kenobi-js 0.1.34 → 0.1.36
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/browser/dist.js +56 -49
- package/browser/dist.js.map +2 -2
- package/browser/dist.min.js +13 -5
- package/package.json +1 -1
package/browser/dist.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Kenobi SDK v0.1.
|
|
2
|
+
* Kenobi SDK v0.1.36
|
|
3
3
|
* (c) 2025 Kenobi.ai
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var KenobiLib=(()=>{var xe=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Xt=Object.prototype.hasOwnProperty;var Yt=(t,e,r)=>e in t?xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Qt=(t,e)=>{for(var r in e)xe(t,r,{get:e[r],enumerable:!0})},Jt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Gt(e))!Xt.call(t,i)&&i!==r&&xe(t,i,{get:()=>e[i],enumerable:!(n=Wt(e,i))||n.enumerable});return t};var Zt=t=>Jt(xe({},"__esModule",{value:!0}),t);var _=(t,e,r)=>Yt(t,typeof e!="symbol"?e+"":e,r);var zr={};Qt(zr,{CueCard:()=>ve,Kenobi:()=>Qe,TRANSFORMATION_ACTIONS:()=>Kt});var Je=11;function er(t,e){var r=e.attributes,n,i,o,a,l;if(!(e.nodeType===Je||t.nodeType===Je)){for(var u=r.length-1;u>=0;u--)n=r[u],i=n.name,o=n.namespaceURI,a=n.value,o?(i=n.localName||i,l=t.getAttributeNS(o,i),l!==a&&(n.prefix==="xmlns"&&(i=n.name),t.setAttributeNS(o,i,a))):(l=t.getAttribute(i),l!==a&&t.setAttribute(i,a));for(var c=t.attributes,d=c.length-1;d>=0;d--)n=c[d],i=n.name,o=n.namespaceURI,o?(i=n.localName||i,e.hasAttributeNS(o,i)||t.removeAttributeNS(o,i)):e.hasAttribute(i)||t.removeAttribute(i)}}var Ce,tr="http://www.w3.org/1999/xhtml",j=typeof document>"u"?void 0:document,rr=!!j&&"content"in j.createElement("template"),nr=!!j&&j.createRange&&"createContextualFragment"in j.createRange();function ir(t){var e=j.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function or(t){Ce||(Ce=j.createRange(),Ce.selectNode(j.body));var e=Ce.createContextualFragment(t);return e.childNodes[0]}function ar(t){var e=j.createElement("body");return e.innerHTML=t,e.childNodes[0]}function sr(t){return t=t.trim(),rr?ir(t):nr?or(t):ar(t)}function Te(t,e){var r=t.nodeName,n=e.nodeName,i,o;return r===n?!0:(i=r.charCodeAt(0),o=n.charCodeAt(0),i<=90&&o>=97?r===n.toUpperCase():o<=90&&i>=97?n===r.toUpperCase():!1)}function lr(t,e){return!e||e===tr?j.createElement(t):j.createElementNS(e,t)}function cr(t,e){for(var r=t.firstChild;r;){var n=r.nextSibling;e.appendChild(r),r=n}return e}function Fe(t,e,r){t[r]!==e[r]&&(t[r]=e[r],t[r]?t.setAttribute(r,""):t.removeAttribute(r))}var Ze={OPTION:function(t,e){var r=t.parentNode;if(r){var n=r.nodeName.toUpperCase();n==="OPTGROUP"&&(r=r.parentNode,n=r&&r.nodeName.toUpperCase()),n==="SELECT"&&!r.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),r.selectedIndex=-1)}Fe(t,e,"selected")},INPUT:function(t,e){Fe(t,e,"checked"),Fe(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var r=e.value;t.value!==r&&(t.value=r);var n=t.firstChild;if(n){var i=n.nodeValue;if(i==r||!r&&i==t.placeholder)return;n.nodeValue=r}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var r=-1,n=0,i=t.firstChild,o,a;i;)if(a=i.nodeName&&i.nodeName.toUpperCase(),a==="OPTGROUP")o=i,i=o.firstChild,i||(i=o.nextSibling,o=null);else{if(a==="OPTION"){if(i.hasAttribute("selected")){r=n;break}n++}i=i.nextSibling,!i&&o&&(i=o.nextSibling,o=null)}t.selectedIndex=r}}},me=1,et=11,tt=3,rt=8;function ae(){}function ur(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function dr(t){return function(r,n,i){if(i||(i={}),typeof n=="string")if(r.nodeName==="#document"||r.nodeName==="HTML"||r.nodeName==="BODY"){var o=n;n=j.createElement("html"),n.innerHTML=o}else n=sr(n);else n.nodeType===et&&(n=n.firstElementChild);var a=i.getNodeKey||ur,l=i.onBeforeNodeAdded||ae,u=i.onNodeAdded||ae,c=i.onBeforeElUpdated||ae,d=i.onElUpdated||ae,s=i.onBeforeNodeDiscarded||ae,m=i.onNodeDiscarded||ae,f=i.onBeforeElChildrenUpdated||ae,A=i.skipFromChildren||ae,R=i.addChild||function(k,y){return k.appendChild(y)},T=i.childrenOnly===!0,h=Object.create(null),w=[];function S(k){w.push(k)}function L(k,y){if(k.nodeType===me)for(var D=k.firstChild;D;){var v=void 0;y&&(v=a(D))?S(v):(m(D),D.firstChild&&L(D,y)),D=D.nextSibling}}function N(k,y,D){s(k)!==!1&&(y&&y.removeChild(k),m(k),L(k,D))}function g(k){if(k.nodeType===me||k.nodeType===et)for(var y=k.firstChild;y;){var D=a(y);D&&(h[D]=y),g(y),y=y.nextSibling}}g(r);function z(k){u(k);for(var y=k.firstChild;y;){var D=y.nextSibling,v=a(y);if(v){var C=h[v];C&&Te(y,C)?(y.parentNode.replaceChild(C,y),O(C,y)):z(y)}else z(y);y=D}}function K(k,y,D){for(;y;){var v=y.nextSibling;(D=a(y))?S(D):N(y,k,!0),y=v}}function O(k,y,D){var v=a(y);if(v&&delete h[v],!D){var C=c(k,y);if(C===!1||(C instanceof HTMLElement&&(k=C,g(k)),t(k,y),d(k),f(k,y)===!1))return}k.nodeName!=="TEXTAREA"?V(k,y):Ze.TEXTAREA(k,y)}function V(k,y){var D=A(k,y),v=y.firstChild,C=k.firstChild,J,q,U,ue,Z;e:for(;v;){for(ue=v.nextSibling,J=a(v);!D&&C;){if(U=C.nextSibling,v.isSameNode&&v.isSameNode(C)){v=ue,C=U;continue e}q=a(C);var oe=C.nodeType,X=void 0;if(oe===v.nodeType&&(oe===me?(J?J!==q&&((Z=h[J])?U===Z?X=!1:(k.insertBefore(Z,C),q?S(q):N(C,k,!0),C=Z,q=a(C)):X=!1):q&&(X=!1),X=X!==!1&&Te(C,v),X&&O(C,v)):(oe===tt||oe==rt)&&(X=!0,C.nodeValue!==v.nodeValue&&(C.nodeValue=v.nodeValue))),X){v=ue,C=U;continue e}q?S(q):N(C,k,!0),C=U}if(J&&(Z=h[J])&&Te(Z,v))D||R(k,Z),O(Z,v);else{var fe=l(v);fe!==!1&&(fe&&(v=fe),v.actualize&&(v=v.actualize(k.ownerDocument||j)),R(k,v),z(v))}v=ue,C=U}K(k,C,q);var ke=Ze[k.nodeName];ke&&ke(k,y)}var M=r,B=M.nodeType,Q=n.nodeType;if(!T){if(B===me)Q===me?Te(r,n)||(m(r),M=cr(r,lr(n.nodeName,n.namespaceURI))):M=n;else if(B===tt||B===rt){if(Q===B)return M.nodeValue!==n.nodeValue&&(M.nodeValue=n.nodeValue),M;M=n}}if(M===n)m(r);else{if(n.isSameNode&&n.isSameNode(M))return;if(O(M,n,T),w)for(var se=0,ie=w.length;se<ie;se++){var le=h[w[se]];le&&N(le,le.parentNode,!1)}}return!T&&M!==r&&r.parentNode&&(M.actualize&&(M=M.actualize(r.ownerDocument||j)),r.parentNode.replaceChild(M,r)),M}}var pr=dr(er),Se=pr;var Le,P,st,fr,ce,nt,lt,ct,ut,Ke,Oe,ze,mr,he={},dt=[],hr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Re=Array.isArray;function ne(t,e){for(var r in e)t[r]=e[r];return t}function $e(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function br(t,e,r){var n,i,o,a={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?Le.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)a[o]===void 0&&(a[o]=t.defaultProps[o]);return Ae(t,a,n,i,null)}function Ae(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++st,__i:-1,__u:0};return i==null&&P.vnode!=null&&P.vnode(o),o}function te(t){return t.children}function Me(t,e){this.props=t,this.context=e}function de(t,e){if(e==null)return t.__?de(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?de(t):null}function pt(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return pt(t)}}function it(t){(!t.__d&&(t.__d=!0)&&ce.push(t)&&!Pe.__r++||nt!=P.debounceRendering)&&((nt=P.debounceRendering)||lt)(Pe)}function Pe(){for(var t,e,r,n,i,o,a,l=1;ce.length;)ce.length>l&&ce.sort(ct),t=ce.shift(),l=ce.length,t.__d&&(r=void 0,n=void 0,i=(n=(e=t).__v).__e,o=[],a=[],e.__P&&((r=ne({},n)).__v=n.__v+1,P.vnode&&P.vnode(r),Ve(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??de(n),!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,ht(o,r,a),n.__e=n.__=null,r.__e!=i&&pt(r)));Pe.__r=0}function ft(t,e,r,n,i,o,a,l,u,c,d){var s,m,f,A,R,T,h,w=n&&n.__k||dt,S=e.length;for(u=_r(r,e,w,u,S),s=0;s<S;s++)(f=r.__k[s])!=null&&(m=f.__i==-1?he:w[f.__i]||he,f.__i=s,T=Ve(t,f,m,i,o,a,l,u,c,d),A=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&Be(m.ref,null,f),d.push(f.ref,f.__c||A,f)),R==null&&A!=null&&(R=A),(h=!!(4&f.__u))||m.__k===f.__k?u=mt(f,u,t,h):typeof f.type=="function"&&T!==void 0?u=T:A&&(u=A.nextSibling),f.__u&=-7);return r.__e=R,u}function _r(t,e,r,n,i){var o,a,l,u,c,d=r.length,s=d,m=0;for(t.__k=new Array(i),o=0;o<i;o++)(a=e[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(u=o+m,(a=t.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?Ae(null,a,null,null,null):Re(a)?Ae(te,{children:a},null,null,null):a.constructor==null&&a.__b>0?Ae(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=t,a.__b=t.__b+1,l=null,(c=a.__i=gr(a,r,u,s))!=-1&&(s--,(l=r[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(i>d?m--:i<d&&m++),typeof a.type!="function"&&(a.__u|=4)):c!=u&&(c==u-1?m--:c==u+1?m++:(c>u?m--:m++,a.__u|=4))):t.__k[o]=null;if(s)for(o=0;o<d;o++)(l=r[o])!=null&&(2&l.__u)==0&&(l.__e==n&&(n=de(l)),_t(l,l));return n}function mt(t,e,r,n){var i,o;if(typeof t.type=="function"){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=mt(i[o],e,r,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=de(t)),r.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function gr(t,e,r,n){var i,o,a,l=t.key,u=t.type,c=e[r],d=c!=null&&(2&c.__u)==0;if(c===null&&t.key==null||d&&l==c.key&&u==c.type)return r;if(n>(d?1:0)){for(i=r-1,o=r+1;i>=0||o<e.length;)if((c=e[a=i>=0?i--:o++])!=null&&(2&c.__u)==0&&l==c.key&&u==c.type)return a}return-1}function ot(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||hr.test(e)?r:r+"px"}function Ee(t,e,r,n,i){var o,a;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||ot(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||ot(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(ut,"$1")),a=e.toLowerCase(),e=a in t||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=Ke,t.addEventListener(e,o?ze:Oe,o)):t.removeEventListener(e,o?ze:Oe,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function at(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Ke++;else if(e.t<r.u)return;return r(P.event?P.event(e):e)}}}function Ve(t,e,r,n,i,o,a,l,u,c){var d,s,m,f,A,R,T,h,w,S,L,N,g,z,K,O,V,M=e.type;if(e.constructor!=null)return null;128&r.__u&&(u=!!(32&r.__u),o=[l=e.__e=r.__e]),(d=P.__b)&&d(e);e:if(typeof M=="function")try{if(h=e.props,w="prototype"in M&&M.prototype.render,S=(d=M.contextType)&&n[d.__c],L=d?S?S.props.value:d.__:n,r.__c?T=(s=e.__c=r.__c).__=s.__E:(w?e.__c=s=new M(h,L):(e.__c=s=new Me(h,L),s.constructor=M,s.render=yr),S&&S.sub(s),s.props=h,s.state||(s.state={}),s.context=L,s.__n=n,m=s.__d=!0,s.__h=[],s._sb=[]),w&&s.__s==null&&(s.__s=s.state),w&&M.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=ne({},s.__s)),ne(s.__s,M.getDerivedStateFromProps(h,s.__s))),f=s.props,A=s.state,s.__v=e,m)w&&M.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),w&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(w&&M.getDerivedStateFromProps==null&&h!==f&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(h,L),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(h,s.__s,L)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(s.props=h,s.state=s.__s,s.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(B){B&&(B.__=e)}),N=0;N<s._sb.length;N++)s.__h.push(s._sb[N]);s._sb=[],s.__h.length&&a.push(s);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(h,s.__s,L),w&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(f,A,R)})}if(s.context=L,s.props=h,s.__P=t,s.__e=!1,g=P.__r,z=0,w){for(s.state=s.__s,s.__d=!1,g&&g(e),d=s.render(s.props,s.state,s.context),K=0;K<s._sb.length;K++)s.__h.push(s._sb[K]);s._sb=[]}else do s.__d=!1,g&&g(e),d=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++z<25);s.state=s.__s,s.getChildContext!=null&&(n=ne(ne({},n),s.getChildContext())),w&&!m&&s.getSnapshotBeforeUpdate!=null&&(R=s.getSnapshotBeforeUpdate(f,A)),O=d,d!=null&&d.type===te&&d.key==null&&(O=bt(d.props.children)),l=ft(t,Re(O)?O:[O],e,r,n,i,o,a,l,u,c),s.base=e.__e,e.__u&=-161,s.__h.length&&a.push(s),T&&(s.__E=s.__=null)}catch(B){if(e.__v=null,u||o!=null)if(B.then){for(e.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o[o.indexOf(l)]=null,e.__e=l}else{for(V=o.length;V--;)$e(o[V]);Ue(e)}else e.__e=r.__e,e.__k=r.__k,B.then||Ue(e);P.__e(B,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):l=e.__e=vr(r.__e,e,r,n,i,o,a,u,c);return(d=P.diffed)&&d(e),128&e.__u?void 0:l}function Ue(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(Ue)}function ht(t,e,r){for(var n=0;n<r.length;n++)Be(r[n],r[++n],r[++n]);P.__c&&P.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){P.__e(o,i.__v)}})}function bt(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Re(t)?t.map(bt):ne({},t)}function vr(t,e,r,n,i,o,a,l,u){var c,d,s,m,f,A,R,T=r.props,h=e.props,w=e.type;if(w=="svg"?i="http://www.w3.org/2000/svg":w=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((f=o[c])&&"setAttribute"in f==!!w&&(w?f.localName==w:f.nodeType==3)){t=f,o[c]=null;break}}if(t==null){if(w==null)return document.createTextNode(h);t=document.createElementNS(i,w,h.is&&h),l&&(P.__m&&P.__m(e,o),l=!1),o=null}if(w==null)T===h||l&&t.data==h||(t.data=h);else{if(o=o&&Le.call(t.childNodes),T=r.props||he,!l&&o!=null)for(T={},c=0;c<t.attributes.length;c++)T[(f=t.attributes[c]).name]=f.value;for(c in T)if(f=T[c],c!="children"){if(c=="dangerouslySetInnerHTML")s=f;else if(!(c in h)){if(c=="value"&&"defaultValue"in h||c=="checked"&&"defaultChecked"in h)continue;Ee(t,c,null,f,i)}}for(c in h)f=h[c],c=="children"?m=f:c=="dangerouslySetInnerHTML"?d=f:c=="value"?A=f:c=="checked"?R=f:l&&typeof f!="function"||T[c]===f||Ee(t,c,f,T[c],i);if(d)l||s&&(d.__html==s.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(s&&(t.innerHTML=""),ft(e.type=="template"?t.content:t,Re(m)?m:[m],e,r,n,w=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:r.__k&&de(r,0),l,u),o!=null)for(c=o.length;c--;)$e(o[c]);l||(c="value",w=="progress"&&A==null?t.removeAttribute("value"):A!=null&&(A!==t[c]||w=="progress"&&!A||w=="option"&&A!=T[c])&&Ee(t,c,A,T[c],i),c="checked",R!=null&&R!=t[c]&&Ee(t,c,R,T[c],i))}return t}function Be(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){P.__e(i,r)}}function _t(t,e,r){var n,i;if(P.unmount&&P.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Be(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){P.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&_t(n[i],e,r||typeof t.type!="function");r||$e(t.__e),t.__c=t.__=t.__e=void 0}function yr(t,e,r){return this.constructor(t,r)}function je(t,e,r){var n,i,o,a;e==document&&(e=document.documentElement),P.__&&P.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],a=[],Ve(e,t=(!n&&r||e).__k=br(te,null,[t]),i||he,he,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Le.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,a),ht(o,t,a)}Le=dt.slice,P={__e:function(t,e,r,n){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),a=i.__d),a)return i.__E=i}catch(l){t=l}throw t}},st=0,fr=function(t){return t!=null&&t.constructor==null},Me.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ne({},this.state),typeof t=="function"&&(t=t(ne({},r),this.props)),t&&ne(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),it(this))},Me.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),it(this))},Me.prototype.render=te,ce=[],lt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ct=function(t,e){return t.__v.__b-e.__v.__b},Pe.__r=0,ut=/(PointerCapture)$|Capture$/i,Ke=0,Oe=at(!1),ze=at(!0),mr=0;var be,H,qe,gt,_e=0,St=[],I=P,vt=I.__b,yt=I.__r,kt=I.diffed,wt=I.__c,xt=I.unmount,Ct=I.__;function Ge(t,e){I.__h&&I.__h(H,t,_e||e),_e=0;var r=H.__H||(H.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function ge(t){return _e=1,kr(Pt,t)}function kr(t,e,r){var n=Ge(be++,2);if(n.t=t,!n.__c&&(n.__=[r?r(e):Pt(void 0,e),function(l){var u=n.__N?n.__N[0]:n.__[0],c=n.t(u,l);u!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=H,!H.__f)){var i=function(l,u,c){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(m){return!!m.__c});if(d.every(function(m){return!m.__N}))return!o||o.call(this,l,u,c);var s=n.__c.props!==l;return d.forEach(function(m){if(m.__N){var f=m.__[0];m.__=m.__N,m.__N=void 0,f!==m.__[0]&&(s=!0)}}),o&&o.call(this,l,u,c)||s};H.__f=!0;var o=H.shouldComponentUpdate,a=H.componentWillUpdate;H.componentWillUpdate=function(l,u,c){if(this.__e){var d=o;o=void 0,i(l,u,c),o=d}a&&a.call(this,l,u,c)},H.shouldComponentUpdate=i}return n.__N||n.__}function G(t,e){var r=Ge(be++,3);!I.__s&&Mt(r.__H,e)&&(r.__=t,r.u=e,H.__H.__h.push(r))}function F(t){return _e=5,Et(function(){return{current:t}},[])}function Et(t,e){var r=Ge(be++,7);return Mt(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function At(t,e){return _e=8,Et(function(){return t},e)}function wr(){for(var t;t=St.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(De),t.__H.__h.forEach(We),t.__H.__h=[]}catch(e){t.__H.__h=[],I.__e(e,t.__v)}}I.__b=function(t){H=null,vt&&vt(t)},I.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ct&&Ct(t,e)},I.__r=function(t){yt&&yt(t),be=0;var e=(H=t.__c).__H;e&&(qe===H?(e.__h=[],H.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(De),e.__h.forEach(We),e.__h=[],be=0)),qe=H},I.diffed=function(t){kt&&kt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(St.push(e)!==1&>===I.requestAnimationFrame||((gt=I.requestAnimationFrame)||xr)(wr)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),qe=H=null},I.__c=function(t,e){e.some(function(r){try{r.__h.forEach(De),r.__h=r.__h.filter(function(n){return!n.__||We(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],I.__e(n,r.__v)}}),wt&&wt(t,e)},I.unmount=function(t){xt&&xt(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{De(n)}catch(i){e=i}}),r.__H=void 0,e&&I.__e(e,r.__v))};var Tt=typeof requestAnimationFrame=="function";function xr(t){var e,r=function(){clearTimeout(n),Tt&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);Tt&&(e=requestAnimationFrame(r))}function De(t){var e=H,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),H=e}function We(t){var e=H;t.__c=t.__(),H=e}function Mt(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function Pt(t,e){return typeof e=="function"?e(t):e}var Cr=0;function p(t,e,r,n,i,o){e||(e={});var a,l,u=e;if("ref"in u)for(l in u={},e)l=="ref"?a=e[l]:u[l]=e[l];var c={type:t,props:u,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Cr,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(a=t.defaultProps))for(l in a)u[l]===void 0&&(u[l]=a[l]);return P.vnode&&P.vnode(c),c}var Lt=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M16.72 7.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1 0 1.06l-3.75 3.75a.75.75 0 1 1-1.06-1.06l2.47-2.47H3a.75.75 0 0 1 0-1.5h16.19l-2.47-2.47a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),Tr=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 0 1 1.04-.208Z",clipRule:"evenodd"})}),Rt=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),Xe=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:p("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),Dt=()=>p("svg",{width:"32",height:"32",viewBox:"0 0 900 900",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("circle",{cx:"446",cy:"450",r:"424",fill:"black"}),p("circle",{cx:"450",cy:"450",r:"357",fill:"url(#paint0_linear_1_41)"}),p("ellipse",{cx:"579.85",cy:"294.451",rx:"79.778",ry:"108.483",transform:"rotate(-46.2324 579.85 294.451)",fill:"black"}),p("defs",{children:p("linearGradient",{id:"paint0_linear_1_41",x1:"807",y1:"93",x2:"93",y2:"807",gradientUnits:"userSpaceOnUse",children:[p("stop",{"stop-color":"#FAFAFA"}),p("stop",{offset:"1","stop-color":"#CACACA"})]})})]}),Sr=`
|
|
5
|
+
"use strict";var KenobiLib=(()=>{var xe=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Jt=Object.getOwnPropertyNames;var Zt=Object.prototype.hasOwnProperty;var er=(t,e,r)=>e in t?xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var tr=(t,e)=>{for(var r in e)xe(t,r,{get:e[r],enumerable:!0})},rr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Jt(e))!Zt.call(t,i)&&i!==r&&xe(t,i,{get:()=>e[i],enumerable:!(n=Qt(e,i))||n.enumerable});return t};var nr=t=>rr(xe({},"__esModule",{value:!0}),t);var g=(t,e,r)=>er(t,typeof e!="symbol"?e+"":e,r);var $r={};tr($r,{CueCard:()=>ye,Kenobi:()=>Qe,TRANSFORMATION_ACTIONS:()=>$t});var et=11;function ir(t,e){var r=e.attributes,n,i,o,a,l;if(!(e.nodeType===et||t.nodeType===et)){for(var u=r.length-1;u>=0;u--)n=r[u],i=n.name,o=n.namespaceURI,a=n.value,o?(i=n.localName||i,l=t.getAttributeNS(o,i),l!==a&&(n.prefix==="xmlns"&&(i=n.name),t.setAttributeNS(o,i,a))):(l=t.getAttribute(i),l!==a&&t.setAttribute(i,a));for(var c=t.attributes,d=c.length-1;d>=0;d--)n=c[d],i=n.name,o=n.namespaceURI,o?(i=n.localName||i,e.hasAttributeNS(o,i)||t.removeAttributeNS(o,i)):e.hasAttribute(i)||t.removeAttribute(i)}}var Ce,or="http://www.w3.org/1999/xhtml",j=typeof document>"u"?void 0:document,ar=!!j&&"content"in j.createElement("template"),sr=!!j&&j.createRange&&"createContextualFragment"in j.createRange();function lr(t){var e=j.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function cr(t){Ce||(Ce=j.createRange(),Ce.selectNode(j.body));var e=Ce.createContextualFragment(t);return e.childNodes[0]}function ur(t){var e=j.createElement("body");return e.innerHTML=t,e.childNodes[0]}function dr(t){return t=t.trim(),ar?lr(t):sr?cr(t):ur(t)}function Te(t,e){var r=t.nodeName,n=e.nodeName,i,o;return r===n?!0:(i=r.charCodeAt(0),o=n.charCodeAt(0),i<=90&&o>=97?r===n.toUpperCase():o<=90&&i>=97?n===r.toUpperCase():!1)}function pr(t,e){return!e||e===or?j.createElement(t):j.createElementNS(e,t)}function fr(t,e){for(var r=t.firstChild;r;){var n=r.nextSibling;e.appendChild(r),r=n}return e}function Fe(t,e,r){t[r]!==e[r]&&(t[r]=e[r],t[r]?t.setAttribute(r,""):t.removeAttribute(r))}var tt={OPTION:function(t,e){var r=t.parentNode;if(r){var n=r.nodeName.toUpperCase();n==="OPTGROUP"&&(r=r.parentNode,n=r&&r.nodeName.toUpperCase()),n==="SELECT"&&!r.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),r.selectedIndex=-1)}Fe(t,e,"selected")},INPUT:function(t,e){Fe(t,e,"checked"),Fe(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var r=e.value;t.value!==r&&(t.value=r);var n=t.firstChild;if(n){var i=n.nodeValue;if(i==r||!r&&i==t.placeholder)return;n.nodeValue=r}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var r=-1,n=0,i=t.firstChild,o,a;i;)if(a=i.nodeName&&i.nodeName.toUpperCase(),a==="OPTGROUP")o=i,i=o.firstChild,i||(i=o.nextSibling,o=null);else{if(a==="OPTION"){if(i.hasAttribute("selected")){r=n;break}n++}i=i.nextSibling,!i&&o&&(i=o.nextSibling,o=null)}t.selectedIndex=r}}},he=1,rt=11,nt=3,it=8;function oe(){}function mr(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function hr(t){return function(r,n,i){if(i||(i={}),typeof n=="string")if(r.nodeName==="#document"||r.nodeName==="HTML"||r.nodeName==="BODY"){var o=n;n=j.createElement("html"),n.innerHTML=o}else n=dr(n);else n.nodeType===rt&&(n=n.firstElementChild);var a=i.getNodeKey||mr,l=i.onBeforeNodeAdded||oe,u=i.onNodeAdded||oe,c=i.onBeforeElUpdated||oe,d=i.onElUpdated||oe,s=i.onBeforeNodeDiscarded||oe,f=i.onNodeDiscarded||oe,m=i.onBeforeElChildrenUpdated||oe,S=i.skipFromChildren||oe,A=i.addChild||function(y,v){return y.appendChild(v)},w=i.childrenOnly===!0,h=Object.create(null),k=[];function P(y){k.push(y)}function O(y,v){if(y.nodeType===he)for(var D=y.firstChild;D;){var x=void 0;v&&(x=a(D))?P(x):(f(D),D.firstChild&&O(D,v)),D=D.nextSibling}}function R(y,v,D){s(y)!==!1&&(v&&v.removeChild(y),f(y),O(y,D))}function b(y){if(y.nodeType===he||y.nodeType===rt)for(var v=y.firstChild;v;){var D=a(v);D&&(h[D]=v),b(v),v=v.nextSibling}}b(r);function z(y){u(y);for(var v=y.firstChild;v;){var D=v.nextSibling,x=a(v);if(x){var M=h[x];M&&Te(v,M)?(v.parentNode.replaceChild(M,v),K(M,v)):z(v)}else z(v);v=D}}function q(y,v,D){for(;v;){var x=v.nextSibling;(D=a(v))?P(D):R(v,y,!0),v=x}}function K(y,v,D){var x=a(v);if(x&&delete h[x],!D){var M=c(y,v);if(M===!1||(M instanceof HTMLElement&&(y=M,b(y)),t(y,v),d(y),m(y,v)===!1))return}y.nodeName!=="TEXTAREA"?V(y,v):tt.TEXTAREA(y,v)}function V(y,v){var D=S(y,v),x=v.firstChild,M=y.firstChild,H,$,Q,ie,U;e:for(;x;){for(ie=x.nextSibling,H=a(x);!D&&M;){if(Q=M.nextSibling,x.isSameNode&&x.isSameNode(M)){x=ie,M=Q;continue e}$=a(M);var ue=M.nodeType,J=void 0;if(ue===x.nodeType&&(ue===he?(H?H!==$&&((U=h[H])?Q===U?J=!1:(y.insertBefore(U,M),$?P($):R(M,y,!0),M=U,$=a(M)):J=!1):$&&(J=!1),J=J!==!1&&Te(M,x),J&&K(M,x)):(ue===nt||ue==it)&&(J=!0,M.nodeValue!==x.nodeValue&&(M.nodeValue=x.nodeValue))),J){x=ie,M=Q;continue e}$?P($):R(M,y,!0),M=Q}if(H&&(U=h[H])&&Te(U,x))D||A(y,U),K(U,x);else{var se=l(x);se!==!1&&(se&&(x=se),x.actualize&&(x=x.actualize(y.ownerDocument||j)),A(y,x),z(x))}x=ie,M=Q}q(y,M,$);var me=tt[y.nodeName];me&&me(y,v)}var E=r,W=E.nodeType,ke=n.nodeType;if(!w){if(W===he)ke===he?Te(r,n)||(f(r),E=fr(r,pr(n.nodeName,n.namespaceURI))):E=n;else if(W===nt||W===it){if(ke===W)return E.nodeValue!==n.nodeValue&&(E.nodeValue=n.nodeValue),E;E=n}}if(E===n)f(r);else{if(n.isSameNode&&n.isSameNode(E))return;if(K(E,n,w),k)for(var ce=0,re=k.length;ce<re;ce++){var ae=h[k[ce]];ae&&R(ae,ae.parentNode,!1)}}return!w&&E!==r&&r.parentNode&&(E.actualize&&(E=E.actualize(r.ownerDocument||j)),r.parentNode.replaceChild(E,r)),E}}var br=hr(ir),Ee=br;var Le,L,ct,_r,le,ot,ut,dt,pt,Ke,Oe,ze,gr,be={},ft=[],yr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Re=Array.isArray;function ne(t,e){for(var r in e)t[r]=e[r];return t}function Ve(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function vr(t,e,r){var n,i,o,a={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?Le.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)a[o]===void 0&&(a[o]=t.defaultProps[o]);return Ae(t,a,n,i,null)}function Ae(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ct,__i:-1,__u:0};return i==null&&L.vnode!=null&&L.vnode(o),o}function ee(t){return t.children}function Me(t,e){this.props=t,this.context=e}function de(t,e){if(e==null)return t.__?de(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?de(t):null}function mt(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return mt(t)}}function at(t){(!t.__d&&(t.__d=!0)&&le.push(t)&&!Pe.__r++||ot!=L.debounceRendering)&&((ot=L.debounceRendering)||ut)(Pe)}function Pe(){for(var t,e,r,n,i,o,a,l=1;le.length;)le.length>l&&le.sort(dt),t=le.shift(),l=le.length,t.__d&&(r=void 0,n=void 0,i=(n=(e=t).__v).__e,o=[],a=[],e.__P&&((r=ne({},n)).__v=n.__v+1,L.vnode&&L.vnode(r),$e(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??de(n),!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,_t(o,r,a),n.__e=n.__=null,r.__e!=i&&mt(r)));Pe.__r=0}function ht(t,e,r,n,i,o,a,l,u,c,d){var s,f,m,S,A,w,h,k=n&&n.__k||ft,P=e.length;for(u=kr(r,e,k,u,P),s=0;s<P;s++)(m=r.__k[s])!=null&&(f=m.__i==-1?be:k[m.__i]||be,m.__i=s,w=$e(t,m,f,i,o,a,l,u,c,d),S=m.__e,m.ref&&f.ref!=m.ref&&(f.ref&&Be(f.ref,null,m),d.push(m.ref,m.__c||S,m)),A==null&&S!=null&&(A=S),(h=!!(4&m.__u))||f.__k===m.__k?u=bt(m,u,t,h):typeof m.type=="function"&&w!==void 0?u=w:S&&(u=S.nextSibling),m.__u&=-7);return r.__e=A,u}function kr(t,e,r,n,i){var o,a,l,u,c,d=r.length,s=d,f=0;for(t.__k=new Array(i),o=0;o<i;o++)(a=e[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(u=o+f,(a=t.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?Ae(null,a,null,null,null):Re(a)?Ae(ee,{children:a},null,null,null):a.constructor==null&&a.__b>0?Ae(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=t,a.__b=t.__b+1,l=null,(c=a.__i=wr(a,r,u,s))!=-1&&(s--,(l=r[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(i>d?f--:i<d&&f++),typeof a.type!="function"&&(a.__u|=4)):c!=u&&(c==u-1?f--:c==u+1?f++:(c>u?f--:f++,a.__u|=4))):t.__k[o]=null;if(s)for(o=0;o<d;o++)(l=r[o])!=null&&(2&l.__u)==0&&(l.__e==n&&(n=de(l)),yt(l,l));return n}function bt(t,e,r,n){var i,o;if(typeof t.type=="function"){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=bt(i[o],e,r,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=de(t)),r.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function wr(t,e,r,n){var i,o,a,l=t.key,u=t.type,c=e[r],d=c!=null&&(2&c.__u)==0;if(c===null&&t.key==null||d&&l==c.key&&u==c.type)return r;if(n>(d?1:0)){for(i=r-1,o=r+1;i>=0||o<e.length;)if((c=e[a=i>=0?i--:o++])!=null&&(2&c.__u)==0&&l==c.key&&u==c.type)return a}return-1}function st(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||yr.test(e)?r:r+"px"}function Se(t,e,r,n,i){var o,a;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||st(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||st(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(pt,"$1")),a=e.toLowerCase(),e=a in t||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=Ke,t.addEventListener(e,o?ze:Oe,o)):t.removeEventListener(e,o?ze:Oe,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function lt(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Ke++;else if(e.t<r.u)return;return r(L.event?L.event(e):e)}}}function $e(t,e,r,n,i,o,a,l,u,c){var d,s,f,m,S,A,w,h,k,P,O,R,b,z,q,K,V,E=e.type;if(e.constructor!=null)return null;128&r.__u&&(u=!!(32&r.__u),o=[l=e.__e=r.__e]),(d=L.__b)&&d(e);e:if(typeof E=="function")try{if(h=e.props,k="prototype"in E&&E.prototype.render,P=(d=E.contextType)&&n[d.__c],O=d?P?P.props.value:d.__:n,r.__c?w=(s=e.__c=r.__c).__=s.__E:(k?e.__c=s=new E(h,O):(e.__c=s=new Me(h,O),s.constructor=E,s.render=Cr),P&&P.sub(s),s.props=h,s.state||(s.state={}),s.context=O,s.__n=n,f=s.__d=!0,s.__h=[],s._sb=[]),k&&s.__s==null&&(s.__s=s.state),k&&E.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=ne({},s.__s)),ne(s.__s,E.getDerivedStateFromProps(h,s.__s))),m=s.props,S=s.state,s.__v=e,f)k&&E.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),k&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(k&&E.getDerivedStateFromProps==null&&h!==m&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(h,O),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(h,s.__s,O)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(s.props=h,s.state=s.__s,s.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(W){W&&(W.__=e)}),R=0;R<s._sb.length;R++)s.__h.push(s._sb[R]);s._sb=[],s.__h.length&&a.push(s);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(h,s.__s,O),k&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(m,S,A)})}if(s.context=O,s.props=h,s.__P=t,s.__e=!1,b=L.__r,z=0,k){for(s.state=s.__s,s.__d=!1,b&&b(e),d=s.render(s.props,s.state,s.context),q=0;q<s._sb.length;q++)s.__h.push(s._sb[q]);s._sb=[]}else do s.__d=!1,b&&b(e),d=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++z<25);s.state=s.__s,s.getChildContext!=null&&(n=ne(ne({},n),s.getChildContext())),k&&!f&&s.getSnapshotBeforeUpdate!=null&&(A=s.getSnapshotBeforeUpdate(m,S)),K=d,d!=null&&d.type===ee&&d.key==null&&(K=gt(d.props.children)),l=ht(t,Re(K)?K:[K],e,r,n,i,o,a,l,u,c),s.base=e.__e,e.__u&=-161,s.__h.length&&a.push(s),w&&(s.__E=s.__=null)}catch(W){if(e.__v=null,u||o!=null)if(W.then){for(e.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o[o.indexOf(l)]=null,e.__e=l}else{for(V=o.length;V--;)Ve(o[V]);Ue(e)}else e.__e=r.__e,e.__k=r.__k,W.then||Ue(e);L.__e(W,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):l=e.__e=xr(r.__e,e,r,n,i,o,a,u,c);return(d=L.diffed)&&d(e),128&e.__u?void 0:l}function Ue(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(Ue)}function _t(t,e,r){for(var n=0;n<r.length;n++)Be(r[n],r[++n],r[++n]);L.__c&&L.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){L.__e(o,i.__v)}})}function gt(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Re(t)?t.map(gt):ne({},t)}function xr(t,e,r,n,i,o,a,l,u){var c,d,s,f,m,S,A,w=r.props,h=e.props,k=e.type;if(k=="svg"?i="http://www.w3.org/2000/svg":k=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((m=o[c])&&"setAttribute"in m==!!k&&(k?m.localName==k:m.nodeType==3)){t=m,o[c]=null;break}}if(t==null){if(k==null)return document.createTextNode(h);t=document.createElementNS(i,k,h.is&&h),l&&(L.__m&&L.__m(e,o),l=!1),o=null}if(k==null)w===h||l&&t.data==h||(t.data=h);else{if(o=o&&Le.call(t.childNodes),w=r.props||be,!l&&o!=null)for(w={},c=0;c<t.attributes.length;c++)w[(m=t.attributes[c]).name]=m.value;for(c in w)if(m=w[c],c!="children"){if(c=="dangerouslySetInnerHTML")s=m;else if(!(c in h)){if(c=="value"&&"defaultValue"in h||c=="checked"&&"defaultChecked"in h)continue;Se(t,c,null,m,i)}}for(c in h)m=h[c],c=="children"?f=m:c=="dangerouslySetInnerHTML"?d=m:c=="value"?S=m:c=="checked"?A=m:l&&typeof m!="function"||w[c]===m||Se(t,c,m,w[c],i);if(d)l||s&&(d.__html==s.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(s&&(t.innerHTML=""),ht(e.type=="template"?t.content:t,Re(f)?f:[f],e,r,n,k=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:r.__k&&de(r,0),l,u),o!=null)for(c=o.length;c--;)Ve(o[c]);l||(c="value",k=="progress"&&S==null?t.removeAttribute("value"):S!=null&&(S!==t[c]||k=="progress"&&!S||k=="option"&&S!=w[c])&&Se(t,c,S,w[c],i),c="checked",A!=null&&A!=t[c]&&Se(t,c,A,w[c],i))}return t}function Be(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){L.__e(i,r)}}function yt(t,e,r){var n,i;if(L.unmount&&L.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Be(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){L.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&yt(n[i],e,r||typeof t.type!="function");r||Ve(t.__e),t.__c=t.__=t.__e=void 0}function Cr(t,e,r){return this.constructor(t,r)}function je(t,e,r){var n,i,o,a;e==document&&(e=document.documentElement),L.__&&L.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],a=[],$e(e,t=(!n&&r||e).__k=vr(ee,null,[t]),i||be,be,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Le.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,a),_t(o,t,a)}Le=ft.slice,L={__e:function(t,e,r,n){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),a=i.__d),a)return i.__E=i}catch(l){t=l}throw t}},ct=0,_r=function(t){return t!=null&&t.constructor==null},Me.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ne({},this.state),typeof t=="function"&&(t=t(ne({},r),this.props)),t&&ne(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),at(this))},Me.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),at(this))},Me.prototype.render=ee,le=[],ut=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,dt=function(t,e){return t.__v.__b-e.__v.__b},Pe.__r=0,pt=/(PointerCapture)$|Capture$/i,Ke=0,Oe=lt(!1),ze=lt(!0),gr=0;var _e,N,qe,vt,ge=0,At=[],I=L,kt=I.__b,wt=I.__r,xt=I.diffed,Ct=I.__c,Tt=I.unmount,Et=I.__;function Ge(t,e){I.__h&&I.__h(N,t,ge||e),ge=0;var r=N.__H||(N.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function pe(t){return ge=1,Tr(Rt,t)}function Tr(t,e,r){var n=Ge(_e++,2);if(n.t=t,!n.__c&&(n.__=[r?r(e):Rt(void 0,e),function(l){var u=n.__N?n.__N[0]:n.__[0],c=n.t(u,l);u!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=N,!N.__f)){var i=function(l,u,c){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(f){return!!f.__c});if(d.every(function(f){return!f.__N}))return!o||o.call(this,l,u,c);var s=n.__c.props!==l;return d.forEach(function(f){if(f.__N){var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(s=!0)}}),o&&o.call(this,l,u,c)||s};N.__f=!0;var o=N.shouldComponentUpdate,a=N.componentWillUpdate;N.componentWillUpdate=function(l,u,c){if(this.__e){var d=o;o=void 0,i(l,u,c),o=d}a&&a.call(this,l,u,c)},N.shouldComponentUpdate=i}return n.__N||n.__}function X(t,e){var r=Ge(_e++,3);!I.__s&&Lt(r.__H,e)&&(r.__=t,r.u=e,N.__H.__h.push(r))}function F(t){return ge=5,Mt(function(){return{current:t}},[])}function Mt(t,e){var r=Ge(_e++,7);return Lt(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Pt(t,e){return ge=8,Mt(function(){return t},e)}function Er(){for(var t;t=At.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(De),t.__H.__h.forEach(We),t.__H.__h=[]}catch(e){t.__H.__h=[],I.__e(e,t.__v)}}I.__b=function(t){N=null,kt&&kt(t)},I.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Et&&Et(t,e)},I.__r=function(t){wt&&wt(t),_e=0;var e=(N=t.__c).__H;e&&(qe===N?(e.__h=[],N.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(De),e.__h.forEach(We),e.__h=[],_e=0)),qe=N},I.diffed=function(t){xt&&xt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(At.push(e)!==1&&vt===I.requestAnimationFrame||((vt=I.requestAnimationFrame)||Sr)(Er)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),qe=N=null},I.__c=function(t,e){e.some(function(r){try{r.__h.forEach(De),r.__h=r.__h.filter(function(n){return!n.__||We(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],I.__e(n,r.__v)}}),Ct&&Ct(t,e)},I.unmount=function(t){Tt&&Tt(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{De(n)}catch(i){e=i}}),r.__H=void 0,e&&I.__e(e,r.__v))};var St=typeof requestAnimationFrame=="function";function Sr(t){var e,r=function(){clearTimeout(n),St&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);St&&(e=requestAnimationFrame(r))}function De(t){var e=N,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),N=e}function We(t){var e=N;t.__c=t.__(),N=e}function Lt(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function Rt(t,e){return typeof e=="function"?e(t):e}var Ar=0;function p(t,e,r,n,i,o){e||(e={});var a,l,u=e;if("ref"in u)for(l in u={},e)l=="ref"?a=e[l]:u[l]=e[l];var c={type:t,props:u,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ar,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(a=t.defaultProps))for(l in a)u[l]===void 0&&(u[l]=a[l]);return L.vnode&&L.vnode(c),c}var Dt=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M16.72 7.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1 0 1.06l-3.75 3.75a.75.75 0 1 1-1.06-1.06l2.47-2.47H3a.75.75 0 0 1 0-1.5h16.19l-2.47-2.47a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),Mr=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 0 1 1.04-.208Z",clipRule:"evenodd"})}),Nt=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),Xe=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:p("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),Ht=()=>p("svg",{width:"32",height:"32",viewBox:"0 0 900 900",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("circle",{cx:"446",cy:"450",r:"424",fill:"black"}),p("circle",{cx:"450",cy:"450",r:"357",fill:"#E8E8E8"}),p("ellipse",{cx:"579.85",cy:"294.451",rx:"79.778",ry:"108.483",transform:"rotate(-46.2324 579.85 294.451)",fill:"black"})]}),Pr=`
|
|
6
6
|
:host { --kb-font-family: system-ui, -apple-system, sans-serif; --kb-bg-container: rgba(255, 255, 255, 0.05); --kb-border-container: rgba(255, 255, 255, 0.2); --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 16px; --kb-text-title: #ffffff; --kb-text-subtitle: rgba(255, 255, 255, 0.7); --kb-btn-dismiss-bg: rgba(0, 0, 0, 0.7); --kb-btn-dismiss-border: rgba(255, 255, 255, 0.2); --kb-btn-dismiss-text: rgba(255, 255, 255, 0.8); --kb-btn-dismiss-hover-bg: rgba(0, 0, 0, 0.9); --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #000000; --kb-btn-trigger-hover-bg: rgba(255, 255, 255, 0.9); --kb-progress-track: rgba(255, 255, 255, 0.2); --kb-progress-indicator: #ffffff; --kb-popover-bg: rgba(255, 255, 255, 0.05); --kb-popover-border: rgba(255, 255, 255, 0.2); --kb-popover-text: #ffffff; --kb-input-bg: transparent; --kb-input-border: rgba(255, 255, 255, 0.3); --kb-input-text: #ffffff; --kb-input-placeholder: rgba(255, 255, 255, 0.6); --kb-form-label: #ffffff; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-focus-blur: 10px; --kb-kbd-bg: rgba(255, 255, 255, 0.1); --kb-kbd-border: rgba(255, 255, 255, 0.2); --kb-kbd-text: rgba(255, 255, 255, 0.6); --kb-watermark-text: rgba(255, 255, 255, 0.4); font-family: var(--kb-font-family); }
|
|
7
7
|
.theme-light { --kb-bg-container: #ffffff; --kb-border-container: #e2e8f0; --kb-shadow-container: 0 20px 25px -5px rgba(0, 0, 0, 0.1); --kb-backdrop-blur: 0px; --kb-text-title: #0f172a; --kb-text-subtitle: #475569; --kb-btn-dismiss-bg: #ffffff; --kb-btn-dismiss-border: #e2e8f0; --kb-btn-dismiss-text: #64748b; --kb-btn-dismiss-hover-bg: #f1f5f9; --kb-btn-dismiss-hover-text: #0f172a; --kb-btn-trigger-bg: #0f172a; --kb-btn-trigger-text: #ffffff; --kb-btn-trigger-hover-bg: #1e293b; --kb-progress-track: #e2e8f0; --kb-progress-indicator: #0f172a; --kb-popover-bg: #ffffff; --kb-popover-border: #e2e8f0; --kb-popover-text: #0f172a; --kb-input-bg: #ffffff; --kb-input-border: #cbd5e1; --kb-input-text: #0f172a; --kb-input-placeholder: #94a3b8; --kb-form-label: #334155; --kb-success-color: #059669; --kb-error-text: #ef4444; --kb-kbd-bg: #f1f5f9; --kb-kbd-border: #e2e8f0; --kb-kbd-text: #64748b; --kb-watermark-text: #94a3b8; }
|
|
8
8
|
.theme-dark { --kb-bg-container: #0f172a; --kb-border-container: #334155; --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 0px; --kb-text-title: #f1f5f9; --kb-text-subtitle: #94a3b8; --kb-btn-dismiss-bg: #1e293b; --kb-btn-dismiss-border: #334155; --kb-btn-dismiss-text: #cbd5e1; --kb-btn-dismiss-hover-bg: #334155; --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #0f172a; --kb-btn-trigger-hover-bg: #f1f5f9; --kb-progress-track: #1e293b; --kb-progress-indicator: #ffffff; --kb-popover-bg: #0f172a; --kb-popover-border: #334155; --kb-popover-text: #f1f5f9; --kb-input-bg: #0f172a; --kb-input-border: #475569; --kb-input-text: #f1f5f9; --kb-input-placeholder: #94a3b8; --kb-form-label: #e2e8f0; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-kbd-bg: #1e293b; --kb-kbd-border: #334155; --kb-kbd-text: #94a3b8; --kb-watermark-text: #64748b; }
|
|
@@ -71,7 +71,15 @@
|
|
|
71
71
|
/* Launcher dismiss button */
|
|
72
72
|
.launcher .btn-dismiss.launcher-dismiss { top: -0.375rem; left: -0.375rem; width: 1.25rem; height: 1.25rem; opacity: 0; transition: opacity 0.2s ease-out, background-color 0.3s ease-out, color 0.3s ease-out; }
|
|
73
73
|
.launcher:hover .btn-dismiss.launcher-dismiss { opacity: 1; }
|
|
74
|
-
`,Nt=(t,e,r)=>{let n=F(!1);G(()=>{let i=t.current;if(!i)return;let o=r.direction==="top-to-bottom",a=o?"translateY(-60px)":"translateX(60px)",l=o?"translateY(-20px)":"translateX(20px)",u="translate(0, 0)";if(e){n.current=!0;let c=i.animate([{opacity:0,transform:a},{opacity:1,transform:u}],{duration:500,delay:r.entranceDelayMs,easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fill:"forwards"});c.onfinish=()=>r.onEntranceComplete?.()}else if(n.current){let c=i.animate([{opacity:1,transform:u},{opacity:0,transform:l}],{duration:350,delay:r.exitDelayMs,easing:"ease-in-out",fill:"forwards"});c.onfinish=()=>r.onExitComplete?.()}else i.style.opacity="0",i.style.transform=l},[e,r.direction])},Ht=t=>{if(!t)return{};let e={};return t.fontFamily&&(e["--kb-font-family"]=t.fontFamily),t.backgroundColor&&(e["--kb-bg-container"]=t.backgroundColor,e["--kb-popover-bg"]=t.backgroundColor),t.borderColor&&(e["--kb-border-container"]=t.borderColor,e["--kb-popover-border"]=t.borderColor),t.textColor&&(e["--kb-text-title"]=t.textColor,e["--kb-popover-text"]=t.textColor),t.subtitleColor&&(e["--kb-text-subtitle"]=t.subtitleColor),t.borderRadius&&(e["border-radius"]=t.borderRadius,e["border-bottom-left-radius"]=t.borderRadius,e["border-bottom-right-radius"]=t.borderRadius),t.primaryColor&&(e["--kb-btn-trigger-bg"]=t.primaryColor,e["--kb-progress-indicator"]=t.primaryColor,e["--kb-success-color"]=t.primaryColor),t.primaryTextColor&&(e["--kb-btn-trigger-text"]=t.primaryTextColor),e},Er=({config:t,isOpen:e,skipFocus:r,setIsOpen:n})=>{let i=t.mountMode==="inline",o=F(null),a=F(null),l=F(null),u=F(null),c=F(null),[d,s]=ge("card"),m=F(!1),f=F(!1),A=F(!1),R=F(!1),T=F("card"),h=F(t.status),w=F(!!t.isVisible),S=F(null),L=F(null),N=F(!1),[g,z]=ge(!1),[K,O]=ge({}),[V,M]=ge(0),B=F(0),Q=t.enableTimer!==!1,se=Math.max(500,t.timerDurationMs??2e4),ie=At(b=>{B.current=b,M(b)},[]);G(()=>{t.isVisible&&(s("card"),m.current=!1)},[t.isVisible]),d==="card"&&T.current==="launcher"&&(A.current=!1),t.status==="success"&&h.current!=="success"?d==="card"&&(A.current=!0):t.status!=="success"&&(A.current=!1),h.current=t.status,G(()=>{let b=T.current==="launcher",x=d==="card";b&&x&&f.current&&(R.current=!0,setTimeout(()=>{R.current=!1},100)),d==="launcher"&&z(!1),b&&x&&Q&&(ie(0),S.current=null,N.current=!1)},[d,ie,Q]),G(()=>{if(t.status==="success"&&(f.current=!0,t.enableLauncher&&d==="card"&&A.current)){let b=setTimeout(()=>{s("launcher")},2e3);return()=>clearTimeout(b)}},[t.status,t.enableLauncher,d]),G(()=>{t.isVisible&&!w.current&&Q&&(ie(0),S.current=null,N.current=!1),w.current=!!t.isVisible},[t.isVisible,ie,Q]),G(()=>{T.current=d},[d]);let le=F(!1);r&&(le.current=!0),G(()=>{if(e){f.current&&c.current&&c.current.reset();let b=le.current;if(le.current=!1,!b){let x=setTimeout(()=>{u.current&&u.current.focus()},100);return()=>clearTimeout(x)}}},[e]);let k=F(e);G(()=>{let b=k.current;k.current=e,!b&&e&&d==="launcher"&&s("card")},[e,d]),i||(Nt(o,!!t.isVisible&&d==="card",{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:m.current?0:t.entranceDelayMs||0,exitDelayMs:75,onEntranceComplete:()=>{t.onEntranceComplete?.(),m.current=!0},onExitComplete:()=>{t.isVisible||t.onExitComplete?.()}}),Nt(a,!!t.isVisible&&d==="launcher",{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:0,exitDelayMs:75})),G(()=>{let b=l.current;if(!b)return;let x=t.status==="success";if(t.enableFocusMode&&d==="card"&&t.isVisible&&!x){let E=setTimeout(()=>{b.classList.add("active")},t.focusDelayMs||500);return()=>clearTimeout(E)}else b.classList.remove("active")},[t.enableFocusMode,d,t.isVisible,t.focusDelayMs,t.status]),G(()=>{if(!t.isVisible)return;let b=x=>{if(x.key==="Escape"){if(e){n(!1);return}d==="card"&&(t.enableLauncher?s("launcher"):t.onDismiss?.());return}(($,Y)=>{let ee=Y||{key:"p",modifiers:["meta","ctrl"]};if($.key.toLowerCase()!==ee.key.toLowerCase())return!1;let W=ee.modifiers||[];if(Y){let He=W.includes("meta")===$.metaKey,we=W.includes("ctrl")===$.ctrlKey,Ie=W.includes("alt")===$.altKey,qt=W.includes("shift")===$.shiftKey;return He&&we&&Ie&&qt}return $.metaKey||$.ctrlKey})(x,t.keyboardShortcut)&&(x.preventDefault(),d==="launcher"?(s("card"),n(!0)):d==="card"&&(t.enableLauncher?s("launcher"):t.onDismiss?.()))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t.isVisible,e,d,t.enableLauncher,n,t.onDismiss]);let y=typeof navigator<"u"&&/Mac/.test(navigator.userAgent),D=(()=>{if(t.keyboardShortcut){let b=t.keyboardShortcut.modifiers||[],x=[];return b.includes("meta")&&x.push(y?"\u2318":"Win"),b.includes("ctrl")&&x.push("Ctrl"),b.includes("alt")&&x.push(y?"Opt":"Alt"),b.includes("shift")&&x.push("Shift"),x.push(t.keyboardShortcut.key.toUpperCase()),x}return[y?"\u2318":"Ctrl","P"]})(),v=t.status==="starting",C=t.status==="success",J=t.status==="error",q=C&&A.current,U=t.textOverrides||{},ue=C?U.titleSuccess||"Personalization complete":v?"Starting personalization":J?U.titleError||"Let's try that again":t.hasPersonalization?"Personalization ready":U.titleResting||"Personalization available",Z=C?U.subtitleSuccess||"Take a look":v?"Hang tight...":J?U.subtitleError||"Something went wrong. Tap to retry.":U.subtitleResting||"This page can adapt to you",oe=v?U.btnLoading||"Starting...":J?U.btnError||"Try again":C&&A.current?U.btnSuccess||"Personalised":f.current?"Show me again":U.btnResting||"Show me",X=(b,x,E)=>{if(!E)return null;if(E.required&&!x.trim())return E.errorMessage||`${E.label} is required`;if(!x)return null;if(E.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x))return E.errorMessage||"Please enter a valid email address";if(E.type==="url")try{new URL(x)}catch{return E.errorMessage||"Please enter a valid URL (e.g., https://example.com)"}return E.minLength&&x.length<E.minLength?E.errorMessage||`Must be at least ${E.minLength} characters`:E.maxLength&&x.length>E.maxLength?E.errorMessage||`Must be at most ${E.maxLength} characters`:E.pattern&&!new RegExp(E.pattern).test(x)?E.errorMessage||"Invalid format":null},fe=b=>{if(b.preventDefault(),v)return;let x=new FormData(b.target),E={},$={},Y=!1;if(x.forEach((ee,W)=>{let Ne=ee.toString();E[W]=Ne;let He=t.fields.find(Ie=>Ie.name===W),we=X(W,Ne,He);we&&($[W]=we,Y=!0)}),Y){O($);return}O({}),n(!1),t.onSubmitPersonalization?.(E)},ke=b=>{let x=b.target,E=x.name;if(K[E]){let $=t.fields.find(ee=>ee.name===E),Y=X(E,x.value,$);O(ee=>{let W={...ee};return Y?W[E]=Y:delete W[E],W})}},Vt=b=>{b.stopPropagation(),!(v||C)&&n(!e)};G(()=>{if(!Q||N.current)return;if(!(t.isVisible&&d==="card"&&t.status==="resting"&&!e&&!g)){L.current!==null&&(cancelAnimationFrame(L.current),L.current=null),S.current=null;return}let x=E=>{S.current===null&&(S.current=E-B.current/100*se);let $=E-S.current,Y=Math.min(1,$/se),ee=Y*100;if(ie(ee),Y>=1){N.current=!0,S.current=null,L.current=null,t.enableLauncher?(s("launcher"),n(!1)):t.onDismiss?.();return}L.current=requestAnimationFrame(x)};return L.current=requestAnimationFrame(x),()=>{L.current!==null&&(cancelAnimationFrame(L.current),L.current=null)}},[t.enableLauncher,t.isVisible,t.onDismiss,t.status,g,e,d,n,se,Q,ie]),G(()=>()=>{L.current!==null&&cancelAnimationFrame(L.current)},[]);let Bt=Math.max(0,Math.min(100,t.progressPct??0)),jt=Q?V:Bt;return p(te,{children:[p("div",{ref:l,class:"backdrop"}),p("div",{ref:o,class:`container theme-${t.theme||"glass"} pos-${t.position||"top-center"}`,style:Ht(t.customTheme),onClick:()=>!e&&!v&&!C&&n(!0),onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[p("button",{class:"btn-dismiss","aria-label":"Dismiss",onClick:b=>{b.stopPropagation(),N.current=!0,t.enableLauncher?s("launcher"):t.onDismiss?.()},children:p(Rt,{})}),p("div",{class:"content-wrapper",children:[p("div",{class:"logo",children:p(Dt,{})}),p("div",{class:"text-content",children:p("div",{class:"text-row",children:[p("div",{children:[p("div",{class:"title",children:ue}),p("div",{class:"subtitle",children:Z})]}),p("button",{class:`btn btn-trigger ${q?"success":""}`,disabled:v||q,onClick:Vt,children:v?p(te,{children:[p(Xe,{})," ",oe]}):q?p(te,{children:[p(Tr,{})," ",oe]}):oe})]})})]}),p("div",{class:"progress-clip",children:p("div",{class:"progress-container",children:p("div",{class:"progress-bar",style:{width:`${jt}%`}})})}),p("div",{class:`popover ${e?"open":""}`,onClick:b=>b.stopPropagation(),children:[p("form",{onSubmit:fe,ref:c,children:[t.fields.map((b,x)=>p("div",{class:"form-group",children:[p("label",{class:`form-label ${K[b.name]?"error":""}`,children:b.label}),p("div",{class:"input-row",children:[p("input",{ref:x===0?u:void 0,class:`form-input ${K[b.name]?"error":""}`,name:b.name,type:b.type||"text",placeholder:b.placeholder,required:b.required,onInput:ke}),t.fields.length===1&&p("button",{type:"submit",class:"btn btn-submit",disabled:v,children:v?p(Xe,{}):p(Lt,{})})]}),K[b.name]&&p("div",{class:"form-message",children:K[b.name]})]},b.name)),t.fields.length>1&&p("button",{type:"submit",class:"btn btn-submit",style:{width:"100%"},disabled:v,children:v?p(Xe,{}):p(Lt,{})})]}),t.showWatermark&&p("div",{class:"watermark",children:["Powered by"," ",p("a",{href:"https://kenobi.ai",target:"_blank",rel:"noopener noreferrer",children:"Kenobi"})]})]}),t.showKeyboardHints&&t.enableFocusMode&&p("div",{class:`kbd-hint ${!e&&!v&&!C?"visible":""}`,children:[p("div",{class:"kbd-group",children:p("div",{class:"kbd",children:"Esc"})}),p("span",{class:"kbd-text",children:"to dismiss"})]})]}),p("div",{ref:a,class:`launcher theme-${t.theme||"glass"} pos-${t.position||"top-center"}`,style:Ht(t.customTheme),onClick:b=>{b.stopPropagation(),s("card"),n(!0)},role:"button",tabIndex:0,children:[p("button",{class:"btn-dismiss launcher-dismiss","aria-label":"Dismiss",onClick:b=>{b.stopPropagation(),t.onDismiss?.()},children:p(Rt,{})}),p("div",{style:{display:"flex",width:"20px",height:"20px",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:p("div",{style:{transform:"scale(0.6)"},children:p(Dt,{})})}),t.textOverrides?.launcherLabel||(f.current?"Personalize again":"Personalize"),t.showKeyboardHints&&p("div",{class:"kbd-hint visible",children:p("div",{class:"kbd-group",children:D.map((b,x)=>p("div",{class:"kbd",children:b},x))})})]})]})},ve=class{constructor(e){_(this,"host");_(this,"shadow");_(this,"config");_(this,"isOpen",!1);_(this,"skipFocus",!1);_(this,"mountTarget",null);this.config={position:"top-center",direction:"top-to-bottom",theme:"glass",entranceDelayMs:0,exitDelayMs:75,hasPersonalization:!1,isVisible:!1,progressPct:0,status:"resting",enableTimer:!0,timerDurationMs:2e4,enableLauncher:!0,enableFocusMode:!1,focusBlurIntensity:"10px",focusDelayMs:500,showKeyboardHints:!1,showWatermark:!0,mountMode:"overlay",...e},this.mountTarget=e.mountNode??null,this.host=document.createElement("div"),this.host.id="kenobi-cue-card-root",this.applyHostStyles(),this.shadow=this.host.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=Sr,this.shadow.appendChild(r);let n=document.createElement("div");this.shadow.appendChild(n)}applyHostStyles(){let e=this.config.mountMode==="inline";if(this.host.classList.toggle("kb-inline",e),e){this.host.style.cssText=`
|
|
74
|
+
/* Launcher logo */
|
|
75
|
+
.launcher-logo { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
|
|
76
|
+
.launcher-logo svg { width: 20px; height: 20px; }
|
|
77
|
+
/* Mobile: hide keyboard hints, show dismiss button */
|
|
78
|
+
@media (max-width: 768px) {
|
|
79
|
+
.launcher .kbd-hint { display: none; }
|
|
80
|
+
.launcher .btn-dismiss.launcher-dismiss { opacity: 1; }
|
|
81
|
+
}
|
|
82
|
+
`,It=(t,e,r)=>{let n=F(!1);X(()=>{let i=t.current;if(!i)return;let o=r.direction==="top-to-bottom",a=o?"translateY(-60px)":"translateX(60px)",l=o?"translateY(-20px)":"translateX(20px)",u="translate(0, 0)";if(e){n.current=!0;let c=i.animate([{opacity:0,transform:a},{opacity:1,transform:u}],{duration:500,delay:r.entranceDelayMs,easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fill:"forwards"});c.onfinish=()=>r.onEntranceComplete?.()}else if(n.current){let c=i.animate([{opacity:1,transform:u},{opacity:0,transform:l}],{duration:350,delay:r.exitDelayMs,easing:"ease-in-out",fill:"forwards"});c.onfinish=()=>r.onExitComplete?.()}else i.style.opacity="0",i.style.transform=l},[e,r.direction])},Ft=t=>{if(!t)return{};let e={};return t.fontFamily&&(e["--kb-font-family"]=t.fontFamily),t.backgroundColor&&(e["--kb-bg-container"]=t.backgroundColor,e["--kb-popover-bg"]=t.backgroundColor),t.borderColor&&(e["--kb-border-container"]=t.borderColor,e["--kb-popover-border"]=t.borderColor),t.textColor&&(e["--kb-text-title"]=t.textColor,e["--kb-popover-text"]=t.textColor),t.subtitleColor&&(e["--kb-text-subtitle"]=t.subtitleColor),t.borderRadius&&(e["border-radius"]=t.borderRadius,e["border-bottom-left-radius"]=t.borderRadius,e["border-bottom-right-radius"]=t.borderRadius),t.primaryColor&&(e["--kb-btn-trigger-bg"]=t.primaryColor,e["--kb-progress-indicator"]=t.primaryColor,e["--kb-success-color"]=t.primaryColor),t.primaryTextColor&&(e["--kb-btn-trigger-text"]=t.primaryTextColor),e},Lr=({config:t,isOpen:e,skipFocus:r,setIsOpen:n})=>{let i=t.mountMode==="inline",o=F(null),a=F(null),l=F(null),u=F(null),c=F(null),[d,s]=pe("card"),[f,m]=pe(!1),S=F(!1),A=F(!1),w=F(!1),h=F(!1),k=F("card"),P=F(t.status),O=F(!!t.isVisible),R=F(null),b=F(null),z=F(!1),[q,K]=pe(!1),[V,E]=pe({}),[W,ke]=pe(0),ce=F(0),re=t.enableTimer!==!1,ae=Math.max(500,t.timerDurationMs??2e4),y=Pt(_=>{ce.current=_,ke(_)},[]);X(()=>{t.isVisible&&(s("card"),S.current=!1,m(!1))},[t.isVisible]),d==="card"&&k.current==="launcher"&&(w.current=!1),t.status==="success"&&P.current!=="success"?d==="card"&&(w.current=!0):t.status!=="success"&&(w.current=!1),P.current=t.status,X(()=>{let _=k.current==="launcher",C=d==="card";_&&C&&A.current&&(h.current=!0,setTimeout(()=>{h.current=!1},100)),d==="launcher"&&K(!1),_&&C&&re&&(y(0),R.current=null,z.current=!1)},[d,y,re]),X(()=>{if(t.status==="success"&&(A.current=!0,t.enableLauncher&&d==="card"&&w.current)){let _=setTimeout(()=>{s("launcher")},2e3);return()=>clearTimeout(_)}},[t.status,t.enableLauncher,d]),X(()=>{t.isVisible&&!O.current&&re&&(y(0),R.current=null,z.current=!1),O.current=!!t.isVisible},[t.isVisible,y,re]),X(()=>{k.current=d},[d]);let v=F(!1);r&&(v.current=!0),X(()=>{if(e){A.current&&c.current&&c.current.reset();let _=v.current;if(v.current=!1,!_){let C=setTimeout(()=>{u.current&&u.current.focus()},100);return()=>clearTimeout(C)}}},[e]);let D=F(e);X(()=>{let _=D.current;D.current=e,!_&&e&&d==="launcher"&&s("card")},[e,d]),i||(It(o,!!t.isVisible&&d==="card"&&!f,{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:S.current?0:t.entranceDelayMs||0,exitDelayMs:75,onEntranceComplete:()=>{t.onEntranceComplete?.(),S.current=!0},onExitComplete:()=>{(!t.isVisible||f)&&t.onExitComplete?.()}}),It(a,!!t.isVisible&&d==="launcher"&&!f,{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:0,exitDelayMs:75})),X(()=>{let _=l.current;if(!_)return;let C=t.status==="success";if(t.enableFocusMode&&d==="card"&&t.isVisible&&!C){let T=setTimeout(()=>{_.classList.add("active")},t.focusDelayMs||500);return()=>clearTimeout(T)}else _.classList.remove("active")},[t.enableFocusMode,d,t.isVisible,t.focusDelayMs,t.status]),X(()=>{if(!t.isVisible)return;let _=C=>{if(C.key==="Escape"){if(e){n(!1);return}d==="card"&&(t.enableLauncher?s("launcher"):t.onDismiss?.());return}((B,Y)=>{let Z=Y||{key:"p",modifiers:["meta","ctrl"]};if(B.key.toLowerCase()!==Z.key.toLowerCase())return!1;let G=Z.modifiers||[];if(Y){let He=G.includes("meta")===B.metaKey,we=G.includes("ctrl")===B.ctrlKey,Ie=G.includes("alt")===B.altKey,Yt=G.includes("shift")===B.shiftKey;return He&&we&&Ie&&Yt}return B.metaKey||B.ctrlKey})(C,t.keyboardShortcut)&&(C.preventDefault(),d==="launcher"?(s("card"),n(!0)):d==="card"&&(t.enableLauncher?s("launcher"):t.onDismiss?.()))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[t.isVisible,e,d,t.enableLauncher,n,t.onDismiss]);let x=typeof navigator<"u"&&/Mac/.test(navigator.userAgent),M=(()=>{if(t.keyboardShortcut){let _=t.keyboardShortcut.modifiers||[],C=[];return _.includes("meta")&&C.push(x?"\u2318":"Win"),_.includes("ctrl")&&C.push("Ctrl"),_.includes("alt")&&C.push(x?"Opt":"Alt"),_.includes("shift")&&C.push("Shift"),C.push(t.keyboardShortcut.key.toUpperCase()),C}return[x?"\u2318":"Ctrl","P"]})(),H=t.status==="starting",$=t.status==="success",Q=t.status==="error",ie=$&&w.current,U=t.textOverrides||{},ue=$?U.titleSuccess||"Personalization complete":H?"Starting personalization":Q?U.titleError||"Let's try that again":t.hasPersonalization?"Personalization ready":U.titleResting||"Personalization available",J=$?U.subtitleSuccess||"Take a look":H?"Hang tight...":Q?U.subtitleError||"Something went wrong. Tap to retry.":U.subtitleResting||"This page can adapt to you",se=H?U.btnLoading||"Starting...":Q?U.btnError||"Try again":$&&w.current?U.btnSuccess||"Personalised":A.current?"Show me again":U.btnResting||"Show me",me=(_,C,T)=>{if(!T)return null;if(T.required&&!C.trim())return T.errorMessage||`${T.label} is required`;if(!C)return null;if(T.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(C))return T.errorMessage||"Please enter a valid email address";if(T.type==="url")try{new URL(C)}catch{return T.errorMessage||"Please enter a valid URL (e.g., https://example.com)"}return T.minLength&&C.length<T.minLength?T.errorMessage||`Must be at least ${T.minLength} characters`:T.maxLength&&C.length>T.maxLength?T.errorMessage||`Must be at most ${T.maxLength} characters`:T.pattern&&!new RegExp(T.pattern).test(C)?T.errorMessage||"Invalid format":null},jt=_=>{if(_.preventDefault(),H)return;let C=new FormData(_.target),T={},B={},Y=!1;if(C.forEach((Z,G)=>{let Ne=Z.toString();T[G]=Ne;let He=t.fields.find(Ie=>Ie.name===G),we=me(G,Ne,He);we&&(B[G]=we,Y=!0)}),Y){E(B);return}E({}),n(!1),t.onSubmitPersonalization?.(T)},qt=_=>{let C=_.target,T=C.name;if(V[T]){let B=t.fields.find(Z=>Z.name===T),Y=me(T,C.value,B);E(Z=>{let G={...Z};return Y?G[T]=Y:delete G[T],G})}},Wt=_=>{_.stopPropagation(),!(H||$)&&n(!e)};X(()=>{if(!re||z.current)return;if(!(t.isVisible&&d==="card"&&t.status==="resting"&&!e&&!q)){b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),R.current=null;return}let C=T=>{R.current===null&&(R.current=T-ce.current/100*ae);let B=T-R.current,Y=Math.min(1,B/ae),Z=Y*100;if(y(Z),Y>=1){z.current=!0,R.current=null,b.current=null,t.enableLauncher?(s("launcher"),n(!1)):t.onDismiss?.();return}b.current=requestAnimationFrame(C)};return b.current=requestAnimationFrame(C),()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null)}},[t.enableLauncher,t.isVisible,t.onDismiss,t.status,q,e,d,n,ae,re,y]),X(()=>()=>{b.current!==null&&cancelAnimationFrame(b.current)},[]);let Gt=Math.max(0,Math.min(100,t.progressPct??0)),Xt=re?W:Gt,Je=!!t.isVisible&&d==="card"&&!f,Ze=!!t.isVisible&&d==="launcher"&&!f;return p(ee,{children:[p("div",{ref:l,class:"backdrop",style:{display:Je||Ze?"block":"none"}}),p("div",{ref:o,class:`container theme-${t.theme||"glass"} pos-${t.position||"top-center"}`,style:{...Ft(t.customTheme),pointerEvents:Je?"auto":"none"},onClick:()=>!e&&!H&&!$&&n(!0),onMouseEnter:()=>K(!0),onMouseLeave:()=>K(!1),children:[p("button",{class:"btn-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),z.current=!0,t.enableLauncher?s("launcher"):t.onDismiss?.()},children:p(Nt,{})}),p("div",{class:"content-wrapper",children:[p("div",{class:"logo",children:p(Ht,{})}),p("div",{class:"text-content",children:p("div",{class:"text-row",children:[p("div",{children:[p("div",{class:"title",children:ue}),p("div",{class:"subtitle",children:J})]}),p("button",{class:`btn btn-trigger ${ie?"success":""}`,disabled:H||ie,onClick:Wt,children:H?p(ee,{children:[p(Xe,{})," ",se]}):ie?p(ee,{children:[p(Mr,{})," ",se]}):se})]})})]}),p("div",{class:"progress-clip",children:p("div",{class:"progress-container",children:p("div",{class:"progress-bar",style:{width:`${Xt}%`}})})}),p("div",{class:`popover ${e?"open":""}`,onClick:_=>_.stopPropagation(),children:[p("form",{onSubmit:jt,ref:c,children:[t.fields.map((_,C)=>p("div",{class:"form-group",children:[p("label",{class:`form-label ${V[_.name]?"error":""}`,children:_.label}),p("div",{class:"input-row",children:[p("input",{ref:C===0?u:void 0,class:`form-input ${V[_.name]?"error":""}`,name:_.name,type:_.type||"text",placeholder:_.placeholder,required:_.required,onInput:qt}),t.fields.length===1&&p("button",{type:"submit",class:"btn btn-submit",disabled:H,children:H?p(Xe,{}):p(Dt,{})})]}),V[_.name]&&p("div",{class:"form-message",children:V[_.name]})]},_.name)),t.fields.length>1&&p("button",{type:"submit",class:"btn btn-submit",style:{width:"100%"},disabled:H,children:H?p(Xe,{}):p(Dt,{})})]}),t.showWatermark&&p("div",{class:"watermark",children:["Powered by"," ",p("a",{href:"https://kenobi.ai",target:"_blank",rel:"noopener noreferrer",children:"Kenobi"})]})]}),t.showKeyboardHints&&t.enableFocusMode&&p("div",{class:`kbd-hint ${!e&&!H&&!$?"visible":""}`,children:[p("div",{class:"kbd-group",children:p("div",{class:"kbd",children:"Esc"})}),p("span",{class:"kbd-text",children:"to dismiss"})]})]}),p("div",{ref:a,class:`launcher theme-${t.theme||"glass"} pos-${t.position||"top-center"}`,style:{...Ft(t.customTheme),pointerEvents:Ze?"auto":"none"},onClick:_=>{_.stopPropagation(),m(!1),s("card"),n(!0)},role:"button",tabIndex:0,children:[p("button",{class:"btn-dismiss launcher-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),m(!0),t.onDismiss?.()},children:p(Nt,{})}),p("div",{class:"launcher-logo",children:p(Ht,{})}),t.textOverrides?.launcherLabel||(A.current?"Personalize again":"Personalize"),t.showKeyboardHints&&p("div",{class:"kbd-hint visible",children:p("div",{class:"kbd-group",children:M.map((_,C)=>p("div",{class:"kbd",children:_},C))})})]})]})},ye=class{constructor(e){g(this,"host");g(this,"shadow");g(this,"config");g(this,"isOpen",!1);g(this,"skipFocus",!1);g(this,"mountTarget",null);this.config={position:"top-center",direction:"top-to-bottom",theme:"glass",entranceDelayMs:0,exitDelayMs:75,hasPersonalization:!1,isVisible:!1,progressPct:0,status:"resting",enableTimer:!0,timerDurationMs:2e4,enableLauncher:!0,enableFocusMode:!1,focusBlurIntensity:"10px",focusDelayMs:500,showKeyboardHints:!1,showWatermark:!0,mountMode:"overlay",...e},this.mountTarget=e.mountNode??null,this.host=document.createElement("div"),this.host.id="kenobi-cue-card-root",this.applyHostStyles(),this.shadow=this.host.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=Pr,this.shadow.appendChild(r);let n=document.createElement("div");this.shadow.appendChild(n)}applyHostStyles(){let e=this.config.mountMode==="inline";if(this.host.classList.toggle("kb-inline",e),e){this.host.style.cssText=`
|
|
75
83
|
position: relative !important;
|
|
76
84
|
z-index: auto !important;
|
|
77
85
|
top: auto !important;
|
|
@@ -90,5 +98,5 @@
|
|
|
90
98
|
height: 0 !important;
|
|
91
99
|
pointer-events: none !important;
|
|
92
100
|
isolation: isolate !important;
|
|
93
|
-
`}mount(e){let r=e||this.config.mountNode||this.mountTarget||document.body;this.mountTarget=r,r.contains(this.host)||r.appendChild(this.host),this.applyHostStyles(),this.render()}unmount(){je(null,this.shadow.lastElementChild),this.host.remove()}update(e){e.status==="starting"&&this.config.status!=="starting"&&(this.isOpen=!1),this.config={...this.config,...e},this.applyHostStyles(),this.render()}setTheme(e){this.update({theme:e})}openForm(e){this.isOpen=!0,this.skipFocus=e??!1,this.render()}render(){let e=this.shadow.lastElementChild,r=this.skipFocus;this.skipFocus=!1,je(p(
|
|
94
|
-
`);break;default:m=s.split("")}let f=document.createDocumentFragment(),A=c;return m.forEach(R=>{if(R.length===0)return;if(R.trim().length===0){f.appendChild(document.createTextNode(R));return}let h=document.createElement("span");h.textContent=R,h.style.display="inline-block",h.style.opacity="0",d&&(h.style.setProperty("background","inherit"),h.style.setProperty("-webkit-background-clip","text"),h.style.setProperty("background-clip","text"),h.style.setProperty("color","transparent"),h.style.setProperty("will-change","opacity, transform"));let w=this.resolveKeyframes(r.keyframes),S=r.durationMs??n.durationMs??300,L=n.easing??"ease",N=h.animate(w,{duration:S,easing:L,delay:A,fill:"forwards"});N.addEventListener("finish",()=>{N.commitStyles(),N.cancel()}),f.appendChild(h),A+=r.staggerMs??50}),u.parentNode?.replaceChild(f,u),A}if(u.nodeType===Node.ELEMENT_NODE){let s=c,m=Array.from(u.childNodes);for(let f of m)s=l(f,s,d);return s}return c};l(e,i,a)})}},Kt=new Set(["Replace","InsertBefore","InsertAfter","Delete","SetFormField"]),$t=t=>typeof t=="string",Hr=t=>Array.isArray(t)&&t.every(e=>$t(e)),Ir=t=>typeof t=="string"&&Kt.has(t),Fr=t=>{if(typeof t!="object"||t===null)return!1;let e=t;return $t(e.identifier)&&typeof e.markup=="string"&&Hr(e.selectorGuesses)&&Ir(e.action)&&(e.transition===void 0||Nr(e.transition))},Or=t=>{if(typeof t!="object"||t===null)throw new Error("Invalid response: expected object with data array");let e=t.data;if(!Array.isArray(e))throw new Error("Invalid response: data must be an array");return e.forEach((r,n)=>{if(!Fr(r))throw new Error(`Invalid transformation at index ${n}`)}),e},Qe=class{constructor(e){_(this,"config");_(this,"changeStack",new Map);_(this,"visitorKey",null);_(this,"orchestrator");_(this,"cueCardInstance",null);_(this,"currentPath");_(this,"currentUrl");_(this,"navTicking",!1);_(this,"transitionDefaults");_(this,"startAutoTransform",async()=>{try{this.syncChangeStack(),await this.waitForLoaded(),this.isFramer()&&(await this.waitForFrames(),await this.waitForIdle(),await this.waitForQuietDom(100,1e3)),await this.transform()}catch(e){this.log("error","Auto-transformation flow failed with error:",e)}});_(this,"transform",async()=>{try{let e=new Date;if(this.log("debug","Starting transform"),this.visitorKey===null){this.log("debug",`Couldn't find a visitor copy external ID with query param key "${It}"`,"Exiting...");return}let r=[];try{r=await this.getTransformations(this.currentPath,this.visitorKey)}catch(o){this.log("error_detailed","An error occurred _getting_ transformations",o)}try{await this.applyTransformations(r)}catch(o){this.log("error_detailed","An error occurred _applying_ transformations",o)}let n=new Date,i=this.getDurationInMilliseconds(e,n);this.log("debug",`Transformation complete, took ${this.formatThousands(i)} ms`)}catch(e){this.log("error","An unexpected, top-level error occurred during transformation",e)}});_(this,"log",(e,r,...n)=>{let a=`${`[Kenobi \u25D4] (v${typeof window.__KENOBI_VERSION__<"u"?window.__KENOBI_VERSION__:"dev"})`} [${e.toLocaleUpperCase()}] :: ${r}`;switch(e){case"debug":this.config.debug&&console.log(a,...n);break;case"info":console.log(a,...n);break;case"warn":console.warn(a,...n);break;case"error_detailed":console.trace(...n);case"error":console.error(a,...n);break}});_(this,"resolveTransitionConfig",e=>Mr(this.transitionDefaults,e));_(this,"retrieveElement",e=>{if(!Array.isArray(e)||e.some(r=>typeof r!="string"))throw new Error(`Invalid selectorGuesses payload received: expected array of strings but got ${JSON.stringify(e)}`);for(let r of e){let n=document.querySelectorAll(r);if(n.length===0)continue;if(n.length===1)return n[0];let i=Array.from(n).filter(a=>{let l=a.getBoundingClientRect(),u=getComputedStyle(a);return u.display!=="none"&&u.visibility!=="hidden"&&l.width>0&&l.height>0});if(i.length===0)continue;let o=i.sort((a,l)=>a.getBoundingClientRect().top-l.getBoundingClientRect().top);return this.log("debug",`Selector "${r}" matched ${n.length} elements, selected topmost visible one at y=${o[0].getBoundingClientRect().top}`),o[0]}throw new Error(`Could not find an element in the document with any of these selector patterns: ${e.join(", ")}`)});_(this,"getQueryParam",e=>new URLSearchParams(window.location.search).get(e));_(this,"getCurrentPath",()=>window.location.pathname);_(this,"getCurrentUrl",()=>window.location.pathname+window.location.search+window.location.hash);_(this,"getDurationInMilliseconds",(e,r)=>+r-+e);_(this,"formatThousands",e=>new Intl.NumberFormat("en-US").format(e));_(this,"setDebug",e=>this.config.debug=e);_(this,"isInputElement",e=>!(!(e instanceof HTMLInputElement)&&!(e instanceof HTMLTextAreaElement)&&!(e instanceof HTMLSelectElement)));_(this,"waitForFrames",()=>new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))));_(this,"waitForIdle",(e=1e3)=>new Promise(r=>"requestIdleCallback"in window?window.requestIdleCallback(()=>r(),{timeout:e}):setTimeout(r,50)));_(this,"waitForLoaded",()=>document.readyState==="complete"?Promise.resolve():new Promise(e=>window.addEventListener("load",()=>e(),{once:!0})));_(this,"waitForQuietDom",(e,r)=>new Promise(n=>{let i=performance.now(),o=new MutationObserver(()=>{i=performance.now()});o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let a=performance.now()+e;(function l(){let u=performance.now();if(u-i>=r){o.disconnect(),n();return}if(u>=a){o.disconnect(),n();return}requestAnimationFrame(l)})()}));_(this,"isFramer",()=>{let e=Array.from(document.scripts).map(n=>n.src||"");return["__framer_events"in window,document.querySelector("[data-framer-root],[data-framer-component],[data-framer-page]"),e.some(n=>/framerusercontent\.com\/sites/i.test(n))].some(n=>!!n)});_(this,"syncVisitorKey",()=>{try{let e=this.getQueryParam(It);e?(this.log("debug",`Query param value found (${e}), pushing into session storage`),sessionStorage.setItem(Ft,e),this.visitorKey=e):this.visitorKey=sessionStorage.getItem(Ft)}catch(e){this.log("error","Failed to sync visitor key with error:",e)}});_(this,"initNavigationListener",()=>{if("__KENOBI_NAV_HOOKED__"in window)return;window.__KENOBI_NAV_HOOKED__=!0;let e=i=>{this.navTicking||(this.navTicking=!0,queueMicrotask(()=>{this.navTicking=!1;let o=this.getCurrentUrl();o!==this.currentUrl&&(this.currentUrl=o,this.currentPath=this.getCurrentPath(),this.log("debug",`URL changed (${i}) \u2192 ${location.href}`),this.config.autoTransform&&(this.undoAll(),this.startAutoTransform()))}))};if("navigation"in window){let i=window.navigation;i&&"addEventListener"in i&&typeof i.addEventListener=="function"&&(i.addEventListener("navigate",()=>e("navigation:navigate")),i.addEventListener("currententrychange",()=>e("navigation:entrychange")),i.addEventListener?.("navigatesuccess",()=>e("navigation:success")))}let r=history.pushState.bind(history),n=history.replaceState.bind(history);history.pushState=((...i)=>{let o=r(...i);return e("pushState"),o}),history.replaceState=((...i)=>{let o=n(...i);return e("replaceState"),o}),window.addEventListener("popstate",()=>e("popstate")),window.addEventListener("hashchange",()=>e("hashchange")),document.addEventListener("click",i=>{let o=i.target,a=o&&o.closest?.("a[href]");!a||a.target&&a.target!=="_self"||new URL(a.href,location.href).origin!==location.origin||setTimeout(()=>e("click"),0)},!0),setInterval(()=>{this.getCurrentUrl()!==this.currentUrl&&e("poll")},1e3)});_(this,"getTransformations",async(e,r)=>{let n=new URLSearchParams({path:e}),i=await fetch(`${this.config.apiHost}/v1/visitor-copy-transformations/${r}?${n.toString()}`),o=await i.json();if(!i.ok)throw new Error(`Network error (status ${i.status}) with json body: ${JSON.stringify(o,null,2)}`);return Or(o)});_(this,"validateTransitionPreconditions",(e,r,n)=>{if(n.enabled){let i=document.createElement("div");i.innerHTML=r;let o=i.firstElementChild;if(!o||!ye(o))return this.log("warn",`Transformation "${e}" was skipped: A transition was requested, but the element is not animatable.`),!1}return!0});_(this,"applyTransformations",async(e,r)=>{this.log("debug",`Starting ${e.length} transformations`),r?.shouldConsolidate&&this.changeStack.forEach((n,i)=>{e.find(a=>a.identifier===i)&&this.undo(i)});for(let{identifier:n,...i}of e)try{if(this.changeStack.get(n))throw new Error("Transformation already exists in stack");let o=this.retrieveElement(i.selectorGuesses);switch(i.action){case"Replace":{let a=o.outerHTML,l=this.resolveTransitionConfig(i.transition);if(l.enabled&&ye(o)&&"animate"in o){let u=await this.orchestrator.replaceWithTransition(o,i.markup,l);this.setOrUpdateReplaceChangeRef(n,a,u)}else Se(o,i.markup,{}),this.setOrUpdateReplaceChangeRef(n,a,o);o.nodeName==="VIDEO"&&o.play();break}case"InsertBefore":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(n,i.markup,a))break;o.insertAdjacentHTML("beforebegin",i.markup);let l=o.previousElementSibling;if(l===null)throw new Error("Element wasn't created");if(l.setAttribute(re,n),a.enabled&&ye(l)){let u=l.style.cssText;l.style.opacity="0",this.orchestrator.enter(l,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{l.style.cssText=u},{once:!0})}this.changeStack.set(n,{undoOpts:{type:"Remove",ref:l}});break}case"InsertAfter":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(n,i.markup,a))break;o.insertAdjacentHTML("afterend",i.markup);let l=o.nextElementSibling;if(l===null)throw new Error("Element wasn't created");if(l.setAttribute(re,n),a.enabled&&ye(l)){let u=l.style.cssText;l.style.opacity="0",this.orchestrator.enter(l,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{l.style.cssText=u},{once:!0})}this.changeStack.set(n,{undoOpts:{type:"Remove",ref:l}});break}case"Delete":{let a=o.outerHTML;Se(o,'<div style="display: none;" data-kenobi-delete-marker="true"></div>',{}),o.setAttribute(re,n),this.changeStack.set(n,{undoOpts:{type:"Replace",ref:o,content:a}});break}case"SetFormField":{if(!this.isInputElement(o))throw new Error("Element targeted is not of a supported type");let a=o.value;this.setInputValue(o,i.markup),o.setAttribute(re,n),this.changeStack.set(n,{undoOpts:{type:"SetInput",ref:o,content:a}})}}}catch(o){this.log("warn",`Unable to apply transformation with identifier "${n}"`,o)}});_(this,"setOrUpdateReplaceChangeRef",(e,r,n)=>{let i=this.changeStack.get(e);if(!i){n.setAttribute(re,e),this.changeStack.set(e,{undoOpts:{type:"Replace",ref:n,content:r}});return}let o=i.undoOpts.ref;o&&o!==n&&o.isConnected&&o.removeAttribute(re),n.setAttribute(re,e),i.undoOpts.ref=n});_(this,"syncChangeStack",()=>{let e=0;for(let[r,n]of this.changeStack){let i=n.undoOpts.ref;if(!(!!i&&(i.isConnected||document.contains(i)))){this.changeStack.delete(r),e++;continue}i.getAttribute(re)!==r&&(this.changeStack.delete(r),e++)}this.log("debug",`syncChangeStack pruned ${this.formatThousands(e)} stale entries`)});_(this,"undo",e=>{let r=this.changeStack.get(e);if(r===void 0)throw new Error(`Cannot undo stack item with identifier ${e} as it does not exist.`);let{undoOpts:n}=r;switch(n.type){case"Remove":{n.ref.remove();break}case"Replace":{Se(n.ref,n.content),n.ref.removeAttribute(re);break}case"SetInput":{if(!this.isInputElement(n.ref))throw new Error("Element targeted is not of a supported type");this.setInputValue(n.ref,n.content),n.ref.removeAttribute(re);break}}this.changeStack.delete(e)});_(this,"undoAll",()=>{this.changeStack.forEach((e,r)=>this.undo(r))});_(this,"setInputValue",(e,r)=>{let n=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:e instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(n,"value");if(!i?.set)throw new Error("No value setter found");i.set.call(e,r),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))});_(this,"initCueCard",()=>{if(this.cueCardInstance){this.log("warn","CueCard already initialized, skipping...");return}this.cueCardInstance=new ve({theme:"light",position:"top-center",fields:[{name:"companyDomain",label:"Company Name or Domain",placeholder:"example.com",required:!0,minLength:3,errorMessage:"Company name or domain is required"}],isVisible:!0,enableFocusMode:!1,showWatermark:!1,showKeyboardHints:!0,enableLauncher:!0,onSubmitPersonalization:e=>{this.log("debug","CueCard submitted:",e),this.personalize(e)},onOpenChange:e=>{this.log("debug","CueCard open state changed:",e)}}),this.cueCardInstance.mount(),this.log("debug","CueCard mounted successfully")});_(this,"personalize",async e=>{if(!this.config.publicKey){this.log("error","Cannot personalize: publicKey not configured");return}let r=new Date;this.log("debug","Starting personalization with input:",e),this.cueCardInstance&&this.cueCardInstance.update({status:"starting",progressPct:10});try{let n=await fetch(`${this.config.apiHost}/v1/personalize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({publicKey:this.config.publicKey,input:e,pagePath:this.currentPath})});if(this.cueCardInstance&&this.cueCardInstance.update({progressPct:50}),!n.ok){let l=await n.json().catch(()=>({}));throw new Error(l.error||`API error: ${n.status}`)}let i=await n.json();this.log("debug","Personalization API response:",i),this.cueCardInstance&&this.cueCardInstance.update({progressPct:80}),i.transformations&&Array.isArray(i.transformations)&&await this.applyTransformations(i.transformations,{shouldConsolidate:!0}),this.cueCardInstance&&this.cueCardInstance.update({status:"success",progressPct:100});let o=new Date,a=this.getDurationInMilliseconds(r,o);this.log("debug",`Personalization complete, took ${this.formatThousands(a)} ms`)}catch(n){this.log("error","Personalization failed:",n),this.cueCardInstance&&this.cueCardInstance.update({status:"error",progressPct:0})}});_(this,"getCueCard",()=>this.cueCardInstance);this.config={apiHost:"https://kenobi.ai/api",debug:!1,autoTransform:!0,...e},this.transitionDefaults=Ar(this.config.transitionDefaults),this.orchestrator=new Ye,this.syncVisitorKey(),this.currentPath=this.getCurrentPath(),this.currentUrl=this.getCurrentUrl();try{this.initNavigationListener()}catch(r){this.log("error","Failed to initialize navigation listener with error:",r)}this.log("debug","Kenobi initialized"),this.config.autoTransform&&(this.log("debug","Auto-transform is requested... Starting..."),this.startAutoTransform()),this.config.publicKey&&(this.log("debug","Public key provided, auto-mounting CueCard..."),this.initCueCard())}};return Zt(zr);})();
|
|
101
|
+
`}mount(e){let r=e||this.config.mountNode||this.mountTarget||document.body;this.mountTarget=r,r.contains(this.host)||r.appendChild(this.host),this.applyHostStyles(),this.render()}unmount(){je(null,this.shadow.lastElementChild),this.host.remove()}update(e){e.status==="starting"&&this.config.status!=="starting"&&(this.isOpen=!1),this.config={...this.config,...e},this.applyHostStyles(),this.render()}setTheme(e){this.update({theme:e})}openForm(e){this.isOpen=!0,this.skipFocus=e??!1,this.render()}render(){let e=this.shadow.lastElementChild,r=this.skipFocus;this.skipFocus=!1,je(p(Lr,{config:this.config,isOpen:this.isOpen,skipFocus:r,setIsOpen:n=>{this.isOpen=n,this.config.onOpenChange?.(n),this.render()}}),e)}};var Ot="kfor",zt="kenobi_visitor_key",te="data-kenobi-transformation-identifier",fe={enabled:!1,durationMs:300,delayMs:0,easing:"ease",animateSize:!0,overflow:"hidden"},Rr=t=>({enabled:t?.enabled??fe.enabled,durationMs:t?.durationMs??fe.durationMs,delayMs:t?.delayMs??fe.delayMs,easing:t?.easing??fe.easing,animateSize:t?.animateSize??fe.animateSize,overflow:t?.overflow??fe.overflow,textAnimation:t?.textAnimation,enter:t?.enter,exit:t?.exit}),Dr=(t,e)=>({enabled:e?.enabled??t.enabled,durationMs:e?.durationMs??t.durationMs,delayMs:e?.delayMs??t.delayMs,easing:e?.easing??t.easing,animateSize:e?.animateSize??t.animateSize,overflow:e?.overflow??t.overflow,textAnimation:e?.textAnimation??t.textAnimation,enter:e?.enter??t.enter,exit:e?.exit??t.exit}),Kt=t=>typeof t=="string",ve=t=>t instanceof HTMLElement||typeof SVGElement<"u"&&t instanceof SVGElement,Nr=t=>typeof t=="string",Hr=t=>t==="hidden"||t==="visible"||t==="clip",Ir=t=>t==="line"||t==="word"||t==="character",Vt=t=>typeof t!="object"||t===null?!1:Array.isArray(t)?t.every(e=>typeof e=="object"&&e!==null):!0,Ut=t=>{if(typeof t!="object"||t===null)return!1;let e=t,{animationName:r,keyframes:n,durationMs:i,delayMs:o}=e;return(r===void 0||Kt(r))&&(n===void 0||Vt(n))&&(i===void 0||typeof i=="number")&&(o===void 0||typeof o=="number")},Fr=t=>{if(typeof t!="object"||t===null)return!1;let e=t,{by:r,staggerMs:n,animationName:i,keyframes:o,delayMs:a,durationMs:l}=e;return Ir(r)&&(a===void 0||typeof a=="number")&&(n===void 0||typeof n=="number")&&(l===void 0||typeof l=="number")&&(Kt(i)||o!==void 0)&&(o===void 0||Vt(o))},Or=t=>{if(typeof t!="object"||t===null)return!1;let e=t,{enabled:r,durationMs:n,delayMs:i,easing:o,animateSize:a,overflow:l,textAnimation:u,enter:c,exit:d}=e;return(r===void 0||typeof r=="boolean")&&(n===void 0||typeof n=="number")&&(i===void 0||typeof i=="number")&&(o===void 0||Nr(o))&&(a===void 0||typeof a=="boolean")&&(l===void 0||Hr(l))&&(u===void 0||Fr(u))&&(c===void 0||Ut(c))&&(d===void 0||Ut(d))},Ye=class{constructor(){g(this,"replaceWithTransition",async(e,r,n)=>{let i=document.createElement("div");i.style.position="relative",i.style.overflow=n.overflow;let o=e.getBoundingClientRect(),a=window.getComputedStyle(e);i.style.display=a.display,i.style.verticalAlign=a.verticalAlign,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`,i.style.margin=a.margin;let l=e.cloneNode(!0);if(!(l instanceof Element)||!ve(l))throw new Error("oldElClone is not an AnimatableElement");l.style.position="absolute",l.style.top="0",l.style.left="0",l.style.width="100%",l.style.height="100%",l.style.margin="0",l.style.pointerEvents="none",i.appendChild(l);let u=document.createElement("div");u.innerHTML=r;let c=u.firstElementChild;if(!c||!(c instanceof HTMLElement||c instanceof SVGElement))return await this.exit(e,n).finished,e;let d=c.style.cssText,s=e.parentNode,f;if(s instanceof HTMLElement){let b=s.cloneNode(!1),z=window.getComputedStyle(s),q=z.cssText?z.cssText:Array.from(z).reduce((K,V)=>`${K}${V}:${z.getPropertyValue(V)};`,"");b.style.cssText=q,b.style.position="absolute",b.style.top="-9999px",b.style.left="-9999px",b.style.visibility="hidden",b.style.pointerEvents="none",b.appendChild(c),document.body.appendChild(b),n.textAnimation&&this.applyTextAnimationToNode(c,n.textAnimation,n),f=c.getBoundingClientRect(),document.body.removeChild(b)}else{let b=document.createElement("div");b.style.position="absolute",b.style.top="-9999px",b.style.left="-9999px",b.style.visibility="hidden",b.appendChild(c),document.body.appendChild(b),n.textAnimation&&this.applyTextAnimationToNode(c,n.textAnimation,n),f=c.getBoundingClientRect(),document.body.removeChild(b)}c.style.cssText=d,c.style.visibility="",c.style.position="absolute",c.style.top="0",c.style.left="0",c.style.width=`${f.width}px`,c.style.height=`${f.height}px`,c.style.margin="0",c.style.opacity="0",i.appendChild(c),e.replaceWith(i);let m=n.exit?.delayMs??n.delayMs,S=n.exit?.durationMs??n.durationMs,A=n.enter?.delayMs??n.delayMs,w=n.enter?.durationMs??n.durationMs,h=[],k=this.resolveKeyframes(n.exit?.keyframes),P=l.animate(k,{duration:S,delay:m,easing:n.easing,fill:"forwards"});h.push(P);let O=this.resolveKeyframes(n.enter?.keyframes),R=c.animate(O,{duration:w,delay:A,easing:n.easing,fill:"forwards"});if(h.push(R),n.animateSize){let b=i.animate([{width:`${o.width}px`,height:`${o.height}px`},{width:`${f.width}px`,height:`${f.height}px`}],{duration:w,delay:A,easing:n.easing,fill:"forwards"});h.push(b)}return await Promise.all(h.map(b=>b.finished)),i.parentNode&&i.replaceWith(c),c.style.cssText=d,l.remove(),c});g(this,"enter",(e,r)=>{let n=r.enter?.delayMs??r.delayMs,i=r.enter?.durationMs??r.durationMs,o=this.resolveKeyframes(r.enter?.keyframes);return e.animate(o,{duration:i,delay:n,easing:r.easing,fill:"forwards"})});g(this,"exit",(e,r)=>{let n=r.exit?.delayMs??r.delayMs,i=r.exit?.durationMs??r.durationMs,o=this.resolveKeyframes(r.exit?.keyframes);return e.animate(o,{duration:i,delay:n,easing:r.easing,fill:"forwards"})});g(this,"resolveKeyframes",e=>e?Array.isArray(e)?e:[e]:[]);g(this,"applyTextAnimationToNode",(e,r,n)=>{let i=r.delayMs??0,o=window.getComputedStyle(e),a=o.getPropertyValue("background-clip")==="text"||o.getPropertyValue("-webkit-background-clip")==="text",l=(u,c,d)=>{if(u.nodeType===Node.TEXT_NODE){let s=u.textContent??"";if(s.trim().length===0)return c;if(r.by==="character"){let A=s.split(/(\s+)/),w=document.createDocumentFragment(),h=c;return A.forEach(k=>{if(k.length===0)return;if(k.trim().length===0){w.appendChild(document.createTextNode(k));return}let P=document.createElement("span");P.style.display="inline-block",P.style.whiteSpace="nowrap",d&&(P.style.setProperty("background","inherit"),P.style.setProperty("-webkit-background-clip","text"),P.style.setProperty("background-clip","text"),P.style.setProperty("color","transparent")),k.split("").forEach(R=>{let b=document.createElement("span");b.textContent=R,b.style.display="inline-block",b.style.opacity="0",d&&(b.style.setProperty("background","inherit"),b.style.setProperty("-webkit-background-clip","text"),b.style.setProperty("background-clip","text"),b.style.setProperty("color","transparent"),b.style.paddingBottom="0.1em",b.style.marginBottom="-0.1em");let z=this.resolveKeyframes(r.keyframes),q=r.durationMs??n.durationMs??300,K=n.easing??"ease",V=b.animate(z,{duration:q,easing:K,delay:h,fill:"forwards"});V.addEventListener("finish",()=>{V.commitStyles(),V.cancel()}),P.appendChild(b),h+=r.staggerMs??50}),w.appendChild(P)}),u.parentNode?.replaceChild(w,u),h}let f;switch(r.by){case"word":f=s.split(/(\s+)/);break;case"line":f=s.split(`
|
|
102
|
+
`);break;default:f=s.split("")}let m=document.createDocumentFragment(),S=c;return f.forEach(A=>{if(A.length===0)return;if(A.trim().length===0){m.appendChild(document.createTextNode(A));return}let h=document.createElement("span");h.textContent=A,h.style.display="inline-block",h.style.opacity="0",d&&(h.style.setProperty("background","inherit"),h.style.setProperty("-webkit-background-clip","text"),h.style.setProperty("background-clip","text"),h.style.setProperty("color","transparent"),h.style.setProperty("will-change","opacity, transform"));let k=this.resolveKeyframes(r.keyframes),P=r.durationMs??n.durationMs??300,O=n.easing??"ease",R=h.animate(k,{duration:P,easing:O,delay:S,fill:"forwards"});R.addEventListener("finish",()=>{R.commitStyles(),R.cancel()}),m.appendChild(h),S+=r.staggerMs??50}),u.parentNode?.replaceChild(m,u),S}if(u.nodeType===Node.ELEMENT_NODE){let s=c,f=Array.from(u.childNodes);for(let m of f)s=l(m,s,d);return s}return c};l(e,i,a)})}},$t=new Set(["Replace","InsertBefore","InsertAfter","Delete","SetFormField"]),Bt=t=>typeof t=="string",zr=t=>Array.isArray(t)&&t.every(e=>Bt(e)),Ur=t=>typeof t=="string"&&$t.has(t),Kr=t=>{if(typeof t!="object"||t===null)return!1;let e=t;return Bt(e.identifier)&&typeof e.markup=="string"&&zr(e.selectorGuesses)&&Ur(e.action)&&(e.transition===void 0||Or(e.transition))},Vr=t=>{if(typeof t!="object"||t===null)throw new Error("Invalid response: expected object with data array");let e=t.data;if(!Array.isArray(e))throw new Error("Invalid response: data must be an array");return e.forEach((r,n)=>{if(!Kr(r))throw new Error(`Invalid transformation at index ${n}`)}),e},Qe=class{constructor(e){g(this,"config");g(this,"changeStack",new Map);g(this,"visitorKey",null);g(this,"orchestrator");g(this,"cueCardInstance",null);g(this,"currentPath");g(this,"currentUrl");g(this,"navTicking",!1);g(this,"transitionDefaults");g(this,"startAutoTransform",async()=>{try{this.syncChangeStack(),await this.waitForLoaded(),this.isFramer()&&(await this.waitForFrames(),await this.waitForIdle(),await this.waitForQuietDom(100,1e3)),await this.transform()}catch(e){this.log("error","Auto-transformation flow failed with error:",e)}});g(this,"transform",async()=>{try{let e=new Date;if(this.log("debug","Starting transform"),this.visitorKey===null){this.log("debug",`Couldn't find a visitor copy external ID with query param key "${Ot}"`,"Exiting...");return}let r=[];try{r=await this.getTransformations(this.currentPath,this.visitorKey)}catch(o){this.log("error_detailed","An error occurred _getting_ transformations",o)}try{await this.applyTransformations(r)}catch(o){this.log("error_detailed","An error occurred _applying_ transformations",o)}let n=new Date,i=this.getDurationInMilliseconds(e,n);this.log("debug",`Transformation complete, took ${this.formatThousands(i)} ms`)}catch(e){this.log("error","An unexpected, top-level error occurred during transformation",e)}});g(this,"log",(e,r,...n)=>{let a=`${`[Kenobi \u25D4] (v${typeof window.__KENOBI_VERSION__<"u"?window.__KENOBI_VERSION__:"dev"})`} [${e.toLocaleUpperCase()}] :: ${r}`;switch(e){case"debug":this.config.debug&&console.log(a,...n);break;case"info":console.log(a,...n);break;case"warn":console.warn(a,...n);break;case"error_detailed":console.trace(...n);case"error":console.error(a,...n);break}});g(this,"resolveTransitionConfig",e=>Dr(this.transitionDefaults,e));g(this,"retrieveElement",e=>{if(!Array.isArray(e)||e.some(r=>typeof r!="string"))throw new Error(`Invalid selectorGuesses payload received: expected array of strings but got ${JSON.stringify(e)}`);for(let r of e){let n=document.querySelectorAll(r);if(n.length===0)continue;if(n.length===1)return n[0];let i=Array.from(n).filter(a=>{let l=a.getBoundingClientRect(),u=getComputedStyle(a);return u.display!=="none"&&u.visibility!=="hidden"&&l.width>0&&l.height>0});if(i.length===0)continue;let o=i.sort((a,l)=>a.getBoundingClientRect().top-l.getBoundingClientRect().top);return this.log("debug",`Selector "${r}" matched ${n.length} elements, selected topmost visible one at y=${o[0].getBoundingClientRect().top}`),o[0]}throw new Error(`Could not find an element in the document with any of these selector patterns: ${e.join(", ")}`)});g(this,"getQueryParam",e=>new URLSearchParams(window.location.search).get(e));g(this,"getCurrentPath",()=>window.location.pathname);g(this,"getCurrentUrl",()=>window.location.pathname+window.location.search+window.location.hash);g(this,"getDurationInMilliseconds",(e,r)=>+r-+e);g(this,"formatThousands",e=>new Intl.NumberFormat("en-US").format(e));g(this,"setDebug",e=>this.config.debug=e);g(this,"isInputElement",e=>!(!(e instanceof HTMLInputElement)&&!(e instanceof HTMLTextAreaElement)&&!(e instanceof HTMLSelectElement)));g(this,"waitForFrames",()=>new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))));g(this,"waitForIdle",(e=1e3)=>new Promise(r=>"requestIdleCallback"in window?window.requestIdleCallback(()=>r(),{timeout:e}):setTimeout(r,50)));g(this,"waitForLoaded",()=>document.readyState==="complete"?Promise.resolve():new Promise(e=>window.addEventListener("load",()=>e(),{once:!0})));g(this,"waitForQuietDom",(e,r)=>new Promise(n=>{let i=performance.now(),o=new MutationObserver(()=>{i=performance.now()});o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let a=performance.now()+e;(function l(){let u=performance.now();if(u-i>=r){o.disconnect(),n();return}if(u>=a){o.disconnect(),n();return}requestAnimationFrame(l)})()}));g(this,"isFramer",()=>{let e=Array.from(document.scripts).map(n=>n.src||"");return["__framer_events"in window,document.querySelector("[data-framer-root],[data-framer-component],[data-framer-page]"),e.some(n=>/framerusercontent\.com\/sites/i.test(n))].some(n=>!!n)});g(this,"syncVisitorKey",()=>{try{let e=this.getQueryParam(Ot);e?(this.log("debug",`Query param value found (${e}), pushing into session storage`),sessionStorage.setItem(zt,e),this.visitorKey=e):this.visitorKey=sessionStorage.getItem(zt)}catch(e){this.log("error","Failed to sync visitor key with error:",e)}});g(this,"initNavigationListener",()=>{if("__KENOBI_NAV_HOOKED__"in window)return;window.__KENOBI_NAV_HOOKED__=!0;let e=i=>{this.navTicking||(this.navTicking=!0,queueMicrotask(()=>{this.navTicking=!1;let o=this.getCurrentUrl();o!==this.currentUrl&&(this.currentUrl=o,this.currentPath=this.getCurrentPath(),this.log("debug",`URL changed (${i}) \u2192 ${location.href}`),this.config.autoTransform&&(this.undoAll(),this.startAutoTransform()))}))};if("navigation"in window){let i=window.navigation;i&&"addEventListener"in i&&typeof i.addEventListener=="function"&&(i.addEventListener("navigate",()=>e("navigation:navigate")),i.addEventListener("currententrychange",()=>e("navigation:entrychange")),i.addEventListener?.("navigatesuccess",()=>e("navigation:success")))}let r=history.pushState.bind(history),n=history.replaceState.bind(history);history.pushState=((...i)=>{let o=r(...i);return e("pushState"),o}),history.replaceState=((...i)=>{let o=n(...i);return e("replaceState"),o}),window.addEventListener("popstate",()=>e("popstate")),window.addEventListener("hashchange",()=>e("hashchange")),document.addEventListener("click",i=>{let o=i.target,a=o&&o.closest?.("a[href]");!a||a.target&&a.target!=="_self"||new URL(a.href,location.href).origin!==location.origin||setTimeout(()=>e("click"),0)},!0),setInterval(()=>{this.getCurrentUrl()!==this.currentUrl&&e("poll")},1e3)});g(this,"getTransformations",async(e,r)=>{let n=new URLSearchParams({path:e}),i=await fetch(`${this.config.apiHost}/v1/visitor-copy-transformations/${r}?${n.toString()}`),o=await i.json();if(!i.ok)throw new Error(`Network error (status ${i.status}) with json body: ${JSON.stringify(o,null,2)}`);return Vr(o)});g(this,"validateTransitionPreconditions",(e,r,n)=>{if(n.enabled){let i=document.createElement("div");i.innerHTML=r;let o=i.firstElementChild;if(!o||!ve(o))return this.log("warn",`Transformation "${e}" was skipped: A transition was requested, but the element is not animatable.`),!1}return!0});g(this,"applyTransformations",async(e,r)=>{this.log("debug",`Starting ${e.length} transformations`),r?.shouldConsolidate&&this.changeStack.forEach((n,i)=>{e.find(a=>a.identifier===i)&&this.undo(i)});for(let{identifier:n,...i}of e)try{if(this.changeStack.get(n))throw new Error("Transformation already exists in stack");let o=this.retrieveElement(i.selectorGuesses);switch(i.action){case"Replace":{let a=o.outerHTML,l=this.resolveTransitionConfig(i.transition);if(l.enabled&&ve(o)&&"animate"in o){let u=await this.orchestrator.replaceWithTransition(o,i.markup,l);this.setOrUpdateReplaceChangeRef(n,a,u)}else Ee(o,i.markup,{}),this.setOrUpdateReplaceChangeRef(n,a,o);o.nodeName==="VIDEO"&&o.play();break}case"InsertBefore":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(n,i.markup,a))break;o.insertAdjacentHTML("beforebegin",i.markup);let l=o.previousElementSibling;if(l===null)throw new Error("Element wasn't created");if(l.setAttribute(te,n),a.enabled&&ve(l)){let u=l.style.cssText;l.style.opacity="0",this.orchestrator.enter(l,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{l.style.cssText=u},{once:!0})}this.changeStack.set(n,{undoOpts:{type:"Remove",ref:l}});break}case"InsertAfter":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(n,i.markup,a))break;o.insertAdjacentHTML("afterend",i.markup);let l=o.nextElementSibling;if(l===null)throw new Error("Element wasn't created");if(l.setAttribute(te,n),a.enabled&&ve(l)){let u=l.style.cssText;l.style.opacity="0",this.orchestrator.enter(l,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{l.style.cssText=u},{once:!0})}this.changeStack.set(n,{undoOpts:{type:"Remove",ref:l}});break}case"Delete":{let a=o.outerHTML;Ee(o,'<div style="display: none;" data-kenobi-delete-marker="true"></div>',{}),o.setAttribute(te,n),this.changeStack.set(n,{undoOpts:{type:"Replace",ref:o,content:a}});break}case"SetFormField":{if(!this.isInputElement(o))throw new Error("Element targeted is not of a supported type");let a=o.value;this.setInputValue(o,i.markup),o.setAttribute(te,n),this.changeStack.set(n,{undoOpts:{type:"SetInput",ref:o,content:a}})}}}catch(o){this.log("warn",`Unable to apply transformation with identifier "${n}"`,o)}});g(this,"setOrUpdateReplaceChangeRef",(e,r,n)=>{let i=this.changeStack.get(e);if(!i){n.setAttribute(te,e),this.changeStack.set(e,{undoOpts:{type:"Replace",ref:n,content:r}});return}let o=i.undoOpts.ref;o&&o!==n&&o.isConnected&&o.removeAttribute(te),n.setAttribute(te,e),i.undoOpts.ref=n});g(this,"syncChangeStack",()=>{let e=0;for(let[r,n]of this.changeStack){let i=n.undoOpts.ref;if(!(!!i&&(i.isConnected||document.contains(i)))){this.changeStack.delete(r),e++;continue}i.getAttribute(te)!==r&&(this.changeStack.delete(r),e++)}this.log("debug",`syncChangeStack pruned ${this.formatThousands(e)} stale entries`)});g(this,"undo",e=>{let r=this.changeStack.get(e);if(r===void 0)throw new Error(`Cannot undo stack item with identifier ${e} as it does not exist.`);let{undoOpts:n}=r;switch(n.type){case"Remove":{n.ref.remove();break}case"Replace":{Ee(n.ref,n.content),n.ref.removeAttribute(te);break}case"SetInput":{if(!this.isInputElement(n.ref))throw new Error("Element targeted is not of a supported type");this.setInputValue(n.ref,n.content),n.ref.removeAttribute(te);break}}this.changeStack.delete(e)});g(this,"undoAll",()=>{this.changeStack.forEach((e,r)=>this.undo(r))});g(this,"setInputValue",(e,r)=>{let n=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:e instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(n,"value");if(!i?.set)throw new Error("No value setter found");i.set.call(e,r),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))});g(this,"initCueCard",()=>{if(this.cueCardInstance){this.log("warn","CueCard already initialized, skipping...");return}this.cueCardInstance=new ye({theme:"light",position:"top-center",fields:[{name:"companyDomain",label:"Company Name or Domain",placeholder:"example.com",required:!0,minLength:3,errorMessage:"Company name or domain is required"}],isVisible:!0,enableFocusMode:!1,showWatermark:!1,showKeyboardHints:!0,enableLauncher:!0,onDismiss:()=>{this.log("debug","CueCard dismissed by user")},onSubmitPersonalization:e=>{this.log("debug","CueCard submitted:",e),this.personalize(e)},onOpenChange:e=>{this.log("debug","CueCard open state changed:",e)}}),this.cueCardInstance.mount(),this.log("debug","CueCard mounted successfully")});g(this,"personalize",async e=>{if(!this.config.publicKey){this.log("error","Cannot personalize: publicKey not configured");return}let r=new Date;this.log("debug","Starting personalization with input:",e),this.cueCardInstance&&this.cueCardInstance.update({status:"starting",progressPct:10});try{let n=await fetch(`${this.config.apiHost}/v1/personalize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({publicKey:this.config.publicKey,input:e,pagePath:this.currentPath})});if(this.cueCardInstance&&this.cueCardInstance.update({progressPct:50}),!n.ok){let l=await n.json().catch(()=>({}));throw new Error(l.error||`API error: ${n.status}`)}let i=await n.json();this.log("debug","Personalization API response:",i),this.cueCardInstance&&this.cueCardInstance.update({progressPct:80}),i.transformations&&Array.isArray(i.transformations)&&await this.applyTransformations(i.transformations,{shouldConsolidate:!0}),this.cueCardInstance&&this.cueCardInstance.update({status:"success",progressPct:100});let o=new Date,a=this.getDurationInMilliseconds(r,o);this.log("debug",`Personalization complete, took ${this.formatThousands(a)} ms`)}catch(n){this.log("error","Personalization failed:",n),this.cueCardInstance&&this.cueCardInstance.update({status:"error",progressPct:0})}});g(this,"getCueCard",()=>this.cueCardInstance);this.config={apiHost:"https://kenobi.ai/api",debug:!1,autoTransform:!0,...e},this.transitionDefaults=Rr(this.config.transitionDefaults),this.orchestrator=new Ye,this.syncVisitorKey(),this.currentPath=this.getCurrentPath(),this.currentUrl=this.getCurrentUrl();try{this.initNavigationListener()}catch(r){this.log("error","Failed to initialize navigation listener with error:",r)}this.log("debug","Kenobi initialized"),this.config.autoTransform&&(this.log("debug","Auto-transform is requested... Starting..."),this.startAutoTransform()),this.config.publicKey&&(this.log("debug","Public key provided, auto-mounting CueCard..."),this.initCueCard())}};return nr($r);})();
|