@telnyx/ai-agent-widget 0.6.0 → 0.7.0

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.
@@ -73,7 +73,7 @@
73
73
  *
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
- */const Kg=we("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Fn={},ou=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,au=e=>"init"in e,wr=e=>!!e.write,lu=e=>"v"in e||"e"in e,Ti=e=>{if("e"in e)throw e.e;if((Fn?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},ki=new WeakMap,cu=e=>{var t;return Ei(e)&&!!((t=ki.get(e))!=null&&t[0])},Xg=e=>{const t=ki.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))},uu=(e,t)=>{let n=ki.get(e);if(!n){n=[!0,new Set],ki.set(e,n);const i=()=>{n[0]=!1};e.then(i,i)}n[1].add(t)},Ei=e=>typeof(e==null?void 0:e.then)=="function",du=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},xr=(e,t,n)=>{const i=n(e),s="v"in i,o=i.v;if(Ei(t))for(const r of i.d.keys())du(e,t,n(r));i.v=t,delete i.e,(!s||!Object.is(o,i.v))&&(++i.n,Ei(o)&&Xg(o))},hu=(e,t,n)=>{var i;const s=new Set;for(const o of((i=n.get(e))==null?void 0:i.t)||[])n.has(o)&&s.add(o);for(const o of t.p)s.add(o);return s},Yg=()=>{const e=new Set,t=()=>{e.forEach(n=>n())};return t.add=n=>(e.add(n),()=>{e.delete(n)}),t},Sr=()=>{const e={},t=new WeakMap,n=i=>{var s,o;(s=t.get(e))==null||s.forEach(r=>r(i)),(o=t.get(i))==null||o.forEach(r=>r())};return n.add=(i,s)=>{const o=i||e,r=(t.has(o)?t:t.set(o,new Set)).get(o);return r.add(s),()=>{r==null||r.delete(s),r.size||t.delete(o)}},n},Zg=e=>(e.c||(e.c=Sr()),e.m||(e.m=Sr()),e.u||(e.u=Sr()),e.f||(e.f=Yg()),e),Jg=Symbol(),fu=(e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new Set,s=new Set,o=new Set,r={},a=(m,...g)=>m.read(...g),l=(m,...g)=>m.write(...g),c=(m,g)=>{var _;return(_=m.unstable_onInit)==null?void 0:_.call(m,g)},d=(m,g)=>{var _;return(_=m.onMount)==null?void 0:_.call(m,g)},...u)=>{const m=u[0]||(x=>{if((Fn?"production":void 0)!=="production"&&!x)throw new Error("Atom is undefined or null");let T=e.get(x);return T||(T={d:new Map,p:new Set,n:0},e.set(x,T),c==null||c(x,D)),T}),g=u[1]||(()=>{const x=[],T=f=>{try{f()}catch(p){x.push(p)}};do{r.f&&T(r.f);const f=new Set,p=f.add.bind(f);i.forEach(h=>{var v;return(v=t.get(h))==null?void 0:v.l.forEach(p)}),i.clear(),o.forEach(p),o.clear(),s.forEach(p),s.clear(),f.forEach(T),i.size&&_()}while(i.size||o.size||s.size);if(x.length)throw new AggregateError(x)}),_=u[2]||(()=>{const x=[],T=new WeakSet,f=new WeakSet,p=Array.from(i);for(;p.length;){const h=p[p.length-1],v=m(h);if(f.has(h)){p.pop();continue}if(T.has(h)){if(n.get(h)===v.n)x.push([h,v]);else if((Fn?"production":void 0)!=="production"&&n.has(h))throw new Error("[Bug] invalidated atom exists");f.add(h),p.pop();continue}T.add(h);for(const k of hu(h,v,t))T.has(k)||p.push(k)}for(let h=x.length-1;h>=0;--h){const[v,k]=x[h];let A=!1;for(const E of k.d.keys())if(E!==v&&i.has(E)){A=!0;break}A&&(b(v),S(v)),n.delete(v)}}),b=u[3]||(x=>{var T;const f=m(x);if(lu(f)&&(t.has(x)&&n.get(x)!==f.n||Array.from(f.d).every(([I,V])=>b(I).n===V)))return f;f.d.clear();let p=!0;const h=()=>{t.has(x)&&(S(x),_(),g())},v=I=>{var V;if(ou(x,I)){const N=m(I);if(!lu(N))if(au(I))xr(I,I.init,m);else throw new Error("no atom init");return Ti(N)}const K=b(I);try{return Ti(K)}finally{f.d.set(I,K.n),cu(f.v)&&du(x,f.v,K),(V=t.get(I))==null||V.t.add(x),p||h()}};let k,A;const E={get signal(){return k||(k=new AbortController),k.signal},get setSelf(){return(Fn?"production":void 0)!=="production"&&!wr(x)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&wr(x)&&(A=(...I)=>{if((Fn?"production":void 0)!=="production"&&p&&console.warn("setSelf function cannot be called in sync"),!p)try{return y(x,...I)}finally{_(),g()}}),A}},P=f.n;try{const I=a(x,v,E);return xr(x,I,m),Ei(I)&&(uu(I,()=>k==null?void 0:k.abort()),I.then(h,h)),f}catch(I){return delete f.v,f.e=I,++f.n,f}finally{p=!1,P!==f.n&&n.get(x)===P&&(n.set(x,f.n),i.add(x),(T=r.c)==null||T.call(r,x))}}),w=u[4]||(x=>{const T=[x];for(;T.length;){const f=T.pop(),p=m(f);for(const h of hu(f,p,t)){const v=m(h);n.set(h,v.n),T.push(h)}}}),y=u[5]||((x,...T)=>{let f=!0;const p=v=>Ti(b(v)),h=(v,...k)=>{var A;const E=m(v);try{if(ou(x,v)){if(!au(v))throw new Error("atom not writable");const P=E.n,I=k[0];xr(v,I,m),S(v),P!==E.n&&(i.add(v),(A=r.c)==null||A.call(r,v),w(v));return}else return y(v,...k)}finally{f||(_(),g())}};try{return l(x,p,h,...T)}finally{f=!1}}),S=u[6]||(x=>{var T;const f=m(x),p=t.get(x);if(p&&!cu(f.v)){for(const[h,v]of f.d)if(!p.d.has(h)){const k=m(h);C(h).t.add(x),p.d.add(h),v!==k.n&&(i.add(h),(T=r.c)==null||T.call(r,h),w(h))}for(const h of p.d||[])if(!f.d.has(h)){p.d.delete(h);const v=R(h);v==null||v.t.delete(x)}}}),C=u[7]||(x=>{var T;const f=m(x);let p=t.get(x);if(!p){b(x);for(const h of f.d.keys())C(h).t.add(x);if(p={l:new Set,d:new Set(f.d.keys()),t:new Set},t.set(x,p),(T=r.m)==null||T.call(r,x),wr(x)){const h=()=>{let v=!0;const k=(...A)=>{try{return y(x,...A)}finally{v||(_(),g())}};try{const A=d(x,k);A&&(p.u=()=>{v=!0;try{A()}finally{v=!1}})}finally{v=!1}};s.add(h)}}return p}),R=u[8]||(x=>{var T;const f=m(x);let p=t.get(x);if(p&&!p.l.size&&!Array.from(p.t).some(h=>{var v;return(v=t.get(h))==null?void 0:v.d.has(x)})){p.u&&o.add(p.u),p=void 0,t.delete(x),(T=r.u)==null||T.call(r,x);for(const h of f.d.keys()){const v=R(h);v==null||v.t.delete(x)}return}return p}),M=[e,t,n,i,s,o,r,a,l,c,d,m,g,_,b,w,y,S,C,R],D={get:x=>Ti(b(x)),set:(x,...T)=>{try{return y(x,...T)}finally{_(),g()}},sub:(x,T)=>{const p=C(x).l;return p.add(T),g(),()=>{p.delete(T),R(x),g()}}};return Object.defineProperty(D,Jg,{value:M}),D},Qg=Zg,pu=uu,Cr={};let tv=0;function ev(e,t){const n=`atom${++tv}`,i={toString(){return(Cr?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return i.init=e,i.read=nv,i.write=iv,i}function nv(e){return e(this)}function iv(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}const sv=()=>{let e=0;const t=Qg({}),n=new WeakMap,i=new WeakMap,s=fu(n,i,void 0,void 0,void 0,void 0,t,void 0,(a,l,c,...d)=>e?c(a,...d):a.write(l,c,...d)),o=new Set;return t.m.add(void 0,a=>{o.add(a);const l=n.get(a);l.m=i.get(a)}),t.u.add(void 0,a=>{o.delete(a);const l=n.get(a);delete l.m}),Object.assign(s,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:a=>{const l={read:()=>null,write:(c,d)=>{++e;try{for(const[u,m]of a)"init"in u&&d(u,m)}finally{--e}}};s.set(l)}})};function rv(){return(Cr?"production":void 0)!=="production"?sv():fu()}let jn;function ov(){return jn||(jn=rv(),(Cr?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=jn),globalThis.__JOTAI_DEFAULT_STORE__!==jn&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),jn}const av={},lv=Ae(void 0);function mu(e){return wt(lv)||ov()}const Tr=e=>typeof(e==null?void 0:e.then)=="function",kr=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},cv=Uo.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(kr(e),e)}),Er=new WeakMap,gu=(e,t)=>{let n=Er.get(e);return n||(n=new Promise((i,s)=>{let o=e;const r=c=>d=>{o===c&&i(d)},a=c=>d=>{o===c&&s(d)},l=()=>{try{const c=t();Tr(c)?(Er.set(c,n),o=c,c.then(r(c),a(c)),pu(c,l)):i(c)}catch(c){s(c)}};e.then(r(e),a(e)),pu(e,l)}),Er.set(e,n)),n};function uv(e,t){const{delay:n,unstable_promiseStatus:i=!Uo.use}={},s=mu(),[[o,r,a],l]=wo(d=>{const u=s.get(e);return Object.is(d[0],u)&&d[1]===s&&d[2]===e?d:[u,s,e]},void 0,()=>[s.get(e),s,e]);let c=o;if((r!==s||a!==e)&&(l(),c=s.get(e)),zt(()=>{const d=s.sub(e,()=>{if(i)try{const u=s.get(e);Tr(u)&&kr(gu(u,()=>s.get(e)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[s,e,n,i]),vd(c),Tr(c)){const d=gu(c,()=>s.get(e));return i&&kr(d),cv(d)}return c}function dv(e,t){const n=mu();return Ji((...s)=>{if((av?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...s)},[n,e])}function hv(e,t){return[uv(e),dv(e)]}const fv=ev(!1),pv=()=>hv(fv),Ai=({children:e,className:t,onClick:n,tooltip:i})=>L("button",{title:i,onClick:n,className:Bn("w-8 h-8 rounded-full cursor-pointer text-white flex items-center justify-center",t),children:e}),vu=({call:e})=>{const[t,n]=pv(),i=()=>{n(o=>{const r=!o;return r?e.muteAudio():e.unmuteAudio(),r})},s=()=>{e.hangup()};return L("div",{className:"flex items-center justify-center gap-2",children:[L(Ai,{tooltip:t?"Unmute":"Mute",onClick:i,className:Bn(t?"bg-[#750000]":"bg-[#3C3C3C]"),children:t?L(Gg,{className:"w-5 h-5"}):L(Hg,{className:"w-5 h-5"})}),L(Ai,{tooltip:"End Call",onClick:s,className:"bg-[#750000]",children:L(Wg,{className:"w-4 h-4"})})]})},_u=({call:e,onExpand:t})=>L(On.div,{layoutId:Ci,className:"p-4 rounded-3xl w-[250px] overflow-hidden flex flex-col items-center justify-center bg-black text-white shadow-lg shadow-[#38383878] gap-3",children:[L(iu,{onClick:t,className:"h-[72px] cursor-pointer",stream:e.remoteStream}),L(Dc,{stream:e.remoteStream}),L("h1",{className:"text-xs",children:"Speak to interrupt"}),L(vu,{call:e})]});function mv({item:e}){const t=qt(null);return zt(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth"})},[]),L("li",{className:Bn("flex flex-col gap-1 text-left",{"items-end":e.role==="user"}),ref:t,children:[L("span",{className:"text-xs text-[#969696]",children:e.timestamp.toLocaleTimeString()}),L("p",{className:Bn("text-white text-sm",{"bg-[#222227] px-2.5 py-2 rounded-md":e.role==="user"}),children:e.content})]})}const gv=({transcript:e})=>L("div",{className:"h-[240px] sm:h-[320px] bg-[#38383C] rounded-t-3xl sm:rounded-3xl p-4 flex flex-col w-full",children:[L("ul",{className:"overflow-y-auto flex flex-col gap-4 p-4 flex-1",children:e.map((t,n)=>L(mv,{item:t},t.id+n))}),L("div",{className:"flex items-center h-8 bg-[#222227] rounded-full p-2 gap-2",children:[L("input",{type:"text",placeholder:"Type something here",className:"w-full outline-none text-sm"}),L(Ai,{tooltip:"Send",children:L(zg,{className:"text-[#969696] w-4 h-4"})})]})]});function vv({onCollapse:e}){return L("div",{className:"flex items-center justify-between w-full",children:L(Ai,{tooltip:"Collapse",className:"ml-auto",onClick:e,children:L(Kg,{})})})}const _v=({call:e,onCollapse:t,transcript:n})=>L(Df,{children:L(On.div,{exit:{opacity:0,scale:.95},initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},layoutId:"transcript-widget",className:"bg-black gap-3 w-full sm:w-[400px] text-white rounded-t-3xl sm:rounded-3xl shadow-lg shadow-[#38383878]",children:[L("div",{className:"p-4 text-center",children:[L(vv,{onCollapse:t}),L(iu,{className:"h-[144px]",stream:e.remoteStream}),L("h1",{className:"mb-4",children:"Speak or text to interrupt"}),L(vu,{call:e})]}),L(Dc,{stream:e.remoteStream}),L(gv,{transcript:n})]})});function Ar(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}function H(e,t,n,i){return new(n||(n=Promise))(function(s,o){function r(c){try{l(i.next(c))}catch(d){o(d)}}function a(c){try{l(i.throw(c))}catch(d){o(d)}}function l(c){var d;c.done?s(c.value):(d=c.value,d instanceof n?d:new n(function(u){u(d)})).then(r,a)}l((i=i.apply(e,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var yu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),yv=new Uint8Array(16);function bv(){if(!yu)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yu(yv)}for(var bu=[],Ii=0;Ii<256;++Ii)bu[Ii]=(Ii+256).toString(16).substr(1);function $n(e,t,n){var i=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||bv)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var o=0;o<16;++o)t[i+o]=s[o];return t||function(r,a){var l=0,c=bu;return[c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]]].join("")}(s)}var wv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wu(e,t){return e(t={exports:{}},t.exports),t.exports}var xv=wu(function(e){var t,n;t=wv,n=function(){var i=function(){},s="undefined",o=typeof window!==s&&typeof window.navigator!==s&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function a(w,y){var S=w[y];if(typeof S.bind=="function")return S.bind(w);try{return Function.prototype.bind.call(S,w)}catch{return function(){return Function.prototype.apply.apply(S,[w,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(w,y){for(var S=0;S<r.length;S++){var C=r[S];this[C]=S<w?i:this.methodFactory(C,w,y)}this.log=this.debug}function d(w,y,S){return function(){typeof console!==s&&(c.call(this,y,S),this[w].apply(this,arguments))}}function u(w,y,S){return function(C){return C==="debug"&&(C="log"),typeof console!==s&&(C==="trace"&&o?l:console[C]!==void 0?a(console,C):console.log!==void 0?a(console,"log"):i)}(w)||d.apply(this,arguments)}function m(w,y,S){var C,R=this;y=y??"WARN";var M="loglevel";function D(){var T;if(typeof window!==s&&M){try{T=window.localStorage[M]}catch{}if(typeof T===s)try{var f=window.document.cookie,p=f.indexOf(encodeURIComponent(M)+"=");p!==-1&&(T=/^([^;]+)/.exec(f.slice(p))[1])}catch{}return R.levels[T]===void 0&&(T=void 0),T}}typeof w=="string"?M+=":"+w:typeof w=="symbol"&&(M=void 0),R.name=w,R.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},R.methodFactory=S||u,R.getLevel=function(){return C},R.setLevel=function(T,f){if(typeof T=="string"&&R.levels[T.toUpperCase()]!==void 0&&(T=R.levels[T.toUpperCase()]),!(typeof T=="number"&&T>=0&&T<=R.levels.SILENT))throw"log.setLevel() called with invalid level: "+T;if(C=T,f!==!1&&function(p){var h=(r[p]||"silent").toUpperCase();if(typeof window!==s&&M){try{return void(window.localStorage[M]=h)}catch{}try{window.document.cookie=encodeURIComponent(M)+"="+h+";"}catch{}}}(T),c.call(R,T,w),typeof console===s&&T<R.levels.SILENT)return"No console available for logging"},R.setDefaultLevel=function(T){y=T,D()||R.setLevel(T,!1)},R.resetLevel=function(){R.setLevel(y,!1),function(){if(typeof window!==s&&M){try{return void window.localStorage.removeItem(M)}catch{}try{window.document.cookie=encodeURIComponent(M)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}()},R.enableAll=function(T){R.setLevel(R.levels.TRACE,T)},R.disableAll=function(T){R.setLevel(R.levels.SILENT,T)};var x=D();x==null&&(x=y),R.setLevel(x,!1)}var g=new m,_={};g.getLogger=function(w){if(typeof w!="symbol"&&typeof w!="string"||w==="")throw new TypeError("You must supply a name when creating a logger.");var y=_[w];return y||(y=_[w]=new m(w,g.getLevel(),g.methodFactory)),y};var b=typeof window!==s?window.log:void 0;return g.noConflict=function(){return typeof window!==s&&window.log===g&&(window.log=b),g},g.getLoggers=function(){return _},g.default=g,g},e.exports?e.exports=n():t.log=n()});const B=xv.getLogger("telnyx"),Sv=B.methodFactory;B.methodFactory=(e,t,n)=>{const i=Sv(e,t,n);return function(){const s=[new Date().toISOString().replace("T"," ").replace("Z",""),"-"];for(let o=0;o<arguments.length;o++)s.push(arguments[o]);i.apply(void 0,s)}},B.setLevel(B.getLevel());const xu="Time to call invite",Su="wss://rtc.telnyx.com",Cv={urls:"stun:stun.telnyx.com:3478"},Tv={urls:"turn:turn.telnyx.com:3478?transport=tcp",username:"testuser",credential:"testpassword"};var F;(function(e){e.SocketOpen="telnyx.socket.open",e.SocketClose="telnyx.socket.close",e.SocketError="telnyx.socket.error",e.SocketMessage="telnyx.socket.message",e.SpeedTest="telnyx.internal.speedtest",e.Ready="telnyx.ready",e.Error="telnyx.error",e.Notification="telnyx.notification",e.StatsFrame="telnyx.stats.frame",e.StatsReport="telnyx.stats.report",e.Messages="telnyx.messages",e.Calls="telnyx.calls",e.MediaError="telnyx.rtc.mediaError"})(F||(F={}));const Cu=e=>Object.keys(e).length===0,Ri=e=>{const[t,n,i,s,o,r]=e;let a={};try{a=JSON.parse(o.replace(/ID"/g,'Id"'))}catch{B.warn("Verto LA invalid media JSON string:",o)}return{participantId:Number(t),participantNumber:n,participantName:i,codec:s,media:a,participantData:r}},Tu=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},sn=e=>e instanceof Function||typeof e=="function",Un=e=>typeof document=="object"&&"getElementById"in document?typeof e=="string"?document.getElementById(e)||null:typeof e=="function"?e():e instanceof HTMLMediaElement?e:null:null,kv=/^(ws|wss):\/\//,ku=(e,t=null)=>{const{result:n={},error:i}=e;if(i)return{error:i};const{result:s=null}=n;if(s===null)return t!==null&&(n.node_id=t),{result:n};const{code:o=null,node_id:r=null,result:a=null}=s;return o&&o!=="200"?{error:s}:a?ku(a,r):{result:s}},Eu=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),Ir=({login:e,passwd:t,password:n,login_token:i})=>!!(e&&(t||n)||i),Pi=({anonymous_login:e})=>!!e&&!!e.target_id&&!!e.target_type,Rr=e=>{var t,n,i,s,o,r;let a="",l="";return!((n=(t=e==null?void 0:e.result)===null||t===void 0?void 0:t.params)===null||n===void 0)&&n.state&&(a=(s=(i=e==null?void 0:e.result)===null||i===void 0?void 0:i.params)===null||s===void 0?void 0:s.state),!((o=e==null?void 0:e.params)===null||o===void 0)&&o.state&&(l=(r=e==null?void 0:e.params)===null||r===void 0?void 0:r.state),a||l};function Au({debounceTime:e}){let t,n;return{promise:new Promise((i,s)=>{t=e?Ev(i,e):i,n=s}),resolve:t,reject:n}}const Ev=(e,t)=>{let n;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>{e(...i)},t)}},rn="GLOBAL",Lt={},Gn=(e,t)=>`${e}|${t}`,Iu=(e,t=rn)=>Gn(e,t)in Lt,on=(e,t,n=rn)=>{const i=Gn(e,n);i in Lt||(Lt[i]=[]),Lt[i].push(t)},Ru=(e,t,n=rn)=>{const i=function(s){an(e,i,n),t(s)};return i.prototype.targetRef=t,on(e,i,n)},an=(e,t,n=rn)=>{if(!Iu(e,n))return!1;const i=Gn(e,n);if(sn(t))for(let s=Lt[i].length-1;s>=0;s--){const o=Lt[i][s];(t===o||o.prototype&&t===o.prototype.targetRef)&&Lt[i].splice(s,1)}else Lt[i]=[];return Lt[i].length===0&&delete Lt[i],!0},J=(e,t,n=rn,i=!0)=>{const s=i&&n!==rn;if(!Iu(e,n))return s&&J(e,t),!1;const o=Gn(e,n),r=Lt[o].length;if(!r)return s&&J(e,t),!1;for(let a=r-1;a>=0;a--)Lt[o][a](t);return s&&J(e,t),!0},Pr=e=>{const t=Gn(e,"");Object.keys(Lt).filter(n=>n.indexOf(t)===0).forEach(n=>delete Lt[n])};var Dt,xe,nt;(function(e){e.Offer="offer",e.Answer="answer"})(Dt||(Dt={})),function(e){e.Inbound="inbound",e.Outbound="outbound"}(xe||(xe={})),function(e){e.Invite="telnyx_rtc.invite",e.Attach="telnyx_rtc.attach",e.Answer="telnyx_rtc.answer",e.Info="telnyx_rtc.info",e.Display="telnyx_rtc.display",e.Media="telnyx_rtc.media",e.Event="telnyx_rtc.event",e.Bye="telnyx_rtc.bye",e.Punt="telnyx_rtc.punt",e.Broadcast="telnyx_rtc.broadcast",e.Subscribe="telnyx_rtc.subscribe",e.Unsubscribe="telnyx_rtc.unsubscribe",e.ClientReady="telnyx_rtc.clientReady",e.Modify="telnyx_rtc.modify",e.Ringing="telnyx_rtc.ringing",e.GatewayState="telnyx_rtc.gatewayState",e.Ping="telnyx_rtc.ping",e.Pong="telnyx_rtc.pong"}(nt||(nt={}));const se={generic:"event",[nt.Display]:"participantData",[nt.Attach]:"participantData",conferenceUpdate:"conferenceUpdate",callUpdate:"callUpdate",vertoClientReady:"vertoClientReady",userMediaError:"userMediaError"},Av={destinationNumber:"",remoteCallerName:"Outbound Call",remoteCallerNumber:"",callerName:"",callerNumber:"",audio:!0,video:!1,useStereo:!1,debug:!1,debugOutput:"socket",attach:!1,screenShare:!1,userVariables:{},mediaSettings:{useSdpASBandwidthKbps:!1,sdpASBandwidthKbps:0}};var X,Hn,At,re,It;(function(e){e[e.New=0]="New",e[e.Requesting=1]="Requesting",e[e.Trying=2]="Trying",e[e.Recovering=3]="Recovering",e[e.Ringing=4]="Ringing",e[e.Answering=5]="Answering",e[e.Early=6]="Early",e[e.Active=7]="Active",e[e.Held=8]="Held",e[e.Hangup=9]="Hangup",e[e.Destroy=10]="Destroy",e[e.Purge=11]="Purge"})(X||(X={})),function(e){e.Participant="participant",e.Moderator="moderator"}(Hn||(Hn={})),function(e){e.Join="join",e.Leave="leave",e.Bootstrap="bootstrap",e.Add="add",e.Modify="modify",e.Delete="delete",e.Clear="clear",e.ChatMessage="chatMessage",e.LayerInfo="layerInfo",e.LogoInfo="logoInfo",e.LayoutInfo="layoutInfo",e.LayoutList="layoutList",e.ModCmdResponse="modCommandResponse"}(At||(At={})),function(e){e.Video="videoinput",e.AudioIn="audioinput",e.AudioOut="audiooutput"}(re||(re={})),function(e){e.REGED="REGED",e.UNREGED="UNREGED",e.NOREG="NOREG",e.FAILED="FAILED",e.FAIL_WAIT="FAIL_WAIT",e.REGISTER="REGISTER",e.TRYING="TRYING",e.EXPIRED="EXPIRED",e.UNREGISTER="UNREGISTER"}(It||(It={}));const Mr="telnyx-voice-sdk-id";function Lr(){return sessionStorage.getItem(Mr)}typeof window<"u"&&window.addEventListener("beforeunload",()=>{sessionStorage.removeItem(Mr)});let Iv=typeof WebSocket<"u"?WebSocket:null;const Rv=0,Pv=1,Mv=2,Lv=3;class Pu{constructor(t){this.session=t,this.previousGatewayState="",this._wsClient=null,this._host=Su,this._timers={},this.upDur=null,this.downDur=null;const{host:n,env:i,region:s}=t.options;i&&(this._host=i==="development"?"wss://rtcdev.telnyx.com":Su),n&&(this._host=(o=>`${kv.test(o)?"":"wss://"}${o}`)(n)),s&&(this._host=this._host.replace(/rtc(dev)?/,`${s}.rtc$1`))}get connected(){return this._wsClient&&this._wsClient.readyState===Pv}get connecting(){return this._wsClient&&this._wsClient.readyState===Rv}get closing(){return this._wsClient&&this._wsClient.readyState===Mv}get closed(){return this._wsClient&&this._wsClient.readyState===Lv}get isAlive(){return this.connecting||this.connected}get isDead(){return this.closing||this.closed}connect(){const t=new URL(this._host),n=Lr();n&&t.searchParams.set("voice_sdk_id",n),this._wsClient=new Iv(t.toString()),this._wsClient.onopen=i=>J(F.SocketOpen,i,this.session.uuid),this._wsClient.onclose=i=>J(F.SocketClose,i,this.session.uuid),this._wsClient.onerror=i=>J(F.SocketError,{error:i,sessionId:this.session.sessionid},this.session.uuid),this._wsClient.onmessage=i=>{var s,o;const r=Tu(i.data);var a;if(typeof r!="string"){if(r.voice_sdk_id&&(a=r.voice_sdk_id,sessionStorage.setItem(Mr,a)),this._unsetTimer(r.id),B.debug(`RECV:
76
+ */const Kg=we("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Fn={},ou=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,au=e=>"init"in e,wr=e=>!!e.write,lu=e=>"v"in e||"e"in e,Ti=e=>{if("e"in e)throw e.e;if((Fn?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},ki=new WeakMap,cu=e=>{var t;return Ei(e)&&!!((t=ki.get(e))!=null&&t[0])},Xg=e=>{const t=ki.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))},uu=(e,t)=>{let n=ki.get(e);if(!n){n=[!0,new Set],ki.set(e,n);const i=()=>{n[0]=!1};e.then(i,i)}n[1].add(t)},Ei=e=>typeof(e==null?void 0:e.then)=="function",du=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},xr=(e,t,n)=>{const i=n(e),s="v"in i,o=i.v;if(Ei(t))for(const r of i.d.keys())du(e,t,n(r));i.v=t,delete i.e,(!s||!Object.is(o,i.v))&&(++i.n,Ei(o)&&Xg(o))},hu=(e,t,n)=>{var i;const s=new Set;for(const o of((i=n.get(e))==null?void 0:i.t)||[])n.has(o)&&s.add(o);for(const o of t.p)s.add(o);return s},Yg=()=>{const e=new Set,t=()=>{e.forEach(n=>n())};return t.add=n=>(e.add(n),()=>{e.delete(n)}),t},Sr=()=>{const e={},t=new WeakMap,n=i=>{var s,o;(s=t.get(e))==null||s.forEach(r=>r(i)),(o=t.get(i))==null||o.forEach(r=>r())};return n.add=(i,s)=>{const o=i||e,r=(t.has(o)?t:t.set(o,new Set)).get(o);return r.add(s),()=>{r==null||r.delete(s),r.size||t.delete(o)}},n},Zg=e=>(e.c||(e.c=Sr()),e.m||(e.m=Sr()),e.u||(e.u=Sr()),e.f||(e.f=Yg()),e),Jg=Symbol(),fu=(e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new Set,s=new Set,o=new Set,r={},a=(m,...g)=>m.read(...g),l=(m,...g)=>m.write(...g),c=(m,g)=>{var _;return(_=m.unstable_onInit)==null?void 0:_.call(m,g)},d=(m,g)=>{var _;return(_=m.onMount)==null?void 0:_.call(m,g)},...u)=>{const m=u[0]||(x=>{if((Fn?"production":void 0)!=="production"&&!x)throw new Error("Atom is undefined or null");let T=e.get(x);return T||(T={d:new Map,p:new Set,n:0},e.set(x,T),c==null||c(x,D)),T}),g=u[1]||(()=>{const x=[],T=f=>{try{f()}catch(p){x.push(p)}};do{r.f&&T(r.f);const f=new Set,p=f.add.bind(f);i.forEach(h=>{var v;return(v=t.get(h))==null?void 0:v.l.forEach(p)}),i.clear(),o.forEach(p),o.clear(),s.forEach(p),s.clear(),f.forEach(T),i.size&&_()}while(i.size||o.size||s.size);if(x.length)throw new AggregateError(x)}),_=u[2]||(()=>{const x=[],T=new WeakSet,f=new WeakSet,p=Array.from(i);for(;p.length;){const h=p[p.length-1],v=m(h);if(f.has(h)){p.pop();continue}if(T.has(h)){if(n.get(h)===v.n)x.push([h,v]);else if((Fn?"production":void 0)!=="production"&&n.has(h))throw new Error("[Bug] invalidated atom exists");f.add(h),p.pop();continue}T.add(h);for(const k of hu(h,v,t))T.has(k)||p.push(k)}for(let h=x.length-1;h>=0;--h){const[v,k]=x[h];let A=!1;for(const E of k.d.keys())if(E!==v&&i.has(E)){A=!0;break}A&&(b(v),S(v)),n.delete(v)}}),b=u[3]||(x=>{var T;const f=m(x);if(lu(f)&&(t.has(x)&&n.get(x)!==f.n||Array.from(f.d).every(([I,V])=>b(I).n===V)))return f;f.d.clear();let p=!0;const h=()=>{t.has(x)&&(S(x),_(),g())},v=I=>{var V;if(ou(x,I)){const N=m(I);if(!lu(N))if(au(I))xr(I,I.init,m);else throw new Error("no atom init");return Ti(N)}const K=b(I);try{return Ti(K)}finally{f.d.set(I,K.n),cu(f.v)&&du(x,f.v,K),(V=t.get(I))==null||V.t.add(x),p||h()}};let k,A;const E={get signal(){return k||(k=new AbortController),k.signal},get setSelf(){return(Fn?"production":void 0)!=="production"&&!wr(x)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&wr(x)&&(A=(...I)=>{if((Fn?"production":void 0)!=="production"&&p&&console.warn("setSelf function cannot be called in sync"),!p)try{return y(x,...I)}finally{_(),g()}}),A}},P=f.n;try{const I=a(x,v,E);return xr(x,I,m),Ei(I)&&(uu(I,()=>k==null?void 0:k.abort()),I.then(h,h)),f}catch(I){return delete f.v,f.e=I,++f.n,f}finally{p=!1,P!==f.n&&n.get(x)===P&&(n.set(x,f.n),i.add(x),(T=r.c)==null||T.call(r,x))}}),w=u[4]||(x=>{const T=[x];for(;T.length;){const f=T.pop(),p=m(f);for(const h of hu(f,p,t)){const v=m(h);n.set(h,v.n),T.push(h)}}}),y=u[5]||((x,...T)=>{let f=!0;const p=v=>Ti(b(v)),h=(v,...k)=>{var A;const E=m(v);try{if(ou(x,v)){if(!au(v))throw new Error("atom not writable");const P=E.n,I=k[0];xr(v,I,m),S(v),P!==E.n&&(i.add(v),(A=r.c)==null||A.call(r,v),w(v));return}else return y(v,...k)}finally{f||(_(),g())}};try{return l(x,p,h,...T)}finally{f=!1}}),S=u[6]||(x=>{var T;const f=m(x),p=t.get(x);if(p&&!cu(f.v)){for(const[h,v]of f.d)if(!p.d.has(h)){const k=m(h);C(h).t.add(x),p.d.add(h),v!==k.n&&(i.add(h),(T=r.c)==null||T.call(r,h),w(h))}for(const h of p.d||[])if(!f.d.has(h)){p.d.delete(h);const v=R(h);v==null||v.t.delete(x)}}}),C=u[7]||(x=>{var T;const f=m(x);let p=t.get(x);if(!p){b(x);for(const h of f.d.keys())C(h).t.add(x);if(p={l:new Set,d:new Set(f.d.keys()),t:new Set},t.set(x,p),(T=r.m)==null||T.call(r,x),wr(x)){const h=()=>{let v=!0;const k=(...A)=>{try{return y(x,...A)}finally{v||(_(),g())}};try{const A=d(x,k);A&&(p.u=()=>{v=!0;try{A()}finally{v=!1}})}finally{v=!1}};s.add(h)}}return p}),R=u[8]||(x=>{var T;const f=m(x);let p=t.get(x);if(p&&!p.l.size&&!Array.from(p.t).some(h=>{var v;return(v=t.get(h))==null?void 0:v.d.has(x)})){p.u&&o.add(p.u),p=void 0,t.delete(x),(T=r.u)==null||T.call(r,x);for(const h of f.d.keys()){const v=R(h);v==null||v.t.delete(x)}return}return p}),M=[e,t,n,i,s,o,r,a,l,c,d,m,g,_,b,w,y,S,C,R],D={get:x=>Ti(b(x)),set:(x,...T)=>{try{return y(x,...T)}finally{_(),g()}},sub:(x,T)=>{const p=C(x).l;return p.add(T),g(),()=>{p.delete(T),R(x),g()}}};return Object.defineProperty(D,Jg,{value:M}),D},Qg=Zg,pu=uu,Cr={};let tv=0;function ev(e,t){const n=`atom${++tv}`,i={toString(){return(Cr?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return i.init=e,i.read=nv,i.write=iv,i}function nv(e){return e(this)}function iv(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}const sv=()=>{let e=0;const t=Qg({}),n=new WeakMap,i=new WeakMap,s=fu(n,i,void 0,void 0,void 0,void 0,t,void 0,(a,l,c,...d)=>e?c(a,...d):a.write(l,c,...d)),o=new Set;return t.m.add(void 0,a=>{o.add(a);const l=n.get(a);l.m=i.get(a)}),t.u.add(void 0,a=>{o.delete(a);const l=n.get(a);delete l.m}),Object.assign(s,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:a=>{const l={read:()=>null,write:(c,d)=>{++e;try{for(const[u,m]of a)"init"in u&&d(u,m)}finally{--e}}};s.set(l)}})};function rv(){return(Cr?"production":void 0)!=="production"?sv():fu()}let jn;function ov(){return jn||(jn=rv(),(Cr?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=jn),globalThis.__JOTAI_DEFAULT_STORE__!==jn&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),jn}const av={},lv=Ae(void 0);function mu(e){return wt(lv)||ov()}const Tr=e=>typeof(e==null?void 0:e.then)=="function",kr=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},cv=Uo.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(kr(e),e)}),Er=new WeakMap,gu=(e,t)=>{let n=Er.get(e);return n||(n=new Promise((i,s)=>{let o=e;const r=c=>d=>{o===c&&i(d)},a=c=>d=>{o===c&&s(d)},l=()=>{try{const c=t();Tr(c)?(Er.set(c,n),o=c,c.then(r(c),a(c)),pu(c,l)):i(c)}catch(c){s(c)}};e.then(r(e),a(e)),pu(e,l)}),Er.set(e,n)),n};function uv(e,t){const{delay:n,unstable_promiseStatus:i=!Uo.use}={},s=mu(),[[o,r,a],l]=wo(d=>{const u=s.get(e);return Object.is(d[0],u)&&d[1]===s&&d[2]===e?d:[u,s,e]},void 0,()=>[s.get(e),s,e]);let c=o;if((r!==s||a!==e)&&(l(),c=s.get(e)),zt(()=>{const d=s.sub(e,()=>{if(i)try{const u=s.get(e);Tr(u)&&kr(gu(u,()=>s.get(e)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[s,e,n,i]),vd(c),Tr(c)){const d=gu(c,()=>s.get(e));return i&&kr(d),cv(d)}return c}function dv(e,t){const n=mu();return Ji((...s)=>{if((av?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...s)},[n,e])}function hv(e,t){return[uv(e),dv(e)]}const fv=ev(!1),pv=()=>hv(fv),Ai=({children:e,className:t,onClick:n,tooltip:i})=>L("button",{title:i,onClick:n,className:Bn("w-8 h-8 rounded-full cursor-pointer text-white flex items-center justify-center",t),children:e}),vu=({call:e})=>{const[t,n]=pv(),i=()=>{n(o=>{const r=!o;return r?e.muteAudio():e.unmuteAudio(),r})},s=()=>{e.hangup()};return L("div",{className:"flex items-center justify-center gap-2",children:[L(Ai,{tooltip:t?"Unmute":"Mute",onClick:i,className:Bn(t?"bg-[#750000]":"bg-[#3C3C3C]"),children:t?L(Gg,{className:"w-5 h-5"}):L(Hg,{className:"w-5 h-5"})}),L(Ai,{tooltip:"End Call",onClick:s,className:"bg-[#750000]",children:L(Wg,{className:"w-4 h-4"})})]})},_u=({call:e,onExpand:t})=>L(On.div,{layoutId:Ci,className:"p-4 rounded-3xl w-[250px] overflow-hidden flex flex-col items-center justify-center bg-black text-white shadow-lg shadow-[#38383878] gap-3",children:[L(iu,{onClick:t,className:"h-[72px] cursor-pointer",stream:e.remoteStream}),L(Dc,{stream:e.remoteStream}),L("h1",{className:"text-xs",children:"Speak to interrupt"}),L(vu,{call:e})]});function mv({item:e}){const t=qt(null);return zt(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth"})},[]),L("li",{className:Bn("flex flex-col gap-1 text-left",{"items-end":e.role==="user"}),ref:t,children:[L("span",{className:"text-xs text-[#969696]",children:e.timestamp.toLocaleTimeString()}),L("p",{className:Bn("text-white text-sm",{"bg-[#222227] px-2.5 py-2 rounded-md":e.role==="user"}),children:e.content})]})}const gv=({transcript:e})=>L("div",{className:"h-[300px] sm:h-[386px] bg-[#38383C] rounded-t-3xl sm:rounded-3xl p-4 flex flex-col w-full",children:[L("ul",{className:"overflow-y-auto flex flex-col gap-4 p-4 flex-1",children:e.map((t,n)=>L(mv,{item:t},t.id+n))}),L("div",{className:"flex items-center h-8 bg-[#222227] rounded-full p-2 gap-2",children:[L("input",{type:"text",placeholder:"Type something here",className:"w-full outline-none text-sm"}),L(Ai,{tooltip:"Send",children:L(zg,{className:"text-[#969696] w-4 h-4"})})]})]});function vv({onCollapse:e}){return L("div",{className:"flex items-center justify-between w-full",children:L(Ai,{tooltip:"Collapse",className:"ml-auto",onClick:e,children:L(Kg,{})})})}const _v=({call:e,onCollapse:t,transcript:n})=>L(Df,{children:L(On.div,{exit:{opacity:0,scale:.95},initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},layoutId:"transcript-widget",className:"bg-black gap-3 w-full sm:w-[400px] text-white rounded-t-3xl sm:rounded-3xl shadow-lg shadow-[#38383878]",children:[L("div",{className:"p-4 text-center",children:[L(vv,{onCollapse:t}),L(iu,{className:"h-[144px]",stream:e.remoteStream}),L("h1",{className:"mb-4",children:"Speak or text to interrupt"}),L(vu,{call:e})]}),L(Dc,{stream:e.remoteStream}),L(gv,{transcript:n})]})});function Ar(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}function H(e,t,n,i){return new(n||(n=Promise))(function(s,o){function r(c){try{l(i.next(c))}catch(d){o(d)}}function a(c){try{l(i.throw(c))}catch(d){o(d)}}function l(c){var d;c.done?s(c.value):(d=c.value,d instanceof n?d:new n(function(u){u(d)})).then(r,a)}l((i=i.apply(e,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var yu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),yv=new Uint8Array(16);function bv(){if(!yu)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yu(yv)}for(var bu=[],Ii=0;Ii<256;++Ii)bu[Ii]=(Ii+256).toString(16).substr(1);function $n(e,t,n){var i=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||bv)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var o=0;o<16;++o)t[i+o]=s[o];return t||function(r,a){var l=0,c=bu;return[c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],"-",c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]],c[r[l++]]].join("")}(s)}var wv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wu(e,t){return e(t={exports:{}},t.exports),t.exports}var xv=wu(function(e){var t,n;t=wv,n=function(){var i=function(){},s="undefined",o=typeof window!==s&&typeof window.navigator!==s&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function a(w,y){var S=w[y];if(typeof S.bind=="function")return S.bind(w);try{return Function.prototype.bind.call(S,w)}catch{return function(){return Function.prototype.apply.apply(S,[w,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(w,y){for(var S=0;S<r.length;S++){var C=r[S];this[C]=S<w?i:this.methodFactory(C,w,y)}this.log=this.debug}function d(w,y,S){return function(){typeof console!==s&&(c.call(this,y,S),this[w].apply(this,arguments))}}function u(w,y,S){return function(C){return C==="debug"&&(C="log"),typeof console!==s&&(C==="trace"&&o?l:console[C]!==void 0?a(console,C):console.log!==void 0?a(console,"log"):i)}(w)||d.apply(this,arguments)}function m(w,y,S){var C,R=this;y=y??"WARN";var M="loglevel";function D(){var T;if(typeof window!==s&&M){try{T=window.localStorage[M]}catch{}if(typeof T===s)try{var f=window.document.cookie,p=f.indexOf(encodeURIComponent(M)+"=");p!==-1&&(T=/^([^;]+)/.exec(f.slice(p))[1])}catch{}return R.levels[T]===void 0&&(T=void 0),T}}typeof w=="string"?M+=":"+w:typeof w=="symbol"&&(M=void 0),R.name=w,R.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},R.methodFactory=S||u,R.getLevel=function(){return C},R.setLevel=function(T,f){if(typeof T=="string"&&R.levels[T.toUpperCase()]!==void 0&&(T=R.levels[T.toUpperCase()]),!(typeof T=="number"&&T>=0&&T<=R.levels.SILENT))throw"log.setLevel() called with invalid level: "+T;if(C=T,f!==!1&&function(p){var h=(r[p]||"silent").toUpperCase();if(typeof window!==s&&M){try{return void(window.localStorage[M]=h)}catch{}try{window.document.cookie=encodeURIComponent(M)+"="+h+";"}catch{}}}(T),c.call(R,T,w),typeof console===s&&T<R.levels.SILENT)return"No console available for logging"},R.setDefaultLevel=function(T){y=T,D()||R.setLevel(T,!1)},R.resetLevel=function(){R.setLevel(y,!1),function(){if(typeof window!==s&&M){try{return void window.localStorage.removeItem(M)}catch{}try{window.document.cookie=encodeURIComponent(M)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}()},R.enableAll=function(T){R.setLevel(R.levels.TRACE,T)},R.disableAll=function(T){R.setLevel(R.levels.SILENT,T)};var x=D();x==null&&(x=y),R.setLevel(x,!1)}var g=new m,_={};g.getLogger=function(w){if(typeof w!="symbol"&&typeof w!="string"||w==="")throw new TypeError("You must supply a name when creating a logger.");var y=_[w];return y||(y=_[w]=new m(w,g.getLevel(),g.methodFactory)),y};var b=typeof window!==s?window.log:void 0;return g.noConflict=function(){return typeof window!==s&&window.log===g&&(window.log=b),g},g.getLoggers=function(){return _},g.default=g,g},e.exports?e.exports=n():t.log=n()});const B=xv.getLogger("telnyx"),Sv=B.methodFactory;B.methodFactory=(e,t,n)=>{const i=Sv(e,t,n);return function(){const s=[new Date().toISOString().replace("T"," ").replace("Z",""),"-"];for(let o=0;o<arguments.length;o++)s.push(arguments[o]);i.apply(void 0,s)}},B.setLevel(B.getLevel());const xu="Time to call invite",Su="wss://rtc.telnyx.com",Cv={urls:"stun:stun.telnyx.com:3478"},Tv={urls:"turn:turn.telnyx.com:3478?transport=tcp",username:"testuser",credential:"testpassword"};var F;(function(e){e.SocketOpen="telnyx.socket.open",e.SocketClose="telnyx.socket.close",e.SocketError="telnyx.socket.error",e.SocketMessage="telnyx.socket.message",e.SpeedTest="telnyx.internal.speedtest",e.Ready="telnyx.ready",e.Error="telnyx.error",e.Notification="telnyx.notification",e.StatsFrame="telnyx.stats.frame",e.StatsReport="telnyx.stats.report",e.Messages="telnyx.messages",e.Calls="telnyx.calls",e.MediaError="telnyx.rtc.mediaError"})(F||(F={}));const Cu=e=>Object.keys(e).length===0,Ri=e=>{const[t,n,i,s,o,r]=e;let a={};try{a=JSON.parse(o.replace(/ID"/g,'Id"'))}catch{B.warn("Verto LA invalid media JSON string:",o)}return{participantId:Number(t),participantNumber:n,participantName:i,codec:s,media:a,participantData:r}},Tu=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},sn=e=>e instanceof Function||typeof e=="function",Un=e=>typeof document=="object"&&"getElementById"in document?typeof e=="string"?document.getElementById(e)||null:typeof e=="function"?e():e instanceof HTMLMediaElement?e:null:null,kv=/^(ws|wss):\/\//,ku=(e,t=null)=>{const{result:n={},error:i}=e;if(i)return{error:i};const{result:s=null}=n;if(s===null)return t!==null&&(n.node_id=t),{result:n};const{code:o=null,node_id:r=null,result:a=null}=s;return o&&o!=="200"?{error:s}:a?ku(a,r):{result:s}},Eu=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),Ir=({login:e,passwd:t,password:n,login_token:i})=>!!(e&&(t||n)||i),Pi=({anonymous_login:e})=>!!e&&!!e.target_id&&!!e.target_type,Rr=e=>{var t,n,i,s,o,r;let a="",l="";return!((n=(t=e==null?void 0:e.result)===null||t===void 0?void 0:t.params)===null||n===void 0)&&n.state&&(a=(s=(i=e==null?void 0:e.result)===null||i===void 0?void 0:i.params)===null||s===void 0?void 0:s.state),!((o=e==null?void 0:e.params)===null||o===void 0)&&o.state&&(l=(r=e==null?void 0:e.params)===null||r===void 0?void 0:r.state),a||l};function Au({debounceTime:e}){let t,n;return{promise:new Promise((i,s)=>{t=e?Ev(i,e):i,n=s}),resolve:t,reject:n}}const Ev=(e,t)=>{let n;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>{e(...i)},t)}},rn="GLOBAL",Lt={},Gn=(e,t)=>`${e}|${t}`,Iu=(e,t=rn)=>Gn(e,t)in Lt,on=(e,t,n=rn)=>{const i=Gn(e,n);i in Lt||(Lt[i]=[]),Lt[i].push(t)},Ru=(e,t,n=rn)=>{const i=function(s){an(e,i,n),t(s)};return i.prototype.targetRef=t,on(e,i,n)},an=(e,t,n=rn)=>{if(!Iu(e,n))return!1;const i=Gn(e,n);if(sn(t))for(let s=Lt[i].length-1;s>=0;s--){const o=Lt[i][s];(t===o||o.prototype&&t===o.prototype.targetRef)&&Lt[i].splice(s,1)}else Lt[i]=[];return Lt[i].length===0&&delete Lt[i],!0},J=(e,t,n=rn,i=!0)=>{const s=i&&n!==rn;if(!Iu(e,n))return s&&J(e,t),!1;const o=Gn(e,n),r=Lt[o].length;if(!r)return s&&J(e,t),!1;for(let a=r-1;a>=0;a--)Lt[o][a](t);return s&&J(e,t),!0},Pr=e=>{const t=Gn(e,"");Object.keys(Lt).filter(n=>n.indexOf(t)===0).forEach(n=>delete Lt[n])};var Dt,xe,nt;(function(e){e.Offer="offer",e.Answer="answer"})(Dt||(Dt={})),function(e){e.Inbound="inbound",e.Outbound="outbound"}(xe||(xe={})),function(e){e.Invite="telnyx_rtc.invite",e.Attach="telnyx_rtc.attach",e.Answer="telnyx_rtc.answer",e.Info="telnyx_rtc.info",e.Display="telnyx_rtc.display",e.Media="telnyx_rtc.media",e.Event="telnyx_rtc.event",e.Bye="telnyx_rtc.bye",e.Punt="telnyx_rtc.punt",e.Broadcast="telnyx_rtc.broadcast",e.Subscribe="telnyx_rtc.subscribe",e.Unsubscribe="telnyx_rtc.unsubscribe",e.ClientReady="telnyx_rtc.clientReady",e.Modify="telnyx_rtc.modify",e.Ringing="telnyx_rtc.ringing",e.GatewayState="telnyx_rtc.gatewayState",e.Ping="telnyx_rtc.ping",e.Pong="telnyx_rtc.pong"}(nt||(nt={}));const se={generic:"event",[nt.Display]:"participantData",[nt.Attach]:"participantData",conferenceUpdate:"conferenceUpdate",callUpdate:"callUpdate",vertoClientReady:"vertoClientReady",userMediaError:"userMediaError"},Av={destinationNumber:"",remoteCallerName:"Outbound Call",remoteCallerNumber:"",callerName:"",callerNumber:"",audio:!0,video:!1,useStereo:!1,debug:!1,debugOutput:"socket",attach:!1,screenShare:!1,userVariables:{},mediaSettings:{useSdpASBandwidthKbps:!1,sdpASBandwidthKbps:0}};var X,Hn,At,re,It;(function(e){e[e.New=0]="New",e[e.Requesting=1]="Requesting",e[e.Trying=2]="Trying",e[e.Recovering=3]="Recovering",e[e.Ringing=4]="Ringing",e[e.Answering=5]="Answering",e[e.Early=6]="Early",e[e.Active=7]="Active",e[e.Held=8]="Held",e[e.Hangup=9]="Hangup",e[e.Destroy=10]="Destroy",e[e.Purge=11]="Purge"})(X||(X={})),function(e){e.Participant="participant",e.Moderator="moderator"}(Hn||(Hn={})),function(e){e.Join="join",e.Leave="leave",e.Bootstrap="bootstrap",e.Add="add",e.Modify="modify",e.Delete="delete",e.Clear="clear",e.ChatMessage="chatMessage",e.LayerInfo="layerInfo",e.LogoInfo="logoInfo",e.LayoutInfo="layoutInfo",e.LayoutList="layoutList",e.ModCmdResponse="modCommandResponse"}(At||(At={})),function(e){e.Video="videoinput",e.AudioIn="audioinput",e.AudioOut="audiooutput"}(re||(re={})),function(e){e.REGED="REGED",e.UNREGED="UNREGED",e.NOREG="NOREG",e.FAILED="FAILED",e.FAIL_WAIT="FAIL_WAIT",e.REGISTER="REGISTER",e.TRYING="TRYING",e.EXPIRED="EXPIRED",e.UNREGISTER="UNREGISTER"}(It||(It={}));const Mr="telnyx-voice-sdk-id";function Lr(){return sessionStorage.getItem(Mr)}typeof window<"u"&&window.addEventListener("beforeunload",()=>{sessionStorage.removeItem(Mr)});let Iv=typeof WebSocket<"u"?WebSocket:null;const Rv=0,Pv=1,Mv=2,Lv=3;class Pu{constructor(t){this.session=t,this.previousGatewayState="",this._wsClient=null,this._host=Su,this._timers={},this.upDur=null,this.downDur=null;const{host:n,env:i,region:s}=t.options;i&&(this._host=i==="development"?"wss://rtcdev.telnyx.com":Su),n&&(this._host=(o=>`${kv.test(o)?"":"wss://"}${o}`)(n)),s&&(this._host=this._host.replace(/rtc(dev)?/,`${s}.rtc$1`))}get connected(){return this._wsClient&&this._wsClient.readyState===Pv}get connecting(){return this._wsClient&&this._wsClient.readyState===Rv}get closing(){return this._wsClient&&this._wsClient.readyState===Mv}get closed(){return this._wsClient&&this._wsClient.readyState===Lv}get isAlive(){return this.connecting||this.connected}get isDead(){return this.closing||this.closed}connect(){const t=new URL(this._host),n=Lr();n&&t.searchParams.set("voice_sdk_id",n),this._wsClient=new Iv(t.toString()),this._wsClient.onopen=i=>J(F.SocketOpen,i,this.session.uuid),this._wsClient.onclose=i=>J(F.SocketClose,i,this.session.uuid),this._wsClient.onerror=i=>J(F.SocketError,{error:i,sessionId:this.session.sessionid},this.session.uuid),this._wsClient.onmessage=i=>{var s,o;const r=Tu(i.data);var a;if(typeof r!="string"){if(r.voice_sdk_id&&(a=r.voice_sdk_id,sessionStorage.setItem(Mr,a)),this._unsetTimer(r.id),B.debug(`RECV:
77
77
  `,JSON.stringify(r,null,2),`
78
78
  `),It[`${(o=(s=r==null?void 0:r.result)===null||s===void 0?void 0:s.params)===null||o===void 0?void 0:o.state}`]||!J(r.id,r)){const l=Rr(r);J(F.SocketMessage,r,this.session.uuid),l&&(this.previousGatewayState=l)}}else this._handleStringResponse(r)}}sendRawText(t){this._wsClient.send(t)}send(t){const{request:n}=t,i=new Promise((s,o)=>{if(n.hasOwnProperty("result"))return s();Ru(n.id,r=>{const{result:a,error:l}=ku(r);return l?o(l):s(a)})});return B.debug(`SEND:
79
79
  `,JSON.stringify(n,null,2),`
@@ -93,4 +93,4 @@ b=`+c+":"+d+`\r
93
93
  `),void this._requestAnotherLocalDescription();(i=(n=this.peer)===null||n===void 0?void 0:n.instance)===null||i===void 0||i.removeEventListener("icecandidate",this._onIce);let r=null;const a={sessid:this.session.sessionid,sdp:s,dialogParams:this.options,"User-Agent":`Web-${e_}`};switch(o){case Dt.Offer:this.setState(X.Requesting),r=new jv(a);break;case Dt.Answer:this.setState(X.Answering),r=this.options.attach===!0?new Uv(a):new $v(a);break;default:return B.error(`${this.id} - Unknown local SDP type:`,t),this.hangup({},!1)}this._execute(r).then(l=>{const{node_id:c=null}=l;this._targetNodeId=c,o===Dt.Offer?this.setState(X.Trying):this.setState(X.Active)}).catch(l=>{B.error(`${this.id} - Sending ${o} error:`,l),this.hangup()}),console.timeEnd(xu)}_onIce(t){const{instance:n}=this.peer;this._iceTimeout===null&&(this._iceTimeout=setTimeout(()=>this._onIceSdp(n.localDescription),1e3)),t.candidate?B.debug("RTCPeer Candidate:",t.candidate):this._onIceSdp(n.localDescription)}_registerPeerEvents(){const{instance:t}=this.peer;this._iceDone=!1,t.onicecandidate=n=>{this._iceDone||this._onIce(n)},t.addEventListener("addstream",n=>{this.options.remoteStream=n.stream}),t.addEventListener("track",n=>{this.options.remoteStream=n.streams[0];const{remoteElement:i,remoteStream:s,screenShare:o}=this.options;o===!1&&Di(i,s)})}_onMediaError(t){this._dispatchNotification({type:se.userMediaError,error:t}),this.hangup({},!1)}_dispatchConferenceUpdate(t){this._dispatchNotification(Object.assign({type:se.conferenceUpdate,call:this},t))}_dispatchNotification(t){this.options.screenShare!==!0&&(J(F.Notification,t,this.id,!1)||J(F.Notification,t,this.session.uuid))}_execute(t){return this.nodeId&&(t.targetNodeId=this.nodeId),this.session.execute(t)}_init(){const{id:t,userVariables:n,remoteCallerNumber:i,onNotification:s}=this.options;t||(this.options.id=$n()),this.id=this.options.id,n&&!Cu(n)||(this.options.userVariables=this.session.options.userVariables||{}),i||(this.options.remoteCallerNumber=this.options.destinationNumber),this.session.calls[this.id]=this,on(F.MediaError,this._onMediaError,this.id),sn(s)&&on(F.Notification,s.bind(this),this.id),this.setState(X.New),B.info("New Call with Options:",this.options)}_finalize(){this._stopStats(),this.peer&&this.peer.instance&&(this.peer.instance.close(),this.peer=null);const{remoteStream:t,localStream:n}=this.options;Wn(t),Wn(n),an(F.MediaError,null,this.id),this.session.calls[this.id]=null,delete this.session.calls[this.id]}_startStats(t){this._statsIntervalId=setInterval(this._doStats,t),B.info("Stats started")}_stopStats(){this._statsIntervalId&&(clearInterval(this._statsIntervalId),this._statsIntervalId=null),B.info("Stats stopped")}}Ju.setStateTelnyx=e=>{if(e){switch(e._state){case X.Requesting:case X.Recovering:case X.Trying:case X.Early:e.state="connecting";break;case X.Active:e.state="active";break;case X.Held:e.state="held";break;case X.Hangup:case X.Destroy:e.state="done";break;case X.Answering:e.state="ringing";break;case X.New:e.state="new"}return e}};class Oe extends Ju{constructor(){super(...arguments),this._statsInterval=null}hangup(t={},n=!0){this.screenShare instanceof Oe&&this.screenShare.hangup(t,n),super.hangup(t,n)}startScreenShare(t){return H(this,void 0,void 0,function*(){const n=yield(i={video:!0},navigator.mediaDevices.getDisplayMedia(i));var i;n.getTracks().forEach(c=>{c.addEventListener("ended",()=>{this.screenShare&&this.screenShare.hangup()})});const{remoteCallerName:s,remoteCallerNumber:o,callerName:r,callerNumber:a}=this.options,l=Object.assign({screenShare:!0,localStream:n,destinationNumber:`${this.extension}-screen`,remoteCallerName:s,remoteCallerNumber:`${o}-screen`,callerName:`${r} (Screen)`,callerNumber:`${a} (Screen)`},t);return this.screenShare=new Oe(this.session,l),this.screenShare.invite(),this.screenShare})}stopScreenShare(){this.screenShare instanceof Oe&&this.screenShare.hangup()}setAudioOutDevice(t){return H(this,void 0,void 0,function*(){this.options.speakerId=t;const{remoteElement:n,speakerId:i}=this.options;return!(!n||!i)&&Du(n,i)})}_finalize(){this._stats(!1),super._finalize()}_stats(t=!0){if(t===!1)return clearInterval(this._statsInterval);B.setLevel(2),this._statsInterval=window.setInterval(()=>H(this,void 0,void 0,function*(){const n=yield this.peer.instance.getStats(null);let i="";const s=["certificate","codec","peer-connection","stream","local-candidate","remote-candidate"],o=["id","type","timestamp"];n.forEach(r=>{s.includes(r.type)||(i+=`
94
94
  ${r.type}
95
95
  `,Object.keys(r).forEach(a=>{o.includes(a)||(i+=` ${a}: ${r[a]}
96
- `)}))}),B.info(i)}),2e3)}}class n_ extends Ov{constructor(t){super(t),this.calls={},this.autoRecoverCalls=!0,this._iceServers=[],this._localElement=null,this._remoteElement=null,this._jwtAuth=!0,this._audioConstraints=!0,this._videoConstraints=!1,this._speaker=null,this.iceServers=t.iceServers,this.ringtoneFile=t.ringtoneFile,this.ringbackFile=t.ringbackFile}get reconnectDelay(){return 1e3}connect(){const t=Object.create(null,{connect:{get:()=>super.connect}});return H(this,void 0,void 0,function*(){t.connect.call(this)})}checkPermissions(t=!0,n=!0){return H(this,void 0,void 0,function*(){try{const i=yield Oi({audio:t,video:n});return Wn(i),!0}catch{return!1}})}logout(){this.disconnect()}disconnect(){const t=Object.create(null,{disconnect:{get:()=>super.disconnect}});return H(this,void 0,void 0,function*(){Object.keys(this.calls).forEach(n=>this.calls[n].setState(X.Purge)),this.calls={},yield t.disconnect.call(this)})}speedTest(t){return new Promise((n,i)=>{if(Ru(F.SpeedTest,r=>{const{upDur:a,downDur:l}=r,c=l?8*t/(l/1e3)/1024:0;n({upDur:a,downDur:l,upKps:(a?8*t/(a/1e3)/1024:0).toFixed(0),downKps:c.toFixed(0)})},this.uuid),!(t=Number(t)))return i(`Invalid parameter 'bytes': ${t}`);this.executeRaw(`#SPU ${t}`);let s=t/1024;t%1024&&s++;const o=".".repeat(1024);for(let r=0;r<s;r++)this.executeRaw(`#SPB ${o}`);this.executeRaw("#SPE")})}getDevices(){return zn().catch(t=>(J(F.MediaError,t,this.uuid),[]))}getVideoDevices(){return zn(re.Video).catch(t=>(J(F.MediaError,t,this.uuid),[]))}getAudioInDevices(){return zn(re.AudioIn).catch(t=>(J(F.MediaError,t,this.uuid),[]))}getAudioOutDevices(){return zn(re.AudioOut).catch(t=>(console.error("getAudioOutDevices",t),J(F.MediaError,t,this.uuid),[]))}validateDeviceId(t,n,i){return Vi(t,n,i)}getDeviceResolutions(t){return H(this,void 0,void 0,function*(){try{return yield(n=>H(void 0,void 0,void 0,function*(){const i=[],s=yield Oi({video:{deviceId:{exact:n}}}),o=s.getVideoTracks()[0];for(let r=0;r<Ou.length;r++){const[a,l]=Ou[r];(yield o.applyConstraints({width:{exact:a},height:{exact:l}}).then(()=>!0).catch(()=>!1))&&i.push({resolution:`${a}x${l}`,width:a,height:l})}return Wn(s),i}))(t)}catch(n){throw n}})}get mediaConstraints(){return{audio:this._audioConstraints,video:this._videoConstraints}}setAudioSettings(t){return H(this,void 0,void 0,function*(){if(!t)throw new Error("You need to provide the settings object");const{micId:n,micLabel:i}=t,s=Ar(t,["micId","micLabel"]);return Vu(s),this._audioConstraints=yield Nu(n,i,"audioinput",s),this.micId=n,this.micLabel=i,this._audioConstraints})}disableMicrophone(){this._audioConstraints=!1}enableMicrophone(){this._audioConstraints=!0}setVideoSettings(t){return H(this,void 0,void 0,function*(){if(!t)throw new Error("You need to provide the settings object");const{camId:n,camLabel:i}=t,s=Ar(t,["camId","camLabel"]);return Vu(s),this._videoConstraints=yield Nu(n,i,"videoinput",s),this.camId=n,this.camLabel=i,this._videoConstraints})}disableWebcam(){this._videoConstraints=!1}enableWebcam(){this._videoConstraints=!0}set iceServers(t){const n={urls:["stun:stun.l.google.com:19302"]};this._iceServers=typeof t=="boolean"?t?[n]:[]:t||[Tv,Cv,n]}get iceServers(){return this._iceServers}set speaker(t){this._speaker=t}get speaker(){return this._speaker}set localElement(t){this._localElement=Un(t)}get localElement(){return this._localElement}set remoteElement(t){this._remoteElement=Un(t)}get remoteElement(){return this._remoteElement}vertoBroadcast({nodeId:t,channel:n="",data:i}){if(!n)throw new Error(`Invalid channel for broadcast: ${n}`);const s=new Hv({sessid:this.sessionid,eventChannel:n,data:i});t&&(s.targetNodeId=t),this.execute(s).catch(o=>o)}vertoSubscribe({nodeId:t,channels:n=[],handler:i}){return H(this,void 0,void 0,function*(){if(!(n=n.filter(l=>l&&!this._existsSubscription(this.relayProtocol,l))).length)return{};const s=new Wv({sessid:this.sessionid,eventChannel:n});t&&(s.targetNodeId=t);const o=yield this.execute(s),{unauthorized:r=[],subscribed:a=[]}=Vr(o);return r.length&&r.forEach(l=>this._removeSubscription(this.relayProtocol,l)),a.forEach(l=>this._addSubscription(this.relayProtocol,i,l)),o})}vertoUnsubscribe({nodeId:t,channels:n=[]}){return H(this,void 0,void 0,function*(){if(!(n=n.filter(a=>a&&this._existsSubscription(this.relayProtocol,a))).length)return{};const i=new zv({sessid:this.sessionid,eventChannel:n});t&&(i.targetNodeId=t);const s=yield this.execute(i),{unsubscribed:o=[],notSubscribed:r=[]}=Vr(s);return o.forEach(a=>this._removeSubscription(this.relayProtocol,a)),r.forEach(a=>this._removeSubscription(this.relayProtocol,a)),s})}static telnyxStateCall(t){return Oe.setStateTelnyx(t)}}class Qu{constructor(t,n){this.code=n,this.message=t}}class i_ extends Ot{constructor(){super(),this.method=nt.Ping,this.buildRequest({method:this.method,params:{}})}}class Gt{constructor(t){this.session=t}_ack(t,n){const i=new Fv(t,n);this.nodeId&&(i.targetNodeId=this.nodeId),this.session.execute(i)}reconnectDelay(){return 1e3*Eu(2,6)}handleMessage(t){const{session:n}=this,{id:i,method:s,params:o={}}=t,r=o==null?void 0:o.callID,a=o==null?void 0:o.eventChannel,l=o==null?void 0:o.eventType,c=s===nt.Attach;if(l==="channelPvtData")return this._handlePvtEvent(o.pvtData);if(r&&n.calls.hasOwnProperty(r)){if(!c)return n.calls[r].handleMessage(t),void this._ack(i,s);n.calls[r].hangup({},!1)}const d=()=>{var g,_,b,w;const y={id:r,remoteSdp:o.sdp,destinationNumber:o.callee_id_number,remoteCallerName:o.caller_id_name,remoteCallerNumber:o.caller_id_number,callerName:o.callee_id_name,callerNumber:o.callee_id_number,attach:c,mediaSettings:o.mediaSettings,debug:(g=n.options.debug)!==null&&g!==void 0&&g,debugOutput:(_=n.options.debugOutput)!==null&&_!==void 0?_:"socket",prefetchIceCandidates:(b=n.options.prefetchIceCandidates)!==null&&b!==void 0&&b,forceRelayCandidate:(w=n.options.forceRelayCandidate)!==null&&w!==void 0&&w};o.telnyx_call_control_id&&(y.telnyxCallControlId=o.telnyx_call_control_id),o.telnyx_session_id&&(y.telnyxSessionId=o.telnyx_session_id),o.telnyx_leg_id&&(y.telnyxLegId=o.telnyx_leg_id),o.client_state&&(y.clientState=o.client_state),o.dialogParams&&o.dialogParams.custom_headers&&o.dialogParams.custom_headers.length&&(y.customHeaders=o.dialogParams.custom_headers);const S=new Oe(n,y);return S.nodeId=this.nodeId,S},u=new Lu,m=new i_;switch(s){case nt.Ping:this.session.execute(m);break;case nt.Punt:n.disconnect();break;case nt.Invite:{const b=d();b.playRingtone(),b.setState(X.Ringing),b.direction=xe.Inbound,this._ack(i,s);break}case nt.Attach:{const b=d();this.session.autoRecoverCalls?b.answer():b.setState(X.Recovering),b.handleMessage(t);break}case nt.Event:case"webrtc.event":if(!a)return void B.error("Verto received an unknown event:",o);const g=n.relayProtocol,_=a.split(".")[0];n._existsSubscription(g,a)?J(g,o,a):a===n.sessionid?this._handleSessionEvent(o.eventData):n._existsSubscription(g,_)?J(g,o,_):n.calls.hasOwnProperty(a)?n.calls[a].handleMessage(t):J(F.Notification,o,n.uuid);break;case nt.Info:o.type=se.generic,J(F.Notification,o,n.uuid);break;case nt.ClientReady:this.session.execute(u);break;default:{const b=Rr(t);if(b){switch(b){case It.REGISTER:case It.REGED:n.connection.previousGatewayState!==It.REGED&&n.connection.previousGatewayState!==It.REGISTER&&(Gt.retriedRegister=0,o.type=se.vertoClientReady,J(F.Ready,o,n.uuid));break;case It.UNREGED:case It.NOREG:if(Gt.retriedRegister+=1,Gt.retriedRegister===5){Gt.retriedRegister=0,J(F.Error,{error:new Qu("Fail to register the user, the server tried 5 times","UNREGED|NOREG"),sessionId:n.sessionid},n.uuid);break}setTimeout(()=>{this.session.execute(u)},this.reconnectDelay());break;case It.FAILED:case It.FAIL_WAIT:if(n.connection.previousGatewayState!==It.FAILED&&n.connection.previousGatewayState!==It.FAIL_WAIT){if(!this.session.hasAutoReconnect()){Gt.retriedConnect=0,J(F.Error,{error:new Qu("Fail to connect the server, the server tried 5 times","FAILED|FAIL_WAIT"),sessionId:n.sessionid},n.uuid);break}if(Gt.retriedConnect+=1,Gt.retriedConnect===5){Gt.retriedConnect=0,J(F.Error,{error:new Error("Connection Retry Failed"),sessionId:n.sessionid},n.uuid);break}setTimeout(()=>{this.session.disconnect().then(()=>{this.session.clearConnection(),this.session.connect()})},this.reconnectDelay())}break;default:B.warn("GatewayState message unknown method:",t)}break}B.warn("Verto message unknown method:",t);break}}}_retrieveCallId(t,n){const i=Object.keys(this.session.calls);if(t.action!=="bootObj")return i.find(s=>this.session.calls[s].channels.includes(n));{const s=t.data.find(o=>i.includes(o[0]));if(s instanceof Array)return s[0]}}_handlePvtEvent(t){return H(this,void 0,void 0,function*(){const{session:n}=this,i=n.relayProtocol,{action:s,laChannel:o,laName:r,chatChannel:a,infoChannel:l,modChannel:c,conferenceMemberID:d,role:u,callID:m}=t;switch(s){case"conference-liveArray-join":{const g=()=>{n.vertoBroadcast({nodeId:this.nodeId,channel:o,data:{liveArray:{command:"bootstrap",context:o,name:r}}})},_={nodeId:this.nodeId,channels:[o],handler:({data:w})=>{const y=m||this._retrieveCallId(w,o);if(y&&n.calls.hasOwnProperty(y)){const S=n.calls[y];S._addChannel(o),S.extension=r,S.handleConferenceUpdate(w,t).then(C=>{C==="INVALID_PACKET"&&g()})}}},b=yield n.vertoSubscribe(_).catch(w=>{B.error("liveArray subscription error:",w)});Ni(b,o)&&g();break}case"conference-liveArray-part":{let g=null;if(o&&n._existsSubscription(i,o)){const{callId:b=null}=n.subscriptions[i][o];if(g=n.calls[b]||null,b!==null){const w={type:se.conferenceUpdate,action:At.Leave,conferenceName:r,participantId:Number(d),role:u};J(F.Notification,w,b,!1)||J(F.Notification,w,n.uuid),g===null&&an(F.Notification,null,b)}}const _=[o,a,l,c];n.vertoUnsubscribe({nodeId:this.nodeId,channels:_}).then(({unsubscribedChannels:b=[]})=>{g&&(g.channels=g.channels.filter(w=>!b.includes(w)))}).catch(b=>{B.error("liveArray unsubscribe error:",b)});break}}})}_handleSessionEvent(t){switch(t.contentType){case"layout-info":case"layer-info":Xu(this.session,t);break;case"logo-info":{const n={type:se.conferenceUpdate,action:At.LogoInfo,logo:t.logoURL};J(F.Notification,n,this.session.uuid);break}}}}Gt.retriedConnect=0,Gt.retriedRegister=0;class s_ extends Ot{constructor(t,n,i,s={},o){super(),this.method="anonymous_login";const r={target_type:t,target_id:n,userVariables:s,reconnection:o,"User-Agent":{sdkVersion:Nr,data:navigator.userAgent}};i&&(r.sessid=i),this.buildRequest({method:this.method,params:r})}}class r_ extends n_{constructor(t){super(t),this.relayProtocol="verto-protocol",this.timeoutErrorCode=-329990,this.handleLoginOnSocketOpen=()=>H(this,void 0,void 0,function*(){this._idle=!1;const{login:n,password:i,passwd:s,login_token:o,userVariables:r,autoReconnect:a=!0}=this.options,l=new Bv(n,i||s,o,this.sessionid,r,!!Lr()),c=yield this.execute(l).catch(this._handleLoginError);c&&(this._autoReconnect=a,this.sessionid=c.sessid)}),this.handleAnonymousLoginOnSocketOpen=()=>H(this,void 0,void 0,function*(){this._idle=!1;const{anonymous_login:n}=this.options,{target_type:i,target_id:s}=n,o=new s_(i,s,this.sessionid,this.options.userVariables,!!Lr()),r=yield this.execute(o).catch(this._handleLoginError);r&&(this.sessionid=r.sessid)}),window.addEventListener("beforeunload",n=>{this.calls&&Object.keys(this.calls).forEach(i=>{this.calls[i]&&this.calls[i].hangup({},!0)})})}validateOptions(){return Ir(this.options)||Pi(this.options)}newCall(t){if(!this.validateCallOptions(t))throw new Error("Verto.newCall() error: destinationNumber is required.");console.time(xu);const n=new Oe(this,t);return n.invite(),n}broadcast(t){return this.vertoBroadcast(t)}subscribe(t){return this.vertoSubscribe(t)}unsubscribe(t){return this.vertoUnsubscribe(t)}validateCallOptions(t){return!!Pi(this.options)||!!t.destinationNumber}_onSocketOpen(){return H(this,void 0,void 0,function*(){return Ir(this.options)?this.handleLoginOnSocketOpen():Pi(this.options)?this.handleAnonymousLoginOnSocketOpen():void 0})}_onSocketMessage(t){new Gt(this).handleMessage(t)}}class o_ extends r_{constructor(t){super(t),console.log(`SDK version: ${qu}`)}newCall(t){return super.newCall(t)}static webRTCInfo(){return Nv()}static webRTCSupportedBrowserList(){return[{operationSystem:"Android",supported:[{browserName:"Chrome",features:["audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",supported:vt.not_supported},{browserName:"Edge",supported:vt.not_supported}]},{operationSystem:"iOS",supported:[{browserName:"Chrome",supported:vt.not_supported},{browserName:"Firefox",supported:vt.not_supported},{browserName:"Safari",features:["video","audio"],supported:vt.full},{browserName:"Edge",supported:vt.not_supported}]},{operationSystem:"Linux",supported:[{browserName:"Chrome",features:["video","audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",supported:vt.not_supported},{browserName:"Edge",supported:vt.not_supported}]},{operationSystem:"MacOS",supported:[{browserName:"Chrome",features:["video","audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",features:["video","audio"],supported:vt.full},{browserName:"Edge",features:["audio"],supported:vt.partial}]},{operationSystem:"Windows",supported:[{browserName:"Chrome",features:["video","audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",supported:vt.not_supported},{browserName:"Edge",features:["audio"],supported:vt.partial}]}]}}function a_(e){if(!e||typeof e!="object")return!1;const t=e;return t.method==="ai_conversation"&&typeof t.params=="object"}function l_(e){if(!e||typeof e!="object")return!1;const t=e;return t.params.type!=="response.text.delta"?!1:!!t.params.delta}function c_(e){if(!e||typeof e!="object")return!1;const t=e;return t.params.type!=="conversation.item.created"?!1:!!t.params.item.content}function u_(e){return l_(e)?{id:e.params.item_id,role:"assistant",content:e.params.delta,timestamp:new Date}:null}function d_(e){return!c_(e)||e.params.item.role!=="user"||e.params.item.status!=="completed"?null:{id:e.params.item.id,role:e.params.item.role,content:e.params.item.content.map(t=>t.transcript).join(" "),timestamp:new Date}}function h_(e){const[t,n]=ge([]);return zt(()=>{if(!e)return;const i=s=>{if(a_(s))switch(s.params.type){case"response.text.delta":{n(o=>{const r=u_(s);return r?[...o,r]:o});return}case"conversation.item.created":{const o=d_(s);o&&n(r=>[...r,o]);return}}};return e.on(F.SocketMessage,i),()=>{e.off(F.SocketMessage,i)}},[e]),t}const f_=({call:e,client:t})=>{const[n,i]=ge("collapsed"),s=()=>i("expanded"),o=()=>i("collapsed"),r=h_(t);switch(n){case"collapsed":return L(_u,{onExpand:s,call:e,client:t});case"expanded":return L(_v,{transcript:r,onCollapse:o,call:e});default:return L(_u,{onExpand:s,call:e,client:t})}},Fr=()=>L(On.div,{layoutId:Ci,className:"bg-black gap-3 text-white w-[240px] max-w-full rounded-4xl p-4 text-center flex items-center justify-center flex-col shadow-lg shadow-[#38383878]",children:L("div",{className:"animate-spin rounded-full",children:L(Ug,{})})}),p_=({call:e,client:t})=>{switch(e==null?void 0:e.state){case"new":case"trying":case"requesting":return L(Fr,{});case"done":case"purged":case"destroy":return null;case"active":return L(f_,{client:t,call:e});default:return L(Fr,{})}},m_=(e,t)=>{const[n,i]=ge(null);return zt(()=>{if(!e)return;const s=new o_({env:t||"production",anonymous_login:{target_id:e,target_type:"ai_assistant"}});i(s)},[e,t]),n},g_=(e,{onReady:t,onNotification:n,onError:i})=>(zt(()=>{if(e)return e.connect().then().catch(console.error),e.on(F.Ready,t),e.on(F.Notification,n),e.on(F.Error,i),()=>{e.off(F.Ready,t),e.off(F.Notification,n),e.off(F.Error,i),e.disconnect()}},[e]),null),v_=({className:e})=>L("svg",{className:e,width:"236",height:"211",viewBox:"0 0 236 211",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[L("g",{clipPath:"url(#:R5lfm:)",children:[L("path",{d:"M231.927 194.514C235.881 187.393 237.006 179.067 235.083 171.168C234.531 168.984 233.769 166.858 232.806 164.819C232.502 164.15 232.156 163.501 231.771 162.874L200.418 104.252H168.341L201.143 165.69C202.172 167.475 202.714 169.496 202.714 171.552C202.714 173.608 202.172 175.628 201.143 177.414C200.139 179.082 198.715 180.464 197.01 181.424C195.305 182.385 193.378 182.89 191.416 182.892H154.009C153.595 188.612 151.801 194.15 148.776 199.041C145.751 203.931 141.584 208.033 136.625 211H205.385C209.975 210.698 214.443 209.405 218.475 207.211C224.164 204.438 228.859 200.007 231.927 194.514Z",fill:"currentColor"}),L("path",{d:"M56.0698 65.9049H88.1473L104.134 36.466C105.487 33.9253 107.515 31.7984 109.999 30.3146C112.484 28.8309 115.331 28.0467 118.233 28.0467C121.135 28.0467 123.982 28.8309 126.466 30.3146C128.951 31.7984 130.979 33.9253 132.331 36.466L147.853 65.9049H179.93L157.166 23.3081C153.391 16.2702 147.751 10.3822 140.851 6.27586C133.951 2.16956 126.052 0 118 0C109.948 0 102.049 2.16956 95.1487 6.27586C88.2488 10.3822 82.6089 16.2702 78.8345 23.3081L56.0698 65.9049Z",fill:"currentColor"}),L("path",{d:"M81.9387 99.1324C82.275 93.4362 83.9987 87.9051 86.9627 83.0107C89.9266 78.1164 94.0429 74.0041 98.9604 71.0247H36.875V99.1324H81.9387Z",fill:"currentColor"}),L("path",{d:"M87.0591 101.18V177.977H101.649C104.692 177.944 107.64 176.924 110.041 175.075C112.443 173.226 114.165 170.648 114.946 167.738C115.26 166.621 115.416 165.467 115.411 164.308V118.229C115.425 113.227 117.432 108.432 120.997 104.885C124.561 101.338 129.396 99.3264 134.451 99.286H199.382V71.0247H117.481C109.408 71.0382 101.67 74.2213 95.9663 79.8751C90.2626 85.5289 87.0591 93.1914 87.0591 101.18Z",fill:"currentColor"}),L("path",{d:"M3.1927 164.819C2.23008 166.858 1.46775 168.984 0.916237 171.168C-1.00574 179.084 0.119328 187.425 4.07225 194.565C7.14854 200.039 11.8422 204.452 17.5241 207.211C21.5555 209.405 26.0233 210.698 30.6138 211H117.999C126.232 211 134.128 207.764 139.949 202.003C145.771 196.242 149.042 188.428 149.042 180.281V104.201H134.245C130.607 104.294 127.148 105.782 124.6 108.352C122.051 110.922 120.611 114.372 120.586 117.973V164.051C120.572 169.053 118.555 173.845 114.976 177.377C111.397 180.909 106.549 182.892 101.495 182.892H44.8417C42.8798 182.89 40.9521 182.385 39.2471 181.424C37.5421 180.464 36.1182 179.082 35.1149 177.414C34.0855 175.619 33.5443 173.59 33.5443 171.526C33.5443 169.462 34.0855 167.434 35.1149 165.638L67.9167 104.201H35.5806L4.22746 162.823C3.86529 163.539 3.50313 164.154 3.1927 164.819Z",fill:"currentColor"})]}),L("defs",{children:L("clipPath",{id:":R5lfm:",children:L("rect",{width:"236",height:"211",fill:"currentColor"})})})]}),__=({client:e})=>{const t=()=>{var s;if(!e){console.error("Client is not initialized.");return}const n=(s=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:s.codecs,i=n==null?void 0:n.find(o=>o.mimeType.toLowerCase().includes("opus"));e.newCall({destinationNumber:"xxx",preferred_codecs:[i]})};return L(On.button,{layoutId:Ci,onClick:t,className:"bg-black cursor-pointer text-white px-4 py-2 rounded-full flex items-center text-xl font-medium shadow-lg",children:[L(v_,{className:"w-8 h-8 mr-2"}),"Let's Talk"]})},y_='@layer components;/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--color-green-400:oklch(79.2% .209 151.711);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--radius-md:.375rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--radius-4xl:2rem;--animate-spin:spin 1s linear infinite;--blur-xs:4px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.static{position:static}.inset-0{inset:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.right-0{right:calc(var(--spacing)*0)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.z-10{z-index:10}.z-\\[9999\\]{z-index:9999}.mt-2{margin-top:calc(var(--spacing)*2)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-auto{margin-left:auto}.flex{display:flex}.hidden{display:none}.inline-flex{display:inline-flex}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-8{height:calc(var(--spacing)*8)}.h-\\[72px\\]{height:72px}.h-\\[144px\\]{height:144px}.h-\\[240px\\]{height:240px}.min-h-\\[180px\\]{min-height:180px}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-8{width:calc(var(--spacing)*8)}.w-\\[200px\\]{width:200px}.w-\\[240px\\]{width:240px}.w-\\[250px\\]{width:250px}.w-\\[344px\\]{width:344px}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-\\[\\#3D3D46\\]>:not(:last-child)){border-color:#3d3d46}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-4xl{border-radius:var(--radius-4xl)}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-t-3xl{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl)}.border-solid{--tw-border-style:solid;border-style:solid}.bg-\\[\\#3C3C3C\\]{background-color:#3c3c3c}.bg-\\[\\#38383C96\\]{background-color:#38383c96}.bg-\\[\\#38383C\\]{background-color:#38383c}.bg-\\[\\#222227\\]{background-color:#222227}.bg-\\[\\#750000\\]{background-color:#750000}.bg-black{background-color:var(--color-black)}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.text-center{text-align:center}.text-left{text-align:left}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-\\[\\#969696\\]{color:#969696}.text-green-400{color:var(--color-green-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.underline{text-decoration-line:underline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[\\#38383878\\]{--tw-shadow-color:#38383878}@supports (color:color-mix(in lab,red,red)){.shadow-\\[\\#38383878\\]{--tw-shadow-color:color-mix(in oklab,#38383878 var(--tw-shadow-alpha),transparent)}}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (min-width:40rem){.sm\\:h-\\[320px\\]{height:320px}.sm\\:w-\\[400px\\]{width:400px}.sm\\:rounded-3xl{border-radius:var(--radius-3xl)}}@media (min-width:48rem){.md\\:right-10{right:calc(var(--spacing)*10)}.md\\:bottom-10{bottom:calc(var(--spacing)*10)}}}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:#888;background-clip:content-box;border:2px solid #0000;border-radius:4px}::-webkit-scrollbar-thumb:hover{background-color:#555}html{scrollbar-width:thin;scrollbar-color:#888 transparent}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}',b_=({children:e})=>L("main",{className:"fixed inset-0 z-[9999] pointer-events-none",children:L("div",{className:"absolute bottom-0 right-0 md:bottom-10 md:right-10 pointer-events-auto",children:e})}),w_={duration:.1,ease:"circOut"},x_=({children:e,position:t="fixed"})=>L(Bf,{transition:w_,children:[L("style",{children:y_}),t==="fixed"?L(b_,{children:e}):e]}),S_=e=>L(On.div,{layoutId:Ci,className:"bg-black rounded-2xl p-4 flex flex-col items-center justify-center text-white w-[344px] max-w-full",children:[L($g,{className:"w-8 h-8 text-red-400"}),L("h1",{className:"text-2xl font-medium mt-2 mb-4",children:"An error occurred"}),L("ul",{className:"list-disc ml-4 text-sm gap-4",children:[L("li",{children:"Failed to initialize the Telnyx AI Agent client. Please check your agent ID and ensure that you are connected to the internet."}),L("li",{children:["Make sure that the"," ",L("a",{href:`https://portal.telnyx.com/#/ai/assistants/edit/${e.agentId}?tab=telephony`,className:"font-medium text-green-400 underline inline-flex items-center gap-1",target:"_blank",rel:"noopener noreferrer",children:["Support Unauthenticated Web Calls"," ",L(qg,{className:"w-4 h-4"})]})," ","option is enabled in your Telnyx agent settings."]})]})]});function C_({"agent-id":e,environment:t,position:n="fixed"}){const i=m_(e,t),[s,o]=ge(null),[r,a]=ge(!0),[l,c]=ge(!1);return g_(i,{onReady:()=>a(!1),onNotification:_=>{var b;if(((b=_.call)==null?void 0:b.state)==="destroy")return o(null);o(_)},onError:()=>{a(!1),c(!0)}}),L(x_,{position:n,children:e?l?L(S_,{agentId:e}):r?L(Fr,{}):s!=null&&s.call?L(p_,{call:s.call,client:i}):L(__,{client:i}):L("div",{children:"Please provide an assistant ID."})})}gd(C_,"telnyx-ai-agent",Vg,{shadow:!0})})();
96
+ `)}))}),B.info(i)}),2e3)}}class n_ extends Ov{constructor(t){super(t),this.calls={},this.autoRecoverCalls=!0,this._iceServers=[],this._localElement=null,this._remoteElement=null,this._jwtAuth=!0,this._audioConstraints=!0,this._videoConstraints=!1,this._speaker=null,this.iceServers=t.iceServers,this.ringtoneFile=t.ringtoneFile,this.ringbackFile=t.ringbackFile}get reconnectDelay(){return 1e3}connect(){const t=Object.create(null,{connect:{get:()=>super.connect}});return H(this,void 0,void 0,function*(){t.connect.call(this)})}checkPermissions(t=!0,n=!0){return H(this,void 0,void 0,function*(){try{const i=yield Oi({audio:t,video:n});return Wn(i),!0}catch{return!1}})}logout(){this.disconnect()}disconnect(){const t=Object.create(null,{disconnect:{get:()=>super.disconnect}});return H(this,void 0,void 0,function*(){Object.keys(this.calls).forEach(n=>this.calls[n].setState(X.Purge)),this.calls={},yield t.disconnect.call(this)})}speedTest(t){return new Promise((n,i)=>{if(Ru(F.SpeedTest,r=>{const{upDur:a,downDur:l}=r,c=l?8*t/(l/1e3)/1024:0;n({upDur:a,downDur:l,upKps:(a?8*t/(a/1e3)/1024:0).toFixed(0),downKps:c.toFixed(0)})},this.uuid),!(t=Number(t)))return i(`Invalid parameter 'bytes': ${t}`);this.executeRaw(`#SPU ${t}`);let s=t/1024;t%1024&&s++;const o=".".repeat(1024);for(let r=0;r<s;r++)this.executeRaw(`#SPB ${o}`);this.executeRaw("#SPE")})}getDevices(){return zn().catch(t=>(J(F.MediaError,t,this.uuid),[]))}getVideoDevices(){return zn(re.Video).catch(t=>(J(F.MediaError,t,this.uuid),[]))}getAudioInDevices(){return zn(re.AudioIn).catch(t=>(J(F.MediaError,t,this.uuid),[]))}getAudioOutDevices(){return zn(re.AudioOut).catch(t=>(console.error("getAudioOutDevices",t),J(F.MediaError,t,this.uuid),[]))}validateDeviceId(t,n,i){return Vi(t,n,i)}getDeviceResolutions(t){return H(this,void 0,void 0,function*(){try{return yield(n=>H(void 0,void 0,void 0,function*(){const i=[],s=yield Oi({video:{deviceId:{exact:n}}}),o=s.getVideoTracks()[0];for(let r=0;r<Ou.length;r++){const[a,l]=Ou[r];(yield o.applyConstraints({width:{exact:a},height:{exact:l}}).then(()=>!0).catch(()=>!1))&&i.push({resolution:`${a}x${l}`,width:a,height:l})}return Wn(s),i}))(t)}catch(n){throw n}})}get mediaConstraints(){return{audio:this._audioConstraints,video:this._videoConstraints}}setAudioSettings(t){return H(this,void 0,void 0,function*(){if(!t)throw new Error("You need to provide the settings object");const{micId:n,micLabel:i}=t,s=Ar(t,["micId","micLabel"]);return Vu(s),this._audioConstraints=yield Nu(n,i,"audioinput",s),this.micId=n,this.micLabel=i,this._audioConstraints})}disableMicrophone(){this._audioConstraints=!1}enableMicrophone(){this._audioConstraints=!0}setVideoSettings(t){return H(this,void 0,void 0,function*(){if(!t)throw new Error("You need to provide the settings object");const{camId:n,camLabel:i}=t,s=Ar(t,["camId","camLabel"]);return Vu(s),this._videoConstraints=yield Nu(n,i,"videoinput",s),this.camId=n,this.camLabel=i,this._videoConstraints})}disableWebcam(){this._videoConstraints=!1}enableWebcam(){this._videoConstraints=!0}set iceServers(t){const n={urls:["stun:stun.l.google.com:19302"]};this._iceServers=typeof t=="boolean"?t?[n]:[]:t||[Tv,Cv,n]}get iceServers(){return this._iceServers}set speaker(t){this._speaker=t}get speaker(){return this._speaker}set localElement(t){this._localElement=Un(t)}get localElement(){return this._localElement}set remoteElement(t){this._remoteElement=Un(t)}get remoteElement(){return this._remoteElement}vertoBroadcast({nodeId:t,channel:n="",data:i}){if(!n)throw new Error(`Invalid channel for broadcast: ${n}`);const s=new Hv({sessid:this.sessionid,eventChannel:n,data:i});t&&(s.targetNodeId=t),this.execute(s).catch(o=>o)}vertoSubscribe({nodeId:t,channels:n=[],handler:i}){return H(this,void 0,void 0,function*(){if(!(n=n.filter(l=>l&&!this._existsSubscription(this.relayProtocol,l))).length)return{};const s=new Wv({sessid:this.sessionid,eventChannel:n});t&&(s.targetNodeId=t);const o=yield this.execute(s),{unauthorized:r=[],subscribed:a=[]}=Vr(o);return r.length&&r.forEach(l=>this._removeSubscription(this.relayProtocol,l)),a.forEach(l=>this._addSubscription(this.relayProtocol,i,l)),o})}vertoUnsubscribe({nodeId:t,channels:n=[]}){return H(this,void 0,void 0,function*(){if(!(n=n.filter(a=>a&&this._existsSubscription(this.relayProtocol,a))).length)return{};const i=new zv({sessid:this.sessionid,eventChannel:n});t&&(i.targetNodeId=t);const s=yield this.execute(i),{unsubscribed:o=[],notSubscribed:r=[]}=Vr(s);return o.forEach(a=>this._removeSubscription(this.relayProtocol,a)),r.forEach(a=>this._removeSubscription(this.relayProtocol,a)),s})}static telnyxStateCall(t){return Oe.setStateTelnyx(t)}}class Qu{constructor(t,n){this.code=n,this.message=t}}class i_ extends Ot{constructor(){super(),this.method=nt.Ping,this.buildRequest({method:this.method,params:{}})}}class Gt{constructor(t){this.session=t}_ack(t,n){const i=new Fv(t,n);this.nodeId&&(i.targetNodeId=this.nodeId),this.session.execute(i)}reconnectDelay(){return 1e3*Eu(2,6)}handleMessage(t){const{session:n}=this,{id:i,method:s,params:o={}}=t,r=o==null?void 0:o.callID,a=o==null?void 0:o.eventChannel,l=o==null?void 0:o.eventType,c=s===nt.Attach;if(l==="channelPvtData")return this._handlePvtEvent(o.pvtData);if(r&&n.calls.hasOwnProperty(r)){if(!c)return n.calls[r].handleMessage(t),void this._ack(i,s);n.calls[r].hangup({},!1)}const d=()=>{var g,_,b,w;const y={id:r,remoteSdp:o.sdp,destinationNumber:o.callee_id_number,remoteCallerName:o.caller_id_name,remoteCallerNumber:o.caller_id_number,callerName:o.callee_id_name,callerNumber:o.callee_id_number,attach:c,mediaSettings:o.mediaSettings,debug:(g=n.options.debug)!==null&&g!==void 0&&g,debugOutput:(_=n.options.debugOutput)!==null&&_!==void 0?_:"socket",prefetchIceCandidates:(b=n.options.prefetchIceCandidates)!==null&&b!==void 0&&b,forceRelayCandidate:(w=n.options.forceRelayCandidate)!==null&&w!==void 0&&w};o.telnyx_call_control_id&&(y.telnyxCallControlId=o.telnyx_call_control_id),o.telnyx_session_id&&(y.telnyxSessionId=o.telnyx_session_id),o.telnyx_leg_id&&(y.telnyxLegId=o.telnyx_leg_id),o.client_state&&(y.clientState=o.client_state),o.dialogParams&&o.dialogParams.custom_headers&&o.dialogParams.custom_headers.length&&(y.customHeaders=o.dialogParams.custom_headers);const S=new Oe(n,y);return S.nodeId=this.nodeId,S},u=new Lu,m=new i_;switch(s){case nt.Ping:this.session.execute(m);break;case nt.Punt:n.disconnect();break;case nt.Invite:{const b=d();b.playRingtone(),b.setState(X.Ringing),b.direction=xe.Inbound,this._ack(i,s);break}case nt.Attach:{const b=d();this.session.autoRecoverCalls?b.answer():b.setState(X.Recovering),b.handleMessage(t);break}case nt.Event:case"webrtc.event":if(!a)return void B.error("Verto received an unknown event:",o);const g=n.relayProtocol,_=a.split(".")[0];n._existsSubscription(g,a)?J(g,o,a):a===n.sessionid?this._handleSessionEvent(o.eventData):n._existsSubscription(g,_)?J(g,o,_):n.calls.hasOwnProperty(a)?n.calls[a].handleMessage(t):J(F.Notification,o,n.uuid);break;case nt.Info:o.type=se.generic,J(F.Notification,o,n.uuid);break;case nt.ClientReady:this.session.execute(u);break;default:{const b=Rr(t);if(b){switch(b){case It.REGISTER:case It.REGED:n.connection.previousGatewayState!==It.REGED&&n.connection.previousGatewayState!==It.REGISTER&&(Gt.retriedRegister=0,o.type=se.vertoClientReady,J(F.Ready,o,n.uuid));break;case It.UNREGED:case It.NOREG:if(Gt.retriedRegister+=1,Gt.retriedRegister===5){Gt.retriedRegister=0,J(F.Error,{error:new Qu("Fail to register the user, the server tried 5 times","UNREGED|NOREG"),sessionId:n.sessionid},n.uuid);break}setTimeout(()=>{this.session.execute(u)},this.reconnectDelay());break;case It.FAILED:case It.FAIL_WAIT:if(n.connection.previousGatewayState!==It.FAILED&&n.connection.previousGatewayState!==It.FAIL_WAIT){if(!this.session.hasAutoReconnect()){Gt.retriedConnect=0,J(F.Error,{error:new Qu("Fail to connect the server, the server tried 5 times","FAILED|FAIL_WAIT"),sessionId:n.sessionid},n.uuid);break}if(Gt.retriedConnect+=1,Gt.retriedConnect===5){Gt.retriedConnect=0,J(F.Error,{error:new Error("Connection Retry Failed"),sessionId:n.sessionid},n.uuid);break}setTimeout(()=>{this.session.disconnect().then(()=>{this.session.clearConnection(),this.session.connect()})},this.reconnectDelay())}break;default:B.warn("GatewayState message unknown method:",t)}break}B.warn("Verto message unknown method:",t);break}}}_retrieveCallId(t,n){const i=Object.keys(this.session.calls);if(t.action!=="bootObj")return i.find(s=>this.session.calls[s].channels.includes(n));{const s=t.data.find(o=>i.includes(o[0]));if(s instanceof Array)return s[0]}}_handlePvtEvent(t){return H(this,void 0,void 0,function*(){const{session:n}=this,i=n.relayProtocol,{action:s,laChannel:o,laName:r,chatChannel:a,infoChannel:l,modChannel:c,conferenceMemberID:d,role:u,callID:m}=t;switch(s){case"conference-liveArray-join":{const g=()=>{n.vertoBroadcast({nodeId:this.nodeId,channel:o,data:{liveArray:{command:"bootstrap",context:o,name:r}}})},_={nodeId:this.nodeId,channels:[o],handler:({data:w})=>{const y=m||this._retrieveCallId(w,o);if(y&&n.calls.hasOwnProperty(y)){const S=n.calls[y];S._addChannel(o),S.extension=r,S.handleConferenceUpdate(w,t).then(C=>{C==="INVALID_PACKET"&&g()})}}},b=yield n.vertoSubscribe(_).catch(w=>{B.error("liveArray subscription error:",w)});Ni(b,o)&&g();break}case"conference-liveArray-part":{let g=null;if(o&&n._existsSubscription(i,o)){const{callId:b=null}=n.subscriptions[i][o];if(g=n.calls[b]||null,b!==null){const w={type:se.conferenceUpdate,action:At.Leave,conferenceName:r,participantId:Number(d),role:u};J(F.Notification,w,b,!1)||J(F.Notification,w,n.uuid),g===null&&an(F.Notification,null,b)}}const _=[o,a,l,c];n.vertoUnsubscribe({nodeId:this.nodeId,channels:_}).then(({unsubscribedChannels:b=[]})=>{g&&(g.channels=g.channels.filter(w=>!b.includes(w)))}).catch(b=>{B.error("liveArray unsubscribe error:",b)});break}}})}_handleSessionEvent(t){switch(t.contentType){case"layout-info":case"layer-info":Xu(this.session,t);break;case"logo-info":{const n={type:se.conferenceUpdate,action:At.LogoInfo,logo:t.logoURL};J(F.Notification,n,this.session.uuid);break}}}}Gt.retriedConnect=0,Gt.retriedRegister=0;class s_ extends Ot{constructor(t,n,i,s={},o){super(),this.method="anonymous_login";const r={target_type:t,target_id:n,userVariables:s,reconnection:o,"User-Agent":{sdkVersion:Nr,data:navigator.userAgent}};i&&(r.sessid=i),this.buildRequest({method:this.method,params:r})}}class r_ extends n_{constructor(t){super(t),this.relayProtocol="verto-protocol",this.timeoutErrorCode=-329990,this.handleLoginOnSocketOpen=()=>H(this,void 0,void 0,function*(){this._idle=!1;const{login:n,password:i,passwd:s,login_token:o,userVariables:r,autoReconnect:a=!0}=this.options,l=new Bv(n,i||s,o,this.sessionid,r,!!Lr()),c=yield this.execute(l).catch(this._handleLoginError);c&&(this._autoReconnect=a,this.sessionid=c.sessid)}),this.handleAnonymousLoginOnSocketOpen=()=>H(this,void 0,void 0,function*(){this._idle=!1;const{anonymous_login:n}=this.options,{target_type:i,target_id:s}=n,o=new s_(i,s,this.sessionid,this.options.userVariables,!!Lr()),r=yield this.execute(o).catch(this._handleLoginError);r&&(this.sessionid=r.sessid)}),window.addEventListener("beforeunload",n=>{this.calls&&Object.keys(this.calls).forEach(i=>{this.calls[i]&&this.calls[i].hangup({},!0)})})}validateOptions(){return Ir(this.options)||Pi(this.options)}newCall(t){if(!this.validateCallOptions(t))throw new Error("Verto.newCall() error: destinationNumber is required.");console.time(xu);const n=new Oe(this,t);return n.invite(),n}broadcast(t){return this.vertoBroadcast(t)}subscribe(t){return this.vertoSubscribe(t)}unsubscribe(t){return this.vertoUnsubscribe(t)}validateCallOptions(t){return!!Pi(this.options)||!!t.destinationNumber}_onSocketOpen(){return H(this,void 0,void 0,function*(){return Ir(this.options)?this.handleLoginOnSocketOpen():Pi(this.options)?this.handleAnonymousLoginOnSocketOpen():void 0})}_onSocketMessage(t){new Gt(this).handleMessage(t)}}class o_ extends r_{constructor(t){super(t),console.log(`SDK version: ${qu}`)}newCall(t){return super.newCall(t)}static webRTCInfo(){return Nv()}static webRTCSupportedBrowserList(){return[{operationSystem:"Android",supported:[{browserName:"Chrome",features:["audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",supported:vt.not_supported},{browserName:"Edge",supported:vt.not_supported}]},{operationSystem:"iOS",supported:[{browserName:"Chrome",supported:vt.not_supported},{browserName:"Firefox",supported:vt.not_supported},{browserName:"Safari",features:["video","audio"],supported:vt.full},{browserName:"Edge",supported:vt.not_supported}]},{operationSystem:"Linux",supported:[{browserName:"Chrome",features:["video","audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",supported:vt.not_supported},{browserName:"Edge",supported:vt.not_supported}]},{operationSystem:"MacOS",supported:[{browserName:"Chrome",features:["video","audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",features:["video","audio"],supported:vt.full},{browserName:"Edge",features:["audio"],supported:vt.partial}]},{operationSystem:"Windows",supported:[{browserName:"Chrome",features:["video","audio"],supported:vt.full},{browserName:"Firefox",features:["audio"],supported:vt.partial},{browserName:"Safari",supported:vt.not_supported},{browserName:"Edge",features:["audio"],supported:vt.partial}]}]}}function a_(e){if(!e||typeof e!="object")return!1;const t=e;return t.method==="ai_conversation"&&typeof t.params=="object"}function l_(e){if(!e||typeof e!="object")return!1;const t=e;return t.params.type!=="response.text.delta"?!1:!!t.params.delta}function c_(e){if(!e||typeof e!="object")return!1;const t=e;return t.params.type!=="conversation.item.created"?!1:!!t.params.item.content}function u_(e){return l_(e)?{id:e.params.item_id,role:"assistant",content:e.params.delta,timestamp:new Date}:null}function d_(e){return!c_(e)||e.params.item.role!=="user"||e.params.item.status!=="completed"?null:{id:e.params.item.id,role:e.params.item.role,content:e.params.item.content.map(t=>t.transcript).join(" "),timestamp:new Date}}function h_(e){const[t,n]=ge([]);return zt(()=>{if(!e)return;const i=s=>{if(a_(s))switch(s.params.type){case"response.text.delta":{n(o=>{const r=u_(s);return r?[...o,r]:o});return}case"conversation.item.created":{const o=d_(s);o&&n(r=>[...r,o]);return}}};return e.on(F.SocketMessage,i),()=>{e.off(F.SocketMessage,i)}},[e]),t}const f_=({call:e,client:t})=>{const[n,i]=ge("collapsed"),s=()=>i("expanded"),o=()=>i("collapsed"),r=h_(t);switch(n){case"collapsed":return L(_u,{onExpand:s,call:e,client:t});case"expanded":return L(_v,{transcript:r,onCollapse:o,call:e});default:return L(_u,{onExpand:s,call:e,client:t})}},Fr=()=>L(On.div,{layoutId:Ci,className:"bg-black gap-3 text-white w-[240px] max-w-full rounded-4xl p-4 text-center flex items-center justify-center flex-col shadow-lg shadow-[#38383878]",children:L("div",{className:"animate-spin rounded-full",children:L(Ug,{})})}),p_=({call:e,client:t})=>{switch(e==null?void 0:e.state){case"new":case"trying":case"requesting":return L(Fr,{});case"done":case"purged":case"destroy":return null;case"active":return L(f_,{client:t,call:e});default:return L(Fr,{})}},m_=(e,t)=>{const[n,i]=ge(null);return zt(()=>{if(!e)return;const s=new o_({env:t||"production",anonymous_login:{target_id:e,target_type:"ai_assistant"}});i(s)},[e,t]),n},g_=(e,{onReady:t,onNotification:n,onError:i})=>(zt(()=>{if(e)return e.connect().then().catch(console.error),e.on(F.Ready,t),e.on(F.Notification,n),e.on(F.Error,i),()=>{e.off(F.Ready,t),e.off(F.Notification,n),e.off(F.Error,i),e.disconnect()}},[e]),null),v_=({className:e})=>L("svg",{className:e,width:"236",height:"211",viewBox:"0 0 236 211",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[L("g",{clipPath:"url(#:R5lfm:)",children:[L("path",{d:"M231.927 194.514C235.881 187.393 237.006 179.067 235.083 171.168C234.531 168.984 233.769 166.858 232.806 164.819C232.502 164.15 232.156 163.501 231.771 162.874L200.418 104.252H168.341L201.143 165.69C202.172 167.475 202.714 169.496 202.714 171.552C202.714 173.608 202.172 175.628 201.143 177.414C200.139 179.082 198.715 180.464 197.01 181.424C195.305 182.385 193.378 182.89 191.416 182.892H154.009C153.595 188.612 151.801 194.15 148.776 199.041C145.751 203.931 141.584 208.033 136.625 211H205.385C209.975 210.698 214.443 209.405 218.475 207.211C224.164 204.438 228.859 200.007 231.927 194.514Z",fill:"currentColor"}),L("path",{d:"M56.0698 65.9049H88.1473L104.134 36.466C105.487 33.9253 107.515 31.7984 109.999 30.3146C112.484 28.8309 115.331 28.0467 118.233 28.0467C121.135 28.0467 123.982 28.8309 126.466 30.3146C128.951 31.7984 130.979 33.9253 132.331 36.466L147.853 65.9049H179.93L157.166 23.3081C153.391 16.2702 147.751 10.3822 140.851 6.27586C133.951 2.16956 126.052 0 118 0C109.948 0 102.049 2.16956 95.1487 6.27586C88.2488 10.3822 82.6089 16.2702 78.8345 23.3081L56.0698 65.9049Z",fill:"currentColor"}),L("path",{d:"M81.9387 99.1324C82.275 93.4362 83.9987 87.9051 86.9627 83.0107C89.9266 78.1164 94.0429 74.0041 98.9604 71.0247H36.875V99.1324H81.9387Z",fill:"currentColor"}),L("path",{d:"M87.0591 101.18V177.977H101.649C104.692 177.944 107.64 176.924 110.041 175.075C112.443 173.226 114.165 170.648 114.946 167.738C115.26 166.621 115.416 165.467 115.411 164.308V118.229C115.425 113.227 117.432 108.432 120.997 104.885C124.561 101.338 129.396 99.3264 134.451 99.286H199.382V71.0247H117.481C109.408 71.0382 101.67 74.2213 95.9663 79.8751C90.2626 85.5289 87.0591 93.1914 87.0591 101.18Z",fill:"currentColor"}),L("path",{d:"M3.1927 164.819C2.23008 166.858 1.46775 168.984 0.916237 171.168C-1.00574 179.084 0.119328 187.425 4.07225 194.565C7.14854 200.039 11.8422 204.452 17.5241 207.211C21.5555 209.405 26.0233 210.698 30.6138 211H117.999C126.232 211 134.128 207.764 139.949 202.003C145.771 196.242 149.042 188.428 149.042 180.281V104.201H134.245C130.607 104.294 127.148 105.782 124.6 108.352C122.051 110.922 120.611 114.372 120.586 117.973V164.051C120.572 169.053 118.555 173.845 114.976 177.377C111.397 180.909 106.549 182.892 101.495 182.892H44.8417C42.8798 182.89 40.9521 182.385 39.2471 181.424C37.5421 180.464 36.1182 179.082 35.1149 177.414C34.0855 175.619 33.5443 173.59 33.5443 171.526C33.5443 169.462 34.0855 167.434 35.1149 165.638L67.9167 104.201H35.5806L4.22746 162.823C3.86529 163.539 3.50313 164.154 3.1927 164.819Z",fill:"currentColor"})]}),L("defs",{children:L("clipPath",{id:":R5lfm:",children:L("rect",{width:"236",height:"211",fill:"currentColor"})})})]}),__=({client:e})=>{const t=()=>{var s;if(!e){console.error("Client is not initialized.");return}const n=(s=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:s.codecs,i=n==null?void 0:n.find(o=>o.mimeType.toLowerCase().includes("opus"));e.newCall({destinationNumber:"xxx",preferred_codecs:[i]})};return L(On.button,{layoutId:Ci,onClick:t,className:"bg-black cursor-pointer text-white px-4 py-2 rounded-full flex items-center text-xl font-medium shadow-lg",children:[L(v_,{className:"w-8 h-8 mr-2"}),"Let's Talk"]})},y_='@layer components;/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--color-green-400:oklch(79.2% .209 151.711);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--radius-md:.375rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--radius-4xl:2rem;--animate-spin:spin 1s linear infinite;--blur-xs:4px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.static{position:static}.inset-0{inset:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.right-0{right:calc(var(--spacing)*0)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.z-10{z-index:10}.z-\\[9999\\]{z-index:9999}.mt-2{margin-top:calc(var(--spacing)*2)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-auto{margin-left:auto}.flex{display:flex}.hidden{display:none}.inline-flex{display:inline-flex}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-8{height:calc(var(--spacing)*8)}.h-\\[72px\\]{height:72px}.h-\\[144px\\]{height:144px}.h-\\[300px\\]{height:300px}.min-h-\\[180px\\]{min-height:180px}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-8{width:calc(var(--spacing)*8)}.w-\\[200px\\]{width:200px}.w-\\[240px\\]{width:240px}.w-\\[250px\\]{width:250px}.w-\\[344px\\]{width:344px}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-\\[\\#3D3D46\\]>:not(:last-child)){border-color:#3d3d46}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-4xl{border-radius:var(--radius-4xl)}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-t-3xl{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl)}.border-solid{--tw-border-style:solid;border-style:solid}.bg-\\[\\#3C3C3C\\]{background-color:#3c3c3c}.bg-\\[\\#38383C96\\]{background-color:#38383c96}.bg-\\[\\#38383C\\]{background-color:#38383c}.bg-\\[\\#222227\\]{background-color:#222227}.bg-\\[\\#750000\\]{background-color:#750000}.bg-black{background-color:var(--color-black)}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.text-center{text-align:center}.text-left{text-align:left}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-\\[\\#969696\\]{color:#969696}.text-green-400{color:var(--color-green-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.underline{text-decoration-line:underline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[\\#38383878\\]{--tw-shadow-color:#38383878}@supports (color:color-mix(in lab,red,red)){.shadow-\\[\\#38383878\\]{--tw-shadow-color:color-mix(in oklab,#38383878 var(--tw-shadow-alpha),transparent)}}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (min-width:40rem){.sm\\:h-\\[386px\\]{height:386px}.sm\\:w-\\[400px\\]{width:400px}.sm\\:rounded-3xl{border-radius:var(--radius-3xl)}}@media (min-width:48rem){.md\\:right-10{right:calc(var(--spacing)*10)}.md\\:bottom-10{bottom:calc(var(--spacing)*10)}}}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:#888;background-clip:content-box;border:2px solid #0000;border-radius:4px}::-webkit-scrollbar-thumb:hover{background-color:#555}html{scrollbar-width:thin;scrollbar-color:#888 transparent}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}',b_=({children:e})=>L("main",{className:"fixed inset-0 z-[9999] pointer-events-none",children:L("div",{className:"absolute bottom-0 right-0 md:bottom-10 md:right-10 pointer-events-auto",children:e})}),w_={duration:.1,ease:"circOut"},x_=({children:e,position:t="fixed"})=>L(Bf,{transition:w_,children:[L("style",{children:y_}),t==="fixed"?L(b_,{children:e}):e]}),S_=e=>L(On.div,{layoutId:Ci,className:"bg-black rounded-2xl p-4 flex flex-col items-center justify-center text-white w-[344px] max-w-full",children:[L($g,{className:"w-8 h-8 text-red-400"}),L("h1",{className:"text-2xl font-medium mt-2 mb-4",children:"An error occurred"}),L("ul",{className:"list-disc ml-4 text-sm gap-4",children:[L("li",{children:"Failed to initialize the Telnyx AI Agent client. Please check your agent ID and ensure that you are connected to the internet."}),L("li",{children:["Make sure that the"," ",L("a",{href:`https://portal.telnyx.com/#/ai/assistants/edit/${e.agentId}?tab=telephony`,className:"font-medium text-green-400 underline inline-flex items-center gap-1",target:"_blank",rel:"noopener noreferrer",children:["Support Unauthenticated Web Calls"," ",L(qg,{className:"w-4 h-4"})]})," ","option is enabled in your Telnyx agent settings."]})]})]});function C_({"agent-id":e,environment:t,position:n="fixed"}){const i=m_(e,t),[s,o]=ge(null),[r,a]=ge(!0),[l,c]=ge(!1);return g_(i,{onReady:()=>a(!1),onNotification:_=>{var b;if(((b=_.call)==null?void 0:b.state)==="destroy")return o(null);o(_)},onError:()=>{a(!1),c(!0)}}),L(x_,{position:n,children:e?l?L(S_,{agentId:e}):r?L(Fr,{}):s!=null&&s.call?L(p_,{call:s.call,client:i}):L(__,{client:i}):L("div",{children:"Please provide an assistant ID."})})}gd(C_,"telnyx-ai-agent",Vg,{shadow:!0})})();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@telnyx/ai-agent-widget",
3
3
  "private": false,
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "description": "A widget for Telnyx AI Agent",
6
6
  "type": "module",
7
7
  "author": "Telnyx",