obi-sdk 0.19.40-beta.1 → 0.19.40
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 +1 -1
- package/dist/obi-sdk.standalone.iife.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,4 +53,4 @@ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
|
|
|
53
53
|
}
|
|
54
54
|
`}),g("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[g("section",{style:n.headerSection,children:[g("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLines,children:[g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:g("div",{style:n.shimmer})})]})]}),g("section",{style:n.contentSection,children:g("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:g("div",{style:n.shimmer})})})]})]})}function Vw({}){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 g("div",{style:n.host,children:g("div",{style:n.shareContainer,children:[g("div",{style:n.controlsRow,children:[g("div",{style:n.monitorIconContainer,children:g("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),g("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),g("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),g("div",{style:n.tabSelector,children:[g("button",{style:n.tabButton(!1),children:"Tab"}),g("button",{style:n.tabButton(!0),children:"Window"})]})]}),g("div",{style:n.skeletonContainer,children:g(jw,{})})]})})}function Gw({session:n,speakingState:e,onAction:t}){return g(Di,{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:g(Vw,{}),actionDisabled:!0,onAction:t})}function zw({session:n,speakingState:e,spectrum:t,onAction:i}){return g(Di,{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:g(am,{spectrum:t}),actionDisabled:!0,onAction:i})}function Hw({id:n,name:e,description:t,duration:i=10,order:r=0,selected:s=!1,completed:a=!1,onClick:o}){return g("div",{className:`course-container ${s?"selected":""}`,onClick:()=>{o==null||o({id:n,name:e,description:t,duration:i,order:r})},children:[g("div",{className:"header-row",children:[g("h2",{className:"course-title",children:e}),a&&g("span",{className:"duration",children:"Completed"})]}),t&&g("p",{className:"course-description",children:t})]})}function Ww({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[s,a]=Y(""),o=u=>{const d=u.currentTarget;a(d.value)},c=u=>{r==null||r(u)};if(t)return g("div",{className:"loading",children:"Loading..."});if(i)return g("div",{className:"error",children:i});if(!n||n.length===0)return g("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 g("div",{className:"tour-select",children:[g("div",{className:"controls",children:[g("div",{className:"tabs",children:g("button",{className:"tab active",children:"All"})}),g("div",{className:"filter",children:[g("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g("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"})}),g("input",{type:"text",placeholder:"Search...",value:s,onInput:o})]})]}),g("div",{className:"course-grid",children:l.sort((u,d)=>(u.order||0)-(d.order||0)).map(u=>{const d=u.id===e;return g(Hw,{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 qw({open:n,courses:e=[],loading:t=!1,error:i="",title:r="AI Coach",productName:s,onClose:a,onCourseSelect:o,onCourseHighlight:c}){const[l,u]=Y(null),d=f=>{u(f),c==null||c(f)},h=()=>{l&&o&&o(l)};return g(Rp,{open:n,onClose:a,size:"large",preventOutsideClick:!0,children:g("div",{className:"tour-select-modal-container",children:[g("div",{className:"header",children:[g("div",{className:"icon",style:{color:"white"},children:g(Hp,{})}),g("div",{className:"title-section",children:t?g(nt,{children:[g("div",{className:"skeleton skeleton-title"}),g("div",{className:"skeleton skeleton-subtitle"})]}):g(nt,{children:[g("h1",{children:r}),g("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",s," through an interactive conversation."]})]})})]}),g("div",{className:"course-list-wrapper",children:g(Ww,{courses:e,selectedCourseId:(l==null?void 0:l.id)||"",loading:t,error:i,onCourseSelect:d})}),g("div",{className:"footer",children:[g("button",{className:"obi-button footer-button",onClick:h,disabled:!l,children:[g("span",{children:"Get started"}),g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:g("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"})})]}),g("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function Kw({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:s,onShareMicrophone:a,onShareScreen:o,onModalChange:c}){const[l,u]=Y(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 ha(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),g(Dw,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),g(Fw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-check":return d("overview"),g(zw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),g(Bw,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),g(Gw,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),g(hw,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,s,a,o])}function $w(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]=Y(null);function f(v){u==null||u(v),h(v)}function m(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 g(ow,{open:p,onClose:m,preventOutsideClick:!0,children:()=>g(Kw,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:f})})}const Yw={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};function ii(){return Yw}const Xw=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,om="9.23.0",Ui=globalThis;function Jw(n,e,t=Ui){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[om]=i[om]||{};return r[n]||(r[n]=e())}const Qw="Sentry Logger ",cm=["debug","info","warn","error","log","assert","trace"],lm={};function Zw(n){if(!("console"in Ui))return n();const e=Ui.console,t={},i=Object.keys(lm);i.forEach(r=>{const s=lm[r];t[r]=e[r],e[r]=s});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function ex(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return Xw?cm.forEach(t=>{e[t]=(...i)=>{n&&Zw(()=>{Ui.console[t](`${Qw}[${t}]:`,...i)})}}):cm.forEach(t=>{e[t]=()=>{}}),e}Jw("logger",ex);const um=1e3;function tx(){return Date.now()/um}function nx(){const{performance:n}=Ui;if(!(n!=null&&n.now))return tx;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/um}nx();const dm=50,Bi="?",hm=/\(error: (.*)\)/,fm=/captureMessage|captureException/;function ix(...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=hm.test(c)?c.replace(hm,"$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>=dm+r)break}}return rx(s.slice(r))}}function rx(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(ya(e).function||"")&&e.pop(),e.reverse(),fm.test(ya(e).function||"")&&(e.pop(),fm.test(ya(e).function||"")&&e.pop()),e.slice(0,dm).map(t=>({...t,filename:t.filename||ya(e).filename,function:t.function||Bi}))}function ya(n){return n[n.length-1]||{}}var pm;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(pm||(pm={})),Ui._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const sx=30,ax=50;function Qc(n,e,t,i){const r={filename:n,function:e==="<anonymous>"?Bi:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const ox=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lx=/\((\S*)(?::(\d+))(?::(\d+))\)/,ux=n=>{const e=ox.exec(n);if(e){const[,i,r,s]=e;return Qc(i,Bi,+r,+s)}const t=cx.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=lx.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=mm(t[1]||Bi,t[2]);return Qc(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},dx=[sx,ux],hx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;ix(...[dx,[ax,n=>{const e=hx.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=fx.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]||Bi;return[i,t]=mm(i,t),Qc(t,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const mm=(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]:Bi,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function px(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function mx(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=px(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function Ta(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return mx(e,n)}function gx(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 vx(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 gm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ka=0;ka<gm.length;ka++)wr[gm.charCodeAt(ka)]=ka;for(var bx=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=wr[n.charCodeAt(i)],a=wr[n.charCodeAt(i+1)],o=wr[n.charCodeAt(i+2)],c=wr[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},yx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Tx=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},ri=5,Zc=6+5,el=2,kx=Zc-ri,vm=65536>>ri,Sx=1<<ri,tl=Sx-1,Cx=1024>>ri,wx=vm+Cx,xx=wx,_x=32,Ex=xx+_x,Rx=65536>>Zc,Px=1<<kx,Ix=Px-1,bm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Ox=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Ax=function(n,e){var t=bx(n),i=Array.isArray(t)?Tx(t):new Uint32Array(t),r=Array.isArray(t)?yx(t):new Uint16Array(t),s=24,a=bm(r,s/2,i[4]/2),o=i[5]===2?bm(r,(s+i[4])/2):Ox(i,Math.ceil((s+i[4])/4));return new Nx(i[0],i[1],i[2],i[3],a,o)},Nx=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>>ri],t=(t<<el)+(e&tl),this.data[t];if(e<=65535)return t=this.index[vm+(e-55296>>ri)],t=(t<<el)+(e&tl),this.data[t];if(e<this.highStart)return t=Ex-Rx+(e>>Zc),t=this.index[t],t+=e>>ri&Ix,t=this.index[t],t=(t<<el)+(e&tl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),ym="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Mx=typeof Uint8Array>"u"?[]:new Uint8Array(256),Sa=0;Sa<ym.length;Sa++)Mx[ym.charCodeAt(Sa)]=Sa;var Tm=null;function Lx(n){return gx(this,void 0,void 0,function(){var e;return vx(this,function(t){switch(t.label){case 0:return Tm!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw new Error("Invalid graphemes response");Tm=Ax(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}for(var km="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dx=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ca=0;Ca<km.length;Ca++)Dx[km.charCodeAt(Ca)]=Ca;function Ux(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 Bx(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 Sm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256),wa=0;wa<Sm.length;wa++)xr[Sm.charCodeAt(wa)]=wa;for(var Fx=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=xr[n.charCodeAt(i)],a=xr[n.charCodeAt(i+1)],o=xr[n.charCodeAt(i+2)],c=xr[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},jx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Vx=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},si=5,nl=6+5,il=2,Gx=nl-si,Cm=65536>>si,zx=1<<si,rl=zx-1,Hx=1024>>si,Wx=Cm+Hx,qx=Wx,Kx=32,$x=qx+Kx,Yx=65536>>nl,Xx=1<<Gx,Jx=Xx-1,wm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Qx=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Zx=function(n,e){var t=Fx(n),i=Array.isArray(t)?Vx(t):new Uint32Array(t),r=Array.isArray(t)?jx(t):new Uint16Array(t),s=24,a=wm(r,s/2,i[4]/2),o=i[5]===2?wm(r,(s+i[4])/2):Qx(i,Math.ceil((s+i[4])/4));return new e_(i[0],i[1],i[2],i[3],a,o)},e_=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>>si],t=(t<<il)+(e&rl),this.data[t];if(e<=65535)return t=this.index[Cm+(e-55296>>si)],t=(t<<il)+(e&rl),this.data[t];if(e<this.highStart)return t=$x-Yx+(e>>nl),t=this.index[t],t+=e>>si&Jx,t=this.index[t],t=(t<<il)+(e&rl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),xm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t_=typeof Uint8Array>"u"?[]:new Uint8Array(256),xa=0;xa<xm.length;xa++)t_[xm.charCodeAt(xa)]=xa;var _m=null;function n_(n){return Ux(this,void 0,void 0,function(){var e;return Bx(this,function(t){switch(t.label){case 0:return _m!==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");_m=Zx(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}const i_=`: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-widget-draggable .obi-widget-panel{cursor:grab}.obi-widget-draggable.dragging .obi-widget-panel{cursor:grabbing;-webkit-user-select:none;user-select:none}.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 r_(n){var xt,hn,_t,Jt,oi,_r,Er,_a,ji,Vn,fn;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(null),[l,u]=Y(!1),[d,h]=Y(null),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(!1),x=Be(null),k=Be(0),S=Be(0),w=Be(0),E=Be(0),A=Be({width:0,height:0}),O=Be(null),B=Be(!1),L=6,R=s_(n.sdk,H,n.shadowHost,m,a,N=>{if(!N){c(null);return}if(Fe&&(c(N),!de&&K==="minimized")){u(!0);const q=Math.max(0,N.autoCloseMs??3e3);d&&window.clearTimeout(d);const Z=window.setTimeout(()=>u(!1),q);h(Z)}});function H(N){var q;(q=R.client)!=null&&q.session||(N?We():t(!1))}if(!R.client)return null;const Q=R.client.planIsCompleted.filter(Boolean).length===R.client.plans.length,X=a_((xt=R.client.product)==null?void 0:xt.widget_url_blacklist),K=Q?R.completedWidgetDisplay||((hn=R.client.product)==null?void 0:hn.completed_widget_display):R.widgetDisplay||((_t=R.client.product)==null?void 0:_t.widget_display),ye=R.widgetPosition||((Jt=R.client.product)==null?void 0:Jt.widget_position);let Te=R.isActive;((_r=(oi=R.client)==null?void 0:oi.product)==null?void 0:_r.name)==="Canibuild"&&(Te=!0);const W=R.client.session,de=!!W,te=de&&!e;let ge;switch(W==null?void 0:W.speakingState){case"listening":ge="user-speaking";break;case"speaking":ge="agent-speaking";break;case"thinking":ge="thinking";break;case"busy":ge="busy";break}const oe=W==null?void 0:W.isPaused,Fe=de||R.client.state==="ready"&&Te&&!X&&(K!=="invisible"||R.client.selectedPlan),$=()=>{var N,q,Z,Se,qe,Qt,pn;return{name:(N=R.client.selectedPlan)==null?void 0:N.name,description:(q=R.client.selectedPlan)==null?void 0:q.description,appName:(Z=R.client.product)==null?void 0:Z.name,appLogoUrl:((Se=R.client.product)==null?void 0:Se.logo_url)||"",url:(qe=R.client.product)==null?void 0:qe.url,agentName:((Qt=R.client.product)==null?void 0:Qt.agent_name)||"Obi",legalFooter:((pn=R.client.product)==null?void 0:pn.legal_footer_text)||void 0}};function ke(){const N=ye==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return te?N.top="calc(100vh - 100px)":N.bottom="20px",N}const Le=(()=>{if(de&&p)return{position:"fixed",left:`${Math.round(p.left)}px`,top:`${Math.round(p.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const N=ke();return de&&(N.touchAction="none"),N})();Qe(()=>{de||(v(null),C(!1),x.current=null,B.current=!1,O.current&&(cancelAnimationFrame(O.current),O.current=null))},[de]);function gt(N,q,Z){return Math.max(q,Math.min(Z,N))}function bt(N){var Qt;if(!de)return;const q=N.currentTarget;if(!q)return;const Z=N.target;if((Qt=Z==null?void 0:Z.closest)==null?void 0:Qt.call(Z,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;x.current=N.pointerId;const qe=q.getBoundingClientRect();k.current=N.clientX,S.current=N.clientY,w.current=qe.left,E.current=qe.top,A.current={width:qe.width,height:qe.height},B.current=!1,v({left:qe.left,top:qe.top})}function Fi(N){var mn;if(!de||x.current!==N.pointerId)return;const q=N.clientX-k.current,Z=N.clientY-S.current;if(!b){if(Math.hypot(q,Z)<L)return;const gn=N.currentTarget;try{(mn=gn==null?void 0:gn.setPointerCapture)==null||mn.call(gn,N.pointerId)}catch{}C(!0),B.current=!0,p||v({left:w.current,top:E.current})}const Se=8,qe=Se,Qt=Se,pn=Math.max(Se,window.innerWidth-A.current.width-Se),Vi=Math.max(Se,window.innerHeight-A.current.height-Se),Et={left:gt(w.current+q,qe,pn),top:gt(E.current+Z,Qt,Vi)};if(O.current==null){const Gi=Et;O.current=requestAnimationFrame(()=>{v(Gi),O.current=null})}else v(Et)}function ai(N){var q,Z;if(x.current!==null)try{(Z=(q=N.currentTarget)==null?void 0:q.releasePointerCapture)==null||Z.call(q,x.current)}catch{}x.current=null,C(!1)}function ne(N){de&&x.current===N.pointerId&&ai(N)}function je(N){de&&x.current===N.pointerId&&ai(N)}const We=()=>{const N=R.client;if(!N)return;const q=N.plans||[];if(q.length===1){const[Z]=q;N.selectedPlanUuid!==Z.uuid&&(N.selectPlan(Z),ii().track("course-get-started",{courseName:Z.name,courseUuid:Z.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(qw,{open:e,courses:R.client.plans.map((N,q)=>{var Z,Se;return{id:N.uuid,name:N.name,description:N.description||"",duration:N.duration||0,completed:((Se=(Z=R.client)==null?void 0:Z.planIsCompleted)==null?void 0:Se[q])||!1}}),loading:!1,title:((Er=R.client.product)==null?void 0:Er.assistant_subtitle)||void 0,productName:((_a=R.client.product)==null?void 0:_a.name)||"",onCourseHighlight:N=>{N&&ii().track("course-selected",{courseName:N.name,courseUuid:N.id})},onCourseSelect:N=>{const q=R.client.plans.find(Z=>Z.uuid===N.id)||null;q&&(q==null?void 0:q.uuid)!==R.client.selectedPlanUuid&&(R.client.selectPlan(q),t(!1),r(!0),ii().track("course-get-started",{courseName:N.name,courseUuid:N.id}))},onClose:N=>{N==="user-initiated"&&R.client.selectPlan(null),t(!1)}}),Fe&&g(nt,{children:[g("div",{className:de?`obi-widget-draggable${b?" dragging":""}`:void 0,style:Le,onPointerDown:bt,onPointerMove:Fi,onPointerUp:ne,onPointerCancel:je,onClickCapture:N=>{var q,Z;B.current&&((q=N.preventDefault)==null||q.call(N),(Z=N.stopPropagation)==null||Z.call(N),B.current=!1)},children:g(rw,{inPlan:de,isActive:i?!1:l?!0:void 0,defaultIsActive:K!=="minimized",isPaused:oe,toastMessage:o,messaging:(W==null?void 0:W.isMicShared)===!1||s?!0:void 0,speakingStatus:ge,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,courseProgress:f,onOpen:We,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var N;(N=R.client.session)==null||N.stop()},onCancelReason:(N,q)=>{},onPause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.pause)==null||q.call(N)},onUnpause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.unpause)==null||q.call(N)},onMessagingChange:N=>{var q,Z,Se,qe;a(!1),N?(Z=(q=R.client.session)==null?void 0:q.muteMicrophone)==null||Z.call(q):(qe=(Se=R.client.session)==null?void 0:Se.unmuteMicrophone)==null||qe.call(Se)},onMessageChange:N=>{ii().track("chat-input-provided",{message:N,length:N.length})},onMessage:N=>{R.say(N),a(!1),ii().track("chat-message-sent",{message:N,length:N.length})},onHover:N=>{},onOneClickAction:N=>{a(!1)},onMinimize:()=>{},agentName:((ji=R.client.product)==null?void 0:ji.agent_name)||"Obi",completedTutorials:((Vn=R.client.product)==null?void 0:Vn.widget_show_progress)===!1?void 0:R.client.planIsCompleted.filter(Boolean).length,totalTutorials:((fn=R.client.product)==null?void 0:fn.widget_show_progress)===!1?void 0:R.client.plans.length})}),!!R.client.selectedPlan&&g($w,{open:!0,session:$(),sessionState:(W==null?void 0:W.state)||null,speakingState:(W==null?void 0:W.speakingState)||null,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,onModalChange:N=>{},onClose:(N,q)=>{var Z,Se;N==="user-initiated"&&(((Z=R.client.session)==null?void 0:Z.state)==="mic-share"?(Se=R.client.session)==null||Se.shareMicrophoneFailed():R.client.stopSession()),r(!1)},onStart:()=>{R.client.selectedPlanUuid&&R.startSession()},onContinue:()=>{W==null||W.continue()},onShareMicrophone:()=>{W==null||W.shareMicrophone()}})]})]})}function s_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(null),u=Be(s);Qe(()=>{u.current=s},[s]);const d=h=>{var f;(f=u.current)==null||f.call(u,h)};return Qe(()=>{const h=m=>{e(m)};n.on("showMenu",h);const f=()=>{o(m=>m+1)};return n.on("configUpdated",f),n.on("showMessage",d),()=>{var m,p,v;(m=n.off)==null||m.call(n,"showMenu",h),(p=n.off)==null||p.call(n,"configUpdated",f),(v=n.off)==null||v.call(n,"showMessage",d)}},[n]),Qe(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",h=>{l(h),r==null||r(!1),o(f=>f+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(h=>h+1)}),n.client.on("sessionShutdown",()=>{o(h=>h+1)}),n.client.on("sessionResumed",()=>{o(h=>h+1)}),n.client.on("stateChanged",()=>{var h;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((h=n.client.product)==null?void 0:h.primary_color)||"#9500FF"),o(f=>f+1)}),n.client.on("planSelected",()=>{o(h=>h+1)}))},[n,n.client]),Qe(()=>{if(!c)return;c.on("stateChanged",()=>{o(f=>f+1)}),c.on("speakingStateChanged",()=>{o(f=>f+1)}),c.on("paused",()=>{o(f=>f+1)}),c.on("unpaused",()=>{o(f=>f+1)}),c.on("micCheckComplete",f=>{}),c.on("transcript",(f,m)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(f=>f+1)});const h=f=>{i(f)};return c.on&&c.on("courseProgress",h),()=>{c.off&&c.off("courseProgress",h),c.off&&c.off("textInputRequested")}},[c]),n}function a_(n){const[e,t]=Y(()=>Ta(n));return Qe(()=>{t(Ta(n))},[n]),Qe(()=>{o_();const i=()=>{t(Ta(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 o_(){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 c_(n){if(document.querySelector("obi-widget"))return;l_();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(i_),t.adoptedStyleSheets=[r],k1(g(r_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function l_(){Em("https://fonts.cdnfonts.com/css/satoshi"),Em("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Em(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Rm="49206C6F7665204F6269_session",Pm="obi-url-params";class u_ extends Pa{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,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()}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=sa.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 sa(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,m;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)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),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()})})}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&Ta(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}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");try{this._maybeActOnServerEngagement()}catch{}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");try{this._maybeActOnServerEngagement()}catch{}}).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");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().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(Pm)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Rm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Rm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Pm),this.passivePlanUuid=t}mountWidget(){c_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Lx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await n_(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 ET(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")}}async function Im(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return d_({appToken:n,window:t,init:e})}async function d_({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 u_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Om(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Im(void 0,Om)}):Im(void 0,Om)})();
|
|
56
|
+
`;function r_(n){var xt,hn,_t,Jt,oi,_r,Er,_a,ji,Vn,fn;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(null),[l,u]=Y(!1),[d,h]=Y(null),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(!1),x=Be(null),k=Be(0),S=Be(0),w=Be(0),E=Be(0),A=Be({width:0,height:0}),O=Be(null),B=Be(!1),L=6,R=s_(n.sdk,H,n.shadowHost,m,a,N=>{if(!N){c(null);return}if(Fe&&(c(N),!de&&K==="minimized")){u(!0);const q=Math.max(0,N.autoCloseMs??3e3);d&&window.clearTimeout(d);const Z=window.setTimeout(()=>u(!1),q);h(Z)}});function H(N){var q;(q=R.client)!=null&&q.session||(N?We():t(!1))}if(!R.client)return null;const Q=R.client.planIsCompleted.filter(Boolean).length===R.client.plans.length,X=a_((xt=R.client.product)==null?void 0:xt.widget_url_blacklist),K=Q?R.completedWidgetDisplay||((hn=R.client.product)==null?void 0:hn.completed_widget_display):R.widgetDisplay||((_t=R.client.product)==null?void 0:_t.widget_display),ye=R.widgetPosition||((Jt=R.client.product)==null?void 0:Jt.widget_position);let Te=R.isActive;((_r=(oi=R.client)==null?void 0:oi.product)==null?void 0:_r.name)==="Canibuild"&&(Te=!0);const W=R.client.session,de=!!W,te=de&&!e;let ge;switch(W==null?void 0:W.speakingState){case"listening":ge="user-speaking";break;case"speaking":ge="agent-speaking";break;case"thinking":ge="thinking";break;case"busy":ge="busy";break}const oe=W==null?void 0:W.isPaused,Fe=de||R.client.state==="ready"&&Te&&!X&&(K!=="invisible"||R.client.selectedPlan),$=()=>{var N,q,Z,Se,qe,Qt,pn;return{name:(N=R.client.selectedPlan)==null?void 0:N.name,description:(q=R.client.selectedPlan)==null?void 0:q.description,appName:(Z=R.client.product)==null?void 0:Z.name,appLogoUrl:((Se=R.client.product)==null?void 0:Se.logo_url)||"",url:(qe=R.client.product)==null?void 0:qe.url,agentName:((Qt=R.client.product)==null?void 0:Qt.agent_name)||"Obi",legalFooter:((pn=R.client.product)==null?void 0:pn.legal_footer_text)||void 0}};function ke(){const N=ye==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return te?N.top="calc(100vh - 100px)":N.bottom="20px",N}const Le=(()=>{if(de&&p)return{position:"fixed",left:`${Math.round(p.left)}px`,top:`${Math.round(p.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const N=ke();return de&&(N.touchAction="none"),N})();Qe(()=>{de||(v(null),C(!1),x.current=null,B.current=!1,O.current&&(cancelAnimationFrame(O.current),O.current=null))},[de]);function gt(N,q,Z){return Math.max(q,Math.min(Z,N))}function bt(N){var Qt;if(!de)return;const q=N.currentTarget;if(!q)return;const Z=N.target;if((Qt=Z==null?void 0:Z.closest)==null?void 0:Qt.call(Z,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;x.current=N.pointerId;const qe=q.getBoundingClientRect();k.current=N.clientX,S.current=N.clientY,w.current=qe.left,E.current=qe.top,A.current={width:qe.width,height:qe.height},B.current=!1,v({left:qe.left,top:qe.top})}function Fi(N){var mn;if(!de||x.current!==N.pointerId)return;const q=N.clientX-k.current,Z=N.clientY-S.current;if(!b){if(Math.hypot(q,Z)<L)return;const gn=N.currentTarget;try{(mn=gn==null?void 0:gn.setPointerCapture)==null||mn.call(gn,N.pointerId)}catch{}C(!0),B.current=!0,p||v({left:w.current,top:E.current})}const Se=8,qe=Se,Qt=Se,pn=Math.max(Se,window.innerWidth-A.current.width-Se),Vi=Math.max(Se,window.innerHeight-A.current.height-Se),Et={left:gt(w.current+q,qe,pn),top:gt(E.current+Z,Qt,Vi)};if(O.current==null){const Gi=Et;O.current=requestAnimationFrame(()=>{v(Gi),O.current=null})}else v(Et)}function ai(N){var q,Z;if(x.current!==null)try{(Z=(q=N.currentTarget)==null?void 0:q.releasePointerCapture)==null||Z.call(q,x.current)}catch{}x.current=null,C(!1)}function ne(N){de&&x.current===N.pointerId&&ai(N)}function je(N){de&&x.current===N.pointerId&&ai(N)}const We=()=>{const N=R.client;if(!N)return;const q=N.plans||[];if(q.length===1){const[Z]=q;N.selectedPlanUuid!==Z.uuid&&(N.selectPlan(Z),ii().track("course-get-started",{courseName:Z.name,courseUuid:Z.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(qw,{open:e,courses:R.client.plans.map((N,q)=>{var Z,Se;return{id:N.uuid,name:N.name,description:N.description||"",duration:N.duration||0,completed:((Se=(Z=R.client)==null?void 0:Z.planIsCompleted)==null?void 0:Se[q])||!1}}),loading:!1,title:((Er=R.client.product)==null?void 0:Er.assistant_subtitle)||void 0,productName:((_a=R.client.product)==null?void 0:_a.name)||"",onCourseHighlight:N=>{N&&ii().track("course-selected",{courseName:N.name,courseUuid:N.id})},onCourseSelect:N=>{const q=R.client.plans.find(Z=>Z.uuid===N.id)||null;q&&(q==null?void 0:q.uuid)!==R.client.selectedPlanUuid&&(R.client.selectPlan(q),t(!1),r(!0),ii().track("course-get-started",{courseName:N.name,courseUuid:N.id}))},onClose:N=>{N==="user-initiated"&&R.client.selectPlan(null),t(!1)}}),Fe&&g(nt,{children:[g("div",{className:de?`obi-widget-draggable${b?" dragging":""}`:void 0,style:Le,onPointerDown:bt,onPointerMove:Fi,onPointerUp:ne,onPointerCancel:je,onClickCapture:N=>{var q,Z;B.current&&((q=N.preventDefault)==null||q.call(N),(Z=N.stopPropagation)==null||Z.call(N),B.current=!1)},children:g(rw,{inPlan:de,isActive:i?!1:l?!0:void 0,defaultIsActive:K!=="minimized",isPaused:oe,toastMessage:o,messaging:(W==null?void 0:W.isMicShared)===!1||s?!0:void 0,speakingStatus:ge,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,courseProgress:f,onOpen:We,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var N;(N=R.client.session)==null||N.stop()},onCancelReason:(N,q)=>{},onPause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.pause)==null||q.call(N)},onUnpause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.unpause)==null||q.call(N)},onMessagingChange:N=>{var q,Z,Se,qe;a(!1),N?(Z=(q=R.client.session)==null?void 0:q.muteMicrophone)==null||Z.call(q):(qe=(Se=R.client.session)==null?void 0:Se.unmuteMicrophone)==null||qe.call(Se)},onMessageChange:N=>{ii().track("chat-input-provided",{message:N,length:N.length})},onMessage:N=>{R.say(N),a(!1),ii().track("chat-message-sent",{message:N,length:N.length})},onHover:N=>{},onOneClickAction:N=>{a(!1)},onMinimize:()=>{},agentName:((ji=R.client.product)==null?void 0:ji.agent_name)||"Obi",completedTutorials:((Vn=R.client.product)==null?void 0:Vn.widget_show_progress)===!1?void 0:R.client.planIsCompleted.filter(Boolean).length,totalTutorials:((fn=R.client.product)==null?void 0:fn.widget_show_progress)===!1?void 0:R.client.plans.length})}),!!R.client.selectedPlan&&g($w,{open:!0,session:$(),sessionState:(W==null?void 0:W.state)||null,speakingState:(W==null?void 0:W.speakingState)||null,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,onModalChange:N=>{},onClose:(N,q)=>{var Z,Se;N==="user-initiated"&&(((Z=R.client.session)==null?void 0:Z.state)==="mic-share"?(Se=R.client.session)==null||Se.shareMicrophoneFailed():R.client.stopSession()),r(!1)},onStart:()=>{R.client.selectedPlanUuid&&R.startSession()},onContinue:()=>{W==null||W.continue()},onShareMicrophone:()=>{W==null||W.shareMicrophone()}})]})]})}function s_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(null),u=Be(s);Qe(()=>{u.current=s},[s]);const d=h=>{var f;(f=u.current)==null||f.call(u,h)};return Qe(()=>{const h=m=>{e(m)};n.on("showMenu",h);const f=()=>{o(m=>m+1)};return n.on("configUpdated",f),n.on("showMessage",d),()=>{var m,p,v;(m=n.off)==null||m.call(n,"showMenu",h),(p=n.off)==null||p.call(n,"configUpdated",f),(v=n.off)==null||v.call(n,"showMessage",d)}},[n]),Qe(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",h=>{l(h),r==null||r(!1),o(f=>f+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(h=>h+1)}),n.client.on("sessionShutdown",()=>{o(h=>h+1)}),n.client.on("sessionResumed",()=>{o(h=>h+1)}),n.client.on("stateChanged",()=>{var h;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((h=n.client.product)==null?void 0:h.primary_color)||"#9500FF"),o(f=>f+1)}),n.client.on("planSelected",()=>{o(h=>h+1)}))},[n,n.client]),Qe(()=>{if(!c)return;c.on("stateChanged",()=>{o(f=>f+1)}),c.on("speakingStateChanged",()=>{o(f=>f+1)}),c.on("paused",()=>{o(f=>f+1)}),c.on("unpaused",()=>{o(f=>f+1)}),c.on("micCheckComplete",f=>{}),c.on("transcript",(f,m)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(f=>f+1)});const h=f=>{i(f)};return c.on&&c.on("courseProgress",h),()=>{c.off&&c.off("courseProgress",h),c.off&&c.off("textInputRequested")}},[c]),n}function a_(n){const[e,t]=Y(()=>Ta(n));return Qe(()=>{t(Ta(n))},[n]),Qe(()=>{o_();const i=()=>{t(Ta(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 o_(){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 c_(n){if(document.querySelector("obi-widget"))return;l_();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(i_),t.adoptedStyleSheets=[r],k1(g(r_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function l_(){Em("https://fonts.cdnfonts.com/css/satoshi"),Em("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Em(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Rm="49206C6F7665204F6269_session",Pm="obi-url-params";class u_ extends Pa{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,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()}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=sa.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 sa(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,m;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)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),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()})})}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&Ta(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}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");try{this._maybeActOnServerEngagement()}catch{}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");try{this._maybeActOnServerEngagement()}catch{}}).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");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().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(Pm)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Rm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Rm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Pm),this.passivePlanUuid=t}mountWidget(){c_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Lx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await n_(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 ET(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")}}async function Im(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return d_({appToken:n,window:t,init:e})}async function d_({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 u_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Om(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Im(void 0,Om)}):Im(void 0,Om)})();
|
|
@@ -53,4 +53,4 @@ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
|
|
|
53
53
|
}
|
|
54
54
|
`}),g("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[g("section",{style:n.headerSection,children:[g("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLines,children:[g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:g("div",{style:n.shimmer})})]})]}),g("section",{style:n.contentSection,children:g("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:g("div",{style:n.shimmer})})})]})]})}function Vw({}){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 g("div",{style:n.host,children:g("div",{style:n.shareContainer,children:[g("div",{style:n.controlsRow,children:[g("div",{style:n.monitorIconContainer,children:g("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),g("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),g("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),g("div",{style:n.tabSelector,children:[g("button",{style:n.tabButton(!1),children:"Tab"}),g("button",{style:n.tabButton(!0),children:"Window"})]})]}),g("div",{style:n.skeletonContainer,children:g(jw,{})})]})})}function Gw({session:n,speakingState:e,onAction:t}){return g(Di,{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:g(Vw,{}),actionDisabled:!0,onAction:t})}function zw({session:n,speakingState:e,spectrum:t,onAction:i}){return g(Di,{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:g(am,{spectrum:t}),actionDisabled:!0,onAction:i})}function Hw({id:n,name:e,description:t,duration:i=10,order:r=0,selected:s=!1,completed:a=!1,onClick:o}){return g("div",{className:`course-container ${s?"selected":""}`,onClick:()=>{o==null||o({id:n,name:e,description:t,duration:i,order:r})},children:[g("div",{className:"header-row",children:[g("h2",{className:"course-title",children:e}),a&&g("span",{className:"duration",children:"Completed"})]}),t&&g("p",{className:"course-description",children:t})]})}function Ww({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[s,a]=Y(""),o=u=>{const d=u.currentTarget;a(d.value)},c=u=>{r==null||r(u)};if(t)return g("div",{className:"loading",children:"Loading..."});if(i)return g("div",{className:"error",children:i});if(!n||n.length===0)return g("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 g("div",{className:"tour-select",children:[g("div",{className:"controls",children:[g("div",{className:"tabs",children:g("button",{className:"tab active",children:"All"})}),g("div",{className:"filter",children:[g("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g("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"})}),g("input",{type:"text",placeholder:"Search...",value:s,onInput:o})]})]}),g("div",{className:"course-grid",children:l.sort((u,d)=>(u.order||0)-(d.order||0)).map(u=>{const d=u.id===e;return g(Hw,{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 qw({open:n,courses:e=[],loading:t=!1,error:i="",title:r="AI Coach",productName:s,onClose:a,onCourseSelect:o,onCourseHighlight:c}){const[l,u]=Y(null),d=f=>{u(f),c==null||c(f)},h=()=>{l&&o&&o(l)};return g(Rp,{open:n,onClose:a,size:"large",preventOutsideClick:!0,children:g("div",{className:"tour-select-modal-container",children:[g("div",{className:"header",children:[g("div",{className:"icon",style:{color:"white"},children:g(Hp,{})}),g("div",{className:"title-section",children:t?g(nt,{children:[g("div",{className:"skeleton skeleton-title"}),g("div",{className:"skeleton skeleton-subtitle"})]}):g(nt,{children:[g("h1",{children:r}),g("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",s," through an interactive conversation."]})]})})]}),g("div",{className:"course-list-wrapper",children:g(Ww,{courses:e,selectedCourseId:(l==null?void 0:l.id)||"",loading:t,error:i,onCourseSelect:d})}),g("div",{className:"footer",children:[g("button",{className:"obi-button footer-button",onClick:h,disabled:!l,children:[g("span",{children:"Get started"}),g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:g("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"})})]}),g("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function Kw({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:s,onShareMicrophone:a,onShareScreen:o,onModalChange:c}){const[l,u]=Y(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 ha(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),g(Dw,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),g(Fw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-check":return d("overview"),g(zw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),g(Bw,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),g(Gw,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),g(hw,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,s,a,o])}function $w(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]=Y(null);function f(v){u==null||u(v),h(v)}function m(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 g(ow,{open:p,onClose:m,preventOutsideClick:!0,children:()=>g(Kw,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:f})})}const Yw={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};function ii(){return Yw}const Xw=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,om="9.23.0",Ui=globalThis;function Jw(n,e,t=Ui){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[om]=i[om]||{};return r[n]||(r[n]=e())}const Qw="Sentry Logger ",cm=["debug","info","warn","error","log","assert","trace"],lm={};function Zw(n){if(!("console"in Ui))return n();const e=Ui.console,t={},i=Object.keys(lm);i.forEach(r=>{const s=lm[r];t[r]=e[r],e[r]=s});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function ex(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return Xw?cm.forEach(t=>{e[t]=(...i)=>{n&&Zw(()=>{Ui.console[t](`${Qw}[${t}]:`,...i)})}}):cm.forEach(t=>{e[t]=()=>{}}),e}Jw("logger",ex);const um=1e3;function tx(){return Date.now()/um}function nx(){const{performance:n}=Ui;if(!(n!=null&&n.now))return tx;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/um}nx();const dm=50,Bi="?",hm=/\(error: (.*)\)/,fm=/captureMessage|captureException/;function ix(...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=hm.test(c)?c.replace(hm,"$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>=dm+r)break}}return rx(s.slice(r))}}function rx(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(ya(e).function||"")&&e.pop(),e.reverse(),fm.test(ya(e).function||"")&&(e.pop(),fm.test(ya(e).function||"")&&e.pop()),e.slice(0,dm).map(t=>({...t,filename:t.filename||ya(e).filename,function:t.function||Bi}))}function ya(n){return n[n.length-1]||{}}var pm;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(pm||(pm={})),Ui._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const sx=30,ax=50;function Qc(n,e,t,i){const r={filename:n,function:e==="<anonymous>"?Bi:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const ox=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lx=/\((\S*)(?::(\d+))(?::(\d+))\)/,ux=n=>{const e=ox.exec(n);if(e){const[,i,r,s]=e;return Qc(i,Bi,+r,+s)}const t=cx.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=lx.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=mm(t[1]||Bi,t[2]);return Qc(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},dx=[sx,ux],hx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;ix(...[dx,[ax,n=>{const e=hx.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=fx.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]||Bi;return[i,t]=mm(i,t),Qc(t,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const mm=(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]:Bi,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function px(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function mx(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=px(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function Ta(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return mx(e,n)}function gx(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 vx(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 gm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ka=0;ka<gm.length;ka++)wr[gm.charCodeAt(ka)]=ka;for(var bx=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=wr[n.charCodeAt(i)],a=wr[n.charCodeAt(i+1)],o=wr[n.charCodeAt(i+2)],c=wr[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},yx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Tx=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},ri=5,Zc=6+5,el=2,kx=Zc-ri,vm=65536>>ri,Sx=1<<ri,tl=Sx-1,Cx=1024>>ri,wx=vm+Cx,xx=wx,_x=32,Ex=xx+_x,Rx=65536>>Zc,Px=1<<kx,Ix=Px-1,bm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Ox=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Ax=function(n,e){var t=bx(n),i=Array.isArray(t)?Tx(t):new Uint32Array(t),r=Array.isArray(t)?yx(t):new Uint16Array(t),s=24,a=bm(r,s/2,i[4]/2),o=i[5]===2?bm(r,(s+i[4])/2):Ox(i,Math.ceil((s+i[4])/4));return new Nx(i[0],i[1],i[2],i[3],a,o)},Nx=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>>ri],t=(t<<el)+(e&tl),this.data[t];if(e<=65535)return t=this.index[vm+(e-55296>>ri)],t=(t<<el)+(e&tl),this.data[t];if(e<this.highStart)return t=Ex-Rx+(e>>Zc),t=this.index[t],t+=e>>ri&Ix,t=this.index[t],t=(t<<el)+(e&tl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),ym="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Mx=typeof Uint8Array>"u"?[]:new Uint8Array(256),Sa=0;Sa<ym.length;Sa++)Mx[ym.charCodeAt(Sa)]=Sa;var Tm=null;function Lx(n){return gx(this,void 0,void 0,function(){var e;return vx(this,function(t){switch(t.label){case 0:return Tm!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw new Error("Invalid graphemes response");Tm=Ax(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}for(var km="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dx=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ca=0;Ca<km.length;Ca++)Dx[km.charCodeAt(Ca)]=Ca;function Ux(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 Bx(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 Sm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256),wa=0;wa<Sm.length;wa++)xr[Sm.charCodeAt(wa)]=wa;for(var Fx=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=xr[n.charCodeAt(i)],a=xr[n.charCodeAt(i+1)],o=xr[n.charCodeAt(i+2)],c=xr[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},jx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Vx=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},si=5,nl=6+5,il=2,Gx=nl-si,Cm=65536>>si,zx=1<<si,rl=zx-1,Hx=1024>>si,Wx=Cm+Hx,qx=Wx,Kx=32,$x=qx+Kx,Yx=65536>>nl,Xx=1<<Gx,Jx=Xx-1,wm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Qx=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Zx=function(n,e){var t=Fx(n),i=Array.isArray(t)?Vx(t):new Uint32Array(t),r=Array.isArray(t)?jx(t):new Uint16Array(t),s=24,a=wm(r,s/2,i[4]/2),o=i[5]===2?wm(r,(s+i[4])/2):Qx(i,Math.ceil((s+i[4])/4));return new e_(i[0],i[1],i[2],i[3],a,o)},e_=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>>si],t=(t<<il)+(e&rl),this.data[t];if(e<=65535)return t=this.index[Cm+(e-55296>>si)],t=(t<<il)+(e&rl),this.data[t];if(e<this.highStart)return t=$x-Yx+(e>>nl),t=this.index[t],t+=e>>si&Jx,t=this.index[t],t=(t<<il)+(e&rl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),xm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t_=typeof Uint8Array>"u"?[]:new Uint8Array(256),xa=0;xa<xm.length;xa++)t_[xm.charCodeAt(xa)]=xa;var _m=null;function n_(n){return Ux(this,void 0,void 0,function(){var e;return Bx(this,function(t){switch(t.label){case 0:return _m!==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");_m=Zx(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}const i_=`: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-widget-draggable .obi-widget-panel{cursor:grab}.obi-widget-draggable.dragging .obi-widget-panel{cursor:grabbing;-webkit-user-select:none;user-select:none}.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 r_(n){var xt,hn,_t,Jt,oi,_r,Er,_a,ji,Vn,fn;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(null),[l,u]=Y(!1),[d,h]=Y(null),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(!1),x=Be(null),k=Be(0),S=Be(0),w=Be(0),E=Be(0),A=Be({width:0,height:0}),O=Be(null),B=Be(!1),L=6,R=s_(n.sdk,H,n.shadowHost,m,a,N=>{if(!N){c(null);return}if(Fe&&(c(N),!de&&K==="minimized")){u(!0);const q=Math.max(0,N.autoCloseMs??3e3);d&&window.clearTimeout(d);const Z=window.setTimeout(()=>u(!1),q);h(Z)}});function H(N){var q;(q=R.client)!=null&&q.session||(N?We():t(!1))}if(!R.client)return null;const Q=R.client.planIsCompleted.filter(Boolean).length===R.client.plans.length,X=a_((xt=R.client.product)==null?void 0:xt.widget_url_blacklist),K=Q?R.completedWidgetDisplay||((hn=R.client.product)==null?void 0:hn.completed_widget_display):R.widgetDisplay||((_t=R.client.product)==null?void 0:_t.widget_display),ye=R.widgetPosition||((Jt=R.client.product)==null?void 0:Jt.widget_position);let Te=R.isActive;((_r=(oi=R.client)==null?void 0:oi.product)==null?void 0:_r.name)==="Canibuild"&&(Te=!0);const W=R.client.session,de=!!W,te=de&&!e;let ge;switch(W==null?void 0:W.speakingState){case"listening":ge="user-speaking";break;case"speaking":ge="agent-speaking";break;case"thinking":ge="thinking";break;case"busy":ge="busy";break}const oe=W==null?void 0:W.isPaused,Fe=de||R.client.state==="ready"&&Te&&!X&&(K!=="invisible"||R.client.selectedPlan),$=()=>{var N,q,Z,Se,qe,Qt,pn;return{name:(N=R.client.selectedPlan)==null?void 0:N.name,description:(q=R.client.selectedPlan)==null?void 0:q.description,appName:(Z=R.client.product)==null?void 0:Z.name,appLogoUrl:((Se=R.client.product)==null?void 0:Se.logo_url)||"",url:(qe=R.client.product)==null?void 0:qe.url,agentName:((Qt=R.client.product)==null?void 0:Qt.agent_name)||"Obi",legalFooter:((pn=R.client.product)==null?void 0:pn.legal_footer_text)||void 0}};function ke(){const N=ye==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return te?N.top="calc(100vh - 100px)":N.bottom="20px",N}const Le=(()=>{if(de&&p)return{position:"fixed",left:`${Math.round(p.left)}px`,top:`${Math.round(p.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const N=ke();return de&&(N.touchAction="none"),N})();Qe(()=>{de||(v(null),C(!1),x.current=null,B.current=!1,O.current&&(cancelAnimationFrame(O.current),O.current=null))},[de]);function gt(N,q,Z){return Math.max(q,Math.min(Z,N))}function bt(N){var Qt;if(!de)return;const q=N.currentTarget;if(!q)return;const Z=N.target;if((Qt=Z==null?void 0:Z.closest)==null?void 0:Qt.call(Z,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;x.current=N.pointerId;const qe=q.getBoundingClientRect();k.current=N.clientX,S.current=N.clientY,w.current=qe.left,E.current=qe.top,A.current={width:qe.width,height:qe.height},B.current=!1,v({left:qe.left,top:qe.top})}function Fi(N){var mn;if(!de||x.current!==N.pointerId)return;const q=N.clientX-k.current,Z=N.clientY-S.current;if(!b){if(Math.hypot(q,Z)<L)return;const gn=N.currentTarget;try{(mn=gn==null?void 0:gn.setPointerCapture)==null||mn.call(gn,N.pointerId)}catch{}C(!0),B.current=!0,p||v({left:w.current,top:E.current})}const Se=8,qe=Se,Qt=Se,pn=Math.max(Se,window.innerWidth-A.current.width-Se),Vi=Math.max(Se,window.innerHeight-A.current.height-Se),Et={left:gt(w.current+q,qe,pn),top:gt(E.current+Z,Qt,Vi)};if(O.current==null){const Gi=Et;O.current=requestAnimationFrame(()=>{v(Gi),O.current=null})}else v(Et)}function ai(N){var q,Z;if(x.current!==null)try{(Z=(q=N.currentTarget)==null?void 0:q.releasePointerCapture)==null||Z.call(q,x.current)}catch{}x.current=null,C(!1)}function ne(N){de&&x.current===N.pointerId&&ai(N)}function je(N){de&&x.current===N.pointerId&&ai(N)}const We=()=>{const N=R.client;if(!N)return;const q=N.plans||[];if(q.length===1){const[Z]=q;N.selectedPlanUuid!==Z.uuid&&(N.selectPlan(Z),ii().track("course-get-started",{courseName:Z.name,courseUuid:Z.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(qw,{open:e,courses:R.client.plans.map((N,q)=>{var Z,Se;return{id:N.uuid,name:N.name,description:N.description||"",duration:N.duration||0,completed:((Se=(Z=R.client)==null?void 0:Z.planIsCompleted)==null?void 0:Se[q])||!1}}),loading:!1,title:((Er=R.client.product)==null?void 0:Er.assistant_subtitle)||void 0,productName:((_a=R.client.product)==null?void 0:_a.name)||"",onCourseHighlight:N=>{N&&ii().track("course-selected",{courseName:N.name,courseUuid:N.id})},onCourseSelect:N=>{const q=R.client.plans.find(Z=>Z.uuid===N.id)||null;q&&(q==null?void 0:q.uuid)!==R.client.selectedPlanUuid&&(R.client.selectPlan(q),t(!1),r(!0),ii().track("course-get-started",{courseName:N.name,courseUuid:N.id}))},onClose:N=>{N==="user-initiated"&&R.client.selectPlan(null),t(!1)}}),Fe&&g(nt,{children:[g("div",{className:de?`obi-widget-draggable${b?" dragging":""}`:void 0,style:Le,onPointerDown:bt,onPointerMove:Fi,onPointerUp:ne,onPointerCancel:je,onClickCapture:N=>{var q,Z;B.current&&((q=N.preventDefault)==null||q.call(N),(Z=N.stopPropagation)==null||Z.call(N),B.current=!1)},children:g(rw,{inPlan:de,isActive:i?!1:l?!0:void 0,defaultIsActive:K!=="minimized",isPaused:oe,toastMessage:o,messaging:(W==null?void 0:W.isMicShared)===!1||s?!0:void 0,speakingStatus:ge,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,courseProgress:f,onOpen:We,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var N;(N=R.client.session)==null||N.stop()},onCancelReason:(N,q)=>{},onPause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.pause)==null||q.call(N)},onUnpause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.unpause)==null||q.call(N)},onMessagingChange:N=>{var q,Z,Se,qe;a(!1),N?(Z=(q=R.client.session)==null?void 0:q.muteMicrophone)==null||Z.call(q):(qe=(Se=R.client.session)==null?void 0:Se.unmuteMicrophone)==null||qe.call(Se)},onMessageChange:N=>{ii().track("chat-input-provided",{message:N,length:N.length})},onMessage:N=>{R.say(N),a(!1),ii().track("chat-message-sent",{message:N,length:N.length})},onHover:N=>{},onOneClickAction:N=>{a(!1)},onMinimize:()=>{},agentName:((ji=R.client.product)==null?void 0:ji.agent_name)||"Obi",completedTutorials:((Vn=R.client.product)==null?void 0:Vn.widget_show_progress)===!1?void 0:R.client.planIsCompleted.filter(Boolean).length,totalTutorials:((fn=R.client.product)==null?void 0:fn.widget_show_progress)===!1?void 0:R.client.plans.length})}),!!R.client.selectedPlan&&g($w,{open:!0,session:$(),sessionState:(W==null?void 0:W.state)||null,speakingState:(W==null?void 0:W.speakingState)||null,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,onModalChange:N=>{},onClose:(N,q)=>{var Z,Se;N==="user-initiated"&&(((Z=R.client.session)==null?void 0:Z.state)==="mic-share"?(Se=R.client.session)==null||Se.shareMicrophoneFailed():R.client.stopSession()),r(!1)},onStart:()=>{R.client.selectedPlanUuid&&R.startSession()},onContinue:()=>{W==null||W.continue()},onShareMicrophone:()=>{W==null||W.shareMicrophone()}})]})]})}function s_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(null),u=Be(s);Qe(()=>{u.current=s},[s]);const d=h=>{var f;(f=u.current)==null||f.call(u,h)};return Qe(()=>{const h=m=>{e(m)};n.on("showMenu",h);const f=()=>{o(m=>m+1)};return n.on("configUpdated",f),n.on("showMessage",d),()=>{var m,p,v;(m=n.off)==null||m.call(n,"showMenu",h),(p=n.off)==null||p.call(n,"configUpdated",f),(v=n.off)==null||v.call(n,"showMessage",d)}},[n]),Qe(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",h=>{l(h),r==null||r(!1),o(f=>f+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(h=>h+1)}),n.client.on("sessionShutdown",()=>{o(h=>h+1)}),n.client.on("sessionResumed",()=>{o(h=>h+1)}),n.client.on("stateChanged",()=>{var h;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((h=n.client.product)==null?void 0:h.primary_color)||"#9500FF"),o(f=>f+1)}),n.client.on("planSelected",()=>{o(h=>h+1)}))},[n,n.client]),Qe(()=>{if(!c)return;c.on("stateChanged",()=>{o(f=>f+1)}),c.on("speakingStateChanged",()=>{o(f=>f+1)}),c.on("paused",()=>{o(f=>f+1)}),c.on("unpaused",()=>{o(f=>f+1)}),c.on("micCheckComplete",f=>{}),c.on("transcript",(f,m)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(f=>f+1)});const h=f=>{i(f)};return c.on&&c.on("courseProgress",h),()=>{c.off&&c.off("courseProgress",h),c.off&&c.off("textInputRequested")}},[c]),n}function a_(n){const[e,t]=Y(()=>Ta(n));return Qe(()=>{t(Ta(n))},[n]),Qe(()=>{o_();const i=()=>{t(Ta(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 o_(){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 c_(n){if(document.querySelector("obi-widget"))return;l_();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(i_),t.adoptedStyleSheets=[r],k1(g(r_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function l_(){Em("https://fonts.cdnfonts.com/css/satoshi"),Em("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Em(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Rm="49206C6F7665204F6269_session",Pm="obi-url-params";class u_ extends Pa{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,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()}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=sa.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 sa(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,m;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)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),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()})})}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&Ta(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}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");try{this._maybeActOnServerEngagement()}catch{}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");try{this._maybeActOnServerEngagement()}catch{}}).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");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().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(Pm)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Rm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Rm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Pm),this.passivePlanUuid=t}mountWidget(){c_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Lx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await n_(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 ET(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")}}async function Im(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return d_({appToken:n,window:t,init:e})}async function d_({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 u_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Om(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Im(void 0,Om)}):Im(void 0,Om)})();
|
|
56
|
+
`;function r_(n){var xt,hn,_t,Jt,oi,_r,Er,_a,ji,Vn,fn;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(null),[l,u]=Y(!1),[d,h]=Y(null),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(!1),x=Be(null),k=Be(0),S=Be(0),w=Be(0),E=Be(0),A=Be({width:0,height:0}),O=Be(null),B=Be(!1),L=6,R=s_(n.sdk,H,n.shadowHost,m,a,N=>{if(!N){c(null);return}if(Fe&&(c(N),!de&&K==="minimized")){u(!0);const q=Math.max(0,N.autoCloseMs??3e3);d&&window.clearTimeout(d);const Z=window.setTimeout(()=>u(!1),q);h(Z)}});function H(N){var q;(q=R.client)!=null&&q.session||(N?We():t(!1))}if(!R.client)return null;const Q=R.client.planIsCompleted.filter(Boolean).length===R.client.plans.length,X=a_((xt=R.client.product)==null?void 0:xt.widget_url_blacklist),K=Q?R.completedWidgetDisplay||((hn=R.client.product)==null?void 0:hn.completed_widget_display):R.widgetDisplay||((_t=R.client.product)==null?void 0:_t.widget_display),ye=R.widgetPosition||((Jt=R.client.product)==null?void 0:Jt.widget_position);let Te=R.isActive;((_r=(oi=R.client)==null?void 0:oi.product)==null?void 0:_r.name)==="Canibuild"&&(Te=!0);const W=R.client.session,de=!!W,te=de&&!e;let ge;switch(W==null?void 0:W.speakingState){case"listening":ge="user-speaking";break;case"speaking":ge="agent-speaking";break;case"thinking":ge="thinking";break;case"busy":ge="busy";break}const oe=W==null?void 0:W.isPaused,Fe=de||R.client.state==="ready"&&Te&&!X&&(K!=="invisible"||R.client.selectedPlan),$=()=>{var N,q,Z,Se,qe,Qt,pn;return{name:(N=R.client.selectedPlan)==null?void 0:N.name,description:(q=R.client.selectedPlan)==null?void 0:q.description,appName:(Z=R.client.product)==null?void 0:Z.name,appLogoUrl:((Se=R.client.product)==null?void 0:Se.logo_url)||"",url:(qe=R.client.product)==null?void 0:qe.url,agentName:((Qt=R.client.product)==null?void 0:Qt.agent_name)||"Obi",legalFooter:((pn=R.client.product)==null?void 0:pn.legal_footer_text)||void 0}};function ke(){const N=ye==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return te?N.top="calc(100vh - 100px)":N.bottom="20px",N}const Le=(()=>{if(de&&p)return{position:"fixed",left:`${Math.round(p.left)}px`,top:`${Math.round(p.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const N=ke();return de&&(N.touchAction="none"),N})();Qe(()=>{de||(v(null),C(!1),x.current=null,B.current=!1,O.current&&(cancelAnimationFrame(O.current),O.current=null))},[de]);function gt(N,q,Z){return Math.max(q,Math.min(Z,N))}function bt(N){var Qt;if(!de)return;const q=N.currentTarget;if(!q)return;const Z=N.target;if((Qt=Z==null?void 0:Z.closest)==null?void 0:Qt.call(Z,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;x.current=N.pointerId;const qe=q.getBoundingClientRect();k.current=N.clientX,S.current=N.clientY,w.current=qe.left,E.current=qe.top,A.current={width:qe.width,height:qe.height},B.current=!1,v({left:qe.left,top:qe.top})}function Fi(N){var mn;if(!de||x.current!==N.pointerId)return;const q=N.clientX-k.current,Z=N.clientY-S.current;if(!b){if(Math.hypot(q,Z)<L)return;const gn=N.currentTarget;try{(mn=gn==null?void 0:gn.setPointerCapture)==null||mn.call(gn,N.pointerId)}catch{}C(!0),B.current=!0,p||v({left:w.current,top:E.current})}const Se=8,qe=Se,Qt=Se,pn=Math.max(Se,window.innerWidth-A.current.width-Se),Vi=Math.max(Se,window.innerHeight-A.current.height-Se),Et={left:gt(w.current+q,qe,pn),top:gt(E.current+Z,Qt,Vi)};if(O.current==null){const Gi=Et;O.current=requestAnimationFrame(()=>{v(Gi),O.current=null})}else v(Et)}function ai(N){var q,Z;if(x.current!==null)try{(Z=(q=N.currentTarget)==null?void 0:q.releasePointerCapture)==null||Z.call(q,x.current)}catch{}x.current=null,C(!1)}function ne(N){de&&x.current===N.pointerId&&ai(N)}function je(N){de&&x.current===N.pointerId&&ai(N)}const We=()=>{const N=R.client;if(!N)return;const q=N.plans||[];if(q.length===1){const[Z]=q;N.selectedPlanUuid!==Z.uuid&&(N.selectPlan(Z),ii().track("course-get-started",{courseName:Z.name,courseUuid:Z.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(qw,{open:e,courses:R.client.plans.map((N,q)=>{var Z,Se;return{id:N.uuid,name:N.name,description:N.description||"",duration:N.duration||0,completed:((Se=(Z=R.client)==null?void 0:Z.planIsCompleted)==null?void 0:Se[q])||!1}}),loading:!1,title:((Er=R.client.product)==null?void 0:Er.assistant_subtitle)||void 0,productName:((_a=R.client.product)==null?void 0:_a.name)||"",onCourseHighlight:N=>{N&&ii().track("course-selected",{courseName:N.name,courseUuid:N.id})},onCourseSelect:N=>{const q=R.client.plans.find(Z=>Z.uuid===N.id)||null;q&&(q==null?void 0:q.uuid)!==R.client.selectedPlanUuid&&(R.client.selectPlan(q),t(!1),r(!0),ii().track("course-get-started",{courseName:N.name,courseUuid:N.id}))},onClose:N=>{N==="user-initiated"&&R.client.selectPlan(null),t(!1)}}),Fe&&g(nt,{children:[g("div",{className:de?`obi-widget-draggable${b?" dragging":""}`:void 0,style:Le,onPointerDown:bt,onPointerMove:Fi,onPointerUp:ne,onPointerCancel:je,onClickCapture:N=>{var q,Z;B.current&&((q=N.preventDefault)==null||q.call(N),(Z=N.stopPropagation)==null||Z.call(N),B.current=!1)},children:g(rw,{inPlan:de,isActive:i?!1:l?!0:void 0,defaultIsActive:K!=="minimized",isPaused:oe,toastMessage:o,messaging:(W==null?void 0:W.isMicShared)===!1||s?!0:void 0,speakingStatus:ge,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,courseProgress:f,onOpen:We,onCancelClick:()=>{},onCancelAbort:()=>{},onCancel:()=>{var N;(N=R.client.session)==null||N.stop()},onCancelReason:(N,q)=>{},onPause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.pause)==null||q.call(N)},onUnpause:()=>{var N,q;(q=(N=R.client.session)==null?void 0:N.unpause)==null||q.call(N)},onMessagingChange:N=>{var q,Z,Se,qe;a(!1),N?(Z=(q=R.client.session)==null?void 0:q.muteMicrophone)==null||Z.call(q):(qe=(Se=R.client.session)==null?void 0:Se.unmuteMicrophone)==null||qe.call(Se)},onMessageChange:N=>{ii().track("chat-input-provided",{message:N,length:N.length})},onMessage:N=>{R.say(N),a(!1),ii().track("chat-message-sent",{message:N,length:N.length})},onHover:N=>{},onOneClickAction:N=>{a(!1)},onMinimize:()=>{},agentName:((ji=R.client.product)==null?void 0:ji.agent_name)||"Obi",completedTutorials:((Vn=R.client.product)==null?void 0:Vn.widget_show_progress)===!1?void 0:R.client.planIsCompleted.filter(Boolean).length,totalTutorials:((fn=R.client.product)==null?void 0:fn.widget_show_progress)===!1?void 0:R.client.plans.length})}),!!R.client.selectedPlan&&g($w,{open:!0,session:$(),sessionState:(W==null?void 0:W.state)||null,speakingState:(W==null?void 0:W.speakingState)||null,spectrum:()=>(W==null?void 0:W.audioSpectrum())||null,onModalChange:N=>{},onClose:(N,q)=>{var Z,Se;N==="user-initiated"&&(((Z=R.client.session)==null?void 0:Z.state)==="mic-share"?(Se=R.client.session)==null||Se.shareMicrophoneFailed():R.client.stopSession()),r(!1)},onStart:()=>{R.client.selectedPlanUuid&&R.startSession()},onContinue:()=>{W==null||W.continue()},onShareMicrophone:()=>{W==null||W.shareMicrophone()}})]})]})}function s_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(null),u=Be(s);Qe(()=>{u.current=s},[s]);const d=h=>{var f;(f=u.current)==null||f.call(u,h)};return Qe(()=>{const h=m=>{e(m)};n.on("showMenu",h);const f=()=>{o(m=>m+1)};return n.on("configUpdated",f),n.on("showMessage",d),()=>{var m,p,v;(m=n.off)==null||m.call(n,"showMenu",h),(p=n.off)==null||p.call(n,"configUpdated",f),(v=n.off)==null||v.call(n,"showMessage",d)}},[n]),Qe(()=>{n.client&&(n.client.session&&l(n.client.session),n.client.on("sessionStarted",h=>{l(h),r==null||r(!1),o(f=>f+1)}),n.client.on("sessionStopped",()=>{l(null),r==null||r(!1),o(h=>h+1)}),n.client.on("sessionShutdown",()=>{o(h=>h+1)}),n.client.on("sessionResumed",()=>{o(h=>h+1)}),n.client.on("stateChanged",()=>{var h;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((h=n.client.product)==null?void 0:h.primary_color)||"#9500FF"),o(f=>f+1)}),n.client.on("planSelected",()=>{o(h=>h+1)}))},[n,n.client]),Qe(()=>{if(!c)return;c.on("stateChanged",()=>{o(f=>f+1)}),c.on("speakingStateChanged",()=>{o(f=>f+1)}),c.on("paused",()=>{o(f=>f+1)}),c.on("unpaused",()=>{o(f=>f+1)}),c.on("micCheckComplete",f=>{}),c.on("transcript",(f,m)=>{}),c.on&&c.on("textInputRequested",()=>{r==null||r(!0),o(f=>f+1)});const h=f=>{i(f)};return c.on&&c.on("courseProgress",h),()=>{c.off&&c.off("courseProgress",h),c.off&&c.off("textInputRequested")}},[c]),n}function a_(n){const[e,t]=Y(()=>Ta(n));return Qe(()=>{t(Ta(n))},[n]),Qe(()=>{o_();const i=()=>{t(Ta(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 o_(){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 c_(n){if(document.querySelector("obi-widget"))return;l_();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(i_),t.adoptedStyleSheets=[r],k1(g(r_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function l_(){Em("https://fonts.cdnfonts.com/css/satoshi"),Em("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Em(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Rm="49206C6F7665204F6269_session",Pm="obi-url-params";class u_ extends Pa{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,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()}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=sa.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 sa(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,m;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)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),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()})})}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&Ta(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}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");try{this._maybeActOnServerEngagement()}catch{}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");try{this._maybeActOnServerEngagement()}catch{}}).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");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().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(Pm)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Rm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Rm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Pm),this.passivePlanUuid=t}mountWidget(){c_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Lx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await n_(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 ET(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")}}async function Im(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return d_({appToken:n,window:t,init:e})}async function d_({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 u_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Om(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Im(void 0,Om)}):Im(void 0,Om)})();
|