Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@candulabs/harbour

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@candulabs/harbour - npm Package Compare versions

Comparing version 0.7.1-alpha.16 to 0.7.1-alpha.17

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## 0.7.1-alpha.17 (2021-04-20)
**Note:** Version bump only for package @candulabs/harbour
## 0.7.1-alpha.16 (2021-04-19)

@@ -8,0 +16,0 @@

2

dist/index.cjs.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("@candulabs/core"),r=require("@candulabs/eventing"),n=require("invariant"),o=require("react-player");require("setimmediate");var a=require("dataloader");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=i(t),c=i(n),s=i(o),l=i(a),d=function(t,e){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function f(t,e){function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var p=function(){return(p=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function v(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function h(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{c(n.next(t))}catch(t){a(t)}}function u(t){try{c(n.throw(t))}catch(t){a(t)}}function c(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(i,u)}c((n=n.apply(t,e||[])).next())}))}function g(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var m=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function b(t){var e={exports:{}};return t(e,e.exports),e.exports}var _="object"==typeof y&&y&&y.Object===Object&&y,E="object"==typeof self&&self&&self.Object===Object&&self,T=_||E||Function("return this")(),S=T.Symbol,I=Object.prototype,O=I.hasOwnProperty,A=I.toString,C=S?S.toStringTag:void 0;var w=function(t){var e=O.call(t,C),r=t[C];try{t[C]=void 0;var n=!0}catch(t){}var o=A.call(t);return n&&(e?t[C]=r:delete t[C]),o},R=Object.prototype.toString;var N=function(t){return R.call(t)},k=S?S.toStringTag:void 0;var x=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":k&&k in Object(t)?w(t):N(t)};var j,D=function(t){if(!m(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},L=T["__core-js_shared__"],P=(j=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+j:"";var F=function(t){return!!P&&P in t},M=Function.prototype.toString;var U=function(t){if(null!=t){try{return M.call(t)}catch(t){}try{return t+""}catch(t){}}return""},G=/^\[object .+?Constructor\]$/,H=Function.prototype,B=Object.prototype,V=H.toString,z=B.hasOwnProperty,Y=RegExp("^"+V.call(z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var W=function(t){return!(!m(t)||F(t))&&(D(t)?Y:G).test(U(t))};var K=function(t,e){return null==t?void 0:t[e]};var J=function(t,e){var r=K(t,e);return W(r)?r:void 0},q=function(){try{var t=J(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var $=function(t,e,r){"__proto__"==e&&q?q(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var Z=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 Q=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var X=function(t){return null!=t&&"object"==typeof t};var tt=function(t){return X(t)&&"[object Arguments]"==x(t)},et=Object.prototype,rt=et.hasOwnProperty,nt=et.propertyIsEnumerable,ot=tt(function(){return arguments}())?tt:function(t){return X(t)&&rt.call(t,"callee")&&!nt.call(t,"callee")},at=Array.isArray;var it=function(){return!1},ut=b((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?T.Buffer:void 0,a=(o?o.isBuffer:void 0)||it;t.exports=a})),ct=/^(?:0|[1-9]\d*)$/;var st=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&ct.test(t))&&t>-1&&t%1==0&&t<e};var lt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},dt={};dt["[object Float32Array]"]=dt["[object Float64Array]"]=dt["[object Int8Array]"]=dt["[object Int16Array]"]=dt["[object Int32Array]"]=dt["[object Uint8Array]"]=dt["[object Uint8ClampedArray]"]=dt["[object Uint16Array]"]=dt["[object Uint32Array]"]=!0,dt["[object Arguments]"]=dt["[object Array]"]=dt["[object ArrayBuffer]"]=dt["[object Boolean]"]=dt["[object DataView]"]=dt["[object Date]"]=dt["[object Error]"]=dt["[object Function]"]=dt["[object Map]"]=dt["[object Number]"]=dt["[object Object]"]=dt["[object RegExp]"]=dt["[object Set]"]=dt["[object String]"]=dt["[object WeakMap]"]=!1;var ft=function(t){return X(t)&&lt(t.length)&&!!dt[x(t)]};var pt=function(t){return function(e){return t(e)}},vt=b((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&_.process,a=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a})),ht=vt&&vt.isTypedArray,gt=ht?pt(ht):ft,mt=Object.prototype.hasOwnProperty;var yt=function(t,e){var r=at(t),n=!r&&ot(t),o=!r&&!n&&ut(t),a=!r&&!n&&!o&&gt(t),i=r||n||o||a,u=i?Q(t.length,String):[],c=u.length;for(var s in t)!e&&!mt.call(t,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||st(s,c))||u.push(s);return u},bt=Object.prototype;var _t=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||bt)};var Et=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Tt=Object.prototype.hasOwnProperty;var St=function(t){if(!_t(t))return Et(t);var e=[];for(var r in Object(t))Tt.call(t,r)&&"constructor"!=r&&e.push(r);return e};var It=function(t){return null!=t&&lt(t.length)&&!D(t)};var Ot=function(t){return It(t)?yt(t):St(t)};var At=function(t,e){return t&&Z(t,e,Ot)};var Ct=function(){this.__data__=[],this.size=0};var wt=function(t,e){return t===e||t!=t&&e!=e};var Rt=function(t,e){for(var r=t.length;r--;)if(wt(t[r][0],e))return r;return-1},Nt=Array.prototype.splice;var kt=function(t){var e=this.__data__,r=Rt(e,t);return!(r<0)&&(r==e.length-1?e.pop():Nt.call(e,r,1),--this.size,!0)};var xt=function(t){var e=this.__data__,r=Rt(e,t);return r<0?void 0:e[r][1]};var jt=function(t){return Rt(this.__data__,t)>-1};var Dt=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 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=Ct,Lt.prototype.delete=kt,Lt.prototype.get=xt,Lt.prototype.has=jt,Lt.prototype.set=Dt;var Pt=Lt;var Ft=function(){this.__data__=new Pt,this.size=0};var Mt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ut=function(t){return this.__data__.get(t)};var Gt=function(t){return this.__data__.has(t)},Ht=J(T,"Map"),Bt=J(Object,"create");var Vt=function(){this.__data__=Bt?Bt(null):{},this.size=0};var zt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Yt=Object.prototype.hasOwnProperty;var Wt=function(t){var e=this.__data__;if(Bt){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Yt.call(e,t)?e[t]:void 0},Kt=Object.prototype.hasOwnProperty;var Jt=function(t){var e=this.__data__;return Bt?void 0!==e[t]:Kt.call(e,t)};var qt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Bt&&void 0===e?"__lodash_hash_undefined__":e,this};function $t(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])}}$t.prototype.clear=Vt,$t.prototype.delete=zt,$t.prototype.get=Wt,$t.prototype.has=Jt,$t.prototype.set=qt;var Zt=$t;var Qt=function(){this.size=0,this.__data__={hash:new Zt,map:new(Ht||Pt),string:new Zt}};var Xt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var te=function(t,e){var r=t.__data__;return Xt(e)?r["string"==typeof e?"string":"hash"]:r.map};var ee=function(t){var e=te(this,t).delete(t);return this.size-=e?1:0,e};var re=function(t){return te(this,t).get(t)};var ne=function(t){return te(this,t).has(t)};var oe=function(t,e){var r=te(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ae(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])}}ae.prototype.clear=Qt,ae.prototype.delete=ee,ae.prototype.get=re,ae.prototype.has=ne,ae.prototype.set=oe;var ie=ae;var ue=function(t,e){var r=this.__data__;if(r instanceof Pt){var n=r.__data__;if(!Ht||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ie(n)}return r.set(t,e),this.size=r.size,this};function ce(t){var e=this.__data__=new Pt(t);this.size=e.size}ce.prototype.clear=Ft,ce.prototype.delete=Mt,ce.prototype.get=Ut,ce.prototype.has=Gt,ce.prototype.set=ue;var se=ce;var le=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var de=function(t){return this.__data__.has(t)};function fe(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new ie;++e<r;)this.add(t[e])}fe.prototype.add=fe.prototype.push=le,fe.prototype.has=de;var pe=fe;var ve=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 he=function(t,e){return t.has(e)};var ge=function(t,e,r,n,o,a){var i=1&r,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var s=a.get(t),l=a.get(e);if(s&&l)return s==e&&l==t;var d=-1,f=!0,p=2&r?new pe:void 0;for(a.set(t,e),a.set(e,t);++d<u;){var v=t[d],h=e[d];if(n)var g=i?n(h,v,d,e,t,a):n(v,h,d,t,e,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!ve(e,(function(t,e){if(!he(p,e)&&(v===t||o(v,t,r,n,a)))return p.push(e)}))){f=!1;break}}else if(v!==h&&!o(v,h,r,n,a)){f=!1;break}}return a.delete(t),a.delete(e),f},me=T.Uint8Array;var ye=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var be=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},_e=S?S.prototype:void 0,Ee=_e?_e.valueOf:void 0;var Te=function(t,e,r,n,o,a,i){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!a(new me(t),new me(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return wt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=ye;case"[object Set]":var c=1&n;if(u||(u=be),t.size!=e.size&&!c)return!1;var s=i.get(t);if(s)return s==e;n|=2,i.set(t,e);var l=ge(u(t),u(e),n,o,a,i);return i.delete(t),l;case"[object Symbol]":if(Ee)return Ee.call(t)==Ee.call(e)}return!1};var Se=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Ie=function(t,e,r){var n=e(t);return at(t)?n:Se(n,r(t))};var Oe=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 Ae=function(){return[]},Ce=Object.prototype.propertyIsEnumerable,we=Object.getOwnPropertySymbols,Re=we?function(t){return null==t?[]:(t=Object(t),Oe(we(t),(function(e){return Ce.call(t,e)})))}:Ae;var Ne=function(t){return Ie(t,Ot,Re)},ke=Object.prototype.hasOwnProperty;var xe=function(t,e,r,n,o,a){var i=1&r,u=Ne(t),c=u.length;if(c!=Ne(e).length&&!i)return!1;for(var s=c;s--;){var l=u[s];if(!(i?l in e:ke.call(e,l)))return!1}var d=a.get(t),f=a.get(e);if(d&&f)return d==e&&f==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=i;++s<c;){var h=t[l=u[s]],g=e[l];if(n)var m=i?n(g,h,l,e,t,a):n(h,g,l,t,e,a);if(!(void 0===m?h===g||o(h,g,r,n,a):m)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){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||(p=!1)}return a.delete(t),a.delete(e),p},je=J(T,"DataView"),De=J(T,"Promise"),Le=J(T,"Set"),Pe=J(T,"WeakMap"),Fe=U(je),Me=U(Ht),Ue=U(De),Ge=U(Le),He=U(Pe),Be=x;(je&&"[object DataView]"!=Be(new je(new ArrayBuffer(1)))||Ht&&"[object Map]"!=Be(new Ht)||De&&"[object Promise]"!=Be(De.resolve())||Le&&"[object Set]"!=Be(new Le)||Pe&&"[object WeakMap]"!=Be(new Pe))&&(Be=function(t){var e=x(t),r="[object Object]"==e?t.constructor:void 0,n=r?U(r):"";if(n)switch(n){case Fe:return"[object DataView]";case Me:return"[object Map]";case Ue:return"[object Promise]";case Ge:return"[object Set]";case He:return"[object WeakMap]"}return e});var Ve=Be,ze="[object Object]",Ye=Object.prototype.hasOwnProperty;var We=function(t,e,r,n,o,a){var i=at(t),u=at(e),c=i?"[object Array]":Ve(t),s=u?"[object Array]":Ve(e),l=(c="[object Arguments]"==c?ze:c)==ze,d=(s="[object Arguments]"==s?ze:s)==ze,f=c==s;if(f&&ut(t)){if(!ut(e))return!1;i=!0,l=!1}if(f&&!l)return a||(a=new se),i||gt(t)?ge(t,e,r,n,o,a):Te(t,e,c,r,n,o,a);if(!(1&r)){var p=l&&Ye.call(t,"__wrapped__"),v=d&&Ye.call(e,"__wrapped__");if(p||v){var h=p?t.value():t,g=v?e.value():e;return a||(a=new se),o(h,g,r,n,a)}}return!!f&&(a||(a=new se),xe(t,e,r,n,o,a))};var Ke=function t(e,r,n,o,a){return e===r||(null==e||null==r||!X(e)&&!X(r)?e!=e&&r!=r:We(e,r,n,o,t,a))};var Je=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 se;if(n)var f=n(s,l,c,t,e,d);if(!(void 0===f?Ke(l,s,3,n,d):f))return!1}}return!0};var qe=function(t){return t==t&&!m(t)};var $e=function(t){for(var e=Ot(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,qe(o)]}return e};var Ze=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var Qe=function(t){var e=$e(t);return 1==e.length&&e[0][2]?Ze(e[0][0],e[0][1]):function(r){return r===t||Je(r,t,e)}};var Xe=function(t){return"symbol"==typeof t||X(t)&&"[object Symbol]"==x(t)},tr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,er=/^\w*$/;var rr=function(t,e){if(at(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Xe(t))||(er.test(t)||!tr.test(t)||null!=e&&t in Object(e))};function nr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");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(nr.Cache||ie),r}nr.Cache=ie;var or=nr;var ar=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,ur=function(t){var e=or(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ar,(function(t,r,n,o){e.push(n?o.replace(ir,"$1"):r||t)})),e}));var cr=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=S?S.prototype:void 0,lr=sr?sr.toString:void 0;var dr=function t(e){if("string"==typeof e)return e;if(at(e))return cr(e,t)+"";if(Xe(e))return lr?lr.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var fr=function(t){return null==t?"":dr(t)};var pr=function(t,e){return at(t)?t:rr(t,e)?[t]:ur(fr(t))};var vr=function(t){if("string"==typeof t||Xe(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var hr=function(t,e){for(var r=0,n=(e=pr(e,t)).length;null!=t&&r<n;)t=t[vr(e[r++])];return r&&r==n?t:void 0};var gr=function(t,e,r){var n=null==t?void 0:hr(t,e);return void 0===n?r:n};var mr=function(t,e){return null!=t&&e in Object(t)};var yr=function(t,e,r){for(var n=-1,o=(e=pr(e,t)).length,a=!1;++n<o;){var i=vr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&lt(o)&&st(i,o)&&(at(t)||ot(t))};var br=function(t,e){return null!=t&&yr(t,e,mr)};var _r=function(t,e){return rr(t)&&qe(e)?Ze(vr(t),e):function(r){var n=gr(r,t);return void 0===n&&n===e?br(r,t):Ke(e,n,3)}};var Er=function(t){return t};var Tr=function(t){return function(e){return null==e?void 0:e[t]}};var Sr=function(t){return function(e){return hr(e,t)}};var Ir=function(t){return rr(t)?Tr(vr(t)):Sr(t)};var Or=function(t){return"function"==typeof t?t:null==t?Er:"object"==typeof t?at(t)?_r(t[0],t[1]):Qe(t):Ir(t)};var Ar=function(t,e){var r={};return e=Or(e),At(t,(function(t,n,o){$(r,n,e(t,n,o))})),r};function Cr(t){var e=t.name,r=t.actions,n=t.selectors,o=v(t,["name","actions","selectors"]);return p(p({},o),{actions:Ar(r||{},(function(t,r){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return p({type:r,storeName:e},t.apply(void 0,n))}})),selectors:Ar(n||{},(function(t){function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return{storeName:e,selector:t.apply(void 0,r)}}return r.storeName=e,r.selector=t,r})),name:e})}function wr(t){var e=t.name,r=t.initialValue,n=t.reducer,o=r,a=[];return{name:e,getState:function(){return o},subscribe:function(t){return a.push(t),function(){a=a.filter((function(e){return e!==t}))}},dispatch:function(t){var e=o;return"object"==typeof e&&null!==e?e=p({},o):Array.isArray(e)&&(e=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var a=arguments[e],i=0,u=a.length;i<u;i++,o++)n[o]=a[i];return n}(o)),o=n(t,o),a.forEach((function(r){return r(o,e,t)})),this}}}function Rr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.fromEntries(t.map((function(t){return[t.name,t]})));return{name:"root",getFluxState:function(t){var e=this.getStore(t);if(!e)throw new Error("rootState.getFluxState: the flux store "+t.name+" does not exist");return e.getState()},getState:function(){return Ar(r,(function(t){return t.getState()}))},getStore:function(t){var e="string"==typeof t?t:t.name;return r[e]},registerFlux:function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter((function(t){var e=t.name;return!r[e]})).forEach((function(e){return t.register(wr(e))})),this},register:function(t){return r[t.name]=t,this},dispatch:function(t){t.storeName?r[t.storeName].dispatch(t):Object.values(r).forEach((function(e){return e.dispatch(t)}))},remove:function(t){return delete r[t.name],this},select:function(t){var e;return t.selector(null===(e=r[t.storeName])||void 0===e?void 0:e.getState())}}}var Nr=function(t){return{loading:!1,result:t,error:void 0,loadTime:0}},kr=Cr({name:"config",initialValue:{clientToken:"",options:{},styleguide:{}},actions:{set:function(t){return{payload:t}}},selectors:{styleguide:function(t){return t.styleguide},clientToken:function(t){return t.clientToken}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e}}),xr=Cr({name:"eventing",initialValue:r.noOpEventing,actions:{set:function(t){return{eventing:t}}},selectors:{state:function(t){return t}},reducer:function(t,e){var r=t.type,n=t.eventing;return"set"===r?n:e}}),jr=Cr({name:"user",initialValue:{userId:r.getAnonymousId(),traits:{}},actions:{set:function(t){return{payload:t}}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e},selectors:{userId:function(t){return t.userId}}}),Dr=function(t){return localStorage.setItem("candu.segmentMembership",JSON.stringify(t))},Lr=Cr({name:"segmentMembership",initialValue:Nr(function(){try{var t=localStorage.getItem("candu.segmentMembership"),e=t&&JSON.parse(t);if(!e)return;return{id:"",segmentIds:e}}catch(t){return}}()),actions:{loading:function(){return{}},success:function(t){return t},error:function(t){return t}},selectors:{segmentIds:function(t){var e;return null===(e=t.result)||void 0===e?void 0:e.segmentIds}},reducer:function(t,e){var r=t.type,n=t.result,o=t.loadTime,a=t.error;switch(r){case"loading":return p(p({},e),{loading:!0});case"success":return Dr(n.segmentIds),p(p({},e),{loading:!1,error:void 0,result:n,loadTime:o});case"error":return{loading:!1,result:void 0,error:a,loadTime:o};default:return e}}});var Pr={name:"@candulabs/harbour",version:"0.7.1-alpha.16"},Fr="/api/checklistItems",Mr="/api/cards";function Ur(t,n){n.registerFlux(kr,jr,xr,Lr);var o=function(t,r){var n=t.clientToken,o=t.userId,a=t.traits,i=t.options,u=t.styleguide,s=v(t,["clientToken","userId","traits","options","styleguide"]);c.default(e.isClientToken(n),"(Candu) you must provide a valid clientToken"),c.default(!o||e.isUserId(o),"(Candu) you must provide a valid userId"),c.default(!a||m(a),"(Candu) traits must be undefined or an object"),c.default(!i||m(i),"(Candu) options must be undefined or an object"),c.default(!u||m(u),"(Candu) styleguide must be undefined or an object");var l=r.getFluxState(jr);return p(p({},s),{clientToken:n,traits:a||l.traits||{},options:i||{},styleguide:u||{},userId:o||l.userId})}(t,n),a=o.clientToken,i=o.userId,u=o.traits,s=o.styleguide,l=o.options,d=r.eventingFactory(a,i,l,Pr);e.internalEventing(d).provider({userId:i,traits:u,styleguide:s}),n.dispatch(jr.actions.set({userId:i,traits:u})),n.dispatch(xr.actions.set(d)),n.dispatch(kr.actions.set({clientToken:a,options:l,styleguide:s})),e.attachStylesheet(a),function(t){var r=t.getFluxState(kr),n=r.clientToken,o=r.options,a=t.getFluxState(jr).userId,i=t.getFluxState(xr);if(o.skipLoading||o.overrideSegmentMemberships){var u={id:a,segmentIds:o.overrideSegmentMemberships||[]};t.dispatch(Lr.actions.success({result:u,loadTime:0}))}else{var c=performance.now();t.dispatch(Lr.actions.loading()),e.RESOURCES.segmentMembership(n,a).then((function(r){var n=performance.now()-c;i.track(e.METRICS.SEGMENT_MEMBERSHIP_LOAD_TIME,{value:n}),t.dispatch(Lr.actions.success({result:r,loadTime:n}))})).catch((function(e){return t.dispatch(Lr.actions.error({error:e,loadTime:performance.now()-c}))}))}}(n)}var Gr=u.default.createContext(Rr()),Hr=function(){return t.useContext(Gr)},Br=function(t){function e(e){var r=t.call(this,e)||this;r.state=Rr();var n=r.props;return n.children,Ur(v(n,["children"]),r.state),r}return f(e,t),e.prototype.render=function(){return u.default.createElement(Gr.Provider,{value:this.state},this.props.children)},e}(u.default.Component),Vr=function(t){return function(e){var r;return(r=function(r){function n(t){var e=r.call(this,t)||this;return e.unsubscribes=[],e.handleChange=e.handleChange.bind(e),e}return f(n,r),n.prototype.componentDidMount=function(){var e=this;this.handleChange();var r=Object.values(t(this.context,this.props)).map((function(t){var r=t.storeName;return e.context.getStore(r).subscribe}));this.unsubscribes=r.map((function(t){return t(e.handleChange)}))},n.prototype.componentWillUnmount=function(){this.unsubscribes.forEach((function(t){return t()}))},n.prototype.mapStateToProps=function(){var e=this;return Ar(t(this.context,this.props),(function(t){return t.selector&&t.storeName?e.context.select(t):t}))},n.prototype.handleChange=function(){this.setState(this.mapStateToProps())},n.prototype.render=function(){return u.default.createElement(e,p({},this.state||this.mapStateToProps(),this.props))},n}(u.default.Component)).contextType=Gr,r}},zr=Cr({name:"stateProviders",initialValue:{},actions:{set:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{providers:t}}},selectors:{provider:function(t){return function(e){return e[t]}}},reducer:function(t,e){var r=t.type,n=t.providers;switch(r){case"set":return p(p({},e),Object.fromEntries(n.map((function(t){return[t.providerId,t]}))));default:return e}}}),Yr=function(){try{var t=localStorage.getItem("candu.tutorials");return t?JSON.parse(t):{}}catch(t){return{}}},Wr=Cr({name:"tutorialDocuments",initialValue:Ar(Yr(),Nr),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{tutorialDocument:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return p(p({},e),((r={})[i]=p(p({},Nr()),{loading:!0}),r));case"success":return function(t,e){var r=Yr();r[t]=e,localStorage.setItem("candu.tutorials",JSON.stringify(r))}(i,u),p(p({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return p(p({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});var Kr,Jr=["div","a","p"],qr={Fragment:t.Fragment,Document:t.Fragment},$r="#6310E5",Zr="#59C3C3",Qr="#4D515D",Xr="#FCAD0D",tn="#EE4266",en=function(e){c.default(m(e),"(createStyleguide) styleguide must be undefined or an object");return{getComponent:function(r){var n=function(t){if(e[t])return e[t];if(qr[t])return qr[t];var r=Jr.indexOf(t)||Jr.indexOf(t.toLowerCase());return Jr[r]}(r);return"string"==typeof n?function(t){var e=t.api,r=t.attributes;return u.default.createElement(n,p({key:e.nodeId},r))}:n===t.Fragment?function(e){var r=e.api,n=e.attributes;return u.default.createElement(t.Fragment,{key:r.nodeId},n.children)}:n},all:function(){return e}}},rn={borderRadius:"4px",padding:"8px"},nn=function(t){switch(t){case"success":return $r;case"active":return Zr;case"warning":return Xr;case"danger":return tn;default:return Qr}},on=function(){return u.default.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("path",{d:"M6 6L18 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}),u.default.createElement("path",{d:"M18 6L6 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}))},an=function(){return Hr().getFluxState(xr)},un={borderRadius:"4px",padding:"8px",backgroundColor:"rgb(51, 55, 69)",color:"rgb(255, 255, 255)",overflow:"auto"},cn={display:"flex"},sn={flex:"1 1"},ln={maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"};!function(t){t.Ordered="OL",t.Unordered="UL"}(Kr||(Kr={}));var dn,fn={backgroundColor:"transparent",border:"none",borderTop:"1px solid #edeff3",height:"0"},pn=function(t){return function(r){var n,o=r.attributes,a=["h1","h2","h3","h4","p"].includes(t);a&&(n={variant:t.toUpperCase()});var i=e.toCssSelector(a?"typography":t,{variant:n,output:"html"});return u.default.createElement(t,p({},o,{className:i}))}},vn=function(t){var e=pn("div");return u.default.createElement(e,p({},t))},hn="640px",gn="360px",mn={border:"1px solid var(--color-lines)",borderRadius:"4px",marginBottom:"16px",backgroundColor:"white",display:"flex",flexDirection:"column"},yn={padding:"16px",display:"flex",flexDirection:"row",alignItems:"center",flexGrow:1,boxSizing:"border-box",color:"var(--color-neutral)"},bn={padding:"16px 48px",display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",transition:"all .35s ease-out 0s"},_n={borderRadius:"20px",height:"32px",width:"32px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",marginRight:"16px",appearance:"none",outline:"none",padding:0,transition:"all .1s ease-out 0s"},En={appearance:"none",border:"none",outline:"none",cursor:"pointer",background:"none",padding:"0px",display:"flex"},Tn={marginBottom:"48px"},Sn={width:"100%",height:"4px",marginBottom:"16px",backgroundColor:"#EDEFF3"},In={height:"100%",backgroundColor:"#59C3C3",transition:"all .35s ease-out 0s"},On=function(t){var e=t.direction;return u.default.createElement("svg",{style:{transition:"all .35s ease-out 0s",transform:"rotateZ("+("up"===e?"180deg":"0deg")+")"},width:"18",height:"11",viewBox:"0 0 18 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("path",{d:"M9 6.74488L3.09046 0.555221C2.39741 -0.170679 1.25783 -0.186906 0.545126 0.518977C-0.167576 1.22486 -0.183508 2.38555 0.509541 3.11145L7.37034 10.2975L7.37166 10.2988C8.26633 11.2347 9.73727 11.2336 10.6306 10.2965L17.4905 3.11145C18.1835 2.38555 18.1676 1.22486 17.4549 0.518977C16.7422 -0.186906 15.6026 -0.170679 14.9095 0.555221L9 6.74488Z",fill:"#D4D8E4"}))},An=((dn={})[e.CheckListItemStatus.NotStared]={title:"Not Started",statusStyle:{backgroundColor:"#EDEFF3",borderColor:"#D4D8E4"},icon:{path:"M 2 6.55 L 5 6.55 L 10 6.55",stroke:"#9498A7"}},dn[e.CheckListItemStatus.InProgress]={title:"In Progress",statusStyle:{backgroundColor:"#FE8A3A",borderColor:"white"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"white"}},dn[e.CheckListItemStatus.Done]={title:"Completed",statusStyle:{backgroundColor:"#CFF5F5",borderColor:"#6DD8D8"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"#46AEAE"}},dn),Cn=function(e){var r=e.onChangeStatus,n=e.status,o=t.useState(!1),a=o[0],i=o[1],c=p(p(p({},_n),An[n].statusStyle),{border:(a?"1px":"0px")+" solid "+An[n].statusStyle.borderColor}),s=An[n].title,l=An[n].icon;return u.default.createElement("button",{type:"button",onClick:function(t){r(),t.stopPropagation()},style:c,title:s,onMouseOver:function(){return i(!0)},onFocus:function(){return i(!0)},onMouseOut:function(){return i(!1)},onBlur:function(){return i(!1)}},u.default.createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("path",{d:l.path,stroke:l.stroke,strokeWidth:"2.5",strokeLinecap:"round",style:{transition:"all .1s ease-out 0s"}})))},wn=[e.CheckListItemStatus.NotStared,e.CheckListItemStatus.Done],Rn=function(t){var e=t.expanded,r=t.children,n=e?bn:p(p({},bn),{maxHeight:0,padding:"0px 48px"});return u.default.createElement("div",{style:n},r)},Nn={Alert:function(t){var e=t.attributes,r=e.intent,n=e.title,o=e.description;return u.default.createElement("div",p({},e,{style:p(p(p({},rn),e.style),{color:"#FFF",backgroundColor:nn(r)||"#EDEDED"})}),n,u.default.createElement("div",null,u.default.createElement("small",null,o)))},B:function(t){var e=pn("b");return u.default.createElement(e,p({},t))},Badge:function(t){var r=t.attributes,n=r.color,o=r.outline,a=v(r,["color","outline"]),i=e.toCssSelector("badge",{variant:{color:n,outline:o},output:"html"});return u.default.createElement("span",p({},a,{className:i}))},Button:function(t){var r=t.attributes;return u.default.createElement("button",p({type:"button"},r,{className:e.toCssSelector("button",{variant:{color:r.color,outline:r.outline},output:"html"}),style:p({},r.style||{})}))},Card:function(r){var n=r.attributes,o=n.children,a=n.isDismissible,i=v(n,["children","isDismissible"]),c=r.api,s=an(),l=e.toCssSelector("card",{output:"html"}),d=t.useMemo((function(){var t;return null===(t=c.stateInstances)||void 0===t?void 0:t.find((function(t){return t.resolver instanceof e.CardResolverInstance}))}),[]),f=t.useState({dismissed:!1}),h=f[0],g=f[1];return t.useLayoutEffect((function(){if(d)return d.subscribe((function(t){g(t.state)}))}),[d]),h.dismissed?null:u.default.createElement("div",p({},i,{className:l,style:p({position:"relative"},i.style)}),a&&u.default.createElement("a",{style:{position:"absolute",top:"6px",right:"6px",cursor:"pointer"},onClick:function(){d?(s.track(e.EVENT_NAMES.TUTORIAL_INTERACTION,p({category:e.CATEGORIES.NATIVE,trigger:e.TRIGGERS.ON_CLICK,handler:{type:e.HANDLER_TYPES.DISMISSED_CARD,cardId:c.nodeId},eventName:"DismissedCard_"+c.nodeId},c.trackingIdentifiers)),d.mutate({id:d.providerId,state:{dismissed:!0}})):e.logger.warning("Card state provider not found")}},u.default.createElement(on,null)),o)},Code:function(t){var e=t.attributes,r=e.children,n=v(e,["children"]);return u.default.createElement("div",p({},n,{style:p(p({},un),n.style||{})}),u.default.createElement("pre",{style:{color:"rgb(255, 255, 255)"}},r))},Document:function(t){var e=t.attributes,r=v(t,["attributes"]),n=e.style;return u.default.createElement(vn,p({},r,{attributes:p(p({},e),{style:p(p({},{overflow:"auto",maxWidth:"100%",maxHeight:"100%",boxSizing:"border-box"}),n)})}))},Em:function(t){var e=pn("em");return u.default.createElement(e,p({},t))},EmbedPortal:function(t){var r=t.attributes,n=r.slug,o=r.style,a=t.api;return u.default.createElement("div",{className:e.CANDU_PORTAL_CLASS,style:o},a.render.portal({slug:n}))},EmbedTutorial:function(t){var e=t.attributes,r=e.id,n=e.slug,o=e.style,a=t.api;return u.default.createElement("div",{style:o},a.render.tutorial({tutorialId:r,slug:n}))},Flex:function(t){var e=t.attributes;return u.default.createElement("div",p({},e,{style:p(p({},cn),e.style)}))},FlexItem:function(t){var e=t.attributes;return u.default.createElement("div",p({},e,{style:p(p({},sn),e.style)}))},H1:function(t){var e=pn("h1");return u.default.createElement(e,p({},t))},H2:function(t){var e=pn("h2");return u.default.createElement(e,p({},t))},H3:function(t){var e=pn("h3");return u.default.createElement(e,p({},t))},H4:function(t){var e=pn("h4");return u.default.createElement(e,p({},t))},H5:function(t){var e=pn("h5");return u.default.createElement(e,p({},t))},H6:function(t){var e=pn("h6");return u.default.createElement(e,p({},t))},Image:function(t){var e=t.attributes,r=e.width,n=e.height,o=e.src,a=e.className,i=e.alt,c=e.style,s=t.api,l=s.nodeId,d=s.document;return!!d&&!!l&&d.nodes[l].props?u.default.createElement("img",{alt:i||"",src:o,className:a,style:p(p(p({},ln),c),{width:r||ln.width,height:n||ln.height})}):null},InlineCode:function(t){var e=pn("code");return u.default.createElement(e,p({},t))},Link:function(t){var r=t.attributes,n=r.href,o=r.target,a=v(r,["href","target"]),i=e.toCssSelector("link",{output:"html"});return u.default.createElement("a",p({},a,{className:i,href:n,target:n.includes("http")&&!o?"_blank":o}))},List:function(t){var e=t.attributes,r=t.api,n=r.nodeId,o=(r.document.nodes[n]||{}).data;return o&&o.custom&&o.custom.variant===Kr.Unordered?u.default.createElement("ul",p({},e)):u.default.createElement("ol",p({},e))},ListItem:function(t){var r=t.attributes,n=e.toCssSelector("typography",{variant:{variant:"P"},output:"html"});return u.default.createElement("li",p({},r,{className:n}))},P:function(t){var e=pn("p");return u.default.createElement(e,p({},t))},RichText:vn,Spacing:function(t){var e=t.attributes;return u.default.createElement("hr",p({},e,{style:p(p({},fn),e.style)}))},Text:function(e){var r=e.attributes,n=e.api,o=n.nodeId,a=n.document,i=!!a&&!!o&&a.nodes[o],c=u.default.createElement(t.Fragment,null,r.children);if(!i)return c;var s=i.data&&i.data.custom&&at(i.data.custom.marks)?i.data.custom.marks:[];return 0===s.length?c:c=s.reduce((function(t,e){return n.render.styleguide(e,p(p({},r),{children:t}))}),c)},U:function(t){var e=pn("u");return u.default.createElement(e,p({},t))},View:vn,Player:function(t){var r=t.attributes,n=r.width,o=r.height,a=r.src,i=v(r,["width","height","src"]);return u.default.createElement(s.default,p({},i,{controls:!0,url:a,width:n||hn,height:o||gn,onError:e.logError}))},CheckList:function(t){var e=t.attributes,r=e.children,n=v(e,["children"]);return u.default.createElement("div",p({},n),r)},CheckListGroup:function(r){var n=r.attributes,o=n.children,a=n.title,i=n.style,c=n.className,s=n.onClick,l=r.api,d=l.childrenStateInstances,f=l.trackingIdentifiers,v=l.node.data,h=an(),g=e.getCheckListStateProviders(d||[]),m=g.length,y=t.useState(e.getInitialItems(g)),b=y[0],_=y[1];t.useEffect((function(){var t=g.map((function(t,e){return t.subscribe((function(t){_((function(r){var n;return p(p({},r),((n={})[t.id]={position:e,status:t.state},n))}))}))}));return function(){t.map((function(t){return t()}))}}),g);var E=e.calculateGroupCompletion(b,m).percComplete;t.useEffect((function(){var t,r;100===E&&h.track(e.EVENT_NAMES.CHECKLIST_GROUP_COMPLETE,p({title:a,groupId:null===(r=null===(t=v)||void 0===t?void 0:t.custom)||void 0===r?void 0:r.groupId},f))}),[E]);var T=e.getFirstNotStartedItem(b,m),S=e.toCssSelector("typography",{variant:{variant:"H4"},output:"html"});return u.default.createElement("div",{className:c,onClick:s,style:p(p({},Tn),i)},u.default.createElement("h4",{className:S},a),u.default.createElement("div",{style:Sn},u.default.createElement("div",{style:p(p({},In),{width:E+"%"})})),!!o&&u.default.Children.map(o,(function(t,e){return u.default.cloneElement(t,{expandByDefault:e===T})})))},CheckListItem:function(r){var n=r.attributes,o=n.title,a=n.style,i=n.children,c=v(n,["title","style","children"]),s=r.api,l=s.stateInstances,d=s.trackingIdentifiers,f=r.expandByDefault,h=an(),g=t.useState(e.CheckListItemStatus.NotStared),m=g[0],y=g[1],b=t.useState(!!f),_=b[0],E=b[1];if(!l)throw new Error("no state provided");var T=function(t){var r=t.find((function(t){return t.resolver instanceof e.CheckListResolverInstance}));if(!r)throw new Error("Couldn't find CheckListApi state provider");return r}(l);t.useEffect((function(){return T.subscribe((function(t){y(t.state)}))}),[T]),t.useEffect((function(){i&&E(!!f)}),[f]);var S=p(p({},yn),{borderBottom:i&&_?"1px solid var(--color-lines)":"none"}),I={flexGrow:1,fontWeight:600,cursor:i?"pointer":"auto"},O=e.toCssSelector("typography",{variant:{variant:"P"},output:"html"}),A=function(t){E(!_),t.stopPropagation()};return u.default.createElement("div",p({style:p(p({},mn),a)},c),u.default.createElement("div",{style:S,onClick:i&&A},u.default.createElement(Cn,{onChangeStatus:function(){var t=function(t){return wn[(wn.indexOf(t)+1)%wn.length]}(m);T.mutate({state:t}),h.track(e.EVENT_NAMES.CHECKLIST_ITEM_STATE_UPDATED,p({itemId:T.providerId,state:t,title:o},d))},status:m}),u.default.createElement("div",{className:O,style:I},o),i&&u.default.createElement("button",{type:"button",onClick:A,style:En},u.default.createElement(On,{direction:_?"up":"down"}))),i&&u.default.createElement(Rn,{expanded:_},i))}},kn=or((function(t,r){return en(e.mergeStyleguidesFromContext(t,r))})),xn=function(){try{var t=localStorage.getItem("candu.portals");return t?JSON.parse(t):{}}catch(t){return{}}},jn=Cr({name:"portal",initialValue:Ar(xn(),Nr),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{portalAsset:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return p(p({},e),((r={})[i]=p(p({},Nr()),{loading:!0}),r));case"success":return function(t,e){xn()[t]=e,localStorage.setItem("candu.portals",JSON.stringify(e))}(i,u),p(p({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return p(p({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});function Dn(t,r){var n=t.slug;c.default(e.isIdentifier(n),"(Portal) You must supply a valid slug");var o=r.getFluxState(kr).clientToken,a=r.select(Lr.selectors.segmentIds);if(a){r.registerFlux(jn);var i=r.select(jn.selectors.portalAsset(n)),u=r.select(jn.selectors.isLoadingOrHasErrors(n));if(!i&&!u){var s=performance.now(),l=function(t,e,r){return h(void 0,void 0,void 0,(function(){var n;return g(this,(function(o){return n="?segmentIds="+(r||[]).join(","),[2,fetch("https://cdn.candu.ai/portalMemberships/"+t+"/"+e+"/head.json"+n)]}))}))}(o,n,a);l&&(r.dispatch(jn.actions.loading(n)),l.then((function(t){return r.dispatch(jn.actions.success({slug:n,result:t,loadTime:performance.now()-s}))})).catch((function(t){return r.dispatch(jn.actions.error({slug:n,error:t,loadTime:performance.now()-s}))})),r.registerFlux(jn))}}}var Ln,Pn,Fn=function(t){var e=t.tutorialDocument;return e?u.default.createElement(Uo,{tutorialDocument:e}):null},Mn=function(t,e){return{tutorialDocument:jn.selectors.portalAsset(e.slug)}},Un=function(t){Dn(t,Hr());var e=Vr(Mn)(Fn);return u.default.createElement(e,p({},t))},Gn=function(t){return"candu.sdk."+t},Hn=function(t){return Gn("error."+t)},Bn="unknown_node_type",Vn="unkown_inline_node_type",zn="unkown_node_object_type",Yn="tutorial_error_boundary",Wn="portal_error_boundary",Kn="provider_error_boundary",Jn={HEARTBEAT:Gn("heartbeat"),PREVIEW_OPEN:Gn("preview.open"),PORTAL:Gn("portal"),TUTORIAL:Gn("tutorial"),TUTORIAL_INTERACTION:Gn("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Hn("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Hn("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Hn("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Hn("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Hn("commit_api"),TUTORIAL_LOADING_ERROR:Hn("tutorial"),UNKOWN_NODE_TYPE:Hn(Bn),UNKOWN_INLINE_NODE_TYPE:Hn(Vn),UNKOWN_NODE_OBJECT_TYPE:Hn(zn),TUTORIAL_ERROR:Hn(Yn),PORTAL_ERROR:Hn(Wn),PROVIDER_ERROR:Hn(Kn),STYLEGUIDE_MAP_ERROR:Hn(Yn),RENDER_NODE_ERROR:Hn(Yn),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Hn("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Hn("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Hn("state_fetch_failed"),STATE_UPDATE_FAILED:Hn("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Hn("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:Gn("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:Gn("tutorial.checklist_group_complete"),CARD_DISMISSED:Gn("tutorial.card_dismissed")},qn=function(t){return"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+"."},$n=((Ln={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"})[Jn.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[Jn.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[Jn.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",Ln[Jn.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",Ln[Jn.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",Ln[Jn.UNKOWN_INLINE_NODE_TYPE]=qn(Vn),Ln[Jn.UNKOWN_NODE_TYPE]=qn(Bn),Ln[Jn.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Ln[Jn.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Ln[Jn.PORTAL_ERROR]="An error has occured within Portal",Ln[Jn.PROVIDER_ERROR]="An error has occured within Provider",Ln[Jn.TUTORIAL_ERROR]="An error has occured within Tutorial",Ln[Jn.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",Ln[Jn.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",Ln[Jn.STATE_FETCH_FAILED]="An error has occured while fetching state:",Ln[Jn.STATE_UPDATE_FAILED]="An error has occured while updating state:",Ln[Jn.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",Ln),Zn=function(t){switch(t.trigger){case e.TRIGGERS.ON_CLICK:default:return"onClick"}},Qn=function(t,r,n){var o,a,i;switch(t.handler.type){case e.HANDLER_TYPES.NAVIGATE:return(o={})[Zn(t)]=function(e){e.stopPropagation();var o=t.handler,a=o.href,i=o.target,u=n||{},c=u.parentTrackers,s=v(u,["parentTrackers"]);c&&c.forEach((function(e){return r(t,e)})),r(t,s),"Blank"===i?window.open(a,"_blank"):a&&a.includes("mailto:")?window.location=a:document.location.href=a},o;case e.HANDLER_TYPES.CHANGE_TUTORIAL:return(a={})[Zn(t)]=function(){var r=t.handler.tutorialId;e.logger.error("TODO -> change tutorial",r)},a;case e.HANDLER_TYPES.OPEN_GUIDE:return(i={})[Zn(t)]=function(){var r=t.handler.guideId;e.logger.error("TODO -> open guide",r)},i;default:return{}}},Xn=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},to=function(t,e){var r=t.states;return Object.keys(r||{}).map((function(t){return e.select(zr.selectors.provider(t))}))},eo=function(t,e,r){var n=t.nodes;return n&&n.map((function(t){return e.nodes[t]})).filter((function(t){return!!t})).map((function(t){return to(t,r)||[]})).reduce((function(t,e){return t.concat(e)}),[])},ro=function(t,r,n){var o=r.getFluxState(xr);try{var a=n.document,i=a.nodes[t];if(!i)return e.logger.error("Document is corrupted. Refusing to move further."),null;var u=function(t){return ro(t,r,n)},c=i.type,s=i.props,l=i.css,d=p(p(p({},s||{}),{style:l||{},children:Xn(i,u)}),function(t,r,n){var o,a,i,u,c,s,l=r.getFluxState(xr);if("Link"===t.type&&(null===(o=t.props)||void 0===o?void 0:o.href)){var d=t.props.href+" Link Clicked",f=null===(i=null===(a=t)||void 0===a?void 0:a.nodes)||void 0===i?void 0:i[0];if(f){var v=n.nodes[f];"Text"===(null===(u=v)||void 0===u?void 0:u.type)&&(null===(s=null===(c=v)||void 0===c?void 0:c.props)||void 0===s?void 0:s.children)&&(d=v.props.children+" Link Clicked")}return{onClick:function(){var r;return l.track(Jn.TUTORIAL_INTERACTION,{trigger:e.TRIGGERS.ON_CLICK,category:t.type,eventName:d,handler:{href:null===(r=t.props)||void 0===r?void 0:r.href,type:e.HANDLER_TYPES.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var h=function(t,e){l.track(Jn.TUTORIAL_INTERACTION,p(p({},t),e||{}))};return t.data.actions.map((function(t){return Qn(t,h,{})})).reduce((function(t,e){return p(p({},t),e)}),{})}(i,r,a)),f={nodeId:t,node:i,document:a,render:{node:u,styleguide:function(t,e){return void 0===e&&(e={}),n.renderNode(t,{api:f,attributes:e})},tutorial:function(t){return n.renderTutorial(t)},portal:function(t){return n.renderPortal(t)}},trackingIdentifiers:{},stateInstances:to(i,r),childrenStateInstances:eo(i,a,r)},v=f.render.styleguide(c,d);return v||(e.logger.error($n[Jn.UNKOWN_NODE_TYPE],{type:c}),o.error(new Error($n[Jn.UNKOWN_NODE_TYPE]),{type:c}),null)}catch(t){return e.logger.error($n[Jn.STYLEGUIDE_MAP_ERROR],t),o.error(t),null}},no=function(t,e){var r,n,o,a,i="string"==typeof e&&e.split(" ");return i?1===i.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===i.length?((n={})[t+"Top"]=i[0],n[t+"Right"]=i[1],n[t+"Bottom"]=i[0],n[t+"Left"]=i[1],n):3===i.length?((o={})[t+"Top"]=i[0],o[t+"Right"]=i[1],o[t+"Bottom"]=i[2],o[t+"Left"]=i[1],o):((a={})[t+"Top"]=i[0],a[t+"Right"]=i[1],a[t+"Bottom"]=i[2],a[t+"Left"]=i[3],a):{}},oo=function(t){var e=t.padding,r=t.margin,n=v(t,["padding","margin"]),o={};return e&&(o=p(p({},o),no("padding",e))),r&&(o=p(p({},o),no("margin",r))),p(p({},o),n)},ao=function(t){return"candu.sdk."+t},io=function(t){return ao("error."+t)},uo=(ao("preview.open"),ao("portal"),ao("tutorial"),io("portal_asset_not_found")),co=io("portal_no_segment_ids"),so=io("no_matching_tutorials"),lo=io("circular_dependecy_embed_portal"),fo=io("circular_dependecy_embed_tutorial"),po=((Pn={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"})[uo]="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",Pn[co]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",Pn[so]="The Tutorial will not be rendered because there are no matching segments for the given user.",Pn[lo]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Pn[fo]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Pn);var vo=function(t,e){return function(r,n){if(null==r)return r;if(!It(r))return t(r,n);for(var o=r.length,a=e?o:-1,i=Object(r);(e?a--:++a<o)&&!1!==n(i[a],a,i););return r}}(At);var ho=function(t,e){var r=-1,n=It(t)?Array(t.length):[];return vo(t,(function(t,o,a){n[++r]=e(t,o,a)})),n};var go=function(t,e){return(at(t)?cr:ho)(t,Or(e))},mo=function(){function t(t,r,n){var o=this;this.observer=new e.Observer,this.rootStore=t,this.providerId=r,this.resolver=n,this.eventing=t.getFluxState(xr),this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,r).then((function(t){return o.updateState(t)})).catch((function(t){e.logger.error(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_FETCH_FAILED],t.message),o.eventing.track(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var r=this,n=this.state;this.updateState(p(p({},n),t)),this.resolver.update(this.rootStore,this.providerId,t).then((function(t){return r.updateState(t)})).catch((function(t){e.logger.error(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_UPDATE_FAILED],t.message),r.eventing.track(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&r.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),yo=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),bo=Object.create(null),_o=function(){function t(t){this.cache=new yo,this.options=p({},t||{})}return t.register=function(t,e){bo[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=v(t,["type"]),n=bo[e];return n?new n(r):null},t.prototype.toJSON=function(){return p({type:this.type},this.options)},t}();var Eo=function(t,e,r,n){for(var o=t.length,a=r+(n?1:-1);n?a--:++a<o;)if(e(t[a],a,t))return a;return-1};var To=function(t){return t!=t};var So=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var Io=function(t,e,r){return e==e?So(t,e,r):Eo(t,To,r)};var Oo=function(t,e){return!!(null==t?0:t.length)&&Io(t,e,0)>-1};var Ao=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var Co=function(){},wo=Le&&1/be(new Le([,-0]))[1]==1/0?function(t){return new Le(t)}:Co;var Ro=function(t,e,r){var n=-1,o=Oo,a=t.length,i=!0,u=[],c=u;if(r)i=!1,o=Ao;else if(a>=200){var s=e?null:wo(t);if(s)return be(s);i=!1,o=he,c=new pe}else c=e?[]:u;t:for(;++n<a;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,i&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,r)||(c!==u&&c.push(d),u.push(l))}return u};var No=function(t){return t&&t.length?Ro(t):[]},ko=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new l.default(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),xo="https://api.candu.ai"+Mr,jo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.retrieve=function(t,e){return h(this,void 0,void 0,(function(){var r,n,o,a,i=this;return g(this,(function(u){switch(u.label){case 0:return r=t.getFluxState(kr).clientToken,n=t.getFluxState(jr).userId,[4,ko.get("cardStateApi",(function(t){return h(i,void 0,void 0,(function(){var e;return g(this,(function(o){switch(o.label){case 0:return[4,fetch(xo+"?token="+r+"&finder=byIds&ids="+No(t).join(",")+"&userId="+n).then((function(t){return t.json()}))];case 1:return e=o.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return o=u.sent(),a={id:e,state:{dismissed:!1}},[2,o||a]}}))}))},e.prototype.update=function(t,e,r){var n=t.getFluxState(kr).clientToken,o=t.getFluxState(jr).userId;return fetch(xo+"/"+e+"?token="+n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:o.toString()})}).then((function(t){return t.json()}))},e}(_o);_o.register(e.StateResolverType.CardApi,jo);var Do="https://api.candu.ai"+Fr;function Lo(t){return{state:t.state,id:t.id}}function Po(t){switch(t){case e.CheckListScope.Account:return"AccountId";case e.CheckListScope.User:default:return"UserId"}}var Fo=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getScopeAndFieldsFromRootState=function(t){var r=t.getFluxState(jr),n=r.userId,o=r.traits,a=this.options.scopeTrait,i=this.options.scope||e.CheckListScope.User,u=n.toString();return i===e.CheckListScope.Account&&(a&&o[a]?u=o[a]:(e.logger.warning("trait '"+a+"' is not defined, falling back to user scope"),i=e.CheckListScope.User)),{scope:i,scopeField:u}},r.prototype.retrieve=function(t,r){return h(this,void 0,void 0,(function(){var n,o,a,i,u=this;return g(this,(function(c){switch(c.label){case 0:return n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(kr).clientToken,[4,ko.get("checklistState",(function(t){return h(u,void 0,void 0,(function(){var e;return g(this,(function(r){switch(r.label){case 0:return[4,fetch(Do+"?token="+i+"&byTrait="+Po(o)+"&field="+a+"&finder=byIds&ids="+No(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(Lo)}))];case 1:return e=r.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(r)];case 1:return[2,c.sent()||{id:r,state:e.CheckListItemStatus.NotStared}]}}))}))},r.prototype.update=function(t,e,r){var n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(kr).clientToken;return fetch(Do+"/"+e+"?token="+i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(p(p({},r),{byTrait:Po(o),field:a}))}).then((function(t){return t.json()})).then(Lo)},r}(_o);function Mo(t,r){var n=t.document,o=n.stateProviders,a=n.head,i=r.getFluxState(kr).clientToken;a&&e.fetchHead(a,i),o&&function(t,e){var r;e.registerFlux(zr);var n=go(t,(function(t,r){if(e.select(zr.selectors.provider(r)))return null;var n=_o.fromJSON(t.resolver);return n?new mo(e,r,n):null})).filter((function(t){return!!t}));e.dispatch((r=zr.actions).set.apply(r,n))}(o,r)}_o.register(e.StateResolverType.CheckListApi,Fo);var Uo=Vr((function(){return{clientToken:kr.selectors.clientToken,eventing:xr.selectors.state}}))((function(t){var r,n=t.tutorialDocument,o=t.clientToken,a=t.eventing,i=(r=Hr().select(kr.selectors.styleguide),kn({provider:r},Nn)).getComponent,c=Hr();if(!n.document)return null;Mo(n,c);var s=n.document,l=s.rootNodeId,d=s.head,f=s.nodes,v={rootNodeId:l,nodes:e.adaptCustomNodes(f)};return d&&e.fetchHead(d,o),ro(n.document.rootNodeId,c,{document:v,renderTutorial:function(t){return u.default.createElement(Bo,p({},t))},renderPortal:function(t){return u.default.createElement(Un,p({},t))},renderNode:function(t,r){try{var n=i(t);return n?u.default.createElement(n,{key:r.api.nodeId,api:r.api,attributes:p(p({},r.attributes),{style:r.attributes.style&&oo(r.attributes.style)})}):null}catch(t){return e.logger.error(po[e.EVENT_NAMES.RENDER_NODE_ERROR],t),a.error(t),null}}})})),Go=function(t){var e=t.tutorialDocument;return e?u.default.createElement(Uo,{tutorialDocument:e}):null},Ho=function(t,e){return{tutorialDocument:Wr.selectors.tutorialDocument(e.slug)}},Bo=function(t){!function(t,r){var n=e.tutorialValidation(t),o=r.getFluxState(xr),a=r.getFluxState(kr).clientToken;r.registerFlux(Wr);var i=n.slug,u=r.select(Wr.selectors.tutorialDocument(i));if(!r.select(Wr.selectors.isLoadingOrHasErrors(i))&&!u){var c=performance.now(),s=e.RESOURCES.tutorialDocument(n,a,o);s&&(r.dispatch(Wr.actions.loading(i)),s.then((function(t){return r.dispatch(Wr.actions.success({slug:i,result:t,loadTime:performance.now()-c}))})).catch((function(t){return r.dispatch(Wr.actions.error({slug:i,error:t,loadTime:performance.now()-c}))})))}}(t,Hr());var r=Vr(Ho)(Go);return u.default.createElement(r,p({},t))};exports.CanduProvider=Br,exports.Portal=Un,exports.ProviderContext=Gr,exports.Tutorial=Bo,exports.useRootStore=Hr;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("@candulabs/core"),r=require("@candulabs/eventing"),n=require("invariant"),o=require("react-player");require("setimmediate");var a=require("dataloader");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=i(t),c=i(n),s=i(o),l=i(a),d=function(t,e){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function f(t,e){function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var p=function(){return(p=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function v(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function h(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{c(n.next(t))}catch(t){a(t)}}function u(t){try{c(n.throw(t))}catch(t){a(t)}}function c(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(i,u)}c((n=n.apply(t,e||[])).next())}))}function g(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var m=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function b(t){var e={exports:{}};return t(e,e.exports),e.exports}var _="object"==typeof y&&y&&y.Object===Object&&y,E="object"==typeof self&&self&&self.Object===Object&&self,T=_||E||Function("return this")(),S=T.Symbol,I=Object.prototype,O=I.hasOwnProperty,A=I.toString,C=S?S.toStringTag:void 0;var w=function(t){var e=O.call(t,C),r=t[C];try{t[C]=void 0;var n=!0}catch(t){}var o=A.call(t);return n&&(e?t[C]=r:delete t[C]),o},R=Object.prototype.toString;var N=function(t){return R.call(t)},k=S?S.toStringTag:void 0;var x=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":k&&k in Object(t)?w(t):N(t)};var j,D=function(t){if(!m(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},L=T["__core-js_shared__"],P=(j=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+j:"";var F=function(t){return!!P&&P in t},M=Function.prototype.toString;var U=function(t){if(null!=t){try{return M.call(t)}catch(t){}try{return t+""}catch(t){}}return""},G=/^\[object .+?Constructor\]$/,H=Function.prototype,B=Object.prototype,V=H.toString,z=B.hasOwnProperty,Y=RegExp("^"+V.call(z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var W=function(t){return!(!m(t)||F(t))&&(D(t)?Y:G).test(U(t))};var K=function(t,e){return null==t?void 0:t[e]};var J=function(t,e){var r=K(t,e);return W(r)?r:void 0},q=function(){try{var t=J(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var $=function(t,e,r){"__proto__"==e&&q?q(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var Z=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 Q=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var X=function(t){return null!=t&&"object"==typeof t};var tt=function(t){return X(t)&&"[object Arguments]"==x(t)},et=Object.prototype,rt=et.hasOwnProperty,nt=et.propertyIsEnumerable,ot=tt(function(){return arguments}())?tt:function(t){return X(t)&&rt.call(t,"callee")&&!nt.call(t,"callee")},at=Array.isArray;var it=function(){return!1},ut=b((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?T.Buffer:void 0,a=(o?o.isBuffer:void 0)||it;t.exports=a})),ct=/^(?:0|[1-9]\d*)$/;var st=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&ct.test(t))&&t>-1&&t%1==0&&t<e};var lt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},dt={};dt["[object Float32Array]"]=dt["[object Float64Array]"]=dt["[object Int8Array]"]=dt["[object Int16Array]"]=dt["[object Int32Array]"]=dt["[object Uint8Array]"]=dt["[object Uint8ClampedArray]"]=dt["[object Uint16Array]"]=dt["[object Uint32Array]"]=!0,dt["[object Arguments]"]=dt["[object Array]"]=dt["[object ArrayBuffer]"]=dt["[object Boolean]"]=dt["[object DataView]"]=dt["[object Date]"]=dt["[object Error]"]=dt["[object Function]"]=dt["[object Map]"]=dt["[object Number]"]=dt["[object Object]"]=dt["[object RegExp]"]=dt["[object Set]"]=dt["[object String]"]=dt["[object WeakMap]"]=!1;var ft=function(t){return X(t)&&lt(t.length)&&!!dt[x(t)]};var pt=function(t){return function(e){return t(e)}},vt=b((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&_.process,a=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a})),ht=vt&&vt.isTypedArray,gt=ht?pt(ht):ft,mt=Object.prototype.hasOwnProperty;var yt=function(t,e){var r=at(t),n=!r&&ot(t),o=!r&&!n&&ut(t),a=!r&&!n&&!o&&gt(t),i=r||n||o||a,u=i?Q(t.length,String):[],c=u.length;for(var s in t)!e&&!mt.call(t,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||st(s,c))||u.push(s);return u},bt=Object.prototype;var _t=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||bt)};var Et=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Tt=Object.prototype.hasOwnProperty;var St=function(t){if(!_t(t))return Et(t);var e=[];for(var r in Object(t))Tt.call(t,r)&&"constructor"!=r&&e.push(r);return e};var It=function(t){return null!=t&&lt(t.length)&&!D(t)};var Ot=function(t){return It(t)?yt(t):St(t)};var At=function(t,e){return t&&Z(t,e,Ot)};var Ct=function(){this.__data__=[],this.size=0};var wt=function(t,e){return t===e||t!=t&&e!=e};var Rt=function(t,e){for(var r=t.length;r--;)if(wt(t[r][0],e))return r;return-1},Nt=Array.prototype.splice;var kt=function(t){var e=this.__data__,r=Rt(e,t);return!(r<0)&&(r==e.length-1?e.pop():Nt.call(e,r,1),--this.size,!0)};var xt=function(t){var e=this.__data__,r=Rt(e,t);return r<0?void 0:e[r][1]};var jt=function(t){return Rt(this.__data__,t)>-1};var Dt=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 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=Ct,Lt.prototype.delete=kt,Lt.prototype.get=xt,Lt.prototype.has=jt,Lt.prototype.set=Dt;var Pt=Lt;var Ft=function(){this.__data__=new Pt,this.size=0};var Mt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ut=function(t){return this.__data__.get(t)};var Gt=function(t){return this.__data__.has(t)},Ht=J(T,"Map"),Bt=J(Object,"create");var Vt=function(){this.__data__=Bt?Bt(null):{},this.size=0};var zt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Yt=Object.prototype.hasOwnProperty;var Wt=function(t){var e=this.__data__;if(Bt){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Yt.call(e,t)?e[t]:void 0},Kt=Object.prototype.hasOwnProperty;var Jt=function(t){var e=this.__data__;return Bt?void 0!==e[t]:Kt.call(e,t)};var qt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Bt&&void 0===e?"__lodash_hash_undefined__":e,this};function $t(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])}}$t.prototype.clear=Vt,$t.prototype.delete=zt,$t.prototype.get=Wt,$t.prototype.has=Jt,$t.prototype.set=qt;var Zt=$t;var Qt=function(){this.size=0,this.__data__={hash:new Zt,map:new(Ht||Pt),string:new Zt}};var Xt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var te=function(t,e){var r=t.__data__;return Xt(e)?r["string"==typeof e?"string":"hash"]:r.map};var ee=function(t){var e=te(this,t).delete(t);return this.size-=e?1:0,e};var re=function(t){return te(this,t).get(t)};var ne=function(t){return te(this,t).has(t)};var oe=function(t,e){var r=te(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ae(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])}}ae.prototype.clear=Qt,ae.prototype.delete=ee,ae.prototype.get=re,ae.prototype.has=ne,ae.prototype.set=oe;var ie=ae;var ue=function(t,e){var r=this.__data__;if(r instanceof Pt){var n=r.__data__;if(!Ht||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ie(n)}return r.set(t,e),this.size=r.size,this};function ce(t){var e=this.__data__=new Pt(t);this.size=e.size}ce.prototype.clear=Ft,ce.prototype.delete=Mt,ce.prototype.get=Ut,ce.prototype.has=Gt,ce.prototype.set=ue;var se=ce;var le=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var de=function(t){return this.__data__.has(t)};function fe(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new ie;++e<r;)this.add(t[e])}fe.prototype.add=fe.prototype.push=le,fe.prototype.has=de;var pe=fe;var ve=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 he=function(t,e){return t.has(e)};var ge=function(t,e,r,n,o,a){var i=1&r,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var s=a.get(t),l=a.get(e);if(s&&l)return s==e&&l==t;var d=-1,f=!0,p=2&r?new pe:void 0;for(a.set(t,e),a.set(e,t);++d<u;){var v=t[d],h=e[d];if(n)var g=i?n(h,v,d,e,t,a):n(v,h,d,t,e,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!ve(e,(function(t,e){if(!he(p,e)&&(v===t||o(v,t,r,n,a)))return p.push(e)}))){f=!1;break}}else if(v!==h&&!o(v,h,r,n,a)){f=!1;break}}return a.delete(t),a.delete(e),f},me=T.Uint8Array;var ye=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var be=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},_e=S?S.prototype:void 0,Ee=_e?_e.valueOf:void 0;var Te=function(t,e,r,n,o,a,i){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!a(new me(t),new me(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return wt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=ye;case"[object Set]":var c=1&n;if(u||(u=be),t.size!=e.size&&!c)return!1;var s=i.get(t);if(s)return s==e;n|=2,i.set(t,e);var l=ge(u(t),u(e),n,o,a,i);return i.delete(t),l;case"[object Symbol]":if(Ee)return Ee.call(t)==Ee.call(e)}return!1};var Se=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Ie=function(t,e,r){var n=e(t);return at(t)?n:Se(n,r(t))};var Oe=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 Ae=function(){return[]},Ce=Object.prototype.propertyIsEnumerable,we=Object.getOwnPropertySymbols,Re=we?function(t){return null==t?[]:(t=Object(t),Oe(we(t),(function(e){return Ce.call(t,e)})))}:Ae;var Ne=function(t){return Ie(t,Ot,Re)},ke=Object.prototype.hasOwnProperty;var xe=function(t,e,r,n,o,a){var i=1&r,u=Ne(t),c=u.length;if(c!=Ne(e).length&&!i)return!1;for(var s=c;s--;){var l=u[s];if(!(i?l in e:ke.call(e,l)))return!1}var d=a.get(t),f=a.get(e);if(d&&f)return d==e&&f==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=i;++s<c;){var h=t[l=u[s]],g=e[l];if(n)var m=i?n(g,h,l,e,t,a):n(h,g,l,t,e,a);if(!(void 0===m?h===g||o(h,g,r,n,a):m)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){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||(p=!1)}return a.delete(t),a.delete(e),p},je=J(T,"DataView"),De=J(T,"Promise"),Le=J(T,"Set"),Pe=J(T,"WeakMap"),Fe=U(je),Me=U(Ht),Ue=U(De),Ge=U(Le),He=U(Pe),Be=x;(je&&"[object DataView]"!=Be(new je(new ArrayBuffer(1)))||Ht&&"[object Map]"!=Be(new Ht)||De&&"[object Promise]"!=Be(De.resolve())||Le&&"[object Set]"!=Be(new Le)||Pe&&"[object WeakMap]"!=Be(new Pe))&&(Be=function(t){var e=x(t),r="[object Object]"==e?t.constructor:void 0,n=r?U(r):"";if(n)switch(n){case Fe:return"[object DataView]";case Me:return"[object Map]";case Ue:return"[object Promise]";case Ge:return"[object Set]";case He:return"[object WeakMap]"}return e});var Ve=Be,ze="[object Object]",Ye=Object.prototype.hasOwnProperty;var We=function(t,e,r,n,o,a){var i=at(t),u=at(e),c=i?"[object Array]":Ve(t),s=u?"[object Array]":Ve(e),l=(c="[object Arguments]"==c?ze:c)==ze,d=(s="[object Arguments]"==s?ze:s)==ze,f=c==s;if(f&&ut(t)){if(!ut(e))return!1;i=!0,l=!1}if(f&&!l)return a||(a=new se),i||gt(t)?ge(t,e,r,n,o,a):Te(t,e,c,r,n,o,a);if(!(1&r)){var p=l&&Ye.call(t,"__wrapped__"),v=d&&Ye.call(e,"__wrapped__");if(p||v){var h=p?t.value():t,g=v?e.value():e;return a||(a=new se),o(h,g,r,n,a)}}return!!f&&(a||(a=new se),xe(t,e,r,n,o,a))};var Ke=function t(e,r,n,o,a){return e===r||(null==e||null==r||!X(e)&&!X(r)?e!=e&&r!=r:We(e,r,n,o,t,a))};var Je=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 se;if(n)var f=n(s,l,c,t,e,d);if(!(void 0===f?Ke(l,s,3,n,d):f))return!1}}return!0};var qe=function(t){return t==t&&!m(t)};var $e=function(t){for(var e=Ot(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,qe(o)]}return e};var Ze=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var Qe=function(t){var e=$e(t);return 1==e.length&&e[0][2]?Ze(e[0][0],e[0][1]):function(r){return r===t||Je(r,t,e)}};var Xe=function(t){return"symbol"==typeof t||X(t)&&"[object Symbol]"==x(t)},tr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,er=/^\w*$/;var rr=function(t,e){if(at(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Xe(t))||(er.test(t)||!tr.test(t)||null!=e&&t in Object(e))};function nr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");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(nr.Cache||ie),r}nr.Cache=ie;var or=nr;var ar=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,ur=function(t){var e=or(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ar,(function(t,r,n,o){e.push(n?o.replace(ir,"$1"):r||t)})),e}));var cr=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=S?S.prototype:void 0,lr=sr?sr.toString:void 0;var dr=function t(e){if("string"==typeof e)return e;if(at(e))return cr(e,t)+"";if(Xe(e))return lr?lr.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var fr=function(t){return null==t?"":dr(t)};var pr=function(t,e){return at(t)?t:rr(t,e)?[t]:ur(fr(t))};var vr=function(t){if("string"==typeof t||Xe(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var hr=function(t,e){for(var r=0,n=(e=pr(e,t)).length;null!=t&&r<n;)t=t[vr(e[r++])];return r&&r==n?t:void 0};var gr=function(t,e,r){var n=null==t?void 0:hr(t,e);return void 0===n?r:n};var mr=function(t,e){return null!=t&&e in Object(t)};var yr=function(t,e,r){for(var n=-1,o=(e=pr(e,t)).length,a=!1;++n<o;){var i=vr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&lt(o)&&st(i,o)&&(at(t)||ot(t))};var br=function(t,e){return null!=t&&yr(t,e,mr)};var _r=function(t,e){return rr(t)&&qe(e)?Ze(vr(t),e):function(r){var n=gr(r,t);return void 0===n&&n===e?br(r,t):Ke(e,n,3)}};var Er=function(t){return t};var Tr=function(t){return function(e){return null==e?void 0:e[t]}};var Sr=function(t){return function(e){return hr(e,t)}};var Ir=function(t){return rr(t)?Tr(vr(t)):Sr(t)};var Or=function(t){return"function"==typeof t?t:null==t?Er:"object"==typeof t?at(t)?_r(t[0],t[1]):Qe(t):Ir(t)};var Ar=function(t,e){var r={};return e=Or(e),At(t,(function(t,n,o){$(r,n,e(t,n,o))})),r};function Cr(t){var e=t.name,r=t.actions,n=t.selectors,o=v(t,["name","actions","selectors"]);return p(p({},o),{actions:Ar(r||{},(function(t,r){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return p({type:r,storeName:e},t.apply(void 0,n))}})),selectors:Ar(n||{},(function(t){function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return{storeName:e,selector:t.apply(void 0,r)}}return r.storeName=e,r.selector=t,r})),name:e})}function wr(t){var e=t.name,r=t.initialValue,n=t.reducer,o=r,a=[];return{name:e,getState:function(){return o},subscribe:function(t){return a.push(t),function(){a=a.filter((function(e){return e!==t}))}},dispatch:function(t){var e=o;return"object"==typeof e&&null!==e?e=p({},o):Array.isArray(e)&&(e=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var a=arguments[e],i=0,u=a.length;i<u;i++,o++)n[o]=a[i];return n}(o)),o=n(t,o),a.forEach((function(r){return r(o,e,t)})),this}}}function Rr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.fromEntries(t.map((function(t){return[t.name,t]})));return{name:"root",getFluxState:function(t){var e=this.getStore(t);if(!e)throw new Error("rootState.getFluxState: the flux store "+t.name+" does not exist");return e.getState()},getState:function(){return Ar(r,(function(t){return t.getState()}))},getStore:function(t){var e="string"==typeof t?t:t.name;return r[e]},registerFlux:function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter((function(t){var e=t.name;return!r[e]})).forEach((function(e){return t.register(wr(e))})),this},register:function(t){return r[t.name]=t,this},dispatch:function(t){t.storeName?r[t.storeName].dispatch(t):Object.values(r).forEach((function(e){return e.dispatch(t)}))},remove:function(t){return delete r[t.name],this},select:function(t){var e;return t.selector(null===(e=r[t.storeName])||void 0===e?void 0:e.getState())}}}var Nr=function(t){return{loading:!1,result:t,error:void 0,loadTime:0}},kr=Cr({name:"config",initialValue:{clientToken:"",options:{},styleguide:{}},actions:{set:function(t){return{payload:t}}},selectors:{styleguide:function(t){return t.styleguide},clientToken:function(t){return t.clientToken}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e}}),xr=Cr({name:"eventing",initialValue:r.noOpEventing,actions:{set:function(t){return{eventing:t}}},selectors:{state:function(t){return t}},reducer:function(t,e){var r=t.type,n=t.eventing;return"set"===r?n:e}}),jr=Cr({name:"user",initialValue:{userId:r.getAnonymousId(),traits:{}},actions:{set:function(t){return{payload:t}}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e},selectors:{userId:function(t){return t.userId}}}),Dr=function(t){return localStorage.setItem("candu.segmentMembership",JSON.stringify(t))},Lr=Cr({name:"segmentMembership",initialValue:Nr(function(){try{var t=localStorage.getItem("candu.segmentMembership"),e=t&&JSON.parse(t);if(!e)return;return{id:"",segmentIds:e}}catch(t){return}}()),actions:{loading:function(){return{}},success:function(t){return t},error:function(t){return t}},selectors:{segmentIds:function(t){var e;return null===(e=t.result)||void 0===e?void 0:e.segmentIds}},reducer:function(t,e){var r=t.type,n=t.result,o=t.loadTime,a=t.error;switch(r){case"loading":return p(p({},e),{loading:!0});case"success":return Dr(n.segmentIds),p(p({},e),{loading:!1,error:void 0,result:n,loadTime:o});case"error":return{loading:!1,result:void 0,error:a,loadTime:o};default:return e}}});var Pr={name:"@candulabs/harbour",version:"0.7.1-alpha.17"},Fr="/api/checklistItems",Mr="/api/cards";function Ur(t,n){n.registerFlux(kr,jr,xr,Lr);var o=function(t,r){var n=t.clientToken,o=t.userId,a=t.traits,i=t.options,u=t.styleguide,s=v(t,["clientToken","userId","traits","options","styleguide"]);c.default(e.isClientToken(n),"(Candu) you must provide a valid clientToken"),c.default(!o||e.isUserId(o),"(Candu) you must provide a valid userId"),c.default(!a||m(a),"(Candu) traits must be undefined or an object"),c.default(!i||m(i),"(Candu) options must be undefined or an object"),c.default(!u||m(u),"(Candu) styleguide must be undefined or an object");var l=r.getFluxState(jr);return p(p({},s),{clientToken:n,traits:a||l.traits||{},options:i||{},styleguide:u||{},userId:o||l.userId})}(t,n),a=o.clientToken,i=o.userId,u=o.traits,s=o.styleguide,l=o.options,d=r.eventingFactory(a,i,l,Pr);e.internalEventing(d).provider({userId:i,traits:u,styleguide:s}),n.dispatch(jr.actions.set({userId:i,traits:u})),n.dispatch(xr.actions.set(d)),n.dispatch(kr.actions.set({clientToken:a,options:l,styleguide:s})),e.attachStylesheet(a),function(t){var r=t.getFluxState(kr),n=r.clientToken,o=r.options,a=t.getFluxState(jr).userId,i=t.getFluxState(xr);if(o.skipLoading||o.overrideSegmentMemberships){var u={id:a,segmentIds:o.overrideSegmentMemberships||[]};t.dispatch(Lr.actions.success({result:u,loadTime:0}))}else{var c=performance.now();t.dispatch(Lr.actions.loading()),e.RESOURCES.segmentMembership(n,a).then((function(r){var n=performance.now()-c;i.track(e.METRICS.SEGMENT_MEMBERSHIP_LOAD_TIME,{value:n}),t.dispatch(Lr.actions.success({result:r,loadTime:n}))})).catch((function(e){return t.dispatch(Lr.actions.error({error:e,loadTime:performance.now()-c}))}))}}(n)}var Gr=u.default.createContext(Rr()),Hr=function(){return t.useContext(Gr)},Br=function(t){function e(e){var r=t.call(this,e)||this;r.state=Rr();var n=r.props;return n.children,Ur(v(n,["children"]),r.state),r}return f(e,t),e.prototype.render=function(){return u.default.createElement(Gr.Provider,{value:this.state},this.props.children)},e}(u.default.Component),Vr=function(t){return function(e){var r;return(r=function(r){function n(t){var e=r.call(this,t)||this;return e.unsubscribes=[],e.handleChange=e.handleChange.bind(e),e}return f(n,r),n.prototype.componentDidMount=function(){var e=this;this.handleChange();var r=Object.values(t(this.context,this.props)).map((function(t){var r=t.storeName;return e.context.getStore(r).subscribe}));this.unsubscribes=r.map((function(t){return t(e.handleChange)}))},n.prototype.componentWillUnmount=function(){this.unsubscribes.forEach((function(t){return t()}))},n.prototype.mapStateToProps=function(){var e=this;return Ar(t(this.context,this.props),(function(t){return t.selector&&t.storeName?e.context.select(t):t}))},n.prototype.handleChange=function(){this.setState(this.mapStateToProps())},n.prototype.render=function(){return u.default.createElement(e,p({},this.state||this.mapStateToProps(),this.props))},n}(u.default.Component)).contextType=Gr,r}},zr=Cr({name:"stateProviders",initialValue:{},actions:{set:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{providers:t}}},selectors:{provider:function(t){return function(e){return e[t]}}},reducer:function(t,e){var r=t.type,n=t.providers;switch(r){case"set":return p(p({},e),Object.fromEntries(n.map((function(t){return[t.providerId,t]}))));default:return e}}}),Yr=function(){try{var t=localStorage.getItem("candu.tutorials");return t?JSON.parse(t):{}}catch(t){return{}}},Wr=Cr({name:"tutorialDocuments",initialValue:Ar(Yr(),Nr),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{tutorialDocument:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return p(p({},e),((r={})[i]=p(p({},Nr()),{loading:!0}),r));case"success":return function(t,e){var r=Yr();r[t]=e,localStorage.setItem("candu.tutorials",JSON.stringify(r))}(i,u),p(p({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return p(p({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});var Kr,Jr=["div","a","p"],qr={Fragment:t.Fragment,Document:t.Fragment},$r="#6310E5",Zr="#59C3C3",Qr="#4D515D",Xr="#FCAD0D",tn="#EE4266",en=function(e){c.default(m(e),"(createStyleguide) styleguide must be undefined or an object");return{getComponent:function(r){var n=function(t){if(e[t])return e[t];if(qr[t])return qr[t];var r=Jr.indexOf(t)||Jr.indexOf(t.toLowerCase());return Jr[r]}(r);return"string"==typeof n?function(t){var e=t.api,r=t.attributes;return u.default.createElement(n,p({key:e.nodeId},r))}:n===t.Fragment?function(e){var r=e.api,n=e.attributes;return u.default.createElement(t.Fragment,{key:r.nodeId},n.children)}:n},all:function(){return e}}},rn={borderRadius:"4px",padding:"8px"},nn=function(t){switch(t){case"success":return $r;case"active":return Zr;case"warning":return Xr;case"danger":return tn;default:return Qr}},on=function(){return u.default.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("path",{d:"M6 6L18 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}),u.default.createElement("path",{d:"M18 6L6 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}))},an=function(){return Hr().getFluxState(xr)},un={borderRadius:"4px",padding:"8px",backgroundColor:"rgb(51, 55, 69)",color:"rgb(255, 255, 255)",overflow:"auto"},cn={display:"flex"},sn={flex:"1 1"},ln={maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"};!function(t){t.Ordered="OL",t.Unordered="UL"}(Kr||(Kr={}));var dn,fn={backgroundColor:"transparent",border:"none",borderTop:"1px solid #edeff3",height:"0"},pn=function(t){return function(r){var n,o=r.attributes,a=["h1","h2","h3","h4","p"].includes(t);a&&(n={variant:t.toUpperCase()});var i=e.toCssSelector(a?"typography":t,{variant:n,output:"html"});return u.default.createElement(t,p({},o,{className:i}))}},vn=function(t){var e=pn("div");return u.default.createElement(e,p({},t))},hn="640px",gn="360px",mn={border:"1px solid var(--color-lines)",borderRadius:"4px",marginBottom:"16px",backgroundColor:"white",display:"flex",flexDirection:"column"},yn={padding:"16px",display:"flex",flexDirection:"row",alignItems:"center",flexGrow:1,boxSizing:"border-box",color:"var(--color-neutral)"},bn={padding:"16px 48px",display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",transition:"all .35s ease-out 0s"},_n={borderRadius:"20px",height:"32px",width:"32px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",marginRight:"16px",appearance:"none",outline:"none",padding:0,transition:"all .1s ease-out 0s"},En={appearance:"none",border:"none",outline:"none",cursor:"pointer",background:"none",padding:"0px",display:"flex"},Tn={marginBottom:"48px"},Sn={width:"100%",height:"4px",marginBottom:"16px",backgroundColor:"#EDEFF3"},In={height:"100%",backgroundColor:"#59C3C3",transition:"all .35s ease-out 0s"},On=function(t){var e=t.direction;return u.default.createElement("svg",{style:{transition:"all .35s ease-out 0s",transform:"rotateZ("+("up"===e?"180deg":"0deg")+")"},width:"18",height:"11",viewBox:"0 0 18 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("path",{d:"M9 6.74488L3.09046 0.555221C2.39741 -0.170679 1.25783 -0.186906 0.545126 0.518977C-0.167576 1.22486 -0.183508 2.38555 0.509541 3.11145L7.37034 10.2975L7.37166 10.2988C8.26633 11.2347 9.73727 11.2336 10.6306 10.2965L17.4905 3.11145C18.1835 2.38555 18.1676 1.22486 17.4549 0.518977C16.7422 -0.186906 15.6026 -0.170679 14.9095 0.555221L9 6.74488Z",fill:"#D4D8E4"}))},An=((dn={})[e.CheckListItemStatus.NotStared]={title:"Not Started",statusStyle:{backgroundColor:"#EDEFF3",borderColor:"#D4D8E4"},icon:{path:"M 2 6.55 L 5 6.55 L 10 6.55",stroke:"#9498A7"}},dn[e.CheckListItemStatus.InProgress]={title:"In Progress",statusStyle:{backgroundColor:"#FE8A3A",borderColor:"white"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"white"}},dn[e.CheckListItemStatus.Done]={title:"Completed",statusStyle:{backgroundColor:"#CFF5F5",borderColor:"#6DD8D8"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"#46AEAE"}},dn),Cn=function(e){var r=e.onChangeStatus,n=e.status,o=t.useState(!1),a=o[0],i=o[1],c=p(p(p({},_n),An[n].statusStyle),{border:(a?"1px":"0px")+" solid "+An[n].statusStyle.borderColor}),s=An[n].title,l=An[n].icon;return u.default.createElement("button",{type:"button",onClick:function(t){r(),t.stopPropagation()},style:c,title:s,onMouseOver:function(){return i(!0)},onFocus:function(){return i(!0)},onMouseOut:function(){return i(!1)},onBlur:function(){return i(!1)}},u.default.createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("path",{d:l.path,stroke:l.stroke,strokeWidth:"2.5",strokeLinecap:"round",style:{transition:"all .1s ease-out 0s"}})))},wn=[e.CheckListItemStatus.NotStared,e.CheckListItemStatus.Done],Rn=function(t){var e=t.expanded,r=t.children,n=e?bn:p(p({},bn),{maxHeight:0,padding:"0px 48px"});return u.default.createElement("div",{style:n},r)},Nn={Alert:function(t){var e=t.attributes,r=e.intent,n=e.title,o=e.description;return u.default.createElement("div",p({},e,{style:p(p(p({},rn),e.style),{color:"#FFF",backgroundColor:nn(r)||"#EDEDED"})}),n,u.default.createElement("div",null,u.default.createElement("small",null,o)))},B:function(t){var e=pn("b");return u.default.createElement(e,p({},t))},Badge:function(t){var r=t.attributes,n=r.color,o=r.outline,a=v(r,["color","outline"]),i=e.toCssSelector("badge",{variant:{color:n,outline:o},output:"html"});return u.default.createElement("span",p({},a,{className:i}))},Button:function(t){var r=t.attributes;return u.default.createElement("button",p({type:"button"},r,{className:e.toCssSelector("button",{variant:{color:r.color,outline:r.outline},output:"html"}),style:p({},r.style||{})}))},Card:function(r){var n=r.attributes,o=n.children,a=n.isDismissible,i=v(n,["children","isDismissible"]),c=r.api,s=an(),l=e.toCssSelector("card",{output:"html"}),d=t.useMemo((function(){var t;return null===(t=c.stateInstances)||void 0===t?void 0:t.find((function(t){return t.resolver instanceof e.CardResolverInstance}))}),[]),f=t.useState({dismissed:!1}),h=f[0],g=f[1];return t.useLayoutEffect((function(){if(d)return d.subscribe((function(t){g(t.state)}))}),[d]),h.dismissed?null:u.default.createElement("div",p({},i,{className:l,style:p({position:"relative"},i.style)}),a&&u.default.createElement("a",{style:{position:"absolute",top:"6px",right:"6px",cursor:"pointer"},onClick:function(){d?(s.track(e.EVENT_NAMES.TUTORIAL_INTERACTION,p({category:e.CATEGORIES.NATIVE,trigger:e.TRIGGERS.ON_CLICK,handler:{type:e.HANDLER_TYPES.DISMISSED_CARD,cardId:c.nodeId},eventName:"DismissedCard_"+c.nodeId},c.trackingIdentifiers)),d.mutate({id:d.providerId,state:{dismissed:!0}})):e.logger.warning("Card state provider not found")}},u.default.createElement(on,null)),o)},Code:function(t){var e=t.attributes,r=e.children,n=v(e,["children"]);return u.default.createElement("div",p({},n,{style:p(p({},un),n.style||{})}),u.default.createElement("pre",{style:{color:"rgb(255, 255, 255)"}},r))},Document:function(t){var e=t.attributes,r=v(t,["attributes"]),n=e.style;return u.default.createElement(vn,p({},r,{attributes:p(p({},e),{style:p(p({},{overflow:"auto",maxWidth:"100%",maxHeight:"100%",boxSizing:"border-box"}),n)})}))},Em:function(t){var e=pn("em");return u.default.createElement(e,p({},t))},EmbedPortal:function(t){var r=t.attributes,n=r.slug,o=r.style,a=t.api;return u.default.createElement("div",{className:e.CANDU_PORTAL_CLASS,style:o},a.render.portal({slug:n}))},EmbedTutorial:function(t){var e=t.attributes,r=e.id,n=e.slug,o=e.style,a=t.api;return u.default.createElement("div",{style:o},a.render.tutorial({tutorialId:r,slug:n}))},Flex:function(t){var e=t.attributes;return u.default.createElement("div",p({},e,{style:p(p({},cn),e.style)}))},FlexItem:function(t){var e=t.attributes;return u.default.createElement("div",p({},e,{style:p(p({},sn),e.style)}))},H1:function(t){var e=pn("h1");return u.default.createElement(e,p({},t))},H2:function(t){var e=pn("h2");return u.default.createElement(e,p({},t))},H3:function(t){var e=pn("h3");return u.default.createElement(e,p({},t))},H4:function(t){var e=pn("h4");return u.default.createElement(e,p({},t))},H5:function(t){var e=pn("h5");return u.default.createElement(e,p({},t))},H6:function(t){var e=pn("h6");return u.default.createElement(e,p({},t))},Image:function(t){var e=t.attributes,r=e.width,n=e.height,o=e.src,a=e.className,i=e.alt,c=e.style,s=t.api,l=s.nodeId,d=s.document;return!!d&&!!l&&d.nodes[l].props?u.default.createElement("img",{alt:i||"",src:o,className:a,style:p(p(p({},ln),c),{width:r||ln.width,height:n||ln.height})}):null},InlineCode:function(t){var e=pn("code");return u.default.createElement(e,p({},t))},Link:function(t){var r=t.attributes,n=r.href,o=r.target,a=v(r,["href","target"]),i=e.toCssSelector("link",{output:"html"});return u.default.createElement("a",p({},a,{className:i,href:n,target:n.includes("http")&&!o?"_blank":o}))},List:function(t){var e=t.attributes,r=t.api,n=r.nodeId,o=(r.document.nodes[n]||{}).data;return o&&o.custom&&o.custom.variant===Kr.Unordered?u.default.createElement("ul",p({},e)):u.default.createElement("ol",p({},e))},ListItem:function(t){var r=t.attributes,n=e.toCssSelector("typography",{variant:{variant:"P"},output:"html"});return u.default.createElement("li",p({},r,{className:n}))},P:function(t){var e=pn("p");return u.default.createElement(e,p({},t))},RichText:vn,Spacing:function(t){var e=t.attributes;return u.default.createElement("hr",p({},e,{style:p(p({},fn),e.style)}))},Text:function(e){var r=e.attributes,n=e.api,o=n.nodeId,a=n.document,i=!!a&&!!o&&a.nodes[o],c=u.default.createElement(t.Fragment,null,r.children);if(!i)return c;var s=i.data&&i.data.custom&&at(i.data.custom.marks)?i.data.custom.marks:[];return 0===s.length?c:c=s.reduce((function(t,e){return n.render.styleguide(e,p(p({},r),{children:t}))}),c)},U:function(t){var e=pn("u");return u.default.createElement(e,p({},t))},View:vn,Player:function(t){var r=t.attributes,n=r.width,o=r.height,a=r.src,i=v(r,["width","height","src"]);return u.default.createElement(s.default,p({},i,{controls:!0,url:a,width:n||hn,height:o||gn,onError:e.logError}))},CheckList:function(t){var e=t.attributes,r=e.children,n=v(e,["children"]);return u.default.createElement("div",p({},n),r)},CheckListGroup:function(r){var n=r.attributes,o=n.children,a=n.title,i=n.style,c=n.className,s=n.onClick,l=r.api,d=l.childrenStateInstances,f=l.trackingIdentifiers,v=l.node.data,h=an(),g=e.getCheckListStateProviders(d||[]),m=g.length,y=t.useState(e.getInitialItems(g)),b=y[0],_=y[1];t.useEffect((function(){var t=g.map((function(t,e){return t.subscribe((function(t){_((function(r){var n;return p(p({},r),((n={})[t.id]={position:e,status:t.state},n))}))}))}));return function(){t.map((function(t){return t()}))}}),g);var E=e.calculateGroupCompletion(b,m).percComplete;t.useEffect((function(){var t,r;100===E&&h.track(e.EVENT_NAMES.CHECKLIST_GROUP_COMPLETE,p({title:a,groupId:null===(r=null===(t=v)||void 0===t?void 0:t.custom)||void 0===r?void 0:r.groupId},f))}),[E]);var T=e.getFirstNotStartedItem(b,m),S=e.toCssSelector("typography",{variant:{variant:"H4"},output:"html"});return u.default.createElement("div",{className:c,onClick:s,style:p(p({},Tn),i)},u.default.createElement("h4",{className:S},a),u.default.createElement("div",{style:Sn},u.default.createElement("div",{style:p(p({},In),{width:E+"%"})})),!!o&&u.default.Children.map(o,(function(t,e){return u.default.cloneElement(t,{expandByDefault:e===T})})))},CheckListItem:function(r){var n=r.attributes,o=n.title,a=n.style,i=n.children,c=v(n,["title","style","children"]),s=r.api,l=s.stateInstances,d=s.trackingIdentifiers,f=r.expandByDefault,h=an(),g=t.useState(e.CheckListItemStatus.NotStared),m=g[0],y=g[1],b=t.useState(!!f),_=b[0],E=b[1];if(!l)throw new Error("no state provided");var T=function(t){var r=t.find((function(t){return t.resolver instanceof e.CheckListResolverInstance}));if(!r)throw new Error("Couldn't find CheckListApi state provider");return r}(l);t.useEffect((function(){return T.subscribe((function(t){y(t.state)}))}),[T]),t.useEffect((function(){i&&E(!!f)}),[f]);var S=p(p({},yn),{borderBottom:i&&_?"1px solid var(--color-lines)":"none"}),I={flexGrow:1,fontWeight:600,cursor:i?"pointer":"auto"},O=e.toCssSelector("typography",{variant:{variant:"P"},output:"html"}),A=function(t){E(!_),t.stopPropagation()};return u.default.createElement("div",p({style:p(p({},mn),a)},c),u.default.createElement("div",{style:S,onClick:i&&A},u.default.createElement(Cn,{onChangeStatus:function(){var t=function(t){return wn[(wn.indexOf(t)+1)%wn.length]}(m);T.mutate({state:t}),h.track(e.EVENT_NAMES.CHECKLIST_ITEM_STATE_UPDATED,p({itemId:T.providerId,state:t,title:o},d))},status:m}),u.default.createElement("div",{className:O,style:I},o),i&&u.default.createElement("button",{type:"button",onClick:A,style:En},u.default.createElement(On,{direction:_?"up":"down"}))),i&&u.default.createElement(Rn,{expanded:_},i))}},kn=or((function(t,r){return en(e.mergeStyleguidesFromContext(t,r))})),xn=function(){try{var t=localStorage.getItem("candu.portals");return t?JSON.parse(t):{}}catch(t){return{}}},jn=Cr({name:"portal",initialValue:Ar(xn(),Nr),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{portalAsset:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return p(p({},e),((r={})[i]=p(p({},Nr()),{loading:!0}),r));case"success":return function(t,e){xn()[t]=e,localStorage.setItem("candu.portals",JSON.stringify(e))}(i,u),p(p({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return p(p({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});function Dn(t,r){var n=t.slug;c.default(e.isIdentifier(n),"(Portal) You must supply a valid slug");var o=r.getFluxState(kr).clientToken,a=r.select(Lr.selectors.segmentIds);if(a){r.registerFlux(jn);var i=r.select(jn.selectors.portalAsset(n)),u=r.select(jn.selectors.isLoadingOrHasErrors(n));if(!i&&!u){var s=performance.now(),l=function(t,e,r){return h(void 0,void 0,void 0,(function(){var n;return g(this,(function(o){return n="?segmentIds="+(r||[]).join(","),[2,fetch("https://cdn.candu.ai/portalMemberships/"+t+"/"+e+"/head.json"+n)]}))}))}(o,n,a);l&&(r.dispatch(jn.actions.loading(n)),l.then((function(t){return r.dispatch(jn.actions.success({slug:n,result:t,loadTime:performance.now()-s}))})).catch((function(t){return r.dispatch(jn.actions.error({slug:n,error:t,loadTime:performance.now()-s}))})),r.registerFlux(jn))}}}var Ln,Pn,Fn=function(t){var e=t.tutorialDocument;return e?u.default.createElement(Uo,{tutorialDocument:e}):null},Mn=function(t,e){return{tutorialDocument:jn.selectors.portalAsset(e.slug)}},Un=function(t){Dn(t,Hr());var e=Vr(Mn)(Fn);return u.default.createElement(e,p({},t))},Gn=function(t){return"candu.sdk."+t},Hn=function(t){return Gn("error."+t)},Bn="unknown_node_type",Vn="unkown_inline_node_type",zn="unkown_node_object_type",Yn="tutorial_error_boundary",Wn="portal_error_boundary",Kn="provider_error_boundary",Jn={HEARTBEAT:Gn("heartbeat"),PREVIEW_OPEN:Gn("preview.open"),PORTAL:Gn("portal"),TUTORIAL:Gn("tutorial"),TUTORIAL_INTERACTION:Gn("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Hn("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Hn("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Hn("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Hn("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Hn("commit_api"),TUTORIAL_LOADING_ERROR:Hn("tutorial"),UNKOWN_NODE_TYPE:Hn(Bn),UNKOWN_INLINE_NODE_TYPE:Hn(Vn),UNKOWN_NODE_OBJECT_TYPE:Hn(zn),TUTORIAL_ERROR:Hn(Yn),PORTAL_ERROR:Hn(Wn),PROVIDER_ERROR:Hn(Kn),STYLEGUIDE_MAP_ERROR:Hn(Yn),RENDER_NODE_ERROR:Hn(Yn),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Hn("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Hn("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Hn("state_fetch_failed"),STATE_UPDATE_FAILED:Hn("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Hn("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:Gn("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:Gn("tutorial.checklist_group_complete"),CARD_DISMISSED:Gn("tutorial.card_dismissed")},qn=function(t){return"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+"."},$n=((Ln={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"})[Jn.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[Jn.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[Jn.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",Ln[Jn.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",Ln[Jn.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",Ln[Jn.UNKOWN_INLINE_NODE_TYPE]=qn(Vn),Ln[Jn.UNKOWN_NODE_TYPE]=qn(Bn),Ln[Jn.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Ln[Jn.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Ln[Jn.PORTAL_ERROR]="An error has occured within Portal",Ln[Jn.PROVIDER_ERROR]="An error has occured within Provider",Ln[Jn.TUTORIAL_ERROR]="An error has occured within Tutorial",Ln[Jn.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",Ln[Jn.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",Ln[Jn.STATE_FETCH_FAILED]="An error has occured while fetching state:",Ln[Jn.STATE_UPDATE_FAILED]="An error has occured while updating state:",Ln[Jn.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",Ln),Zn=function(t){switch(t.trigger){case e.TRIGGERS.ON_CLICK:default:return"onClick"}},Qn=function(t,r,n){var o,a,i;switch(t.handler.type){case e.HANDLER_TYPES.NAVIGATE:return(o={})[Zn(t)]=function(e){e.stopPropagation();var o=t.handler,a=o.href,i=o.target,u=n||{},c=u.parentTrackers,s=v(u,["parentTrackers"]);c&&c.forEach((function(e){return r(t,e)})),r(t,s),"Blank"===i?window.open(a,"_blank"):a&&a.includes("mailto:")?window.location=a:document.location.href=a},o;case e.HANDLER_TYPES.CHANGE_TUTORIAL:return(a={})[Zn(t)]=function(){var r=t.handler.tutorialId;e.logger.error("TODO -> change tutorial",r)},a;case e.HANDLER_TYPES.OPEN_GUIDE:return(i={})[Zn(t)]=function(){var r=t.handler.guideId;e.logger.error("TODO -> open guide",r)},i;default:return{}}},Xn=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},to=function(t,e){var r=t.states;return Object.keys(r||{}).map((function(t){return e.select(zr.selectors.provider(t))}))},eo=function(t,e,r){var n=t.nodes;return n&&n.map((function(t){return e.nodes[t]})).filter((function(t){return!!t})).map((function(t){return to(t,r)||[]})).reduce((function(t,e){return t.concat(e)}),[])},ro=function(t,r,n){var o=r.getFluxState(xr);try{var a=n.document,i=a.nodes[t];if(!i)return e.logger.error("Document is corrupted. Refusing to move further."),null;var u=function(t){return ro(t,r,n)},c=i.type,s=i.props,l=i.css,d=p(p(p({},s||{}),{style:l||{},children:Xn(i,u)}),function(t,r,n){var o,a,i,u,c,s,l=r.getFluxState(xr);if("Link"===t.type&&(null===(o=t.props)||void 0===o?void 0:o.href)){var d=t.props.href+" Link Clicked",f=null===(i=null===(a=t)||void 0===a?void 0:a.nodes)||void 0===i?void 0:i[0];if(f){var v=n.nodes[f];"Text"===(null===(u=v)||void 0===u?void 0:u.type)&&(null===(s=null===(c=v)||void 0===c?void 0:c.props)||void 0===s?void 0:s.children)&&(d=v.props.children+" Link Clicked")}return{onClick:function(){var r;return l.track(Jn.TUTORIAL_INTERACTION,{trigger:e.TRIGGERS.ON_CLICK,category:t.type,eventName:d,handler:{href:null===(r=t.props)||void 0===r?void 0:r.href,type:e.HANDLER_TYPES.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var h=function(t,e){l.track(Jn.TUTORIAL_INTERACTION,p(p({},t),e||{}))};return t.data.actions.map((function(t){return Qn(t,h,{})})).reduce((function(t,e){return p(p({},t),e)}),{})}(i,r,a)),f={nodeId:t,node:i,document:a,render:{node:u,styleguide:function(t,e){return void 0===e&&(e={}),n.renderNode(t,{api:f,attributes:e})},tutorial:function(t){return n.renderTutorial(t)},portal:function(t){return n.renderPortal(t)}},trackingIdentifiers:{},stateInstances:to(i,r),childrenStateInstances:eo(i,a,r)},v=f.render.styleguide(c,d);return v||(e.logger.error($n[Jn.UNKOWN_NODE_TYPE],{type:c}),o.error(new Error($n[Jn.UNKOWN_NODE_TYPE]),{type:c}),null)}catch(t){return e.logger.error($n[Jn.STYLEGUIDE_MAP_ERROR],t),o.error(t),null}},no=function(t,e){var r,n,o,a,i="string"==typeof e&&e.split(" ");return i?1===i.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===i.length?((n={})[t+"Top"]=i[0],n[t+"Right"]=i[1],n[t+"Bottom"]=i[0],n[t+"Left"]=i[1],n):3===i.length?((o={})[t+"Top"]=i[0],o[t+"Right"]=i[1],o[t+"Bottom"]=i[2],o[t+"Left"]=i[1],o):((a={})[t+"Top"]=i[0],a[t+"Right"]=i[1],a[t+"Bottom"]=i[2],a[t+"Left"]=i[3],a):{}},oo=function(t){var e=t.padding,r=t.margin,n=v(t,["padding","margin"]),o={};return e&&(o=p(p({},o),no("padding",e))),r&&(o=p(p({},o),no("margin",r))),p(p({},o),n)},ao=function(t){return"candu.sdk."+t},io=function(t){return ao("error."+t)},uo=(ao("preview.open"),ao("portal"),ao("tutorial"),io("portal_asset_not_found")),co=io("portal_no_segment_ids"),so=io("no_matching_tutorials"),lo=io("circular_dependecy_embed_portal"),fo=io("circular_dependecy_embed_tutorial"),po=((Pn={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"})[uo]="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",Pn[co]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",Pn[so]="The Tutorial will not be rendered because there are no matching segments for the given user.",Pn[lo]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Pn[fo]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Pn);var vo=function(t,e){return function(r,n){if(null==r)return r;if(!It(r))return t(r,n);for(var o=r.length,a=e?o:-1,i=Object(r);(e?a--:++a<o)&&!1!==n(i[a],a,i););return r}}(At);var ho=function(t,e){var r=-1,n=It(t)?Array(t.length):[];return vo(t,(function(t,o,a){n[++r]=e(t,o,a)})),n};var go=function(t,e){return(at(t)?cr:ho)(t,Or(e))},mo=function(){function t(t,r,n){var o=this;this.observer=new e.Observer,this.rootStore=t,this.providerId=r,this.resolver=n,this.eventing=t.getFluxState(xr),this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,r).then((function(t){return o.updateState(t)})).catch((function(t){e.logger.error(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_FETCH_FAILED],t.message),o.eventing.track(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var r=this,n=this.state;this.updateState(p(p({},n),t)),this.resolver.update(this.rootStore,this.providerId,t).then((function(t){return r.updateState(t)})).catch((function(t){e.logger.error(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_UPDATE_FAILED],t.message),r.eventing.track(e.ERROR_MESSAGES[e.EVENT_NAMES.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&r.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),yo=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),bo=Object.create(null),_o=function(){function t(t){this.cache=new yo,this.options=p({},t||{})}return t.register=function(t,e){bo[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=v(t,["type"]),n=bo[e];return n?new n(r):null},t.prototype.toJSON=function(){return p({type:this.type},this.options)},t}();var Eo=function(t,e,r,n){for(var o=t.length,a=r+(n?1:-1);n?a--:++a<o;)if(e(t[a],a,t))return a;return-1};var To=function(t){return t!=t};var So=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var Io=function(t,e,r){return e==e?So(t,e,r):Eo(t,To,r)};var Oo=function(t,e){return!!(null==t?0:t.length)&&Io(t,e,0)>-1};var Ao=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var Co=function(){},wo=Le&&1/be(new Le([,-0]))[1]==1/0?function(t){return new Le(t)}:Co;var Ro=function(t,e,r){var n=-1,o=Oo,a=t.length,i=!0,u=[],c=u;if(r)i=!1,o=Ao;else if(a>=200){var s=e?null:wo(t);if(s)return be(s);i=!1,o=he,c=new pe}else c=e?[]:u;t:for(;++n<a;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,i&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,r)||(c!==u&&c.push(d),u.push(l))}return u};var No=function(t){return t&&t.length?Ro(t):[]},ko=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new l.default(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),xo="https://api.candu.ai"+Mr,jo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.retrieve=function(t,e){return h(this,void 0,void 0,(function(){var r,n,o,a,i=this;return g(this,(function(u){switch(u.label){case 0:return r=t.getFluxState(kr).clientToken,n=t.getFluxState(jr).userId,[4,ko.get("cardStateApi",(function(t){return h(i,void 0,void 0,(function(){var e;return g(this,(function(o){switch(o.label){case 0:return[4,fetch(xo+"?token="+r+"&finder=byIds&ids="+No(t).join(",")+"&userId="+n).then((function(t){return t.json()}))];case 1:return e=o.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return o=u.sent(),a={id:e,state:{dismissed:!1}},[2,o||a]}}))}))},e.prototype.update=function(t,e,r){var n=t.getFluxState(kr).clientToken,o=t.getFluxState(jr).userId;return fetch(xo+"/"+e+"?token="+n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:o.toString()})}).then((function(t){return t.json()}))},e}(_o);_o.register(e.StateResolverType.CardApi,jo);var Do="https://api.candu.ai"+Fr;function Lo(t){return{state:t.state,id:t.id}}function Po(t){switch(t){case e.CheckListScope.Account:return"AccountId";case e.CheckListScope.User:default:return"UserId"}}var Fo=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return f(r,t),r.prototype.getScopeAndFieldsFromRootState=function(t){var r=t.getFluxState(jr),n=r.userId,o=r.traits,a=this.options.scopeTrait,i=this.options.scope||e.CheckListScope.User,u=n.toString();return i===e.CheckListScope.Account&&(a&&o[a]?u=o[a]:(e.logger.warning("trait '"+a+"' is not defined, falling back to user scope"),i=e.CheckListScope.User)),{scope:i,scopeField:u}},r.prototype.retrieve=function(t,r){return h(this,void 0,void 0,(function(){var n,o,a,i,u=this;return g(this,(function(c){switch(c.label){case 0:return n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(kr).clientToken,[4,ko.get("checklistState",(function(t){return h(u,void 0,void 0,(function(){var e;return g(this,(function(r){switch(r.label){case 0:return[4,fetch(Do+"?token="+i+"&byTrait="+Po(o)+"&field="+a+"&finder=byIds&ids="+No(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(Lo)}))];case 1:return e=r.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(r)];case 1:return[2,c.sent()||{id:r,state:e.CheckListItemStatus.NotStared}]}}))}))},r.prototype.update=function(t,e,r){var n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(kr).clientToken;return fetch(Do+"/"+e+"?token="+i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(p(p({},r),{byTrait:Po(o),field:a}))}).then((function(t){return t.json()})).then(Lo)},r}(_o);function Mo(t,r){var n=t.document,o=n.stateProviders,a=n.head,i=r.getFluxState(kr).clientToken;a&&e.fetchHead(a,i),o&&function(t,e){var r;e.registerFlux(zr);var n=go(t,(function(t,r){if(e.select(zr.selectors.provider(r)))return null;var n=_o.fromJSON(t.resolver);return n?new mo(e,r,n):null})).filter((function(t){return!!t}));e.dispatch((r=zr.actions).set.apply(r,n))}(o,r)}_o.register(e.StateResolverType.CheckListApi,Fo);var Uo=Vr((function(){return{clientToken:kr.selectors.clientToken,eventing:xr.selectors.state}}))((function(t){var r,n=t.tutorialDocument,o=t.clientToken,a=t.eventing,i=(r=Hr().select(kr.selectors.styleguide),kn({provider:r},Nn)).getComponent,c=Hr();if(!n.document)return null;Mo(n,c);var s=n.document,l=s.rootNodeId,d=s.head,f=s.nodes,v={rootNodeId:l,nodes:e.adaptCustomNodes(f)};return d&&e.fetchHead(d,o),ro(n.document.rootNodeId,c,{document:v,renderTutorial:function(t){return u.default.createElement(Bo,p({},t))},renderPortal:function(t){return u.default.createElement(Un,p({},t))},renderNode:function(t,r){try{var n=i(t);return n?u.default.createElement(n,{key:r.api.nodeId,api:r.api,attributes:p(p({},r.attributes),{style:r.attributes.style&&oo(r.attributes.style)})}):null}catch(t){return e.logger.error(po[e.EVENT_NAMES.RENDER_NODE_ERROR],t),a.error(t),null}}})})),Go=function(t){var e=t.tutorialDocument;return e?u.default.createElement(Uo,{tutorialDocument:e}):null},Ho=function(t,e){return{tutorialDocument:Wr.selectors.tutorialDocument(e.slug)}},Bo=function(t){!function(t,r){var n=e.tutorialValidation(t),o=r.getFluxState(xr),a=r.getFluxState(kr).clientToken;r.registerFlux(Wr);var i=n.slug,u=r.select(Wr.selectors.tutorialDocument(i));if(!r.select(Wr.selectors.isLoadingOrHasErrors(i))&&!u){var c=performance.now(),s=e.RESOURCES.tutorialDocument(n,a,o);s&&(r.dispatch(Wr.actions.loading(i)),s.then((function(t){return r.dispatch(Wr.actions.success({slug:i,result:t,loadTime:performance.now()-c}))})).catch((function(t){return r.dispatch(Wr.actions.error({slug:i,error:t,loadTime:performance.now()-c}))})))}}(t,Hr());var r=Vr(Ho)(Go);return u.default.createElement(r,p({},t))};exports.CanduProvider=Br,exports.Portal=Un,exports.ProviderContext=Gr,exports.Tutorial=Bo,exports.useRootStore=Hr;
//# sourceMappingURL=index.cjs.js.map

@@ -15,3 +15,3 @@ import t,{useContext as e,Fragment as r,useMemo as n,useState as o,useLayoutEffect as i,useEffect as a}from"react";import{RESOURCES as u,METRICS as c,internalEventing as s,attachStylesheet as l,isClientToken as d,isUserId as f,tutorialValidation as p,toCssSelector as v,CardResolverInstance as h,logger as g,EVENT_NAMES as m,CATEGORIES as y,TRIGGERS as b,HANDLER_TYPES as _,CANDU_PORTAL_CLASS as E,logError as T,getCheckListStateProviders as I,getInitialItems as O,calculateGroupCompletion as w,getFirstNotStartedItem as S,CheckListItemStatus as A,CheckListResolverInstance as C,mergeStyleguidesFromContext as N,isIdentifier as x,Observer as j,ERROR_MESSAGES as R,StateResolverType as k,CheckListScope as D,fetchHead as P,adaptCustomNodes as L}from"@candulabs/core";import{noOpEventing as F,getAnonymousId as U,eventingFactory as M}from"@candulabs/eventing";import B from"invariant";import z from"react-player";import"setimmediate";import H from"dataloader";

and limitations under the License.
***************************************************************************** */var G=function(t,e){return(G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function V(t,e){function r(){this.constructor=t}G(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Y=function(){return(Y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function W(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function K(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(a,u)}c((n=n.apply(t,e||[])).next())}))}function J(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var $=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(t){var e={exports:{}};return t(e,e.exports),e.exports}var Q="object"==typeof q&&q&&q.Object===Object&&q,X="object"==typeof self&&self&&self.Object===Object&&self,tt=Q||X||Function("return this")(),et=tt.Symbol,rt=Object.prototype,nt=rt.hasOwnProperty,ot=rt.toString,it=et?et.toStringTag:void 0;var at=function(t){var e=nt.call(t,it),r=t[it];try{t[it]=void 0;var n=!0}catch(t){}var o=ot.call(t);return n&&(e?t[it]=r:delete t[it]),o},ut=Object.prototype.toString;var ct=function(t){return ut.call(t)},st=et?et.toStringTag:void 0;var lt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":st&&st in Object(t)?at(t):ct(t)};var dt,ft=function(t){if(!$(t))return!1;var e=lt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},pt=tt["__core-js_shared__"],vt=(dt=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||""))?"Symbol(src)_1."+dt:"";var ht=function(t){return!!vt&&vt in t},gt=Function.prototype.toString;var mt=function(t){if(null!=t){try{return gt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},yt=/^\[object .+?Constructor\]$/,bt=Function.prototype,_t=Object.prototype,Et=bt.toString,Tt=_t.hasOwnProperty,It=RegExp("^"+Et.call(Tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ot=function(t){return!(!$(t)||ht(t))&&(ft(t)?It:yt).test(mt(t))};var wt=function(t,e){return null==t?void 0:t[e]};var St=function(t,e){var r=wt(t,e);return Ot(r)?r:void 0},At=function(){try{var t=St(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Ct=function(t,e,r){"__proto__"==e&&At?At(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var Nt=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),u=a.length;u--;){var c=a[t?u:++o];if(!1===r(i[c],c,i))break}return e}}();var xt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var jt=function(t){return null!=t&&"object"==typeof t};var Rt=function(t){return jt(t)&&"[object Arguments]"==lt(t)},kt=Object.prototype,Dt=kt.hasOwnProperty,Pt=kt.propertyIsEnumerable,Lt=Rt(function(){return arguments}())?Rt:function(t){return jt(t)&&Dt.call(t,"callee")&&!Pt.call(t,"callee")},Ft=Array.isArray;var Ut=function(){return!1},Mt=Z((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?tt.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ut;t.exports=i})),Bt=/^(?:0|[1-9]\d*)$/;var zt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Bt.test(t))&&t>-1&&t%1==0&&t<e};var Ht=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Gt={};Gt["[object Float32Array]"]=Gt["[object Float64Array]"]=Gt["[object Int8Array]"]=Gt["[object Int16Array]"]=Gt["[object Int32Array]"]=Gt["[object Uint8Array]"]=Gt["[object Uint8ClampedArray]"]=Gt["[object Uint16Array]"]=Gt["[object Uint32Array]"]=!0,Gt["[object Arguments]"]=Gt["[object Array]"]=Gt["[object ArrayBuffer]"]=Gt["[object Boolean]"]=Gt["[object DataView]"]=Gt["[object Date]"]=Gt["[object Error]"]=Gt["[object Function]"]=Gt["[object Map]"]=Gt["[object Number]"]=Gt["[object Object]"]=Gt["[object RegExp]"]=Gt["[object Set]"]=Gt["[object String]"]=Gt["[object WeakMap]"]=!1;var Vt=function(t){return jt(t)&&Ht(t.length)&&!!Gt[lt(t)]};var Yt=function(t){return function(e){return t(e)}},Wt=Z((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&Q.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})),Kt=Wt&&Wt.isTypedArray,Jt=Kt?Yt(Kt):Vt,$t=Object.prototype.hasOwnProperty;var qt=function(t,e){var r=Ft(t),n=!r&&Lt(t),o=!r&&!n&&Mt(t),i=!r&&!n&&!o&&Jt(t),a=r||n||o||i,u=a?xt(t.length,String):[],c=u.length;for(var s in t)!e&&!$t.call(t,s)||a&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||zt(s,c))||u.push(s);return u},Zt=Object.prototype;var Qt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Zt)};var Xt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),te=Object.prototype.hasOwnProperty;var ee=function(t){if(!Qt(t))return Xt(t);var e=[];for(var r in Object(t))te.call(t,r)&&"constructor"!=r&&e.push(r);return e};var re=function(t){return null!=t&&Ht(t.length)&&!ft(t)};var ne=function(t){return re(t)?qt(t):ee(t)};var oe=function(t,e){return t&&Nt(t,e,ne)};var ie=function(){this.__data__=[],this.size=0};var ae=function(t,e){return t===e||t!=t&&e!=e};var ue=function(t,e){for(var r=t.length;r--;)if(ae(t[r][0],e))return r;return-1},ce=Array.prototype.splice;var se=function(t){var e=this.__data__,r=ue(e,t);return!(r<0)&&(r==e.length-1?e.pop():ce.call(e,r,1),--this.size,!0)};var le=function(t){var e=this.__data__,r=ue(e,t);return r<0?void 0:e[r][1]};var de=function(t){return ue(this.__data__,t)>-1};var fe=function(t,e){var r=this.__data__,n=ue(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function pe(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])}}pe.prototype.clear=ie,pe.prototype.delete=se,pe.prototype.get=le,pe.prototype.has=de,pe.prototype.set=fe;var ve=pe;var he=function(){this.__data__=new ve,this.size=0};var ge=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var me=function(t){return this.__data__.get(t)};var ye=function(t){return this.__data__.has(t)},be=St(tt,"Map"),_e=St(Object,"create");var Ee=function(){this.__data__=_e?_e(null):{},this.size=0};var Te=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Ie=Object.prototype.hasOwnProperty;var Oe=function(t){var e=this.__data__;if(_e){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Ie.call(e,t)?e[t]:void 0},we=Object.prototype.hasOwnProperty;var Se=function(t){var e=this.__data__;return _e?void 0!==e[t]:we.call(e,t)};var Ae=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_e&&void 0===e?"__lodash_hash_undefined__":e,this};function Ce(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])}}Ce.prototype.clear=Ee,Ce.prototype.delete=Te,Ce.prototype.get=Oe,Ce.prototype.has=Se,Ce.prototype.set=Ae;var Ne=Ce;var xe=function(){this.size=0,this.__data__={hash:new Ne,map:new(be||ve),string:new Ne}};var je=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Re=function(t,e){var r=t.__data__;return je(e)?r["string"==typeof e?"string":"hash"]:r.map};var ke=function(t){var e=Re(this,t).delete(t);return this.size-=e?1:0,e};var De=function(t){return Re(this,t).get(t)};var Pe=function(t){return Re(this,t).has(t)};var Le=function(t,e){var r=Re(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Fe(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])}}Fe.prototype.clear=xe,Fe.prototype.delete=ke,Fe.prototype.get=De,Fe.prototype.has=Pe,Fe.prototype.set=Le;var Ue=Fe;var Me=function(t,e){var r=this.__data__;if(r instanceof ve){var n=r.__data__;if(!be||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ue(n)}return r.set(t,e),this.size=r.size,this};function Be(t){var e=this.__data__=new ve(t);this.size=e.size}Be.prototype.clear=he,Be.prototype.delete=ge,Be.prototype.get=me,Be.prototype.has=ye,Be.prototype.set=Me;var ze=Be;var He=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var Ge=function(t){return this.__data__.has(t)};function Ve(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Ue;++e<r;)this.add(t[e])}Ve.prototype.add=Ve.prototype.push=He,Ve.prototype.has=Ge;var Ye=Ve;var We=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 Ke=function(t,e){return t.has(e)};var Je=function(t,e,r,n,o,i){var a=1&r,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var s=i.get(t),l=i.get(e);if(s&&l)return s==e&&l==t;var d=-1,f=!0,p=2&r?new Ye:void 0;for(i.set(t,e),i.set(e,t);++d<u;){var v=t[d],h=e[d];if(n)var g=a?n(h,v,d,e,t,i):n(v,h,d,t,e,i);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!We(e,(function(t,e){if(!Ke(p,e)&&(v===t||o(v,t,r,n,i)))return p.push(e)}))){f=!1;break}}else if(v!==h&&!o(v,h,r,n,i)){f=!1;break}}return i.delete(t),i.delete(e),f},$e=tt.Uint8Array;var qe=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Ze=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},Qe=et?et.prototype:void 0,Xe=Qe?Qe.valueOf:void 0;var tr=function(t,e,r,n,o,i,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new $e(t),new $e(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ae(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=qe;case"[object Set]":var c=1&n;if(u||(u=Ze),t.size!=e.size&&!c)return!1;var s=a.get(t);if(s)return s==e;n|=2,a.set(t,e);var l=Je(u(t),u(e),n,o,i,a);return a.delete(t),l;case"[object Symbol]":if(Xe)return Xe.call(t)==Xe.call(e)}return!1};var er=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var rr=function(t,e,r){var n=e(t);return Ft(t)?n:er(n,r(t))};var nr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i};var or=function(){return[]},ir=Object.prototype.propertyIsEnumerable,ar=Object.getOwnPropertySymbols,ur=ar?function(t){return null==t?[]:(t=Object(t),nr(ar(t),(function(e){return ir.call(t,e)})))}:or;var cr=function(t){return rr(t,ne,ur)},sr=Object.prototype.hasOwnProperty;var lr=function(t,e,r,n,o,i){var a=1&r,u=cr(t),c=u.length;if(c!=cr(e).length&&!a)return!1;for(var s=c;s--;){var l=u[s];if(!(a?l in e:sr.call(e,l)))return!1}var d=i.get(t),f=i.get(e);if(d&&f)return d==e&&f==t;var p=!0;i.set(t,e),i.set(e,t);for(var v=a;++s<c;){var h=t[l=u[s]],g=e[l];if(n)var m=a?n(g,h,l,e,t,i):n(h,g,l,t,e,i);if(!(void 0===m?h===g||o(h,g,r,n,i):m)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){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||(p=!1)}return i.delete(t),i.delete(e),p},dr=St(tt,"DataView"),fr=St(tt,"Promise"),pr=St(tt,"Set"),vr=St(tt,"WeakMap"),hr=mt(dr),gr=mt(be),mr=mt(fr),yr=mt(pr),br=mt(vr),_r=lt;(dr&&"[object DataView]"!=_r(new dr(new ArrayBuffer(1)))||be&&"[object Map]"!=_r(new be)||fr&&"[object Promise]"!=_r(fr.resolve())||pr&&"[object Set]"!=_r(new pr)||vr&&"[object WeakMap]"!=_r(new vr))&&(_r=function(t){var e=lt(t),r="[object Object]"==e?t.constructor:void 0,n=r?mt(r):"";if(n)switch(n){case hr:return"[object DataView]";case gr:return"[object Map]";case mr:return"[object Promise]";case yr:return"[object Set]";case br:return"[object WeakMap]"}return e});var Er=_r,Tr="[object Object]",Ir=Object.prototype.hasOwnProperty;var Or=function(t,e,r,n,o,i){var a=Ft(t),u=Ft(e),c=a?"[object Array]":Er(t),s=u?"[object Array]":Er(e),l=(c="[object Arguments]"==c?Tr:c)==Tr,d=(s="[object Arguments]"==s?Tr:s)==Tr,f=c==s;if(f&&Mt(t)){if(!Mt(e))return!1;a=!0,l=!1}if(f&&!l)return i||(i=new ze),a||Jt(t)?Je(t,e,r,n,o,i):tr(t,e,c,r,n,o,i);if(!(1&r)){var p=l&&Ir.call(t,"__wrapped__"),v=d&&Ir.call(e,"__wrapped__");if(p||v){var h=p?t.value():t,g=v?e.value():e;return i||(i=new ze),o(h,g,r,n,i)}}return!!f&&(i||(i=new ze),lr(t,e,r,n,o,i))};var wr=function t(e,r,n,o,i){return e===r||(null==e||null==r||!jt(e)&&!jt(r)?e!=e&&r!=r:Or(e,r,n,o,t,i))};var Sr=function(t,e,r,n){var o=r.length,i=o,a=!n;if(null==t)return!i;for(t=Object(t);o--;){var u=r[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var c=(u=r[o])[0],s=t[c],l=u[1];if(a&&u[2]){if(void 0===s&&!(c in t))return!1}else{var d=new ze;if(n)var f=n(s,l,c,t,e,d);if(!(void 0===f?wr(l,s,3,n,d):f))return!1}}return!0};var Ar=function(t){return t==t&&!$(t)};var Cr=function(t){for(var e=ne(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,Ar(o)]}return e};var Nr=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var xr=function(t){var e=Cr(t);return 1==e.length&&e[0][2]?Nr(e[0][0],e[0][1]):function(r){return r===t||Sr(r,t,e)}};var jr=function(t){return"symbol"==typeof t||jt(t)&&"[object Symbol]"==lt(t)},Rr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kr=/^\w*$/;var Dr=function(t,e){if(Ft(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!jr(t))||(kr.test(t)||!Rr.test(t)||null!=e&&t in Object(e))};function Pr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(Pr.Cache||Ue),r}Pr.Cache=Ue;var Lr=Pr;var Fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ur=/\\(\\)?/g,Mr=function(t){var e=Lr(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Fr,(function(t,r,n,o){e.push(n?o.replace(Ur,"$1"):r||t)})),e}));var Br=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},zr=et?et.prototype:void 0,Hr=zr?zr.toString:void 0;var Gr=function t(e){if("string"==typeof e)return e;if(Ft(e))return Br(e,t)+"";if(jr(e))return Hr?Hr.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var Vr=function(t){return null==t?"":Gr(t)};var Yr=function(t,e){return Ft(t)?t:Dr(t,e)?[t]:Mr(Vr(t))};var Wr=function(t){if("string"==typeof t||jr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Kr=function(t,e){for(var r=0,n=(e=Yr(e,t)).length;null!=t&&r<n;)t=t[Wr(e[r++])];return r&&r==n?t:void 0};var Jr=function(t,e,r){var n=null==t?void 0:Kr(t,e);return void 0===n?r:n};var $r=function(t,e){return null!=t&&e in Object(t)};var qr=function(t,e,r){for(var n=-1,o=(e=Yr(e,t)).length,i=!1;++n<o;){var a=Wr(e[n]);if(!(i=null!=t&&r(t,a)))break;t=t[a]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&Ht(o)&&zt(a,o)&&(Ft(t)||Lt(t))};var Zr=function(t,e){return null!=t&&qr(t,e,$r)};var Qr=function(t,e){return Dr(t)&&Ar(e)?Nr(Wr(t),e):function(r){var n=Jr(r,t);return void 0===n&&n===e?Zr(r,t):wr(e,n,3)}};var Xr=function(t){return t};var tn=function(t){return function(e){return null==e?void 0:e[t]}};var en=function(t){return function(e){return Kr(e,t)}};var rn=function(t){return Dr(t)?tn(Wr(t)):en(t)};var nn=function(t){return"function"==typeof t?t:null==t?Xr:"object"==typeof t?Ft(t)?Qr(t[0],t[1]):xr(t):rn(t)};var on=function(t,e){var r={};return e=nn(e),oe(t,(function(t,n,o){Ct(r,n,e(t,n,o))})),r};function an(t){var e=t.name,r=t.actions,n=t.selectors,o=W(t,["name","actions","selectors"]);return Y(Y({},o),{actions:on(r||{},(function(t,r){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return Y({type:r,storeName:e},t.apply(void 0,n))}})),selectors:on(n||{},(function(t){function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return{storeName:e,selector:t.apply(void 0,r)}}return r.storeName=e,r.selector=t,r})),name:e})}function un(t){var e=t.name,r=t.initialValue,n=t.reducer,o=r,i=[];return{name:e,getState:function(){return o},subscribe:function(t){return i.push(t),function(){i=i.filter((function(e){return e!==t}))}},dispatch:function(t){var e=o;return"object"==typeof e&&null!==e?e=Y({},o):Array.isArray(e)&&(e=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,u=i.length;a<u;a++,o++)n[o]=i[a];return n}(o)),o=n(t,o),i.forEach((function(r){return r(o,e,t)})),this}}}function cn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.fromEntries(t.map((function(t){return[t.name,t]})));return{name:"root",getFluxState:function(t){var e=this.getStore(t);if(!e)throw new Error("rootState.getFluxState: the flux store "+t.name+" does not exist");return e.getState()},getState:function(){return on(r,(function(t){return t.getState()}))},getStore:function(t){var e="string"==typeof t?t:t.name;return r[e]},registerFlux:function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter((function(t){var e=t.name;return!r[e]})).forEach((function(e){return t.register(un(e))})),this},register:function(t){return r[t.name]=t,this},dispatch:function(t){t.storeName?r[t.storeName].dispatch(t):Object.values(r).forEach((function(e){return e.dispatch(t)}))},remove:function(t){return delete r[t.name],this},select:function(t){var e;return t.selector(null===(e=r[t.storeName])||void 0===e?void 0:e.getState())}}}var sn=function(t){return{loading:!1,result:t,error:void 0,loadTime:0}},ln=an({name:"config",initialValue:{clientToken:"",options:{},styleguide:{}},actions:{set:function(t){return{payload:t}}},selectors:{styleguide:function(t){return t.styleguide},clientToken:function(t){return t.clientToken}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e}}),dn=an({name:"eventing",initialValue:F,actions:{set:function(t){return{eventing:t}}},selectors:{state:function(t){return t}},reducer:function(t,e){var r=t.type,n=t.eventing;return"set"===r?n:e}}),fn=an({name:"user",initialValue:{userId:U(),traits:{}},actions:{set:function(t){return{payload:t}}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e},selectors:{userId:function(t){return t.userId}}}),pn=function(t){return localStorage.setItem("candu.segmentMembership",JSON.stringify(t))},vn=an({name:"segmentMembership",initialValue:sn(function(){try{var t=localStorage.getItem("candu.segmentMembership"),e=t&&JSON.parse(t);if(!e)return;return{id:"",segmentIds:e}}catch(t){return}}()),actions:{loading:function(){return{}},success:function(t){return t},error:function(t){return t}},selectors:{segmentIds:function(t){var e;return null===(e=t.result)||void 0===e?void 0:e.segmentIds}},reducer:function(t,e){var r=t.type,n=t.result,o=t.loadTime,i=t.error;switch(r){case"loading":return Y(Y({},e),{loading:!0});case"success":return pn(n.segmentIds),Y(Y({},e),{loading:!1,error:void 0,result:n,loadTime:o});case"error":return{loading:!1,result:void 0,error:i,loadTime:o};default:return e}}});var hn={name:"@candulabs/harbour",version:"0.7.1-alpha.16"},gn="/api/checklistItems",mn="/api/cards";function yn(t,e){e.registerFlux(ln,fn,dn,vn);var r=function(t,e){var r=t.clientToken,n=t.userId,o=t.traits,i=t.options,a=t.styleguide,u=W(t,["clientToken","userId","traits","options","styleguide"]);B(d(r),"(Candu) you must provide a valid clientToken"),B(!n||f(n),"(Candu) you must provide a valid userId"),B(!o||$(o),"(Candu) traits must be undefined or an object"),B(!i||$(i),"(Candu) options must be undefined or an object"),B(!a||$(a),"(Candu) styleguide must be undefined or an object");var c=e.getFluxState(fn);return Y(Y({},u),{clientToken:r,traits:o||c.traits||{},options:i||{},styleguide:a||{},userId:n||c.userId})}(t,e),n=r.clientToken,o=r.userId,i=r.traits,a=r.styleguide,p=r.options,v=M(n,o,p,hn);s(v).provider({userId:o,traits:i,styleguide:a}),e.dispatch(fn.actions.set({userId:o,traits:i})),e.dispatch(dn.actions.set(v)),e.dispatch(ln.actions.set({clientToken:n,options:p,styleguide:a})),l(n),function(t){var e=t.getFluxState(ln),r=e.clientToken,n=e.options,o=t.getFluxState(fn).userId,i=t.getFluxState(dn);if(n.skipLoading||n.overrideSegmentMemberships){var a={id:o,segmentIds:n.overrideSegmentMemberships||[]};t.dispatch(vn.actions.success({result:a,loadTime:0}))}else{var s=performance.now();t.dispatch(vn.actions.loading()),u.segmentMembership(r,o).then((function(e){var r=performance.now()-s;i.track(c.SEGMENT_MEMBERSHIP_LOAD_TIME,{value:r}),t.dispatch(vn.actions.success({result:e,loadTime:r}))})).catch((function(e){return t.dispatch(vn.actions.error({error:e,loadTime:performance.now()-s}))}))}}(e)}var bn=t.createContext(cn()),_n=function(){return e(bn)},En=function(e){function r(t){var r=e.call(this,t)||this;r.state=cn();var n=r.props;return n.children,yn(W(n,["children"]),r.state),r}return V(r,e),r.prototype.render=function(){return t.createElement(bn.Provider,{value:this.state},this.props.children)},r}(t.Component),Tn=function(e){return function(r){var n;return(n=function(n){function o(t){var e=n.call(this,t)||this;return e.unsubscribes=[],e.handleChange=e.handleChange.bind(e),e}return V(o,n),o.prototype.componentDidMount=function(){var t=this;this.handleChange();var r=Object.values(e(this.context,this.props)).map((function(e){var r=e.storeName;return t.context.getStore(r).subscribe}));this.unsubscribes=r.map((function(e){return e(t.handleChange)}))},o.prototype.componentWillUnmount=function(){this.unsubscribes.forEach((function(t){return t()}))},o.prototype.mapStateToProps=function(){var t=this;return on(e(this.context,this.props),(function(e){return e.selector&&e.storeName?t.context.select(e):e}))},o.prototype.handleChange=function(){this.setState(this.mapStateToProps())},o.prototype.render=function(){return t.createElement(r,Y({},this.state||this.mapStateToProps(),this.props))},o}(t.Component)).contextType=bn,n}},In=an({name:"stateProviders",initialValue:{},actions:{set:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{providers:t}}},selectors:{provider:function(t){return function(e){return e[t]}}},reducer:function(t,e){var r=t.type,n=t.providers;switch(r){case"set":return Y(Y({},e),Object.fromEntries(n.map((function(t){return[t.providerId,t]}))));default:return e}}}),On=function(){try{var t=localStorage.getItem("candu.tutorials");return t?JSON.parse(t):{}}catch(t){return{}}},wn=an({name:"tutorialDocuments",initialValue:on(On(),sn),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{tutorialDocument:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,i=t.type,a=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(i){case"loading":return Y(Y({},e),((r={})[a]=Y(Y({},sn()),{loading:!0}),r));case"success":return function(t,e){var r=On();r[t]=e,localStorage.setItem("candu.tutorials",JSON.stringify(r))}(a,u),Y(Y({},e),((n={})[a]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return Y(Y({},e),((o={})[a]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});var Sn,An=["div","a","p"],Cn={Fragment:r,Document:r},Nn="#6310E5",xn="#59C3C3",jn="#4D515D",Rn="#FCAD0D",kn="#EE4266",Dn=function(e){B($(e),"(createStyleguide) styleguide must be undefined or an object");return{getComponent:function(n){var o=function(t){if(e[t])return e[t];if(Cn[t])return Cn[t];var r=An.indexOf(t)||An.indexOf(t.toLowerCase());return An[r]}(n);return"string"==typeof o?function(e){var r=e.api,n=e.attributes;return t.createElement(o,Y({key:r.nodeId},n))}:o===r?function(e){var n=e.api,o=e.attributes;return t.createElement(r,{key:n.nodeId},o.children)}:o},all:function(){return e}}},Pn={borderRadius:"4px",padding:"8px"},Ln=function(t){switch(t){case"success":return Nn;case"active":return xn;case"warning":return Rn;case"danger":return kn;default:return jn}},Fn=function(){return t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M6 6L18 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}),t.createElement("path",{d:"M18 6L6 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}))},Un=function(){return _n().getFluxState(dn)},Mn={borderRadius:"4px",padding:"8px",backgroundColor:"rgb(51, 55, 69)",color:"rgb(255, 255, 255)",overflow:"auto"},Bn={display:"flex"},zn={flex:"1 1"},Hn={maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"};!function(t){t.Ordered="OL",t.Unordered="UL"}(Sn||(Sn={}));var Gn,Vn={backgroundColor:"transparent",border:"none",borderTop:"1px solid #edeff3",height:"0"},Yn=function(e){return function(r){var n,o=r.attributes,i=["h1","h2","h3","h4","p"].includes(e);i&&(n={variant:e.toUpperCase()});var a=v(i?"typography":e,{variant:n,output:"html"});return t.createElement(e,Y({},o,{className:a}))}},Wn=function(e){var r=Yn("div");return t.createElement(r,Y({},e))},Kn="640px",Jn="360px",$n={border:"1px solid var(--color-lines)",borderRadius:"4px",marginBottom:"16px",backgroundColor:"white",display:"flex",flexDirection:"column"},qn={padding:"16px",display:"flex",flexDirection:"row",alignItems:"center",flexGrow:1,boxSizing:"border-box",color:"var(--color-neutral)"},Zn={padding:"16px 48px",display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",transition:"all .35s ease-out 0s"},Qn={borderRadius:"20px",height:"32px",width:"32px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",marginRight:"16px",appearance:"none",outline:"none",padding:0,transition:"all .1s ease-out 0s"},Xn={appearance:"none",border:"none",outline:"none",cursor:"pointer",background:"none",padding:"0px",display:"flex"},to={marginBottom:"48px"},eo={width:"100%",height:"4px",marginBottom:"16px",backgroundColor:"#EDEFF3"},ro={height:"100%",backgroundColor:"#59C3C3",transition:"all .35s ease-out 0s"},no=function(e){var r=e.direction;return t.createElement("svg",{style:{transition:"all .35s ease-out 0s",transform:"rotateZ("+("up"===r?"180deg":"0deg")+")"},width:"18",height:"11",viewBox:"0 0 18 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M9 6.74488L3.09046 0.555221C2.39741 -0.170679 1.25783 -0.186906 0.545126 0.518977C-0.167576 1.22486 -0.183508 2.38555 0.509541 3.11145L7.37034 10.2975L7.37166 10.2988C8.26633 11.2347 9.73727 11.2336 10.6306 10.2965L17.4905 3.11145C18.1835 2.38555 18.1676 1.22486 17.4549 0.518977C16.7422 -0.186906 15.6026 -0.170679 14.9095 0.555221L9 6.74488Z",fill:"#D4D8E4"}))},oo=((Gn={})[A.NotStared]={title:"Not Started",statusStyle:{backgroundColor:"#EDEFF3",borderColor:"#D4D8E4"},icon:{path:"M 2 6.55 L 5 6.55 L 10 6.55",stroke:"#9498A7"}},Gn[A.InProgress]={title:"In Progress",statusStyle:{backgroundColor:"#FE8A3A",borderColor:"white"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"white"}},Gn[A.Done]={title:"Completed",statusStyle:{backgroundColor:"#CFF5F5",borderColor:"#6DD8D8"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"#46AEAE"}},Gn),io=function(e){var r=e.onChangeStatus,n=e.status,i=o(!1),a=i[0],u=i[1],c=Y(Y(Y({},Qn),oo[n].statusStyle),{border:(a?"1px":"0px")+" solid "+oo[n].statusStyle.borderColor}),s=oo[n].title,l=oo[n].icon;return t.createElement("button",{type:"button",onClick:function(t){r(),t.stopPropagation()},style:c,title:s,onMouseOver:function(){return u(!0)},onFocus:function(){return u(!0)},onMouseOut:function(){return u(!1)},onBlur:function(){return u(!1)}},t.createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:l.path,stroke:l.stroke,strokeWidth:"2.5",strokeLinecap:"round",style:{transition:"all .1s ease-out 0s"}})))},ao=[A.NotStared,A.Done],uo=function(e){var r=e.expanded,n=e.children,o=r?Zn:Y(Y({},Zn),{maxHeight:0,padding:"0px 48px"});return t.createElement("div",{style:o},n)},co={Alert:function(e){var r=e.attributes,n=r.intent,o=r.title,i=r.description;return t.createElement("div",Y({},r,{style:Y(Y(Y({},Pn),r.style),{color:"#FFF",backgroundColor:Ln(n)||"#EDEDED"})}),o,t.createElement("div",null,t.createElement("small",null,i)))},B:function(e){var r=Yn("b");return t.createElement(r,Y({},e))},Badge:function(e){var r=e.attributes,n=r.color,o=r.outline,i=W(r,["color","outline"]),a=v("badge",{variant:{color:n,outline:o},output:"html"});return t.createElement("span",Y({},i,{className:a}))},Button:function(e){var r=e.attributes;return t.createElement("button",Y({type:"button"},r,{className:v("button",{variant:{color:r.color,outline:r.outline},output:"html"}),style:Y({},r.style||{})}))},Card:function(e){var r=e.attributes,a=r.children,u=r.isDismissible,c=W(r,["children","isDismissible"]),s=e.api,l=Un(),d=v("card",{output:"html"}),f=n((function(){var t;return null===(t=s.stateInstances)||void 0===t?void 0:t.find((function(t){return t.resolver instanceof h}))}),[]),p=o({dismissed:!1}),E=p[0],T=p[1];return i((function(){if(f)return f.subscribe((function(t){T(t.state)}))}),[f]),E.dismissed?null:t.createElement("div",Y({},c,{className:d,style:Y({position:"relative"},c.style)}),u&&t.createElement("a",{style:{position:"absolute",top:"6px",right:"6px",cursor:"pointer"},onClick:function(){f?(l.track(m.TUTORIAL_INTERACTION,Y({category:y.NATIVE,trigger:b.ON_CLICK,handler:{type:_.DISMISSED_CARD,cardId:s.nodeId},eventName:"DismissedCard_"+s.nodeId},s.trackingIdentifiers)),f.mutate({id:f.providerId,state:{dismissed:!0}})):g.warning("Card state provider not found")}},t.createElement(Fn,null)),a)},Code:function(e){var r=e.attributes,n=r.children,o=W(r,["children"]);return t.createElement("div",Y({},o,{style:Y(Y({},Mn),o.style||{})}),t.createElement("pre",{style:{color:"rgb(255, 255, 255)"}},n))},Document:function(e){var r=e.attributes,n=W(e,["attributes"]),o=r.style;return t.createElement(Wn,Y({},n,{attributes:Y(Y({},r),{style:Y(Y({},{overflow:"auto",maxWidth:"100%",maxHeight:"100%",boxSizing:"border-box"}),o)})}))},Em:function(e){var r=Yn("em");return t.createElement(r,Y({},e))},EmbedPortal:function(e){var r=e.attributes,n=r.slug,o=r.style,i=e.api;return t.createElement("div",{className:E,style:o},i.render.portal({slug:n}))},EmbedTutorial:function(e){var r=e.attributes,n=r.id,o=r.slug,i=r.style,a=e.api;return t.createElement("div",{style:i},a.render.tutorial({tutorialId:n,slug:o}))},Flex:function(e){var r=e.attributes;return t.createElement("div",Y({},r,{style:Y(Y({},Bn),r.style)}))},FlexItem:function(e){var r=e.attributes;return t.createElement("div",Y({},r,{style:Y(Y({},zn),r.style)}))},H1:function(e){var r=Yn("h1");return t.createElement(r,Y({},e))},H2:function(e){var r=Yn("h2");return t.createElement(r,Y({},e))},H3:function(e){var r=Yn("h3");return t.createElement(r,Y({},e))},H4:function(e){var r=Yn("h4");return t.createElement(r,Y({},e))},H5:function(e){var r=Yn("h5");return t.createElement(r,Y({},e))},H6:function(e){var r=Yn("h6");return t.createElement(r,Y({},e))},Image:function(e){var r=e.attributes,n=r.width,o=r.height,i=r.src,a=r.className,u=r.alt,c=r.style,s=e.api,l=s.nodeId,d=s.document;return!!d&&!!l&&d.nodes[l].props?t.createElement("img",{alt:u||"",src:i,className:a,style:Y(Y(Y({},Hn),c),{width:n||Hn.width,height:o||Hn.height})}):null},InlineCode:function(e){var r=Yn("code");return t.createElement(r,Y({},e))},Link:function(e){var r=e.attributes,n=r.href,o=r.target,i=W(r,["href","target"]),a=v("link",{output:"html"});return t.createElement("a",Y({},i,{className:a,href:n,target:n.includes("http")&&!o?"_blank":o}))},List:function(e){var r=e.attributes,n=e.api,o=n.nodeId,i=(n.document.nodes[o]||{}).data;return i&&i.custom&&i.custom.variant===Sn.Unordered?t.createElement("ul",Y({},r)):t.createElement("ol",Y({},r))},ListItem:function(e){var r=e.attributes,n=v("typography",{variant:{variant:"P"},output:"html"});return t.createElement("li",Y({},r,{className:n}))},P:function(e){var r=Yn("p");return t.createElement(r,Y({},e))},RichText:Wn,Spacing:function(e){var r=e.attributes;return t.createElement("hr",Y({},r,{style:Y(Y({},Vn),r.style)}))},Text:function(e){var n=e.attributes,o=e.api,i=o.nodeId,a=o.document,u=!!a&&!!i&&a.nodes[i],c=t.createElement(r,null,n.children);if(!u)return c;var s=u.data&&u.data.custom&&Ft(u.data.custom.marks)?u.data.custom.marks:[];return 0===s.length?c:c=s.reduce((function(t,e){return o.render.styleguide(e,Y(Y({},n),{children:t}))}),c)},U:function(e){var r=Yn("u");return t.createElement(r,Y({},e))},View:Wn,Player:function(e){var r=e.attributes,n=r.width,o=r.height,i=r.src,a=W(r,["width","height","src"]);return t.createElement(z,Y({},a,{controls:!0,url:i,width:n||Kn,height:o||Jn,onError:T}))},CheckList:function(e){var r=e.attributes,n=r.children,o=W(r,["children"]);return t.createElement("div",Y({},o),n)},CheckListGroup:function(e){var r=e.attributes,n=r.children,i=r.title,u=r.style,c=r.className,s=r.onClick,l=e.api,d=l.childrenStateInstances,f=l.trackingIdentifiers,p=l.node.data,h=Un(),g=I(d||[]),y=g.length,b=o(O(g)),_=b[0],E=b[1];a((function(){var t=g.map((function(t,e){return t.subscribe((function(t){E((function(r){var n;return Y(Y({},r),((n={})[t.id]={position:e,status:t.state},n))}))}))}));return function(){t.map((function(t){return t()}))}}),g);var T=w(_,y).percComplete;a((function(){var t,e;100===T&&h.track(m.CHECKLIST_GROUP_COMPLETE,Y({title:i,groupId:null===(e=null===(t=p)||void 0===t?void 0:t.custom)||void 0===e?void 0:e.groupId},f))}),[T]);var A=S(_,y),C=v("typography",{variant:{variant:"H4"},output:"html"});return t.createElement("div",{className:c,onClick:s,style:Y(Y({},to),u)},t.createElement("h4",{className:C},i),t.createElement("div",{style:eo},t.createElement("div",{style:Y(Y({},ro),{width:T+"%"})})),!!n&&t.Children.map(n,(function(e,r){return t.cloneElement(e,{expandByDefault:r===A})})))},CheckListItem:function(e){var r=e.attributes,n=r.title,i=r.style,u=r.children,c=W(r,["title","style","children"]),s=e.api,l=s.stateInstances,d=s.trackingIdentifiers,f=e.expandByDefault,p=Un(),h=o(A.NotStared),g=h[0],y=h[1],b=o(!!f),_=b[0],E=b[1];if(!l)throw new Error("no state provided");var T=function(t){var e=t.find((function(t){return t.resolver instanceof C}));if(!e)throw new Error("Couldn't find CheckListApi state provider");return e}(l);a((function(){return T.subscribe((function(t){y(t.state)}))}),[T]),a((function(){u&&E(!!f)}),[f]);var I=Y(Y({},qn),{borderBottom:u&&_?"1px solid var(--color-lines)":"none"}),O={flexGrow:1,fontWeight:600,cursor:u?"pointer":"auto"},w=v("typography",{variant:{variant:"P"},output:"html"}),S=function(t){E(!_),t.stopPropagation()};return t.createElement("div",Y({style:Y(Y({},$n),i)},c),t.createElement("div",{style:I,onClick:u&&S},t.createElement(io,{onChangeStatus:function(){var t=function(t){return ao[(ao.indexOf(t)+1)%ao.length]}(g);T.mutate({state:t}),p.track(m.CHECKLIST_ITEM_STATE_UPDATED,Y({itemId:T.providerId,state:t,title:n},d))},status:g}),t.createElement("div",{className:w,style:O},n),u&&t.createElement("button",{type:"button",onClick:S,style:Xn},t.createElement(no,{direction:_?"up":"down"}))),u&&t.createElement(uo,{expanded:_},u))}},so=Lr((function(t,e){return Dn(N(t,e))})),lo=function(){try{var t=localStorage.getItem("candu.portals");return t?JSON.parse(t):{}}catch(t){return{}}},fo=an({name:"portal",initialValue:on(lo(),sn),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{portalAsset:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,i=t.type,a=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(i){case"loading":return Y(Y({},e),((r={})[a]=Y(Y({},sn()),{loading:!0}),r));case"success":return function(t,e){lo()[t]=e,localStorage.setItem("candu.portals",JSON.stringify(e))}(a,u),Y(Y({},e),((n={})[a]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return Y(Y({},e),((o={})[a]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});function po(t,e){var r=t.slug;B(x(r),"(Portal) You must supply a valid slug");var n=e.getFluxState(ln).clientToken,o=e.select(vn.selectors.segmentIds);if(o){e.registerFlux(fo);var i=e.select(fo.selectors.portalAsset(r)),a=e.select(fo.selectors.isLoadingOrHasErrors(r));if(!i&&!a){var u=performance.now(),c=function(t,e,r){return K(void 0,void 0,void 0,(function(){var n;return J(this,(function(o){return n="?segmentIds="+(r||[]).join(","),[2,fetch("https://cdn.candu.ai/portalMemberships/"+t+"/"+e+"/head.json"+n)]}))}))}(n,r,o);c&&(e.dispatch(fo.actions.loading(r)),c.then((function(t){return e.dispatch(fo.actions.success({slug:r,result:t,loadTime:performance.now()-u}))})).catch((function(t){return e.dispatch(fo.actions.error({slug:r,error:t,loadTime:performance.now()-u}))})),e.registerFlux(fo))}}}var vo,ho,go=function(e){var r=e.tutorialDocument;return r?t.createElement(mi,{tutorialDocument:r}):null},mo=function(t,e){return{tutorialDocument:fo.selectors.portalAsset(e.slug)}},yo=function(e){po(e,_n());var r=Tn(mo)(go);return t.createElement(r,Y({},e))},bo=function(t){return"candu.sdk."+t},_o=function(t){return bo("error."+t)},Eo="unknown_node_type",To="unkown_inline_node_type",Io="unkown_node_object_type",Oo="tutorial_error_boundary",wo="portal_error_boundary",So="provider_error_boundary",Ao={HEARTBEAT:bo("heartbeat"),PREVIEW_OPEN:bo("preview.open"),PORTAL:bo("portal"),TUTORIAL:bo("tutorial"),TUTORIAL_INTERACTION:bo("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:_o("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:_o("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:_o("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:_o("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:_o("commit_api"),TUTORIAL_LOADING_ERROR:_o("tutorial"),UNKOWN_NODE_TYPE:_o(Eo),UNKOWN_INLINE_NODE_TYPE:_o(To),UNKOWN_NODE_OBJECT_TYPE:_o(Io),TUTORIAL_ERROR:_o(Oo),PORTAL_ERROR:_o(wo),PROVIDER_ERROR:_o(So),STYLEGUIDE_MAP_ERROR:_o(Oo),RENDER_NODE_ERROR:_o(Oo),CIRCULAR_DEPENDENCY_EMBED_PORTAL:_o("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:_o("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:_o("state_fetch_failed"),STATE_UPDATE_FAILED:_o("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:_o("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:bo("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:bo("tutorial.checklist_group_complete"),CARD_DISMISSED:bo("tutorial.card_dismissed")},Co=function(t){return"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+"."},No=((vo={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"})[Ao.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",vo[Ao.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",vo[Ao.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",vo[Ao.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",vo[Ao.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",vo[Ao.UNKOWN_INLINE_NODE_TYPE]=Co(To),vo[Ao.UNKOWN_NODE_TYPE]=Co(Eo),vo[Ao.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",vo[Ao.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",vo[Ao.PORTAL_ERROR]="An error has occured within Portal",vo[Ao.PROVIDER_ERROR]="An error has occured within Provider",vo[Ao.TUTORIAL_ERROR]="An error has occured within Tutorial",vo[Ao.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",vo[Ao.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",vo[Ao.STATE_FETCH_FAILED]="An error has occured while fetching state:",vo[Ao.STATE_UPDATE_FAILED]="An error has occured while updating state:",vo[Ao.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",vo),xo=function(t){switch(t.trigger){case b.ON_CLICK:default:return"onClick"}},jo=function(t,e,r){var n,o,i;switch(t.handler.type){case _.NAVIGATE:return(n={})[xo(t)]=function(n){n.stopPropagation();var o=t.handler,i=o.href,a=o.target,u=r||{},c=u.parentTrackers,s=W(u,["parentTrackers"]);c&&c.forEach((function(r){return e(t,r)})),e(t,s),"Blank"===a?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},n;case _.CHANGE_TUTORIAL:return(o={})[xo(t)]=function(){var e=t.handler.tutorialId;g.error("TODO -> change tutorial",e)},o;case _.OPEN_GUIDE:return(i={})[xo(t)]=function(){var e=t.handler.guideId;g.error("TODO -> open guide",e)},i;default:return{}}},Ro=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},ko=function(t,e){var r=t.states;return Object.keys(r||{}).map((function(t){return e.select(In.selectors.provider(t))}))},Do=function(t,e,r){var n=t.nodes;return n&&n.map((function(t){return e.nodes[t]})).filter((function(t){return!!t})).map((function(t){return ko(t,r)||[]})).reduce((function(t,e){return t.concat(e)}),[])},Po=function(t,e,r){var n=e.getFluxState(dn);try{var o=r.document,i=o.nodes[t];if(!i)return g.error("Document is corrupted. Refusing to move further."),null;var a=function(t){return Po(t,e,r)},u=i.type,c=i.props,s=i.css,l=Y(Y(Y({},c||{}),{style:s||{},children:Ro(i,a)}),function(t,e,r){var n,o,i,a,u,c,s=e.getFluxState(dn);if("Link"===t.type&&(null===(n=t.props)||void 0===n?void 0:n.href)){var l=t.props.href+" Link Clicked",d=null===(i=null===(o=t)||void 0===o?void 0:o.nodes)||void 0===i?void 0:i[0];if(d){var f=r.nodes[d];"Text"===(null===(a=f)||void 0===a?void 0:a.type)&&(null===(c=null===(u=f)||void 0===u?void 0:u.props)||void 0===c?void 0:c.children)&&(l=f.props.children+" Link Clicked")}return{onClick:function(){var e;return s.track(Ao.TUTORIAL_INTERACTION,{trigger:b.ON_CLICK,category:t.type,eventName:l,handler:{href:null===(e=t.props)||void 0===e?void 0:e.href,type:_.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var p=function(t,e){s.track(Ao.TUTORIAL_INTERACTION,Y(Y({},t),e||{}))};return t.data.actions.map((function(t){return jo(t,p,{})})).reduce((function(t,e){return Y(Y({},t),e)}),{})}(i,e,o)),d={nodeId:t,node:i,document:o,render:{node:a,styleguide:function(t,e){return void 0===e&&(e={}),r.renderNode(t,{api:d,attributes:e})},tutorial:function(t){return r.renderTutorial(t)},portal:function(t){return r.renderPortal(t)}},trackingIdentifiers:{},stateInstances:ko(i,e),childrenStateInstances:Do(i,o,e)},f=d.render.styleguide(u,l);return f||(g.error(No[Ao.UNKOWN_NODE_TYPE],{type:u}),n.error(new Error(No[Ao.UNKOWN_NODE_TYPE]),{type:u}),null)}catch(t){return g.error(No[Ao.STYLEGUIDE_MAP_ERROR],t),n.error(t),null}},Lo=function(t,e){var r,n,o,i,a="string"==typeof e&&e.split(" ");return a?1===a.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===a.length?((n={})[t+"Top"]=a[0],n[t+"Right"]=a[1],n[t+"Bottom"]=a[0],n[t+"Left"]=a[1],n):3===a.length?((o={})[t+"Top"]=a[0],o[t+"Right"]=a[1],o[t+"Bottom"]=a[2],o[t+"Left"]=a[1],o):((i={})[t+"Top"]=a[0],i[t+"Right"]=a[1],i[t+"Bottom"]=a[2],i[t+"Left"]=a[3],i):{}},Fo=function(t){var e=t.padding,r=t.margin,n=W(t,["padding","margin"]),o={};return e&&(o=Y(Y({},o),Lo("padding",e))),r&&(o=Y(Y({},o),Lo("margin",r))),Y(Y({},o),n)},Uo=function(t){return"candu.sdk."+t},Mo=function(t){return Uo("error."+t)},Bo=(Uo("preview.open"),Uo("portal"),Uo("tutorial"),Mo("portal_asset_not_found")),zo=Mo("portal_no_segment_ids"),Ho=Mo("no_matching_tutorials"),Go=Mo("circular_dependecy_embed_portal"),Vo=Mo("circular_dependecy_embed_tutorial"),Yo=((ho={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"})[Bo]="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",ho[zo]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",ho[Ho]="The Tutorial will not be rendered because there are no matching segments for the given user.",ho[Go]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",ho[Vo]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",ho);var Wo=function(t,e){return function(r,n){if(null==r)return r;if(!re(r))return t(r,n);for(var o=r.length,i=e?o:-1,a=Object(r);(e?i--:++i<o)&&!1!==n(a[i],i,a););return r}}(oe);var Ko=function(t,e){var r=-1,n=re(t)?Array(t.length):[];return Wo(t,(function(t,o,i){n[++r]=e(t,o,i)})),n};var Jo=function(t,e){return(Ft(t)?Br:Ko)(t,nn(e))},$o=function(){function t(t,e,r){var n=this;this.observer=new j,this.rootStore=t,this.providerId=e,this.resolver=r,this.eventing=t.getFluxState(dn),this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return n.updateState(t)})).catch((function(t){g.error(R[m.STATE_FETCH_FAILED],t.message),n.eventing.track(R[m.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,r=this.state;this.updateState(Y(Y({},r),t)),this.resolver.update(this.rootStore,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){g.error(R[m.STATE_UPDATE_FAILED],t.message),e.eventing.track(R[m.STATE_UPDATE_FAILED],{errorMessage:t.message}),r&&e.updateState(r)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),qo=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),Zo=Object.create(null),Qo=function(){function t(t){this.cache=new qo,this.options=Y({},t||{})}return t.register=function(t,e){Zo[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=W(t,["type"]),n=Zo[e];return n?new n(r):null},t.prototype.toJSON=function(){return Y({type:this.type},this.options)},t}();var Xo=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var ti=function(t){return t!=t};var ei=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var ri=function(t,e,r){return e==e?ei(t,e,r):Xo(t,ti,r)};var ni=function(t,e){return!!(null==t?0:t.length)&&ri(t,e,0)>-1};var oi=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var ii=function(){},ai=pr&&1/Ze(new pr([,-0]))[1]==1/0?function(t){return new pr(t)}:ii;var ui=function(t,e,r){var n=-1,o=ni,i=t.length,a=!0,u=[],c=u;if(r)a=!1,o=oi;else if(i>=200){var s=e?null:ai(t);if(s)return Ze(s);a=!1,o=Ke,c=new Ye}else c=e?[]:u;t:for(;++n<i;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,r)||(c!==u&&c.push(d),u.push(l))}return u};var ci=function(t){return t&&t.length?ui(t):[]},si=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new H(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),li="https://api.candu.ai"+mn,di=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V(e,t),e.prototype.retrieve=function(t,e){return K(this,void 0,void 0,(function(){var r,n,o,i,a=this;return J(this,(function(u){switch(u.label){case 0:return r=t.getFluxState(ln).clientToken,n=t.getFluxState(fn).userId,[4,si.get("cardStateApi",(function(t){return K(a,void 0,void 0,(function(){var e;return J(this,(function(o){switch(o.label){case 0:return[4,fetch(li+"?token="+r+"&finder=byIds&ids="+ci(t).join(",")+"&userId="+n).then((function(t){return t.json()}))];case 1:return e=o.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return o=u.sent(),i={id:e,state:{dismissed:!1}},[2,o||i]}}))}))},e.prototype.update=function(t,e,r){var n=t.getFluxState(ln).clientToken,o=t.getFluxState(fn).userId;return fetch(li+"/"+e+"?token="+n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:o.toString()})}).then((function(t){return t.json()}))},e}(Qo);Qo.register(k.CardApi,di);var fi="https://api.candu.ai"+gn;function pi(t){return{state:t.state,id:t.id}}function vi(t){switch(t){case D.Account:return"AccountId";case D.User:default:return"UserId"}}var hi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V(e,t),e.prototype.getScopeAndFieldsFromRootState=function(t){var e=t.getFluxState(fn),r=e.userId,n=e.traits,o=this.options.scopeTrait,i=this.options.scope||D.User,a=r.toString();return i===D.Account&&(o&&n[o]?a=n[o]:(g.warning("trait '"+o+"' is not defined, falling back to user scope"),i=D.User)),{scope:i,scopeField:a}},e.prototype.retrieve=function(t,e){return K(this,void 0,void 0,(function(){var r,n,o,i,a=this;return J(this,(function(u){switch(u.label){case 0:return r=this.getScopeAndFieldsFromRootState(t),n=r.scope,o=r.scopeField,i=t.getFluxState(ln).clientToken,[4,si.get("checklistState",(function(t){return K(a,void 0,void 0,(function(){var e;return J(this,(function(r){switch(r.label){case 0:return[4,fetch(fi+"?token="+i+"&byTrait="+vi(n)+"&field="+o+"&finder=byIds&ids="+ci(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(pi)}))];case 1:return e=r.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,u.sent()||{id:e,state:A.NotStared}]}}))}))},e.prototype.update=function(t,e,r){var n=this.getScopeAndFieldsFromRootState(t),o=n.scope,i=n.scopeField,a=t.getFluxState(ln).clientToken;return fetch(fi+"/"+e+"?token="+a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y(Y({},r),{byTrait:vi(o),field:i}))}).then((function(t){return t.json()})).then(pi)},e}(Qo);function gi(t,e){var r=t.document,n=r.stateProviders,o=r.head,i=e.getFluxState(ln).clientToken;o&&P(o,i),n&&function(t,e){var r;e.registerFlux(In);var n=Jo(t,(function(t,r){if(e.select(In.selectors.provider(r)))return null;var n=Qo.fromJSON(t.resolver);return n?new $o(e,r,n):null})).filter((function(t){return!!t}));e.dispatch((r=In.actions).set.apply(r,n))}(n,e)}Qo.register(k.CheckListApi,hi);var mi=Tn((function(){return{clientToken:ln.selectors.clientToken,eventing:dn.selectors.state}}))((function(e){var r,n=e.tutorialDocument,o=e.clientToken,i=e.eventing,a=(r=_n().select(ln.selectors.styleguide),so({provider:r},co)).getComponent,u=_n();if(!n.document)return null;gi(n,u);var c=n.document,s=c.rootNodeId,l=c.head,d=c.nodes,f={rootNodeId:s,nodes:L(d)};return l&&P(l,o),Po(n.document.rootNodeId,u,{document:f,renderTutorial:function(e){return t.createElement(_i,Y({},e))},renderPortal:function(e){return t.createElement(yo,Y({},e))},renderNode:function(e,r){try{var n=a(e);return n?t.createElement(n,{key:r.api.nodeId,api:r.api,attributes:Y(Y({},r.attributes),{style:r.attributes.style&&Fo(r.attributes.style)})}):null}catch(t){return g.error(Yo[m.RENDER_NODE_ERROR],t),i.error(t),null}}})})),yi=function(e){var r=e.tutorialDocument;return r?t.createElement(mi,{tutorialDocument:r}):null},bi=function(t,e){return{tutorialDocument:wn.selectors.tutorialDocument(e.slug)}},_i=function(e){!function(t,e){var r=p(t),n=e.getFluxState(dn),o=e.getFluxState(ln).clientToken;e.registerFlux(wn);var i=r.slug,a=e.select(wn.selectors.tutorialDocument(i));if(!e.select(wn.selectors.isLoadingOrHasErrors(i))&&!a){var c=performance.now(),s=u.tutorialDocument(r,o,n);s&&(e.dispatch(wn.actions.loading(i)),s.then((function(t){return e.dispatch(wn.actions.success({slug:i,result:t,loadTime:performance.now()-c}))})).catch((function(t){return e.dispatch(wn.actions.error({slug:i,error:t,loadTime:performance.now()-c}))})))}}(e,_n());var r=Tn(bi)(yi);return t.createElement(r,Y({},e))};export{En as CanduProvider,yo as Portal,bn as ProviderContext,_i as Tutorial,_n as useRootStore};
***************************************************************************** */var G=function(t,e){return(G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function V(t,e){function r(){this.constructor=t}G(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Y=function(){return(Y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function W(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function K(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(a,u)}c((n=n.apply(t,e||[])).next())}))}function J(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var $=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(t){var e={exports:{}};return t(e,e.exports),e.exports}var Q="object"==typeof q&&q&&q.Object===Object&&q,X="object"==typeof self&&self&&self.Object===Object&&self,tt=Q||X||Function("return this")(),et=tt.Symbol,rt=Object.prototype,nt=rt.hasOwnProperty,ot=rt.toString,it=et?et.toStringTag:void 0;var at=function(t){var e=nt.call(t,it),r=t[it];try{t[it]=void 0;var n=!0}catch(t){}var o=ot.call(t);return n&&(e?t[it]=r:delete t[it]),o},ut=Object.prototype.toString;var ct=function(t){return ut.call(t)},st=et?et.toStringTag:void 0;var lt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":st&&st in Object(t)?at(t):ct(t)};var dt,ft=function(t){if(!$(t))return!1;var e=lt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},pt=tt["__core-js_shared__"],vt=(dt=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||""))?"Symbol(src)_1."+dt:"";var ht=function(t){return!!vt&&vt in t},gt=Function.prototype.toString;var mt=function(t){if(null!=t){try{return gt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},yt=/^\[object .+?Constructor\]$/,bt=Function.prototype,_t=Object.prototype,Et=bt.toString,Tt=_t.hasOwnProperty,It=RegExp("^"+Et.call(Tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ot=function(t){return!(!$(t)||ht(t))&&(ft(t)?It:yt).test(mt(t))};var wt=function(t,e){return null==t?void 0:t[e]};var St=function(t,e){var r=wt(t,e);return Ot(r)?r:void 0},At=function(){try{var t=St(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Ct=function(t,e,r){"__proto__"==e&&At?At(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var Nt=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),u=a.length;u--;){var c=a[t?u:++o];if(!1===r(i[c],c,i))break}return e}}();var xt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var jt=function(t){return null!=t&&"object"==typeof t};var Rt=function(t){return jt(t)&&"[object Arguments]"==lt(t)},kt=Object.prototype,Dt=kt.hasOwnProperty,Pt=kt.propertyIsEnumerable,Lt=Rt(function(){return arguments}())?Rt:function(t){return jt(t)&&Dt.call(t,"callee")&&!Pt.call(t,"callee")},Ft=Array.isArray;var Ut=function(){return!1},Mt=Z((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?tt.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ut;t.exports=i})),Bt=/^(?:0|[1-9]\d*)$/;var zt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Bt.test(t))&&t>-1&&t%1==0&&t<e};var Ht=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Gt={};Gt["[object Float32Array]"]=Gt["[object Float64Array]"]=Gt["[object Int8Array]"]=Gt["[object Int16Array]"]=Gt["[object Int32Array]"]=Gt["[object Uint8Array]"]=Gt["[object Uint8ClampedArray]"]=Gt["[object Uint16Array]"]=Gt["[object Uint32Array]"]=!0,Gt["[object Arguments]"]=Gt["[object Array]"]=Gt["[object ArrayBuffer]"]=Gt["[object Boolean]"]=Gt["[object DataView]"]=Gt["[object Date]"]=Gt["[object Error]"]=Gt["[object Function]"]=Gt["[object Map]"]=Gt["[object Number]"]=Gt["[object Object]"]=Gt["[object RegExp]"]=Gt["[object Set]"]=Gt["[object String]"]=Gt["[object WeakMap]"]=!1;var Vt=function(t){return jt(t)&&Ht(t.length)&&!!Gt[lt(t)]};var Yt=function(t){return function(e){return t(e)}},Wt=Z((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&Q.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})),Kt=Wt&&Wt.isTypedArray,Jt=Kt?Yt(Kt):Vt,$t=Object.prototype.hasOwnProperty;var qt=function(t,e){var r=Ft(t),n=!r&&Lt(t),o=!r&&!n&&Mt(t),i=!r&&!n&&!o&&Jt(t),a=r||n||o||i,u=a?xt(t.length,String):[],c=u.length;for(var s in t)!e&&!$t.call(t,s)||a&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||zt(s,c))||u.push(s);return u},Zt=Object.prototype;var Qt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Zt)};var Xt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),te=Object.prototype.hasOwnProperty;var ee=function(t){if(!Qt(t))return Xt(t);var e=[];for(var r in Object(t))te.call(t,r)&&"constructor"!=r&&e.push(r);return e};var re=function(t){return null!=t&&Ht(t.length)&&!ft(t)};var ne=function(t){return re(t)?qt(t):ee(t)};var oe=function(t,e){return t&&Nt(t,e,ne)};var ie=function(){this.__data__=[],this.size=0};var ae=function(t,e){return t===e||t!=t&&e!=e};var ue=function(t,e){for(var r=t.length;r--;)if(ae(t[r][0],e))return r;return-1},ce=Array.prototype.splice;var se=function(t){var e=this.__data__,r=ue(e,t);return!(r<0)&&(r==e.length-1?e.pop():ce.call(e,r,1),--this.size,!0)};var le=function(t){var e=this.__data__,r=ue(e,t);return r<0?void 0:e[r][1]};var de=function(t){return ue(this.__data__,t)>-1};var fe=function(t,e){var r=this.__data__,n=ue(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function pe(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])}}pe.prototype.clear=ie,pe.prototype.delete=se,pe.prototype.get=le,pe.prototype.has=de,pe.prototype.set=fe;var ve=pe;var he=function(){this.__data__=new ve,this.size=0};var ge=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var me=function(t){return this.__data__.get(t)};var ye=function(t){return this.__data__.has(t)},be=St(tt,"Map"),_e=St(Object,"create");var Ee=function(){this.__data__=_e?_e(null):{},this.size=0};var Te=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Ie=Object.prototype.hasOwnProperty;var Oe=function(t){var e=this.__data__;if(_e){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Ie.call(e,t)?e[t]:void 0},we=Object.prototype.hasOwnProperty;var Se=function(t){var e=this.__data__;return _e?void 0!==e[t]:we.call(e,t)};var Ae=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_e&&void 0===e?"__lodash_hash_undefined__":e,this};function Ce(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])}}Ce.prototype.clear=Ee,Ce.prototype.delete=Te,Ce.prototype.get=Oe,Ce.prototype.has=Se,Ce.prototype.set=Ae;var Ne=Ce;var xe=function(){this.size=0,this.__data__={hash:new Ne,map:new(be||ve),string:new Ne}};var je=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Re=function(t,e){var r=t.__data__;return je(e)?r["string"==typeof e?"string":"hash"]:r.map};var ke=function(t){var e=Re(this,t).delete(t);return this.size-=e?1:0,e};var De=function(t){return Re(this,t).get(t)};var Pe=function(t){return Re(this,t).has(t)};var Le=function(t,e){var r=Re(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Fe(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])}}Fe.prototype.clear=xe,Fe.prototype.delete=ke,Fe.prototype.get=De,Fe.prototype.has=Pe,Fe.prototype.set=Le;var Ue=Fe;var Me=function(t,e){var r=this.__data__;if(r instanceof ve){var n=r.__data__;if(!be||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ue(n)}return r.set(t,e),this.size=r.size,this};function Be(t){var e=this.__data__=new ve(t);this.size=e.size}Be.prototype.clear=he,Be.prototype.delete=ge,Be.prototype.get=me,Be.prototype.has=ye,Be.prototype.set=Me;var ze=Be;var He=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var Ge=function(t){return this.__data__.has(t)};function Ve(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Ue;++e<r;)this.add(t[e])}Ve.prototype.add=Ve.prototype.push=He,Ve.prototype.has=Ge;var Ye=Ve;var We=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 Ke=function(t,e){return t.has(e)};var Je=function(t,e,r,n,o,i){var a=1&r,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var s=i.get(t),l=i.get(e);if(s&&l)return s==e&&l==t;var d=-1,f=!0,p=2&r?new Ye:void 0;for(i.set(t,e),i.set(e,t);++d<u;){var v=t[d],h=e[d];if(n)var g=a?n(h,v,d,e,t,i):n(v,h,d,t,e,i);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!We(e,(function(t,e){if(!Ke(p,e)&&(v===t||o(v,t,r,n,i)))return p.push(e)}))){f=!1;break}}else if(v!==h&&!o(v,h,r,n,i)){f=!1;break}}return i.delete(t),i.delete(e),f},$e=tt.Uint8Array;var qe=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Ze=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},Qe=et?et.prototype:void 0,Xe=Qe?Qe.valueOf:void 0;var tr=function(t,e,r,n,o,i,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new $e(t),new $e(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ae(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=qe;case"[object Set]":var c=1&n;if(u||(u=Ze),t.size!=e.size&&!c)return!1;var s=a.get(t);if(s)return s==e;n|=2,a.set(t,e);var l=Je(u(t),u(e),n,o,i,a);return a.delete(t),l;case"[object Symbol]":if(Xe)return Xe.call(t)==Xe.call(e)}return!1};var er=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var rr=function(t,e,r){var n=e(t);return Ft(t)?n:er(n,r(t))};var nr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i};var or=function(){return[]},ir=Object.prototype.propertyIsEnumerable,ar=Object.getOwnPropertySymbols,ur=ar?function(t){return null==t?[]:(t=Object(t),nr(ar(t),(function(e){return ir.call(t,e)})))}:or;var cr=function(t){return rr(t,ne,ur)},sr=Object.prototype.hasOwnProperty;var lr=function(t,e,r,n,o,i){var a=1&r,u=cr(t),c=u.length;if(c!=cr(e).length&&!a)return!1;for(var s=c;s--;){var l=u[s];if(!(a?l in e:sr.call(e,l)))return!1}var d=i.get(t),f=i.get(e);if(d&&f)return d==e&&f==t;var p=!0;i.set(t,e),i.set(e,t);for(var v=a;++s<c;){var h=t[l=u[s]],g=e[l];if(n)var m=a?n(g,h,l,e,t,i):n(h,g,l,t,e,i);if(!(void 0===m?h===g||o(h,g,r,n,i):m)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){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||(p=!1)}return i.delete(t),i.delete(e),p},dr=St(tt,"DataView"),fr=St(tt,"Promise"),pr=St(tt,"Set"),vr=St(tt,"WeakMap"),hr=mt(dr),gr=mt(be),mr=mt(fr),yr=mt(pr),br=mt(vr),_r=lt;(dr&&"[object DataView]"!=_r(new dr(new ArrayBuffer(1)))||be&&"[object Map]"!=_r(new be)||fr&&"[object Promise]"!=_r(fr.resolve())||pr&&"[object Set]"!=_r(new pr)||vr&&"[object WeakMap]"!=_r(new vr))&&(_r=function(t){var e=lt(t),r="[object Object]"==e?t.constructor:void 0,n=r?mt(r):"";if(n)switch(n){case hr:return"[object DataView]";case gr:return"[object Map]";case mr:return"[object Promise]";case yr:return"[object Set]";case br:return"[object WeakMap]"}return e});var Er=_r,Tr="[object Object]",Ir=Object.prototype.hasOwnProperty;var Or=function(t,e,r,n,o,i){var a=Ft(t),u=Ft(e),c=a?"[object Array]":Er(t),s=u?"[object Array]":Er(e),l=(c="[object Arguments]"==c?Tr:c)==Tr,d=(s="[object Arguments]"==s?Tr:s)==Tr,f=c==s;if(f&&Mt(t)){if(!Mt(e))return!1;a=!0,l=!1}if(f&&!l)return i||(i=new ze),a||Jt(t)?Je(t,e,r,n,o,i):tr(t,e,c,r,n,o,i);if(!(1&r)){var p=l&&Ir.call(t,"__wrapped__"),v=d&&Ir.call(e,"__wrapped__");if(p||v){var h=p?t.value():t,g=v?e.value():e;return i||(i=new ze),o(h,g,r,n,i)}}return!!f&&(i||(i=new ze),lr(t,e,r,n,o,i))};var wr=function t(e,r,n,o,i){return e===r||(null==e||null==r||!jt(e)&&!jt(r)?e!=e&&r!=r:Or(e,r,n,o,t,i))};var Sr=function(t,e,r,n){var o=r.length,i=o,a=!n;if(null==t)return!i;for(t=Object(t);o--;){var u=r[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var c=(u=r[o])[0],s=t[c],l=u[1];if(a&&u[2]){if(void 0===s&&!(c in t))return!1}else{var d=new ze;if(n)var f=n(s,l,c,t,e,d);if(!(void 0===f?wr(l,s,3,n,d):f))return!1}}return!0};var Ar=function(t){return t==t&&!$(t)};var Cr=function(t){for(var e=ne(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,Ar(o)]}return e};var Nr=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var xr=function(t){var e=Cr(t);return 1==e.length&&e[0][2]?Nr(e[0][0],e[0][1]):function(r){return r===t||Sr(r,t,e)}};var jr=function(t){return"symbol"==typeof t||jt(t)&&"[object Symbol]"==lt(t)},Rr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kr=/^\w*$/;var Dr=function(t,e){if(Ft(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!jr(t))||(kr.test(t)||!Rr.test(t)||null!=e&&t in Object(e))};function Pr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(Pr.Cache||Ue),r}Pr.Cache=Ue;var Lr=Pr;var Fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ur=/\\(\\)?/g,Mr=function(t){var e=Lr(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Fr,(function(t,r,n,o){e.push(n?o.replace(Ur,"$1"):r||t)})),e}));var Br=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},zr=et?et.prototype:void 0,Hr=zr?zr.toString:void 0;var Gr=function t(e){if("string"==typeof e)return e;if(Ft(e))return Br(e,t)+"";if(jr(e))return Hr?Hr.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var Vr=function(t){return null==t?"":Gr(t)};var Yr=function(t,e){return Ft(t)?t:Dr(t,e)?[t]:Mr(Vr(t))};var Wr=function(t){if("string"==typeof t||jr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Kr=function(t,e){for(var r=0,n=(e=Yr(e,t)).length;null!=t&&r<n;)t=t[Wr(e[r++])];return r&&r==n?t:void 0};var Jr=function(t,e,r){var n=null==t?void 0:Kr(t,e);return void 0===n?r:n};var $r=function(t,e){return null!=t&&e in Object(t)};var qr=function(t,e,r){for(var n=-1,o=(e=Yr(e,t)).length,i=!1;++n<o;){var a=Wr(e[n]);if(!(i=null!=t&&r(t,a)))break;t=t[a]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&Ht(o)&&zt(a,o)&&(Ft(t)||Lt(t))};var Zr=function(t,e){return null!=t&&qr(t,e,$r)};var Qr=function(t,e){return Dr(t)&&Ar(e)?Nr(Wr(t),e):function(r){var n=Jr(r,t);return void 0===n&&n===e?Zr(r,t):wr(e,n,3)}};var Xr=function(t){return t};var tn=function(t){return function(e){return null==e?void 0:e[t]}};var en=function(t){return function(e){return Kr(e,t)}};var rn=function(t){return Dr(t)?tn(Wr(t)):en(t)};var nn=function(t){return"function"==typeof t?t:null==t?Xr:"object"==typeof t?Ft(t)?Qr(t[0],t[1]):xr(t):rn(t)};var on=function(t,e){var r={};return e=nn(e),oe(t,(function(t,n,o){Ct(r,n,e(t,n,o))})),r};function an(t){var e=t.name,r=t.actions,n=t.selectors,o=W(t,["name","actions","selectors"]);return Y(Y({},o),{actions:on(r||{},(function(t,r){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return Y({type:r,storeName:e},t.apply(void 0,n))}})),selectors:on(n||{},(function(t){function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return{storeName:e,selector:t.apply(void 0,r)}}return r.storeName=e,r.selector=t,r})),name:e})}function un(t){var e=t.name,r=t.initialValue,n=t.reducer,o=r,i=[];return{name:e,getState:function(){return o},subscribe:function(t){return i.push(t),function(){i=i.filter((function(e){return e!==t}))}},dispatch:function(t){var e=o;return"object"==typeof e&&null!==e?e=Y({},o):Array.isArray(e)&&(e=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,u=i.length;a<u;a++,o++)n[o]=i[a];return n}(o)),o=n(t,o),i.forEach((function(r){return r(o,e,t)})),this}}}function cn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.fromEntries(t.map((function(t){return[t.name,t]})));return{name:"root",getFluxState:function(t){var e=this.getStore(t);if(!e)throw new Error("rootState.getFluxState: the flux store "+t.name+" does not exist");return e.getState()},getState:function(){return on(r,(function(t){return t.getState()}))},getStore:function(t){var e="string"==typeof t?t:t.name;return r[e]},registerFlux:function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter((function(t){var e=t.name;return!r[e]})).forEach((function(e){return t.register(un(e))})),this},register:function(t){return r[t.name]=t,this},dispatch:function(t){t.storeName?r[t.storeName].dispatch(t):Object.values(r).forEach((function(e){return e.dispatch(t)}))},remove:function(t){return delete r[t.name],this},select:function(t){var e;return t.selector(null===(e=r[t.storeName])||void 0===e?void 0:e.getState())}}}var sn=function(t){return{loading:!1,result:t,error:void 0,loadTime:0}},ln=an({name:"config",initialValue:{clientToken:"",options:{},styleguide:{}},actions:{set:function(t){return{payload:t}}},selectors:{styleguide:function(t){return t.styleguide},clientToken:function(t){return t.clientToken}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e}}),dn=an({name:"eventing",initialValue:F,actions:{set:function(t){return{eventing:t}}},selectors:{state:function(t){return t}},reducer:function(t,e){var r=t.type,n=t.eventing;return"set"===r?n:e}}),fn=an({name:"user",initialValue:{userId:U(),traits:{}},actions:{set:function(t){return{payload:t}}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e},selectors:{userId:function(t){return t.userId}}}),pn=function(t){return localStorage.setItem("candu.segmentMembership",JSON.stringify(t))},vn=an({name:"segmentMembership",initialValue:sn(function(){try{var t=localStorage.getItem("candu.segmentMembership"),e=t&&JSON.parse(t);if(!e)return;return{id:"",segmentIds:e}}catch(t){return}}()),actions:{loading:function(){return{}},success:function(t){return t},error:function(t){return t}},selectors:{segmentIds:function(t){var e;return null===(e=t.result)||void 0===e?void 0:e.segmentIds}},reducer:function(t,e){var r=t.type,n=t.result,o=t.loadTime,i=t.error;switch(r){case"loading":return Y(Y({},e),{loading:!0});case"success":return pn(n.segmentIds),Y(Y({},e),{loading:!1,error:void 0,result:n,loadTime:o});case"error":return{loading:!1,result:void 0,error:i,loadTime:o};default:return e}}});var hn={name:"@candulabs/harbour",version:"0.7.1-alpha.17"},gn="/api/checklistItems",mn="/api/cards";function yn(t,e){e.registerFlux(ln,fn,dn,vn);var r=function(t,e){var r=t.clientToken,n=t.userId,o=t.traits,i=t.options,a=t.styleguide,u=W(t,["clientToken","userId","traits","options","styleguide"]);B(d(r),"(Candu) you must provide a valid clientToken"),B(!n||f(n),"(Candu) you must provide a valid userId"),B(!o||$(o),"(Candu) traits must be undefined or an object"),B(!i||$(i),"(Candu) options must be undefined or an object"),B(!a||$(a),"(Candu) styleguide must be undefined or an object");var c=e.getFluxState(fn);return Y(Y({},u),{clientToken:r,traits:o||c.traits||{},options:i||{},styleguide:a||{},userId:n||c.userId})}(t,e),n=r.clientToken,o=r.userId,i=r.traits,a=r.styleguide,p=r.options,v=M(n,o,p,hn);s(v).provider({userId:o,traits:i,styleguide:a}),e.dispatch(fn.actions.set({userId:o,traits:i})),e.dispatch(dn.actions.set(v)),e.dispatch(ln.actions.set({clientToken:n,options:p,styleguide:a})),l(n),function(t){var e=t.getFluxState(ln),r=e.clientToken,n=e.options,o=t.getFluxState(fn).userId,i=t.getFluxState(dn);if(n.skipLoading||n.overrideSegmentMemberships){var a={id:o,segmentIds:n.overrideSegmentMemberships||[]};t.dispatch(vn.actions.success({result:a,loadTime:0}))}else{var s=performance.now();t.dispatch(vn.actions.loading()),u.segmentMembership(r,o).then((function(e){var r=performance.now()-s;i.track(c.SEGMENT_MEMBERSHIP_LOAD_TIME,{value:r}),t.dispatch(vn.actions.success({result:e,loadTime:r}))})).catch((function(e){return t.dispatch(vn.actions.error({error:e,loadTime:performance.now()-s}))}))}}(e)}var bn=t.createContext(cn()),_n=function(){return e(bn)},En=function(e){function r(t){var r=e.call(this,t)||this;r.state=cn();var n=r.props;return n.children,yn(W(n,["children"]),r.state),r}return V(r,e),r.prototype.render=function(){return t.createElement(bn.Provider,{value:this.state},this.props.children)},r}(t.Component),Tn=function(e){return function(r){var n;return(n=function(n){function o(t){var e=n.call(this,t)||this;return e.unsubscribes=[],e.handleChange=e.handleChange.bind(e),e}return V(o,n),o.prototype.componentDidMount=function(){var t=this;this.handleChange();var r=Object.values(e(this.context,this.props)).map((function(e){var r=e.storeName;return t.context.getStore(r).subscribe}));this.unsubscribes=r.map((function(e){return e(t.handleChange)}))},o.prototype.componentWillUnmount=function(){this.unsubscribes.forEach((function(t){return t()}))},o.prototype.mapStateToProps=function(){var t=this;return on(e(this.context,this.props),(function(e){return e.selector&&e.storeName?t.context.select(e):e}))},o.prototype.handleChange=function(){this.setState(this.mapStateToProps())},o.prototype.render=function(){return t.createElement(r,Y({},this.state||this.mapStateToProps(),this.props))},o}(t.Component)).contextType=bn,n}},In=an({name:"stateProviders",initialValue:{},actions:{set:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{providers:t}}},selectors:{provider:function(t){return function(e){return e[t]}}},reducer:function(t,e){var r=t.type,n=t.providers;switch(r){case"set":return Y(Y({},e),Object.fromEntries(n.map((function(t){return[t.providerId,t]}))));default:return e}}}),On=function(){try{var t=localStorage.getItem("candu.tutorials");return t?JSON.parse(t):{}}catch(t){return{}}},wn=an({name:"tutorialDocuments",initialValue:on(On(),sn),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{tutorialDocument:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,i=t.type,a=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(i){case"loading":return Y(Y({},e),((r={})[a]=Y(Y({},sn()),{loading:!0}),r));case"success":return function(t,e){var r=On();r[t]=e,localStorage.setItem("candu.tutorials",JSON.stringify(r))}(a,u),Y(Y({},e),((n={})[a]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return Y(Y({},e),((o={})[a]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});var Sn,An=["div","a","p"],Cn={Fragment:r,Document:r},Nn="#6310E5",xn="#59C3C3",jn="#4D515D",Rn="#FCAD0D",kn="#EE4266",Dn=function(e){B($(e),"(createStyleguide) styleguide must be undefined or an object");return{getComponent:function(n){var o=function(t){if(e[t])return e[t];if(Cn[t])return Cn[t];var r=An.indexOf(t)||An.indexOf(t.toLowerCase());return An[r]}(n);return"string"==typeof o?function(e){var r=e.api,n=e.attributes;return t.createElement(o,Y({key:r.nodeId},n))}:o===r?function(e){var n=e.api,o=e.attributes;return t.createElement(r,{key:n.nodeId},o.children)}:o},all:function(){return e}}},Pn={borderRadius:"4px",padding:"8px"},Ln=function(t){switch(t){case"success":return Nn;case"active":return xn;case"warning":return Rn;case"danger":return kn;default:return jn}},Fn=function(){return t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M6 6L18 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}),t.createElement("path",{d:"M18 6L6 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}))},Un=function(){return _n().getFluxState(dn)},Mn={borderRadius:"4px",padding:"8px",backgroundColor:"rgb(51, 55, 69)",color:"rgb(255, 255, 255)",overflow:"auto"},Bn={display:"flex"},zn={flex:"1 1"},Hn={maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"};!function(t){t.Ordered="OL",t.Unordered="UL"}(Sn||(Sn={}));var Gn,Vn={backgroundColor:"transparent",border:"none",borderTop:"1px solid #edeff3",height:"0"},Yn=function(e){return function(r){var n,o=r.attributes,i=["h1","h2","h3","h4","p"].includes(e);i&&(n={variant:e.toUpperCase()});var a=v(i?"typography":e,{variant:n,output:"html"});return t.createElement(e,Y({},o,{className:a}))}},Wn=function(e){var r=Yn("div");return t.createElement(r,Y({},e))},Kn="640px",Jn="360px",$n={border:"1px solid var(--color-lines)",borderRadius:"4px",marginBottom:"16px",backgroundColor:"white",display:"flex",flexDirection:"column"},qn={padding:"16px",display:"flex",flexDirection:"row",alignItems:"center",flexGrow:1,boxSizing:"border-box",color:"var(--color-neutral)"},Zn={padding:"16px 48px",display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",transition:"all .35s ease-out 0s"},Qn={borderRadius:"20px",height:"32px",width:"32px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",marginRight:"16px",appearance:"none",outline:"none",padding:0,transition:"all .1s ease-out 0s"},Xn={appearance:"none",border:"none",outline:"none",cursor:"pointer",background:"none",padding:"0px",display:"flex"},to={marginBottom:"48px"},eo={width:"100%",height:"4px",marginBottom:"16px",backgroundColor:"#EDEFF3"},ro={height:"100%",backgroundColor:"#59C3C3",transition:"all .35s ease-out 0s"},no=function(e){var r=e.direction;return t.createElement("svg",{style:{transition:"all .35s ease-out 0s",transform:"rotateZ("+("up"===r?"180deg":"0deg")+")"},width:"18",height:"11",viewBox:"0 0 18 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M9 6.74488L3.09046 0.555221C2.39741 -0.170679 1.25783 -0.186906 0.545126 0.518977C-0.167576 1.22486 -0.183508 2.38555 0.509541 3.11145L7.37034 10.2975L7.37166 10.2988C8.26633 11.2347 9.73727 11.2336 10.6306 10.2965L17.4905 3.11145C18.1835 2.38555 18.1676 1.22486 17.4549 0.518977C16.7422 -0.186906 15.6026 -0.170679 14.9095 0.555221L9 6.74488Z",fill:"#D4D8E4"}))},oo=((Gn={})[A.NotStared]={title:"Not Started",statusStyle:{backgroundColor:"#EDEFF3",borderColor:"#D4D8E4"},icon:{path:"M 2 6.55 L 5 6.55 L 10 6.55",stroke:"#9498A7"}},Gn[A.InProgress]={title:"In Progress",statusStyle:{backgroundColor:"#FE8A3A",borderColor:"white"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"white"}},Gn[A.Done]={title:"Completed",statusStyle:{backgroundColor:"#CFF5F5",borderColor:"#6DD8D8"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"#46AEAE"}},Gn),io=function(e){var r=e.onChangeStatus,n=e.status,i=o(!1),a=i[0],u=i[1],c=Y(Y(Y({},Qn),oo[n].statusStyle),{border:(a?"1px":"0px")+" solid "+oo[n].statusStyle.borderColor}),s=oo[n].title,l=oo[n].icon;return t.createElement("button",{type:"button",onClick:function(t){r(),t.stopPropagation()},style:c,title:s,onMouseOver:function(){return u(!0)},onFocus:function(){return u(!0)},onMouseOut:function(){return u(!1)},onBlur:function(){return u(!1)}},t.createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:l.path,stroke:l.stroke,strokeWidth:"2.5",strokeLinecap:"round",style:{transition:"all .1s ease-out 0s"}})))},ao=[A.NotStared,A.Done],uo=function(e){var r=e.expanded,n=e.children,o=r?Zn:Y(Y({},Zn),{maxHeight:0,padding:"0px 48px"});return t.createElement("div",{style:o},n)},co={Alert:function(e){var r=e.attributes,n=r.intent,o=r.title,i=r.description;return t.createElement("div",Y({},r,{style:Y(Y(Y({},Pn),r.style),{color:"#FFF",backgroundColor:Ln(n)||"#EDEDED"})}),o,t.createElement("div",null,t.createElement("small",null,i)))},B:function(e){var r=Yn("b");return t.createElement(r,Y({},e))},Badge:function(e){var r=e.attributes,n=r.color,o=r.outline,i=W(r,["color","outline"]),a=v("badge",{variant:{color:n,outline:o},output:"html"});return t.createElement("span",Y({},i,{className:a}))},Button:function(e){var r=e.attributes;return t.createElement("button",Y({type:"button"},r,{className:v("button",{variant:{color:r.color,outline:r.outline},output:"html"}),style:Y({},r.style||{})}))},Card:function(e){var r=e.attributes,a=r.children,u=r.isDismissible,c=W(r,["children","isDismissible"]),s=e.api,l=Un(),d=v("card",{output:"html"}),f=n((function(){var t;return null===(t=s.stateInstances)||void 0===t?void 0:t.find((function(t){return t.resolver instanceof h}))}),[]),p=o({dismissed:!1}),E=p[0],T=p[1];return i((function(){if(f)return f.subscribe((function(t){T(t.state)}))}),[f]),E.dismissed?null:t.createElement("div",Y({},c,{className:d,style:Y({position:"relative"},c.style)}),u&&t.createElement("a",{style:{position:"absolute",top:"6px",right:"6px",cursor:"pointer"},onClick:function(){f?(l.track(m.TUTORIAL_INTERACTION,Y({category:y.NATIVE,trigger:b.ON_CLICK,handler:{type:_.DISMISSED_CARD,cardId:s.nodeId},eventName:"DismissedCard_"+s.nodeId},s.trackingIdentifiers)),f.mutate({id:f.providerId,state:{dismissed:!0}})):g.warning("Card state provider not found")}},t.createElement(Fn,null)),a)},Code:function(e){var r=e.attributes,n=r.children,o=W(r,["children"]);return t.createElement("div",Y({},o,{style:Y(Y({},Mn),o.style||{})}),t.createElement("pre",{style:{color:"rgb(255, 255, 255)"}},n))},Document:function(e){var r=e.attributes,n=W(e,["attributes"]),o=r.style;return t.createElement(Wn,Y({},n,{attributes:Y(Y({},r),{style:Y(Y({},{overflow:"auto",maxWidth:"100%",maxHeight:"100%",boxSizing:"border-box"}),o)})}))},Em:function(e){var r=Yn("em");return t.createElement(r,Y({},e))},EmbedPortal:function(e){var r=e.attributes,n=r.slug,o=r.style,i=e.api;return t.createElement("div",{className:E,style:o},i.render.portal({slug:n}))},EmbedTutorial:function(e){var r=e.attributes,n=r.id,o=r.slug,i=r.style,a=e.api;return t.createElement("div",{style:i},a.render.tutorial({tutorialId:n,slug:o}))},Flex:function(e){var r=e.attributes;return t.createElement("div",Y({},r,{style:Y(Y({},Bn),r.style)}))},FlexItem:function(e){var r=e.attributes;return t.createElement("div",Y({},r,{style:Y(Y({},zn),r.style)}))},H1:function(e){var r=Yn("h1");return t.createElement(r,Y({},e))},H2:function(e){var r=Yn("h2");return t.createElement(r,Y({},e))},H3:function(e){var r=Yn("h3");return t.createElement(r,Y({},e))},H4:function(e){var r=Yn("h4");return t.createElement(r,Y({},e))},H5:function(e){var r=Yn("h5");return t.createElement(r,Y({},e))},H6:function(e){var r=Yn("h6");return t.createElement(r,Y({},e))},Image:function(e){var r=e.attributes,n=r.width,o=r.height,i=r.src,a=r.className,u=r.alt,c=r.style,s=e.api,l=s.nodeId,d=s.document;return!!d&&!!l&&d.nodes[l].props?t.createElement("img",{alt:u||"",src:i,className:a,style:Y(Y(Y({},Hn),c),{width:n||Hn.width,height:o||Hn.height})}):null},InlineCode:function(e){var r=Yn("code");return t.createElement(r,Y({},e))},Link:function(e){var r=e.attributes,n=r.href,o=r.target,i=W(r,["href","target"]),a=v("link",{output:"html"});return t.createElement("a",Y({},i,{className:a,href:n,target:n.includes("http")&&!o?"_blank":o}))},List:function(e){var r=e.attributes,n=e.api,o=n.nodeId,i=(n.document.nodes[o]||{}).data;return i&&i.custom&&i.custom.variant===Sn.Unordered?t.createElement("ul",Y({},r)):t.createElement("ol",Y({},r))},ListItem:function(e){var r=e.attributes,n=v("typography",{variant:{variant:"P"},output:"html"});return t.createElement("li",Y({},r,{className:n}))},P:function(e){var r=Yn("p");return t.createElement(r,Y({},e))},RichText:Wn,Spacing:function(e){var r=e.attributes;return t.createElement("hr",Y({},r,{style:Y(Y({},Vn),r.style)}))},Text:function(e){var n=e.attributes,o=e.api,i=o.nodeId,a=o.document,u=!!a&&!!i&&a.nodes[i],c=t.createElement(r,null,n.children);if(!u)return c;var s=u.data&&u.data.custom&&Ft(u.data.custom.marks)?u.data.custom.marks:[];return 0===s.length?c:c=s.reduce((function(t,e){return o.render.styleguide(e,Y(Y({},n),{children:t}))}),c)},U:function(e){var r=Yn("u");return t.createElement(r,Y({},e))},View:Wn,Player:function(e){var r=e.attributes,n=r.width,o=r.height,i=r.src,a=W(r,["width","height","src"]);return t.createElement(z,Y({},a,{controls:!0,url:i,width:n||Kn,height:o||Jn,onError:T}))},CheckList:function(e){var r=e.attributes,n=r.children,o=W(r,["children"]);return t.createElement("div",Y({},o),n)},CheckListGroup:function(e){var r=e.attributes,n=r.children,i=r.title,u=r.style,c=r.className,s=r.onClick,l=e.api,d=l.childrenStateInstances,f=l.trackingIdentifiers,p=l.node.data,h=Un(),g=I(d||[]),y=g.length,b=o(O(g)),_=b[0],E=b[1];a((function(){var t=g.map((function(t,e){return t.subscribe((function(t){E((function(r){var n;return Y(Y({},r),((n={})[t.id]={position:e,status:t.state},n))}))}))}));return function(){t.map((function(t){return t()}))}}),g);var T=w(_,y).percComplete;a((function(){var t,e;100===T&&h.track(m.CHECKLIST_GROUP_COMPLETE,Y({title:i,groupId:null===(e=null===(t=p)||void 0===t?void 0:t.custom)||void 0===e?void 0:e.groupId},f))}),[T]);var A=S(_,y),C=v("typography",{variant:{variant:"H4"},output:"html"});return t.createElement("div",{className:c,onClick:s,style:Y(Y({},to),u)},t.createElement("h4",{className:C},i),t.createElement("div",{style:eo},t.createElement("div",{style:Y(Y({},ro),{width:T+"%"})})),!!n&&t.Children.map(n,(function(e,r){return t.cloneElement(e,{expandByDefault:r===A})})))},CheckListItem:function(e){var r=e.attributes,n=r.title,i=r.style,u=r.children,c=W(r,["title","style","children"]),s=e.api,l=s.stateInstances,d=s.trackingIdentifiers,f=e.expandByDefault,p=Un(),h=o(A.NotStared),g=h[0],y=h[1],b=o(!!f),_=b[0],E=b[1];if(!l)throw new Error("no state provided");var T=function(t){var e=t.find((function(t){return t.resolver instanceof C}));if(!e)throw new Error("Couldn't find CheckListApi state provider");return e}(l);a((function(){return T.subscribe((function(t){y(t.state)}))}),[T]),a((function(){u&&E(!!f)}),[f]);var I=Y(Y({},qn),{borderBottom:u&&_?"1px solid var(--color-lines)":"none"}),O={flexGrow:1,fontWeight:600,cursor:u?"pointer":"auto"},w=v("typography",{variant:{variant:"P"},output:"html"}),S=function(t){E(!_),t.stopPropagation()};return t.createElement("div",Y({style:Y(Y({},$n),i)},c),t.createElement("div",{style:I,onClick:u&&S},t.createElement(io,{onChangeStatus:function(){var t=function(t){return ao[(ao.indexOf(t)+1)%ao.length]}(g);T.mutate({state:t}),p.track(m.CHECKLIST_ITEM_STATE_UPDATED,Y({itemId:T.providerId,state:t,title:n},d))},status:g}),t.createElement("div",{className:w,style:O},n),u&&t.createElement("button",{type:"button",onClick:S,style:Xn},t.createElement(no,{direction:_?"up":"down"}))),u&&t.createElement(uo,{expanded:_},u))}},so=Lr((function(t,e){return Dn(N(t,e))})),lo=function(){try{var t=localStorage.getItem("candu.portals");return t?JSON.parse(t):{}}catch(t){return{}}},fo=an({name:"portal",initialValue:on(lo(),sn),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{portalAsset:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,i=t.type,a=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(i){case"loading":return Y(Y({},e),((r={})[a]=Y(Y({},sn()),{loading:!0}),r));case"success":return function(t,e){lo()[t]=e,localStorage.setItem("candu.portals",JSON.stringify(e))}(a,u),Y(Y({},e),((n={})[a]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return Y(Y({},e),((o={})[a]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});function po(t,e){var r=t.slug;B(x(r),"(Portal) You must supply a valid slug");var n=e.getFluxState(ln).clientToken,o=e.select(vn.selectors.segmentIds);if(o){e.registerFlux(fo);var i=e.select(fo.selectors.portalAsset(r)),a=e.select(fo.selectors.isLoadingOrHasErrors(r));if(!i&&!a){var u=performance.now(),c=function(t,e,r){return K(void 0,void 0,void 0,(function(){var n;return J(this,(function(o){return n="?segmentIds="+(r||[]).join(","),[2,fetch("https://cdn.candu.ai/portalMemberships/"+t+"/"+e+"/head.json"+n)]}))}))}(n,r,o);c&&(e.dispatch(fo.actions.loading(r)),c.then((function(t){return e.dispatch(fo.actions.success({slug:r,result:t,loadTime:performance.now()-u}))})).catch((function(t){return e.dispatch(fo.actions.error({slug:r,error:t,loadTime:performance.now()-u}))})),e.registerFlux(fo))}}}var vo,ho,go=function(e){var r=e.tutorialDocument;return r?t.createElement(mi,{tutorialDocument:r}):null},mo=function(t,e){return{tutorialDocument:fo.selectors.portalAsset(e.slug)}},yo=function(e){po(e,_n());var r=Tn(mo)(go);return t.createElement(r,Y({},e))},bo=function(t){return"candu.sdk."+t},_o=function(t){return bo("error."+t)},Eo="unknown_node_type",To="unkown_inline_node_type",Io="unkown_node_object_type",Oo="tutorial_error_boundary",wo="portal_error_boundary",So="provider_error_boundary",Ao={HEARTBEAT:bo("heartbeat"),PREVIEW_OPEN:bo("preview.open"),PORTAL:bo("portal"),TUTORIAL:bo("tutorial"),TUTORIAL_INTERACTION:bo("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:_o("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:_o("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:_o("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:_o("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:_o("commit_api"),TUTORIAL_LOADING_ERROR:_o("tutorial"),UNKOWN_NODE_TYPE:_o(Eo),UNKOWN_INLINE_NODE_TYPE:_o(To),UNKOWN_NODE_OBJECT_TYPE:_o(Io),TUTORIAL_ERROR:_o(Oo),PORTAL_ERROR:_o(wo),PROVIDER_ERROR:_o(So),STYLEGUIDE_MAP_ERROR:_o(Oo),RENDER_NODE_ERROR:_o(Oo),CIRCULAR_DEPENDENCY_EMBED_PORTAL:_o("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:_o("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:_o("state_fetch_failed"),STATE_UPDATE_FAILED:_o("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:_o("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:bo("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:bo("tutorial.checklist_group_complete"),CARD_DISMISSED:bo("tutorial.card_dismissed")},Co=function(t){return"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+"."},No=((vo={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"})[Ao.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",vo[Ao.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",vo[Ao.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",vo[Ao.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",vo[Ao.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",vo[Ao.UNKOWN_INLINE_NODE_TYPE]=Co(To),vo[Ao.UNKOWN_NODE_TYPE]=Co(Eo),vo[Ao.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",vo[Ao.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",vo[Ao.PORTAL_ERROR]="An error has occured within Portal",vo[Ao.PROVIDER_ERROR]="An error has occured within Provider",vo[Ao.TUTORIAL_ERROR]="An error has occured within Tutorial",vo[Ao.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",vo[Ao.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",vo[Ao.STATE_FETCH_FAILED]="An error has occured while fetching state:",vo[Ao.STATE_UPDATE_FAILED]="An error has occured while updating state:",vo[Ao.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",vo),xo=function(t){switch(t.trigger){case b.ON_CLICK:default:return"onClick"}},jo=function(t,e,r){var n,o,i;switch(t.handler.type){case _.NAVIGATE:return(n={})[xo(t)]=function(n){n.stopPropagation();var o=t.handler,i=o.href,a=o.target,u=r||{},c=u.parentTrackers,s=W(u,["parentTrackers"]);c&&c.forEach((function(r){return e(t,r)})),e(t,s),"Blank"===a?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},n;case _.CHANGE_TUTORIAL:return(o={})[xo(t)]=function(){var e=t.handler.tutorialId;g.error("TODO -> change tutorial",e)},o;case _.OPEN_GUIDE:return(i={})[xo(t)]=function(){var e=t.handler.guideId;g.error("TODO -> open guide",e)},i;default:return{}}},Ro=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},ko=function(t,e){var r=t.states;return Object.keys(r||{}).map((function(t){return e.select(In.selectors.provider(t))}))},Do=function(t,e,r){var n=t.nodes;return n&&n.map((function(t){return e.nodes[t]})).filter((function(t){return!!t})).map((function(t){return ko(t,r)||[]})).reduce((function(t,e){return t.concat(e)}),[])},Po=function(t,e,r){var n=e.getFluxState(dn);try{var o=r.document,i=o.nodes[t];if(!i)return g.error("Document is corrupted. Refusing to move further."),null;var a=function(t){return Po(t,e,r)},u=i.type,c=i.props,s=i.css,l=Y(Y(Y({},c||{}),{style:s||{},children:Ro(i,a)}),function(t,e,r){var n,o,i,a,u,c,s=e.getFluxState(dn);if("Link"===t.type&&(null===(n=t.props)||void 0===n?void 0:n.href)){var l=t.props.href+" Link Clicked",d=null===(i=null===(o=t)||void 0===o?void 0:o.nodes)||void 0===i?void 0:i[0];if(d){var f=r.nodes[d];"Text"===(null===(a=f)||void 0===a?void 0:a.type)&&(null===(c=null===(u=f)||void 0===u?void 0:u.props)||void 0===c?void 0:c.children)&&(l=f.props.children+" Link Clicked")}return{onClick:function(){var e;return s.track(Ao.TUTORIAL_INTERACTION,{trigger:b.ON_CLICK,category:t.type,eventName:l,handler:{href:null===(e=t.props)||void 0===e?void 0:e.href,type:_.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var p=function(t,e){s.track(Ao.TUTORIAL_INTERACTION,Y(Y({},t),e||{}))};return t.data.actions.map((function(t){return jo(t,p,{})})).reduce((function(t,e){return Y(Y({},t),e)}),{})}(i,e,o)),d={nodeId:t,node:i,document:o,render:{node:a,styleguide:function(t,e){return void 0===e&&(e={}),r.renderNode(t,{api:d,attributes:e})},tutorial:function(t){return r.renderTutorial(t)},portal:function(t){return r.renderPortal(t)}},trackingIdentifiers:{},stateInstances:ko(i,e),childrenStateInstances:Do(i,o,e)},f=d.render.styleguide(u,l);return f||(g.error(No[Ao.UNKOWN_NODE_TYPE],{type:u}),n.error(new Error(No[Ao.UNKOWN_NODE_TYPE]),{type:u}),null)}catch(t){return g.error(No[Ao.STYLEGUIDE_MAP_ERROR],t),n.error(t),null}},Lo=function(t,e){var r,n,o,i,a="string"==typeof e&&e.split(" ");return a?1===a.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===a.length?((n={})[t+"Top"]=a[0],n[t+"Right"]=a[1],n[t+"Bottom"]=a[0],n[t+"Left"]=a[1],n):3===a.length?((o={})[t+"Top"]=a[0],o[t+"Right"]=a[1],o[t+"Bottom"]=a[2],o[t+"Left"]=a[1],o):((i={})[t+"Top"]=a[0],i[t+"Right"]=a[1],i[t+"Bottom"]=a[2],i[t+"Left"]=a[3],i):{}},Fo=function(t){var e=t.padding,r=t.margin,n=W(t,["padding","margin"]),o={};return e&&(o=Y(Y({},o),Lo("padding",e))),r&&(o=Y(Y({},o),Lo("margin",r))),Y(Y({},o),n)},Uo=function(t){return"candu.sdk."+t},Mo=function(t){return Uo("error."+t)},Bo=(Uo("preview.open"),Uo("portal"),Uo("tutorial"),Mo("portal_asset_not_found")),zo=Mo("portal_no_segment_ids"),Ho=Mo("no_matching_tutorials"),Go=Mo("circular_dependecy_embed_portal"),Vo=Mo("circular_dependecy_embed_tutorial"),Yo=((ho={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"})[Bo]="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",ho[zo]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",ho[Ho]="The Tutorial will not be rendered because there are no matching segments for the given user.",ho[Go]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",ho[Vo]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",ho);var Wo=function(t,e){return function(r,n){if(null==r)return r;if(!re(r))return t(r,n);for(var o=r.length,i=e?o:-1,a=Object(r);(e?i--:++i<o)&&!1!==n(a[i],i,a););return r}}(oe);var Ko=function(t,e){var r=-1,n=re(t)?Array(t.length):[];return Wo(t,(function(t,o,i){n[++r]=e(t,o,i)})),n};var Jo=function(t,e){return(Ft(t)?Br:Ko)(t,nn(e))},$o=function(){function t(t,e,r){var n=this;this.observer=new j,this.rootStore=t,this.providerId=e,this.resolver=r,this.eventing=t.getFluxState(dn),this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return n.updateState(t)})).catch((function(t){g.error(R[m.STATE_FETCH_FAILED],t.message),n.eventing.track(R[m.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,r=this.state;this.updateState(Y(Y({},r),t)),this.resolver.update(this.rootStore,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){g.error(R[m.STATE_UPDATE_FAILED],t.message),e.eventing.track(R[m.STATE_UPDATE_FAILED],{errorMessage:t.message}),r&&e.updateState(r)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),qo=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),Zo=Object.create(null),Qo=function(){function t(t){this.cache=new qo,this.options=Y({},t||{})}return t.register=function(t,e){Zo[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=W(t,["type"]),n=Zo[e];return n?new n(r):null},t.prototype.toJSON=function(){return Y({type:this.type},this.options)},t}();var Xo=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var ti=function(t){return t!=t};var ei=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var ri=function(t,e,r){return e==e?ei(t,e,r):Xo(t,ti,r)};var ni=function(t,e){return!!(null==t?0:t.length)&&ri(t,e,0)>-1};var oi=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var ii=function(){},ai=pr&&1/Ze(new pr([,-0]))[1]==1/0?function(t){return new pr(t)}:ii;var ui=function(t,e,r){var n=-1,o=ni,i=t.length,a=!0,u=[],c=u;if(r)a=!1,o=oi;else if(i>=200){var s=e?null:ai(t);if(s)return Ze(s);a=!1,o=Ke,c=new Ye}else c=e?[]:u;t:for(;++n<i;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,r)||(c!==u&&c.push(d),u.push(l))}return u};var ci=function(t){return t&&t.length?ui(t):[]},si=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new H(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),li="https://api.candu.ai"+mn,di=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V(e,t),e.prototype.retrieve=function(t,e){return K(this,void 0,void 0,(function(){var r,n,o,i,a=this;return J(this,(function(u){switch(u.label){case 0:return r=t.getFluxState(ln).clientToken,n=t.getFluxState(fn).userId,[4,si.get("cardStateApi",(function(t){return K(a,void 0,void 0,(function(){var e;return J(this,(function(o){switch(o.label){case 0:return[4,fetch(li+"?token="+r+"&finder=byIds&ids="+ci(t).join(",")+"&userId="+n).then((function(t){return t.json()}))];case 1:return e=o.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return o=u.sent(),i={id:e,state:{dismissed:!1}},[2,o||i]}}))}))},e.prototype.update=function(t,e,r){var n=t.getFluxState(ln).clientToken,o=t.getFluxState(fn).userId;return fetch(li+"/"+e+"?token="+n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:o.toString()})}).then((function(t){return t.json()}))},e}(Qo);Qo.register(k.CardApi,di);var fi="https://api.candu.ai"+gn;function pi(t){return{state:t.state,id:t.id}}function vi(t){switch(t){case D.Account:return"AccountId";case D.User:default:return"UserId"}}var hi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V(e,t),e.prototype.getScopeAndFieldsFromRootState=function(t){var e=t.getFluxState(fn),r=e.userId,n=e.traits,o=this.options.scopeTrait,i=this.options.scope||D.User,a=r.toString();return i===D.Account&&(o&&n[o]?a=n[o]:(g.warning("trait '"+o+"' is not defined, falling back to user scope"),i=D.User)),{scope:i,scopeField:a}},e.prototype.retrieve=function(t,e){return K(this,void 0,void 0,(function(){var r,n,o,i,a=this;return J(this,(function(u){switch(u.label){case 0:return r=this.getScopeAndFieldsFromRootState(t),n=r.scope,o=r.scopeField,i=t.getFluxState(ln).clientToken,[4,si.get("checklistState",(function(t){return K(a,void 0,void 0,(function(){var e;return J(this,(function(r){switch(r.label){case 0:return[4,fetch(fi+"?token="+i+"&byTrait="+vi(n)+"&field="+o+"&finder=byIds&ids="+ci(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(pi)}))];case 1:return e=r.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,u.sent()||{id:e,state:A.NotStared}]}}))}))},e.prototype.update=function(t,e,r){var n=this.getScopeAndFieldsFromRootState(t),o=n.scope,i=n.scopeField,a=t.getFluxState(ln).clientToken;return fetch(fi+"/"+e+"?token="+a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y(Y({},r),{byTrait:vi(o),field:i}))}).then((function(t){return t.json()})).then(pi)},e}(Qo);function gi(t,e){var r=t.document,n=r.stateProviders,o=r.head,i=e.getFluxState(ln).clientToken;o&&P(o,i),n&&function(t,e){var r;e.registerFlux(In);var n=Jo(t,(function(t,r){if(e.select(In.selectors.provider(r)))return null;var n=Qo.fromJSON(t.resolver);return n?new $o(e,r,n):null})).filter((function(t){return!!t}));e.dispatch((r=In.actions).set.apply(r,n))}(n,e)}Qo.register(k.CheckListApi,hi);var mi=Tn((function(){return{clientToken:ln.selectors.clientToken,eventing:dn.selectors.state}}))((function(e){var r,n=e.tutorialDocument,o=e.clientToken,i=e.eventing,a=(r=_n().select(ln.selectors.styleguide),so({provider:r},co)).getComponent,u=_n();if(!n.document)return null;gi(n,u);var c=n.document,s=c.rootNodeId,l=c.head,d=c.nodes,f={rootNodeId:s,nodes:L(d)};return l&&P(l,o),Po(n.document.rootNodeId,u,{document:f,renderTutorial:function(e){return t.createElement(_i,Y({},e))},renderPortal:function(e){return t.createElement(yo,Y({},e))},renderNode:function(e,r){try{var n=a(e);return n?t.createElement(n,{key:r.api.nodeId,api:r.api,attributes:Y(Y({},r.attributes),{style:r.attributes.style&&Fo(r.attributes.style)})}):null}catch(t){return g.error(Yo[m.RENDER_NODE_ERROR],t),i.error(t),null}}})})),yi=function(e){var r=e.tutorialDocument;return r?t.createElement(mi,{tutorialDocument:r}):null},bi=function(t,e){return{tutorialDocument:wn.selectors.tutorialDocument(e.slug)}},_i=function(e){!function(t,e){var r=p(t),n=e.getFluxState(dn),o=e.getFluxState(ln).clientToken;e.registerFlux(wn);var i=r.slug,a=e.select(wn.selectors.tutorialDocument(i));if(!e.select(wn.selectors.isLoadingOrHasErrors(i))&&!a){var c=performance.now(),s=u.tutorialDocument(r,o,n);s&&(e.dispatch(wn.actions.loading(i)),s.then((function(t){return e.dispatch(wn.actions.success({slug:i,result:t,loadTime:performance.now()-c}))})).catch((function(t){return e.dispatch(wn.actions.error({slug:i,error:t,loadTime:performance.now()-c}))})))}}(e,_n());var r=Tn(bi)(yi);return t.createElement(r,Y({},e))};export{En as CanduProvider,yo as Portal,bn as ProviderContext,_i as Tutorial,_n as useRootStore};
//# sourceMappingURL=index.es.js.map

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("@candulabs/core"),require("@candulabs/eventing"),require("invariant"),require("react-player"),require("setimmediate"),require("dataloader")):"function"==typeof define&&define.amd?define(["exports","react","@candulabs/core","@candulabs/eventing","invariant","react-player","setimmediate","dataloader"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@candulabs/harbour"]={},t.React,t.core,t.eventing,t.invariant,t.ReactPlayer,null,t.DataLoader)}(this,(function(t,e,r,n,o,a,i,u){"use strict";function c(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=c(e),l=c(o),d=c(a),f=c(u),p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function v(t,e){function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var h=function(){return(h=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function g(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function m(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{c(n.next(t))}catch(t){a(t)}}function u(t){try{c(n.throw(t))}catch(t){a(t)}}function c(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(i,u)}c((n=n.apply(t,e||[])).next())}))}function y(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var _=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(t){var e={exports:{}};return t(e,e.exports),e.exports}var T="object"==typeof b&&b&&b.Object===Object&&b,S="object"==typeof self&&self&&self.Object===Object&&self,I=T||S||Function("return this")(),O=I.Symbol,C=Object.prototype,A=C.hasOwnProperty,w=C.toString,R=O?O.toStringTag:void 0;var N=function(t){var e=A.call(t,R),r=t[R];try{t[R]=void 0;var n=!0}catch(t){}var o=w.call(t);return n&&(e?t[R]=r:delete t[R]),o},k=Object.prototype.toString;var x=function(t){return k.call(t)},D=O?O.toStringTag:void 0;var j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":D&&D in Object(t)?N(t):x(t)};var L,P=function(t){if(!_(t))return!1;var e=j(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},F=I["__core-js_shared__"],M=(L=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+L:"";var U=function(t){return!!M&&M in t},G=Function.prototype.toString;var H=function(t){if(null!=t){try{return G.call(t)}catch(t){}try{return t+""}catch(t){}}return""},B=/^\[object .+?Constructor\]$/,V=Function.prototype,z=Object.prototype,Y=V.toString,W=z.hasOwnProperty,K=RegExp("^"+Y.call(W).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var J=function(t){return!(!_(t)||U(t))&&(P(t)?K:B).test(H(t))};var q=function(t,e){return null==t?void 0:t[e]};var $=function(t,e){var r=q(t,e);return J(r)?r:void 0},Z=function(){try{var t=$(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Q=function(t,e,r){"__proto__"==e&&Z?Z(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var X=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 tt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var et=function(t){return null!=t&&"object"==typeof t};var rt=function(t){return et(t)&&"[object Arguments]"==j(t)},nt=Object.prototype,ot=nt.hasOwnProperty,at=nt.propertyIsEnumerable,it=rt(function(){return arguments}())?rt:function(t){return et(t)&&ot.call(t,"callee")&&!at.call(t,"callee")},ut=Array.isArray;var ct=function(){return!1},st=E((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)||ct;t.exports=a})),lt=/^(?:0|[1-9]\d*)$/;var dt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&lt.test(t))&&t>-1&&t%1==0&&t<e};var ft=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},pt={};pt["[object Float32Array]"]=pt["[object Float64Array]"]=pt["[object Int8Array]"]=pt["[object Int16Array]"]=pt["[object Int32Array]"]=pt["[object Uint8Array]"]=pt["[object Uint8ClampedArray]"]=pt["[object Uint16Array]"]=pt["[object Uint32Array]"]=!0,pt["[object Arguments]"]=pt["[object Array]"]=pt["[object ArrayBuffer]"]=pt["[object Boolean]"]=pt["[object DataView]"]=pt["[object Date]"]=pt["[object Error]"]=pt["[object Function]"]=pt["[object Map]"]=pt["[object Number]"]=pt["[object Object]"]=pt["[object RegExp]"]=pt["[object Set]"]=pt["[object String]"]=pt["[object WeakMap]"]=!1;var vt=function(t){return et(t)&&ft(t.length)&&!!pt[j(t)]};var ht=function(t){return function(e){return t(e)}},gt=E((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&T.process,a=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a})),mt=gt&&gt.isTypedArray,yt=mt?ht(mt):vt,_t=Object.prototype.hasOwnProperty;var bt=function(t,e){var r=ut(t),n=!r&&it(t),o=!r&&!n&&st(t),a=!r&&!n&&!o&&yt(t),i=r||n||o||a,u=i?tt(t.length,String):[],c=u.length;for(var s in t)!e&&!_t.call(t,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||dt(s,c))||u.push(s);return u},Et=Object.prototype;var Tt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Et)};var St=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),It=Object.prototype.hasOwnProperty;var Ot=function(t){if(!Tt(t))return St(t);var e=[];for(var r in Object(t))It.call(t,r)&&"constructor"!=r&&e.push(r);return e};var Ct=function(t){return null!=t&&ft(t.length)&&!P(t)};var At=function(t){return Ct(t)?bt(t):Ot(t)};var wt=function(t,e){return t&&X(t,e,At)};var Rt=function(){this.__data__=[],this.size=0};var Nt=function(t,e){return t===e||t!=t&&e!=e};var kt=function(t,e){for(var r=t.length;r--;)if(Nt(t[r][0],e))return r;return-1},xt=Array.prototype.splice;var Dt=function(t){var e=this.__data__,r=kt(e,t);return!(r<0)&&(r==e.length-1?e.pop():xt.call(e,r,1),--this.size,!0)};var jt=function(t){var e=this.__data__,r=kt(e,t);return r<0?void 0:e[r][1]};var Lt=function(t){return kt(this.__data__,t)>-1};var Pt=function(t,e){var r=this.__data__,n=kt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Ft(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])}}Ft.prototype.clear=Rt,Ft.prototype.delete=Dt,Ft.prototype.get=jt,Ft.prototype.has=Lt,Ft.prototype.set=Pt;var Mt=Ft;var Ut=function(){this.__data__=new Mt,this.size=0};var Gt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ht=function(t){return this.__data__.get(t)};var Bt=function(t){return this.__data__.has(t)},Vt=$(I,"Map"),zt=$(Object,"create");var Yt=function(){this.__data__=zt?zt(null):{},this.size=0};var Wt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Kt=Object.prototype.hasOwnProperty;var Jt=function(t){var e=this.__data__;if(zt){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Kt.call(e,t)?e[t]:void 0},qt=Object.prototype.hasOwnProperty;var $t=function(t){var e=this.__data__;return zt?void 0!==e[t]:qt.call(e,t)};var Zt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=zt&&void 0===e?"__lodash_hash_undefined__":e,this};function Qt(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])}}Qt.prototype.clear=Yt,Qt.prototype.delete=Wt,Qt.prototype.get=Jt,Qt.prototype.has=$t,Qt.prototype.set=Zt;var Xt=Qt;var te=function(){this.size=0,this.__data__={hash:new Xt,map:new(Vt||Mt),string:new Xt}};var ee=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var re=function(t,e){var r=t.__data__;return ee(e)?r["string"==typeof e?"string":"hash"]:r.map};var ne=function(t){var e=re(this,t).delete(t);return this.size-=e?1:0,e};var oe=function(t){return re(this,t).get(t)};var ae=function(t){return re(this,t).has(t)};var ie=function(t,e){var r=re(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ue(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])}}ue.prototype.clear=te,ue.prototype.delete=ne,ue.prototype.get=oe,ue.prototype.has=ae,ue.prototype.set=ie;var ce=ue;var se=function(t,e){var r=this.__data__;if(r instanceof Mt){var n=r.__data__;if(!Vt||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ce(n)}return r.set(t,e),this.size=r.size,this};function le(t){var e=this.__data__=new Mt(t);this.size=e.size}le.prototype.clear=Ut,le.prototype.delete=Gt,le.prototype.get=Ht,le.prototype.has=Bt,le.prototype.set=se;var de=le;var fe=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var pe=function(t){return this.__data__.has(t)};function ve(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new ce;++e<r;)this.add(t[e])}ve.prototype.add=ve.prototype.push=fe,ve.prototype.has=pe;var he=ve;var ge=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 me=function(t,e){return t.has(e)};var ye=function(t,e,r,n,o,a){var i=1&r,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var s=a.get(t),l=a.get(e);if(s&&l)return s==e&&l==t;var d=-1,f=!0,p=2&r?new he:void 0;for(a.set(t,e),a.set(e,t);++d<u;){var v=t[d],h=e[d];if(n)var g=i?n(h,v,d,e,t,a):n(v,h,d,t,e,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!ge(e,(function(t,e){if(!me(p,e)&&(v===t||o(v,t,r,n,a)))return p.push(e)}))){f=!1;break}}else if(v!==h&&!o(v,h,r,n,a)){f=!1;break}}return a.delete(t),a.delete(e),f},_e=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},Te=O?O.prototype:void 0,Se=Te?Te.valueOf:void 0;var Ie=function(t,e,r,n,o,a,i){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!a(new _e(t),new _e(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Nt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=be;case"[object Set]":var c=1&n;if(u||(u=Ee),t.size!=e.size&&!c)return!1;var s=i.get(t);if(s)return s==e;n|=2,i.set(t,e);var l=ye(u(t),u(e),n,o,a,i);return i.delete(t),l;case"[object Symbol]":if(Se)return Se.call(t)==Se.call(e)}return!1};var Oe=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Ce=function(t,e,r){var n=e(t);return ut(t)?n:Oe(n,r(t))};var Ae=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 we=function(){return[]},Re=Object.prototype.propertyIsEnumerable,Ne=Object.getOwnPropertySymbols,ke=Ne?function(t){return null==t?[]:(t=Object(t),Ae(Ne(t),(function(e){return Re.call(t,e)})))}:we;var xe=function(t){return Ce(t,At,ke)},De=Object.prototype.hasOwnProperty;var je=function(t,e,r,n,o,a){var i=1&r,u=xe(t),c=u.length;if(c!=xe(e).length&&!i)return!1;for(var s=c;s--;){var l=u[s];if(!(i?l in e:De.call(e,l)))return!1}var d=a.get(t),f=a.get(e);if(d&&f)return d==e&&f==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=i;++s<c;){var h=t[l=u[s]],g=e[l];if(n)var m=i?n(g,h,l,e,t,a):n(h,g,l,t,e,a);if(!(void 0===m?h===g||o(h,g,r,n,a):m)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var y=t.constructor,_=e.constructor;y==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(p=!1)}return a.delete(t),a.delete(e),p},Le=$(I,"DataView"),Pe=$(I,"Promise"),Fe=$(I,"Set"),Me=$(I,"WeakMap"),Ue="[object Map]",Ge="[object Promise]",He="[object Set]",Be="[object WeakMap]",Ve="[object DataView]",ze=H(Le),Ye=H(Vt),We=H(Pe),Ke=H(Fe),Je=H(Me),qe=j;(Le&&qe(new Le(new ArrayBuffer(1)))!=Ve||Vt&&qe(new Vt)!=Ue||Pe&&qe(Pe.resolve())!=Ge||Fe&&qe(new Fe)!=He||Me&&qe(new Me)!=Be)&&(qe=function(t){var e=j(t),r="[object Object]"==e?t.constructor:void 0,n=r?H(r):"";if(n)switch(n){case ze:return Ve;case Ye:return Ue;case We:return Ge;case Ke:return He;case Je:return Be}return e});var $e=qe,Ze="[object Arguments]",Qe="[object Array]",Xe="[object Object]",tr=Object.prototype.hasOwnProperty;var er=function(t,e,r,n,o,a){var i=ut(t),u=ut(e),c=i?Qe:$e(t),s=u?Qe:$e(e),l=(c=c==Ze?Xe:c)==Xe,d=(s=s==Ze?Xe:s)==Xe,f=c==s;if(f&&st(t)){if(!st(e))return!1;i=!0,l=!1}if(f&&!l)return a||(a=new de),i||yt(t)?ye(t,e,r,n,o,a):Ie(t,e,c,r,n,o,a);if(!(1&r)){var p=l&&tr.call(t,"__wrapped__"),v=d&&tr.call(e,"__wrapped__");if(p||v){var h=p?t.value():t,g=v?e.value():e;return a||(a=new de),o(h,g,r,n,a)}}return!!f&&(a||(a=new de),je(t,e,r,n,o,a))};var rr=function t(e,r,n,o,a){return e===r||(null==e||null==r||!et(e)&&!et(r)?e!=e&&r!=r:er(e,r,n,o,t,a))};var nr=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 de;if(n)var f=n(s,l,c,t,e,d);if(!(void 0===f?rr(l,s,3,n,d):f))return!1}}return!0};var or=function(t){return t==t&&!_(t)};var ar=function(t){for(var e=At(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,or(o)]}return e};var ir=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var ur=function(t){var e=ar(t);return 1==e.length&&e[0][2]?ir(e[0][0],e[0][1]):function(r){return r===t||nr(r,t,e)}};var cr=function(t){return"symbol"==typeof t||et(t)&&"[object Symbol]"==j(t)},sr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lr=/^\w*$/;var dr=function(t,e){if(ut(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!cr(t))||(lr.test(t)||!sr.test(t)||null!=e&&t in Object(e))};function fr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");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(fr.Cache||ce),r}fr.Cache=ce;var pr=fr;var vr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hr=/\\(\\)?/g,gr=function(t){var e=pr(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(vr,(function(t,r,n,o){e.push(n?o.replace(hr,"$1"):r||t)})),e}));var mr=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},yr=O?O.prototype:void 0,_r=yr?yr.toString:void 0;var br=function t(e){if("string"==typeof e)return e;if(ut(e))return mr(e,t)+"";if(cr(e))return _r?_r.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var Er=function(t){return null==t?"":br(t)};var Tr=function(t,e){return ut(t)?t:dr(t,e)?[t]:gr(Er(t))};var Sr=function(t){if("string"==typeof t||cr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Ir=function(t,e){for(var r=0,n=(e=Tr(e,t)).length;null!=t&&r<n;)t=t[Sr(e[r++])];return r&&r==n?t:void 0};var Or=function(t,e,r){var n=null==t?void 0:Ir(t,e);return void 0===n?r:n};var Cr=function(t,e){return null!=t&&e in Object(t)};var Ar=function(t,e,r){for(var n=-1,o=(e=Tr(e,t)).length,a=!1;++n<o;){var i=Sr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&ft(o)&&dt(i,o)&&(ut(t)||it(t))};var wr=function(t,e){return null!=t&&Ar(t,e,Cr)};var Rr=function(t,e){return dr(t)&&or(e)?ir(Sr(t),e):function(r){var n=Or(r,t);return void 0===n&&n===e?wr(r,t):rr(e,n,3)}};var Nr=function(t){return t};var kr=function(t){return function(e){return null==e?void 0:e[t]}};var xr=function(t){return function(e){return Ir(e,t)}};var Dr=function(t){return dr(t)?kr(Sr(t)):xr(t)};var jr=function(t){return"function"==typeof t?t:null==t?Nr:"object"==typeof t?ut(t)?Rr(t[0],t[1]):ur(t):Dr(t)};var Lr=function(t,e){var r={};return e=jr(e),wt(t,(function(t,n,o){Q(r,n,e(t,n,o))})),r};function Pr(t){var e=t.name,r=t.actions,n=t.selectors,o=g(t,["name","actions","selectors"]);return h(h({},o),{actions:Lr(r||{},(function(t,r){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return h({type:r,storeName:e},t.apply(void 0,n))}})),selectors:Lr(n||{},(function(t){function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return{storeName:e,selector:t.apply(void 0,r)}}return r.storeName=e,r.selector=t,r})),name:e})}function Fr(t){var e=t.name,r=t.initialValue,n=t.reducer,o=r,a=[];return{name:e,getState:function(){return o},subscribe:function(t){return a.push(t),function(){a=a.filter((function(e){return e!==t}))}},dispatch:function(t){var e=o;return"object"==typeof e&&null!==e?e=h({},o):Array.isArray(e)&&(e=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var a=arguments[e],i=0,u=a.length;i<u;i++,o++)n[o]=a[i];return n}(o)),o=n(t,o),a.forEach((function(r){return r(o,e,t)})),this}}}function Mr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.fromEntries(t.map((function(t){return[t.name,t]})));return{name:"root",getFluxState:function(t){var e=this.getStore(t);if(!e)throw new Error("rootState.getFluxState: the flux store "+t.name+" does not exist");return e.getState()},getState:function(){return Lr(r,(function(t){return t.getState()}))},getStore:function(t){var e="string"==typeof t?t:t.name;return r[e]},registerFlux:function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter((function(t){var e=t.name;return!r[e]})).forEach((function(e){return t.register(Fr(e))})),this},register:function(t){return r[t.name]=t,this},dispatch:function(t){t.storeName?r[t.storeName].dispatch(t):Object.values(r).forEach((function(e){return e.dispatch(t)}))},remove:function(t){return delete r[t.name],this},select:function(t){var e;return t.selector(null===(e=r[t.storeName])||void 0===e?void 0:e.getState())}}}var Ur=function(t){return{loading:!1,result:t,error:void 0,loadTime:0}},Gr=Pr({name:"config",initialValue:{clientToken:"",options:{},styleguide:{}},actions:{set:function(t){return{payload:t}}},selectors:{styleguide:function(t){return t.styleguide},clientToken:function(t){return t.clientToken}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e}}),Hr=Pr({name:"eventing",initialValue:n.noOpEventing,actions:{set:function(t){return{eventing:t}}},selectors:{state:function(t){return t}},reducer:function(t,e){var r=t.type,n=t.eventing;return"set"===r?n:e}}),Br=Pr({name:"user",initialValue:{userId:n.getAnonymousId(),traits:{}},actions:{set:function(t){return{payload:t}}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e},selectors:{userId:function(t){return t.userId}}}),Vr="candu.segmentMembership",zr=function(t){return localStorage.setItem(Vr,JSON.stringify(t))},Yr=Pr({name:"segmentMembership",initialValue:Ur(function(){try{var t=localStorage.getItem(Vr),e=t&&JSON.parse(t);if(!e)return;return{id:"",segmentIds:e}}catch(t){return}}()),actions:{loading:function(){return{}},success:function(t){return t},error:function(t){return t}},selectors:{segmentIds:function(t){var e;return null===(e=t.result)||void 0===e?void 0:e.segmentIds}},reducer:function(t,e){var r=t.type,n=t.result,o=t.loadTime,a=t.error;switch(r){case"loading":return h(h({},e),{loading:!0});case"success":return zr(n.segmentIds),h(h({},e),{loading:!1,error:void 0,result:n,loadTime:o});case"error":return{loading:!1,result:void 0,error:a,loadTime:o};default:return e}}});const Wr="https://api.candu.ai";var Kr={name:"@candulabs/harbour",version:"0.7.1-alpha.16"},Jr="/api/checklistItems",qr="/api/cards";function $r(t,e){e.registerFlux(Gr,Br,Hr,Yr);var o=function(t,e){var n=t.clientToken,o=t.userId,a=t.traits,i=t.options,u=t.styleguide,c=g(t,["clientToken","userId","traits","options","styleguide"]);l.default(r.isClientToken(n),"(Candu) you must provide a valid clientToken"),l.default(!o||r.isUserId(o),"(Candu) you must provide a valid userId"),l.default(!a||_(a),"(Candu) traits must be undefined or an object"),l.default(!i||_(i),"(Candu) options must be undefined or an object"),l.default(!u||_(u),"(Candu) styleguide must be undefined or an object");var s=e.getFluxState(Br);return h(h({},c),{clientToken:n,traits:a||s.traits||{},options:i||{},styleguide:u||{},userId:o||s.userId})}(t,e),a=o.clientToken,i=o.userId,u=o.traits,c=o.styleguide,s=o.options,d=n.eventingFactory(a,i,s,Kr);r.internalEventing(d).provider({userId:i,traits:u,styleguide:c}),e.dispatch(Br.actions.set({userId:i,traits:u})),e.dispatch(Hr.actions.set(d)),e.dispatch(Gr.actions.set({clientToken:a,options:s,styleguide:c})),r.attachStylesheet(a),function(t){var e=t.getFluxState(Gr),n=e.clientToken,o=e.options,a=t.getFluxState(Br).userId,i=t.getFluxState(Hr);if(o.skipLoading||o.overrideSegmentMemberships){var u={id:a,segmentIds:o.overrideSegmentMemberships||[]};t.dispatch(Yr.actions.success({result:u,loadTime:0}))}else{var c=performance.now();t.dispatch(Yr.actions.loading()),r.RESOURCES.segmentMembership(n,a).then((function(e){var n=performance.now()-c;i.track(r.METRICS.SEGMENT_MEMBERSHIP_LOAD_TIME,{value:n}),t.dispatch(Yr.actions.success({result:e,loadTime:n}))})).catch((function(e){return t.dispatch(Yr.actions.error({error:e,loadTime:performance.now()-c}))}))}}(e)}var Zr=s.default.createContext(Mr()),Qr=function(){return e.useContext(Zr)},Xr=function(t){function e(e){var r=t.call(this,e)||this;r.state=Mr();var n=r.props;return n.children,$r(g(n,["children"]),r.state),r}return v(e,t),e.prototype.render=function(){return s.default.createElement(Zr.Provider,{value:this.state},this.props.children)},e}(s.default.Component),tn=function(t){return function(e){var r;return(r=function(r){function n(t){var e=r.call(this,t)||this;return e.unsubscribes=[],e.handleChange=e.handleChange.bind(e),e}return v(n,r),n.prototype.componentDidMount=function(){var e=this;this.handleChange();var r=Object.values(t(this.context,this.props)).map((function(t){var r=t.storeName;return e.context.getStore(r).subscribe}));this.unsubscribes=r.map((function(t){return t(e.handleChange)}))},n.prototype.componentWillUnmount=function(){this.unsubscribes.forEach((function(t){return t()}))},n.prototype.mapStateToProps=function(){var e=this;return Lr(t(this.context,this.props),(function(t){return t.selector&&t.storeName?e.context.select(t):t}))},n.prototype.handleChange=function(){this.setState(this.mapStateToProps())},n.prototype.render=function(){return s.default.createElement(e,h({},this.state||this.mapStateToProps(),this.props))},n}(s.default.Component)).contextType=Zr,r}},en=Pr({name:"stateProviders",initialValue:{},actions:{set:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{providers:t}}},selectors:{provider:function(t){return function(e){return e[t]}}},reducer:function(t,e){var r=t.type,n=t.providers;switch(r){case"set":return h(h({},e),Object.fromEntries(n.map((function(t){return[t.providerId,t]}))));default:return e}}}),rn=function(){try{var t=localStorage.getItem("candu.tutorials");return t?JSON.parse(t):{}}catch(t){return{}}},nn=Pr({name:"tutorialDocuments",initialValue:Lr(rn(),Ur),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{tutorialDocument:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return h(h({},e),((r={})[i]=h(h({},Ur()),{loading:!0}),r));case"success":return function(t,e){var r=rn();r[t]=e,localStorage.setItem("candu.tutorials",JSON.stringify(r))}(i,u),h(h({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return h(h({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});var on,an=["div","a","p"],un={Fragment:e.Fragment,Document:e.Fragment},cn="#6310E5",sn="#59C3C3",ln="#4D515D",dn="#FCAD0D",fn="#EE4266",pn=function(t){l.default(_(t),"(createStyleguide) styleguide must be undefined or an object");return{getComponent:function(r){var n=function(e){if(t[e])return t[e];if(un[e])return un[e];var r=an.indexOf(e)||an.indexOf(e.toLowerCase());return an[r]}(r);return"string"==typeof n?function(t){var e=t.api,r=t.attributes;return s.default.createElement(n,h({key:e.nodeId},r))}:n===e.Fragment?function(t){var r=t.api,n=t.attributes;return s.default.createElement(e.Fragment,{key:r.nodeId},n.children)}:n},all:function(){return t}}},vn={borderRadius:"4px",padding:"8px"},hn=function(t){switch(t){case"success":return cn;case"active":return sn;case"warning":return dn;case"danger":return fn;default:return ln}},gn=function(){return s.default.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s.default.createElement("path",{d:"M6 6L18 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}),s.default.createElement("path",{d:"M18 6L6 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}))},mn=function(){return Qr().getFluxState(Hr)},yn={borderRadius:"4px",padding:"8px",backgroundColor:"rgb(51, 55, 69)",color:"rgb(255, 255, 255)",overflow:"auto"},_n={display:"flex"},bn={flex:"1 1"},En={maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"};!function(t){t.Ordered="OL",t.Unordered="UL"}(on||(on={}));var Tn,Sn={backgroundColor:"transparent",border:"none",borderTop:"1px solid #edeff3",height:"0"},In=function(t){return function(e){var n,o=e.attributes,a=["h1","h2","h3","h4","p"].includes(t);a&&(n={variant:t.toUpperCase()});var i=r.toCssSelector(a?"typography":t,{variant:n,output:"html"});return s.default.createElement(t,h({},o,{className:i}))}},On=function(t){var e=In("div");return s.default.createElement(e,h({},t))},Cn="640px",An="360px",wn="all .35s ease-out 0s",Rn={border:"1px solid var(--color-lines)",borderRadius:"4px",marginBottom:"16px",backgroundColor:"white",display:"flex",flexDirection:"column"},Nn={padding:"16px",display:"flex",flexDirection:"row",alignItems:"center",flexGrow:1,boxSizing:"border-box",color:"var(--color-neutral)"},kn={padding:"16px 48px",display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",transition:wn},xn={borderRadius:"20px",height:"32px",width:"32px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",marginRight:"16px",appearance:"none",outline:"none",padding:0,transition:"all .1s ease-out 0s"},Dn={appearance:"none",border:"none",outline:"none",cursor:"pointer",background:"none",padding:"0px",display:"flex"},jn={marginBottom:"48px"},Ln={width:"100%",height:"4px",marginBottom:"16px",backgroundColor:"#EDEFF3"},Pn={height:"100%",backgroundColor:"#59C3C3",transition:wn},Fn=function(t){var e=t.direction;return s.default.createElement("svg",{style:{transition:"all .35s ease-out 0s",transform:"rotateZ("+("up"===e?"180deg":"0deg")+")"},width:"18",height:"11",viewBox:"0 0 18 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s.default.createElement("path",{d:"M9 6.74488L3.09046 0.555221C2.39741 -0.170679 1.25783 -0.186906 0.545126 0.518977C-0.167576 1.22486 -0.183508 2.38555 0.509541 3.11145L7.37034 10.2975L7.37166 10.2988C8.26633 11.2347 9.73727 11.2336 10.6306 10.2965L17.4905 3.11145C18.1835 2.38555 18.1676 1.22486 17.4549 0.518977C16.7422 -0.186906 15.6026 -0.170679 14.9095 0.555221L9 6.74488Z",fill:"#D4D8E4"}))},Mn=((Tn={})[r.CheckListItemStatus.NotStared]={title:"Not Started",statusStyle:{backgroundColor:"#EDEFF3",borderColor:"#D4D8E4"},icon:{path:"M 2 6.55 L 5 6.55 L 10 6.55",stroke:"#9498A7"}},Tn[r.CheckListItemStatus.InProgress]={title:"In Progress",statusStyle:{backgroundColor:"#FE8A3A",borderColor:"white"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"white"}},Tn[r.CheckListItemStatus.Done]={title:"Completed",statusStyle:{backgroundColor:"#CFF5F5",borderColor:"#6DD8D8"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"#46AEAE"}},Tn),Un=function(t){var r=t.onChangeStatus,n=t.status,o=e.useState(!1),a=o[0],i=o[1],u=h(h(h({},xn),Mn[n].statusStyle),{border:(a?"1px":"0px")+" solid "+Mn[n].statusStyle.borderColor}),c=Mn[n].title,l=Mn[n].icon;return s.default.createElement("button",{type:"button",onClick:function(t){r(),t.stopPropagation()},style:u,title:c,onMouseOver:function(){return i(!0)},onFocus:function(){return i(!0)},onMouseOut:function(){return i(!1)},onBlur:function(){return i(!1)}},s.default.createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s.default.createElement("path",{d:l.path,stroke:l.stroke,strokeWidth:"2.5",strokeLinecap:"round",style:{transition:"all .1s ease-out 0s"}})))},Gn=[r.CheckListItemStatus.NotStared,r.CheckListItemStatus.Done],Hn=function(t){var e=t.expanded,r=t.children,n=e?kn:h(h({},kn),{maxHeight:0,padding:"0px 48px"});return s.default.createElement("div",{style:n},r)},Bn={Alert:function(t){var e=t.attributes,r=e.intent,n=e.title,o=e.description;return s.default.createElement("div",h({},e,{style:h(h(h({},vn),e.style),{color:"#FFF",backgroundColor:hn(r)||"#EDEDED"})}),n,s.default.createElement("div",null,s.default.createElement("small",null,o)))},B:function(t){var e=In("b");return s.default.createElement(e,h({},t))},Badge:function(t){var e=t.attributes,n=e.color,o=e.outline,a=g(e,["color","outline"]),i=r.toCssSelector("badge",{variant:{color:n,outline:o},output:"html"});return s.default.createElement("span",h({},a,{className:i}))},Button:function(t){var e=t.attributes;return s.default.createElement("button",h({type:"button"},e,{className:r.toCssSelector("button",{variant:{color:e.color,outline:e.outline},output:"html"}),style:h({},e.style||{})}))},Card:function(t){var n=t.attributes,o=n.children,a=n.isDismissible,i=g(n,["children","isDismissible"]),u=t.api,c=mn(),l=r.toCssSelector("card",{output:"html"}),d=e.useMemo((function(){var t;return null===(t=u.stateInstances)||void 0===t?void 0:t.find((function(t){return t.resolver instanceof r.CardResolverInstance}))}),[]),f=e.useState({dismissed:!1}),p=f[0],v=f[1];return e.useLayoutEffect((function(){if(d)return d.subscribe((function(t){v(t.state)}))}),[d]),p.dismissed?null:s.default.createElement("div",h({},i,{className:l,style:h({position:"relative"},i.style)}),a&&s.default.createElement("a",{style:{position:"absolute",top:"6px",right:"6px",cursor:"pointer"},onClick:function(){d?(c.track(r.EVENT_NAMES.TUTORIAL_INTERACTION,h({category:r.CATEGORIES.NATIVE,trigger:r.TRIGGERS.ON_CLICK,handler:{type:r.HANDLER_TYPES.DISMISSED_CARD,cardId:u.nodeId},eventName:"DismissedCard_"+u.nodeId},u.trackingIdentifiers)),d.mutate({id:d.providerId,state:{dismissed:!0}})):r.logger.warning("Card state provider not found")}},s.default.createElement(gn,null)),o)},Code:function(t){var e=t.attributes,r=e.children,n=g(e,["children"]);return s.default.createElement("div",h({},n,{style:h(h({},yn),n.style||{})}),s.default.createElement("pre",{style:{color:"rgb(255, 255, 255)"}},r))},Document:function(t){var e=t.attributes,r=g(t,["attributes"]),n=e.style;return s.default.createElement(On,h({},r,{attributes:h(h({},e),{style:h(h({},{overflow:"auto",maxWidth:"100%",maxHeight:"100%",boxSizing:"border-box"}),n)})}))},Em:function(t){var e=In("em");return s.default.createElement(e,h({},t))},EmbedPortal:function(t){var e=t.attributes,n=e.slug,o=e.style,a=t.api;return s.default.createElement("div",{className:r.CANDU_PORTAL_CLASS,style:o},a.render.portal({slug:n}))},EmbedTutorial:function(t){var e=t.attributes,r=e.id,n=e.slug,o=e.style,a=t.api;return s.default.createElement("div",{style:o},a.render.tutorial({tutorialId:r,slug:n}))},Flex:function(t){var e=t.attributes;return s.default.createElement("div",h({},e,{style:h(h({},_n),e.style)}))},FlexItem:function(t){var e=t.attributes;return s.default.createElement("div",h({},e,{style:h(h({},bn),e.style)}))},H1:function(t){var e=In("h1");return s.default.createElement(e,h({},t))},H2:function(t){var e=In("h2");return s.default.createElement(e,h({},t))},H3:function(t){var e=In("h3");return s.default.createElement(e,h({},t))},H4:function(t){var e=In("h4");return s.default.createElement(e,h({},t))},H5:function(t){var e=In("h5");return s.default.createElement(e,h({},t))},H6:function(t){var e=In("h6");return s.default.createElement(e,h({},t))},Image:function(t){var e=t.attributes,r=e.width,n=e.height,o=e.src,a=e.className,i=e.alt,u=e.style,c=t.api,l=c.nodeId,d=c.document;return!!d&&!!l&&d.nodes[l].props?s.default.createElement("img",{alt:i||"",src:o,className:a,style:h(h(h({},En),u),{width:r||En.width,height:n||En.height})}):null},InlineCode:function(t){var e=In("code");return s.default.createElement(e,h({},t))},Link:function(t){var e=t.attributes,n=e.href,o=e.target,a=g(e,["href","target"]),i=r.toCssSelector("link",{output:"html"});return s.default.createElement("a",h({},a,{className:i,href:n,target:n.includes("http")&&!o?"_blank":o}))},List:function(t){var e=t.attributes,r=t.api,n=r.nodeId,o=(r.document.nodes[n]||{}).data;return o&&o.custom&&o.custom.variant===on.Unordered?s.default.createElement("ul",h({},e)):s.default.createElement("ol",h({},e))},ListItem:function(t){var e=t.attributes,n=r.toCssSelector("typography",{variant:{variant:"P"},output:"html"});return s.default.createElement("li",h({},e,{className:n}))},P:function(t){var e=In("p");return s.default.createElement(e,h({},t))},RichText:On,Spacing:function(t){var e=t.attributes;return s.default.createElement("hr",h({},e,{style:h(h({},Sn),e.style)}))},Text:function(t){var r=t.attributes,n=t.api,o=n.nodeId,a=n.document,i=!!a&&!!o&&a.nodes[o],u=s.default.createElement(e.Fragment,null,r.children);if(!i)return u;var c=i.data&&i.data.custom&&ut(i.data.custom.marks)?i.data.custom.marks:[];return 0===c.length?u:u=c.reduce((function(t,e){return n.render.styleguide(e,h(h({},r),{children:t}))}),u)},U:function(t){var e=In("u");return s.default.createElement(e,h({},t))},View:On,Player:function(t){var e=t.attributes,n=e.width,o=e.height,a=e.src,i=g(e,["width","height","src"]);return s.default.createElement(d.default,h({},i,{controls:!0,url:a,width:n||Cn,height:o||An,onError:r.logError}))},CheckList:function(t){var e=t.attributes,r=e.children,n=g(e,["children"]);return s.default.createElement("div",h({},n),r)},CheckListGroup:function(t){var n=t.attributes,o=n.children,a=n.title,i=n.style,u=n.className,c=n.onClick,l=t.api,d=l.childrenStateInstances,f=l.trackingIdentifiers,p=l.node.data,v=mn(),g=r.getCheckListStateProviders(d||[]),m=g.length,y=e.useState(r.getInitialItems(g)),_=y[0],b=y[1];e.useEffect((function(){var t=g.map((function(t,e){return t.subscribe((function(t){b((function(r){var n;return h(h({},r),((n={})[t.id]={position:e,status:t.state},n))}))}))}));return function(){t.map((function(t){return t()}))}}),g);var E=r.calculateGroupCompletion(_,m).percComplete;e.useEffect((function(){var t,e;100===E&&v.track(r.EVENT_NAMES.CHECKLIST_GROUP_COMPLETE,h({title:a,groupId:null===(e=null===(t=p)||void 0===t?void 0:t.custom)||void 0===e?void 0:e.groupId},f))}),[E]);var T=r.getFirstNotStartedItem(_,m),S=r.toCssSelector("typography",{variant:{variant:"H4"},output:"html"});return s.default.createElement("div",{className:u,onClick:c,style:h(h({},jn),i)},s.default.createElement("h4",{className:S},a),s.default.createElement("div",{style:Ln},s.default.createElement("div",{style:h(h({},Pn),{width:E+"%"})})),!!o&&s.default.Children.map(o,(function(t,e){return s.default.cloneElement(t,{expandByDefault:e===T})})))},CheckListItem:function(t){var n=t.attributes,o=n.title,a=n.style,i=n.children,u=g(n,["title","style","children"]),c=t.api,l=c.stateInstances,d=c.trackingIdentifiers,f=t.expandByDefault,p=mn(),v=e.useState(r.CheckListItemStatus.NotStared),m=v[0],y=v[1],_=e.useState(!!f),b=_[0],E=_[1];if(!l)throw new Error("no state provided");var T=function(t){var e=t.find((function(t){return t.resolver instanceof r.CheckListResolverInstance}));if(!e)throw new Error("Couldn't find CheckListApi state provider");return e}(l);e.useEffect((function(){return T.subscribe((function(t){y(t.state)}))}),[T]),e.useEffect((function(){i&&E(!!f)}),[f]);var S=h(h({},Nn),{borderBottom:i&&b?"1px solid var(--color-lines)":"none"}),I={flexGrow:1,fontWeight:600,cursor:i?"pointer":"auto"},O=r.toCssSelector("typography",{variant:{variant:"P"},output:"html"}),C=function(t){E(!b),t.stopPropagation()};return s.default.createElement("div",h({style:h(h({},Rn),a)},u),s.default.createElement("div",{style:S,onClick:i&&C},s.default.createElement(Un,{onChangeStatus:function(){var t=function(t){return Gn[(Gn.indexOf(t)+1)%Gn.length]}(m);T.mutate({state:t}),p.track(r.EVENT_NAMES.CHECKLIST_ITEM_STATE_UPDATED,h({itemId:T.providerId,state:t,title:o},d))},status:m}),s.default.createElement("div",{className:O,style:I},o),i&&s.default.createElement("button",{type:"button",onClick:C,style:Dn},s.default.createElement(Fn,{direction:b?"up":"down"}))),i&&s.default.createElement(Hn,{expanded:b},i))}},Vn=pr((function(t,e){return pn(r.mergeStyleguidesFromContext(t,e))})),zn=function(){try{var t=localStorage.getItem("candu.portals");return t?JSON.parse(t):{}}catch(t){return{}}},Yn=Pr({name:"portal",initialValue:Lr(zn(),Ur),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{portalAsset:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return h(h({},e),((r={})[i]=h(h({},Ur()),{loading:!0}),r));case"success":return function(t,e){zn()[t]=e,localStorage.setItem("candu.portals",JSON.stringify(e))}(i,u),h(h({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return h(h({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});function Wn(t,e){var n=t.slug;l.default(r.isIdentifier(n),"(Portal) You must supply a valid slug");var o=e.getFluxState(Gr).clientToken,a=e.select(Yr.selectors.segmentIds);if(a){e.registerFlux(Yn);var i=e.select(Yn.selectors.portalAsset(n)),u=e.select(Yn.selectors.isLoadingOrHasErrors(n));if(!i&&!u){var c=performance.now(),s=function(t,e,r){return m(void 0,void 0,void 0,(function(){var n;return y(this,(function(o){return n="?segmentIds="+(r||[]).join(","),[2,fetch("https://cdn.candu.ai/portalMemberships/"+t+"/"+e+"/head.json"+n)]}))}))}(o,n,a);s&&(e.dispatch(Yn.actions.loading(n)),s.then((function(t){return e.dispatch(Yn.actions.success({slug:n,result:t,loadTime:performance.now()-c}))})).catch((function(t){return e.dispatch(Yn.actions.error({slug:n,error:t,loadTime:performance.now()-c}))})),e.registerFlux(Yn))}}}var Kn,Jn,qn=function(t){var e=t.tutorialDocument;return e?s.default.createElement(Zo,{tutorialDocument:e}):null},$n=function(t,e){return{tutorialDocument:Yn.selectors.portalAsset(e.slug)}},Zn=function(t){Wn(t,Qr());var e=tn($n)(qn);return s.default.createElement(e,h({},t))},Qn=function(t){return"candu.sdk."+t},Xn=function(t){return Qn("error."+t)},to="unknown_node_type",eo="unkown_inline_node_type",ro="unkown_node_object_type",no="tutorial_error_boundary",oo="portal_error_boundary",ao="provider_error_boundary",io={HEARTBEAT:Qn("heartbeat"),PREVIEW_OPEN:Qn("preview.open"),PORTAL:Qn("portal"),TUTORIAL:Qn("tutorial"),TUTORIAL_INTERACTION:Qn("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Xn("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Xn("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Xn("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Xn("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Xn("commit_api"),TUTORIAL_LOADING_ERROR:Xn("tutorial"),UNKOWN_NODE_TYPE:Xn(to),UNKOWN_INLINE_NODE_TYPE:Xn(eo),UNKOWN_NODE_OBJECT_TYPE:Xn(ro),TUTORIAL_ERROR:Xn(no),PORTAL_ERROR:Xn(oo),PROVIDER_ERROR:Xn(ao),STYLEGUIDE_MAP_ERROR:Xn(no),RENDER_NODE_ERROR:Xn(no),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Xn("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Xn("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Xn("state_fetch_failed"),STATE_UPDATE_FAILED:Xn("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Xn("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:Qn("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:Qn("tutorial.checklist_group_complete"),CARD_DISMISSED:Qn("tutorial.card_dismissed")},uo=function(t){return"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+"."},co=((Kn={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"})[io.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",Kn[io.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",Kn[io.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",Kn[io.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",Kn[io.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",Kn[io.UNKOWN_INLINE_NODE_TYPE]=uo(eo),Kn[io.UNKOWN_NODE_TYPE]=uo(to),Kn[io.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Kn[io.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Kn[io.PORTAL_ERROR]="An error has occured within Portal",Kn[io.PROVIDER_ERROR]="An error has occured within Provider",Kn[io.TUTORIAL_ERROR]="An error has occured within Tutorial",Kn[io.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",Kn[io.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",Kn[io.STATE_FETCH_FAILED]="An error has occured while fetching state:",Kn[io.STATE_UPDATE_FAILED]="An error has occured while updating state:",Kn[io.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",Kn),so=function(t){switch(t.trigger){case r.TRIGGERS.ON_CLICK:default:return"onClick"}},lo=function(t,e,n){var o,a,i;switch(t.handler.type){case r.HANDLER_TYPES.NAVIGATE:return(o={})[so(t)]=function(r){r.stopPropagation();var o=t.handler,a=o.href,i=o.target,u=n||{},c=u.parentTrackers,s=g(u,["parentTrackers"]);c&&c.forEach((function(r){return e(t,r)})),e(t,s),"Blank"===i?window.open(a,"_blank"):a&&a.includes("mailto:")?window.location=a:document.location.href=a},o;case r.HANDLER_TYPES.CHANGE_TUTORIAL:return(a={})[so(t)]=function(){var e=t.handler.tutorialId;r.logger.error("TODO -> change tutorial",e)},a;case r.HANDLER_TYPES.OPEN_GUIDE:return(i={})[so(t)]=function(){var e=t.handler.guideId;r.logger.error("TODO -> open guide",e)},i;default:return{}}},fo=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},po=function(t,e){var r=t.states;return Object.keys(r||{}).map((function(t){return e.select(en.selectors.provider(t))}))},vo=function(t,e,r){var n=t.nodes;return n&&n.map((function(t){return e.nodes[t]})).filter((function(t){return!!t})).map((function(t){return po(t,r)||[]})).reduce((function(t,e){return t.concat(e)}),[])},ho=function(t,e,n){var o=e.getFluxState(Hr);try{var a=n.document,i=a.nodes[t];if(!i)return r.logger.error("Document is corrupted. Refusing to move further."),null;var u=function(t){return ho(t,e,n)},c=i.type,s=i.props,l=i.css,d=h(h(h({},s||{}),{style:l||{},children:fo(i,u)}),function(t,e,n){var o,a,i,u,c,s,l=e.getFluxState(Hr);if("Link"===t.type&&(null===(o=t.props)||void 0===o?void 0:o.href)){var d=t.props.href+" Link Clicked",f=null===(i=null===(a=t)||void 0===a?void 0:a.nodes)||void 0===i?void 0:i[0];if(f){var p=n.nodes[f];"Text"===(null===(u=p)||void 0===u?void 0:u.type)&&(null===(s=null===(c=p)||void 0===c?void 0:c.props)||void 0===s?void 0:s.children)&&(d=p.props.children+" Link Clicked")}return{onClick:function(){var e;return l.track(io.TUTORIAL_INTERACTION,{trigger:r.TRIGGERS.ON_CLICK,category:t.type,eventName:d,handler:{href:null===(e=t.props)||void 0===e?void 0:e.href,type:r.HANDLER_TYPES.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var v=function(t,e){l.track(io.TUTORIAL_INTERACTION,h(h({},t),e||{}))};return t.data.actions.map((function(t){return lo(t,v,{})})).reduce((function(t,e){return h(h({},t),e)}),{})}(i,e,a)),f={nodeId:t,node:i,document:a,render:{node:u,styleguide:function(t,e){return void 0===e&&(e={}),n.renderNode(t,{api:f,attributes:e})},tutorial:function(t){return n.renderTutorial(t)},portal:function(t){return n.renderPortal(t)}},trackingIdentifiers:{},stateInstances:po(i,e),childrenStateInstances:vo(i,a,e)},p=f.render.styleguide(c,d);return p||(r.logger.error(co[io.UNKOWN_NODE_TYPE],{type:c}),o.error(new Error(co[io.UNKOWN_NODE_TYPE]),{type:c}),null)}catch(t){return r.logger.error(co[io.STYLEGUIDE_MAP_ERROR],t),o.error(t),null}},go=function(t,e){var r,n,o,a,i="string"==typeof e&&e.split(" ");return i?1===i.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===i.length?((n={})[t+"Top"]=i[0],n[t+"Right"]=i[1],n[t+"Bottom"]=i[0],n[t+"Left"]=i[1],n):3===i.length?((o={})[t+"Top"]=i[0],o[t+"Right"]=i[1],o[t+"Bottom"]=i[2],o[t+"Left"]=i[1],o):((a={})[t+"Top"]=i[0],a[t+"Right"]=i[1],a[t+"Bottom"]=i[2],a[t+"Left"]=i[3],a):{}},mo=function(t){var e=t.padding,r=t.margin,n=g(t,["padding","margin"]),o={};return e&&(o=h(h({},o),go("padding",e))),r&&(o=h(h({},o),go("margin",r))),h(h({},o),n)},yo=function(t){return"candu.sdk."+t},_o=function(t){return yo("error."+t)},bo=(yo("preview.open"),yo("portal"),yo("tutorial"),_o("portal_asset_not_found")),Eo=_o("portal_no_segment_ids"),To=_o("no_matching_tutorials"),So=_o("circular_dependecy_embed_portal"),Io=_o("circular_dependecy_embed_tutorial"),Oo=((Jn={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"})[bo]="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",Jn[Eo]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",Jn[To]="The Tutorial will not be rendered because there are no matching segments for the given user.",Jn[So]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Jn[Io]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Jn);var Co=function(t,e){return function(r,n){if(null==r)return r;if(!Ct(r))return t(r,n);for(var o=r.length,a=e?o:-1,i=Object(r);(e?a--:++a<o)&&!1!==n(i[a],a,i););return r}}(wt);var Ao=function(t,e){var r=-1,n=Ct(t)?Array(t.length):[];return Co(t,(function(t,o,a){n[++r]=e(t,o,a)})),n};var wo=function(t,e){return(ut(t)?mr:Ao)(t,jr(e))},Ro=function(){function t(t,e,n){var o=this;this.observer=new r.Observer,this.rootStore=t,this.providerId=e,this.resolver=n,this.eventing=t.getFluxState(Hr),this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return o.updateState(t)})).catch((function(t){r.logger.error(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_FETCH_FAILED],t.message),o.eventing.track(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,n=this.state;this.updateState(h(h({},n),t)),this.resolver.update(this.rootStore,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){r.logger.error(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_UPDATE_FAILED],t.message),e.eventing.track(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&e.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),No=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),ko=Object.create(null),xo=function(){function t(t){this.cache=new No,this.options=h({},t||{})}return t.register=function(t,e){ko[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=g(t,["type"]),n=ko[e];return n?new n(r):null},t.prototype.toJSON=function(){return h({type:this.type},this.options)},t}();var Do=function(t,e,r,n){for(var o=t.length,a=r+(n?1:-1);n?a--:++a<o;)if(e(t[a],a,t))return a;return-1};var jo=function(t){return t!=t};var Lo=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var Po=function(t,e,r){return e==e?Lo(t,e,r):Do(t,jo,r)};var Fo=function(t,e){return!!(null==t?0:t.length)&&Po(t,e,0)>-1};var Mo=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var Uo=function(){},Go=Fe&&1/Ee(new Fe([,-0]))[1]==1/0?function(t){return new Fe(t)}:Uo;var Ho=function(t,e,r){var n=-1,o=Fo,a=t.length,i=!0,u=[],c=u;if(r)i=!1,o=Mo;else if(a>=200){var s=e?null:Go(t);if(s)return Ee(s);i=!1,o=me,c=new he}else c=e?[]:u;t:for(;++n<a;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,i&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,r)||(c!==u&&c.push(d),u.push(l))}return u};var Bo=function(t){return t&&t.length?Ho(t):[]},Vo=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new f.default(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),zo=Wr+qr,Yo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return v(e,t),e.prototype.retrieve=function(t,e){return m(this,void 0,void 0,(function(){var r,n,o,a,i=this;return y(this,(function(u){switch(u.label){case 0:return r=t.getFluxState(Gr).clientToken,n=t.getFluxState(Br).userId,[4,Vo.get("cardStateApi",(function(t){return m(i,void 0,void 0,(function(){var e;return y(this,(function(o){switch(o.label){case 0:return[4,fetch(zo+"?token="+r+"&finder=byIds&ids="+Bo(t).join(",")+"&userId="+n).then((function(t){return t.json()}))];case 1:return e=o.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return o=u.sent(),a={id:e,state:{dismissed:!1}},[2,o||a]}}))}))},e.prototype.update=function(t,e,r){var n=t.getFluxState(Gr).clientToken,o=t.getFluxState(Br).userId;return fetch(zo+"/"+e+"?token="+n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:o.toString()})}).then((function(t){return t.json()}))},e}(xo);xo.register(r.StateResolverType.CardApi,Yo);var Wo=Wr+Jr;function Ko(t){return{state:t.state,id:t.id}}function Jo(t){switch(t){case r.CheckListScope.Account:return"AccountId";case r.CheckListScope.User:default:return"UserId"}}var qo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return v(e,t),e.prototype.getScopeAndFieldsFromRootState=function(t){var e=t.getFluxState(Br),n=e.userId,o=e.traits,a=this.options.scopeTrait,i=this.options.scope||r.CheckListScope.User,u=n.toString();return i===r.CheckListScope.Account&&(a&&o[a]?u=o[a]:(r.logger.warning("trait '"+a+"' is not defined, falling back to user scope"),i=r.CheckListScope.User)),{scope:i,scopeField:u}},e.prototype.retrieve=function(t,e){return m(this,void 0,void 0,(function(){var n,o,a,i,u=this;return y(this,(function(c){switch(c.label){case 0:return n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(Gr).clientToken,[4,Vo.get("checklistState",(function(t){return m(u,void 0,void 0,(function(){var e;return y(this,(function(r){switch(r.label){case 0:return[4,fetch(Wo+"?token="+i+"&byTrait="+Jo(o)+"&field="+a+"&finder=byIds&ids="+Bo(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(Ko)}))];case 1:return e=r.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,c.sent()||{id:e,state:r.CheckListItemStatus.NotStared}]}}))}))},e.prototype.update=function(t,e,r){var n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(Gr).clientToken;return fetch(Wo+"/"+e+"?token="+i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(h(h({},r),{byTrait:Jo(o),field:a}))}).then((function(t){return t.json()})).then(Ko)},e}(xo);function $o(t,e){var n=t.document,o=n.stateProviders,a=n.head,i=e.getFluxState(Gr).clientToken;a&&r.fetchHead(a,i),o&&function(t,e){var r;e.registerFlux(en);var n=wo(t,(function(t,r){if(e.select(en.selectors.provider(r)))return null;var n=xo.fromJSON(t.resolver);return n?new Ro(e,r,n):null})).filter((function(t){return!!t}));e.dispatch((r=en.actions).set.apply(r,n))}(o,e)}xo.register(r.StateResolverType.CheckListApi,qo);var Zo=tn((function(){return{clientToken:Gr.selectors.clientToken,eventing:Hr.selectors.state}}))((function(t){var e,n=t.tutorialDocument,o=t.clientToken,a=t.eventing,i=(e=Qr().select(Gr.selectors.styleguide),Vn({provider:e},Bn)).getComponent,u=Qr();if(!n.document)return null;$o(n,u);var c=n.document,l=c.rootNodeId,d=c.head,f=c.nodes,p={rootNodeId:l,nodes:r.adaptCustomNodes(f)};return d&&r.fetchHead(d,o),ho(n.document.rootNodeId,u,{document:p,renderTutorial:function(t){return s.default.createElement(ta,h({},t))},renderPortal:function(t){return s.default.createElement(Zn,h({},t))},renderNode:function(t,e){try{var n=i(t);return n?s.default.createElement(n,{key:e.api.nodeId,api:e.api,attributes:h(h({},e.attributes),{style:e.attributes.style&&mo(e.attributes.style)})}):null}catch(t){return r.logger.error(Oo[r.EVENT_NAMES.RENDER_NODE_ERROR],t),a.error(t),null}}})})),Qo=function(t){var e=t.tutorialDocument;return e?s.default.createElement(Zo,{tutorialDocument:e}):null},Xo=function(t,e){return{tutorialDocument:nn.selectors.tutorialDocument(e.slug)}},ta=function(t){!function(t,e){var n=r.tutorialValidation(t),o=e.getFluxState(Hr),a=e.getFluxState(Gr).clientToken;e.registerFlux(nn);var i=n.slug,u=e.select(nn.selectors.tutorialDocument(i));if(!e.select(nn.selectors.isLoadingOrHasErrors(i))&&!u){var c=performance.now(),s=r.RESOURCES.tutorialDocument(n,a,o);s&&(e.dispatch(nn.actions.loading(i)),s.then((function(t){return e.dispatch(nn.actions.success({slug:i,result:t,loadTime:performance.now()-c}))})).catch((function(t){return e.dispatch(nn.actions.error({slug:i,error:t,loadTime:performance.now()-c}))})))}}(t,Qr());var e=tn(Xo)(Qo);return s.default.createElement(e,h({},t))};t.CanduProvider=Xr,t.Portal=Zn,t.ProviderContext=Zr,t.Tutorial=ta,t.useRootStore=Qr,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("@candulabs/core"),require("@candulabs/eventing"),require("invariant"),require("react-player"),require("setimmediate"),require("dataloader")):"function"==typeof define&&define.amd?define(["exports","react","@candulabs/core","@candulabs/eventing","invariant","react-player","setimmediate","dataloader"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@candulabs/harbour"]={},t.React,t.core,t.eventing,t.invariant,t.ReactPlayer,null,t.DataLoader)}(this,(function(t,e,r,n,o,a,i,u){"use strict";function c(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=c(e),l=c(o),d=c(a),f=c(u),p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function v(t,e){function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var h=function(){return(h=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function g(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function m(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{c(n.next(t))}catch(t){a(t)}}function u(t){try{c(n.throw(t))}catch(t){a(t)}}function c(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(i,u)}c((n=n.apply(t,e||[])).next())}))}function y(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var _=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(t){var e={exports:{}};return t(e,e.exports),e.exports}var T="object"==typeof b&&b&&b.Object===Object&&b,S="object"==typeof self&&self&&self.Object===Object&&self,I=T||S||Function("return this")(),O=I.Symbol,C=Object.prototype,A=C.hasOwnProperty,w=C.toString,R=O?O.toStringTag:void 0;var N=function(t){var e=A.call(t,R),r=t[R];try{t[R]=void 0;var n=!0}catch(t){}var o=w.call(t);return n&&(e?t[R]=r:delete t[R]),o},k=Object.prototype.toString;var x=function(t){return k.call(t)},D=O?O.toStringTag:void 0;var j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":D&&D in Object(t)?N(t):x(t)};var L,P=function(t){if(!_(t))return!1;var e=j(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},F=I["__core-js_shared__"],M=(L=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+L:"";var U=function(t){return!!M&&M in t},G=Function.prototype.toString;var H=function(t){if(null!=t){try{return G.call(t)}catch(t){}try{return t+""}catch(t){}}return""},B=/^\[object .+?Constructor\]$/,V=Function.prototype,z=Object.prototype,Y=V.toString,W=z.hasOwnProperty,K=RegExp("^"+Y.call(W).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var J=function(t){return!(!_(t)||U(t))&&(P(t)?K:B).test(H(t))};var q=function(t,e){return null==t?void 0:t[e]};var $=function(t,e){var r=q(t,e);return J(r)?r:void 0},Z=function(){try{var t=$(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Q=function(t,e,r){"__proto__"==e&&Z?Z(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var X=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 tt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var et=function(t){return null!=t&&"object"==typeof t};var rt=function(t){return et(t)&&"[object Arguments]"==j(t)},nt=Object.prototype,ot=nt.hasOwnProperty,at=nt.propertyIsEnumerable,it=rt(function(){return arguments}())?rt:function(t){return et(t)&&ot.call(t,"callee")&&!at.call(t,"callee")},ut=Array.isArray;var ct=function(){return!1},st=E((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)||ct;t.exports=a})),lt=/^(?:0|[1-9]\d*)$/;var dt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&lt.test(t))&&t>-1&&t%1==0&&t<e};var ft=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},pt={};pt["[object Float32Array]"]=pt["[object Float64Array]"]=pt["[object Int8Array]"]=pt["[object Int16Array]"]=pt["[object Int32Array]"]=pt["[object Uint8Array]"]=pt["[object Uint8ClampedArray]"]=pt["[object Uint16Array]"]=pt["[object Uint32Array]"]=!0,pt["[object Arguments]"]=pt["[object Array]"]=pt["[object ArrayBuffer]"]=pt["[object Boolean]"]=pt["[object DataView]"]=pt["[object Date]"]=pt["[object Error]"]=pt["[object Function]"]=pt["[object Map]"]=pt["[object Number]"]=pt["[object Object]"]=pt["[object RegExp]"]=pt["[object Set]"]=pt["[object String]"]=pt["[object WeakMap]"]=!1;var vt=function(t){return et(t)&&ft(t.length)&&!!pt[j(t)]};var ht=function(t){return function(e){return t(e)}},gt=E((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&T.process,a=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a})),mt=gt&&gt.isTypedArray,yt=mt?ht(mt):vt,_t=Object.prototype.hasOwnProperty;var bt=function(t,e){var r=ut(t),n=!r&&it(t),o=!r&&!n&&st(t),a=!r&&!n&&!o&&yt(t),i=r||n||o||a,u=i?tt(t.length,String):[],c=u.length;for(var s in t)!e&&!_t.call(t,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||dt(s,c))||u.push(s);return u},Et=Object.prototype;var Tt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Et)};var St=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),It=Object.prototype.hasOwnProperty;var Ot=function(t){if(!Tt(t))return St(t);var e=[];for(var r in Object(t))It.call(t,r)&&"constructor"!=r&&e.push(r);return e};var Ct=function(t){return null!=t&&ft(t.length)&&!P(t)};var At=function(t){return Ct(t)?bt(t):Ot(t)};var wt=function(t,e){return t&&X(t,e,At)};var Rt=function(){this.__data__=[],this.size=0};var Nt=function(t,e){return t===e||t!=t&&e!=e};var kt=function(t,e){for(var r=t.length;r--;)if(Nt(t[r][0],e))return r;return-1},xt=Array.prototype.splice;var Dt=function(t){var e=this.__data__,r=kt(e,t);return!(r<0)&&(r==e.length-1?e.pop():xt.call(e,r,1),--this.size,!0)};var jt=function(t){var e=this.__data__,r=kt(e,t);return r<0?void 0:e[r][1]};var Lt=function(t){return kt(this.__data__,t)>-1};var Pt=function(t,e){var r=this.__data__,n=kt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Ft(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])}}Ft.prototype.clear=Rt,Ft.prototype.delete=Dt,Ft.prototype.get=jt,Ft.prototype.has=Lt,Ft.prototype.set=Pt;var Mt=Ft;var Ut=function(){this.__data__=new Mt,this.size=0};var Gt=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ht=function(t){return this.__data__.get(t)};var Bt=function(t){return this.__data__.has(t)},Vt=$(I,"Map"),zt=$(Object,"create");var Yt=function(){this.__data__=zt?zt(null):{},this.size=0};var Wt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Kt=Object.prototype.hasOwnProperty;var Jt=function(t){var e=this.__data__;if(zt){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Kt.call(e,t)?e[t]:void 0},qt=Object.prototype.hasOwnProperty;var $t=function(t){var e=this.__data__;return zt?void 0!==e[t]:qt.call(e,t)};var Zt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=zt&&void 0===e?"__lodash_hash_undefined__":e,this};function Qt(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])}}Qt.prototype.clear=Yt,Qt.prototype.delete=Wt,Qt.prototype.get=Jt,Qt.prototype.has=$t,Qt.prototype.set=Zt;var Xt=Qt;var te=function(){this.size=0,this.__data__={hash:new Xt,map:new(Vt||Mt),string:new Xt}};var ee=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var re=function(t,e){var r=t.__data__;return ee(e)?r["string"==typeof e?"string":"hash"]:r.map};var ne=function(t){var e=re(this,t).delete(t);return this.size-=e?1:0,e};var oe=function(t){return re(this,t).get(t)};var ae=function(t){return re(this,t).has(t)};var ie=function(t,e){var r=re(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ue(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])}}ue.prototype.clear=te,ue.prototype.delete=ne,ue.prototype.get=oe,ue.prototype.has=ae,ue.prototype.set=ie;var ce=ue;var se=function(t,e){var r=this.__data__;if(r instanceof Mt){var n=r.__data__;if(!Vt||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ce(n)}return r.set(t,e),this.size=r.size,this};function le(t){var e=this.__data__=new Mt(t);this.size=e.size}le.prototype.clear=Ut,le.prototype.delete=Gt,le.prototype.get=Ht,le.prototype.has=Bt,le.prototype.set=se;var de=le;var fe=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var pe=function(t){return this.__data__.has(t)};function ve(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new ce;++e<r;)this.add(t[e])}ve.prototype.add=ve.prototype.push=fe,ve.prototype.has=pe;var he=ve;var ge=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 me=function(t,e){return t.has(e)};var ye=function(t,e,r,n,o,a){var i=1&r,u=t.length,c=e.length;if(u!=c&&!(i&&c>u))return!1;var s=a.get(t),l=a.get(e);if(s&&l)return s==e&&l==t;var d=-1,f=!0,p=2&r?new he:void 0;for(a.set(t,e),a.set(e,t);++d<u;){var v=t[d],h=e[d];if(n)var g=i?n(h,v,d,e,t,a):n(v,h,d,t,e,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!ge(e,(function(t,e){if(!me(p,e)&&(v===t||o(v,t,r,n,a)))return p.push(e)}))){f=!1;break}}else if(v!==h&&!o(v,h,r,n,a)){f=!1;break}}return a.delete(t),a.delete(e),f},_e=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},Te=O?O.prototype:void 0,Se=Te?Te.valueOf:void 0;var Ie=function(t,e,r,n,o,a,i){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!a(new _e(t),new _e(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Nt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=be;case"[object Set]":var c=1&n;if(u||(u=Ee),t.size!=e.size&&!c)return!1;var s=i.get(t);if(s)return s==e;n|=2,i.set(t,e);var l=ye(u(t),u(e),n,o,a,i);return i.delete(t),l;case"[object Symbol]":if(Se)return Se.call(t)==Se.call(e)}return!1};var Oe=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Ce=function(t,e,r){var n=e(t);return ut(t)?n:Oe(n,r(t))};var Ae=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 we=function(){return[]},Re=Object.prototype.propertyIsEnumerable,Ne=Object.getOwnPropertySymbols,ke=Ne?function(t){return null==t?[]:(t=Object(t),Ae(Ne(t),(function(e){return Re.call(t,e)})))}:we;var xe=function(t){return Ce(t,At,ke)},De=Object.prototype.hasOwnProperty;var je=function(t,e,r,n,o,a){var i=1&r,u=xe(t),c=u.length;if(c!=xe(e).length&&!i)return!1;for(var s=c;s--;){var l=u[s];if(!(i?l in e:De.call(e,l)))return!1}var d=a.get(t),f=a.get(e);if(d&&f)return d==e&&f==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=i;++s<c;){var h=t[l=u[s]],g=e[l];if(n)var m=i?n(g,h,l,e,t,a):n(h,g,l,t,e,a);if(!(void 0===m?h===g||o(h,g,r,n,a):m)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var y=t.constructor,_=e.constructor;y==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(p=!1)}return a.delete(t),a.delete(e),p},Le=$(I,"DataView"),Pe=$(I,"Promise"),Fe=$(I,"Set"),Me=$(I,"WeakMap"),Ue="[object Map]",Ge="[object Promise]",He="[object Set]",Be="[object WeakMap]",Ve="[object DataView]",ze=H(Le),Ye=H(Vt),We=H(Pe),Ke=H(Fe),Je=H(Me),qe=j;(Le&&qe(new Le(new ArrayBuffer(1)))!=Ve||Vt&&qe(new Vt)!=Ue||Pe&&qe(Pe.resolve())!=Ge||Fe&&qe(new Fe)!=He||Me&&qe(new Me)!=Be)&&(qe=function(t){var e=j(t),r="[object Object]"==e?t.constructor:void 0,n=r?H(r):"";if(n)switch(n){case ze:return Ve;case Ye:return Ue;case We:return Ge;case Ke:return He;case Je:return Be}return e});var $e=qe,Ze="[object Arguments]",Qe="[object Array]",Xe="[object Object]",tr=Object.prototype.hasOwnProperty;var er=function(t,e,r,n,o,a){var i=ut(t),u=ut(e),c=i?Qe:$e(t),s=u?Qe:$e(e),l=(c=c==Ze?Xe:c)==Xe,d=(s=s==Ze?Xe:s)==Xe,f=c==s;if(f&&st(t)){if(!st(e))return!1;i=!0,l=!1}if(f&&!l)return a||(a=new de),i||yt(t)?ye(t,e,r,n,o,a):Ie(t,e,c,r,n,o,a);if(!(1&r)){var p=l&&tr.call(t,"__wrapped__"),v=d&&tr.call(e,"__wrapped__");if(p||v){var h=p?t.value():t,g=v?e.value():e;return a||(a=new de),o(h,g,r,n,a)}}return!!f&&(a||(a=new de),je(t,e,r,n,o,a))};var rr=function t(e,r,n,o,a){return e===r||(null==e||null==r||!et(e)&&!et(r)?e!=e&&r!=r:er(e,r,n,o,t,a))};var nr=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 de;if(n)var f=n(s,l,c,t,e,d);if(!(void 0===f?rr(l,s,3,n,d):f))return!1}}return!0};var or=function(t){return t==t&&!_(t)};var ar=function(t){for(var e=At(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,or(o)]}return e};var ir=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var ur=function(t){var e=ar(t);return 1==e.length&&e[0][2]?ir(e[0][0],e[0][1]):function(r){return r===t||nr(r,t,e)}};var cr=function(t){return"symbol"==typeof t||et(t)&&"[object Symbol]"==j(t)},sr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lr=/^\w*$/;var dr=function(t,e){if(ut(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!cr(t))||(lr.test(t)||!sr.test(t)||null!=e&&t in Object(e))};function fr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");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(fr.Cache||ce),r}fr.Cache=ce;var pr=fr;var vr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hr=/\\(\\)?/g,gr=function(t){var e=pr(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(vr,(function(t,r,n,o){e.push(n?o.replace(hr,"$1"):r||t)})),e}));var mr=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},yr=O?O.prototype:void 0,_r=yr?yr.toString:void 0;var br=function t(e){if("string"==typeof e)return e;if(ut(e))return mr(e,t)+"";if(cr(e))return _r?_r.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var Er=function(t){return null==t?"":br(t)};var Tr=function(t,e){return ut(t)?t:dr(t,e)?[t]:gr(Er(t))};var Sr=function(t){if("string"==typeof t||cr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Ir=function(t,e){for(var r=0,n=(e=Tr(e,t)).length;null!=t&&r<n;)t=t[Sr(e[r++])];return r&&r==n?t:void 0};var Or=function(t,e,r){var n=null==t?void 0:Ir(t,e);return void 0===n?r:n};var Cr=function(t,e){return null!=t&&e in Object(t)};var Ar=function(t,e,r){for(var n=-1,o=(e=Tr(e,t)).length,a=!1;++n<o;){var i=Sr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&ft(o)&&dt(i,o)&&(ut(t)||it(t))};var wr=function(t,e){return null!=t&&Ar(t,e,Cr)};var Rr=function(t,e){return dr(t)&&or(e)?ir(Sr(t),e):function(r){var n=Or(r,t);return void 0===n&&n===e?wr(r,t):rr(e,n,3)}};var Nr=function(t){return t};var kr=function(t){return function(e){return null==e?void 0:e[t]}};var xr=function(t){return function(e){return Ir(e,t)}};var Dr=function(t){return dr(t)?kr(Sr(t)):xr(t)};var jr=function(t){return"function"==typeof t?t:null==t?Nr:"object"==typeof t?ut(t)?Rr(t[0],t[1]):ur(t):Dr(t)};var Lr=function(t,e){var r={};return e=jr(e),wt(t,(function(t,n,o){Q(r,n,e(t,n,o))})),r};function Pr(t){var e=t.name,r=t.actions,n=t.selectors,o=g(t,["name","actions","selectors"]);return h(h({},o),{actions:Lr(r||{},(function(t,r){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return h({type:r,storeName:e},t.apply(void 0,n))}})),selectors:Lr(n||{},(function(t){function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return{storeName:e,selector:t.apply(void 0,r)}}return r.storeName=e,r.selector=t,r})),name:e})}function Fr(t){var e=t.name,r=t.initialValue,n=t.reducer,o=r,a=[];return{name:e,getState:function(){return o},subscribe:function(t){return a.push(t),function(){a=a.filter((function(e){return e!==t}))}},dispatch:function(t){var e=o;return"object"==typeof e&&null!==e?e=h({},o):Array.isArray(e)&&(e=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var a=arguments[e],i=0,u=a.length;i<u;i++,o++)n[o]=a[i];return n}(o)),o=n(t,o),a.forEach((function(r){return r(o,e,t)})),this}}}function Mr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.fromEntries(t.map((function(t){return[t.name,t]})));return{name:"root",getFluxState:function(t){var e=this.getStore(t);if(!e)throw new Error("rootState.getFluxState: the flux store "+t.name+" does not exist");return e.getState()},getState:function(){return Lr(r,(function(t){return t.getState()}))},getStore:function(t){var e="string"==typeof t?t:t.name;return r[e]},registerFlux:function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter((function(t){var e=t.name;return!r[e]})).forEach((function(e){return t.register(Fr(e))})),this},register:function(t){return r[t.name]=t,this},dispatch:function(t){t.storeName?r[t.storeName].dispatch(t):Object.values(r).forEach((function(e){return e.dispatch(t)}))},remove:function(t){return delete r[t.name],this},select:function(t){var e;return t.selector(null===(e=r[t.storeName])||void 0===e?void 0:e.getState())}}}var Ur=function(t){return{loading:!1,result:t,error:void 0,loadTime:0}},Gr=Pr({name:"config",initialValue:{clientToken:"",options:{},styleguide:{}},actions:{set:function(t){return{payload:t}}},selectors:{styleguide:function(t){return t.styleguide},clientToken:function(t){return t.clientToken}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e}}),Hr=Pr({name:"eventing",initialValue:n.noOpEventing,actions:{set:function(t){return{eventing:t}}},selectors:{state:function(t){return t}},reducer:function(t,e){var r=t.type,n=t.eventing;return"set"===r?n:e}}),Br=Pr({name:"user",initialValue:{userId:n.getAnonymousId(),traits:{}},actions:{set:function(t){return{payload:t}}},reducer:function(t,e){var r=t.type,n=t.payload;return"set"===r?n:e},selectors:{userId:function(t){return t.userId}}}),Vr="candu.segmentMembership",zr=function(t){return localStorage.setItem(Vr,JSON.stringify(t))},Yr=Pr({name:"segmentMembership",initialValue:Ur(function(){try{var t=localStorage.getItem(Vr),e=t&&JSON.parse(t);if(!e)return;return{id:"",segmentIds:e}}catch(t){return}}()),actions:{loading:function(){return{}},success:function(t){return t},error:function(t){return t}},selectors:{segmentIds:function(t){var e;return null===(e=t.result)||void 0===e?void 0:e.segmentIds}},reducer:function(t,e){var r=t.type,n=t.result,o=t.loadTime,a=t.error;switch(r){case"loading":return h(h({},e),{loading:!0});case"success":return zr(n.segmentIds),h(h({},e),{loading:!1,error:void 0,result:n,loadTime:o});case"error":return{loading:!1,result:void 0,error:a,loadTime:o};default:return e}}});const Wr="https://api.candu.ai";var Kr={name:"@candulabs/harbour",version:"0.7.1-alpha.17"},Jr="/api/checklistItems",qr="/api/cards";function $r(t,e){e.registerFlux(Gr,Br,Hr,Yr);var o=function(t,e){var n=t.clientToken,o=t.userId,a=t.traits,i=t.options,u=t.styleguide,c=g(t,["clientToken","userId","traits","options","styleguide"]);l.default(r.isClientToken(n),"(Candu) you must provide a valid clientToken"),l.default(!o||r.isUserId(o),"(Candu) you must provide a valid userId"),l.default(!a||_(a),"(Candu) traits must be undefined or an object"),l.default(!i||_(i),"(Candu) options must be undefined or an object"),l.default(!u||_(u),"(Candu) styleguide must be undefined or an object");var s=e.getFluxState(Br);return h(h({},c),{clientToken:n,traits:a||s.traits||{},options:i||{},styleguide:u||{},userId:o||s.userId})}(t,e),a=o.clientToken,i=o.userId,u=o.traits,c=o.styleguide,s=o.options,d=n.eventingFactory(a,i,s,Kr);r.internalEventing(d).provider({userId:i,traits:u,styleguide:c}),e.dispatch(Br.actions.set({userId:i,traits:u})),e.dispatch(Hr.actions.set(d)),e.dispatch(Gr.actions.set({clientToken:a,options:s,styleguide:c})),r.attachStylesheet(a),function(t){var e=t.getFluxState(Gr),n=e.clientToken,o=e.options,a=t.getFluxState(Br).userId,i=t.getFluxState(Hr);if(o.skipLoading||o.overrideSegmentMemberships){var u={id:a,segmentIds:o.overrideSegmentMemberships||[]};t.dispatch(Yr.actions.success({result:u,loadTime:0}))}else{var c=performance.now();t.dispatch(Yr.actions.loading()),r.RESOURCES.segmentMembership(n,a).then((function(e){var n=performance.now()-c;i.track(r.METRICS.SEGMENT_MEMBERSHIP_LOAD_TIME,{value:n}),t.dispatch(Yr.actions.success({result:e,loadTime:n}))})).catch((function(e){return t.dispatch(Yr.actions.error({error:e,loadTime:performance.now()-c}))}))}}(e)}var Zr=s.default.createContext(Mr()),Qr=function(){return e.useContext(Zr)},Xr=function(t){function e(e){var r=t.call(this,e)||this;r.state=Mr();var n=r.props;return n.children,$r(g(n,["children"]),r.state),r}return v(e,t),e.prototype.render=function(){return s.default.createElement(Zr.Provider,{value:this.state},this.props.children)},e}(s.default.Component),tn=function(t){return function(e){var r;return(r=function(r){function n(t){var e=r.call(this,t)||this;return e.unsubscribes=[],e.handleChange=e.handleChange.bind(e),e}return v(n,r),n.prototype.componentDidMount=function(){var e=this;this.handleChange();var r=Object.values(t(this.context,this.props)).map((function(t){var r=t.storeName;return e.context.getStore(r).subscribe}));this.unsubscribes=r.map((function(t){return t(e.handleChange)}))},n.prototype.componentWillUnmount=function(){this.unsubscribes.forEach((function(t){return t()}))},n.prototype.mapStateToProps=function(){var e=this;return Lr(t(this.context,this.props),(function(t){return t.selector&&t.storeName?e.context.select(t):t}))},n.prototype.handleChange=function(){this.setState(this.mapStateToProps())},n.prototype.render=function(){return s.default.createElement(e,h({},this.state||this.mapStateToProps(),this.props))},n}(s.default.Component)).contextType=Zr,r}},en=Pr({name:"stateProviders",initialValue:{},actions:{set:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{providers:t}}},selectors:{provider:function(t){return function(e){return e[t]}}},reducer:function(t,e){var r=t.type,n=t.providers;switch(r){case"set":return h(h({},e),Object.fromEntries(n.map((function(t){return[t.providerId,t]}))));default:return e}}}),rn=function(){try{var t=localStorage.getItem("candu.tutorials");return t?JSON.parse(t):{}}catch(t){return{}}},nn=Pr({name:"tutorialDocuments",initialValue:Lr(rn(),Ur),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{tutorialDocument:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return h(h({},e),((r={})[i]=h(h({},Ur()),{loading:!0}),r));case"success":return function(t,e){var r=rn();r[t]=e,localStorage.setItem("candu.tutorials",JSON.stringify(r))}(i,u),h(h({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return h(h({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});var on,an=["div","a","p"],un={Fragment:e.Fragment,Document:e.Fragment},cn="#6310E5",sn="#59C3C3",ln="#4D515D",dn="#FCAD0D",fn="#EE4266",pn=function(t){l.default(_(t),"(createStyleguide) styleguide must be undefined or an object");return{getComponent:function(r){var n=function(e){if(t[e])return t[e];if(un[e])return un[e];var r=an.indexOf(e)||an.indexOf(e.toLowerCase());return an[r]}(r);return"string"==typeof n?function(t){var e=t.api,r=t.attributes;return s.default.createElement(n,h({key:e.nodeId},r))}:n===e.Fragment?function(t){var r=t.api,n=t.attributes;return s.default.createElement(e.Fragment,{key:r.nodeId},n.children)}:n},all:function(){return t}}},vn={borderRadius:"4px",padding:"8px"},hn=function(t){switch(t){case"success":return cn;case"active":return sn;case"warning":return dn;case"danger":return fn;default:return ln}},gn=function(){return s.default.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s.default.createElement("path",{d:"M6 6L18 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}),s.default.createElement("path",{d:"M18 6L6 18",stroke:"#D4D8E4",strokeWidth:"3",strokeLinecap:"round"}))},mn=function(){return Qr().getFluxState(Hr)},yn={borderRadius:"4px",padding:"8px",backgroundColor:"rgb(51, 55, 69)",color:"rgb(255, 255, 255)",overflow:"auto"},_n={display:"flex"},bn={flex:"1 1"},En={maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto"};!function(t){t.Ordered="OL",t.Unordered="UL"}(on||(on={}));var Tn,Sn={backgroundColor:"transparent",border:"none",borderTop:"1px solid #edeff3",height:"0"},In=function(t){return function(e){var n,o=e.attributes,a=["h1","h2","h3","h4","p"].includes(t);a&&(n={variant:t.toUpperCase()});var i=r.toCssSelector(a?"typography":t,{variant:n,output:"html"});return s.default.createElement(t,h({},o,{className:i}))}},On=function(t){var e=In("div");return s.default.createElement(e,h({},t))},Cn="640px",An="360px",wn="all .35s ease-out 0s",Rn={border:"1px solid var(--color-lines)",borderRadius:"4px",marginBottom:"16px",backgroundColor:"white",display:"flex",flexDirection:"column"},Nn={padding:"16px",display:"flex",flexDirection:"row",alignItems:"center",flexGrow:1,boxSizing:"border-box",color:"var(--color-neutral)"},kn={padding:"16px 48px",display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",transition:wn},xn={borderRadius:"20px",height:"32px",width:"32px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",marginRight:"16px",appearance:"none",outline:"none",padding:0,transition:"all .1s ease-out 0s"},Dn={appearance:"none",border:"none",outline:"none",cursor:"pointer",background:"none",padding:"0px",display:"flex"},jn={marginBottom:"48px"},Ln={width:"100%",height:"4px",marginBottom:"16px",backgroundColor:"#EDEFF3"},Pn={height:"100%",backgroundColor:"#59C3C3",transition:wn},Fn=function(t){var e=t.direction;return s.default.createElement("svg",{style:{transition:"all .35s ease-out 0s",transform:"rotateZ("+("up"===e?"180deg":"0deg")+")"},width:"18",height:"11",viewBox:"0 0 18 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s.default.createElement("path",{d:"M9 6.74488L3.09046 0.555221C2.39741 -0.170679 1.25783 -0.186906 0.545126 0.518977C-0.167576 1.22486 -0.183508 2.38555 0.509541 3.11145L7.37034 10.2975L7.37166 10.2988C8.26633 11.2347 9.73727 11.2336 10.6306 10.2965L17.4905 3.11145C18.1835 2.38555 18.1676 1.22486 17.4549 0.518977C16.7422 -0.186906 15.6026 -0.170679 14.9095 0.555221L9 6.74488Z",fill:"#D4D8E4"}))},Mn=((Tn={})[r.CheckListItemStatus.NotStared]={title:"Not Started",statusStyle:{backgroundColor:"#EDEFF3",borderColor:"#D4D8E4"},icon:{path:"M 2 6.55 L 5 6.55 L 10 6.55",stroke:"#9498A7"}},Tn[r.CheckListItemStatus.InProgress]={title:"In Progress",statusStyle:{backgroundColor:"#FE8A3A",borderColor:"white"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"white"}},Tn[r.CheckListItemStatus.Done]={title:"Completed",statusStyle:{backgroundColor:"#CFF5F5",borderColor:"#6DD8D8"},icon:{path:"M 2.2808 6.5114 L 5.1884 9.6219 L 10 4.1",stroke:"#46AEAE"}},Tn),Un=function(t){var r=t.onChangeStatus,n=t.status,o=e.useState(!1),a=o[0],i=o[1],u=h(h(h({},xn),Mn[n].statusStyle),{border:(a?"1px":"0px")+" solid "+Mn[n].statusStyle.borderColor}),c=Mn[n].title,l=Mn[n].icon;return s.default.createElement("button",{type:"button",onClick:function(t){r(),t.stopPropagation()},style:u,title:c,onMouseOver:function(){return i(!0)},onFocus:function(){return i(!0)},onMouseOut:function(){return i(!1)},onBlur:function(){return i(!1)}},s.default.createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s.default.createElement("path",{d:l.path,stroke:l.stroke,strokeWidth:"2.5",strokeLinecap:"round",style:{transition:"all .1s ease-out 0s"}})))},Gn=[r.CheckListItemStatus.NotStared,r.CheckListItemStatus.Done],Hn=function(t){var e=t.expanded,r=t.children,n=e?kn:h(h({},kn),{maxHeight:0,padding:"0px 48px"});return s.default.createElement("div",{style:n},r)},Bn={Alert:function(t){var e=t.attributes,r=e.intent,n=e.title,o=e.description;return s.default.createElement("div",h({},e,{style:h(h(h({},vn),e.style),{color:"#FFF",backgroundColor:hn(r)||"#EDEDED"})}),n,s.default.createElement("div",null,s.default.createElement("small",null,o)))},B:function(t){var e=In("b");return s.default.createElement(e,h({},t))},Badge:function(t){var e=t.attributes,n=e.color,o=e.outline,a=g(e,["color","outline"]),i=r.toCssSelector("badge",{variant:{color:n,outline:o},output:"html"});return s.default.createElement("span",h({},a,{className:i}))},Button:function(t){var e=t.attributes;return s.default.createElement("button",h({type:"button"},e,{className:r.toCssSelector("button",{variant:{color:e.color,outline:e.outline},output:"html"}),style:h({},e.style||{})}))},Card:function(t){var n=t.attributes,o=n.children,a=n.isDismissible,i=g(n,["children","isDismissible"]),u=t.api,c=mn(),l=r.toCssSelector("card",{output:"html"}),d=e.useMemo((function(){var t;return null===(t=u.stateInstances)||void 0===t?void 0:t.find((function(t){return t.resolver instanceof r.CardResolverInstance}))}),[]),f=e.useState({dismissed:!1}),p=f[0],v=f[1];return e.useLayoutEffect((function(){if(d)return d.subscribe((function(t){v(t.state)}))}),[d]),p.dismissed?null:s.default.createElement("div",h({},i,{className:l,style:h({position:"relative"},i.style)}),a&&s.default.createElement("a",{style:{position:"absolute",top:"6px",right:"6px",cursor:"pointer"},onClick:function(){d?(c.track(r.EVENT_NAMES.TUTORIAL_INTERACTION,h({category:r.CATEGORIES.NATIVE,trigger:r.TRIGGERS.ON_CLICK,handler:{type:r.HANDLER_TYPES.DISMISSED_CARD,cardId:u.nodeId},eventName:"DismissedCard_"+u.nodeId},u.trackingIdentifiers)),d.mutate({id:d.providerId,state:{dismissed:!0}})):r.logger.warning("Card state provider not found")}},s.default.createElement(gn,null)),o)},Code:function(t){var e=t.attributes,r=e.children,n=g(e,["children"]);return s.default.createElement("div",h({},n,{style:h(h({},yn),n.style||{})}),s.default.createElement("pre",{style:{color:"rgb(255, 255, 255)"}},r))},Document:function(t){var e=t.attributes,r=g(t,["attributes"]),n=e.style;return s.default.createElement(On,h({},r,{attributes:h(h({},e),{style:h(h({},{overflow:"auto",maxWidth:"100%",maxHeight:"100%",boxSizing:"border-box"}),n)})}))},Em:function(t){var e=In("em");return s.default.createElement(e,h({},t))},EmbedPortal:function(t){var e=t.attributes,n=e.slug,o=e.style,a=t.api;return s.default.createElement("div",{className:r.CANDU_PORTAL_CLASS,style:o},a.render.portal({slug:n}))},EmbedTutorial:function(t){var e=t.attributes,r=e.id,n=e.slug,o=e.style,a=t.api;return s.default.createElement("div",{style:o},a.render.tutorial({tutorialId:r,slug:n}))},Flex:function(t){var e=t.attributes;return s.default.createElement("div",h({},e,{style:h(h({},_n),e.style)}))},FlexItem:function(t){var e=t.attributes;return s.default.createElement("div",h({},e,{style:h(h({},bn),e.style)}))},H1:function(t){var e=In("h1");return s.default.createElement(e,h({},t))},H2:function(t){var e=In("h2");return s.default.createElement(e,h({},t))},H3:function(t){var e=In("h3");return s.default.createElement(e,h({},t))},H4:function(t){var e=In("h4");return s.default.createElement(e,h({},t))},H5:function(t){var e=In("h5");return s.default.createElement(e,h({},t))},H6:function(t){var e=In("h6");return s.default.createElement(e,h({},t))},Image:function(t){var e=t.attributes,r=e.width,n=e.height,o=e.src,a=e.className,i=e.alt,u=e.style,c=t.api,l=c.nodeId,d=c.document;return!!d&&!!l&&d.nodes[l].props?s.default.createElement("img",{alt:i||"",src:o,className:a,style:h(h(h({},En),u),{width:r||En.width,height:n||En.height})}):null},InlineCode:function(t){var e=In("code");return s.default.createElement(e,h({},t))},Link:function(t){var e=t.attributes,n=e.href,o=e.target,a=g(e,["href","target"]),i=r.toCssSelector("link",{output:"html"});return s.default.createElement("a",h({},a,{className:i,href:n,target:n.includes("http")&&!o?"_blank":o}))},List:function(t){var e=t.attributes,r=t.api,n=r.nodeId,o=(r.document.nodes[n]||{}).data;return o&&o.custom&&o.custom.variant===on.Unordered?s.default.createElement("ul",h({},e)):s.default.createElement("ol",h({},e))},ListItem:function(t){var e=t.attributes,n=r.toCssSelector("typography",{variant:{variant:"P"},output:"html"});return s.default.createElement("li",h({},e,{className:n}))},P:function(t){var e=In("p");return s.default.createElement(e,h({},t))},RichText:On,Spacing:function(t){var e=t.attributes;return s.default.createElement("hr",h({},e,{style:h(h({},Sn),e.style)}))},Text:function(t){var r=t.attributes,n=t.api,o=n.nodeId,a=n.document,i=!!a&&!!o&&a.nodes[o],u=s.default.createElement(e.Fragment,null,r.children);if(!i)return u;var c=i.data&&i.data.custom&&ut(i.data.custom.marks)?i.data.custom.marks:[];return 0===c.length?u:u=c.reduce((function(t,e){return n.render.styleguide(e,h(h({},r),{children:t}))}),u)},U:function(t){var e=In("u");return s.default.createElement(e,h({},t))},View:On,Player:function(t){var e=t.attributes,n=e.width,o=e.height,a=e.src,i=g(e,["width","height","src"]);return s.default.createElement(d.default,h({},i,{controls:!0,url:a,width:n||Cn,height:o||An,onError:r.logError}))},CheckList:function(t){var e=t.attributes,r=e.children,n=g(e,["children"]);return s.default.createElement("div",h({},n),r)},CheckListGroup:function(t){var n=t.attributes,o=n.children,a=n.title,i=n.style,u=n.className,c=n.onClick,l=t.api,d=l.childrenStateInstances,f=l.trackingIdentifiers,p=l.node.data,v=mn(),g=r.getCheckListStateProviders(d||[]),m=g.length,y=e.useState(r.getInitialItems(g)),_=y[0],b=y[1];e.useEffect((function(){var t=g.map((function(t,e){return t.subscribe((function(t){b((function(r){var n;return h(h({},r),((n={})[t.id]={position:e,status:t.state},n))}))}))}));return function(){t.map((function(t){return t()}))}}),g);var E=r.calculateGroupCompletion(_,m).percComplete;e.useEffect((function(){var t,e;100===E&&v.track(r.EVENT_NAMES.CHECKLIST_GROUP_COMPLETE,h({title:a,groupId:null===(e=null===(t=p)||void 0===t?void 0:t.custom)||void 0===e?void 0:e.groupId},f))}),[E]);var T=r.getFirstNotStartedItem(_,m),S=r.toCssSelector("typography",{variant:{variant:"H4"},output:"html"});return s.default.createElement("div",{className:u,onClick:c,style:h(h({},jn),i)},s.default.createElement("h4",{className:S},a),s.default.createElement("div",{style:Ln},s.default.createElement("div",{style:h(h({},Pn),{width:E+"%"})})),!!o&&s.default.Children.map(o,(function(t,e){return s.default.cloneElement(t,{expandByDefault:e===T})})))},CheckListItem:function(t){var n=t.attributes,o=n.title,a=n.style,i=n.children,u=g(n,["title","style","children"]),c=t.api,l=c.stateInstances,d=c.trackingIdentifiers,f=t.expandByDefault,p=mn(),v=e.useState(r.CheckListItemStatus.NotStared),m=v[0],y=v[1],_=e.useState(!!f),b=_[0],E=_[1];if(!l)throw new Error("no state provided");var T=function(t){var e=t.find((function(t){return t.resolver instanceof r.CheckListResolverInstance}));if(!e)throw new Error("Couldn't find CheckListApi state provider");return e}(l);e.useEffect((function(){return T.subscribe((function(t){y(t.state)}))}),[T]),e.useEffect((function(){i&&E(!!f)}),[f]);var S=h(h({},Nn),{borderBottom:i&&b?"1px solid var(--color-lines)":"none"}),I={flexGrow:1,fontWeight:600,cursor:i?"pointer":"auto"},O=r.toCssSelector("typography",{variant:{variant:"P"},output:"html"}),C=function(t){E(!b),t.stopPropagation()};return s.default.createElement("div",h({style:h(h({},Rn),a)},u),s.default.createElement("div",{style:S,onClick:i&&C},s.default.createElement(Un,{onChangeStatus:function(){var t=function(t){return Gn[(Gn.indexOf(t)+1)%Gn.length]}(m);T.mutate({state:t}),p.track(r.EVENT_NAMES.CHECKLIST_ITEM_STATE_UPDATED,h({itemId:T.providerId,state:t,title:o},d))},status:m}),s.default.createElement("div",{className:O,style:I},o),i&&s.default.createElement("button",{type:"button",onClick:C,style:Dn},s.default.createElement(Fn,{direction:b?"up":"down"}))),i&&s.default.createElement(Hn,{expanded:b},i))}},Vn=pr((function(t,e){return pn(r.mergeStyleguidesFromContext(t,e))})),zn=function(){try{var t=localStorage.getItem("candu.portals");return t?JSON.parse(t):{}}catch(t){return{}}},Yn=Pr({name:"portal",initialValue:Lr(zn(),Ur),actions:{loading:function(t){return{slug:t}},success:function(t){return t},error:function(t){return t}},selectors:{portalAsset:function(t){return function(e){var r;return null===(r=e[t])||void 0===r?void 0:r.result}},isLoadingOrHasErrors:function(t){return function(e){var r,n;return(null===(r=e[t])||void 0===r?void 0:r.loading)||(null===(n=e[t])||void 0===n?void 0:n.error)}}},reducer:function(t,e){var r,n,o,a=t.type,i=t.slug,u=t.result,c=t.loadTime,s=t.error;switch(a){case"loading":return h(h({},e),((r={})[i]=h(h({},Ur()),{loading:!0}),r));case"success":return function(t,e){zn()[t]=e,localStorage.setItem("candu.portals",JSON.stringify(e))}(i,u),h(h({},e),((n={})[i]={loading:!1,error:void 0,result:u,loadTime:c},n));case"error":return h(h({},e),((o={})[i]={loading:!1,error:s,result:void 0,loadTime:c},o));default:return e}}});function Wn(t,e){var n=t.slug;l.default(r.isIdentifier(n),"(Portal) You must supply a valid slug");var o=e.getFluxState(Gr).clientToken,a=e.select(Yr.selectors.segmentIds);if(a){e.registerFlux(Yn);var i=e.select(Yn.selectors.portalAsset(n)),u=e.select(Yn.selectors.isLoadingOrHasErrors(n));if(!i&&!u){var c=performance.now(),s=function(t,e,r){return m(void 0,void 0,void 0,(function(){var n;return y(this,(function(o){return n="?segmentIds="+(r||[]).join(","),[2,fetch("https://cdn.candu.ai/portalMemberships/"+t+"/"+e+"/head.json"+n)]}))}))}(o,n,a);s&&(e.dispatch(Yn.actions.loading(n)),s.then((function(t){return e.dispatch(Yn.actions.success({slug:n,result:t,loadTime:performance.now()-c}))})).catch((function(t){return e.dispatch(Yn.actions.error({slug:n,error:t,loadTime:performance.now()-c}))})),e.registerFlux(Yn))}}}var Kn,Jn,qn=function(t){var e=t.tutorialDocument;return e?s.default.createElement(Zo,{tutorialDocument:e}):null},$n=function(t,e){return{tutorialDocument:Yn.selectors.portalAsset(e.slug)}},Zn=function(t){Wn(t,Qr());var e=tn($n)(qn);return s.default.createElement(e,h({},t))},Qn=function(t){return"candu.sdk."+t},Xn=function(t){return Qn("error."+t)},to="unknown_node_type",eo="unkown_inline_node_type",ro="unkown_node_object_type",no="tutorial_error_boundary",oo="portal_error_boundary",ao="provider_error_boundary",io={HEARTBEAT:Qn("heartbeat"),PREVIEW_OPEN:Qn("preview.open"),PORTAL:Qn("portal"),TUTORIAL:Qn("tutorial"),TUTORIAL_INTERACTION:Qn("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Xn("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Xn("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Xn("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Xn("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Xn("commit_api"),TUTORIAL_LOADING_ERROR:Xn("tutorial"),UNKOWN_NODE_TYPE:Xn(to),UNKOWN_INLINE_NODE_TYPE:Xn(eo),UNKOWN_NODE_OBJECT_TYPE:Xn(ro),TUTORIAL_ERROR:Xn(no),PORTAL_ERROR:Xn(oo),PROVIDER_ERROR:Xn(ao),STYLEGUIDE_MAP_ERROR:Xn(no),RENDER_NODE_ERROR:Xn(no),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Xn("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Xn("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Xn("state_fetch_failed"),STATE_UPDATE_FAILED:Xn("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Xn("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:Qn("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:Qn("tutorial.checklist_group_complete"),CARD_DISMISSED:Qn("tutorial.card_dismissed")},uo=function(t){return"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+"."},co=((Kn={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"})[io.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",Kn[io.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",Kn[io.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",Kn[io.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",Kn[io.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",Kn[io.UNKOWN_INLINE_NODE_TYPE]=uo(eo),Kn[io.UNKOWN_NODE_TYPE]=uo(to),Kn[io.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Kn[io.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Kn[io.PORTAL_ERROR]="An error has occured within Portal",Kn[io.PROVIDER_ERROR]="An error has occured within Provider",Kn[io.TUTORIAL_ERROR]="An error has occured within Tutorial",Kn[io.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",Kn[io.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",Kn[io.STATE_FETCH_FAILED]="An error has occured while fetching state:",Kn[io.STATE_UPDATE_FAILED]="An error has occured while updating state:",Kn[io.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",Kn),so=function(t){switch(t.trigger){case r.TRIGGERS.ON_CLICK:default:return"onClick"}},lo=function(t,e,n){var o,a,i;switch(t.handler.type){case r.HANDLER_TYPES.NAVIGATE:return(o={})[so(t)]=function(r){r.stopPropagation();var o=t.handler,a=o.href,i=o.target,u=n||{},c=u.parentTrackers,s=g(u,["parentTrackers"]);c&&c.forEach((function(r){return e(t,r)})),e(t,s),"Blank"===i?window.open(a,"_blank"):a&&a.includes("mailto:")?window.location=a:document.location.href=a},o;case r.HANDLER_TYPES.CHANGE_TUTORIAL:return(a={})[so(t)]=function(){var e=t.handler.tutorialId;r.logger.error("TODO -> change tutorial",e)},a;case r.HANDLER_TYPES.OPEN_GUIDE:return(i={})[so(t)]=function(){var e=t.handler.guideId;r.logger.error("TODO -> open guide",e)},i;default:return{}}},fo=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},po=function(t,e){var r=t.states;return Object.keys(r||{}).map((function(t){return e.select(en.selectors.provider(t))}))},vo=function(t,e,r){var n=t.nodes;return n&&n.map((function(t){return e.nodes[t]})).filter((function(t){return!!t})).map((function(t){return po(t,r)||[]})).reduce((function(t,e){return t.concat(e)}),[])},ho=function(t,e,n){var o=e.getFluxState(Hr);try{var a=n.document,i=a.nodes[t];if(!i)return r.logger.error("Document is corrupted. Refusing to move further."),null;var u=function(t){return ho(t,e,n)},c=i.type,s=i.props,l=i.css,d=h(h(h({},s||{}),{style:l||{},children:fo(i,u)}),function(t,e,n){var o,a,i,u,c,s,l=e.getFluxState(Hr);if("Link"===t.type&&(null===(o=t.props)||void 0===o?void 0:o.href)){var d=t.props.href+" Link Clicked",f=null===(i=null===(a=t)||void 0===a?void 0:a.nodes)||void 0===i?void 0:i[0];if(f){var p=n.nodes[f];"Text"===(null===(u=p)||void 0===u?void 0:u.type)&&(null===(s=null===(c=p)||void 0===c?void 0:c.props)||void 0===s?void 0:s.children)&&(d=p.props.children+" Link Clicked")}return{onClick:function(){var e;return l.track(io.TUTORIAL_INTERACTION,{trigger:r.TRIGGERS.ON_CLICK,category:t.type,eventName:d,handler:{href:null===(e=t.props)||void 0===e?void 0:e.href,type:r.HANDLER_TYPES.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var v=function(t,e){l.track(io.TUTORIAL_INTERACTION,h(h({},t),e||{}))};return t.data.actions.map((function(t){return lo(t,v,{})})).reduce((function(t,e){return h(h({},t),e)}),{})}(i,e,a)),f={nodeId:t,node:i,document:a,render:{node:u,styleguide:function(t,e){return void 0===e&&(e={}),n.renderNode(t,{api:f,attributes:e})},tutorial:function(t){return n.renderTutorial(t)},portal:function(t){return n.renderPortal(t)}},trackingIdentifiers:{},stateInstances:po(i,e),childrenStateInstances:vo(i,a,e)},p=f.render.styleguide(c,d);return p||(r.logger.error(co[io.UNKOWN_NODE_TYPE],{type:c}),o.error(new Error(co[io.UNKOWN_NODE_TYPE]),{type:c}),null)}catch(t){return r.logger.error(co[io.STYLEGUIDE_MAP_ERROR],t),o.error(t),null}},go=function(t,e){var r,n,o,a,i="string"==typeof e&&e.split(" ");return i?1===i.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===i.length?((n={})[t+"Top"]=i[0],n[t+"Right"]=i[1],n[t+"Bottom"]=i[0],n[t+"Left"]=i[1],n):3===i.length?((o={})[t+"Top"]=i[0],o[t+"Right"]=i[1],o[t+"Bottom"]=i[2],o[t+"Left"]=i[1],o):((a={})[t+"Top"]=i[0],a[t+"Right"]=i[1],a[t+"Bottom"]=i[2],a[t+"Left"]=i[3],a):{}},mo=function(t){var e=t.padding,r=t.margin,n=g(t,["padding","margin"]),o={};return e&&(o=h(h({},o),go("padding",e))),r&&(o=h(h({},o),go("margin",r))),h(h({},o),n)},yo=function(t){return"candu.sdk."+t},_o=function(t){return yo("error."+t)},bo=(yo("preview.open"),yo("portal"),yo("tutorial"),_o("portal_asset_not_found")),Eo=_o("portal_no_segment_ids"),To=_o("no_matching_tutorials"),So=_o("circular_dependecy_embed_portal"),Io=_o("circular_dependecy_embed_tutorial"),Oo=((Jn={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"})[bo]="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",Jn[Eo]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",Jn[To]="The Tutorial will not be rendered because there are no matching segments for the given user.",Jn[So]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Jn[Io]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Jn);var Co=function(t,e){return function(r,n){if(null==r)return r;if(!Ct(r))return t(r,n);for(var o=r.length,a=e?o:-1,i=Object(r);(e?a--:++a<o)&&!1!==n(i[a],a,i););return r}}(wt);var Ao=function(t,e){var r=-1,n=Ct(t)?Array(t.length):[];return Co(t,(function(t,o,a){n[++r]=e(t,o,a)})),n};var wo=function(t,e){return(ut(t)?mr:Ao)(t,jr(e))},Ro=function(){function t(t,e,n){var o=this;this.observer=new r.Observer,this.rootStore=t,this.providerId=e,this.resolver=n,this.eventing=t.getFluxState(Hr),this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return o.updateState(t)})).catch((function(t){r.logger.error(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_FETCH_FAILED],t.message),o.eventing.track(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,n=this.state;this.updateState(h(h({},n),t)),this.resolver.update(this.rootStore,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){r.logger.error(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_UPDATE_FAILED],t.message),e.eventing.track(r.ERROR_MESSAGES[r.EVENT_NAMES.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&e.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),No=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),ko=Object.create(null),xo=function(){function t(t){this.cache=new No,this.options=h({},t||{})}return t.register=function(t,e){ko[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=g(t,["type"]),n=ko[e];return n?new n(r):null},t.prototype.toJSON=function(){return h({type:this.type},this.options)},t}();var Do=function(t,e,r,n){for(var o=t.length,a=r+(n?1:-1);n?a--:++a<o;)if(e(t[a],a,t))return a;return-1};var jo=function(t){return t!=t};var Lo=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var Po=function(t,e,r){return e==e?Lo(t,e,r):Do(t,jo,r)};var Fo=function(t,e){return!!(null==t?0:t.length)&&Po(t,e,0)>-1};var Mo=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var Uo=function(){},Go=Fe&&1/Ee(new Fe([,-0]))[1]==1/0?function(t){return new Fe(t)}:Uo;var Ho=function(t,e,r){var n=-1,o=Fo,a=t.length,i=!0,u=[],c=u;if(r)i=!1,o=Mo;else if(a>=200){var s=e?null:Go(t);if(s)return Ee(s);i=!1,o=me,c=new he}else c=e?[]:u;t:for(;++n<a;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,i&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,r)||(c!==u&&c.push(d),u.push(l))}return u};var Bo=function(t){return t&&t.length?Ho(t):[]},Vo=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new f.default(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),zo=Wr+qr,Yo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return v(e,t),e.prototype.retrieve=function(t,e){return m(this,void 0,void 0,(function(){var r,n,o,a,i=this;return y(this,(function(u){switch(u.label){case 0:return r=t.getFluxState(Gr).clientToken,n=t.getFluxState(Br).userId,[4,Vo.get("cardStateApi",(function(t){return m(i,void 0,void 0,(function(){var e;return y(this,(function(o){switch(o.label){case 0:return[4,fetch(zo+"?token="+r+"&finder=byIds&ids="+Bo(t).join(",")+"&userId="+n).then((function(t){return t.json()}))];case 1:return e=o.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return o=u.sent(),a={id:e,state:{dismissed:!1}},[2,o||a]}}))}))},e.prototype.update=function(t,e,r){var n=t.getFluxState(Gr).clientToken,o=t.getFluxState(Br).userId;return fetch(zo+"/"+e+"?token="+n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:o.toString()})}).then((function(t){return t.json()}))},e}(xo);xo.register(r.StateResolverType.CardApi,Yo);var Wo=Wr+Jr;function Ko(t){return{state:t.state,id:t.id}}function Jo(t){switch(t){case r.CheckListScope.Account:return"AccountId";case r.CheckListScope.User:default:return"UserId"}}var qo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return v(e,t),e.prototype.getScopeAndFieldsFromRootState=function(t){var e=t.getFluxState(Br),n=e.userId,o=e.traits,a=this.options.scopeTrait,i=this.options.scope||r.CheckListScope.User,u=n.toString();return i===r.CheckListScope.Account&&(a&&o[a]?u=o[a]:(r.logger.warning("trait '"+a+"' is not defined, falling back to user scope"),i=r.CheckListScope.User)),{scope:i,scopeField:u}},e.prototype.retrieve=function(t,e){return m(this,void 0,void 0,(function(){var n,o,a,i,u=this;return y(this,(function(c){switch(c.label){case 0:return n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(Gr).clientToken,[4,Vo.get("checklistState",(function(t){return m(u,void 0,void 0,(function(){var e;return y(this,(function(r){switch(r.label){case 0:return[4,fetch(Wo+"?token="+i+"&byTrait="+Jo(o)+"&field="+a+"&finder=byIds&ids="+Bo(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(Ko)}))];case 1:return e=r.sent(),[2,t.map((function(t){return e.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,c.sent()||{id:e,state:r.CheckListItemStatus.NotStared}]}}))}))},e.prototype.update=function(t,e,r){var n=this.getScopeAndFieldsFromRootState(t),o=n.scope,a=n.scopeField,i=t.getFluxState(Gr).clientToken;return fetch(Wo+"/"+e+"?token="+i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(h(h({},r),{byTrait:Jo(o),field:a}))}).then((function(t){return t.json()})).then(Ko)},e}(xo);function $o(t,e){var n=t.document,o=n.stateProviders,a=n.head,i=e.getFluxState(Gr).clientToken;a&&r.fetchHead(a,i),o&&function(t,e){var r;e.registerFlux(en);var n=wo(t,(function(t,r){if(e.select(en.selectors.provider(r)))return null;var n=xo.fromJSON(t.resolver);return n?new Ro(e,r,n):null})).filter((function(t){return!!t}));e.dispatch((r=en.actions).set.apply(r,n))}(o,e)}xo.register(r.StateResolverType.CheckListApi,qo);var Zo=tn((function(){return{clientToken:Gr.selectors.clientToken,eventing:Hr.selectors.state}}))((function(t){var e,n=t.tutorialDocument,o=t.clientToken,a=t.eventing,i=(e=Qr().select(Gr.selectors.styleguide),Vn({provider:e},Bn)).getComponent,u=Qr();if(!n.document)return null;$o(n,u);var c=n.document,l=c.rootNodeId,d=c.head,f=c.nodes,p={rootNodeId:l,nodes:r.adaptCustomNodes(f)};return d&&r.fetchHead(d,o),ho(n.document.rootNodeId,u,{document:p,renderTutorial:function(t){return s.default.createElement(ta,h({},t))},renderPortal:function(t){return s.default.createElement(Zn,h({},t))},renderNode:function(t,e){try{var n=i(t);return n?s.default.createElement(n,{key:e.api.nodeId,api:e.api,attributes:h(h({},e.attributes),{style:e.attributes.style&&mo(e.attributes.style)})}):null}catch(t){return r.logger.error(Oo[r.EVENT_NAMES.RENDER_NODE_ERROR],t),a.error(t),null}}})})),Qo=function(t){var e=t.tutorialDocument;return e?s.default.createElement(Zo,{tutorialDocument:e}):null},Xo=function(t,e){return{tutorialDocument:nn.selectors.tutorialDocument(e.slug)}},ta=function(t){!function(t,e){var n=r.tutorialValidation(t),o=e.getFluxState(Hr),a=e.getFluxState(Gr).clientToken;e.registerFlux(nn);var i=n.slug,u=e.select(nn.selectors.tutorialDocument(i));if(!e.select(nn.selectors.isLoadingOrHasErrors(i))&&!u){var c=performance.now(),s=r.RESOURCES.tutorialDocument(n,a,o);s&&(e.dispatch(nn.actions.loading(i)),s.then((function(t){return e.dispatch(nn.actions.success({slug:i,result:t,loadTime:performance.now()-c}))})).catch((function(t){return e.dispatch(nn.actions.error({slug:i,error:t,loadTime:performance.now()-c}))})))}}(t,Qr());var e=tn(Xo)(Qo);return s.default.createElement(e,h({},t))};t.CanduProvider=Xr,t.Portal=Zn,t.ProviderContext=Zr,t.Tutorial=ta,t.useRootStore=Qr,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map

@@ -12,3 +12,3 @@ {

},
"version": "0.7.1-alpha.16",
"version": "0.7.1-alpha.17",
"main": "dist/index.js",

@@ -29,4 +29,4 @@ "module": "dist/index.es.js",

"dependencies": {
"@candulabs/core": "^0.7.1-alpha.16",
"@candulabs/eventing": "^0.7.1-alpha.16",
"@candulabs/core": "^0.7.1-alpha.17",
"@candulabs/eventing": "^0.7.1-alpha.17",
"dataloader": "^2.0.0",

@@ -42,3 +42,3 @@ "invariant": "^2.2.4",

},
"gitHead": "68c5de2be4f93f93914ea81294d229c98dc8d130"
"gitHead": "75e001561c0b683716f66f16df6ed190634ea88d"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc