@meltingspot/core 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -15,6 +15,16 @@ Date: YYYY-MM-DD
15
15
 
16
16
  -->
17
17
 
18
+ ## v1.5.0
19
+
20
+ Date: 2026-07-20
21
+
22
+ ### Minor Changes
23
+
24
+ - Release alignment with the other MeltingSpot SDKs (`@meltingspot/embed`,
25
+ `@meltingspot/widget`, `@meltingspot/coach`). No functional changes to
26
+ `@meltingspot/core`.
27
+
18
28
  ## v1.4.0
19
29
 
20
30
  Date: 2026-07-17
package/index.mjs CHANGED
@@ -4946,7 +4946,7 @@ class i0 {
4946
4946
  this.listener !== null && typeof document < "u" && document.removeEventListener(xa, this.listener), this.listener = null, this.lastOptions = null;
4947
4947
  }
4948
4948
  }
4949
- const Zm = "1.4.0";
4949
+ const Zm = "1.5.0";
4950
4950
  class Jm {
4951
4951
  constructor(s) {
4952
4952
  this.debug = !1, this.debug = s?.debug ?? !1, this.appName = s?.appName, this.appVersion = s?.appVersion;
package/index.umd.js CHANGED
@@ -30,4 +30,4 @@ __p += '`),tn&&(A+=`' +
30
30
  function print() { __p += __j.call(arguments, '') }
31
31
  `:`;
32
32
  `)+A+`return __p
33
- }`;var J=Cf(function(){return sn(f,U+"return "+A).apply(i,l)});if(J.source=A,Du(J))throw J;return J}function Hv(n){return fn(n).toLowerCase()}function Bv(n){return fn(n).toUpperCase()}function Wv(n,e,t){if(n=fn(n),n&&(t||e===i))return zs(n);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Te(e),f=qs(u,s),l=Ks(u,s)+1;return Ze(u,f,l).join("")}function kv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.slice(0,Zs(n)+1);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Ks(u,Te(e))+1;return Ze(u,0,s).join("")}function Gv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.replace(Di,"");if(!n||!(e=ne(e)))return n;var u=Te(n),s=qs(u,Te(e));return Ze(u,s).join("")}function zv(n,e){var t=ln,u=rn;if(Tn(e)){var s="separator"in e?e.separator:s;t="length"in e?Q(e.length):t,u="omission"in e?ne(e.omission):u}n=fn(n);var f=n.length;if(It(n)){var l=Te(n);f=l.length}if(t>=f)return n;var h=t-Lt(u);if(h<1)return u;var g=l?Ze(l,0,h).join(""):n.slice(0,h);if(s===i)return g+u;if(l&&(h+=g.length-h),Su(s)){if(n.slice(h).search(s)){var T,w=g;for(s.global||(s=qi(s.source,fn(ds.exec(s))+"g")),s.lastIndex=0;T=s.exec(w);)var A=T.index;g=g.slice(0,A===i?h:A)}}else if(n.indexOf(ne(s),h)!=h){var R=g.lastIndexOf(s);R>-1&&(g=g.slice(0,R))}return g+u}function qv(n){return n=fn(n),n&&rh.test(n)?n.replace(cs,wd):n}var Kv=xt(function(n,e,t){return n+(t?" ":"")+e.toUpperCase()}),Uu=Ca("toUpperCase");function Pf(n,e,t){return n=fn(n),e=t?i:e,e===i?gd(n)?Id(n):sd(n):n.match(e)||[]}var Cf=V(function(n,e){try{return Xn(n,i,e)}catch(t){return Du(t)?t:new W(t)}}),Qv=Ce(function(n,e){return ae(e,function(t){t=Oe(t),$e(n,t,Mu(n[t],n))}),n});function Zv(n){var e=n==null?0:n.length,t=N();return n=e?gn(n,function(u){if(typeof u[1]!="function")throw new fe(_);return[t(u[0]),u[1]]}):[],V(function(u){for(var s=-1;++s<e;){var f=n[s];if(Xn(f[0],this,u))return Xn(f[1],this,u)}})}function Jv(n){return wp(le(n,H))}function Nu(n){return function(){return n}}function Vv(n,e){return n==null||n!==n?e:n}var Xv=Fa(),jv=Fa(!0);function Qn(n){return n}function $u(n){return _a(typeof n=="function"?n:le(n,H))}function n0(n){return ma(le(n,H))}function e0(n,e){return va(n,le(e,H))}var t0=V(function(n,e){return function(t){return Vt(t,n,e)}}),r0=V(function(n,e){return function(t){return Vt(n,t,e)}});function Pu(n,e,t){var u=Un(e),s=qr(e,u);t==null&&!(Tn(e)&&(s.length||!u.length))&&(t=e,e=n,n=this,s=qr(e,Un(e)));var f=!(Tn(t)&&"chain"in t)||!!t.chain,l=Fe(n);return ae(s,function(h){var g=e[h];n[h]=g,l&&(n.prototype[h]=function(){var T=this.__chain__;if(f||T){var w=n(this.__wrapped__),A=w.__actions__=zn(this.__actions__);return A.push({func:g,args:arguments,thisArg:n}),w.__chain__=T,w}return g.apply(n,ke([this.value()],arguments))})}),n}function i0(){return Pn._===this&&(Pn._=Sd),this}function Cu(){}function u0(n){return n=Q(n),V(function(e){return Ea(e,n)})}var o0=pu(gn),s0=pu(Hs),a0=pu(Fi);function Yf(n){return wu(n)?Hi(Oe(n)):Yp(n)}function f0(n){return function(e){return n==null?i:ct(n,e)}}var c0=Ba(),l0=Ba(!0);function Yu(){return[]}function Fu(){return!1}function h0(){return{}}function d0(){return""}function p0(){return!0}function _0(n,e){if(n=Q(n),n<1||n>L)return[];var t=X,u=Fn(n,X);e=N(e),n-=X;for(var s=ki(u,e);++t<n;)e(t);return s}function g0(n){return G(n)?gn(n,Oe):ee(n)?[n]:zn(rf(fn(n)))}function m0(n){var e=++Od;return fn(n)+e}var v0=Xr(function(n,e){return n+e},0),E0=_u("ceil"),T0=Xr(function(n,e){return n/e},1),w0=_u("floor");function A0(n){return n&&n.length?zr(n,Qn,nu):i}function y0(n,e){return n&&n.length?zr(n,N(e,2),nu):i}function I0(n){return ks(n,Qn)}function L0(n,e){return ks(n,N(e,2))}function R0(n){return n&&n.length?zr(n,Qn,iu):i}function M0(n,e){return n&&n.length?zr(n,N(e,2),iu):i}var O0=Xr(function(n,e){return n*e},1),D0=_u("round"),S0=Xr(function(n,e){return n-e},0);function b0(n){return n&&n.length?Wi(n,Qn):0}function x0(n,e){return n&&n.length?Wi(n,N(e,2)):0}return a.after=nm,a.ary=_f,a.assign=Bm,a.assignIn=Df,a.assignInWith=li,a.assignWith=Wm,a.at=km,a.before=gf,a.bind=Mu,a.bindAll=Qv,a.bindKey=mf,a.castArray=hm,a.chain=hf,a.chunk=w_,a.compact=A_,a.concat=y_,a.cond=Zv,a.conforms=Jv,a.constant=Nu,a.countBy=bg,a.create=Gm,a.curry=vf,a.curryRight=Ef,a.debounce=Tf,a.defaults=zm,a.defaultsDeep=qm,a.defer=em,a.delay=tm,a.difference=I_,a.differenceBy=L_,a.differenceWith=R_,a.drop=M_,a.dropRight=O_,a.dropRightWhile=D_,a.dropWhile=S_,a.fill=b_,a.filter=Ug,a.flatMap=Pg,a.flatMapDeep=Cg,a.flatMapDepth=Yg,a.flatten=af,a.flattenDeep=x_,a.flattenDepth=U_,a.flip=rm,a.flow=Xv,a.flowRight=jv,a.fromPairs=N_,a.functions=jm,a.functionsIn=nv,a.groupBy=Fg,a.initial=P_,a.intersection=C_,a.intersectionBy=Y_,a.intersectionWith=F_,a.invert=tv,a.invertBy=rv,a.invokeMap=Bg,a.iteratee=$u,a.keyBy=Wg,a.keys=Un,a.keysIn=Kn,a.map=ui,a.mapKeys=uv,a.mapValues=ov,a.matches=n0,a.matchesProperty=e0,a.memoize=si,a.merge=sv,a.mergeWith=Sf,a.method=t0,a.methodOf=r0,a.mixin=Pu,a.negate=ai,a.nthArg=u0,a.omit=av,a.omitBy=fv,a.once=im,a.orderBy=kg,a.over=o0,a.overArgs=um,a.overEvery=s0,a.overSome=a0,a.partial=Ou,a.partialRight=wf,a.partition=Gg,a.pick=cv,a.pickBy=bf,a.property=Yf,a.propertyOf=f0,a.pull=k_,a.pullAll=cf,a.pullAllBy=G_,a.pullAllWith=z_,a.pullAt=q_,a.range=c0,a.rangeRight=l0,a.rearg=om,a.reject=Kg,a.remove=K_,a.rest=sm,a.reverse=Lu,a.sampleSize=Zg,a.set=hv,a.setWith=dv,a.shuffle=Jg,a.slice=Q_,a.sortBy=jg,a.sortedUniq=eg,a.sortedUniqBy=tg,a.split=Pv,a.spread=am,a.tail=rg,a.take=ig,a.takeRight=ug,a.takeRightWhile=og,a.takeWhile=sg,a.tap=Ag,a.throttle=fm,a.thru=ii,a.toArray=Rf,a.toPairs=xf,a.toPairsIn=Uf,a.toPath=g0,a.toPlainObject=Of,a.transform=pv,a.unary=cm,a.union=ag,a.unionBy=fg,a.unionWith=cg,a.uniq=lg,a.uniqBy=hg,a.uniqWith=dg,a.unset=_v,a.unzip=Ru,a.unzipWith=lf,a.update=gv,a.updateWith=mv,a.values=$t,a.valuesIn=vv,a.without=pg,a.words=Pf,a.wrap=lm,a.xor=_g,a.xorBy=gg,a.xorWith=mg,a.zip=vg,a.zipObject=Eg,a.zipObjectDeep=Tg,a.zipWith=wg,a.entries=xf,a.entriesIn=Uf,a.extend=Df,a.extendWith=li,Pu(a,a),a.add=v0,a.attempt=Cf,a.camelCase=Av,a.capitalize=Nf,a.ceil=E0,a.clamp=Ev,a.clone=dm,a.cloneDeep=_m,a.cloneDeepWith=gm,a.cloneWith=pm,a.conformsTo=mm,a.deburr=$f,a.defaultTo=Vv,a.divide=T0,a.endsWith=yv,a.eq=Ae,a.escape=Iv,a.escapeRegExp=Lv,a.every=xg,a.find=Ng,a.findIndex=of,a.findKey=Km,a.findLast=$g,a.findLastIndex=sf,a.findLastKey=Qm,a.floor=w0,a.forEach=df,a.forEachRight=pf,a.forIn=Zm,a.forInRight=Jm,a.forOwn=Vm,a.forOwnRight=Xm,a.get=bu,a.gt=vm,a.gte=Em,a.has=ev,a.hasIn=xu,a.head=ff,a.identity=Qn,a.includes=Hg,a.indexOf=$_,a.inRange=Tv,a.invoke=iv,a.isArguments=dt,a.isArray=G,a.isArrayBuffer=Tm,a.isArrayLike=qn,a.isArrayLikeObject=yn,a.isBoolean=wm,a.isBuffer=Je,a.isDate=Am,a.isElement=ym,a.isEmpty=Im,a.isEqual=Lm,a.isEqualWith=Rm,a.isError=Du,a.isFinite=Mm,a.isFunction=Fe,a.isInteger=Af,a.isLength=fi,a.isMap=yf,a.isMatch=Om,a.isMatchWith=Dm,a.isNaN=Sm,a.isNative=bm,a.isNil=Um,a.isNull=xm,a.isNumber=If,a.isObject=Tn,a.isObjectLike=wn,a.isPlainObject=rr,a.isRegExp=Su,a.isSafeInteger=Nm,a.isSet=Lf,a.isString=ci,a.isSymbol=ee,a.isTypedArray=Nt,a.isUndefined=$m,a.isWeakMap=Pm,a.isWeakSet=Cm,a.join=H_,a.kebabCase=Rv,a.last=de,a.lastIndexOf=B_,a.lowerCase=Mv,a.lowerFirst=Ov,a.lt=Ym,a.lte=Fm,a.max=A0,a.maxBy=y0,a.mean=I0,a.meanBy=L0,a.min=R0,a.minBy=M0,a.stubArray=Yu,a.stubFalse=Fu,a.stubObject=h0,a.stubString=d0,a.stubTrue=p0,a.multiply=O0,a.nth=W_,a.noConflict=i0,a.noop=Cu,a.now=oi,a.pad=Dv,a.padEnd=Sv,a.padStart=bv,a.parseInt=xv,a.random=wv,a.reduce=zg,a.reduceRight=qg,a.repeat=Uv,a.replace=Nv,a.result=lv,a.round=D0,a.runInContext=p,a.sample=Qg,a.size=Vg,a.snakeCase=$v,a.some=Xg,a.sortedIndex=Z_,a.sortedIndexBy=J_,a.sortedIndexOf=V_,a.sortedLastIndex=X_,a.sortedLastIndexBy=j_,a.sortedLastIndexOf=ng,a.startCase=Cv,a.startsWith=Yv,a.subtract=S0,a.sum=b0,a.sumBy=x0,a.template=Fv,a.times=_0,a.toFinite=He,a.toInteger=Q,a.toLength=Mf,a.toLower=Hv,a.toNumber=pe,a.toSafeInteger=Hm,a.toString=fn,a.toUpper=Bv,a.trim=Wv,a.trimEnd=kv,a.trimStart=Gv,a.truncate=zv,a.unescape=qv,a.uniqueId=m0,a.upperCase=Kv,a.upperFirst=Uu,a.each=df,a.eachRight=pf,a.first=ff,Pu(a,(function(){var n={};return Re(a,function(e,t){cn.call(a.prototype,t)||(n[t]=e)}),n})(),{chain:!1}),a.VERSION=c,ae(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){a[n].placeholder=a}),ae(["drop","take"],function(n,e){nn.prototype[n]=function(t){t=t===i?1:bn(Q(t),0);var u=this.__filtered__&&!e?new nn(this):this.clone();return u.__filtered__?u.__takeCount__=Fn(t,u.__takeCount__):u.__views__.push({size:Fn(t,X),type:n+(u.__dir__<0?"Right":"")}),u},nn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),ae(["filter","map","takeWhile"],function(n,e){var t=e+1,u=t==Y||t==O;nn.prototype[n]=function(s){var f=this.clone();return f.__iteratees__.push({iteratee:N(s,3),type:t}),f.__filtered__=f.__filtered__||u,f}}),ae(["head","last"],function(n,e){var t="take"+(e?"Right":"");nn.prototype[n]=function(){return this[t](1).value()[0]}}),ae(["initial","tail"],function(n,e){var t="drop"+(e?"":"Right");nn.prototype[n]=function(){return this.__filtered__?new nn(this):this[t](1)}}),nn.prototype.compact=function(){return this.filter(Qn)},nn.prototype.find=function(n){return this.filter(n).head()},nn.prototype.findLast=function(n){return this.reverse().find(n)},nn.prototype.invokeMap=V(function(n,e){return typeof n=="function"?new nn(this):this.map(function(t){return Vt(t,n,e)})}),nn.prototype.reject=function(n){return this.filter(ai(N(n)))},nn.prototype.slice=function(n,e){n=Q(n);var t=this;return t.__filtered__&&(n>0||e<0)?new nn(t):(n<0?t=t.takeRight(-n):n&&(t=t.drop(n)),e!==i&&(e=Q(e),t=e<0?t.dropRight(-e):t.take(e-n)),t)},nn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},nn.prototype.toArray=function(){return this.take(X)},Re(nn.prototype,function(n,e){var t=/^(?:filter|find|map|reject)|While$/.test(e),u=/^(?:head|last)$/.test(e),s=a[u?"take"+(e=="last"?"Right":""):e],f=u||/^find/.test(e);s&&(a.prototype[e]=function(){var l=this.__wrapped__,h=u?[1]:arguments,g=l instanceof nn,T=h[0],w=g||G(l),A=function(j){var tn=s.apply(a,ke([j],h));return u&&R?tn[0]:tn};w&&t&&typeof T=="function"&&T.length!=1&&(g=w=!1);var R=this.__chain__,U=!!this.__actions__.length,$=f&&!R,J=g&&!U;if(!f&&w){l=J?l:new nn(this);var P=n.apply(l,h);return P.__actions__.push({func:ii,args:[A],thisArg:i}),new ce(P,R)}return $&&J?n.apply(this,h):(P=this.thru(A),$?u?P.value()[0]:P.value():P)})}),ae(["pop","push","shift","sort","splice","unshift"],function(n){var e=Sr[n],t=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",u=/^(?:pop|shift)$/.test(n);a.prototype[n]=function(){var s=arguments;if(u&&!this.__chain__){var f=this.value();return e.apply(G(f)?f:[],s)}return this[t](function(l){return e.apply(G(l)?l:[],s)})}}),Re(nn.prototype,function(n,e){var t=a[e];if(t){var u=t.name+"";cn.call(Dt,u)||(Dt[u]=[]),Dt[u].push({name:e,func:t})}}),Dt[Vr(i,dn).name]=[{name:"wrapper",func:i}],nn.prototype.clone=qd,nn.prototype.reverse=Kd,nn.prototype.value=Qd,a.prototype.at=yg,a.prototype.chain=Ig,a.prototype.commit=Lg,a.prototype.next=Rg,a.prototype.plant=Og,a.prototype.reverse=Dg,a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=Sg,a.prototype.first=a.prototype.head,Gt&&(a.prototype[Gt]=Mg),a}),Rt=Ld();ut?((ut.exports=Rt)._=Rt,$i._=Rt):Pn._=Rt}).call(Pc)})(Ct,Ct.exports)),Ct.exports}var Yc=Cc();const so=pt(Yc),ao=(r,o)=>{switch(o){case"fr":case"it":return so.capitalize(r.format("dddd D MMMM"));case"es":return so.capitalize(r.format("dddd D [de] MMMM"));case"de":return r.format("dddd, D. MMMM");default:return r.format("dddd, MMMM Do")}},fo=r=>r.format("LT"),Fc=(r,o)=>{const i=ao(r,o),c=fo(r);switch(o){case"fr":return`${i} à ${c}`;case"it":return`${i} alle ${c}`;case"es":return`${i} a las ${c}`;case"de":return`${i} um ${c}`;default:return`${i} at ${c}`}},Hc=r=>r.format("ll"),Bc=(r,o)=>{switch(o){case"fr":case"de":case"it":return r.format("HH:mm");case"es":return r.format("H:mm");default:return r.format("h:mm")}},Wc=r=>r.format("L"),kc=r=>r.format("L LT");var co=(r=>(r.SimpleDate="SimpleDate",r.SimpleDateTime="SimpleDateTime",r.ExtraShortDate="ExtraShortDate",r.InlineExtraShortDate="InlineExtraShortDate",r.ShortDate="ShortDate",r.InlineShortDate="InlineShortDate",r.Date="Date",r.LongDate="LongDate",r.LongDateTime="LongDateTime",r.ShortTime="ShortTime",r.Time="Time",r.DateTime="DateTime",r))(co||{});const Gc=(r,o,i,c)=>{let d=_t(r);c&&(d=d.tz(c)),i&&(d=d.locale(i));const v=d.locale();switch(o){case"SimpleDate":return Wc(d);case"SimpleDateTime":return kc(d);case"ExtraShortDate":return Uc(d,v);case"InlineExtraShortDate":return Nc(d,v);case"ShortDate":return Hc(d);case"InlineShortDate":return $c(d,v);case"Date":return bc(d);case"LongDate":return ao(d,v);case"LongDateTime":return Fc(d,v);case"ShortTime":return Bc(d,v);case"Time":return fo(d);case"DateTime":return xc(d)}};var _e=(r=>(r.Contains="Contains",r.DoesntContain="DoesntContain",r.DoesntEndWith="DoesntEndWith",r.DoesntEqual="DoesntEqual",r.DoesntStartWith="DoesntStartWith",r.EndsWith="EndsWith",r.Equals="Equals",r.MatchesRegex="MatchesRegex",r.StartsWith="StartsWith",r))(_e||{});const zc="http://_meltingspot.local",qc=200,Kc=/(\([^()]*[+*][^()]*\))[+*]/,Qc=r=>r.length<=qc&&!Kc.test(r),Zc=r=>{try{const o=new URL(r,zc);return`${o.pathname}${o.search}${o.hash}`}catch{return r}},Er=r=>r.startsWith("/")?r:`/${r}`,Jc=(r,o)=>{switch(o.operator){case _e.MatchesRegex:if(!Qc(o.value))return!1;try{return new RegExp(o.value).test(r)}catch{return!1}case _e.StartsWith:return r.startsWith(Er(o.value));case _e.DoesntStartWith:return!r.startsWith(Er(o.value));case _e.EndsWith:return r.endsWith(o.value);case _e.DoesntEndWith:return!r.endsWith(o.value);case _e.Contains:return r.includes(o.value);case _e.DoesntContain:return!r.includes(o.value);case _e.Equals:return r===Er(o.value);case _e.DoesntEqual:return r!==Er(o.value)}},Vc=(r,o)=>{const i=o.rules.map(c=>Jc(r,c));return o.ruleOperator==="AND"?i.every(Boolean):i.some(Boolean)},Xc=(r,o)=>{const i=Zc(r),c=o.blocks.map(d=>Vc(i,d));return o.blockOperator==="AND"?c.every(Boolean):c.some(Boolean)},jc=r=>r.replace(/^https?:\/\//,""),nl=(r,o)=>{const i=jc(o);try{const c=new URL(r);return c.hostname===i||c.hostname.endsWith(`.${i}`)}catch{return!1}},el="data-meltingspot-playbook-editor-active",di="meltingspot:playbook-editor:active-changed",tl=()=>typeof document<"u"&&typeof document.dispatchEvent=="function",lo=()=>tl()?document.documentElement.getAttribute(el)==="true":!1;class rl{constructor(){this.listener=null,this.lastOptions=null,this.chain=Promise.resolve()}enqueue(o){const i=this.chain.then(o);return this.chain=i.catch(()=>{}),i}get isBound(){return this.listener!==null}bind(o){if(this.listener!==null||typeof document>"u")return;const i=()=>{if(lo()){Promise.resolve().then(()=>o.onEditorActive()).catch(d=>{console.warn("[playbook-editor] onEditorActive callback failed",d)});return}const c=this.lastOptions;c!==null&&Promise.resolve().then(()=>o.onEditorInactive(c)).catch(d=>{console.warn("[playbook-editor] onEditorInactive callback failed",d)})};document.addEventListener(di,i),this.listener=i}cacheOptions(o){this.lastOptions=o}clearOptions(){this.lastOptions=null}unbind(){this.listener!==null&&typeof document<"u"&&document.removeEventListener(di,this.listener),this.listener=null,this.lastOptions=null}}const il="1.4.0";class ho{constructor(o){this.debug=!1,this.debug=o?.debug??!1,this.appName=o?.appName,this.appVersion=o?.appVersion}log(o,...i){this.debug&&this.print(o,"info",i)}warn(o,...i){this.print(o,"warn",i)}error(o,...i){this.print(o,"error",i)}print(o,i,c){const _=[`[${["MeltingSpot",this.appName,this.appVersion].filter(Boolean).join(" - ")}] ${o}`];c.length&&_.push(...c),console[i](..._)}}const po=new ho({appName:"Core SDK",appVersion:il}),ul=r=>{po.debug=r},ol=r=>r.toLowerCase().replace(/[^a-z0-9-]/g,""),sl=["/user"],al=({deeplink:r,spotId:o})=>{try{const i=new URL(r,"https://unused.com");let c=i.pathname;return i.search&&(c+=i.search),i.hash&&(c+=i.hash),sl.some(d=>c.startsWith(d))||(c=`/spot/${o}/${zu(c)}`),c}catch(i){return po.warn("Failed to parse deeplink URL",i),null}},fl=[/(^|\.)meltingspot\.io$/i],cl=r=>{let o;try{const v=qu(r);o=new URL(v)}catch{throw new Error(`Invalid baseURL: ${r}`)}const i=o.hostname==="localhost"||o.hostname==="127.0.0.1",c=o.protocol==="https:",d=fl.some(v=>v.test(o.hostname));if(!i&&(!c||!d))throw new Error(`Untrusted baseURL origin: ${o.origin}`);return o.origin},ll={msApiBaseUrl:"https://openapi.meltingspot.io/",msCommunityWebBaseUrl:"https://go.meltingspot.io/",ssoToken:void 0,spotId:"",autoJoin:!1,rootDocument:globalThis.document};class ue{constructor(){this.configuration=ll}static getInstance(){return ue.instance||(ue.instance=new ue),ue.instance}setConfiguration(o){this.configuration={...this.configuration,...o}}static getConfiguration(o={}){return{...ue.getInstance().configuration,...o}}}const _o="%[a-f0-9]{2}",go=new RegExp("("+_o+")|([^%]+?)","gi"),mo=new RegExp("("+_o+")+","gi");function pi(r,o){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;o=o||1;const i=r.slice(0,o),c=r.slice(o);return Array.prototype.concat.call([],pi(i),pi(c))}function hl(r){try{return decodeURIComponent(r)}catch{let o=r.match(go)||[];for(let i=1;i<o.length;i++)r=pi(o,i).join(""),o=r.match(go)||[];return r}}function dl(r){const o={"%FE%FF":"��","%FF%FE":"��"};let i=mo.exec(r);for(;i;){try{o[i[0]]=decodeURIComponent(i[0])}catch{const d=hl(i[0]);d!==i[0]&&(o[i[0]]=d)}i=mo.exec(r)}o["%C2"]="�";const c=Object.keys(o);for(const d of c)r=r.replace(new RegExp(d,"g"),o[d]);return r}function pl(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return dl(r)}}function _l(r,o){const i={};if(Array.isArray(o))for(const c of o){const d=Object.getOwnPropertyDescriptor(r,c);d?.enumerable&&Object.defineProperty(i,c,d)}else for(const c of Reflect.ownKeys(r)){const d=Object.getOwnPropertyDescriptor(r,c);if(d.enumerable){const v=r[c];o(c,v,r)&&Object.defineProperty(i,c,d)}}return i}function vo(r,o){if(!(typeof r=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||o==="")return[];const i=r.indexOf(o);return i===-1?[]:[r.slice(0,i),r.slice(i+o.length)]}const gl=r=>r==null,ml=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),_i=Symbol("encodeFragmentIdentifier");function vl(r){switch(r.arrayFormat){case"index":return o=>(i,c)=>{const d=i.length;return c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[",d,"]"].join("")]:[...i,[Ln(o,r),"[",Ln(d,r),"]=",Ln(c,r)].join("")]};case"bracket":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[]"].join("")]:[...i,[Ln(o,r),"[]=",Ln(c,r)].join("")];case"colon-list-separator":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),":list="].join("")]:[...i,[Ln(o,r),":list=",Ln(c,r)].join("")];case"comma":case"separator":case"bracket-separator":{const o=r.arrayFormat==="bracket-separator"?"[]=":"=";return i=>(c,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?c:(d=d===null?"":d,c.length===0?[[Ln(i,r),o,Ln(d,r)].join("")]:[[c,Ln(d,r)].join(r.arrayFormatSeparator)])}default:return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,Ln(o,r)]:[...i,[Ln(o,r),"=",Ln(c,r)].join("")]}}function El(r){let o;switch(r.arrayFormat){case"index":return(i,c,d)=>{if(o=/\[(\d*)]$/.exec(i),i=i.replace(/\[\d*]$/,""),!o){d[i]=c;return}d[i]===void 0&&(d[i]={}),d[i][o[1]]=c};case"bracket":return(i,c,d)=>{if(o=/(\[])$/.exec(i),i=i.replace(/\[]$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"colon-list-separator":return(i,c,d)=>{if(o=/(:list)$/.exec(i),i=i.replace(/:list$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"comma":case"separator":return(i,c,d)=>{const v=typeof c=="string"&&c.includes(r.arrayFormatSeparator),_=typeof c=="string"&&!v&&De(c,r).includes(r.arrayFormatSeparator);c=_?De(c,r):c;const I=v||_?c.split(r.arrayFormatSeparator).map(M=>De(M,r)):c===null?c:De(c,r);d[i]=I};case"bracket-separator":return(i,c,d)=>{const v=/(\[])$/.test(i);if(i=i.replace(/\[]$/,""),!v){d[i]=c&&De(c,r);return}const _=c===null?[]:De(c,r).split(r.arrayFormatSeparator);if(d[i]===void 0){d[i]=_;return}d[i]=[...d[i],..._]};default:return(i,c,d)=>{if(d[i]===void 0){d[i]=c;return}d[i]=[...[d[i]].flat(),c]}}}function Eo(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Ln(r,o){return o.encode?o.strict?ml(r):encodeURIComponent(r):r}function De(r,o){return o.decode?pl(r):r}function To(r){return Array.isArray(r)?r.sort():typeof r=="object"?To(Object.keys(r)).sort((o,i)=>Number(o)-Number(i)).map(o=>r[o]):r}function wo(r){const o=r.indexOf("#");return o!==-1&&(r=r.slice(0,o)),r}function Tl(r){let o="";const i=r.indexOf("#");return i!==-1&&(o=r.slice(i)),o}function Ao(r,o,i){return i==="string"&&typeof r=="string"?r:typeof i=="function"&&typeof r=="string"?i(r):i==="boolean"&&r===null?!0:i==="boolean"&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":i==="boolean"&&r!==null&&(r.toLowerCase()==="1"||r.toLowerCase()==="0")?r.toLowerCase()==="1":i==="string[]"&&o.arrayFormat!=="none"&&typeof r=="string"?[r]:i==="number[]"&&o.arrayFormat!=="none"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?[Number(r)]:i==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):o.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":o.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function gi(r){r=wo(r);const o=r.indexOf("?");return o===-1?"":r.slice(o+1)}function mi(r,o){o={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...o},Eo(o.arrayFormatSeparator);const i=El(o),c=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return c;for(const d of r.split("&")){if(d==="")continue;const v=o.decode?d.replaceAll("+"," "):d;let[_,I]=vo(v,"=");_===void 0&&(_=v),I=I===void 0?null:["comma","separator","bracket-separator"].includes(o.arrayFormat)?I:De(I,o),i(De(_,o),I,c)}for(const[d,v]of Object.entries(c))if(typeof v=="object"&&v!==null&&o.types[d]!=="string")for(const[_,I]of Object.entries(v)){const M=o.types[d]?o.types[d].replace("[]",""):void 0;v[_]=Ao(I,o,M)}else typeof v=="object"&&v!==null&&o.types[d]==="string"?c[d]=Object.values(v).join(o.arrayFormatSeparator):c[d]=Ao(v,o,o.types[d]);return o.sort===!1?c:(o.sort===!0?Object.keys(c).sort():Object.keys(c).sort(o.sort)).reduce((d,v)=>{const _=c[v];return d[v]=_&&typeof _=="object"&&!Array.isArray(_)?To(_):_,d},Object.create(null))}function yo(r,o){if(!r)return"";o={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...o},Eo(o.arrayFormatSeparator);const i=_=>o.skipNull&&gl(r[_])||o.skipEmptyString&&r[_]==="",c=vl(o),d={};for(const[_,I]of Object.entries(r))i(_)||(d[_]=I);const v=Object.keys(d);return o.sort!==!1&&v.sort(o.sort),v.map(_=>{const I=r[_];return I===void 0?"":I===null?Ln(_,o):Array.isArray(I)?I.length===0&&o.arrayFormat==="bracket-separator"?Ln(_,o)+"[]":I.reduce(c(_),[]).join("&"):Ln(_,o)+"="+Ln(I,o)}).filter(_=>_.length>0).join("&")}function Io(r,o){o={decode:!0,...o};let[i,c]=vo(r,"#");return i===void 0&&(i=r),{url:i?.split("?")?.[0]??"",query:mi(gi(r),o),...o&&o.parseFragmentIdentifier&&c?{fragmentIdentifier:De(c,o)}:{}}}function Lo(r,o){o={encode:!0,strict:!0,[_i]:!0,...o};const i=wo(r.url).split("?")[0]||"",c=gi(r.url),d={...mi(c,{sort:!1,...o}),...r.query};let v=yo(d,o);v&&=`?${v}`;let _=Tl(r.url);if(typeof r.fragmentIdentifier=="string"){const I=new URL(i);I.hash=r.fragmentIdentifier,_=o[_i]?I.hash:`#${r.fragmentIdentifier}`}return`${i}${v}${_}`}function Ro(r,o,i){i={parseFragmentIdentifier:!0,[_i]:!1,...i};const{url:c,query:d,fragmentIdentifier:v}=Io(r,i);return Lo({url:c,query:_l(d,o),fragmentIdentifier:v},i)}function wl(r,o,i){const c=Array.isArray(o)?d=>!o.includes(d):(d,v)=>!o(d,v);return Ro(r,c,i)}const Al=Object.freeze(Object.defineProperty({__proto__:null,exclude:wl,extract:gi,parse:mi,parseUrl:Io,pick:Ro,stringify:yo,stringifyUrl:Lo},Symbol.toStringTag,{value:"Module"}));class Gn extends Error{constructor(o,i){super(`HTTP Error ${o}${i?`: ${i}`:""}`),this.code=o,this.name="HttpError",Object.setPrototypeOf(this,Gn.prototype)}}var Rn=(r=>(r.GET="GET",r.PATCH="PATCH",r.POST="POST",r))(Rn||{});class Mo{constructor(){this.headers={}}setHeaders(o){this.headers=o}async get(o){try{const i=o.query?`${o.url}?${this.serializeQuery(o.query)}`:o.url,c=await fetch(i,{headers:{...this.headers,...o.headers,"Content-Type":"application/json"},...o.signal?{signal:o.signal}:{}});return c.ok?on(await c.json()):z(new Gn(c.status,await c.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async post(o){try{const i=await fetch(o.url,{method:"POST",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async patch(o){try{const i=await fetch(o.url,{method:"PATCH",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}serializeQuery(o){if(typeof o=="string")return o;if(typeof o=="object")for(const i in o)o[i]===void 0&&delete o[i];return o=Al.stringify(o,{arrayFormat:"none"}),o}}const Tr={accessToken:{email:"/v1/auth/accessToken/email",sso:{jwt:"/v1/auth/accessToken/sso/jwt"}},refreshAccessToken:"/v1/auth/accessToken~refresh",password:{reset:"/v1/auth/password~reset"}};var Oo=(r=>(r.TokensUpdated="auth:tokens-updated",r))(Oo||{});class Se extends EventTarget{constructor(){super(),this.accessToken=null,this.refreshToken=null}static getInstance(){return Se.instance||(Se.instance=new Se),Se.instance}async loginWithPassword(o,i){const c=await this.callApi({endpoint:Tr.accessToken.email,method:"POST",body:{email:o,password:i},withSpotId:!0});if(c.isErr())return z(c.error);const{accessToken:d,refreshToken:v}=c.value;return this.setTokens(d.token,v.token),on({accessToken:d.token,refreshToken:v.token})}async loginWithSsoToken(o){const i=await this.callApi({endpoint:Tr.accessToken.sso.jwt,method:"POST",body:{token:o},withSpotId:!0});if(i.isErr())return z(i.error);const{accessToken:c,refreshToken:d}=i.value;return this.setTokens(c.token,d.token),on({accessToken:c.token,refreshToken:d.token})}loginWithAuthTokens(o,i){return this.setTokens(o,i),{accessToken:o,refreshToken:i}}resetPassword(o){return this.callApi({endpoint:Tr.password.reset,method:"POST",body:{email:o}})}async refresh(){const o=await this.callApi({endpoint:Tr.refreshAccessToken,method:"POST",body:{refreshToken:this.refreshToken}});if(o.isErr())return z(o.error);const{accessToken:i,refreshToken:c}=o.value;return this.setTokens(i.token,c.token),on({accessToken:i.token,refreshToken:c.token})}async logout(){this.setTokens(null,null)}getAccessToken(){return this.accessToken}getRefreshToken(){return this.refreshToken}setTokens(o,i){if(this.accessToken!==o||this.refreshToken!==i){this.accessToken=o,this.refreshToken=i;const c=new CustomEvent("auth:tokens-updated",{detail:{accessToken:o,refreshToken:i}});this.dispatchEvent(c)}}async callApi(o){try{const{spotId:i,msApiBaseUrl:c}=ue.getConfiguration(),d=ur(o.endpoint,c),v={"Content-Type":"application/json",...o.headers};o.withSpotId&&i&&(v[Do.SpotId]=i);const _=await fetch(d,{method:o.method,body:o.body?JSON.stringify(o.body):void 0,headers:v});if(!_.ok)return z(new Gn(_.status,_.statusText));if(_.status===ie.NO_CONTENT)return on(void 0);const I=await _.json();return on(I)}catch(i){return z(new Gn(ie.INTERNAL_SERVER_ERROR,i instanceof Error?i.message:String(i)))}}}var Do=(r=>(r.Authorization="Authorization",r.SpotId="x-spotid",r))(Do||{});class oe{constructor(){this.queue=[],this.isProcessing=!1,this.isPaused=!1,this.authService=Se.getInstance(),this.httpService=new Mo}static getInstance(){return oe.instance||(oe.instance=new oe),oe.instance}static buildAuthenticatedRequest(o){const{msApiBaseUrl:i,spotId:c}=ue.getConfiguration(),d=ur(o,i),v=Se.getInstance().getAccessToken();if(!v)return z(new Error("Not authenticated"));const _={"Content-Type":"application/json",Authorization:`Bearer ${v}`};return c&&(_["x-spotid"]=c),on({url:d,headers:_})}static async stream(o,i,c){const{streamTransport:d}=ue.getConfiguration();if(d)return d({endpoint:o,body:i,signal:c});const v=oe.buildAuthenticatedRequest(o);if(v.isErr())return z(v.error);const{url:_,headers:I}=v.value;try{const M=await fetch(_,{method:"POST",headers:I,...i!==void 0?{body:JSON.stringify(i)}:{},...c?{signal:c}:{}});if(!M.ok){const K=await M.text();return z(new Error(`HTTP ${M.status}: ${K}`))}return M.body?on(M.body):z(new Error("Response body is empty"))}catch(M){const K=M instanceof Error?M.message:"Unknown error";return z(M instanceof Error?M:new Error(K))}}get pendingCount(){return this.queue.length}enqueue(o){return new Promise(i=>{const c=async()=>{try{const d=await o();i(d)}catch(d){i(z(new Gn(ie.INTERNAL_SERVER_ERROR,d instanceof Error?d.message:"Unknown error")))}};this.queue.push(c),this.processQueue()})}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;!this.isPaused&&this.queue.length>0;){const o=this.queue.shift();if(!o)break;await o()}}finally{this.isProcessing=!1,!this.isPaused&&this.queue.length>0&&Promise.resolve().then(()=>this.processQueue())}}}pauseQueue(){this.isPaused=!0}resumeQueue(){const o=this.isPaused;this.isPaused=!1,o&&this.processQueue()}async call(o){return this.enqueue(async()=>{const i=async()=>{const{spotId:d,msApiBaseUrl:v}=ue.getConfiguration(),_={...o.options?.headers??{}};d&&(_["x-spotid"]=d);const I=this.authService.getAccessToken(),{requiresAuth:M=!0}=o;if(!I&&M)return z(new Gn(ie.UNAUTHORIZED));I&&(_.Authorization=`Bearer ${I}`);const K=ur(o.endpoint,v);switch(o.method){case Rn.GET:return this.httpService.get({...o.options??{},headers:_,url:K});case Rn.PATCH:return this.httpService.patch({...o.options??{},headers:_,url:K});case Rn.POST:return this.httpService.post({...o.options??{},headers:_,url:K});default:return z(new Gn(ie.METHOD_NOT_ALLOWED,"Method not allowed"))}};let c=await i();if(c.isErr()&&c.error.code===ie.UNAUTHORIZED){const d=await this.authService.refresh();if(d.isErr())return z(new Gn(ie.UNAUTHORIZED,d.error.message));c=await i()}return c})}}const Ie={playbooks:"/v1/playbooks",pages:r=>`/v1/playbooks/${r}/pages`,hotspots:(r,o)=>`/v1/playbooks/${r}/pages/${o}/hotspots`,hotspot:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}`,accessibleIntents:(r,o)=>`/v1/playbooks/${r}/pages/${o}/accessibleIntents`,intents:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents`,intent:(r,o,i,c)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents/${c}`},wr=50;class et{static getInstance(){return et.instance||(et.instance=new et),et.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listPlaybooks(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.playbooks,options:{query:{page:o?.page??1,limit:o?.limit??wr,...o?.domain?{"domain[eq]":o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookPages(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.pages(o.playbookId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.url?{"url[eq]":o.url}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookPage(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.pages(o.playbookId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listAccessiblePlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.accessibleIntents(o.playbookId,o.pageId),options:{query:{...o.domain?{domain:o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookHotspots(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.intentStatus?{"intentStatus[eq]":o.intentStatus}:{},...o.widgetType?{"widgetType[eq]":o.widgetType}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.hotspot(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listPlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.status?{"status[eq]":o.status}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.intent(o.playbookId,o.pageId,o.hotspotId,o.intentId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}}const yl={me:"/v1/spots/me"},Il=50;class gt{static getInstance(){return gt.instance||(gt.instance=new gt),gt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listSpotsForMe(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:yl.me,options:{query:{page:1,limit:Il,...o?.spotMemberRole?{"spotMemberRole[eq]":o.spotMemberRole}:{}}}});return i.isErr()?z(i.error):on(i.value)}}const So={spotMember:{me:"/v1/spotMembers/me",joinFromSso:"/v1/spotMembers~joinFromSso"}};class tt{static getInstance(){return tt.instance||(tt.instance=new tt),tt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async getSpotMemberForMe(){const o=await this.meltingSpotApi.call({method:Rn.GET,endpoint:So.spotMember.me});return o.isErr()?z(o.error):on(o.value)}async joinFromSso(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:So.spotMember.joinFromSso,options:{payload:{token:o}}});return i.isErr()?z(i.error):on(i.value)}}const Ll={spotMemberSsoToken:"/v1/spotMembers/auth/sso/jwt"};class mt{static getInstance(){return mt.instance||(mt.instance=new mt),mt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async generateSsoToken(){const o=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ll.spotMemberSsoToken,options:{payload:{}}});return o.isErr()?z(o.error):on(o.value.token)}}class rt{static getInstance(){return rt.instance||(rt.instance=new rt),rt.instance}constructor(){this.spotMemberAuthApiService=mt.getInstance()}async generateSsoToken(){return this.spotMemberAuthApiService.generateSsoToken()}}class Rl{constructor(o){this.active=!1,this.lastObservedUrl=null,this.options={onRouteChange:o.onRouteChange,debounceMs:o.debounceMs??0,enableDeduplication:o.enableDeduplication??!0,enableDomMutationDetection:o.enableDomMutationDetection??!1,enableHistoryChange:o.enableHistoryChange??!0,enablePopState:o.enablePopState??!0,enableHashChange:o.enableHashChange??!0,enableLoad:o.enableLoad??!0,rootDocument:o.rootDocument}}start(){this.active||(this.active=!0,this.lastObservedUrl=null,this.options.enablePopState&&(this.popStateListener=()=>this.handleNavigationEvent("popstate"),window.addEventListener("popstate",this.popStateListener)),this.options.enableHashChange&&(this.hashChangeListener=()=>this.handleNavigationEvent("hashchange"),window.addEventListener("hashchange",this.hashChangeListener)),this.options.enableLoad&&(this.loadListener=()=>this.handleNavigationEvent("load"),window.addEventListener("load",this.loadListener)),this.options.enableDomMutationDetection&&(this.mutationObserver=new MutationObserver(()=>{this.handleNavigationEvent("locationchange")}),this.mutationObserver.observe(this.options.rootDocument??document,{childList:!0,subtree:!0})),this.options.enableHistoryChange&&this.patchHistoryListeners())}stop(){this.active&&(this.active=!1,this.debounceTimer!==void 0&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.popStateListener&&(window.removeEventListener("popstate",this.popStateListener),this.popStateListener=void 0),this.hashChangeListener&&(window.removeEventListener("hashchange",this.hashChangeListener),this.hashChangeListener=void 0),this.loadListener&&(window.removeEventListener("load",this.loadListener),this.loadListener=void 0),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=void 0),(this.originalPushState||this.originalReplaceState)&&this.restoreHistoryListeners(),this.lastObservedUrl=null)}handleNavigationEvent(o){if(!this.active)return;const i=window.location.href;this.options.enableDeduplication&&this.lastObservedUrl===i||(this.lastObservedUrl=i,this.options.debounceMs>0?(this.debounceTimer!==void 0&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=void 0,this.options.onRouteChange(i,o)},this.options.debounceMs)):this.options.onRouteChange(i,o))}patchHistoryListeners(){this.originalPushState=window.history.pushState,this.originalReplaceState=window.history.replaceState,window.history.pushState=(...o)=>{const i=this.originalPushState?.apply(window.history,o);return this.handleNavigationEvent("history.pushState"),i},window.history.replaceState=(...o)=>{const i=this.originalReplaceState?.apply(window.history,o);return this.handleNavigationEvent("history.replaceState"),i}}restoreHistoryListeners(){this.originalPushState&&(window.history.pushState=this.originalPushState,this.originalPushState=void 0),this.originalReplaceState&&(window.history.replaceState=this.originalReplaceState,this.originalReplaceState=void 0)}}const Ml={events:"/v1/analytics/events"};class vt{static getInstance(){return vt.instance||(vt.instance=new vt),vt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async appendEvent(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ml.events,options:{payload:o}});return i.isErr()?z(i.error):on(i.value)}}const Ol=r=>{const o=r.get("utm_source");if(o)return{source:o,medium:r.get("utm_medium")??void 0,campaign:r.get("utm_campaign")??void 0,term:r.get("utm_term")??void 0,content:r.get("utm_content")??void 0}},Dl=r=>r?Object.entries(r).reduce((o,[i,c])=>(c!=null&&(o[`utm_${i}`]=c),o),{}):{};var bo=(r=>(r.Active="Active",r.Closed="Closed",r.Expired="Expired",r))(bo||{}),xo=(r=>(r.User="User",r.Assistant="Assistant",r))(xo||{}),Uo=(r=>(r.Metadata="metadata",r.Token="token",r.Action="action",r.Bubble="bubble",r.Handoff="handoff",r.Done="done",r.Error="error",r))(Uo||{}),No=(r=>(r.NoSource="NoSource",r.LowConfidence="LowConfidence",r.HumanRequest="HumanRequest",r.OutOfScope="OutOfScope",r))(No||{}),$o=(r=>(r.PlaybookIntent="PlaybookIntent",r.UserInitiated="UserInitiated",r.Welcome="Welcome",r.Resume="Resume",r.Discover="Discover",r.Recommend="Recommend",r))($o||{}),Po=(r=>(r.ExtraExtraSmall="ExtraExtraSmall",r.ExtraSmall="ExtraSmall",r.Small="Small",r.Medium="Medium",r.Large="Large",r))(Po||{}),Co=(r=>(r.Dropdown="Dropdown",r.Inline="Inline",r.Overlay="Overlay",r))(Co||{}),Yo=(r=>(r.Left="Left",r.Right="Right",r))(Yo||{}),Fo=(r=>(r.Top="Top",r.Bottom="Bottom",r))(Fo||{}),Ho=(r=>(r.TopLeft="TopLeft",r.TopRight="TopRight",r.BottomLeft="BottomLeft",r.BottomRight="BottomRight",r))(Ho||{}),Bo=(r=>(r.Button="Button",r.Card="Card",r.CardInline="CardInline",r.Carousel="Carousel",r.Helper="Helper",r.ListOfContent="ListOfContent",r.ListOfContentInline="ListOfContentInline",r))(Bo||{}),Wo=(r=>(r.Inline="Inline",r.Modal="Modal",r.Drawer="Drawer",r))(Wo||{}),ko=(r=>(r.Self="Self",r.Parent="Parent",r.Top="Top",r))(ko||{}),Go=(r=>(r.Left="Left",r.Right="Right",r))(Go||{}),zo=(r=>(r.Body="Body",r.DOMSelector="DOMSelector",r))(zo||{}),qo=(r=>(r.After="After",r.AppendChild="AppendChild",r.Before="Before",r.PrependChild="PrependChild",r))(qo||{}),Ko=(r=>(r.CSSSelector="CSSSelector",r.Slot="Slot",r))(Ko||{}),Qo=(r=>(r.Element="Element",r.WebComponent="WebComponent",r))(Qo||{}),Zo=(r=>(r.Inline="Inline",r.Flex="Flex",r))(Zo||{}),Jo=(r=>(r.Horizontal="Horizontal",r.Vertical="Vertical",r))(Jo||{}),Vo=(r=>(r.Start="Start",r.Center="Center",r.End="End",r.Stretch="Stretch",r.Baseline="Baseline",r))(Vo||{}),Xo=(r=>(r.Course="Course",r.Live="Live",r.Link="Link",r.Page="Page",r))(Xo||{}),jo=(r=>(r.Workshop="Workshop",r.Conference="Conference",r))(jo||{}),ns=(r=>(r.Ended="Ended",r.Planned="Planned",r.Live="Live",r))(ns||{}),es=(r=>(r.CloseA="CloseA",r.CloseB="CloseB",r.Later="Later",r))(es||{});const Sl="a",bl="mention_input",xl="mention",Ul="var",Nl="p",$l="h1",Pl="h2",Cl="h3",Yl="blockquote",Fl="layout",Hl="layout-column",Bl="ul",Wl="ol",kl="lic",Gl="li",zl="img",ql="iframely",Kl="code_block",Ql="code_line";var ts=(r=>(r.Element="Element",r.FullPage="FullPage",r))(ts||{}),rs=(r=>(r.Draft="Draft",r.Pending="Pending",r.Published="Published",r))(rs||{}),is=(r=>(r.Beacon="Beacon",r.List="List",r))(is||{}),vi=(r=>(r.Channel="Channel",r.Collection="Collection",r.Course="Course",r.Discussion="Discussion",r.Forum="Forum",r.Link="Link",r.Live="Live",r.LearningPath="LearningPath",r.Page="Page",r.RichText="RichText",r.Topic="Topic",r))(vi||{});function Zl(r){return Object.values(vi).includes(r)}const us=ue.getInstance(),os=Se.getInstance(),ss=rt.getInstance(),as={Playbook:et.getInstance(),Spot:gt.getInstance(),SpotMember:tt.getInstance()},Et=globalThis;Et.MeltingSpot||(Et.MeltingSpot={}),Et.MeltingSpot.Configuration=us,Et.MeltingSpot.Auth=os,Et.MeltingSpot.Sso=ss,Et.MeltingSpot.Api=as,y.ATTRIBUTE_BLOCKQUOTE=Yl,y.ATTRIBUTE_CODE_BLOCK=Kl,y.ATTRIBUTE_CODE_LINE=Ql,y.ATTRIBUTE_H1=$l,y.ATTRIBUTE_H2=Pl,y.ATTRIBUTE_H3=Cl,y.ATTRIBUTE_IFRAMELY=ql,y.ATTRIBUTE_IMAGE=zl,y.ATTRIBUTE_LAYOUT=Fl,y.ATTRIBUTE_LAYOUT_COLUMN=Hl,y.ATTRIBUTE_LI=Gl,y.ATTRIBUTE_LIC=kl,y.ATTRIBUTE_LINK=Sl,y.ATTRIBUTE_MENTION=xl,y.ATTRIBUTE_MENTION_INPUT=bl,y.ATTRIBUTE_OL=Wl,y.ATTRIBUTE_PARAGRAPH=Nl,y.ATTRIBUTE_UL=Bl,y.ATTRIBUTE_VARIABLE=Ul,y.AnalyticsApiService=vt,y.Api=as,y.Auth=os,y.AuthService=Se,y.AuthServiceEvents=Oo,y.BeaconIntegrationType=Co,y.BeaconRenderType=Bo,y.ButtonBeaconSize=Po,y.Configuration=us,y.ConfigurationService=ue,y.ConversationMessageRole=xo,y.ConversationSseEventType=Uo,y.ConversationStatus=bo,y.DEFAULT_PERMISSION_POLICIES=Ku,y.DateFormat=co,y.DrawerWidgetPosition=Go,y.DropdownBeaconHorizontalPosition=Yo,y.DropdownBeaconVerticalPosition=Fo,y.HttpMethods=Rn,y.HttpService=Mo,y.LastActionState=es,y.LearningPathContentType=Xo,y.LiveBuiltInType=jo,y.LiveStatus=ns,y.Logger=ho,y.MeltingSpotApi=oe,y.MeltyHandoffReason=No,y.OverlayBeaconPosition=Ho,y.PLAYBOOK_EDITOR_ACTIVE_EVENT=di,y.PlaybookApiService=et,y.PlaybookEditorAwareLifecycle=rl,y.PlaybookHotspotLocation=ts,y.PlaybookIntentStatus=rs,y.PlaybookIntentWidgetMode=is,y.PlaybookPageMatchingOperator=_e,y.RouteChangeDetector=Rl,y.SpotMemberApiService=tt,y.SpotWidgetContentType=vi,y.Sso=ss,y.SsoService=rt,y.TouchPointAnchorType=zo,y.TouchPointDOMInjectionPosition=qo,y.TouchPointDOMSelectorCssStepMode=Qo,y.TouchPointDOMSelectorPathStepType=Ko,y.TouchPointFlexAlign=Vo,y.TouchPointFlexDirection=Jo,y.TouchPointLayoutType=Zo,y.TriggerType=$o,y.WidgetInjectionTarget=ko,y.WidgetInjectionType=Wo,y.createDialog=Qf,y.createIframe=Zf,y.createIsolatedShadowHost=Jf,y.dayjs=_t,y.flattenUtmParameters=Dl,y.formatBaseUrl=cl,y.formatDate=Gc,y.formatDeeplink=al,y.formatUUID=ol,y.getHTMLElement=Kf,y.getTimeInfoWithStartAndEndDate=Sc,y.isPlaybookEditorActive=lo,y.isSpotWidgetContentType=Zl,y.isTouchDevice=Vf,y.matchesDomain=nl,y.parseUtmParameters=Ol,y.sanitizeUrl=ur,y.setLoggerDebugMode=ul,y.testUrlMatching=Xc,y.trimSlashLeft=zu,y.trimSlashRight=qu,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
33
+ }`;var J=Cf(function(){return sn(f,U+"return "+A).apply(i,l)});if(J.source=A,Du(J))throw J;return J}function Hv(n){return fn(n).toLowerCase()}function Bv(n){return fn(n).toUpperCase()}function Wv(n,e,t){if(n=fn(n),n&&(t||e===i))return zs(n);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Te(e),f=qs(u,s),l=Ks(u,s)+1;return Ze(u,f,l).join("")}function kv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.slice(0,Zs(n)+1);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Ks(u,Te(e))+1;return Ze(u,0,s).join("")}function Gv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.replace(Di,"");if(!n||!(e=ne(e)))return n;var u=Te(n),s=qs(u,Te(e));return Ze(u,s).join("")}function zv(n,e){var t=ln,u=rn;if(Tn(e)){var s="separator"in e?e.separator:s;t="length"in e?Q(e.length):t,u="omission"in e?ne(e.omission):u}n=fn(n);var f=n.length;if(It(n)){var l=Te(n);f=l.length}if(t>=f)return n;var h=t-Lt(u);if(h<1)return u;var g=l?Ze(l,0,h).join(""):n.slice(0,h);if(s===i)return g+u;if(l&&(h+=g.length-h),Su(s)){if(n.slice(h).search(s)){var T,w=g;for(s.global||(s=qi(s.source,fn(ds.exec(s))+"g")),s.lastIndex=0;T=s.exec(w);)var A=T.index;g=g.slice(0,A===i?h:A)}}else if(n.indexOf(ne(s),h)!=h){var R=g.lastIndexOf(s);R>-1&&(g=g.slice(0,R))}return g+u}function qv(n){return n=fn(n),n&&rh.test(n)?n.replace(cs,wd):n}var Kv=xt(function(n,e,t){return n+(t?" ":"")+e.toUpperCase()}),Uu=Ca("toUpperCase");function Pf(n,e,t){return n=fn(n),e=t?i:e,e===i?gd(n)?Id(n):sd(n):n.match(e)||[]}var Cf=V(function(n,e){try{return Xn(n,i,e)}catch(t){return Du(t)?t:new W(t)}}),Qv=Ce(function(n,e){return ae(e,function(t){t=Oe(t),$e(n,t,Mu(n[t],n))}),n});function Zv(n){var e=n==null?0:n.length,t=N();return n=e?gn(n,function(u){if(typeof u[1]!="function")throw new fe(_);return[t(u[0]),u[1]]}):[],V(function(u){for(var s=-1;++s<e;){var f=n[s];if(Xn(f[0],this,u))return Xn(f[1],this,u)}})}function Jv(n){return wp(le(n,H))}function Nu(n){return function(){return n}}function Vv(n,e){return n==null||n!==n?e:n}var Xv=Fa(),jv=Fa(!0);function Qn(n){return n}function $u(n){return _a(typeof n=="function"?n:le(n,H))}function n0(n){return ma(le(n,H))}function e0(n,e){return va(n,le(e,H))}var t0=V(function(n,e){return function(t){return Vt(t,n,e)}}),r0=V(function(n,e){return function(t){return Vt(n,t,e)}});function Pu(n,e,t){var u=Un(e),s=qr(e,u);t==null&&!(Tn(e)&&(s.length||!u.length))&&(t=e,e=n,n=this,s=qr(e,Un(e)));var f=!(Tn(t)&&"chain"in t)||!!t.chain,l=Fe(n);return ae(s,function(h){var g=e[h];n[h]=g,l&&(n.prototype[h]=function(){var T=this.__chain__;if(f||T){var w=n(this.__wrapped__),A=w.__actions__=zn(this.__actions__);return A.push({func:g,args:arguments,thisArg:n}),w.__chain__=T,w}return g.apply(n,ke([this.value()],arguments))})}),n}function i0(){return Pn._===this&&(Pn._=Sd),this}function Cu(){}function u0(n){return n=Q(n),V(function(e){return Ea(e,n)})}var o0=pu(gn),s0=pu(Hs),a0=pu(Fi);function Yf(n){return wu(n)?Hi(Oe(n)):Yp(n)}function f0(n){return function(e){return n==null?i:ct(n,e)}}var c0=Ba(),l0=Ba(!0);function Yu(){return[]}function Fu(){return!1}function h0(){return{}}function d0(){return""}function p0(){return!0}function _0(n,e){if(n=Q(n),n<1||n>L)return[];var t=X,u=Fn(n,X);e=N(e),n-=X;for(var s=ki(u,e);++t<n;)e(t);return s}function g0(n){return G(n)?gn(n,Oe):ee(n)?[n]:zn(rf(fn(n)))}function m0(n){var e=++Od;return fn(n)+e}var v0=Xr(function(n,e){return n+e},0),E0=_u("ceil"),T0=Xr(function(n,e){return n/e},1),w0=_u("floor");function A0(n){return n&&n.length?zr(n,Qn,nu):i}function y0(n,e){return n&&n.length?zr(n,N(e,2),nu):i}function I0(n){return ks(n,Qn)}function L0(n,e){return ks(n,N(e,2))}function R0(n){return n&&n.length?zr(n,Qn,iu):i}function M0(n,e){return n&&n.length?zr(n,N(e,2),iu):i}var O0=Xr(function(n,e){return n*e},1),D0=_u("round"),S0=Xr(function(n,e){return n-e},0);function b0(n){return n&&n.length?Wi(n,Qn):0}function x0(n,e){return n&&n.length?Wi(n,N(e,2)):0}return a.after=nm,a.ary=_f,a.assign=Bm,a.assignIn=Df,a.assignInWith=li,a.assignWith=Wm,a.at=km,a.before=gf,a.bind=Mu,a.bindAll=Qv,a.bindKey=mf,a.castArray=hm,a.chain=hf,a.chunk=w_,a.compact=A_,a.concat=y_,a.cond=Zv,a.conforms=Jv,a.constant=Nu,a.countBy=bg,a.create=Gm,a.curry=vf,a.curryRight=Ef,a.debounce=Tf,a.defaults=zm,a.defaultsDeep=qm,a.defer=em,a.delay=tm,a.difference=I_,a.differenceBy=L_,a.differenceWith=R_,a.drop=M_,a.dropRight=O_,a.dropRightWhile=D_,a.dropWhile=S_,a.fill=b_,a.filter=Ug,a.flatMap=Pg,a.flatMapDeep=Cg,a.flatMapDepth=Yg,a.flatten=af,a.flattenDeep=x_,a.flattenDepth=U_,a.flip=rm,a.flow=Xv,a.flowRight=jv,a.fromPairs=N_,a.functions=jm,a.functionsIn=nv,a.groupBy=Fg,a.initial=P_,a.intersection=C_,a.intersectionBy=Y_,a.intersectionWith=F_,a.invert=tv,a.invertBy=rv,a.invokeMap=Bg,a.iteratee=$u,a.keyBy=Wg,a.keys=Un,a.keysIn=Kn,a.map=ui,a.mapKeys=uv,a.mapValues=ov,a.matches=n0,a.matchesProperty=e0,a.memoize=si,a.merge=sv,a.mergeWith=Sf,a.method=t0,a.methodOf=r0,a.mixin=Pu,a.negate=ai,a.nthArg=u0,a.omit=av,a.omitBy=fv,a.once=im,a.orderBy=kg,a.over=o0,a.overArgs=um,a.overEvery=s0,a.overSome=a0,a.partial=Ou,a.partialRight=wf,a.partition=Gg,a.pick=cv,a.pickBy=bf,a.property=Yf,a.propertyOf=f0,a.pull=k_,a.pullAll=cf,a.pullAllBy=G_,a.pullAllWith=z_,a.pullAt=q_,a.range=c0,a.rangeRight=l0,a.rearg=om,a.reject=Kg,a.remove=K_,a.rest=sm,a.reverse=Lu,a.sampleSize=Zg,a.set=hv,a.setWith=dv,a.shuffle=Jg,a.slice=Q_,a.sortBy=jg,a.sortedUniq=eg,a.sortedUniqBy=tg,a.split=Pv,a.spread=am,a.tail=rg,a.take=ig,a.takeRight=ug,a.takeRightWhile=og,a.takeWhile=sg,a.tap=Ag,a.throttle=fm,a.thru=ii,a.toArray=Rf,a.toPairs=xf,a.toPairsIn=Uf,a.toPath=g0,a.toPlainObject=Of,a.transform=pv,a.unary=cm,a.union=ag,a.unionBy=fg,a.unionWith=cg,a.uniq=lg,a.uniqBy=hg,a.uniqWith=dg,a.unset=_v,a.unzip=Ru,a.unzipWith=lf,a.update=gv,a.updateWith=mv,a.values=$t,a.valuesIn=vv,a.without=pg,a.words=Pf,a.wrap=lm,a.xor=_g,a.xorBy=gg,a.xorWith=mg,a.zip=vg,a.zipObject=Eg,a.zipObjectDeep=Tg,a.zipWith=wg,a.entries=xf,a.entriesIn=Uf,a.extend=Df,a.extendWith=li,Pu(a,a),a.add=v0,a.attempt=Cf,a.camelCase=Av,a.capitalize=Nf,a.ceil=E0,a.clamp=Ev,a.clone=dm,a.cloneDeep=_m,a.cloneDeepWith=gm,a.cloneWith=pm,a.conformsTo=mm,a.deburr=$f,a.defaultTo=Vv,a.divide=T0,a.endsWith=yv,a.eq=Ae,a.escape=Iv,a.escapeRegExp=Lv,a.every=xg,a.find=Ng,a.findIndex=of,a.findKey=Km,a.findLast=$g,a.findLastIndex=sf,a.findLastKey=Qm,a.floor=w0,a.forEach=df,a.forEachRight=pf,a.forIn=Zm,a.forInRight=Jm,a.forOwn=Vm,a.forOwnRight=Xm,a.get=bu,a.gt=vm,a.gte=Em,a.has=ev,a.hasIn=xu,a.head=ff,a.identity=Qn,a.includes=Hg,a.indexOf=$_,a.inRange=Tv,a.invoke=iv,a.isArguments=dt,a.isArray=G,a.isArrayBuffer=Tm,a.isArrayLike=qn,a.isArrayLikeObject=yn,a.isBoolean=wm,a.isBuffer=Je,a.isDate=Am,a.isElement=ym,a.isEmpty=Im,a.isEqual=Lm,a.isEqualWith=Rm,a.isError=Du,a.isFinite=Mm,a.isFunction=Fe,a.isInteger=Af,a.isLength=fi,a.isMap=yf,a.isMatch=Om,a.isMatchWith=Dm,a.isNaN=Sm,a.isNative=bm,a.isNil=Um,a.isNull=xm,a.isNumber=If,a.isObject=Tn,a.isObjectLike=wn,a.isPlainObject=rr,a.isRegExp=Su,a.isSafeInteger=Nm,a.isSet=Lf,a.isString=ci,a.isSymbol=ee,a.isTypedArray=Nt,a.isUndefined=$m,a.isWeakMap=Pm,a.isWeakSet=Cm,a.join=H_,a.kebabCase=Rv,a.last=de,a.lastIndexOf=B_,a.lowerCase=Mv,a.lowerFirst=Ov,a.lt=Ym,a.lte=Fm,a.max=A0,a.maxBy=y0,a.mean=I0,a.meanBy=L0,a.min=R0,a.minBy=M0,a.stubArray=Yu,a.stubFalse=Fu,a.stubObject=h0,a.stubString=d0,a.stubTrue=p0,a.multiply=O0,a.nth=W_,a.noConflict=i0,a.noop=Cu,a.now=oi,a.pad=Dv,a.padEnd=Sv,a.padStart=bv,a.parseInt=xv,a.random=wv,a.reduce=zg,a.reduceRight=qg,a.repeat=Uv,a.replace=Nv,a.result=lv,a.round=D0,a.runInContext=p,a.sample=Qg,a.size=Vg,a.snakeCase=$v,a.some=Xg,a.sortedIndex=Z_,a.sortedIndexBy=J_,a.sortedIndexOf=V_,a.sortedLastIndex=X_,a.sortedLastIndexBy=j_,a.sortedLastIndexOf=ng,a.startCase=Cv,a.startsWith=Yv,a.subtract=S0,a.sum=b0,a.sumBy=x0,a.template=Fv,a.times=_0,a.toFinite=He,a.toInteger=Q,a.toLength=Mf,a.toLower=Hv,a.toNumber=pe,a.toSafeInteger=Hm,a.toString=fn,a.toUpper=Bv,a.trim=Wv,a.trimEnd=kv,a.trimStart=Gv,a.truncate=zv,a.unescape=qv,a.uniqueId=m0,a.upperCase=Kv,a.upperFirst=Uu,a.each=df,a.eachRight=pf,a.first=ff,Pu(a,(function(){var n={};return Re(a,function(e,t){cn.call(a.prototype,t)||(n[t]=e)}),n})(),{chain:!1}),a.VERSION=c,ae(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){a[n].placeholder=a}),ae(["drop","take"],function(n,e){nn.prototype[n]=function(t){t=t===i?1:bn(Q(t),0);var u=this.__filtered__&&!e?new nn(this):this.clone();return u.__filtered__?u.__takeCount__=Fn(t,u.__takeCount__):u.__views__.push({size:Fn(t,X),type:n+(u.__dir__<0?"Right":"")}),u},nn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),ae(["filter","map","takeWhile"],function(n,e){var t=e+1,u=t==Y||t==O;nn.prototype[n]=function(s){var f=this.clone();return f.__iteratees__.push({iteratee:N(s,3),type:t}),f.__filtered__=f.__filtered__||u,f}}),ae(["head","last"],function(n,e){var t="take"+(e?"Right":"");nn.prototype[n]=function(){return this[t](1).value()[0]}}),ae(["initial","tail"],function(n,e){var t="drop"+(e?"":"Right");nn.prototype[n]=function(){return this.__filtered__?new nn(this):this[t](1)}}),nn.prototype.compact=function(){return this.filter(Qn)},nn.prototype.find=function(n){return this.filter(n).head()},nn.prototype.findLast=function(n){return this.reverse().find(n)},nn.prototype.invokeMap=V(function(n,e){return typeof n=="function"?new nn(this):this.map(function(t){return Vt(t,n,e)})}),nn.prototype.reject=function(n){return this.filter(ai(N(n)))},nn.prototype.slice=function(n,e){n=Q(n);var t=this;return t.__filtered__&&(n>0||e<0)?new nn(t):(n<0?t=t.takeRight(-n):n&&(t=t.drop(n)),e!==i&&(e=Q(e),t=e<0?t.dropRight(-e):t.take(e-n)),t)},nn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},nn.prototype.toArray=function(){return this.take(X)},Re(nn.prototype,function(n,e){var t=/^(?:filter|find|map|reject)|While$/.test(e),u=/^(?:head|last)$/.test(e),s=a[u?"take"+(e=="last"?"Right":""):e],f=u||/^find/.test(e);s&&(a.prototype[e]=function(){var l=this.__wrapped__,h=u?[1]:arguments,g=l instanceof nn,T=h[0],w=g||G(l),A=function(j){var tn=s.apply(a,ke([j],h));return u&&R?tn[0]:tn};w&&t&&typeof T=="function"&&T.length!=1&&(g=w=!1);var R=this.__chain__,U=!!this.__actions__.length,$=f&&!R,J=g&&!U;if(!f&&w){l=J?l:new nn(this);var P=n.apply(l,h);return P.__actions__.push({func:ii,args:[A],thisArg:i}),new ce(P,R)}return $&&J?n.apply(this,h):(P=this.thru(A),$?u?P.value()[0]:P.value():P)})}),ae(["pop","push","shift","sort","splice","unshift"],function(n){var e=Sr[n],t=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",u=/^(?:pop|shift)$/.test(n);a.prototype[n]=function(){var s=arguments;if(u&&!this.__chain__){var f=this.value();return e.apply(G(f)?f:[],s)}return this[t](function(l){return e.apply(G(l)?l:[],s)})}}),Re(nn.prototype,function(n,e){var t=a[e];if(t){var u=t.name+"";cn.call(Dt,u)||(Dt[u]=[]),Dt[u].push({name:e,func:t})}}),Dt[Vr(i,dn).name]=[{name:"wrapper",func:i}],nn.prototype.clone=qd,nn.prototype.reverse=Kd,nn.prototype.value=Qd,a.prototype.at=yg,a.prototype.chain=Ig,a.prototype.commit=Lg,a.prototype.next=Rg,a.prototype.plant=Og,a.prototype.reverse=Dg,a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=Sg,a.prototype.first=a.prototype.head,Gt&&(a.prototype[Gt]=Mg),a}),Rt=Ld();ut?((ut.exports=Rt)._=Rt,$i._=Rt):Pn._=Rt}).call(Pc)})(Ct,Ct.exports)),Ct.exports}var Yc=Cc();const so=pt(Yc),ao=(r,o)=>{switch(o){case"fr":case"it":return so.capitalize(r.format("dddd D MMMM"));case"es":return so.capitalize(r.format("dddd D [de] MMMM"));case"de":return r.format("dddd, D. MMMM");default:return r.format("dddd, MMMM Do")}},fo=r=>r.format("LT"),Fc=(r,o)=>{const i=ao(r,o),c=fo(r);switch(o){case"fr":return`${i} à ${c}`;case"it":return`${i} alle ${c}`;case"es":return`${i} a las ${c}`;case"de":return`${i} um ${c}`;default:return`${i} at ${c}`}},Hc=r=>r.format("ll"),Bc=(r,o)=>{switch(o){case"fr":case"de":case"it":return r.format("HH:mm");case"es":return r.format("H:mm");default:return r.format("h:mm")}},Wc=r=>r.format("L"),kc=r=>r.format("L LT");var co=(r=>(r.SimpleDate="SimpleDate",r.SimpleDateTime="SimpleDateTime",r.ExtraShortDate="ExtraShortDate",r.InlineExtraShortDate="InlineExtraShortDate",r.ShortDate="ShortDate",r.InlineShortDate="InlineShortDate",r.Date="Date",r.LongDate="LongDate",r.LongDateTime="LongDateTime",r.ShortTime="ShortTime",r.Time="Time",r.DateTime="DateTime",r))(co||{});const Gc=(r,o,i,c)=>{let d=_t(r);c&&(d=d.tz(c)),i&&(d=d.locale(i));const v=d.locale();switch(o){case"SimpleDate":return Wc(d);case"SimpleDateTime":return kc(d);case"ExtraShortDate":return Uc(d,v);case"InlineExtraShortDate":return Nc(d,v);case"ShortDate":return Hc(d);case"InlineShortDate":return $c(d,v);case"Date":return bc(d);case"LongDate":return ao(d,v);case"LongDateTime":return Fc(d,v);case"ShortTime":return Bc(d,v);case"Time":return fo(d);case"DateTime":return xc(d)}};var _e=(r=>(r.Contains="Contains",r.DoesntContain="DoesntContain",r.DoesntEndWith="DoesntEndWith",r.DoesntEqual="DoesntEqual",r.DoesntStartWith="DoesntStartWith",r.EndsWith="EndsWith",r.Equals="Equals",r.MatchesRegex="MatchesRegex",r.StartsWith="StartsWith",r))(_e||{});const zc="http://_meltingspot.local",qc=200,Kc=/(\([^()]*[+*][^()]*\))[+*]/,Qc=r=>r.length<=qc&&!Kc.test(r),Zc=r=>{try{const o=new URL(r,zc);return`${o.pathname}${o.search}${o.hash}`}catch{return r}},Er=r=>r.startsWith("/")?r:`/${r}`,Jc=(r,o)=>{switch(o.operator){case _e.MatchesRegex:if(!Qc(o.value))return!1;try{return new RegExp(o.value).test(r)}catch{return!1}case _e.StartsWith:return r.startsWith(Er(o.value));case _e.DoesntStartWith:return!r.startsWith(Er(o.value));case _e.EndsWith:return r.endsWith(o.value);case _e.DoesntEndWith:return!r.endsWith(o.value);case _e.Contains:return r.includes(o.value);case _e.DoesntContain:return!r.includes(o.value);case _e.Equals:return r===Er(o.value);case _e.DoesntEqual:return r!==Er(o.value)}},Vc=(r,o)=>{const i=o.rules.map(c=>Jc(r,c));return o.ruleOperator==="AND"?i.every(Boolean):i.some(Boolean)},Xc=(r,o)=>{const i=Zc(r),c=o.blocks.map(d=>Vc(i,d));return o.blockOperator==="AND"?c.every(Boolean):c.some(Boolean)},jc=r=>r.replace(/^https?:\/\//,""),nl=(r,o)=>{const i=jc(o);try{const c=new URL(r);return c.hostname===i||c.hostname.endsWith(`.${i}`)}catch{return!1}},el="data-meltingspot-playbook-editor-active",di="meltingspot:playbook-editor:active-changed",tl=()=>typeof document<"u"&&typeof document.dispatchEvent=="function",lo=()=>tl()?document.documentElement.getAttribute(el)==="true":!1;class rl{constructor(){this.listener=null,this.lastOptions=null,this.chain=Promise.resolve()}enqueue(o){const i=this.chain.then(o);return this.chain=i.catch(()=>{}),i}get isBound(){return this.listener!==null}bind(o){if(this.listener!==null||typeof document>"u")return;const i=()=>{if(lo()){Promise.resolve().then(()=>o.onEditorActive()).catch(d=>{console.warn("[playbook-editor] onEditorActive callback failed",d)});return}const c=this.lastOptions;c!==null&&Promise.resolve().then(()=>o.onEditorInactive(c)).catch(d=>{console.warn("[playbook-editor] onEditorInactive callback failed",d)})};document.addEventListener(di,i),this.listener=i}cacheOptions(o){this.lastOptions=o}clearOptions(){this.lastOptions=null}unbind(){this.listener!==null&&typeof document<"u"&&document.removeEventListener(di,this.listener),this.listener=null,this.lastOptions=null}}const il="1.5.0";class ho{constructor(o){this.debug=!1,this.debug=o?.debug??!1,this.appName=o?.appName,this.appVersion=o?.appVersion}log(o,...i){this.debug&&this.print(o,"info",i)}warn(o,...i){this.print(o,"warn",i)}error(o,...i){this.print(o,"error",i)}print(o,i,c){const _=[`[${["MeltingSpot",this.appName,this.appVersion].filter(Boolean).join(" - ")}] ${o}`];c.length&&_.push(...c),console[i](..._)}}const po=new ho({appName:"Core SDK",appVersion:il}),ul=r=>{po.debug=r},ol=r=>r.toLowerCase().replace(/[^a-z0-9-]/g,""),sl=["/user"],al=({deeplink:r,spotId:o})=>{try{const i=new URL(r,"https://unused.com");let c=i.pathname;return i.search&&(c+=i.search),i.hash&&(c+=i.hash),sl.some(d=>c.startsWith(d))||(c=`/spot/${o}/${zu(c)}`),c}catch(i){return po.warn("Failed to parse deeplink URL",i),null}},fl=[/(^|\.)meltingspot\.io$/i],cl=r=>{let o;try{const v=qu(r);o=new URL(v)}catch{throw new Error(`Invalid baseURL: ${r}`)}const i=o.hostname==="localhost"||o.hostname==="127.0.0.1",c=o.protocol==="https:",d=fl.some(v=>v.test(o.hostname));if(!i&&(!c||!d))throw new Error(`Untrusted baseURL origin: ${o.origin}`);return o.origin},ll={msApiBaseUrl:"https://openapi.meltingspot.io/",msCommunityWebBaseUrl:"https://go.meltingspot.io/",ssoToken:void 0,spotId:"",autoJoin:!1,rootDocument:globalThis.document};class ue{constructor(){this.configuration=ll}static getInstance(){return ue.instance||(ue.instance=new ue),ue.instance}setConfiguration(o){this.configuration={...this.configuration,...o}}static getConfiguration(o={}){return{...ue.getInstance().configuration,...o}}}const _o="%[a-f0-9]{2}",go=new RegExp("("+_o+")|([^%]+?)","gi"),mo=new RegExp("("+_o+")+","gi");function pi(r,o){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;o=o||1;const i=r.slice(0,o),c=r.slice(o);return Array.prototype.concat.call([],pi(i),pi(c))}function hl(r){try{return decodeURIComponent(r)}catch{let o=r.match(go)||[];for(let i=1;i<o.length;i++)r=pi(o,i).join(""),o=r.match(go)||[];return r}}function dl(r){const o={"%FE%FF":"��","%FF%FE":"��"};let i=mo.exec(r);for(;i;){try{o[i[0]]=decodeURIComponent(i[0])}catch{const d=hl(i[0]);d!==i[0]&&(o[i[0]]=d)}i=mo.exec(r)}o["%C2"]="�";const c=Object.keys(o);for(const d of c)r=r.replace(new RegExp(d,"g"),o[d]);return r}function pl(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return dl(r)}}function _l(r,o){const i={};if(Array.isArray(o))for(const c of o){const d=Object.getOwnPropertyDescriptor(r,c);d?.enumerable&&Object.defineProperty(i,c,d)}else for(const c of Reflect.ownKeys(r)){const d=Object.getOwnPropertyDescriptor(r,c);if(d.enumerable){const v=r[c];o(c,v,r)&&Object.defineProperty(i,c,d)}}return i}function vo(r,o){if(!(typeof r=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||o==="")return[];const i=r.indexOf(o);return i===-1?[]:[r.slice(0,i),r.slice(i+o.length)]}const gl=r=>r==null,ml=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),_i=Symbol("encodeFragmentIdentifier");function vl(r){switch(r.arrayFormat){case"index":return o=>(i,c)=>{const d=i.length;return c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[",d,"]"].join("")]:[...i,[Ln(o,r),"[",Ln(d,r),"]=",Ln(c,r)].join("")]};case"bracket":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[]"].join("")]:[...i,[Ln(o,r),"[]=",Ln(c,r)].join("")];case"colon-list-separator":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),":list="].join("")]:[...i,[Ln(o,r),":list=",Ln(c,r)].join("")];case"comma":case"separator":case"bracket-separator":{const o=r.arrayFormat==="bracket-separator"?"[]=":"=";return i=>(c,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?c:(d=d===null?"":d,c.length===0?[[Ln(i,r),o,Ln(d,r)].join("")]:[[c,Ln(d,r)].join(r.arrayFormatSeparator)])}default:return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,Ln(o,r)]:[...i,[Ln(o,r),"=",Ln(c,r)].join("")]}}function El(r){let o;switch(r.arrayFormat){case"index":return(i,c,d)=>{if(o=/\[(\d*)]$/.exec(i),i=i.replace(/\[\d*]$/,""),!o){d[i]=c;return}d[i]===void 0&&(d[i]={}),d[i][o[1]]=c};case"bracket":return(i,c,d)=>{if(o=/(\[])$/.exec(i),i=i.replace(/\[]$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"colon-list-separator":return(i,c,d)=>{if(o=/(:list)$/.exec(i),i=i.replace(/:list$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"comma":case"separator":return(i,c,d)=>{const v=typeof c=="string"&&c.includes(r.arrayFormatSeparator),_=typeof c=="string"&&!v&&De(c,r).includes(r.arrayFormatSeparator);c=_?De(c,r):c;const I=v||_?c.split(r.arrayFormatSeparator).map(M=>De(M,r)):c===null?c:De(c,r);d[i]=I};case"bracket-separator":return(i,c,d)=>{const v=/(\[])$/.test(i);if(i=i.replace(/\[]$/,""),!v){d[i]=c&&De(c,r);return}const _=c===null?[]:De(c,r).split(r.arrayFormatSeparator);if(d[i]===void 0){d[i]=_;return}d[i]=[...d[i],..._]};default:return(i,c,d)=>{if(d[i]===void 0){d[i]=c;return}d[i]=[...[d[i]].flat(),c]}}}function Eo(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Ln(r,o){return o.encode?o.strict?ml(r):encodeURIComponent(r):r}function De(r,o){return o.decode?pl(r):r}function To(r){return Array.isArray(r)?r.sort():typeof r=="object"?To(Object.keys(r)).sort((o,i)=>Number(o)-Number(i)).map(o=>r[o]):r}function wo(r){const o=r.indexOf("#");return o!==-1&&(r=r.slice(0,o)),r}function Tl(r){let o="";const i=r.indexOf("#");return i!==-1&&(o=r.slice(i)),o}function Ao(r,o,i){return i==="string"&&typeof r=="string"?r:typeof i=="function"&&typeof r=="string"?i(r):i==="boolean"&&r===null?!0:i==="boolean"&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":i==="boolean"&&r!==null&&(r.toLowerCase()==="1"||r.toLowerCase()==="0")?r.toLowerCase()==="1":i==="string[]"&&o.arrayFormat!=="none"&&typeof r=="string"?[r]:i==="number[]"&&o.arrayFormat!=="none"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?[Number(r)]:i==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):o.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":o.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function gi(r){r=wo(r);const o=r.indexOf("?");return o===-1?"":r.slice(o+1)}function mi(r,o){o={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...o},Eo(o.arrayFormatSeparator);const i=El(o),c=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return c;for(const d of r.split("&")){if(d==="")continue;const v=o.decode?d.replaceAll("+"," "):d;let[_,I]=vo(v,"=");_===void 0&&(_=v),I=I===void 0?null:["comma","separator","bracket-separator"].includes(o.arrayFormat)?I:De(I,o),i(De(_,o),I,c)}for(const[d,v]of Object.entries(c))if(typeof v=="object"&&v!==null&&o.types[d]!=="string")for(const[_,I]of Object.entries(v)){const M=o.types[d]?o.types[d].replace("[]",""):void 0;v[_]=Ao(I,o,M)}else typeof v=="object"&&v!==null&&o.types[d]==="string"?c[d]=Object.values(v).join(o.arrayFormatSeparator):c[d]=Ao(v,o,o.types[d]);return o.sort===!1?c:(o.sort===!0?Object.keys(c).sort():Object.keys(c).sort(o.sort)).reduce((d,v)=>{const _=c[v];return d[v]=_&&typeof _=="object"&&!Array.isArray(_)?To(_):_,d},Object.create(null))}function yo(r,o){if(!r)return"";o={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...o},Eo(o.arrayFormatSeparator);const i=_=>o.skipNull&&gl(r[_])||o.skipEmptyString&&r[_]==="",c=vl(o),d={};for(const[_,I]of Object.entries(r))i(_)||(d[_]=I);const v=Object.keys(d);return o.sort!==!1&&v.sort(o.sort),v.map(_=>{const I=r[_];return I===void 0?"":I===null?Ln(_,o):Array.isArray(I)?I.length===0&&o.arrayFormat==="bracket-separator"?Ln(_,o)+"[]":I.reduce(c(_),[]).join("&"):Ln(_,o)+"="+Ln(I,o)}).filter(_=>_.length>0).join("&")}function Io(r,o){o={decode:!0,...o};let[i,c]=vo(r,"#");return i===void 0&&(i=r),{url:i?.split("?")?.[0]??"",query:mi(gi(r),o),...o&&o.parseFragmentIdentifier&&c?{fragmentIdentifier:De(c,o)}:{}}}function Lo(r,o){o={encode:!0,strict:!0,[_i]:!0,...o};const i=wo(r.url).split("?")[0]||"",c=gi(r.url),d={...mi(c,{sort:!1,...o}),...r.query};let v=yo(d,o);v&&=`?${v}`;let _=Tl(r.url);if(typeof r.fragmentIdentifier=="string"){const I=new URL(i);I.hash=r.fragmentIdentifier,_=o[_i]?I.hash:`#${r.fragmentIdentifier}`}return`${i}${v}${_}`}function Ro(r,o,i){i={parseFragmentIdentifier:!0,[_i]:!1,...i};const{url:c,query:d,fragmentIdentifier:v}=Io(r,i);return Lo({url:c,query:_l(d,o),fragmentIdentifier:v},i)}function wl(r,o,i){const c=Array.isArray(o)?d=>!o.includes(d):(d,v)=>!o(d,v);return Ro(r,c,i)}const Al=Object.freeze(Object.defineProperty({__proto__:null,exclude:wl,extract:gi,parse:mi,parseUrl:Io,pick:Ro,stringify:yo,stringifyUrl:Lo},Symbol.toStringTag,{value:"Module"}));class Gn extends Error{constructor(o,i){super(`HTTP Error ${o}${i?`: ${i}`:""}`),this.code=o,this.name="HttpError",Object.setPrototypeOf(this,Gn.prototype)}}var Rn=(r=>(r.GET="GET",r.PATCH="PATCH",r.POST="POST",r))(Rn||{});class Mo{constructor(){this.headers={}}setHeaders(o){this.headers=o}async get(o){try{const i=o.query?`${o.url}?${this.serializeQuery(o.query)}`:o.url,c=await fetch(i,{headers:{...this.headers,...o.headers,"Content-Type":"application/json"},...o.signal?{signal:o.signal}:{}});return c.ok?on(await c.json()):z(new Gn(c.status,await c.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async post(o){try{const i=await fetch(o.url,{method:"POST",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async patch(o){try{const i=await fetch(o.url,{method:"PATCH",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}serializeQuery(o){if(typeof o=="string")return o;if(typeof o=="object")for(const i in o)o[i]===void 0&&delete o[i];return o=Al.stringify(o,{arrayFormat:"none"}),o}}const Tr={accessToken:{email:"/v1/auth/accessToken/email",sso:{jwt:"/v1/auth/accessToken/sso/jwt"}},refreshAccessToken:"/v1/auth/accessToken~refresh",password:{reset:"/v1/auth/password~reset"}};var Oo=(r=>(r.TokensUpdated="auth:tokens-updated",r))(Oo||{});class Se extends EventTarget{constructor(){super(),this.accessToken=null,this.refreshToken=null}static getInstance(){return Se.instance||(Se.instance=new Se),Se.instance}async loginWithPassword(o,i){const c=await this.callApi({endpoint:Tr.accessToken.email,method:"POST",body:{email:o,password:i},withSpotId:!0});if(c.isErr())return z(c.error);const{accessToken:d,refreshToken:v}=c.value;return this.setTokens(d.token,v.token),on({accessToken:d.token,refreshToken:v.token})}async loginWithSsoToken(o){const i=await this.callApi({endpoint:Tr.accessToken.sso.jwt,method:"POST",body:{token:o},withSpotId:!0});if(i.isErr())return z(i.error);const{accessToken:c,refreshToken:d}=i.value;return this.setTokens(c.token,d.token),on({accessToken:c.token,refreshToken:d.token})}loginWithAuthTokens(o,i){return this.setTokens(o,i),{accessToken:o,refreshToken:i}}resetPassword(o){return this.callApi({endpoint:Tr.password.reset,method:"POST",body:{email:o}})}async refresh(){const o=await this.callApi({endpoint:Tr.refreshAccessToken,method:"POST",body:{refreshToken:this.refreshToken}});if(o.isErr())return z(o.error);const{accessToken:i,refreshToken:c}=o.value;return this.setTokens(i.token,c.token),on({accessToken:i.token,refreshToken:c.token})}async logout(){this.setTokens(null,null)}getAccessToken(){return this.accessToken}getRefreshToken(){return this.refreshToken}setTokens(o,i){if(this.accessToken!==o||this.refreshToken!==i){this.accessToken=o,this.refreshToken=i;const c=new CustomEvent("auth:tokens-updated",{detail:{accessToken:o,refreshToken:i}});this.dispatchEvent(c)}}async callApi(o){try{const{spotId:i,msApiBaseUrl:c}=ue.getConfiguration(),d=ur(o.endpoint,c),v={"Content-Type":"application/json",...o.headers};o.withSpotId&&i&&(v[Do.SpotId]=i);const _=await fetch(d,{method:o.method,body:o.body?JSON.stringify(o.body):void 0,headers:v});if(!_.ok)return z(new Gn(_.status,_.statusText));if(_.status===ie.NO_CONTENT)return on(void 0);const I=await _.json();return on(I)}catch(i){return z(new Gn(ie.INTERNAL_SERVER_ERROR,i instanceof Error?i.message:String(i)))}}}var Do=(r=>(r.Authorization="Authorization",r.SpotId="x-spotid",r))(Do||{});class oe{constructor(){this.queue=[],this.isProcessing=!1,this.isPaused=!1,this.authService=Se.getInstance(),this.httpService=new Mo}static getInstance(){return oe.instance||(oe.instance=new oe),oe.instance}static buildAuthenticatedRequest(o){const{msApiBaseUrl:i,spotId:c}=ue.getConfiguration(),d=ur(o,i),v=Se.getInstance().getAccessToken();if(!v)return z(new Error("Not authenticated"));const _={"Content-Type":"application/json",Authorization:`Bearer ${v}`};return c&&(_["x-spotid"]=c),on({url:d,headers:_})}static async stream(o,i,c){const{streamTransport:d}=ue.getConfiguration();if(d)return d({endpoint:o,body:i,signal:c});const v=oe.buildAuthenticatedRequest(o);if(v.isErr())return z(v.error);const{url:_,headers:I}=v.value;try{const M=await fetch(_,{method:"POST",headers:I,...i!==void 0?{body:JSON.stringify(i)}:{},...c?{signal:c}:{}});if(!M.ok){const K=await M.text();return z(new Error(`HTTP ${M.status}: ${K}`))}return M.body?on(M.body):z(new Error("Response body is empty"))}catch(M){const K=M instanceof Error?M.message:"Unknown error";return z(M instanceof Error?M:new Error(K))}}get pendingCount(){return this.queue.length}enqueue(o){return new Promise(i=>{const c=async()=>{try{const d=await o();i(d)}catch(d){i(z(new Gn(ie.INTERNAL_SERVER_ERROR,d instanceof Error?d.message:"Unknown error")))}};this.queue.push(c),this.processQueue()})}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;!this.isPaused&&this.queue.length>0;){const o=this.queue.shift();if(!o)break;await o()}}finally{this.isProcessing=!1,!this.isPaused&&this.queue.length>0&&Promise.resolve().then(()=>this.processQueue())}}}pauseQueue(){this.isPaused=!0}resumeQueue(){const o=this.isPaused;this.isPaused=!1,o&&this.processQueue()}async call(o){return this.enqueue(async()=>{const i=async()=>{const{spotId:d,msApiBaseUrl:v}=ue.getConfiguration(),_={...o.options?.headers??{}};d&&(_["x-spotid"]=d);const I=this.authService.getAccessToken(),{requiresAuth:M=!0}=o;if(!I&&M)return z(new Gn(ie.UNAUTHORIZED));I&&(_.Authorization=`Bearer ${I}`);const K=ur(o.endpoint,v);switch(o.method){case Rn.GET:return this.httpService.get({...o.options??{},headers:_,url:K});case Rn.PATCH:return this.httpService.patch({...o.options??{},headers:_,url:K});case Rn.POST:return this.httpService.post({...o.options??{},headers:_,url:K});default:return z(new Gn(ie.METHOD_NOT_ALLOWED,"Method not allowed"))}};let c=await i();if(c.isErr()&&c.error.code===ie.UNAUTHORIZED){const d=await this.authService.refresh();if(d.isErr())return z(new Gn(ie.UNAUTHORIZED,d.error.message));c=await i()}return c})}}const Ie={playbooks:"/v1/playbooks",pages:r=>`/v1/playbooks/${r}/pages`,hotspots:(r,o)=>`/v1/playbooks/${r}/pages/${o}/hotspots`,hotspot:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}`,accessibleIntents:(r,o)=>`/v1/playbooks/${r}/pages/${o}/accessibleIntents`,intents:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents`,intent:(r,o,i,c)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents/${c}`},wr=50;class et{static getInstance(){return et.instance||(et.instance=new et),et.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listPlaybooks(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.playbooks,options:{query:{page:o?.page??1,limit:o?.limit??wr,...o?.domain?{"domain[eq]":o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookPages(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.pages(o.playbookId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.url?{"url[eq]":o.url}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookPage(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.pages(o.playbookId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listAccessiblePlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.accessibleIntents(o.playbookId,o.pageId),options:{query:{...o.domain?{domain:o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookHotspots(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.intentStatus?{"intentStatus[eq]":o.intentStatus}:{},...o.widgetType?{"widgetType[eq]":o.widgetType}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.hotspot(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listPlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.status?{"status[eq]":o.status}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.intent(o.playbookId,o.pageId,o.hotspotId,o.intentId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}}const yl={me:"/v1/spots/me"},Il=50;class gt{static getInstance(){return gt.instance||(gt.instance=new gt),gt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listSpotsForMe(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:yl.me,options:{query:{page:1,limit:Il,...o?.spotMemberRole?{"spotMemberRole[eq]":o.spotMemberRole}:{}}}});return i.isErr()?z(i.error):on(i.value)}}const So={spotMember:{me:"/v1/spotMembers/me",joinFromSso:"/v1/spotMembers~joinFromSso"}};class tt{static getInstance(){return tt.instance||(tt.instance=new tt),tt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async getSpotMemberForMe(){const o=await this.meltingSpotApi.call({method:Rn.GET,endpoint:So.spotMember.me});return o.isErr()?z(o.error):on(o.value)}async joinFromSso(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:So.spotMember.joinFromSso,options:{payload:{token:o}}});return i.isErr()?z(i.error):on(i.value)}}const Ll={spotMemberSsoToken:"/v1/spotMembers/auth/sso/jwt"};class mt{static getInstance(){return mt.instance||(mt.instance=new mt),mt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async generateSsoToken(){const o=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ll.spotMemberSsoToken,options:{payload:{}}});return o.isErr()?z(o.error):on(o.value.token)}}class rt{static getInstance(){return rt.instance||(rt.instance=new rt),rt.instance}constructor(){this.spotMemberAuthApiService=mt.getInstance()}async generateSsoToken(){return this.spotMemberAuthApiService.generateSsoToken()}}class Rl{constructor(o){this.active=!1,this.lastObservedUrl=null,this.options={onRouteChange:o.onRouteChange,debounceMs:o.debounceMs??0,enableDeduplication:o.enableDeduplication??!0,enableDomMutationDetection:o.enableDomMutationDetection??!1,enableHistoryChange:o.enableHistoryChange??!0,enablePopState:o.enablePopState??!0,enableHashChange:o.enableHashChange??!0,enableLoad:o.enableLoad??!0,rootDocument:o.rootDocument}}start(){this.active||(this.active=!0,this.lastObservedUrl=null,this.options.enablePopState&&(this.popStateListener=()=>this.handleNavigationEvent("popstate"),window.addEventListener("popstate",this.popStateListener)),this.options.enableHashChange&&(this.hashChangeListener=()=>this.handleNavigationEvent("hashchange"),window.addEventListener("hashchange",this.hashChangeListener)),this.options.enableLoad&&(this.loadListener=()=>this.handleNavigationEvent("load"),window.addEventListener("load",this.loadListener)),this.options.enableDomMutationDetection&&(this.mutationObserver=new MutationObserver(()=>{this.handleNavigationEvent("locationchange")}),this.mutationObserver.observe(this.options.rootDocument??document,{childList:!0,subtree:!0})),this.options.enableHistoryChange&&this.patchHistoryListeners())}stop(){this.active&&(this.active=!1,this.debounceTimer!==void 0&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.popStateListener&&(window.removeEventListener("popstate",this.popStateListener),this.popStateListener=void 0),this.hashChangeListener&&(window.removeEventListener("hashchange",this.hashChangeListener),this.hashChangeListener=void 0),this.loadListener&&(window.removeEventListener("load",this.loadListener),this.loadListener=void 0),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=void 0),(this.originalPushState||this.originalReplaceState)&&this.restoreHistoryListeners(),this.lastObservedUrl=null)}handleNavigationEvent(o){if(!this.active)return;const i=window.location.href;this.options.enableDeduplication&&this.lastObservedUrl===i||(this.lastObservedUrl=i,this.options.debounceMs>0?(this.debounceTimer!==void 0&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=void 0,this.options.onRouteChange(i,o)},this.options.debounceMs)):this.options.onRouteChange(i,o))}patchHistoryListeners(){this.originalPushState=window.history.pushState,this.originalReplaceState=window.history.replaceState,window.history.pushState=(...o)=>{const i=this.originalPushState?.apply(window.history,o);return this.handleNavigationEvent("history.pushState"),i},window.history.replaceState=(...o)=>{const i=this.originalReplaceState?.apply(window.history,o);return this.handleNavigationEvent("history.replaceState"),i}}restoreHistoryListeners(){this.originalPushState&&(window.history.pushState=this.originalPushState,this.originalPushState=void 0),this.originalReplaceState&&(window.history.replaceState=this.originalReplaceState,this.originalReplaceState=void 0)}}const Ml={events:"/v1/analytics/events"};class vt{static getInstance(){return vt.instance||(vt.instance=new vt),vt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async appendEvent(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ml.events,options:{payload:o}});return i.isErr()?z(i.error):on(i.value)}}const Ol=r=>{const o=r.get("utm_source");if(o)return{source:o,medium:r.get("utm_medium")??void 0,campaign:r.get("utm_campaign")??void 0,term:r.get("utm_term")??void 0,content:r.get("utm_content")??void 0}},Dl=r=>r?Object.entries(r).reduce((o,[i,c])=>(c!=null&&(o[`utm_${i}`]=c),o),{}):{};var bo=(r=>(r.Active="Active",r.Closed="Closed",r.Expired="Expired",r))(bo||{}),xo=(r=>(r.User="User",r.Assistant="Assistant",r))(xo||{}),Uo=(r=>(r.Metadata="metadata",r.Token="token",r.Action="action",r.Bubble="bubble",r.Handoff="handoff",r.Done="done",r.Error="error",r))(Uo||{}),No=(r=>(r.NoSource="NoSource",r.LowConfidence="LowConfidence",r.HumanRequest="HumanRequest",r.OutOfScope="OutOfScope",r))(No||{}),$o=(r=>(r.PlaybookIntent="PlaybookIntent",r.UserInitiated="UserInitiated",r.Welcome="Welcome",r.Resume="Resume",r.Discover="Discover",r.Recommend="Recommend",r))($o||{}),Po=(r=>(r.ExtraExtraSmall="ExtraExtraSmall",r.ExtraSmall="ExtraSmall",r.Small="Small",r.Medium="Medium",r.Large="Large",r))(Po||{}),Co=(r=>(r.Dropdown="Dropdown",r.Inline="Inline",r.Overlay="Overlay",r))(Co||{}),Yo=(r=>(r.Left="Left",r.Right="Right",r))(Yo||{}),Fo=(r=>(r.Top="Top",r.Bottom="Bottom",r))(Fo||{}),Ho=(r=>(r.TopLeft="TopLeft",r.TopRight="TopRight",r.BottomLeft="BottomLeft",r.BottomRight="BottomRight",r))(Ho||{}),Bo=(r=>(r.Button="Button",r.Card="Card",r.CardInline="CardInline",r.Carousel="Carousel",r.Helper="Helper",r.ListOfContent="ListOfContent",r.ListOfContentInline="ListOfContentInline",r))(Bo||{}),Wo=(r=>(r.Inline="Inline",r.Modal="Modal",r.Drawer="Drawer",r))(Wo||{}),ko=(r=>(r.Self="Self",r.Parent="Parent",r.Top="Top",r))(ko||{}),Go=(r=>(r.Left="Left",r.Right="Right",r))(Go||{}),zo=(r=>(r.Body="Body",r.DOMSelector="DOMSelector",r))(zo||{}),qo=(r=>(r.After="After",r.AppendChild="AppendChild",r.Before="Before",r.PrependChild="PrependChild",r))(qo||{}),Ko=(r=>(r.CSSSelector="CSSSelector",r.Slot="Slot",r))(Ko||{}),Qo=(r=>(r.Element="Element",r.WebComponent="WebComponent",r))(Qo||{}),Zo=(r=>(r.Inline="Inline",r.Flex="Flex",r))(Zo||{}),Jo=(r=>(r.Horizontal="Horizontal",r.Vertical="Vertical",r))(Jo||{}),Vo=(r=>(r.Start="Start",r.Center="Center",r.End="End",r.Stretch="Stretch",r.Baseline="Baseline",r))(Vo||{}),Xo=(r=>(r.Course="Course",r.Live="Live",r.Link="Link",r.Page="Page",r))(Xo||{}),jo=(r=>(r.Workshop="Workshop",r.Conference="Conference",r))(jo||{}),ns=(r=>(r.Ended="Ended",r.Planned="Planned",r.Live="Live",r))(ns||{}),es=(r=>(r.CloseA="CloseA",r.CloseB="CloseB",r.Later="Later",r))(es||{});const Sl="a",bl="mention_input",xl="mention",Ul="var",Nl="p",$l="h1",Pl="h2",Cl="h3",Yl="blockquote",Fl="layout",Hl="layout-column",Bl="ul",Wl="ol",kl="lic",Gl="li",zl="img",ql="iframely",Kl="code_block",Ql="code_line";var ts=(r=>(r.Element="Element",r.FullPage="FullPage",r))(ts||{}),rs=(r=>(r.Draft="Draft",r.Pending="Pending",r.Published="Published",r))(rs||{}),is=(r=>(r.Beacon="Beacon",r.List="List",r))(is||{}),vi=(r=>(r.Channel="Channel",r.Collection="Collection",r.Course="Course",r.Discussion="Discussion",r.Forum="Forum",r.Link="Link",r.Live="Live",r.LearningPath="LearningPath",r.Page="Page",r.RichText="RichText",r.Topic="Topic",r))(vi||{});function Zl(r){return Object.values(vi).includes(r)}const us=ue.getInstance(),os=Se.getInstance(),ss=rt.getInstance(),as={Playbook:et.getInstance(),Spot:gt.getInstance(),SpotMember:tt.getInstance()},Et=globalThis;Et.MeltingSpot||(Et.MeltingSpot={}),Et.MeltingSpot.Configuration=us,Et.MeltingSpot.Auth=os,Et.MeltingSpot.Sso=ss,Et.MeltingSpot.Api=as,y.ATTRIBUTE_BLOCKQUOTE=Yl,y.ATTRIBUTE_CODE_BLOCK=Kl,y.ATTRIBUTE_CODE_LINE=Ql,y.ATTRIBUTE_H1=$l,y.ATTRIBUTE_H2=Pl,y.ATTRIBUTE_H3=Cl,y.ATTRIBUTE_IFRAMELY=ql,y.ATTRIBUTE_IMAGE=zl,y.ATTRIBUTE_LAYOUT=Fl,y.ATTRIBUTE_LAYOUT_COLUMN=Hl,y.ATTRIBUTE_LI=Gl,y.ATTRIBUTE_LIC=kl,y.ATTRIBUTE_LINK=Sl,y.ATTRIBUTE_MENTION=xl,y.ATTRIBUTE_MENTION_INPUT=bl,y.ATTRIBUTE_OL=Wl,y.ATTRIBUTE_PARAGRAPH=Nl,y.ATTRIBUTE_UL=Bl,y.ATTRIBUTE_VARIABLE=Ul,y.AnalyticsApiService=vt,y.Api=as,y.Auth=os,y.AuthService=Se,y.AuthServiceEvents=Oo,y.BeaconIntegrationType=Co,y.BeaconRenderType=Bo,y.ButtonBeaconSize=Po,y.Configuration=us,y.ConfigurationService=ue,y.ConversationMessageRole=xo,y.ConversationSseEventType=Uo,y.ConversationStatus=bo,y.DEFAULT_PERMISSION_POLICIES=Ku,y.DateFormat=co,y.DrawerWidgetPosition=Go,y.DropdownBeaconHorizontalPosition=Yo,y.DropdownBeaconVerticalPosition=Fo,y.HttpMethods=Rn,y.HttpService=Mo,y.LastActionState=es,y.LearningPathContentType=Xo,y.LiveBuiltInType=jo,y.LiveStatus=ns,y.Logger=ho,y.MeltingSpotApi=oe,y.MeltyHandoffReason=No,y.OverlayBeaconPosition=Ho,y.PLAYBOOK_EDITOR_ACTIVE_EVENT=di,y.PlaybookApiService=et,y.PlaybookEditorAwareLifecycle=rl,y.PlaybookHotspotLocation=ts,y.PlaybookIntentStatus=rs,y.PlaybookIntentWidgetMode=is,y.PlaybookPageMatchingOperator=_e,y.RouteChangeDetector=Rl,y.SpotMemberApiService=tt,y.SpotWidgetContentType=vi,y.Sso=ss,y.SsoService=rt,y.TouchPointAnchorType=zo,y.TouchPointDOMInjectionPosition=qo,y.TouchPointDOMSelectorCssStepMode=Qo,y.TouchPointDOMSelectorPathStepType=Ko,y.TouchPointFlexAlign=Vo,y.TouchPointFlexDirection=Jo,y.TouchPointLayoutType=Zo,y.TriggerType=$o,y.WidgetInjectionTarget=ko,y.WidgetInjectionType=Wo,y.createDialog=Qf,y.createIframe=Zf,y.createIsolatedShadowHost=Jf,y.dayjs=_t,y.flattenUtmParameters=Dl,y.formatBaseUrl=cl,y.formatDate=Gc,y.formatDeeplink=al,y.formatUUID=ol,y.getHTMLElement=Kf,y.getTimeInfoWithStartAndEndDate=Sc,y.isPlaybookEditorActive=lo,y.isSpotWidgetContentType=Zl,y.isTouchDevice=Vf,y.matchesDomain=nl,y.parseUtmParameters=Ol,y.sanitizeUrl=ur,y.setLoggerDebugMode=ul,y.testUrlMatching=Xc,y.trimSlashLeft=zu,y.trimSlashRight=qu,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "MeltingSpot Core SDK",
4
4
  "homepage": "https://meltingspot.io",
5
5
  "license": "BSD-3-Clause",
6
- "version": "1.4.0",
6
+ "version": "1.5.0",
7
7
  "main": "./index.umd.js",
8
8
  "module": "./index.mjs",
9
9
  "typings": "./index.d.ts",