@1interface/voice-core 0.7.1 → 0.8.1

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.
@@ -1 +0,0 @@
1
- function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,r={exports:{}};const s=e(function(){if(t)return r.exports;t=1;var e,s="object"==typeof Reflect?Reflect:null,n=s&&"function"==typeof s.apply?s.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};e=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}r.exports=o,r.exports.once=function(e,t){return new Promise(function(r,s){function n(r){e.removeListener(t,i),s(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}g(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,n)})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function l(e,t,r,s){var n,i,o;if(c(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),void 0===o)o=i[t]=r,++e._eventsCount;else if("function"==typeof o?o=i[t]=s?[r,o]:[o,r]:s?o.unshift(r):o.push(r),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,console&&console.warn&&console.warn(a)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var s={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=u.bind(s);return n.listener=r,s.wrapFn=n,n}function h(e,t,r){var s=e._events;if(void 0===s)return[];var n=s[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):b(n,n.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(e,t){for(var r=new Array(t),s=0;s<t;++s)r[s]=e[s];return r}function g(e,t,r,s){if("function"==typeof e.on)s.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function n(i){s.once&&e.removeEventListener(t,n),r(i)})}}return Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var d=c.length,l=b(c,d);for(r=0;r<d;++r)n(l[r],this,t)}return!0},o.prototype.on=o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.prependListener=function(e,t){return l(this,e,t,!0)},o.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},o.prototype.off=o.prototype.removeListener=function(e,t){var r,s,n,i,o;if(c(t),void 0===(s=this._events))return this;if(void 0===(r=s[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,n=i;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(s[e]=r[0]),void 0!==s.removeListener&&this.emit("removeListener",e,o||t)}return this},o.prototype.removeAllListeners=function(e){var t,r,s;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,i=Object.keys(r);for(s=0;s<i.length;++s)"removeListener"!==(n=i[s])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},o.prototype.listenerCount=m,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},r.exports}()),n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));let i;const o=new Uint8Array(16),a={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},c={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},d={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},l={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},u={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},p={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};class h{static getFirstMatch(e,t){const r=t.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,t){const r=t.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,t,r){if(e.test(t))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map(e=>parseInt(e,10)||0);t.push(0);const r=t[0];if(10===r)switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(r){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map(e=>parseInt(e,10)||0);if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,r=!1){const s=h.getVersionPrecision(e),n=h.getVersionPrecision(t);let i=Math.max(s,n),o=0;const a=h.map([e,t],e=>{const t=i-h.getVersionPrecision(e),r=e+new Array(t+1).join(".0");return h.map(r.split("."),e=>new Array(20-e.length).join("0")+e).reverse()});for(r&&(o=i-Math.min(s,n)),i-=1;i>=o;){if(a[0][i]>a[1][i])return 1;if(a[0][i]===a[1][i]){if(i===o)return 0;i-=1}else if(a[0][i]<a[1][i])return-1}}static map(e,t){const r=[];let s;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(s=0;s<e.length;s+=1)r.push(t(e[s]));return r}static find(e,t){let r,s;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,s=e.length;r<s;r+=1){const s=e[r];if(t(s,r))return s}}static assign(e,...t){const r=e;let s,n;if(Object.assign)return Object.assign(e,...t);for(s=0,n=t.length;s<n;s+=1){const e=t[s];"object"==typeof e&&null!==e&&Object.keys(e).forEach(t=>{r[t]=e[t]})}return e}static getBrowserAlias(e){return c[e]}static getBrowserTypeByAlias(e){return d[e]||""}}const m=/version\/(\d+(\.?_?\d+)+)/i,b=[{test:[/gptbot/i],describe(e){const t={name:"GPTBot"},r=h.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/chatgpt-user/i],describe(e){const t={name:"ChatGPT-User"},r=h.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/oai-searchbot/i],describe(e){const t={name:"OAI-SearchBot"},r=h.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(e){const t={name:"ClaudeBot"},r=h.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/omgilibot/i,/webzio-extended/i],describe(e){const t={name:"Omgilibot"},r=h.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/diffbot/i],describe(e){const t={name:"Diffbot"},r=h.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/perplexitybot/i],describe(e){const t={name:"PerplexityBot"},r=h.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/perplexity-user/i],describe(e){const t={name:"Perplexity-User"},r=h.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/youbot/i],describe(e){const t={name:"YouBot"},r=h.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/meta-webindexer/i],describe(e){const t={name:"Meta-WebIndexer"},r=h.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/meta-externalads/i],describe(e){const t={name:"Meta-ExternalAds"},r=h.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/meta-externalagent/i],describe(e){const t={name:"Meta-ExternalAgent"},r=h.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/meta-externalfetcher/i],describe(e){const t={name:"Meta-ExternalFetcher"},r=h.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},r=h.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/linespider/i],describe(e){const t={name:"Linespider"},r=h.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/amazonbot/i],describe(e){const t={name:"AmazonBot"},r=h.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/bingbot/i],describe(e){const t={name:"BingCrawler"},r=h.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/baiduspider/i],describe(e){const t={name:"BaiduSpider"},r=h.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/duckduckbot/i],describe(e){const t={name:"DuckDuckBot"},r=h.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/ia_archiver/i],describe(e){const t={name:"InternetArchiveCrawler"},r=h.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:()=>({name:"FacebookExternalHit"})},{test:[/slackbot/i,/slack-imgProxy/i],describe(e){const t={name:"SlackBot"},r=h.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/yahoo!?[\s/]*slurp/i],describe:()=>({name:"YahooSlurp"})},{test:[/yandexbot/i,/yandexmobilebot/i],describe:()=>({name:"YandexBot"})},{test:[/pingdom/i],describe:()=>({name:"PingdomBot"})},{test:[/opera/i],describe(e){const t={name:"Opera"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},r=h.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/PaleMoon/i],describe(e){const t={name:"Pale Moon"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},r=h.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},r=h.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},r=h.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},r=h.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},r=h.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},r=h.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=h.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},r=h.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},r=h.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},r=h.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},r=h.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},r=h.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},r=h.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},r=h.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},r=h.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},r=h.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},r=h.getFirstMatch(m,e)||h.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},r=h.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},r=h.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},r=h.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/librewolf/i],describe(e){const t={name:"LibreWolf"},r=h.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},r=h.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},r=h.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(e){const t={name:"Sogou Browser"},r=h.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),s=h.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),n=h.getFirstMatch(/se ([\d.]+)x/i,e),i=r||s||n;return i&&(t.version=i),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},r=h.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:e=>!!e.hasBrand("DuckDuckGo")||e.test(/\sDdg\/[\d.]+$/i),describe(e,t){const r={name:"DuckDuckGo"};if(t){const e=t.getBrandVersion("DuckDuckGo");if(e)return r.version=e,r}const s=h.getFirstMatch(/\sDdg\/([\d.]+)$/i,e);return s&&(r.version=s),r}},{test:e=>e.hasBrand("Brave"),describe(e,t){const r={name:"Brave"};if(t){const e=t.getBrandVersion("Brave");if(e)return r.version=e,r}return r}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},r=h.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},r=h.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},r=h.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t={name:"Android Browser"},r=h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},r=h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},r=h.getFirstMatch(m,e);return r&&(t.version=r),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:h.getFirstMatch(t,e),version:h.getSecondMatch(t,e)}}}],g=[{test:[/Roku\/DVP/],describe(e){const t=h.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:u.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=h.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:u.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=h.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=h.getWindowsVersionName(t);return{name:u.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:u.iOS},r=h.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe(e){const t=h.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=h.getMacOSVersionName(t),s={name:u.MacOS,version:t};return r&&(s.versionName=r),s}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=h.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:u.iOS,version:t}}},{test:[/OpenHarmony/i],describe(e){const t=h.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return{name:u.HarmonyOS,version:t}}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t=h.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=h.getAndroidVersionName(t),s={name:u.Android,version:t};return r&&(s.versionName=r),s}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=h.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:u.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=h.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||h.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||h.getFirstMatch(/\bbb(\d+)/i,e);return{name:u.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=h.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:u.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=h.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:u.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:u.Linux})},{test:[/CrOS/],describe:()=>({name:u.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=h.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:u.PlayStation4,version:t}}}],f=[{test:[/googlebot/i],describe:()=>({type:l.bot,vendor:"Google"})},{test:[/linespider/i],describe:()=>({type:l.bot,vendor:"Line"})},{test:[/amazonbot/i],describe:()=>({type:l.bot,vendor:"Amazon"})},{test:[/gptbot/i],describe:()=>({type:l.bot,vendor:"OpenAI"})},{test:[/chatgpt-user/i],describe:()=>({type:l.bot,vendor:"OpenAI"})},{test:[/oai-searchbot/i],describe:()=>({type:l.bot,vendor:"OpenAI"})},{test:[/baiduspider/i],describe:()=>({type:l.bot,vendor:"Baidu"})},{test:[/bingbot/i],describe:()=>({type:l.bot,vendor:"Bing"})},{test:[/duckduckbot/i],describe:()=>({type:l.bot,vendor:"DuckDuckGo"})},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:()=>({type:l.bot,vendor:"Anthropic"})},{test:[/omgilibot/i,/webzio-extended/i],describe:()=>({type:l.bot,vendor:"Webz.io"})},{test:[/diffbot/i],describe:()=>({type:l.bot,vendor:"Diffbot"})},{test:[/perplexitybot/i],describe:()=>({type:l.bot,vendor:"Perplexity AI"})},{test:[/perplexity-user/i],describe:()=>({type:l.bot,vendor:"Perplexity AI"})},{test:[/youbot/i],describe:()=>({type:l.bot,vendor:"You.com"})},{test:[/ia_archiver/i],describe:()=>({type:l.bot,vendor:"Internet Archive"})},{test:[/meta-webindexer/i],describe:()=>({type:l.bot,vendor:"Meta"})},{test:[/meta-externalads/i],describe:()=>({type:l.bot,vendor:"Meta"})},{test:[/meta-externalagent/i],describe:()=>({type:l.bot,vendor:"Meta"})},{test:[/meta-externalfetcher/i],describe:()=>({type:l.bot,vendor:"Meta"})},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:()=>({type:l.bot,vendor:"Meta"})},{test:[/slackbot/i,/slack-imgProxy/i],describe:()=>({type:l.bot,vendor:"Slack"})},{test:[/yahoo/i],describe:()=>({type:l.bot,vendor:"Yahoo"})},{test:[/yandexbot/i,/yandexmobilebot/i],describe:()=>({type:l.bot,vendor:"Yandex"})},{test:[/pingdom/i],describe:()=>({type:l.bot,vendor:"Pingdom"})},{test:[/huawei/i],describe(e){const t=h.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:l.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:l.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:l.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:l.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:l.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:l.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:l.tablet})},{test(e){const t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe(e){const t=h.getFirstMatch(/(ipod|iphone)/i,e);return{type:l.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:l.mobile,vendor:"Nexus"})},{test:[/Nokia/i],describe(e){const t=h.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),r={type:l.mobile,vendor:"Nokia"};return t&&(r.model=t),r}},{test:[/[^-]mobi/i],describe:()=>({type:l.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:l.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:l.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:l.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:l.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:l.mobile})},{test:[/smart-?tv|smarttv/i],describe:()=>({type:l.tv})},{test:[/netcast/i],describe:()=>({type:l.tv})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:l.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:l.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:l.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:l.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:l.tv})}],v=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:p.Blink};const t=h.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:p.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:p.Trident},r=h.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:p.Presto},r=h.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe(e){const t={name:p.Gecko},r=h.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:p.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:p.WebKit},r=h.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];class S{constructor(e,t=!1,r=null){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e;let s=!1;"boolean"==typeof t?(s=t,this._hints=r):this._hints=null!=t&&"object"==typeof t?t:null,this.parsedResult={},!0!==s&&this.parse()}getHints(){return this._hints}hasBrand(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;const t=e.toLowerCase();return this._hints.brands.some(e=>e.brand&&e.brand.toLowerCase()===t)}getBrandVersion(e){if(!this._hints||!Array.isArray(this._hints.brands))return;const t=e.toLowerCase(),r=this._hints.brands.find(e=>e.brand&&e.brand.toLowerCase()===t);return r?r.version:void 0}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=h.find(b,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA(),this)),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=h.find(g,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=h.find(f,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=h.find(v,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return h.assign({},this.parsedResult)}satisfies(e){const t={};let r=0;const s={};let n=0;if(Object.keys(e).forEach(i=>{const o=e[i];"string"==typeof o?(s[i]=o,n+=1):"object"==typeof o&&(t[i]=o,r+=1)}),r>0){const e=Object.keys(t),r=h.find(e,e=>this.isOS(e));if(r){const e=this.satisfies(t[r]);if(void 0!==e)return e}const s=h.find(e,e=>this.isPlatform(e));if(s){const e=this.satisfies(t[s]);if(void 0!==e)return e}}if(n>0){const e=Object.keys(s),t=h.find(e,e=>this.isBrowser(e,!0));if(void 0!==t)return this.compareVersion(s[t])}}isBrowser(e,t=!1){const r=this.getBrowserName().toLowerCase();let s=e.toLowerCase();const n=h.getBrowserTypeByAlias(s);return t&&n&&(s=n.toLowerCase()),s===r}compareVersion(e){let t=[0],r=e,s=!1;const n=this.getBrowserVersion();if("string"==typeof n)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(s=!0,r=e.substr(2)):t=[],t.push(">"===e[0]?1:-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(s=!0,r=e.substr(1)),t.indexOf(h.compareVersions(n,r,s))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(e=>this.is(e))}}class _{static getParser(e,t=!1,r=null){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new S(e,t,r)}static parse(e,t=null){return new S(e,t).getResult()}static get BROWSER_MAP(){return d}static get ENGINE_MAP(){return p}static get OS_MAP(){return u}static get PLATFORMS_MAP(){return l}}function y(e,t){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}function w(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}function M(e){return e&&e.__esModule?e.default:e}var k={},E={};w(E,"A11ySnapshotStreamer",()=>q);const T=200,C=new WeakMap,B="undefined"==typeof WeakRef?void 0:WeakRef,L=new Map;let A=0;function x(e){const t=C.get(e);if(t)return t;const r="e"+ ++A;return C.set(e,r),L.set(r,B?new B(e):e),r}function O(e){const t=L.get(e);if(!t)return null;const r="deref"in t?t.deref():t;return r&&r.isConnected?r:(L.delete(e),null)}function R(e){return C.get(e)??null}const F=new Set(["script","style","link","meta","noscript","template"]),P=new Set([...new Set(["button","link","checkbox","radio","textbox","combobox","switch","menuitem","tab"]),"heading","img"]);function N(e){return e.replace(/\s+/g," ").trim()}function U(e,t=100){const r=N(e);return r.length<=t?r:r.slice(0,t-1)+"…"}function I(e){const t=[];for(let r=0;r<e.childNodes.length;r++){const s=e.childNodes[r];if(3===s.nodeType){const e=(s.textContent??"").trim();e&&t.push(e)}else if(1===s.nodeType){const e=s;if(F.has(e.tagName.toLowerCase()))continue;if("true"===e.getAttribute("aria-hidden"))continue;const r=I(e);r&&t.push(r)}}return t.join(" ").replace(/\s+/g," ").trim()}function D(e,t){const r=e.getAttribute(t);if(!r)return;const s=parseInt(r,10);return Number.isNaN(s)||s<0?void 0:s}function j(e,t,r,s,n=!1){if(function(e){if(F.has(e.tagName.toLowerCase()))return!0;if("true"===e.getAttribute("aria-hidden"))return!0;if(e.hasAttribute("data-a11y-exclude"))return!0;if(e.hidden)return!0;if(e instanceof HTMLElement&&null===e.offsetParent&&"BODY"!==e.tagName){const t=window.getComputedStyle(e);if("none"===t.display||"hidden"===t.visibility)return!0}return!1}(e))return[];if(r.count>=T)return[];if(t>10)return r.count++,[{ref:x(e),role:"ellipsis",name:"<truncated: max depth>"}];const i=function(e){const t=e.getAttribute("role");if(t)return t;const r=e.tagName.toLowerCase();switch(r){case"main":case"nav":case"header":case"aside":case"footer":return r;case"article":case"section":return function(e){return!!e.hasAttribute("aria-label")||!!e.hasAttribute("aria-labelledby")||(e.textContent??"").trim().length>0}(e)?"region":null;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return"heading";case"a":return e.hasAttribute("href")?"link":null;case"button":return"button";case"input":{const t=e.type;return"checkbox"===t?"checkbox":"radio"===t?"radio":"submit"===t||"button"===t||"reset"===t?"button":"hidden"===t?null:"textbox"}case"select":return"combobox";case"textarea":return"textbox";case"label":return null;case"img":return null!==e.getAttribute("alt")?"img":null;case"p":return"paragraph";case"ul":case"ol":return"list";case"li":return"listitem";case"table":return"table";case"tr":return"row";case"th":return"columnheader";case"td":return"cell";default:return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||e.hasAttribute("tabindex")?"generic":null}}(e);if(null===i)return z(e,t,r,s,{skipTextNodes:n});r.count++;const o={ref:x(e),role:i},a=function(e,t){const r=e.getAttribute("aria-label");if(r)return U(r);const s=function(e){const t=e.getAttribute("aria-labelledby");if(!t)return;const r=[];for(const s of t.split(/\s+/)){if(!s)continue;const t=e.ownerDocument.getElementById(s);t&&r.push(I(t))}return r.filter(Boolean).join(" ")||void 0}(e);if(s)return U(s);const n=e.tagName.toLowerCase();if("input"===n||"textarea"===n||"select"===n){const t=e.getAttribute("id");if(t){const r=e.ownerDocument.getElementsByTagName("label");for(let e=0;e<r.length;e++)if(r[e].htmlFor===t&&r[e].textContent)return U(r[e].textContent??"")}const r=e.closest("label");if(r?.textContent)return U(r.textContent);const s=e.getAttribute("placeholder");return s?U(s):void 0}if("img"===n){const t=e.getAttribute("alt");return t?U(t):void 0}if(P.has(t)||"paragraph"===t){const t=I(e);return t?U(t):void 0}}(e,i);a&&(o.name=a);const c=function(e){if(e instanceof HTMLInputElement){if("password"===e.type)return;if("checkbox"===e.type||"radio"===e.type||"hidden"===e.type)return;return e.value||void 0}if(e instanceof HTMLTextAreaElement)return e.value||void 0;if(e instanceof HTMLSelectElement){const t=e.selectedOptions[0],r=t?.text?.trim();return r||e.value||void 0}}(e);void 0!==c&&(o.value=c);const d=function(e){const t=[];return e.ownerDocument.activeElement===e&&t.push("focused"),"true"===e.getAttribute("aria-expanded")&&t.push("expanded"),"true"===e.getAttribute("aria-selected")&&t.push("selected"),(e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled"))&&t.push("disabled"),"true"===e.getAttribute("aria-checked")&&t.push("checked"),e instanceof HTMLInputElement&&("checkbox"!==e.type&&"radio"!==e.type||!e.checked||t.includes("checked")||t.push("checked")),t}(e);s.trackViewport&&function(e){const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return!0;const r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return t.bottom<=0||t.top>=s||t.right<=0||t.left>=r}(e)&&d.push("offscreen"),d.length&&(o.state=d);const l=function(e,t){if("heading"!==t)return;const r=e.tagName.toLowerCase().match(/^h([1-6])$/);if(r)return parseInt(r[1],10);const s=e.getAttribute("aria-level");if(s){const e=parseInt(s,10);if(!Number.isNaN(e))return e}}(e,i);void 0!==l&&(o.level=l);const u=D(e,"aria-colcount");void 0!==u&&(o.colcount=u);const p=D(e,"aria-rowcount");if(void 0!==p&&(o.rowcount=p),P.has(i)){if(e instanceof HTMLSelectElement){const t=function(e,t,r){const s=[],n=e.options;let i=0;for(let e=0;e<n.length&&!(t.count>=T);e++){const o=n[e];if(o.hidden)continue;if("true"===o.getAttribute("aria-hidden"))continue;if(i>=20){t.count++,s.push({ref:`${r}.more`,role:"ellipsis",name:n.length-i+" more"});break}t.count++,i++;const a=(o.text||o.value||"").trim(),c={ref:x(o),role:"option",name:U(a)},d=[];o.selected&&d.push("selected"),o.disabled&&d.push("disabled"),d.length&&(c.state=d),s.push(c)}return s}(e,r,o.ref);t.length>0&&(o.children=t)}}else{const n=z(e,t+1,r,s,{skipTextNodes:"paragraph"===i});if(n.length>0)if(n.length>50){const e=n.slice(0,50);e.push({ref:`${o.ref}.more`,role:"ellipsis",name:n.length-50+" more"}),o.children=e}else o.children=n}return[o]}function z(e,t,r,s,n={}){const i=[];for(let o=0;o<e.childNodes.length;o++){const a=e.childNodes[o];if(3===a.nodeType){if(n.skipTextNodes)continue;const e=N(a.textContent??"");if(e){if(r.count>=T)break;r.count++,i.push({ref:"",role:"text",name:U(e)})}}else if(1===a.nodeType){const e=j(a,t,r,s,n.skipTextNodes);for(const t of e)i.push(t);if(r.count>=T)break}}return i}function H(e){return e.length<=2e3?e:e.slice(0,1999)+"…"}function G(){if("undefined"==typeof document)return null;const e=document.activeElement;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=e.selectionStart,r=e.selectionEnd;if(null!==t&&null!==r&&t!==r){const s=C.get(e);if(!s)return null;const n=e.value.slice(t,r);return n?{ref:s,text:H(n),start_offset:t,end_offset:r}:null}}const t=document.getSelection();if(!t||0===t.rangeCount||t.isCollapsed)return null;const r=t.toString();if(!r)return null;let s=t.getRangeAt(0).commonAncestorContainer;for(;s&&1!==s.nodeType;)s=s.parentNode;const n=function(e){let t=e;for(;t;){if("true"===t.getAttribute("aria-hidden")||t.hasAttribute("data-a11y-exclude"))return null;if(C.has(t))return t;t=t.parentElement}return null}(s);if(!n)return null;const i=C.get(n);return i?{ref:i,text:H(r)}:null}function V(e,t={}){const r=e??("undefined"!=typeof document?document.body:null);if(!r)return{root:{ref:"e0",role:"generic"},captured_at:Date.now()};const s=z(r,0,{count:0},{trackViewport:t.trackViewport??!0}),n=G();return{root:{ref:x(r),role:"generic",...s.length>0?{children:s}:{}},captured_at:Date.now(),...n?{selection:n}:{}}}class q{constructor(e,t={}){this.running=!1,this.emitSnapshot=e,this.debounceMs=t.debounceMs??300,this.trackViewport=t.trackViewport??!0,this.logSnapshots=t.logSnapshots??!1}start(){this.running||"undefined"!=typeof document&&(this.running=!0,this.schedule(),this.observer=new MutationObserver(()=>this.schedule()),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","aria-label","aria-labelledby","aria-expanded","aria-selected","aria-checked","aria-disabled","aria-level","aria-hidden","aria-colcount","aria-rowcount","data-a11y-exclude","disabled","hidden","tabindex","href"]}),this.focusHandler=()=>this.schedule(),document.addEventListener("focusin",this.focusHandler),document.addEventListener("focusout",this.focusHandler),this.scrollEndHandler=()=>this.schedule(),window.addEventListener("scrollend",this.scrollEndHandler,{capture:!0}),this.resizeHandler=()=>this.schedule(),window.addEventListener("resize",this.resizeHandler),this.visibilityHandler=()=>{"visible"===document.visibilityState&&this.schedule()},document.addEventListener("visibilitychange",this.visibilityHandler),this.selectionHandler=()=>this.schedule(),document.addEventListener("selectionchange",this.selectionHandler),this.formHandler=()=>this.schedule(),document.addEventListener("input",this.formHandler,{capture:!0}),document.addEventListener("change",this.formHandler,{capture:!0}))}stop(){this.running&&(this.running=!1,void 0!==this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.observer&&(this.observer.disconnect(),this.observer=void 0),"undefined"!=typeof document&&(this.focusHandler&&(document.removeEventListener("focusin",this.focusHandler),document.removeEventListener("focusout",this.focusHandler)),this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.selectionHandler&&document.removeEventListener("selectionchange",this.selectionHandler),this.formHandler&&(document.removeEventListener("input",this.formHandler,{capture:!0}),document.removeEventListener("change",this.formHandler,{capture:!0}))),"undefined"!=typeof window&&(this.scrollEndHandler&&window.removeEventListener("scrollend",this.scrollEndHandler,{capture:!0}),this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler)),this.focusHandler=void 0,this.scrollEndHandler=void 0,this.resizeHandler=void 0,this.visibilityHandler=void 0,this.selectionHandler=void 0,this.formHandler=void 0)}schedule(){this.running&&(void 0!==this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.emit(),this.debounceMs))}emit(){if(this.timer=void 0,this.running)try{const e=V(void 0,{trackViewport:this.trackViewport});if(this.emitSnapshot(e),this.logSnapshots){const t=W(e.root),r=Math.round(JSON.stringify(e).length/4);console.groupCollapsed(`[A11ySnapshotStreamer] emit: ${t} nodes, ~${r} tokens`),console.groupEnd()}}catch{}}}function W(e){let t=1;const r=e.children;if(r)for(const e of r)t+=W(e);return t}var $,Y={};w(Y,"PipecatClient",()=>Ve),$=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.12.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web.git"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.module.js","require":"./dist/index.js"}},"files":["dist","package.json","README.md"],"scripts":{"build":"jest --silent --passWithNoTests && parcel build --no-cache","dev":"parcel watch","lint":"eslint . --report-unused-disable-directives --max-warnings 0","test":"jest"},"jest":{"preset":"ts-jest","testEnvironment":"jsdom","setupFilesAfterEnv":["<rootDir>/tests/jest.setup.ts"]},"devDependencies":{"@jest/globals":"^29.7.0","@types/clone-deep":"^4.0.4","@types/jest":"^29.5.12","eslint":"^9.11.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1","jest":"^29.7.0","jest-environment-jsdom":"^30.0.2","ts-jest":"^29.2.5","whatwg-fetch":"^3.6.20"},"dependencies":{"@types/events":"^3.0.3","bowser":"^2.11.0","clone-deep":"^4.0.1","events":"^3.3.0","typed-emitter":"^2.1.0","uuid":"^11.1.1"}}');var J={};w(J,"findElementByRef",()=>O),w(J,"findRefForElement",()=>R),w(J,"serializeSelection",()=>G),w(J,"snapshotDocument",()=>V);var K,Q,X={};w(X,"TransportStateEnum",()=>K),(Q=K||(K={})).DISCONNECTED="disconnected",Q.INITIALIZING="initializing",Q.INITIALIZED="initialized",Q.AUTHENTICATING="authenticating",Q.AUTHENTICATED="authenticated",Q.CONNECTING="connecting",Q.CONNECTED="connected",Q.READY="ready",Q.DISCONNECTING="disconnecting",Q.ERROR="error";var Z={};w(Z,"RTVIError",()=>ee),w(Z,"ConnectionTimeoutError",()=>te),w(Z,"StartBotError",()=>re),w(Z,"TransportStartError",()=>se),w(Z,"InvalidTransportParamsError",()=>ne),w(Z,"BotNotReadyError",()=>ie),w(Z,"BotAlreadyStartedError",()=>oe),w(Z,"UnsupportedFeatureError",()=>ae),w(Z,"MessageTooLargeError",()=>ce),w(Z,"DeviceError",()=>de);class ee extends Error{constructor(e,t){super(e),this.status=t}}class te extends ee{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class re extends ee{constructor(e,t){super(e??"Failed to connect / invalid auth bundle from base url",t??500),this.error="invalid-request-error"}}class se extends ee{constructor(e){super(e??"Unable to connect to transport")}}class ne extends ee{constructor(e){super(e??"Invalid transport connection parameters")}}class ie extends ee{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class oe extends ee{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class ae extends ee{constructor(e,t,r){let s=`${e} not supported${r?`: ${r}`:""}`;t&&(s=`${t} does not support ${e}${r?`: ${r}`:""}`),super(s),this.feature=e}}class ce extends ee{constructor(e){super(e??"Message size exceeds the maximum allowed limit for transport.")}}class de extends ee{constructor(e,t,r,s){super(r??`Device error for ${e.join(", ")}: ${t}`),this.devices=e,this.type=t,this.details=s}}var le,ue,pe={};w(pe,"RTVIEvent",()=>le),(ue=le||(le={})).Connected="connected",ue.Disconnected="disconnected",ue.TransportStateChanged="transportStateChanged",ue.BotStarted="botStarted",ue.BotConnected="botConnected",ue.BotReady="botReady",ue.BotDisconnected="botDisconnected",ue.Error="error",ue.ServerMessage="serverMessage",ue.ServerResponse="serverResponse",ue.MessageError="messageError",ue.UICommand="uiCommand",ue.UIJobGroup="uiJobGroup",ue.Metrics="metrics",ue.BotStartedSpeaking="botStartedSpeaking",ue.BotStoppedSpeaking="botStoppedSpeaking",ue.UserStartedSpeaking="userStartedSpeaking",ue.UserStoppedSpeaking="userStoppedSpeaking",ue.UserMuteStarted="userMuteStarted",ue.UserMuteStopped="userMuteStopped",ue.UserTranscript="userTranscript",ue.BotOutput="botOutput",ue.BotTranscript="botTranscript",ue.UserLlmText="userLlmText",ue.BotLlmText="botLlmText",ue.BotLlmStarted="botLlmStarted",ue.BotLlmStopped="botLlmStopped",ue.LLMFunctionCall="llmFunctionCall",ue.LLMFunctionCallStarted="llmFunctionCallStarted",ue.LLMFunctionCallInProgress="llmFunctionCallInProgress",ue.LLMFunctionCallStopped="llmFunctionCallStopped",ue.BotLlmSearchResponse="botLlmSearchResponse",ue.BotTtsText="botTtsText",ue.BotTtsStarted="botTtsStarted",ue.BotTtsStopped="botTtsStopped",ue.ParticipantConnected="participantConnected",ue.ParticipantLeft="participantLeft",ue.TrackStarted="trackStarted",ue.TrackStopped="trackStopped",ue.ScreenTrackStarted="screenTrackStarted",ue.ScreenTrackStopped="screenTrackStopped",ue.ScreenShareError="screenShareError",ue.LocalAudioLevel="localAudioLevel",ue.RemoteAudioLevel="remoteAudioLevel",ue.AvailableCamsUpdated="availableCamsUpdated",ue.AvailableMicsUpdated="availableMicsUpdated",ue.AvailableSpeakersUpdated="availableSpeakersUpdated",ue.CamUpdated="camUpdated",ue.MicUpdated="micUpdated",ue.SpeakerUpdated="speakerUpdated",ue.DeviceError="deviceError",ue.MediaStateUpdated="mediaStateUpdated",ue.UnsupportedFeature="unsupportedFeature";var he={};w(he,"RTVI_PROTOCOL_VERSION",()=>me),w(he,"RTVI_MESSAGE_LABEL",()=>be),w(he,"RTVIMessageType",()=>ge),w(he,"AggregationType",()=>ve),w(he,"setAboutClient",()=>ye),w(he,"RTVIMessage",()=>we);const me="2.0.0",be="rtvi-ai";var ge,fe,ve,Se;let _e;function ye(e){_e=_e?{..._e,...e}:e}(fe=ge||(ge={})).CLIENT_READY="client-ready",fe.DISCONNECT_BOT="disconnect-bot",fe.CLIENT_MESSAGE="client-message",fe.SEND_TEXT="send-text",fe.UI_EVENT="ui-event",fe.UI_SNAPSHOT="ui-snapshot",fe.UI_CANCEL_JOB_GROUP="ui-cancel-job-group",fe.APPEND_TO_CONTEXT="append-to-context",fe.BOT_READY="bot-ready",fe.ERROR="error",fe.METRICS="metrics",fe.SERVER_MESSAGE="server-message",fe.SERVER_RESPONSE="server-response",fe.ERROR_RESPONSE="error-response",fe.APPEND_TO_CONTEXT_RESULT="append-to-context-result",fe.UI_COMMAND="ui-command",fe.UI_JOB_GROUP="ui-job-group",fe.USER_STARTED_SPEAKING="user-started-speaking",fe.USER_STOPPED_SPEAKING="user-stopped-speaking",fe.BOT_STARTED_SPEAKING="bot-started-speaking",fe.BOT_STOPPED_SPEAKING="bot-stopped-speaking",fe.USER_MUTE_STARTED="user-mute-started",fe.USER_MUTE_STOPPED="user-mute-stopped",fe.USER_TRANSCRIPTION="user-transcription",fe.BOT_OUTPUT="bot-output",fe.BOT_TRANSCRIPTION="bot-transcription",fe.USER_LLM_TEXT="user-llm-text",fe.BOT_LLM_TEXT="bot-llm-text",fe.BOT_LLM_STARTED="bot-llm-started",fe.BOT_LLM_STOPPED="bot-llm-stopped",fe.LLM_FUNCTION_CALL="llm-function-call",fe.LLM_FUNCTION_CALL_STARTED="llm-function-call-started",fe.LLM_FUNCTION_CALL_IN_PROGRESS="llm-function-call-in-progress",fe.LLM_FUNCTION_CALL_STOPPED="llm-function-call-stopped",fe.LLM_FUNCTION_CALL_RESULT="llm-function-call-result",fe.BOT_LLM_SEARCH_RESPONSE="bot-llm-search-response",fe.BOT_TTS_TEXT="bot-tts-text",fe.BOT_TTS_STARTED="bot-tts-started",fe.BOT_TTS_STOPPED="bot-tts-stopped",(Se=ve||(ve={})).WORD="word",Se.SENTENCE="sentence";class we{constructor(e,t,r){this.label=be,this.type=e,this.data=t,this.id=r||function(e){if(a.randomUUID&&!e)return a.randomUUID();const t=(e=e||{}).random??e.rng?.()??function(){if(!i){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");i=crypto.getRandomValues.bind(crypto)}return i(o)}();if(t.length<16)throw new Error("Random bytes length must be >= 16");return t[6]=15&t[6]|64,t[8]=63&t[8]|128,function(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}(t)}().slice(0,8)}static clientReady(){return new we(ge.CLIENT_READY,{version:me,about:_e||{library:$.name,library_version:$.version}})}static disconnectBot(){return new we(ge.DISCONNECT_BOT,{})}static error(e,t=!1){return new we(ge.ERROR,{message:e,fatal:t})}}function Me(e,t,r){const s=r.value;return r.value=function(...e){if("ready"===this.state)return s.apply(this,e);throw new ie(`Attempt to call ${t.toString()} when transport not in ready state. Await connect() first.`)},r}function ke(e,t,r){const s=r.value,n=["authenticating","connecting","connected","ready"];return r.value=function(...e){if(n.includes(this.state))throw new oe(`Attempt to call ${t.toString()} when client already started. Please call disconnect() before starting again.`);return s.apply(this,e)},r}y(J,X),y(J,Z),y(J,pe),y(J,he),y(J,{});var Ee={};w(Ee,"MessageDispatcher",()=>xe);var Te,Ce,Be={};w(Be,"LogLevel",()=>Te),w(Be,"logger",()=>Ae),(Ce=Te||(Te={}))[Ce.NONE=0]="NONE",Ce[Ce.ERROR=1]="ERROR",Ce[Ce.WARN=2]="WARN",Ce[Ce.INFO=3]="INFO",Ce[Ce.DEBUG=4]="DEBUG";class Le{constructor(){this.level=Te.DEBUG}static getInstance(){return Le.instance||(Le.instance=new Le),Le.instance}setLevel(e){this.level=e}debug(...e){}info(...e){}warn(...e){this.level>=Te.WARN&&console.warn(...e)}error(...e){this.level>=Te.ERROR&&console.error(...e)}}const Ae=Le.getInstance();class xe{constructor(e){this._queue=new Array,this._gcInterval=void 0,this._queue=[],this._sendMethod=e}disconnect(){this.clearQueue(),clearInterval(this._gcInterval),this._gcInterval=void 0}dispatch(e,t=ge.CLIENT_MESSAGE,r=1e4){this._gcInterval||(this._gcInterval=setInterval(()=>{this._gc()},2e3));const s=new we(t,e),n=new Promise((e,t)=>{this._queue.push({message:s,timestamp:Date.now(),timeout:r,resolve:e,reject:t})});Ae.debug("[MessageDispatcher] dispatch",s);try{this._sendMethod(s)}catch(e){return Ae.error("[MessageDispatcher] Error sending message",e),Promise.reject(e)}return this._gc(),n}clearQueue(){this._queue=[]}_resolveReject(e,t=!0){const r=this._queue.find(t=>t.message.id===e.id);return r&&(t?(Ae.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(Ae.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(t=>t.message.id!==e.id),Ae.debug("[MessageDispatcher] Queue",this._queue)),e}resolve(e){return this._resolveReject(e,!0)}reject(e){return this._resolveReject(e,!1)}_gc(){const e=[];this._queue=this._queue.filter(t=>{const r=Date.now()-t.timestamp<t.timeout;return r||e.push(t),r}),e.forEach(e=>{e.message.type===ge.CLIENT_MESSAGE&&e.reject(new we(ge.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:e.message.data.t,data:e.message.data.d,fatal:!1}))}),Ae.debug("[MessageDispatcher] GC",this._queue)}}var Oe={};function Re(e){if("object"==typeof e&&null!==e&&Object.keys(e).includes("endpoint")){const t=e.endpoint;return"string"==typeof t||t instanceof URL||"undefined"!=typeof Request&&t instanceof Request}return!1}async function Fe(e,t){let r;return t||(t=new AbortController),new Promise((s,n)=>{(async()=>{let i;e.timeout&&(r=setTimeout(async()=>{t.abort(),n(new Error("Timed out"))},e.timeout)),"undefined"!=typeof Request&&e.endpoint instanceof Request?(i=new Request(e.endpoint,{signal:t.signal}),e.requestData&&Ae.warn("[Pipecat Client] requestData in APIRequest is ignored when endpoint is a Request object"),e.headers&&Ae.warn("[Pipecat Client] headers in APIRequest is ignored when endpoint is a Request object")):i=new Request(e.endpoint,{method:"POST",mode:"cors",headers:new Headers({"Content-Type":"application/json",...Object.fromEntries((e.headers??new Headers).entries())}),body:JSON.stringify(e.requestData),signal:t.signal}),Ae.debug(`[Pipecat Client] Fetching from ${i.url}`),fetch(i).then(e=>{if(Ae.debug(`[Pipecat Client] Received response from ${i.url}`,e),e.ok)return e.json();n(e)}).then(e=>{s(e)}).catch(e=>{Ae.error(`[Pipecat Client] Error fetching: ${e}`),n(e)}).finally(()=>{r&&clearTimeout(r)})})()})}w(Oe,"isAPIRequest",()=>Re),w(Oe,"makeRequest",()=>Fe);var Pe={};w(Pe,"Transport",()=>Ne),w(Pe,"TransportWrapper",()=>Ue);class Ne{constructor(){this._state="disconnected",this._maxMessageSize=65536}connect(e){this._abortController=new AbortController;let t=e;try{t=this._validateConnectionParams(e)}catch(e){throw new ee(`Invalid connection params: ${e.message}. Please check your connection params and try again.`)}return this._connect(t)}get startBotParams(){return this._startBotParams}set startBotParams(e){this._startBotParams="undefined"!=typeof Request&&e.endpoint instanceof Request?{...e,endpoint:e.endpoint.clone()}:e}disconnect(){return this._abortController&&this._abortController.abort(),this._disconnect()}get maxMessageSize(){return this._maxMessageSize}}class Ue{constructor(e){this._transport=e,this._proxy=new Proxy(this._transport,{get:(e,t,r)=>{if("function"==typeof e[t]){let r;switch(String(t)){case"initialize":r="Direct calls to initialize() are disabled and used internally by the PipecatClient.";break;case"initDevices":r="Direct calls to initDevices() are disabled. Please use the PipecatClient.initDevices() wrapper or let PipecatClient.connect() call it for you.";break;case"sendReadyMessage":r="Direct calls to sendReadyMessage() are disabled and used internally by the PipecatClient.";break;case"connect":r="Direct calls to connect() are disabled. Please use the PipecatClient.connect() wrapper.";break;case"disconnect":r="Direct calls to disconnect() are disabled. Please use the PipecatClient.disconnect() wrapper."}return r?()=>{throw new Error(r)}:(...r)=>e[t](...r)}return Reflect.get(e,t,r)}})}get proxy(){return this._proxy}}var Ie={};function De(){let e={library:$.name,library_version:$.version,platform_details:{}},t=null;if(window?.navigator?.userAgent)try{t=_.parse(window.navigator.userAgent)}catch(e){}return t?.browser?.name&&(e.platform_details.browser=t.browser.name),"Safari"!==t?.browser?.name||t.browser.version?t?.browser?.version&&(e.platform_details.browser_version=t.browser.version):e.platform_details.browser_version="Web View",t?.platform?.type&&(e.platform_details.platform_type=t.platform.type),t?.engine?.name&&(e.platform_details.engine=t.engine.name),t?.os&&(e.platform=t.os.name,e.platform_version=t.os.version),e}function je(e,t){return(e=>{const t=JSON.stringify(e);return(new TextEncoder).encode(t).length})(e)<=t}w(Ie,"learnAboutClient",()=>De),w(Ie,"messageSizeWithinLimit",()=>je);var ze=function(e,t,r,s){var n,i=arguments.length,o=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(i<3?n(o):i>3?n(t,r,o):n(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o};function He(e){switch(e){case"in-use":return"already-in-use";case"permissions":return"blocked";case"not-found":return"not-found";case"undefined-mediadevices":return"not-supported";case"constraints":return"invalid-constraints";default:return"unknown"}}class Ge extends s{}class Ve extends Ge{constructor(e){super(),this._functionCallCallbacks={},this._botTranscriptionWarned=!1,this._llmFunctionCallWarned=!1,this._mediaState={mic:{state:"uninitialized"},cam:{state:"uninitialized"}},ye(De()),this._transport=e.transport,this._transportWrapper=new Ue(this._transport),this._disconnectOnBotDisconnect=e.disconnectOnBotDisconnect??!0;const t={...e.callbacks,onMessageError:t=>{e?.callbacks?.onMessageError?.(t),this.emit(le.MessageError,t)},onError:t=>{e?.callbacks?.onError?.(t);try{this.emit(le.Error,t)}catch(r){r instanceof Error&&r.message.includes("Unhandled error")?e?.callbacks?.onError||Ae.debug("No onError callback registered to handle error",t):Ae.debug("Could not emit error",t,r)}const r=t.data;r?.fatal&&(Ae.error("Fatal error reported. Disconnecting..."),this.disconnect())},onConnected:()=>{e?.callbacks?.onConnected?.(),this.emit(le.Connected)},onDisconnected:()=>{e?.callbacks?.onDisconnected?.(),this.emit(le.Disconnected)},onTransportStateChanged:t=>{e?.callbacks?.onTransportStateChanged?.(t),this.emit(le.TransportStateChanged,t),"ready"===t&&this._flushPendingUISnapshot()},onParticipantJoined:t=>{e?.callbacks?.onParticipantJoined?.(t),this.emit(le.ParticipantConnected,t)},onParticipantLeft:t=>{e?.callbacks?.onParticipantLeft?.(t),this.emit(le.ParticipantLeft,t)},onTrackStarted:(t,r)=>{e?.callbacks?.onTrackStarted?.(t,r),this.emit(le.TrackStarted,t,r)},onTrackStopped:(t,r)=>{e?.callbacks?.onTrackStopped?.(t,r),this.emit(le.TrackStopped,t,r)},onScreenTrackStarted:(t,r)=>{e?.callbacks?.onScreenTrackStarted?.(t,r),this.emit(le.ScreenTrackStarted,t,r)},onScreenTrackStopped:(t,r)=>{e?.callbacks?.onScreenTrackStopped?.(t,r),this.emit(le.ScreenTrackStopped,t,r)},onScreenShareError:t=>{e?.callbacks?.onScreenShareError?.(t),this.emit(le.ScreenShareError,t)},onUnsupportedFeature:t=>{e?.callbacks?.onUnsupportedFeature?.(t),this.emit(le.UnsupportedFeature,t)},onAvailableCamsUpdated:t=>{e?.callbacks?.onAvailableCamsUpdated?.(t),this.emit(le.AvailableCamsUpdated,t)},onAvailableMicsUpdated:t=>{e?.callbacks?.onAvailableMicsUpdated?.(t),this.emit(le.AvailableMicsUpdated,t)},onAvailableSpeakersUpdated:t=>{e?.callbacks?.onAvailableSpeakersUpdated?.(t),this.emit(le.AvailableSpeakersUpdated,t)},onCamUpdated:t=>{t?.deviceId&&this._markDeviceGranted("cam"),e?.callbacks?.onCamUpdated?.(t),this.emit(le.CamUpdated,t)},onMicUpdated:t=>{t?.deviceId&&this._markDeviceGranted("mic"),e?.callbacks?.onMicUpdated?.(t),this.emit(le.MicUpdated,t)},onSpeakerUpdated:t=>{e?.callbacks?.onSpeakerUpdated?.(t),this.emit(le.SpeakerUpdated,t)},onDeviceError:t=>{this._classifyAndApplyDeviceError(t),e?.callbacks?.onDeviceError?.(t),this.emit(le.DeviceError,t)},onBotStarted:t=>{e?.callbacks?.onBotStarted?.(t),this.emit(le.BotStarted,t)},onBotConnected:t=>{e?.callbacks?.onBotConnected?.(t),this.emit(le.BotConnected,t)},onBotReady:t=>{e?.callbacks?.onBotReady?.(t),this.emit(le.BotReady,t)},onBotDisconnected:t=>{e?.callbacks?.onBotDisconnected?.(t),this.emit(le.BotDisconnected,t),this._disconnectOnBotDisconnect&&(Ae.info("Bot disconnected. Disconnecting client..."),this.disconnect())},onUserStartedSpeaking:()=>{e?.callbacks?.onUserStartedSpeaking?.(),this.emit(le.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{e?.callbacks?.onUserStoppedSpeaking?.(),this.emit(le.UserStoppedSpeaking)},onBotStartedSpeaking:()=>{e?.callbacks?.onBotStartedSpeaking?.(),this.emit(le.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{e?.callbacks?.onBotStoppedSpeaking?.(),this.emit(le.BotStoppedSpeaking)},onRemoteAudioLevel:(t,r)=>{e?.callbacks?.onRemoteAudioLevel?.(t,r),this.emit(le.RemoteAudioLevel,t,r)},onLocalAudioLevel:t=>{e?.callbacks?.onLocalAudioLevel?.(t),this.emit(le.LocalAudioLevel,t)},onUserMuteStarted:()=>{e?.callbacks?.onUserMuteStarted?.(),this.emit(le.UserMuteStarted)},onUserMuteStopped:()=>{e?.callbacks?.onUserMuteStopped?.(),this.emit(le.UserMuteStopped)},onUserTranscript:t=>{e?.callbacks?.onUserTranscript?.(t),this.emit(le.UserTranscript,t)},onBotOutput:t=>{e?.callbacks?.onBotOutput?.(t),this.emit(le.BotOutput,t)},onBotTranscript:t=>{(!!e?.callbacks?.onBotTranscript||this.listenerCount(le.BotTranscript)>0)&&!this._botTranscriptionWarned&&(Ae.warn("[Pipecat Client] Bot transcription is deprecated. Please use the onBotOutput instead."),this._botTranscriptionWarned=!0),e?.callbacks?.onBotTranscript?.(t),this.emit(le.BotTranscript,t)},onBotLlmText:t=>{e?.callbacks?.onBotLlmText?.(t),this.emit(le.BotLlmText,t)},onBotLlmStarted:()=>{e?.callbacks?.onBotLlmStarted?.(),this.emit(le.BotLlmStarted)},onBotLlmStopped:()=>{e?.callbacks?.onBotLlmStopped?.(),this.emit(le.BotLlmStopped)},onBotTtsText:t=>{e?.callbacks?.onBotTtsText?.(t),this.emit(le.BotTtsText,t)},onBotTtsStarted:()=>{e?.callbacks?.onBotTtsStarted?.(),this.emit(le.BotTtsStarted)},onBotTtsStopped:()=>{e?.callbacks?.onBotTtsStopped?.(),this.emit(le.BotTtsStopped)}};this._options={...e,callbacks:t,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),Ae.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){Ae.setLevel(e)}async initDevices(){Ae.debug("[Pipecat Client] Initializing devices..."),this._setMediaState({mic:{state:"initializing"},cam:{state:"initializing"}});try{await this._transport.initDevices(),this._resolveLingeringInitializing({state:"uninitialized"})}catch(e){throw this._resolveLingeringInitializing({state:"error",reason:"unknown"}),e}finally{await this._enrichFromPermissionsAPI()}}_resolveLingeringInitializing(e){const t={};for(const r of["mic","cam"])"initializing"===this._mediaState[r].state&&(t[r]=e);Object.keys(t).length>0&&this._setMediaState(t)}_markDeviceGranted(e){"granted"!==this._mediaState[e].state&&this._setMediaState({[e]:{state:"granted"}})}async startBot(e){let t;this.needsInit()&&await this.initDevices(),this._transport.state="authenticating",this._transport.startBotParams=e,this._abortController=new AbortController;try{t=await Fe(e,this._abortController)}catch(e){let t,r="An unknown error occurred while starting the bot.";if(e instanceof Response){const s=await e.json();r=s.info??s.detail??e.statusText,t=e.status}else e instanceof Error&&(r=e.message);throw this._options.callbacks?.onError?.(new we(ge.ERROR_RESPONSE,{message:r,fatal:!0})),new re(r,t)}return this._transport.state="authenticated",this._options.callbacks?.onBotStarted?.(t),t}async connect(e){return e&&Re(e)?(Ae.warn("Calling connect with an API endpoint is deprecated. Use startBotAndConnect() instead."),this.startBotAndConnect(e)):new Promise((t,r)=>{(async()=>{this._connectResolve=t,this.needsInit()&&await this.initDevices();try{await this._transport.connect(e),await this._transport.sendReadyMessage()}catch(e){return this.disconnect(),void r(e)}})()})}async startBotAndConnect(e){const t=await this.startBot(e);return this.connect(t)}async disconnect(){this.stopUISnapshotStream(),await this._transport.disconnect(),this._messageDispatcher.disconnect()}_initialize(){this._transport.initialize(this._options,this.handleMessage.bind(this)),this._messageDispatcher=new xe(this._sendMessage.bind(this))}_setMediaState(e){const t={...this._mediaState,...e};this._statusEquals(t.mic,this._mediaState.mic)&&this._statusEquals(t.cam,this._mediaState.cam)||(this._mediaState=t,this._options.callbacks?.onMediaStateChanged?.(this.mediaState),this.emit(le.MediaStateUpdated,this.mediaState))}_statusEquals(e,t){return e.state===t.state&&("error"!==e.state||"error"!==t.state||e.reason===t.reason&&e.details===t.details)}_classifyAndApplyDeviceError(e){const t={state:"error",reason:He(e.type),details:e.details},r={};e.devices.includes("mic")&&(r.mic=t),e.devices.includes("cam")&&(r.cam=t),0!==Object.keys(r).length&&this._setMediaState(r)}async _enrichFromPermissionsAPI(){const e=globalThis.navigator?.permissions;if(!e?.query)return;const t=e.query.bind(e),r={};await Promise.all(["mic","cam"].map(async e=>{try{"denied"===(await t({name:"mic"===e?"microphone":"camera"})).state&&(r[e]={state:"error",reason:"blocked"})}catch{}})),Object.keys(r).length>0&&this._setMediaState(r)}_sendMessage(e){if(!je(e,this._transport.maxMessageSize)){const e=`Message data too large. Max size is ${this._transport.maxMessageSize}`;throw this._options.callbacks?.onError?.(we.error(e,!1)),new ce(e)}try{this._transport.sendMessage(e)}catch(e){throw e instanceof Error?this._options.callbacks?.onError?.(we.error(e.message,!1)):this._options.callbacks?.onError?.(we.error("Unknown error sending message",!1)),e}}get connected(){return["connected","ready"].includes(this._transport.state)}get transport(){return this._transportWrapper.proxy}get state(){return this._transport.state}get mediaState(){return{mic:{...this._mediaState.mic},cam:{...this._mediaState.cam}}}needsInit(){return!1!==this._options.enableMic&&"uninitialized"===this._mediaState.mic.state||!1!==this._options.enableCam&&"uninitialized"===this._mediaState.cam.state}get version(){return M($).version}async getAllMics(){return await this._transport.getAllMics()}async getAllCams(){return await this._transport.getAllCams()}async getAllSpeakers(){return await this._transport.getAllSpeakers()}get selectedMic(){return this._transport.selectedMic}get selectedCam(){try{return this._transport.selectedCam}catch(e){if(e instanceof ae)return this._options.callbacks?.onUnsupportedFeature?.(e),{};throw e}}get selectedSpeaker(){return this._transport.selectedSpeaker}updateMic(e){this._transport.updateMic(e)}updateCam(e){this._transport.updateCam(e)}updateSpeaker(e){this._transport.updateSpeaker(e)}enableMic(e){this._transport.enableMic(e)}get isMicEnabled(){return this._transport.isMicEnabled}enableCam(e){try{this._transport.enableCam(e)}catch(e){if(!(e instanceof ae))throw e;this._options.callbacks?.onUnsupportedFeature?.(e)}}get isCamEnabled(){return this._transport.isCamEnabled}tracks(){return this._transport.tracks()}enableScreenShare(e){try{return this._transport.enableScreenShare(e)}catch(e){if(!(e instanceof ae))throw e;this._options.callbacks?.onUnsupportedFeature?.(e)}}get isSharingScreen(){return this._transport.isSharingScreen}sendClientMessage(e,t){this._sendMessage(new we(ge.CLIENT_MESSAGE,{t:e,d:t}))}sendUIEvent(e,t){this._sendMessage(new we(ge.UI_EVENT,{event:e,payload:t}))}startUISnapshotStream(e={}){this.stopUISnapshotStream(),this._uiSnapshotStreamer=new q(e=>{"ready"===this.state?this._sendUISnapshot(e):this._pendingUISnapshot=e},e),this._uiSnapshotStreamer.start()}stopUISnapshotStream(){this._uiSnapshotStreamer?.stop(),this._uiSnapshotStreamer=void 0,this._pendingUISnapshot=void 0}_sendUISnapshot(e){this._sendMessage(new we(ge.UI_SNAPSHOT,{tree:e}))}_flushPendingUISnapshot(){if(!this._pendingUISnapshot||"ready"!==this.state)return;const e=this._pendingUISnapshot;this._pendingUISnapshot=void 0,this._sendUISnapshot(e)}cancelUIJobGroup(e,t){const r={job_id:e};void 0!==t&&(r.reason=t),this._sendMessage(new we(ge.UI_CANCEL_JOB_GROUP,r))}async sendClientRequest(e,t,r){const s={t:e,d:t};return(await this._messageDispatcher.dispatch(s,ge.CLIENT_MESSAGE,r)).data.d}registerFunctionCallHandler(e,t){this._functionCallCallbacks[e]=t}unregisterFunctionCallHandler(e){delete this._functionCallCallbacks[e]}unregisterAllFunctionCallHandlers(){this._functionCallCallbacks={}}async appendToContext(e){return Ae.warn("appendToContext() is deprecated. Use sendText() instead."),await this._sendMessage(new we(ge.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,t={}){await this._sendMessage(new we(ge.SEND_TEXT,{content:e,options:t}))}disconnectBot(){this._sendMessage(new we(ge.DISCONNECT_BOT,{}))}handleMessage(e){switch(Ae.debug("[RTVI Message]",e),e.type){case ge.BOT_READY:{const t=e.data,r=t.version?t.version.split(".").map(Number):[0,0,0];Ae.debug(`[Pipecat Client] Bot is ready. Version: ${t.version}`),r[0]<2&&Ae.warn(`[Pipecat Client] Bot protocol version ${t.version} is older than this client (${me}). Compatibility issues may occur.`),this._connectResolve?.(e.data),this._options.callbacks?.onBotReady?.(e.data);break}case ge.ERROR:this._options.callbacks?.onError?.(e);break;case ge.SERVER_RESPONSE:this._messageDispatcher.resolve(e);break;case ge.ERROR_RESPONSE:{const t=this._messageDispatcher.reject(e);this._options.callbacks?.onMessageError?.(t);break}case ge.USER_STARTED_SPEAKING:this._options.callbacks?.onUserStartedSpeaking?.();break;case ge.USER_STOPPED_SPEAKING:this._options.callbacks?.onUserStoppedSpeaking?.();break;case ge.BOT_STARTED_SPEAKING:this._options.callbacks?.onBotStartedSpeaking?.();break;case ge.BOT_STOPPED_SPEAKING:this._options.callbacks?.onBotStoppedSpeaking?.();break;case ge.USER_MUTE_STARTED:this._options.callbacks?.onUserMuteStarted?.();break;case ge.USER_MUTE_STOPPED:this._options.callbacks?.onUserMuteStopped?.();break;case ge.USER_TRANSCRIPTION:{const t=e.data;this._options.callbacks?.onUserTranscript?.(t);break}case ge.USER_LLM_TEXT:{const t=e.data;this._options.callbacks?.onUserLlmText?.(t),this.emit(le.UserLlmText,t);break}case ge.BOT_OUTPUT:this._options.callbacks?.onBotOutput?.(e.data);break;case ge.BOT_TRANSCRIPTION:this._options.callbacks?.onBotTranscript?.(e.data);break;case ge.BOT_LLM_TEXT:this._options.callbacks?.onBotLlmText?.(e.data);break;case ge.BOT_LLM_STARTED:this._options.callbacks?.onBotLlmStarted?.();break;case ge.BOT_LLM_STOPPED:this._options.callbacks?.onBotLlmStopped?.();break;case ge.BOT_TTS_TEXT:this._options.callbacks?.onBotTtsText?.(e.data);break;case ge.BOT_TTS_STARTED:this._options.callbacks?.onBotTtsStarted?.();break;case ge.BOT_TTS_STOPPED:this._options.callbacks?.onBotTtsStopped?.();break;case ge.METRICS:this._options.callbacks?.onMetrics?.(e.data),this.emit(le.Metrics,e.data);break;case ge.SERVER_MESSAGE:this._options.callbacks?.onServerMessage?.(e.data),this.emit(le.ServerMessage,e.data);break;case ge.UI_COMMAND:{const t=e.data;this._options.callbacks?.onUICommand?.(t),this.emit(le.UICommand,t);break}case ge.UI_JOB_GROUP:{const t=e.data;this._options.callbacks?.onUIJobGroup?.(t),this.emit(le.UIJobGroup,t);break}case ge.LLM_FUNCTION_CALL_STARTED:{const t=e.data;this._options.callbacks?.onLLMFunctionCallStarted?.(t),this.emit(le.LLMFunctionCallStarted,t);break}case ge.LLM_FUNCTION_CALL_IN_PROGRESS:{const t=e.data;this._maybeTriggerFunctionCallCallback(t),this._options.callbacks?.onLLMFunctionCallInProgress?.(t),this.emit(le.LLMFunctionCallInProgress,t);break}case ge.LLM_FUNCTION_CALL_STOPPED:{const t=e.data;this._options.callbacks?.onLLMFunctionCallStopped?.(t),this.emit(le.LLMFunctionCallStopped,t);break}case ge.LLM_FUNCTION_CALL:{const t=e.data;this._maybeTriggerFunctionCallCallback({function_name:t.function_name,tool_call_id:t.tool_call_id,arguments:t.args}),this._options.callbacks?.onLLMFunctionCall&&(this._llmFunctionCallWarned||(Ae.warn("[Pipecat Client] onLLMFunctionCall is deprecated. Please use onLLMFunctionCallInProgress instead."),this._llmFunctionCallWarned=!0)),this._options.callbacks?.onLLMFunctionCall?.(t),this.emit(le.LLMFunctionCall,t);break}case ge.BOT_LLM_SEARCH_RESPONSE:{const t=e.data;this._options.callbacks?.onBotLlmSearchResponse?.(t),this.emit(le.BotLlmSearchResponse,t);break}default:Ae.debug("[Pipecat Client] Unrecognized message type",e.type)}}_maybeTriggerFunctionCallCallback(e){if(!e.function_name)return;const t=this._functionCallCallbacks[e.function_name];t&&t({functionName:e.function_name??"",arguments:e.arguments??{}}).then(t=>{null!=t&&this._sendMessage(new we(ge.LLM_FUNCTION_CALL_RESULT,{function_name:e.function_name,tool_call_id:e.tool_call_id,arguments:e.arguments??{},result:t}))}).catch(e=>{Ae.error("Error in function call callback",e)})}}ze([ke],Ve.prototype,"startBot",null),ze([ke],Ve.prototype,"connect",null),ze([ke],Ve.prototype,"startBotAndConnect",null),ze([Me],Ve.prototype,"sendClientMessage",null),ze([Me],Ve.prototype,"sendUIEvent",null),ze([Me],Ve.prototype,"cancelUIJobGroup",null),ze([Me],Ve.prototype,"sendClientRequest",null),ze([Me],Ve.prototype,"appendToContext",null),ze([Me],Ve.prototype,"sendText",null),ze([Me],Ve.prototype,"disconnectBot",null),y(k,E),y(k,Y),y(k,Ee),y(k,Be),y(k,Oe),y(k,Pe),y(k,Ie);export{q as A11ySnapshotStreamer,ve as AggregationType,oe as BotAlreadyStartedError,ie as BotNotReadyError,te as ConnectionTimeoutError,de as DeviceError,ne as InvalidTransportParamsError,Te as LogLevel,xe as MessageDispatcher,ce as MessageTooLargeError,Ve as PipecatClient,ee as RTVIError,le as RTVIEvent,we as RTVIMessage,ge as RTVIMessageType,be as RTVI_MESSAGE_LABEL,me as RTVI_PROTOCOL_VERSION,re as StartBotError,Ne as Transport,se as TransportStartError,K as TransportStateEnum,Ue as TransportWrapper,ae as UnsupportedFeatureError,O as findElementByRef,R as findRefForElement,Re as isAPIRequest,De as learnAboutClient,Ae as logger,Fe as makeRequest,je as messageSizeWithinLimit,G as serializeSelection,ye as setAboutClient,V as snapshotDocument};