obi-sdk 0.19.37-beta.0 → 0.19.37

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/dist/index.js CHANGED
@@ -53,4 +53,4 @@ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
53
53
  }
54
54
  `}),m("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[m("section",{style:n.headerSection,children:[m("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:m("div",{style:n.shimmer})}),m("div",{style:n.textLines,children:[m("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:m("div",{style:n.shimmer})}),m("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:m("div",{style:n.shimmer})})]})]}),m("section",{style:n.contentSection,children:m("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:m("div",{style:n.shimmer})})})]})]})}function Ww({}){const n={host:{display:"block",height:"161px"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Inter', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return m("div",{style:n.host,children:m("div",{style:n.shareContainer,children:[m("div",{style:n.controlsRow,children:[m("div",{style:n.monitorIconContainer,children:m("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[m("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),m("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),m("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),m("div",{style:n.tabSelector,children:[m("button",{style:n.tabButton(!1),children:"Tab"}),m("button",{style:n.tabButton(!0),children:"Window"})]})]}),m("div",{style:n.skeletonContainer,children:m(Hw,{})})]})})}function qw({session:n,speakingState:e,onAction:t}){return m(wi,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:n.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${n.agentName||"Obi"} will guide you through ${n.appName||"the app"} by watching your screen.`,centerVisual:m(Ww,{}),actionDisabled:!0,onAction:t})}function Kw({session:n,speakingState:e,spectrum:t,onAction:i}){return m(wi,{title:"Overview",subtitle:`${n.agentName||"Obi"} will start your tutorial in a moment`,agentName:n.agentName||"Obi",speakingState:e,description:`Get ready to explore ${n.appName||"the app"} with ${n.agentName||"Obi"}.`,centerVisual:m(tm,{spectrum:t}),actionDisabled:!0,onAction:i})}function $w({id:n,name:e,description:t,duration:i=10,order:r=0,selected:s=!1,completed:a=!1,onClick:o}){return m("div",{className:`course-container ${s?"selected":""}`,onClick:()=>{o==null||o({id:n,name:e,description:t,duration:i,order:r})},children:[m("div",{className:"header-row",children:[m("h2",{className:"course-title",children:e}),a&&m("span",{className:"duration",children:"Completed"})]}),t&&m("p",{className:"course-description",children:t})]})}function Yw({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[s,a]=J(""),o=u=>{const d=u.currentTarget;a(d.value)},c=u=>{r==null||r(u)};if(t)return m("div",{className:"loading",children:"Loading..."});if(i)return m("div",{className:"error",children:i});if(!n||n.length===0)return m("div",{className:"empty",children:"No courses available"});const l=n.filter(u=>u.name.toLowerCase().includes(s.toLowerCase())||(u.description||"").toLowerCase().includes(s.toLowerCase()));return m("div",{className:"tour-select",children:[m("div",{className:"controls",children:[m("div",{className:"tabs",children:m("button",{className:"tab active",children:"All"})}),m("div",{className:"filter",children:[m("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),m("input",{type:"text",placeholder:"Search...",value:s,onInput:o})]})]}),m("div",{className:"course-grid",children:l.sort((u,d)=>(u.order||0)-(d.order||0)).map(u=>{const d=u.id===e;return m($w,{id:u.id,name:u.name,description:u.description||"",duration:u.duration,order:u.order||0,completed:u.completed,selected:d,onClick:c},u.id)})})]})}function Xw({open:n,courses:e=[],loading:t=!1,error:i="",title:r="AI Coach",productName:s,onClose:a,onCourseSelect:o,onCourseHighlight:c}){const[l,u]=J(null),d=f=>{u(f),c==null||c(f)},h=()=>{l&&o&&o(l)};return m(Cp,{open:n,onClose:a,size:"large",preventOutsideClick:!0,children:m("div",{className:"tour-select-modal-container",children:[m("div",{className:"header",children:[m("div",{className:"icon",style:{color:"white"},children:m(Fp,{})}),m("div",{className:"title-section",children:t?m(Xe,{children:[m("div",{className:"skeleton skeleton-title"}),m("div",{className:"skeleton skeleton-subtitle"})]}):m(Xe,{children:[m("h1",{children:r}),m("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",s," through an interactive conversation."]})]})})]}),m("div",{className:"course-list-wrapper",children:m(Yw,{courses:e,selectedCourseId:(l==null?void 0:l.id)||"",loading:t,error:i,onCourseSelect:d})}),m("div",{className:"footer",children:[m("button",{className:"obi-button footer-button",onClick:h,disabled:!l,children:[m("span",{children:"Get started"}),m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:m("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:l?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),m("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function Jw({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:s,onShareMicrophone:a,onShareScreen:o,onModalChange:c}){const[l,u]=J(null);function d(f){l!==f&&(c==null||c(f),u(f))}function h(){e==="connecting"||e==="connected"||!e?r==null||r():e==="volume-check"||e==="mic-check"?s==null||s():e==="mic-share"?a==null||a():e==="screen-share"&&(o==null||o())}return ea(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),m(jw,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),m(zw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-check":return d("overview"),m(Kw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),m(Gw,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),m(qw,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),m(gw,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,s,a,o])}function Qw(n){const{session:e,sessionState:t,speakingState:i,spectrum:r,onClose:s,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:u}=n,[d,h]=J(null);function f(v){u==null||u(v),h(v)}function g(v){s(v,d),h(null)}const p=(n.open??!0)&&(!t||t==="connecting"||t==="connected"||t==="volume-check"||t==="mic-check"||t==="mic-share"||t==="screen-share"||t==="navigate");return m(dw,{open:p,onClose:g,preventOutsideClick:!0,children:()=>m(Jw,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:f})})}const Zw={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};function In(){return Zw}const ex=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nm="9.23.0",xi=globalThis;function tx(n,e,t=xi){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[nm]=i[nm]||{};return r[n]||(r[n]=e())}const nx="Sentry Logger ",im=["debug","info","warn","error","log","assert","trace"],rm={};function ix(n){if(!("console"in xi))return n();const e=xi.console,t={},i=Object.keys(rm);i.forEach(r=>{const s=rm[r];t[r]=e[r],e[r]=s});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function rx(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return ex?im.forEach(t=>{e[t]=(...i)=>{n&&ix(()=>{xi.console[t](`${nx}[${t}]:`,...i)})}}):im.forEach(t=>{e[t]=()=>{}}),e}tx("logger",rx);const sm=1e3;function sx(){return Date.now()/sm}function ax(){const{performance:n}=xi;if(!(n!=null&&n.now))return sx;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/sm}ax();const am=50,_i="?",om=/\(error: (.*)\)/,cm=/captureMessage|captureException/;function ox(...n){const e=n.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const s=[],a=t.split(`
55
55
  `);for(let o=i;o<a.length;o++){const c=a[o];if(c.length>1024)continue;const l=om.test(c)?c.replace(om,"$1"):c;if(!l.match(/\S*Error: /)){for(const u of e){const d=u(l);if(d){s.push(d);break}}if(s.length>=am+r)break}}return cx(s.slice(r))}}function cx(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(oa(e).function||"")&&e.pop(),e.reverse(),cm.test(oa(e).function||"")&&(e.pop(),cm.test(oa(e).function||"")&&e.pop()),e.slice(0,am).map(t=>({...t,filename:t.filename||oa(e).filename,function:t.function||_i}))}function oa(n){return n[n.length-1]||{}}var lm;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(lm||(lm={})),xi._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const lx=30,ux=50;function Vc(n,e,t,i){const r={filename:n,function:e==="<anonymous>"?_i:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const dx=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fx=/\((\S*)(?::(\d+))(?::(\d+))\)/,px=n=>{const e=dx.exec(n);if(e){const[,i,r,s]=e;return Vc(i,_i,+r,+s)}const t=hx.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=fx.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=um(t[1]||_i,t[2]);return Vc(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},mx=[lx,px],gx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,vx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;ox(...[mx,[ux,n=>{const e=gx.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=vx.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let t=e[3],i=e[1]||_i;return[i,t]=um(i,t),Vc(t,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const um=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,i=n.indexOf("safari-web-extension")!==-1;return t||i?[n.indexOf("@")!==-1?n.split("@")[0]:_i,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const dm="obi-engagement:";function bx(n){let e=5381;for(let t=0;t<n.length;t++)e=e*33^n.charCodeAt(t);return(e>>>0).toString(16)}function hm(n,e){if(!n||!e)return null;const t=e;let r=(t==null?void 0:t.uuid)||e.email||null;if(!r)try{r=bx(JSON.stringify(e))}catch{return null}return`${n}:${r}`}function Gc(n){try{const e=localStorage.getItem(dm+n);if(!e)return null;const t=JSON.parse(e);return{lastActivityAt:typeof t.lastActivityAt=="number"?t.lastActivityAt:0,lastSessionStartAt:typeof t.lastSessionStartAt=="number"?t.lastSessionStartAt:void 0,sessionCount:typeof t.sessionCount=="number"?t.sessionCount:0}}catch{return null}}function zc(n,e){const t={lastActivityAt:e.lastActivityAt||0,lastSessionStartAt:e.lastSessionStartAt,sessionCount:e.sessionCount||0};localStorage.setItem(dm+n,JSON.stringify(t))}function yx(n,e,t=30*60*1e3){return!e||e<=0?!0:n-e>=t}function fm(n,e){return{...e,lastActivityAt:n}}function Tx(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function kx(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=Tx(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function hr(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return kx(e,n)}function Sx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function Cx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var pm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ca=0;ca<pm.length;ca++)fr[pm.charCodeAt(ca)]=ca;for(var wx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=fr[n.charCodeAt(i)],a=fr[n.charCodeAt(i+1)],o=fr[n.charCodeAt(i+2)],c=fr[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},xx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},_x=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},qn=5,Hc=6+5,Wc=2,Ex=Hc-qn,mm=65536>>qn,Rx=1<<qn,qc=Rx-1,Px=1024>>qn,Ix=mm+Px,Ax=Ix,Ox=32,Nx=Ax+Ox,Mx=65536>>Hc,Lx=1<<Ex,Dx=Lx-1,gm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Ux=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Bx=function(n,e){var t=wx(n),i=Array.isArray(t)?_x(t):new Uint32Array(t),r=Array.isArray(t)?xx(t):new Uint16Array(t),s=24,a=gm(r,s/2,i[4]/2),o=i[5]===2?gm(r,(s+i[4])/2):Ux(i,Math.ceil((s+i[4])/4));return new Fx(i[0],i[1],i[2],i[3],a,o)},Fx=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>qn],t=(t<<Wc)+(e&qc),this.data[t];if(e<=65535)return t=this.index[mm+(e-55296>>qn)],t=(t<<Wc)+(e&qc),this.data[t];if(e<this.highStart)return t=Nx-Mx+(e>>Hc),t=this.index[t],t+=e>>qn&Dx,t=this.index[t],t=(t<<Wc)+(e&qc),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jx=typeof Uint8Array>"u"?[]:new Uint8Array(256),la=0;la<vm.length;la++)jx[vm.charCodeAt(la)]=la;var bm=null;function Vx(n){return Sx(this,void 0,void 0,function(){var e;return Cx(this,function(t){switch(t.label){case 0:return bm!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw new Error("Invalid graphemes response");bm=Bx(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}for(var ym="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gx=typeof Uint8Array>"u"?[]:new Uint8Array(256),ua=0;ua<ym.length;ua++)Gx[ym.charCodeAt(ua)]=ua;function zx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function Hx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var Tm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pr=typeof Uint8Array>"u"?[]:new Uint8Array(256),da=0;da<Tm.length;da++)pr[Tm.charCodeAt(da)]=da;for(var Wx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=pr[n.charCodeAt(i)],a=pr[n.charCodeAt(i+1)],o=pr[n.charCodeAt(i+2)],c=pr[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},qx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Kx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},Kn=5,Kc=6+5,$c=2,$x=Kc-Kn,km=65536>>Kn,Yx=1<<Kn,Yc=Yx-1,Xx=1024>>Kn,Jx=km+Xx,Qx=Jx,Zx=32,e_=Qx+Zx,t_=65536>>Kc,n_=1<<$x,i_=n_-1,Sm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},r_=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},s_=function(n,e){var t=Wx(n),i=Array.isArray(t)?Kx(t):new Uint32Array(t),r=Array.isArray(t)?qx(t):new Uint16Array(t),s=24,a=Sm(r,s/2,i[4]/2),o=i[5]===2?Sm(r,(s+i[4])/2):r_(i,Math.ceil((s+i[4])/4));return new a_(i[0],i[1],i[2],i[3],a,o)},a_=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Kn],t=(t<<$c)+(e&Yc),this.data[t];if(e<=65535)return t=this.index[km+(e-55296>>Kn)],t=(t<<$c)+(e&Yc),this.data[t];if(e<this.highStart)return t=e_-t_+(e>>Kc),t=this.index[t],t+=e>>Kn&i_,t=this.index[t],t=(t<<$c)+(e&Yc),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),Cm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o_=typeof Uint8Array>"u"?[]:new Uint8Array(256),ha=0;ha<Cm.length;ha++)o_[Cm.charCodeAt(ha)]=ha;var wm=null;function c_(n){return zx(this,void 0,void 0,function(){var e;return Hx(this,function(t){switch(t.label){case 0:return wm!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw console.error("invalid graphemes response",e),new Error("Invalid graphemes response");wm=s_(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}const l_=`:root,:host{--obi-modal-padding: 32px 48px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 24px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 372px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:block;flex-grow:1;flex-direction:column;align-items:center;padding:0;width:100%;margin-bottom:16px}.tour-content .title{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:700;font-size:24px;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0 0 12px}.tour-content .subtitle{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{flex-grow:0;flex-shrink:0;display:flex;align-items:center;justify-content:center;position:relative;margin-bottom:24px}.tour-content .visual.glow{width:390px;border-radius:15px;background-color:var(--obi-color-tint)}.tour-content .description{height:45px;width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;color:#757575!important;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.tour-content .button-container{flex-grow:0;display:flex;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Inter,sans-serif;font-style:normal;font-weight:500;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{height:100%;flex:1;display:flex;flex-direction:column}.tour-footer{width:100%!important;text-align:center;display:flex;align-items:flex-end;justify-content:center;font-family:Inter,sans-serif;font-size:8px;font-weight:200;margin-top:20px}.session-start-content .description{height:48px}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);transform:translateY(0);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill2.container:not(.active) .pill .text{opacity:0;animation:none}.obi-pill-up.container{display:flex;align-items:flex-end;justify-content:center}.obi-pill-up.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container .pill.button{cursor:pointer}.obi-pill-up.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill-up.container:not(.active) .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container.active{transition:none;height:30px}.obi-pill-up.container.active .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill-up.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill-up.container:not(.active) .pill .text{opacity:0;animation:none}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-message{display:inline-flex;align-items:center;justify-content:center;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:14px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:6px 0;height:100%;flex:1;min-width:0;cursor:pointer}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0;cursor:pointer}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-course-progress .obi-widget-popout,.obi-course-progress .obi-widget-popout .content{z-index:800}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-widget-course-progress{display:block;width:100%;max-width:220px;max-height:40px;opacity:1;transform:translateY(0);overflow:visible;position:relative;z-index:800;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel .obi-widget-course-progress.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:0}.obi-widget-out-of-plan .text{font-size:16px;color:#fff;display:inline-flex;align-items:center;gap:8px;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active{gap:0}.obi-widget-out-of-plan.active:hover,.obi-widget-out-of-plan.active.hover{gap:4px}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.obi-static-voice{height:96px;display:flex;flex-direction:column;align-items:center;justify-content:center}.obi-static-voice-visual-title{font-family:Inter,sans-serif;font-style:normal;font-weight:600;font-size:14px;color:var(--obi-color-primary);background-color:var(--obi-color-tint);padding:8px 12px;border-radius:20px;margin-bottom:24px}.obi-static-voice-visual{display:flex;align-items:center;gap:2px;height:32px}.obi-static-voice-visual .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-static-voice-visual .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;background-color:#fff;border-radius:2px;z-index:1}.obi-static-voice-visual .bar-1{height:2px}.obi-static-voice-visual .bar-2{height:6px}.obi-static-voice-visual .bar-3{height:10px}.obi-static-voice-visual .bar-4,.obi-static-voice-visual .bar-5{height:16px}.obi-static-voice-visual .bar-6{height:10px}.obi-static-voice-visual .bar-7{height:6px}.obi-static-voice-visual .bar-8{height:2px}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
56
- `;function u_(n){var $,q,pe,be,ye,Be,Q,Ce,se,Le,K;const[e,t]=J(!1),[i,r]=J(!1),[s,a]=J(!1),[o,c]=J(null),[l,u]=J(!1),[d,h]=J(null),[f,g]=J(null),p=d_(n.sdk,v,n.shadowHost,g,a,D=>{if(!D){c(null);return}if(N&&(c(D),!E&&x==="minimized")){u(!0);const W=Math.max(0,D.autoCloseMs??3e3);d&&window.clearTimeout(d);const ae=window.setTimeout(()=>u(!1),W);h(ae)}});function v(D){var W;(W=p.client)!=null&&W.session||(D?Y():t(!1))}if(!p.client)return null;const b=p.client.planIsCompleted.filter(Boolean).length===p.client.plans.length,w=h_(($=p.client.product)==null?void 0:$.widget_url_blacklist),x=b?p.completedWidgetDisplay||((q=p.client.product)==null?void 0:q.completed_widget_display):p.widgetDisplay||((pe=p.client.product)==null?void 0:pe.widget_display),k=p.widgetPosition||((be=p.client.product)==null?void 0:be.widget_position);let C=p.isActive;((Be=(ye=p.client)==null?void 0:ye.product)==null?void 0:Be.name)==="Canibuild"&&(C=!0);const S=p.client.session,E=!!S,A=E&&!e;let I;switch(S==null?void 0:S.speakingState){case"listening":I="user-speaking";break;case"speaking":I="agent-speaking";break;case"thinking":I="thinking";break;case"busy":I="busy";break}const B=S==null?void 0:S.isPaused,N=E||p.client.state==="ready"&&C&&!w&&(x!=="invisible"||p.client.selectedPlan),z=()=>{var D,W,ae,me,zt,$n,Z;return{name:(D=p.client.selectedPlan)==null?void 0:D.name,description:(W=p.client.selectedPlan)==null?void 0:W.description,appName:(ae=p.client.product)==null?void 0:ae.name,appLogoUrl:((me=p.client.product)==null?void 0:me.logo_url)||"",url:(zt=p.client.product)==null?void 0:zt.url,agentName:(($n=p.client.product)==null?void 0:$n.agent_name)||"Obi",legalFooter:((Z=p.client.product)==null?void 0:Z.legal_footer_text)||void 0}},H=k==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};A?H.top="calc(100vh - 100px)":H.bottom="20px";const Y=()=>{const D=p.client;if(!D)return;const W=D.plans||[];if(W.length===1){const[ae]=W;D.selectedPlanUuid!==ae.uuid&&(D.selectPlan(ae),In().track("course-get-started",{courseName:ae.name,courseUuid:ae.uuid})),t(!1),r(!0);return}t(!0)};return m("div",{children:[e&&m(Xw,{open:e,courses:p.client.plans.map((D,W)=>{var ae,me;return{id:D.uuid,name:D.name,description:D.description||"",duration:D.duration||0,completed:((me=(ae=p.client)==null?void 0:ae.planIsCompleted)==null?void 0:me[W])||!1}}),loading:!1,title:((Q=p.client.product)==null?void 0:Q.assistant_subtitle)||void 0,productName:((Ce=p.client.product)==null?void 0:Ce.name)||"",onCourseHighlight:D=>{D&&In().track("course-selected",{courseName:D.name,courseUuid:D.id})},onCourseSelect:D=>{const W=p.client.plans.find(ae=>ae.uuid===D.id)||null;W&&(W==null?void 0:W.uuid)!==p.client.selectedPlanUuid&&(p.client.selectPlan(W),t(!1),r(!0),In().track("course-get-started",{courseName:D.name,courseUuid:D.id}))},onClose:D=>{D==="user-initiated"&&p.client.selectPlan(null),t(!1)}}),N&&m(Xe,{children:[m("div",{style:H,children:m(cw,{inPlan:E,isActive:i?!1:l?!0:void 0,defaultIsActive:x!=="minimized",isPaused:B,toastMessage:o,messaging:(S==null?void 0:S.isMicShared)===!1||s?!0:void 0,speakingStatus:I,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,courseProgress:f,onOpen:Y,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var D;(D=p.client.session)==null||D.stop()},onCancelReason:(D,W)=>{},onPause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.pause)==null||W.call(D)},onUnpause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.unpause)==null||W.call(D)},onMessagingChange:D=>{var W,ae,me,zt;a(!1),D?(ae=(W=p.client.session)==null?void 0:W.muteMicrophone)==null||ae.call(W):(zt=(me=p.client.session)==null?void 0:me.unmuteMicrophone)==null||zt.call(me)},onMessageChange:D=>{In().track("chat-input-provided",{message:D,length:D.length})},onMessage:D=>{p.say(D),a(!1),In().track("chat-message-sent",{message:D,length:D.length})},onHover:D=>{},onOneClickAction:D=>{a(!1)},onMinimize:()=>{},agentName:((se=p.client.product)==null?void 0:se.agent_name)||"Obi",completedTutorials:((Le=p.client.product)==null?void 0:Le.widget_show_progress)===!1?void 0:p.client.planIsCompleted.filter(Boolean).length,totalTutorials:((K=p.client.product)==null?void 0:K.widget_show_progress)===!1?void 0:p.client.plans.length})}),!!p.client.selectedPlan&&m(Qw,{open:!0,session:z(),sessionState:(S==null?void 0:S.state)||null,speakingState:(S==null?void 0:S.speakingState)||null,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,onModalChange:D=>{},onClose:(D,W)=>{var ae,me;D==="user-initiated"&&(((ae=p.client.session)==null?void 0:ae.state)==="mic-share"?(me=p.client.session)==null||me.shareMicrophoneFailed():p.client.stopSession()),r(!1)},onStart:()=>{p.client.selectedPlanUuid&&p.startSession()},onContinue:()=>{S==null||S.continue()},onShareMicrophone:()=>{S==null||S.shareMicrophone()}})]})]})}function d_(n,e,t,i,r,s){const[a,o]=J(0),[c,l]=J(null);return Ze(()=>{n.on("showMenu",u=>{e(u)}),n.on("configUpdated",()=>{o(u=>u+1)}),n.on("showMessage",u=>{s==null||s(u)})},[n]),Ze(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",u=>{l(u),r==null||r(!1),o(d=>d+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(u=>u+1)}),n.client.on("sessionShutdown",()=>{o(u=>u+1)}),n.client.on("sessionResumed",()=>{o(u=>u+1)}),n.client.on("stateChanged",()=>{var u;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((u=n.client.product)==null?void 0:u.primary_color)||"#9500FF"),o(d=>d+1)}),n.client.on("planSelected",()=>{o(u=>u+1)}))},[n,n.client]),Ze(()=>{if(!c)return;c.on("stateChanged",()=>{o(d=>d+1)}),c.on("speakingStateChanged",()=>{o(d=>d+1)}),c.on("paused",()=>{o(d=>d+1)}),c.on("unpaused",()=>{o(d=>d+1)}),c.on("micCheckComplete",d=>{}),c.on("transcript",(d,h)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(d=>d+1)});const u=d=>{i(d)};return c.on&&c.on("courseProgress",u),()=>{c.off&&c.off("courseProgress",u),c.off&&c.off("textInputRequested")}},[c]),n}function h_(n){const[e,t]=J(()=>hr(n));return Ze(()=>{t(hr(n))},[n]),Ze(()=>{f_();const i=()=>{t(hr(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function f_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function p_(n){if(document.querySelector("obi-widget"))return;m_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(l_),t.adoptedStyleSheets=[r],x1(m(u_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function m_(){xm("https://fonts.cdnfonts.com/css/satoshi"),xm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function xm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const _m="49206C6F7665204F6269_session",Em="obi-url-params";class g_ extends ba{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this._engagementScopeKey=null,this._engagementInitialised=!1,this._engagementPromptedAtSessionCount=null,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams(),this.on("engagementSessionStarted",t=>{try{this._maybePromptEngagement(t.sessionCount)}catch{}})}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=Ks.deserialise(i,e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r)}t||(t=new Ks(e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,g;r==="ready"&&(this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((g=(f=this.client)==null?void 0:f.product)==null?void 0:g.completed_widget_display)||"regular"}),this._maybeInitEngagement())}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})})}_maybeInitEngagement(){if(this._engagementInitialised||!this.client)return;const e=this.client.product,t=this.client.identity;if(!e||!t)return;if(hr(e.widget_url_blacklist||[])){this._engagementScopeKey=hm(e.uuid,t),this._engagementInitialised=!0;return}const r=hm(e.uuid,t);if(!r)return;this._engagementScopeKey=r,this._engagementInitialised=!0;const s=Date.now(),a=Gc(r),o=(a==null?void 0:a.lastActivityAt)||0,c=yx(s,o);let l=(a==null?void 0:a.sessionCount)||0,u=a==null?void 0:a.lastSessionStartAt;if(c){l=((a==null?void 0:a.sessionCount)||0)+1,u=s,zc(r,{lastActivityAt:s,lastSessionStartAt:u,sessionCount:l}),this.emit("engagementSessionStarted",{sessionCount:l,lastSessionStartAt:u,lastActivityAt:s,scopeKey:r});try{In().track("engagement-session-started",{sessionCount:l,productUuid:e.uuid,onboardeeId:(t==null?void 0:t.uuid)||t.email||"unknown"})}catch{}}else u&&new Date(u).toISOString(),o&&new Date(o).toISOString(),new Date(s).toISOString(),s-o;const d=fm(s,{lastActivityAt:(a==null?void 0:a.lastActivityAt)||0,lastSessionStartAt:u,sessionCount:l});zc(r,d),this._attachEngagementLifecycle()}_attachEngagementLifecycle(){if(!this.client)return;const e=this.client.product;if(!e)return;const t=()=>{if(!this._engagementScopeKey||hr(e.widget_url_blacklist||[]))return;const r=Date.now(),s=Gc(this._engagementScopeKey)||{lastActivityAt:0,sessionCount:0},a=fm(r,s);zc(this._engagementScopeKey,a)};document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t()}),window.addEventListener("beforeunload",t)}_engagementStyleForSession(e,t){if(!e||e.length===0||t<=0)return null;let i=0;for(const r of e){const s=Math.max(0,Number(r.sessions||0));if(i+=s,!(i<=0)&&t<=i)return r.style}return null}_maybePromptEngagement(e){var l;const t=this.client;if(!t||t.state!=="ready"||this._engagementPromptedAtSessionCount===e||!t.showWidget)return;const i=t.plans||[],r=t.planIsCompleted||[],s=r.some(Boolean);if(i.length>0&&r.filter(Boolean).length===i.length||s||i.length===0)return;const o=(l=t.engagement)==null?void 0:l.levels,c=this._engagementStyleForSession(o,e);if(c){if(c==="modal"){const u=r.findIndex(h=>!h),d=u>=0?i[u]:null;if(!d)return;t.selectPlan(d)}else c==="popover"&&this.showMessage("Welcome back!",{autoCloseMs:3e4});this._engagementPromptedAtSessionCount=e;try{In().track("engagement-prompt-shown",{style:c,sessionCount:e})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&In().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Em)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[_m];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(_m),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Em),this.passivePlanUuid=t}mountWidget(){p_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Vx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await c_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await AT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}getEngagementInfo(){const e=this._engagementScopeKey;if(!e)return{sessionCount:0,lastActivityAt:null,lastSessionStartAt:null,scopeKey:null};const t=Gc(e);return{sessionCount:(t==null?void 0:t.sessionCount)||0,lastActivityAt:(t==null?void 0:t.lastActivityAt)??null,lastSessionStartAt:(t==null?void 0:t.lastSessionStartAt)??null,scopeKey:e}}}async function Rm(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return v_({appToken:n,window:t,init:e})}async function v_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new g_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Pm(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Rm(void 0,Pm)}):Rm(void 0,Pm)})();
56
+ `;function u_(n){var $,q,pe,be,ye,Be,Q,Ce,se,Le,K;const[e,t]=J(!1),[i,r]=J(!1),[s,a]=J(!1),[o,c]=J(null),[l,u]=J(!1),[d,h]=J(null),[f,g]=J(null),p=d_(n.sdk,v,n.shadowHost,g,a,D=>{if(!D){c(null);return}if(N&&(c(D),!E&&x==="minimized")){u(!0);const W=Math.max(0,D.autoCloseMs??3e3);d&&window.clearTimeout(d);const ae=window.setTimeout(()=>u(!1),W);h(ae)}});function v(D){var W;(W=p.client)!=null&&W.session||(D?Y():t(!1))}if(!p.client)return null;const b=p.client.planIsCompleted.filter(Boolean).length===p.client.plans.length,w=h_(($=p.client.product)==null?void 0:$.widget_url_blacklist),x=b?p.completedWidgetDisplay||((q=p.client.product)==null?void 0:q.completed_widget_display):p.widgetDisplay||((pe=p.client.product)==null?void 0:pe.widget_display),k=p.widgetPosition||((be=p.client.product)==null?void 0:be.widget_position);let C=p.isActive;((Be=(ye=p.client)==null?void 0:ye.product)==null?void 0:Be.name)==="Canibuild"&&(C=!0);const S=p.client.session,E=!!S,A=E&&!e;let I;switch(S==null?void 0:S.speakingState){case"listening":I="user-speaking";break;case"speaking":I="agent-speaking";break;case"thinking":I="thinking";break;case"busy":I="busy";break}const B=S==null?void 0:S.isPaused,N=E||p.client.state==="ready"&&C&&!w&&(x!=="invisible"||p.client.selectedPlan),z=()=>{var D,W,ae,me,zt,$n,Z;return{name:(D=p.client.selectedPlan)==null?void 0:D.name,description:(W=p.client.selectedPlan)==null?void 0:W.description,appName:(ae=p.client.product)==null?void 0:ae.name,appLogoUrl:((me=p.client.product)==null?void 0:me.logo_url)||"",url:(zt=p.client.product)==null?void 0:zt.url,agentName:(($n=p.client.product)==null?void 0:$n.agent_name)||"Obi",legalFooter:((Z=p.client.product)==null?void 0:Z.legal_footer_text)||void 0}},H=k==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};A?H.top="calc(100vh - 100px)":H.bottom="20px";const Y=()=>{const D=p.client;if(!D)return;const W=D.plans||[];if(W.length===1){const[ae]=W;D.selectedPlanUuid!==ae.uuid&&(D.selectPlan(ae),In().track("course-get-started",{courseName:ae.name,courseUuid:ae.uuid})),t(!1),r(!0);return}t(!0)};return m("div",{children:[e&&m(Xw,{open:e,courses:p.client.plans.map((D,W)=>{var ae,me;return{id:D.uuid,name:D.name,description:D.description||"",duration:D.duration||0,completed:((me=(ae=p.client)==null?void 0:ae.planIsCompleted)==null?void 0:me[W])||!1}}),loading:!1,title:((Q=p.client.product)==null?void 0:Q.assistant_subtitle)||void 0,productName:((Ce=p.client.product)==null?void 0:Ce.name)||"",onCourseHighlight:D=>{D&&In().track("course-selected",{courseName:D.name,courseUuid:D.id})},onCourseSelect:D=>{const W=p.client.plans.find(ae=>ae.uuid===D.id)||null;W&&(W==null?void 0:W.uuid)!==p.client.selectedPlanUuid&&(p.client.selectPlan(W),t(!1),r(!0),In().track("course-get-started",{courseName:D.name,courseUuid:D.id}))},onClose:D=>{D==="user-initiated"&&p.client.selectPlan(null),t(!1)}}),N&&m(Xe,{children:[m("div",{style:H,children:m(cw,{inPlan:E,isActive:i?!1:l?!0:void 0,defaultIsActive:x!=="minimized",isPaused:B,toastMessage:o,messaging:(S==null?void 0:S.isMicShared)===!1||s?!0:void 0,speakingStatus:I,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,courseProgress:f,onOpen:Y,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var D;(D=p.client.session)==null||D.stop()},onCancelReason:(D,W)=>{},onPause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.pause)==null||W.call(D)},onUnpause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.unpause)==null||W.call(D)},onMessagingChange:D=>{var W,ae,me,zt;a(!1),D?(ae=(W=p.client.session)==null?void 0:W.muteMicrophone)==null||ae.call(W):(zt=(me=p.client.session)==null?void 0:me.unmuteMicrophone)==null||zt.call(me)},onMessageChange:D=>{In().track("chat-input-provided",{message:D,length:D.length})},onMessage:D=>{p.say(D),a(!1),In().track("chat-message-sent",{message:D,length:D.length})},onHover:D=>{},onOneClickAction:D=>{a(!1)},onMinimize:()=>{},agentName:((se=p.client.product)==null?void 0:se.agent_name)||"Obi",completedTutorials:((Le=p.client.product)==null?void 0:Le.widget_show_progress)===!1?void 0:p.client.planIsCompleted.filter(Boolean).length,totalTutorials:((K=p.client.product)==null?void 0:K.widget_show_progress)===!1?void 0:p.client.plans.length})}),!!p.client.selectedPlan&&m(Qw,{open:!0,session:z(),sessionState:(S==null?void 0:S.state)||null,speakingState:(S==null?void 0:S.speakingState)||null,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,onModalChange:D=>{},onClose:(D,W)=>{var ae,me;D==="user-initiated"&&(((ae=p.client.session)==null?void 0:ae.state)==="mic-share"?(me=p.client.session)==null||me.shareMicrophoneFailed():p.client.stopSession()),r(!1)},onStart:()=>{p.client.selectedPlanUuid&&p.startSession()},onContinue:()=>{S==null||S.continue()},onShareMicrophone:()=>{S==null||S.shareMicrophone()}})]})]})}function d_(n,e,t,i,r,s){const[a,o]=J(0),[c,l]=J(null);return Ze(()=>{n.on("showMenu",u=>{e(u)}),n.on("configUpdated",()=>{o(u=>u+1)}),n.on("showMessage",u=>{s==null||s(u)})},[n]),Ze(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",u=>{l(u),r==null||r(!1),o(d=>d+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(u=>u+1)}),n.client.on("sessionShutdown",()=>{o(u=>u+1)}),n.client.on("sessionResumed",()=>{o(u=>u+1)}),n.client.on("stateChanged",()=>{var u;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((u=n.client.product)==null?void 0:u.primary_color)||"#9500FF"),o(d=>d+1)}),n.client.on("planSelected",()=>{o(u=>u+1)}))},[n,n.client]),Ze(()=>{if(!c)return;c.on("stateChanged",()=>{o(d=>d+1)}),c.on("speakingStateChanged",()=>{o(d=>d+1)}),c.on("paused",()=>{o(d=>d+1)}),c.on("unpaused",()=>{o(d=>d+1)}),c.on("micCheckComplete",d=>{}),c.on("transcript",(d,h)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(d=>d+1)});const u=d=>{i(d)};return c.on&&c.on("courseProgress",u),()=>{c.off&&c.off("courseProgress",u),c.off&&c.off("textInputRequested")}},[c]),n}function h_(n){const[e,t]=J(()=>hr(n));return Ze(()=>{t(hr(n))},[n]),Ze(()=>{f_();const i=()=>{t(hr(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function f_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function p_(n){if(document.querySelector("obi-widget"))return;m_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(l_),t.adoptedStyleSheets=[r],x1(m(u_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function m_(){xm("https://fonts.cdnfonts.com/css/satoshi"),xm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function xm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const _m="49206C6F7665204F6269_session",Em="obi-url-params";class g_ extends ba{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this._engagementScopeKey=null,this._engagementInitialised=!1,this._engagementPromptedAtSessionCount=null,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams(),this.on("engagementSessionStarted",t=>{try{this._maybePromptEngagement(t.sessionCount)}catch{}})}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=Ks.deserialise(i,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r)}t||(t=new Ks(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,g;r==="ready"&&(this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((g=(f=this.client)==null?void 0:f.product)==null?void 0:g.completed_widget_display)||"regular"}),this._maybeInitEngagement())}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})})}_maybeInitEngagement(){if(this._engagementInitialised||!this.client)return;const e=this.client.product,t=this.client.identity;if(!e||!t)return;if(hr(e.widget_url_blacklist||[])){this._engagementScopeKey=hm(e.uuid,t),this._engagementInitialised=!0;return}const r=hm(e.uuid,t);if(!r)return;this._engagementScopeKey=r,this._engagementInitialised=!0;const s=Date.now(),a=Gc(r),o=(a==null?void 0:a.lastActivityAt)||0,c=yx(s,o);let l=(a==null?void 0:a.sessionCount)||0,u=a==null?void 0:a.lastSessionStartAt;if(c){l=((a==null?void 0:a.sessionCount)||0)+1,u=s,zc(r,{lastActivityAt:s,lastSessionStartAt:u,sessionCount:l}),this.emit("engagementSessionStarted",{sessionCount:l,lastSessionStartAt:u,lastActivityAt:s,scopeKey:r});try{In().track("engagement-session-started",{sessionCount:l,productUuid:e.uuid,onboardeeId:(t==null?void 0:t.uuid)||t.email||"unknown"})}catch{}}else u&&new Date(u).toISOString(),o&&new Date(o).toISOString(),new Date(s).toISOString(),s-o;const d=fm(s,{lastActivityAt:(a==null?void 0:a.lastActivityAt)||0,lastSessionStartAt:u,sessionCount:l});zc(r,d),this._attachEngagementLifecycle()}_attachEngagementLifecycle(){if(!this.client)return;const e=this.client.product;if(!e)return;const t=()=>{if(!this._engagementScopeKey||hr(e.widget_url_blacklist||[]))return;const r=Date.now(),s=Gc(this._engagementScopeKey)||{lastActivityAt:0,sessionCount:0},a=fm(r,s);zc(this._engagementScopeKey,a)};document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t()}),window.addEventListener("beforeunload",t)}_engagementStyleForSession(e,t){if(!e||e.length===0||t<=0)return null;let i=0;for(const r of e){const s=Math.max(0,Number(r.sessions||0));if(i+=s,!(i<=0)&&t<=i)return r.style}return null}_maybePromptEngagement(e){var l;const t=this.client;if(!t||t.state!=="ready"||this._engagementPromptedAtSessionCount===e||!t.showWidget)return;const i=t.plans||[],r=t.planIsCompleted||[],s=r.some(Boolean);if(i.length>0&&r.filter(Boolean).length===i.length||s||i.length===0)return;const o=(l=t.engagement)==null?void 0:l.levels,c=this._engagementStyleForSession(o,e);if(c){if(c==="modal"){const u=r.findIndex(h=>!h),d=u>=0?i[u]:null;if(!d)return;t.selectPlan(d)}else c==="popover"&&this.showMessage("Welcome back!",{autoCloseMs:3e4});this._engagementPromptedAtSessionCount=e;try{In().track("engagement-prompt-shown",{style:c,sessionCount:e})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&In().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Em)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[_m];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(_m),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Em),this.passivePlanUuid=t}mountWidget(){p_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Vx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await c_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await AT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}getEngagementInfo(){const e=this._engagementScopeKey;if(!e)return{sessionCount:0,lastActivityAt:null,lastSessionStartAt:null,scopeKey:null};const t=Gc(e);return{sessionCount:(t==null?void 0:t.sessionCount)||0,lastActivityAt:(t==null?void 0:t.lastActivityAt)??null,lastSessionStartAt:(t==null?void 0:t.lastSessionStartAt)??null,scopeKey:e}}}async function Rm(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return v_({appToken:n,window:t,init:e})}async function v_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new g_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Pm(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Rm(void 0,Pm)}):Rm(void 0,Pm)})();
@@ -53,4 +53,4 @@ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
53
53
  }
54
54
  `}),m("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[m("section",{style:n.headerSection,children:[m("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:m("div",{style:n.shimmer})}),m("div",{style:n.textLines,children:[m("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:m("div",{style:n.shimmer})}),m("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:m("div",{style:n.shimmer})})]})]}),m("section",{style:n.contentSection,children:m("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:m("div",{style:n.shimmer})})})]})]})}function Ww({}){const n={host:{display:"block",height:"161px"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Inter', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return m("div",{style:n.host,children:m("div",{style:n.shareContainer,children:[m("div",{style:n.controlsRow,children:[m("div",{style:n.monitorIconContainer,children:m("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[m("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),m("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),m("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),m("div",{style:n.tabSelector,children:[m("button",{style:n.tabButton(!1),children:"Tab"}),m("button",{style:n.tabButton(!0),children:"Window"})]})]}),m("div",{style:n.skeletonContainer,children:m(Hw,{})})]})})}function qw({session:n,speakingState:e,onAction:t}){return m(wi,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:n.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${n.agentName||"Obi"} will guide you through ${n.appName||"the app"} by watching your screen.`,centerVisual:m(Ww,{}),actionDisabled:!0,onAction:t})}function Kw({session:n,speakingState:e,spectrum:t,onAction:i}){return m(wi,{title:"Overview",subtitle:`${n.agentName||"Obi"} will start your tutorial in a moment`,agentName:n.agentName||"Obi",speakingState:e,description:`Get ready to explore ${n.appName||"the app"} with ${n.agentName||"Obi"}.`,centerVisual:m(tm,{spectrum:t}),actionDisabled:!0,onAction:i})}function $w({id:n,name:e,description:t,duration:i=10,order:r=0,selected:s=!1,completed:a=!1,onClick:o}){return m("div",{className:`course-container ${s?"selected":""}`,onClick:()=>{o==null||o({id:n,name:e,description:t,duration:i,order:r})},children:[m("div",{className:"header-row",children:[m("h2",{className:"course-title",children:e}),a&&m("span",{className:"duration",children:"Completed"})]}),t&&m("p",{className:"course-description",children:t})]})}function Yw({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[s,a]=J(""),o=u=>{const d=u.currentTarget;a(d.value)},c=u=>{r==null||r(u)};if(t)return m("div",{className:"loading",children:"Loading..."});if(i)return m("div",{className:"error",children:i});if(!n||n.length===0)return m("div",{className:"empty",children:"No courses available"});const l=n.filter(u=>u.name.toLowerCase().includes(s.toLowerCase())||(u.description||"").toLowerCase().includes(s.toLowerCase()));return m("div",{className:"tour-select",children:[m("div",{className:"controls",children:[m("div",{className:"tabs",children:m("button",{className:"tab active",children:"All"})}),m("div",{className:"filter",children:[m("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),m("input",{type:"text",placeholder:"Search...",value:s,onInput:o})]})]}),m("div",{className:"course-grid",children:l.sort((u,d)=>(u.order||0)-(d.order||0)).map(u=>{const d=u.id===e;return m($w,{id:u.id,name:u.name,description:u.description||"",duration:u.duration,order:u.order||0,completed:u.completed,selected:d,onClick:c},u.id)})})]})}function Xw({open:n,courses:e=[],loading:t=!1,error:i="",title:r="AI Coach",productName:s,onClose:a,onCourseSelect:o,onCourseHighlight:c}){const[l,u]=J(null),d=f=>{u(f),c==null||c(f)},h=()=>{l&&o&&o(l)};return m(Cp,{open:n,onClose:a,size:"large",preventOutsideClick:!0,children:m("div",{className:"tour-select-modal-container",children:[m("div",{className:"header",children:[m("div",{className:"icon",style:{color:"white"},children:m(Fp,{})}),m("div",{className:"title-section",children:t?m(Xe,{children:[m("div",{className:"skeleton skeleton-title"}),m("div",{className:"skeleton skeleton-subtitle"})]}):m(Xe,{children:[m("h1",{children:r}),m("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",s," through an interactive conversation."]})]})})]}),m("div",{className:"course-list-wrapper",children:m(Yw,{courses:e,selectedCourseId:(l==null?void 0:l.id)||"",loading:t,error:i,onCourseSelect:d})}),m("div",{className:"footer",children:[m("button",{className:"obi-button footer-button",onClick:h,disabled:!l,children:[m("span",{children:"Get started"}),m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:m("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:l?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),m("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function Jw({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:s,onShareMicrophone:a,onShareScreen:o,onModalChange:c}){const[l,u]=J(null);function d(f){l!==f&&(c==null||c(f),u(f))}function h(){e==="connecting"||e==="connected"||!e?r==null||r():e==="volume-check"||e==="mic-check"?s==null||s():e==="mic-share"?a==null||a():e==="screen-share"&&(o==null||o())}return ea(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),m(jw,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),m(zw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-check":return d("overview"),m(Kw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),m(Gw,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),m(qw,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),m(gw,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,s,a,o])}function Qw(n){const{session:e,sessionState:t,speakingState:i,spectrum:r,onClose:s,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:u}=n,[d,h]=J(null);function f(v){u==null||u(v),h(v)}function g(v){s(v,d),h(null)}const p=(n.open??!0)&&(!t||t==="connecting"||t==="connected"||t==="volume-check"||t==="mic-check"||t==="mic-share"||t==="screen-share"||t==="navigate");return m(dw,{open:p,onClose:g,preventOutsideClick:!0,children:()=>m(Jw,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:f})})}const Zw={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};function In(){return Zw}const ex=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nm="9.23.0",xi=globalThis;function tx(n,e,t=xi){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[nm]=i[nm]||{};return r[n]||(r[n]=e())}const nx="Sentry Logger ",im=["debug","info","warn","error","log","assert","trace"],rm={};function ix(n){if(!("console"in xi))return n();const e=xi.console,t={},i=Object.keys(rm);i.forEach(r=>{const s=rm[r];t[r]=e[r],e[r]=s});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function rx(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return ex?im.forEach(t=>{e[t]=(...i)=>{n&&ix(()=>{xi.console[t](`${nx}[${t}]:`,...i)})}}):im.forEach(t=>{e[t]=()=>{}}),e}tx("logger",rx);const sm=1e3;function sx(){return Date.now()/sm}function ax(){const{performance:n}=xi;if(!(n!=null&&n.now))return sx;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/sm}ax();const am=50,_i="?",om=/\(error: (.*)\)/,cm=/captureMessage|captureException/;function ox(...n){const e=n.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const s=[],a=t.split(`
55
55
  `);for(let o=i;o<a.length;o++){const c=a[o];if(c.length>1024)continue;const l=om.test(c)?c.replace(om,"$1"):c;if(!l.match(/\S*Error: /)){for(const u of e){const d=u(l);if(d){s.push(d);break}}if(s.length>=am+r)break}}return cx(s.slice(r))}}function cx(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(oa(e).function||"")&&e.pop(),e.reverse(),cm.test(oa(e).function||"")&&(e.pop(),cm.test(oa(e).function||"")&&e.pop()),e.slice(0,am).map(t=>({...t,filename:t.filename||oa(e).filename,function:t.function||_i}))}function oa(n){return n[n.length-1]||{}}var lm;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(lm||(lm={})),xi._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const lx=30,ux=50;function Vc(n,e,t,i){const r={filename:n,function:e==="<anonymous>"?_i:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const dx=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fx=/\((\S*)(?::(\d+))(?::(\d+))\)/,px=n=>{const e=dx.exec(n);if(e){const[,i,r,s]=e;return Vc(i,_i,+r,+s)}const t=hx.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=fx.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=um(t[1]||_i,t[2]);return Vc(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},mx=[lx,px],gx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,vx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;ox(...[mx,[ux,n=>{const e=gx.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=vx.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let t=e[3],i=e[1]||_i;return[i,t]=um(i,t),Vc(t,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const um=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,i=n.indexOf("safari-web-extension")!==-1;return t||i?[n.indexOf("@")!==-1?n.split("@")[0]:_i,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const dm="obi-engagement:";function bx(n){let e=5381;for(let t=0;t<n.length;t++)e=e*33^n.charCodeAt(t);return(e>>>0).toString(16)}function hm(n,e){if(!n||!e)return null;const t=e;let r=(t==null?void 0:t.uuid)||e.email||null;if(!r)try{r=bx(JSON.stringify(e))}catch{return null}return`${n}:${r}`}function Gc(n){try{const e=localStorage.getItem(dm+n);if(!e)return null;const t=JSON.parse(e);return{lastActivityAt:typeof t.lastActivityAt=="number"?t.lastActivityAt:0,lastSessionStartAt:typeof t.lastSessionStartAt=="number"?t.lastSessionStartAt:void 0,sessionCount:typeof t.sessionCount=="number"?t.sessionCount:0}}catch{return null}}function zc(n,e){const t={lastActivityAt:e.lastActivityAt||0,lastSessionStartAt:e.lastSessionStartAt,sessionCount:e.sessionCount||0};localStorage.setItem(dm+n,JSON.stringify(t))}function yx(n,e,t=30*60*1e3){return!e||e<=0?!0:n-e>=t}function fm(n,e){return{...e,lastActivityAt:n}}function Tx(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function kx(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=Tx(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function hr(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return kx(e,n)}function Sx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function Cx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var pm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ca=0;ca<pm.length;ca++)fr[pm.charCodeAt(ca)]=ca;for(var wx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=fr[n.charCodeAt(i)],a=fr[n.charCodeAt(i+1)],o=fr[n.charCodeAt(i+2)],c=fr[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},xx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},_x=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},qn=5,Hc=6+5,Wc=2,Ex=Hc-qn,mm=65536>>qn,Rx=1<<qn,qc=Rx-1,Px=1024>>qn,Ix=mm+Px,Ax=Ix,Ox=32,Nx=Ax+Ox,Mx=65536>>Hc,Lx=1<<Ex,Dx=Lx-1,gm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Ux=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Bx=function(n,e){var t=wx(n),i=Array.isArray(t)?_x(t):new Uint32Array(t),r=Array.isArray(t)?xx(t):new Uint16Array(t),s=24,a=gm(r,s/2,i[4]/2),o=i[5]===2?gm(r,(s+i[4])/2):Ux(i,Math.ceil((s+i[4])/4));return new Fx(i[0],i[1],i[2],i[3],a,o)},Fx=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>qn],t=(t<<Wc)+(e&qc),this.data[t];if(e<=65535)return t=this.index[mm+(e-55296>>qn)],t=(t<<Wc)+(e&qc),this.data[t];if(e<this.highStart)return t=Nx-Mx+(e>>Hc),t=this.index[t],t+=e>>qn&Dx,t=this.index[t],t=(t<<Wc)+(e&qc),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jx=typeof Uint8Array>"u"?[]:new Uint8Array(256),la=0;la<vm.length;la++)jx[vm.charCodeAt(la)]=la;var bm=null;function Vx(n){return Sx(this,void 0,void 0,function(){var e;return Cx(this,function(t){switch(t.label){case 0:return bm!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw new Error("Invalid graphemes response");bm=Bx(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}for(var ym="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gx=typeof Uint8Array>"u"?[]:new Uint8Array(256),ua=0;ua<ym.length;ua++)Gx[ym.charCodeAt(ua)]=ua;function zx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function Hx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var Tm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pr=typeof Uint8Array>"u"?[]:new Uint8Array(256),da=0;da<Tm.length;da++)pr[Tm.charCodeAt(da)]=da;for(var Wx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=pr[n.charCodeAt(i)],a=pr[n.charCodeAt(i+1)],o=pr[n.charCodeAt(i+2)],c=pr[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},qx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Kx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},Kn=5,Kc=6+5,$c=2,$x=Kc-Kn,km=65536>>Kn,Yx=1<<Kn,Yc=Yx-1,Xx=1024>>Kn,Jx=km+Xx,Qx=Jx,Zx=32,e_=Qx+Zx,t_=65536>>Kc,n_=1<<$x,i_=n_-1,Sm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},r_=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},s_=function(n,e){var t=Wx(n),i=Array.isArray(t)?Kx(t):new Uint32Array(t),r=Array.isArray(t)?qx(t):new Uint16Array(t),s=24,a=Sm(r,s/2,i[4]/2),o=i[5]===2?Sm(r,(s+i[4])/2):r_(i,Math.ceil((s+i[4])/4));return new a_(i[0],i[1],i[2],i[3],a,o)},a_=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Kn],t=(t<<$c)+(e&Yc),this.data[t];if(e<=65535)return t=this.index[km+(e-55296>>Kn)],t=(t<<$c)+(e&Yc),this.data[t];if(e<this.highStart)return t=e_-t_+(e>>Kc),t=this.index[t],t+=e>>Kn&i_,t=this.index[t],t=(t<<$c)+(e&Yc),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),Cm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o_=typeof Uint8Array>"u"?[]:new Uint8Array(256),ha=0;ha<Cm.length;ha++)o_[Cm.charCodeAt(ha)]=ha;var wm=null;function c_(n){return zx(this,void 0,void 0,function(){var e;return Hx(this,function(t){switch(t.label){case 0:return wm!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw console.error("invalid graphemes response",e),new Error("Invalid graphemes response");wm=s_(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}const l_=`:root,:host{--obi-modal-padding: 32px 48px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 24px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 372px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:block;flex-grow:1;flex-direction:column;align-items:center;padding:0;width:100%;margin-bottom:16px}.tour-content .title{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:700;font-size:24px;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0 0 12px}.tour-content .subtitle{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{flex-grow:0;flex-shrink:0;display:flex;align-items:center;justify-content:center;position:relative;margin-bottom:24px}.tour-content .visual.glow{width:390px;border-radius:15px;background-color:var(--obi-color-tint)}.tour-content .description{height:45px;width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;color:#757575!important;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.tour-content .button-container{flex-grow:0;display:flex;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Inter,sans-serif;font-style:normal;font-weight:500;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{height:100%;flex:1;display:flex;flex-direction:column}.tour-footer{width:100%!important;text-align:center;display:flex;align-items:flex-end;justify-content:center;font-family:Inter,sans-serif;font-size:8px;font-weight:200;margin-top:20px}.session-start-content .description{height:48px}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);transform:translateY(0);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill2.container:not(.active) .pill .text{opacity:0;animation:none}.obi-pill-up.container{display:flex;align-items:flex-end;justify-content:center}.obi-pill-up.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container .pill.button{cursor:pointer}.obi-pill-up.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill-up.container:not(.active) .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container.active{transition:none;height:30px}.obi-pill-up.container.active .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill-up.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill-up.container:not(.active) .pill .text{opacity:0;animation:none}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-message{display:inline-flex;align-items:center;justify-content:center;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:14px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:6px 0;height:100%;flex:1;min-width:0;cursor:pointer}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0;cursor:pointer}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-course-progress .obi-widget-popout,.obi-course-progress .obi-widget-popout .content{z-index:800}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-widget-course-progress{display:block;width:100%;max-width:220px;max-height:40px;opacity:1;transform:translateY(0);overflow:visible;position:relative;z-index:800;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel .obi-widget-course-progress.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:0}.obi-widget-out-of-plan .text{font-size:16px;color:#fff;display:inline-flex;align-items:center;gap:8px;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active{gap:0}.obi-widget-out-of-plan.active:hover,.obi-widget-out-of-plan.active.hover{gap:4px}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.obi-static-voice{height:96px;display:flex;flex-direction:column;align-items:center;justify-content:center}.obi-static-voice-visual-title{font-family:Inter,sans-serif;font-style:normal;font-weight:600;font-size:14px;color:var(--obi-color-primary);background-color:var(--obi-color-tint);padding:8px 12px;border-radius:20px;margin-bottom:24px}.obi-static-voice-visual{display:flex;align-items:center;gap:2px;height:32px}.obi-static-voice-visual .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-static-voice-visual .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;background-color:#fff;border-radius:2px;z-index:1}.obi-static-voice-visual .bar-1{height:2px}.obi-static-voice-visual .bar-2{height:6px}.obi-static-voice-visual .bar-3{height:10px}.obi-static-voice-visual .bar-4,.obi-static-voice-visual .bar-5{height:16px}.obi-static-voice-visual .bar-6{height:10px}.obi-static-voice-visual .bar-7{height:6px}.obi-static-voice-visual .bar-8{height:2px}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
56
- `;function u_(n){var $,q,pe,be,ye,Be,Q,Ce,se,Le,K;const[e,t]=J(!1),[i,r]=J(!1),[s,a]=J(!1),[o,c]=J(null),[l,u]=J(!1),[d,h]=J(null),[f,g]=J(null),p=d_(n.sdk,v,n.shadowHost,g,a,D=>{if(!D){c(null);return}if(N&&(c(D),!E&&x==="minimized")){u(!0);const W=Math.max(0,D.autoCloseMs??3e3);d&&window.clearTimeout(d);const ae=window.setTimeout(()=>u(!1),W);h(ae)}});function v(D){var W;(W=p.client)!=null&&W.session||(D?Y():t(!1))}if(!p.client)return null;const b=p.client.planIsCompleted.filter(Boolean).length===p.client.plans.length,w=h_(($=p.client.product)==null?void 0:$.widget_url_blacklist),x=b?p.completedWidgetDisplay||((q=p.client.product)==null?void 0:q.completed_widget_display):p.widgetDisplay||((pe=p.client.product)==null?void 0:pe.widget_display),k=p.widgetPosition||((be=p.client.product)==null?void 0:be.widget_position);let C=p.isActive;((Be=(ye=p.client)==null?void 0:ye.product)==null?void 0:Be.name)==="Canibuild"&&(C=!0);const S=p.client.session,E=!!S,A=E&&!e;let I;switch(S==null?void 0:S.speakingState){case"listening":I="user-speaking";break;case"speaking":I="agent-speaking";break;case"thinking":I="thinking";break;case"busy":I="busy";break}const B=S==null?void 0:S.isPaused,N=E||p.client.state==="ready"&&C&&!w&&(x!=="invisible"||p.client.selectedPlan),z=()=>{var D,W,ae,me,zt,$n,Z;return{name:(D=p.client.selectedPlan)==null?void 0:D.name,description:(W=p.client.selectedPlan)==null?void 0:W.description,appName:(ae=p.client.product)==null?void 0:ae.name,appLogoUrl:((me=p.client.product)==null?void 0:me.logo_url)||"",url:(zt=p.client.product)==null?void 0:zt.url,agentName:(($n=p.client.product)==null?void 0:$n.agent_name)||"Obi",legalFooter:((Z=p.client.product)==null?void 0:Z.legal_footer_text)||void 0}},H=k==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};A?H.top="calc(100vh - 100px)":H.bottom="20px";const Y=()=>{const D=p.client;if(!D)return;const W=D.plans||[];if(W.length===1){const[ae]=W;D.selectedPlanUuid!==ae.uuid&&(D.selectPlan(ae),In().track("course-get-started",{courseName:ae.name,courseUuid:ae.uuid})),t(!1),r(!0);return}t(!0)};return m("div",{children:[e&&m(Xw,{open:e,courses:p.client.plans.map((D,W)=>{var ae,me;return{id:D.uuid,name:D.name,description:D.description||"",duration:D.duration||0,completed:((me=(ae=p.client)==null?void 0:ae.planIsCompleted)==null?void 0:me[W])||!1}}),loading:!1,title:((Q=p.client.product)==null?void 0:Q.assistant_subtitle)||void 0,productName:((Ce=p.client.product)==null?void 0:Ce.name)||"",onCourseHighlight:D=>{D&&In().track("course-selected",{courseName:D.name,courseUuid:D.id})},onCourseSelect:D=>{const W=p.client.plans.find(ae=>ae.uuid===D.id)||null;W&&(W==null?void 0:W.uuid)!==p.client.selectedPlanUuid&&(p.client.selectPlan(W),t(!1),r(!0),In().track("course-get-started",{courseName:D.name,courseUuid:D.id}))},onClose:D=>{D==="user-initiated"&&p.client.selectPlan(null),t(!1)}}),N&&m(Xe,{children:[m("div",{style:H,children:m(cw,{inPlan:E,isActive:i?!1:l?!0:void 0,defaultIsActive:x!=="minimized",isPaused:B,toastMessage:o,messaging:(S==null?void 0:S.isMicShared)===!1||s?!0:void 0,speakingStatus:I,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,courseProgress:f,onOpen:Y,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var D;(D=p.client.session)==null||D.stop()},onCancelReason:(D,W)=>{},onPause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.pause)==null||W.call(D)},onUnpause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.unpause)==null||W.call(D)},onMessagingChange:D=>{var W,ae,me,zt;a(!1),D?(ae=(W=p.client.session)==null?void 0:W.muteMicrophone)==null||ae.call(W):(zt=(me=p.client.session)==null?void 0:me.unmuteMicrophone)==null||zt.call(me)},onMessageChange:D=>{In().track("chat-input-provided",{message:D,length:D.length})},onMessage:D=>{p.say(D),a(!1),In().track("chat-message-sent",{message:D,length:D.length})},onHover:D=>{},onOneClickAction:D=>{a(!1)},onMinimize:()=>{},agentName:((se=p.client.product)==null?void 0:se.agent_name)||"Obi",completedTutorials:((Le=p.client.product)==null?void 0:Le.widget_show_progress)===!1?void 0:p.client.planIsCompleted.filter(Boolean).length,totalTutorials:((K=p.client.product)==null?void 0:K.widget_show_progress)===!1?void 0:p.client.plans.length})}),!!p.client.selectedPlan&&m(Qw,{open:!0,session:z(),sessionState:(S==null?void 0:S.state)||null,speakingState:(S==null?void 0:S.speakingState)||null,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,onModalChange:D=>{},onClose:(D,W)=>{var ae,me;D==="user-initiated"&&(((ae=p.client.session)==null?void 0:ae.state)==="mic-share"?(me=p.client.session)==null||me.shareMicrophoneFailed():p.client.stopSession()),r(!1)},onStart:()=>{p.client.selectedPlanUuid&&p.startSession()},onContinue:()=>{S==null||S.continue()},onShareMicrophone:()=>{S==null||S.shareMicrophone()}})]})]})}function d_(n,e,t,i,r,s){const[a,o]=J(0),[c,l]=J(null);return Ze(()=>{n.on("showMenu",u=>{e(u)}),n.on("configUpdated",()=>{o(u=>u+1)}),n.on("showMessage",u=>{s==null||s(u)})},[n]),Ze(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",u=>{l(u),r==null||r(!1),o(d=>d+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(u=>u+1)}),n.client.on("sessionShutdown",()=>{o(u=>u+1)}),n.client.on("sessionResumed",()=>{o(u=>u+1)}),n.client.on("stateChanged",()=>{var u;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((u=n.client.product)==null?void 0:u.primary_color)||"#9500FF"),o(d=>d+1)}),n.client.on("planSelected",()=>{o(u=>u+1)}))},[n,n.client]),Ze(()=>{if(!c)return;c.on("stateChanged",()=>{o(d=>d+1)}),c.on("speakingStateChanged",()=>{o(d=>d+1)}),c.on("paused",()=>{o(d=>d+1)}),c.on("unpaused",()=>{o(d=>d+1)}),c.on("micCheckComplete",d=>{}),c.on("transcript",(d,h)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(d=>d+1)});const u=d=>{i(d)};return c.on&&c.on("courseProgress",u),()=>{c.off&&c.off("courseProgress",u),c.off&&c.off("textInputRequested")}},[c]),n}function h_(n){const[e,t]=J(()=>hr(n));return Ze(()=>{t(hr(n))},[n]),Ze(()=>{f_();const i=()=>{t(hr(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function f_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function p_(n){if(document.querySelector("obi-widget"))return;m_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(l_),t.adoptedStyleSheets=[r],x1(m(u_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function m_(){xm("https://fonts.cdnfonts.com/css/satoshi"),xm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function xm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const _m="49206C6F7665204F6269_session",Em="obi-url-params";class g_ extends ba{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this._engagementScopeKey=null,this._engagementInitialised=!1,this._engagementPromptedAtSessionCount=null,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams(),this.on("engagementSessionStarted",t=>{try{this._maybePromptEngagement(t.sessionCount)}catch{}})}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=Ks.deserialise(i,e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r)}t||(t=new Ks(e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,g;r==="ready"&&(this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((g=(f=this.client)==null?void 0:f.product)==null?void 0:g.completed_widget_display)||"regular"}),this._maybeInitEngagement())}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})})}_maybeInitEngagement(){if(this._engagementInitialised||!this.client)return;const e=this.client.product,t=this.client.identity;if(!e||!t)return;if(hr(e.widget_url_blacklist||[])){this._engagementScopeKey=hm(e.uuid,t),this._engagementInitialised=!0;return}const r=hm(e.uuid,t);if(!r)return;this._engagementScopeKey=r,this._engagementInitialised=!0;const s=Date.now(),a=Gc(r),o=(a==null?void 0:a.lastActivityAt)||0,c=yx(s,o);let l=(a==null?void 0:a.sessionCount)||0,u=a==null?void 0:a.lastSessionStartAt;if(c){l=((a==null?void 0:a.sessionCount)||0)+1,u=s,zc(r,{lastActivityAt:s,lastSessionStartAt:u,sessionCount:l}),this.emit("engagementSessionStarted",{sessionCount:l,lastSessionStartAt:u,lastActivityAt:s,scopeKey:r});try{In().track("engagement-session-started",{sessionCount:l,productUuid:e.uuid,onboardeeId:(t==null?void 0:t.uuid)||t.email||"unknown"})}catch{}}else u&&new Date(u).toISOString(),o&&new Date(o).toISOString(),new Date(s).toISOString(),s-o;const d=fm(s,{lastActivityAt:(a==null?void 0:a.lastActivityAt)||0,lastSessionStartAt:u,sessionCount:l});zc(r,d),this._attachEngagementLifecycle()}_attachEngagementLifecycle(){if(!this.client)return;const e=this.client.product;if(!e)return;const t=()=>{if(!this._engagementScopeKey||hr(e.widget_url_blacklist||[]))return;const r=Date.now(),s=Gc(this._engagementScopeKey)||{lastActivityAt:0,sessionCount:0},a=fm(r,s);zc(this._engagementScopeKey,a)};document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t()}),window.addEventListener("beforeunload",t)}_engagementStyleForSession(e,t){if(!e||e.length===0||t<=0)return null;let i=0;for(const r of e){const s=Math.max(0,Number(r.sessions||0));if(i+=s,!(i<=0)&&t<=i)return r.style}return null}_maybePromptEngagement(e){var l;const t=this.client;if(!t||t.state!=="ready"||this._engagementPromptedAtSessionCount===e||!t.showWidget)return;const i=t.plans||[],r=t.planIsCompleted||[],s=r.some(Boolean);if(i.length>0&&r.filter(Boolean).length===i.length||s||i.length===0)return;const o=(l=t.engagement)==null?void 0:l.levels,c=this._engagementStyleForSession(o,e);if(c){if(c==="modal"){const u=r.findIndex(h=>!h),d=u>=0?i[u]:null;if(!d)return;t.selectPlan(d)}else c==="popover"&&this.showMessage("Welcome back!",{autoCloseMs:3e4});this._engagementPromptedAtSessionCount=e;try{In().track("engagement-prompt-shown",{style:c,sessionCount:e})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&In().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Em)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[_m];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(_m),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Em),this.passivePlanUuid=t}mountWidget(){p_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Vx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await c_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await AT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}getEngagementInfo(){const e=this._engagementScopeKey;if(!e)return{sessionCount:0,lastActivityAt:null,lastSessionStartAt:null,scopeKey:null};const t=Gc(e);return{sessionCount:(t==null?void 0:t.sessionCount)||0,lastActivityAt:(t==null?void 0:t.lastActivityAt)??null,lastSessionStartAt:(t==null?void 0:t.lastSessionStartAt)??null,scopeKey:e}}}async function Rm(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return v_({appToken:n,window:t,init:e})}async function v_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new g_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Pm(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Rm(void 0,Pm)}):Rm(void 0,Pm)})();
56
+ `;function u_(n){var $,q,pe,be,ye,Be,Q,Ce,se,Le,K;const[e,t]=J(!1),[i,r]=J(!1),[s,a]=J(!1),[o,c]=J(null),[l,u]=J(!1),[d,h]=J(null),[f,g]=J(null),p=d_(n.sdk,v,n.shadowHost,g,a,D=>{if(!D){c(null);return}if(N&&(c(D),!E&&x==="minimized")){u(!0);const W=Math.max(0,D.autoCloseMs??3e3);d&&window.clearTimeout(d);const ae=window.setTimeout(()=>u(!1),W);h(ae)}});function v(D){var W;(W=p.client)!=null&&W.session||(D?Y():t(!1))}if(!p.client)return null;const b=p.client.planIsCompleted.filter(Boolean).length===p.client.plans.length,w=h_(($=p.client.product)==null?void 0:$.widget_url_blacklist),x=b?p.completedWidgetDisplay||((q=p.client.product)==null?void 0:q.completed_widget_display):p.widgetDisplay||((pe=p.client.product)==null?void 0:pe.widget_display),k=p.widgetPosition||((be=p.client.product)==null?void 0:be.widget_position);let C=p.isActive;((Be=(ye=p.client)==null?void 0:ye.product)==null?void 0:Be.name)==="Canibuild"&&(C=!0);const S=p.client.session,E=!!S,A=E&&!e;let I;switch(S==null?void 0:S.speakingState){case"listening":I="user-speaking";break;case"speaking":I="agent-speaking";break;case"thinking":I="thinking";break;case"busy":I="busy";break}const B=S==null?void 0:S.isPaused,N=E||p.client.state==="ready"&&C&&!w&&(x!=="invisible"||p.client.selectedPlan),z=()=>{var D,W,ae,me,zt,$n,Z;return{name:(D=p.client.selectedPlan)==null?void 0:D.name,description:(W=p.client.selectedPlan)==null?void 0:W.description,appName:(ae=p.client.product)==null?void 0:ae.name,appLogoUrl:((me=p.client.product)==null?void 0:me.logo_url)||"",url:(zt=p.client.product)==null?void 0:zt.url,agentName:(($n=p.client.product)==null?void 0:$n.agent_name)||"Obi",legalFooter:((Z=p.client.product)==null?void 0:Z.legal_footer_text)||void 0}},H=k==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};A?H.top="calc(100vh - 100px)":H.bottom="20px";const Y=()=>{const D=p.client;if(!D)return;const W=D.plans||[];if(W.length===1){const[ae]=W;D.selectedPlanUuid!==ae.uuid&&(D.selectPlan(ae),In().track("course-get-started",{courseName:ae.name,courseUuid:ae.uuid})),t(!1),r(!0);return}t(!0)};return m("div",{children:[e&&m(Xw,{open:e,courses:p.client.plans.map((D,W)=>{var ae,me;return{id:D.uuid,name:D.name,description:D.description||"",duration:D.duration||0,completed:((me=(ae=p.client)==null?void 0:ae.planIsCompleted)==null?void 0:me[W])||!1}}),loading:!1,title:((Q=p.client.product)==null?void 0:Q.assistant_subtitle)||void 0,productName:((Ce=p.client.product)==null?void 0:Ce.name)||"",onCourseHighlight:D=>{D&&In().track("course-selected",{courseName:D.name,courseUuid:D.id})},onCourseSelect:D=>{const W=p.client.plans.find(ae=>ae.uuid===D.id)||null;W&&(W==null?void 0:W.uuid)!==p.client.selectedPlanUuid&&(p.client.selectPlan(W),t(!1),r(!0),In().track("course-get-started",{courseName:D.name,courseUuid:D.id}))},onClose:D=>{D==="user-initiated"&&p.client.selectPlan(null),t(!1)}}),N&&m(Xe,{children:[m("div",{style:H,children:m(cw,{inPlan:E,isActive:i?!1:l?!0:void 0,defaultIsActive:x!=="minimized",isPaused:B,toastMessage:o,messaging:(S==null?void 0:S.isMicShared)===!1||s?!0:void 0,speakingStatus:I,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,courseProgress:f,onOpen:Y,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var D;(D=p.client.session)==null||D.stop()},onCancelReason:(D,W)=>{},onPause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.pause)==null||W.call(D)},onUnpause:()=>{var D,W;(W=(D=p.client.session)==null?void 0:D.unpause)==null||W.call(D)},onMessagingChange:D=>{var W,ae,me,zt;a(!1),D?(ae=(W=p.client.session)==null?void 0:W.muteMicrophone)==null||ae.call(W):(zt=(me=p.client.session)==null?void 0:me.unmuteMicrophone)==null||zt.call(me)},onMessageChange:D=>{In().track("chat-input-provided",{message:D,length:D.length})},onMessage:D=>{p.say(D),a(!1),In().track("chat-message-sent",{message:D,length:D.length})},onHover:D=>{},onOneClickAction:D=>{a(!1)},onMinimize:()=>{},agentName:((se=p.client.product)==null?void 0:se.agent_name)||"Obi",completedTutorials:((Le=p.client.product)==null?void 0:Le.widget_show_progress)===!1?void 0:p.client.planIsCompleted.filter(Boolean).length,totalTutorials:((K=p.client.product)==null?void 0:K.widget_show_progress)===!1?void 0:p.client.plans.length})}),!!p.client.selectedPlan&&m(Qw,{open:!0,session:z(),sessionState:(S==null?void 0:S.state)||null,speakingState:(S==null?void 0:S.speakingState)||null,spectrum:()=>(S==null?void 0:S.audioSpectrum())||null,onModalChange:D=>{},onClose:(D,W)=>{var ae,me;D==="user-initiated"&&(((ae=p.client.session)==null?void 0:ae.state)==="mic-share"?(me=p.client.session)==null||me.shareMicrophoneFailed():p.client.stopSession()),r(!1)},onStart:()=>{p.client.selectedPlanUuid&&p.startSession()},onContinue:()=>{S==null||S.continue()},onShareMicrophone:()=>{S==null||S.shareMicrophone()}})]})]})}function d_(n,e,t,i,r,s){const[a,o]=J(0),[c,l]=J(null);return Ze(()=>{n.on("showMenu",u=>{e(u)}),n.on("configUpdated",()=>{o(u=>u+1)}),n.on("showMessage",u=>{s==null||s(u)})},[n]),Ze(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",u=>{l(u),r==null||r(!1),o(d=>d+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(u=>u+1)}),n.client.on("sessionShutdown",()=>{o(u=>u+1)}),n.client.on("sessionResumed",()=>{o(u=>u+1)}),n.client.on("stateChanged",()=>{var u;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((u=n.client.product)==null?void 0:u.primary_color)||"#9500FF"),o(d=>d+1)}),n.client.on("planSelected",()=>{o(u=>u+1)}))},[n,n.client]),Ze(()=>{if(!c)return;c.on("stateChanged",()=>{o(d=>d+1)}),c.on("speakingStateChanged",()=>{o(d=>d+1)}),c.on("paused",()=>{o(d=>d+1)}),c.on("unpaused",()=>{o(d=>d+1)}),c.on("micCheckComplete",d=>{}),c.on("transcript",(d,h)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(d=>d+1)});const u=d=>{i(d)};return c.on&&c.on("courseProgress",u),()=>{c.off&&c.off("courseProgress",u),c.off&&c.off("textInputRequested")}},[c]),n}function h_(n){const[e,t]=J(()=>hr(n));return Ze(()=>{t(hr(n))},[n]),Ze(()=>{f_();const i=()=>{t(hr(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function f_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function p_(n){if(document.querySelector("obi-widget"))return;m_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(l_),t.adoptedStyleSheets=[r],x1(m(u_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function m_(){xm("https://fonts.cdnfonts.com/css/satoshi"),xm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function xm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const _m="49206C6F7665204F6269_session",Em="obi-url-params";class g_ extends ba{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this._engagementScopeKey=null,this._engagementInitialised=!1,this._engagementPromptedAtSessionCount=null,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams(),this.on("engagementSessionStarted",t=>{try{this._maybePromptEngagement(t.sessionCount)}catch{}})}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=Ks.deserialise(i,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r)}t||(t=new Ks(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,g;r==="ready"&&(this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((g=(f=this.client)==null?void 0:f.product)==null?void 0:g.completed_widget_display)||"regular"}),this._maybeInitEngagement())}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})})}_maybeInitEngagement(){if(this._engagementInitialised||!this.client)return;const e=this.client.product,t=this.client.identity;if(!e||!t)return;if(hr(e.widget_url_blacklist||[])){this._engagementScopeKey=hm(e.uuid,t),this._engagementInitialised=!0;return}const r=hm(e.uuid,t);if(!r)return;this._engagementScopeKey=r,this._engagementInitialised=!0;const s=Date.now(),a=Gc(r),o=(a==null?void 0:a.lastActivityAt)||0,c=yx(s,o);let l=(a==null?void 0:a.sessionCount)||0,u=a==null?void 0:a.lastSessionStartAt;if(c){l=((a==null?void 0:a.sessionCount)||0)+1,u=s,zc(r,{lastActivityAt:s,lastSessionStartAt:u,sessionCount:l}),this.emit("engagementSessionStarted",{sessionCount:l,lastSessionStartAt:u,lastActivityAt:s,scopeKey:r});try{In().track("engagement-session-started",{sessionCount:l,productUuid:e.uuid,onboardeeId:(t==null?void 0:t.uuid)||t.email||"unknown"})}catch{}}else u&&new Date(u).toISOString(),o&&new Date(o).toISOString(),new Date(s).toISOString(),s-o;const d=fm(s,{lastActivityAt:(a==null?void 0:a.lastActivityAt)||0,lastSessionStartAt:u,sessionCount:l});zc(r,d),this._attachEngagementLifecycle()}_attachEngagementLifecycle(){if(!this.client)return;const e=this.client.product;if(!e)return;const t=()=>{if(!this._engagementScopeKey||hr(e.widget_url_blacklist||[]))return;const r=Date.now(),s=Gc(this._engagementScopeKey)||{lastActivityAt:0,sessionCount:0},a=fm(r,s);zc(this._engagementScopeKey,a)};document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t()}),window.addEventListener("beforeunload",t)}_engagementStyleForSession(e,t){if(!e||e.length===0||t<=0)return null;let i=0;for(const r of e){const s=Math.max(0,Number(r.sessions||0));if(i+=s,!(i<=0)&&t<=i)return r.style}return null}_maybePromptEngagement(e){var l;const t=this.client;if(!t||t.state!=="ready"||this._engagementPromptedAtSessionCount===e||!t.showWidget)return;const i=t.plans||[],r=t.planIsCompleted||[],s=r.some(Boolean);if(i.length>0&&r.filter(Boolean).length===i.length||s||i.length===0)return;const o=(l=t.engagement)==null?void 0:l.levels,c=this._engagementStyleForSession(o,e);if(c){if(c==="modal"){const u=r.findIndex(h=>!h),d=u>=0?i[u]:null;if(!d)return;t.selectPlan(d)}else c==="popover"&&this.showMessage("Welcome back!",{autoCloseMs:3e4});this._engagementPromptedAtSessionCount=e;try{In().track("engagement-prompt-shown",{style:c,sessionCount:e})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&In().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Em)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[_m];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(_m),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Em),this.passivePlanUuid=t}mountWidget(){p_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Vx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await c_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await AT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}getEngagementInfo(){const e=this._engagementScopeKey;if(!e)return{sessionCount:0,lastActivityAt:null,lastSessionStartAt:null,scopeKey:null};const t=Gc(e);return{sessionCount:(t==null?void 0:t.sessionCount)||0,lastActivityAt:(t==null?void 0:t.lastActivityAt)??null,lastSessionStartAt:(t==null?void 0:t.lastSessionStartAt)??null,scopeKey:e}}}async function Rm(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return v_({appToken:n,window:t,init:e})}async function v_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new g_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Pm(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Rm(void 0,Pm)}):Rm(void 0,Pm)})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obi-sdk",
3
- "version": "0.19.37-beta.0",
3
+ "version": "0.19.37",
4
4
  "description": "JavaScript SDK for Obi",
5
5
  "type": "module",
6
6
  "main": "dist/obi-sdk.umd.js",