@tavus/widget 0.1.6 → 0.1.7

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.
@@ -47,7 +47,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
47
47
  pointer-events: none;
48
48
  `,document.body.appendChild(n),t.layout||=`custom-v1`,e.wrap(n,t)}},{key:`getCallInstance`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return e?cm[e]:Object.values(cm)[0]}}]);var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,ee,te,ne,re,ie,ae,oe,se,ce,le,ue,de,fe,pe}();function wm(e){if(e.extension){if(typeof e.extension!=`string`)throw Error(`Error starting dial out: extension must be a string`);if(e.extension.length>20)throw Error(`Error starting dial out: extension length must be less than or equal to 20`)}if(e.waitBeforeExtensionDialSec){if(typeof e.waitBeforeExtensionDialSec!=`number`)throw Error(`Error starting dial out: waitBeforeExtensionDialSec must be a number`);if(e.waitBeforeExtensionDialSec>60)throw Error(`Error starting dial out: waitBeforeExtensionDialSec must be less than or equal to 60`);if(!e.extension)throw Error(`Error starting dial out: waitBeforeExtensionDialSec requires a phoneNumber and extension`)}}function Tm(e,t){var n={};for(var r in e)if(e[r]instanceof MediaStreamTrack)console.warn(`MediaStreamTrack found in props or cache.`,r),n[r]=Tf;else if(r===`dailyConfig`){if(e[r].modifyLocalSdpHook){var i=window._daily.instances[t].customCallbacks||{};i.modifyLocalSdpHook=e[r].modifyLocalSdpHook,window._daily.instances[t].customCallbacks=i,delete e[r].modifyLocalSdpHook}if(e[r].modifyRemoteSdpHook){var a=window._daily.instances[t].customCallbacks||{};a.modifyRemoteSdpHook=e[r].modifyRemoteSdpHook,window._daily.instances[t].customCallbacks=a,delete e[r].modifyRemoteSdpHook}n[r]=e[r]}else n[r]=e[r];return n}function Em(e){var t=arguments.length>2?arguments[2]:void 0;if(e!==`joined-meeting`){var n=`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:`This daily-js method`} only supported after join.`;throw t&&(n+=` ${t}`),console.error(n),Error(n)}}function Dm(e,t){return[`joining-meeting`,`joined-meeting`].includes(e)||t}function Om(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`This daily-js method`,r=arguments.length>3?arguments[3]:void 0;if(Dm(e,t)){var i=`${n} not supported after joining a meeting.`;throw r&&(i+=` ${r}`),console.error(i),Error(i)}}function km(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`This daily-js method`,n=arguments.length>2?arguments[2]:void 0;if(!e){var r=`${t}${arguments.length>3&&arguments[3]!==void 0&&arguments[3]?` requires preAuth() or startCamera() to initialize call state.`:` requires preAuth(), startCamera(), or join() to initialize call state.`}`;throw n&&(r+=` ${n}`),console.error(r),Error(r)}}function Am(e){if(e){var t=`A pre-call quality test is in progress. Please try ${arguments.length>1&&arguments[1]!==void 0?arguments[1]:`This daily-js method`} again once testing has completed. Use stopTestCallQuality() to end it early.`;throw console.error(t),Error(t)}}function jm(e){if(!e){var t=`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:`This daily-js method`} is only supported on custom callObject instances`;throw console.error(t),Error(t)}}function Mm(e){if(e){var t=`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:`This daily-js method`} is only supported as part of Daily's Prebuilt`;throw console.error(t),Error(t)}}function U(){if(V())throw Error(`This daily-js method is not currently supported in React Native`)}function Nm(){if(!V())throw Error(`This daily-js method is only supported in React Native`)}function Pm(e){if(e===void 0)return!0;var t;if(typeof e==`string`)t=e;else try{t=JSON.stringify(e),Io(JSON.parse(t),e)||console.warn(`The userData provided will be modified when serialized.`)}catch(e){throw Error(`userData must be serializable to JSON: ${e}`)}if(t.length>4096)throw Error(`userData is too large (${t.length} characters). Maximum size suppported is 4096.`);return!0}function Fm(e,t){for(var n=t.allowAllParticipantsKey,r=function(e){var t=[`local`];return n||t.push(`*`),e&&!t.includes(e)},i=function(e){return!!(e.layer===void 0||Number.isInteger(e.layer)&&e.layer>=0||e.layer===`inherit`)},a=function(e){return!!e&&!(e.video&&!i(e.video))&&!(e.screenVideo&&!i(e.screenVideo))},o=0,s=Object.entries(e);o<s.length;o++){var c=Oo(s[o],2),l=c[0],u=c[1];if(!r(l)||!a(u))return!1}return!0}function Im(e){if(L(e)!==`object`)return!1;for(var t=0,n=Object.entries(e);t<n.length;t++){var r=Oo(n[t],2),i=r[0],a=r[1];switch(i){case`video`:if(L(a)!==`object`)return!1;for(var o=0,s=Object.entries(a);o<s.length;o++){var c=Oo(s[o],2),l=c[0],u=c[1];switch(l){case`processor`:if(!zm(u))return!1;break;case`settings`:if(!Bm(u))return!1;break;default:return!1}}break;case`audio`:if(L(a)!==`object`)return!1;for(var d=0,f=Object.entries(a);d<f.length;d++){var p=Oo(f[d],2),m=p[0],h=p[1];switch(m){case`processor`:if(!Rm(h))return!1;break;case`settings`:if(!Bm(h))return!1;break;default:return!1}}break;default:return!1}}return!0}function Lm(e,t,n){var r,i=[];e.video&&e.video.processor&&(Vf((r=t?.useLegacyVideoProcessor)!=null&&r)||(e.video.settings?delete e.video.processor:delete e.video,i.push(`video`))),e.audio&&e.audio.processor&&(Hf()||(e.audio.settings?delete e.audio.processor:delete e.audio,i.push(`audio`))),i.length>0&&console.error(`Ignoring settings for browser- or platform-unsupported input processor(s): ${i.join(`, `)}`),e.audio&&e.audio.settings&&(e.audio.settings.customTrack?(n.audioTrack=e.audio.settings.customTrack,e.audio.settings={customTrack:Tf}):delete n.audioTrack),e.video&&e.video.settings&&(e.video.settings.customTrack?(n.videoTrack=e.video.settings.customTrack,e.video.settings={customTrack:Tf}):delete n.videoTrack)}function Rm(e){if(V())return console.warn(`Video processing is not yet supported in React Native`),!1;var t=[`type`];return!!e&&L(e)===`object`&&(Object.keys(e).filter((function(e){return!t.includes(e)})).forEach((function(t){console.warn(`invalid key inputSettings -> audio -> processor : ${t}`),delete e[t]})),!!function(e){return typeof e==`string`?Object.values(Df).includes(e)?!0:(console.error(`inputSettings audio processor type invalid`),!1):!1}(e.type))}function zm(e){if(V())return console.warn(`Video processing is not yet supported in React Native`),!1;var t=[`type`,`config`];return!e||L(e)!==`object`||!function(e){return typeof e==`string`?Object.values(Ef).includes(e)?!0:(console.error(`inputSettings video processor type invalid`),!1):!1}(e.type)||e.config&&(L(e.config)!==`object`||!function(e,t){var n=Object.keys(t);if(n.length===0)return!0;var r=`invalid object in inputSettings -> video -> processor -> config`;switch(e){case Ef.BGBLUR:return n.length>1||n[0]!==`strength`?(console.error(r),!1):!(typeof t.strength!=`number`||t.strength<=0||t.strength>1||isNaN(t.strength))||(console.error(`${r}; expected: {0 < strength <= 1}, got: ${t.strength}`),!1);case Ef.BGIMAGE:return!(t.source!==void 0&&!function(e){if(e.source==="default")return e.type=`default`,!0;if(e.source instanceof ArrayBuffer)return!0;if($o(e.source))return e.type=`url`,!!function(e){var t=new URL(e),n=t.pathname;if(t.protocol===`data:`)try{var r=n.substring(n.indexOf(`:`)+1,n.indexOf(`;`)).split(`/`)[1];return kf.includes(r)}catch(e){return console.error(`failed to deduce blob content type`,e),!1}var i=n.split(`.`).at(-1).toLowerCase().trim();return kf.includes(i)}(e.source)||(console.error(`invalid image type; supported types: [${kf.join(`, `)}]`),!1);return t=e.source,n=Number(t),isNaN(n)||!Number.isInteger(n)||n<=0||n>10?(console.error(`invalid image selection; must be an int, > 0, <= 10`),!1):(e.type=`daily-preselect`,!0);var t,n}(t));default:return!0}}(e.type,e.config))?!1:(Object.keys(e).filter((function(e){return!t.includes(e)})).forEach((function(t){console.warn(`invalid key inputSettings -> video -> processor : ${t}`),delete e[t]})),!0)}function Bm(e){return L(e)===`object`&&(!e.customTrack||e.customTrack instanceof MediaStreamTrack)}function Vm(){return`inputSettings must be of the form: { video?: { processor?: { type: [ ${Object.values(Ef).join(` | `)} ], config?: {} } }, audio?: { processor: {type: [ ${Object.values(Df).join(` | `)} ] } } }`}function Hm(e){return`receiveSettings must be of the form { [<remote participant id> | ${yd}${e.allowAllParticipantsKey?` | "*"`:``}]: { [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}`}function Um(){return`customIntegrations should be an object of type ${JSON.stringify(vm)}.`}function Wm(e){if(e&&L(e)!==`object`||Array.isArray(e))return console.error(`customTrayButtons should be an Object of the type ${JSON.stringify(_m)}.`),!1;if(e)for(var t=0,n=Object.entries(e);t<n.length;t++)for(var r=Oo(n[t],1)[0],i=0,a=Object.entries(e[r]);i<a.length;i++){var o=Oo(a[i],2),s=o[0],c=o[1],l=_m.id[s];if(!l)return console.error(`customTrayButton does not support key ${s}`),!1;switch(s){case`iconPath`:case`iconPathDarkMode`:if(!$o(c))return console.error(`customTrayButton ${s} should be a url.`),!1;break;case`visualState`:if(![`default`,`sidebar-open`,`active`].includes(c))return console.error(`customTrayButton ${s} should be ${l}. Got: ${c}`),!1;break;default:if(L(c)!==l)return console.error(`customTrayButton ${s} should be a ${l}.`),!1}}return!0}function Gm(e){if(!e||e&&L(e)!==`object`||Array.isArray(e))return console.error(Um()),!1;for(var t=function(e){return`${e} should be ${vm.id[e]}`},n=function(e,t){return console.error(`customIntegration ${e}: ${t}`)},r=0,i=Object.entries(e);r<i.length;r++){var a=Oo(i[r],1)[0];if(!(`label`in e[a]))return n(a,`label is required`),!1;if(!(`location`in e[a]))return n(a,`location is required`),!1;if(!(`src`in e[a])&&!(`srcdoc`in e[a]))return n(a,`src or srcdoc is required`),!1;for(var o=0,s=Object.entries(e[a]);o<s.length;o++){var c=Oo(s[o],2),l=c[0],u=c[1];switch(l){case`allow`:case`csp`:case`name`:case`referrerPolicy`:case`sandbox`:if(typeof u!=`string`)return n(a,t(l)),!1;break;case`iconURL`:if(!$o(u))return n(a,`${l} should be a url`),!1;break;case`src`:if(`srcdoc`in e[a])return n(a,`cannot have both src and srcdoc`),!1;if(!$o(u))return n(a,`src "${u}" is not a valid URL`),!1;break;case`srcdoc`:if(`src`in e[a])return n(a,`cannot have both src and srcdoc`),!1;if(typeof u!=`string`)return n(a,t(l)),!1;break;case`location`:if(![`main`,`sidebar`].includes(u))return n(a,t(l)),!1;break;case`controlledBy`:if(u!==`*`&&u!==`owners`&&(!Array.isArray(u)||u.some((function(e){return typeof e!=`string`}))))return n(a,t(l)),!1;break;case`shared`:if((!Array.isArray(u)||u.some((function(e){return typeof e!=`string`})))&&u!==`owners`&&typeof u!=`boolean`)return n(a,t(l)),!1;break;default:if(!vm.id[l])return console.error(`customIntegration does not support key ${l}`),!1}}}return!0}function Km(e,t){if(t===void 0)return!1;switch(L(t)){case`string`:return L(e)===t;case`object`:if(L(e)!==`object`)return!1;for(var n in e)if(!Km(e[n],t[n]))return!1;return!0;default:return!1}}function qm(e,t){var n=e.sessionId,r=e.toEndPoint,i=e.callerId,a=e.useSipRefer;if(!n||!r)throw Error(`${t}() requires a sessionId and toEndPoint`);if(typeof n!=`string`||typeof r!=`string`)throw Error(`Invalid paramater: sessionId and toEndPoint must be of type string`);if(a&&!r.startsWith(`sip:`))throw Error(`"toEndPoint" must be a "sip" address`);if(!r.startsWith(`sip:`)&&!r.startsWith(`+`))throw Error(`toEndPoint: ${r} must starts with either "sip:" or "+"`);if(i&&typeof i!=`string`)throw Error(`callerId must be of type string`);if(i&&!r.startsWith(`+`))throw Error(`callerId is only valid when transferring to a PSTN number`)}function Jm(e){if(L(e)!==`object`)throw Error(`RemoteMediaPlayerSettings: must be "object" type`);if(e.state&&!Object.values(Of).includes(e.state))throw Error(`Invalid value for RemoteMediaPlayerSettings.state, valid values are: `+JSON.stringify(Of));if(e.volume){if(typeof e.volume!=`number`)throw Error(`RemoteMediaPlayerSettings.volume: must be "number" type`);if(e.volume<0||e.volume>2)throw Error(`RemoteMediaPlayerSettings.volume: must be between 0.0 - 2.0`)}}function Ym(e,t,n){return!(typeof e!=`number`||e<t||e>n)}function Xm(e,t){return e&&!t&&delete e.data,e}function Zm(e){"@babel/helpers - typeof";return Zm=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Zm(e)}var W=function(){return W=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},W.apply(this,arguments)};function Qm(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function $m(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function eh(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function th(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function nh(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function rh(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ih=Ie(null),ah=function(){var e=pt(ih);return mt(e),e},oh=Ie({on:function(){},off:function(){}}),sh=-1,ch=function(){return sh--},lh=1,uh=function(){return lh++},G=function(e,t,n){n===void 0&&(n=!1);var r=pt(oh),i=r.off,a=r.on,o=nh(T(!1),2),s=o[0],c=o[1],l=D(0),u=O(function(){return n?ch():uh()},[n]);E(function(){if(!(!e||s)){if(l.current>1e5){console.error(`useDailyEvent called with potentially non-memoized event callback or due to too many re-renders.
49
49
  Memoize using useCallback to avoid re-render loop or reduce the amount of state transitions the callback depends on.
50
- Passed callback for '${e}' event is NOT registered.`,t),c(!0);return}l.current++;var n=setTimeout(function(){l.current=0},50);return a(e,t,u),function(){clearTimeout(n),i(e,u)}}},[t,e,u,s,i,a]),mt({event:e,eventId:u,isBlocked:s,callback:t})};function dh(e,t){var n,r;if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!dh(e[i],t[i]))return!1;return!0}if(MediaStream&&e instanceof MediaStream&&t instanceof MediaStream)return e.id===t.id&&e.active===t.active&&e.getTracks().length===t.getTracks().length&&e.getTracks().every(function(e,n){return dh(e,t.getTracks()[n])});if(MediaStreamTrack&&e instanceof MediaStreamTrack&&t instanceof MediaStreamTrack)return e.id===t.id&&e.kind===t.kind&&e.readyState===t.readyState;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;var a=Array.from(e).sort(),o=Array.from(t).sort();return a.every(function(e,t){return dh(e,o[t])})}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;try{for(var s=th(e.entries()),c=s.next();!c.done;c=s.next()){var l=nh(c.value,2),u=l[0],d=l[1];if(!t.has(u)||!dh(d,t.get(u)))return!1}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!0}if(Zm(e)!==`object`||e===null||Zm(t)!==`object`||t===null)return!1;var f=Object.keys(e),p=Object.keys(t);if(f.length!==p.length)return!1;for(var i=0;i<f.length;i++){var u=f[i];if(!Object.prototype.hasOwnProperty.call(t,u)||!dh(e[u],t[u]))return!1}return!0}function fh(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n],a=r!==null&&Zm(r)===`object`,o=i!==null&&Zm(i)===`object`;if(a||o){if(!dh(r,i))return!1}else if(r!==i)return!1}return!0}function ph(e){return`daily-react-`+e}function mh(e){var t=new Map,n=new Map;return function(r){if(!t.has(r)){var i=N(function(t){var i=e.get(r)(t),a=n.get(r);return a!=null&&e.equals(i,a)?a:(n.set(r,i),i)});t.set(r,i)}return t.get(r)}}var hh=`::`,gh=`;`,_h=function(e,t){return e+hh+t},vh=function(e,t){return e+hh+t.join(gh)},yh=function(e,t){return xh(_h(e,t))},bh=ca(function(e){var t=N([]);return t.debugLabel=ph(`participant-property-paths-${e}`),t}),xh=ca(function(e){var t=N(null);return t.debugLabel=ph(`participant-property-${e}`),t}),Sh=mh({equals:fh,get:function(e){return function(t){var n=nh(e.split(hh),2),r=n[0];return n[1].split(gh).map(function(e){return t(yh(r,e))})}}}),Ch=function(e,t){var n,r=mo(Array.isArray(t)?Sh(vh(e,t)):xh(_h(e,t)));return mt(Array.isArray(t)?t.reduce(function(e,t,n){return e[t]=r[n],e},{}):(n={},n[t]=r,n)),r},wh=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function Th(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Eh,Dh;function Oh(){if(Dh)return Eh;Dh=1;var e=`Expected a function`,t=NaN,n=`[object Symbol]`,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=Zm(wh)==`object`&&wh&&wh.Object===Object&&wh,l=(typeof self>`u`?`undefined`:Zm(self))==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype.toString,f=Math.max,p=Math.min,m=function(){return u.Date.now()};function h(t,n,r){var i,a,o,s,c,l,u=0,d=!1,h=!1,g=!0;if(typeof t!=`function`)throw TypeError(e);n=b(n)||0,_(r)&&(d=!!r.leading,h=`maxWait`in r,o=h?f(b(r.maxWait)||0,n):o,g=`trailing`in r?!!r.trailing:g);function v(e){var n=i,r=a;return i=a=void 0,u=e,s=t.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,n),d?v(e):s}function x(e){var t=e-l,r=e-u,i=n-t;return h?p(i,o-r):i}function S(e){var t=e-l,r=e-u;return l===void 0||t>=n||t<0||h&&r>=o}function C(){var e=m();if(S(e))return w(e);c=setTimeout(C,x(e))}function w(e){return c=void 0,g&&i?v(e):(i=a=void 0,s)}function ee(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function te(){return c===void 0?s:w(m())}function ne(){var e=m(),t=S(e);if(i=arguments,a=this,l=e,t){if(c===void 0)return y(l);if(h)return c=setTimeout(C,n),v(l)}return c===void 0&&(c=setTimeout(C,n)),s}return ne.cancel=ee,ne.flush=te,ne}function g(t,n,r){var i=!0,a=!0;if(typeof t!=`function`)throw TypeError(e);return _(r)&&(i=`leading`in r?!!r.leading:i,a=`trailing`in r?!!r.trailing:a),h(t,n,{leading:i,maxWait:n,trailing:a})}function _(e){var t=Zm(e);return!!e&&(t==`object`||t==`function`)}function v(e){return!!e&&Zm(e)==`object`}function y(e){return Zm(e)==`symbol`||v(e)&&d.call(e)==n}function b(e){if(typeof e==`number`)return e;if(y(e))return t;if(_(e)){var n=typeof e.valueOf==`function`?e.valueOf():e;e=_(n)?n+``:n}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?t:+e}return Eh=g,Eh}var kh=Th(Oh()),Ah=function(e,t,n,r){n===void 0&&(n=500),r===void 0&&(r=!1);var i=pt(oh),a=i.off,o=i.on,s=O(function(){var t;return Array.isArray(e)?e.reduce(function(e,t){return e[t]=r?ch():uh(),e},{}):(t={},t[e]=r?ch():uh(),t)},[e,r]),c=D([]);G(`call-instance-destroyed`,k(function(){c.current.length=0},[]));var l=O(function(){return kh(function(){c.current.length!==0&&(t(c.current),c.current.length=0)},n,{trailing:!0})},[t,n]);E(function(){if(e){var t=function(e){c.current.push(e),l()};return Array.isArray(e)?e.forEach(function(e){return o(e,t,s[e])}):o(e,t,s[e]),function(){Array.isArray(e)?e.forEach(function(e){return a(e,s[e])}):a(e,s[e])}}},[l,e,s,a,o]),mt({event:e,eventId:s})},jh=function(e,t,n){if(t===void 0&&(t=``),n===void 0&&(n=new Set),Zm(e)!==`object`||e===null||n.has(e))return[t];n.add(e);var r=[];for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=t?`${t}.${i}`:i;r.push.apply(r,rh([a],nh(jh(e[i],a,n)),!1))}return n.delete(e),r},Mh=function(e){return jh(e)},Nh=function(e,t){return String(t).split(`.`).filter(function(e){return e.length}).reduce(function(e,t){return e&&e[t]},e)},Ph=function(e,t){return t.map(function(t){return Nh(e,t)})},Fh=N(null);Fh.debugLabel=ph(`active-id`);var Ih=N(``);Ih.debugLabel=ph(`local-id`);var Lh=N(null);Lh.debugLabel=ph(`local-join-date`);var Rh=N([]);Rh.debugLabel=ph(`participant-ids`);var zh=ca(function(e){var t=N(null);return t.debugLabel=ph(`participant-${e}`),t}),Bh=N([]);Bh.debugLabel=ph(`waiting-participants`);var Vh=ca(function(e){var t=N({awaitingAccess:{level:`full`},id:e,name:``});return t.debugLabel=ph(`waiting-participant-${e}`),t}),Hh=function(e){var t=e.children,n=ah(),r=nh(T(!1),2),i=r[0],a=r[1],o=I(k(function(e,t,n){t(Ih,n.local.session_id);var r=Object.values(n);t(Rh,r.map(function(e){return e.session_id})),r.forEach(function(e){t(zh(e.session_id),e);var n=Mh(e);t(bh(e.session_id),n),n.forEach(function(n){var r=nh(Ph(e,[n]),1)[0];t(yh(e.session_id,n),r)})}),a(!0)},[]));E(function(){if(!(!n||i)){var e=setInterval(function(){var t=n.participants();`local`in t&&(o(t),clearInterval(e))},100);return function(){clearInterval(e)}}},[n,i,o]);var s=k(function(){if(n){var e=n?.participants();e.local&&o(e)}},[n,o]);G(`started-camera`,s,!0),G(`access-state-updated`,s,!0),G(`joining-meeting`,I(k(function(e,t){t(Lh,new Date),s()},[s])),!0),G(`joined-meeting`,k(function(e){o(e.participants)},[o]),!0);var c=I(k(function(e,t){t(Ih,``),t(Fh,null),e(Rh).forEach(function(e){return zh.remove(e)}),t(Rh,[])},[]));return G(`call-instance-destroyed`,c,!0),G(`left-meeting`,c,!0),Ah([`active-speaker-change`,`participant-joined`,`participant-updated`,`participant-left`],I(k(function(e,t,n){n.length&&n.forEach(function(n){switch(n.action){case`active-speaker-change`:t(Fh,n.activeSpeaker.peerId),t(zh(n.activeSpeaker.peerId),function(e){return e?W(W({},e),{last_active:new Date}):null});break;case`participant-joined`:t(Rh,function(e){return e.includes(n.participant.session_id)?e:rh(rh([],nh(e),!1),[n.participant.session_id],!1)}),t(zh(n.participant.session_id),n.participant);var r=Mh(n.participant);t(bh(n.participant.session_id),r),r.forEach(function(e){var r=nh(Ph(n.participant,[e]),1)[0];t(yh(n.participant.session_id,e),r)});break;case`participant-updated`:t(zh(n.participant.session_id),n.participant),n.participant.local&&t(Ih,n.participant.session_id);var r=Mh(n.participant),i=e(bh(n.participant.session_id));(r.length!==i.length||r.some(function(e){return!i.includes(e)}))&&t(bh(n.participant.session_id),r);var a=new Set(i),o=Ph(n.participant,r);r.forEach(function(e,r){var i=o[r];a.delete(e),t(yh(n.participant.session_id,e),function(e){return dh(e,i)?e:i})}),a.forEach(function(e){t(yh(n.participant.session_id,e),null)});break;case`participant-left`:t(Rh,function(e){return e.includes(n.participant.session_id)?e.filter(function(e){return e!==n.participant.session_id}):e}),zh.remove(n.participant.session_id),e(bh(n.participant.session_id)).forEach(function(e){xh.remove(_h(n.participant.session_id,e))}),bh.remove(n.participant.session_id);break}})},[])),100,!0),Ah([`waiting-participant-added`,`waiting-participant-updated`,`waiting-participant-removed`],I(k(function(e,t,n){n.forEach(function(e){switch(e.action){case`waiting-participant-added`:t(Bh,function(t){return t.includes(e.participant.id)?t:rh(rh([],nh(t),!1),[e.participant.id],!1)}),t(Vh(e.participant.id),e.participant);break;case`waiting-participant-updated`:t(Vh(e.participant.id),e.participant);break;case`waiting-participant-removed`:t(Bh,function(t){return t.filter(function(t){return t!==e.participant.id})}),Vh.remove(e.participant.id);break}})},[])),100,!0),F.createElement(F.Fragment,null,t)},Uh=function(){var e=mo(Ih);return mt(e),e},Wh=function(){return!0},Gh=function(e){var t=e===void 0?{}:e,n=t.filter,r=n===void 0?Wh:n,i=t.ignoreLocal,a=i===void 0?!1:i,o=Uh(),s=mo(Fh),c=a&&s===o,l=!r?.(s),u=nh(T(!c&&!l?s:null),2),d=u[0],f=u[1];return E(function(){c||l||f(s)},[l,c,s]),mt(d),d},Kh=function(e){return[`blocked`,`off`].includes(e)},qh=`;`,Jh=function(e,t){return`${e}${qh}${t}`},Yh=mh({equals:dh,get:function(e){return function(t){var n=nh(e.split(qh),2),r=n[0],i=n[1];return t(Rh).filter(function(e){switch(r){case`local`:case`owner`:case`record`:return t(yh(e,r));case`remote`:return!t(yh(e,`local`));case`screen`:var n=t(yh(e,`tracks.screenAudio.state`)),i=t(yh(e,`tracks.screenVideo.state`));return!Kh(n)||!Kh(i);default:return!0}}).sort(function(e,n){switch(i){case`joined_at`:case`session_id`:case`user_id`:case`user_name`:var r=t(yh(e,i)),a=t(yh(n,i));if(r!==void 0||a!==void 0){if(r===void 0)return-1;if(a===void 0||r>a)return 1;if(r<a)return-1}return 0;default:return 0}})}}}),Xh=function(e){var t=e===void 0?{}:e,n=t.filter,r=t.onActiveSpeakerChange,i=t.onParticipantJoined,a=t.onParticipantLeft,o=t.onParticipantUpdated,s=t.sort,c=mo(Yh(Jh(typeof n==`string`?n:null,typeof s==`string`?s:null))),l=typeof n==`function`||typeof s==`function`,u=k(function(e){return typeof n!=`function`&&typeof s!=`function`?[]:c.map(function(t){return e(zh(t))}).filter(function(e){return!!e}).filter(typeof n==`function`?n:function(){return!0}).sort(typeof s==`function`?s:function(){return 0}).map(function(e){return e.session_id}).filter(Boolean)},[n,c,s]),d=nh(T([]),2),f=d[0],p=d[1],m=I(k(function(e){if(l){var t=u(e);dh(t,f)||p(t)}},[f,u,l]));E(function(){m()},[m]),Ah([`participant-joined`,`participant-updated`,`active-speaker-change`,`participant-left`],k(function(e){e.length&&(e.forEach(function(e){switch(e.action){case`participant-joined`:i?.(e);break;case`participant-updated`:o?.(e);break;case`active-speaker-change`:r?.(e);break;case`participant-left`:a?.(e);break}}),m())},[m,r,i,a,o]));var h=typeof n==`function`||typeof s==`function`?f:c;return mt(h),h},Zh=mh({equals:fh,get:function(){return function(e){return e(Yh(Jh(`screen`,null))).map(function(t){return{local:e(yh(t,`local`)),screenAudio:e(yh(t,`tracks.screenAudio`)),screenVideo:e(yh(t,`tracks.screenVideo`)),screenId:`${t}-screen`,session_id:t}})}}}),Qh=function(e){var t=e===void 0?{}:e,n=t.onError,r=t.onLocalScreenShareStarted,i=t.onLocalScreenShareStopped,a=ah(),o=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.startScreenShare.apply(a,rh([],nh(e),!1))},[a]),s=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.stopScreenShare.apply(a,rh([],nh(e),!1))},[a]);G(`local-screen-share-started`,k(function(){return r?.()},[r])),G(`local-screen-share-stopped`,k(function(){return i?.()},[i])),G(`nonfatal-error`,k(function(e){e.type===`screen-share-error`&&n?.(e)},[n]));var c=mo(Zh(void 0)),l={isSharingScreen:c.some(function(e){return e.local}),screens:c,startScreenShare:o,stopScreenShare:s};return mt(l),l},$h=function(e,t){t===void 0&&(t=`video`);var n=Ch(e,`tracks.${t}`),r=n?W(W({},n),{isOff:Kh(n.state)}):{isOff:!0,persistentTrack:void 0,state:`off`,subscribed:!1};return mt(r),r};function eg(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return k(function(t){for(var n=0;n<e.length;n++){var r=e[n];typeof r==`function`?r(t):r&&Zm(r)===`object`&&(r.current=t)}},e)}var tg=P(Sa(function(e,t){var n=e.onPlayFailed,r=e.sessionId,i=e.type,a=i===void 0?`audio`:i,o=Qm(e,[`onPlayFailed`,`sessionId`,`type`]),s=D(null),c=$h(r,a),l=eg(s,t),u=c?.subscribed;return E(function(){var e=s.current;if(!(!e||!c?.persistentTrack)){if(!MediaStream){console.warn(`MediaStream API not available. Can't setup ${a} for ${r}`),n?.({sessionId:r,target:e,type:a,message:`MediaStream API not available`,name:`MediaStream API not available`});return}var t=function(){e.play().catch(function(t){n?.({sessionId:r,target:e,type:a,message:t.message,name:t.name})})};return e.addEventListener(`loadedmetadata`,t),e.srcObject=new MediaStream([c.persistentTrack]),e.load(),function(){e.removeEventListener(`loadedmetadata`,t)}}},[c?.persistentTrack,n,r,a]),G(`participant-left`,k(function(e){var t=s.current;e.participant.session_id!==r||!t||(t.srcObject=null)},[r])),G(`left-meeting`,k(function(){var e=s.current;e&&(e.pause(),e.srcObject=null)},[])),F.createElement(`audio`,W({autoPlay:!0,ref:l},o,{"data-session-id":r,"data-audio-type":a,"data-subscribed":u}))}));tg.displayName=`DailyAudioTrack`;var ng=P(Sa(function(e,t){var n=e.autoSubscribeActiveSpeaker,r=n===void 0?!1:n,i=e.maxSpeakers,a=i===void 0?5:i,o=e.onPlayFailed,s=e.playLocalScreenAudio,c=s===void 0?!1:s,l=ah(),u=nh(T(Array(a).fill(``)),2),d=u[0],f=u[1],p=Qh().screens,m=Uh(),h=Gh({ignoreLocal:!0}),g=D(null);ft(t,function(){return{getActiveSpeakerAudio:function(){return g.current?.querySelector(`audio[data-session-id="${h}"][data-audio-type="audio"]`)??null},getAllAudio:function(){return Array.from(g.current?.querySelectorAll(`audio`)??[])},getAudioBySessionId:function(e){return g.current?.querySelector(`audio[data-session-id="${e}"][data-audio-type="audio"]`)??null},getRmpAudio:function(){return Array.from(g.current?.querySelectorAll(`audio[data-audio-type="rmpAudio"]`)??[])},getScreenAudio:function(){return Array.from(g.current?.querySelectorAll(`audio[data-audio-type="screenAudio"]`)??[])},getRmpAudioBySessionId:function(e){return g.current?.querySelector(`audio[data-session-id="${e}"][data-audio-type="rmpAudio"]`)??null},getScreenAudioBySessionId:function(e){return g.current?.querySelector(`audio[data-session-id="${e}"][data-audio-type="screenAudio"]`)??null}}},[h]);var _=I(k(function(e,t,n){return $m(void 0,void 0,void 0,function(){var t,i;return eh(this,function(a){if(t=Object.values(l?.participants()??{}).filter(function(e){return!e.local&&!!e.tracks.audio.subscribed}),i=function(e){return t.some(function(t){return t.session_id===e})},!i(n))if(l&&!l.isDestroyed()&&r&&!l.subscribeToTracksAutomatically())l.updateParticipant(n,{setSubscribedTracks:{audio:!0}});else return[2];return f(function(r){if(r.includes(n))return r;var a=function(e){return!e||!i(e)};if(r.some(a)){var o=r.findIndex(a);return r[o]=n,rh([],nh(r),!1)}var s=r.findIndex(function(e){return t.some(function(t){return t.session_id===e&&Kh(t.tracks.audio.state)})});if(s>=0)return r[s]=n,rh([],nh(r),!1);var c=t.filter(function(e){return r.includes(e.session_id)&&e.session_id!==h}).sort(function(t,n){var r=e(yh(t.session_id,`last_active`))??new Date(`1970-01-01`),i=e(yh(n.session_id,`last_active`))??new Date(`1970-01-01`);return r>i?1:r<i?-1:0});if(!c.length){var l=r.findIndex(function(e){return e!==h});return r[l]=n,rh([],nh(r),!1)}var u=r.indexOf(c[0]?.session_id);return r[u]=n,rh([],nh(r),!1)}),[2]})})},[h,r,l])),v=k(function(e){f(function(t){if(!t.includes(e))return t;var n=rh([],nh(t),!1),r=n.indexOf(e);return n[r]=``,n})},[]);Ah([`active-speaker-change`,`track-started`,`participant-left`],k(function(e){e.forEach(function(e){switch(e.action){case`active-speaker-change`:if(e.activeSpeaker.peerId===m)return;_(e.activeSpeaker.peerId);break;case`track-started`:e.track.kind===`audio`&&e.participant&&!e.participant.local&&_(e.participant.session_id);break;case`participant-left`:v(e.participant.session_id);break}})},[_,m,v]),200);var y=Xh({filter:k(function(e){return!!e?.tracks?.rmpAudio},[])});return F.createElement(`div`,{ref:g},d.map(function(e,t){return F.createElement(tg,{key:`speaker-slot-${t}`,onPlayFailed:o,sessionId:e,type:`audio`})}),p.filter(function(e){return c?!0:!e.local}).map(function(e){return F.createElement(tg,{key:e.screenId,onPlayFailed:o,sessionId:e.session_id,type:`screenAudio`})}),y.map(function(e){return F.createElement(tg,{key:`${e}-rmp`,onPlayFailed:o,sessionId:e,type:`rmpAudio`})}))}));ng.displayName=`DailyAudio`;var rg=Sa(function(e,t){var n=e.automirror,r=e.fit,i=r===void 0?`contain`:r,a=e.mirror,o=e.onResize,s=e.playableStyle,c=s===void 0?{}:s,l=e.sessionId,u=e.style,d=u===void 0?{}:u,f=e.type,p=f===void 0?`video`:f,m=Qm(e,[`automirror`,`fit`,`mirror`,`onResize`,`playableStyle`,`sessionId`,`style`,`type`]),h=Uh()===l,g=p===`screenVideo`,_=h&&!g,v=D(null),y=eg(v,t),b=$h(l,p),x=b.persistentTrack,S=_||g||!b.isOff,C=Ch(l,`tracks.${p}`)?.subscribed,w=O(function(){if(typeof a==`boolean`)return a;if(!n)return!1;if(!x)return _;var e=x.getSettings();return`facingMode`in e?_&&e.facingMode===`user`:_},[n,_,a,x]);return E(function(){var e=v.current;if(e){var t=function(){var t=e.play();t!==void 0&&t.then(function(){e.controls=!1}).catch(function(t){e.controls=!0,console.warn(`Failed to play video`,t)})},n=function(){e.paused&&t()},r=function(){e.style.transform=`scale(1)`},i=function(){e.style.transform=``,setTimeout(function(){e.paused&&t()},100)},a=function(){document.visibilityState!==`hidden`&&e.paused&&t()};return e.addEventListener(`canplay`,n),e.addEventListener(`enterpictureinpicture`,r),e.addEventListener(`leavepictureinpicture`,i),document.addEventListener(`visibilitychange`,a),function(){e.removeEventListener(`canplay`,n),e.removeEventListener(`enterpictureinpicture`,r),e.removeEventListener(`leavepictureinpicture`,i),document.removeEventListener(`visibilitychange`,a)}}},[]),E(function(){var e=v.current;if(!(!e||!x)){if(!MediaStream){console.warn(`MediaStream API not available. Can't setup ${p} for ${l}`);return}return e.srcObject=new MediaStream([x]),e.load(),function(){e.srcObject=null,e.load()}}},[l,p,x,x?.id]),E(function(){var e=v.current;if(!o||!e)return;var t;function n(){t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){var e=v.current;if(!(!e||document.hidden)){var t=e.videoWidth,n=e.videoHeight;t&&n&&o?.({aspectRatio:t/n,height:n,width:t})}})}return n(),e.addEventListener(`loadedmetadata`,n),e.addEventListener(`resize`,n),function(){t&&cancelAnimationFrame(t),e.removeEventListener(`loadedmetadata`,n),e.removeEventListener(`resize`,n)}},[o]),F.createElement(`video`,W({autoPlay:!0,muted:!0,playsInline:!0,ref:y,"data-local":h,"data-mirrored":w||void 0,"data-playable":S||void 0,"data-session-id":l,"data-subscribed":C,"data-video-type":p,style:W(W({objectFit:i,transform:w?`scale(-1, 1)`:``},d),S?c:{})},m))});rg.displayName=`DailyVideo`;var ig=Ie({refreshDevices:function(){return Promise.resolve()}}),ag=N(`idle`);ag.debugLabel=ph(`camera-state`);var og=N(`idle`);og.debugLabel=ph(`microphone-state`);var sg=N([]);sg.debugLabel=ph(`camera-devices`);var cg=N([]);cg.debugLabel=ph(`microphone-devices`);var lg=N([]);lg.debugLabel=ph(`speaker-devices`);var ug=N(null);ug.debugLabel=ph(`last-camera-error`);var dg=function(e){var t=e.children,n=ah(),r=I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var e,r,i,a,o,s,c,l,u,d;return eh(this,function(f){switch(f.label){case 0:if((navigator==null?void 0:navigator.mediaDevices)?.getUserMedia===void 0||(navigator==null?void 0:navigator.mediaDevices)?.enumerateDevices===void 0)return t(ag,`not-supported`),t(og,`not-supported`),[2];if(!n)return[2];f.label=1;case 1:return f.trys.push([1,4,,5]),[4,n.enumerateDevices()];case 2:return e=f.sent().devices,r=e.filter(function(e){return e.kind===`videoinput`&&e.deviceId!==``}),i=e.filter(function(e){return e.kind===`audioinput`&&e.deviceId!==``}),a=e.filter(function(e){return e.kind===`audiooutput`&&e.deviceId!==``}),[4,n.getInputDevices()];case 3:return o=f.sent(),s=o.camera,c=o.mic,l=o.speaker,u=function(e,t,n){var r=n.find(function(e){return e.device.deviceId===t.deviceId}),i=`deviceId`in e&&t.deviceId===e.deviceId,a=!(`deviceId`in e)&&r?.selected;return{device:t,selected:i||!!a,state:r?.state??`granted`}},d=function(e,t){return e.device.deviceId==="default"?-1:t.device.deviceId==="default"?1:e.device.label<t.device.label?-1:+(e.device.label>t.device.label)},t(sg,function(e){return r.filter(Boolean).map(function(t){return u(s,t,e)}).sort(d)}),t(cg,function(e){return i.filter(Boolean).map(function(t){return u(c,t,e)}).sort(d)}),t(lg,function(e){return a.filter(Boolean).map(function(t){return u(l,t,e)}).sort(d)}),[3,5];case 4:return f.sent(),t(ag,`not-supported`),t(og,`not-supported`),[3,5];case 5:return[2]}})})},[n])),i=I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var i,a,o,s,c,l,u,d,f,p,m,h;return eh(this,function(g){switch(g.label){case 0:if(!n||(i=e(ag),a=e(og),o=n.participants(),!o.local))return[2];if(s=o.local.tracks,c=`prompt`,l=`prompt`,!navigator.permissions)return[3,5];g.label=1;case 1:return g.trys.push([1,4,,5]),[4,navigator.permissions.query({name:`camera`})];case 2:return u=g.sent(),c=u.state,[4,navigator.permissions.query({name:`microphone`})];case 3:return d=g.sent(),l=d.state,[3,5];case 4:return g.sent(),[3,5];case 5:return f=c===`prompt`&&[`idle`,`pending`].includes(i)&&s.video.state===`interrupted`&&!s.video.persistentTrack,p=[`idle`,`pending`].includes(i)&&!s.video.persistentTrack&&!!s.video.off?.byUser,m=l===`prompt`&&[`idle`,`pending`].includes(a)&&s.audio.state===`interrupted`&&!s.audio.persistentTrack,h=[`idle`,`pending`].includes(a)&&!s.audio.persistentTrack&&!!s.audio.off?.byUser,s.audio?.blocked?.byDeviceInUse?(t(og,`in-use`),t(cg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`in-use`}):e})})):s.audio?.blocked?.byDeviceMissing?t(og,`not-found`):s.audio?.blocked?.byPermissions||l===`denied`?t(og,`blocked`):m?t(og,`pending`):h?t(og,`idle`):(t(og,`granted`),t(cg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`granted`}):e})})),s.video?.blocked?.byDeviceInUse?(t(ag,`in-use`),t(sg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`in-use`}):e})})):s.video?.blocked?.byDeviceMissing?t(ag,`not-found`):s.video?.blocked?.byPermissions||c===`denied`?t(ag,`blocked`):f?t(ag,`pending`):p?t(ag,`idle`):(t(ag,`granted`),t(sg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`granted`}):e})})),r(),[2]}})})},[n,r]));return G(`participant-updated`,k(function(e){e.participant.local&&i()},[i])),G(`available-devices-updated`,r),G(`selected-devices-updated`,r),G(`camera-error`,I(k(function(e,t,n){switch(t(ug,n.error),n.error?.type){case`cam-in-use`:t(ag,`in-use`);break;case`mic-in-use`:t(og,`in-use`);break;case`cam-mic-in-use`:t(ag,`in-use`),t(og,`in-use`);break;case`not-found`:n.error?.missingMedia.includes(`video`)&&t(ag,`not-found`),n.error?.missingMedia.includes(`audio`)&&t(og,`not-found`);break;case`permissions`:n.error?.blockedMedia.includes(`video`)&&t(ag,`blocked`),n.error?.blockedMedia.includes(`audio`)&&t(og,`blocked`);break;case`constraints`:n.error?.reason===`invalid`?(t(ag,`constraints-invalid`),t(og,`constraints-invalid`)):n.error?.reason===`none-specified`&&(t(ag,`constraints-none-specified`),t(og,`constraints-none-specified`));break;case`undefined-mediadevices`:t(ag,`undefined-mediadevices`),t(og,`undefined-mediadevices`);break;default:t(ag,`unknown`),t(og,`unknown`);break}},[]))),G(`started-camera`,I(k(function(e,t){t(ag,`granted`),t(og,`granted`),i()},[i]))),F.createElement(ig.Provider,{value:{refreshDevices:r}},t)};function fg(e){return e.instanceId??`__default__`}var pg=N({});pg.debugLabel=ph(`live-streaming-instances`);var mg=N(function(e){var t=e(pg),n=Object.values(t),r=n.filter(function(e){return e.isLiveStreaming}),i=r[0]??n[n.length-1];return{errorMsg:n.find(function(e){return e.errorMsg})?.errorMsg,isLiveStreaming:r.length>0,layout:i?.layout}});mg.debugLabel=ph(`live-streaming`);var hg=function(e){var t=e.children;return G(`live-streaming-started`,I(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return W(W({},e),(t={},t[r]={instanceId:r,isLiveStreaming:!0,layout:n?.layout},t))})},[]))),G(`live-streaming-stopped`,I(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return e[r]?W(W({},e),(t={},t[r]=W(W({},e[r]),{isLiveStreaming:!1,layout:void 0}),t)):e})},[]))),G(`live-streaming-error`,I(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return W(W({},e),(t={},t[r]=W(W({},e[r]??{instanceId:r,isLiveStreaming:!1}),{errorMsg:n.errorMsg}),t))})},[]))),G(`left-meeting`,I(k(function(e,t){t(pg,{})},[]))),F.createElement(F.Fragment,null,t)},gg=N(`new`);gg.debugLabel=ph(`meeting-state`);var _g=N(null);_g.debugLabel=ph(`meeting-error`);var vg=N(null);vg.debugLabel=ph(`non-fatal-error`);var yg=N({data:void 0,topology:`none`});yg.debugLabel=ph(`meeting-session-data`);var bg=function(e){var t=e.children,n=ah(),r=I(k(function(e,t){if(n){var r=n.meetingState();return t(gg,r),r}},[n]));return G(`loading`,r),G(`loaded`,r),G(`joining-meeting`,r),G(`joined-meeting`,r),G(`left-meeting`,r),G(`error`,I(k(function(e,t,n){t(_g,n),r()},[r]))),G(`nonfatal-error`,I(k(function(e,t,n){t(vg,n)},[]))),G(`joined-meeting`,I(k(function(e,t){n&&t(yg,n.meetingSessionState())},[n]))),G(`meeting-session-state-updated`,I(k(function(e,t,n){t(yg,n.meetingSessionState)},[]))),G(`left-meeting`,I(k(function(e,t){t(yg,{data:void 0,topology:`none`})},[]))),G(`call-instance-destroyed`,I(k(function(e,t){t(gg,`new`),t(_g,null),t(vg,null),t(yg,{data:void 0,topology:`none`})},[]))),F.createElement(F.Fragment,null,t)},xg=N(`none`);xg.debugLabel=ph(`topology`);var Sg=N(`unknown`),Cg=N([]),wg=N(`interrupted`),Tg=N(100);Tg.debugLabel=ph(`network-quality`);var Eg=N(`good`);Eg.debugLabel=ph(`network-threshold`);var Dg=function(e){var t=e.children,n=ah(),r=mo(xg),i=I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var e;return eh(this,function(r){switch(r.label){case 0:return n?[4,n.getNetworkTopology()]:[2];case 1:return e=r.sent(),!e||e?.topology===`none`||t(xg,e.topology),[2]}})})},[n]));return G(`joined-meeting`,i),G(`network-connection`,I(k(function(e,t,n){switch(t(wg,n.event),n.event){case`connected`:n.type===`peer-to-peer`&&t(xg,`peer`),n.type===`sfu`&&t(xg,`sfu`);break}},[]))),G(`network-quality-change`,I(k(function(e,t,n){t(Sg,function(e){return e===n.networkState?e:n.networkState}),t(Cg,function(e){var t=n.networkStateReasons??[];return fh(e,t)?e:t}),t(Tg,function(e){return e===n.quality?e:n.quality}),t(Eg,function(e){return e===n.threshold?e:n.threshold})},[]))),G(`left-meeting`,I(k(function(e,t){t(xg,`none`),t(Sg,`unknown`),t(Cg,[]),t(wg,`interrupted`),t(Tg,100),t(Eg,`good`)},[]))),E(function(){!n||r!==`none`||i()},[n,i,r]),F.createElement(F.Fragment,null,t)};function Og(e){return e.instanceId?e.instanceId:e.type===`local`||e.local?`__local__`:`__default__`}var kg=N({});kg.debugLabel=ph(`recording-instances`);var Ag=N(function(e){var t=e(kg),n=Object.values(t),r=n.filter(function(e){return e.isRecording}),i=r[0]??n[n.length-1];return{error:n.some(function(e){return e.error}),isLocalParticipantRecorded:n.some(function(e){return e.isLocalParticipantRecorded}),isRecording:r.length>0,layout:i?.layout,local:i?.local,recordingId:i?.recordingId,recordingStartedDate:i?.recordingStartedDate,startedBy:i?.startedBy,type:i?.type}});Ag.debugLabel=ph(`recording-state`);var jg=function(e){var t=e.children,n=Uh(),r=Xh({filter:`record`}),i=I(k(function(e,t,n,r){var i=e(kg).__local__,a={instanceId:`__local__`,isLocalParticipantRecorded:n,isRecording:n,local:n?r:i?.local,type:n?`local`:i?.type};i&&dh(i,a)||!n&&!i||(n?t(kg,function(e){return W(W({},e),{__local__:a})}):i&&t(kg,function(e){return W(W({},e),{__local__:W(W({},i),{isLocalParticipantRecorded:!1,isRecording:!1})})}))},[]));return E(function(){i(r.length>0,r.includes(n||`local`))},[n,i,r]),G(`recording-started`,I(k(function(e,t,r){var i=Og(r),a=!0;switch(r.type){case`cloud-audio-only`:case`cloud-beta`:case`cloud`:n&&r.layout?.preset===`single-participant`&&r.layout.session_id!==n&&(a=!1);break}t(kg,function(e){var t;return W(W({},e),(t={},t[i]={error:!1,instanceId:i,isLocalParticipantRecorded:a,isRecording:!0,layout:r?.layout,local:r?.local,recordingId:r?.recordingId,recordingStartedDate:new Date,startedBy:r?.startedBy,type:r?.type},t))})},[n]))),G(`recording-stopped`,I(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t;return e[r]?W(W({},e),(t={},t[r]=W(W({},e[r]),{isLocalParticipantRecorded:!1,isRecording:!1}),t)):e})},[]))),G(`recording-error`,I(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t,i=e[r];return W(W({},e),(t={},t[r]=W(W({},i??{instanceId:r}),{error:!0,errorMsg:n.errorMsg,isLocalParticipantRecorded:!1,isRecording:!1}),t))})},[]))),G(`left-meeting`,I(k(function(e,t){t(kg,{})},[]))),F.createElement(F.Fragment,null,t)},Mg=function(){var e=mo(gg);return mt(e),e},Ng=N(null);Ng.debugLabel=ph(`room-state`);var Pg=function(e){var t=e.children,n=ah(),r=Mg();return G(`access-state-updated`,I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var e;return eh(this,function(i){switch(i.label){case 0:return!n||r===`left-meeting`?[2]:[4,n.room()];case 1:return e=i.sent(),e&&`id`in e&&t(Ng,e),[2,e]}})})},[n,r]))),G(`left-meeting`,I(k(function(e,t){return function(){t(Ng,null)}},[]))),F.createElement(F.Fragment,null,t)},Fg=N({isTranscribing:!1,model:`general`,language:`en`,transcriptions:[]});Fg.debugLabel=ph(`transcription-state`);var Ig=function(e){var t=e.children;return G(`transcription-started`,I(k(function(e,t,n){t(Fg,{error:!1,transcriptionStartDate:new Date,isTranscribing:!0,transcriptions:[],endpointing:n.endpointing,extra:n.extra,includeRawResponse:n.includeRawResponse,instanceId:n.instanceId,language:n.language,model:n.model,profanity_filter:n.profanity_filter,punctuate:n.punctuate,redact:n.redact,startedBy:n.startedBy,tier:n.tier})},[]))),G(`transcription-stopped`,I(k(function(e,t,n){t(Fg,function(e){return W(W({},e),{updatedBy:n.updatedBy,isTranscribing:!1})})},[]))),G(`transcription-error`,I(k(function(e,t){t(Fg,function(e){return W(W({},e),{error:!0,isTranscribing:!1})})},[]))),G(`left-meeting`,I(k(function(e,t){t(Fg,function(e){return W(W({},e),{isTranscribing:!1})})},[]))),G(`app-message`,I(k(function(e,t,n){n?.fromId===`transcription`&&t(Fg,function(e){return W(W({},e),{isTranscribing:!0,transcriptions:rh(rh([],nh(e.transcriptions),!1),[n.data],!1)})})},[]))),F.createElement(F.Fragment,null,t)},Lg=`0.25.2`,Rg={strictMode:!0},zg=function(){return!0},Bg={options:Rg,shouldCreateInstance:zg},Vg=function(e,t){var n=t===void 0?Bg:t,r=n.parentElRef,i=n.options,a=i===void 0?Rg:i,o=n.shouldCreateInstance,s=o===void 0?zg:o,c=nh(T(null),2),l=c[0],u=c[1],d=D();return E(function(){if(e===`callFrame`&&r?.current===null||!s())return;function t(e){return $m(this,void 0,void 0,function(){return eh(this,function(t){switch(t.label){case 0:return[4,e.destroy()];case 1:return t.sent(),[2]}})})}var n=function(){setTimeout(function(){return u(null)},0)},i=Cm.getCallInstance();if(!l&&i&&!i.isDestroyed()){i.once(`call-instance-destroyed`,n),u(i);return}if(l){dh(d.current,a)||t(l);return}if(!i||i.isDestroyed())try{var o=W(W({},a),{aboutClient:W(W({},a.aboutClient??{}),{"daily-react":Lg})});switch(e){case`callFrame`:i=r?.current?Cm.createFrame(r.current,o):Cm.createFrame(o);break;case`callObject`:i=Cm.createCallObject(o);break}d.current=a,u(i),i.once(`call-instance-destroyed`,n)}catch(e){if(console.error(`Error creating call instance:`,e),a.strictMode)throw e}},[l,a,r,s,e]),l},Hg=function(e){return Vg(`callObject`,e)},Ug=function(e){var t=e.children,n=e.jotaiStore,r=Qm(e,[`children`,`jotaiStore`]),i=D({}),a=k(function(e){var t,n;if(`action`in e){var r=e.action,a=Array.from(i.current?.[r]??[]),o=a.filter(function(e){return nh(e,1)[0]<0}),s=a.filter(function(e){return nh(e,1)[0]>0}),c=rh(rh([],nh(o),!1),nh(s),!1);try{for(var l=th(c),u=l.next();!u.done;u=l.next()){var d=nh(u.value,2)[1];d(e)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}}},[]),o=k(function(e){e&&Object.keys(i.current).forEach(function(t){e.off(t,a),e.isDestroyed()||e.on(t,a)})},[a]),s=`callObject`in r?r.callObject:null,c=Hg({options:O(function(){return`callObject`in r?{}:r},[r]),shouldCreateInstance:k(function(){return!(`callObject`in r)},[r])}),l=s??c;E(function(){l&&o(l)},[l,o]);var u=k(function(e,t,n){var r;i.current[e]||(i.current[e]=new Map,l&&(l.off(e,a),l.isDestroyed()||l.on(e,a))),i.current[e]?.has(n)||(r=i.current[e])==null||r.set(n,t)},[l,a]),d=k(function(e,t){var n;(n=i.current[e])==null||n.delete(t),i.current[e]?.size===0&&(l?.off(e,a),delete i.current[e])},[l,a]);return F.createElement(so,{store:n},F.createElement(ih.Provider,{value:l},F.createElement(oh.Provider,{value:{on:u,off:d}},F.createElement(Pg,null,F.createElement(bg,null,F.createElement(Dg,null,F.createElement(Hh,null,F.createElement(jg,null,F.createElement(hg,null,F.createElement(Ig,null,F.createElement(dg,null,t)))))))))))},Wg=function(e){var t=(e===void 0?{}:e).onAppMessage,n=ah(),r=k(function(e,t){t===void 0&&(t=`*`),n&&n.sendAppMessage(e,t)},[n]);return G(`app-message`,k(function(e){t?.(e,r)},[t,r])),r},Gg=function(e,t,n,r){var i=ah(),a=e===Uh();G(`local-audio-level`,k(function(e){a&&t(e.audioLevel)},[t,a])),G(`remote-participants-audio-level`,k(function(n){a||t(n.participantsAudioLevel[e])},[t,e,a])),E(function(){if(!(!i||i.isDestroyed()||!a)&&!i.isLocalAudioLevelObserverRunning())try{i.startLocalAudioLevelObserver(r)}catch{n?.(`Local audio level observer not supported in this browser`)}},[i,n,r,a]),E(function(){!i||i.isDestroyed()||a||i.isRemoteParticipantsAudioLevelObserverRunning()||i.startRemoteParticipantsAudioLevelObserver(r)},[i,r,a])},Kg=function(e){return $h(e,`audio`)},qg,Jg;function Yg(){return Jg?qg:(Jg=1,qg=function e(t,n){if(t===n)return!0;if(t&&n&&Zm(t)==`object`&&Zm(n)==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n},qg)}Yg();var Xg=N({state:`low`,reason:`none`});Xg.debugLabel=ph(`cpu-load`);var Zg=function(){var e=ah(),t=mo(ag),n=mo(og),r=mo(sg),i=mo(cg),a=mo(lg),o=mo(ug),s=pt(ig).refreshDevices,c=k(function(t){return $m(void 0,void 0,void 0,function(){return eh(this,function(n){switch(n.label){case 0:return[4,e?.setInputDevicesAsync({audioDeviceId:null,videoDeviceId:t})];case 1:return n.sent(),[2]}})})},[e]),l=k(function(t){return $m(void 0,void 0,void 0,function(){return eh(this,function(n){switch(n.label){case 0:return[4,e?.setInputDevicesAsync({audioDeviceId:t,videoDeviceId:null})];case 1:return n.sent(),[2]}})})},[e]),u=k(function(t){return $m(void 0,void 0,void 0,function(){return eh(this,function(n){switch(n.label){case 0:return[4,e?.setOutputDeviceAsync({outputDeviceId:t})];case 1:return n.sent(),[2]}})})},[e]),d=[`blocked`,`in-use`,`not-found`,`constraints-invalid`,`constraints-none-specified`,`undefined-mediadevices`,`unknown`],f={cameraError:o,cameras:r,camState:t,currentCam:r.find(function(e){return e.selected}),currentMic:i.find(function(e){return e.selected}),currentSpeaker:a.find(function(e){return e.selected}),hasCamError:d.includes(t),hasMicError:d.includes(n),microphones:i,micState:n,refreshDevices:s,setCamera:c,setMicrophone:l,setSpeaker:u,speakers:a};return mt(f),f},Qg=N(null);Qg.debugLabel=ph(`input-settings`);var $g=N({hidden:0,present:0});$g.debugLabel=ph(`participant-counts`);var e_=ca(function(e){var t=N({},function(t,n,r){n(e_(e),r)});return t.debugLabel=ph(`participant-receive-settings-${e}`),t}),t_=function(e){return $h(e,`screenVideo`)},n_=N(null);n_.debugLabel=ph(`send-settings`);var r_=function(e){return $h(e,`video`)};function i_({children:e}){return A(Ug,{children:e})}var a_=Ie(null),o_=`tavus:memory-user-id:`,s_=new Map;function c_(e){return`${o_}${e}`}function l_(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function u_(e){if(!e)return``;let t=c_(e);try{let e=window.localStorage.getItem(t);if(e)return e;let n=l_();return window.localStorage.setItem(t,n),n}catch{}let n=s_.get(t);if(n)return n;let r=l_();return s_.set(t,r),r}var d_=`tavus:terms-accepted:`;function f_(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t.toString(36)}function p_(e,t){return`${d_}${e}:${f_(t)}`}function m_(e,t){if(!e||!t)return!1;try{return globalThis.localStorage?.getItem(p_(e,t))===`1`}catch{return!1}}function h_(e,t){if(!(!e||!t))try{globalThis.localStorage?.setItem(p_(e,t),`1`)}catch{}}var g_=null;function __(e,t){!e||!t||(g_={deploymentId:e,content:t})}function v_(){g_&&=(h_(g_.deploymentId,g_.content),null)}function y_(e){return e===`replica`||e===`user`?e:null}function b_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function x_(e){if(!b_(e)||e.message_type!==`conversation`||typeof e.event_type!=`string`||!b_(e.properties))return null;if(e.event_type===`conversation.utterance`){let t=e.properties;return typeof t.speech==`string`?{kind:`chat-message`,sender:t.role===`replica`?`agent`:`user`,text:t.speech}:null}if(e.event_type===`conversation.utterance.streaming`){let t=e.properties;if(typeof t.speech!=`string`)return null;let n=t.final===!0||t.is_interrupted===!0;return{kind:`caption-update`,text:t.speech,final:n,role:y_(t.role)}}return null}function S_(e,t){return{message_type:`conversation`,event_type:`conversation.respond`,conversation_id:e,properties:{text:t}}}function C_(e,t){return typeof e[t]==`number`?{[t]:e[t]}:{}}function w_(e){let t=e.role===`user`||e.role===`replica`?e.role:null;return!t||typeof e.speech!=`string`?null:{kind:`utterance`,event_type:`conversation.utterance`,properties:{role:t,speech:e.speech,...C_(e,`seq`),...C_(e,`turn_idx`)}}}function T_(e){let t=e.role===`user`||e.role===`replica`?e.role:null;return!t||typeof e.speech!=`string`?null:{kind:`utterance.streaming`,event_type:`conversation.utterance.streaming`,properties:{role:t,speech:e.speech,...typeof e.final==`boolean`?{final:e.final}:{},...typeof e.is_interrupted==`boolean`?{is_interrupted:e.is_interrupted}:{},...C_(e,`seq`)}}}function E_(e){return typeof e.name!=`string`||typeof e.arguments!=`string`?null:{kind:`tool_call`,event_type:`conversation.tool_call`,properties:{name:e.name,arguments:e.arguments,...C_(e,`seq`),...C_(e,`turn_idx`)}}}function D_(e){if(typeof e.name!=`string`||typeof e.arguments!=`string`)return null;let t=e.modality===`vision`||e.modality===`audio`?e.modality:null;return t?{kind:`perception_tool_call`,event_type:`conversation.perception_tool_call`,properties:{name:e.name,arguments:e.arguments,modality:t}}:null}function O_(e){return{kind:`perception_analysis`,event_type:`conversation.perception_analysis`,properties:e}}function k_(e,t){return{kind:`speaking`,event_type:t,properties:{...C_(e,`seq`),...C_(e,`turn_idx`)}}}var A_={"conversation.utterance":w_,"conversation.utterance.streaming":T_,"conversation.tool_call":E_,"conversation.perception_tool_call":D_,"conversation.perception_analysis":O_,"conversation.replica_started_speaking":k_,"conversation.replica_stopped_speaking":k_,"conversation.user_started_speaking":k_,"conversation.user_stopped_speaking":k_};function j_(e){if(!b_(e)||e.message_type!==`conversation`||typeof e.event_type!=`string`||!b_(e.properties))return null;let t=A_[e.event_type];return t?t(e.properties,e.event_type):{kind:`unknown`,event_type:e.event_type,properties:e.properties}}function M_(e,t){return{message_type:`conversation`,event_type:t.event_type,conversation_id:e,properties:t.properties??{}}}function N_(e,t){let n=x_(e);return n?n.kind===`chat-message`?(t.appendChatMessage(n.sender,n.text),!0):(t.setCaption(n.text,n.final,n.role),!0):!1}function P_(e=5e3){let t=[],n=n=>{for(;t.length>0&&n-t[0].ts>e;)t.shift()};return{markSent(e){t.push({text:e,ts:Date.now()})},consumeMatch(e){n(Date.now());let r=t.findIndex(t=>t.text===e);return r===-1?!1:(t.splice(r,1),!0)}}}var F_=yn(`Conversation`),I_=1500,L_=Ie(null);function R_({children:e}){return A(i_,{children:A(G_,{children:e})})}function z_(e,t,n){let{role:r,speech:i}=e.properties;if(!(r===`user`&&n.consumeMatch(i)))for(let n of t)n.onUtterance?.({...e.properties})}function B_(e,t){for(let n of t)n.onToolCall?.({...e.properties})}function V_(e,t){for(let n of t)n.onPerception?.(e)}function H_(e,t){let n=e.event_type,r=n.startsWith(`conversation.replica`)?`replica`:`user`,i=n.endsWith(`started_speaking`)?`started`:`stopped`;for(let n of t)n.onSpeakingState?.({who:r,state:i,...e.properties})}function U_(e,t){for(let n of t)n.onMessage?.(e)}function W_(e,t,n){switch(e.kind){case`utterance`:case`utterance.streaming`:z_(e,t,n);return;case`tool_call`:B_(e,t);return;case`perception_tool_call`:case`perception_analysis`:V_(e,t);return;case`speaking`:H_(e,t);return;case`unknown`:U_(e,t);return}}function G_({children:e}){let{deploymentId:t,client:n,config:r}=pt(bi),{memoryStores:i}=pt(wt),a=ah(),o=Mg(),s=pt(a_),c=O(()=>Wt(`idle`),[]),l=O(()=>Wt(null),[]),u=O(()=>Wt([]),[]),d=O(()=>Wt(``),[]),f=O(()=>Wt(null),[]),p=O(()=>Wt(null),[]),m=O(()=>Wt(null),[]),h=O(()=>Wt(null),[]),g=D(null),_=O(()=>P_(),[]),v=O(()=>new Set,[]),y=O(()=>Wt(`idle`),[]),b=s?.flowSignal??y,x=k(e=>{m.value=e},[m]),S=k(e=>{h.value=e},[h]),[,C]=T(o);E(()=>{C(o),o===`joined-meeting`?(c.value=`connected`,F_.info(`Connected to meeting`)):o===`left-meeting`?(c.value=`ended`,v_(),F_.info(`Left meeting`)):o===`error`&&(p.value=`Meeting error`,c.value=`error`)},[o,c,p]),vn(()=>{let e=c.value;if(e===`connected`)for(let e of v)e.onConnect?.();else if(e===`ended`||e===`disconnecting`)for(let e of v)e.onDisconnect?.();else if(e===`error`){let e=p.peek()??`Unknown error`;for(let t of v)t.onError?.({code:`CONVERSATION_ERROR`,message:e})}}),vn(()=>{let e=b.value;for(let t of v)t.onModeChange?.(e)}),Wg({onAppMessage:k(e=>{N_(e?.data,{appendChatMessage(e,t){e===`user`&&_.consumeMatch(t)||(u.value=[...u.peek(),{id:crypto.randomUUID(),sender:e,text:t,timestamp:Date.now()}])},setCaption(e,t,n){d.value=e,f.value=n,g.current!==null&&(clearTimeout(g.current),g.current=null),t&&(g.current=setTimeout(()=>{d.value=``,f.value=null,g.current=null},I_))}});let t=j_(e?.data);t&&W_(t,v,_)},[u,d,f,_,v])}),E(()=>()=>{g.current!==null&&(clearTimeout(g.current),g.current=null)},[]);let w=k(async(e,o)=>{try{c.value=`connecting`,p.value=null;let s=e,u=m.peek();u&&s?.password==null&&(s={...s,password:u});let d=r.value.customization.conversation.unique_memory_tag===!0;if(!s?.memory_stores){let e=i??(d?[u_(t)]:[]);e.length&&(s={...s,memory_stores:e})}let f=h.peek();h.value=null,f&&s?.captcha_token==null&&(s={...s,captcha_token:f});let g=await wn(n,t,s,o);l.value={conversationId:g.conversation_id,conversationName:g.conversation_name,conversationUrl:g.conversation_url,callbackUrl:g.callback_url,createdAt:g.created_at},console.info(`[Tavus:Conversation] Conversation created:`,g.conversation_id),await a?.join({url:g.conversation_url})}catch(e){throw e instanceof Sn&&(e.status===401||e.status===403)&&r.value.has_password===!0&&(m.value=null),F_.error(`Start failed`,e),p.value=String(e),c.value=`error`,e}},[n,t,a,c,p,l,m,h,r,i]),ee=k(async()=>{let e=l.peek();c.value=`disconnecting`,e&&await Tn(n,t,e.conversationId).catch(e=>F_.error(`End conversation API failed`,e)),await a?.leave(),c.value=`ended`},[n,t,a,c,l]),te=k(e=>{if(!a)return;let t=l.peek();if(!t){F_.warn(`sendChat called before session was established; dropping message`);return}_.markSent(e),a.sendAppMessage(S_(t.conversationId,e),`*`),u.value=[...u.peek(),{id:crypto.randomUUID(),sender:`user`,text:e,timestamp:Date.now()}]},[a,u,l,_]),ne=k(e=>{if(!a){F_.warn(`sendMessage called before Daily was ready; dropping message`);return}let t=l.peek();if(!t){F_.warn(`sendMessage called before session was established; dropping message`);return}e.event_type===`conversation.respond`&&_.markSent(e.properties.text),a.sendAppMessage(M_(t.conversationId,e),`*`)},[a,l,_]),re=k(e=>{v.add(e)},[v]),ie=k(e=>{v.delete(e)},[v]),ae=O(()=>({state:c,session:l,chatMessages:u,captionText:d,captionRole:f,error:p,password:m,setPassword:x,captchaToken:h,setCaptchaToken:S,mode:b,start:w,end:ee,sendChat:te,sendMessage:ne,conversation:{start:w,end:ee,sendMessage:ne},__registerSubscriber:re,__unregisterSubscriber:ie}),[c,l,u,d,f,p,m,x,h,S,b,w,ee,te,ne,re,ie]);return A(L_.Provider,{value:ae,children:e})}function K_(){let e=pt(bi);if(!e)throw Error(`useConfig must be used within ConfigProvider`);return e}var q_=new Set([`network`,`server`,`unavailable`,`busy`,`rate_limited`]);function J_(e){return e===401||e===403?`forbidden`:e===402?`limit_exceeded`:e===423?`busy`:e===429?`rate_limited`:e===409?`concurrency`:e===503?`unavailable`:e>=500?`server`:`unknown`}function Y_(e){if(!e)return;let t=e.get(`Retry-After`);if(!t)return;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&n>=0)return n;let r=Date.parse(t);if(!Number.isNaN(r)){let e=Math.floor((r-Date.now())/1e3);return e>0?e:0}}function X_(e){if(e instanceof Sn){let t=J_(e.status);return{kind:t,status:e.status,raw:e.body,retryable:q_.has(t),retryAfterSec:Y_(e.headers)}}return e instanceof TypeError?{kind:`network`,raw:String(e),retryable:!0}:{kind:`unknown`,raw:String(e),retryable:!1}}function Z_(e){return e===`limit_exceeded`?`daily_limit`:e===`forbidden`||e===`concurrency`?null:`busy`}var Q_=`tavus_pudl_`,$_=3600*48,ev=new Map;function tv(){let e=new Date;return`${e.getUTCFullYear()}${String(e.getUTCMonth()+1).padStart(2,`0`)}${String(e.getUTCDate()).padStart(2,`0`)}`}function nv(e){return`${Q_}${e}`}function rv(e){try{let t=`${nv(e)}=`,n=document.cookie.split(`; `).find(e=>e.startsWith(t));if(!n)return 0;let[r,i]=decodeURIComponent(n.slice(t.length)).split(`.`);if(r!==tv())return 0;let a=Number.parseInt(i,10);return Number.isFinite(a)&&a>0?a:0}catch{return 0}}function iv(e,t){try{let n=encodeURIComponent(`${tv()}.${t}`);document.cookie=`${nv(e)}=${n}; max-age=${$_}; path=/; SameSite=Lax`}catch{return}}function av(e){let t=ev.get(e);return t||(t=Wt(e?rv(e):0),ev.set(e,t)),t}function ov(e){if(!e)return;iv(e,rv(e)+1);let t=rv(e),n=ev.get(e);n?n.value=t:ev.set(e,Wt(t))}var sv=new Set([`Captcha token required`,`Captcha verification failed`]);function cv(e){if(!(e instanceof Sn)||e.status!==403)return!1;try{let t=JSON.parse(e.body.trim());return typeof t.error==`string`&&sv.has(t.error)}catch{return!1}}function lv(e,t){let n=e!==null,r=(t?.captchaToken.peek()??null)!==null,[i,a]=T(!n||r),[o,s]=T(0);E(()=>{n||a(!0)},[n]);let c=k(e=>{t?.setCaptchaToken(e),a(!0)},[t]),l=k(()=>{a(!0)},[]),u=t?.captchaToken.value??null,d=D(null);return E(()=>{let e=d.current!==null;d.current=u,n&&u===null&&(a(!1),e&&s(e=>e+1))},[n,u]),{captchaReady:i,captchaEpoch:o,handleCaptchaToken:c,handleCaptchaFallback:l}}function uv({children:e}){let{config:t}=K_(),{start:n}=pt(L_),r=t.value.deployment_id??``,i=av(r),a=k(()=>{let e=t.value,n=e.limits?.daily_call_limit_per_user;return n==null||e.channel!==`widget`&&e.channel!==`embed`?null:n},[t]),[o,s]=T(`idle`),[c,l]=T(!1),[u,d]=T(null),[f,p]=T(!1),m=O(()=>Wt(`idle`),[]);E(()=>{m.value=o},[o,m]),vn(()=>{let e=t.value,n=e.limits?.daily_call_limit_per_user;n!=null&&(e.channel!==`widget`&&e.channel!==`embed`||m.value===`idle`&&i.value>=n&&(d(`daily_limit`),p(!1),s(`unavailable`)))});let h=t.value.customization.show_haircheck,g=t.value.customization.conversation.modality,_=h&&g!==`chat`,v=D(!1),y=D(!1),b=k(async()=>{l(!0);try{await n(),v.current=!1,a()!=null&&ov(r),s(`call`)}catch(e){let n=X_(e);if(cv(e)&&!v.current){v.current=!0,l(!1),s(`idle`);return}if(v.current=!1,n.kind===`forbidden`&&t.value.has_password===!0){s(`idle`);return}d(Z_(n.kind)??`busy`),p(n.retryable),s(`unavailable`)}finally{l(!1)}},[n,t,a,r]),x=k(async()=>{if(o!==`idle`&&o!==`unavailable`)return;let e=a();if(e!=null&&i.value>=e){d(`daily_limit`),p(!1),s(`unavailable`);return}if(d(null),p(!1),_&&!y.current){s(`haircheck`);return}return b()},[o,_,b,a,i]),S=k(async()=>{o===`haircheck`&&(y.current=!0,await b())},[o,b]),C=k(()=>{o===`haircheck`&&s(`idle`)},[o]),w=k(()=>{o===`call`&&s(`ended`)},[o]),ee=k(()=>{d(null),p(!1),s(`idle`)},[]),te=O(()=>({flowSignal:m,setFlowState:s,isStarting:c,unavailableCause:u,canRetry:f,start:x,join:S,cancel:C,leave:w,restart:ee}),[m,c,u,f,x,S,C,w,ee]);return A(a_.Provider,{value:te,children:e})}var dv=yn(`HostBridge`),fv=Ie(null);function pv(e){if(!e)return null;let t=e.getRootNode();return t instanceof ShadowRoot&&t.host instanceof HTMLElement?t.host:e.parentElement}function mv({children:e}){let t=pt(L_),n=pt(a_),r=dn(null),i=k(e=>{r.value=pv(e)},[r]),a=k((e,t)=>{let n=r.peek();n&&n.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0})),dv.info(`Event:`,e,t)},[r]);E(()=>{let e=r.value;if(e)return e.tavus={start:t.start,end:t.end,sendChat:t.sendChat,sendMessage:t.sendMessage},()=>{delete e.tavus}},[r.value,t]),E(()=>t.state.subscribe(e=>{switch(e){case`connected`:a(`tavus:conversation-started`,{conversationId:t.session.peek()?.conversationId??``}),a(`tavus:state-change`,{state:e});break;case`ended`:a(`tavus:conversation-ended`,{conversationId:t.session.peek()?.conversationId??``}),a(`tavus:state-change`,{state:e});break;case`error`:a(`tavus:error`,{code:`CONVERSATION_ERROR`,message:t.error.peek()??`Unknown error`}),a(`tavus:state-change`,{state:e});break;default:a(`tavus:state-change`,{state:e})}}),[t,a]),vn(()=>{if(!n)return;let e=n.flowSignal.value;a(`tavus:mode-change`,{mode:e})}),E(()=>{let e={onUtterance(e){a(`tavus:protocol-message`,{kind:`utterance`,event_type:`conversation.utterance`,properties:e})},onToolCall(e){a(`tavus:tool-call`,e),a(`tavus:protocol-message`,{kind:`tool_call`,event_type:`conversation.tool_call`,properties:e})},onPerception(e){a(`tavus:protocol-message`,e)},onSpeakingState({who:e,state:t,seq:n,turn_idx:r}){let i={state:t,...n===void 0?{}:{seq:n},...r===void 0?{}:{turn_idx:r}};a(`tavus:protocol-message`,{kind:`speaking`,event_type:e===`replica`?t===`started`?`conversation.replica_started_speaking`:`conversation.replica_stopped_speaking`:t===`started`?`conversation.user_started_speaking`:`conversation.user_stopped_speaking`,properties:i})},onMessage(e){a(`tavus:protocol-message`,e)}};return t.__registerSubscriber(e),()=>t.__unregisterSubscriber(e)},[t,a]);let o=O(()=>({shadowHost:r,dispatchEvent:a}),[r,a]);return A(fv.Provider,{value:o,children:[A(`div`,{ref:i,style:`display:contents`}),e]})}var hv=Ie(null);function gv({children:e}){let{config:t}=pt(bi),n=O(()=>Yt(()=>{let e=t.value.customization.style;return e.mode===`dark`||e.mode===`system`&&(globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1)}),[t]),r=O(()=>Yt(()=>{let e=t.value.customization.style;return e.style===`basic`?n.value?`white-black`:`black-white`:n.value?`${e.style}-dark`:e.style}),[t,n]),i=O(()=>Yt(()=>bv(t.value.customization.style)),[t]),a=O(()=>({dataTheme:r,isDark:n,cssVars:i}),[r,n,i]);return A(hv.Provider,{value:a,children:A(`div`,{"data-theme":r.value,style:xv(i.value),class:`contents`,children:e})})}var _v=[0,.125,.25,.5,.75],vv=[0,1,2,3,4],yv=[0,.2,.25,.3];function bv(e){return{"--radius-box":`${_v[e.boxes_radius]??.5}rem`,"--radius-field":`${_v[e.field_radius]??.25}rem`,"--radius-selector":`${_v[e.selectors_radius]??.5}rem`,"--border":`${vv[e.border_width]??1}px`,"--size-field":`${yv[e.fields_size]??.25}rem`,"--size-selector":`${yv[e.selectors_size]??.25}rem`,"--depth":e.depth_effect?`1`:`0`,"--noise":e.noise_effect?`1`:`0`}}function xv(e){return Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`; `)}Ie(null);var Sv=41/2,Cv=23/2,wv=Math.hypot(Sv,Cv);Array.from({length:1008},(e,t)=>{let n=t%42,r=Math.floor(t/42),i=Math.hypot(n-Sv,r-Cv)/wv*.82,a=.34+(n*13+r*7)%34/100;return{delay:`${i.toFixed(3)}s`,opacity:a.toFixed(2)}});var Tv=Ie(null);function Ev({children:e}){let t=D(null);return A(Tv.Provider,{value:{frameRef:t},children:A(`div`,{class:`@container/conversation w-full h-full`,children:A(`div`,{ref:t,class:`relative w-full h-full max-h-screen aspect-video @max-mobile:aspect-9/16 overflow-hidden rounded-box bg-base-100`,children:e})})})}var Dv=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ov=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),kv=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Av=e=>{let t=kv(e);return t.charAt(0).toUpperCase()+t.slice(1)},jv={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Mv=Ie({size:24,color:`currentColor`,strokeWidth:2,absoluteStrokeWidth:!1,class:``}),Nv=()=>pt(Mv),Pv=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Fv=({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,children:i,iconNode:a,class:o=``,...s})=>{let{size:c=24,strokeWidth:l=2,absoluteStrokeWidth:u=!1,color:d=`currentColor`,class:f=``}=Nv()??{},p=r??u?Number(n??l)*24/Number(t??c):n??l;return se(`svg`,{...jv,width:t??c??24,height:t??c??24,stroke:e??d,"stroke-width":p,class:Dv(`lucide`,f,o),...!i&&!Pv(s)&&{"aria-hidden":`true`},...s},[...a.map(([e,t])=>se(e,t)),...be(i)])},Iv=(e,t)=>{let n=({class:n=``,className:r=``,children:i,...a})=>se(Fv,{...a,iconNode:t,class:Dv(`lucide-${Ov(Av(e))}`,`lucide-${Ov(e)}`,n,r)},i);return n.displayName=Av(e),n},Lv=Iv(`captions`,[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]]),Rv=Iv(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),zv=Iv(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Bv=Iv(`camera-off`,[[`path`,{d:`M14.564 14.558a3 3 0 1 1-4.122-4.121`,key:`1rnrzw`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M20 20H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 .819-.175`,key:`1x3arw`}],[`path`,{d:`M9.695 4.024A2 2 0 0 1 10.004 4h3.993a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v7.344`,key:`1i84u0`}]]),Vv=Iv(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Hv=Iv(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Uv=Iv(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),Wv=Iv(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Gv=Iv(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Kv=Iv(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),qv=Iv(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),Jv=Iv(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),Yv=Iv(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Xv=Iv(`monitor-up`,[[`path`,{d:`m9 10 3-3 3 3`,key:`11gsxs`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]),Zv=Iv(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Qv=Iv(`phone-off`,[[`path`,{d:`M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272`,key:`1wngk7`}],[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}],[`path`,{d:`M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473`,key:`10hv5p`}]]),$v=Iv(`picture-in-picture-2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),ey=Iv(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ty=Iv(`shrink`,[[`path`,{d:`m15 15 6 6m-6-6v4.8m0-4.8h4.8`,key:`17vawe`}],[`path`,{d:`M9 19.8V15m0 0H4.2M9 15l-6 6`,key:`chjx8e`}],[`path`,{d:`M15 4.2V9m0 0h4.8M15 9l6-6`,key:`lav6yq`}],[`path`,{d:`M9 4.2V9m0 0H4.2M9 9 3 3`,key:`1pxi2q`}]]),ny=Iv(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),ry=Iv(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),iy=Iv(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ay=Iv(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function oy(e,t){return({size:n=`var(--icon-size, 1.5rem)`,class:r,"aria-label":i})=>A(`span`,{class:r,role:`img`,"aria-label":i??t,children:A(e,{size:n})})}var sy={close:oy(ay,`Close`),leave:oy(Qv,`Leave call`),more:oy(Rv,`More`),error:oy(zv,`Error`),mic:oy(Jv,`Microphone`),"mic-off":oy(qv,`Microphone muted`),cam:oy(Vv,`Camera`),"cam-off":oy(Bv,`Camera off`),"screen-share":oy(Xv,`Screen share`),pip:oy($v,`Picture in picture`),user:oy(ry,`User`),"face-smile":oy(ny,`Camera off`),captions:oy(Lv,`Closed captions`),chat:oy(Kv,`Chat`),fullscreen:oy(Gv,`Enter fullscreen`),"fullscreen-exit":oy(Yv,`Exit fullscreen`),expand:oy(Uv,`Expand`),collapse:oy(ty,`Collapse`),send:oy(ey,`Send`),"external-link":oy(Wv,`External link`),clock:oy(Hv,`Clock`),moon:oy(Zv,`Unavailable`),users:oy(iy,`Busy`)},cy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M16 19H4v-2h12v2ZM4 17H2V7h2v10Zm14-8h2V7h2v10h-2v-2h-2v2h-2V7h2v2Zm-2-2H4V5h12v2Z"/></svg>`,ly=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 21h-2v-2h2v2Zm-6-2H4v-2h10v2Zm4 0h-2v-2h2v2Zm4 0h-2v-2h-2v-2h-2v-2h-2V7h2v2h2V7h2V5h2v14ZM4 17H2V7h2v10Zm12 0h-2v-2h2v2Zm-2-2h-2v-2h2v2Zm-2-2h-2v-2h2v2Zm-2-2H8V9h2v2ZM8 9H6V7h2v2ZM6 7H4V5h2v2Zm8 0h-4V5h4v2ZM4 5H2V3h2v2Z"/></svg>`,uy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M3 4h18v2H3zm0 14h18v2H3zM1 6h2v12H1zm20 0h2v12h-2zM5 10h2v4H5zm8 0h2v4h-2zM7 8h4v2H7zm0 6h4v2H7zm8 0h4v2h-4zm0-6h4v2h-4z"/></svg>`,dy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M22 22h-2v-2h-2v-2h2v-8h2v12Zm-4-4h-8v-2h8v2ZM4 12h2v2H4v2H2V4h2v8Zm6 4H8v-6h2v6Zm10-6H10V8h10v2Zm-4-4h-2V4h2v2Zm-2-2H4V2h10v2Z"/></svg>`,fy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H6v-2h12v2ZM6 20H4v-2h2v2Zm14 0h-2v-2h2v2ZM4 18H2V6h2v12Zm18 0h-2V6h2v12Zm-5-1h-2v-2h2v2Zm-2-2h-2v-2h2v2Zm-2-2h-2V6h2v7ZM6 6H4V4h2v2Zm14 0h-2V4h2v2Zm-2-2H6V2h12v2Z"/></svg>`,py=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H6v-2h12v2ZM6 20H4v-2h2v2Zm14 0h-2v-2h2v2ZM4 18H2V6h2v12Zm4 0H6v-2h2v2Zm14 0h-2V6h2v12Zm-12-2H8v-2h2v2Zm2-2h-2v-2h2v2Zm2-2h-2v-2h2v2Zm2-2h-2V8h2v2Zm2-2h-2V6h2v2ZM6 6H4V4h2v2Zm14 0h-2V4h2v2Zm-2-2H6V2h12v2Z"/></svg>`,my=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M7 19h2v-2h2v-2h2v2h2v2h2v2H7v-2Zm13-6H4v-2h16v2Zm-3-8h-2v2h-2v2h-2V7H9V5H7V3h10v2Z"/></svg>`,hy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 22H4v-2h16v2ZM4 20H2V4h2v16Zm18 0h-2V4h2v16Zm-9-2h-2v-2h2v2Zm0-4h-2V6h2v8Zm7-10H4V2h16v2Z"/></svg>`,gy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M15 19h-2v2h-2v-2H9v-2H7v-2h10v2h-2v2Zm5-6H4v-2h16v2Zm-7-8h2v2h2v2H7V7h2V5h2V3h2v2Z"/></svg>`,_y=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M8 22H4v-2h4v2Zm12 0h-4v-2h4v2ZM4 20H2v-4h2v4Zm18 0h-2v-4h2v4Zm-6-3H8v-2h8v2Zm-8-2H6V9h2v6Zm10 0h-2V9h2v6Zm-2-6H8V7h8v2ZM4 8H2V4h2v4Zm18 0h-2V4h2v4ZM8 4H4V2h4v2Zm12 0h-4V2h4v2Z"/></svg>`,vy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H6v-2h12v2ZM6 20H4V4h2v16Zm14 0h-2v-3h2v3ZM16 9h2v2h2v2h-2v2h-2v2h-2v-4H8v-2h6V7h2v2Zm4-2h-2V4h2v3Zm-2-3H6V2h12v2Z"/></svg>`,yy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M13 22h-2v-2H8v-2h8v2h-3v2Zm-5-4H6v-2h2v2Zm10 0h-2v-2h2v2ZM6 16H4v-6h2v6Zm8 0h-4v-2h4v2Zm6 0h-2v-6h2v6Zm-10-2H8V4h2v10Zm6 0h-2V4h2v10ZM14 4h-4V2h4v2Z"/></svg>`,by=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M13 22h-2v-2H8v-2h8v2h-3v2Zm9 0h-2v-2h2v2Zm-2-2h-2v-2h2v2ZM8 18H6v-2h2v2Zm10 0h-2v-2h2v2ZM6 16H4v-6h2v6Zm8-2h2v2h-6v-2h2v-2h2v2Zm-4-4h2v2h-2v2H8V8h2v2Zm10 4h-2v-4h2v4Zm-4-4h-2V4h2v6ZM8 8H6V6h2v2ZM6 6H4V4h2v2ZM4 4H2V2h2v2Zm10 0h-4V2h4v2Z"/></svg>`,xy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H8v-2h10v2ZM8 20H6v-2h2v2Zm12 0h-2v-2h2v2ZM6 18H4v-2h2v2Zm16 0h-2v-4h-2v-2h2v-2h2v8ZM4 16H2V6h2v10Zm14 0h-6v-2h6v2Zm-6-2h-2v-2h2v2Zm-2-2H8V6h2v6ZM6 6H4V4h2v2Zm8-2h-2v2h-2V4H6V2h8v2Z"/></svg>`,Sy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M5 15H3v-2h2v2Zm8 0h-2v-2h2v2Zm8 0h-2v-2h2v2ZM3 13H1v-2h2v2Zm4 0H5v-2h2v2Zm4 0H9v-2h2v2Zm4 0h-2v-2h2v2Zm4 0h-2v-2h2v2Zm4 0h-2v-2h2v2ZM5 11H3V9h2v2Zm8 0h-2V9h2v2Zm8 0h-2V9h2v2Z"/></svg>`,Cy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 20H4v-2h16v2ZM4 18H2V6h2v12Zm18 0h-2V6h2v12ZM18 8v6h-8V8h8Zm2-2H4V4h16v2Zm-4 4h-4v2h4v-2Z"/></svg>`,wy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 18h-7v2h3v2H8v-2h3v-2H4v-2h16v2ZM4 16H2V4h2v12Zm18 0h-2v-6h2v6Zm-6-6h-2V8h2v2Zm2-2h-2V6h2v2Zm4-6v6h-2V6h-2V4h-2V2h6Zm-8 2H4V2h10v2Z"/></svg>`,Ty=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M4 19h4v2H2v-8h2v6Zm8 0H8v-2h4v2Zm4-2h-4v-2h4v2Zm4-2h-4v-2h4v2Zm-10-2H4v-2h6v2Zm12 0h-2v-2h2v2ZM8 5H4v6H2V3h6v2Zm12 6h-4V9h4v2Zm-4-2h-4V7h4v2Zm-4-2H8V5h4v2Z"/></svg>`,Ey=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M6 22H4v-4h2v4Zm14 0h-2v-4h2v4ZM8 18H6v-2h2v2Zm10 0h-2v-2h2v2Zm-2-2H8v-2h8v2Zm-1-4H9v-2h6v2Zm-6-2H7V4h2v6Zm8 0h-2V4h2v6Zm-2-6H9V2h6v2Z"/></svg>`,Dy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M2 22H0v-4h2v4Zm14 0h-2v-4h2v4Zm8 0h-2v-4h2v4ZM4 18H2v-2h2v2Zm10 0h-2v-2h2v2Zm8 0h-2v-2h2v2Zm-10-2H4v-2h8v2Zm8 0h-4v-2h4v2Zm-9-4H5v-2h6v2Zm8 0h-4v-2h4v2ZM5 10H3V4h2v6Zm8 0h-2V4h2v6Zm8 0h-2V4h2v6ZM11 4H5V2h6v2Zm8 0h-4V2h4v2Z"/></svg>`,Oy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 22H4v-2h16v2ZM4 20H2v-6H0v-2h2V8h2v12Zm18-8h2v2h-2v6h-2V8h2v4Zm-8 6h-4v-2h4v2Zm-4-2H8v-2h2v2Zm6 0h-2v-2h2v2Zm-6-4H8v-2h2v2Zm6 0h-2v-2h2v2Zm-3-6h7v2H4V6h7V4h2v2Zm4-2h-4V2h4v2Z"/></svg>`,ky=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M17 21H5v-2h12v2ZM5 19H3V7h2v12Zm14 0h-2v-6h2v6Zm-8-4H9v-2h2v2Zm2-2h-2v-2h2v2Zm2-2h-2V9h2v2Zm6 0h-2V7h-2V5h-4V3h8v8Zm-4-2h-2V7h2v2Zm-6-2H5V5h6v2Z"/></svg>`;function Ay(e){return e.replace(/\s(width|height)="\d+"/g,``)}function jy(e,t){let n=Ay(e);return({size:e=`var(--icon-size, 1.5rem)`,class:r,"aria-label":i})=>A(`span`,{class:r,role:`img`,"aria-label":i??t,style:{display:`inline-flex`,width:e,height:e},dangerouslySetInnerHTML:{__html:n.replace(`<svg`,`<svg width="100%" height="100%"`)}})}var My={pixelarticons:{close:jy(py,`Close`),leave:jy(vy,`Leave call`),more:jy(Sy,`More`),error:jy(hy,`Error`),mic:jy(yy,`Microphone`),"mic-off":jy(by,`Microphone muted`),cam:jy(cy,`Camera`),"cam-off":jy(ly,`Camera off`),"screen-share":jy(wy,`Screen share`),pip:jy(Cy,`Picture in picture`),user:jy(Ey,`User`),"face-smile":jy(Oy,`Camera off`),captions:jy(uy,`Closed captions`),chat:jy(dy,`Chat`),fullscreen:jy(_y,`Enter fullscreen`),"fullscreen-exit":jy(my,`Exit fullscreen`),expand:jy(gy,`Expand`),collapse:jy(my,`Collapse`),send:jy(Ty,`Send`),"external-link":jy(ky,`External link`),clock:jy(fy,`Clock`),moon:jy(xy,`Unavailable`),users:jy(Dy,`Busy`)},lucide:sy};function Ny({name:e,...t}){let{config:n}=K_(),r=(My[n.value.customization.style.icon_library]??My.pixelarticons)[e];return A(r,{...t})}var Py=`Ready when you are`,Fy=`Start the conversation`;function Iy(e){return typeof e==`string`&&e.length>0?e:``}function Ly(e){let t=Iy(e.replica_thumbnail_image_url)||null,n=Iy(e.replica_thumbnail_video_url)||null;return!t&&!n?null:{imageUrl:t,videoUrl:n}}function Ry(e){let{preview:t}=e.customization,{background:n}=t,r=Ly(e),i;i=n.type?n.type:r?`replica`:`background-gradient`;let a=Iy(n.url);return{title:t.title||Py,description:t.description||``,btn_title:t.btn_title||Fy,background:{type:i,url:a}}}var zy={backgroundImage:`linear-gradient(to bottom right, var(--color-primary), var(--color-base-300))`},By=`#t=0.1`;function Vy(e){return e.includes(`#`)?e:`${e}${By}`}function Hy({replica:e,fallback:t=null}){let[n,r]=T(!1);E(()=>{r(!1)},[e.imageUrl]);let i=`absolute inset-0 w-full h-full object-cover`;return e.imageUrl&&!n?A(`img`,{class:i,src:e.imageUrl,loading:`lazy`,alt:``,onError:()=>r(!0)}):e.videoUrl?A(`video`,{class:i,src:Vy(e.videoUrl),muted:!0,playsinline:!0,preload:`metadata`,controls:!1}):A(ue,{children:t})}function Uy({variant:e,replica:t}){let[n,r]=T(!1);return E(()=>{r(!1)},[e.url]),e.type===`replica`&&t?A(Hy,{replica:t,fallback:A(`div`,{class:`absolute inset-0`,style:zy})}):e.type===`custom-image`&&e.url&&!n?A(`img`,{class:`absolute inset-0 w-full h-full object-cover`,src:e.url,loading:`lazy`,alt:``,onError:()=>r(!0)}):A(`div`,{class:`absolute inset-0`,style:zy})}function Wy({className:e=``}){let{config:t}=K_(),n=Ry(t.value),r=Ly(t.value);return A(`div`,{class:`relative size-16 shrink-0 rounded-box overflow-hidden bg-base-300 ${e}`,children:A(Uy,{variant:n.background,replica:r})})}var Gy=`absolute inset-0 bg-base-100 text-base-content flex flex-col items-center justify-center gap-6 px-6 py-8 text-center overflow-y-auto motion-safe:animate-[tavusFadeUp_280ms_ease-out]`;function Ky({children:e,class:t,role:n,"aria-live":r}){return A(`div`,{class:t?`${Gy} ${t}`:Gy,role:n,"aria-live":r,children:e})}function qy({title:e,description:t,media:n,children:r,overlay:i}){return A(Ky,{children:[n===void 0?A(Wy,{}):n,(e||t)&&A(`div`,{class:`flex flex-col items-center gap-3 max-w-sm`,children:[e&&A(`h2`,{class:`text-lg font-medium leading-snug`,children:e}),t&&A(`p`,{class:`text-base text-base-content/60 tracking-wide leading-snug`,children:t})]}),r&&A(`div`,{class:`flex flex-col items-center gap-3`,children:r}),i]})}var Jy={daily_limit:{title:`PAL is at today's limit`,description:`This PAL can take more conversations tomorrow.`},total_limit:{title:`PAL is unavailable`,description:`This PAL isn't available right now. Please check back later.`},busy:{title:`PAL is in another conversation`,description:`Please try again in a moment.`},error:{title:`Couldn't load this PAL`,description:`This PAL couldn't be loaded. Please try again later.`}};function Yy(e,t){let n=t?.[e];return{title:n?.title||Jy[e].title,description:n?.description||Jy[e].description}}var Xy={daily_limit:`clock`,total_limit:`moon`,busy:`users`,error:`error`};function Zy({cause:e}){return A(`div`,{class:`flex size-16 shrink-0 items-center justify-center rounded-box bg-base-200 text-base-content/70`,children:A(Ny,{name:Xy[e],size:`2rem`})})}function Qy({cause:e,canRetry:t,onRetry:n,onCancel:r}){let{config:i}=K_(),a=i.value.customization?.unavailable_screen,o=Yy(e,a),s=a?.cta??[],c=e===`busy`||s.length>0||!!r;return A(qy,{media:A(Zy,{cause:e}),title:o.title,description:o.description,children:c&&A(`div`,{class:`flex flex-wrap items-center justify-center gap-2`,children:[e===`busy`&&A(`button`,{type:`button`,class:`btn btn-neutral rounded-box`,disabled:!t,onClick:n,children:`Try again`}),s.map(e=>A(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`btn btn-outline rounded-box`,children:e.title},e.url)),r&&A(`button`,{type:`button`,class:`btn btn-ghost`,onClick:r,children:`Close`})]})})}function $y(){let e=pt(a_);return{state:e.flowSignal.value,isStarting:e.isStarting,unavailableCause:e.unavailableCause,canRetry:e.canRetry,start:e.start,join:e.join,cancel:e.cancel,leave:e.leave,restart:e.restart}}var eb=`Thanks for joining`,tb=`You can start a new conversation whenever you're ready.`,nb=`Start a new conversation`;function rb(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`||t.protocol===`mailto:`}catch{return!1}}function ib({text:e,onRestart:t}){let{config:n}=K_(),r=n.value.customization.after_call,i=r.cta.filter(e=>rb(e.url));return A(qy,{title:r.title||e?.title||eb,description:r.description||e?.description||tb,children:[A(`button`,{type:`button`,class:`btn btn-neutral rounded-box`,onClick:t,children:e?.restart||nb}),i.length>0&&A(`div`,{class:`flex flex-wrap items-center justify-center gap-2`,children:i.map(e=>A(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`btn btn-outline rounded-box`,children:e.title},e.url))})]})}function ab(){let e=ah(),t=Uh(),{isOff:n}=r_(t),{camState:r}=Zg();return{isCamReady:O(()=>r===`granted`,[r]),isCamMuted:n,localSessionId:t,onToggleCamera:k(()=>{e?.setLocalVideo(n)},[e,n])}}function ob(){let e=ah(),t=Uh(),{isOff:n}=Kg(t),{micState:r}=Zg();return{isMicReady:O(()=>r===`granted`,[r]),isMicMuted:n,localSessionId:t,onToggleMicrophone:k(()=>{e?.setLocalAudio(n)},[e,n])}}function sb(){let e=ah(),t=Uh(),{isOff:n}=t_(t),r=!n;return{isScreenSharing:r,localSessionId:t,onToggleScreenshare:k(()=>{r?e?.stopScreenShare():e?.startScreenShare({displayMediaOptions:{audio:!1,selfBrowserSurface:`exclude`,surfaceSwitching:`include`,video:{width:1920,height:1080}}})},[e,r])}}function cb(e){switch(e){case`blocked`:return`blocked`;case`in-use`:return`in-use`;case`not-found`:return`not-found`;case`not-supported`:case`undefined-mediadevices`:return`unsupported`;default:return null}}function lb(e,t,n,r){return e===`granted`&&r?`granted`:cb(e)||(t===`denied`?`blocked`:t===`prompt`?e===`granted`&&n?`granted`:`prompt`:t===`granted`?n?`checking`:`prompt`:e===`granted`?`granted`:n?`checking`:`prompt`)}function ub(e,t){let n=e===`granted`,r=e===`blocked`||e===`in-use`||e===`not-found`||e===`unsupported`;return{status:e,isGranted:n,isBlocked:r,canRequest:e===`prompt`,needsAttention:r||e===`prompt`&&t!==`granted`}}function db(e){let[t,n]=T(null);return E(()=>{let t=!1,r=navigator.permissions;if(r?.query)return r.query({name:e}).then(e=>{t||(n(e.state),e.onchange=()=>{t||n(e.state)})}).catch(()=>{}),()=>{t=!0}},[e]),t}function fb(){let e=ah(),t=Mg(),n=Uh(),{micState:r,camState:i,currentMic:a,currentCam:o}=Zg(),s=db(`microphone`),c=db(`camera`),l=t===`joined-meeting`||!!n,[u,d]=T(!1),[f,p]=T(!1),m=k(()=>{e&&(d(!0),l?e.setLocalAudio(!0):Promise.resolve(e.startCamera({videoSource:!1})).catch(()=>{}))},[e,l]),h=k(async()=>{if(e){p(!0);try{await e.setInputDevicesAsync({videoSource:!0})}catch{}e.setLocalVideo(!0)}},[e]);return{mic:O(()=>ub(lb(r,s,u,!!a),s),[r,s,u,a]),camera:O(()=>ub(lb(i,c,f,!!o),c),[i,c,f,o]),requestMic:m,requestCamera:h}}var pb={microphone:`microphone`,camera:`camera`};function mb({class:e}){return A(`svg`,{class:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[A(`circle`,{cx:`7`,cy:`8`,r:`2.2`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{cx:`16`,cy:`16`,r:`2.2`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`path`,{d:`M2 8h2.5M9.5 8H22M2 16h11.5M18.5 16H22`,stroke:`currentColor`,"stroke-width":`1.6`,"stroke-linecap":`round`})]})}function hb(){return A(`svg`,{viewBox:`0 0 240 180`,class:`w-full h-auto text-base-content/70`,fill:`none`,"aria-hidden":`true`,children:[A(`rect`,{x:`10`,y:`20`,width:`220`,height:`150`,rx:`10`,stroke:`currentColor`,"stroke-width":`2`}),A(`path`,{d:`M10 46h220`,stroke:`currentColor`,"stroke-width":`2`}),A(`circle`,{cx:`26`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{cx:`40`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{cx:`54`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`path`,{d:`M78 33h14M86 27l-6 6 6 6M104 27v12`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),A(`rect`,{x:`118`,y:`25`,width:`96`,height:`16`,rx:`8`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{class:`text-info`,cx:`128`,cy:`33`,r:`11`,fill:`currentColor`,opacity:`0.18`}),A(`circle`,{class:`text-info`,cx:`128`,cy:`33`,r:`11`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`g`,{class:`text-info`,transform:`translate(120 25) scale(0.66)`,children:A(mb,{})}),A(`g`,{transform:`translate(34 78)`,children:[A(`rect`,{x:`0`,y:`8`,width:`34`,height:`26`,rx:`5`,stroke:`currentColor`,"stroke-width":`2`}),A(`path`,{d:`M34 16l14-8v26l-14-8`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linejoin":`round`})]}),A(`g`,{transform:`translate(40 120)`,children:[A(`rect`,{x:`6`,y:`0`,width:`14`,height:`24`,rx:`7`,stroke:`currentColor`,"stroke-width":`2`}),A(`path`,{d:`M0 20a13 13 0 0 0 26 0M13 33v8`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})]}),A(`path`,{d:`M150 64l34 14-14 4-2 16-18-34Z`,fill:`currentColor`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linejoin":`round`})]})}var gb=P(({device:e,onClose:t})=>{let n=pb[e];return E(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),A(`div`,{class:`absolute inset-0 z-50 flex items-center justify-center p-4 bg-black/50 motion-safe:animate-[tavusFadeUp_180ms_ease-out]`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tavus-blocked-title`,onClick:t,children:A(`div`,{class:`relative w-full max-w-md rounded-box bg-base-100 text-base-content shadow-xl overflow-hidden`,onClick:e=>e.stopPropagation(),children:[A(`button`,{type:`button`,class:`btn btn-sm btn-circle btn-ghost absolute top-2 right-2 z-10`,onClick:t,"aria-label":`Close`,children:A(Ny,{name:`close`,size:`1.1rem`})}),A(`div`,{class:`grid @3xl:grid-cols-[1fr_1.2fr] gap-4 p-5 @max-md:p-4`,children:[A(`div`,{class:`flex items-center justify-center @max-md:hidden`,children:A(hb,{})}),A(`div`,{class:`flex flex-col gap-4`,children:[A(`h2`,{id:`tavus-blocked-title`,class:`text-lg font-semibold leading-snug pr-6`,children:[`Access to your `,n,` is blocked`]}),A(`ol`,{class:`flex flex-col gap-3 text-sm`,children:[A(`li`,{class:`flex items-start gap-2`,children:[A(`span`,{class:`font-semibold tabular-nums`,children:`1.`}),A(`span`,{class:`leading-snug`,children:[`Click the `,A(mb,{class:`inline-block align-text-bottom h-4 w-4 mx-0.5`}),` `,`settings icon in your browser's address bar`]})]}),A(`li`,{class:`flex items-start gap-2`,children:[A(`span`,{class:`font-semibold tabular-nums`,children:`2.`}),A(`span`,{class:`leading-snug`,children:[`Allow `,n,` access, then reload the page`]})]})]}),A(`button`,{type:`button`,class:`btn btn-neutral btn-sm self-start`,onClick:t,children:`Got it`})]})]})]})})}),_b=Ie({open:()=>{},close:()=>{}});function vb(){return pt(_b)}function yb({children:e}){let[t,n]=T(null),r=k(e=>n(e),[]),i=k(()=>n(null),[]),a=O(()=>({open:r,close:i}),[r,i]);return A(_b.Provider,{value:a,children:[e,t&&A(gb,{device:t,onClose:i})]})}var bb=P(()=>A(`span`,{"aria-hidden":`true`,class:`absolute -top-0.5 -right-0.5 z-20 flex h-4 w-4 items-center justify-center rounded-full bg-warning text-warning-content text-[0.6rem] font-bold leading-none ring-2 ring-base-100 pointer-events-none`,children:`!`})),xb=`select-control-pill relative inline-flex items-center bg-neutral text-neutral-content`,Sb=`absolute inset-0 w-full h-full opacity-0 cursor-pointer appearance-none disabled:cursor-not-allowed`,Cb=`absolute right-1.5 top-1/2 -translate-y-1/2 pointer-events-none flex items-center`,wb=`absolute left-0 top-0 h-full aspect-square flex items-center justify-center pointer-events-none`,Tb=`absolute left-0 top-0 z-10 btn btn-control btn-neutral`;function Eb(){return A(`svg`,{style:{width:`var(--chevron-size, 0.75rem)`,height:`var(--chevron-size, 0.75rem)`},viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:A(`path`,{d:`M4 6L8 10L12 6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})})}function Db(){let e=Uh(),t=D(null),n=D(void 0);return Gg(e??``,k(e=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let n=Math.max(0,Math.min(1,e**.6));t.current?.style.setProperty(`--mic-level`,String(n))})},[])),A(`span`,{ref:t,"aria-hidden":`true`,class:`pointer-events-none absolute inset-x-0 bottom-0 z-0 bg-success/70`,style:{"--mic-level":`0`,height:`calc(var(--mic-level, 0) * 100%)`,transition:`height 100ms ease-out`}})}function Ob({value:e,devices:t,disabled:n,onChange:r,label:i}){return A(ue,{children:[A(`select`,{class:Sb,value:e,onChange:e=>r(e.target.value),disabled:n,"aria-label":i,children:t.map(({device:e})=>A(`option`,{value:e.deviceId,children:e.label},e.deviceId))}),A(`span`,{class:Cb,children:A(Eb,{})})]})}function kb(e){return A(`div`,{class:xb,children:A(Ob,{...e})})}function Ab({iconName:e,...t}){return A(`div`,{class:xb,children:[A(`span`,{class:wb,"aria-hidden":`true`,children:A(Ny,{name:e})}),A(Ob,{...t})]})}var jb=P(({level:e=!1})=>{let{onToggleMicrophone:t,isMicReady:n,isMicMuted:r}=ob(),{microphones:i,currentMic:a,setMicrophone:o}=Zg();if(!a||(i?.length??0)<=1)return A(Pb,{level:e});let s=e&&n&&!r;return A(`div`,{class:`relative inline-flex items-center`,children:[A(kb,{value:a?.device?.deviceId,devices:i||[],disabled:!n,onChange:e=>o(e),label:`Select microphone`}),A(`button`,{type:`button`,onClick:t,disabled:!n,class:`${Tb} overflow-hidden`,"aria-label":r?`Unmute microphone`:`Mute microphone`,"aria-pressed":r,children:[s&&A(Db,{}),A(`span`,{class:`relative z-10 inline-flex`,children:A(Ny,{name:r||!n?`mic-off`:`mic`})})]})]})});function Mb(){let{onToggleCamera:e,isCamMuted:t}=ab(),{camera:n,requestCamera:r}=fb(),{open:i}=vb(),a=n.isGranted&&!t;return{isOn:a,onClick:()=>{if(n.isBlocked)return i(`camera`);if(a)return e();r()},label:a?`Turn camera off`:n.isGranted?`Turn camera on`:`Enable camera`,needsAttention:n.needsAttention}}var Nb=P(()=>{let{isCamReady:e}=ab(),{currentCam:t,cameras:n,setCamera:r}=Zg(),i=Mb();return!t||(n?.length??0)<=1?A(Fb,{}):A(`div`,{class:`relative inline-flex items-center`,children:[A(kb,{value:t?.device?.deviceId,devices:n||[],disabled:!e,onChange:e=>r(e),label:`Select camera`}),A(`button`,{type:`button`,onClick:i.onClick,class:Tb,"aria-label":i.label,"aria-pressed":!i.isOn,children:A(Ny,{name:i.isOn?`cam`:`cam-off`})})]})}),Pb=P(({level:e=!1})=>{let{onToggleMicrophone:t,isMicMuted:n}=ob(),{mic:r,requestMic:i}=fb(),{open:a}=vb(),o=()=>{if(r.isGranted)return t();if(r.isBlocked)return a(`microphone`);i()},s=r.isGranted?n?`Unmute microphone`:`Mute microphone`:`Allow microphone access`,c=e&&r.isGranted&&!n;return A(`span`,{class:`relative inline-flex`,children:[A(`button`,{type:`button`,onClick:o,class:`btn btn-control btn-neutral relative overflow-hidden`,"aria-label":s,"aria-pressed":r.isGranted?n:void 0,children:[c&&A(Db,{}),A(`span`,{class:`relative z-10 inline-flex`,children:A(Ny,{name:n||!r.isGranted?`mic-off`:`mic`})})]}),r.needsAttention&&A(bb,{})]})}),Fb=P(()=>{let{isOn:e,onClick:t,label:n,needsAttention:r}=Mb();return A(`span`,{class:`relative inline-flex`,children:[A(`button`,{type:`button`,onClick:t,class:`btn btn-control btn-neutral`,"aria-label":n,"aria-pressed":!e,children:A(Ny,{name:e?`cam`:`cam-off`})}),r&&A(bb,{})]})});P(({compact:e=!1}={})=>{let{isMicReady:t}=ob(),{microphones:n,currentMic:r,setMicrophone:i}=Zg();return(n?.length??0)<=1?null:A(Ab,{iconName:`mic`,value:r?.device?.deviceId,devices:n,disabled:!t,onChange:e=>i(e),label:`Select microphone`,compact:e})}),P(({compact:e=!1}={})=>{let{isCamReady:t}=ab(),{currentCam:n,cameras:r,setCamera:i}=Zg();return(r?.length??0)<=1?null:A(Ab,{iconName:`cam`,value:n?.device?.deviceId,devices:r,disabled:!t,onChange:e=>i(e),label:`Select camera`,compact:e})});var Ib=P((e={})=>{let{onToggleScreenshare:t,isScreenSharing:n}=sb();return A(`button`,{type:`button`,onClick:t,class:`btn btn-control ${n?`btn-primary`:`btn-neutral`}`,"aria-label":n?`Stop screen share`:`Start screen share`,"aria-pressed":n,children:A(Ny,{name:`screen-share`})})});function Lb(e){let t=pt(L_);if(!t)throw Error(`useConversation must be used within ConversationProvider`);return E(()=>{if(e)return t.__registerSubscriber(e),()=>t.__unregisterSubscriber(e)},[e]),t}var Rb=Ie(null);function zb({children:e,defaultEnabled:t=!1}){let[n,r]=T(t),i=k(()=>r(e=>!e),[]),a=O(()=>({isEnabled:n,toggle:i}),[n,i]);return A(Rb.Provider,{value:a,children:e})}function Bb(){let e=pt(Rb);if(!e)throw Error(`ClosedCaptions components must be used within <ClosedCaptionsProvider>`);return e}var Vb=P(()=>{let{isEnabled:e,toggle:t}=Bb();return A(`button`,{type:`button`,onClick:t,"aria-pressed":e,class:`btn btn-control ${e?`btn-primary`:`btn-neutral`}`,"aria-label":e?`Hide captions`:`Show captions`,children:A(Ny,{name:`captions`,"aria-label":e?`Closed Captions On`:`Closed Captions Off`})})}),Hb=P(()=>{let{isEnabled:e}=Bb(),{captionText:t,captionRole:n}=Lb(),r=t.value,i=n.value;return!e||!r?null:A(`div`,{class:`absolute bottom-24 left-1/2 -translate-x-1/2 max-w-[80%] px-4 py-2 rounded-box bg-black/60 text-white z-10`,role:`status`,"aria-live":`polite`,children:A(`div`,{class:`text-sm leading-5 max-h-15 overflow-hidden flex flex-col justify-end text-center`,children:A(`div`,{children:[A(`span`,{class:`text-xs ${i===`replica`?`text-secondary`:`text-primary`} mr-2`,children:i===`replica`?`PAL`:`You`}),r]})})})}),Ub=Ie(null);function Wb({children:e,defaultOpen:t=!1}){let[n,r]=T(t),i=k(()=>r(e=>!e),[]),a=k(()=>r(!1),[]),o=O(()=>({isOpen:n,toggle:i,close:a}),[n,i,a]);return A(Ub.Provider,{value:o,children:e})}function Gb(){let e=pt(Ub);if(!e)throw Error(`Chat components must be used within <ChatProvider>`);return e}var Kb=P((e={})=>{let{isOpen:t,toggle:n}=Gb();return A(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":t?`Close chat`:`Open chat`,class:`btn btn-control ${t?`btn-primary`:`btn-neutral`}`,children:A(Ny,{name:`chat`})})}),qb=P(({message:e})=>{let t=e.sender===`user`;return A(`li`,{class:`flex flex-col gap-1 ${t?`items-end`:`items-start`}`,children:[A(`span`,{class:`text-xs ${t?`text-primary`:`text-secondary`}`,children:t?`You`:`PAL`}),A(`span`,{class:`px-3 py-2 rounded-field text-sm max-w-[80%] ${t?`bg-primary text-primary-content`:`bg-base-200 text-base-content`}`,children:e.text})]})}),Jb=P(()=>{let{isOpen:e,close:t}=Gb(),{chatMessages:n,sendChat:r,session:i}=Lb(),a=i.value?.conversationId??null,o=n.value,[s,c]=T(``),l=D(null);E(()=>{let e=l.current;e&&(e.scrollTop=e.scrollHeight)},[o.length]);let u=k(()=>{let e=s.trim();!e||!a||(r(e),c(``))},[s,r,a]),d=k(e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),u())},[u]),f=!!s.trim()&&!!a;return A(`aside`,{class:`absolute top-0 right-0 w-80 h-full bg-base-100 border-l border-base-300 flex flex-col z-30 transition-transform ${e?`translate-x-0`:`translate-x-full`} @max-mobile:w-full`,"aria-hidden":!e,inert:!e,children:[A(`header`,{class:`flex items-center justify-between px-4 py-3 border-b border-base-300`,children:[A(`span`,{class:`font-medium text-base-content`,children:`Chat`}),A(`button`,{type:`button`,class:`btn btn-ghost btn-sm btn-circle`,onClick:t,"aria-label":`Close chat`,children:A(Ny,{name:`close`,size:20})})]}),A(`ul`,{ref:l,class:`flex-1 overflow-y-auto p-4 flex flex-col gap-3`,role:`log`,"aria-live":`polite`,children:o.length===0?A(`li`,{class:`text-center text-sm opacity-70`,children:a?`Send a message to start the conversation.`:`Connecting…`}):o.map(e=>A(qb,{message:e},e.id))}),A(`form`,{class:`flex items-end gap-2 p-3 border-t border-base-300`,onSubmit:e=>{e.preventDefault(),u()},children:[A(`textarea`,{class:`textarea textarea-bordered textarea-sm flex-1 resize-none`,value:s,onChange:e=>c(e.target.value),onKeyDown:d,placeholder:a?`Type a message…`:`Connecting…`,disabled:!a,rows:1,"aria-label":`Message`}),A(`button`,{type:`submit`,class:`btn btn-primary btn-sm btn-circle`,disabled:!f,"aria-label":`Send message`,children:A(Ny,{name:`send`,size:18})})]})]})});function Yb({label:e}){return A(Ky,{role:`status`,"aria-live":`polite`,class:`z-2`,children:[A(Wy,{}),A(`div`,{class:`flex flex-col items-center gap-3`,children:[A(`span`,{class:`loading loading-spinner loading-md text-base-content`}),A(`span`,{class:`text-base font-medium`,children:e})]})]})}var Xb=P(()=>A(Yb,{label:`Connecting`})),Zb=P(()=>A(Yb,{label:`Leaving`}));function Qb({active:e,onToggle:t,tooltip:n}){return A(`button`,{type:`button`,onClick:t,class:`btn btn-control ${e?`btn-info`:`btn-ghost`}`,"aria-label":n??(e?`Exit fullscreen`:`Enter fullscreen`),title:n,children:A(Ny,{name:e?`fullscreen-exit`:`fullscreen`})})}var $b=P(({id:e})=>{let t=Gh()===e,n=D(null),r=D(null),i=D(null),a=D(void 0);Gg(e,k(e=>{a.current&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{let t=Number(Math.max(.01,e).toFixed(2));n.current&&r.current&&i.current&&(n.current.style.height=`${20+t*40}%`,r.current.style.height=`${20+t*130}%`,i.current.style.height=`${20+t*40}%`)})},[]));let o=`w-[3px] rounded-full bg-base-100 transition-[opacity] ${t?`opacity-100`:`opacity-50`}`;return A(`div`,{class:`flex items-center justify-center w-6 h-6`,children:A(`div`,{class:`flex items-center justify-center gap-[2px] w-full h-full`,children:[A(`div`,{ref:n,class:o,style:{height:`20%`}}),A(`div`,{ref:r,class:o,style:{height:`20%`}}),A(`div`,{ref:i,class:o,style:{height:`20%`}})]})})}),ex=[0,1,2],tx=.05,nx=450;function rx({sessionId:e,className:t=``}){let{config:n}=K_(),r=Ry(n.value),i=Ly(n.value),a=D(null),o=D(void 0),s=D(void 0),[c,l]=T(!1),u=D(!1);return Gg(e??``,k(t=>{e&&(o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let e=Math.max(0,Math.min(1,t**.6));a.current?.style.setProperty(`--audio-level`,String(e)),e>tx?(s.current&&=(clearTimeout(s.current),void 0),u.current||(u.current=!0,l(!0))):u.current&&s.current===void 0&&(s.current=setTimeout(()=>{s.current=void 0,u.current=!1,l(!1)},nx))}))},[e])),E(()=>()=>{o.current&&cancelAnimationFrame(o.current),s.current&&clearTimeout(s.current)},[]),A(`div`,{ref:a,class:`relative aspect-square w-full max-w-[min(48cqi,16rem)] mx-auto pointer-events-none ${t}`,style:{"--audio-level":`0`},"aria-hidden":`true`,children:[ex.map(e=>A(`div`,{class:`absolute inset-[16%] rounded-full will-change-transform`,style:{border:`2px solid var(--color-primary)`,opacity:0,animation:c?`tavusAudioWave 2.4s ease-out ${e*.8}s infinite`:`none`,"--wave-peak":`calc(0.18 + var(--audio-level, 0) * 0.5)`}},e)),A(`div`,{class:`absolute inset-[16%] rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--color-primary) 60%, transparent), transparent 70%)`,filter:`blur(20px)`,scale:`calc(1 + var(--audio-level, 0) * 0.25)`,opacity:`calc(0.35 + var(--audio-level, 0) * 0.5)`,transition:`scale 120ms ease-out, opacity 120ms ease-out`}}),A(`div`,{class:`absolute inset-[20%] rounded-full overflow-hidden bg-base-300 ring-2 ring-base-100/20 shadow-xl will-change-transform`,style:{scale:`calc(1 + var(--audio-level, 0) * 0.06)`,transition:`scale 100ms ease-out`},children:A(Uy,{variant:r.background,replica:i})})]})}function ix({children:e,class:t,className:n,...r}){return A(`div`,{class:`tavus-mesh-bg ${t??n??``}`,...r,children:[A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-1`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-2`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-3`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-4`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-5`}),A(`div`,{class:`absolute inset-0 bg-linear-to-t from-black/30 via-black/10 to-transparent pointer-events-none backdrop-blur-xs`}),e]})}var ax=e=>!!e.user_id?.includes(`tavus-replica`);function ox(){return Xh({filter:ax})}function sx(e){let t=ox()[0],n=r_(t??``),r=Mg(),[i,a]=T(!1);return E(()=>{t&&(n.state===`playable`||e)&&a(!0)},[t,n.state,e]),r===`left-meeting`||r===`error`?{phase:`left`}:!i||!t?{phase:`connecting`}:{phase:`ready`,replicaId:t,videoState:n}}var cx=P(({isAudioOnly:e})=>{let t=sx(e);return t.phase===`left`?A(Zb,{}):t.phase===`connecting`?A(Xb,{}):e?A(ix,{class:`flex items-center justify-center`,children:[A(rx,{sessionId:t.replicaId}),A(tg,{sessionId:t.replicaId})]}):A(`div`,{class:`relative w-full h-full`,children:[A(rg,{automirror:!0,sessionId:t.replicaId,type:`video`,fit:`cover`,className:`absolute inset-0 w-full h-full object-cover ${t.videoState.isOff?`hidden`:``}`}),A(tg,{sessionId:t.replicaId})]})}),lx=P(({onLeave:e})=>{let{config:t}=K_(),n=t.value.customization.conversation.modality===`audio`;return A(`div`,{class:`@container/pip w-full h-full`,children:A(`div`,{class:`relative w-full h-full overflow-hidden bg-linear-to-br from-base-300 to-base-200 text-base-content`,children:[A(`div`,{class:`relative w-full h-full z-5`,children:A(cx,{isAudioOnly:n})}),A(`div`,{class:`absolute bottom-4 w-full inset-x-0 z-20 flex justify-center items-center gap-2 @max-mobile:gap-1`,children:[A(Pb,{}),!n&&A(Fb,{}),A(`button`,{type:`button`,class:`btn btn-control btn-error`,onClick:e,"aria-label":`Leave call`,children:A(Ny,{name:`leave`,"aria-label":`Leave Call`})})]})]})})}),ux=P(({personaSessionId:e,localSessionId:t,isScreenSharing:n,avatarOff:r,videoRef:i})=>A(rg,{ref:i,automirror:!0,sessionId:n?t??``:e,type:n?`screenVideo`:`video`,fit:n?`contain`:`cover`,className:`absolute inset-0 w-full h-full transition-all ${n?`object-contain`:`object-cover`} ${!n&&r?`hidden`:``}`})),dx=new Set([`mcp-ui.tavus.io`,`mcp-ui.tavus-preview.io`]),fx=[`.sandbox-tavus.io`],px=new Set([`tavusapi.com`]);function mx(e){let t;try{t=new URL(e)}catch{return!1}return _x(t)?!0:t.protocol===`https:`?dx.has(t.hostname)?!0:fx.some(e=>t.hostname.endsWith(e)):!1}function hx(e){return mx(e)}function gx(e){let t;try{t=new URL(e)}catch{return!1}return vx(t)?!0:t.protocol===`https:`&&px.has(t.hostname)}function _x(e){return vx(e)}function vx(e){return!yx()||e.protocol!==`http:`&&e.protocol!==`https:`?!1:[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e.hostname)}function yx(){try{let e=globalThis.location?.hostname;return typeof e==`string`&&[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e)}catch{return!1}}async function bx(e){try{await e.teardownResource({},{timeout:1e3})}catch{}try{await e.close?.()}catch{}}var xx=`tavus.canvas.interaction`,Sx=[`safe-area-right`,`safe-area-left`,`safe-area-bottom`,`full`],Cx=`safe-area-right`,wx={x:275/1280,y:111/720,width:730/1280,height:609/720},Tx={type:`snapshot_mirror`};function Ex(e){return Jx(e)?e.message_type===`conversation`&&e.event_type===`conversation.tool_call`&&typeof e.conversation_id==`string`&&Jx(e.properties):!1}function Dx(e){if(!Jx(e))return null;let t=cS(e,`component`),n=cS(e,`component_version`),r=cS(e,`sandbox_url`),i=dS(e,`mcp_server_url`,hx),a=dS(e,`api_base_url`,gx),o=dS(e,`interaction_url`,gx),s=Qx(e.layout),c=e.version;return c!==1||!t||!n||!r||!mx(r)||i===null||a===null||o===null||s===null?null:{version:c,component:t,component_version:n,resource_uri:cS(e,`resource_uri`),sandbox_url:r,mcp_server_url:i,mcp_tool_name:cS(e,`mcp_tool_name`),api_base_url:a,interaction_url:o,layout:s,host_context:Jx(e.host_context)?e.host_context:void 0}}function Ox(e){if(e===void 0)return{ok:!0,value:{}};if(Jx(e))return{ok:!0,value:e};if(typeof e!=`string`)return{ok:!1,error:Error(`Magic Canvas tool arguments must be an object or JSON string.`)};try{let t=JSON.parse(e);return Jx(t)?{ok:!0,value:t}:{ok:!1,error:Error(`Magic Canvas tool arguments must decode to an object.`)}}catch(e){return{ok:!1,error:Yx(e)}}}function kx(e){let t=e.properties.name;if(t!==`canvas_clear`&&t!==`update_component`)return null;let n=Ox(e.properties.arguments);if(!n.ok)throw n.error;if(t===`canvas_clear`){let t=n.value.tool_call_id,r=n.value.reason;if(t!==void 0&&typeof t!=`string`)throw Error(`Magic Canvas clear tool_call_id must be a string when provided.`);if(r!==void 0&&typeof r!=`string`)throw Error(`Magic Canvas clear reason must be a string when provided.`);return{kind:`clear`,conversation_id:e.conversation_id,tool_call_id:t,reason:r}}let r=n.value.tool_call_id,i=n.value.updates;if(typeof r!=`string`||r.length===0)throw Error(`Magic Canvas update_component requires a target tool_call_id.`);if(!Jx(i))throw Error(`Magic Canvas update_component requires an object updates payload.`);return{kind:`update`,conversation_id:e.conversation_id,tool_call_id:r,updates:i}}var Ax=[`safe-area-left`,`safe-area-right`];function jx(e){let t=Ax.includes(e.preferred_slot)?e.preferred_slot:Cx;return t===e.preferred_slot&&e.display_mode===`inline`?e:{...e,preferred_slot:t,display_mode:`inline`}}function Mx(e){return e.display_mode===`fullscreen`?`full`:e.preferred_slot}function Nx(e,t){return[t]}function Px(e,t){switch(t.kind){case`show`:{let n=e.find(e=>e.id===t.instance.id),r=n?{...t.instance,revision:n.revision+1}:t.instance;return Nx(e.filter(e=>e.id!==t.instance.id),r)}case`update`:{let n=e=>e.conversation_id===t.conversation_id&&e.tool_call_id===t.tool_call_id,r=Wx(t.updates),i,a=e.map(e=>{if(!n(e))return e;let t={...e,arguments:{...e.arguments,...r.componentArguments},layout:jx({preferred_slot:r.preferredSlot??e.layout.preferred_slot,display_mode:r.displayMode??e.layout.display_mode,avoid_safe_area:r.avoidSafeArea??e.layout.avoid_safe_area,safe_area:r.safeArea??e.layout.safe_area,backdrop:r.backdrop??e.layout.backdrop}),revision:e.revision+1};return i=t,t});if(i===void 0)return a;let o=e.find(n);return o&&Mx(o.layout)===Mx(i.layout)?a:Nx(a.filter(e=>!n(e)),i)}case`clear`:return t.tool_call_id?e.filter(e=>!(e.conversation_id===t.conversation_id&&e.tool_call_id===t.tool_call_id)):e.filter(e=>e.conversation_id!==t.conversation_id)}}function Fx(e){if(!Jx(e)||!Array.isArray(e.content))return null;for(let t of e.content){if(!Jx(t))continue;let e=(Jx(t._meta)?t._meta:null)?.[xx];if(Jx(e))return fS(e)}return null}function Ix(e,t){let n=t.type,r=t.value;if(!n)throw Error(`Magic Canvas interaction is missing type.`);if(r===void 0)throw Error(`Magic Canvas interaction is missing value.`);return{interaction_id:t.interaction_id??qx(e.tool_call_id,n),conversation_id:e.conversation_id,tool_call_id:e.tool_call_id,component:t.component??e.canvas_config.component,component_version:t.component_version??e.canvas_config.component_version,type:n,value:r,metadata:Jx(t.metadata)?t.metadata:{}}}function Lx(e){return e.type===`dismiss`||e.type===`clear`?!0:e.type!==`submit`&&e.type!==`skip`?!1:e.component===`canvas.question`||e.component===`canvas.input`||e.component===`canvas.calendar`}function Rx(e){return!Jx(e)||!Array.isArray(e.content)?``:e.content.map(e=>Jx(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
50
+ Passed callback for '${e}' event is NOT registered.`,t),c(!0);return}l.current++;var n=setTimeout(function(){l.current=0},50);return a(e,t,u),function(){clearTimeout(n),i(e,u)}}},[t,e,u,s,i,a]),mt({event:e,eventId:u,isBlocked:s,callback:t})};function dh(e,t){var n,r;if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!dh(e[i],t[i]))return!1;return!0}if(MediaStream&&e instanceof MediaStream&&t instanceof MediaStream)return e.id===t.id&&e.active===t.active&&e.getTracks().length===t.getTracks().length&&e.getTracks().every(function(e,n){return dh(e,t.getTracks()[n])});if(MediaStreamTrack&&e instanceof MediaStreamTrack&&t instanceof MediaStreamTrack)return e.id===t.id&&e.kind===t.kind&&e.readyState===t.readyState;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;var a=Array.from(e).sort(),o=Array.from(t).sort();return a.every(function(e,t){return dh(e,o[t])})}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;try{for(var s=th(e.entries()),c=s.next();!c.done;c=s.next()){var l=nh(c.value,2),u=l[0],d=l[1];if(!t.has(u)||!dh(d,t.get(u)))return!1}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!0}if(Zm(e)!==`object`||e===null||Zm(t)!==`object`||t===null)return!1;var f=Object.keys(e),p=Object.keys(t);if(f.length!==p.length)return!1;for(var i=0;i<f.length;i++){var u=f[i];if(!Object.prototype.hasOwnProperty.call(t,u)||!dh(e[u],t[u]))return!1}return!0}function fh(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n],a=r!==null&&Zm(r)===`object`,o=i!==null&&Zm(i)===`object`;if(a||o){if(!dh(r,i))return!1}else if(r!==i)return!1}return!0}function ph(e){return`daily-react-`+e}function mh(e){var t=new Map,n=new Map;return function(r){if(!t.has(r)){var i=N(function(t){var i=e.get(r)(t),a=n.get(r);return a!=null&&e.equals(i,a)?a:(n.set(r,i),i)});t.set(r,i)}return t.get(r)}}var hh=`::`,gh=`;`,_h=function(e,t){return e+hh+t},vh=function(e,t){return e+hh+t.join(gh)},yh=function(e,t){return xh(_h(e,t))},bh=ca(function(e){var t=N([]);return t.debugLabel=ph(`participant-property-paths-${e}`),t}),xh=ca(function(e){var t=N(null);return t.debugLabel=ph(`participant-property-${e}`),t}),Sh=mh({equals:fh,get:function(e){return function(t){var n=nh(e.split(hh),2),r=n[0];return n[1].split(gh).map(function(e){return t(yh(r,e))})}}}),Ch=function(e,t){var n,r=mo(Array.isArray(t)?Sh(vh(e,t)):xh(_h(e,t)));return mt(Array.isArray(t)?t.reduce(function(e,t,n){return e[t]=r[n],e},{}):(n={},n[t]=r,n)),r},wh=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function Th(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Eh,Dh;function Oh(){if(Dh)return Eh;Dh=1;var e=`Expected a function`,t=NaN,n=`[object Symbol]`,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=Zm(wh)==`object`&&wh&&wh.Object===Object&&wh,l=(typeof self>`u`?`undefined`:Zm(self))==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype.toString,f=Math.max,p=Math.min,m=function(){return u.Date.now()};function h(t,n,r){var i,a,o,s,c,l,u=0,d=!1,h=!1,g=!0;if(typeof t!=`function`)throw TypeError(e);n=b(n)||0,_(r)&&(d=!!r.leading,h=`maxWait`in r,o=h?f(b(r.maxWait)||0,n):o,g=`trailing`in r?!!r.trailing:g);function v(e){var n=i,r=a;return i=a=void 0,u=e,s=t.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,n),d?v(e):s}function x(e){var t=e-l,r=e-u,i=n-t;return h?p(i,o-r):i}function S(e){var t=e-l,r=e-u;return l===void 0||t>=n||t<0||h&&r>=o}function C(){var e=m();if(S(e))return w(e);c=setTimeout(C,x(e))}function w(e){return c=void 0,g&&i?v(e):(i=a=void 0,s)}function ee(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function te(){return c===void 0?s:w(m())}function ne(){var e=m(),t=S(e);if(i=arguments,a=this,l=e,t){if(c===void 0)return y(l);if(h)return c=setTimeout(C,n),v(l)}return c===void 0&&(c=setTimeout(C,n)),s}return ne.cancel=ee,ne.flush=te,ne}function g(t,n,r){var i=!0,a=!0;if(typeof t!=`function`)throw TypeError(e);return _(r)&&(i=`leading`in r?!!r.leading:i,a=`trailing`in r?!!r.trailing:a),h(t,n,{leading:i,maxWait:n,trailing:a})}function _(e){var t=Zm(e);return!!e&&(t==`object`||t==`function`)}function v(e){return!!e&&Zm(e)==`object`}function y(e){return Zm(e)==`symbol`||v(e)&&d.call(e)==n}function b(e){if(typeof e==`number`)return e;if(y(e))return t;if(_(e)){var n=typeof e.valueOf==`function`?e.valueOf():e;e=_(n)?n+``:n}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?t:+e}return Eh=g,Eh}var kh=Th(Oh()),Ah=function(e,t,n,r){n===void 0&&(n=500),r===void 0&&(r=!1);var i=pt(oh),a=i.off,o=i.on,s=O(function(){var t;return Array.isArray(e)?e.reduce(function(e,t){return e[t]=r?ch():uh(),e},{}):(t={},t[e]=r?ch():uh(),t)},[e,r]),c=D([]);G(`call-instance-destroyed`,k(function(){c.current.length=0},[]));var l=O(function(){return kh(function(){c.current.length!==0&&(t(c.current),c.current.length=0)},n,{trailing:!0})},[t,n]);E(function(){if(e){var t=function(e){c.current.push(e),l()};return Array.isArray(e)?e.forEach(function(e){return o(e,t,s[e])}):o(e,t,s[e]),function(){Array.isArray(e)?e.forEach(function(e){return a(e,s[e])}):a(e,s[e])}}},[l,e,s,a,o]),mt({event:e,eventId:s})},jh=function(e,t,n){if(t===void 0&&(t=``),n===void 0&&(n=new Set),Zm(e)!==`object`||e===null||n.has(e))return[t];n.add(e);var r=[];for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=t?`${t}.${i}`:i;r.push.apply(r,rh([a],nh(jh(e[i],a,n)),!1))}return n.delete(e),r},Mh=function(e){return jh(e)},Nh=function(e,t){return String(t).split(`.`).filter(function(e){return e.length}).reduce(function(e,t){return e&&e[t]},e)},Ph=function(e,t){return t.map(function(t){return Nh(e,t)})},Fh=N(null);Fh.debugLabel=ph(`active-id`);var Ih=N(``);Ih.debugLabel=ph(`local-id`);var Lh=N(null);Lh.debugLabel=ph(`local-join-date`);var Rh=N([]);Rh.debugLabel=ph(`participant-ids`);var zh=ca(function(e){var t=N(null);return t.debugLabel=ph(`participant-${e}`),t}),Bh=N([]);Bh.debugLabel=ph(`waiting-participants`);var Vh=ca(function(e){var t=N({awaitingAccess:{level:`full`},id:e,name:``});return t.debugLabel=ph(`waiting-participant-${e}`),t}),Hh=function(e){var t=e.children,n=ah(),r=nh(T(!1),2),i=r[0],a=r[1],o=I(k(function(e,t,n){t(Ih,n.local.session_id);var r=Object.values(n);t(Rh,r.map(function(e){return e.session_id})),r.forEach(function(e){t(zh(e.session_id),e);var n=Mh(e);t(bh(e.session_id),n),n.forEach(function(n){var r=nh(Ph(e,[n]),1)[0];t(yh(e.session_id,n),r)})}),a(!0)},[]));E(function(){if(!(!n||i)){var e=setInterval(function(){var t=n.participants();`local`in t&&(o(t),clearInterval(e))},100);return function(){clearInterval(e)}}},[n,i,o]);var s=k(function(){if(n){var e=n?.participants();e.local&&o(e)}},[n,o]);G(`started-camera`,s,!0),G(`access-state-updated`,s,!0),G(`joining-meeting`,I(k(function(e,t){t(Lh,new Date),s()},[s])),!0),G(`joined-meeting`,k(function(e){o(e.participants)},[o]),!0);var c=I(k(function(e,t){t(Ih,``),t(Fh,null),e(Rh).forEach(function(e){return zh.remove(e)}),t(Rh,[])},[]));return G(`call-instance-destroyed`,c,!0),G(`left-meeting`,c,!0),Ah([`active-speaker-change`,`participant-joined`,`participant-updated`,`participant-left`],I(k(function(e,t,n){n.length&&n.forEach(function(n){switch(n.action){case`active-speaker-change`:t(Fh,n.activeSpeaker.peerId),t(zh(n.activeSpeaker.peerId),function(e){return e?W(W({},e),{last_active:new Date}):null});break;case`participant-joined`:t(Rh,function(e){return e.includes(n.participant.session_id)?e:rh(rh([],nh(e),!1),[n.participant.session_id],!1)}),t(zh(n.participant.session_id),n.participant);var r=Mh(n.participant);t(bh(n.participant.session_id),r),r.forEach(function(e){var r=nh(Ph(n.participant,[e]),1)[0];t(yh(n.participant.session_id,e),r)});break;case`participant-updated`:t(zh(n.participant.session_id),n.participant),n.participant.local&&t(Ih,n.participant.session_id);var r=Mh(n.participant),i=e(bh(n.participant.session_id));(r.length!==i.length||r.some(function(e){return!i.includes(e)}))&&t(bh(n.participant.session_id),r);var a=new Set(i),o=Ph(n.participant,r);r.forEach(function(e,r){var i=o[r];a.delete(e),t(yh(n.participant.session_id,e),function(e){return dh(e,i)?e:i})}),a.forEach(function(e){t(yh(n.participant.session_id,e),null)});break;case`participant-left`:t(Rh,function(e){return e.includes(n.participant.session_id)?e.filter(function(e){return e!==n.participant.session_id}):e}),zh.remove(n.participant.session_id),e(bh(n.participant.session_id)).forEach(function(e){xh.remove(_h(n.participant.session_id,e))}),bh.remove(n.participant.session_id);break}})},[])),100,!0),Ah([`waiting-participant-added`,`waiting-participant-updated`,`waiting-participant-removed`],I(k(function(e,t,n){n.forEach(function(e){switch(e.action){case`waiting-participant-added`:t(Bh,function(t){return t.includes(e.participant.id)?t:rh(rh([],nh(t),!1),[e.participant.id],!1)}),t(Vh(e.participant.id),e.participant);break;case`waiting-participant-updated`:t(Vh(e.participant.id),e.participant);break;case`waiting-participant-removed`:t(Bh,function(t){return t.filter(function(t){return t!==e.participant.id})}),Vh.remove(e.participant.id);break}})},[])),100,!0),F.createElement(F.Fragment,null,t)},Uh=function(){var e=mo(Ih);return mt(e),e},Wh=function(){return!0},Gh=function(e){var t=e===void 0?{}:e,n=t.filter,r=n===void 0?Wh:n,i=t.ignoreLocal,a=i===void 0?!1:i,o=Uh(),s=mo(Fh),c=a&&s===o,l=!r?.(s),u=nh(T(!c&&!l?s:null),2),d=u[0],f=u[1];return E(function(){c||l||f(s)},[l,c,s]),mt(d),d},Kh=function(e){return[`blocked`,`off`].includes(e)},qh=`;`,Jh=function(e,t){return`${e}${qh}${t}`},Yh=mh({equals:dh,get:function(e){return function(t){var n=nh(e.split(qh),2),r=n[0],i=n[1];return t(Rh).filter(function(e){switch(r){case`local`:case`owner`:case`record`:return t(yh(e,r));case`remote`:return!t(yh(e,`local`));case`screen`:var n=t(yh(e,`tracks.screenAudio.state`)),i=t(yh(e,`tracks.screenVideo.state`));return!Kh(n)||!Kh(i);default:return!0}}).sort(function(e,n){switch(i){case`joined_at`:case`session_id`:case`user_id`:case`user_name`:var r=t(yh(e,i)),a=t(yh(n,i));if(r!==void 0||a!==void 0){if(r===void 0)return-1;if(a===void 0||r>a)return 1;if(r<a)return-1}return 0;default:return 0}})}}}),Xh=function(e){var t=e===void 0?{}:e,n=t.filter,r=t.onActiveSpeakerChange,i=t.onParticipantJoined,a=t.onParticipantLeft,o=t.onParticipantUpdated,s=t.sort,c=mo(Yh(Jh(typeof n==`string`?n:null,typeof s==`string`?s:null))),l=typeof n==`function`||typeof s==`function`,u=k(function(e){return typeof n!=`function`&&typeof s!=`function`?[]:c.map(function(t){return e(zh(t))}).filter(function(e){return!!e}).filter(typeof n==`function`?n:function(){return!0}).sort(typeof s==`function`?s:function(){return 0}).map(function(e){return e.session_id}).filter(Boolean)},[n,c,s]),d=nh(T([]),2),f=d[0],p=d[1],m=I(k(function(e){if(l){var t=u(e);dh(t,f)||p(t)}},[f,u,l]));E(function(){m()},[m]),Ah([`participant-joined`,`participant-updated`,`active-speaker-change`,`participant-left`],k(function(e){e.length&&(e.forEach(function(e){switch(e.action){case`participant-joined`:i?.(e);break;case`participant-updated`:o?.(e);break;case`active-speaker-change`:r?.(e);break;case`participant-left`:a?.(e);break}}),m())},[m,r,i,a,o]));var h=typeof n==`function`||typeof s==`function`?f:c;return mt(h),h},Zh=mh({equals:fh,get:function(){return function(e){return e(Yh(Jh(`screen`,null))).map(function(t){return{local:e(yh(t,`local`)),screenAudio:e(yh(t,`tracks.screenAudio`)),screenVideo:e(yh(t,`tracks.screenVideo`)),screenId:`${t}-screen`,session_id:t}})}}}),Qh=function(e){var t=e===void 0?{}:e,n=t.onError,r=t.onLocalScreenShareStarted,i=t.onLocalScreenShareStopped,a=ah(),o=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.startScreenShare.apply(a,rh([],nh(e),!1))},[a]),s=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.stopScreenShare.apply(a,rh([],nh(e),!1))},[a]);G(`local-screen-share-started`,k(function(){return r?.()},[r])),G(`local-screen-share-stopped`,k(function(){return i?.()},[i])),G(`nonfatal-error`,k(function(e){e.type===`screen-share-error`&&n?.(e)},[n]));var c=mo(Zh(void 0)),l={isSharingScreen:c.some(function(e){return e.local}),screens:c,startScreenShare:o,stopScreenShare:s};return mt(l),l},$h=function(e,t){t===void 0&&(t=`video`);var n=Ch(e,`tracks.${t}`),r=n?W(W({},n),{isOff:Kh(n.state)}):{isOff:!0,persistentTrack:void 0,state:`off`,subscribed:!1};return mt(r),r};function eg(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return k(function(t){for(var n=0;n<e.length;n++){var r=e[n];typeof r==`function`?r(t):r&&Zm(r)===`object`&&(r.current=t)}},e)}var tg=P(Sa(function(e,t){var n=e.onPlayFailed,r=e.sessionId,i=e.type,a=i===void 0?`audio`:i,o=Qm(e,[`onPlayFailed`,`sessionId`,`type`]),s=D(null),c=$h(r,a),l=eg(s,t),u=c?.subscribed;return E(function(){var e=s.current;if(!(!e||!c?.persistentTrack)){if(!MediaStream){console.warn(`MediaStream API not available. Can't setup ${a} for ${r}`),n?.({sessionId:r,target:e,type:a,message:`MediaStream API not available`,name:`MediaStream API not available`});return}var t=function(){e.play().catch(function(t){n?.({sessionId:r,target:e,type:a,message:t.message,name:t.name})})};return e.addEventListener(`loadedmetadata`,t),e.srcObject=new MediaStream([c.persistentTrack]),e.load(),function(){e.removeEventListener(`loadedmetadata`,t)}}},[c?.persistentTrack,n,r,a]),G(`participant-left`,k(function(e){var t=s.current;e.participant.session_id!==r||!t||(t.srcObject=null)},[r])),G(`left-meeting`,k(function(){var e=s.current;e&&(e.pause(),e.srcObject=null)},[])),F.createElement(`audio`,W({autoPlay:!0,ref:l},o,{"data-session-id":r,"data-audio-type":a,"data-subscribed":u}))}));tg.displayName=`DailyAudioTrack`;var ng=P(Sa(function(e,t){var n=e.autoSubscribeActiveSpeaker,r=n===void 0?!1:n,i=e.maxSpeakers,a=i===void 0?5:i,o=e.onPlayFailed,s=e.playLocalScreenAudio,c=s===void 0?!1:s,l=ah(),u=nh(T(Array(a).fill(``)),2),d=u[0],f=u[1],p=Qh().screens,m=Uh(),h=Gh({ignoreLocal:!0}),g=D(null);ft(t,function(){return{getActiveSpeakerAudio:function(){return g.current?.querySelector(`audio[data-session-id="${h}"][data-audio-type="audio"]`)??null},getAllAudio:function(){return Array.from(g.current?.querySelectorAll(`audio`)??[])},getAudioBySessionId:function(e){return g.current?.querySelector(`audio[data-session-id="${e}"][data-audio-type="audio"]`)??null},getRmpAudio:function(){return Array.from(g.current?.querySelectorAll(`audio[data-audio-type="rmpAudio"]`)??[])},getScreenAudio:function(){return Array.from(g.current?.querySelectorAll(`audio[data-audio-type="screenAudio"]`)??[])},getRmpAudioBySessionId:function(e){return g.current?.querySelector(`audio[data-session-id="${e}"][data-audio-type="rmpAudio"]`)??null},getScreenAudioBySessionId:function(e){return g.current?.querySelector(`audio[data-session-id="${e}"][data-audio-type="screenAudio"]`)??null}}},[h]);var _=I(k(function(e,t,n){return $m(void 0,void 0,void 0,function(){var t,i;return eh(this,function(a){if(t=Object.values(l?.participants()??{}).filter(function(e){return!e.local&&!!e.tracks.audio.subscribed}),i=function(e){return t.some(function(t){return t.session_id===e})},!i(n))if(l&&!l.isDestroyed()&&r&&!l.subscribeToTracksAutomatically())l.updateParticipant(n,{setSubscribedTracks:{audio:!0}});else return[2];return f(function(r){if(r.includes(n))return r;var a=function(e){return!e||!i(e)};if(r.some(a)){var o=r.findIndex(a);return r[o]=n,rh([],nh(r),!1)}var s=r.findIndex(function(e){return t.some(function(t){return t.session_id===e&&Kh(t.tracks.audio.state)})});if(s>=0)return r[s]=n,rh([],nh(r),!1);var c=t.filter(function(e){return r.includes(e.session_id)&&e.session_id!==h}).sort(function(t,n){var r=e(yh(t.session_id,`last_active`))??new Date(`1970-01-01`),i=e(yh(n.session_id,`last_active`))??new Date(`1970-01-01`);return r>i?1:r<i?-1:0});if(!c.length){var l=r.findIndex(function(e){return e!==h});return r[l]=n,rh([],nh(r),!1)}var u=r.indexOf(c[0]?.session_id);return r[u]=n,rh([],nh(r),!1)}),[2]})})},[h,r,l])),v=k(function(e){f(function(t){if(!t.includes(e))return t;var n=rh([],nh(t),!1),r=n.indexOf(e);return n[r]=``,n})},[]);Ah([`active-speaker-change`,`track-started`,`participant-left`],k(function(e){e.forEach(function(e){switch(e.action){case`active-speaker-change`:if(e.activeSpeaker.peerId===m)return;_(e.activeSpeaker.peerId);break;case`track-started`:e.track.kind===`audio`&&e.participant&&!e.participant.local&&_(e.participant.session_id);break;case`participant-left`:v(e.participant.session_id);break}})},[_,m,v]),200);var y=Xh({filter:k(function(e){return!!e?.tracks?.rmpAudio},[])});return F.createElement(`div`,{ref:g},d.map(function(e,t){return F.createElement(tg,{key:`speaker-slot-${t}`,onPlayFailed:o,sessionId:e,type:`audio`})}),p.filter(function(e){return c?!0:!e.local}).map(function(e){return F.createElement(tg,{key:e.screenId,onPlayFailed:o,sessionId:e.session_id,type:`screenAudio`})}),y.map(function(e){return F.createElement(tg,{key:`${e}-rmp`,onPlayFailed:o,sessionId:e,type:`rmpAudio`})}))}));ng.displayName=`DailyAudio`;var rg=Sa(function(e,t){var n=e.automirror,r=e.fit,i=r===void 0?`contain`:r,a=e.mirror,o=e.onResize,s=e.playableStyle,c=s===void 0?{}:s,l=e.sessionId,u=e.style,d=u===void 0?{}:u,f=e.type,p=f===void 0?`video`:f,m=Qm(e,[`automirror`,`fit`,`mirror`,`onResize`,`playableStyle`,`sessionId`,`style`,`type`]),h=Uh()===l,g=p===`screenVideo`,_=h&&!g,v=D(null),y=eg(v,t),b=$h(l,p),x=b.persistentTrack,S=_||g||!b.isOff,C=Ch(l,`tracks.${p}`)?.subscribed,w=O(function(){if(typeof a==`boolean`)return a;if(!n)return!1;if(!x)return _;var e=x.getSettings();return`facingMode`in e?_&&e.facingMode===`user`:_},[n,_,a,x]);return E(function(){var e=v.current;if(e){var t=function(){var t=e.play();t!==void 0&&t.then(function(){e.controls=!1}).catch(function(t){e.controls=!0,console.warn(`Failed to play video`,t)})},n=function(){e.paused&&t()},r=function(){e.style.transform=`scale(1)`},i=function(){e.style.transform=``,setTimeout(function(){e.paused&&t()},100)},a=function(){document.visibilityState!==`hidden`&&e.paused&&t()};return e.addEventListener(`canplay`,n),e.addEventListener(`enterpictureinpicture`,r),e.addEventListener(`leavepictureinpicture`,i),document.addEventListener(`visibilitychange`,a),function(){e.removeEventListener(`canplay`,n),e.removeEventListener(`enterpictureinpicture`,r),e.removeEventListener(`leavepictureinpicture`,i),document.removeEventListener(`visibilitychange`,a)}}},[]),E(function(){var e=v.current;if(!(!e||!x)){if(!MediaStream){console.warn(`MediaStream API not available. Can't setup ${p} for ${l}`);return}return e.srcObject=new MediaStream([x]),e.load(),function(){e.srcObject=null,e.load()}}},[l,p,x,x?.id]),E(function(){var e=v.current;if(!o||!e)return;var t;function n(){t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){var e=v.current;if(!(!e||document.hidden)){var t=e.videoWidth,n=e.videoHeight;t&&n&&o?.({aspectRatio:t/n,height:n,width:t})}})}return n(),e.addEventListener(`loadedmetadata`,n),e.addEventListener(`resize`,n),function(){t&&cancelAnimationFrame(t),e.removeEventListener(`loadedmetadata`,n),e.removeEventListener(`resize`,n)}},[o]),F.createElement(`video`,W({autoPlay:!0,muted:!0,playsInline:!0,ref:y,"data-local":h,"data-mirrored":w||void 0,"data-playable":S||void 0,"data-session-id":l,"data-subscribed":C,"data-video-type":p,style:W(W({objectFit:i,transform:w?`scale(-1, 1)`:``},d),S?c:{})},m))});rg.displayName=`DailyVideo`;var ig=Ie({refreshDevices:function(){return Promise.resolve()}}),ag=N(`idle`);ag.debugLabel=ph(`camera-state`);var og=N(`idle`);og.debugLabel=ph(`microphone-state`);var sg=N([]);sg.debugLabel=ph(`camera-devices`);var cg=N([]);cg.debugLabel=ph(`microphone-devices`);var lg=N([]);lg.debugLabel=ph(`speaker-devices`);var ug=N(null);ug.debugLabel=ph(`last-camera-error`);var dg=function(e){var t=e.children,n=ah(),r=I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var e,r,i,a,o,s,c,l,u,d;return eh(this,function(f){switch(f.label){case 0:if((navigator==null?void 0:navigator.mediaDevices)?.getUserMedia===void 0||(navigator==null?void 0:navigator.mediaDevices)?.enumerateDevices===void 0)return t(ag,`not-supported`),t(og,`not-supported`),[2];if(!n)return[2];f.label=1;case 1:return f.trys.push([1,4,,5]),[4,n.enumerateDevices()];case 2:return e=f.sent().devices,r=e.filter(function(e){return e.kind===`videoinput`&&e.deviceId!==``}),i=e.filter(function(e){return e.kind===`audioinput`&&e.deviceId!==``}),a=e.filter(function(e){return e.kind===`audiooutput`&&e.deviceId!==``}),[4,n.getInputDevices()];case 3:return o=f.sent(),s=o.camera,c=o.mic,l=o.speaker,u=function(e,t,n){var r=n.find(function(e){return e.device.deviceId===t.deviceId}),i=`deviceId`in e&&t.deviceId===e.deviceId,a=!(`deviceId`in e)&&r?.selected;return{device:t,selected:i||!!a,state:r?.state??`granted`}},d=function(e,t){return e.device.deviceId==="default"?-1:t.device.deviceId==="default"?1:e.device.label<t.device.label?-1:+(e.device.label>t.device.label)},t(sg,function(e){return r.filter(Boolean).map(function(t){return u(s,t,e)}).sort(d)}),t(cg,function(e){return i.filter(Boolean).map(function(t){return u(c,t,e)}).sort(d)}),t(lg,function(e){return a.filter(Boolean).map(function(t){return u(l,t,e)}).sort(d)}),[3,5];case 4:return f.sent(),t(ag,`not-supported`),t(og,`not-supported`),[3,5];case 5:return[2]}})})},[n])),i=I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var i,a,o,s,c,l,u,d,f,p,m,h;return eh(this,function(g){switch(g.label){case 0:if(!n||(i=e(ag),a=e(og),o=n.participants(),!o.local))return[2];if(s=o.local.tracks,c=`prompt`,l=`prompt`,!navigator.permissions)return[3,5];g.label=1;case 1:return g.trys.push([1,4,,5]),[4,navigator.permissions.query({name:`camera`})];case 2:return u=g.sent(),c=u.state,[4,navigator.permissions.query({name:`microphone`})];case 3:return d=g.sent(),l=d.state,[3,5];case 4:return g.sent(),[3,5];case 5:return f=c===`prompt`&&[`idle`,`pending`].includes(i)&&s.video.state===`interrupted`&&!s.video.persistentTrack,p=[`idle`,`pending`].includes(i)&&!s.video.persistentTrack&&!!s.video.off?.byUser,m=l===`prompt`&&[`idle`,`pending`].includes(a)&&s.audio.state===`interrupted`&&!s.audio.persistentTrack,h=[`idle`,`pending`].includes(a)&&!s.audio.persistentTrack&&!!s.audio.off?.byUser,s.audio?.blocked?.byDeviceInUse?(t(og,`in-use`),t(cg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`in-use`}):e})})):s.audio?.blocked?.byDeviceMissing?t(og,`not-found`):s.audio?.blocked?.byPermissions||l===`denied`?t(og,`blocked`):m?t(og,`pending`):h?t(og,`idle`):(t(og,`granted`),t(cg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`granted`}):e})})),s.video?.blocked?.byDeviceInUse?(t(ag,`in-use`),t(sg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`in-use`}):e})})):s.video?.blocked?.byDeviceMissing?t(ag,`not-found`):s.video?.blocked?.byPermissions||c===`denied`?t(ag,`blocked`):f?t(ag,`pending`):p?t(ag,`idle`):(t(ag,`granted`),t(sg,function(e){return e.map(function(e){return e.selected?W(W({},e),{state:`granted`}):e})})),r(),[2]}})})},[n,r]));return G(`participant-updated`,k(function(e){e.participant.local&&i()},[i])),G(`available-devices-updated`,r),G(`selected-devices-updated`,r),G(`camera-error`,I(k(function(e,t,n){switch(t(ug,n.error),n.error?.type){case`cam-in-use`:t(ag,`in-use`);break;case`mic-in-use`:t(og,`in-use`);break;case`cam-mic-in-use`:t(ag,`in-use`),t(og,`in-use`);break;case`not-found`:n.error?.missingMedia.includes(`video`)&&t(ag,`not-found`),n.error?.missingMedia.includes(`audio`)&&t(og,`not-found`);break;case`permissions`:n.error?.blockedMedia.includes(`video`)&&t(ag,`blocked`),n.error?.blockedMedia.includes(`audio`)&&t(og,`blocked`);break;case`constraints`:n.error?.reason===`invalid`?(t(ag,`constraints-invalid`),t(og,`constraints-invalid`)):n.error?.reason===`none-specified`&&(t(ag,`constraints-none-specified`),t(og,`constraints-none-specified`));break;case`undefined-mediadevices`:t(ag,`undefined-mediadevices`),t(og,`undefined-mediadevices`);break;default:t(ag,`unknown`),t(og,`unknown`);break}},[]))),G(`started-camera`,I(k(function(e,t){t(ag,`granted`),t(og,`granted`),i()},[i]))),F.createElement(ig.Provider,{value:{refreshDevices:r}},t)};function fg(e){return e.instanceId??`__default__`}var pg=N({});pg.debugLabel=ph(`live-streaming-instances`);var mg=N(function(e){var t=e(pg),n=Object.values(t),r=n.filter(function(e){return e.isLiveStreaming}),i=r[0]??n[n.length-1];return{errorMsg:n.find(function(e){return e.errorMsg})?.errorMsg,isLiveStreaming:r.length>0,layout:i?.layout}});mg.debugLabel=ph(`live-streaming`);var hg=function(e){var t=e.children;return G(`live-streaming-started`,I(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return W(W({},e),(t={},t[r]={instanceId:r,isLiveStreaming:!0,layout:n?.layout},t))})},[]))),G(`live-streaming-stopped`,I(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return e[r]?W(W({},e),(t={},t[r]=W(W({},e[r]),{isLiveStreaming:!1,layout:void 0}),t)):e})},[]))),G(`live-streaming-error`,I(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return W(W({},e),(t={},t[r]=W(W({},e[r]??{instanceId:r,isLiveStreaming:!1}),{errorMsg:n.errorMsg}),t))})},[]))),G(`left-meeting`,I(k(function(e,t){t(pg,{})},[]))),F.createElement(F.Fragment,null,t)},gg=N(`new`);gg.debugLabel=ph(`meeting-state`);var _g=N(null);_g.debugLabel=ph(`meeting-error`);var vg=N(null);vg.debugLabel=ph(`non-fatal-error`);var yg=N({data:void 0,topology:`none`});yg.debugLabel=ph(`meeting-session-data`);var bg=function(e){var t=e.children,n=ah(),r=I(k(function(e,t){if(n){var r=n.meetingState();return t(gg,r),r}},[n]));return G(`loading`,r),G(`loaded`,r),G(`joining-meeting`,r),G(`joined-meeting`,r),G(`left-meeting`,r),G(`error`,I(k(function(e,t,n){t(_g,n),r()},[r]))),G(`nonfatal-error`,I(k(function(e,t,n){t(vg,n)},[]))),G(`joined-meeting`,I(k(function(e,t){n&&t(yg,n.meetingSessionState())},[n]))),G(`meeting-session-state-updated`,I(k(function(e,t,n){t(yg,n.meetingSessionState)},[]))),G(`left-meeting`,I(k(function(e,t){t(yg,{data:void 0,topology:`none`})},[]))),G(`call-instance-destroyed`,I(k(function(e,t){t(gg,`new`),t(_g,null),t(vg,null),t(yg,{data:void 0,topology:`none`})},[]))),F.createElement(F.Fragment,null,t)},xg=N(`none`);xg.debugLabel=ph(`topology`);var Sg=N(`unknown`),Cg=N([]),wg=N(`interrupted`),Tg=N(100);Tg.debugLabel=ph(`network-quality`);var Eg=N(`good`);Eg.debugLabel=ph(`network-threshold`);var Dg=function(e){var t=e.children,n=ah(),r=mo(xg),i=I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var e;return eh(this,function(r){switch(r.label){case 0:return n?[4,n.getNetworkTopology()]:[2];case 1:return e=r.sent(),!e||e?.topology===`none`||t(xg,e.topology),[2]}})})},[n]));return G(`joined-meeting`,i),G(`network-connection`,I(k(function(e,t,n){switch(t(wg,n.event),n.event){case`connected`:n.type===`peer-to-peer`&&t(xg,`peer`),n.type===`sfu`&&t(xg,`sfu`);break}},[]))),G(`network-quality-change`,I(k(function(e,t,n){t(Sg,function(e){return e===n.networkState?e:n.networkState}),t(Cg,function(e){var t=n.networkStateReasons??[];return fh(e,t)?e:t}),t(Tg,function(e){return e===n.quality?e:n.quality}),t(Eg,function(e){return e===n.threshold?e:n.threshold})},[]))),G(`left-meeting`,I(k(function(e,t){t(xg,`none`),t(Sg,`unknown`),t(Cg,[]),t(wg,`interrupted`),t(Tg,100),t(Eg,`good`)},[]))),E(function(){!n||r!==`none`||i()},[n,i,r]),F.createElement(F.Fragment,null,t)};function Og(e){return e.instanceId?e.instanceId:e.type===`local`||e.local?`__local__`:`__default__`}var kg=N({});kg.debugLabel=ph(`recording-instances`);var Ag=N(function(e){var t=e(kg),n=Object.values(t),r=n.filter(function(e){return e.isRecording}),i=r[0]??n[n.length-1];return{error:n.some(function(e){return e.error}),isLocalParticipantRecorded:n.some(function(e){return e.isLocalParticipantRecorded}),isRecording:r.length>0,layout:i?.layout,local:i?.local,recordingId:i?.recordingId,recordingStartedDate:i?.recordingStartedDate,startedBy:i?.startedBy,type:i?.type}});Ag.debugLabel=ph(`recording-state`);var jg=function(e){var t=e.children,n=Uh(),r=Xh({filter:`record`}),i=I(k(function(e,t,n,r){var i=e(kg).__local__,a={instanceId:`__local__`,isLocalParticipantRecorded:n,isRecording:n,local:n?r:i?.local,type:n?`local`:i?.type};i&&dh(i,a)||!n&&!i||(n?t(kg,function(e){return W(W({},e),{__local__:a})}):i&&t(kg,function(e){return W(W({},e),{__local__:W(W({},i),{isLocalParticipantRecorded:!1,isRecording:!1})})}))},[]));return E(function(){i(r.length>0,r.includes(n||`local`))},[n,i,r]),G(`recording-started`,I(k(function(e,t,r){var i=Og(r),a=!0;switch(r.type){case`cloud-audio-only`:case`cloud-beta`:case`cloud`:n&&r.layout?.preset===`single-participant`&&r.layout.session_id!==n&&(a=!1);break}t(kg,function(e){var t;return W(W({},e),(t={},t[i]={error:!1,instanceId:i,isLocalParticipantRecorded:a,isRecording:!0,layout:r?.layout,local:r?.local,recordingId:r?.recordingId,recordingStartedDate:new Date,startedBy:r?.startedBy,type:r?.type},t))})},[n]))),G(`recording-stopped`,I(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t;return e[r]?W(W({},e),(t={},t[r]=W(W({},e[r]),{isLocalParticipantRecorded:!1,isRecording:!1}),t)):e})},[]))),G(`recording-error`,I(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t,i=e[r];return W(W({},e),(t={},t[r]=W(W({},i??{instanceId:r}),{error:!0,errorMsg:n.errorMsg,isLocalParticipantRecorded:!1,isRecording:!1}),t))})},[]))),G(`left-meeting`,I(k(function(e,t){t(kg,{})},[]))),F.createElement(F.Fragment,null,t)},Mg=function(){var e=mo(gg);return mt(e),e},Ng=N(null);Ng.debugLabel=ph(`room-state`);var Pg=function(e){var t=e.children,n=ah(),r=Mg();return G(`access-state-updated`,I(k(function(e,t){return $m(void 0,void 0,void 0,function(){var e;return eh(this,function(i){switch(i.label){case 0:return!n||r===`left-meeting`?[2]:[4,n.room()];case 1:return e=i.sent(),e&&`id`in e&&t(Ng,e),[2,e]}})})},[n,r]))),G(`left-meeting`,I(k(function(e,t){return function(){t(Ng,null)}},[]))),F.createElement(F.Fragment,null,t)},Fg=N({isTranscribing:!1,model:`general`,language:`en`,transcriptions:[]});Fg.debugLabel=ph(`transcription-state`);var Ig=function(e){var t=e.children;return G(`transcription-started`,I(k(function(e,t,n){t(Fg,{error:!1,transcriptionStartDate:new Date,isTranscribing:!0,transcriptions:[],endpointing:n.endpointing,extra:n.extra,includeRawResponse:n.includeRawResponse,instanceId:n.instanceId,language:n.language,model:n.model,profanity_filter:n.profanity_filter,punctuate:n.punctuate,redact:n.redact,startedBy:n.startedBy,tier:n.tier})},[]))),G(`transcription-stopped`,I(k(function(e,t,n){t(Fg,function(e){return W(W({},e),{updatedBy:n.updatedBy,isTranscribing:!1})})},[]))),G(`transcription-error`,I(k(function(e,t){t(Fg,function(e){return W(W({},e),{error:!0,isTranscribing:!1})})},[]))),G(`left-meeting`,I(k(function(e,t){t(Fg,function(e){return W(W({},e),{isTranscribing:!1})})},[]))),G(`app-message`,I(k(function(e,t,n){n?.fromId===`transcription`&&t(Fg,function(e){return W(W({},e),{isTranscribing:!0,transcriptions:rh(rh([],nh(e.transcriptions),!1),[n.data],!1)})})},[]))),F.createElement(F.Fragment,null,t)},Lg=`0.25.2`,Rg={strictMode:!0},zg=function(){return!0},Bg={options:Rg,shouldCreateInstance:zg},Vg=function(e,t){var n=t===void 0?Bg:t,r=n.parentElRef,i=n.options,a=i===void 0?Rg:i,o=n.shouldCreateInstance,s=o===void 0?zg:o,c=nh(T(null),2),l=c[0],u=c[1],d=D();return E(function(){if(e===`callFrame`&&r?.current===null||!s())return;function t(e){return $m(this,void 0,void 0,function(){return eh(this,function(t){switch(t.label){case 0:return[4,e.destroy()];case 1:return t.sent(),[2]}})})}var n=function(){setTimeout(function(){return u(null)},0)},i=Cm.getCallInstance();if(!l&&i&&!i.isDestroyed()){i.once(`call-instance-destroyed`,n),u(i);return}if(l){dh(d.current,a)||t(l);return}if(!i||i.isDestroyed())try{var o=W(W({},a),{aboutClient:W(W({},a.aboutClient??{}),{"daily-react":Lg})});switch(e){case`callFrame`:i=r?.current?Cm.createFrame(r.current,o):Cm.createFrame(o);break;case`callObject`:i=Cm.createCallObject(o);break}d.current=a,u(i),i.once(`call-instance-destroyed`,n)}catch(e){if(console.error(`Error creating call instance:`,e),a.strictMode)throw e}},[l,a,r,s,e]),l},Hg=function(e){return Vg(`callObject`,e)},Ug=function(e){var t=e.children,n=e.jotaiStore,r=Qm(e,[`children`,`jotaiStore`]),i=D({}),a=k(function(e){var t,n;if(`action`in e){var r=e.action,a=Array.from(i.current?.[r]??[]),o=a.filter(function(e){return nh(e,1)[0]<0}),s=a.filter(function(e){return nh(e,1)[0]>0}),c=rh(rh([],nh(o),!1),nh(s),!1);try{for(var l=th(c),u=l.next();!u.done;u=l.next()){var d=nh(u.value,2)[1];d(e)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}}},[]),o=k(function(e){e&&Object.keys(i.current).forEach(function(t){e.off(t,a),e.isDestroyed()||e.on(t,a)})},[a]),s=`callObject`in r?r.callObject:null,c=Hg({options:O(function(){return`callObject`in r?{}:r},[r]),shouldCreateInstance:k(function(){return!(`callObject`in r)},[r])}),l=s??c;E(function(){l&&o(l)},[l,o]);var u=k(function(e,t,n){var r;i.current[e]||(i.current[e]=new Map,l&&(l.off(e,a),l.isDestroyed()||l.on(e,a))),i.current[e]?.has(n)||(r=i.current[e])==null||r.set(n,t)},[l,a]),d=k(function(e,t){var n;(n=i.current[e])==null||n.delete(t),i.current[e]?.size===0&&(l?.off(e,a),delete i.current[e])},[l,a]);return F.createElement(so,{store:n},F.createElement(ih.Provider,{value:l},F.createElement(oh.Provider,{value:{on:u,off:d}},F.createElement(Pg,null,F.createElement(bg,null,F.createElement(Dg,null,F.createElement(Hh,null,F.createElement(jg,null,F.createElement(hg,null,F.createElement(Ig,null,F.createElement(dg,null,t)))))))))))},Wg=function(e){var t=(e===void 0?{}:e).onAppMessage,n=ah(),r=k(function(e,t){t===void 0&&(t=`*`),n&&n.sendAppMessage(e,t)},[n]);return G(`app-message`,k(function(e){t?.(e,r)},[t,r])),r},Gg=function(e,t,n,r){var i=ah(),a=e===Uh();G(`local-audio-level`,k(function(e){a&&t(e.audioLevel)},[t,a])),G(`remote-participants-audio-level`,k(function(n){a||t(n.participantsAudioLevel[e])},[t,e,a])),E(function(){if(!(!i||i.isDestroyed()||!a)&&!i.isLocalAudioLevelObserverRunning())try{i.startLocalAudioLevelObserver(r)}catch{n?.(`Local audio level observer not supported in this browser`)}},[i,n,r,a]),E(function(){!i||i.isDestroyed()||a||i.isRemoteParticipantsAudioLevelObserverRunning()||i.startRemoteParticipantsAudioLevelObserver(r)},[i,r,a])},Kg=function(e){return $h(e,`audio`)},qg,Jg;function Yg(){return Jg?qg:(Jg=1,qg=function e(t,n){if(t===n)return!0;if(t&&n&&Zm(t)==`object`&&Zm(n)==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n},qg)}Yg();var Xg=N({state:`low`,reason:`none`});Xg.debugLabel=ph(`cpu-load`);var Zg=function(){var e=ah(),t=mo(ag),n=mo(og),r=mo(sg),i=mo(cg),a=mo(lg),o=mo(ug),s=pt(ig).refreshDevices,c=k(function(t){return $m(void 0,void 0,void 0,function(){return eh(this,function(n){switch(n.label){case 0:return[4,e?.setInputDevicesAsync({audioDeviceId:null,videoDeviceId:t})];case 1:return n.sent(),[2]}})})},[e]),l=k(function(t){return $m(void 0,void 0,void 0,function(){return eh(this,function(n){switch(n.label){case 0:return[4,e?.setInputDevicesAsync({audioDeviceId:t,videoDeviceId:null})];case 1:return n.sent(),[2]}})})},[e]),u=k(function(t){return $m(void 0,void 0,void 0,function(){return eh(this,function(n){switch(n.label){case 0:return[4,e?.setOutputDeviceAsync({outputDeviceId:t})];case 1:return n.sent(),[2]}})})},[e]),d=[`blocked`,`in-use`,`not-found`,`constraints-invalid`,`constraints-none-specified`,`undefined-mediadevices`,`unknown`],f={cameraError:o,cameras:r,camState:t,currentCam:r.find(function(e){return e.selected}),currentMic:i.find(function(e){return e.selected}),currentSpeaker:a.find(function(e){return e.selected}),hasCamError:d.includes(t),hasMicError:d.includes(n),microphones:i,micState:n,refreshDevices:s,setCamera:c,setMicrophone:l,setSpeaker:u,speakers:a};return mt(f),f},Qg=N(null);Qg.debugLabel=ph(`input-settings`);var $g=N({hidden:0,present:0});$g.debugLabel=ph(`participant-counts`);var e_=ca(function(e){var t=N({},function(t,n,r){n(e_(e),r)});return t.debugLabel=ph(`participant-receive-settings-${e}`),t}),t_=function(e){return $h(e,`screenVideo`)},n_=N(null);n_.debugLabel=ph(`send-settings`);var r_=function(e){return $h(e,`video`)};function i_({children:e}){return A(Ug,{children:e})}var a_=Ie(null),o_=`tavus:memory-user-id:`,s_=new Map;function c_(e){return`${o_}${e}`}function l_(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function u_(e){if(!e)return``;let t=c_(e);try{let e=window.localStorage.getItem(t);if(e)return e;let n=l_();return window.localStorage.setItem(t,n),n}catch{}let n=s_.get(t);if(n)return n;let r=l_();return s_.set(t,r),r}var d_=`tavus:terms-accepted:`;function f_(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t.toString(36)}function p_(e,t){return`${d_}${e}:${f_(t)}`}function m_(e,t){if(!e||!t)return!1;try{return globalThis.localStorage?.getItem(p_(e,t))===`1`}catch{return!1}}function h_(e,t){if(!(!e||!t))try{globalThis.localStorage?.setItem(p_(e,t),`1`)}catch{}}var g_=null;function __(e,t){!e||!t||(g_={deploymentId:e,content:t})}function v_(){g_&&=(h_(g_.deploymentId,g_.content),null)}function y_(e){return e===`replica`||e===`user`?e:null}function b_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function x_(e){if(!b_(e)||e.message_type!==`conversation`||typeof e.event_type!=`string`||!b_(e.properties))return null;if(e.event_type===`conversation.utterance`){let t=e.properties;return typeof t.speech==`string`?{kind:`chat-message`,sender:t.role===`replica`?`agent`:`user`,text:t.speech}:null}if(e.event_type===`conversation.utterance.streaming`){let t=e.properties;if(typeof t.speech!=`string`)return null;let n=t.final===!0||t.is_interrupted===!0;return{kind:`caption-update`,text:t.speech,final:n,role:y_(t.role)}}return null}function S_(e,t){return{message_type:`conversation`,event_type:`conversation.respond`,conversation_id:e,properties:{text:t}}}function C_(e,t){return typeof e[t]==`number`?{[t]:e[t]}:{}}function w_(e){let t=e.role===`user`||e.role===`replica`?e.role:null;return!t||typeof e.speech!=`string`?null:{kind:`utterance`,event_type:`conversation.utterance`,properties:{role:t,speech:e.speech,...C_(e,`seq`),...C_(e,`turn_idx`)}}}function T_(e){let t=e.role===`user`||e.role===`replica`?e.role:null;return!t||typeof e.speech!=`string`?null:{kind:`utterance.streaming`,event_type:`conversation.utterance.streaming`,properties:{role:t,speech:e.speech,...typeof e.final==`boolean`?{final:e.final}:{},...typeof e.is_interrupted==`boolean`?{is_interrupted:e.is_interrupted}:{},...C_(e,`seq`)}}}function E_(e){return typeof e.name!=`string`||typeof e.arguments!=`string`?null:{kind:`tool_call`,event_type:`conversation.tool_call`,properties:{name:e.name,arguments:e.arguments,...C_(e,`seq`),...C_(e,`turn_idx`)}}}function D_(e){if(typeof e.name!=`string`||typeof e.arguments!=`string`)return null;let t=e.modality===`vision`||e.modality===`audio`?e.modality:null;return t?{kind:`perception_tool_call`,event_type:`conversation.perception_tool_call`,properties:{name:e.name,arguments:e.arguments,modality:t}}:null}function O_(e){return{kind:`perception_analysis`,event_type:`conversation.perception_analysis`,properties:e}}function k_(e,t){return{kind:`speaking`,event_type:t,properties:{...C_(e,`seq`),...C_(e,`turn_idx`)}}}var A_={"conversation.utterance":w_,"conversation.utterance.streaming":T_,"conversation.tool_call":E_,"conversation.perception_tool_call":D_,"conversation.perception_analysis":O_,"conversation.replica_started_speaking":k_,"conversation.replica_stopped_speaking":k_,"conversation.user_started_speaking":k_,"conversation.user_stopped_speaking":k_};function j_(e){if(!b_(e)||e.message_type!==`conversation`||typeof e.event_type!=`string`||!b_(e.properties))return null;let t=A_[e.event_type];return t?t(e.properties,e.event_type):{kind:`unknown`,event_type:e.event_type,properties:e.properties}}function M_(e,t){return{message_type:`conversation`,event_type:t.event_type,conversation_id:e,properties:t.properties??{}}}function N_(e,t){let n=x_(e);return n?n.kind===`chat-message`?(t.appendChatMessage(n.sender,n.text),!0):(t.setCaption(n.text,n.final,n.role),!0):!1}function P_(e=5e3){let t=[],n=n=>{for(;t.length>0&&n-t[0].ts>e;)t.shift()};return{markSent(e){t.push({text:e,ts:Date.now()})},consumeMatch(e){n(Date.now());let r=t.findIndex(t=>t.text===e);return r===-1?!1:(t.splice(r,1),!0)}}}var F_=yn(`Conversation`),I_=1500,L_=Ie(null);function R_({children:e}){return A(i_,{children:A(G_,{children:e})})}function z_(e,t,n){let{role:r,speech:i}=e.properties;if(!(r===`user`&&n.consumeMatch(i)))for(let n of t)n.onUtterance?.({...e.properties})}function B_(e,t){for(let n of t)n.onToolCall?.({...e.properties})}function V_(e,t){for(let n of t)n.onPerception?.(e)}function H_(e,t){let n=e.event_type,r=n.startsWith(`conversation.replica`)?`replica`:`user`,i=n.endsWith(`started_speaking`)?`started`:`stopped`;for(let n of t)n.onSpeakingState?.({who:r,state:i,...e.properties})}function U_(e,t){for(let n of t)n.onMessage?.(e)}function W_(e,t,n){switch(e.kind){case`utterance`:case`utterance.streaming`:z_(e,t,n);return;case`tool_call`:B_(e,t);return;case`perception_tool_call`:case`perception_analysis`:V_(e,t);return;case`speaking`:H_(e,t);return;case`unknown`:U_(e,t);return}}function G_({children:e}){let{deploymentId:t,client:n,config:r}=pt(bi),{memoryStores:i}=pt(wt),a=ah(),o=Mg(),s=pt(a_),c=O(()=>Wt(`idle`),[]),l=O(()=>Wt(null),[]),u=O(()=>Wt([]),[]),d=O(()=>Wt(``),[]),f=O(()=>Wt(null),[]),p=O(()=>Wt(null),[]),m=O(()=>Wt(null),[]),h=O(()=>Wt(null),[]),g=D(null),_=O(()=>P_(),[]),v=O(()=>new Set,[]),y=O(()=>Wt(`idle`),[]),b=s?.flowSignal??y,x=k(e=>{m.value=e},[m]),S=k(e=>{h.value=e},[h]),[,C]=T(o);E(()=>{C(o),o===`joined-meeting`?(c.value=`connected`,F_.info(`Connected to meeting`)):o===`left-meeting`?(c.value=`ended`,v_(),F_.info(`Left meeting`)):o===`error`&&(p.value=`Meeting error`,c.value=`error`)},[o,c,p]),vn(()=>{let e=c.value;if(e===`connected`)for(let e of v)e.onConnect?.();else if(e===`ended`||e===`disconnecting`)for(let e of v)e.onDisconnect?.();else if(e===`error`){let e=p.peek()??`Unknown error`;for(let t of v)t.onError?.({code:`CONVERSATION_ERROR`,message:e})}}),vn(()=>{let e=b.value;for(let t of v)t.onModeChange?.(e)}),Wg({onAppMessage:k(e=>{N_(e?.data,{appendChatMessage(e,t){e===`user`&&_.consumeMatch(t)||(u.value=[...u.peek(),{id:crypto.randomUUID(),sender:e,text:t,timestamp:Date.now()}])},setCaption(e,t,n){d.value=e,f.value=n,g.current!==null&&(clearTimeout(g.current),g.current=null),t&&(g.current=setTimeout(()=>{d.value=``,f.value=null,g.current=null},I_))}});let t=j_(e?.data);t&&W_(t,v,_)},[u,d,f,_,v])}),E(()=>()=>{g.current!==null&&(clearTimeout(g.current),g.current=null)},[]);let w=k(async(e,o)=>{try{c.value=`connecting`,p.value=null;let s=e,u=m.peek();u&&s?.password==null&&(s={...s,password:u});let d=r.value.customization.conversation.unique_memory_tag===!0;if(!s?.memory_stores){let e=i??(d?[u_(t)]:[]);e.length&&(s={...s,memory_stores:e})}let f=h.peek();h.value=null,f&&s?.captcha_token==null&&(s={...s,captcha_token:f});let g=await wn(n,t,s,o);l.value={conversationId:g.conversation_id,conversationName:g.conversation_name,conversationUrl:g.conversation_url,callbackUrl:g.callback_url,createdAt:g.created_at},console.info(`[Tavus:Conversation] Conversation created:`,g.conversation_id),await a?.join({url:g.conversation_url})}catch(e){throw e instanceof Sn&&(e.status===401||e.status===403)&&r.value.has_password===!0&&(m.value=null),F_.error(`Start failed`,e),p.value=String(e),c.value=`error`,e}},[n,t,a,c,p,l,m,h,r,i]),ee=k(async()=>{let e=l.peek();c.value=`disconnecting`,e&&await Tn(n,t,e.conversationId).catch(e=>F_.error(`End conversation API failed`,e)),await a?.leave(),c.value=`ended`},[n,t,a,c,l]),te=k(e=>{if(!a)return;let t=l.peek();if(!t){F_.warn(`sendChat called before session was established; dropping message`);return}_.markSent(e),a.sendAppMessage(S_(t.conversationId,e),`*`),u.value=[...u.peek(),{id:crypto.randomUUID(),sender:`user`,text:e,timestamp:Date.now()}]},[a,u,l,_]),ne=k(e=>{if(!a){F_.warn(`sendMessage called before Daily was ready; dropping message`);return}let t=l.peek();if(!t){F_.warn(`sendMessage called before session was established; dropping message`);return}e.event_type===`conversation.respond`&&_.markSent(e.properties.text),a.sendAppMessage(M_(t.conversationId,e),`*`)},[a,l,_]),re=k(e=>{v.add(e)},[v]),ie=k(e=>{v.delete(e)},[v]),ae=O(()=>({state:c,session:l,chatMessages:u,captionText:d,captionRole:f,error:p,password:m,setPassword:x,captchaToken:h,setCaptchaToken:S,mode:b,start:w,end:ee,sendChat:te,sendMessage:ne,conversation:{start:w,end:ee,sendMessage:ne},__registerSubscriber:re,__unregisterSubscriber:ie}),[c,l,u,d,f,p,m,x,h,S,b,w,ee,te,ne,re,ie]);return A(L_.Provider,{value:ae,children:e})}function K_(){let e=pt(bi);if(!e)throw Error(`useConfig must be used within ConfigProvider`);return e}var q_=new Set([`network`,`server`,`unavailable`,`busy`,`rate_limited`]);function J_(e){return e===401||e===403?`forbidden`:e===402?`limit_exceeded`:e===423?`busy`:e===429?`rate_limited`:e===409?`concurrency`:e===503?`unavailable`:e>=500?`server`:`unknown`}function Y_(e){if(!e)return;let t=e.get(`Retry-After`);if(!t)return;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&n>=0)return n;let r=Date.parse(t);if(!Number.isNaN(r)){let e=Math.floor((r-Date.now())/1e3);return e>0?e:0}}function X_(e){if(e instanceof Sn){let t=J_(e.status);return{kind:t,status:e.status,raw:e.body,retryable:q_.has(t),retryAfterSec:Y_(e.headers)}}return e instanceof TypeError?{kind:`network`,raw:String(e),retryable:!0}:{kind:`unknown`,raw:String(e),retryable:!1}}function Z_(e){return e===`limit_exceeded`?`daily_limit`:e===`forbidden`||e===`concurrency`?null:`busy`}var Q_=`tavus_pudl_`,$_=3600*48,ev=new Map;function tv(){let e=new Date;return`${e.getUTCFullYear()}${String(e.getUTCMonth()+1).padStart(2,`0`)}${String(e.getUTCDate()).padStart(2,`0`)}`}function nv(e){return`${Q_}${e}`}function rv(e){try{let t=`${nv(e)}=`,n=document.cookie.split(`; `).find(e=>e.startsWith(t));if(!n)return 0;let[r,i]=decodeURIComponent(n.slice(t.length)).split(`.`);if(r!==tv())return 0;let a=Number.parseInt(i,10);return Number.isFinite(a)&&a>0?a:0}catch{return 0}}function iv(e,t){try{let n=encodeURIComponent(`${tv()}.${t}`);document.cookie=`${nv(e)}=${n}; max-age=${$_}; path=/; SameSite=Lax`}catch{return}}function av(e){let t=ev.get(e);return t||(t=Wt(e?rv(e):0),ev.set(e,t)),t}function ov(e){if(!e)return;iv(e,rv(e)+1);let t=rv(e),n=ev.get(e);n?n.value=t:ev.set(e,Wt(t))}var sv=new Set([`Captcha token required`,`Captcha verification failed`]);function cv(e){if(!(e instanceof Sn)||e.status!==403)return!1;try{let t=JSON.parse(e.body.trim());return typeof t.error==`string`&&sv.has(t.error)}catch{return!1}}function lv(e,t){let n=e!==null,r=(t?.captchaToken.peek()??null)!==null,[i,a]=T(!n||r),[o,s]=T(0);E(()=>{n||a(!0)},[n]);let c=k(e=>{t?.setCaptchaToken(e),a(!0)},[t]),l=k(()=>{a(!0)},[]),u=t?.captchaToken.value??null,d=D(null);return E(()=>{let e=d.current!==null;d.current=u,n&&u===null&&(a(!1),e&&s(e=>e+1))},[n,u]),{captchaReady:i,captchaEpoch:o,handleCaptchaToken:c,handleCaptchaFallback:l}}function uv({children:e}){let{config:t}=K_(),{start:n}=pt(L_),r=t.value.deployment_id??``,i=av(r),a=k(()=>{let e=t.value,n=e.limits?.daily_call_limit_per_user;return n==null||e.channel!==`widget`&&e.channel!==`embed`?null:n},[t]),[o,s]=T(`idle`),[c,l]=T(!1),[u,d]=T(null),[f,p]=T(!1),m=O(()=>Wt(`idle`),[]);E(()=>{m.value=o},[o,m]),vn(()=>{let e=t.value,n=e.limits?.daily_call_limit_per_user;n!=null&&(e.channel!==`widget`&&e.channel!==`embed`||m.value===`idle`&&i.value>=n&&(d(`daily_limit`),p(!1),s(`unavailable`)))});let h=t.value.customization.show_haircheck,g=t.value.customization.conversation.modality,_=h&&g!==`chat`,v=D(!1),y=D(!1),b=k(async()=>{l(!0);try{await n(),v.current=!1,a()!=null&&ov(r),s(`call`)}catch(e){let n=X_(e);if(cv(e)&&!v.current){v.current=!0,l(!1),s(`idle`);return}if(v.current=!1,n.kind===`forbidden`&&t.value.has_password===!0){s(`idle`);return}d(Z_(n.kind)??`busy`),p(n.retryable),s(`unavailable`)}finally{l(!1)}},[n,t,a,r]),x=k(async()=>{if(o!==`idle`&&o!==`unavailable`)return;let e=a();if(e!=null&&i.value>=e){d(`daily_limit`),p(!1),s(`unavailable`);return}if(d(null),p(!1),_&&!y.current){s(`haircheck`);return}return b()},[o,_,b,a,i]),S=k(async()=>{o===`haircheck`&&(y.current=!0,await b())},[o,b]),C=k(()=>{o===`haircheck`&&s(`idle`)},[o]),w=k(()=>{o===`call`&&s(`ended`)},[o]),ee=k(()=>{d(null),p(!1),s(`idle`)},[]),te=O(()=>({flowSignal:m,setFlowState:s,isStarting:c,unavailableCause:u,canRetry:f,start:x,join:S,cancel:C,leave:w,restart:ee}),[m,c,u,f,x,S,C,w,ee]);return A(a_.Provider,{value:te,children:e})}var dv=yn(`HostBridge`),fv=Ie(null);function pv(e){if(!e)return null;let t=e.getRootNode();return t instanceof ShadowRoot&&t.host instanceof HTMLElement?t.host:e.parentElement}function mv({children:e}){let t=pt(L_),n=pt(a_),r=dn(null),i=k(e=>{r.value=pv(e)},[r]),a=k((e,t)=>{let n=r.peek();n&&n.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0})),dv.info(`Event:`,e,t)},[r]);E(()=>{let e=r.value;if(e)return e.tavus={start:t.start,end:t.end,sendChat:t.sendChat,sendMessage:t.sendMessage},()=>{delete e.tavus}},[r.value,t]),E(()=>t.state.subscribe(e=>{switch(e){case`connected`:a(`tavus:conversation-started`,{conversationId:t.session.peek()?.conversationId??``}),a(`tavus:state-change`,{state:e});break;case`ended`:a(`tavus:conversation-ended`,{conversationId:t.session.peek()?.conversationId??``}),a(`tavus:state-change`,{state:e});break;case`error`:a(`tavus:error`,{code:`CONVERSATION_ERROR`,message:t.error.peek()??`Unknown error`}),a(`tavus:state-change`,{state:e});break;default:a(`tavus:state-change`,{state:e})}}),[t,a]),vn(()=>{if(!n)return;let e=n.flowSignal.value;a(`tavus:mode-change`,{mode:e})}),E(()=>{let e={onUtterance(e){a(`tavus:protocol-message`,{kind:`utterance`,event_type:`conversation.utterance`,properties:e})},onToolCall(e){a(`tavus:tool-call`,e),a(`tavus:protocol-message`,{kind:`tool_call`,event_type:`conversation.tool_call`,properties:e})},onPerception(e){a(`tavus:protocol-message`,e)},onSpeakingState({who:e,state:t,seq:n,turn_idx:r}){let i={state:t,...n===void 0?{}:{seq:n},...r===void 0?{}:{turn_idx:r}};a(`tavus:protocol-message`,{kind:`speaking`,event_type:e===`replica`?t===`started`?`conversation.replica_started_speaking`:`conversation.replica_stopped_speaking`:t===`started`?`conversation.user_started_speaking`:`conversation.user_stopped_speaking`,properties:i})},onMessage(e){a(`tavus:protocol-message`,e)}};return t.__registerSubscriber(e),()=>t.__unregisterSubscriber(e)},[t,a]);let o=O(()=>({shadowHost:r,dispatchEvent:a}),[r,a]);return A(fv.Provider,{value:o,children:[A(`div`,{ref:i,style:`display:contents`}),e]})}var hv=Ie(null);function gv({children:e}){let{config:t}=pt(bi),n=O(()=>Yt(()=>{let e=t.value.customization.style;return e.mode===`dark`||e.mode===`system`&&(globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1)}),[t]),r=O(()=>Yt(()=>{let e=t.value.customization.style;return e.style===`basic`?n.value?`white-black`:`black-white`:n.value?`${e.style}-dark`:e.style}),[t,n]),i=O(()=>Yt(()=>bv(t.value.customization.style)),[t]),a=O(()=>({dataTheme:r,isDark:n,cssVars:i}),[r,n,i]);return A(hv.Provider,{value:a,children:A(`div`,{"data-theme":r.value,style:xv(i.value),class:`contents`,children:e})})}var _v=[0,.125,.25,.5,.75],vv=[0,1,2,3,4],yv=[0,.2,.25,.3];function bv(e){return{"--radius-box":`${_v[e.boxes_radius]??.5}rem`,"--radius-field":`${_v[e.field_radius]??.25}rem`,"--radius-selector":`${_v[e.selectors_radius]??.5}rem`,"--border":`${vv[e.border_width]??1}px`,"--size-field":`${yv[e.fields_size]??.25}rem`,"--size-selector":`${yv[e.selectors_size]??.25}rem`,"--depth":e.depth_effect?`1`:`0`,"--noise":e.noise_effect?`1`:`0`}}function xv(e){return Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`; `)}Ie(null);var Sv=41/2,Cv=23/2,wv=Math.hypot(Sv,Cv);Array.from({length:1008},(e,t)=>{let n=t%42,r=Math.floor(t/42),i=Math.hypot(n-Sv,r-Cv)/wv*.82,a=.34+(n*13+r*7)%34/100;return{delay:`${i.toFixed(3)}s`,opacity:a.toFixed(2)}});var Tv=Ie(null);function Ev({children:e}){let t=D(null);return A(Tv.Provider,{value:{frameRef:t},children:A(`div`,{class:`@container/conversation w-full h-full`,children:A(`div`,{ref:t,class:`relative w-full h-full max-h-screen aspect-video @max-mobile:aspect-9/16 overflow-hidden rounded-box bg-base-100`,children:e})})})}var Dv=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ov=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),kv=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Av=e=>{let t=kv(e);return t.charAt(0).toUpperCase()+t.slice(1)},jv={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Mv=Ie({size:24,color:`currentColor`,strokeWidth:2,absoluteStrokeWidth:!1,class:``}),Nv=()=>pt(Mv),Pv=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Fv=({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,children:i,iconNode:a,class:o=``,...s})=>{let{size:c=24,strokeWidth:l=2,absoluteStrokeWidth:u=!1,color:d=`currentColor`,class:f=``}=Nv()??{},p=r??u?Number(n??l)*24/Number(t??c):n??l;return se(`svg`,{...jv,width:t??c??24,height:t??c??24,stroke:e??d,"stroke-width":p,class:Dv(`lucide`,f,o),...!i&&!Pv(s)&&{"aria-hidden":`true`},...s},[...a.map(([e,t])=>se(e,t)),...be(i)])},Iv=(e,t)=>{let n=({class:n=``,className:r=``,children:i,...a})=>se(Fv,{...a,iconNode:t,class:Dv(`lucide-${Ov(Av(e))}`,`lucide-${Ov(e)}`,n,r)},i);return n.displayName=Av(e),n},Lv=Iv(`captions`,[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]]),Rv=Iv(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),zv=Iv(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Bv=Iv(`camera-off`,[[`path`,{d:`M14.564 14.558a3 3 0 1 1-4.122-4.121`,key:`1rnrzw`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M20 20H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 .819-.175`,key:`1x3arw`}],[`path`,{d:`M9.695 4.024A2 2 0 0 1 10.004 4h3.993a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v7.344`,key:`1i84u0`}]]),Vv=Iv(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Hv=Iv(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Uv=Iv(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),Wv=Iv(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Gv=Iv(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Kv=Iv(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),qv=Iv(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),Jv=Iv(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),Yv=Iv(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Xv=Iv(`monitor-up`,[[`path`,{d:`m9 10 3-3 3 3`,key:`11gsxs`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]),Zv=Iv(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Qv=Iv(`phone-off`,[[`path`,{d:`M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272`,key:`1wngk7`}],[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}],[`path`,{d:`M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473`,key:`10hv5p`}]]),$v=Iv(`picture-in-picture-2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),ey=Iv(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ty=Iv(`shrink`,[[`path`,{d:`m15 15 6 6m-6-6v4.8m0-4.8h4.8`,key:`17vawe`}],[`path`,{d:`M9 19.8V15m0 0H4.2M9 15l-6 6`,key:`chjx8e`}],[`path`,{d:`M15 4.2V9m0 0h4.8M15 9l6-6`,key:`lav6yq`}],[`path`,{d:`M9 4.2V9m0 0H4.2M9 9 3 3`,key:`1pxi2q`}]]),ny=Iv(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),ry=Iv(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),iy=Iv(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ay=Iv(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function oy(e,t){return({size:n=`var(--icon-size, 1.5rem)`,class:r,"aria-label":i})=>A(`span`,{class:r,role:`img`,"aria-label":i??t,children:A(e,{size:n})})}var sy={close:oy(ay,`Close`),leave:oy(Qv,`Leave call`),more:oy(Rv,`More`),error:oy(zv,`Error`),mic:oy(Jv,`Microphone`),"mic-off":oy(qv,`Microphone muted`),cam:oy(Vv,`Camera`),"cam-off":oy(Bv,`Camera off`),"screen-share":oy(Xv,`Screen share`),pip:oy($v,`Picture in picture`),user:oy(ry,`User`),"face-smile":oy(ny,`Camera off`),captions:oy(Lv,`Closed captions`),chat:oy(Kv,`Chat`),fullscreen:oy(Gv,`Enter fullscreen`),"fullscreen-exit":oy(Yv,`Exit fullscreen`),expand:oy(Uv,`Expand`),collapse:oy(ty,`Collapse`),send:oy(ey,`Send`),"external-link":oy(Wv,`External link`),clock:oy(Hv,`Clock`),moon:oy(Zv,`Unavailable`),users:oy(iy,`Busy`)},cy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M16 19H4v-2h12v2ZM4 17H2V7h2v10Zm14-8h2V7h2v10h-2v-2h-2v2h-2V7h2v2Zm-2-2H4V5h12v2Z"/></svg>`,ly=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 21h-2v-2h2v2Zm-6-2H4v-2h10v2Zm4 0h-2v-2h2v2Zm4 0h-2v-2h-2v-2h-2v-2h-2V7h2v2h2V7h2V5h2v14ZM4 17H2V7h2v10Zm12 0h-2v-2h2v2Zm-2-2h-2v-2h2v2Zm-2-2h-2v-2h2v2Zm-2-2H8V9h2v2ZM8 9H6V7h2v2ZM6 7H4V5h2v2Zm8 0h-4V5h4v2ZM4 5H2V3h2v2Z"/></svg>`,uy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M3 4h18v2H3zm0 14h18v2H3zM1 6h2v12H1zm20 0h2v12h-2zM5 10h2v4H5zm8 0h2v4h-2zM7 8h4v2H7zm0 6h4v2H7zm8 0h4v2h-4zm0-6h4v2h-4z"/></svg>`,dy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M22 22h-2v-2h-2v-2h2v-8h2v12Zm-4-4h-8v-2h8v2ZM4 12h2v2H4v2H2V4h2v8Zm6 4H8v-6h2v6Zm10-6H10V8h10v2Zm-4-4h-2V4h2v2Zm-2-2H4V2h10v2Z"/></svg>`,fy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H6v-2h12v2ZM6 20H4v-2h2v2Zm14 0h-2v-2h2v2ZM4 18H2V6h2v12Zm18 0h-2V6h2v12Zm-5-1h-2v-2h2v2Zm-2-2h-2v-2h2v2Zm-2-2h-2V6h2v7ZM6 6H4V4h2v2Zm14 0h-2V4h2v2Zm-2-2H6V2h12v2Z"/></svg>`,py=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H6v-2h12v2ZM6 20H4v-2h2v2Zm14 0h-2v-2h2v2ZM4 18H2V6h2v12Zm4 0H6v-2h2v2Zm14 0h-2V6h2v12Zm-12-2H8v-2h2v2Zm2-2h-2v-2h2v2Zm2-2h-2v-2h2v2Zm2-2h-2V8h2v2Zm2-2h-2V6h2v2ZM6 6H4V4h2v2Zm14 0h-2V4h2v2Zm-2-2H6V2h12v2Z"/></svg>`,my=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M7 19h2v-2h2v-2h2v2h2v2h2v2H7v-2Zm13-6H4v-2h16v2Zm-3-8h-2v2h-2v2h-2V7H9V5H7V3h10v2Z"/></svg>`,hy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 22H4v-2h16v2ZM4 20H2V4h2v16Zm18 0h-2V4h2v16Zm-9-2h-2v-2h2v2Zm0-4h-2V6h2v8Zm7-10H4V2h16v2Z"/></svg>`,gy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M15 19h-2v2h-2v-2H9v-2H7v-2h10v2h-2v2Zm5-6H4v-2h16v2Zm-7-8h2v2h2v2H7V7h2V5h2V3h2v2Z"/></svg>`,_y=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M8 22H4v-2h4v2Zm12 0h-4v-2h4v2ZM4 20H2v-4h2v4Zm18 0h-2v-4h2v4Zm-6-3H8v-2h8v2Zm-8-2H6V9h2v6Zm10 0h-2V9h2v6Zm-2-6H8V7h8v2ZM4 8H2V4h2v4Zm18 0h-2V4h2v4ZM8 4H4V2h4v2Zm12 0h-4V2h4v2Z"/></svg>`,vy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H6v-2h12v2ZM6 20H4V4h2v16Zm14 0h-2v-3h2v3ZM16 9h2v2h2v2h-2v2h-2v2h-2v-4H8v-2h6V7h2v2Zm4-2h-2V4h2v3Zm-2-3H6V2h12v2Z"/></svg>`,yy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M13 22h-2v-2H8v-2h8v2h-3v2Zm-5-4H6v-2h2v2Zm10 0h-2v-2h2v2ZM6 16H4v-6h2v6Zm8 0h-4v-2h4v2Zm6 0h-2v-6h2v6Zm-10-2H8V4h2v10Zm6 0h-2V4h2v10ZM14 4h-4V2h4v2Z"/></svg>`,by=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M13 22h-2v-2H8v-2h8v2h-3v2Zm9 0h-2v-2h2v2Zm-2-2h-2v-2h2v2ZM8 18H6v-2h2v2Zm10 0h-2v-2h2v2ZM6 16H4v-6h2v6Zm8-2h2v2h-6v-2h2v-2h2v2Zm-4-4h2v2h-2v2H8V8h2v2Zm10 4h-2v-4h2v4Zm-4-4h-2V4h2v6ZM8 8H6V6h2v2ZM6 6H4V4h2v2ZM4 4H2V2h2v2Zm10 0h-4V2h4v2Z"/></svg>`,xy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M18 22H8v-2h10v2ZM8 20H6v-2h2v2Zm12 0h-2v-2h2v2ZM6 18H4v-2h2v2Zm16 0h-2v-4h-2v-2h2v-2h2v8ZM4 16H2V6h2v10Zm14 0h-6v-2h6v2Zm-6-2h-2v-2h2v2Zm-2-2H8V6h2v6ZM6 6H4V4h2v2Zm8-2h-2v2h-2V4H6V2h8v2Z"/></svg>`,Sy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M5 15H3v-2h2v2Zm8 0h-2v-2h2v2Zm8 0h-2v-2h2v2ZM3 13H1v-2h2v2Zm4 0H5v-2h2v2Zm4 0H9v-2h2v2Zm4 0h-2v-2h2v2Zm4 0h-2v-2h2v2Zm4 0h-2v-2h2v2ZM5 11H3V9h2v2Zm8 0h-2V9h2v2Zm8 0h-2V9h2v2Z"/></svg>`,Cy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 20H4v-2h16v2ZM4 18H2V6h2v12Zm18 0h-2V6h2v12ZM18 8v6h-8V8h8Zm2-2H4V4h16v2Zm-4 4h-4v2h4v-2Z"/></svg>`,wy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 18h-7v2h3v2H8v-2h3v-2H4v-2h16v2ZM4 16H2V4h2v12Zm18 0h-2v-6h2v6Zm-6-6h-2V8h2v2Zm2-2h-2V6h2v2Zm4-6v6h-2V6h-2V4h-2V2h6Zm-8 2H4V2h10v2Z"/></svg>`,Ty=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M4 19h4v2H2v-8h2v6Zm8 0H8v-2h4v2Zm4-2h-4v-2h4v2Zm4-2h-4v-2h4v2Zm-10-2H4v-2h6v2Zm12 0h-2v-2h2v2ZM8 5H4v6H2V3h6v2Zm12 6h-4V9h4v2Zm-4-2h-4V7h4v2Zm-4-2H8V5h4v2Z"/></svg>`,Ey=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M6 22H4v-4h2v4Zm14 0h-2v-4h2v4ZM8 18H6v-2h2v2Zm10 0h-2v-2h2v2Zm-2-2H8v-2h8v2Zm-1-4H9v-2h6v2Zm-6-2H7V4h2v6Zm8 0h-2V4h2v6Zm-2-6H9V2h6v2Z"/></svg>`,Dy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M2 22H0v-4h2v4Zm14 0h-2v-4h2v4Zm8 0h-2v-4h2v4ZM4 18H2v-2h2v2Zm10 0h-2v-2h2v2Zm8 0h-2v-2h2v2Zm-10-2H4v-2h8v2Zm8 0h-4v-2h4v2Zm-9-4H5v-2h6v2Zm8 0h-4v-2h4v2ZM5 10H3V4h2v6Zm8 0h-2V4h2v6Zm8 0h-2V4h2v6ZM11 4H5V2h6v2Zm8 0h-4V2h4v2Z"/></svg>`,Oy=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M20 22H4v-2h16v2ZM4 20H2v-6H0v-2h2V8h2v12Zm18-8h2v2h-2v6h-2V8h2v4Zm-8 6h-4v-2h4v2Zm-4-2H8v-2h2v2Zm6 0h-2v-2h2v2Zm-6-4H8v-2h2v2Zm6 0h-2v-2h2v2Zm-3-6h7v2H4V6h7V4h2v2Zm4-2h-4V2h4v2Z"/></svg>`,ky=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M17 21H5v-2h12v2ZM5 19H3V7h2v12Zm14 0h-2v-6h2v6Zm-8-4H9v-2h2v2Zm2-2h-2v-2h2v2Zm2-2h-2V9h2v2Zm6 0h-2V7h-2V5h-4V3h8v8Zm-4-2h-2V7h2v2Zm-6-2H5V5h6v2Z"/></svg>`;function Ay(e){return e.replace(/\s(width|height)="\d+"/g,``)}function jy(e,t){let n=Ay(e);return({size:e=`var(--icon-size, 1.5rem)`,class:r,"aria-label":i})=>A(`span`,{class:r,role:`img`,"aria-label":i??t,style:{display:`inline-flex`,width:e,height:e},dangerouslySetInnerHTML:{__html:n.replace(`<svg`,`<svg width="100%" height="100%"`)}})}var My={pixelarticons:{close:jy(py,`Close`),leave:jy(vy,`Leave call`),more:jy(Sy,`More`),error:jy(hy,`Error`),mic:jy(yy,`Microphone`),"mic-off":jy(by,`Microphone muted`),cam:jy(cy,`Camera`),"cam-off":jy(ly,`Camera off`),"screen-share":jy(wy,`Screen share`),pip:jy(Cy,`Picture in picture`),user:jy(Ey,`User`),"face-smile":jy(Oy,`Camera off`),captions:jy(uy,`Closed captions`),chat:jy(dy,`Chat`),fullscreen:jy(_y,`Enter fullscreen`),"fullscreen-exit":jy(my,`Exit fullscreen`),expand:jy(gy,`Expand`),collapse:jy(my,`Collapse`),send:jy(Ty,`Send`),"external-link":jy(ky,`External link`),clock:jy(fy,`Clock`),moon:jy(xy,`Unavailable`),users:jy(Dy,`Busy`)},lucide:sy};function Ny({name:e,...t}){let{config:n}=K_(),r=(My[n.value.customization.style.icon_library]??My.pixelarticons)[e];return A(r,{...t})}var Py=`Ready when you are`,Fy=`Start the conversation`;function Iy(e){return typeof e==`string`&&e.length>0?e:``}function Ly(e){let t=Iy(e.replica_thumbnail_image_url)||null,n=Iy(e.replica_thumbnail_video_url)||null;return!t&&!n?null:{imageUrl:t,videoUrl:n}}function Ry(e){let{preview:t}=e.customization,{background:n}=t,r=Ly(e),i;i=n.type?n.type:r?`replica`:`background-gradient`;let a=Iy(n.url);return{title:t.title||Py,description:t.description||``,btn_title:t.btn_title||Fy,background:{type:i,url:a}}}var zy={backgroundImage:`linear-gradient(to bottom right, var(--color-primary), var(--color-base-300))`},By=`#t=0.1`;function Vy(e){return e.includes(`#`)?e:`${e}${By}`}function Hy({replica:e,fallback:t=null}){let[n,r]=T(!1);E(()=>{r(!1)},[e.imageUrl]);let i=`absolute inset-0 w-full h-full object-cover`;return e.imageUrl&&!n?A(`img`,{class:i,src:e.imageUrl,loading:`lazy`,alt:``,onError:()=>r(!0)}):e.videoUrl?A(`video`,{class:i,src:Vy(e.videoUrl),muted:!0,playsinline:!0,preload:`metadata`,controls:!1}):A(ue,{children:t})}function Uy({variant:e,replica:t}){let[n,r]=T(!1);return E(()=>{r(!1)},[e.url]),e.type===`replica`&&t?A(Hy,{replica:t,fallback:A(`div`,{class:`absolute inset-0`,style:zy})}):e.type===`custom-image`&&e.url&&!n?A(`img`,{class:`absolute inset-0 w-full h-full object-cover`,src:e.url,loading:`lazy`,alt:``,onError:()=>r(!0)}):A(`div`,{class:`absolute inset-0`,style:zy})}function Wy({className:e=``}){let{config:t}=K_(),n=Ry(t.value),r=Ly(t.value);return A(`div`,{class:`relative size-16 shrink-0 rounded-box overflow-hidden bg-base-300 ${e}`,children:A(Uy,{variant:n.background,replica:r})})}var Gy=`absolute inset-0 bg-base-100 text-base-content flex flex-col items-center justify-center gap-6 px-6 py-8 text-center overflow-y-auto motion-safe:animate-[tavusFadeUp_280ms_ease-out]`;function Ky({children:e,class:t,role:n,"aria-live":r}){return A(`div`,{class:t?`${Gy} ${t}`:Gy,role:n,"aria-live":r,children:e})}function qy({title:e,description:t,media:n,children:r,overlay:i}){return A(Ky,{children:[n===void 0?A(Wy,{}):n,(e||t)&&A(`div`,{class:`flex flex-col items-center gap-3 max-w-sm`,children:[e&&A(`h2`,{class:`text-lg font-medium leading-snug`,children:e}),t&&A(`p`,{class:`text-base text-base-content/60 tracking-wide leading-snug`,children:t})]}),r&&A(`div`,{class:`flex flex-col items-center gap-3`,children:r}),i]})}var Jy={daily_limit:{title:`PAL is at today's limit`,description:`This PAL can take more conversations tomorrow.`},total_limit:{title:`PAL is unavailable`,description:`This PAL isn't available right now. Please check back later.`},busy:{title:`PAL is in another conversation`,description:`Please try again in a moment.`},error:{title:`Couldn't load this PAL`,description:`This PAL couldn't be loaded. Please try again later.`}};function Yy(e,t){let n=t?.[e];return{title:n?.title||Jy[e].title,description:n?.description||Jy[e].description}}var Xy={daily_limit:`clock`,total_limit:`moon`,busy:`users`,error:`error`};function Zy({cause:e}){return A(`div`,{class:`flex size-16 shrink-0 items-center justify-center rounded-box bg-base-200 text-base-content/70`,children:A(Ny,{name:Xy[e],size:`2rem`})})}function Qy({cause:e,canRetry:t,onRetry:n,onCancel:r}){let{config:i}=K_(),a=i.value.customization?.unavailable_screen,o=Yy(e,a),s=a?.cta??[],c=e===`busy`||s.length>0||!!r;return A(qy,{media:A(Zy,{cause:e}),title:o.title,description:o.description,children:c&&A(`div`,{class:`flex flex-wrap items-center justify-center gap-2`,children:[e===`busy`&&A(`button`,{type:`button`,class:`btn btn-neutral rounded-box`,disabled:!t,onClick:n,children:`Try again`}),s.map(e=>A(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`btn btn-outline rounded-box`,children:e.title},e.url)),r&&A(`button`,{type:`button`,class:`btn btn-ghost`,onClick:r,children:`Close`})]})})}function $y(){let e=pt(a_);return{state:e.flowSignal.value,isStarting:e.isStarting,unavailableCause:e.unavailableCause,canRetry:e.canRetry,start:e.start,join:e.join,cancel:e.cancel,leave:e.leave,restart:e.restart}}var eb=`Thanks for joining`,tb=`You can start a new conversation whenever you're ready.`,nb=`Start a new conversation`;function rb(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`||t.protocol===`mailto:`}catch{return!1}}function ib({text:e,onRestart:t}){let{config:n}=K_(),r=n.value.customization.after_call,i=r.cta.filter(e=>rb(e.url));return A(qy,{title:r.title||e?.title||eb,description:r.description||e?.description||tb,children:[A(`button`,{type:`button`,class:`btn btn-neutral rounded-box`,onClick:t,children:e?.restart||nb}),i.length>0&&A(`div`,{class:`flex flex-wrap items-center justify-center gap-2`,children:i.map(e=>A(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`btn btn-outline rounded-box`,children:e.title},e.url))})]})}function ab(){let e=ah(),t=Uh(),{isOff:n}=r_(t),{camState:r}=Zg();return{isCamReady:O(()=>r===`granted`,[r]),isCamMuted:n,localSessionId:t,onToggleCamera:k(()=>{e?.setLocalVideo(n)},[e,n])}}function ob(){let e=ah(),t=Uh(),{isOff:n}=Kg(t),{micState:r}=Zg();return{isMicReady:O(()=>r===`granted`,[r]),isMicMuted:n,localSessionId:t,onToggleMicrophone:k(()=>{e?.setLocalAudio(n)},[e,n])}}function sb(){let e=ah(),t=Uh(),{isOff:n}=t_(t),r=!n;return{isScreenSharing:r,localSessionId:t,onToggleScreenshare:k(()=>{r?e?.stopScreenShare():e?.startScreenShare({displayMediaOptions:{audio:!1,selfBrowserSurface:`exclude`,surfaceSwitching:`include`,video:{width:1920,height:1080}}})},[e,r])}}function cb(e){switch(e){case`blocked`:return`blocked`;case`in-use`:return`in-use`;case`not-found`:return`not-found`;case`not-supported`:case`undefined-mediadevices`:return`unsupported`;default:return null}}function lb(e,t,n,r){return e===`granted`&&r?`granted`:cb(e)||(t===`denied`?`blocked`:t===`prompt`?e===`granted`&&n?`granted`:`prompt`:t===`granted`?n?`checking`:`prompt`:e===`granted`?`granted`:n?`checking`:`prompt`)}function ub(e,t){let n=e===`granted`,r=e===`blocked`||e===`in-use`||e===`not-found`||e===`unsupported`;return{status:e,isGranted:n,isBlocked:r,canRequest:e===`prompt`,needsAttention:r||e===`prompt`&&t!==`granted`}}function db(e){let[t,n]=T(null);return E(()=>{let t=!1,r=navigator.permissions;if(r?.query)return r.query({name:e}).then(e=>{t||(n(e.state),e.onchange=()=>{t||n(e.state)})}).catch(()=>{}),()=>{t=!0}},[e]),t}function fb(){let e=ah(),t=Mg(),n=Uh(),{micState:r,camState:i,currentMic:a,currentCam:o}=Zg(),s=db(`microphone`),c=db(`camera`),l=t===`joined-meeting`||!!n,[u,d]=T(!1),[f,p]=T(!1),m=k(()=>{e&&(d(!0),l?e.setLocalAudio(!0):Promise.resolve(e.startCamera({videoSource:!1})).catch(()=>{}))},[e,l]),h=k(async()=>{if(e){p(!0);try{await e.setInputDevicesAsync({videoSource:!0})}catch{}e.setLocalVideo(!0)}},[e]);return{mic:O(()=>ub(lb(r,s,u,!!a),s),[r,s,u,a]),camera:O(()=>ub(lb(i,c,f,!!o),c),[i,c,f,o]),requestMic:m,requestCamera:h}}var pb={microphone:`microphone`,camera:`camera`};function mb({class:e}){return A(`svg`,{class:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[A(`circle`,{cx:`7`,cy:`8`,r:`2.2`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{cx:`16`,cy:`16`,r:`2.2`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`path`,{d:`M2 8h2.5M9.5 8H22M2 16h11.5M18.5 16H22`,stroke:`currentColor`,"stroke-width":`1.6`,"stroke-linecap":`round`})]})}function hb(){return A(`svg`,{viewBox:`0 0 240 180`,class:`w-full h-auto text-base-content/70`,fill:`none`,"aria-hidden":`true`,children:[A(`rect`,{x:`10`,y:`20`,width:`220`,height:`150`,rx:`10`,stroke:`currentColor`,"stroke-width":`2`}),A(`path`,{d:`M10 46h220`,stroke:`currentColor`,"stroke-width":`2`}),A(`circle`,{cx:`26`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{cx:`40`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{cx:`54`,cy:`33`,r:`3.5`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`path`,{d:`M78 33h14M86 27l-6 6 6 6M104 27v12`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),A(`rect`,{x:`118`,y:`25`,width:`96`,height:`16`,rx:`8`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`circle`,{class:`text-info`,cx:`128`,cy:`33`,r:`11`,fill:`currentColor`,opacity:`0.18`}),A(`circle`,{class:`text-info`,cx:`128`,cy:`33`,r:`11`,stroke:`currentColor`,"stroke-width":`1.6`}),A(`g`,{class:`text-info`,transform:`translate(120 25) scale(0.66)`,children:A(mb,{})}),A(`g`,{transform:`translate(34 78)`,children:[A(`rect`,{x:`0`,y:`8`,width:`34`,height:`26`,rx:`5`,stroke:`currentColor`,"stroke-width":`2`}),A(`path`,{d:`M34 16l14-8v26l-14-8`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linejoin":`round`})]}),A(`g`,{transform:`translate(40 120)`,children:[A(`rect`,{x:`6`,y:`0`,width:`14`,height:`24`,rx:`7`,stroke:`currentColor`,"stroke-width":`2`}),A(`path`,{d:`M0 20a13 13 0 0 0 26 0M13 33v8`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})]}),A(`path`,{d:`M150 64l34 14-14 4-2 16-18-34Z`,fill:`currentColor`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linejoin":`round`})]})}var gb=P(({device:e,onClose:t})=>{let n=pb[e];return E(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),A(`div`,{class:`absolute inset-0 z-50 flex items-center justify-center p-4 bg-black/50 motion-safe:animate-[tavusFadeUp_180ms_ease-out]`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tavus-blocked-title`,onClick:t,children:A(`div`,{class:`relative w-full max-w-md rounded-box bg-base-100 text-base-content shadow-xl overflow-hidden`,onClick:e=>e.stopPropagation(),children:[A(`button`,{type:`button`,class:`btn btn-sm btn-circle btn-ghost absolute top-2 right-2 z-10`,onClick:t,"aria-label":`Close`,children:A(Ny,{name:`close`,size:`1.1rem`})}),A(`div`,{class:`grid @3xl:grid-cols-[1fr_1.2fr] gap-4 p-5 @max-md:p-4`,children:[A(`div`,{class:`flex items-center justify-center @max-md:hidden`,children:A(hb,{})}),A(`div`,{class:`flex flex-col gap-4`,children:[A(`h2`,{id:`tavus-blocked-title`,class:`text-lg font-semibold leading-snug pr-6`,children:[`Access to your `,n,` is blocked`]}),A(`ol`,{class:`flex flex-col gap-3 text-sm`,children:[A(`li`,{class:`flex items-start gap-2`,children:[A(`span`,{class:`font-semibold tabular-nums`,children:`1.`}),A(`span`,{class:`leading-snug`,children:[`Click the `,A(mb,{class:`inline-block align-text-bottom h-4 w-4 mx-0.5`}),` `,`settings icon in your browser's address bar`]})]}),A(`li`,{class:`flex items-start gap-2`,children:[A(`span`,{class:`font-semibold tabular-nums`,children:`2.`}),A(`span`,{class:`leading-snug`,children:[`Allow `,n,` access, then reload the page`]})]})]}),A(`button`,{type:`button`,class:`btn btn-neutral btn-sm self-start`,onClick:t,children:`Got it`})]})]})]})})}),_b=Ie({open:()=>{},close:()=>{}});function vb(){return pt(_b)}function yb({children:e}){let[t,n]=T(null),r=k(e=>n(e),[]),i=k(()=>n(null),[]),a=O(()=>({open:r,close:i}),[r,i]);return A(_b.Provider,{value:a,children:[e,t&&A(gb,{device:t,onClose:i})]})}var bb=P(()=>A(`span`,{"aria-hidden":`true`,class:`absolute -top-0.5 -right-0.5 z-20 flex h-4 w-4 items-center justify-center rounded-full bg-warning text-warning-content text-[0.6rem] font-bold leading-none ring-2 ring-base-100 pointer-events-none`,children:`!`})),xb=`select-control-pill relative inline-flex items-center bg-neutral text-neutral-content`,Sb=`absolute inset-0 w-full h-full opacity-0 cursor-pointer appearance-none disabled:cursor-not-allowed`,Cb=`absolute right-1.5 top-1/2 -translate-y-1/2 pointer-events-none flex items-center`,wb=`absolute left-0 top-0 h-full aspect-square flex items-center justify-center pointer-events-none`,Tb=`absolute left-0 top-0 z-10 btn btn-control btn-neutral`;function Eb(){return A(`svg`,{style:{width:`var(--chevron-size, 0.75rem)`,height:`var(--chevron-size, 0.75rem)`},viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:A(`path`,{d:`M4 6L8 10L12 6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})})}function Db(){let e=Uh(),t=D(null),n=D(void 0);return Gg(e??``,k(e=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let n=Math.max(0,Math.min(1,e**.6));t.current?.style.setProperty(`--mic-level`,String(n))})},[])),A(`span`,{ref:t,"aria-hidden":`true`,class:`pointer-events-none absolute inset-x-0 bottom-0 z-0 bg-success/70`,style:{"--mic-level":`0`,height:`calc(var(--mic-level, 0) * 100%)`,transition:`height 100ms ease-out`}})}function Ob({value:e,devices:t,disabled:n,onChange:r,label:i}){return A(ue,{children:[A(`select`,{class:Sb,value:e,onChange:e=>r(e.target.value),disabled:n,"aria-label":i,children:t.map(({device:e})=>A(`option`,{value:e.deviceId,children:e.label},e.deviceId))}),A(`span`,{class:Cb,children:A(Eb,{})})]})}function kb(e){return A(`div`,{class:xb,children:A(Ob,{...e})})}function Ab({iconName:e,...t}){return A(`div`,{class:xb,children:[A(`span`,{class:wb,"aria-hidden":`true`,children:A(Ny,{name:e})}),A(Ob,{...t})]})}var jb=P(({level:e=!1})=>{let{onToggleMicrophone:t,isMicReady:n,isMicMuted:r}=ob(),{microphones:i,currentMic:a,setMicrophone:o}=Zg();if(!a||(i?.length??0)<=1)return A(Pb,{level:e});let s=e&&n&&!r;return A(`div`,{class:`relative inline-flex items-center`,children:[A(kb,{value:a?.device?.deviceId,devices:i||[],disabled:!n,onChange:e=>o(e),label:`Select microphone`}),A(`button`,{type:`button`,onClick:t,disabled:!n,class:`${Tb} overflow-hidden`,"aria-label":r?`Unmute microphone`:`Mute microphone`,"aria-pressed":r,children:[s&&A(Db,{}),A(`span`,{class:`relative z-10 inline-flex`,children:A(Ny,{name:r||!n?`mic-off`:`mic`})})]})]})});function Mb(){let{onToggleCamera:e,isCamMuted:t}=ab(),{camera:n,requestCamera:r}=fb(),{open:i}=vb(),a=n.isGranted&&!t;return{isOn:a,onClick:()=>{if(n.isBlocked)return i(`camera`);if(a)return e();r()},label:a?`Turn camera off`:n.isGranted?`Turn camera on`:`Enable camera`,needsAttention:n.needsAttention}}var Nb=P(()=>{let{isCamReady:e}=ab(),{currentCam:t,cameras:n,setCamera:r}=Zg(),i=Mb();return!t||(n?.length??0)<=1?A(Fb,{}):A(`div`,{class:`relative inline-flex items-center`,children:[A(kb,{value:t?.device?.deviceId,devices:n||[],disabled:!e,onChange:e=>r(e),label:`Select camera`}),A(`button`,{type:`button`,onClick:i.onClick,class:Tb,"aria-label":i.label,"aria-pressed":!i.isOn,children:A(Ny,{name:i.isOn?`cam`:`cam-off`})})]})}),Pb=P(({level:e=!1})=>{let{onToggleMicrophone:t,isMicMuted:n}=ob(),{mic:r,requestMic:i}=fb(),{open:a}=vb(),o=()=>{if(r.isGranted)return t();if(r.isBlocked)return a(`microphone`);i()},s=r.isGranted?n?`Unmute microphone`:`Mute microphone`:`Allow microphone access`,c=e&&r.isGranted&&!n;return A(`span`,{class:`relative inline-flex`,children:[A(`button`,{type:`button`,onClick:o,class:`btn btn-control btn-neutral relative overflow-hidden`,"aria-label":s,"aria-pressed":r.isGranted?n:void 0,children:[c&&A(Db,{}),A(`span`,{class:`relative z-10 inline-flex`,children:A(Ny,{name:n||!r.isGranted?`mic-off`:`mic`})})]}),r.needsAttention&&A(bb,{})]})}),Fb=P(()=>{let{isOn:e,onClick:t,label:n,needsAttention:r}=Mb();return A(`span`,{class:`relative inline-flex`,children:[A(`button`,{type:`button`,onClick:t,class:`btn btn-control btn-neutral`,"aria-label":n,"aria-pressed":!e,children:A(Ny,{name:e?`cam`:`cam-off`})}),r&&A(bb,{})]})});P(({compact:e=!1}={})=>{let{isMicReady:t}=ob(),{microphones:n,currentMic:r,setMicrophone:i}=Zg();return(n?.length??0)<=1?null:A(Ab,{iconName:`mic`,value:r?.device?.deviceId,devices:n,disabled:!t,onChange:e=>i(e),label:`Select microphone`,compact:e})}),P(({compact:e=!1}={})=>{let{isCamReady:t}=ab(),{currentCam:n,cameras:r,setCamera:i}=Zg();return(r?.length??0)<=1?null:A(Ab,{iconName:`cam`,value:n?.device?.deviceId,devices:r,disabled:!t,onChange:e=>i(e),label:`Select camera`,compact:e})});var Ib=P((e={})=>{let{onToggleScreenshare:t,isScreenSharing:n}=sb();return A(`button`,{type:`button`,onClick:t,class:`btn btn-control ${n?`btn-primary`:`btn-neutral`}`,"aria-label":n?`Stop screen share`:`Start screen share`,"aria-pressed":n,children:A(Ny,{name:`screen-share`})})});function Lb(e){let t=pt(L_);if(!t)throw Error(`useConversation must be used within ConversationProvider`);return E(()=>{if(e)return t.__registerSubscriber(e),()=>t.__unregisterSubscriber(e)},[e]),t}var Rb=Ie(null);function zb({children:e,defaultEnabled:t=!1}){let[n,r]=T(t),i=k(()=>r(e=>!e),[]),a=O(()=>({isEnabled:n,toggle:i}),[n,i]);return A(Rb.Provider,{value:a,children:e})}function Bb(){let e=pt(Rb);if(!e)throw Error(`ClosedCaptions components must be used within <ClosedCaptionsProvider>`);return e}var Vb=P(()=>{let{isEnabled:e,toggle:t}=Bb();return A(`button`,{type:`button`,onClick:t,"aria-pressed":e,class:`btn btn-control ${e?`btn-primary`:`btn-neutral`}`,"aria-label":e?`Hide captions`:`Show captions`,children:A(Ny,{name:`captions`,"aria-label":e?`Closed Captions On`:`Closed Captions Off`})})}),Hb=P(()=>{let{isEnabled:e}=Bb(),{captionText:t,captionRole:n}=Lb(),r=t.value,i=n.value;return!e||!r?null:A(`div`,{class:`absolute bottom-24 left-1/2 -translate-x-1/2 max-w-[80%] px-4 py-2 rounded-box bg-black/60 text-white z-10`,role:`status`,"aria-live":`polite`,children:A(`div`,{class:`text-sm leading-5 max-h-15 overflow-hidden flex flex-col justify-end text-center`,children:A(`div`,{children:[A(`span`,{class:`text-xs ${i===`replica`?`text-secondary`:`text-primary`} mr-2`,children:i===`replica`?`PAL`:`You`}),r]})})})}),Ub=Ie(null);function Wb({children:e,defaultOpen:t=!1}){let[n,r]=T(t),i=k(()=>r(e=>!e),[]),a=k(()=>r(!1),[]),o=O(()=>({isOpen:n,toggle:i,close:a}),[n,i,a]);return A(Ub.Provider,{value:o,children:e})}function Gb(){let e=pt(Ub);if(!e)throw Error(`Chat components must be used within <ChatProvider>`);return e}var Kb=P((e={})=>{let{isOpen:t,toggle:n}=Gb();return A(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":t?`Close chat`:`Open chat`,class:`btn btn-control ${t?`btn-primary`:`btn-neutral`}`,children:A(Ny,{name:`chat`})})}),qb=P(({message:e})=>{let t=e.sender===`user`;return A(`li`,{class:`flex flex-col gap-1 ${t?`items-end`:`items-start`}`,children:[A(`span`,{class:`text-xs ${t?`text-primary`:`text-secondary`}`,children:t?`You`:`PAL`}),A(`span`,{class:`px-3 py-2 rounded-field text-sm max-w-[80%] ${t?`bg-primary text-primary-content`:`bg-base-200 text-base-content`}`,children:e.text})]})}),Jb=P(()=>{let{isOpen:e,close:t}=Gb(),{chatMessages:n,sendChat:r,session:i}=Lb(),a=i.value?.conversationId??null,o=n.value,[s,c]=T(``),l=D(null);E(()=>{let e=l.current;e&&(e.scrollTop=e.scrollHeight)},[o.length]);let u=k(()=>{let e=s.trim();!e||!a||(r(e),c(``))},[s,r,a]),d=k(e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),u())},[u]),f=!!s.trim()&&!!a;return A(`aside`,{class:`absolute top-0 right-0 w-80 h-full bg-base-100 border-l border-base-300 flex flex-col z-30 transition-transform ${e?`translate-x-0`:`translate-x-full`} @max-mobile:w-full`,"aria-hidden":!e,inert:!e,children:[A(`header`,{class:`flex items-center justify-between px-4 py-3 border-b border-base-300`,children:[A(`span`,{class:`font-medium text-base-content`,children:`Chat`}),A(`button`,{type:`button`,class:`btn btn-ghost btn-sm btn-circle`,onClick:t,"aria-label":`Close chat`,children:A(Ny,{name:`close`,size:20})})]}),A(`ul`,{ref:l,class:`flex-1 overflow-y-auto p-4 flex flex-col gap-3`,role:`log`,"aria-live":`polite`,children:o.length===0?A(`li`,{class:`text-center text-sm opacity-70`,children:a?`Send a message to start the conversation.`:`Connecting…`}):o.map(e=>A(qb,{message:e},e.id))}),A(`form`,{class:`flex items-end gap-2 p-3 border-t border-base-300`,onSubmit:e=>{e.preventDefault(),u()},children:[A(`textarea`,{class:`textarea textarea-bordered textarea-sm flex-1 resize-none`,value:s,onChange:e=>c(e.target.value),onKeyDown:d,placeholder:a?`Type a message…`:`Connecting…`,disabled:!a,rows:1,"aria-label":`Message`}),A(`button`,{type:`submit`,class:`btn btn-primary btn-sm btn-circle`,disabled:!f,"aria-label":`Send message`,children:A(Ny,{name:`send`,size:18})})]})]})});function Yb({label:e}){return A(Ky,{role:`status`,"aria-live":`polite`,class:`z-2`,children:[A(Wy,{}),A(`div`,{class:`flex flex-col items-center gap-3`,children:[A(`span`,{class:`loading loading-spinner loading-md text-base-content`}),A(`span`,{class:`text-base font-medium`,children:e})]})]})}var Xb=P(()=>A(Yb,{label:`Connecting`})),Zb=P(()=>A(Yb,{label:`Leaving`}));function Qb({active:e,onToggle:t,tooltip:n}){return A(`button`,{type:`button`,onClick:t,class:`btn btn-xs btn-control ${e?`btn-info`:`btn-neutral`}`,"aria-label":n??(e?`Exit fullscreen`:`Enter fullscreen`),title:n,children:A(Ny,{name:e?`fullscreen-exit`:`fullscreen`,size:`calc(var(--size-field, 0.25rem) * 3.5)`})})}var $b=P(({id:e})=>{let t=Gh()===e,n=D(null),r=D(null),i=D(null),a=D(void 0);Gg(e,k(e=>{a.current&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{let t=Number(Math.max(.01,e).toFixed(2));n.current&&r.current&&i.current&&(n.current.style.height=`${20+t*40}%`,r.current.style.height=`${20+t*130}%`,i.current.style.height=`${20+t*40}%`)})},[]));let o=`w-[3px] rounded-full bg-base-100 transition-[opacity] ${t?`opacity-100`:`opacity-50`}`;return A(`div`,{class:`flex items-center justify-center w-6 h-6`,children:A(`div`,{class:`flex items-center justify-center gap-[2px] w-full h-full`,children:[A(`div`,{ref:n,class:o,style:{height:`20%`}}),A(`div`,{ref:r,class:o,style:{height:`20%`}}),A(`div`,{ref:i,class:o,style:{height:`20%`}})]})})}),ex=[0,1,2],tx=.05,nx=450;function rx({sessionId:e,className:t=``}){let{config:n}=K_(),r=Ry(n.value),i=Ly(n.value),a=D(null),o=D(void 0),s=D(void 0),[c,l]=T(!1),u=D(!1);return Gg(e??``,k(t=>{e&&(o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let e=Math.max(0,Math.min(1,t**.6));a.current?.style.setProperty(`--audio-level`,String(e)),e>tx?(s.current&&=(clearTimeout(s.current),void 0),u.current||(u.current=!0,l(!0))):u.current&&s.current===void 0&&(s.current=setTimeout(()=>{s.current=void 0,u.current=!1,l(!1)},nx))}))},[e])),E(()=>()=>{o.current&&cancelAnimationFrame(o.current),s.current&&clearTimeout(s.current)},[]),A(`div`,{ref:a,class:`relative aspect-square w-full max-w-[min(48cqi,16rem)] mx-auto pointer-events-none ${t}`,style:{"--audio-level":`0`},"aria-hidden":`true`,children:[ex.map(e=>A(`div`,{class:`absolute inset-[16%] rounded-full will-change-transform`,style:{border:`2px solid var(--color-primary)`,opacity:0,animation:c?`tavusAudioWave 2.4s ease-out ${e*.8}s infinite`:`none`,"--wave-peak":`calc(0.18 + var(--audio-level, 0) * 0.5)`}},e)),A(`div`,{class:`absolute inset-[16%] rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--color-primary) 60%, transparent), transparent 70%)`,filter:`blur(20px)`,scale:`calc(1 + var(--audio-level, 0) * 0.25)`,opacity:`calc(0.35 + var(--audio-level, 0) * 0.5)`,transition:`scale 120ms ease-out, opacity 120ms ease-out`}}),A(`div`,{class:`absolute inset-[20%] rounded-full overflow-hidden bg-base-300 ring-2 ring-base-100/20 shadow-xl will-change-transform`,style:{scale:`calc(1 + var(--audio-level, 0) * 0.06)`,transition:`scale 100ms ease-out`},children:A(Uy,{variant:r.background,replica:i})})]})}function ix({children:e,class:t,className:n,...r}){return A(`div`,{class:`tavus-mesh-bg ${t??n??``}`,...r,children:[A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-1`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-2`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-3`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-4`}),A(`div`,{class:`tavus-mesh-blob tavus-mesh-blob-5`}),A(`div`,{class:`absolute inset-0 bg-linear-to-t from-black/30 via-black/10 to-transparent pointer-events-none backdrop-blur-xs`}),e]})}var ax=e=>!!e.user_id?.includes(`tavus-replica`);function ox(){return Xh({filter:ax})}function sx(e){let t=ox()[0],n=r_(t??``),r=Mg(),[i,a]=T(!1);return E(()=>{t&&(n.state===`playable`||e)&&a(!0)},[t,n.state,e]),r===`left-meeting`||r===`error`?{phase:`left`}:!i||!t?{phase:`connecting`}:{phase:`ready`,replicaId:t,videoState:n}}var cx=P(({isAudioOnly:e})=>{let t=sx(e);return t.phase===`left`?A(Zb,{}):t.phase===`connecting`?A(Xb,{}):e?A(ix,{class:`flex items-center justify-center`,children:[A(rx,{sessionId:t.replicaId}),A(tg,{sessionId:t.replicaId})]}):A(`div`,{class:`relative w-full h-full`,children:[A(rg,{automirror:!0,sessionId:t.replicaId,type:`video`,fit:`cover`,className:`absolute inset-0 w-full h-full object-cover ${t.videoState.isOff?`hidden`:``}`}),A(tg,{sessionId:t.replicaId})]})}),lx=P(({onLeave:e})=>{let{config:t}=K_(),n=t.value.customization.conversation.modality===`audio`;return A(`div`,{class:`@container/pip w-full h-full`,children:A(`div`,{class:`relative w-full h-full overflow-hidden bg-linear-to-br from-base-300 to-base-200 text-base-content`,children:[A(`div`,{class:`relative w-full h-full z-5`,children:A(cx,{isAudioOnly:n})}),A(`div`,{class:`absolute bottom-4 w-full inset-x-0 z-20 flex justify-center items-center gap-2 @max-mobile:gap-1`,children:[A(Pb,{}),!n&&A(Fb,{}),A(`button`,{type:`button`,class:`btn btn-control btn-error`,onClick:e,"aria-label":`Leave call`,children:A(Ny,{name:`leave`,"aria-label":`Leave Call`})})]})]})})}),ux=P(({personaSessionId:e,localSessionId:t,isScreenSharing:n,avatarOff:r,videoRef:i})=>A(rg,{ref:i,automirror:!0,sessionId:n?t??``:e,type:n?`screenVideo`:`video`,fit:n?`contain`:`cover`,className:`absolute inset-0 w-full h-full transition-all ${n?`object-contain`:`object-cover`} ${!n&&r?`hidden`:``}`})),dx=new Set([`mcp-ui.tavus.io`,`mcp-ui.tavus-preview.io`]),fx=[`.sandbox-tavus.io`],px=new Set([`tavusapi.com`]);function mx(e){let t;try{t=new URL(e)}catch{return!1}return _x(t)?!0:t.protocol===`https:`?dx.has(t.hostname)?!0:fx.some(e=>t.hostname.endsWith(e)):!1}function hx(e){return mx(e)}function gx(e){let t;try{t=new URL(e)}catch{return!1}return vx(t)?!0:t.protocol===`https:`&&px.has(t.hostname)}function _x(e){return vx(e)}function vx(e){return!yx()||e.protocol!==`http:`&&e.protocol!==`https:`?!1:[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e.hostname)}function yx(){try{let e=globalThis.location?.hostname;return typeof e==`string`&&[`localhost`,`127.0.0.1`,`::1`,`[::1]`].includes(e)}catch{return!1}}async function bx(e){try{await e.teardownResource({},{timeout:1e3})}catch{}try{await e.close?.()}catch{}}var xx=`tavus.canvas.interaction`,Sx=[`safe-area-right`,`safe-area-left`,`safe-area-bottom`,`full`],Cx=`safe-area-right`,wx={x:275/1280,y:111/720,width:730/1280,height:609/720},Tx={type:`snapshot_mirror`};function Ex(e){return Jx(e)?e.message_type===`conversation`&&e.event_type===`conversation.tool_call`&&typeof e.conversation_id==`string`&&Jx(e.properties):!1}function Dx(e){if(!Jx(e))return null;let t=cS(e,`component`),n=cS(e,`component_version`),r=cS(e,`sandbox_url`),i=dS(e,`mcp_server_url`,hx),a=dS(e,`api_base_url`,gx),o=dS(e,`interaction_url`,gx),s=Qx(e.layout),c=e.version;return c!==1||!t||!n||!r||!mx(r)||i===null||a===null||o===null||s===null?null:{version:c,component:t,component_version:n,resource_uri:cS(e,`resource_uri`),sandbox_url:r,mcp_server_url:i,mcp_tool_name:cS(e,`mcp_tool_name`),api_base_url:a,interaction_url:o,layout:s,host_context:Jx(e.host_context)?e.host_context:void 0}}function Ox(e){if(e===void 0)return{ok:!0,value:{}};if(Jx(e))return{ok:!0,value:e};if(typeof e!=`string`)return{ok:!1,error:Error(`Magic Canvas tool arguments must be an object or JSON string.`)};try{let t=JSON.parse(e);return Jx(t)?{ok:!0,value:t}:{ok:!1,error:Error(`Magic Canvas tool arguments must decode to an object.`)}}catch(e){return{ok:!1,error:Yx(e)}}}function kx(e){let t=e.properties.name;if(t!==`canvas_clear`&&t!==`update_component`)return null;let n=Ox(e.properties.arguments);if(!n.ok)throw n.error;if(t===`canvas_clear`){let t=n.value.tool_call_id,r=n.value.reason;if(t!==void 0&&typeof t!=`string`)throw Error(`Magic Canvas clear tool_call_id must be a string when provided.`);if(r!==void 0&&typeof r!=`string`)throw Error(`Magic Canvas clear reason must be a string when provided.`);return{kind:`clear`,conversation_id:e.conversation_id,tool_call_id:t,reason:r}}let r=n.value.tool_call_id,i=n.value.updates;if(typeof r!=`string`||r.length===0)throw Error(`Magic Canvas update_component requires a target tool_call_id.`);if(!Jx(i))throw Error(`Magic Canvas update_component requires an object updates payload.`);return{kind:`update`,conversation_id:e.conversation_id,tool_call_id:r,updates:i}}var Ax=[`safe-area-left`,`safe-area-right`];function jx(e){let t=Ax.includes(e.preferred_slot)?e.preferred_slot:Cx;return t===e.preferred_slot&&e.display_mode===`inline`?e:{...e,preferred_slot:t,display_mode:`inline`}}function Mx(e){return e.display_mode===`fullscreen`?`full`:e.preferred_slot}function Nx(e,t){return[t]}function Px(e,t){switch(t.kind){case`show`:{let n=e.find(e=>e.id===t.instance.id),r=n?{...t.instance,revision:n.revision+1}:t.instance;return Nx(e.filter(e=>e.id!==t.instance.id),r)}case`update`:{let n=e=>e.conversation_id===t.conversation_id&&e.tool_call_id===t.tool_call_id,r=Wx(t.updates),i,a=e.map(e=>{if(!n(e))return e;let t={...e,arguments:{...e.arguments,...r.componentArguments},layout:jx({preferred_slot:r.preferredSlot??e.layout.preferred_slot,display_mode:r.displayMode??e.layout.display_mode,avoid_safe_area:r.avoidSafeArea??e.layout.avoid_safe_area,safe_area:r.safeArea??e.layout.safe_area,backdrop:r.backdrop??e.layout.backdrop}),revision:e.revision+1};return i=t,t});if(i===void 0)return a;let o=e.find(n);return o&&Mx(o.layout)===Mx(i.layout)?a:Nx(a.filter(e=>!n(e)),i)}case`clear`:return t.tool_call_id?e.filter(e=>!(e.conversation_id===t.conversation_id&&e.tool_call_id===t.tool_call_id)):e.filter(e=>e.conversation_id!==t.conversation_id)}}function Fx(e){if(!Jx(e)||!Array.isArray(e.content))return null;for(let t of e.content){if(!Jx(t))continue;let e=(Jx(t._meta)?t._meta:null)?.[xx];if(Jx(e))return fS(e)}return null}function Ix(e,t){let n=t.type,r=t.value;if(!n)throw Error(`Magic Canvas interaction is missing type.`);if(r===void 0)throw Error(`Magic Canvas interaction is missing value.`);return{interaction_id:t.interaction_id??qx(e.tool_call_id,n),conversation_id:e.conversation_id,tool_call_id:e.tool_call_id,component:t.component??e.canvas_config.component,component_version:t.component_version??e.canvas_config.component_version,type:n,value:r,metadata:Jx(t.metadata)?t.metadata:{}}}function Lx(e){return e.type===`dismiss`||e.type===`clear`?!0:e.type!==`submit`&&e.type!==`skip`?!1:e.component===`canvas.question`||e.component===`canvas.input`||e.component===`canvas.calendar`}function Rx(e){return!Jx(e)||!Array.isArray(e.content)?``:e.content.map(e=>Jx(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
51
51
  `).trim()}function zx(e,t){let n=Jx(t.structuredContent)?t.structuredContent:void 0,r=Xx(t.content),i=typeof n?.state==`string`?n.state:`updated`,a=typeof n?.summary==`string`?n.summary:r,o=[`Magic Canvas state update for ${e.canvas_config.component} (${e.tool_call_id}).`,`State: ${i}.`];return a&&o.push(`Summary: ${a}`),n&&o.push(`Structured state: ${Zx(n)}`),r&&r!==a&&o.push(r),o.join(`
52
52
  `)}function Bx({conversationId:e,toolCallId:t,args:n,canvasConfig:r}){let i=Wx(n);return{id:t,conversation_id:e,tool_call_id:t,arguments:i.componentArguments,canvas_config:r,layout:jx({preferred_slot:i.preferredSlot??r.layout?.preferred_slot??Gx(r.component),display_mode:i.displayMode??`inline`,avoid_safe_area:i.avoidSafeArea??r.layout?.avoid_safe_area??!0,safe_area:i.safeArea??r.layout?.safe_area??wx,backdrop:i.backdrop??r.layout?.backdrop??Tx}),revision:0}}function Vx(e,t){let n=e.layout.display_mode;return{...e.layout,display_mode:n,viable_slot:n===`fullscreen`?`full`:Ux(e.layout.preferred_slot,t)}}function Hx(e,t){let n=e.filter(e=>!e.avoid_safe_area||e.display_mode===`fullscreen`?!1:e.viable_slot===`safe-area-left`||e.viable_slot===`safe-area-right`),r=n.some(e=>e.viable_slot===`safe-area-left`),i=n.some(e=>e.viable_slot===`safe-area-right`);if(r&&i)return{active:!1,video_shift_x:0,backdrop:Tx};let a=[...n].reverse()[0];if(!a||t.width<900)return{active:!1,video_shift_x:0,backdrop:Tx};let o=Math.min(448,Math.max(0,t.width-32)),s=a.safe_area,c=s.x*t.width,l=(s.x+s.width)*t.width,u=Math.min(360,t.width*.3),d=0;return d=a.viable_slot===`safe-area-left`?uS(16+o+24-c,0,u):-uS(l-(t.width-16-o-24),0,u),{active:!0,side:a.viable_slot===`safe-area-left`?`left`:`right`,video_shift_x:Math.round(d),safe_area:s,backdrop:a.backdrop}}function Ux(e,t){return e===`full`||e===`safe-area-bottom`&&t.visualViewportHeight!==void 0&&t.visualViewportHeight<t.height*.75?`full`:(e===`safe-area-left`||e===`safe-area-right`)&&t.width<768&&t.height>=t.width?`safe-area-bottom`:e}function Wx(e){let t={};for(let[n,r]of Object.entries(e))n===`layout`||n===`preferred_slot`||n===`preferredSlot`||n===`display_mode`||n===`displayMode`||n===`presentation`||n===`fullscreen`||n===`avoid_safe_area`||n===`avoidSafeArea`||n===`safe_area`||n===`safeArea`||n===`backdrop`||(t[n]=r);return{componentArguments:t,preferredSlot:$x(e.layout)??$x(e.preferred_slot)??$x(e.preferredSlot),displayMode:eS(e),avoidSafeArea:tS(e),safeArea:nS(e),backdrop:rS(e)}}function Gx(e){switch(e){case`canvas.alert`:return`safe-area-bottom`;case`canvas.chart`:case`canvas.image`:case`canvas.video`:return`full`;default:return Cx}}function Kx(e,t){let n=t?.displayScale??1;if(e.display_mode===`fullscreen`||e.viable_slot===`full`)return{maxWidth:void 0,maxHeight:void 0,displayScale:n};let r=t?.maxHeight??720;return e.viable_slot===`safe-area-bottom`?{maxWidth:720,maxHeight:r,displayScale:n}:{width:384,maxHeight:r,displayScale:n}}function qx(e,t){return`ci_${e.replace(/[^a-zA-Z0-9_-]/g,`_`)}_${t}_${globalThis.crypto?.randomUUID?.()??Math.random().toString(36).slice(2,10)}`}function Jx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Yx(e){return e instanceof Error?e:Error(String(e))}function Xx(e){return Array.isArray(e)?e.map(e=>Jx(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
53
53
  `).trim():``}function Zx(e){let t=JSON.stringify(e);return t?t.length<=2e3?t:`${t.slice(0,2e3)}...`:`{}`}function Qx(e){if(e===void 0)return;if(!Jx(e))return null;let t=$x(e),n=iS(e.safe_area??e.safeArea),r=aS(e.backdrop);return n===null||r===null?null:{...t?{preferred_slot:t}:{},...oS(e.avoid_safe_area??e.avoidSafeArea,`avoid_safe_area`),...n?{safe_area:n}:{},...r?{backdrop:r}:{}}}function $x(e){if(typeof e==`string`&&sS(e))return e;if(!Jx(e))return;let t=e.preferred_slot??e.preferredSlot??e.slot;return typeof t==`string`&&sS(t)?t:void 0}function eS(e){if(e.presentation===!0||e.fullscreen===!0)return`fullscreen`;if(e.presentation===!1||e.fullscreen===!1)return`inline`;let t=e.display_mode??e.displayMode;return t===`fullscreen`||t===`inline`?t:void 0}function tS(e){let t=Jx(e.layout)?e.layout:void 0,n=e.avoid_safe_area??e.avoidSafeArea??t?.avoid_safe_area??t?.avoidSafeArea;return typeof n==`boolean`?n:void 0}function nS(e){let t=Jx(e.layout)?e.layout:void 0;return iS(e.safe_area??e.safeArea??t?.safe_area??t?.safeArea)??void 0}function rS(e){let t=Jx(e.layout)?e.layout:void 0;return aS(e.backdrop??t?.backdrop)??void 0}function iS(e){if(e===void 0)return;if(!Jx(e))return null;let t=lS(e,`x`),n=lS(e,`y`),r=lS(e,`width`),i=lS(e,`height`);return t===void 0||n===void 0||r===void 0||i===void 0||t<0||n<0||r<=0||i<=0||t+r>1.001||n+i>1.001?null:{x:uS(t,0,1),y:uS(n,0,1),width:uS(r,0,1),height:uS(i,0,1)}}function aS(e){if(e===void 0)return;if(e===`snapshot_mirror`||e===`none`)return{type:e};if(!Jx(e))return null;let t=e.type;return t===`snapshot_mirror`||t===`none`?{type:t}:null}function oS(e,t){return typeof e==`boolean`?{[t]:e}:{}}function sS(e){return Sx.includes(e)}function cS(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function lS(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function uS(e,t,n){return Math.min(Math.max(e,t),n)}function dS(e,t,n){let r=cS(e,t);if(r)return n(r)?r:null}function fS(e){return e.interaction_id!==void 0&&typeof e.interaction_id!=`string`||e.component!==void 0&&typeof e.component!=`string`||e.component_version!==void 0&&typeof e.component_version!=`string`||e.type!==void 0&&typeof e.type!=`string`||e.metadata!==void 0&&!Jx(e.metadata)?null:e}var pS=`tavus-deployment magic-canvas/0.0.0`;function mS(e){if(!Ex(e)||e.canvas_config===void 0||e.canvas_config===null)return null;let t=Dx(e.canvas_config),n=e.properties.tool_call_id;if(!t)return null;if(!n)throw Error(`Received Magic Canvas tool call without tool_call_id.`);let r=Ox(e.properties.arguments);if(!r.ok)throw r.error;return Bx({conversationId:e.conversation_id,toolCallId:n,args:r.value,canvasConfig:t})}function hS(e){if(!Ex(e))return null;if(e.canvas_config!==void 0&&e.canvas_config!==null){let t=mS(e);return t?{kind:`show`,instance:t}:null}return kx(e)}function gS(e){return{body:{interaction_id:e.interaction_id,tool_call_id:e.tool_call_id,component:e.component,component_version:e.component_version,type:e.type,value:e.value,metadata:e.metadata}}}function _S(e,t){return{theme:e.theme,displayMode:t?.display_mode??`inline`,availableDisplayModes:[`inline`,`fullscreen`],...t?{containerDimensions:Kx(t),layout:{preferred_slot:t.preferred_slot,viable_slot:t.viable_slot,avoid_safe_area:t.avoid_safe_area,safe_area:t.safe_area,backdrop:t.backdrop}}:{},platform:`web`,userAgent:pS,styles:{variables:vS(e.cssVars)}}}function vS(e){return{"--border-radius-md":e[`--radius-box`]??e[`--tavus-boxes-radius`]??`0.5rem`,"--border-radius-sm":e[`--radius-field`]??e[`--tavus-field-radius`]??`0.375rem`,"--border-radius-xs":e[`--radius-selector`]??`0.25rem`,"--border-radius-lg":e[`--radius-box`]??e[`--tavus-boxes-radius`]??`0.75rem`,"--border-width-regular":e[`--border`]??e[`--tavus-border-width`]??`1px`,"--font-text-sm-size":`0.875rem`,"--font-text-md-size":`1rem`,...yS(e)}}function yS(e){let t=e[`--color-base-content`],n=e[`--color-base-100`],r=e[`--color-base-200`],i=e[`--color-base-300`],a=e[`--color-error`],o={},s=(e,t)=>{t&&(o[e]=t)},c=(e,t,n)=>e&&n?`color-mix(in oklch, ${e} ${t}%, ${n})`:void 0;return s(`--color-background-primary`,n),s(`--color-background-secondary`,r),s(`--color-border-secondary`,i),s(`--color-border-primary`,c(t,28,n)),s(`--color-text-primary`,t),s(`--color-text-secondary`,c(t,62,n)),s(`--color-text-danger`,a),s(`--color-border-danger`,a),o}var bS=24,xS=96;function SS(e=document){let t=Array.from(e.querySelectorAll(`[data-canvas-card]`)).map(e=>e.getBoundingClientRect());return t.length===0?null:{left:Math.min(...t.map(e=>e.left)),right:Math.max(...t.map(e=>e.right)),top:Math.min(...t.map(e=>e.top)),bottom:Math.max(...t.map(e=>e.bottom))}}function CS(e){let t=e?.getRootNode();return t instanceof ShadowRoot?t:document}function wS(e){if(!e)return null;let t=e.getBoundingClientRect();return t.width<=0||t.height<=0?null:{left:t.left,right:t.right,top:t.top,bottom:t.bottom}}function TS(e,t,n,r){if(!t)return!1;let i=r?r.left:0,a=r?r.top:0,o=r?r.right-r.left:globalThis.innerWidth,s=r?r.bottom-r.top:globalThis.innerHeight,c=e?.safe_area??wx,l=i+c.x*o+n,u=i+(c.x+c.width)*o+n,d=a+c.y*s,f=a+(c.y+c.height)*s;return l<t.right&&u>t.left&&d<t.bottom&&f>t.top}function ES(e,t,n){let[r,i]=T(()=>e?SS(CS(n?.current)):null);return dt(()=>{if(!e){i(null);return}let t=CS(n?.current),r=()=>i(SS(t)),a=new ResizeObserver(r),o=()=>{for(let e of t.querySelectorAll(`[data-canvas-card]`))a.observe(e)};r(),o(),a.observe(document.documentElement);let s=globalThis.requestAnimationFrame(()=>{r(),o()});return globalThis.addEventListener(`resize`,r),()=>{a.disconnect(),globalThis.removeEventListener(`resize`,r),globalThis.cancelAnimationFrame(s)}},[e,t,n]),e?r:null}function DS(e,t,n){let[r,i]=T(()=>t?wS(e.current):null);return dt(()=>{if(!t){i(null);return}let n=()=>i(wS(e.current)),r=new ResizeObserver(n);n(),e.current&&r.observe(e.current),r.observe(document.documentElement);let a=globalThis.requestAnimationFrame(n);return globalThis.addEventListener(`resize`,n),()=>{r.disconnect(),globalThis.removeEventListener(`resize`,n),globalThis.cancelAnimationFrame(a)}},[t,n,e]),t?r:null}function OS(e,t,n,r,i,a){let o=e?.side??(n===`safe-area-left`?`left`:n===`safe-area-right`?`right`:null);return{usePip:o!=null&&(t===`pip`||t===`auto`&&TS(e,r,i,a)),side:o}}function kS(e,t=document,n){let r=n?n.left:0,i=n?n.right:globalThis.innerWidth,a=n?n.top:0,o=n?n.bottom:globalThis.innerHeight,s=i-r,c=o-a,l=Array.from(t.querySelectorAll(`[data-canvas-card]`)).map(e=>e.getBoundingClientRect()),u,d,f,p;if(l.length>0){let t=Math.min(...l.map(e=>e.left)),n=Math.max(...l.map(e=>e.right));f=Math.min(...l.map(e=>e.top)),p=Math.max(...l.map(e=>e.bottom)),[u,d]=e===`right`?[r,t]:[n,i]}else{let t=Math.min(448,Math.max(0,s-32));[u,d]=e===`right`?[r,i-16-t]:[r+16+t,i],f=a,p=o}let m=d-u>=144&&p-f>=xS&&u>=r&&d<=i;if(l.length>0&&!m){let t=Math.min(448,Math.max(0,s-32));[u,d]=e===`right`?[r,i-16-t]:[r+16+t,i],f=a,p=o}let h=Math.max(0,d-u-bS*2),g=Math.max(xS,Math.min(h,c-bS*2));return{centerX:(u+d)/2-r,centerY:(f+p)/2-a,diameter:g}}var AS=`560ms linear(0, 0, .0001, .0002, .0003, .0005, .0007, .001, .0013, .0016, .002, .0024, .0029, .0033, .0039, .0044, .005, .0057, .0063, .007, .0079, .0086, .0094, .0103, .0112, .0121, .0132 1.84%, .0153, .0175, .0201, .0226, .0253, .0283, .0313, .0345, .038, .0416, .0454, .0493, .0535, .0576, .0621, .0667, .0714, .0764, .0816 5.04%, .0897, .098 5.62%, .1071, .1165, .1263 6.56%, .137, .1481 7.25%, .1601 7.62%, .1706 7.94%, .1819 8.28%, .194, .2068 9.02%, .2331 9.79%, .2898 11.44%, .3151 12.18%, .3412 12.95%, .3533, .365 13.66%, .3786, .3918, .4045, .4167, .4288, .4405, .452, .4631 16.72%, .4759, .4884, .5005, .5124, .5242, .5354, .5467, .5576, .5686, .5791, .5894, .5995, .6094, .6194, .6289, .6385, .6477, .6569, .6659 24.45%, .6702, .6747, .6789, .6833, .6877, .6919, .696, .7002, .7043, .7084, .7125, .7165, .7205, .7244, .7283, .7321, .7358, .7396, .7433, .7471, .7507, .7544, .7579, .7615, .7649, .7685, .7718, .7752, .7786, .782, .7853, .7885, .7918, .7951, .7982, .8013, .8043, .8075, .8104, .8135, .8165, .8195, .8224, .8253, .8281, .8309, .8336, .8365, .8391, .8419, .8446, .8472, .8499, .8524, .855, .8575, .8599, .8625 37.27%, .8651, .8678, .8703, .8729, .8754, .8779, .8803, .8827, .8851, .8875, .8898, .892, .8942, .8965, .8987, .9009, .903, .9051, .9071, .9092, .9112, .9132, .9151, .9171, .919, .9209, .9227, .9245, .9262, .928, .9297, .9314, .9331, .9347, .9364, .9379, .9395, .941, .9425, .944, .9454, .9469, .9483, .9497, .951, .9524, .9537, .955, .9562, .9574, .9586, .9599, .961, .9622, .9633, .9644, .9655, .9665, .9676, .9686, .9696, .9705, .9715, .9724, .9733, .9742, .975, .9758, .9766, .9774, .9782, .9789, .9796, .9804, .9811, .9817, .9824, .9831, .9837, .9843, .9849, .9855, .986, .9866, .9871, .9877, .9882, .9887, .9892, .9896 70.56%, .9905 71.67%, .9914 72.82%, .9922, .9929 75.2%, .9936 76.43%, .9942 77.71%, .9948 79.03%, .9954 80.39%, .9959 81.81%, .9963 83.28%, .9968 84.82%, .9972 86.41%, .9975 88.07%, .9979 89.81%, .9982 91.64%, .9984 93.56%, .9987 95.58%, .9989 97.72%, .9991)`;function jS(e,t){let n=Math.abs(t)/2;return e===`left`?`${n}px center`:`calc(100% - ${n}px) center`}function MS(e,t,n){let[r,i]=T(()=>e&&t?kS(t,CS(n?.current),wS(n?.current)):null);return dt(()=>{if(!e||!t){i(null);return}let r=CS(n?.current),a=()=>i(kS(t,r,wS(n?.current))),o=new ResizeObserver(a),s=()=>{for(let e of r.querySelectorAll(`[data-canvas-card]`))o.observe(e)};a(),s(),n?.current&&o.observe(n.current),o.observe(document.documentElement);let c=globalThis.requestAnimationFrame(()=>{a(),s()});return globalThis.addEventListener(`resize`,a),()=>{o.disconnect(),globalThis.removeEventListener(`resize`,a),globalThis.cancelAnimationFrame(c)}},[e,t,n]),e&&t?r:null}function NS(e,t){let[n,r]=T(null);return dt(()=>{if(!t){r(null);return}let n=e.current;if(!n)return;let i=()=>{let e=n.clientWidth,t=n.clientHeight;r(e&&t?{width:e,height:t}:null)},a=new ResizeObserver(i);return a.observe(n),i(),()=>a.disconnect()},[t,e]),t?n:null}var PS=1;function FS(e,t,n){return Math.min(Math.max(e,t),n)}function IS(e,t,n,r){let i=Math.min(e.diameter/t.height,1),a=r?.safe_area??wx,o=((a.x+a.width/2)*t.width+n)*i,s=(a.y+a.height/2)*t.height*i,c=e.diameter/2;return{scale:i,tx:FS(e.centerX-o,e.centerX+c-t.width*i,e.centerX-c),ty:FS(e.centerY-s,e.centerY+c-t.height*i,e.centerY-c)}}var LS=[`cx`,`cy`,`r`,`tx`,`ty`,`s`,`shift`];function RS(e,t,n,r,i){if(!n)return null;let{width:a,height:o}=n,s={x:a/2,y:o/2},c=null;if(e&&(c=IS(e,n,r,i),s={x:(e.centerX-c.tx)/c.scale,y:(e.centerY-c.ty)/c.scale}),t&&c&&e)return{cx:s.x,cy:s.y,r:e.diameter/2/c.scale,tx:c.tx,ty:c.ty,s:c.scale,shift:r};let l=Math.hypot(Math.max(s.x,a-s.x),Math.max(s.y,o-s.y));return{cx:s.x,cy:s.y,r:l*1.1,tx:0,ty:0,s:1,shift:r}}function zS(e,t,n){let r=D(null),i=D(e),a=D(n),o=D(0),s=D(0);i.current=e,a.current=n,E(()=>{let e=i.current;if(!e)return;if(!r.current||BS()){r.current={values:{...e},velocity:{cx:0,cy:0,r:0,tx:0,ty:0,s:0,shift:0}},a.current(e,!0);return}if(o.current)return;let n=Math.max(t,160)/4e3;s.current=performance.now();let c=e=>{o.current=0;let t=i.current,l=r.current;if(!t||!l)return;let u=Math.min((e-s.current)/1e3,1/30);s.current=e;let d=!0;for(let e of LS){let r=(t[e]-l.values[e])/(n*n)-2/n*l.velocity[e],i=l.velocity[e]+r*u,a=l.values[e]+i*u,o=e===`s`?.001:.25;Math.abs(t[e]-a)<o&&Math.abs(i)*n<o?(l.values[e]=t[e],l.velocity[e]=0):(l.values[e]=a,l.velocity[e]=i,d=!1)}a.current(l.values,d),d||(o.current=globalThis.requestAnimationFrame(c))};o.current=globalThis.requestAnimationFrame(c)},[e?LS.map(t=>Math.round(e[t]*100)).join():``,t]),E(()=>()=>{o.current&&globalThis.cancelAnimationFrame(o.current)},[])}function BS(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function VS({geom:e,visible:t}){return A(`div`,{"aria-hidden":`true`,"data-morph":`ring`,class:`pointer-events-none absolute z-10 rounded-full`,style:{top:`${e.centerY-e.diameter/2}px`,left:`${e.centerX-e.diameter/2}px`,width:`${e.diameter}px`,height:`${e.diameter}px`,boxShadow:`0 0 0 3px rgb(255 255 255 / 12%), 0 18px 50px rgb(0 0 0 / 55%)`,opacity:+!!t,transition:`opacity 240ms ease-out`}})}function HS(e,t){let n=t>=0?`left`:`right`,r=D({side:n,shift:t});E(()=>{e&&(r.current={side:n,shift:t})},[e,n,t]);let i=e?n:r.current.side;return{side:i,transformOrigin:jS(i,e?t:r.current.shift),translateX:e?0:-r.current.shift}}function US(e,t,n){return`${e.side??``}:${e.active}:${t}:${n??``}`}function WS({snapshotUrl:e,transformOrigin:t}){return A(`div`,{class:`absolute inset-0 bg-cover bg-center`,style:{backgroundImage:`url("${e}")`,transform:`scaleX(-1)`,transformOrigin:t}})}function GS({snapshotUrl:e,translateX:t,transition:n,transformOrigin:r}){return A(`div`,{"aria-hidden":`true`,"data-morph":`mirror`,class:`pointer-events-none absolute z-0 overflow-hidden`,style:{inset:`0 0`,transform:`translate3d(${t}px, 0, 0)`,transition:`transform ${n}`,willChange:`transform`},children:A(WS,{snapshotUrl:e,transformOrigin:r})})}function KS({ambient:e,usePip:t,transition:n}){return e===`none`?null:A(`div`,{"aria-hidden":`true`,"data-morph":`ambient`,class:`pointer-events-none absolute inset-0 z-0`,style:{opacity:+!!t,transition:`opacity ${n}`,background:e===`darker`?`rgb(0 0 0 / 40%)`:`rgb(0 0 0 / 15%)`}})}function qS({morphCapable:e,snapshotUrl:t,mirrorSide:n,videoShiftX:r,transition:i,sceneRef:a,videoWrapRef:o,fill:s,videoRef:c}){return A(`div`,{ref:a,"data-morph":`scene`,class:`absolute inset-0`,style:e?{transformOrigin:`top left`}:void 0,children:A(`div`,{ref:o,class:`absolute inset-0`,style:e?void 0:{transform:`translate3d(${r}px, 0, 0)`,transition:`transform ${i}`},children:[s(c),e&&t!==null&&A(`div`,{"aria-hidden":`true`,"data-morph":`window-mirror`,class:`absolute top-0 bottom-0 w-full`,style:n===`right`?{left:`calc(100% - ${PS}px)`}:{right:`calc(100% - ${PS}px)`},children:A(WS,{snapshotUrl:t,transformOrigin:`center`})})]})})}function JS({canvasLayoutEffect:e,smartSidecarActive:t,isScreenSharing:n,fill:r,captureSnapshot:i,transition:a=AS,transitionMs:o=560,personaMode:s=`shift`,renderedSlot:c=null,ambient:l=`default`,children:u}){let d=D(null),[f,p]=T(null),m=t&&e.backdrop.type===`snapshot_mirror`,h=t?e.video_shift_x:0,g=D(null),_=US(e,h,c),{usePip:v,side:y}=OS(e,s,c,ES(s!==`shift`,_,g),h,DS(g,s!==`shift`,_)),b=MS(s!==`shift`,y,g),x=HS(m,h);E(()=>{if(!m)return;let e=!1,t=0,n,r=0,a=()=>{if(e)return;let t=i(d.current);if(t){p(t);return}r+=1,r<8&&(n=globalThis.setTimeout(a,150))};return typeof globalThis.requestAnimationFrame==`function`?t=globalThis.requestAnimationFrame(a):n=globalThis.setTimeout(a,0),()=>{e=!0,t&&globalThis.cancelAnimationFrame?.(t),n&&globalThis.clearTimeout(n)}},[m,e.side,e.video_shift_x,i]),E(()=>{if(m||f===null)return;let e=globalThis.setTimeout(()=>{p(null)},o);return()=>globalThis.clearTimeout(e)},[m,f,o]);let S=v&&y!=null&&b!=null,C=s!==`shift`,w=NS(g,C),ee=f!==null&&!C,te=C&&y!=null,ne=D(null),re=D(null),[ie,ae]=T(!0),oe=D(!0),se=k((e,t)=>{let n=ne.current;n&&(n.style.clipPath=`circle(${e.r}px at ${e.cx}px ${e.cy}px)`,n.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.s})`);let r=re.current;r&&(r.style.transform=`translate3d(${e.shift}px, 0, 0)`),oe.current!==t&&(oe.current=t,ae(t))},[]);return zS(C?RS(b,S,w,h,e):null,o,se),A(`div`,{ref:g,class:`relative w-full h-full overflow-hidden ${n?`flex items-center justify-center`:``}`,children:[ee&&f!==null&&A(GS,{snapshotUrl:f,translateX:x.translateX,transition:a,transformOrigin:x.transformOrigin}),te&&A(KS,{ambient:l,usePip:v,transition:a}),A(`div`,{"data-morph":`fg`,class:`absolute inset-0 z-10`,children:A(qS,{morphCapable:C,snapshotUrl:f,mirrorSide:x.side,videoShiftX:h,transition:a,sceneRef:ne,videoWrapRef:re,fill:r,videoRef:d})}),C&&b&&A(VS,{geom:b,visible:S&&ie}),u]})}var YS=480,XS=P(({personaSessionId:e,isAudioOnly:t,avatarOff:n,canvasLayoutEffect:r,smartSidecarActive:i})=>{let a=t||n,o=i?r.video_shift_x:0;return A(`div`,{class:`absolute inset-0 overflow-hidden`,children:A(`div`,{class:`absolute top-0 bottom-0`,style:{left:o>0?`${YS}px`:`0px`,right:o<0?`${YS}px`:`0px`,transition:`left ${AS}, right ${AS}`},children:[A(rg,{automirror:!0,sessionId:e,type:`screenVideo`,fit:`contain`,className:`absolute inset-0 w-full h-full object-contain`}),A(`div`,{class:`absolute bottom-4 right-4 aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10`,children:a?A(`div`,{class:`flex w-full h-full items-center justify-center`,children:A(rx,{sessionId:e})}):A(rg,{automirror:!0,sessionId:e,type:`video`,fit:`cover`,className:`w-full h-full object-cover`})})]})})});function K(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}function ZS(e){return e&&Object.assign(tC,e),tC}var QS,$S,eC,tC,nC=a((()=>{$S=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},eC=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(QS=globalThis).__zod_globalConfig??(QS.__zod_globalConfig={}),tC=globalThis.__zod_globalConfig}));function rC(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function iC(e,t=`|`){return e.map(e=>bC(e)).join(t)}function aC(e,t){return typeof t==`bigint`?t.toString():t}function oC(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function sC(e){return e==null}function cC(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function lC(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function uC(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==LC)return r===void 0&&(r=LC,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function dC(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fC(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function pC(e){return JSON.stringify(e)}function mC(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function hC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gC(e){if(hC(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(hC(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function _C(e){return gC(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function vC(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yC(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function q(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function bC(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xC(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function SC(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return yC(e,fC(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return dC(this,`shape`,e),e},checks:[]}))}function CC(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return yC(e,fC(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return dC(this,`shape`,r),r},checks:[]}))}function wC(e,t){if(!gC(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yC(e,fC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return dC(this,`shape`,n),n}}))}function TC(e,t){if(!gC(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return yC(e,fC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return dC(this,`shape`,n),n}}))}function EC(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return yC(e,fC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return dC(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function DC(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return yC(t,fC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return dC(this,`shape`,i),i},checks:[]}))}function OC(e,t,n){return yC(t,fC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return dC(this,`shape`,i),i}}))}function kC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function AC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function jC(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function MC(e){return typeof e==`string`?e:e?.message}function NC(e,t,n){let r=e.message?e.message:MC(e.inst?._zod.def?.error?.(e))??MC(t?.error?.(e))??MC(n.customError?.(e))??MC(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function PC(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function FC(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function IC(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var LC,RC,zC,BC,VC,HC=a((()=>{nC(),LC=Symbol(`evaluating`),RC=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},zC=oC(()=>{if(tC.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),BC=new Set([`string`,`number`,`symbol`]),VC={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function UC(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function WC(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var GC,KC,qC,JC=a((()=>{nC(),HC(),GC=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,aC,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},KC=K(`$ZodError`,GC),qC=K(`$ZodError`,GC,{Parent:Error})})),YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,lw=a((()=>{nC(),JC(),HC(),YC=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new $S;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>NC(e,a,ZS())));throw RC(t,i?.callee),t}return o.value},XC=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>NC(e,a,ZS())));throw RC(t,i?.callee),t}return o.value},ZC=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $S;return a.issues.length?{success:!1,error:new(e??KC)(a.issues.map(e=>NC(e,i,ZS())))}:{success:!0,data:a.value}},QC=ZC(qC),$C=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>NC(e,i,ZS())))}:{success:!0,data:a.value}},ew=$C(qC),tw=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return YC(e)(t,n,i)},nw=e=>(t,n,r)=>YC(e)(t,n,r),rw=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return XC(e)(t,n,i)},iw=e=>async(t,n,r)=>XC(e)(t,n,r),aw=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ZC(e)(t,n,i)},ow=e=>(t,n,r)=>ZC(e)(t,n,r),sw=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return $C(e)(t,n,i)},cw=e=>async(t,n,r)=>$C(e)(t,n,r)}));function uw(){return new RegExp(ww,`u`)}function dw(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function fw(e){return RegExp(`^${dw(e)}$`)}function pw(e){let t=dw({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Nw}T(?:${r})$`)}var mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,Tw,Ew,Dw,Ow,kw,Aw,jw,Mw,Nw,Pw,Fw,Iw,Lw,Rw,zw,Bw,Vw,Hw,Uw=a((()=>{mw=/^[cC][0-9a-z]{6,}$/,hw=/^[0-9a-z]+$/,gw=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_w=/^[0-9a-vA-V]{20}$/,vw=/^[A-Za-z0-9]{27}$/,yw=/^[a-zA-Z0-9_-]{21}$/,bw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xw=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Sw=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Cw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ww=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Tw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ew=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Dw=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ow=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Aw=/^[A-Za-z0-9_-]*$/,jw=/^https?$/,Mw=/^\+[1-9]\d{6,14}$/,Nw=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Pw=RegExp(`^${Nw}$`),Fw=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Iw=/^-?\d+$/,Lw=/^-?\d+(?:\.\d+)?$/,Rw=/^(?:true|false)$/i,zw=/^null$/i,Bw=/^undefined$/i,Vw=/^[^A-Z]*$/,Hw=/^[^a-z]*$/})),Ww,Gw,Kw,qw,Jw,Yw,Xw,Zw,Qw,$w,eT,tT,nT,rT,iT,aT,oT,sT=a((()=>{nC(),Uw(),HC(),Ww=K(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Gw={number:`number`,bigint:`bigint`,object:`date`},Kw=K(`$ZodCheckLessThan`,(e,t)=>{Ww.init(e,t);let n=Gw[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qw=K(`$ZodCheckGreaterThan`,(e,t)=>{Ww.init(e,t);let n=Gw[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jw=K(`$ZodCheckMultipleOf`,(e,t)=>{Ww.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):lC(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Yw=K(`$ZodCheckNumberFormat`,(e,t)=>{Ww.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=VC[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Iw)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Xw=K(`$ZodCheckMaxLength`,(e,t)=>{var n;Ww.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!sC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=PC(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zw=K(`$ZodCheckMinLength`,(e,t)=>{var n;Ww.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!sC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=PC(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Qw=K(`$ZodCheckLengthEquals`,(e,t)=>{var n;Ww.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!sC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=PC(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$w=K(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Ww.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),eT=K(`$ZodCheckRegex`,(e,t)=>{$w.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),tT=K(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Vw,$w.init(e,t)}),nT=K(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Hw,$w.init(e,t)}),rT=K(`$ZodCheckIncludes`,(e,t)=>{Ww.init(e,t);let n=vC(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),iT=K(`$ZodCheckStartsWith`,(e,t)=>{Ww.init(e,t);let n=RegExp(`^${vC(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),aT=K(`$ZodCheckEndsWith`,(e,t)=>{Ww.init(e,t);let n=RegExp(`.*${vC(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),oT=K(`$ZodCheckOverwrite`,(e,t)=>{Ww.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),cT,lT=a((()=>{cT=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
package/dist/index.mjs CHANGED
@@ -19997,10 +19997,13 @@ function Qb({ active: e, onToggle: t, tooltip: n }) {
19997
19997
  return /* @__PURE__ */ j("button", {
19998
19998
  type: "button",
19999
19999
  onClick: t,
20000
- class: `btn btn-control ${e ? "btn-info" : "btn-ghost"}`,
20000
+ class: `btn btn-xs btn-control ${e ? "btn-info" : "btn-neutral"}`,
20001
20001
  "aria-label": n ?? (e ? "Exit fullscreen" : "Enter fullscreen"),
20002
20002
  title: n,
20003
- children: /* @__PURE__ */ j(Ny, { name: e ? "fullscreen-exit" : "fullscreen" })
20003
+ children: /* @__PURE__ */ j(Ny, {
20004
+ name: e ? "fullscreen-exit" : "fullscreen",
20005
+ size: "calc(var(--size-field, 0.25rem) * 3.5)"
20006
+ })
20004
20007
  });
20005
20008
  }
20006
20009
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tavus/widget",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Tavus conversational video AI <tavus-widget> launcher custom element for the web.",
5
5
  "keywords": [
6
6
  "ai",