@floe-ai/sdk 0.1.0-dev.38 → 0.1.0-dev.39

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,38 +1,38 @@
1
- var FloeSDK=function(fn){"use strict";var C_=Object.defineProperty;var E_=(fn,en,Pn)=>en in fn?C_(fn,en,{enumerable:!0,configurable:!0,writable:!0,value:Pn}):fn[en]=Pn;var D=(fn,en,Pn)=>E_(fn,typeof en!="symbol"?en+"":en,Pn);function en(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pn={exports:{}},Ur=typeof Reflect=="object"?Reflect:null,Md=Ur&&typeof Ur.apply=="function"?Ur.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},Vo;Ur&&typeof Ur.ownKeys=="function"?Vo=Ur.ownKeys:Object.getOwnPropertySymbols?Vo=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Vo=function(e){return Object.getOwnPropertyNames(e)};function jv(t){console&&console.warn&&console.warn(t)}var Ad=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}Pn.exports=ke,Pn.exports.once=Hv,ke.EventEmitter=ke,ke.prototype._events=void 0,ke.prototype._eventsCount=0,ke.prototype._maxListeners=void 0;var Od=10;function Ko(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return Od},set:function(t){if(typeof t!="number"||t<0||Ad(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Od=t}}),ke.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ad(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};function Dd(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return Dd(this)},ke.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(l===void 0)return!1;if(typeof l=="function")Md(l,this,n);else for(var c=l.length,d=Nd(l,c),r=0;r<c;++r)Md(d[r],this,n);return!0};function Pd(t,e,n,r){var i,o,s;if(Ko(n),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),s===void 0)s=o[e]=n,++t._eventsCount;else if(typeof s=="function"?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=Dd(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,jv(a)}return t}ke.prototype.addListener=function(e,n){return Pd(this,e,n,!1)},ke.prototype.on=ke.prototype.addListener,ke.prototype.prependListener=function(e,n){return Pd(this,e,n,!0)};function Bv(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ld(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=Bv.bind(r);return i.listener=n,r.wrapFn=i,i}ke.prototype.once=function(e,n){return Ko(n),this.on(e,Ld(this,e,n)),this},ke.prototype.prependOnceListener=function(e,n){return Ko(n),this.prependListener(e,Ld(this,e,n)),this},ke.prototype.removeListener=function(e,n){var r,i,o,s,a;if(Ko(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;o===0?r.shift():Uv(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this},ke.prototype.off=ke.prototype.removeListener,ke.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(i=n.length-1;i>=0;i--)this.removeListener(e,n[i]);return this};function Id(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?zv(i):Nd(i,i.length)}ke.prototype.listeners=function(e){return Id(this,e,!0)},ke.prototype.rawListeners=function(e){return Id(this,e,!1)},ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Rd.call(t,e)},ke.prototype.listenerCount=Rd;function Rd(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}ke.prototype.eventNames=function(){return this._eventsCount>0?Vo(this._events):[]};function Nd(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function Uv(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function zv(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function Hv(t,e){return new Promise(function(n,r){function i(s){t.removeListener(e,o),r(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),n([].slice.call(arguments))}$d(t,e,o,{once:!0}),e!=="error"&&Vv(t,i,{once:!0})})}function Vv(t,e,n){typeof t.on=="function"&&$d(t,"error",e,n)}function $d(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){r.once&&t.removeEventListener(e,i),n(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Kv=Pn.exports;const Wv=en(Kv);for(var Ke=[],Ya=0;Ya<256;++Ya)Ke.push((Ya+256).toString(16).slice(1));function qv(t,e=0){return(Ke[t[e+0]]+Ke[t[e+1]]+Ke[t[e+2]]+Ke[t[e+3]]+"-"+Ke[t[e+4]]+Ke[t[e+5]]+"-"+Ke[t[e+6]]+Ke[t[e+7]]+"-"+Ke[t[e+8]]+Ke[t[e+9]]+"-"+Ke[t[e+10]]+Ke[t[e+11]]+Ke[t[e+12]]+Ke[t[e+13]]+Ke[t[e+14]]+Ke[t[e+15]]).toLowerCase()}var Wo,Jv=new Uint8Array(16);function Gv(){if(!Wo&&(Wo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Wo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Wo(Jv)}var Qv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Fd={randomUUID:Qv};function Yv(t,e,n){if(Fd.randomUUID&&!e&&!t)return Fd.randomUUID();t=t||{};var r=t.random||(t.rng||Gv)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return qv(r)}const Xv={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"},jd={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"},Z={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},Qe={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"},Ln={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};class T{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";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 n=e.split(".").splice(0,2).map(o=>parseInt(o,10)||0);n.push(0);const r=n[0],i=n[1];if(r===10)switch(i){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 n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=T.getVersionPrecision(e),o=T.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=T.map([e,n],c=>{const d=s-T.getVersionPrecision(c),h=c+new Array(d+1).join(".0");return T.map(h.split("."),f=>new Array(20-f.length).join("0")+f).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(l=>{r[l]=s[l]})}return e}static getBrowserAlias(e){return Xv[e]}static getBrowserTypeByAlias(e){return jd[e]||""}}const ee=/version\/(\d+(\.?_?\d+)+)/i,Zv=[{test:[/gptbot/i],describe(t){const e={name:"GPTBot"},n=T.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/chatgpt-user/i],describe(t){const e={name:"ChatGPT-User"},n=T.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/oai-searchbot/i],describe(t){const e={name:"OAI-SearchBot"},n=T.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(t){const e={name:"ClaudeBot"},n=T.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/omgilibot/i,/webzio-extended/i],describe(t){const e={name:"Omgilibot"},n=T.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/diffbot/i],describe(t){const e={name:"Diffbot"},n=T.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/perplexitybot/i],describe(t){const e={name:"PerplexityBot"},n=T.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/perplexity-user/i],describe(t){const e={name:"Perplexity-User"},n=T.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/youbot/i],describe(t){const e={name:"YouBot"},n=T.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/meta-webindexer/i],describe(t){const e={name:"Meta-WebIndexer"},n=T.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/meta-externalads/i],describe(t){const e={name:"Meta-ExternalAds"},n=T.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/meta-externalagent/i],describe(t){const e={name:"Meta-ExternalAgent"},n=T.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/meta-externalfetcher/i],describe(t){const e={name:"Meta-ExternalFetcher"},n=T.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=T.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/linespider/i],describe(t){const e={name:"Linespider"},n=T.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/amazonbot/i],describe(t){const e={name:"AmazonBot"},n=T.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/bingbot/i],describe(t){const e={name:"BingCrawler"},n=T.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/baiduspider/i],describe(t){const e={name:"BaiduSpider"},n=T.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/duckduckbot/i],describe(t){const e={name:"DuckDuckBot"},n=T.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/ia_archiver/i],describe(t){const e={name:"InternetArchiveCrawler"},n=T.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(t){const e={name:"SlackBot"},n=T.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/yahoo!?[\s/]*slurp/i],describe(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe(){return{name:"PingdomBot"}}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=T.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/PaleMoon/i],describe(t){const e={name:"Pale Moon"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=T.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=T.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=T.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=T.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=T.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=T.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=T.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=T.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=T.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=T.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=T.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=T.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=T.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=T.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=T.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=T.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=T.getFirstMatch(ee,t)||T.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=T.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=T.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=T.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/librewolf/i],describe(t){const e={name:"LibreWolf"},n=T.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=T.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=T.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(t){const e={name:"Sogou Browser"},n=T.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,t),r=T.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),i=T.getFirstMatch(/se ([\d.]+)x/i,t),o=n||r||i;return o&&(e.version=o),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=T.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.hasBrand("DuckDuckGo")?!0:t.test(/\sDdg\/[\d.]+$/i)},describe(t,e){const n={name:"DuckDuckGo"};if(e){const i=e.getBrandVersion("DuckDuckGo");if(i)return n.version=i,n}const r=T.getFirstMatch(/\sDdg\/([\d.]+)$/i,t);return r&&(n.version=r),n}},{test(t){return t.hasBrand("Brave")},describe(t,e){const n={name:"Brave"};if(e){const r=e.getBrandVersion("Brave");if(r)return n.version=r,n}return n}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=T.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=T.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=T.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=T.getFirstMatch(ee,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=t.search("\\(")!==-1?n:e;return{name:T.getFirstMatch(i,t),version:T.getSecondMatch(i,t)}}}],eb=[{test:[/Roku\/DVP/],describe(t){const e=T.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Qe.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=T.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Qe.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=T.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=T.getWindowsVersionName(e);return{name:Qe.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Qe.iOS},n=T.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=T.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=T.getMacOSVersionName(e),r={name:Qe.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=T.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Qe.iOS,version:e}}},{test:[/OpenHarmony/i],describe(t){const e=T.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:Qe.HarmonyOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=T.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=T.getAndroidVersionName(e),r={name:Qe.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=T.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:Qe.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=T.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||T.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||T.getFirstMatch(/\bbb(\d+)/i,t);return{name:Qe.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=T.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Qe.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=T.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Qe.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Qe.Linux}}},{test:[/CrOS/],describe(){return{name:Qe.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=T.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Qe.PlayStation4,version:e}}}],tb=[{test:[/googlebot/i],describe(){return{type:Z.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:Z.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:Z.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:Z.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:Z.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:Z.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:Z.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:Z.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:Z.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:Z.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:Z.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:Z.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:Z.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:Z.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:Z.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:Z.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:Z.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:Z.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:Z.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:Z.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:Z.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:Z.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:Z.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:Z.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:Z.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(t){const e=T.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Z.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:Z.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:Z.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:Z.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:Z.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:Z.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:Z.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=T.getFirstMatch(/(ipod|iphone)/i,t);return{type:Z.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:Z.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=T.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:Z.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:Z.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:Z.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:Z.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:Z.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:Z.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:Z.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:Z.tv}}},{test:[/netcast/i],describe(){return{type:Z.tv}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:Z.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:Z.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:Z.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:Z.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:Z.tv}}}],nb=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Ln.Blink};const n=T.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Ln.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:Ln.Trident},n=T.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:Ln.Presto},n=T.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:Ln.Gecko},n=T.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Ln.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:Ln.WebKit},n=T.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class Bd{constructor(e,n=!1,r=null){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e;let i=!1;typeof n=="boolean"?(i=n,this._hints=r):n!=null&&typeof n=="object"?this._hints=n:this._hints=null,this.parsedResult={},i!==!0&&this.parse()}getHints(){return this._hints}hasBrand(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;const n=e.toLowerCase();return this._hints.brands.some(r=>r.brand&&r.brand.toLowerCase()===n)}getBrandVersion(e){if(!this._hints||!Array.isArray(this._hints.brands))return;const n=e.toLowerCase(),r=this._hints.brands.find(i=>i.brand&&i.brand.toLowerCase()===n);return r?r.version:void 0}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=T.find(Zv,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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=T.find(eb,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=T.find(tb,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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=T.find(nb,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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 T.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(a=>{const l=e[a];typeof l=="string"?(i[a]=l,o+=1):typeof l=="object"&&(n[a]=l,r+=1)}),r>0){const a=Object.keys(n),l=T.find(a,d=>this.isOS(d));if(l){const d=this.satisfies(n[l]);if(d!==void 0)return d}const c=T.find(a,d=>this.isPlatform(d));if(c){const d=this.satisfies(n[c]);if(d!==void 0)return d}}if(o>0){const a=Object.keys(i),l=T.find(a,c=>this.isBrowser(c,!0));if(l!==void 0)return this.compareVersion(i[l])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=T.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(T.compareVersions(o,r,i))>-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,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}}/*!
1
+ var FloeSDK=function(pn){"use strict";var C_=Object.defineProperty;var E_=(pn,tn,Pn)=>tn in pn?C_(pn,tn,{enumerable:!0,configurable:!0,writable:!0,value:Pn}):pn[tn]=Pn;var P=(pn,tn,Pn)=>E_(pn,typeof tn!="symbol"?tn+"":tn,Pn);function tn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pn={exports:{}},Ur=typeof Reflect=="object"?Reflect:null,Ad=Ur&&typeof Ur.apply=="function"?Ur.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},Vo;Ur&&typeof Ur.ownKeys=="function"?Vo=Ur.ownKeys:Object.getOwnPropertySymbols?Vo=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Vo=function(e){return Object.getOwnPropertyNames(e)};function jv(t){console&&console.warn&&console.warn(t)}var Od=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}Pn.exports=ke,Pn.exports.once=Hv,ke.EventEmitter=ke,ke.prototype._events=void 0,ke.prototype._eventsCount=0,ke.prototype._maxListeners=void 0;var Dd=10;function Ko(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return Dd},set:function(t){if(typeof t!="number"||t<0||Od(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Dd=t}}),ke.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Od(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};function Ld(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return Ld(this)},ke.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(l===void 0)return!1;if(typeof l=="function")Ad(l,this,n);else for(var c=l.length,d=$d(l,c),r=0;r<c;++r)Ad(d[r],this,n);return!0};function Pd(t,e,n,r){var i,o,s;if(Ko(n),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),s===void 0)s=o[e]=n,++t._eventsCount;else if(typeof s=="function"?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=Ld(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,jv(a)}return t}ke.prototype.addListener=function(e,n){return Pd(this,e,n,!1)},ke.prototype.on=ke.prototype.addListener,ke.prototype.prependListener=function(e,n){return Pd(this,e,n,!0)};function Bv(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Id(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=Bv.bind(r);return i.listener=n,r.wrapFn=i,i}ke.prototype.once=function(e,n){return Ko(n),this.on(e,Id(this,e,n)),this},ke.prototype.prependOnceListener=function(e,n){return Ko(n),this.prependListener(e,Id(this,e,n)),this},ke.prototype.removeListener=function(e,n){var r,i,o,s,a;if(Ko(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,o=s;break}if(o<0)return this;o===0?r.shift():Uv(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this},ke.prototype.off=ke.prototype.removeListener,ke.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(i=n.length-1;i>=0;i--)this.removeListener(e,n[i]);return this};function Rd(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?zv(i):$d(i,i.length)}ke.prototype.listeners=function(e){return Rd(this,e,!0)},ke.prototype.rawListeners=function(e){return Rd(this,e,!1)},ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Nd.call(t,e)},ke.prototype.listenerCount=Nd;function Nd(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}ke.prototype.eventNames=function(){return this._eventsCount>0?Vo(this._events):[]};function $d(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function Uv(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function zv(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function Hv(t,e){return new Promise(function(n,r){function i(s){t.removeListener(e,o),r(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),n([].slice.call(arguments))}Fd(t,e,o,{once:!0}),e!=="error"&&Vv(t,i,{once:!0})})}function Vv(t,e,n){typeof t.on=="function"&&Fd(t,"error",e,n)}function Fd(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){r.once&&t.removeEventListener(e,i),n(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Kv=Pn.exports;const Wv=tn(Kv);for(var Ke=[],Ya=0;Ya<256;++Ya)Ke.push((Ya+256).toString(16).slice(1));function qv(t,e=0){return(Ke[t[e+0]]+Ke[t[e+1]]+Ke[t[e+2]]+Ke[t[e+3]]+"-"+Ke[t[e+4]]+Ke[t[e+5]]+"-"+Ke[t[e+6]]+Ke[t[e+7]]+"-"+Ke[t[e+8]]+Ke[t[e+9]]+"-"+Ke[t[e+10]]+Ke[t[e+11]]+Ke[t[e+12]]+Ke[t[e+13]]+Ke[t[e+14]]+Ke[t[e+15]]).toLowerCase()}var Wo,Jv=new Uint8Array(16);function Gv(){if(!Wo&&(Wo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Wo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Wo(Jv)}var Qv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const jd={randomUUID:Qv};function Yv(t,e,n){if(jd.randomUUID&&!e&&!t)return jd.randomUUID();t=t||{};var r=t.random||(t.rng||Gv)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return qv(r)}const Xv={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"},Bd={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"},ee={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},Ye={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"},In={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};class M{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";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 n=e.split(".").splice(0,2).map(o=>parseInt(o,10)||0);n.push(0);const r=n[0],i=n[1];if(r===10)switch(i){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 n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=M.getVersionPrecision(e),o=M.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=M.map([e,n],c=>{const d=s-M.getVersionPrecision(c),h=c+new Array(d+1).join(".0");return M.map(h.split("."),f=>new Array(20-f.length).join("0")+f).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(l=>{r[l]=s[l]})}return e}static getBrowserAlias(e){return Xv[e]}static getBrowserTypeByAlias(e){return Bd[e]||""}}const te=/version\/(\d+(\.?_?\d+)+)/i,Zv=[{test:[/gptbot/i],describe(t){const e={name:"GPTBot"},n=M.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/chatgpt-user/i],describe(t){const e={name:"ChatGPT-User"},n=M.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/oai-searchbot/i],describe(t){const e={name:"OAI-SearchBot"},n=M.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(t){const e={name:"ClaudeBot"},n=M.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/omgilibot/i,/webzio-extended/i],describe(t){const e={name:"Omgilibot"},n=M.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/diffbot/i],describe(t){const e={name:"Diffbot"},n=M.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/perplexitybot/i],describe(t){const e={name:"PerplexityBot"},n=M.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/perplexity-user/i],describe(t){const e={name:"Perplexity-User"},n=M.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/youbot/i],describe(t){const e={name:"YouBot"},n=M.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/meta-webindexer/i],describe(t){const e={name:"Meta-WebIndexer"},n=M.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/meta-externalads/i],describe(t){const e={name:"Meta-ExternalAds"},n=M.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/meta-externalagent/i],describe(t){const e={name:"Meta-ExternalAgent"},n=M.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/meta-externalfetcher/i],describe(t){const e={name:"Meta-ExternalFetcher"},n=M.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=M.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/linespider/i],describe(t){const e={name:"Linespider"},n=M.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/amazonbot/i],describe(t){const e={name:"AmazonBot"},n=M.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/bingbot/i],describe(t){const e={name:"BingCrawler"},n=M.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/baiduspider/i],describe(t){const e={name:"BaiduSpider"},n=M.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/duckduckbot/i],describe(t){const e={name:"DuckDuckBot"},n=M.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/ia_archiver/i],describe(t){const e={name:"InternetArchiveCrawler"},n=M.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(t){const e={name:"SlackBot"},n=M.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/yahoo!?[\s/]*slurp/i],describe(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe(){return{name:"PingdomBot"}}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=M.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/PaleMoon/i],describe(t){const e={name:"Pale Moon"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=M.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=M.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=M.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=M.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=M.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=M.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=M.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=M.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=M.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=M.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=M.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=M.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=M.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=M.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=M.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=M.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=M.getFirstMatch(te,t)||M.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=M.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=M.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=M.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/librewolf/i],describe(t){const e={name:"LibreWolf"},n=M.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=M.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=M.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(t){const e={name:"Sogou Browser"},n=M.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,t),r=M.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),i=M.getFirstMatch(/se ([\d.]+)x/i,t),o=n||r||i;return o&&(e.version=o),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=M.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.hasBrand("DuckDuckGo")?!0:t.test(/\sDdg\/[\d.]+$/i)},describe(t,e){const n={name:"DuckDuckGo"};if(e){const i=e.getBrandVersion("DuckDuckGo");if(i)return n.version=i,n}const r=M.getFirstMatch(/\sDdg\/([\d.]+)$/i,t);return r&&(n.version=r),n}},{test(t){return t.hasBrand("Brave")},describe(t,e){const n={name:"Brave"};if(e){const r=e.getBrandVersion("Brave");if(r)return n.version=r,n}return n}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=M.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=M.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=M.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=M.getFirstMatch(te,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=t.search("\\(")!==-1?n:e;return{name:M.getFirstMatch(i,t),version:M.getSecondMatch(i,t)}}}],eb=[{test:[/Roku\/DVP/],describe(t){const e=M.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Ye.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=M.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Ye.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=M.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=M.getWindowsVersionName(e);return{name:Ye.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Ye.iOS},n=M.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=M.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=M.getMacOSVersionName(e),r={name:Ye.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=M.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Ye.iOS,version:e}}},{test:[/OpenHarmony/i],describe(t){const e=M.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:Ye.HarmonyOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=M.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=M.getAndroidVersionName(e),r={name:Ye.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=M.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:Ye.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=M.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||M.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||M.getFirstMatch(/\bbb(\d+)/i,t);return{name:Ye.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=M.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Ye.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=M.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Ye.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Ye.Linux}}},{test:[/CrOS/],describe(){return{name:Ye.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=M.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Ye.PlayStation4,version:e}}}],tb=[{test:[/googlebot/i],describe(){return{type:ee.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:ee.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:ee.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:ee.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:ee.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:ee.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:ee.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:ee.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:ee.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:ee.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:ee.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:ee.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:ee.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:ee.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:ee.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:ee.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:ee.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:ee.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:ee.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:ee.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:ee.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:ee.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:ee.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:ee.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:ee.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(t){const e=M.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:ee.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:ee.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:ee.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:ee.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:ee.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:ee.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:ee.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=M.getFirstMatch(/(ipod|iphone)/i,t);return{type:ee.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:ee.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=M.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:ee.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:ee.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:ee.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:ee.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:ee.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:ee.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:ee.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:ee.tv}}},{test:[/netcast/i],describe(){return{type:ee.tv}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:ee.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:ee.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:ee.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:ee.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:ee.tv}}}],nb=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:In.Blink};const n=M.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:In.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:In.Trident},n=M.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:In.Presto},n=M.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:In.Gecko},n=M.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:In.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:In.WebKit},n=M.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class Ud{constructor(e,n=!1,r=null){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e;let i=!1;typeof n=="boolean"?(i=n,this._hints=r):n!=null&&typeof n=="object"?this._hints=n:this._hints=null,this.parsedResult={},i!==!0&&this.parse()}getHints(){return this._hints}hasBrand(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;const n=e.toLowerCase();return this._hints.brands.some(r=>r.brand&&r.brand.toLowerCase()===n)}getBrandVersion(e){if(!this._hints||!Array.isArray(this._hints.brands))return;const n=e.toLowerCase(),r=this._hints.brands.find(i=>i.brand&&i.brand.toLowerCase()===n);return r?r.version:void 0}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=M.find(Zv,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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=M.find(eb,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=M.find(tb,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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=M.find(nb,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));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 M.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(a=>{const l=e[a];typeof l=="string"?(i[a]=l,o+=1):typeof l=="object"&&(n[a]=l,r+=1)}),r>0){const a=Object.keys(n),l=M.find(a,d=>this.isOS(d));if(l){const d=this.satisfies(n[l]);if(d!==void 0)return d}const c=M.find(a,d=>this.isPlatform(d));if(c){const d=this.satisfies(n[c]);if(d!==void 0)return d}}if(o>0){const a=Object.keys(i),l=M.find(a,c=>this.isBrowser(c,!0));if(l!==void 0)return this.compareVersion(i[l])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=M.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(M.compareVersions(o,r,i))>-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,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}}/*!
2
2
  * Bowser - a browser detector
3
3
  * https://github.com/bowser-js/bowser
4
4
  * MIT License | (c) Dustin Diaz 2012-2015
5
5
  * MIT License | (c) Denis Demchenko 2015-2019
6
- */class rb{static getParser(e,n=!1,r=null){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Bd(e,n,r)}static parse(e,n=null){return new Bd(e,n).getResult()}static get BROWSER_MAP(){return jd}static get ENGINE_MAP(){return Ln}static get OS_MAP(){return Qe}static get PLATFORMS_MAP(){return Z}}function tn(t,e){return Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t}function ib(t){return t&&t.__esModule?t.default:t}function xe(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var zr={},Ud={};xe(Ud,"PipecatClient",()=>At);var Hr={};Hr=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.6.1","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","@types/uuid":"^10.0.0","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":"^10.0.0"}}');var qo={},zd={};xe(zd,"TransportStateEnum",()=>Xa);var Xa;(function(t){t.DISCONNECTED="disconnected",t.INITIALIZING="initializing",t.INITIALIZED="initialized",t.AUTHENTICATING="authenticating",t.AUTHENTICATED="authenticated",t.CONNECTING="connecting",t.CONNECTED="connected",t.READY="ready",t.DISCONNECTING="disconnecting",t.ERROR="error"})(Xa||(Xa={}));var Bt={};xe(Bt,"RTVIError",()=>dt),xe(Bt,"ConnectionTimeoutError",()=>ob),xe(Bt,"StartBotError",()=>Hd),xe(Bt,"TransportStartError",()=>Vd),xe(Bt,"InvalidTransportParamsError",()=>sb),xe(Bt,"BotNotReadyError",()=>Kd),xe(Bt,"BotAlreadyStartedError",()=>Wd),xe(Bt,"UnsupportedFeatureError",()=>ab),xe(Bt,"MessageTooLargeError",()=>qd),xe(Bt,"DeviceError",()=>pn);class dt extends Error{constructor(e,n){super(e),this.status=n}}class ob extends dt{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class Hd extends dt{constructor(e,n){super(e??"Failed to connect / invalid auth bundle from base url",n??500),this.error="invalid-request-error"}}class Vd extends dt{constructor(e){super(e??"Unable to connect to transport")}}class sb extends dt{constructor(e){super(e??"Invalid transport connection parameters")}}class Kd extends dt{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class Wd extends dt{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class ab extends dt{constructor(e,n,r){let i=`${e} not supported${r?`: ${r}`:""}`;n&&(i=`${n} does not support ${e}${r?`: ${r}`:""}`),super(i),this.feature=e}}class qd extends dt{constructor(e){super(e??"Message size exceeds the maximum allowed limit for transport.")}}class pn extends dt{constructor(e,n,r,i){super(r??`Device error for ${e.join(", ")}: ${n}`),this.devices=e,this.type=n,this.details=i}}var Jd={};xe(Jd,"RTVIEvent",()=>X);var X;(function(t){t.Connected="connected",t.Disconnected="disconnected",t.TransportStateChanged="transportStateChanged",t.BotStarted="botStarted",t.BotConnected="botConnected",t.BotReady="botReady",t.BotDisconnected="botDisconnected",t.Error="error",t.ServerMessage="serverMessage",t.ServerResponse="serverResponse",t.MessageError="messageError",t.Metrics="metrics",t.BotStartedSpeaking="botStartedSpeaking",t.BotStoppedSpeaking="botStoppedSpeaking",t.UserStartedSpeaking="userStartedSpeaking",t.UserStoppedSpeaking="userStoppedSpeaking",t.UserMuteStarted="userMuteStarted",t.UserMuteStopped="userMuteStopped",t.UserTranscript="userTranscript",t.BotOutput="botOutput",t.BotTranscript="botTranscript",t.BotLlmText="botLlmText",t.BotLlmStarted="botLlmStarted",t.BotLlmStopped="botLlmStopped",t.LLMFunctionCall="llmFunctionCall",t.LLMFunctionCallStarted="llmFunctionCallStarted",t.LLMFunctionCallInProgress="llmFunctionCallInProgress",t.LLMFunctionCallStopped="llmFunctionCallStopped",t.BotLlmSearchResponse="botLlmSearchResponse",t.BotTtsText="botTtsText",t.BotTtsStarted="botTtsStarted",t.BotTtsStopped="botTtsStopped",t.ParticipantConnected="participantConnected",t.ParticipantLeft="participantLeft",t.TrackStarted="trackStarted",t.TrackStopped="trackStopped",t.ScreenTrackStarted="screenTrackStarted",t.ScreenTrackStopped="screenTrackStopped",t.ScreenShareError="screenShareError",t.LocalAudioLevel="localAudioLevel",t.RemoteAudioLevel="remoteAudioLevel",t.AvailableCamsUpdated="availableCamsUpdated",t.AvailableMicsUpdated="availableMicsUpdated",t.AvailableSpeakersUpdated="availableSpeakersUpdated",t.CamUpdated="camUpdated",t.MicUpdated="micUpdated",t.SpeakerUpdated="speakerUpdated",t.DeviceError="deviceError"})(X||(X={}));var ur={};xe(ur,"RTVI_PROTOCOL_VERSION",()=>Gd),xe(ur,"RTVI_MESSAGE_LABEL",()=>Qd),xe(ur,"RTVIMessageType",()=>se),xe(ur,"AggregationType",()=>Za),xe(ur,"setAboutClient",()=>Yd),xe(ur,"RTVIMessage",()=>Ue);const Gd="1.2.0",Qd="rtvi-ai";var se;(function(t){t.CLIENT_READY="client-ready",t.DISCONNECT_BOT="disconnect-bot",t.CLIENT_MESSAGE="client-message",t.SEND_TEXT="send-text",t.APPEND_TO_CONTEXT="append-to-context",t.BOT_READY="bot-ready",t.ERROR="error",t.METRICS="metrics",t.SERVER_MESSAGE="server-message",t.SERVER_RESPONSE="server-response",t.ERROR_RESPONSE="error-response",t.APPEND_TO_CONTEXT_RESULT="append-to-context-result",t.USER_STARTED_SPEAKING="user-started-speaking",t.USER_STOPPED_SPEAKING="user-stopped-speaking",t.BOT_STARTED_SPEAKING="bot-started-speaking",t.BOT_STOPPED_SPEAKING="bot-stopped-speaking",t.USER_MUTE_STARTED="user-mute-started",t.USER_MUTE_STOPPED="user-mute-stopped",t.USER_TRANSCRIPTION="user-transcription",t.BOT_OUTPUT="bot-output",t.BOT_TRANSCRIPTION="bot-transcription",t.USER_LLM_TEXT="user-llm-text",t.BOT_LLM_TEXT="bot-llm-text",t.BOT_LLM_STARTED="bot-llm-started",t.BOT_LLM_STOPPED="bot-llm-stopped",t.LLM_FUNCTION_CALL="llm-function-call",t.LLM_FUNCTION_CALL_STARTED="llm-function-call-started",t.LLM_FUNCTION_CALL_IN_PROGRESS="llm-function-call-in-progress",t.LLM_FUNCTION_CALL_STOPPED="llm-function-call-stopped",t.LLM_FUNCTION_CALL_RESULT="llm-function-call-result",t.BOT_LLM_SEARCH_RESPONSE="bot-llm-search-response",t.BOT_TTS_TEXT="bot-tts-text",t.BOT_TTS_STARTED="bot-tts-started",t.BOT_TTS_STOPPED="bot-tts-stopped"})(se||(se={}));var Za;(function(t){t.WORD="word",t.SENTENCE="sentence"})(Za||(Za={}));let Ii;function Yd(t){Ii?Ii={...Ii,...t}:Ii=t}class Ue{constructor(e,n,r){this.label=Qd,this.type=e,this.data=n,this.id=r||Yv().slice(0,8)}static clientReady(){return new Ue(se.CLIENT_READY,{version:Gd,about:Ii||{library:Hr.name,library_version:Hr.version}})}static disconnectBot(){return new Ue(se.DISCONNECT_BOT,{})}static error(e,n=!1){return new Ue(se.ERROR,{message:e,fatal:n})}}tn(qo,zd),tn(qo,Bt),tn(qo,Jd),tn(qo,ur);function Ri(t,e,n){const r=n.value;return n.value=function(...i){if(this.state==="ready")return r.apply(this,i);throw new Kd(`Attempt to call ${e.toString()} when transport not in ready state. Await connect() first.`)},n}function el(t,e,n){const r=n.value,i=["authenticating","connecting","connected","ready"];return n.value=function(...o){if(i.includes(this.state))throw new Wd(`Attempt to call ${e.toString()} when client already started. Please call disconnect() before starting again.`);return r.apply(this,o)},n}var Xd={};xe(Xd,"MessageDispatcher",()=>Zd);var tl={};xe(tl,"LogLevel",()=>In),xe(tl,"logger",()=>fe);var In;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"})(In||(In={}));class Vr{constructor(){this.level=In.DEBUG}static getInstance(){return Vr.instance||(Vr.instance=new Vr),Vr.instance}setLevel(e){this.level=e}debug(...e){this.level>=In.DEBUG&&console.debug(...e)}info(...e){this.level>=In.INFO&&console.info(...e)}warn(...e){this.level>=In.WARN&&console.warn(...e)}error(...e){this.level>=In.ERROR&&console.error(...e)}}const fe=Vr.getInstance();class Zd{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,n=se.CLIENT_MESSAGE,r=1e4){this._gcInterval||(this._gcInterval=setInterval(()=>{this._gc()},2e3));const i=new Ue(n,e),o=new Promise((s,a)=>{this._queue.push({message:i,timestamp:Date.now(),timeout:r,resolve:s,reject:a})});fe.debug("[MessageDispatcher] dispatch",i);try{this._sendMethod(i)}catch(s){return fe.error("[MessageDispatcher] Error sending message",s),Promise.reject(s)}return this._gc(),o}clearQueue(){this._queue=[]}_resolveReject(e,n=!0){const r=this._queue.find(i=>i.message.id===e.id);return r&&(n?(fe.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(fe.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(i=>i.message.id!==e.id),fe.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(n=>{const r=Date.now()-n.timestamp<n.timeout;return r||e.push(n),r}),e.forEach(n=>{n.message.type===se.CLIENT_MESSAGE&&n.reject(new Ue(se.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:n.message.data.t,data:n.message.data.d,fatal:!1}))}),fe.debug("[MessageDispatcher] GC",this._queue)}}var nl={};xe(nl,"isAPIRequest",()=>eh),xe(nl,"makeRequest",()=>th);function eh(t){if(typeof t=="object"&&t!==null&&Object.keys(t).includes("endpoint")){const e=t.endpoint;return typeof e=="string"||e instanceof URL||typeof Request<"u"&&e instanceof Request}return!1}async function th(t,e){e||(e=new AbortController);let n;return new Promise((r,i)=>{(async()=>{t.timeout&&(n=setTimeout(async()=>{e.abort(),i(new Error("Timed out"))},t.timeout));let o;typeof Request<"u"&&t.endpoint instanceof Request?(o=new Request(t.endpoint,{signal:e.signal}),t.requestData&&fe.warn("[Pipecat Client] requestData in APIRequest is ignored when endpoint is a Request object"),t.headers&&fe.warn("[Pipecat Client] headers in APIRequest is ignored when endpoint is a Request object")):o=new Request(t.endpoint,{method:"POST",mode:"cors",headers:new Headers({"Content-Type":"application/json",...Object.fromEntries((t.headers??new Headers).entries())}),body:JSON.stringify(t.requestData),signal:e.signal}),fe.debug(`[Pipecat Client] Fetching from ${o.url}`),fetch(o).then(s=>{if(fe.debug(`[Pipecat Client] Received response from ${o.url}`,s),!s.ok){i(s);return}return s.json()}).then(s=>{r(s)}).catch(s=>{fe.error(`[Pipecat Client] Error fetching: ${s}`),i(s)}).finally(()=>{n&&clearTimeout(n)})})()})}var rl={};xe(rl,"Transport",()=>nh),xe(rl,"TransportWrapper",()=>rh);class nh{constructor(){this._state="disconnected",this._maxMessageSize=65536}connect(e){this._abortController=new AbortController;let n=e;try{n=this._validateConnectionParams(e)}catch(r){throw new dt(`Invalid connection params: ${r.message}. Please check your connection params and try again.`)}return this._connect(n)}get startBotParams(){return this._startBotParams}set startBotParams(e){if(typeof Request<"u"&&e.endpoint instanceof Request){this._startBotParams={...e,endpoint:e.endpoint.clone()};return}this._startBotParams=e}disconnect(){return this._abortController&&this._abortController.abort(),this._disconnect()}get maxMessageSize(){return this._maxMessageSize}}class rh{constructor(e){this._transport=e,this._proxy=new Proxy(this._transport,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"initialize":o="Direct calls to initialize() are disabled and used internally by the PipecatClient.";break;case"initDevices":o="Direct calls to initDevices() are disabled. Please use the PipecatClient.initDevices() wrapper or let PipecatClient.connect() call it for you.";break;case"sendReadyMessage":o="Direct calls to sendReadyMessage() are disabled and used internally by the PipecatClient.";break;case"connect":o="Direct calls to connect() are disabled. Please use the PipecatClient.connect() wrapper.";break;case"disconnect":o="Direct calls to disconnect() are disabled. Please use the PipecatClient.disconnect() wrapper.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}var il={};xe(il,"learnAboutClient",()=>ih),xe(il,"messageSizeWithinLimit",()=>oh);function ih(){var n,r,i,o,s,a;let t={library:Hr.name,library_version:Hr.version,platform_details:{}},e=null;if((n=window==null?void 0:window.navigator)!=null&&n.userAgent)try{e=rb.parse(window.navigator.userAgent)}catch{}return(r=e==null?void 0:e.browser)!=null&&r.name&&(t.platform_details.browser=e.browser.name),((i=e==null?void 0:e.browser)==null?void 0:i.name)==="Safari"&&!e.browser.version?t.platform_details.browser_version="Web View":(o=e==null?void 0:e.browser)!=null&&o.version&&(t.platform_details.browser_version=e.browser.version),(s=e==null?void 0:e.platform)!=null&&s.type&&(t.platform_details.platform_type=e.platform.type),(a=e==null?void 0:e.engine)!=null&&a.name&&(t.platform_details.engine=e.engine.name),e!=null&&e.os&&(t.platform=e.os.name,t.platform_version=e.os.version),t}function oh(t,e){return(i=>{const o=JSON.stringify(i);return new TextEncoder().encode(o).length})(t)<=e}var Rn=function(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,n,o):s(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};class lb extends Wv{}class At extends lb{constructor(e){super(),this._functionCallCallbacks={},this._botTranscriptionWarned=!1,this._llmFunctionCallWarned=!1,Yd(ih()),this._transport=e.transport,this._transportWrapper=new rh(this._transport);const n={...e.callbacks,onMessageError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMessageError)==null||o.call(i,r),this.emit(X.MessageError,r)},onError:r=>{var o,s,a;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onError)==null||s.call(o,r);try{this.emit(X.Error,r)}catch(l){l instanceof Error&&l.message.includes("Unhandled error")?(a=e==null?void 0:e.callbacks)!=null&&a.onError||fe.debug("No onError callback registered to handle error",r):fe.debug("Could not emit error",r,l)}const i=r.data;i!=null&&i.fatal&&(fe.error("Fatal error reported. Disconnecting..."),this.disconnect())},onConnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onConnected)==null||i.call(r),this.emit(X.Connected)},onDisconnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onDisconnected)==null||i.call(r),this.emit(X.Disconnected)},onTransportStateChanged:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onTransportStateChanged)==null||o.call(i,r),this.emit(X.TransportStateChanged,r)},onParticipantJoined:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantJoined)==null||o.call(i,r),this.emit(X.ParticipantConnected,r)},onParticipantLeft:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantLeft)==null||o.call(i,r),this.emit(X.ParticipantLeft,r)},onTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStarted)==null||s.call(o,r,i),this.emit(X.TrackStarted,r,i)},onTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStopped)==null||s.call(o,r,i),this.emit(X.TrackStopped,r,i)},onScreenTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStarted)==null||s.call(o,r,i),this.emit(X.ScreenTrackStarted,r,i)},onScreenTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStopped)==null||s.call(o,r,i),this.emit(X.ScreenTrackStopped,r,i)},onScreenShareError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onScreenShareError)==null||o.call(i,r),this.emit(X.ScreenShareError,r)},onAvailableCamsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableCamsUpdated)==null||o.call(i,r),this.emit(X.AvailableCamsUpdated,r)},onAvailableMicsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableMicsUpdated)==null||o.call(i,r),this.emit(X.AvailableMicsUpdated,r)},onAvailableSpeakersUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableSpeakersUpdated)==null||o.call(i,r),this.emit(X.AvailableSpeakersUpdated,r)},onCamUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onCamUpdated)==null||o.call(i,r),this.emit(X.CamUpdated,r)},onMicUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMicUpdated)==null||o.call(i,r),this.emit(X.MicUpdated,r)},onSpeakerUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onSpeakerUpdated)==null||o.call(i,r),this.emit(X.SpeakerUpdated,r)},onDeviceError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onDeviceError)==null||o.call(i,r),this.emit(X.DeviceError,r)},onBotStarted:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotStarted)==null||o.call(i,r),this.emit(X.BotStarted,r)},onBotConnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotConnected)==null||o.call(i,r),this.emit(X.BotConnected,r)},onBotReady:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotReady)==null||o.call(i,r),this.emit(X.BotReady,r)},onBotDisconnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotDisconnected)==null||o.call(i,r),this.emit(X.BotDisconnected,r)},onUserStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStartedSpeaking)==null||i.call(r),this.emit(X.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStoppedSpeaking)==null||i.call(r),this.emit(X.UserStoppedSpeaking)},onBotStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStartedSpeaking)==null||i.call(r),this.emit(X.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStoppedSpeaking)==null||i.call(r),this.emit(X.BotStoppedSpeaking)},onRemoteAudioLevel:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onRemoteAudioLevel)==null||s.call(o,r,i),this.emit(X.RemoteAudioLevel,r,i)},onLocalAudioLevel:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onLocalAudioLevel)==null||o.call(i,r),this.emit(X.LocalAudioLevel,r)},onUserMuteStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserMuteStarted)==null||i.call(r),this.emit(X.UserMuteStarted)},onUserMuteStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserMuteStopped)==null||i.call(r),this.emit(X.UserMuteStopped)},onUserTranscript:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onUserTranscript)==null||o.call(i,r),this.emit(X.UserTranscript,r)},onBotOutput:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotOutput)==null||o.call(i,r),this.emit(X.BotOutput,r)},onBotTranscript:r=>{var i,o;this._botTranscriptionWarned||(fe.warn("[Pipecat Client] Bot transcription is deprecated. Please use the onBotOutput instead."),this._botTranscriptionWarned=!0),(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTranscript)==null||o.call(i,r),this.emit(X.BotTranscript,r)},onBotLlmText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotLlmText)==null||o.call(i,r),this.emit(X.BotLlmText,r)},onBotLlmStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStarted)==null||i.call(r),this.emit(X.BotLlmStarted)},onBotLlmStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStopped)==null||i.call(r),this.emit(X.BotLlmStopped)},onBotTtsText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTtsText)==null||o.call(i,r),this.emit(X.BotTtsText,r)},onBotTtsStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStarted)==null||i.call(r),this.emit(X.BotTtsStarted)},onBotTtsStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStopped)==null||i.call(r),this.emit(X.BotTtsStopped)}};this._options={...e,callbacks:n,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),fe.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){fe.setLevel(e)}async initDevices(){fe.debug("[Pipecat Client] Initializing devices..."),await this._transport.initDevices()}async startBot(e){var r,i,o,s;this._transport.state==="disconnected"&&await this._transport.initDevices(),this._transport.state="authenticating",this._transport.startBotParams=e,this._abortController=new AbortController;let n;try{n=await th(e,this._abortController)}catch(a){let l="An unknown error occurred while starting the bot.",c;if(a instanceof Response){const d=await a.json();l=d.info??d.detail??a.statusText,c=a.status}else a instanceof Error&&(l=a.message);throw(i=(r=this._options.callbacks)==null?void 0:r.onError)==null||i.call(r,new Ue(se.ERROR_RESPONSE,{message:l,fatal:!0})),new Hd(l,c)}return this._transport.state="authenticated",(s=(o=this._options.callbacks)==null?void 0:o.onBotStarted)==null||s.call(o,n),n}async connect(e){return e&&eh(e)?(fe.warn("Calling connect with an API endpoint is deprecated. Use startBotAndConnect() instead."),this.startBotAndConnect(e)):new Promise((n,r)=>{(async()=>{this._connectResolve=n,this._transport.state==="disconnected"&&await this._transport.initDevices();try{await this._transport.connect(e),await this._transport.sendReadyMessage()}catch(i){this.disconnect(),r(i);return}})()})}async startBotAndConnect(e){const n=await this.startBot(e);return this.connect(n)}async disconnect(){await this._transport.disconnect(),this._messageDispatcher.disconnect()}_initialize(){this._transport.initialize(this._options,this.handleMessage.bind(this)),this._messageDispatcher=new Zd(this._sendMessage.bind(this))}_sendMessage(e){var n,r,i,o,s,a;if(!oh(e,this._transport.maxMessageSize)){const l=`Message data too large. Max size is ${this._transport.maxMessageSize}`;throw(r=(n=this._options.callbacks)==null?void 0:n.onError)==null||r.call(n,Ue.error(l,!1)),new qd(l)}try{this._transport.sendMessage(e)}catch(l){throw l instanceof Error?(o=(i=this._options.callbacks)==null?void 0:i.onError)==null||o.call(i,Ue.error(l.message,!1)):(a=(s=this._options.callbacks)==null?void 0:s.onError)==null||a.call(s,Ue.error("Unknown error sending message",!1)),l}}get connected(){return["connected","ready"].includes(this._transport.state)}get transport(){return this._transportWrapper.proxy}get state(){return this._transport.state}get version(){return ib(Hr).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(){return this._transport.selectedCam}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){this._transport.enableCam(e)}get isCamEnabled(){return this._transport.isCamEnabled}tracks(){return this._transport.tracks()}enableScreenShare(e){return this._transport.enableScreenShare(e)}get isSharingScreen(){return this._transport.isSharingScreen}sendClientMessage(e,n){this._sendMessage(new Ue(se.CLIENT_MESSAGE,{t:e,d:n}))}async sendClientRequest(e,n,r){const i={t:e,d:n};return(await this._messageDispatcher.dispatch(i,se.CLIENT_MESSAGE,r)).data.d}registerFunctionCallHandler(e,n){this._functionCallCallbacks[e]=n}unregisterFunctionCallHandler(e){delete this._functionCallCallbacks[e]}unregisterAllFunctionCallHandlers(){this._functionCallCallbacks={}}async appendToContext(e){return fe.warn("appendToContext() is deprecated. Use sendText() instead."),await this._sendMessage(new Ue(se.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,n={}){await this._sendMessage(new Ue(se.SEND_TEXT,{content:e,options:n}))}disconnectBot(){this._sendMessage(new Ue(se.DISCONNECT_BOT,{}))}handleMessage(e){var n,r,i,o,s,a,l,c,d,h,f,v,b,g,S,m,w,k,C,M,P,L,F,Y,W,H,Q,q,ae,J,K,re,j,z,B,le,we,u,y,p,x,_,O,I,$,U,ne,he,ut,dn,hn,$e;switch(fe.debug("[RTVI Message]",e),e.type){case se.BOT_READY:{const ce=e.data,Zt=ce.version?ce.version.split(".").map(Number):[0,0,0];fe.debug(`[Pipecat Client] Bot is ready. Version: ${ce.version}`),Zt[0]<1&&fe.warn("[Pipecat Client] Bot version is less than 1.0.0, which may not be compatible with this client."),(n=this._connectResolve)==null||n.call(this,e.data),(i=(r=this._options.callbacks)==null?void 0:r.onBotReady)==null||i.call(r,e.data);break}case se.ERROR:(s=(o=this._options.callbacks)==null?void 0:o.onError)==null||s.call(o,e);break;case se.SERVER_RESPONSE:this._messageDispatcher.resolve(e);break;case se.ERROR_RESPONSE:{const ce=this._messageDispatcher.reject(e);(l=(a=this._options.callbacks)==null?void 0:a.onMessageError)==null||l.call(a,ce);break}case se.USER_STARTED_SPEAKING:(d=(c=this._options.callbacks)==null?void 0:c.onUserStartedSpeaking)==null||d.call(c);break;case se.USER_STOPPED_SPEAKING:(f=(h=this._options.callbacks)==null?void 0:h.onUserStoppedSpeaking)==null||f.call(h);break;case se.BOT_STARTED_SPEAKING:(b=(v=this._options.callbacks)==null?void 0:v.onBotStartedSpeaking)==null||b.call(v);break;case se.BOT_STOPPED_SPEAKING:(S=(g=this._options.callbacks)==null?void 0:g.onBotStoppedSpeaking)==null||S.call(g);break;case se.USER_MUTE_STARTED:(w=(m=this._options.callbacks)==null?void 0:m.onUserMuteStarted)==null||w.call(m);break;case se.USER_MUTE_STOPPED:(C=(k=this._options.callbacks)==null?void 0:k.onUserMuteStopped)==null||C.call(k);break;case se.USER_TRANSCRIPTION:{const ce=e.data;(P=(M=this._options.callbacks)==null?void 0:M.onUserTranscript)==null||P.call(M,ce);break}case se.BOT_OUTPUT:(F=(L=this._options.callbacks)==null?void 0:L.onBotOutput)==null||F.call(L,e.data);break;case se.BOT_TRANSCRIPTION:(W=(Y=this._options.callbacks)==null?void 0:Y.onBotTranscript)==null||W.call(Y,e.data);break;case se.BOT_LLM_TEXT:(Q=(H=this._options.callbacks)==null?void 0:H.onBotLlmText)==null||Q.call(H,e.data);break;case se.BOT_LLM_STARTED:(ae=(q=this._options.callbacks)==null?void 0:q.onBotLlmStarted)==null||ae.call(q);break;case se.BOT_LLM_STOPPED:(K=(J=this._options.callbacks)==null?void 0:J.onBotLlmStopped)==null||K.call(J);break;case se.BOT_TTS_TEXT:(j=(re=this._options.callbacks)==null?void 0:re.onBotTtsText)==null||j.call(re,e.data);break;case se.BOT_TTS_STARTED:(B=(z=this._options.callbacks)==null?void 0:z.onBotTtsStarted)==null||B.call(z);break;case se.BOT_TTS_STOPPED:(we=(le=this._options.callbacks)==null?void 0:le.onBotTtsStopped)==null||we.call(le);break;case se.METRICS:(y=(u=this._options.callbacks)==null?void 0:u.onMetrics)==null||y.call(u,e.data),this.emit(X.Metrics,e.data);break;case se.SERVER_MESSAGE:(x=(p=this._options.callbacks)==null?void 0:p.onServerMessage)==null||x.call(p,e.data),this.emit(X.ServerMessage,e.data);break;case se.LLM_FUNCTION_CALL_STARTED:{const ce=e.data;(O=(_=this._options.callbacks)==null?void 0:_.onLLMFunctionCallStarted)==null||O.call(_,ce),this.emit(X.LLMFunctionCallStarted,ce);break}case se.LLM_FUNCTION_CALL_IN_PROGRESS:{const ce=e.data;this._maybeTriggerFunctionCallCallback(ce),($=(I=this._options.callbacks)==null?void 0:I.onLLMFunctionCallInProgress)==null||$.call(I,ce),this.emit(X.LLMFunctionCallInProgress,ce);break}case se.LLM_FUNCTION_CALL_STOPPED:{const ce=e.data;(ne=(U=this._options.callbacks)==null?void 0:U.onLLMFunctionCallStopped)==null||ne.call(U,ce),this.emit(X.LLMFunctionCallStopped,ce);break}case se.LLM_FUNCTION_CALL:{const ce=e.data,Zt={function_name:ce.function_name,tool_call_id:ce.tool_call_id,arguments:ce.args};this._maybeTriggerFunctionCallCallback(Zt),(he=this._options.callbacks)!=null&&he.onLLMFunctionCall&&(this._llmFunctionCallWarned||(fe.warn("[Pipecat Client] onLLMFunctionCall is deprecated. Please use onLLMFunctionCallInProgress instead."),this._llmFunctionCallWarned=!0)),(dn=(ut=this._options.callbacks)==null?void 0:ut.onLLMFunctionCall)==null||dn.call(ut,ce),this.emit(X.LLMFunctionCall,ce);break}case se.BOT_LLM_SEARCH_RESPONSE:{const ce=e.data;($e=(hn=this._options.callbacks)==null?void 0:hn.onBotLlmSearchResponse)==null||$e.call(hn,ce),this.emit(X.BotLlmSearchResponse,ce);break}default:fe.debug("[Pipecat Client] Unrecognized message type",e.type);break}}_maybeTriggerFunctionCallCallback(e){if(!e.function_name)return;const n=this._functionCallCallbacks[e.function_name];if(n){const r={functionName:e.function_name??"",arguments:e.arguments??{}};n(r).then(i=>{i!=null&&this._sendMessage(new Ue(se.LLM_FUNCTION_CALL_RESULT,{function_name:e.function_name,tool_call_id:e.tool_call_id,arguments:e.arguments??{},result:i}))}).catch(i=>{fe.error("Error in function call callback",i)})}}}Rn([el],At.prototype,"startBot",null),Rn([el],At.prototype,"connect",null),Rn([el],At.prototype,"startBotAndConnect",null),Rn([Ri],At.prototype,"sendClientMessage",null),Rn([Ri],At.prototype,"sendClientRequest",null),Rn([Ri],At.prototype,"appendToContext",null),Rn([Ri],At.prototype,"sendText",null),Rn([Ri],At.prototype,"disconnectBot",null),tn(zr,Ud),tn(zr,Xd),tn(zr,tl),tn(zr,nl),tn(zr,rl),tn(zr,il);function sh(t,e){if(t==null)return{};var n,r,i=function(s,a){if(s==null)return{};var l={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.indexOf(c)!==-1)continue;l[c]=s[c]}return l}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function me(t){return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},me(t)}function ah(t){var e=function(n,r){if(me(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r);if(me(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return me(e)=="symbol"?e:e+""}function lh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ah(r.key),r)}}function bt(t,e,n){return e&&lh(t.prototype,e),n&&lh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jo(t,e){if(e&&(me(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(t)}function Ut(t){return Ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ut(t)}function Ni(t,e){return Ni=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ni(t,e)}function Go(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ni(t,e)}function nn(t,e,n){return(e=ah(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ch(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(c){return void n(c)}a.done?e(l):Promise.resolve(l).then(r,i)}function te(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(l){ch(o,r,i,s,a,"next",l)}function a(l){ch(o,r,i,s,a,"throw",l)}s(void 0)})}}function uh(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ye(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,s,a,l,c=[],d=!0,h=!1;try{if(a=(i=i.call(n)).next,r===0){if(Object(i)!==i)return;d=!1}else for(;!(d=(o=a.call(i)).done)&&(c.push(o.value),c.length!==r);d=!0);}catch(f){h=!0,s=f}finally{try{if(!d&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(h)throw s}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return uh(n,r);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?uh(n,r):void 0}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function cb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var dh,Qo={exports:{}},ol=function(){if(dh)return Qo.exports;dh=1;var t,e=typeof Reflect=="object"?Reflect:null,n=e&&typeof e.apply=="function"?e.apply:function(g,S,m){return Function.prototype.apply.call(g,S,m)};t=e&&typeof e.ownKeys=="function"?e.ownKeys:Object.getOwnPropertySymbols?function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:function(g){return Object.getOwnPropertyNames(g)};var r=Number.isNaN||function(g){return g!=g};function i(){i.init.call(this)}Qo.exports=i,Qo.exports.once=function(g,S){return new Promise(function(m,w){function k(M){g.removeListener(S,C),w(M)}function C(){typeof g.removeListener=="function"&&g.removeListener("error",k),m([].slice.call(arguments))}b(g,S,C,{once:!0}),S!=="error"&&function(M,P,L){typeof M.on=="function"&&b(M,"error",P,L)}(g,k,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function s(g){if(typeof g!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof g)}function a(g){return g._maxListeners===void 0?i.defaultMaxListeners:g._maxListeners}function l(g,S,m,w){var k,C,M,P;if(s(m),(C=g._events)===void 0?(C=g._events=Object.create(null),g._eventsCount=0):(C.newListener!==void 0&&(g.emit("newListener",S,m.listener?m.listener:m),C=g._events),M=C[S]),M===void 0)M=C[S]=m,++g._eventsCount;else if(typeof M=="function"?M=C[S]=w?[m,M]:[M,m]:w?M.unshift(m):M.push(m),(k=a(g))>0&&M.length>k&&!M.warned){M.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=g,L.type=S,L.count=M.length,P=L,console&&console.warn&&console.warn(P)}return g}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(g,S,m){var w={fired:!1,wrapFn:void 0,target:g,type:S,listener:m},k=c.bind(w);return k.listener=m,w.wrapFn=k,k}function h(g,S,m){var w=g._events;if(w===void 0)return[];var k=w[S];return k===void 0?[]:typeof k=="function"?m?[k.listener||k]:[k]:m?function(C){for(var M=new Array(C.length),P=0;P<M.length;++P)M[P]=C[P].listener||C[P];return M}(k):v(k,k.length)}function f(g){var S=this._events;if(S!==void 0){var m=S[g];if(typeof m=="function")return 1;if(m!==void 0)return m.length}return 0}function v(g,S){for(var m=new Array(S),w=0;w<S;++w)m[w]=g[w];return m}function b(g,S,m,w){if(typeof g.on=="function")w.once?g.once(S,m):g.on(S,m);else{if(typeof g.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof g);g.addEventListener(S,function k(C){w.once&&g.removeEventListener(S,k),m(C)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(g){if(typeof g!="number"||g<0||r(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");o=g}}),i.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||r(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(g){for(var S=[],m=1;m<arguments.length;m++)S.push(arguments[m]);var w=g==="error",k=this._events;if(k!==void 0)w=w&&k.error===void 0;else if(!w)return!1;if(w){var C;if(S.length>0&&(C=S[0]),C instanceof Error)throw C;var M=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw M.context=C,M}var P=k[g];if(P===void 0)return!1;if(typeof P=="function")n(P,this,S);else{var L=P.length,F=v(P,L);for(m=0;m<L;++m)n(F[m],this,S)}return!0},i.prototype.addListener=function(g,S){return l(this,g,S,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(g,S){return l(this,g,S,!0)},i.prototype.once=function(g,S){return s(S),this.on(g,d(this,g,S)),this},i.prototype.prependOnceListener=function(g,S){return s(S),this.prependListener(g,d(this,g,S)),this},i.prototype.removeListener=function(g,S){var m,w,k,C,M;if(s(S),(w=this._events)===void 0)return this;if((m=w[g])===void 0)return this;if(m===S||m.listener===S)--this._eventsCount==0?this._events=Object.create(null):(delete w[g],w.removeListener&&this.emit("removeListener",g,m.listener||S));else if(typeof m!="function"){for(k=-1,C=m.length-1;C>=0;C--)if(m[C]===S||m[C].listener===S){M=m[C].listener,k=C;break}if(k<0)return this;k===0?m.shift():function(P,L){for(;L+1<P.length;L++)P[L]=P[L+1];P.pop()}(m,k),m.length===1&&(w[g]=m[0]),w.removeListener!==void 0&&this.emit("removeListener",g,M||S)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(g){var S,m,w;if((m=this._events)===void 0)return this;if(m.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):m[g]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete m[g]),this;if(arguments.length===0){var k,C=Object.keys(m);for(w=0;w<C.length;++w)(k=C[w])!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(S=m[g])=="function")this.removeListener(g,S);else if(S!==void 0)for(w=S.length-1;w>=0;w--)this.removeListener(g,S[w]);return this},i.prototype.listeners=function(g){return h(this,g,!0)},i.prototype.rawListeners=function(g){return h(this,g,!1)},i.listenerCount=function(g,S){return typeof g.listenerCount=="function"?g.listenerCount(S):f.call(g,S)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},Qo.exports}(),Yo=cb(ol),hh=Object.prototype.hasOwnProperty;function fh(t,e,n){for(n of t.keys())if(rt(n,e))return n}function rt(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&rt(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if((i=r)&&typeof i=="object"&&!(i=fh(e,i))||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if((i=r[0])&&typeof i=="object"&&!(i=fh(e,i))||!rt(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){for(n in r=0,t)if(hh.call(t,n)&&++r&&!hh.call(e,n)||!(n in e)||!rt(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!=t&&e!=e}const ub={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},ph={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Re={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},it={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Nn={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};let R=class Li{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))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 n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),n[0]===10)switch(n[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}}static getAndroidVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5))return n[0]===1&&n[1]<6?"Cupcake":n[0]===1&&n[1]>=6?"Donut":n[0]===2&&n[1]<2?"Eclair":n[0]===2&&n[1]===2?"Froyo":n[0]===2&&n[1]>2?"Gingerbread":n[0]===3?"Honeycomb":n[0]===4&&n[1]<1?"Ice Cream Sandwich":n[0]===4&&n[1]<4?"Jelly Bean":n[0]===4&&n[1]>=4?"KitKat":n[0]===5?"Lollipop":n[0]===6?"Marshmallow":n[0]===7?"Nougat":n[0]===8?"Oreo":n[0]===9?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=Li.getVersionPrecision(e),o=Li.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=Li.map([e,n],c=>{const d=s-Li.getVersionPrecision(c),h=c+new Array(d+1).join(".0");return Li.map(h.split("."),f=>new Array(20-f.length).join("0")+f).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(a=>{r[a]=s[a]})}return e}static getBrowserAlias(e){return ub[e]}static getBrowserTypeByAlias(e){return ph[e]||""}};const _e=/version\/(\d+(\.?_?\d+)+)/i,db=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=R.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=R.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=R.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=R.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=R.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=R.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=R.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=R.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=R.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=R.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=R.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=R.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=R.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=R.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=R.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=R.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=R.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=R.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=R.getFirstMatch(_e,t)||R.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=R.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=R.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=R.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=R.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=R.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=R.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=R.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=R.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=R.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=R.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:R.getFirstMatch(e,t),version:R.getSecondMatch(e,t)}}}];var hb=[{test:[/Roku\/DVP/],describe(t){const e=R.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:it.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=R.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:it.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=R.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=R.getWindowsVersionName(e);return{name:it.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:it.iOS},n=R.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=R.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=R.getMacOSVersionName(e),r={name:it.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=R.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:it.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=R.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=R.getAndroidVersionName(e),r={name:it.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=R.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:it.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=R.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||R.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||R.getFirstMatch(/\bbb(\d+)/i,t);return{name:it.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=R.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:it.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=R.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:it.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:it.Linux})},{test:[/CrOS/],describe:()=>({name:it.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=R.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:it.PlayStation4,version:e}}}],fb=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=R.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Re.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Re.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Re.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Re.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Re.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Re.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Re.tablet})},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=R.getFirstMatch(/(ipod|iphone)/i,t);return{type:Re.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Re.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Re.mobile})},{test:t=>t.getBrowserName(!0)==="blackberry",describe:()=>({type:Re.mobile,vendor:"BlackBerry"})},{test:t=>t.getBrowserName(!0)==="bada",describe:()=>({type:Re.mobile})},{test:t=>t.getBrowserName()==="windows phone",describe:()=>({type:Re.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe:()=>({type:Re.tablet})},{test:t=>t.getOSName(!0)==="android",describe:()=>({type:Re.mobile})},{test:t=>t.getOSName(!0)==="macos",describe:()=>({type:Re.desktop,vendor:"Apple"})},{test:t=>t.getOSName(!0)==="windows",describe:()=>({type:Re.desktop})},{test:t=>t.getOSName(!0)==="linux",describe:()=>({type:Re.desktop})},{test:t=>t.getOSName(!0)==="playstation 4",describe:()=>({type:Re.tv})},{test:t=>t.getOSName(!0)==="roku",describe:()=>({type:Re.tv})}],pb=[{test:t=>t.getBrowserName(!0)==="microsoft edge",describe(t){if(/\sedg\//i.test(t))return{name:Nn.Blink};const e=R.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Nn.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:Nn.Trident},n=R.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:Nn.Presto},n=R.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:Nn.Gecko},n=R.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Nn.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:Nn.WebKit},n=R.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];let gh=class{constructor(e,n=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=R.find(db,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),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=R.find(hb,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));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:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=R.find(fb,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));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=R.find(pb,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));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 R.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(s=>{const a=e[s];typeof a=="string"?(i[s]=a,o+=1):typeof a=="object"&&(n[s]=a,r+=1)}),r>0){const s=Object.keys(n),a=R.find(s,c=>this.isOS(c));if(a){const c=this.satisfies(n[a]);if(c!==void 0)return c}const l=R.find(s,c=>this.isPlatform(c));if(l){const c=this.satisfies(n[l]);if(c!==void 0)return c}}if(o>0){const s=Object.keys(i),a=R.find(s,l=>this.isBrowser(l,!0));if(a!==void 0)return this.compareVersion(i[a])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=R.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(R.compareVersions(o,r,i))>-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,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}};/*!
6
+ */class rb{static getParser(e,n=!1,r=null){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Ud(e,n,r)}static parse(e,n=null){return new Ud(e,n).getResult()}static get BROWSER_MAP(){return Bd}static get ENGINE_MAP(){return In}static get OS_MAP(){return Ye}static get PLATFORMS_MAP(){return ee}}function nn(t,e){return Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t}function ib(t){return t&&t.__esModule?t.default:t}function xe(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var zr={},zd={};xe(zd,"PipecatClient",()=>At);var Hr={};Hr=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.6.1","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","@types/uuid":"^10.0.0","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":"^10.0.0"}}');var qo={},Hd={};xe(Hd,"TransportStateEnum",()=>Xa);var Xa;(function(t){t.DISCONNECTED="disconnected",t.INITIALIZING="initializing",t.INITIALIZED="initialized",t.AUTHENTICATING="authenticating",t.AUTHENTICATED="authenticated",t.CONNECTING="connecting",t.CONNECTED="connected",t.READY="ready",t.DISCONNECTING="disconnecting",t.ERROR="error"})(Xa||(Xa={}));var Bt={};xe(Bt,"RTVIError",()=>ht),xe(Bt,"ConnectionTimeoutError",()=>ob),xe(Bt,"StartBotError",()=>Vd),xe(Bt,"TransportStartError",()=>Kd),xe(Bt,"InvalidTransportParamsError",()=>sb),xe(Bt,"BotNotReadyError",()=>Wd),xe(Bt,"BotAlreadyStartedError",()=>qd),xe(Bt,"UnsupportedFeatureError",()=>ab),xe(Bt,"MessageTooLargeError",()=>Jd),xe(Bt,"DeviceError",()=>gn);class ht extends Error{constructor(e,n){super(e),this.status=n}}class ob extends ht{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class Vd extends ht{constructor(e,n){super(e??"Failed to connect / invalid auth bundle from base url",n??500),this.error="invalid-request-error"}}class Kd extends ht{constructor(e){super(e??"Unable to connect to transport")}}class sb extends ht{constructor(e){super(e??"Invalid transport connection parameters")}}class Wd extends ht{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class qd extends ht{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class ab extends ht{constructor(e,n,r){let i=`${e} not supported${r?`: ${r}`:""}`;n&&(i=`${n} does not support ${e}${r?`: ${r}`:""}`),super(i),this.feature=e}}class Jd extends ht{constructor(e){super(e??"Message size exceeds the maximum allowed limit for transport.")}}class gn extends ht{constructor(e,n,r,i){super(r??`Device error for ${e.join(", ")}: ${n}`),this.devices=e,this.type=n,this.details=i}}var Gd={};xe(Gd,"RTVIEvent",()=>Z);var Z;(function(t){t.Connected="connected",t.Disconnected="disconnected",t.TransportStateChanged="transportStateChanged",t.BotStarted="botStarted",t.BotConnected="botConnected",t.BotReady="botReady",t.BotDisconnected="botDisconnected",t.Error="error",t.ServerMessage="serverMessage",t.ServerResponse="serverResponse",t.MessageError="messageError",t.Metrics="metrics",t.BotStartedSpeaking="botStartedSpeaking",t.BotStoppedSpeaking="botStoppedSpeaking",t.UserStartedSpeaking="userStartedSpeaking",t.UserStoppedSpeaking="userStoppedSpeaking",t.UserMuteStarted="userMuteStarted",t.UserMuteStopped="userMuteStopped",t.UserTranscript="userTranscript",t.BotOutput="botOutput",t.BotTranscript="botTranscript",t.BotLlmText="botLlmText",t.BotLlmStarted="botLlmStarted",t.BotLlmStopped="botLlmStopped",t.LLMFunctionCall="llmFunctionCall",t.LLMFunctionCallStarted="llmFunctionCallStarted",t.LLMFunctionCallInProgress="llmFunctionCallInProgress",t.LLMFunctionCallStopped="llmFunctionCallStopped",t.BotLlmSearchResponse="botLlmSearchResponse",t.BotTtsText="botTtsText",t.BotTtsStarted="botTtsStarted",t.BotTtsStopped="botTtsStopped",t.ParticipantConnected="participantConnected",t.ParticipantLeft="participantLeft",t.TrackStarted="trackStarted",t.TrackStopped="trackStopped",t.ScreenTrackStarted="screenTrackStarted",t.ScreenTrackStopped="screenTrackStopped",t.ScreenShareError="screenShareError",t.LocalAudioLevel="localAudioLevel",t.RemoteAudioLevel="remoteAudioLevel",t.AvailableCamsUpdated="availableCamsUpdated",t.AvailableMicsUpdated="availableMicsUpdated",t.AvailableSpeakersUpdated="availableSpeakersUpdated",t.CamUpdated="camUpdated",t.MicUpdated="micUpdated",t.SpeakerUpdated="speakerUpdated",t.DeviceError="deviceError"})(Z||(Z={}));var ur={};xe(ur,"RTVI_PROTOCOL_VERSION",()=>Qd),xe(ur,"RTVI_MESSAGE_LABEL",()=>Yd),xe(ur,"RTVIMessageType",()=>ae),xe(ur,"AggregationType",()=>Za),xe(ur,"setAboutClient",()=>Xd),xe(ur,"RTVIMessage",()=>Ue);const Qd="1.2.0",Yd="rtvi-ai";var ae;(function(t){t.CLIENT_READY="client-ready",t.DISCONNECT_BOT="disconnect-bot",t.CLIENT_MESSAGE="client-message",t.SEND_TEXT="send-text",t.APPEND_TO_CONTEXT="append-to-context",t.BOT_READY="bot-ready",t.ERROR="error",t.METRICS="metrics",t.SERVER_MESSAGE="server-message",t.SERVER_RESPONSE="server-response",t.ERROR_RESPONSE="error-response",t.APPEND_TO_CONTEXT_RESULT="append-to-context-result",t.USER_STARTED_SPEAKING="user-started-speaking",t.USER_STOPPED_SPEAKING="user-stopped-speaking",t.BOT_STARTED_SPEAKING="bot-started-speaking",t.BOT_STOPPED_SPEAKING="bot-stopped-speaking",t.USER_MUTE_STARTED="user-mute-started",t.USER_MUTE_STOPPED="user-mute-stopped",t.USER_TRANSCRIPTION="user-transcription",t.BOT_OUTPUT="bot-output",t.BOT_TRANSCRIPTION="bot-transcription",t.USER_LLM_TEXT="user-llm-text",t.BOT_LLM_TEXT="bot-llm-text",t.BOT_LLM_STARTED="bot-llm-started",t.BOT_LLM_STOPPED="bot-llm-stopped",t.LLM_FUNCTION_CALL="llm-function-call",t.LLM_FUNCTION_CALL_STARTED="llm-function-call-started",t.LLM_FUNCTION_CALL_IN_PROGRESS="llm-function-call-in-progress",t.LLM_FUNCTION_CALL_STOPPED="llm-function-call-stopped",t.LLM_FUNCTION_CALL_RESULT="llm-function-call-result",t.BOT_LLM_SEARCH_RESPONSE="bot-llm-search-response",t.BOT_TTS_TEXT="bot-tts-text",t.BOT_TTS_STARTED="bot-tts-started",t.BOT_TTS_STOPPED="bot-tts-stopped"})(ae||(ae={}));var Za;(function(t){t.WORD="word",t.SENTENCE="sentence"})(Za||(Za={}));let Ii;function Xd(t){Ii?Ii={...Ii,...t}:Ii=t}class Ue{constructor(e,n,r){this.label=Yd,this.type=e,this.data=n,this.id=r||Yv().slice(0,8)}static clientReady(){return new Ue(ae.CLIENT_READY,{version:Qd,about:Ii||{library:Hr.name,library_version:Hr.version}})}static disconnectBot(){return new Ue(ae.DISCONNECT_BOT,{})}static error(e,n=!1){return new Ue(ae.ERROR,{message:e,fatal:n})}}nn(qo,Hd),nn(qo,Bt),nn(qo,Gd),nn(qo,ur);function Ri(t,e,n){const r=n.value;return n.value=function(...i){if(this.state==="ready")return r.apply(this,i);throw new Wd(`Attempt to call ${e.toString()} when transport not in ready state. Await connect() first.`)},n}function el(t,e,n){const r=n.value,i=["authenticating","connecting","connected","ready"];return n.value=function(...o){if(i.includes(this.state))throw new qd(`Attempt to call ${e.toString()} when client already started. Please call disconnect() before starting again.`);return r.apply(this,o)},n}var Zd={};xe(Zd,"MessageDispatcher",()=>eh);var tl={};xe(tl,"LogLevel",()=>Ut),xe(tl,"logger",()=>fe);var Ut;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"})(Ut||(Ut={}));class Vr{constructor(){this.level=Ut.DEBUG}static getInstance(){return Vr.instance||(Vr.instance=new Vr),Vr.instance}setLevel(e){this.level=e}debug(...e){this.level>=Ut.DEBUG&&console.debug(...e)}info(...e){this.level>=Ut.INFO&&console.info(...e)}warn(...e){this.level>=Ut.WARN&&console.warn(...e)}error(...e){this.level>=Ut.ERROR&&console.error(...e)}}const fe=Vr.getInstance();class eh{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,n=ae.CLIENT_MESSAGE,r=1e4){this._gcInterval||(this._gcInterval=setInterval(()=>{this._gc()},2e3));const i=new Ue(n,e),o=new Promise((s,a)=>{this._queue.push({message:i,timestamp:Date.now(),timeout:r,resolve:s,reject:a})});fe.debug("[MessageDispatcher] dispatch",i);try{this._sendMethod(i)}catch(s){return fe.error("[MessageDispatcher] Error sending message",s),Promise.reject(s)}return this._gc(),o}clearQueue(){this._queue=[]}_resolveReject(e,n=!0){const r=this._queue.find(i=>i.message.id===e.id);return r&&(n?(fe.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(fe.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(i=>i.message.id!==e.id),fe.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(n=>{const r=Date.now()-n.timestamp<n.timeout;return r||e.push(n),r}),e.forEach(n=>{n.message.type===ae.CLIENT_MESSAGE&&n.reject(new Ue(ae.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:n.message.data.t,data:n.message.data.d,fatal:!1}))}),fe.debug("[MessageDispatcher] GC",this._queue)}}var nl={};xe(nl,"isAPIRequest",()=>th),xe(nl,"makeRequest",()=>nh);function th(t){if(typeof t=="object"&&t!==null&&Object.keys(t).includes("endpoint")){const e=t.endpoint;return typeof e=="string"||e instanceof URL||typeof Request<"u"&&e instanceof Request}return!1}async function nh(t,e){e||(e=new AbortController);let n;return new Promise((r,i)=>{(async()=>{t.timeout&&(n=setTimeout(async()=>{e.abort(),i(new Error("Timed out"))},t.timeout));let o;typeof Request<"u"&&t.endpoint instanceof Request?(o=new Request(t.endpoint,{signal:e.signal}),t.requestData&&fe.warn("[Pipecat Client] requestData in APIRequest is ignored when endpoint is a Request object"),t.headers&&fe.warn("[Pipecat Client] headers in APIRequest is ignored when endpoint is a Request object")):o=new Request(t.endpoint,{method:"POST",mode:"cors",headers:new Headers({"Content-Type":"application/json",...Object.fromEntries((t.headers??new Headers).entries())}),body:JSON.stringify(t.requestData),signal:e.signal}),fe.debug(`[Pipecat Client] Fetching from ${o.url}`),fetch(o).then(s=>{if(fe.debug(`[Pipecat Client] Received response from ${o.url}`,s),!s.ok){i(s);return}return s.json()}).then(s=>{r(s)}).catch(s=>{fe.error(`[Pipecat Client] Error fetching: ${s}`),i(s)}).finally(()=>{n&&clearTimeout(n)})})()})}var rl={};xe(rl,"Transport",()=>rh),xe(rl,"TransportWrapper",()=>ih);class rh{constructor(){this._state="disconnected",this._maxMessageSize=65536}connect(e){this._abortController=new AbortController;let n=e;try{n=this._validateConnectionParams(e)}catch(r){throw new ht(`Invalid connection params: ${r.message}. Please check your connection params and try again.`)}return this._connect(n)}get startBotParams(){return this._startBotParams}set startBotParams(e){if(typeof Request<"u"&&e.endpoint instanceof Request){this._startBotParams={...e,endpoint:e.endpoint.clone()};return}this._startBotParams=e}disconnect(){return this._abortController&&this._abortController.abort(),this._disconnect()}get maxMessageSize(){return this._maxMessageSize}}class ih{constructor(e){this._transport=e,this._proxy=new Proxy(this._transport,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"initialize":o="Direct calls to initialize() are disabled and used internally by the PipecatClient.";break;case"initDevices":o="Direct calls to initDevices() are disabled. Please use the PipecatClient.initDevices() wrapper or let PipecatClient.connect() call it for you.";break;case"sendReadyMessage":o="Direct calls to sendReadyMessage() are disabled and used internally by the PipecatClient.";break;case"connect":o="Direct calls to connect() are disabled. Please use the PipecatClient.connect() wrapper.";break;case"disconnect":o="Direct calls to disconnect() are disabled. Please use the PipecatClient.disconnect() wrapper.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}var il={};xe(il,"learnAboutClient",()=>oh),xe(il,"messageSizeWithinLimit",()=>sh);function oh(){var n,r,i,o,s,a;let t={library:Hr.name,library_version:Hr.version,platform_details:{}},e=null;if((n=window==null?void 0:window.navigator)!=null&&n.userAgent)try{e=rb.parse(window.navigator.userAgent)}catch{}return(r=e==null?void 0:e.browser)!=null&&r.name&&(t.platform_details.browser=e.browser.name),((i=e==null?void 0:e.browser)==null?void 0:i.name)==="Safari"&&!e.browser.version?t.platform_details.browser_version="Web View":(o=e==null?void 0:e.browser)!=null&&o.version&&(t.platform_details.browser_version=e.browser.version),(s=e==null?void 0:e.platform)!=null&&s.type&&(t.platform_details.platform_type=e.platform.type),(a=e==null?void 0:e.engine)!=null&&a.name&&(t.platform_details.engine=e.engine.name),e!=null&&e.os&&(t.platform=e.os.name,t.platform_version=e.os.version),t}function sh(t,e){return(i=>{const o=JSON.stringify(i);return new TextEncoder().encode(o).length})(t)<=e}var Rn=function(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,n,o):s(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o};class lb extends Wv{}class At extends lb{constructor(e){super(),this._functionCallCallbacks={},this._botTranscriptionWarned=!1,this._llmFunctionCallWarned=!1,Xd(oh()),this._transport=e.transport,this._transportWrapper=new ih(this._transport);const n={...e.callbacks,onMessageError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMessageError)==null||o.call(i,r),this.emit(Z.MessageError,r)},onError:r=>{var o,s,a;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onError)==null||s.call(o,r);try{this.emit(Z.Error,r)}catch(l){l instanceof Error&&l.message.includes("Unhandled error")?(a=e==null?void 0:e.callbacks)!=null&&a.onError||fe.debug("No onError callback registered to handle error",r):fe.debug("Could not emit error",r,l)}const i=r.data;i!=null&&i.fatal&&(fe.error("Fatal error reported. Disconnecting..."),this.disconnect())},onConnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onConnected)==null||i.call(r),this.emit(Z.Connected)},onDisconnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onDisconnected)==null||i.call(r),this.emit(Z.Disconnected)},onTransportStateChanged:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onTransportStateChanged)==null||o.call(i,r),this.emit(Z.TransportStateChanged,r)},onParticipantJoined:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantJoined)==null||o.call(i,r),this.emit(Z.ParticipantConnected,r)},onParticipantLeft:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onParticipantLeft)==null||o.call(i,r),this.emit(Z.ParticipantLeft,r)},onTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStarted)==null||s.call(o,r,i),this.emit(Z.TrackStarted,r,i)},onTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onTrackStopped)==null||s.call(o,r,i),this.emit(Z.TrackStopped,r,i)},onScreenTrackStarted:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStarted)==null||s.call(o,r,i),this.emit(Z.ScreenTrackStarted,r,i)},onScreenTrackStopped:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onScreenTrackStopped)==null||s.call(o,r,i),this.emit(Z.ScreenTrackStopped,r,i)},onScreenShareError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onScreenShareError)==null||o.call(i,r),this.emit(Z.ScreenShareError,r)},onAvailableCamsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableCamsUpdated)==null||o.call(i,r),this.emit(Z.AvailableCamsUpdated,r)},onAvailableMicsUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableMicsUpdated)==null||o.call(i,r),this.emit(Z.AvailableMicsUpdated,r)},onAvailableSpeakersUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onAvailableSpeakersUpdated)==null||o.call(i,r),this.emit(Z.AvailableSpeakersUpdated,r)},onCamUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onCamUpdated)==null||o.call(i,r),this.emit(Z.CamUpdated,r)},onMicUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onMicUpdated)==null||o.call(i,r),this.emit(Z.MicUpdated,r)},onSpeakerUpdated:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onSpeakerUpdated)==null||o.call(i,r),this.emit(Z.SpeakerUpdated,r)},onDeviceError:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onDeviceError)==null||o.call(i,r),this.emit(Z.DeviceError,r)},onBotStarted:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotStarted)==null||o.call(i,r),this.emit(Z.BotStarted,r)},onBotConnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotConnected)==null||o.call(i,r),this.emit(Z.BotConnected,r)},onBotReady:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotReady)==null||o.call(i,r),this.emit(Z.BotReady,r)},onBotDisconnected:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotDisconnected)==null||o.call(i,r),this.emit(Z.BotDisconnected,r)},onUserStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStartedSpeaking)==null||i.call(r),this.emit(Z.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStoppedSpeaking)==null||i.call(r),this.emit(Z.UserStoppedSpeaking)},onBotStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStartedSpeaking)==null||i.call(r),this.emit(Z.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStoppedSpeaking)==null||i.call(r),this.emit(Z.BotStoppedSpeaking)},onRemoteAudioLevel:(r,i)=>{var o,s;(s=(o=e==null?void 0:e.callbacks)==null?void 0:o.onRemoteAudioLevel)==null||s.call(o,r,i),this.emit(Z.RemoteAudioLevel,r,i)},onLocalAudioLevel:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onLocalAudioLevel)==null||o.call(i,r),this.emit(Z.LocalAudioLevel,r)},onUserMuteStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserMuteStarted)==null||i.call(r),this.emit(Z.UserMuteStarted)},onUserMuteStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserMuteStopped)==null||i.call(r),this.emit(Z.UserMuteStopped)},onUserTranscript:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onUserTranscript)==null||o.call(i,r),this.emit(Z.UserTranscript,r)},onBotOutput:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotOutput)==null||o.call(i,r),this.emit(Z.BotOutput,r)},onBotTranscript:r=>{var i,o;this._botTranscriptionWarned||(fe.warn("[Pipecat Client] Bot transcription is deprecated. Please use the onBotOutput instead."),this._botTranscriptionWarned=!0),(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTranscript)==null||o.call(i,r),this.emit(Z.BotTranscript,r)},onBotLlmText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotLlmText)==null||o.call(i,r),this.emit(Z.BotLlmText,r)},onBotLlmStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStarted)==null||i.call(r),this.emit(Z.BotLlmStarted)},onBotLlmStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStopped)==null||i.call(r),this.emit(Z.BotLlmStopped)},onBotTtsText:r=>{var i,o;(o=(i=e==null?void 0:e.callbacks)==null?void 0:i.onBotTtsText)==null||o.call(i,r),this.emit(Z.BotTtsText,r)},onBotTtsStarted:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStarted)==null||i.call(r),this.emit(Z.BotTtsStarted)},onBotTtsStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStopped)==null||i.call(r),this.emit(Z.BotTtsStopped)}};this._options={...e,callbacks:n,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),fe.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){fe.setLevel(e)}async initDevices(){fe.debug("[Pipecat Client] Initializing devices..."),await this._transport.initDevices()}async startBot(e){var r,i,o,s;this._transport.state==="disconnected"&&await this._transport.initDevices(),this._transport.state="authenticating",this._transport.startBotParams=e,this._abortController=new AbortController;let n;try{n=await nh(e,this._abortController)}catch(a){let l="An unknown error occurred while starting the bot.",c;if(a instanceof Response){const d=await a.json();l=d.info??d.detail??a.statusText,c=a.status}else a instanceof Error&&(l=a.message);throw(i=(r=this._options.callbacks)==null?void 0:r.onError)==null||i.call(r,new Ue(ae.ERROR_RESPONSE,{message:l,fatal:!0})),new Vd(l,c)}return this._transport.state="authenticated",(s=(o=this._options.callbacks)==null?void 0:o.onBotStarted)==null||s.call(o,n),n}async connect(e){return e&&th(e)?(fe.warn("Calling connect with an API endpoint is deprecated. Use startBotAndConnect() instead."),this.startBotAndConnect(e)):new Promise((n,r)=>{(async()=>{this._connectResolve=n,this._transport.state==="disconnected"&&await this._transport.initDevices();try{await this._transport.connect(e),await this._transport.sendReadyMessage()}catch(i){this.disconnect(),r(i);return}})()})}async startBotAndConnect(e){const n=await this.startBot(e);return this.connect(n)}async disconnect(){await this._transport.disconnect(),this._messageDispatcher.disconnect()}_initialize(){this._transport.initialize(this._options,this.handleMessage.bind(this)),this._messageDispatcher=new eh(this._sendMessage.bind(this))}_sendMessage(e){var n,r,i,o,s,a;if(!sh(e,this._transport.maxMessageSize)){const l=`Message data too large. Max size is ${this._transport.maxMessageSize}`;throw(r=(n=this._options.callbacks)==null?void 0:n.onError)==null||r.call(n,Ue.error(l,!1)),new Jd(l)}try{this._transport.sendMessage(e)}catch(l){throw l instanceof Error?(o=(i=this._options.callbacks)==null?void 0:i.onError)==null||o.call(i,Ue.error(l.message,!1)):(a=(s=this._options.callbacks)==null?void 0:s.onError)==null||a.call(s,Ue.error("Unknown error sending message",!1)),l}}get connected(){return["connected","ready"].includes(this._transport.state)}get transport(){return this._transportWrapper.proxy}get state(){return this._transport.state}get version(){return ib(Hr).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(){return this._transport.selectedCam}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){this._transport.enableCam(e)}get isCamEnabled(){return this._transport.isCamEnabled}tracks(){return this._transport.tracks()}enableScreenShare(e){return this._transport.enableScreenShare(e)}get isSharingScreen(){return this._transport.isSharingScreen}sendClientMessage(e,n){this._sendMessage(new Ue(ae.CLIENT_MESSAGE,{t:e,d:n}))}async sendClientRequest(e,n,r){const i={t:e,d:n};return(await this._messageDispatcher.dispatch(i,ae.CLIENT_MESSAGE,r)).data.d}registerFunctionCallHandler(e,n){this._functionCallCallbacks[e]=n}unregisterFunctionCallHandler(e){delete this._functionCallCallbacks[e]}unregisterAllFunctionCallHandlers(){this._functionCallCallbacks={}}async appendToContext(e){return fe.warn("appendToContext() is deprecated. Use sendText() instead."),await this._sendMessage(new Ue(ae.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,n={}){await this._sendMessage(new Ue(ae.SEND_TEXT,{content:e,options:n}))}disconnectBot(){this._sendMessage(new Ue(ae.DISCONNECT_BOT,{}))}handleMessage(e){var n,r,i,o,s,a,l,c,d,h,f,g,y,m,S,v,w,k,C,E,L,A,R,G,U,K,j,H,ie,Q,V,X,B,q,z,le,we,u,b,p,x,_,D,I,F,W,re,he,dt,hn,fn,$e;switch(fe.debug("[RTVI Message]",e),e.type){case ae.BOT_READY:{const ce=e.data,en=ce.version?ce.version.split(".").map(Number):[0,0,0];fe.debug(`[Pipecat Client] Bot is ready. Version: ${ce.version}`),en[0]<1&&fe.warn("[Pipecat Client] Bot version is less than 1.0.0, which may not be compatible with this client."),(n=this._connectResolve)==null||n.call(this,e.data),(i=(r=this._options.callbacks)==null?void 0:r.onBotReady)==null||i.call(r,e.data);break}case ae.ERROR:(s=(o=this._options.callbacks)==null?void 0:o.onError)==null||s.call(o,e);break;case ae.SERVER_RESPONSE:this._messageDispatcher.resolve(e);break;case ae.ERROR_RESPONSE:{const ce=this._messageDispatcher.reject(e);(l=(a=this._options.callbacks)==null?void 0:a.onMessageError)==null||l.call(a,ce);break}case ae.USER_STARTED_SPEAKING:(d=(c=this._options.callbacks)==null?void 0:c.onUserStartedSpeaking)==null||d.call(c);break;case ae.USER_STOPPED_SPEAKING:(f=(h=this._options.callbacks)==null?void 0:h.onUserStoppedSpeaking)==null||f.call(h);break;case ae.BOT_STARTED_SPEAKING:(y=(g=this._options.callbacks)==null?void 0:g.onBotStartedSpeaking)==null||y.call(g);break;case ae.BOT_STOPPED_SPEAKING:(S=(m=this._options.callbacks)==null?void 0:m.onBotStoppedSpeaking)==null||S.call(m);break;case ae.USER_MUTE_STARTED:(w=(v=this._options.callbacks)==null?void 0:v.onUserMuteStarted)==null||w.call(v);break;case ae.USER_MUTE_STOPPED:(C=(k=this._options.callbacks)==null?void 0:k.onUserMuteStopped)==null||C.call(k);break;case ae.USER_TRANSCRIPTION:{const ce=e.data;(L=(E=this._options.callbacks)==null?void 0:E.onUserTranscript)==null||L.call(E,ce);break}case ae.BOT_OUTPUT:(R=(A=this._options.callbacks)==null?void 0:A.onBotOutput)==null||R.call(A,e.data);break;case ae.BOT_TRANSCRIPTION:(U=(G=this._options.callbacks)==null?void 0:G.onBotTranscript)==null||U.call(G,e.data);break;case ae.BOT_LLM_TEXT:(j=(K=this._options.callbacks)==null?void 0:K.onBotLlmText)==null||j.call(K,e.data);break;case ae.BOT_LLM_STARTED:(ie=(H=this._options.callbacks)==null?void 0:H.onBotLlmStarted)==null||ie.call(H);break;case ae.BOT_LLM_STOPPED:(V=(Q=this._options.callbacks)==null?void 0:Q.onBotLlmStopped)==null||V.call(Q);break;case ae.BOT_TTS_TEXT:(B=(X=this._options.callbacks)==null?void 0:X.onBotTtsText)==null||B.call(X,e.data);break;case ae.BOT_TTS_STARTED:(z=(q=this._options.callbacks)==null?void 0:q.onBotTtsStarted)==null||z.call(q);break;case ae.BOT_TTS_STOPPED:(we=(le=this._options.callbacks)==null?void 0:le.onBotTtsStopped)==null||we.call(le);break;case ae.METRICS:(b=(u=this._options.callbacks)==null?void 0:u.onMetrics)==null||b.call(u,e.data),this.emit(Z.Metrics,e.data);break;case ae.SERVER_MESSAGE:(x=(p=this._options.callbacks)==null?void 0:p.onServerMessage)==null||x.call(p,e.data),this.emit(Z.ServerMessage,e.data);break;case ae.LLM_FUNCTION_CALL_STARTED:{const ce=e.data;(D=(_=this._options.callbacks)==null?void 0:_.onLLMFunctionCallStarted)==null||D.call(_,ce),this.emit(Z.LLMFunctionCallStarted,ce);break}case ae.LLM_FUNCTION_CALL_IN_PROGRESS:{const ce=e.data;this._maybeTriggerFunctionCallCallback(ce),(F=(I=this._options.callbacks)==null?void 0:I.onLLMFunctionCallInProgress)==null||F.call(I,ce),this.emit(Z.LLMFunctionCallInProgress,ce);break}case ae.LLM_FUNCTION_CALL_STOPPED:{const ce=e.data;(re=(W=this._options.callbacks)==null?void 0:W.onLLMFunctionCallStopped)==null||re.call(W,ce),this.emit(Z.LLMFunctionCallStopped,ce);break}case ae.LLM_FUNCTION_CALL:{const ce=e.data,en={function_name:ce.function_name,tool_call_id:ce.tool_call_id,arguments:ce.args};this._maybeTriggerFunctionCallCallback(en),(he=this._options.callbacks)!=null&&he.onLLMFunctionCall&&(this._llmFunctionCallWarned||(fe.warn("[Pipecat Client] onLLMFunctionCall is deprecated. Please use onLLMFunctionCallInProgress instead."),this._llmFunctionCallWarned=!0)),(hn=(dt=this._options.callbacks)==null?void 0:dt.onLLMFunctionCall)==null||hn.call(dt,ce),this.emit(Z.LLMFunctionCall,ce);break}case ae.BOT_LLM_SEARCH_RESPONSE:{const ce=e.data;($e=(fn=this._options.callbacks)==null?void 0:fn.onBotLlmSearchResponse)==null||$e.call(fn,ce),this.emit(Z.BotLlmSearchResponse,ce);break}default:fe.debug("[Pipecat Client] Unrecognized message type",e.type);break}}_maybeTriggerFunctionCallCallback(e){if(!e.function_name)return;const n=this._functionCallCallbacks[e.function_name];if(n){const r={functionName:e.function_name??"",arguments:e.arguments??{}};n(r).then(i=>{i!=null&&this._sendMessage(new Ue(ae.LLM_FUNCTION_CALL_RESULT,{function_name:e.function_name,tool_call_id:e.tool_call_id,arguments:e.arguments??{},result:i}))}).catch(i=>{fe.error("Error in function call callback",i)})}}}Rn([el],At.prototype,"startBot",null),Rn([el],At.prototype,"connect",null),Rn([el],At.prototype,"startBotAndConnect",null),Rn([Ri],At.prototype,"sendClientMessage",null),Rn([Ri],At.prototype,"sendClientRequest",null),Rn([Ri],At.prototype,"appendToContext",null),Rn([Ri],At.prototype,"sendText",null),Rn([Ri],At.prototype,"disconnectBot",null),nn(zr,zd),nn(zr,Zd),nn(zr,tl),nn(zr,nl),nn(zr,rl),nn(zr,il);function ah(t,e){if(t==null)return{};var n,r,i=function(s,a){if(s==null)return{};var l={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.indexOf(c)!==-1)continue;l[c]=s[c]}return l}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function me(t){return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},me(t)}function lh(t){var e=function(n,r){if(me(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r);if(me(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return me(e)=="symbol"?e:e+""}function ch(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lh(r.key),r)}}function bt(t,e,n){return e&&ch(t.prototype,e),n&&ch(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jo(t,e){if(e&&(me(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(t)}function zt(t){return zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zt(t)}function Ni(t,e){return Ni=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ni(t,e)}function Go(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ni(t,e)}function rn(t,e,n){return(e=lh(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uh(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(c){return void n(c)}a.done?e(l):Promise.resolve(l).then(r,i)}function ne(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(l){uh(o,r,i,s,a,"next",l)}function a(l){uh(o,r,i,s,a,"throw",l)}s(void 0)})}}function dh(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xe(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,s,a,l,c=[],d=!0,h=!1;try{if(a=(i=i.call(n)).next,r===0){if(Object(i)!==i)return;d=!1}else for(;!(d=(o=a.call(i)).done)&&(c.push(o.value),c.length!==r);d=!0);}catch(f){h=!0,s=f}finally{try{if(!d&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(h)throw s}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return dh(n,r);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?dh(n,r):void 0}}(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function cb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hh,Qo={exports:{}},ol=function(){if(hh)return Qo.exports;hh=1;var t,e=typeof Reflect=="object"?Reflect:null,n=e&&typeof e.apply=="function"?e.apply:function(m,S,v){return Function.prototype.apply.call(m,S,v)};t=e&&typeof e.ownKeys=="function"?e.ownKeys:Object.getOwnPropertySymbols?function(m){return Object.getOwnPropertyNames(m).concat(Object.getOwnPropertySymbols(m))}:function(m){return Object.getOwnPropertyNames(m)};var r=Number.isNaN||function(m){return m!=m};function i(){i.init.call(this)}Qo.exports=i,Qo.exports.once=function(m,S){return new Promise(function(v,w){function k(E){m.removeListener(S,C),w(E)}function C(){typeof m.removeListener=="function"&&m.removeListener("error",k),v([].slice.call(arguments))}y(m,S,C,{once:!0}),S!=="error"&&function(E,L,A){typeof E.on=="function"&&y(E,"error",L,A)}(m,k,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}function a(m){return m._maxListeners===void 0?i.defaultMaxListeners:m._maxListeners}function l(m,S,v,w){var k,C,E,L;if(s(v),(C=m._events)===void 0?(C=m._events=Object.create(null),m._eventsCount=0):(C.newListener!==void 0&&(m.emit("newListener",S,v.listener?v.listener:v),C=m._events),E=C[S]),E===void 0)E=C[S]=v,++m._eventsCount;else if(typeof E=="function"?E=C[S]=w?[v,E]:[E,v]:w?E.unshift(v):E.push(v),(k=a(m))>0&&E.length>k&&!E.warned){E.warned=!0;var A=new Error("Possible EventEmitter memory leak detected. "+E.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");A.name="MaxListenersExceededWarning",A.emitter=m,A.type=S,A.count=E.length,L=A,console&&console.warn&&console.warn(L)}return m}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(m,S,v){var w={fired:!1,wrapFn:void 0,target:m,type:S,listener:v},k=c.bind(w);return k.listener=v,w.wrapFn=k,k}function h(m,S,v){var w=m._events;if(w===void 0)return[];var k=w[S];return k===void 0?[]:typeof k=="function"?v?[k.listener||k]:[k]:v?function(C){for(var E=new Array(C.length),L=0;L<E.length;++L)E[L]=C[L].listener||C[L];return E}(k):g(k,k.length)}function f(m){var S=this._events;if(S!==void 0){var v=S[m];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}function g(m,S){for(var v=new Array(S),w=0;w<S;++w)v[w]=m[w];return v}function y(m,S,v,w){if(typeof m.on=="function")w.once?m.once(S,v):m.on(S,v);else{if(typeof m.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m);m.addEventListener(S,function k(C){w.once&&m.removeEventListener(S,k),v(C)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||r(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),i.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(m){if(typeof m!="number"||m<0||r(m))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+m+".");return this._maxListeners=m,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(m){for(var S=[],v=1;v<arguments.length;v++)S.push(arguments[v]);var w=m==="error",k=this._events;if(k!==void 0)w=w&&k.error===void 0;else if(!w)return!1;if(w){var C;if(S.length>0&&(C=S[0]),C instanceof Error)throw C;var E=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw E.context=C,E}var L=k[m];if(L===void 0)return!1;if(typeof L=="function")n(L,this,S);else{var A=L.length,R=g(L,A);for(v=0;v<A;++v)n(R[v],this,S)}return!0},i.prototype.addListener=function(m,S){return l(this,m,S,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(m,S){return l(this,m,S,!0)},i.prototype.once=function(m,S){return s(S),this.on(m,d(this,m,S)),this},i.prototype.prependOnceListener=function(m,S){return s(S),this.prependListener(m,d(this,m,S)),this},i.prototype.removeListener=function(m,S){var v,w,k,C,E;if(s(S),(w=this._events)===void 0)return this;if((v=w[m])===void 0)return this;if(v===S||v.listener===S)--this._eventsCount==0?this._events=Object.create(null):(delete w[m],w.removeListener&&this.emit("removeListener",m,v.listener||S));else if(typeof v!="function"){for(k=-1,C=v.length-1;C>=0;C--)if(v[C]===S||v[C].listener===S){E=v[C].listener,k=C;break}if(k<0)return this;k===0?v.shift():function(L,A){for(;A+1<L.length;A++)L[A]=L[A+1];L.pop()}(v,k),v.length===1&&(w[m]=v[0]),w.removeListener!==void 0&&this.emit("removeListener",m,E||S)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(m){var S,v,w;if((v=this._events)===void 0)return this;if(v.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):v[m]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete v[m]),this;if(arguments.length===0){var k,C=Object.keys(v);for(w=0;w<C.length;++w)(k=C[w])!=="removeListener"&&this.removeAllListeners(k);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(S=v[m])=="function")this.removeListener(m,S);else if(S!==void 0)for(w=S.length-1;w>=0;w--)this.removeListener(m,S[w]);return this},i.prototype.listeners=function(m){return h(this,m,!0)},i.prototype.rawListeners=function(m){return h(this,m,!1)},i.listenerCount=function(m,S){return typeof m.listenerCount=="function"?m.listenerCount(S):f.call(m,S)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},Qo.exports}(),Yo=cb(ol),fh=Object.prototype.hasOwnProperty;function ph(t,e,n){for(n of t.keys())if(it(n,e))return n}function it(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&it(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if((i=r)&&typeof i=="object"&&!(i=ph(e,i))||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if((i=r[0])&&typeof i=="object"&&!(i=ph(e,i))||!it(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){for(n in r=0,t)if(fh.call(t,n)&&++r&&!fh.call(e,n)||!(n in e)||!it(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!=t&&e!=e}const ub={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},gh={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Re={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},ot={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Nn={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};let N=class Pi{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))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 n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),n[0]===10)switch(n[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}}static getAndroidVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5))return n[0]===1&&n[1]<6?"Cupcake":n[0]===1&&n[1]>=6?"Donut":n[0]===2&&n[1]<2?"Eclair":n[0]===2&&n[1]===2?"Froyo":n[0]===2&&n[1]>2?"Gingerbread":n[0]===3?"Honeycomb":n[0]===4&&n[1]<1?"Ice Cream Sandwich":n[0]===4&&n[1]<4?"Jelly Bean":n[0]===4&&n[1]>=4?"KitKat":n[0]===5?"Lollipop":n[0]===6?"Marshmallow":n[0]===7?"Nougat":n[0]===8?"Oreo":n[0]===9?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const i=Pi.getVersionPrecision(e),o=Pi.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=Pi.map([e,n],c=>{const d=s-Pi.getVersionPrecision(c),h=c+new Array(d+1).join(".0");return Pi.map(h.split("."),f=>new Array(20-f.length).join("0")+f).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}}static map(e,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(i=0;i<e.length;i+=1)r.push(n(e[i]));return r}static find(e,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,i=e.length;r<i;r+=1){const o=e[r];if(n(o,r))return o}}static assign(e,...n){const r=e;let i,o;if(Object.assign)return Object.assign(e,...n);for(i=0,o=n.length;i<o;i+=1){const s=n[i];typeof s=="object"&&s!==null&&Object.keys(s).forEach(a=>{r[a]=s[a]})}return e}static getBrowserAlias(e){return ub[e]}static getBrowserTypeByAlias(e){return gh[e]||""}};const _e=/version\/(\d+(\.?_?\d+)+)/i,db=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=N.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=N.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=N.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=N.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=N.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=N.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=N.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=N.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=N.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=N.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=N.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=N.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=N.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=N.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=N.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=N.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=N.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=N.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=N.getFirstMatch(_e,t)||N.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=N.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=N.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=N.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=N.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=N.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=N.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=N.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=N.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=N.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=N.getFirstMatch(_e,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:N.getFirstMatch(e,t),version:N.getSecondMatch(e,t)}}}];var hb=[{test:[/Roku\/DVP/],describe(t){const e=N.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:ot.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=N.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:ot.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=N.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=N.getWindowsVersionName(e);return{name:ot.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:ot.iOS},n=N.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=N.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=N.getMacOSVersionName(e),r={name:ot.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=N.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:ot.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=N.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=N.getAndroidVersionName(e),r={name:ot.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=N.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:ot.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=N.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||N.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||N.getFirstMatch(/\bbb(\d+)/i,t);return{name:ot.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=N.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:ot.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=N.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:ot.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:ot.Linux})},{test:[/CrOS/],describe:()=>({name:ot.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=N.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:ot.PlayStation4,version:e}}}],fb=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=N.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Re.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Re.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Re.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Re.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Re.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Re.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Re.tablet})},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=N.getFirstMatch(/(ipod|iphone)/i,t);return{type:Re.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Re.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Re.mobile})},{test:t=>t.getBrowserName(!0)==="blackberry",describe:()=>({type:Re.mobile,vendor:"BlackBerry"})},{test:t=>t.getBrowserName(!0)==="bada",describe:()=>({type:Re.mobile})},{test:t=>t.getBrowserName()==="windows phone",describe:()=>({type:Re.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe:()=>({type:Re.tablet})},{test:t=>t.getOSName(!0)==="android",describe:()=>({type:Re.mobile})},{test:t=>t.getOSName(!0)==="macos",describe:()=>({type:Re.desktop,vendor:"Apple"})},{test:t=>t.getOSName(!0)==="windows",describe:()=>({type:Re.desktop})},{test:t=>t.getOSName(!0)==="linux",describe:()=>({type:Re.desktop})},{test:t=>t.getOSName(!0)==="playstation 4",describe:()=>({type:Re.tv})},{test:t=>t.getOSName(!0)==="roku",describe:()=>({type:Re.tv})}],pb=[{test:t=>t.getBrowserName(!0)==="microsoft edge",describe(t){if(/\sedg\//i.test(t))return{name:Nn.Blink};const e=N.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Nn.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:Nn.Trident},n=N.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:Nn.Presto},n=N.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:Nn.Gecko},n=N.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Nn.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:Nn.WebKit},n=N.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];let mh=class{constructor(e,n=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=N.find(db,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),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=N.find(hb,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));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:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=N.find(fb,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));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=N.find(pb,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));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 N.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const i={};let o=0;if(Object.keys(e).forEach(s=>{const a=e[s];typeof a=="string"?(i[s]=a,o+=1):typeof a=="object"&&(n[s]=a,r+=1)}),r>0){const s=Object.keys(n),a=N.find(s,c=>this.isOS(c));if(a){const c=this.satisfies(n[a]);if(c!==void 0)return c}const l=N.find(s,c=>this.isPlatform(c));if(l){const c=this.satisfies(n[l]);if(c!==void 0)return c}}if(o>0){const s=Object.keys(i),a=N.find(s,l=>this.isBrowser(l,!0));if(a!==void 0)return this.compareVersion(i[a])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const o=N.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(e){let n=[0],r=e,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(i=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(i=!0,r=e.substr(1)),n.indexOf(N.compareVersions(o,r,i))>-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,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}};/*!
8
8
  * Bowser - a browser detector
9
9
  * https://github.com/lancedikson/bowser
10
10
  * MIT License | (c) Dustin Diaz 2012-2015
11
11
  * MIT License | (c) Denis Demchenko 2015-2019
12
- */let gb=class{static getParser(e,n=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new gh(e,n)}static parse(e){return new gh(e).getResult()}static get BROWSER_MAP(){return ph}static get ENGINE_MAP(){return Nn}static get OS_MAP(){return it}static get PLATFORMS_MAP(){return Re}};function Xo(){return Date.now()+Math.random().toString()}function $i(){throw new Error("Method must be implemented in subclass")}function mh(t,e){return e!=null&&e.proxyUrl?e.proxyUrl+(e.proxyUrl.slice(-1)==="/"?"":"/")+t.substring(8):t}function Zo(t){return t!=null&&t.callObjectBundleUrlOverride?t.callObjectBundleUrlOverride:mh("https://c.daily.co/call-machine/versioned/".concat("0.86.0","/static/call-machine-object-bundle.js"),t)}function es(t){try{new URL(t)}catch{return!1}return!0}const Ee=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,dr="8.55.0",ve=globalThis;function ts(t,e,n){const r=ve,i=r.__SENTRY__=r.__SENTRY__||{},o=i[dr]=i[dr]||{};return o[t]||(o[t]=e())}const hr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sl=["debug","info","warn","error","log","assert","trace"],ns={};function Fi(t){if(!("console"in ve))return t();const e=ve.console,n={},r=Object.keys(ns);r.forEach(i=>{const o=ns[i];n[i]=e[i],e[i]=o});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}const ie=ts("logger",function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return hr?sl.forEach(n=>{e[n]=(...r)=>{t&&Fi(()=>{ve.console[n](`Sentry Logger [${n}]:`,...r)})}}):sl.forEach(n=>{e[n]=()=>{}}),e}),fr="?",yh=/\(error: (.*)\)/,vh=/captureMessage|captureException/;function rs(t){return t[t.length-1]||{}}const bh="<anonymous>";function $n(t){try{return t&&typeof t=="function"&&t.name||bh}catch{return bh}}function wh(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const is={},Sh={};function pr(t,e){is[t]=is[t]||[],is[t].push(e)}function gr(t,e){if(!Sh[t]){Sh[t]=!0;try{e()}catch(n){hr&&ie.error(`Error while instrumenting ${t}`,n)}}}function zt(t,e){const n=t&&is[t];if(n)for(const r of n)try{r(e)}catch(i){hr&&ie.error(`Error while triggering instrumentation handler.
12
+ */let gb=class{static getParser(e,n=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new mh(e,n)}static parse(e){return new mh(e).getResult()}static get BROWSER_MAP(){return gh}static get ENGINE_MAP(){return Nn}static get OS_MAP(){return ot}static get PLATFORMS_MAP(){return Re}};function Xo(){return Date.now()+Math.random().toString()}function $i(){throw new Error("Method must be implemented in subclass")}function yh(t,e){return e!=null&&e.proxyUrl?e.proxyUrl+(e.proxyUrl.slice(-1)==="/"?"":"/")+t.substring(8):t}function Zo(t){return t!=null&&t.callObjectBundleUrlOverride?t.callObjectBundleUrlOverride:yh("https://c.daily.co/call-machine/versioned/".concat("0.86.0","/static/call-machine-object-bundle.js"),t)}function es(t){try{new URL(t)}catch{return!1}return!0}const Ee=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,dr="8.55.0",ve=globalThis;function ts(t,e,n){const r=ve,i=r.__SENTRY__=r.__SENTRY__||{},o=i[dr]=i[dr]||{};return o[t]||(o[t]=e())}const hr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sl=["debug","info","warn","error","log","assert","trace"],ns={};function Fi(t){if(!("console"in ve))return t();const e=ve.console,n={},r=Object.keys(ns);r.forEach(i=>{const o=ns[i];n[i]=e[i],e[i]=o});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}const oe=ts("logger",function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return hr?sl.forEach(n=>{e[n]=(...r)=>{t&&Fi(()=>{ve.console[n](`Sentry Logger [${n}]:`,...r)})}}):sl.forEach(n=>{e[n]=()=>{}}),e}),fr="?",vh=/\(error: (.*)\)/,bh=/captureMessage|captureException/;function rs(t){return t[t.length-1]||{}}const wh="<anonymous>";function $n(t){try{return t&&typeof t=="function"&&t.name||wh}catch{return wh}}function Sh(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const is={},kh={};function pr(t,e){is[t]=is[t]||[],is[t].push(e)}function gr(t,e){if(!kh[t]){kh[t]=!0;try{e()}catch(n){hr&&oe.error(`Error while instrumenting ${t}`,n)}}}function Ht(t,e){const n=t&&is[t];if(n)for(const r of n)try{r(e)}catch(i){hr&&oe.error(`Error while triggering instrumentation handler.
13
13
  Type: ${t}
14
14
  Name: ${$n(r)}
15
- Error:`,i)}}let al=null;function mb(){al=ve.onerror,ve.onerror=function(t,e,n,r,i){return zt("error",{column:r,error:i,line:n,msg:t,url:e}),!!al&&al.apply(this,arguments)},ve.onerror.__SENTRY_INSTRUMENTED__=!0}let ll=null;function yb(){ll=ve.onunhandledrejection,ve.onunhandledrejection=function(t){return zt("unhandledrejection",t),!ll||ll.apply(this,arguments)},ve.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function os(){return cl(ve),ve}function cl(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||dr,e[dr]=e[dr]||{}}const kh=Object.prototype.toString;function ul(t){switch(kh.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return mr(t,Error)}}function Kr(t,e){return kh.call(t)===`[object ${e}]`}function xh(t){return Kr(t,"ErrorEvent")}function _h(t){return Kr(t,"DOMError")}function gn(t){return Kr(t,"String")}function dl(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function hl(t){return t===null||dl(t)||typeof t!="object"&&typeof t!="function"}function Wr(t){return Kr(t,"Object")}function ss(t){return typeof Event<"u"&&mr(t,Event)}function as(t){return!!(t&&t.then&&typeof t.then=="function")}function mr(t,e){try{return t instanceof e}catch{return!1}}function Ch(t){return!(typeof t!="object"||t===null||!t.__isVue&&!t._isVue)}const fl=ve;function Eh(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const d=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(c=vb(n,d),!(c==="html"||o>1&&s+i.length*l+c.length>=h));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function vb(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(fl.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e&&e.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(i&&i.length)i.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const s=n.className;if(s&&gn(s)){const a=s.split(/\s+/);for(const l of a)r.push(`.${l}`)}}const o=["aria-label","type","name","title","alt"];for(const s of o){const a=n.getAttribute(s);a&&r.push(`[${s}="${a}"]`)}return r.join("")}function qr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Th(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{Ch(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function bb(t,e,n=!1){return!!gn(t)&&(Kr(e,"RegExp")?e.test(t):!!gn(e)&&(n?t===e:t.includes(e)))}function ls(t,e=[],n=!1){return e.some(r=>bb(t,r,n))}function wt(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&Mh(i,r);try{t[e]=i}catch{hr&&ie.log(`Failed to replace method "${e}" in object`,t)}}function yr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{hr&&ie.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Mh(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,yr(t,"__sentry_original__",e)}catch{}}function pl(t){return t.__sentry_original__}function Ah(t){if(ul(t))return{message:t.message,name:t.name,stack:t.stack,...Dh(t)};if(ss(t)){const e={type:t.type,target:Oh(t.target),currentTarget:Oh(t.currentTarget),...Dh(t)};return typeof CustomEvent<"u"&&mr(t,CustomEvent)&&(e.detail=t.detail),e}return t}function Oh(t){try{return e=t,typeof Element<"u"&&mr(e,Element)?Eh(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var e}function Dh(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Ot(t){return gl(t,new Map)}function gl(t,e){if(function(n){if(!Wr(n))return!1;try{const r=Object.getPrototypeOf(n).constructor.name;return!r||r==="Object"}catch{return!0}}(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const i of Object.getOwnPropertyNames(t))t[i]!==void 0&&(r[i]=gl(t[i],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(i=>{r.push(gl(i,e))}),r}return t}function ji(){return Date.now()/1e3}const mn=function(){const{performance:t}=ve;if(!t||!t.now)return ji;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/1e3}();function Dt(){const t=ve,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(15&n())>>r/4).toString(16))}function Ph(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Fn(t){const{message:e,event_id:n}=t;if(e)return e;const r=Ph(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ml(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type="Error")}function Jr(t,e){const n=Ph(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const i={...r&&r.data,...e.data};n.mechanism.data=i}}function Lh(t){if(function(e){try{return e.__sentry_captured__}catch{}}(t))return!0;try{yr(t,"__sentry_captured__",!0)}catch{}return!1}var yn;function vr(t){return new Pt(e=>{e(t)})}function cs(t){return new Pt((e,n)=>{n(t)})}(()=>{const{performance:t}=ve;!t||!t.now||(t.now(),t.timing&&t.timing.navigationStart)})(),function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(yn||(yn={}));class Pt{constructor(e){Pt.prototype.__init.call(this),Pt.prototype.__init2.call(this),Pt.prototype.__init3.call(this),Pt.prototype.__init4.call(this),this._state=yn.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Pt((r,i)=>{this._handlers.push([!1,o=>{if(e)try{r(e(o))}catch(s){i(s)}else r(o)},o=>{if(n)try{r(n(o))}catch(s){i(s)}else i(o)}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Pt((n,r)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{o?r(i):n(i)})})}__init(){this._resolve=e=>{this._setResult(yn.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(yn.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{this._state===yn.PENDING&&(as(n)?n.then(this._resolve,this._reject):(this._state=e,this._value=n,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===yn.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===yn.RESOLVED&&n[1](this._value),this._state===yn.REJECTED&&n[2](this._value),n[0]=!0)})}}}function wb(t){const e=mn(),n={sid:Dt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(r){return Ot({sid:`${r.sid}`,init:r.init,started:new Date(1e3*r.started).toISOString(),timestamp:new Date(1e3*r.timestamp).toISOString(),status:r.status,errors:r.errors,did:typeof r.did=="number"||typeof r.did=="string"?`${r.did}`:void 0,duration:r.duration,abnormal_mechanism:r.abnormal_mechanism,attrs:{release:r.release,environment:r.environment,ip_address:r.ipAddress,user_agent:r.userAgent}})}(n)};return t&&Gr(n,t),n}function Gr(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||mn(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Dt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Ih(){return Dt()}function yl(){return Dt().substring(16)}function us(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&e&&Object.keys(e).length===0)return t;const r={...t};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=us(r[i],e[i],n-1));return r}const vl="_sentrySpan";function Rh(t,e){e?yr(t,vl,e):delete t[vl]}function Nh(t){return t[vl]}class bl{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ih(),spanId:yl()}}clone(){const e=new bl;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Rh(e,Nh(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Gr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[r,i]=n instanceof jn?[n.getScopeData(),n.getRequestSession()]:Wr(n)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:l,level:c,fingerprint:d=[],propagationContext:h}=r||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...s},this._contexts={...this._contexts,...l},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),d.length&&(this._fingerprint=d),h&&(this._propagationContext=h),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Rh(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ih()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:100;if(r<=0)return this;const i={timestamp:ji(),...e};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client&&this._client.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Nh(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=us(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:yl(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:Dt();if(!this._client)return ie.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureMessage(e,n,r){const i=r&&r.event_id?r.event_id:Dt();if(!this._client)return ie.warn("No client configured on scope - will not capture message!"),i;const o=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:o,...r,event_id:i},this),i}captureEvent(e,n){const r=n&&n.event_id?n.event_id:Dt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(ie.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const jn=bl;class Sb{constructor(e,n){let r,i;r=e||new jn,i=n||new jn,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(i){throw this._popScope(),i}return as(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Qr(){const t=cl(os());return t.stack=t.stack||new Sb(ts("defaultCurrentScope",()=>new jn),ts("defaultIsolationScope",()=>new jn))}function kb(t){return Qr().withScope(t)}function xb(t,e){const n=Qr();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function $h(t){return Qr().withScope(()=>t(Qr().getIsolationScope()))}function wl(t){const e=cl(t);return e.acs?e.acs:{withIsolationScope:$h,withScope:kb,withSetScope:xb,withSetIsolationScope:(n,r)=>$h(r),getCurrentScope:()=>Qr().getScope(),getIsolationScope:()=>Qr().getIsolationScope()}}function br(){return wl(os()).getCurrentScope()}function Bi(){return wl(os()).getIsolationScope()}function Xe(){return br().getClient()}function _b(t){const e=t.getPropagationContext(),{traceId:n,spanId:r,parentSpanId:i}=e;return Ot({trace_id:n,span_id:r,parent_span_id:i})}function Cb(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[r,i]]of e)(n[r]||(n[r]=[])).push(Ot(i));return n}const Eb=/^sentry-/;function Tb(t){const e=function(r){if(!(!r||!gn(r)&&!Array.isArray(r)))return Array.isArray(r)?r.reduce((i,o)=>{const s=Fh(o);return Object.entries(s).forEach(([a,l])=>{i[a]=l}),i},{}):Fh(r)}(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,o])=>(i.match(Eb)&&(r[i.slice(7)]=o),r),{});return Object.keys(n).length>0?n:void 0}function Fh(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}let jh=!1;function Mb(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext();return Ot({parent_span_id:r?e:Sl(t).parent_span_id,span_id:r?yl():e,trace_id:n})}function Bh(t){return typeof t=="number"?Uh(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Uh(t.getTime()):mn()}function Uh(t){return t>9999999999?t/1e3:t}function Sl(t){if(function(e){return typeof e.getSpanJSON=="function"}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(r){const i=r;return!!(i.attributes&&i.startTime&&i.name&&i.endTime&&i.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,parentSpanId:a,status:l}=t;return Ot({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Bh(i),timestamp:Bh(s)||void 0,status:Ab(l),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:Cb(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function Ab(t){if(t&&t.code!==0)return t.code===1?"ok":t.message||"unknown_error"}function zh(t){return t._sentryRootSpan||t}function Ob(){jh||(Fi(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),jh=!0)}const kl="production";function Hh(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Ot({environment:n.environment||kl,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function Db(t){const e=Xe();if(!e)return{};const n=zh(t),r=n._frozenDsc;if(r)return r;const i=n.spanContext().traceState,o=i&&i.get("sentry.dsc"),s=o&&Tb(o);if(s)return s;const a=Hh(t.spanContext().traceId,e),l=Sl(n),c=l.data||{},d=c["sentry.sample_rate"];d!=null&&(a.sample_rate=`${d}`);const h=c["sentry.source"],f=l.description;return h!=="url"&&f&&(a.transaction=f),function(v){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const b=Xe(),g=b&&b.getOptions();return!!g&&(g.enableTracing||"tracesSampleRate"in g||"tracesSampler"in g)}()&&(a.sampled=String(function(v){const{traceFlags:b}=v.spanContext();return b===1}(n))),e.emit("createDsc",a,n),a}const Pb=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function ds(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function Vh(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Lb(t){const e=typeof t=="string"?function(n){const r=Pb.exec(n);if(!r)return void Fi(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[i,o,s="",a="",l="",c=""]=r.slice(1);let d="",h=c;const f=h.split("/");if(f.length>1&&(d=f.slice(0,-1).join("/"),h=f.pop()),h){const v=h.match(/^\d+/);v&&(h=v[0])}return Vh({host:a,pass:s,path:d,projectId:h,port:l,protocol:i,publicKey:o})}(t):Vh(t);if(e&&function(n){if(!hr)return!0;const{port:r,projectId:i,protocol:o}=n;return!(["protocol","publicKey","host","projectId"].find(s=>!n[s]&&(ie.error(`Invalid Sentry Dsn: ${s} missing`),!0))||(i.match(/^\d+$/)?function(s){return s==="http"||s==="https"}(o)?r&&isNaN(parseInt(r,10))&&(ie.error(`Invalid Sentry Dsn: Invalid port ${r}`),1):(ie.error(`Invalid Sentry Dsn: Invalid protocol ${o}`),1):(ie.error(`Invalid Sentry Dsn: Invalid projectId ${i}`),1)))}(e))return e}function vn(t,e=100,n=1/0){try{return xl("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Kh(t,e=3,n=102400){const r=vn(t,e);return i=r,function(o){return~-encodeURI(o).split(/%..|./).length}(JSON.stringify(i))>n?Kh(t,e-1,n):r;var i}function xl(t,e,n=1/0,r=1/0,i=function(){const o=typeof WeakSet=="function",s=o?new WeakSet:[];return[function(a){if(o)return!!s.has(a)||(s.add(a),!1);for(let l=0;l<s.length;l++)if(s[l]===a)return!0;return s.push(a),!1},function(a){if(o)s.delete(a);else for(let l=0;l<s.length;l++)if(s[l]===a){s.splice(l,1);break}}]}()){const[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=function(v,b){try{if(v==="domain"&&b&&typeof b=="object"&&b._events)return"[Domain]";if(v==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&b===global)return"[Global]";if(typeof window<"u"&&b===window)return"[Window]";if(typeof document<"u"&&b===document)return"[Document]";if(Ch(b))return"[VueViewModel]";if(Wr(g=b)&&"nativeEvent"in g&&"preventDefault"in g&&"stopPropagation"in g)return"[SyntheticEvent]";if(typeof b=="number"&&!Number.isFinite(b))return`[${b}]`;if(typeof b=="function")return`[Function: ${$n(b)}]`;if(typeof b=="symbol")return`[${String(b)}]`;if(typeof b=="bigint")return`[BigInt: ${String(b)}]`;const S=function(m){const w=Object.getPrototypeOf(m);return w?w.constructor.name:"null prototype"}(b);return/^HTML(\w*)Element$/.test(S)?`[HTMLElement: ${S}]`:`[object ${S}]`}catch(S){return`**non-serializable** (${S})`}var g}(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(o(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{return xl("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let h=0;const f=Ah(e);for(const v in f){if(!Object.prototype.hasOwnProperty.call(f,v))continue;if(h>=r){d[v]="[MaxProperties ~]";break}const b=f[v];d[v]=xl(v,b,l-1,r,i),h++}return s(e),d}function Ui(t,e=[]){return[t,e]}function Ib(t,e){const[n,r]=t;return[n,[...r,e]]}function Wh(t,e){const n=t[1];for(const r of n)if(e(r,r[0].type))return!0;return!1}function _l(t){return ve.__SENTRY__&&ve.__SENTRY__.encodePolyfill?ve.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function Rb(t){const[e,n]=t;let r=JSON.stringify(e);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[_l(r),o]:r.push(typeof o=="string"?_l(o):o)}for(const o of n){const[s,a]=o;if(i(`
15
+ Error:`,i)}}let al=null;function mb(){al=ve.onerror,ve.onerror=function(t,e,n,r,i){return Ht("error",{column:r,error:i,line:n,msg:t,url:e}),!!al&&al.apply(this,arguments)},ve.onerror.__SENTRY_INSTRUMENTED__=!0}let ll=null;function yb(){ll=ve.onunhandledrejection,ve.onunhandledrejection=function(t){return Ht("unhandledrejection",t),!ll||ll.apply(this,arguments)},ve.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function os(){return cl(ve),ve}function cl(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||dr,e[dr]=e[dr]||{}}const xh=Object.prototype.toString;function ul(t){switch(xh.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return mr(t,Error)}}function Kr(t,e){return xh.call(t)===`[object ${e}]`}function _h(t){return Kr(t,"ErrorEvent")}function Ch(t){return Kr(t,"DOMError")}function mn(t){return Kr(t,"String")}function dl(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function hl(t){return t===null||dl(t)||typeof t!="object"&&typeof t!="function"}function Wr(t){return Kr(t,"Object")}function ss(t){return typeof Event<"u"&&mr(t,Event)}function as(t){return!!(t&&t.then&&typeof t.then=="function")}function mr(t,e){try{return t instanceof e}catch{return!1}}function Eh(t){return!(typeof t!="object"||t===null||!t.__isVue&&!t._isVue)}const fl=ve;function Th(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const d=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(c=vb(n,d),!(c==="html"||o>1&&s+i.length*l+c.length>=h));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function vb(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(fl.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e&&e.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(i&&i.length)i.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const s=n.className;if(s&&mn(s)){const a=s.split(/\s+/);for(const l of a)r.push(`.${l}`)}}const o=["aria-label","type","name","title","alt"];for(const s of o){const a=n.getAttribute(s);a&&r.push(`[${s}="${a}"]`)}return r.join("")}function qr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Mh(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{Eh(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function bb(t,e,n=!1){return!!mn(t)&&(Kr(e,"RegExp")?e.test(t):!!mn(e)&&(n?t===e:t.includes(e)))}function ls(t,e=[],n=!1){return e.some(r=>bb(t,r,n))}function wt(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&Ah(i,r);try{t[e]=i}catch{hr&&oe.log(`Failed to replace method "${e}" in object`,t)}}function yr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{hr&&oe.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Ah(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,yr(t,"__sentry_original__",e)}catch{}}function pl(t){return t.__sentry_original__}function Oh(t){if(ul(t))return{message:t.message,name:t.name,stack:t.stack,...Lh(t)};if(ss(t)){const e={type:t.type,target:Dh(t.target),currentTarget:Dh(t.currentTarget),...Lh(t)};return typeof CustomEvent<"u"&&mr(t,CustomEvent)&&(e.detail=t.detail),e}return t}function Dh(t){try{return e=t,typeof Element<"u"&&mr(e,Element)?Th(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var e}function Lh(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Ot(t){return gl(t,new Map)}function gl(t,e){if(function(n){if(!Wr(n))return!1;try{const r=Object.getPrototypeOf(n).constructor.name;return!r||r==="Object"}catch{return!0}}(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const i of Object.getOwnPropertyNames(t))t[i]!==void 0&&(r[i]=gl(t[i],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(i=>{r.push(gl(i,e))}),r}return t}function ji(){return Date.now()/1e3}const yn=function(){const{performance:t}=ve;if(!t||!t.now)return ji;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/1e3}();function Dt(){const t=ve,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(15&n())>>r/4).toString(16))}function Ph(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Fn(t){const{message:e,event_id:n}=t;if(e)return e;const r=Ph(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ml(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type="Error")}function Jr(t,e){const n=Ph(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const i={...r&&r.data,...e.data};n.mechanism.data=i}}function Ih(t){if(function(e){try{return e.__sentry_captured__}catch{}}(t))return!0;try{yr(t,"__sentry_captured__",!0)}catch{}return!1}var vn;function vr(t){return new Lt(e=>{e(t)})}function cs(t){return new Lt((e,n)=>{n(t)})}(()=>{const{performance:t}=ve;!t||!t.now||(t.now(),t.timing&&t.timing.navigationStart)})(),function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(vn||(vn={}));class Lt{constructor(e){Lt.prototype.__init.call(this),Lt.prototype.__init2.call(this),Lt.prototype.__init3.call(this),Lt.prototype.__init4.call(this),this._state=vn.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Lt((r,i)=>{this._handlers.push([!1,o=>{if(e)try{r(e(o))}catch(s){i(s)}else r(o)},o=>{if(n)try{r(n(o))}catch(s){i(s)}else i(o)}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Lt((n,r)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{o?r(i):n(i)})})}__init(){this._resolve=e=>{this._setResult(vn.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(vn.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{this._state===vn.PENDING&&(as(n)?n.then(this._resolve,this._reject):(this._state=e,this._value=n,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===vn.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===vn.RESOLVED&&n[1](this._value),this._state===vn.REJECTED&&n[2](this._value),n[0]=!0)})}}}function wb(t){const e=yn(),n={sid:Dt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(r){return Ot({sid:`${r.sid}`,init:r.init,started:new Date(1e3*r.started).toISOString(),timestamp:new Date(1e3*r.timestamp).toISOString(),status:r.status,errors:r.errors,did:typeof r.did=="number"||typeof r.did=="string"?`${r.did}`:void 0,duration:r.duration,abnormal_mechanism:r.abnormal_mechanism,attrs:{release:r.release,environment:r.environment,ip_address:r.ipAddress,user_agent:r.userAgent}})}(n)};return t&&Gr(n,t),n}function Gr(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||yn(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Dt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Rh(){return Dt()}function yl(){return Dt().substring(16)}function us(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&e&&Object.keys(e).length===0)return t;const r={...t};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=us(r[i],e[i],n-1));return r}const vl="_sentrySpan";function Nh(t,e){e?yr(t,vl,e):delete t[vl]}function $h(t){return t[vl]}class bl{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Rh(),spanId:yl()}}clone(){const e=new bl;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Nh(e,$h(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Gr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[r,i]=n instanceof jn?[n.getScopeData(),n.getRequestSession()]:Wr(n)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:l,level:c,fingerprint:d=[],propagationContext:h}=r||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...s},this._contexts={...this._contexts,...l},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),d.length&&(this._fingerprint=d),h&&(this._propagationContext=h),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Nh(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Rh()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:100;if(r<=0)return this;const i={timestamp:ji(),...e};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client&&this._client.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:$h(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=us(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:yl(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:Dt();if(!this._client)return oe.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureMessage(e,n,r){const i=r&&r.event_id?r.event_id:Dt();if(!this._client)return oe.warn("No client configured on scope - will not capture message!"),i;const o=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:o,...r,event_id:i},this),i}captureEvent(e,n){const r=n&&n.event_id?n.event_id:Dt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(oe.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const jn=bl;class Sb{constructor(e,n){let r,i;r=e||new jn,i=n||new jn,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(i){throw this._popScope(),i}return as(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Qr(){const t=cl(os());return t.stack=t.stack||new Sb(ts("defaultCurrentScope",()=>new jn),ts("defaultIsolationScope",()=>new jn))}function kb(t){return Qr().withScope(t)}function xb(t,e){const n=Qr();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Fh(t){return Qr().withScope(()=>t(Qr().getIsolationScope()))}function wl(t){const e=cl(t);return e.acs?e.acs:{withIsolationScope:Fh,withScope:kb,withSetScope:xb,withSetIsolationScope:(n,r)=>Fh(r),getCurrentScope:()=>Qr().getScope(),getIsolationScope:()=>Qr().getIsolationScope()}}function br(){return wl(os()).getCurrentScope()}function Bi(){return wl(os()).getIsolationScope()}function Ze(){return br().getClient()}function _b(t){const e=t.getPropagationContext(),{traceId:n,spanId:r,parentSpanId:i}=e;return Ot({trace_id:n,span_id:r,parent_span_id:i})}function Cb(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[r,i]]of e)(n[r]||(n[r]=[])).push(Ot(i));return n}const Eb=/^sentry-/;function Tb(t){const e=function(r){if(!(!r||!mn(r)&&!Array.isArray(r)))return Array.isArray(r)?r.reduce((i,o)=>{const s=jh(o);return Object.entries(s).forEach(([a,l])=>{i[a]=l}),i},{}):jh(r)}(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,o])=>(i.match(Eb)&&(r[i.slice(7)]=o),r),{});return Object.keys(n).length>0?n:void 0}function jh(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}let Bh=!1;function Mb(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext();return Ot({parent_span_id:r?e:Sl(t).parent_span_id,span_id:r?yl():e,trace_id:n})}function Uh(t){return typeof t=="number"?zh(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?zh(t.getTime()):yn()}function zh(t){return t>9999999999?t/1e3:t}function Sl(t){if(function(e){return typeof e.getSpanJSON=="function"}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(r){const i=r;return!!(i.attributes&&i.startTime&&i.name&&i.endTime&&i.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,parentSpanId:a,status:l}=t;return Ot({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Uh(i),timestamp:Uh(s)||void 0,status:Ab(l),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:Cb(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function Ab(t){if(t&&t.code!==0)return t.code===1?"ok":t.message||"unknown_error"}function Hh(t){return t._sentryRootSpan||t}function Ob(){Bh||(Fi(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),Bh=!0)}const kl="production";function Vh(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Ot({environment:n.environment||kl,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function Db(t){const e=Ze();if(!e)return{};const n=Hh(t),r=n._frozenDsc;if(r)return r;const i=n.spanContext().traceState,o=i&&i.get("sentry.dsc"),s=o&&Tb(o);if(s)return s;const a=Vh(t.spanContext().traceId,e),l=Sl(n),c=l.data||{},d=c["sentry.sample_rate"];d!=null&&(a.sample_rate=`${d}`);const h=c["sentry.source"],f=l.description;return h!=="url"&&f&&(a.transaction=f),function(g){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const y=Ze(),m=y&&y.getOptions();return!!m&&(m.enableTracing||"tracesSampleRate"in m||"tracesSampler"in m)}()&&(a.sampled=String(function(g){const{traceFlags:y}=g.spanContext();return y===1}(n))),e.emit("createDsc",a,n),a}const Lb=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function ds(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function Kh(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Pb(t){const e=typeof t=="string"?function(n){const r=Lb.exec(n);if(!r)return void Fi(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[i,o,s="",a="",l="",c=""]=r.slice(1);let d="",h=c;const f=h.split("/");if(f.length>1&&(d=f.slice(0,-1).join("/"),h=f.pop()),h){const g=h.match(/^\d+/);g&&(h=g[0])}return Kh({host:a,pass:s,path:d,projectId:h,port:l,protocol:i,publicKey:o})}(t):Kh(t);if(e&&function(n){if(!hr)return!0;const{port:r,projectId:i,protocol:o}=n;return!(["protocol","publicKey","host","projectId"].find(s=>!n[s]&&(oe.error(`Invalid Sentry Dsn: ${s} missing`),!0))||(i.match(/^\d+$/)?function(s){return s==="http"||s==="https"}(o)?r&&isNaN(parseInt(r,10))&&(oe.error(`Invalid Sentry Dsn: Invalid port ${r}`),1):(oe.error(`Invalid Sentry Dsn: Invalid protocol ${o}`),1):(oe.error(`Invalid Sentry Dsn: Invalid projectId ${i}`),1)))}(e))return e}function bn(t,e=100,n=1/0){try{return xl("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Wh(t,e=3,n=102400){const r=bn(t,e);return i=r,function(o){return~-encodeURI(o).split(/%..|./).length}(JSON.stringify(i))>n?Wh(t,e-1,n):r;var i}function xl(t,e,n=1/0,r=1/0,i=function(){const o=typeof WeakSet=="function",s=o?new WeakSet:[];return[function(a){if(o)return!!s.has(a)||(s.add(a),!1);for(let l=0;l<s.length;l++)if(s[l]===a)return!0;return s.push(a),!1},function(a){if(o)s.delete(a);else for(let l=0;l<s.length;l++)if(s[l]===a){s.splice(l,1);break}}]}()){const[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=function(g,y){try{if(g==="domain"&&y&&typeof y=="object"&&y._events)return"[Domain]";if(g==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&y===global)return"[Global]";if(typeof window<"u"&&y===window)return"[Window]";if(typeof document<"u"&&y===document)return"[Document]";if(Eh(y))return"[VueViewModel]";if(Wr(m=y)&&"nativeEvent"in m&&"preventDefault"in m&&"stopPropagation"in m)return"[SyntheticEvent]";if(typeof y=="number"&&!Number.isFinite(y))return`[${y}]`;if(typeof y=="function")return`[Function: ${$n(y)}]`;if(typeof y=="symbol")return`[${String(y)}]`;if(typeof y=="bigint")return`[BigInt: ${String(y)}]`;const S=function(v){const w=Object.getPrototypeOf(v);return w?w.constructor.name:"null prototype"}(y);return/^HTML(\w*)Element$/.test(S)?`[HTMLElement: ${S}]`:`[object ${S}]`}catch(S){return`**non-serializable** (${S})`}var m}(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(o(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{return xl("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let h=0;const f=Oh(e);for(const g in f){if(!Object.prototype.hasOwnProperty.call(f,g))continue;if(h>=r){d[g]="[MaxProperties ~]";break}const y=f[g];d[g]=xl(g,y,l-1,r,i),h++}return s(e),d}function Ui(t,e=[]){return[t,e]}function Ib(t,e){const[n,r]=t;return[n,[...r,e]]}function qh(t,e){const n=t[1];for(const r of n)if(e(r,r[0].type))return!0;return!1}function _l(t){return ve.__SENTRY__&&ve.__SENTRY__.encodePolyfill?ve.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function Rb(t){const[e,n]=t;let r=JSON.stringify(e);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[_l(r),o]:r.push(typeof o=="string"?_l(o):o)}for(const o of n){const[s,a]=o;if(i(`
16
16
  ${JSON.stringify(s)}
17
- `),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(vn(a))}i(l)}}return typeof r=="string"?r:function(o){const s=o.reduce((c,d)=>c+d.length,0),a=new Uint8Array(s);let l=0;for(const c of o)a.set(c,l),l+=c.length;return a}(r)}function Nb(t){const e=typeof t.data=="string"?_l(t.data):t.data;return[Ot({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const $b={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket",raw_security:"security"};function qh(t){return $b[t]}function Jh(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Fb(t,e,n,r){const i=Jh(n),o=t.type&&t.type!=="replay_event"?t.type:"event";(function(a,l){l&&(a.sdk=a.sdk||{},a.sdk.name=a.sdk.name||l.name,a.sdk.version=a.sdk.version||l.version,a.sdk.integrations=[...a.sdk.integrations||[],...l.integrations||[]],a.sdk.packages=[...a.sdk.packages||[],...l.packages||[]])})(t,n&&n.sdk);const s=function(a,l,c,d){const h=a.sdkProcessingMetadata&&a.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:a.event_id,sent_at:new Date().toISOString(),...l&&{sdk:l},...!!c&&d&&{dsn:ds(d)},...h&&{trace:Ot({...h})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Ui(s,[[{type:o},t]])}function Cl(t,e,n,r=0){return new Pt((i,o)=>{const s=t[r];if(e===null||typeof s!="function")i(e);else{const a=s({...e},n);Ee&&s.id&&a===null&&ie.log(`Event processor "${s.id}" dropped event`),as(a)?a.then(l=>Cl(t,l,n,r+1).then(i)).then(null,o):Cl(t,a,n,r+1).then(i).then(null,o)}})}let hs,Gh,El;function jb(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;(function(s,a){const{extra:l,tags:c,user:d,contexts:h,level:f,transactionName:v}=a,b=Ot(l);b&&Object.keys(b).length&&(s.extra={...b,...s.extra});const g=Ot(c);g&&Object.keys(g).length&&(s.tags={...g,...s.tags});const S=Ot(d);S&&Object.keys(S).length&&(s.user={...S,...s.user});const m=Ot(h);m&&Object.keys(m).length&&(s.contexts={...m,...s.contexts}),f&&(s.level=f),v&&s.type!=="transaction"&&(s.transaction=v)})(t,e),r&&function(s,a){s.contexts={trace:Mb(a),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:Db(a),...s.sdkProcessingMetadata};const l=zh(a),c=Sl(l).description;c&&!s.transaction&&s.type==="transaction"&&(s.transaction=c)}(t,r),function(s,a){s.fingerprint=s.fingerprint?Array.isArray(s.fingerprint)?s.fingerprint:[s.fingerprint]:[],a&&(s.fingerprint=s.fingerprint.concat(a)),s.fingerprint&&!s.fingerprint.length&&delete s.fingerprint}(t,n),function(s,a){const l=[...s.breadcrumbs||[],...a];s.breadcrumbs=l.length?l:void 0}(t,i),function(s,a){s.sdkProcessingMetadata={...s.sdkProcessingMetadata,...a}}(t,o)}function Qh(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:d,attachments:h,propagationContext:f,transactionName:v,span:b}=e;fs(t,"extra",n),fs(t,"tags",r),fs(t,"user",i),fs(t,"contexts",o),t.sdkProcessingMetadata=us(t.sdkProcessingMetadata,a,2),s&&(t.level=s),v&&(t.transactionName=v),b&&(t.span=b),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),c.length&&(t.fingerprint=[...t.fingerprint,...c]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...f}}function fs(t,e,n){t[e]=us(t[e],n,1)}function Bb(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Dt(),timestamp:e.timestamp||ji()},c=n.integrations||t.integrations.map(b=>b.name);(function(b,g){const{environment:S,release:m,dist:w,maxValueLength:k=250}=g;b.environment=b.environment||S||kl,!b.release&&m&&(b.release=m),!b.dist&&w&&(b.dist=w),b.message&&(b.message=qr(b.message,k));const C=b.exception&&b.exception.values&&b.exception.values[0];C&&C.value&&(C.value=qr(C.value,k));const M=b.request;M&&M.url&&(M.url=qr(M.url,k))})(l,t),function(b,g){g.length>0&&(b.sdk=b.sdk||{},b.sdk.integrations=[...b.sdk.integrations||[],...g])}(l,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&function(b,g){const S=function(m){const w=ve._sentryDebugIds;if(!w)return{};const k=Object.keys(w);return El&&k.length===Gh||(Gh=k.length,El=k.reduce((C,M)=>{hs||(hs={});const P=hs[M];if(P)C[P[0]]=P[1];else{const L=m(M);for(let F=L.length-1;F>=0;F--){const Y=L[F],W=Y&&Y.filename,H=w[M];if(W&&H){C[W]=H,hs[M]=[W,H];break}}}return C},{})),El}(g);try{b.exception.values.forEach(m=>{m.stacktrace.frames.forEach(w=>{S&&w.filename&&(w.debug_id=S[w.filename])})})}catch{}}(l,t.stackParser);const d=function(b,g){if(!g)return b;const S=b?b.clone():new jn;return S.update(g),S}(r,n.captureContext);n.mechanism&&Jr(l,n.mechanism);const h=i?i.getEventProcessors():[],f=ts("globalScope",()=>new jn).getScopeData();o&&Qh(f,o.getScopeData()),d&&Qh(f,d.getScopeData());const v=[...n.attachments||[],...f.attachments];return v.length&&(n.attachments=v),jb(l,f),Cl([...h,...f.eventProcessors],l,n).then(b=>(b&&function(g){const S={};try{g.exception.values.forEach(w=>{w.stacktrace.frames.forEach(k=>{k.debug_id&&(k.abs_path?S[k.abs_path]=k.debug_id:k.filename&&(S[k.filename]=k.debug_id),delete k.debug_id)})})}catch{}if(Object.keys(S).length===0)return;g.debug_meta=g.debug_meta||{},g.debug_meta.images=g.debug_meta.images||[];const m=g.debug_meta.images;Object.entries(S).forEach(([w,k])=>{m.push({type:"sourcemap",code_file:w,debug_id:k})})}(b),typeof s=="number"&&s>0?function(g,S,m){if(!g)return null;const w={...g,...g.breadcrumbs&&{breadcrumbs:g.breadcrumbs.map(k=>({...k,...k.data&&{data:vn(k.data,S,m)}}))},...g.user&&{user:vn(g.user,S,m)},...g.contexts&&{contexts:vn(g.contexts,S,m)},...g.extra&&{extra:vn(g.extra,S,m)}};return g.contexts&&g.contexts.trace&&w.contexts&&(w.contexts.trace=g.contexts.trace,g.contexts.trace.data&&(w.contexts.trace.data=vn(g.contexts.trace.data,S,m))),g.spans&&(w.spans=g.spans.map(k=>({...k,...k.data&&{data:vn(k.data,S,m)}}))),g.contexts&&g.contexts.flags&&w.contexts&&(w.contexts.flags=vn(g.contexts.flags,3,m)),w}(b,s,a):b))}function T_(t){}function Yh(t,e){return br().captureEvent(t,e)}function Xh(t){const e=Xe(),n=Bi(),r=br(),{release:i,environment:o=kl}=e&&e.getOptions()||{},{userAgent:s}=ve.navigator||{},a=wb({release:i,environment:o,user:r.getUser()||n.getUser(),...s&&{userAgent:s},...t}),l=n.getSession();return l&&l.status==="ok"&&Gr(l,{status:"exited"}),Zh(),n.setSession(a),r.setSession(a),a}function Zh(){const t=Bi(),e=br(),n=e.getSession()||t.getSession();n&&function(r,i){let o={};r.status==="ok"&&(o={status:"exited"}),Gr(r,o)}(n),ef(),t.setSession(),e.setSession()}function ef(){const t=Bi(),e=br(),n=Xe(),r=e.getSession()||t.getSession();r&&n&&n.captureSession(r)}function tf(t=!1){t?Zh():ef()}function Ub(t,e,n){return e||`${function(r){return`${function(i){const o=i.protocol?`${i.protocol}:`:"",s=i.port?`:${i.port}`:"";return`${o}//${i.host}${s}${i.path?`/${i.path}`:""}/api/`}(r)}${r.projectId}/envelope/`}(t)}?${function(r,i){const o={sentry_version:"7"};return r.publicKey&&(o.sentry_key=r.publicKey),i&&(o.sentry_client=`${i.name}/${i.version}`),new URLSearchParams(o).toString()}(t,n)}`}const nf=[];function rf(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function of(t,e,n){if(n[e.name])Ee&&ie.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,nf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),nf.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>r(i,o,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((o,s)=>r(o,s,t),{id:e.name});t.addEventProcessor(i)}Ee&&ie.log(`Integration installed: ${e.name}`)}}class Ht extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const sf="Not capturing exception because it's already been captured.";class zb{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Lb(e.dsn):Ee&&ie.warn("No DSN provided, client will not send events."),this._dsn){const r=Ub(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}const n=["enableTracing","tracesSampleRate","tracesSampler"].find(r=>r in e&&e[r]==null);n&&Fi(()=>{console.warn(`[Sentry] Deprecation warning: \`${n}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.`)})}captureException(e,n,r){const i=Dt();if(Lh(e))return Ee&&ie.log(sf),i;const o={event_id:i,...n};return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,r))),o.event_id}captureMessage(e,n,r,i){const o={event_id:Dt(),...r},s=dl(e)?e:String(e),a=hl(e)?this.eventFromMessage(s,n,o):this.eventFromException(e,o);return this._process(a.then(l=>this._captureEvent(l,o,i))),o.event_id}captureEvent(e,n,r){const i=Dt();if(n&&n.originalException&&Lh(n.originalException))return Ee&&ie.log(sf),i;const o={event_id:i,...n},s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,o,s||r)),o.event_id}captureSession(e){typeof e.release!="string"?Ee&&ie.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),Gr(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(i=>r&&i))):vr(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];of(this,e,this._integrations),n||rf(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=Fb(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])r=Ib(r,Nb(o));const i=this.sendEnvelope(r);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){const n=function(r,i,o,s){const a=Jh(o);return Ui({sent_at:new Date().toISOString(),...a&&{sdk:a},...!!s&&i&&{dsn:ds(i)}},["aggregates"in r?[{type:"sessions"},r]:[{type:"session"},r.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){const i=typeof r=="number"?r:1,o=`${e}:${n}`;Ee&&ie.log(`Recording outcome: "${o}"${i>1?` (${i} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+i}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const i=r.indexOf(n);i>-1&&r.splice(i,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(i=>i(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(Ee&&ie.error("Error while sending envelope:",n),n)):(Ee&&ie.error("Transport disabled"),vr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(n,r){const i={};return r.forEach(o=>{o&&of(n,o,i)}),i}(this,e),rf(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",i=!1;const o=n.exception&&n.exception.values;if(o){i=!0;for(const a of o){const l=a.mechanism;if(l&&l.handled===!1){r=!0;break}}}const s=e.status==="ok";(s&&e.errors===0||s&&r)&&(Gr(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Pt(n=>{let r=0;const i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=1,e&&r>=e&&(clearInterval(i),n(!1)))},1)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r=br(),i=Bi()){const o=this.getOptions(),s=Object.keys(this._integrations);return!n.integrations&&s.length>0&&(n.integrations=s),this.emit("preprocessEvent",e,n),e.type||i.setLastEventId(e.event_id||n.event_id),Bb(o,e,n,r,this,i).then(a=>{if(a===null)return a;a.contexts={trace:_b(r),...a.contexts};const l=function(c,d){const h=d.getPropagationContext();return h.dsc||Hh(h.traceId,c)}(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(i=>i.event_id,i=>{Ee&&(i instanceof Ht&&i.logLevel==="log"?ie.log(i.message):ie.warn(i))})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=lf(e),a=af(e),l=e.type||"error",c=`before send for type \`${l}\``,d=o===void 0?void 0:function(v){if(typeof v=="boolean")return Number(v);const b=typeof v=="string"?parseFloat(v):v;if(!(typeof b!="number"||isNaN(b)||b<0||b>1))return b;Ee&&ie.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(v)} of type ${JSON.stringify(typeof v)}.`)}(o);if(a&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),cs(new Ht(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const h=l==="replay_event"?"replay":l,f=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,f).then(v=>{if(v===null)throw this.recordDroppedEvent("event_processor",h,e),new Ht("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return v;const b=function(g,S,m,w){const{beforeSend:k,beforeSendTransaction:C,beforeSendSpan:M}=S;if(af(m)&&k)return k(m,w);if(lf(m)){if(m.spans&&M){const P=[];for(const L of m.spans){const F=M(L);F?P.push(F):(Ob(),g.recordDroppedEvent("before_send","span"))}m.spans=P}if(C){if(m.spans){const P=m.spans.length;m.sdkProcessingMetadata={...m.sdkProcessingMetadata,spanCountBeforeProcessing:P}}return C(m,w)}}return m}(this,i,v,n);return function(g,S){const m=`${S} must return \`null\` or a valid event.`;if(as(g))return g.then(w=>{if(!Wr(w)&&w!==null)throw new Ht(m);return w},w=>{throw new Ht(`${S} rejected with ${w}`)});if(!Wr(g)&&g!==null)throw new Ht(m);return g}(b,c)}).then(v=>{if(v===null){if(this.recordDroppedEvent("before_send",h,e),s){const S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw new Ht(`${c} returned \`null\`, will not send event.`,"log")}const b=r&&r.getSession();if(!s&&b&&this._updateSessionFromEvent(b,v),s){const S=(v.sdkProcessingMetadata&&v.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(v.spans?v.spans.length:0);S>0&&this.recordDroppedEvent("before_send","span",S)}const g=v.transaction_info;if(s&&g&&v.transaction!==e.transaction){const S="custom";v.transaction_info={...g,source:S}}return this.sendEvent(v,n),v}).then(null,v=>{throw v instanceof Ht?v:(this.captureException(v,{data:{__sentry__:!0},originalException:v}),new Ht(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
18
- Reason: ${v}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[i,o]=n.split(":");return{reason:i,category:o,quantity:r}})}_flushOutcomes(){Ee&&ie.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0)return void(Ee&&ie.log("No outcomes to send"));if(!this._dsn)return void(Ee&&ie.log("No dsn provided, will not send outcomes"));Ee&&ie.log("Sending outcomes:",e);const n=(r=e,Ui((i=this._options.tunnel&&ds(this._dsn))?{dsn:i}:{},[[{type:"client_report"},{timestamp:o||ji(),discarded_events:r}]]));var r,i,o;this.sendEnvelope(n)}}function af(t){return t.type===void 0}function lf(t){return t.type==="transaction"}function Hb(t){const e=[];function n(r){return e.splice(e.indexOf(r),1)[0]||Promise.resolve(void 0)}return{$:e,add:function(r){if(!(t===void 0||e.length<t))return cs(new Ht("Not adding Promise because buffer limit was reached."));const i=r();return e.indexOf(i)===-1&&e.push(i),i.then(()=>n(i)).then(null,()=>n(i).then(null,()=>{})),i},drain:function(r){return new Pt((i,o)=>{let s=e.length;if(!s)return i(!0);const a=setTimeout(()=>{r&&r>0&&i(!1)},r);e.forEach(l=>{vr(l).then(()=>{--s||(clearTimeout(a),i(!0))},o)})})}}}function Vb(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n&&n["x-sentry-rate-limits"],s=n&&n["retry-after"];if(o)for(const a of o.trim().split(",")){const[l,c,,,d]=a.split(":",5),h=parseInt(l,10),f=1e3*(isNaN(h)?60:h);if(c)for(const v of c.split(";"))v==="metric_bucket"&&d&&!d.split(";").includes("custom")||(i[v]=r+f);else i.all=r+f}else s?i.all=r+function(a,l=Date.now()){const c=parseInt(`${a}`,10);if(!isNaN(c))return 1e3*c;const d=Date.parse(`${a}`);return isNaN(d)?6e4:d-l}(s,r):e===429&&(i.all=r+6e4);return i}function Kb(t,e,n=Hb(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Wh(i,(l,c)=>{const d=qh(c);if(function(h,f,v=Date.now()){return function(b,g){return b[g]||b.all||0}(h,f)>v}(r,d)){const h=cf(l,c);t.recordDroppedEvent("ratelimit_backoff",d,h)}else o.push(l)}),o.length===0)return vr({});const s=Ui(i[0],o),a=l=>{Wh(s,(c,d)=>{const h=cf(c,d);t.recordDroppedEvent(l,qh(d),h)})};return n.add(()=>e({body:Rb(s)}).then(l=>(l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&Ee&&ie.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=Vb(r,l),l),l=>{throw a("network_error"),l})).then(l=>l,l=>{if(l instanceof Ht)return Ee&&ie.error("Skipped sending event because buffer is full."),a("queue_overflow"),vr({});throw l})},flush:i=>n.drain(i)}}function cf(t,e){if(e==="event"||e==="transaction")return Array.isArray(t)?t[1]:void 0}const Wb=100;function wr(t,e){const n=Xe(),r=Bi();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Wb}=n.getOptions();if(o<=0)return;const s={timestamp:ji(),...t},a=i?Fi(()=>i(s,e)):s;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let uf;const df=new WeakMap,qb=()=>({name:"FunctionToString",setupOnce(){uf=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=pl(this),n=df.has(Xe())&&e!==void 0?e:this;return uf.apply(n,t)}}catch{}},setup(t){df.set(t,!0)}}),Jb=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/],Gb=(t={})=>({name:"InboundFilters",processEvent(e,n,r){const i=r.getOptions(),o=function(s={},a={}){return{allowUrls:[...s.allowUrls||[],...a.allowUrls||[]],denyUrls:[...s.denyUrls||[],...a.denyUrls||[]],ignoreErrors:[...s.ignoreErrors||[],...a.ignoreErrors||[],...s.disableErrorDefaults?[]:Jb],ignoreTransactions:[...s.ignoreTransactions||[],...a.ignoreTransactions||[]],ignoreInternal:s.ignoreInternal===void 0||s.ignoreInternal}}(t,i);return function(s,a){return a.ignoreInternal&&function(l){try{return l.exception.values[0].type==="SentryError"}catch{}return!1}(s)?(Ee&&ie.warn(`Event dropped due to being internal Sentry Error.
19
- Event: ${Fn(s)}`),!0):function(l,c){return l.type||!c||!c.length?!1:function(d){const h=[];d.message&&h.push(d.message);let f;try{f=d.exception.values[d.exception.values.length-1]}catch{}return f&&f.value&&(h.push(f.value),f.type&&h.push(`${f.type}: ${f.value}`)),h}(l).some(d=>ls(d,c))}(s,a.ignoreErrors)?(Ee&&ie.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
20
- Event: ${Fn(s)}`),!0):function(l){return l.type||!l.exception||!l.exception.values||l.exception.values.length===0?!1:!l.message&&!l.exception.values.some(c=>c.stacktrace||c.type&&c.type!=="Error"||c.value)}(s)?(Ee&&ie.warn(`Event dropped due to not having an error message, error type or stacktrace.
21
- Event: ${Fn(s)}`),!0):function(l,c){if(l.type!=="transaction"||!c||!c.length)return!1;const d=l.transaction;return!!d&&ls(d,c)}(s,a.ignoreTransactions)?(Ee&&ie.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
22
- Event: ${Fn(s)}`),!0):function(l,c){if(!c||!c.length)return!1;const d=ps(l);return!!d&&ls(d,c)}(s,a.denyUrls)?(Ee&&ie.warn(`Event dropped due to being matched by \`denyUrls\` option.
17
+ `),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(bn(a))}i(l)}}return typeof r=="string"?r:function(o){const s=o.reduce((c,d)=>c+d.length,0),a=new Uint8Array(s);let l=0;for(const c of o)a.set(c,l),l+=c.length;return a}(r)}function Nb(t){const e=typeof t.data=="string"?_l(t.data):t.data;return[Ot({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const $b={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket",raw_security:"security"};function Jh(t){return $b[t]}function Gh(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Fb(t,e,n,r){const i=Gh(n),o=t.type&&t.type!=="replay_event"?t.type:"event";(function(a,l){l&&(a.sdk=a.sdk||{},a.sdk.name=a.sdk.name||l.name,a.sdk.version=a.sdk.version||l.version,a.sdk.integrations=[...a.sdk.integrations||[],...l.integrations||[]],a.sdk.packages=[...a.sdk.packages||[],...l.packages||[]])})(t,n&&n.sdk);const s=function(a,l,c,d){const h=a.sdkProcessingMetadata&&a.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:a.event_id,sent_at:new Date().toISOString(),...l&&{sdk:l},...!!c&&d&&{dsn:ds(d)},...h&&{trace:Ot({...h})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Ui(s,[[{type:o},t]])}function Cl(t,e,n,r=0){return new Lt((i,o)=>{const s=t[r];if(e===null||typeof s!="function")i(e);else{const a=s({...e},n);Ee&&s.id&&a===null&&oe.log(`Event processor "${s.id}" dropped event`),as(a)?a.then(l=>Cl(t,l,n,r+1).then(i)).then(null,o):Cl(t,a,n,r+1).then(i).then(null,o)}})}let hs,Qh,El;function jb(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;(function(s,a){const{extra:l,tags:c,user:d,contexts:h,level:f,transactionName:g}=a,y=Ot(l);y&&Object.keys(y).length&&(s.extra={...y,...s.extra});const m=Ot(c);m&&Object.keys(m).length&&(s.tags={...m,...s.tags});const S=Ot(d);S&&Object.keys(S).length&&(s.user={...S,...s.user});const v=Ot(h);v&&Object.keys(v).length&&(s.contexts={...v,...s.contexts}),f&&(s.level=f),g&&s.type!=="transaction"&&(s.transaction=g)})(t,e),r&&function(s,a){s.contexts={trace:Mb(a),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:Db(a),...s.sdkProcessingMetadata};const l=Hh(a),c=Sl(l).description;c&&!s.transaction&&s.type==="transaction"&&(s.transaction=c)}(t,r),function(s,a){s.fingerprint=s.fingerprint?Array.isArray(s.fingerprint)?s.fingerprint:[s.fingerprint]:[],a&&(s.fingerprint=s.fingerprint.concat(a)),s.fingerprint&&!s.fingerprint.length&&delete s.fingerprint}(t,n),function(s,a){const l=[...s.breadcrumbs||[],...a];s.breadcrumbs=l.length?l:void 0}(t,i),function(s,a){s.sdkProcessingMetadata={...s.sdkProcessingMetadata,...a}}(t,o)}function Yh(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:d,attachments:h,propagationContext:f,transactionName:g,span:y}=e;fs(t,"extra",n),fs(t,"tags",r),fs(t,"user",i),fs(t,"contexts",o),t.sdkProcessingMetadata=us(t.sdkProcessingMetadata,a,2),s&&(t.level=s),g&&(t.transactionName=g),y&&(t.span=y),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),c.length&&(t.fingerprint=[...t.fingerprint,...c]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...f}}function fs(t,e,n){t[e]=us(t[e],n,1)}function Bb(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Dt(),timestamp:e.timestamp||ji()},c=n.integrations||t.integrations.map(y=>y.name);(function(y,m){const{environment:S,release:v,dist:w,maxValueLength:k=250}=m;y.environment=y.environment||S||kl,!y.release&&v&&(y.release=v),!y.dist&&w&&(y.dist=w),y.message&&(y.message=qr(y.message,k));const C=y.exception&&y.exception.values&&y.exception.values[0];C&&C.value&&(C.value=qr(C.value,k));const E=y.request;E&&E.url&&(E.url=qr(E.url,k))})(l,t),function(y,m){m.length>0&&(y.sdk=y.sdk||{},y.sdk.integrations=[...y.sdk.integrations||[],...m])}(l,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&function(y,m){const S=function(v){const w=ve._sentryDebugIds;if(!w)return{};const k=Object.keys(w);return El&&k.length===Qh||(Qh=k.length,El=k.reduce((C,E)=>{hs||(hs={});const L=hs[E];if(L)C[L[0]]=L[1];else{const A=v(E);for(let R=A.length-1;R>=0;R--){const G=A[R],U=G&&G.filename,K=w[E];if(U&&K){C[U]=K,hs[E]=[U,K];break}}}return C},{})),El}(m);try{y.exception.values.forEach(v=>{v.stacktrace.frames.forEach(w=>{S&&w.filename&&(w.debug_id=S[w.filename])})})}catch{}}(l,t.stackParser);const d=function(y,m){if(!m)return y;const S=y?y.clone():new jn;return S.update(m),S}(r,n.captureContext);n.mechanism&&Jr(l,n.mechanism);const h=i?i.getEventProcessors():[],f=ts("globalScope",()=>new jn).getScopeData();o&&Yh(f,o.getScopeData()),d&&Yh(f,d.getScopeData());const g=[...n.attachments||[],...f.attachments];return g.length&&(n.attachments=g),jb(l,f),Cl([...h,...f.eventProcessors],l,n).then(y=>(y&&function(m){const S={};try{m.exception.values.forEach(w=>{w.stacktrace.frames.forEach(k=>{k.debug_id&&(k.abs_path?S[k.abs_path]=k.debug_id:k.filename&&(S[k.filename]=k.debug_id),delete k.debug_id)})})}catch{}if(Object.keys(S).length===0)return;m.debug_meta=m.debug_meta||{},m.debug_meta.images=m.debug_meta.images||[];const v=m.debug_meta.images;Object.entries(S).forEach(([w,k])=>{v.push({type:"sourcemap",code_file:w,debug_id:k})})}(y),typeof s=="number"&&s>0?function(m,S,v){if(!m)return null;const w={...m,...m.breadcrumbs&&{breadcrumbs:m.breadcrumbs.map(k=>({...k,...k.data&&{data:bn(k.data,S,v)}}))},...m.user&&{user:bn(m.user,S,v)},...m.contexts&&{contexts:bn(m.contexts,S,v)},...m.extra&&{extra:bn(m.extra,S,v)}};return m.contexts&&m.contexts.trace&&w.contexts&&(w.contexts.trace=m.contexts.trace,m.contexts.trace.data&&(w.contexts.trace.data=bn(m.contexts.trace.data,S,v))),m.spans&&(w.spans=m.spans.map(k=>({...k,...k.data&&{data:bn(k.data,S,v)}}))),m.contexts&&m.contexts.flags&&w.contexts&&(w.contexts.flags=bn(m.contexts.flags,3,v)),w}(y,s,a):y))}function T_(t){}function Xh(t,e){return br().captureEvent(t,e)}function Zh(t){const e=Ze(),n=Bi(),r=br(),{release:i,environment:o=kl}=e&&e.getOptions()||{},{userAgent:s}=ve.navigator||{},a=wb({release:i,environment:o,user:r.getUser()||n.getUser(),...s&&{userAgent:s},...t}),l=n.getSession();return l&&l.status==="ok"&&Gr(l,{status:"exited"}),ef(),n.setSession(a),r.setSession(a),a}function ef(){const t=Bi(),e=br(),n=e.getSession()||t.getSession();n&&function(r,i){let o={};r.status==="ok"&&(o={status:"exited"}),Gr(r,o)}(n),tf(),t.setSession(),e.setSession()}function tf(){const t=Bi(),e=br(),n=Ze(),r=e.getSession()||t.getSession();r&&n&&n.captureSession(r)}function nf(t=!1){t?ef():tf()}function Ub(t,e,n){return e||`${function(r){return`${function(i){const o=i.protocol?`${i.protocol}:`:"",s=i.port?`:${i.port}`:"";return`${o}//${i.host}${s}${i.path?`/${i.path}`:""}/api/`}(r)}${r.projectId}/envelope/`}(t)}?${function(r,i){const o={sentry_version:"7"};return r.publicKey&&(o.sentry_key=r.publicKey),i&&(o.sentry_client=`${i.name}/${i.version}`),new URLSearchParams(o).toString()}(t,n)}`}const rf=[];function of(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function sf(t,e,n){if(n[e.name])Ee&&oe.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,rf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),rf.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>r(i,o,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((o,s)=>r(o,s,t),{id:e.name});t.addEventProcessor(i)}Ee&&oe.log(`Integration installed: ${e.name}`)}}class Vt extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const af="Not capturing exception because it's already been captured.";class zb{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Pb(e.dsn):Ee&&oe.warn("No DSN provided, client will not send events."),this._dsn){const r=Ub(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}const n=["enableTracing","tracesSampleRate","tracesSampler"].find(r=>r in e&&e[r]==null);n&&Fi(()=>{console.warn(`[Sentry] Deprecation warning: \`${n}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.`)})}captureException(e,n,r){const i=Dt();if(Ih(e))return Ee&&oe.log(af),i;const o={event_id:i,...n};return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,r))),o.event_id}captureMessage(e,n,r,i){const o={event_id:Dt(),...r},s=dl(e)?e:String(e),a=hl(e)?this.eventFromMessage(s,n,o):this.eventFromException(e,o);return this._process(a.then(l=>this._captureEvent(l,o,i))),o.event_id}captureEvent(e,n,r){const i=Dt();if(n&&n.originalException&&Ih(n.originalException))return Ee&&oe.log(af),i;const o={event_id:i,...n},s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,o,s||r)),o.event_id}captureSession(e){typeof e.release!="string"?Ee&&oe.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),Gr(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(i=>r&&i))):vr(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];sf(this,e,this._integrations),n||of(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=Fb(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])r=Ib(r,Nb(o));const i=this.sendEnvelope(r);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){const n=function(r,i,o,s){const a=Gh(o);return Ui({sent_at:new Date().toISOString(),...a&&{sdk:a},...!!s&&i&&{dsn:ds(i)}},["aggregates"in r?[{type:"sessions"},r]:[{type:"session"},r.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){const i=typeof r=="number"?r:1,o=`${e}:${n}`;Ee&&oe.log(`Recording outcome: "${o}"${i>1?` (${i} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+i}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const i=r.indexOf(n);i>-1&&r.splice(i,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(i=>i(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(Ee&&oe.error("Error while sending envelope:",n),n)):(Ee&&oe.error("Transport disabled"),vr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(n,r){const i={};return r.forEach(o=>{o&&sf(n,o,i)}),i}(this,e),of(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",i=!1;const o=n.exception&&n.exception.values;if(o){i=!0;for(const a of o){const l=a.mechanism;if(l&&l.handled===!1){r=!0;break}}}const s=e.status==="ok";(s&&e.errors===0||s&&r)&&(Gr(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Lt(n=>{let r=0;const i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=1,e&&r>=e&&(clearInterval(i),n(!1)))},1)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r=br(),i=Bi()){const o=this.getOptions(),s=Object.keys(this._integrations);return!n.integrations&&s.length>0&&(n.integrations=s),this.emit("preprocessEvent",e,n),e.type||i.setLastEventId(e.event_id||n.event_id),Bb(o,e,n,r,this,i).then(a=>{if(a===null)return a;a.contexts={trace:_b(r),...a.contexts};const l=function(c,d){const h=d.getPropagationContext();return h.dsc||Vh(h.traceId,c)}(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(i=>i.event_id,i=>{Ee&&(i instanceof Vt&&i.logLevel==="log"?oe.log(i.message):oe.warn(i))})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=cf(e),a=lf(e),l=e.type||"error",c=`before send for type \`${l}\``,d=o===void 0?void 0:function(g){if(typeof g=="boolean")return Number(g);const y=typeof g=="string"?parseFloat(g):g;if(!(typeof y!="number"||isNaN(y)||y<0||y>1))return y;Ee&&oe.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(g)} of type ${JSON.stringify(typeof g)}.`)}(o);if(a&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),cs(new Vt(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const h=l==="replay_event"?"replay":l,f=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,f).then(g=>{if(g===null)throw this.recordDroppedEvent("event_processor",h,e),new Vt("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return g;const y=function(m,S,v,w){const{beforeSend:k,beforeSendTransaction:C,beforeSendSpan:E}=S;if(lf(v)&&k)return k(v,w);if(cf(v)){if(v.spans&&E){const L=[];for(const A of v.spans){const R=E(A);R?L.push(R):(Ob(),m.recordDroppedEvent("before_send","span"))}v.spans=L}if(C){if(v.spans){const L=v.spans.length;v.sdkProcessingMetadata={...v.sdkProcessingMetadata,spanCountBeforeProcessing:L}}return C(v,w)}}return v}(this,i,g,n);return function(m,S){const v=`${S} must return \`null\` or a valid event.`;if(as(m))return m.then(w=>{if(!Wr(w)&&w!==null)throw new Vt(v);return w},w=>{throw new Vt(`${S} rejected with ${w}`)});if(!Wr(m)&&m!==null)throw new Vt(v);return m}(y,c)}).then(g=>{if(g===null){if(this.recordDroppedEvent("before_send",h,e),s){const S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw new Vt(`${c} returned \`null\`, will not send event.`,"log")}const y=r&&r.getSession();if(!s&&y&&this._updateSessionFromEvent(y,g),s){const S=(g.sdkProcessingMetadata&&g.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(g.spans?g.spans.length:0);S>0&&this.recordDroppedEvent("before_send","span",S)}const m=g.transaction_info;if(s&&m&&g.transaction!==e.transaction){const S="custom";g.transaction_info={...m,source:S}}return this.sendEvent(g,n),g}).then(null,g=>{throw g instanceof Vt?g:(this.captureException(g,{data:{__sentry__:!0},originalException:g}),new Vt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
18
+ Reason: ${g}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[i,o]=n.split(":");return{reason:i,category:o,quantity:r}})}_flushOutcomes(){Ee&&oe.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0)return void(Ee&&oe.log("No outcomes to send"));if(!this._dsn)return void(Ee&&oe.log("No dsn provided, will not send outcomes"));Ee&&oe.log("Sending outcomes:",e);const n=(r=e,Ui((i=this._options.tunnel&&ds(this._dsn))?{dsn:i}:{},[[{type:"client_report"},{timestamp:o||ji(),discarded_events:r}]]));var r,i,o;this.sendEnvelope(n)}}function lf(t){return t.type===void 0}function cf(t){return t.type==="transaction"}function Hb(t){const e=[];function n(r){return e.splice(e.indexOf(r),1)[0]||Promise.resolve(void 0)}return{$:e,add:function(r){if(!(t===void 0||e.length<t))return cs(new Vt("Not adding Promise because buffer limit was reached."));const i=r();return e.indexOf(i)===-1&&e.push(i),i.then(()=>n(i)).then(null,()=>n(i).then(null,()=>{})),i},drain:function(r){return new Lt((i,o)=>{let s=e.length;if(!s)return i(!0);const a=setTimeout(()=>{r&&r>0&&i(!1)},r);e.forEach(l=>{vr(l).then(()=>{--s||(clearTimeout(a),i(!0))},o)})})}}}function Vb(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n&&n["x-sentry-rate-limits"],s=n&&n["retry-after"];if(o)for(const a of o.trim().split(",")){const[l,c,,,d]=a.split(":",5),h=parseInt(l,10),f=1e3*(isNaN(h)?60:h);if(c)for(const g of c.split(";"))g==="metric_bucket"&&d&&!d.split(";").includes("custom")||(i[g]=r+f);else i.all=r+f}else s?i.all=r+function(a,l=Date.now()){const c=parseInt(`${a}`,10);if(!isNaN(c))return 1e3*c;const d=Date.parse(`${a}`);return isNaN(d)?6e4:d-l}(s,r):e===429&&(i.all=r+6e4);return i}function Kb(t,e,n=Hb(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(qh(i,(l,c)=>{const d=Jh(c);if(function(h,f,g=Date.now()){return function(y,m){return y[m]||y.all||0}(h,f)>g}(r,d)){const h=uf(l,c);t.recordDroppedEvent("ratelimit_backoff",d,h)}else o.push(l)}),o.length===0)return vr({});const s=Ui(i[0],o),a=l=>{qh(s,(c,d)=>{const h=uf(c,d);t.recordDroppedEvent(l,Jh(d),h)})};return n.add(()=>e({body:Rb(s)}).then(l=>(l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&Ee&&oe.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=Vb(r,l),l),l=>{throw a("network_error"),l})).then(l=>l,l=>{if(l instanceof Vt)return Ee&&oe.error("Skipped sending event because buffer is full."),a("queue_overflow"),vr({});throw l})},flush:i=>n.drain(i)}}function uf(t,e){if(e==="event"||e==="transaction")return Array.isArray(t)?t[1]:void 0}const Wb=100;function wr(t,e){const n=Ze(),r=Bi();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Wb}=n.getOptions();if(o<=0)return;const s={timestamp:ji(),...t},a=i?Fi(()=>i(s,e)):s;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let df;const hf=new WeakMap,qb=()=>({name:"FunctionToString",setupOnce(){df=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=pl(this),n=hf.has(Ze())&&e!==void 0?e:this;return df.apply(n,t)}}catch{}},setup(t){hf.set(t,!0)}}),Jb=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/],Gb=(t={})=>({name:"InboundFilters",processEvent(e,n,r){const i=r.getOptions(),o=function(s={},a={}){return{allowUrls:[...s.allowUrls||[],...a.allowUrls||[]],denyUrls:[...s.denyUrls||[],...a.denyUrls||[]],ignoreErrors:[...s.ignoreErrors||[],...a.ignoreErrors||[],...s.disableErrorDefaults?[]:Jb],ignoreTransactions:[...s.ignoreTransactions||[],...a.ignoreTransactions||[]],ignoreInternal:s.ignoreInternal===void 0||s.ignoreInternal}}(t,i);return function(s,a){return a.ignoreInternal&&function(l){try{return l.exception.values[0].type==="SentryError"}catch{}return!1}(s)?(Ee&&oe.warn(`Event dropped due to being internal Sentry Error.
19
+ Event: ${Fn(s)}`),!0):function(l,c){return l.type||!c||!c.length?!1:function(d){const h=[];d.message&&h.push(d.message);let f;try{f=d.exception.values[d.exception.values.length-1]}catch{}return f&&f.value&&(h.push(f.value),f.type&&h.push(`${f.type}: ${f.value}`)),h}(l).some(d=>ls(d,c))}(s,a.ignoreErrors)?(Ee&&oe.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
20
+ Event: ${Fn(s)}`),!0):function(l){return l.type||!l.exception||!l.exception.values||l.exception.values.length===0?!1:!l.message&&!l.exception.values.some(c=>c.stacktrace||c.type&&c.type!=="Error"||c.value)}(s)?(Ee&&oe.warn(`Event dropped due to not having an error message, error type or stacktrace.
21
+ Event: ${Fn(s)}`),!0):function(l,c){if(l.type!=="transaction"||!c||!c.length)return!1;const d=l.transaction;return!!d&&ls(d,c)}(s,a.ignoreTransactions)?(Ee&&oe.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
22
+ Event: ${Fn(s)}`),!0):function(l,c){if(!c||!c.length)return!1;const d=ps(l);return!!d&&ls(d,c)}(s,a.denyUrls)?(Ee&&oe.warn(`Event dropped due to being matched by \`denyUrls\` option.
23
23
  Event: ${Fn(s)}.
24
- Url: ${ps(s)}`),!0):function(l,c){if(!c||!c.length)return!0;const d=ps(l);return!d||ls(d,c)}(s,a.allowUrls)?!1:(Ee&&ie.warn(`Event dropped due to not being matched by \`allowUrls\` option.
24
+ Url: ${ps(s)}`),!0):function(l,c){if(!c||!c.length)return!0;const d=ps(l);return!d||ls(d,c)}(s,a.allowUrls)?!1:(Ee&&oe.warn(`Event dropped due to not being matched by \`allowUrls\` option.
25
25
  Event: ${Fn(s)}.
26
- Url: ${ps(s)}`),!0)}(e,o)?null:e}});function ps(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?function(n=[]){for(let r=n.length-1;r>=0;r--){const i=n[r];if(i&&i.filename!=="<anonymous>"&&i.filename!=="[native code]")return i.filename||null}return null}(e):null}catch{return Ee&&ie.error(`Cannot extract url for event ${Fn(t)}`),null}}function Qb(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&mr(s.originalException,Error)))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var l,c;a&&(o.exception.values=(l=Tl(t,e,i,s.originalException,r,o.exception.values,a,0),c=n,l.map(d=>(d.value&&(d.value=qr(d.value,c)),d))))}function Tl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(mr(r[i],Error)){hf(s,a);const c=t(e,r[i]),d=l.length;ff(c,i,d,a),l=Tl(t,e,n,r[i],i,[c,...l],c,d)}return Array.isArray(r.errors)&&r.errors.forEach((c,d)=>{if(mr(c,Error)){hf(s,a);const h=t(e,c),f=l.length;ff(h,`errors[${d}]`,f,a),l=Tl(t,e,n,c,i,[h,...l],h,f)}}),l}function hf(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function ff(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function Ml(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Yb(){"console"in ve&&sl.forEach(function(t){t in ve.console&&wt(ve.console,t,function(e){return ns[t]=e,function(...n){zt("console",{args:n,level:t});const r=ns[t];r&&r.apply(ve.console,n)}})})}function Xb(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Zb=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(n,r){return r?!!(function(i,o){const s=i.message,a=o.message;return!(!s&&!a||s&&!a||!s&&a||s!==a||!gf(i,o)||!pf(i,o))}(n,r)||function(i,o){const s=mf(o),a=mf(i);return!(!s||!a||s.type!==a.type||s.value!==a.value||!gf(i,o)||!pf(i,o))}(n,r)):!1}(e,t))return Ee&&ie.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function pf(t,e){let n=wh(t),r=wh(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let i=0;i<r.length;i++){const o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function gf(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return n.join("")===r.join("")}catch{return!1}}function mf(t){return t.exception&&t.exception.values&&t.exception.values[0]}function yf(t){return t===void 0?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const Al=ve;function Ol(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function ew(){if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in Al))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(Ol(Al.fetch))return!0;let t=!1;const e=Al.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=Ol(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){hr&&ie.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function tw(t,e){const n="fetch";pr(n,t),gr(n,()=>function(r,i=!1){i&&!ew()||wt(ve,"fetch",function(o){return function(...s){const a=new Error,{method:l,url:c}=function(h){if(h.length===0)return{method:"GET",url:""};if(h.length===2){const[v,b]=h;return{url:vf(v),method:Dl(b,"method")?String(b.method).toUpperCase():"GET"}}const f=h[0];return{url:vf(f),method:Dl(f,"method")?String(f.method).toUpperCase():"GET"}}(s),d={args:s,fetchData:{method:l,url:c},startTimestamp:1e3*mn(),virtualError:a};return r||zt("fetch",{...d}),o.apply(ve,s).then(async h=>(r?r(h):zt("fetch",{...d,endTimestamp:1e3*mn(),response:h}),h),h=>{throw zt("fetch",{...d,endTimestamp:1e3*mn(),error:h}),ul(h)&&h.stack===void 0&&(h.stack=a.stack,yr(h,"framesToPop",1)),h})}})}(void 0,e))}function Dl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function vf(t){return typeof t=="string"?t:t?Dl(t,"url")?t.url:t.toString?t.toString():"":""}const gs=ve,ze=ve;let Pl=0;function bf(){return Pl>0}function Yr(t,e={}){if(!function(r){return typeof r=="function"}(t))return t;try{const r=t.__sentry_wrapped__;if(r)return typeof r=="function"?r:t;if(pl(t))return t}catch{return t}const n=function(...r){try{const i=r.map(o=>Yr(o,e));return t.apply(this,i)}catch(i){throw Pl++,setTimeout(()=>{Pl--}),function(...o){const s=wl(os());if(o.length===2){const[a,l]=o;return a?s.withSetScope(a,l):s.withScope(l)}s.withScope(o[0])}(o=>{var s;o.addEventProcessor(a=>(e.mechanism&&(ml(a,void 0),Jr(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),s=i,br().captureException(s,void 0)}),i}};try{for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}catch{}Mh(n,t),yr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}const ms=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Ll(t,e){const n=Rl(t,e),r={type:iw(e),value:ow(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function nw(t,e,n,r){const i=Xe(),o=i&&i.getOptions().normalizeDepth,s=function(c){for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d)){const h=c[d];if(h instanceof Error)return h}}(e),a={__serialized__:Kh(e,o)};if(s)return{exception:{values:[Ll(t,s)]},extra:a};const l={exception:{values:[{type:ss(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:sw(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=Rl(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function Il(t,e){return{exception:{values:[Ll(t,e)]}}}function Rl(t,e){const n=e.stacktrace||e.stack||"",r=function(o){return o&&rw.test(o.message)?1:0}(e),i=function(o){return typeof o.framesToPop=="number"?o.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const rw=/Minified React error #\d+;/i;function wf(t){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&t instanceof WebAssembly.Exception}function iw(t){const e=t&&t.name;return!e&&wf(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function ow(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:wf(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function Nl(t,e,n,r,i){let o;if(xh(e)&&e.error)return Il(t,e.error);if(_h(e)||Kr(e,"DOMException")){const s=e;if("stack"in e)o=Il(t,e);else{const a=s.name||(_h(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=$l(t,l,n,r),ml(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return ul(e)?Il(t,e):Wr(e)||ss(e)?(o=nw(t,e,n,i),Jr(o,{synthetic:!0}),o):(o=$l(t,e,n,r),ml(o,`${e}`),Jr(o,{synthetic:!0}),o)}function $l(t,e,n,r){const i={};if(r&&n){const o=Rl(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Jr(i,{synthetic:!0})}if(dl(e)){const{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function sw(t,{isUnhandledRejection:e}){const n=function(i,o=40){const s=Object.keys(Ah(i));s.sort();const a=s[0];if(!a)return"[object has no keys]";if(a.length>=o)return qr(a,o);for(let l=s.length;l>0;l--){const c=s.slice(0,l).join(", ");if(!(c.length>o))return l===s.length?c:qr(c,o)}return""}(t),r=e?"promise rejection":"exception";return xh(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:ss(t)?`Event \`${function(i){try{const o=Object.getPrototypeOf(i);return o?o.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class aw extends zb{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e};(function(r,i,o=[i],s="npm"){const a=r._metadata||{};a.sdk||(a.sdk={name:`sentry.javascript.${i}`,packages:o.map(l=>({name:`${s}:@sentry/${l}`,version:dr})),version:dr}),r._metadata=a})(n,"browser",["browser"],ze.SENTRY_SDK_SOURCE||"npm"),super(n),n.sendClientReports&&ze.document&&ze.document.addEventListener("visibilitychange",()=>{ze.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return function(r,i,o,s){const a=Nl(r,i,o&&o.syntheticException||void 0,s);return Jr(a),a.level="error",o&&o.event_id&&(a.event_id=o.event_id),vr(a)}(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return function(i,o,s="info",a,l){const c=$l(i,o,a&&a.syntheticException||void 0,l);return c.level=s,a&&a.event_id&&(c.event_id=a.event_id),vr(c)}(this._options.stackParser,e,n,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(ms&&ie.warn("SDK not enabled, will not capture user feedback."));const n=function(r,{metadata:i,tunnel:o,dsn:s}){const a={event_id:r.event_id,sent_at:new Date().toISOString(),...i&&i.sdk&&{sdk:{name:i.sdk.name,version:i.sdk.version}},...!!o&&!!s&&{dsn:ds(s)}};return Ui(a,[function(c){return[{type:"user_report"},c]}(r)])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}}const lw=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ot=ve;let Sf,Fl,jl,ys;function cw(){if(!ot.document)return;const t=zt.bind(null,"dom"),e=kf(t,!0);ot.document.addEventListener("click",e,!1),ot.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=ot[n],i=r&&r.prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(wt(i,"addEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=c[s]=c[s]||{refCount:0};if(!d.handler){const h=kf(t);d.handler=h,o.call(this,s,h,l)}d.refCount++}catch{}return o.call(this,s,a,l)}}),wt(i,"removeEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},d=c[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,l),d.handler=void 0,delete c[s]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,l)}}))})}function kf(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(o){try{return o.target}catch{return null}}(n);if(function(o,s){return o==="keypress"&&(!s||!s.tagName||s.tagName!=="INPUT"&&s.tagName!=="TEXTAREA"&&!s.isContentEditable)}(n.type,r))return;yr(n,"_sentryCaptured",!0),r&&!r._sentryId&&yr(r,"_sentryId",Dt());const i=n.type==="keypress"?"input":n.type;(function(o){if(o.type!==Fl)return!1;try{if(!o.target||o.target._sentryId!==jl)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Fl=n.type,jl=r?r._sentryId:void 0),clearTimeout(Sf),Sf=ot.setTimeout(()=>{jl=void 0,Fl=void 0},1e3)}}function xf(t){const e="history";pr(e,t),gr(e,uw)}function uw(){if(!function(){const n=gs.chrome,r=n&&n.app&&n.app.runtime,i="history"in gs&&!!gs.history.pushState&&!!gs.history.replaceState;return!r&&i}())return;const t=ot.onpopstate;function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const o=ys,s=String(i);ys=s,zt("history",{from:o,to:s})}return n.apply(this,r)}}ot.onpopstate=function(...n){const r=ot.location.href,i=ys;if(ys=r,zt("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}},wt(ot.history,"pushState",e),wt(ot.history,"replaceState",e)}const vs={};function _f(t){vs[t]=void 0}const zi="__sentry_xhr_v3__";function dw(){if(!ot.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,o=1e3*mn(),s=gn(r[0])?r[0].toUpperCase():void 0,a=function(c){if(gn(c))return c;try{return c.toString()}catch{}}(r[1]);if(!s||!a)return e.apply(n,r);n[zi]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[zi];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}zt("xhr",{endTimestamp:1e3*mn(),startTimestamp:o,xhr:n,virtualError:i})}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply:(c,d,h)=>(l(),c.apply(d,h))}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,d,h){const[f,v]=h,b=d[zi];return b&&gn(f)&&gn(v)&&(b.request_headers[f.toLowerCase()]=v),c.apply(d,h)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[zi];return i?(r[0]!==void 0&&(i.body=r[0]),zt("xhr",{startTimestamp:1e3*mn(),xhr:n}),e.apply(n,r)):e.apply(n,r)}})}function hw(t,e=function(n){const r=vs[n];if(r)return r;let i=ot[n];if(Ol(i))return vs[n]=i.bind(ot);const o=ot.document;if(o&&typeof o.createElement=="function")try{const s=o.createElement("iframe");s.hidden=!0,o.head.appendChild(s);const a=s.contentWindow;a&&a[n]&&(i=a[n]),o.head.removeChild(s)}catch(s){lw&&ie.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,s)}return i&&(vs[n]=i.bind(ot))}("fetch")){let n=0,r=0;return Kb(t,function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return _f("fetch"),cs("No fetch implementation available");try{return e(t.url,s).then(a=>(n-=o,r--,{statusCode:a.status,headers:{"x-sentry-rate-limits":a.headers.get("X-Sentry-Rate-Limits"),"retry-after":a.headers.get("Retry-After")}}))}catch(a){return _f("fetch"),n-=o,r--,cs(a)}})}function Bl(t,e,n,r){const i={filename:t,function:e==="<anonymous>"?fr:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const fw=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,pw=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,gw=/\((\S*)(?::(\d+))(?::(\d+))\)/,mw=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,yw=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vw=function(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const o=[],s=n.split(`
27
- `);for(let a=r;a<s.length;a++){const l=s[a];if(l.length>1024)continue;const c=yh.test(l)?l.replace(yh,"$1"):l;if(!c.match(/\S*Error: /)){for(const d of e){const h=d(c);if(h){o.push(h);break}}if(o.length>=50+i)break}}return function(a){if(!a.length)return[];const l=Array.from(a);return/sentryWrapped/.test(rs(l).function||"")&&l.pop(),l.reverse(),vh.test(rs(l).function||"")&&(l.pop(),vh.test(rs(l).function||"")&&l.pop()),l.slice(0,50).map(c=>({...c,filename:c.filename||rs(l).filename,function:c.function||fr}))}(o.slice(i))}}([30,t=>{const e=fw.exec(t);if(e){const[,r,i,o]=e;return Bl(r,fr,+i,+o)}const n=pw.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=gw.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,i]=Cf(n[1]||fr,n[2]);return Bl(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=mw.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=yw.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let n=e[3],r=e[1]||fr;return[r,n]=Cf(r,n),Bl(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),Cf=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:fr,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Ef=1024,bw=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(n){var r;e.console&&function(i){const o="console";pr(o,i),gr(o,Yb)}(function(i){return function(o){if(Xe()!==i)return;const s={category:"console",data:{arguments:o.args,logger:"console"},level:Xb(o.level),message:Th(o.args," ")};if(o.level==="assert"){if(o.args[0]!==!1)return;s.message=`Assertion failed: ${Th(o.args.slice(1)," ")||"console.assert"}`,s.data.arguments=o.args.slice(1)}wr(s,{input:o.args,level:o.level})}}(n)),e.dom&&(r=function(i,o){return function(s){if(Xe()!==i)return;let a,l,c=typeof o=="object"?o.serializeAttribute:void 0,d=typeof o=="object"&&typeof o.maxStringLength=="number"?o.maxStringLength:void 0;d&&d>Ef&&(ms&&ie.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${d} was configured. Sentry will use 1024 instead.`),d=Ef),typeof c=="string"&&(c=[c]);try{const f=s.event,v=function(b){return!!b&&!!b.target}(f)?f.target:f;a=Eh(v,{keyAttrs:c,maxStringLength:d}),l=function(b){if(!fl.HTMLElement)return null;let g=b;for(let S=0;S<5;S++){if(!g)return null;if(g instanceof HTMLElement){if(g.dataset.sentryComponent)return g.dataset.sentryComponent;if(g.dataset.sentryElement)return g.dataset.sentryElement}g=g.parentNode}return null}(v)}catch{a="<unknown>"}if(a.length===0)return;const h={category:`ui.${s.name}`,message:a};l&&(h.data={"ui.component_name":l}),wr(h,{event:s.event,name:s.name,global:s.global})}}(n,e.dom),pr("dom",r),gr("dom",cw)),e.xhr&&function(i){pr("xhr",i),gr("xhr",dw)}(function(i){return function(o){if(Xe()!==i)return;const{startTimestamp:s,endTimestamp:a}=o,l=o.xhr[zi];if(!s||!a||!l)return;const{method:c,url:d,status_code:h,body:f}=l,v={method:c,url:d,status_code:h},b={xhr:o.xhr,input:f,startTimestamp:s,endTimestamp:a};wr({category:"xhr",data:v,type:"http",level:yf(h)},b)}}(n)),e.fetch&&tw(function(i){return function(o){if(Xe()!==i)return;const{startTimestamp:s,endTimestamp:a}=o;if(a&&(!o.fetchData.url.match(/sentry_key/)||o.fetchData.method!=="POST"))if(o.error)wr({category:"fetch",data:o.fetchData,level:"error",type:"http"},{data:o.error,input:o.args,startTimestamp:s,endTimestamp:a});else{const l=o.response,c={...o.fetchData,status_code:l&&l.status},d={input:o.args,response:l,startTimestamp:s,endTimestamp:a};wr({category:"fetch",data:c,type:"http",level:yf(c.status_code)},d)}}}(n)),e.history&&xf(function(i){return function(o){if(Xe()!==i)return;let s=o.from,a=o.to;const l=Ml(ze.location.href);let c=s?Ml(s):void 0;const d=Ml(a);c&&c.path||(c=l),l.protocol===d.protocol&&l.host===d.host&&(a=d.relative),l.protocol===c.protocol&&l.host===c.host&&(s=c.relative),wr({category:"navigation",data:{from:s,to:a}})}}(n)),e.sentry&&n.on("beforeSendEvent",function(i){return function(o){Xe()===i&&wr({category:"sentry."+(o.type==="transaction"?"transaction":"event"),event_id:o.event_id,level:o.level,message:Fn(o)},{event:o})}}(n))}}},ww=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Sw=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&wt(ze,"setTimeout",Tf),e.setInterval&&wt(ze,"setInterval",Tf),e.requestAnimationFrame&&wt(ze,"requestAnimationFrame",kw),e.XMLHttpRequest&&"XMLHttpRequest"in ze&&wt(XMLHttpRequest.prototype,"send",xw);const n=e.eventTarget;n&&(Array.isArray(n)?n:ww).forEach(_w)}}};function Tf(t){return function(...e){const n=e[0];return e[0]=Yr(n,{mechanism:{data:{function:$n(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function kw(t){return function(e){return t.apply(this,[Yr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:$n(t)},handled:!1,type:"instrument"}})])}}function xw(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&wt(n,r,function(i){const o={mechanism:{data:{function:r,handler:$n(i)},handled:!1,type:"instrument"}},s=pl(i);return s&&(o.mechanism.data.handler=$n(s)),Yr(i,o)})}),t.apply(this,e)}}function _w(t){const e=ze[t],n=e&&e.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(wt(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=Yr(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:$n(o),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Yr(o,{mechanism:{data:{function:"addEventListener",handler:$n(o),target:t},handled:!1,type:"instrument"}}),s])}}),wt(n,"removeEventListener",function(r){return function(i,o,s){try{const a=o.__sentry_wrapped__;a&&r.call(this,i,a,s)}catch{}return r.call(this,i,o,s)}}))}const Cw=()=>({name:"BrowserSession",setupOnce(){ze.document!==void 0?(Xh({ignoreDuration:!0}),tf(),xf(({from:t,to:e})=>{t!==void 0&&t!==e&&(Xh({ignoreDuration:!0}),tf())})):ms&&ie.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),Ew=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(function(r){(function(i){const o="error";pr(o,i),gr(o,mb)})(i=>{const{stackParser:o,attachStacktrace:s}=Af();if(Xe()!==r||bf())return;const{msg:a,url:l,line:c,column:d,error:h}=i,f=function(v,b,g,S){const m=v.exception=v.exception||{},w=m.values=m.values||[],k=w[0]=w[0]||{},C=k.stacktrace=k.stacktrace||{},M=C.frames=C.frames||[],P=S,L=g,F=gn(b)&&b.length>0?b:function(){try{return fl.document.location.href}catch{return""}}();return M.length===0&&M.push({colno:P,filename:F,function:fr,in_app:!0,lineno:L}),v}(Nl(o,h||a,void 0,s,!1),l,c,d);f.level="error",Yh(f,{originalException:h,mechanism:{handled:!1,type:"onerror"}})})}(n),Mf("onerror")),e.onunhandledrejection&&(function(r){(function(i){const o="unhandledrejection";pr(o,i),gr(o,yb)})(i=>{const{stackParser:o,attachStacktrace:s}=Af();if(Xe()!==r||bf())return;const a=function(c){if(hl(c))return c;try{if("reason"in c)return c.reason;if("detail"in c&&"reason"in c.detail)return c.detail.reason}catch{}return c}(i),l=hl(a)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`}]}}:Nl(o,a,void 0,s,!0);l.level="error",Yh(l,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(n),Mf("onunhandledrejection"))}}};function Mf(t){ms&&ie.log(`Global Handler attached: ${t}`)}function Af(){const t=Xe();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const Tw=()=>({name:"HttpContext",preprocessEvent(t){if(!ze.navigator&&!ze.location&&!ze.document)return;const e=t.request&&t.request.url||ze.location&&ze.location.href,{referrer:n}=ze.document||{},{userAgent:r}=ze.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...t.request,...e&&{url:e},headers:i};t.request=o}}),Mw=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(r,i,o){const s=o.getOptions();Qb(Ll,s.stackParser,s.maxValueLength,n,e,r,i)}}};var Of="new",Df="loading",Pf="loaded",Ul="joining-meeting",Sr="joined-meeting",Bn="left-meeting",Un="error",Aw="playable",zl="unknown",Ow="full",Dw="base",Lf="no-room",Pw="end-of-life",Lw="connection-error",Iw="iframe-ready-for-launch-config",Rw="iframe-launch-config",Nw="theme-updated",$w="loading",Fw="load-attempt-failed",If="loaded",jw="started-camera",Bw="camera-error",Uw="joining-meeting",zw="joined-meeting",Hw="left-meeting",Vw="participant-joined",Kw="participant-updated",Ww="participant-left",qw="participant-counts-updated",Jw="access-state-updated",Gw="meeting-session-summary-updated",Qw="meeting-session-state-updated",Yw="waiting-participant-added",Xw="waiting-participant-updated",Zw="waiting-participant-removed",e0="track-started",t0="track-stopped",n0="transcription-started",r0="transcription-stopped",i0="transcription-error",Rf="recording-started",Nf="recording-stopped",o0="recording-stats",s0="recording-error",a0="recording-upload-completed",l0="recording-data",c0="app-message",u0="transcription-message",d0="remote-media-player-started",h0="remote-media-player-updated",f0="remote-media-player-stopped",p0="local-screen-share-started",g0="local-screen-share-stopped",m0="local-screen-share-canceled",y0="active-speaker-change",v0="active-speaker-mode-change",b0="network-quality-change",w0="network-connection",S0="cpu-load-change",k0="face-counts-updated",bs="fullscreen",ws="exited-fullscreen",x0="live-streaming-started",_0="live-streaming-updated",C0="live-streaming-stopped",E0="live-streaming-error",T0="lang-updated",M0="receive-settings-updated",$f="input-settings-updated",Ff="nonfatal-error",jf="error",Hl=4096,Bf=102400,Vl="iframe-call-message",Uf="local-screen-start",zf="daily-method-update-live-streaming-endpoints",Ss="transmit-log",bn="daily-custom-track",ks={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},Hf={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},Kl={PLAY:"play",PAUSE:"pause"},Wl=["jpg","png","jpeg"],A0="add-endpoints",O0="remove-endpoints",Vf="sip-call-transfer";function Lt(){return!pe()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function pe(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function Kf(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function D0(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)&&(function(t,e){if(!t||!e)return!0;switch(t){case"Chrome":return e.major>=75;case"Safari":return RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")&&!(e.major===13&&e.minor===0&&e.point===0);case"Firefox":return e.major>=67}return!0}(kr(),xs())||pe())}function Wf(){if(pe()||!document)return!1;var t=document.createElement("iframe");return!!t.requestFullscreen||!!t.webkitRequestFullscreen}var ql="none",P0="software",L0="hardware",I0=function(){try{var t,e=document.createElement("canvas"),n=!1;(t=e.getContext("webgl2",{failIfMajorPerformanceCaveat:!0}))||(n=!0,t=e.getContext("webgl2"));var r=t!=null;return e.remove(),r?n?P0:L0:ql}catch{return ql}}();function qf(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!pe()&&I0!==ql&&(t?function(){return Qf()?!1:["Chrome","Firefox"].includes(kr())}():function(){if(Qf())return!1;var e=kr();if(e==="Safari"){var n=Ql();if(n.major<15||n.major===15&&n.minor<4)return!1}return e==="Chrome"?Gl().major>=77:e==="Firefox"?Yl().major>=97:["Chrome","Firefox","Safari"].includes(e)}())}function Jf(){if(pe()||Gf()||typeof AudioWorkletNode>"u")return!1;switch(kr()){case"Chrome":case"Firefox":return!0;case"Safari":var t=xs();return t.major>17||t.major===17&&t.minor>=4}return!1}function Jl(){return Kf()&&typeof MediaStreamTrack<"u"&&!function(){var t,e=kr();if(!Lt())return!0;switch(e){case"Chrome":return(t=Gl()).major&&t.major>0&&t.major<75;case"Firefox":return(t=Yl()).major<91;case"Safari":return(t=Ql()).major<13||t.major===13&&t.minor<1;default:return!0}}()}function Gf(){return Lt().match(/Linux; Android/)}function Qf(){var t,e=Lt(),n=e.match(/Mac/)&&(!pe()&&typeof window<"u"&&(t=window)!==null&&t!==void 0&&(t=t.navigator)!==null&&t!==void 0&&t.maxTouchPoints?window.navigator.maxTouchPoints:0)>=5;return!!(e.match(/Mobi/)||e.match(/Android/)||n)||!!Lt().match(/DailyAnd\//)||void 0}function kr(){if(typeof window<"u"){var t=Lt();return Yf()?"Safari":t.indexOf("Edge")>-1?"Edge":t.match(/Chrome\//)?"Chrome":t.indexOf("Safari")>-1||Xf()?"Safari":t.indexOf("Firefox")>-1?"Firefox":t.indexOf("MSIE")>-1||t.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function xs(){switch(kr()){case"Chrome":return Gl();case"Safari":return Ql();case"Firefox":return Yl();case"Edge":return function(){var t=0,e=0;if(typeof window<"u"){var n=Lt().match(/Edge\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}()}}function Gl(){var t=0,e=0,n=0,r=0,i=!1;if(typeof window<"u"){var o=Lt(),s=o.match(/Chrome\/(\d+).(\d+).(\d+).(\d+)/);if(s)try{t=parseInt(s[1]),e=parseInt(s[2]),n=parseInt(s[3]),r=parseInt(s[4]),i=o.indexOf("OPR/")>-1}catch{}}return{major:t,minor:e,build:n,patch:r,opera:i}}function Yf(){return!!Lt().match(/iPad|iPhone|iPod/i)&&Kf()}function Xf(){return Lt().indexOf("AppleWebKit/605.1.15")>-1}function Ql(){var t=0,e=0,n=0;if(typeof window<"u"){var r=Lt().match(/Version\/(\d+).(\d+)(.(\d+))?/);if(r)try{t=parseInt(r[1]),e=parseInt(r[2]),n=parseInt(r[4])}catch{}else(Yf()||Xf())&&(t=14,e=0,n=3)}return{major:t,minor:e,point:n}}function Yl(){var t=0,e=0;if(typeof window<"u"){var n=Lt().match(/Firefox\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}var Zf=function(){return bt(function t(){vt(this,t)},[{key:"addListenerForMessagesFromCallMachine",value:function(t,e,n){$i()}},{key:"addListenerForMessagesFromDailyJs",value:function(t,e,n){$i()}},{key:"sendMessageToCallMachine",value:function(t,e,n,r){$i()}},{key:"sendMessageToDailyJs",value:function(t,e){$i()}},{key:"removeListener",value:function(t){$i()}}])}();function ep(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Xl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ep(Object(n),!0).forEach(function(r){nn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ep(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tp=function(){return!!t})()}var R0=function(){function t(){var e,n,r,i;return vt(this,t),n=this,r=Ut(r=t),(e=Jo(n,tp()?Reflect.construct(r,[],Ut(n).constructor):r.apply(n,i)))._wrappedListeners={},e._messageCallbacks={},e}return Go(t,Zf),bt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){var i=this,o=function(s){if(s.data&&s.data.what==="iframe-call-message"&&(!s.data.callClientId||s.data.callClientId===n)&&(!s.data.from||s.data.from!=="module")){var a=Xl({},s.data);if(delete a.from,a.callbackStamp&&i._messageCallbacks[a.callbackStamp]){var l=a.callbackStamp;i._messageCallbacks[l].call(r,a),delete i._messageCallbacks[l]}delete a.what,delete a.callbackStamp,e.call(r,a)}};this._wrappedListeners[e]=o,window.addEventListener("message",o)}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){var i=function(o){var s;if(!(!o.data||o.data.what!==Vl||!o.data.action||o.data.from&&o.data.from!=="module"||o.data.callClientId&&n&&o.data.callClientId!==n||o!=null&&(s=o.data)!==null&&s!==void 0&&s.callFrameId)){var a=o.data;e.call(r,a)}};this._wrappedListeners[e]=i,window.addEventListener("message",i)}},{key:"sendMessageToCallMachine",value:function(e,n,r,i){if(!r)throw new Error("undefined callClientId. Are you trying to use a DailyCall instance previously destroyed?");var o=Xl({},e);if(o.what=Vl,o.from="module",o.callClientId=r,n){var s=Xo();this._messageCallbacks[s]=n,o.callbackStamp=s}var a=i?i.contentWindow:window,l=this._callMachineTargetOrigin(i);l&&a.postMessage(o,l)}},{key:"sendMessageToDailyJs",value:function(e,n){e.what=Vl,e.callClientId=n,e.from="embedded",window.postMessage(e,this._targetOriginFromWindowLocation())}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"forwardPackagedMessageToCallMachine",value:function(e,n,r){var i=Xl({},e);i.callClientId=r;var o=n?n.contentWindow:window,s=this._callMachineTargetOrigin(n);s&&o.postMessage(i,s)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(e,n){var r=function(i){if(i.data&&i.data.what==="iframe-call-message"&&(!i.data.callClientId||i.data.callClientId===n)&&(!i.data.from||i.data.from!=="module")){var o=i.data;e(o)}};return this._wrappedListeners[e]=r,window.addEventListener("message",r),e}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"_callMachineTargetOrigin",value:function(e){return e?e.src?new URL(e.src).origin:void 0:this._targetOriginFromWindowLocation()}},{key:"_targetOriginFromWindowLocation",value:function(){return window.location.protocol==="file:"?"*":window.location.origin}}])}();function np(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rp=function(){return!!t})()}var N0=function(){function t(){var e,n,r,i;return vt(this,t),n=this,r=Ut(r=t),e=Jo(n,rp()?Reflect.construct(r,[],Ut(n).constructor):r.apply(n,i)),global.callMachineToDailyJsEmitter=global.callMachineToDailyJsEmitter||new ol.EventEmitter,global.dailyJsToCallMachineEmitter=global.dailyJsToCallMachineEmitter||new ol.EventEmitter,e._wrappedListeners={},e._messageCallbacks={},e}return Go(t,Zf),bt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){this._addListener(e,global.callMachineToDailyJsEmitter,n,r,"received call machine message")}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){this._addListener(e,global.dailyJsToCallMachineEmitter,n,r,"received daily-js message")}},{key:"sendMessageToCallMachine",value:function(e,n,r){this._sendMessage(e,global.dailyJsToCallMachineEmitter,r,n,"sending message to call machine")}},{key:"sendMessageToDailyJs",value:function(e,n){this._sendMessage(e,global.callMachineToDailyJsEmitter,n,null,"sending message to daily-js")}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(global.callMachineToDailyJsEmitter.removeListener("message",n),global.dailyJsToCallMachineEmitter.removeListener("message",n),delete this._wrappedListeners[e])}},{key:"_addListener",value:function(e,n,r,i,o){var s=this,a=function(l){if(l.callClientId===r){if(l.callbackStamp&&s._messageCallbacks[l.callbackStamp]){var c=l.callbackStamp;s._messageCallbacks[c].call(i,l),delete s._messageCallbacks[c]}e.call(i,l)}};this._wrappedListeners[e]=a,n.addListener("message",a)}},{key:"_sendMessage",value:function(e,n,r,i,o){var s=function(l){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?np(Object(d),!0).forEach(function(h){nn(l,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):np(Object(d)).forEach(function(h){Object.defineProperty(l,h,Object.getOwnPropertyDescriptor(d,h))})}return l}({},e);if(s.callClientId=r,i){var a=Xo();this._messageCallbacks[a]=i,s.callbackStamp=a}n.emit("message",s)}}])}(),Zl="replace",ec="shallow-merge",ip=[Zl,ec],$0=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.data,r=e.mergeStrategy,i=r===void 0?Zl:r;vt(this,t),t._validateMergeStrategy(i),t._validateData(n,i),this.mergeStrategy=i,this.data=n}return bt(t,[{key:"isNoOp",value:function(){return t.isNoOpUpdate(this.data,this.mergeStrategy)}}],[{key:"isNoOpUpdate",value:function(e,n){return Object.keys(e).length===0&&n===ec}},{key:"_validateMergeStrategy",value:function(e){if(!ip.includes(e))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(ip,"]"))}},{key:"_validateData",value:function(e,n){if(!function(a){if(a==null||me(a)!=="object")return!1;var l=Object.getPrototypeOf(a);return l==null||l===Object.prototype}(e))throw Error("Meeting session data must be a plain (map-like) object");var r;try{if(r=JSON.stringify(e),n===Zl){var i=JSON.parse(r);rt(i,e)||console.warn("The meeting session data provided will be modified when serialized.",i,e)}else if(n===ec){for(var o in e)if(Object.hasOwnProperty.call(e,o)&&e[o]!==void 0){var s=JSON.parse(JSON.stringify(e[o]));rt(e[o],s)||console.warn("At least one key in the meeting session data provided will be modified when serialized.",s,e[o])}}}catch(a){throw Error("Meeting session data must be serializable to JSON: ".concat(a))}if(r.length>Bf)throw Error("Meeting session data is too large (".concat(r.length," characters). Maximum size suppported is ").concat(Bf,"."))}}])}();function op(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(op=function(){return!!t})()}function tc(t){var e=typeof Map=="function"?new Map:void 0;return tc=function(n){if(n===null||!function(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return function(i,o,s){if(op())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,o);var l=new(i.bind.apply(i,a));return s&&Ni(l,s.prototype),l}(n,arguments,Ut(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ni(r,n)},tc(t)}function sp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sp=function(){return!!t})()}function ap(t){var e,n=(e=window._daily)===null||e===void 0?void 0:e.pendings;if(n){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}var F0=function(){return bt(function t(e){vt(this,t),this._currentLoad=null,this._callClientId=e},[{key:"load",value:function(){var t,e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;if(this.loaded)return window._daily.instances[this._callClientId].callMachine.reset(),void r(!0);t=this._callClientId,window._daily.pendings.push(t),this._currentLoad&&this._currentLoad.cancel(),this._currentLoad=new j0(n,function(){r(!1)},function(o,s){s||ap(e._callClientId),i(o,s)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),ap(this._callClientId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}])}(),j0=function(){return bt(function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;vt(this,t),this._attemptsRemaining=3,this._currentAttempt=null,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r},[{key:"start",value:function(){var t=this;if(!this._currentAttempt){var e=function(n){t._currentAttempt.cancelled||(t._attemptsRemaining--,t._failureCallback(n,t._attemptsRemaining>0),t._attemptsRemaining<=0||setTimeout(function(){t._currentAttempt.cancelled||(t._currentAttempt=new lp(t._dailyConfig,t._successCallback,e),t._currentAttempt.start())},3e3))};this._currentAttempt=new lp(this._dailyConfig,this._successCallback,e),this._currentAttempt.start()}}},{key:"cancel",value:function(){this._currentAttempt&&this._currentAttempt.cancel()}},{key:"cancelled",get:function(){return this._currentAttempt&&this._currentAttempt.cancelled}},{key:"succeeded",get:function(){return this._currentAttempt&&this._currentAttempt.succeeded}}])}(),nc=function(){function t(){return vt(this,t),e=this,r=arguments,n=Ut(n=t),Jo(e,sp()?Reflect.construct(n,r||[],Ut(e).constructor):n.apply(e,r));var e,n,r}return Go(t,tc(Error)),bt(t)}(),_s=2e4,lp=function(){return bt(function e(n,r,i){vt(this,e),this._loadAttemptImpl=pe()||!n.avoidEval?new B0(n,r,i):new U0(n,r,i)},[{key:"start",value:(t=te(function*(){return this._loadAttemptImpl.start()}),function(){return t.apply(this,arguments)})},{key:"cancel",value:function(){this._loadAttemptImpl.cancel()}},{key:"cancelled",get:function(){return this._loadAttemptImpl.cancelled}},{key:"succeeded",get:function(){return this._loadAttemptImpl.succeeded}}]);var t}(),B0=function(){return bt(function i(o,s,a){vt(this,i),this.cancelled=!1,this.succeeded=!1,this._networkTimedOut=!1,this._networkTimeout=null,this._iosCache=typeof iOSCallObjectBundleCache<"u"&&iOSCallObjectBundleCache,this._refetchHeaders=null,this._dailyConfig=o,this._successCallback=s,this._failureCallback=a},[{key:"start",value:(r=te(function*(){var i=Zo(this._dailyConfig);!(yield this._tryLoadFromIOSCache(i))&&this._loadFromNetwork(i)}),function(){return r.apply(this,arguments)})},{key:"cancel",value:function(){clearTimeout(this._networkTimeout),this.cancelled=!0}},{key:"_tryLoadFromIOSCache",value:(n=te(function*(i){if(!this._iosCache)return!1;try{var o=yield this._iosCache.get(i);return!!this.cancelled||!!o&&(o.code?(Function('"use strict";'+o.code)(),this.succeeded=!0,this._successCallback(),!0):(this._refetchHeaders=o.refetchHeaders,!1))}catch{return!1}}),function(i){return n.apply(this,arguments)})},{key:"_loadFromNetwork",value:(e=te(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(_s," ms) when loading call object bundle ").concat(i),type:"timeout"})},_s);try{var s=this._refetchHeaders?{headers:this._refetchHeaders}:{},a=yield fetch(i,s);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new nc;var l=yield this._getBundleCodeFromResponse(i,a);if(this.cancelled)throw new nc;Function('"use strict";'+l)(),this._iosCache&&this._iosCache.set(i,l,a.headers),this.succeeded=!0,this._successCallback()}catch(c){if(clearTimeout(this._networkTimeout),c instanceof nc||this.cancelled||this._networkTimedOut)return;this._failureCallback({msg:"Failed to load call object bundle ".concat(i,": ").concat(c),type:c.message})}}),function(i){return e.apply(this,arguments)})},{key:"_getBundleCodeFromResponse",value:(t=te(function*(i,o){if(o.ok)return yield o.text();if(this._iosCache&&o.status===304)return(yield this._iosCache.renew(i,o.headers)).code;throw new Error("Received ".concat(o.status," response"))}),function(i,o){return t.apply(this,arguments)})}]);var t,e,n,r}(),U0=function(){return bt(function t(e,n,r){vt(this,t),this.cancelled=!1,this.succeeded=!1,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r,this._attemptId=Xo(),this._networkTimeout=null,this._scriptElement=null},[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=Zo(this._dailyConfig);(typeof document>"u"?"undefined":me(document))==="object"?this._startLoading(t):this._failureCallback({msg:"Call object bundle must be loaded in a DOM/web context",type:"missing context"})}},{key:"cancel",value:function(){this._stopLoading(),this.cancelled=!0}},{key:"_startLoading",value:function(t){var e=this;this._signUpForCallMachineLoadWaitlist(),this._networkTimeout=setTimeout(function(){e._stopLoading(),e._failureCallback({msg:"Timed out (>".concat(_s," ms) when loading call object bundle ").concat(t),type:"timeout"})},_s);var n=document.getElementsByTagName("head")[0],r=document.createElement("script");this._scriptElement=r,r.onload=function(){e._stopLoading(),e.succeeded=!0,e._successCallback()},r.onerror=function(i){e._stopLoading(),e._failureCallback({msg:"Failed to load call object bundle ".concat(i.target.src),type:i.message})},r.src=t,n.appendChild(r)}},{key:"_stopLoading",value:function(){this._withdrawFromCallMachineLoadWaitlist(),clearTimeout(this._networkTimeout),this._scriptElement&&(this._scriptElement.onload=null,this._scriptElement.onerror=null)}},{key:"_signUpForCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.add(this._attemptId)}},{key:"_withdrawFromCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.delete(this._attemptId)}}])}(),Cs=function(t,e,n){return H0(t.local,e,n)===!0},z0=function(t,e,n){return t.local.streams&&t.local.streams[e]&&t.local.streams[e].stream&&t.local.streams[e].stream["get".concat(n==="video"?"Video":"Audio","Tracks")]()[0]},Xr=function(t,e,n,r){var i=V0(t,e,n,r);return i&&i.pendingTrack},H0=function(t,e,n){if(!t)return!1;var r=function(o){switch(o){case"avatar":return!0;case"staged":return o;default:return!!o}},i=t.public.subscribedTracks;return i&&i[e]?["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo"].indexOf(n)===-1&&i[e].custom?[!0,"staged"].includes(i[e].custom)?r(i[e].custom):r(i[e].custom[n]):r(i[e][n]):!i||r(i.ALL)},V0=function(t,e,n,r){var i=Object.values(t.streams||{}).filter(function(o){return o.participantId===e&&o.type===n&&o.pendingTrack&&o.pendingTrack.kind===r}).sort(function(o,s){return new Date(s.starttime)-new Date(o.starttime)});return i&&i[0]},K0=function(t,e){var n=t.local.public.customTracks;if(n&&n[e])return n[e].track};function cp(t,e){for(var n=e.getState(),r=0,i=["cam","screen"];r<i.length;r++)for(var o=i[r],s=0,a=["video","audio"];s<a.length;s++){var l=a[s],c=o==="cam"?l:"screen".concat(l.charAt(0).toUpperCase()+l.slice(1)),d=t.tracks[c];if(d){var h=t.local?z0(n,o,l):Xr(n,t.session_id,o,l);d.state==="playable"&&(d.track=h),d.persistentTrack=h}}}function up(t,e){try{var n=e.getState();for(var r in t.tracks)if(!W0(r)){var i=t.tracks[r].kind;if(i){var o=t.tracks[r];if(o){var s=t.local?K0(n,r):Xr(n,t.session_id,r,i);o.state==="playable"&&(t.tracks[r].track=s),o.persistentTrack=s}}else console.error("unknown type for custom track")}}catch(a){console.error(a)}}function W0(t){return["video","audio","screenVideo","screenAudio"].includes(t)}function dp(t,e,n){var r=n.getState();if(t.local){if(t.audio)try{t.audioTrack=r.local.streams.cam.stream.getAudioTracks()[0],t.audioTrack||(t.audio=!1)}catch{}if(t.video)try{t.videoTrack=r.local.streams.cam.stream.getVideoTracks()[0],t.videoTrack||(t.video=!1)}catch{}if(t.screen)try{t.screenVideoTrack=r.local.streams.screen.stream.getVideoTracks()[0],t.screenAudioTrack=r.local.streams.screen.stream.getAudioTracks()[0],t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch{}}else{var i=!0;try{var o=r.participants[t.session_id];o&&o.public&&o.public.rtcType&&o.public.rtcType.impl==="peer-to-peer"&&o.private&&!["connected","completed"].includes(o.private.peeringState)&&(i=!1)}catch(d){console.error(d)}if(!i)return t.audio=!1,t.audioTrack=!1,t.video=!1,t.videoTrack=!1,t.screen=!1,void(t.screenTrack=!1);try{if(r.streams,t.audio&&Cs(r,t.session_id,"cam-audio")){var s=Xr(r,t.session_id,"cam","audio");s&&(e&&e.audioTrack&&e.audioTrack.id===s.id?t.audioTrack=s:s.muted||(t.audioTrack=s)),t.audioTrack||(t.audio=!1)}if(t.video&&Cs(r,t.session_id,"cam-video")){var a=Xr(r,t.session_id,"cam","video");a&&(e&&e.videoTrack&&e.videoTrack.id===a.id?t.videoTrack=a:a.muted||(t.videoTrack=a)),t.videoTrack||(t.video=!1)}if(t.screen&&Cs(r,t.session_id,"screen-audio")){var l=Xr(r,t.session_id,"screen","audio");l&&(e&&e.screenAudioTrack&&e.screenAudioTrack.id===l.id?t.screenAudioTrack=l:l.muted||(t.screenAudioTrack=l))}if(t.screen&&Cs(r,t.session_id,"screen-video")){var c=Xr(r,t.session_id,"screen","video");c&&(e&&e.screenVideoTrack&&e.screenVideoTrack.id===c.id?t.screenVideoTrack=c:c.muted||(t.screenVideoTrack=c))}t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch(d){console.error("unexpected error matching up tracks",d)}}}function q0(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return hp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?hp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
28
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function hp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var rn=new Map,Zr=null;function J0(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return fp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?fp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
29
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function fp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var on=new Map,Hi=null;function G0(t){pp()?function(e){rn.has(e)||(rn.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){rn.has(e)&&(rn.get(e).lastDevicesString=JSON.stringify(n),Zr||(Zr=function(){var r=te(function*(){var i,o=yield navigator.mediaDevices.enumerateDevices(),s=q0(rn.keys());try{for(s.s();!(i=s.n()).done;){var a=i.value,l=JSON.stringify(o);l!==rn.get(a).lastDevicesString&&(rn.get(a).lastDevicesString=l,a(o))}}catch(c){s.e(c)}finally{s.f()}});return function(){return r.apply(this,arguments)}}(),navigator.mediaDevices.addEventListener("devicechange",Zr)))}).catch(function(){}))}(t):function(e){on.has(e)||(on.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){on.has(e)&&(on.get(e).lastDevicesString=JSON.stringify(n),Hi||(Hi=setInterval(te(function*(){var r,i=yield navigator.mediaDevices.enumerateDevices(),o=J0(on.keys());try{for(o.s();!(r=o.n()).done;){var s=r.value,a=JSON.stringify(i);a!==on.get(s).lastDevicesString&&(on.get(s).lastDevicesString=a,s(i))}}catch(l){o.e(l)}finally{o.f()}}),3e3)))}))}(t)}function Q0(t){pp()?function(e){rn.has(e)&&(rn.delete(e),rn.size===0&&Zr&&(navigator.mediaDevices.removeEventListener("devicechange",Zr),Zr=null))}(t):function(e){on.has(e)&&(on.delete(e),on.size===0&&Hi&&(clearInterval(Hi),Hi=null))}(t)}function pp(){var t;return pe()||((t=navigator.mediaDevices)===null||t===void 0?void 0:t.ondevicechange)!==void 0}var Y0=new Set;function X0(t,e){return t&&t.readyState==="live"&&!function(n,r){return n.muted&&!Y0.has(n.id)}(t)}function gp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gp(Object(n),!0).forEach(function(r){nn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var Vi=Object.freeze({VIDEO:"video",AUDIO:"audio",SCREEN_VIDEO:"screenVideo",SCREEN_AUDIO:"screenAudio",CUSTOM_VIDEO:"customVideo",CUSTOM_AUDIO:"customAudio"}),Z0=Object.freeze({PARTICIPANTS:"participants",STREAMING:"streaming",TRANSCRIPTION:"transcription"}),Ki=Object.values(Vi),mp=["v","a","sv","sa","cv","ca"];Object.freeze(Ki.reduce(function(t,e,n){return t[e]=mp[n],t},{})),Object.freeze(mp.reduce(function(t,e,n){return t[e]=Ki[n],t},{}));var eS=[Vi.VIDEO,Vi.AUDIO,Vi.SCREEN_VIDEO,Vi.SCREEN_AUDIO],yp=Object.values(Z0),vp=["p","s","t"];Object.freeze(yp.reduce(function(t,e,n){return t[e]=vp[n],t},{})),Object.freeze(vp.reduce(function(t,e,n){return t[e]=yp[n],t},{}));var bp=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.base,r=e.byUserId,i=e.byParticipantId;vt(this,t),this.base=n,this.byUserId=r,this.byParticipantId=i}return bt(t,[{key:"clone",value:function(){var e=new t;if(this.base instanceof We?e.base=this.base.clone():e.base=this.base,this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof We?r.clone():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof We?o.clone():o}return e}},{key:"toJSONObject",value:function(){var e={};if(typeof this.base=="boolean"?e.base=this.base:this.base instanceof We&&(e.base=this.base.toJSONObject()),this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof We?r.toJSONObject():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof We?o.toJSONObject():o}return e}},{key:"toMinifiedJSONObject",value:function(){var e={};if(this.base!==void 0&&(typeof this.base=="boolean"?e.b=this.base:e.b=this.base.toMinifiedJSONObject()),this.byUserId!==void 0)for(var n in e.u={},this.byUserId){var r=this.byUserId[n];e.u[n]=typeof r=="boolean"?r:r.toMinifiedJSONObject()}if(this.byParticipantId!==void 0)for(var i in e.p={},this.byParticipantId){var o=this.byParticipantId[i];e.p[i]=typeof o=="boolean"?o:o.toMinifiedJSONObject()}return e}},{key:"normalize",value:function(){return this.base instanceof We&&(this.base=this.base.normalize()),this.byUserId&&(this.byUserId=Object.fromEntries(Object.entries(this.byUserId).map(function(e){var n=Ye(e,2),r=n[0],i=n[1];return[r,i instanceof We?i.normalize():i]}))),this.byParticipantId&&(this.byParticipantId=Object.fromEntries(Object.entries(this.byParticipantId).map(function(e){var n=Ye(e,2),r=n[0],i=n[1];return[r,i instanceof We?i.normalize():i]}))),this}}],[{key:"fromJSONObject",value:function(e){var n,r,i;if(e.base!==void 0&&(n=typeof e.base=="boolean"?e.base:We.fromJSONObject(e.base)),e.byUserId!==void 0)for(var o in r={},e.byUserId){var s=e.byUserId[o];r[o]=typeof s=="boolean"?s:We.fromJSONObject(s)}if(e.byParticipantId!==void 0)for(var a in i={},e.byParticipantId){var l=e.byParticipantId[a];i[a]=typeof l=="boolean"?l:We.fromJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"fromMinifiedJSONObject",value:function(e){var n,r,i;if(e.b!==void 0&&(n=typeof e.b=="boolean"?e.b:We.fromMinifiedJSONObject(e.b)),e.u!==void 0)for(var o in r={},e.u){var s=e.u[o];r[o]=typeof s=="boolean"?s:We.fromMinifiedJSONObject(s)}if(e.p!==void 0)for(var a in i={},e.p){var l=e.p[a];i[a]=typeof l=="boolean"?l:We.fromMinifiedJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"validateJSONObject",value:function(e){if(me(e)!=="object")return[!1,"canReceive must be an object"];for(var n=["base","byUserId","byParticipantId"],r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];if(!n.includes(o))return[!1,"canReceive can only contain keys (".concat(n.join(", "),")")];if(o==="base"){var s=Ye(We.validateJSONObject(e.base,!0),2),a=s[0],l=s[1];if(!a)return[!1,l]}else{if(me(e[o])!=="object")return[!1,"invalid (non-object) value for field '".concat(o,"' in canReceive")];for(var c=0,d=Object.values(e[o]);c<d.length;c++){var h=d[c],f=Ye(We.validateJSONObject(h),2),v=f[0],b=f[1];if(!v)return[!1,b]}}}return[!0]}}])}(),We=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.video,r=e.audio,i=e.screenVideo,o=e.screenAudio,s=e.customVideo,a=e.customAudio;vt(this,t),this.video=n,this.audio=r,this.screenVideo=i,this.screenAudio=o,this.customVideo=s,this.customAudio=a}return bt(t,[{key:"clone",value:function(){var e=new t;return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=zn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=zn({},this.customAudio)),e}},{key:"toJSONObject",value:function(){var e={};return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=zn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=zn({},this.customAudio)),e}},{key:"toMinifiedJSONObject",value:function(){var e={};return this.video!==void 0&&(e.v=this.video),this.audio!==void 0&&(e.a=this.audio),this.screenVideo!==void 0&&(e.sv=this.screenVideo),this.screenAudio!==void 0&&(e.sa=this.screenAudio),this.customVideo!==void 0&&(e.cv=zn({},this.customVideo)),this.customAudio!==void 0&&(e.ca=zn({},this.customAudio)),e}},{key:"normalize",value:function(){function e(n,r){return n&&Object.keys(n).length===1&&n["*"]===r}return!(this.video!==!0||this.audio!==!0||this.screenVideo!==!0||this.screenAudio!==!0||!e(this.customVideo,!0)||!e(this.customAudio,!0))||(this.video!==!1||this.audio!==!1||this.screenVideo!==!1||this.screenAudio!==!1||!e(this.customVideo,!1)||!e(this.customAudio,!1))&&this}}],[{key:"fromBoolean",value:function(e){return new t({video:e,audio:e,screenVideo:e,screenAudio:e,customVideo:{"*":e},customAudio:{"*":e}})}},{key:"fromJSONObject",value:function(e){return new t({video:e.video,audio:e.audio,screenVideo:e.screenVideo,screenAudio:e.screenAudio,customVideo:e.customVideo!==void 0?zn({},e.customVideo):void 0,customAudio:e.customAudio!==void 0?zn({},e.customAudio):void 0})}},{key:"fromMinifiedJSONObject",value:function(e){return new t({video:e.v,audio:e.a,screenVideo:e.sv,screenAudio:e.sa,customVideo:e.cv,customAudio:e.ca})}},{key:"validateJSONObject",value:function(e,n){if(typeof e=="boolean")return[!0];if(me(e)!=="object")return[!1,"invalid (non-object, non-boolean) value in canReceive"];for(var r=Object.keys(e),i=0,o=r;i<o.length;i++){var s=o[i];if(!Ki.includes(s))return[!1,"invalid media type '".concat(s,"' in canReceive")];if(eS.includes(s)){if(typeof e[s]!="boolean")return[!1,"invalid (non-boolean) value for media type '".concat(s,"' in canReceive")]}else{if(me(e[s])!=="object")return[!1,"invalid (non-object) value for media type '".concat(s,"' in canReceive")];for(var a=0,l=Object.values(e[s]);a<l.length;a++)if(typeof l[a]!="boolean")return[!1,"invalid (non-boolean) value for entry within '".concat(s,"' in canReceive")];if(n&&e[s]["*"]===void 0)return[!1,`canReceive "base" permission must specify "*" as an entry within '`.concat(s,"'")]}}return n&&r.length!==Ki.length?[!1,'canReceive "base" permission must specify all media types: '.concat(Ki.join(", ")," (or be set to a boolean shorthand)")]:[!0]}}])}(),tS=["result"],nS=["preserveIframe"];function wp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function G(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wp(Object(n),!0).forEach(function(r){nn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Sp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Sp=function(){return!!t})()}function kp(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return xp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?xp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
30
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function xp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var xr={},_p="video",rS="voice",Cp=pe()?{data:{}}:{data:{},topology:"none"},Ep={present:0,hidden:0},Tp={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},rc=Object.keys(Tp),Mp=["state","volume","simulcastEncodings"],Ap={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},Es={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string",visualState:"'default' | 'sidebar-open' | 'active'"}},ic={id:{allow:"string",controlledBy:"'*' | 'owners' | string[]",csp:"string",iconURL:"string",label:"string",loading:"'eager' | 'lazy'",location:"'main' | 'sidebar'",name:"string",referrerPolicy:"string",sandbox:"string",src:"string",srcdoc:"string",shared:"string[] | 'owners' | boolean"}},_r={customIntegrations:{validate:jp,help:$p()},customTrayButtons:{validate:Fp,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(Es))},url:{validate:function(t){return typeof t=="string"},help:"url should be a string"},baseUrl:{validate:function(t){return typeof t=="string"},help:"baseUrl should be a string"},token:{validate:function(t){return typeof t=="string"},help:"token should be a string",queryString:"t"},dailyConfig:{validate:function(t,e){try{return e.validateDailyConfig(t),!0}catch(n){console.error("Failed to validate dailyConfig",n)}return!1},help:"Unsupported dailyConfig. Check error logs for detailed info."},reactNativeConfig:{validate:function(t){return Bp(t,Ap)},help:"reactNativeConfig should look like ".concat(JSON.stringify(Ap),", all fields optional")},lang:{validate:function(t){return["da","de","en-us","en","es","fi","fr","it","jp","ka","nl","no","pl","pt","pt-BR","ru","sv","tr","user"].includes(t)},help:"language not supported. Options are: da, de, en-us, en, es, fi, fr, it, jp, ka, nl, no, pl, pt, pt-BR, ru, sv, tr, user"},userName:!0,userData:{validate:function(t){try{return Dp(t),!0}catch(e){return console.error(e),!1}},help:"invalid userData type provided"},startVideoOff:!0,startAudioOff:!0,allowLocalVideo:!0,allowLocalAudio:!0,activeSpeakerMode:!0,showLeaveButton:!0,showLocalVideo:!0,showParticipantsBar:!0,showFullscreenButton:!0,showUserNameChangeUI:!0,iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,videoSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalVideo=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.videoTrack=t,n={customTrack:bn};else{if(delete e._sharedTracks.videoTrack,typeof t!="string")return console.error("videoSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({video:{settings:n}},!1),!0}},audioSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalAudio=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.audioTrack=t,n={customTrack:bn};else{if(delete e._sharedTracks.audioTrack,typeof t!="string")return console.error("audioSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({audio:{settings:n}},!1),!0}},subscribeToTracksAutomatically:{validate:function(t,e){return e._preloadCache.subscribeToTracksAutomatically=t,!0}},theme:{validate:function(t){var e=["accent","accentText","background","backgroundAccent","baseText","border","mainAreaBg","mainAreaBgAccent","mainAreaText","supportiveText"],n=function(r){for(var i=0,o=Object.keys(r);i<o.length;i++){var s=o[i];if(!e.includes(s))return console.error('unsupported color "'.concat(s,'". Valid colors: ').concat(e.join(", "))),!1;if(!r[s].match(/^#[0-9a-f]{6}|#[0-9a-f]{3}$/i))return console.error("".concat(s,' theme color should be provided in valid hex color format. Received: "').concat(r[s],'"')),!1}return!0};return me(t)==="object"&&("light"in t&&"dark"in t||"colors"in t)?"light"in t&&"dark"in t?"colors"in t.light?"colors"in t.dark?n(t.light.colors)&&n(t.dark.colors):(console.error('Dark theme is missing "colors" property.',t),!1):(console.error('Light theme is missing "colors" property.',t),!1):n(t.colors):(console.error('Theme must contain either both "light" and "dark" properties, or "colors".',t),!1)},help:"unsupported theme configuration. Check error logs for detailed info."},layoutConfig:{validate:function(t){if("grid"in t){var e=t.grid;if("maxTilesPerPage"in e){if(!Number.isInteger(e.maxTilesPerPage))return console.error("grid.maxTilesPerPage should be an integer. You passed ".concat(e.maxTilesPerPage,".")),!1;if(e.maxTilesPerPage>49)return console.error("grid.maxTilesPerPage can't be larger than 49 without sacrificing browser performance. Please contact us at https://www.daily.co/contact to talk about your use case."),!1}if("minTilesPerPage"in e){if(!Number.isInteger(e.minTilesPerPage))return console.error("grid.minTilesPerPage should be an integer. You passed ".concat(e.minTilesPerPage,".")),!1;if(e.minTilesPerPage<1)return console.error("grid.minTilesPerPage can't be lower than 1."),!1;if("maxTilesPerPage"in e&&e.minTilesPerPage>e.maxTilesPerPage)return console.error("grid.minTilesPerPage can't be higher than grid.maxTilesPerPage."),!1}}return!0},help:"unsupported layoutConfig. Check error logs for detailed info."},receiveSettings:{validate:function(t){return Pp(t,{allowAllParticipantsKey:!1})},help:Np({allowAllParticipantsKey:!1})},sendSettings:{validate:function(t,e){return!!function(n,r){try{return r.validateUpdateSendSettings(n),!0}catch(i){return console.error("Failed to validate send settings",i),!1}}(t,e)&&(e._preloadCache.sendSettings=t,!0)},help:"Invalid sendSettings provided. Check error logs for detailed info."},inputSettings:{validate:function(t,e){var n;return!!Lp(t)&&(e._inputSettings||(e._inputSettings={}),Ip(t,(n=e.properties)===null||n===void 0?void 0:n.dailyConfig,e._sharedTracks),e._updatePreloadCacheInputSettings(t,!0),!0)},help:ac()},layout:{validate:function(t){return t==="custom-v1"||t==="browser"||t==="none"},help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"},embHref:{queryString:"embHref"},dailyJsVersion:{queryString:"dailyJsVersion"},proxy:{queryString:"proxy"},strictMode:!0,allowMultipleCallInstances:!0},Ts={styles:{validate:function(t){for(var e in t)if(e!=="cam"&&e!=="screen")return!1;if(t.cam){for(var n in t.cam)if(n!=="div"&&n!=="video")return!1}if(t.screen){for(var r in t.screen)if(r!=="div"&&r!=="video")return!1}return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setSubscribedTracks:{validate:function(t,e){if(e._preloadCache.subscribeToTracksAutomatically)return!1;var n=[!0,!1,"staged"];if(n.includes(t)||!pe()&&t==="avatar")return!0;var r=["audio","video","screenAudio","screenVideo","rmpAudio","rmpVideo"],i=function(o){var s=arguments.length>1&&arguments[1]!==void 0&&arguments[1];for(var a in o)if(a==="custom"){if(!n.includes(o[a])&&!i(o[a],!0))return!1}else{var l=!s&&!r.includes(a),c=!n.includes(o[a]);if(l||c)return!1}return!0};return i(t)},help:"setSubscribedTracks cannot be used when setSubscribeToTracksAutomatically is enabled, and should be of the form: "+"true".concat(pe()?"":" | 'avatar'"," | false | 'staged' | { [audio: true|false|'staged'], [video: true|false|'staged'], [screenAudio: true|false|'staged'], [screenVideo: true|false|'staged'] }")},setAudio:!0,setVideo:!0,setScreenShare:{validate:function(t){return t===!1},help:"setScreenShare must be false, as it's only meant for stopping remote participants' screen shares"},eject:!0,updatePermissions:{validate:function(t){for(var e=0,n=Object.entries(t);e<n.length;e++){var r=Ye(n[e],2),i=r[0],o=r[1];switch(i){case"hasPresence":if(typeof o!="boolean")return!1;break;case"canSend":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var s,a=["video","audio","screenVideo","screenAudio","customVideo","customAudio"],l=kp(o);try{for(l.s();!(s=l.n()).done;){var c=s.value;if(!a.includes(c))return!1}}catch(m){l.e(m)}finally{l.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canSend=new Set(o));break;case"canReceive":var d=Ye(bp.validateJSONObject(o),2),h=d[0],f=d[1];if(!h)return console.error(f),!1;break;case"canAdmin":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var v,b=["participants","streaming","transcription"],g=kp(o);try{for(g.s();!(v=g.n()).done;){var S=v.value;if(!b.includes(S))return!1}}catch(m){g.e(m)}finally{g.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canAdmin=new Set(o));break;default:return!1}}return!0},help:"updatePermissions can take hasPresence, canSend, canReceive, and canAdmin permissions. hasPresence must be a boolean. canSend can be a boolean or an Array or Set of media types (video, audio, screenVideo, screenAudio, customVideo, customAudio). canReceive must be an object specifying base, byUserId, and/or byParticipantId fields (see documentation for more details). canAdmin can be a boolean or an Array or Set of admin types (participants, streaming, transcription)."}};Promise.any||(Promise.any=function(){var t=te(function*(e){return new Promise(function(n,r){var i=[];e.forEach(function(o){return Promise.resolve(o).then(function(s){n(s)}).catch(function(s){i.push(s),i.length===e.length&&r(i)})})})});return function(e){return t.apply(this,arguments)}}());var iS=function(){function t(u){var y,p,x,_,O,I,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(vt(this,t),x=this,_=Ut(_=t),nn(p=Jo(x,Sp()?Reflect.construct(_,[],Ut(x).constructor):_.apply(x,O)),"startListeningForDeviceChanges",function(){G0(p.handleDeviceChange)}),nn(p,"stopListeningForDeviceChanges",function(){Q0(p.handleDeviceChange)}),nn(p,"handleDeviceChange",function(ne){ne=ne.map(function(he){return JSON.parse(JSON.stringify(he))}),p.emitDailyJSEvent({action:"available-devices-updated",availableDevices:ne})}),nn(p,"handleNativeAppStateChange",function(){var ne=te(function*(he){if(he==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield p.destroy());var ut=he==="active";p.disableReactNativeAutoDeviceManagement("video")||(ut?p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!0):(p.camUnmutedBeforeLosingNativeActiveState=p.localVideo(),p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!1)))});return function(he){return ne.apply(this,arguments)}}()),nn(p,"handleNativeAudioFocusChange",function(ne){p.disableReactNativeAutoDeviceManagement("audio")||(p._hasNativeAudioFocus=ne,p.toggleParticipantAudioBasedOnNativeAudioFocus(),p._hasNativeAudioFocus?p.micUnmutedBeforeLosingNativeAudioFocus&&p.setLocalAudio(!0):(p.micUnmutedBeforeLosingNativeAudioFocus=p.localAudio(),p.setLocalAudio(!1)))}),nn(p,"handleNativeSystemScreenCaptureStop",function(){p.stopScreenShare()}),!Jl()&&!pe())throw new Error("WebRTC not supported or suppressed");if(p.strictMode=$.strictMode===void 0||$.strictMode,p.allowMultipleCallInstances=(y=$.allowMultipleCallInstances)!==null&&y!==void 0&&y,Object.keys(xr).length&&(p._logDuplicateInstanceAttempt(),!p.allowMultipleCallInstances)){if(p.strictMode)throw new Error("Duplicate DailyIframe instances are not allowed");console.warn("Using strictMode: false to allow multiple call instances is now deprecated. Set `allowMultipleCallInstances: true`")}if(window._daily||(window._daily={pendings:[],instances:{}}),p.callClientId=Xo(),xr[(I=p).callClientId]=I,window._daily.instances[p.callClientId]={},p._sharedTracks={},window._daily.instances[p.callClientId].tracks=p._sharedTracks,$.dailyJsVersion=t.version(),p._iframe=u,p._callObjectMode=$.layout==="none"&&!p._iframe,p._preloadCache={subscribeToTracksAutomatically:!0,outputDeviceId:null,inputSettings:null,sendSettings:null,videoTrackForNetworkConnectivityTest:null,videoTrackForConnectionQualityTest:null},$.showLocalVideo!==void 0?p._callObjectMode?console.error("showLocalVideo is not available in call object mode"):p._showLocalVideo=!!$.showLocalVideo:p._showLocalVideo=!0,$.showParticipantsBar!==void 0?p._callObjectMode?console.error("showParticipantsBar is not available in call object mode"):p._showParticipantsBar=!!$.showParticipantsBar:p._showParticipantsBar=!0,$.customIntegrations!==void 0?p._callObjectMode?console.error("customIntegrations is not available in call object mode"):p._customIntegrations=$.customIntegrations:p._customIntegrations={},$.customTrayButtons!==void 0?p._callObjectMode?console.error("customTrayButtons is not available in call object mode"):p._customTrayButtons=$.customTrayButtons:p._customTrayButtons={},$.activeSpeakerMode!==void 0?p._callObjectMode?console.error("activeSpeakerMode is not available in call object mode"):p._activeSpeakerMode=!!$.activeSpeakerMode:p._activeSpeakerMode=!1,$.receiveSettings?p._callObjectMode?p._receiveSettings=$.receiveSettings:console.error("receiveSettings is only available in call object mode"):p._receiveSettings={},p.validateProperties($),p.properties=G({},$),p._inputSettings||(p._inputSettings={}),p._callObjectLoader=p._callObjectMode?new F0(p.callClientId):null,p._callState=Of,p._isPreparingToJoin=!1,p._accessState={access:zl},p._meetingSessionSummary={},p._finalSummaryOfPrevSession={},p._meetingSessionState=lc(Cp,p._callObjectMode),p._nativeInCallAudioMode=_p,p._participants={},p._isScreenSharing=!1,p._participantCounts=Ep,p._rmpPlayerState={},p._waitingParticipants={},p._network={threshold:"good",quality:100,networkState:"unknown",stats:{}},p._activeSpeaker={},p._localAudioLevel=0,p._isLocalAudioLevelObserverRunning=!1,p._remoteParticipantsAudioLevel={},p._isRemoteParticipantsAudioLevelObserverRunning=!1,p._maxAppMessageSize=Hl,p._messageChannel=pe()?new N0:new R0,p._iframe&&(p._iframe.requestFullscreen?p._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===p._iframe?(p.emitDailyJSEvent({action:bs}),p.sendMessageToCallMachine({action:bs})):(p.emitDailyJSEvent({action:ws}),p.sendMessageToCallMachine({action:ws}))}):p._iframe.webkitRequestFullscreen&&p._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===p._iframe?(p.emitDailyJSEvent({action:bs}),p.sendMessageToCallMachine({action:bs})):(p.emitDailyJSEvent({action:ws}),p.sendMessageToCallMachine({action:ws}))})),pe()){var U=p.nativeUtils();U.addAudioFocusChangeListener&&U.removeAudioFocusChangeListener&&U.addAppStateChangeListener&&U.removeAppStateChangeListener&&U.addSystemScreenCaptureStopListener&&U.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),p._hasNativeAudioFocus=!0,U.addAudioFocusChangeListener(p.handleNativeAudioFocusChange),U.addAppStateChangeListener(p.handleNativeAppStateChange),U.addSystemScreenCaptureStopListener(p.handleNativeSystemScreenCaptureStop)}return p._callObjectMode&&p.startListeningForDeviceChanges(),p._messageChannel.addListenerForMessagesFromCallMachine(p.handleMessageFromCallMachine,p.callClientId,p),p}return Go(t,Yo),bt(t,[{key:"destroy",value:(we=te(function*(){var u;try{yield this.leave()}catch{}var y=this._iframe;if(y){var p=y.parentElement;p&&p.removeChild(y)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),pe()){var x=this.nativeUtils();x.removeAudioFocusChangeListener(this.handleNativeAudioFocusChange),x.removeAppStateChangeListener(this.handleNativeAppStateChange),x.removeSystemScreenCaptureStopListener(this.handleNativeSystemScreenCaptureStop)}this._callObjectMode&&this.stopListeningForDeviceChanges(),this.resetMeetingDependentVars(),this._destroyed=!0,this.emitDailyJSEvent({action:"call-instance-destroyed"}),delete xr[this.callClientId],!((u=window)===null||u===void 0||(u=u._daily)===null||u===void 0)&&u.instances&&delete window._daily.instances[this.callClientId],this.strictMode&&(this.callClientId=void 0)}),function(){return we.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(u){var y=u.bodyClass,p=u.cssFile,x=u.cssText;return ge(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl(p),bodyClass:y,cssText:x}),this}},{key:"iframe",value:function(){return ge(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return Vt(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return Vt(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(u,y){for(var p in y){if(!Ts[p])throw new Error("unrecognized updateParticipant property ".concat(p));if(Ts[p].validate&&!Ts[p].validate(y[p],this,this._participants[u]))throw new Error(Ts[p].help)}}},{key:"updateParticipant",value:function(u,y){return this._participants.local&&this._participants.local.session_id===u&&(u="local"),u&&y&&(this.validateParticipantProperties(u,y),this.sendMessageToCallMachine({action:"update-participant",id:u,properties:y})),this}},{key:"updateParticipants",value:function(u){var y=this._participants.local&&this._participants.local.session_id;for(var p in u)p===y&&(p="local"),p&&u[p]&&this.validateParticipantProperties(p,u[p]);return this.sendMessageToCallMachine({action:"update-participants",participants:u}),this}},{key:"updateWaitingParticipant",value:(le=te(function*(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Vt(this._callObjectMode,"updateWaitingParticipant()"),Ce(this._callState,"updateWaitingParticipant()"),typeof y!="string"||me(p)!=="object")throw new Error("updateWaitingParticipant() must take an id string and a updates object");return new Promise(function(x,_){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participant",id:y,updates:p},function(O){O.error&&_(O.error),O.id||_(new Error("unknown error in updateWaitingParticipant()")),x({id:O.id})})})}),function(){return le.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(B=te(function*(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Vt(this._callObjectMode,"updateWaitingParticipants()"),Ce(this._callState,"updateWaitingParticipants()"),me(y)!=="object")throw new Error("updateWaitingParticipants() must take a mapping between ids and update objects");return new Promise(function(p,x){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participants",updatesById:y},function(_){_.error&&x(_.error),_.ids||x(new Error("unknown error in updateWaitingParticipants()")),p({ids:_.ids})})})}),function(){return B.apply(this,arguments)})},{key:"requestAccess",value:(z=te(function*(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=y.access,x=p===void 0?{level:Ow}:p,_=y.name,O=_===void 0?"":_;return Vt(this._callObjectMode,"requestAccess()"),Ce(this._callState,"requestAccess()"),new Promise(function(I,$){u.sendMessageToCallMachine({action:"daily-method-request-access",access:x,name:O},function(U){U.error&&$(U.error),U.access||$(new Error("unknown error in requestAccess()")),I({access:U.access,granted:U.granted})})})}),function(){return z.apply(this,arguments)})},{key:"localAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.audio.state):null}},{key:"localVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.video.state):null}},{key:"setLocalAudio",value:function(u){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return"forceDiscardTrack"in y&&(pe()?(console.warn("forceDiscardTrack option not supported in React Native; ignoring"),y={}):u&&(console.warn("forceDiscardTrack option only supported when calling setLocalAudio(false); ignoring"),y={})),this.sendMessageToCallMachine({action:"local-audio",state:u,options:y}),this}},{key:"localScreenAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenAudio.state):null}},{key:"localScreenVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenVideo.state):null}},{key:"updateScreenShare",value:function(u){if(this._isScreenSharing)return this.sendMessageToCallMachine({action:"local-screen-update",options:u}),this;console.warn("There is no screen share in progress. Try calling startScreenShare first.")}},{key:"setLocalVideo",value:function(u){return this.sendMessageToCallMachine({action:"local-video",state:u}),this}},{key:"_setAllowLocalAudio",value:function(u){if(this._preloadCache.allowLocalAudio=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-audio",state:u}),this}},{key:"_setAllowLocalVideo",value:function(u){if(this._preloadCache.allowLocalVideo=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-video",state:u}),this}},{key:"getReceiveSettings",value:(j=te(function*(u){var y=this,p=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,x=p!==void 0&&p;if(Vt(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(me(u)){case"string":return new Promise(function(_){y.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:u,showInheritedValues:x},function(O){_(O.receiveSettings)})});case"undefined":return this._receiveSettings;default:throw new Error('first argument to getReceiveSettings() must be a participant id (or "base"), or there should be no arguments')}}),function(u){return j.apply(this,arguments)})},{key:"updateReceiveSettings",value:(re=te(function*(u){var y=this;if(Vt(this._callObjectMode,"updateReceiveSettings()"),!Pp(u,{allowAllParticipantsKey:!0}))throw new Error(Np({allowAllParticipantsKey:!0}));return Ce(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function(p){y.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:u},function(x){p({receiveSettings:x.receiveSettings})})})}),function(u){return re.apply(this,arguments)})},{key:"_prepInputSettingsForSharing",value:function(u,y){if(u){var p={};if(u.audio){var x,_,O;u.audio.settings&&(!Object.keys(u.audio.settings).length&&y||(p.audio={settings:G({},u.audio.settings)})),y&&(x=p.audio)!==null&&x!==void 0&&(x=x.settings)!==null&&x!==void 0&&x.customTrack&&(p.audio.settings={customTrack:this._sharedTracks.audioTrack});var I=((_=u.audio.processor)===null||_===void 0?void 0:_.type)==="none"&&((O=u.audio.processor)===null||O===void 0?void 0:O._isDefaultWhenNone);if(u.audio.processor&&!I){var $=G({},u.audio.processor);delete $._isDefaultWhenNone,p.audio=G(G({},p.audio),{},{processor:$})}}if(u.video){var U,ne,he;u.video.settings&&(!Object.keys(u.video.settings).length&&y||(p.video={settings:G({},u.video.settings)})),y&&(U=p.video)!==null&&U!==void 0&&(U=U.settings)!==null&&U!==void 0&&U.customTrack&&(p.video.settings={customTrack:this._sharedTracks.videoTrack});var ut=((ne=u.video.processor)===null||ne===void 0?void 0:ne.type)==="none"&&((he=u.video.processor)===null||he===void 0?void 0:he._isDefaultWhenNone);if(u.video.processor&&!ut){var dn=G({},u.video.processor);delete dn._isDefaultWhenNone,p.video=G(G({},p.video),{},{processor:dn})}}return p}}},{key:"getInputSettings",value:function(){var u=this;return ge(),new Promise(function(y){y(u._getInputSettings())})}},{key:"_getInputSettings",value:function(){var u,y,p,x,_,O,I={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(u=((p=this._inputSettings)===null||p===void 0?void 0:p.video)||I,y=((x=this._inputSettings)===null||x===void 0?void 0:x.audio)||I):(u=((_=this._preloadCache)===null||_===void 0||(_=_.inputSettings)===null||_===void 0?void 0:_.video)||I,y=((O=this._preloadCache)===null||O===void 0||(O=O.inputSettings)===null||O===void 0?void 0:O.audio)||I);var $={audio:y,video:u};return this._prepInputSettingsForSharing($,!0)}},{key:"_updatePreloadCacheInputSettings",value:function(u,y){var p=this._inputSettings||{},x={};if(u.video){var _,O,I;x.video={},u.video.settings?(x.video.settings={},y||u.video.settings.customTrack||(I=p.video)===null||I===void 0||!I.settings?x.video.settings=u.video.settings:x.video.settings=G(G({},p.video.settings),u.video.settings),Object.keys(x.video.settings).length||delete x.video.settings):(_=p.video)!==null&&_!==void 0&&_.settings&&(x.video.settings=p.video.settings),u.video.processor?x.video.processor=u.video.processor:(O=p.video)!==null&&O!==void 0&&O.processor&&(x.video.processor=p.video.processor)}else p.video&&(x.video=p.video);if(u.audio){var $,U,ne;x.audio={},u.audio.settings?(x.audio.settings={},y||u.audio.settings.customTrack||(ne=p.audio)===null||ne===void 0||!ne.settings?x.audio.settings=u.audio.settings:x.audio.settings=G(G({},p.audio.settings),u.audio.settings),Object.keys(x.audio.settings).length||delete x.audio.settings):($=p.audio)!==null&&$!==void 0&&$.settings&&(x.audio.settings=p.audio.settings),u.audio.processor?x.audio.processor=u.audio.processor:(U=p.audio)!==null&&U!==void 0&&U.processor&&(x.audio.processor=p.audio.processor)}else p.audio&&(x.audio=p.audio);this._maybeUpdateInputSettings(x)}},{key:"_devicesFromInputSettings",value:function(u){var y,p,x=(u==null||(y=u.video)===null||y===void 0||(y=y.settings)===null||y===void 0?void 0:y.deviceId)||null,_=(u==null||(p=u.audio)===null||p===void 0||(p=p.settings)===null||p===void 0?void 0:p.deviceId)||null,O=this._preloadCache.outputDeviceId||null;return{camera:x?{deviceId:x}:{},mic:_?{deviceId:_}:{},speaker:O?{deviceId:O}:{}}}},{key:"updateInputSettings",value:(K=te(function*(u){var y=this;return ge(),Lp(u)?u.video||u.audio?(Ip(u,this.properties.dailyConfig,this._sharedTracks),this._callObjectMode&&!this._callMachineInitialized?(this._updatePreloadCacheInputSettings(u,!0),this._getInputSettings()):new Promise(function(p,x){y.sendMessageToCallMachine({action:"update-input-settings",inputSettings:u},function(_){if(_.error)x(_.error);else{if(_.returnPreloadCache)return y._updatePreloadCacheInputSettings(u,!0),void p(y._getInputSettings());y._maybeUpdateInputSettings(_.inputSettings),p(y._prepInputSettingsForSharing(_.inputSettings,!0))}})})):this._getInputSettings():(console.error(ac()),Promise.reject(ac()))}),function(u){return K.apply(this,arguments)})},{key:"setBandwidth",value:function(u){var y=u.kbs,p=u.trackConstraints;if(ge(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:y,trackConstraints:p}),this}},{key:"getDailyLang",value:function(){var u=this;if(ge(),this._callMachineInitialized)return new Promise(function(y){u.sendMessageToCallMachine({action:"get-daily-lang"},function(p){delete p.action,delete p.callbackStamp,y(p)})})}},{key:"setDailyLang",value:function(u){return ge(),this.sendMessageToCallMachine({action:"set-daily-lang",lang:u}),this}},{key:"setProxyUrl",value:function(u){return this.sendMessageToCallMachine({action:"set-proxy-url",proxyUrl:u}),this}},{key:"setIceConfig",value:function(u){return this.sendMessageToCallMachine({action:"set-ice-config",iceConfig:u}),this}},{key:"meetingSessionSummary",value:function(){return[Bn,Un].includes(this._callState)?this._finalSummaryOfPrevSession:this._meetingSessionSummary}},{key:"getMeetingSession",value:(J=te(function*(){var u=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),Ce(this._callState,"getMeetingSession()"),new Promise(function(y){u.sendMessageToCallMachine({action:"get-meeting-session"},function(p){delete p.action,delete p.callbackStamp,y(p)})})}),function(){return J.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return Ce(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(u){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";Vt(this._callObjectMode,"setMeetingSessionData()"),Ce(this._callState,"setMeetingSessionData");try{(function(p,x){new $0({data:p,mergeStrategy:x})})(u,y)}catch(p){throw console.error(p),p}try{this.sendMessageToCallMachine({action:"set-session-data",data:u,mergeStrategy:y})}catch(p){throw new Error("Error setting meeting session data: ".concat(p))}}},{key:"setUserName",value:function(u,y){var p=this;return this.properties.userName=u,new Promise(function(x){p.sendMessageToCallMachine({action:"set-user-name",name:u??"",thisMeetingOnly:pe()||!!y&&!!y.thisMeetingOnly},function(_){delete _.action,delete _.callbackStamp,x(_)})})}},{key:"setUserData",value:(ae=te(function*(u){var y=this;try{Dp(u)}catch(p){throw console.error(p),p}if(this.properties.userData=u,this._callMachineInitialized)return new Promise(function(p){try{y.sendMessageToCallMachine({action:"set-user-data",userData:u},function(x){delete x.action,delete x.callbackStamp,p(x)})}catch(x){throw new Error("Error setting user data: ".concat(x))}})}),function(u){return ae.apply(this,arguments)})},{key:"validateAudioLevelInterval",value:function(u){if(u&&(u<100||typeof u!="number"))throw new Error("The interval must be a number greater than or equal to 100 milliseconds.")}},{key:"startLocalAudioLevelObserver",value:function(u){var y=this;if(typeof AudioWorkletNode>"u"&&!pe())throw new Error("startLocalAudioLevelObserver() is not supported on this browser");if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isLocalAudioLevelObserverRunning=!0,new Promise(function(p,x){y.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:u},function(_){y._isLocalAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.localAudioLevelObserver={enabled:!0,interval:u}}},{key:"isLocalAudioLevelObserverRunning",value:function(){return this._isLocalAudioLevelObserverRunning}},{key:"stopLocalAudioLevelObserver",value:function(){this._preloadCache.localAudioLevelObserver=null,this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-local-audio-level-observer"})}},{key:"startRemoteParticipantsAudioLevelObserver",value:function(u){var y=this;if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isRemoteParticipantsAudioLevelObserverRunning=!0,new Promise(function(p,x){y.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:u},function(_){y._isRemoteParticipantsAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.remoteParticipantsAudioLevelObserver={enabled:!0,interval:u}}},{key:"isRemoteParticipantsAudioLevelObserverRunning",value:function(){return this._isRemoteParticipantsAudioLevelObserverRunning}},{key:"stopRemoteParticipantsAudioLevelObserver",value:function(){this._preloadCache.remoteParticipantsAudioLevelObserver=null,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-remote-participants-audio-level-observer"})}},{key:"startCamera",value:(q=te(function*(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Vt(this._callObjectMode,"startCamera()"),oc(this._callState,this._isPreparingToJoin,"startCamera()","Did you mean to use setLocalAudio() and/or setLocalVideo() instead?"),this.needsLoad())try{yield this.load(y)}catch(p){return Promise.reject(p)}else{if(this._didPreAuth){if(y.url&&y.url!==this.properties.url)return console.error("url in startCamera() is different than the one used in preAuth()"),Promise.reject();if(y.token&&y.token!==this.properties.token)return console.error("token in startCamera() is different than the one used in preAuth()"),Promise.reject()}this.validateProperties(y),this.properties=G(G({},this.properties),y)}return new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"start-camera",properties:ei(u.properties,u.callClientId),preloadCache:ei(u._preloadCache,u.callClientId)},function(_){_.error?x(_.error):p({camera:_.camera,mic:_.mic,speaker:_.speaker})})})}),function(){return q.apply(this,arguments)})},{key:"validateCustomTrack",value:function(u,y,p){if(p&&p.length>50)throw new Error("Custom track `trackName` must not be more than 50 characters");if(y&&y!=="music"&&y!=="speech"&&!(y instanceof Object))throw new Error("Custom track `mode` must be either `music` | `speech` | `DailyMicAudioModeSettings` or `undefined`");if(p&&["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo","customVideoDefaults"].includes(p))throw new Error("Custom track `trackName` must not match a track name already used by daily: cam-audio, cam-video, customVideoDefaults, screen-video, screen-audio, rmpAudio, rmpVideo");if(!(u instanceof MediaStreamTrack))throw new Error("Custom tracks provided must be instances of MediaStreamTrack")}},{key:"startCustomTrack",value:function(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{track,mode,trackName,ignoreAudioLevel};return ge(),Ce(this._callState,"startCustomTrack()"),this.validateCustomTrack(y.track,y.mode,y.trackName),new Promise(function(p,x){u._sharedTracks.customTrack=y.track,y.track=bn,u.sendMessageToCallMachine({action:"start-custom-track",properties:y},function(_){_.error?x({error:_.error}):p(_.mediaTag)})})}},{key:"stopCustomTrack",value:function(u){var y=this;return ge(),Ce(this._callState,"stopCustomTrack()"),new Promise(function(p){y.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:u},function(x){p(x.mediaTag)})})}},{key:"setCamera",value:function(u){var y=this;return Wi(),As(this._callMachineInitialized,"setCamera()"),new Promise(function(p){y.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:u},function(x){p({device:x.device})})})}},{key:"setAudioDevice",value:(Q=te(function*(u){return Wi(),this.nativeUtils().setAudioDevice(u),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(u){return Q.apply(this,arguments)})},{key:"cycleCamera",value:function(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p){u.sendMessageToCallMachine({action:"cycle-camera",properties:y},function(x){p({device:x.device})})})}},{key:"cycleMic",value:function(){var u=this;return ge(),new Promise(function(y){u.sendMessageToCallMachine({action:"cycle-mic"},function(p){y({device:p.device})})})}},{key:"getCameraFacingMode",value:function(){var u=this;return Wi(),new Promise(function(y){u.sendMessageToCallMachine({action:"get-camera-facing-mode"},function(p){y(p.facingMode)})})}},{key:"setInputDevicesAsync",value:(H=te(function*(u){var y=this,p=u.audioDeviceId,x=u.videoDeviceId,_=u.audioSource,O=u.videoSource;if(ge(),_!==void 0&&(p=_),O!==void 0&&(x=O),typeof p=="boolean"&&(this._setAllowLocalAudio(p),p=void 0),typeof x=="boolean"&&(this._setAllowLocalVideo(x),x=void 0),!p&&!x)return yield this.getInputDevices();var I={};return p&&(p instanceof MediaStreamTrack?(this._sharedTracks.audioTrack=p,p=bn,I.audio={settings:{customTrack:p}}):(delete this._sharedTracks.audioTrack,I.audio={settings:{deviceId:p}})),x&&(x instanceof MediaStreamTrack?(this._sharedTracks.videoTrack=x,x=bn,I.video={settings:{customTrack:x}}):(delete this._sharedTracks.videoTrack,I.video={settings:{deviceId:x}})),this._callObjectMode&&this.needsLoad()?(this._updatePreloadCacheInputSettings(I,!1),this._devicesFromInputSettings(this._inputSettings)):new Promise(function($){y.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:p,videoDeviceId:x},function(U){if(delete U.action,delete U.callbackStamp,U.returnPreloadCache)return y._updatePreloadCacheInputSettings(I,!1),void $(y._devicesFromInputSettings(y._inputSettings));$(U)})})}),function(u){return H.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(W=te(function*(u){var y=this,p=u.outputDeviceId;if(ge(),!p||typeof p!="string")throw new Error("outputDeviceId must be provided and must be a valid device id");return this._preloadCache.outputDeviceId=p,this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(x,_){y.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:p},function(O){if(delete O.action,delete O.callbackStamp,O.error){var I=new Error(O.error.message);return I.type=O.error.type,void _(I)}O.returnPreloadCache?x(y._devicesFromInputSettings(y._inputSettings)):x(O)})})}),function(u){return W.apply(this,arguments)})},{key:"getInputDevices",value:(Y=te(function*(){var u=this;return this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(y){u.sendMessageToCallMachine({action:"get-input-devices"},function(p){p.returnPreloadCache?y(u._devicesFromInputSettings(u._inputSettings)):y({camera:p.camera,mic:p.mic,speaker:p.speaker})})})}),function(){return Y.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return Wi(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(u){if(Wi(),[_p,rS].includes(u)){if(u!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=u,!this.disableReactNativeAutoDeviceManagement("audio")&&Ms(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMode(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",u)}},{key:"preAuth",value:(F=te(function*(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Vt(this._callObjectMode,"preAuth()"),oc(this._callState,this._isPreparingToJoin,"preAuth()"),this.needsLoad()&&(yield this.load(y)),!y.url)throw new Error("preAuth() requires at least a url to be provided");return this.validateProperties(y),this.properties=G(G({},this.properties),y),new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"daily-method-preauth",properties:ei(u.properties,u.callClientId),preloadCache:ei(u._preloadCache,u.callClientId)},function(_){return _.error?x(_.error):_.access?(u._didPreAuth=!0,void p({access:_.access})):x(new Error("unknown error in preAuth()"))})})}),function(){return F.apply(this,arguments)})},{key:"load",value:(L=te(function*(u){var y=this;if(this.needsLoad()){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");if(u&&(this.validateProperties(u),this.properties=G(G({},this.properties),u)),!this._callObjectMode&&!this.properties.url)throw new Error("can't load iframe meeting because url property isn't set");return this._updateCallState(Df),this.emitDailyJSEvent({action:$w}),this._callObjectMode?new Promise(function(p,x){y._callObjectLoader.cancel();var _=Date.now();y._callObjectLoader.load(y.properties.dailyConfig,function(O){y._bundleLoadTime=O?"no-op":Date.now()-_,y._updateCallState(Pf),O&&y.emitDailyJSEvent({action:If}),p()},function(O,I){if(y.emitDailyJSEvent({action:Fw}),!I){y._updateCallState(Un),y.resetMeetingDependentVars();var $={action:jf,errorMsg:O.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:O,bundleUrl:Zo(y.properties.dailyConfig)}}};y._maybeSendToSentry($),y.emitDailyJSEvent($),x(O.msg)}})}):(this._iframe.src=mh(this.assembleMeetingUrl(),this.properties.dailyConfig),new Promise(function(p,x){y._loadedCallback=function(_){y._callState!==Un?(y._updateCallState(Pf),(y.properties.cssFile||y.properties.cssText)&&y.loadCss(y.properties),p()):x(_)}}))}}),function(u){return L.apply(this,arguments)})},{key:"join",value:(P=te(function*(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._testCallInProgress&&this.stopTestCallQuality(),!y.url&&!this.properties.url){var p="No room URL has been provided";return console.error(p),Promise.reject(new Error(p))}var x=!1;if(this.needsLoad()){this.updateIsPreparingToJoin(!0);try{yield this.load(y)}catch(_){return this.updateIsPreparingToJoin(!1),Promise.reject(_)}}else{if(x=!(!this.properties.cssFile&&!this.properties.cssText),this._didPreAuth){if(y.url&&y.url!==this.properties.url)return console.error("url in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject();if(y.token&&y.token!==this.properties.token)return console.error("token in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject()}if(y.url&&!this._callObjectMode&&y.url&&y.url!==this.properties.url)return console.error("url in join() is different than the one used in load() (".concat(this.properties.url," -> ").concat(y.url,")")),this.updateIsPreparingToJoin(!1),Promise.reject();this.validateProperties(y),this.properties=G(G({},this.properties),y)}return y.showLocalVideo!==void 0&&(this._callObjectMode?console.error("showLocalVideo is not available in callObject mode"):this._showLocalVideo=!!y.showLocalVideo),y.showParticipantsBar!==void 0&&(this._callObjectMode?console.error("showParticipantsBar is not available in callObject mode"):this._showParticipantsBar=!!y.showParticipantsBar),this._callState===Sr||this._callState===Ul?(console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1)):(this._updateCallState(Ul,!1),this.emitDailyJSEvent({action:Uw}),this._preloadCache.inputSettings=this._prepInputSettingsForSharing(this._inputSettings||{},!1),this.sendMessageToCallMachine({action:"join-meeting",properties:ei(this.properties,this.callClientId),preloadCache:ei(this._preloadCache,this.callClientId)},function(_){_.error&&u._joinedCallback&&(u._joinedCallback(null,_.error),u._joinedCallback=null)}),new Promise(function(_,O){u._joinedCallback=function(I,$){if(u._callState!==Un){if($)return u._updateCallState(Bn),void O($);if(u._updateCallState(Sr),I)for(var U in I){if(u._callObjectMode){var ne=u._callMachine().store;cp(I[U],ne),up(I[U],ne),dp(I[U],u._participants[U],ne)}u._participants[U]=G({},I[U]),u.toggleParticipantAudioBasedOnNativeAudioFocus()}x&&u.loadCss(u.properties),_(I)}else O($)}}))}),function(){return P.apply(this,arguments)})},{key:"leave",value:(M=te(function*(){var u=this;return this._testCallInProgress&&this.stopTestCallQuality(),new Promise(function(y){u._callState===Bn||u._callState===Un?y():u._callObjectLoader&&!u._callObjectLoader.loaded?(u._callObjectLoader.cancel(),u._updateCallState(Bn),u.resetMeetingDependentVars(),u.emitDailyJSEvent({action:Bn}),y()):(u._resolveLeave=y,u.sendMessageToCallMachine({action:"leave-meeting"}))})}),function(){return M.apply(this,arguments)})},{key:"startScreenShare",value:(C=te(function*(){var u=this,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(As(this._callMachineInitialized,"startScreenShare()"),y.screenVideoSendSettings&&this._validateVideoSendSettings("screenVideo",y.screenVideoSendSettings),y.mediaStream&&(this._sharedTracks.screenMediaStream=y.mediaStream,y.mediaStream=bn),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var p=this.nativeUtils();if(yield p.isScreenBeingCaptured())return void this.emitDailyJSEvent({action:Ff,type:"screen-share-error",errorMsg:"Could not start the screen sharing. The screen is already been captured!"});p.setSystemScreenCaptureStartCallback(function(){p.setSystemScreenCaptureStartCallback(null),u.sendMessageToCallMachine({action:Uf,captureOptions:y})}),p.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:Uf,captureOptions:y})}),function(){return C.apply(this,arguments)})},{key:"stopScreenShare",value:function(){As(this._callMachineInitialized,"stopScreenShare()"),this.sendMessageToCallMachine({action:"local-screen-stop"})}},{key:"startRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},y=u.type;if(y&&y!=="cloud"&&y!=="cloud-audio-only"&&y!=="raw-tracks"&&y!=="local")throw new Error("invalid type: ".concat(y,", allowed values 'cloud', 'cloud-audio-only', 'raw-tracks', or 'local'"));this.sendMessageToCallMachine(G({action:"local-recording-start"},u))}},{key:"updateRecording",value:function(u){var y=u.layout,p=y===void 0?{preset:"default"}:y,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-recording",layout:p,instanceId:x})}},{key:"stopRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(G({action:"local-recording-stop"},u))}},{key:"startLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(G({action:"daily-method-start-live-streaming"},u))}},{key:"updateLiveStreaming",value:function(u){var y=u.layout,p=y===void 0?{preset:"default"}:y,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:p,instanceId:x})}},{key:"addLiveStreamingEndpoints",value:function(u){var y=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:zf,endpointsOp:A0,endpoints:y,instanceId:p})}},{key:"removeLiveStreamingEndpoints",value:function(u){var y=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:zf,endpointsOp:O0,endpoints:y,instanceId:p})}},{key:"stopLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(G({action:"daily-method-stop-live-streaming"},u))}},{key:"validateDailyConfig",value:function(u){u.camSimulcastEncodings&&(console.warn("camSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide camera simulcast settings."),this.validateSimulcastEncodings(u.camSimulcastEncodings)),u.screenSimulcastEncodings&&console.warn("screenSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide screen simulcast settings."),Gf()&&u.noAutoDefaultDeviceChange&&console.warn("noAutoDefaultDeviceChange is not supported on Android, and will be ignored.")}},{key:"validateSimulcastEncodings",value:function(u){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(u){if(!(u instanceof Array||Array.isArray(u)))throw new Error("encodings must be an Array");if(!Hp(u.length,1,3))throw new Error("encodings must be an Array with between 1 to ".concat(3," layers"));for(var x=0;x<u.length;x++){var _=u[x];for(var O in this._validateEncodingLayerHasValidProperties(_),_)if(rc.includes(O)){if(typeof _[O]!="number")throw new Error("".concat(O," must be a number"));if(y){var I=y[O],$=I.min,U=I.max;if(!Hp(_[O],$,U))throw new Error("".concat(O," value not in range. valid range: ").concat($," to ").concat(U))}}else if(!["active","scalabilityMode"].includes(O))throw new Error("Invalid key ".concat(O,", valid keys are:")+Object.values(rc));if(p&&!_.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(k=te(function*(u){var y=this,p=u.url,x=u.settings,_=x===void 0?{state:Kl.PLAY}:x;try{(function(O){if(typeof O!="string")throw new Error('url parameter must be "string" type')})(p),zp(_),function(O){for(var I in O)if(!Mp.includes(I))throw new Error("Invalid key ".concat(I,", valid keys are: ").concat(Mp));O.simulcastEncodings&&this.validateSimulcastEncodings(O.simulcastEncodings,Tp,!0)}(_)}catch(O){throw console.error("invalid argument Error: ".concat(O)),console.error(`startRemoteMediaPlayer arguments must be of the form:
26
+ Url: ${ps(s)}`),!0)}(e,o)?null:e}});function ps(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?function(n=[]){for(let r=n.length-1;r>=0;r--){const i=n[r];if(i&&i.filename!=="<anonymous>"&&i.filename!=="[native code]")return i.filename||null}return null}(e):null}catch{return Ee&&oe.error(`Cannot extract url for event ${Fn(t)}`),null}}function Qb(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&mr(s.originalException,Error)))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var l,c;a&&(o.exception.values=(l=Tl(t,e,i,s.originalException,r,o.exception.values,a,0),c=n,l.map(d=>(d.value&&(d.value=qr(d.value,c)),d))))}function Tl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(mr(r[i],Error)){ff(s,a);const c=t(e,r[i]),d=l.length;pf(c,i,d,a),l=Tl(t,e,n,r[i],i,[c,...l],c,d)}return Array.isArray(r.errors)&&r.errors.forEach((c,d)=>{if(mr(c,Error)){ff(s,a);const h=t(e,c),f=l.length;pf(h,`errors[${d}]`,f,a),l=Tl(t,e,n,c,i,[h,...l],h,f)}}),l}function ff(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function pf(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function Ml(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Yb(){"console"in ve&&sl.forEach(function(t){t in ve.console&&wt(ve.console,t,function(e){return ns[t]=e,function(...n){Ht("console",{args:n,level:t});const r=ns[t];r&&r.apply(ve.console,n)}})})}function Xb(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Zb=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(n,r){return r?!!(function(i,o){const s=i.message,a=o.message;return!(!s&&!a||s&&!a||!s&&a||s!==a||!mf(i,o)||!gf(i,o))}(n,r)||function(i,o){const s=yf(o),a=yf(i);return!(!s||!a||s.type!==a.type||s.value!==a.value||!mf(i,o)||!gf(i,o))}(n,r)):!1}(e,t))return Ee&&oe.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function gf(t,e){let n=Sh(t),r=Sh(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let i=0;i<r.length;i++){const o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function mf(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return n.join("")===r.join("")}catch{return!1}}function yf(t){return t.exception&&t.exception.values&&t.exception.values[0]}function vf(t){return t===void 0?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const Al=ve;function Ol(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function ew(){if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in Al))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(Ol(Al.fetch))return!0;let t=!1;const e=Al.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=Ol(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){hr&&oe.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function tw(t,e){const n="fetch";pr(n,t),gr(n,()=>function(r,i=!1){i&&!ew()||wt(ve,"fetch",function(o){return function(...s){const a=new Error,{method:l,url:c}=function(h){if(h.length===0)return{method:"GET",url:""};if(h.length===2){const[g,y]=h;return{url:bf(g),method:Dl(y,"method")?String(y.method).toUpperCase():"GET"}}const f=h[0];return{url:bf(f),method:Dl(f,"method")?String(f.method).toUpperCase():"GET"}}(s),d={args:s,fetchData:{method:l,url:c},startTimestamp:1e3*yn(),virtualError:a};return r||Ht("fetch",{...d}),o.apply(ve,s).then(async h=>(r?r(h):Ht("fetch",{...d,endTimestamp:1e3*yn(),response:h}),h),h=>{throw Ht("fetch",{...d,endTimestamp:1e3*yn(),error:h}),ul(h)&&h.stack===void 0&&(h.stack=a.stack,yr(h,"framesToPop",1)),h})}})}(void 0,e))}function Dl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function bf(t){return typeof t=="string"?t:t?Dl(t,"url")?t.url:t.toString?t.toString():"":""}const gs=ve,ze=ve;let Ll=0;function wf(){return Ll>0}function Yr(t,e={}){if(!function(r){return typeof r=="function"}(t))return t;try{const r=t.__sentry_wrapped__;if(r)return typeof r=="function"?r:t;if(pl(t))return t}catch{return t}const n=function(...r){try{const i=r.map(o=>Yr(o,e));return t.apply(this,i)}catch(i){throw Ll++,setTimeout(()=>{Ll--}),function(...o){const s=wl(os());if(o.length===2){const[a,l]=o;return a?s.withSetScope(a,l):s.withScope(l)}s.withScope(o[0])}(o=>{var s;o.addEventProcessor(a=>(e.mechanism&&(ml(a,void 0),Jr(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),s=i,br().captureException(s,void 0)}),i}};try{for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}catch{}Ah(n,t),yr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}const ms=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Pl(t,e){const n=Rl(t,e),r={type:iw(e),value:ow(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function nw(t,e,n,r){const i=Ze(),o=i&&i.getOptions().normalizeDepth,s=function(c){for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d)){const h=c[d];if(h instanceof Error)return h}}(e),a={__serialized__:Wh(e,o)};if(s)return{exception:{values:[Pl(t,s)]},extra:a};const l={exception:{values:[{type:ss(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:sw(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=Rl(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function Il(t,e){return{exception:{values:[Pl(t,e)]}}}function Rl(t,e){const n=e.stacktrace||e.stack||"",r=function(o){return o&&rw.test(o.message)?1:0}(e),i=function(o){return typeof o.framesToPop=="number"?o.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const rw=/Minified React error #\d+;/i;function Sf(t){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&t instanceof WebAssembly.Exception}function iw(t){const e=t&&t.name;return!e&&Sf(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function ow(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:Sf(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function Nl(t,e,n,r,i){let o;if(_h(e)&&e.error)return Il(t,e.error);if(Ch(e)||Kr(e,"DOMException")){const s=e;if("stack"in e)o=Il(t,e);else{const a=s.name||(Ch(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=$l(t,l,n,r),ml(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return ul(e)?Il(t,e):Wr(e)||ss(e)?(o=nw(t,e,n,i),Jr(o,{synthetic:!0}),o):(o=$l(t,e,n,r),ml(o,`${e}`),Jr(o,{synthetic:!0}),o)}function $l(t,e,n,r){const i={};if(r&&n){const o=Rl(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Jr(i,{synthetic:!0})}if(dl(e)){const{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function sw(t,{isUnhandledRejection:e}){const n=function(i,o=40){const s=Object.keys(Oh(i));s.sort();const a=s[0];if(!a)return"[object has no keys]";if(a.length>=o)return qr(a,o);for(let l=s.length;l>0;l--){const c=s.slice(0,l).join(", ");if(!(c.length>o))return l===s.length?c:qr(c,o)}return""}(t),r=e?"promise rejection":"exception";return _h(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:ss(t)?`Event \`${function(i){try{const o=Object.getPrototypeOf(i);return o?o.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class aw extends zb{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e};(function(r,i,o=[i],s="npm"){const a=r._metadata||{};a.sdk||(a.sdk={name:`sentry.javascript.${i}`,packages:o.map(l=>({name:`${s}:@sentry/${l}`,version:dr})),version:dr}),r._metadata=a})(n,"browser",["browser"],ze.SENTRY_SDK_SOURCE||"npm"),super(n),n.sendClientReports&&ze.document&&ze.document.addEventListener("visibilitychange",()=>{ze.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return function(r,i,o,s){const a=Nl(r,i,o&&o.syntheticException||void 0,s);return Jr(a),a.level="error",o&&o.event_id&&(a.event_id=o.event_id),vr(a)}(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return function(i,o,s="info",a,l){const c=$l(i,o,a&&a.syntheticException||void 0,l);return c.level=s,a&&a.event_id&&(c.event_id=a.event_id),vr(c)}(this._options.stackParser,e,n,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(ms&&oe.warn("SDK not enabled, will not capture user feedback."));const n=function(r,{metadata:i,tunnel:o,dsn:s}){const a={event_id:r.event_id,sent_at:new Date().toISOString(),...i&&i.sdk&&{sdk:{name:i.sdk.name,version:i.sdk.version}},...!!o&&!!s&&{dsn:ds(s)}};return Ui(a,[function(c){return[{type:"user_report"},c]}(r)])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}}const lw=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,st=ve;let kf,Fl,jl,ys;function cw(){if(!st.document)return;const t=Ht.bind(null,"dom"),e=xf(t,!0);st.document.addEventListener("click",e,!1),st.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=st[n],i=r&&r.prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(wt(i,"addEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=c[s]=c[s]||{refCount:0};if(!d.handler){const h=xf(t);d.handler=h,o.call(this,s,h,l)}d.refCount++}catch{}return o.call(this,s,a,l)}}),wt(i,"removeEventListener",function(o){return function(s,a,l){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},d=c[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,l),d.handler=void 0,delete c[s]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,l)}}))})}function xf(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(o){try{return o.target}catch{return null}}(n);if(function(o,s){return o==="keypress"&&(!s||!s.tagName||s.tagName!=="INPUT"&&s.tagName!=="TEXTAREA"&&!s.isContentEditable)}(n.type,r))return;yr(n,"_sentryCaptured",!0),r&&!r._sentryId&&yr(r,"_sentryId",Dt());const i=n.type==="keypress"?"input":n.type;(function(o){if(o.type!==Fl)return!1;try{if(!o.target||o.target._sentryId!==jl)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Fl=n.type,jl=r?r._sentryId:void 0),clearTimeout(kf),kf=st.setTimeout(()=>{jl=void 0,Fl=void 0},1e3)}}function _f(t){const e="history";pr(e,t),gr(e,uw)}function uw(){if(!function(){const n=gs.chrome,r=n&&n.app&&n.app.runtime,i="history"in gs&&!!gs.history.pushState&&!!gs.history.replaceState;return!r&&i}())return;const t=st.onpopstate;function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const o=ys,s=String(i);ys=s,Ht("history",{from:o,to:s})}return n.apply(this,r)}}st.onpopstate=function(...n){const r=st.location.href,i=ys;if(ys=r,Ht("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}},wt(st.history,"pushState",e),wt(st.history,"replaceState",e)}const vs={};function Cf(t){vs[t]=void 0}const zi="__sentry_xhr_v3__";function dw(){if(!st.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,o=1e3*yn(),s=mn(r[0])?r[0].toUpperCase():void 0,a=function(c){if(mn(c))return c;try{return c.toString()}catch{}}(r[1]);if(!s||!a)return e.apply(n,r);n[zi]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[zi];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}Ht("xhr",{endTimestamp:1e3*yn(),startTimestamp:o,xhr:n,virtualError:i})}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply:(c,d,h)=>(l(),c.apply(d,h))}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,d,h){const[f,g]=h,y=d[zi];return y&&mn(f)&&mn(g)&&(y.request_headers[f.toLowerCase()]=g),c.apply(d,h)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[zi];return i?(r[0]!==void 0&&(i.body=r[0]),Ht("xhr",{startTimestamp:1e3*yn(),xhr:n}),e.apply(n,r)):e.apply(n,r)}})}function hw(t,e=function(n){const r=vs[n];if(r)return r;let i=st[n];if(Ol(i))return vs[n]=i.bind(st);const o=st.document;if(o&&typeof o.createElement=="function")try{const s=o.createElement("iframe");s.hidden=!0,o.head.appendChild(s);const a=s.contentWindow;a&&a[n]&&(i=a[n]),o.head.removeChild(s)}catch(s){lw&&oe.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,s)}return i&&(vs[n]=i.bind(st))}("fetch")){let n=0,r=0;return Kb(t,function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return Cf("fetch"),cs("No fetch implementation available");try{return e(t.url,s).then(a=>(n-=o,r--,{statusCode:a.status,headers:{"x-sentry-rate-limits":a.headers.get("X-Sentry-Rate-Limits"),"retry-after":a.headers.get("Retry-After")}}))}catch(a){return Cf("fetch"),n-=o,r--,cs(a)}})}function Bl(t,e,n,r){const i={filename:t,function:e==="<anonymous>"?fr:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const fw=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,pw=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,gw=/\((\S*)(?::(\d+))(?::(\d+))\)/,mw=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,yw=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vw=function(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const o=[],s=n.split(`
27
+ `);for(let a=r;a<s.length;a++){const l=s[a];if(l.length>1024)continue;const c=vh.test(l)?l.replace(vh,"$1"):l;if(!c.match(/\S*Error: /)){for(const d of e){const h=d(c);if(h){o.push(h);break}}if(o.length>=50+i)break}}return function(a){if(!a.length)return[];const l=Array.from(a);return/sentryWrapped/.test(rs(l).function||"")&&l.pop(),l.reverse(),bh.test(rs(l).function||"")&&(l.pop(),bh.test(rs(l).function||"")&&l.pop()),l.slice(0,50).map(c=>({...c,filename:c.filename||rs(l).filename,function:c.function||fr}))}(o.slice(i))}}([30,t=>{const e=fw.exec(t);if(e){const[,r,i,o]=e;return Bl(r,fr,+i,+o)}const n=pw.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=gw.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,i]=Ef(n[1]||fr,n[2]);return Bl(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=mw.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=yw.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let n=e[3],r=e[1]||fr;return[r,n]=Ef(r,n),Bl(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),Ef=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:fr,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Tf=1024,bw=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(n){var r;e.console&&function(i){const o="console";pr(o,i),gr(o,Yb)}(function(i){return function(o){if(Ze()!==i)return;const s={category:"console",data:{arguments:o.args,logger:"console"},level:Xb(o.level),message:Mh(o.args," ")};if(o.level==="assert"){if(o.args[0]!==!1)return;s.message=`Assertion failed: ${Mh(o.args.slice(1)," ")||"console.assert"}`,s.data.arguments=o.args.slice(1)}wr(s,{input:o.args,level:o.level})}}(n)),e.dom&&(r=function(i,o){return function(s){if(Ze()!==i)return;let a,l,c=typeof o=="object"?o.serializeAttribute:void 0,d=typeof o=="object"&&typeof o.maxStringLength=="number"?o.maxStringLength:void 0;d&&d>Tf&&(ms&&oe.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${d} was configured. Sentry will use 1024 instead.`),d=Tf),typeof c=="string"&&(c=[c]);try{const f=s.event,g=function(y){return!!y&&!!y.target}(f)?f.target:f;a=Th(g,{keyAttrs:c,maxStringLength:d}),l=function(y){if(!fl.HTMLElement)return null;let m=y;for(let S=0;S<5;S++){if(!m)return null;if(m instanceof HTMLElement){if(m.dataset.sentryComponent)return m.dataset.sentryComponent;if(m.dataset.sentryElement)return m.dataset.sentryElement}m=m.parentNode}return null}(g)}catch{a="<unknown>"}if(a.length===0)return;const h={category:`ui.${s.name}`,message:a};l&&(h.data={"ui.component_name":l}),wr(h,{event:s.event,name:s.name,global:s.global})}}(n,e.dom),pr("dom",r),gr("dom",cw)),e.xhr&&function(i){pr("xhr",i),gr("xhr",dw)}(function(i){return function(o){if(Ze()!==i)return;const{startTimestamp:s,endTimestamp:a}=o,l=o.xhr[zi];if(!s||!a||!l)return;const{method:c,url:d,status_code:h,body:f}=l,g={method:c,url:d,status_code:h},y={xhr:o.xhr,input:f,startTimestamp:s,endTimestamp:a};wr({category:"xhr",data:g,type:"http",level:vf(h)},y)}}(n)),e.fetch&&tw(function(i){return function(o){if(Ze()!==i)return;const{startTimestamp:s,endTimestamp:a}=o;if(a&&(!o.fetchData.url.match(/sentry_key/)||o.fetchData.method!=="POST"))if(o.error)wr({category:"fetch",data:o.fetchData,level:"error",type:"http"},{data:o.error,input:o.args,startTimestamp:s,endTimestamp:a});else{const l=o.response,c={...o.fetchData,status_code:l&&l.status},d={input:o.args,response:l,startTimestamp:s,endTimestamp:a};wr({category:"fetch",data:c,type:"http",level:vf(c.status_code)},d)}}}(n)),e.history&&_f(function(i){return function(o){if(Ze()!==i)return;let s=o.from,a=o.to;const l=Ml(ze.location.href);let c=s?Ml(s):void 0;const d=Ml(a);c&&c.path||(c=l),l.protocol===d.protocol&&l.host===d.host&&(a=d.relative),l.protocol===c.protocol&&l.host===c.host&&(s=c.relative),wr({category:"navigation",data:{from:s,to:a}})}}(n)),e.sentry&&n.on("beforeSendEvent",function(i){return function(o){Ze()===i&&wr({category:"sentry."+(o.type==="transaction"?"transaction":"event"),event_id:o.event_id,level:o.level,message:Fn(o)},{event:o})}}(n))}}},ww=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Sw=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&wt(ze,"setTimeout",Mf),e.setInterval&&wt(ze,"setInterval",Mf),e.requestAnimationFrame&&wt(ze,"requestAnimationFrame",kw),e.XMLHttpRequest&&"XMLHttpRequest"in ze&&wt(XMLHttpRequest.prototype,"send",xw);const n=e.eventTarget;n&&(Array.isArray(n)?n:ww).forEach(_w)}}};function Mf(t){return function(...e){const n=e[0];return e[0]=Yr(n,{mechanism:{data:{function:$n(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function kw(t){return function(e){return t.apply(this,[Yr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:$n(t)},handled:!1,type:"instrument"}})])}}function xw(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&wt(n,r,function(i){const o={mechanism:{data:{function:r,handler:$n(i)},handled:!1,type:"instrument"}},s=pl(i);return s&&(o.mechanism.data.handler=$n(s)),Yr(i,o)})}),t.apply(this,e)}}function _w(t){const e=ze[t],n=e&&e.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(wt(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=Yr(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:$n(o),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Yr(o,{mechanism:{data:{function:"addEventListener",handler:$n(o),target:t},handled:!1,type:"instrument"}}),s])}}),wt(n,"removeEventListener",function(r){return function(i,o,s){try{const a=o.__sentry_wrapped__;a&&r.call(this,i,a,s)}catch{}return r.call(this,i,o,s)}}))}const Cw=()=>({name:"BrowserSession",setupOnce(){ze.document!==void 0?(Zh({ignoreDuration:!0}),nf(),_f(({from:t,to:e})=>{t!==void 0&&t!==e&&(Zh({ignoreDuration:!0}),nf())})):ms&&oe.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),Ew=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(function(r){(function(i){const o="error";pr(o,i),gr(o,mb)})(i=>{const{stackParser:o,attachStacktrace:s}=Of();if(Ze()!==r||wf())return;const{msg:a,url:l,line:c,column:d,error:h}=i,f=function(g,y,m,S){const v=g.exception=g.exception||{},w=v.values=v.values||[],k=w[0]=w[0]||{},C=k.stacktrace=k.stacktrace||{},E=C.frames=C.frames||[],L=S,A=m,R=mn(y)&&y.length>0?y:function(){try{return fl.document.location.href}catch{return""}}();return E.length===0&&E.push({colno:L,filename:R,function:fr,in_app:!0,lineno:A}),g}(Nl(o,h||a,void 0,s,!1),l,c,d);f.level="error",Xh(f,{originalException:h,mechanism:{handled:!1,type:"onerror"}})})}(n),Af("onerror")),e.onunhandledrejection&&(function(r){(function(i){const o="unhandledrejection";pr(o,i),gr(o,yb)})(i=>{const{stackParser:o,attachStacktrace:s}=Of();if(Ze()!==r||wf())return;const a=function(c){if(hl(c))return c;try{if("reason"in c)return c.reason;if("detail"in c&&"reason"in c.detail)return c.detail.reason}catch{}return c}(i),l=hl(a)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`}]}}:Nl(o,a,void 0,s,!0);l.level="error",Xh(l,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(n),Af("onunhandledrejection"))}}};function Af(t){ms&&oe.log(`Global Handler attached: ${t}`)}function Of(){const t=Ze();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const Tw=()=>({name:"HttpContext",preprocessEvent(t){if(!ze.navigator&&!ze.location&&!ze.document)return;const e=t.request&&t.request.url||ze.location&&ze.location.href,{referrer:n}=ze.document||{},{userAgent:r}=ze.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...t.request,...e&&{url:e},headers:i};t.request=o}}),Mw=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(r,i,o){const s=o.getOptions();Qb(Pl,s.stackParser,s.maxValueLength,n,e,r,i)}}};var Df="new",Lf="loading",Pf="loaded",Ul="joining-meeting",Sr="joined-meeting",Bn="left-meeting",Un="error",Aw="playable",zl="unknown",Ow="full",Dw="base",If="no-room",Lw="end-of-life",Pw="connection-error",Iw="iframe-ready-for-launch-config",Rw="iframe-launch-config",Nw="theme-updated",$w="loading",Fw="load-attempt-failed",Rf="loaded",jw="started-camera",Bw="camera-error",Uw="joining-meeting",zw="joined-meeting",Hw="left-meeting",Vw="participant-joined",Kw="participant-updated",Ww="participant-left",qw="participant-counts-updated",Jw="access-state-updated",Gw="meeting-session-summary-updated",Qw="meeting-session-state-updated",Yw="waiting-participant-added",Xw="waiting-participant-updated",Zw="waiting-participant-removed",e0="track-started",t0="track-stopped",n0="transcription-started",r0="transcription-stopped",i0="transcription-error",Nf="recording-started",$f="recording-stopped",o0="recording-stats",s0="recording-error",a0="recording-upload-completed",l0="recording-data",c0="app-message",u0="transcription-message",d0="remote-media-player-started",h0="remote-media-player-updated",f0="remote-media-player-stopped",p0="local-screen-share-started",g0="local-screen-share-stopped",m0="local-screen-share-canceled",y0="active-speaker-change",v0="active-speaker-mode-change",b0="network-quality-change",w0="network-connection",S0="cpu-load-change",k0="face-counts-updated",bs="fullscreen",ws="exited-fullscreen",x0="live-streaming-started",_0="live-streaming-updated",C0="live-streaming-stopped",E0="live-streaming-error",T0="lang-updated",M0="receive-settings-updated",Ff="input-settings-updated",jf="nonfatal-error",Bf="error",Hl=4096,Uf=102400,Vl="iframe-call-message",zf="local-screen-start",Hf="daily-method-update-live-streaming-endpoints",Ss="transmit-log",wn="daily-custom-track",ks={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},Vf={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},Kl={PLAY:"play",PAUSE:"pause"},Wl=["jpg","png","jpeg"],A0="add-endpoints",O0="remove-endpoints",Kf="sip-call-transfer";function Pt(){return!pe()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function pe(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function Wf(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function D0(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)&&(function(t,e){if(!t||!e)return!0;switch(t){case"Chrome":return e.major>=75;case"Safari":return RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")&&!(e.major===13&&e.minor===0&&e.point===0);case"Firefox":return e.major>=67}return!0}(kr(),xs())||pe())}function qf(){if(pe()||!document)return!1;var t=document.createElement("iframe");return!!t.requestFullscreen||!!t.webkitRequestFullscreen}var ql="none",L0="software",P0="hardware",I0=function(){try{var t,e=document.createElement("canvas"),n=!1;(t=e.getContext("webgl2",{failIfMajorPerformanceCaveat:!0}))||(n=!0,t=e.getContext("webgl2"));var r=t!=null;return e.remove(),r?n?L0:P0:ql}catch{return ql}}();function Jf(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!pe()&&I0!==ql&&(t?function(){return Yf()?!1:["Chrome","Firefox"].includes(kr())}():function(){if(Yf())return!1;var e=kr();if(e==="Safari"){var n=Ql();if(n.major<15||n.major===15&&n.minor<4)return!1}return e==="Chrome"?Gl().major>=77:e==="Firefox"?Yl().major>=97:["Chrome","Firefox","Safari"].includes(e)}())}function Gf(){if(pe()||Qf()||typeof AudioWorkletNode>"u")return!1;switch(kr()){case"Chrome":case"Firefox":return!0;case"Safari":var t=xs();return t.major>17||t.major===17&&t.minor>=4}return!1}function Jl(){return Wf()&&typeof MediaStreamTrack<"u"&&!function(){var t,e=kr();if(!Pt())return!0;switch(e){case"Chrome":return(t=Gl()).major&&t.major>0&&t.major<75;case"Firefox":return(t=Yl()).major<91;case"Safari":return(t=Ql()).major<13||t.major===13&&t.minor<1;default:return!0}}()}function Qf(){return Pt().match(/Linux; Android/)}function Yf(){var t,e=Pt(),n=e.match(/Mac/)&&(!pe()&&typeof window<"u"&&(t=window)!==null&&t!==void 0&&(t=t.navigator)!==null&&t!==void 0&&t.maxTouchPoints?window.navigator.maxTouchPoints:0)>=5;return!!(e.match(/Mobi/)||e.match(/Android/)||n)||!!Pt().match(/DailyAnd\//)||void 0}function kr(){if(typeof window<"u"){var t=Pt();return Xf()?"Safari":t.indexOf("Edge")>-1?"Edge":t.match(/Chrome\//)?"Chrome":t.indexOf("Safari")>-1||Zf()?"Safari":t.indexOf("Firefox")>-1?"Firefox":t.indexOf("MSIE")>-1||t.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function xs(){switch(kr()){case"Chrome":return Gl();case"Safari":return Ql();case"Firefox":return Yl();case"Edge":return function(){var t=0,e=0;if(typeof window<"u"){var n=Pt().match(/Edge\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}()}}function Gl(){var t=0,e=0,n=0,r=0,i=!1;if(typeof window<"u"){var o=Pt(),s=o.match(/Chrome\/(\d+).(\d+).(\d+).(\d+)/);if(s)try{t=parseInt(s[1]),e=parseInt(s[2]),n=parseInt(s[3]),r=parseInt(s[4]),i=o.indexOf("OPR/")>-1}catch{}}return{major:t,minor:e,build:n,patch:r,opera:i}}function Xf(){return!!Pt().match(/iPad|iPhone|iPod/i)&&Wf()}function Zf(){return Pt().indexOf("AppleWebKit/605.1.15")>-1}function Ql(){var t=0,e=0,n=0;if(typeof window<"u"){var r=Pt().match(/Version\/(\d+).(\d+)(.(\d+))?/);if(r)try{t=parseInt(r[1]),e=parseInt(r[2]),n=parseInt(r[4])}catch{}else(Xf()||Zf())&&(t=14,e=0,n=3)}return{major:t,minor:e,point:n}}function Yl(){var t=0,e=0;if(typeof window<"u"){var n=Pt().match(/Firefox\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}var ep=function(){return bt(function t(){vt(this,t)},[{key:"addListenerForMessagesFromCallMachine",value:function(t,e,n){$i()}},{key:"addListenerForMessagesFromDailyJs",value:function(t,e,n){$i()}},{key:"sendMessageToCallMachine",value:function(t,e,n,r){$i()}},{key:"sendMessageToDailyJs",value:function(t,e){$i()}},{key:"removeListener",value:function(t){$i()}}])}();function tp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Xl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tp(Object(n),!0).forEach(function(r){rn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function np(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(np=function(){return!!t})()}var R0=function(){function t(){var e,n,r,i;return vt(this,t),n=this,r=zt(r=t),(e=Jo(n,np()?Reflect.construct(r,[],zt(n).constructor):r.apply(n,i)))._wrappedListeners={},e._messageCallbacks={},e}return Go(t,ep),bt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){var i=this,o=function(s){if(s.data&&s.data.what==="iframe-call-message"&&(!s.data.callClientId||s.data.callClientId===n)&&(!s.data.from||s.data.from!=="module")){var a=Xl({},s.data);if(delete a.from,a.callbackStamp&&i._messageCallbacks[a.callbackStamp]){var l=a.callbackStamp;i._messageCallbacks[l].call(r,a),delete i._messageCallbacks[l]}delete a.what,delete a.callbackStamp,e.call(r,a)}};this._wrappedListeners[e]=o,window.addEventListener("message",o)}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){var i=function(o){var s;if(!(!o.data||o.data.what!==Vl||!o.data.action||o.data.from&&o.data.from!=="module"||o.data.callClientId&&n&&o.data.callClientId!==n||o!=null&&(s=o.data)!==null&&s!==void 0&&s.callFrameId)){var a=o.data;e.call(r,a)}};this._wrappedListeners[e]=i,window.addEventListener("message",i)}},{key:"sendMessageToCallMachine",value:function(e,n,r,i){if(!r)throw new Error("undefined callClientId. Are you trying to use a DailyCall instance previously destroyed?");var o=Xl({},e);if(o.what=Vl,o.from="module",o.callClientId=r,n){var s=Xo();this._messageCallbacks[s]=n,o.callbackStamp=s}var a=i?i.contentWindow:window,l=this._callMachineTargetOrigin(i);l&&a.postMessage(o,l)}},{key:"sendMessageToDailyJs",value:function(e,n){e.what=Vl,e.callClientId=n,e.from="embedded",window.postMessage(e,this._targetOriginFromWindowLocation())}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"forwardPackagedMessageToCallMachine",value:function(e,n,r){var i=Xl({},e);i.callClientId=r;var o=n?n.contentWindow:window,s=this._callMachineTargetOrigin(n);s&&o.postMessage(i,s)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(e,n){var r=function(i){if(i.data&&i.data.what==="iframe-call-message"&&(!i.data.callClientId||i.data.callClientId===n)&&(!i.data.from||i.data.from!=="module")){var o=i.data;e(o)}};return this._wrappedListeners[e]=r,window.addEventListener("message",r),e}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(e){var n=this._wrappedListeners[e];n&&(window.removeEventListener("message",n),delete this._wrappedListeners[e])}},{key:"_callMachineTargetOrigin",value:function(e){return e?e.src?new URL(e.src).origin:void 0:this._targetOriginFromWindowLocation()}},{key:"_targetOriginFromWindowLocation",value:function(){return window.location.protocol==="file:"?"*":window.location.origin}}])}();function rp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ip(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ip=function(){return!!t})()}var N0=function(){function t(){var e,n,r,i;return vt(this,t),n=this,r=zt(r=t),e=Jo(n,ip()?Reflect.construct(r,[],zt(n).constructor):r.apply(n,i)),global.callMachineToDailyJsEmitter=global.callMachineToDailyJsEmitter||new ol.EventEmitter,global.dailyJsToCallMachineEmitter=global.dailyJsToCallMachineEmitter||new ol.EventEmitter,e._wrappedListeners={},e._messageCallbacks={},e}return Go(t,ep),bt(t,[{key:"addListenerForMessagesFromCallMachine",value:function(e,n,r){this._addListener(e,global.callMachineToDailyJsEmitter,n,r,"received call machine message")}},{key:"addListenerForMessagesFromDailyJs",value:function(e,n,r){this._addListener(e,global.dailyJsToCallMachineEmitter,n,r,"received daily-js message")}},{key:"sendMessageToCallMachine",value:function(e,n,r){this._sendMessage(e,global.dailyJsToCallMachineEmitter,r,n,"sending message to call machine")}},{key:"sendMessageToDailyJs",value:function(e,n){this._sendMessage(e,global.callMachineToDailyJsEmitter,n,null,"sending message to daily-js")}},{key:"removeListener",value:function(e){var n=this._wrappedListeners[e];n&&(global.callMachineToDailyJsEmitter.removeListener("message",n),global.dailyJsToCallMachineEmitter.removeListener("message",n),delete this._wrappedListeners[e])}},{key:"_addListener",value:function(e,n,r,i,o){var s=this,a=function(l){if(l.callClientId===r){if(l.callbackStamp&&s._messageCallbacks[l.callbackStamp]){var c=l.callbackStamp;s._messageCallbacks[c].call(i,l),delete s._messageCallbacks[c]}e.call(i,l)}};this._wrappedListeners[e]=a,n.addListener("message",a)}},{key:"_sendMessage",value:function(e,n,r,i,o){var s=function(l){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?arguments[c]:{};c%2?rp(Object(d),!0).forEach(function(h){rn(l,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):rp(Object(d)).forEach(function(h){Object.defineProperty(l,h,Object.getOwnPropertyDescriptor(d,h))})}return l}({},e);if(s.callClientId=r,i){var a=Xo();this._messageCallbacks[a]=i,s.callbackStamp=a}n.emit("message",s)}}])}(),Zl="replace",ec="shallow-merge",op=[Zl,ec],$0=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.data,r=e.mergeStrategy,i=r===void 0?Zl:r;vt(this,t),t._validateMergeStrategy(i),t._validateData(n,i),this.mergeStrategy=i,this.data=n}return bt(t,[{key:"isNoOp",value:function(){return t.isNoOpUpdate(this.data,this.mergeStrategy)}}],[{key:"isNoOpUpdate",value:function(e,n){return Object.keys(e).length===0&&n===ec}},{key:"_validateMergeStrategy",value:function(e){if(!op.includes(e))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(op,"]"))}},{key:"_validateData",value:function(e,n){if(!function(a){if(a==null||me(a)!=="object")return!1;var l=Object.getPrototypeOf(a);return l==null||l===Object.prototype}(e))throw Error("Meeting session data must be a plain (map-like) object");var r;try{if(r=JSON.stringify(e),n===Zl){var i=JSON.parse(r);it(i,e)||console.warn("The meeting session data provided will be modified when serialized.",i,e)}else if(n===ec){for(var o in e)if(Object.hasOwnProperty.call(e,o)&&e[o]!==void 0){var s=JSON.parse(JSON.stringify(e[o]));it(e[o],s)||console.warn("At least one key in the meeting session data provided will be modified when serialized.",s,e[o])}}}catch(a){throw Error("Meeting session data must be serializable to JSON: ".concat(a))}if(r.length>Uf)throw Error("Meeting session data is too large (".concat(r.length," characters). Maximum size suppported is ").concat(Uf,"."))}}])}();function sp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sp=function(){return!!t})()}function tc(t){var e=typeof Map=="function"?new Map:void 0;return tc=function(n){if(n===null||!function(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return function(i,o,s){if(sp())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,o);var l=new(i.bind.apply(i,a));return s&&Ni(l,s.prototype),l}(n,arguments,zt(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ni(r,n)},tc(t)}function ap(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ap=function(){return!!t})()}function lp(t){var e,n=(e=window._daily)===null||e===void 0?void 0:e.pendings;if(n){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}var F0=function(){return bt(function t(e){vt(this,t),this._currentLoad=null,this._callClientId=e},[{key:"load",value:function(){var t,e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;if(this.loaded)return window._daily.instances[this._callClientId].callMachine.reset(),void r(!0);t=this._callClientId,window._daily.pendings.push(t),this._currentLoad&&this._currentLoad.cancel(),this._currentLoad=new j0(n,function(){r(!1)},function(o,s){s||lp(e._callClientId),i(o,s)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),lp(this._callClientId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}])}(),j0=function(){return bt(function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;vt(this,t),this._attemptsRemaining=3,this._currentAttempt=null,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r},[{key:"start",value:function(){var t=this;if(!this._currentAttempt){var e=function(n){t._currentAttempt.cancelled||(t._attemptsRemaining--,t._failureCallback(n,t._attemptsRemaining>0),t._attemptsRemaining<=0||setTimeout(function(){t._currentAttempt.cancelled||(t._currentAttempt=new cp(t._dailyConfig,t._successCallback,e),t._currentAttempt.start())},3e3))};this._currentAttempt=new cp(this._dailyConfig,this._successCallback,e),this._currentAttempt.start()}}},{key:"cancel",value:function(){this._currentAttempt&&this._currentAttempt.cancel()}},{key:"cancelled",get:function(){return this._currentAttempt&&this._currentAttempt.cancelled}},{key:"succeeded",get:function(){return this._currentAttempt&&this._currentAttempt.succeeded}}])}(),nc=function(){function t(){return vt(this,t),e=this,r=arguments,n=zt(n=t),Jo(e,ap()?Reflect.construct(n,r||[],zt(e).constructor):n.apply(e,r));var e,n,r}return Go(t,tc(Error)),bt(t)}(),_s=2e4,cp=function(){return bt(function e(n,r,i){vt(this,e),this._loadAttemptImpl=pe()||!n.avoidEval?new B0(n,r,i):new U0(n,r,i)},[{key:"start",value:(t=ne(function*(){return this._loadAttemptImpl.start()}),function(){return t.apply(this,arguments)})},{key:"cancel",value:function(){this._loadAttemptImpl.cancel()}},{key:"cancelled",get:function(){return this._loadAttemptImpl.cancelled}},{key:"succeeded",get:function(){return this._loadAttemptImpl.succeeded}}]);var t}(),B0=function(){return bt(function i(o,s,a){vt(this,i),this.cancelled=!1,this.succeeded=!1,this._networkTimedOut=!1,this._networkTimeout=null,this._iosCache=typeof iOSCallObjectBundleCache<"u"&&iOSCallObjectBundleCache,this._refetchHeaders=null,this._dailyConfig=o,this._successCallback=s,this._failureCallback=a},[{key:"start",value:(r=ne(function*(){var i=Zo(this._dailyConfig);!(yield this._tryLoadFromIOSCache(i))&&this._loadFromNetwork(i)}),function(){return r.apply(this,arguments)})},{key:"cancel",value:function(){clearTimeout(this._networkTimeout),this.cancelled=!0}},{key:"_tryLoadFromIOSCache",value:(n=ne(function*(i){if(!this._iosCache)return!1;try{var o=yield this._iosCache.get(i);return!!this.cancelled||!!o&&(o.code?(Function('"use strict";'+o.code)(),this.succeeded=!0,this._successCallback(),!0):(this._refetchHeaders=o.refetchHeaders,!1))}catch{return!1}}),function(i){return n.apply(this,arguments)})},{key:"_loadFromNetwork",value:(e=ne(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(_s," ms) when loading call object bundle ").concat(i),type:"timeout"})},_s);try{var s=this._refetchHeaders?{headers:this._refetchHeaders}:{},a=yield fetch(i,s);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new nc;var l=yield this._getBundleCodeFromResponse(i,a);if(this.cancelled)throw new nc;Function('"use strict";'+l)(),this._iosCache&&this._iosCache.set(i,l,a.headers),this.succeeded=!0,this._successCallback()}catch(c){if(clearTimeout(this._networkTimeout),c instanceof nc||this.cancelled||this._networkTimedOut)return;this._failureCallback({msg:"Failed to load call object bundle ".concat(i,": ").concat(c),type:c.message})}}),function(i){return e.apply(this,arguments)})},{key:"_getBundleCodeFromResponse",value:(t=ne(function*(i,o){if(o.ok)return yield o.text();if(this._iosCache&&o.status===304)return(yield this._iosCache.renew(i,o.headers)).code;throw new Error("Received ".concat(o.status," response"))}),function(i,o){return t.apply(this,arguments)})}]);var t,e,n,r}(),U0=function(){return bt(function t(e,n,r){vt(this,t),this.cancelled=!1,this.succeeded=!1,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r,this._attemptId=Xo(),this._networkTimeout=null,this._scriptElement=null},[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=Zo(this._dailyConfig);(typeof document>"u"?"undefined":me(document))==="object"?this._startLoading(t):this._failureCallback({msg:"Call object bundle must be loaded in a DOM/web context",type:"missing context"})}},{key:"cancel",value:function(){this._stopLoading(),this.cancelled=!0}},{key:"_startLoading",value:function(t){var e=this;this._signUpForCallMachineLoadWaitlist(),this._networkTimeout=setTimeout(function(){e._stopLoading(),e._failureCallback({msg:"Timed out (>".concat(_s," ms) when loading call object bundle ").concat(t),type:"timeout"})},_s);var n=document.getElementsByTagName("head")[0],r=document.createElement("script");this._scriptElement=r,r.onload=function(){e._stopLoading(),e.succeeded=!0,e._successCallback()},r.onerror=function(i){e._stopLoading(),e._failureCallback({msg:"Failed to load call object bundle ".concat(i.target.src),type:i.message})},r.src=t,n.appendChild(r)}},{key:"_stopLoading",value:function(){this._withdrawFromCallMachineLoadWaitlist(),clearTimeout(this._networkTimeout),this._scriptElement&&(this._scriptElement.onload=null,this._scriptElement.onerror=null)}},{key:"_signUpForCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.add(this._attemptId)}},{key:"_withdrawFromCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.delete(this._attemptId)}}])}(),Cs=function(t,e,n){return H0(t.local,e,n)===!0},z0=function(t,e,n){return t.local.streams&&t.local.streams[e]&&t.local.streams[e].stream&&t.local.streams[e].stream["get".concat(n==="video"?"Video":"Audio","Tracks")]()[0]},Xr=function(t,e,n,r){var i=V0(t,e,n,r);return i&&i.pendingTrack},H0=function(t,e,n){if(!t)return!1;var r=function(o){switch(o){case"avatar":return!0;case"staged":return o;default:return!!o}},i=t.public.subscribedTracks;return i&&i[e]?["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo"].indexOf(n)===-1&&i[e].custom?[!0,"staged"].includes(i[e].custom)?r(i[e].custom):r(i[e].custom[n]):r(i[e][n]):!i||r(i.ALL)},V0=function(t,e,n,r){var i=Object.values(t.streams||{}).filter(function(o){return o.participantId===e&&o.type===n&&o.pendingTrack&&o.pendingTrack.kind===r}).sort(function(o,s){return new Date(s.starttime)-new Date(o.starttime)});return i&&i[0]},K0=function(t,e){var n=t.local.public.customTracks;if(n&&n[e])return n[e].track};function up(t,e){for(var n=e.getState(),r=0,i=["cam","screen"];r<i.length;r++)for(var o=i[r],s=0,a=["video","audio"];s<a.length;s++){var l=a[s],c=o==="cam"?l:"screen".concat(l.charAt(0).toUpperCase()+l.slice(1)),d=t.tracks[c];if(d){var h=t.local?z0(n,o,l):Xr(n,t.session_id,o,l);d.state==="playable"&&(d.track=h),d.persistentTrack=h}}}function dp(t,e){try{var n=e.getState();for(var r in t.tracks)if(!W0(r)){var i=t.tracks[r].kind;if(i){var o=t.tracks[r];if(o){var s=t.local?K0(n,r):Xr(n,t.session_id,r,i);o.state==="playable"&&(t.tracks[r].track=s),o.persistentTrack=s}}else console.error("unknown type for custom track")}}catch(a){console.error(a)}}function W0(t){return["video","audio","screenVideo","screenAudio"].includes(t)}function hp(t,e,n){var r=n.getState();if(t.local){if(t.audio)try{t.audioTrack=r.local.streams.cam.stream.getAudioTracks()[0],t.audioTrack||(t.audio=!1)}catch{}if(t.video)try{t.videoTrack=r.local.streams.cam.stream.getVideoTracks()[0],t.videoTrack||(t.video=!1)}catch{}if(t.screen)try{t.screenVideoTrack=r.local.streams.screen.stream.getVideoTracks()[0],t.screenAudioTrack=r.local.streams.screen.stream.getAudioTracks()[0],t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch{}}else{var i=!0;try{var o=r.participants[t.session_id];o&&o.public&&o.public.rtcType&&o.public.rtcType.impl==="peer-to-peer"&&o.private&&!["connected","completed"].includes(o.private.peeringState)&&(i=!1)}catch(d){console.error(d)}if(!i)return t.audio=!1,t.audioTrack=!1,t.video=!1,t.videoTrack=!1,t.screen=!1,void(t.screenTrack=!1);try{if(r.streams,t.audio&&Cs(r,t.session_id,"cam-audio")){var s=Xr(r,t.session_id,"cam","audio");s&&(e&&e.audioTrack&&e.audioTrack.id===s.id?t.audioTrack=s:s.muted||(t.audioTrack=s)),t.audioTrack||(t.audio=!1)}if(t.video&&Cs(r,t.session_id,"cam-video")){var a=Xr(r,t.session_id,"cam","video");a&&(e&&e.videoTrack&&e.videoTrack.id===a.id?t.videoTrack=a:a.muted||(t.videoTrack=a)),t.videoTrack||(t.video=!1)}if(t.screen&&Cs(r,t.session_id,"screen-audio")){var l=Xr(r,t.session_id,"screen","audio");l&&(e&&e.screenAudioTrack&&e.screenAudioTrack.id===l.id?t.screenAudioTrack=l:l.muted||(t.screenAudioTrack=l))}if(t.screen&&Cs(r,t.session_id,"screen-video")){var c=Xr(r,t.session_id,"screen","video");c&&(e&&e.screenVideoTrack&&e.screenVideoTrack.id===c.id?t.screenVideoTrack=c:c.muted||(t.screenVideoTrack=c))}t.screenVideoTrack||t.screenAudioTrack||(t.screen=!1)}catch(d){console.error("unexpected error matching up tracks",d)}}}function q0(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return fp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?fp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
28
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function fp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var on=new Map,Zr=null;function J0(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return pp(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?pp(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
29
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function pp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var sn=new Map,Hi=null;function G0(t){gp()?function(e){on.has(e)||(on.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){on.has(e)&&(on.get(e).lastDevicesString=JSON.stringify(n),Zr||(Zr=function(){var r=ne(function*(){var i,o=yield navigator.mediaDevices.enumerateDevices(),s=q0(on.keys());try{for(s.s();!(i=s.n()).done;){var a=i.value,l=JSON.stringify(o);l!==on.get(a).lastDevicesString&&(on.get(a).lastDevicesString=l,a(o))}}catch(c){s.e(c)}finally{s.f()}});return function(){return r.apply(this,arguments)}}(),navigator.mediaDevices.addEventListener("devicechange",Zr)))}).catch(function(){}))}(t):function(e){sn.has(e)||(sn.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){sn.has(e)&&(sn.get(e).lastDevicesString=JSON.stringify(n),Hi||(Hi=setInterval(ne(function*(){var r,i=yield navigator.mediaDevices.enumerateDevices(),o=J0(sn.keys());try{for(o.s();!(r=o.n()).done;){var s=r.value,a=JSON.stringify(i);a!==sn.get(s).lastDevicesString&&(sn.get(s).lastDevicesString=a,s(i))}}catch(l){o.e(l)}finally{o.f()}}),3e3)))}))}(t)}function Q0(t){gp()?function(e){on.has(e)&&(on.delete(e),on.size===0&&Zr&&(navigator.mediaDevices.removeEventListener("devicechange",Zr),Zr=null))}(t):function(e){sn.has(e)&&(sn.delete(e),sn.size===0&&Hi&&(clearInterval(Hi),Hi=null))}(t)}function gp(){var t;return pe()||((t=navigator.mediaDevices)===null||t===void 0?void 0:t.ondevicechange)!==void 0}var Y0=new Set;function X0(t,e){return t&&t.readyState==="live"&&!function(n,r){return n.muted&&!Y0.has(n.id)}(t)}function mp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mp(Object(n),!0).forEach(function(r){rn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var Vi=Object.freeze({VIDEO:"video",AUDIO:"audio",SCREEN_VIDEO:"screenVideo",SCREEN_AUDIO:"screenAudio",CUSTOM_VIDEO:"customVideo",CUSTOM_AUDIO:"customAudio"}),Z0=Object.freeze({PARTICIPANTS:"participants",STREAMING:"streaming",TRANSCRIPTION:"transcription"}),Ki=Object.values(Vi),yp=["v","a","sv","sa","cv","ca"];Object.freeze(Ki.reduce(function(t,e,n){return t[e]=yp[n],t},{})),Object.freeze(yp.reduce(function(t,e,n){return t[e]=Ki[n],t},{}));var eS=[Vi.VIDEO,Vi.AUDIO,Vi.SCREEN_VIDEO,Vi.SCREEN_AUDIO],vp=Object.values(Z0),bp=["p","s","t"];Object.freeze(vp.reduce(function(t,e,n){return t[e]=bp[n],t},{})),Object.freeze(bp.reduce(function(t,e,n){return t[e]=vp[n],t},{}));var wp=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.base,r=e.byUserId,i=e.byParticipantId;vt(this,t),this.base=n,this.byUserId=r,this.byParticipantId=i}return bt(t,[{key:"clone",value:function(){var e=new t;if(this.base instanceof We?e.base=this.base.clone():e.base=this.base,this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof We?r.clone():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof We?o.clone():o}return e}},{key:"toJSONObject",value:function(){var e={};if(typeof this.base=="boolean"?e.base=this.base:this.base instanceof We&&(e.base=this.base.toJSONObject()),this.byUserId!==void 0)for(var n in e.byUserId={},this.byUserId){var r=this.byUserId[n];e.byUserId[n]=r instanceof We?r.toJSONObject():r}if(this.byParticipantId!==void 0)for(var i in e.byParticipantId={},this.byParticipantId){var o=this.byParticipantId[i];e.byParticipantId[i]=o instanceof We?o.toJSONObject():o}return e}},{key:"toMinifiedJSONObject",value:function(){var e={};if(this.base!==void 0&&(typeof this.base=="boolean"?e.b=this.base:e.b=this.base.toMinifiedJSONObject()),this.byUserId!==void 0)for(var n in e.u={},this.byUserId){var r=this.byUserId[n];e.u[n]=typeof r=="boolean"?r:r.toMinifiedJSONObject()}if(this.byParticipantId!==void 0)for(var i in e.p={},this.byParticipantId){var o=this.byParticipantId[i];e.p[i]=typeof o=="boolean"?o:o.toMinifiedJSONObject()}return e}},{key:"normalize",value:function(){return this.base instanceof We&&(this.base=this.base.normalize()),this.byUserId&&(this.byUserId=Object.fromEntries(Object.entries(this.byUserId).map(function(e){var n=Xe(e,2),r=n[0],i=n[1];return[r,i instanceof We?i.normalize():i]}))),this.byParticipantId&&(this.byParticipantId=Object.fromEntries(Object.entries(this.byParticipantId).map(function(e){var n=Xe(e,2),r=n[0],i=n[1];return[r,i instanceof We?i.normalize():i]}))),this}}],[{key:"fromJSONObject",value:function(e){var n,r,i;if(e.base!==void 0&&(n=typeof e.base=="boolean"?e.base:We.fromJSONObject(e.base)),e.byUserId!==void 0)for(var o in r={},e.byUserId){var s=e.byUserId[o];r[o]=typeof s=="boolean"?s:We.fromJSONObject(s)}if(e.byParticipantId!==void 0)for(var a in i={},e.byParticipantId){var l=e.byParticipantId[a];i[a]=typeof l=="boolean"?l:We.fromJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"fromMinifiedJSONObject",value:function(e){var n,r,i;if(e.b!==void 0&&(n=typeof e.b=="boolean"?e.b:We.fromMinifiedJSONObject(e.b)),e.u!==void 0)for(var o in r={},e.u){var s=e.u[o];r[o]=typeof s=="boolean"?s:We.fromMinifiedJSONObject(s)}if(e.p!==void 0)for(var a in i={},e.p){var l=e.p[a];i[a]=typeof l=="boolean"?l:We.fromMinifiedJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"validateJSONObject",value:function(e){if(me(e)!=="object")return[!1,"canReceive must be an object"];for(var n=["base","byUserId","byParticipantId"],r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];if(!n.includes(o))return[!1,"canReceive can only contain keys (".concat(n.join(", "),")")];if(o==="base"){var s=Xe(We.validateJSONObject(e.base,!0),2),a=s[0],l=s[1];if(!a)return[!1,l]}else{if(me(e[o])!=="object")return[!1,"invalid (non-object) value for field '".concat(o,"' in canReceive")];for(var c=0,d=Object.values(e[o]);c<d.length;c++){var h=d[c],f=Xe(We.validateJSONObject(h),2),g=f[0],y=f[1];if(!g)return[!1,y]}}}return[!0]}}])}(),We=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.video,r=e.audio,i=e.screenVideo,o=e.screenAudio,s=e.customVideo,a=e.customAudio;vt(this,t),this.video=n,this.audio=r,this.screenVideo=i,this.screenAudio=o,this.customVideo=s,this.customAudio=a}return bt(t,[{key:"clone",value:function(){var e=new t;return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=zn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=zn({},this.customAudio)),e}},{key:"toJSONObject",value:function(){var e={};return this.video!==void 0&&(e.video=this.video),this.audio!==void 0&&(e.audio=this.audio),this.screenVideo!==void 0&&(e.screenVideo=this.screenVideo),this.screenAudio!==void 0&&(e.screenAudio=this.screenAudio),this.customVideo!==void 0&&(e.customVideo=zn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=zn({},this.customAudio)),e}},{key:"toMinifiedJSONObject",value:function(){var e={};return this.video!==void 0&&(e.v=this.video),this.audio!==void 0&&(e.a=this.audio),this.screenVideo!==void 0&&(e.sv=this.screenVideo),this.screenAudio!==void 0&&(e.sa=this.screenAudio),this.customVideo!==void 0&&(e.cv=zn({},this.customVideo)),this.customAudio!==void 0&&(e.ca=zn({},this.customAudio)),e}},{key:"normalize",value:function(){function e(n,r){return n&&Object.keys(n).length===1&&n["*"]===r}return!(this.video!==!0||this.audio!==!0||this.screenVideo!==!0||this.screenAudio!==!0||!e(this.customVideo,!0)||!e(this.customAudio,!0))||(this.video!==!1||this.audio!==!1||this.screenVideo!==!1||this.screenAudio!==!1||!e(this.customVideo,!1)||!e(this.customAudio,!1))&&this}}],[{key:"fromBoolean",value:function(e){return new t({video:e,audio:e,screenVideo:e,screenAudio:e,customVideo:{"*":e},customAudio:{"*":e}})}},{key:"fromJSONObject",value:function(e){return new t({video:e.video,audio:e.audio,screenVideo:e.screenVideo,screenAudio:e.screenAudio,customVideo:e.customVideo!==void 0?zn({},e.customVideo):void 0,customAudio:e.customAudio!==void 0?zn({},e.customAudio):void 0})}},{key:"fromMinifiedJSONObject",value:function(e){return new t({video:e.v,audio:e.a,screenVideo:e.sv,screenAudio:e.sa,customVideo:e.cv,customAudio:e.ca})}},{key:"validateJSONObject",value:function(e,n){if(typeof e=="boolean")return[!0];if(me(e)!=="object")return[!1,"invalid (non-object, non-boolean) value in canReceive"];for(var r=Object.keys(e),i=0,o=r;i<o.length;i++){var s=o[i];if(!Ki.includes(s))return[!1,"invalid media type '".concat(s,"' in canReceive")];if(eS.includes(s)){if(typeof e[s]!="boolean")return[!1,"invalid (non-boolean) value for media type '".concat(s,"' in canReceive")]}else{if(me(e[s])!=="object")return[!1,"invalid (non-object) value for media type '".concat(s,"' in canReceive")];for(var a=0,l=Object.values(e[s]);a<l.length;a++)if(typeof l[a]!="boolean")return[!1,"invalid (non-boolean) value for entry within '".concat(s,"' in canReceive")];if(n&&e[s]["*"]===void 0)return[!1,`canReceive "base" permission must specify "*" as an entry within '`.concat(s,"'")]}}return n&&r.length!==Ki.length?[!1,'canReceive "base" permission must specify all media types: '.concat(Ki.join(", ")," (or be set to a boolean shorthand)")]:[!0]}}])}(),tS=["result"],nS=["preserveIframe"];function Sp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Y(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(n),!0).forEach(function(r){rn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kp=function(){return!!t})()}function xp(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(l,c){if(l){if(typeof l=="string")return _p(l,c);var d={}.toString.call(l).slice(8,-1);return d==="Object"&&l.constructor&&(d=l.constructor.name),d==="Map"||d==="Set"?Array.from(l):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?_p(l,c):void 0}}(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
30
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,o=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw o}}}}function _p(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var xr={},Cp="video",rS="voice",Ep=pe()?{data:{}}:{data:{},topology:"none"},Tp={present:0,hidden:0},Mp={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},rc=Object.keys(Mp),Ap=["state","volume","simulcastEncodings"],Op={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},Es={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string",visualState:"'default' | 'sidebar-open' | 'active'"}},ic={id:{allow:"string",controlledBy:"'*' | 'owners' | string[]",csp:"string",iconURL:"string",label:"string",loading:"'eager' | 'lazy'",location:"'main' | 'sidebar'",name:"string",referrerPolicy:"string",sandbox:"string",src:"string",srcdoc:"string",shared:"string[] | 'owners' | boolean"}},_r={customIntegrations:{validate:Bp,help:Fp()},customTrayButtons:{validate:jp,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(Es))},url:{validate:function(t){return typeof t=="string"},help:"url should be a string"},baseUrl:{validate:function(t){return typeof t=="string"},help:"baseUrl should be a string"},token:{validate:function(t){return typeof t=="string"},help:"token should be a string",queryString:"t"},dailyConfig:{validate:function(t,e){try{return e.validateDailyConfig(t),!0}catch(n){console.error("Failed to validate dailyConfig",n)}return!1},help:"Unsupported dailyConfig. Check error logs for detailed info."},reactNativeConfig:{validate:function(t){return Up(t,Op)},help:"reactNativeConfig should look like ".concat(JSON.stringify(Op),", all fields optional")},lang:{validate:function(t){return["da","de","en-us","en","es","fi","fr","it","jp","ka","nl","no","pl","pt","pt-BR","ru","sv","tr","user"].includes(t)},help:"language not supported. Options are: da, de, en-us, en, es, fi, fr, it, jp, ka, nl, no, pl, pt, pt-BR, ru, sv, tr, user"},userName:!0,userData:{validate:function(t){try{return Lp(t),!0}catch(e){return console.error(e),!1}},help:"invalid userData type provided"},startVideoOff:!0,startAudioOff:!0,allowLocalVideo:!0,allowLocalAudio:!0,activeSpeakerMode:!0,showLeaveButton:!0,showLocalVideo:!0,showParticipantsBar:!0,showFullscreenButton:!0,showUserNameChangeUI:!0,iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,videoSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalVideo=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.videoTrack=t,n={customTrack:wn};else{if(delete e._sharedTracks.videoTrack,typeof t!="string")return console.error("videoSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({video:{settings:n}},!1),!0}},audioSource:{validate:function(t,e){if(typeof t=="boolean")return e._preloadCache.allowLocalAudio=t,!0;var n;if(t instanceof MediaStreamTrack)e._sharedTracks.audioTrack=t,n={customTrack:wn};else{if(delete e._sharedTracks.audioTrack,typeof t!="string")return console.error("audioSource must be a MediaStreamTrack, boolean, or a string"),!1;n={deviceId:t}}return e._updatePreloadCacheInputSettings({audio:{settings:n}},!1),!0}},subscribeToTracksAutomatically:{validate:function(t,e){return e._preloadCache.subscribeToTracksAutomatically=t,!0}},theme:{validate:function(t){var e=["accent","accentText","background","backgroundAccent","baseText","border","mainAreaBg","mainAreaBgAccent","mainAreaText","supportiveText"],n=function(r){for(var i=0,o=Object.keys(r);i<o.length;i++){var s=o[i];if(!e.includes(s))return console.error('unsupported color "'.concat(s,'". Valid colors: ').concat(e.join(", "))),!1;if(!r[s].match(/^#[0-9a-f]{6}|#[0-9a-f]{3}$/i))return console.error("".concat(s,' theme color should be provided in valid hex color format. Received: "').concat(r[s],'"')),!1}return!0};return me(t)==="object"&&("light"in t&&"dark"in t||"colors"in t)?"light"in t&&"dark"in t?"colors"in t.light?"colors"in t.dark?n(t.light.colors)&&n(t.dark.colors):(console.error('Dark theme is missing "colors" property.',t),!1):(console.error('Light theme is missing "colors" property.',t),!1):n(t.colors):(console.error('Theme must contain either both "light" and "dark" properties, or "colors".',t),!1)},help:"unsupported theme configuration. Check error logs for detailed info."},layoutConfig:{validate:function(t){if("grid"in t){var e=t.grid;if("maxTilesPerPage"in e){if(!Number.isInteger(e.maxTilesPerPage))return console.error("grid.maxTilesPerPage should be an integer. You passed ".concat(e.maxTilesPerPage,".")),!1;if(e.maxTilesPerPage>49)return console.error("grid.maxTilesPerPage can't be larger than 49 without sacrificing browser performance. Please contact us at https://www.daily.co/contact to talk about your use case."),!1}if("minTilesPerPage"in e){if(!Number.isInteger(e.minTilesPerPage))return console.error("grid.minTilesPerPage should be an integer. You passed ".concat(e.minTilesPerPage,".")),!1;if(e.minTilesPerPage<1)return console.error("grid.minTilesPerPage can't be lower than 1."),!1;if("maxTilesPerPage"in e&&e.minTilesPerPage>e.maxTilesPerPage)return console.error("grid.minTilesPerPage can't be higher than grid.maxTilesPerPage."),!1}}return!0},help:"unsupported layoutConfig. Check error logs for detailed info."},receiveSettings:{validate:function(t){return Pp(t,{allowAllParticipantsKey:!1})},help:$p({allowAllParticipantsKey:!1})},sendSettings:{validate:function(t,e){return!!function(n,r){try{return r.validateUpdateSendSettings(n),!0}catch(i){return console.error("Failed to validate send settings",i),!1}}(t,e)&&(e._preloadCache.sendSettings=t,!0)},help:"Invalid sendSettings provided. Check error logs for detailed info."},inputSettings:{validate:function(t,e){var n;return!!Ip(t)&&(e._inputSettings||(e._inputSettings={}),Rp(t,(n=e.properties)===null||n===void 0?void 0:n.dailyConfig,e._sharedTracks),e._updatePreloadCacheInputSettings(t,!0),!0)},help:ac()},layout:{validate:function(t){return t==="custom-v1"||t==="browser"||t==="none"},help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"},embHref:{queryString:"embHref"},dailyJsVersion:{queryString:"dailyJsVersion"},proxy:{queryString:"proxy"},strictMode:!0,allowMultipleCallInstances:!0},Ts={styles:{validate:function(t){for(var e in t)if(e!=="cam"&&e!=="screen")return!1;if(t.cam){for(var n in t.cam)if(n!=="div"&&n!=="video")return!1}if(t.screen){for(var r in t.screen)if(r!=="div"&&r!=="video")return!1}return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setSubscribedTracks:{validate:function(t,e){if(e._preloadCache.subscribeToTracksAutomatically)return!1;var n=[!0,!1,"staged"];if(n.includes(t)||!pe()&&t==="avatar")return!0;var r=["audio","video","screenAudio","screenVideo","rmpAudio","rmpVideo"],i=function(o){var s=arguments.length>1&&arguments[1]!==void 0&&arguments[1];for(var a in o)if(a==="custom"){if(!n.includes(o[a])&&!i(o[a],!0))return!1}else{var l=!s&&!r.includes(a),c=!n.includes(o[a]);if(l||c)return!1}return!0};return i(t)},help:"setSubscribedTracks cannot be used when setSubscribeToTracksAutomatically is enabled, and should be of the form: "+"true".concat(pe()?"":" | 'avatar'"," | false | 'staged' | { [audio: true|false|'staged'], [video: true|false|'staged'], [screenAudio: true|false|'staged'], [screenVideo: true|false|'staged'] }")},setAudio:!0,setVideo:!0,setScreenShare:{validate:function(t){return t===!1},help:"setScreenShare must be false, as it's only meant for stopping remote participants' screen shares"},eject:!0,updatePermissions:{validate:function(t){for(var e=0,n=Object.entries(t);e<n.length;e++){var r=Xe(n[e],2),i=r[0],o=r[1];switch(i){case"hasPresence":if(typeof o!="boolean")return!1;break;case"canSend":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var s,a=["video","audio","screenVideo","screenAudio","customVideo","customAudio"],l=xp(o);try{for(l.s();!(s=l.n()).done;){var c=s.value;if(!a.includes(c))return!1}}catch(v){l.e(v)}finally{l.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canSend=new Set(o));break;case"canReceive":var d=Xe(wp.validateJSONObject(o),2),h=d[0],f=d[1];if(!h)return console.error(f),!1;break;case"canAdmin":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var g,y=["participants","streaming","transcription"],m=xp(o);try{for(m.s();!(g=m.n()).done;){var S=g.value;if(!y.includes(S))return!1}}catch(v){m.e(v)}finally{m.f()}}else if(typeof o!="boolean")return!1;(o instanceof Array||Array.isArray(o))&&(t.canAdmin=new Set(o));break;default:return!1}}return!0},help:"updatePermissions can take hasPresence, canSend, canReceive, and canAdmin permissions. hasPresence must be a boolean. canSend can be a boolean or an Array or Set of media types (video, audio, screenVideo, screenAudio, customVideo, customAudio). canReceive must be an object specifying base, byUserId, and/or byParticipantId fields (see documentation for more details). canAdmin can be a boolean or an Array or Set of admin types (participants, streaming, transcription)."}};Promise.any||(Promise.any=function(){var t=ne(function*(e){return new Promise(function(n,r){var i=[];e.forEach(function(o){return Promise.resolve(o).then(function(s){n(s)}).catch(function(s){i.push(s),i.length===e.length&&r(i)})})})});return function(e){return t.apply(this,arguments)}}());var iS=function(){function t(u){var b,p,x,_,D,I,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(vt(this,t),x=this,_=zt(_=t),rn(p=Jo(x,kp()?Reflect.construct(_,[],zt(x).constructor):_.apply(x,D)),"startListeningForDeviceChanges",function(){G0(p.handleDeviceChange)}),rn(p,"stopListeningForDeviceChanges",function(){Q0(p.handleDeviceChange)}),rn(p,"handleDeviceChange",function(re){re=re.map(function(he){return JSON.parse(JSON.stringify(he))}),p.emitDailyJSEvent({action:"available-devices-updated",availableDevices:re})}),rn(p,"handleNativeAppStateChange",function(){var re=ne(function*(he){if(he==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield p.destroy());var dt=he==="active";p.disableReactNativeAutoDeviceManagement("video")||(dt?p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!0):(p.camUnmutedBeforeLosingNativeActiveState=p.localVideo(),p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!1)))});return function(he){return re.apply(this,arguments)}}()),rn(p,"handleNativeAudioFocusChange",function(re){p.disableReactNativeAutoDeviceManagement("audio")||(p._hasNativeAudioFocus=re,p.toggleParticipantAudioBasedOnNativeAudioFocus(),p._hasNativeAudioFocus?p.micUnmutedBeforeLosingNativeAudioFocus&&p.setLocalAudio(!0):(p.micUnmutedBeforeLosingNativeAudioFocus=p.localAudio(),p.setLocalAudio(!1)))}),rn(p,"handleNativeSystemScreenCaptureStop",function(){p.stopScreenShare()}),!Jl()&&!pe())throw new Error("WebRTC not supported or suppressed");if(p.strictMode=F.strictMode===void 0||F.strictMode,p.allowMultipleCallInstances=(b=F.allowMultipleCallInstances)!==null&&b!==void 0&&b,Object.keys(xr).length&&(p._logDuplicateInstanceAttempt(),!p.allowMultipleCallInstances)){if(p.strictMode)throw new Error("Duplicate DailyIframe instances are not allowed");console.warn("Using strictMode: false to allow multiple call instances is now deprecated. Set `allowMultipleCallInstances: true`")}if(window._daily||(window._daily={pendings:[],instances:{}}),p.callClientId=Xo(),xr[(I=p).callClientId]=I,window._daily.instances[p.callClientId]={},p._sharedTracks={},window._daily.instances[p.callClientId].tracks=p._sharedTracks,F.dailyJsVersion=t.version(),p._iframe=u,p._callObjectMode=F.layout==="none"&&!p._iframe,p._preloadCache={subscribeToTracksAutomatically:!0,outputDeviceId:null,inputSettings:null,sendSettings:null,videoTrackForNetworkConnectivityTest:null,videoTrackForConnectionQualityTest:null},F.showLocalVideo!==void 0?p._callObjectMode?console.error("showLocalVideo is not available in call object mode"):p._showLocalVideo=!!F.showLocalVideo:p._showLocalVideo=!0,F.showParticipantsBar!==void 0?p._callObjectMode?console.error("showParticipantsBar is not available in call object mode"):p._showParticipantsBar=!!F.showParticipantsBar:p._showParticipantsBar=!0,F.customIntegrations!==void 0?p._callObjectMode?console.error("customIntegrations is not available in call object mode"):p._customIntegrations=F.customIntegrations:p._customIntegrations={},F.customTrayButtons!==void 0?p._callObjectMode?console.error("customTrayButtons is not available in call object mode"):p._customTrayButtons=F.customTrayButtons:p._customTrayButtons={},F.activeSpeakerMode!==void 0?p._callObjectMode?console.error("activeSpeakerMode is not available in call object mode"):p._activeSpeakerMode=!!F.activeSpeakerMode:p._activeSpeakerMode=!1,F.receiveSettings?p._callObjectMode?p._receiveSettings=F.receiveSettings:console.error("receiveSettings is only available in call object mode"):p._receiveSettings={},p.validateProperties(F),p.properties=Y({},F),p._inputSettings||(p._inputSettings={}),p._callObjectLoader=p._callObjectMode?new F0(p.callClientId):null,p._callState=Df,p._isPreparingToJoin=!1,p._accessState={access:zl},p._meetingSessionSummary={},p._finalSummaryOfPrevSession={},p._meetingSessionState=lc(Ep,p._callObjectMode),p._nativeInCallAudioMode=Cp,p._participants={},p._isScreenSharing=!1,p._participantCounts=Tp,p._rmpPlayerState={},p._waitingParticipants={},p._network={threshold:"good",quality:100,networkState:"unknown",stats:{}},p._activeSpeaker={},p._localAudioLevel=0,p._isLocalAudioLevelObserverRunning=!1,p._remoteParticipantsAudioLevel={},p._isRemoteParticipantsAudioLevelObserverRunning=!1,p._maxAppMessageSize=Hl,p._messageChannel=pe()?new N0:new R0,p._iframe&&(p._iframe.requestFullscreen?p._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===p._iframe?(p.emitDailyJSEvent({action:bs}),p.sendMessageToCallMachine({action:bs})):(p.emitDailyJSEvent({action:ws}),p.sendMessageToCallMachine({action:ws}))}):p._iframe.webkitRequestFullscreen&&p._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===p._iframe?(p.emitDailyJSEvent({action:bs}),p.sendMessageToCallMachine({action:bs})):(p.emitDailyJSEvent({action:ws}),p.sendMessageToCallMachine({action:ws}))})),pe()){var W=p.nativeUtils();W.addAudioFocusChangeListener&&W.removeAudioFocusChangeListener&&W.addAppStateChangeListener&&W.removeAppStateChangeListener&&W.addSystemScreenCaptureStopListener&&W.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),p._hasNativeAudioFocus=!0,W.addAudioFocusChangeListener(p.handleNativeAudioFocusChange),W.addAppStateChangeListener(p.handleNativeAppStateChange),W.addSystemScreenCaptureStopListener(p.handleNativeSystemScreenCaptureStop)}return p._callObjectMode&&p.startListeningForDeviceChanges(),p._messageChannel.addListenerForMessagesFromCallMachine(p.handleMessageFromCallMachine,p.callClientId,p),p}return Go(t,Yo),bt(t,[{key:"destroy",value:(we=ne(function*(){var u;try{yield this.leave()}catch{}var b=this._iframe;if(b){var p=b.parentElement;p&&p.removeChild(b)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),pe()){var x=this.nativeUtils();x.removeAudioFocusChangeListener(this.handleNativeAudioFocusChange),x.removeAppStateChangeListener(this.handleNativeAppStateChange),x.removeSystemScreenCaptureStopListener(this.handleNativeSystemScreenCaptureStop)}this._callObjectMode&&this.stopListeningForDeviceChanges(),this.resetMeetingDependentVars(),this._destroyed=!0,this.emitDailyJSEvent({action:"call-instance-destroyed"}),delete xr[this.callClientId],!((u=window)===null||u===void 0||(u=u._daily)===null||u===void 0)&&u.instances&&delete window._daily.instances[this.callClientId],this.strictMode&&(this.callClientId=void 0)}),function(){return we.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(u){var b=u.bodyClass,p=u.cssFile,x=u.cssText;return ge(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl(p),bodyClass:b,cssText:x}),this}},{key:"iframe",value:function(){return ge(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return Kt(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return Kt(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(u,b){for(var p in b){if(!Ts[p])throw new Error("unrecognized updateParticipant property ".concat(p));if(Ts[p].validate&&!Ts[p].validate(b[p],this,this._participants[u]))throw new Error(Ts[p].help)}}},{key:"updateParticipant",value:function(u,b){return this._participants.local&&this._participants.local.session_id===u&&(u="local"),u&&b&&(this.validateParticipantProperties(u,b),this.sendMessageToCallMachine({action:"update-participant",id:u,properties:b})),this}},{key:"updateParticipants",value:function(u){var b=this._participants.local&&this._participants.local.session_id;for(var p in u)p===b&&(p="local"),p&&u[p]&&this.validateParticipantProperties(p,u[p]);return this.sendMessageToCallMachine({action:"update-participants",participants:u}),this}},{key:"updateWaitingParticipant",value:(le=ne(function*(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Kt(this._callObjectMode,"updateWaitingParticipant()"),Ce(this._callState,"updateWaitingParticipant()"),typeof b!="string"||me(p)!=="object")throw new Error("updateWaitingParticipant() must take an id string and a updates object");return new Promise(function(x,_){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participant",id:b,updates:p},function(D){D.error&&_(D.error),D.id||_(new Error("unknown error in updateWaitingParticipant()")),x({id:D.id})})})}),function(){return le.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(z=ne(function*(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Kt(this._callObjectMode,"updateWaitingParticipants()"),Ce(this._callState,"updateWaitingParticipants()"),me(b)!=="object")throw new Error("updateWaitingParticipants() must take a mapping between ids and update objects");return new Promise(function(p,x){u.sendMessageToCallMachine({action:"daily-method-update-waiting-participants",updatesById:b},function(_){_.error&&x(_.error),_.ids||x(new Error("unknown error in updateWaitingParticipants()")),p({ids:_.ids})})})}),function(){return z.apply(this,arguments)})},{key:"requestAccess",value:(q=ne(function*(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=b.access,x=p===void 0?{level:Ow}:p,_=b.name,D=_===void 0?"":_;return Kt(this._callObjectMode,"requestAccess()"),Ce(this._callState,"requestAccess()"),new Promise(function(I,F){u.sendMessageToCallMachine({action:"daily-method-request-access",access:x,name:D},function(W){W.error&&F(W.error),W.access||F(new Error("unknown error in requestAccess()")),I({access:W.access,granted:W.granted})})})}),function(){return q.apply(this,arguments)})},{key:"localAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.audio.state):null}},{key:"localVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.video.state):null}},{key:"setLocalAudio",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return"forceDiscardTrack"in b&&(pe()?(console.warn("forceDiscardTrack option not supported in React Native; ignoring"),b={}):u&&(console.warn("forceDiscardTrack option only supported when calling setLocalAudio(false); ignoring"),b={})),this.sendMessageToCallMachine({action:"local-audio",state:u,options:b}),this}},{key:"localScreenAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenAudio.state):null}},{key:"localScreenVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenVideo.state):null}},{key:"updateScreenShare",value:function(u){if(this._isScreenSharing)return this.sendMessageToCallMachine({action:"local-screen-update",options:u}),this;console.warn("There is no screen share in progress. Try calling startScreenShare first.")}},{key:"setLocalVideo",value:function(u){return this.sendMessageToCallMachine({action:"local-video",state:u}),this}},{key:"_setAllowLocalAudio",value:function(u){if(this._preloadCache.allowLocalAudio=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-audio",state:u}),this}},{key:"_setAllowLocalVideo",value:function(u){if(this._preloadCache.allowLocalVideo=u,this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-allow-local-video",state:u}),this}},{key:"getReceiveSettings",value:(B=ne(function*(u){var b=this,p=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,x=p!==void 0&&p;if(Kt(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(me(u)){case"string":return new Promise(function(_){b.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:u,showInheritedValues:x},function(D){_(D.receiveSettings)})});case"undefined":return this._receiveSettings;default:throw new Error('first argument to getReceiveSettings() must be a participant id (or "base"), or there should be no arguments')}}),function(u){return B.apply(this,arguments)})},{key:"updateReceiveSettings",value:(X=ne(function*(u){var b=this;if(Kt(this._callObjectMode,"updateReceiveSettings()"),!Pp(u,{allowAllParticipantsKey:!0}))throw new Error($p({allowAllParticipantsKey:!0}));return Ce(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function(p){b.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:u},function(x){p({receiveSettings:x.receiveSettings})})})}),function(u){return X.apply(this,arguments)})},{key:"_prepInputSettingsForSharing",value:function(u,b){if(u){var p={};if(u.audio){var x,_,D;u.audio.settings&&(!Object.keys(u.audio.settings).length&&b||(p.audio={settings:Y({},u.audio.settings)})),b&&(x=p.audio)!==null&&x!==void 0&&(x=x.settings)!==null&&x!==void 0&&x.customTrack&&(p.audio.settings={customTrack:this._sharedTracks.audioTrack});var I=((_=u.audio.processor)===null||_===void 0?void 0:_.type)==="none"&&((D=u.audio.processor)===null||D===void 0?void 0:D._isDefaultWhenNone);if(u.audio.processor&&!I){var F=Y({},u.audio.processor);delete F._isDefaultWhenNone,p.audio=Y(Y({},p.audio),{},{processor:F})}}if(u.video){var W,re,he;u.video.settings&&(!Object.keys(u.video.settings).length&&b||(p.video={settings:Y({},u.video.settings)})),b&&(W=p.video)!==null&&W!==void 0&&(W=W.settings)!==null&&W!==void 0&&W.customTrack&&(p.video.settings={customTrack:this._sharedTracks.videoTrack});var dt=((re=u.video.processor)===null||re===void 0?void 0:re.type)==="none"&&((he=u.video.processor)===null||he===void 0?void 0:he._isDefaultWhenNone);if(u.video.processor&&!dt){var hn=Y({},u.video.processor);delete hn._isDefaultWhenNone,p.video=Y(Y({},p.video),{},{processor:hn})}}return p}}},{key:"getInputSettings",value:function(){var u=this;return ge(),new Promise(function(b){b(u._getInputSettings())})}},{key:"_getInputSettings",value:function(){var u,b,p,x,_,D,I={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(u=((p=this._inputSettings)===null||p===void 0?void 0:p.video)||I,b=((x=this._inputSettings)===null||x===void 0?void 0:x.audio)||I):(u=((_=this._preloadCache)===null||_===void 0||(_=_.inputSettings)===null||_===void 0?void 0:_.video)||I,b=((D=this._preloadCache)===null||D===void 0||(D=D.inputSettings)===null||D===void 0?void 0:D.audio)||I);var F={audio:b,video:u};return this._prepInputSettingsForSharing(F,!0)}},{key:"_updatePreloadCacheInputSettings",value:function(u,b){var p=this._inputSettings||{},x={};if(u.video){var _,D,I;x.video={},u.video.settings?(x.video.settings={},b||u.video.settings.customTrack||(I=p.video)===null||I===void 0||!I.settings?x.video.settings=u.video.settings:x.video.settings=Y(Y({},p.video.settings),u.video.settings),Object.keys(x.video.settings).length||delete x.video.settings):(_=p.video)!==null&&_!==void 0&&_.settings&&(x.video.settings=p.video.settings),u.video.processor?x.video.processor=u.video.processor:(D=p.video)!==null&&D!==void 0&&D.processor&&(x.video.processor=p.video.processor)}else p.video&&(x.video=p.video);if(u.audio){var F,W,re;x.audio={},u.audio.settings?(x.audio.settings={},b||u.audio.settings.customTrack||(re=p.audio)===null||re===void 0||!re.settings?x.audio.settings=u.audio.settings:x.audio.settings=Y(Y({},p.audio.settings),u.audio.settings),Object.keys(x.audio.settings).length||delete x.audio.settings):(F=p.audio)!==null&&F!==void 0&&F.settings&&(x.audio.settings=p.audio.settings),u.audio.processor?x.audio.processor=u.audio.processor:(W=p.audio)!==null&&W!==void 0&&W.processor&&(x.audio.processor=p.audio.processor)}else p.audio&&(x.audio=p.audio);this._maybeUpdateInputSettings(x)}},{key:"_devicesFromInputSettings",value:function(u){var b,p,x=(u==null||(b=u.video)===null||b===void 0||(b=b.settings)===null||b===void 0?void 0:b.deviceId)||null,_=(u==null||(p=u.audio)===null||p===void 0||(p=p.settings)===null||p===void 0?void 0:p.deviceId)||null,D=this._preloadCache.outputDeviceId||null;return{camera:x?{deviceId:x}:{},mic:_?{deviceId:_}:{},speaker:D?{deviceId:D}:{}}}},{key:"updateInputSettings",value:(V=ne(function*(u){var b=this;return ge(),Ip(u)?u.video||u.audio?(Rp(u,this.properties.dailyConfig,this._sharedTracks),this._callObjectMode&&!this._callMachineInitialized?(this._updatePreloadCacheInputSettings(u,!0),this._getInputSettings()):new Promise(function(p,x){b.sendMessageToCallMachine({action:"update-input-settings",inputSettings:u},function(_){if(_.error)x(_.error);else{if(_.returnPreloadCache)return b._updatePreloadCacheInputSettings(u,!0),void p(b._getInputSettings());b._maybeUpdateInputSettings(_.inputSettings),p(b._prepInputSettingsForSharing(_.inputSettings,!0))}})})):this._getInputSettings():(console.error(ac()),Promise.reject(ac()))}),function(u){return V.apply(this,arguments)})},{key:"setBandwidth",value:function(u){var b=u.kbs,p=u.trackConstraints;if(ge(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:b,trackConstraints:p}),this}},{key:"getDailyLang",value:function(){var u=this;if(ge(),this._callMachineInitialized)return new Promise(function(b){u.sendMessageToCallMachine({action:"get-daily-lang"},function(p){delete p.action,delete p.callbackStamp,b(p)})})}},{key:"setDailyLang",value:function(u){return ge(),this.sendMessageToCallMachine({action:"set-daily-lang",lang:u}),this}},{key:"setProxyUrl",value:function(u){return this.sendMessageToCallMachine({action:"set-proxy-url",proxyUrl:u}),this}},{key:"setIceConfig",value:function(u){return this.sendMessageToCallMachine({action:"set-ice-config",iceConfig:u}),this}},{key:"meetingSessionSummary",value:function(){return[Bn,Un].includes(this._callState)?this._finalSummaryOfPrevSession:this._meetingSessionSummary}},{key:"getMeetingSession",value:(Q=ne(function*(){var u=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),Ce(this._callState,"getMeetingSession()"),new Promise(function(b){u.sendMessageToCallMachine({action:"get-meeting-session"},function(p){delete p.action,delete p.callbackStamp,b(p)})})}),function(){return Q.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return Ce(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";Kt(this._callObjectMode,"setMeetingSessionData()"),Ce(this._callState,"setMeetingSessionData");try{(function(p,x){new $0({data:p,mergeStrategy:x})})(u,b)}catch(p){throw console.error(p),p}try{this.sendMessageToCallMachine({action:"set-session-data",data:u,mergeStrategy:b})}catch(p){throw new Error("Error setting meeting session data: ".concat(p))}}},{key:"setUserName",value:function(u,b){var p=this;return this.properties.userName=u,new Promise(function(x){p.sendMessageToCallMachine({action:"set-user-name",name:u??"",thisMeetingOnly:pe()||!!b&&!!b.thisMeetingOnly},function(_){delete _.action,delete _.callbackStamp,x(_)})})}},{key:"setUserData",value:(ie=ne(function*(u){var b=this;try{Lp(u)}catch(p){throw console.error(p),p}if(this.properties.userData=u,this._callMachineInitialized)return new Promise(function(p){try{b.sendMessageToCallMachine({action:"set-user-data",userData:u},function(x){delete x.action,delete x.callbackStamp,p(x)})}catch(x){throw new Error("Error setting user data: ".concat(x))}})}),function(u){return ie.apply(this,arguments)})},{key:"validateAudioLevelInterval",value:function(u){if(u&&(u<100||typeof u!="number"))throw new Error("The interval must be a number greater than or equal to 100 milliseconds.")}},{key:"startLocalAudioLevelObserver",value:function(u){var b=this;if(typeof AudioWorkletNode>"u"&&!pe())throw new Error("startLocalAudioLevelObserver() is not supported on this browser");if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isLocalAudioLevelObserverRunning=!0,new Promise(function(p,x){b.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:u},function(_){b._isLocalAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.localAudioLevelObserver={enabled:!0,interval:u}}},{key:"isLocalAudioLevelObserverRunning",value:function(){return this._isLocalAudioLevelObserverRunning}},{key:"stopLocalAudioLevelObserver",value:function(){this._preloadCache.localAudioLevelObserver=null,this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-local-audio-level-observer"})}},{key:"startRemoteParticipantsAudioLevelObserver",value:function(u){var b=this;if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isRemoteParticipantsAudioLevelObserverRunning=!0,new Promise(function(p,x){b.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:u},function(_){b._isRemoteParticipantsAudioLevelObserverRunning=!_.error,_.error?x({error:_.error}):p()})});this._preloadCache.remoteParticipantsAudioLevelObserver={enabled:!0,interval:u}}},{key:"isRemoteParticipantsAudioLevelObserverRunning",value:function(){return this._isRemoteParticipantsAudioLevelObserverRunning}},{key:"stopRemoteParticipantsAudioLevelObserver",value:function(){this._preloadCache.remoteParticipantsAudioLevelObserver=null,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this.sendMessageToCallMachine({action:"stop-remote-participants-audio-level-observer"})}},{key:"startCamera",value:(H=ne(function*(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Kt(this._callObjectMode,"startCamera()"),oc(this._callState,this._isPreparingToJoin,"startCamera()","Did you mean to use setLocalAudio() and/or setLocalVideo() instead?"),this.needsLoad())try{yield this.load(b)}catch(p){return Promise.reject(p)}else{if(this._didPreAuth){if(b.url&&b.url!==this.properties.url)return console.error("url in startCamera() is different than the one used in preAuth()"),Promise.reject();if(b.token&&b.token!==this.properties.token)return console.error("token in startCamera() is different than the one used in preAuth()"),Promise.reject()}this.validateProperties(b),this.properties=Y(Y({},this.properties),b)}return new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"start-camera",properties:ei(u.properties,u.callClientId),preloadCache:ei(u._preloadCache,u.callClientId)},function(_){_.error?x(_.error):p({camera:_.camera,mic:_.mic,speaker:_.speaker})})})}),function(){return H.apply(this,arguments)})},{key:"validateCustomTrack",value:function(u,b,p){if(p&&p.length>50)throw new Error("Custom track `trackName` must not be more than 50 characters");if(b&&b!=="music"&&b!=="speech"&&!(b instanceof Object))throw new Error("Custom track `mode` must be either `music` | `speech` | `DailyMicAudioModeSettings` or `undefined`");if(p&&["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo","customVideoDefaults"].includes(p))throw new Error("Custom track `trackName` must not match a track name already used by daily: cam-audio, cam-video, customVideoDefaults, screen-video, screen-audio, rmpAudio, rmpVideo");if(!(u instanceof MediaStreamTrack))throw new Error("Custom tracks provided must be instances of MediaStreamTrack")}},{key:"startCustomTrack",value:function(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{track,mode,trackName,ignoreAudioLevel};return ge(),Ce(this._callState,"startCustomTrack()"),this.validateCustomTrack(b.track,b.mode,b.trackName),new Promise(function(p,x){u._sharedTracks.customTrack=b.track,b.track=wn,u.sendMessageToCallMachine({action:"start-custom-track",properties:b},function(_){_.error?x({error:_.error}):p(_.mediaTag)})})}},{key:"stopCustomTrack",value:function(u){var b=this;return ge(),Ce(this._callState,"stopCustomTrack()"),new Promise(function(p){b.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:u},function(x){p(x.mediaTag)})})}},{key:"setCamera",value:function(u){var b=this;return Wi(),As(this._callMachineInitialized,"setCamera()"),new Promise(function(p){b.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:u},function(x){p({device:x.device})})})}},{key:"setAudioDevice",value:(j=ne(function*(u){return Wi(),this.nativeUtils().setAudioDevice(u),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(u){return j.apply(this,arguments)})},{key:"cycleCamera",value:function(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p){u.sendMessageToCallMachine({action:"cycle-camera",properties:b},function(x){p({device:x.device})})})}},{key:"cycleMic",value:function(){var u=this;return ge(),new Promise(function(b){u.sendMessageToCallMachine({action:"cycle-mic"},function(p){b({device:p.device})})})}},{key:"getCameraFacingMode",value:function(){var u=this;return Wi(),new Promise(function(b){u.sendMessageToCallMachine({action:"get-camera-facing-mode"},function(p){b(p.facingMode)})})}},{key:"setInputDevicesAsync",value:(K=ne(function*(u){var b=this,p=u.audioDeviceId,x=u.videoDeviceId,_=u.audioSource,D=u.videoSource;if(ge(),_!==void 0&&(p=_),D!==void 0&&(x=D),typeof p=="boolean"&&(this._setAllowLocalAudio(p),p=void 0),typeof x=="boolean"&&(this._setAllowLocalVideo(x),x=void 0),!p&&!x)return yield this.getInputDevices();var I={};return p&&(p instanceof MediaStreamTrack?(this._sharedTracks.audioTrack=p,p=wn,I.audio={settings:{customTrack:p}}):(delete this._sharedTracks.audioTrack,I.audio={settings:{deviceId:p}})),x&&(x instanceof MediaStreamTrack?(this._sharedTracks.videoTrack=x,x=wn,I.video={settings:{customTrack:x}}):(delete this._sharedTracks.videoTrack,I.video={settings:{deviceId:x}})),this._callObjectMode&&this.needsLoad()?(this._updatePreloadCacheInputSettings(I,!1),this._devicesFromInputSettings(this._inputSettings)):new Promise(function(F){b.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:p,videoDeviceId:x},function(W){if(delete W.action,delete W.callbackStamp,W.returnPreloadCache)return b._updatePreloadCacheInputSettings(I,!1),void F(b._devicesFromInputSettings(b._inputSettings));F(W)})})}),function(u){return K.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(U=ne(function*(u){var b=this,p=u.outputDeviceId;if(ge(),!p||typeof p!="string")throw new Error("outputDeviceId must be provided and must be a valid device id");return this._preloadCache.outputDeviceId=p,this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(x,_){b.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:p},function(D){if(delete D.action,delete D.callbackStamp,D.error){var I=new Error(D.error.message);return I.type=D.error.type,void _(I)}D.returnPreloadCache?x(b._devicesFromInputSettings(b._inputSettings)):x(D)})})}),function(u){return U.apply(this,arguments)})},{key:"getInputDevices",value:(G=ne(function*(){var u=this;return this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(b){u.sendMessageToCallMachine({action:"get-input-devices"},function(p){p.returnPreloadCache?b(u._devicesFromInputSettings(u._inputSettings)):b({camera:p.camera,mic:p.mic,speaker:p.speaker})})})}),function(){return G.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return Wi(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(u){if(Wi(),[Cp,rS].includes(u)){if(u!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=u,!this.disableReactNativeAutoDeviceManagement("audio")&&Ms(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMode(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",u)}},{key:"preAuth",value:(R=ne(function*(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Kt(this._callObjectMode,"preAuth()"),oc(this._callState,this._isPreparingToJoin,"preAuth()"),this.needsLoad()&&(yield this.load(b)),!b.url)throw new Error("preAuth() requires at least a url to be provided");return this.validateProperties(b),this.properties=Y(Y({},this.properties),b),new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"daily-method-preauth",properties:ei(u.properties,u.callClientId),preloadCache:ei(u._preloadCache,u.callClientId)},function(_){return _.error?x(_.error):_.access?(u._didPreAuth=!0,void p({access:_.access})):x(new Error("unknown error in preAuth()"))})})}),function(){return R.apply(this,arguments)})},{key:"load",value:(A=ne(function*(u){var b=this;if(this.needsLoad()){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");if(u&&(this.validateProperties(u),this.properties=Y(Y({},this.properties),u)),!this._callObjectMode&&!this.properties.url)throw new Error("can't load iframe meeting because url property isn't set");return this._updateCallState(Lf),this.emitDailyJSEvent({action:$w}),this._callObjectMode?new Promise(function(p,x){b._callObjectLoader.cancel();var _=Date.now();b._callObjectLoader.load(b.properties.dailyConfig,function(D){b._bundleLoadTime=D?"no-op":Date.now()-_,b._updateCallState(Pf),D&&b.emitDailyJSEvent({action:Rf}),p()},function(D,I){if(b.emitDailyJSEvent({action:Fw}),!I){b._updateCallState(Un),b.resetMeetingDependentVars();var F={action:Bf,errorMsg:D.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:D,bundleUrl:Zo(b.properties.dailyConfig)}}};b._maybeSendToSentry(F),b.emitDailyJSEvent(F),x(D.msg)}})}):(this._iframe.src=yh(this.assembleMeetingUrl(),this.properties.dailyConfig),new Promise(function(p,x){b._loadedCallback=function(_){b._callState!==Un?(b._updateCallState(Pf),(b.properties.cssFile||b.properties.cssText)&&b.loadCss(b.properties),p()):x(_)}}))}}),function(u){return A.apply(this,arguments)})},{key:"join",value:(L=ne(function*(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._testCallInProgress&&this.stopTestCallQuality(),!b.url&&!this.properties.url){var p="No room URL has been provided";return console.error(p),Promise.reject(new Error(p))}var x=!1;if(this.needsLoad()){this.updateIsPreparingToJoin(!0);try{yield this.load(b)}catch(_){return this.updateIsPreparingToJoin(!1),Promise.reject(_)}}else{if(x=!(!this.properties.cssFile&&!this.properties.cssText),this._didPreAuth){if(b.url&&b.url!==this.properties.url)return console.error("url in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject();if(b.token&&b.token!==this.properties.token)return console.error("token in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject()}if(b.url&&!this._callObjectMode&&b.url&&b.url!==this.properties.url)return console.error("url in join() is different than the one used in load() (".concat(this.properties.url," -> ").concat(b.url,")")),this.updateIsPreparingToJoin(!1),Promise.reject();this.validateProperties(b),this.properties=Y(Y({},this.properties),b)}return b.showLocalVideo!==void 0&&(this._callObjectMode?console.error("showLocalVideo is not available in callObject mode"):this._showLocalVideo=!!b.showLocalVideo),b.showParticipantsBar!==void 0&&(this._callObjectMode?console.error("showParticipantsBar is not available in callObject mode"):this._showParticipantsBar=!!b.showParticipantsBar),this._callState===Sr||this._callState===Ul?(console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1)):(this._updateCallState(Ul,!1),this.emitDailyJSEvent({action:Uw}),this._preloadCache.inputSettings=this._prepInputSettingsForSharing(this._inputSettings||{},!1),this.sendMessageToCallMachine({action:"join-meeting",properties:ei(this.properties,this.callClientId),preloadCache:ei(this._preloadCache,this.callClientId)},function(_){_.error&&u._joinedCallback&&(u._joinedCallback(null,_.error),u._joinedCallback=null)}),new Promise(function(_,D){u._joinedCallback=function(I,F){if(u._callState!==Un){if(F)return u._updateCallState(Bn),void D(F);if(u._updateCallState(Sr),I)for(var W in I){if(u._callObjectMode){var re=u._callMachine().store;up(I[W],re),dp(I[W],re),hp(I[W],u._participants[W],re)}u._participants[W]=Y({},I[W]),u.toggleParticipantAudioBasedOnNativeAudioFocus()}x&&u.loadCss(u.properties),_(I)}else D(F)}}))}),function(){return L.apply(this,arguments)})},{key:"leave",value:(E=ne(function*(){var u=this;return this._testCallInProgress&&this.stopTestCallQuality(),new Promise(function(b){u._callState===Bn||u._callState===Un?b():u._callObjectLoader&&!u._callObjectLoader.loaded?(u._callObjectLoader.cancel(),u._updateCallState(Bn),u.resetMeetingDependentVars(),u.emitDailyJSEvent({action:Bn}),b()):(u._resolveLeave=b,u.sendMessageToCallMachine({action:"leave-meeting"}))})}),function(){return E.apply(this,arguments)})},{key:"startScreenShare",value:(C=ne(function*(){var u=this,b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(As(this._callMachineInitialized,"startScreenShare()"),b.screenVideoSendSettings&&this._validateVideoSendSettings("screenVideo",b.screenVideoSendSettings),b.mediaStream&&(this._sharedTracks.screenMediaStream=b.mediaStream,b.mediaStream=wn),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var p=this.nativeUtils();if(yield p.isScreenBeingCaptured())return void this.emitDailyJSEvent({action:jf,type:"screen-share-error",errorMsg:"Could not start the screen sharing. The screen is already been captured!"});p.setSystemScreenCaptureStartCallback(function(){p.setSystemScreenCaptureStartCallback(null),u.sendMessageToCallMachine({action:zf,captureOptions:b})}),p.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:zf,captureOptions:b})}),function(){return C.apply(this,arguments)})},{key:"stopScreenShare",value:function(){As(this._callMachineInitialized,"stopScreenShare()"),this.sendMessageToCallMachine({action:"local-screen-stop"})}},{key:"startRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},b=u.type;if(b&&b!=="cloud"&&b!=="cloud-audio-only"&&b!=="raw-tracks"&&b!=="local")throw new Error("invalid type: ".concat(b,", allowed values 'cloud', 'cloud-audio-only', 'raw-tracks', or 'local'"));this.sendMessageToCallMachine(Y({action:"local-recording-start"},u))}},{key:"updateRecording",value:function(u){var b=u.layout,p=b===void 0?{preset:"default"}:b,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-recording",layout:p,instanceId:x})}},{key:"stopRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(Y({action:"local-recording-stop"},u))}},{key:"startLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(Y({action:"daily-method-start-live-streaming"},u))}},{key:"updateLiveStreaming",value:function(u){var b=u.layout,p=b===void 0?{preset:"default"}:b,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:p,instanceId:x})}},{key:"addLiveStreamingEndpoints",value:function(u){var b=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Hf,endpointsOp:A0,endpoints:b,instanceId:p})}},{key:"removeLiveStreamingEndpoints",value:function(u){var b=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Hf,endpointsOp:O0,endpoints:b,instanceId:p})}},{key:"stopLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(Y({action:"daily-method-stop-live-streaming"},u))}},{key:"validateDailyConfig",value:function(u){u.camSimulcastEncodings&&(console.warn("camSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide camera simulcast settings."),this.validateSimulcastEncodings(u.camSimulcastEncodings)),u.screenSimulcastEncodings&&console.warn("screenSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide screen simulcast settings."),Qf()&&u.noAutoDefaultDeviceChange&&console.warn("noAutoDefaultDeviceChange is not supported on Android, and will be ignored.")}},{key:"validateSimulcastEncodings",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(u){if(!(u instanceof Array||Array.isArray(u)))throw new Error("encodings must be an Array");if(!Vp(u.length,1,3))throw new Error("encodings must be an Array with between 1 to ".concat(3," layers"));for(var x=0;x<u.length;x++){var _=u[x];for(var D in this._validateEncodingLayerHasValidProperties(_),_)if(rc.includes(D)){if(typeof _[D]!="number")throw new Error("".concat(D," must be a number"));if(b){var I=b[D],F=I.min,W=I.max;if(!Vp(_[D],F,W))throw new Error("".concat(D," value not in range. valid range: ").concat(F," to ").concat(W))}}else if(!["active","scalabilityMode"].includes(D))throw new Error("Invalid key ".concat(D,", valid keys are:")+Object.values(rc));if(p&&!_.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(k=ne(function*(u){var b=this,p=u.url,x=u.settings,_=x===void 0?{state:Kl.PLAY}:x;try{(function(D){if(typeof D!="string")throw new Error('url parameter must be "string" type')})(p),Hp(_),function(D){for(var I in D)if(!Ap.includes(I))throw new Error("Invalid key ".concat(I,", valid keys are: ").concat(Ap));D.simulcastEncodings&&this.validateSimulcastEncodings(D.simulcastEncodings,Mp,!0)}(_)}catch(D){throw console.error("invalid argument Error: ".concat(D)),console.error(`startRemoteMediaPlayer arguments must be of the form:
31
31
  { url: "playback url",
32
32
  settings?:
33
- {state: "play"|"pause", simulcastEncodings?: [{}] } }`),O}return new Promise(function(O,I){y.sendMessageToCallMachine({action:"daily-method-start-remote-media-player",url:p,settings:_},function($){$.error?I({error:$.error,errorMsg:$.errorMsg}):O({session_id:$.session_id,remoteMediaPlayerState:{state:$.state,settings:$.settings}})})})}),function(u){return k.apply(this,arguments)})},{key:"stopRemoteMediaPlayer",value:(w=te(function*(u){var y=this;if(typeof u!="string")throw new Error(" remotePlayerID must be of type string");return new Promise(function(p,x){y.sendMessageToCallMachine({action:"daily-method-stop-remote-media-player",session_id:u},function(_){_.error?x({error:_.error,errorMsg:_.errorMsg}):p()})})}),function(u){return w.apply(this,arguments)})},{key:"updateRemoteMediaPlayer",value:(m=te(function*(u){var y=this,p=u.session_id,x=u.settings;try{zp(x)}catch(_){throw console.error("invalid argument Error: ".concat(_)),console.error(`updateRemoteMediaPlayer arguments must be of the form:
33
+ {state: "play"|"pause", simulcastEncodings?: [{}] } }`),D}return new Promise(function(D,I){b.sendMessageToCallMachine({action:"daily-method-start-remote-media-player",url:p,settings:_},function(F){F.error?I({error:F.error,errorMsg:F.errorMsg}):D({session_id:F.session_id,remoteMediaPlayerState:{state:F.state,settings:F.settings}})})})}),function(u){return k.apply(this,arguments)})},{key:"stopRemoteMediaPlayer",value:(w=ne(function*(u){var b=this;if(typeof u!="string")throw new Error(" remotePlayerID must be of type string");return new Promise(function(p,x){b.sendMessageToCallMachine({action:"daily-method-stop-remote-media-player",session_id:u},function(_){_.error?x({error:_.error,errorMsg:_.errorMsg}):p()})})}),function(u){return w.apply(this,arguments)})},{key:"updateRemoteMediaPlayer",value:(v=ne(function*(u){var b=this,p=u.session_id,x=u.settings;try{Hp(x)}catch(_){throw console.error("invalid argument Error: ".concat(_)),console.error(`updateRemoteMediaPlayer arguments must be of the form:
34
34
  session_id: "participant session",
35
- { settings?: {state: "play"|"pause"} }`),_}return new Promise(function(_,O){y.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:p,settings:x},function(I){I.error?O({error:I.error,errorMsg:I.errorMsg}):_({session_id:I.session_id,remoteMediaPlayerState:{state:I.state,settings:I.settings}})})})}),function(u){return m.apply(this,arguments)})},{key:"startTranscription",value:function(u){Ce(this._callState,"startTranscription()"),this.sendMessageToCallMachine(G({action:"daily-method-start-transcription"},u))}},{key:"updateTranscription",value:function(u){if(Ce(this._callState,"updateTranscription()"),!u)throw new Error("updateTranscription Error: options is mandatory");if(me(u)!=="object")throw new Error("updateTranscription Error: options must be object type");if(u.participants&&!Array.isArray(u.participants))throw new Error("updateTranscription Error: participants must be an array");this.sendMessageToCallMachine(G({action:"daily-method-update-transcription"},u))}},{key:"stopTranscription",value:function(u){if(Ce(this._callState,"stopTranscription()"),u&&me(u)!=="object")throw new Error("stopTranscription Error: options must be object type");if(u&&!u.instanceId)throw new Error('"instanceId" not provided');this.sendMessageToCallMachine(G({action:"daily-method-stop-transcription"},u))}},{key:"startDialOut",value:(S=te(function*(u){var y=this;Ce(this._callState,"startDialOut()");var p=function(I){if(I){if(!Array.isArray(I))throw new Error("Error starting dial out: audio codec must be an array");if(I.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");I.forEach(function($){if(typeof $!="string")throw new Error("Error starting dial out: audio codec must be a string");if($!=="OPUS"&&$!=="PCMU"&&$!=="PCMA"&&$!=="G722")throw new Error("Error starting dial out: audio codec must be one of OPUS, PCMU, PCMA, G722")})}};if(!u.sipUri&&!u.phoneNumber)throw new Error("Error starting dial out: either a sip uri or phone number must be provided");if(u.sipUri&&u.phoneNumber)throw new Error("Error starting dial out: only one of sip uri or phone number must be provided");if(u.sipUri){if(typeof u.sipUri!="string")throw new Error("Error starting dial out: sipUri must be a string");if(!u.sipUri.startsWith("sip:"))throw new Error("Error starting dial out: Invalid SIP URI, must start with 'sip:'");if(u.video&&typeof u.video!="boolean")throw new Error("Error starting dial out: video must be a boolean value");(function(I){if(I&&(p(I.audio),I.video)){if(!Array.isArray(I.video))throw new Error("Error starting dial out: video codec must be an array");if(I.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");I.video.forEach(function($){if(typeof $!="string")throw new Error("Error starting dial out: video codec must be a string");if($!=="H264"&&$!=="VP8")throw new Error("Error starting dial out: video codec must be H264 or VP8")})}})(u.codecs)}if(u.phoneNumber){if(typeof u.phoneNumber!="string")throw new Error("Error starting dial out: phoneNumber must be a string");if(!/^\+\d{1,}$/.test(u.phoneNumber))throw new Error("Error starting dial out: Invalid phone number, must be valid phone number as per E.164");u.codecs&&p(u.codecs.audio)}if(u.callerId){if(typeof u.callerId!="string")throw new Error("Error starting dial out: callerId must be a string");if(u.sipUri)throw new Error("Error starting dial out: callerId not allowed with sipUri")}if(u.displayName){if(typeof u.displayName!="string")throw new Error("Error starting dial out: displayName must be a string");if(u.displayName.length>=200)throw new Error("Error starting dial out: displayName length must be less than 200")}if(u.userId){if(typeof u.userId!="string")throw new Error("Error starting dial out: userId must be a string");if(u.userId.length>36)throw new Error("Error starting dial out: userId length must be less than or equal to 36")}if(Op(u),u.permissions&&u.permissions.canReceive){var x=Ye(bp.validateJSONObject(u.permissions.canReceive),2),_=x[0],O=x[1];if(!_)throw new Error(O)}if(u.provider){if(u.provider!=="daily")throw new Error("Error: provider can be set only to 'daily', got: ".concat(u.provider));if(u.phoneNumber)throw new Error("Error starting dial out: provider valid only for sipUri, not phoneNumber");console.warn("(pre-beta) provider=daily is currently in pre-beta, things might break!")}return new Promise(function(I,$){y.sendMessageToCallMachine(G({action:"dialout-start"},u),function(U){U.error?$(U.error):I(U)})})}),function(u){return S.apply(this,arguments)})},{key:"stopDialOut",value:function(u){var y=this;return Ce(this._callState,"stopDialOut()"),new Promise(function(p,x){y.sendMessageToCallMachine(G({action:"dialout-stop"},u),function(_){_.error?x(_.error):p(_)})})}},{key:"sipCallTransfer",value:(g=te(function*(u){var y=this;if(Ce(this._callState,"sipCallTransfer()"),!u)throw new Error("sipCallTransfer() requires a sessionId and toEndPoint");return u.useSipRefer=!1,Up(u,"sipCallTransfer"),Op(u),new Promise(function(p,x){y.sendMessageToCallMachine(G({action:Vf},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return g.apply(this,arguments)})},{key:"sipRefer",value:(b=te(function*(u){var y=this;if(Ce(this._callState,"sipRefer()"),!u)throw new Error("sessionId and toEndPoint are mandatory parameter");return u.useSipRefer=!0,Up(u,"sipRefer"),new Promise(function(p,x){y.sendMessageToCallMachine(G({action:Vf},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return b.apply(this,arguments)})},{key:"sendDTMF",value:(v=te(function*(u){var y=this;return Ce(this._callState,"sendDTMF()"),function(p){var x=p.sessionId,_=p.tones;if(!x||!_)throw new Error("sessionId and tones are mandatory parameter");if(typeof x!="string"||typeof _!="string")throw new Error("sessionId and tones should be of string type");if(_.length>20)throw new Error("tones string must be upto 20 characters");var O=/[^0-9A-D*#]/g,I=_.match(O);if(I&&I[0])throw new Error("".concat(I[0]," is not valid DTMF tone"))}(u),new Promise(function(p,x){y.sendMessageToCallMachine(G({action:"send-dtmf"},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return v.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var u=this;return this._callState!==Sr?Promise.resolve(G({stats:{latest:{}}},this._network)):new Promise(function(y){u.sendMessageToCallMachine({action:"get-calc-stats"},function(p){y(G(G({},u._network),{},{stats:p.stats}))})})}},{key:"testWebsocketConnectivity",value:(f=te(function*(){var u=this;if(sc(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(y){return Promise.reject(y)}return new Promise(function(y,p){u.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(x){x.error?p(x.error):y(x.results)})})}),function(){return f.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(u){return u?u instanceof MediaStreamTrack?!!X0(u)||(console.error("Video track is not playable. This test needs a live video track."),!1):(console.error("Video track needs to be of type `MediaStreamTrack`."),!1):(console.error("Missing video track. You must provide a video track in order to run this test."),!1)}},{key:"testCallQuality",value:(h=te(function*(){var u=this;ge(),Vt(this._callObjectMode,"testCallQuality()"),As(this._callMachineInitialized,"testCallQuality()",null,!0),oc(this._callState,this._isPreparingToJoin,"testCallQuality()");var y=this._testCallAlreadyInProgress,p=function(_){y||(u._testCallInProgress=_)};if(p(!0),this.needsLoad())try{var x=this._callState;yield this.load(),this._callState=x}catch(_){return p(!1),Promise.reject(_)}return new Promise(function(_){u.sendMessageToCallMachine({action:"test-call-quality",dailyJsVersion:u.properties.dailyJsVersion},function(O){var I=O.results,$=I.result,U=sh(I,tS);if($==="failed"){var ne,he=G({},U);(ne=U.error)!==null&&ne!==void 0&&ne.details?(U.error.details=JSON.parse(U.error.details),he.error=G(G({},he.error),{},{details:G({},he.error.details)}),he.error.details.duringTest="testCallQuality"):(he.error=he.error?G({},he.error):{},he.error.details={duringTest:"testCallQuality"}),u._maybeSendToSentry(he)}p(!1),_(G({result:$},U))})})}),function(){return h.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(d=te(function*(u){var y;pe()?(console.warn("testConnectionQuality() is deprecated: use testPeerToPeerCallQuality() instead"),y=yield this.testPeerToPeerCallQuality(u)):(console.warn("testConnectionQuality() is deprecated: use testCallQuality() instead"),y=yield this.testCallQuality());var p={result:y.result,secondsElapsed:y.secondsElapsed};return y.data&&(p.data={maxRTT:y.data.maxRoundTripTime,packetLoss:y.data.avgRecvPacketLoss}),p}),function(u){return d.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(c=te(function*(u){var y=this;if(sc(this._testCallInProgress,"testPeerToPeerCallQuality()"),this.needsLoad())try{yield this.load()}catch(_){return Promise.reject(_)}var p=u.videoTrack,x=u.duration;if(!this._validateVideoTrackForNetworkTests(p))throw new Error("Video track error");return this._sharedTracks.videoTrackForConnectionQualityTest=p,new Promise(function(_,O){y.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:x},function(I){I.error?O(I.error):_(I.results)})})}),function(u){return c.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){pe()?(console.warn("stopTestConnectionQuality() is deprecated: use testPeerToPeerCallQuality() and stopTestPeerToPeerCallQuality() instead"),this.stopTestPeerToPeerCallQuality()):(console.warn("stopTestConnectionQuality() is deprecated: use testCallQuality() and stopTestCallQuality() instead"),this.stopTestCallQuality())}},{key:"stopTestPeerToPeerCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-p2p-call-quality"})}},{key:"testNetworkConnectivity",value:(l=te(function*(u){var y=this;if(sc(this._testCallInProgress,"testNetworkConnectivity()"),this.needsLoad())try{yield this.load()}catch(p){return Promise.reject(p)}if(!this._validateVideoTrackForNetworkTests(u))throw new Error("Video track error");return this._sharedTracks.videoTrackForNetworkConnectivityTest=u,new Promise(function(p,x){y.sendMessageToCallMachine({action:"test-network-connectivity"},function(_){_.error?x(_.error):p(_.results)})})}),function(u){return l.apply(this,arguments)})},{key:"abortTestNetworkConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-network-connectivity"})}},{key:"getCpuLoadStats",value:function(){var u=this;return new Promise(function(y){u._callState===Sr?u.sendMessageToCallMachine({action:"get-cpu-load-stats"},function(p){y(p.cpuStats)}):y({cpuLoadState:void 0,cpuLoadStateReason:void 0,stats:{}})})}},{key:"_validateEncodingLayerHasValidProperties",value:function(u){var y;if(!(((y=Object.keys(u))===null||y===void 0?void 0:y.length)>0))throw new Error("Empty encoding is not allowed. At least one of these valid keys should be specified:"+Object.values(rc))}},{key:"_validateVideoSendSettings",value:function(u,y){var p=u==="screenVideo"?["default-screen-video","detail-optimized","motion-optimized","motion-and-detail-balanced"]:["default-video","bandwidth-optimized","bandwidth-and-quality-balanced","quality-optimized","adaptive-2-layers","adaptive-3-layers"],x="Video send settings should be either an object or one of the supported presets: ".concat(p.join());if(typeof y=="string"){if(!p.includes(y))throw new Error(x)}else{if(me(y)!=="object")throw new Error(x);if(!y.maxQuality&&!y.encodings&&y.allowAdaptiveLayers===void 0)throw new Error("Video send settings must contain at least maxQuality, allowAdaptiveLayers or encodings attribute");if(y.maxQuality&&["low","medium","high"].indexOf(y.maxQuality)===-1)throw new Error("maxQuality must be either low, medium or high");if(y.encodings){var _=!1;switch(Object.keys(y.encodings).length){case 1:_=!y.encodings.low;break;case 2:_=!y.encodings.low||!y.encodings.medium;break;case 3:_=!y.encodings.low||!y.encodings.medium||!y.encodings.high;break;default:_=!0}if(_)throw new Error("Encodings must be defined as: low, low and medium, or low, medium and high.");y.encodings.low&&this._validateEncodingLayerHasValidProperties(y.encodings.low),y.encodings.medium&&this._validateEncodingLayerHasValidProperties(y.encodings.medium),y.encodings.high&&this._validateEncodingLayerHasValidProperties(y.encodings.high)}}}},{key:"validateUpdateSendSettings",value:function(u){var y=this;if(!u||Object.keys(u).length===0)throw new Error("Send settings must contain at least information for one track!");Object.entries(u).forEach(function(p){var x=Ye(p,2),_=x[0],O=x[1];y._validateVideoSendSettings(_,O)})}},{key:"updateSendSettings",value:function(u){var y=this;return this.validateUpdateSendSettings(u),this.needsLoad()?(this._preloadCache.sendSettings=u,{sendSettings:this._preloadCache.sendSettings}):new Promise(function(p,x){y.sendMessageToCallMachine({action:"update-send-settings",sendSettings:u},function(_){_.error?x(_.error):p(_.sendSettings)})})}},{key:"getSendSettings",value:function(){return this._sendSettings||this._preloadCache.sendSettings}},{key:"getLocalAudioLevel",value:function(){return this._localAudioLevel}},{key:"getRemoteParticipantsAudioLevel",value:function(){return this._remoteParticipantsAudioLevel}},{key:"getActiveSpeaker",value:function(){return ge(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(u){return ge(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:u}),this}},{key:"activeSpeakerMode",value:function(){return ge(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(u){return Ce(this._callState,"setSubscribeToTracksAutomatically()","Use the subscribeToTracksAutomatically configuration property."),this._preloadCache.subscribeToTracksAutomatically=u,this.sendMessageToCallMachine({action:"daily-method-subscribe-to-tracks-automatically",enabled:u}),this}},{key:"enumerateDevices",value:(a=te(function*(){var u=this;if(this._callObjectMode){var y=yield navigator.mediaDevices.enumerateDevices();return kr()==="Firefox"&&xs().major>115&&xs().major<123&&(y=y.filter(function(p){return p.kind!=="audiooutput"})),{devices:y.map(function(p){var x=JSON.parse(JSON.stringify(p));if(!pe()&&p.kind==="videoinput"&&p.getCapabilities){var _,O=p.getCapabilities();x.facing=(O==null||(_=O.facingMode)===null||_===void 0?void 0:_.length)>=1?O.facingMode[0]:void 0}return x})}}return new Promise(function(p){u.sendMessageToCallMachine({action:"enumerate-devices"},function(x){p({devices:x.devices})})})}),function(){return a.apply(this,arguments)})},{key:"sendAppMessage",value:function(u){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"*";if(Ce(this._callState,"sendAppMessage()"),JSON.stringify(u).length>this._maxAppMessageSize)throw new Error("Message data too large. Max size is "+this._maxAppMessageSize);return this.sendMessageToCallMachine({action:"app-msg",data:u,to:y}),this}},{key:"addFakeParticipant",value:function(u){return ge(),Ce(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(G({action:"add-fake-participant"},u)),this}},{key:"setShowNamesMode",value:function(u){return St(this._callObjectMode,"setShowNamesMode()"),ge(),u&&u!=="always"&&u!=="never"?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this.sendMessageToCallMachine({action:"set-show-names",mode:u}),this)}},{key:"setShowLocalVideo",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return St(this._callObjectMode,"setShowLocalVideo()"),ge(),Ce(this._callState,"setShowLocalVideo()"),typeof u!="boolean"?(console.error("setShowLocalVideo only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-local-video",show:u}),this._showLocalVideo=u,this)}},{key:"showLocalVideo",value:function(){return St(this._callObjectMode,"showLocalVideo()"),ge(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return St(this._callObjectMode,"setShowParticipantsBar()"),ge(),Ce(this._callState,"setShowParticipantsBar()"),typeof u!="boolean"?(console.error("setShowParticipantsBar only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-participants-bar",show:u}),this._showParticipantsBar=u,this)}},{key:"showParticipantsBar",value:function(){return St(this._callObjectMode,"showParticipantsBar()"),ge(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return ge(),St(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(u){return ge(),St(this._callObjectMode,"setCustomIntegrations()"),Ce(this._callState,"setCustomIntegrations()"),jp(u)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:u}),this._customIntegrations=u,this):this}},{key:"startCustomIntegrations",value:function(u){var y=this;if(ge(),St(this._callObjectMode,"startCustomIntegrations()"),Ce(this._callState,"startCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("startCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in y._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"start-custom-integrations",ids:p}),this)}},{key:"stopCustomIntegrations",value:function(u){var y=this;if(ge(),St(this._callObjectMode,"stopCustomIntegrations()"),Ce(this._callState,"stopCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("stopCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in y._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"stop-custom-integrations",ids:p}),this)}},{key:"customTrayButtons",value:function(){return St(this._callObjectMode,"customTrayButtons()"),ge(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(u){return St(this._callObjectMode,"updateCustomTrayButtons()"),ge(),Ce(this._callState,"updateCustomTrayButtons()"),Fp(u)?(this.sendMessageToCallMachine({action:"update-custom-tray-buttons",btns:u}),this._customTrayButtons=u,this):(console.error("updateCustomTrayButtons only accepts a dictionary of the type ".concat(JSON.stringify(Es))),this)}},{key:"theme",value:function(){return St(this._callObjectMode,"theme()"),this.properties.theme}},{key:"setTheme",value:function(u){var y=this;return St(this._callObjectMode,"setTheme()"),new Promise(function(p,x){try{y.validateProperties({theme:u}),y.properties.theme=G({},u),y.sendMessageToCallMachine({action:"set-theme",theme:y.properties.theme});try{y.emitDailyJSEvent({action:Nw,theme:y.properties.theme})}catch(_){console.log("could not emit 'theme-updated'",_)}p(y.properties.theme)}catch(_){x(_)}})}},{key:"requestFullscreen",value:(s=te(function*(){if(ge(),this._iframe&&!document.fullscreenElement&&Wf())try{(yield this._iframe.requestFullscreen)?this._iframe.requestFullscreen():this._iframe.webkitRequestFullscreen()}catch(u){console.log("could not make video call fullscreen",u)}}),function(){return s.apply(this,arguments)})},{key:"exitFullscreen",value:function(){ge(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(o=te(function*(){var u=this;return this._callObjectMode?(console.error("getSidebarView is not available in callObject mode"),Promise.resolve(null)):new Promise(function(y){u.sendMessageToCallMachine({action:"get-sidebar-view"},function(p){y(p.view)})})}),function(){return o.apply(this,arguments)})},{key:"setSidebarView",value:function(u){return this._callObjectMode?(console.error("setSidebarView is not available in callObject mode"),this):(this.sendMessageToCallMachine({action:"set-sidebar-view",view:u}),this)}},{key:"room",value:(i=te(function*(){var u=this,y=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,p=y===void 0||y;return this._accessState.access===zl||this.needsLoad()?this.properties.url?{roomUrlPendingJoin:this.properties.url}:null:new Promise(function(x){u.sendMessageToCallMachine({action:"lib-room-info",includeRoomConfigDefaults:p},function(_){delete _.action,delete _.callbackStamp,x(_)})})}),function(){return i.apply(this,arguments)})},{key:"geo",value:(r=te(function*(){try{var u=yield fetch("https://gs.daily.co/_ks_/x-swsl/:");return{current:(yield u.json()).geo}}catch(y){return console.error("geo lookup failed",y),{current:""}}}),function(){return r.apply(this,arguments)})},{key:"setNetworkTopology",value:(n=te(function*(u){var y=this;return ge(),Ce(this._callState,"setNetworkTopology()"),new Promise(function(p,x){y.sendMessageToCallMachine({action:"set-network-topology",opts:u},function(_){_.error?x({error:_.error}):p({workerId:_.workerId})})})}),function(u){return n.apply(this,arguments)})},{key:"getNetworkTopology",value:(e=te(function*(){var u=this;return new Promise(function(y,p){u.needsLoad()&&y({topology:"none"}),u.sendMessageToCallMachine({action:"get-network-topology"},function(x){x.error?p({error:x.error}):y({topology:x.topology})})})}),function(){return e.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(u){if(ge(),typeof u!="number"&&u!==!0&&u!==!1)throw new Error("argument to setShouldPlayNewParticipantSound should be true, false, or a number, but is ".concat(u));this.sendMessageToCallMachine({action:"daily-method-set-play-ding",arg:u})}},{key:"on",value:function(u,y){return Yo.prototype.on.call(this,u,y)}},{key:"once",value:function(u,y){return Yo.prototype.once.call(this,u,y)}},{key:"off",value:function(u,y){return Yo.prototype.off.call(this,u,y)}},{key:"validateProperties",value:function(u){var y,p;if(u!=null&&(y=u.dailyConfig)!==null&&y!==void 0&&y.userMediaAudioConstraints){var x,_;pe()||console.warn("userMediaAudioConstraints is deprecated. You can override constraints with inputSettings.audio.settings, found in DailyCallOptions.");var O=u.inputSettings||{};O.audio=((x=u.inputSettings)===null||x===void 0?void 0:x.audio)||{},O.audio.settings=((_=u.inputSettings)===null||_===void 0||(_=_.audio)===null||_===void 0?void 0:_.settings)||{},O.audio.settings=G(G({},O.audio.settings),u.dailyConfig.userMediaAudioConstraints),u.inputSettings=O,delete u.dailyConfig.userMediaAudioConstraints}if(u!=null&&(p=u.dailyConfig)!==null&&p!==void 0&&p.userMediaVideoConstraints){var I,$;pe()||console.warn("userMediaVideoConstraints is deprecated. You can override constraints with inputSettings.video.settings, found in DailyCallOptions.");var U=u.inputSettings||{};U.video=((I=u.inputSettings)===null||I===void 0?void 0:I.video)||{},U.video.settings=(($=u.inputSettings)===null||$===void 0||($=$.video)===null||$===void 0?void 0:$.settings)||{},U.video.settings=G(G({},U.video.settings),u.dailyConfig.userMediaVideoConstraints),u.inputSettings=U,delete u.dailyConfig.userMediaVideoConstraints}for(var ne in u)if(_r[ne]){if(_r[ne].validate&&!_r[ne].validate(u[ne],this))throw new Error("property '".concat(ne,"': ").concat(_r[ne].help))}else console.warn("Ignoring unrecognized property '".concat(ne,"'")),delete u[ne]}},{key:"assembleMeetingUrl",value:function(){var u,y,p=G(G({},this.properties),{},{emb:this.callClientId,embHref:encodeURIComponent(window.location.href),proxy:(u=this.properties.dailyConfig)!==null&&u!==void 0&&u.proxyUrl?encodeURIComponent((y=this.properties.dailyConfig)===null||y===void 0?void 0:y.proxyUrl):void 0}),x=p.url.match(/\?/)?"&":"?";return p.url+x+Object.keys(_r).filter(function(_){return _r[_].queryString&&p[_]!==void 0}).map(function(_){return"".concat(_r[_].queryString,"=").concat(p[_])}).join("&")}},{key:"needsLoad",value:function(){return[Of,Df,Bn,Un].includes(this._callState)}},{key:"sendMessageToCallMachine",value:function(u,y){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");this._messageChannel.sendMessageToCallMachine(u,y,this.callClientId,this._iframe)}},{key:"forwardPackagedMessageToCallMachine",value:function(u){this._messageChannel.forwardPackagedMessageToCallMachine(u,this._iframe,this.callClientId)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(u){return this._messageChannel.addListenerForPackagedMessagesFromCallMachine(u,this.callClientId)}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(u){this._messageChannel.removeListenerForPackagedMessagesFromCallMachine(u)}},{key:"handleMessageFromCallMachine",value:function(u){switch(u.action){case Iw:this.sendMessageToCallMachine(G({action:Rw},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var y={action:Ss,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:Zo(this.properties.dailyConfig)}};this.sendMessageToCallMachine(y),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case If:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emitDailyJSEvent(u);break;case zw:var p,x=G({},u);delete x.internal,this._maxAppMessageSize=((p=u.internal)===null||p===void 0?void 0:p._maxAppMessageSize)||Hl,this._joinedCallback&&(this._joinedCallback(u.participants),this._joinedCallback=null),this.emitDailyJSEvent(x);break;case Vw:case Kw:if(this._callState===Bn)return;if(u.participant&&u.participant.session_id){var _=u.participant.local?"local":u.participant.session_id;if(this._callObjectMode){var O=this._callMachine().store;cp(u.participant,O),up(u.participant,O),dp(u.participant,this._participants[_],O)}try{this.maybeParticipantTracksStopped(this._participants[_],u.participant),this.maybeParticipantTracksStarted(this._participants[_],u.participant),this.maybeEventRecordingStopped(this._participants[_],u.participant),this.maybeEventRecordingStarted(this._participants[_],u.participant)}catch(__){console.error("track events error",__)}this.compareEqualForParticipantUpdateEvent(u.participant,this._participants[_])||(this._participants[_]=G({},u.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus(),this.emitDailyJSEvent(u))}break;case Ww:if(u.participant&&u.participant.session_id){var I=this._participants[u.participant.session_id];I&&this.maybeParticipantTracksStopped(I,null),delete this._participants[u.participant.session_id],this.emitDailyJSEvent(u)}break;case qw:rt(this._participantCounts,u.participantCounts)||(this._participantCounts=u.participantCounts,this.emitDailyJSEvent(u));break;case Jw:var $={access:u.access};u.awaitingAccess&&($.awaitingAccess=u.awaitingAccess),rt(this._accessState,$)||(this._accessState=$,this.emitDailyJSEvent(u));break;case Gw:if(u.meetingSession){this._meetingSessionSummary=u.meetingSession,this.emitDailyJSEvent(u);var U=G(G({},u),{},{action:"meeting-session-updated"});this.emitDailyJSEvent(U)}break;case jf:var ne;this._iframe&&!u.preserveIframe&&(this._iframe.src=""),this._updateCallState(Un),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(u.errorMsg),this._loadedCallback=null),u.preserveIframe;var he=sh(u,nS);he!=null&&(ne=he.error)!==null&&ne!==void 0&&ne.details&&(he.error.details=JSON.parse(he.error.details)),this._maybeSendToSentry(u),this._joinedCallback&&(this._joinedCallback(null,he),this._joinedCallback=null),this.emitDailyJSEvent(he);break;case Hw:this._callState!==Un&&this._updateCallState(Bn),this.resetMeetingDependentVars(),this._resolveLeave&&(this._resolveLeave(),this._resolveLeave=null),this.emitDailyJSEvent(u);break;case"selected-devices-updated":u.devices&&this.emitDailyJSEvent(u);break;case b0:var ut=u.state,dn=u.threshold,hn=u.quality,$e=ut.state,ce=ut.reasons;$e===this._network.networkState&&rt(ce,this._network.networkStateReasons)&&dn===this._network.threshold&&hn===this._network.quality||(this._network.networkState=$e,this._network.networkStateReasons=ce,this._network.quality=hn,this._network.threshold=dn,u.networkState=$e,ce.length&&(u.networkStateReasons=ce),delete u.state,this.emitDailyJSEvent(u));break;case S0:u&&u.cpuLoadState&&this.emitDailyJSEvent(u);break;case k0:u&&u.faceCounts!==void 0&&this.emitDailyJSEvent(u);break;case y0:var Zt=u.activeSpeaker;this._activeSpeaker.peerId!==Zt.peerId&&(this._activeSpeaker.peerId=Zt.peerId,this.emitDailyJSEvent({action:u.action,activeSpeaker:this._activeSpeaker}));break;case"show-local-video-changed":if(this._callObjectMode)return;var Uo=u.show;this._showLocalVideo=Uo,this.emitDailyJSEvent({action:u.action,show:Uo});break;case v0:var Qa=u.enabled;this._activeSpeakerMode!==Qa&&(this._activeSpeakerMode=Qa,this.emitDailyJSEvent({action:u.action,enabled:this._activeSpeakerMode}));break;case Yw:case Xw:case Zw:this._waitingParticipants=u.allWaitingParticipants,this.emitDailyJSEvent({action:u.action,participant:u.participant});break;case M0:rt(this._receiveSettings,u.receiveSettings)||(this._receiveSettings=u.receiveSettings,this.emitDailyJSEvent({action:u.action,receiveSettings:u.receiveSettings}));break;case $f:this._maybeUpdateInputSettings(u.inputSettings);break;case"send-settings-updated":rt(this._sendSettings,u.sendSettings)||(this._sendSettings=u.sendSettings,this._preloadCache.sendSettings=null,this.emitDailyJSEvent({action:u.action,sendSettings:u.sendSettings}));break;case"local-audio-level":this._localAudioLevel=u.audioLevel,this._preloadCache.localAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case"remote-participants-audio-level":this._remoteParticipantsAudioLevel=u.participantsAudioLevel,this._preloadCache.remoteParticipantsAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case d0:var zo=u.session_id;this._rmpPlayerState[zo]=u.playerState,this.emitDailyJSEvent(u);break;case f0:delete this._rmpPlayerState[u.session_id],this.emitDailyJSEvent(u);break;case h0:var Ho=u.session_id,Fv=this._rmpPlayerState[Ho];Fv&&this.compareEqualForRMPUpdateEvent(Fv,u.remoteMediaPlayerState)||(this._rmpPlayerState[Ho]=u.remoteMediaPlayerState,this.emitDailyJSEvent(u));break;case"custom-button-click":case"sidebar-view-changed":case"pip-started":case"pip-stopped":this.emitDailyJSEvent(u);break;case Qw:var x_=this._meetingSessionState.topology!==(u.meetingSessionState&&u.meetingSessionState.topology);this._meetingSessionState=lc(u.meetingSessionState,this._callObjectMode),(this._callObjectMode||x_)&&this.emitDailyJSEvent(u);break;case p0:this._isScreenSharing=!0,this.emitDailyJSEvent(u);break;case g0:case m0:this._isScreenSharing=!1,this.emitDailyJSEvent(u);break;case Rf:case Nf:case o0:case s0:case a0:case n0:case r0:case i0:case jw:case Bw:case c0:case u0:case"test-completed":case w0:case l0:case x0:case _0:case C0:case E0:case Ff:case T0:case"dialin-ready":case"dialin-connected":case"dialin-error":case"dialin-stopped":case"dialin-warning":case"dialout-connected":case"dialout-answered":case"dialout-error":case"dialout-stopped":case"dialout-warning":this.emitDailyJSEvent(u);break;case"request-fullscreen":this.requestFullscreen();break;case"request-exit-fullscreen":this.exitFullscreen()}}},{key:"maybeEventRecordingStopped",value:function(u,y){var p="record";u&&(y.local||y[p]!==!1||u[p]===y[p]||this.emitDailyJSEvent({action:Nf}))}},{key:"maybeEventRecordingStarted",value:function(u,y){var p="record";u&&(y.local||y[p]!==!0||u[p]===y[p]||this.emitDailyJSEvent({action:Rf}))}},{key:"_trackStatePlayable",value:function(u){return!(!u||u.state!==Aw)}},{key:"_trackChanged",value:function(u,y){return(u==null?void 0:u.id)!==(y==null?void 0:y.id)}},{key:"maybeEventTrackStopped",value:function(u,y,p){var x,_,O=(x=y==null?void 0:y.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,$=O==null?void 0:O.track;if($){var U=this._trackStatePlayable(O),ne=this._trackStatePlayable(I),he=this._trackChanged($,I==null?void 0:I.track);U&&(ne&&!he||this.emitDailyJSEvent({action:t0,track:$,participant:p??y,type:u}))}}},{key:"maybeEventTrackStarted",value:function(u,y,p){var x,_,O=(x=y==null?void 0:y.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,$=I==null?void 0:I.track;if($){var U=this._trackStatePlayable(O),ne=this._trackStatePlayable(I),he=this._trackChanged(O==null?void 0:O.track,$);ne&&(U&&!he||this.emitDailyJSEvent({action:e0,track:$,participant:p,type:u}))}}},{key:"maybeParticipantTracksStopped",value:function(u,y){if(u)for(var p in u.tracks)this.maybeEventTrackStopped(p,u,y)}},{key:"maybeParticipantTracksStarted",value:function(u,y){if(y)for(var p in y.tracks)this.maybeEventTrackStarted(p,u,y)}},{key:"compareEqualForRMPUpdateEvent",value:function(u,y){var p,x;return u.state===y.state&&((p=u.settings)===null||p===void 0?void 0:p.volume)===((x=y.settings)===null||x===void 0?void 0:x.volume)}},{key:"emitDailyJSEvent",value:function(u){try{u.callClientId=this.callClientId,this.emit(u.action,u)}catch(y){console.log("could not emit",u,y)}}},{key:"compareEqualForParticipantUpdateEvent",value:function(u,y){return!!rt(u,y)&&(!u.videoTrack||!y.videoTrack||u.videoTrack.id===y.videoTrack.id&&u.videoTrack.muted===y.videoTrack.muted&&u.videoTrack.enabled===y.videoTrack.enabled)&&(!u.audioTrack||!y.audioTrack||u.audioTrack.id===y.audioTrack.id&&u.audioTrack.muted===y.audioTrack.muted&&u.audioTrack.enabled===y.audioTrack.enabled)}},{key:"nativeUtils",value:function(){return pe()?typeof DailyNativeUtils>"u"?(console.warn("in React Native, DailyNativeUtils is expected to be available"),null):DailyNativeUtils:null}},{key:"updateIsPreparingToJoin",value:function(u){this._updateCallState(this._callState,u)}},{key:"_updateCallState",value:function(u){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._isPreparingToJoin;if(u!==this._callState||y!==this._isPreparingToJoin){var p=this._callState,x=this._isPreparingToJoin;this._callState=u,this._isPreparingToJoin=y;var _=this._callState===Sr;this.updateShowAndroidOngoingMeetingNotification(_);var O=Ms(p,x),I=Ms(this._callState,this._isPreparingToJoin);O!==I&&(this.updateKeepDeviceAwake(I),this.updateDeviceAudioMode(I),this.updateNoOpRecordingEnsuringBackgroundContinuity(I))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=Ep,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:zl},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=lc(Cp,this._callObjectMode),this._isScreenSharing=!1,this._receiveSettings={},this._inputSettings=void 0,this._sendSettings={},this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this._maxAppMessageSize=Hl,this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(u){pe()&&this.nativeUtils().setKeepDeviceAwake(u,this.callClientId)}},{key:"updateDeviceAudioMode",value:function(u){if(pe()&&!this.disableReactNativeAutoDeviceManagement("audio")){var y=u?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(y)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(u){if(pe()&&this.nativeUtils().setShowOngoingMeetingNotification){var y,p,x,_;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var O=this.properties.reactNativeConfig.androidInCallNotification;y=O.title,p=O.subtitle,x=O.iconName,_=O.disableForCustomOverride}_&&(u=!1),this.nativeUtils().setShowOngoingMeetingNotification(u,y,p,x,this.callClientId)}}},{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(u){pe()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(u)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var u;if(pe()){var y=(u=this._callMachine())===null||u===void 0||(u=u.store)===null||u===void 0?void 0:u.getState();for(var p in y==null?void 0:y.streams){var x=y.streams[p];x&&x.pendingTrack&&x.pendingTrack.kind==="audio"&&(x.pendingTrack.enabled=this._hasNativeAudioFocus)}}}},{key:"disableReactNativeAutoDeviceManagement",value:function(u){return this.properties.reactNativeConfig&&this.properties.reactNativeConfig.disableAutoDeviceManagement&&this.properties.reactNativeConfig.disableAutoDeviceManagement[u]}},{key:"absoluteUrl",value:function(u){if(u!==void 0){var y=document.createElement("a");return y.href=u,y.href}}},{key:"sayHello",value:function(){var u="hello, world.";return console.log(u),u}},{key:"_logUseAfterDestroy",value:function(){var u=Object.values(xr)[0];if(this.needsLoad())if(u&&!u.needsLoad()){var y={action:Ss,level:"error",code:this.strictMode?9995:9997};u.sendMessageToCallMachine(y)}else this.strictMode||console.error("You are are attempting to use a call instance that was previously destroyed, which is unsupported. Please remove `strictMode: false` from your constructor properties to enable strict mode to track down and fix this unsupported usage.");else{var p={action:Ss,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(p,null,this.callClientId,this._iframe)}}},{key:"_logDuplicateInstanceAttempt",value:function(){for(var u=0,y=Object.values(xr);u<y.length;u++){var p=y[u];p._callMachineInitialized?(p.sendMessageToCallMachine({action:Ss,level:"warn",code:this.allowMultipleCallInstances?9993:9992}),p._delayDuplicateInstanceLog=!1):p._delayDuplicateInstanceLog=!0}}},{key:"_maybeSendToSentry",value:function(u){var y,p,x,_;if(!((y=u.error)!==null&&y!==void 0&&y.type&&(![Lw,Pw,Lf].includes(u.error.type)||u.error.type===Lf&&u.error.msg.includes("deleted")))){var O=(p=this.properties)!==null&&p!==void 0&&p.url?new URL(this.properties.url):void 0,I="production";O&&O.host.includes(".staging.daily")&&(I="staging");var $,U,ne,he,ut,dn=function(zo){const Ho=[Gb(),qb(),Sw(),bw(),Ew(),Mw(),Zb(),Tw()];return zo.autoSessionTracking!==!1&&Ho.push(Cw()),Ho}({}).filter(function(zo){return!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(zo.name)}),hn=new aw({dsn:"https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844",transport:hw,stackParser:vw,integrations:dn,environment:I}),$e=new jn;if($e.setClient(hn),hn.init(),this.session_id&&$e.setExtra("sessionId",this.session_id),this.properties){var ce=G({},this.properties);ce.userName=ce.userName?"[Filtered]":void 0,ce.userData=ce.userData?"[Filtered]":void 0,ce.token=ce.token?"[Filtered]":void 0,$e.setExtra("properties",ce)}if(O){var Zt=O.searchParams.get("domain");if(!Zt){var Uo=O.host.match(/(.*?)\./);Zt=Uo&&Uo[1]||""}Zt&&$e.setTag("domain",Zt)}u.error&&($e.setTag("fatalErrorType",u.error.type),$e.setExtra("errorDetails",u.error.details),!(($=u.error.details)===null||$===void 0)&&$.uri&&$e.setTag("serverAddress",u.error.details.uri),!((U=u.error.details)===null||U===void 0)&&U.workerGroup&&$e.setTag("workerGroup",u.error.details.workerGroup),!((ne=u.error.details)===null||ne===void 0)&&ne.geoGroup&&$e.setTag("geoGroup",u.error.details.geoGroup),!((he=u.error.details)===null||he===void 0)&&he.on&&$e.setTag("connectionAttempt",u.error.details.on),(ut=u.error.details)!==null&&ut!==void 0&&ut.bundleUrl&&($e.setTag("bundleUrl",u.error.details.bundleUrl),$e.setTag("bundleError",u.error.details.sourceError.type))),$e.setTags({callMode:this._callObjectMode?pe()?"reactNative":(x=this.properties)!==null&&x!==void 0&&(x=x.dailyConfig)!==null&&x!==void 0&&(x=x.callMode)!==null&&x!==void 0&&x.includes("prebuilt")?this.properties.dailyConfig.callMode:"custom":"prebuilt-frame",version:t.version()});var Qa=((_=u.error)===null||_===void 0?void 0:_.msg)||u.errorMsg;$e.captureException(new Error(Qa))}}},{key:"_callMachine",value:function(){var u;return(u=window._daily)===null||u===void 0||(u=u.instances)===null||u===void 0||(u=u[this.callClientId])===null||u===void 0?void 0:u.callMachine}},{key:"_maybeUpdateInputSettings",value:function(u){if(!rt(this._inputSettings,u)){var y=this._getInputSettings();this._inputSettings=u;var p=this._getInputSettings();rt(y,p)||this.emitDailyJSEvent({action:$f,inputSettings:p})}}}],[{key:"supportedBrowser",value:function(){if(pe())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var u=gb.getParser(Lt());return{supported:!!Jl(),mobile:u.getPlatformType()==="mobile",name:u.getBrowserName(),version:u.getBrowserVersion(),supportsFullscreen:!!Wf(),supportsScreenShare:!!D0(),supportsSfu:!!Jl(),supportsVideoProcessing:qf(),supportsAudioProcessing:Jf()}}},{key:"version",value:function(){return"0.86.0"}},{key:"createCallObject",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return u.layout="none",new t(null,u)}},{key:"wrap",value:function(u){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ge(),!u||!u.contentWindow||typeof u.src!="string")throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return y.layout||(y.customLayout?y.layout="custom-v1":y.layout="browser"),new t(u,y)}},{key:"createFrame",value:function(u,y){var p,x;ge(),u&&y?(p=u,x=y):u&&u.append?(p=u,x={}):(p=document.body,x=u||{});var _=x.iframeStyle;_||(_=p===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:"375px",height:"450px",right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});var O=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?O.allow="microphone, camera":O.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",O.style.visibility="hidden",p.appendChild(O),O.style.visibility=null,Object.keys(_).forEach(function(I){return O.style[I]=_[I]}),x.layout||(x.customLayout?x.layout="custom-v1":x.layout="browser");try{return new t(O,x)}catch(I){throw p.removeChild(O),I}}},{key:"createTransparentFrame",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ge();var y=document.createElement("iframe");return y.allow="microphone; camera; autoplay",y.style.cssText=`
35
+ { settings?: {state: "play"|"pause"} }`),_}return new Promise(function(_,D){b.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:p,settings:x},function(I){I.error?D({error:I.error,errorMsg:I.errorMsg}):_({session_id:I.session_id,remoteMediaPlayerState:{state:I.state,settings:I.settings}})})})}),function(u){return v.apply(this,arguments)})},{key:"startTranscription",value:function(u){Ce(this._callState,"startTranscription()"),this.sendMessageToCallMachine(Y({action:"daily-method-start-transcription"},u))}},{key:"updateTranscription",value:function(u){if(Ce(this._callState,"updateTranscription()"),!u)throw new Error("updateTranscription Error: options is mandatory");if(me(u)!=="object")throw new Error("updateTranscription Error: options must be object type");if(u.participants&&!Array.isArray(u.participants))throw new Error("updateTranscription Error: participants must be an array");this.sendMessageToCallMachine(Y({action:"daily-method-update-transcription"},u))}},{key:"stopTranscription",value:function(u){if(Ce(this._callState,"stopTranscription()"),u&&me(u)!=="object")throw new Error("stopTranscription Error: options must be object type");if(u&&!u.instanceId)throw new Error('"instanceId" not provided');this.sendMessageToCallMachine(Y({action:"daily-method-stop-transcription"},u))}},{key:"startDialOut",value:(S=ne(function*(u){var b=this;Ce(this._callState,"startDialOut()");var p=function(I){if(I){if(!Array.isArray(I))throw new Error("Error starting dial out: audio codec must be an array");if(I.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");I.forEach(function(F){if(typeof F!="string")throw new Error("Error starting dial out: audio codec must be a string");if(F!=="OPUS"&&F!=="PCMU"&&F!=="PCMA"&&F!=="G722")throw new Error("Error starting dial out: audio codec must be one of OPUS, PCMU, PCMA, G722")})}};if(!u.sipUri&&!u.phoneNumber)throw new Error("Error starting dial out: either a sip uri or phone number must be provided");if(u.sipUri&&u.phoneNumber)throw new Error("Error starting dial out: only one of sip uri or phone number must be provided");if(u.sipUri){if(typeof u.sipUri!="string")throw new Error("Error starting dial out: sipUri must be a string");if(!u.sipUri.startsWith("sip:"))throw new Error("Error starting dial out: Invalid SIP URI, must start with 'sip:'");if(u.video&&typeof u.video!="boolean")throw new Error("Error starting dial out: video must be a boolean value");(function(I){if(I&&(p(I.audio),I.video)){if(!Array.isArray(I.video))throw new Error("Error starting dial out: video codec must be an array");if(I.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");I.video.forEach(function(F){if(typeof F!="string")throw new Error("Error starting dial out: video codec must be a string");if(F!=="H264"&&F!=="VP8")throw new Error("Error starting dial out: video codec must be H264 or VP8")})}})(u.codecs)}if(u.phoneNumber){if(typeof u.phoneNumber!="string")throw new Error("Error starting dial out: phoneNumber must be a string");if(!/^\+\d{1,}$/.test(u.phoneNumber))throw new Error("Error starting dial out: Invalid phone number, must be valid phone number as per E.164");u.codecs&&p(u.codecs.audio)}if(u.callerId){if(typeof u.callerId!="string")throw new Error("Error starting dial out: callerId must be a string");if(u.sipUri)throw new Error("Error starting dial out: callerId not allowed with sipUri")}if(u.displayName){if(typeof u.displayName!="string")throw new Error("Error starting dial out: displayName must be a string");if(u.displayName.length>=200)throw new Error("Error starting dial out: displayName length must be less than 200")}if(u.userId){if(typeof u.userId!="string")throw new Error("Error starting dial out: userId must be a string");if(u.userId.length>36)throw new Error("Error starting dial out: userId length must be less than or equal to 36")}if(Dp(u),u.permissions&&u.permissions.canReceive){var x=Xe(wp.validateJSONObject(u.permissions.canReceive),2),_=x[0],D=x[1];if(!_)throw new Error(D)}if(u.provider){if(u.provider!=="daily")throw new Error("Error: provider can be set only to 'daily', got: ".concat(u.provider));if(u.phoneNumber)throw new Error("Error starting dial out: provider valid only for sipUri, not phoneNumber");console.warn("(pre-beta) provider=daily is currently in pre-beta, things might break!")}return new Promise(function(I,F){b.sendMessageToCallMachine(Y({action:"dialout-start"},u),function(W){W.error?F(W.error):I(W)})})}),function(u){return S.apply(this,arguments)})},{key:"stopDialOut",value:function(u){var b=this;return Ce(this._callState,"stopDialOut()"),new Promise(function(p,x){b.sendMessageToCallMachine(Y({action:"dialout-stop"},u),function(_){_.error?x(_.error):p(_)})})}},{key:"sipCallTransfer",value:(m=ne(function*(u){var b=this;if(Ce(this._callState,"sipCallTransfer()"),!u)throw new Error("sipCallTransfer() requires a sessionId and toEndPoint");return u.useSipRefer=!1,zp(u,"sipCallTransfer"),Dp(u),new Promise(function(p,x){b.sendMessageToCallMachine(Y({action:Kf},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return m.apply(this,arguments)})},{key:"sipRefer",value:(y=ne(function*(u){var b=this;if(Ce(this._callState,"sipRefer()"),!u)throw new Error("sessionId and toEndPoint are mandatory parameter");return u.useSipRefer=!0,zp(u,"sipRefer"),new Promise(function(p,x){b.sendMessageToCallMachine(Y({action:Kf},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return y.apply(this,arguments)})},{key:"sendDTMF",value:(g=ne(function*(u){var b=this;return Ce(this._callState,"sendDTMF()"),function(p){var x=p.sessionId,_=p.tones;if(!x||!_)throw new Error("sessionId and tones are mandatory parameter");if(typeof x!="string"||typeof _!="string")throw new Error("sessionId and tones should be of string type");if(_.length>20)throw new Error("tones string must be upto 20 characters");var D=/[^0-9A-D*#]/g,I=_.match(D);if(I&&I[0])throw new Error("".concat(I[0]," is not valid DTMF tone"))}(u),new Promise(function(p,x){b.sendMessageToCallMachine(Y({action:"send-dtmf"},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return g.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var u=this;return this._callState!==Sr?Promise.resolve(Y({stats:{latest:{}}},this._network)):new Promise(function(b){u.sendMessageToCallMachine({action:"get-calc-stats"},function(p){b(Y(Y({},u._network),{},{stats:p.stats}))})})}},{key:"testWebsocketConnectivity",value:(f=ne(function*(){var u=this;if(sc(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(b){return Promise.reject(b)}return new Promise(function(b,p){u.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(x){x.error?p(x.error):b(x.results)})})}),function(){return f.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(u){return u?u instanceof MediaStreamTrack?!!X0(u)||(console.error("Video track is not playable. This test needs a live video track."),!1):(console.error("Video track needs to be of type `MediaStreamTrack`."),!1):(console.error("Missing video track. You must provide a video track in order to run this test."),!1)}},{key:"testCallQuality",value:(h=ne(function*(){var u=this;ge(),Kt(this._callObjectMode,"testCallQuality()"),As(this._callMachineInitialized,"testCallQuality()",null,!0),oc(this._callState,this._isPreparingToJoin,"testCallQuality()");var b=this._testCallAlreadyInProgress,p=function(_){b||(u._testCallInProgress=_)};if(p(!0),this.needsLoad())try{var x=this._callState;yield this.load(),this._callState=x}catch(_){return p(!1),Promise.reject(_)}return new Promise(function(_){u.sendMessageToCallMachine({action:"test-call-quality",dailyJsVersion:u.properties.dailyJsVersion},function(D){var I=D.results,F=I.result,W=ah(I,tS);if(F==="failed"){var re,he=Y({},W);(re=W.error)!==null&&re!==void 0&&re.details?(W.error.details=JSON.parse(W.error.details),he.error=Y(Y({},he.error),{},{details:Y({},he.error.details)}),he.error.details.duringTest="testCallQuality"):(he.error=he.error?Y({},he.error):{},he.error.details={duringTest:"testCallQuality"}),u._maybeSendToSentry(he)}p(!1),_(Y({result:F},W))})})}),function(){return h.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(d=ne(function*(u){var b;pe()?(console.warn("testConnectionQuality() is deprecated: use testPeerToPeerCallQuality() instead"),b=yield this.testPeerToPeerCallQuality(u)):(console.warn("testConnectionQuality() is deprecated: use testCallQuality() instead"),b=yield this.testCallQuality());var p={result:b.result,secondsElapsed:b.secondsElapsed};return b.data&&(p.data={maxRTT:b.data.maxRoundTripTime,packetLoss:b.data.avgRecvPacketLoss}),p}),function(u){return d.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(c=ne(function*(u){var b=this;if(sc(this._testCallInProgress,"testPeerToPeerCallQuality()"),this.needsLoad())try{yield this.load()}catch(_){return Promise.reject(_)}var p=u.videoTrack,x=u.duration;if(!this._validateVideoTrackForNetworkTests(p))throw new Error("Video track error");return this._sharedTracks.videoTrackForConnectionQualityTest=p,new Promise(function(_,D){b.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:x},function(I){I.error?D(I.error):_(I.results)})})}),function(u){return c.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){pe()?(console.warn("stopTestConnectionQuality() is deprecated: use testPeerToPeerCallQuality() and stopTestPeerToPeerCallQuality() instead"),this.stopTestPeerToPeerCallQuality()):(console.warn("stopTestConnectionQuality() is deprecated: use testCallQuality() and stopTestCallQuality() instead"),this.stopTestCallQuality())}},{key:"stopTestPeerToPeerCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-p2p-call-quality"})}},{key:"testNetworkConnectivity",value:(l=ne(function*(u){var b=this;if(sc(this._testCallInProgress,"testNetworkConnectivity()"),this.needsLoad())try{yield this.load()}catch(p){return Promise.reject(p)}if(!this._validateVideoTrackForNetworkTests(u))throw new Error("Video track error");return this._sharedTracks.videoTrackForNetworkConnectivityTest=u,new Promise(function(p,x){b.sendMessageToCallMachine({action:"test-network-connectivity"},function(_){_.error?x(_.error):p(_.results)})})}),function(u){return l.apply(this,arguments)})},{key:"abortTestNetworkConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-network-connectivity"})}},{key:"getCpuLoadStats",value:function(){var u=this;return new Promise(function(b){u._callState===Sr?u.sendMessageToCallMachine({action:"get-cpu-load-stats"},function(p){b(p.cpuStats)}):b({cpuLoadState:void 0,cpuLoadStateReason:void 0,stats:{}})})}},{key:"_validateEncodingLayerHasValidProperties",value:function(u){var b;if(!(((b=Object.keys(u))===null||b===void 0?void 0:b.length)>0))throw new Error("Empty encoding is not allowed. At least one of these valid keys should be specified:"+Object.values(rc))}},{key:"_validateVideoSendSettings",value:function(u,b){var p=u==="screenVideo"?["default-screen-video","detail-optimized","motion-optimized","motion-and-detail-balanced"]:["default-video","bandwidth-optimized","bandwidth-and-quality-balanced","quality-optimized","adaptive-2-layers","adaptive-3-layers"],x="Video send settings should be either an object or one of the supported presets: ".concat(p.join());if(typeof b=="string"){if(!p.includes(b))throw new Error(x)}else{if(me(b)!=="object")throw new Error(x);if(!b.maxQuality&&!b.encodings&&b.allowAdaptiveLayers===void 0)throw new Error("Video send settings must contain at least maxQuality, allowAdaptiveLayers or encodings attribute");if(b.maxQuality&&["low","medium","high"].indexOf(b.maxQuality)===-1)throw new Error("maxQuality must be either low, medium or high");if(b.encodings){var _=!1;switch(Object.keys(b.encodings).length){case 1:_=!b.encodings.low;break;case 2:_=!b.encodings.low||!b.encodings.medium;break;case 3:_=!b.encodings.low||!b.encodings.medium||!b.encodings.high;break;default:_=!0}if(_)throw new Error("Encodings must be defined as: low, low and medium, or low, medium and high.");b.encodings.low&&this._validateEncodingLayerHasValidProperties(b.encodings.low),b.encodings.medium&&this._validateEncodingLayerHasValidProperties(b.encodings.medium),b.encodings.high&&this._validateEncodingLayerHasValidProperties(b.encodings.high)}}}},{key:"validateUpdateSendSettings",value:function(u){var b=this;if(!u||Object.keys(u).length===0)throw new Error("Send settings must contain at least information for one track!");Object.entries(u).forEach(function(p){var x=Xe(p,2),_=x[0],D=x[1];b._validateVideoSendSettings(_,D)})}},{key:"updateSendSettings",value:function(u){var b=this;return this.validateUpdateSendSettings(u),this.needsLoad()?(this._preloadCache.sendSettings=u,{sendSettings:this._preloadCache.sendSettings}):new Promise(function(p,x){b.sendMessageToCallMachine({action:"update-send-settings",sendSettings:u},function(_){_.error?x(_.error):p(_.sendSettings)})})}},{key:"getSendSettings",value:function(){return this._sendSettings||this._preloadCache.sendSettings}},{key:"getLocalAudioLevel",value:function(){return this._localAudioLevel}},{key:"getRemoteParticipantsAudioLevel",value:function(){return this._remoteParticipantsAudioLevel}},{key:"getActiveSpeaker",value:function(){return ge(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(u){return ge(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:u}),this}},{key:"activeSpeakerMode",value:function(){return ge(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(u){return Ce(this._callState,"setSubscribeToTracksAutomatically()","Use the subscribeToTracksAutomatically configuration property."),this._preloadCache.subscribeToTracksAutomatically=u,this.sendMessageToCallMachine({action:"daily-method-subscribe-to-tracks-automatically",enabled:u}),this}},{key:"enumerateDevices",value:(a=ne(function*(){var u=this;if(this._callObjectMode){var b=yield navigator.mediaDevices.enumerateDevices();return kr()==="Firefox"&&xs().major>115&&xs().major<123&&(b=b.filter(function(p){return p.kind!=="audiooutput"})),{devices:b.map(function(p){var x=JSON.parse(JSON.stringify(p));if(!pe()&&p.kind==="videoinput"&&p.getCapabilities){var _,D=p.getCapabilities();x.facing=(D==null||(_=D.facingMode)===null||_===void 0?void 0:_.length)>=1?D.facingMode[0]:void 0}return x})}}return new Promise(function(p){u.sendMessageToCallMachine({action:"enumerate-devices"},function(x){p({devices:x.devices})})})}),function(){return a.apply(this,arguments)})},{key:"sendAppMessage",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"*";if(Ce(this._callState,"sendAppMessage()"),JSON.stringify(u).length>this._maxAppMessageSize)throw new Error("Message data too large. Max size is "+this._maxAppMessageSize);return this.sendMessageToCallMachine({action:"app-msg",data:u,to:b}),this}},{key:"addFakeParticipant",value:function(u){return ge(),Ce(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(Y({action:"add-fake-participant"},u)),this}},{key:"setShowNamesMode",value:function(u){return St(this._callObjectMode,"setShowNamesMode()"),ge(),u&&u!=="always"&&u!=="never"?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this.sendMessageToCallMachine({action:"set-show-names",mode:u}),this)}},{key:"setShowLocalVideo",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return St(this._callObjectMode,"setShowLocalVideo()"),ge(),Ce(this._callState,"setShowLocalVideo()"),typeof u!="boolean"?(console.error("setShowLocalVideo only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-local-video",show:u}),this._showLocalVideo=u,this)}},{key:"showLocalVideo",value:function(){return St(this._callObjectMode,"showLocalVideo()"),ge(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return St(this._callObjectMode,"setShowParticipantsBar()"),ge(),Ce(this._callState,"setShowParticipantsBar()"),typeof u!="boolean"?(console.error("setShowParticipantsBar only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-participants-bar",show:u}),this._showParticipantsBar=u,this)}},{key:"showParticipantsBar",value:function(){return St(this._callObjectMode,"showParticipantsBar()"),ge(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return ge(),St(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(u){return ge(),St(this._callObjectMode,"setCustomIntegrations()"),Ce(this._callState,"setCustomIntegrations()"),Bp(u)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:u}),this._customIntegrations=u,this):this}},{key:"startCustomIntegrations",value:function(u){var b=this;if(ge(),St(this._callObjectMode,"startCustomIntegrations()"),Ce(this._callState,"startCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("startCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in b._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"start-custom-integrations",ids:p}),this)}},{key:"stopCustomIntegrations",value:function(u){var b=this;if(ge(),St(this._callObjectMode,"stopCustomIntegrations()"),Ce(this._callState,"stopCustomIntegrations()"),Array.isArray(u)&&u.some(function(_){return typeof _!="string"})||!Array.isArray(u)&&typeof u!="string")return console.error("stopCustomIntegrations() only accepts string | string[]"),this;var p=typeof u=="string"?[u]:u,x=p.filter(function(_){return!(_ in b._customIntegrations)});return x.length?(console.error(`Can't find custom integration(s): "`.concat(x.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"stop-custom-integrations",ids:p}),this)}},{key:"customTrayButtons",value:function(){return St(this._callObjectMode,"customTrayButtons()"),ge(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(u){return St(this._callObjectMode,"updateCustomTrayButtons()"),ge(),Ce(this._callState,"updateCustomTrayButtons()"),jp(u)?(this.sendMessageToCallMachine({action:"update-custom-tray-buttons",btns:u}),this._customTrayButtons=u,this):(console.error("updateCustomTrayButtons only accepts a dictionary of the type ".concat(JSON.stringify(Es))),this)}},{key:"theme",value:function(){return St(this._callObjectMode,"theme()"),this.properties.theme}},{key:"setTheme",value:function(u){var b=this;return St(this._callObjectMode,"setTheme()"),new Promise(function(p,x){try{b.validateProperties({theme:u}),b.properties.theme=Y({},u),b.sendMessageToCallMachine({action:"set-theme",theme:b.properties.theme});try{b.emitDailyJSEvent({action:Nw,theme:b.properties.theme})}catch(_){console.log("could not emit 'theme-updated'",_)}p(b.properties.theme)}catch(_){x(_)}})}},{key:"requestFullscreen",value:(s=ne(function*(){if(ge(),this._iframe&&!document.fullscreenElement&&qf())try{(yield this._iframe.requestFullscreen)?this._iframe.requestFullscreen():this._iframe.webkitRequestFullscreen()}catch(u){console.log("could not make video call fullscreen",u)}}),function(){return s.apply(this,arguments)})},{key:"exitFullscreen",value:function(){ge(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(o=ne(function*(){var u=this;return this._callObjectMode?(console.error("getSidebarView is not available in callObject mode"),Promise.resolve(null)):new Promise(function(b){u.sendMessageToCallMachine({action:"get-sidebar-view"},function(p){b(p.view)})})}),function(){return o.apply(this,arguments)})},{key:"setSidebarView",value:function(u){return this._callObjectMode?(console.error("setSidebarView is not available in callObject mode"),this):(this.sendMessageToCallMachine({action:"set-sidebar-view",view:u}),this)}},{key:"room",value:(i=ne(function*(){var u=this,b=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,p=b===void 0||b;return this._accessState.access===zl||this.needsLoad()?this.properties.url?{roomUrlPendingJoin:this.properties.url}:null:new Promise(function(x){u.sendMessageToCallMachine({action:"lib-room-info",includeRoomConfigDefaults:p},function(_){delete _.action,delete _.callbackStamp,x(_)})})}),function(){return i.apply(this,arguments)})},{key:"geo",value:(r=ne(function*(){try{var u=yield fetch("https://gs.daily.co/_ks_/x-swsl/:");return{current:(yield u.json()).geo}}catch(b){return console.error("geo lookup failed",b),{current:""}}}),function(){return r.apply(this,arguments)})},{key:"setNetworkTopology",value:(n=ne(function*(u){var b=this;return ge(),Ce(this._callState,"setNetworkTopology()"),new Promise(function(p,x){b.sendMessageToCallMachine({action:"set-network-topology",opts:u},function(_){_.error?x({error:_.error}):p({workerId:_.workerId})})})}),function(u){return n.apply(this,arguments)})},{key:"getNetworkTopology",value:(e=ne(function*(){var u=this;return new Promise(function(b,p){u.needsLoad()&&b({topology:"none"}),u.sendMessageToCallMachine({action:"get-network-topology"},function(x){x.error?p({error:x.error}):b({topology:x.topology})})})}),function(){return e.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(u){if(ge(),typeof u!="number"&&u!==!0&&u!==!1)throw new Error("argument to setShouldPlayNewParticipantSound should be true, false, or a number, but is ".concat(u));this.sendMessageToCallMachine({action:"daily-method-set-play-ding",arg:u})}},{key:"on",value:function(u,b){return Yo.prototype.on.call(this,u,b)}},{key:"once",value:function(u,b){return Yo.prototype.once.call(this,u,b)}},{key:"off",value:function(u,b){return Yo.prototype.off.call(this,u,b)}},{key:"validateProperties",value:function(u){var b,p;if(u!=null&&(b=u.dailyConfig)!==null&&b!==void 0&&b.userMediaAudioConstraints){var x,_;pe()||console.warn("userMediaAudioConstraints is deprecated. You can override constraints with inputSettings.audio.settings, found in DailyCallOptions.");var D=u.inputSettings||{};D.audio=((x=u.inputSettings)===null||x===void 0?void 0:x.audio)||{},D.audio.settings=((_=u.inputSettings)===null||_===void 0||(_=_.audio)===null||_===void 0?void 0:_.settings)||{},D.audio.settings=Y(Y({},D.audio.settings),u.dailyConfig.userMediaAudioConstraints),u.inputSettings=D,delete u.dailyConfig.userMediaAudioConstraints}if(u!=null&&(p=u.dailyConfig)!==null&&p!==void 0&&p.userMediaVideoConstraints){var I,F;pe()||console.warn("userMediaVideoConstraints is deprecated. You can override constraints with inputSettings.video.settings, found in DailyCallOptions.");var W=u.inputSettings||{};W.video=((I=u.inputSettings)===null||I===void 0?void 0:I.video)||{},W.video.settings=((F=u.inputSettings)===null||F===void 0||(F=F.video)===null||F===void 0?void 0:F.settings)||{},W.video.settings=Y(Y({},W.video.settings),u.dailyConfig.userMediaVideoConstraints),u.inputSettings=W,delete u.dailyConfig.userMediaVideoConstraints}for(var re in u)if(_r[re]){if(_r[re].validate&&!_r[re].validate(u[re],this))throw new Error("property '".concat(re,"': ").concat(_r[re].help))}else console.warn("Ignoring unrecognized property '".concat(re,"'")),delete u[re]}},{key:"assembleMeetingUrl",value:function(){var u,b,p=Y(Y({},this.properties),{},{emb:this.callClientId,embHref:encodeURIComponent(window.location.href),proxy:(u=this.properties.dailyConfig)!==null&&u!==void 0&&u.proxyUrl?encodeURIComponent((b=this.properties.dailyConfig)===null||b===void 0?void 0:b.proxyUrl):void 0}),x=p.url.match(/\?/)?"&":"?";return p.url+x+Object.keys(_r).filter(function(_){return _r[_].queryString&&p[_]!==void 0}).map(function(_){return"".concat(_r[_].queryString,"=").concat(p[_])}).join("&")}},{key:"needsLoad",value:function(){return[Df,Lf,Bn,Un].includes(this._callState)}},{key:"sendMessageToCallMachine",value:function(u,b){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");this._messageChannel.sendMessageToCallMachine(u,b,this.callClientId,this._iframe)}},{key:"forwardPackagedMessageToCallMachine",value:function(u){this._messageChannel.forwardPackagedMessageToCallMachine(u,this._iframe,this.callClientId)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(u){return this._messageChannel.addListenerForPackagedMessagesFromCallMachine(u,this.callClientId)}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(u){this._messageChannel.removeListenerForPackagedMessagesFromCallMachine(u)}},{key:"handleMessageFromCallMachine",value:function(u){switch(u.action){case Iw:this.sendMessageToCallMachine(Y({action:Rw},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var b={action:Ss,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:Zo(this.properties.dailyConfig)}};this.sendMessageToCallMachine(b),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case Rf:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emitDailyJSEvent(u);break;case zw:var p,x=Y({},u);delete x.internal,this._maxAppMessageSize=((p=u.internal)===null||p===void 0?void 0:p._maxAppMessageSize)||Hl,this._joinedCallback&&(this._joinedCallback(u.participants),this._joinedCallback=null),this.emitDailyJSEvent(x);break;case Vw:case Kw:if(this._callState===Bn)return;if(u.participant&&u.participant.session_id){var _=u.participant.local?"local":u.participant.session_id;if(this._callObjectMode){var D=this._callMachine().store;up(u.participant,D),dp(u.participant,D),hp(u.participant,this._participants[_],D)}try{this.maybeParticipantTracksStopped(this._participants[_],u.participant),this.maybeParticipantTracksStarted(this._participants[_],u.participant),this.maybeEventRecordingStopped(this._participants[_],u.participant),this.maybeEventRecordingStarted(this._participants[_],u.participant)}catch(__){console.error("track events error",__)}this.compareEqualForParticipantUpdateEvent(u.participant,this._participants[_])||(this._participants[_]=Y({},u.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus(),this.emitDailyJSEvent(u))}break;case Ww:if(u.participant&&u.participant.session_id){var I=this._participants[u.participant.session_id];I&&this.maybeParticipantTracksStopped(I,null),delete this._participants[u.participant.session_id],this.emitDailyJSEvent(u)}break;case qw:it(this._participantCounts,u.participantCounts)||(this._participantCounts=u.participantCounts,this.emitDailyJSEvent(u));break;case Jw:var F={access:u.access};u.awaitingAccess&&(F.awaitingAccess=u.awaitingAccess),it(this._accessState,F)||(this._accessState=F,this.emitDailyJSEvent(u));break;case Gw:if(u.meetingSession){this._meetingSessionSummary=u.meetingSession,this.emitDailyJSEvent(u);var W=Y(Y({},u),{},{action:"meeting-session-updated"});this.emitDailyJSEvent(W)}break;case Bf:var re;this._iframe&&!u.preserveIframe&&(this._iframe.src=""),this._updateCallState(Un),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(u.errorMsg),this._loadedCallback=null),u.preserveIframe;var he=ah(u,nS);he!=null&&(re=he.error)!==null&&re!==void 0&&re.details&&(he.error.details=JSON.parse(he.error.details)),this._maybeSendToSentry(u),this._joinedCallback&&(this._joinedCallback(null,he),this._joinedCallback=null),this.emitDailyJSEvent(he);break;case Hw:this._callState!==Un&&this._updateCallState(Bn),this.resetMeetingDependentVars(),this._resolveLeave&&(this._resolveLeave(),this._resolveLeave=null),this.emitDailyJSEvent(u);break;case"selected-devices-updated":u.devices&&this.emitDailyJSEvent(u);break;case b0:var dt=u.state,hn=u.threshold,fn=u.quality,$e=dt.state,ce=dt.reasons;$e===this._network.networkState&&it(ce,this._network.networkStateReasons)&&hn===this._network.threshold&&fn===this._network.quality||(this._network.networkState=$e,this._network.networkStateReasons=ce,this._network.quality=fn,this._network.threshold=hn,u.networkState=$e,ce.length&&(u.networkStateReasons=ce),delete u.state,this.emitDailyJSEvent(u));break;case S0:u&&u.cpuLoadState&&this.emitDailyJSEvent(u);break;case k0:u&&u.faceCounts!==void 0&&this.emitDailyJSEvent(u);break;case y0:var en=u.activeSpeaker;this._activeSpeaker.peerId!==en.peerId&&(this._activeSpeaker.peerId=en.peerId,this.emitDailyJSEvent({action:u.action,activeSpeaker:this._activeSpeaker}));break;case"show-local-video-changed":if(this._callObjectMode)return;var Uo=u.show;this._showLocalVideo=Uo,this.emitDailyJSEvent({action:u.action,show:Uo});break;case v0:var Qa=u.enabled;this._activeSpeakerMode!==Qa&&(this._activeSpeakerMode=Qa,this.emitDailyJSEvent({action:u.action,enabled:this._activeSpeakerMode}));break;case Yw:case Xw:case Zw:this._waitingParticipants=u.allWaitingParticipants,this.emitDailyJSEvent({action:u.action,participant:u.participant});break;case M0:it(this._receiveSettings,u.receiveSettings)||(this._receiveSettings=u.receiveSettings,this.emitDailyJSEvent({action:u.action,receiveSettings:u.receiveSettings}));break;case Ff:this._maybeUpdateInputSettings(u.inputSettings);break;case"send-settings-updated":it(this._sendSettings,u.sendSettings)||(this._sendSettings=u.sendSettings,this._preloadCache.sendSettings=null,this.emitDailyJSEvent({action:u.action,sendSettings:u.sendSettings}));break;case"local-audio-level":this._localAudioLevel=u.audioLevel,this._preloadCache.localAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case"remote-participants-audio-level":this._remoteParticipantsAudioLevel=u.participantsAudioLevel,this._preloadCache.remoteParticipantsAudioLevelObserver=null,this.emitDailyJSEvent(u);break;case d0:var zo=u.session_id;this._rmpPlayerState[zo]=u.playerState,this.emitDailyJSEvent(u);break;case f0:delete this._rmpPlayerState[u.session_id],this.emitDailyJSEvent(u);break;case h0:var Ho=u.session_id,Fv=this._rmpPlayerState[Ho];Fv&&this.compareEqualForRMPUpdateEvent(Fv,u.remoteMediaPlayerState)||(this._rmpPlayerState[Ho]=u.remoteMediaPlayerState,this.emitDailyJSEvent(u));break;case"custom-button-click":case"sidebar-view-changed":case"pip-started":case"pip-stopped":this.emitDailyJSEvent(u);break;case Qw:var x_=this._meetingSessionState.topology!==(u.meetingSessionState&&u.meetingSessionState.topology);this._meetingSessionState=lc(u.meetingSessionState,this._callObjectMode),(this._callObjectMode||x_)&&this.emitDailyJSEvent(u);break;case p0:this._isScreenSharing=!0,this.emitDailyJSEvent(u);break;case g0:case m0:this._isScreenSharing=!1,this.emitDailyJSEvent(u);break;case Nf:case $f:case o0:case s0:case a0:case n0:case r0:case i0:case jw:case Bw:case c0:case u0:case"test-completed":case w0:case l0:case x0:case _0:case C0:case E0:case jf:case T0:case"dialin-ready":case"dialin-connected":case"dialin-error":case"dialin-stopped":case"dialin-warning":case"dialout-connected":case"dialout-answered":case"dialout-error":case"dialout-stopped":case"dialout-warning":this.emitDailyJSEvent(u);break;case"request-fullscreen":this.requestFullscreen();break;case"request-exit-fullscreen":this.exitFullscreen()}}},{key:"maybeEventRecordingStopped",value:function(u,b){var p="record";u&&(b.local||b[p]!==!1||u[p]===b[p]||this.emitDailyJSEvent({action:$f}))}},{key:"maybeEventRecordingStarted",value:function(u,b){var p="record";u&&(b.local||b[p]!==!0||u[p]===b[p]||this.emitDailyJSEvent({action:Nf}))}},{key:"_trackStatePlayable",value:function(u){return!(!u||u.state!==Aw)}},{key:"_trackChanged",value:function(u,b){return(u==null?void 0:u.id)!==(b==null?void 0:b.id)}},{key:"maybeEventTrackStopped",value:function(u,b,p){var x,_,D=(x=b==null?void 0:b.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,F=D==null?void 0:D.track;if(F){var W=this._trackStatePlayable(D),re=this._trackStatePlayable(I),he=this._trackChanged(F,I==null?void 0:I.track);W&&(re&&!he||this.emitDailyJSEvent({action:t0,track:F,participant:p??b,type:u}))}}},{key:"maybeEventTrackStarted",value:function(u,b,p){var x,_,D=(x=b==null?void 0:b.tracks[u])!==null&&x!==void 0?x:null,I=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,F=I==null?void 0:I.track;if(F){var W=this._trackStatePlayable(D),re=this._trackStatePlayable(I),he=this._trackChanged(D==null?void 0:D.track,F);re&&(W&&!he||this.emitDailyJSEvent({action:e0,track:F,participant:p,type:u}))}}},{key:"maybeParticipantTracksStopped",value:function(u,b){if(u)for(var p in u.tracks)this.maybeEventTrackStopped(p,u,b)}},{key:"maybeParticipantTracksStarted",value:function(u,b){if(b)for(var p in b.tracks)this.maybeEventTrackStarted(p,u,b)}},{key:"compareEqualForRMPUpdateEvent",value:function(u,b){var p,x;return u.state===b.state&&((p=u.settings)===null||p===void 0?void 0:p.volume)===((x=b.settings)===null||x===void 0?void 0:x.volume)}},{key:"emitDailyJSEvent",value:function(u){try{u.callClientId=this.callClientId,this.emit(u.action,u)}catch(b){console.log("could not emit",u,b)}}},{key:"compareEqualForParticipantUpdateEvent",value:function(u,b){return!!it(u,b)&&(!u.videoTrack||!b.videoTrack||u.videoTrack.id===b.videoTrack.id&&u.videoTrack.muted===b.videoTrack.muted&&u.videoTrack.enabled===b.videoTrack.enabled)&&(!u.audioTrack||!b.audioTrack||u.audioTrack.id===b.audioTrack.id&&u.audioTrack.muted===b.audioTrack.muted&&u.audioTrack.enabled===b.audioTrack.enabled)}},{key:"nativeUtils",value:function(){return pe()?typeof DailyNativeUtils>"u"?(console.warn("in React Native, DailyNativeUtils is expected to be available"),null):DailyNativeUtils:null}},{key:"updateIsPreparingToJoin",value:function(u){this._updateCallState(this._callState,u)}},{key:"_updateCallState",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._isPreparingToJoin;if(u!==this._callState||b!==this._isPreparingToJoin){var p=this._callState,x=this._isPreparingToJoin;this._callState=u,this._isPreparingToJoin=b;var _=this._callState===Sr;this.updateShowAndroidOngoingMeetingNotification(_);var D=Ms(p,x),I=Ms(this._callState,this._isPreparingToJoin);D!==I&&(this.updateKeepDeviceAwake(I),this.updateDeviceAudioMode(I),this.updateNoOpRecordingEnsuringBackgroundContinuity(I))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=Tp,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:zl},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=lc(Ep,this._callObjectMode),this._isScreenSharing=!1,this._receiveSettings={},this._inputSettings=void 0,this._sendSettings={},this._localAudioLevel=0,this._isLocalAudioLevelObserverRunning=!1,this._remoteParticipantsAudioLevel={},this._isRemoteParticipantsAudioLevelObserverRunning=!1,this._maxAppMessageSize=Hl,this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(u){pe()&&this.nativeUtils().setKeepDeviceAwake(u,this.callClientId)}},{key:"updateDeviceAudioMode",value:function(u){if(pe()&&!this.disableReactNativeAutoDeviceManagement("audio")){var b=u?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(b)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(u){if(pe()&&this.nativeUtils().setShowOngoingMeetingNotification){var b,p,x,_;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var D=this.properties.reactNativeConfig.androidInCallNotification;b=D.title,p=D.subtitle,x=D.iconName,_=D.disableForCustomOverride}_&&(u=!1),this.nativeUtils().setShowOngoingMeetingNotification(u,b,p,x,this.callClientId)}}},{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(u){pe()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(u)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var u;if(pe()){var b=(u=this._callMachine())===null||u===void 0||(u=u.store)===null||u===void 0?void 0:u.getState();for(var p in b==null?void 0:b.streams){var x=b.streams[p];x&&x.pendingTrack&&x.pendingTrack.kind==="audio"&&(x.pendingTrack.enabled=this._hasNativeAudioFocus)}}}},{key:"disableReactNativeAutoDeviceManagement",value:function(u){return this.properties.reactNativeConfig&&this.properties.reactNativeConfig.disableAutoDeviceManagement&&this.properties.reactNativeConfig.disableAutoDeviceManagement[u]}},{key:"absoluteUrl",value:function(u){if(u!==void 0){var b=document.createElement("a");return b.href=u,b.href}}},{key:"sayHello",value:function(){var u="hello, world.";return console.log(u),u}},{key:"_logUseAfterDestroy",value:function(){var u=Object.values(xr)[0];if(this.needsLoad())if(u&&!u.needsLoad()){var b={action:Ss,level:"error",code:this.strictMode?9995:9997};u.sendMessageToCallMachine(b)}else this.strictMode||console.error("You are are attempting to use a call instance that was previously destroyed, which is unsupported. Please remove `strictMode: false` from your constructor properties to enable strict mode to track down and fix this unsupported usage.");else{var p={action:Ss,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(p,null,this.callClientId,this._iframe)}}},{key:"_logDuplicateInstanceAttempt",value:function(){for(var u=0,b=Object.values(xr);u<b.length;u++){var p=b[u];p._callMachineInitialized?(p.sendMessageToCallMachine({action:Ss,level:"warn",code:this.allowMultipleCallInstances?9993:9992}),p._delayDuplicateInstanceLog=!1):p._delayDuplicateInstanceLog=!0}}},{key:"_maybeSendToSentry",value:function(u){var b,p,x,_;if(!((b=u.error)!==null&&b!==void 0&&b.type&&(![Pw,Lw,If].includes(u.error.type)||u.error.type===If&&u.error.msg.includes("deleted")))){var D=(p=this.properties)!==null&&p!==void 0&&p.url?new URL(this.properties.url):void 0,I="production";D&&D.host.includes(".staging.daily")&&(I="staging");var F,W,re,he,dt,hn=function(zo){const Ho=[Gb(),qb(),Sw(),bw(),Ew(),Mw(),Zb(),Tw()];return zo.autoSessionTracking!==!1&&Ho.push(Cw()),Ho}({}).filter(function(zo){return!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(zo.name)}),fn=new aw({dsn:"https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844",transport:hw,stackParser:vw,integrations:hn,environment:I}),$e=new jn;if($e.setClient(fn),fn.init(),this.session_id&&$e.setExtra("sessionId",this.session_id),this.properties){var ce=Y({},this.properties);ce.userName=ce.userName?"[Filtered]":void 0,ce.userData=ce.userData?"[Filtered]":void 0,ce.token=ce.token?"[Filtered]":void 0,$e.setExtra("properties",ce)}if(D){var en=D.searchParams.get("domain");if(!en){var Uo=D.host.match(/(.*?)\./);en=Uo&&Uo[1]||""}en&&$e.setTag("domain",en)}u.error&&($e.setTag("fatalErrorType",u.error.type),$e.setExtra("errorDetails",u.error.details),!((F=u.error.details)===null||F===void 0)&&F.uri&&$e.setTag("serverAddress",u.error.details.uri),!((W=u.error.details)===null||W===void 0)&&W.workerGroup&&$e.setTag("workerGroup",u.error.details.workerGroup),!((re=u.error.details)===null||re===void 0)&&re.geoGroup&&$e.setTag("geoGroup",u.error.details.geoGroup),!((he=u.error.details)===null||he===void 0)&&he.on&&$e.setTag("connectionAttempt",u.error.details.on),(dt=u.error.details)!==null&&dt!==void 0&&dt.bundleUrl&&($e.setTag("bundleUrl",u.error.details.bundleUrl),$e.setTag("bundleError",u.error.details.sourceError.type))),$e.setTags({callMode:this._callObjectMode?pe()?"reactNative":(x=this.properties)!==null&&x!==void 0&&(x=x.dailyConfig)!==null&&x!==void 0&&(x=x.callMode)!==null&&x!==void 0&&x.includes("prebuilt")?this.properties.dailyConfig.callMode:"custom":"prebuilt-frame",version:t.version()});var Qa=((_=u.error)===null||_===void 0?void 0:_.msg)||u.errorMsg;$e.captureException(new Error(Qa))}}},{key:"_callMachine",value:function(){var u;return(u=window._daily)===null||u===void 0||(u=u.instances)===null||u===void 0||(u=u[this.callClientId])===null||u===void 0?void 0:u.callMachine}},{key:"_maybeUpdateInputSettings",value:function(u){if(!it(this._inputSettings,u)){var b=this._getInputSettings();this._inputSettings=u;var p=this._getInputSettings();it(b,p)||this.emitDailyJSEvent({action:Ff,inputSettings:p})}}}],[{key:"supportedBrowser",value:function(){if(pe())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var u=gb.getParser(Pt());return{supported:!!Jl(),mobile:u.getPlatformType()==="mobile",name:u.getBrowserName(),version:u.getBrowserVersion(),supportsFullscreen:!!qf(),supportsScreenShare:!!D0(),supportsSfu:!!Jl(),supportsVideoProcessing:Jf(),supportsAudioProcessing:Gf()}}},{key:"version",value:function(){return"0.86.0"}},{key:"createCallObject",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return u.layout="none",new t(null,u)}},{key:"wrap",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ge(),!u||!u.contentWindow||typeof u.src!="string")throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return b.layout||(b.customLayout?b.layout="custom-v1":b.layout="browser"),new t(u,b)}},{key:"createFrame",value:function(u,b){var p,x;ge(),u&&b?(p=u,x=b):u&&u.append?(p=u,x={}):(p=document.body,x=u||{});var _=x.iframeStyle;_||(_=p===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:"375px",height:"450px",right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});var D=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?D.allow="microphone, camera":D.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",D.style.visibility="hidden",p.appendChild(D),D.style.visibility=null,Object.keys(_).forEach(function(I){return D.style[I]=_[I]}),x.layout||(x.customLayout?x.layout="custom-v1":x.layout="browser");try{return new t(D,x)}catch(I){throw p.removeChild(D),I}}},{key:"createTransparentFrame",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ge();var b=document.createElement("iframe");return b.allow="microphone; camera; autoplay",b.style.cssText=`
36
36
  position: fixed;
37
37
  top: 0;
38
38
  left: 0;
@@ -40,7 +40,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
40
40
  height: 100%;
41
41
  border: 0;
42
42
  pointer-events: none;
43
- `,document.body.appendChild(y),u.layout||(u.layout="custom-v1"),t.wrap(y,u)}},{key:"getCallInstance",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return u?xr[u]:Object.values(xr)[0]}}]);var e,n,r,i,o,s,a,l,c,d,h,f,v,b,g,S,m,w,k,C,M,P,L,F,Y,W,H,Q,q,ae,J,K,re,j,z,B,le,we}();function Op(t){if(t.extension){if(typeof t.extension!="string")throw new Error("Error starting dial out: extension must be a string");if(t.extension.length>20)throw new Error("Error starting dial out: extension length must be less than or equal to 20")}if(t.waitBeforeExtensionDialSec){if(typeof t.waitBeforeExtensionDialSec!="number")throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be a number");if(t.waitBeforeExtensionDialSec>60)throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be less than or equal to 60");if(!t.extension)throw new Error("Error starting dial out: waitBeforeExtensionDialSec requires a phoneNumber and extension")}}function ei(t,e){var n={};for(var r in t)if(t[r]instanceof MediaStreamTrack)console.warn("MediaStreamTrack found in props or cache.",r),n[r]=bn;else if(r==="dailyConfig"){if(t[r].modifyLocalSdpHook){var i=window._daily.instances[e].customCallbacks||{};i.modifyLocalSdpHook=t[r].modifyLocalSdpHook,window._daily.instances[e].customCallbacks=i,delete t[r].modifyLocalSdpHook}if(t[r].modifyRemoteSdpHook){var o=window._daily.instances[e].customCallbacks||{};o.modifyRemoteSdpHook=t[r].modifyRemoteSdpHook,window._daily.instances[e].customCallbacks=o,delete t[r].modifyRemoteSdpHook}n[r]=t[r]}else n[r]=t[r];return n}function Ce(t){var e=arguments.length>2?arguments[2]:void 0;if(t!==Sr){var n="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," only supported after join.");throw e&&(n+=" ".concat(e)),console.error(n),new Error(n)}}function Ms(t,e){return[Ul,Sr].includes(t)||e}function oc(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"This daily-js method",r=arguments.length>3?arguments[3]:void 0;if(Ms(t,e)){var i="".concat(n," not supported after joining a meeting.");throw r&&(i+=" ".concat(r)),console.error(i),new Error(i)}}function As(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method",n=arguments.length>2?arguments[2]:void 0;if(!t){var r="".concat(e,arguments.length>3&&arguments[3]!==void 0&&arguments[3]?" requires preAuth() or startCamera() to initialize call state.":" requires preAuth(), startCamera(), or join() to initialize call state.");throw n&&(r+=" ".concat(n)),console.error(r),new Error(r)}}function sc(t){if(t){var e="A pre-call quality test is in progress. Please try ".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," again once testing has completed. Use stopTestCallQuality() to end it early.");throw console.error(e),new Error(e)}}function Vt(t){if(!t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported on custom callObject instances");throw console.error(e),new Error(e)}}function St(t){if(t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported as part of Daily's Prebuilt");throw console.error(e),new Error(e)}}function ge(){if(pe())throw new Error("This daily-js method is not currently supported in React Native")}function Wi(){if(!pe())throw new Error("This daily-js method is only supported in React Native")}function Dp(t){if(t===void 0)return!0;var e;if(typeof t=="string")e=t;else try{e=JSON.stringify(t),rt(JSON.parse(e),t)||console.warn("The userData provided will be modified when serialized.")}catch(n){throw Error("userData must be serializable to JSON: ".concat(n))}if(e.length>4096)throw Error("userData is too large (".concat(e.length," characters). Maximum size suppported is ").concat(4096,"."));return!0}function Pp(t,e){for(var n=e.allowAllParticipantsKey,r=function(h){var f=["local"];return n||f.push("*"),h&&!f.includes(h)},i=function(h){return!!(h.layer===void 0||Number.isInteger(h.layer)&&h.layer>=0||h.layer==="inherit")},o=function(h){return!!h&&!(h.video&&!i(h.video))&&!(h.screenVideo&&!i(h.screenVideo))},s=0,a=Object.entries(t);s<a.length;s++){var l=Ye(a[s],2),c=l[0],d=l[1];if(!r(c)||!o(d))return!1}return!0}function Lp(t){if(me(t)!=="object")return!1;for(var e=0,n=Object.entries(t);e<n.length;e++){var r=Ye(n[e],2),i=r[0],o=r[1];switch(i){case"video":if(me(o)!=="object")return!1;for(var s=0,a=Object.entries(o);s<a.length;s++){var l=Ye(a[s],2),c=l[0],d=l[1];switch(c){case"processor":if(!sS(d))return!1;break;case"settings":if(!Rp(d))return!1;break;default:return!1}}break;case"audio":if(me(o)!=="object")return!1;for(var h=0,f=Object.entries(o);h<f.length;h++){var v=Ye(f[h],2),b=v[0],g=v[1];switch(b){case"processor":if(!oS(g))return!1;break;case"settings":if(!Rp(g))return!1;break;default:return!1}}break;default:return!1}}return!0}function Ip(t,e,n){var r,i=[];t.video&&t.video.processor&&(qf((r=e==null?void 0:e.useLegacyVideoProcessor)!==null&&r!==void 0&&r)||(t.video.settings?delete t.video.processor:delete t.video,i.push("video"))),t.audio&&t.audio.processor&&(Jf()||(t.audio.settings?delete t.audio.processor:delete t.audio,i.push("audio"))),i.length>0&&console.error("Ignoring settings for browser- or platform-unsupported input processor(s): ".concat(i.join(", "))),t.audio&&t.audio.settings&&(t.audio.settings.customTrack?(n.audioTrack=t.audio.settings.customTrack,t.audio.settings={customTrack:bn}):delete n.audioTrack),t.video&&t.video.settings&&(t.video.settings.customTrack?(n.videoTrack=t.video.settings.customTrack,t.video.settings={customTrack:bn}):delete n.videoTrack)}function oS(t){if(pe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type"];return!!t&&me(t)==="object"&&(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> audio -> processor : ".concat(n)),delete t[n]}),!!function(n){return typeof n!="string"?!1:Object.values(Hf).includes(n)?!0:(console.error("inputSettings audio processor type invalid"),!1)}(t.type))}function sS(t){if(pe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type","config"];return!t||me(t)!=="object"||!function(n){return typeof n!="string"?!1:Object.values(ks).includes(n)?!0:(console.error("inputSettings video processor type invalid"),!1)}(t.type)||t.config&&(me(t.config)!=="object"||!function(n,r){var i=Object.keys(r);if(i.length===0)return!0;var o="invalid object in inputSettings -> video -> processor -> config";switch(n){case ks.BGBLUR:return i.length>1||i[0]!=="strength"?(console.error(o),!1):!(typeof r.strength!="number"||r.strength<=0||r.strength>1||isNaN(r.strength))||(console.error("".concat(o,"; expected: {0 < strength <= 1}, got: ").concat(r.strength)),!1);case ks.BGIMAGE:return!(r.source!==void 0&&!function(s){if(s.source==="default")return s.type="default",!0;if(s.source instanceof ArrayBuffer)return!0;if(es(s.source))return s.type="url",!!function(c){var d=new URL(c),h=d.pathname;if(d.protocol==="data:")try{var f=h.substring(h.indexOf(":")+1,h.indexOf(";")).split("/")[1];return Wl.includes(f)}catch(b){return console.error("failed to deduce blob content type",b),!1}var v=h.split(".").at(-1).toLowerCase().trim();return Wl.includes(v)}(s.source)||(console.error("invalid image type; supported types: [".concat(Wl.join(", "),"]")),!1);return a=s.source,l=Number(a),isNaN(l)||!Number.isInteger(l)||l<=0||l>10?(console.error("invalid image selection; must be an int, > 0, <= ".concat(10)),!1):(s.type="daily-preselect",!0);var a,l}(r));default:return!0}}(t.type,t.config))?!1:(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> video -> processor : ".concat(n)),delete t[n]}),!0)}function Rp(t){return me(t)==="object"&&(!t.customTrack||t.customTrack instanceof MediaStreamTrack)}function ac(){var t=Object.values(ks).join(" | "),e=Object.values(Hf).join(" | ");return"inputSettings must be of the form: { video?: { processor?: { type: [ ".concat(t," ], config?: {} } }, audio?: { processor: {type: [ ").concat(e," ] } } }")}function Np(t){var e=t.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(Dw).concat(e?' | "'.concat("*",'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function $p(){return"customIntegrations should be an object of type ".concat(JSON.stringify(ic),".")}function Fp(t){if(t&&me(t)!=="object"||Array.isArray(t))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(Es),".")),!1;if(t)for(var e=0,n=Object.entries(t);e<n.length;e++)for(var r=Ye(n[e],1)[0],i=0,o=Object.entries(t[r]);i<o.length;i++){var s=Ye(o[i],2),a=s[0],l=s[1],c=Es.id[a];if(!c)return console.error("customTrayButton does not support key ".concat(a)),!1;switch(a){case"iconPath":case"iconPathDarkMode":if(!es(l))return console.error("customTrayButton ".concat(a," should be a url.")),!1;break;case"visualState":if(!["default","sidebar-open","active"].includes(l))return console.error("customTrayButton ".concat(a," should be ").concat(c,". Got: ").concat(l)),!1;break;default:if(me(l)!==c)return console.error("customTrayButton ".concat(a," should be a ").concat(c,".")),!1}}return!0}function jp(t){if(!t||t&&me(t)!=="object"||Array.isArray(t))return console.error($p()),!1;for(var e=function(h){return"".concat(h," should be ").concat(ic.id[h])},n=function(h,f){return console.error("customIntegration ".concat(h,": ").concat(f))},r=0,i=Object.entries(t);r<i.length;r++){var o=Ye(i[r],1)[0];if(!("label"in t[o]))return n(o,"label is required"),!1;if(!("location"in t[o]))return n(o,"location is required"),!1;if(!("src"in t[o])&&!("srcdoc"in t[o]))return n(o,"src or srcdoc is required"),!1;for(var s=0,a=Object.entries(t[o]);s<a.length;s++){var l=Ye(a[s],2),c=l[0],d=l[1];switch(c){case"allow":case"csp":case"name":case"referrerPolicy":case"sandbox":if(typeof d!="string")return n(o,e(c)),!1;break;case"iconURL":if(!es(d))return n(o,"".concat(c," should be a url")),!1;break;case"src":if("srcdoc"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(!es(d))return n(o,'src "'.concat(d,'" is not a valid URL')),!1;break;case"srcdoc":if("src"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(typeof d!="string")return n(o,e(c)),!1;break;case"location":if(!["main","sidebar"].includes(d))return n(o,e(c)),!1;break;case"controlledBy":if(d!=="*"&&d!=="owners"&&(!Array.isArray(d)||d.some(function(h){return typeof h!="string"})))return n(o,e(c)),!1;break;case"shared":if((!Array.isArray(d)||d.some(function(h){return typeof h!="string"}))&&d!=="owners"&&typeof d!="boolean")return n(o,e(c)),!1;break;default:if(!ic.id[c])return console.error("customIntegration does not support key ".concat(c)),!1}}}return!0}function Bp(t,e){if(e===void 0)return!1;switch(me(e)){case"string":return me(t)===e;case"object":if(me(t)!=="object")return!1;for(var n in t)if(!Bp(t[n],e[n]))return!1;return!0;default:return!1}}function Up(t,e){var n=t.sessionId,r=t.toEndPoint,i=t.callerId,o=t.useSipRefer;if(!n||!r)throw new Error("".concat(e,"() requires a sessionId and toEndPoint"));if(typeof n!="string"||typeof r!="string")throw new Error("Invalid paramater: sessionId and toEndPoint must be of type string");if(o&&!r.startsWith("sip:"))throw new Error('"toEndPoint" must be a "sip" address');if(!r.startsWith("sip:")&&!r.startsWith("+"))throw new Error("toEndPoint: ".concat(r,' must starts with either "sip:" or "+"'));if(i&&typeof i!="string")throw new Error("callerId must be of type string");if(i&&!r.startsWith("+"))throw new Error("callerId is only valid when transferring to a PSTN number")}function zp(t){if(me(t)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(t.state&&!Object.values(Kl).includes(t.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify(Kl));if(t.volume){if(typeof t.volume!="number")throw new Error('RemoteMediaPlayerSettings.volume: must be "number" type');if(t.volume<0||t.volume>2)throw new Error("RemoteMediaPlayerSettings.volume: must be between 0.0 - 2.0")}}function Hp(t,e,n){return!(typeof t!="number"||t<e||t>n)}function lc(t,e){return t&&!e&&delete t.data,t}function aS(t){return t&&t.__esModule?t.default:t}function Vp(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Kp={};Vp(Kp,"DailyRTVIMessageType",()=>uc),Vp(Kp,"DailyTransport",()=>wn);class Kt{static floatTo16BitPCM(e){const n=new ArrayBuffer(e.length*2),r=new DataView(n);let i=0;for(let o=0;o<e.length;o++,i+=2){let s=Math.max(-1,Math.min(1,e[o]));r.setInt16(i,s<0?s*32768:s*32767,!0)}return n}static mergeBuffers(e,n){const r=new Uint8Array(e.byteLength+n.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(n),e.byteLength),r.buffer}_packData(e,n){return[new Uint8Array([n,n>>8]),new Uint8Array([n,n>>8,n>>16,n>>24])][e]}pack(e,n){if(n!=null&&n.bitsPerSample)if(n!=null&&n.channels){if(!(n!=null&&n.data))throw new Error('Missing "data"')}else throw new Error('Missing "channels"');else throw new Error('Missing "bitsPerSample"');const{bitsPerSample:r,channels:i,data:o}=n,s=["RIFF",this._packData(1,52),"WAVE","fmt ",this._packData(1,16),this._packData(0,1),this._packData(0,i.length),this._packData(1,e),this._packData(1,e*i.length*r/8),this._packData(0,i.length*r/8),this._packData(0,r),"data",this._packData(1,i[0].length*i.length*r/8),o],a=new Blob(s,{type:"audio/mpeg"}),l=URL.createObjectURL(a);return{blob:a,url:l,channelCount:i.length,sampleRate:e,duration:o.byteLength/(i.length*e*2)}}}globalThis.WavPacker=Kt;const Wp=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],lS=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Hn=[],cc=[];for(let t=1;t<=8;t++)for(let e=0;e<Wp.length;e++){const n=Wp[e];Hn.push(n/Math.pow(2,8-t)),cc.push(lS[e]+t)}const Os=[32,2e3],qp=Hn.filter((t,e)=>Hn[e]>Os[0]&&Hn[e]<Os[1]),cS=cc.filter((t,e)=>Hn[e]>Os[0]&&Hn[e]<Os[1]);class ti{static getFrequencies(e,n,r,i="frequency",o=-100,s=-30){r||(r=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(r));const a=n/2,l=1/r.length*a;let c,d,h;if(i==="music"||i==="voice"){const b=i==="voice"?qp:Hn,g=Array(b.length).fill(o);for(let S=0;S<r.length;S++){const m=S*l,w=r[S];for(let k=b.length-1;k>=0;k--)if(m>b[k]){g[k]=Math.max(g[k],w);break}}c=g,d=i==="voice"?qp:Hn,h=i==="voice"?cS:cc}else c=Array.from(r),d=c.map((b,g)=>l*g),h=d.map(b=>`${b.toFixed(2)} Hz`);const f=c.map(b=>Math.max(0,Math.min((b-o)/(s-o),1)));return{values:new Float32Array(f),frequencies:d,labels:h}}constructor(e,n=null){if(this.fftResults=[],n){const{length:r,sampleRate:i}=n,o=new OfflineAudioContext({length:r,sampleRate:i}),s=o.createBufferSource();s.buffer=n;const a=o.createAnalyser();a.fftSize=8192,a.smoothingTimeConstant=.1,s.connect(a);const l=1/60,c=r/i,d=h=>{const f=l*h;f<c&&o.suspend(f).then(()=>{const v=new Float32Array(a.frequencyBinCount);a.getFloatFrequencyData(v),this.fftResults.push(v),d(h+1)}),h===1?o.startRendering():o.resume()};s.start(0),d(1),this.audio=e,this.context=o,this.analyser=a,this.sampleRate=i,this.audioBuffer=n}else{const r=new AudioContext,i=r.createMediaElementSource(e),o=r.createAnalyser();o.fftSize=8192,o.smoothingTimeConstant=.1,i.connect(o),o.connect(r.destination),this.audio=e,this.context=r,this.analyser=o,this.sampleRate=this.context.sampleRate,this.audioBuffer=null}}getFrequencies(e="frequency",n=-100,r=-30){let i=null;if(this.audioBuffer&&this.fftResults.length){const o=this.audio.currentTime/this.audio.duration,s=Math.min(o*this.fftResults.length|0,this.fftResults.length-1);i=this.fftResults[s]}return ti.getFrequencies(this.analyser,this.sampleRate,i,e,n,r)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}}globalThis.AudioAnalysis=ti;const uS=`
43
+ `,document.body.appendChild(b),u.layout||(u.layout="custom-v1"),t.wrap(b,u)}},{key:"getCallInstance",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return u?xr[u]:Object.values(xr)[0]}}]);var e,n,r,i,o,s,a,l,c,d,h,f,g,y,m,S,v,w,k,C,E,L,A,R,G,U,K,j,H,ie,Q,V,X,B,q,z,le,we}();function Dp(t){if(t.extension){if(typeof t.extension!="string")throw new Error("Error starting dial out: extension must be a string");if(t.extension.length>20)throw new Error("Error starting dial out: extension length must be less than or equal to 20")}if(t.waitBeforeExtensionDialSec){if(typeof t.waitBeforeExtensionDialSec!="number")throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be a number");if(t.waitBeforeExtensionDialSec>60)throw new Error("Error starting dial out: waitBeforeExtensionDialSec must be less than or equal to 60");if(!t.extension)throw new Error("Error starting dial out: waitBeforeExtensionDialSec requires a phoneNumber and extension")}}function ei(t,e){var n={};for(var r in t)if(t[r]instanceof MediaStreamTrack)console.warn("MediaStreamTrack found in props or cache.",r),n[r]=wn;else if(r==="dailyConfig"){if(t[r].modifyLocalSdpHook){var i=window._daily.instances[e].customCallbacks||{};i.modifyLocalSdpHook=t[r].modifyLocalSdpHook,window._daily.instances[e].customCallbacks=i,delete t[r].modifyLocalSdpHook}if(t[r].modifyRemoteSdpHook){var o=window._daily.instances[e].customCallbacks||{};o.modifyRemoteSdpHook=t[r].modifyRemoteSdpHook,window._daily.instances[e].customCallbacks=o,delete t[r].modifyRemoteSdpHook}n[r]=t[r]}else n[r]=t[r];return n}function Ce(t){var e=arguments.length>2?arguments[2]:void 0;if(t!==Sr){var n="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," only supported after join.");throw e&&(n+=" ".concat(e)),console.error(n),new Error(n)}}function Ms(t,e){return[Ul,Sr].includes(t)||e}function oc(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"This daily-js method",r=arguments.length>3?arguments[3]:void 0;if(Ms(t,e)){var i="".concat(n," not supported after joining a meeting.");throw r&&(i+=" ".concat(r)),console.error(i),new Error(i)}}function As(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method",n=arguments.length>2?arguments[2]:void 0;if(!t){var r="".concat(e,arguments.length>3&&arguments[3]!==void 0&&arguments[3]?" requires preAuth() or startCamera() to initialize call state.":" requires preAuth(), startCamera(), or join() to initialize call state.");throw n&&(r+=" ".concat(n)),console.error(r),new Error(r)}}function sc(t){if(t){var e="A pre-call quality test is in progress. Please try ".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," again once testing has completed. Use stopTestCallQuality() to end it early.");throw console.error(e),new Error(e)}}function Kt(t){if(!t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported on custom callObject instances");throw console.error(e),new Error(e)}}function St(t){if(t){var e="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported as part of Daily's Prebuilt");throw console.error(e),new Error(e)}}function ge(){if(pe())throw new Error("This daily-js method is not currently supported in React Native")}function Wi(){if(!pe())throw new Error("This daily-js method is only supported in React Native")}function Lp(t){if(t===void 0)return!0;var e;if(typeof t=="string")e=t;else try{e=JSON.stringify(t),it(JSON.parse(e),t)||console.warn("The userData provided will be modified when serialized.")}catch(n){throw Error("userData must be serializable to JSON: ".concat(n))}if(e.length>4096)throw Error("userData is too large (".concat(e.length," characters). Maximum size suppported is ").concat(4096,"."));return!0}function Pp(t,e){for(var n=e.allowAllParticipantsKey,r=function(h){var f=["local"];return n||f.push("*"),h&&!f.includes(h)},i=function(h){return!!(h.layer===void 0||Number.isInteger(h.layer)&&h.layer>=0||h.layer==="inherit")},o=function(h){return!!h&&!(h.video&&!i(h.video))&&!(h.screenVideo&&!i(h.screenVideo))},s=0,a=Object.entries(t);s<a.length;s++){var l=Xe(a[s],2),c=l[0],d=l[1];if(!r(c)||!o(d))return!1}return!0}function Ip(t){if(me(t)!=="object")return!1;for(var e=0,n=Object.entries(t);e<n.length;e++){var r=Xe(n[e],2),i=r[0],o=r[1];switch(i){case"video":if(me(o)!=="object")return!1;for(var s=0,a=Object.entries(o);s<a.length;s++){var l=Xe(a[s],2),c=l[0],d=l[1];switch(c){case"processor":if(!sS(d))return!1;break;case"settings":if(!Np(d))return!1;break;default:return!1}}break;case"audio":if(me(o)!=="object")return!1;for(var h=0,f=Object.entries(o);h<f.length;h++){var g=Xe(f[h],2),y=g[0],m=g[1];switch(y){case"processor":if(!oS(m))return!1;break;case"settings":if(!Np(m))return!1;break;default:return!1}}break;default:return!1}}return!0}function Rp(t,e,n){var r,i=[];t.video&&t.video.processor&&(Jf((r=e==null?void 0:e.useLegacyVideoProcessor)!==null&&r!==void 0&&r)||(t.video.settings?delete t.video.processor:delete t.video,i.push("video"))),t.audio&&t.audio.processor&&(Gf()||(t.audio.settings?delete t.audio.processor:delete t.audio,i.push("audio"))),i.length>0&&console.error("Ignoring settings for browser- or platform-unsupported input processor(s): ".concat(i.join(", "))),t.audio&&t.audio.settings&&(t.audio.settings.customTrack?(n.audioTrack=t.audio.settings.customTrack,t.audio.settings={customTrack:wn}):delete n.audioTrack),t.video&&t.video.settings&&(t.video.settings.customTrack?(n.videoTrack=t.video.settings.customTrack,t.video.settings={customTrack:wn}):delete n.videoTrack)}function oS(t){if(pe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type"];return!!t&&me(t)==="object"&&(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> audio -> processor : ".concat(n)),delete t[n]}),!!function(n){return typeof n!="string"?!1:Object.values(Vf).includes(n)?!0:(console.error("inputSettings audio processor type invalid"),!1)}(t.type))}function sS(t){if(pe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type","config"];return!t||me(t)!=="object"||!function(n){return typeof n!="string"?!1:Object.values(ks).includes(n)?!0:(console.error("inputSettings video processor type invalid"),!1)}(t.type)||t.config&&(me(t.config)!=="object"||!function(n,r){var i=Object.keys(r);if(i.length===0)return!0;var o="invalid object in inputSettings -> video -> processor -> config";switch(n){case ks.BGBLUR:return i.length>1||i[0]!=="strength"?(console.error(o),!1):!(typeof r.strength!="number"||r.strength<=0||r.strength>1||isNaN(r.strength))||(console.error("".concat(o,"; expected: {0 < strength <= 1}, got: ").concat(r.strength)),!1);case ks.BGIMAGE:return!(r.source!==void 0&&!function(s){if(s.source==="default")return s.type="default",!0;if(s.source instanceof ArrayBuffer)return!0;if(es(s.source))return s.type="url",!!function(c){var d=new URL(c),h=d.pathname;if(d.protocol==="data:")try{var f=h.substring(h.indexOf(":")+1,h.indexOf(";")).split("/")[1];return Wl.includes(f)}catch(y){return console.error("failed to deduce blob content type",y),!1}var g=h.split(".").at(-1).toLowerCase().trim();return Wl.includes(g)}(s.source)||(console.error("invalid image type; supported types: [".concat(Wl.join(", "),"]")),!1);return a=s.source,l=Number(a),isNaN(l)||!Number.isInteger(l)||l<=0||l>10?(console.error("invalid image selection; must be an int, > 0, <= ".concat(10)),!1):(s.type="daily-preselect",!0);var a,l}(r));default:return!0}}(t.type,t.config))?!1:(Object.keys(t).filter(function(n){return!e.includes(n)}).forEach(function(n){console.warn("invalid key inputSettings -> video -> processor : ".concat(n)),delete t[n]}),!0)}function Np(t){return me(t)==="object"&&(!t.customTrack||t.customTrack instanceof MediaStreamTrack)}function ac(){var t=Object.values(ks).join(" | "),e=Object.values(Vf).join(" | ");return"inputSettings must be of the form: { video?: { processor?: { type: [ ".concat(t," ], config?: {} } }, audio?: { processor: {type: [ ").concat(e," ] } } }")}function $p(t){var e=t.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(Dw).concat(e?' | "'.concat("*",'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function Fp(){return"customIntegrations should be an object of type ".concat(JSON.stringify(ic),".")}function jp(t){if(t&&me(t)!=="object"||Array.isArray(t))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(Es),".")),!1;if(t)for(var e=0,n=Object.entries(t);e<n.length;e++)for(var r=Xe(n[e],1)[0],i=0,o=Object.entries(t[r]);i<o.length;i++){var s=Xe(o[i],2),a=s[0],l=s[1],c=Es.id[a];if(!c)return console.error("customTrayButton does not support key ".concat(a)),!1;switch(a){case"iconPath":case"iconPathDarkMode":if(!es(l))return console.error("customTrayButton ".concat(a," should be a url.")),!1;break;case"visualState":if(!["default","sidebar-open","active"].includes(l))return console.error("customTrayButton ".concat(a," should be ").concat(c,". Got: ").concat(l)),!1;break;default:if(me(l)!==c)return console.error("customTrayButton ".concat(a," should be a ").concat(c,".")),!1}}return!0}function Bp(t){if(!t||t&&me(t)!=="object"||Array.isArray(t))return console.error(Fp()),!1;for(var e=function(h){return"".concat(h," should be ").concat(ic.id[h])},n=function(h,f){return console.error("customIntegration ".concat(h,": ").concat(f))},r=0,i=Object.entries(t);r<i.length;r++){var o=Xe(i[r],1)[0];if(!("label"in t[o]))return n(o,"label is required"),!1;if(!("location"in t[o]))return n(o,"location is required"),!1;if(!("src"in t[o])&&!("srcdoc"in t[o]))return n(o,"src or srcdoc is required"),!1;for(var s=0,a=Object.entries(t[o]);s<a.length;s++){var l=Xe(a[s],2),c=l[0],d=l[1];switch(c){case"allow":case"csp":case"name":case"referrerPolicy":case"sandbox":if(typeof d!="string")return n(o,e(c)),!1;break;case"iconURL":if(!es(d))return n(o,"".concat(c," should be a url")),!1;break;case"src":if("srcdoc"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(!es(d))return n(o,'src "'.concat(d,'" is not a valid URL')),!1;break;case"srcdoc":if("src"in t[o])return n(o,"cannot have both src and srcdoc"),!1;if(typeof d!="string")return n(o,e(c)),!1;break;case"location":if(!["main","sidebar"].includes(d))return n(o,e(c)),!1;break;case"controlledBy":if(d!=="*"&&d!=="owners"&&(!Array.isArray(d)||d.some(function(h){return typeof h!="string"})))return n(o,e(c)),!1;break;case"shared":if((!Array.isArray(d)||d.some(function(h){return typeof h!="string"}))&&d!=="owners"&&typeof d!="boolean")return n(o,e(c)),!1;break;default:if(!ic.id[c])return console.error("customIntegration does not support key ".concat(c)),!1}}}return!0}function Up(t,e){if(e===void 0)return!1;switch(me(e)){case"string":return me(t)===e;case"object":if(me(t)!=="object")return!1;for(var n in t)if(!Up(t[n],e[n]))return!1;return!0;default:return!1}}function zp(t,e){var n=t.sessionId,r=t.toEndPoint,i=t.callerId,o=t.useSipRefer;if(!n||!r)throw new Error("".concat(e,"() requires a sessionId and toEndPoint"));if(typeof n!="string"||typeof r!="string")throw new Error("Invalid paramater: sessionId and toEndPoint must be of type string");if(o&&!r.startsWith("sip:"))throw new Error('"toEndPoint" must be a "sip" address');if(!r.startsWith("sip:")&&!r.startsWith("+"))throw new Error("toEndPoint: ".concat(r,' must starts with either "sip:" or "+"'));if(i&&typeof i!="string")throw new Error("callerId must be of type string");if(i&&!r.startsWith("+"))throw new Error("callerId is only valid when transferring to a PSTN number")}function Hp(t){if(me(t)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(t.state&&!Object.values(Kl).includes(t.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify(Kl));if(t.volume){if(typeof t.volume!="number")throw new Error('RemoteMediaPlayerSettings.volume: must be "number" type');if(t.volume<0||t.volume>2)throw new Error("RemoteMediaPlayerSettings.volume: must be between 0.0 - 2.0")}}function Vp(t,e,n){return!(typeof t!="number"||t<e||t>n)}function lc(t,e){return t&&!e&&delete t.data,t}function aS(t){return t&&t.__esModule?t.default:t}function Kp(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Wp={};Kp(Wp,"DailyRTVIMessageType",()=>uc),Kp(Wp,"DailyTransport",()=>Sn);class Wt{static floatTo16BitPCM(e){const n=new ArrayBuffer(e.length*2),r=new DataView(n);let i=0;for(let o=0;o<e.length;o++,i+=2){let s=Math.max(-1,Math.min(1,e[o]));r.setInt16(i,s<0?s*32768:s*32767,!0)}return n}static mergeBuffers(e,n){const r=new Uint8Array(e.byteLength+n.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(n),e.byteLength),r.buffer}_packData(e,n){return[new Uint8Array([n,n>>8]),new Uint8Array([n,n>>8,n>>16,n>>24])][e]}pack(e,n){if(n!=null&&n.bitsPerSample)if(n!=null&&n.channels){if(!(n!=null&&n.data))throw new Error('Missing "data"')}else throw new Error('Missing "channels"');else throw new Error('Missing "bitsPerSample"');const{bitsPerSample:r,channels:i,data:o}=n,s=["RIFF",this._packData(1,52),"WAVE","fmt ",this._packData(1,16),this._packData(0,1),this._packData(0,i.length),this._packData(1,e),this._packData(1,e*i.length*r/8),this._packData(0,i.length*r/8),this._packData(0,r),"data",this._packData(1,i[0].length*i.length*r/8),o],a=new Blob(s,{type:"audio/mpeg"}),l=URL.createObjectURL(a);return{blob:a,url:l,channelCount:i.length,sampleRate:e,duration:o.byteLength/(i.length*e*2)}}}globalThis.WavPacker=Wt;const qp=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],lS=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Hn=[],cc=[];for(let t=1;t<=8;t++)for(let e=0;e<qp.length;e++){const n=qp[e];Hn.push(n/Math.pow(2,8-t)),cc.push(lS[e]+t)}const Os=[32,2e3],Jp=Hn.filter((t,e)=>Hn[e]>Os[0]&&Hn[e]<Os[1]),cS=cc.filter((t,e)=>Hn[e]>Os[0]&&Hn[e]<Os[1]);class ti{static getFrequencies(e,n,r,i="frequency",o=-100,s=-30){r||(r=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(r));const a=n/2,l=1/r.length*a;let c,d,h;if(i==="music"||i==="voice"){const y=i==="voice"?Jp:Hn,m=Array(y.length).fill(o);for(let S=0;S<r.length;S++){const v=S*l,w=r[S];for(let k=y.length-1;k>=0;k--)if(v>y[k]){m[k]=Math.max(m[k],w);break}}c=m,d=i==="voice"?Jp:Hn,h=i==="voice"?cS:cc}else c=Array.from(r),d=c.map((y,m)=>l*m),h=d.map(y=>`${y.toFixed(2)} Hz`);const f=c.map(y=>Math.max(0,Math.min((y-o)/(s-o),1)));return{values:new Float32Array(f),frequencies:d,labels:h}}constructor(e,n=null){if(this.fftResults=[],n){const{length:r,sampleRate:i}=n,o=new OfflineAudioContext({length:r,sampleRate:i}),s=o.createBufferSource();s.buffer=n;const a=o.createAnalyser();a.fftSize=8192,a.smoothingTimeConstant=.1,s.connect(a);const l=1/60,c=r/i,d=h=>{const f=l*h;f<c&&o.suspend(f).then(()=>{const g=new Float32Array(a.frequencyBinCount);a.getFloatFrequencyData(g),this.fftResults.push(g),d(h+1)}),h===1?o.startRendering():o.resume()};s.start(0),d(1),this.audio=e,this.context=o,this.analyser=a,this.sampleRate=i,this.audioBuffer=n}else{const r=new AudioContext,i=r.createMediaElementSource(e),o=r.createAnalyser();o.fftSize=8192,o.smoothingTimeConstant=.1,i.connect(o),o.connect(r.destination),this.audio=e,this.context=r,this.analyser=o,this.sampleRate=this.context.sampleRate,this.audioBuffer=null}}getFrequencies(e="frequency",n=-100,r=-30){let i=null;if(this.audioBuffer&&this.fftResults.length){const o=this.audio.currentTime/this.audio.duration,s=Math.min(o*this.fftResults.length|0,this.fftResults.length-1);i=this.fftResults[s]}return ti.getFrequencies(this.analyser,this.sampleRate,i,e,n,r)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}}globalThis.AudioAnalysis=ti;const uS=`
44
44
  class StreamProcessor extends AudioWorkletProcessor {
45
45
  constructor() {
46
46
  super();
@@ -336,11 +336,11 @@ class AudioProcessor extends AudioWorkletProcessor {
336
336
  }
337
337
 
338
338
  registerProcessor('audio_processor', AudioProcessor);
339
- `,gS=new Blob([pS],{type:"application/javascript"}),Jp=URL.createObjectURL(gS);class mS{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Jp,this.sampleRate=e,this.outputToSpeakers=n,this.debug=!!r,this._deviceChangeCallback=null,this._deviceErrorCallback=null,this._devices=[],this.deviceSelection=null,this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}static async decode(e,n=44100,r=-1){const i=new AudioContext({sampleRate:n});let o,s;if(e instanceof Blob){if(r!==-1)throw new Error('Can not specify "fromSampleRate" when reading from Blob');s=e,o=await s.arrayBuffer()}else if(e instanceof ArrayBuffer){if(r!==-1)throw new Error('Can not specify "fromSampleRate" when reading from ArrayBuffer');o=e,s=new Blob([o],{type:"audio/wav"})}else{let d,h;if(e instanceof Int16Array){h=e,d=new Float32Array(e.length);for(let g=0;g<e.length;g++)d[g]=e[g]/32768}else if(e instanceof Float32Array)d=e;else if(e instanceof Array)d=new Float32Array(e);else throw new Error('"audioData" must be one of: Blob, Float32Arrray, Int16Array, ArrayBuffer, Array<number>');if(r===-1)throw new Error('Must specify "fromSampleRate" when reading from Float32Array, In16Array or Array');if(r<3e3)throw new Error('Minimum "fromSampleRate" is 3000 (3kHz)');h||(h=Kt.floatTo16BitPCM(d));const f={bitsPerSample:16,channels:[d],data:h};s=new Kt().pack(r,f).blob,o=await s.arrayBuffer()}const a=await i.decodeAudioData(o),l=a.getChannelData(0),c=URL.createObjectURL(s);return{blob:s,url:c,values:l,audioBuffer:a}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,n={},r=null){if(r=r||this.processor,!r)throw new Error("Can not send events without recording first");const i={event:e,id:this._lastEventId++,data:n};r.port.postMessage(i);const o=new Date().valueOf();for(;!this.eventReceipts[i.id];){if(new Date().valueOf()-o>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(a=>setTimeout(()=>a(!0),1))}const s=this.eventReceipts[i.id];return delete this.eventReceipts[i.id],s}listenForDeviceChange(e){if(e===null&&this._deviceChangeCallback)navigator.mediaDevices.removeEventListener("devicechange",this._deviceChangeCallback),this._deviceChangeCallback=null;else if(e!==null){let n=0,r=[];const i=s=>s.map(a=>a.deviceId).sort().join(","),o=async()=>{let s=++n;const a=await this.listDevices();s===n&&i(r)!==i(a)&&(r=a,e(a.slice()))};navigator.mediaDevices.addEventListener("devicechange",o),o(),this._deviceChangeCallback=o}return!0}listenForDeviceErrors(e){this._deviceErrorCallback=e}async requestPermission(){const e=await navigator.permissions.query({name:"microphone"});if(e.state==="denied")this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:new Error("Microphone access denied")});else if(e.state==="prompt")try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(i=>i.stop())}catch(n){console.error("Error accessing microphone."),this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:n})}return!0}async listDevices(){if(!navigator.mediaDevices||!("enumerateDevices"in navigator.mediaDevices))throw new Error("Could not request user devices");return await this.requestPermission(),(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput")}async begin(e){var a;if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!navigator.mediaDevices||!("getUserMedia"in navigator.mediaDevices))throw this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic","cam"],type:"undefined-mediadevices"}),new Error("Could not request user media");e=e??((a=this.deviceSelection)==null?void 0:a.deviceId);try{const l={audio:!0};e&&(l.audio={deviceId:{exact:e}}),this.stream=await navigator.mediaDevices.getUserMedia(l)}catch(l){throw this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:l}),new Error("Could not start media stream")}this.listDevices().then(l=>{e=this.stream.getAudioTracks()[0].getSettings().deviceId,console.log("find current device",l,e,this.stream.getAudioTracks()[0].getSettings()),this.deviceSelection=l.find(c=>c.deviceId===e),console.log("current device",this.deviceSelection)});const n=new AudioContext({sampleRate:this.sampleRate}),r=n.createMediaStreamSource(this.stream);try{await n.audioWorklet.addModule(this.scriptSrc)}catch(l){throw console.error(l),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const i=new AudioWorkletNode(n,"audio_processor");i.port.onmessage=l=>{const{event:c,id:d,data:h}=l.data;if(c==="receipt")this.eventReceipts[d]=h;else if(c==="chunk")if(this._chunkProcessorSize){const f=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Kt.mergeBuffers(f.raw,h.raw),mono:Kt.mergeBuffers(f.mono,h.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(h)};const o=r.connect(i),s=n.createAnalyser();return s.fftSize=8192,s.smoothingTimeConstant=.1,o.connect(s),this.outputToSpeakers&&(console.warn(`Warning: Output to speakers may affect sound quality,
339
+ `,gS=new Blob([pS],{type:"application/javascript"}),Gp=URL.createObjectURL(gS);class mS{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Gp,this.sampleRate=e,this.outputToSpeakers=n,this.debug=!!r,this._deviceChangeCallback=null,this._deviceErrorCallback=null,this._devices=[],this.deviceSelection=null,this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}static async decode(e,n=44100,r=-1){const i=new AudioContext({sampleRate:n});let o,s;if(e instanceof Blob){if(r!==-1)throw new Error('Can not specify "fromSampleRate" when reading from Blob');s=e,o=await s.arrayBuffer()}else if(e instanceof ArrayBuffer){if(r!==-1)throw new Error('Can not specify "fromSampleRate" when reading from ArrayBuffer');o=e,s=new Blob([o],{type:"audio/wav"})}else{let d,h;if(e instanceof Int16Array){h=e,d=new Float32Array(e.length);for(let m=0;m<e.length;m++)d[m]=e[m]/32768}else if(e instanceof Float32Array)d=e;else if(e instanceof Array)d=new Float32Array(e);else throw new Error('"audioData" must be one of: Blob, Float32Arrray, Int16Array, ArrayBuffer, Array<number>');if(r===-1)throw new Error('Must specify "fromSampleRate" when reading from Float32Array, In16Array or Array');if(r<3e3)throw new Error('Minimum "fromSampleRate" is 3000 (3kHz)');h||(h=Wt.floatTo16BitPCM(d));const f={bitsPerSample:16,channels:[d],data:h};s=new Wt().pack(r,f).blob,o=await s.arrayBuffer()}const a=await i.decodeAudioData(o),l=a.getChannelData(0),c=URL.createObjectURL(s);return{blob:s,url:c,values:l,audioBuffer:a}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,n={},r=null){if(r=r||this.processor,!r)throw new Error("Can not send events without recording first");const i={event:e,id:this._lastEventId++,data:n};r.port.postMessage(i);const o=new Date().valueOf();for(;!this.eventReceipts[i.id];){if(new Date().valueOf()-o>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(a=>setTimeout(()=>a(!0),1))}const s=this.eventReceipts[i.id];return delete this.eventReceipts[i.id],s}listenForDeviceChange(e){if(e===null&&this._deviceChangeCallback)navigator.mediaDevices.removeEventListener("devicechange",this._deviceChangeCallback),this._deviceChangeCallback=null;else if(e!==null){let n=0,r=[];const i=s=>s.map(a=>a.deviceId).sort().join(","),o=async()=>{let s=++n;const a=await this.listDevices();s===n&&i(r)!==i(a)&&(r=a,e(a.slice()))};navigator.mediaDevices.addEventListener("devicechange",o),o(),this._deviceChangeCallback=o}return!0}listenForDeviceErrors(e){this._deviceErrorCallback=e}async requestPermission(){const e=await navigator.permissions.query({name:"microphone"});if(e.state==="denied")this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:new Error("Microphone access denied")});else if(e.state==="prompt")try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(i=>i.stop())}catch(n){console.error("Error accessing microphone."),this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:n})}return!0}async listDevices(){if(!navigator.mediaDevices||!("enumerateDevices"in navigator.mediaDevices))throw new Error("Could not request user devices");return await this.requestPermission(),(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput")}async begin(e){var a;if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!navigator.mediaDevices||!("getUserMedia"in navigator.mediaDevices))throw this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic","cam"],type:"undefined-mediadevices"}),new Error("Could not request user media");e=e??((a=this.deviceSelection)==null?void 0:a.deviceId);try{const l={audio:!0};e&&(l.audio={deviceId:{exact:e}}),this.stream=await navigator.mediaDevices.getUserMedia(l)}catch(l){throw this._deviceErrorCallback&&this._deviceErrorCallback({devices:["mic"],type:"unknown",error:l}),new Error("Could not start media stream")}this.listDevices().then(l=>{e=this.stream.getAudioTracks()[0].getSettings().deviceId,console.log("find current device",l,e,this.stream.getAudioTracks()[0].getSettings()),this.deviceSelection=l.find(c=>c.deviceId===e),console.log("current device",this.deviceSelection)});const n=new AudioContext({sampleRate:this.sampleRate}),r=n.createMediaStreamSource(this.stream);try{await n.audioWorklet.addModule(this.scriptSrc)}catch(l){throw console.error(l),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const i=new AudioWorkletNode(n,"audio_processor");i.port.onmessage=l=>{const{event:c,id:d,data:h}=l.data;if(c==="receipt")this.eventReceipts[d]=h;else if(c==="chunk")if(this._chunkProcessorSize){const f=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Wt.mergeBuffers(f.raw,h.raw),mono:Wt.mergeBuffers(f.mono,h.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(h)};const o=r.connect(i),s=n.createAnalyser();return s.fftSize=8192,s.smoothingTimeConstant=.1,o.connect(s),this.outputToSpeakers&&(console.warn(`Warning: Output to speakers may affect sound quality,
340
340
  especially due to system audio feedback preventative measures.
341
- use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,this.analyser=s,this.processor=i,console.log("begin completed"),!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return ti.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Kt().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.stream.getTracks().forEach(s=>s.stop()),this.log("Exporting ...");const r=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Kt().pack(this.sampleRate,r.audio)}async quit(){return this.listenForDeviceChange(null),this.deviceSelection=null,this.processor&&await this.end(),!0}}globalThis.WavRecorder=mS;function Gp(t,e,n){if(e===n)return t;const r=new Int16Array(t),i=e/n,o=Math.round(r.length/i),s=new ArrayBuffer(o*2),a=new Int16Array(s);for(let l=0;l<o;l++){const c=l*i,d=Math.floor(c),h=Math.min(d+1,r.length-1),f=c-d;a[l]=Math.round(r[d]*(1-f)+r[h]*f)}return s}class yS{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Jp,this.sampleRate=e,this.outputToSpeakers=n,this.debug=!!r,this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,n={},r=null){if(r=r||this.processor,!r)throw new Error("Can not send events without recording first");const i={event:e,id:this._lastEventId++,data:n};r.port.postMessage(i);const o=new Date().valueOf();for(;!this.eventReceipts[i.id];){if(new Date().valueOf()-o>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(a=>setTimeout(()=>a(!0),1))}const s=this.eventReceipts[i.id];return delete this.eventReceipts[i.id],s}async begin(e){if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!e||e.kind!=="audio")throw new Error("No audio track provided");this.stream=new MediaStream([e]);const n=navigator.userAgent.toLowerCase().includes("firefox");let r;n?r=new AudioContext:r=new AudioContext({sampleRate:this.sampleRate});const i=r.sampleRate,o=r.createMediaStreamSource(this.stream);try{await r.audioWorklet.addModule(this.scriptSrc)}catch(c){throw console.error(c),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const s=new AudioWorkletNode(r,"audio_processor");s.port.onmessage=c=>{const{event:d,id:h,data:f}=c.data;if(d==="receipt")this.eventReceipts[h]=f;else if(d==="chunk"){const v={raw:Gp(f.raw,i,this.sampleRate),mono:Gp(f.mono,i,this.sampleRate)};if(this._chunkProcessorSize){const b=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Kt.mergeBuffers(b.raw,v.raw),mono:Kt.mergeBuffers(b.mono,v.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(v)}};const a=o.connect(s),l=r.createAnalyser();return l.fftSize=8192,l.smoothingTimeConstant=.1,a.connect(l),this.outputToSpeakers&&(console.warn(`Warning: Output to speakers may affect sound quality,
341
+ use only for debugging`),s.connect(n.destination)),this.source=r,this.node=o,this.analyser=s,this.processor=i,console.log("begin completed"),!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return ti.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Wt().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.stream.getTracks().forEach(s=>s.stop()),this.log("Exporting ...");const r=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Wt().pack(this.sampleRate,r.audio)}async quit(){return this.listenForDeviceChange(null),this.deviceSelection=null,this.processor&&await this.end(),!0}}globalThis.WavRecorder=mS;function Qp(t,e,n){if(e===n)return t;const r=new Int16Array(t),i=e/n,o=Math.round(r.length/i),s=new ArrayBuffer(o*2),a=new Int16Array(s);for(let l=0;l<o;l++){const c=l*i,d=Math.floor(c),h=Math.min(d+1,r.length-1),f=c-d;a[l]=Math.round(r[d]*(1-f)+r[h]*f)}return s}class yS{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Gp,this.sampleRate=e,this.outputToSpeakers=n,this.debug=!!r,this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,n={},r=null){if(r=r||this.processor,!r)throw new Error("Can not send events without recording first");const i={event:e,id:this._lastEventId++,data:n};r.port.postMessage(i);const o=new Date().valueOf();for(;!this.eventReceipts[i.id];){if(new Date().valueOf()-o>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(a=>setTimeout(()=>a(!0),1))}const s=this.eventReceipts[i.id];return delete this.eventReceipts[i.id],s}async begin(e){if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!e||e.kind!=="audio")throw new Error("No audio track provided");this.stream=new MediaStream([e]);const n=navigator.userAgent.toLowerCase().includes("firefox");let r;n?r=new AudioContext:r=new AudioContext({sampleRate:this.sampleRate});const i=r.sampleRate,o=r.createMediaStreamSource(this.stream);try{await r.audioWorklet.addModule(this.scriptSrc)}catch(c){throw console.error(c),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const s=new AudioWorkletNode(r,"audio_processor");s.port.onmessage=c=>{const{event:d,id:h,data:f}=c.data;if(d==="receipt")this.eventReceipts[h]=f;else if(d==="chunk"){const g={raw:Qp(f.raw,i,this.sampleRate),mono:Qp(f.mono,i,this.sampleRate)};if(this._chunkProcessorSize){const y=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Wt.mergeBuffers(y.raw,g.raw),mono:Wt.mergeBuffers(y.mono,g.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(g)}};const a=o.connect(s),l=r.createAnalyser();return l.fftSize=8192,l.smoothingTimeConstant=.1,a.connect(l),this.outputToSpeakers&&(console.warn(`Warning: Output to speakers may affect sound quality,
342
342
  especially due to system audio feedback preventative measures.
343
- use only for debugging`),l.connect(r.destination)),this.source=o,this.node=a,this.analyser=l,this.processor=s,!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return ti.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: HELLO please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Kt().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.log("Exporting ...");const n=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Kt().pack(this.sampleRate,n.audio)}async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}}globalThis.WavRecorder=WavRecorder;var Qp={};Qp=JSON.parse('{"name":"@pipecat-ai/daily-transport","version":"1.6.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"src/index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web-transports.git"},"files":["dist","package.json","README.md"],"scripts":{"build":"parcel build --no-cache","dev":"parcel watch","lint":"eslint . --ext ts --report-unused-disable-directives --max-warnings 0"},"devDependencies":{"@pipecat-ai/client-js":"^1.6.0","eslint":"9.39.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1"},"peerDependencies":{"@pipecat-ai/client-js":"~1.6.0"},"dependencies":{"@daily-co/daily-js":"^0.86.0"},"description":"Pipecat Daily Transport Package","author":"Daily.co","bugs":{"url":"https://github.com/pipecat-ai/pipecat-client-web-transports/issues"},"homepage":"https://github.com/pipecat-ai/pipecat-client-web-transports/blob/main/transports/daily-webrtc/README.md"}');var uc;(function(t){t.AUDIO_BUFFERING_STARTED="audio-buffering-started",t.AUDIO_BUFFERING_STOPPED="audio-buffering-stopped"})(uc||(uc={}));class vS{constructor(e){this._daily=e,this._proxy=new Proxy(this._daily,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"preAuth":o="Calls to preAuth() are disabled. Please use Transport.preAuth()";break;case"startCamera":o="Calls to startCamera() are disabled. Please use PipecatClient.initDevices()";break;case"join":o="Calls to join() are disabled. Please use PipecatClient.connect()";break;case"leave":o="Calls to leave() are disabled. Please use PipecatClient.disconnect()";break;case"destroy":o="Calls to destroy() are disabled.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}class wn extends nh{constructor(e={}){var i;super(),this._botId="",this._selectedCam={},this._selectedMic={},this._selectedSpeaker={},this._currentAudioTrack=null,this._audioQueue=[],this._callbacks={};const{bufferLocalAudioUntilBotReady:n,...r}=e;this._dailyFactoryOptions=r,typeof((i=this._dailyFactoryOptions.dailyConfig)==null?void 0:i.useDevicePreferenceCookies)>"u"&&(this._dailyFactoryOptions.dailyConfig==null&&(this._dailyFactoryOptions.dailyConfig={}),this._dailyFactoryOptions.dailyConfig.useDevicePreferenceCookies=!0),this._bufferLocalAudioUntilBotReady=n||!1,this._daily=iS.createCallObject({...this._dailyFactoryOptions,allowMultipleCallInstances:!0}),this._dailyWrapper=new vS(this._daily)}setupRecorder(){this._mediaStreamRecorder=new yS({sampleRate:wn.RECORDER_SAMPLE_RATE})}handleUserAudioStream(e){this._audioQueue.push(e)}flushAudioQueue(){if(this._audioQueue.length!==0)for(fe.debug(`Will flush audio queue: ${this._audioQueue.length}`);this._audioQueue.length>0;){const n=[];for(;n.length<10&&this._audioQueue.length>0;){const r=this._audioQueue.shift();r&&n.push(r)}n.length>0&&this._sendAudioBatch(n)}}_sendAudioBatch(e){const r={id:"raw-audio-batch",label:"rtvi-ai",type:"raw-audio-batch",data:{base64AudioBatch:e.map(i=>{const o=new Uint8Array(i);return btoa(String.fromCharCode(...o))}),sampleRate:wn.RECORDER_SAMPLE_RATE,numChannels:1}};this.sendMessage(r)}initialize(e,n){this._bufferLocalAudioUntilBotReady&&this.setupRecorder(),this._callbacks=e.callbacks??{},this._onMessage=n,(this._dailyFactoryOptions.startVideoOff==null||e.enableCam!=null)&&(this._dailyFactoryOptions.startVideoOff=!(e.enableCam??!1)),(this._dailyFactoryOptions.startAudioOff==null||e.enableMic!=null)&&(this._dailyFactoryOptions.startAudioOff=!(e.enableMic??!0)),this.attachEventListeners(),this.state="disconnected",fe.debug("[Daily Transport] Initialized",aS(Qp).version)}get dailyCallClient(){return this._dailyWrapper.proxy}get state(){return this._state}set state(e){var n,r;this._state!==e&&(this._state=e,(r=(n=this._callbacks).onTransportStateChanged)==null||r.call(n,e))}getSessionInfo(){return this._daily.meetingSessionSummary()}async getAllCams(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="videoinput")}updateCam(e){this._daily.setInputDevicesAsync({videoDeviceId:e}).then(n=>{this._selectedCam=n.camera})}get selectedCam(){return this._selectedCam}async getAllMics(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audioinput")}updateMic(e){this._daily.setInputDevicesAsync({audioDeviceId:e}).then(n=>{this._selectedMic=n.mic})}get selectedMic(){return this._selectedMic}async getAllSpeakers(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audiooutput")}updateSpeaker(e){this._daily.setOutputDeviceAsync({outputDeviceId:e}).then(n=>{this._selectedSpeaker=n.speaker}).catch(n=>{var r,i;(i=(r=this._callbacks).onDeviceError)==null||i.call(r,new pn(["speaker"],n.type??"unknown",n.message))})}get selectedSpeaker(){return this._selectedSpeaker}enableMic(e){this._daily.setLocalAudio(e)}get isMicEnabled(){return this._daily.localAudio()}enableCam(e){this._daily.setLocalVideo(e)}get isCamEnabled(){return this._daily.localVideo()}enableScreenShare(e){e?this._daily.startScreenShare():this._daily.stopScreenShare()}get isSharingScreen(){return this._daily.localScreenAudio()||this._daily.localScreenVideo()}tracks(){var i,o,s,a,l,c,d,h,f,v,b,g,S,m,w,k;const e=this._daily.participants()??{},n=e==null?void 0:e[this._botId],r={local:{audio:(s=(o=(i=e==null?void 0:e.local)==null?void 0:i.tracks)==null?void 0:o.audio)==null?void 0:s.persistentTrack,screenAudio:(c=(l=(a=e==null?void 0:e.local)==null?void 0:a.tracks)==null?void 0:l.screenAudio)==null?void 0:c.persistentTrack,screenVideo:(f=(h=(d=e==null?void 0:e.local)==null?void 0:d.tracks)==null?void 0:h.screenVideo)==null?void 0:f.persistentTrack,video:(g=(b=(v=e==null?void 0:e.local)==null?void 0:v.tracks)==null?void 0:b.video)==null?void 0:g.persistentTrack}};return n&&(r.bot={audio:(m=(S=n==null?void 0:n.tracks)==null?void 0:S.audio)==null?void 0:m.persistentTrack,video:(k=(w=n==null?void 0:n.tracks)==null?void 0:w.video)==null?void 0:k.persistentTrack}),r}async startRecording(){var e,n;try{fe.info("[Daily Transport] Initializing recording"),await this._mediaStreamRecorder.record(r=>{this.handleUserAudioStream(r.mono)},wn.RECORDER_CHUNK_SIZE),(n=(e=this._callbacks).onAudioBufferingStarted)==null||n.call(e),fe.info("[Daily Transport] Recording Initialized")}catch(r){r.message.includes("Already recording")||fe.error("Error starting recording",r)}}async preAuth(e){this._dailyFactoryOptions=e,await this._daily.preAuth(e)}async initDevices(){var s,a,l,c,d,h,f,v,b,g,S,m;if(!this._daily)throw new dt("Transport instance not initialized");this.state="initializing";const e=await this._daily.startCamera(this._dailyFactoryOptions),{devices:n}=await this._daily.enumerateDevices(),r=n.filter(w=>w.kind==="videoinput"),i=n.filter(w=>w.kind==="audioinput"),o=n.filter(w=>w.kind==="audiooutput");this._selectedCam=e.camera,this._selectedMic=e.mic,this._selectedSpeaker=e.speaker,(a=(s=this._callbacks).onAvailableCamsUpdated)==null||a.call(s,r),(c=(l=this._callbacks).onAvailableMicsUpdated)==null||c.call(l,i),(h=(d=this._callbacks).onAvailableSpeakersUpdated)==null||h.call(d,o),(v=(f=this._callbacks).onCamUpdated)==null||v.call(f,e.camera),(g=(b=this._callbacks).onMicUpdated)==null||g.call(b,e.mic),(m=(S=this._callbacks).onSpeakerUpdated)==null||m.call(S,e.speaker),this._daily.isLocalAudioLevelObserverRunning()||await this._daily.startLocalAudioLevelObserver(100),this._daily.isRemoteParticipantsAudioLevelObserverRunning()||await this._daily.startRemoteParticipantsAudioLevelObserver(100),this.state="initialized"}_validateConnectionParams(e){if(e==null)return;if(typeof e!="object")throw new dt("Invalid connection parameters");const n=e;return n.room_url?(n.url=n.room_url,delete n.room_url):n.dailyRoom&&(n.url=n.dailyRoom,delete n.dailyRoom),n.dailyToken&&(n.token=n.dailyToken,delete n.dailyToken),n.token||delete n.token,n}async _connect(e){var n,r,i;if(!this._daily)throw new dt("Transport instance not initialized");e&&(this._dailyFactoryOptions={...this._dailyFactoryOptions,...e}),this.state="connecting";try{await this._daily.join(this._dailyFactoryOptions)}catch(o){throw fe.error("Failed to join room",o),this.state="error",new Vd}(n=this._abortController)!=null&&n.signal.aborted||(this.state="connected",(i=(r=this._callbacks).onConnected)==null||i.call(r))}async sendReadyMessage(){return new Promise(e=>{var o,s;const n=()=>{const a=navigator.userAgent;return/iPad|iPhone|iPod/.test(a)||/Macintosh/.test(a)&&"ontouchend"in document},r=()=>{this.state="ready",this.flushAudioQueue(),this.sendMessage(Ue.clientReady()),this.stopRecording(),e()};for(const a in this._daily.participants()){const l=this._daily.participants()[a];if(!l.local&&((s=(o=l.tracks)==null?void 0:o.audio)!=null&&s.persistentTrack)){r(),e();return}}const i=a=>{var l;(l=a.participant)!=null&&l.local||(this._daily.off("track-started",i),n()?(fe.debug("[Daily Transport] iOS device detected, adding 0.5 second delay before sending ready message"),setTimeout(r,500)):r())};this._daily.on("track-started",i)})}stopRecording(){var e,n;this._mediaStreamRecorder&&this._mediaStreamRecorder.getStatus()!=="ended"&&(this._mediaStreamRecorder.end(),(n=(e=this._callbacks).onAudioBufferingStopped)==null||n.call(e))}attachEventListeners(){this._daily.on("available-devices-updated",this.handleAvailableDevicesUpdated.bind(this)),this._daily.on("selected-devices-updated",this.handleSelectedDevicesUpdated.bind(this)),this._daily.on("camera-error",this.handleDeviceError.bind(this)),this._daily.on("track-started",this.handleTrackStarted.bind(this)),this._daily.on("track-stopped",this.handleTrackStopped.bind(this)),this._daily.on("participant-joined",this.handleParticipantJoined.bind(this)),this._daily.on("participant-left",this.handleParticipantLeft.bind(this)),this._daily.on("local-audio-level",this.handleLocalAudioLevel.bind(this)),this._daily.on("remote-participants-audio-level",this.handleRemoteAudioLevel.bind(this)),this._daily.on("app-message",this.handleAppMessage.bind(this)),this._daily.on("left-meeting",this.handleLeftMeeting.bind(this)),this._daily.on("error",this.handleFatalError.bind(this)),this._daily.on("nonfatal-error",this.handleNonFatalError.bind(this))}async _disconnect(){this.state="disconnecting",this._daily.stopLocalAudioLevelObserver(),this._daily.stopRemoteParticipantsAudioLevelObserver(),this._audioQueue=[],this._currentAudioTrack=null,this.stopRecording(),await this._daily.leave()}sendMessage(e){this._daily.sendAppMessage(e,"*")}handleAppMessage(e){e.data.label==="rtvi-ai"&&this._onMessage({id:e.data.id,type:e.data.type,data:e.data.data})}handleAvailableDevicesUpdated(e){var n,r,i,o,s,a;(r=(n=this._callbacks).onAvailableCamsUpdated)==null||r.call(n,e.availableDevices.filter(l=>l.kind==="videoinput")),(o=(i=this._callbacks).onAvailableMicsUpdated)==null||o.call(i,e.availableDevices.filter(l=>l.kind==="audioinput")),(a=(s=this._callbacks).onAvailableSpeakersUpdated)==null||a.call(s,e.availableDevices.filter(l=>l.kind==="audiooutput"))}handleSelectedDevicesUpdated(e){var n,r,i,o,s,a,l,c,d;((n=this._selectedCam)==null?void 0:n.deviceId)!==e.devices.camera&&(this._selectedCam=e.devices.camera,(i=(r=this._callbacks).onCamUpdated)==null||i.call(r,e.devices.camera)),((o=this._selectedMic)==null?void 0:o.deviceId)!==e.devices.mic&&(this._selectedMic=e.devices.mic,(a=(s=this._callbacks).onMicUpdated)==null||a.call(s,e.devices.mic)),((l=this._selectedSpeaker)==null?void 0:l.deviceId)!==e.devices.speaker&&(this._selectedSpeaker=e.devices.speaker,(d=(c=this._callbacks).onSpeakerUpdated)==null||d.call(c,e.devices.speaker))}handleDeviceError(e){var r,i;const n=o=>{const s=[];switch(o.type){case"permissions":return o.blockedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new pn(s,o.type,o.msg,{blockedBy:o.blockedBy});case"not-found":return o.missingMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new pn(s,o.type,o.msg);case"constraints":return o.failedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new pn(s,o.type,o.msg,{reason:o.reason});case"cam-in-use":return s.push("cam"),new pn(s,"in-use",o.msg);case"mic-in-use":return s.push("mic"),new pn(s,"in-use",o.msg);case"cam-mic-in-use":return s.push("cam"),s.push("mic"),new pn(s,"in-use",o.msg);case"undefined-mediadevices":case"unknown":default:return s.push("cam"),s.push("mic"),new pn(s,o.type,o.msg)}};(i=(r=this._callbacks).onDeviceError)==null||i.call(r,n(e.error))}async handleLocalAudioTrack(e){if(this.state=="ready"||!this._bufferLocalAudioUntilBotReady)return;switch(this._mediaStreamRecorder.getStatus()){case"ended":try{await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}break;case"paused":await this.startRecording();break;case"recording":default:if(this._currentAudioTrack!==e)try{await this._mediaStreamRecorder.end(),await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}else fe.warn("track-started event received for current track and already recording");break}this._currentAudioTrack=e}handleTrackStarted(e){var n,r,i,o,s;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStarted)==null||r.call(n,e.track,e.participant?Cr(e.participant):void 0):((i=e.participant)!=null&&i.local&&e.track.kind==="audio"&&this.handleLocalAudioTrack(e.track),(s=(o=this._callbacks).onTrackStarted)==null||s.call(o,e.track,e.participant?Cr(e.participant):void 0))}handleTrackStopped(e){var n,r,i,o;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStopped)==null||r.call(n,e.track,e.participant?Cr(e.participant):void 0):(o=(i=this._callbacks).onTrackStopped)==null||o.call(i,e.track,e.participant?Cr(e.participant):void 0)}handleParticipantJoined(e){var r,i,o,s;const n=Cr(e.participant);(i=(r=this._callbacks).onParticipantJoined)==null||i.call(r,n),!n.local&&(this._botId=e.participant.session_id,(s=(o=this._callbacks).onBotConnected)==null||s.call(o,n))}handleParticipantLeft(e){var r,i,o,s;const n=Cr(e.participant);(i=(r=this._callbacks).onParticipantLeft)==null||i.call(r,n),!n.local&&(this._botId="",(s=(o=this._callbacks).onBotDisconnected)==null||s.call(o,n))}handleLocalAudioLevel(e){var n,r;(r=(n=this._callbacks).onLocalAudioLevel)==null||r.call(n,e.audioLevel)}handleRemoteAudioLevel(e){var i,o;const n=this._daily.participants(),r=Object.keys(e.participantsAudioLevel);for(let s=0;s<r.length;s++){const a=r[s],l=e.participantsAudioLevel[a];(o=(i=this._callbacks).onRemoteAudioLevel)==null||o.call(i,l,Cr(n[a]))}}handleLeftMeeting(){var e,n;this.state="disconnected",this._botId="",(n=(e=this._callbacks).onDisconnected)==null||n.call(e)}handleFatalError(e){var n,r;fe.error("Daily fatal error",e.errorMsg),this.state="error",this._botId="",(r=(n=this._callbacks).onError)==null||r.call(n,Ue.error(e.errorMsg,!0))}handleNonFatalError(e){var n,r;switch(e.type){case"screen-share-error":(r=(n=this._callbacks).onScreenShareError)==null||r.call(n,e.errorMsg);break}}}wn.RECORDER_SAMPLE_RATE=16e3,wn.RECORDER_CHUNK_SIZE=512;const Cr=t=>({id:t.user_id,local:t.local,name:t.user_name});var Yp={exports:{}},ue={};/**
343
+ use only for debugging`),l.connect(r.destination)),this.source=o,this.node=a,this.analyser=l,this.processor=s,!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return ti.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},n=8192){if(this.processor){if(this.recording)throw new Error("Already recording: HELLO please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=n,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");const n=await this._event("export");return new Wt().pack(this.sampleRate,n.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");const e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.log("Exporting ...");const n=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new Wt().pack(this.sampleRate,n.audio)}async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}}globalThis.WavRecorder=WavRecorder;var Yp={};Yp=JSON.parse('{"name":"@pipecat-ai/daily-transport","version":"1.6.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"src/index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web-transports.git"},"files":["dist","package.json","README.md"],"scripts":{"build":"parcel build --no-cache","dev":"parcel watch","lint":"eslint . --ext ts --report-unused-disable-directives --max-warnings 0"},"devDependencies":{"@pipecat-ai/client-js":"^1.6.0","eslint":"9.39.1","eslint-config-prettier":"^9.1.0","eslint-plugin-simple-import-sort":"^12.1.1"},"peerDependencies":{"@pipecat-ai/client-js":"~1.6.0"},"dependencies":{"@daily-co/daily-js":"^0.86.0"},"description":"Pipecat Daily Transport Package","author":"Daily.co","bugs":{"url":"https://github.com/pipecat-ai/pipecat-client-web-transports/issues"},"homepage":"https://github.com/pipecat-ai/pipecat-client-web-transports/blob/main/transports/daily-webrtc/README.md"}');var uc;(function(t){t.AUDIO_BUFFERING_STARTED="audio-buffering-started",t.AUDIO_BUFFERING_STOPPED="audio-buffering-stopped"})(uc||(uc={}));class vS{constructor(e){this._daily=e,this._proxy=new Proxy(this._daily,{get:(n,r,i)=>{if(typeof n[r]=="function"){let o;switch(String(r)){case"preAuth":o="Calls to preAuth() are disabled. Please use Transport.preAuth()";break;case"startCamera":o="Calls to startCamera() are disabled. Please use PipecatClient.initDevices()";break;case"join":o="Calls to join() are disabled. Please use PipecatClient.connect()";break;case"leave":o="Calls to leave() are disabled. Please use PipecatClient.disconnect()";break;case"destroy":o="Calls to destroy() are disabled.";break}return o?()=>{throw new Error(o)}:(...s)=>n[r](...s)}return Reflect.get(n,r,i)}})}get proxy(){return this._proxy}}class Sn extends rh{constructor(e={}){var i;super(),this._botId="",this._selectedCam={},this._selectedMic={},this._selectedSpeaker={},this._currentAudioTrack=null,this._audioQueue=[],this._callbacks={};const{bufferLocalAudioUntilBotReady:n,...r}=e;this._dailyFactoryOptions=r,typeof((i=this._dailyFactoryOptions.dailyConfig)==null?void 0:i.useDevicePreferenceCookies)>"u"&&(this._dailyFactoryOptions.dailyConfig==null&&(this._dailyFactoryOptions.dailyConfig={}),this._dailyFactoryOptions.dailyConfig.useDevicePreferenceCookies=!0),this._bufferLocalAudioUntilBotReady=n||!1,this._daily=iS.createCallObject({...this._dailyFactoryOptions,allowMultipleCallInstances:!0}),this._dailyWrapper=new vS(this._daily)}setupRecorder(){this._mediaStreamRecorder=new yS({sampleRate:Sn.RECORDER_SAMPLE_RATE})}handleUserAudioStream(e){this._audioQueue.push(e)}flushAudioQueue(){if(this._audioQueue.length!==0)for(fe.debug(`Will flush audio queue: ${this._audioQueue.length}`);this._audioQueue.length>0;){const n=[];for(;n.length<10&&this._audioQueue.length>0;){const r=this._audioQueue.shift();r&&n.push(r)}n.length>0&&this._sendAudioBatch(n)}}_sendAudioBatch(e){const r={id:"raw-audio-batch",label:"rtvi-ai",type:"raw-audio-batch",data:{base64AudioBatch:e.map(i=>{const o=new Uint8Array(i);return btoa(String.fromCharCode(...o))}),sampleRate:Sn.RECORDER_SAMPLE_RATE,numChannels:1}};this.sendMessage(r)}initialize(e,n){this._bufferLocalAudioUntilBotReady&&this.setupRecorder(),this._callbacks=e.callbacks??{},this._onMessage=n,(this._dailyFactoryOptions.startVideoOff==null||e.enableCam!=null)&&(this._dailyFactoryOptions.startVideoOff=!(e.enableCam??!1)),(this._dailyFactoryOptions.startAudioOff==null||e.enableMic!=null)&&(this._dailyFactoryOptions.startAudioOff=!(e.enableMic??!0)),this.attachEventListeners(),this.state="disconnected",fe.debug("[Daily Transport] Initialized",aS(Yp).version)}get dailyCallClient(){return this._dailyWrapper.proxy}get state(){return this._state}set state(e){var n,r;this._state!==e&&(this._state=e,(r=(n=this._callbacks).onTransportStateChanged)==null||r.call(n,e))}getSessionInfo(){return this._daily.meetingSessionSummary()}async getAllCams(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="videoinput")}updateCam(e){this._daily.setInputDevicesAsync({videoDeviceId:e}).then(n=>{this._selectedCam=n.camera})}get selectedCam(){return this._selectedCam}async getAllMics(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audioinput")}updateMic(e){this._daily.setInputDevicesAsync({audioDeviceId:e}).then(n=>{this._selectedMic=n.mic})}get selectedMic(){return this._selectedMic}async getAllSpeakers(){const{devices:e}=await this._daily.enumerateDevices();return e.filter(n=>n.kind==="audiooutput")}updateSpeaker(e){this._daily.setOutputDeviceAsync({outputDeviceId:e}).then(n=>{this._selectedSpeaker=n.speaker}).catch(n=>{var r,i;(i=(r=this._callbacks).onDeviceError)==null||i.call(r,new gn(["speaker"],n.type??"unknown",n.message))})}get selectedSpeaker(){return this._selectedSpeaker}enableMic(e){this._daily.setLocalAudio(e)}get isMicEnabled(){return this._daily.localAudio()}enableCam(e){this._daily.setLocalVideo(e)}get isCamEnabled(){return this._daily.localVideo()}enableScreenShare(e){e?this._daily.startScreenShare():this._daily.stopScreenShare()}get isSharingScreen(){return this._daily.localScreenAudio()||this._daily.localScreenVideo()}tracks(){var i,o,s,a,l,c,d,h,f,g,y,m,S,v,w,k;const e=this._daily.participants()??{},n=e==null?void 0:e[this._botId],r={local:{audio:(s=(o=(i=e==null?void 0:e.local)==null?void 0:i.tracks)==null?void 0:o.audio)==null?void 0:s.persistentTrack,screenAudio:(c=(l=(a=e==null?void 0:e.local)==null?void 0:a.tracks)==null?void 0:l.screenAudio)==null?void 0:c.persistentTrack,screenVideo:(f=(h=(d=e==null?void 0:e.local)==null?void 0:d.tracks)==null?void 0:h.screenVideo)==null?void 0:f.persistentTrack,video:(m=(y=(g=e==null?void 0:e.local)==null?void 0:g.tracks)==null?void 0:y.video)==null?void 0:m.persistentTrack}};return n&&(r.bot={audio:(v=(S=n==null?void 0:n.tracks)==null?void 0:S.audio)==null?void 0:v.persistentTrack,video:(k=(w=n==null?void 0:n.tracks)==null?void 0:w.video)==null?void 0:k.persistentTrack}),r}async startRecording(){var e,n;try{fe.info("[Daily Transport] Initializing recording"),await this._mediaStreamRecorder.record(r=>{this.handleUserAudioStream(r.mono)},Sn.RECORDER_CHUNK_SIZE),(n=(e=this._callbacks).onAudioBufferingStarted)==null||n.call(e),fe.info("[Daily Transport] Recording Initialized")}catch(r){r.message.includes("Already recording")||fe.error("Error starting recording",r)}}async preAuth(e){this._dailyFactoryOptions=e,await this._daily.preAuth(e)}async initDevices(){var s,a,l,c,d,h,f,g,y,m,S,v;if(!this._daily)throw new ht("Transport instance not initialized");this.state="initializing";const e=await this._daily.startCamera(this._dailyFactoryOptions),{devices:n}=await this._daily.enumerateDevices(),r=n.filter(w=>w.kind==="videoinput"),i=n.filter(w=>w.kind==="audioinput"),o=n.filter(w=>w.kind==="audiooutput");this._selectedCam=e.camera,this._selectedMic=e.mic,this._selectedSpeaker=e.speaker,(a=(s=this._callbacks).onAvailableCamsUpdated)==null||a.call(s,r),(c=(l=this._callbacks).onAvailableMicsUpdated)==null||c.call(l,i),(h=(d=this._callbacks).onAvailableSpeakersUpdated)==null||h.call(d,o),(g=(f=this._callbacks).onCamUpdated)==null||g.call(f,e.camera),(m=(y=this._callbacks).onMicUpdated)==null||m.call(y,e.mic),(v=(S=this._callbacks).onSpeakerUpdated)==null||v.call(S,e.speaker),this._daily.isLocalAudioLevelObserverRunning()||await this._daily.startLocalAudioLevelObserver(100),this._daily.isRemoteParticipantsAudioLevelObserverRunning()||await this._daily.startRemoteParticipantsAudioLevelObserver(100),this.state="initialized"}_validateConnectionParams(e){if(e==null)return;if(typeof e!="object")throw new ht("Invalid connection parameters");const n=e;return n.room_url?(n.url=n.room_url,delete n.room_url):n.dailyRoom&&(n.url=n.dailyRoom,delete n.dailyRoom),n.dailyToken&&(n.token=n.dailyToken,delete n.dailyToken),n.token||delete n.token,n}async _connect(e){var n,r,i;if(!this._daily)throw new ht("Transport instance not initialized");e&&(this._dailyFactoryOptions={...this._dailyFactoryOptions,...e}),this.state="connecting";try{await this._daily.join(this._dailyFactoryOptions)}catch(o){throw fe.error("Failed to join room",o),this.state="error",new Kd}(n=this._abortController)!=null&&n.signal.aborted||(this.state="connected",(i=(r=this._callbacks).onConnected)==null||i.call(r))}async sendReadyMessage(){return new Promise(e=>{var o,s;const n=()=>{const a=navigator.userAgent;return/iPad|iPhone|iPod/.test(a)||/Macintosh/.test(a)&&"ontouchend"in document},r=()=>{this.state="ready",this.flushAudioQueue(),this.sendMessage(Ue.clientReady()),this.stopRecording(),e()};for(const a in this._daily.participants()){const l=this._daily.participants()[a];if(!l.local&&((s=(o=l.tracks)==null?void 0:o.audio)!=null&&s.persistentTrack)){r(),e();return}}const i=a=>{var l;(l=a.participant)!=null&&l.local||(this._daily.off("track-started",i),n()?(fe.debug("[Daily Transport] iOS device detected, adding 0.5 second delay before sending ready message"),setTimeout(r,500)):r())};this._daily.on("track-started",i)})}stopRecording(){var e,n;this._mediaStreamRecorder&&this._mediaStreamRecorder.getStatus()!=="ended"&&(this._mediaStreamRecorder.end(),(n=(e=this._callbacks).onAudioBufferingStopped)==null||n.call(e))}attachEventListeners(){this._daily.on("available-devices-updated",this.handleAvailableDevicesUpdated.bind(this)),this._daily.on("selected-devices-updated",this.handleSelectedDevicesUpdated.bind(this)),this._daily.on("camera-error",this.handleDeviceError.bind(this)),this._daily.on("track-started",this.handleTrackStarted.bind(this)),this._daily.on("track-stopped",this.handleTrackStopped.bind(this)),this._daily.on("participant-joined",this.handleParticipantJoined.bind(this)),this._daily.on("participant-left",this.handleParticipantLeft.bind(this)),this._daily.on("local-audio-level",this.handleLocalAudioLevel.bind(this)),this._daily.on("remote-participants-audio-level",this.handleRemoteAudioLevel.bind(this)),this._daily.on("app-message",this.handleAppMessage.bind(this)),this._daily.on("left-meeting",this.handleLeftMeeting.bind(this)),this._daily.on("error",this.handleFatalError.bind(this)),this._daily.on("nonfatal-error",this.handleNonFatalError.bind(this))}async _disconnect(){this.state="disconnecting",this._daily.stopLocalAudioLevelObserver(),this._daily.stopRemoteParticipantsAudioLevelObserver(),this._audioQueue=[],this._currentAudioTrack=null,this.stopRecording(),await this._daily.leave()}sendMessage(e){this._daily.sendAppMessage(e,"*")}handleAppMessage(e){e.data.label==="rtvi-ai"&&this._onMessage({id:e.data.id,type:e.data.type,data:e.data.data})}handleAvailableDevicesUpdated(e){var n,r,i,o,s,a;(r=(n=this._callbacks).onAvailableCamsUpdated)==null||r.call(n,e.availableDevices.filter(l=>l.kind==="videoinput")),(o=(i=this._callbacks).onAvailableMicsUpdated)==null||o.call(i,e.availableDevices.filter(l=>l.kind==="audioinput")),(a=(s=this._callbacks).onAvailableSpeakersUpdated)==null||a.call(s,e.availableDevices.filter(l=>l.kind==="audiooutput"))}handleSelectedDevicesUpdated(e){var n,r,i,o,s,a,l,c,d;((n=this._selectedCam)==null?void 0:n.deviceId)!==e.devices.camera&&(this._selectedCam=e.devices.camera,(i=(r=this._callbacks).onCamUpdated)==null||i.call(r,e.devices.camera)),((o=this._selectedMic)==null?void 0:o.deviceId)!==e.devices.mic&&(this._selectedMic=e.devices.mic,(a=(s=this._callbacks).onMicUpdated)==null||a.call(s,e.devices.mic)),((l=this._selectedSpeaker)==null?void 0:l.deviceId)!==e.devices.speaker&&(this._selectedSpeaker=e.devices.speaker,(d=(c=this._callbacks).onSpeakerUpdated)==null||d.call(c,e.devices.speaker))}handleDeviceError(e){var r,i;const n=o=>{const s=[];switch(o.type){case"permissions":return o.blockedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new gn(s,o.type,o.msg,{blockedBy:o.blockedBy});case"not-found":return o.missingMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new gn(s,o.type,o.msg);case"constraints":return o.failedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new gn(s,o.type,o.msg,{reason:o.reason});case"cam-in-use":return s.push("cam"),new gn(s,"in-use",o.msg);case"mic-in-use":return s.push("mic"),new gn(s,"in-use",o.msg);case"cam-mic-in-use":return s.push("cam"),s.push("mic"),new gn(s,"in-use",o.msg);case"undefined-mediadevices":case"unknown":default:return s.push("cam"),s.push("mic"),new gn(s,o.type,o.msg)}};(i=(r=this._callbacks).onDeviceError)==null||i.call(r,n(e.error))}async handleLocalAudioTrack(e){if(this.state=="ready"||!this._bufferLocalAudioUntilBotReady)return;switch(this._mediaStreamRecorder.getStatus()){case"ended":try{await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}break;case"paused":await this.startRecording();break;case"recording":default:if(this._currentAudioTrack!==e)try{await this._mediaStreamRecorder.end(),await this._mediaStreamRecorder.begin(e),await this.startRecording()}catch{}else fe.warn("track-started event received for current track and already recording");break}this._currentAudioTrack=e}handleTrackStarted(e){var n,r,i,o,s;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStarted)==null||r.call(n,e.track,e.participant?Cr(e.participant):void 0):((i=e.participant)!=null&&i.local&&e.track.kind==="audio"&&this.handleLocalAudioTrack(e.track),(s=(o=this._callbacks).onTrackStarted)==null||s.call(o,e.track,e.participant?Cr(e.participant):void 0))}handleTrackStopped(e){var n,r,i,o;e.type==="screenAudio"||e.type==="screenVideo"?(r=(n=this._callbacks).onScreenTrackStopped)==null||r.call(n,e.track,e.participant?Cr(e.participant):void 0):(o=(i=this._callbacks).onTrackStopped)==null||o.call(i,e.track,e.participant?Cr(e.participant):void 0)}handleParticipantJoined(e){var r,i,o,s;const n=Cr(e.participant);(i=(r=this._callbacks).onParticipantJoined)==null||i.call(r,n),!n.local&&(this._botId=e.participant.session_id,(s=(o=this._callbacks).onBotConnected)==null||s.call(o,n))}handleParticipantLeft(e){var r,i,o,s;const n=Cr(e.participant);(i=(r=this._callbacks).onParticipantLeft)==null||i.call(r,n),!n.local&&(this._botId="",(s=(o=this._callbacks).onBotDisconnected)==null||s.call(o,n))}handleLocalAudioLevel(e){var n,r;(r=(n=this._callbacks).onLocalAudioLevel)==null||r.call(n,e.audioLevel)}handleRemoteAudioLevel(e){var i,o;const n=this._daily.participants(),r=Object.keys(e.participantsAudioLevel);for(let s=0;s<r.length;s++){const a=r[s],l=e.participantsAudioLevel[a];(o=(i=this._callbacks).onRemoteAudioLevel)==null||o.call(i,l,Cr(n[a]))}}handleLeftMeeting(){var e,n;this.state="disconnected",this._botId="",(n=(e=this._callbacks).onDisconnected)==null||n.call(e)}handleFatalError(e){var n,r;fe.error("Daily fatal error",e.errorMsg),this.state="error",this._botId="",(r=(n=this._callbacks).onError)==null||r.call(n,Ue.error(e.errorMsg,!0))}handleNonFatalError(e){var n,r;switch(e.type){case"screen-share-error":(r=(n=this._callbacks).onScreenShareError)==null||r.call(n,e.errorMsg);break}}}Sn.RECORDER_SAMPLE_RATE=16e3,Sn.RECORDER_CHUNK_SIZE=512;const Cr=t=>({id:t.user_id,local:t.local,name:t.user_name});var Xp={exports:{}},ue={};/**
344
344
  * @license React
345
345
  * react.production.min.js
346
346
  *
@@ -348,7 +348,7 @@ use only for debugging`),l.connect(r.destination)),this.source=o,this.node=a,thi
348
348
  *
349
349
  * This source code is licensed under the MIT license found in the
350
350
  * LICENSE file in the root directory of this source tree.
351
- */var qi=Symbol.for("react.element"),bS=Symbol.for("react.portal"),wS=Symbol.for("react.fragment"),SS=Symbol.for("react.strict_mode"),kS=Symbol.for("react.profiler"),xS=Symbol.for("react.provider"),_S=Symbol.for("react.context"),CS=Symbol.for("react.forward_ref"),ES=Symbol.for("react.suspense"),TS=Symbol.for("react.memo"),MS=Symbol.for("react.lazy"),Xp=Symbol.iterator;function AS(t){return t===null||typeof t!="object"?null:(t=Xp&&t[Xp]||t["@@iterator"],typeof t=="function"?t:null)}var Zp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},eg=Object.assign,tg={};function ni(t,e,n){this.props=t,this.context=e,this.refs=tg,this.updater=n||Zp}ni.prototype.isReactComponent={},ni.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")},ni.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function ng(){}ng.prototype=ni.prototype;function dc(t,e,n){this.props=t,this.context=e,this.refs=tg,this.updater=n||Zp}var hc=dc.prototype=new ng;hc.constructor=dc,eg(hc,ni.prototype),hc.isPureReactComponent=!0;var rg=Array.isArray,ig=Object.prototype.hasOwnProperty,fc={current:null},og={key:!0,ref:!0,__self:!0,__source:!0};function sg(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)ig.call(e,r)&&!og.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:qi,type:t,key:o,ref:s,props:i,_owner:fc.current}}function OS(t,e){return{$$typeof:qi,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function pc(t){return typeof t=="object"&&t!==null&&t.$$typeof===qi}function DS(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var ag=/\/+/g;function gc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?DS(""+t.key):e.toString(36)}function Ds(t,e,n,r,i){var o=typeof t;(o==="undefined"||o==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(o){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case qi:case bS:s=!0}}if(s)return s=t,i=i(s),t=r===""?"."+gc(s,0):r,rg(i)?(n="",t!=null&&(n=t.replace(ag,"$&/")+"/"),Ds(i,e,n,"",function(c){return c})):i!=null&&(pc(i)&&(i=OS(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(ag,"$&/")+"/")+t)),e.push(i)),1;if(s=0,r=r===""?".":r+":",rg(t))for(var a=0;a<t.length;a++){o=t[a];var l=r+gc(o,a);s+=Ds(o,e,n,l,i)}else if(l=AS(t),typeof l=="function")for(t=l.call(t),a=0;!(o=t.next()).done;)o=o.value,l=r+gc(o,a++),s+=Ds(o,e,n,l,i);else if(o==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function Ps(t,e,n){if(t==null)return t;var r=[],i=0;return Ds(t,r,"","",function(o){return e.call(n,o,i++)}),r}function PS(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var st={current:null},Ls={transition:null},LS={ReactCurrentDispatcher:st,ReactCurrentBatchConfig:Ls,ReactCurrentOwner:fc};function lg(){throw Error("act(...) is not supported in production builds of React.")}ue.Children={map:Ps,forEach:function(t,e,n){Ps(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Ps(t,function(){e++}),e},toArray:function(t){return Ps(t,function(e){return e})||[]},only:function(t){if(!pc(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},ue.Component=ni,ue.Fragment=wS,ue.Profiler=kS,ue.PureComponent=dc,ue.StrictMode=SS,ue.Suspense=ES,ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=LS,ue.act=lg,ue.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=eg({},t.props),i=t.key,o=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,s=fc.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)ig.call(e,l)&&!og.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:qi,type:t.type,key:i,ref:o,props:r,_owner:s}},ue.createContext=function(t){return t={$$typeof:_S,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:xS,_context:t},t.Consumer=t},ue.createElement=sg,ue.createFactory=function(t){var e=sg.bind(null,t);return e.type=t,e},ue.createRef=function(){return{current:null}},ue.forwardRef=function(t){return{$$typeof:CS,render:t}},ue.isValidElement=pc,ue.lazy=function(t){return{$$typeof:MS,_payload:{_status:-1,_result:t},_init:PS}},ue.memo=function(t,e){return{$$typeof:TS,type:t,compare:e===void 0?null:e}},ue.startTransition=function(t){var e=Ls.transition;Ls.transition={};try{t()}finally{Ls.transition=e}},ue.unstable_act=lg,ue.useCallback=function(t,e){return st.current.useCallback(t,e)},ue.useContext=function(t){return st.current.useContext(t)},ue.useDebugValue=function(){},ue.useDeferredValue=function(t){return st.current.useDeferredValue(t)},ue.useEffect=function(t,e){return st.current.useEffect(t,e)},ue.useId=function(){return st.current.useId()},ue.useImperativeHandle=function(t,e,n){return st.current.useImperativeHandle(t,e,n)},ue.useInsertionEffect=function(t,e){return st.current.useInsertionEffect(t,e)},ue.useLayoutEffect=function(t,e){return st.current.useLayoutEffect(t,e)},ue.useMemo=function(t,e){return st.current.useMemo(t,e)},ue.useReducer=function(t,e,n){return st.current.useReducer(t,e,n)},ue.useRef=function(t){return st.current.useRef(t)},ue.useState=function(t){return st.current.useState(t)},ue.useSyncExternalStore=function(t,e,n){return st.current.useSyncExternalStore(t,e,n)},ue.useTransition=function(){return st.current.useTransition()},ue.version="18.3.1",Yp.exports=ue;var oe=Yp.exports;const cg=en(oe);var mc={},ug={exports:{}},kt={},dg={exports:{}},hg={};/**
351
+ */var qi=Symbol.for("react.element"),bS=Symbol.for("react.portal"),wS=Symbol.for("react.fragment"),SS=Symbol.for("react.strict_mode"),kS=Symbol.for("react.profiler"),xS=Symbol.for("react.provider"),_S=Symbol.for("react.context"),CS=Symbol.for("react.forward_ref"),ES=Symbol.for("react.suspense"),TS=Symbol.for("react.memo"),MS=Symbol.for("react.lazy"),Zp=Symbol.iterator;function AS(t){return t===null||typeof t!="object"?null:(t=Zp&&t[Zp]||t["@@iterator"],typeof t=="function"?t:null)}var eg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tg=Object.assign,ng={};function ni(t,e,n){this.props=t,this.context=e,this.refs=ng,this.updater=n||eg}ni.prototype.isReactComponent={},ni.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")},ni.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function rg(){}rg.prototype=ni.prototype;function dc(t,e,n){this.props=t,this.context=e,this.refs=ng,this.updater=n||eg}var hc=dc.prototype=new rg;hc.constructor=dc,tg(hc,ni.prototype),hc.isPureReactComponent=!0;var ig=Array.isArray,og=Object.prototype.hasOwnProperty,fc={current:null},sg={key:!0,ref:!0,__self:!0,__source:!0};function ag(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)og.call(e,r)&&!sg.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:qi,type:t,key:o,ref:s,props:i,_owner:fc.current}}function OS(t,e){return{$$typeof:qi,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function pc(t){return typeof t=="object"&&t!==null&&t.$$typeof===qi}function DS(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var lg=/\/+/g;function gc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?DS(""+t.key):e.toString(36)}function Ds(t,e,n,r,i){var o=typeof t;(o==="undefined"||o==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(o){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case qi:case bS:s=!0}}if(s)return s=t,i=i(s),t=r===""?"."+gc(s,0):r,ig(i)?(n="",t!=null&&(n=t.replace(lg,"$&/")+"/"),Ds(i,e,n,"",function(c){return c})):i!=null&&(pc(i)&&(i=OS(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(lg,"$&/")+"/")+t)),e.push(i)),1;if(s=0,r=r===""?".":r+":",ig(t))for(var a=0;a<t.length;a++){o=t[a];var l=r+gc(o,a);s+=Ds(o,e,n,l,i)}else if(l=AS(t),typeof l=="function")for(t=l.call(t),a=0;!(o=t.next()).done;)o=o.value,l=r+gc(o,a++),s+=Ds(o,e,n,l,i);else if(o==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function Ls(t,e,n){if(t==null)return t;var r=[],i=0;return Ds(t,r,"","",function(o){return e.call(n,o,i++)}),r}function LS(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var at={current:null},Ps={transition:null},PS={ReactCurrentDispatcher:at,ReactCurrentBatchConfig:Ps,ReactCurrentOwner:fc};function cg(){throw Error("act(...) is not supported in production builds of React.")}ue.Children={map:Ls,forEach:function(t,e,n){Ls(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Ls(t,function(){e++}),e},toArray:function(t){return Ls(t,function(e){return e})||[]},only:function(t){if(!pc(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},ue.Component=ni,ue.Fragment=wS,ue.Profiler=kS,ue.PureComponent=dc,ue.StrictMode=SS,ue.Suspense=ES,ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=PS,ue.act=cg,ue.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=tg({},t.props),i=t.key,o=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,s=fc.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)og.call(e,l)&&!sg.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:qi,type:t.type,key:i,ref:o,props:r,_owner:s}},ue.createContext=function(t){return t={$$typeof:_S,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:xS,_context:t},t.Consumer=t},ue.createElement=ag,ue.createFactory=function(t){var e=ag.bind(null,t);return e.type=t,e},ue.createRef=function(){return{current:null}},ue.forwardRef=function(t){return{$$typeof:CS,render:t}},ue.isValidElement=pc,ue.lazy=function(t){return{$$typeof:MS,_payload:{_status:-1,_result:t},_init:LS}},ue.memo=function(t,e){return{$$typeof:TS,type:t,compare:e===void 0?null:e}},ue.startTransition=function(t){var e=Ps.transition;Ps.transition={};try{t()}finally{Ps.transition=e}},ue.unstable_act=cg,ue.useCallback=function(t,e){return at.current.useCallback(t,e)},ue.useContext=function(t){return at.current.useContext(t)},ue.useDebugValue=function(){},ue.useDeferredValue=function(t){return at.current.useDeferredValue(t)},ue.useEffect=function(t,e){return at.current.useEffect(t,e)},ue.useId=function(){return at.current.useId()},ue.useImperativeHandle=function(t,e,n){return at.current.useImperativeHandle(t,e,n)},ue.useInsertionEffect=function(t,e){return at.current.useInsertionEffect(t,e)},ue.useLayoutEffect=function(t,e){return at.current.useLayoutEffect(t,e)},ue.useMemo=function(t,e){return at.current.useMemo(t,e)},ue.useReducer=function(t,e,n){return at.current.useReducer(t,e,n)},ue.useRef=function(t){return at.current.useRef(t)},ue.useState=function(t){return at.current.useState(t)},ue.useSyncExternalStore=function(t,e,n){return at.current.useSyncExternalStore(t,e,n)},ue.useTransition=function(){return at.current.useTransition()},ue.version="18.3.1",Xp.exports=ue;var se=Xp.exports;const ug=tn(se);var mc={},dg={exports:{}},kt={},hg={exports:{}},fg={};/**
352
352
  * @license React
353
353
  * scheduler.production.min.js
354
354
  *
@@ -356,7 +356,7 @@ use only for debugging`),l.connect(r.destination)),this.source=o,this.node=a,thi
356
356
  *
357
357
  * This source code is licensed under the MIT license found in the
358
358
  * LICENSE file in the root directory of this source tree.
359
- */(function(t){function e(j,z){var B=j.length;j.push(z);e:for(;0<B;){var le=B-1>>>1,we=j[le];if(0<i(we,z))j[le]=z,j[B]=we,B=le;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var z=j[0],B=j.pop();if(B!==z){j[0]=B;e:for(var le=0,we=j.length,u=we>>>1;le<u;){var y=2*(le+1)-1,p=j[y],x=y+1,_=j[x];if(0>i(p,B))x<we&&0>i(_,p)?(j[le]=_,j[x]=B,le=x):(j[le]=p,j[y]=B,le=y);else if(x<we&&0>i(_,B))j[le]=_,j[x]=B,le=x;else break e}}return z}function i(j,z){var B=j.sortIndex-z.sortIndex;return B!==0?B:j.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var l=[],c=[],d=1,h=null,f=3,v=!1,b=!1,g=!1,S=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(j){for(var z=n(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=j)r(c),z.sortIndex=z.expirationTime,e(l,z);else break;z=n(c)}}function C(j){if(g=!1,k(j),!b)if(n(l)!==null)b=!0,K(M);else{var z=n(c);z!==null&&re(C,z.startTime-j)}}function M(j,z){b=!1,g&&(g=!1,m(F),F=-1),v=!0;var B=f;try{for(k(z),h=n(l);h!==null&&(!(h.expirationTime>z)||j&&!H());){var le=h.callback;if(typeof le=="function"){h.callback=null,f=h.priorityLevel;var we=le(h.expirationTime<=z);z=t.unstable_now(),typeof we=="function"?h.callback=we:h===n(l)&&r(l),k(z)}else r(l);h=n(l)}if(h!==null)var u=!0;else{var y=n(c);y!==null&&re(C,y.startTime-z),u=!1}return u}finally{h=null,f=B,v=!1}}var P=!1,L=null,F=-1,Y=5,W=-1;function H(){return!(t.unstable_now()-W<Y)}function Q(){if(L!==null){var j=t.unstable_now();W=j;var z=!0;try{z=L(!0,j)}finally{z?q():(P=!1,L=null)}}else P=!1}var q;if(typeof w=="function")q=function(){w(Q)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,J=ae.port2;ae.port1.onmessage=Q,q=function(){J.postMessage(null)}}else q=function(){S(Q,0)};function K(j){L=j,P||(P=!0,q())}function re(j,z){F=S(function(){j(t.unstable_now())},z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_continueExecution=function(){b||v||(b=!0,K(M))},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(j){switch(f){case 1:case 2:case 3:var z=3;break;default:z=f}var B=f;f=z;try{return j()}finally{f=B}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(j,z){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var B=f;f=j;try{return z()}finally{f=B}},t.unstable_scheduleCallback=function(j,z,B){var le=t.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?le+B:le):B=le,j){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=B+we,j={id:d++,callback:z,priorityLevel:j,startTime:B,expirationTime:we,sortIndex:-1},B>le?(j.sortIndex=B,e(c,j),n(l)===null&&j===n(c)&&(g?(m(F),F=-1):g=!0,re(C,B-le))):(j.sortIndex=we,e(l,j),b||v||(b=!0,K(M))),j},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(j){var z=f;return function(){var B=f;f=z;try{return j.apply(this,arguments)}finally{f=B}}}})(hg),dg.exports=hg;var IS=dg.exports;/**
359
+ */(function(t){function e(B,q){var z=B.length;B.push(q);e:for(;0<z;){var le=z-1>>>1,we=B[le];if(0<i(we,q))B[le]=q,B[z]=we,z=le;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var q=B[0],z=B.pop();if(z!==q){B[0]=z;e:for(var le=0,we=B.length,u=we>>>1;le<u;){var b=2*(le+1)-1,p=B[b],x=b+1,_=B[x];if(0>i(p,z))x<we&&0>i(_,p)?(B[le]=_,B[x]=z,le=x):(B[le]=p,B[b]=z,le=b);else if(x<we&&0>i(_,z))B[le]=_,B[x]=z,le=x;else break e}}return q}function i(B,q){var z=B.sortIndex-q.sortIndex;return z!==0?z:B.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var l=[],c=[],d=1,h=null,f=3,g=!1,y=!1,m=!1,S=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(B){for(var q=n(c);q!==null;){if(q.callback===null)r(c);else if(q.startTime<=B)r(c),q.sortIndex=q.expirationTime,e(l,q);else break;q=n(c)}}function C(B){if(m=!1,k(B),!y)if(n(l)!==null)y=!0,V(E);else{var q=n(c);q!==null&&X(C,q.startTime-B)}}function E(B,q){y=!1,m&&(m=!1,v(R),R=-1),g=!0;var z=f;try{for(k(q),h=n(l);h!==null&&(!(h.expirationTime>q)||B&&!K());){var le=h.callback;if(typeof le=="function"){h.callback=null,f=h.priorityLevel;var we=le(h.expirationTime<=q);q=t.unstable_now(),typeof we=="function"?h.callback=we:h===n(l)&&r(l),k(q)}else r(l);h=n(l)}if(h!==null)var u=!0;else{var b=n(c);b!==null&&X(C,b.startTime-q),u=!1}return u}finally{h=null,f=z,g=!1}}var L=!1,A=null,R=-1,G=5,U=-1;function K(){return!(t.unstable_now()-U<G)}function j(){if(A!==null){var B=t.unstable_now();U=B;var q=!0;try{q=A(!0,B)}finally{q?H():(L=!1,A=null)}}else L=!1}var H;if(typeof w=="function")H=function(){w(j)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,Q=ie.port2;ie.port1.onmessage=j,H=function(){Q.postMessage(null)}}else H=function(){S(j,0)};function V(B){A=B,L||(L=!0,H())}function X(B,q){R=S(function(){B(t.unstable_now())},q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){y||g||(y=!0,V(E))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(B){switch(f){case 1:case 2:case 3:var q=3;break;default:q=f}var z=f;f=q;try{return B()}finally{f=z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,q){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var z=f;f=B;try{return q()}finally{f=z}},t.unstable_scheduleCallback=function(B,q,z){var le=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?le+z:le):z=le,B){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=z+we,B={id:d++,callback:q,priorityLevel:B,startTime:z,expirationTime:we,sortIndex:-1},z>le?(B.sortIndex=z,e(c,B),n(l)===null&&B===n(c)&&(m?(v(R),R=-1):m=!0,X(C,z-le))):(B.sortIndex=we,e(l,B),y||g||(y=!0,V(E))),B},t.unstable_shouldYield=K,t.unstable_wrapCallback=function(B){var q=f;return function(){var z=f;f=q;try{return B.apply(this,arguments)}finally{f=z}}}})(fg),hg.exports=fg;var IS=hg.exports;/**
360
360
  * @license React
361
361
  * react-dom.production.min.js
362
362
  *
@@ -364,14 +364,14 @@ use only for debugging`),l.connect(r.destination)),this.source=o,this.node=a,thi
364
364
  *
365
365
  * This source code is licensed under the MIT license found in the
366
366
  * LICENSE file in the root directory of this source tree.
367
- */var RS=oe,xt=IS;function N(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var fg=new Set,Ji={};function Er(t,e){ri(t,e),ri(t+"Capture",e)}function ri(t,e){for(Ji[t]=e,t=0;t<e.length;t++)fg.add(e[t])}var Sn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yc=Object.prototype.hasOwnProperty,NS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,pg={},gg={};function $S(t){return yc.call(gg,t)?!0:yc.call(pg,t)?!1:NS.test(t)?gg[t]=!0:(pg[t]=!0,!1)}function FS(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function jS(t,e,n,r){if(e===null||typeof e>"u"||FS(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function at(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){qe[t]=new at(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];qe[e]=new at(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){qe[t]=new at(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){qe[t]=new at(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){qe[t]=new at(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){qe[t]=new at(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){qe[t]=new at(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){qe[t]=new at(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){qe[t]=new at(t,5,!1,t.toLowerCase(),null,!1,!1)});var vc=/[\-:]([a-z])/g;function bc(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(vc,bc);qe[e]=new at(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(vc,bc);qe[e]=new at(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(vc,bc);qe[e]=new at(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){qe[t]=new at(t,1,!1,t.toLowerCase(),null,!1,!1)}),qe.xlinkHref=new at("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){qe[t]=new at(t,1,!1,t.toLowerCase(),null,!0,!0)});function wc(t,e,n,r){var i=qe.hasOwnProperty(e)?qe[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(jS(e,n,i,r)&&(n=null),r||i===null?$S(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var kn=RS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Is=Symbol.for("react.element"),ii=Symbol.for("react.portal"),oi=Symbol.for("react.fragment"),Sc=Symbol.for("react.strict_mode"),kc=Symbol.for("react.profiler"),mg=Symbol.for("react.provider"),yg=Symbol.for("react.context"),xc=Symbol.for("react.forward_ref"),_c=Symbol.for("react.suspense"),Cc=Symbol.for("react.suspense_list"),Ec=Symbol.for("react.memo"),Vn=Symbol.for("react.lazy"),vg=Symbol.for("react.offscreen"),bg=Symbol.iterator;function Gi(t){return t===null||typeof t!="object"?null:(t=bg&&t[bg]||t["@@iterator"],typeof t=="function"?t:null)}var De=Object.assign,Tc;function Qi(t){if(Tc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Tc=e&&e[1]||""}return`
367
+ */var RS=se,xt=IS;function $(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var pg=new Set,Ji={};function Er(t,e){ri(t,e),ri(t+"Capture",e)}function ri(t,e){for(Ji[t]=e,t=0;t<e.length;t++)pg.add(e[t])}var kn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yc=Object.prototype.hasOwnProperty,NS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,gg={},mg={};function $S(t){return yc.call(mg,t)?!0:yc.call(gg,t)?!1:NS.test(t)?mg[t]=!0:(gg[t]=!0,!1)}function FS(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function jS(t,e,n,r){if(e===null||typeof e>"u"||FS(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function lt(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){qe[t]=new lt(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];qe[e]=new lt(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){qe[t]=new lt(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){qe[t]=new lt(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){qe[t]=new lt(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){qe[t]=new lt(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){qe[t]=new lt(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){qe[t]=new lt(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){qe[t]=new lt(t,5,!1,t.toLowerCase(),null,!1,!1)});var vc=/[\-:]([a-z])/g;function bc(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(vc,bc);qe[e]=new lt(e,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(vc,bc);qe[e]=new lt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(vc,bc);qe[e]=new lt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){qe[t]=new lt(t,1,!1,t.toLowerCase(),null,!1,!1)}),qe.xlinkHref=new lt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){qe[t]=new lt(t,1,!1,t.toLowerCase(),null,!0,!0)});function wc(t,e,n,r){var i=qe.hasOwnProperty(e)?qe[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(jS(e,n,i,r)&&(n=null),r||i===null?$S(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var xn=RS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Is=Symbol.for("react.element"),ii=Symbol.for("react.portal"),oi=Symbol.for("react.fragment"),Sc=Symbol.for("react.strict_mode"),kc=Symbol.for("react.profiler"),yg=Symbol.for("react.provider"),vg=Symbol.for("react.context"),xc=Symbol.for("react.forward_ref"),_c=Symbol.for("react.suspense"),Cc=Symbol.for("react.suspense_list"),Ec=Symbol.for("react.memo"),Vn=Symbol.for("react.lazy"),bg=Symbol.for("react.offscreen"),wg=Symbol.iterator;function Gi(t){return t===null||typeof t!="object"?null:(t=wg&&t[wg]||t["@@iterator"],typeof t=="function"?t:null)}var De=Object.assign,Tc;function Qi(t){if(Tc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Tc=e&&e[1]||""}return`
368
368
  `+Tc+t}var Mc=!1;function Ac(t,e){if(!t||Mc)return"";Mc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
369
369
  `),o=r.stack.split(`
370
370
  `),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(s!==1||a!==1)do if(s--,a--,0>a||i[s]!==o[a]){var l=`
371
- `+i[s].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{Mc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Qi(t):""}function BS(t){switch(t.tag){case 5:return Qi(t.type);case 16:return Qi("Lazy");case 13:return Qi("Suspense");case 19:return Qi("SuspenseList");case 0:case 2:case 15:return t=Ac(t.type,!1),t;case 11:return t=Ac(t.type.render,!1),t;case 1:return t=Ac(t.type,!0),t;default:return""}}function Oc(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case oi:return"Fragment";case ii:return"Portal";case kc:return"Profiler";case Sc:return"StrictMode";case _c:return"Suspense";case Cc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case yg:return(t.displayName||"Context")+".Consumer";case mg:return(t._context.displayName||"Context")+".Provider";case xc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ec:return e=t.displayName||null,e!==null?e:Oc(t.type)||"Memo";case Vn:e=t._payload,t=t._init;try{return Oc(t(e))}catch{}}return null}function US(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Oc(e);case 8:return e===Sc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Kn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function wg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function zS(t){var e=wg(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Rs(t){t._valueTracker||(t._valueTracker=zS(t))}function Sg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=wg(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ns(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Dc(t,e){var n=e.checked;return De({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function kg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Kn(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function xg(t,e){e=e.checked,e!=null&&wc(t,"checked",e,!1)}function Pc(t,e){xg(t,e);var n=Kn(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Lc(t,e.type,n):e.hasOwnProperty("defaultValue")&&Lc(t,e.type,Kn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function _g(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Lc(t,e,n){(e!=="number"||Ns(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Yi=Array.isArray;function si(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Kn(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Ic(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(N(91));return De({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Cg(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(N(92));if(Yi(n)){if(1<n.length)throw Error(N(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Kn(n)}}function Eg(t,e){var n=Kn(e.value),r=Kn(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Tg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Mg(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Rc(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Mg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var $s,Ag=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for($s=$s||document.createElement("div"),$s.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=$s.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Xi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Zi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},HS=["Webkit","ms","Moz","O"];Object.keys(Zi).forEach(function(t){HS.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zi[e]=Zi[t]})});function Og(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Zi.hasOwnProperty(t)&&Zi[t]?(""+e).trim():e+"px"}function Dg(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Og(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var VS=De({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Nc(t,e){if(e){if(VS[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(N(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(N(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(N(61))}if(e.style!=null&&typeof e.style!="object")throw Error(N(62))}}function $c(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Fc=null;function jc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Bc=null,ai=null,li=null;function Pg(t){if(t=ko(t)){if(typeof Bc!="function")throw Error(N(280));var e=t.stateNode;e&&(e=sa(e),Bc(t.stateNode,t.type,e))}}function Lg(t){ai?li?li.push(t):li=[t]:ai=t}function Ig(){if(ai){var t=ai,e=li;if(li=ai=null,Pg(t),e)for(t=0;t<e.length;t++)Pg(e[t])}}function Rg(t,e){return t(e)}function Ng(){}var Uc=!1;function $g(t,e,n){if(Uc)return t(e,n);Uc=!0;try{return Rg(t,e,n)}finally{Uc=!1,(ai!==null||li!==null)&&(Ng(),Ig())}}function eo(t,e){var n=t.stateNode;if(n===null)return null;var r=sa(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(N(231,e,typeof n));return n}var zc=!1;if(Sn)try{var to={};Object.defineProperty(to,"passive",{get:function(){zc=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{zc=!1}function KS(t,e,n,r,i,o,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(d){this.onError(d)}}var no=!1,Fs=null,js=!1,Hc=null,WS={onError:function(t){no=!0,Fs=t}};function qS(t,e,n,r,i,o,s,a,l){no=!1,Fs=null,KS.apply(WS,arguments)}function JS(t,e,n,r,i,o,s,a,l){if(qS.apply(this,arguments),no){if(no){var c=Fs;no=!1,Fs=null}else throw Error(N(198));js||(js=!0,Hc=c)}}function Tr(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function Fg(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function jg(t){if(Tr(t)!==t)throw Error(N(188))}function GS(t){var e=t.alternate;if(!e){if(e=Tr(t),e===null)throw Error(N(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return jg(i),t;if(o===r)return jg(i),e;o=o.sibling}throw Error(N(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s){for(a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s)throw Error(N(189))}}if(n.alternate!==r)throw Error(N(190))}if(n.tag!==3)throw Error(N(188));return n.stateNode.current===n?t:e}function Bg(t){return t=GS(t),t!==null?Ug(t):null}function Ug(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Ug(t);if(e!==null)return e;t=t.sibling}return null}var zg=xt.unstable_scheduleCallback,Hg=xt.unstable_cancelCallback,QS=xt.unstable_shouldYield,YS=xt.unstable_requestPaint,Ne=xt.unstable_now,XS=xt.unstable_getCurrentPriorityLevel,Vc=xt.unstable_ImmediatePriority,Vg=xt.unstable_UserBlockingPriority,Bs=xt.unstable_NormalPriority,ZS=xt.unstable_LowPriority,Kg=xt.unstable_IdlePriority,Us=null,sn=null;function ek(t){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(Us,t,void 0,(t.current.flags&128)===128)}catch{}}var Wt=Math.clz32?Math.clz32:rk,tk=Math.log,nk=Math.LN2;function rk(t){return t>>>=0,t===0?32:31-(tk(t)/nk|0)|0}var zs=64,Hs=4194304;function ro(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Vs(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=ro(a):(o&=s,o!==0&&(r=ro(o)))}else s=n&~i,s!==0?r=ro(s):o!==0&&(r=ro(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Wt(e),i=1<<n,r|=t[n],e&=~i;return r}function ik(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ok(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-Wt(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=ik(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}function Kc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Wg(){var t=zs;return zs<<=1,!(zs&4194240)&&(zs=64),t}function Wc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function io(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wt(e),t[e]=n}function sk(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-Wt(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function qc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Wt(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var Se=0;function qg(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Jg,Jc,Gg,Qg,Yg,Gc=!1,Ks=[],Wn=null,qn=null,Jn=null,oo=new Map,so=new Map,Gn=[],ak="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xg(t,e){switch(t){case"focusin":case"focusout":Wn=null;break;case"dragenter":case"dragleave":qn=null;break;case"mouseover":case"mouseout":Jn=null;break;case"pointerover":case"pointerout":oo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":so.delete(e.pointerId)}}function ao(t,e,n,r,i,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},e!==null&&(e=ko(e),e!==null&&Jc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function lk(t,e,n,r,i){switch(e){case"focusin":return Wn=ao(Wn,t,e,n,r,i),!0;case"dragenter":return qn=ao(qn,t,e,n,r,i),!0;case"mouseover":return Jn=ao(Jn,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return oo.set(o,ao(oo.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,so.set(o,ao(so.get(o)||null,t,e,n,r,i)),!0}return!1}function Zg(t){var e=Mr(t.target);if(e!==null){var n=Tr(e);if(n!==null){if(e=n.tag,e===13){if(e=Fg(n),e!==null){t.blockedOn=e,Yg(t.priority,function(){Gg(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ws(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Yc(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Fc=r,n.target.dispatchEvent(r),Fc=null}else return e=ko(n),e!==null&&Jc(e),t.blockedOn=n,!1;e.shift()}return!0}function em(t,e,n){Ws(t)&&n.delete(e)}function ck(){Gc=!1,Wn!==null&&Ws(Wn)&&(Wn=null),qn!==null&&Ws(qn)&&(qn=null),Jn!==null&&Ws(Jn)&&(Jn=null),oo.forEach(em),so.forEach(em)}function lo(t,e){t.blockedOn===e&&(t.blockedOn=null,Gc||(Gc=!0,xt.unstable_scheduleCallback(xt.unstable_NormalPriority,ck)))}function co(t){function e(i){return lo(i,t)}if(0<Ks.length){lo(Ks[0],t);for(var n=1;n<Ks.length;n++){var r=Ks[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Wn!==null&&lo(Wn,t),qn!==null&&lo(qn,t),Jn!==null&&lo(Jn,t),oo.forEach(e),so.forEach(e),n=0;n<Gn.length;n++)r=Gn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Gn.length&&(n=Gn[0],n.blockedOn===null);)Zg(n),n.blockedOn===null&&Gn.shift()}var ci=kn.ReactCurrentBatchConfig,qs=!0;function uk(t,e,n,r){var i=Se,o=ci.transition;ci.transition=null;try{Se=1,Qc(t,e,n,r)}finally{Se=i,ci.transition=o}}function dk(t,e,n,r){var i=Se,o=ci.transition;ci.transition=null;try{Se=4,Qc(t,e,n,r)}finally{Se=i,ci.transition=o}}function Qc(t,e,n,r){if(qs){var i=Yc(t,e,n,r);if(i===null)pu(t,e,r,Js,n),Xg(t,r);else if(lk(i,t,e,n,r))r.stopPropagation();else if(Xg(t,r),e&4&&-1<ak.indexOf(t)){for(;i!==null;){var o=ko(i);if(o!==null&&Jg(o),o=Yc(t,e,n,r),o===null&&pu(t,e,r,Js,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else pu(t,e,r,null,n)}}var Js=null;function Yc(t,e,n,r){if(Js=null,t=jc(r),t=Mr(t),t!==null)if(e=Tr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Fg(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Js=t,null}function tm(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(XS()){case Vc:return 1;case Vg:return 4;case Bs:case ZS:return 16;case Kg:return 536870912;default:return 16}default:return 16}}var Qn=null,Xc=null,Gs=null;function nm(){if(Gs)return Gs;var t,e=Xc,n=e.length,r,i="value"in Qn?Qn.value:Qn.textContent,o=i.length;for(t=0;t<n&&e[t]===i[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===i[o-r];r++);return Gs=i.slice(t,1<r?1-r:void 0)}function Qs(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Ys(){return!0}function rm(){return!1}function _t(t){function e(n,r,i,o,s){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Ys:rm,this.isPropagationStopped=rm,this}return De(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ys)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ys)},persist:function(){},isPersistent:Ys}),e}var ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zc=_t(ui),uo=De({},ui,{view:0,detail:0}),hk=_t(uo),eu,tu,ho,Xs=De({},uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ru,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ho&&(ho&&t.type==="mousemove"?(eu=t.screenX-ho.screenX,tu=t.screenY-ho.screenY):tu=eu=0,ho=t),eu)},movementY:function(t){return"movementY"in t?t.movementY:tu}}),im=_t(Xs),fk=De({},Xs,{dataTransfer:0}),pk=_t(fk),gk=De({},uo,{relatedTarget:0}),nu=_t(gk),mk=De({},ui,{animationName:0,elapsedTime:0,pseudoElement:0}),yk=_t(mk),vk=De({},ui,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),bk=_t(vk),wk=De({},ui,{data:0}),om=_t(wk),Sk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kk={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _k(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=xk[t])?!!e[t]:!1}function ru(){return _k}var Ck=De({},uo,{key:function(t){if(t.key){var e=Sk[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Qs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?kk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ru,charCode:function(t){return t.type==="keypress"?Qs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Qs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Ek=_t(Ck),Tk=De({},Xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sm=_t(Tk),Mk=De({},uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ru}),Ak=_t(Mk),Ok=De({},ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dk=_t(Ok),Pk=De({},Xs,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Lk=_t(Pk),Ik=[9,13,27,32],iu=Sn&&"CompositionEvent"in window,fo=null;Sn&&"documentMode"in document&&(fo=document.documentMode);var Rk=Sn&&"TextEvent"in window&&!fo,am=Sn&&(!iu||fo&&8<fo&&11>=fo),lm=" ",cm=!1;function um(t,e){switch(t){case"keyup":return Ik.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var di=!1;function Nk(t,e){switch(t){case"compositionend":return dm(e);case"keypress":return e.which!==32?null:(cm=!0,lm);case"textInput":return t=e.data,t===lm&&cm?null:t;default:return null}}function $k(t,e){if(di)return t==="compositionend"||!iu&&um(t,e)?(t=nm(),Gs=Xc=Qn=null,di=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return am&&e.locale!=="ko"?null:e.data;default:return null}}var Fk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Fk[t.type]:e==="textarea"}function fm(t,e,n,r){Lg(r),e=ra(e,"onChange"),0<e.length&&(n=new Zc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var po=null,go=null;function jk(t){Dm(t,0)}function Zs(t){var e=mi(t);if(Sg(e))return t}function Bk(t,e){if(t==="change")return e}var pm=!1;if(Sn){var ou;if(Sn){var su="oninput"in document;if(!su){var gm=document.createElement("div");gm.setAttribute("oninput","return;"),su=typeof gm.oninput=="function"}ou=su}else ou=!1;pm=ou&&(!document.documentMode||9<document.documentMode)}function mm(){po&&(po.detachEvent("onpropertychange",ym),go=po=null)}function ym(t){if(t.propertyName==="value"&&Zs(go)){var e=[];fm(e,go,t,jc(t)),$g(jk,e)}}function Uk(t,e,n){t==="focusin"?(mm(),po=e,go=n,po.attachEvent("onpropertychange",ym)):t==="focusout"&&mm()}function zk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Zs(go)}function Hk(t,e){if(t==="click")return Zs(e)}function Vk(t,e){if(t==="input"||t==="change")return Zs(e)}function Kk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var qt=typeof Object.is=="function"?Object.is:Kk;function mo(t,e){if(qt(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!yc.call(e,i)||!qt(t[i],e[i]))return!1}return!0}function vm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function bm(t,e){var n=vm(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=vm(n)}}function wm(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?wm(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Sm(){for(var t=window,e=Ns();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ns(t.document)}return e}function au(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Wk(t){var e=Sm(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&wm(n.ownerDocument.documentElement,n)){if(r!==null&&au(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=bm(n,o);var s=bm(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var qk=Sn&&"documentMode"in document&&11>=document.documentMode,hi=null,lu=null,yo=null,cu=!1;function km(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cu||hi==null||hi!==Ns(r)||(r=hi,"selectionStart"in r&&au(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yo&&mo(yo,r)||(yo=r,r=ra(lu,"onSelect"),0<r.length&&(e=new Zc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=hi)))}function ea(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var fi={animationend:ea("Animation","AnimationEnd"),animationiteration:ea("Animation","AnimationIteration"),animationstart:ea("Animation","AnimationStart"),transitionend:ea("Transition","TransitionEnd")},uu={},xm={};Sn&&(xm=document.createElement("div").style,"AnimationEvent"in window||(delete fi.animationend.animation,delete fi.animationiteration.animation,delete fi.animationstart.animation),"TransitionEvent"in window||delete fi.transitionend.transition);function ta(t){if(uu[t])return uu[t];if(!fi[t])return t;var e=fi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in xm)return uu[t]=e[n];return t}var _m=ta("animationend"),Cm=ta("animationiteration"),Em=ta("animationstart"),Tm=ta("transitionend"),Mm=new Map,Am="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Yn(t,e){Mm.set(t,e),Er(e,[t])}for(var du=0;du<Am.length;du++){var hu=Am[du],Jk=hu.toLowerCase(),Gk=hu[0].toUpperCase()+hu.slice(1);Yn(Jk,"on"+Gk)}Yn(_m,"onAnimationEnd"),Yn(Cm,"onAnimationIteration"),Yn(Em,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(Tm,"onTransitionEnd"),ri("onMouseEnter",["mouseout","mouseover"]),ri("onMouseLeave",["mouseout","mouseover"]),ri("onPointerEnter",["pointerout","pointerover"]),ri("onPointerLeave",["pointerout","pointerover"]),Er("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Er("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Er("onBeforeInput",["compositionend","keypress","textInput","paste"]),Er("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Er("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Er("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Qk=new Set("cancel close invalid load scroll toggle".split(" ").concat(vo));function Om(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,JS(r,e,void 0,t),t.currentTarget=null}function Dm(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var o=void 0;if(e)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&i.isPropagationStopped())break e;Om(i,a,c),o=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==o&&i.isPropagationStopped())break e;Om(i,a,c),o=l}}}if(js)throw t=Hc,js=!1,Hc=null,t}function Me(t,e){var n=e[wu];n===void 0&&(n=e[wu]=new Set);var r=t+"__bubble";n.has(r)||(Pm(e,t,2,!1),n.add(r))}function fu(t,e,n){var r=0;e&&(r|=4),Pm(n,t,r,e)}var na="_reactListening"+Math.random().toString(36).slice(2);function bo(t){if(!t[na]){t[na]=!0,fg.forEach(function(n){n!=="selectionchange"&&(Qk.has(n)||fu(n,!1,t),fu(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[na]||(e[na]=!0,fu("selectionchange",!1,e))}}function Pm(t,e,n,r){switch(tm(e)){case 1:var i=uk;break;case 4:i=dk;break;default:i=Qc}n=i.bind(null,e,n,t),i=void 0,!zc||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function pu(t,e,n,r,i){var o=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;s=s.return}for(;a!==null;){if(s=Mr(a),s===null)return;if(l=s.tag,l===5||l===6){r=o=s;continue e}a=a.parentNode}}r=r.return}$g(function(){var c=o,d=jc(n),h=[];e:{var f=Mm.get(t);if(f!==void 0){var v=Zc,b=t;switch(t){case"keypress":if(Qs(n)===0)break e;case"keydown":case"keyup":v=Ek;break;case"focusin":b="focus",v=nu;break;case"focusout":b="blur",v=nu;break;case"beforeblur":case"afterblur":v=nu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=im;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=pk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=Ak;break;case _m:case Cm:case Em:v=yk;break;case Tm:v=Dk;break;case"scroll":v=hk;break;case"wheel":v=Lk;break;case"copy":case"cut":case"paste":v=bk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=sm}var g=(e&4)!==0,S=!g&&t==="scroll",m=g?f!==null?f+"Capture":null:f;g=[];for(var w=c,k;w!==null;){k=w;var C=k.stateNode;if(k.tag===5&&C!==null&&(k=C,m!==null&&(C=eo(w,m),C!=null&&g.push(wo(w,C,k)))),S)break;w=w.return}0<g.length&&(f=new v(f,b,null,n,d),h.push({event:f,listeners:g}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",v=t==="mouseout"||t==="pointerout",f&&n!==Fc&&(b=n.relatedTarget||n.fromElement)&&(Mr(b)||b[xn]))break e;if((v||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,v?(b=n.relatedTarget||n.toElement,v=c,b=b?Mr(b):null,b!==null&&(S=Tr(b),b!==S||b.tag!==5&&b.tag!==6)&&(b=null)):(v=null,b=c),v!==b)){if(g=im,C="onMouseLeave",m="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(g=sm,C="onPointerLeave",m="onPointerEnter",w="pointer"),S=v==null?f:mi(v),k=b==null?f:mi(b),f=new g(C,w+"leave",v,n,d),f.target=S,f.relatedTarget=k,C=null,Mr(d)===c&&(g=new g(m,w+"enter",b,n,d),g.target=k,g.relatedTarget=S,C=g),S=C,v&&b)t:{for(g=v,m=b,w=0,k=g;k;k=pi(k))w++;for(k=0,C=m;C;C=pi(C))k++;for(;0<w-k;)g=pi(g),w--;for(;0<k-w;)m=pi(m),k--;for(;w--;){if(g===m||m!==null&&g===m.alternate)break t;g=pi(g),m=pi(m)}g=null}else g=null;v!==null&&Lm(h,f,v,g,!1),b!==null&&S!==null&&Lm(h,S,b,g,!0)}}e:{if(f=c?mi(c):window,v=f.nodeName&&f.nodeName.toLowerCase(),v==="select"||v==="input"&&f.type==="file")var M=Bk;else if(hm(f))if(pm)M=Vk;else{M=zk;var P=Uk}else(v=f.nodeName)&&v.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(M=Hk);if(M&&(M=M(t,c))){fm(h,M,n,d);break e}P&&P(t,f,c),t==="focusout"&&(P=f._wrapperState)&&P.controlled&&f.type==="number"&&Lc(f,"number",f.value)}switch(P=c?mi(c):window,t){case"focusin":(hm(P)||P.contentEditable==="true")&&(hi=P,lu=c,yo=null);break;case"focusout":yo=lu=hi=null;break;case"mousedown":cu=!0;break;case"contextmenu":case"mouseup":case"dragend":cu=!1,km(h,n,d);break;case"selectionchange":if(qk)break;case"keydown":case"keyup":km(h,n,d)}var L;if(iu)e:{switch(t){case"compositionstart":var F="onCompositionStart";break e;case"compositionend":F="onCompositionEnd";break e;case"compositionupdate":F="onCompositionUpdate";break e}F=void 0}else di?um(t,n)&&(F="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(F="onCompositionStart");F&&(am&&n.locale!=="ko"&&(di||F!=="onCompositionStart"?F==="onCompositionEnd"&&di&&(L=nm()):(Qn=d,Xc="value"in Qn?Qn.value:Qn.textContent,di=!0)),P=ra(c,F),0<P.length&&(F=new om(F,t,null,n,d),h.push({event:F,listeners:P}),L?F.data=L:(L=dm(n),L!==null&&(F.data=L)))),(L=Rk?Nk(t,n):$k(t,n))&&(c=ra(c,"onBeforeInput"),0<c.length&&(d=new om("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:c}),d.data=L))}Dm(h,e)})}function wo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function ra(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=eo(t,n),o!=null&&r.unshift(wo(t,o,i)),o=eo(t,e),o!=null&&r.push(wo(t,o,i))),t=t.return}return r}function pi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Lm(t,e,n,r,i){for(var o=e._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=eo(n,o),l!=null&&s.unshift(wo(n,l,a))):i||(l=eo(n,o),l!=null&&s.push(wo(n,l,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var Yk=/\r\n?/g,Xk=/\u0000|\uFFFD/g;function Im(t){return(typeof t=="string"?t:""+t).replace(Yk,`
372
- `).replace(Xk,"")}function ia(t,e,n){if(e=Im(e),Im(t)!==e&&n)throw Error(N(425))}function oa(){}var gu=null,mu=null;function yu(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var vu=typeof setTimeout=="function"?setTimeout:void 0,Zk=typeof clearTimeout=="function"?clearTimeout:void 0,Rm=typeof Promise=="function"?Promise:void 0,ex=typeof queueMicrotask=="function"?queueMicrotask:typeof Rm<"u"?function(t){return Rm.resolve(null).then(t).catch(tx)}:vu;function tx(t){setTimeout(function(){throw t})}function bu(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),co(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);co(e)}function Xn(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Nm(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var gi=Math.random().toString(36).slice(2),an="__reactFiber$"+gi,So="__reactProps$"+gi,xn="__reactContainer$"+gi,wu="__reactEvents$"+gi,nx="__reactListeners$"+gi,rx="__reactHandles$"+gi;function Mr(t){var e=t[an];if(e)return e;for(var n=t.parentNode;n;){if(e=n[xn]||n[an]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Nm(t);t!==null;){if(n=t[an])return n;t=Nm(t)}return e}t=n,n=t.parentNode}return null}function ko(t){return t=t[an]||t[xn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function mi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(N(33))}function sa(t){return t[So]||null}var Su=[],yi=-1;function Zn(t){return{current:t}}function Ae(t){0>yi||(t.current=Su[yi],Su[yi]=null,yi--)}function Te(t,e){yi++,Su[yi]=t.current,t.current=e}var er={},Ze=Zn(er),ht=Zn(!1),Ar=er;function vi(t,e){var n=t.type.contextTypes;if(!n)return er;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function ft(t){return t=t.childContextTypes,t!=null}function aa(){Ae(ht),Ae(Ze)}function $m(t,e,n){if(Ze.current!==er)throw Error(N(168));Te(Ze,e),Te(ht,n)}function Fm(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(N(108,US(t)||"Unknown",i));return De({},n,r)}function la(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||er,Ar=Ze.current,Te(Ze,t),Te(ht,ht.current),!0}function jm(t,e,n){var r=t.stateNode;if(!r)throw Error(N(169));n?(t=Fm(t,e,Ar),r.__reactInternalMemoizedMergedChildContext=t,Ae(ht),Ae(Ze),Te(Ze,t)):Ae(ht),Te(ht,n)}var _n=null,ca=!1,ku=!1;function Bm(t){_n===null?_n=[t]:_n.push(t)}function ix(t){ca=!0,Bm(t)}function tr(){if(!ku&&_n!==null){ku=!0;var t=0,e=Se;try{var n=_n;for(Se=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}_n=null,ca=!1}catch(i){throw _n!==null&&(_n=_n.slice(t+1)),zg(Vc,tr),i}finally{Se=e,ku=!1}}return null}var bi=[],wi=0,ua=null,da=0,It=[],Rt=0,Or=null,Cn=1,En="";function Dr(t,e){bi[wi++]=da,bi[wi++]=ua,ua=t,da=e}function Um(t,e,n){It[Rt++]=Cn,It[Rt++]=En,It[Rt++]=Or,Or=t;var r=Cn;t=En;var i=32-Wt(r)-1;r&=~(1<<i),n+=1;var o=32-Wt(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,Cn=1<<32-Wt(e)+i|n<<i|r,En=o+t}else Cn=1<<o|n<<i|r,En=t}function xu(t){t.return!==null&&(Dr(t,1),Um(t,1,0))}function _u(t){for(;t===ua;)ua=bi[--wi],bi[wi]=null,da=bi[--wi],bi[wi]=null;for(;t===Or;)Or=It[--Rt],It[Rt]=null,En=It[--Rt],It[Rt]=null,Cn=It[--Rt],It[Rt]=null}var Ct=null,Et=null,Oe=!1,Jt=null;function zm(t,e){var n=jt(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Hm(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ct=t,Et=Xn(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ct=t,Et=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Or!==null?{id:Cn,overflow:En}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=jt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Ct=t,Et=null,!0):!1;default:return!1}}function Cu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Eu(t){if(Oe){var e=Et;if(e){var n=e;if(!Hm(t,e)){if(Cu(t))throw Error(N(418));e=Xn(n.nextSibling);var r=Ct;e&&Hm(t,e)?zm(r,n):(t.flags=t.flags&-4097|2,Oe=!1,Ct=t)}}else{if(Cu(t))throw Error(N(418));t.flags=t.flags&-4097|2,Oe=!1,Ct=t}}}function Vm(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ct=t}function ha(t){if(t!==Ct)return!1;if(!Oe)return Vm(t),Oe=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!yu(t.type,t.memoizedProps)),e&&(e=Et)){if(Cu(t))throw Km(),Error(N(418));for(;e;)zm(t,e),e=Xn(e.nextSibling)}if(Vm(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(N(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Et=Xn(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Et=null}}else Et=Ct?Xn(t.stateNode.nextSibling):null;return!0}function Km(){for(var t=Et;t;)t=Xn(t.nextSibling)}function Si(){Et=Ct=null,Oe=!1}function Tu(t){Jt===null?Jt=[t]:Jt.push(t)}var ox=kn.ReactCurrentBatchConfig;function xo(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(N(309));var r=n.stateNode}if(!r)throw Error(N(147,t));var i=r,o=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===o?e.ref:(e=function(s){var a=i.refs;s===null?delete a[o]:a[o]=s},e._stringRef=o,e)}if(typeof t!="string")throw Error(N(284));if(!n._owner)throw Error(N(290,t))}return t}function fa(t,e){throw t=Object.prototype.toString.call(e),Error(N(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Wm(t){var e=t._init;return e(t._payload)}function qm(t){function e(m,w){if(t){var k=m.deletions;k===null?(m.deletions=[w],m.flags|=16):k.push(w)}}function n(m,w){if(!t)return null;for(;w!==null;)e(m,w),w=w.sibling;return null}function r(m,w){for(m=new Map;w!==null;)w.key!==null?m.set(w.key,w):m.set(w.index,w),w=w.sibling;return m}function i(m,w){return m=cr(m,w),m.index=0,m.sibling=null,m}function o(m,w,k){return m.index=k,t?(k=m.alternate,k!==null?(k=k.index,k<w?(m.flags|=2,w):k):(m.flags|=2,w)):(m.flags|=1048576,w)}function s(m){return t&&m.alternate===null&&(m.flags|=2),m}function a(m,w,k,C){return w===null||w.tag!==6?(w=vd(k,m.mode,C),w.return=m,w):(w=i(w,k),w.return=m,w)}function l(m,w,k,C){var M=k.type;return M===oi?d(m,w,k.props.children,C,k.key):w!==null&&(w.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Vn&&Wm(M)===w.type)?(C=i(w,k.props),C.ref=xo(m,w,k),C.return=m,C):(C=$a(k.type,k.key,k.props,null,m.mode,C),C.ref=xo(m,w,k),C.return=m,C)}function c(m,w,k,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==k.containerInfo||w.stateNode.implementation!==k.implementation?(w=bd(k,m.mode,C),w.return=m,w):(w=i(w,k.children||[]),w.return=m,w)}function d(m,w,k,C,M){return w===null||w.tag!==7?(w=jr(k,m.mode,C,M),w.return=m,w):(w=i(w,k),w.return=m,w)}function h(m,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=vd(""+w,m.mode,k),w.return=m,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Is:return k=$a(w.type,w.key,w.props,null,m.mode,k),k.ref=xo(m,null,w),k.return=m,k;case ii:return w=bd(w,m.mode,k),w.return=m,w;case Vn:var C=w._init;return h(m,C(w._payload),k)}if(Yi(w)||Gi(w))return w=jr(w,m.mode,k,null),w.return=m,w;fa(m,w)}return null}function f(m,w,k,C){var M=w!==null?w.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return M!==null?null:a(m,w,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Is:return k.key===M?l(m,w,k,C):null;case ii:return k.key===M?c(m,w,k,C):null;case Vn:return M=k._init,f(m,w,M(k._payload),C)}if(Yi(k)||Gi(k))return M!==null?null:d(m,w,k,C,null);fa(m,k)}return null}function v(m,w,k,C,M){if(typeof C=="string"&&C!==""||typeof C=="number")return m=m.get(k)||null,a(w,m,""+C,M);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Is:return m=m.get(C.key===null?k:C.key)||null,l(w,m,C,M);case ii:return m=m.get(C.key===null?k:C.key)||null,c(w,m,C,M);case Vn:var P=C._init;return v(m,w,k,P(C._payload),M)}if(Yi(C)||Gi(C))return m=m.get(k)||null,d(w,m,C,M,null);fa(w,C)}return null}function b(m,w,k,C){for(var M=null,P=null,L=w,F=w=0,Y=null;L!==null&&F<k.length;F++){L.index>F?(Y=L,L=null):Y=L.sibling;var W=f(m,L,k[F],C);if(W===null){L===null&&(L=Y);break}t&&L&&W.alternate===null&&e(m,L),w=o(W,w,F),P===null?M=W:P.sibling=W,P=W,L=Y}if(F===k.length)return n(m,L),Oe&&Dr(m,F),M;if(L===null){for(;F<k.length;F++)L=h(m,k[F],C),L!==null&&(w=o(L,w,F),P===null?M=L:P.sibling=L,P=L);return Oe&&Dr(m,F),M}for(L=r(m,L);F<k.length;F++)Y=v(L,m,F,k[F],C),Y!==null&&(t&&Y.alternate!==null&&L.delete(Y.key===null?F:Y.key),w=o(Y,w,F),P===null?M=Y:P.sibling=Y,P=Y);return t&&L.forEach(function(H){return e(m,H)}),Oe&&Dr(m,F),M}function g(m,w,k,C){var M=Gi(k);if(typeof M!="function")throw Error(N(150));if(k=M.call(k),k==null)throw Error(N(151));for(var P=M=null,L=w,F=w=0,Y=null,W=k.next();L!==null&&!W.done;F++,W=k.next()){L.index>F?(Y=L,L=null):Y=L.sibling;var H=f(m,L,W.value,C);if(H===null){L===null&&(L=Y);break}t&&L&&H.alternate===null&&e(m,L),w=o(H,w,F),P===null?M=H:P.sibling=H,P=H,L=Y}if(W.done)return n(m,L),Oe&&Dr(m,F),M;if(L===null){for(;!W.done;F++,W=k.next())W=h(m,W.value,C),W!==null&&(w=o(W,w,F),P===null?M=W:P.sibling=W,P=W);return Oe&&Dr(m,F),M}for(L=r(m,L);!W.done;F++,W=k.next())W=v(L,m,F,W.value,C),W!==null&&(t&&W.alternate!==null&&L.delete(W.key===null?F:W.key),w=o(W,w,F),P===null?M=W:P.sibling=W,P=W);return t&&L.forEach(function(Q){return e(m,Q)}),Oe&&Dr(m,F),M}function S(m,w,k,C){if(typeof k=="object"&&k!==null&&k.type===oi&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Is:e:{for(var M=k.key,P=w;P!==null;){if(P.key===M){if(M=k.type,M===oi){if(P.tag===7){n(m,P.sibling),w=i(P,k.props.children),w.return=m,m=w;break e}}else if(P.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Vn&&Wm(M)===P.type){n(m,P.sibling),w=i(P,k.props),w.ref=xo(m,P,k),w.return=m,m=w;break e}n(m,P);break}else e(m,P);P=P.sibling}k.type===oi?(w=jr(k.props.children,m.mode,C,k.key),w.return=m,m=w):(C=$a(k.type,k.key,k.props,null,m.mode,C),C.ref=xo(m,w,k),C.return=m,m=C)}return s(m);case ii:e:{for(P=k.key;w!==null;){if(w.key===P)if(w.tag===4&&w.stateNode.containerInfo===k.containerInfo&&w.stateNode.implementation===k.implementation){n(m,w.sibling),w=i(w,k.children||[]),w.return=m,m=w;break e}else{n(m,w);break}else e(m,w);w=w.sibling}w=bd(k,m.mode,C),w.return=m,m=w}return s(m);case Vn:return P=k._init,S(m,w,P(k._payload),C)}if(Yi(k))return b(m,w,k,C);if(Gi(k))return g(m,w,k,C);fa(m,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,w!==null&&w.tag===6?(n(m,w.sibling),w=i(w,k),w.return=m,m=w):(n(m,w),w=vd(k,m.mode,C),w.return=m,m=w),s(m)):n(m,w)}return S}var ki=qm(!0),Jm=qm(!1),pa=Zn(null),ga=null,xi=null,Mu=null;function Au(){Mu=xi=ga=null}function Ou(t){var e=pa.current;Ae(pa),t._currentValue=e}function Du(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function _i(t,e){ga=t,Mu=xi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(pt=!0),t.firstContext=null)}function Nt(t){var e=t._currentValue;if(Mu!==t)if(t={context:t,memoizedValue:e,next:null},xi===null){if(ga===null)throw Error(N(308));xi=t,ga.dependencies={lanes:0,firstContext:t}}else xi=xi.next=t;return e}var Pr=null;function Pu(t){Pr===null?Pr=[t]:Pr.push(t)}function Gm(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Pu(e)):(n.next=i.next,i.next=n),e.interleaved=n,Tn(t,r)}function Tn(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var nr=!1;function Lu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qm(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Mn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function rr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ye&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Tn(t,n)}return i=r.interleaved,i===null?(e.next=e,Pu(r)):(e.next=i.next,i.next=e),r.interleaved=e,Tn(t,n)}function ma(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qc(t,n)}}function Ym(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function ya(t,e,n,r){var i=t.updateQueue;nr=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?o=c:s.next=c,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(o!==null){var h=i.baseState;s=0,d=c=l=null,a=o;do{var f=a.lane,v=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:v,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var b=t,g=a;switch(f=e,v=n,g.tag){case 1:if(b=g.payload,typeof b=="function"){h=b.call(v,h,f);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,f=typeof b=="function"?b.call(v,h,f):b,f==null)break e;h=De({},h,f);break e;case 2:nr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else v={eventTime:v,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=v,l=h):d=d.next=v,s|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(l=h),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Rr|=s,t.lanes=s,t.memoizedState=h}}function Xm(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(N(191,i));i.call(r)}}}var _o={},ln=Zn(_o),Co=Zn(_o),Eo=Zn(_o);function Lr(t){if(t===_o)throw Error(N(174));return t}function Iu(t,e){switch(Te(Eo,e),Te(Co,t),Te(ln,_o),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Rc(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Rc(e,t)}Ae(ln),Te(ln,e)}function Ci(){Ae(ln),Ae(Co),Ae(Eo)}function Zm(t){Lr(Eo.current);var e=Lr(ln.current),n=Rc(e,t.type);e!==n&&(Te(Co,t),Te(ln,n))}function Ru(t){Co.current===t&&(Ae(ln),Ae(Co))}var Pe=Zn(0);function va(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Nu=[];function $u(){for(var t=0;t<Nu.length;t++)Nu[t]._workInProgressVersionPrimary=null;Nu.length=0}var ba=kn.ReactCurrentDispatcher,Fu=kn.ReactCurrentBatchConfig,Ir=0,Le=null,je=null,He=null,wa=!1,To=!1,Mo=0,sx=0;function et(){throw Error(N(321))}function ju(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!qt(t[n],e[n]))return!1;return!0}function Bu(t,e,n,r,i,o){if(Ir=o,Le=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ba.current=t===null||t.memoizedState===null?ux:dx,t=n(r,i),To){o=0;do{if(To=!1,Mo=0,25<=o)throw Error(N(301));o+=1,He=je=null,e.updateQueue=null,ba.current=hx,t=n(r,i)}while(To)}if(ba.current=xa,e=je!==null&&je.next!==null,Ir=0,He=je=Le=null,wa=!1,e)throw Error(N(300));return t}function Uu(){var t=Mo!==0;return Mo=0,t}function cn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return He===null?Le.memoizedState=He=t:He=He.next=t,He}function $t(){if(je===null){var t=Le.alternate;t=t!==null?t.memoizedState:null}else t=je.next;var e=He===null?Le.memoizedState:He.next;if(e!==null)He=e,je=t;else{if(t===null)throw Error(N(310));je=t,t={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},He===null?Le.memoizedState=He=t:He=He.next=t}return He}function Ao(t,e){return typeof e=="function"?e(t):e}function zu(t){var e=$t(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=je,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var a=s=null,l=null,c=o;do{var d=c.lane;if((Ir&d)===d)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var h={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,s=r):l=l.next=h,Le.lanes|=d,Rr|=d}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,qt(r,e.memoizedState)||(pt=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do o=i.lane,Le.lanes|=o,Rr|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Hu(t){var e=$t(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,o=e.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=t(o,s.action),s=s.next;while(s!==i);qt(o,e.memoizedState)||(pt=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function ey(){}function ty(t,e){var n=Le,r=$t(),i=e(),o=!qt(r.memoizedState,i);if(o&&(r.memoizedState=i,pt=!0),r=r.queue,Vu(iy.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||He!==null&&He.memoizedState.tag&1){if(n.flags|=2048,Oo(9,ry.bind(null,n,r,i,e),void 0,null),Ve===null)throw Error(N(349));Ir&30||ny(n,e,i)}return i}function ny(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function ry(t,e,n,r){e.value=n,e.getSnapshot=r,oy(e)&&sy(t)}function iy(t,e,n){return n(function(){oy(e)&&sy(t)})}function oy(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!qt(t,n)}catch{return!0}}function sy(t){var e=Tn(t,1);e!==null&&Xt(e,t,1,-1)}function ay(t){var e=cn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:t},e.queue=t,t=t.dispatch=cx.bind(null,Le,t),[e.memoizedState,t]}function Oo(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function ly(){return $t().memoizedState}function Sa(t,e,n,r){var i=cn();Le.flags|=t,i.memoizedState=Oo(1|e,n,void 0,r===void 0?null:r)}function ka(t,e,n,r){var i=$t();r=r===void 0?null:r;var o=void 0;if(je!==null){var s=je.memoizedState;if(o=s.destroy,r!==null&&ju(r,s.deps)){i.memoizedState=Oo(e,n,o,r);return}}Le.flags|=t,i.memoizedState=Oo(1|e,n,o,r)}function cy(t,e){return Sa(8390656,8,t,e)}function Vu(t,e){return ka(2048,8,t,e)}function uy(t,e){return ka(4,2,t,e)}function dy(t,e){return ka(4,4,t,e)}function hy(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function fy(t,e,n){return n=n!=null?n.concat([t]):null,ka(4,4,hy.bind(null,e,t),n)}function Ku(){}function py(t,e){var n=$t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&ju(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function gy(t,e){var n=$t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&ju(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function my(t,e,n){return Ir&21?(qt(n,e)||(n=Wg(),Le.lanes|=n,Rr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,pt=!0),t.memoizedState=n)}function ax(t,e){var n=Se;Se=n!==0&&4>n?n:4,t(!0);var r=Fu.transition;Fu.transition={};try{t(!1),e()}finally{Se=n,Fu.transition=r}}function yy(){return $t().memoizedState}function lx(t,e,n){var r=ar(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vy(t))by(e,n);else if(n=Gm(t,e,n,r),n!==null){var i=ct();Xt(n,t,r,i),wy(n,e,r)}}function cx(t,e,n){var r=ar(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vy(t))by(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,qt(a,s)){var l=e.interleaved;l===null?(i.next=i,Pu(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Gm(t,e,i,r),n!==null&&(i=ct(),Xt(n,t,r,i),wy(n,e,r))}}function vy(t){var e=t.alternate;return t===Le||e!==null&&e===Le}function by(t,e){To=wa=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function wy(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qc(t,n)}}var xa={readContext:Nt,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useInsertionEffect:et,useLayoutEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useMutableSource:et,useSyncExternalStore:et,useId:et,unstable_isNewReconciler:!1},ux={readContext:Nt,useCallback:function(t,e){return cn().memoizedState=[t,e===void 0?null:e],t},useContext:Nt,useEffect:cy,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Sa(4194308,4,hy.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Sa(4194308,4,t,e)},useInsertionEffect:function(t,e){return Sa(4,2,t,e)},useMemo:function(t,e){var n=cn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=cn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=lx.bind(null,Le,t),[r.memoizedState,t]},useRef:function(t){var e=cn();return t={current:t},e.memoizedState=t},useState:ay,useDebugValue:Ku,useDeferredValue:function(t){return cn().memoizedState=t},useTransition:function(){var t=ay(!1),e=t[0];return t=ax.bind(null,t[1]),cn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Le,i=cn();if(Oe){if(n===void 0)throw Error(N(407));n=n()}else{if(n=e(),Ve===null)throw Error(N(349));Ir&30||ny(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,cy(iy.bind(null,r,o,t),[t]),r.flags|=2048,Oo(9,ry.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=cn(),e=Ve.identifierPrefix;if(Oe){var n=En,r=Cn;n=(r&~(1<<32-Wt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Mo++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=sx++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},dx={readContext:Nt,useCallback:py,useContext:Nt,useEffect:Vu,useImperativeHandle:fy,useInsertionEffect:uy,useLayoutEffect:dy,useMemo:gy,useReducer:zu,useRef:ly,useState:function(){return zu(Ao)},useDebugValue:Ku,useDeferredValue:function(t){var e=$t();return my(e,je.memoizedState,t)},useTransition:function(){var t=zu(Ao)[0],e=$t().memoizedState;return[t,e]},useMutableSource:ey,useSyncExternalStore:ty,useId:yy,unstable_isNewReconciler:!1},hx={readContext:Nt,useCallback:py,useContext:Nt,useEffect:Vu,useImperativeHandle:fy,useInsertionEffect:uy,useLayoutEffect:dy,useMemo:gy,useReducer:Hu,useRef:ly,useState:function(){return Hu(Ao)},useDebugValue:Ku,useDeferredValue:function(t){var e=$t();return je===null?e.memoizedState=t:my(e,je.memoizedState,t)},useTransition:function(){var t=Hu(Ao)[0],e=$t().memoizedState;return[t,e]},useMutableSource:ey,useSyncExternalStore:ty,useId:yy,unstable_isNewReconciler:!1};function Gt(t,e){if(t&&t.defaultProps){e=De({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Wu(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:De({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var _a={isMounted:function(t){return(t=t._reactInternals)?Tr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=ct(),i=ar(t),o=Mn(r,i);o.payload=e,n!=null&&(o.callback=n),e=rr(t,o,i),e!==null&&(Xt(e,t,i,r),ma(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=ct(),i=ar(t),o=Mn(r,i);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=rr(t,o,i),e!==null&&(Xt(e,t,i,r),ma(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=ct(),r=ar(t),i=Mn(n,r);i.tag=2,e!=null&&(i.callback=e),e=rr(t,i,r),e!==null&&(Xt(e,t,r,n),ma(e,t,r))}};function Sy(t,e,n,r,i,o,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,o,s):e.prototype&&e.prototype.isPureReactComponent?!mo(n,r)||!mo(i,o):!0}function ky(t,e,n){var r=!1,i=er,o=e.contextType;return typeof o=="object"&&o!==null?o=Nt(o):(i=ft(e)?Ar:Ze.current,r=e.contextTypes,o=(r=r!=null)?vi(t,i):er),e=new e(n,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=_a,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function xy(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&_a.enqueueReplaceState(e,e.state,null)}function qu(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Lu(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Nt(o):(o=ft(e)?Ar:Ze.current,i.context=vi(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(Wu(t,e,o,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&_a.enqueueReplaceState(i,i.state,null),ya(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Ei(t,e){try{var n="",r=e;do n+=BS(r),r=r.return;while(r);var i=n}catch(o){i=`
371
+ `+i[s].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{Mc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Qi(t):""}function BS(t){switch(t.tag){case 5:return Qi(t.type);case 16:return Qi("Lazy");case 13:return Qi("Suspense");case 19:return Qi("SuspenseList");case 0:case 2:case 15:return t=Ac(t.type,!1),t;case 11:return t=Ac(t.type.render,!1),t;case 1:return t=Ac(t.type,!0),t;default:return""}}function Oc(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case oi:return"Fragment";case ii:return"Portal";case kc:return"Profiler";case Sc:return"StrictMode";case _c:return"Suspense";case Cc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case vg:return(t.displayName||"Context")+".Consumer";case yg:return(t._context.displayName||"Context")+".Provider";case xc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ec:return e=t.displayName||null,e!==null?e:Oc(t.type)||"Memo";case Vn:e=t._payload,t=t._init;try{return Oc(t(e))}catch{}}return null}function US(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Oc(e);case 8:return e===Sc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Kn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Sg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function zS(t){var e=Sg(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Rs(t){t._valueTracker||(t._valueTracker=zS(t))}function kg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Sg(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ns(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Dc(t,e){var n=e.checked;return De({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function xg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Kn(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function _g(t,e){e=e.checked,e!=null&&wc(t,"checked",e,!1)}function Lc(t,e){_g(t,e);var n=Kn(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Pc(t,e.type,n):e.hasOwnProperty("defaultValue")&&Pc(t,e.type,Kn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Cg(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Pc(t,e,n){(e!=="number"||Ns(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Yi=Array.isArray;function si(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Kn(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Ic(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error($(91));return De({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Eg(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error($(92));if(Yi(n)){if(1<n.length)throw Error($(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Kn(n)}}function Tg(t,e){var n=Kn(e.value),r=Kn(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Mg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Ag(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Rc(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Ag(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var $s,Og=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for($s=$s||document.createElement("div"),$s.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=$s.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Xi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Zi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},HS=["Webkit","ms","Moz","O"];Object.keys(Zi).forEach(function(t){HS.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zi[e]=Zi[t]})});function Dg(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Zi.hasOwnProperty(t)&&Zi[t]?(""+e).trim():e+"px"}function Lg(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Dg(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var VS=De({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Nc(t,e){if(e){if(VS[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error($(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error($(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error($(61))}if(e.style!=null&&typeof e.style!="object")throw Error($(62))}}function $c(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Fc=null;function jc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Bc=null,ai=null,li=null;function Pg(t){if(t=ko(t)){if(typeof Bc!="function")throw Error($(280));var e=t.stateNode;e&&(e=sa(e),Bc(t.stateNode,t.type,e))}}function Ig(t){ai?li?li.push(t):li=[t]:ai=t}function Rg(){if(ai){var t=ai,e=li;if(li=ai=null,Pg(t),e)for(t=0;t<e.length;t++)Pg(e[t])}}function Ng(t,e){return t(e)}function $g(){}var Uc=!1;function Fg(t,e,n){if(Uc)return t(e,n);Uc=!0;try{return Ng(t,e,n)}finally{Uc=!1,(ai!==null||li!==null)&&($g(),Rg())}}function eo(t,e){var n=t.stateNode;if(n===null)return null;var r=sa(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error($(231,e,typeof n));return n}var zc=!1;if(kn)try{var to={};Object.defineProperty(to,"passive",{get:function(){zc=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{zc=!1}function KS(t,e,n,r,i,o,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(d){this.onError(d)}}var no=!1,Fs=null,js=!1,Hc=null,WS={onError:function(t){no=!0,Fs=t}};function qS(t,e,n,r,i,o,s,a,l){no=!1,Fs=null,KS.apply(WS,arguments)}function JS(t,e,n,r,i,o,s,a,l){if(qS.apply(this,arguments),no){if(no){var c=Fs;no=!1,Fs=null}else throw Error($(198));js||(js=!0,Hc=c)}}function Tr(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function jg(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Bg(t){if(Tr(t)!==t)throw Error($(188))}function GS(t){var e=t.alternate;if(!e){if(e=Tr(t),e===null)throw Error($(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Bg(i),t;if(o===r)return Bg(i),e;o=o.sibling}throw Error($(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s){for(a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s)throw Error($(189))}}if(n.alternate!==r)throw Error($(190))}if(n.tag!==3)throw Error($(188));return n.stateNode.current===n?t:e}function Ug(t){return t=GS(t),t!==null?zg(t):null}function zg(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=zg(t);if(e!==null)return e;t=t.sibling}return null}var Hg=xt.unstable_scheduleCallback,Vg=xt.unstable_cancelCallback,QS=xt.unstable_shouldYield,YS=xt.unstable_requestPaint,Ne=xt.unstable_now,XS=xt.unstable_getCurrentPriorityLevel,Vc=xt.unstable_ImmediatePriority,Kg=xt.unstable_UserBlockingPriority,Bs=xt.unstable_NormalPriority,ZS=xt.unstable_LowPriority,Wg=xt.unstable_IdlePriority,Us=null,an=null;function ek(t){if(an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(Us,t,void 0,(t.current.flags&128)===128)}catch{}}var qt=Math.clz32?Math.clz32:rk,tk=Math.log,nk=Math.LN2;function rk(t){return t>>>=0,t===0?32:31-(tk(t)/nk|0)|0}var zs=64,Hs=4194304;function ro(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Vs(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=ro(a):(o&=s,o!==0&&(r=ro(o)))}else s=n&~i,s!==0?r=ro(s):o!==0&&(r=ro(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-qt(e),i=1<<n,r|=t[n],e&=~i;return r}function ik(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ok(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-qt(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=ik(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}function Kc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function qg(){var t=zs;return zs<<=1,!(zs&4194240)&&(zs=64),t}function Wc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function io(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-qt(e),t[e]=n}function sk(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-qt(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function qc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-qt(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var Se=0;function Jg(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Gg,Jc,Qg,Yg,Xg,Gc=!1,Ks=[],Wn=null,qn=null,Jn=null,oo=new Map,so=new Map,Gn=[],ak="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Zg(t,e){switch(t){case"focusin":case"focusout":Wn=null;break;case"dragenter":case"dragleave":qn=null;break;case"mouseover":case"mouseout":Jn=null;break;case"pointerover":case"pointerout":oo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":so.delete(e.pointerId)}}function ao(t,e,n,r,i,o){return t===null||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},e!==null&&(e=ko(e),e!==null&&Jc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function lk(t,e,n,r,i){switch(e){case"focusin":return Wn=ao(Wn,t,e,n,r,i),!0;case"dragenter":return qn=ao(qn,t,e,n,r,i),!0;case"mouseover":return Jn=ao(Jn,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return oo.set(o,ao(oo.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,so.set(o,ao(so.get(o)||null,t,e,n,r,i)),!0}return!1}function em(t){var e=Mr(t.target);if(e!==null){var n=Tr(e);if(n!==null){if(e=n.tag,e===13){if(e=jg(n),e!==null){t.blockedOn=e,Xg(t.priority,function(){Qg(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ws(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Yc(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Fc=r,n.target.dispatchEvent(r),Fc=null}else return e=ko(n),e!==null&&Jc(e),t.blockedOn=n,!1;e.shift()}return!0}function tm(t,e,n){Ws(t)&&n.delete(e)}function ck(){Gc=!1,Wn!==null&&Ws(Wn)&&(Wn=null),qn!==null&&Ws(qn)&&(qn=null),Jn!==null&&Ws(Jn)&&(Jn=null),oo.forEach(tm),so.forEach(tm)}function lo(t,e){t.blockedOn===e&&(t.blockedOn=null,Gc||(Gc=!0,xt.unstable_scheduleCallback(xt.unstable_NormalPriority,ck)))}function co(t){function e(i){return lo(i,t)}if(0<Ks.length){lo(Ks[0],t);for(var n=1;n<Ks.length;n++){var r=Ks[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Wn!==null&&lo(Wn,t),qn!==null&&lo(qn,t),Jn!==null&&lo(Jn,t),oo.forEach(e),so.forEach(e),n=0;n<Gn.length;n++)r=Gn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Gn.length&&(n=Gn[0],n.blockedOn===null);)em(n),n.blockedOn===null&&Gn.shift()}var ci=xn.ReactCurrentBatchConfig,qs=!0;function uk(t,e,n,r){var i=Se,o=ci.transition;ci.transition=null;try{Se=1,Qc(t,e,n,r)}finally{Se=i,ci.transition=o}}function dk(t,e,n,r){var i=Se,o=ci.transition;ci.transition=null;try{Se=4,Qc(t,e,n,r)}finally{Se=i,ci.transition=o}}function Qc(t,e,n,r){if(qs){var i=Yc(t,e,n,r);if(i===null)pu(t,e,r,Js,n),Zg(t,r);else if(lk(i,t,e,n,r))r.stopPropagation();else if(Zg(t,r),e&4&&-1<ak.indexOf(t)){for(;i!==null;){var o=ko(i);if(o!==null&&Gg(o),o=Yc(t,e,n,r),o===null&&pu(t,e,r,Js,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else pu(t,e,r,null,n)}}var Js=null;function Yc(t,e,n,r){if(Js=null,t=jc(r),t=Mr(t),t!==null)if(e=Tr(t),e===null)t=null;else if(n=e.tag,n===13){if(t=jg(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Js=t,null}function nm(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(XS()){case Vc:return 1;case Kg:return 4;case Bs:case ZS:return 16;case Wg:return 536870912;default:return 16}default:return 16}}var Qn=null,Xc=null,Gs=null;function rm(){if(Gs)return Gs;var t,e=Xc,n=e.length,r,i="value"in Qn?Qn.value:Qn.textContent,o=i.length;for(t=0;t<n&&e[t]===i[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===i[o-r];r++);return Gs=i.slice(t,1<r?1-r:void 0)}function Qs(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Ys(){return!0}function im(){return!1}function _t(t){function e(n,r,i,o,s){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Ys:im,this.isPropagationStopped=im,this}return De(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ys)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ys)},persist:function(){},isPersistent:Ys}),e}var ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zc=_t(ui),uo=De({},ui,{view:0,detail:0}),hk=_t(uo),eu,tu,ho,Xs=De({},uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ru,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ho&&(ho&&t.type==="mousemove"?(eu=t.screenX-ho.screenX,tu=t.screenY-ho.screenY):tu=eu=0,ho=t),eu)},movementY:function(t){return"movementY"in t?t.movementY:tu}}),om=_t(Xs),fk=De({},Xs,{dataTransfer:0}),pk=_t(fk),gk=De({},uo,{relatedTarget:0}),nu=_t(gk),mk=De({},ui,{animationName:0,elapsedTime:0,pseudoElement:0}),yk=_t(mk),vk=De({},ui,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),bk=_t(vk),wk=De({},ui,{data:0}),sm=_t(wk),Sk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kk={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _k(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=xk[t])?!!e[t]:!1}function ru(){return _k}var Ck=De({},uo,{key:function(t){if(t.key){var e=Sk[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Qs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?kk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ru,charCode:function(t){return t.type==="keypress"?Qs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Qs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Ek=_t(Ck),Tk=De({},Xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),am=_t(Tk),Mk=De({},uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ru}),Ak=_t(Mk),Ok=De({},ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dk=_t(Ok),Lk=De({},Xs,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Pk=_t(Lk),Ik=[9,13,27,32],iu=kn&&"CompositionEvent"in window,fo=null;kn&&"documentMode"in document&&(fo=document.documentMode);var Rk=kn&&"TextEvent"in window&&!fo,lm=kn&&(!iu||fo&&8<fo&&11>=fo),cm=" ",um=!1;function dm(t,e){switch(t){case"keyup":return Ik.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var di=!1;function Nk(t,e){switch(t){case"compositionend":return hm(e);case"keypress":return e.which!==32?null:(um=!0,cm);case"textInput":return t=e.data,t===cm&&um?null:t;default:return null}}function $k(t,e){if(di)return t==="compositionend"||!iu&&dm(t,e)?(t=rm(),Gs=Xc=Qn=null,di=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return lm&&e.locale!=="ko"?null:e.data;default:return null}}var Fk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function fm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Fk[t.type]:e==="textarea"}function pm(t,e,n,r){Ig(r),e=ra(e,"onChange"),0<e.length&&(n=new Zc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var po=null,go=null;function jk(t){Lm(t,0)}function Zs(t){var e=mi(t);if(kg(e))return t}function Bk(t,e){if(t==="change")return e}var gm=!1;if(kn){var ou;if(kn){var su="oninput"in document;if(!su){var mm=document.createElement("div");mm.setAttribute("oninput","return;"),su=typeof mm.oninput=="function"}ou=su}else ou=!1;gm=ou&&(!document.documentMode||9<document.documentMode)}function ym(){po&&(po.detachEvent("onpropertychange",vm),go=po=null)}function vm(t){if(t.propertyName==="value"&&Zs(go)){var e=[];pm(e,go,t,jc(t)),Fg(jk,e)}}function Uk(t,e,n){t==="focusin"?(ym(),po=e,go=n,po.attachEvent("onpropertychange",vm)):t==="focusout"&&ym()}function zk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Zs(go)}function Hk(t,e){if(t==="click")return Zs(e)}function Vk(t,e){if(t==="input"||t==="change")return Zs(e)}function Kk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Jt=typeof Object.is=="function"?Object.is:Kk;function mo(t,e){if(Jt(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!yc.call(e,i)||!Jt(t[i],e[i]))return!1}return!0}function bm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function wm(t,e){var n=bm(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=bm(n)}}function Sm(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Sm(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function km(){for(var t=window,e=Ns();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ns(t.document)}return e}function au(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Wk(t){var e=km(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Sm(n.ownerDocument.documentElement,n)){if(r!==null&&au(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=wm(n,o);var s=wm(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var qk=kn&&"documentMode"in document&&11>=document.documentMode,hi=null,lu=null,yo=null,cu=!1;function xm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cu||hi==null||hi!==Ns(r)||(r=hi,"selectionStart"in r&&au(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yo&&mo(yo,r)||(yo=r,r=ra(lu,"onSelect"),0<r.length&&(e=new Zc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=hi)))}function ea(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var fi={animationend:ea("Animation","AnimationEnd"),animationiteration:ea("Animation","AnimationIteration"),animationstart:ea("Animation","AnimationStart"),transitionend:ea("Transition","TransitionEnd")},uu={},_m={};kn&&(_m=document.createElement("div").style,"AnimationEvent"in window||(delete fi.animationend.animation,delete fi.animationiteration.animation,delete fi.animationstart.animation),"TransitionEvent"in window||delete fi.transitionend.transition);function ta(t){if(uu[t])return uu[t];if(!fi[t])return t;var e=fi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in _m)return uu[t]=e[n];return t}var Cm=ta("animationend"),Em=ta("animationiteration"),Tm=ta("animationstart"),Mm=ta("transitionend"),Am=new Map,Om="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Yn(t,e){Am.set(t,e),Er(e,[t])}for(var du=0;du<Om.length;du++){var hu=Om[du],Jk=hu.toLowerCase(),Gk=hu[0].toUpperCase()+hu.slice(1);Yn(Jk,"on"+Gk)}Yn(Cm,"onAnimationEnd"),Yn(Em,"onAnimationIteration"),Yn(Tm,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(Mm,"onTransitionEnd"),ri("onMouseEnter",["mouseout","mouseover"]),ri("onMouseLeave",["mouseout","mouseover"]),ri("onPointerEnter",["pointerout","pointerover"]),ri("onPointerLeave",["pointerout","pointerover"]),Er("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Er("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Er("onBeforeInput",["compositionend","keypress","textInput","paste"]),Er("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Er("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Er("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Qk=new Set("cancel close invalid load scroll toggle".split(" ").concat(vo));function Dm(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,JS(r,e,void 0,t),t.currentTarget=null}function Lm(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var o=void 0;if(e)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&i.isPropagationStopped())break e;Dm(i,a,c),o=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==o&&i.isPropagationStopped())break e;Dm(i,a,c),o=l}}}if(js)throw t=Hc,js=!1,Hc=null,t}function Me(t,e){var n=e[wu];n===void 0&&(n=e[wu]=new Set);var r=t+"__bubble";n.has(r)||(Pm(e,t,2,!1),n.add(r))}function fu(t,e,n){var r=0;e&&(r|=4),Pm(n,t,r,e)}var na="_reactListening"+Math.random().toString(36).slice(2);function bo(t){if(!t[na]){t[na]=!0,pg.forEach(function(n){n!=="selectionchange"&&(Qk.has(n)||fu(n,!1,t),fu(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[na]||(e[na]=!0,fu("selectionchange",!1,e))}}function Pm(t,e,n,r){switch(nm(e)){case 1:var i=uk;break;case 4:i=dk;break;default:i=Qc}n=i.bind(null,e,n,t),i=void 0,!zc||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function pu(t,e,n,r,i){var o=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;s=s.return}for(;a!==null;){if(s=Mr(a),s===null)return;if(l=s.tag,l===5||l===6){r=o=s;continue e}a=a.parentNode}}r=r.return}Fg(function(){var c=o,d=jc(n),h=[];e:{var f=Am.get(t);if(f!==void 0){var g=Zc,y=t;switch(t){case"keypress":if(Qs(n)===0)break e;case"keydown":case"keyup":g=Ek;break;case"focusin":y="focus",g=nu;break;case"focusout":y="blur",g=nu;break;case"beforeblur":case"afterblur":g=nu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=om;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=pk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=Ak;break;case Cm:case Em:case Tm:g=yk;break;case Mm:g=Dk;break;case"scroll":g=hk;break;case"wheel":g=Pk;break;case"copy":case"cut":case"paste":g=bk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=am}var m=(e&4)!==0,S=!m&&t==="scroll",v=m?f!==null?f+"Capture":null:f;m=[];for(var w=c,k;w!==null;){k=w;var C=k.stateNode;if(k.tag===5&&C!==null&&(k=C,v!==null&&(C=eo(w,v),C!=null&&m.push(wo(w,C,k)))),S)break;w=w.return}0<m.length&&(f=new g(f,y,null,n,d),h.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",g=t==="mouseout"||t==="pointerout",f&&n!==Fc&&(y=n.relatedTarget||n.fromElement)&&(Mr(y)||y[_n]))break e;if((g||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,g?(y=n.relatedTarget||n.toElement,g=c,y=y?Mr(y):null,y!==null&&(S=Tr(y),y!==S||y.tag!==5&&y.tag!==6)&&(y=null)):(g=null,y=c),g!==y)){if(m=om,C="onMouseLeave",v="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(m=am,C="onPointerLeave",v="onPointerEnter",w="pointer"),S=g==null?f:mi(g),k=y==null?f:mi(y),f=new m(C,w+"leave",g,n,d),f.target=S,f.relatedTarget=k,C=null,Mr(d)===c&&(m=new m(v,w+"enter",y,n,d),m.target=k,m.relatedTarget=S,C=m),S=C,g&&y)t:{for(m=g,v=y,w=0,k=m;k;k=pi(k))w++;for(k=0,C=v;C;C=pi(C))k++;for(;0<w-k;)m=pi(m),w--;for(;0<k-w;)v=pi(v),k--;for(;w--;){if(m===v||v!==null&&m===v.alternate)break t;m=pi(m),v=pi(v)}m=null}else m=null;g!==null&&Im(h,f,g,m,!1),y!==null&&S!==null&&Im(h,S,y,m,!0)}}e:{if(f=c?mi(c):window,g=f.nodeName&&f.nodeName.toLowerCase(),g==="select"||g==="input"&&f.type==="file")var E=Bk;else if(fm(f))if(gm)E=Vk;else{E=zk;var L=Uk}else(g=f.nodeName)&&g.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(E=Hk);if(E&&(E=E(t,c))){pm(h,E,n,d);break e}L&&L(t,f,c),t==="focusout"&&(L=f._wrapperState)&&L.controlled&&f.type==="number"&&Pc(f,"number",f.value)}switch(L=c?mi(c):window,t){case"focusin":(fm(L)||L.contentEditable==="true")&&(hi=L,lu=c,yo=null);break;case"focusout":yo=lu=hi=null;break;case"mousedown":cu=!0;break;case"contextmenu":case"mouseup":case"dragend":cu=!1,xm(h,n,d);break;case"selectionchange":if(qk)break;case"keydown":case"keyup":xm(h,n,d)}var A;if(iu)e:{switch(t){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else di?dm(t,n)&&(R="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(lm&&n.locale!=="ko"&&(di||R!=="onCompositionStart"?R==="onCompositionEnd"&&di&&(A=rm()):(Qn=d,Xc="value"in Qn?Qn.value:Qn.textContent,di=!0)),L=ra(c,R),0<L.length&&(R=new sm(R,t,null,n,d),h.push({event:R,listeners:L}),A?R.data=A:(A=hm(n),A!==null&&(R.data=A)))),(A=Rk?Nk(t,n):$k(t,n))&&(c=ra(c,"onBeforeInput"),0<c.length&&(d=new sm("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:c}),d.data=A))}Lm(h,e)})}function wo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function ra(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=eo(t,n),o!=null&&r.unshift(wo(t,o,i)),o=eo(t,e),o!=null&&r.push(wo(t,o,i))),t=t.return}return r}function pi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Im(t,e,n,r,i){for(var o=e._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=eo(n,o),l!=null&&s.unshift(wo(n,l,a))):i||(l=eo(n,o),l!=null&&s.push(wo(n,l,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var Yk=/\r\n?/g,Xk=/\u0000|\uFFFD/g;function Rm(t){return(typeof t=="string"?t:""+t).replace(Yk,`
372
+ `).replace(Xk,"")}function ia(t,e,n){if(e=Rm(e),Rm(t)!==e&&n)throw Error($(425))}function oa(){}var gu=null,mu=null;function yu(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var vu=typeof setTimeout=="function"?setTimeout:void 0,Zk=typeof clearTimeout=="function"?clearTimeout:void 0,Nm=typeof Promise=="function"?Promise:void 0,ex=typeof queueMicrotask=="function"?queueMicrotask:typeof Nm<"u"?function(t){return Nm.resolve(null).then(t).catch(tx)}:vu;function tx(t){setTimeout(function(){throw t})}function bu(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),co(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);co(e)}function Xn(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function $m(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var gi=Math.random().toString(36).slice(2),ln="__reactFiber$"+gi,So="__reactProps$"+gi,_n="__reactContainer$"+gi,wu="__reactEvents$"+gi,nx="__reactListeners$"+gi,rx="__reactHandles$"+gi;function Mr(t){var e=t[ln];if(e)return e;for(var n=t.parentNode;n;){if(e=n[_n]||n[ln]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=$m(t);t!==null;){if(n=t[ln])return n;t=$m(t)}return e}t=n,n=t.parentNode}return null}function ko(t){return t=t[ln]||t[_n],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function mi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error($(33))}function sa(t){return t[So]||null}var Su=[],yi=-1;function Zn(t){return{current:t}}function Ae(t){0>yi||(t.current=Su[yi],Su[yi]=null,yi--)}function Te(t,e){yi++,Su[yi]=t.current,t.current=e}var er={},et=Zn(er),ft=Zn(!1),Ar=er;function vi(t,e){var n=t.type.contextTypes;if(!n)return er;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function pt(t){return t=t.childContextTypes,t!=null}function aa(){Ae(ft),Ae(et)}function Fm(t,e,n){if(et.current!==er)throw Error($(168));Te(et,e),Te(ft,n)}function jm(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error($(108,US(t)||"Unknown",i));return De({},n,r)}function la(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||er,Ar=et.current,Te(et,t),Te(ft,ft.current),!0}function Bm(t,e,n){var r=t.stateNode;if(!r)throw Error($(169));n?(t=jm(t,e,Ar),r.__reactInternalMemoizedMergedChildContext=t,Ae(ft),Ae(et),Te(et,t)):Ae(ft),Te(ft,n)}var Cn=null,ca=!1,ku=!1;function Um(t){Cn===null?Cn=[t]:Cn.push(t)}function ix(t){ca=!0,Um(t)}function tr(){if(!ku&&Cn!==null){ku=!0;var t=0,e=Se;try{var n=Cn;for(Se=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Cn=null,ca=!1}catch(i){throw Cn!==null&&(Cn=Cn.slice(t+1)),Hg(Vc,tr),i}finally{Se=e,ku=!1}}return null}var bi=[],wi=0,ua=null,da=0,It=[],Rt=0,Or=null,En=1,Tn="";function Dr(t,e){bi[wi++]=da,bi[wi++]=ua,ua=t,da=e}function zm(t,e,n){It[Rt++]=En,It[Rt++]=Tn,It[Rt++]=Or,Or=t;var r=En;t=Tn;var i=32-qt(r)-1;r&=~(1<<i),n+=1;var o=32-qt(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,En=1<<32-qt(e)+i|n<<i|r,Tn=o+t}else En=1<<o|n<<i|r,Tn=t}function xu(t){t.return!==null&&(Dr(t,1),zm(t,1,0))}function _u(t){for(;t===ua;)ua=bi[--wi],bi[wi]=null,da=bi[--wi],bi[wi]=null;for(;t===Or;)Or=It[--Rt],It[Rt]=null,Tn=It[--Rt],It[Rt]=null,En=It[--Rt],It[Rt]=null}var Ct=null,Et=null,Oe=!1,Gt=null;function Hm(t,e){var n=jt(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Vm(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ct=t,Et=Xn(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ct=t,Et=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Or!==null?{id:En,overflow:Tn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=jt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Ct=t,Et=null,!0):!1;default:return!1}}function Cu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Eu(t){if(Oe){var e=Et;if(e){var n=e;if(!Vm(t,e)){if(Cu(t))throw Error($(418));e=Xn(n.nextSibling);var r=Ct;e&&Vm(t,e)?Hm(r,n):(t.flags=t.flags&-4097|2,Oe=!1,Ct=t)}}else{if(Cu(t))throw Error($(418));t.flags=t.flags&-4097|2,Oe=!1,Ct=t}}}function Km(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ct=t}function ha(t){if(t!==Ct)return!1;if(!Oe)return Km(t),Oe=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!yu(t.type,t.memoizedProps)),e&&(e=Et)){if(Cu(t))throw Wm(),Error($(418));for(;e;)Hm(t,e),e=Xn(e.nextSibling)}if(Km(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error($(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Et=Xn(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Et=null}}else Et=Ct?Xn(t.stateNode.nextSibling):null;return!0}function Wm(){for(var t=Et;t;)t=Xn(t.nextSibling)}function Si(){Et=Ct=null,Oe=!1}function Tu(t){Gt===null?Gt=[t]:Gt.push(t)}var ox=xn.ReactCurrentBatchConfig;function xo(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error($(309));var r=n.stateNode}if(!r)throw Error($(147,t));var i=r,o=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===o?e.ref:(e=function(s){var a=i.refs;s===null?delete a[o]:a[o]=s},e._stringRef=o,e)}if(typeof t!="string")throw Error($(284));if(!n._owner)throw Error($(290,t))}return t}function fa(t,e){throw t=Object.prototype.toString.call(e),Error($(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function qm(t){var e=t._init;return e(t._payload)}function Jm(t){function e(v,w){if(t){var k=v.deletions;k===null?(v.deletions=[w],v.flags|=16):k.push(w)}}function n(v,w){if(!t)return null;for(;w!==null;)e(v,w),w=w.sibling;return null}function r(v,w){for(v=new Map;w!==null;)w.key!==null?v.set(w.key,w):v.set(w.index,w),w=w.sibling;return v}function i(v,w){return v=cr(v,w),v.index=0,v.sibling=null,v}function o(v,w,k){return v.index=k,t?(k=v.alternate,k!==null?(k=k.index,k<w?(v.flags|=2,w):k):(v.flags|=2,w)):(v.flags|=1048576,w)}function s(v){return t&&v.alternate===null&&(v.flags|=2),v}function a(v,w,k,C){return w===null||w.tag!==6?(w=vd(k,v.mode,C),w.return=v,w):(w=i(w,k),w.return=v,w)}function l(v,w,k,C){var E=k.type;return E===oi?d(v,w,k.props.children,C,k.key):w!==null&&(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Vn&&qm(E)===w.type)?(C=i(w,k.props),C.ref=xo(v,w,k),C.return=v,C):(C=$a(k.type,k.key,k.props,null,v.mode,C),C.ref=xo(v,w,k),C.return=v,C)}function c(v,w,k,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==k.containerInfo||w.stateNode.implementation!==k.implementation?(w=bd(k,v.mode,C),w.return=v,w):(w=i(w,k.children||[]),w.return=v,w)}function d(v,w,k,C,E){return w===null||w.tag!==7?(w=jr(k,v.mode,C,E),w.return=v,w):(w=i(w,k),w.return=v,w)}function h(v,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=vd(""+w,v.mode,k),w.return=v,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Is:return k=$a(w.type,w.key,w.props,null,v.mode,k),k.ref=xo(v,null,w),k.return=v,k;case ii:return w=bd(w,v.mode,k),w.return=v,w;case Vn:var C=w._init;return h(v,C(w._payload),k)}if(Yi(w)||Gi(w))return w=jr(w,v.mode,k,null),w.return=v,w;fa(v,w)}return null}function f(v,w,k,C){var E=w!==null?w.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return E!==null?null:a(v,w,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Is:return k.key===E?l(v,w,k,C):null;case ii:return k.key===E?c(v,w,k,C):null;case Vn:return E=k._init,f(v,w,E(k._payload),C)}if(Yi(k)||Gi(k))return E!==null?null:d(v,w,k,C,null);fa(v,k)}return null}function g(v,w,k,C,E){if(typeof C=="string"&&C!==""||typeof C=="number")return v=v.get(k)||null,a(w,v,""+C,E);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Is:return v=v.get(C.key===null?k:C.key)||null,l(w,v,C,E);case ii:return v=v.get(C.key===null?k:C.key)||null,c(w,v,C,E);case Vn:var L=C._init;return g(v,w,k,L(C._payload),E)}if(Yi(C)||Gi(C))return v=v.get(k)||null,d(w,v,C,E,null);fa(w,C)}return null}function y(v,w,k,C){for(var E=null,L=null,A=w,R=w=0,G=null;A!==null&&R<k.length;R++){A.index>R?(G=A,A=null):G=A.sibling;var U=f(v,A,k[R],C);if(U===null){A===null&&(A=G);break}t&&A&&U.alternate===null&&e(v,A),w=o(U,w,R),L===null?E=U:L.sibling=U,L=U,A=G}if(R===k.length)return n(v,A),Oe&&Dr(v,R),E;if(A===null){for(;R<k.length;R++)A=h(v,k[R],C),A!==null&&(w=o(A,w,R),L===null?E=A:L.sibling=A,L=A);return Oe&&Dr(v,R),E}for(A=r(v,A);R<k.length;R++)G=g(A,v,R,k[R],C),G!==null&&(t&&G.alternate!==null&&A.delete(G.key===null?R:G.key),w=o(G,w,R),L===null?E=G:L.sibling=G,L=G);return t&&A.forEach(function(K){return e(v,K)}),Oe&&Dr(v,R),E}function m(v,w,k,C){var E=Gi(k);if(typeof E!="function")throw Error($(150));if(k=E.call(k),k==null)throw Error($(151));for(var L=E=null,A=w,R=w=0,G=null,U=k.next();A!==null&&!U.done;R++,U=k.next()){A.index>R?(G=A,A=null):G=A.sibling;var K=f(v,A,U.value,C);if(K===null){A===null&&(A=G);break}t&&A&&K.alternate===null&&e(v,A),w=o(K,w,R),L===null?E=K:L.sibling=K,L=K,A=G}if(U.done)return n(v,A),Oe&&Dr(v,R),E;if(A===null){for(;!U.done;R++,U=k.next())U=h(v,U.value,C),U!==null&&(w=o(U,w,R),L===null?E=U:L.sibling=U,L=U);return Oe&&Dr(v,R),E}for(A=r(v,A);!U.done;R++,U=k.next())U=g(A,v,R,U.value,C),U!==null&&(t&&U.alternate!==null&&A.delete(U.key===null?R:U.key),w=o(U,w,R),L===null?E=U:L.sibling=U,L=U);return t&&A.forEach(function(j){return e(v,j)}),Oe&&Dr(v,R),E}function S(v,w,k,C){if(typeof k=="object"&&k!==null&&k.type===oi&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Is:e:{for(var E=k.key,L=w;L!==null;){if(L.key===E){if(E=k.type,E===oi){if(L.tag===7){n(v,L.sibling),w=i(L,k.props.children),w.return=v,v=w;break e}}else if(L.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Vn&&qm(E)===L.type){n(v,L.sibling),w=i(L,k.props),w.ref=xo(v,L,k),w.return=v,v=w;break e}n(v,L);break}else e(v,L);L=L.sibling}k.type===oi?(w=jr(k.props.children,v.mode,C,k.key),w.return=v,v=w):(C=$a(k.type,k.key,k.props,null,v.mode,C),C.ref=xo(v,w,k),C.return=v,v=C)}return s(v);case ii:e:{for(L=k.key;w!==null;){if(w.key===L)if(w.tag===4&&w.stateNode.containerInfo===k.containerInfo&&w.stateNode.implementation===k.implementation){n(v,w.sibling),w=i(w,k.children||[]),w.return=v,v=w;break e}else{n(v,w);break}else e(v,w);w=w.sibling}w=bd(k,v.mode,C),w.return=v,v=w}return s(v);case Vn:return L=k._init,S(v,w,L(k._payload),C)}if(Yi(k))return y(v,w,k,C);if(Gi(k))return m(v,w,k,C);fa(v,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,w!==null&&w.tag===6?(n(v,w.sibling),w=i(w,k),w.return=v,v=w):(n(v,w),w=vd(k,v.mode,C),w.return=v,v=w),s(v)):n(v,w)}return S}var ki=Jm(!0),Gm=Jm(!1),pa=Zn(null),ga=null,xi=null,Mu=null;function Au(){Mu=xi=ga=null}function Ou(t){var e=pa.current;Ae(pa),t._currentValue=e}function Du(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function _i(t,e){ga=t,Mu=xi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(gt=!0),t.firstContext=null)}function Nt(t){var e=t._currentValue;if(Mu!==t)if(t={context:t,memoizedValue:e,next:null},xi===null){if(ga===null)throw Error($(308));xi=t,ga.dependencies={lanes:0,firstContext:t}}else xi=xi.next=t;return e}var Lr=null;function Lu(t){Lr===null?Lr=[t]:Lr.push(t)}function Qm(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Lu(e)):(n.next=i.next,i.next=n),e.interleaved=n,Mn(t,r)}function Mn(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var nr=!1;function Pu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ym(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function An(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function rr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ye&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Mn(t,n)}return i=r.interleaved,i===null?(e.next=e,Lu(r)):(e.next=i.next,i.next=e),r.interleaved=e,Mn(t,n)}function ma(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qc(t,n)}}function Xm(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function ya(t,e,n,r){var i=t.updateQueue;nr=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?o=c:s.next=c,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(o!==null){var h=i.baseState;s=0,d=c=l=null,a=o;do{var f=a.lane,g=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=t,m=a;switch(f=e,g=n,m.tag){case 1:if(y=m.payload,typeof y=="function"){h=y.call(g,h,f);break e}h=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=m.payload,f=typeof y=="function"?y.call(g,h,f):y,f==null)break e;h=De({},h,f);break e;case 2:nr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else g={eventTime:g,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=g,l=h):d=d.next=g,s|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(l=h),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Rr|=s,t.lanes=s,t.memoizedState=h}}function Zm(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error($(191,i));i.call(r)}}}var _o={},cn=Zn(_o),Co=Zn(_o),Eo=Zn(_o);function Pr(t){if(t===_o)throw Error($(174));return t}function Iu(t,e){switch(Te(Eo,e),Te(Co,t),Te(cn,_o),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Rc(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Rc(e,t)}Ae(cn),Te(cn,e)}function Ci(){Ae(cn),Ae(Co),Ae(Eo)}function ey(t){Pr(Eo.current);var e=Pr(cn.current),n=Rc(e,t.type);e!==n&&(Te(Co,t),Te(cn,n))}function Ru(t){Co.current===t&&(Ae(cn),Ae(Co))}var Le=Zn(0);function va(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Nu=[];function $u(){for(var t=0;t<Nu.length;t++)Nu[t]._workInProgressVersionPrimary=null;Nu.length=0}var ba=xn.ReactCurrentDispatcher,Fu=xn.ReactCurrentBatchConfig,Ir=0,Pe=null,je=null,He=null,wa=!1,To=!1,Mo=0,sx=0;function tt(){throw Error($(321))}function ju(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Jt(t[n],e[n]))return!1;return!0}function Bu(t,e,n,r,i,o){if(Ir=o,Pe=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ba.current=t===null||t.memoizedState===null?ux:dx,t=n(r,i),To){o=0;do{if(To=!1,Mo=0,25<=o)throw Error($(301));o+=1,He=je=null,e.updateQueue=null,ba.current=hx,t=n(r,i)}while(To)}if(ba.current=xa,e=je!==null&&je.next!==null,Ir=0,He=je=Pe=null,wa=!1,e)throw Error($(300));return t}function Uu(){var t=Mo!==0;return Mo=0,t}function un(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return He===null?Pe.memoizedState=He=t:He=He.next=t,He}function $t(){if(je===null){var t=Pe.alternate;t=t!==null?t.memoizedState:null}else t=je.next;var e=He===null?Pe.memoizedState:He.next;if(e!==null)He=e,je=t;else{if(t===null)throw Error($(310));je=t,t={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},He===null?Pe.memoizedState=He=t:He=He.next=t}return He}function Ao(t,e){return typeof e=="function"?e(t):e}function zu(t){var e=$t(),n=e.queue;if(n===null)throw Error($(311));n.lastRenderedReducer=t;var r=je,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var a=s=null,l=null,c=o;do{var d=c.lane;if((Ir&d)===d)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var h={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,s=r):l=l.next=h,Pe.lanes|=d,Rr|=d}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,Jt(r,e.memoizedState)||(gt=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do o=i.lane,Pe.lanes|=o,Rr|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Hu(t){var e=$t(),n=e.queue;if(n===null)throw Error($(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,o=e.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=t(o,s.action),s=s.next;while(s!==i);Jt(o,e.memoizedState)||(gt=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function ty(){}function ny(t,e){var n=Pe,r=$t(),i=e(),o=!Jt(r.memoizedState,i);if(o&&(r.memoizedState=i,gt=!0),r=r.queue,Vu(oy.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||He!==null&&He.memoizedState.tag&1){if(n.flags|=2048,Oo(9,iy.bind(null,n,r,i,e),void 0,null),Ve===null)throw Error($(349));Ir&30||ry(n,e,i)}return i}function ry(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Pe.updateQueue,e===null?(e={lastEffect:null,stores:null},Pe.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function iy(t,e,n,r){e.value=n,e.getSnapshot=r,sy(e)&&ay(t)}function oy(t,e,n){return n(function(){sy(e)&&ay(t)})}function sy(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Jt(t,n)}catch{return!0}}function ay(t){var e=Mn(t,1);e!==null&&Zt(e,t,1,-1)}function ly(t){var e=un();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:t},e.queue=t,t=t.dispatch=cx.bind(null,Pe,t),[e.memoizedState,t]}function Oo(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Pe.updateQueue,e===null?(e={lastEffect:null,stores:null},Pe.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function cy(){return $t().memoizedState}function Sa(t,e,n,r){var i=un();Pe.flags|=t,i.memoizedState=Oo(1|e,n,void 0,r===void 0?null:r)}function ka(t,e,n,r){var i=$t();r=r===void 0?null:r;var o=void 0;if(je!==null){var s=je.memoizedState;if(o=s.destroy,r!==null&&ju(r,s.deps)){i.memoizedState=Oo(e,n,o,r);return}}Pe.flags|=t,i.memoizedState=Oo(1|e,n,o,r)}function uy(t,e){return Sa(8390656,8,t,e)}function Vu(t,e){return ka(2048,8,t,e)}function dy(t,e){return ka(4,2,t,e)}function hy(t,e){return ka(4,4,t,e)}function fy(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function py(t,e,n){return n=n!=null?n.concat([t]):null,ka(4,4,fy.bind(null,e,t),n)}function Ku(){}function gy(t,e){var n=$t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&ju(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function my(t,e){var n=$t();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&ju(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function yy(t,e,n){return Ir&21?(Jt(n,e)||(n=qg(),Pe.lanes|=n,Rr|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,gt=!0),t.memoizedState=n)}function ax(t,e){var n=Se;Se=n!==0&&4>n?n:4,t(!0);var r=Fu.transition;Fu.transition={};try{t(!1),e()}finally{Se=n,Fu.transition=r}}function vy(){return $t().memoizedState}function lx(t,e,n){var r=ar(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},by(t))wy(e,n);else if(n=Qm(t,e,n,r),n!==null){var i=ut();Zt(n,t,r,i),Sy(n,e,r)}}function cx(t,e,n){var r=ar(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(by(t))wy(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Jt(a,s)){var l=e.interleaved;l===null?(i.next=i,Lu(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Qm(t,e,i,r),n!==null&&(i=ut(),Zt(n,t,r,i),Sy(n,e,r))}}function by(t){var e=t.alternate;return t===Pe||e!==null&&e===Pe}function wy(t,e){To=wa=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Sy(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qc(t,n)}}var xa={readContext:Nt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},ux={readContext:Nt,useCallback:function(t,e){return un().memoizedState=[t,e===void 0?null:e],t},useContext:Nt,useEffect:uy,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Sa(4194308,4,fy.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Sa(4194308,4,t,e)},useInsertionEffect:function(t,e){return Sa(4,2,t,e)},useMemo:function(t,e){var n=un();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=un();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=lx.bind(null,Pe,t),[r.memoizedState,t]},useRef:function(t){var e=un();return t={current:t},e.memoizedState=t},useState:ly,useDebugValue:Ku,useDeferredValue:function(t){return un().memoizedState=t},useTransition:function(){var t=ly(!1),e=t[0];return t=ax.bind(null,t[1]),un().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Pe,i=un();if(Oe){if(n===void 0)throw Error($(407));n=n()}else{if(n=e(),Ve===null)throw Error($(349));Ir&30||ry(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,uy(oy.bind(null,r,o,t),[t]),r.flags|=2048,Oo(9,iy.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=un(),e=Ve.identifierPrefix;if(Oe){var n=Tn,r=En;n=(r&~(1<<32-qt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Mo++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=sx++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},dx={readContext:Nt,useCallback:gy,useContext:Nt,useEffect:Vu,useImperativeHandle:py,useInsertionEffect:dy,useLayoutEffect:hy,useMemo:my,useReducer:zu,useRef:cy,useState:function(){return zu(Ao)},useDebugValue:Ku,useDeferredValue:function(t){var e=$t();return yy(e,je.memoizedState,t)},useTransition:function(){var t=zu(Ao)[0],e=$t().memoizedState;return[t,e]},useMutableSource:ty,useSyncExternalStore:ny,useId:vy,unstable_isNewReconciler:!1},hx={readContext:Nt,useCallback:gy,useContext:Nt,useEffect:Vu,useImperativeHandle:py,useInsertionEffect:dy,useLayoutEffect:hy,useMemo:my,useReducer:Hu,useRef:cy,useState:function(){return Hu(Ao)},useDebugValue:Ku,useDeferredValue:function(t){var e=$t();return je===null?e.memoizedState=t:yy(e,je.memoizedState,t)},useTransition:function(){var t=Hu(Ao)[0],e=$t().memoizedState;return[t,e]},useMutableSource:ty,useSyncExternalStore:ny,useId:vy,unstable_isNewReconciler:!1};function Qt(t,e){if(t&&t.defaultProps){e=De({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Wu(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:De({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var _a={isMounted:function(t){return(t=t._reactInternals)?Tr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=ut(),i=ar(t),o=An(r,i);o.payload=e,n!=null&&(o.callback=n),e=rr(t,o,i),e!==null&&(Zt(e,t,i,r),ma(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=ut(),i=ar(t),o=An(r,i);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=rr(t,o,i),e!==null&&(Zt(e,t,i,r),ma(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=ut(),r=ar(t),i=An(n,r);i.tag=2,e!=null&&(i.callback=e),e=rr(t,i,r),e!==null&&(Zt(e,t,r,n),ma(e,t,r))}};function ky(t,e,n,r,i,o,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,o,s):e.prototype&&e.prototype.isPureReactComponent?!mo(n,r)||!mo(i,o):!0}function xy(t,e,n){var r=!1,i=er,o=e.contextType;return typeof o=="object"&&o!==null?o=Nt(o):(i=pt(e)?Ar:et.current,r=e.contextTypes,o=(r=r!=null)?vi(t,i):er),e=new e(n,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=_a,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function _y(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&_a.enqueueReplaceState(e,e.state,null)}function qu(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Pu(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Nt(o):(o=pt(e)?Ar:et.current,i.context=vi(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(Wu(t,e,o,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&_a.enqueueReplaceState(i,i.state,null),ya(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Ei(t,e){try{var n="",r=e;do n+=BS(r),r=r.return;while(r);var i=n}catch(o){i=`
373
373
  Error generating stack: `+o.message+`
374
- `+o.stack}return{value:t,source:e,stack:i,digest:null}}function Ju(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Gu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var fx=typeof WeakMap=="function"?WeakMap:Map;function _y(t,e,n){n=Mn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Da||(Da=!0,ud=r),Gu(t,e)},n}function Cy(t,e,n){n=Mn(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Gu(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Gu(t,e),typeof r!="function"&&(or===null?or=new Set([this]):or.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function Ey(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new fx;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=Tx.bind(null,t,e,n),e.then(t,t))}function Ty(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function My(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Mn(-1,1),e.tag=2,rr(n,e,1))),n.lanes|=1),t)}var px=kn.ReactCurrentOwner,pt=!1;function lt(t,e,n,r){e.child=t===null?Jm(e,null,n,r):ki(e,t.child,n,r)}function Ay(t,e,n,r,i){n=n.render;var o=e.ref;return _i(e,i),r=Bu(t,e,n,r,o,i),n=Uu(),t!==null&&!pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,An(t,e,i)):(Oe&&n&&xu(e),e.flags|=1,lt(t,e,r,i),e.child)}function Oy(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!yd(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,Dy(t,e,o,r,i)):(t=$a(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:mo,n(s,r)&&t.ref===e.ref)return An(t,e,i)}return e.flags|=1,t=cr(o,r),t.ref=e.ref,t.return=e,e.child=t}function Dy(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(mo(o,r)&&t.ref===e.ref)if(pt=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(pt=!0);else return e.lanes=t.lanes,An(t,e,i)}return Qu(t,e,n,r,i)}function Py(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Te(Mi,Tt),Tt|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Te(Mi,Tt),Tt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,Te(Mi,Tt),Tt|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,Te(Mi,Tt),Tt|=r;return lt(t,e,i,n),e.child}function Ly(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Qu(t,e,n,r,i){var o=ft(n)?Ar:Ze.current;return o=vi(e,o),_i(e,i),n=Bu(t,e,n,r,o,i),r=Uu(),t!==null&&!pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,An(t,e,i)):(Oe&&r&&xu(e),e.flags|=1,lt(t,e,n,i),e.child)}function Iy(t,e,n,r,i){if(ft(n)){var o=!0;la(e)}else o=!1;if(_i(e,i),e.stateNode===null)Ea(t,e),ky(e,n,r),qu(e,n,r,i),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Nt(c):(c=ft(n)?Ar:Ze.current,c=vi(e,c));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";h||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&xy(e,s,r,c),nr=!1;var f=e.memoizedState;s.state=f,ya(e,r,s,i),l=e.memoizedState,a!==r||f!==l||ht.current||nr?(typeof d=="function"&&(Wu(e,n,d,r),l=e.memoizedState),(a=nr||Sy(e,n,a,r,f,l,c))?(h||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,Qm(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Gt(e.type,a),s.props=c,h=e.pendingProps,f=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Nt(l):(l=ft(n)?Ar:Ze.current,l=vi(e,l));var v=n.getDerivedStateFromProps;(d=typeof v=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==h||f!==l)&&xy(e,s,r,l),nr=!1,f=e.memoizedState,s.state=f,ya(e,r,s,i);var b=e.memoizedState;a!==h||f!==b||ht.current||nr?(typeof v=="function"&&(Wu(e,n,v,r),b=e.memoizedState),(c=nr||Sy(e,n,c,r,f,b,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,b,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,b,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=b),s.props=r,s.state=b,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return Yu(t,e,n,r,o,i)}function Yu(t,e,n,r,i,o){Ly(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&jm(e,n,!1),An(t,e,o);r=e.stateNode,px.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=ki(e,t.child,null,o),e.child=ki(e,null,a,o)):lt(t,e,a,o),e.memoizedState=r.state,i&&jm(e,n,!0),e.child}function Ry(t){var e=t.stateNode;e.pendingContext?$m(t,e.pendingContext,e.pendingContext!==e.context):e.context&&$m(t,e.context,!1),Iu(t,e.containerInfo)}function Ny(t,e,n,r,i){return Si(),Tu(i),e.flags|=256,lt(t,e,n,r),e.child}var Xu={dehydrated:null,treeContext:null,retryLane:0};function Zu(t){return{baseLanes:t,cachePool:null,transitions:null}}function $y(t,e,n){var r=e.pendingProps,i=Pe.current,o=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Te(Pe,i&1),t===null)return Eu(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,o?(r=e.mode,o=e.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=Fa(s,r,0,null),t=jr(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Zu(n),e.memoizedState=Xu,t):ed(e,s));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return gx(t,e,s,r,a,i,n);if(o){o=r.fallback,s=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=cr(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?o=cr(a,o):(o=jr(o,s,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,r=o,o=e.child,s=t.child.memoizedState,s=s===null?Zu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=Xu,r}return o=t.child,t=o.sibling,r=cr(o,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function ed(t,e){return e=Fa({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Ca(t,e,n,r){return r!==null&&Tu(r),ki(e,t.child,null,n),t=ed(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function gx(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=Ju(Error(N(422))),Ca(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Fa({mode:"visible",children:r.children},i,0,null),o=jr(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&ki(e,t.child,null,s),e.child.memoizedState=Zu(s),e.memoizedState=Xu,o);if(!(e.mode&1))return Ca(t,e,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error(N(419)),r=Ju(o,r,void 0),Ca(t,e,s,r)}if(a=(s&t.childLanes)!==0,pt||a){if(r=Ve,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,Tn(t,i),Xt(r,t,i,-1))}return md(),r=Ju(Error(N(421))),Ca(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=Mx.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,Et=Xn(i.nextSibling),Ct=e,Oe=!0,Jt=null,t!==null&&(It[Rt++]=Cn,It[Rt++]=En,It[Rt++]=Or,Cn=t.id,En=t.overflow,Or=e),e=ed(e,r.children),e.flags|=4096,e)}function Fy(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Du(t.return,e,n)}function td(t,e,n,r,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function jy(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(lt(t,e,r.children,n),r=Pe.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Fy(t,n,e);else if(t.tag===19)Fy(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Te(Pe,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&va(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),td(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&va(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}td(e,!0,n,null,o);break;case"together":td(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ea(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function An(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Rr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(N(153));if(e.child!==null){for(t=e.child,n=cr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=cr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function mx(t,e,n){switch(e.tag){case 3:Ry(e),Si();break;case 5:Zm(e);break;case 1:ft(e.type)&&la(e);break;case 4:Iu(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Te(pa,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Te(Pe,Pe.current&1),e.flags|=128,null):n&e.child.childLanes?$y(t,e,n):(Te(Pe,Pe.current&1),t=An(t,e,n),t!==null?t.sibling:null);Te(Pe,Pe.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return jy(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Te(Pe,Pe.current),r)break;return null;case 22:case 23:return e.lanes=0,Py(t,e,n)}return An(t,e,n)}var By,nd,Uy,zy;By=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},nd=function(){},Uy=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Lr(ln.current);var o=null;switch(n){case"input":i=Dc(t,i),r=Dc(t,r),o=[];break;case"select":i=De({},i,{value:void 0}),r=De({},r,{value:void 0}),o=[];break;case"textarea":i=Ic(t,i),r=Ic(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=oa)}Nc(n,r);var s;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ji.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(o||(o=[]),o.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ji.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Me("scroll",t),o||a===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(e.updateQueue=c)&&(e.flags|=4)}},zy=function(t,e,n,r){n!==r&&(e.flags|=4)};function Do(t,e){if(!Oe)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function tt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function yx(t,e,n){var r=e.pendingProps;switch(_u(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(e),null;case 1:return ft(e.type)&&aa(),tt(e),null;case 3:return r=e.stateNode,Ci(),Ae(ht),Ae(Ze),$u(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(ha(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Jt!==null&&(fd(Jt),Jt=null))),nd(t,e),tt(e),null;case 5:Ru(e);var i=Lr(Eo.current);if(n=e.type,t!==null&&e.stateNode!=null)Uy(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(N(166));return tt(e),null}if(t=Lr(ln.current),ha(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[an]=e,r[So]=o,t=(e.mode&1)!==0,n){case"dialog":Me("cancel",r),Me("close",r);break;case"iframe":case"object":case"embed":Me("load",r);break;case"video":case"audio":for(i=0;i<vo.length;i++)Me(vo[i],r);break;case"source":Me("error",r);break;case"img":case"image":case"link":Me("error",r),Me("load",r);break;case"details":Me("toggle",r);break;case"input":kg(r,o),Me("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Me("invalid",r);break;case"textarea":Cg(r,o),Me("invalid",r)}Nc(n,o),i=null;for(var s in o)if(o.hasOwnProperty(s)){var a=o[s];s==="children"?typeof a=="string"?r.textContent!==a&&(o.suppressHydrationWarning!==!0&&ia(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&ia(r.textContent,a,t),i=["children",""+a]):Ji.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Me("scroll",r)}switch(n){case"input":Rs(r),_g(r,o,!0);break;case"textarea":Rs(r),Tg(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=oa)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Mg(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[an]=e,t[So]=r,By(t,e,!1,!1),e.stateNode=t;e:{switch(s=$c(n,r),n){case"dialog":Me("cancel",t),Me("close",t),i=r;break;case"iframe":case"object":case"embed":Me("load",t),i=r;break;case"video":case"audio":for(i=0;i<vo.length;i++)Me(vo[i],t);i=r;break;case"source":Me("error",t),i=r;break;case"img":case"image":case"link":Me("error",t),Me("load",t),i=r;break;case"details":Me("toggle",t),i=r;break;case"input":kg(t,r),i=Dc(t,r),Me("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=De({},r,{value:void 0}),Me("invalid",t);break;case"textarea":Cg(t,r),i=Ic(t,r),Me("invalid",t);break;default:i=r}Nc(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?Dg(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Ag(t,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Xi(t,l):typeof l=="number"&&Xi(t,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Ji.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Me("scroll",t):l!=null&&wc(t,o,l,s))}switch(n){case"input":Rs(t),_g(t,r,!1);break;case"textarea":Rs(t),Tg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Kn(r.value));break;case"select":t.multiple=!!r.multiple,o=r.value,o!=null?si(t,!!r.multiple,o,!1):r.defaultValue!=null&&si(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=oa)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return tt(e),null;case 6:if(t&&e.stateNode!=null)zy(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(N(166));if(n=Lr(Eo.current),Lr(ln.current),ha(e)){if(r=e.stateNode,n=e.memoizedProps,r[an]=e,(o=r.nodeValue!==n)&&(t=Ct,t!==null))switch(t.tag){case 3:ia(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ia(r.nodeValue,n,(t.mode&1)!==0)}o&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[an]=e,e.stateNode=r}return tt(e),null;case 13:if(Ae(Pe),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Oe&&Et!==null&&e.mode&1&&!(e.flags&128))Km(),Si(),e.flags|=98560,o=!1;else if(o=ha(e),r!==null&&r.dehydrated!==null){if(t===null){if(!o)throw Error(N(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(N(317));o[an]=e}else Si(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;tt(e),o=!1}else Jt!==null&&(fd(Jt),Jt=null),o=!0;if(!o)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Pe.current&1?Be===0&&(Be=3):md())),e.updateQueue!==null&&(e.flags|=4),tt(e),null);case 4:return Ci(),nd(t,e),t===null&&bo(e.stateNode.containerInfo),tt(e),null;case 10:return Ou(e.type._context),tt(e),null;case 17:return ft(e.type)&&aa(),tt(e),null;case 19:if(Ae(Pe),o=e.memoizedState,o===null)return tt(e),null;if(r=(e.flags&128)!==0,s=o.rendering,s===null)if(r)Do(o,!1);else{if(Be!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=va(t),s!==null){for(e.flags|=128,Do(o,!1),r=s.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)o=n,t=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=t,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,t=s.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Te(Pe,Pe.current&1|2),e.child}t=t.sibling}o.tail!==null&&Ne()>Ai&&(e.flags|=128,r=!0,Do(o,!1),e.lanes=4194304)}else{if(!r)if(t=va(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Do(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Oe)return tt(e),null}else 2*Ne()-o.renderingStartTime>Ai&&n!==1073741824&&(e.flags|=128,r=!0,Do(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Ne(),e.sibling=null,n=Pe.current,Te(Pe,r?n&1|2:n&1),e):(tt(e),null);case 22:case 23:return gd(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Tt&1073741824&&(tt(e),e.subtreeFlags&6&&(e.flags|=8192)):tt(e),null;case 24:return null;case 25:return null}throw Error(N(156,e.tag))}function vx(t,e){switch(_u(e),e.tag){case 1:return ft(e.type)&&aa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ci(),Ae(ht),Ae(Ze),$u(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Ru(e),null;case 13:if(Ae(Pe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(N(340));Si()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ae(Pe),null;case 4:return Ci(),null;case 10:return Ou(e.type._context),null;case 22:case 23:return gd(),null;case 24:return null;default:return null}}var Ta=!1,nt=!1,bx=typeof WeakSet=="function"?WeakSet:Set,V=null;function Ti(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ie(t,e,r)}else n.current=null}function rd(t,e,n){try{n()}catch(r){Ie(t,e,r)}}var Hy=!1;function wx(t,e){if(gu=qs,t=Sm(),au(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,d=0,h=t,f=null;t:for(;;){for(var v;h!==n||i!==0&&h.nodeType!==3||(a=s+i),h!==o||r!==0&&h.nodeType!==3||(l=s+r),h.nodeType===3&&(s+=h.nodeValue.length),(v=h.firstChild)!==null;)f=h,h=v;for(;;){if(h===t)break t;if(f===n&&++c===i&&(a=s),f===o&&++d===r&&(l=s),(v=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=v}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(mu={focusedElem:t,selectionRange:n},qs=!1,V=e;V!==null;)if(e=V,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,V=t;else for(;V!==null;){e=V;try{var b=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var g=b.memoizedProps,S=b.memoizedState,m=e.stateNode,w=m.getSnapshotBeforeUpdate(e.elementType===e.type?g:Gt(e.type,g),S);m.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(C){Ie(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,V=t;break}V=e.return}return b=Hy,Hy=!1,b}function Po(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&rd(e,n,o)}i=i.next}while(i!==r)}}function Ma(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function id(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Vy(t){var e=t.alternate;e!==null&&(t.alternate=null,Vy(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[an],delete e[So],delete e[wu],delete e[nx],delete e[rx])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Ky(t){return t.tag===5||t.tag===3||t.tag===4}function Wy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ky(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function od(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=oa));else if(r!==4&&(t=t.child,t!==null))for(od(t,e,n),t=t.sibling;t!==null;)od(t,e,n),t=t.sibling}function sd(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(sd(t,e,n),t=t.sibling;t!==null;)sd(t,e,n),t=t.sibling}var Je=null,Qt=!1;function ir(t,e,n){for(n=n.child;n!==null;)qy(t,e,n),n=n.sibling}function qy(t,e,n){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(Us,n)}catch{}switch(n.tag){case 5:nt||Ti(n,e);case 6:var r=Je,i=Qt;Je=null,ir(t,e,n),Je=r,Qt=i,Je!==null&&(Qt?(t=Je,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Je.removeChild(n.stateNode));break;case 18:Je!==null&&(Qt?(t=Je,n=n.stateNode,t.nodeType===8?bu(t.parentNode,n):t.nodeType===1&&bu(t,n),co(t)):bu(Je,n.stateNode));break;case 4:r=Je,i=Qt,Je=n.stateNode.containerInfo,Qt=!0,ir(t,e,n),Je=r,Qt=i;break;case 0:case 11:case 14:case 15:if(!nt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&rd(n,e,s),i=i.next}while(i!==r)}ir(t,e,n);break;case 1:if(!nt&&(Ti(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ie(n,e,a)}ir(t,e,n);break;case 21:ir(t,e,n);break;case 22:n.mode&1?(nt=(r=nt)||n.memoizedState!==null,ir(t,e,n),nt=r):ir(t,e,n);break;default:ir(t,e,n)}}function Jy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new bx),e.forEach(function(r){var i=Ax.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Yt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=t,s=e,a=s;e:for(;a!==null;){switch(a.tag){case 5:Je=a.stateNode,Qt=!1;break e;case 3:Je=a.stateNode.containerInfo,Qt=!0;break e;case 4:Je=a.stateNode.containerInfo,Qt=!0;break e}a=a.return}if(Je===null)throw Error(N(160));qy(o,s,i),Je=null,Qt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Ie(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Gy(e,t),e=e.sibling}function Gy(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Yt(e,t),un(t),r&4){try{Po(3,t,t.return),Ma(3,t)}catch(g){Ie(t,t.return,g)}try{Po(5,t,t.return)}catch(g){Ie(t,t.return,g)}}break;case 1:Yt(e,t),un(t),r&512&&n!==null&&Ti(n,n.return);break;case 5:if(Yt(e,t),un(t),r&512&&n!==null&&Ti(n,n.return),t.flags&32){var i=t.stateNode;try{Xi(i,"")}catch(g){Ie(t,t.return,g)}}if(r&4&&(i=t.stateNode,i!=null)){var o=t.memoizedProps,s=n!==null?n.memoizedProps:o,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&xg(i,o),$c(a,s);var c=$c(a,o);for(s=0;s<l.length;s+=2){var d=l[s],h=l[s+1];d==="style"?Dg(i,h):d==="dangerouslySetInnerHTML"?Ag(i,h):d==="children"?Xi(i,h):wc(i,d,h,c)}switch(a){case"input":Pc(i,o);break;case"textarea":Eg(i,o);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var v=o.value;v!=null?si(i,!!o.multiple,v,!1):f!==!!o.multiple&&(o.defaultValue!=null?si(i,!!o.multiple,o.defaultValue,!0):si(i,!!o.multiple,o.multiple?[]:"",!1))}i[So]=o}catch(g){Ie(t,t.return,g)}}break;case 6:if(Yt(e,t),un(t),r&4){if(t.stateNode===null)throw Error(N(162));i=t.stateNode,o=t.memoizedProps;try{i.nodeValue=o}catch(g){Ie(t,t.return,g)}}break;case 3:if(Yt(e,t),un(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{co(e.containerInfo)}catch(g){Ie(t,t.return,g)}break;case 4:Yt(e,t),un(t);break;case 13:Yt(e,t),un(t),i=t.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(cd=Ne())),r&4&&Jy(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(nt=(c=nt)||d,Yt(e,t),nt=c):Yt(e,t),un(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(V=t,d=t.child;d!==null;){for(h=V=d;V!==null;){switch(f=V,v=f.child,f.tag){case 0:case 11:case 14:case 15:Po(4,f,f.return);break;case 1:Ti(f,f.return);var b=f.stateNode;if(typeof b.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,b.props=e.memoizedProps,b.state=e.memoizedState,b.componentWillUnmount()}catch(g){Ie(r,n,g)}}break;case 5:Ti(f,f.return);break;case 22:if(f.memoizedState!==null){Xy(h);continue}}v!==null?(v.return=f,V=v):Xy(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{i=h.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=h.stateNode,l=h.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Og("display",s))}catch(g){Ie(t,t.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(g){Ie(t,t.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Yt(e,t),un(t),r&4&&Jy(t);break;case 21:break;default:Yt(e,t),un(t)}}function un(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Ky(n)){var r=n;break e}n=n.return}throw Error(N(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Xi(i,""),r.flags&=-33);var o=Wy(t);sd(t,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=Wy(t);od(t,a,s);break;default:throw Error(N(161))}}catch(l){Ie(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Sx(t,e,n){V=t,Qy(t)}function Qy(t,e,n){for(var r=(t.mode&1)!==0;V!==null;){var i=V,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||Ta;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||nt;a=Ta;var c=nt;if(Ta=s,(nt=l)&&!c)for(V=i;V!==null;)s=V,l=s.child,s.tag===22&&s.memoizedState!==null?Zy(i):l!==null?(l.return=s,V=l):Zy(i);for(;o!==null;)V=o,Qy(o),o=o.sibling;V=i,Ta=a,nt=c}Yy(t)}else i.subtreeFlags&8772&&o!==null?(o.return=i,V=o):Yy(t)}}function Yy(t){for(;V!==null;){var e=V;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:nt||Ma(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!nt)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Gt(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=e.updateQueue;o!==null&&Xm(e,o,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}Xm(e,s,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&co(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(N(163))}nt||e.flags&512&&id(e)}catch(f){Ie(e,e.return,f)}}if(e===t){V=null;break}if(n=e.sibling,n!==null){n.return=e.return,V=n;break}V=e.return}}function Xy(t){for(;V!==null;){var e=V;if(e===t){V=null;break}var n=e.sibling;if(n!==null){n.return=e.return,V=n;break}V=e.return}}function Zy(t){for(;V!==null;){var e=V;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Ma(4,e)}catch(l){Ie(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Ie(e,i,l)}}var o=e.return;try{id(e)}catch(l){Ie(e,o,l)}break;case 5:var s=e.return;try{id(e)}catch(l){Ie(e,s,l)}}}catch(l){Ie(e,e.return,l)}if(e===t){V=null;break}var a=e.sibling;if(a!==null){a.return=e.return,V=a;break}V=e.return}}var kx=Math.ceil,Aa=kn.ReactCurrentDispatcher,ad=kn.ReactCurrentOwner,Ft=kn.ReactCurrentBatchConfig,ye=0,Ve=null,Fe=null,Ge=0,Tt=0,Mi=Zn(0),Be=0,Lo=null,Rr=0,Oa=0,ld=0,Io=null,gt=null,cd=0,Ai=1/0,On=null,Da=!1,ud=null,or=null,Pa=!1,sr=null,La=0,Ro=0,dd=null,Ia=-1,Ra=0;function ct(){return ye&6?Ne():Ia!==-1?Ia:Ia=Ne()}function ar(t){return t.mode&1?ye&2&&Ge!==0?Ge&-Ge:ox.transition!==null?(Ra===0&&(Ra=Wg()),Ra):(t=Se,t!==0||(t=window.event,t=t===void 0?16:tm(t.type)),t):1}function Xt(t,e,n,r){if(50<Ro)throw Ro=0,dd=null,Error(N(185));io(t,n,r),(!(ye&2)||t!==Ve)&&(t===Ve&&(!(ye&2)&&(Oa|=n),Be===4&&lr(t,Ge)),mt(t,r),n===1&&ye===0&&!(e.mode&1)&&(Ai=Ne()+500,ca&&tr()))}function mt(t,e){var n=t.callbackNode;ok(t,e);var r=Vs(t,t===Ve?Ge:0);if(r===0)n!==null&&Hg(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Hg(n),e===1)t.tag===0?ix(tv.bind(null,t)):Bm(tv.bind(null,t)),ex(function(){!(ye&6)&&tr()}),n=null;else{switch(qg(r)){case 1:n=Vc;break;case 4:n=Vg;break;case 16:n=Bs;break;case 536870912:n=Kg;break;default:n=Bs}n=cv(n,ev.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function ev(t,e){if(Ia=-1,Ra=0,ye&6)throw Error(N(327));var n=t.callbackNode;if(Oi()&&t.callbackNode!==n)return null;var r=Vs(t,t===Ve?Ge:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Na(t,r);else{e=r;var i=ye;ye|=2;var o=rv();(Ve!==t||Ge!==e)&&(On=null,Ai=Ne()+500,$r(t,e));do try{Cx();break}catch(a){nv(t,a)}while(!0);Au(),Aa.current=o,ye=i,Fe!==null?e=0:(Ve=null,Ge=0,e=Be)}if(e!==0){if(e===2&&(i=Kc(t),i!==0&&(r=i,e=hd(t,i))),e===1)throw n=Lo,$r(t,0),lr(t,r),mt(t,Ne()),n;if(e===6)lr(t,r);else{if(i=t.current.alternate,!(r&30)&&!xx(i)&&(e=Na(t,r),e===2&&(o=Kc(t),o!==0&&(r=o,e=hd(t,o))),e===1))throw n=Lo,$r(t,0),lr(t,r),mt(t,Ne()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(N(345));case 2:Fr(t,gt,On);break;case 3:if(lr(t,r),(r&130023424)===r&&(e=cd+500-Ne(),10<e)){if(Vs(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){ct(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=vu(Fr.bind(null,t,gt,On),e);break}Fr(t,gt,On);break;case 4:if(lr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var s=31-Wt(r);o=1<<s,s=e[s],s>i&&(i=s),r&=~o}if(r=i,r=Ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*kx(r/1960))-r,10<r){t.timeoutHandle=vu(Fr.bind(null,t,gt,On),r);break}Fr(t,gt,On);break;case 5:Fr(t,gt,On);break;default:throw Error(N(329))}}}return mt(t,Ne()),t.callbackNode===n?ev.bind(null,t):null}function hd(t,e){var n=Io;return t.current.memoizedState.isDehydrated&&($r(t,e).flags|=256),t=Na(t,e),t!==2&&(e=gt,gt=n,e!==null&&fd(e)),t}function fd(t){gt===null?gt=t:gt.push.apply(gt,t)}function xx(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!qt(o(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function lr(t,e){for(e&=~ld,e&=~Oa,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Wt(e),r=1<<n;t[n]=-1,e&=~r}}function tv(t){if(ye&6)throw Error(N(327));Oi();var e=Vs(t,0);if(!(e&1))return mt(t,Ne()),null;var n=Na(t,e);if(t.tag!==0&&n===2){var r=Kc(t);r!==0&&(e=r,n=hd(t,r))}if(n===1)throw n=Lo,$r(t,0),lr(t,e),mt(t,Ne()),n;if(n===6)throw Error(N(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Fr(t,gt,On),mt(t,Ne()),null}function pd(t,e){var n=ye;ye|=1;try{return t(e)}finally{ye=n,ye===0&&(Ai=Ne()+500,ca&&tr())}}function Nr(t){sr!==null&&sr.tag===0&&!(ye&6)&&Oi();var e=ye;ye|=1;var n=Ft.transition,r=Se;try{if(Ft.transition=null,Se=1,t)return t()}finally{Se=r,Ft.transition=n,ye=e,!(ye&6)&&tr()}}function gd(){Tt=Mi.current,Ae(Mi)}function $r(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Zk(n)),Fe!==null)for(n=Fe.return;n!==null;){var r=n;switch(_u(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&aa();break;case 3:Ci(),Ae(ht),Ae(Ze),$u();break;case 5:Ru(r);break;case 4:Ci();break;case 13:Ae(Pe);break;case 19:Ae(Pe);break;case 10:Ou(r.type._context);break;case 22:case 23:gd()}n=n.return}if(Ve=t,Fe=t=cr(t.current,null),Ge=Tt=e,Be=0,Lo=null,ld=Oa=Rr=0,gt=Io=null,Pr!==null){for(e=0;e<Pr.length;e++)if(n=Pr[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var s=o.next;o.next=i,r.next=s}n.pending=r}Pr=null}return t}function nv(t,e){do{var n=Fe;try{if(Au(),ba.current=xa,wa){for(var r=Le.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}wa=!1}if(Ir=0,He=je=Le=null,To=!1,Mo=0,ad.current=null,n===null||n.return===null){Be=1,Lo=e,Fe=null;break}e:{var o=t,s=n.return,a=n,l=e;if(e=Ge,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var v=Ty(s);if(v!==null){v.flags&=-257,My(v,s,a,o,e),v.mode&1&&Ey(o,c,e),e=v,l=c;var b=e.updateQueue;if(b===null){var g=new Set;g.add(l),e.updateQueue=g}else b.add(l);break e}else{if(!(e&1)){Ey(o,c,e),md();break e}l=Error(N(426))}}else if(Oe&&a.mode&1){var S=Ty(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),My(S,s,a,o,e),Tu(Ei(l,a));break e}}o=l=Ei(l,a),Be!==4&&(Be=2),Io===null?Io=[o]:Io.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var m=_y(o,l,e);Ym(o,m);break e;case 1:a=l;var w=o.type,k=o.stateNode;if(!(o.flags&128)&&(typeof w.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(or===null||!or.has(k)))){o.flags|=65536,e&=-e,o.lanes|=e;var C=Cy(o,a,e);Ym(o,C);break e}}o=o.return}while(o!==null)}ov(n)}catch(M){e=M,Fe===n&&n!==null&&(Fe=n=n.return);continue}break}while(!0)}function rv(){var t=Aa.current;return Aa.current=xa,t===null?xa:t}function md(){(Be===0||Be===3||Be===2)&&(Be=4),Ve===null||!(Rr&268435455)&&!(Oa&268435455)||lr(Ve,Ge)}function Na(t,e){var n=ye;ye|=2;var r=rv();(Ve!==t||Ge!==e)&&(On=null,$r(t,e));do try{_x();break}catch(i){nv(t,i)}while(!0);if(Au(),ye=n,Aa.current=r,Fe!==null)throw Error(N(261));return Ve=null,Ge=0,Be}function _x(){for(;Fe!==null;)iv(Fe)}function Cx(){for(;Fe!==null&&!QS();)iv(Fe)}function iv(t){var e=lv(t.alternate,t,Tt);t.memoizedProps=t.pendingProps,e===null?ov(t):Fe=e,ad.current=null}function ov(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=vx(n,e),n!==null){n.flags&=32767,Fe=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Be=6,Fe=null;return}}else if(n=yx(n,e,Tt),n!==null){Fe=n;return}if(e=e.sibling,e!==null){Fe=e;return}Fe=e=t}while(e!==null);Be===0&&(Be=5)}function Fr(t,e,n){var r=Se,i=Ft.transition;try{Ft.transition=null,Se=1,Ex(t,e,n,r)}finally{Ft.transition=i,Se=r}return null}function Ex(t,e,n,r){do Oi();while(sr!==null);if(ye&6)throw Error(N(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(N(177));t.callbackNode=null,t.callbackPriority=0;var o=n.lanes|n.childLanes;if(sk(t,o),t===Ve&&(Fe=Ve=null,Ge=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Pa||(Pa=!0,cv(Bs,function(){return Oi(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Ft.transition,Ft.transition=null;var s=Se;Se=1;var a=ye;ye|=4,ad.current=null,wx(t,n),Gy(n,t),Wk(mu),qs=!!gu,mu=gu=null,t.current=n,Sx(n),YS(),ye=a,Se=s,Ft.transition=o}else t.current=n;if(Pa&&(Pa=!1,sr=t,La=i),o=t.pendingLanes,o===0&&(or=null),ek(n.stateNode),mt(t,Ne()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Da)throw Da=!1,t=ud,ud=null,t;return La&1&&t.tag!==0&&Oi(),o=t.pendingLanes,o&1?t===dd?Ro++:(Ro=0,dd=t):Ro=0,tr(),null}function Oi(){if(sr!==null){var t=qg(La),e=Ft.transition,n=Se;try{if(Ft.transition=null,Se=16>t?16:t,sr===null)var r=!1;else{if(t=sr,sr=null,La=0,ye&6)throw Error(N(331));var i=ye;for(ye|=4,V=t.current;V!==null;){var o=V,s=o.child;if(V.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(V=c;V!==null;){var d=V;switch(d.tag){case 0:case 11:case 15:Po(8,d,o)}var h=d.child;if(h!==null)h.return=d,V=h;else for(;V!==null;){d=V;var f=d.sibling,v=d.return;if(Vy(d),d===c){V=null;break}if(f!==null){f.return=v,V=f;break}V=v}}}var b=o.alternate;if(b!==null){var g=b.child;if(g!==null){b.child=null;do{var S=g.sibling;g.sibling=null,g=S}while(g!==null)}}V=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,V=s;else e:for(;V!==null;){if(o=V,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Po(9,o,o.return)}var m=o.sibling;if(m!==null){m.return=o.return,V=m;break e}V=o.return}}var w=t.current;for(V=w;V!==null;){s=V;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,V=k;else e:for(s=w;V!==null;){if(a=V,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ma(9,a)}}catch(M){Ie(a,a.return,M)}if(a===s){V=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,V=C;break e}V=a.return}}if(ye=i,tr(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(Us,t)}catch{}r=!0}return r}finally{Se=n,Ft.transition=e}}return!1}function sv(t,e,n){e=Ei(n,e),e=_y(t,e,1),t=rr(t,e,1),e=ct(),t!==null&&(io(t,1,e),mt(t,e))}function Ie(t,e,n){if(t.tag===3)sv(t,t,n);else for(;e!==null;){if(e.tag===3){sv(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(or===null||!or.has(r))){t=Ei(n,t),t=Cy(e,t,1),e=rr(e,t,1),t=ct(),e!==null&&(io(e,1,t),mt(e,t));break}}e=e.return}}function Tx(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=ct(),t.pingedLanes|=t.suspendedLanes&n,Ve===t&&(Ge&n)===n&&(Be===4||Be===3&&(Ge&130023424)===Ge&&500>Ne()-cd?$r(t,0):ld|=n),mt(t,e)}function av(t,e){e===0&&(t.mode&1?(e=Hs,Hs<<=1,!(Hs&130023424)&&(Hs=4194304)):e=1);var n=ct();t=Tn(t,e),t!==null&&(io(t,e,n),mt(t,n))}function Mx(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),av(t,n)}function Ax(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(e),av(t,n)}var lv;lv=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ht.current)pt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return pt=!1,mx(t,e,n);pt=!!(t.flags&131072)}else pt=!1,Oe&&e.flags&1048576&&Um(e,da,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Ea(t,e),t=e.pendingProps;var i=vi(e,Ze.current);_i(e,n),i=Bu(null,e,r,t,i,n);var o=Uu();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ft(r)?(o=!0,la(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Lu(e),i.updater=_a,e.stateNode=i,i._reactInternals=e,qu(e,r,t,n),e=Yu(null,e,r,!0,o,n)):(e.tag=0,Oe&&o&&xu(e),lt(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Ea(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Dx(r),t=Gt(r,t),i){case 0:e=Qu(null,e,r,t,n);break e;case 1:e=Iy(null,e,r,t,n);break e;case 11:e=Ay(null,e,r,t,n);break e;case 14:e=Oy(null,e,r,Gt(r.type,t),n);break e}throw Error(N(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gt(r,i),Qu(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gt(r,i),Iy(t,e,r,i,n);case 3:e:{if(Ry(e),t===null)throw Error(N(387));r=e.pendingProps,o=e.memoizedState,i=o.element,Qm(t,e),ya(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Ei(Error(N(423)),e),e=Ny(t,e,r,n,i);break e}else if(r!==i){i=Ei(Error(N(424)),e),e=Ny(t,e,r,n,i);break e}else for(Et=Xn(e.stateNode.containerInfo.firstChild),Ct=e,Oe=!0,Jt=null,n=Jm(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Si(),r===i){e=An(t,e,n);break e}lt(t,e,r,n)}e=e.child}return e;case 5:return Zm(e),t===null&&Eu(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,yu(r,i)?s=null:o!==null&&yu(r,o)&&(e.flags|=32),Ly(t,e),lt(t,e,s,n),e.child;case 6:return t===null&&Eu(e),null;case 13:return $y(t,e,n);case 4:return Iu(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ki(e,null,r,n):lt(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gt(r,i),Ay(t,e,r,i,n);case 7:return lt(t,e,e.pendingProps,n),e.child;case 8:return lt(t,e,e.pendingProps.children,n),e.child;case 12:return lt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Te(pa,r._currentValue),r._currentValue=s,o!==null)if(qt(o.value,s)){if(o.children===i.children&&!ht.current){e=An(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Mn(-1,n&-n),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Du(o.return,n,e),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(N(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Du(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}lt(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,_i(e,n),i=Nt(i),r=r(i),e.flags|=1,lt(t,e,r,n),e.child;case 14:return r=e.type,i=Gt(r,e.pendingProps),i=Gt(r.type,i),Oy(t,e,r,i,n);case 15:return Dy(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Gt(r,i),Ea(t,e),e.tag=1,ft(r)?(t=!0,la(e)):t=!1,_i(e,n),ky(e,r,i),qu(e,r,i,n),Yu(null,e,r,!0,t,n);case 19:return jy(t,e,n);case 22:return Py(t,e,n)}throw Error(N(156,e.tag))};function cv(t,e){return zg(t,e)}function Ox(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jt(t,e,n,r){return new Ox(t,e,n,r)}function yd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Dx(t){if(typeof t=="function")return yd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===xc)return 11;if(t===Ec)return 14}return 2}function cr(t,e){var n=t.alternate;return n===null?(n=jt(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function $a(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")yd(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case oi:return jr(n.children,i,o,e);case Sc:s=8,i|=8;break;case kc:return t=jt(12,n,e,i|2),t.elementType=kc,t.lanes=o,t;case _c:return t=jt(13,n,e,i),t.elementType=_c,t.lanes=o,t;case Cc:return t=jt(19,n,e,i),t.elementType=Cc,t.lanes=o,t;case vg:return Fa(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case mg:s=10;break e;case yg:s=9;break e;case xc:s=11;break e;case Ec:s=14;break e;case Vn:s=16,r=null;break e}throw Error(N(130,t==null?t:typeof t,""))}return e=jt(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function jr(t,e,n,r){return t=jt(7,t,r,e),t.lanes=n,t}function Fa(t,e,n,r){return t=jt(22,t,r,e),t.elementType=vg,t.lanes=n,t.stateNode={isHidden:!1},t}function vd(t,e,n){return t=jt(6,t,null,e),t.lanes=n,t}function bd(t,e,n){return e=jt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Px(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wc(0),this.expirationTimes=Wc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wc(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function wd(t,e,n,r,i,o,s,a,l){return t=new Px(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=jt(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lu(o),t}function Lx(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ii,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function uv(t){if(!t)return er;t=t._reactInternals;e:{if(Tr(t)!==t||t.tag!==1)throw Error(N(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(ft(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(N(171))}if(t.tag===1){var n=t.type;if(ft(n))return Fm(t,n,e)}return e}function dv(t,e,n,r,i,o,s,a,l){return t=wd(n,r,!0,t,i,o,s,a,l),t.context=uv(null),n=t.current,r=ct(),i=ar(n),o=Mn(r,i),o.callback=e??null,rr(n,o,i),t.current.lanes=i,io(t,i,r),mt(t,r),t}function ja(t,e,n,r){var i=e.current,o=ct(),s=ar(i);return n=uv(n),e.context===null?e.context=n:e.pendingContext=n,e=Mn(o,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=rr(i,e,s),t!==null&&(Xt(t,i,s,o),ma(t,i,s)),s}function Ba(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function hv(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Sd(t,e){hv(t,e),(t=t.alternate)&&hv(t,e)}function Ix(){return null}var fv=typeof reportError=="function"?reportError:function(t){console.error(t)};function kd(t){this._internalRoot=t}Ua.prototype.render=kd.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(N(409));ja(t,e,null,null)},Ua.prototype.unmount=kd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Nr(function(){ja(null,t,null,null)}),e[xn]=null}};function Ua(t){this._internalRoot=t}Ua.prototype.unstable_scheduleHydration=function(t){if(t){var e=Qg();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Gn.length&&e!==0&&e<Gn[n].priority;n++);Gn.splice(n,0,t),n===0&&Zg(t)}};function xd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function za(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function pv(){}function Rx(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=Ba(s);o.call(c)}}var s=dv(e,r,t,0,null,!1,!1,"",pv);return t._reactRootContainer=s,t[xn]=s.current,bo(t.nodeType===8?t.parentNode:t),Nr(),s}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=Ba(l);a.call(c)}}var l=wd(t,0,!1,null,null,!1,!1,"",pv);return t._reactRootContainer=l,t[xn]=l.current,bo(t.nodeType===8?t.parentNode:t),Nr(function(){ja(e,l,n,r)}),l}function Ha(t,e,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if(typeof i=="function"){var a=i;i=function(){var l=Ba(s);a.call(l)}}ja(e,s,t,i)}else s=Rx(n,e,t,i,r);return Ba(s)}Jg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=ro(e.pendingLanes);n!==0&&(qc(e,n|1),mt(e,Ne()),!(ye&6)&&(Ai=Ne()+500,tr()))}break;case 13:Nr(function(){var r=Tn(t,1);if(r!==null){var i=ct();Xt(r,t,1,i)}}),Sd(t,1)}},Jc=function(t){if(t.tag===13){var e=Tn(t,134217728);if(e!==null){var n=ct();Xt(e,t,134217728,n)}Sd(t,134217728)}},Gg=function(t){if(t.tag===13){var e=ar(t),n=Tn(t,e);if(n!==null){var r=ct();Xt(n,t,e,r)}Sd(t,e)}},Qg=function(){return Se},Yg=function(t,e){var n=Se;try{return Se=t,e()}finally{Se=n}},Bc=function(t,e,n){switch(e){case"input":if(Pc(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=sa(r);if(!i)throw Error(N(90));Sg(r),Pc(r,i)}}}break;case"textarea":Eg(t,n);break;case"select":e=n.value,e!=null&&si(t,!!n.multiple,e,!1)}},Rg=pd,Ng=Nr;var Nx={usingClientEntryPoint:!1,Events:[ko,mi,sa,Lg,Ig,pd]},No={findFiberByHostInstance:Mr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$x={bundleType:No.bundleType,version:No.version,rendererPackageName:No.rendererPackageName,rendererConfig:No.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:kn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Bg(t),t===null?null:t.stateNode},findFiberByHostInstance:No.findFiberByHostInstance||Ix,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Va=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Va.isDisabled&&Va.supportsFiber)try{Us=Va.inject($x),sn=Va}catch{}}kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Nx,kt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!xd(e))throw Error(N(200));return Lx(t,e,null,n)},kt.createRoot=function(t,e){if(!xd(t))throw Error(N(299));var n=!1,r="",i=fv;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=wd(t,1,!1,null,null,n,!1,r,i),t[xn]=e.current,bo(t.nodeType===8?t.parentNode:t),new kd(e)},kt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(N(188)):(t=Object.keys(t).join(","),Error(N(268,t)));return t=Bg(e),t=t===null?null:t.stateNode,t},kt.flushSync=function(t){return Nr(t)},kt.hydrate=function(t,e,n){if(!za(e))throw Error(N(200));return Ha(null,t,e,!0,n)},kt.hydrateRoot=function(t,e,n){if(!xd(t))throw Error(N(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=fv;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=dv(e,null,t,1,n??null,i,!1,o,s),t[xn]=e.current,bo(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new Ua(e)},kt.render=function(t,e,n){if(!za(e))throw Error(N(200));return Ha(null,t,e,!1,n)},kt.unmountComponentAtNode=function(t){if(!za(t))throw Error(N(40));return t._reactRootContainer?(Nr(function(){Ha(null,null,t,!1,function(){t._reactRootContainer=null,t[xn]=null})}),!0):!1},kt.unstable_batchedUpdates=pd,kt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!za(n))throw Error(N(200));if(t==null||t._reactInternals===void 0)throw Error(N(38));return Ha(t,e,n,!1,r)},kt.version="18.3.1-next-f1338f8080-20240426";function gv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gv)}catch(t){console.error(t)}}gv(),ug.exports=kt;var Fx=ug.exports,mv=Fx;mc.createRoot=mv.createRoot,mc.hydrateRoot=mv.hydrateRoot;var yv={exports:{}},Ka={};/**
374
+ `+o.stack}return{value:t,source:e,stack:i,digest:null}}function Ju(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Gu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var fx=typeof WeakMap=="function"?WeakMap:Map;function Cy(t,e,n){n=An(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Da||(Da=!0,ud=r),Gu(t,e)},n}function Ey(t,e,n){n=An(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Gu(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Gu(t,e),typeof r!="function"&&(or===null?or=new Set([this]):or.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function Ty(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new fx;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=Tx.bind(null,t,e,n),e.then(t,t))}function My(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Ay(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=An(-1,1),e.tag=2,rr(n,e,1))),n.lanes|=1),t)}var px=xn.ReactCurrentOwner,gt=!1;function ct(t,e,n,r){e.child=t===null?Gm(e,null,n,r):ki(e,t.child,n,r)}function Oy(t,e,n,r,i){n=n.render;var o=e.ref;return _i(e,i),r=Bu(t,e,n,r,o,i),n=Uu(),t!==null&&!gt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,On(t,e,i)):(Oe&&n&&xu(e),e.flags|=1,ct(t,e,r,i),e.child)}function Dy(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!yd(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,Ly(t,e,o,r,i)):(t=$a(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:mo,n(s,r)&&t.ref===e.ref)return On(t,e,i)}return e.flags|=1,t=cr(o,r),t.ref=e.ref,t.return=e,e.child=t}function Ly(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(mo(o,r)&&t.ref===e.ref)if(gt=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(gt=!0);else return e.lanes=t.lanes,On(t,e,i)}return Qu(t,e,n,r,i)}function Py(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Te(Mi,Tt),Tt|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Te(Mi,Tt),Tt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,Te(Mi,Tt),Tt|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,Te(Mi,Tt),Tt|=r;return ct(t,e,i,n),e.child}function Iy(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Qu(t,e,n,r,i){var o=pt(n)?Ar:et.current;return o=vi(e,o),_i(e,i),n=Bu(t,e,n,r,o,i),r=Uu(),t!==null&&!gt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,On(t,e,i)):(Oe&&r&&xu(e),e.flags|=1,ct(t,e,n,i),e.child)}function Ry(t,e,n,r,i){if(pt(n)){var o=!0;la(e)}else o=!1;if(_i(e,i),e.stateNode===null)Ea(t,e),xy(e,n,r),qu(e,n,r,i),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Nt(c):(c=pt(n)?Ar:et.current,c=vi(e,c));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";h||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&_y(e,s,r,c),nr=!1;var f=e.memoizedState;s.state=f,ya(e,r,s,i),l=e.memoizedState,a!==r||f!==l||ft.current||nr?(typeof d=="function"&&(Wu(e,n,d,r),l=e.memoizedState),(a=nr||ky(e,n,a,r,f,l,c))?(h||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,Ym(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Qt(e.type,a),s.props=c,h=e.pendingProps,f=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Nt(l):(l=pt(n)?Ar:et.current,l=vi(e,l));var g=n.getDerivedStateFromProps;(d=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==h||f!==l)&&_y(e,s,r,l),nr=!1,f=e.memoizedState,s.state=f,ya(e,r,s,i);var y=e.memoizedState;a!==h||f!==y||ft.current||nr?(typeof g=="function"&&(Wu(e,n,g,r),y=e.memoizedState),(c=nr||ky(e,n,c,r,f,y,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,y,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,y,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=y),s.props=r,s.state=y,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return Yu(t,e,n,r,o,i)}function Yu(t,e,n,r,i,o){Iy(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&Bm(e,n,!1),On(t,e,o);r=e.stateNode,px.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=ki(e,t.child,null,o),e.child=ki(e,null,a,o)):ct(t,e,a,o),e.memoizedState=r.state,i&&Bm(e,n,!0),e.child}function Ny(t){var e=t.stateNode;e.pendingContext?Fm(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Fm(t,e.context,!1),Iu(t,e.containerInfo)}function $y(t,e,n,r,i){return Si(),Tu(i),e.flags|=256,ct(t,e,n,r),e.child}var Xu={dehydrated:null,treeContext:null,retryLane:0};function Zu(t){return{baseLanes:t,cachePool:null,transitions:null}}function Fy(t,e,n){var r=e.pendingProps,i=Le.current,o=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Te(Le,i&1),t===null)return Eu(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,o?(r=e.mode,o=e.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=Fa(s,r,0,null),t=jr(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Zu(n),e.memoizedState=Xu,t):ed(e,s));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return gx(t,e,s,r,a,i,n);if(o){o=r.fallback,s=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=cr(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?o=cr(a,o):(o=jr(o,s,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,r=o,o=e.child,s=t.child.memoizedState,s=s===null?Zu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=Xu,r}return o=t.child,t=o.sibling,r=cr(o,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function ed(t,e){return e=Fa({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Ca(t,e,n,r){return r!==null&&Tu(r),ki(e,t.child,null,n),t=ed(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function gx(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=Ju(Error($(422))),Ca(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Fa({mode:"visible",children:r.children},i,0,null),o=jr(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&ki(e,t.child,null,s),e.child.memoizedState=Zu(s),e.memoizedState=Xu,o);if(!(e.mode&1))return Ca(t,e,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error($(419)),r=Ju(o,r,void 0),Ca(t,e,s,r)}if(a=(s&t.childLanes)!==0,gt||a){if(r=Ve,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,Mn(t,i),Zt(r,t,i,-1))}return md(),r=Ju(Error($(421))),Ca(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=Mx.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,Et=Xn(i.nextSibling),Ct=e,Oe=!0,Gt=null,t!==null&&(It[Rt++]=En,It[Rt++]=Tn,It[Rt++]=Or,En=t.id,Tn=t.overflow,Or=e),e=ed(e,r.children),e.flags|=4096,e)}function jy(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Du(t.return,e,n)}function td(t,e,n,r,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function By(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(ct(t,e,r.children,n),r=Le.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&jy(t,n,e);else if(t.tag===19)jy(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Te(Le,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&va(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),td(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&va(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}td(e,!0,n,null,o);break;case"together":td(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ea(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function On(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Rr|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error($(153));if(e.child!==null){for(t=e.child,n=cr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=cr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function mx(t,e,n){switch(e.tag){case 3:Ny(e),Si();break;case 5:ey(e);break;case 1:pt(e.type)&&la(e);break;case 4:Iu(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Te(pa,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Te(Le,Le.current&1),e.flags|=128,null):n&e.child.childLanes?Fy(t,e,n):(Te(Le,Le.current&1),t=On(t,e,n),t!==null?t.sibling:null);Te(Le,Le.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return By(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Te(Le,Le.current),r)break;return null;case 22:case 23:return e.lanes=0,Py(t,e,n)}return On(t,e,n)}var Uy,nd,zy,Hy;Uy=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},nd=function(){},zy=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Pr(cn.current);var o=null;switch(n){case"input":i=Dc(t,i),r=Dc(t,r),o=[];break;case"select":i=De({},i,{value:void 0}),r=De({},r,{value:void 0}),o=[];break;case"textarea":i=Ic(t,i),r=Ic(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=oa)}Nc(n,r);var s;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ji.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(o||(o=[]),o.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ji.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Me("scroll",t),o||a===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(e.updateQueue=c)&&(e.flags|=4)}},Hy=function(t,e,n,r){n!==r&&(e.flags|=4)};function Do(t,e){if(!Oe)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function nt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function yx(t,e,n){var r=e.pendingProps;switch(_u(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(e),null;case 1:return pt(e.type)&&aa(),nt(e),null;case 3:return r=e.stateNode,Ci(),Ae(ft),Ae(et),$u(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(ha(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Gt!==null&&(fd(Gt),Gt=null))),nd(t,e),nt(e),null;case 5:Ru(e);var i=Pr(Eo.current);if(n=e.type,t!==null&&e.stateNode!=null)zy(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error($(166));return nt(e),null}if(t=Pr(cn.current),ha(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[ln]=e,r[So]=o,t=(e.mode&1)!==0,n){case"dialog":Me("cancel",r),Me("close",r);break;case"iframe":case"object":case"embed":Me("load",r);break;case"video":case"audio":for(i=0;i<vo.length;i++)Me(vo[i],r);break;case"source":Me("error",r);break;case"img":case"image":case"link":Me("error",r),Me("load",r);break;case"details":Me("toggle",r);break;case"input":xg(r,o),Me("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Me("invalid",r);break;case"textarea":Eg(r,o),Me("invalid",r)}Nc(n,o),i=null;for(var s in o)if(o.hasOwnProperty(s)){var a=o[s];s==="children"?typeof a=="string"?r.textContent!==a&&(o.suppressHydrationWarning!==!0&&ia(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&ia(r.textContent,a,t),i=["children",""+a]):Ji.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Me("scroll",r)}switch(n){case"input":Rs(r),Cg(r,o,!0);break;case"textarea":Rs(r),Mg(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=oa)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ag(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[ln]=e,t[So]=r,Uy(t,e,!1,!1),e.stateNode=t;e:{switch(s=$c(n,r),n){case"dialog":Me("cancel",t),Me("close",t),i=r;break;case"iframe":case"object":case"embed":Me("load",t),i=r;break;case"video":case"audio":for(i=0;i<vo.length;i++)Me(vo[i],t);i=r;break;case"source":Me("error",t),i=r;break;case"img":case"image":case"link":Me("error",t),Me("load",t),i=r;break;case"details":Me("toggle",t),i=r;break;case"input":xg(t,r),i=Dc(t,r),Me("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=De({},r,{value:void 0}),Me("invalid",t);break;case"textarea":Eg(t,r),i=Ic(t,r),Me("invalid",t);break;default:i=r}Nc(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?Lg(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Og(t,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Xi(t,l):typeof l=="number"&&Xi(t,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Ji.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Me("scroll",t):l!=null&&wc(t,o,l,s))}switch(n){case"input":Rs(t),Cg(t,r,!1);break;case"textarea":Rs(t),Mg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Kn(r.value));break;case"select":t.multiple=!!r.multiple,o=r.value,o!=null?si(t,!!r.multiple,o,!1):r.defaultValue!=null&&si(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=oa)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return nt(e),null;case 6:if(t&&e.stateNode!=null)Hy(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error($(166));if(n=Pr(Eo.current),Pr(cn.current),ha(e)){if(r=e.stateNode,n=e.memoizedProps,r[ln]=e,(o=r.nodeValue!==n)&&(t=Ct,t!==null))switch(t.tag){case 3:ia(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ia(r.nodeValue,n,(t.mode&1)!==0)}o&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ln]=e,e.stateNode=r}return nt(e),null;case 13:if(Ae(Le),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Oe&&Et!==null&&e.mode&1&&!(e.flags&128))Wm(),Si(),e.flags|=98560,o=!1;else if(o=ha(e),r!==null&&r.dehydrated!==null){if(t===null){if(!o)throw Error($(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error($(317));o[ln]=e}else Si(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;nt(e),o=!1}else Gt!==null&&(fd(Gt),Gt=null),o=!0;if(!o)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Le.current&1?Be===0&&(Be=3):md())),e.updateQueue!==null&&(e.flags|=4),nt(e),null);case 4:return Ci(),nd(t,e),t===null&&bo(e.stateNode.containerInfo),nt(e),null;case 10:return Ou(e.type._context),nt(e),null;case 17:return pt(e.type)&&aa(),nt(e),null;case 19:if(Ae(Le),o=e.memoizedState,o===null)return nt(e),null;if(r=(e.flags&128)!==0,s=o.rendering,s===null)if(r)Do(o,!1);else{if(Be!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=va(t),s!==null){for(e.flags|=128,Do(o,!1),r=s.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)o=n,t=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=t,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,t=s.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Te(Le,Le.current&1|2),e.child}t=t.sibling}o.tail!==null&&Ne()>Ai&&(e.flags|=128,r=!0,Do(o,!1),e.lanes=4194304)}else{if(!r)if(t=va(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Do(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Oe)return nt(e),null}else 2*Ne()-o.renderingStartTime>Ai&&n!==1073741824&&(e.flags|=128,r=!0,Do(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Ne(),e.sibling=null,n=Le.current,Te(Le,r?n&1|2:n&1),e):(nt(e),null);case 22:case 23:return gd(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Tt&1073741824&&(nt(e),e.subtreeFlags&6&&(e.flags|=8192)):nt(e),null;case 24:return null;case 25:return null}throw Error($(156,e.tag))}function vx(t,e){switch(_u(e),e.tag){case 1:return pt(e.type)&&aa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ci(),Ae(ft),Ae(et),$u(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Ru(e),null;case 13:if(Ae(Le),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error($(340));Si()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ae(Le),null;case 4:return Ci(),null;case 10:return Ou(e.type._context),null;case 22:case 23:return gd(),null;case 24:return null;default:return null}}var Ta=!1,rt=!1,bx=typeof WeakSet=="function"?WeakSet:Set,J=null;function Ti(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ie(t,e,r)}else n.current=null}function rd(t,e,n){try{n()}catch(r){Ie(t,e,r)}}var Vy=!1;function wx(t,e){if(gu=qs,t=km(),au(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,d=0,h=t,f=null;t:for(;;){for(var g;h!==n||i!==0&&h.nodeType!==3||(a=s+i),h!==o||r!==0&&h.nodeType!==3||(l=s+r),h.nodeType===3&&(s+=h.nodeValue.length),(g=h.firstChild)!==null;)f=h,h=g;for(;;){if(h===t)break t;if(f===n&&++c===i&&(a=s),f===o&&++d===r&&(l=s),(g=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(mu={focusedElem:t,selectionRange:n},qs=!1,J=e;J!==null;)if(e=J,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,J=t;else for(;J!==null;){e=J;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var m=y.memoizedProps,S=y.memoizedState,v=e.stateNode,w=v.getSnapshotBeforeUpdate(e.elementType===e.type?m:Qt(e.type,m),S);v.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($(163))}}catch(C){Ie(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,J=t;break}J=e.return}return y=Vy,Vy=!1,y}function Lo(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&rd(e,n,o)}i=i.next}while(i!==r)}}function Ma(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function id(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Ky(t){var e=t.alternate;e!==null&&(t.alternate=null,Ky(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ln],delete e[So],delete e[wu],delete e[nx],delete e[rx])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Wy(t){return t.tag===5||t.tag===3||t.tag===4}function qy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Wy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function od(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=oa));else if(r!==4&&(t=t.child,t!==null))for(od(t,e,n),t=t.sibling;t!==null;)od(t,e,n),t=t.sibling}function sd(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(sd(t,e,n),t=t.sibling;t!==null;)sd(t,e,n),t=t.sibling}var Je=null,Yt=!1;function ir(t,e,n){for(n=n.child;n!==null;)Jy(t,e,n),n=n.sibling}function Jy(t,e,n){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(Us,n)}catch{}switch(n.tag){case 5:rt||Ti(n,e);case 6:var r=Je,i=Yt;Je=null,ir(t,e,n),Je=r,Yt=i,Je!==null&&(Yt?(t=Je,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Je.removeChild(n.stateNode));break;case 18:Je!==null&&(Yt?(t=Je,n=n.stateNode,t.nodeType===8?bu(t.parentNode,n):t.nodeType===1&&bu(t,n),co(t)):bu(Je,n.stateNode));break;case 4:r=Je,i=Yt,Je=n.stateNode.containerInfo,Yt=!0,ir(t,e,n),Je=r,Yt=i;break;case 0:case 11:case 14:case 15:if(!rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&rd(n,e,s),i=i.next}while(i!==r)}ir(t,e,n);break;case 1:if(!rt&&(Ti(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ie(n,e,a)}ir(t,e,n);break;case 21:ir(t,e,n);break;case 22:n.mode&1?(rt=(r=rt)||n.memoizedState!==null,ir(t,e,n),rt=r):ir(t,e,n);break;default:ir(t,e,n)}}function Gy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new bx),e.forEach(function(r){var i=Ax.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Xt(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=t,s=e,a=s;e:for(;a!==null;){switch(a.tag){case 5:Je=a.stateNode,Yt=!1;break e;case 3:Je=a.stateNode.containerInfo,Yt=!0;break e;case 4:Je=a.stateNode.containerInfo,Yt=!0;break e}a=a.return}if(Je===null)throw Error($(160));Jy(o,s,i),Je=null,Yt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Ie(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Qy(e,t),e=e.sibling}function Qy(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Xt(e,t),dn(t),r&4){try{Lo(3,t,t.return),Ma(3,t)}catch(m){Ie(t,t.return,m)}try{Lo(5,t,t.return)}catch(m){Ie(t,t.return,m)}}break;case 1:Xt(e,t),dn(t),r&512&&n!==null&&Ti(n,n.return);break;case 5:if(Xt(e,t),dn(t),r&512&&n!==null&&Ti(n,n.return),t.flags&32){var i=t.stateNode;try{Xi(i,"")}catch(m){Ie(t,t.return,m)}}if(r&4&&(i=t.stateNode,i!=null)){var o=t.memoizedProps,s=n!==null?n.memoizedProps:o,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&_g(i,o),$c(a,s);var c=$c(a,o);for(s=0;s<l.length;s+=2){var d=l[s],h=l[s+1];d==="style"?Lg(i,h):d==="dangerouslySetInnerHTML"?Og(i,h):d==="children"?Xi(i,h):wc(i,d,h,c)}switch(a){case"input":Lc(i,o);break;case"textarea":Tg(i,o);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var g=o.value;g!=null?si(i,!!o.multiple,g,!1):f!==!!o.multiple&&(o.defaultValue!=null?si(i,!!o.multiple,o.defaultValue,!0):si(i,!!o.multiple,o.multiple?[]:"",!1))}i[So]=o}catch(m){Ie(t,t.return,m)}}break;case 6:if(Xt(e,t),dn(t),r&4){if(t.stateNode===null)throw Error($(162));i=t.stateNode,o=t.memoizedProps;try{i.nodeValue=o}catch(m){Ie(t,t.return,m)}}break;case 3:if(Xt(e,t),dn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{co(e.containerInfo)}catch(m){Ie(t,t.return,m)}break;case 4:Xt(e,t),dn(t);break;case 13:Xt(e,t),dn(t),i=t.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(cd=Ne())),r&4&&Gy(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(rt=(c=rt)||d,Xt(e,t),rt=c):Xt(e,t),dn(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(J=t,d=t.child;d!==null;){for(h=J=d;J!==null;){switch(f=J,g=f.child,f.tag){case 0:case 11:case 14:case 15:Lo(4,f,f.return);break;case 1:Ti(f,f.return);var y=f.stateNode;if(typeof y.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(m){Ie(r,n,m)}}break;case 5:Ti(f,f.return);break;case 22:if(f.memoizedState!==null){Zy(h);continue}}g!==null?(g.return=f,J=g):Zy(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{i=h.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=h.stateNode,l=h.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Dg("display",s))}catch(m){Ie(t,t.return,m)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(m){Ie(t,t.return,m)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Xt(e,t),dn(t),r&4&&Gy(t);break;case 21:break;default:Xt(e,t),dn(t)}}function dn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Wy(n)){var r=n;break e}n=n.return}throw Error($(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Xi(i,""),r.flags&=-33);var o=qy(t);sd(t,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=qy(t);od(t,a,s);break;default:throw Error($(161))}}catch(l){Ie(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Sx(t,e,n){J=t,Yy(t)}function Yy(t,e,n){for(var r=(t.mode&1)!==0;J!==null;){var i=J,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||Ta;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||rt;a=Ta;var c=rt;if(Ta=s,(rt=l)&&!c)for(J=i;J!==null;)s=J,l=s.child,s.tag===22&&s.memoizedState!==null?ev(i):l!==null?(l.return=s,J=l):ev(i);for(;o!==null;)J=o,Yy(o),o=o.sibling;J=i,Ta=a,rt=c}Xy(t)}else i.subtreeFlags&8772&&o!==null?(o.return=i,J=o):Xy(t)}}function Xy(t){for(;J!==null;){var e=J;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:rt||Ma(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!rt)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Qt(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=e.updateQueue;o!==null&&Zm(e,o,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}Zm(e,s,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&co(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error($(163))}rt||e.flags&512&&id(e)}catch(f){Ie(e,e.return,f)}}if(e===t){J=null;break}if(n=e.sibling,n!==null){n.return=e.return,J=n;break}J=e.return}}function Zy(t){for(;J!==null;){var e=J;if(e===t){J=null;break}var n=e.sibling;if(n!==null){n.return=e.return,J=n;break}J=e.return}}function ev(t){for(;J!==null;){var e=J;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Ma(4,e)}catch(l){Ie(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Ie(e,i,l)}}var o=e.return;try{id(e)}catch(l){Ie(e,o,l)}break;case 5:var s=e.return;try{id(e)}catch(l){Ie(e,s,l)}}}catch(l){Ie(e,e.return,l)}if(e===t){J=null;break}var a=e.sibling;if(a!==null){a.return=e.return,J=a;break}J=e.return}}var kx=Math.ceil,Aa=xn.ReactCurrentDispatcher,ad=xn.ReactCurrentOwner,Ft=xn.ReactCurrentBatchConfig,ye=0,Ve=null,Fe=null,Ge=0,Tt=0,Mi=Zn(0),Be=0,Po=null,Rr=0,Oa=0,ld=0,Io=null,mt=null,cd=0,Ai=1/0,Dn=null,Da=!1,ud=null,or=null,La=!1,sr=null,Pa=0,Ro=0,dd=null,Ia=-1,Ra=0;function ut(){return ye&6?Ne():Ia!==-1?Ia:Ia=Ne()}function ar(t){return t.mode&1?ye&2&&Ge!==0?Ge&-Ge:ox.transition!==null?(Ra===0&&(Ra=qg()),Ra):(t=Se,t!==0||(t=window.event,t=t===void 0?16:nm(t.type)),t):1}function Zt(t,e,n,r){if(50<Ro)throw Ro=0,dd=null,Error($(185));io(t,n,r),(!(ye&2)||t!==Ve)&&(t===Ve&&(!(ye&2)&&(Oa|=n),Be===4&&lr(t,Ge)),yt(t,r),n===1&&ye===0&&!(e.mode&1)&&(Ai=Ne()+500,ca&&tr()))}function yt(t,e){var n=t.callbackNode;ok(t,e);var r=Vs(t,t===Ve?Ge:0);if(r===0)n!==null&&Vg(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Vg(n),e===1)t.tag===0?ix(nv.bind(null,t)):Um(nv.bind(null,t)),ex(function(){!(ye&6)&&tr()}),n=null;else{switch(Jg(r)){case 1:n=Vc;break;case 4:n=Kg;break;case 16:n=Bs;break;case 536870912:n=Wg;break;default:n=Bs}n=uv(n,tv.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function tv(t,e){if(Ia=-1,Ra=0,ye&6)throw Error($(327));var n=t.callbackNode;if(Oi()&&t.callbackNode!==n)return null;var r=Vs(t,t===Ve?Ge:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Na(t,r);else{e=r;var i=ye;ye|=2;var o=iv();(Ve!==t||Ge!==e)&&(Dn=null,Ai=Ne()+500,$r(t,e));do try{Cx();break}catch(a){rv(t,a)}while(!0);Au(),Aa.current=o,ye=i,Fe!==null?e=0:(Ve=null,Ge=0,e=Be)}if(e!==0){if(e===2&&(i=Kc(t),i!==0&&(r=i,e=hd(t,i))),e===1)throw n=Po,$r(t,0),lr(t,r),yt(t,Ne()),n;if(e===6)lr(t,r);else{if(i=t.current.alternate,!(r&30)&&!xx(i)&&(e=Na(t,r),e===2&&(o=Kc(t),o!==0&&(r=o,e=hd(t,o))),e===1))throw n=Po,$r(t,0),lr(t,r),yt(t,Ne()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error($(345));case 2:Fr(t,mt,Dn);break;case 3:if(lr(t,r),(r&130023424)===r&&(e=cd+500-Ne(),10<e)){if(Vs(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){ut(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=vu(Fr.bind(null,t,mt,Dn),e);break}Fr(t,mt,Dn);break;case 4:if(lr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var s=31-qt(r);o=1<<s,s=e[s],s>i&&(i=s),r&=~o}if(r=i,r=Ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*kx(r/1960))-r,10<r){t.timeoutHandle=vu(Fr.bind(null,t,mt,Dn),r);break}Fr(t,mt,Dn);break;case 5:Fr(t,mt,Dn);break;default:throw Error($(329))}}}return yt(t,Ne()),t.callbackNode===n?tv.bind(null,t):null}function hd(t,e){var n=Io;return t.current.memoizedState.isDehydrated&&($r(t,e).flags|=256),t=Na(t,e),t!==2&&(e=mt,mt=n,e!==null&&fd(e)),t}function fd(t){mt===null?mt=t:mt.push.apply(mt,t)}function xx(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!Jt(o(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function lr(t,e){for(e&=~ld,e&=~Oa,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-qt(e),r=1<<n;t[n]=-1,e&=~r}}function nv(t){if(ye&6)throw Error($(327));Oi();var e=Vs(t,0);if(!(e&1))return yt(t,Ne()),null;var n=Na(t,e);if(t.tag!==0&&n===2){var r=Kc(t);r!==0&&(e=r,n=hd(t,r))}if(n===1)throw n=Po,$r(t,0),lr(t,e),yt(t,Ne()),n;if(n===6)throw Error($(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Fr(t,mt,Dn),yt(t,Ne()),null}function pd(t,e){var n=ye;ye|=1;try{return t(e)}finally{ye=n,ye===0&&(Ai=Ne()+500,ca&&tr())}}function Nr(t){sr!==null&&sr.tag===0&&!(ye&6)&&Oi();var e=ye;ye|=1;var n=Ft.transition,r=Se;try{if(Ft.transition=null,Se=1,t)return t()}finally{Se=r,Ft.transition=n,ye=e,!(ye&6)&&tr()}}function gd(){Tt=Mi.current,Ae(Mi)}function $r(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Zk(n)),Fe!==null)for(n=Fe.return;n!==null;){var r=n;switch(_u(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&aa();break;case 3:Ci(),Ae(ft),Ae(et),$u();break;case 5:Ru(r);break;case 4:Ci();break;case 13:Ae(Le);break;case 19:Ae(Le);break;case 10:Ou(r.type._context);break;case 22:case 23:gd()}n=n.return}if(Ve=t,Fe=t=cr(t.current,null),Ge=Tt=e,Be=0,Po=null,ld=Oa=Rr=0,mt=Io=null,Lr!==null){for(e=0;e<Lr.length;e++)if(n=Lr[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var s=o.next;o.next=i,r.next=s}n.pending=r}Lr=null}return t}function rv(t,e){do{var n=Fe;try{if(Au(),ba.current=xa,wa){for(var r=Pe.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}wa=!1}if(Ir=0,He=je=Pe=null,To=!1,Mo=0,ad.current=null,n===null||n.return===null){Be=1,Po=e,Fe=null;break}e:{var o=t,s=n.return,a=n,l=e;if(e=Ge,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var g=My(s);if(g!==null){g.flags&=-257,Ay(g,s,a,o,e),g.mode&1&&Ty(o,c,e),e=g,l=c;var y=e.updateQueue;if(y===null){var m=new Set;m.add(l),e.updateQueue=m}else y.add(l);break e}else{if(!(e&1)){Ty(o,c,e),md();break e}l=Error($(426))}}else if(Oe&&a.mode&1){var S=My(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),Ay(S,s,a,o,e),Tu(Ei(l,a));break e}}o=l=Ei(l,a),Be!==4&&(Be=2),Io===null?Io=[o]:Io.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var v=Cy(o,l,e);Xm(o,v);break e;case 1:a=l;var w=o.type,k=o.stateNode;if(!(o.flags&128)&&(typeof w.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(or===null||!or.has(k)))){o.flags|=65536,e&=-e,o.lanes|=e;var C=Ey(o,a,e);Xm(o,C);break e}}o=o.return}while(o!==null)}sv(n)}catch(E){e=E,Fe===n&&n!==null&&(Fe=n=n.return);continue}break}while(!0)}function iv(){var t=Aa.current;return Aa.current=xa,t===null?xa:t}function md(){(Be===0||Be===3||Be===2)&&(Be=4),Ve===null||!(Rr&268435455)&&!(Oa&268435455)||lr(Ve,Ge)}function Na(t,e){var n=ye;ye|=2;var r=iv();(Ve!==t||Ge!==e)&&(Dn=null,$r(t,e));do try{_x();break}catch(i){rv(t,i)}while(!0);if(Au(),ye=n,Aa.current=r,Fe!==null)throw Error($(261));return Ve=null,Ge=0,Be}function _x(){for(;Fe!==null;)ov(Fe)}function Cx(){for(;Fe!==null&&!QS();)ov(Fe)}function ov(t){var e=cv(t.alternate,t,Tt);t.memoizedProps=t.pendingProps,e===null?sv(t):Fe=e,ad.current=null}function sv(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=vx(n,e),n!==null){n.flags&=32767,Fe=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Be=6,Fe=null;return}}else if(n=yx(n,e,Tt),n!==null){Fe=n;return}if(e=e.sibling,e!==null){Fe=e;return}Fe=e=t}while(e!==null);Be===0&&(Be=5)}function Fr(t,e,n){var r=Se,i=Ft.transition;try{Ft.transition=null,Se=1,Ex(t,e,n,r)}finally{Ft.transition=i,Se=r}return null}function Ex(t,e,n,r){do Oi();while(sr!==null);if(ye&6)throw Error($(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error($(177));t.callbackNode=null,t.callbackPriority=0;var o=n.lanes|n.childLanes;if(sk(t,o),t===Ve&&(Fe=Ve=null,Ge=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||La||(La=!0,uv(Bs,function(){return Oi(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Ft.transition,Ft.transition=null;var s=Se;Se=1;var a=ye;ye|=4,ad.current=null,wx(t,n),Qy(n,t),Wk(mu),qs=!!gu,mu=gu=null,t.current=n,Sx(n),YS(),ye=a,Se=s,Ft.transition=o}else t.current=n;if(La&&(La=!1,sr=t,Pa=i),o=t.pendingLanes,o===0&&(or=null),ek(n.stateNode),yt(t,Ne()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Da)throw Da=!1,t=ud,ud=null,t;return Pa&1&&t.tag!==0&&Oi(),o=t.pendingLanes,o&1?t===dd?Ro++:(Ro=0,dd=t):Ro=0,tr(),null}function Oi(){if(sr!==null){var t=Jg(Pa),e=Ft.transition,n=Se;try{if(Ft.transition=null,Se=16>t?16:t,sr===null)var r=!1;else{if(t=sr,sr=null,Pa=0,ye&6)throw Error($(331));var i=ye;for(ye|=4,J=t.current;J!==null;){var o=J,s=o.child;if(J.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(J=c;J!==null;){var d=J;switch(d.tag){case 0:case 11:case 15:Lo(8,d,o)}var h=d.child;if(h!==null)h.return=d,J=h;else for(;J!==null;){d=J;var f=d.sibling,g=d.return;if(Ky(d),d===c){J=null;break}if(f!==null){f.return=g,J=f;break}J=g}}}var y=o.alternate;if(y!==null){var m=y.child;if(m!==null){y.child=null;do{var S=m.sibling;m.sibling=null,m=S}while(m!==null)}}J=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,J=s;else e:for(;J!==null;){if(o=J,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Lo(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,J=v;break e}J=o.return}}var w=t.current;for(J=w;J!==null;){s=J;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,J=k;else e:for(s=w;J!==null;){if(a=J,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ma(9,a)}}catch(E){Ie(a,a.return,E)}if(a===s){J=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,J=C;break e}J=a.return}}if(ye=i,tr(),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(Us,t)}catch{}r=!0}return r}finally{Se=n,Ft.transition=e}}return!1}function av(t,e,n){e=Ei(n,e),e=Cy(t,e,1),t=rr(t,e,1),e=ut(),t!==null&&(io(t,1,e),yt(t,e))}function Ie(t,e,n){if(t.tag===3)av(t,t,n);else for(;e!==null;){if(e.tag===3){av(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(or===null||!or.has(r))){t=Ei(n,t),t=Ey(e,t,1),e=rr(e,t,1),t=ut(),e!==null&&(io(e,1,t),yt(e,t));break}}e=e.return}}function Tx(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=ut(),t.pingedLanes|=t.suspendedLanes&n,Ve===t&&(Ge&n)===n&&(Be===4||Be===3&&(Ge&130023424)===Ge&&500>Ne()-cd?$r(t,0):ld|=n),yt(t,e)}function lv(t,e){e===0&&(t.mode&1?(e=Hs,Hs<<=1,!(Hs&130023424)&&(Hs=4194304)):e=1);var n=ut();t=Mn(t,e),t!==null&&(io(t,e,n),yt(t,n))}function Mx(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),lv(t,n)}function Ax(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error($(314))}r!==null&&r.delete(e),lv(t,n)}var cv;cv=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ft.current)gt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return gt=!1,mx(t,e,n);gt=!!(t.flags&131072)}else gt=!1,Oe&&e.flags&1048576&&zm(e,da,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Ea(t,e),t=e.pendingProps;var i=vi(e,et.current);_i(e,n),i=Bu(null,e,r,t,i,n);var o=Uu();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,pt(r)?(o=!0,la(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Pu(e),i.updater=_a,e.stateNode=i,i._reactInternals=e,qu(e,r,t,n),e=Yu(null,e,r,!0,o,n)):(e.tag=0,Oe&&o&&xu(e),ct(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Ea(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Dx(r),t=Qt(r,t),i){case 0:e=Qu(null,e,r,t,n);break e;case 1:e=Ry(null,e,r,t,n);break e;case 11:e=Oy(null,e,r,t,n);break e;case 14:e=Dy(null,e,r,Qt(r.type,t),n);break e}throw Error($(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Qt(r,i),Qu(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Qt(r,i),Ry(t,e,r,i,n);case 3:e:{if(Ny(e),t===null)throw Error($(387));r=e.pendingProps,o=e.memoizedState,i=o.element,Ym(t,e),ya(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Ei(Error($(423)),e),e=$y(t,e,r,n,i);break e}else if(r!==i){i=Ei(Error($(424)),e),e=$y(t,e,r,n,i);break e}else for(Et=Xn(e.stateNode.containerInfo.firstChild),Ct=e,Oe=!0,Gt=null,n=Gm(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Si(),r===i){e=On(t,e,n);break e}ct(t,e,r,n)}e=e.child}return e;case 5:return ey(e),t===null&&Eu(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,yu(r,i)?s=null:o!==null&&yu(r,o)&&(e.flags|=32),Iy(t,e),ct(t,e,s,n),e.child;case 6:return t===null&&Eu(e),null;case 13:return Fy(t,e,n);case 4:return Iu(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ki(e,null,r,n):ct(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Qt(r,i),Oy(t,e,r,i,n);case 7:return ct(t,e,e.pendingProps,n),e.child;case 8:return ct(t,e,e.pendingProps.children,n),e.child;case 12:return ct(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Te(pa,r._currentValue),r._currentValue=s,o!==null)if(Jt(o.value,s)){if(o.children===i.children&&!ft.current){e=On(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=An(-1,n&-n),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Du(o.return,n,e),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error($(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Du(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ct(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,_i(e,n),i=Nt(i),r=r(i),e.flags|=1,ct(t,e,r,n),e.child;case 14:return r=e.type,i=Qt(r,e.pendingProps),i=Qt(r.type,i),Dy(t,e,r,i,n);case 15:return Ly(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Qt(r,i),Ea(t,e),e.tag=1,pt(r)?(t=!0,la(e)):t=!1,_i(e,n),xy(e,r,i),qu(e,r,i,n),Yu(null,e,r,!0,t,n);case 19:return By(t,e,n);case 22:return Py(t,e,n)}throw Error($(156,e.tag))};function uv(t,e){return Hg(t,e)}function Ox(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jt(t,e,n,r){return new Ox(t,e,n,r)}function yd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Dx(t){if(typeof t=="function")return yd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===xc)return 11;if(t===Ec)return 14}return 2}function cr(t,e){var n=t.alternate;return n===null?(n=jt(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function $a(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")yd(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case oi:return jr(n.children,i,o,e);case Sc:s=8,i|=8;break;case kc:return t=jt(12,n,e,i|2),t.elementType=kc,t.lanes=o,t;case _c:return t=jt(13,n,e,i),t.elementType=_c,t.lanes=o,t;case Cc:return t=jt(19,n,e,i),t.elementType=Cc,t.lanes=o,t;case bg:return Fa(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case yg:s=10;break e;case vg:s=9;break e;case xc:s=11;break e;case Ec:s=14;break e;case Vn:s=16,r=null;break e}throw Error($(130,t==null?t:typeof t,""))}return e=jt(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function jr(t,e,n,r){return t=jt(7,t,r,e),t.lanes=n,t}function Fa(t,e,n,r){return t=jt(22,t,r,e),t.elementType=bg,t.lanes=n,t.stateNode={isHidden:!1},t}function vd(t,e,n){return t=jt(6,t,null,e),t.lanes=n,t}function bd(t,e,n){return e=jt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Lx(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wc(0),this.expirationTimes=Wc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wc(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function wd(t,e,n,r,i,o,s,a,l){return t=new Lx(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=jt(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pu(o),t}function Px(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ii,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function dv(t){if(!t)return er;t=t._reactInternals;e:{if(Tr(t)!==t||t.tag!==1)throw Error($(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(pt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error($(171))}if(t.tag===1){var n=t.type;if(pt(n))return jm(t,n,e)}return e}function hv(t,e,n,r,i,o,s,a,l){return t=wd(n,r,!0,t,i,o,s,a,l),t.context=dv(null),n=t.current,r=ut(),i=ar(n),o=An(r,i),o.callback=e??null,rr(n,o,i),t.current.lanes=i,io(t,i,r),yt(t,r),t}function ja(t,e,n,r){var i=e.current,o=ut(),s=ar(i);return n=dv(n),e.context===null?e.context=n:e.pendingContext=n,e=An(o,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=rr(i,e,s),t!==null&&(Zt(t,i,s,o),ma(t,i,s)),s}function Ba(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function fv(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Sd(t,e){fv(t,e),(t=t.alternate)&&fv(t,e)}function Ix(){return null}var pv=typeof reportError=="function"?reportError:function(t){console.error(t)};function kd(t){this._internalRoot=t}Ua.prototype.render=kd.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error($(409));ja(t,e,null,null)},Ua.prototype.unmount=kd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Nr(function(){ja(null,t,null,null)}),e[_n]=null}};function Ua(t){this._internalRoot=t}Ua.prototype.unstable_scheduleHydration=function(t){if(t){var e=Yg();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Gn.length&&e!==0&&e<Gn[n].priority;n++);Gn.splice(n,0,t),n===0&&em(t)}};function xd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function za(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function gv(){}function Rx(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=Ba(s);o.call(c)}}var s=hv(e,r,t,0,null,!1,!1,"",gv);return t._reactRootContainer=s,t[_n]=s.current,bo(t.nodeType===8?t.parentNode:t),Nr(),s}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=Ba(l);a.call(c)}}var l=wd(t,0,!1,null,null,!1,!1,"",gv);return t._reactRootContainer=l,t[_n]=l.current,bo(t.nodeType===8?t.parentNode:t),Nr(function(){ja(e,l,n,r)}),l}function Ha(t,e,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if(typeof i=="function"){var a=i;i=function(){var l=Ba(s);a.call(l)}}ja(e,s,t,i)}else s=Rx(n,e,t,i,r);return Ba(s)}Gg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=ro(e.pendingLanes);n!==0&&(qc(e,n|1),yt(e,Ne()),!(ye&6)&&(Ai=Ne()+500,tr()))}break;case 13:Nr(function(){var r=Mn(t,1);if(r!==null){var i=ut();Zt(r,t,1,i)}}),Sd(t,1)}},Jc=function(t){if(t.tag===13){var e=Mn(t,134217728);if(e!==null){var n=ut();Zt(e,t,134217728,n)}Sd(t,134217728)}},Qg=function(t){if(t.tag===13){var e=ar(t),n=Mn(t,e);if(n!==null){var r=ut();Zt(n,t,e,r)}Sd(t,e)}},Yg=function(){return Se},Xg=function(t,e){var n=Se;try{return Se=t,e()}finally{Se=n}},Bc=function(t,e,n){switch(e){case"input":if(Lc(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=sa(r);if(!i)throw Error($(90));kg(r),Lc(r,i)}}}break;case"textarea":Tg(t,n);break;case"select":e=n.value,e!=null&&si(t,!!n.multiple,e,!1)}},Ng=pd,$g=Nr;var Nx={usingClientEntryPoint:!1,Events:[ko,mi,sa,Ig,Rg,pd]},No={findFiberByHostInstance:Mr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$x={bundleType:No.bundleType,version:No.version,rendererPackageName:No.rendererPackageName,rendererConfig:No.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:xn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Ug(t),t===null?null:t.stateNode},findFiberByHostInstance:No.findFiberByHostInstance||Ix,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Va=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Va.isDisabled&&Va.supportsFiber)try{Us=Va.inject($x),an=Va}catch{}}kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Nx,kt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!xd(e))throw Error($(200));return Px(t,e,null,n)},kt.createRoot=function(t,e){if(!xd(t))throw Error($(299));var n=!1,r="",i=pv;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=wd(t,1,!1,null,null,n,!1,r,i),t[_n]=e.current,bo(t.nodeType===8?t.parentNode:t),new kd(e)},kt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error($(188)):(t=Object.keys(t).join(","),Error($(268,t)));return t=Ug(e),t=t===null?null:t.stateNode,t},kt.flushSync=function(t){return Nr(t)},kt.hydrate=function(t,e,n){if(!za(e))throw Error($(200));return Ha(null,t,e,!0,n)},kt.hydrateRoot=function(t,e,n){if(!xd(t))throw Error($(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=pv;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=hv(e,null,t,1,n??null,i,!1,o,s),t[_n]=e.current,bo(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new Ua(e)},kt.render=function(t,e,n){if(!za(e))throw Error($(200));return Ha(null,t,e,!1,n)},kt.unmountComponentAtNode=function(t){if(!za(t))throw Error($(40));return t._reactRootContainer?(Nr(function(){Ha(null,null,t,!1,function(){t._reactRootContainer=null,t[_n]=null})}),!0):!1},kt.unstable_batchedUpdates=pd,kt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!za(n))throw Error($(200));if(t==null||t._reactInternals===void 0)throw Error($(38));return Ha(t,e,n,!1,r)},kt.version="18.3.1-next-f1338f8080-20240426";function mv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mv)}catch(t){console.error(t)}}mv(),dg.exports=kt;var Fx=dg.exports,yv=Fx;mc.createRoot=yv.createRoot,mc.hydrateRoot=yv.hydrateRoot;var vv={exports:{}},Ka={};/**
375
375
  * @license React
376
376
  * react-jsx-runtime.production.min.js
377
377
  *
@@ -379,27 +379,27 @@ Error generating stack: `+o.message+`
379
379
  *
380
380
  * This source code is licensed under the MIT license found in the
381
381
  * LICENSE file in the root directory of this source tree.
382
- */var jx=oe,Bx=Symbol.for("react.element"),Ux=Symbol.for("react.fragment"),zx=Object.prototype.hasOwnProperty,Hx=jx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vx={key:!0,ref:!0,__self:!0,__source:!0};function vv(t,e,n){var r,i={},o=null,s=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)zx.call(e,r)&&!Vx.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Bx,type:t,key:o,ref:s,props:i,_owner:Hx.current}}Ka.Fragment=Ux,Ka.jsx=vv,Ka.jsxs=vv,yv.exports=Ka;var E=yv.exports;const Kx=400,Wx=({text:t,isVisible:e,onClick:n,autoHideDelay:r=0,onAutoHide:i,orbSize:o=56})=>{const[s,a]=oe.useState(!1),[l,c]=oe.useState(!1);return oe.useEffect(()=>{if(e)c(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a(!0)})});else{a(!1);const d=setTimeout(()=>{c(!1)},Kx);return()=>clearTimeout(d)}},[e]),oe.useEffect(()=>{if(e&&r>0&&i){const d=setTimeout(i,r);return()=>clearTimeout(d)}},[e,r,i]),l?E.jsx("div",{onClick:n,...n&&{role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" "||d.key==="Spacebar")&&(d.preventDefault(),n())}},style:{position:"absolute",right:0,height:`${o}px`,display:"flex",alignItems:"center",paddingLeft:"24px",paddingRight:`${o/2+24}px`,background:"linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%)",borderRadius:`${o/2}px`,boxShadow:`
382
+ */var jx=se,Bx=Symbol.for("react.element"),Ux=Symbol.for("react.fragment"),zx=Object.prototype.hasOwnProperty,Hx=jx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vx={key:!0,ref:!0,__self:!0,__source:!0};function bv(t,e,n){var r,i={},o=null,s=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)zx.call(e,r)&&!Vx.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Bx,type:t,key:o,ref:s,props:i,_owner:Hx.current}}Ka.Fragment=Ux,Ka.jsx=bv,Ka.jsxs=bv,vv.exports=Ka;var T=vv.exports;const Kx=400,Wx=({text:t,isVisible:e,onClick:n,autoHideDelay:r=0,onAutoHide:i,orbSize:o=56})=>{const[s,a]=se.useState(!1),[l,c]=se.useState(!1);return se.useEffect(()=>{if(e)c(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a(!0)})});else{a(!1);const d=setTimeout(()=>{c(!1)},Kx);return()=>clearTimeout(d)}},[e]),se.useEffect(()=>{if(e&&r>0&&i){const d=setTimeout(i,r);return()=>clearTimeout(d)}},[e,r,i]),l?T.jsx("div",{onClick:n,...n&&{role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" "||d.key==="Spacebar")&&(d.preventDefault(),n())}},style:{position:"absolute",right:0,height:`${o}px`,display:"flex",alignItems:"center",paddingLeft:"24px",paddingRight:`${o/2+24}px`,background:"linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%)",borderRadius:`${o/2}px`,boxShadow:`
383
383
  0 2px 20px rgba(0, 0, 0, 0.1),
384
384
  0 8px 32px rgba(0, 0, 0, 0.08),
385
385
  inset 0 1px 0 rgba(255, 255, 255, 1),
386
386
  inset 0 -1px 0 rgba(0, 0, 0, 0.02)
387
- `,cursor:n?"pointer":"default",opacity:s?1:0,transform:`translateX(${s?"0":"30px"})`,transition:"all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',pointerEvents:"all",whiteSpace:"nowrap",zIndex:0},children:E.jsx("span",{style:{fontSize:"15px",fontWeight:"500",color:"rgba(0, 0, 0, 0.85)",letterSpacing:"-0.01em",paddingRight:"24px"},children:t})}):null};function _d(t){return{get isDebug(){return t},log:(...e)=>{t&&console.log(...e)},warn:(...e)=>{t&&console.warn(...e)},error:(...e)=>{console.error(...e)}}}const de=_d(!1),Br="floe_nudge_state",bv="floe_nudge_sound_played",$o={initialDelay:5e3,autoHideDuration:1e4,maxImpressions:3,cooldownDays:7},qx=({connected:t,agentState:e,onExpand:n,onToggleConnection:r,isReturningUser:i=!1,hasSkippedOnboarding:o=!1,nudgeText:s="Hi 👋 How can I help you today?",showNudge:a,onNudgeDismiss:l,nudgeAutoHideDelay:c,nudgeAutoShow:d=!0})=>{const h=i||o,[f,v]=oe.useState(!1),[b,g]=oe.useState(!1),[S,m]=oe.useState(!1),w=oe.useRef(null),k=oe.useCallback(()=>{try{const J=localStorage.getItem(Br);if(!J)return!0;const K=JSON.parse(J);return!(K.hasEngaged||K.impressions>=$o.maxImpressions||K.lastDismissed&&(Date.now()-K.lastDismissed)/864e5<$o.cooldownDays)}catch{return!0}},[]),C=oe.useCallback(()=>{try{const J=localStorage.getItem(Br),K=J?JSON.parse(J):{impressions:0};K.impressions=(K.impressions||0)+1,K.lastShown=Date.now(),localStorage.setItem(Br,JSON.stringify(K))}catch{}},[]),M=oe.useCallback(()=>{try{const J=localStorage.getItem(Br),K=J?JSON.parse(J):{impressions:0};K.lastDismissed=Date.now(),localStorage.setItem(Br,JSON.stringify(K))}catch{}},[]),P=oe.useCallback(()=>{try{const J=localStorage.getItem(Br),K=J?JSON.parse(J):{impressions:0};K.hasEngaged=!0,localStorage.setItem(Br,JSON.stringify(K))}catch{}},[]),L=oe.useCallback(()=>{try{if(sessionStorage.getItem(bv))return;const J=window.AudioContext||window.webkitAudioContext;if(!J)return;const K=new J;K.state==="suspended"&&K.resume();const re=K.currentTime,j=K.createOscillator(),z=K.createGain();j.connect(z),z.connect(K.destination),j.frequency.setValueAtTime(659,re),j.type="sine",z.gain.setValueAtTime(.25,re),z.gain.exponentialRampToValueAtTime(.01,re+.3),j.start(re),j.stop(re+.3);const B=K.createOscillator(),le=K.createGain();B.connect(le),le.connect(K.destination),B.frequency.setValueAtTime(784,re+.12),B.type="sine",le.gain.setValueAtTime(0,re),le.gain.setValueAtTime(.2,re+.12),le.gain.exponentialRampToValueAtTime(.01,re+.5),B.start(re+.12),B.stop(re+.5);const we=K.createOscillator(),u=K.createGain();we.connect(u),u.connect(K.destination),we.frequency.setValueAtTime(1318,re),we.type="sine",u.gain.setValueAtTime(.08,re),u.gain.exponentialRampToValueAtTime(.001,re+.2),we.start(re),we.stop(re+.2),B.onended=()=>{K.close()},de.log("[Floe] Nudge sound played"),sessionStorage.setItem(bv,"true")}catch{}},[]),F=a!==void 0?a:b&&!S&&!t;oe.useEffect(()=>{if(a===void 0&&d&&h&&!t&&!S){if(!k())return;const J=setTimeout(()=>{g(!0),C(),L()},$o.initialDelay),K=c===void 0?$o.autoHideDuration:c;let re;return K>0&&(re=setTimeout(()=>{g(!1),M()},$o.initialDelay+K)),()=>{clearTimeout(J),re&&clearTimeout(re)}}},[h,t,S,k,C,M,L,a,d,c]);const Y=oe.useCallback(()=>{g(!1),m(!0),M(),l==null||l()},[M,l]),W=oe.useCallback(()=>{g(!1),P(),n==null||n(),h&&!t&&r&&r()},[P,n,h,t,r]),H=oe.useCallback(()=>{P(),n==null||n(),h&&!t&&r&&r()},[P,n,h,t,r]),Q=oe.useCallback(J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),H())},[H]),q=()=>{switch(e){case"connecting":return"#fbbf24";case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#22d3ee";case"paused":return"#f59e0b";case"minimized":return"#6b7280";default:return"#6b7280"}},ae=h&&!t?56:52;return E.jsxs("div",{style:{position:"fixed",bottom:"24px",right:"24px",display:"flex",alignItems:"center",justifyContent:"flex-end",zIndex:2147483645,pointerEvents:"none"},children:[E.jsx(Wx,{text:s,isVisible:F,onClick:W,onAutoHide:Y,orbSize:ae}),E.jsxs("div",{ref:w,role:"button",tabIndex:0,"aria-label":h?i?"Welcome back - Start Floe":"Start Floe":"Expand Floe",onClick:H,onKeyDown:Q,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),style:{position:"relative",width:`${ae}px`,height:`${ae}px`,borderRadius:"50%",background:"linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 50%, #0f0f0f 100%)",border:"1px solid rgba(255, 255, 255, 0.1)",boxShadow:`
387
+ `,cursor:n?"pointer":"default",opacity:s?1:0,transform:`translateX(${s?"0":"30px"})`,transition:"all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',pointerEvents:"all",whiteSpace:"nowrap",zIndex:0},children:T.jsx("span",{style:{fontSize:"15px",fontWeight:"500",color:"rgba(0, 0, 0, 0.85)",letterSpacing:"-0.01em",paddingRight:"24px"},children:t})}):null};function _d(t){return{get isDebug(){return t},log:(...e)=>{t&&console.log(...e)},warn:(...e)=>{t&&console.warn(...e)},error:(...e)=>{console.error(...e)}}}const de=_d(!1),Br="floe_nudge_state",wv="floe_nudge_sound_played",$o={initialDelay:5e3,autoHideDuration:1e4,maxImpressions:3,cooldownDays:7},qx=({connected:t,agentState:e,onExpand:n,onToggleConnection:r,isReturningUser:i=!1,hasSkippedOnboarding:o=!1,nudgeText:s="Hi 👋 How can I help you today?",showNudge:a,onNudgeDismiss:l,nudgeAutoHideDelay:c,nudgeAutoShow:d=!0})=>{const h=i||o,[f,g]=se.useState(!1),[y,m]=se.useState(!1),[S,v]=se.useState(!1),w=se.useRef(null),k=se.useCallback(()=>{try{const Q=localStorage.getItem(Br);if(!Q)return!0;const V=JSON.parse(Q);return!(V.hasEngaged||V.impressions>=$o.maxImpressions||V.lastDismissed&&(Date.now()-V.lastDismissed)/864e5<$o.cooldownDays)}catch{return!0}},[]),C=se.useCallback(()=>{try{const Q=localStorage.getItem(Br),V=Q?JSON.parse(Q):{impressions:0};V.impressions=(V.impressions||0)+1,V.lastShown=Date.now(),localStorage.setItem(Br,JSON.stringify(V))}catch{}},[]),E=se.useCallback(()=>{try{const Q=localStorage.getItem(Br),V=Q?JSON.parse(Q):{impressions:0};V.lastDismissed=Date.now(),localStorage.setItem(Br,JSON.stringify(V))}catch{}},[]),L=se.useCallback(()=>{try{const Q=localStorage.getItem(Br),V=Q?JSON.parse(Q):{impressions:0};V.hasEngaged=!0,localStorage.setItem(Br,JSON.stringify(V))}catch{}},[]),A=se.useCallback(()=>{try{if(sessionStorage.getItem(wv))return;const Q=window.AudioContext||window.webkitAudioContext;if(!Q)return;const V=new Q;V.state==="suspended"&&V.resume();const X=V.currentTime,B=V.createOscillator(),q=V.createGain();B.connect(q),q.connect(V.destination),B.frequency.setValueAtTime(659,X),B.type="sine",q.gain.setValueAtTime(.25,X),q.gain.exponentialRampToValueAtTime(.01,X+.3),B.start(X),B.stop(X+.3);const z=V.createOscillator(),le=V.createGain();z.connect(le),le.connect(V.destination),z.frequency.setValueAtTime(784,X+.12),z.type="sine",le.gain.setValueAtTime(0,X),le.gain.setValueAtTime(.2,X+.12),le.gain.exponentialRampToValueAtTime(.01,X+.5),z.start(X+.12),z.stop(X+.5);const we=V.createOscillator(),u=V.createGain();we.connect(u),u.connect(V.destination),we.frequency.setValueAtTime(1318,X),we.type="sine",u.gain.setValueAtTime(.08,X),u.gain.exponentialRampToValueAtTime(.001,X+.2),we.start(X),we.stop(X+.2),z.onended=()=>{V.close()},de.log("[Floe] Nudge sound played"),sessionStorage.setItem(wv,"true")}catch{}},[]),R=a!==void 0?a:y&&!S&&!t;se.useEffect(()=>{if(a===void 0&&d&&h&&!t&&!S){if(!k())return;const Q=setTimeout(()=>{m(!0),C(),A()},$o.initialDelay),V=c===void 0?$o.autoHideDuration:c;let X;return V>0&&(X=setTimeout(()=>{m(!1),E()},$o.initialDelay+V)),()=>{clearTimeout(Q),X&&clearTimeout(X)}}},[h,t,S,k,C,E,A,a,d,c]);const G=se.useCallback(()=>{m(!1),v(!0),E(),l==null||l()},[E,l]),U=se.useCallback(()=>{m(!1),L(),n==null||n(),h&&!t&&r&&r()},[L,n,h,t,r]),K=se.useCallback(()=>{L(),n==null||n(),h&&!t&&r&&r()},[L,n,h,t,r]),j=se.useCallback(Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),K())},[K]),H=()=>{switch(e){case"connecting":return"#fbbf24";case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#22d3ee";case"paused":return"#f59e0b";case"minimized":return"#6b7280";default:return"#6b7280"}},ie=h&&!t?56:52;return T.jsxs("div",{style:{position:"fixed",bottom:"24px",right:"24px",display:"flex",alignItems:"center",justifyContent:"flex-end",zIndex:2147483645,pointerEvents:"none"},children:[T.jsx(Wx,{text:s,isVisible:R,onClick:U,onAutoHide:G,orbSize:ie}),T.jsxs("div",{ref:w,role:"button",tabIndex:0,"aria-label":h?i?"Welcome back - Start Floe":"Start Floe":"Expand Floe",onClick:K,onKeyDown:j,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{position:"relative",width:`${ie}px`,height:`${ie}px`,borderRadius:"50%",background:"linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 50%, #0f0f0f 100%)",border:"1px solid rgba(255, 255, 255, 0.1)",boxShadow:`
388
388
  0 4px 24px rgba(0, 0, 0, 0.4),
389
389
  0 12px 48px rgba(0, 0, 0, 0.3),
390
390
  inset 0 1px 0 rgba(255, 255, 255, 0.08),
391
391
  inset 0 -1px 0 rgba(0, 0, 0, 0.2)
392
- `,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"all",transition:"all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",transform:f?"scale(1.06)":"scale(1)",outline:"none",flexShrink:0,zIndex:1},children:[(t&&e!=="idle"||h&&!t&&!F)&&E.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",border:`2px solid ${h&&!t?"rgba(255, 255, 255, 0.25)":q()}`,animation:"pulseRing 2.5s ease-out infinite",opacity:.5}}),E.jsxs("svg",{width:"22",height:"18",viewBox:"0 0 159 138",fill:"none",style:{transition:"all 0.3s ease"},children:[E.jsx("path",{fill:t?q():"white",d:"M64 31.5c-23.5 0-34 18-64 48.5C0 31.5 26.5 1 54 1s105-1 105-1c-2 11.5-18.5 31.5-29.5 31.5z"}),E.jsx("path",{fill:t?q():"white",d:"M64.5 89.5c-23.5 0-34 18-64 48.5 0-48.5 26.5-79 54-79s75-1 75-1c-2 11.5-18.5 31.5-29.5 31.5z"})]})]}),E.jsx("style",{children:`
392
+ `,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"all",transition:"all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",transform:f?"scale(1.06)":"scale(1)",outline:"none",flexShrink:0,zIndex:1},children:[(t&&e!=="idle"||h&&!t&&!R)&&T.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",border:`2px solid ${h&&!t?"rgba(255, 255, 255, 0.25)":H()}`,animation:"pulseRing 2.5s ease-out infinite",opacity:.5}}),T.jsxs("svg",{width:"22",height:"18",viewBox:"0 0 159 138",fill:"none",style:{transition:"all 0.3s ease"},children:[T.jsx("path",{fill:t?H():"white",d:"M64 31.5c-23.5 0-34 18-64 48.5C0 31.5 26.5 1 54 1s105-1 105-1c-2 11.5-18.5 31.5-29.5 31.5z"}),T.jsx("path",{fill:t?H():"white",d:"M64.5 89.5c-23.5 0-34 18-64 48.5 0-48.5 26.5-79 54-79s75-1 75-1c-2 11.5-18.5 31.5-29.5 31.5z"})]})]}),T.jsx("style",{children:`
393
393
  @keyframes pulseRing {
394
394
  0% { transform: scale(1); opacity: 0.5; }
395
395
  100% { transform: scale(1.6); opacity: 0; }
396
396
  }
397
- `})]})},Jx=({isActive:t,color:e="#60a5fa",height:n=24,barCount:r=5,barWidth:i=3,gap:o=2,audioLevels:s})=>{const a=Math.ceil(r/2),[l,c]=oe.useState(Array(a).fill(.15)),d=oe.useRef(),h=oe.useRef(Array(a).fill(.15));oe.useEffect(()=>{if(s&&s.length>0&&t){const b=Array(a).fill(0).map((g,S)=>{let m=0;if(S===0)m=s.reduce((k,C)=>k+C,0)/s.length,m=Math.pow(m,.7)*1.3;else{const w=Math.floor(s.length/(a-1)),k=(S-1)*w,C=Math.min(k+w,s.length);let M=0,P=0;for(let L=k;L<C;L++)M+=s[L],P++;m=P>0?M/P:0,m=m*(1-S*.08)}return Math.max(.15,Math.min(1,.15+m*.85))});h.current=b}else t||(h.current=Array(a).fill(.15))},[s,t,a]),oe.useEffect(()=>{const b=()=>{c(g=>g.map((S,m)=>{const w=h.current[m]||.15,k=t?.35:.15;return S+(w-S)*k})),d.current=requestAnimationFrame(b)};return d.current=requestAnimationFrame(b),()=>{d.current&&cancelAnimationFrame(d.current)}},[t,a]);const f=cg.useMemo(()=>{const b=[];for(let g=a-1;g>0;g--)b.push(l[g]);b.push(l[0]);for(let g=1;g<a;g++)b.push(l[g]);return b},[l,a]),v=f.length*i+(f.length-1)*o;return E.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:`${n}px`,width:`${v}px`,gap:`${o}px`},children:f.map((b,g)=>{const S=g===Math.floor(f.length/2),m=Math.max(4,n*b*(S?1.1:1));return E.jsx("div",{style:{width:`${i}px`,height:`${m}px`,background:e,borderRadius:`${i/2}px`,transition:"none",opacity:t?1:.4,boxShadow:t&&b>.3?`0 0 ${6*b}px ${e}50`:"none"}},g)})})},Gx=({isOpen:t,agentState:e,connected:n,voiceEnabled:r=!0,messages:i,currentTranscript:o="",currentRole:s,screenShareEnabled:a=!1,isSpeaking:l=!1,audioLevels:c=[],onToggleConnection:d,onToggleMute:h,onToggleScreenShare:f,onMinimize:v,onResume:b,onStop:g,connectionProgress:S,textModeEnabled:m=!1,micPermissionDenied:w=!1,onToggleTextMode:k,onSendText:C,planProgress:M})=>{const P=oe.useRef(null),L=oe.useRef(null),[F,Y]=oe.useState(!1),[W,H]=oe.useState(""),[Q,q]=oe.useState(!1),[ae,J]=oe.useState(!1);oe.useEffect(()=>{var B;(B=P.current)==null||B.scrollIntoView({behavior:"smooth"})},[i,o]),oe.useEffect(()=>{t&&Y(!0)},[t]);const K=!n||e==="paused";oe.useEffect(()=>{m&&!K&&L.current&&L.current.focus()},[m,K]);const re=()=>{var B;K||!W.trim()||!C||(C(W.trim()),H(""),(B=L.current)==null||B.focus())},j=()=>{if(e==="connecting")return(S==null?void 0:S.message)||"Connecting...";if(m&&n)switch(e){case"listening":return"Text mode";case"thinking":return"Thinking";case"speaking":return"Responding";case"guiding":return"Guiding";case"paused":return"Paused";default:return"Text mode"}if(!r&&n&&e!=="speaking")return"Muted";switch(e){case"listening":return"Listening";case"thinking":return"Thinking";case"speaking":return"Speaking";case"guiding":return"Guiding";case"paused":return"Paused";default:return n?"Ready":"Offline"}},z=()=>{if(e==="connecting")return"#fbbf24";if(!r&&n&&e!=="speaking")return"#ef4444";switch(e){case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#22d3ee";case"paused":return"#f59e0b";default:return"#6b7280"}};return!t&&!F?null:E.jsx(E.Fragment,{children:E.jsxs("div",{onTransitionEnd:()=>!t&&Y(!1),style:{position:"fixed",bottom:"24px",right:"24px",width:"360px",maxHeight:"min(70vh, 700px)",minHeight:"220px",background:"linear-gradient(180deg, rgba(22, 22, 24, 0.98) 0%, rgba(18, 18, 20, 0.99) 100%)",backdropFilter:"blur(24px)",borderRadius:"20px",border:"1px solid rgba(255, 255, 255, 0.08)",boxShadow:`
397
+ `})]})},Jx=({isActive:t,color:e="#60a5fa",height:n=24,barCount:r=5,barWidth:i=3,gap:o=2,audioLevels:s})=>{const a=Math.ceil(r/2),[l,c]=se.useState(Array(a).fill(.15)),d=se.useRef(),h=se.useRef(Array(a).fill(.15));se.useEffect(()=>{if(s&&s.length>0&&t){const y=Array(a).fill(0).map((m,S)=>{let v=0;if(S===0)v=s.reduce((k,C)=>k+C,0)/s.length,v=Math.pow(v,.7)*1.3;else{const w=Math.floor(s.length/(a-1)),k=(S-1)*w,C=Math.min(k+w,s.length);let E=0,L=0;for(let A=k;A<C;A++)E+=s[A],L++;v=L>0?E/L:0,v=v*(1-S*.08)}return Math.max(.15,Math.min(1,.15+v*.85))});h.current=y}else t||(h.current=Array(a).fill(.15))},[s,t,a]),se.useEffect(()=>{const y=()=>{c(m=>m.map((S,v)=>{const w=h.current[v]||.15,k=t?.35:.15;return S+(w-S)*k})),d.current=requestAnimationFrame(y)};return d.current=requestAnimationFrame(y),()=>{d.current&&cancelAnimationFrame(d.current)}},[t,a]);const f=ug.useMemo(()=>{const y=[];for(let m=a-1;m>0;m--)y.push(l[m]);y.push(l[0]);for(let m=1;m<a;m++)y.push(l[m]);return y},[l,a]),g=f.length*i+(f.length-1)*o;return T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:`${n}px`,width:`${g}px`,gap:`${o}px`},children:f.map((y,m)=>{const S=m===Math.floor(f.length/2),v=Math.max(4,n*y*(S?1.1:1));return T.jsx("div",{style:{width:`${i}px`,height:`${v}px`,background:e,borderRadius:`${i/2}px`,transition:"none",opacity:t?1:.4,boxShadow:t&&y>.3?`0 0 ${6*y}px ${e}50`:"none"}},m)})})},Gx=({isOpen:t,agentState:e,connected:n,voiceEnabled:r=!0,messages:i,currentTranscript:o="",currentRole:s,screenShareEnabled:a=!1,isSpeaking:l=!1,audioLevels:c=[],onToggleConnection:d,onToggleMute:h,onToggleScreenShare:f,onMinimize:g,onResume:y,onStop:m,connectionProgress:S,textModeEnabled:v=!1,micPermissionDenied:w=!1,onToggleTextMode:k,onSendText:C,planProgress:E})=>{const L=se.useRef(null),A=se.useRef(null),[R,G]=se.useState(!1),[U,K]=se.useState(""),[j,H]=se.useState(!1),[ie,Q]=se.useState(!1);se.useEffect(()=>{var z;(z=L.current)==null||z.scrollIntoView({behavior:"smooth"})},[i,o]),se.useEffect(()=>{t&&G(!0)},[t]);const V=!n||e==="paused";se.useEffect(()=>{v&&!V&&A.current&&A.current.focus()},[v,V]);const X=()=>{var z;V||!U.trim()||!C||(C(U.trim()),K(""),(z=A.current)==null||z.focus())},B=()=>{if(e==="connecting")return(S==null?void 0:S.message)||"Connecting...";if(v&&n)switch(e){case"listening":return"Text mode";case"thinking":return"Thinking";case"speaking":return"Responding";case"guiding":return"Guiding";case"paused":return"Paused";default:return"Text mode"}if(!r&&n&&e!=="speaking")return"Muted";switch(e){case"listening":return"Listening";case"thinking":return"Thinking";case"speaking":return"Speaking";case"guiding":return"Guiding";case"paused":return"Paused";default:return n?"Ready":"Offline"}},q=()=>{if(e==="connecting")return"#fbbf24";if(!r&&n&&e!=="speaking")return"#ef4444";switch(e){case"listening":return"#60a5fa";case"thinking":return"#fbbf24";case"speaking":return"#34d399";case"guiding":return"#22d3ee";case"paused":return"#f59e0b";default:return"#6b7280"}};return!t&&!R?null:T.jsx(T.Fragment,{children:T.jsxs("div",{onTransitionEnd:()=>!t&&G(!1),style:{position:"fixed",bottom:"24px",right:"24px",width:"360px",maxHeight:"min(70vh, 700px)",minHeight:"220px",background:"linear-gradient(180deg, rgba(22, 22, 24, 0.98) 0%, rgba(18, 18, 20, 0.99) 100%)",backdropFilter:"blur(24px)",borderRadius:"20px",border:"1px solid rgba(255, 255, 255, 0.08)",boxShadow:`
398
398
  0 0 0 1px rgba(0, 0, 0, 0.3),
399
399
  0 24px 48px rgba(0, 0, 0, 0.5),
400
400
  0 12px 24px rgba(0, 0, 0, 0.3),
401
401
  inset 0 1px 0 rgba(255, 255, 255, 0.05)
402
- `,display:"flex",flexDirection:"column",zIndex:2147483645,pointerEvents:"all",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',transform:t?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",opacity:t?1:0,transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:[E.jsxs("div",{style:{padding:"16px 16px 12px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[E.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:"linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 50%, #0f0f0f 100%)",border:`1.5px solid ${z()}40`,boxShadow:`0 0 12px ${z()}30`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.3s ease",animation:n&&e!=="idle"?"logoGlow 2s ease-in-out infinite":"none","--glow-color":z()},children:E.jsxs("svg",{width:"16",height:"14",viewBox:"0 0 159 138",fill:"none",children:[E.jsx("path",{fill:z(),d:"M64 31.5c-23.5 0-34 18-64 48.5C0 31.5 26.5 1 54 1s105-1 105-1c-2 11.5-18.5 31.5-29.5 31.5z"}),E.jsx("path",{fill:z(),d:"M64.5 89.5c-23.5 0-34 18-64 48.5 0-48.5 26.5-79 54-79s75-1 75-1c-2 11.5-18.5 31.5-29.5 31.5z"})]})}),E.jsxs("div",{style:{minWidth:0},children:[E.jsx("div",{style:{fontSize:"14px",fontWeight:"600",color:"rgba(255, 255, 255, 0.95)",marginBottom:"1px"},children:"Floe"}),E.jsxs("div",{style:{fontSize:"11px",color:z(),fontWeight:"500",display:"flex",alignItems:"center",gap:"5px"},children:[E.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:z(),boxShadow:`0 0 6px ${z()}`,flexShrink:0}}),j()]})]})]}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexShrink:0},children:[e!=="paused"&&E.jsx(Fo,{onClick:d,tooltip:e==="connecting"?"Connecting…":n?"End Session":"Connect",ariaLabel:e==="connecting"?"Connecting, please wait":n?"End session":"Connect",active:n,activeColor:"#34d399",disabled:e==="connecting",children:e==="connecting"?E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{animation:"headerSpinner 0.8s linear infinite"},children:[E.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"rgba(251, 191, 36, 0.25)",strokeWidth:"2.5"}),E.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"#fbbf24",strokeWidth:"2.5",strokeLinecap:"round"})]}):n?E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),E.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}):E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("path",{d:"M5 12.55a11 11 0 0 1 14.08 0"}),E.jsx("path",{d:"M1.42 9a16 16 0 0 1 21.16 0"}),E.jsx("path",{d:"M8.53 16.11a6 6 0 0 1 6.95 0"}),E.jsx("circle",{cx:"12",cy:"20",r:"1"})]})}),e==="paused"&&b&&E.jsx(Fo,{onClick:b,tooltip:"Resume",ariaLabel:"Resume session",active:!0,activeColor:"#34d399",children:E.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:E.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),e==="paused"&&g&&E.jsx(Fo,{onClick:g,tooltip:"End Session",ariaLabel:"End session",activeColor:"#ef4444",children:E.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:E.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),E.jsx(Fo,{onClick:f,disabled:!n,active:a,activeColor:"#22d3ee",tooltip:a?"Stop Share":"Share Screen",ariaLabel:a?"Stop screen share":"Share screen",children:a?E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),E.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),E.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),E.jsx("path",{d:"M12 11V7l3 2-3 2z",fill:"currentColor"})]}):E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),E.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),E.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),E.jsx("div",{style:{width:"1px",height:"20px",background:"rgba(255, 255, 255, 0.08)",margin:"0 2px"}}),E.jsx(Fo,{onClick:v,tooltip:"Minimize",ariaLabel:"Minimize panel",children:E.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:E.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})]})]}),M&&(()=>{const B=Number.isFinite(M.progressPercent)?Math.max(0,Math.min(100,M.progressPercent)):0;return E.jsxs("div",{style:{padding:"0 16px 8px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)"},children:[E.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",color:"rgba(255, 255, 255, 0.5)",marginBottom:"4px"},children:[E.jsxs("span",{children:["Step ",M.currentStep," of ",M.totalSteps]}),E.jsxs("span",{children:[Math.round(B),"%"]})]}),E.jsx("div",{style:{height:"3px",borderRadius:"2px",background:"rgba(255, 255, 255, 0.08)"},children:E.jsx("div",{style:{height:"100%",borderRadius:"2px",background:"linear-gradient(90deg, #3b82f6, #60a5fa)",width:`${B}%`,transition:"width 0.5s ease"}})}),M.currentTaskTitle&&E.jsx("div",{style:{fontSize:"11px",color:"rgba(255, 255, 255, 0.4)",marginTop:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.currentTaskTitle})]})})(),e==="connecting"&&S&&E.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",gap:"10px"},children:[E.jsx("div",{style:{width:"18px",height:"18px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),E.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"3px",flex:1},children:[E.jsx("span",{style:{fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.9)"},children:S.message}),E.jsx("div",{style:{width:"100%",height:"2px",background:"rgba(255, 255, 255, 0.1)",borderRadius:"2px",overflow:"hidden"},children:E.jsx("div",{style:{width:`${S.progress}%`,height:"100%",background:"linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%)",borderRadius:"2px",transition:"width 0.3s ease"}})})]})]}),e==="paused"&&E.jsxs("div",{style:{padding:"14px 16px",background:"rgba(245, 158, 11, 0.1)",borderBottom:"1px solid rgba(245, 158, 11, 0.2)",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[E.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#f59e0b",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("circle",{cx:"12",cy:"12",r:"10"}),E.jsx("line",{x1:"10",y1:"15",x2:"10",y2:"9"}),E.jsx("line",{x1:"14",y1:"15",x2:"14",y2:"9"})]}),E.jsx("span",{style:{color:"#f59e0b",fontSize:"13px",fontWeight:"600"},children:"Session Paused"})]}),E.jsx("div",{style:{color:"rgba(255, 255, 255, 0.5)",fontSize:"12px",textAlign:"center",lineHeight:"1.4"},children:"You were inactive. Click Resume to continue."}),b&&E.jsxs("button",{onClick:b,style:{padding:"8px 20px",background:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",border:"none",borderRadius:"8px",color:"white",fontSize:"13px",fontWeight:"600",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",boxShadow:"0 4px 12px rgba(245, 158, 11, 0.3)",transition:"all 0.2s ease"},onMouseEnter:B=>{B.currentTarget.style.transform="scale(1.02)"},onMouseLeave:B=>{B.currentTarget.style.transform="scale(1)"},children:[E.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:E.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Resume"]})]}),E.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.length===0&&!o?E.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"32px 16px",color:"rgba(255, 255, 255, 0.4)"},children:[E.jsx("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{marginBottom:"12px",opacity:.5},children:E.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),E.jsx("div",{style:{fontSize:"13px",fontWeight:"500",marginBottom:"6px"},children:"No messages yet"}),E.jsx("div",{style:{fontSize:"12px",lineHeight:"1.5"},children:m?"Type a message to begin your conversation":"Start speaking to begin your conversation"})]}):E.jsxs(E.Fragment,{children:[i.map(B=>E.jsx(wv,{message:B},B.id)),o&&s&&E.jsx(wv,{message:{id:"current",role:s,content:o,timestamp:Date.now(),isPartial:!0}})]}),E.jsx("div",{ref:P})]}),E.jsx("div",{style:{padding:"10px 16px 14px 16px",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},children:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"rgba(255, 255, 255, 0.04)",borderRadius:"12px",border:`1px solid ${!m&&!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.2)":"rgba(255, 255, 255, 0.06)"}`},children:[E.jsx("button",{onClick:m?k:h,disabled:!n,"aria-label":m&&w?"Microphone access was denied. Allow microphone in browser settings to switch to voice mode.":m?"Switch to voice mode":r?"Mute microphone":"Unmute microphone",title:m&&w?"Microphone access was denied. Allow microphone in browser settings to switch to voice mode.":void 0,style:{width:"32px",height:"32px",borderRadius:"8px",border:!m&&!r&&n&&e!=="speaking"?"1px solid rgba(239, 68, 68, 0.3)":"none",background:m?"transparent":!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.15)":r&&n?`${z()}15`:"transparent",color:m?"rgba(255, 255, 255, 0.5)":!r&&n&&e!=="speaking"?"#ef4444":n?"rgba(255, 255, 255, 0.8)":"rgba(255, 255, 255, 0.3)",cursor:n?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:n?1:.5,flexShrink:0},children:m?E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),E.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),E.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),E.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}):r?E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),E.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),E.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),E.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}):E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),E.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),E.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"}),E.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),E.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}),E.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",gap:"8px",minWidth:0,position:"relative"},children:m?E.jsx("input",{ref:L,type:"text",placeholder:K?"Not connected...":"Type a message...",value:W,disabled:K,onChange:B=>H(B.target.value),onKeyDown:B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),re())},style:{flex:1,padding:"6px 10px",borderRadius:"8px",border:"none",background:"transparent",color:K?"rgba(255, 255, 255, 0.3)":"rgba(255, 255, 255, 0.9)",fontSize:"13px",outline:"none",caretColor:"#60a5fa",fontFamily:"inherit",width:"100%",minWidth:0,cursor:K?"not-allowed":"text"}}):E.jsx(E.Fragment,{children:n&&r&&(e==="speaking"||e==="listening")?E.jsx(Jx,{isActive:l,color:z(),height:22,barCount:7,audioLevels:c}):e==="connecting"&&S?E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[E.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),E.jsx("span",{style:{fontSize:"12px",color:"#fbbf24",fontWeight:"500"},children:S.message})]}):E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[!r&&n&&e!=="speaking"&&E.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),E.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),E.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"})]}),E.jsx("span",{style:{fontSize:"12px",fontWeight:"500",color:!r&&n&&e!=="speaking"?"#ef4444":"rgba(255, 255, 255, 0.5)",letterSpacing:"0.01em"},children:j()})]})})}),m?E.jsx("button",{onClick:re,disabled:!W.trim(),"aria-label":"Send message",onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:W.trim()?Q?"#2563eb":"#3b82f6":"transparent",color:W.trim()?"white":"rgba(255, 255, 255, 0.3)",cursor:W.trim()?"pointer":"default",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0,outline:"none"},children:E.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),E.jsx("polyline",{points:"5 12 12 5 19 12"})]})}):E.jsxs(E.Fragment,{children:[n&&E.jsx("button",{onClick:k,"aria-label":"Switch to text mode",onMouseEnter:()=>J(!0),onMouseLeave:()=>J(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:"transparent",color:ae?"rgba(255, 255, 255, 0.7)":"rgba(255, 255, 255, 0.4)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0,outline:"none",padding:0},children:E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",ry:"2"}),E.jsx("line",{x1:"6",y1:"8",x2:"6",y2:"8"}),E.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"8"}),E.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"8"}),E.jsx("line",{x1:"18",y1:"8",x2:"18",y2:"8"}),E.jsx("line",{x1:"6",y1:"12",x2:"6",y2:"12"}),E.jsx("line",{x1:"10",y1:"12",x2:"10",y2:"12"}),E.jsx("line",{x1:"14",y1:"12",x2:"14",y2:"12"}),E.jsx("line",{x1:"18",y1:"12",x2:"18",y2:"12"}),E.jsx("line",{x1:"8",y1:"16",x2:"16",y2:"16"})]})}),n&&E.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"#34d399",boxShadow:"0 0 8px #34d39980",animation:"pulse 2s ease-in-out infinite",flexShrink:0}})]})]})}),E.jsx("style",{children:`
402
+ `,display:"flex",flexDirection:"column",zIndex:2147483645,pointerEvents:"all",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',transform:t?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",opacity:t?1:0,transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:[T.jsxs("div",{style:{padding:"16px 16px 12px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[T.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:"linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 50%, #0f0f0f 100%)",border:`1.5px solid ${q()}40`,boxShadow:`0 0 12px ${q()}30`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.3s ease",animation:n&&e!=="idle"?"logoGlow 2s ease-in-out infinite":"none","--glow-color":q()},children:T.jsxs("svg",{width:"16",height:"14",viewBox:"0 0 159 138",fill:"none",children:[T.jsx("path",{fill:q(),d:"M64 31.5c-23.5 0-34 18-64 48.5C0 31.5 26.5 1 54 1s105-1 105-1c-2 11.5-18.5 31.5-29.5 31.5z"}),T.jsx("path",{fill:q(),d:"M64.5 89.5c-23.5 0-34 18-64 48.5 0-48.5 26.5-79 54-79s75-1 75-1c-2 11.5-18.5 31.5-29.5 31.5z"})]})}),T.jsxs("div",{style:{minWidth:0},children:[T.jsx("div",{style:{fontSize:"14px",fontWeight:"600",color:"rgba(255, 255, 255, 0.95)",marginBottom:"1px"},children:"Floe"}),T.jsxs("div",{style:{fontSize:"11px",color:q(),fontWeight:"500",display:"flex",alignItems:"center",gap:"5px"},children:[T.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:q(),boxShadow:`0 0 6px ${q()}`,flexShrink:0}}),B()]})]})]}),T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexShrink:0},children:[e!=="paused"&&T.jsx(Fo,{onClick:d,tooltip:e==="connecting"?"Connecting…":n?"End Session":"Connect",ariaLabel:e==="connecting"?"Connecting, please wait":n?"End session":"Connect",active:n,activeColor:"#34d399",disabled:e==="connecting",children:e==="connecting"?T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{animation:"headerSpinner 0.8s linear infinite"},children:[T.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"rgba(251, 191, 36, 0.25)",strokeWidth:"2.5"}),T.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"#fbbf24",strokeWidth:"2.5",strokeLinecap:"round"})]}):n?T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),T.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}):T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M5 12.55a11 11 0 0 1 14.08 0"}),T.jsx("path",{d:"M1.42 9a16 16 0 0 1 21.16 0"}),T.jsx("path",{d:"M8.53 16.11a6 6 0 0 1 6.95 0"}),T.jsx("circle",{cx:"12",cy:"20",r:"1"})]})}),e==="paused"&&y&&T.jsx(Fo,{onClick:y,tooltip:"Resume",ariaLabel:"Resume session",active:!0,activeColor:"#34d399",children:T.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),e==="paused"&&m&&T.jsx(Fo,{onClick:m,tooltip:"End Session",ariaLabel:"End session",activeColor:"#ef4444",children:T.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),T.jsx(Fo,{onClick:f,disabled:!n,active:a,activeColor:"#22d3ee",tooltip:a?"Stop Share":"Share Screen",ariaLabel:a?"Stop screen share":"Share screen",children:a?T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),T.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),T.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),T.jsx("path",{d:"M12 11V7l3 2-3 2z",fill:"currentColor"})]}):T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),T.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),T.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),T.jsx("div",{style:{width:"1px",height:"20px",background:"rgba(255, 255, 255, 0.08)",margin:"0 2px"}}),T.jsx(Fo,{onClick:g,tooltip:"Minimize",ariaLabel:"Minimize panel",children:T.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})]})]}),E&&(()=>{const z=Number.isFinite(E.progressPercent)?Math.max(0,Math.min(100,E.progressPercent)):0;return T.jsxs("div",{style:{padding:"0 16px 8px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)"},children:[T.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",color:"rgba(255, 255, 255, 0.5)",marginBottom:"4px"},children:[T.jsxs("span",{children:["Step ",E.currentStep," of ",E.totalSteps]}),T.jsxs("span",{children:[Math.round(z),"%"]})]}),T.jsx("div",{style:{height:"3px",borderRadius:"2px",background:"rgba(255, 255, 255, 0.08)"},children:T.jsx("div",{style:{height:"100%",borderRadius:"2px",background:"linear-gradient(90deg, #3b82f6, #60a5fa)",width:`${z}%`,transition:"width 0.5s ease"}})}),E.currentTaskTitle&&T.jsx("div",{style:{fontSize:"11px",color:"rgba(255, 255, 255, 0.4)",marginTop:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.currentTaskTitle})]})})(),e==="connecting"&&S&&T.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.06)",display:"flex",alignItems:"center",gap:"10px"},children:[T.jsx("div",{style:{width:"18px",height:"18px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),T.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"3px",flex:1},children:[T.jsx("span",{style:{fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.9)"},children:S.message}),T.jsx("div",{style:{width:"100%",height:"2px",background:"rgba(255, 255, 255, 0.1)",borderRadius:"2px",overflow:"hidden"},children:T.jsx("div",{style:{width:`${S.progress}%`,height:"100%",background:"linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%)",borderRadius:"2px",transition:"width 0.3s ease"}})})]})]}),e==="paused"&&T.jsxs("div",{style:{padding:"14px 16px",background:"rgba(245, 158, 11, 0.1)",borderBottom:"1px solid rgba(245, 158, 11, 0.2)",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},children:[T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#f59e0b",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("circle",{cx:"12",cy:"12",r:"10"}),T.jsx("line",{x1:"10",y1:"15",x2:"10",y2:"9"}),T.jsx("line",{x1:"14",y1:"15",x2:"14",y2:"9"})]}),T.jsx("span",{style:{color:"#f59e0b",fontSize:"13px",fontWeight:"600"},children:"Session Paused"})]}),T.jsx("div",{style:{color:"rgba(255, 255, 255, 0.5)",fontSize:"12px",textAlign:"center",lineHeight:"1.4"},children:"You were inactive. Click Resume to continue."}),y&&T.jsxs("button",{onClick:y,style:{padding:"8px 20px",background:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",border:"none",borderRadius:"8px",color:"white",fontSize:"13px",fontWeight:"600",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",boxShadow:"0 4px 12px rgba(245, 158, 11, 0.3)",transition:"all 0.2s ease"},onMouseEnter:z=>{z.currentTarget.style.transform="scale(1.02)"},onMouseLeave:z=>{z.currentTarget.style.transform="scale(1)"},children:[T.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:T.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Resume"]})]}),T.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.length===0&&!o?T.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"32px 16px",color:"rgba(255, 255, 255, 0.4)"},children:[T.jsx("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{marginBottom:"12px",opacity:.5},children:T.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),T.jsx("div",{style:{fontSize:"13px",fontWeight:"500",marginBottom:"6px"},children:"No messages yet"}),T.jsx("div",{style:{fontSize:"12px",lineHeight:"1.5"},children:v?"Type a message to begin your conversation":"Start speaking to begin your conversation"})]}):T.jsxs(T.Fragment,{children:[i.map(z=>T.jsx(Sv,{message:z},z.id)),o&&s&&T.jsx(Sv,{message:{id:"current",role:s,content:o,timestamp:Date.now(),isPartial:!0}})]}),T.jsx("div",{ref:L})]}),T.jsx("div",{style:{padding:"10px 16px 14px 16px",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},children:T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"rgba(255, 255, 255, 0.04)",borderRadius:"12px",border:`1px solid ${!v&&!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.2)":"rgba(255, 255, 255, 0.06)"}`},children:[T.jsx("button",{onClick:v?k:h,disabled:!n,"aria-label":v&&w?"Microphone access was denied. Allow microphone in browser settings to switch to voice mode.":v?"Switch to voice mode":r?"Mute microphone":"Unmute microphone",title:v&&w?"Microphone access was denied. Allow microphone in browser settings to switch to voice mode.":void 0,style:{width:"32px",height:"32px",borderRadius:"8px",border:!v&&!r&&n&&e!=="speaking"?"1px solid rgba(239, 68, 68, 0.3)":"none",background:v?"transparent":!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.15)":r&&n?`${q()}15`:"transparent",color:v?"rgba(255, 255, 255, 0.5)":!r&&n&&e!=="speaking"?"#ef4444":n?"rgba(255, 255, 255, 0.8)":"rgba(255, 255, 255, 0.3)",cursor:n?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:n?1:.5,flexShrink:0},children:v?T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),T.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),T.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),T.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}):r?T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),T.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),T.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),T.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}):T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),T.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),T.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"}),T.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),T.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}),T.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",gap:"8px",minWidth:0,position:"relative"},children:v?T.jsx("input",{ref:A,type:"text",placeholder:V?"Not connected...":"Type a message...",value:U,disabled:V,onChange:z=>K(z.target.value),onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),X())},style:{flex:1,padding:"6px 10px",borderRadius:"8px",border:"none",background:"transparent",color:V?"rgba(255, 255, 255, 0.3)":"rgba(255, 255, 255, 0.9)",fontSize:"13px",outline:"none",caretColor:"#60a5fa",fontFamily:"inherit",width:"100%",minWidth:0,cursor:V?"not-allowed":"text"}}):T.jsx(T.Fragment,{children:n&&r&&(e==="speaking"||e==="listening")?T.jsx(Jx,{isActive:l,color:q(),height:22,barCount:7,audioLevels:c}):e==="connecting"&&S?T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[T.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(251, 191, 36, 0.2)",borderTopColor:"#fbbf24",borderRadius:"50%",animation:"spin 0.8s linear infinite",flexShrink:0}}),T.jsx("span",{style:{fontSize:"12px",color:"#fbbf24",fontWeight:"500"},children:S.message})]}):T.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[!r&&n&&e!=="speaking"&&T.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"}),T.jsx("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}),T.jsx("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"})]}),T.jsx("span",{style:{fontSize:"12px",fontWeight:"500",color:!r&&n&&e!=="speaking"?"#ef4444":"rgba(255, 255, 255, 0.5)",letterSpacing:"0.01em"},children:B()})]})})}),v?T.jsx("button",{onClick:X,disabled:!U.trim(),"aria-label":"Send message",onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:U.trim()?j?"#2563eb":"#3b82f6":"transparent",color:U.trim()?"white":"rgba(255, 255, 255, 0.3)",cursor:U.trim()?"pointer":"default",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0,outline:"none"},children:T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),T.jsx("polyline",{points:"5 12 12 5 19 12"})]})}):T.jsxs(T.Fragment,{children:[n&&T.jsx("button",{onClick:k,"aria-label":"Switch to text mode",onMouseEnter:()=>Q(!0),onMouseLeave:()=>Q(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:"transparent",color:ie?"rgba(255, 255, 255, 0.7)":"rgba(255, 255, 255, 0.4)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0,outline:"none",padding:0},children:T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",ry:"2"}),T.jsx("line",{x1:"6",y1:"8",x2:"6",y2:"8"}),T.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"8"}),T.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"8"}),T.jsx("line",{x1:"18",y1:"8",x2:"18",y2:"8"}),T.jsx("line",{x1:"6",y1:"12",x2:"6",y2:"12"}),T.jsx("line",{x1:"10",y1:"12",x2:"10",y2:"12"}),T.jsx("line",{x1:"14",y1:"12",x2:"14",y2:"12"}),T.jsx("line",{x1:"18",y1:"12",x2:"18",y2:"12"}),T.jsx("line",{x1:"8",y1:"16",x2:"16",y2:"16"})]})}),n&&T.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"#34d399",boxShadow:"0 0 8px #34d39980",animation:"pulse 2s ease-in-out infinite",flexShrink:0}})]})]})}),T.jsx("style",{children:`
403
403
  @keyframes pulse {
404
404
  0%, 100% { opacity: 1; }
405
405
  50% { opacity: 0.5; }
@@ -421,12 +421,12 @@ Error generating stack: `+o.message+`
421
421
  input[placeholder="Not connected..."]::placeholder {
422
422
  color: rgba(255, 255, 255, 0.3);
423
423
  }
424
- `})]})})},Fo=({onClick:t,disabled:e=!1,active:n=!1,activeColor:r="#60a5fa",tooltip:i,ariaLabel:o,children:s})=>{const[a,l]=oe.useState(!1),c=()=>n?`${r}18`:a&&!e?"rgba(255, 255, 255, 0.08)":"transparent",d=()=>n?r:e?"rgba(255, 255, 255, 0.25)":"rgba(255, 255, 255, 0.6)";return E.jsxs("div",{style:{position:"relative"},children:[E.jsx("button",{onClick:t,disabled:e,"aria-label":o,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:c(),color:d(),cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:e?.5:1},children:s}),i&&a&&!e&&E.jsx("div",{style:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"6px",padding:"4px 8px",background:"rgba(0, 0, 0, 0.9)",borderRadius:"5px",fontSize:"10px",fontWeight:"500",color:"rgba(255, 255, 255, 0.9)",whiteSpace:"nowrap",pointerEvents:"none",animation:"tooltipFade 0.15s ease",zIndex:10},children:i}),E.jsx("style",{children:`
424
+ `})]})})},Fo=({onClick:t,disabled:e=!1,active:n=!1,activeColor:r="#60a5fa",tooltip:i,ariaLabel:o,children:s})=>{const[a,l]=se.useState(!1),c=()=>n?`${r}18`:a&&!e?"rgba(255, 255, 255, 0.08)":"transparent",d=()=>n?r:e?"rgba(255, 255, 255, 0.25)":"rgba(255, 255, 255, 0.6)";return T.jsxs("div",{style:{position:"relative"},children:[T.jsx("button",{onClick:t,disabled:e,"aria-label":o,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:c(),color:d(),cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",outline:"none",opacity:e?.5:1},children:s}),i&&a&&!e&&T.jsx("div",{style:{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"6px",padding:"4px 8px",background:"rgba(0, 0, 0, 0.9)",borderRadius:"5px",fontSize:"10px",fontWeight:"500",color:"rgba(255, 255, 255, 0.9)",whiteSpace:"nowrap",pointerEvents:"none",animation:"tooltipFade 0.15s ease",zIndex:10},children:i}),T.jsx("style",{children:`
425
425
  @keyframes tooltipFade {
426
426
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
427
427
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
428
428
  }
429
- `})]})},wv=({message:t})=>{const e=t.role==="user";return E.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:e?"flex-end":"flex-start",animation:"messageSlide 0.3s ease-out"},children:[E.jsx("div",{style:{fontSize:"10px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",color:"rgba(255, 255, 255, 0.4)",marginBottom:"5px",paddingLeft:e?"0":"10px",paddingRight:e?"10px":"0"},children:e?"You":"Assistant"}),E.jsxs("div",{style:{maxWidth:"90%",padding:"10px 14px",borderRadius:e?"14px 14px 4px 14px":"14px 14px 14px 4px",background:e?"linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)":"rgba(255, 255, 255, 0.08)",color:e?"white":"rgba(255, 255, 255, 0.9)",fontSize:"13px",lineHeight:"1.5",boxShadow:e?"0 4px 12px rgba(59, 130, 246, 0.3)":"0 2px 8px rgba(0, 0, 0, 0.2)",opacity:t.isPartial?.7:1,border:e?"none":"1px solid rgba(255, 255, 255, 0.06)"},children:[t.content,t.isPartial&&E.jsx("span",{style:{display:"inline-block",width:"4px",height:"14px",background:"currentColor",marginLeft:"4px",animation:"blink 1s step-end infinite",verticalAlign:"text-bottom"}})]}),!t.isPartial&&E.jsx("div",{style:{fontSize:"10px",color:"rgba(255, 255, 255, 0.3)",marginTop:"3px",paddingLeft:e?"0":"10px",paddingRight:e?"10px":"0"},children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),E.jsx("style",{children:`
429
+ `})]})},Sv=({message:t})=>{const e=t.role==="user";return T.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:e?"flex-end":"flex-start",animation:"messageSlide 0.3s ease-out"},children:[T.jsx("div",{style:{fontSize:"10px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",color:"rgba(255, 255, 255, 0.4)",marginBottom:"5px",paddingLeft:e?"0":"10px",paddingRight:e?"10px":"0"},children:e?"You":"Assistant"}),T.jsxs("div",{style:{maxWidth:"90%",padding:"10px 14px",borderRadius:e?"14px 14px 4px 14px":"14px 14px 14px 4px",background:e?"linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)":"rgba(255, 255, 255, 0.08)",color:e?"white":"rgba(255, 255, 255, 0.9)",fontSize:"13px",lineHeight:"1.5",boxShadow:e?"0 4px 12px rgba(59, 130, 246, 0.3)":"0 2px 8px rgba(0, 0, 0, 0.2)",opacity:t.isPartial?.7:1,border:e?"none":"1px solid rgba(255, 255, 255, 0.06)"},children:[t.content,t.isPartial&&T.jsx("span",{style:{display:"inline-block",width:"4px",height:"14px",background:"currentColor",marginLeft:"4px",animation:"blink 1s step-end infinite",verticalAlign:"text-bottom"}})]}),!t.isPartial&&T.jsx("div",{style:{fontSize:"10px",color:"rgba(255, 255, 255, 0.3)",marginTop:"3px",paddingLeft:e?"0":"10px",paddingRight:e?"10px":"0"},children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),T.jsx("style",{children:`
430
430
  @keyframes messageSlide {
431
431
  from { opacity: 0; transform: translateY(8px); }
432
432
  to { opacity: 1; transform: translateY(0); }
@@ -435,7 +435,7 @@ Error generating stack: `+o.message+`
435
435
  0%, 100% { opacity: 1; }
436
436
  50% { opacity: 0; }
437
437
  }
438
- `})]})},Qx=({connected:t,voiceEnabled:e,agentState:n,botTranscript:r="",userTranscript:i="",screenShareEnabled:o=!1,userIsSpeaking:s=!1,botIsSpeaking:a=!1,audioLevels:l=[],onToggleConnection:c,onToggleMute:d,onToggleScreenShare:h,transcriptHistory:f=[],onResume:v,pausedSessionId:b,onStop:g,connectionProgress:S,isReturningUser:m=!1,hasSkippedOnboarding:w=!1,onMinimize:k,onExpand:C,textModeEnabled:M=!1,micPermissionDenied:P=!1,onToggleTextMode:L,onSendText:F,nudgeText:Y,showNudge:W,onNudgeDismiss:H,nudgeAutoHideDelay:Q,nudgeAutoShow:q,planProgress:ae})=>{const[J,K]=oe.useState(!m&&!w);oe.useEffect(()=>{(m||w)&&!t&&K(!1)},[m,w,t]),oe.useEffect(()=>{t&&K(!0)},[t]),oe.useEffect(()=>{de.log("[AgentUI] Rendering with state:",{connected:t,agentState:n,voiceEnabled:e,screenShareEnabled:o,panelOpen:J,historyCount:f.length,botTranscript:r==null?void 0:r.substring(0,30),userTranscript:i==null?void 0:i.substring(0,30)})},[t,n,e,o,J,f.length,r,i]);const{currentTranscript:re,currentRole:j}=oe.useMemo(()=>n==="speaking"&&r?{currentTranscript:r,currentRole:"assistant"}:n==="listening"&&i?{currentTranscript:i,currentRole:"user"}:{currentTranscript:"",currentRole:void 0},[n,r,i]),z=oe.useCallback(()=>{K(!0),C==null||C()},[C]),B=oe.useCallback(()=>{K(!1),k==null||k()},[k]);return E.jsxs(E.Fragment,{children:[!J&&E.jsx(qx,{connected:t,agentState:n,onExpand:z,onToggleConnection:c,isReturningUser:m,hasSkippedOnboarding:w,nudgeText:Y,showNudge:W,onNudgeDismiss:H,nudgeAutoHideDelay:Q,nudgeAutoShow:q}),E.jsx(Gx,{isOpen:J,agentState:n,connected:t,voiceEnabled:e,messages:f,currentTranscript:re,currentRole:j,screenShareEnabled:o,isSpeaking:s||a,audioLevels:l,onToggleConnection:c,onToggleMute:d,onToggleScreenShare:h,onMinimize:B,onResume:v,onStop:g,connectionProgress:S,textModeEnabled:M,micPermissionDenied:P,onToggleTextMode:L,onSendText:F,planProgress:ae}),E.jsx("style",{children:`
438
+ `})]})},Qx=({connected:t,voiceEnabled:e,agentState:n,botTranscript:r="",userTranscript:i="",screenShareEnabled:o=!1,userIsSpeaking:s=!1,botIsSpeaking:a=!1,audioLevels:l=[],onToggleConnection:c,onToggleMute:d,onToggleScreenShare:h,transcriptHistory:f=[],onResume:g,pausedSessionId:y,onStop:m,connectionProgress:S,isReturningUser:v=!1,hasSkippedOnboarding:w=!1,onMinimize:k,onExpand:C,textModeEnabled:E=!1,micPermissionDenied:L=!1,onToggleTextMode:A,onSendText:R,nudgeText:G,showNudge:U,onNudgeDismiss:K,nudgeAutoHideDelay:j,nudgeAutoShow:H,planProgress:ie})=>{const[Q,V]=se.useState(!v&&!w);se.useEffect(()=>{(v||w)&&!t&&V(!1)},[v,w,t]),se.useEffect(()=>{t&&V(!0)},[t]),se.useEffect(()=>{de.log("[AgentUI] Rendering with state:",{connected:t,agentState:n,voiceEnabled:e,screenShareEnabled:o,panelOpen:Q,historyCount:f.length,botTranscript:r==null?void 0:r.substring(0,30),userTranscript:i==null?void 0:i.substring(0,30)})},[t,n,e,o,Q,f.length,r,i]);const{currentTranscript:X,currentRole:B}=se.useMemo(()=>n==="speaking"&&r?{currentTranscript:r,currentRole:"assistant"}:n==="listening"&&i?{currentTranscript:i,currentRole:"user"}:{currentTranscript:"",currentRole:void 0},[n,r,i]),q=se.useCallback(()=>{V(!0),C==null||C()},[C]),z=se.useCallback(()=>{V(!1),k==null||k()},[k]);return T.jsxs(T.Fragment,{children:[!Q&&T.jsx(qx,{connected:t,agentState:n,onExpand:q,onToggleConnection:c,isReturningUser:v,hasSkippedOnboarding:w,nudgeText:G,showNudge:U,onNudgeDismiss:K,nudgeAutoHideDelay:j,nudgeAutoShow:H}),T.jsx(Gx,{isOpen:Q,agentState:n,connected:t,voiceEnabled:e,messages:f,currentTranscript:X,currentRole:B,screenShareEnabled:o,isSpeaking:s||a,audioLevels:l,onToggleConnection:c,onToggleMute:d,onToggleScreenShare:h,onMinimize:z,onResume:g,onStop:m,connectionProgress:S,textModeEnabled:E,micPermissionDenied:L,onToggleTextMode:A,onSendText:R,planProgress:ie}),T.jsx("style",{children:`
439
439
  /* Smooth scrollbar for sidebar */
440
440
  #onboarding-sdk-react-ui *::-webkit-scrollbar {
441
441
  width: 6px;
@@ -450,32 +450,42 @@ Error generating stack: `+o.message+`
450
450
  #onboarding-sdk-react-ui *::-webkit-scrollbar-thumb:hover {
451
451
  background: rgba(255, 255, 255, 0.2);
452
452
  }
453
- `})]})};let jo=null,Sv=0;function Yx(){jo=null}function kv(){if(jo&&Date.now()-Sv<500)return jo;const t=document.querySelectorAll('[aria-modal="true"]:not([aria-hidden="true"]), [role="dialog"]:not([aria-hidden="true"]), dialog[open]');return jo=Array.from(t).filter(e=>{const n=window.getComputedStyle(e);return n.display!=="none"&&n.visibility!=="hidden"}),Sv=Date.now(),jo}const Xx=[".cdk-overlay-container",".cdk-overlay-pane",".ant-select-dropdown:not(.ant-select-dropdown-hidden)",".ant-dropdown:not(.ant-dropdown-hidden)",".ant-popover:not(.ant-popover-hidden)",".ant-picker-dropdown",".ant-cascader-dropdown",".ant-tree-select-dropdown",'[role="listbox"]:not([aria-hidden="true"])','[role="menu"]:not([aria-hidden="true"])','[role="tree"]:not([aria-hidden="true"])','[class*="MenuList"]','[class*="menu"][class*="--is-open"]',"[data-radix-popper-content-wrapper]",'[data-headlessui-state*="open"]',".MuiPopper-root",".MuiPopover-root",".MuiMenu-root",".MuiAutocomplete-popper",'[class*="popover"]:not([aria-hidden="true"])','[class*="Popover"]:not([aria-hidden="true"])'];let Wa=null,xv=0;function _v(){if(Wa&&Date.now()-xv<300)return Wa;const t=[],e=new Set;for(const n of Xx)try{const r=Array.from(document.querySelectorAll(n));for(const i of r){if(e.has(i))continue;const o=i;try{const s=window.getComputedStyle(o);if(s.display==="none"||s.visibility==="hidden")continue;const a=o.getBoundingClientRect();a.width>5&&a.height>5&&(t.push(i),e.add(i))}catch{}}}catch{}return Wa=t,xv=Date.now(),Wa}function Cv(t){return _v().some(n=>n.contains(t))}function Cd(t){const e=kv();if(e.length===0)return!0;const n=e.some(i=>i.contains(t)),r=e.some(i=>t.contains(i));return!!(n||r||Cv(t))}function Zx(t){return t.getAttribute("aria-hidden")==="true"||!!t.closest('[aria-hidden="true"]')}function qa(t){const e=t.closest("details:not([open])");if(!e||t===e)return!1;const n=e.querySelector(":scope > summary");return!(n!=null&&n.contains(t))&&t!==n}function Ja(t,e=10){let n=t.parentElement,r=0;for(;n&&r<e;){if(n.getAttribute("aria-expanded")==="false"){const i=n.nextElementSibling;if(i&&i.contains(t))return!0;const o=n.querySelector('[role="tabpanel"], [role="region"], .panel, .accordion-content, .collapse:not(.show)');if(o&&o.contains(t))return!0}n=n.parentElement,r++}return!1}function Ev(t,e=!0){if(t.disabled||t.getAttribute("aria-disabled")==="true"||!Cd(t))return!1;try{if(window.getComputedStyle(t).pointerEvents==="none")return!1}catch{}if(e)try{const n=t.getBoundingClientRect();if(n.width>0&&n.height>0){const r=n.left+n.width/2,i=n.top+n.height/2;if(r>=0&&r<=window.innerWidth&&i>=0&&i<=window.innerHeight){const o=document.elementFromPoint(r,i);if(o&&o!==t&&!t.contains(o)&&!o.contains(t))return!1}}}catch{}return!0}const yt=class yt{constructor(e=de){D(this,"logger");D(this,"refCounters",{});D(this,"lastSnapshotHash","");this.logger=e}capture(e){this.refCounters={};const n=[],r={width:window.innerWidth,height:window.innerHeight};try{const s=this.queryInteractiveElements(),a=this.queryCursorPointerElements(),l=this.queryOverlayElements(),c=this.dedupeElements([...s,...a,...l]);for(const d of c)try{const h=this.processElement(d,r);h&&n.push(h)}catch(h){this.logger.warn("[AccessibleSnapshot] Error processing element:",h)}n.sort((d,h)=>{const f=d.rect.y-h.rect.y;return Math.abs(f)<20?d.rect.x-h.rect.x:f}),this.renumberRefs(n)}catch(s){this.logger.error("[AccessibleSnapshot] Error during capture:",s)}const i=this.computeSnapshotHash(n),o=i!==this.lastSnapshotHash;return this.lastSnapshotHash=i,{timestamp:Date.now(),url:window.location.pathname,title:document.title,viewport:r,elements:n,elementCount:n.length,domChanged:o,captureReason:e}}async captureWhenStable(e=2e3,n){const r=Date.now();let i=this.capture(n);for(;Date.now()-r<e;){await this.sleep(200);const o=this.capture(n);if(this.snapshotsAreEqual(i,o))return o;i=o}return i}queryInteractiveElements(){return Array.from(document.querySelectorAll(yt.INTERACTIVE_SELECTOR)).filter(n=>this.shouldIncludeElement(n))}queryOverlayElements(){const e=_v();if(e.length===0)return[];const n=[],r=new Set,i=['[role="option"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="treeitem"]','[role="listbox"]','[role="menu"]','[role="button"]','[role="link"]','[role="checkbox"]','[role="radio"]','[role="switch"]','[role="tab"]','[role="combobox"]','[role="searchbox"]','[role="textbox"]',"button","a[href]",'input:not([type="hidden"])',"select","textarea","li","nz-option-item",".ant-select-item-option",".ant-select-item",".ant-dropdown-menu-item",".ant-cascader-menu-item",'[class*="option"]:not([class*="singleValue"]):not([class*="placeholder"])','[class*="Option"]:not([class*="singleValue"]):not([class*="placeholder"])','[class*="menu-item"]','[class*="MenuItem"]'].join(", ");for(const o of e)try{const s=Array.from(o.querySelectorAll(i));for(const a of s){const l=a;if(r.has(l))continue;r.add(l);const c=l.getBoundingClientRect();if(c.width<=0||c.height<=0)continue;try{const h=window.getComputedStyle(l);if(h.display==="none"||h.visibility==="hidden")continue}catch{continue}let d=!1;for(const h of yt.SKIP_SELECTORS)if(l.matches(h)||l.closest(h)){d=!0;break}d||n.push(l)}}catch{}return this.logger.log(`[AccessibleSnapshot] Found ${n.length} overlay elements from ${e.length} active overlays`),n}queryCursorPointerElements(){const e=['[class*="card"]:not(button):not(a)','[class*="Card"]:not(button):not(a)','[class*="tile"]:not(button):not(a)','[class*="Tile"]:not(button):not(a)','[class*="option"]:not(button):not(a)','[class*="Option"]:not(button):not(a)','[class*="clickable"]','[class*="Clickable"]','[class*="selectable"]','[class*="Selectable"]',"[data-clickable]","[data-action]","[data-onclick]",'li[class*="item"]','li[class*="Item"]','div[class*="cursor-pointer"]','div[class*="pointer"]'].join(", "),n=[];try{const o=Array.from(document.querySelectorAll(e));n.push(...o)}catch{}const r=document.querySelectorAll('main, [role="main"], #app, #root, .app, .main');for(const o of r){const s=Array.from(o.querySelectorAll(":scope > div, :scope > section > div"));n.push(...s.slice(0,50))}const i=new Set;return n.filter(o=>{if(i.has(o)||(i.add(o),!this.shouldIncludeElement(o))||window.getComputedStyle(o).cursor!=="pointer")return!1;const a=o.parentElement;return!(a&&window.getComputedStyle(a).cursor==="pointer"&&!o.onclick&&!o.getAttribute("onclick")&&!o.getAttribute("role"))})}shouldIncludeElement(e){for(const a of yt.SKIP_SELECTORS)if(e.matches(a)||e.closest(a))return!1;if(Cv(e)){try{const a=window.getComputedStyle(e);if(a.display==="none"||a.visibility==="hidden")return!1}catch{}return!0}if(e.getAttribute("aria-hidden")==="true"||!!e.closest('[aria-hidden="true"]')){const a=kv();if(!(a.length>0&&!a.some(c=>c.contains(e))))return!1}const i=e.getAttribute("role");if(i==="presentation"||i==="none")return!1;if(!this.isVisible(e)){const a=qa(e),l=Ja(e,8);if(!a&&!l)return!1}const o=e.getBoundingClientRect();if(o.bottom<0||o.top>window.innerHeight||o.right<0||o.left>window.innerWidth||o.width<=0||o.height<=0){const a=qa(e),l=Ja(e,8);if(!a&&!l)return!1}return!0}isVisible(e){if(e.offsetParent===null){const n=window.getComputedStyle(e);if(n.position!=="fixed"&&(n.display==="none"||n.visibility==="hidden"))return!1}try{const n=window.getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"||n.opacity==="0")return!1;let r=e.parentElement,i=0;const o=10;for(;r&&r!==document.body&&i<o;){const s=window.getComputedStyle(r);if(s.display==="none"||s.visibility==="hidden")return!1;r=r.parentElement,i++}return!0}catch{return!0}}dedupeElements(e){const n=new Set,r=[],i=new Map,o=new Map,s=new Map,a=h=>(i.has(h)||i.set(h,this.getElementDepth(h)),i.get(h)),l=h=>(o.has(h)||o.set(h,this.getRole(h)),o.get(h)),c=h=>(s.has(h)||s.set(h,this.computeAccessibleName(h)),s.get(h)),d=[...e].sort((h,f)=>a(f)-a(h));for(const h of d){if(n.has(h))continue;let f=!1;for(const v of r)if(h.contains(v)&&h!==v){const b=l(h),g=l(v);if(b==="card"||b==="listitem"||b==="option"){if(!c(h)){f=!0;break}}else if(b===g){f=!0;break}}if(!f){for(const v of r)if(v.contains(h)&&v!==h){const b=c(h),g=c(v);if(!b||b===g){f=!0;break}}}f||(n.add(h),r.push(h))}return r}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}getBlockedReason(e){return Cd(e)?qa(e)?"collapsed-details":Ja(e,8)?"collapsed-accordion":null:"modal"}processElement(e,n){const r=e.getBoundingClientRect(),i=this.computeAccessibleName(e);let o=this.getRole(e);if((!o||o==="element")&&this.looksLikeCard(e)&&(o="card"),!i&&(!o||o==="element"))return null;const s=this.getState(e),a=this.findContext(e),l=this.getRowContext(e),c=this.generateRef(o||"element");let d;if(e instanceof HTMLInputElement&&e.value)d=e.value;else if(e instanceof HTMLTextAreaElement&&e.value)d=e.value;else if(e instanceof HTMLSelectElement&&e.selectedIndex>=0){const v=e.options[e.selectedIndex];v&&(d=v.text)}const h=this.getBlockedReason(e),f=h?!1:Ev(e,!0);return{ref:c,role:o||"element",name:i||this.generateFallbackName(e,o),...Object.keys(s).length&&{state:s},...d&&{value:d},...a&&{context:a},...l&&{rowContext:l},rect:{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)},selector:this.generateSelector(e),tag:e.tagName.toLowerCase(),interactable:f,...h&&{hiddenBy:h}}}computeAccessibleName(e){var h,f,v,b,g,S;const n=e.getAttribute("aria-labelledby");if(n){const m=n.split(/\s+/).map(w=>{var k,C;return(C=(k=document.getElementById(w))==null?void 0:k.textContent)==null?void 0:C.trim()}).filter(Boolean);if(m.length)return m.join(" ").slice(0,100)}const r=(h=e.getAttribute("aria-label"))==null?void 0:h.trim();if(r)return r.slice(0,100);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){const m=this.getInputLabel(e);if(m)return m;if("placeholder"in e&&e.placeholder)return e.placeholder.slice(0,100)}if(e instanceof HTMLImageElement&&e.alt)return e.alt.slice(0,100);const i=(f=e.getAttribute("title"))==null?void 0:f.trim();if(i)return i.slice(0,100);const o=this.getDirectTextContent(e);if(o)return o;const s=this.findSiblingLabel(e);if(s)return s;const a=e.querySelector("svg");if(a){const m=(b=(v=a.querySelector("title"))==null?void 0:v.textContent)==null?void 0:b.trim();if(m)return m.slice(0,100);const w=(S=(g=a.querySelector("desc"))==null?void 0:g.textContent)==null?void 0:S.trim();if(w)return w.slice(0,100)}const l=e.getAttribute("data-tooltip")||e.getAttribute("data-tip")||e.getAttribute("data-original-title");if(l)return l.slice(0,100);const c=e.getAttribute("data-testid");if(c)return c.replace(/[-_]/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").slice(0,100);const d=this.extractIconName(e);return d||""}getInputLabel(e){var i,o,s;if(e.id){const a=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(a){const l=(i=a.textContent)==null?void 0:i.trim();if(l)return l.slice(0,100)}}const n=e.closest("label");if(n){const a=n.cloneNode(!0);a.querySelectorAll("input, select, textarea").forEach(c=>c.remove());const l=(o=a.textContent)==null?void 0:o.trim();if(l)return l.slice(0,100)}const r=e.getAttribute("aria-describedby");if(r){const a=document.getElementById(r);if(a){const l=(s=a.textContent)==null?void 0:s.trim();if(l)return l.slice(0,100)}}return""}getDirectTextContent(e){var r,i;let n="";for(const o of e.childNodes)o.nodeType===Node.TEXT_NODE&&(n+=(o.textContent||"")+" ");if(n=n.trim(),!n){const o=[":scope > span",":scope > strong",":scope > em",":scope > b",":scope > label",":scope > .MuiButton-label",":scope > .ant-btn-content",':scope > [class*="label"]',':scope > [class*="text"]'];for(const s of o)try{const a=e.querySelector(s);if(a&&a.children.length===0){const l=(r=a.textContent)==null?void 0:r.trim();if(l){n=l;break}}}catch{}}if(!n&&e.innerText){const o=e.innerText.trim().split(`
454
- `);n=((i=o[0])==null?void 0:i.trim())||"",o.length>1&&o.length<=3&&(n=o.join(" - ").slice(0,100))}return n.slice(0,100)}extractIconName(e){var s;const r=e.querySelector('[class*="icon"], [class*="Icon"], svg, i')||e,i=typeof r.className=="string"?r.className:"",o=[/fa-([a-z-]+)/i,/fas? fa-([a-z-]+)/i,/far? fa-([a-z-]+)/i,/icon-([a-z-]+)/i,/([a-z]+)-icon/i,/material-icons/i,/lucide-([a-z-]+)/i,/heroicon-([a-z-]+)/i,/ri-([a-z-]+)/i,/bi-([a-z-]+)/i,/bx-([a-z-]+)/i,/bxs-([a-z-]+)/i,/ph-([a-z-]+)/i,/tabler-([a-z-]+)/i,/mdi-([a-z-]+)/i];for(const a of o){const l=i.match(a);if(l&&l[1])return l[1].replace(/-/g," ").replace(/([a-z])([A-Z])/g,"$1 $2")}if(i.includes("material-icons")||i.includes("material-symbols")){const a=(s=r.textContent)==null?void 0:s.trim();if(a&&a.length<30)return a.replace(/_/g," ")}return""}findSiblingLabel(e){var i,o;let n=e.previousElementSibling;for(;n;){if(n.matches('label, .label, [class*="label"], [class*="Label"]')){const s=(i=n.textContent)==null?void 0:i.trim();if(s&&s.length<50)return s}n=n.previousElementSibling}const r=e.parentElement;if(r){const s=r.querySelector(':scope > label, :scope > .label, :scope > [class*="FormLabel"]');if(s&&!s.contains(e)){const a=(o=s.textContent)==null?void 0:o.trim();if(a&&a.length<50)return a}}return""}generateFallbackName(e,n){const r=e.tagName.toLowerCase(),i=this.getSiblingIndex(e),o=this.getParentContext(e),s=[];return s.push(n||r),i>0&&s.push(`${i+1}`),o&&s.push(`in ${o}`),s.join(" ")}getSiblingIndex(e){const n=e.parentElement;return n?Array.from(n.children).filter(i=>i.tagName===e.tagName).indexOf(e):0}getParentContext(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=n.getAttribute("aria-label")||n.getAttribute("title")||(n.matches("nav, main, header, footer, aside, section, article")?n.tagName.toLowerCase():null);if(r)return r.slice(0,30);n=n.parentElement}return""}getRole(e){const n=e.getAttribute("role");if(n)return n;const r=e.tagName.toLowerCase();if(r==="input"){const i=e.type||"text";return yt.INPUT_TYPE_ROLES[i]||"textbox"}return r==="a"?e.hasAttribute("href")?"link":"":yt.IMPLICIT_ROLES[r]||""}looksLikeCard(e){const n=typeof e.className=="string"?e.className.toLowerCase():"";if(n.includes("card")||n.includes("tile")||n.includes("option")||n.includes("selection"))return!0;const r=window.getComputedStyle(e),o=!(r.borderWidth||"0").split(" ").every(c=>c==="0px"||c==="0")&&r.borderStyle!=="none",s=r.borderRadius||"0",a=parseFloat(s)>0;r.backgroundColor!=="rgba(0, 0, 0, 0)"&&r.backgroundColor;const l=e.getBoundingClientRect();return!!(o&&a&&l.height>50&&l.width>100)}getState(e){const n={};e.getAttribute("aria-selected")==="true"&&(n.selected=!0);const r=e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio");(e.getAttribute("aria-checked")==="true"||r&&e.checked)&&(n.checked=!0),e.getAttribute("aria-expanded")==="true"&&(n.expanded=!0),e instanceof HTMLDetailsElement&&e.open&&(n.expanded=!0),e.getAttribute("aria-pressed")==="true"&&(n.pressed=!0);const i=e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement;(e.getAttribute("aria-disabled")==="true"||i&&e.disabled||e.hasAttribute("disabled"))&&(n.disabled=!0),(e.getAttribute("aria-current")==="true"||e.getAttribute("aria-current")==="page")&&(n.current=!0),!n.selected&&this.detectVisualSelection(e)&&(n.selected=!0);const o=typeof e.className=="string"?e.className.toLowerCase():"";!n.selected&&(o.includes("selected")||o.includes("active")||o.includes("chosen")||o.includes("current"))&&(n.selected=!0),!n.disabled&&o.includes("disabled")&&(n.disabled=!0);const s=e.getAttribute("data-state");return(s==="checked"||s==="on")&&(n.checked=!0),(s==="open"||s==="expanded")&&(n.expanded=!0),(s==="active"||s==="selected")&&(n.selected=!0),n}detectVisualSelection(e){const n=window.getComputedStyle(e),r=n.borderColor.toLowerCase();if(r.includes("rgb(8, 103, 236)")||r.includes("rgb(59, 130, 246)")||r.includes("rgb(37, 99, 235)")||r.includes("rgb(29, 78, 216)"))return!0;const i=n.backgroundColor.toLowerCase();return!!(i.includes("rgb(238, 245, 252)")||i.includes("rgb(239, 246, 255)")||i.includes("rgb(219, 234, 254)"))}findContext(e){var l,c,d,h,f,v,b,g;const n=e.getAttribute("aria-describedby");if(n){const S=document.getElementById(n);if(S)return((l=S.textContent)==null?void 0:l.trim().slice(0,50))||null}const r=e.closest("fieldset");if(r){const S=r.querySelector("legend");if(S)return((c=S.textContent)==null?void 0:c.trim().slice(0,50))||null}const i=e.closest('[class*="form-group"], [class*="FormGroup"], [class*="field"]');if(i){const S=i.querySelector(":scope > label, :scope > .label");if(S&&!S.contains(e))return((d=S.textContent)==null?void 0:d.trim().slice(0,50))||null}const o=e.closest('section, [role="region"], form, [class*="section"], [class*="Section"]');if(o){const S=o.querySelector(':scope > h1, :scope > h2, :scope > h3, :scope > h4, :scope > h5, :scope > h6, :scope > [role="heading"]');if(S)return((h=S.textContent)==null?void 0:h.trim().slice(0,50))||null;const m=o.querySelector(':scope > [class*="title"], :scope > [class*="Title"], :scope > [class*="header"] > *');if(m)return((f=m.textContent)==null?void 0:f.trim().slice(0,50))||null}const s=e.previousElementSibling;if(s&&s.matches('p, label, h1, h2, h3, h4, h5, h6, [class*="label"], [class*="Label"]')){const S=(v=s.textContent)==null?void 0:v.trim();if(S&&S.length<50)return S}const a=(b=e.parentElement)==null?void 0:b.previousElementSibling;if(a&&a.matches('p, label, [class*="label"], [class*="Label"]')){const S=(g=a.textContent)==null?void 0:g.trim();if(S&&S.length<50)return S}return null}getRowContext(e){var o,s,a;const n=e.closest('tr, [role="row"]');if(n){const l=n.querySelector('td:first-child, th:first-child, [role="cell"]:first-child');if(l&&!l.contains(e)){const c=(o=l.textContent)==null?void 0:o.trim();if(c)return c.slice(0,40)}}const r=e.closest('li, [role="listitem"]');if(r){const l=r.querySelector('.name, .title, [class*="name"], [class*="title"], [class*="Name"]');if(l&&!l.contains(e)){const c=(s=l.textContent)==null?void 0:s.trim();if(c)return c.slice(0,40)}}const i=['[class*="data-row"]','[class*="DataRow"]','[class*="list-item"]','[class*="ListItem"]','[class*="table-row"]','[class*="TableRow"]','.row[class*="item"]','.Row[class*="Item"]'];for(const l of i)try{const c=e.closest(l);if(c&&!c.matches("tr")){const d=c.querySelector('[class*="name"], [class*="title"], [class*="-id"]');if(d&&!d.contains(e)){const h=(a=d.textContent)==null?void 0:a.trim();if(h&&h.length<40)return h}}}catch{}return null}generateRef(e){const n=yt.ROLE_PREFIXES[e]||"E";return this.refCounters[n]=(this.refCounters[n]||0)+1,`${n}${this.refCounters[n]}`}renumberRefs(e){const n={};for(const r of e){const i=yt.ROLE_PREFIXES[r.role]||"E";n[i]=(n[i]||0)+1,r.ref=`${i}${n[i]}`}}generateSelector(e){try{if(e.id){const o=`#${CSS.escape(e.id)}`;if(document.querySelector(o)===e)return o}const n=e.getAttribute("data-testid");if(n){const o=`[data-testid="${CSS.escape(n)}"]`;if(document.querySelector(o)===e)return o}if(e.className&&typeof e.className=="string"){const o=e.className.split(/\s+/).filter(s=>s&&!s.includes(":")&&!s.startsWith("css-"));if(o.length>0){const s=o.slice(0,3).map(a=>{try{return CSS.escape(a)}catch{return null}}).filter(Boolean);if(s.length>0){const a=`${e.tagName.toLowerCase()}.${s.join(".")}`;try{if(document.querySelectorAll(a).length===1)return a}catch{}}}}const r=[];let i=e;for(;i&&i!==document.body&&r.length<4;){let o=i.tagName.toLowerCase();if(i.id)try{const a=`#${CSS.escape(i.id)}`;if(document.querySelector(a)){r.unshift(a);break}}catch{}const s=i.parentElement;if(s){const a=Array.from(s.children).filter(l=>l.tagName===i.tagName);if(a.length>1){const l=a.indexOf(i)+1;o+=`:nth-of-type(${l})`}}r.unshift(o),i=s}return r.join(" > ")}catch{const r=e.parentElement;if(r){const o=Array.from(r.children).indexOf(e);return`${e.tagName.toLowerCase()}:nth-child(${o+1})`}return e.tagName.toLowerCase()}}computeSnapshotHash(e){const n=e.map(r=>`${r.role}:${r.name}:${r.state?JSON.stringify(r.state):""}`).join("|");return this.simpleHash(n)}simpleHash(e){let n=0;for(let r=0;r<e.length;r++){const i=e.charCodeAt(r);n=(n<<5)-n+i,n=n&n}return n.toString(36)}snapshotsAreEqual(e,n){if(e.elementCount!==n.elementCount||e.elements.length!==n.elements.length)return!1;for(let r=0;r<e.elements.length;r++){const i=e.elements[r],o=n.elements[r];if(!i||!o||i.name!==o.name||i.role!==o.role)return!1;const s=JSON.stringify(i.state||{}),a=JSON.stringify(o.state||{});if(s!==a)return!1}return!0}sleep(e){return new Promise(n=>setTimeout(n,e))}};D(yt,"IMPLICIT_ROLES",{button:"button",a:"link",input:"textbox",textarea:"textbox",select:"combobox",option:"option",img:"img",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",form:"form",table:"table",ul:"list",ol:"list",li:"listitem",article:"article",aside:"complementary",section:"region",dialog:"dialog",menu:"menu",menuitem:"menuitem",progress:"progressbar",meter:"meter"}),D(yt,"INPUT_TYPE_ROLES",{button:"button",submit:"button",reset:"button",image:"button",checkbox:"checkbox",radio:"radio",range:"slider",search:"searchbox",email:"textbox",tel:"textbox",url:"textbox",password:"textbox",text:"textbox",number:"spinbutton"}),D(yt,"ROLE_PREFIXES",{button:"B",link:"L",textbox:"T",searchbox:"T",checkbox:"X",radio:"R",combobox:"S",listbox:"S",option:"O",tab:"TAB",menuitem:"M",menu:"MENU",img:"I",card:"C",dialog:"D",slider:"SL",spinbutton:"N",switch:"SW",navigation:"NAV"}),D(yt,"INTERACTIVE_SELECTOR",`
455
- button,
456
- a[href],
457
- input:not([type="hidden"]),
458
- select,
453
+ `})]})};let jo=null,kv=0;function Yx(){jo=null}function xv(){if(jo&&Date.now()-kv<500)return jo;const t=document.querySelectorAll('[aria-modal="true"]:not([aria-hidden="true"]), [role="dialog"]:not([aria-hidden="true"]), dialog[open]');return jo=Array.from(t).filter(e=>{const n=window.getComputedStyle(e);return n.display!=="none"&&n.visibility!=="hidden"}),kv=Date.now(),jo}const Xx=[".cdk-overlay-container",".cdk-overlay-pane",".ant-select-dropdown:not(.ant-select-dropdown-hidden)",".ant-dropdown:not(.ant-dropdown-hidden)",".ant-popover:not(.ant-popover-hidden)",".ant-picker-dropdown",".ant-cascader-dropdown",".ant-tree-select-dropdown",'[role="listbox"]:not([aria-hidden="true"])','[role="menu"]:not([aria-hidden="true"])','[role="tree"]:not([aria-hidden="true"])','[class*="MenuList"]','[class*="menu"][class*="--is-open"]',"[data-radix-popper-content-wrapper]",'[data-headlessui-state*="open"]',".MuiPopper-root",".MuiPopover-root",".MuiMenu-root",".MuiAutocomplete-popper",'[class*="popover"]:not([aria-hidden="true"])','[class*="Popover"]:not([aria-hidden="true"])'];let Wa=null,_v=0;function Cv(){if(Wa&&Date.now()-_v<300)return Wa;const t=[],e=new Set;for(const n of Xx)try{const r=Array.from(document.querySelectorAll(n));for(const i of r){if(e.has(i))continue;const o=i;try{const s=window.getComputedStyle(o);if(s.display==="none"||s.visibility==="hidden")continue;const a=o.getBoundingClientRect();a.width>5&&a.height>5&&(t.push(i),e.add(i))}catch{}}}catch{}return Wa=t,_v=Date.now(),Wa}function Cd(t){return Cv().some(n=>n.contains(t))}function Ed(t){const e=xv();if(e.length===0)return!0;const n=e.some(i=>i.contains(t)),r=e.some(i=>t.contains(i));return!!(n||r||Cd(t))}function Zx(t){return t.getAttribute("aria-hidden")==="true"||!!t.closest('[aria-hidden="true"]')}function qa(t){const e=t.closest("details:not([open])");if(!e||t===e)return!1;const n=e.querySelector(":scope > summary");return!(n!=null&&n.contains(t))&&t!==n}function Ja(t,e=10){let n=t.parentElement,r=0;for(;n&&r<e;){if(n.getAttribute("aria-expanded")==="false"){const i=n.nextElementSibling;if(i&&i.contains(t))return!0;const o=n.querySelector('[role="tabpanel"], [role="region"], .panel, .accordion-content, .collapse:not(.show)');if(o&&o.contains(t))return!0}n=n.parentElement,r++}return!1}function Ev(t,e=!0){if(t.disabled||t.getAttribute("aria-disabled")==="true"||!Ed(t))return!1;try{if(window.getComputedStyle(t).pointerEvents==="none")return!1}catch{}if(e&&!Cd(t))try{const n=t.getBoundingClientRect();if(n.width>0&&n.height>0){const r=n.left+n.width/2,i=n.top+n.height/2;if(r>=0&&r<=window.innerWidth&&i>=0&&i<=window.innerHeight){const o=document.elementFromPoint(r,i);if(o&&o!==t&&!t.contains(o)&&!o.contains(t))return!1}}}catch{}return!0}const Qe=class Qe{constructor(e=de){P(this,"logger");P(this,"refCounters",{});P(this,"lastSnapshotHash","");P(this,"previousElementMap",new Map);this.logger=e}capture(e){this.refCounters={};const n=[],r={width:window.innerWidth,height:window.innerHeight};try{const s=this.queryInteractiveElements(),a=this.queryCursorPointerElements(),l=this.queryOverlayElements(),c=this.queryIframeElements(),d=this.dedupeElements([...s,...a,...l,...c]);for(const g of d)try{const y=this.processElement(g,r);y&&n.push(y)}catch(y){this.logger.warn("[AccessibleSnapshot] Error processing element:",y)}n.sort((g,y)=>{const m=g.rect.y-y.rect.y;return Math.abs(m)<20?g.rect.x-y.rect.x:m}),this.renumberRefs(n);const h=document.activeElement;if(h&&h!==document.body){for(const g of n)if(g.selector)try{const y=document.querySelector(g.selector);if(y===h||h.closest(g.selector)===y){g.focused=!0;break}}catch{}}const f=new Map;for(const g of n){const y=`${g.role}|${g.name}|${g.selector||""}`,m=g.state?Object.entries(g.state).sort().map(([v,w])=>`${v}:${w}`).join(","):"";f.set(y,{value:g.value,stateKey:m});const S=this.previousElementMap.get(y);S?(S.value!==g.value||S.stateKey!==m)&&(g.status="changed"):g.status="new"}this.previousElementMap=f}catch(s){this.logger.error("[AccessibleSnapshot] Error during capture:",s)}const i=this.computeSnapshotHash(n),o=i!==this.lastSnapshotHash;return this.lastSnapshotHash=i,{timestamp:Date.now(),url:window.location.pathname,title:document.title,viewport:r,elements:n,elementCount:n.length,domChanged:o,captureReason:e}}async captureWhenStable(e=2e3,n){const r=Date.now();let i=this.capture(n);for(;Date.now()-r<e;){await this.sleep(200);const o=this.capture(n);if(this.snapshotsAreEqual(i,o))return o;i=o}return i}queryInteractiveElements(){const e=Array.from(document.querySelectorAll(Qe.INTERACTIVE_SELECTOR));this.queryShadowRoots(document.body,e);const n=['[role="alert"]','[role="status"]','[aria-live="polite"]','[aria-live="assertive"]','[class*="toast"]:not([aria-hidden="true"])','[class*="Toast"]:not([aria-hidden="true"])','[class*="notification"]:not([aria-hidden="true"])','[class*="Notification"]:not([aria-hidden="true"])','[class*="snackbar"]:not([aria-hidden="true"])','[class*="Snackbar"]:not([aria-hidden="true"])'].join(", ");try{const r=Array.from(document.querySelectorAll(n));for(const i of r){const o=(i.textContent||"").trim();o&&o.length>0&&!e.includes(i)&&e.push(i)}}catch{}return e.filter(r=>this.shouldIncludeElement(r))}queryShadowRoots(e,n,r=0){if(r>5)return;const i=e instanceof DocumentFragment?Array.from(e.children):Array.from(e.querySelectorAll("*")),o=Math.min(i.length,500);for(let s=0;s<o;s++){const l=i[s].shadowRoot;if(l){try{const c=Array.from(l.querySelectorAll(Qe.INTERACTIVE_SELECTOR));n.push(...c)}catch{}this.queryShadowRoots(l,n,r+1)}}}queryOverlayElements(){const e=Cv();if(e.length===0)return[];const n=[],r=new Set,i=['[role="option"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="treeitem"]','[role="listbox"]','[role="menu"]','[role="button"]','[role="link"]','[role="checkbox"]','[role="radio"]','[role="switch"]','[role="tab"]','[role="combobox"]','[role="searchbox"]','[role="textbox"]',"button","a[href]",'input:not([type="hidden"])',"select","textarea","li","nz-option-item",".ant-select-item-option",".ant-select-item",".ant-dropdown-menu-item",".ant-cascader-menu-item",'[class*="option"]:not([class*="singleValue"]):not([class*="placeholder"])','[class*="Option"]:not([class*="singleValue"]):not([class*="placeholder"])','[class*="menu-item"]','[class*="MenuItem"]'].join(", ");for(const o of e)try{const s=Array.from(o.querySelectorAll(i));for(const a of s){const l=a;if(r.has(l))continue;r.add(l);const c=l.getBoundingClientRect();if(c.width<=0||c.height<=0)continue;try{const h=window.getComputedStyle(l);if(h.display==="none"||h.visibility==="hidden")continue}catch{continue}let d=!1;for(const h of Qe.SKIP_SELECTORS)if(l.matches(h)||l.closest(h)){d=!0;break}d||n.push(l)}}catch{}return this.logger.log(`[AccessibleSnapshot] Found ${n.length} overlay elements from ${e.length} active overlays`),n}queryIframeElements(){const e=[];try{const n=Array.from(document.querySelectorAll("iframe"));for(const r of n)try{const i=r.contentDocument;if(!i)continue;const o=Array.from(i.querySelectorAll(Qe.INTERACTIVE_SELECTOR));e.push(...o)}catch{}}catch{}return e}queryCursorPointerElements(){const e=['[class*="card"]:not(button):not(a)','[class*="Card"]:not(button):not(a)','[class*="tile"]:not(button):not(a)','[class*="Tile"]:not(button):not(a)','[class*="option"]:not(button):not(a)','[class*="Option"]:not(button):not(a)','[class*="clickable"]','[class*="Clickable"]','[class*="selectable"]','[class*="Selectable"]',"[data-clickable]","[data-action]","[data-onclick]",'li[class*="item"]','li[class*="Item"]','div[class*="cursor-pointer"]','div[class*="pointer"]'].join(", "),n=[];try{const o=Array.from(document.querySelectorAll(e));n.push(...o)}catch{}const r=document.querySelectorAll('main, [role="main"], #app, #root, .app, .main');for(const o of r){const s=Array.from(o.querySelectorAll(":scope > div, :scope > section > div"));n.push(...s.slice(0,50))}const i=new Set;return n.filter(o=>{if(i.has(o)||(i.add(o),!this.shouldIncludeElement(o))||window.getComputedStyle(o).cursor!=="pointer")return!1;const a=o.parentElement;return!(a&&window.getComputedStyle(a).cursor==="pointer"&&!o.onclick&&!o.getAttribute("onclick")&&!o.getAttribute("role"))})}shouldIncludeElement(e){for(const a of Qe.SKIP_SELECTORS)if(e.matches(a)||e.closest(a))return!1;if(Cd(e)){try{const a=window.getComputedStyle(e);if(a.display==="none"||a.visibility==="hidden")return!1}catch{}return!0}if(e.getAttribute("aria-hidden")==="true"||!!e.closest('[aria-hidden="true"]')){const a=xv();if(!(a.length>0&&!a.some(c=>c.contains(e))))return!1}const i=e.getAttribute("role");if(i==="presentation"||i==="none")return!1;if(!this.isVisible(e)){const a=qa(e),l=Ja(e,8);if(!a&&!l)return!1}const o=e.getBoundingClientRect();if(o.bottom<0||o.top>window.innerHeight||o.right<0||o.left>window.innerWidth||o.width<=0||o.height<=0){const a=qa(e),l=Ja(e,8);if(!a&&!l)return!1}return!0}isVisible(e){if(e.offsetParent===null){const n=window.getComputedStyle(e);if(n.position!=="fixed"&&(n.display==="none"||n.visibility==="hidden"))return!1}try{const n=window.getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"||n.opacity==="0")return!1;let r=e.parentElement,i=0;const o=10;for(;r&&r!==document.body&&i<o;){const s=window.getComputedStyle(r);if(s.display==="none"||s.visibility==="hidden")return!1;r=r.parentElement,i++}return!0}catch{return!0}}dedupeElements(e){const n=new Set,r=[],i=new Map,o=new Map,s=new Map,a=h=>(i.has(h)||i.set(h,this.getElementDepth(h)),i.get(h)),l=h=>(o.has(h)||o.set(h,this.getRole(h)),o.get(h)),c=h=>(s.has(h)||s.set(h,this.computeAccessibleName(h)),s.get(h)),d=[...e].sort((h,f)=>a(f)-a(h));for(const h of d){if(n.has(h))continue;let f=!1;for(const g of r)if(h.contains(g)&&h!==g){const y=l(h),m=l(g);if(y==="card"||y==="listitem"||y==="option"){if(!c(h)){f=!0;break}}else if(y===m){f=!0;break}}if(!f){for(const g of r)if(g.contains(h)&&g!==h){const y=c(h),m=c(g);if(!y||y===m){f=!0;break}}}f||(n.add(h),r.push(h))}return r}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}getBlockedReason(e){return Ed(e)?qa(e)?"collapsed-details":Ja(e,8)?"collapsed-accordion":null:"modal"}processElement(e,n){const r=e.getBoundingClientRect(),i=this.computeAccessibleName(e);let o=this.getRole(e);if((!o||o==="element")&&this.looksLikeCard(e)&&(o="card"),!i&&(!o||o==="element"))return null;const s=this.getState(e),a=this.findContext(e),l=this.getRowContext(e),c=this.generateRef(o||"element");let d;if(e instanceof HTMLInputElement&&e.value)d=e.value;else if(e instanceof HTMLTextAreaElement&&e.value)d=e.value;else if(e instanceof HTMLSelectElement&&e.selectedIndex>=0){const j=e.options[e.selectedIndex];j&&(d=j.text)}else if(e.getAttribute("contenteditable")==="true"){const j=(e.textContent||"").trim();j&&(d=j.length>200?j.slice(0,200)+"...":j)}if(!d){const j=e.getAttribute("aria-valuetext"),H=e.getAttribute("aria-valuenow");j?d=j:H&&(d=H)}if(!d){const j=(e.getAttribute("role")||"").toLowerCase();if(j==="combobox"||j==="listbox"||e.classList.contains("ant-select")||e.classList.contains("ant-select-selector")||e.tagName.toLowerCase()==="nz-select"||e.closest("nz-select")||e.closest(".ant-select")||e.closest('[class*="select-container"]')||e.closest('[class*="Select"]')){const ie=[".ant-select-selection-item",".ant-select-selection-placeholder","nz-select-top-control nz-select-item",".nz-select-item-label",'[class*="singleValue"]','[class*="SingleValue"]','[class*="select-value"]','[class*="selected-value"]','[class*="placeholder"]'];for(const Q of ie)try{const V=e.querySelector(Q);if(V){const X=(V.textContent||"").trim();if(X){d=X;break}}}catch{}if(!d){const Q=e.querySelectorAll('.ant-select-selection-item, nz-select-item, [class*="selected"]');for(let V=0;V<Q.length;V++){const X=(Q[V].textContent||"").trim();if(X&&X!=="Select"&&X!=="Choose"&&X.length<100){d=X;break}}}}}if(!d&&(e.classList.contains("ant-picker")||e.closest(".ant-picker")||e.closest('[class*="datepicker"]')||e.closest('[class*="DatePicker"]'))){const H=e.querySelector('.ant-picker-input input, [class*="date-input"] input, input');H&&H.value&&(d=H.value)}const h=this.getBlockedReason(e),f=h?!1:Ev(e,!0);let g;const y=(o||"").toLowerCase(),m=y==="listbox"||y==="menu"||y==="combobox"||y==="list"||y==="tree"||y==="grid";e.scrollHeight>e.clientHeight+10&&(m||e.scrollHeight>e.clientHeight+50)&&(g={scrollable:!0,hasMoreAbove:e.scrollTop>10,hasMoreBelow:e.scrollTop+e.clientHeight<e.scrollHeight-10});let v;if(s.invalid){const j=e.getAttribute("aria-errormessage");if(j){const H=document.getElementById(j);H&&(v=(H.textContent||"").trim().slice(0,100))}if(!v){const H=[".error-message",".form-error",".field-error",".ant-form-item-explain-error",".ant-form-item-explain",".help-block.error",".invalid-feedback",'[class*="error-msg"]','[class*="ErrorMessage"]','[role="alert"]'],ie=e.closest('.form-group, .ant-form-item, .field, [class*="form-field"]')||e.parentElement;if(ie)for(const Q of H)try{const V=ie.querySelector(Q);if(V){const X=(V.textContent||"").trim();if(X){v=X.slice(0,100);break}}}catch{}}}let w;const k=e.getAttribute("aria-live"),C=e.getAttribute("role");k==="assertive"||C==="alert"?w="assertive":(k==="polite"||C==="status"||C==="log")&&(w="polite");let E;const L=["data-testid","data-cy","data-automation-id","data-qa","data-test"];let A=e,R=0;for(;A&&R<5;){for(const j of L){const H=A.getAttribute(j);if(H){E=H;break}}if(E)break;A=A.parentElement,R++}let G;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){const j={};e instanceof HTMLInputElement&&(e.type&&e.type!=="text"&&(j.type=e.type),e.min&&(j.min=e.min),e.max&&(j.max=e.max),e.step&&e.step!=="any"&&(j.step=e.step),e.pattern&&(j.pattern=e.pattern),e.accept&&(j.accept=e.accept)),"maxLength"in e&&e.maxLength>0&&e.maxLength<524288&&(j.maxlength=String(e.maxLength)),"minLength"in e&&e.minLength>0&&(j.minlength=String(e.minLength)),Object.keys(j).length>0&&(G=j)}const U=this.findLandmark(e),K=this.getPositionInSet(e);return{ref:c,role:o||"element",name:i||this.generateFallbackName(e,o),...Object.keys(s).length&&{state:s},...d&&{value:d},...a&&{context:a},...l&&{rowContext:l},rect:{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)},selector:this.generateSelector(e),tag:e.tagName.toLowerCase(),interactable:f,...h&&{hiddenBy:h},...g&&{scrollInfo:g},...v&&{errorMessage:v},...w&&{liveRegion:w},...E&&{testId:E},...G&&{constraints:G},...U&&{landmark:U},...K&&{positionInSet:K}}}computeAccessibleName(e){var h,f,g,y,m,S,v,w,k,C,E,L;const n=e.getAttribute("aria-labelledby");if(n){const A=n.split(/\s+/).map(R=>{var G,U;return(U=(G=document.getElementById(R))==null?void 0:G.textContent)==null?void 0:U.trim()}).filter(Boolean);if(A.length)return A.join(" ").slice(0,100)}const r=(h=e.getAttribute("aria-label"))==null?void 0:h.trim();if(r)return r.slice(0,100);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){const A=this.getInputLabel(e);if(A)return A;if("placeholder"in e&&e.placeholder)return e.placeholder.slice(0,100);const R=this.getCustomSelectPlaceholder(e);if(R)return R;const G=this.getAncestorLabel(e);if(G)return G}if(e instanceof HTMLImageElement&&e.alt)return e.alt.slice(0,100);if(e.tagName.toLowerCase()==="svg"||e instanceof SVGElement){const A=(g=(f=e.querySelector("title"))==null?void 0:f.textContent)==null?void 0:g.trim();if(A)return A.slice(0,100)}if(e instanceof HTMLTableElement){const A=(m=(y=e.querySelector("caption"))==null?void 0:y.textContent)==null?void 0:m.trim();if(A)return A.slice(0,100)}if(e.tagName.toLowerCase()==="figure"){const A=(v=(S=e.querySelector("figcaption"))==null?void 0:S.textContent)==null?void 0:v.trim();if(A)return A.slice(0,100)}const i=(w=e.getAttribute("title"))==null?void 0:w.trim();if(i)return i.slice(0,100);const o=this.getDirectTextContent(e);if(o)return o;const s=this.findSiblingLabel(e);if(s)return s;const a=e.querySelector("svg");if(a){const A=(C=(k=a.querySelector("title"))==null?void 0:k.textContent)==null?void 0:C.trim();if(A)return A.slice(0,100);const R=(L=(E=a.querySelector("desc"))==null?void 0:E.textContent)==null?void 0:L.trim();if(R)return R.slice(0,100)}const l=e.getAttribute("data-tooltip")||e.getAttribute("data-tip")||e.getAttribute("data-original-title");if(l)return l.slice(0,100);const c=e.getAttribute("data-testid");if(c)return c.replace(/[-_]/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").slice(0,100);const d=this.extractIconName(e);if(d)return d;try{const A=window.getComputedStyle(e,"::before").content,R=window.getComputedStyle(e,"::after").content,G=[];if(A&&A!=="none"&&A!=="normal"){const U=A.replace(/^["']|["']$/g,"").trim();U&&U.length>1&&U.length<100&&G.push(U)}if(R&&R!=="none"&&R!=="normal"){const U=R.replace(/^["']|["']$/g,"").trim();U&&U.length>1&&U.length<100&&G.push(U)}if(G.length>0)return G.join(" ").slice(0,100)}catch{}return""}getInputLabel(e){var i,o,s;if(e.id){const a=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(a){const l=(i=a.textContent)==null?void 0:i.trim();if(l)return l.slice(0,100)}}const n=e.closest("label");if(n){const a=n.cloneNode(!0);a.querySelectorAll("input, select, textarea").forEach(c=>c.remove());const l=(o=a.textContent)==null?void 0:o.trim();if(l)return l.slice(0,100)}const r=e.getAttribute("aria-describedby");if(r){const a=document.getElementById(r);if(a){const l=(s=a.textContent)==null?void 0:s.trim();if(l)return l.slice(0,100)}}return""}getDirectTextContent(e){var r,i,o;let n="";for(const s of e.childNodes)s.nodeType===Node.TEXT_NODE&&(n+=(s.textContent||"")+" ");if(n=n.trim(),!n){const s=[":scope > span",":scope > strong",":scope > em",":scope > b",":scope > label",":scope > .MuiButton-label",":scope > .ant-btn-content",':scope > [class*="label"]',':scope > [class*="text"]',':scope > div > [class*="font-medium"]',':scope > div > [class*="title"]',':scope > [class*="font-medium"]',':scope > [class*="title"]',":scope > div"];for(const a of s)try{const l=e.querySelector(a);if(l){const c=(r=l.textContent)==null?void 0:r.trim();if(c&&c.length<100)if(l.children.length>2){const d=(i=c.split(`
454
+ `)[0])==null?void 0:i.trim();if(d){n=d;break}}else{n=c;break}}}catch{}}if(!n&&e.innerText){const s=e.innerText.trim().split(`
455
+ `);n=((o=s[0])==null?void 0:o.trim())||"",s.length>1&&s.length<=3&&(n=s.join(" - ").slice(0,100))}return n.slice(0,100)}extractIconName(e){var s;const r=e.querySelector('[class*="icon"], [class*="Icon"], svg, i')||e,i=typeof r.className=="string"?r.className:"",o=[/fa-([a-z-]+)/i,/fas? fa-([a-z-]+)/i,/far? fa-([a-z-]+)/i,/icon-([a-z-]+)/i,/([a-z]+)-icon/i,/material-icons/i,/lucide-([a-z-]+)/i,/heroicon-([a-z-]+)/i,/ri-([a-z-]+)/i,/bi-([a-z-]+)/i,/bx-([a-z-]+)/i,/bxs-([a-z-]+)/i,/ph-([a-z-]+)/i,/tabler-([a-z-]+)/i,/mdi-([a-z-]+)/i];for(const a of o){const l=i.match(a);if(l&&l[1])return l[1].replace(/-/g," ").replace(/([a-z])([A-Z])/g,"$1 $2")}if(i.includes("material-icons")||i.includes("material-symbols")){const a=(s=r.textContent)==null?void 0:s.trim();if(a&&a.length<30)return a.replace(/_/g," ")}return""}getCustomSelectPlaceholder(e){const n=e.closest('nz-select, .ant-select, [class*="select-container"], [class*="Select"], [class*="react-select"]');if(!n)return"";const r=["nz-select-placeholder",".ant-select-selection-placeholder",'[class*="placeholder"]:not(input)','[class*="Placeholder"]:not(input)'];for(const o of r)try{const s=n.querySelector(o);if(s){const a=(s.textContent||"").trim();if(a&&a.length<100)return a}}catch{}const i=n.getAttribute("aria-label")||n.getAttribute("placeholder")||n.getAttribute("placeholdertext");return i?i.slice(0,100):""}getAncestorLabel(e){let n=e.parentElement,r=0;for(;n&&n!==document.body&&r<6;){const i=[":scope > label",":scope > .label",':scope > [class*="label"]',':scope > [class*="Label"]',':scope > [class*="font-semibold"]',':scope > [class*="form-label"]',':scope > [data-cy*="label"]'];for(const o of i)try{const s=n.querySelector(o);if(s&&!s.contains(e)){const a=(s.textContent||"").replace(/\s*\*\s*$/,"").trim();if(a&&a.length>1&&a.length<60)return a}}catch{}try{const o=n.querySelector("nz-form-label, .ant-form-item-label, .ant-form-item-label label");if(o&&!o.contains(e)){const s=(o.textContent||"").replace(/\s*\*\s*$/,"").trim();if(s&&s.length>1&&s.length<60)return s}}catch{}n=n.parentElement,r++}return""}findSiblingLabel(e){var i,o;let n=e.previousElementSibling;for(;n;){if(n.matches('label, .label, [class*="label"], [class*="Label"]')){const s=(i=n.textContent)==null?void 0:i.trim();if(s&&s.length<50)return s}n=n.previousElementSibling}const r=e.parentElement;if(r){const s=r.querySelector(':scope > label, :scope > .label, :scope > [class*="FormLabel"]');if(s&&!s.contains(e)){const a=(o=s.textContent)==null?void 0:o.trim();if(a&&a.length<50)return a}}return""}generateFallbackName(e,n){const r=e.tagName.toLowerCase(),i=this.getSiblingIndex(e),o=this.getParentContext(e),s=[];return s.push(n||r),i>0&&s.push(`${i+1}`),o&&s.push(`in ${o}`),s.join(" ")}getSiblingIndex(e){const n=e.parentElement;return n?Array.from(n.children).filter(i=>i.tagName===e.tagName).indexOf(e):0}getParentContext(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=n.getAttribute("aria-label")||n.getAttribute("title")||(n.matches("nav, main, header, footer, aside, section, article")?n.tagName.toLowerCase():null);if(r)return r.slice(0,30);n=n.parentElement}return""}getRole(e){const n=e.getAttribute("role");if(n)return n;const r=e.tagName.toLowerCase();if(r==="input"){const s=e.type||"text";return Qe.INPUT_TYPE_ROLES[s]||"textbox"}if(r==="a")return e.hasAttribute("href")?"link":"";const i=typeof e.className=="string"?e.className:"";if(e.getAttribute("contenteditable")==="true"){const s=["ql-editor","ProseMirror","tiptap","ck-editor__editable","DraftEditor-content"];for(const a of s)if(i.includes(a)||e.closest(`.${a}`))return"richtext"}const o=["ql-container","ck-editor__main","DraftEditor-root","tiptap-editor"];for(const s of o)if(i.includes(s))return"richtext";return Qe.IMPLICIT_ROLES[r]||""}looksLikeCard(e){const n=typeof e.className=="string"?e.className.toLowerCase():"";if(n.includes("card")||n.includes("tile")||n.includes("option")||n.includes("selection"))return!0;const r=window.getComputedStyle(e),o=!(r.borderWidth||"0").split(" ").every(c=>c==="0px"||c==="0")&&r.borderStyle!=="none",s=r.borderRadius||"0",a=parseFloat(s)>0;r.backgroundColor!=="rgba(0, 0, 0, 0)"&&r.backgroundColor;const l=e.getBoundingClientRect();return!!(o&&a&&l.height>50&&l.width>100)}getState(e){const n={};e.getAttribute("aria-selected")==="true"&&(n.selected=!0);const r=e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio");(e.getAttribute("aria-checked")==="true"||r&&e.checked)&&(n.checked=!0),e.getAttribute("aria-expanded")==="true"&&(n.expanded=!0),e instanceof HTMLDetailsElement&&e.open&&(n.expanded=!0),e.getAttribute("aria-pressed")==="true"&&(n.pressed=!0);const i=e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement;(e.getAttribute("aria-disabled")==="true"||i&&e.disabled||e.hasAttribute("disabled"))&&(n.disabled=!0),(e.getAttribute("aria-current")==="true"||e.getAttribute("aria-current")==="page")&&(n.current=!0),!n.selected&&this.detectVisualSelection(e)&&(n.selected=!0);const o=typeof e.className=="string"?e.className.toLowerCase():"";!n.selected&&(o.includes("selected")||o.includes("active")||o.includes("chosen")||o.includes("current"))&&(n.selected=!0),!n.disabled&&o.includes("disabled")&&(n.disabled=!0);const s=e.getAttribute("data-state");return(s==="checked"||s==="on")&&(n.checked=!0),(s==="open"||s==="expanded")&&(n.expanded=!0),(s==="active"||s==="selected")&&(n.selected=!0),(e.getAttribute("aria-invalid")==="true"||o.includes("invalid")||o.includes("error")||o.includes("has-error")||o.includes("ng-invalid")||o.includes("ant-form-item-has-error"))&&(n.invalid=!0),(e.getAttribute("aria-busy")==="true"||o.includes("loading")||o.includes("spinner")||o.includes("skeleton")||o.includes("pending")||o.includes("ant-btn-loading"))&&(n.loading=!0),(e.hasAttribute("required")||e.getAttribute("aria-required")==="true")&&(n.required=!0),n}detectVisualSelection(e){const n=window.getComputedStyle(e),r=n.borderColor.toLowerCase();if(r.includes("rgb(8, 103, 236)")||r.includes("rgb(59, 130, 246)")||r.includes("rgb(37, 99, 235)")||r.includes("rgb(29, 78, 216)"))return!0;const i=n.backgroundColor.toLowerCase();return!!(i.includes("rgb(238, 245, 252)")||i.includes("rgb(239, 246, 255)")||i.includes("rgb(219, 234, 254)"))}findContext(e){var l,c,d,h,f,g,y,m;const n=e.getAttribute("aria-describedby");if(n){const S=document.getElementById(n);if(S)return((l=S.textContent)==null?void 0:l.trim().slice(0,50))||null}const r=e.closest("fieldset");if(r){const S=r.querySelector("legend");if(S)return((c=S.textContent)==null?void 0:c.trim().slice(0,50))||null}const i=e.closest('[class*="form-group"], [class*="FormGroup"], [class*="field"]');if(i){const S=i.querySelector(":scope > label, :scope > .label");if(S&&!S.contains(e))return((d=S.textContent)==null?void 0:d.trim().slice(0,50))||null}const o=e.closest('section, [role="region"], form, [class*="section"], [class*="Section"]');if(o){const S=o.querySelector(':scope > h1, :scope > h2, :scope > h3, :scope > h4, :scope > h5, :scope > h6, :scope > [role="heading"]');if(S)return((h=S.textContent)==null?void 0:h.trim().slice(0,50))||null;const v=o.querySelector(':scope > [class*="title"], :scope > [class*="Title"], :scope > [class*="header"] > *');if(v)return((f=v.textContent)==null?void 0:f.trim().slice(0,50))||null}const s=e.previousElementSibling;if(s&&s.matches('p, label, h1, h2, h3, h4, h5, h6, [class*="label"], [class*="Label"]')){const S=(g=s.textContent)==null?void 0:g.trim();if(S&&S.length<50)return S}const a=(y=e.parentElement)==null?void 0:y.previousElementSibling;if(a&&a.matches('p, label, [class*="label"], [class*="Label"]')){const S=(m=a.textContent)==null?void 0:m.trim();if(S&&S.length<50)return S}return null}findLandmark(e){const n=e.closest('nav, main, aside, header, footer, [role="navigation"], [role="banner"], [role="main"], [role="contentinfo"], [role="complementary"], [role="search"], [role="form"]');if(!n)return;const r=n.getAttribute("aria-label"),i=n.getAttribute("role")||Qe.IMPLICIT_ROLES[n.tagName.toLowerCase()]||"";return r?`${i}: ${r}`.slice(0,50):i||void 0}getPositionInSet(e){const n=e.getAttribute("aria-posinset"),r=e.getAttribute("aria-setsize");if(n&&r)return`${n} of ${r}`;const i=(e.getAttribute("role")||"").toLowerCase(),o=e.tagName.toLowerCase();if(!(i==="option"||i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio"||i==="treeitem"||i==="tab"||i==="listitem"||o==="option"||o==="li"))return;const a=e.parentElement;if(!a)return;let l;i?l=`:scope > [role="${i}"]`:o==="option"?l=":scope > option":l=`:scope > ${o}`;try{const c=Array.from(a.querySelectorAll(l));if(c.length<=1)return;const d=c.indexOf(e);if(d>=0)return`${d+1} of ${c.length}`}catch{}}getRowContext(e){var o,s,a;const n=e.closest('tr, [role="row"]');if(n){const l=n.querySelector('td:first-child, th:first-child, [role="cell"]:first-child');if(l&&!l.contains(e)){const c=(o=l.textContent)==null?void 0:o.trim();if(c)return c.slice(0,40)}}const r=e.closest('li, [role="listitem"]');if(r){const l=r.querySelector('.name, .title, [class*="name"], [class*="title"], [class*="Name"]');if(l&&!l.contains(e)){const c=(s=l.textContent)==null?void 0:s.trim();if(c)return c.slice(0,40)}}const i=['[class*="data-row"]','[class*="DataRow"]','[class*="list-item"]','[class*="ListItem"]','[class*="table-row"]','[class*="TableRow"]','.row[class*="item"]','.Row[class*="Item"]'];for(const l of i)try{const c=e.closest(l);if(c&&!c.matches("tr")){const d=c.querySelector('[class*="name"], [class*="title"], [class*="-id"]');if(d&&!d.contains(e)){const h=(a=d.textContent)==null?void 0:a.trim();if(h&&h.length<40)return h}}}catch{}return null}generateRef(e){const n=Qe.ROLE_PREFIXES[e]||"E";return this.refCounters[n]=(this.refCounters[n]||0)+1,`${n}${this.refCounters[n]}`}renumberRefs(e){const n={};for(const r of e){const i=Qe.ROLE_PREFIXES[r.role]||"E";n[i]=(n[i]||0)+1,r.ref=`${i}${n[i]}`}}generateSelector(e){try{if(e.id){const o=`#${CSS.escape(e.id)}`;if(document.querySelector(o)===e)return o}const n=e.getAttribute("data-testid");if(n){const o=`[data-testid="${CSS.escape(n)}"]`;if(document.querySelector(o)===e)return o}if(e.className&&typeof e.className=="string"){const o=e.className.split(/\s+/).filter(s=>s&&!s.includes(":")&&!s.startsWith("css-"));if(o.length>0){const s=o.slice(0,3).map(a=>{try{return CSS.escape(a)}catch{return null}}).filter(Boolean);if(s.length>0){const a=`${e.tagName.toLowerCase()}.${s.join(".")}`;try{if(document.querySelectorAll(a).length===1)return a}catch{}}}}const r=[];let i=e;for(;i&&i!==document.body&&r.length<4;){let o=i.tagName.toLowerCase();if(i.id)try{const a=`#${CSS.escape(i.id)}`;if(document.querySelector(a)){r.unshift(a);break}}catch{}const s=i.parentElement;if(s){const a=Array.from(s.children).filter(l=>l.tagName===i.tagName);if(a.length>1){const l=a.indexOf(i)+1;o+=`:nth-of-type(${l})`}}r.unshift(o),i=s}return r.join(" > ")}catch{const r=e.parentElement;if(r){const o=Array.from(r.children).indexOf(e);return`${e.tagName.toLowerCase()}:nth-child(${o+1})`}return e.tagName.toLowerCase()}}computeSnapshotHash(e){const n=e.map(r=>`${r.role}:${r.name}:${r.state?JSON.stringify(r.state):""}`).join("|");return this.simpleHash(n)}simpleHash(e){let n=0;for(let r=0;r<e.length;r++){const i=e.charCodeAt(r);n=(n<<5)-n+i,n=n&n}return n.toString(36)}snapshotsAreEqual(e,n){if(e.elementCount!==n.elementCount||e.elements.length!==n.elements.length)return!1;for(let r=0;r<e.elements.length;r++){const i=e.elements[r],o=n.elements[r];if(!i||!o||i.name!==o.name||i.role!==o.role)return!1;const s=JSON.stringify(i.state||{}),a=JSON.stringify(o.state||{});if(s!==a)return!1}return!0}sleep(e){return new Promise(n=>setTimeout(n,e))}};P(Qe,"IMPLICIT_ROLES",{button:"button",a:"link",input:"textbox",textarea:"textbox",select:"combobox",option:"option",img:"img",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",form:"form",table:"table",ul:"list",ol:"list",li:"listitem",article:"article",aside:"complementary",section:"region",dialog:"dialog",menu:"menu",menuitem:"menuitem",progress:"progressbar",meter:"meter"}),P(Qe,"INPUT_TYPE_ROLES",{button:"button",submit:"button",reset:"button",image:"button",checkbox:"checkbox",radio:"radio",range:"slider",search:"searchbox",email:"textbox",tel:"textbox",url:"textbox",password:"textbox",text:"textbox",number:"spinbutton"}),P(Qe,"ROLE_PREFIXES",{button:"B",link:"L",textbox:"T",searchbox:"T",checkbox:"X",radio:"R",combobox:"S",listbox:"S",option:"O",tab:"TAB",menuitem:"M",menu:"MENU",img:"I",card:"C",dialog:"D",slider:"SL",spinbutton:"N",switch:"SW",navigation:"NAV",treeitem:"TI",gridcell:"GC",rowheader:"RH",columnheader:"CH",menuitemcheckbox:"MX",menuitemradio:"MR",alertdialog:"AD",progressbar:"PB",separator:"SEP",richtext:"RT"}),P(Qe,"INTERACTIVE_SELECTOR",`
456
+ button,
457
+ a[href],
458
+ input:not([type="hidden"]),
459
+ select,
459
460
  textarea,
460
- [role="button"],
461
- [role="link"],
462
- [role="tab"],
461
+ [role="button"],
462
+ [role="link"],
463
+ [role="tab"],
463
464
  [role="menuitem"],
464
- [role="option"],
465
- [role="checkbox"],
466
- [role="radio"],
465
+ [role="menuitemcheckbox"],
466
+ [role="menuitemradio"],
467
+ [role="option"],
468
+ [role="checkbox"],
469
+ [role="radio"],
467
470
  [role="switch"],
468
- [role="combobox"],
469
- [role="listbox"],
471
+ [role="combobox"],
472
+ [role="listbox"],
470
473
  [role="slider"],
471
474
  [role="spinbutton"],
472
475
  [role="searchbox"],
473
476
  [role="textbox"],
477
+ [role="treeitem"],
478
+ [role="gridcell"],
479
+ [role="rowheader"],
480
+ [role="columnheader"],
481
+ [role="alertdialog"],
482
+ [role="progressbar"],
483
+ [role="separator"][tabindex],
474
484
  [tabindex]:not([tabindex="-1"]),
475
485
  [contenteditable="true"],
476
486
  summary
477
- `.replace(/\s+/g," ").trim()),D(yt,"SKIP_SELECTORS",["#onboarding-overlay","#onboarding-sdk-react-ui","#hse-highlight-element","script","style","noscript","template"]);let Ed=yt;const e_=["#onboarding-overlay","#floe-cursor","#onboarding-sdk-react-ui","#hse-highlight-element","#floe-cursor-styles","#onboarding-animations"],Di="data-floe-widget";function Mt(t){if(!t)return!1;if(t.hasAttribute(Di))return!0;for(const e of e_)if(t.closest(e))return!0;return!1}function Dn(){return window.location.origin+window.location.pathname}function Ga(t){try{const e=new URL(t,window.location.origin);return e.origin+e.pathname}catch{return t}}function Tv(t){return t&&t.replace(/\.ng-(untouched|touched|pristine|dirty|valid|invalid)/g,"")}function Mv(t){try{const n=document.querySelector(t);if(n)return n}catch{}const e=Tv(t);if(e!==t)try{const n=document.querySelector(e);if(n)return de.log(`[AngularFallback] Selector matched after stripping state classes: "${e}"`),n}catch{}return null}function Av(t){let e=t,n=0;for(;e&&n<5;){const r=e.getAttribute("role");if(r==="dialog"||r==="alertdialog"||e.getAttribute("aria-modal")==="true"||e.tagName==="DIALOG")return!0;const i=e.tagName.toLowerCase();if(i.includes("modal")||i.includes("dialog"))return!0;const o=typeof e.className=="string"?e.className.toLowerCase():"";if(o.includes("modal")||o.includes("dialog")||o.includes("cdk-overlay"))return!0;e=e.parentElement,n++}return!1}function Ov(t,e={}){var v,b,g,S,m;const{focus:n=!0,includePointerEvents:r=!0,nativeClickFallback:i=!1,includeMouseEnter:o=!1}=e,s=t.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c=document.elementFromPoint(a,l);let d;if(c&&(c===t||t.contains(c)||c.contains(t)))d=c,d!==t&&de.log("[humanLikeClick] 🎯 Using element at point:",d.tagName,"instead of target:",t.tagName);else if(c){if(de.warn("[humanLikeClick] ⚠️ Element at point is unrelated:",c.tagName,(v=c.className)==null?void 0:v.toString().slice(0,50)),de.warn("[humanLikeClick] Expected target:",t.tagName,(b=t.className)==null?void 0:b.toString().slice(0,50)),Av(c))if(Av(t))de.warn("[humanLikeClick] ⚠️ Stacked modal detected: both target and overlay are in modals.","Falling through to direct dispatch on target."),d=t;else{const w=`${c.tagName} (${(g=c.className)==null?void 0:g.toString().slice(0,80)})`;throw de.error("[humanLikeClick] ❌ BLOCKED: Modal/dialog overlay is covering the target element.",`Overlay: ${w}`,`Target: ${t.tagName} "${(S=t.textContent)==null?void 0:S.trim().slice(0,50)}"`),new Error(`Click blocked by modal overlay: ${w}. Target "${(m=t.textContent)==null?void 0:m.trim().slice(0,50)}" is behind the modal. Interact with the modal instead.`)}d=t}else de.warn("[humanLikeClick] ⚠️ No element at coordinates, falling back to target"),d=t;n&&typeof d.focus=="function"&&d.focus();const h={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l,screenX:a+window.screenX,screenY:l+window.screenY,button:0,buttons:1},f=r?{...h,pointerType:"mouse",isPrimary:!0}:null;return o&&(d.dispatchEvent(new MouseEvent("mouseenter",{...h,bubbles:!1})),d.dispatchEvent(new MouseEvent("mouseover",h))),f&&d.dispatchEvent(new PointerEvent("pointerdown",f)),d.dispatchEvent(new MouseEvent("mousedown",h)),f&&d.dispatchEvent(new PointerEvent("pointerup",f)),d.dispatchEvent(new MouseEvent("mouseup",h)),d.dispatchEvent(new MouseEvent("click",h)),i&&typeof d.click=="function"&&d.click(),de.log("[humanLikeClick] ✅ Completed on",d.tagName,"at (",Math.round(a),",",Math.round(l),")"),d}class Dv{constructor(){D(this,"audioContext",null);D(this,"analyzerNode",null);D(this,"sourceNode",null);D(this,"dataArray",new Uint8Array(0));D(this,"isRunning",!1);D(this,"onLevelsCallback",null);D(this,"animationId",null);D(this,"analyze",()=>{if(!this.isRunning||!this.analyzerNode||this.dataArray.length===0)return;this.analyzerNode.getByteFrequencyData(this.dataArray);const e=[];for(let n=0;n<this.dataArray.length;n++)n>=2&&n<this.dataArray.length-2&&e.push(this.dataArray[n]/255);this.onLevelsCallback&&this.onLevelsCallback(e),this.animationId=requestAnimationFrame(this.analyze)})}start(e,n){try{this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext.state==="suspended"&&this.audioContext.resume(),this.analyzerNode=this.audioContext.createAnalyser(),this.analyzerNode.fftSize=64,this.analyzerNode.smoothingTimeConstant=.4,this.sourceNode=this.audioContext.createMediaStreamSource(e),this.sourceNode.connect(this.analyzerNode);const r=this.analyzerNode.frequencyBinCount;this.dataArray=new Uint8Array(r),this.onLevelsCallback=n,this.isRunning=!0,this.analyze(),de.log("[AudioAnalyzer] Started analyzing audio stream")}catch(r){de.error("[AudioAnalyzer] Failed to start:",r)}}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=null),this.analyzerNode=null,this.dataArray=new Uint8Array(0),this.onLevelsCallback=null,de.log("[AudioAnalyzer] Stopped")}destroy(){this.stop(),this.audioContext&&(this.audioContext.close(),this.audioContext=null)}}class t_{constructor(){D(this,"events",{})}on(e,n){return this.events[e]||(this.events[e]=[]),this.events[e].push(n),this}off(e,n){if(!this.events[e])return this;const r=this.events[e].indexOf(n);return r>-1&&this.events[e].splice(r,1),this}emit(e,...n){if(!this.events[e])return!1;for(const r of this.events[e])r(...n);return!0}}class n_{constructor(e=de){D(this,"logger");D(this,"lastSnapshot",null);D(this,"lastSnapshotHash","");D(this,"snapshotInterval",null);D(this,"sendCallback",null);D(this,"correlationCounter",0);D(this,"lastSendTimestamp",0);D(this,"INTERACTIVE_TAGS",new Set(["button","a","input","select","textarea","label","summary","details","option","menuitem"]));D(this,"INTERACTIVE_ROLES",new Set(["button","link","menuitem","option","tab","checkbox","radio","switch","textbox","combobox","listbox","slider"]));D(this,"_visibilityCacheObserver",null);D(this,"mutationObserver",null);D(this,"mutationDebounceTimer",null);this.logger=e}startCapturing(e=1500,n){this.logger.log(`[DOMIntrospector] Starting DOM capture every ${e}ms`),this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this._visibilityCacheObserver&&(this._visibilityCacheObserver.disconnect(),this._visibilityCacheObserver=null),this.sendCallback=n,this.initCacheInvalidation(),this.captureAndSend(),this.snapshotInterval=window.setInterval(()=>{this.captureAndSend()},e),this.setupMutationObserver()}stopCapturing(){this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this._visibilityCacheObserver&&(this._visibilityCacheObserver.disconnect(),this._visibilityCacheObserver=null),this.logger.log("[DOMIntrospector] Stopped DOM capture")}captureAndSendImmediate(e="immediate"){this.logger.log(`[DOMIntrospector] Immediate capture triggered: ${e}`);const n=this.captureSnapshot(),r=this.computeSnapshotHash(n),i=r!==this.lastSnapshotHash,o={...n,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:e,domChanged:i};return this.lastSnapshot=o,this.lastSnapshotHash=r,this.sendCallback&&(this.logger.log(`[DOMIntrospector] Sending immediate snapshot (changed=${i}): ${n.elements.length} elements, corr=${o.correlationId}`),this.sendCallback(o)),o.correlationId}setupMutationObserver(){this.mutationObserver||(this.mutationObserver=new MutationObserver(e=>{this.mutationDebounceTimer&&clearTimeout(this.mutationDebounceTimer),e.some(r=>r.type==="childList"||r.type==="attributes"&&["href","src","hidden","disabled","aria-hidden","aria-modal","aria-expanded","open"].includes(r.attributeName||""))&&(this.mutationDebounceTimer=setTimeout(()=>{this.logger.log("[DOMIntrospector] Significant DOM change detected"),this.captureAndSendImmediate("dom-mutation")},300))}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","disabled","aria-hidden","aria-modal","aria-expanded","open","href","src"]}))}captureAndSend(){const e=this.captureSnapshot(),n=this.computeSnapshotHash(e),r=n!==this.lastSnapshotHash,i=Date.now(),o=i-(this.lastSendTimestamp||0),s=!r&&o>1e4;if(r||s){const a={...e,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:r?"periodic":"heartbeat",domChanged:r};this.lastSnapshot=a,r&&(this.lastSnapshotHash=n),this.lastSendTimestamp=i,this.sendCallback&&(this.logger.log(`[DOMIntrospector] Sending snapshot (${r?"DOM changed":"heartbeat"}): ${e.elements.length} elements, ${e.interactiveCount} interactive, corr=${a.correlationId}`),this.sendCallback(a))}else this.logger.log("[DOMIntrospector] Snapshot unchanged, skipping send")}computeSnapshotHash(e){const n=e.elements.length,r=e.interactiveCount||0,i=30,o=e.elements.slice(0,i),s=Math.max(0,Math.floor(n/2)-Math.floor(i/2)),a=e.elements.slice(s,s+i),l=e.elements.slice(-i),c=h=>h.map(f=>{var v;return`${f.tag}:${(v=f.text)==null?void 0:v.slice(0,20)}:${Math.round(f.rect.x)}:${Math.round(f.rect.y)}`}).join("|");return`count:${n}:${r}|`+c(o)+"||"+c(a)+"||"+c(l)}captureSnapshot(){const e=[],n={width:window.innerWidth,height:window.innerHeight},r=document.body.querySelectorAll("*");let i=0,o=0;return r.forEach(s=>{var f;const a=s;if(this.shouldSkipElement(a))return;const l=a.getBoundingClientRect();if(l.bottom<0||l.top>n.height||l.right<0||l.left>n.width||l.width<=0||l.height<=0)return;const c=this.isInteractiveElement(a);c&&o++;const d=this.getVisibleText(a);if(!c&&!d)return;const h={index:i++,tag:a.tagName.toLowerCase(),text:d,id:a.id||"",className:typeof a.className=="string"?a.className:"",ariaLabel:a.getAttribute("aria-label"),placeholder:a.getAttribute("placeholder"),role:a.getAttribute("role"),href:a.getAttribute("href"),type:a.getAttribute("type"),name:a.getAttribute("name"),rect:{x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height)},isVisible:!0,isInteractive:c,isInteractable:c?Ev(a,!0):!1,parentTag:((f=a.parentElement)==null?void 0:f.tagName.toLowerCase())||null,depth:this.getElementDepth(a)};e.push(h)}),{timestamp:Date.now(),url:Dn(),viewport:n,elements:e,totalElements:e.length,interactiveCount:o}}shouldSkipElement(e){if(Mt(e))return!0;const n=e.tagName.toLowerCase();if(["script","style","noscript","template","svg","path"].includes(n))return!0;const r=window.getComputedStyle(e);return!!(r.display==="none"||r.visibility==="hidden"||r.opacity==="0"||Zx(e)||!Cd(e)||qa(e)||Ja(e))}initCacheInvalidation(){this._visibilityCacheObserver&&this._visibilityCacheObserver.disconnect(),this._visibilityCacheObserver=new MutationObserver(e=>{for(const n of e)if(n.type==="attributes"||n.type==="childList"){Yx();break}}),this._visibilityCacheObserver.observe(document.body,{attributes:!0,attributeFilter:["aria-modal","aria-hidden","aria-expanded","open"],childList:!0,subtree:!0})}isInteractiveElement(e){const n=e.tagName.toLowerCase();if(this.INTERACTIVE_TAGS.has(n))return!0;const r=e.getAttribute("role");if(r&&this.INTERACTIVE_ROLES.has(r)||e.onclick||e.getAttribute("onclick")||e.contentEditable==="true")return!0;const i=e.getAttribute("tabindex");return!!(i&&parseInt(i)>=0||window.getComputedStyle(e).cursor==="pointer")}getVisibleText(e){var r;return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?(e.value||e.placeholder||"").trim().slice(0,80):(((r=e.innerText)==null?void 0:r.trim())||"").slice(0,80)}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}getLastSnapshot(){return this.lastSnapshot}findElementByIndex(e){if(!this.lastSnapshot)return null;const n=this.lastSnapshot.elements.find(r=>r.index===e);return n?this.findElementByBoundingBox(n.rect,n.tag,n.text):null}findElementByBoundingBox(e,n,r){var a;const o=[];if(document.body.querySelectorAll("*").forEach(l=>{var g;const c=l;if(this.shouldSkipElement(c))return;const d=c.getBoundingClientRect(),h=Math.abs(d.x-e.x)<=10,f=Math.abs(d.y-e.y)<=10,v=Math.abs(d.width-e.width)<=10*2,b=Math.abs(d.height-e.height)<=10*2;if(h&&f&&v&&b){let S=100,m=!1;if(n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r){const w=((g=c.innerText)==null?void 0:g.trim().toLowerCase())||"",k=r.toLowerCase();w.length===0?m=!1:w===k?(S+=50,m=!0):(w.includes(k)||k.includes(w))&&(S+=25,m=!0)}else m=!0;o.push({element:c,score:S,textMatch:m})}}),o.sort((l,c)=>c.score-l.score),o.length>0){const l=o[0],c=((a=l.element.innerText)==null?void 0:a.trim().slice(0,50))||"";return r&&!l.textMatch?(this.logger.warn(`[DOMIntrospector] ⚠️ Bounding box match REJECTED - text mismatch! Expected: "${r}", Found: "${c}"`),this.logger.warn(`[DOMIntrospector] Element at (${e.x}, ${e.y}) has text "${c}" which doesn't match expected "${r}" - page may have scrolled`),null):(this.logger.log(`[DOMIntrospector] Found ${o.length} candidates by bounding box, best score: ${l.score}, text: "${c}"`),l.element)}return null}}const r_=[".cdk-overlay-pane nz-option-container",".cdk-overlay-pane .ant-select-dropdown",'.cdk-overlay-pane [role="listbox"]','[role="listbox"]:not([aria-hidden="true"])','[class*="menu"][class*="--is-open"]','[class*="MenuList"]',".ant-select-dropdown:not(.ant-select-dropdown-hidden)",'input[role="combobox"][aria-expanded="true"]'],i_=['[role="listbox"]','[role="menu"]','[class*="-menu"]:not([aria-hidden="true"])','[class*="listbox"]','[class*="options-container"]',".ant-select-dropdown","nz-option-container",".cdk-overlay-pane",".cdk-virtual-scroll-content-wrapper"],o_=['[role="option"]','[class*="option"]:not([class*="singleValue"]):not([class*="placeholder"])',"nz-option-item",".ant-select-item-option",".ant-select-item-option-content",".ant-select-item"].join(", "),Pv=["input.ant-select-selection-search-input",'input[role="combobox"]','input[type="search"]','input[class*="search"]','input[class*="Search"]','input[aria-autocomplete="list"]'];function s_(t){for(const e of r_)try{const n=document.querySelector(e);if(n&&t(n)){const r=n.getBoundingClientRect();if(r.height>20&&r.width>20)return de.log("[DropdownHelpers] Dropdown detected as open via:",e),!0}}catch{continue}return!1}function a_(t,e){if(t instanceof HTMLInputElement&&(t.getAttribute("role")==="combobox"||t.classList.contains("ant-select-selection-search-input")||t.type==="search"))return de.log("[DropdownHelpers] Trigger itself is search input"),t;const r=t.closest('nz-select, [class*="select-container"], [class*="Select"], [class*="combobox"]')||t.parentElement;if(r)for(const s of Pv){const a=r.querySelector(s);if(a)return de.log("[DropdownHelpers] Found search input via:",s),a}const i=document.querySelectorAll(".cdk-overlay-pane");for(const s of i)if(e(s))for(const a of Pv){const l=s.querySelector(a);if(l)return de.log("[DropdownHelpers] Found search input in CDK overlay via:",a),l}const o=document.activeElement;return o instanceof HTMLInputElement&&(o.getAttribute("role")==="combobox"||o.classList.contains("ant-select-selection-search-input"))?(de.log("[DropdownHelpers] Found search input as active element"),o):(de.log("[DropdownHelpers] No search input found for dropdown"),null)}function l_(t){const e=[],n=t.match(/^([^(]+)/),r=n?n[1].trim():t,i=r.split(/\s+/)[0];return i&&i.length>=2&&e.push(i),r!==i&&e.push(r),e.length===0&&e.push(t),e}function Bo(t,e){var o;const n=t.toLowerCase().trim();let r=null,i=null;for(const s of i_){let a;try{a=document.querySelectorAll(s)}catch{continue}for(const l of a){const c=l;if(!e(c)||c.getBoundingClientRect().height<20)continue;const h=l.querySelectorAll(o_);for(const f of h){const v=f,b=v.className||"";if(b.toLowerCase().includes("singlevalue")||b.toLowerCase().includes("placeholder"))continue;const g=v.getBoundingClientRect();if(g.height===0||g.width===0)continue;const S=((o=v.textContent)==null?void 0:o.trim().toLowerCase())||"";if(S===n){de.log(`[DropdownHelpers] Found EXACT match for option: "${t}"`),r=v;break}if(!i&&S.includes(n)){const m=n.length/S.length;m>.7&&(de.log(`[DropdownHelpers] Found partial match (${(m*100).toFixed(0)}%): "${S.slice(0,50)}"`),i=v)}}if(r)break}if(r)break}return r||(i?(de.warn(`[DropdownHelpers] Using partial match for "${t}" — verify correctness`),i):(de.log(`[DropdownHelpers] No option found for: "${t}"`),null))}async function c_(t,e,n){const r=l_(e);for(const i of r){de.log(`[DropdownHelpers] Typing search term: "${i}"`),t.focus(),await new Promise(s=>setTimeout(s,50)),t.value="",t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(s=>setTimeout(s,100));for(let s=0;s<i.length;s++){const a=i[s];t.value=i.substring(0,s+1),t.dispatchEvent(new KeyboardEvent("keydown",{key:a,bubbles:!0})),t.dispatchEvent(new KeyboardEvent("keypress",{key:a,bubbles:!0})),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new KeyboardEvent("keyup",{key:a,bubbles:!0})),await new Promise(l=>setTimeout(l,30))}t.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(s=>setTimeout(s,400));let o=Bo(e,n);if(o||(await new Promise(s=>setTimeout(s,300)),o=Bo(e,n),o))return o}return t.value="",t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(i=>setTimeout(i,200)),null}const A=class A{static setLogger(e){A._logger=e}static extractSelectorContext(e){if(!e)return{};const n=e.split(/\s*([>+~]|\s)\s*/);if(n.length<2)return{};const r=n[n.length-1],i=n.slice(0,-2),o=r.match(/^([a-zA-Z][a-zA-Z0-9-]*)/),s=o?o[1].toLowerCase():void 0,a=i.length>0?i.join(" "):void 0;let l;if(i.length>0){const d=i[i.length-1].match(/^([a-zA-Z][a-zA-Z0-9-]*)/);l=d?d[1].toLowerCase():void 0}return{expectedTag:s,parentSelector:a,parentTag:l}}static matchesSelectorContext(e,n){if(!n.parentTag&&!n.parentSelector)return .5;let r=0,i=0;if(n.parentTag&&(i++,e.closest(n.parentTag)&&(r+=1)),n.parentSelector){i++;try{e.closest(n.parentSelector)&&(r+=1)}catch{}}return i>0?r/i:.5}static setDOMIntrospector(e){A.domIntrospector=e,A._logger.log("[HybridTargetResolver] DOM Introspector set for enhanced targeting")}static safeStringify(e,n){const r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(o&&typeof o=="object"){if(o instanceof HTMLElement){const s=o.tagName||"Unknown",a=o.id?`#${o.id}`:"",l=o.className&&typeof o.className=="string"?`.${o.className.split(" ").filter(Boolean).join(".")}`:"";return`[HTMLElement: ${s}${a}${l}]`}if(o instanceof Element)return`[Element: ${o.tagName||"Unknown"}]`;if(o instanceof Node)return`[Node: ${o.nodeName}]`;if(r.has(o))return"[Circular]";r.add(o)}return o},n)}static resolveTarget(e){if(!e)return A._logger.warn("[HybridTargetResolver] ❌ No target provided"),null;A._logger.isDebug&&A._logger.log("[HybridTargetResolver] Target details:",this.safeStringify(e,2));const n=this.resolveTargetWithConsensus(e),r=n.element?`[HTMLElement: ${n.element.tagName}${n.element.id?`#${n.element.id}`:""}${n.element.className&&typeof n.element.className=="string"?`.${n.element.className.split(" ").filter(Boolean).join(".")}`:""}]`:null,i={...n,element:r};return A._logger.isDebug&&A._logger.log(`[HybridTargetResolver] consensus results (${n.confidence.toFixed(1)}% confidence)`,this.safeStringify(i,2)),n.element?n.element:null}static resolveTargetWithConsensus(e){var h;const n=performance.now(),r=this.getAvailableStrategies(e);if(r.length===0)return A._logger.warn("[HybridTargetResolver] ⚠️ No strategies available for target"),{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};A._logger.log(`[HybridTargetResolver] 🔄 Running ${r.length} strategies in parallel...`);const i=new Map;for(const f of r){const v=this.executeStrategyMulti(f,e);for(const b of v)Mt(b)||b.isConnected&&(i.has(b)?i.get(b).strategies.push(f):i.set(b,{element:b,strategies:[f],validationScore:0,interactable:!1,confidence:0}))}if(A._logger.log(`[HybridTargetResolver] 📊 Found ${i.size} unique candidate(s)`),i.size===0)return{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};const o=[];for(const[f,v]of i){if(!f.isConnected){A._logger.warn("[HybridTargetResolver] ⚠️ Candidate element was removed from DOM, skipping");continue}v.validationScore=this.computeValidationScore(f,e),v.interactable=this.checkInteractability(f).ok,v.confidence=this.computeConfidence(v,r.length,e),o.push(v),A._logger.isDebug&&(A._logger.log(`[HybridTargetResolver] <${f.tagName.toLowerCase()}> "${(h=f.textContent)==null?void 0:h.slice(0,25)}..."`),A._logger.log(`[HybridTargetResolver] Strategies: ${v.strategies.join(", ")} (${v.strategies.length}/${r.length})`),A._logger.log(`[HybridTargetResolver] Confidence: ${v.confidence.toFixed(1)}%`))}if(o.length===0)return{element:null,confidence:0,strategies:[],candidateCount:i.size,ambiguous:!1,duration:performance.now()-n};o.sort((f,v)=>v.confidence-f.confidence);const s=o[0],a=o.length>1?o[1]:void 0,l=performance.now()-n,c=a!==void 0&&s.confidence-a.confidence<10;if(c&&A._logger.warn("[HybridTargetResolver] ⚠️ AMBIGUOUS: Top candidates have similar confidence"),s.confidence<30)return A._logger.warn(`[HybridTargetResolver] ❌ Best candidate confidence too low: ${s.confidence.toFixed(1)}%`),{element:null,confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l};if(!s.interactable){const f=this.getClickableContainer(s.element);if(f!==s.element&&A.checkInteractability(f).ok)return A._logger.log(`[HybridTargetResolver] ✅ Using clickable container for hidden winner (${s.confidence.toFixed(1)}%)`),{element:f,confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l};const v=o.find(b=>b.interactable);if(v&&v.confidence>30)return A._logger.log(`[HybridTargetResolver] ✅ Using interactable candidate (${v.confidence.toFixed(1)}%)`),{element:this.getClickableContainer(v.element),confidence:v.confidence,strategies:v.strategies,candidateCount:i.size,ambiguous:c,duration:l}}return A._logger.log(`[HybridTargetResolver] ✅ Winner: ${s.confidence.toFixed(1)}% confidence (${l.toFixed(1)}ms)`),{element:this.getClickableContainer(s.element),confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l}}static isValidCSSSelector(e){if(!e||typeof e!="string")return!1;if(/^(role|text|label|placeholder)=/.test(e))return A._logger.warn(`[HybridTargetResolver] Skipping Playwright-style selector (not CSS): "${e.substring(0,50)}..."`),!1;try{return document.querySelector(e),!0}catch{return A._logger.warn(`[HybridTargetResolver] Invalid CSS selector: "${e.substring(0,50)}..."`),!1}}static executeStrategyMulti(e,n){const r=[];try{switch(e){case"selector":{const i=new Set,o=[n.selector,...n.selectorFallbacks||[]].filter(a=>!!a),s=[];for(const a of o){this.isValidCSSSelector(a)&&s.push(a);const l=Tv(a);l!==a&&this.isValidCSSSelector(l)&&!s.includes(l)&&s.push(l)}for(const a of s)try{document.querySelectorAll(a).forEach(l=>i.add(l))}catch{A._logger.warn(`[HybridTargetResolver] querySelectorAll failed for: "${a.substring(0,50)}..."`)}r.push(...i);break}case"text":n.text&&r.push(...this.findAllByText(n.text));break;case"ariaLabel":n.ariaLabel&&document.querySelectorAll(`[aria-label*="${CSS.escape(n.ariaLabel)}"]`).forEach(i=>r.push(i));break;case"placeholder":n.placeholder&&document.querySelectorAll(`[placeholder*="${CSS.escape(n.placeholder)}"]`).forEach(i=>r.push(i));break;case"role":n.role&&document.querySelectorAll(`[role="${n.role}"]`).forEach(i=>r.push(i));break;case"labelText":{if(n.labelText){let i=n.selector||"";(!i||/react-select-\d+/.test(i))&&(n.role?i=`[role="${n.role}"]`:n.tag?i=n.tag:i="*");const o=this.findElementByLabelText(n.labelText,i);o&&r.push(o)}break}case"optionText":{if(n.optionText){const i=this.findDropdownOptionByText(n.optionText);i&&r.push(i)}break}case"removeChip":{if(n.removeChipText){const i=this.findMultiSelectChipRemoveButton(n.removeChipText);i&&r.push(i)}break}case"tag":{if(n.tag){const i=document.getElementsByTagName(n.tag);for(const o of i)(!n.text||(o.textContent||"").toLowerCase().includes(n.text.toLowerCase()))&&r.push(o)}break}case"domIndex":if(n.domIndex!==void 0){const i=this.findByDomIndex(n.domIndex);i&&r.push(i)}break;case"boundingBox":{if(n.boundingBox){const i=this.findByBoundingBox(n.boundingBox,n.tag,n.text);i&&r.push(i)}break}}}catch(i){A._logger.warn(`[HybridTargetResolver] Strategy "${e}" threw error:`,i)}return r}static findAllByText(e,n){var v,b;const r=[],i=new Set;if(!e)return r;const o=e.trim();if(!o)return r;const s=n||"*",a=this.escapeXPathString(o),l=`//${s}[normalize-space(.)=${a}]`;try{const g=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<g.snapshotLength;S++){const m=g.snapshotItem(S);m&&!this.isDropdownDisplayValue(m)&&!i.has(m)&&(r.push(m),i.add(m))}}catch{}const c=`//${s}[contains(normalize-space(.), ${a})]`;try{const g=document.evaluate(c,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<g.snapshotLength;S++){const m=g.snapshotItem(S);m&&!this.isDropdownDisplayValue(m)&&!i.has(m)&&(r.push(m),i.add(m))}}catch{}const d=[];for(const g of r)if(!this.isInteractiveElement(g)){const S=this.findNearbyInput(g);S&&!i.has(S)&&(A._logger.isDebug&&A._logger.log(`[HybridTargetResolver] → Found nearby input for label "${(v=g.textContent)==null?void 0:v.trim().substring(0,30)}": <${S.tagName.toLowerCase()}>`),d.push(S),i.add(S))}r.push(...d);const h=o.toLowerCase(),f=document.querySelectorAll("input, textarea");for(const g of f){const S=g;if(Mt(S)||i.has(S))continue;const m=((b=S.getAttribute("placeholder"))==null?void 0:b.trim().toLowerCase())||"";if(m===h||m&&m.includes(h)&&h.length/m.length>.6){const w=S.getBoundingClientRect();w.width>0&&w.height>0&&(r.push(S),i.add(S))}}return r}static isInteractiveElement(e){return!!(["INPUT","BUTTON","SELECT","TEXTAREA","A"].includes(e.tagName)||e.getAttribute("role")==="button"||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="textbox"||e.getAttribute("role")==="listbox"||e.getAttribute("contenteditable")==="true"||e.getAttribute("tabindex")!==null&&e.getAttribute("tabindex")!=="-1")}static findNearbyInput(e){if(e.tagName==="LABEL"){const i=e.getAttribute("for");if(i){const o=document.getElementById(i);if(o)return o}}let n=e.nextElementSibling;for(let i=0;i<3&&n;i++){const o=this.findFirstInput(n);if(o)return o;n=n.nextElementSibling}const r=e.parentElement;if(r){const i=r.querySelectorAll('input, textarea, select, [role="combobox"], [role="listbox"], nz-select input, .ant-select input');for(const o of i)if(e.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING){const s=o.getBoundingClientRect();if(s.width>0&&s.height>0)return o}}return null}static findFirstInput(e){if(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="listbox")return e;const n=e.querySelector('input, textarea, select, [role="combobox"], [role="listbox"]');if(n){const r=n.getBoundingClientRect();if(r.width>0&&r.height>0)return n}return null}static computeValidationScore(e,n){var c,d,h;let r=0,i=0,o=!1,s=!1;if(n.role){i+=25;const f=e.getAttribute("role");if(f===n.role)r+=25;else if(f)o=!0;else{const v=e.tagName.toLowerCase(),b=typeof e.className=="string"?e.className:"";v==="div"||v==="span"||e.classList.contains("container")||b.includes("control")||b.includes("wrapper")?r+=10:s=!0}}if(n.role==="combobox"&&e.querySelector('[role="combobox"]')&&(r+=10,i+=10),n.tag){i+=15;const f=e.tagName.toLowerCase(),v=n.tag.toLowerCase();f===v?r+=15:n.role==="combobox"&&(f==="input"||f==="div")&&(r+=10)}if(n.text&&!n.optionText){i+=20;const f=(e.textContent||"").toLowerCase().trim(),v=n.text.toLowerCase().trim();if(n.role==="combobox"&&e.tagName.toLowerCase()==="input"){const b=(c=e.closest('.css-6lmz24, [class*="value-container"], [class*="placeholder"]'))==null?void 0:c.parentElement,g=b==null?void 0:b.querySelector('[class*="placeholder"], [id*="placeholder"]'),S=((d=g==null?void 0:g.textContent)==null?void 0:d.toLowerCase().trim())||"";(S===v||S.includes(v))&&(r+=20)}else if(f===v)r+=20;else if(f.includes(v)){const b=v.length/f.length;b>.8?r+=15:b>.5?r+=8:(new RegExp(`\\b${A.escapeRegex(v)}\\b`,"i").test(f)?r+=2:r+=0,A._logger.isDebug&&A._logger.log(`[HybridTargetResolver] Text length mismatch: "${v}" (${v.length}) in "${f.slice(0,30)}..." (${f.length}), ratio=${b.toFixed(2)}, points=${r}`))}else if(v.includes(f)){const b=f.length/v.length;v.startsWith(f)&&f.length>=15?r+=Math.round(18*b):r+=Math.round(10*b)}}if(n.ariaLabel){i+=15;const f=e.getAttribute("aria-label")||"";f.toLowerCase()===n.ariaLabel.toLowerCase()?r+=15:f.toLowerCase().includes(n.ariaLabel.toLowerCase())&&(r+=10)}if(n.placeholder){i+=15;const f=e.placeholder||"",v=n.placeholder.toLowerCase();if(f.toLowerCase().includes(v))r+=15;else if(n.role==="combobox"){const b=e.closest('[class*="container"]')||e.parentElement,g=b==null?void 0:b.querySelector('[class*="placeholder"], [id*="placeholder"]');(((h=g==null?void 0:g.textContent)==null?void 0:h.toLowerCase().trim())||"").includes(v)&&(r+=15)}}if(n.labelText){i+=20;const f=this.getAssociatedLabelText(e);if(f){const v=f.toLowerCase().trim().replace(/\*$/,"").trim(),b=n.labelText.toLowerCase().trim().replace(/\*$/,"").trim();v===b?r+=20:(v.includes(b)||b.includes(v))&&(r+=15)}}if(n.optionText){i+=15;const v=(e.textContent||"").trim().toLowerCase(),b=n.optionText.toLowerCase().trim();v===b?r+=15:v.includes(b)&&(r+=10)}if(i===0)return 100;let a=Math.round(r/i*100);if(o?(a=Math.round(a*.3),A._logger.log(`[HybridTargetResolver] Role mismatch penalty (30%): ${e.tagName}[role="${e.getAttribute("role")}"] vs target role="${n.role}"`)):s&&(e.closest('[role="listbox"], [role="menu"], [role="tree"]')||(a=Math.round(a*.7),A._logger.log(`[HybridTargetResolver] No role penalty (70%): ${e.tagName} expected role="${n.role}"`))),e.getAttribute("tabindex")==="-1"&&(e.closest('[role="listbox"], [role="menu"], [role="combobox"], .select, [class*="dropdown"]')||e.tagName.toLowerCase()==="input"&&(a=Math.round(a*.85),A._logger.log("[HybridTargetResolver] tabindex=-1 input penalty (85%): likely hidden placeholder"))),n.selector){const f=this.extractSelectorContext(n.selector);if(f.parentTag||f.parentSelector){const v=this.matchesSelectorContext(e,f);v>.5?a=Math.min(100,Math.round(a*1.15)):v<.5&&n.text&&(a=Math.round(a*.7))}}if(n.text){const f=e.tagName.toLowerCase(),v=e.getAttribute("role"),b=["button","a","input","select","textarea"].includes(f),g=["button","link","menuitem","option","tab","checkbox","radio"].includes(v||""),S=e.onclick!==null||e.hasAttribute("onclick"),m=e.closest('button, a, [role="button"], [role="link"]');b||g?(a=Math.min(100,Math.round(a*1.25)),A._logger.log(`[HybridTargetResolver] Interactive element bonus (25%): <${f}> is natively interactive`)):m?a=Math.min(100,Math.round(a*1.15)):S&&(a=Math.min(100,Math.round(a*1.1)))}return a}static computeConfidence(e,n,r){if(n===0)return A._logger.warn("[HybridTargetResolver] computeConfidence: totalStrategies is 0, returning 0"),0;const i=e.strategies.length/n*100,o=e.validationScore;let s=100;try{const c=e.element.getBoundingClientRect();(c.width===0||c.height===0)&&(s=0),e.interactable||(s*=.5)}catch{s=0}let a=0;if(e.strategies.includes("selector"))if(r.text){const c=(e.element.textContent||"").toLowerCase().trim(),d=r.text.toLowerCase().trim();if(c===d)a=100,A._logger.log("[HybridTargetResolver] Selector + exact text match bonus applied");else if(c.includes(d))a=70,A._logger.log("[HybridTargetResolver] Selector + partial text match bonus applied");else if(d.startsWith(c)&&c.length>=15&&c.length/d.length>=.3){const h=c.length/d.length;a=Math.round(70*h),A._logger.log(`[HybridTargetResolver] Selector + truncated text match bonus: ${a} (${Math.round(h*100)}% overlap)`)}else a=20,A._logger.log("[HybridTargetResolver] Selector match but NO text match - reduced bonus")}else a=100,A._logger.log("[HybridTargetResolver] Selector match bonus applied (no text to validate)");return i*.3+o*.4+s*.15+a*.15}static checkInteractability(e){try{if(!e.isConnected)return{ok:!1,reason:"Element is not connected to DOM"};let n;try{n=window.getComputedStyle(e)}catch{return{ok:!1,reason:"Cannot compute style (element may be in different document)"}}if(n.display==="none")return{ok:!1,reason:"Element has display: none"};if(n.visibility==="hidden")return{ok:!1,reason:"Element has visibility: hidden"};const r=parseFloat(n.opacity);if(isNaN(r)||r===0)return{ok:!1,reason:"Element has opacity: 0"};if(n.pointerEvents==="none")return{ok:!1,reason:"Element has pointer-events: none"};if(e.disabled)return{ok:!1,reason:"Element is disabled"};if(e.getAttribute("aria-disabled")==="true")return{ok:!1,reason:"Element has aria-disabled: true"};if(!e.offsetParent&&n.position!=="fixed"&&n.position!=="sticky"){let o=e.parentElement,s=!1;for(;o&&o!==document.body;){try{const a=window.getComputedStyle(o);if(a.position==="fixed"||a.position==="sticky"){s=!0;break}}catch{break}o=o.parentElement}if(!s)return{ok:!1,reason:"Element is not rendered (offsetParent is null)"}}let i;try{i=e.getBoundingClientRect()}catch{return{ok:!1,reason:"Cannot get bounding rect (element may be in different frame)"}}return i.width===0||i.height===0?{ok:!1,reason:"Element has zero dimensions"}:{ok:!0}}catch(n){return A._logger.warn("[HybridTargetResolver] checkInteractability error:",n),{ok:!1,reason:`Error checking interactability: ${n}`}}}static getAvailableStrategies(e){const n=[];return e.labelText&&n.push("labelText"),e.optionText&&n.push("optionText"),e.removeChipText&&n.push("removeChip"),e.selector&&n.push("selector"),e.domIndex!==void 0&&n.push("domIndex"),e.boundingBox&&n.push("boundingBox"),e.placeholder&&n.push("placeholder"),e.ariaLabel&&n.push("ariaLabel"),e.text&&n.push("text"),e.role&&n.push("role"),e.tag&&n.push("tag"),A._logger.log("[HybridTargetResolver] Auto-detected available strategies:",n.join(", ")),n}static findByDomIndex(e){return e===void 0?null:this.domIntrospector?this.domIntrospector.findElementByIndex(e):null}static findByBoundingBox(e,n,r){if(!e)return null;if(this.domIntrospector)return this.domIntrospector.findElementByBoundingBox(e,n,r);const i=10,o=document.body.querySelectorAll("*");let s=null,a=0;return o.forEach(l=>{var g;const c=l;if(Mt(c))return;const d=c.getBoundingClientRect(),h=Math.abs(d.x-e.x),f=Math.abs(d.y-e.y),v=Math.abs(d.width-e.width),b=Math.abs(d.height-e.height);if(h<=i&&f<=i&&v<=i*2&&b<=i*2){let S=100-h-f;n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r&&(((g=c.innerText)==null?void 0:g.trim().toLowerCase())||"").includes(r.toLowerCase())&&(S+=25),S>a&&(a=S,s=c)}}),s}static validateElementMatchesTarget(e,n){var o;if(!n.labelText&&!n.optionText&&!n.role&&!n.ariaLabel&&!n.placeholder&&!n.name&&!n.tag&&!n.text)return!0;const r=[];if(n.tag){const s=e.tagName.toLowerCase(),a=n.tag.toLowerCase();if(s!==a&&["input","select","textarea","button","a"].includes(a))return A._logger.log(`[HybridTargetResolver] Validation failed: tag="${s}" !== expected "${a}"`),!1;r.push("tag")}if(n.text&&!n.optionText){const s=(e.textContent||"").trim().toLowerCase(),a=n.text.trim().toLowerCase(),l=s===a,c=s.includes(a)||a.includes(s);if(!l&&!c)return A._logger.log(`[HybridTargetResolver] Validation failed: text="${s.slice(0,50)}" !== expected "${a}"`),!1;if(a.length<=10&&!l){const d=a.length/Math.max(s.length,1);if(d<.5)return A._logger.log(`[HybridTargetResolver] Validation failed: text match ratio too low (${d.toFixed(2)})`),!1}r.push("text")}const i=(s,a)=>{const l=s.toLowerCase().trim().replace(/\*$/,"").trim(),c=a.toLowerCase().trim();return l===c?!0:new RegExp(`(^|\\s)${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(s)};if(n.role){const s=e.getAttribute("role");if(s!==n.role)return A._logger.log(`[HybridTargetResolver] Validation failed: role="${s}" !== expected "${n.role}"`),!1;r.push("role")}if(n.ariaLabel){const s=e.getAttribute("aria-label")||"";if(!i(s,n.ariaLabel))return A._logger.log(`[HybridTargetResolver] Validation failed: aria-label="${s}" !== expected "${n.ariaLabel}"`),!1;r.push("ariaLabel")}if(n.placeholder){const s=e.placeholder||"";if(!i(s,n.placeholder))return A._logger.log(`[HybridTargetResolver] Validation failed: placeholder="${s}" !== expected "${n.placeholder}"`),!1;r.push("placeholder")}if(n.name){const s=e.getAttribute("name")||"";if(s!==n.name)return A._logger.log(`[HybridTargetResolver] Validation failed: name="${s}" !== expected "${n.name}"`),!1;r.push("name")}if(n.labelText){const s=this.getAssociatedLabelText(e);if(!s||!i(s,n.labelText))return A._logger.log(`[HybridTargetResolver] Validation failed: associated label="${s}" !== expected "${n.labelText}"`),!1;A._logger.log(`[HybridTargetResolver] ✓ Label validation passed: "${s}" matches "${n.labelText}"`),r.push("labelText")}if(n.optionText){const s=((o=e.textContent)==null?void 0:o.trim())||"";if(!i(s,n.optionText))return A._logger.log(`[HybridTargetResolver] Validation failed: option text="${s}" !== expected "${n.optionText}"`),!1;r.push("optionText")}return r.length>0&&A._logger.log(`[HybridTargetResolver] ✓ Validated: ${r.join(", ")}`),!0}static getAssociatedLabelText(e){var s,a,l,c;const n=e.getAttribute("id");if(n)try{const d=document.querySelector(`label[for="${CSS.escape(n)}"]`);if(d)return((s=d.textContent)==null?void 0:s.trim().replace(/\*$/,"").trim())||null}catch{}const r=e.getAttribute("aria-labelledby");if(r){const d=r.split(/\s+/).filter(h=>h.length>0);for(const h of d){const f=document.getElementById(h);if(f)return((a=f.textContent)==null?void 0:a.trim().replace(/\*$/,"").trim())||null}}let i=e.parentElement,o=0;for(;i&&o<8;){const d=i.querySelectorAll('label, .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"], .label');for(const h of d){if(e.contains(h)||h.contains(e)||h.querySelector('input, select, textarea, [role="combobox"]'))continue;if(i.querySelectorAll('input, select, textarea, [role="combobox"]').length===1){const v=(l=h.textContent)==null?void 0:l.trim().replace(/\*$/,"").trim();if(v&&v.length>0&&v.length<50)return v}else if(this.isLabelForElement(h,e,i)){const v=(c=h.textContent)==null?void 0:c.trim().replace(/\*$/,"").trim();if(v&&v.length>0&&v.length<50)return v}}i=i.parentElement,o++}return null}static isLabelForElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect(),s=i.bottom<=o.top+30,a=i.right<=o.left+30&&Math.abs(i.top-o.top)<60;if(!s&&!a)return!1;const l=r.querySelectorAll('input, select, textarea, [role="combobox"]');if(l.length<=1)return!0;for(const c of l){if(c===n)continue;const d=c.getBoundingClientRect();if(s&&(d.top>=i.bottom-5&&d.bottom<o.top||Math.abs(d.left-i.left)<Math.abs(o.left-i.left)&&d.top<o.top))return!1;if(a){const h=Math.abs(d.left-i.right),f=Math.abs(o.left-i.right);if(h<f&&Math.abs(d.top-i.top)<40)return!1}}return!0}static isTextNearElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect();if(i.width===0||i.height===0||o.width===0||o.height===0)return(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;const s=i.bottom<=o.top+40,a=i.right<=o.left+20&&Math.abs(i.top-o.top)<50;if(!s&&!a)return!1;for(const l of r){if(l===n)continue;const c=l.getBoundingClientRect();if(!(c.width===0||c.height===0)){if(s&&c.top>=i.bottom-10&&c.bottom<o.top||s&&Math.abs(c.left-i.left)<Math.abs(o.left-i.left)-20&&c.top<o.top&&c.top>=i.bottom-50)return!1;if(a){const d=Math.abs(c.left-i.right),h=Math.abs(o.left-i.right);if(d<h-10&&Math.abs(c.top-i.top)<40)return!1}}}return!0}static isHiddenPlaceholderInput(e){const n=e.tagName.toLowerCase(),r=e.getAttribute("role");if(r==="option"||r==="menuitem"||r==="treeitem"||e.closest('[role="listbox"], [role="menu"], [role="tree"]')||n!=="input"&&!r)return!1;if(e.getAttribute("tabindex")==="-1"&&n==="input")return A._logger.log('[HybridTargetResolver] → Input has tabindex="-1" (hidden placeholder)'),!0;try{const o=window.getComputedStyle(e);if(o.opacity==="0")return A._logger.log("[HybridTargetResolver] → Element has opacity: 0 (hidden placeholder)"),!0;if(o.visibility==="hidden")return A._logger.log("[HybridTargetResolver] → Element has visibility: hidden (hidden placeholder)"),!0;const s=e.getBoundingClientRect();if(s.width<=5&&s.height<=5)return A._logger.log(`[HybridTargetResolver] → Element is too small (${s.width}x${s.height}) - hidden placeholder`),!0;if(o.position==="absolute"){const a=e.parentElement;if(a&&a.getBoundingClientRect().width>s.width*10&&s.width<20)return A._logger.log("[HybridTargetResolver] → Element is tiny absolute-positioned (hidden placeholder)"),!0}}catch{}return!1}static getClickableContainer(e){var o,s,a;if(!this.isHiddenPlaceholderInput(e))return e;A._logger.log("[HybridTargetResolver] → Looking for clickable container...");const n=['[class*="-control"]','[class*="control"]',".MuiSelect-select",".MuiInputBase-root",".MuiOutlinedInput-root",".MuiRadio-root",".MuiCheckbox-root",".MuiFormControlLabel-root",".ant-radio-wrapper",".ant-radio-button-wrapper",".ant-checkbox-wrapper","nz-radio","nz-radio-button","nz-checkbox","[nz-radio]","[nz-radio-button]","[nz-checkbox]",'[role="button"]','[role="combobox"]:not(input)','[role="radio"]','[role="checkbox"]','[aria-haspopup="listbox"]','[class*="select-container"]','[class*="dropdown-container"]','[class*="picker"]','[class*="radio-wrapper"]','[class*="checkbox-wrapper"]'];let r=e.parentElement,i=0;for(;r&&i<6;){if(r.tagName==="LABEL"){const c=r.getBoundingClientRect();if(c.width>10&&c.height>10)return A._logger.log(`[HybridTargetResolver] → Found clickable container (label): ${r.tagName}.${(o=r.className)==null?void 0:o.split(" ").slice(0,2).join(".")}`),r}for(const c of n)try{if(r.matches(c)){const d=r.getBoundingClientRect();if(d.width>10&&d.height>10)return A._logger.log(`[HybridTargetResolver] → Found clickable container: ${r.tagName}.${(s=r.className)==null?void 0:s.split(" ").slice(0,2).join(".")}`),r}}catch{}const l=r.getBoundingClientRect();if(l.width>100&&l.height>30){const c=r.getAttribute("role"),d=r.onclick!==null||r.getAttribute("onclick")!==null||r.classList.contains("clickable");if(c==="button"||c==="combobox"||d||r.querySelector('input[role="combobox"]')===e)return A._logger.log(`[HybridTargetResolver] → Found clickable container (generic): ${r.tagName}.${(a=r.className)==null?void 0:a.split(" ").slice(0,2).join(".")}`),r}r=r.parentElement,i++}return A._logger.log("[HybridTargetResolver] → No clickable container found, using original element"),e}static findBySelector(e){if(!e)return null;const n=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\");A._logger.log(`[HybridTargetResolver] → Normalized selector: "${n}"`);const r=n.match(/\[data-option-text="([^"]+)"\]/);if(r){const l=r[1];return A._logger.log(`[HybridTargetResolver] → Virtual selector - searching for option text: "${l}"`),this.findDropdownOptionByText(l)}const i=n.match(/\[data-label="([^"]+)"\]/);if(i){const l=i[1];return A._logger.log(`[HybridTargetResolver] → Virtual selector - searching for combobox with label: "${l}"`),this.findComboboxByLabel(l)}const o=n.replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim();if(/#?react-select-\d+-(input|listbox|option|placeholder|live-region)/.test(o))return A._logger.log(`[HybridTargetResolver] → Detected unstable React-Select ID pattern in "${o}", skipping selector strategy`),null;if(o==='input[role="combobox"]'||o==='[role="combobox"]'){const l=document.querySelectorAll(o);l.length>1&&(A._logger.warn(`[HybridTargetResolver] ⚠️ AMBIGUOUS SELECTOR: "${o}" matches ${l.length} elements!`),A._logger.warn("[HybridTargetResolver] ⚠️ Bot should send more specific targeting (text, label, boundingBox, domIndex)"),l.forEach((c,d)=>{const h=c,f=h.getAttribute("placeholder")||"",v=h.getAttribute("aria-label")||"",b=h.id||"";A._logger.log(`[HybridTargetResolver] ${d}: id="${b}" placeholder="${f}" aria-label="${v}"`)}))}const a=document.querySelector(o);return a?this.isAccessibilityOnlyElement(a)?(A._logger.log(`[HybridTargetResolver] → Selector matched a11y-only element (class: ${a.className}), skipping`),null):a:(A._logger.log(`[HybridTargetResolver] → Selector "${o}" matched 0 elements`),null)}static isAccessibilityOnlyElement(e){const n=typeof e.className=="string"?e.className:"",r=(e.textContent||"").trim();if(n.includes("a11yText")&&!r||n.includes("sr-only")||n.includes("visually-hidden")||n.includes("screenreader")||n.includes("screen-reader")||e.getAttribute("aria-live")&&!r||e.getAttribute("role")==="log"&&!r)return!0;try{const i=getComputedStyle(e);if(i.position==="absolute"&&(i.width==="1px"||i.height==="1px"||i.clip==="rect(0px, 0px, 0px, 0px)"||i.clipPath==="inset(50%)"))return!0}catch{}return!1}static isDropdownDisplayValue(e){var a;const n=(e.className||"").toLowerCase(),r=(((a=e.parentElement)==null?void 0:a.className)||"").toLowerCase(),i=["singlevalue","single-value","selectedvalue","selected-value","placeholder","value-container","valuecontainer","muiselect-select","select__single-value"];for(const l of i)if(n.includes(l)||r.includes(l))return!0;const o=e.closest('[class*="-control"]:not([class*="-menu"])'),s=!e.closest('[role="listbox"], [role="menu"], [class*="-menu"]');return!!(o&&s)}static findDropdownOptionByText(e){return Bo(e,A.isVisible)}static findMultiSelectChipRemoveButton(e){var i;const n=e.toLowerCase().trim();A._logger.log(`[HybridTargetResolver] → Searching for multi-select chip: "${e}"`);const r=['[class*="multiValue"]','[class*="multi-value"]','[class*="chip"]','[class*="tag"]',"[data-tag]"];for(const o of r){let s;try{s=document.querySelectorAll(o)}catch{continue}for(const a of s){const l=a;if(!this.isVisible(l))continue;const c=l.querySelector('[class*="label"], [class*="Label"], span:first-of-type'),d=c?(c.textContent||"").trim().toLowerCase():(l.textContent||"").replace(/×|✕|x/gi,"").trim().toLowerCase();if(d===n||d.includes(n)||n.includes(d)){A._logger.log(`[HybridTargetResolver] → Found chip with text: "${(i=l.textContent)==null?void 0:i.trim().substring(0,30)}..."`);const h=['[role="button"]','[class*="remove"]','[class*="Remove"]','[class*="clear"]','[class*="delete"]','[aria-label*="Remove"]','[aria-label*="remove"]','[aria-label*="Delete"]','[aria-label*="delete"]',"button","svg"];for(const f of h){const v=l.querySelector(f);if(v&&this.isVisible(v))return A._logger.log(`[HybridTargetResolver] → Found remove button: <${v.tagName.toLowerCase()}> with selector "${f}"`),v}return A._logger.log("[HybridTargetResolver] → No specific remove button found, returning chip container"),l}}}return A._logger.log(`[HybridTargetResolver] → No chip found with text: "${e}"`),null}static findComboboxByLabel(e){const n=e.toLowerCase().trim(),r=a=>a.toLowerCase().trim().replace(/\*$/,"").trim()===n?!0:new RegExp(`(^|\\s)${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(a),i=document.querySelectorAll("label[for]");for(const a of i)if(r(a.textContent||"")){const l=a.getAttribute("for");if(l){const c=document.getElementById(l);if(c&&(c.getAttribute("role")==="combobox"||c.getAttribute("aria-haspopup")==="listbox"))return A._logger.log(`[HybridTargetResolver] → Found combobox via label[for]: "${e}"`),c}}const o=document.querySelectorAll('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');for(const a of o){const l=a.getAttribute("aria-labelledby");if(l){const c=document.getElementById(l.split(/\s+/)[0]);if(c&&r(c.textContent||""))return A._logger.log(`[HybridTargetResolver] → Found combobox via aria-labelledby: "${e}"`),a}}const s=document.querySelectorAll("label");for(const a of s)if(r(a.textContent||"")){const l=a.closest('fieldset, [role="group"], form > div, [class*="form"], [class*="field"]')||a.parentElement;if(l){const c=l.querySelector('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');if(c&&this.isElementVisible(c))return A._logger.log(`[HybridTargetResolver] → Found combobox in label container: "${e}"`),c}}return null}static isElementVisible(e){const n=e.getBoundingClientRect();if(n.width===0||n.height===0)return!1;if(!e.offsetParent)try{const r=window.getComputedStyle(e);if(r.position!=="fixed"&&r.position!=="sticky")return!1}catch{return!1}return!0}static findElementByLabelText(e,n){var v,b,g;const i=n.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim(),o=i.toLowerCase().trim(),s=["*","div","span","p","a","li","ul","section","article"],a=/\[role=/.test(i);if(s.includes(o)&&!a)return null;let l;try{l=document.querySelectorAll(i)}catch{return A._logger.warn(`[HybridTargetResolver] → Invalid selector: "${i}"`),null}if(l.length===0)return null;A._logger.log(`[HybridTargetResolver] → Looking for "${i}" associated with label "${e}"`),A._logger.log(`[HybridTargetResolver] → Found ${l.length} elements matching selector`);const c=e.toLowerCase().trim();function d(S){return S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const h=S=>S.toLowerCase().trim().replace(/\*$/,"").trim()===c?!0:new RegExp(`(^|\\s)${d(c)}($|\\s|[:\\*\\?\\.\\,\\)\\]\\}\\-])`,"i").test(S),f=S=>{const m=S,w=m.getBoundingClientRect();if(w.width===0||w.height===0)return!1;if(!m.offsetParent)try{const C=window.getComputedStyle(m).position;if(C!=="fixed"&&C!=="sticky")return!1}catch{return!1}return!0};for(const S of l){if(!f(S))continue;const m=S.getAttribute("id");if(m)try{const L=document.querySelector(`label[for="${CSS.escape(m)}"]`);if(L&&h(L.textContent||""))return A._logger.log("[HybridTargetResolver] → Found via label[for] attribute"),S}catch{}const w=S.getAttribute("aria-labelledby");if(w){const L=w.split(/\s+/).filter(F=>F.length>0);for(const F of L){const Y=document.getElementById(F);if(Y&&h(Y.textContent||""))return A._logger.log("[HybridTargetResolver] → Found via aria-labelledby"),S}}const k=S.getAttribute("aria-label")||"";if(k&&h(k))return A._logger.log("[HybridTargetResolver] → Found via aria-label"),S;const C=S.getAttribute("placeholder")||"";if(C&&h(C))return A._logger.log("[HybridTargetResolver] → Found via placeholder"),S;let M=S.parentElement,P=0;for(;M&&P<6;){const L=M.querySelectorAll('input, select, textarea, [role="combobox"], [role="listbox"]'),F=Array.from(L),Y=F.includes(S),W=M.classList.contains("MuiFormControl-root")||M.tagName==="FIELDSET"||/form(-|_)?(field|group|control|item|row)/i.test(M.className)||M.childElementCount>=2&&M.childElementCount<=5,H=M.querySelectorAll('label, [class*="label"]:not(input):not(select):not(textarea):not([role="combobox"]), .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"]');for(const Q of H){if(S.contains(Q)||Q.contains(S)||Q.querySelector('input, select, textarea, [role="combobox"]'))continue;const q=((v=Q.textContent)==null?void 0:v.trim())||"";if(!(q.length>50)&&h(q)){if(L.length===1&&Y)return A._logger.log(`[HybridTargetResolver] → Found via label in container: "${q}"`),S;if(Y&&this.isTextNearElement(Q,S,F))return A._logger.log(`[HybridTargetResolver] → Found via label position: "${q}"`),S}}if(W||P>=3){const Q=M.querySelectorAll(":scope > div, :scope > span, :scope > p, :scope > div > div, :scope > div > span, :scope > div > p");for(const q of Q){if(q.querySelector('input, select, textarea, [role="combobox"]')||q.contains(S)||S.contains(q))continue;const ae=S.value||"";if(ae&&((b=q.textContent)==null?void 0:b.trim())===ae)continue;const J=((g=q.textContent)==null?void 0:g.trim())||"";if(J.length>0&&J.length<=30&&h(J)){if(L.length===1&&Y)return A._logger.log(`[HybridTargetResolver] → Found via nearby text: "${J}"`),S;if(Y&&this.isTextNearElement(q,S,F))return A._logger.log(`[HybridTargetResolver] → Found via nearby text (position): "${J}"`),S}}}M=M.parentElement,P++}}return null}static escapeXPathString(e){const n=e.replace(/[\n\r\t]+/g," ").replace(/\s+/g," ").trim();if(n.includes('"')&&n.includes("'")){const r=n.split('"');return`concat(${r.map((o,s)=>s===r.length-1?`"${o}"`:`"${o}", '"'`).join(", ")})`}return n.includes('"')?`'${n}'`:`"${n}"`}static escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}static findByText(e,n,r){var C,M,P,L,F,Y,W;if(!e)return null;const i=e.trim();if(!i)return null;const o=i.toLowerCase(),s=n||"*",a=this.escapeXPathString(i);if(r){const H=this.findElementByLabelText(i,r);if(H)return A._logger.log(`[HybridTargetResolver] → Found element matching selector "${r}" associated with label "${i}"`),H}const l=`//${s}[normalize-space(.)=${a}]`;A._logger.log(`[HybridTargetResolver] → XPath exact query: ${l}`);let c;try{c=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(H){A._logger.warn("[HybridTargetResolver] → XPath query failed:",H),c={snapshotLength:0,snapshotItem:()=>null}}if(c.snapshotLength>0){A._logger.log(`[HybridTargetResolver] → Found ${c.snapshotLength} exact match(es), checking visibility...`);let H=null,Q=null;for(let q=0;q<c.snapshotLength;q++){const ae=c.snapshotItem(q);if(Q||(Q=ae),this.isDropdownDisplayValue(ae)){A._logger.log(`[HybridTargetResolver] → Skipping display value (not an option): "${(C=ae.textContent)==null?void 0:C.trim().substring(0,30)}..."`);continue}const J=ae.getBoundingClientRect();if(J.width>0&&J.height>0){H=ae,A._logger.log(`[HybridTargetResolver] → Returning visible match ${q}: "${(M=ae.textContent)==null?void 0:M.trim().substring(0,30)}..."`);break}}if(H)return H;if(Q&&!this.isDropdownDisplayValue(Q))return A._logger.log("[HybridTargetResolver] → No visible matches, returning first (possibly hidden) element"),Q}A._logger.log("[HybridTargetResolver] → No exact match, trying partial match...");const d=`//${s}[contains(normalize-space(.), ${a})]`;A._logger.log(`[HybridTargetResolver] → XPath partial query: ${d}`);let h;try{h=document.evaluate(d,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(H){A._logger.warn("[HybridTargetResolver] → XPath partial query failed:",H),h={snapshotLength:0,snapshotItem:()=>null}}if(h.snapshotLength>0){let H=null,Q=-1;const q=r?this.extractSelectorContext(r):{},ae=!!(q.parentTag||q.parentSelector);A._logger.log(`[HybridTargetResolver] → Selector context: parentTag="${q.parentTag||"none"}", expectedTag="${q.expectedTag||"none"}"`);for(let J=0;J<h.snapshotLength;J++){const K=h.snapshotItem(J),re=(K.textContent||"").trim();if(re.length===0)continue;const j=re.toLowerCase(),z=o.length/j.length,B=K.getBoundingClientRect();if(B.width===0||B.height===0||this.isDropdownDisplayValue(K))continue;let le=z;if(new RegExp(`\\b${A.escapeRegex(o)}\\b`,"i").test(j))le+=.5;else if(z<.5)if(ae){if(this.matchesSelectorContext(K,q)<.5){A._logger.log(`[HybridTargetResolver] → Skipping low ratio match that doesn't match selector context: "${re.slice(0,30)}..."`);continue}}else{A._logger.log(`[HybridTargetResolver] → Skipping low ratio match (${z.toFixed(2)}): "${re.slice(0,30)}..."`);continue}if(ae){const y=this.matchesSelectorContext(K,q);le+=y*.3}le>Q&&(Q=le,H=K)}if(H)return A._logger.log(`[HybridTargetResolver] → XPath partial match found (score=${Q.toFixed(2)})!`),H}A._logger.log("[HybridTargetResolver] → XPath found nothing, trying fallback...");const f=document.querySelectorAll(n||"*");A._logger.isDebug&&A._logger.log(`[HybridTargetResolver] → Fallback: checking ${f.length} <${n||"*"}> elements for text "${i}"`);const v=H=>{const Q=H;return Mt(Q)?!0:Q.id==="root"||Q.id==="app"||Q.id==="__next"||Q.tagName==="BODY"||Q.tagName==="HTML"};for(const H of f){if(v(H)||(((P=H.textContent)==null?void 0:P.trim().toLowerCase())||"")!==o)continue;const q=H.getBoundingClientRect();if(q.width>0&&q.height>0&&(((L=H.innerText)==null?void 0:L.trim().toLowerCase())||"")===o)return A._logger.log("[HybridTargetResolver] → Found via exact text match"),H}let b=null,g=-1/0;for(const H of f){if(v(H))continue;const Q=((F=H.textContent)==null?void 0:F.trim().toLowerCase())||"";if(Q.length!==0&&Q.includes(o)){const q=o.length/Q.length,ae=H.getBoundingClientRect(),J=ae.width*ae.height;if(J>0&&J<5e5){const K=Math.max(0,50-J/1e4),re=q*50,j=K+re;j>g&&(g=j,b=H)}}}if(b){const H=b.getBoundingClientRect();return A._logger.log(`[HybridTargetResolver] → Found via textContent (${H.width.toFixed(0)}x${H.height.toFixed(0)}px, score=${g.toFixed(0)})`),b}const S=n&&["input","textarea"].includes(n.toLowerCase())?n.toLowerCase():"input, textarea",m=document.querySelectorAll(S);A._logger.log(`[HybridTargetResolver] → Checking ${m.length} input/textarea elements for placeholder "${i}"`);for(const H of m){const Q=H;if(Mt(Q))continue;const q=((Y=Q.getAttribute("placeholder"))==null?void 0:Y.trim())||"";if(q.toLowerCase()===o){const ae=Q.getBoundingClientRect();if(ae.width>0&&ae.height>0)return A._logger.log(`[HybridTargetResolver] → Found via placeholder match: "${q}"`),Q}}let w=null,k=0;for(const H of m){const Q=H;if(Mt(Q))continue;const q=((W=Q.getAttribute("placeholder"))==null?void 0:W.trim().toLowerCase())||"";if(q&&q.includes(o)){const ae=o.length/q.length;if(ae>.6&&ae>k){const J=Q.getBoundingClientRect();J.width>0&&J.height>0&&(w=Q,k=ae)}}}return w?(A._logger.log(`[HybridTargetResolver] → Found via partial placeholder match (ratio=${k.toFixed(2)})`),w):null}static findByAriaLabel(e){if(!e)return null;let n=document.querySelector(`[aria-label="${e}"]`);if(n)return A._logger.log("[HybridTargetResolver] → Found via exact aria-label match"),n;const r=document.querySelectorAll("[aria-label]");A._logger.log(`[HybridTargetResolver] → Checking ${r.length} elements with aria-label`);for(const i of r){const o=i.getAttribute("aria-label")||"";if(o.toLowerCase().includes(e.toLowerCase()))return A._logger.log(`[HybridTargetResolver] → Found via partial aria-label match: "${o}"`),i}return null}static findByPlaceholder(e){if(!e)return null;let n=document.querySelector(`[placeholder="${e}"]`);if(n)return A._logger.log("[HybridTargetResolver] → Found via exact placeholder match"),n;const r=document.querySelectorAll("input, textarea");A._logger.log(`[HybridTargetResolver] → Checking ${r.length} input/textarea elements`);for(const i of r){const o=i.getAttribute("placeholder")||"";if(o.toLowerCase().includes(e.toLowerCase()))return A._logger.log(`[HybridTargetResolver] → Found via partial placeholder match: "${o}"`),i}return null}static findByRole(e,n){var i;if(!e)return null;const r=document.querySelectorAll(`[role="${e}"]`);if(A._logger.log(`[HybridTargetResolver] → Found ${r.length} elements with role="${e}"`),n){for(const o of r)if((((i=o.textContent)==null?void 0:i.trim())||"").toLowerCase().includes(n.toLowerCase()))return A._logger.log("[HybridTargetResolver] → Found role element with matching text"),o}return r[0]||null}static findByTag(e,n){var i,o,s;if(!e)return null;const r=document.getElementsByTagName(e);if(A._logger.log(`[HybridTargetResolver] → Found ${r.length} <${e}> elements`),n){const a=n.toLowerCase().trim();let l=null,c=null,d=0;for(const h of r){const f=h;if(f.id==="root"||f.id==="app"||f.tagName==="BODY"||f.tagName==="HTML"||!A.isVisible(f)||(((i=f.innerText)==null?void 0:i.length)||0)>200)continue;const b=((o=f.innerText)==null?void 0:o.trim())||"",g=b.toLowerCase();if(g===a){A._logger.log(`[HybridTargetResolver] → Found exact match: "${b.substring(0,50)}..."`),l=f;break}if(g.includes(a)){const S=a.length/g.length;S>.7&&S>d&&(c=f,d=S)}}if(l)return l;if(c){const h=((s=c.innerText)==null?void 0:s.trim().substring(0,50))||"";return A._logger.log(`[HybridTargetResolver] → Found close match (${(d*100).toFixed(0)}%): "${h}..."`),c}return A._logger.log(`[HybridTargetResolver] → No matching <${e}> found for text "${n}"`),null}if(e==="div"||e==="span")return A._logger.log(`[HybridTargetResolver] → REFUSING to blindly return first <${e}> - too ambiguous without text`),null;for(const a of r){const l=a;if(l.id==="root"||l.id==="app"||l.tagName==="BODY"||l.tagName==="HTML"||l.classList.contains("App"))continue;const c=l.getBoundingClientRect();if(!(c.width>500&&c.height>500)&&c.width>0&&c.height>0)return l}return null}static isVisible(e){const n=e.getBoundingClientRect(),r=window.getComputedStyle(e);return n.width>0&&n.height>0&&r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}static scrollIntoView(e,n){A._logger.log("[HybridTargetResolver] 📜 Scrolling element into view"),e.scrollIntoView({behavior:"smooth",block:"center",...n})}static async waitForPositionStability(e,n=1e3,r=50,i=2){A._logger.log("[HybridTargetResolver] ⏳ Waiting for element position stability...");let o=e.getBoundingClientRect(),s=0;const a=3,l=Date.now();for(;Date.now()-l<n;){await new Promise(f=>setTimeout(f,r));const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return A._logger.warn("[HybridTargetResolver] ⚠️ Element disappeared during stability check"),null;const d=Math.abs(c.x-o.x),h=Math.abs(c.y-o.y);if(d<i&&h<i){if(s++,s>=a)return A._logger.log(`[HybridTargetResolver] ✅ Element position stable at (${c.x.toFixed(0)}, ${c.y.toFixed(0)}) after ${Date.now()-l}ms`),c}else s=0,A._logger.log(`[HybridTargetResolver] 📍 Element still moving: (${o.x.toFixed(0)}, ${o.y.toFixed(0)}) → (${c.x.toFixed(0)}, ${c.y.toFixed(0)})`);o=c}return A._logger.warn(`[HybridTargetResolver] ⚠️ Position stability timeout after ${n}ms`),e.getBoundingClientRect()}static reResolveAndVerify(e,n){var a,l,c;const r={text:e.text,selector:e.selector,selectorFallbacks:e.selectorFallbacks,tag:e.tag,ariaLabel:e.ariaLabel,placeholder:e.placeholder,role:e.role,labelText:e.labelText,optionText:e.optionText,name:e.name,removeChipText:e.removeChipText,dropdownTriggerSelector:e.dropdownTriggerSelector,selectedValues:e.selectedValues,strategy:(a=e.strategy)==null?void 0:a.filter(d=>d!=="boundingBox"&&d!=="domIndex")};A._logger.log("[HybridTargetResolver] 🔄 Re-resolving with position-independent target (no boundingBox/domIndex)");const i=this.resolveTarget(r);if(!i)return A._logger.warn("[HybridTargetResolver] ⚠️ Re-resolution failed - element no longer found"),null;const o=((l=n.textContent)==null?void 0:l.trim().toLowerCase())||"",s=((c=i.textContent)==null?void 0:c.trim().toLowerCase())||"";return o!==s&&o&&s&&A._logger.warn(`[HybridTargetResolver] ⚠️ Element changed during wait: "${o}" → "${s}"`),i}};D(A,"domIntrospector",null),D(A,"_logger",de);let be=A;class u_{constructor(e=de){D(this,"confirmationSound");D(this,"logger");D(this,"lastError",null);this.logger=e,be.setLogger(e),this.confirmationSound=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=")}humanLikeClick(e,n={}){return Ov(e,n)}async executeWithConsent(e,n=!0){try{if(n&&this.isDestructive(e)&&!await this.getConsent(e))return!1;const r=await this.execute(e);return r&&(this.confirmationSound.play().catch(()=>{}),this.logger.log(`[ActionExecutor] Executed ${e.type} on ${e.selector}`)),r}catch(r){return this.logger.error("[ActionExecutor] Failed to execute action:",r),!1}}async executeHybridAction(e,n=!0){this.lastError=null;try{if(this.logger.log("[ActionExecutor] Executing hybrid action:",e),e.action==="navigate"){const s=e.value;if(!s)return this.logger.error("[ActionExecutor] Navigate action missing target URL"),this.lastError="Navigate action missing target URL",!1;let a;try{const l=new URL(s,window.location.origin);if(l.protocol!=="http:"&&l.protocol!=="https:")return this.logger.error("[ActionExecutor] Navigate blocked — disallowed scheme:",l.protocol),this.lastError=`Navigate blocked: disallowed URL scheme "${l.protocol}"`,!1;if(l.origin!==window.location.origin)return this.logger.error("[ActionExecutor] Navigate blocked — cross-origin URL:",l.origin),this.lastError="Navigate blocked: cross-origin URL not allowed",!1;a=l.href}catch{return this.logger.error("[ActionExecutor] Navigate blocked — invalid URL:",s),this.lastError=`Navigate blocked: invalid URL "${s}"`,!1}this.logger.log("[ActionExecutor] 🧭 Navigating to URL:",a);try{const l=new URL(a),c=window.location.href,d=l.hash!==window.location.hash,h=l.pathname+l.search+l.hash;return history.pushState(null,"",h),window.dispatchEvent(new PopStateEvent("popstate",{state:null})),d&&window.dispatchEvent(new HashChangeEvent("hashchange",{oldURL:c,newURL:l.href})),!0}catch{}return window.location.href=a,!0}if(e.target.optionText&&e.action==="click"){this.logger.log("[ActionExecutor] 🔽 Dropdown option click detected:",e.target.optionText);let s=be.resolveTarget(e.target);if(!s){this.logger.log("[ActionExecutor] Option not visible - dropdown may be closed, attempting to open...");let a=!1;if(e.target.dropdownTriggerSelector){this.logger.log("[ActionExecutor] Using dropdownTriggerSelector:",e.target.dropdownTriggerSelector);const l=Mv(e.target.dropdownTriggerSelector);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.labelText){this.logger.log("[ActionExecutor] Trying to find dropdown by label:",e.target.labelText);const l=this.findComboboxByLabel(e.target.labelText);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.selector){this.logger.log("[ActionExecutor] Trying to find dropdown by selector:",e.target.selector);const l={...e.target,optionText:void 0},c=be.resolveTarget(l);if(c){const d=this.findComboboxInput(c);d&&(this.handleComboboxClick(d),a=!0)}}if(a){if(this.logger.log("[ActionExecutor] Waiting for dropdown to open..."),await new Promise(l=>setTimeout(l,300)),s=be.resolveTarget(e.target),!s)return this.logger.warn("[ActionExecutor] ❌ Option still not found after opening dropdown:",e.target.optionText),!1;this.logger.log("[ActionExecutor] ✅ Found option after opening dropdown")}else return this.logger.warn("[ActionExecutor] ❌ Could not open dropdown - no trigger found. Add a separate task to open the dropdown first."),!1}return n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e)?!1:(be.scrollIntoView(s),await new Promise(a=>setTimeout(a,100)),this.performClick(s),this.confirmationSound.play().catch(()=>{}),this.logger.log(`[ActionExecutor] ✅ Successfully clicked dropdown option: "${e.target.optionText}"`),!0)}const r=be.resolveTarget(e.target);if(!r)return this.logger.warn("[ActionExecutor] Could not resolve target:",e.target),!1;if(n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e))return!1;const i=e.target.selector,o=await this.executeOnElement(e.action,r,e.value,i);return o&&(this.confirmationSound.play().catch(()=>{}),this.logger.log(`[ActionExecutor] Successfully executed "${e.action}" on element`)),o}catch(r){return this.logger.error("[ActionExecutor] Failed to execute hybrid action:",r),this.lastError=r instanceof Error?r.message:String(r),!1}}async executeOnElement(e,n,r,i){var o;switch(be.scrollIntoView(n),await new Promise(s=>setTimeout(s,300)),e){case"click":await this.expandCollapsedContainer(n),this.simulateClick(n,i);break;case"type":if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)n.focus(),n.value=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}));else if(n.getAttribute("contenteditable")==="true")n.focus(),n.textContent=r||"",n.dispatchEvent(new Event("input",{bubbles:!0}));else return console.error(`[ActionExecution] BLOCKED: type action on non-editable element <${n.tagName.toLowerCase()}> (id="${n.id}", class="${(o=n.className)==null?void 0:o.toString().slice(0,50)}"). Only input, textarea, and contenteditable elements are valid type targets.`),!1;break;case"focus":n.focus();break;case"hover":n.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),n.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":n.scrollIntoView({behavior:"smooth",block:"center"});break;case"highlight":n.style.outline="3px solid #00aaff",n.style.outlineOffset="2px";break;default:return this.logger.warn("[ActionExecutor] Unknown action type:",e),!1}return!0}async expandCollapsedContainer(e){const n=this.findCollapsedContainer(e);if(n){this.logger.log("[ActionExecutor] Found collapsed container, hovering to expand...");const r=n.getBoundingClientRect(),i=r.left+r.width/2,o=r.top+r.height/2,s={bubbles:!0,cancelable:!0,view:window,clientX:i,clientY:o};n.dispatchEvent(new MouseEvent("mouseenter",s)),n.dispatchEvent(new MouseEvent("mouseover",s));const a=e.getBoundingClientRect(),l={bubbles:!0,cancelable:!0,view:window,clientX:a.left+a.width/2,clientY:a.top+a.height/2};e.dispatchEvent(new MouseEvent("mouseenter",l)),e.dispatchEvent(new MouseEvent("mouseover",l)),await new Promise(c=>setTimeout(c,400)),this.logger.log("[ActionExecutor] Container expanded, proceeding with click")}}findCollapsedContainer(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=window.getComputedStyle(n),i=n.getBoundingClientRect().width,o=r.transition.includes("width")||r.transitionProperty.includes("width")||r.transitionProperty==="all",s=i<80,a=n.offsetHeight>window.innerHeight*.7,l=typeof n.className=="string"?n.className:"",c=l.includes("sidebar")||l.includes("nav")||l.includes("menu");if(s&&(o||c)&&a)return this.logger.log("[ActionExecutor] Detected collapsed container:",{width:i,hasTransition:o,isFullHeight:a,classes:n.className.substring(0,100)}),n;n=n.parentElement}return null}simulateClick(e,n){if(n){const d=this.parseOptionTextFromSelector(n);if(d){this.logger.log("[ActionExecutor] 🎯 Detected dropdown option selector, searching for:",d);const f=this.findDropdownOption(d);if(f){this.logger.log("[ActionExecutor] Found option by text, clicking it"),this.performClick(f);return}this.logger.log("[ActionExecutor] Option not found by text, trying direct click")}const h=this.parseLabelFromSelector(n);if(h){this.logger.log("[ActionExecutor] 🎯 Detected labeled combobox selector:",h);const f=this.findComboboxByLabel(h);if(f){this.logger.log("[ActionExecutor] Found combobox by label, opening it"),this.handleComboboxClick(f);return}this.logger.log("[ActionExecutor] Combobox not found by label, trying direct match")}}const r=this.findComboboxInput(e);if(r){this.logger.log("[ActionExecutor] 🎯 Detected combobox/dropdown - using special handling"),this.handleComboboxClick(r);return}if(this.isDropdownOption(e)){this.logger.log("[ActionExecutor] 🎯 Element is dropdown option - using React onClick + DOM events");const d=this.triggerReactOnClick(e);this.logger.log(`[ActionExecutor] React onClick triggered: ${d}`),this.performClick(e);return}const i=this.findClickableElement(e),o=i.getBoundingClientRect(),s=o.left+o.width/2,a=o.top+o.height/2;if(i.focus&&i.focus(),this.hasReactOnClickHandler(i)){if(this.logger.log("[ActionExecutor] 🎯 Element has React onClick - using direct call only"),this.triggerReactOnClick(i)){this.sendClickMetadata(i,e),this.logger.log("[ActionExecutor] ✅ React onClick executed at",s,a,"on",i.tagName),i!==e&&this.logger.log("[ActionExecutor] Note: Clicked parent",i.tagName,"instead of",e.tagName);return}this.logger.log("[ActionExecutor] ⚠️ React onClick found but call failed, falling back to DOM events")}this.logger.log("[ActionExecutor] Using humanLikeClick (no React onClick or fallback)");const c=this.humanLikeClick(i,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});c!==e&&c!==i&&this.logger.log("[ActionExecutor] Note: humanLikeClick hit",c.tagName,"instead of element",e.tagName,"or clickTarget",i.tagName)}findComboboxInput(e){if(e.getAttribute("role")==="combobox")return this.logger.log("[ActionExecutor] Element is combobox"),e;if(e.getAttribute("aria-haspopup")==="listbox"||e.getAttribute("aria-haspopup")==="true"){const o=e.querySelector('input[role="combobox"]');if(o)return this.logger.log("[ActionExecutor] Found combobox via aria-haspopup container"),o;if(e.tagName==="BUTTON")return this.logger.log("[ActionExecutor] Element is button with aria-haspopup"),e}let n=e,r=0;const i=5;for(;n&&r<i;){const o=typeof n.className=="string"?n.className:"",s=o.includes("css-")&&o.includes("control"),a=o.includes("css-")&&o.includes("ValueContainer"),l=o.includes("css-")&&o.includes("Indicator"),c=o.includes("MuiSelect-select")||o.includes("MuiAutocomplete-inputRoot"),d=(o.includes("headlessui")||o.includes("radix"))&&(o.includes("trigger")||o.includes("button"));if(s||a||l||c||d||o.includes("control")&&n.querySelector('input[role="combobox"]')||o.includes("trigger")&&n.getAttribute("aria-haspopup")){const f=n.querySelector('input[role="combobox"]');if(f)return this.logger.log("[ActionExecutor] Found combobox input via control element"),f;const v=n.parentElement;if(v){const g=v.querySelector('input[role="combobox"]');if(g)return this.logger.log("[ActionExecutor] Found combobox input in parent container"),g}const b=n.querySelector('button[aria-haspopup="listbox"]');if(b)return this.logger.log("[ActionExecutor] Found listbox trigger button"),b}n=n.parentElement,r++}return null}parseOptionTextFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-option-text="([^"]+)"\]/);return r?r[1]:null}parseLabelFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-label="([^"]+)"\]/);return r?r[1]:null}stripVirtualAttributes(e){return e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim()}findComboboxByLabel(e){var r;const n=document.querySelectorAll("label");for(const i of n){const o=(r=i.textContent)==null?void 0:r.trim().replace(/\*$/,"").trim();if(o===e||o!=null&&o.includes(e)){const s=i.closest('div[class*="container"], div[aria-label], .MuiFormControl-root, form > div');if(s){const a=s.querySelector('input[role="combobox"], button[aria-haspopup="listbox"]');if(a)return this.logger.log("[ActionExecutor] Found combobox by label:",e),a}}}return null}handleComboboxClick(e){this.logger.log("[ActionExecutor] Opening combobox/dropdown with humanLikeClick");const r=e.closest('[class*="control"]')||e.closest('[class*="trigger"]')||e.closest("[aria-haspopup]")||e.parentElement||e,i=this.humanLikeClick(r,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});e.dispatchEvent(new FocusEvent("focus",{bubbles:!0})),e instanceof HTMLInputElement&&e.dispatchEvent(new Event("input",{bubbles:!0})),this.logger.log("[ActionExecutor] ✅ Combobox/dropdown humanLikeClick complete, actual element:",i.tagName)}openDropdown(e){this.handleComboboxClick(e)}triggerReactOnClickPublic(e){return this.triggerReactOnClick(e)}findDropdownOption(e){return Bo(e,be.isVisible)}isDropdownOption(e){if(e.getAttribute("role")==="option")return!0;const n=typeof e.className=="string"?e.className:"";return n.includes("option")||n.includes("item")?e.closest('[role="listbox"], [role="menu"], [class*="menu"], [class*="listbox"]')!==null:!1}performClick(e){this.humanLikeClick(e,{focus:!0,includePointerEvents:!0,nativeClickFallback:!0})}hasReactOnClickHandler(e){const n=["__reactProps","__reactFiber","__reactEventHandlers"];try{const o=Object.keys(e);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=e[s];if(a!=null&&a.onClick)return!0}}catch{}let r=e.parentElement,i=0;for(;r&&i<5;){try{const o=Object.keys(r);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=r[s];if(a!=null&&a.onClick)return!0}}catch{}r=r.parentElement,i++}return!1}findClickableElement(e){var a;const n=["SPAN","LABEL","P","H1","H2","H3","H4","H5","H6","TEXT","SVG","PATH"],r=l=>l.className?typeof l.className=="string"?l.className:typeof l.className.baseVal=="string"?l.className.baseVal:"":"";if(this.logger.log("[ActionExecutor] Finding clickable element for:",e.tagName,r(e).substring(0,50)),!n.includes(e.tagName))return this.logger.log("[ActionExecutor] Element is already interactive"),e;let i=e.parentElement,o=e,s=0;for(;i&&i!==document.body&&s<10;){s++;const l=window.getComputedStyle(i),c=l.cursor==="pointer",d=r(i),h=d.includes("cursor-pointer"),f=(a=i.classList)==null?void 0:a.contains("cursor-pointer"),v=i.hasAttribute("onclick")||i.hasAttribute("data-onclick")||i.getAttribute("role")==="button"||i.getAttribute("role")==="menuitem",b=i.tagName==="BUTTON"||i.tagName==="A";if(this.logger.log(`[ActionExecutor] Checking parent #${s}:`,i.tagName,"cursor:",l.cursor,"hasCursorClass:",h||f,"classes:",d.substring(0,60)),(c||h||f||v||b)&&(o=i,this.logger.log("[ActionExecutor] ✅ Found clickable parent:",i.tagName,d.substring(0,80)),b||i.getAttribute("role")==="button"))break;i=i.parentElement}return this.logger.log("[ActionExecutor] Final click target:",o.tagName,r(o).substring(0,60)),o}triggerReactOnClick(e){try{const n=Object.keys(e);for(const s of n)if(s.startsWith("__reactFiber")||s.startsWith("__reactProps")||s.startsWith("__reactEventHandlers")){const a=e[s];if(this.logger.log("[ActionExecutor] Found React property:",s),a!=null&&a.onClick){this.logger.log("[ActionExecutor] 🎯 Calling React onClick directly!");const l=new MouseEvent("click",{bubbles:!0,cancelable:!0}),c={type:"click",target:e,currentTarget:e,nativeEvent:l,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{c.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>c.defaultPrevented,isPropagationStopped:()=>!1};return a.onClick(c),!0}}const r=["__reactProps","__reactFiber","__reactEventHandlers"];let i=e.parentElement,o=0;for(;i&&o<5;){const s=Object.keys(i);for(const a of s)if(r.some(l=>a.startsWith(l))){const l=i[a];if(l!=null&&l.onClick){this.logger.log("[ActionExecutor] 🎯 Found onClick on parent, calling directly!");const c=new MouseEvent("click",{bubbles:!0,cancelable:!0}),d={type:"click",target:e,currentTarget:i,nativeEvent:c,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{d.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>d.defaultPrevented,isPropagationStopped:()=>!1};return l.onClick(d),!0}}i=i.parentElement,o++}return this.logger.log("[ActionExecutor] No React onClick handler found"),!1}catch(n){return this.logger.log("[ActionExecutor] Error accessing React internals:",n),!1}}sendClickMetadata(e,n){const r=d=>d.className?typeof d.className=="string"?d.className:typeof d.className.baseVal=="string"?d.className.baseVal:"":"",i=[];let o=e;for(;o&&o!==document.body&&i.length<5;){let d=o.tagName.toLowerCase();if(o.id)d=`#${o.id}`;else{const h=r(o);if(h){const f=h.trim().split(/\s+/).slice(0,3).join(".");f&&(d+="."+f)}}i.unshift(d),o=o.parentElement}const s=d=>{var v;const h=d.querySelector("span, label, p");if((v=h==null?void 0:h.textContent)!=null&&v.trim())return h.textContent.trim().substring(0,50);let f="";for(const b of Array.from(d.childNodes))b.nodeType===Node.TEXT_NODE&&(f+=(b.textContent||"").trim()+" ");return f=f.trim(),!f&&d.textContent&&(f=d.textContent.trim().substring(0,50)),f},a=window.__onboardingSDK,l=(a==null?void 0:a._botActionDepth)>0,c={type:"click",selector:i.join(" > "),text:s(n),tagName:e.tagName.toLowerCase(),timestamp:Date.now(),source:l?"bot":"user",sourceDetail:"react_onclick"};this.logger.log("[ActionExecutor] 📤 Sending React onClick metadata:",c.text,`(source: ${c.source})`),a!=null&&a.sendMetadata?a.sendMetadata(c):this.logger.warn("[ActionExecutor] ⚠️ SDK not found on window, cannot send metadata")}isDestructive(e){const n=["submit","delete","remove","clear"],r=['[type="submit"]',".delete",".remove"];return n.some(i=>{var o;return(o=e.description)==null?void 0:o.toLowerCase().includes(i)})||r.some(i=>e.selector.includes(i))}isHybridActionDestructive(e){var o,s;const n=["submit","delete","remove","clear","confirm","proceed"],r=((o=e.description)==null?void 0:o.toLowerCase())||"",i=((s=e.target.text)==null?void 0:s.toLowerCase())||"";return n.some(a=>r.includes(a)||i.includes(a))}async getConsent(e){const n=`Allow action: ${e.description||e.type} on ${e.selector}?`;return confirm(n)}async getHybridConsent(e){const n=e.target.text||e.target.selector||"element",r=`Allow "${e.action}" on "${n}"?
478
- ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){const i=this.parseOptionTextFromSelector(e.selector);if(i){this.logger.log("[ActionExecutor] Virtual selector detected - finding option by text:",i);const s=this.findDropdownOption(i);return s?(this.performClick(s),!0):(this.logger.warn("[ActionExecutor] Option not found by text:",i),!1)}const o=this.parseLabelFromSelector(e.selector);if(o){this.logger.log("[ActionExecutor] Virtual selector detected - finding combobox by label:",o);const s=this.findComboboxByLabel(o);return s?(this.handleComboboxClick(s),!0):(this.logger.warn("[ActionExecutor] Combobox not found by label:",o),!1)}}const n=this.stripVirtualAttributes(e.selector),r=document.querySelector(n);if(!r)return this.logger.warn("[ActionExecutor] Element not found:",n),!1;switch(e.type){case"click":this.simulateClick(r,e.selector);break;case"type":(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&(r.focus(),r.value=e.value||"",r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"select":const i=this.findComboboxInput(r);if(i){if(this.handleComboboxClick(i),await new Promise(o=>setTimeout(o,200)),e.value){const o=this.findDropdownOption(e.value);o&&this.performClick(o)}}else r instanceof HTMLSelectElement&&(r.value=e.value||"",r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"hover":r.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),r.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":r.scrollIntoView({behavior:"smooth",block:"center"});break;default:return this.logger.warn("[ActionExecutor] Unknown action type:",e.type),!1}return!0}}class d_{constructor(e=de){D(this,"logger");D(this,"container",null);D(this,"highlightEl",null);D(this,"tooltipElement",null);D(this,"floeCursor",null);D(this,"cursorHasBeenPositioned",!1);this.logger=e}inject(){this.container||(this.container=document.createElement("div"),this.container.id="onboarding-overlay",this.container.setAttribute(Di,"overlay"),this.container.style.cssText=`
487
+ `.replace(/\s+/g," ").trim()),P(Qe,"SKIP_SELECTORS",["#onboarding-overlay","#onboarding-sdk-react-ui","#hse-highlight-element","script","style","noscript","template"]);let Td=Qe;const e_=["#onboarding-overlay","#floe-cursor","#onboarding-sdk-react-ui","#hse-highlight-element","#floe-cursor-styles","#onboarding-animations"],Di="data-floe-widget";function Mt(t){if(!t)return!1;if(t.hasAttribute(Di))return!0;for(const e of e_)if(t.closest(e))return!0;return!1}function Ln(){return window.location.origin+window.location.pathname}function Ga(t){try{const e=new URL(t,window.location.origin);return e.origin+e.pathname}catch{return t}}function Tv(t){return t&&t.replace(/\.ng-(untouched|touched|pristine|dirty|valid|invalid)/g,"")}function Mv(t){try{const n=document.querySelector(t);if(n)return n}catch{}const e=Tv(t);if(e!==t)try{const n=document.querySelector(e);if(n)return de.log(`[AngularFallback] Selector matched after stripping state classes: "${e}"`),n}catch{}return null}function Av(t){let e=t,n=0;for(;e&&n<5;){const r=e.getAttribute("role");if(r==="dialog"||r==="alertdialog"||e.getAttribute("aria-modal")==="true"||e.tagName==="DIALOG")return!0;const i=e.tagName.toLowerCase();if(i.includes("modal")||i.includes("dialog"))return!0;const o=typeof e.className=="string"?e.className.toLowerCase():"";if(o.includes("modal")||o.includes("dialog")||o.includes("cdk-overlay"))return!0;e=e.parentElement,n++}return!1}function Ov(t,e={}){var g,y,m,S,v;const{focus:n=!0,includePointerEvents:r=!0,nativeClickFallback:i=!1,includeMouseEnter:o=!1}=e,s=t.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c=document.elementFromPoint(a,l);let d;if(c&&(c===t||t.contains(c)||c.contains(t)))d=c,d!==t&&de.log("[humanLikeClick] 🎯 Using element at point:",d.tagName,"instead of target:",t.tagName);else if(c){if(de.warn("[humanLikeClick] ⚠️ Element at point is unrelated:",c.tagName,(g=c.className)==null?void 0:g.toString().slice(0,50)),de.warn("[humanLikeClick] Expected target:",t.tagName,(y=t.className)==null?void 0:y.toString().slice(0,50)),Av(c))if(Av(t))de.warn("[humanLikeClick] ⚠️ Stacked modal detected: both target and overlay are in modals.","Falling through to direct dispatch on target."),d=t;else{const w=`${c.tagName} (${(m=c.className)==null?void 0:m.toString().slice(0,80)})`;throw de.error("[humanLikeClick] ❌ BLOCKED: Modal/dialog overlay is covering the target element.",`Overlay: ${w}`,`Target: ${t.tagName} "${(S=t.textContent)==null?void 0:S.trim().slice(0,50)}"`),new Error(`Click blocked by modal overlay: ${w}. Target "${(v=t.textContent)==null?void 0:v.trim().slice(0,50)}" is behind the modal. Interact with the modal instead.`)}d=t}else de.warn("[humanLikeClick] ⚠️ No element at coordinates, falling back to target"),d=t;n&&typeof d.focus=="function"&&d.focus();const h={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l,screenX:a+window.screenX,screenY:l+window.screenY,button:0,buttons:1},f=r?{...h,pointerType:"mouse",isPrimary:!0}:null;return o&&(d.dispatchEvent(new MouseEvent("mouseenter",{...h,bubbles:!1})),d.dispatchEvent(new MouseEvent("mouseover",h))),f&&d.dispatchEvent(new PointerEvent("pointerdown",f)),d.dispatchEvent(new MouseEvent("mousedown",h)),f&&d.dispatchEvent(new PointerEvent("pointerup",f)),d.dispatchEvent(new MouseEvent("mouseup",h)),d.dispatchEvent(new MouseEvent("click",h)),i&&typeof d.click=="function"&&d.click(),de.log("[humanLikeClick] ✅ Completed on",d.tagName,"at (",Math.round(a),",",Math.round(l),")"),d}class Dv{constructor(){P(this,"audioContext",null);P(this,"analyzerNode",null);P(this,"sourceNode",null);P(this,"dataArray",new Uint8Array(0));P(this,"isRunning",!1);P(this,"onLevelsCallback",null);P(this,"animationId",null);P(this,"analyze",()=>{if(!this.isRunning||!this.analyzerNode||this.dataArray.length===0)return;this.analyzerNode.getByteFrequencyData(this.dataArray);const e=[];for(let n=0;n<this.dataArray.length;n++)n>=2&&n<this.dataArray.length-2&&e.push(this.dataArray[n]/255);this.onLevelsCallback&&this.onLevelsCallback(e),this.animationId=requestAnimationFrame(this.analyze)})}start(e,n){try{this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext.state==="suspended"&&this.audioContext.resume(),this.analyzerNode=this.audioContext.createAnalyser(),this.analyzerNode.fftSize=64,this.analyzerNode.smoothingTimeConstant=.4,this.sourceNode=this.audioContext.createMediaStreamSource(e),this.sourceNode.connect(this.analyzerNode);const r=this.analyzerNode.frequencyBinCount;this.dataArray=new Uint8Array(r),this.onLevelsCallback=n,this.isRunning=!0,this.analyze(),de.log("[AudioAnalyzer] Started analyzing audio stream")}catch(r){de.error("[AudioAnalyzer] Failed to start:",r)}}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=null),this.analyzerNode=null,this.dataArray=new Uint8Array(0),this.onLevelsCallback=null,de.log("[AudioAnalyzer] Stopped")}destroy(){this.stop(),this.audioContext&&(this.audioContext.close(),this.audioContext=null)}}class t_{constructor(){P(this,"events",{})}on(e,n){return this.events[e]||(this.events[e]=[]),this.events[e].push(n),this}off(e,n){if(!this.events[e])return this;const r=this.events[e].indexOf(n);return r>-1&&this.events[e].splice(r,1),this}emit(e,...n){if(!this.events[e])return!1;for(const r of this.events[e])r(...n);return!0}}class n_{constructor(e=de){P(this,"logger");P(this,"lastSnapshot",null);P(this,"lastSnapshotHash","");P(this,"snapshotInterval",null);P(this,"sendCallback",null);P(this,"correlationCounter",0);P(this,"lastSendTimestamp",0);P(this,"INTERACTIVE_TAGS",new Set(["button","a","input","select","textarea","label","summary","details","option","menuitem"]));P(this,"INTERACTIVE_ROLES",new Set(["button","link","menuitem","option","tab","checkbox","radio","switch","textbox","combobox","listbox","slider"]));P(this,"_visibilityCacheObserver",null);P(this,"mutationObserver",null);P(this,"mutationDebounceTimer",null);this.logger=e}startCapturing(e=1500,n){this.logger.log(`[DOMIntrospector] Starting DOM capture every ${e}ms`),this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this._visibilityCacheObserver&&(this._visibilityCacheObserver.disconnect(),this._visibilityCacheObserver=null),this.sendCallback=n,this.initCacheInvalidation(),this.captureAndSend(),this.snapshotInterval=window.setInterval(()=>{this.captureAndSend()},e),this.setupMutationObserver()}stopCapturing(){this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.mutationDebounceTimer&&(clearTimeout(this.mutationDebounceTimer),this.mutationDebounceTimer=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this._visibilityCacheObserver&&(this._visibilityCacheObserver.disconnect(),this._visibilityCacheObserver=null),this.logger.log("[DOMIntrospector] Stopped DOM capture")}captureAndSendImmediate(e="immediate"){this.logger.log(`[DOMIntrospector] Immediate capture triggered: ${e}`);const n=this.captureSnapshot(),r=this.computeSnapshotHash(n),i=r!==this.lastSnapshotHash,o={...n,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:e,domChanged:i};return this.lastSnapshot=o,this.lastSnapshotHash=r,this.sendCallback&&(this.logger.log(`[DOMIntrospector] Sending immediate snapshot (changed=${i}): ${n.elements.length} elements, corr=${o.correlationId}`),this.sendCallback(o)),o.correlationId}setupMutationObserver(){this.mutationObserver||(this.mutationObserver=new MutationObserver(e=>{this.mutationDebounceTimer&&clearTimeout(this.mutationDebounceTimer),e.some(r=>r.type==="childList"||r.type==="attributes"&&["href","src","hidden","disabled","aria-hidden","aria-modal","aria-expanded","open"].includes(r.attributeName||""))&&(this.mutationDebounceTimer=setTimeout(()=>{this.logger.log("[DOMIntrospector] Significant DOM change detected"),this.captureAndSendImmediate("dom-mutation")},300))}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","disabled","aria-hidden","aria-modal","aria-expanded","open","href","src"]}))}captureAndSend(){const e=this.captureSnapshot(),n=this.computeSnapshotHash(e),r=n!==this.lastSnapshotHash,i=Date.now(),o=i-(this.lastSendTimestamp||0),s=!r&&o>1e4;if(r||s){const a={...e,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:r?"periodic":"heartbeat",domChanged:r};this.lastSnapshot=a,r&&(this.lastSnapshotHash=n),this.lastSendTimestamp=i,this.sendCallback&&(this.logger.log(`[DOMIntrospector] Sending snapshot (${r?"DOM changed":"heartbeat"}): ${e.elements.length} elements, ${e.interactiveCount} interactive, corr=${a.correlationId}`),this.sendCallback(a))}else this.logger.log("[DOMIntrospector] Snapshot unchanged, skipping send")}computeSnapshotHash(e){const n=e.elements.length,r=e.interactiveCount||0,i=30,o=e.elements.slice(0,i),s=Math.max(0,Math.floor(n/2)-Math.floor(i/2)),a=e.elements.slice(s,s+i),l=e.elements.slice(-i),c=h=>h.map(f=>{var g;return`${f.tag}:${(g=f.text)==null?void 0:g.slice(0,20)}:${Math.round(f.rect.x)}:${Math.round(f.rect.y)}`}).join("|");return`count:${n}:${r}|`+c(o)+"||"+c(a)+"||"+c(l)}captureSnapshot(){const e=[],n={width:window.innerWidth,height:window.innerHeight},r=document.body.querySelectorAll("*");let i=0,o=0;return r.forEach(s=>{var f;const a=s;if(this.shouldSkipElement(a))return;const l=a.getBoundingClientRect();if(l.bottom<0||l.top>n.height||l.right<0||l.left>n.width||l.width<=0||l.height<=0)return;const c=this.isInteractiveElement(a);c&&o++;const d=this.getVisibleText(a);if(!c&&!d)return;const h={index:i++,tag:a.tagName.toLowerCase(),text:d,id:a.id||"",className:typeof a.className=="string"?a.className:"",ariaLabel:a.getAttribute("aria-label"),placeholder:a.getAttribute("placeholder"),role:a.getAttribute("role"),href:a.getAttribute("href"),type:a.getAttribute("type"),name:a.getAttribute("name"),rect:{x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height)},isVisible:!0,isInteractive:c,isInteractable:c?Ev(a,!0):!1,parentTag:((f=a.parentElement)==null?void 0:f.tagName.toLowerCase())||null,depth:this.getElementDepth(a)};e.push(h)}),{timestamp:Date.now(),url:Ln(),viewport:n,elements:e,totalElements:e.length,interactiveCount:o}}shouldSkipElement(e){if(Mt(e))return!0;const n=e.tagName.toLowerCase();if(["script","style","noscript","template","svg","path"].includes(n))return!0;const r=window.getComputedStyle(e);return!!(r.display==="none"||r.visibility==="hidden"||r.opacity==="0"||Zx(e)||!Ed(e)||qa(e)||Ja(e))}initCacheInvalidation(){this._visibilityCacheObserver&&this._visibilityCacheObserver.disconnect(),this._visibilityCacheObserver=new MutationObserver(e=>{for(const n of e)if(n.type==="attributes"||n.type==="childList"){Yx();break}}),this._visibilityCacheObserver.observe(document.body,{attributes:!0,attributeFilter:["aria-modal","aria-hidden","aria-expanded","open"],childList:!0,subtree:!0})}isInteractiveElement(e){const n=e.tagName.toLowerCase();if(this.INTERACTIVE_TAGS.has(n))return!0;const r=e.getAttribute("role");if(r&&this.INTERACTIVE_ROLES.has(r)||e.onclick||e.getAttribute("onclick")||e.contentEditable==="true")return!0;const i=e.getAttribute("tabindex");return!!(i&&parseInt(i)>=0||window.getComputedStyle(e).cursor==="pointer")}getVisibleText(e){var r;return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?(e.value||e.placeholder||"").trim().slice(0,80):(((r=e.innerText)==null?void 0:r.trim())||"").slice(0,80)}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}getLastSnapshot(){return this.lastSnapshot}findElementByIndex(e){if(!this.lastSnapshot)return null;const n=this.lastSnapshot.elements.find(r=>r.index===e);return n?this.findElementByBoundingBox(n.rect,n.tag,n.text):null}findElementByBoundingBox(e,n,r){var a;const o=[];if(document.body.querySelectorAll("*").forEach(l=>{var m;const c=l;if(this.shouldSkipElement(c))return;const d=c.getBoundingClientRect(),h=Math.abs(d.x-e.x)<=10,f=Math.abs(d.y-e.y)<=10,g=Math.abs(d.width-e.width)<=10*2,y=Math.abs(d.height-e.height)<=10*2;if(h&&f&&g&&y){let S=100,v=!1;if(n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r){const w=((m=c.innerText)==null?void 0:m.trim().toLowerCase())||"",k=r.toLowerCase();w.length===0?v=!1:w===k?(S+=50,v=!0):(w.includes(k)||k.includes(w))&&(S+=25,v=!0)}else v=!0;o.push({element:c,score:S,textMatch:v})}}),o.sort((l,c)=>c.score-l.score),o.length>0){const l=o[0],c=((a=l.element.innerText)==null?void 0:a.trim().slice(0,50))||"";return r&&!l.textMatch?(this.logger.warn(`[DOMIntrospector] ⚠️ Bounding box match REJECTED - text mismatch! Expected: "${r}", Found: "${c}"`),this.logger.warn(`[DOMIntrospector] Element at (${e.x}, ${e.y}) has text "${c}" which doesn't match expected "${r}" - page may have scrolled`),null):(this.logger.log(`[DOMIntrospector] Found ${o.length} candidates by bounding box, best score: ${l.score}, text: "${c}"`),l.element)}return null}}const r_=[".cdk-overlay-pane nz-option-container",".cdk-overlay-pane .ant-select-dropdown",'.cdk-overlay-pane [role="listbox"]','[role="listbox"]:not([aria-hidden="true"])','[class*="menu"][class*="--is-open"]','[class*="MenuList"]',".ant-select-dropdown:not(.ant-select-dropdown-hidden)",'input[role="combobox"][aria-expanded="true"]'],i_=['[role="listbox"]','[role="menu"]','[class*="-menu"]:not([aria-hidden="true"])','[class*="listbox"]','[class*="options-container"]',".ant-select-dropdown","nz-option-container",".cdk-overlay-pane",".cdk-virtual-scroll-content-wrapper"],o_=['[role="option"]','[class*="option"]:not([class*="singleValue"]):not([class*="placeholder"])',"nz-option-item",".ant-select-item-option",".ant-select-item-option-content",".ant-select-item"].join(", "),Lv=["input.ant-select-selection-search-input",'input[role="combobox"]','input[type="search"]','input[class*="search"]','input[class*="Search"]','input[aria-autocomplete="list"]'];function s_(t){for(const e of r_)try{const n=document.querySelector(e);if(n&&t(n)){const r=n.getBoundingClientRect();if(r.height>20&&r.width>20)return de.log("[DropdownHelpers] Dropdown detected as open via:",e),!0}}catch{continue}return!1}function a_(t,e){if(t instanceof HTMLInputElement&&(t.getAttribute("role")==="combobox"||t.classList.contains("ant-select-selection-search-input")||t.type==="search"))return de.log("[DropdownHelpers] Trigger itself is search input"),t;const r=t.closest('nz-select, [class*="select-container"], [class*="Select"], [class*="combobox"]')||t.parentElement;if(r)for(const s of Lv){const a=r.querySelector(s);if(a)return de.log("[DropdownHelpers] Found search input via:",s),a}const i=document.querySelectorAll(".cdk-overlay-pane");for(const s of i)if(e(s))for(const a of Lv){const l=s.querySelector(a);if(l)return de.log("[DropdownHelpers] Found search input in CDK overlay via:",a),l}const o=document.activeElement;return o instanceof HTMLInputElement&&(o.getAttribute("role")==="combobox"||o.classList.contains("ant-select-selection-search-input"))?(de.log("[DropdownHelpers] Found search input as active element"),o):(de.log("[DropdownHelpers] No search input found for dropdown"),null)}function l_(t){const e=[],n=t.match(/^([^(]+)/),r=n?n[1].trim():t,i=r.split(/\s+/)[0];return i&&i.length>=2&&e.push(i),r!==i&&e.push(r),e.length===0&&e.push(t),e}function Bo(t,e){var o;const n=t.toLowerCase().trim();let r=null,i=null;for(const s of i_){let a;try{a=document.querySelectorAll(s)}catch{continue}for(const l of a){const c=l;if(!e(c)||c.getBoundingClientRect().height<20)continue;const h=l.querySelectorAll(o_);for(const f of h){const g=f,y=g.className||"";if(y.toLowerCase().includes("singlevalue")||y.toLowerCase().includes("placeholder"))continue;const m=g.getBoundingClientRect();if(m.height===0||m.width===0)continue;const S=((o=g.textContent)==null?void 0:o.trim().toLowerCase())||"";if(S===n){de.log(`[DropdownHelpers] Found EXACT match for option: "${t}"`),r=g;break}if(!i&&S.includes(n)){const v=n.length/S.length;v>.7&&(de.log(`[DropdownHelpers] Found partial match (${(v*100).toFixed(0)}%): "${S.slice(0,50)}"`),i=g)}}if(r)break}if(r)break}return r||(i?(de.warn(`[DropdownHelpers] Using partial match for "${t}" — verify correctness`),i):(de.log(`[DropdownHelpers] No option found for: "${t}"`),null))}async function c_(t,e,n){const r=l_(e);for(const i of r){de.log(`[DropdownHelpers] Typing search term: "${i}"`),t.focus(),await new Promise(s=>setTimeout(s,50)),t.value="",t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(s=>setTimeout(s,100));for(let s=0;s<i.length;s++){const a=i[s];t.value=i.substring(0,s+1),t.dispatchEvent(new KeyboardEvent("keydown",{key:a,bubbles:!0})),t.dispatchEvent(new KeyboardEvent("keypress",{key:a,bubbles:!0})),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new KeyboardEvent("keyup",{key:a,bubbles:!0})),await new Promise(l=>setTimeout(l,30))}t.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(s=>setTimeout(s,400));let o=Bo(e,n);if(o||(await new Promise(s=>setTimeout(s,300)),o=Bo(e,n),o))return o}return t.value="",t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(i=>setTimeout(i,200)),null}const O=class O{static setLogger(e){O._logger=e}static extractSelectorContext(e){if(!e)return{};const n=e.split(/\s*([>+~]|\s)\s*/);if(n.length<2)return{};const r=n[n.length-1],i=n.slice(0,-2),o=r.match(/^([a-zA-Z][a-zA-Z0-9-]*)/),s=o?o[1].toLowerCase():void 0,a=i.length>0?i.join(" "):void 0;let l;if(i.length>0){const d=i[i.length-1].match(/^([a-zA-Z][a-zA-Z0-9-]*)/);l=d?d[1].toLowerCase():void 0}return{expectedTag:s,parentSelector:a,parentTag:l}}static matchesSelectorContext(e,n){if(!n.parentTag&&!n.parentSelector)return .5;let r=0,i=0;if(n.parentTag&&(i++,e.closest(n.parentTag)&&(r+=1)),n.parentSelector){i++;try{e.closest(n.parentSelector)&&(r+=1)}catch{}}return i>0?r/i:.5}static setDOMIntrospector(e){O.domIntrospector=e,O._logger.log("[HybridTargetResolver] DOM Introspector set for enhanced targeting")}static safeStringify(e,n){const r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(o&&typeof o=="object"){if(o instanceof HTMLElement){const s=o.tagName||"Unknown",a=o.id?`#${o.id}`:"",l=o.className&&typeof o.className=="string"?`.${o.className.split(" ").filter(Boolean).join(".")}`:"";return`[HTMLElement: ${s}${a}${l}]`}if(o instanceof Element)return`[Element: ${o.tagName||"Unknown"}]`;if(o instanceof Node)return`[Node: ${o.nodeName}]`;if(r.has(o))return"[Circular]";r.add(o)}return o},n)}static resolveTarget(e){if(!e)return O._logger.warn("[HybridTargetResolver] ❌ No target provided"),null;O._logger.isDebug&&O._logger.log("[HybridTargetResolver] Target details:",this.safeStringify(e,2));const n=this.resolveTargetWithConsensus(e),r=n.element?`[HTMLElement: ${n.element.tagName}${n.element.id?`#${n.element.id}`:""}${n.element.className&&typeof n.element.className=="string"?`.${n.element.className.split(" ").filter(Boolean).join(".")}`:""}]`:null,i={...n,element:r};return O._logger.isDebug&&O._logger.log(`[HybridTargetResolver] consensus results (${n.confidence.toFixed(1)}% confidence)`,this.safeStringify(i,2)),n.element?n.element:null}static resolveTargetWithConsensus(e){var h;const n=performance.now(),r=this.getAvailableStrategies(e);if(r.length===0)return O._logger.warn("[HybridTargetResolver] ⚠️ No strategies available for target"),{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};O._logger.log(`[HybridTargetResolver] 🔄 Running ${r.length} strategies in parallel...`);const i=new Map;for(const f of r){const g=this.executeStrategyMulti(f,e);for(const y of g)Mt(y)||y.isConnected&&(i.has(y)?i.get(y).strategies.push(f):i.set(y,{element:y,strategies:[f],validationScore:0,interactable:!1,confidence:0}))}if(O._logger.log(`[HybridTargetResolver] 📊 Found ${i.size} unique candidate(s)`),i.size===0)return{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};const o=[];for(const[f,g]of i){if(!f.isConnected){O._logger.warn("[HybridTargetResolver] ⚠️ Candidate element was removed from DOM, skipping");continue}g.validationScore=this.computeValidationScore(f,e),g.interactable=this.checkInteractability(f).ok,g.confidence=this.computeConfidence(g,r.length,e),o.push(g),O._logger.isDebug&&(O._logger.log(`[HybridTargetResolver] <${f.tagName.toLowerCase()}> "${(h=f.textContent)==null?void 0:h.slice(0,25)}..."`),O._logger.log(`[HybridTargetResolver] Strategies: ${g.strategies.join(", ")} (${g.strategies.length}/${r.length})`),O._logger.log(`[HybridTargetResolver] Confidence: ${g.confidence.toFixed(1)}%`))}if(o.length===0)return{element:null,confidence:0,strategies:[],candidateCount:i.size,ambiguous:!1,duration:performance.now()-n};o.sort((f,g)=>g.confidence-f.confidence);const s=o[0],a=o.length>1?o[1]:void 0,l=performance.now()-n,c=a!==void 0&&s.confidence-a.confidence<10;if(c&&O._logger.warn("[HybridTargetResolver] ⚠️ AMBIGUOUS: Top candidates have similar confidence"),s.confidence<30)return O._logger.warn(`[HybridTargetResolver] ❌ Best candidate confidence too low: ${s.confidence.toFixed(1)}%`),{element:null,confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l};if(!s.interactable){const f=this.getClickableContainer(s.element);if(f!==s.element&&O.checkInteractability(f).ok)return O._logger.log(`[HybridTargetResolver] ✅ Using clickable container for hidden winner (${s.confidence.toFixed(1)}%)`),{element:f,confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l};const g=o.find(y=>y.interactable);if(g&&g.confidence>30)return O._logger.log(`[HybridTargetResolver] ✅ Using interactable candidate (${g.confidence.toFixed(1)}%)`),{element:this.getClickableContainer(g.element),confidence:g.confidence,strategies:g.strategies,candidateCount:i.size,ambiguous:c,duration:l}}return O._logger.log(`[HybridTargetResolver] ✅ Winner: ${s.confidence.toFixed(1)}% confidence (${l.toFixed(1)}ms)`),{element:this.getClickableContainer(s.element),confidence:s.confidence,strategies:s.strategies,candidateCount:i.size,ambiguous:c,duration:l}}static isValidCSSSelector(e){if(!e||typeof e!="string")return!1;if(/^(role|text|label|placeholder)=/.test(e))return O._logger.warn(`[HybridTargetResolver] Skipping Playwright-style selector (not CSS): "${e.substring(0,50)}..."`),!1;try{return document.querySelector(e),!0}catch{return O._logger.warn(`[HybridTargetResolver] Invalid CSS selector: "${e.substring(0,50)}..."`),!1}}static executeStrategyMulti(e,n){const r=[];try{switch(e){case"selector":{const i=new Set,o=[n.selector,...n.selectorFallbacks||[]].filter(a=>!!a),s=[];for(const a of o){this.isValidCSSSelector(a)&&s.push(a);const l=Tv(a);l!==a&&this.isValidCSSSelector(l)&&!s.includes(l)&&s.push(l)}for(const a of s)try{document.querySelectorAll(a).forEach(l=>i.add(l))}catch{O._logger.warn(`[HybridTargetResolver] querySelectorAll failed for: "${a.substring(0,50)}..."`)}r.push(...i);break}case"text":n.text&&r.push(...this.findAllByText(n.text));break;case"ariaLabel":n.ariaLabel&&document.querySelectorAll(`[aria-label*="${CSS.escape(n.ariaLabel)}"]`).forEach(i=>r.push(i));break;case"placeholder":n.placeholder&&document.querySelectorAll(`[placeholder*="${CSS.escape(n.placeholder)}"]`).forEach(i=>r.push(i));break;case"role":n.role&&document.querySelectorAll(`[role="${n.role}"]`).forEach(i=>r.push(i));break;case"labelText":{if(n.labelText){let i=n.selector||"";(!i||/react-select-\d+/.test(i))&&(n.role?i=`[role="${n.role}"]`:n.tag?i=n.tag:i="*");const o=this.findElementByLabelText(n.labelText,i);o&&r.push(o)}break}case"optionText":{if(n.optionText){const i=this.findDropdownOptionByText(n.optionText);i&&r.push(i)}break}case"removeChip":{if(n.removeChipText){const i=this.findMultiSelectChipRemoveButton(n.removeChipText);i&&r.push(i)}break}case"tag":{if(n.tag){const i=document.getElementsByTagName(n.tag);for(const o of i)(!n.text||(o.textContent||"").toLowerCase().includes(n.text.toLowerCase()))&&r.push(o)}break}case"domIndex":if(n.domIndex!==void 0){const i=this.findByDomIndex(n.domIndex);i&&r.push(i)}break;case"boundingBox":{if(n.boundingBox){const i=this.findByBoundingBox(n.boundingBox,n.tag,n.text);i&&r.push(i)}break}}}catch(i){O._logger.warn(`[HybridTargetResolver] Strategy "${e}" threw error:`,i)}return r}static findAllByText(e,n){var g,y;const r=[],i=new Set;if(!e)return r;const o=e.trim();if(!o)return r;const s=n||"*",a=this.escapeXPathString(o),l=`//${s}[normalize-space(.)=${a}]`;try{const m=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<m.snapshotLength;S++){const v=m.snapshotItem(S);v&&!this.isDropdownDisplayValue(v)&&!i.has(v)&&(r.push(v),i.add(v))}}catch{}const c=`//${s}[contains(normalize-space(.), ${a})]`;try{const m=document.evaluate(c,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<m.snapshotLength;S++){const v=m.snapshotItem(S);v&&!this.isDropdownDisplayValue(v)&&!i.has(v)&&(r.push(v),i.add(v))}}catch{}const d=[];for(const m of r)if(!this.isInteractiveElement(m)){const S=this.findNearbyInput(m);S&&!i.has(S)&&(O._logger.isDebug&&O._logger.log(`[HybridTargetResolver] → Found nearby input for label "${(g=m.textContent)==null?void 0:g.trim().substring(0,30)}": <${S.tagName.toLowerCase()}>`),d.push(S),i.add(S))}r.push(...d);const h=o.toLowerCase(),f=document.querySelectorAll("input, textarea");for(const m of f){const S=m;if(Mt(S)||i.has(S))continue;const v=((y=S.getAttribute("placeholder"))==null?void 0:y.trim().toLowerCase())||"";if(v===h||v&&v.includes(h)&&h.length/v.length>.6){const w=S.getBoundingClientRect();w.width>0&&w.height>0&&(r.push(S),i.add(S))}}return r}static isInteractiveElement(e){return!!(["INPUT","BUTTON","SELECT","TEXTAREA","A"].includes(e.tagName)||e.getAttribute("role")==="button"||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="textbox"||e.getAttribute("role")==="listbox"||e.getAttribute("contenteditable")==="true"||e.getAttribute("tabindex")!==null&&e.getAttribute("tabindex")!=="-1")}static findNearbyInput(e){if(e.tagName==="LABEL"){const i=e.getAttribute("for");if(i){const o=document.getElementById(i);if(o)return o}}let n=e.nextElementSibling;for(let i=0;i<3&&n;i++){const o=this.findFirstInput(n);if(o)return o;n=n.nextElementSibling}const r=e.parentElement;if(r){const i=r.querySelectorAll('input, textarea, select, [role="combobox"], [role="listbox"], nz-select input, .ant-select input');for(const o of i)if(e.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING){const s=o.getBoundingClientRect();if(s.width>0&&s.height>0)return o}}return null}static findFirstInput(e){if(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.getAttribute("role")==="combobox"||e.getAttribute("role")==="listbox")return e;const n=e.querySelector('input, textarea, select, [role="combobox"], [role="listbox"]');if(n){const r=n.getBoundingClientRect();if(r.width>0&&r.height>0)return n}return null}static computeValidationScore(e,n){var c,d,h;let r=0,i=0,o=!1,s=!1;if(n.role){i+=25;const f=e.getAttribute("role");if(f===n.role)r+=25;else if(f)o=!0;else{const g=e.tagName.toLowerCase(),y=typeof e.className=="string"?e.className:"";g==="div"||g==="span"||e.classList.contains("container")||y.includes("control")||y.includes("wrapper")?r+=10:s=!0}}if(n.role==="combobox"&&e.querySelector('[role="combobox"]')&&(r+=10,i+=10),n.tag){i+=15;const f=e.tagName.toLowerCase(),g=n.tag.toLowerCase();f===g?r+=15:n.role==="combobox"&&(f==="input"||f==="div")&&(r+=10)}if(n.text&&!n.optionText){i+=20;const f=(e.textContent||"").toLowerCase().trim(),g=n.text.toLowerCase().trim();if(n.role==="combobox"&&e.tagName.toLowerCase()==="input"){const y=(c=e.closest('.css-6lmz24, [class*="value-container"], [class*="placeholder"]'))==null?void 0:c.parentElement,m=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]'),S=((d=m==null?void 0:m.textContent)==null?void 0:d.toLowerCase().trim())||"";(S===g||S.includes(g))&&(r+=20)}else if(f===g)r+=20;else if(f.includes(g)){const y=g.length/f.length;y>.8?r+=15:y>.5?r+=8:(new RegExp(`\\b${O.escapeRegex(g)}\\b`,"i").test(f)?r+=2:r+=0,O._logger.isDebug&&O._logger.log(`[HybridTargetResolver] Text length mismatch: "${g}" (${g.length}) in "${f.slice(0,30)}..." (${f.length}), ratio=${y.toFixed(2)}, points=${r}`))}else if(g.includes(f)){const y=f.length/g.length;g.startsWith(f)&&f.length>=15?r+=Math.round(18*y):r+=Math.round(10*y)}}if(n.ariaLabel){i+=15;const f=e.getAttribute("aria-label")||"";f.toLowerCase()===n.ariaLabel.toLowerCase()?r+=15:f.toLowerCase().includes(n.ariaLabel.toLowerCase())&&(r+=10)}if(n.placeholder){i+=15;const f=e.placeholder||"",g=n.placeholder.toLowerCase();if(f.toLowerCase().includes(g))r+=15;else if(n.role==="combobox"){const y=e.closest('[class*="container"]')||e.parentElement,m=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]');(((h=m==null?void 0:m.textContent)==null?void 0:h.toLowerCase().trim())||"").includes(g)&&(r+=15)}}if(n.labelText){i+=20;const f=this.getAssociatedLabelText(e);if(f){const g=f.toLowerCase().trim().replace(/\*$/,"").trim(),y=n.labelText.toLowerCase().trim().replace(/\*$/,"").trim();g===y?r+=20:(g.includes(y)||y.includes(g))&&(r+=15)}}if(n.optionText){i+=15;const g=(e.textContent||"").trim().toLowerCase(),y=n.optionText.toLowerCase().trim();g===y?r+=15:g.includes(y)&&(r+=10)}if(i===0)return 100;let a=Math.round(r/i*100);if(o?(a=Math.round(a*.3),O._logger.log(`[HybridTargetResolver] Role mismatch penalty (30%): ${e.tagName}[role="${e.getAttribute("role")}"] vs target role="${n.role}"`)):s&&(e.closest('[role="listbox"], [role="menu"], [role="tree"]')||(a=Math.round(a*.7),O._logger.log(`[HybridTargetResolver] No role penalty (70%): ${e.tagName} expected role="${n.role}"`))),e.getAttribute("tabindex")==="-1"&&(e.closest('[role="listbox"], [role="menu"], [role="combobox"], .select, [class*="dropdown"]')||e.tagName.toLowerCase()==="input"&&(a=Math.round(a*.85),O._logger.log("[HybridTargetResolver] tabindex=-1 input penalty (85%): likely hidden placeholder"))),n.selector){const f=this.extractSelectorContext(n.selector);if(f.parentTag||f.parentSelector){const g=this.matchesSelectorContext(e,f);g>.5?a=Math.min(100,Math.round(a*1.15)):g<.5&&n.text&&(a=Math.round(a*.7))}}if(n.text){const f=e.tagName.toLowerCase(),g=e.getAttribute("role"),y=["button","a","input","select","textarea"].includes(f),m=["button","link","menuitem","option","tab","checkbox","radio"].includes(g||""),S=e.onclick!==null||e.hasAttribute("onclick"),v=e.closest('button, a, [role="button"], [role="link"]');y||m?(a=Math.min(100,Math.round(a*1.25)),O._logger.log(`[HybridTargetResolver] Interactive element bonus (25%): <${f}> is natively interactive`)):v?a=Math.min(100,Math.round(a*1.15)):S&&(a=Math.min(100,Math.round(a*1.1)))}return a}static computeConfidence(e,n,r){if(n===0)return O._logger.warn("[HybridTargetResolver] computeConfidence: totalStrategies is 0, returning 0"),0;const i=e.strategies.length/n*100,o=e.validationScore;let s=100;try{const c=e.element.getBoundingClientRect();(c.width===0||c.height===0)&&(s=0),e.interactable||(s*=.5)}catch{s=0}let a=0;if(e.strategies.includes("selector"))if(r.text){const c=(e.element.textContent||"").toLowerCase().trim(),d=r.text.toLowerCase().trim();if(c===d)a=100,O._logger.log("[HybridTargetResolver] Selector + exact text match bonus applied");else if(c.includes(d))a=70,O._logger.log("[HybridTargetResolver] Selector + partial text match bonus applied");else if(d.startsWith(c)&&c.length>=15&&c.length/d.length>=.3){const h=c.length/d.length;a=Math.round(70*h),O._logger.log(`[HybridTargetResolver] Selector + truncated text match bonus: ${a} (${Math.round(h*100)}% overlap)`)}else a=20,O._logger.log("[HybridTargetResolver] Selector match but NO text match - reduced bonus")}else a=100,O._logger.log("[HybridTargetResolver] Selector match bonus applied (no text to validate)");return i*.3+o*.4+s*.15+a*.15}static checkInteractability(e){try{if(!e.isConnected)return{ok:!1,reason:"Element is not connected to DOM"};let n;try{n=window.getComputedStyle(e)}catch{return{ok:!1,reason:"Cannot compute style (element may be in different document)"}}if(n.display==="none")return{ok:!1,reason:"Element has display: none"};if(n.visibility==="hidden")return{ok:!1,reason:"Element has visibility: hidden"};const r=parseFloat(n.opacity);if(isNaN(r)||r===0)return{ok:!1,reason:"Element has opacity: 0"};if(n.pointerEvents==="none")return{ok:!1,reason:"Element has pointer-events: none"};if(e.disabled)return{ok:!1,reason:"Element is disabled"};if(e.getAttribute("aria-disabled")==="true")return{ok:!1,reason:"Element has aria-disabled: true"};if(!e.offsetParent&&n.position!=="fixed"&&n.position!=="sticky"){let o=e.parentElement,s=!1;for(;o&&o!==document.body;){try{const a=window.getComputedStyle(o);if(a.position==="fixed"||a.position==="sticky"){s=!0;break}}catch{break}o=o.parentElement}if(!s)return{ok:!1,reason:"Element is not rendered (offsetParent is null)"}}let i;try{i=e.getBoundingClientRect()}catch{return{ok:!1,reason:"Cannot get bounding rect (element may be in different frame)"}}return i.width===0||i.height===0?{ok:!1,reason:"Element has zero dimensions"}:{ok:!0}}catch(n){return O._logger.warn("[HybridTargetResolver] checkInteractability error:",n),{ok:!1,reason:`Error checking interactability: ${n}`}}}static getAvailableStrategies(e){const n=[];return e.labelText&&n.push("labelText"),e.optionText&&n.push("optionText"),e.removeChipText&&n.push("removeChip"),e.selector&&n.push("selector"),e.domIndex!==void 0&&n.push("domIndex"),e.boundingBox&&n.push("boundingBox"),e.placeholder&&n.push("placeholder"),e.ariaLabel&&n.push("ariaLabel"),e.text&&n.push("text"),e.role&&n.push("role"),e.tag&&n.push("tag"),O._logger.log("[HybridTargetResolver] Auto-detected available strategies:",n.join(", ")),n}static findByDomIndex(e){return e===void 0?null:this.domIntrospector?this.domIntrospector.findElementByIndex(e):null}static findByBoundingBox(e,n,r){if(!e)return null;if(this.domIntrospector)return this.domIntrospector.findElementByBoundingBox(e,n,r);const i=10,o=document.body.querySelectorAll("*");let s=null,a=0;return o.forEach(l=>{var m;const c=l;if(Mt(c))return;const d=c.getBoundingClientRect(),h=Math.abs(d.x-e.x),f=Math.abs(d.y-e.y),g=Math.abs(d.width-e.width),y=Math.abs(d.height-e.height);if(h<=i&&f<=i&&g<=i*2&&y<=i*2){let S=100-h-f;n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r&&(((m=c.innerText)==null?void 0:m.trim().toLowerCase())||"").includes(r.toLowerCase())&&(S+=25),S>a&&(a=S,s=c)}}),s}static validateElementMatchesTarget(e,n){var o;if(!n.labelText&&!n.optionText&&!n.role&&!n.ariaLabel&&!n.placeholder&&!n.name&&!n.tag&&!n.text)return!0;const r=[];if(n.tag){const s=e.tagName.toLowerCase(),a=n.tag.toLowerCase();if(s!==a&&["input","select","textarea","button","a"].includes(a))return O._logger.log(`[HybridTargetResolver] Validation failed: tag="${s}" !== expected "${a}"`),!1;r.push("tag")}if(n.text&&!n.optionText){const s=(e.textContent||"").trim().toLowerCase(),a=n.text.trim().toLowerCase(),l=s===a,c=s.includes(a)||a.includes(s);if(!l&&!c)return O._logger.log(`[HybridTargetResolver] Validation failed: text="${s.slice(0,50)}" !== expected "${a}"`),!1;if(a.length<=10&&!l){const d=a.length/Math.max(s.length,1);if(d<.5)return O._logger.log(`[HybridTargetResolver] Validation failed: text match ratio too low (${d.toFixed(2)})`),!1}r.push("text")}const i=(s,a)=>{const l=s.toLowerCase().trim().replace(/\*$/,"").trim(),c=a.toLowerCase().trim();return l===c?!0:new RegExp(`(^|\\s)${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(s)};if(n.role){const s=e.getAttribute("role");if(s!==n.role)return O._logger.log(`[HybridTargetResolver] Validation failed: role="${s}" !== expected "${n.role}"`),!1;r.push("role")}if(n.ariaLabel){const s=e.getAttribute("aria-label")||"";if(!i(s,n.ariaLabel))return O._logger.log(`[HybridTargetResolver] Validation failed: aria-label="${s}" !== expected "${n.ariaLabel}"`),!1;r.push("ariaLabel")}if(n.placeholder){const s=e.placeholder||"";if(!i(s,n.placeholder))return O._logger.log(`[HybridTargetResolver] Validation failed: placeholder="${s}" !== expected "${n.placeholder}"`),!1;r.push("placeholder")}if(n.name){const s=e.getAttribute("name")||"";if(s!==n.name)return O._logger.log(`[HybridTargetResolver] Validation failed: name="${s}" !== expected "${n.name}"`),!1;r.push("name")}if(n.labelText){const s=this.getAssociatedLabelText(e);if(!s||!i(s,n.labelText))return O._logger.log(`[HybridTargetResolver] Validation failed: associated label="${s}" !== expected "${n.labelText}"`),!1;O._logger.log(`[HybridTargetResolver] ✓ Label validation passed: "${s}" matches "${n.labelText}"`),r.push("labelText")}if(n.optionText){const s=((o=e.textContent)==null?void 0:o.trim())||"";if(!i(s,n.optionText))return O._logger.log(`[HybridTargetResolver] Validation failed: option text="${s}" !== expected "${n.optionText}"`),!1;r.push("optionText")}return r.length>0&&O._logger.log(`[HybridTargetResolver] ✓ Validated: ${r.join(", ")}`),!0}static getAssociatedLabelText(e){var s,a,l,c;const n=e.getAttribute("id");if(n)try{const d=document.querySelector(`label[for="${CSS.escape(n)}"]`);if(d)return((s=d.textContent)==null?void 0:s.trim().replace(/\*$/,"").trim())||null}catch{}const r=e.getAttribute("aria-labelledby");if(r){const d=r.split(/\s+/).filter(h=>h.length>0);for(const h of d){const f=document.getElementById(h);if(f)return((a=f.textContent)==null?void 0:a.trim().replace(/\*$/,"").trim())||null}}let i=e.parentElement,o=0;for(;i&&o<8;){const d=i.querySelectorAll('label, .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"], .label');for(const h of d){if(e.contains(h)||h.contains(e)||h.querySelector('input, select, textarea, [role="combobox"]'))continue;if(i.querySelectorAll('input, select, textarea, [role="combobox"]').length===1){const g=(l=h.textContent)==null?void 0:l.trim().replace(/\*$/,"").trim();if(g&&g.length>0&&g.length<50)return g}else if(this.isLabelForElement(h,e,i)){const g=(c=h.textContent)==null?void 0:c.trim().replace(/\*$/,"").trim();if(g&&g.length>0&&g.length<50)return g}}i=i.parentElement,o++}return null}static isLabelForElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect(),s=i.bottom<=o.top+30,a=i.right<=o.left+30&&Math.abs(i.top-o.top)<60;if(!s&&!a)return!1;const l=r.querySelectorAll('input, select, textarea, [role="combobox"]');if(l.length<=1)return!0;for(const c of l){if(c===n)continue;const d=c.getBoundingClientRect();if(s&&(d.top>=i.bottom-5&&d.bottom<o.top||Math.abs(d.left-i.left)<Math.abs(o.left-i.left)&&d.top<o.top))return!1;if(a){const h=Math.abs(d.left-i.right),f=Math.abs(o.left-i.right);if(h<f&&Math.abs(d.top-i.top)<40)return!1}}return!0}static isTextNearElement(e,n,r){const i=e.getBoundingClientRect(),o=n.getBoundingClientRect();if(i.width===0||i.height===0||o.width===0||o.height===0)return(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;const s=i.bottom<=o.top+40,a=i.right<=o.left+20&&Math.abs(i.top-o.top)<50;if(!s&&!a)return!1;for(const l of r){if(l===n)continue;const c=l.getBoundingClientRect();if(!(c.width===0||c.height===0)){if(s&&c.top>=i.bottom-10&&c.bottom<o.top||s&&Math.abs(c.left-i.left)<Math.abs(o.left-i.left)-20&&c.top<o.top&&c.top>=i.bottom-50)return!1;if(a){const d=Math.abs(c.left-i.right),h=Math.abs(o.left-i.right);if(d<h-10&&Math.abs(c.top-i.top)<40)return!1}}}return!0}static isHiddenPlaceholderInput(e){const n=e.tagName.toLowerCase(),r=e.getAttribute("role");if(r==="option"||r==="menuitem"||r==="treeitem"||e.closest('[role="listbox"], [role="menu"], [role="tree"]')||n!=="input"&&!r)return!1;if(e.getAttribute("tabindex")==="-1"&&n==="input")return O._logger.log('[HybridTargetResolver] → Input has tabindex="-1" (hidden placeholder)'),!0;try{const o=window.getComputedStyle(e);if(o.opacity==="0")return O._logger.log("[HybridTargetResolver] → Element has opacity: 0 (hidden placeholder)"),!0;if(o.visibility==="hidden")return O._logger.log("[HybridTargetResolver] → Element has visibility: hidden (hidden placeholder)"),!0;const s=e.getBoundingClientRect();if(s.width<=5&&s.height<=5)return O._logger.log(`[HybridTargetResolver] → Element is too small (${s.width}x${s.height}) - hidden placeholder`),!0;if(o.position==="absolute"){const a=e.parentElement;if(a&&a.getBoundingClientRect().width>s.width*10&&s.width<20)return O._logger.log("[HybridTargetResolver] → Element is tiny absolute-positioned (hidden placeholder)"),!0}}catch{}return!1}static getClickableContainer(e){var o,s,a;if(!this.isHiddenPlaceholderInput(e))return e;O._logger.log("[HybridTargetResolver] → Looking for clickable container...");const n=['[class*="-control"]','[class*="control"]',".MuiSelect-select",".MuiInputBase-root",".MuiOutlinedInput-root",".MuiRadio-root",".MuiCheckbox-root",".MuiFormControlLabel-root",".ant-radio-wrapper",".ant-radio-button-wrapper",".ant-checkbox-wrapper","nz-radio","nz-radio-button","nz-checkbox","[nz-radio]","[nz-radio-button]","[nz-checkbox]",'[role="button"]','[role="combobox"]:not(input)','[role="radio"]','[role="checkbox"]','[aria-haspopup="listbox"]','[class*="select-container"]','[class*="dropdown-container"]','[class*="picker"]','[class*="radio-wrapper"]','[class*="checkbox-wrapper"]'];let r=e.parentElement,i=0;for(;r&&i<6;){if(r.tagName==="LABEL"){const c=r.getBoundingClientRect();if(c.width>10&&c.height>10)return O._logger.log(`[HybridTargetResolver] → Found clickable container (label): ${r.tagName}.${(o=r.className)==null?void 0:o.split(" ").slice(0,2).join(".")}`),r}for(const c of n)try{if(r.matches(c)){const d=r.getBoundingClientRect();if(d.width>10&&d.height>10)return O._logger.log(`[HybridTargetResolver] → Found clickable container: ${r.tagName}.${(s=r.className)==null?void 0:s.split(" ").slice(0,2).join(".")}`),r}}catch{}const l=r.getBoundingClientRect();if(l.width>100&&l.height>30){const c=r.getAttribute("role"),d=r.onclick!==null||r.getAttribute("onclick")!==null||r.classList.contains("clickable");if(c==="button"||c==="combobox"||d||r.querySelector('input[role="combobox"]')===e)return O._logger.log(`[HybridTargetResolver] → Found clickable container (generic): ${r.tagName}.${(a=r.className)==null?void 0:a.split(" ").slice(0,2).join(".")}`),r}r=r.parentElement,i++}return O._logger.log("[HybridTargetResolver] → No clickable container found, using original element"),e}static findBySelector(e){if(!e)return null;const n=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\");O._logger.log(`[HybridTargetResolver] → Normalized selector: "${n}"`);const r=n.match(/\[data-option-text="([^"]+)"\]/);if(r){const l=r[1];return O._logger.log(`[HybridTargetResolver] → Virtual selector - searching for option text: "${l}"`),this.findDropdownOptionByText(l)}const i=n.match(/\[data-label="([^"]+)"\]/);if(i){const l=i[1];return O._logger.log(`[HybridTargetResolver] → Virtual selector - searching for combobox with label: "${l}"`),this.findComboboxByLabel(l)}const o=n.replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim();if(/#?react-select-\d+-(input|listbox|option|placeholder|live-region)/.test(o))return O._logger.log(`[HybridTargetResolver] → Detected unstable React-Select ID pattern in "${o}", skipping selector strategy`),null;if(o==='input[role="combobox"]'||o==='[role="combobox"]'){const l=document.querySelectorAll(o);l.length>1&&(O._logger.warn(`[HybridTargetResolver] ⚠️ AMBIGUOUS SELECTOR: "${o}" matches ${l.length} elements!`),O._logger.warn("[HybridTargetResolver] ⚠️ Bot should send more specific targeting (text, label, boundingBox, domIndex)"),l.forEach((c,d)=>{const h=c,f=h.getAttribute("placeholder")||"",g=h.getAttribute("aria-label")||"",y=h.id||"";O._logger.log(`[HybridTargetResolver] ${d}: id="${y}" placeholder="${f}" aria-label="${g}"`)}))}const a=document.querySelector(o);return a?this.isAccessibilityOnlyElement(a)?(O._logger.log(`[HybridTargetResolver] → Selector matched a11y-only element (class: ${a.className}), skipping`),null):a:(O._logger.log(`[HybridTargetResolver] → Selector "${o}" matched 0 elements`),null)}static isAccessibilityOnlyElement(e){const n=typeof e.className=="string"?e.className:"",r=(e.textContent||"").trim();if(n.includes("a11yText")&&!r||n.includes("sr-only")||n.includes("visually-hidden")||n.includes("screenreader")||n.includes("screen-reader")||e.getAttribute("aria-live")&&!r||e.getAttribute("role")==="log"&&!r)return!0;try{const i=getComputedStyle(e);if(i.position==="absolute"&&(i.width==="1px"||i.height==="1px"||i.clip==="rect(0px, 0px, 0px, 0px)"||i.clipPath==="inset(50%)"))return!0}catch{}return!1}static isDropdownDisplayValue(e){var a;const n=(e.className||"").toLowerCase(),r=(((a=e.parentElement)==null?void 0:a.className)||"").toLowerCase(),i=["singlevalue","single-value","selectedvalue","selected-value","placeholder","value-container","valuecontainer","muiselect-select","select__single-value"];for(const l of i)if(n.includes(l)||r.includes(l))return!0;const o=e.closest('[class*="-control"]:not([class*="-menu"])'),s=!e.closest('[role="listbox"], [role="menu"], [class*="-menu"]');return!!(o&&s)}static findDropdownOptionByText(e){return Bo(e,O.isVisible)}static findMultiSelectChipRemoveButton(e){var i;const n=e.toLowerCase().trim();O._logger.log(`[HybridTargetResolver] → Searching for multi-select chip: "${e}"`);const r=['[class*="multiValue"]','[class*="multi-value"]','[class*="chip"]','[class*="tag"]',"[data-tag]"];for(const o of r){let s;try{s=document.querySelectorAll(o)}catch{continue}for(const a of s){const l=a;if(!this.isVisible(l))continue;const c=l.querySelector('[class*="label"], [class*="Label"], span:first-of-type'),d=c?(c.textContent||"").trim().toLowerCase():(l.textContent||"").replace(/×|✕|x/gi,"").trim().toLowerCase();if(d===n||d.includes(n)||n.includes(d)){O._logger.log(`[HybridTargetResolver] → Found chip with text: "${(i=l.textContent)==null?void 0:i.trim().substring(0,30)}..."`);const h=['[role="button"]','[class*="remove"]','[class*="Remove"]','[class*="clear"]','[class*="delete"]','[aria-label*="Remove"]','[aria-label*="remove"]','[aria-label*="Delete"]','[aria-label*="delete"]',"button","svg"];for(const f of h){const g=l.querySelector(f);if(g&&this.isVisible(g))return O._logger.log(`[HybridTargetResolver] → Found remove button: <${g.tagName.toLowerCase()}> with selector "${f}"`),g}return O._logger.log("[HybridTargetResolver] → No specific remove button found, returning chip container"),l}}}return O._logger.log(`[HybridTargetResolver] → No chip found with text: "${e}"`),null}static findComboboxByLabel(e){const n=e.toLowerCase().trim(),r=a=>a.toLowerCase().trim().replace(/\*$/,"").trim()===n?!0:new RegExp(`(^|\\s)${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}($|\\s|[:\\*\\?\\.\\,])`,"i").test(a),i=document.querySelectorAll("label[for]");for(const a of i)if(r(a.textContent||"")){const l=a.getAttribute("for");if(l){const c=document.getElementById(l);if(c&&(c.getAttribute("role")==="combobox"||c.getAttribute("aria-haspopup")==="listbox"))return O._logger.log(`[HybridTargetResolver] → Found combobox via label[for]: "${e}"`),c}}const o=document.querySelectorAll('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');for(const a of o){const l=a.getAttribute("aria-labelledby");if(l){const c=document.getElementById(l.split(/\s+/)[0]);if(c&&r(c.textContent||""))return O._logger.log(`[HybridTargetResolver] → Found combobox via aria-labelledby: "${e}"`),a}}const s=document.querySelectorAll("label");for(const a of s)if(r(a.textContent||"")){const l=a.closest('fieldset, [role="group"], form > div, [class*="form"], [class*="field"]')||a.parentElement;if(l){const c=l.querySelector('input[role="combobox"], button[aria-haspopup="listbox"], [role="combobox"]');if(c&&this.isElementVisible(c))return O._logger.log(`[HybridTargetResolver] → Found combobox in label container: "${e}"`),c}}return null}static isElementVisible(e){const n=e.getBoundingClientRect();if(n.width===0||n.height===0)return!1;if(!e.offsetParent)try{const r=window.getComputedStyle(e);if(r.position!=="fixed"&&r.position!=="sticky")return!1}catch{return!1}return!0}static findElementByLabelText(e,n){var g,y,m;const i=n.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim(),o=i.toLowerCase().trim(),s=["*","div","span","p","a","li","ul","section","article"],a=/\[role=/.test(i);if(s.includes(o)&&!a)return null;let l;try{l=document.querySelectorAll(i)}catch{return O._logger.warn(`[HybridTargetResolver] → Invalid selector: "${i}"`),null}if(l.length===0)return null;O._logger.log(`[HybridTargetResolver] → Looking for "${i}" associated with label "${e}"`),O._logger.log(`[HybridTargetResolver] → Found ${l.length} elements matching selector`);const c=e.toLowerCase().trim();function d(S){return S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const h=S=>S.toLowerCase().trim().replace(/\*$/,"").trim()===c?!0:new RegExp(`(^|\\s)${d(c)}($|\\s|[:\\*\\?\\.\\,\\)\\]\\}\\-])`,"i").test(S),f=S=>{const v=S,w=v.getBoundingClientRect();if(w.width===0||w.height===0)return!1;if(!v.offsetParent)try{const C=window.getComputedStyle(v).position;if(C!=="fixed"&&C!=="sticky")return!1}catch{return!1}return!0};for(const S of l){if(!f(S))continue;const v=S.getAttribute("id");if(v)try{const A=document.querySelector(`label[for="${CSS.escape(v)}"]`);if(A&&h(A.textContent||""))return O._logger.log("[HybridTargetResolver] → Found via label[for] attribute"),S}catch{}const w=S.getAttribute("aria-labelledby");if(w){const A=w.split(/\s+/).filter(R=>R.length>0);for(const R of A){const G=document.getElementById(R);if(G&&h(G.textContent||""))return O._logger.log("[HybridTargetResolver] → Found via aria-labelledby"),S}}const k=S.getAttribute("aria-label")||"";if(k&&h(k))return O._logger.log("[HybridTargetResolver] → Found via aria-label"),S;const C=S.getAttribute("placeholder")||"";if(C&&h(C))return O._logger.log("[HybridTargetResolver] → Found via placeholder"),S;let E=S.parentElement,L=0;for(;E&&L<6;){const A=E.querySelectorAll('input, select, textarea, [role="combobox"], [role="listbox"]'),R=Array.from(A),G=R.includes(S),U=E.classList.contains("MuiFormControl-root")||E.tagName==="FIELDSET"||/form(-|_)?(field|group|control|item|row)/i.test(E.className)||E.childElementCount>=2&&E.childElementCount<=5,K=E.querySelectorAll('label, [class*="label"]:not(input):not(select):not(textarea):not([role="combobox"]), .MuiFormLabel-root, [class*="FormLabel"], [class*="form-label"], [class*="field-label"]');for(const j of K){if(S.contains(j)||j.contains(S)||j.querySelector('input, select, textarea, [role="combobox"]'))continue;const H=((g=j.textContent)==null?void 0:g.trim())||"";if(!(H.length>50)&&h(H)){if(A.length===1&&G)return O._logger.log(`[HybridTargetResolver] → Found via label in container: "${H}"`),S;if(G&&this.isTextNearElement(j,S,R))return O._logger.log(`[HybridTargetResolver] → Found via label position: "${H}"`),S}}if(U||L>=3){const j=E.querySelectorAll(":scope > div, :scope > span, :scope > p, :scope > div > div, :scope > div > span, :scope > div > p");for(const H of j){if(H.querySelector('input, select, textarea, [role="combobox"]')||H.contains(S)||S.contains(H))continue;const ie=S.value||"";if(ie&&((y=H.textContent)==null?void 0:y.trim())===ie)continue;const Q=((m=H.textContent)==null?void 0:m.trim())||"";if(Q.length>0&&Q.length<=30&&h(Q)){if(A.length===1&&G)return O._logger.log(`[HybridTargetResolver] → Found via nearby text: "${Q}"`),S;if(G&&this.isTextNearElement(H,S,R))return O._logger.log(`[HybridTargetResolver] → Found via nearby text (position): "${Q}"`),S}}}E=E.parentElement,L++}}return null}static escapeXPathString(e){const n=e.replace(/[\n\r\t]+/g," ").replace(/\s+/g," ").trim();if(n.includes('"')&&n.includes("'")){const r=n.split('"');return`concat(${r.map((o,s)=>s===r.length-1?`"${o}"`:`"${o}", '"'`).join(", ")})`}return n.includes('"')?`'${n}'`:`"${n}"`}static escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}static findByText(e,n,r){var C,E,L,A,R,G,U;if(!e)return null;const i=e.trim();if(!i)return null;const o=i.toLowerCase(),s=n||"*",a=this.escapeXPathString(i);if(r){const K=this.findElementByLabelText(i,r);if(K)return O._logger.log(`[HybridTargetResolver] → Found element matching selector "${r}" associated with label "${i}"`),K}const l=`//${s}[normalize-space(.)=${a}]`;O._logger.log(`[HybridTargetResolver] → XPath exact query: ${l}`);let c;try{c=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(K){O._logger.warn("[HybridTargetResolver] → XPath query failed:",K),c={snapshotLength:0,snapshotItem:()=>null}}if(c.snapshotLength>0){O._logger.log(`[HybridTargetResolver] → Found ${c.snapshotLength} exact match(es), checking visibility...`);let K=null,j=null;for(let H=0;H<c.snapshotLength;H++){const ie=c.snapshotItem(H);if(j||(j=ie),this.isDropdownDisplayValue(ie)){O._logger.log(`[HybridTargetResolver] → Skipping display value (not an option): "${(C=ie.textContent)==null?void 0:C.trim().substring(0,30)}..."`);continue}const Q=ie.getBoundingClientRect();if(Q.width>0&&Q.height>0){K=ie,O._logger.log(`[HybridTargetResolver] → Returning visible match ${H}: "${(E=ie.textContent)==null?void 0:E.trim().substring(0,30)}..."`);break}}if(K)return K;if(j&&!this.isDropdownDisplayValue(j))return O._logger.log("[HybridTargetResolver] → No visible matches, returning first (possibly hidden) element"),j}O._logger.log("[HybridTargetResolver] → No exact match, trying partial match...");const d=`//${s}[contains(normalize-space(.), ${a})]`;O._logger.log(`[HybridTargetResolver] → XPath partial query: ${d}`);let h;try{h=document.evaluate(d,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(K){O._logger.warn("[HybridTargetResolver] → XPath partial query failed:",K),h={snapshotLength:0,snapshotItem:()=>null}}if(h.snapshotLength>0){let K=null,j=-1;const H=r?this.extractSelectorContext(r):{},ie=!!(H.parentTag||H.parentSelector);O._logger.log(`[HybridTargetResolver] → Selector context: parentTag="${H.parentTag||"none"}", expectedTag="${H.expectedTag||"none"}"`);for(let Q=0;Q<h.snapshotLength;Q++){const V=h.snapshotItem(Q),X=(V.textContent||"").trim();if(X.length===0)continue;const B=X.toLowerCase(),q=o.length/B.length,z=V.getBoundingClientRect();if(z.width===0||z.height===0||this.isDropdownDisplayValue(V))continue;let le=q;if(new RegExp(`\\b${O.escapeRegex(o)}\\b`,"i").test(B))le+=.5;else if(q<.5)if(ie){if(this.matchesSelectorContext(V,H)<.5){O._logger.log(`[HybridTargetResolver] → Skipping low ratio match that doesn't match selector context: "${X.slice(0,30)}..."`);continue}}else{O._logger.log(`[HybridTargetResolver] → Skipping low ratio match (${q.toFixed(2)}): "${X.slice(0,30)}..."`);continue}if(ie){const b=this.matchesSelectorContext(V,H);le+=b*.3}le>j&&(j=le,K=V)}if(K)return O._logger.log(`[HybridTargetResolver] → XPath partial match found (score=${j.toFixed(2)})!`),K}O._logger.log("[HybridTargetResolver] → XPath found nothing, trying fallback...");const f=document.querySelectorAll(n||"*");O._logger.isDebug&&O._logger.log(`[HybridTargetResolver] → Fallback: checking ${f.length} <${n||"*"}> elements for text "${i}"`);const g=K=>{const j=K;return Mt(j)?!0:j.id==="root"||j.id==="app"||j.id==="__next"||j.tagName==="BODY"||j.tagName==="HTML"};for(const K of f){if(g(K)||(((L=K.textContent)==null?void 0:L.trim().toLowerCase())||"")!==o)continue;const H=K.getBoundingClientRect();if(H.width>0&&H.height>0&&(((A=K.innerText)==null?void 0:A.trim().toLowerCase())||"")===o)return O._logger.log("[HybridTargetResolver] → Found via exact text match"),K}let y=null,m=-1/0;for(const K of f){if(g(K))continue;const j=((R=K.textContent)==null?void 0:R.trim().toLowerCase())||"";if(j.length!==0&&j.includes(o)){const H=o.length/j.length,ie=K.getBoundingClientRect(),Q=ie.width*ie.height;if(Q>0&&Q<5e5){const V=Math.max(0,50-Q/1e4),X=H*50,B=V+X;B>m&&(m=B,y=K)}}}if(y){const K=y.getBoundingClientRect();return O._logger.log(`[HybridTargetResolver] → Found via textContent (${K.width.toFixed(0)}x${K.height.toFixed(0)}px, score=${m.toFixed(0)})`),y}const S=n&&["input","textarea"].includes(n.toLowerCase())?n.toLowerCase():"input, textarea",v=document.querySelectorAll(S);O._logger.log(`[HybridTargetResolver] → Checking ${v.length} input/textarea elements for placeholder "${i}"`);for(const K of v){const j=K;if(Mt(j))continue;const H=((G=j.getAttribute("placeholder"))==null?void 0:G.trim())||"";if(H.toLowerCase()===o){const ie=j.getBoundingClientRect();if(ie.width>0&&ie.height>0)return O._logger.log(`[HybridTargetResolver] → Found via placeholder match: "${H}"`),j}}let w=null,k=0;for(const K of v){const j=K;if(Mt(j))continue;const H=((U=j.getAttribute("placeholder"))==null?void 0:U.trim().toLowerCase())||"";if(H&&H.includes(o)){const ie=o.length/H.length;if(ie>.6&&ie>k){const Q=j.getBoundingClientRect();Q.width>0&&Q.height>0&&(w=j,k=ie)}}}return w?(O._logger.log(`[HybridTargetResolver] → Found via partial placeholder match (ratio=${k.toFixed(2)})`),w):null}static findByAriaLabel(e){if(!e)return null;let n=document.querySelector(`[aria-label="${e}"]`);if(n)return O._logger.log("[HybridTargetResolver] → Found via exact aria-label match"),n;const r=document.querySelectorAll("[aria-label]");O._logger.log(`[HybridTargetResolver] → Checking ${r.length} elements with aria-label`);for(const i of r){const o=i.getAttribute("aria-label")||"";if(o.toLowerCase().includes(e.toLowerCase()))return O._logger.log(`[HybridTargetResolver] → Found via partial aria-label match: "${o}"`),i}return null}static findByPlaceholder(e){if(!e)return null;let n=document.querySelector(`[placeholder="${e}"]`);if(n)return O._logger.log("[HybridTargetResolver] → Found via exact placeholder match"),n;const r=document.querySelectorAll("input, textarea");O._logger.log(`[HybridTargetResolver] → Checking ${r.length} input/textarea elements`);for(const i of r){const o=i.getAttribute("placeholder")||"";if(o.toLowerCase().includes(e.toLowerCase()))return O._logger.log(`[HybridTargetResolver] → Found via partial placeholder match: "${o}"`),i}return null}static findByRole(e,n){var i;if(!e)return null;const r=document.querySelectorAll(`[role="${e}"]`);if(O._logger.log(`[HybridTargetResolver] → Found ${r.length} elements with role="${e}"`),n){for(const o of r)if((((i=o.textContent)==null?void 0:i.trim())||"").toLowerCase().includes(n.toLowerCase()))return O._logger.log("[HybridTargetResolver] → Found role element with matching text"),o}return r[0]||null}static findByTag(e,n){var i,o,s;if(!e)return null;const r=document.getElementsByTagName(e);if(O._logger.log(`[HybridTargetResolver] → Found ${r.length} <${e}> elements`),n){const a=n.toLowerCase().trim();let l=null,c=null,d=0;for(const h of r){const f=h;if(f.id==="root"||f.id==="app"||f.tagName==="BODY"||f.tagName==="HTML"||!O.isVisible(f)||(((i=f.innerText)==null?void 0:i.length)||0)>200)continue;const y=((o=f.innerText)==null?void 0:o.trim())||"",m=y.toLowerCase();if(m===a){O._logger.log(`[HybridTargetResolver] → Found exact match: "${y.substring(0,50)}..."`),l=f;break}if(m.includes(a)){const S=a.length/m.length;S>.7&&S>d&&(c=f,d=S)}}if(l)return l;if(c){const h=((s=c.innerText)==null?void 0:s.trim().substring(0,50))||"";return O._logger.log(`[HybridTargetResolver] → Found close match (${(d*100).toFixed(0)}%): "${h}..."`),c}return O._logger.log(`[HybridTargetResolver] → No matching <${e}> found for text "${n}"`),null}if(e==="div"||e==="span")return O._logger.log(`[HybridTargetResolver] → REFUSING to blindly return first <${e}> - too ambiguous without text`),null;for(const a of r){const l=a;if(l.id==="root"||l.id==="app"||l.tagName==="BODY"||l.tagName==="HTML"||l.classList.contains("App"))continue;const c=l.getBoundingClientRect();if(!(c.width>500&&c.height>500)&&c.width>0&&c.height>0)return l}return null}static isVisible(e){const n=e.getBoundingClientRect(),r=window.getComputedStyle(e);return n.width>0&&n.height>0&&r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}static scrollIntoView(e,n){O._logger.log("[HybridTargetResolver] 📜 Scrolling element into view"),e.scrollIntoView({behavior:"smooth",block:"center",...n})}static async waitForPositionStability(e,n=1e3,r=50,i=2){O._logger.log("[HybridTargetResolver] ⏳ Waiting for element position stability...");let o=e.getBoundingClientRect(),s=0;const a=3,l=Date.now();for(;Date.now()-l<n;){await new Promise(f=>setTimeout(f,r));const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return O._logger.warn("[HybridTargetResolver] ⚠️ Element disappeared during stability check"),null;const d=Math.abs(c.x-o.x),h=Math.abs(c.y-o.y);if(d<i&&h<i){if(s++,s>=a)return O._logger.log(`[HybridTargetResolver] ✅ Element position stable at (${c.x.toFixed(0)}, ${c.y.toFixed(0)}) after ${Date.now()-l}ms`),c}else s=0,O._logger.log(`[HybridTargetResolver] 📍 Element still moving: (${o.x.toFixed(0)}, ${o.y.toFixed(0)}) → (${c.x.toFixed(0)}, ${c.y.toFixed(0)})`);o=c}return O._logger.warn(`[HybridTargetResolver] ⚠️ Position stability timeout after ${n}ms`),e.getBoundingClientRect()}static reResolveAndVerify(e,n){var a,l,c;const r={text:e.text,selector:e.selector,selectorFallbacks:e.selectorFallbacks,tag:e.tag,ariaLabel:e.ariaLabel,placeholder:e.placeholder,role:e.role,labelText:e.labelText,optionText:e.optionText,name:e.name,removeChipText:e.removeChipText,dropdownTriggerSelector:e.dropdownTriggerSelector,selectedValues:e.selectedValues,strategy:(a=e.strategy)==null?void 0:a.filter(d=>d!=="boundingBox"&&d!=="domIndex")};O._logger.log("[HybridTargetResolver] 🔄 Re-resolving with position-independent target (no boundingBox/domIndex)");const i=this.resolveTarget(r);if(!i)return O._logger.warn("[HybridTargetResolver] ⚠️ Re-resolution failed - element no longer found"),null;const o=((l=n.textContent)==null?void 0:l.trim().toLowerCase())||"",s=((c=i.textContent)==null?void 0:c.trim().toLowerCase())||"";return o!==s&&o&&s&&O._logger.warn(`[HybridTargetResolver] ⚠️ Element changed during wait: "${o}" → "${s}"`),i}};P(O,"domIntrospector",null),P(O,"_logger",de);let be=O;class u_{constructor(e=de){P(this,"confirmationSound");P(this,"logger");P(this,"lastError",null);this.logger=e,be.setLogger(e),this.confirmationSound=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=")}humanLikeClick(e,n={}){return Ov(e,n)}async executeWithConsent(e,n=!0){try{if(n&&this.isDestructive(e)&&!await this.getConsent(e))return!1;const r=await this.execute(e);return r&&(this.confirmationSound.play().catch(()=>{}),this.logger.log(`[ActionExecutor] Executed ${e.type} on ${e.selector}`)),r}catch(r){return this.logger.error("[ActionExecutor] Failed to execute action:",r),!1}}async executeHybridAction(e,n=!0){this.lastError=null;try{if(this.logger.log("[ActionExecutor] Executing hybrid action:",e),e.action==="navigate"){const s=e.value;if(!s)return this.logger.error("[ActionExecutor] Navigate action missing target URL"),this.lastError="Navigate action missing target URL",!1;let a;try{const l=new URL(s,window.location.origin);if(l.protocol!=="http:"&&l.protocol!=="https:")return this.logger.error("[ActionExecutor] Navigate blocked — disallowed scheme:",l.protocol),this.lastError=`Navigate blocked: disallowed URL scheme "${l.protocol}"`,!1;if(l.origin!==window.location.origin)return this.logger.error("[ActionExecutor] Navigate blocked — cross-origin URL:",l.origin),this.lastError="Navigate blocked: cross-origin URL not allowed",!1;a=l.href}catch{return this.logger.error("[ActionExecutor] Navigate blocked — invalid URL:",s),this.lastError=`Navigate blocked: invalid URL "${s}"`,!1}this.logger.log("[ActionExecutor] 🧭 Navigating to URL:",a);try{const l=new URL(a),c=window.location.href,d=l.hash!==window.location.hash,h=l.pathname+l.search+l.hash;return history.pushState(null,"",h),window.dispatchEvent(new PopStateEvent("popstate",{state:null})),d&&window.dispatchEvent(new HashChangeEvent("hashchange",{oldURL:c,newURL:l.href})),!0}catch{}return window.location.href=a,!0}if(e.target.optionText&&e.action==="click"){this.logger.log("[ActionExecutor] 🔽 Dropdown option click detected:",e.target.optionText);let s=be.resolveTarget(e.target);if(!s){this.logger.log("[ActionExecutor] Option not visible - dropdown may be closed, attempting to open...");let a=!1;if(e.target.dropdownTriggerSelector){this.logger.log("[ActionExecutor] Using dropdownTriggerSelector:",e.target.dropdownTriggerSelector);const l=Mv(e.target.dropdownTriggerSelector);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.labelText){this.logger.log("[ActionExecutor] Trying to find dropdown by label:",e.target.labelText);const l=this.findComboboxByLabel(e.target.labelText);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.selector){this.logger.log("[ActionExecutor] Trying to find dropdown by selector:",e.target.selector);const l={...e.target,optionText:void 0},c=be.resolveTarget(l);if(c){const d=this.findComboboxInput(c);d&&(this.handleComboboxClick(d),a=!0)}}if(a){if(this.logger.log("[ActionExecutor] Waiting for dropdown to open..."),await new Promise(l=>setTimeout(l,300)),s=be.resolveTarget(e.target),!s)return this.logger.warn("[ActionExecutor] ❌ Option still not found after opening dropdown:",e.target.optionText),!1;this.logger.log("[ActionExecutor] ✅ Found option after opening dropdown")}else return this.logger.warn("[ActionExecutor] ❌ Could not open dropdown - no trigger found. Add a separate task to open the dropdown first."),!1}return n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e)?!1:(be.scrollIntoView(s),await new Promise(a=>setTimeout(a,100)),this.performClick(s),this.confirmationSound.play().catch(()=>{}),this.logger.log(`[ActionExecutor] ✅ Successfully clicked dropdown option: "${e.target.optionText}"`),!0)}const r=be.resolveTarget(e.target);if(!r)return this.logger.warn("[ActionExecutor] Could not resolve target:",e.target),!1;if(n&&this.isHybridActionDestructive(e)&&!await this.getHybridConsent(e))return!1;const i=e.target.selector,o=await this.executeOnElement(e.action,r,e.value,i);return o&&(this.confirmationSound.play().catch(()=>{}),this.logger.log(`[ActionExecutor] Successfully executed "${e.action}" on element`)),o}catch(r){return this.logger.error("[ActionExecutor] Failed to execute hybrid action:",r),this.lastError=r instanceof Error?r.message:String(r),!1}}async executeOnElement(e,n,r,i){var o;switch(be.scrollIntoView(n),await new Promise(s=>setTimeout(s,300)),e){case"click":await this.expandCollapsedContainer(n),this.simulateClick(n,i);break;case"type":if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)n.focus(),n.value=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}));else if(n.getAttribute("contenteditable")==="true")n.focus(),n.textContent=r||"",n.dispatchEvent(new Event("input",{bubbles:!0}));else return console.error(`[ActionExecution] BLOCKED: type action on non-editable element <${n.tagName.toLowerCase()}> (id="${n.id}", class="${(o=n.className)==null?void 0:o.toString().slice(0,50)}"). Only input, textarea, and contenteditable elements are valid type targets.`),!1;break;case"focus":n.focus();break;case"hover":n.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),n.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":n.scrollIntoView({behavior:"smooth",block:"center"});break;case"highlight":n.style.outline="3px solid #00aaff",n.style.outlineOffset="2px";break;default:return this.logger.warn("[ActionExecutor] Unknown action type:",e),!1}return!0}async expandCollapsedContainer(e){const n=this.findCollapsedContainer(e);if(n){this.logger.log("[ActionExecutor] Found collapsed container, hovering to expand...");const r=n.getBoundingClientRect(),i=r.left+r.width/2,o=r.top+r.height/2,s={bubbles:!0,cancelable:!0,view:window,clientX:i,clientY:o};n.dispatchEvent(new MouseEvent("mouseenter",s)),n.dispatchEvent(new MouseEvent("mouseover",s));const a=e.getBoundingClientRect(),l={bubbles:!0,cancelable:!0,view:window,clientX:a.left+a.width/2,clientY:a.top+a.height/2};e.dispatchEvent(new MouseEvent("mouseenter",l)),e.dispatchEvent(new MouseEvent("mouseover",l)),await new Promise(c=>setTimeout(c,400)),this.logger.log("[ActionExecutor] Container expanded, proceeding with click")}}findCollapsedContainer(e){let n=e.parentElement;for(;n&&n!==document.body;){const r=window.getComputedStyle(n),i=n.getBoundingClientRect().width,o=r.transition.includes("width")||r.transitionProperty.includes("width")||r.transitionProperty==="all",s=i<80,a=n.offsetHeight>window.innerHeight*.7,l=typeof n.className=="string"?n.className:"",c=l.includes("sidebar")||l.includes("nav")||l.includes("menu");if(s&&(o||c)&&a)return this.logger.log("[ActionExecutor] Detected collapsed container:",{width:i,hasTransition:o,isFullHeight:a,classes:n.className.substring(0,100)}),n;n=n.parentElement}return null}simulateClick(e,n){if(n){const d=this.parseOptionTextFromSelector(n);if(d){this.logger.log("[ActionExecutor] 🎯 Detected dropdown option selector, searching for:",d);const f=this.findDropdownOption(d);if(f){this.logger.log("[ActionExecutor] Found option by text, clicking it"),this.performClick(f);return}this.logger.log("[ActionExecutor] Option not found by text, trying direct click")}const h=this.parseLabelFromSelector(n);if(h){this.logger.log("[ActionExecutor] 🎯 Detected labeled combobox selector:",h);const f=this.findComboboxByLabel(h);if(f){this.logger.log("[ActionExecutor] Found combobox by label, opening it"),this.handleComboboxClick(f);return}this.logger.log("[ActionExecutor] Combobox not found by label, trying direct match")}}const r=this.findComboboxInput(e);if(r){this.logger.log("[ActionExecutor] 🎯 Detected combobox/dropdown - using special handling"),this.handleComboboxClick(r);return}if(this.isDropdownOption(e)){this.logger.log("[ActionExecutor] 🎯 Element is dropdown option - using React onClick + DOM events");const d=this.triggerReactOnClick(e);this.logger.log(`[ActionExecutor] React onClick triggered: ${d}`),this.performClick(e);return}const i=this.findClickableElement(e),o=i.getBoundingClientRect(),s=o.left+o.width/2,a=o.top+o.height/2;if(i.focus&&i.focus(),this.hasReactOnClickHandler(i)){if(this.logger.log("[ActionExecutor] 🎯 Element has React onClick - using direct call only"),this.triggerReactOnClick(i)){this.sendClickMetadata(i,e),this.logger.log("[ActionExecutor] ✅ React onClick executed at",s,a,"on",i.tagName),i!==e&&this.logger.log("[ActionExecutor] Note: Clicked parent",i.tagName,"instead of",e.tagName);return}this.logger.log("[ActionExecutor] ⚠️ React onClick found but call failed, falling back to DOM events")}this.logger.log("[ActionExecutor] Using humanLikeClick (no React onClick or fallback)");const c=this.humanLikeClick(i,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});c!==e&&c!==i&&this.logger.log("[ActionExecutor] Note: humanLikeClick hit",c.tagName,"instead of element",e.tagName,"or clickTarget",i.tagName)}findComboboxInput(e){if(e.getAttribute("role")==="combobox")return this.logger.log("[ActionExecutor] Element is combobox"),e;if(e.getAttribute("aria-haspopup")==="listbox"||e.getAttribute("aria-haspopup")==="true"){const o=e.querySelector('input[role="combobox"]');if(o)return this.logger.log("[ActionExecutor] Found combobox via aria-haspopup container"),o;if(e.tagName==="BUTTON")return this.logger.log("[ActionExecutor] Element is button with aria-haspopup"),e}let n=e,r=0;const i=5;for(;n&&r<i;){const o=typeof n.className=="string"?n.className:"",s=o.includes("css-")&&o.includes("control"),a=o.includes("css-")&&o.includes("ValueContainer"),l=o.includes("css-")&&o.includes("Indicator"),c=o.includes("MuiSelect-select")||o.includes("MuiAutocomplete-inputRoot"),d=(o.includes("headlessui")||o.includes("radix"))&&(o.includes("trigger")||o.includes("button"));if(s||a||l||c||d||o.includes("control")&&n.querySelector('input[role="combobox"]')||o.includes("trigger")&&n.getAttribute("aria-haspopup")){const f=n.querySelector('input[role="combobox"]');if(f)return this.logger.log("[ActionExecutor] Found combobox input via control element"),f;const g=n.parentElement;if(g){const m=g.querySelector('input[role="combobox"]');if(m)return this.logger.log("[ActionExecutor] Found combobox input in parent container"),m}const y=n.querySelector('button[aria-haspopup="listbox"]');if(y)return this.logger.log("[ActionExecutor] Found listbox trigger button"),y}n=n.parentElement,r++}return null}parseOptionTextFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-option-text="([^"]+)"\]/);return r?r[1]:null}parseLabelFromSelector(e){const r=e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").match(/\[data-label="([^"]+)"\]/);return r?r[1]:null}stripVirtualAttributes(e){return e.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[data-index="[^"]*"\]/g,"").trim()}findComboboxByLabel(e){var r;const n=document.querySelectorAll("label");for(const i of n){const o=(r=i.textContent)==null?void 0:r.trim().replace(/\*$/,"").trim();if(o===e||o!=null&&o.includes(e)){const s=i.closest('div[class*="container"], div[aria-label], .MuiFormControl-root, form > div');if(s){const a=s.querySelector('input[role="combobox"], button[aria-haspopup="listbox"]');if(a)return this.logger.log("[ActionExecutor] Found combobox by label:",e),a}}}return null}handleComboboxClick(e){this.logger.log("[ActionExecutor] Opening combobox/dropdown with humanLikeClick");const r=e.closest('[class*="control"]')||e.closest('[class*="trigger"]')||e.closest("[aria-haspopup]")||e.parentElement||e,i=this.humanLikeClick(r,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});e.dispatchEvent(new FocusEvent("focus",{bubbles:!0})),e instanceof HTMLInputElement&&e.dispatchEvent(new Event("input",{bubbles:!0})),this.logger.log("[ActionExecutor] ✅ Combobox/dropdown humanLikeClick complete, actual element:",i.tagName)}openDropdown(e){this.handleComboboxClick(e)}triggerReactOnClickPublic(e){return this.triggerReactOnClick(e)}findDropdownOption(e){return Bo(e,be.isVisible)}isDropdownOption(e){if(e.getAttribute("role")==="option")return!0;const n=typeof e.className=="string"?e.className:"";return n.includes("option")||n.includes("item")?e.closest('[role="listbox"], [role="menu"], [class*="menu"], [class*="listbox"]')!==null:!1}performClick(e){this.humanLikeClick(e,{focus:!0,includePointerEvents:!0,nativeClickFallback:!0})}hasReactOnClickHandler(e){const n=["__reactProps","__reactFiber","__reactEventHandlers"];try{const o=Object.keys(e);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=e[s];if(a!=null&&a.onClick)return!0}}catch{}let r=e.parentElement,i=0;for(;r&&i<5;){try{const o=Object.keys(r);for(const s of o)if(n.some(a=>s.startsWith(a))){const a=r[s];if(a!=null&&a.onClick)return!0}}catch{}r=r.parentElement,i++}return!1}findClickableElement(e){var a;const n=["SPAN","LABEL","P","H1","H2","H3","H4","H5","H6","TEXT","SVG","PATH"],r=l=>l.className?typeof l.className=="string"?l.className:typeof l.className.baseVal=="string"?l.className.baseVal:"":"";if(this.logger.log("[ActionExecutor] Finding clickable element for:",e.tagName,r(e).substring(0,50)),!n.includes(e.tagName))return this.logger.log("[ActionExecutor] Element is already interactive"),e;let i=e.parentElement,o=e,s=0;for(;i&&i!==document.body&&s<10;){s++;const l=window.getComputedStyle(i),c=l.cursor==="pointer",d=r(i),h=d.includes("cursor-pointer"),f=(a=i.classList)==null?void 0:a.contains("cursor-pointer"),g=i.hasAttribute("onclick")||i.hasAttribute("data-onclick")||i.getAttribute("role")==="button"||i.getAttribute("role")==="menuitem",y=i.tagName==="BUTTON"||i.tagName==="A";if(this.logger.log(`[ActionExecutor] Checking parent #${s}:`,i.tagName,"cursor:",l.cursor,"hasCursorClass:",h||f,"classes:",d.substring(0,60)),(c||h||f||g||y)&&(o=i,this.logger.log("[ActionExecutor] ✅ Found clickable parent:",i.tagName,d.substring(0,80)),y||i.getAttribute("role")==="button"))break;i=i.parentElement}return this.logger.log("[ActionExecutor] Final click target:",o.tagName,r(o).substring(0,60)),o}triggerReactOnClick(e){try{const n=Object.keys(e);for(const s of n)if(s.startsWith("__reactFiber")||s.startsWith("__reactProps")||s.startsWith("__reactEventHandlers")){const a=e[s];if(this.logger.log("[ActionExecutor] Found React property:",s),a!=null&&a.onClick){this.logger.log("[ActionExecutor] 🎯 Calling React onClick directly!");const l=new MouseEvent("click",{bubbles:!0,cancelable:!0}),c={type:"click",target:e,currentTarget:e,nativeEvent:l,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{c.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>c.defaultPrevented,isPropagationStopped:()=>!1};return a.onClick(c),!0}}const r=["__reactProps","__reactFiber","__reactEventHandlers"];let i=e.parentElement,o=0;for(;i&&o<5;){const s=Object.keys(i);for(const a of s)if(r.some(l=>a.startsWith(l))){const l=i[a];if(l!=null&&l.onClick){this.logger.log("[ActionExecutor] 🎯 Found onClick on parent, calling directly!");const c=new MouseEvent("click",{bubbles:!0,cancelable:!0}),d={type:"click",target:e,currentTarget:i,nativeEvent:c,bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:0,isTrusted:!1,timeStamp:Date.now(),preventDefault:()=>{d.defaultPrevented=!0},stopPropagation:()=>{},persist:()=>{},isDefaultPrevented:()=>d.defaultPrevented,isPropagationStopped:()=>!1};return l.onClick(d),!0}}i=i.parentElement,o++}return this.logger.log("[ActionExecutor] No React onClick handler found"),!1}catch(n){return this.logger.log("[ActionExecutor] Error accessing React internals:",n),!1}}sendClickMetadata(e,n){const r=d=>d.className?typeof d.className=="string"?d.className:typeof d.className.baseVal=="string"?d.className.baseVal:"":"",i=[];let o=e;for(;o&&o!==document.body&&i.length<5;){let d=o.tagName.toLowerCase();if(o.id)d=`#${o.id}`;else{const h=r(o);if(h){const f=h.trim().split(/\s+/).slice(0,3).join(".");f&&(d+="."+f)}}i.unshift(d),o=o.parentElement}const s=d=>{var g;const h=d.querySelector("span, label, p");if((g=h==null?void 0:h.textContent)!=null&&g.trim())return h.textContent.trim().substring(0,50);let f="";for(const y of Array.from(d.childNodes))y.nodeType===Node.TEXT_NODE&&(f+=(y.textContent||"").trim()+" ");return f=f.trim(),!f&&d.textContent&&(f=d.textContent.trim().substring(0,50)),f},a=window.__onboardingSDK,l=(a==null?void 0:a._botActionDepth)>0,c={type:"click",selector:i.join(" > "),text:s(n),tagName:e.tagName.toLowerCase(),timestamp:Date.now(),source:l?"bot":"user",sourceDetail:"react_onclick"};this.logger.log("[ActionExecutor] 📤 Sending React onClick metadata:",c.text,`(source: ${c.source})`),a!=null&&a.sendMetadata?a.sendMetadata(c):this.logger.warn("[ActionExecutor] ⚠️ SDK not found on window, cannot send metadata")}isDestructive(e){const n=["submit","delete","remove","clear"],r=['[type="submit"]',".delete",".remove"];return n.some(i=>{var o;return(o=e.description)==null?void 0:o.toLowerCase().includes(i)})||r.some(i=>e.selector.includes(i))}isHybridActionDestructive(e){var o,s;const n=["submit","delete","remove","clear","confirm","proceed"],r=((o=e.description)==null?void 0:o.toLowerCase())||"",i=((s=e.target.text)==null?void 0:s.toLowerCase())||"";return n.some(a=>r.includes(a)||i.includes(a))}async getConsent(e){const n=`Allow action: ${e.description||e.type} on ${e.selector}?`;return confirm(n)}async getHybridConsent(e){const n=e.target.text||e.target.selector||"element",r=`Allow "${e.action}" on "${n}"?
488
+ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){const i=this.parseOptionTextFromSelector(e.selector);if(i){this.logger.log("[ActionExecutor] Virtual selector detected - finding option by text:",i);const s=this.findDropdownOption(i);return s?(this.performClick(s),!0):(this.logger.warn("[ActionExecutor] Option not found by text:",i),!1)}const o=this.parseLabelFromSelector(e.selector);if(o){this.logger.log("[ActionExecutor] Virtual selector detected - finding combobox by label:",o);const s=this.findComboboxByLabel(o);return s?(this.handleComboboxClick(s),!0):(this.logger.warn("[ActionExecutor] Combobox not found by label:",o),!1)}}const n=this.stripVirtualAttributes(e.selector),r=document.querySelector(n);if(!r)return this.logger.warn("[ActionExecutor] Element not found:",n),!1;switch(e.type){case"click":this.simulateClick(r,e.selector);break;case"type":(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&(r.focus(),r.value=e.value||"",r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"select":const i=this.findComboboxInput(r);if(i){if(this.handleComboboxClick(i),await new Promise(o=>setTimeout(o,200)),e.value){const o=this.findDropdownOption(e.value);o&&this.performClick(o)}}else r instanceof HTMLSelectElement&&(r.value=e.value||"",r.dispatchEvent(new Event("change",{bubbles:!0})));break;case"hover":r.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),r.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0}));break;case"scroll":r.scrollIntoView({behavior:"smooth",block:"center"});break;default:return this.logger.warn("[ActionExecutor] Unknown action type:",e.type),!1}return!0}}class d_{constructor(e=de){P(this,"logger");P(this,"container",null);P(this,"highlightEl",null);P(this,"tooltipElement",null);P(this,"floeCursor",null);P(this,"cursorHasBeenPositioned",!1);this.logger=e}inject(){this.container||(this.container=document.createElement("div"),this.container.id="onboarding-overlay",this.container.setAttribute(Di,"overlay"),this.container.style.cssText=`
479
489
  position: fixed;
480
490
  top: 0;
481
491
  left: 0;
@@ -549,7 +559,7 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
549
559
  30% { transform: scale(0.85); }
550
560
  100% { transform: scale(1); }
551
561
  }
552
- `,document.head.appendChild(e),document.body.appendChild(this.floeCursor),this.logger.log("[OverlaySystem] Floe cursor injected")}showFloeCursor(){if(this.floeCursor){if(!this.cursorHasBeenPositioned){const e=window.innerWidth-50,n=window.innerHeight-50;this.floeCursor.style.left=`${e}px`,this.floeCursor.style.top=`${n}px`,this.cursorHasBeenPositioned=!0,this.logger.log("[OverlaySystem] Cursor initial position set to bot icon:",e,n)}this.floeCursor.style.opacity="1",this.floeCursor.style.transform="scale(1)"}}hideFloeCursor(){this.floeCursor&&(this.floeCursor.style.opacity="0",this.floeCursor.style.transform="scale(0.8)")}animateFloeCursorTo(e,n,r=400){return new Promise(i=>{if(!this.floeCursor){i();return}this.showFloeCursor();const o=parseFloat(this.floeCursor.style.top)||0,s=parseFloat(this.floeCursor.style.left)||0,a=performance.now(),l=s,c=o,d=h=>{const f=h-a,v=Math.min(f/r,1),b=1-Math.pow(1-v,3),g=l+(e-l)*b,S=c+(n-c)*b;this.floeCursor&&(this.floeCursor.style.left=`${g}px`,this.floeCursor.style.top=`${S}px`),v<1?requestAnimationFrame(d):i()};requestAnimationFrame(d)})}animateFloeCursorClick(){return new Promise(e=>{if(!this.floeCursor){e();return}const n=this.floeCursor.querySelector("svg");n?(n.style.animation="floeCursorClick 0.2s ease",setTimeout(()=>{n.style.animation="",e()},200)):e()})}async moveToElementAndClick(e){const n=e.getBoundingClientRect(),r=n.left+n.width/2-5,i=n.top+n.height/2-5;await this.animateFloeCursorTo(r,i,500),await new Promise(o=>setTimeout(o,100)),await this.animateFloeCursorClick()}showScreenShareModal(){return new Promise(e=>{const n=document.createElement("div");n.setAttribute(Di,"consent-modal"),n.style.cssText=`
562
+ `,document.head.appendChild(e),document.body.appendChild(this.floeCursor),this.logger.log("[OverlaySystem] Floe cursor injected")}showFloeCursor(){if(this.floeCursor){if(!this.cursorHasBeenPositioned){const e=window.innerWidth-50,n=window.innerHeight-50;this.floeCursor.style.left=`${e}px`,this.floeCursor.style.top=`${n}px`,this.cursorHasBeenPositioned=!0,this.logger.log("[OverlaySystem] Cursor initial position set to bot icon:",e,n)}this.floeCursor.style.opacity="1",this.floeCursor.style.transform="scale(1)"}}hideFloeCursor(){this.floeCursor&&(this.floeCursor.style.opacity="0",this.floeCursor.style.transform="scale(0.8)")}animateFloeCursorTo(e,n,r=400){return new Promise(i=>{if(!this.floeCursor){i();return}this.showFloeCursor();const o=parseFloat(this.floeCursor.style.top)||0,s=parseFloat(this.floeCursor.style.left)||0,a=performance.now(),l=s,c=o,d=h=>{const f=h-a,g=Math.min(f/r,1),y=1-Math.pow(1-g,3),m=l+(e-l)*y,S=c+(n-c)*y;this.floeCursor&&(this.floeCursor.style.left=`${m}px`,this.floeCursor.style.top=`${S}px`),g<1?requestAnimationFrame(d):i()};requestAnimationFrame(d)})}animateFloeCursorClick(){return new Promise(e=>{if(!this.floeCursor){e();return}const n=this.floeCursor.querySelector("svg");n?(n.style.animation="floeCursorClick 0.2s ease",setTimeout(()=>{n.style.animation="",e()},200)):e()})}async moveToElementAndClick(e){const n=e.getBoundingClientRect(),r=n.left+n.width/2-5,i=n.top+n.height/2-5;await this.animateFloeCursorTo(r,i,500),await new Promise(o=>setTimeout(o,100)),await this.animateFloeCursorClick()}showScreenShareModal(){return new Promise(e=>{const n=document.createElement("div");n.setAttribute(Di,"consent-modal"),n.style.cssText=`
553
563
  position: fixed;
554
564
  top: 0;
555
565
  left: 0;
@@ -801,13 +811,13 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
801
811
  max-width: 300px;
802
812
  text-align: center;
803
813
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
804
- `,this.tooltipElement.textContent=e}hideTooltip(){this.tooltipElement&&(this.tooltipElement.remove(),this.tooltipElement=null)}cleanup(){this.clearHighlight(),this.hideFloeCursor(),this.hideTooltip(),this.logger.log("[OverlaySystem] Cleaned up all overlays")}resetCursorState(){this.cursorHasBeenPositioned=!1,this.floeCursor&&(this.floeCursor.style.top="-100px",this.floeCursor.style.left="-100px",this.floeCursor.style.opacity="0",this.floeCursor.style.transform="scale(0.8)"),this.logger.log("[OverlaySystem] Cursor state reset")}remove(){var r;const e=document.getElementById("floe-cursor-styles");e&&e.remove();const n=document.getElementById("onboarding-animations");n&&n.remove(),this.floeCursor&&(this.floeCursor.remove(),this.floeCursor=null),this.cursorHasBeenPositioned=!1,(r=this.container)==null||r.remove(),this.container=null,this.highlightEl=null,this.tooltipElement=null}}class Td{constructor(e,n=de){D(this,"logger");D(this,"piiPatterns");this.logger=n,this.piiPatterns={email:/[\w.-]+@[\w.-]+\.\w+/,phone:/[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}/,ssn:/\d{3}-\d{2}-\d{4}/,creditCard:/\d{4}[\s.-]?\d{4}[\s.-]?\d{4}[\s.-]?\d{4}/,...e}}safeCanvasToDataURL(e,n,r){const i=`image/${n}`;try{return Promise.resolve(e.toDataURL(i,r))}catch(o){this.logger.warn("[ScreenCapture] toDataURL failed (tainted canvas?), trying toBlob fallback:",o)}return new Promise((o,s)=>{try{e.toBlob(a=>{if(!a){s(new Error("[ScreenCapture] canvas.toBlob returned null — canvas may be tainted"));return}const l=new FileReader;l.onloadend=()=>{typeof l.result=="string"?o(l.result):s(new Error("[ScreenCapture] FileReader did not produce a string result"))},l.onerror=()=>{s(new Error("[ScreenCapture] FileReader failed to read blob"))},l.readAsDataURL(a)},i,r)}catch(a){s(new Error(`[ScreenCapture] Both toDataURL and toBlob failed for canvas export. toBlob error: ${a instanceof Error?a.message:String(a)}`))}})}static sanitizeClonedDocument(e){e.querySelectorAll("script").forEach(o=>{o.remove()});const r=e.querySelectorAll("*"),i=/^on/i;r.forEach(o=>{const s=Array.from(o.attributes);for(const a of s)i.test(a.name)&&o.removeAttribute(a.name)})}getAllTextNodes(){const e=[];if(!document.body)return e;const n=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:i=>{const o=i.parentElement;if(!o)return NodeFilter.FILTER_REJECT;const s=window.getComputedStyle(o);return s.display==="none"||s.visibility==="hidden"||!i.textContent||!i.textContent.trim()?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let r;for(;r=n.nextNode();){const i=document.createRange();i.selectNode(r);const o=i.getBoundingClientRect();o.width>0&&o.height>0&&e.push({node:r,rect:o})}return e}containsPII(e){for(const[n,r]of Object.entries(this.piiPatterns))if(r.lastIndex=0,r.test(e))return{contains:!0,type:n};return{contains:!1}}applyBlur(e,n){const r=e.getImageData(n.x,n.y,n.width,n.height),i=r.data,o=5;for(let s=0;s<n.height;s++)for(let a=0;a<n.width;a++){let l=0,c=0,d=0,h=0,f=0;for(let b=-o;b<=o;b++)for(let g=-o;g<=o;g++){const S=a+g,m=s+b;if(S>=0&&S<n.width&&m>=0&&m<n.height){const w=(m*n.width+S)*4;l+=i[w],c+=i[w+1],d+=i[w+2],h+=i[w+3],f++}}const v=(s*n.width+a)*4;i[v]=l/f,i[v+1]=c/f,i[v+2]=d/f,i[v+3]=h/f}e.putImageData(r,n.x,n.y)}async captureWithRedaction(e={}){const{redact:n=!0,scale:r=.6,quality:i=.7,format:o="webp"}=e;if(!document.body)return this.logger.warn("[ScreenCapture] Document body not available"),"";const s=[];if(n){const h=this.getAllTextNodes();for(const{node:f,rect:v}of h){const b=this.containsPII(f.textContent||"");b.contains&&s.push({x:v.left,y:v.top,width:v.width,height:v.height,type:b.type||"unknown"})}}const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return this.logger.error("[ScreenCapture] Failed to get 2D canvas context"),Promise.reject(new Error("[ScreenCapture] Canvas 2D context unavailable"));const c=window.innerWidth*r,d=window.innerHeight*r;return a.width=c,a.height=d,new Promise((h,f)=>{const v=document.createElement("iframe");if(v.style.position="fixed",v.style.top="0",v.style.left="0",v.style.width="100%",v.style.height="100%",v.style.border="none",v.style.zIndex="-999999",!document.body){this.logger.warn("[ScreenCapture] Document body became null before iframe append"),this.safeCanvasToDataURL(a,o,i).then(h,f);return}document.body.appendChild(v);const b=v.contentDocument;if(b.open(),b.write(document.documentElement.outerHTML),b.close(),Td.sanitizeClonedDocument(b),n&&s.length>0){const S=b.createElement("style");if(S.textContent=`
814
+ `,this.tooltipElement.textContent=e}hideTooltip(){this.tooltipElement&&(this.tooltipElement.remove(),this.tooltipElement=null)}cleanup(){this.clearHighlight(),this.hideFloeCursor(),this.hideTooltip(),this.logger.log("[OverlaySystem] Cleaned up all overlays")}resetCursorState(){this.cursorHasBeenPositioned=!1,this.floeCursor&&(this.floeCursor.style.top="-100px",this.floeCursor.style.left="-100px",this.floeCursor.style.opacity="0",this.floeCursor.style.transform="scale(0.8)"),this.logger.log("[OverlaySystem] Cursor state reset")}remove(){var r;const e=document.getElementById("floe-cursor-styles");e&&e.remove();const n=document.getElementById("onboarding-animations");n&&n.remove(),this.floeCursor&&(this.floeCursor.remove(),this.floeCursor=null),this.cursorHasBeenPositioned=!1,(r=this.container)==null||r.remove(),this.container=null,this.highlightEl=null,this.tooltipElement=null}}class Md{constructor(e,n=de){P(this,"logger");P(this,"piiPatterns");this.logger=n,this.piiPatterns={email:/[\w.-]+@[\w.-]+\.\w+/,phone:/[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}/,ssn:/\d{3}-\d{2}-\d{4}/,creditCard:/\d{4}[\s.-]?\d{4}[\s.-]?\d{4}[\s.-]?\d{4}/,...e}}safeCanvasToDataURL(e,n,r){const i=`image/${n}`;try{return Promise.resolve(e.toDataURL(i,r))}catch(o){this.logger.warn("[ScreenCapture] toDataURL failed (tainted canvas?), trying toBlob fallback:",o)}return new Promise((o,s)=>{try{e.toBlob(a=>{if(!a){s(new Error("[ScreenCapture] canvas.toBlob returned null — canvas may be tainted"));return}const l=new FileReader;l.onloadend=()=>{typeof l.result=="string"?o(l.result):s(new Error("[ScreenCapture] FileReader did not produce a string result"))},l.onerror=()=>{s(new Error("[ScreenCapture] FileReader failed to read blob"))},l.readAsDataURL(a)},i,r)}catch(a){s(new Error(`[ScreenCapture] Both toDataURL and toBlob failed for canvas export. toBlob error: ${a instanceof Error?a.message:String(a)}`))}})}static sanitizeClonedDocument(e){e.querySelectorAll("script").forEach(o=>{o.remove()});const r=e.querySelectorAll("*"),i=/^on/i;r.forEach(o=>{const s=Array.from(o.attributes);for(const a of s)i.test(a.name)&&o.removeAttribute(a.name)})}getAllTextNodes(){const e=[];if(!document.body)return e;const n=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:i=>{const o=i.parentElement;if(!o)return NodeFilter.FILTER_REJECT;const s=window.getComputedStyle(o);return s.display==="none"||s.visibility==="hidden"||!i.textContent||!i.textContent.trim()?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let r;for(;r=n.nextNode();){const i=document.createRange();i.selectNode(r);const o=i.getBoundingClientRect();o.width>0&&o.height>0&&e.push({node:r,rect:o})}return e}containsPII(e){for(const[n,r]of Object.entries(this.piiPatterns))if(r.lastIndex=0,r.test(e))return{contains:!0,type:n};return{contains:!1}}applyBlur(e,n){const r=e.getImageData(n.x,n.y,n.width,n.height),i=r.data,o=5;for(let s=0;s<n.height;s++)for(let a=0;a<n.width;a++){let l=0,c=0,d=0,h=0,f=0;for(let y=-o;y<=o;y++)for(let m=-o;m<=o;m++){const S=a+m,v=s+y;if(S>=0&&S<n.width&&v>=0&&v<n.height){const w=(v*n.width+S)*4;l+=i[w],c+=i[w+1],d+=i[w+2],h+=i[w+3],f++}}const g=(s*n.width+a)*4;i[g]=l/f,i[g+1]=c/f,i[g+2]=d/f,i[g+3]=h/f}e.putImageData(r,n.x,n.y)}async captureWithRedaction(e={}){const{redact:n=!0,scale:r=.6,quality:i=.7,format:o="webp"}=e;if(!document.body)return this.logger.warn("[ScreenCapture] Document body not available"),"";const s=[];if(n){const h=this.getAllTextNodes();for(const{node:f,rect:g}of h){const y=this.containsPII(f.textContent||"");y.contains&&s.push({x:g.left,y:g.top,width:g.width,height:g.height,type:y.type||"unknown"})}}const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return this.logger.error("[ScreenCapture] Failed to get 2D canvas context"),Promise.reject(new Error("[ScreenCapture] Canvas 2D context unavailable"));const c=window.innerWidth*r,d=window.innerHeight*r;return a.width=c,a.height=d,new Promise((h,f)=>{const g=document.createElement("iframe");if(g.style.position="fixed",g.style.top="0",g.style.left="0",g.style.width="100%",g.style.height="100%",g.style.border="none",g.style.zIndex="-999999",!document.body){this.logger.warn("[ScreenCapture] Document body became null before iframe append"),this.safeCanvasToDataURL(a,o,i).then(h,f);return}document.body.appendChild(g);const y=g.contentDocument;if(y.open(),y.write(document.documentElement.outerHTML),y.close(),Md.sanitizeClonedDocument(y),n&&s.length>0){const S=y.createElement("style");if(S.textContent=`
805
815
  .pii-redacted {
806
816
  filter: blur(5px);
807
817
  background: #000;
808
818
  color: transparent !important;
809
819
  }
810
- `,b.head.appendChild(S),!b.body){this.logger.warn("[ScreenCapture] Cloned document has no body"),document.body.removeChild(v),this.safeCanvasToDataURL(a,o,i).then(h,f);return}const m=b.createTreeWalker(b.body,NodeFilter.SHOW_TEXT);let w;for(;w=m.nextNode();)this.containsPII(w.textContent||"").contains&&w.parentElement&&w.parentElement.classList.add("pii-redacted")}const g=()=>{try{document.body.removeChild(v)}catch{}};setTimeout(()=>{try{if(!v.contentWindow){this.logger.warn("[ScreenCapture] iframe contentWindow not available"),g(),this.safeCanvasToDataURL(a,o,i).then(h,f);return}const w=new XMLSerializer().serializeToString(b.documentElement),k=`<svg xmlns="http://www.w3.org/2000/svg" width="${window.innerWidth}" height="${window.innerHeight}"><foreignObject width="100%" height="100%">`+w+"</foreignObject></svg>",C=new Blob([k],{type:"image/svg+xml;charset=utf-8"}),M=URL.createObjectURL(C),P=new Image;P.onload=()=>{if(l.save(),l.scale(r,r),l.drawImage(P,0,0),l.restore(),URL.revokeObjectURL(M),n&&s.length>0)for(const L of s)this.applyBlur(l,{x:L.x*r,y:L.y*r,width:L.width*r,height:L.height*r});g(),this.safeCanvasToDataURL(a,o,i).then(h,f)},P.onerror=()=>{URL.revokeObjectURL(M),this.logger.warn("[ScreenCapture] SVG image render failed, returning blank canvas"),g(),this.safeCanvasToDataURL(a,o,i).then(h,f)},P.src=M}catch(S){this.logger.error("[ScreenCapture] Failed to render iframe content:",S),g(),this.safeCanvasToDataURL(a,o,i).then(h,f)}},100)})}async captureSimple(e={}){return this.captureWithRedaction({...e,redact:!1})}}class h_{constructor(e,n=de){D(this,"logger");D(this,"sdk");D(this,"domIntrospector",null);D(this,"lastUrl","");D(this,"clickHandler",null);D(this,"focusHandler",null);D(this,"blurHandler",null);D(this,"inputHandler",null);D(this,"keydownHandler",null);D(this,"inputDebounceTimers",new Map);D(this,"isTracking",!1);D(this,"scrollHandler",null);D(this,"scrollDebounceTimer",null);D(this,"urlCheckInterval",null);D(this,"popstateHandler",null);this.logger=n,this.sdk=e,this.lastUrl=window.location.href}setDOMIntrospector(e){this.domIntrospector=e,this.logger.log("[PageTracker] DOMIntrospector set for sync captures")}start(){this.isTracking||(this.isTracking=!0,this.logger.log("[PageTracker] Starting page event tracking"),this.sendPageMetadata(),this.setupUrlTracking(),this.clickHandler=e=>{const n=e.target;if(!n||Mt(n))return;const r=this.getElementMetadata(n),i=this.sdk._botActionDepth>0?"bot":"user";this.sdk.sendMetadata({type:"click",selector:r.selector,text:r.text,tagName:r.tagName,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now(),source:i}),this.logger.log(`[PageTracker] Click (${i}):`,r.selector,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-click")},100)},document.addEventListener("click",this.clickHandler,!0),this.scrollHandler=()=>{this.sdk.fastExecutionMode||(this.scrollDebounceTimer&&clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=setTimeout(()=>{this.sdk.fastExecutionMode||(this.logger.log("[PageTracker] Scroll detected, capturing DOM"),this.sdk.sendMetadata({type:"scroll",scrollY:window.scrollY,scrollX:window.scrollX,viewportHeight:window.innerHeight,documentHeight:document.documentElement.scrollHeight,timestamp:Date.now()}),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-scroll"))},200))},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.focusHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||Mt(n))return;const r=this.getElementMetadata(n),i=n.type||"";this.sdk.sendMetadata({type:"focus",selector:r.selector,tagName:r.tagName,inputType:i,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now()}),this.logger.log("[PageTracker] Focus:",r.tagName,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-focus")},150)},document.addEventListener("focus",this.focusHandler,!0),this.blurHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||Mt(n))return;const r=n.tagName.toLowerCase();this.sdk.sendMetadata({type:"blur",selector:this.getSelector(n),tagName:r,timestamp:Date.now()}),this.logger.log("[PageTracker] Blur:",r),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var i;(i=this.domIntrospector)==null||i.captureAndSendImmediate("post-blur")},200)},document.addEventListener("blur",this.blurHandler,!0),this.inputHandler=e=>{const n=e.target;if(!n||Mt(n))return;const r=this.inputDebounceTimers.get(n);r&&clearTimeout(r);const i=setTimeout(()=>{const o=this.getElementMetadata(n),s=n.name||n.id||n.placeholder||o.labelText||"field";this.sdk.sendMetadata({type:"form_input",selector:o.selector,field:s,inputType:n.type||"text",hasValue:!!n.value,role:o.role,ariaLabel:o.ariaLabel,placeholder:o.placeholder,labelText:o.labelText,timestamp:Date.now()}),this.logger.log("[PageTracker] Form input:",s,o.labelText?`(label: ${o.labelText})`:""),this.inputDebounceTimers.delete(n),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-input")},500);this.inputDebounceTimers.set(n,i)},document.addEventListener("input",this.inputHandler,!0),this.keydownHandler=e=>{const n=e.target;if(!n||!(n instanceof HTMLElement)||Mt(n)||!this.isInputElement(n)||!["Enter","Escape","Tab"].includes(e.key))return;const i=n.tagName.toLowerCase(),o=n.type||"";if(this.sdk.sendMetadata({type:"keydown",key:e.key,selector:this.getSelector(n),tagName:i,inputType:o,timestamp:Date.now()}),this.logger.log("[PageTracker] Keydown:",e.key,"on",i),this.domIntrospector){const s=e.key==="Enter"?300:150;setTimeout(()=>{var a;(a=this.domIntrospector)==null||a.captureAndSendImmediate(`post-keydown-${e.key.toLowerCase()}`)},s)}},document.addEventListener("keydown",this.keydownHandler,!0),this.logger.log("[PageTracker] Event listeners attached"))}stop(){this.isTracking&&(this.isTracking=!1,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null),this.focusHandler&&(document.removeEventListener("focus",this.focusHandler,!0),this.focusHandler=null),this.blurHandler&&(document.removeEventListener("blur",this.blurHandler,!0),this.blurHandler=null),this.inputHandler&&(document.removeEventListener("input",this.inputHandler,!0),this.inputHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler,!0),this.keydownHandler=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.scrollDebounceTimer&&(clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=null),this.urlCheckInterval&&(clearInterval(this.urlCheckInterval),this.urlCheckInterval=null),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.inputDebounceTimers.forEach(e=>{clearTimeout(e)}),this.inputDebounceTimers.clear(),this.logger.log("[PageTracker] Stopped tracking"))}setupUrlTracking(){this.urlCheckInterval||(this.urlCheckInterval=setInterval(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},1e3),this.popstateHandler=()=>{setTimeout(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},100)},window.addEventListener("popstate",this.popstateHandler))}sendPageMetadata(){const e=Dn();this.sdk.sendMetadata({type:"page_metadata",url:e,title:document.title,pathname:window.location.pathname,timestamp:Date.now()}),this.logger.log("[PageTracker] Page metadata sent:",e)}isInteractiveElement(e){const n=e.tagName.toLowerCase();return["input","textarea","select","button"].includes(n)||e.contentEditable==="true"}isInputElement(e){const n=e.tagName.toLowerCase();if(n==="textarea")return!0;if(n==="input"){const r=e.type||"text";return["text","search","email","password","tel","url","number"].includes(r)}return e.contentEditable==="true"}getSelector(e){if(e.id&&!e.id.match(/^(react-select-|:r|radix-)/))return`#${CSS.escape(e.id)}`;const n=e.getAttribute("role"),r=e.getAttribute("aria-label"),i=e.getAttribute("name"),o=e.getAttribute("data-testid")||e.getAttribute("data-test-id"),s=e.placeholder,a=e.tagName.toLowerCase();let l=a;if(o)return`[data-testid="${o}"]`;if(n)return l=`${a}[role="${n}"]`,r?l+=`[aria-label="${r}"]`:i&&(l+=`[name="${i}"]`),l;if(i)return`${a}[name="${i}"]`;if(s)return`${a}[placeholder="${s}"]`;if(r)return`${a}[aria-label="${r}"]`;const c=[];let d=e,h=0;for(;d&&d!==document.body&&h<5;){let f=d.tagName.toLowerCase();const v=d.getAttribute("role"),b=d.getAttribute("data-testid");if(b){c.unshift(`[data-testid="${b}"]`);break}if(v)f+=`[role="${v}"]`;else if(d.className&&typeof d.className=="string"){const g=d.className.split(" ").filter(S=>S&&!S.startsWith("css-")&&!S.startsWith("sc-")&&!S.startsWith("ng-")&&!S.startsWith("_")&&!S.match(/^[a-z]{6,}$/)&&!S.match(/^\d/)).slice(0,2);g.length>0&&(f+=`.${g.join(".")}`)}c.unshift(f),d=d.parentElement,h++}return c.join(" > ")}getElementMetadata(e){var f,v,b,g;const n=e,r=this.getSelector(e),i=((f=n.innerText)==null?void 0:f.trim().substring(0,100))||"",o=e.tagName.toLowerCase(),s=e.getAttribute("role")||void 0,a=e.getAttribute("aria-label")||void 0,l=e.placeholder||void 0;let c;const d=e.getAttribute("aria-labelledby");if(d){const S=document.getElementById(d.split(/\s+/)[0]);S&&(c=(v=S.textContent)==null?void 0:v.trim())}const h=e.getAttribute("id");if(!c&&h)try{const S=document.querySelector(`label[for="${CSS.escape(h)}"]`);S&&(c=(b=S.textContent)==null?void 0:b.trim().replace(/\*$/,"").trim())}catch{}if(!c){const S=e.closest('.MuiFormControl-root, fieldset, [class*="form-group"], [class*="form-field"], [class*="field-wrapper"]');if(S){const m=S.querySelector(":scope > label, :scope > .MuiFormLabel-root, :scope > div > label");if(m){const w=S.querySelectorAll('input, select, textarea, [role="combobox"]'),k=Array.from(w).some(C=>e.contains(C)||e===C);(w.length===1||k)&&(c=(g=m.textContent)==null?void 0:g.trim().replace(/\*$/,"").trim())}}}return{selector:r,text:i,tagName:o,role:s,ariaLabel:a,placeholder:l,labelText:c}}}class Lv{constructor(e=de){D(this,"logger");D(this,"loadingSelectors",['[role="progressbar"]',".loading",".spinner",".loader",'[aria-busy="true"]','[class*="loading"]','[class*="spinner"]','svg[class*="animate-spin"]','[data-loading="true"]',".MuiCircularProgress-root",".MuiLinearProgress-root"]);D(this,"_lastLoggedSelector",null);this.logger=e}isLoading(){for(const e of this.loadingSelectors)try{const n=document.querySelector(e);if(n&&this.isVisible(n))return this._lastLoggedSelector!==e&&(this.logger.log("[LoadingDetector] Found loading indicator:",e),this._lastLoggedSelector=e),!0}catch{}return this._lastLoggedSelector=null,!1}async waitForLoadingComplete(e=5e3){const n=Date.now();for(this.logger.log("[LoadingDetector] Waiting for loading to complete...");Date.now()-n<e;){if(!this.isLoading()&&(await new Promise(r=>setTimeout(r,100)),!this.isLoading()))return this.logger.log("[LoadingDetector] Loading complete"),!0;await new Promise(r=>setTimeout(r,50))}return this.logger.warn("[LoadingDetector] Timed out waiting for loading"),!1}isVisible(e){const n=getComputedStyle(e);if(n.visibility==="hidden"||n.display==="none"||n.opacity==="0")return!1;if(e.offsetParent===null){const i=n.position;if(i!=="fixed"&&i!=="sticky")return!1}const r=e.getBoundingClientRect();return r.width>0&&r.height>0}}class f_{constructor(e=de){D(this,"logger");this.logger=e}async waitForStable(e=300,n=5e3){return new Promise(r=>{let i,o;const s=()=>{clearTimeout(i),clearTimeout(o),a.disconnect()},a=new MutationObserver(()=>{clearTimeout(i),i=setTimeout(()=>{s(),this.logger.log("[DOMStabilityChecker] DOM stable"),r()},e)});a.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(()=>{s(),this.logger.log("[DOMStabilityChecker] DOM stable (no mutations)"),r()},e),o=setTimeout(()=>{s(),this.logger.warn("[DOMStabilityChecker] Max wait time reached, proceeding anyway"),r()},n)})}}class p_{constructor(e=de){D(this,"logger");D(this,"lastUrl","");D(this,"urlChangeCallback",null);D(this,"loadingDetector");D(this,"domStabilityChecker");D(this,"originalPushState",null);D(this,"originalReplaceState",null);D(this,"popstateHandler",null);D(this,"isStarted",!1);D(this,"handleUrlChange",async()=>{const e=window.location.href;if(e!==this.lastUrl){this.logger.log("[NavigationCompleteDetector] URL changed:",e),this.lastUrl=e;try{await this.waitForPageStable()}catch(n){this.logger.warn("[NavigationCompleteDetector] Error waiting for page stable:",n)}this.urlChangeCallback&&this.urlChangeCallback(Dn())}});this.logger=e,this.lastUrl=window.location.href,this.loadingDetector=new Lv(e),this.domStabilityChecker=new f_(e)}start(e){this.isStarted&&(this.logger.warn("[NavigationCompleteDetector] Already started, stopping first"),this.stop()),this.logger.log("[NavigationCompleteDetector] Starting navigation monitoring"),this.isStarted=!0,this.urlChangeCallback=e,this.lastUrl=window.location.href,this.setupUrlObserver(),this.popstateHandler=()=>this.handleUrlChange(),window.addEventListener("popstate",this.popstateHandler)}setupUrlObserver(){this.originalPushState||(this.originalPushState=history.pushState.bind(history)),this.originalReplaceState||(this.originalReplaceState=history.replaceState.bind(history));const e=this;history.pushState=function(...n){e.originalPushState(...n),e.handleUrlChange()},history.replaceState=function(...n){e.originalReplaceState(...n),e.handleUrlChange()}}async waitForPageStable(){this.logger.log("[NavigationCompleteDetector] Waiting for page to stabilize...");const e=8e3,n=Date.now();await this.loadingDetector.waitForLoadingComplete(5e3);const r=e-(Date.now()-n);r>300&&await this.domStabilityChecker.waitForStable(300,Math.min(r,3e3)),this.logger.log("[NavigationCompleteDetector] Page stable")}stop(){this.isStarted&&(this.logger.log("[NavigationCompleteDetector] Stopping navigation monitoring"),this.isStarted=!1,this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),this.urlChangeCallback=null)}}class g_{constructor(e,n,r=de){D(this,"logger");D(this,"overlay");D(this,"loadingDetector");D(this,"domIntrospector",null);D(this,"isExecuting",!1);this.logger=r,this.overlay=e,this.loadingDetector=new Lv(r)}setDOMIntrospector(e){this.domIntrospector=e,this.logger.log("[BatchedActionExecutor] DOMIntrospector set for step captures")}get isBusy(){return this.isExecuting}async executeBatch(e){if(this.isExecuting)return this.logger.warn("[BatchedActionExecutor] Already executing a batch"),{success:!1,completedSteps:0};this.isExecuting=!0;let n=0;this.logger.log(`[BatchedActionExecutor] ⚡ Starting fast batch with ${e.steps.length} steps`);try{for(let r=0;r<e.steps.length;r++){const i=e.steps[r];if(this.logger.log(`[BatchedActionExecutor] Step ${r+1}/${e.steps.length}: ${i.action}`),!await this.executeStep(i))return this.logger.error(`[BatchedActionExecutor] ❌ Step ${r+1} failed, aborting batch (completed ${n} steps)`),{success:!1,completedSteps:n};n++;const s=i.action==="wait"?100:300;await new Promise(a=>setTimeout(a,s))}return this.logger.log("[BatchedActionExecutor] ✅ Batch completed successfully"),e.completionCallback&&e.completionCallback(),{success:!0,completedSteps:n}}finally{this.isExecuting=!1,this.overlay.clearHighlight(),this.overlay.hideFloeCursor()}}async executeStep(e){switch(e.action){case"click":return await this.executeClickStep(e);case"wait":return await this.executeWaitStep(e);case"scroll":return await this.executeScrollStep(e);default:return this.logger.warn(`[BatchedActionExecutor] Unknown action: ${e.action}`),!1}}async executeClickStep(e){var a,l,c,d,h;if(!e.target)return this.logger.error("[BatchedActionExecutor] Click step missing target"),!1;const n=(a=e.target.text)==null?void 0:a.toLowerCase().trim(),r=(l=e.target.tag)==null?void 0:l.toLowerCase();this.logger.log("[BatchedActionExecutor] Looking for element:",{text:e.target.text,tag:e.target.tag,selector:e.target.selector,ariaLabel:e.target.ariaLabel,role:e.target.role,labelText:e.target.labelText,selectorFallbacks:(c=e.target.selectorFallbacks)!=null&&c.length?`${e.target.selectorFallbacks.length} fallback(s)`:void 0});let i=null;const o=3,s=[300,500,800];for(let f=0;f<=o;f++)if(f>0&&(this.logger.log(`[BatchedActionExecutor] Retry ${f}/${o} in ${s[f-1]}ms...`),await new Promise(v=>setTimeout(v,s[f-1]))),i=be.resolveTarget(e.target),i){const v=((d=i.textContent)==null?void 0:d.trim().toLowerCase())||"",b=i.tagName.toLowerCase();if(n&&!v.includes(n))if(v.length>=15&&n.startsWith(v)&&v.length/n.length>=.3){const S=Array.from(document.querySelectorAll(r||"*")).filter(m=>{var k;if(m===i)return!1;const w=((k=m.textContent)==null?void 0:k.trim().toLowerCase())||"";return w.length>=v.length&&w.startsWith(v)&&w!==v});if(S.length>0){this.logger.warn(`[BatchedActionExecutor] ⚠️ Truncated text match is ambiguous - ${S.length} other element(s) share the same prefix "${v.slice(0,40)}..."`,S.map(m=>{var w;return`${m.tagName}: "${(w=m.textContent)==null?void 0:w.trim().slice(0,60)}"`})),i=null;continue}this.logger.log(`[BatchedActionExecutor] ✓ Accepting truncated text match (${v.length}/${n.length} chars, ${Math.round(v.length/n.length*100)}% overlap)`)}else{this.logger.warn(`[BatchedActionExecutor] ⚠️ Found element text "${v.slice(0,50)}" doesn't match expected "${n}"`),i=null;continue}r&&b!==r&&this.logger.log(`[BatchedActionExecutor] Note: Found ${b} instead of expected ${r} (acceptable if it contains the text)`);break}if(!i){if(this.logger.error("[BatchedActionExecutor] ❌ Could not find matching element after retries:",e.target),n){const f=Array.from(document.querySelectorAll("*")).filter(v=>{var b;return(b=v.textContent)==null?void 0:b.toLowerCase().includes(n)}).slice(0,5).map(v=>{var b;return`${v.tagName.toLowerCase()}: "${(b=v.textContent)==null?void 0:b.trim().slice(0,50)}"`});f.length>0&&this.logger.log("[BatchedActionExecutor] Similar elements found:",f)}return!1}return this.logger.log("[BatchedActionExecutor] ✓ Found element:",i.tagName,(h=i.textContent)==null?void 0:h.slice(0,30)),i.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(f=>setTimeout(f,150)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(f=>setTimeout(f,100)),this.simulateClick(i),await new Promise(f=>setTimeout(f,100)),this.overlay.clearHighlight(),this.domIntrospector&&(await new Promise(f=>setTimeout(f,100)),this.domIntrospector.captureAndSendImmediate("post-batch-step-click")),!0}simulateClick(e){var n,r;try{const i=Ov(e,{focus:!0,includePointerEvents:!0,includeMouseEnter:!0,nativeClickFallback:!1});i.tagName==="A"&&i.href&&this.logger.log("[BatchedActionExecutor] Clicked link:",i.href)}catch(i){const o=((n=e.tagName)==null?void 0:n.toLowerCase())||"unknown",s=e.href||"",a=((r=e.textContent)==null?void 0:r.trim().slice(0,50))||"";this.logger.error(`[BatchedActionExecutor] simulateClick failed on <${o}>${s?` href="${s}"`:""} "${a}":`,i);const l=i instanceof Error?i.message:String(i),c=new Error(`[BatchedActionExecutor] Click step failed on <${o}> "${a}": ${l}`);throw c.cause=i,c}}async executeWaitStep(e){const n=e.condition||"page_stable",r=e.waitMs||5e3;switch(n){case"page_stable":return await this.loadingDetector.waitForLoadingComplete(r),await new Promise(i=>setTimeout(i,400)),!0;case"loading_complete":return await this.loadingDetector.waitForLoadingComplete(r);case"element_visible":return e.target?await this.waitForElement(e.target,r):!0;default:return await new Promise(i=>setTimeout(i,e.waitMs||500)),!0}}async executeScrollStep(e){if(!e.target)return this.logger.warn("[BatchedActionExecutor] Scroll step has no target"),!1;const n=be.resolveTarget(e.target);return n?(n.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(r=>setTimeout(r,100)),!0):(this.logger.warn("[BatchedActionExecutor] Scroll target not found:",e.target),!0)}async waitForElement(e,n){const r=Date.now();for(;Date.now()-r<n;){if(be.resolveTarget(e))return!0;await new Promise(o=>setTimeout(o,100))}return!1}}const Iv=(()=>{var t;try{const e=(t=document.currentScript)==null?void 0:t.src;if(e)return new URL(e).origin}catch{}return null})(),m_=50,Pi="floe_recording_params",y_=15*60*1e3;function v_(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.recordingId=="string"&&e.recordingId.length>0&&typeof e.siteId=="string"&&e.siteId.length>0&&typeof e.recordingToken=="string"&&e.recordingToken.length>0&&typeof e.storedAt=="number"&&Number.isFinite(e.storedAt)}function b_(){try{const t=new URL(window.location.href);if(t.searchParams.get("floe_record")==="true"){const r=t.searchParams.get("floe_recording_id"),i=t.searchParams.get("floe_site_id"),o=t.searchParams.get("floe_recording_token");if(t.searchParams.delete("floe_record"),t.searchParams.delete("floe_recording_id"),t.searchParams.delete("floe_site_id"),t.searchParams.delete("floe_recording_token"),window.history.replaceState(null,"",t.toString()),r&&i&&o){const s={recordingId:r,siteId:i,recordingToken:o,storedAt:Date.now()};try{sessionStorage.setItem(Pi,JSON.stringify(s))}catch{}return s}}const n=sessionStorage.getItem(Pi);if(n){let r;try{r=JSON.parse(n)}catch{return sessionStorage.removeItem(Pi),null}if(!v_(r))return sessionStorage.removeItem(Pi),null;if(Date.now()-r.storedAt<y_)return r;sessionStorage.removeItem(Pi)}}catch{}return null}function Rv(){try{sessionStorage.removeItem(Pi)}catch{}}async function w_(t,e){de.log("[OnboardingSDK] 🎬 Manual recording mode detected – loading recorder…");const n=(()=>{if(Iv)return`${Iv}/floe-recorder.js`;try{return`${new URL(e).origin}/floe-recorder.js`}catch{return"/floe-recorder.js"}})();await new Promise((i,o)=>{if(window.FloeRecorder){i();return}const s=1e4,a=document.createElement("script");a.src=n,a.async=!0;const l=setTimeout(()=>{a.onload=null,a.onerror=null,a.remove(),o(new Error(`FloeRecorder script load timed out after ${s}ms: ${n}`))},s);a.onload=()=>{clearTimeout(l),i()},a.onerror=()=>{clearTimeout(l),a.remove(),o(new Error(`Failed to load FloeRecorder from ${n}`))},document.head.appendChild(a)});const r=window.FloeRecorder;if(!r)throw new Error("FloeRecorder not found after script load");r.configure({apiEndpoint:e,siteId:t.siteId,recordingId:t.recordingId,recordingToken:t.recordingToken,autoUpload:!0}),Rv(),await r.start(),de.log("[OnboardingSDK] ✅ Recording started")}const S_=3e4;class Nv extends t_{constructor(n,r){super();D(this,"logger");D(this,"config");D(this,"sessionId");D(this,"overlay");D(this,"capture");D(this,"actionExecutor");D(this,"pipecatClient",null);D(this,"transport",null);D(this,"isInitialized",!1);D(this,"reactRoot",null);D(this,"reactContainer",null);D(this,"agentState","idle");D(this,"pausedSessionId",null);D(this,"pendingResumeSessionId",null);D(this,"botTranscript","");D(this,"userTranscript","");D(this,"transcriptHistory",[]);D(this,"lastUserTranscript","");D(this,"isConnected",!1);D(this,"connectInFlight",!1);D(this,"micEnabled",!0);D(this,"userIsSpeaking",!1);D(this,"botIsSpeaking",!1);D(this,"audioLevels",[]);D(this,"_discoveryPopupShown",!1);D(this,"_pendingDiscoveryStart",!1);D(this,"botAudioAnalyzer",null);D(this,"userAudioAnalyzer",null);D(this,"userMicStream",null);D(this,"userMicStreamRequestId",0);D(this,"audioElements",[]);D(this,"pageTracker");D(this,"screenShareEnabled",!1);D(this,"domIntrospector");D(this,"accessibleSnapshot");D(this,"fastExecutionMode",!1);D(this,"batchedActionExecutor",null);D(this,"navigationCompleteDetector",null);D(this,"_botActionDepth",0);D(this,"endUserStatus",null);D(this,"connectionProgress",null);D(this,"isReturningUser",!1);D(this,"hasSkippedOnboarding",!1);D(this,"_isMinimized",!1);D(this,"textModeEnabled",!1);D(this,"micPermissionDenied",!1);D(this,"planProgress",null);if(!n.clientKey)throw new Error("Client key is required");const i="https://api.dev.floe.so";this.config={apiUrl:i,enableVideo:!1,enableAudio:!0,enableScreenCapture:!0,debug:!1,...n},this.logger=r??_d(this.config.debug??!1),this.micEnabled=this.config.enableAudio!==!1;try{localStorage.getItem("floe_text_mode")==="true"&&(this.textModeEnabled=!0)}catch{}this.sessionId=this.generateSessionId(),this.overlay=new d_(this.logger),this.capture=new Td(this.config.redactionPatterns,this.logger),this.actionExecutor=new u_(this.logger),this.pageTracker=new h_(this,this.logger),this.domIntrospector=new n_(this.logger),be.setDOMIntrospector(this.domIntrospector),this.accessibleSnapshot=new Ed(this.logger),this.batchedActionExecutor=new g_(this.overlay,this.actionExecutor,this.logger),this.batchedActionExecutor.setDOMIntrospector(this.domIntrospector),window.__onboardingSDK=this,this.logger.log("[OnboardingSDK] Initialized with config:",this.config)}generateSessionId(){return`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}async validateClientKeyAndBotStatus(){const n=new AbortController,r=setTimeout(()=>n.abort(),4e3);try{const i=await fetch(`${this.config.apiUrl}/sites/validate-client-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:this.config.clientKey,origin:window.location.origin}),signal:n.signal});if(clearTimeout(r),!i.ok){let s=null;try{s=await i.json()}catch{}return{valid:!1,error:(s==null?void 0:s.error)||i.statusText||`HTTP ${i.status}`}}const o=await i.json();return o.valid?{valid:!0}:{valid:!1,error:o.error||"Validation failed"}}catch(i){return clearTimeout(r),i instanceof TypeError||i instanceof DOMException&&i.name==="AbortError"?(this.logger.warn("[OnboardingSDK] Client key validation failed due to network/timeout, proceeding anyway:",i),{valid:!0}):(this.logger.warn("[OnboardingSDK] Unexpected error during client key validation:",i),{valid:!1})}}async startScreenShare(){try{this.pipecatClient&&(await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,this.logger.log("[OnboardingSDK] Screen share enabled"),this.sendMetadata({type:"screen_share_status",active:!0}),this.renderReactUI())}catch(n){throw this.logger.error("[OnboardingSDK] Screen share failed:",n),this.screenShareEnabled=!1,n}}async init(){if(this.isInitialized){this.logger.warn("[OnboardingSDK] Already initialized");return}try{const n=b_();if(n){const l=this.config.apiUrl??"http://localhost:3001";try{await w_(n,l),this.isInitialized=!0;return}catch(c){this.logger.error("[OnboardingSDK] Failed to initialise manual recording:",c),Rv(),this.emit("error",{type:"manual_recording_init_failed",error:c})}}const r=await this.validateClientKeyAndBotStatus();if(!r.valid){this.config.debug&&this.logger.log("[OnboardingSDK] Bot is disabled or invalid:",r.error);return}this._finalizePendingNavigation(),this.overlay.inject(),this.initReactUI(),this.config.userInfo&&(this.config.userInfo.externalId||this.config.userInfo.email)&&await this.checkEndUserStatus();const i=this.shouldSkipOnboardingModal();let o=!0;if(i)this.logger.log("[OnboardingSDK] 🔄 Skipping onboarding modal for returning user"),this._discoveryPopupShown=!0,this.isReturningUser=!0,o=!1,this.logger.log("[OnboardingSDK] Bot will stay closed - user clicks to start");else if(this.config.enableDiscoveryPopup!==!1){this.logger.log("[OnboardingSDK] 🎉 Showing welcome popup before connect");const l=await this.showWelcomePopupAsync();this._discoveryPopupShown=!0,this.markUserVisited(),l?(this._pendingDiscoveryStart=!0,this.logger.log("[OnboardingSDK] User chose guided discovery - will start after connect"),o=!0):(this.logger.log("[OnboardingSDK] User skipped onboarding - bot will stay closed"),this.hasSkippedOnboarding=!0,o=!1)}if(!o){this.logger.log("[OnboardingSDK] 📍 Initialized in minimized state - user clicks to connect"),this._isMinimized=!0,this.agentState="idle",this.isInitialized=!0,this.renderReactUI(),this.emit("ready");return}this.transport=new wn,this.pipecatClient=new At({transport:this.transport,enableMic:this.textModeEnabled?!1:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),this.setupNavigationDetection(),this.pipecatClient=await this.initDevicesWithMicFallback(this.pipecatClient),this.setupAudioPlayback();const s=`${this.config.apiUrl}/sites/start-session`;this.logger.log("[OnboardingSDK] Starting session via floe-api proxy:",s);const a={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};if(this.config.userInfo&&(a.sessionData.userInfo=this.config.userInfo),await this.pipecatClient.startBotAndConnect({endpoint:s,requestData:a}),this.config.enableScreenCapture)if(await this.overlay.showScreenShareModal())try{await this.startScreenShare()}catch(c){this.logger.error("[OnboardingSDK] Screen share failed:",c)}else this.logger.log("[OnboardingSDK] Screen share declined by user");this.isInitialized=!0,this.emit("ready")}catch(n){throw this.logger.error("[OnboardingSDK] Initialization failed:",n),this.emit("error",n),n}}setupNavigationDetection(){this.navigationCompleteDetector||(this.navigationCompleteDetector=new p_(this.logger)),this.navigationCompleteDetector.start(n=>{this.logger.log("[OnboardingSDK] Navigation complete detected:",n),this.overlay.cleanup(),this.sendMetadata({type:"navigation_complete",url:n,timestamp:Date.now()})}),this.logger.log("[OnboardingSDK] NavigationCompleteDetector started")}setupAudioPlayback(){this.pipecatClient&&(this.botAudioAnalyzer||(this.botAudioAnalyzer=new Dv),this.userAudioAnalyzer||(this.userAudioAnalyzer=new Dv),this.textModeEnabled?this.logger.log("[OnboardingSDK] ⌨️ Text mode — skipping user mic analysis"):this.setupUserMicAnalysis(),this.pipecatClient.on("trackStarted",(n,r)=>{if(!(r!=null&&r.local)&&n.kind==="audio"){this.logger.log("[OnboardingSDK] 🔊 Bot audio track started");const i=new MediaStream([n]),o=document.createElement("audio");o.autoplay=!0,o.srcObject=i,document.body.appendChild(o),this.botAudioAnalyzer&&this.botAudioAnalyzer.start(i,s=>{this.botIsSpeaking&&(this.audioLevels=s,this.renderReactUI())}),this.audioElements||(this.audioElements=[]),this.audioElements.push(o)}}),this.pipecatClient.on("trackStopped",(n,r)=>{!(r!=null&&r.local)&&n.kind==="audio"&&(this.logger.log("[OnboardingSDK] 🔇 Bot audio track stopped"),this.botAudioAnalyzer&&this.botAudioAnalyzer.stop(),this.audioLevels=[]),r!=null&&r.local&&n.kind==="video"&&this.screenShareEnabled&&(this.logger.log("[OnboardingSDK] 🖥️ Screen share track stopped (browser stop button)"),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1}),this.renderReactUI())}))}async initDevicesWithMicFallback(n){try{return await n.initDevices(),this.logger.log("[OnboardingSDK] Devices initialized"),n}catch(r){if(!this.isMicPermissionError(r))throw r;this.logger.warn("[OnboardingSDK] Mic permission denied during initDevices — retrying in text mode"),this.textModeEnabled=!0,this.micPermissionDenied=!0,this.micEnabled=!1;try{localStorage.setItem("floe_text_mode","true")}catch{}const i=new At({transport:this.transport,enableMic:!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()});return await i.initDevices(),this.logger.log("[OnboardingSDK] Devices initialized (text mode fallback)"),i}}isMicPermissionError(n){const r=["NotAllowedError","SecurityError","AbortError"];if(n instanceof DOMException)return r.includes(n.name);if(n!==null&&typeof n=="object"){const i=n.name;return typeof i=="string"&&r.includes(i)}return!1}enableTextModeFallback(){if(!this.textModeEnabled){this.logger.log("[OnboardingSDK] Mic permission denied/cancelled — switching to text mode automatically"),this.textModeEnabled=!0,this.micPermissionDenied=!0,this.micEnabled=!1,this.pipecatClient&&this.pipecatClient.enableMic(!1),this.pipecatClient&&this.isConnected&&this.pipecatClient.sendClientMessage("set_text_mode",{enabled:!0});try{localStorage.setItem("floe_text_mode","true")}catch{}this.renderReactUI()}}async setupUserMicAnalysis(){const n=++this.userMicStreamRequestId;try{const r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});if(n!==this.userMicStreamRequestId||!this.userAudioAnalyzer){this.logger.log("[OnboardingSDK] 🎤 Mic stream request invalidated (disconnect/reconnect occurred), stopping tracks"),r.getTracks().forEach(i=>i.stop());return}this.userMicStream&&this.userMicStream.getTracks().forEach(i=>i.stop()),this.userMicStream=r,this.micPermissionDenied&&(this.micPermissionDenied=!1,this.renderReactUI()),this.logger.log("[OnboardingSDK] 🎤 User mic stream captured for visualization"),this.userAudioAnalyzer&&this.userAudioAnalyzer.start(r,i=>{this.userIsSpeaking&&(this.audioLevels=i,this.renderReactUI())})}catch(r){if(n!==this.userMicStreamRequestId)return;this.isMicPermissionError(r)?this.enableTextModeFallback():this.logger.warn("[OnboardingSDK] Could not capture mic for visualization:",r)}}initReactUI(){this.reactContainer=document.createElement("div"),this.reactContainer.id="onboarding-sdk-react-ui",this.reactContainer.setAttribute(Di,"react-ui"),this.reactContainer.style.cssText=`
820
+ `,y.head.appendChild(S),!y.body){this.logger.warn("[ScreenCapture] Cloned document has no body"),document.body.removeChild(g),this.safeCanvasToDataURL(a,o,i).then(h,f);return}const v=y.createTreeWalker(y.body,NodeFilter.SHOW_TEXT);let w;for(;w=v.nextNode();)this.containsPII(w.textContent||"").contains&&w.parentElement&&w.parentElement.classList.add("pii-redacted")}const m=()=>{try{document.body.removeChild(g)}catch{}};setTimeout(()=>{try{if(!g.contentWindow){this.logger.warn("[ScreenCapture] iframe contentWindow not available"),m(),this.safeCanvasToDataURL(a,o,i).then(h,f);return}const w=new XMLSerializer().serializeToString(y.documentElement),k=`<svg xmlns="http://www.w3.org/2000/svg" width="${window.innerWidth}" height="${window.innerHeight}"><foreignObject width="100%" height="100%">`+w+"</foreignObject></svg>",C=new Blob([k],{type:"image/svg+xml;charset=utf-8"}),E=URL.createObjectURL(C),L=new Image;L.onload=()=>{if(l.save(),l.scale(r,r),l.drawImage(L,0,0),l.restore(),URL.revokeObjectURL(E),n&&s.length>0)for(const A of s)this.applyBlur(l,{x:A.x*r,y:A.y*r,width:A.width*r,height:A.height*r});m(),this.safeCanvasToDataURL(a,o,i).then(h,f)},L.onerror=()=>{URL.revokeObjectURL(E),this.logger.warn("[ScreenCapture] SVG image render failed, returning blank canvas"),m(),this.safeCanvasToDataURL(a,o,i).then(h,f)},L.src=E}catch(S){this.logger.error("[ScreenCapture] Failed to render iframe content:",S),m(),this.safeCanvasToDataURL(a,o,i).then(h,f)}},100)})}async captureSimple(e={}){return this.captureWithRedaction({...e,redact:!1})}}class h_{constructor(e,n=de){P(this,"logger");P(this,"sdk");P(this,"domIntrospector",null);P(this,"lastUrl","");P(this,"clickHandler",null);P(this,"focusHandler",null);P(this,"blurHandler",null);P(this,"inputHandler",null);P(this,"keydownHandler",null);P(this,"inputDebounceTimers",new Map);P(this,"isTracking",!1);P(this,"scrollHandler",null);P(this,"scrollDebounceTimer",null);P(this,"urlCheckInterval",null);P(this,"popstateHandler",null);this.logger=n,this.sdk=e,this.lastUrl=window.location.href}setDOMIntrospector(e){this.domIntrospector=e,this.logger.log("[PageTracker] DOMIntrospector set for sync captures")}start(){this.isTracking||(this.isTracking=!0,this.logger.log("[PageTracker] Starting page event tracking"),this.sendPageMetadata(),this.setupUrlTracking(),this.clickHandler=e=>{const n=e.target;if(!n||Mt(n))return;const r=this.getElementMetadata(n),i=this.sdk._botActionDepth>0?"bot":"user";this.sdk.sendMetadata({type:"click",selector:r.selector,text:r.text,tagName:r.tagName,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now(),source:i}),this.logger.log(`[PageTracker] Click (${i}):`,r.selector,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-click")},100)},document.addEventListener("click",this.clickHandler,!0),this.scrollHandler=()=>{this.sdk.fastExecutionMode||(this.scrollDebounceTimer&&clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=setTimeout(()=>{this.sdk.fastExecutionMode||(this.logger.log("[PageTracker] Scroll detected, capturing DOM"),this.sdk.sendMetadata({type:"scroll",scrollY:window.scrollY,scrollX:window.scrollX,viewportHeight:window.innerHeight,documentHeight:document.documentElement.scrollHeight,timestamp:Date.now()}),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-scroll"))},200))},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.focusHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||Mt(n))return;const r=this.getElementMetadata(n),i=n.type||"";this.sdk.sendMetadata({type:"focus",selector:r.selector,tagName:r.tagName,inputType:i,role:r.role,ariaLabel:r.ariaLabel,placeholder:r.placeholder,labelText:r.labelText,timestamp:Date.now()}),this.logger.log("[PageTracker] Focus:",r.tagName,r.labelText?`(label: ${r.labelText})`:""),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var o;(o=this.domIntrospector)==null||o.captureAndSendImmediate("post-focus")},150)},document.addEventListener("focus",this.focusHandler,!0),this.blurHandler=e=>{const n=e.target;if(!n||!this.isInteractiveElement(n)||Mt(n))return;const r=n.tagName.toLowerCase();this.sdk.sendMetadata({type:"blur",selector:this.getSelector(n),tagName:r,timestamp:Date.now()}),this.logger.log("[PageTracker] Blur:",r),this.domIntrospector&&this.isInputElement(n)&&setTimeout(()=>{var i;(i=this.domIntrospector)==null||i.captureAndSendImmediate("post-blur")},200)},document.addEventListener("blur",this.blurHandler,!0),this.inputHandler=e=>{const n=e.target;if(!n||Mt(n))return;const r=this.inputDebounceTimers.get(n);r&&clearTimeout(r);const i=setTimeout(()=>{const o=this.getElementMetadata(n),s=n.name||n.id||n.placeholder||o.labelText||"field";this.sdk.sendMetadata({type:"form_input",selector:o.selector,field:s,inputType:n.type||"text",hasValue:!!n.value,role:o.role,ariaLabel:o.ariaLabel,placeholder:o.placeholder,labelText:o.labelText,timestamp:Date.now()}),this.logger.log("[PageTracker] Form input:",s,o.labelText?`(label: ${o.labelText})`:""),this.inputDebounceTimers.delete(n),this.domIntrospector&&this.domIntrospector.captureAndSendImmediate("post-input")},500);this.inputDebounceTimers.set(n,i)},document.addEventListener("input",this.inputHandler,!0),this.keydownHandler=e=>{const n=e.target;if(!n||!(n instanceof HTMLElement)||Mt(n)||!this.isInputElement(n)||!["Enter","Escape","Tab"].includes(e.key))return;const i=n.tagName.toLowerCase(),o=n.type||"";if(this.sdk.sendMetadata({type:"keydown",key:e.key,selector:this.getSelector(n),tagName:i,inputType:o,timestamp:Date.now()}),this.logger.log("[PageTracker] Keydown:",e.key,"on",i),this.domIntrospector){const s=e.key==="Enter"?300:150;setTimeout(()=>{var a;(a=this.domIntrospector)==null||a.captureAndSendImmediate(`post-keydown-${e.key.toLowerCase()}`)},s)}},document.addEventListener("keydown",this.keydownHandler,!0),this.logger.log("[PageTracker] Event listeners attached"))}stop(){this.isTracking&&(this.isTracking=!1,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null),this.focusHandler&&(document.removeEventListener("focus",this.focusHandler,!0),this.focusHandler=null),this.blurHandler&&(document.removeEventListener("blur",this.blurHandler,!0),this.blurHandler=null),this.inputHandler&&(document.removeEventListener("input",this.inputHandler,!0),this.inputHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler,!0),this.keydownHandler=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.scrollDebounceTimer&&(clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=null),this.urlCheckInterval&&(clearInterval(this.urlCheckInterval),this.urlCheckInterval=null),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.inputDebounceTimers.forEach(e=>{clearTimeout(e)}),this.inputDebounceTimers.clear(),this.logger.log("[PageTracker] Stopped tracking"))}setupUrlTracking(){this.urlCheckInterval||(this.urlCheckInterval=setInterval(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},1e3),this.popstateHandler=()=>{setTimeout(()=>{const e=window.location.href;e!==this.lastUrl&&(this.lastUrl=e,this.sendPageMetadata())},100)},window.addEventListener("popstate",this.popstateHandler))}sendPageMetadata(){const e=Ln();this.sdk.sendMetadata({type:"page_metadata",url:e,title:document.title,pathname:window.location.pathname,timestamp:Date.now()}),this.logger.log("[PageTracker] Page metadata sent:",e)}isInteractiveElement(e){const n=e.tagName.toLowerCase();return["input","textarea","select","button"].includes(n)||e.contentEditable==="true"}isInputElement(e){const n=e.tagName.toLowerCase();if(n==="textarea")return!0;if(n==="input"){const r=e.type||"text";return["text","search","email","password","tel","url","number"].includes(r)}return e.contentEditable==="true"}getSelector(e){if(e.id&&!e.id.match(/^(react-select-|:r|radix-)/))return`#${CSS.escape(e.id)}`;const n=e.getAttribute("role"),r=e.getAttribute("aria-label"),i=e.getAttribute("name"),o=e.getAttribute("data-testid")||e.getAttribute("data-test-id"),s=e.placeholder,a=e.tagName.toLowerCase();let l=a;if(o)return`[data-testid="${o}"]`;if(n)return l=`${a}[role="${n}"]`,r?l+=`[aria-label="${r}"]`:i&&(l+=`[name="${i}"]`),l;if(i)return`${a}[name="${i}"]`;if(s)return`${a}[placeholder="${s}"]`;if(r)return`${a}[aria-label="${r}"]`;const c=[];let d=e,h=0;for(;d&&d!==document.body&&h<5;){let f=d.tagName.toLowerCase();const g=d.getAttribute("role"),y=d.getAttribute("data-testid");if(y){c.unshift(`[data-testid="${y}"]`);break}if(g)f+=`[role="${g}"]`;else if(d.className&&typeof d.className=="string"){const m=d.className.split(" ").filter(S=>S&&!S.startsWith("css-")&&!S.startsWith("sc-")&&!S.startsWith("ng-")&&!S.startsWith("_")&&!S.match(/^[a-z]{6,}$/)&&!S.match(/^\d/)).slice(0,2);m.length>0&&(f+=`.${m.join(".")}`)}c.unshift(f),d=d.parentElement,h++}return c.join(" > ")}getElementMetadata(e){var f,g,y,m;const n=e,r=this.getSelector(e),i=((f=n.innerText)==null?void 0:f.trim().substring(0,100))||"",o=e.tagName.toLowerCase(),s=e.getAttribute("role")||void 0,a=e.getAttribute("aria-label")||void 0,l=e.placeholder||void 0;let c;const d=e.getAttribute("aria-labelledby");if(d){const S=document.getElementById(d.split(/\s+/)[0]);S&&(c=(g=S.textContent)==null?void 0:g.trim())}const h=e.getAttribute("id");if(!c&&h)try{const S=document.querySelector(`label[for="${CSS.escape(h)}"]`);S&&(c=(y=S.textContent)==null?void 0:y.trim().replace(/\*$/,"").trim())}catch{}if(!c){const S=e.closest('.MuiFormControl-root, fieldset, [class*="form-group"], [class*="form-field"], [class*="field-wrapper"]');if(S){const v=S.querySelector(":scope > label, :scope > .MuiFormLabel-root, :scope > div > label");if(v){const w=S.querySelectorAll('input, select, textarea, [role="combobox"]'),k=Array.from(w).some(C=>e.contains(C)||e===C);(w.length===1||k)&&(c=(m=v.textContent)==null?void 0:m.trim().replace(/\*$/,"").trim())}}}return{selector:r,text:i,tagName:o,role:s,ariaLabel:a,placeholder:l,labelText:c}}}class Pv{constructor(e=de){P(this,"logger");P(this,"loadingSelectors",['[role="progressbar"]',".loading",".spinner",".loader",'[aria-busy="true"]','[class*="loading"]','[class*="spinner"]','svg[class*="animate-spin"]','[data-loading="true"]',".MuiCircularProgress-root",".MuiLinearProgress-root"]);P(this,"_lastLoggedSelector",null);this.logger=e}isLoading(){for(const e of this.loadingSelectors)try{const n=document.querySelector(e);if(n&&this.isVisible(n))return this._lastLoggedSelector!==e&&(this.logger.log("[LoadingDetector] Found loading indicator:",e),this._lastLoggedSelector=e),!0}catch{}return this._lastLoggedSelector=null,!1}async waitForLoadingComplete(e=5e3){const n=Date.now();for(this.logger.log("[LoadingDetector] Waiting for loading to complete...");Date.now()-n<e;){if(!this.isLoading()&&(await new Promise(r=>setTimeout(r,100)),!this.isLoading()))return this.logger.log("[LoadingDetector] Loading complete"),!0;await new Promise(r=>setTimeout(r,50))}return this.logger.warn("[LoadingDetector] Timed out waiting for loading"),!1}isVisible(e){const n=getComputedStyle(e);if(n.visibility==="hidden"||n.display==="none"||n.opacity==="0")return!1;if(e.offsetParent===null){const i=n.position;if(i!=="fixed"&&i!=="sticky")return!1}const r=e.getBoundingClientRect();return r.width>0&&r.height>0}}class f_{constructor(e=de){P(this,"logger");this.logger=e}async waitForStable(e=300,n=5e3){return new Promise(r=>{let i,o;const s=()=>{clearTimeout(i),clearTimeout(o),a.disconnect()},a=new MutationObserver(()=>{clearTimeout(i),i=setTimeout(()=>{s(),this.logger.log("[DOMStabilityChecker] DOM stable"),r()},e)});a.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(()=>{s(),this.logger.log("[DOMStabilityChecker] DOM stable (no mutations)"),r()},e),o=setTimeout(()=>{s(),this.logger.warn("[DOMStabilityChecker] Max wait time reached, proceeding anyway"),r()},n)})}}class p_{constructor(e=de){P(this,"logger");P(this,"lastUrl","");P(this,"urlChangeCallback",null);P(this,"loadingDetector");P(this,"domStabilityChecker");P(this,"originalPushState",null);P(this,"originalReplaceState",null);P(this,"popstateHandler",null);P(this,"isStarted",!1);P(this,"handleUrlChange",async()=>{const e=window.location.href;if(e!==this.lastUrl){this.logger.log("[NavigationCompleteDetector] URL changed:",e),this.lastUrl=e;try{await this.waitForPageStable()}catch(n){this.logger.warn("[NavigationCompleteDetector] Error waiting for page stable:",n)}this.urlChangeCallback&&this.urlChangeCallback(Ln())}});this.logger=e,this.lastUrl=window.location.href,this.loadingDetector=new Pv(e),this.domStabilityChecker=new f_(e)}start(e){this.isStarted&&(this.logger.warn("[NavigationCompleteDetector] Already started, stopping first"),this.stop()),this.logger.log("[NavigationCompleteDetector] Starting navigation monitoring"),this.isStarted=!0,this.urlChangeCallback=e,this.lastUrl=window.location.href,this.setupUrlObserver(),this.popstateHandler=()=>this.handleUrlChange(),window.addEventListener("popstate",this.popstateHandler)}setupUrlObserver(){this.originalPushState||(this.originalPushState=history.pushState.bind(history)),this.originalReplaceState||(this.originalReplaceState=history.replaceState.bind(history));const e=this;history.pushState=function(...n){e.originalPushState(...n),e.handleUrlChange()},history.replaceState=function(...n){e.originalReplaceState(...n),e.handleUrlChange()}}async waitForPageStable(){this.logger.log("[NavigationCompleteDetector] Waiting for page to stabilize...");const e=8e3,n=Date.now();await this.loadingDetector.waitForLoadingComplete(5e3);const r=e-(Date.now()-n);r>300&&await this.domStabilityChecker.waitForStable(300,Math.min(r,3e3)),this.logger.log("[NavigationCompleteDetector] Page stable")}stop(){this.isStarted&&(this.logger.log("[NavigationCompleteDetector] Stopping navigation monitoring"),this.isStarted=!1,this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),this.urlChangeCallback=null)}}class g_{constructor(e,n,r=de){P(this,"logger");P(this,"overlay");P(this,"loadingDetector");P(this,"domIntrospector",null);P(this,"isExecuting",!1);this.logger=r,this.overlay=e,this.loadingDetector=new Pv(r)}setDOMIntrospector(e){this.domIntrospector=e,this.logger.log("[BatchedActionExecutor] DOMIntrospector set for step captures")}get isBusy(){return this.isExecuting}async executeBatch(e){if(this.isExecuting)return this.logger.warn("[BatchedActionExecutor] Already executing a batch"),{success:!1,completedSteps:0};this.isExecuting=!0;let n=0;this.logger.log(`[BatchedActionExecutor] ⚡ Starting fast batch with ${e.steps.length} steps`);try{for(let r=0;r<e.steps.length;r++){const i=e.steps[r];if(this.logger.log(`[BatchedActionExecutor] Step ${r+1}/${e.steps.length}: ${i.action}`),!await this.executeStep(i))return this.logger.error(`[BatchedActionExecutor] ❌ Step ${r+1} failed, aborting batch (completed ${n} steps)`),{success:!1,completedSteps:n};n++;const s=i.action==="wait"?100:300;await new Promise(a=>setTimeout(a,s))}return this.logger.log("[BatchedActionExecutor] ✅ Batch completed successfully"),e.completionCallback&&e.completionCallback(),{success:!0,completedSteps:n}}finally{this.isExecuting=!1,this.overlay.clearHighlight(),this.overlay.hideFloeCursor()}}async executeStep(e){switch(e.action){case"click":return await this.executeClickStep(e);case"wait":return await this.executeWaitStep(e);case"scroll":return await this.executeScrollStep(e);default:return this.logger.warn(`[BatchedActionExecutor] Unknown action: ${e.action}`),!1}}async executeClickStep(e){var a,l,c,d,h;if(!e.target)return this.logger.error("[BatchedActionExecutor] Click step missing target"),!1;const n=(a=e.target.text)==null?void 0:a.toLowerCase().trim(),r=(l=e.target.tag)==null?void 0:l.toLowerCase();this.logger.log("[BatchedActionExecutor] Looking for element:",{text:e.target.text,tag:e.target.tag,selector:e.target.selector,ariaLabel:e.target.ariaLabel,role:e.target.role,labelText:e.target.labelText,selectorFallbacks:(c=e.target.selectorFallbacks)!=null&&c.length?`${e.target.selectorFallbacks.length} fallback(s)`:void 0});let i=null;const o=3,s=[300,500,800];for(let f=0;f<=o;f++)if(f>0&&(this.logger.log(`[BatchedActionExecutor] Retry ${f}/${o} in ${s[f-1]}ms...`),await new Promise(g=>setTimeout(g,s[f-1]))),i=be.resolveTarget(e.target),i){const g=((d=i.textContent)==null?void 0:d.trim().toLowerCase())||"",y=i.tagName.toLowerCase();if(n&&!g.includes(n))if(g.length>=15&&n.startsWith(g)&&g.length/n.length>=.3){const S=Array.from(document.querySelectorAll(r||"*")).filter(v=>{var k;if(v===i)return!1;const w=((k=v.textContent)==null?void 0:k.trim().toLowerCase())||"";return w.length>=g.length&&w.startsWith(g)&&w!==g});if(S.length>0){this.logger.warn(`[BatchedActionExecutor] ⚠️ Truncated text match is ambiguous - ${S.length} other element(s) share the same prefix "${g.slice(0,40)}..."`,S.map(v=>{var w;return`${v.tagName}: "${(w=v.textContent)==null?void 0:w.trim().slice(0,60)}"`})),i=null;continue}this.logger.log(`[BatchedActionExecutor] ✓ Accepting truncated text match (${g.length}/${n.length} chars, ${Math.round(g.length/n.length*100)}% overlap)`)}else{this.logger.warn(`[BatchedActionExecutor] ⚠️ Found element text "${g.slice(0,50)}" doesn't match expected "${n}"`),i=null;continue}r&&y!==r&&this.logger.log(`[BatchedActionExecutor] Note: Found ${y} instead of expected ${r} (acceptable if it contains the text)`);break}if(!i){if(this.logger.error("[BatchedActionExecutor] ❌ Could not find matching element after retries:",e.target),n){const f=Array.from(document.querySelectorAll("*")).filter(g=>{var y;return(y=g.textContent)==null?void 0:y.toLowerCase().includes(n)}).slice(0,5).map(g=>{var y;return`${g.tagName.toLowerCase()}: "${(y=g.textContent)==null?void 0:y.trim().slice(0,50)}"`});f.length>0&&this.logger.log("[BatchedActionExecutor] Similar elements found:",f)}return!1}return this.logger.log("[BatchedActionExecutor] ✓ Found element:",i.tagName,(h=i.textContent)==null?void 0:h.slice(0,30)),i.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(f=>setTimeout(f,150)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(f=>setTimeout(f,100)),this.simulateClick(i),await new Promise(f=>setTimeout(f,100)),this.overlay.clearHighlight(),this.domIntrospector&&(await new Promise(f=>setTimeout(f,100)),this.domIntrospector.captureAndSendImmediate("post-batch-step-click")),!0}simulateClick(e){var n,r;try{const i=Ov(e,{focus:!0,includePointerEvents:!0,includeMouseEnter:!0,nativeClickFallback:!1});i.tagName==="A"&&i.href&&this.logger.log("[BatchedActionExecutor] Clicked link:",i.href)}catch(i){const o=((n=e.tagName)==null?void 0:n.toLowerCase())||"unknown",s=e.href||"",a=((r=e.textContent)==null?void 0:r.trim().slice(0,50))||"";this.logger.error(`[BatchedActionExecutor] simulateClick failed on <${o}>${s?` href="${s}"`:""} "${a}":`,i);const l=i instanceof Error?i.message:String(i),c=new Error(`[BatchedActionExecutor] Click step failed on <${o}> "${a}": ${l}`);throw c.cause=i,c}}async executeWaitStep(e){const n=e.condition||"page_stable",r=e.waitMs||5e3;switch(n){case"page_stable":return await this.loadingDetector.waitForLoadingComplete(r),await new Promise(i=>setTimeout(i,400)),!0;case"loading_complete":return await this.loadingDetector.waitForLoadingComplete(r);case"element_visible":return e.target?await this.waitForElement(e.target,r):!0;default:return await new Promise(i=>setTimeout(i,e.waitMs||500)),!0}}async executeScrollStep(e){if(!e.target)return this.logger.warn("[BatchedActionExecutor] Scroll step has no target"),!1;const n=be.resolveTarget(e.target);return n?(n.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(r=>setTimeout(r,100)),!0):(this.logger.warn("[BatchedActionExecutor] Scroll target not found:",e.target),!0)}async waitForElement(e,n){const r=Date.now();for(;Date.now()-r<n;){if(be.resolveTarget(e))return!0;await new Promise(o=>setTimeout(o,100))}return!1}}const Iv=(()=>{var t;try{const e=(t=document.currentScript)==null?void 0:t.src;if(e)return new URL(e).origin}catch{}return null})(),m_=50,Li="floe_recording_params",y_=15*60*1e3;function v_(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.recordingId=="string"&&e.recordingId.length>0&&typeof e.siteId=="string"&&e.siteId.length>0&&typeof e.recordingToken=="string"&&e.recordingToken.length>0&&typeof e.storedAt=="number"&&Number.isFinite(e.storedAt)}function b_(){try{const t=new URL(window.location.href);if(t.searchParams.get("floe_record")==="true"){const r=t.searchParams.get("floe_recording_id"),i=t.searchParams.get("floe_site_id"),o=t.searchParams.get("floe_recording_token");if(t.searchParams.delete("floe_record"),t.searchParams.delete("floe_recording_id"),t.searchParams.delete("floe_site_id"),t.searchParams.delete("floe_recording_token"),window.history.replaceState(null,"",t.toString()),r&&i&&o){const s={recordingId:r,siteId:i,recordingToken:o,storedAt:Date.now()};try{sessionStorage.setItem(Li,JSON.stringify(s))}catch{}return s}}const n=sessionStorage.getItem(Li);if(n){let r;try{r=JSON.parse(n)}catch{return sessionStorage.removeItem(Li),null}if(!v_(r))return sessionStorage.removeItem(Li),null;if(Date.now()-r.storedAt<y_)return r;sessionStorage.removeItem(Li)}}catch{}return null}function Rv(){try{sessionStorage.removeItem(Li)}catch{}}async function w_(t,e){de.log("[OnboardingSDK] 🎬 Manual recording mode detected – loading recorder…");const n=(()=>{if(Iv)return`${Iv}/floe-recorder.js`;try{return`${new URL(e).origin}/floe-recorder.js`}catch{return"/floe-recorder.js"}})();await new Promise((i,o)=>{if(window.FloeRecorder){i();return}const s=1e4,a=document.createElement("script");a.src=n,a.async=!0;const l=setTimeout(()=>{a.onload=null,a.onerror=null,a.remove(),o(new Error(`FloeRecorder script load timed out after ${s}ms: ${n}`))},s);a.onload=()=>{clearTimeout(l),i()},a.onerror=()=>{clearTimeout(l),a.remove(),o(new Error(`Failed to load FloeRecorder from ${n}`))},document.head.appendChild(a)});const r=window.FloeRecorder;if(!r)throw new Error("FloeRecorder not found after script load");r.configure({apiEndpoint:e,siteId:t.siteId,recordingId:t.recordingId,recordingToken:t.recordingToken,autoUpload:!0}),Rv(),await r.start(),de.log("[OnboardingSDK] ✅ Recording started")}const S_=3e4;class Nv extends t_{constructor(n,r){super();P(this,"logger");P(this,"config");P(this,"sessionId");P(this,"overlay");P(this,"capture");P(this,"actionExecutor");P(this,"pipecatClient",null);P(this,"transport",null);P(this,"isInitialized",!1);P(this,"reactRoot",null);P(this,"reactContainer",null);P(this,"agentState","idle");P(this,"pausedSessionId",null);P(this,"pendingResumeSessionId",null);P(this,"botTranscript","");P(this,"userTranscript","");P(this,"transcriptHistory",[]);P(this,"lastUserTranscript","");P(this,"isConnected",!1);P(this,"connectInFlight",!1);P(this,"micEnabled",!0);P(this,"userIsSpeaking",!1);P(this,"botIsSpeaking",!1);P(this,"audioLevels",[]);P(this,"_discoveryPopupShown",!1);P(this,"_pendingDiscoveryStart",!1);P(this,"botAudioAnalyzer",null);P(this,"userAudioAnalyzer",null);P(this,"userMicStream",null);P(this,"userMicStreamRequestId",0);P(this,"audioElements",[]);P(this,"pageTracker");P(this,"screenShareEnabled",!1);P(this,"domIntrospector");P(this,"accessibleSnapshot");P(this,"fastExecutionMode",!1);P(this,"batchedActionExecutor",null);P(this,"navigationCompleteDetector",null);P(this,"_botActionDepth",0);P(this,"endUserStatus",null);P(this,"connectionProgress",null);P(this,"isReturningUser",!1);P(this,"hasSkippedOnboarding",!1);P(this,"_isMinimized",!1);P(this,"textModeEnabled",!1);P(this,"micPermissionDenied",!1);P(this,"planProgress",null);if(!n.clientKey)throw new Error("Client key is required");const i="https://api.dev.floe.so";this.config={apiUrl:i,enableVideo:!1,enableAudio:!0,enableScreenCapture:!0,debug:!1,...n},this.logger=r??_d(this.config.debug??!1),this.micEnabled=this.config.enableAudio!==!1;try{localStorage.getItem("floe_text_mode")==="true"&&(this.textModeEnabled=!0)}catch{}this.sessionId=this.generateSessionId(),this.overlay=new d_(this.logger),this.capture=new Md(this.config.redactionPatterns,this.logger),this.actionExecutor=new u_(this.logger),this.pageTracker=new h_(this,this.logger),this.domIntrospector=new n_(this.logger),be.setDOMIntrospector(this.domIntrospector),this.accessibleSnapshot=new Td(this.logger),this.batchedActionExecutor=new g_(this.overlay,this.actionExecutor,this.logger),this.batchedActionExecutor.setDOMIntrospector(this.domIntrospector),window.__onboardingSDK=this,this.logger.log("[OnboardingSDK] Initialized with config:",this.config)}generateSessionId(){return`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}async validateClientKeyAndBotStatus(){const n=new AbortController,r=setTimeout(()=>n.abort(),4e3);try{const i=await fetch(`${this.config.apiUrl}/sites/validate-client-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:this.config.clientKey,origin:window.location.origin}),signal:n.signal});if(clearTimeout(r),!i.ok){let s=null;try{s=await i.json()}catch{}return{valid:!1,error:(s==null?void 0:s.error)||i.statusText||`HTTP ${i.status}`}}const o=await i.json();return o.valid?{valid:!0}:{valid:!1,error:o.error||"Validation failed"}}catch(i){return clearTimeout(r),i instanceof TypeError||i instanceof DOMException&&i.name==="AbortError"?(this.logger.warn("[OnboardingSDK] Client key validation failed due to network/timeout, proceeding anyway:",i),{valid:!0}):(this.logger.warn("[OnboardingSDK] Unexpected error during client key validation:",i),{valid:!1})}}async startScreenShare(){try{this.pipecatClient&&(await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,this.logger.log("[OnboardingSDK] Screen share enabled"),this.sendMetadata({type:"screen_share_status",active:!0}),this.renderReactUI())}catch(n){throw this.logger.error("[OnboardingSDK] Screen share failed:",n),this.screenShareEnabled=!1,n}}async init(){if(this.isInitialized){this.logger.warn("[OnboardingSDK] Already initialized");return}try{const n=b_();if(n){const l=this.config.apiUrl??"http://localhost:3001";try{await w_(n,l),this.isInitialized=!0;return}catch(c){this.logger.error("[OnboardingSDK] Failed to initialise manual recording:",c),Rv(),this.emit("error",{type:"manual_recording_init_failed",error:c})}}const r=await this.validateClientKeyAndBotStatus();if(!r.valid){this.config.debug&&this.logger.log("[OnboardingSDK] Bot is disabled or invalid:",r.error);return}this._finalizePendingNavigation(),this.overlay.inject(),this.initReactUI(),this.config.userInfo&&(this.config.userInfo.externalId||this.config.userInfo.email)&&await this.checkEndUserStatus();const i=this.shouldSkipOnboardingModal();let o=!0;if(i)this.logger.log("[OnboardingSDK] 🔄 Skipping onboarding modal for returning user"),this._discoveryPopupShown=!0,this.isReturningUser=!0,o=!1,this.logger.log("[OnboardingSDK] Bot will stay closed - user clicks to start");else if(this.config.enableDiscoveryPopup!==!1){this.logger.log("[OnboardingSDK] 🎉 Showing welcome popup before connect");const l=await this.showWelcomePopupAsync();this._discoveryPopupShown=!0,this.markUserVisited(),l?(this._pendingDiscoveryStart=!0,this.logger.log("[OnboardingSDK] User chose guided discovery - will start after connect"),o=!0):(this.logger.log("[OnboardingSDK] User skipped onboarding - bot will stay closed"),this.hasSkippedOnboarding=!0,o=!1)}if(!o){this.logger.log("[OnboardingSDK] 📍 Initialized in minimized state - user clicks to connect"),this._isMinimized=!0,this.agentState="idle",this.isInitialized=!0,this.renderReactUI(),this.emit("ready");return}this.transport=new Sn,this.pipecatClient=new At({transport:this.transport,enableMic:this.textModeEnabled?!1:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),this.config.debug||this.pipecatClient.setLogLevel(Ut.WARN),this.setupNavigationDetection(),this.pipecatClient=await this.initDevicesWithMicFallback(this.pipecatClient),this.setupAudioPlayback();const s=`${this.config.apiUrl}/sites/start-session`;this.logger.log("[OnboardingSDK] Starting session via floe-api proxy:",s);const a={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};if(this.config.userInfo&&(a.sessionData.userInfo=this.config.userInfo),await this.pipecatClient.startBotAndConnect({endpoint:s,requestData:a}),this.config.enableScreenCapture)if(await this.overlay.showScreenShareModal())try{await this.startScreenShare()}catch(c){this.logger.error("[OnboardingSDK] Screen share failed:",c)}else this.logger.log("[OnboardingSDK] Screen share declined by user");this.isInitialized=!0,this.emit("ready")}catch(n){throw this.logger.error("[OnboardingSDK] Initialization failed:",n),this.emit("error",n),n}}setupNavigationDetection(){this.navigationCompleteDetector||(this.navigationCompleteDetector=new p_(this.logger)),this.navigationCompleteDetector.start(n=>{this.logger.log("[OnboardingSDK] Navigation complete detected:",n),this.overlay.cleanup(),this.sendMetadata({type:"navigation_complete",url:n,timestamp:Date.now()})}),this.logger.log("[OnboardingSDK] NavigationCompleteDetector started")}setupAudioPlayback(){this.pipecatClient&&(this.botAudioAnalyzer||(this.botAudioAnalyzer=new Dv),this.userAudioAnalyzer||(this.userAudioAnalyzer=new Dv),this.textModeEnabled?this.logger.log("[OnboardingSDK] ⌨️ Text mode — skipping user mic analysis"):this.setupUserMicAnalysis(),this.pipecatClient.on("trackStarted",(n,r)=>{if(!(r!=null&&r.local)&&n.kind==="audio"){this.logger.log("[OnboardingSDK] 🔊 Bot audio track started");const i=new MediaStream([n]),o=document.createElement("audio");o.autoplay=!0,o.srcObject=i,document.body.appendChild(o),this.botAudioAnalyzer&&this.botAudioAnalyzer.start(i,s=>{this.botIsSpeaking&&(this.audioLevels=s,this.renderReactUI())}),this.audioElements||(this.audioElements=[]),this.audioElements.push(o)}}),this.pipecatClient.on("trackStopped",(n,r)=>{!(r!=null&&r.local)&&n.kind==="audio"&&(this.logger.log("[OnboardingSDK] 🔇 Bot audio track stopped"),this.botAudioAnalyzer&&this.botAudioAnalyzer.stop(),this.audioLevels=[]),r!=null&&r.local&&n.kind==="video"&&this.screenShareEnabled&&(this.logger.log("[OnboardingSDK] 🖥️ Screen share track stopped (browser stop button)"),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1}),this.renderReactUI())}))}async initDevicesWithMicFallback(n){try{return await n.initDevices(),this.logger.log("[OnboardingSDK] Devices initialized"),n}catch(r){if(!this.isMicPermissionError(r))throw r;this.logger.warn("[OnboardingSDK] Mic permission denied during initDevices — retrying in text mode"),this.textModeEnabled=!0,this.micPermissionDenied=!0,this.micEnabled=!1;try{localStorage.setItem("floe_text_mode","true")}catch{}const i=new At({transport:this.transport,enableMic:!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()});return this.config.debug||i.setLogLevel(Ut.WARN),await i.initDevices(),this.logger.log("[OnboardingSDK] Devices initialized (text mode fallback)"),i}}isMicPermissionError(n){const r=["NotAllowedError","SecurityError","AbortError"];if(n instanceof DOMException)return r.includes(n.name);if(n!==null&&typeof n=="object"){const i=n.name;return typeof i=="string"&&r.includes(i)}return!1}enableTextModeFallback(){if(!this.textModeEnabled){this.logger.log("[OnboardingSDK] Mic permission denied/cancelled — switching to text mode automatically"),this.textModeEnabled=!0,this.micPermissionDenied=!0,this.micEnabled=!1,this.pipecatClient&&this.pipecatClient.enableMic(!1),this.pipecatClient&&this.isConnected&&this.pipecatClient.sendClientMessage("set_text_mode",{enabled:!0});try{localStorage.setItem("floe_text_mode","true")}catch{}this.renderReactUI()}}async setupUserMicAnalysis(){const n=++this.userMicStreamRequestId;try{const r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});if(n!==this.userMicStreamRequestId||!this.userAudioAnalyzer){this.logger.log("[OnboardingSDK] 🎤 Mic stream request invalidated (disconnect/reconnect occurred), stopping tracks"),r.getTracks().forEach(i=>i.stop());return}this.userMicStream&&this.userMicStream.getTracks().forEach(i=>i.stop()),this.userMicStream=r,this.micPermissionDenied&&(this.micPermissionDenied=!1,this.renderReactUI()),this.logger.log("[OnboardingSDK] 🎤 User mic stream captured for visualization"),this.userAudioAnalyzer&&this.userAudioAnalyzer.start(r,i=>{this.userIsSpeaking&&(this.audioLevels=i,this.renderReactUI())})}catch(r){if(n!==this.userMicStreamRequestId)return;this.isMicPermissionError(r)?this.enableTextModeFallback():this.logger.warn("[OnboardingSDK] Could not capture mic for visualization:",r)}}initReactUI(){this.reactContainer=document.createElement("div"),this.reactContainer.id="onboarding-sdk-react-ui",this.reactContainer.setAttribute(Di,"react-ui"),this.reactContainer.style.cssText=`
811
821
  position: fixed;
812
822
  top: 0;
813
823
  left: 0;
@@ -815,7 +825,7 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
815
825
  height: 100%;
816
826
  pointer-events: none;
817
827
  z-index: 2147483646;
818
- `,document.body.appendChild(this.reactContainer),this.reactRoot=mc.createRoot(this.reactContainer),this.renderReactUI()}renderReactUI(){var n,r,i;this.reactRoot&&this.reactRoot.render(cg.createElement(Qx,{connected:this.isConnected,voiceEnabled:this.micEnabled,agentState:this.agentState,botTranscript:this.botTranscript,userTranscript:this.userTranscript,transcriptHistory:[...this.transcriptHistory],screenShareEnabled:this.screenShareEnabled,userIsSpeaking:this.userIsSpeaking,botIsSpeaking:this.botIsSpeaking,audioLevels:[...this.audioLevels],onToggleConnection:()=>this.handleToggleConnection(),onToggleMute:()=>this.toggleMute(),onToggleScreenShare:()=>this.handleToggleScreenShare(),onResume:this.pausedSessionId?()=>this.resumeSession(this.pausedSessionId):void 0,pausedSessionId:this.pausedSessionId||void 0,onStop:this.agentState==="paused"?()=>this.stopSession():void 0,connectionProgress:this.connectionProgress||void 0,isReturningUser:this.isReturningUser,hasSkippedOnboarding:this.hasSkippedOnboarding,onMinimize:()=>this.handleMinimize(),onExpand:()=>this.handleExpand(),textModeEnabled:this.textModeEnabled,micPermissionDenied:this.micPermissionDenied,onToggleTextMode:()=>this.toggleTextMode(),onSendText:o=>this.sendTextMessage(o),nudgeText:(n=this.config.nudge)==null?void 0:n.text,nudgeAutoHideDelay:(r=this.config.nudge)==null?void 0:r.autoHideDelay,nudgeAutoShow:(i=this.config.nudge)==null?void 0:i.autoShow,planProgress:this.planProgress||void 0}))}handleMinimize(){this._isMinimized=!0,this.logger.log("[OnboardingSDK] UI minimized"),this.renderReactUI(),this.emit("minimized")}handleExpand(){this._isMinimized=!1,this.logger.log("[OnboardingSDK] UI expanded"),this.renderReactUI(),this.emit("expanded")}setConnectionProgress(n,r,i){this.connectionProgress={stage:n,message:r,progress:i},this.renderReactUI()}clearConnectionProgress(){this.connectionProgress=null,this.renderReactUI()}async handleToggleConnection(){if(this.isConnected){this.logger.log("[OnboardingSDK] Disconnecting and minimizing...");try{await this.disconnectAndMinimize()}catch(n){this.logger.error("[OnboardingSDK] Error during disconnect and minimize:",n),this.emit("error",n)}return}if(this.connectInFlight){this.logger.log("[OnboardingSDK] Connection operation already in progress, ignoring...");return}try{await this.connectWithProgress()}catch(n){this.logger.log("[OnboardingSDK] Connection error handled in handleToggleConnection:",n)}}async disconnectAndMinimize(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.cleanup(),this.overlay.resetCursorState(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.isConnected=!1,this.agentState="idle",this._isMinimized=!0,this.botTranscript="",this.userTranscript="",this.renderReactUI(),this.logger.log("[OnboardingSDK] Disconnected and minimized"),this.emit("disconnected"),this.emit("minimized")}async connectWithProgress(){if(this.connectInFlight){this.logger.log("[OnboardingSDK] Connection already in progress, ignoring...");return}this.connectInFlight=!0;try{this.agentState="connecting",this._isMinimized=!1,this.setConnectionProgress("initializing","Initializing...",10),this.transport=new wn,this.setConnectionProgress("authenticating","Authenticating...",30),this.pipecatClient=new At({transport:this.transport,enableMic:this.textModeEnabled?!1:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),this.setupNavigationDetection(),this.pipecatClient=await this.initDevicesWithMicFallback(this.pipecatClient),this.setupAudioPlayback(),this.setConnectionProgress("connecting","Connecting to server...",50);const n=`${this.config.apiUrl}/sites/start-session`;this.logger.log("[OnboardingSDK] Starting session via floe-api proxy:",n);const r={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};this.config.userInfo&&(r.sessionData.userInfo=this.config.userInfo),this.setConnectionProgress("joining","Joining session...",70),await this.pipecatClient.startBotAndConnect({endpoint:n,requestData:r}),this.setConnectionProgress("ready","Connected!",100),setTimeout(()=>{this.clearConnectionProgress()},500)}catch(n){this.logger.error("[OnboardingSDK] Connection failed:",n),this.setConnectionProgress("error","Connection failed",0),this.agentState="idle",setTimeout(()=>{this.clearConnectionProgress(),this.renderReactUI()},3e3),this.emit("error",n)}finally{this.connectInFlight=!1}}createPipecatCallbacks(){return{onConnected:()=>{var n;this.logger.log("[OnboardingSDK] Connected to Pipecat"),this.isConnected=!0,this.agentState="listening",this.micEnabled=((n=this.pipecatClient)==null?void 0:n.isMicEnabled)??this.config.enableAudio!==!1,this.logger.log("[OnboardingSDK] 🎤 Mic state on connect:",this.micEnabled?"ON":"MUTED"),this.textModeEnabled&&this.pipecatClient&&(this.pipecatClient.enableMic(!1),this.micEnabled=!1,this.logger.log("[OnboardingSDK] ⌨️ Text mode active — mic muted on connect")),this.clearConnectionProgress(),this.renderReactUI(),this.emit("connected")},onDisconnected:()=>{this.logger.log("[OnboardingSDK] Disconnected from Pipecat"),this.isConnected=!1,this.agentState="idle",this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.cleanup(),this.overlay.resetCursorState(),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.logger.log("[OnboardingSDK] 🎤 Stopping user microphone stream"),this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.renderReactUI(),this.emit("disconnected")},onBotReady:()=>{var n;if(this.logger.log("[OnboardingSDK] Bot ready - transport is now in ready state"),this.domIntrospector.startCapturing(1500,r=>{const i=this.accessibleSnapshot.capture(r.captureReason);this.sendAccessibleSnapshot(i),this.sendDOMSnapshot(r)}),this.logger.log("[OnboardingSDK] DOM Introspection Layer started (with Accessible Snapshot)"),this.pageTracker.setDOMIntrospector(this.domIntrospector),this.pageTracker.start(),this.logger.log("[OnboardingSDK] PageTracker started"),this.config.clientKey){this.logger.log("[OnboardingSDK] Sending site initialization with client key");const r={clientKey:this.config.clientKey,origin:window.location.origin,userInfo:this.config.userInfo,textMode:this.textModeEnabled};this.pendingResumeSessionId&&(r.resumeSessionId=this.pendingResumeSessionId,this.logger.log(`[OnboardingSDK] Resuming session: ${this.pendingResumeSessionId}`),this.pendingResumeSessionId=null),(n=this.pipecatClient)==null||n.sendClientMessage("site_init",r)}this.emit("botReady"),this._pendingDiscoveryStart&&(this.logger.log("[OnboardingSDK] 🔍 Starting pending guided discovery"),this._pendingDiscoveryStart=!1,setTimeout(()=>{this.isConnected&&this.startGuidedDiscovery()},500))},onUserTranscript:n=>{this.logger.log("[OnboardingSDK] 🎤 User transcript:",n.text,n.final?"(final)":"(interim)"),n.text&&(this.userTranscript=n.text),n.final&&n.text&&(this.lastUserTranscript=n.text),this.emit("userTranscript",n),this.handleUserInput(n.text).catch(r=>{this.logger.warn("[OnboardingSDK] Context capture failed:",r==null?void 0:r.message)}),this.renderReactUI()},onBotTtsText:n=>{this.textModeEnabled||(this.logger.log("[OnboardingSDK] 🤖 Bot TTS text:",n.text),n.text&&(this.botTranscript&&!this.botTranscript.endsWith(" ")&&!n.text.startsWith(" ")&&(this.botTranscript+=" "),this.botTranscript+=n.text,this.renderReactUI()))},onBotLlmText:n=>{this.textModeEnabled&&n.text&&(this.botTranscript+=n.text,this.renderReactUI())},onBotLlmStarted:()=>{this.textModeEnabled&&(this.logger.log("[OnboardingSDK] 🤖 Bot LLM started (text mode)"),this.agentState="speaking",this.botTranscript="",this.renderReactUI())},onBotLlmStopped:()=>{this.textModeEnabled&&(this.logger.log("[OnboardingSDK] 🤖 Bot LLM stopped (text mode)"),this.agentState="listening",this.botTranscript&&(this.transcriptHistory.push({id:`assistant-${Date.now()}`,role:"assistant",content:this.botTranscript,timestamp:Date.now()}),this.pruneTranscriptHistory(),this.logger.log("[OnboardingSDK] 📝 Added assistant message to history (text mode):",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI())},onUserStartedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🎤 User started speaking"),this.agentState="listening",this.userIsSpeaking=!0,this.renderReactUI(),this.emit("userSpeaking",!0)},onUserStoppedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🛑 User stopped speaking"),this.agentState="thinking",this.userIsSpeaking=!1,this.lastUserTranscript&&(this.transcriptHistory.push({id:`user-${Date.now()}`,role:"user",content:this.lastUserTranscript,timestamp:Date.now()}),this.pruneTranscriptHistory(),this.logger.log("[OnboardingSDK] 📝 Added user message to history:",this.lastUserTranscript),this.lastUserTranscript=""),this.userTranscript="",this.renderReactUI(),this.emit("userSpeaking",!1)},onBotStartedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🔊 Bot started speaking"),this.agentState="speaking",this.botIsSpeaking=!0,this.userTranscript="",this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!0)},onBotStoppedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🔇 Bot stopped speaking"),this.agentState="listening",this.botIsSpeaking=!1,this.botTranscript&&(this.transcriptHistory.push({id:`assistant-${Date.now()}`,role:"assistant",content:this.botTranscript,timestamp:Date.now()}),this.pruneTranscriptHistory(),this.logger.log("[OnboardingSDK] 📝 Added assistant message to history:",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!1)},onServerMessage:n=>{this.logger.log("[OnboardingSDK] Server message:",n),this.handleServerMessage(n)},onError:n=>{this.logger.error("[OnboardingSDK] Error:",n),this.emit("error",n)}}}async resumeSession(n){this.logger.log(`[OnboardingSDK] Resuming session: ${n}`),this.pendingResumeSessionId=n,this.agentState="idle",this.logger.log("[OnboardingSDK] Forcing full reconnect for resume (bot pipeline was cancelled)"),this.isConnected&&await this.disconnect(),await new Promise(r=>setTimeout(r,100)),await this.init()}async stopSession(){this.logger.log("[OnboardingSDK] Stopping paused session"),this.agentState="idle",this.pausedSessionId=null,this.pendingResumeSessionId=null,this.isConnected&&await this.disconnect(),this.renderReactUI(),this.emit("sessionStopped")}async handleToggleScreenShare(){if(!this.pipecatClient){this.logger.warn("[OnboardingSDK] Cannot toggle screen share: client not initialized");return}try{this.screenShareEnabled?(this.logger.log("[OnboardingSDK] Stopping screen share"),await this.pipecatClient.enableScreenShare(!1),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1})):(this.logger.log("[OnboardingSDK] Starting screen share"),await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,this.sendMetadata({type:"screen_share_status",active:!0})),this.renderReactUI()}catch(n){this.logger.error("[OnboardingSDK] Failed to toggle screen share:",n),this.emit("error",n)}}sendMetadata(n){if(this.pipecatClient&&this.isConnected){const r=n.type||"metadata";this.logger.log(`[OnboardingSDK] Sending metadata: ${r}`,n),this.pipecatClient.sendClientMessage(r,n)}else this.logger.warn("[OnboardingSDK] Cannot send metadata - not connected")}sendDOMSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.2&&this.logger.log(`[OnboardingSDK] Sending DOM snapshot: ${n.totalElements} elements`),this.pipecatClient.sendClientMessage("dom_snapshot",{type:"dom_snapshot",...n}))}sendAccessibleSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.3&&(this.logger.log(`[OnboardingSDK] Sending accessible snapshot: ${n.elementCount} elements (reduced from DOM)`),this.config.debug&&this.logger.log("[OnboardingSDK] Accessible elements:",n.elements.slice(0,5).map(r=>`${r.ref}: ${r.role} "${r.name}"`).join(", "),n.elements.length>5?"...":"")),this.pipecatClient.sendClientMessage("accessible_snapshot",{type:"accessible_snapshot",...n}))}async handleUserInput(n){await this.extractIntent(n),this.config.enableScreenCapture&&await this.captureContext()}pruneTranscriptHistory(){const n=this.config.maxTranscriptMessages??m_;if(this.transcriptHistory.length<=n)return;const r=[];for(let i=0;i<this.transcriptHistory.length;i++){const o=this.transcriptHistory[i],s=r[r.length-1];s&&s.role===o.role&&o.timestamp-s.timestamp<S_?(s.content=s.content+" "+o.content,s.timestamp=o.timestamp):r.push({...o})}r.length>n?this.transcriptHistory=r.slice(-n):this.transcriptHistory=r}handleServerMessage(n){this.logger.isDebug&&this.logger.log("[OnboardingSDK] 📥 Server message received:",n);let r=n;if(n.data&&typeof n.data=="object"&&(this.logger.log("[OnboardingSDK] Unwrapping RTVIServerMessageFrame data"),r=n.data),r.type==="ui_action"&&r.action&&r.target){this.logger.log("[OnboardingSDK] 🎯 Received UI action from bot:",r.action),this.logger.isDebug&&this.logger.log("[OnboardingSDK] Target:",r.target),this.handleHybridAction({action:r.action,target:r.target,value:r.value,description:r.description,precondition:r.precondition});return}if(r.action&&r.target){this.logger.log("[OnboardingSDK] 🎯 Received direct hybrid action:",r.action),this.handleHybridAction(r);return}r.type==="highlight"?(this.logger.log("[OnboardingSDK] Handling highlight command"),r.target?this.overlay.highlightTarget(r.target,r.options):r.selector&&this.overlay.highlight(r.selector,r.options)):r.type==="tooltip"&&r.text?this.overlay.showTooltip(r.text,r.options):r.type==="action"?r.target?this.handleHybridAction(r):this.actionExecutor.executeWithConsent(r.action):r.type==="clear_highlight"?this.overlay.clearHighlight():r.type==="batched_navigation"?this.handleBatchedNavigation(r):r.type==="fast_action"?this.executeActionFast(r):r.type==="execute_api"||r.action==="execute_api"?this.handleExecuteApi(r):r.type==="session_paused"?(this.logger.log("[OnboardingSDK] Session paused:",r),this.agentState="paused",this.pausedSessionId=r.session_id||null,this.overlay.cleanup(),this.renderReactUI(),this.emit("sessionPaused",r)):r.type==="plan_progress"?(this.logger.log("[OnboardingSDK] Plan progress:",r),this.planProgress={planName:r.planName||"",currentStep:r.currentStep||0,totalSteps:r.totalSteps||0,progressPercent:r.progressPercent||0,currentTaskTitle:r.currentTaskTitle||""},this.renderReactUI(),this.emit("planProgress",this.planProgress)):r.type==="plan_started"?(this.logger.log("[OnboardingSDK] Plan started:",r),this.emit("planStarted",{planName:r.planName,totalSteps:r.totalSteps})):r.type==="plan_complete"?(this.logger.log("[OnboardingSDK] Plan complete:",r),this.planProgress=null,this.overlay.cleanup(),this.renderReactUI(),this.emit("planComplete",{planName:r.planName})):this.logger.log("[OnboardingSDK] Unhandled server message type:",r.type||"unknown")}async handleHybridAction(n){switch(this.logger.log("[OnboardingSDK] 🎯 Handling hybrid action:",n.action),this.logger.log("[OnboardingSDK] Target strategies:",n.target.strategy||"auto-detect"),this.logger.log("[OnboardingSDK] Target text:",n.target.text),this.logger.log("[OnboardingSDK] Target selector:",n.target.selector),this.logger.log("[OnboardingSDK] Target tag:",n.target.tag),n.action){case"highlight":this.logger.log("[OnboardingSDK] 💡 Executing HIGHLIGHT action"),this.overlay.highlightTarget(n.target,{color:"rgba(0, 170, 255, 0.7)",padding:10})?(this.logger.log("[OnboardingSDK] ✅ Element highlighted successfully"),n.description&&this.overlay.showTooltip(n.description,{}),this.emit("elementHighlighted",{target:n.target,description:n.description})):(this.logger.warn("[OnboardingSDK] ⚠️ Failed to find element for highlight"),setTimeout(()=>{this.overlay.highlightTarget(n.target,{color:"rgba(255, 193, 7, 0.7)",padding:10})?(this.logger.log("[OnboardingSDK] ✅ Element found on retry"),n.description&&this.overlay.showTooltip(n.description,{})):this.logger.error("[OnboardingSDK] ❌ Element not found even after retry:",n.target)},500));break;case"click":this.logger.log("[OnboardingSDK] 👆 Executing CLICK action with Floe cursor");const i=Dn();if(n.target.optionText){this.logger.log("[OnboardingSDK] 🎯 Dropdown option selection detected:",n.target.optionText),await this.handleDropdownOptionClick(n);break}let o=be.resolveTarget(n.target);if(!o){this.logger.warn("[OnboardingSDK] ⚠️ Click target not found"),this.overlay.cleanup(),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element not found",timestamp:Date.now()});break}be.scrollIntoView(o),setTimeout(async()=>{var f,v;const a=this.findCollapsedSidebar(o);if(a){this.logger.log("[OnboardingSDK] 🔍 Element is in collapsed sidebar, expanding first...");const b=a.getBoundingClientRect();await this.overlay.animateFloeCursorTo(b.left+b.width/2,b.top+b.height/3,400),a.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),a.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0})),await new Promise(g=>setTimeout(g,450)),this.logger.log("[OnboardingSDK] 📂 Sidebar expanded")}if(!await be.waitForPositionStability(o,800)){this.logger.error("[OnboardingSDK] ❌ Element disappeared during stability wait"),this.overlay.cleanup(),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element disappeared during animation",timestamp:Date.now()});return}const c=be.reResolveAndVerify(n.target,o);c?(o=c,this.logger.log("[OnboardingSDK] 🔄 Re-resolved element after stability wait")):this.logger.warn("[OnboardingSDK] ⚠️ Could not re-resolve element, using original"),await this.overlay.moveToElementAndClick(o),await new Promise(b=>setTimeout(b,150)),this._botActionDepth++;const d={...n,target:{text:n.target.text,selector:n.target.selector,selectorFallbacks:n.target.selectorFallbacks,tag:n.target.tag,ariaLabel:n.target.ariaLabel,placeholder:n.target.placeholder,role:n.target.role,strategy:(f=n.target.strategy)==null?void 0:f.filter(b=>b!=="boundingBox"&&b!=="domIndex")}};let h=!1;try{h=await this.actionExecutor.executeHybridAction(d,!1)}finally{this._botActionDepth--}if(h){this.logger.log("[OnboardingSDK] ✅ Click executed successfully");const b=(n.target.text||"").toLowerCase().trim(),g=((v=o==null?void 0:o.textContent)==null?void 0:v.toLowerCase().trim())||"",S=(o==null?void 0:o.tagName.toLowerCase())||"unknown";let m=!1,w="";b&&g&&!g.includes(b)&&!b.includes(g)&&(m=!0,w=`Expected "${n.target.text}", but clicked "${g.slice(0,50)}"`,this.logger.error(`[OnboardingSDK] ❌ CLICK MISMATCH: ${w}`)),this.domIntrospector&&(await new Promise(k=>setTimeout(k,150)),this.domIntrospector.captureAndSendImmediate("post-bot-click"),this.logger.log("[OnboardingSDK] 📸 DOM snapshot sent after bot click")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!m,target:n.target.text||n.target.selector||"unknown",actualClicked:m?g.slice(0,100):void 0,clickedTag:S,mismatch:m,mismatchDetails:w||void 0,previousUrl:i,currentUrl:Dn(),timestamp:Date.now()}),m?this.logger.warn("[OnboardingSDK] ⚠️ Click mismatch reported to server"):this.logger.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance")}else{const b=this.actionExecutor.lastError||"unknown";this.logger.warn("[OnboardingSDK] ⚠️ Click action failed:",b),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:b,timestamp:Date.now()})}await new Promise(b=>setTimeout(b,100)),setTimeout(()=>{this.overlay.cleanup()},800)},350);break;case"type":this.logger.log("[OnboardingSDK] ⌨️ Executing TYPE action, value:",n.value);const s=be.resolveTarget(n.target);s&&this.overlay.highlightResolvedElement(s,{color:"rgba(76, 175, 80, 0.6)",padding:4}),setTimeout(async()=>{await this.actionExecutor.executeHybridAction(n,!1),setTimeout(()=>this.overlay.clearHighlight(),1500)},300);break;case"focus":this.logger.log("[OnboardingSDK] 🎯 Executing FOCUS action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"hover":this.logger.log("[OnboardingSDK] 🖱️ Executing HOVER action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"scroll":this.logger.log("[OnboardingSDK] 📜 Executing SCROLL action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"multi_select":this.logger.log("[OnboardingSDK] 📋 Executing MULTI_SELECT action"),await this.handleMultiSelectAction(n);break;case"navigate":this.logger.log("[OnboardingSDK] 🧭 Executing NAVIGATE action to URL:",n.value),this.overlay.cleanup();{const a=n.value;if(!a){this.logger.warn("[OnboardingSDK] ⚠️ Navigate action missing URL"),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:"Missing target URL",timestamp:Date.now()});break}let l;try{const g=new URL(a,window.location.href);if(g.protocol!=="http:"&&g.protocol!=="https:"){this.logger.warn("[OnboardingSDK] ⚠️ Navigate blocked — disallowed scheme:",g.protocol),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:`Blocked: disallowed URL scheme "${g.protocol}"`,timestamp:Date.now()});break}if(g.origin!==window.location.origin){this.logger.warn("[OnboardingSDK] ⚠️ Navigate blocked — cross-origin URL:",g.origin),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:`Blocked: cross-origin navigation not allowed (${g.origin})`,timestamp:Date.now()});break}l=g.href}catch{this.logger.warn("[OnboardingSDK] ⚠️ Navigate blocked — invalid URL"),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:"Blocked: invalid URL",timestamp:Date.now()});break}const c=window.location.href,d=Date.now(),h={resolvedUrl:Ga(l),beforeUrl:Ga(c),timestamp:d};try{sessionStorage.setItem("floe_pending_navigation",JSON.stringify(h))}catch{}const f=()=>{const g={type:"bot_action_complete",action:"navigate",target:h.resolvedUrl,success:!0,previousUrl:h.beforeUrl,currentUrl:h.resolvedUrl,timestamp:d,beacon:!0};try{const S=this.config.apiUrl||"";S&&navigator.sendBeacon&&navigator.sendBeacon(`${S}/api/v1/events/beacon`,new Blob([JSON.stringify(g)],{type:"application/json"}))}catch{}};window.addEventListener("pagehide",f,{once:!0});let v=!1;try{const g=new URL(l).pathname+new URL(l).search+new URL(l).hash;history.pushState(null,"",g),window.dispatchEvent(new PopStateEvent("popstate",{state:null})),v=!0}catch{}v||(window.location.href=l);const b=await this.waitForNavigation(l,1e4);window.removeEventListener("pagehide",f);try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata({type:"bot_action_complete",action:"navigate",target:Ga(l),success:b,previousUrl:Ga(c),currentUrl:Dn(),...b?{}:{error:"Navigation timed out waiting for URL change"},timestamp:d})}break;case"check_precondition":this.logger.log("[OnboardingSDK] 🔍 Checking precondition"),await this.handleCheckPrecondition(n);break;default:this.logger.warn("[OnboardingSDK] ⚠️ Unknown hybrid action:",n.action)}}async waitForNavigation(n,r){const i=Date.now(),o=200,s=f=>f.length>1&&f.endsWith("/")?f.slice(0,-1):f;let a;try{a=new URL(n)}catch{return this.logger.warn("[OnboardingSDK] ⚠️ waitForNavigation: could not parse expectedUrl, using exact match"),new Promise(f=>{const v=()=>{if(window.location.href===n){f(!0);return}if(Date.now()-i>=r){f(!1);return}setTimeout(v,o)};v()})}const l=a.origin,c=s(a.pathname),d=a.search,h=a.hash;return new Promise(f=>{const v=()=>{const b=Date.now()-i;try{const g=new URL(window.location.href);if(g.origin===l&&s(g.pathname)===c&&(!d||g.search===d)&&(!h||g.hash===h)){this.logger.log(`[OnboardingSDK] ✅ Navigation completed to: ${window.location.href}`),f(!0);return}}catch{}if(b>=r){this.logger.warn(`[OnboardingSDK] ⏱️ Navigation timeout after ${r}ms. Current: ${window.location.href}, Expected: ${n}`),f(!1);return}setTimeout(v,o)};v()})}_finalizePendingNavigation(){let n;try{n=sessionStorage.getItem("floe_pending_navigation")}catch{return}if(!n)return;let r;try{if(r=JSON.parse(n),!r.resolvedUrl||!r.timestamp)return}catch{try{sessionStorage.removeItem("floe_pending_navigation")}catch{}return}if(Date.now()-r.timestamp>6e4){try{sessionStorage.removeItem("floe_pending_navigation")}catch{}return}const i=Dn(),o=i===r.resolvedUrl,s={type:"bot_action_complete",action:"navigate",target:r.resolvedUrl,success:o,previousUrl:r.beforeUrl,currentUrl:i,...o?{}:{error:"Full-page navigation did not reach expected URL"},timestamp:r.timestamp,finalized:!0};try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata(s),setTimeout(()=>{this.isConnected&&this.sendMetadata(s)},3e3),this.logger.log(`[OnboardingSDK] 🔄 Finalized pending navigation: ${r.resolvedUrl} (success=${o})`)}async handleCheckPrecondition(n){const r=n.precondition;if(!r){this.logger.warn("[OnboardingSDK] ⚠️ No precondition specified"),this.sendMetadata({type:"precondition_result",preconditionType:"unknown",optionText:"",result:!1,details:"No precondition specified in action",timestamp:Date.now()});return}const{type:i,optionText:o,selector:s}=r;let a=!1,l="";switch(i){case"option_exists":{if(!o){l="No optionText provided for option_exists";break}const c=this.findDropdownTrigger(n.target);if(c){this.logger.log("[OnboardingSDK] 🔍 Opening dropdown to check for option:",o),this._botActionDepth++;try{this.actionExecutor.openDropdown(c)}finally{this._botActionDepth--}await new Promise(h=>setTimeout(h,400)),a=!!this.findVisibleDropdownOption(o),a||(a=!!await this.scrollToDropdownOption(o)),l=a?`Option "${o}" found in dropdown`:`Option "${o}" NOT found in dropdown`,this._botActionDepth++;try{await new Promise(f=>setTimeout(f,100));const h=document.activeElement instanceof HTMLElement?document.activeElement:document.body;h&&h.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(f=>setTimeout(f,100)),document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight()}else l="Could not find dropdown trigger"}break;case"element_visible":{const c=s||n.target.selector;if(!c){l="No selector provided for element_visible";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_visible: "${c}"`;break}a=!!(d&&be.isVisible(d)),l=a?`Element "${c}" is visible`:`Element "${c}" is NOT visible or not found`}break;case"element_enabled":{const c=s||n.target.selector;if(!c){l="No selector provided for element_enabled";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_enabled: "${c}"`;break}d?(a=!(d.hasAttribute("disabled")||d.getAttribute("aria-disabled")==="true"||d.classList.contains("disabled")||d.disabled===!0),l=a?`Element "${c}" is enabled`:`Element "${c}" is disabled`):l=`Element "${c}" not found`}break;default:l=`Unknown precondition type: ${i}`}this.logger.log(`[OnboardingSDK] 🔍 Precondition check result: ${a} - ${l}`),this.sendMetadata({type:"precondition_result",preconditionType:i,optionText:o,result:a,details:l,timestamp:Date.now()})}async handleMultiSelectAction(n){const r=n.target.selectedValues||[];if(this.logger.log("[OnboardingSDK] 📋 handleMultiSelectAction for:",r),r.length===0){this.logger.warn("[OnboardingSDK] ⚠️ No values to select in multi_select action"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"No values provided for multi-select",timestamp:Date.now()});return}const i=this.findDropdownTrigger(n.target);if(!i){this.logger.error("[OnboardingSDK] ❌ Could not find dropdown trigger for multi-select"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Dropdown trigger not found",timestamp:Date.now()});return}be.scrollIntoView(i),await new Promise(l=>setTimeout(l,200)),await this.overlay.moveToElementAndClick(i),this.logger.log("[OnboardingSDK] 📂 Opening multi-select dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}await new Promise(l=>setTimeout(l,300));const o=[],s=[];for(let l=0;l<r.length;l++){const c=r[l];this.logger.log(`[OnboardingSDK] 📋 Selecting option ${l+1}/${r.length}: "${c}"`);let d=this.findVisibleDropdownOption(c);if(!d){this.logger.log("[OnboardingSDK] ⚠️ Option not visible, checking if dropdown closed..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}if(await new Promise(h=>setTimeout(h,300)),d=this.findVisibleDropdownOption(c),!d){const h=await this.scrollToDropdownOption(c);h&&(d=h)}}if(d)if(d.getAttribute("aria-selected")==="true"||d.classList.contains("selected")||d.closest('[aria-selected="true"]')!==null)o.push(c),this.logger.log(`[OnboardingSDK] ✅ Already selected: "${c}"`);else{this._botActionDepth++;try{const f=d.getBoundingClientRect(),v=f.left+f.width/2,b=f.top+f.height/2,g={bubbles:!0,cancelable:!0,view:window,clientX:v,clientY:b};d.dispatchEvent(new MouseEvent("mousedown",g)),d.dispatchEvent(new MouseEvent("mouseup",g)),d.dispatchEvent(new MouseEvent("click",g)),await new Promise(S=>setTimeout(S,200)),o.push(c),this.logger.log(`[OnboardingSDK] ✅ Selected: "${c}"`)}finally{this._botActionDepth--}}else s.push(c),this.logger.warn(`[OnboardingSDK] ⚠️ Option not found after retries: "${c}"`)}await new Promise(l=>setTimeout(l,200)),this._botActionDepth++;try{const l=document.activeElement instanceof HTMLElement?document.activeElement:document.body;l&&l.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(d=>setTimeout(d,100));const c=document.querySelector('[class*="backdrop"], [class*="overlay"], .MuiBackdrop-root');c&&c instanceof HTMLElement?c.click():document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight();const a=o.length>0;this.logger.log(`[OnboardingSDK] 📋 Multi-select complete: ${o.length} selected, ${s.length} failed`),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:a,target:n.target.text||n.target.selector||"unknown",selectedValues:o,failedValues:s,timestamp:Date.now()})}async handleDropdownOptionClick(n){const r=n.target.optionText;this.logger.log("[OnboardingSDK] 🎯 handleDropdownOptionClick for:",r);let i=this.findVisibleDropdownOption(r);if(i){this.logger.log("[OnboardingSDK] ✅ Option already visible, clicking directly"),await this.clickDropdownOption(i,n);return}const o=this.isDropdownCurrentlyOpen();this.logger.log("[OnboardingSDK] 🔍 Option not visible, dropdown already open:",o);const s=this.findDropdownTrigger(n.target);if(!s){this.logger.error("[OnboardingSDK] ❌ Could not find dropdown trigger"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:"Dropdown trigger not found",timestamp:Date.now()});return}if(o){this.logger.log("[OnboardingSDK] 📜 Dropdown open but option not visible — trying scroll first");const h=await this.scrollToDropdownOption(r);if(h){this.logger.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(h,n);return}}const a=this.findDropdownSearchInput(s);if(a){if(this.logger.log("[OnboardingSDK] ⌨️ Typing to filter dropdown:",r),i=await this.typeToFilterDropdown(a,r),i){this.logger.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}this.logger.log("[OnboardingSDK] ⚠️ Typing to filter did not reveal the option")}if(!o){be.scrollIntoView(s),await new Promise(v=>setTimeout(v,200)),await this.overlay.moveToElementAndClick(s),this.logger.log("[OnboardingSDK] 📂 Opening dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(s)}finally{this._botActionDepth--}if(await new Promise(v=>setTimeout(v,300)),i=this.findVisibleDropdownOption(r),i){this.logger.log("[OnboardingSDK] ✅ Option visible after opening dropdown"),await this.clickDropdownOption(i,n);return}const h=this.findDropdownSearchInput(s);if(h&&(this.logger.log("[OnboardingSDK] ⌨️ Typing to filter after opening dropdown:",r),i=await this.typeToFilterDropdown(h,r),i)){this.logger.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}const f=await this.scrollToDropdownOption(r);if(f){this.logger.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(f,n);return}}const l=1500,c=150;let d=0;for(;d<l;){if(i=this.findVisibleDropdownOption(r),i){this.logger.log("[OnboardingSDK] ✅ Option appeared after",d,"ms (final poll)");break}await new Promise(h=>setTimeout(h,c)),d+=c}if(!i){this.logger.error("[OnboardingSDK] ❌ All strategies failed for option:",r);const h=document.querySelectorAll('[role="option"], [class*="option"], nz-option-item, .ant-select-item-option'),f=Array.from(h).slice(0,10).map(v=>{var b;return(b=v.textContent)==null?void 0:b.trim().slice(0,50)}).filter(Boolean);f.length>0?this.logger.log("[OnboardingSDK] Available options:",f):this.logger.log("[OnboardingSDK] No options visible - dropdown may not have opened"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:`Option "${r}" not found in dropdown`,timestamp:Date.now()}),this.overlay.clearHighlight();return}await this.clickDropdownOption(i,n)}isDropdownCurrentlyOpen(){return s_(be.isVisible)}findDropdownSearchInput(n){return a_(n,be.isVisible)}async typeToFilterDropdown(n,r){return c_(n,r,be.isVisible)}findVisibleDropdownOption(n){return Bo(n,be.isVisible)}async scrollToDropdownOption(n){var o;const r=n.toLowerCase().trim();this.logger.log(`[OnboardingSDK] 🔍 Scrolling dropdown to find: "${n}"`);const i=["cdk-virtual-scroll-viewport",".cdk-virtual-scroll-viewport",'[role="listbox"]','[class*="-menu"] [class*="menu-list"]','[class*="options-container"]','[class*="virtual-list"]'];for(const s of i){let a;try{a=document.querySelectorAll(s)}catch{continue}for(const l of a){const c=l;if(!be.isVisible(c)||c.scrollHeight<=c.clientHeight+5)continue;const d=window.getComputedStyle(c).overflowY;if(d==="visible"||d==="hidden"){this.logger.log(`[OnboardingSDK] Skipping non-scrollable container (${s}), overflow-y: ${d}`);continue}this.logger.log(`[OnboardingSDK] Found scrollable container (${s}), scrollHeight: ${c.scrollHeight}, clientHeight: ${c.clientHeight}, overflow-y: ${d}`);const h=150,f=Math.ceil(c.scrollHeight/h)+2,v=c.scrollTop;for(let b=0;b<f;b++){c.scrollTop=b*h,await new Promise(m=>setTimeout(m,120));const S=c.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]), nz-option-item, .ant-select-item-option, .ant-select-item');for(const m of S){const w=m,k=w.getBoundingClientRect();if(k.height===0||k.width===0)continue;const C=((o=w.textContent)==null?void 0:o.trim().toLowerCase())||"";if(C===r||C.includes(r))return this.logger.log(`[OnboardingSDK] ✅ Found option after scrolling to position ${c.scrollTop}: "${n}"`),w.scrollIntoView({block:"center"}),await new Promise(M=>setTimeout(M,100)),w}}c.scrollTop=v}}return this.logger.log(`[OnboardingSDK] Option not found after scrolling: "${n}"`),null}isValidDropdownElement(n,r=!1){if(!n)return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is null"),!1;if(Mt(n))return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is inside SDK widget",{id:n.id,className:n.className,tagName:n.tagName}),!1;if(n.getAttribute("aria-hidden")==="true"||n.closest('[aria-hidden="true"]'))return this.logger.warn('[OnboardingSDK] ⚠️ Dropdown validation: element or ancestor has aria-hidden="true"',{id:n.id,className:n.className}),!1;const i=window.getComputedStyle(n);if(i.display==="none")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has display:none",{id:n.id,className:n.className}),!1;if(i.visibility==="hidden")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has visibility:hidden",{id:n.id,className:n.className}),!1;if(i.pointerEvents==="none")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has pointer-events:none",{id:n.id,className:n.className}),!1;if(i.opacity==="0")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has opacity:0",{id:n.id,className:n.className}),!1;const o=i.position;if(n.offsetParent===null&&o!=="fixed"&&o!=="sticky"){let a=n.parentElement,l=!1;for(;a;){const c=window.getComputedStyle(a);if(c.position==="fixed"||c.position==="sticky"){l=!0;break}a=a.parentElement}if(!l)return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has null offsetParent (not rendered)",{id:n.id,className:n.className}),!1}const s=n.getBoundingClientRect();return s.width<=0||s.height<=0?(this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has zero dimensions",{id:n.id,className:n.className,width:s.width,height:s.height}),!1):r&&!(n.closest('[role="combobox"]')!==null||n.closest('[aria-haspopup="listbox"]')!==null||n.closest('[aria-haspopup="true"]')!==null||n.closest('[class*="select"]')!==null||n.closest('[class*="Select"]')!==null||n.closest('[class*="dropdown"]')!==null||n.closest('[class*="Dropdown"]')!==null||n.closest("select")!==null)?(this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation (Strategy 5): element lacks dropdown-like ancestor",{id:n.id,className:n.className,tagName:n.tagName}),!1):!0}findDropdownTrigger(n){var o;if(n.dropdownTriggerSelector){this.logger.log("[OnboardingSDK] 🎯 Using dropdownTriggerSelector:",n.dropdownTriggerSelector);try{const s=Mv(n.dropdownTriggerSelector);if(s){const a=this.getClickableDropdownContainer(s);if(this.isValidDropdownElement(a))return this.logger.log("[OnboardingSDK] ✅ Found trigger via dropdownTriggerSelector"),a;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 1: dropdownTriggerSelector element failed validation")}}catch(s){this.logger.warn("[OnboardingSDK] Invalid dropdownTriggerSelector:",s)}}if(n.labelText){this.logger.log("[OnboardingSDK] 🔍 Finding dropdown by label:",n.labelText);const s=this.findDropdownByLabel(n.labelText);if(s)return this.logger.log("[OnboardingSDK] ✅ Found trigger via labelText"),s}const r=document.querySelector('input[role="combobox"]:focus');if(r){const s=this.getClickableDropdownContainer(r);if(this.isValidDropdownElement(s))return this.logger.log("[OnboardingSDK] ✅ Found focused combobox"),s;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 3: focused combobox failed validation")}const i=document.querySelector('input[role="combobox"][aria-expanded="true"]');if(i){const s=this.getClickableDropdownContainer(i);if(this.isValidDropdownElement(s))return this.logger.log("[OnboardingSDK] ✅ Found expanded combobox"),s;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 3: expanded combobox failed validation")}if(n.selector){const a=n.selector.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[role="option"\]/g,"").trim();if(a&&a!=="")try{const l=document.querySelector(a);if(l){const c=this.getClickableDropdownContainer(l);if(this.isValidDropdownElement(c))return this.logger.log("[OnboardingSDK] ✅ Found trigger via cleaned selector"),c;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 4: selector element failed validation")}}catch{this.logger.warn("[OnboardingSDK] Invalid selector:",a)}}if(n.text||n.optionText){const s=(n.text||n.optionText||"").toLowerCase(),a=['[class*="singleValue"]','[class*="single-value"]','[class*="select__single-value"]',".MuiSelect-select",'[class*="placeholder"]'];for(const l of a){const c=document.querySelectorAll(l);for(const d of c){const h=((o=d.textContent)==null?void 0:o.trim().toLowerCase())||"";if(h===s||h.includes(s)){const f=this.getClickableDropdownContainer(d);if(this.isValidDropdownElement(f,!0))return this.logger.log("[OnboardingSDK] ✅ Found trigger via display value match"),f;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 5: display value match element failed validation",{searchText:s,selector:l,elementText:h})}}}}return this.logger.warn("[OnboardingSDK] ❌ Could not find dropdown trigger"),null}findDropdownByLabel(n){var o;const r=n.toLowerCase().trim(),i=["label",'[class*="label"]','[class*="Label"]','[class*="form-label"]',".MuiFormLabel-root",".MuiInputLabel-root"];for(const s of i){const a=document.querySelectorAll(s);for(const l of a){const c=((o=l.textContent)==null?void 0:o.trim().toLowerCase().replace(/\*$/,"").trim())||"";if(c===r||c.includes(r)){const d=l;if(d.tagName==="LABEL"&&d.htmlFor){const v=document.getElementById(d.htmlFor);if(v)return this.getClickableDropdownContainer(v)}const h=d.id;if(h){const v=document.querySelector(`[aria-labelledby="${h}"]`);if(v)return this.getClickableDropdownContainer(v)}const f=d.closest('[class*="field"], [class*="form-group"], [class*="FormControl"]')||d.parentElement;if(f){const v=f.querySelector('input[role="combobox"], select, [aria-haspopup="listbox"], [class*="control"]');if(v)return this.getClickableDropdownContainer(v)}}}}return null}getClickableDropdownContainer(n){var i;return n.closest('[class*="-control"]')||n.closest('[class*="control"]')||n.closest('[class*="trigger"]')||n.closest("[aria-haspopup]")||((i=n.closest(".MuiSelect-select"))==null?void 0:i.parentElement)||n.closest('[class*="select"]')||n}async clickDropdownOption(n,r){var i;await this.overlay.moveToElementAndClick(n),await new Promise(o=>setTimeout(o,150)),this.logger.log("[OnboardingSDK] 👆 Clicking dropdown option:",(i=n.textContent)==null?void 0:i.trim()),this._botActionDepth++;try{if(this.actionExecutor.triggerReactOnClickPublic(n))this.logger.log("[OnboardingSDK] ✅ React onClick triggered for option");else{const s=n.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l};n.dispatchEvent(new MouseEvent("mousedown",c)),n.dispatchEvent(new MouseEvent("mouseup",c)),n.dispatchEvent(new MouseEvent("click",c))}}finally{this._botActionDepth--}this.logger.log("[OnboardingSDK] ✅ Dropdown option clicked successfully"),this.domIntrospector&&(await new Promise(o=>setTimeout(o,150)),this.domIntrospector.captureAndSendImmediate("post-dropdown-select"),this.logger.log("[OnboardingSDK] 📸 DOM snapshot sent after dropdown selection")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!0,target:r.target.optionText||r.target.text||"dropdown option",timestamp:Date.now()}),this.logger.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance"),await new Promise(o=>setTimeout(o,200)),setTimeout(()=>{this.overlay.cleanup()},600)}findCollapsedSidebar(n){let r=n.parentElement;for(;r&&r!==document.body;){const i=window.getComputedStyle(r),o=r.getBoundingClientRect().width,s=r.getBoundingClientRect().height,a=i.transition.includes("width")||i.transitionProperty.includes("width")||i.transitionProperty==="all",l=o<80,c=s>window.innerHeight*.5,d=typeof r.className=="string"?r.className:"",h=d.includes("sidebar")||d.includes("nav")||d.includes("menu"),f=d.includes("w-12")||d.includes("w-14")||d.includes("w-16");if(l&&c&&(a||h)||f)return this.logger.log("[OnboardingSDK] Detected collapsed sidebar:",{width:o,height:s,hasTransition:a,hasTailwindCollapsed:f,classes:r.className.substring(0,100)}),r;r=r.parentElement}return null}async executeActionFast(n){this.logger.log("[OnboardingSDK] ⚡ Fast executing action:",n.action);let r=be.resolveTarget(n.target);if(!r&&(await new Promise(o=>setTimeout(o,150)),r=be.resolveTarget(n.target),!r))return this.logger.warn("[OnboardingSDK] ⚠️ Fast action target not found"),!1;r.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(o=>setTimeout(o,50)),this.overlay.highlightResolvedElement(r,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(o=>setTimeout(o,80)),this._botActionDepth++;let i=!1;try{i=await this.actionExecutor.executeHybridAction(n,!1)}finally{this._botActionDepth--}return await new Promise(o=>setTimeout(o,50)),this.overlay.clearHighlight(),i}async handleExecuteApi(n){var v;this.logger.log("[OnboardingSDK] 🔌 Executing API call:",n.method,n.url);const{method:r="GET",url:i,base_url:o,body:s,query_params:a,success_indicator:l,result_extractor:c,error_message_path:d}=n;let h=i;if(o&&(h=`${o.replace(/\/$/,"")}/${i.replace(/^\//,"")}`),a&&r==="GET"){const b=new URLSearchParams(a);h=`${h}?${b.toString()}`}try{const b=new URL(h,window.location.href);if(b.origin!==window.location.origin){this.logger.error("[OnboardingSDK] ❌ Cross-origin API request blocked:",b.origin),this.sendMetadata({type:"api_execution_result",success:!1,error:`Cross-origin request blocked: ${b.origin} does not match ${window.location.origin}`,url:h,method:r,timestamp:Date.now()});return}}catch{this.logger.error("[OnboardingSDK] ❌ Invalid URL:",h),this.sendMetadata({type:"api_execution_result",success:!1,error:`Invalid URL: ${h}`,url:h,method:r,timestamp:Date.now()});return}if(!["GET","HEAD","POST","PUT","PATCH","DELETE"].includes(r.toUpperCase())){this.logger.error("[OnboardingSDK] ❌ HTTP method not allowed:",r),this.sendMetadata({type:"api_execution_result",success:!1,error:`HTTP method not allowed: ${r}`,url:h,method:r,timestamp:Date.now()});return}try{const b={method:r.toUpperCase(),headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"};s&&r!=="GET"&&(b.body=JSON.stringify(s)),this.logger.log("[OnboardingSDK] 📤 Making API request:",h);const g=await fetch(h,b);let S;const m=await g.text();try{S=JSON.parse(m)}catch{S={raw:m}}this.logger.log("[OnboardingSDK] 📥 API response:",g.status,S);const w=g.ok&&this.evaluateJsonPathCondition(S,l),k=this.extractJsonPath(S,c);let C;w||(C=this.extractJsonPath(S,d)||((v=S.error)==null?void 0:v.message)||S.message||`Request failed with status ${g.status}`),this.sendMetadata({type:"api_execution_result",success:w,status_code:g.status,data:S,result_text:k,error:C,url:h,method:r,timestamp:Date.now()}),this.logger.log(`[OnboardingSDK] ${w?"✅":"❌"} API execution ${w?"succeeded":"failed"}:`,k||C)}catch(b){this.logger.error("[OnboardingSDK] ❌ API execution error:",b),this.sendMetadata({type:"api_execution_result",success:!1,error:b instanceof Error?b.message:"Unknown error",url:h,method:r,timestamp:Date.now()})}}evaluateJsonPathCondition(n,r){if(!r)return!0;try{if(r.includes(" == ")){const[i,o]=r.split(" == "),s=this.extractJsonPath(n,i.trim()),a=o.trim().replace(/^["']|["']$/g,"");return String(s)===a}return!!this.extractJsonPath(n,r)}catch{return!0}}extractJsonPath(n,r){if(!r||!n)return;const o=r.replace(/^\$\.?/,"").split(".");let s=n;for(const a of o){if(s==null)return;s=s[a]}return s}async handleBatchedNavigation(n){if(this.logger.log("[OnboardingSDK] ⚡ Received batched navigation request"),!this.batchedActionExecutor){this.logger.error("[OnboardingSDK] BatchedActionExecutor not initialized");return}const r=(n.steps||[]).map(i=>{const o=i.target||i,a=o.text||o.selector||o.tag?{text:o.text,tag:o.tag,selector:o.selector,ariaLabel:o.aria_label||o.ariaLabel,role:o.role,labelText:o.label_text||o.labelText,selectorFallbacks:o.selector_fallbacks||o.selectorFallbacks}:void 0;return{action:i.action,target:a,condition:i.condition,waitMs:i.wait_ms||i.waitMs}});if(r.length===0){this.logger.warn("[OnboardingSDK] No steps in batched navigation request");return}this.fastExecutionMode=!0,this._botActionDepth++;try{this.logger.log("[OnboardingSDK] ⚡ Executing batched navigation with steps:",r.map(o=>{var s;return`${o.action}${(s=o.target)!=null&&s.text?` "${o.target.text}"`:""}`}).join(" → "));const i=await this.batchedActionExecutor.executeBatch({steps:r});this.domIntrospector&&(await new Promise(o=>setTimeout(o,200)),this.domIntrospector.captureAndSendImmediate("post-batched-navigation"),this.logger.log("[OnboardingSDK] 📸 DOM snapshot sent after batched navigation")),i.success?(this.logger.log("[OnboardingSDK] ✅ Batched navigation complete, sending success"),this.sendMetadata({type:"batched_navigation_complete",success:!0,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()})):(this.logger.log(`[OnboardingSDK] ❌ Batched navigation failed at step ${i.completedSteps+1}, sending failure`),this.sendMetadata({type:"batched_navigation_complete",success:!1,error:`Step ${i.completedSteps+1} failed - check console for details`,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()}))}finally{this.fastExecutionMode=!1,this._botActionDepth--}}startNavigationDetection(n){this.navigationCompleteDetector&&this.navigationCompleteDetector.start(r=>{this.logger.log("[OnboardingSDK] Navigation complete detected:",r),this.sendMetadata({type:"navigation_complete",url:r,timestamp:Date.now()}),n(r)})}stopNavigationDetection(){this.navigationCompleteDetector&&this.navigationCompleteDetector.stop()}isInFastMode(){return this.fastExecutionMode}async extractIntent(n){const r={"get started":"onboarding",help:"assistance","show me":"demonstration","how do":"tutorial",where:"navigation",what:"information"},i=n.toLowerCase();for(const[o,s]of Object.entries(r))if(i.includes(o))return s;return"unknown"}async captureContext(){const n=this.config.enableScreenCapture?await this.capture.captureWithRedaction():void 0,r=this.extractPageStructure();return{screenshot:n,url:Dn(),structure:r,timestamp:Date.now()}}extractPageStructure(){const n=[];return["button","a","input","select","textarea",'[role="button"]',"[onclick]"].forEach(i=>{document.querySelectorAll(i).forEach(o=>{const s=o.getBoundingClientRect(),a=s.width>0&&s.height>0&&s.top<window.innerHeight&&s.bottom>0;a&&n.push({selector:this.getSelector(o),type:o.tagName.toLowerCase(),text:(o.textContent||"").trim().substring(0,100),visible:a,position:s,attributes:this.getAttributes(o)})})}),{title:document.title,url:Dn(),elements:n,viewport:{width:window.innerWidth,height:window.innerHeight}}}getSelector(n){if(n.id)return`#${n.id}`;const r=[];let i=n;for(;i&&i!==document.body;){let o=i.tagName.toLowerCase();if(i.className){const s=Array.from(i.classList).slice(0,2).join(".");s&&(o+=`.${s}`)}r.unshift(o),i=i.parentElement}return r.join(" > ")}getAttributes(n){const r={};return["href","type","name","placeholder","aria-label","role"].forEach(o=>{const s=n.getAttribute(o);s&&(r[o]=s)}),r}async sendText(n){this.pipecatClient&&this.isConnected&&await this.pipecatClient.sendText(n)}toggleTextMode(){var n,r;this.textModeEnabled=!this.textModeEnabled,this.textModeEnabled?((n=this.pipecatClient)==null||n.enableMic(!1),this.micEnabled=!1,this.logger.log("[OnboardingSDK] ⌨️ Text mode enabled — mic muted")):((r=this.pipecatClient)==null||r.enableMic(!0),this.micEnabled=!0,this.micPermissionDenied=!1,this.logger.log("[OnboardingSDK] 🎤 Voice mode enabled — mic unmuted"),this.isConnected&&this.setupUserMicAnalysis()),this.pipecatClient&&this.isConnected&&this.pipecatClient.sendClientMessage("set_text_mode",{enabled:this.textModeEnabled});try{localStorage.setItem("floe_text_mode",String(this.textModeEnabled))}catch{}this.renderReactUI()}async sendTextMessage(n){n.trim()&&(this.transcriptHistory.push({id:`user-${Date.now()}`,role:"user",content:n.trim(),timestamp:Date.now()}),this.pruneTranscriptHistory(),this.renderReactUI(),this.pipecatClient&&this.isConnected&&this.pipecatClient.sendClientMessage("text_message",{text:n.trim(),audio_response:!this.textModeEnabled}))}toggleMute(){if(this.pipecatClient){const r=!this.pipecatClient.isMicEnabled;return this.pipecatClient.enableMic(r),this.micEnabled=r,this.logger.log("[OnboardingSDK] 🎤 Mic toggled:",r?"ON":"MUTED"),this.renderReactUI(),r}return!1}highlight(n,r){this.overlay.highlight(n,r)}clearHighlight(){this.overlay.clearHighlight()}showTooltip(n,r){this.overlay.showTooltip(n,r)}hideTooltip(){this.overlay.hideTooltip()}async executeAction(n){return this.actionExecutor.executeWithConsent(n)}async takeScreenshot(n){return this.capture.captureWithRedaction(n)}getSessionId(){return this.sessionId}getStatus(){return{initialized:this.isInitialized,connected:this.isConnected,sessionId:this.sessionId,microphoneMuted:this.pipecatClient?!this.pipecatClient.isMicEnabled:!1}}startGuidedDiscovery(){return!this.pipecatClient||!this.isConnected?(this.logger.warn("[OnboardingSDK] Cannot start discovery - not connected"),!1):(this.logger.log("[OnboardingSDK] 🔍 Starting guided discovery mode"),this.pipecatClient.sendClientMessage("start_discovery",{type:"start_discovery",timestamp:Date.now()}),this.hideWelcomePopup(),!0)}skipDiscovery(){this.logger.log("[OnboardingSDK] Skipping discovery - standard greeting flow"),this.hideWelcomePopup()}showWelcomePopupAsync(){return new Promise(n=>{if(document.getElementById("floe-welcome-popup")){n(!1);return}const r=document.createElement("div");r.id="floe-welcome-popup",r.setAttribute("data-floe-widget","true"),r.style.cssText=`
828
+ `,document.body.appendChild(this.reactContainer),this.reactRoot=mc.createRoot(this.reactContainer),this.renderReactUI()}renderReactUI(){var n,r,i;this.reactRoot&&this.reactRoot.render(ug.createElement(Qx,{connected:this.isConnected,voiceEnabled:this.micEnabled,agentState:this.agentState,botTranscript:this.botTranscript,userTranscript:this.userTranscript,transcriptHistory:[...this.transcriptHistory],screenShareEnabled:this.screenShareEnabled,userIsSpeaking:this.userIsSpeaking,botIsSpeaking:this.botIsSpeaking,audioLevels:[...this.audioLevels],onToggleConnection:()=>this.handleToggleConnection(),onToggleMute:()=>this.toggleMute(),onToggleScreenShare:()=>this.handleToggleScreenShare(),onResume:this.pausedSessionId?()=>this.resumeSession(this.pausedSessionId):void 0,pausedSessionId:this.pausedSessionId||void 0,onStop:this.agentState==="paused"?()=>this.stopSession():void 0,connectionProgress:this.connectionProgress||void 0,isReturningUser:this.isReturningUser,hasSkippedOnboarding:this.hasSkippedOnboarding,onMinimize:()=>this.handleMinimize(),onExpand:()=>this.handleExpand(),textModeEnabled:this.textModeEnabled,micPermissionDenied:this.micPermissionDenied,onToggleTextMode:()=>this.toggleTextMode(),onSendText:o=>this.sendTextMessage(o),nudgeText:(n=this.config.nudge)==null?void 0:n.text,nudgeAutoHideDelay:(r=this.config.nudge)==null?void 0:r.autoHideDelay,nudgeAutoShow:(i=this.config.nudge)==null?void 0:i.autoShow,planProgress:this.planProgress||void 0}))}handleMinimize(){this._isMinimized=!0,this.logger.log("[OnboardingSDK] UI minimized"),this.renderReactUI(),this.emit("minimized")}handleExpand(){this._isMinimized=!1,this.logger.log("[OnboardingSDK] UI expanded"),this.renderReactUI(),this.emit("expanded")}setConnectionProgress(n,r,i){this.connectionProgress={stage:n,message:r,progress:i},this.renderReactUI()}clearConnectionProgress(){this.connectionProgress=null,this.renderReactUI()}async handleToggleConnection(){if(this.isConnected){this.logger.log("[OnboardingSDK] Disconnecting and minimizing...");try{await this.disconnectAndMinimize()}catch(n){this.logger.error("[OnboardingSDK] Error during disconnect and minimize:",n),this.emit("error",n)}return}if(this.connectInFlight){this.logger.log("[OnboardingSDK] Connection operation already in progress, ignoring...");return}try{await this.connectWithProgress()}catch(n){this.logger.log("[OnboardingSDK] Connection error handled in handleToggleConnection:",n)}}async disconnectAndMinimize(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.cleanup(),this.overlay.resetCursorState(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.isConnected=!1,this.agentState="idle",this._isMinimized=!0,this.botTranscript="",this.userTranscript="",this.renderReactUI(),this.logger.log("[OnboardingSDK] Disconnected and minimized"),this.emit("disconnected"),this.emit("minimized")}async connectWithProgress(){if(this.connectInFlight){this.logger.log("[OnboardingSDK] Connection already in progress, ignoring...");return}this.connectInFlight=!0;try{this.agentState="connecting",this._isMinimized=!1,this.setConnectionProgress("initializing","Initializing...",10),this.transport=new Sn,this.setConnectionProgress("authenticating","Authenticating...",30),this.pipecatClient=new At({transport:this.transport,enableMic:this.textModeEnabled?!1:this.config.enableAudio!==!1,enableCam:this.config.enableVideo||!1,enableScreenShare:this.config.enableScreenCapture||!1,callbacks:this.createPipecatCallbacks()}),this.config.debug||this.pipecatClient.setLogLevel(Ut.WARN),this.setupNavigationDetection(),this.pipecatClient=await this.initDevicesWithMicFallback(this.pipecatClient),this.setupAudioPlayback(),this.setConnectionProgress("connecting","Connecting to server...",50);const n=`${this.config.apiUrl}/sites/start-session`;this.logger.log("[OnboardingSDK] Starting session via floe-api proxy:",n);const r={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};this.config.userInfo&&(r.sessionData.userInfo=this.config.userInfo),this.setConnectionProgress("joining","Joining session...",70),await this.pipecatClient.startBotAndConnect({endpoint:n,requestData:r}),this.setConnectionProgress("ready","Connected!",100),setTimeout(()=>{this.clearConnectionProgress()},500)}catch(n){this.logger.error("[OnboardingSDK] Connection failed:",n),this.setConnectionProgress("error","Connection failed",0),this.agentState="idle",setTimeout(()=>{this.clearConnectionProgress(),this.renderReactUI()},3e3),this.emit("error",n)}finally{this.connectInFlight=!1}}createPipecatCallbacks(){return{onConnected:()=>{var n;this.logger.log("[OnboardingSDK] Connected to Pipecat"),this.isConnected=!0,this.agentState="listening",this.micEnabled=((n=this.pipecatClient)==null?void 0:n.isMicEnabled)??this.config.enableAudio!==!1,this.logger.log("[OnboardingSDK] 🎤 Mic state on connect:",this.micEnabled?"ON":"MUTED"),this.textModeEnabled&&this.pipecatClient&&(this.pipecatClient.enableMic(!1),this.micEnabled=!1,this.logger.log("[OnboardingSDK] ⌨️ Text mode active — mic muted on connect")),this.clearConnectionProgress(),this.renderReactUI(),this.emit("connected")},onDisconnected:()=>{this.logger.log("[OnboardingSDK] Disconnected from Pipecat"),this.isConnected=!1,this.agentState="idle",this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.cleanup(),this.overlay.resetCursorState(),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.logger.log("[OnboardingSDK] 🎤 Stopping user microphone stream"),this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.renderReactUI(),this.emit("disconnected")},onBotReady:()=>{var n;if(this.logger.log("[OnboardingSDK] Bot ready - transport is now in ready state"),this.domIntrospector.startCapturing(1500,r=>{const i=this.accessibleSnapshot.capture(r.captureReason);this.sendAccessibleSnapshot(i),this.sendDOMSnapshot(r)}),this.logger.log("[OnboardingSDK] DOM Introspection Layer started (with Accessible Snapshot)"),this.pageTracker.setDOMIntrospector(this.domIntrospector),this.pageTracker.start(),this.logger.log("[OnboardingSDK] PageTracker started"),this.config.clientKey){this.logger.log("[OnboardingSDK] Sending site initialization with client key");const r={clientKey:this.config.clientKey,origin:window.location.origin,userInfo:this.config.userInfo,textMode:this.textModeEnabled};this.pendingResumeSessionId&&(r.resumeSessionId=this.pendingResumeSessionId,this.logger.log(`[OnboardingSDK] Resuming session: ${this.pendingResumeSessionId}`),this.pendingResumeSessionId=null),(n=this.pipecatClient)==null||n.sendClientMessage("site_init",r)}this.emit("botReady"),this._pendingDiscoveryStart&&(this.logger.log("[OnboardingSDK] 🔍 Starting pending guided discovery"),this._pendingDiscoveryStart=!1,setTimeout(()=>{this.isConnected&&this.startGuidedDiscovery()},500))},onUserTranscript:n=>{this.logger.log("[OnboardingSDK] 🎤 User transcript:",n.text,n.final?"(final)":"(interim)"),n.text&&(this.userTranscript=n.text),n.final&&n.text&&(this.lastUserTranscript=n.text),this.emit("userTranscript",n),this.handleUserInput(n.text).catch(r=>{this.logger.warn("[OnboardingSDK] Context capture failed:",r==null?void 0:r.message)}),this.renderReactUI()},onBotTtsText:n=>{this.textModeEnabled||(this.logger.log("[OnboardingSDK] 🤖 Bot TTS text:",n.text),n.text&&(this.botTranscript&&!this.botTranscript.endsWith(" ")&&!n.text.startsWith(" ")&&(this.botTranscript+=" "),this.botTranscript+=n.text,this.renderReactUI()))},onBotLlmText:n=>{this.textModeEnabled&&n.text&&(this.botTranscript+=n.text,this.renderReactUI())},onBotLlmStarted:()=>{this.textModeEnabled&&(this.logger.log("[OnboardingSDK] 🤖 Bot LLM started (text mode)"),this.agentState="speaking",this.botTranscript="",this.renderReactUI())},onBotLlmStopped:()=>{this.textModeEnabled&&(this.logger.log("[OnboardingSDK] 🤖 Bot LLM stopped (text mode)"),this.agentState="listening",this.botTranscript&&(this.transcriptHistory.push({id:`assistant-${Date.now()}`,role:"assistant",content:this.botTranscript,timestamp:Date.now()}),this.pruneTranscriptHistory(),this.logger.log("[OnboardingSDK] 📝 Added assistant message to history (text mode):",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI())},onUserStartedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🎤 User started speaking"),this.agentState="listening",this.userIsSpeaking=!0,this.renderReactUI(),this.emit("userSpeaking",!0)},onUserStoppedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🛑 User stopped speaking"),this.agentState="thinking",this.userIsSpeaking=!1,this.lastUserTranscript&&(this.transcriptHistory.push({id:`user-${Date.now()}`,role:"user",content:this.lastUserTranscript,timestamp:Date.now()}),this.pruneTranscriptHistory(),this.logger.log("[OnboardingSDK] 📝 Added user message to history:",this.lastUserTranscript),this.lastUserTranscript=""),this.userTranscript="",this.renderReactUI(),this.emit("userSpeaking",!1)},onBotStartedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🔊 Bot started speaking"),this.agentState="speaking",this.botIsSpeaking=!0,this.userTranscript="",this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!0)},onBotStoppedSpeaking:()=>{this.logger.log("[OnboardingSDK] 🔇 Bot stopped speaking"),this.agentState="listening",this.botIsSpeaking=!1,this.botTranscript&&(this.transcriptHistory.push({id:`assistant-${Date.now()}`,role:"assistant",content:this.botTranscript,timestamp:Date.now()}),this.pruneTranscriptHistory(),this.logger.log("[OnboardingSDK] 📝 Added assistant message to history:",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!1)},onServerMessage:n=>{this.logger.log("[OnboardingSDK] Server message:",n),this.handleServerMessage(n)},onError:n=>{this.logger.error("[OnboardingSDK] Error:",n),this.emit("error",n)}}}async resumeSession(n){this.logger.log(`[OnboardingSDK] Resuming session: ${n}`),this.pendingResumeSessionId=n,this.agentState="idle",this.logger.log("[OnboardingSDK] Forcing full reconnect for resume (bot pipeline was cancelled)"),this.isConnected&&await this.disconnect(),await new Promise(r=>setTimeout(r,100)),await this.init()}async stopSession(){this.logger.log("[OnboardingSDK] Stopping paused session"),this.agentState="idle",this.pausedSessionId=null,this.pendingResumeSessionId=null,this.isConnected&&await this.disconnect(),this.renderReactUI(),this.emit("sessionStopped")}async handleToggleScreenShare(){if(!this.pipecatClient){this.logger.warn("[OnboardingSDK] Cannot toggle screen share: client not initialized");return}try{this.screenShareEnabled?(this.logger.log("[OnboardingSDK] Stopping screen share"),await this.pipecatClient.enableScreenShare(!1),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1})):(this.logger.log("[OnboardingSDK] Starting screen share"),await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,this.sendMetadata({type:"screen_share_status",active:!0})),this.renderReactUI()}catch(n){this.logger.error("[OnboardingSDK] Failed to toggle screen share:",n),this.emit("error",n)}}sendMetadata(n){if(this.pipecatClient&&this.isConnected){const r=n.type||"metadata";this.logger.log(`[OnboardingSDK] Sending metadata: ${r}`,n),this.pipecatClient.sendClientMessage(r,n)}else this.logger.warn("[OnboardingSDK] Cannot send metadata - not connected")}sendDOMSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.2&&this.logger.log(`[OnboardingSDK] Sending DOM snapshot: ${n.totalElements} elements`),this.pipecatClient.sendClientMessage("dom_snapshot",{type:"dom_snapshot",...n}))}sendAccessibleSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.3&&(this.logger.log(`[OnboardingSDK] Sending accessible snapshot: ${n.elementCount} elements (reduced from DOM)`),this.config.debug&&this.logger.log("[OnboardingSDK] Accessible elements:",n.elements.slice(0,5).map(r=>`${r.ref}: ${r.role} "${r.name}"`).join(", "),n.elements.length>5?"...":"")),this.pipecatClient.sendClientMessage("accessible_snapshot",{type:"accessible_snapshot",...n}))}async handleUserInput(n){await this.extractIntent(n),this.config.enableScreenCapture&&await this.captureContext()}pruneTranscriptHistory(){const n=this.config.maxTranscriptMessages??m_;if(this.transcriptHistory.length<=n)return;const r=[];for(let i=0;i<this.transcriptHistory.length;i++){const o=this.transcriptHistory[i],s=r[r.length-1];s&&s.role===o.role&&o.timestamp-s.timestamp<S_?(s.content=s.content+" "+o.content,s.timestamp=o.timestamp):r.push({...o})}r.length>n?this.transcriptHistory=r.slice(-n):this.transcriptHistory=r}handleServerMessage(n){this.logger.isDebug&&this.logger.log("[OnboardingSDK] 📥 Server message received:",n);let r=n;if(n.data&&typeof n.data=="object"&&(this.logger.log("[OnboardingSDK] Unwrapping RTVIServerMessageFrame data"),r=n.data),r.type==="ui_action"&&r.action&&r.target){this.logger.log("[OnboardingSDK] 🎯 Received UI action from bot:",r.action),this.logger.isDebug&&this.logger.log("[OnboardingSDK] Target:",r.target),this.handleHybridAction({action:r.action,target:r.target,value:r.value,description:r.description,precondition:r.precondition});return}if(r.action&&r.target){this.logger.log("[OnboardingSDK] 🎯 Received direct hybrid action:",r.action),this.handleHybridAction(r);return}r.type==="highlight"?(this.logger.log("[OnboardingSDK] Handling highlight command"),r.target?this.overlay.highlightTarget(r.target,r.options):r.selector&&this.overlay.highlight(r.selector,r.options)):r.type==="tooltip"&&r.text?this.overlay.showTooltip(r.text,r.options):r.type==="action"?r.target?this.handleHybridAction(r):this.actionExecutor.executeWithConsent(r.action):r.type==="clear_highlight"?this.overlay.clearHighlight():r.type==="batched_navigation"?this.handleBatchedNavigation(r):r.type==="fast_action"?this.executeActionFast(r):r.type==="execute_api"||r.action==="execute_api"?this.handleExecuteApi(r):r.type==="session_paused"?(this.logger.log("[OnboardingSDK] Session paused:",r),this.agentState="paused",this.pausedSessionId=r.session_id||null,this.overlay.cleanup(),this.renderReactUI(),this.emit("sessionPaused",r)):r.type==="plan_progress"?(this.logger.log("[OnboardingSDK] Plan progress:",r),this.planProgress={planName:r.planName||"",currentStep:r.currentStep||0,totalSteps:r.totalSteps||0,progressPercent:r.progressPercent||0,currentTaskTitle:r.currentTaskTitle||""},this.renderReactUI(),this.emit("planProgress",this.planProgress)):r.type==="plan_started"?(this.logger.log("[OnboardingSDK] Plan started:",r),this.emit("planStarted",{planName:r.planName,totalSteps:r.totalSteps})):r.type==="plan_complete"?(this.logger.log("[OnboardingSDK] Plan complete:",r),this.planProgress=null,this.overlay.cleanup(),this.renderReactUI(),this.emit("planComplete",{planName:r.planName})):this.logger.log("[OnboardingSDK] Unhandled server message type:",r.type||"unknown")}async handleHybridAction(n){switch(this.logger.log("[OnboardingSDK] 🎯 Handling hybrid action:",n.action),this.logger.log("[OnboardingSDK] Target strategies:",n.target.strategy||"auto-detect"),this.logger.log("[OnboardingSDK] Target text:",n.target.text),this.logger.log("[OnboardingSDK] Target selector:",n.target.selector),this.logger.log("[OnboardingSDK] Target tag:",n.target.tag),n.action){case"highlight":this.logger.log("[OnboardingSDK] 💡 Executing HIGHLIGHT action"),this.overlay.highlightTarget(n.target,{color:"rgba(0, 170, 255, 0.7)",padding:10})?(this.logger.log("[OnboardingSDK] ✅ Element highlighted successfully"),n.description&&this.overlay.showTooltip(n.description,{}),this.emit("elementHighlighted",{target:n.target,description:n.description})):(this.logger.warn("[OnboardingSDK] ⚠️ Failed to find element for highlight"),setTimeout(()=>{this.overlay.highlightTarget(n.target,{color:"rgba(255, 193, 7, 0.7)",padding:10})?(this.logger.log("[OnboardingSDK] ✅ Element found on retry"),n.description&&this.overlay.showTooltip(n.description,{})):this.logger.error("[OnboardingSDK] ❌ Element not found even after retry:",n.target)},500));break;case"click":this.logger.log("[OnboardingSDK] 👆 Executing CLICK action with Floe cursor");const i=Ln();if(n.target.optionText){this.logger.log("[OnboardingSDK] 🎯 Dropdown option selection detected:",n.target.optionText),await this.handleDropdownOptionClick(n);break}let o=be.resolveTarget(n.target);if(!o){this.logger.warn("[OnboardingSDK] ⚠️ Click target not found"),this.overlay.cleanup(),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element not found",timestamp:Date.now()});break}be.scrollIntoView(o),setTimeout(async()=>{var f,g;const a=this.findCollapsedSidebar(o);if(a){this.logger.log("[OnboardingSDK] 🔍 Element is in collapsed sidebar, expanding first...");const y=a.getBoundingClientRect();await this.overlay.animateFloeCursorTo(y.left+y.width/2,y.top+y.height/3,400),a.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0})),a.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0})),await new Promise(m=>setTimeout(m,450)),this.logger.log("[OnboardingSDK] 📂 Sidebar expanded")}if(!await be.waitForPositionStability(o,800)){this.logger.error("[OnboardingSDK] ❌ Element disappeared during stability wait"),this.overlay.cleanup(),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Element disappeared during animation",timestamp:Date.now()});return}const c=be.reResolveAndVerify(n.target,o);c?(o=c,this.logger.log("[OnboardingSDK] 🔄 Re-resolved element after stability wait")):this.logger.warn("[OnboardingSDK] ⚠️ Could not re-resolve element, using original"),await this.overlay.moveToElementAndClick(o),await new Promise(y=>setTimeout(y,150)),this._botActionDepth++;const d={...n,target:{text:n.target.text,selector:n.target.selector,selectorFallbacks:n.target.selectorFallbacks,tag:n.target.tag,ariaLabel:n.target.ariaLabel,placeholder:n.target.placeholder,role:n.target.role,strategy:(f=n.target.strategy)==null?void 0:f.filter(y=>y!=="boundingBox"&&y!=="domIndex")}};let h=!1;try{h=await this.actionExecutor.executeHybridAction(d,!1)}finally{this._botActionDepth--}if(h){this.logger.log("[OnboardingSDK] ✅ Click executed successfully");const y=(n.target.text||"").toLowerCase().trim(),m=((g=o==null?void 0:o.textContent)==null?void 0:g.toLowerCase().trim())||"",S=(o==null?void 0:o.tagName.toLowerCase())||"unknown";let v=!1,w="";y&&m&&!m.includes(y)&&!y.includes(m)&&(v=!0,w=`Expected "${n.target.text}", but clicked "${m.slice(0,50)}"`,this.logger.error(`[OnboardingSDK] ❌ CLICK MISMATCH: ${w}`)),this.domIntrospector&&(await new Promise(k=>setTimeout(k,150)),this.domIntrospector.captureAndSendImmediate("post-bot-click"),this.logger.log("[OnboardingSDK] 📸 DOM snapshot sent after bot click")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!v,target:n.target.text||n.target.selector||"unknown",actualClicked:v?m.slice(0,100):void 0,clickedTag:S,mismatch:v,mismatchDetails:w||void 0,previousUrl:i,currentUrl:Ln(),timestamp:Date.now()}),v?this.logger.warn("[OnboardingSDK] ⚠️ Click mismatch reported to server"):this.logger.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance")}else{const y=this.actionExecutor.lastError||"unknown";this.logger.warn("[OnboardingSDK] ⚠️ Click action failed:",y),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:n.target.text||n.target.selector||"unknown",error:y,timestamp:Date.now()})}await new Promise(y=>setTimeout(y,100)),setTimeout(()=>{this.overlay.cleanup()},800)},350);break;case"type":this.logger.log("[OnboardingSDK] ⌨️ Executing TYPE action, value:",n.value);const s=be.resolveTarget(n.target);s&&this.overlay.highlightResolvedElement(s,{color:"rgba(76, 175, 80, 0.6)",padding:4}),setTimeout(async()=>{await this.actionExecutor.executeHybridAction(n,!1),setTimeout(()=>this.overlay.clearHighlight(),1500)},300);break;case"focus":this.logger.log("[OnboardingSDK] 🎯 Executing FOCUS action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"hover":this.logger.log("[OnboardingSDK] 🖱️ Executing HOVER action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"scroll":this.logger.log("[OnboardingSDK] 📜 Executing SCROLL action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"multi_select":this.logger.log("[OnboardingSDK] 📋 Executing MULTI_SELECT action"),await this.handleMultiSelectAction(n);break;case"navigate":this.logger.log("[OnboardingSDK] 🧭 Executing NAVIGATE action to URL:",n.value),this.overlay.cleanup();{const a=n.value;if(!a){this.logger.warn("[OnboardingSDK] ⚠️ Navigate action missing URL"),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:"Missing target URL",timestamp:Date.now()});break}let l;try{const m=new URL(a,window.location.href);if(m.protocol!=="http:"&&m.protocol!=="https:"){this.logger.warn("[OnboardingSDK] ⚠️ Navigate blocked — disallowed scheme:",m.protocol),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:`Blocked: disallowed URL scheme "${m.protocol}"`,timestamp:Date.now()});break}if(m.origin!==window.location.origin){this.logger.warn("[OnboardingSDK] ⚠️ Navigate blocked — cross-origin URL:",m.origin),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:`Blocked: cross-origin navigation not allowed (${m.origin})`,timestamp:Date.now()});break}l=m.href}catch{this.logger.warn("[OnboardingSDK] ⚠️ Navigate blocked — invalid URL"),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:"Blocked: invalid URL",timestamp:Date.now()});break}const c=window.location.href,d=Date.now(),h={resolvedUrl:Ga(l),beforeUrl:Ga(c),timestamp:d};try{sessionStorage.setItem("floe_pending_navigation",JSON.stringify(h))}catch{}const f=()=>{const m={type:"bot_action_complete",action:"navigate",target:h.resolvedUrl,success:!0,previousUrl:h.beforeUrl,currentUrl:h.resolvedUrl,timestamp:d,beacon:!0};try{const S=this.config.apiUrl||"";S&&navigator.sendBeacon&&navigator.sendBeacon(`${S}/api/v1/events/beacon`,new Blob([JSON.stringify(m)],{type:"application/json"}))}catch{}};window.addEventListener("pagehide",f,{once:!0});let g=!1;try{const m=new URL(l).pathname+new URL(l).search+new URL(l).hash;history.pushState(null,"",m),window.dispatchEvent(new PopStateEvent("popstate",{state:null})),g=!0}catch{}g||(window.location.href=l);const y=await this.waitForNavigation(l,1e4);window.removeEventListener("pagehide",f);try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata({type:"bot_action_complete",action:"navigate",target:Ga(l),success:y,previousUrl:Ga(c),currentUrl:Ln(),...y?{}:{error:"Navigation timed out waiting for URL change"},timestamp:d})}break;case"check_precondition":this.logger.log("[OnboardingSDK] 🔍 Checking precondition"),await this.handleCheckPrecondition(n);break;default:this.logger.warn("[OnboardingSDK] ⚠️ Unknown hybrid action:",n.action)}}async waitForNavigation(n,r){const i=Date.now(),o=200,s=f=>f.length>1&&f.endsWith("/")?f.slice(0,-1):f;let a;try{a=new URL(n)}catch{return this.logger.warn("[OnboardingSDK] ⚠️ waitForNavigation: could not parse expectedUrl, using exact match"),new Promise(f=>{const g=()=>{if(window.location.href===n){f(!0);return}if(Date.now()-i>=r){f(!1);return}setTimeout(g,o)};g()})}const l=a.origin,c=s(a.pathname),d=a.search,h=a.hash;return new Promise(f=>{const g=()=>{const y=Date.now()-i;try{const m=new URL(window.location.href);if(m.origin===l&&s(m.pathname)===c&&(!d||m.search===d)&&(!h||m.hash===h)){this.logger.log(`[OnboardingSDK] ✅ Navigation completed to: ${window.location.href}`),f(!0);return}}catch{}if(y>=r){this.logger.warn(`[OnboardingSDK] ⏱️ Navigation timeout after ${r}ms. Current: ${window.location.href}, Expected: ${n}`),f(!1);return}setTimeout(g,o)};g()})}_finalizePendingNavigation(){let n;try{n=sessionStorage.getItem("floe_pending_navigation")}catch{return}if(!n)return;let r;try{if(r=JSON.parse(n),!r.resolvedUrl||!r.timestamp)return}catch{try{sessionStorage.removeItem("floe_pending_navigation")}catch{}return}if(Date.now()-r.timestamp>6e4){try{sessionStorage.removeItem("floe_pending_navigation")}catch{}return}const i=Ln(),o=i===r.resolvedUrl,s={type:"bot_action_complete",action:"navigate",target:r.resolvedUrl,success:o,previousUrl:r.beforeUrl,currentUrl:i,...o?{}:{error:"Full-page navigation did not reach expected URL"},timestamp:r.timestamp,finalized:!0};try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata(s),setTimeout(()=>{this.isConnected&&this.sendMetadata(s)},3e3),this.logger.log(`[OnboardingSDK] 🔄 Finalized pending navigation: ${r.resolvedUrl} (success=${o})`)}async handleCheckPrecondition(n){const r=n.precondition;if(!r){this.logger.warn("[OnboardingSDK] ⚠️ No precondition specified"),this.sendMetadata({type:"precondition_result",preconditionType:"unknown",optionText:"",result:!1,details:"No precondition specified in action",timestamp:Date.now()});return}const{type:i,optionText:o,selector:s}=r;let a=!1,l="";switch(i){case"option_exists":{if(!o){l="No optionText provided for option_exists";break}const c=this.findDropdownTrigger(n.target);if(c){this.logger.log("[OnboardingSDK] 🔍 Opening dropdown to check for option:",o),this._botActionDepth++;try{this.actionExecutor.openDropdown(c)}finally{this._botActionDepth--}await new Promise(h=>setTimeout(h,400)),a=!!this.findVisibleDropdownOption(o),a||(a=!!await this.scrollToDropdownOption(o)),l=a?`Option "${o}" found in dropdown`:`Option "${o}" NOT found in dropdown`,this._botActionDepth++;try{await new Promise(f=>setTimeout(f,100));const h=document.activeElement instanceof HTMLElement?document.activeElement:document.body;h&&h.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(f=>setTimeout(f,100)),document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight()}else l="Could not find dropdown trigger"}break;case"element_visible":{const c=s||n.target.selector;if(!c){l="No selector provided for element_visible";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_visible: "${c}"`;break}a=!!(d&&be.isVisible(d)),l=a?`Element "${c}" is visible`:`Element "${c}" is NOT visible or not found`}break;case"element_enabled":{const c=s||n.target.selector;if(!c){l="No selector provided for element_enabled";break}let d=null;try{d=document.querySelector(c)}catch{l=`Invalid selector for element_enabled: "${c}"`;break}d?(a=!(d.hasAttribute("disabled")||d.getAttribute("aria-disabled")==="true"||d.classList.contains("disabled")||d.disabled===!0),l=a?`Element "${c}" is enabled`:`Element "${c}" is disabled`):l=`Element "${c}" not found`}break;default:l=`Unknown precondition type: ${i}`}this.logger.log(`[OnboardingSDK] 🔍 Precondition check result: ${a} - ${l}`),this.sendMetadata({type:"precondition_result",preconditionType:i,optionText:o,result:a,details:l,timestamp:Date.now()})}async handleMultiSelectAction(n){const r=n.target.selectedValues||[];if(this.logger.log("[OnboardingSDK] 📋 handleMultiSelectAction for:",r),r.length===0){this.logger.warn("[OnboardingSDK] ⚠️ No values to select in multi_select action"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"No values provided for multi-select",timestamp:Date.now()});return}const i=this.findDropdownTrigger(n.target);if(!i){this.logger.error("[OnboardingSDK] ❌ Could not find dropdown trigger for multi-select"),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:!1,target:n.target.text||n.target.selector||"unknown",error:"Dropdown trigger not found",timestamp:Date.now()});return}be.scrollIntoView(i),await new Promise(l=>setTimeout(l,200)),await this.overlay.moveToElementAndClick(i),this.logger.log("[OnboardingSDK] 📂 Opening multi-select dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}await new Promise(l=>setTimeout(l,300));const o=[],s=[];for(let l=0;l<r.length;l++){const c=r[l];this.logger.log(`[OnboardingSDK] 📋 Selecting option ${l+1}/${r.length}: "${c}"`);let d=this.findVisibleDropdownOption(c);if(!d){this.logger.log("[OnboardingSDK] ⚠️ Option not visible, checking if dropdown closed..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}if(await new Promise(h=>setTimeout(h,300)),d=this.findVisibleDropdownOption(c),!d){const h=await this.scrollToDropdownOption(c);h&&(d=h)}}if(d)if(d.getAttribute("aria-selected")==="true"||d.classList.contains("selected")||d.closest('[aria-selected="true"]')!==null)o.push(c),this.logger.log(`[OnboardingSDK] ✅ Already selected: "${c}"`);else{this._botActionDepth++;try{const f=d.getBoundingClientRect(),g=f.left+f.width/2,y=f.top+f.height/2,m={bubbles:!0,cancelable:!0,view:window,clientX:g,clientY:y};d.dispatchEvent(new MouseEvent("mousedown",m)),d.dispatchEvent(new MouseEvent("mouseup",m)),d.dispatchEvent(new MouseEvent("click",m)),await new Promise(S=>setTimeout(S,200)),o.push(c),this.logger.log(`[OnboardingSDK] ✅ Selected: "${c}"`)}finally{this._botActionDepth--}}else s.push(c),this.logger.warn(`[OnboardingSDK] ⚠️ Option not found after retries: "${c}"`)}await new Promise(l=>setTimeout(l,200)),this._botActionDepth++;try{const l=document.activeElement instanceof HTMLElement?document.activeElement:document.body;l&&l.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(d=>setTimeout(d,100));const c=document.querySelector('[class*="backdrop"], [class*="overlay"], .MuiBackdrop-root');c&&c instanceof HTMLElement?c.click():document.body.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}finally{this._botActionDepth--}this.overlay.clearHighlight();const a=o.length>0;this.logger.log(`[OnboardingSDK] 📋 Multi-select complete: ${o.length} selected, ${s.length} failed`),this.sendMetadata({type:"bot_action_complete",action:"multi_select",success:a,target:n.target.text||n.target.selector||"unknown",selectedValues:o,failedValues:s,timestamp:Date.now()})}async handleDropdownOptionClick(n){const r=n.target.optionText;this.logger.log("[OnboardingSDK] 🎯 handleDropdownOptionClick for:",r);let i=this.findVisibleDropdownOption(r);if(i){this.logger.log("[OnboardingSDK] ✅ Option already visible, clicking directly"),await this.clickDropdownOption(i,n);return}const o=this.isDropdownCurrentlyOpen();this.logger.log("[OnboardingSDK] 🔍 Option not visible, dropdown already open:",o);const s=this.findDropdownTrigger(n.target);if(!s){this.logger.error("[OnboardingSDK] ❌ Could not find dropdown trigger"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:"Dropdown trigger not found",timestamp:Date.now()});return}if(o){this.logger.log("[OnboardingSDK] 📜 Dropdown open but option not visible — trying scroll first");const h=await this.scrollToDropdownOption(r);if(h){this.logger.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(h,n);return}}const a=this.findDropdownSearchInput(s);if(a){if(this.logger.log("[OnboardingSDK] ⌨️ Typing to filter dropdown:",r),i=await this.typeToFilterDropdown(a,r),i){this.logger.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}this.logger.log("[OnboardingSDK] ⚠️ Typing to filter did not reveal the option")}if(!o){be.scrollIntoView(s),await new Promise(g=>setTimeout(g,200)),await this.overlay.moveToElementAndClick(s),this.logger.log("[OnboardingSDK] 📂 Opening dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(s)}finally{this._botActionDepth--}if(await new Promise(g=>setTimeout(g,300)),i=this.findVisibleDropdownOption(r),i){this.logger.log("[OnboardingSDK] ✅ Option visible after opening dropdown"),await this.clickDropdownOption(i,n);return}const h=this.findDropdownSearchInput(s);if(h&&(this.logger.log("[OnboardingSDK] ⌨️ Typing to filter after opening dropdown:",r),i=await this.typeToFilterDropdown(h,r),i)){this.logger.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}const f=await this.scrollToDropdownOption(r);if(f){this.logger.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(f,n);return}}const l=1500,c=150;let d=0;for(;d<l;){if(i=this.findVisibleDropdownOption(r),i){this.logger.log("[OnboardingSDK] ✅ Option appeared after",d,"ms (final poll)");break}await new Promise(h=>setTimeout(h,c)),d+=c}if(!i){this.logger.error("[OnboardingSDK] ❌ All strategies failed for option:",r);const h=document.querySelectorAll('[role="option"], [class*="option"], nz-option-item, .ant-select-item-option'),f=Array.from(h).slice(0,10).map(g=>{var y;return(y=g.textContent)==null?void 0:y.trim().slice(0,50)}).filter(Boolean);f.length>0?this.logger.log("[OnboardingSDK] Available options:",f):this.logger.log("[OnboardingSDK] No options visible - dropdown may not have opened"),this.sendMetadata({type:"bot_action_complete",action:"click",success:!1,target:r,error:`Option "${r}" not found in dropdown`,timestamp:Date.now()}),this.overlay.clearHighlight();return}await this.clickDropdownOption(i,n)}isDropdownCurrentlyOpen(){return s_(be.isVisible)}findDropdownSearchInput(n){return a_(n,be.isVisible)}async typeToFilterDropdown(n,r){return c_(n,r,be.isVisible)}findVisibleDropdownOption(n){return Bo(n,be.isVisible)}async scrollToDropdownOption(n){var o;const r=n.toLowerCase().trim();this.logger.log(`[OnboardingSDK] 🔍 Scrolling dropdown to find: "${n}"`);const i=["cdk-virtual-scroll-viewport",".cdk-virtual-scroll-viewport",'[role="listbox"]','[class*="-menu"] [class*="menu-list"]','[class*="options-container"]','[class*="virtual-list"]'];for(const s of i){let a;try{a=document.querySelectorAll(s)}catch{continue}for(const l of a){const c=l;if(!be.isVisible(c)||c.scrollHeight<=c.clientHeight+5)continue;const d=window.getComputedStyle(c).overflowY;if(d==="visible"||d==="hidden"){this.logger.log(`[OnboardingSDK] Skipping non-scrollable container (${s}), overflow-y: ${d}`);continue}this.logger.log(`[OnboardingSDK] Found scrollable container (${s}), scrollHeight: ${c.scrollHeight}, clientHeight: ${c.clientHeight}, overflow-y: ${d}`);const h=150,f=Math.ceil(c.scrollHeight/h)+2,g=c.scrollTop;for(let y=0;y<f;y++){c.scrollTop=y*h,await new Promise(v=>setTimeout(v,120));const S=c.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]), nz-option-item, .ant-select-item-option, .ant-select-item');for(const v of S){const w=v,k=w.getBoundingClientRect();if(k.height===0||k.width===0)continue;const C=((o=w.textContent)==null?void 0:o.trim().toLowerCase())||"";if(C===r||C.includes(r))return this.logger.log(`[OnboardingSDK] ✅ Found option after scrolling to position ${c.scrollTop}: "${n}"`),w.scrollIntoView({block:"center"}),await new Promise(E=>setTimeout(E,100)),w}}c.scrollTop=g}}return this.logger.log(`[OnboardingSDK] Option not found after scrolling: "${n}"`),null}isValidDropdownElement(n,r=!1){if(!n)return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is null"),!1;if(Mt(n))return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is inside SDK widget",{id:n.id,className:n.className,tagName:n.tagName}),!1;if(n.getAttribute("aria-hidden")==="true"||n.closest('[aria-hidden="true"]'))return this.logger.warn('[OnboardingSDK] ⚠️ Dropdown validation: element or ancestor has aria-hidden="true"',{id:n.id,className:n.className}),!1;const i=window.getComputedStyle(n);if(i.display==="none")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has display:none",{id:n.id,className:n.className}),!1;if(i.visibility==="hidden")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has visibility:hidden",{id:n.id,className:n.className}),!1;if(i.pointerEvents==="none")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has pointer-events:none",{id:n.id,className:n.className}),!1;if(i.opacity==="0")return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has opacity:0",{id:n.id,className:n.className}),!1;const o=i.position;if(n.offsetParent===null&&o!=="fixed"&&o!=="sticky"){let a=n.parentElement,l=!1;for(;a;){const c=window.getComputedStyle(a);if(c.position==="fixed"||c.position==="sticky"){l=!0;break}a=a.parentElement}if(!l)return this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has null offsetParent (not rendered)",{id:n.id,className:n.className}),!1}const s=n.getBoundingClientRect();return s.width<=0||s.height<=0?(this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has zero dimensions",{id:n.id,className:n.className,width:s.width,height:s.height}),!1):r&&!(n.closest('[role="combobox"]')!==null||n.closest('[aria-haspopup="listbox"]')!==null||n.closest('[aria-haspopup="true"]')!==null||n.closest('[class*="select"]')!==null||n.closest('[class*="Select"]')!==null||n.closest('[class*="dropdown"]')!==null||n.closest('[class*="Dropdown"]')!==null||n.closest("select")!==null)?(this.logger.warn("[OnboardingSDK] ⚠️ Dropdown validation (Strategy 5): element lacks dropdown-like ancestor",{id:n.id,className:n.className,tagName:n.tagName}),!1):!0}findDropdownTrigger(n){var o;if(n.dropdownTriggerSelector){this.logger.log("[OnboardingSDK] 🎯 Using dropdownTriggerSelector:",n.dropdownTriggerSelector);try{const s=Mv(n.dropdownTriggerSelector);if(s){const a=this.getClickableDropdownContainer(s);if(this.isValidDropdownElement(a))return this.logger.log("[OnboardingSDK] ✅ Found trigger via dropdownTriggerSelector"),a;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 1: dropdownTriggerSelector element failed validation")}}catch(s){this.logger.warn("[OnboardingSDK] Invalid dropdownTriggerSelector:",s)}}if(n.labelText){this.logger.log("[OnboardingSDK] 🔍 Finding dropdown by label:",n.labelText);const s=this.findDropdownByLabel(n.labelText);if(s)return this.logger.log("[OnboardingSDK] ✅ Found trigger via labelText"),s}const r=document.querySelector('input[role="combobox"]:focus');if(r){const s=this.getClickableDropdownContainer(r);if(this.isValidDropdownElement(s))return this.logger.log("[OnboardingSDK] ✅ Found focused combobox"),s;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 3: focused combobox failed validation")}const i=document.querySelector('input[role="combobox"][aria-expanded="true"]');if(i){const s=this.getClickableDropdownContainer(i);if(this.isValidDropdownElement(s))return this.logger.log("[OnboardingSDK] ✅ Found expanded combobox"),s;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 3: expanded combobox failed validation")}if(n.selector){const a=n.selector.replace(/\\"/g,'"').replace(/\\ /g," ").replace(/\\\\/g,"\\").replace(/\[data-option-text="[^"]*"\]/g,"").replace(/\[data-label="[^"]*"\]/g,"").replace(/\[role="option"\]/g,"").trim();if(a&&a!=="")try{const l=document.querySelector(a);if(l){const c=this.getClickableDropdownContainer(l);if(this.isValidDropdownElement(c))return this.logger.log("[OnboardingSDK] ✅ Found trigger via cleaned selector"),c;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 4: selector element failed validation")}}catch{this.logger.warn("[OnboardingSDK] Invalid selector:",a)}}if(n.text||n.optionText){const s=(n.text||n.optionText||"").toLowerCase(),a=['[class*="singleValue"]','[class*="single-value"]','[class*="select__single-value"]',".MuiSelect-select",'[class*="placeholder"]'];for(const l of a){const c=document.querySelectorAll(l);for(const d of c){const h=((o=d.textContent)==null?void 0:o.trim().toLowerCase())||"";if(h===s||h.includes(s)){const f=this.getClickableDropdownContainer(d);if(this.isValidDropdownElement(f,!0))return this.logger.log("[OnboardingSDK] ✅ Found trigger via display value match"),f;this.logger.warn("[OnboardingSDK] ⚠️ Strategy 5: display value match element failed validation",{searchText:s,selector:l,elementText:h})}}}}return this.logger.warn("[OnboardingSDK] ❌ Could not find dropdown trigger"),null}findDropdownByLabel(n){var o;const r=n.toLowerCase().trim(),i=["label",'[class*="label"]','[class*="Label"]','[class*="form-label"]',".MuiFormLabel-root",".MuiInputLabel-root"];for(const s of i){const a=document.querySelectorAll(s);for(const l of a){const c=((o=l.textContent)==null?void 0:o.trim().toLowerCase().replace(/\*$/,"").trim())||"";if(c===r||c.includes(r)){const d=l;if(d.tagName==="LABEL"&&d.htmlFor){const g=document.getElementById(d.htmlFor);if(g)return this.getClickableDropdownContainer(g)}const h=d.id;if(h){const g=document.querySelector(`[aria-labelledby="${h}"]`);if(g)return this.getClickableDropdownContainer(g)}const f=d.closest('[class*="field"], [class*="form-group"], [class*="FormControl"]')||d.parentElement;if(f){const g=f.querySelector('input[role="combobox"], select, [aria-haspopup="listbox"], [class*="control"]');if(g)return this.getClickableDropdownContainer(g)}}}}return null}getClickableDropdownContainer(n){var i;return n.closest('[class*="-control"]')||n.closest('[class*="control"]')||n.closest('[class*="trigger"]')||n.closest("[aria-haspopup]")||((i=n.closest(".MuiSelect-select"))==null?void 0:i.parentElement)||n.closest('[class*="select"]')||n}async clickDropdownOption(n,r){var i;await this.overlay.moveToElementAndClick(n),await new Promise(o=>setTimeout(o,150)),this.logger.log("[OnboardingSDK] 👆 Clicking dropdown option:",(i=n.textContent)==null?void 0:i.trim()),this._botActionDepth++;try{if(this.actionExecutor.triggerReactOnClickPublic(n))this.logger.log("[OnboardingSDK] ✅ React onClick triggered for option");else{const s=n.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l};n.dispatchEvent(new MouseEvent("mousedown",c)),n.dispatchEvent(new MouseEvent("mouseup",c)),n.dispatchEvent(new MouseEvent("click",c))}}finally{this._botActionDepth--}this.logger.log("[OnboardingSDK] ✅ Dropdown option clicked successfully"),this.domIntrospector&&(await new Promise(o=>setTimeout(o,150)),this.domIntrospector.captureAndSendImmediate("post-dropdown-select"),this.logger.log("[OnboardingSDK] 📸 DOM snapshot sent after dropdown selection")),this.sendMetadata({type:"bot_action_complete",action:"click",success:!0,target:r.target.optionText||r.target.text||"dropdown option",timestamp:Date.now()}),this.logger.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance"),await new Promise(o=>setTimeout(o,200)),setTimeout(()=>{this.overlay.cleanup()},600)}findCollapsedSidebar(n){let r=n.parentElement;for(;r&&r!==document.body;){const i=window.getComputedStyle(r),o=r.getBoundingClientRect().width,s=r.getBoundingClientRect().height,a=i.transition.includes("width")||i.transitionProperty.includes("width")||i.transitionProperty==="all",l=o<80,c=s>window.innerHeight*.5,d=typeof r.className=="string"?r.className:"",h=d.includes("sidebar")||d.includes("nav")||d.includes("menu"),f=d.includes("w-12")||d.includes("w-14")||d.includes("w-16");if(l&&c&&(a||h)||f)return this.logger.log("[OnboardingSDK] Detected collapsed sidebar:",{width:o,height:s,hasTransition:a,hasTailwindCollapsed:f,classes:r.className.substring(0,100)}),r;r=r.parentElement}return null}async executeActionFast(n){this.logger.log("[OnboardingSDK] ⚡ Fast executing action:",n.action);let r=be.resolveTarget(n.target);if(!r&&(await new Promise(o=>setTimeout(o,150)),r=be.resolveTarget(n.target),!r))return this.logger.warn("[OnboardingSDK] ⚠️ Fast action target not found"),!1;r.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(o=>setTimeout(o,50)),this.overlay.highlightResolvedElement(r,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(o=>setTimeout(o,80)),this._botActionDepth++;let i=!1;try{i=await this.actionExecutor.executeHybridAction(n,!1)}finally{this._botActionDepth--}return await new Promise(o=>setTimeout(o,50)),this.overlay.clearHighlight(),i}async handleExecuteApi(n){var g;this.logger.log("[OnboardingSDK] 🔌 Executing API call:",n.method,n.url);const{method:r="GET",url:i,base_url:o,body:s,query_params:a,success_indicator:l,result_extractor:c,error_message_path:d}=n;let h=i;if(o&&(h=`${o.replace(/\/$/,"")}/${i.replace(/^\//,"")}`),a&&r==="GET"){const y=new URLSearchParams(a);h=`${h}?${y.toString()}`}try{const y=new URL(h,window.location.href);if(y.origin!==window.location.origin){this.logger.error("[OnboardingSDK] ❌ Cross-origin API request blocked:",y.origin),this.sendMetadata({type:"api_execution_result",success:!1,error:`Cross-origin request blocked: ${y.origin} does not match ${window.location.origin}`,url:h,method:r,timestamp:Date.now()});return}}catch{this.logger.error("[OnboardingSDK] ❌ Invalid URL:",h),this.sendMetadata({type:"api_execution_result",success:!1,error:`Invalid URL: ${h}`,url:h,method:r,timestamp:Date.now()});return}if(!["GET","HEAD","POST","PUT","PATCH","DELETE"].includes(r.toUpperCase())){this.logger.error("[OnboardingSDK] ❌ HTTP method not allowed:",r),this.sendMetadata({type:"api_execution_result",success:!1,error:`HTTP method not allowed: ${r}`,url:h,method:r,timestamp:Date.now()});return}try{const y={method:r.toUpperCase(),headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"};s&&r!=="GET"&&(y.body=JSON.stringify(s)),this.logger.log("[OnboardingSDK] 📤 Making API request:",h);const m=await fetch(h,y);let S;const v=await m.text();try{S=JSON.parse(v)}catch{S={raw:v}}this.logger.log("[OnboardingSDK] 📥 API response:",m.status,S);const w=m.ok&&this.evaluateJsonPathCondition(S,l),k=this.extractJsonPath(S,c);let C;w||(C=this.extractJsonPath(S,d)||((g=S.error)==null?void 0:g.message)||S.message||`Request failed with status ${m.status}`),this.sendMetadata({type:"api_execution_result",success:w,status_code:m.status,data:S,result_text:k,error:C,url:h,method:r,timestamp:Date.now()}),this.logger.log(`[OnboardingSDK] ${w?"✅":"❌"} API execution ${w?"succeeded":"failed"}:`,k||C)}catch(y){this.logger.error("[OnboardingSDK] ❌ API execution error:",y),this.sendMetadata({type:"api_execution_result",success:!1,error:y instanceof Error?y.message:"Unknown error",url:h,method:r,timestamp:Date.now()})}}evaluateJsonPathCondition(n,r){if(!r)return!0;try{if(r.includes(" == ")){const[i,o]=r.split(" == "),s=this.extractJsonPath(n,i.trim()),a=o.trim().replace(/^["']|["']$/g,"");return String(s)===a}return!!this.extractJsonPath(n,r)}catch{return!0}}extractJsonPath(n,r){if(!r||!n)return;const o=r.replace(/^\$\.?/,"").split(".");let s=n;for(const a of o){if(s==null)return;s=s[a]}return s}async handleBatchedNavigation(n){if(this.logger.log("[OnboardingSDK] ⚡ Received batched navigation request"),!this.batchedActionExecutor){this.logger.error("[OnboardingSDK] BatchedActionExecutor not initialized");return}const r=(n.steps||[]).map(i=>{const o=i.target||i,a=o.text||o.selector||o.tag?{text:o.text,tag:o.tag,selector:o.selector,ariaLabel:o.aria_label||o.ariaLabel,role:o.role,labelText:o.label_text||o.labelText,selectorFallbacks:o.selector_fallbacks||o.selectorFallbacks}:void 0;return{action:i.action,target:a,condition:i.condition,waitMs:i.wait_ms||i.waitMs}});if(r.length===0){this.logger.warn("[OnboardingSDK] No steps in batched navigation request");return}this.fastExecutionMode=!0,this._botActionDepth++;try{this.logger.log("[OnboardingSDK] ⚡ Executing batched navigation with steps:",r.map(o=>{var s;return`${o.action}${(s=o.target)!=null&&s.text?` "${o.target.text}"`:""}`}).join(" → "));const i=await this.batchedActionExecutor.executeBatch({steps:r});this.domIntrospector&&(await new Promise(o=>setTimeout(o,200)),this.domIntrospector.captureAndSendImmediate("post-batched-navigation"),this.logger.log("[OnboardingSDK] 📸 DOM snapshot sent after batched navigation")),i.success?(this.logger.log("[OnboardingSDK] ✅ Batched navigation complete, sending success"),this.sendMetadata({type:"batched_navigation_complete",success:!0,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()})):(this.logger.log(`[OnboardingSDK] ❌ Batched navigation failed at step ${i.completedSteps+1}, sending failure`),this.sendMetadata({type:"batched_navigation_complete",success:!1,error:`Step ${i.completedSteps+1} failed - check console for details`,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()}))}finally{this.fastExecutionMode=!1,this._botActionDepth--}}startNavigationDetection(n){this.navigationCompleteDetector&&this.navigationCompleteDetector.start(r=>{this.logger.log("[OnboardingSDK] Navigation complete detected:",r),this.sendMetadata({type:"navigation_complete",url:r,timestamp:Date.now()}),n(r)})}stopNavigationDetection(){this.navigationCompleteDetector&&this.navigationCompleteDetector.stop()}isInFastMode(){return this.fastExecutionMode}async extractIntent(n){const r={"get started":"onboarding",help:"assistance","show me":"demonstration","how do":"tutorial",where:"navigation",what:"information"},i=n.toLowerCase();for(const[o,s]of Object.entries(r))if(i.includes(o))return s;return"unknown"}async captureContext(){const n=this.config.enableScreenCapture?await this.capture.captureWithRedaction():void 0,r=this.extractPageStructure();return{screenshot:n,url:Ln(),structure:r,timestamp:Date.now()}}extractPageStructure(){const n=[];return["button","a","input","select","textarea",'[role="button"]',"[onclick]"].forEach(i=>{document.querySelectorAll(i).forEach(o=>{const s=o.getBoundingClientRect(),a=s.width>0&&s.height>0&&s.top<window.innerHeight&&s.bottom>0;a&&n.push({selector:this.getSelector(o),type:o.tagName.toLowerCase(),text:(o.textContent||"").trim().substring(0,100),visible:a,position:s,attributes:this.getAttributes(o)})})}),{title:document.title,url:Ln(),elements:n,viewport:{width:window.innerWidth,height:window.innerHeight}}}getSelector(n){if(n.id)return`#${n.id}`;const r=[];let i=n;for(;i&&i!==document.body;){let o=i.tagName.toLowerCase();if(i.className){const s=Array.from(i.classList).slice(0,2).join(".");s&&(o+=`.${s}`)}r.unshift(o),i=i.parentElement}return r.join(" > ")}getAttributes(n){const r={};return["href","type","name","placeholder","aria-label","role"].forEach(o=>{const s=n.getAttribute(o);s&&(r[o]=s)}),r}async sendText(n){this.pipecatClient&&this.isConnected&&await this.pipecatClient.sendText(n)}toggleTextMode(){var n,r;this.textModeEnabled=!this.textModeEnabled,this.textModeEnabled?((n=this.pipecatClient)==null||n.enableMic(!1),this.micEnabled=!1,this.logger.log("[OnboardingSDK] ⌨️ Text mode enabled — mic muted")):((r=this.pipecatClient)==null||r.enableMic(!0),this.micEnabled=!0,this.micPermissionDenied=!1,this.logger.log("[OnboardingSDK] 🎤 Voice mode enabled — mic unmuted"),this.isConnected&&this.setupUserMicAnalysis()),this.pipecatClient&&this.isConnected&&this.pipecatClient.sendClientMessage("set_text_mode",{enabled:this.textModeEnabled});try{localStorage.setItem("floe_text_mode",String(this.textModeEnabled))}catch{}this.renderReactUI()}async sendTextMessage(n){n.trim()&&(this.transcriptHistory.push({id:`user-${Date.now()}`,role:"user",content:n.trim(),timestamp:Date.now()}),this.pruneTranscriptHistory(),this.renderReactUI(),this.pipecatClient&&this.isConnected&&this.pipecatClient.sendClientMessage("text_message",{text:n.trim(),audio_response:!this.textModeEnabled}))}toggleMute(){if(this.pipecatClient){const r=!this.pipecatClient.isMicEnabled;return this.pipecatClient.enableMic(r),this.micEnabled=r,this.logger.log("[OnboardingSDK] 🎤 Mic toggled:",r?"ON":"MUTED"),this.renderReactUI(),r}return!1}highlight(n,r){this.overlay.highlight(n,r)}clearHighlight(){this.overlay.clearHighlight()}showTooltip(n,r){this.overlay.showTooltip(n,r)}hideTooltip(){this.overlay.hideTooltip()}async executeAction(n){return this.actionExecutor.executeWithConsent(n)}async takeScreenshot(n){return this.capture.captureWithRedaction(n)}getSessionId(){return this.sessionId}getStatus(){return{initialized:this.isInitialized,connected:this.isConnected,sessionId:this.sessionId,microphoneMuted:this.pipecatClient?!this.pipecatClient.isMicEnabled:!1}}startGuidedDiscovery(){return!this.pipecatClient||!this.isConnected?(this.logger.warn("[OnboardingSDK] Cannot start discovery - not connected"),!1):(this.logger.log("[OnboardingSDK] 🔍 Starting guided discovery mode"),this.pipecatClient.sendClientMessage("start_discovery",{type:"start_discovery",timestamp:Date.now()}),this.hideWelcomePopup(),!0)}skipDiscovery(){this.logger.log("[OnboardingSDK] Skipping discovery - standard greeting flow"),this.hideWelcomePopup()}showWelcomePopupAsync(){return new Promise(n=>{if(document.getElementById("floe-welcome-popup")){n(!1);return}const r=document.createElement("div");r.id="floe-welcome-popup",r.setAttribute("data-floe-widget","true"),r.style.cssText=`
819
829
  position: fixed;
820
830
  top: 0;
821
831
  left: 0;
@@ -973,5 +983,5 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
973
983
  ">
974
984
  I'll explore on my own
975
985
  </button>
976
- `,r.appendChild(i),document.body.appendChild(r);const o=r.querySelector("#floe-start-guided"),s=r.querySelector("#floe-skip-guided");o&&(o.onmouseenter=()=>{o.style.background="rgba(255, 255, 255, 1)",o.style.transform="translateY(-1px)",o.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)"},o.onmouseleave=()=>{o.style.background="rgba(255, 255, 255, 0.95)",o.style.transform="translateY(0)",o.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.2)"},o.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!0)},200)}),s&&(s.onmouseenter=()=>{s.style.color="rgba(255, 255, 255, 0.8)"},s.onmouseleave=()=>{s.style.color="rgba(255, 255, 255, 0.4)"},s.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!1)},200)}),this.logger.log("[OnboardingSDK] Welcome popup shown (async)")})}showWelcomePopup(){this.showWelcomePopupAsync().then(n=>{n?this.startGuidedDiscovery():this.skipDiscovery()})}hideWelcomePopup(){const n=document.getElementById("floe-welcome-popup");n&&(n.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>n.remove(),200)),this.logger.log("[OnboardingSDK] Welcome popup hidden")}shouldShowDiscoveryPrompt(){const n=localStorage.getItem("floe_has_visited"),r=localStorage.getItem("floe_onboarding_complete");return!n||!r}async checkEndUserStatus(){var n,r,i,o,s;try{const a=`${this.config.apiUrl}/end-users/check-status`,l={clientKey:this.config.clientKey,origin:window.location.origin};(n=this.config.userInfo)!=null&&n.externalId&&(l.externalId=this.config.userInfo.externalId),(r=this.config.userInfo)!=null&&r.email&&(l.email=this.config.userInfo.email),this.config.debug&&this.logger.log("[OnboardingSDK] Checking EndUser status...",{externalId:l.externalId?"***":void 0,email:l.email?"***":void 0});const c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){this.logger.warn(`[OnboardingSDK] EndUser status check failed: ${c.status}`);return}this.endUserStatus=await c.json(),this.logger.log(`[OnboardingSDK] EndUser status: found=${(i=this.endUserStatus)==null?void 0:i.found}, isNewUser=${(o=this.endUserStatus)==null?void 0:o.isNewUser}, hasPreferences=${(s=this.endUserStatus)==null?void 0:s.hasPreferences}`)}catch(a){this.logger.warn("[OnboardingSDK] Error checking EndUser status:",a)}}getEndUserPreferences(){var n;return((n=this.endUserStatus)==null?void 0:n.preferences)||null}shouldSkipOnboardingModal(){var o,s;if(typeof this.config.skipOnboardingModal=="boolean")return this.logger.log(`[OnboardingSDK] skipOnboardingModal explicitly set to: ${this.config.skipOnboardingModal}`),this.config.skipOnboardingModal;if(((o=this.endUserStatus)==null?void 0:o.isNewUser)===!0)return this.logger.log("[OnboardingSDK] Showing modal: API indicates isNewUser=true"),!1;if((s=this.endUserStatus)!=null&&s.found&&this.endUserStatus.isNewUser===!1)return this.logger.log("[OnboardingSDK] Skipping modal: existing EndUser (isNewUser=false)"),!0;const n=localStorage.getItem("floe_has_visited")==="true",r=localStorage.getItem("floe_onboarding_complete")==="true",i=n&&r;return this.logger.log(`[OnboardingSDK] Fallback to localStorage: skip=${i} (hasVisited: ${n}, hasCompletedOnboarding: ${r})`),i}markUserVisited(){localStorage.setItem("floe_has_visited","true")}markOnboardingComplete(){localStorage.setItem("floe_onboarding_complete","true")}async disconnect(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.cleanup(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.reactRoot&&(this.reactRoot.unmount(),this.reactRoot=null),this.reactContainer&&(this.reactContainer.remove(),this.reactContainer=null),this.overlay.remove(),this.isInitialized=!1,this.isConnected=!1,this.agentState="idle",this.logger.log("[OnboardingSDK] Disconnected"),this.emit("disconnected")}}typeof window<"u"&&(window.OnboardingSDK=Nv);function k_(t){return{clientKey:t.clientKey,...t.apiUrl!==void 0&&{apiUrl:t.apiUrl},enableVideo:!1,enableAudio:t.enableAudio??!0,enableScreenCapture:t.enableScreenCapture??!0,debug:t.debug??!1,industry:t.industry,useCase:t.useCase,companyName:t.companyName,companySize:t.companySize,role:t.role,userInfo:t.userInfo,skipOnboardingModal:t.skipOnboardingModal,enableDiscoveryPopup:!0,nudge:t.nudge?{text:t.nudge.text??"Hi 👋 How can I help you today?",autoShow:t.nudge.autoShow??!0,autoHideDelay:t.nudge.autoHideDelay??0}:void 0}}function $v(t){if(!t.clientKey)throw new Error("[Floe] clientKey is required");const e=k_(t),n=_d(e.debug??!1),r=new Nv(e,n);return r.ready=r.init().catch(i=>{throw n.error("[Floe] Initialization failed:",i),i}),r}return typeof window<"u"&&(window.Floe=$v),fn.Floe=$v,Object.defineProperty(fn,Symbol.toStringTag,{value:"Module"}),fn}({});
986
+ `,r.appendChild(i),document.body.appendChild(r);const o=r.querySelector("#floe-start-guided"),s=r.querySelector("#floe-skip-guided");o&&(o.onmouseenter=()=>{o.style.background="rgba(255, 255, 255, 1)",o.style.transform="translateY(-1px)",o.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)"},o.onmouseleave=()=>{o.style.background="rgba(255, 255, 255, 0.95)",o.style.transform="translateY(0)",o.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.2)"},o.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!0)},200)}),s&&(s.onmouseenter=()=>{s.style.color="rgba(255, 255, 255, 0.8)"},s.onmouseleave=()=>{s.style.color="rgba(255, 255, 255, 0.4)"},s.onclick=()=>{r.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>{r.remove(),n(!1)},200)}),this.logger.log("[OnboardingSDK] Welcome popup shown (async)")})}showWelcomePopup(){this.showWelcomePopupAsync().then(n=>{n?this.startGuidedDiscovery():this.skipDiscovery()})}hideWelcomePopup(){const n=document.getElementById("floe-welcome-popup");n&&(n.style.animation="welcomeFadeOut 0.2s ease",setTimeout(()=>n.remove(),200)),this.logger.log("[OnboardingSDK] Welcome popup hidden")}shouldShowDiscoveryPrompt(){const n=localStorage.getItem("floe_has_visited"),r=localStorage.getItem("floe_onboarding_complete");return!n||!r}async checkEndUserStatus(){var n,r,i,o,s;try{const a=`${this.config.apiUrl}/end-users/check-status`,l={clientKey:this.config.clientKey,origin:window.location.origin};(n=this.config.userInfo)!=null&&n.externalId&&(l.externalId=this.config.userInfo.externalId),(r=this.config.userInfo)!=null&&r.email&&(l.email=this.config.userInfo.email),this.config.debug&&this.logger.log("[OnboardingSDK] Checking EndUser status...",{externalId:l.externalId?"***":void 0,email:l.email?"***":void 0});const c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){this.logger.warn(`[OnboardingSDK] EndUser status check failed: ${c.status}`);return}this.endUserStatus=await c.json(),this.logger.log(`[OnboardingSDK] EndUser status: found=${(i=this.endUserStatus)==null?void 0:i.found}, isNewUser=${(o=this.endUserStatus)==null?void 0:o.isNewUser}, hasPreferences=${(s=this.endUserStatus)==null?void 0:s.hasPreferences}`)}catch(a){this.logger.warn("[OnboardingSDK] Error checking EndUser status:",a)}}getEndUserPreferences(){var n;return((n=this.endUserStatus)==null?void 0:n.preferences)||null}shouldSkipOnboardingModal(){var o,s;if(typeof this.config.skipOnboardingModal=="boolean")return this.logger.log(`[OnboardingSDK] skipOnboardingModal explicitly set to: ${this.config.skipOnboardingModal}`),this.config.skipOnboardingModal;if(((o=this.endUserStatus)==null?void 0:o.isNewUser)===!0)return this.logger.log("[OnboardingSDK] Showing modal: API indicates isNewUser=true"),!1;if((s=this.endUserStatus)!=null&&s.found&&this.endUserStatus.isNewUser===!1)return this.logger.log("[OnboardingSDK] Skipping modal: existing EndUser (isNewUser=false)"),!0;const n=localStorage.getItem("floe_has_visited")==="true",r=localStorage.getItem("floe_onboarding_complete")==="true",i=n&&r;return this.logger.log(`[OnboardingSDK] Fallback to localStorage: skip=${i} (hasVisited: ${n}, hasCompletedOnboarding: ${r})`),i}markUserVisited(){localStorage.setItem("floe_has_visited","true")}markOnboardingComplete(){localStorage.setItem("floe_onboarding_complete","true")}async disconnect(){this.pageTracker.stop(),this.domIntrospector.stopCapturing(),this.navigationCompleteDetector&&this.navigationCompleteDetector.stop(),this.overlay.cleanup(),this.pipecatClient&&(await this.pipecatClient.disconnect(),this.pipecatClient=null),this.transport&&(this.transport=null),this.audioElements&&(this.audioElements.forEach(n=>{n.pause(),n.remove()}),this.audioElements=[]),this.botAudioAnalyzer&&(this.botAudioAnalyzer.destroy(),this.botAudioAnalyzer=null),this.userAudioAnalyzer&&(this.userAudioAnalyzer.destroy(),this.userAudioAnalyzer=null),this.userMicStreamRequestId++,this.userMicStream&&(this.userMicStream.getTracks().forEach(n=>n.stop()),this.userMicStream=null),this.audioLevels=[],this.reactRoot&&(this.reactRoot.unmount(),this.reactRoot=null),this.reactContainer&&(this.reactContainer.remove(),this.reactContainer=null),this.overlay.remove(),this.isInitialized=!1,this.isConnected=!1,this.agentState="idle",this.logger.log("[OnboardingSDK] Disconnected"),this.emit("disconnected")}}typeof window<"u"&&(window.OnboardingSDK=Nv);function k_(t){return{clientKey:t.clientKey,...t.apiUrl!==void 0&&{apiUrl:t.apiUrl},enableVideo:!1,enableAudio:t.enableAudio??!0,enableScreenCapture:t.enableScreenCapture??!0,debug:t.debug??!1,industry:t.industry,useCase:t.useCase,companyName:t.companyName,companySize:t.companySize,role:t.role,userInfo:t.userInfo,skipOnboardingModal:t.skipOnboardingModal,enableDiscoveryPopup:!0,nudge:t.nudge?{text:t.nudge.text??"Hi 👋 How can I help you today?",autoShow:t.nudge.autoShow??!0,autoHideDelay:t.nudge.autoHideDelay??0}:void 0}}function $v(t){if(!t.clientKey)throw new Error("[Floe] clientKey is required");const e=k_(t),n=_d(e.debug??!1),r=new Nv(e,n);return r.ready=r.init().catch(i=>{throw n.error("[Floe] Initialization failed:",i),i}),r}return typeof window<"u"&&(window.Floe=$v),pn.Floe=$v,Object.defineProperty(pn,Symbol.toStringTag,{value:"Module"}),pn}({});
977
987
  //# sourceMappingURL=floe-sdk.iife.js.map