@tavus/widget 0.0.1-beta.10 → 0.0.1-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.iife.js +1 -1
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -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?lm[e]:Object.values(lm)[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 Tm(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 Em(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]=Ef;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 Dm(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 Om(e,t){return[`joining-meeting`,`joined-meeting`].includes(e)||t}function km(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(Om(e,t)){var i=`${n} not supported after joining a meeting.`;throw r&&(i+=` ${r}`),console.error(i),Error(i)}}function Am(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 jm(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 Mm(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 Nm(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 H(){if(B())throw Error(`This daily-js method is not currently supported in React Native`)}function Pm(){if(!B())throw Error(`This daily-js method is only supported in React Native`)}function Fm(e){if(e===void 0)return!0;var t;if(typeof e==`string`)t=e;else try{t=JSON.stringify(e),Lo(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 Im(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=ko(s[o],2),l=c[0],u=c[1];if(!r(l)||!a(u))return!1}return!0}function Lm(e){if(I(e)!==`object`)return!1;for(var t=0,n=Object.entries(e);t<n.length;t++){var r=ko(n[t],2),i=r[0],a=r[1];switch(i){case`video`:if(I(a)!==`object`)return!1;for(var o=0,s=Object.entries(a);o<s.length;o++){var c=ko(s[o],2),l=c[0],u=c[1];switch(l){case`processor`:if(!Bm(u))return!1;break;case`settings`:if(!Vm(u))return!1;break;default:return!1}}break;case`audio`:if(I(a)!==`object`)return!1;for(var d=0,f=Object.entries(a);d<f.length;d++){var p=ko(f[d],2),m=p[0],h=p[1];switch(m){case`processor`:if(!zm(h))return!1;break;case`settings`:if(!Vm(h))return!1;break;default:return!1}}break;default:return!1}}return!0}function Rm(e,t,n){var r,i=[];e.video&&e.video.processor&&(Hf((r=t?.useLegacyVideoProcessor)!=null&&r)||(e.video.settings?delete e.video.processor:delete e.video,i.push(`video`))),e.audio&&e.audio.processor&&(Uf()||(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:Ef}):delete n.audioTrack),e.video&&e.video.settings&&(e.video.settings.customTrack?(n.videoTrack=e.video.settings.customTrack,e.video.settings={customTrack:Ef}):delete n.videoTrack)}function zm(e){if(B())return console.warn(`Video processing is not yet supported in React Native`),!1;var t=[`type`];return!!e&&I(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(Of).includes(e)?!0:(console.error(`inputSettings audio processor type invalid`),!1):!1}(e.type))}function Bm(e){if(B())return console.warn(`Video processing is not yet supported in React Native`),!1;var t=[`type`,`config`];return!e||I(e)!==`object`||!function(e){return typeof e==`string`?Object.values(Df).includes(e)?!0:(console.error(`inputSettings video processor type invalid`),!1):!1}(e.type)||e.config&&(I(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 Df.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 Df.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(es(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 Af.includes(r)}catch(e){return console.error(`failed to deduce blob content type`,e),!1}var i=n.split(`.`).at(-1).toLowerCase().trim();return Af.includes(i)}(e.source)||(console.error(`invalid image type; supported types: [${Af.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 Vm(e){return I(e)===`object`&&(!e.customTrack||e.customTrack instanceof MediaStreamTrack)}function Hm(){return`inputSettings must be of the form: { video?: { processor?: { type: [ ${Object.values(Df).join(` | `)} ], config?: {} } }, audio?: { processor: {type: [ ${Object.values(Of).join(` | `)} ] } } }`}function Um(e){return`receiveSettings must be of the form { [<remote participant id> | ${bd}${e.allowAllParticipantsKey?` | "*"`:``}]: { [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}`}function Wm(){return`customIntegrations should be an object of type ${JSON.stringify(ym)}.`}function Gm(e){if(e&&I(e)!==`object`||Array.isArray(e))return console.error(`customTrayButtons should be an Object of the type ${JSON.stringify(vm)}.`),!1;if(e)for(var t=0,n=Object.entries(e);t<n.length;t++)for(var r=ko(n[t],1)[0],i=0,a=Object.entries(e[r]);i<a.length;i++){var o=ko(a[i],2),s=o[0],c=o[1],l=vm.id[s];if(!l)return console.error(`customTrayButton does not support key ${s}`),!1;switch(s){case`iconPath`:case`iconPathDarkMode`:if(!es(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(I(c)!==l)return console.error(`customTrayButton ${s} should be a ${l}.`),!1}}return!0}function Km(e){if(!e||e&&I(e)!==`object`||Array.isArray(e))return console.error(Wm()),!1;for(var t=function(e){return`${e} should be ${ym.id[e]}`},n=function(e,t){return console.error(`customIntegration ${e}: ${t}`)},r=0,i=Object.entries(e);r<i.length;r++){var a=ko(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=ko(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(!es(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(!es(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(!ym.id[l])return console.error(`customIntegration does not support key ${l}`),!1}}}return!0}function qm(e,t){if(t===void 0)return!1;switch(I(t)){case`string`:return I(e)===t;case`object`:if(I(e)!==`object`)return!1;for(var n in e)if(!qm(e[n],t[n]))return!1;return!0;default:return!1}}function Jm(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 Ym(e){if(I(e)!==`object`)throw Error(`RemoteMediaPlayerSettings: must be "object" type`);if(e.state&&!Object.values(kf).includes(e.state))throw Error(`Invalid value for RemoteMediaPlayerSettings.state, valid values are: `+JSON.stringify(kf));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 Xm(e,t,n){return!(typeof e!=`number`||e<t||e>n)}function Zm(e,t){return e&&!t&&delete e.data,e}function Qm(e){"@babel/helpers - typeof";return Qm=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},Qm(e)}var U=function(){return U=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},U.apply(this,arguments)};function $m(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 eh(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 th(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 nh(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 rh(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 ih(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 ah=Ie(null),oh=function(){var e=pt(ah);return mt(e),e},sh=Ie({on:function(){},off:function(){}}),ch=-1,lh=function(){return ch--},uh=1,dh=function(){return uh++},W=function(e,t,n){n===void 0&&(n=!1);var r=pt(sh),i=r.off,a=r.on,o=rh(T(!1),2),s=o[0],c=o[1],l=D(0),u=O(function(){return n?lh():dh()},[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 fh(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(!fh(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 fh(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 fh(e,o[t])})}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;try{for(var s=nh(e.entries()),c=s.next();!c.done;c=s.next()){var l=rh(c.value,2),u=l[0],d=l[1];if(!t.has(u)||!fh(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(Qm(e)!==`object`||e===null||Qm(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)||!fh(e[u],t[u]))return!1}return!0}function ph(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&&Qm(r)===`object`,o=i!==null&&Qm(i)===`object`;if(a||o){if(!fh(r,i))return!1}else if(r!==i)return!1}return!0}function G(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=G(`participant-property-paths-${e}`),t}),xh=ca(function(e){var t=N(null);return t.debugLabel=G(`participant-property-${e}`),t}),Sh=mh({equals:ph,get:function(e){return function(t){var n=rh(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=ho(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=Qm(wh)==`object`&&wh&&wh.Object===Object&&wh,l=(typeof self>`u`?`undefined`:Qm(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=Qm(e);return!!e&&(t==`object`||t==`function`)}function v(e){return!!e&&Qm(e)==`object`}function y(e){return Qm(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(sh),a=i.off,o=i.on,s=O(function(){var t;return Array.isArray(e)?e.reduce(function(e,t){return e[t]=r?lh():dh(),e},{}):(t={},t[e]=r?lh():dh(),t)},[e,r]),c=D([]);W(`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),Qm(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,ih([a],rh(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=G(`active-id`);var Ih=N(``);Ih.debugLabel=G(`local-id`);var Lh=N(null);Lh.debugLabel=G(`local-join-date`);var Rh=N([]);Rh.debugLabel=G(`participant-ids`);var zh=ca(function(e){var t=N(null);return t.debugLabel=G(`participant-${e}`),t}),Bh=N([]);Bh.debugLabel=G(`waiting-participants`);var Vh=ca(function(e){var t=N({awaitingAccess:{level:`full`},id:e,name:``});return t.debugLabel=G(`waiting-participant-${e}`),t}),Hh=function(e){var t=e.children,n=oh(),r=rh(T(!1),2),i=r[0],a=r[1],o=F(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=rh(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]);W(`started-camera`,s,!0),W(`access-state-updated`,s,!0),W(`joining-meeting`,F(k(function(e,t){t(Lh,new Date),s()},[s])),!0),W(`joined-meeting`,k(function(e){o(e.participants)},[o]),!0);var c=F(k(function(e,t){t(Ih,``),t(Fh,null),e(Rh).forEach(function(e){return zh.remove(e)}),t(Rh,[])},[]));return W(`call-instance-destroyed`,c,!0),W(`left-meeting`,c,!0),Ah([`active-speaker-change`,`participant-joined`,`participant-updated`,`participant-left`],F(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?U(U({},e),{last_active:new Date}):null});break;case`participant-joined`:t(Rh,function(e){return e.includes(n.participant.session_id)?e:ih(ih([],rh(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=rh(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 fh(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`],F(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:ih(ih([],rh(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),P.createElement(P.Fragment,null,t)},Uh=function(){var e=ho(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=ho(Fh),c=a&&s===o,l=!r?.(s),u=rh(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:fh,get:function(e){return function(t){var n=rh(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=ho(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=rh(T([]),2),f=d[0],p=d[1],m=F(k(function(e){if(l){var t=u(e);fh(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:ph,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=oh(),o=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.startScreenShare.apply(a,ih([],rh(e),!1))},[a]),s=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.stopScreenShare.apply(a,ih([],rh(e),!1))},[a]);W(`local-screen-share-started`,k(function(){return r?.()},[r])),W(`local-screen-share-stopped`,k(function(){return i?.()},[i])),W(`nonfatal-error`,k(function(e){e.type===`screen-share-error`&&n?.(e)},[n]));var c=ho(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?U(U({},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&&Qm(r)===`object`&&(r.current=t)}},e)}var tg=ba(Ca(function(e,t){var n=e.onPlayFailed,r=e.sessionId,i=e.type,a=i===void 0?`audio`:i,o=$m(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]),W(`participant-left`,k(function(e){var t=s.current;e.participant.session_id!==r||!t||(t.srcObject=null)},[r])),W(`left-meeting`,k(function(){var e=s.current;e&&(e.pause(),e.srcObject=null)},[])),P.createElement(`audio`,U({autoPlay:!0,ref:l},o,{"data-session-id":r,"data-audio-type":a,"data-subscribed":u}))}));tg.displayName=`DailyAudioTrack`;var ng=ba(Ca(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=oh(),u=rh(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 _=F(k(function(e,t,n){return eh(void 0,void 0,void 0,function(){var t,i;return th(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,ih([],rh(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,ih([],rh(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,ih([],rh(r),!1)}var u=r.indexOf(c[0]?.session_id);return r[u]=n,ih([],rh(r),!1)}),[2]})})},[h,r,l])),v=k(function(e){f(function(t){if(!t.includes(e))return t;var n=ih([],rh(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 P.createElement(`div`,{ref:g},d.map(function(e,t){return P.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 P.createElement(tg,{key:e.screenId,onPlayFailed:o,sessionId:e.session_id,type:`screenAudio`})}),y.map(function(e){return P.createElement(tg,{key:`${e}-rmp`,onPlayFailed:o,sessionId:e,type:`rmpAudio`})}))}));ng.displayName=`DailyAudio`;var rg=Ca(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=$m(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]),P.createElement(`video`,U({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:U(U({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=G(`camera-state`);var og=N(`idle`);og.debugLabel=G(`microphone-state`);var sg=N([]);sg.debugLabel=G(`camera-devices`);var cg=N([]);cg.debugLabel=G(`microphone-devices`);var lg=N([]);lg.debugLabel=G(`speaker-devices`);var ug=N(null);ug.debugLabel=G(`last-camera-error`);var dg=function(e){var t=e.children,n=oh(),r=F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var e,r,i,a,o,s,c,l,u,d;return th(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=F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var i,a,o,s,c,l,u,d,f,p,m,h;return th(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?U(U({},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?U(U({},e),{state:`granted`}):e})})),s.video?.blocked?.byDeviceInUse?(t(ag,`in-use`),t(sg,function(e){return e.map(function(e){return e.selected?U(U({},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?U(U({},e),{state:`granted`}):e})})),r(),[2]}})})},[n,r]));return W(`participant-updated`,k(function(e){e.participant.local&&i()},[i])),W(`available-devices-updated`,r),W(`selected-devices-updated`,r),W(`camera-error`,F(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}},[]))),W(`started-camera`,F(k(function(e,t){t(ag,`granted`),t(og,`granted`),i()},[i]))),P.createElement(ig.Provider,{value:{refreshDevices:r}},t)};function fg(e){return e.instanceId??`__default__`}var pg=N({});pg.debugLabel=G(`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=G(`live-streaming`);var hg=function(e){var t=e.children;return W(`live-streaming-started`,F(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return U(U({},e),(t={},t[r]={instanceId:r,isLiveStreaming:!0,layout:n?.layout},t))})},[]))),W(`live-streaming-stopped`,F(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return e[r]?U(U({},e),(t={},t[r]=U(U({},e[r]),{isLiveStreaming:!1,layout:void 0}),t)):e})},[]))),W(`live-streaming-error`,F(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return U(U({},e),(t={},t[r]=U(U({},e[r]??{instanceId:r,isLiveStreaming:!1}),{errorMsg:n.errorMsg}),t))})},[]))),W(`left-meeting`,F(k(function(e,t){t(pg,{})},[]))),P.createElement(P.Fragment,null,t)},gg=N(`new`);gg.debugLabel=G(`meeting-state`);var _g=N(null);_g.debugLabel=G(`meeting-error`);var vg=N(null);vg.debugLabel=G(`non-fatal-error`);var yg=N({data:void 0,topology:`none`});yg.debugLabel=G(`meeting-session-data`);var bg=function(e){var t=e.children,n=oh(),r=F(k(function(e,t){if(n){var r=n.meetingState();return t(gg,r),r}},[n]));return W(`loading`,r),W(`loaded`,r),W(`joining-meeting`,r),W(`joined-meeting`,r),W(`left-meeting`,r),W(`error`,F(k(function(e,t,n){t(_g,n),r()},[r]))),W(`nonfatal-error`,F(k(function(e,t,n){t(vg,n)},[]))),W(`joined-meeting`,F(k(function(e,t){n&&t(yg,n.meetingSessionState())},[n]))),W(`meeting-session-state-updated`,F(k(function(e,t,n){t(yg,n.meetingSessionState)},[]))),W(`left-meeting`,F(k(function(e,t){t(yg,{data:void 0,topology:`none`})},[]))),W(`call-instance-destroyed`,F(k(function(e,t){t(gg,`new`),t(_g,null),t(vg,null),t(yg,{data:void 0,topology:`none`})},[]))),P.createElement(P.Fragment,null,t)},xg=N(`none`);xg.debugLabel=G(`topology`);var Sg=N(`unknown`),Cg=N([]),wg=N(`interrupted`),Tg=N(100);Tg.debugLabel=G(`network-quality`);var Eg=N(`good`);Eg.debugLabel=G(`network-threshold`);var Dg=function(e){var t=e.children,n=oh(),r=ho(xg),i=F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var e;return th(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 W(`joined-meeting`,i),W(`network-connection`,F(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}},[]))),W(`network-quality-change`,F(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 ph(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})},[]))),W(`left-meeting`,F(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]),P.createElement(P.Fragment,null,t)};function Og(e){return e.instanceId?e.instanceId:e.type===`local`||e.local?`__local__`:`__default__`}var kg=N({});kg.debugLabel=G(`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=G(`recording-state`);var jg=function(e){var t=e.children,n=Uh(),r=Xh({filter:`record`}),i=F(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&&fh(i,a)||!n&&!i||(n?t(kg,function(e){return U(U({},e),{__local__:a})}):i&&t(kg,function(e){return U(U({},e),{__local__:U(U({},i),{isLocalParticipantRecorded:!1,isRecording:!1})})}))},[]));return E(function(){i(r.length>0,r.includes(n||`local`))},[n,i,r]),W(`recording-started`,F(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 U(U({},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]))),W(`recording-stopped`,F(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t;return e[r]?U(U({},e),(t={},t[r]=U(U({},e[r]),{isLocalParticipantRecorded:!1,isRecording:!1}),t)):e})},[]))),W(`recording-error`,F(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t,i=e[r];return U(U({},e),(t={},t[r]=U(U({},i??{instanceId:r}),{error:!0,errorMsg:n.errorMsg,isLocalParticipantRecorded:!1,isRecording:!1}),t))})},[]))),W(`left-meeting`,F(k(function(e,t){t(kg,{})},[]))),P.createElement(P.Fragment,null,t)},Mg=function(){var e=ho(gg);return mt(e),e},Ng=N(null);Ng.debugLabel=G(`room-state`);var Pg=function(e){var t=e.children,n=oh(),r=Mg();return W(`access-state-updated`,F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var e;return th(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]))),W(`left-meeting`,F(k(function(e,t){return function(){t(Ng,null)}},[]))),P.createElement(P.Fragment,null,t)},Fg=N({isTranscribing:!1,model:`general`,language:`en`,transcriptions:[]});Fg.debugLabel=G(`transcription-state`);var Ig=function(e){var t=e.children;return W(`transcription-started`,F(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})},[]))),W(`transcription-stopped`,F(k(function(e,t,n){t(Fg,function(e){return U(U({},e),{updatedBy:n.updatedBy,isTranscribing:!1})})},[]))),W(`transcription-error`,F(k(function(e,t){t(Fg,function(e){return U(U({},e),{error:!0,isTranscribing:!1})})},[]))),W(`left-meeting`,F(k(function(e,t){t(Fg,function(e){return U(U({},e),{isTranscribing:!1})})},[]))),W(`app-message`,F(k(function(e,t,n){n?.fromId===`transcription`&&t(Fg,function(e){return U(U({},e),{isTranscribing:!0,transcriptions:ih(ih([],rh(e.transcriptions),!1),[n.data],!1)})})},[]))),P.createElement(P.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=rh(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 eh(this,void 0,void 0,function(){return th(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=wm.getCallInstance();if(!l&&i&&!i.isDestroyed()){i.once(`call-instance-destroyed`,n),u(i);return}if(l){fh(d.current,a)||t(l);return}if(!i||i.isDestroyed())try{var o=U(U({},a),{aboutClient:U(U({},a.aboutClient??{}),{"daily-react":Lg})});switch(e){case`callFrame`:i=r?.current?wm.createFrame(r.current,o):wm.createFrame(o);break;case`callObject`:i=wm.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=$m(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 rh(e,1)[0]<0}),s=a.filter(function(e){return rh(e,1)[0]>0}),c=ih(ih([],rh(o),!1),rh(s),!1);try{for(var l=nh(c),u=l.next();!u.done;u=l.next()){var d=rh(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 P.createElement(co,{store:n},P.createElement(ah.Provider,{value:l},P.createElement(sh.Provider,{value:{on:u,off:d}},P.createElement(Pg,null,P.createElement(bg,null,P.createElement(Dg,null,P.createElement(Hh,null,P.createElement(jg,null,P.createElement(hg,null,P.createElement(Ig,null,P.createElement(dg,null,t)))))))))))},Wg=function(e){var t=(e===void 0?{}:e).onAppMessage,n=oh(),r=k(function(e,t){t===void 0&&(t=`*`),n&&n.sendAppMessage(e,t)},[n]);return W(`app-message`,k(function(e){t?.(e,r)},[t,r])),r},Gg=function(e,t,n,r){var i=oh(),a=e===Uh();W(`local-audio-level`,k(function(e){a&&t(e.audioLevel)},[t,a])),W(`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&&Qm(t)==`object`&&Qm(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=G(`cpu-load`);var Zg=function(){var e=oh(),t=ho(ag),n=ho(og),r=ho(sg),i=ho(cg),a=ho(lg),o=ho(ug),s=pt(ig).refreshDevices,c=k(function(t){return eh(void 0,void 0,void 0,function(){return th(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 eh(void 0,void 0,void 0,function(){return th(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 eh(void 0,void 0,void 0,function(){return th(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=G(`input-settings`);var $g=N({hidden:0,present:0});$g.debugLabel=G(`participant-counts`);var e_=ca(function(e){var t=N({},function(t,n,r){n(e_(e),r)});return t.debugLabel=G(`participant-receive-settings-${e}`),t}),t_=function(e){return $h(e,`screenVideo`)},n_=N(null);n_.debugLabel=G(`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=oh(),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},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);if(t)return{url:t,kind:`image`};let n=Iy(e.replica_thumbnail_video_url);return n?{url:n,kind:`video`}:null}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))`};function By({variant:e,replica:t}){let[n,r]=T(!1);return E(()=>{r(!1)},[e.url]),e.type===`replica`&&t?t.kind===`image`?A(`img`,{class:`absolute inset-0 w-full h-full object-cover`,src:t.url,loading:`lazy`,alt:``}):A(`video`,{class:`absolute inset-0 w-full h-full object-cover`,src:t.url,muted:!0,autoplay:!0,loop:!0,playsinline:!0}):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 Vy({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(By,{variant:n.background,replica:r})})}var Hy=`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 Uy({children:e,class:t,role:n,"aria-live":r}){return A(`div`,{class:t?`${Hy} ${t}`:Hy,role:n,"aria-live":r,children:e})}function Wy({title:e,description:t,media:n,children:r,overlay:i}){return A(Uy,{children:[n===void 0?A(Vy,{}):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 Gy={daily_limit:{title:`Agent is at today's limit`,description:`This Agent can take more conversations tomorrow.`},total_limit:{title:`Agent is unavailable`,description:`This Agent isn't available right now. Please check back later.`},busy:{title:`Agent is in another conversation`,description:`Please try again in a moment.`},error:{title:`Couldn't load this Agent`,description:`This Agent couldn't be loaded. Please try again later.`}};function Ky(e,t){let n=t?.[e];return{title:n?.title||Gy[e].title,description:n?.description||Gy[e].description}}var qy={daily_limit:`clock`,total_limit:`moon`,busy:`users`,error:`error`};function Jy({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:qy[e],size:`2rem`})})}function Yy({cause:e,canRetry:t,onRetry:n,onCancel:r}){let{config:i}=K_(),a=i.value.customization?.unavailable_screen,o=Ky(e,a),s=a?.cta??[],c=e===`busy`||s.length>0||!!r;return A(Wy,{media:A(Jy,{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 Xy(){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 Zy=`Thanks for joining`,Qy=`You can start a new conversation whenever you're ready.`,$y=`Start a new conversation`;function eb(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`||t.protocol===`mailto:`}catch{return!1}}function tb({text:e,onRestart:t}){let{config:n}=K_(),r=n.value.customization.after_call,i=r.cta.filter(e=>eb(e.url));return A(Wy,{title:r.title||e?.title||Zy,description:r.description||e?.description||Qy,children:[A(`button`,{type:`button`,class:`btn btn-neutral rounded-box`,onClick:t,children:e?.restart||$y}),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 nb(){let e=oh(),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 rb(){let e=oh(),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 ib(){let e=oh(),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 ab(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 ob(e,t,n,r){return e===`granted`&&r?`granted`:ab(e)||(t===`denied`?`blocked`:t===`prompt`?`prompt`:t===`granted`?n?`checking`:`prompt`:e===`granted`?`granted`:n?`checking`:`prompt`)}function sb(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 cb(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 lb(){let e=oh(),t=Mg(),n=Uh(),{micState:r,camState:i,currentMic:a,currentCam:o}=Zg(),s=cb(`microphone`),c=cb(`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(()=>sb(ob(r,s,u,!!a),s),[r,s,u,a]),camera:O(()=>sb(ob(i,c,f,!!o),c),[i,c,f,o]),requestMic:m,requestCamera:h}}var ub={microphone:`microphone`,camera:`camera`};function db({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 fb(){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(db,{})}),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 pb=ba(({device:e,onClose:t})=>{let n=ub[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(fb,{})}),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(db,{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`})]})]})]})})}),mb=Ie({open:()=>{},close:()=>{}});function hb(){return pt(mb)}function gb({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(mb.Provider,{value:a,children:[e,t&&A(pb,{device:t,onClose:i})]})}var _b=ba(()=>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:`!`})),vb=`select-control-pill relative inline-flex items-center bg-neutral text-neutral-content`,yb=`absolute inset-0 w-full h-full opacity-0 cursor-pointer appearance-none disabled:cursor-not-allowed`,bb=`absolute right-1.5 top-1/2 -translate-y-1/2 pointer-events-none flex items-center`,xb=`absolute left-0 top-0 h-full aspect-square flex items-center justify-center pointer-events-none`,Sb=`absolute left-0 top-0 z-10 btn btn-control btn-neutral`;function Cb(){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 wb({value:e,devices:t,disabled:n,onChange:r,label:i}){return A(ue,{children:[A(`select`,{class:yb,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:bb,children:A(Cb,{})})]})}function Tb(e){return A(`div`,{class:vb,children:A(wb,{...e})})}function Eb({iconName:e,...t}){return A(`div`,{class:vb,children:[A(`span`,{class:xb,"aria-hidden":`true`,children:A(Ny,{name:e})}),A(wb,{...t})]})}var Db=ba(()=>{let{onToggleMicrophone:e,isMicReady:t,isMicMuted:n}=rb(),{microphones:r,currentMic:i,setMicrophone:a}=Zg();return!i||(r?.length??0)<=1?A(Ab,{}):A(`div`,{class:`relative inline-flex items-center`,children:[A(Tb,{value:i?.device?.deviceId,devices:r||[],disabled:!t,onChange:e=>a(e),label:`Select microphone`}),A(`button`,{type:`button`,onClick:e,disabled:!t,class:Sb,"aria-label":n?`Unmute microphone`:`Mute microphone`,"aria-pressed":n,children:A(Ny,{name:n||!t?`mic-off`:`mic`})})]})});function Ob(){let{onToggleCamera:e,isCamMuted:t}=nb(),{camera:n,requestCamera:r}=lb(),{open:i}=hb(),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 kb=ba(()=>{let{isCamReady:e}=nb(),{currentCam:t,cameras:n,setCamera:r}=Zg(),i=Ob();return!t||(n?.length??0)<=1?A(jb,{}):A(`div`,{class:`relative inline-flex items-center`,children:[A(Tb,{value:t?.device?.deviceId,devices:n||[],disabled:!e,onChange:e=>r(e),label:`Select camera`}),A(`button`,{type:`button`,onClick:i.onClick,class:Sb,"aria-label":i.label,"aria-pressed":!i.isOn,children:A(Ny,{name:i.isOn?`cam`:`cam-off`})})]})}),Ab=ba(()=>{let{onToggleMicrophone:e,isMicMuted:t}=rb(),{mic:n,requestMic:r}=lb(),{open:i}=hb();return A(`span`,{class:`relative inline-flex`,children:[A(`button`,{type:`button`,onClick:()=>{if(n.isGranted)return e();if(n.isBlocked)return i(`microphone`);r()},class:`btn btn-control btn-neutral`,"aria-label":n.isGranted?t?`Unmute microphone`:`Mute microphone`:`Allow microphone access`,"aria-pressed":n.isGranted?t:void 0,children:A(Ny,{name:t||!n.isGranted?`mic-off`:`mic`})}),n.needsAttention&&A(_b,{})]})}),jb=ba(()=>{let{isOn:e,onClick:t,label:n,needsAttention:r}=Ob();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(_b,{})]})});ba(({compact:e=!1}={})=>{let{isMicReady:t}=rb(),{microphones:n,currentMic:r,setMicrophone:i}=Zg();return(n?.length??0)<=1?null:A(Eb,{iconName:`mic`,value:r?.device?.deviceId,devices:n,disabled:!t,onChange:e=>i(e),label:`Select microphone`,compact:e})}),ba(({compact:e=!1}={})=>{let{isCamReady:t}=nb(),{currentCam:n,cameras:r,setCamera:i}=Zg();return(r?.length??0)<=1?null:A(Eb,{iconName:`cam`,value:n?.device?.deviceId,devices:r,disabled:!t,onChange:e=>i(e),label:`Select camera`,compact:e})});var Mb=ba((e={})=>{let{onToggleScreenshare:t,isScreenSharing:n}=ib();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 Nb(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 Pb=Ie(null);function Fb({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(Pb.Provider,{value:a,children:e})}function Ib(){let e=pt(Pb);if(!e)throw Error(`ClosedCaptions components must be used within <ClosedCaptionsProvider>`);return e}var Lb=ba(()=>{let{isEnabled:e,toggle:t}=Ib();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`})})}),Rb=ba(()=>{let{isEnabled:e}=Ib(),{captionText:t,captionRole:n}=Nb(),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`,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`?`Replica`:`You`}),r]})})})}),zb=Ie(null);function Bb({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(zb.Provider,{value:o,children:e})}function Vb(){let e=pt(zb);if(!e)throw Error(`Chat components must be used within <ChatProvider>`);return e}var Hb=ba((e={})=>{let{isOpen:t,toggle:n}=Vb();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`})})}),Ub=ba(({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`:`Replica`}),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})]})}),Wb=ba(()=>{let{isOpen:e,close:t}=Vb(),{chatMessages:n,sendChat:r,session:i}=Nb(),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(Ub,{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 Gb({label:e}){return A(Uy,{role:`status`,"aria-live":`polite`,class:`z-2`,children:[A(Vy,{}),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 Kb=ba(()=>A(Gb,{label:`Connecting`})),qb=ba(()=>A(Gb,{label:`Leaving`}));function Jb({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 Yb=ba(({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%`}})]})})});function Xb({sessionId:e,className:t=``}){let n=D(null),r=D(void 0);return Gg(e??``,k(t=>{e&&(r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let e=Math.max(0,Math.min(1,t**.6));n.current?.style.setProperty(`--audio-level`,String(e))}))},[e])),A(`div`,{ref:n,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:[A(`div`,{class:`absolute inset-0 rounded-full will-change-transform`,style:{background:`conic-gradient(from 0deg, var(--color-primary), var(--color-info, var(--color-primary)), var(--color-secondary, var(--color-primary)), var(--color-primary))`,filter:`blur(28px)`,animation:`tavusOrbSpin 18s linear infinite`,scale:`calc(1 + var(--audio-level, 0) * 0.35)`,opacity:`calc(0.45 + var(--audio-level, 0) * 0.45)`,transition:`scale 120ms ease-out, opacity 120ms ease-out`}}),A(`div`,{class:`absolute inset-[12%] rounded-full will-change-transform`,style:{background:`conic-gradient(from 180deg, color-mix(in oklab, var(--color-primary) 80%, white), transparent 30%, color-mix(in oklab, var(--color-primary) 60%, white) 70%, transparent)`,filter:`blur(14px)`,opacity:.55,mixBlendMode:`screen`,animation:`tavusOrbSpin 26s linear infinite reverse`}}),A(`div`,{class:`absolute inset-[28%] rounded-full`,style:{background:`radial-gradient(circle at 30% 30%, color-mix(in oklab, white 70%, var(--color-primary)), var(--color-primary) 60%, color-mix(in oklab, var(--color-primary) 50%, black))`,boxShadow:`0 0 60px color-mix(in oklab, var(--color-primary) 60%, transparent), inset 0 0 30px color-mix(in oklab, white 40%, transparent)`,scale:`calc(1 + var(--audio-level, 0) * 0.18)`,transition:`scale 100ms ease-out`}}),A(`div`,{class:`absolute inset-[28%] rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--color-primary) 80%, transparent), transparent 70%)`,animation:`tavusOrbPulse 2.6s ease-in-out infinite`}})]})}function Zb({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 Qb=e=>!!e.user_id?.includes(`tavus-replica`);function $b(){return Xh({filter:Qb})}function ex(e){let t=$b()[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 tx=ba(({isAudioOnly:e})=>{let t=ex(e);return t.phase===`left`?A(qb,{}):t.phase===`connecting`?A(Kb,{}):e?A(Zb,{class:`flex items-center justify-center`,children:[A(Xb,{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})]})}),nx=ba(({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(tx,{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(Ab,{}),!n&&A(jb,{}),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`})})]})]})})}),rx=ba(({personaSessionId:e,localSessionId:t,isPresenting:n,isScreenSharing:r,isAudioOnly:i,avatarOff:a,videoRef:o})=>{let s=n||r;return A(ue,{children:[A(rg,{ref:o,automirror:!0,sessionId:r?t??``:e,type:s?`screenVideo`:`video`,fit:s?`contain`:`cover`,className:`absolute inset-0 w-full h-full transition-all ${s?`object-contain`:`object-cover`} ${!s&&a?`hidden`:``}`}),n&&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:i||a?A(`div`,{class:`flex w-full h-full items-center justify-center`,children:A(Xb,{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 ix(e){return e&&Object.assign(cx,e),cx}var ax,ox,sx,cx,lx=a((()=>{ox=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},sx=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(ax=globalThis).__zod_globalConfig??(ax.__zod_globalConfig={}),cx=globalThis.__zod_globalConfig}));function ux(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 dx(e,t=`|`){return e.map(e=>Dx(e)).join(t)}function fx(e,t){return typeof t==`bigint`?t.toString():t}function px(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function mx(e){return e==null}function hx(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function gx(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 _x(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Wx)return r===void 0&&(r=Wx,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function vx(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function yx(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function bx(e){return JSON.stringify(e)}function xx(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Sx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Cx(e){if(Sx(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Sx(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function wx(e){return Cx(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Tx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ex(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 Dx(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ox(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function kx(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 Ex(e,yx(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 vx(this,`shape`,e),e},checks:[]}))}function Ax(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 Ex(e,yx(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 vx(this,`shape`,r),r},checks:[]}))}function jx(e,t){if(!Cx(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 Ex(e,yx(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return vx(this,`shape`,n),n}}))}function Mx(e,t){if(!Cx(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ex(e,yx(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return vx(this,`shape`,n),n}}))}function Nx(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ex(e,yx(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return vx(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Px(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 Ex(t,yx(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 vx(this,`shape`,i),i},checks:[]}))}function Fx(e,t,n){return Ex(t,yx(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 vx(this,`shape`,i),i}}))}function Ix(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 Lx(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 Rx(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function zx(e){return typeof e==`string`?e:e?.message}function Bx(e,t,n){let r=e.message?e.message:zx(e.inst?._zod.def?.error?.(e))??zx(t?.error?.(e))??zx(n.customError?.(e))??zx(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 Vx(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Hx(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 Ux(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Wx,Gx,Kx,qx,Jx,Yx=a((()=>{lx(),Wx=Symbol(`evaluating`),Gx=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},Kx=px(()=>{if(cx.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),qx=new Set([`string`,`number`,`symbol`]),Jx={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function Xx(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 Zx(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 Qx,$x,eS,tS=a((()=>{lx(),Yx(),Qx=(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,fx,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$x=K(`$ZodError`,Qx),eS=K(`$ZodError`,Qx,{Parent:Error})})),nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS=a((()=>{lx(),tS(),Yx(),nS=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 ox;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Bx(e,a,ix())));throw Gx(t,i?.callee),t}return o.value},rS=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=>Bx(e,a,ix())));throw Gx(t,i?.callee),t}return o.value},iS=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 ox;return a.issues.length?{success:!1,error:new(e??$x)(a.issues.map(e=>Bx(e,i,ix())))}:{success:!0,data:a.value}},aS=iS(eS),oS=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=>Bx(e,i,ix())))}:{success:!0,data:a.value}},sS=oS(eS),cS=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return nS(e)(t,n,i)},lS=e=>(t,n,r)=>nS(e)(t,n,r),uS=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return rS(e)(t,n,i)},dS=e=>async(t,n,r)=>rS(e)(t,n,r),fS=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return iS(e)(t,n,i)},pS=e=>(t,n,r)=>iS(e)(t,n,r),mS=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return oS(e)(t,n,i)},hS=e=>async(t,n,r)=>oS(e)(t,n,r)}));function _S(){return new RegExp(jS,`u`)}function vS(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 yS(e){return RegExp(`^${vS(e)}$`)}function bS(e){let t=vS({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(`^${BS}T(?:${r})$`)}var xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS=a((()=>{xS=/^[cC][0-9a-z]{6,}$/,SS=/^[0-9a-z]+$/,CS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wS=/^[0-9a-vA-V]{20}$/,TS=/^[A-Za-z0-9]{27}$/,ES=/^[a-zA-Z0-9_-]{21}$/,DS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OS=/^([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})$/,kS=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)$/,AS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,jS=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,MS=/^(?:(?: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])$/,NS=/^(([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}|:))$/,PS=/^((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])$/,FS=/^(([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])$/,IS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,LS=/^[A-Za-z0-9_-]*$/,RS=/^https?$/,zS=/^\+[1-9]\d{6,14}$/,BS=`(?:(?:\\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])))`,VS=RegExp(`^${BS}$`),HS=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},US=/^-?\d+$/,WS=/^-?\d+(?:\.\d+)?$/,GS=/^(?:true|false)$/i,KS=/^null$/i,qS=/^undefined$/i,JS=/^[^A-Z]*$/,YS=/^[^a-z]*$/})),ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC=a((()=>{lx(),XS(),Yx(),ZS=K(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),QS={number:`number`,bigint:`bigint`,object:`date`},$S=K(`$ZodCheckLessThan`,(e,t)=>{ZS.init(e,t);let n=QS[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})}}),eC=K(`$ZodCheckGreaterThan`,(e,t)=>{ZS.init(e,t);let n=QS[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})}}),tC=K(`$ZodCheckMultipleOf`,(e,t)=>{ZS.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):gx(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})}}),nC=K(`$ZodCheckNumberFormat`,(e,t)=>{ZS.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Jx[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=US)}),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})}}),rC=K(`$ZodCheckMaxLength`,(e,t)=>{var n;ZS.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mx(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=Vx(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),iC=K(`$ZodCheckMinLength`,(e,t)=>{var n;ZS.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mx(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=Vx(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),aC=K(`$ZodCheckLengthEquals`,(e,t)=>{var n;ZS.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mx(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=Vx(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})}}),oC=K(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ZS.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=()=>{})}),sC=K(`$ZodCheckRegex`,(e,t)=>{oC.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})}}),cC=K(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=JS,oC.init(e,t)}),lC=K(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=YS,oC.init(e,t)}),uC=K(`$ZodCheckIncludes`,(e,t)=>{ZS.init(e,t);let n=Tx(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})}}),dC=K(`$ZodCheckStartsWith`,(e,t)=>{ZS.init(e,t);let n=RegExp(`^${Tx(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})}}),fC=K(`$ZodCheckEndsWith`,(e,t)=>{ZS.init(e,t);let n=RegExp(`.*${Tx(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})}}),pC=K(`$ZodCheckOverwrite`,(e,t)=>{ZS.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),hC,gC=a((()=>{hC=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(`
|
|
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 fh(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(!fh(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 fh(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 fh(e,o[t])})}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;try{for(var s=nh(e.entries()),c=s.next();!c.done;c=s.next()){var l=rh(c.value,2),u=l[0],d=l[1];if(!t.has(u)||!fh(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(Qm(e)!==`object`||e===null||Qm(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)||!fh(e[u],t[u]))return!1}return!0}function ph(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&&Qm(r)===`object`,o=i!==null&&Qm(i)===`object`;if(a||o){if(!fh(r,i))return!1}else if(r!==i)return!1}return!0}function G(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=G(`participant-property-paths-${e}`),t}),xh=ca(function(e){var t=N(null);return t.debugLabel=G(`participant-property-${e}`),t}),Sh=mh({equals:ph,get:function(e){return function(t){var n=rh(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=ho(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=Qm(wh)==`object`&&wh&&wh.Object===Object&&wh,l=(typeof self>`u`?`undefined`:Qm(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=Qm(e);return!!e&&(t==`object`||t==`function`)}function v(e){return!!e&&Qm(e)==`object`}function y(e){return Qm(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(sh),a=i.off,o=i.on,s=O(function(){var t;return Array.isArray(e)?e.reduce(function(e,t){return e[t]=r?lh():dh(),e},{}):(t={},t[e]=r?lh():dh(),t)},[e,r]),c=D([]);W(`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),Qm(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,ih([a],rh(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=G(`active-id`);var Ih=N(``);Ih.debugLabel=G(`local-id`);var Lh=N(null);Lh.debugLabel=G(`local-join-date`);var Rh=N([]);Rh.debugLabel=G(`participant-ids`);var zh=ca(function(e){var t=N(null);return t.debugLabel=G(`participant-${e}`),t}),Bh=N([]);Bh.debugLabel=G(`waiting-participants`);var Vh=ca(function(e){var t=N({awaitingAccess:{level:`full`},id:e,name:``});return t.debugLabel=G(`waiting-participant-${e}`),t}),Hh=function(e){var t=e.children,n=oh(),r=rh(T(!1),2),i=r[0],a=r[1],o=F(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=rh(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]);W(`started-camera`,s,!0),W(`access-state-updated`,s,!0),W(`joining-meeting`,F(k(function(e,t){t(Lh,new Date),s()},[s])),!0),W(`joined-meeting`,k(function(e){o(e.participants)},[o]),!0);var c=F(k(function(e,t){t(Ih,``),t(Fh,null),e(Rh).forEach(function(e){return zh.remove(e)}),t(Rh,[])},[]));return W(`call-instance-destroyed`,c,!0),W(`left-meeting`,c,!0),Ah([`active-speaker-change`,`participant-joined`,`participant-updated`,`participant-left`],F(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?U(U({},e),{last_active:new Date}):null});break;case`participant-joined`:t(Rh,function(e){return e.includes(n.participant.session_id)?e:ih(ih([],rh(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=rh(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 fh(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`],F(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:ih(ih([],rh(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),P.createElement(P.Fragment,null,t)},Uh=function(){var e=ho(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=ho(Fh),c=a&&s===o,l=!r?.(s),u=rh(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:fh,get:function(e){return function(t){var n=rh(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=ho(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=rh(T([]),2),f=d[0],p=d[1],m=F(k(function(e){if(l){var t=u(e);fh(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:ph,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=oh(),o=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.startScreenShare.apply(a,ih([],rh(e),!1))},[a]),s=k(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a?.stopScreenShare.apply(a,ih([],rh(e),!1))},[a]);W(`local-screen-share-started`,k(function(){return r?.()},[r])),W(`local-screen-share-stopped`,k(function(){return i?.()},[i])),W(`nonfatal-error`,k(function(e){e.type===`screen-share-error`&&n?.(e)},[n]));var c=ho(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?U(U({},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&&Qm(r)===`object`&&(r.current=t)}},e)}var tg=ba(Ca(function(e,t){var n=e.onPlayFailed,r=e.sessionId,i=e.type,a=i===void 0?`audio`:i,o=$m(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]),W(`participant-left`,k(function(e){var t=s.current;e.participant.session_id!==r||!t||(t.srcObject=null)},[r])),W(`left-meeting`,k(function(){var e=s.current;e&&(e.pause(),e.srcObject=null)},[])),P.createElement(`audio`,U({autoPlay:!0,ref:l},o,{"data-session-id":r,"data-audio-type":a,"data-subscribed":u}))}));tg.displayName=`DailyAudioTrack`;var ng=ba(Ca(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=oh(),u=rh(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 _=F(k(function(e,t,n){return eh(void 0,void 0,void 0,function(){var t,i;return th(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,ih([],rh(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,ih([],rh(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,ih([],rh(r),!1)}var u=r.indexOf(c[0]?.session_id);return r[u]=n,ih([],rh(r),!1)}),[2]})})},[h,r,l])),v=k(function(e){f(function(t){if(!t.includes(e))return t;var n=ih([],rh(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 P.createElement(`div`,{ref:g},d.map(function(e,t){return P.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 P.createElement(tg,{key:e.screenId,onPlayFailed:o,sessionId:e.session_id,type:`screenAudio`})}),y.map(function(e){return P.createElement(tg,{key:`${e}-rmp`,onPlayFailed:o,sessionId:e,type:`rmpAudio`})}))}));ng.displayName=`DailyAudio`;var rg=Ca(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=$m(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]),P.createElement(`video`,U({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:U(U({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=G(`camera-state`);var og=N(`idle`);og.debugLabel=G(`microphone-state`);var sg=N([]);sg.debugLabel=G(`camera-devices`);var cg=N([]);cg.debugLabel=G(`microphone-devices`);var lg=N([]);lg.debugLabel=G(`speaker-devices`);var ug=N(null);ug.debugLabel=G(`last-camera-error`);var dg=function(e){var t=e.children,n=oh(),r=F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var e,r,i,a,o,s,c,l,u,d;return th(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=F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var i,a,o,s,c,l,u,d,f,p,m,h;return th(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?U(U({},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?U(U({},e),{state:`granted`}):e})})),s.video?.blocked?.byDeviceInUse?(t(ag,`in-use`),t(sg,function(e){return e.map(function(e){return e.selected?U(U({},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?U(U({},e),{state:`granted`}):e})})),r(),[2]}})})},[n,r]));return W(`participant-updated`,k(function(e){e.participant.local&&i()},[i])),W(`available-devices-updated`,r),W(`selected-devices-updated`,r),W(`camera-error`,F(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}},[]))),W(`started-camera`,F(k(function(e,t){t(ag,`granted`),t(og,`granted`),i()},[i]))),P.createElement(ig.Provider,{value:{refreshDevices:r}},t)};function fg(e){return e.instanceId??`__default__`}var pg=N({});pg.debugLabel=G(`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=G(`live-streaming`);var hg=function(e){var t=e.children;return W(`live-streaming-started`,F(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return U(U({},e),(t={},t[r]={instanceId:r,isLiveStreaming:!0,layout:n?.layout},t))})},[]))),W(`live-streaming-stopped`,F(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return e[r]?U(U({},e),(t={},t[r]=U(U({},e[r]),{isLiveStreaming:!1,layout:void 0}),t)):e})},[]))),W(`live-streaming-error`,F(k(function(e,t,n){var r=fg(n);t(pg,function(e){var t;return U(U({},e),(t={},t[r]=U(U({},e[r]??{instanceId:r,isLiveStreaming:!1}),{errorMsg:n.errorMsg}),t))})},[]))),W(`left-meeting`,F(k(function(e,t){t(pg,{})},[]))),P.createElement(P.Fragment,null,t)},gg=N(`new`);gg.debugLabel=G(`meeting-state`);var _g=N(null);_g.debugLabel=G(`meeting-error`);var vg=N(null);vg.debugLabel=G(`non-fatal-error`);var yg=N({data:void 0,topology:`none`});yg.debugLabel=G(`meeting-session-data`);var bg=function(e){var t=e.children,n=oh(),r=F(k(function(e,t){if(n){var r=n.meetingState();return t(gg,r),r}},[n]));return W(`loading`,r),W(`loaded`,r),W(`joining-meeting`,r),W(`joined-meeting`,r),W(`left-meeting`,r),W(`error`,F(k(function(e,t,n){t(_g,n),r()},[r]))),W(`nonfatal-error`,F(k(function(e,t,n){t(vg,n)},[]))),W(`joined-meeting`,F(k(function(e,t){n&&t(yg,n.meetingSessionState())},[n]))),W(`meeting-session-state-updated`,F(k(function(e,t,n){t(yg,n.meetingSessionState)},[]))),W(`left-meeting`,F(k(function(e,t){t(yg,{data:void 0,topology:`none`})},[]))),W(`call-instance-destroyed`,F(k(function(e,t){t(gg,`new`),t(_g,null),t(vg,null),t(yg,{data:void 0,topology:`none`})},[]))),P.createElement(P.Fragment,null,t)},xg=N(`none`);xg.debugLabel=G(`topology`);var Sg=N(`unknown`),Cg=N([]),wg=N(`interrupted`),Tg=N(100);Tg.debugLabel=G(`network-quality`);var Eg=N(`good`);Eg.debugLabel=G(`network-threshold`);var Dg=function(e){var t=e.children,n=oh(),r=ho(xg),i=F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var e;return th(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 W(`joined-meeting`,i),W(`network-connection`,F(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}},[]))),W(`network-quality-change`,F(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 ph(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})},[]))),W(`left-meeting`,F(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]),P.createElement(P.Fragment,null,t)};function Og(e){return e.instanceId?e.instanceId:e.type===`local`||e.local?`__local__`:`__default__`}var kg=N({});kg.debugLabel=G(`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=G(`recording-state`);var jg=function(e){var t=e.children,n=Uh(),r=Xh({filter:`record`}),i=F(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&&fh(i,a)||!n&&!i||(n?t(kg,function(e){return U(U({},e),{__local__:a})}):i&&t(kg,function(e){return U(U({},e),{__local__:U(U({},i),{isLocalParticipantRecorded:!1,isRecording:!1})})}))},[]));return E(function(){i(r.length>0,r.includes(n||`local`))},[n,i,r]),W(`recording-started`,F(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 U(U({},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]))),W(`recording-stopped`,F(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t;return e[r]?U(U({},e),(t={},t[r]=U(U({},e[r]),{isLocalParticipantRecorded:!1,isRecording:!1}),t)):e})},[]))),W(`recording-error`,F(k(function(e,t,n){var r=Og(n);t(kg,function(e){var t,i=e[r];return U(U({},e),(t={},t[r]=U(U({},i??{instanceId:r}),{error:!0,errorMsg:n.errorMsg,isLocalParticipantRecorded:!1,isRecording:!1}),t))})},[]))),W(`left-meeting`,F(k(function(e,t){t(kg,{})},[]))),P.createElement(P.Fragment,null,t)},Mg=function(){var e=ho(gg);return mt(e),e},Ng=N(null);Ng.debugLabel=G(`room-state`);var Pg=function(e){var t=e.children,n=oh(),r=Mg();return W(`access-state-updated`,F(k(function(e,t){return eh(void 0,void 0,void 0,function(){var e;return th(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]))),W(`left-meeting`,F(k(function(e,t){return function(){t(Ng,null)}},[]))),P.createElement(P.Fragment,null,t)},Fg=N({isTranscribing:!1,model:`general`,language:`en`,transcriptions:[]});Fg.debugLabel=G(`transcription-state`);var Ig=function(e){var t=e.children;return W(`transcription-started`,F(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})},[]))),W(`transcription-stopped`,F(k(function(e,t,n){t(Fg,function(e){return U(U({},e),{updatedBy:n.updatedBy,isTranscribing:!1})})},[]))),W(`transcription-error`,F(k(function(e,t){t(Fg,function(e){return U(U({},e),{error:!0,isTranscribing:!1})})},[]))),W(`left-meeting`,F(k(function(e,t){t(Fg,function(e){return U(U({},e),{isTranscribing:!1})})},[]))),W(`app-message`,F(k(function(e,t,n){n?.fromId===`transcription`&&t(Fg,function(e){return U(U({},e),{isTranscribing:!0,transcriptions:ih(ih([],rh(e.transcriptions),!1),[n.data],!1)})})},[]))),P.createElement(P.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=rh(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 eh(this,void 0,void 0,function(){return th(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=wm.getCallInstance();if(!l&&i&&!i.isDestroyed()){i.once(`call-instance-destroyed`,n),u(i);return}if(l){fh(d.current,a)||t(l);return}if(!i||i.isDestroyed())try{var o=U(U({},a),{aboutClient:U(U({},a.aboutClient??{}),{"daily-react":Lg})});switch(e){case`callFrame`:i=r?.current?wm.createFrame(r.current,o):wm.createFrame(o);break;case`callObject`:i=wm.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=$m(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 rh(e,1)[0]<0}),s=a.filter(function(e){return rh(e,1)[0]>0}),c=ih(ih([],rh(o),!1),rh(s),!1);try{for(var l=nh(c),u=l.next();!u.done;u=l.next()){var d=rh(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 P.createElement(co,{store:n},P.createElement(ah.Provider,{value:l},P.createElement(sh.Provider,{value:{on:u,off:d}},P.createElement(Pg,null,P.createElement(bg,null,P.createElement(Dg,null,P.createElement(Hh,null,P.createElement(jg,null,P.createElement(hg,null,P.createElement(Ig,null,P.createElement(dg,null,t)))))))))))},Wg=function(e){var t=(e===void 0?{}:e).onAppMessage,n=oh(),r=k(function(e,t){t===void 0&&(t=`*`),n&&n.sendAppMessage(e,t)},[n]);return W(`app-message`,k(function(e){t?.(e,r)},[t,r])),r},Gg=function(e,t,n,r){var i=oh(),a=e===Uh();W(`local-audio-level`,k(function(e){a&&t(e.audioLevel)},[t,a])),W(`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&&Qm(t)==`object`&&Qm(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=G(`cpu-load`);var Zg=function(){var e=oh(),t=ho(ag),n=ho(og),r=ho(sg),i=ho(cg),a=ho(lg),o=ho(ug),s=pt(ig).refreshDevices,c=k(function(t){return eh(void 0,void 0,void 0,function(){return th(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 eh(void 0,void 0,void 0,function(){return th(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 eh(void 0,void 0,void 0,function(){return th(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=G(`input-settings`);var $g=N({hidden:0,present:0});$g.debugLabel=G(`participant-counts`);var e_=ca(function(e){var t=N({},function(t,n,r){n(e_(e),r)});return t.debugLabel=G(`participant-receive-settings-${e}`),t}),t_=function(e){return $h(e,`screenVideo`)},n_=N(null);n_.debugLabel=G(`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=oh(),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},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);if(t)return{url:t,kind:`image`};let n=Iy(e.replica_thumbnail_video_url);return n?{url:n,kind:`video`}:null}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))`};function By({variant:e,replica:t}){let[n,r]=T(!1);return E(()=>{r(!1)},[e.url]),e.type===`replica`&&t?t.kind===`image`?A(`img`,{class:`absolute inset-0 w-full h-full object-cover`,src:t.url,loading:`lazy`,alt:``}):A(`video`,{class:`absolute inset-0 w-full h-full object-cover`,src:t.url,muted:!0,autoplay:!0,loop:!0,playsinline:!0}):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 Vy({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(By,{variant:n.background,replica:r})})}var Hy=`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 Uy({children:e,class:t,role:n,"aria-live":r}){return A(`div`,{class:t?`${Hy} ${t}`:Hy,role:n,"aria-live":r,children:e})}function Wy({title:e,description:t,media:n,children:r,overlay:i}){return A(Uy,{children:[n===void 0?A(Vy,{}):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 Gy={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 Ky(e,t){let n=t?.[e];return{title:n?.title||Gy[e].title,description:n?.description||Gy[e].description}}var qy={daily_limit:`clock`,total_limit:`moon`,busy:`users`,error:`error`};function Jy({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:qy[e],size:`2rem`})})}function Yy({cause:e,canRetry:t,onRetry:n,onCancel:r}){let{config:i}=K_(),a=i.value.customization?.unavailable_screen,o=Ky(e,a),s=a?.cta??[],c=e===`busy`||s.length>0||!!r;return A(Wy,{media:A(Jy,{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 Xy(){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 Zy=`Thanks for joining`,Qy=`You can start a new conversation whenever you're ready.`,$y=`Start a new conversation`;function eb(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`||t.protocol===`mailto:`}catch{return!1}}function tb({text:e,onRestart:t}){let{config:n}=K_(),r=n.value.customization.after_call,i=r.cta.filter(e=>eb(e.url));return A(Wy,{title:r.title||e?.title||Zy,description:r.description||e?.description||Qy,children:[A(`button`,{type:`button`,class:`btn btn-neutral rounded-box`,onClick:t,children:e?.restart||$y}),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 nb(){let e=oh(),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 rb(){let e=oh(),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 ib(){let e=oh(),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 ab(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 ob(e,t,n,r){return e===`granted`&&r?`granted`:ab(e)||(t===`denied`?`blocked`:t===`prompt`?`prompt`:t===`granted`?n?`checking`:`prompt`:e===`granted`?`granted`:n?`checking`:`prompt`)}function sb(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 cb(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 lb(){let e=oh(),t=Mg(),n=Uh(),{micState:r,camState:i,currentMic:a,currentCam:o}=Zg(),s=cb(`microphone`),c=cb(`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(()=>sb(ob(r,s,u,!!a),s),[r,s,u,a]),camera:O(()=>sb(ob(i,c,f,!!o),c),[i,c,f,o]),requestMic:m,requestCamera:h}}var ub={microphone:`microphone`,camera:`camera`};function db({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 fb(){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(db,{})}),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 pb=ba(({device:e,onClose:t})=>{let n=ub[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(fb,{})}),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(db,{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`})]})]})]})})}),mb=Ie({open:()=>{},close:()=>{}});function hb(){return pt(mb)}function gb({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(mb.Provider,{value:a,children:[e,t&&A(pb,{device:t,onClose:i})]})}var _b=ba(()=>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:`!`})),vb=`select-control-pill relative inline-flex items-center bg-neutral text-neutral-content`,yb=`absolute inset-0 w-full h-full opacity-0 cursor-pointer appearance-none disabled:cursor-not-allowed`,bb=`absolute right-1.5 top-1/2 -translate-y-1/2 pointer-events-none flex items-center`,xb=`absolute left-0 top-0 h-full aspect-square flex items-center justify-center pointer-events-none`,Sb=`absolute left-0 top-0 z-10 btn btn-control btn-neutral`;function Cb(){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 wb({value:e,devices:t,disabled:n,onChange:r,label:i}){return A(ue,{children:[A(`select`,{class:yb,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:bb,children:A(Cb,{})})]})}function Tb(e){return A(`div`,{class:vb,children:A(wb,{...e})})}function Eb({iconName:e,...t}){return A(`div`,{class:vb,children:[A(`span`,{class:xb,"aria-hidden":`true`,children:A(Ny,{name:e})}),A(wb,{...t})]})}var Db=ba(()=>{let{onToggleMicrophone:e,isMicReady:t,isMicMuted:n}=rb(),{microphones:r,currentMic:i,setMicrophone:a}=Zg();return!i||(r?.length??0)<=1?A(Ab,{}):A(`div`,{class:`relative inline-flex items-center`,children:[A(Tb,{value:i?.device?.deviceId,devices:r||[],disabled:!t,onChange:e=>a(e),label:`Select microphone`}),A(`button`,{type:`button`,onClick:e,disabled:!t,class:Sb,"aria-label":n?`Unmute microphone`:`Mute microphone`,"aria-pressed":n,children:A(Ny,{name:n||!t?`mic-off`:`mic`})})]})});function Ob(){let{onToggleCamera:e,isCamMuted:t}=nb(),{camera:n,requestCamera:r}=lb(),{open:i}=hb(),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 kb=ba(()=>{let{isCamReady:e}=nb(),{currentCam:t,cameras:n,setCamera:r}=Zg(),i=Ob();return!t||(n?.length??0)<=1?A(jb,{}):A(`div`,{class:`relative inline-flex items-center`,children:[A(Tb,{value:t?.device?.deviceId,devices:n||[],disabled:!e,onChange:e=>r(e),label:`Select camera`}),A(`button`,{type:`button`,onClick:i.onClick,class:Sb,"aria-label":i.label,"aria-pressed":!i.isOn,children:A(Ny,{name:i.isOn?`cam`:`cam-off`})})]})}),Ab=ba(()=>{let{onToggleMicrophone:e,isMicMuted:t}=rb(),{mic:n,requestMic:r}=lb(),{open:i}=hb();return A(`span`,{class:`relative inline-flex`,children:[A(`button`,{type:`button`,onClick:()=>{if(n.isGranted)return e();if(n.isBlocked)return i(`microphone`);r()},class:`btn btn-control btn-neutral`,"aria-label":n.isGranted?t?`Unmute microphone`:`Mute microphone`:`Allow microphone access`,"aria-pressed":n.isGranted?t:void 0,children:A(Ny,{name:t||!n.isGranted?`mic-off`:`mic`})}),n.needsAttention&&A(_b,{})]})}),jb=ba(()=>{let{isOn:e,onClick:t,label:n,needsAttention:r}=Ob();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(_b,{})]})});ba(({compact:e=!1}={})=>{let{isMicReady:t}=rb(),{microphones:n,currentMic:r,setMicrophone:i}=Zg();return(n?.length??0)<=1?null:A(Eb,{iconName:`mic`,value:r?.device?.deviceId,devices:n,disabled:!t,onChange:e=>i(e),label:`Select microphone`,compact:e})}),ba(({compact:e=!1}={})=>{let{isCamReady:t}=nb(),{currentCam:n,cameras:r,setCamera:i}=Zg();return(r?.length??0)<=1?null:A(Eb,{iconName:`cam`,value:n?.device?.deviceId,devices:r,disabled:!t,onChange:e=>i(e),label:`Select camera`,compact:e})});var Mb=ba((e={})=>{let{onToggleScreenshare:t,isScreenSharing:n}=ib();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 Nb(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 Pb=Ie(null);function Fb({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(Pb.Provider,{value:a,children:e})}function Ib(){let e=pt(Pb);if(!e)throw Error(`ClosedCaptions components must be used within <ClosedCaptionsProvider>`);return e}var Lb=ba(()=>{let{isEnabled:e,toggle:t}=Ib();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`})})}),Rb=ba(()=>{let{isEnabled:e}=Ib(),{captionText:t,captionRole:n}=Nb(),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]})})})}),zb=Ie(null);function Bb({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(zb.Provider,{value:o,children:e})}function Vb(){let e=pt(zb);if(!e)throw Error(`Chat components must be used within <ChatProvider>`);return e}var Hb=ba((e={})=>{let{isOpen:t,toggle:n}=Vb();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`})})}),Ub=ba(({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})]})}),Wb=ba(()=>{let{isOpen:e,close:t}=Vb(),{chatMessages:n,sendChat:r,session:i}=Nb(),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(Ub,{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 Gb({label:e}){return A(Uy,{role:`status`,"aria-live":`polite`,class:`z-2`,children:[A(Vy,{}),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 Kb=ba(()=>A(Gb,{label:`Connecting`})),qb=ba(()=>A(Gb,{label:`Leaving`}));function Jb({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 Yb=ba(({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%`}})]})})});function Xb({sessionId:e,className:t=``}){let n=D(null),r=D(void 0);return Gg(e??``,k(t=>{e&&(r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let e=Math.max(0,Math.min(1,t**.6));n.current?.style.setProperty(`--audio-level`,String(e))}))},[e])),A(`div`,{ref:n,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:[A(`div`,{class:`absolute inset-0 rounded-full will-change-transform`,style:{background:`conic-gradient(from 0deg, var(--color-primary), var(--color-info, var(--color-primary)), var(--color-secondary, var(--color-primary)), var(--color-primary))`,filter:`blur(28px)`,animation:`tavusOrbSpin 18s linear infinite`,scale:`calc(1 + var(--audio-level, 0) * 0.35)`,opacity:`calc(0.45 + var(--audio-level, 0) * 0.45)`,transition:`scale 120ms ease-out, opacity 120ms ease-out`}}),A(`div`,{class:`absolute inset-[12%] rounded-full will-change-transform`,style:{background:`conic-gradient(from 180deg, color-mix(in oklab, var(--color-primary) 80%, white), transparent 30%, color-mix(in oklab, var(--color-primary) 60%, white) 70%, transparent)`,filter:`blur(14px)`,opacity:.55,mixBlendMode:`screen`,animation:`tavusOrbSpin 26s linear infinite reverse`}}),A(`div`,{class:`absolute inset-[28%] rounded-full`,style:{background:`radial-gradient(circle at 30% 30%, color-mix(in oklab, white 70%, var(--color-primary)), var(--color-primary) 60%, color-mix(in oklab, var(--color-primary) 50%, black))`,boxShadow:`0 0 60px color-mix(in oklab, var(--color-primary) 60%, transparent), inset 0 0 30px color-mix(in oklab, white 40%, transparent)`,scale:`calc(1 + var(--audio-level, 0) * 0.18)`,transition:`scale 100ms ease-out`}}),A(`div`,{class:`absolute inset-[28%] rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--color-primary) 80%, transparent), transparent 70%)`,animation:`tavusOrbPulse 2.6s ease-in-out infinite`}})]})}function Zb({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 Qb=e=>!!e.user_id?.includes(`tavus-replica`);function $b(){return Xh({filter:Qb})}function ex(e){let t=$b()[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 tx=ba(({isAudioOnly:e})=>{let t=ex(e);return t.phase===`left`?A(qb,{}):t.phase===`connecting`?A(Kb,{}):e?A(Zb,{class:`flex items-center justify-center`,children:[A(Xb,{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})]})}),nx=ba(({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(tx,{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(Ab,{}),!n&&A(jb,{}),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`})})]})]})})}),rx=ba(({personaSessionId:e,localSessionId:t,isPresenting:n,isScreenSharing:r,isAudioOnly:i,avatarOff:a,videoRef:o})=>{let s=n||r;return A(ue,{children:[A(rg,{ref:o,automirror:!0,sessionId:r?t??``:e,type:s?`screenVideo`:`video`,fit:s?`contain`:`cover`,className:`absolute inset-0 w-full h-full transition-all ${s?`object-contain`:`object-cover`} ${!s&&a?`hidden`:``}`}),n&&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:i||a?A(`div`,{class:`flex w-full h-full items-center justify-center`,children:A(Xb,{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 ix(e){return e&&Object.assign(cx,e),cx}var ax,ox,sx,cx,lx=a((()=>{ox=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},sx=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(ax=globalThis).__zod_globalConfig??(ax.__zod_globalConfig={}),cx=globalThis.__zod_globalConfig}));function ux(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 dx(e,t=`|`){return e.map(e=>Dx(e)).join(t)}function fx(e,t){return typeof t==`bigint`?t.toString():t}function px(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function mx(e){return e==null}function hx(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function gx(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 _x(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Wx)return r===void 0&&(r=Wx,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function vx(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function yx(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function bx(e){return JSON.stringify(e)}function xx(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Sx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Cx(e){if(Sx(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Sx(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function wx(e){return Cx(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Tx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ex(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 Dx(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ox(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function kx(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 Ex(e,yx(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 vx(this,`shape`,e),e},checks:[]}))}function Ax(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 Ex(e,yx(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 vx(this,`shape`,r),r},checks:[]}))}function jx(e,t){if(!Cx(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 Ex(e,yx(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return vx(this,`shape`,n),n}}))}function Mx(e,t){if(!Cx(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ex(e,yx(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return vx(this,`shape`,n),n}}))}function Nx(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ex(e,yx(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return vx(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Px(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 Ex(t,yx(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 vx(this,`shape`,i),i},checks:[]}))}function Fx(e,t,n){return Ex(t,yx(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 vx(this,`shape`,i),i}}))}function Ix(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 Lx(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 Rx(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function zx(e){return typeof e==`string`?e:e?.message}function Bx(e,t,n){let r=e.message?e.message:zx(e.inst?._zod.def?.error?.(e))??zx(t?.error?.(e))??zx(n.customError?.(e))??zx(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 Vx(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Hx(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 Ux(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Wx,Gx,Kx,qx,Jx,Yx=a((()=>{lx(),Wx=Symbol(`evaluating`),Gx=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},Kx=px(()=>{if(cx.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),qx=new Set([`string`,`number`,`symbol`]),Jx={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function Xx(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 Zx(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 Qx,$x,eS,tS=a((()=>{lx(),Yx(),Qx=(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,fx,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$x=K(`$ZodError`,Qx),eS=K(`$ZodError`,Qx,{Parent:Error})})),nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS=a((()=>{lx(),tS(),Yx(),nS=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 ox;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Bx(e,a,ix())));throw Gx(t,i?.callee),t}return o.value},rS=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=>Bx(e,a,ix())));throw Gx(t,i?.callee),t}return o.value},iS=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 ox;return a.issues.length?{success:!1,error:new(e??$x)(a.issues.map(e=>Bx(e,i,ix())))}:{success:!0,data:a.value}},aS=iS(eS),oS=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=>Bx(e,i,ix())))}:{success:!0,data:a.value}},sS=oS(eS),cS=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return nS(e)(t,n,i)},lS=e=>(t,n,r)=>nS(e)(t,n,r),uS=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return rS(e)(t,n,i)},dS=e=>async(t,n,r)=>rS(e)(t,n,r),fS=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return iS(e)(t,n,i)},pS=e=>(t,n,r)=>iS(e)(t,n,r),mS=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return oS(e)(t,n,i)},hS=e=>async(t,n,r)=>oS(e)(t,n,r)}));function _S(){return new RegExp(jS,`u`)}function vS(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 yS(e){return RegExp(`^${vS(e)}$`)}function bS(e){let t=vS({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(`^${BS}T(?:${r})$`)}var xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS=a((()=>{xS=/^[cC][0-9a-z]{6,}$/,SS=/^[0-9a-z]+$/,CS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wS=/^[0-9a-vA-V]{20}$/,TS=/^[A-Za-z0-9]{27}$/,ES=/^[a-zA-Z0-9_-]{21}$/,DS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OS=/^([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})$/,kS=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)$/,AS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,jS=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,MS=/^(?:(?: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])$/,NS=/^(([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}|:))$/,PS=/^((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])$/,FS=/^(([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])$/,IS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,LS=/^[A-Za-z0-9_-]*$/,RS=/^https?$/,zS=/^\+[1-9]\d{6,14}$/,BS=`(?:(?:\\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])))`,VS=RegExp(`^${BS}$`),HS=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},US=/^-?\d+$/,WS=/^-?\d+(?:\.\d+)?$/,GS=/^(?:true|false)$/i,KS=/^null$/i,qS=/^undefined$/i,JS=/^[^A-Z]*$/,YS=/^[^a-z]*$/})),ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC=a((()=>{lx(),XS(),Yx(),ZS=K(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),QS={number:`number`,bigint:`bigint`,object:`date`},$S=K(`$ZodCheckLessThan`,(e,t)=>{ZS.init(e,t);let n=QS[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})}}),eC=K(`$ZodCheckGreaterThan`,(e,t)=>{ZS.init(e,t);let n=QS[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})}}),tC=K(`$ZodCheckMultipleOf`,(e,t)=>{ZS.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):gx(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})}}),nC=K(`$ZodCheckNumberFormat`,(e,t)=>{ZS.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Jx[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=US)}),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})}}),rC=K(`$ZodCheckMaxLength`,(e,t)=>{var n;ZS.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mx(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=Vx(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),iC=K(`$ZodCheckMinLength`,(e,t)=>{var n;ZS.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mx(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=Vx(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),aC=K(`$ZodCheckLengthEquals`,(e,t)=>{var n;ZS.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mx(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=Vx(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})}}),oC=K(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ZS.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=()=>{})}),sC=K(`$ZodCheckRegex`,(e,t)=>{oC.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})}}),cC=K(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=JS,oC.init(e,t)}),lC=K(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=YS,oC.init(e,t)}),uC=K(`$ZodCheckIncludes`,(e,t)=>{ZS.init(e,t);let n=Tx(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})}}),dC=K(`$ZodCheckStartsWith`,(e,t)=>{ZS.init(e,t);let n=RegExp(`^${Tx(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})}}),fC=K(`$ZodCheckEndsWith`,(e,t)=>{ZS.init(e,t);let n=RegExp(`.*${Tx(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})}}),pC=K(`$ZodCheckOverwrite`,(e,t)=>{ZS.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),hC,gC=a((()=>{hC=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(`
|
|
51
51
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
52
52
|
`))}}})),_C,vC=a((()=>{_C={major:4,minor:4,patch:3}}));function yC(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}function bC(e){if(!LS.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return yC(t.padEnd(Math.ceil(t.length/4)*4,`=`))}function xC(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}function SC(e,t,n){e.issues.length&&t.issues.push(...Rx(n,e.issues)),t.value[n]=e.value}function CC(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Rx(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function wC(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ox(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function TC(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>CC(e,n,i,t,u,d))):CC(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}function EC(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ix(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Bx(e,r,ix())))}),t)}function DC(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Cx(e)&&Cx(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=DC(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=DC(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function OC(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Ix(e))return e;let o=DC(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}function kC(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}function AC(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function jC(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function MC(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}function NC(e){return e.value=Object.freeze(e.value),e}function PC(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ux(e))}}var FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,lw,uw,dw,fw,pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,Tw,Ew,Dw,Ow,kw,Aw,jw,Mw,Nw,Pw,Fw=a((()=>{mC(),lx(),gC(),gS(),XS(),Yx(),vC(),FC=K(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_C;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Ix(e),i;for(let a of t){if(a._zod.def.when){if(Lx(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new ox;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Ix(e,t))});else{if(e.issues.length===t)continue;r||=Ix(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Ix(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new ox;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new ox;return o.then(e=>t(e,r,a))}return t(o,r,a)}}_x(e,`~standard`,()=>({validate:t=>{try{let n=aS(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return sS(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),IC=K(`$ZodString`,(e,t)=>{FC.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??HS(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),LC=K(`$ZodStringFormat`,(e,t)=>{oC.init(e,t),IC.init(e,t)}),RC=K(`$ZodGUID`,(e,t)=>{t.pattern??=OS,LC.init(e,t)}),zC=K(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=kS(e)}else t.pattern??=kS();LC.init(e,t)}),BC=K(`$ZodEmail`,(e,t)=>{t.pattern??=AS,LC.init(e,t)}),VC=K(`$ZodURL`,(e,t)=>{LC.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===RS.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),HC=K(`$ZodEmoji`,(e,t)=>{t.pattern??=_S(),LC.init(e,t)}),UC=K(`$ZodNanoID`,(e,t)=>{t.pattern??=ES,LC.init(e,t)}),WC=K(`$ZodCUID`,(e,t)=>{t.pattern??=xS,LC.init(e,t)}),GC=K(`$ZodCUID2`,(e,t)=>{t.pattern??=SS,LC.init(e,t)}),KC=K(`$ZodULID`,(e,t)=>{t.pattern??=CS,LC.init(e,t)}),qC=K(`$ZodXID`,(e,t)=>{t.pattern??=wS,LC.init(e,t)}),JC=K(`$ZodKSUID`,(e,t)=>{t.pattern??=TS,LC.init(e,t)}),YC=K(`$ZodISODateTime`,(e,t)=>{t.pattern??=bS(t),LC.init(e,t)}),XC=K(`$ZodISODate`,(e,t)=>{t.pattern??=VS,LC.init(e,t)}),ZC=K(`$ZodISOTime`,(e,t)=>{t.pattern??=yS(t),LC.init(e,t)}),QC=K(`$ZodISODuration`,(e,t)=>{t.pattern??=DS,LC.init(e,t)}),$C=K(`$ZodIPv4`,(e,t)=>{t.pattern??=MS,LC.init(e,t),e._zod.bag.format=`ipv4`}),ew=K(`$ZodIPv6`,(e,t)=>{t.pattern??=NS,LC.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),tw=K(`$ZodCIDRv4`,(e,t)=>{t.pattern??=PS,LC.init(e,t)}),nw=K(`$ZodCIDRv6`,(e,t)=>{t.pattern??=FS,LC.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}}),rw=K(`$ZodBase64`,(e,t)=>{t.pattern??=IS,LC.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{yC(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),iw=K(`$ZodBase64URL`,(e,t)=>{t.pattern??=LS,LC.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{bC(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),aw=K(`$ZodE164`,(e,t)=>{t.pattern??=zS,LC.init(e,t)}),ow=K(`$ZodJWT`,(e,t)=>{LC.init(e,t),e._zod.check=n=>{xC(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),sw=K(`$ZodNumber`,(e,t)=>{FC.init(e,t),e._zod.pattern=e._zod.bag.pattern??WS,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),cw=K(`$ZodNumberFormat`,(e,t)=>{nC.init(e,t),sw.init(e,t)}),lw=K(`$ZodBoolean`,(e,t)=>{FC.init(e,t),e._zod.pattern=GS,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),uw=K(`$ZodUndefined`,(e,t)=>{FC.init(e,t),e._zod.pattern=qS,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),dw=K(`$ZodNull`,(e,t)=>{FC.init(e,t),e._zod.pattern=KS,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),fw=K(`$ZodUnknown`,(e,t)=>{FC.init(e,t),e._zod.parse=e=>e}),pw=K(`$ZodNever`,(e,t)=>{FC.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),mw=K(`$ZodArray`,(e,t)=>{FC.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>SC(t,n,e))):SC(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}}),hw=K(`$ZodObject`,(e,t)=>{if(FC.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=px(()=>wC(t));_x(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Sx,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>CC(n,t,e,s,r,i))):CC(a,t,e,s,r,i)}return i?TC(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),gw=K(`$ZodObjectJIT`,(e,t)=>{hw.init(e,t);let n=e._zod.parse,r=px(()=>wC(t)),i=e=>{let t=new hC([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=bx(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=bx(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
53
53
|
if (${n}.issues.length) {
|
package/dist/index.mjs
CHANGED
|
@@ -19092,20 +19092,20 @@ function Wy({ title: e, description: t, media: n, children: r, overlay: i }) {
|
|
|
19092
19092
|
//#region ../core/src/utils/unavailable-copy.ts
|
|
19093
19093
|
var Gy = {
|
|
19094
19094
|
daily_limit: {
|
|
19095
|
-
title: "
|
|
19096
|
-
description: "This
|
|
19095
|
+
title: "PAL is at today's limit",
|
|
19096
|
+
description: "This PAL can take more conversations tomorrow."
|
|
19097
19097
|
},
|
|
19098
19098
|
total_limit: {
|
|
19099
|
-
title: "
|
|
19100
|
-
description: "This
|
|
19099
|
+
title: "PAL is unavailable",
|
|
19100
|
+
description: "This PAL isn't available right now. Please check back later."
|
|
19101
19101
|
},
|
|
19102
19102
|
busy: {
|
|
19103
|
-
title: "
|
|
19103
|
+
title: "PAL is in another conversation",
|
|
19104
19104
|
description: "Please try again in a moment."
|
|
19105
19105
|
},
|
|
19106
19106
|
error: {
|
|
19107
|
-
title: "Couldn't load this
|
|
19108
|
-
description: "This
|
|
19107
|
+
title: "Couldn't load this PAL",
|
|
19108
|
+
description: "This PAL couldn't be loaded. Please try again later."
|
|
19109
19109
|
}
|
|
19110
19110
|
};
|
|
19111
19111
|
function Ky(e, t) {
|
|
@@ -19808,14 +19808,14 @@ var Lb = ba(() => {
|
|
|
19808
19808
|
}), Rb = ba(() => {
|
|
19809
19809
|
let { isEnabled: e } = Ib(), { captionText: t, captionRole: n } = Nb(), r = t.value, i = n.value;
|
|
19810
19810
|
return !e || !r ? null : /* @__PURE__ */ A("div", {
|
|
19811
|
-
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",
|
|
19811
|
+
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",
|
|
19812
19812
|
role: "status",
|
|
19813
19813
|
"aria-live": "polite",
|
|
19814
19814
|
children: /* @__PURE__ */ A("div", {
|
|
19815
19815
|
class: "text-sm leading-5 max-h-15 overflow-hidden flex flex-col justify-end text-center",
|
|
19816
19816
|
children: /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("span", {
|
|
19817
19817
|
class: `text-xs ${i === "replica" ? "text-secondary" : "text-primary"} mr-2`,
|
|
19818
|
-
children: i === "replica" ? "
|
|
19818
|
+
children: i === "replica" ? "PAL" : "You"
|
|
19819
19819
|
}), r] })
|
|
19820
19820
|
})
|
|
19821
19821
|
});
|
|
@@ -19856,7 +19856,7 @@ var Hb = ba((e = {}) => {
|
|
|
19856
19856
|
class: `flex flex-col gap-1 ${t ? "items-end" : "items-start"}`,
|
|
19857
19857
|
children: [/* @__PURE__ */ A("span", {
|
|
19858
19858
|
class: `text-xs ${t ? "text-primary" : "text-secondary"}`,
|
|
19859
|
-
children: t ? "You" : "
|
|
19859
|
+
children: t ? "You" : "PAL"
|
|
19860
19860
|
}), /* @__PURE__ */ A("span", {
|
|
19861
19861
|
class: `px-3 py-2 rounded-field text-sm max-w-[80%] ${t ? "bg-primary text-primary-content" : "bg-base-200 text-base-content"}`,
|
|
19862
19862
|
children: e.text
|