@floe-ai/sdk 0.1.0-dev.26 → 0.1.0-dev.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/floe-sdk.es.js +1694 -1780
- package/dist-sdk/floe-sdk.es.js.map +1 -1
- package/dist-sdk/floe-sdk.iife.js +46 -46
- package/dist-sdk/floe-sdk.iife.js.map +1 -1
- package/dist-sdk/floe-sdk.umd.js +46 -46
- package/dist-sdk/floe-sdk.umd.js.map +1 -1
- package/dist-sdk/index.d.ts +5 -10
- package/package.json +1 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
var FloeSDK=function(dn){"use strict";var Kx=Object.defineProperty;var Wx=(dn,Xt,On)=>Xt in dn?Kx(dn,Xt,{enumerable:!0,configurable:!0,writable:!0,value:On}):dn[Xt]=On;var L=(dn,Xt,On)=>Wx(dn,typeof Xt!="symbol"?Xt+"":Xt,On);function Xt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var On={exports:{}},Br=typeof Reflect=="object"?Reflect:null,bd=Br&&typeof Br.apply=="function"?Br.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},Bo;Br&&typeof Br.ownKeys=="function"?Bo=Br.ownKeys:Object.getOwnPropertySymbols?Bo=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Bo=function(e){return Object.getOwnPropertyNames(e)};function wy(t){console&&console.warn&&console.warn(t)}var wd=Number.isNaN||function(e){return e!==e};function we(){we.init.call(this)}On.exports=we,On.exports.once=_y,we.EventEmitter=we,we.prototype._events=void 0,we.prototype._eventsCount=0,we.prototype._maxListeners=void 0;var Sd=10;function Uo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(we,"defaultMaxListeners",{enumerable:!0,get:function(){return Sd},set:function(t){if(typeof t!="number"||t<0||wd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Sd=t}}),we.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},we.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||wd(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 kd(t){return t._maxListeners===void 0?we.defaultMaxListeners:t._maxListeners}we.prototype.getMaxListeners=function(){return kd(this)},we.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")bd(l,this,n);else for(var c=l.length,d=Td(l,c),r=0;r<c;++r)bd(d[r],this,n);return!0};function xd(t,e,n,r){var i,o,s;if(Uo(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=kd(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,wy(a)}return t}we.prototype.addListener=function(e,n){return xd(this,e,n,!1)},we.prototype.on=we.prototype.addListener,we.prototype.prependListener=function(e,n){return xd(this,e,n,!0)};function Sy(){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(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=Sy.bind(r);return i.listener=n,r.wrapFn=i,i}we.prototype.once=function(e,n){return Uo(n),this.on(e,_d(this,e,n)),this},we.prototype.prependOnceListener=function(e,n){return Uo(n),this.prependListener(e,_d(this,e,n)),this},we.prototype.removeListener=function(e,n){var r,i,o,s,a;if(Uo(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():ky(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this},we.prototype.off=we.prototype.removeListener,we.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 Cd(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?xy(i):Td(i,i.length)}we.prototype.listeners=function(e){return Cd(this,e,!0)},we.prototype.rawListeners=function(e){return Cd(this,e,!1)},we.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ed.call(t,e)},we.prototype.listenerCount=Ed;function Ed(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}we.prototype.eventNames=function(){return this._eventsCount>0?Bo(this._events):[]};function Td(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function ky(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function xy(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function _y(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))}Md(t,e,o,{once:!0}),e!=="error"&&Cy(t,i,{once:!0})})}function Cy(t,e,n){typeof t.on=="function"&&Md(t,"error",e,n)}function Md(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 Ey=On.exports;const Ty=Xt(Ey);for(var He=[],Va=0;Va<256;++Va)He.push((Va+256).toString(16).slice(1));function My(t,e=0){return(He[t[e+0]]+He[t[e+1]]+He[t[e+2]]+He[t[e+3]]+"-"+He[t[e+4]]+He[t[e+5]]+"-"+He[t[e+6]]+He[t[e+7]]+"-"+He[t[e+8]]+He[t[e+9]]+"-"+He[t[e+10]]+He[t[e+11]]+He[t[e+12]]+He[t[e+13]]+He[t[e+14]]+He[t[e+15]]).toLowerCase()}var zo,Ay=new Uint8Array(16);function Oy(){if(!zo&&(zo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!zo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zo(Ay)}var Dy=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ad={randomUUID:Dy};function Py(t,e,n){if(Ad.randomUUID&&!e&&!t)return Ad.randomUUID();t=t||{};var r=t.random||(t.rng||Oy)();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 My(r)}const Ly={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"},Od={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"},X={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},Je={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"},Dn={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),f=c+new Array(d+1).join(".0");return T.map(f.split("."),h=>new Array(20-h.length).join("0")+h).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 Ly[e]}static getBrowserTypeByAlias(e){return Od[e]||""}}const Z=/version\/(\d+(\.?_?\d+)+)/i,Iy=[{test:[/gptbot/i],describe(t){const e={name:"GPTBot"},n=T.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=T.getFirstMatch(Z,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(Z,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(Z,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(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=T.getFirstMatch(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=T.getFirstMatch(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=T.getFirstMatch(Z,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=T.getFirstMatch(Z,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)}}}],Ry=[{test:[/Roku\/DVP/],describe(t){const e=T.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Je.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=T.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Je.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:Je.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Je.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:Je.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:Je.iOS,version:e}}},{test:[/OpenHarmony/i],describe(t){const e=T.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:Je.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:Je.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:Je.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:Je.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=T.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Je.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=T.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Je.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Je.Linux}}},{test:[/CrOS/],describe(){return{name:Je.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=T.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Je.PlayStation4,version:e}}}],Ny=[{test:[/googlebot/i],describe(){return{type:X.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:X.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:X.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:X.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:X.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:X.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:X.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:X.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:X.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:X.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:X.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:X.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:X.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:X.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:X.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:X.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:X.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:X.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:X.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:X.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(t){const e=T.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:X.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:X.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:X.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:X.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:X.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:X.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:X.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:X.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:X.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=T.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:X.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:X.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:X.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:X.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:X.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:X.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:X.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:X.tv}}},{test:[/netcast/i],describe(){return{type:X.tv}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:X.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:X.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:X.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:X.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:X.tv}}}],$y=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Dn.Blink};const n=T.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Dn.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:Dn.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:Dn.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:Dn.Gecko},n=T.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Dn.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:Dn.WebKit},n=T.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class Dd{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(Iy,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(Ry,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(Ny,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($y,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(dn){"use strict";var e_=Object.defineProperty;var t_=(dn,Xt,On)=>Xt in dn?e_(dn,Xt,{enumerable:!0,configurable:!0,writable:!0,value:On}):dn[Xt]=On;var L=(dn,Xt,On)=>t_(dn,typeof Xt!="symbol"?Xt+"":Xt,On);function Xt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var On={exports:{}},Br=typeof Reflect=="object"?Reflect:null,wd=Br&&typeof Br.apply=="function"?Br.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},Uo;Br&&typeof Br.ownKeys=="function"?Uo=Br.ownKeys:Object.getOwnPropertySymbols?Uo=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Uo=function(e){return Object.getOwnPropertyNames(e)};function ky(t){console&&console.warn&&console.warn(t)}var Sd=Number.isNaN||function(e){return e!==e};function we(){we.init.call(this)}On.exports=we,On.exports.once=Ey,we.EventEmitter=we,we.prototype._events=void 0,we.prototype._eventsCount=0,we.prototype._maxListeners=void 0;var kd=10;function zo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(we,"defaultMaxListeners",{enumerable:!0,get:function(){return kd},set:function(t){if(typeof t!="number"||t<0||Sd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");kd=t}}),we.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},we.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Sd(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 xd(t){return t._maxListeners===void 0?we.defaultMaxListeners:t._maxListeners}we.prototype.getMaxListeners=function(){return xd(this)},we.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")wd(l,this,n);else for(var c=l.length,d=Md(l,c),r=0;r<c;++r)wd(d[r],this,n);return!0};function _d(t,e,n,r){var i,o,s;if(zo(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=xd(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,ky(a)}return t}we.prototype.addListener=function(e,n){return _d(this,e,n,!1)},we.prototype.on=we.prototype.addListener,we.prototype.prependListener=function(e,n){return _d(this,e,n,!0)};function xy(){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 Cd(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=xy.bind(r);return i.listener=n,r.wrapFn=i,i}we.prototype.once=function(e,n){return zo(n),this.on(e,Cd(this,e,n)),this},we.prototype.prependOnceListener=function(e,n){return zo(n),this.prependListener(e,Cd(this,e,n)),this},we.prototype.removeListener=function(e,n){var r,i,o,s,a;if(zo(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():_y(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this},we.prototype.off=we.prototype.removeListener,we.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 Ed(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?Cy(i):Md(i,i.length)}we.prototype.listeners=function(e){return Ed(this,e,!0)},we.prototype.rawListeners=function(e){return Ed(this,e,!1)},we.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Td.call(t,e)},we.prototype.listenerCount=Td;function Td(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}we.prototype.eventNames=function(){return this._eventsCount>0?Uo(this._events):[]};function Md(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function _y(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Cy(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function Ey(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))}Ad(t,e,o,{once:!0}),e!=="error"&&Ty(t,i,{once:!0})})}function Ty(t,e,n){typeof t.on=="function"&&Ad(t,"error",e,n)}function Ad(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 My=On.exports;const Ay=Xt(My);for(var He=[],Ka=0;Ka<256;++Ka)He.push((Ka+256).toString(16).slice(1));function Oy(t,e=0){return(He[t[e+0]]+He[t[e+1]]+He[t[e+2]]+He[t[e+3]]+"-"+He[t[e+4]]+He[t[e+5]]+"-"+He[t[e+6]]+He[t[e+7]]+"-"+He[t[e+8]]+He[t[e+9]]+"-"+He[t[e+10]]+He[t[e+11]]+He[t[e+12]]+He[t[e+13]]+He[t[e+14]]+He[t[e+15]]).toLowerCase()}var Ho,Dy=new Uint8Array(16);function Py(){if(!Ho&&(Ho=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ho))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ho(Dy)}var Ly=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Od={randomUUID:Ly};function Iy(t,e,n){if(Od.randomUUID&&!e&&!t)return Od.randomUUID();t=t||{};var r=t.random||(t.rng||Py)();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 Oy(r)}const Ry={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"},Dd={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"},X={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},Je={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"},Dn={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),f=c+new Array(d+1).join(".0");return T.map(f.split("."),h=>new Array(20-h.length).join("0")+h).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 Ry[e]}static getBrowserTypeByAlias(e){return Dd[e]||""}}const Z=/version\/(\d+(\.?_?\d+)+)/i,Ny=[{test:[/gptbot/i],describe(t){const e={name:"GPTBot"},n=T.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||T.getFirstMatch(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=T.getFirstMatch(Z,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(Z,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(Z,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(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=T.getFirstMatch(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=T.getFirstMatch(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,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(Z,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=T.getFirstMatch(Z,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=T.getFirstMatch(Z,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)}}}],$y=[{test:[/Roku\/DVP/],describe(t){const e=T.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Je.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=T.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Je.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:Je.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Je.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:Je.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:Je.iOS,version:e}}},{test:[/OpenHarmony/i],describe(t){const e=T.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:Je.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:Je.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:Je.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:Je.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=T.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Je.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=T.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Je.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Je.Linux}}},{test:[/CrOS/],describe(){return{name:Je.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=T.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Je.PlayStation4,version:e}}}],Fy=[{test:[/googlebot/i],describe(){return{type:X.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:X.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:X.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:X.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:X.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:X.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:X.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:X.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:X.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:X.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:X.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:X.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:X.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:X.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:X.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:X.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:X.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:X.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:X.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:X.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:X.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(t){const e=T.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:X.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:X.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:X.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:X.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:X.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:X.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:X.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:X.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:X.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=T.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:X.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:X.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:X.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:X.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:X.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:X.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:X.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:X.tv}}},{test:[/netcast/i],describe(){return{type:X.tv}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:X.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:X.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:X.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:X.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:X.tv}}}],jy=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Dn.Blink};const n=T.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Dn.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:Dn.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:Dn.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:Dn.Gecko},n=T.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Dn.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:Dn.WebKit},n=T.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class Pd{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(Ny,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($y,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(Fy,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(jy,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))}}/*!
|
|
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 Fy{static getParser(e,n=!1,r=null){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Dd(e,n,r)}static parse(e,n=null){return new Dd(e,n).getResult()}static get BROWSER_MAP(){return Od}static get ENGINE_MAP(){return Dn}static get OS_MAP(){return Je}static get PLATFORMS_MAP(){return X}}function Zt(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 jy(t){return t&&t.__esModule?t.default:t}function Se(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Ur={},Pd={};Se(Pd,"PipecatClient",()=>Ft);var zr={};zr=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.6.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web.git"},"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 Ho={},Ld={};Se(Ld,"TransportStateEnum",()=>Ka);var Ka;(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"})(Ka||(Ka={}));var $t={};Se($t,"RTVIError",()=>ct),Se($t,"ConnectionTimeoutError",()=>By),Se($t,"StartBotError",()=>Id),Se($t,"TransportStartError",()=>Rd),Se($t,"InvalidTransportParamsError",()=>Uy),Se($t,"BotNotReadyError",()=>Nd),Se($t,"BotAlreadyStartedError",()=>$d),Se($t,"UnsupportedFeatureError",()=>zy),Se($t,"MessageTooLargeError",()=>Fd),Se($t,"DeviceError",()=>fn);class ct extends Error{constructor(e,n){super(e),this.status=n}}class By extends ct{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class Id extends ct{constructor(e,n){super(e??"Failed to connect / invalid auth bundle from base url",n??500),this.error="invalid-request-error"}}class Rd extends ct{constructor(e){super(e??"Unable to connect to transport")}}class Uy extends ct{constructor(e){super(e??"Invalid transport connection parameters")}}class Nd extends ct{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class $d extends ct{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class zy extends ct{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 Fd extends ct{constructor(e){super(e??"Message size exceeds the maximum allowed limit for transport.")}}class fn extends ct{constructor(e,n,r,i){super(r??`Device error for ${e.join(", ")}: ${n}`),this.devices=e,this.type=n,this.details=i}}var jd={};Se(jd,"RTVIEvent",()=>Y);var Y;(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"})(Y||(Y={}));var cr={};Se(cr,"RTVI_PROTOCOL_VERSION",()=>Bd),Se(cr,"RTVI_MESSAGE_LABEL",()=>Ud),Se(cr,"RTVIMessageType",()=>se),Se(cr,"AggregationType",()=>Wa),Se(cr,"setAboutClient",()=>zd),Se(cr,"RTVIMessage",()=>je);const Bd="1.2.0",Ud="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 Wa;(function(t){t.WORD="word",t.SENTENCE="sentence"})(Wa||(Wa={}));let Pi;function zd(t){Pi?Pi={...Pi,...t}:Pi=t}class je{constructor(e,n,r){this.label=Ud,this.type=e,this.data=n,this.id=r||Py().slice(0,8)}static clientReady(){return new je(se.CLIENT_READY,{version:Bd,about:Pi||{library:zr.name,library_version:zr.version}})}static disconnectBot(){return new je(se.DISCONNECT_BOT,{})}static error(e,n=!1){return new je(se.ERROR,{message:e,fatal:n})}}Zt(Ho,Ld),Zt(Ho,$t),Zt(Ho,jd),Zt(Ho,cr);function Li(t,e,n){const r=n.value;return n.value=function(...i){if(this.state==="ready")return r.apply(this,i);throw new Nd(`Attempt to call ${e.toString()} when transport not in ready state. Await connect() first.`)},n}function qa(t,e,n){const r=n.value,i=["authenticating","connecting","connected","ready"];return n.value=function(...o){if(i.includes(this.state))throw new $d(`Attempt to call ${e.toString()} when client already started. Please call disconnect() before starting again.`);return r.apply(this,o)},n}var Hd={};Se(Hd,"MessageDispatcher",()=>Vd);var Ja={};Se(Ja,"LogLevel",()=>Pn),Se(Ja,"logger",()=>de);var Pn;(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"})(Pn||(Pn={}));class Hr{constructor(){this.level=Pn.DEBUG}static getInstance(){return Hr.instance||(Hr.instance=new Hr),Hr.instance}setLevel(e){this.level=e}debug(...e){this.level>=Pn.DEBUG&&console.debug(...e)}info(...e){this.level>=Pn.INFO&&console.info(...e)}warn(...e){this.level>=Pn.WARN&&console.warn(...e)}error(...e){this.level>=Pn.ERROR&&console.error(...e)}}const de=Hr.getInstance();class Vd{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 je(n,e),o=new Promise((s,a)=>{this._queue.push({message:i,timestamp:Date.now(),timeout:r,resolve:s,reject:a})});de.debug("[MessageDispatcher] dispatch",i);try{this._sendMethod(i)}catch(s){return de.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?(de.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(de.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(i=>i.message.id!==e.id),de.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 je(se.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:n.message.data.t,data:n.message.data.d,fatal:!1}))}),de.debug("[MessageDispatcher] GC",this._queue)}}var Ga={};Se(Ga,"isAPIRequest",()=>Kd),Se(Ga,"makeRequest",()=>Wd);function Kd(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 Wd(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&&de.warn("[Pipecat Client] requestData in APIRequest is ignored when endpoint is a Request object"),t.headers&&de.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}),de.debug(`[Pipecat Client] Fetching from ${o.url}`),fetch(o).then(s=>{if(de.debug(`[Pipecat Client] Received response from ${o.url}`,s),!s.ok){i(s);return}return s.json()}).then(s=>{r(s)}).catch(s=>{de.error(`[Pipecat Client] Error fetching: ${s}`),i(s)}).finally(()=>{n&&clearTimeout(n)})})()})}var Qa={};Se(Qa,"Transport",()=>qd),Se(Qa,"TransportWrapper",()=>Jd);class qd{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 ct(`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 Jd{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 Ya={};Se(Ya,"learnAboutClient",()=>Gd),Se(Ya,"messageSizeWithinLimit",()=>Qd);function Gd(){var n,r,i,o,s,a;let t={library:zr.name,library_version:zr.version,platform_details:{}},e=null;if((n=window==null?void 0:window.navigator)!=null&&n.userAgent)try{e=Fy.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 Qd(t,e){return(i=>{const o=JSON.stringify(i);return new TextEncoder().encode(o).length})(t)<=e}var Ln=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 Hy extends Ty{}class Ft extends Hy{constructor(e){super(),this._functionCallCallbacks={},this._botTranscriptionWarned=!1,this._llmFunctionCallWarned=!1,zd(Gd()),this._transport=e.transport,this._transportWrapper=new Jd(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(Y.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(Y.Error,r)}catch(l){l instanceof Error&&l.message.includes("Unhandled error")?(a=e==null?void 0:e.callbacks)!=null&&a.onError||de.debug("No onError callback registered to handle error",r):de.debug("Could not emit error",r,l)}const i=r.data;i!=null&&i.fatal&&(de.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(Y.Connected)},onDisconnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onDisconnected)==null||i.call(r),this.emit(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStoppedSpeaking)==null||i.call(r),this.emit(Y.UserStoppedSpeaking)},onBotStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStartedSpeaking)==null||i.call(r),this.emit(Y.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStoppedSpeaking)==null||i.call(r),this.emit(Y.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(Y.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(Y.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(Y.UserMuteStarted)},onUserMuteStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserMuteStopped)==null||i.call(r),this.emit(Y.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(Y.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(Y.BotOutput,r)},onBotTranscript:r=>{var i,o;this._botTranscriptionWarned||(de.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(Y.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(Y.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(Y.BotLlmStarted)},onBotLlmStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStopped)==null||i.call(r),this.emit(Y.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(Y.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(Y.BotTtsStarted)},onBotTtsStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStopped)==null||i.call(r),this.emit(Y.BotTtsStopped)}};this._options={...e,callbacks:n,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),de.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){de.setLevel(e)}async initDevices(){de.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 Wd(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 je(se.ERROR_RESPONSE,{message:l,fatal:!0})),new Id(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&&Kd(e)?(de.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 Vd(this._sendMessage.bind(this))}_sendMessage(e){var n,r,i,o,s,a;if(!Qd(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,je.error(l,!1)),new Fd(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,je.error(l.message,!1)):(a=(s=this._options.callbacks)==null?void 0:s.onError)==null||a.call(s,je.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 jy(zr).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 je(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 de.warn("appendToContext() is deprecated. Use sendText() instead."),await this._sendMessage(new je(se.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,n={}){await this._sendMessage(new je(se.SEND_TEXT,{content:e,options:n}))}disconnectBot(){this._sendMessage(new je(se.DISCONNECT_BOT,{}))}handleMessage(e){var n,r,i,o,s,a,l,c,d,f,h,b,y,m,S,v,w,k,C,M,O,D,F,J,W,U,V,q,ie,H,G,ne,R,j,Q,ae,ve,u,g,p,x,_,A,P,$,B,te,ue,lt,cn,un,Re;switch(de.debug("[RTVI Message]",e),e.type){case se.BOT_READY:{const le=e.data,Yt=le.version?le.version.split(".").map(Number):[0,0,0];de.debug(`[Pipecat Client] Bot is ready. Version: ${le.version}`),Yt[0]<1&&de.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 le=this._messageDispatcher.reject(e);(l=(a=this._options.callbacks)==null?void 0:a.onMessageError)==null||l.call(a,le);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:(h=(f=this._options.callbacks)==null?void 0:f.onUserStoppedSpeaking)==null||h.call(f);break;case se.BOT_STARTED_SPEAKING:(y=(b=this._options.callbacks)==null?void 0:b.onBotStartedSpeaking)==null||y.call(b);break;case se.BOT_STOPPED_SPEAKING:(S=(m=this._options.callbacks)==null?void 0:m.onBotStoppedSpeaking)==null||S.call(m);break;case se.USER_MUTE_STARTED:(w=(v=this._options.callbacks)==null?void 0:v.onUserMuteStarted)==null||w.call(v);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 le=e.data;(O=(M=this._options.callbacks)==null?void 0:M.onUserTranscript)==null||O.call(M,le);break}case se.BOT_OUTPUT:(F=(D=this._options.callbacks)==null?void 0:D.onBotOutput)==null||F.call(D,e.data);break;case se.BOT_TRANSCRIPTION:(W=(J=this._options.callbacks)==null?void 0:J.onBotTranscript)==null||W.call(J,e.data);break;case se.BOT_LLM_TEXT:(V=(U=this._options.callbacks)==null?void 0:U.onBotLlmText)==null||V.call(U,e.data);break;case se.BOT_LLM_STARTED:(ie=(q=this._options.callbacks)==null?void 0:q.onBotLlmStarted)==null||ie.call(q);break;case se.BOT_LLM_STOPPED:(G=(H=this._options.callbacks)==null?void 0:H.onBotLlmStopped)==null||G.call(H);break;case se.BOT_TTS_TEXT:(R=(ne=this._options.callbacks)==null?void 0:ne.onBotTtsText)==null||R.call(ne,e.data);break;case se.BOT_TTS_STARTED:(Q=(j=this._options.callbacks)==null?void 0:j.onBotTtsStarted)==null||Q.call(j);break;case se.BOT_TTS_STOPPED:(ve=(ae=this._options.callbacks)==null?void 0:ae.onBotTtsStopped)==null||ve.call(ae);break;case se.METRICS:(g=(u=this._options.callbacks)==null?void 0:u.onMetrics)==null||g.call(u,e.data),this.emit(Y.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(Y.ServerMessage,e.data);break;case se.LLM_FUNCTION_CALL_STARTED:{const le=e.data;(A=(_=this._options.callbacks)==null?void 0:_.onLLMFunctionCallStarted)==null||A.call(_,le),this.emit(Y.LLMFunctionCallStarted,le);break}case se.LLM_FUNCTION_CALL_IN_PROGRESS:{const le=e.data;this._maybeTriggerFunctionCallCallback(le),($=(P=this._options.callbacks)==null?void 0:P.onLLMFunctionCallInProgress)==null||$.call(P,le),this.emit(Y.LLMFunctionCallInProgress,le);break}case se.LLM_FUNCTION_CALL_STOPPED:{const le=e.data;(te=(B=this._options.callbacks)==null?void 0:B.onLLMFunctionCallStopped)==null||te.call(B,le),this.emit(Y.LLMFunctionCallStopped,le);break}case se.LLM_FUNCTION_CALL:{const le=e.data,Yt={function_name:le.function_name,tool_call_id:le.tool_call_id,arguments:le.args};this._maybeTriggerFunctionCallCallback(Yt),(ue=this._options.callbacks)!=null&&ue.onLLMFunctionCall&&(this._llmFunctionCallWarned||(de.warn("[Pipecat Client] onLLMFunctionCall is deprecated. Please use onLLMFunctionCallInProgress instead."),this._llmFunctionCallWarned=!0)),(cn=(lt=this._options.callbacks)==null?void 0:lt.onLLMFunctionCall)==null||cn.call(lt,le),this.emit(Y.LLMFunctionCall,le);break}case se.BOT_LLM_SEARCH_RESPONSE:{const le=e.data;(Re=(un=this._options.callbacks)==null?void 0:un.onBotLlmSearchResponse)==null||Re.call(un,le),this.emit(Y.BotLlmSearchResponse,le);break}default:de.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 je(se.LLM_FUNCTION_CALL_RESULT,{function_name:e.function_name,tool_call_id:e.tool_call_id,arguments:e.arguments??{},result:i}))}).catch(i=>{de.error("Error in function call callback",i)})}}}Ln([qa],Ft.prototype,"startBot",null),Ln([qa],Ft.prototype,"connect",null),Ln([qa],Ft.prototype,"startBotAndConnect",null),Ln([Li],Ft.prototype,"sendClientMessage",null),Ln([Li],Ft.prototype,"sendClientRequest",null),Ln([Li],Ft.prototype,"appendToContext",null),Ln([Li],Ft.prototype,"sendText",null),Ln([Li],Ft.prototype,"disconnectBot",null),Zt(Ur,Pd),Zt(Ur,Hd),Zt(Ur,Ja),Zt(Ur,Ga),Zt(Ur,Qa),Zt(Ur,Ya);function Yd(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 gt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pe(t){return pe=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},pe(t)}function Xd(t){var e=function(n,r){if(pe(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r);if(pe(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return pe(e)=="symbol"?e:e+""}function Zd(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,Xd(r.key),r)}}function mt(t,e,n){return e&&Zd(t.prototype,e),n&&Zd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vo(t,e){if(e&&(pe(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 jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jt(t)}function Ii(t,e){return Ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ii(t,e)}function Ko(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&&Ii(t,e)}function en(t,e,n){return(e=Xd(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ef(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 ee(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(l){ef(o,r,i,s,a,"next",l)}function a(l){ef(o,r,i,s,a,"throw",l)}s(void 0)})}}function tf(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 Ge(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,f=!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(h){f=!0,s=h}finally{try{if(!d&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(f)throw s}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return tf(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)?tf(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 Vy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nf,Wo={exports:{}},Xa=function(){if(nf)return Wo.exports;nf=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)}Wo.exports=i,Wo.exports.once=function(m,S){return new Promise(function(v,w){function k(M){m.removeListener(S,C),w(M)}function C(){typeof m.removeListener=="function"&&m.removeListener("error",k),v([].slice.call(arguments))}y(m,S,C,{once:!0}),S!=="error"&&function(M,O,D){typeof M.on=="function"&&y(M,"error",O,D)}(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,M,O;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),M=C[S]),M===void 0)M=C[S]=v,++m._eventsCount;else if(typeof M=="function"?M=C[S]=w?[v,M]:[M,v]:w?M.unshift(v):M.push(v),(k=a(m))>0&&M.length>k&&!M.warned){M.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=m,D.type=S,D.count=M.length,O=D,console&&console.warn&&console.warn(O)}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 f(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 M=new Array(C.length),O=0;O<M.length;++O)M[O]=C[O].listener||C[O];return M}(k):b(k,k.length)}function h(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 b(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 M=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw M.context=C,M}var O=k[m];if(O===void 0)return!1;if(typeof O=="function")n(O,this,S);else{var D=O.length,F=b(O,D);for(v=0;v<D;++v)n(F[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,M;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){M=v[C].listener,k=C;break}if(k<0)return this;k===0?v.shift():function(O,D){for(;D+1<O.length;D++)O[D]=O[D+1];O.pop()}(v,k),v.length===1&&(w[m]=v[0]),w.removeListener!==void 0&&this.emit("removeListener",m,M||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 f(this,m,!0)},i.prototype.rawListeners=function(m){return f(this,m,!1)},i.listenerCount=function(m,S){return typeof m.listenerCount=="function"?m.listenerCount(S):h.call(m,S)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},Wo.exports}(),qo=Vy(Xa),rf=Object.prototype.hasOwnProperty;function of(t,e,n){for(n of t.keys())if(tt(n,e))return n}function tt(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--&&tt(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=of(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=of(e,i))||!tt(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(rf.call(t,n)&&++r&&!rf.call(e,n)||!(n in e)||!tt(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!=t&&e!=e}const Ky={"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"},sf={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"},Le={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},nt={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"},In={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};let I=class Di{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=Di.getVersionPrecision(e),o=Di.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=Di.map([e,n],c=>{const d=s-Di.getVersionPrecision(c),f=c+new Array(d+1).join(".0");return Di.map(f.split("."),h=>new Array(20-h.length).join("0")+h).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 Ky[e]}static getBrowserTypeByAlias(e){return sf[e]||""}};const ke=/version\/(\d+(\.?_?\d+)+)/i,Wy=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=I.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=I.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=I.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=I.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=I.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=I.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=I.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,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=I.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=I.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=I.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=I.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=I.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=I.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=I.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=I.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=I.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=I.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=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=I.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=I.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=I.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=I.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=I.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=I.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=I.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=I.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=I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:I.getFirstMatch(e,t),version:I.getSecondMatch(e,t)}}}];var qy=[{test:[/Roku\/DVP/],describe(t){const e=I.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:nt.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=I.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:nt.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=I.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=I.getWindowsVersionName(e);return{name:nt.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:nt.iOS},n=I.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=I.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=I.getMacOSVersionName(e),r={name:nt.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=I.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:nt.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=I.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=I.getAndroidVersionName(e),r={name:nt.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=I.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:nt.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=I.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||I.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||I.getFirstMatch(/\bbb(\d+)/i,t);return{name:nt.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=I.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:nt.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=I.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:nt.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:nt.Linux})},{test:[/CrOS/],describe:()=>({name:nt.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=I.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:nt.PlayStation4,version:e}}}],Jy=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=I.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Le.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Le.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Le.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Le.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Le.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Le.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Le.tablet})},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=I.getFirstMatch(/(ipod|iphone)/i,t);return{type:Le.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Le.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Le.mobile})},{test:t=>t.getBrowserName(!0)==="blackberry",describe:()=>({type:Le.mobile,vendor:"BlackBerry"})},{test:t=>t.getBrowserName(!0)==="bada",describe:()=>({type:Le.mobile})},{test:t=>t.getBrowserName()==="windows phone",describe:()=>({type:Le.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe:()=>({type:Le.tablet})},{test:t=>t.getOSName(!0)==="android",describe:()=>({type:Le.mobile})},{test:t=>t.getOSName(!0)==="macos",describe:()=>({type:Le.desktop,vendor:"Apple"})},{test:t=>t.getOSName(!0)==="windows",describe:()=>({type:Le.desktop})},{test:t=>t.getOSName(!0)==="linux",describe:()=>({type:Le.desktop})},{test:t=>t.getOSName(!0)==="playstation 4",describe:()=>({type:Le.tv})},{test:t=>t.getOSName(!0)==="roku",describe:()=>({type:Le.tv})}],Gy=[{test:t=>t.getBrowserName(!0)==="microsoft edge",describe(t){if(/\sedg\//i.test(t))return{name:In.Blink};const e=I.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:In.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:In.Trident},n=I.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:In.Presto},n=I.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=I.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:In.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:In.WebKit},n=I.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];let af=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=I.find(Wy,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=I.find(qy,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=I.find(Jy,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=I.find(Gy,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 I.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=I.find(s,c=>this.isOS(c));if(a){const c=this.satisfies(n[a]);if(c!==void 0)return c}const l=I.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=I.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=I.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(I.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 By{static getParser(e,n=!1,r=null){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Pd(e,n,r)}static parse(e,n=null){return new Pd(e,n).getResult()}static get BROWSER_MAP(){return Dd}static get ENGINE_MAP(){return Dn}static get OS_MAP(){return Je}static get PLATFORMS_MAP(){return X}}function Zt(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 Uy(t){return t&&t.__esModule?t.default:t}function Se(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Ur={},Ld={};Se(Ld,"PipecatClient",()=>Ft);var zr={};zr=JSON.parse('{"name":"@pipecat-ai/client-js","version":"1.6.0","license":"BSD-2-Clause","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","source":"index.ts","repository":{"type":"git","url":"git+https://github.com/pipecat-ai/pipecat-client-web.git"},"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 Vo={},Id={};Se(Id,"TransportStateEnum",()=>Wa);var Wa;(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"})(Wa||(Wa={}));var $t={};Se($t,"RTVIError",()=>ct),Se($t,"ConnectionTimeoutError",()=>zy),Se($t,"StartBotError",()=>Rd),Se($t,"TransportStartError",()=>Nd),Se($t,"InvalidTransportParamsError",()=>Hy),Se($t,"BotNotReadyError",()=>$d),Se($t,"BotAlreadyStartedError",()=>Fd),Se($t,"UnsupportedFeatureError",()=>Vy),Se($t,"MessageTooLargeError",()=>jd),Se($t,"DeviceError",()=>fn);class ct extends Error{constructor(e,n){super(e),this.status=n}}class zy extends ct{constructor(e){super(e??"Bot did not enter ready state within the specified timeout period.")}}class Rd extends ct{constructor(e,n){super(e??"Failed to connect / invalid auth bundle from base url",n??500),this.error="invalid-request-error"}}class Nd extends ct{constructor(e){super(e??"Unable to connect to transport")}}class Hy extends ct{constructor(e){super(e??"Invalid transport connection parameters")}}class $d extends ct{constructor(e){super(e??"Attempt to call action on transport when not in 'ready' state.")}}class Fd extends ct{constructor(e){super(e??"Pipecat client has already been started. Please call disconnect() before starting again.")}}class Vy extends ct{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 ct{constructor(e){super(e??"Message size exceeds the maximum allowed limit for transport.")}}class fn extends ct{constructor(e,n,r,i){super(r??`Device error for ${e.join(", ")}: ${n}`),this.devices=e,this.type=n,this.details=i}}var Bd={};Se(Bd,"RTVIEvent",()=>Y);var Y;(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"})(Y||(Y={}));var cr={};Se(cr,"RTVI_PROTOCOL_VERSION",()=>Ud),Se(cr,"RTVI_MESSAGE_LABEL",()=>zd),Se(cr,"RTVIMessageType",()=>se),Se(cr,"AggregationType",()=>qa),Se(cr,"setAboutClient",()=>Hd),Se(cr,"RTVIMessage",()=>je);const Ud="1.2.0",zd="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 qa;(function(t){t.WORD="word",t.SENTENCE="sentence"})(qa||(qa={}));let Pi;function Hd(t){Pi?Pi={...Pi,...t}:Pi=t}class je{constructor(e,n,r){this.label=zd,this.type=e,this.data=n,this.id=r||Iy().slice(0,8)}static clientReady(){return new je(se.CLIENT_READY,{version:Ud,about:Pi||{library:zr.name,library_version:zr.version}})}static disconnectBot(){return new je(se.DISCONNECT_BOT,{})}static error(e,n=!1){return new je(se.ERROR,{message:e,fatal:n})}}Zt(Vo,Id),Zt(Vo,$t),Zt(Vo,Bd),Zt(Vo,cr);function Li(t,e,n){const r=n.value;return n.value=function(...i){if(this.state==="ready")return r.apply(this,i);throw new $d(`Attempt to call ${e.toString()} when transport not in ready state. Await connect() first.`)},n}function Ja(t,e,n){const r=n.value,i=["authenticating","connecting","connected","ready"];return n.value=function(...o){if(i.includes(this.state))throw new Fd(`Attempt to call ${e.toString()} when client already started. Please call disconnect() before starting again.`);return r.apply(this,o)},n}var Vd={};Se(Vd,"MessageDispatcher",()=>Kd);var Ga={};Se(Ga,"LogLevel",()=>Pn),Se(Ga,"logger",()=>de);var Pn;(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"})(Pn||(Pn={}));class Hr{constructor(){this.level=Pn.DEBUG}static getInstance(){return Hr.instance||(Hr.instance=new Hr),Hr.instance}setLevel(e){this.level=e}debug(...e){this.level>=Pn.DEBUG&&console.debug(...e)}info(...e){this.level>=Pn.INFO&&console.info(...e)}warn(...e){this.level>=Pn.WARN&&console.warn(...e)}error(...e){this.level>=Pn.ERROR&&console.error(...e)}}const de=Hr.getInstance();class Kd{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 je(n,e),o=new Promise((s,a)=>{this._queue.push({message:i,timestamp:Date.now(),timeout:r,resolve:s,reject:a})});de.debug("[MessageDispatcher] dispatch",i);try{this._sendMethod(i)}catch(s){return de.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?(de.debug("[MessageDispatcher] Resolve",e),r.resolve(e)):(de.debug("[MessageDispatcher] Reject",e),r.reject(e)),this._queue=this._queue.filter(i=>i.message.id!==e.id),de.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 je(se.ERROR_RESPONSE,{error:"Timed out waiting for response",msgType:n.message.data.t,data:n.message.data.d,fatal:!1}))}),de.debug("[MessageDispatcher] GC",this._queue)}}var Qa={};Se(Qa,"isAPIRequest",()=>Wd),Se(Qa,"makeRequest",()=>qd);function Wd(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 qd(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&&de.warn("[Pipecat Client] requestData in APIRequest is ignored when endpoint is a Request object"),t.headers&&de.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}),de.debug(`[Pipecat Client] Fetching from ${o.url}`),fetch(o).then(s=>{if(de.debug(`[Pipecat Client] Received response from ${o.url}`,s),!s.ok){i(s);return}return s.json()}).then(s=>{r(s)}).catch(s=>{de.error(`[Pipecat Client] Error fetching: ${s}`),i(s)}).finally(()=>{n&&clearTimeout(n)})})()})}var Ya={};Se(Ya,"Transport",()=>Jd),Se(Ya,"TransportWrapper",()=>Gd);class Jd{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 ct(`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 Gd{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 Xa={};Se(Xa,"learnAboutClient",()=>Qd),Se(Xa,"messageSizeWithinLimit",()=>Yd);function Qd(){var n,r,i,o,s,a;let t={library:zr.name,library_version:zr.version,platform_details:{}},e=null;if((n=window==null?void 0:window.navigator)!=null&&n.userAgent)try{e=By.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 Yd(t,e){return(i=>{const o=JSON.stringify(i);return new TextEncoder().encode(o).length})(t)<=e}var Ln=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 Ky extends Ay{}class Ft extends Ky{constructor(e){super(),this._functionCallCallbacks={},this._botTranscriptionWarned=!1,this._llmFunctionCallWarned=!1,Hd(Qd()),this._transport=e.transport,this._transportWrapper=new Gd(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(Y.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(Y.Error,r)}catch(l){l instanceof Error&&l.message.includes("Unhandled error")?(a=e==null?void 0:e.callbacks)!=null&&a.onError||de.debug("No onError callback registered to handle error",r):de.debug("Could not emit error",r,l)}const i=r.data;i!=null&&i.fatal&&(de.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(Y.Connected)},onDisconnected:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onDisconnected)==null||i.call(r),this.emit(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.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(Y.UserStartedSpeaking)},onUserStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserStoppedSpeaking)==null||i.call(r),this.emit(Y.UserStoppedSpeaking)},onBotStartedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStartedSpeaking)==null||i.call(r),this.emit(Y.BotStartedSpeaking)},onBotStoppedSpeaking:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotStoppedSpeaking)==null||i.call(r),this.emit(Y.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(Y.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(Y.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(Y.UserMuteStarted)},onUserMuteStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onUserMuteStopped)==null||i.call(r),this.emit(Y.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(Y.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(Y.BotOutput,r)},onBotTranscript:r=>{var i,o;this._botTranscriptionWarned||(de.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(Y.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(Y.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(Y.BotLlmStarted)},onBotLlmStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotLlmStopped)==null||i.call(r),this.emit(Y.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(Y.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(Y.BotTtsStarted)},onBotTtsStopped:()=>{var r,i;(i=(r=e==null?void 0:e.callbacks)==null?void 0:r.onBotTtsStopped)==null||i.call(r),this.emit(Y.BotTtsStopped)}};this._options={...e,callbacks:n,enableMic:e.enableMic??!0,enableCam:e.enableCam??!1,enableScreenShare:e.enableScreenShare??!1},this._initialize(),de.debug("[Pipecat Client] Initialized",this.version)}setLogLevel(e){de.setLevel(e)}async initDevices(){de.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 qd(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 je(se.ERROR_RESPONSE,{message:l,fatal:!0})),new Rd(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&&Wd(e)?(de.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 Kd(this._sendMessage.bind(this))}_sendMessage(e){var n,r,i,o,s,a;if(!Yd(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,je.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,je.error(l.message,!1)):(a=(s=this._options.callbacks)==null?void 0:s.onError)==null||a.call(s,je.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 Uy(zr).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 je(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 de.warn("appendToContext() is deprecated. Use sendText() instead."),await this._sendMessage(new je(se.APPEND_TO_CONTEXT,{role:e.role,content:e.content,run_immediately:e.run_immediately})),!0}async sendText(e,n={}){await this._sendMessage(new je(se.SEND_TEXT,{content:e,options:n}))}disconnectBot(){this._sendMessage(new je(se.DISCONNECT_BOT,{}))}handleMessage(e){var n,r,i,o,s,a,l,c,d,f,h,b,y,v,S,m,w,k,C,M,O,D,F,J,W,U,V,q,ie,H,G,ne,R,j,Q,ae,ve,u,g,p,x,_,A,P,$,B,te,ue,lt,cn,un,Re;switch(de.debug("[RTVI Message]",e),e.type){case se.BOT_READY:{const le=e.data,Yt=le.version?le.version.split(".").map(Number):[0,0,0];de.debug(`[Pipecat Client] Bot is ready. Version: ${le.version}`),Yt[0]<1&&de.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 le=this._messageDispatcher.reject(e);(l=(a=this._options.callbacks)==null?void 0:a.onMessageError)==null||l.call(a,le);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:(h=(f=this._options.callbacks)==null?void 0:f.onUserStoppedSpeaking)==null||h.call(f);break;case se.BOT_STARTED_SPEAKING:(y=(b=this._options.callbacks)==null?void 0:b.onBotStartedSpeaking)==null||y.call(b);break;case se.BOT_STOPPED_SPEAKING:(S=(v=this._options.callbacks)==null?void 0:v.onBotStoppedSpeaking)==null||S.call(v);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 le=e.data;(O=(M=this._options.callbacks)==null?void 0:M.onUserTranscript)==null||O.call(M,le);break}case se.BOT_OUTPUT:(F=(D=this._options.callbacks)==null?void 0:D.onBotOutput)==null||F.call(D,e.data);break;case se.BOT_TRANSCRIPTION:(W=(J=this._options.callbacks)==null?void 0:J.onBotTranscript)==null||W.call(J,e.data);break;case se.BOT_LLM_TEXT:(V=(U=this._options.callbacks)==null?void 0:U.onBotLlmText)==null||V.call(U,e.data);break;case se.BOT_LLM_STARTED:(ie=(q=this._options.callbacks)==null?void 0:q.onBotLlmStarted)==null||ie.call(q);break;case se.BOT_LLM_STOPPED:(G=(H=this._options.callbacks)==null?void 0:H.onBotLlmStopped)==null||G.call(H);break;case se.BOT_TTS_TEXT:(R=(ne=this._options.callbacks)==null?void 0:ne.onBotTtsText)==null||R.call(ne,e.data);break;case se.BOT_TTS_STARTED:(Q=(j=this._options.callbacks)==null?void 0:j.onBotTtsStarted)==null||Q.call(j);break;case se.BOT_TTS_STOPPED:(ve=(ae=this._options.callbacks)==null?void 0:ae.onBotTtsStopped)==null||ve.call(ae);break;case se.METRICS:(g=(u=this._options.callbacks)==null?void 0:u.onMetrics)==null||g.call(u,e.data),this.emit(Y.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(Y.ServerMessage,e.data);break;case se.LLM_FUNCTION_CALL_STARTED:{const le=e.data;(A=(_=this._options.callbacks)==null?void 0:_.onLLMFunctionCallStarted)==null||A.call(_,le),this.emit(Y.LLMFunctionCallStarted,le);break}case se.LLM_FUNCTION_CALL_IN_PROGRESS:{const le=e.data;this._maybeTriggerFunctionCallCallback(le),($=(P=this._options.callbacks)==null?void 0:P.onLLMFunctionCallInProgress)==null||$.call(P,le),this.emit(Y.LLMFunctionCallInProgress,le);break}case se.LLM_FUNCTION_CALL_STOPPED:{const le=e.data;(te=(B=this._options.callbacks)==null?void 0:B.onLLMFunctionCallStopped)==null||te.call(B,le),this.emit(Y.LLMFunctionCallStopped,le);break}case se.LLM_FUNCTION_CALL:{const le=e.data,Yt={function_name:le.function_name,tool_call_id:le.tool_call_id,arguments:le.args};this._maybeTriggerFunctionCallCallback(Yt),(ue=this._options.callbacks)!=null&&ue.onLLMFunctionCall&&(this._llmFunctionCallWarned||(de.warn("[Pipecat Client] onLLMFunctionCall is deprecated. Please use onLLMFunctionCallInProgress instead."),this._llmFunctionCallWarned=!0)),(cn=(lt=this._options.callbacks)==null?void 0:lt.onLLMFunctionCall)==null||cn.call(lt,le),this.emit(Y.LLMFunctionCall,le);break}case se.BOT_LLM_SEARCH_RESPONSE:{const le=e.data;(Re=(un=this._options.callbacks)==null?void 0:un.onBotLlmSearchResponse)==null||Re.call(un,le),this.emit(Y.BotLlmSearchResponse,le);break}default:de.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 je(se.LLM_FUNCTION_CALL_RESULT,{function_name:e.function_name,tool_call_id:e.tool_call_id,arguments:e.arguments??{},result:i}))}).catch(i=>{de.error("Error in function call callback",i)})}}}Ln([Ja],Ft.prototype,"startBot",null),Ln([Ja],Ft.prototype,"connect",null),Ln([Ja],Ft.prototype,"startBotAndConnect",null),Ln([Li],Ft.prototype,"sendClientMessage",null),Ln([Li],Ft.prototype,"sendClientRequest",null),Ln([Li],Ft.prototype,"appendToContext",null),Ln([Li],Ft.prototype,"sendText",null),Ln([Li],Ft.prototype,"disconnectBot",null),Zt(Ur,Ld),Zt(Ur,Vd),Zt(Ur,Ga),Zt(Ur,Qa),Zt(Ur,Ya),Zt(Ur,Xa);function Xd(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 gt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pe(t){return pe=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},pe(t)}function Zd(t){var e=function(n,r){if(pe(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r);if(pe(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return pe(e)=="symbol"?e:e+""}function ef(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,Zd(r.key),r)}}function mt(t,e,n){return e&&ef(t.prototype,e),n&&ef(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ko(t,e){if(e&&(pe(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 jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jt(t)}function Ii(t,e){return Ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ii(t,e)}function Wo(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&&Ii(t,e)}function en(t,e,n){return(e=Zd(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tf(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 ee(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(l){tf(o,r,i,s,a,"next",l)}function a(l){tf(o,r,i,s,a,"throw",l)}s(void 0)})}}function nf(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 Ge(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,f=!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(h){f=!0,s=h}finally{try{if(!d&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(f)throw s}}return c}}(t,e)||function(n,r){if(n){if(typeof n=="string")return nf(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)?nf(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 Wy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var rf,qo={exports:{}},Za=function(){if(rf)return qo.exports;rf=1;var t,e=typeof Reflect=="object"?Reflect:null,n=e&&typeof e.apply=="function"?e.apply:function(v,S,m){return Function.prototype.apply.call(v,S,m)};t=e&&typeof e.ownKeys=="function"?e.ownKeys:Object.getOwnPropertySymbols?function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:function(v){return Object.getOwnPropertyNames(v)};var r=Number.isNaN||function(v){return v!=v};function i(){i.init.call(this)}qo.exports=i,qo.exports.once=function(v,S){return new Promise(function(m,w){function k(M){v.removeListener(S,C),w(M)}function C(){typeof v.removeListener=="function"&&v.removeListener("error",k),m([].slice.call(arguments))}y(v,S,C,{once:!0}),S!=="error"&&function(M,O,D){typeof M.on=="function"&&y(M,"error",O,D)}(v,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(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}function a(v){return v._maxListeners===void 0?i.defaultMaxListeners:v._maxListeners}function l(v,S,m,w){var k,C,M,O;if(s(m),(C=v._events)===void 0?(C=v._events=Object.create(null),v._eventsCount=0):(C.newListener!==void 0&&(v.emit("newListener",S,m.listener?m.listener:m),C=v._events),M=C[S]),M===void 0)M=C[S]=m,++v._eventsCount;else if(typeof M=="function"?M=C[S]=w?[m,M]:[M,m]:w?M.unshift(m):M.push(m),(k=a(v))>0&&M.length>k&&!M.warned){M.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=v,D.type=S,D.count=M.length,O=D,console&&console.warn&&console.warn(O)}return v}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(v,S,m){var w={fired:!1,wrapFn:void 0,target:v,type:S,listener:m},k=c.bind(w);return k.listener=m,w.wrapFn=k,k}function f(v,S,m){var w=v._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),O=0;O<M.length;++O)M[O]=C[O].listener||C[O];return M}(k):b(k,k.length)}function h(v){var S=this._events;if(S!==void 0){var m=S[v];if(typeof m=="function")return 1;if(m!==void 0)return m.length}return 0}function b(v,S){for(var m=new Array(S),w=0;w<S;++w)m[w]=v[w];return m}function y(v,S,m,w){if(typeof v.on=="function")w.once?v.once(S,m):v.on(S,m);else{if(typeof v.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v);v.addEventListener(S,function k(C){w.once&&v.removeEventListener(S,k),m(C)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");o=v}}),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(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(v){for(var S=[],m=1;m<arguments.length;m++)S.push(arguments[m]);var w=v==="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 O=k[v];if(O===void 0)return!1;if(typeof O=="function")n(O,this,S);else{var D=O.length,F=b(O,D);for(m=0;m<D;++m)n(F[m],this,S)}return!0},i.prototype.addListener=function(v,S){return l(this,v,S,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(v,S){return l(this,v,S,!0)},i.prototype.once=function(v,S){return s(S),this.on(v,d(this,v,S)),this},i.prototype.prependOnceListener=function(v,S){return s(S),this.prependListener(v,d(this,v,S)),this},i.prototype.removeListener=function(v,S){var m,w,k,C,M;if(s(S),(w=this._events)===void 0)return this;if((m=w[v])===void 0)return this;if(m===S||m.listener===S)--this._eventsCount==0?this._events=Object.create(null):(delete w[v],w.removeListener&&this.emit("removeListener",v,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(O,D){for(;D+1<O.length;D++)O[D]=O[D+1];O.pop()}(m,k),m.length===1&&(w[v]=m[0]),w.removeListener!==void 0&&this.emit("removeListener",v,M||S)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(v){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[v]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete m[v]),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[v])=="function")this.removeListener(v,S);else if(S!==void 0)for(w=S.length-1;w>=0;w--)this.removeListener(v,S[w]);return this},i.prototype.listeners=function(v){return f(this,v,!0)},i.prototype.rawListeners=function(v){return f(this,v,!1)},i.listenerCount=function(v,S){return typeof v.listenerCount=="function"?v.listenerCount(S):h.call(v,S)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},qo.exports}(),Jo=Wy(Za),of=Object.prototype.hasOwnProperty;function sf(t,e,n){for(n of t.keys())if(tt(n,e))return n}function tt(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--&&tt(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=sf(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=sf(e,i))||!tt(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(of.call(t,n)&&++r&&!of.call(e,n)||!(n in e)||!tt(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!=t&&e!=e}const qy={"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"},af={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"},Le={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},nt={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"},In={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};let I=class Di{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=Di.getVersionPrecision(e),o=Di.getVersionPrecision(n);let s=Math.max(i,o),a=0;const l=Di.map([e,n],c=>{const d=s-Di.getVersionPrecision(c),f=c+new Array(d+1).join(".0");return Di.map(f.split("."),h=>new Array(20-h.length).join("0")+h).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 qy[e]}static getBrowserTypeByAlias(e){return af[e]||""}};const ke=/version\/(\d+(\.?_?\d+)+)/i,Jy=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=I.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=I.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=I.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=I.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=I.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=I.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(ke,t)||I.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=I.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,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=I.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=I.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=I.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=I.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=I.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=I.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=I.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=I.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=I.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=I.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=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(ke,t)||I.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=I.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=I.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=I.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=I.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=I.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=I.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=I.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=I.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=I.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=I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=I.getFirstMatch(ke,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=t.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:I.getFirstMatch(e,t),version:I.getSecondMatch(e,t)}}}];var Gy=[{test:[/Roku\/DVP/],describe(t){const e=I.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:nt.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=I.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:nt.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=I.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=I.getWindowsVersionName(e);return{name:nt.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:nt.iOS},n=I.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=I.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=I.getMacOSVersionName(e),r={name:nt.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=I.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:nt.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=I.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=I.getAndroidVersionName(e),r={name:nt.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=I.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:nt.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=I.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||I.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||I.getFirstMatch(/\bbb(\d+)/i,t);return{name:nt.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=I.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:nt.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=I.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:nt.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:nt.Linux})},{test:[/CrOS/],describe:()=>({name:nt.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=I.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:nt.PlayStation4,version:e}}}],Qy=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=I.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:Le.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Le.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Le.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Le.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Le.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Le.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Le.tablet})},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=I.getFirstMatch(/(ipod|iphone)/i,t);return{type:Le.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Le.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Le.mobile})},{test:t=>t.getBrowserName(!0)==="blackberry",describe:()=>({type:Le.mobile,vendor:"BlackBerry"})},{test:t=>t.getBrowserName(!0)==="bada",describe:()=>({type:Le.mobile})},{test:t=>t.getBrowserName()==="windows phone",describe:()=>({type:Le.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe:()=>({type:Le.tablet})},{test:t=>t.getOSName(!0)==="android",describe:()=>({type:Le.mobile})},{test:t=>t.getOSName(!0)==="macos",describe:()=>({type:Le.desktop,vendor:"Apple"})},{test:t=>t.getOSName(!0)==="windows",describe:()=>({type:Le.desktop})},{test:t=>t.getOSName(!0)==="linux",describe:()=>({type:Le.desktop})},{test:t=>t.getOSName(!0)==="playstation 4",describe:()=>({type:Le.tv})},{test:t=>t.getOSName(!0)==="roku",describe:()=>({type:Le.tv})}],Yy=[{test:t=>t.getBrowserName(!0)==="microsoft edge",describe(t){if(/\sedg\//i.test(t))return{name:In.Blink};const e=I.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:In.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:In.Trident},n=I.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:In.Presto},n=I.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=I.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:In.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:In.WebKit},n=I.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];let lf=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=I.find(Jy,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=I.find(Gy,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=I.find(Qy,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=I.find(Yy,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 I.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=I.find(s,c=>this.isOS(c));if(a){const c=this.satisfies(n[a]);if(c!==void 0)return c}const l=I.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=I.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=I.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(I.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
|
|
12
|
+
*/let Xy=class{static getParser(e,n=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new lf(e,n)}static parse(e){return new lf(e).getResult()}static get BROWSER_MAP(){return af}static get ENGINE_MAP(){return In}static get OS_MAP(){return nt}static get PLATFORMS_MAP(){return Le}};function Go(){return Date.now()+Math.random().toString()}function Ri(){throw new Error("Method must be implemented in subclass")}function cf(t,e){return e!=null&&e.proxyUrl?e.proxyUrl+(e.proxyUrl.slice(-1)==="/"?"":"/")+t.substring(8):t}function Qo(t){return t!=null&&t.callObjectBundleUrlOverride?t.callObjectBundleUrlOverride:cf("https://c.daily.co/call-machine/versioned/".concat("0.86.0","/static/call-machine-object-bundle.js"),t)}function Yo(t){try{new URL(t)}catch{return!1}return!0}const _e=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ur="8.55.0",me=globalThis;function Xo(t,e,n){const r=me,i=r.__SENTRY__=r.__SENTRY__||{},o=i[ur]=i[ur]||{};return o[t]||(o[t]=e())}const dr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,el=["debug","info","warn","error","log","assert","trace"],Zo={};function Ni(t){if(!("console"in me))return t();const e=me.console,n={},r=Object.keys(Zo);r.forEach(i=>{const o=Zo[i];n[i]=e[i],e[i]=o});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}const re=Xo("logger",function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return dr?el.forEach(n=>{e[n]=(...r)=>{t&&Ni(()=>{me.console[n](`Sentry Logger [${n}]:`,...r)})}}):el.forEach(n=>{e[n]=()=>{}}),e}),fr="?",uf=/\(error: (.*)\)/,df=/captureMessage|captureException/;function es(t){return t[t.length-1]||{}}const ff="<anonymous>";function Rn(t){try{return t&&typeof t=="function"&&t.name||ff}catch{return ff}}function hf(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 ts={},pf={};function hr(t,e){ts[t]=ts[t]||[],ts[t].push(e)}function pr(t,e){if(!pf[t]){pf[t]=!0;try{e()}catch(n){dr&&re.error(`Error while instrumenting ${t}`,n)}}}function Bt(t,e){const n=t&&ts[t];if(n)for(const r of n)try{r(e)}catch(i){dr&&re.error(`Error while triggering instrumentation handler.
|
|
13
13
|
Type: ${t}
|
|
14
14
|
Name: ${Rn(r)}
|
|
15
|
-
Error:`,i)}}let el=null;function Yy(){el=me.onerror,me.onerror=function(t,e,n,r,i){return Bt("error",{column:r,error:i,line:n,msg:t,url:e}),!!el&&el.apply(this,arguments)},me.onerror.__SENTRY_INSTRUMENTED__=!0}let tl=null;function Xy(){tl=me.onunhandledrejection,me.onunhandledrejection=function(t){return Bt("unhandledrejection",t),!tl||tl.apply(this,arguments)},me.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function ts(){return nl(me),me}function nl(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ur,e[ur]=e[ur]||{}}const pf=Object.prototype.toString;function rl(t){switch(pf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return gr(t,Error)}}function Vr(t,e){return pf.call(t)===`[object ${e}]`}function gf(t){return Vr(t,"ErrorEvent")}function mf(t){return Vr(t,"DOMError")}function hn(t){return Vr(t,"String")}function il(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function ol(t){return t===null||il(t)||typeof t!="object"&&typeof t!="function"}function Kr(t){return Vr(t,"Object")}function ns(t){return typeof Event<"u"&&gr(t,Event)}function rs(t){return!!(t&&t.then&&typeof t.then=="function")}function gr(t,e){try{return t instanceof e}catch{return!1}}function vf(t){return!(typeof t!="object"||t===null||!t.__isVue&&!t._isVue)}const sl=me;function yf(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,f=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(c=Zy(n,d),!(c==="html"||o>1&&s+i.length*l+c.length>=f));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Zy(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(sl.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&&hn(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 Wr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function bf(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{vf(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function eb(t,e,n=!1){return!!hn(t)&&(Vr(e,"RegExp")?e.test(t):!!hn(e)&&(n?t===e:t.includes(e)))}function is(t,e=[],n=!1){return e.some(r=>eb(t,r,n))}function vt(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&wf(i,r);try{t[e]=i}catch{dr&&re.log(`Failed to replace method "${e}" in object`,t)}}function mr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{dr&&re.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function wf(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,mr(t,"__sentry_original__",e)}catch{}}function al(t){return t.__sentry_original__}function Sf(t){if(rl(t))return{message:t.message,name:t.name,stack:t.stack,...xf(t)};if(ns(t)){const e={type:t.type,target:kf(t.target),currentTarget:kf(t.currentTarget),...xf(t)};return typeof CustomEvent<"u"&&gr(t,CustomEvent)&&(e.detail=t.detail),e}return t}function kf(t){try{return e=t,typeof Element<"u"&&gr(e,Element)?yf(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var e}function xf(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 Tt(t){return ll(t,new Map)}function ll(t,e){if(function(n){if(!Kr(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]=ll(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(ll(i,e))}),r}return t}function $i(){return Date.now()/1e3}const pn=function(){const{performance:t}=me;if(!t||!t.now)return $i;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/1e3}();function Mt(){const t=me,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 _f(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Nn(t){const{message:e,event_id:n}=t;if(e)return e;const r=_f(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function cl(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 qr(t,e){const n=_f(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 Cf(t){if(function(e){try{return e.__sentry_captured__}catch{}}(t))return!0;try{mr(t,"__sentry_captured__",!0)}catch{}return!1}var gn;function vr(t){return new At(e=>{e(t)})}function os(t){return new At((e,n)=>{n(t)})}(()=>{const{performance:t}=me;!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"}(gn||(gn={}));class At{constructor(e){At.prototype.__init.call(this),At.prototype.__init2.call(this),At.prototype.__init3.call(this),At.prototype.__init4.call(this),this._state=gn.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new At((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 At((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(gn.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(gn.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{this._state===gn.PENDING&&(rs(n)?n.then(this._resolve,this._reject):(this._state=e,this._value=n,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===gn.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===gn.RESOLVED&&n[1](this._value),this._state===gn.REJECTED&&n[2](this._value),n[0]=!0)})}}}function tb(t){const e=pn(),n={sid:Mt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(r){return Tt({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&&Jr(n,t),n}function Jr(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||pn(),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:Mt()),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 Ef(){return Mt()}function ul(){return Mt().substring(16)}function ss(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]=ss(r[i],e[i],n-1));return r}const dl="_sentrySpan";function Tf(t,e){e?mr(t,dl,e):delete t[dl]}function Mf(t){return t[dl]}class fl{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:Ef(),spanId:ul()}}clone(){const e=new fl;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,Tf(e,Mf(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&&Jr(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 $n?[n.getScopeData(),n.getRequestSession()]:Kr(n)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:l,level:c,fingerprint:d=[],propagationContext:f}=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),f&&(this._propagationContext=f),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,Tf(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ef()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:100;if(r<=0)return this;const i={timestamp:$i(),...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:Mf(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ss(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:ul(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:Mt();if(!this._client)return re.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:Mt();if(!this._client)return re.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:Mt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(re.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 $n=fl;class nb{constructor(e,n){let r,i;r=e||new $n,i=n||new $n,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 rs(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 Gr(){const t=nl(ts());return t.stack=t.stack||new nb(Yo("defaultCurrentScope",()=>new $n),Yo("defaultIsolationScope",()=>new $n))}function rb(t){return Gr().withScope(t)}function ib(t,e){const n=Gr();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Af(t){return Gr().withScope(()=>t(Gr().getIsolationScope()))}function hl(t){const e=nl(t);return e.acs?e.acs:{withIsolationScope:Af,withScope:rb,withSetScope:ib,withSetIsolationScope:(n,r)=>Af(r),getCurrentScope:()=>Gr().getScope(),getIsolationScope:()=>Gr().getIsolationScope()}}function yr(){return hl(ts()).getCurrentScope()}function Fi(){return hl(ts()).getIsolationScope()}function Qe(){return yr().getClient()}function ob(t){const e=t.getPropagationContext(),{traceId:n,spanId:r,parentSpanId:i}=e;return Tt({trace_id:n,span_id:r,parent_span_id:i})}function sb(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[r,i]]of e)(n[r]||(n[r]=[])).push(Tt(i));return n}const ab=/^sentry-/;function lb(t){const e=function(r){if(!(!r||!hn(r)&&!Array.isArray(r)))return Array.isArray(r)?r.reduce((i,o)=>{const s=Of(o);return Object.entries(s).forEach(([a,l])=>{i[a]=l}),i},{}):Of(r)}(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,o])=>(i.match(ab)&&(r[i.slice(7)]=o),r),{});return Object.keys(n).length>0?n:void 0}function Of(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}let Df=!1;function cb(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext();return Tt({parent_span_id:r?e:pl(t).parent_span_id,span_id:r?ul():e,trace_id:n})}function Pf(t){return typeof t=="number"?Lf(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Lf(t.getTime()):pn()}function Lf(t){return t>9999999999?t/1e3:t}function pl(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 Tt({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Pf(i),timestamp:Pf(s)||void 0,status:ub(l),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:sb(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function ub(t){if(t&&t.code!==0)return t.code===1?"ok":t.message||"unknown_error"}function If(t){return t._sentryRootSpan||t}function db(){Df||(Ni(()=>{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.")}),Df=!0)}const gl="production";function Rf(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Tt({environment:n.environment||gl,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function fb(t){const e=Qe();if(!e)return{};const n=If(t),r=n._frozenDsc;if(r)return r;const i=n.spanContext().traceState,o=i&&i.get("sentry.dsc"),s=o&&lb(o);if(s)return s;const a=Rf(t.spanContext().traceId,e),l=pl(n),c=l.data||{},d=c["sentry.sample_rate"];d!=null&&(a.sample_rate=`${d}`);const f=c["sentry.source"],h=l.description;return f!=="url"&&h&&(a.transaction=h),function(b){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const y=Qe(),m=y&&y.getOptions();return!!m&&(m.enableTracing||"tracesSampleRate"in m||"tracesSampler"in m)}()&&(a.sampled=String(function(b){const{traceFlags:y}=b.spanContext();return y===1}(n))),e.emit("createDsc",a,n),a}const hb=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function as(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 Nf(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=hb.exec(n);if(!r)return void Ni(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[i,o,s="",a="",l="",c=""]=r.slice(1);let d="",f=c;const h=f.split("/");if(h.length>1&&(d=h.slice(0,-1).join("/"),f=h.pop()),f){const b=f.match(/^\d+/);b&&(f=b[0])}return Nf({host:a,pass:s,path:d,projectId:f,port:l,protocol:i,publicKey:o})}(t):Nf(t);if(e&&function(n){if(!dr)return!0;const{port:r,projectId:i,protocol:o}=n;return!(["protocol","publicKey","host","projectId"].find(s=>!n[s]&&(re.error(`Invalid Sentry Dsn: ${s} missing`),!0))||(i.match(/^\d+$/)?function(s){return s==="http"||s==="https"}(o)?r&&isNaN(parseInt(r,10))&&(re.error(`Invalid Sentry Dsn: Invalid port ${r}`),1):(re.error(`Invalid Sentry Dsn: Invalid protocol ${o}`),1):(re.error(`Invalid Sentry Dsn: Invalid projectId ${i}`),1)))}(e))return e}function mn(t,e=100,n=1/0){try{return ml("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function $f(t,e=3,n=102400){const r=mn(t,e);return i=r,function(o){return~-encodeURI(o).split(/%..|./).length}(JSON.stringify(i))>n?$f(t,e-1,n):r;var i}function ml(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(b,y){try{if(b==="domain"&&y&&typeof y=="object"&&y._events)return"[Domain]";if(b==="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(vf(y))return"[VueViewModel]";if(Kr(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: ${Rn(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 ml("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const h=Sf(e);for(const b in h){if(!Object.prototype.hasOwnProperty.call(h,b))continue;if(f>=r){d[b]="[MaxProperties ~]";break}const y=h[b];d[b]=ml(b,y,l-1,r,i),f++}return s(e),d}function ji(t,e=[]){return[t,e]}function gb(t,e){const[n,r]=t;return[n,[...r,e]]}function Ff(t,e){const n=t[1];for(const r of n)if(e(r,r[0].type))return!0;return!1}function vl(t){return me.__SENTRY__&&me.__SENTRY__.encodePolyfill?me.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function mb(t){const[e,n]=t;let r=JSON.stringify(e);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[vl(r),o]:r.push(typeof o=="string"?vl(o):o)}for(const o of n){const[s,a]=o;if(i(`
|
|
15
|
+
Error:`,i)}}let tl=null;function Zy(){tl=me.onerror,me.onerror=function(t,e,n,r,i){return Bt("error",{column:r,error:i,line:n,msg:t,url:e}),!!tl&&tl.apply(this,arguments)},me.onerror.__SENTRY_INSTRUMENTED__=!0}let nl=null;function eb(){nl=me.onunhandledrejection,me.onunhandledrejection=function(t){return Bt("unhandledrejection",t),!nl||nl.apply(this,arguments)},me.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function ns(){return rl(me),me}function rl(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ur,e[ur]=e[ur]||{}}const gf=Object.prototype.toString;function il(t){switch(gf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return gr(t,Error)}}function Vr(t,e){return gf.call(t)===`[object ${e}]`}function mf(t){return Vr(t,"ErrorEvent")}function vf(t){return Vr(t,"DOMError")}function hn(t){return Vr(t,"String")}function ol(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function sl(t){return t===null||ol(t)||typeof t!="object"&&typeof t!="function"}function Kr(t){return Vr(t,"Object")}function rs(t){return typeof Event<"u"&&gr(t,Event)}function is(t){return!!(t&&t.then&&typeof t.then=="function")}function gr(t,e){try{return t instanceof e}catch{return!1}}function yf(t){return!(typeof t!="object"||t===null||!t.__isVue&&!t._isVue)}const al=me;function bf(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,f=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(c=tb(n,d),!(c==="html"||o>1&&s+i.length*l+c.length>=f));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function tb(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(al.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&&hn(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 Wr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function wf(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{yf(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function nb(t,e,n=!1){return!!hn(t)&&(Vr(e,"RegExp")?e.test(t):!!hn(e)&&(n?t===e:t.includes(e)))}function os(t,e=[],n=!1){return e.some(r=>nb(t,r,n))}function vt(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);typeof i=="function"&&Sf(i,r);try{t[e]=i}catch{dr&&re.log(`Failed to replace method "${e}" in object`,t)}}function mr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{dr&&re.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Sf(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,mr(t,"__sentry_original__",e)}catch{}}function ll(t){return t.__sentry_original__}function kf(t){if(il(t))return{message:t.message,name:t.name,stack:t.stack,..._f(t)};if(rs(t)){const e={type:t.type,target:xf(t.target),currentTarget:xf(t.currentTarget),..._f(t)};return typeof CustomEvent<"u"&&gr(t,CustomEvent)&&(e.detail=t.detail),e}return t}function xf(t){try{return e=t,typeof Element<"u"&&gr(e,Element)?bf(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}var e}function _f(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 Tt(t){return cl(t,new Map)}function cl(t,e){if(function(n){if(!Kr(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]=cl(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(cl(i,e))}),r}return t}function $i(){return Date.now()/1e3}const pn=function(){const{performance:t}=me;if(!t||!t.now)return $i;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/1e3}();function Mt(){const t=me,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 Cf(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Nn(t){const{message:e,event_id:n}=t;if(e)return e;const r=Cf(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ul(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 qr(t,e){const n=Cf(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 Ef(t){if(function(e){try{return e.__sentry_captured__}catch{}}(t))return!0;try{mr(t,"__sentry_captured__",!0)}catch{}return!1}var gn;function vr(t){return new At(e=>{e(t)})}function ss(t){return new At((e,n)=>{n(t)})}(()=>{const{performance:t}=me;!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"}(gn||(gn={}));class At{constructor(e){At.prototype.__init.call(this),At.prototype.__init2.call(this),At.prototype.__init3.call(this),At.prototype.__init4.call(this),this._state=gn.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new At((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 At((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(gn.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(gn.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{this._state===gn.PENDING&&(is(n)?n.then(this._resolve,this._reject):(this._state=e,this._value=n,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===gn.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===gn.RESOLVED&&n[1](this._value),this._state===gn.REJECTED&&n[2](this._value),n[0]=!0)})}}}function rb(t){const e=pn(),n={sid:Mt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(r){return Tt({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&&Jr(n,t),n}function Jr(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||pn(),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:Mt()),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 Tf(){return Mt()}function dl(){return Mt().substring(16)}function as(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]=as(r[i],e[i],n-1));return r}const fl="_sentrySpan";function Mf(t,e){e?mr(t,fl,e):delete t[fl]}function Af(t){return t[fl]}class hl{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:Tf(),spanId:dl()}}clone(){const e=new hl;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,Mf(e,Af(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&&Jr(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 $n?[n.getScopeData(),n.getRequestSession()]:Kr(n)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:l,level:c,fingerprint:d=[],propagationContext:f}=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),f&&(this._propagationContext=f),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,Mf(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Tf()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:100;if(r<=0)return this;const i={timestamp:$i(),...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:Af(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=as(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:dl(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:Mt();if(!this._client)return re.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:Mt();if(!this._client)return re.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:Mt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(re.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 $n=hl;class ib{constructor(e,n){let r,i;r=e||new $n,i=n||new $n,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 is(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 Gr(){const t=rl(ns());return t.stack=t.stack||new ib(Xo("defaultCurrentScope",()=>new $n),Xo("defaultIsolationScope",()=>new $n))}function ob(t){return Gr().withScope(t)}function sb(t,e){const n=Gr();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Of(t){return Gr().withScope(()=>t(Gr().getIsolationScope()))}function pl(t){const e=rl(t);return e.acs?e.acs:{withIsolationScope:Of,withScope:ob,withSetScope:sb,withSetIsolationScope:(n,r)=>Of(r),getCurrentScope:()=>Gr().getScope(),getIsolationScope:()=>Gr().getIsolationScope()}}function yr(){return pl(ns()).getCurrentScope()}function Fi(){return pl(ns()).getIsolationScope()}function Qe(){return yr().getClient()}function ab(t){const e=t.getPropagationContext(),{traceId:n,spanId:r,parentSpanId:i}=e;return Tt({trace_id:n,span_id:r,parent_span_id:i})}function lb(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[r,i]]of e)(n[r]||(n[r]=[])).push(Tt(i));return n}const cb=/^sentry-/;function ub(t){const e=function(r){if(!(!r||!hn(r)&&!Array.isArray(r)))return Array.isArray(r)?r.reduce((i,o)=>{const s=Df(o);return Object.entries(s).forEach(([a,l])=>{i[a]=l}),i},{}):Df(r)}(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,o])=>(i.match(cb)&&(r[i.slice(7)]=o),r),{});return Object.keys(n).length>0?n:void 0}function Df(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}let Pf=!1;function db(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext();return Tt({parent_span_id:r?e:gl(t).parent_span_id,span_id:r?dl():e,trace_id:n})}function Lf(t){return typeof t=="number"?If(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?If(t.getTime()):pn()}function If(t){return t>9999999999?t/1e3:t}function gl(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 Tt({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Lf(i),timestamp:Lf(s)||void 0,status:fb(l),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:lb(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function fb(t){if(t&&t.code!==0)return t.code===1?"ok":t.message||"unknown_error"}function Rf(t){return t._sentryRootSpan||t}function hb(){Pf||(Ni(()=>{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.")}),Pf=!0)}const ml="production";function Nf(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Tt({environment:n.environment||ml,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function pb(t){const e=Qe();if(!e)return{};const n=Rf(t),r=n._frozenDsc;if(r)return r;const i=n.spanContext().traceState,o=i&&i.get("sentry.dsc"),s=o&&ub(o);if(s)return s;const a=Nf(t.spanContext().traceId,e),l=gl(n),c=l.data||{},d=c["sentry.sample_rate"];d!=null&&(a.sample_rate=`${d}`);const f=c["sentry.source"],h=l.description;return f!=="url"&&h&&(a.transaction=h),function(b){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const y=Qe(),v=y&&y.getOptions();return!!v&&(v.enableTracing||"tracesSampleRate"in v||"tracesSampler"in v)}()&&(a.sampled=String(function(b){const{traceFlags:y}=b.spanContext();return y===1}(n))),e.emit("createDsc",a,n),a}const gb=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function ls(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 $f(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function mb(t){const e=typeof t=="string"?function(n){const r=gb.exec(n);if(!r)return void Ni(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});const[i,o,s="",a="",l="",c=""]=r.slice(1);let d="",f=c;const h=f.split("/");if(h.length>1&&(d=h.slice(0,-1).join("/"),f=h.pop()),f){const b=f.match(/^\d+/);b&&(f=b[0])}return $f({host:a,pass:s,path:d,projectId:f,port:l,protocol:i,publicKey:o})}(t):$f(t);if(e&&function(n){if(!dr)return!0;const{port:r,projectId:i,protocol:o}=n;return!(["protocol","publicKey","host","projectId"].find(s=>!n[s]&&(re.error(`Invalid Sentry Dsn: ${s} missing`),!0))||(i.match(/^\d+$/)?function(s){return s==="http"||s==="https"}(o)?r&&isNaN(parseInt(r,10))&&(re.error(`Invalid Sentry Dsn: Invalid port ${r}`),1):(re.error(`Invalid Sentry Dsn: Invalid protocol ${o}`),1):(re.error(`Invalid Sentry Dsn: Invalid projectId ${i}`),1)))}(e))return e}function mn(t,e=100,n=1/0){try{return vl("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Ff(t,e=3,n=102400){const r=mn(t,e);return i=r,function(o){return~-encodeURI(o).split(/%..|./).length}(JSON.stringify(i))>n?Ff(t,e-1,n):r;var i}function vl(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(b,y){try{if(b==="domain"&&y&&typeof y=="object"&&y._events)return"[Domain]";if(b==="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(yf(y))return"[VueViewModel]";if(Kr(v=y)&&"nativeEvent"in v&&"preventDefault"in v&&"stopPropagation"in v)return"[SyntheticEvent]";if(typeof y=="number"&&!Number.isFinite(y))return`[${y}]`;if(typeof y=="function")return`[Function: ${Rn(y)}]`;if(typeof y=="symbol")return`[${String(y)}]`;if(typeof y=="bigint")return`[BigInt: ${String(y)}]`;const S=function(m){const w=Object.getPrototypeOf(m);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 v}(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 vl("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const h=kf(e);for(const b in h){if(!Object.prototype.hasOwnProperty.call(h,b))continue;if(f>=r){d[b]="[MaxProperties ~]";break}const y=h[b];d[b]=vl(b,y,l-1,r,i),f++}return s(e),d}function ji(t,e=[]){return[t,e]}function vb(t,e){const[n,r]=t;return[n,[...r,e]]}function jf(t,e){const n=t[1];for(const r of n)if(e(r,r[0].type))return!0;return!1}function yl(t){return me.__SENTRY__&&me.__SENTRY__.encodePolyfill?me.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function yb(t){const[e,n]=t;let r=JSON.stringify(e);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[yl(r),o]:r.push(typeof o=="string"?yl(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(mn(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 vb(t){const e=typeof t.data=="string"?vl(t.data):t.data;return[Tt({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const yb={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 jf(t){return yb[t]}function Bf(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function bb(t,e,n,r){const i=Bf(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 f=a.sdkProcessingMetadata&&a.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:a.event_id,sent_at:new Date().toISOString(),...l&&{sdk:l},...!!c&&d&&{dsn:as(d)},...f&&{trace:Tt({...f})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,ji(s,[[{type:o},t]])}function yl(t,e,n,r=0){return new At((i,o)=>{const s=t[r];if(e===null||typeof s!="function")i(e);else{const a=s({...e},n);_e&&s.id&&a===null&&re.log(`Event processor "${s.id}" dropped event`),rs(a)?a.then(l=>yl(t,l,n,r+1).then(i)).then(null,o):yl(t,a,n,r+1).then(i).then(null,o)}})}let ls,Uf,bl;function wb(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;(function(s,a){const{extra:l,tags:c,user:d,contexts:f,level:h,transactionName:b}=a,y=Tt(l);y&&Object.keys(y).length&&(s.extra={...y,...s.extra});const m=Tt(c);m&&Object.keys(m).length&&(s.tags={...m,...s.tags});const S=Tt(d);S&&Object.keys(S).length&&(s.user={...S,...s.user});const v=Tt(f);v&&Object.keys(v).length&&(s.contexts={...v,...s.contexts}),h&&(s.level=h),b&&s.type!=="transaction"&&(s.transaction=b)})(t,e),r&&function(s,a){s.contexts={trace:cb(a),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:fb(a),...s.sdkProcessingMetadata};const l=If(a),c=pl(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 zf(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:d,attachments:f,propagationContext:h,transactionName:b,span:y}=e;cs(t,"extra",n),cs(t,"tags",r),cs(t,"user",i),cs(t,"contexts",o),t.sdkProcessingMetadata=ss(t.sdkProcessingMetadata,a,2),s&&(t.level=s),b&&(t.transactionName=b),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]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,...h}}function cs(t,e,n){t[e]=ss(t[e],n,1)}function Sb(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Mt(),timestamp:e.timestamp||$i()},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||gl,!y.release&&v&&(y.release=v),!y.dist&&w&&(y.dist=w),y.message&&(y.message=Wr(y.message,k));const C=y.exception&&y.exception.values&&y.exception.values[0];C&&C.value&&(C.value=Wr(C.value,k));const M=y.request;M&&M.url&&(M.url=Wr(M.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=me._sentryDebugIds;if(!w)return{};const k=Object.keys(w);return bl&&k.length===Uf||(Uf=k.length,bl=k.reduce((C,M)=>{ls||(ls={});const O=ls[M];if(O)C[O[0]]=O[1];else{const D=v(M);for(let F=D.length-1;F>=0;F--){const J=D[F],W=J&&J.filename,U=w[M];if(W&&U){C[W]=U,ls[M]=[W,U];break}}}return C},{})),bl}(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 $n;return S.update(m),S}(r,n.captureContext);n.mechanism&&qr(l,n.mechanism);const f=i?i.getEventProcessors():[],h=Yo("globalScope",()=>new $n).getScopeData();o&&zf(h,o.getScopeData()),d&&zf(h,d.getScopeData());const b=[...n.attachments||[],...h.attachments];return b.length&&(n.attachments=b),wb(l,h),yl([...f,...h.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:mn(k.data,S,v)}}))},...m.user&&{user:mn(m.user,S,v)},...m.contexts&&{contexts:mn(m.contexts,S,v)},...m.extra&&{extra:mn(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=mn(m.contexts.trace.data,S,v))),m.spans&&(w.spans=m.spans.map(k=>({...k,...k.data&&{data:mn(k.data,S,v)}}))),m.contexts&&m.contexts.flags&&w.contexts&&(w.contexts.flags=mn(m.contexts.flags,3,v)),w}(y,s,a):y))}function qx(t){}function Hf(t,e){return yr().captureEvent(t,e)}function Vf(t){const e=Qe(),n=Fi(),r=yr(),{release:i,environment:o=gl}=e&&e.getOptions()||{},{userAgent:s}=me.navigator||{},a=tb({release:i,environment:o,user:r.getUser()||n.getUser(),...s&&{userAgent:s},...t}),l=n.getSession();return l&&l.status==="ok"&&Jr(l,{status:"exited"}),Kf(),n.setSession(a),r.setSession(a),a}function Kf(){const t=Fi(),e=yr(),n=e.getSession()||t.getSession();n&&function(r,i){let o={};r.status==="ok"&&(o={status:"exited"}),Jr(r,o)}(n),Wf(),t.setSession(),e.setSession()}function Wf(){const t=Fi(),e=yr(),n=Qe(),r=e.getSession()||t.getSession();r&&n&&n.captureSession(r)}function qf(t=!1){t?Kf():Wf()}function kb(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 Jf=[];function Gf(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function Qf(t,e,n){if(n[e.name])_e&&re.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,Jf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Jf.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)}_e&&re.log(`Integration installed: ${e.name}`)}}class Ut extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const Yf="Not capturing exception because it's already been captured.";class xb{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=pb(e.dsn):_e&&re.warn("No DSN provided, client will not send events."),this._dsn){const r=kb(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&&Ni(()=>{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=Mt();if(Cf(e))return _e&&re.log(Yf),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:Mt(),...r},s=il(e)?e:String(e),a=ol(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=Mt();if(n&&n.originalException&&Cf(n.originalException))return _e&&re.log(Yf),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"?_e&&re.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),Jr(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];Qf(this,e,this._integrations),n||Gf(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=bb(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])r=gb(r,vb(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=Bf(o);return ji({sent_at:new Date().toISOString(),...a&&{sdk:a},...!!s&&i&&{dsn:as(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}`;_e&&re.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=>(_e&&re.error("Error while sending envelope:",n),n)):(_e&&re.error("Transport disabled"),vr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(n,r){const i={};return r.forEach(o=>{o&&Qf(n,o,i)}),i}(this,e),Gf(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)&&(Jr(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new At(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=yr(),i=Fi()){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),Sb(o,e,n,r,this,i).then(a=>{if(a===null)return a;a.contexts={trace:ob(r),...a.contexts};const l=function(c,d){const f=d.getPropagationContext();return f.dsc||Rf(f.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=>{_e&&(i instanceof Ut&&i.logLevel==="log"?re.log(i.message):re.warn(i))})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Zf(e),a=Xf(e),l=e.type||"error",c=`before send for type \`${l}\``,d=o===void 0?void 0:function(b){if(typeof b=="boolean")return Number(b);const y=typeof b=="string"?parseFloat(b):b;if(!(typeof y!="number"||isNaN(y)||y<0||y>1))return y;_e&&re.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(b)} of type ${JSON.stringify(typeof b)}.`)}(o);if(a&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),os(new Ut(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const f=l==="replay_event"?"replay":l,h=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,h).then(b=>{if(b===null)throw this.recordDroppedEvent("event_processor",f,e),new Ut("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return b;const y=function(m,S,v,w){const{beforeSend:k,beforeSendTransaction:C,beforeSendSpan:M}=S;if(Xf(v)&&k)return k(v,w);if(Zf(v)){if(v.spans&&M){const O=[];for(const D of v.spans){const F=M(D);F?O.push(F):(db(),m.recordDroppedEvent("before_send","span"))}v.spans=O}if(C){if(v.spans){const O=v.spans.length;v.sdkProcessingMetadata={...v.sdkProcessingMetadata,spanCountBeforeProcessing:O}}return C(v,w)}}return v}(this,i,b,n);return function(m,S){const v=`${S} must return \`null\` or a valid event.`;if(rs(m))return m.then(w=>{if(!Kr(w)&&w!==null)throw new Ut(v);return w},w=>{throw new Ut(`${S} rejected with ${w}`)});if(!Kr(m)&&m!==null)throw new Ut(v);return m}(y,c)}).then(b=>{if(b===null){if(this.recordDroppedEvent("before_send",f,e),s){const S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw new Ut(`${c} returned \`null\`, will not send event.`,"log")}const y=r&&r.getSession();if(!s&&y&&this._updateSessionFromEvent(y,b),s){const S=(b.sdkProcessingMetadata&&b.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(b.spans?b.spans.length:0);S>0&&this.recordDroppedEvent("before_send","span",S)}const m=b.transaction_info;if(s&&m&&b.transaction!==e.transaction){const S="custom";b.transaction_info={...m,source:S}}return this.sendEvent(b,n),b}).then(null,b=>{throw b instanceof Ut?b:(this.captureException(b,{data:{__sentry__:!0},originalException:b}),new Ut(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
18
|
-
Reason: ${b}`))})}_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(){_e&&re.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0)return void(_e&&re.log("No outcomes to send"));if(!this._dsn)return void(_e&&re.log("No dsn provided, will not send outcomes"));_e&&re.log("Sending outcomes:",e);const n=(r=e,ji((i=this._options.tunnel&&
|
|
19
|
-
Event: ${Nn(s)}`),!0):function(l,c){return l.type||!c||!c.length?!1:function(d){const f=[];d.message&&f.push(d.message);let h;try{h=d.exception.values[d.exception.values.length-1]}catch{}return h&&h.value&&(f.push(h.value),h.type&&f.push(`${h.type}: ${h.value}`)),f}(l).some(d=>
|
|
17
|
+
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(mn(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 bb(t){const e=typeof t.data=="string"?yl(t.data):t.data;return[Tt({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const wb={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 Bf(t){return wb[t]}function Uf(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Sb(t,e,n,r){const i=Uf(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 f=a.sdkProcessingMetadata&&a.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:a.event_id,sent_at:new Date().toISOString(),...l&&{sdk:l},...!!c&&d&&{dsn:ls(d)},...f&&{trace:Tt({...f})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,ji(s,[[{type:o},t]])}function bl(t,e,n,r=0){return new At((i,o)=>{const s=t[r];if(e===null||typeof s!="function")i(e);else{const a=s({...e},n);_e&&s.id&&a===null&&re.log(`Event processor "${s.id}" dropped event`),is(a)?a.then(l=>bl(t,l,n,r+1).then(i)).then(null,o):bl(t,a,n,r+1).then(i).then(null,o)}})}let cs,zf,wl;function kb(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;(function(s,a){const{extra:l,tags:c,user:d,contexts:f,level:h,transactionName:b}=a,y=Tt(l);y&&Object.keys(y).length&&(s.extra={...y,...s.extra});const v=Tt(c);v&&Object.keys(v).length&&(s.tags={...v,...s.tags});const S=Tt(d);S&&Object.keys(S).length&&(s.user={...S,...s.user});const m=Tt(f);m&&Object.keys(m).length&&(s.contexts={...m,...s.contexts}),h&&(s.level=h),b&&s.type!=="transaction"&&(s.transaction=b)})(t,e),r&&function(s,a){s.contexts={trace:db(a),...s.contexts},s.sdkProcessingMetadata={dynamicSamplingContext:pb(a),...s.sdkProcessingMetadata};const l=Rf(a),c=gl(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 Hf(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:d,attachments:f,propagationContext:h,transactionName:b,span:y}=e;us(t,"extra",n),us(t,"tags",r),us(t,"user",i),us(t,"contexts",o),t.sdkProcessingMetadata=as(t.sdkProcessingMetadata,a,2),s&&(t.level=s),b&&(t.transactionName=b),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]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,...h}}function us(t,e,n){t[e]=as(t[e],n,1)}function xb(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Mt(),timestamp:e.timestamp||$i()},c=n.integrations||t.integrations.map(y=>y.name);(function(y,v){const{environment:S,release:m,dist:w,maxValueLength:k=250}=v;y.environment=y.environment||S||ml,!y.release&&m&&(y.release=m),!y.dist&&w&&(y.dist=w),y.message&&(y.message=Wr(y.message,k));const C=y.exception&&y.exception.values&&y.exception.values[0];C&&C.value&&(C.value=Wr(C.value,k));const M=y.request;M&&M.url&&(M.url=Wr(M.url,k))})(l,t),function(y,v){v.length>0&&(y.sdk=y.sdk||{},y.sdk.integrations=[...y.sdk.integrations||[],...v])}(l,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&function(y,v){const S=function(m){const w=me._sentryDebugIds;if(!w)return{};const k=Object.keys(w);return wl&&k.length===zf||(zf=k.length,wl=k.reduce((C,M)=>{cs||(cs={});const O=cs[M];if(O)C[O[0]]=O[1];else{const D=m(M);for(let F=D.length-1;F>=0;F--){const J=D[F],W=J&&J.filename,U=w[M];if(W&&U){C[W]=U,cs[M]=[W,U];break}}}return C},{})),wl}(v);try{y.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(y,v){if(!v)return y;const S=y?y.clone():new $n;return S.update(v),S}(r,n.captureContext);n.mechanism&&qr(l,n.mechanism);const f=i?i.getEventProcessors():[],h=Xo("globalScope",()=>new $n).getScopeData();o&&Hf(h,o.getScopeData()),d&&Hf(h,d.getScopeData());const b=[...n.attachments||[],...h.attachments];return b.length&&(n.attachments=b),kb(l,h),bl([...f,...h.eventProcessors],l,n).then(y=>(y&&function(v){const S={};try{v.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;v.debug_meta=v.debug_meta||{},v.debug_meta.images=v.debug_meta.images||[];const m=v.debug_meta.images;Object.entries(S).forEach(([w,k])=>{m.push({type:"sourcemap",code_file:w,debug_id:k})})}(y),typeof s=="number"&&s>0?function(v,S,m){if(!v)return null;const w={...v,...v.breadcrumbs&&{breadcrumbs:v.breadcrumbs.map(k=>({...k,...k.data&&{data:mn(k.data,S,m)}}))},...v.user&&{user:mn(v.user,S,m)},...v.contexts&&{contexts:mn(v.contexts,S,m)},...v.extra&&{extra:mn(v.extra,S,m)}};return v.contexts&&v.contexts.trace&&w.contexts&&(w.contexts.trace=v.contexts.trace,v.contexts.trace.data&&(w.contexts.trace.data=mn(v.contexts.trace.data,S,m))),v.spans&&(w.spans=v.spans.map(k=>({...k,...k.data&&{data:mn(k.data,S,m)}}))),v.contexts&&v.contexts.flags&&w.contexts&&(w.contexts.flags=mn(v.contexts.flags,3,m)),w}(y,s,a):y))}function n_(t){}function Vf(t,e){return yr().captureEvent(t,e)}function Kf(t){const e=Qe(),n=Fi(),r=yr(),{release:i,environment:o=ml}=e&&e.getOptions()||{},{userAgent:s}=me.navigator||{},a=rb({release:i,environment:o,user:r.getUser()||n.getUser(),...s&&{userAgent:s},...t}),l=n.getSession();return l&&l.status==="ok"&&Jr(l,{status:"exited"}),Wf(),n.setSession(a),r.setSession(a),a}function Wf(){const t=Fi(),e=yr(),n=e.getSession()||t.getSession();n&&function(r,i){let o={};r.status==="ok"&&(o={status:"exited"}),Jr(r,o)}(n),qf(),t.setSession(),e.setSession()}function qf(){const t=Fi(),e=yr(),n=Qe(),r=e.getSession()||t.getSession();r&&n&&n.captureSession(r)}function Jf(t=!1){t?Wf():qf()}function _b(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 Gf=[];function Qf(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function Yf(t,e,n){if(n[e.name])_e&&re.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,Gf.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Gf.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)}_e&&re.log(`Integration installed: ${e.name}`)}}class Ut extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const Xf="Not capturing exception because it's already been captured.";class Cb{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=mb(e.dsn):_e&&re.warn("No DSN provided, client will not send events."),this._dsn){const r=_b(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&&Ni(()=>{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=Mt();if(Ef(e))return _e&&re.log(Xf),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:Mt(),...r},s=ol(e)?e:String(e),a=sl(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=Mt();if(n&&n.originalException&&Ef(n.originalException))return _e&&re.log(Xf),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"?_e&&re.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),Jr(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];Yf(this,e,this._integrations),n||Qf(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=Sb(e,this._dsn,this._options._metadata,this._options.tunnel);for(const o of n.attachments||[])r=vb(r,bb(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=Uf(o);return ji({sent_at:new Date().toISOString(),...a&&{sdk:a},...!!s&&i&&{dsn:ls(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}`;_e&&re.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=>(_e&&re.error("Error while sending envelope:",n),n)):(_e&&re.error("Transport disabled"),vr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(n,r){const i={};return r.forEach(o=>{o&&Yf(n,o,i)}),i}(this,e),Qf(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)&&(Jr(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new At(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=yr(),i=Fi()){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),xb(o,e,n,r,this,i).then(a=>{if(a===null)return a;a.contexts={trace:ab(r),...a.contexts};const l=function(c,d){const f=d.getPropagationContext();return f.dsc||Nf(f.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=>{_e&&(i instanceof Ut&&i.logLevel==="log"?re.log(i.message):re.warn(i))})}_processEvent(e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=eh(e),a=Zf(e),l=e.type||"error",c=`before send for type \`${l}\``,d=o===void 0?void 0:function(b){if(typeof b=="boolean")return Number(b);const y=typeof b=="string"?parseFloat(b):b;if(!(typeof y!="number"||isNaN(y)||y<0||y>1))return y;_e&&re.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(b)} of type ${JSON.stringify(typeof b)}.`)}(o);if(a&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),ss(new Ut(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const f=l==="replay_event"?"replay":l,h=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,h).then(b=>{if(b===null)throw this.recordDroppedEvent("event_processor",f,e),new Ut("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return b;const y=function(v,S,m,w){const{beforeSend:k,beforeSendTransaction:C,beforeSendSpan:M}=S;if(Zf(m)&&k)return k(m,w);if(eh(m)){if(m.spans&&M){const O=[];for(const D of m.spans){const F=M(D);F?O.push(F):(hb(),v.recordDroppedEvent("before_send","span"))}m.spans=O}if(C){if(m.spans){const O=m.spans.length;m.sdkProcessingMetadata={...m.sdkProcessingMetadata,spanCountBeforeProcessing:O}}return C(m,w)}}return m}(this,i,b,n);return function(v,S){const m=`${S} must return \`null\` or a valid event.`;if(is(v))return v.then(w=>{if(!Kr(w)&&w!==null)throw new Ut(m);return w},w=>{throw new Ut(`${S} rejected with ${w}`)});if(!Kr(v)&&v!==null)throw new Ut(m);return v}(y,c)}).then(b=>{if(b===null){if(this.recordDroppedEvent("before_send",f,e),s){const S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw new Ut(`${c} returned \`null\`, will not send event.`,"log")}const y=r&&r.getSession();if(!s&&y&&this._updateSessionFromEvent(y,b),s){const S=(b.sdkProcessingMetadata&&b.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(b.spans?b.spans.length:0);S>0&&this.recordDroppedEvent("before_send","span",S)}const v=b.transaction_info;if(s&&v&&b.transaction!==e.transaction){const S="custom";b.transaction_info={...v,source:S}}return this.sendEvent(b,n),b}).then(null,b=>{throw b instanceof Ut?b:(this.captureException(b,{data:{__sentry__:!0},originalException:b}),new Ut(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
18
|
+
Reason: ${b}`))})}_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(){_e&&re.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0)return void(_e&&re.log("No outcomes to send"));if(!this._dsn)return void(_e&&re.log("No dsn provided, will not send outcomes"));_e&&re.log("Sending outcomes:",e);const n=(r=e,ji((i=this._options.tunnel&&ls(this._dsn))?{dsn:i}:{},[[{type:"client_report"},{timestamp:o||$i(),discarded_events:r}]]));var r,i,o;this.sendEnvelope(n)}}function Zf(t){return t.type===void 0}function eh(t){return t.type==="transaction"}function Eb(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 ss(new Ut("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 At((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 Tb(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),f=parseInt(l,10),h=1e3*(isNaN(f)?60:f);if(c)for(const b of c.split(";"))b==="metric_bucket"&&d&&!d.split(";").includes("custom")||(i[b]=r+h);else i.all=r+h}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 Mb(t,e,n=Eb(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(jf(i,(l,c)=>{const d=Bf(c);if(function(f,h,b=Date.now()){return function(y,v){return y[v]||y.all||0}(f,h)>b}(r,d)){const f=th(l,c);t.recordDroppedEvent("ratelimit_backoff",d,f)}else o.push(l)}),o.length===0)return vr({});const s=ji(i[0],o),a=l=>{jf(s,(c,d)=>{const f=th(c,d);t.recordDroppedEvent(l,Bf(d),f)})};return n.add(()=>e({body:yb(s)}).then(l=>(l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&_e&&re.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=Tb(r,l),l),l=>{throw a("network_error"),l})).then(l=>l,l=>{if(l instanceof Ut)return _e&&re.error("Skipped sending event because buffer is full."),a("queue_overflow"),vr({});throw l})},flush:i=>n.drain(i)}}function th(t,e){if(e==="event"||e==="transaction")return Array.isArray(t)?t[1]:void 0}const Ab=100;function br(t,e){const n=Qe(),r=Fi();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Ab}=n.getOptions();if(o<=0)return;const s={timestamp:$i(),...t},a=i?Ni(()=>i(s,e)):s;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let nh;const rh=new WeakMap,Ob=()=>({name:"FunctionToString",setupOnce(){nh=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=ll(this),n=rh.has(Qe())&&e!==void 0?e:this;return nh.apply(n,t)}}catch{}},setup(t){rh.set(t,!0)}}),Db=[/^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+$/],Pb=(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?[]:Db],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)?(_e&&re.warn(`Event dropped due to being internal Sentry Error.
|
|
19
|
+
Event: ${Nn(s)}`),!0):function(l,c){return l.type||!c||!c.length?!1:function(d){const f=[];d.message&&f.push(d.message);let h;try{h=d.exception.values[d.exception.values.length-1]}catch{}return h&&h.value&&(f.push(h.value),h.type&&f.push(`${h.type}: ${h.value}`)),f}(l).some(d=>os(d,c))}(s,a.ignoreErrors)?(_e&&re.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
20
20
|
Event: ${Nn(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)?(_e&&re.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
21
|
-
Event: ${Nn(s)}`),!0):function(l,c){if(l.type!=="transaction"||!c||!c.length)return!1;const d=l.transaction;return!!d&&
|
|
22
|
-
Event: ${Nn(s)}`),!0):function(l,c){if(!c||!c.length)return!1;const d=
|
|
21
|
+
Event: ${Nn(s)}`),!0):function(l,c){if(l.type!=="transaction"||!c||!c.length)return!1;const d=l.transaction;return!!d&&os(d,c)}(s,a.ignoreTransactions)?(_e&&re.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
22
|
+
Event: ${Nn(s)}`),!0):function(l,c){if(!c||!c.length)return!1;const d=ds(l);return!!d&&os(d,c)}(s,a.denyUrls)?(_e&&re.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
23
23
|
Event: ${Nn(s)}.
|
|
24
|
-
Url: ${
|
|
24
|
+
Url: ${ds(s)}`),!0):function(l,c){if(!c||!c.length)return!0;const d=ds(l);return!d||os(d,c)}(s,a.allowUrls)?!1:(_e&&re.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
25
25
|
Event: ${Nn(s)}.
|
|
26
|
-
Url: ${us(s)}`),!0)}(e,o)?null:e}});function us(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 _e&&re.error(`Cannot extract url for event ${Nn(t)}`),null}}function Db(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&gr(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=wl(t,e,i,s.originalException,r,o.exception.values,a,0),c=n,l.map(d=>(d.value&&(d.value=Wr(d.value,c)),d))))}function wl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(gr(r[i],Error)){rh(s,a);const c=t(e,r[i]),d=l.length;ih(c,i,d,a),l=wl(t,e,n,r[i],i,[c,...l],c,d)}return Array.isArray(r.errors)&&r.errors.forEach((c,d)=>{if(gr(c,Error)){rh(s,a);const f=t(e,c),h=l.length;ih(f,`errors[${d}]`,h,a),l=wl(t,e,n,c,i,[f,...l],f,h)}}),l}function rh(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 ih(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 Sl(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 Pb(){"console"in me&&Za.forEach(function(t){t in me.console&&vt(me.console,t,function(e){return Xo[t]=e,function(...n){Bt("console",{args:n,level:t});const r=Xo[t];r&&r.apply(me.console,n)}})})}function Lb(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Ib=()=>{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||!sh(i,o)||!oh(i,o))}(n,r)||function(i,o){const s=ah(o),a=ah(i);return!(!s||!a||s.type!==a.type||s.value!==a.value||!sh(i,o)||!oh(i,o))}(n,r)):!1}(e,t))return _e&&re.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function oh(t,e){let n=ff(t),r=ff(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 sh(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 ah(t){return t.exception&&t.exception.values&&t.exception.values[0]}function lh(t){return t===void 0?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const kl=me;function xl(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Rb(){if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in kl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(xl(kl.fetch))return!0;let t=!1;const e=kl.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=xl(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){dr&&re.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function Nb(t,e){const n="fetch";hr(n,t),pr(n,()=>function(r,i=!1){i&&!Rb()||vt(me,"fetch",function(o){return function(...s){const a=new Error,{method:l,url:c}=function(f){if(f.length===0)return{method:"GET",url:""};if(f.length===2){const[b,y]=f;return{url:ch(b),method:_l(y,"method")?String(y.method).toUpperCase():"GET"}}const h=f[0];return{url:ch(h),method:_l(h,"method")?String(h.method).toUpperCase():"GET"}}(s),d={args:s,fetchData:{method:l,url:c},startTimestamp:1e3*pn(),virtualError:a};return r||Bt("fetch",{...d}),o.apply(me,s).then(async f=>(r?r(f):Bt("fetch",{...d,endTimestamp:1e3*pn(),response:f}),f),f=>{throw Bt("fetch",{...d,endTimestamp:1e3*pn(),error:f}),rl(f)&&f.stack===void 0&&(f.stack=a.stack,mr(f,"framesToPop",1)),f})}})}(void 0,e))}function _l(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ch(t){return typeof t=="string"?t:t?_l(t,"url")?t.url:t.toString?t.toString():"":""}const ds=me,Be=me;let Cl=0;function uh(){return Cl>0}function Qr(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(al(t))return t}catch{return t}const n=function(...r){try{const i=r.map(o=>Qr(o,e));return t.apply(this,i)}catch(i){throw Cl++,setTimeout(()=>{Cl--}),function(...o){const s=hl(ts());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&&(cl(a,void 0),qr(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),s=i,yr().captureException(s,void 0)}),i}};try{for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}catch{}wf(n,t),mr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}const fs=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function El(t,e){const n=Ml(t,e),r={type:jb(e),value:Bb(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function $b(t,e,n,r){const i=Qe(),o=i&&i.getOptions().normalizeDepth,s=function(c){for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d)){const f=c[d];if(f instanceof Error)return f}}(e),a={__serialized__:$f(e,o)};if(s)return{exception:{values:[El(t,s)]},extra:a};const l={exception:{values:[{type:ns(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Ub(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=Ml(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function Tl(t,e){return{exception:{values:[El(t,e)]}}}function Ml(t,e){const n=e.stacktrace||e.stack||"",r=function(o){return o&&Fb.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 Fb=/Minified React error #\d+;/i;function dh(t){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&t instanceof WebAssembly.Exception}function jb(t){const e=t&&t.name;return!e&&dh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Bb(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:dh(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function Al(t,e,n,r,i){let o;if(gf(e)&&e.error)return Tl(t,e.error);if(mf(e)||Vr(e,"DOMException")){const s=e;if("stack"in e)o=Tl(t,e);else{const a=s.name||(mf(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=Ol(t,l,n,r),cl(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return rl(e)?Tl(t,e):Kr(e)||ns(e)?(o=$b(t,e,n,i),qr(o,{synthetic:!0}),o):(o=Ol(t,e,n,r),cl(o,`${e}`),qr(o,{synthetic:!0}),o)}function Ol(t,e,n,r){const i={};if(r&&n){const o=Ml(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),qr(i,{synthetic:!0})}if(il(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 Ub(t,{isUnhandledRejection:e}){const n=function(i,o=40){const s=Object.keys(Sf(i));s.sort();const a=s[0];if(!a)return"[object has no keys]";if(a.length>=o)return Wr(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:Wr(c,o)}return""}(t),r=e?"promise rejection":"exception";return gf(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:ns(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 zb extends xb{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:ur})),version:ur}),r._metadata=a})(n,"browser",["browser"],Be.SENTRY_SDK_SOURCE||"npm"),super(n),n.sendClientReports&&Be.document&&Be.document.addEventListener("visibilitychange",()=>{Be.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return function(r,i,o,s){const a=Al(r,i,o&&o.syntheticException||void 0,s);return qr(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=Ol(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(fs&&re.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:as(s)}};return ji(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 Hb=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,rt=me;let fh,Dl,Pl,hs;function Vb(){if(!rt.document)return;const t=Bt.bind(null,"dom"),e=hh(t,!0);rt.document.addEventListener("click",e,!1),rt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=rt[n],i=r&&r.prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(vt(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 f=hh(t);d.handler=f,o.call(this,s,f,l)}d.refCount++}catch{}return o.call(this,s,a,l)}}),vt(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 hh(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;mr(n,"_sentryCaptured",!0),r&&!r._sentryId&&mr(r,"_sentryId",Mt());const i=n.type==="keypress"?"input":n.type;(function(o){if(o.type!==Dl)return!1;try{if(!o.target||o.target._sentryId!==Pl)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Dl=n.type,Pl=r?r._sentryId:void 0),clearTimeout(fh),fh=rt.setTimeout(()=>{Pl=void 0,Dl=void 0},1e3)}}function ph(t){const e="history";hr(e,t),pr(e,Kb)}function Kb(){if(!function(){const n=ds.chrome,r=n&&n.app&&n.app.runtime,i="history"in ds&&!!ds.history.pushState&&!!ds.history.replaceState;return!r&&i}())return;const t=rt.onpopstate;function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const o=hs,s=String(i);hs=s,Bt("history",{from:o,to:s})}return n.apply(this,r)}}rt.onpopstate=function(...n){const r=rt.location.href,i=hs;if(hs=r,Bt("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}},vt(rt.history,"pushState",e),vt(rt.history,"replaceState",e)}const ps={};function gh(t){ps[t]=void 0}const Bi="__sentry_xhr_v3__";function Wb(){if(!rt.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,o=1e3*pn(),s=hn(r[0])?r[0].toUpperCase():void 0,a=function(c){if(hn(c))return c;try{return c.toString()}catch{}}(r[1]);if(!s||!a)return e.apply(n,r);n[Bi]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[Bi];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}Bt("xhr",{endTimestamp:1e3*pn(),startTimestamp:o,xhr:n,virtualError:i})}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply:(c,d,f)=>(l(),c.apply(d,f))}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,d,f){const[h,b]=f,y=d[Bi];return y&&hn(h)&&hn(b)&&(y.request_headers[h.toLowerCase()]=b),c.apply(d,f)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[Bi];return i?(r[0]!==void 0&&(i.body=r[0]),Bt("xhr",{startTimestamp:1e3*pn(),xhr:n}),e.apply(n,r)):e.apply(n,r)}})}function qb(t,e=function(n){const r=ps[n];if(r)return r;let i=rt[n];if(xl(i))return ps[n]=i.bind(rt);const o=rt.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){Hb&&re.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,s)}return i&&(ps[n]=i.bind(rt))}("fetch")){let n=0,r=0;return Eb(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 gh("fetch"),os("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 gh("fetch"),n-=o,r--,os(a)}})}function Ll(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 Jb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Gb=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Qb=/\((\S*)(?::(\d+))(?::(\d+))\)/,Yb=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Xb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Zb=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=cf.test(l)?l.replace(cf,"$1"):l;if(!c.match(/\S*Error: /)){for(const d of e){const f=d(c);if(f){o.push(f);break}}if(o.length>=50+i)break}}return function(a){if(!a.length)return[];const l=Array.from(a);return/sentryWrapped/.test(Zo(l).function||"")&&l.pop(),l.reverse(),uf.test(Zo(l).function||"")&&(l.pop(),uf.test(Zo(l).function||"")&&l.pop()),l.slice(0,50).map(c=>({...c,filename:c.filename||Zo(l).filename,function:c.function||fr}))}(o.slice(i))}}([30,t=>{const e=Jb.exec(t);if(e){const[,r,i,o]=e;return Ll(r,fr,+i,+o)}const n=Gb.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=Qb.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,i]=mh(n[1]||fr,n[2]);return Ll(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=Yb.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=Xb.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]=mh(r,n),Ll(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),mh=(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]},vh=1024,e0=(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";hr(o,i),pr(o,Pb)}(function(i){return function(o){if(Qe()!==i)return;const s={category:"console",data:{arguments:o.args,logger:"console"},level:Lb(o.level),message:bf(o.args," ")};if(o.level==="assert"){if(o.args[0]!==!1)return;s.message=`Assertion failed: ${bf(o.args.slice(1)," ")||"console.assert"}`,s.data.arguments=o.args.slice(1)}br(s,{input:o.args,level:o.level})}}(n)),e.dom&&(r=function(i,o){return function(s){if(Qe()!==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>vh&&(fs&&re.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${d} was configured. Sentry will use 1024 instead.`),d=vh),typeof c=="string"&&(c=[c]);try{const h=s.event,b=function(y){return!!y&&!!y.target}(h)?h.target:h;a=yf(b,{keyAttrs:c,maxStringLength:d}),l=function(y){if(!sl.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}(b)}catch{a="<unknown>"}if(a.length===0)return;const f={category:`ui.${s.name}`,message:a};l&&(f.data={"ui.component_name":l}),br(f,{event:s.event,name:s.name,global:s.global})}}(n,e.dom),hr("dom",r),pr("dom",Vb)),e.xhr&&function(i){hr("xhr",i),pr("xhr",Wb)}(function(i){return function(o){if(Qe()!==i)return;const{startTimestamp:s,endTimestamp:a}=o,l=o.xhr[Bi];if(!s||!a||!l)return;const{method:c,url:d,status_code:f,body:h}=l,b={method:c,url:d,status_code:f},y={xhr:o.xhr,input:h,startTimestamp:s,endTimestamp:a};br({category:"xhr",data:b,type:"http",level:lh(f)},y)}}(n)),e.fetch&&Nb(function(i){return function(o){if(Qe()!==i)return;const{startTimestamp:s,endTimestamp:a}=o;if(a&&(!o.fetchData.url.match(/sentry_key/)||o.fetchData.method!=="POST"))if(o.error)br({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};br({category:"fetch",data:c,type:"http",level:lh(c.status_code)},d)}}}(n)),e.history&&ph(function(i){return function(o){if(Qe()!==i)return;let s=o.from,a=o.to;const l=Sl(Be.location.href);let c=s?Sl(s):void 0;const d=Sl(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),br({category:"navigation",data:{from:s,to:a}})}}(n)),e.sentry&&n.on("beforeSendEvent",function(i){return function(o){Qe()===i&&br({category:"sentry."+(o.type==="transaction"?"transaction":"event"),event_id:o.event_id,level:o.level,message:Nn(o)},{event:o})}}(n))}}},t0=["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"],n0=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&vt(Be,"setTimeout",yh),e.setInterval&&vt(Be,"setInterval",yh),e.requestAnimationFrame&&vt(Be,"requestAnimationFrame",r0),e.XMLHttpRequest&&"XMLHttpRequest"in Be&&vt(XMLHttpRequest.prototype,"send",i0);const n=e.eventTarget;n&&(Array.isArray(n)?n:t0).forEach(o0)}}};function yh(t){return function(...e){const n=e[0];return e[0]=Qr(n,{mechanism:{data:{function:Rn(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function r0(t){return function(e){return t.apply(this,[Qr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Rn(t)},handled:!1,type:"instrument"}})])}}function i0(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&vt(n,r,function(i){const o={mechanism:{data:{function:r,handler:Rn(i)},handled:!1,type:"instrument"}},s=al(i);return s&&(o.mechanism.data.handler=Rn(s)),Qr(i,o)})}),t.apply(this,e)}}function o0(t){const e=Be[t],n=e&&e.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(vt(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=Qr(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Rn(o),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Qr(o,{mechanism:{data:{function:"addEventListener",handler:Rn(o),target:t},handled:!1,type:"instrument"}}),s])}}),vt(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 s0=()=>({name:"BrowserSession",setupOnce(){Be.document!==void 0?(Vf({ignoreDuration:!0}),qf(),ph(({from:t,to:e})=>{t!==void 0&&t!==e&&(Vf({ignoreDuration:!0}),qf())})):fs&&re.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),a0=(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";hr(o,i),pr(o,Yy)})(i=>{const{stackParser:o,attachStacktrace:s}=wh();if(Qe()!==r||uh())return;const{msg:a,url:l,line:c,column:d,error:f}=i,h=function(b,y,m,S){const v=b.exception=b.exception||{},w=v.values=v.values||[],k=w[0]=w[0]||{},C=k.stacktrace=k.stacktrace||{},M=C.frames=C.frames||[],O=S,D=m,F=hn(y)&&y.length>0?y:function(){try{return sl.document.location.href}catch{return""}}();return M.length===0&&M.push({colno:O,filename:F,function:fr,in_app:!0,lineno:D}),b}(Al(o,f||a,void 0,s,!1),l,c,d);h.level="error",Hf(h,{originalException:f,mechanism:{handled:!1,type:"onerror"}})})}(n),bh("onerror")),e.onunhandledrejection&&(function(r){(function(i){const o="unhandledrejection";hr(o,i),pr(o,Xy)})(i=>{const{stackParser:o,attachStacktrace:s}=wh();if(Qe()!==r||uh())return;const a=function(c){if(ol(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=ol(a)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`}]}}:Al(o,a,void 0,s,!0);l.level="error",Hf(l,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(n),bh("onunhandledrejection"))}}};function bh(t){fs&&re.log(`Global Handler attached: ${t}`)}function wh(){const t=Qe();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const l0=()=>({name:"HttpContext",preprocessEvent(t){if(!Be.navigator&&!Be.location&&!Be.document)return;const e=t.request&&t.request.url||Be.location&&Be.location.href,{referrer:n}=Be.document||{},{userAgent:r}=Be.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}}),c0=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(r,i,o){const s=o.getOptions();Db(El,s.stackParser,s.maxValueLength,n,e,r,i)}}};var Sh="new",kh="loading",xh="loaded",Il="joining-meeting",wr="joined-meeting",Fn="left-meeting",jn="error",u0="playable",Rl="unknown",d0="full",f0="base",_h="no-room",h0="end-of-life",p0="connection-error",g0="iframe-ready-for-launch-config",m0="iframe-launch-config",v0="theme-updated",y0="loading",b0="load-attempt-failed",Ch="loaded",w0="started-camera",S0="camera-error",k0="joining-meeting",x0="joined-meeting",_0="left-meeting",C0="participant-joined",E0="participant-updated",T0="participant-left",M0="participant-counts-updated",A0="access-state-updated",O0="meeting-session-summary-updated",D0="meeting-session-state-updated",P0="waiting-participant-added",L0="waiting-participant-updated",I0="waiting-participant-removed",R0="track-started",N0="track-stopped",$0="transcription-started",F0="transcription-stopped",j0="transcription-error",Eh="recording-started",Th="recording-stopped",B0="recording-stats",U0="recording-error",z0="recording-upload-completed",H0="recording-data",V0="app-message",K0="transcription-message",W0="remote-media-player-started",q0="remote-media-player-updated",J0="remote-media-player-stopped",G0="local-screen-share-started",Q0="local-screen-share-stopped",Y0="local-screen-share-canceled",X0="active-speaker-change",Z0="active-speaker-mode-change",ew="network-quality-change",tw="network-connection",nw="cpu-load-change",rw="face-counts-updated",gs="fullscreen",ms="exited-fullscreen",iw="live-streaming-started",ow="live-streaming-updated",sw="live-streaming-stopped",aw="live-streaming-error",lw="lang-updated",cw="receive-settings-updated",Mh="input-settings-updated",Ah="nonfatal-error",Oh="error",Nl=4096,Dh=102400,$l="iframe-call-message",Ph="local-screen-start",Lh="daily-method-update-live-streaming-endpoints",vs="transmit-log",vn="daily-custom-track",ys={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},Ih={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},Fl={PLAY:"play",PAUSE:"pause"},jl=["jpg","png","jpeg"],uw="add-endpoints",dw="remove-endpoints",Rh="sip-call-transfer";function Ot(){return!fe()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function fe(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function Nh(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function fw(){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}(Sr(),bs())||fe())}function $h(){if(fe()||!document)return!1;var t=document.createElement("iframe");return!!t.requestFullscreen||!!t.webkitRequestFullscreen}var Bl="none",hw="software",pw="hardware",gw=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?hw:pw:Bl}catch{return Bl}}();function Fh(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!fe()&&gw!==Bl&&(t?function(){return Uh()?!1:["Chrome","Firefox"].includes(Sr())}():function(){if(Uh())return!1;var e=Sr();if(e==="Safari"){var n=Hl();if(n.major<15||n.major===15&&n.minor<4)return!1}return e==="Chrome"?zl().major>=77:e==="Firefox"?Vl().major>=97:["Chrome","Firefox","Safari"].includes(e)}())}function jh(){if(fe()||Bh()||typeof AudioWorkletNode>"u")return!1;switch(Sr()){case"Chrome":case"Firefox":return!0;case"Safari":var t=bs();return t.major>17||t.major===17&&t.minor>=4}return!1}function Ul(){return Nh()&&typeof MediaStreamTrack<"u"&&!function(){var t,e=Sr();if(!Ot())return!0;switch(e){case"Chrome":return(t=zl()).major&&t.major>0&&t.major<75;case"Firefox":return(t=Vl()).major<91;case"Safari":return(t=Hl()).major<13||t.major===13&&t.minor<1;default:return!0}}()}function Bh(){return Ot().match(/Linux; Android/)}function Uh(){var t,e=Ot(),n=e.match(/Mac/)&&(!fe()&&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)||!!Ot().match(/DailyAnd\//)||void 0}function Sr(){if(typeof window<"u"){var t=Ot();return zh()?"Safari":t.indexOf("Edge")>-1?"Edge":t.match(/Chrome\//)?"Chrome":t.indexOf("Safari")>-1||Hh()?"Safari":t.indexOf("Firefox")>-1?"Firefox":t.indexOf("MSIE")>-1||t.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function bs(){switch(Sr()){case"Chrome":return zl();case"Safari":return Hl();case"Firefox":return Vl();case"Edge":return function(){var t=0,e=0;if(typeof window<"u"){var n=Ot().match(/Edge\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}()}}function zl(){var t=0,e=0,n=0,r=0,i=!1;if(typeof window<"u"){var o=Ot(),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 zh(){return!!Ot().match(/iPad|iPhone|iPod/i)&&Nh()}function Hh(){return Ot().indexOf("AppleWebKit/605.1.15")>-1}function Hl(){var t=0,e=0,n=0;if(typeof window<"u"){var r=Ot().match(/Version\/(\d+).(\d+)(.(\d+))?/);if(r)try{t=parseInt(r[1]),e=parseInt(r[2]),n=parseInt(r[4])}catch{}else(zh()||Hh())&&(t=14,e=0,n=3)}return{major:t,minor:e,point:n}}function Vl(){var t=0,e=0;if(typeof window<"u"){var n=Ot().match(/Firefox\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}var Vh=function(){return mt(function t(){gt(this,t)},[{key:"addListenerForMessagesFromCallMachine",value:function(t,e,n){Ri()}},{key:"addListenerForMessagesFromDailyJs",value:function(t,e,n){Ri()}},{key:"sendMessageToCallMachine",value:function(t,e,n,r){Ri()}},{key:"sendMessageToDailyJs",value:function(t,e){Ri()}},{key:"removeListener",value:function(t){Ri()}}])}();function Kh(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 Kl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Kh(Object(n),!0).forEach(function(r){en(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Wh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wh=function(){return!!t})()}var mw=function(){function t(){var e,n,r,i;return gt(this,t),n=this,r=jt(r=t),(e=Vo(n,Wh()?Reflect.construct(r,[],jt(n).constructor):r.apply(n,i)))._wrappedListeners={},e._messageCallbacks={},e}return Ko(t,Vh),mt(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=Kl({},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!==$l||!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=Kl({},e);if(o.what=$l,o.from="module",o.callClientId=r,n){var s=Jo();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=$l,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=Kl({},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 qh(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 Jh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jh=function(){return!!t})()}var vw=function(){function t(){var e,n,r,i;return gt(this,t),n=this,r=jt(r=t),e=Vo(n,Jh()?Reflect.construct(r,[],jt(n).constructor):r.apply(n,i)),global.callMachineToDailyJsEmitter=global.callMachineToDailyJsEmitter||new Xa.EventEmitter,global.dailyJsToCallMachineEmitter=global.dailyJsToCallMachineEmitter||new Xa.EventEmitter,e._wrappedListeners={},e._messageCallbacks={},e}return Ko(t,Vh),mt(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?qh(Object(d),!0).forEach(function(f){en(l,f,d[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):qh(Object(d)).forEach(function(f){Object.defineProperty(l,f,Object.getOwnPropertyDescriptor(d,f))})}return l}({},e);if(s.callClientId=r,i){var a=Jo();this._messageCallbacks[a]=i,s.callbackStamp=a}n.emit("message",s)}}])}(),Wl="replace",ql="shallow-merge",Gh=[Wl,ql],yw=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.data,r=e.mergeStrategy,i=r===void 0?Wl:r;gt(this,t),t._validateMergeStrategy(i),t._validateData(n,i),this.mergeStrategy=i,this.data=n}return mt(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===ql}},{key:"_validateMergeStrategy",value:function(e){if(!Gh.includes(e))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(Gh,"]"))}},{key:"_validateData",value:function(e,n){if(!function(a){if(a==null||pe(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===Wl){var i=JSON.parse(r);tt(i,e)||console.warn("The meeting session data provided will be modified when serialized.",i,e)}else if(n===ql){for(var o in e)if(Object.hasOwnProperty.call(e,o)&&e[o]!==void 0){var s=JSON.parse(JSON.stringify(e[o]));tt(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>Dh)throw Error("Meeting session data is too large (".concat(r.length," characters). Maximum size suppported is ").concat(Dh,"."))}}])}();function Qh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Qh=function(){return!!t})()}function Jl(t){var e=typeof Map=="function"?new Map:void 0;return Jl=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(Qh())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,o);var l=new(i.bind.apply(i,a));return s&&Ii(l,s.prototype),l}(n,arguments,jt(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ii(r,n)},Jl(t)}function Yh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Yh=function(){return!!t})()}function Xh(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 bw=function(){return mt(function t(e){gt(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 ww(n,function(){r(!1)},function(o,s){s||Xh(e._callClientId),i(o,s)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),Xh(this._callClientId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}])}(),ww=function(){return mt(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;gt(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 Zh(t._dailyConfig,t._successCallback,e),t._currentAttempt.start())},3e3))};this._currentAttempt=new Zh(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}}])}(),Gl=function(){function t(){return gt(this,t),e=this,r=arguments,n=jt(n=t),Vo(e,Yh()?Reflect.construct(n,r||[],jt(e).constructor):n.apply(e,r));var e,n,r}return Ko(t,Jl(Error)),mt(t)}(),ws=2e4,Zh=function(){return mt(function e(n,r,i){gt(this,e),this._loadAttemptImpl=fe()||!n.avoidEval?new Sw(n,r,i):new kw(n,r,i)},[{key:"start",value:(t=ee(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}(),Sw=function(){return mt(function i(o,s,a){gt(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=ee(function*(){var i=Go(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=ee(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=ee(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(ws," ms) when loading call object bundle ").concat(i),type:"timeout"})},ws);try{var s=this._refetchHeaders?{headers:this._refetchHeaders}:{},a=yield fetch(i,s);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new Gl;var l=yield this._getBundleCodeFromResponse(i,a);if(this.cancelled)throw new Gl;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 Gl||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=ee(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}(),kw=function(){return mt(function t(e,n,r){gt(this,t),this.cancelled=!1,this.succeeded=!1,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r,this._attemptId=Jo(),this._networkTimeout=null,this._scriptElement=null},[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=Go(this._dailyConfig);(typeof document>"u"?"undefined":pe(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(ws," ms) when loading call object bundle ").concat(t),type:"timeout"})},ws);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)}}])}(),Ss=function(t,e,n){return _w(t.local,e,n)===!0},xw=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]},Yr=function(t,e,n,r){var i=Cw(t,e,n,r);return i&&i.pendingTrack},_w=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)},Cw=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]},Ew=function(t,e){var n=t.local.public.customTracks;if(n&&n[e])return n[e].track};function ep(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 f=t.local?xw(n,o,l):Yr(n,t.session_id,o,l);d.state==="playable"&&(d.track=f),d.persistentTrack=f}}}function tp(t,e){try{var n=e.getState();for(var r in t.tracks)if(!Tw(r)){var i=t.tracks[r].kind;if(i){var o=t.tracks[r];if(o){var s=t.local?Ew(n,r):Yr(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 Tw(t){return["video","audio","screenVideo","screenAudio"].includes(t)}function np(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&&Ss(r,t.session_id,"cam-audio")){var s=Yr(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&&Ss(r,t.session_id,"cam-video")){var a=Yr(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&&Ss(r,t.session_id,"screen-audio")){var l=Yr(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&&Ss(r,t.session_id,"screen-video")){var c=Yr(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 Mw(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 rp(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)?rp(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
|
|
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 ip(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 nn=new Map,Ui=null;function Ow(t){op()?function(e){tn.has(e)||(tn.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){tn.has(e)&&(tn.get(e).lastDevicesString=JSON.stringify(n),Xr||(Xr=function(){var r=ee(function*(){var i,o=yield navigator.mediaDevices.enumerateDevices(),s=Mw(tn.keys());try{for(s.s();!(i=s.n()).done;){var a=i.value,l=JSON.stringify(o);l!==tn.get(a).lastDevicesString&&(tn.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",Xr)))}).catch(function(){}))}(t):function(e){nn.has(e)||(nn.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){nn.has(e)&&(nn.get(e).lastDevicesString=JSON.stringify(n),Ui||(Ui=setInterval(ee(function*(){var r,i=yield navigator.mediaDevices.enumerateDevices(),o=Aw(nn.keys());try{for(o.s();!(r=o.n()).done;){var s=r.value,a=JSON.stringify(i);a!==nn.get(s).lastDevicesString&&(nn.get(s).lastDevicesString=a,s(i))}}catch(l){o.e(l)}finally{o.f()}}),3e3)))}))}(t)}function Dw(t){op()?function(e){tn.has(e)&&(tn.delete(e),tn.size===0&&Xr&&(navigator.mediaDevices.removeEventListener("devicechange",Xr),Xr=null))}(t):function(e){nn.has(e)&&(nn.delete(e),nn.size===0&&Ui&&(clearInterval(Ui),Ui=null))}(t)}function op(){var t;return fe()||((t=navigator.mediaDevices)===null||t===void 0?void 0:t.ondevicechange)!==void 0}var Pw=new Set;function Lw(t,e){return t&&t.readyState==="live"&&!function(n,r){return n.muted&&!Pw.has(n.id)}(t)}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 Bn(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){en(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}var zi=Object.freeze({VIDEO:"video",AUDIO:"audio",SCREEN_VIDEO:"screenVideo",SCREEN_AUDIO:"screenAudio",CUSTOM_VIDEO:"customVideo",CUSTOM_AUDIO:"customAudio"}),Iw=Object.freeze({PARTICIPANTS:"participants",STREAMING:"streaming",TRANSCRIPTION:"transcription"}),Hi=Object.values(zi),ap=["v","a","sv","sa","cv","ca"];Object.freeze(Hi.reduce(function(t,e,n){return t[e]=ap[n],t},{})),Object.freeze(ap.reduce(function(t,e,n){return t[e]=Hi[n],t},{}));var Rw=[zi.VIDEO,zi.AUDIO,zi.SCREEN_VIDEO,zi.SCREEN_AUDIO],lp=Object.values(Iw),cp=["p","s","t"];Object.freeze(lp.reduce(function(t,e,n){return t[e]=cp[n],t},{})),Object.freeze(cp.reduce(function(t,e,n){return t[e]=lp[n],t},{}));var up=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.base,r=e.byUserId,i=e.byParticipantId;gt(this,t),this.base=n,this.byUserId=r,this.byParticipantId=i}return mt(t,[{key:"clone",value:function(){var e=new t;if(this.base instanceof Ve?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 Ve?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 Ve?o.clone():o}return e}},{key:"toJSONObject",value:function(){var e={};if(typeof this.base=="boolean"?e.base=this.base:this.base instanceof Ve&&(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 Ve?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 Ve?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 Ve&&(this.base=this.base.normalize()),this.byUserId&&(this.byUserId=Object.fromEntries(Object.entries(this.byUserId).map(function(e){var n=Ge(e,2),r=n[0],i=n[1];return[r,i instanceof Ve?i.normalize():i]}))),this.byParticipantId&&(this.byParticipantId=Object.fromEntries(Object.entries(this.byParticipantId).map(function(e){var n=Ge(e,2),r=n[0],i=n[1];return[r,i instanceof Ve?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:Ve.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:Ve.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:Ve.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:Ve.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:Ve.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:Ve.fromMinifiedJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"validateJSONObject",value:function(e){if(pe(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=Ge(Ve.validateJSONObject(e.base,!0),2),a=s[0],l=s[1];if(!a)return[!1,l]}else{if(pe(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 f=d[c],h=Ge(Ve.validateJSONObject(f),2),b=h[0],y=h[1];if(!b)return[!1,y]}}}return[!0]}}])}(),Ve=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;gt(this,t),this.video=n,this.audio=r,this.screenVideo=i,this.screenAudio=o,this.customVideo=s,this.customAudio=a}return mt(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=Bn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Bn({},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=Bn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Bn({},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=Bn({},this.customVideo)),this.customAudio!==void 0&&(e.ca=Bn({},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?Bn({},e.customVideo):void 0,customAudio:e.customAudio!==void 0?Bn({},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(pe(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(!Hi.includes(s))return[!1,"invalid media type '".concat(s,"' in canReceive")];if(Rw.includes(s)){if(typeof e[s]!="boolean")return[!1,"invalid (non-boolean) value for media type '".concat(s,"' in canReceive")]}else{if(pe(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!==Hi.length?[!1,'canReceive "base" permission must specify all media types: '.concat(Hi.join(", ")," (or be set to a boolean shorthand)")]:[!0]}}])}(),Nw=["result"],$w=["preserveIframe"];function dp(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 K(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dp(Object(n),!0).forEach(function(r){en(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fp=function(){return!!t})()}function hp(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.
|
|
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 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 kr={},gp="video",Fw="voice",mp=fe()?{data:{}}:{data:{},topology:"none"},vp={present:0,hidden:0},yp={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},Ql=Object.keys(yp),bp=["state","volume","simulcastEncodings"],wp={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},ks={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string",visualState:"'default' | 'sidebar-open' | 'active'"}},Yl={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"}},xr={customIntegrations:{validate:Op,help:Mp()},customTrayButtons:{validate:Ap,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(ks))},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 Dp(t,wp)},help:"reactNativeConfig should look like ".concat(JSON.stringify(wp),", 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 kp(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:vn};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:vn};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 pe(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 xp(t,{allowAllParticipantsKey:!1})},help:Tp({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!!_p(t)&&(e._inputSettings||(e._inputSettings={}),Cp(t,(n=e.properties)===null||n===void 0?void 0:n.dailyConfig,e._sharedTracks),e._updatePreloadCacheInputSettings(t,!0),!0)},help:ec()},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},xs={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)||!fe()&&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(fe()?"":" | '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=Ge(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=hp(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=Ge(up.validateJSONObject(o),2),f=d[0],h=d[1];if(!f)return console.error(h),!1;break;case"canAdmin":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var b,y=["participants","streaming","transcription"],m=hp(o);try{for(m.s();!(b=m.n()).done;){var S=b.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=ee(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 jw=function(){function t(u){var g,p,x,_,A,P,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(gt(this,t),x=this,_=jt(_=t),en(p=Vo(x,fp()?Reflect.construct(_,[],jt(x).constructor):_.apply(x,A)),"startListeningForDeviceChanges",function(){Ow(p.handleDeviceChange)}),en(p,"stopListeningForDeviceChanges",function(){Dw(p.handleDeviceChange)}),en(p,"handleDeviceChange",function(te){te=te.map(function(ue){return JSON.parse(JSON.stringify(ue))}),p.emitDailyJSEvent({action:"available-devices-updated",availableDevices:te})}),en(p,"handleNativeAppStateChange",function(){var te=ee(function*(ue){if(ue==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield p.destroy());var lt=ue==="active";p.disableReactNativeAutoDeviceManagement("video")||(lt?p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!0):(p.camUnmutedBeforeLosingNativeActiveState=p.localVideo(),p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!1)))});return function(ue){return te.apply(this,arguments)}}()),en(p,"handleNativeAudioFocusChange",function(te){p.disableReactNativeAutoDeviceManagement("audio")||(p._hasNativeAudioFocus=te,p.toggleParticipantAudioBasedOnNativeAudioFocus(),p._hasNativeAudioFocus?p.micUnmutedBeforeLosingNativeAudioFocus&&p.setLocalAudio(!0):(p.micUnmutedBeforeLosingNativeAudioFocus=p.localAudio(),p.setLocalAudio(!1)))}),en(p,"handleNativeSystemScreenCaptureStop",function(){p.stopScreenShare()}),!Ul()&&!fe())throw new Error("WebRTC not supported or suppressed");if(p.strictMode=$.strictMode===void 0||$.strictMode,p.allowMultipleCallInstances=(g=$.allowMultipleCallInstances)!==null&&g!==void 0&&g,Object.keys(kr).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=Jo(),kr[(P=p).callClientId]=P,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=K({},$),p._inputSettings||(p._inputSettings={}),p._callObjectLoader=p._callObjectMode?new bw(p.callClientId):null,p._callState=Sh,p._isPreparingToJoin=!1,p._accessState={access:Rl},p._meetingSessionSummary={},p._finalSummaryOfPrevSession={},p._meetingSessionState=tc(mp,p._callObjectMode),p._nativeInCallAudioMode=gp,p._participants={},p._isScreenSharing=!1,p._participantCounts=vp,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=Nl,p._messageChannel=fe()?new vw:new mw,p._iframe&&(p._iframe.requestFullscreen?p._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===p._iframe?(p.emitDailyJSEvent({action:gs}),p.sendMessageToCallMachine({action:gs})):(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms}))}):p._iframe.webkitRequestFullscreen&&p._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===p._iframe?(p.emitDailyJSEvent({action:gs}),p.sendMessageToCallMachine({action:gs})):(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms}))})),fe()){var B=p.nativeUtils();B.addAudioFocusChangeListener&&B.removeAudioFocusChangeListener&&B.addAppStateChangeListener&&B.removeAppStateChangeListener&&B.addSystemScreenCaptureStopListener&&B.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),p._hasNativeAudioFocus=!0,B.addAudioFocusChangeListener(p.handleNativeAudioFocusChange),B.addAppStateChangeListener(p.handleNativeAppStateChange),B.addSystemScreenCaptureStopListener(p.handleNativeSystemScreenCaptureStop)}return p._callObjectMode&&p.startListeningForDeviceChanges(),p._messageChannel.addListenerForMessagesFromCallMachine(p.handleMessageFromCallMachine,p.callClientId,p),p}return Ko(t,qo),mt(t,[{key:"destroy",value:(ve=ee(function*(){var u;try{yield this.leave()}catch{}var g=this._iframe;if(g){var p=g.parentElement;p&&p.removeChild(g)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),fe()){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 kr[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 ve.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(u){var g=u.bodyClass,p=u.cssFile,x=u.cssText;return he(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl(p),bodyClass:g,cssText:x}),this}},{key:"iframe",value:function(){return he(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return zt(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return zt(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(u,g){for(var p in g){if(!xs[p])throw new Error("unrecognized updateParticipant property ".concat(p));if(xs[p].validate&&!xs[p].validate(g[p],this,this._participants[u]))throw new Error(xs[p].help)}}},{key:"updateParticipant",value:function(u,g){return this._participants.local&&this._participants.local.session_id===u&&(u="local"),u&&g&&(this.validateParticipantProperties(u,g),this.sendMessageToCallMachine({action:"update-participant",id:u,properties:g})),this}},{key:"updateParticipants",value:function(u){var g=this._participants.local&&this._participants.local.session_id;for(var p in u)p===g&&(p="local"),p&&u[p]&&this.validateParticipantProperties(p,u[p]);return this.sendMessageToCallMachine({action:"update-participants",participants:u}),this}},{key:"updateWaitingParticipant",value:(ae=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(zt(this._callObjectMode,"updateWaitingParticipant()"),xe(this._callState,"updateWaitingParticipant()"),typeof g!="string"||pe(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:g,updates:p},function(A){A.error&&_(A.error),A.id||_(new Error("unknown error in updateWaitingParticipant()")),x({id:A.id})})})}),function(){return ae.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(Q=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(this._callObjectMode,"updateWaitingParticipants()"),xe(this._callState,"updateWaitingParticipants()"),pe(g)!=="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:g},function(_){_.error&&x(_.error),_.ids||x(new Error("unknown error in updateWaitingParticipants()")),p({ids:_.ids})})})}),function(){return Q.apply(this,arguments)})},{key:"requestAccess",value:(j=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=g.access,x=p===void 0?{level:d0}:p,_=g.name,A=_===void 0?"":_;return zt(this._callObjectMode,"requestAccess()"),xe(this._callState,"requestAccess()"),new Promise(function(P,$){u.sendMessageToCallMachine({action:"daily-method-request-access",access:x,name:A},function(B){B.error&&$(B.error),B.access||$(new Error("unknown error in requestAccess()")),P({access:B.access,granted:B.granted})})})}),function(){return j.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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return"forceDiscardTrack"in g&&(fe()?(console.warn("forceDiscardTrack option not supported in React Native; ignoring"),g={}):u&&(console.warn("forceDiscardTrack option only supported when calling setLocalAudio(false); ignoring"),g={})),this.sendMessageToCallMachine({action:"local-audio",state:u,options:g}),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:(R=ee(function*(u){var g=this,p=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,x=p!==void 0&&p;if(zt(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(pe(u)){case"string":return new Promise(function(_){g.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:u,showInheritedValues:x},function(A){_(A.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 R.apply(this,arguments)})},{key:"updateReceiveSettings",value:(ne=ee(function*(u){var g=this;if(zt(this._callObjectMode,"updateReceiveSettings()"),!xp(u,{allowAllParticipantsKey:!0}))throw new Error(Tp({allowAllParticipantsKey:!0}));return xe(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function(p){g.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:u},function(x){p({receiveSettings:x.receiveSettings})})})}),function(u){return ne.apply(this,arguments)})},{key:"_prepInputSettingsForSharing",value:function(u,g){if(u){var p={};if(u.audio){var x,_,A;u.audio.settings&&(!Object.keys(u.audio.settings).length&&g||(p.audio={settings:K({},u.audio.settings)})),g&&(x=p.audio)!==null&&x!==void 0&&(x=x.settings)!==null&&x!==void 0&&x.customTrack&&(p.audio.settings={customTrack:this._sharedTracks.audioTrack});var P=((_=u.audio.processor)===null||_===void 0?void 0:_.type)==="none"&&((A=u.audio.processor)===null||A===void 0?void 0:A._isDefaultWhenNone);if(u.audio.processor&&!P){var $=K({},u.audio.processor);delete $._isDefaultWhenNone,p.audio=K(K({},p.audio),{},{processor:$})}}if(u.video){var B,te,ue;u.video.settings&&(!Object.keys(u.video.settings).length&&g||(p.video={settings:K({},u.video.settings)})),g&&(B=p.video)!==null&&B!==void 0&&(B=B.settings)!==null&&B!==void 0&&B.customTrack&&(p.video.settings={customTrack:this._sharedTracks.videoTrack});var lt=((te=u.video.processor)===null||te===void 0?void 0:te.type)==="none"&&((ue=u.video.processor)===null||ue===void 0?void 0:ue._isDefaultWhenNone);if(u.video.processor&&!lt){var cn=K({},u.video.processor);delete cn._isDefaultWhenNone,p.video=K(K({},p.video),{},{processor:cn})}}return p}}},{key:"getInputSettings",value:function(){var u=this;return he(),new Promise(function(g){g(u._getInputSettings())})}},{key:"_getInputSettings",value:function(){var u,g,p,x,_,A,P={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(u=((p=this._inputSettings)===null||p===void 0?void 0:p.video)||P,g=((x=this._inputSettings)===null||x===void 0?void 0:x.audio)||P):(u=((_=this._preloadCache)===null||_===void 0||(_=_.inputSettings)===null||_===void 0?void 0:_.video)||P,g=((A=this._preloadCache)===null||A===void 0||(A=A.inputSettings)===null||A===void 0?void 0:A.audio)||P);var $={audio:g,video:u};return this._prepInputSettingsForSharing($,!0)}},{key:"_updatePreloadCacheInputSettings",value:function(u,g){var p=this._inputSettings||{},x={};if(u.video){var _,A,P;x.video={},u.video.settings?(x.video.settings={},g||u.video.settings.customTrack||(P=p.video)===null||P===void 0||!P.settings?x.video.settings=u.video.settings:x.video.settings=K(K({},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:(A=p.video)!==null&&A!==void 0&&A.processor&&(x.video.processor=p.video.processor)}else p.video&&(x.video=p.video);if(u.audio){var $,B,te;x.audio={},u.audio.settings?(x.audio.settings={},g||u.audio.settings.customTrack||(te=p.audio)===null||te===void 0||!te.settings?x.audio.settings=u.audio.settings:x.audio.settings=K(K({},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:(B=p.audio)!==null&&B!==void 0&&B.processor&&(x.audio.processor=p.audio.processor)}else p.audio&&(x.audio=p.audio);this._maybeUpdateInputSettings(x)}},{key:"_devicesFromInputSettings",value:function(u){var g,p,x=(u==null||(g=u.video)===null||g===void 0||(g=g.settings)===null||g===void 0?void 0:g.deviceId)||null,_=(u==null||(p=u.audio)===null||p===void 0||(p=p.settings)===null||p===void 0?void 0:p.deviceId)||null,A=this._preloadCache.outputDeviceId||null;return{camera:x?{deviceId:x}:{},mic:_?{deviceId:_}:{},speaker:A?{deviceId:A}:{}}}},{key:"updateInputSettings",value:(G=ee(function*(u){var g=this;return he(),_p(u)?u.video||u.audio?(Cp(u,this.properties.dailyConfig,this._sharedTracks),this._callObjectMode&&!this._callMachineInitialized?(this._updatePreloadCacheInputSettings(u,!0),this._getInputSettings()):new Promise(function(p,x){g.sendMessageToCallMachine({action:"update-input-settings",inputSettings:u},function(_){if(_.error)x(_.error);else{if(_.returnPreloadCache)return g._updatePreloadCacheInputSettings(u,!0),void p(g._getInputSettings());g._maybeUpdateInputSettings(_.inputSettings),p(g._prepInputSettingsForSharing(_.inputSettings,!0))}})})):this._getInputSettings():(console.error(ec()),Promise.reject(ec()))}),function(u){return G.apply(this,arguments)})},{key:"setBandwidth",value:function(u){var g=u.kbs,p=u.trackConstraints;if(he(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:g,trackConstraints:p}),this}},{key:"getDailyLang",value:function(){var u=this;if(he(),this._callMachineInitialized)return new Promise(function(g){u.sendMessageToCallMachine({action:"get-daily-lang"},function(p){delete p.action,delete p.callbackStamp,g(p)})})}},{key:"setDailyLang",value:function(u){return he(),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[Fn,jn].includes(this._callState)?this._finalSummaryOfPrevSession:this._meetingSessionSummary}},{key:"getMeetingSession",value:(H=ee(function*(){var u=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),xe(this._callState,"getMeetingSession()"),new Promise(function(g){u.sendMessageToCallMachine({action:"get-meeting-session"},function(p){delete p.action,delete p.callbackStamp,g(p)})})}),function(){return H.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return xe(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";zt(this._callObjectMode,"setMeetingSessionData()"),xe(this._callState,"setMeetingSessionData");try{(function(p,x){new yw({data:p,mergeStrategy:x})})(u,g)}catch(p){throw console.error(p),p}try{this.sendMessageToCallMachine({action:"set-session-data",data:u,mergeStrategy:g})}catch(p){throw new Error("Error setting meeting session data: ".concat(p))}}},{key:"setUserName",value:function(u,g){var p=this;return this.properties.userName=u,new Promise(function(x){p.sendMessageToCallMachine({action:"set-user-name",name:u??"",thisMeetingOnly:fe()||!!g&&!!g.thisMeetingOnly},function(_){delete _.action,delete _.callbackStamp,x(_)})})}},{key:"setUserData",value:(ie=ee(function*(u){var g=this;try{kp(u)}catch(p){throw console.error(p),p}if(this.properties.userData=u,this._callMachineInitialized)return new Promise(function(p){try{g.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 g=this;if(typeof AudioWorkletNode>"u"&&!fe())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){g.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:u},function(_){g._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 g=this;if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isRemoteParticipantsAudioLevelObserverRunning=!0,new Promise(function(p,x){g.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:u},function(_){g._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=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(this._callObjectMode,"startCamera()"),Xl(this._callState,this._isPreparingToJoin,"startCamera()","Did you mean to use setLocalAudio() and/or setLocalVideo() instead?"),this.needsLoad())try{yield this.load(g)}catch(p){return Promise.reject(p)}else{if(this._didPreAuth){if(g.url&&g.url!==this.properties.url)return console.error("url in startCamera() is different than the one used in preAuth()"),Promise.reject();if(g.token&&g.token!==this.properties.token)return console.error("token in startCamera() is different than the one used in preAuth()"),Promise.reject()}this.validateProperties(g),this.properties=K(K({},this.properties),g)}return new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"start-camera",properties:Zr(u.properties,u.callClientId),preloadCache:Zr(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,g,p){if(p&&p.length>50)throw new Error("Custom track `trackName` must not be more than 50 characters");if(g&&g!=="music"&&g!=="speech"&&!(g 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,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{track,mode,trackName,ignoreAudioLevel};return he(),xe(this._callState,"startCustomTrack()"),this.validateCustomTrack(g.track,g.mode,g.trackName),new Promise(function(p,x){u._sharedTracks.customTrack=g.track,g.track=vn,u.sendMessageToCallMachine({action:"start-custom-track",properties:g},function(_){_.error?x({error:_.error}):p(_.mediaTag)})})}},{key:"stopCustomTrack",value:function(u){var g=this;return he(),xe(this._callState,"stopCustomTrack()"),new Promise(function(p){g.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:u},function(x){p(x.mediaTag)})})}},{key:"setCamera",value:function(u){var g=this;return Vi(),Cs(this._callMachineInitialized,"setCamera()"),new Promise(function(p){g.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:u},function(x){p({device:x.device})})})}},{key:"setAudioDevice",value:(V=ee(function*(u){return Vi(),this.nativeUtils().setAudioDevice(u),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(u){return V.apply(this,arguments)})},{key:"cycleCamera",value:function(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p){u.sendMessageToCallMachine({action:"cycle-camera",properties:g},function(x){p({device:x.device})})})}},{key:"cycleMic",value:function(){var u=this;return he(),new Promise(function(g){u.sendMessageToCallMachine({action:"cycle-mic"},function(p){g({device:p.device})})})}},{key:"getCameraFacingMode",value:function(){var u=this;return Vi(),new Promise(function(g){u.sendMessageToCallMachine({action:"get-camera-facing-mode"},function(p){g(p.facingMode)})})}},{key:"setInputDevicesAsync",value:(U=ee(function*(u){var g=this,p=u.audioDeviceId,x=u.videoDeviceId,_=u.audioSource,A=u.videoSource;if(he(),_!==void 0&&(p=_),A!==void 0&&(x=A),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 P={};return p&&(p instanceof MediaStreamTrack?(this._sharedTracks.audioTrack=p,p=vn,P.audio={settings:{customTrack:p}}):(delete this._sharedTracks.audioTrack,P.audio={settings:{deviceId:p}})),x&&(x instanceof MediaStreamTrack?(this._sharedTracks.videoTrack=x,x=vn,P.video={settings:{customTrack:x}}):(delete this._sharedTracks.videoTrack,P.video={settings:{deviceId:x}})),this._callObjectMode&&this.needsLoad()?(this._updatePreloadCacheInputSettings(P,!1),this._devicesFromInputSettings(this._inputSettings)):new Promise(function($){g.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:p,videoDeviceId:x},function(B){if(delete B.action,delete B.callbackStamp,B.returnPreloadCache)return g._updatePreloadCacheInputSettings(P,!1),void $(g._devicesFromInputSettings(g._inputSettings));$(B)})})}),function(u){return U.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(W=ee(function*(u){var g=this,p=u.outputDeviceId;if(he(),!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,_){g.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:p},function(A){if(delete A.action,delete A.callbackStamp,A.error){var P=new Error(A.error.message);return P.type=A.error.type,void _(P)}A.returnPreloadCache?x(g._devicesFromInputSettings(g._inputSettings)):x(A)})})}),function(u){return W.apply(this,arguments)})},{key:"getInputDevices",value:(J=ee(function*(){var u=this;return this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(g){u.sendMessageToCallMachine({action:"get-input-devices"},function(p){p.returnPreloadCache?g(u._devicesFromInputSettings(u._inputSettings)):g({camera:p.camera,mic:p.mic,speaker:p.speaker})})})}),function(){return J.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return Vi(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(u){if(Vi(),[gp,Fw].includes(u)){if(u!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=u,!this.disableReactNativeAutoDeviceManagement("audio")&&_s(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMode(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",u)}},{key:"preAuth",value:(F=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(this._callObjectMode,"preAuth()"),Xl(this._callState,this._isPreparingToJoin,"preAuth()"),this.needsLoad()&&(yield this.load(g)),!g.url)throw new Error("preAuth() requires at least a url to be provided");return this.validateProperties(g),this.properties=K(K({},this.properties),g),new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"daily-method-preauth",properties:Zr(u.properties,u.callClientId),preloadCache:Zr(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:(D=ee(function*(u){var g=this;if(this.needsLoad()){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");if(u&&(this.validateProperties(u),this.properties=K(K({},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(kh),this.emitDailyJSEvent({action:y0}),this._callObjectMode?new Promise(function(p,x){g._callObjectLoader.cancel();var _=Date.now();g._callObjectLoader.load(g.properties.dailyConfig,function(A){g._bundleLoadTime=A?"no-op":Date.now()-_,g._updateCallState(xh),A&&g.emitDailyJSEvent({action:Ch}),p()},function(A,P){if(g.emitDailyJSEvent({action:b0}),!P){g._updateCallState(jn),g.resetMeetingDependentVars();var $={action:Oh,errorMsg:A.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:A,bundleUrl:Go(g.properties.dailyConfig)}}};g._maybeSendToSentry($),g.emitDailyJSEvent($),x(A.msg)}})}):(this._iframe.src=lf(this.assembleMeetingUrl(),this.properties.dailyConfig),new Promise(function(p,x){g._loadedCallback=function(_){g._callState!==jn?(g._updateCallState(xh),(g.properties.cssFile||g.properties.cssText)&&g.loadCss(g.properties),p()):x(_)}}))}}),function(u){return D.apply(this,arguments)})},{key:"join",value:(O=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._testCallInProgress&&this.stopTestCallQuality(),!g.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(g)}catch(_){return this.updateIsPreparingToJoin(!1),Promise.reject(_)}}else{if(x=!(!this.properties.cssFile&&!this.properties.cssText),this._didPreAuth){if(g.url&&g.url!==this.properties.url)return console.error("url in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject();if(g.token&&g.token!==this.properties.token)return console.error("token in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject()}if(g.url&&!this._callObjectMode&&g.url&&g.url!==this.properties.url)return console.error("url in join() is different than the one used in load() (".concat(this.properties.url," -> ").concat(g.url,")")),this.updateIsPreparingToJoin(!1),Promise.reject();this.validateProperties(g),this.properties=K(K({},this.properties),g)}return g.showLocalVideo!==void 0&&(this._callObjectMode?console.error("showLocalVideo is not available in callObject mode"):this._showLocalVideo=!!g.showLocalVideo),g.showParticipantsBar!==void 0&&(this._callObjectMode?console.error("showParticipantsBar is not available in callObject mode"):this._showParticipantsBar=!!g.showParticipantsBar),this._callState===wr||this._callState===Il?(console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1)):(this._updateCallState(Il,!1),this.emitDailyJSEvent({action:k0}),this._preloadCache.inputSettings=this._prepInputSettingsForSharing(this._inputSettings||{},!1),this.sendMessageToCallMachine({action:"join-meeting",properties:Zr(this.properties,this.callClientId),preloadCache:Zr(this._preloadCache,this.callClientId)},function(_){_.error&&u._joinedCallback&&(u._joinedCallback(null,_.error),u._joinedCallback=null)}),new Promise(function(_,A){u._joinedCallback=function(P,$){if(u._callState!==jn){if($)return u._updateCallState(Fn),void A($);if(u._updateCallState(wr),P)for(var B in P){if(u._callObjectMode){var te=u._callMachine().store;ep(P[B],te),tp(P[B],te),np(P[B],u._participants[B],te)}u._participants[B]=K({},P[B]),u.toggleParticipantAudioBasedOnNativeAudioFocus()}x&&u.loadCss(u.properties),_(P)}else A($)}}))}),function(){return O.apply(this,arguments)})},{key:"leave",value:(M=ee(function*(){var u=this;return this._testCallInProgress&&this.stopTestCallQuality(),new Promise(function(g){u._callState===Fn||u._callState===jn?g():u._callObjectLoader&&!u._callObjectLoader.loaded?(u._callObjectLoader.cancel(),u._updateCallState(Fn),u.resetMeetingDependentVars(),u.emitDailyJSEvent({action:Fn}),g()):(u._resolveLeave=g,u.sendMessageToCallMachine({action:"leave-meeting"}))})}),function(){return M.apply(this,arguments)})},{key:"startScreenShare",value:(C=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Cs(this._callMachineInitialized,"startScreenShare()"),g.screenVideoSendSettings&&this._validateVideoSendSettings("screenVideo",g.screenVideoSendSettings),g.mediaStream&&(this._sharedTracks.screenMediaStream=g.mediaStream,g.mediaStream=vn),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var p=this.nativeUtils();if(yield p.isScreenBeingCaptured())return void this.emitDailyJSEvent({action:Ah,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:Ph,captureOptions:g})}),p.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:Ph,captureOptions:g})}),function(){return C.apply(this,arguments)})},{key:"stopScreenShare",value:function(){Cs(this._callMachineInitialized,"stopScreenShare()"),this.sendMessageToCallMachine({action:"local-screen-stop"})}},{key:"startRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},g=u.type;if(g&&g!=="cloud"&&g!=="cloud-audio-only"&&g!=="raw-tracks"&&g!=="local")throw new Error("invalid type: ".concat(g,", allowed values 'cloud', 'cloud-audio-only', 'raw-tracks', or 'local'"));this.sendMessageToCallMachine(K({action:"local-recording-start"},u))}},{key:"updateRecording",value:function(u){var g=u.layout,p=g===void 0?{preset:"default"}:g,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(K({action:"local-recording-stop"},u))}},{key:"startLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(K({action:"daily-method-start-live-streaming"},u))}},{key:"updateLiveStreaming",value:function(u){var g=u.layout,p=g===void 0?{preset:"default"}:g,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:p,instanceId:x})}},{key:"addLiveStreamingEndpoints",value:function(u){var g=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Lh,endpointsOp:uw,endpoints:g,instanceId:p})}},{key:"removeLiveStreamingEndpoints",value:function(u){var g=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Lh,endpointsOp:dw,endpoints:g,instanceId:p})}},{key:"stopLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(K({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."),Bh()&&u.noAutoDefaultDeviceChange&&console.warn("noAutoDefaultDeviceChange is not supported on Android, and will be ignored.")}},{key:"validateSimulcastEncodings",value:function(u){var g=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(!Ip(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 A in this._validateEncodingLayerHasValidProperties(_),_)if(Ql.includes(A)){if(typeof _[A]!="number")throw new Error("".concat(A," must be a number"));if(g){var P=g[A],$=P.min,B=P.max;if(!Ip(_[A],$,B))throw new Error("".concat(A," value not in range. valid range: ").concat($," to ").concat(B))}}else if(!["active","scalabilityMode"].includes(A))throw new Error("Invalid key ".concat(A,", valid keys are:")+Object.values(Ql));if(p&&!_.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(k=ee(function*(u){var g=this,p=u.url,x=u.settings,_=x===void 0?{state:Fl.PLAY}:x;try{(function(A){if(typeof A!="string")throw new Error('url parameter must be "string" type')})(p),Lp(_),function(A){for(var P in A)if(!bp.includes(P))throw new Error("Invalid key ".concat(P,", valid keys are: ").concat(bp));A.simulcastEncodings&&this.validateSimulcastEncodings(A.simulcastEncodings,yp,!0)}(_)}catch(A){throw console.error("invalid argument Error: ".concat(A)),console.error(`startRemoteMediaPlayer arguments must be of the form:
|
|
26
|
+
Url: ${ds(s)}`),!0)}(e,o)?null:e}});function ds(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 _e&&re.error(`Cannot extract url for event ${Nn(t)}`),null}}function Lb(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&gr(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=Sl(t,e,i,s.originalException,r,o.exception.values,a,0),c=n,l.map(d=>(d.value&&(d.value=Wr(d.value,c)),d))))}function Sl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(gr(r[i],Error)){ih(s,a);const c=t(e,r[i]),d=l.length;oh(c,i,d,a),l=Sl(t,e,n,r[i],i,[c,...l],c,d)}return Array.isArray(r.errors)&&r.errors.forEach((c,d)=>{if(gr(c,Error)){ih(s,a);const f=t(e,c),h=l.length;oh(f,`errors[${d}]`,h,a),l=Sl(t,e,n,c,i,[f,...l],f,h)}}),l}function ih(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 oh(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 kl(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 Ib(){"console"in me&&el.forEach(function(t){t in me.console&&vt(me.console,t,function(e){return Zo[t]=e,function(...n){Bt("console",{args:n,level:t});const r=Zo[t];r&&r.apply(me.console,n)}})})}function Rb(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Nb=()=>{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||!ah(i,o)||!sh(i,o))}(n,r)||function(i,o){const s=lh(o),a=lh(i);return!(!s||!a||s.type!==a.type||s.value!==a.value||!ah(i,o)||!sh(i,o))}(n,r)):!1}(e,t))return _e&&re.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function sh(t,e){let n=hf(t),r=hf(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 ah(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 lh(t){return t.exception&&t.exception.values&&t.exception.values[0]}function ch(t){return t===void 0?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const xl=me;function _l(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function $b(){if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in xl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(_l(xl.fetch))return!0;let t=!1;const e=xl.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=_l(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){dr&&re.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function Fb(t,e){const n="fetch";hr(n,t),pr(n,()=>function(r,i=!1){i&&!$b()||vt(me,"fetch",function(o){return function(...s){const a=new Error,{method:l,url:c}=function(f){if(f.length===0)return{method:"GET",url:""};if(f.length===2){const[b,y]=f;return{url:uh(b),method:Cl(y,"method")?String(y.method).toUpperCase():"GET"}}const h=f[0];return{url:uh(h),method:Cl(h,"method")?String(h.method).toUpperCase():"GET"}}(s),d={args:s,fetchData:{method:l,url:c},startTimestamp:1e3*pn(),virtualError:a};return r||Bt("fetch",{...d}),o.apply(me,s).then(async f=>(r?r(f):Bt("fetch",{...d,endTimestamp:1e3*pn(),response:f}),f),f=>{throw Bt("fetch",{...d,endTimestamp:1e3*pn(),error:f}),il(f)&&f.stack===void 0&&(f.stack=a.stack,mr(f,"framesToPop",1)),f})}})}(void 0,e))}function Cl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function uh(t){return typeof t=="string"?t:t?Cl(t,"url")?t.url:t.toString?t.toString():"":""}const fs=me,Be=me;let El=0;function dh(){return El>0}function Qr(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(ll(t))return t}catch{return t}const n=function(...r){try{const i=r.map(o=>Qr(o,e));return t.apply(this,i)}catch(i){throw El++,setTimeout(()=>{El--}),function(...o){const s=pl(ns());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&&(ul(a,void 0),qr(a,e.mechanism)),a.extra={...a.extra,arguments:r},a)),s=i,yr().captureException(s,void 0)}),i}};try{for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}catch{}Sf(n,t),mr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}const hs=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Tl(t,e){const n=Al(t,e),r={type:Ub(e),value:zb(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function jb(t,e,n,r){const i=Qe(),o=i&&i.getOptions().normalizeDepth,s=function(c){for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d)){const f=c[d];if(f instanceof Error)return f}}(e),a={__serialized__:Ff(e,o)};if(s)return{exception:{values:[Tl(t,s)]},extra:a};const l={exception:{values:[{type:rs(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Hb(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=Al(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function Ml(t,e){return{exception:{values:[Tl(t,e)]}}}function Al(t,e){const n=e.stacktrace||e.stack||"",r=function(o){return o&&Bb.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 Bb=/Minified React error #\d+;/i;function fh(t){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&t instanceof WebAssembly.Exception}function Ub(t){const e=t&&t.name;return!e&&fh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function zb(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:fh(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function Ol(t,e,n,r,i){let o;if(mf(e)&&e.error)return Ml(t,e.error);if(vf(e)||Vr(e,"DOMException")){const s=e;if("stack"in e)o=Ml(t,e);else{const a=s.name||(vf(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=Dl(t,l,n,r),ul(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return il(e)?Ml(t,e):Kr(e)||rs(e)?(o=jb(t,e,n,i),qr(o,{synthetic:!0}),o):(o=Dl(t,e,n,r),ul(o,`${e}`),qr(o,{synthetic:!0}),o)}function Dl(t,e,n,r){const i={};if(r&&n){const o=Al(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),qr(i,{synthetic:!0})}if(ol(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 Hb(t,{isUnhandledRejection:e}){const n=function(i,o=40){const s=Object.keys(kf(i));s.sort();const a=s[0];if(!a)return"[object has no keys]";if(a.length>=o)return Wr(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:Wr(c,o)}return""}(t),r=e?"promise rejection":"exception";return mf(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:rs(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 Vb extends Cb{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:ur})),version:ur}),r._metadata=a})(n,"browser",["browser"],Be.SENTRY_SDK_SOURCE||"npm"),super(n),n.sendClientReports&&Be.document&&Be.document.addEventListener("visibilitychange",()=>{Be.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return function(r,i,o,s){const a=Ol(r,i,o&&o.syntheticException||void 0,s);return qr(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=Dl(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(hs&&re.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:ls(s)}};return ji(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 Kb=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,rt=me;let hh,Pl,Ll,ps;function Wb(){if(!rt.document)return;const t=Bt.bind(null,"dom"),e=ph(t,!0);rt.document.addEventListener("click",e,!1),rt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=rt[n],i=r&&r.prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(vt(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 f=ph(t);d.handler=f,o.call(this,s,f,l)}d.refCount++}catch{}return o.call(this,s,a,l)}}),vt(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 ph(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;mr(n,"_sentryCaptured",!0),r&&!r._sentryId&&mr(r,"_sentryId",Mt());const i=n.type==="keypress"?"input":n.type;(function(o){if(o.type!==Pl)return!1;try{if(!o.target||o.target._sentryId!==Ll)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Pl=n.type,Ll=r?r._sentryId:void 0),clearTimeout(hh),hh=rt.setTimeout(()=>{Ll=void 0,Pl=void 0},1e3)}}function gh(t){const e="history";hr(e,t),pr(e,qb)}function qb(){if(!function(){const n=fs.chrome,r=n&&n.app&&n.app.runtime,i="history"in fs&&!!fs.history.pushState&&!!fs.history.replaceState;return!r&&i}())return;const t=rt.onpopstate;function e(n){return function(...r){const i=r.length>2?r[2]:void 0;if(i){const o=ps,s=String(i);ps=s,Bt("history",{from:o,to:s})}return n.apply(this,r)}}rt.onpopstate=function(...n){const r=rt.location.href,i=ps;if(ps=r,Bt("history",{from:i,to:r}),t)try{return t.apply(this,n)}catch{}},vt(rt.history,"pushState",e),vt(rt.history,"replaceState",e)}const gs={};function mh(t){gs[t]=void 0}const Bi="__sentry_xhr_v3__";function Jb(){if(!rt.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,o=1e3*pn(),s=hn(r[0])?r[0].toUpperCase():void 0,a=function(c){if(hn(c))return c;try{return c.toString()}catch{}}(r[1]);if(!s||!a)return e.apply(n,r);n[Bi]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[Bi];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}Bt("xhr",{endTimestamp:1e3*pn(),startTimestamp:o,xhr:n,virtualError:i})}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply:(c,d,f)=>(l(),c.apply(d,f))}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,d,f){const[h,b]=f,y=d[Bi];return y&&hn(h)&&hn(b)&&(y.request_headers[h.toLowerCase()]=b),c.apply(d,f)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[Bi];return i?(r[0]!==void 0&&(i.body=r[0]),Bt("xhr",{startTimestamp:1e3*pn(),xhr:n}),e.apply(n,r)):e.apply(n,r)}})}function Gb(t,e=function(n){const r=gs[n];if(r)return r;let i=rt[n];if(_l(i))return gs[n]=i.bind(rt);const o=rt.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){Kb&&re.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,s)}return i&&(gs[n]=i.bind(rt))}("fetch")){let n=0,r=0;return Mb(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 mh("fetch"),ss("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 mh("fetch"),n-=o,r--,ss(a)}})}function Il(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 Qb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Yb=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Xb=/\((\S*)(?::(\d+))(?::(\d+))\)/,Zb=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ew=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tw=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=uf.test(l)?l.replace(uf,"$1"):l;if(!c.match(/\S*Error: /)){for(const d of e){const f=d(c);if(f){o.push(f);break}}if(o.length>=50+i)break}}return function(a){if(!a.length)return[];const l=Array.from(a);return/sentryWrapped/.test(es(l).function||"")&&l.pop(),l.reverse(),df.test(es(l).function||"")&&(l.pop(),df.test(es(l).function||"")&&l.pop()),l.slice(0,50).map(c=>({...c,filename:c.filename||es(l).filename,function:c.function||fr}))}(o.slice(i))}}([30,t=>{const e=Qb.exec(t);if(e){const[,r,i,o]=e;return Il(r,fr,+i,+o)}const n=Yb.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=Xb.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,i]=vh(n[1]||fr,n[2]);return Il(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=Zb.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=ew.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]=vh(r,n),Il(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),vh=(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]},yh=1024,nw=(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";hr(o,i),pr(o,Ib)}(function(i){return function(o){if(Qe()!==i)return;const s={category:"console",data:{arguments:o.args,logger:"console"},level:Rb(o.level),message:wf(o.args," ")};if(o.level==="assert"){if(o.args[0]!==!1)return;s.message=`Assertion failed: ${wf(o.args.slice(1)," ")||"console.assert"}`,s.data.arguments=o.args.slice(1)}br(s,{input:o.args,level:o.level})}}(n)),e.dom&&(r=function(i,o){return function(s){if(Qe()!==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>yh&&(hs&&re.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${d} was configured. Sentry will use 1024 instead.`),d=yh),typeof c=="string"&&(c=[c]);try{const h=s.event,b=function(y){return!!y&&!!y.target}(h)?h.target:h;a=bf(b,{keyAttrs:c,maxStringLength:d}),l=function(y){if(!al.HTMLElement)return null;let v=y;for(let S=0;S<5;S++){if(!v)return null;if(v instanceof HTMLElement){if(v.dataset.sentryComponent)return v.dataset.sentryComponent;if(v.dataset.sentryElement)return v.dataset.sentryElement}v=v.parentNode}return null}(b)}catch{a="<unknown>"}if(a.length===0)return;const f={category:`ui.${s.name}`,message:a};l&&(f.data={"ui.component_name":l}),br(f,{event:s.event,name:s.name,global:s.global})}}(n,e.dom),hr("dom",r),pr("dom",Wb)),e.xhr&&function(i){hr("xhr",i),pr("xhr",Jb)}(function(i){return function(o){if(Qe()!==i)return;const{startTimestamp:s,endTimestamp:a}=o,l=o.xhr[Bi];if(!s||!a||!l)return;const{method:c,url:d,status_code:f,body:h}=l,b={method:c,url:d,status_code:f},y={xhr:o.xhr,input:h,startTimestamp:s,endTimestamp:a};br({category:"xhr",data:b,type:"http",level:ch(f)},y)}}(n)),e.fetch&&Fb(function(i){return function(o){if(Qe()!==i)return;const{startTimestamp:s,endTimestamp:a}=o;if(a&&(!o.fetchData.url.match(/sentry_key/)||o.fetchData.method!=="POST"))if(o.error)br({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};br({category:"fetch",data:c,type:"http",level:ch(c.status_code)},d)}}}(n)),e.history&&gh(function(i){return function(o){if(Qe()!==i)return;let s=o.from,a=o.to;const l=kl(Be.location.href);let c=s?kl(s):void 0;const d=kl(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),br({category:"navigation",data:{from:s,to:a}})}}(n)),e.sentry&&n.on("beforeSendEvent",function(i){return function(o){Qe()===i&&br({category:"sentry."+(o.type==="transaction"?"transaction":"event"),event_id:o.event_id,level:o.level,message:Nn(o)},{event:o})}}(n))}}},rw=["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"],iw=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&vt(Be,"setTimeout",bh),e.setInterval&&vt(Be,"setInterval",bh),e.requestAnimationFrame&&vt(Be,"requestAnimationFrame",ow),e.XMLHttpRequest&&"XMLHttpRequest"in Be&&vt(XMLHttpRequest.prototype,"send",sw);const n=e.eventTarget;n&&(Array.isArray(n)?n:rw).forEach(aw)}}};function bh(t){return function(...e){const n=e[0];return e[0]=Qr(n,{mechanism:{data:{function:Rn(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function ow(t){return function(e){return t.apply(this,[Qr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Rn(t)},handled:!1,type:"instrument"}})])}}function sw(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&vt(n,r,function(i){const o={mechanism:{data:{function:r,handler:Rn(i)},handled:!1,type:"instrument"}},s=ll(i);return s&&(o.mechanism.data.handler=Rn(s)),Qr(i,o)})}),t.apply(this,e)}}function aw(t){const e=Be[t],n=e&&e.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(vt(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=Qr(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Rn(o),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Qr(o,{mechanism:{data:{function:"addEventListener",handler:Rn(o),target:t},handled:!1,type:"instrument"}}),s])}}),vt(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 lw=()=>({name:"BrowserSession",setupOnce(){Be.document!==void 0?(Kf({ignoreDuration:!0}),Jf(),gh(({from:t,to:e})=>{t!==void 0&&t!==e&&(Kf({ignoreDuration:!0}),Jf())})):hs&&re.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),cw=(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";hr(o,i),pr(o,Zy)})(i=>{const{stackParser:o,attachStacktrace:s}=Sh();if(Qe()!==r||dh())return;const{msg:a,url:l,line:c,column:d,error:f}=i,h=function(b,y,v,S){const m=b.exception=b.exception||{},w=m.values=m.values||[],k=w[0]=w[0]||{},C=k.stacktrace=k.stacktrace||{},M=C.frames=C.frames||[],O=S,D=v,F=hn(y)&&y.length>0?y:function(){try{return al.document.location.href}catch{return""}}();return M.length===0&&M.push({colno:O,filename:F,function:fr,in_app:!0,lineno:D}),b}(Ol(o,f||a,void 0,s,!1),l,c,d);h.level="error",Vf(h,{originalException:f,mechanism:{handled:!1,type:"onerror"}})})}(n),wh("onerror")),e.onunhandledrejection&&(function(r){(function(i){const o="unhandledrejection";hr(o,i),pr(o,eb)})(i=>{const{stackParser:o,attachStacktrace:s}=Sh();if(Qe()!==r||dh())return;const a=function(c){if(sl(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=sl(a)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`}]}}:Ol(o,a,void 0,s,!0);l.level="error",Vf(l,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(n),wh("onunhandledrejection"))}}};function wh(t){hs&&re.log(`Global Handler attached: ${t}`)}function Sh(){const t=Qe();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const uw=()=>({name:"HttpContext",preprocessEvent(t){if(!Be.navigator&&!Be.location&&!Be.document)return;const e=t.request&&t.request.url||Be.location&&Be.location.href,{referrer:n}=Be.document||{},{userAgent:r}=Be.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}}),dw=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(r,i,o){const s=o.getOptions();Lb(Tl,s.stackParser,s.maxValueLength,n,e,r,i)}}};var kh="new",xh="loading",_h="loaded",Rl="joining-meeting",wr="joined-meeting",Fn="left-meeting",jn="error",fw="playable",Nl="unknown",hw="full",pw="base",Ch="no-room",gw="end-of-life",mw="connection-error",vw="iframe-ready-for-launch-config",yw="iframe-launch-config",bw="theme-updated",ww="loading",Sw="load-attempt-failed",Eh="loaded",kw="started-camera",xw="camera-error",_w="joining-meeting",Cw="joined-meeting",Ew="left-meeting",Tw="participant-joined",Mw="participant-updated",Aw="participant-left",Ow="participant-counts-updated",Dw="access-state-updated",Pw="meeting-session-summary-updated",Lw="meeting-session-state-updated",Iw="waiting-participant-added",Rw="waiting-participant-updated",Nw="waiting-participant-removed",$w="track-started",Fw="track-stopped",jw="transcription-started",Bw="transcription-stopped",Uw="transcription-error",Th="recording-started",Mh="recording-stopped",zw="recording-stats",Hw="recording-error",Vw="recording-upload-completed",Kw="recording-data",Ww="app-message",qw="transcription-message",Jw="remote-media-player-started",Gw="remote-media-player-updated",Qw="remote-media-player-stopped",Yw="local-screen-share-started",Xw="local-screen-share-stopped",Zw="local-screen-share-canceled",e0="active-speaker-change",t0="active-speaker-mode-change",n0="network-quality-change",r0="network-connection",i0="cpu-load-change",o0="face-counts-updated",ms="fullscreen",vs="exited-fullscreen",s0="live-streaming-started",a0="live-streaming-updated",l0="live-streaming-stopped",c0="live-streaming-error",u0="lang-updated",d0="receive-settings-updated",Ah="input-settings-updated",Oh="nonfatal-error",Dh="error",$l=4096,Ph=102400,Fl="iframe-call-message",Lh="local-screen-start",Ih="daily-method-update-live-streaming-endpoints",ys="transmit-log",vn="daily-custom-track",bs={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},Rh={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},jl={PLAY:"play",PAUSE:"pause"},Bl=["jpg","png","jpeg"],f0="add-endpoints",h0="remove-endpoints",Nh="sip-call-transfer";function Ot(){return!fe()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function fe(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function $h(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function p0(){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}(Sr(),ws())||fe())}function Fh(){if(fe()||!document)return!1;var t=document.createElement("iframe");return!!t.requestFullscreen||!!t.webkitRequestFullscreen}var Ul="none",g0="software",m0="hardware",v0=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?g0:m0:Ul}catch{return Ul}}();function jh(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!fe()&&v0!==Ul&&(t?function(){return zh()?!1:["Chrome","Firefox"].includes(Sr())}():function(){if(zh())return!1;var e=Sr();if(e==="Safari"){var n=Vl();if(n.major<15||n.major===15&&n.minor<4)return!1}return e==="Chrome"?Hl().major>=77:e==="Firefox"?Kl().major>=97:["Chrome","Firefox","Safari"].includes(e)}())}function Bh(){if(fe()||Uh()||typeof AudioWorkletNode>"u")return!1;switch(Sr()){case"Chrome":case"Firefox":return!0;case"Safari":var t=ws();return t.major>17||t.major===17&&t.minor>=4}return!1}function zl(){return $h()&&typeof MediaStreamTrack<"u"&&!function(){var t,e=Sr();if(!Ot())return!0;switch(e){case"Chrome":return(t=Hl()).major&&t.major>0&&t.major<75;case"Firefox":return(t=Kl()).major<91;case"Safari":return(t=Vl()).major<13||t.major===13&&t.minor<1;default:return!0}}()}function Uh(){return Ot().match(/Linux; Android/)}function zh(){var t,e=Ot(),n=e.match(/Mac/)&&(!fe()&&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)||!!Ot().match(/DailyAnd\//)||void 0}function Sr(){if(typeof window<"u"){var t=Ot();return Hh()?"Safari":t.indexOf("Edge")>-1?"Edge":t.match(/Chrome\//)?"Chrome":t.indexOf("Safari")>-1||Vh()?"Safari":t.indexOf("Firefox")>-1?"Firefox":t.indexOf("MSIE")>-1||t.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function ws(){switch(Sr()){case"Chrome":return Hl();case"Safari":return Vl();case"Firefox":return Kl();case"Edge":return function(){var t=0,e=0;if(typeof window<"u"){var n=Ot().match(/Edge\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}()}}function Hl(){var t=0,e=0,n=0,r=0,i=!1;if(typeof window<"u"){var o=Ot(),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 Hh(){return!!Ot().match(/iPad|iPhone|iPod/i)&&$h()}function Vh(){return Ot().indexOf("AppleWebKit/605.1.15")>-1}function Vl(){var t=0,e=0,n=0;if(typeof window<"u"){var r=Ot().match(/Version\/(\d+).(\d+)(.(\d+))?/);if(r)try{t=parseInt(r[1]),e=parseInt(r[2]),n=parseInt(r[4])}catch{}else(Hh()||Vh())&&(t=14,e=0,n=3)}return{major:t,minor:e,point:n}}function Kl(){var t=0,e=0;if(typeof window<"u"){var n=Ot().match(/Firefox\/(\d+).(\d+)/);if(n)try{t=parseInt(n[1]),e=parseInt(n[2])}catch{}}return{major:t,minor:e}}var Kh=function(){return mt(function t(){gt(this,t)},[{key:"addListenerForMessagesFromCallMachine",value:function(t,e,n){Ri()}},{key:"addListenerForMessagesFromDailyJs",value:function(t,e,n){Ri()}},{key:"sendMessageToCallMachine",value:function(t,e,n,r){Ri()}},{key:"sendMessageToDailyJs",value:function(t,e){Ri()}},{key:"removeListener",value:function(t){Ri()}}])}();function Wh(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 Wl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Wh(Object(n),!0).forEach(function(r){en(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Wh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qh=function(){return!!t})()}var y0=function(){function t(){var e,n,r,i;return gt(this,t),n=this,r=jt(r=t),(e=Ko(n,qh()?Reflect.construct(r,[],jt(n).constructor):r.apply(n,i)))._wrappedListeners={},e._messageCallbacks={},e}return Wo(t,Kh),mt(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=Wl({},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!==Fl||!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=Wl({},e);if(o.what=Fl,o.from="module",o.callClientId=r,n){var s=Go();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=Fl,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=Wl({},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 Jh(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 Gh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Gh=function(){return!!t})()}var b0=function(){function t(){var e,n,r,i;return gt(this,t),n=this,r=jt(r=t),e=Ko(n,Gh()?Reflect.construct(r,[],jt(n).constructor):r.apply(n,i)),global.callMachineToDailyJsEmitter=global.callMachineToDailyJsEmitter||new Za.EventEmitter,global.dailyJsToCallMachineEmitter=global.dailyJsToCallMachineEmitter||new Za.EventEmitter,e._wrappedListeners={},e._messageCallbacks={},e}return Wo(t,Kh),mt(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?Jh(Object(d),!0).forEach(function(f){en(l,f,d[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):Jh(Object(d)).forEach(function(f){Object.defineProperty(l,f,Object.getOwnPropertyDescriptor(d,f))})}return l}({},e);if(s.callClientId=r,i){var a=Go();this._messageCallbacks[a]=i,s.callbackStamp=a}n.emit("message",s)}}])}(),ql="replace",Jl="shallow-merge",Qh=[ql,Jl],w0=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.data,r=e.mergeStrategy,i=r===void 0?ql:r;gt(this,t),t._validateMergeStrategy(i),t._validateData(n,i),this.mergeStrategy=i,this.data=n}return mt(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===Jl}},{key:"_validateMergeStrategy",value:function(e){if(!Qh.includes(e))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(Qh,"]"))}},{key:"_validateData",value:function(e,n){if(!function(a){if(a==null||pe(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===ql){var i=JSON.parse(r);tt(i,e)||console.warn("The meeting session data provided will be modified when serialized.",i,e)}else if(n===Jl){for(var o in e)if(Object.hasOwnProperty.call(e,o)&&e[o]!==void 0){var s=JSON.parse(JSON.stringify(e[o]));tt(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>Ph)throw Error("Meeting session data is too large (".concat(r.length," characters). Maximum size suppported is ").concat(Ph,"."))}}])}();function Yh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Yh=function(){return!!t})()}function Gl(t){var e=typeof Map=="function"?new Map:void 0;return Gl=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(Yh())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,o);var l=new(i.bind.apply(i,a));return s&&Ii(l,s.prototype),l}(n,arguments,jt(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ii(r,n)},Gl(t)}function Xh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xh=function(){return!!t})()}function Zh(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 S0=function(){return mt(function t(e){gt(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 k0(n,function(){r(!1)},function(o,s){s||Zh(e._callClientId),i(o,s)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),Zh(this._callClientId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}])}(),k0=function(){return mt(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;gt(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 ep(t._dailyConfig,t._successCallback,e),t._currentAttempt.start())},3e3))};this._currentAttempt=new ep(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}}])}(),Ql=function(){function t(){return gt(this,t),e=this,r=arguments,n=jt(n=t),Ko(e,Xh()?Reflect.construct(n,r||[],jt(e).constructor):n.apply(e,r));var e,n,r}return Wo(t,Gl(Error)),mt(t)}(),Ss=2e4,ep=function(){return mt(function e(n,r,i){gt(this,e),this._loadAttemptImpl=fe()||!n.avoidEval?new x0(n,r,i):new _0(n,r,i)},[{key:"start",value:(t=ee(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}(),x0=function(){return mt(function i(o,s,a){gt(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=ee(function*(){var i=Qo(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=ee(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=ee(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(Ss," ms) when loading call object bundle ").concat(i),type:"timeout"})},Ss);try{var s=this._refetchHeaders?{headers:this._refetchHeaders}:{},a=yield fetch(i,s);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new Ql;var l=yield this._getBundleCodeFromResponse(i,a);if(this.cancelled)throw new Ql;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 Ql||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=ee(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}(),_0=function(){return mt(function t(e,n,r){gt(this,t),this.cancelled=!1,this.succeeded=!1,this._dailyConfig=e,this._successCallback=n,this._failureCallback=r,this._attemptId=Go(),this._networkTimeout=null,this._scriptElement=null},[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=Qo(this._dailyConfig);(typeof document>"u"?"undefined":pe(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(Ss," ms) when loading call object bundle ").concat(t),type:"timeout"})},Ss);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)}}])}(),ks=function(t,e,n){return E0(t.local,e,n)===!0},C0=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]},Yr=function(t,e,n,r){var i=T0(t,e,n,r);return i&&i.pendingTrack},E0=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)},T0=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]},M0=function(t,e){var n=t.local.public.customTracks;if(n&&n[e])return n[e].track};function tp(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 f=t.local?C0(n,o,l):Yr(n,t.session_id,o,l);d.state==="playable"&&(d.track=f),d.persistentTrack=f}}}function np(t,e){try{var n=e.getState();for(var r in t.tracks)if(!A0(r)){var i=t.tracks[r].kind;if(i){var o=t.tracks[r];if(o){var s=t.local?M0(n,r):Yr(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 A0(t){return["video","audio","screenVideo","screenAudio"].includes(t)}function rp(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&&ks(r,t.session_id,"cam-audio")){var s=Yr(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&&ks(r,t.session_id,"cam-video")){var a=Yr(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&&ks(r,t.session_id,"screen-audio")){var l=Yr(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&&ks(r,t.session_id,"screen-video")){var c=Yr(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 O0(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 ip(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)?ip(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 ip(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 tn=new Map,Xr=null;function D0(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 op(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)?op(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 op(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 nn=new Map,Ui=null;function P0(t){sp()?function(e){tn.has(e)||(tn.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){tn.has(e)&&(tn.get(e).lastDevicesString=JSON.stringify(n),Xr||(Xr=function(){var r=ee(function*(){var i,o=yield navigator.mediaDevices.enumerateDevices(),s=O0(tn.keys());try{for(s.s();!(i=s.n()).done;){var a=i.value,l=JSON.stringify(o);l!==tn.get(a).lastDevicesString&&(tn.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",Xr)))}).catch(function(){}))}(t):function(e){nn.has(e)||(nn.set(e,{}),navigator.mediaDevices.enumerateDevices().then(function(n){nn.has(e)&&(nn.get(e).lastDevicesString=JSON.stringify(n),Ui||(Ui=setInterval(ee(function*(){var r,i=yield navigator.mediaDevices.enumerateDevices(),o=D0(nn.keys());try{for(o.s();!(r=o.n()).done;){var s=r.value,a=JSON.stringify(i);a!==nn.get(s).lastDevicesString&&(nn.get(s).lastDevicesString=a,s(i))}}catch(l){o.e(l)}finally{o.f()}}),3e3)))}))}(t)}function L0(t){sp()?function(e){tn.has(e)&&(tn.delete(e),tn.size===0&&Xr&&(navigator.mediaDevices.removeEventListener("devicechange",Xr),Xr=null))}(t):function(e){nn.has(e)&&(nn.delete(e),nn.size===0&&Ui&&(clearInterval(Ui),Ui=null))}(t)}function sp(){var t;return fe()||((t=navigator.mediaDevices)===null||t===void 0?void 0:t.ondevicechange)!==void 0}var I0=new Set;function R0(t,e){return t&&t.readyState==="live"&&!function(n,r){return n.muted&&!I0.has(n.id)}(t)}function ap(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 Bn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ap(Object(n),!0).forEach(function(r){en(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ap(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var zi=Object.freeze({VIDEO:"video",AUDIO:"audio",SCREEN_VIDEO:"screenVideo",SCREEN_AUDIO:"screenAudio",CUSTOM_VIDEO:"customVideo",CUSTOM_AUDIO:"customAudio"}),N0=Object.freeze({PARTICIPANTS:"participants",STREAMING:"streaming",TRANSCRIPTION:"transcription"}),Hi=Object.values(zi),lp=["v","a","sv","sa","cv","ca"];Object.freeze(Hi.reduce(function(t,e,n){return t[e]=lp[n],t},{})),Object.freeze(lp.reduce(function(t,e,n){return t[e]=Hi[n],t},{}));var $0=[zi.VIDEO,zi.AUDIO,zi.SCREEN_VIDEO,zi.SCREEN_AUDIO],cp=Object.values(N0),up=["p","s","t"];Object.freeze(cp.reduce(function(t,e,n){return t[e]=up[n],t},{})),Object.freeze(up.reduce(function(t,e,n){return t[e]=cp[n],t},{}));var dp=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.base,r=e.byUserId,i=e.byParticipantId;gt(this,t),this.base=n,this.byUserId=r,this.byParticipantId=i}return mt(t,[{key:"clone",value:function(){var e=new t;if(this.base instanceof Ve?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 Ve?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 Ve?o.clone():o}return e}},{key:"toJSONObject",value:function(){var e={};if(typeof this.base=="boolean"?e.base=this.base:this.base instanceof Ve&&(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 Ve?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 Ve?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 Ve&&(this.base=this.base.normalize()),this.byUserId&&(this.byUserId=Object.fromEntries(Object.entries(this.byUserId).map(function(e){var n=Ge(e,2),r=n[0],i=n[1];return[r,i instanceof Ve?i.normalize():i]}))),this.byParticipantId&&(this.byParticipantId=Object.fromEntries(Object.entries(this.byParticipantId).map(function(e){var n=Ge(e,2),r=n[0],i=n[1];return[r,i instanceof Ve?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:Ve.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:Ve.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:Ve.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:Ve.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:Ve.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:Ve.fromMinifiedJSONObject(l)}return new t({base:n,byUserId:r,byParticipantId:i})}},{key:"validateJSONObject",value:function(e){if(pe(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=Ge(Ve.validateJSONObject(e.base,!0),2),a=s[0],l=s[1];if(!a)return[!1,l]}else{if(pe(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 f=d[c],h=Ge(Ve.validateJSONObject(f),2),b=h[0],y=h[1];if(!b)return[!1,y]}}}return[!0]}}])}(),Ve=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;gt(this,t),this.video=n,this.audio=r,this.screenVideo=i,this.screenAudio=o,this.customVideo=s,this.customAudio=a}return mt(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=Bn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Bn({},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=Bn({},this.customVideo)),this.customAudio!==void 0&&(e.customAudio=Bn({},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=Bn({},this.customVideo)),this.customAudio!==void 0&&(e.ca=Bn({},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?Bn({},e.customVideo):void 0,customAudio:e.customAudio!==void 0?Bn({},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(pe(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(!Hi.includes(s))return[!1,"invalid media type '".concat(s,"' in canReceive")];if($0.includes(s)){if(typeof e[s]!="boolean")return[!1,"invalid (non-boolean) value for media type '".concat(s,"' in canReceive")]}else{if(pe(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!==Hi.length?[!1,'canReceive "base" permission must specify all media types: '.concat(Hi.join(", ")," (or be set to a boolean shorthand)")]:[!0]}}])}(),F0=["result"],j0=["preserveIframe"];function fp(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 K(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fp(Object(n),!0).forEach(function(r){en(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fp(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hp=function(){return!!t})()}function pp(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 gp(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)?gp(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 gp(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 kr={},mp="video",B0="voice",vp=fe()?{data:{}}:{data:{},topology:"none"},yp={present:0,hidden:0},bp={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},Yl=Object.keys(bp),wp=["state","volume","simulcastEncodings"],Sp={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},xs={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string",visualState:"'default' | 'sidebar-open' | 'active'"}},Xl={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"}},xr={customIntegrations:{validate:Dp,help:Ap()},customTrayButtons:{validate:Op,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(xs))},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 Pp(t,Sp)},help:"reactNativeConfig should look like ".concat(JSON.stringify(Sp),", 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 xp(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:vn};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:vn};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 pe(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 _p(t,{allowAllParticipantsKey:!1})},help:Mp({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!!Cp(t)&&(e._inputSettings||(e._inputSettings={}),Ep(t,(n=e.properties)===null||n===void 0?void 0:n.dailyConfig,e._sharedTracks),e._updatePreloadCacheInputSettings(t,!0),!0)},help:tc()},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},_s={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)||!fe()&&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(fe()?"":" | '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=Ge(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=pp(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=Ge(dp.validateJSONObject(o),2),f=d[0],h=d[1];if(!f)return console.error(h),!1;break;case"canAdmin":if(o instanceof Set||o instanceof Array||Array.isArray(o)){var b,y=["participants","streaming","transcription"],v=pp(o);try{for(v.s();!(b=v.n()).done;){var S=b.value;if(!y.includes(S))return!1}}catch(m){v.e(m)}finally{v.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=ee(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 U0=function(){function t(u){var g,p,x,_,A,P,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(gt(this,t),x=this,_=jt(_=t),en(p=Ko(x,hp()?Reflect.construct(_,[],jt(x).constructor):_.apply(x,A)),"startListeningForDeviceChanges",function(){P0(p.handleDeviceChange)}),en(p,"stopListeningForDeviceChanges",function(){L0(p.handleDeviceChange)}),en(p,"handleDeviceChange",function(te){te=te.map(function(ue){return JSON.parse(JSON.stringify(ue))}),p.emitDailyJSEvent({action:"available-devices-updated",availableDevices:te})}),en(p,"handleNativeAppStateChange",function(){var te=ee(function*(ue){if(ue==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield p.destroy());var lt=ue==="active";p.disableReactNativeAutoDeviceManagement("video")||(lt?p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!0):(p.camUnmutedBeforeLosingNativeActiveState=p.localVideo(),p.camUnmutedBeforeLosingNativeActiveState&&p.setLocalVideo(!1)))});return function(ue){return te.apply(this,arguments)}}()),en(p,"handleNativeAudioFocusChange",function(te){p.disableReactNativeAutoDeviceManagement("audio")||(p._hasNativeAudioFocus=te,p.toggleParticipantAudioBasedOnNativeAudioFocus(),p._hasNativeAudioFocus?p.micUnmutedBeforeLosingNativeAudioFocus&&p.setLocalAudio(!0):(p.micUnmutedBeforeLosingNativeAudioFocus=p.localAudio(),p.setLocalAudio(!1)))}),en(p,"handleNativeSystemScreenCaptureStop",function(){p.stopScreenShare()}),!zl()&&!fe())throw new Error("WebRTC not supported or suppressed");if(p.strictMode=$.strictMode===void 0||$.strictMode,p.allowMultipleCallInstances=(g=$.allowMultipleCallInstances)!==null&&g!==void 0&&g,Object.keys(kr).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=Go(),kr[(P=p).callClientId]=P,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=K({},$),p._inputSettings||(p._inputSettings={}),p._callObjectLoader=p._callObjectMode?new S0(p.callClientId):null,p._callState=kh,p._isPreparingToJoin=!1,p._accessState={access:Nl},p._meetingSessionSummary={},p._finalSummaryOfPrevSession={},p._meetingSessionState=nc(vp,p._callObjectMode),p._nativeInCallAudioMode=mp,p._participants={},p._isScreenSharing=!1,p._participantCounts=yp,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=$l,p._messageChannel=fe()?new b0:new y0,p._iframe&&(p._iframe.requestFullscreen?p._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===p._iframe?(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms})):(p.emitDailyJSEvent({action:vs}),p.sendMessageToCallMachine({action:vs}))}):p._iframe.webkitRequestFullscreen&&p._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===p._iframe?(p.emitDailyJSEvent({action:ms}),p.sendMessageToCallMachine({action:ms})):(p.emitDailyJSEvent({action:vs}),p.sendMessageToCallMachine({action:vs}))})),fe()){var B=p.nativeUtils();B.addAudioFocusChangeListener&&B.removeAudioFocusChangeListener&&B.addAppStateChangeListener&&B.removeAppStateChangeListener&&B.addSystemScreenCaptureStopListener&&B.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),p._hasNativeAudioFocus=!0,B.addAudioFocusChangeListener(p.handleNativeAudioFocusChange),B.addAppStateChangeListener(p.handleNativeAppStateChange),B.addSystemScreenCaptureStopListener(p.handleNativeSystemScreenCaptureStop)}return p._callObjectMode&&p.startListeningForDeviceChanges(),p._messageChannel.addListenerForMessagesFromCallMachine(p.handleMessageFromCallMachine,p.callClientId,p),p}return Wo(t,Jo),mt(t,[{key:"destroy",value:(ve=ee(function*(){var u;try{yield this.leave()}catch{}var g=this._iframe;if(g){var p=g.parentElement;p&&p.removeChild(g)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),fe()){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 kr[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 ve.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(u){var g=u.bodyClass,p=u.cssFile,x=u.cssText;return he(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl(p),bodyClass:g,cssText:x}),this}},{key:"iframe",value:function(){return he(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return zt(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return zt(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(u,g){for(var p in g){if(!_s[p])throw new Error("unrecognized updateParticipant property ".concat(p));if(_s[p].validate&&!_s[p].validate(g[p],this,this._participants[u]))throw new Error(_s[p].help)}}},{key:"updateParticipant",value:function(u,g){return this._participants.local&&this._participants.local.session_id===u&&(u="local"),u&&g&&(this.validateParticipantProperties(u,g),this.sendMessageToCallMachine({action:"update-participant",id:u,properties:g})),this}},{key:"updateParticipants",value:function(u){var g=this._participants.local&&this._participants.local.session_id;for(var p in u)p===g&&(p="local"),p&&u[p]&&this.validateParticipantProperties(p,u[p]);return this.sendMessageToCallMachine({action:"update-participants",participants:u}),this}},{key:"updateWaitingParticipant",value:(ae=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(zt(this._callObjectMode,"updateWaitingParticipant()"),xe(this._callState,"updateWaitingParticipant()"),typeof g!="string"||pe(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:g,updates:p},function(A){A.error&&_(A.error),A.id||_(new Error("unknown error in updateWaitingParticipant()")),x({id:A.id})})})}),function(){return ae.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(Q=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(this._callObjectMode,"updateWaitingParticipants()"),xe(this._callState,"updateWaitingParticipants()"),pe(g)!=="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:g},function(_){_.error&&x(_.error),_.ids||x(new Error("unknown error in updateWaitingParticipants()")),p({ids:_.ids})})})}),function(){return Q.apply(this,arguments)})},{key:"requestAccess",value:(j=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=g.access,x=p===void 0?{level:hw}:p,_=g.name,A=_===void 0?"":_;return zt(this._callObjectMode,"requestAccess()"),xe(this._callState,"requestAccess()"),new Promise(function(P,$){u.sendMessageToCallMachine({action:"daily-method-request-access",access:x,name:A},function(B){B.error&&$(B.error),B.access||$(new Error("unknown error in requestAccess()")),P({access:B.access,granted:B.granted})})})}),function(){return j.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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return"forceDiscardTrack"in g&&(fe()?(console.warn("forceDiscardTrack option not supported in React Native; ignoring"),g={}):u&&(console.warn("forceDiscardTrack option only supported when calling setLocalAudio(false); ignoring"),g={})),this.sendMessageToCallMachine({action:"local-audio",state:u,options:g}),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:(R=ee(function*(u){var g=this,p=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,x=p!==void 0&&p;if(zt(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(pe(u)){case"string":return new Promise(function(_){g.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:u,showInheritedValues:x},function(A){_(A.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 R.apply(this,arguments)})},{key:"updateReceiveSettings",value:(ne=ee(function*(u){var g=this;if(zt(this._callObjectMode,"updateReceiveSettings()"),!_p(u,{allowAllParticipantsKey:!0}))throw new Error(Mp({allowAllParticipantsKey:!0}));return xe(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function(p){g.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:u},function(x){p({receiveSettings:x.receiveSettings})})})}),function(u){return ne.apply(this,arguments)})},{key:"_prepInputSettingsForSharing",value:function(u,g){if(u){var p={};if(u.audio){var x,_,A;u.audio.settings&&(!Object.keys(u.audio.settings).length&&g||(p.audio={settings:K({},u.audio.settings)})),g&&(x=p.audio)!==null&&x!==void 0&&(x=x.settings)!==null&&x!==void 0&&x.customTrack&&(p.audio.settings={customTrack:this._sharedTracks.audioTrack});var P=((_=u.audio.processor)===null||_===void 0?void 0:_.type)==="none"&&((A=u.audio.processor)===null||A===void 0?void 0:A._isDefaultWhenNone);if(u.audio.processor&&!P){var $=K({},u.audio.processor);delete $._isDefaultWhenNone,p.audio=K(K({},p.audio),{},{processor:$})}}if(u.video){var B,te,ue;u.video.settings&&(!Object.keys(u.video.settings).length&&g||(p.video={settings:K({},u.video.settings)})),g&&(B=p.video)!==null&&B!==void 0&&(B=B.settings)!==null&&B!==void 0&&B.customTrack&&(p.video.settings={customTrack:this._sharedTracks.videoTrack});var lt=((te=u.video.processor)===null||te===void 0?void 0:te.type)==="none"&&((ue=u.video.processor)===null||ue===void 0?void 0:ue._isDefaultWhenNone);if(u.video.processor&&!lt){var cn=K({},u.video.processor);delete cn._isDefaultWhenNone,p.video=K(K({},p.video),{},{processor:cn})}}return p}}},{key:"getInputSettings",value:function(){var u=this;return he(),new Promise(function(g){g(u._getInputSettings())})}},{key:"_getInputSettings",value:function(){var u,g,p,x,_,A,P={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(u=((p=this._inputSettings)===null||p===void 0?void 0:p.video)||P,g=((x=this._inputSettings)===null||x===void 0?void 0:x.audio)||P):(u=((_=this._preloadCache)===null||_===void 0||(_=_.inputSettings)===null||_===void 0?void 0:_.video)||P,g=((A=this._preloadCache)===null||A===void 0||(A=A.inputSettings)===null||A===void 0?void 0:A.audio)||P);var $={audio:g,video:u};return this._prepInputSettingsForSharing($,!0)}},{key:"_updatePreloadCacheInputSettings",value:function(u,g){var p=this._inputSettings||{},x={};if(u.video){var _,A,P;x.video={},u.video.settings?(x.video.settings={},g||u.video.settings.customTrack||(P=p.video)===null||P===void 0||!P.settings?x.video.settings=u.video.settings:x.video.settings=K(K({},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:(A=p.video)!==null&&A!==void 0&&A.processor&&(x.video.processor=p.video.processor)}else p.video&&(x.video=p.video);if(u.audio){var $,B,te;x.audio={},u.audio.settings?(x.audio.settings={},g||u.audio.settings.customTrack||(te=p.audio)===null||te===void 0||!te.settings?x.audio.settings=u.audio.settings:x.audio.settings=K(K({},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:(B=p.audio)!==null&&B!==void 0&&B.processor&&(x.audio.processor=p.audio.processor)}else p.audio&&(x.audio=p.audio);this._maybeUpdateInputSettings(x)}},{key:"_devicesFromInputSettings",value:function(u){var g,p,x=(u==null||(g=u.video)===null||g===void 0||(g=g.settings)===null||g===void 0?void 0:g.deviceId)||null,_=(u==null||(p=u.audio)===null||p===void 0||(p=p.settings)===null||p===void 0?void 0:p.deviceId)||null,A=this._preloadCache.outputDeviceId||null;return{camera:x?{deviceId:x}:{},mic:_?{deviceId:_}:{},speaker:A?{deviceId:A}:{}}}},{key:"updateInputSettings",value:(G=ee(function*(u){var g=this;return he(),Cp(u)?u.video||u.audio?(Ep(u,this.properties.dailyConfig,this._sharedTracks),this._callObjectMode&&!this._callMachineInitialized?(this._updatePreloadCacheInputSettings(u,!0),this._getInputSettings()):new Promise(function(p,x){g.sendMessageToCallMachine({action:"update-input-settings",inputSettings:u},function(_){if(_.error)x(_.error);else{if(_.returnPreloadCache)return g._updatePreloadCacheInputSettings(u,!0),void p(g._getInputSettings());g._maybeUpdateInputSettings(_.inputSettings),p(g._prepInputSettingsForSharing(_.inputSettings,!0))}})})):this._getInputSettings():(console.error(tc()),Promise.reject(tc()))}),function(u){return G.apply(this,arguments)})},{key:"setBandwidth",value:function(u){var g=u.kbs,p=u.trackConstraints;if(he(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:g,trackConstraints:p}),this}},{key:"getDailyLang",value:function(){var u=this;if(he(),this._callMachineInitialized)return new Promise(function(g){u.sendMessageToCallMachine({action:"get-daily-lang"},function(p){delete p.action,delete p.callbackStamp,g(p)})})}},{key:"setDailyLang",value:function(u){return he(),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[Fn,jn].includes(this._callState)?this._finalSummaryOfPrevSession:this._meetingSessionSummary}},{key:"getMeetingSession",value:(H=ee(function*(){var u=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),xe(this._callState,"getMeetingSession()"),new Promise(function(g){u.sendMessageToCallMachine({action:"get-meeting-session"},function(p){delete p.action,delete p.callbackStamp,g(p)})})}),function(){return H.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return xe(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(u){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";zt(this._callObjectMode,"setMeetingSessionData()"),xe(this._callState,"setMeetingSessionData");try{(function(p,x){new w0({data:p,mergeStrategy:x})})(u,g)}catch(p){throw console.error(p),p}try{this.sendMessageToCallMachine({action:"set-session-data",data:u,mergeStrategy:g})}catch(p){throw new Error("Error setting meeting session data: ".concat(p))}}},{key:"setUserName",value:function(u,g){var p=this;return this.properties.userName=u,new Promise(function(x){p.sendMessageToCallMachine({action:"set-user-name",name:u??"",thisMeetingOnly:fe()||!!g&&!!g.thisMeetingOnly},function(_){delete _.action,delete _.callbackStamp,x(_)})})}},{key:"setUserData",value:(ie=ee(function*(u){var g=this;try{xp(u)}catch(p){throw console.error(p),p}if(this.properties.userData=u,this._callMachineInitialized)return new Promise(function(p){try{g.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 g=this;if(typeof AudioWorkletNode>"u"&&!fe())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){g.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:u},function(_){g._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 g=this;if(this.validateAudioLevelInterval(u),this._callMachineInitialized)return this._isRemoteParticipantsAudioLevelObserverRunning=!0,new Promise(function(p,x){g.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:u},function(_){g._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=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(this._callObjectMode,"startCamera()"),Zl(this._callState,this._isPreparingToJoin,"startCamera()","Did you mean to use setLocalAudio() and/or setLocalVideo() instead?"),this.needsLoad())try{yield this.load(g)}catch(p){return Promise.reject(p)}else{if(this._didPreAuth){if(g.url&&g.url!==this.properties.url)return console.error("url in startCamera() is different than the one used in preAuth()"),Promise.reject();if(g.token&&g.token!==this.properties.token)return console.error("token in startCamera() is different than the one used in preAuth()"),Promise.reject()}this.validateProperties(g),this.properties=K(K({},this.properties),g)}return new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"start-camera",properties:Zr(u.properties,u.callClientId),preloadCache:Zr(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,g,p){if(p&&p.length>50)throw new Error("Custom track `trackName` must not be more than 50 characters");if(g&&g!=="music"&&g!=="speech"&&!(g 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,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{track,mode,trackName,ignoreAudioLevel};return he(),xe(this._callState,"startCustomTrack()"),this.validateCustomTrack(g.track,g.mode,g.trackName),new Promise(function(p,x){u._sharedTracks.customTrack=g.track,g.track=vn,u.sendMessageToCallMachine({action:"start-custom-track",properties:g},function(_){_.error?x({error:_.error}):p(_.mediaTag)})})}},{key:"stopCustomTrack",value:function(u){var g=this;return he(),xe(this._callState,"stopCustomTrack()"),new Promise(function(p){g.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:u},function(x){p(x.mediaTag)})})}},{key:"setCamera",value:function(u){var g=this;return Vi(),Es(this._callMachineInitialized,"setCamera()"),new Promise(function(p){g.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:u},function(x){p({device:x.device})})})}},{key:"setAudioDevice",value:(V=ee(function*(u){return Vi(),this.nativeUtils().setAudioDevice(u),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(u){return V.apply(this,arguments)})},{key:"cycleCamera",value:function(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p){u.sendMessageToCallMachine({action:"cycle-camera",properties:g},function(x){p({device:x.device})})})}},{key:"cycleMic",value:function(){var u=this;return he(),new Promise(function(g){u.sendMessageToCallMachine({action:"cycle-mic"},function(p){g({device:p.device})})})}},{key:"getCameraFacingMode",value:function(){var u=this;return Vi(),new Promise(function(g){u.sendMessageToCallMachine({action:"get-camera-facing-mode"},function(p){g(p.facingMode)})})}},{key:"setInputDevicesAsync",value:(U=ee(function*(u){var g=this,p=u.audioDeviceId,x=u.videoDeviceId,_=u.audioSource,A=u.videoSource;if(he(),_!==void 0&&(p=_),A!==void 0&&(x=A),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 P={};return p&&(p instanceof MediaStreamTrack?(this._sharedTracks.audioTrack=p,p=vn,P.audio={settings:{customTrack:p}}):(delete this._sharedTracks.audioTrack,P.audio={settings:{deviceId:p}})),x&&(x instanceof MediaStreamTrack?(this._sharedTracks.videoTrack=x,x=vn,P.video={settings:{customTrack:x}}):(delete this._sharedTracks.videoTrack,P.video={settings:{deviceId:x}})),this._callObjectMode&&this.needsLoad()?(this._updatePreloadCacheInputSettings(P,!1),this._devicesFromInputSettings(this._inputSettings)):new Promise(function($){g.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:p,videoDeviceId:x},function(B){if(delete B.action,delete B.callbackStamp,B.returnPreloadCache)return g._updatePreloadCacheInputSettings(P,!1),void $(g._devicesFromInputSettings(g._inputSettings));$(B)})})}),function(u){return U.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(W=ee(function*(u){var g=this,p=u.outputDeviceId;if(he(),!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,_){g.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:p},function(A){if(delete A.action,delete A.callbackStamp,A.error){var P=new Error(A.error.message);return P.type=A.error.type,void _(P)}A.returnPreloadCache?x(g._devicesFromInputSettings(g._inputSettings)):x(A)})})}),function(u){return W.apply(this,arguments)})},{key:"getInputDevices",value:(J=ee(function*(){var u=this;return this._callObjectMode&&this.needsLoad()?this._devicesFromInputSettings(this._inputSettings):new Promise(function(g){u.sendMessageToCallMachine({action:"get-input-devices"},function(p){p.returnPreloadCache?g(u._devicesFromInputSettings(u._inputSettings)):g({camera:p.camera,mic:p.mic,speaker:p.speaker})})})}),function(){return J.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return Vi(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(u){if(Vi(),[mp,B0].includes(u)){if(u!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=u,!this.disableReactNativeAutoDeviceManagement("audio")&&Cs(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMode(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",u)}},{key:"preAuth",value:(F=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(zt(this._callObjectMode,"preAuth()"),Zl(this._callState,this._isPreparingToJoin,"preAuth()"),this.needsLoad()&&(yield this.load(g)),!g.url)throw new Error("preAuth() requires at least a url to be provided");return this.validateProperties(g),this.properties=K(K({},this.properties),g),new Promise(function(p,x){u._preloadCache.inputSettings=u._prepInputSettingsForSharing(u._inputSettings,!1),u.sendMessageToCallMachine({action:"daily-method-preauth",properties:Zr(u.properties,u.callClientId),preloadCache:Zr(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:(D=ee(function*(u){var g=this;if(this.needsLoad()){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");if(u&&(this.validateProperties(u),this.properties=K(K({},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(xh),this.emitDailyJSEvent({action:ww}),this._callObjectMode?new Promise(function(p,x){g._callObjectLoader.cancel();var _=Date.now();g._callObjectLoader.load(g.properties.dailyConfig,function(A){g._bundleLoadTime=A?"no-op":Date.now()-_,g._updateCallState(_h),A&&g.emitDailyJSEvent({action:Eh}),p()},function(A,P){if(g.emitDailyJSEvent({action:Sw}),!P){g._updateCallState(jn),g.resetMeetingDependentVars();var $={action:Dh,errorMsg:A.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:A,bundleUrl:Qo(g.properties.dailyConfig)}}};g._maybeSendToSentry($),g.emitDailyJSEvent($),x(A.msg)}})}):(this._iframe.src=cf(this.assembleMeetingUrl(),this.properties.dailyConfig),new Promise(function(p,x){g._loadedCallback=function(_){g._callState!==jn?(g._updateCallState(_h),(g.properties.cssFile||g.properties.cssText)&&g.loadCss(g.properties),p()):x(_)}}))}}),function(u){return D.apply(this,arguments)})},{key:"join",value:(O=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._testCallInProgress&&this.stopTestCallQuality(),!g.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(g)}catch(_){return this.updateIsPreparingToJoin(!1),Promise.reject(_)}}else{if(x=!(!this.properties.cssFile&&!this.properties.cssText),this._didPreAuth){if(g.url&&g.url!==this.properties.url)return console.error("url in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject();if(g.token&&g.token!==this.properties.token)return console.error("token in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject()}if(g.url&&!this._callObjectMode&&g.url&&g.url!==this.properties.url)return console.error("url in join() is different than the one used in load() (".concat(this.properties.url," -> ").concat(g.url,")")),this.updateIsPreparingToJoin(!1),Promise.reject();this.validateProperties(g),this.properties=K(K({},this.properties),g)}return g.showLocalVideo!==void 0&&(this._callObjectMode?console.error("showLocalVideo is not available in callObject mode"):this._showLocalVideo=!!g.showLocalVideo),g.showParticipantsBar!==void 0&&(this._callObjectMode?console.error("showParticipantsBar is not available in callObject mode"):this._showParticipantsBar=!!g.showParticipantsBar),this._callState===wr||this._callState===Rl?(console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1)):(this._updateCallState(Rl,!1),this.emitDailyJSEvent({action:_w}),this._preloadCache.inputSettings=this._prepInputSettingsForSharing(this._inputSettings||{},!1),this.sendMessageToCallMachine({action:"join-meeting",properties:Zr(this.properties,this.callClientId),preloadCache:Zr(this._preloadCache,this.callClientId)},function(_){_.error&&u._joinedCallback&&(u._joinedCallback(null,_.error),u._joinedCallback=null)}),new Promise(function(_,A){u._joinedCallback=function(P,$){if(u._callState!==jn){if($)return u._updateCallState(Fn),void A($);if(u._updateCallState(wr),P)for(var B in P){if(u._callObjectMode){var te=u._callMachine().store;tp(P[B],te),np(P[B],te),rp(P[B],u._participants[B],te)}u._participants[B]=K({},P[B]),u.toggleParticipantAudioBasedOnNativeAudioFocus()}x&&u.loadCss(u.properties),_(P)}else A($)}}))}),function(){return O.apply(this,arguments)})},{key:"leave",value:(M=ee(function*(){var u=this;return this._testCallInProgress&&this.stopTestCallQuality(),new Promise(function(g){u._callState===Fn||u._callState===jn?g():u._callObjectLoader&&!u._callObjectLoader.loaded?(u._callObjectLoader.cancel(),u._updateCallState(Fn),u.resetMeetingDependentVars(),u.emitDailyJSEvent({action:Fn}),g()):(u._resolveLeave=g,u.sendMessageToCallMachine({action:"leave-meeting"}))})}),function(){return M.apply(this,arguments)})},{key:"startScreenShare",value:(C=ee(function*(){var u=this,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Es(this._callMachineInitialized,"startScreenShare()"),g.screenVideoSendSettings&&this._validateVideoSendSettings("screenVideo",g.screenVideoSendSettings),g.mediaStream&&(this._sharedTracks.screenMediaStream=g.mediaStream,g.mediaStream=vn),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var p=this.nativeUtils();if(yield p.isScreenBeingCaptured())return void this.emitDailyJSEvent({action:Oh,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:Lh,captureOptions:g})}),p.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:Lh,captureOptions:g})}),function(){return C.apply(this,arguments)})},{key:"stopScreenShare",value:function(){Es(this._callMachineInitialized,"stopScreenShare()"),this.sendMessageToCallMachine({action:"local-screen-stop"})}},{key:"startRecording",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},g=u.type;if(g&&g!=="cloud"&&g!=="cloud-audio-only"&&g!=="raw-tracks"&&g!=="local")throw new Error("invalid type: ".concat(g,", allowed values 'cloud', 'cloud-audio-only', 'raw-tracks', or 'local'"));this.sendMessageToCallMachine(K({action:"local-recording-start"},u))}},{key:"updateRecording",value:function(u){var g=u.layout,p=g===void 0?{preset:"default"}:g,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(K({action:"local-recording-stop"},u))}},{key:"startLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(K({action:"daily-method-start-live-streaming"},u))}},{key:"updateLiveStreaming",value:function(u){var g=u.layout,p=g===void 0?{preset:"default"}:g,x=u.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:p,instanceId:x})}},{key:"addLiveStreamingEndpoints",value:function(u){var g=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Ih,endpointsOp:f0,endpoints:g,instanceId:p})}},{key:"removeLiveStreamingEndpoints",value:function(u){var g=u.endpoints,p=u.instanceId;this.sendMessageToCallMachine({action:Ih,endpointsOp:h0,endpoints:g,instanceId:p})}},{key:"stopLiveStreaming",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(K({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."),Uh()&&u.noAutoDefaultDeviceChange&&console.warn("noAutoDefaultDeviceChange is not supported on Android, and will be ignored.")}},{key:"validateSimulcastEncodings",value:function(u){var g=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(!Rp(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 A in this._validateEncodingLayerHasValidProperties(_),_)if(Yl.includes(A)){if(typeof _[A]!="number")throw new Error("".concat(A," must be a number"));if(g){var P=g[A],$=P.min,B=P.max;if(!Rp(_[A],$,B))throw new Error("".concat(A," value not in range. valid range: ").concat($," to ").concat(B))}}else if(!["active","scalabilityMode"].includes(A))throw new Error("Invalid key ".concat(A,", valid keys are:")+Object.values(Yl));if(p&&!_.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(k=ee(function*(u){var g=this,p=u.url,x=u.settings,_=x===void 0?{state:jl.PLAY}:x;try{(function(A){if(typeof A!="string")throw new Error('url parameter must be "string" type')})(p),Ip(_),function(A){for(var P in A)if(!wp.includes(P))throw new Error("Invalid key ".concat(P,", valid keys are: ").concat(wp));A.simulcastEncodings&&this.validateSimulcastEncodings(A.simulcastEncodings,bp,!0)}(_)}catch(A){throw console.error("invalid argument Error: ".concat(A)),console.error(`startRemoteMediaPlayer arguments must be of the form:
|
|
31
31
|
{ url: "playback url",
|
|
32
32
|
settings?:
|
|
33
|
-
{state: "play"|"pause", simulcastEncodings?: [{}] } }`),A}return new Promise(function(A,P){g.sendMessageToCallMachine({action:"daily-method-start-remote-media-player",url:p,settings:_},function($){$.error?P({error:$.error,errorMsg:$.errorMsg}):A({session_id:$.session_id,remoteMediaPlayerState:{state:$.state,settings:$.settings}})})})}),function(u){return k.apply(this,arguments)})},{key:"stopRemoteMediaPlayer",value:(w=ee(function*(u){var g=this;if(typeof u!="string")throw new Error(" remotePlayerID must be of type string");return new Promise(function(p,x){g.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:(
|
|
33
|
+
{state: "play"|"pause", simulcastEncodings?: [{}] } }`),A}return new Promise(function(A,P){g.sendMessageToCallMachine({action:"daily-method-start-remote-media-player",url:p,settings:_},function($){$.error?P({error:$.error,errorMsg:$.errorMsg}):A({session_id:$.session_id,remoteMediaPlayerState:{state:$.state,settings:$.settings}})})})}),function(u){return k.apply(this,arguments)})},{key:"stopRemoteMediaPlayer",value:(w=ee(function*(u){var g=this;if(typeof u!="string")throw new Error(" remotePlayerID must be of type string");return new Promise(function(p,x){g.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=ee(function*(u){var g=this,p=u.session_id,x=u.settings;try{Ip(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(_,A){g.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:p,settings:x},function(P){P.error?A({error:P.error,errorMsg:P.errorMsg}):_({session_id:P.session_id,remoteMediaPlayerState:{state:P.state,settings:P.settings}})})})}),function(u){return v.apply(this,arguments)})},{key:"startTranscription",value:function(u){xe(this._callState,"startTranscription()"),this.sendMessageToCallMachine(K({action:"daily-method-start-transcription"},u))}},{key:"updateTranscription",value:function(u){if(xe(this._callState,"updateTranscription()"),!u)throw new Error("updateTranscription Error: options is mandatory");if(pe(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(K({action:"daily-method-update-transcription"},u))}},{key:"stopTranscription",value:function(u){if(xe(this._callState,"stopTranscription()"),u&&pe(u)!=="object")throw new Error("stopTranscription Error: options must be object type");if(u&&!u.instanceId)throw new Error('"instanceId" not provided');this.sendMessageToCallMachine(K({action:"daily-method-stop-transcription"},u))}},{key:"startDialOut",value:(S=ee(function*(u){var g=this;xe(this._callState,"startDialOut()");var p=function(P){if(P){if(!Array.isArray(P))throw new Error("Error starting dial out: audio codec must be an array");if(P.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");P.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(P){if(P&&(p(P.audio),P.video)){if(!Array.isArray(P.video))throw new Error("Error starting dial out: video codec must be an array");if(P.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");P.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(Sp(u),u.permissions&&u.permissions.canReceive){var x=Ge(up.validateJSONObject(u.permissions.canReceive),2),_=x[0],A=x[1];if(!_)throw new Error(A)}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(P,$){g.sendMessageToCallMachine(K({action:"dialout-start"},u),function(B){B.error?$(B.error):P(B)})})}),function(u){return S.apply(this,arguments)})},{key:"stopDialOut",value:function(u){var g=this;return xe(this._callState,"stopDialOut()"),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:"dialout-stop"},u),function(_){_.error?x(_.error):p(_)})})}},{key:"sipCallTransfer",value:(m=ee(function*(u){var g=this;if(xe(this._callState,"sipCallTransfer()"),!u)throw new Error("sipCallTransfer() requires a sessionId and toEndPoint");return u.useSipRefer=!1,Pp(u,"sipCallTransfer"),Sp(u),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:Rh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return m.apply(this,arguments)})},{key:"sipRefer",value:(y=ee(function*(u){var g=this;if(xe(this._callState,"sipRefer()"),!u)throw new Error("sessionId and toEndPoint are mandatory parameter");return u.useSipRefer=!0,Pp(u,"sipRefer"),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:Rh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return y.apply(this,arguments)})},{key:"sendDTMF",value:(b=ee(function*(u){var g=this;return xe(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 A=/[^0-9A-D*#]/g,P=_.match(A);if(P&&P[0])throw new Error("".concat(P[0]," is not valid DTMF tone"))}(u),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:"send-dtmf"},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return b.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var u=this;return this._callState!==wr?Promise.resolve(K({stats:{latest:{}}},this._network)):new Promise(function(g){u.sendMessageToCallMachine({action:"get-calc-stats"},function(p){g(K(K({},u._network),{},{stats:p.stats}))})})}},{key:"testWebsocketConnectivity",value:(h=ee(function*(){var u=this;if(Zl(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(g){return Promise.reject(g)}return new Promise(function(g,p){u.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(x){x.error?p(x.error):g(x.results)})})}),function(){return h.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(u){return u?u instanceof MediaStreamTrack?!!Lw(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:(f=ee(function*(){var u=this;he(),zt(this._callObjectMode,"testCallQuality()"),Cs(this._callMachineInitialized,"testCallQuality()",null,!0),Xl(this._callState,this._isPreparingToJoin,"testCallQuality()");var g=this._testCallAlreadyInProgress,p=function(_){g||(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(A){var P=A.results,$=P.result,B=Yd(P,Nw);if($==="failed"){var te,ue=K({},B);(te=B.error)!==null&&te!==void 0&&te.details?(B.error.details=JSON.parse(B.error.details),ue.error=K(K({},ue.error),{},{details:K({},ue.error.details)}),ue.error.details.duringTest="testCallQuality"):(ue.error=ue.error?K({},ue.error):{},ue.error.details={duringTest:"testCallQuality"}),u._maybeSendToSentry(ue)}p(!1),_(K({result:$},B))})})}),function(){return f.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(d=ee(function*(u){var g;fe()?(console.warn("testConnectionQuality() is deprecated: use testPeerToPeerCallQuality() instead"),g=yield this.testPeerToPeerCallQuality(u)):(console.warn("testConnectionQuality() is deprecated: use testCallQuality() instead"),g=yield this.testCallQuality());var p={result:g.result,secondsElapsed:g.secondsElapsed};return g.data&&(p.data={maxRTT:g.data.maxRoundTripTime,packetLoss:g.data.avgRecvPacketLoss}),p}),function(u){return d.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(c=ee(function*(u){var g=this;if(Zl(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(_,A){g.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:x},function(P){P.error?A(P.error):_(P.results)})})}),function(u){return c.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){fe()?(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=ee(function*(u){var g=this;if(Zl(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){g.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(g){u._callState===wr?u.sendMessageToCallMachine({action:"get-cpu-load-stats"},function(p){g(p.cpuStats)}):g({cpuLoadState:void 0,cpuLoadStateReason:void 0,stats:{}})})}},{key:"_validateEncodingLayerHasValidProperties",value:function(u){var g;if(!(((g=Object.keys(u))===null||g===void 0?void 0:g.length)>0))throw new Error("Empty encoding is not allowed. At least one of these valid keys should be specified:"+Object.values(Ql))}},{key:"_validateVideoSendSettings",value:function(u,g){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 g=="string"){if(!p.includes(g))throw new Error(x)}else{if(pe(g)!=="object")throw new Error(x);if(!g.maxQuality&&!g.encodings&&g.allowAdaptiveLayers===void 0)throw new Error("Video send settings must contain at least maxQuality, allowAdaptiveLayers or encodings attribute");if(g.maxQuality&&["low","medium","high"].indexOf(g.maxQuality)===-1)throw new Error("maxQuality must be either low, medium or high");if(g.encodings){var _=!1;switch(Object.keys(g.encodings).length){case 1:_=!g.encodings.low;break;case 2:_=!g.encodings.low||!g.encodings.medium;break;case 3:_=!g.encodings.low||!g.encodings.medium||!g.encodings.high;break;default:_=!0}if(_)throw new Error("Encodings must be defined as: low, low and medium, or low, medium and high.");g.encodings.low&&this._validateEncodingLayerHasValidProperties(g.encodings.low),g.encodings.medium&&this._validateEncodingLayerHasValidProperties(g.encodings.medium),g.encodings.high&&this._validateEncodingLayerHasValidProperties(g.encodings.high)}}}},{key:"validateUpdateSendSettings",value:function(u){var g=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=Ge(p,2),_=x[0],A=x[1];g._validateVideoSendSettings(_,A)})}},{key:"updateSendSettings",value:function(u){var g=this;return this.validateUpdateSendSettings(u),this.needsLoad()?(this._preloadCache.sendSettings=u,{sendSettings:this._preloadCache.sendSettings}):new Promise(function(p,x){g.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 he(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(u){return he(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:u}),this}},{key:"activeSpeakerMode",value:function(){return he(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(u){return xe(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=ee(function*(){var u=this;if(this._callObjectMode){var g=yield navigator.mediaDevices.enumerateDevices();return Sr()==="Firefox"&&bs().major>115&&bs().major<123&&(g=g.filter(function(p){return p.kind!=="audiooutput"})),{devices:g.map(function(p){var x=JSON.parse(JSON.stringify(p));if(!fe()&&p.kind==="videoinput"&&p.getCapabilities){var _,A=p.getCapabilities();x.facing=(A==null||(_=A.facingMode)===null||_===void 0?void 0:_.length)>=1?A.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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"*";if(xe(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:g}),this}},{key:"addFakeParticipant",value:function(u){return he(),xe(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(K({action:"add-fake-participant"},u)),this}},{key:"setShowNamesMode",value:function(u){return yt(this._callObjectMode,"setShowNamesMode()"),he(),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 yt(this._callObjectMode,"setShowLocalVideo()"),he(),xe(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 yt(this._callObjectMode,"showLocalVideo()"),he(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return yt(this._callObjectMode,"setShowParticipantsBar()"),he(),xe(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 yt(this._callObjectMode,"showParticipantsBar()"),he(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return he(),yt(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(u){return he(),yt(this._callObjectMode,"setCustomIntegrations()"),xe(this._callState,"setCustomIntegrations()"),Op(u)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:u}),this._customIntegrations=u,this):this}},{key:"startCustomIntegrations",value:function(u){var g=this;if(he(),yt(this._callObjectMode,"startCustomIntegrations()"),xe(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 g._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 g=this;if(he(),yt(this._callObjectMode,"stopCustomIntegrations()"),xe(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 g._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 yt(this._callObjectMode,"customTrayButtons()"),he(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(u){return yt(this._callObjectMode,"updateCustomTrayButtons()"),he(),xe(this._callState,"updateCustomTrayButtons()"),Ap(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(ks))),this)}},{key:"theme",value:function(){return yt(this._callObjectMode,"theme()"),this.properties.theme}},{key:"setTheme",value:function(u){var g=this;return yt(this._callObjectMode,"setTheme()"),new Promise(function(p,x){try{g.validateProperties({theme:u}),g.properties.theme=K({},u),g.sendMessageToCallMachine({action:"set-theme",theme:g.properties.theme});try{g.emitDailyJSEvent({action:v0,theme:g.properties.theme})}catch(_){console.log("could not emit 'theme-updated'",_)}p(g.properties.theme)}catch(_){x(_)}})}},{key:"requestFullscreen",value:(s=ee(function*(){if(he(),this._iframe&&!document.fullscreenElement&&$h())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(){he(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(o=ee(function*(){var u=this;return this._callObjectMode?(console.error("getSidebarView is not available in callObject mode"),Promise.resolve(null)):new Promise(function(g){u.sendMessageToCallMachine({action:"get-sidebar-view"},function(p){g(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=ee(function*(){var u=this,g=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,p=g===void 0||g;return this._accessState.access===Rl||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=ee(function*(){try{var u=yield fetch("https://gs.daily.co/_ks_/x-swsl/:");return{current:(yield u.json()).geo}}catch(g){return console.error("geo lookup failed",g),{current:""}}}),function(){return r.apply(this,arguments)})},{key:"setNetworkTopology",value:(n=ee(function*(u){var g=this;return he(),xe(this._callState,"setNetworkTopology()"),new Promise(function(p,x){g.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=ee(function*(){var u=this;return new Promise(function(g,p){u.needsLoad()&&g({topology:"none"}),u.sendMessageToCallMachine({action:"get-network-topology"},function(x){x.error?p({error:x.error}):g({topology:x.topology})})})}),function(){return e.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(u){if(he(),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,g){return qo.prototype.on.call(this,u,g)}},{key:"once",value:function(u,g){return qo.prototype.once.call(this,u,g)}},{key:"off",value:function(u,g){return qo.prototype.off.call(this,u,g)}},{key:"validateProperties",value:function(u){var g,p;if(u!=null&&(g=u.dailyConfig)!==null&&g!==void 0&&g.userMediaAudioConstraints){var x,_;fe()||console.warn("userMediaAudioConstraints is deprecated. You can override constraints with inputSettings.audio.settings, found in DailyCallOptions.");var A=u.inputSettings||{};A.audio=((x=u.inputSettings)===null||x===void 0?void 0:x.audio)||{},A.audio.settings=((_=u.inputSettings)===null||_===void 0||(_=_.audio)===null||_===void 0?void 0:_.settings)||{},A.audio.settings=K(K({},A.audio.settings),u.dailyConfig.userMediaAudioConstraints),u.inputSettings=A,delete u.dailyConfig.userMediaAudioConstraints}if(u!=null&&(p=u.dailyConfig)!==null&&p!==void 0&&p.userMediaVideoConstraints){var P,$;fe()||console.warn("userMediaVideoConstraints is deprecated. You can override constraints with inputSettings.video.settings, found in DailyCallOptions.");var B=u.inputSettings||{};B.video=((P=u.inputSettings)===null||P===void 0?void 0:P.video)||{},B.video.settings=(($=u.inputSettings)===null||$===void 0||($=$.video)===null||$===void 0?void 0:$.settings)||{},B.video.settings=K(K({},B.video.settings),u.dailyConfig.userMediaVideoConstraints),u.inputSettings=B,delete u.dailyConfig.userMediaVideoConstraints}for(var te in u)if(xr[te]){if(xr[te].validate&&!xr[te].validate(u[te],this))throw new Error("property '".concat(te,"': ").concat(xr[te].help))}else console.warn("Ignoring unrecognized property '".concat(te,"'")),delete u[te]}},{key:"assembleMeetingUrl",value:function(){var u,g,p=K(K({},this.properties),{},{emb:this.callClientId,embHref:encodeURIComponent(window.location.href),proxy:(u=this.properties.dailyConfig)!==null&&u!==void 0&&u.proxyUrl?encodeURIComponent((g=this.properties.dailyConfig)===null||g===void 0?void 0:g.proxyUrl):void 0}),x=p.url.match(/\?/)?"&":"?";return p.url+x+Object.keys(xr).filter(function(_){return xr[_].queryString&&p[_]!==void 0}).map(function(_){return"".concat(xr[_].queryString,"=").concat(p[_])}).join("&")}},{key:"needsLoad",value:function(){return[Sh,kh,Fn,jn].includes(this._callState)}},{key:"sendMessageToCallMachine",value:function(u,g){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");this._messageChannel.sendMessageToCallMachine(u,g,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 g0:this.sendMessageToCallMachine(K({action:m0},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var g={action:vs,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:Go(this.properties.dailyConfig)}};this.sendMessageToCallMachine(g),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case Ch:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emitDailyJSEvent(u);break;case x0:var p,x=K({},u);delete x.internal,this._maxAppMessageSize=((p=u.internal)===null||p===void 0?void 0:p._maxAppMessageSize)||Nl,this._joinedCallback&&(this._joinedCallback(u.participants),this._joinedCallback=null),this.emitDailyJSEvent(x);break;case C0:case E0:if(this._callState===Fn)return;if(u.participant&&u.participant.session_id){var _=u.participant.local?"local":u.participant.session_id;if(this._callObjectMode){var A=this._callMachine().store;ep(u.participant,A),tp(u.participant,A),np(u.participant,this._participants[_],A)}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(Vx){console.error("track events error",Vx)}this.compareEqualForParticipantUpdateEvent(u.participant,this._participants[_])||(this._participants[_]=K({},u.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus(),this.emitDailyJSEvent(u))}break;case T0:if(u.participant&&u.participant.session_id){var P=this._participants[u.participant.session_id];P&&this.maybeParticipantTracksStopped(P,null),delete this._participants[u.participant.session_id],this.emitDailyJSEvent(u)}break;case M0:tt(this._participantCounts,u.participantCounts)||(this._participantCounts=u.participantCounts,this.emitDailyJSEvent(u));break;case A0:var $={access:u.access};u.awaitingAccess&&($.awaitingAccess=u.awaitingAccess),tt(this._accessState,$)||(this._accessState=$,this.emitDailyJSEvent(u));break;case O0:if(u.meetingSession){this._meetingSessionSummary=u.meetingSession,this.emitDailyJSEvent(u);var B=K(K({},u),{},{action:"meeting-session-updated"});this.emitDailyJSEvent(B)}break;case Oh:var te;this._iframe&&!u.preserveIframe&&(this._iframe.src=""),this._updateCallState(jn),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(u.errorMsg),this._loadedCallback=null),u.preserveIframe;var ue=Yd(u,$w);ue!=null&&(te=ue.error)!==null&&te!==void 0&&te.details&&(ue.error.details=JSON.parse(ue.error.details)),this._maybeSendToSentry(u),this._joinedCallback&&(this._joinedCallback(null,ue),this._joinedCallback=null),this.emitDailyJSEvent(ue);break;case _0:this._callState!==jn&&this._updateCallState(Fn),this.resetMeetingDependentVars(),this._resolveLeave&&(this._resolveLeave(),this._resolveLeave=null),this.emitDailyJSEvent(u);break;case"selected-devices-updated":u.devices&&this.emitDailyJSEvent(u);break;case ew:var lt=u.state,cn=u.threshold,un=u.quality,Re=lt.state,le=lt.reasons;Re===this._network.networkState&&tt(le,this._network.networkStateReasons)&&cn===this._network.threshold&&un===this._network.quality||(this._network.networkState=Re,this._network.networkStateReasons=le,this._network.quality=un,this._network.threshold=cn,u.networkState=Re,le.length&&(u.networkStateReasons=le),delete u.state,this.emitDailyJSEvent(u));break;case nw:u&&u.cpuLoadState&&this.emitDailyJSEvent(u);break;case rw:u&&u.faceCounts!==void 0&&this.emitDailyJSEvent(u);break;case X0:var Yt=u.activeSpeaker;this._activeSpeaker.peerId!==Yt.peerId&&(this._activeSpeaker.peerId=Yt.peerId,this.emitDailyJSEvent({action:u.action,activeSpeaker:this._activeSpeaker}));break;case"show-local-video-changed":if(this._callObjectMode)return;var $o=u.show;this._showLocalVideo=$o,this.emitDailyJSEvent({action:u.action,show:$o});break;case Z0:var Ha=u.enabled;this._activeSpeakerMode!==Ha&&(this._activeSpeakerMode=Ha,this.emitDailyJSEvent({action:u.action,enabled:this._activeSpeakerMode}));break;case P0:case L0:case I0:this._waitingParticipants=u.allWaitingParticipants,this.emitDailyJSEvent({action:u.action,participant:u.participant});break;case cw:tt(this._receiveSettings,u.receiveSettings)||(this._receiveSettings=u.receiveSettings,this.emitDailyJSEvent({action:u.action,receiveSettings:u.receiveSettings}));break;case Mh:this._maybeUpdateInputSettings(u.inputSettings);break;case"send-settings-updated":tt(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 W0:var Fo=u.session_id;this._rmpPlayerState[Fo]=u.playerState,this.emitDailyJSEvent(u);break;case J0:delete this._rmpPlayerState[u.session_id],this.emitDailyJSEvent(u);break;case q0:var jo=u.session_id,by=this._rmpPlayerState[jo];by&&this.compareEqualForRMPUpdateEvent(by,u.remoteMediaPlayerState)||(this._rmpPlayerState[jo]=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 D0:var Hx=this._meetingSessionState.topology!==(u.meetingSessionState&&u.meetingSessionState.topology);this._meetingSessionState=tc(u.meetingSessionState,this._callObjectMode),(this._callObjectMode||Hx)&&this.emitDailyJSEvent(u);break;case G0:this._isScreenSharing=!0,this.emitDailyJSEvent(u);break;case Q0:case Y0:this._isScreenSharing=!1,this.emitDailyJSEvent(u);break;case Eh:case Th:case B0:case U0:case z0:case $0:case F0:case j0:case w0:case S0:case V0:case K0:case"test-completed":case tw:case H0:case iw:case ow:case sw:case aw:case Ah:case lw: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,g){var p="record";u&&(g.local||g[p]!==!1||u[p]===g[p]||this.emitDailyJSEvent({action:Th}))}},{key:"maybeEventRecordingStarted",value:function(u,g){var p="record";u&&(g.local||g[p]!==!0||u[p]===g[p]||this.emitDailyJSEvent({action:Eh}))}},{key:"_trackStatePlayable",value:function(u){return!(!u||u.state!==u0)}},{key:"_trackChanged",value:function(u,g){return(u==null?void 0:u.id)!==(g==null?void 0:g.id)}},{key:"maybeEventTrackStopped",value:function(u,g,p){var x,_,A=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,P=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,$=A==null?void 0:A.track;if($){var B=this._trackStatePlayable(A),te=this._trackStatePlayable(P),ue=this._trackChanged($,P==null?void 0:P.track);B&&(te&&!ue||this.emitDailyJSEvent({action:N0,track:$,participant:p??g,type:u}))}}},{key:"maybeEventTrackStarted",value:function(u,g,p){var x,_,A=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,P=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,$=P==null?void 0:P.track;if($){var B=this._trackStatePlayable(A),te=this._trackStatePlayable(P),ue=this._trackChanged(A==null?void 0:A.track,$);te&&(B&&!ue||this.emitDailyJSEvent({action:R0,track:$,participant:p,type:u}))}}},{key:"maybeParticipantTracksStopped",value:function(u,g){if(u)for(var p in u.tracks)this.maybeEventTrackStopped(p,u,g)}},{key:"maybeParticipantTracksStarted",value:function(u,g){if(g)for(var p in g.tracks)this.maybeEventTrackStarted(p,u,g)}},{key:"compareEqualForRMPUpdateEvent",value:function(u,g){var p,x;return u.state===g.state&&((p=u.settings)===null||p===void 0?void 0:p.volume)===((x=g.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(g){console.log("could not emit",u,g)}}},{key:"compareEqualForParticipantUpdateEvent",value:function(u,g){return!!tt(u,g)&&(!u.videoTrack||!g.videoTrack||u.videoTrack.id===g.videoTrack.id&&u.videoTrack.muted===g.videoTrack.muted&&u.videoTrack.enabled===g.videoTrack.enabled)&&(!u.audioTrack||!g.audioTrack||u.audioTrack.id===g.audioTrack.id&&u.audioTrack.muted===g.audioTrack.muted&&u.audioTrack.enabled===g.audioTrack.enabled)}},{key:"nativeUtils",value:function(){return fe()?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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._isPreparingToJoin;if(u!==this._callState||g!==this._isPreparingToJoin){var p=this._callState,x=this._isPreparingToJoin;this._callState=u,this._isPreparingToJoin=g;var _=this._callState===wr;this.updateShowAndroidOngoingMeetingNotification(_);var A=_s(p,x),P=_s(this._callState,this._isPreparingToJoin);A!==P&&(this.updateKeepDeviceAwake(P),this.updateDeviceAudioMode(P),this.updateNoOpRecordingEnsuringBackgroundContinuity(P))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=vp,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:Rl},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=tc(mp,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=Nl,this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(u){fe()&&this.nativeUtils().setKeepDeviceAwake(u,this.callClientId)}},{key:"updateDeviceAudioMode",value:function(u){if(fe()&&!this.disableReactNativeAutoDeviceManagement("audio")){var g=u?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(g)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(u){if(fe()&&this.nativeUtils().setShowOngoingMeetingNotification){var g,p,x,_;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var A=this.properties.reactNativeConfig.androidInCallNotification;g=A.title,p=A.subtitle,x=A.iconName,_=A.disableForCustomOverride}_&&(u=!1),this.nativeUtils().setShowOngoingMeetingNotification(u,g,p,x,this.callClientId)}}},{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(u){fe()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(u)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var u;if(fe()){var g=(u=this._callMachine())===null||u===void 0||(u=u.store)===null||u===void 0?void 0:u.getState();for(var p in g==null?void 0:g.streams){var x=g.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 g=document.createElement("a");return g.href=u,g.href}}},{key:"sayHello",value:function(){var u="hello, world.";return console.log(u),u}},{key:"_logUseAfterDestroy",value:function(){var u=Object.values(kr)[0];if(this.needsLoad())if(u&&!u.needsLoad()){var g={action:vs,level:"error",code:this.strictMode?9995:9997};u.sendMessageToCallMachine(g)}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:vs,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(p,null,this.callClientId,this._iframe)}}},{key:"_logDuplicateInstanceAttempt",value:function(){for(var u=0,g=Object.values(kr);u<g.length;u++){var p=g[u];p._callMachineInitialized?(p.sendMessageToCallMachine({action:vs,level:"warn",code:this.allowMultipleCallInstances?9993:9992}),p._delayDuplicateInstanceLog=!1):p._delayDuplicateInstanceLog=!0}}},{key:"_maybeSendToSentry",value:function(u){var g,p,x,_;if(!((g=u.error)!==null&&g!==void 0&&g.type&&(![p0,h0,_h].includes(u.error.type)||u.error.type===_h&&u.error.msg.includes("deleted")))){var A=(p=this.properties)!==null&&p!==void 0&&p.url?new URL(this.properties.url):void 0,P="production";A&&A.host.includes(".staging.daily")&&(P="staging");var $,B,te,ue,lt,cn=function(Fo){const jo=[Ob(),Mb(),n0(),e0(),a0(),c0(),Ib(),l0()];return Fo.autoSessionTracking!==!1&&jo.push(s0()),jo}({}).filter(function(Fo){return!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(Fo.name)}),un=new zb({dsn:"https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844",transport:qb,stackParser:Zb,integrations:cn,environment:P}),Re=new $n;if(Re.setClient(un),un.init(),this.session_id&&Re.setExtra("sessionId",this.session_id),this.properties){var le=K({},this.properties);le.userName=le.userName?"[Filtered]":void 0,le.userData=le.userData?"[Filtered]":void 0,le.token=le.token?"[Filtered]":void 0,Re.setExtra("properties",le)}if(A){var Yt=A.searchParams.get("domain");if(!Yt){var $o=A.host.match(/(.*?)\./);Yt=$o&&$o[1]||""}Yt&&Re.setTag("domain",Yt)}u.error&&(Re.setTag("fatalErrorType",u.error.type),Re.setExtra("errorDetails",u.error.details),!(($=u.error.details)===null||$===void 0)&&$.uri&&Re.setTag("serverAddress",u.error.details.uri),!((B=u.error.details)===null||B===void 0)&&B.workerGroup&&Re.setTag("workerGroup",u.error.details.workerGroup),!((te=u.error.details)===null||te===void 0)&&te.geoGroup&&Re.setTag("geoGroup",u.error.details.geoGroup),!((ue=u.error.details)===null||ue===void 0)&&ue.on&&Re.setTag("connectionAttempt",u.error.details.on),(lt=u.error.details)!==null&<!==void 0&<.bundleUrl&&(Re.setTag("bundleUrl",u.error.details.bundleUrl),Re.setTag("bundleError",u.error.details.sourceError.type))),Re.setTags({callMode:this._callObjectMode?fe()?"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 Ha=((_=u.error)===null||_===void 0?void 0:_.msg)||u.errorMsg;Re.captureException(new Error(Ha))}}},{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(!tt(this._inputSettings,u)){var g=this._getInputSettings();this._inputSettings=u;var p=this._getInputSettings();tt(g,p)||this.emitDailyJSEvent({action:Mh,inputSettings:p})}}}],[{key:"supportedBrowser",value:function(){if(fe())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var u=Qy.getParser(Ot());return{supported:!!Ul(),mobile:u.getPlatformType()==="mobile",name:u.getBrowserName(),version:u.getBrowserVersion(),supportsFullscreen:!!$h(),supportsScreenShare:!!fw(),supportsSfu:!!Ul(),supportsVideoProcessing:Fh(),supportsAudioProcessing:jh()}}},{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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(he(),!u||!u.contentWindow||typeof u.src!="string")throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return g.layout||(g.customLayout?g.layout="custom-v1":g.layout="browser"),new t(u,g)}},{key:"createFrame",value:function(u,g){var p,x;he(),u&&g?(p=u,x=g):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 A=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?A.allow="microphone, camera":A.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",A.style.visibility="hidden",p.appendChild(A),A.style.visibility=null,Object.keys(_).forEach(function(P){return A.style[P]=_[P]}),x.layout||(x.customLayout?x.layout="custom-v1":x.layout="browser");try{return new t(A,x)}catch(P){throw p.removeChild(A),P}}},{key:"createTransparentFrame",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};he();var g=document.createElement("iframe");return g.allow="microphone; camera; autoplay",g.style.cssText=`
|
|
35
|
+
{ settings?: {state: "play"|"pause"} }`),_}return new Promise(function(_,A){g.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:p,settings:x},function(P){P.error?A({error:P.error,errorMsg:P.errorMsg}):_({session_id:P.session_id,remoteMediaPlayerState:{state:P.state,settings:P.settings}})})})}),function(u){return m.apply(this,arguments)})},{key:"startTranscription",value:function(u){xe(this._callState,"startTranscription()"),this.sendMessageToCallMachine(K({action:"daily-method-start-transcription"},u))}},{key:"updateTranscription",value:function(u){if(xe(this._callState,"updateTranscription()"),!u)throw new Error("updateTranscription Error: options is mandatory");if(pe(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(K({action:"daily-method-update-transcription"},u))}},{key:"stopTranscription",value:function(u){if(xe(this._callState,"stopTranscription()"),u&&pe(u)!=="object")throw new Error("stopTranscription Error: options must be object type");if(u&&!u.instanceId)throw new Error('"instanceId" not provided');this.sendMessageToCallMachine(K({action:"daily-method-stop-transcription"},u))}},{key:"startDialOut",value:(S=ee(function*(u){var g=this;xe(this._callState,"startDialOut()");var p=function(P){if(P){if(!Array.isArray(P))throw new Error("Error starting dial out: audio codec must be an array");if(P.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");P.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(P){if(P&&(p(P.audio),P.video)){if(!Array.isArray(P.video))throw new Error("Error starting dial out: video codec must be an array");if(P.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");P.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(kp(u),u.permissions&&u.permissions.canReceive){var x=Ge(dp.validateJSONObject(u.permissions.canReceive),2),_=x[0],A=x[1];if(!_)throw new Error(A)}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(P,$){g.sendMessageToCallMachine(K({action:"dialout-start"},u),function(B){B.error?$(B.error):P(B)})})}),function(u){return S.apply(this,arguments)})},{key:"stopDialOut",value:function(u){var g=this;return xe(this._callState,"stopDialOut()"),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:"dialout-stop"},u),function(_){_.error?x(_.error):p(_)})})}},{key:"sipCallTransfer",value:(v=ee(function*(u){var g=this;if(xe(this._callState,"sipCallTransfer()"),!u)throw new Error("sipCallTransfer() requires a sessionId and toEndPoint");return u.useSipRefer=!1,Lp(u,"sipCallTransfer"),kp(u),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:Nh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return v.apply(this,arguments)})},{key:"sipRefer",value:(y=ee(function*(u){var g=this;if(xe(this._callState,"sipRefer()"),!u)throw new Error("sessionId and toEndPoint are mandatory parameter");return u.useSipRefer=!0,Lp(u,"sipRefer"),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:Nh},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return y.apply(this,arguments)})},{key:"sendDTMF",value:(b=ee(function*(u){var g=this;return xe(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 A=/[^0-9A-D*#]/g,P=_.match(A);if(P&&P[0])throw new Error("".concat(P[0]," is not valid DTMF tone"))}(u),new Promise(function(p,x){g.sendMessageToCallMachine(K({action:"send-dtmf"},u),function(_){_.error?x(_.error):p(_)})})}),function(u){return b.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var u=this;return this._callState!==wr?Promise.resolve(K({stats:{latest:{}}},this._network)):new Promise(function(g){u.sendMessageToCallMachine({action:"get-calc-stats"},function(p){g(K(K({},u._network),{},{stats:p.stats}))})})}},{key:"testWebsocketConnectivity",value:(h=ee(function*(){var u=this;if(ec(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(g){return Promise.reject(g)}return new Promise(function(g,p){u.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(x){x.error?p(x.error):g(x.results)})})}),function(){return h.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(u){return u?u instanceof MediaStreamTrack?!!R0(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:(f=ee(function*(){var u=this;he(),zt(this._callObjectMode,"testCallQuality()"),Es(this._callMachineInitialized,"testCallQuality()",null,!0),Zl(this._callState,this._isPreparingToJoin,"testCallQuality()");var g=this._testCallAlreadyInProgress,p=function(_){g||(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(A){var P=A.results,$=P.result,B=Xd(P,F0);if($==="failed"){var te,ue=K({},B);(te=B.error)!==null&&te!==void 0&&te.details?(B.error.details=JSON.parse(B.error.details),ue.error=K(K({},ue.error),{},{details:K({},ue.error.details)}),ue.error.details.duringTest="testCallQuality"):(ue.error=ue.error?K({},ue.error):{},ue.error.details={duringTest:"testCallQuality"}),u._maybeSendToSentry(ue)}p(!1),_(K({result:$},B))})})}),function(){return f.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(d=ee(function*(u){var g;fe()?(console.warn("testConnectionQuality() is deprecated: use testPeerToPeerCallQuality() instead"),g=yield this.testPeerToPeerCallQuality(u)):(console.warn("testConnectionQuality() is deprecated: use testCallQuality() instead"),g=yield this.testCallQuality());var p={result:g.result,secondsElapsed:g.secondsElapsed};return g.data&&(p.data={maxRTT:g.data.maxRoundTripTime,packetLoss:g.data.avgRecvPacketLoss}),p}),function(u){return d.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(c=ee(function*(u){var g=this;if(ec(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(_,A){g.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:x},function(P){P.error?A(P.error):_(P.results)})})}),function(u){return c.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){fe()?(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=ee(function*(u){var g=this;if(ec(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){g.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(g){u._callState===wr?u.sendMessageToCallMachine({action:"get-cpu-load-stats"},function(p){g(p.cpuStats)}):g({cpuLoadState:void 0,cpuLoadStateReason:void 0,stats:{}})})}},{key:"_validateEncodingLayerHasValidProperties",value:function(u){var g;if(!(((g=Object.keys(u))===null||g===void 0?void 0:g.length)>0))throw new Error("Empty encoding is not allowed. At least one of these valid keys should be specified:"+Object.values(Yl))}},{key:"_validateVideoSendSettings",value:function(u,g){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 g=="string"){if(!p.includes(g))throw new Error(x)}else{if(pe(g)!=="object")throw new Error(x);if(!g.maxQuality&&!g.encodings&&g.allowAdaptiveLayers===void 0)throw new Error("Video send settings must contain at least maxQuality, allowAdaptiveLayers or encodings attribute");if(g.maxQuality&&["low","medium","high"].indexOf(g.maxQuality)===-1)throw new Error("maxQuality must be either low, medium or high");if(g.encodings){var _=!1;switch(Object.keys(g.encodings).length){case 1:_=!g.encodings.low;break;case 2:_=!g.encodings.low||!g.encodings.medium;break;case 3:_=!g.encodings.low||!g.encodings.medium||!g.encodings.high;break;default:_=!0}if(_)throw new Error("Encodings must be defined as: low, low and medium, or low, medium and high.");g.encodings.low&&this._validateEncodingLayerHasValidProperties(g.encodings.low),g.encodings.medium&&this._validateEncodingLayerHasValidProperties(g.encodings.medium),g.encodings.high&&this._validateEncodingLayerHasValidProperties(g.encodings.high)}}}},{key:"validateUpdateSendSettings",value:function(u){var g=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=Ge(p,2),_=x[0],A=x[1];g._validateVideoSendSettings(_,A)})}},{key:"updateSendSettings",value:function(u){var g=this;return this.validateUpdateSendSettings(u),this.needsLoad()?(this._preloadCache.sendSettings=u,{sendSettings:this._preloadCache.sendSettings}):new Promise(function(p,x){g.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 he(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(u){return he(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:u}),this}},{key:"activeSpeakerMode",value:function(){return he(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(u){return xe(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=ee(function*(){var u=this;if(this._callObjectMode){var g=yield navigator.mediaDevices.enumerateDevices();return Sr()==="Firefox"&&ws().major>115&&ws().major<123&&(g=g.filter(function(p){return p.kind!=="audiooutput"})),{devices:g.map(function(p){var x=JSON.parse(JSON.stringify(p));if(!fe()&&p.kind==="videoinput"&&p.getCapabilities){var _,A=p.getCapabilities();x.facing=(A==null||(_=A.facingMode)===null||_===void 0?void 0:_.length)>=1?A.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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"*";if(xe(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:g}),this}},{key:"addFakeParticipant",value:function(u){return he(),xe(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(K({action:"add-fake-participant"},u)),this}},{key:"setShowNamesMode",value:function(u){return yt(this._callObjectMode,"setShowNamesMode()"),he(),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 yt(this._callObjectMode,"setShowLocalVideo()"),he(),xe(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 yt(this._callObjectMode,"showLocalVideo()"),he(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var u=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return yt(this._callObjectMode,"setShowParticipantsBar()"),he(),xe(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 yt(this._callObjectMode,"showParticipantsBar()"),he(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return he(),yt(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(u){return he(),yt(this._callObjectMode,"setCustomIntegrations()"),xe(this._callState,"setCustomIntegrations()"),Dp(u)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:u}),this._customIntegrations=u,this):this}},{key:"startCustomIntegrations",value:function(u){var g=this;if(he(),yt(this._callObjectMode,"startCustomIntegrations()"),xe(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 g._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 g=this;if(he(),yt(this._callObjectMode,"stopCustomIntegrations()"),xe(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 g._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 yt(this._callObjectMode,"customTrayButtons()"),he(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(u){return yt(this._callObjectMode,"updateCustomTrayButtons()"),he(),xe(this._callState,"updateCustomTrayButtons()"),Op(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(xs))),this)}},{key:"theme",value:function(){return yt(this._callObjectMode,"theme()"),this.properties.theme}},{key:"setTheme",value:function(u){var g=this;return yt(this._callObjectMode,"setTheme()"),new Promise(function(p,x){try{g.validateProperties({theme:u}),g.properties.theme=K({},u),g.sendMessageToCallMachine({action:"set-theme",theme:g.properties.theme});try{g.emitDailyJSEvent({action:bw,theme:g.properties.theme})}catch(_){console.log("could not emit 'theme-updated'",_)}p(g.properties.theme)}catch(_){x(_)}})}},{key:"requestFullscreen",value:(s=ee(function*(){if(he(),this._iframe&&!document.fullscreenElement&&Fh())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(){he(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(o=ee(function*(){var u=this;return this._callObjectMode?(console.error("getSidebarView is not available in callObject mode"),Promise.resolve(null)):new Promise(function(g){u.sendMessageToCallMachine({action:"get-sidebar-view"},function(p){g(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=ee(function*(){var u=this,g=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,p=g===void 0||g;return this._accessState.access===Nl||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=ee(function*(){try{var u=yield fetch("https://gs.daily.co/_ks_/x-swsl/:");return{current:(yield u.json()).geo}}catch(g){return console.error("geo lookup failed",g),{current:""}}}),function(){return r.apply(this,arguments)})},{key:"setNetworkTopology",value:(n=ee(function*(u){var g=this;return he(),xe(this._callState,"setNetworkTopology()"),new Promise(function(p,x){g.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=ee(function*(){var u=this;return new Promise(function(g,p){u.needsLoad()&&g({topology:"none"}),u.sendMessageToCallMachine({action:"get-network-topology"},function(x){x.error?p({error:x.error}):g({topology:x.topology})})})}),function(){return e.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(u){if(he(),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,g){return Jo.prototype.on.call(this,u,g)}},{key:"once",value:function(u,g){return Jo.prototype.once.call(this,u,g)}},{key:"off",value:function(u,g){return Jo.prototype.off.call(this,u,g)}},{key:"validateProperties",value:function(u){var g,p;if(u!=null&&(g=u.dailyConfig)!==null&&g!==void 0&&g.userMediaAudioConstraints){var x,_;fe()||console.warn("userMediaAudioConstraints is deprecated. You can override constraints with inputSettings.audio.settings, found in DailyCallOptions.");var A=u.inputSettings||{};A.audio=((x=u.inputSettings)===null||x===void 0?void 0:x.audio)||{},A.audio.settings=((_=u.inputSettings)===null||_===void 0||(_=_.audio)===null||_===void 0?void 0:_.settings)||{},A.audio.settings=K(K({},A.audio.settings),u.dailyConfig.userMediaAudioConstraints),u.inputSettings=A,delete u.dailyConfig.userMediaAudioConstraints}if(u!=null&&(p=u.dailyConfig)!==null&&p!==void 0&&p.userMediaVideoConstraints){var P,$;fe()||console.warn("userMediaVideoConstraints is deprecated. You can override constraints with inputSettings.video.settings, found in DailyCallOptions.");var B=u.inputSettings||{};B.video=((P=u.inputSettings)===null||P===void 0?void 0:P.video)||{},B.video.settings=(($=u.inputSettings)===null||$===void 0||($=$.video)===null||$===void 0?void 0:$.settings)||{},B.video.settings=K(K({},B.video.settings),u.dailyConfig.userMediaVideoConstraints),u.inputSettings=B,delete u.dailyConfig.userMediaVideoConstraints}for(var te in u)if(xr[te]){if(xr[te].validate&&!xr[te].validate(u[te],this))throw new Error("property '".concat(te,"': ").concat(xr[te].help))}else console.warn("Ignoring unrecognized property '".concat(te,"'")),delete u[te]}},{key:"assembleMeetingUrl",value:function(){var u,g,p=K(K({},this.properties),{},{emb:this.callClientId,embHref:encodeURIComponent(window.location.href),proxy:(u=this.properties.dailyConfig)!==null&&u!==void 0&&u.proxyUrl?encodeURIComponent((g=this.properties.dailyConfig)===null||g===void 0?void 0:g.proxyUrl):void 0}),x=p.url.match(/\?/)?"&":"?";return p.url+x+Object.keys(xr).filter(function(_){return xr[_].queryString&&p[_]!==void 0}).map(function(_){return"".concat(xr[_].queryString,"=").concat(p[_])}).join("&")}},{key:"needsLoad",value:function(){return[kh,xh,Fn,jn].includes(this._callState)}},{key:"sendMessageToCallMachine",value:function(u,g){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");this._messageChannel.sendMessageToCallMachine(u,g,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 vw:this.sendMessageToCallMachine(K({action:yw},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var g={action:ys,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:Qo(this.properties.dailyConfig)}};this.sendMessageToCallMachine(g),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case Eh:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emitDailyJSEvent(u);break;case Cw:var p,x=K({},u);delete x.internal,this._maxAppMessageSize=((p=u.internal)===null||p===void 0?void 0:p._maxAppMessageSize)||$l,this._joinedCallback&&(this._joinedCallback(u.participants),this._joinedCallback=null),this.emitDailyJSEvent(x);break;case Tw:case Mw:if(this._callState===Fn)return;if(u.participant&&u.participant.session_id){var _=u.participant.local?"local":u.participant.session_id;if(this._callObjectMode){var A=this._callMachine().store;tp(u.participant,A),np(u.participant,A),rp(u.participant,this._participants[_],A)}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(Zx){console.error("track events error",Zx)}this.compareEqualForParticipantUpdateEvent(u.participant,this._participants[_])||(this._participants[_]=K({},u.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus(),this.emitDailyJSEvent(u))}break;case Aw:if(u.participant&&u.participant.session_id){var P=this._participants[u.participant.session_id];P&&this.maybeParticipantTracksStopped(P,null),delete this._participants[u.participant.session_id],this.emitDailyJSEvent(u)}break;case Ow:tt(this._participantCounts,u.participantCounts)||(this._participantCounts=u.participantCounts,this.emitDailyJSEvent(u));break;case Dw:var $={access:u.access};u.awaitingAccess&&($.awaitingAccess=u.awaitingAccess),tt(this._accessState,$)||(this._accessState=$,this.emitDailyJSEvent(u));break;case Pw:if(u.meetingSession){this._meetingSessionSummary=u.meetingSession,this.emitDailyJSEvent(u);var B=K(K({},u),{},{action:"meeting-session-updated"});this.emitDailyJSEvent(B)}break;case Dh:var te;this._iframe&&!u.preserveIframe&&(this._iframe.src=""),this._updateCallState(jn),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(u.errorMsg),this._loadedCallback=null),u.preserveIframe;var ue=Xd(u,j0);ue!=null&&(te=ue.error)!==null&&te!==void 0&&te.details&&(ue.error.details=JSON.parse(ue.error.details)),this._maybeSendToSentry(u),this._joinedCallback&&(this._joinedCallback(null,ue),this._joinedCallback=null),this.emitDailyJSEvent(ue);break;case Ew:this._callState!==jn&&this._updateCallState(Fn),this.resetMeetingDependentVars(),this._resolveLeave&&(this._resolveLeave(),this._resolveLeave=null),this.emitDailyJSEvent(u);break;case"selected-devices-updated":u.devices&&this.emitDailyJSEvent(u);break;case n0:var lt=u.state,cn=u.threshold,un=u.quality,Re=lt.state,le=lt.reasons;Re===this._network.networkState&&tt(le,this._network.networkStateReasons)&&cn===this._network.threshold&&un===this._network.quality||(this._network.networkState=Re,this._network.networkStateReasons=le,this._network.quality=un,this._network.threshold=cn,u.networkState=Re,le.length&&(u.networkStateReasons=le),delete u.state,this.emitDailyJSEvent(u));break;case i0:u&&u.cpuLoadState&&this.emitDailyJSEvent(u);break;case o0:u&&u.faceCounts!==void 0&&this.emitDailyJSEvent(u);break;case e0:var Yt=u.activeSpeaker;this._activeSpeaker.peerId!==Yt.peerId&&(this._activeSpeaker.peerId=Yt.peerId,this.emitDailyJSEvent({action:u.action,activeSpeaker:this._activeSpeaker}));break;case"show-local-video-changed":if(this._callObjectMode)return;var Fo=u.show;this._showLocalVideo=Fo,this.emitDailyJSEvent({action:u.action,show:Fo});break;case t0:var Va=u.enabled;this._activeSpeakerMode!==Va&&(this._activeSpeakerMode=Va,this.emitDailyJSEvent({action:u.action,enabled:this._activeSpeakerMode}));break;case Iw:case Rw:case Nw:this._waitingParticipants=u.allWaitingParticipants,this.emitDailyJSEvent({action:u.action,participant:u.participant});break;case d0:tt(this._receiveSettings,u.receiveSettings)||(this._receiveSettings=u.receiveSettings,this.emitDailyJSEvent({action:u.action,receiveSettings:u.receiveSettings}));break;case Ah:this._maybeUpdateInputSettings(u.inputSettings);break;case"send-settings-updated":tt(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 Jw:var jo=u.session_id;this._rmpPlayerState[jo]=u.playerState,this.emitDailyJSEvent(u);break;case Qw:delete this._rmpPlayerState[u.session_id],this.emitDailyJSEvent(u);break;case Gw:var Bo=u.session_id,Sy=this._rmpPlayerState[Bo];Sy&&this.compareEqualForRMPUpdateEvent(Sy,u.remoteMediaPlayerState)||(this._rmpPlayerState[Bo]=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 Lw:var Xx=this._meetingSessionState.topology!==(u.meetingSessionState&&u.meetingSessionState.topology);this._meetingSessionState=nc(u.meetingSessionState,this._callObjectMode),(this._callObjectMode||Xx)&&this.emitDailyJSEvent(u);break;case Yw:this._isScreenSharing=!0,this.emitDailyJSEvent(u);break;case Xw:case Zw:this._isScreenSharing=!1,this.emitDailyJSEvent(u);break;case Th:case Mh:case zw:case Hw:case Vw:case jw:case Bw:case Uw:case kw:case xw:case Ww:case qw:case"test-completed":case r0:case Kw:case s0:case a0:case l0:case c0:case Oh:case u0: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,g){var p="record";u&&(g.local||g[p]!==!1||u[p]===g[p]||this.emitDailyJSEvent({action:Mh}))}},{key:"maybeEventRecordingStarted",value:function(u,g){var p="record";u&&(g.local||g[p]!==!0||u[p]===g[p]||this.emitDailyJSEvent({action:Th}))}},{key:"_trackStatePlayable",value:function(u){return!(!u||u.state!==fw)}},{key:"_trackChanged",value:function(u,g){return(u==null?void 0:u.id)!==(g==null?void 0:g.id)}},{key:"maybeEventTrackStopped",value:function(u,g,p){var x,_,A=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,P=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,$=A==null?void 0:A.track;if($){var B=this._trackStatePlayable(A),te=this._trackStatePlayable(P),ue=this._trackChanged($,P==null?void 0:P.track);B&&(te&&!ue||this.emitDailyJSEvent({action:Fw,track:$,participant:p??g,type:u}))}}},{key:"maybeEventTrackStarted",value:function(u,g,p){var x,_,A=(x=g==null?void 0:g.tracks[u])!==null&&x!==void 0?x:null,P=(_=p==null?void 0:p.tracks[u])!==null&&_!==void 0?_:null,$=P==null?void 0:P.track;if($){var B=this._trackStatePlayable(A),te=this._trackStatePlayable(P),ue=this._trackChanged(A==null?void 0:A.track,$);te&&(B&&!ue||this.emitDailyJSEvent({action:$w,track:$,participant:p,type:u}))}}},{key:"maybeParticipantTracksStopped",value:function(u,g){if(u)for(var p in u.tracks)this.maybeEventTrackStopped(p,u,g)}},{key:"maybeParticipantTracksStarted",value:function(u,g){if(g)for(var p in g.tracks)this.maybeEventTrackStarted(p,u,g)}},{key:"compareEqualForRMPUpdateEvent",value:function(u,g){var p,x;return u.state===g.state&&((p=u.settings)===null||p===void 0?void 0:p.volume)===((x=g.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(g){console.log("could not emit",u,g)}}},{key:"compareEqualForParticipantUpdateEvent",value:function(u,g){return!!tt(u,g)&&(!u.videoTrack||!g.videoTrack||u.videoTrack.id===g.videoTrack.id&&u.videoTrack.muted===g.videoTrack.muted&&u.videoTrack.enabled===g.videoTrack.enabled)&&(!u.audioTrack||!g.audioTrack||u.audioTrack.id===g.audioTrack.id&&u.audioTrack.muted===g.audioTrack.muted&&u.audioTrack.enabled===g.audioTrack.enabled)}},{key:"nativeUtils",value:function(){return fe()?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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._isPreparingToJoin;if(u!==this._callState||g!==this._isPreparingToJoin){var p=this._callState,x=this._isPreparingToJoin;this._callState=u,this._isPreparingToJoin=g;var _=this._callState===wr;this.updateShowAndroidOngoingMeetingNotification(_);var A=Cs(p,x),P=Cs(this._callState,this._isPreparingToJoin);A!==P&&(this.updateKeepDeviceAwake(P),this.updateDeviceAudioMode(P),this.updateNoOpRecordingEnsuringBackgroundContinuity(P))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=yp,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:Nl},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=nc(vp,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=$l,this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(u){fe()&&this.nativeUtils().setKeepDeviceAwake(u,this.callClientId)}},{key:"updateDeviceAudioMode",value:function(u){if(fe()&&!this.disableReactNativeAutoDeviceManagement("audio")){var g=u?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(g)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(u){if(fe()&&this.nativeUtils().setShowOngoingMeetingNotification){var g,p,x,_;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var A=this.properties.reactNativeConfig.androidInCallNotification;g=A.title,p=A.subtitle,x=A.iconName,_=A.disableForCustomOverride}_&&(u=!1),this.nativeUtils().setShowOngoingMeetingNotification(u,g,p,x,this.callClientId)}}},{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(u){fe()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(u)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var u;if(fe()){var g=(u=this._callMachine())===null||u===void 0||(u=u.store)===null||u===void 0?void 0:u.getState();for(var p in g==null?void 0:g.streams){var x=g.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 g=document.createElement("a");return g.href=u,g.href}}},{key:"sayHello",value:function(){var u="hello, world.";return console.log(u),u}},{key:"_logUseAfterDestroy",value:function(){var u=Object.values(kr)[0];if(this.needsLoad())if(u&&!u.needsLoad()){var g={action:ys,level:"error",code:this.strictMode?9995:9997};u.sendMessageToCallMachine(g)}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:ys,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(p,null,this.callClientId,this._iframe)}}},{key:"_logDuplicateInstanceAttempt",value:function(){for(var u=0,g=Object.values(kr);u<g.length;u++){var p=g[u];p._callMachineInitialized?(p.sendMessageToCallMachine({action:ys,level:"warn",code:this.allowMultipleCallInstances?9993:9992}),p._delayDuplicateInstanceLog=!1):p._delayDuplicateInstanceLog=!0}}},{key:"_maybeSendToSentry",value:function(u){var g,p,x,_;if(!((g=u.error)!==null&&g!==void 0&&g.type&&(![mw,gw,Ch].includes(u.error.type)||u.error.type===Ch&&u.error.msg.includes("deleted")))){var A=(p=this.properties)!==null&&p!==void 0&&p.url?new URL(this.properties.url):void 0,P="production";A&&A.host.includes(".staging.daily")&&(P="staging");var $,B,te,ue,lt,cn=function(jo){const Bo=[Pb(),Ob(),iw(),nw(),cw(),dw(),Nb(),uw()];return jo.autoSessionTracking!==!1&&Bo.push(lw()),Bo}({}).filter(function(jo){return!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(jo.name)}),un=new Vb({dsn:"https://f10f1c81e5d44a4098416c0867a8b740@o77906.ingest.sentry.io/168844",transport:Gb,stackParser:tw,integrations:cn,environment:P}),Re=new $n;if(Re.setClient(un),un.init(),this.session_id&&Re.setExtra("sessionId",this.session_id),this.properties){var le=K({},this.properties);le.userName=le.userName?"[Filtered]":void 0,le.userData=le.userData?"[Filtered]":void 0,le.token=le.token?"[Filtered]":void 0,Re.setExtra("properties",le)}if(A){var Yt=A.searchParams.get("domain");if(!Yt){var Fo=A.host.match(/(.*?)\./);Yt=Fo&&Fo[1]||""}Yt&&Re.setTag("domain",Yt)}u.error&&(Re.setTag("fatalErrorType",u.error.type),Re.setExtra("errorDetails",u.error.details),!(($=u.error.details)===null||$===void 0)&&$.uri&&Re.setTag("serverAddress",u.error.details.uri),!((B=u.error.details)===null||B===void 0)&&B.workerGroup&&Re.setTag("workerGroup",u.error.details.workerGroup),!((te=u.error.details)===null||te===void 0)&&te.geoGroup&&Re.setTag("geoGroup",u.error.details.geoGroup),!((ue=u.error.details)===null||ue===void 0)&&ue.on&&Re.setTag("connectionAttempt",u.error.details.on),(lt=u.error.details)!==null&<!==void 0&<.bundleUrl&&(Re.setTag("bundleUrl",u.error.details.bundleUrl),Re.setTag("bundleError",u.error.details.sourceError.type))),Re.setTags({callMode:this._callObjectMode?fe()?"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 Va=((_=u.error)===null||_===void 0?void 0:_.msg)||u.errorMsg;Re.captureException(new Error(Va))}}},{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(!tt(this._inputSettings,u)){var g=this._getInputSettings();this._inputSettings=u;var p=this._getInputSettings();tt(g,p)||this.emitDailyJSEvent({action:Ah,inputSettings:p})}}}],[{key:"supportedBrowser",value:function(){if(fe())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var u=Xy.getParser(Ot());return{supported:!!zl(),mobile:u.getPlatformType()==="mobile",name:u.getBrowserName(),version:u.getBrowserVersion(),supportsFullscreen:!!Fh(),supportsScreenShare:!!p0(),supportsSfu:!!zl(),supportsVideoProcessing:jh(),supportsAudioProcessing:Bh()}}},{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 g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(he(),!u||!u.contentWindow||typeof u.src!="string")throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return g.layout||(g.customLayout?g.layout="custom-v1":g.layout="browser"),new t(u,g)}},{key:"createFrame",value:function(u,g){var p,x;he(),u&&g?(p=u,x=g):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 A=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?A.allow="microphone, camera":A.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",A.style.visibility="hidden",p.appendChild(A),A.style.visibility=null,Object.keys(_).forEach(function(P){return A.style[P]=_[P]}),x.layout||(x.customLayout?x.layout="custom-v1":x.layout="browser");try{return new t(A,x)}catch(P){throw p.removeChild(A),P}}},{key:"createTransparentFrame",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};he();var g=document.createElement("iframe");return g.allow="microphone; camera; autoplay",g.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(g),u.layout||(u.layout="custom-v1"),t.wrap(g,u)}},{key:"getCallInstance",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return u?kr[u]:Object.values(kr)[0]}}]);var e,n,r,i,o,s,a,l,c,d,f,h,b,y,m,S,v,w,k,C,M,O,D,F,J,W,U,V,q,ie,H,G,ne,R,j,Q,ae,ve}();function Sp(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 Zr(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]=vn;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 xe(t){var e=arguments.length>2?arguments[2]:void 0;if(t!==wr){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 _s(t,e){return[Il,wr].includes(t)||e}function Xl(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(_s(t,e)){var i="".concat(n," not supported after joining a meeting.");throw r&&(i+=" ".concat(r)),console.error(i),new Error(i)}}function Cs(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 Zl(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 zt(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 yt(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 he(){if(fe())throw new Error("This daily-js method is not currently supported in React Native")}function Vi(){if(!fe())throw new Error("This daily-js method is only supported in React Native")}function kp(t){if(t===void 0)return!0;var e;if(typeof t=="string")e=t;else try{e=JSON.stringify(t),tt(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 xp(t,e){for(var n=e.allowAllParticipantsKey,r=function(f){var h=["local"];return n||h.push("*"),f&&!h.includes(f)},i=function(f){return!!(f.layer===void 0||Number.isInteger(f.layer)&&f.layer>=0||f.layer==="inherit")},o=function(f){return!!f&&!(f.video&&!i(f.video))&&!(f.screenVideo&&!i(f.screenVideo))},s=0,a=Object.entries(t);s<a.length;s++){var l=Ge(a[s],2),c=l[0],d=l[1];if(!r(c)||!o(d))return!1}return!0}function _p(t){if(pe(t)!=="object")return!1;for(var e=0,n=Object.entries(t);e<n.length;e++){var r=Ge(n[e],2),i=r[0],o=r[1];switch(i){case"video":if(pe(o)!=="object")return!1;for(var s=0,a=Object.entries(o);s<a.length;s++){var l=Ge(a[s],2),c=l[0],d=l[1];switch(c){case"processor":if(!Uw(d))return!1;break;case"settings":if(!Ep(d))return!1;break;default:return!1}}break;case"audio":if(pe(o)!=="object")return!1;for(var f=0,h=Object.entries(o);f<h.length;f++){var b=Ge(h[f],2),y=b[0],m=b[1];switch(y){case"processor":if(!Bw(m))return!1;break;case"settings":if(!Ep(m))return!1;break;default:return!1}}break;default:return!1}}return!0}function Cp(t,e,n){var r,i=[];t.video&&t.video.processor&&(Fh((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&&(jh()||(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:vn}):delete n.audioTrack),t.video&&t.video.settings&&(t.video.settings.customTrack?(n.videoTrack=t.video.settings.customTrack,t.video.settings={customTrack:vn}):delete n.videoTrack)}function Bw(t){if(fe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type"];return!!t&&pe(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(Ih).includes(n)?!0:(console.error("inputSettings audio processor type invalid"),!1)}(t.type))}function Uw(t){if(fe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type","config"];return!t||pe(t)!=="object"||!function(n){return typeof n!="string"?!1:Object.values(ys).includes(n)?!0:(console.error("inputSettings video processor type invalid"),!1)}(t.type)||t.config&&(pe(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 ys.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 ys.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(Qo(s.source))return s.type="url",!!function(c){var d=new URL(c),f=d.pathname;if(d.protocol==="data:")try{var h=f.substring(f.indexOf(":")+1,f.indexOf(";")).split("/")[1];return jl.includes(h)}catch(y){return console.error("failed to deduce blob content type",y),!1}var b=f.split(".").at(-1).toLowerCase().trim();return jl.includes(b)}(s.source)||(console.error("invalid image type; supported types: [".concat(jl.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 Ep(t){return pe(t)==="object"&&(!t.customTrack||t.customTrack instanceof MediaStreamTrack)}function ec(){var t=Object.values(ys).join(" | "),e=Object.values(Ih).join(" | ");return"inputSettings must be of the form: { video?: { processor?: { type: [ ".concat(t," ], config?: {} } }, audio?: { processor: {type: [ ").concat(e," ] } } }")}function Tp(t){var e=t.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(f0).concat(e?' | "'.concat("*",'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function Mp(){return"customIntegrations should be an object of type ".concat(JSON.stringify(Yl),".")}function Ap(t){if(t&&pe(t)!=="object"||Array.isArray(t))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(ks),".")),!1;if(t)for(var e=0,n=Object.entries(t);e<n.length;e++)for(var r=Ge(n[e],1)[0],i=0,o=Object.entries(t[r]);i<o.length;i++){var s=Ge(o[i],2),a=s[0],l=s[1],c=ks.id[a];if(!c)return console.error("customTrayButton does not support key ".concat(a)),!1;switch(a){case"iconPath":case"iconPathDarkMode":if(!Qo(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(pe(l)!==c)return console.error("customTrayButton ".concat(a," should be a ").concat(c,".")),!1}}return!0}function Op(t){if(!t||t&&pe(t)!=="object"||Array.isArray(t))return console.error(Mp()),!1;for(var e=function(f){return"".concat(f," should be ").concat(Yl.id[f])},n=function(f,h){return console.error("customIntegration ".concat(f,": ").concat(h))},r=0,i=Object.entries(t);r<i.length;r++){var o=Ge(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=Ge(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(!Qo(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(!Qo(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(f){return typeof f!="string"})))return n(o,e(c)),!1;break;case"shared":if((!Array.isArray(d)||d.some(function(f){return typeof f!="string"}))&&d!=="owners"&&typeof d!="boolean")return n(o,e(c)),!1;break;default:if(!Yl.id[c])return console.error("customIntegration does not support key ".concat(c)),!1}}}return!0}function Dp(t,e){if(e===void 0)return!1;switch(pe(e)){case"string":return pe(t)===e;case"object":if(pe(t)!=="object")return!1;for(var n in t)if(!Dp(t[n],e[n]))return!1;return!0;default:return!1}}function Pp(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 Lp(t){if(pe(t)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(t.state&&!Object.values(Fl).includes(t.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify(Fl));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 Ip(t,e,n){return!(typeof t!="number"||t<e||t>n)}function tc(t,e){return t&&!e&&delete t.data,t}function zw(t){return t&&t.__esModule?t.default:t}function Rp(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var Np={};Rp(Np,"DailyRTVIMessageType",()=>rc),Rp(Np,"DailyTransport",()=>yn);class Ht{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=Ht;const $p=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],Hw=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Un=[],nc=[];for(let t=1;t<=8;t++)for(let e=0;e<$p.length;e++){const n=$p[e];Un.push(n/Math.pow(2,8-t)),nc.push(Hw[e]+t)}const Es=[32,2e3],Fp=Un.filter((t,e)=>Un[e]>Es[0]&&Un[e]<Es[1]),Vw=nc.filter((t,e)=>Un[e]>Es[0]&&Un[e]<Es[1]);class ei{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,f;if(i==="music"||i==="voice"){const y=i==="voice"?Fp:Un,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"?Fp:Un,f=i==="voice"?Vw:nc}else c=Array.from(r),d=c.map((y,m)=>l*m),f=d.map(y=>`${y.toFixed(2)} Hz`);const h=c.map(y=>Math.max(0,Math.min((y-o)/(s-o),1)));return{values:new Float32Array(h),frequencies:d,labels:f}}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=f=>{const h=l*f;h<c&&o.suspend(h).then(()=>{const b=new Float32Array(a.frequencyBinCount);a.getFloatFrequencyData(b),this.fftResults.push(b),d(f+1)}),f===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 ei.getFrequencies(this.analyser,this.sampleRate,i,e,n,r)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}}globalThis.AudioAnalysis=ei;const Kw=`
|
|
43
|
+
`,document.body.appendChild(g),u.layout||(u.layout="custom-v1"),t.wrap(g,u)}},{key:"getCallInstance",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return u?kr[u]:Object.values(kr)[0]}}]);var e,n,r,i,o,s,a,l,c,d,f,h,b,y,v,S,m,w,k,C,M,O,D,F,J,W,U,V,q,ie,H,G,ne,R,j,Q,ae,ve}();function kp(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 Zr(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]=vn;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 xe(t){var e=arguments.length>2?arguments[2]:void 0;if(t!==wr){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 Cs(t,e){return[Rl,wr].includes(t)||e}function Zl(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(Cs(t,e)){var i="".concat(n," not supported after joining a meeting.");throw r&&(i+=" ".concat(r)),console.error(i),new Error(i)}}function Es(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 ec(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 zt(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 yt(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 he(){if(fe())throw new Error("This daily-js method is not currently supported in React Native")}function Vi(){if(!fe())throw new Error("This daily-js method is only supported in React Native")}function xp(t){if(t===void 0)return!0;var e;if(typeof t=="string")e=t;else try{e=JSON.stringify(t),tt(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 _p(t,e){for(var n=e.allowAllParticipantsKey,r=function(f){var h=["local"];return n||h.push("*"),f&&!h.includes(f)},i=function(f){return!!(f.layer===void 0||Number.isInteger(f.layer)&&f.layer>=0||f.layer==="inherit")},o=function(f){return!!f&&!(f.video&&!i(f.video))&&!(f.screenVideo&&!i(f.screenVideo))},s=0,a=Object.entries(t);s<a.length;s++){var l=Ge(a[s],2),c=l[0],d=l[1];if(!r(c)||!o(d))return!1}return!0}function Cp(t){if(pe(t)!=="object")return!1;for(var e=0,n=Object.entries(t);e<n.length;e++){var r=Ge(n[e],2),i=r[0],o=r[1];switch(i){case"video":if(pe(o)!=="object")return!1;for(var s=0,a=Object.entries(o);s<a.length;s++){var l=Ge(a[s],2),c=l[0],d=l[1];switch(c){case"processor":if(!H0(d))return!1;break;case"settings":if(!Tp(d))return!1;break;default:return!1}}break;case"audio":if(pe(o)!=="object")return!1;for(var f=0,h=Object.entries(o);f<h.length;f++){var b=Ge(h[f],2),y=b[0],v=b[1];switch(y){case"processor":if(!z0(v))return!1;break;case"settings":if(!Tp(v))return!1;break;default:return!1}}break;default:return!1}}return!0}function Ep(t,e,n){var r,i=[];t.video&&t.video.processor&&(jh((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&&(Bh()||(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:vn}):delete n.audioTrack),t.video&&t.video.settings&&(t.video.settings.customTrack?(n.videoTrack=t.video.settings.customTrack,t.video.settings={customTrack:vn}):delete n.videoTrack)}function z0(t){if(fe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type"];return!!t&&pe(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(Rh).includes(n)?!0:(console.error("inputSettings audio processor type invalid"),!1)}(t.type))}function H0(t){if(fe())return console.warn("Video processing is not yet supported in React Native"),!1;var e=["type","config"];return!t||pe(t)!=="object"||!function(n){return typeof n!="string"?!1:Object.values(bs).includes(n)?!0:(console.error("inputSettings video processor type invalid"),!1)}(t.type)||t.config&&(pe(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 bs.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 bs.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(Yo(s.source))return s.type="url",!!function(c){var d=new URL(c),f=d.pathname;if(d.protocol==="data:")try{var h=f.substring(f.indexOf(":")+1,f.indexOf(";")).split("/")[1];return Bl.includes(h)}catch(y){return console.error("failed to deduce blob content type",y),!1}var b=f.split(".").at(-1).toLowerCase().trim();return Bl.includes(b)}(s.source)||(console.error("invalid image type; supported types: [".concat(Bl.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 Tp(t){return pe(t)==="object"&&(!t.customTrack||t.customTrack instanceof MediaStreamTrack)}function tc(){var t=Object.values(bs).join(" | "),e=Object.values(Rh).join(" | ");return"inputSettings must be of the form: { video?: { processor?: { type: [ ".concat(t," ], config?: {} } }, audio?: { processor: {type: [ ").concat(e," ] } } }")}function Mp(t){var e=t.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(pw).concat(e?' | "'.concat("*",'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function Ap(){return"customIntegrations should be an object of type ".concat(JSON.stringify(Xl),".")}function Op(t){if(t&&pe(t)!=="object"||Array.isArray(t))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(xs),".")),!1;if(t)for(var e=0,n=Object.entries(t);e<n.length;e++)for(var r=Ge(n[e],1)[0],i=0,o=Object.entries(t[r]);i<o.length;i++){var s=Ge(o[i],2),a=s[0],l=s[1],c=xs.id[a];if(!c)return console.error("customTrayButton does not support key ".concat(a)),!1;switch(a){case"iconPath":case"iconPathDarkMode":if(!Yo(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(pe(l)!==c)return console.error("customTrayButton ".concat(a," should be a ").concat(c,".")),!1}}return!0}function Dp(t){if(!t||t&&pe(t)!=="object"||Array.isArray(t))return console.error(Ap()),!1;for(var e=function(f){return"".concat(f," should be ").concat(Xl.id[f])},n=function(f,h){return console.error("customIntegration ".concat(f,": ").concat(h))},r=0,i=Object.entries(t);r<i.length;r++){var o=Ge(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=Ge(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(!Yo(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(!Yo(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(f){return typeof f!="string"})))return n(o,e(c)),!1;break;case"shared":if((!Array.isArray(d)||d.some(function(f){return typeof f!="string"}))&&d!=="owners"&&typeof d!="boolean")return n(o,e(c)),!1;break;default:if(!Xl.id[c])return console.error("customIntegration does not support key ".concat(c)),!1}}}return!0}function Pp(t,e){if(e===void 0)return!1;switch(pe(e)){case"string":return pe(t)===e;case"object":if(pe(t)!=="object")return!1;for(var n in t)if(!Pp(t[n],e[n]))return!1;return!0;default:return!1}}function Lp(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 Ip(t){if(pe(t)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(t.state&&!Object.values(jl).includes(t.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify(jl));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 Rp(t,e,n){return!(typeof t!="number"||t<e||t>n)}function nc(t,e){return t&&!e&&delete t.data,t}function V0(t){return t&&t.__esModule?t.default:t}function Np(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var $p={};Np($p,"DailyRTVIMessageType",()=>ic),Np($p,"DailyTransport",()=>yn);class Ht{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=Ht;const Fp=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],K0=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Un=[],rc=[];for(let t=1;t<=8;t++)for(let e=0;e<Fp.length;e++){const n=Fp[e];Un.push(n/Math.pow(2,8-t)),rc.push(K0[e]+t)}const Ts=[32,2e3],jp=Un.filter((t,e)=>Un[e]>Ts[0]&&Un[e]<Ts[1]),W0=rc.filter((t,e)=>Un[e]>Ts[0]&&Un[e]<Ts[1]);class ei{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,f;if(i==="music"||i==="voice"){const y=i==="voice"?jp:Un,v=Array(y.length).fill(o);for(let S=0;S<r.length;S++){const m=S*l,w=r[S];for(let k=y.length-1;k>=0;k--)if(m>y[k]){v[k]=Math.max(v[k],w);break}}c=v,d=i==="voice"?jp:Un,f=i==="voice"?W0:rc}else c=Array.from(r),d=c.map((y,v)=>l*v),f=d.map(y=>`${y.toFixed(2)} Hz`);const h=c.map(y=>Math.max(0,Math.min((y-o)/(s-o),1)));return{values:new Float32Array(h),frequencies:d,labels:f}}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=f=>{const h=l*f;h<c&&o.suspend(h).then(()=>{const b=new Float32Array(a.frequencyBinCount);a.getFloatFrequencyData(b),this.fftResults.push(b),d(f+1)}),f===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 ei.getFrequencies(this.analyser,this.sampleRate,i,e,n,r)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}}globalThis.AudioAnalysis=ei;const q0=`
|
|
44
44
|
class StreamProcessor extends AudioWorkletProcessor {
|
|
45
45
|
constructor() {
|
|
46
46
|
super();
|
|
@@ -129,7 +129,7 @@ class StreamProcessor extends AudioWorkletProcessor {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
registerProcessor('stream_processor', StreamProcessor);
|
|
132
|
-
`,
|
|
132
|
+
`,J0=new Blob([q0],{type:"application/javascript"}),G0=URL.createObjectURL(J0);class Q0{constructor({sampleRate:e=44100}={}){this.scriptSrc=G0,this.sampleRate=e,this.context=null,this.stream=null,this.analyser=null,this.trackSampleOffsets={},this.interruptedTrackIds={}}async connect(){this.context=new AudioContext({sampleRate:this.sampleRate}),this._speakerID&&this.context.setSinkId(this._speakerID),this.context.state==="suspended"&&await this.context.resume();try{await this.context.audioWorklet.addModule(this.scriptSrc)}catch(n){throw console.error(n),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}const e=this.context.createAnalyser();return e.fftSize=8192,e.smoothingTimeConstant=.1,this.analyser=e,!0}getFrequencies(e="frequency",n=-100,r=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return ei.getFrequencies(this.analyser,this.sampleRate,null,e,n,r)}async updateSpeaker(e){const n=this._speakerID;if(this._speakerID=e,this.context)try{e==="default"?await this.context.setSinkId():await this.context.setSinkId(e)}catch(r){console.error(`Could not set sinkId to ${e}: ${r}`),this._speakerID=n}}_start(){const e=new AudioWorkletNode(this.context,"stream_processor");return e.connect(this.context.destination),e.port.onmessage=n=>{const{event:r}=n.data;if(r==="stop")e.disconnect(),this.stream=null;else if(r==="offset"){const{requestId:i,trackId:o,offset:s}=n.data,a=s/this.sampleRate;this.trackSampleOffsets[i]={trackId:o,offset:s,currentTime:a}}},this.analyser.disconnect(),e.connect(this.analyser),this.stream=e,!0}add16BitPCM(e,n="default"){if(typeof n!="string")throw new Error("trackId must be a string");if(this.interruptedTrackIds[n])return;this.stream||this._start();let r;if(e instanceof Int16Array)r=e;else if(e instanceof ArrayBuffer)r=new Int16Array(e);else throw new Error("argument must be Int16Array or ArrayBuffer");return this.stream.port.postMessage({event:"write",buffer:r,trackId:n}),r}async getTrackSampleOffset(e=!1){if(!this.stream)return null;const n=crypto.randomUUID();this.stream.port.postMessage({event:e?"interrupt":"offset",requestId:n});let r;for(;!r;)r=this.trackSampleOffsets[n],await new Promise(o=>setTimeout(()=>o(),1));const{trackId:i}=r;return e&&i&&(this.interruptedTrackIds[i]=!0),r}async interrupt(){return this.getTrackSampleOffset(!0)}}globalThis.WavStreamPlayer=Q0;const Y0=`
|
|
133
133
|
class AudioProcessor extends AudioWorkletProcessor {
|
|
134
134
|
|
|
135
135
|
constructor() {
|
|
@@ -336,11 +336,11 @@ class AudioProcessor extends AudioWorkletProcessor {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
registerProcessor('audio_processor', AudioProcessor);
|
|
339
|
-
`,
|
|
339
|
+
`,X0=new Blob([Y0],{type:"application/javascript"}),Bp=URL.createObjectURL(X0);class Z0{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Bp,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,f;if(e instanceof Int16Array){f=e,d=new Float32Array(e.length);for(let v=0;v<e.length;v++)d[v]=e[v]/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)');f||(f=Ht.floatTo16BitPCM(d));const h={bitsPerSample:16,channels:[d],data:f};s=new Ht().pack(r,h).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:f}=l.data;if(c==="receipt")this.eventReceipts[d]=f;else if(c==="chunk")if(this._chunkProcessorSize){const h=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Ht.mergeBuffers(h.raw,f.raw),mono:Ht.mergeBuffers(h.mono,f.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(f)};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 ei.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 Ht().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 Ht().pack(this.sampleRate,r.audio)}async quit(){return this.listenForDeviceChange(null),this.deviceSelection=null,this.processor&&await this.end(),!0}}globalThis.WavRecorder=
|
|
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 ei.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 Ht().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 Ht().pack(this.sampleRate,r.audio)}async quit(){return this.listenForDeviceChange(null),this.deviceSelection=null,this.processor&&await this.end(),!0}}globalThis.WavRecorder=Z0;function Up(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),f=Math.min(d+1,r.length-1),h=c-d;a[l]=Math.round(r[d]*(1-h)+r[f]*h)}return s}class eS{constructor({sampleRate:e=44100,outputToSpeakers:n=!1,debug:r=!1}={}){this.scriptSrc=Bp,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:f,data:h}=c.data;if(d==="receipt")this.eventReceipts[f]=h;else if(d==="chunk"){const b={raw:Up(h.raw,i,this.sampleRate),mono:Up(h.mono,i,this.sampleRate)};if(this._chunkProcessorSize){const y=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Ht.mergeBuffers(y.raw,b.raw),mono:Ht.mergeBuffers(y.mono,b.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(b)}};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 ei.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 Ht().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 Ht().pack(this.sampleRate,n.audio)}async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}}globalThis.WavRecorder=WavRecorder;var Up={};Up=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 rc;(function(t){t.AUDIO_BUFFERING_STARTED="audio-buffering-started",t.AUDIO_BUFFERING_STOPPED="audio-buffering-stopped"})(rc||(rc={}));class Zw{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 yn extends qd{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=jw.createCallObject({...this._dailyFactoryOptions,allowMultipleCallInstances:!0}),this._dailyWrapper=new Zw(this._daily)}setupRecorder(){this._mediaStreamRecorder=new Xw({sampleRate:yn.RECORDER_SAMPLE_RATE})}handleUserAudioStream(e){this._audioQueue.push(e)}flushAudioQueue(){if(this._audioQueue.length!==0)for(de.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:yn.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",de.debug("[Daily Transport] Initialized",zw(Up).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 fn(["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,f,h,b,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:(h=(f=(d=e==null?void 0:e.local)==null?void 0:d.tracks)==null?void 0:f.screenVideo)==null?void 0:h.persistentTrack,video:(m=(y=(b=e==null?void 0:e.local)==null?void 0:b.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{de.info("[Daily Transport] Initializing recording"),await this._mediaStreamRecorder.record(r=>{this.handleUserAudioStream(r.mono)},yn.RECORDER_CHUNK_SIZE),(n=(e=this._callbacks).onAudioBufferingStarted)==null||n.call(e),de.info("[Daily Transport] Recording Initialized")}catch(r){r.message.includes("Already recording")||de.error("Error starting recording",r)}}async preAuth(e){this._dailyFactoryOptions=e,await this._daily.preAuth(e)}async initDevices(){var s,a,l,c,d,f,h,b,y,m,S,v;if(!this._daily)throw new ct("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),(f=(d=this._callbacks).onAvailableSpeakersUpdated)==null||f.call(d,o),(b=(h=this._callbacks).onCamUpdated)==null||b.call(h,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 ct("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 ct("Transport instance not initialized");e&&(this._dailyFactoryOptions={...this._dailyFactoryOptions,...e}),this.state="connecting";try{await this._daily.join(this._dailyFactoryOptions)}catch(o){throw de.error("Failed to join room",o),this.state="error",new Rd}(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(je.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()?(de.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 fn(s,o.type,o.msg,{blockedBy:o.blockedBy});case"not-found":return o.missingMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new fn(s,o.type,o.msg);case"constraints":return o.failedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new fn(s,o.type,o.msg,{reason:o.reason});case"cam-in-use":return s.push("cam"),new fn(s,"in-use",o.msg);case"mic-in-use":return s.push("mic"),new fn(s,"in-use",o.msg);case"cam-mic-in-use":return s.push("cam"),s.push("mic"),new fn(s,"in-use",o.msg);case"undefined-mediadevices":case"unknown":default:return s.push("cam"),s.push("mic"),new fn(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 de.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?_r(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?_r(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?_r(e.participant):void 0):(o=(i=this._callbacks).onTrackStopped)==null||o.call(i,e.track,e.participant?_r(e.participant):void 0)}handleParticipantJoined(e){var r,i,o,s;const n=_r(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=_r(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,_r(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;de.error("Daily fatal error",e.errorMsg),this.state="error",this._botId="",(r=(n=this._callbacks).onError)==null||r.call(n,je.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}}}yn.RECORDER_SAMPLE_RATE=16e3,yn.RECORDER_CHUNK_SIZE=512;const _r=t=>({id:t.user_id,local:t.local,name:t.user_name});var zp={exports:{}},ce={};/**
|
|
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 ei.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 Ht().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 Ht().pack(this.sampleRate,n.audio)}async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}}globalThis.WavRecorder=WavRecorder;var zp={};zp=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 ic;(function(t){t.AUDIO_BUFFERING_STARTED="audio-buffering-started",t.AUDIO_BUFFERING_STOPPED="audio-buffering-stopped"})(ic||(ic={}));class tS{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 yn extends Jd{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=U0.createCallObject({...this._dailyFactoryOptions,allowMultipleCallInstances:!0}),this._dailyWrapper=new tS(this._daily)}setupRecorder(){this._mediaStreamRecorder=new eS({sampleRate:yn.RECORDER_SAMPLE_RATE})}handleUserAudioStream(e){this._audioQueue.push(e)}flushAudioQueue(){if(this._audioQueue.length!==0)for(de.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:yn.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",de.debug("[Daily Transport] Initialized",V0(zp).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 fn(["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,f,h,b,y,v,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:(h=(f=(d=e==null?void 0:e.local)==null?void 0:d.tracks)==null?void 0:f.screenVideo)==null?void 0:h.persistentTrack,video:(v=(y=(b=e==null?void 0:e.local)==null?void 0:b.tracks)==null?void 0:y.video)==null?void 0:v.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{de.info("[Daily Transport] Initializing recording"),await this._mediaStreamRecorder.record(r=>{this.handleUserAudioStream(r.mono)},yn.RECORDER_CHUNK_SIZE),(n=(e=this._callbacks).onAudioBufferingStarted)==null||n.call(e),de.info("[Daily Transport] Recording Initialized")}catch(r){r.message.includes("Already recording")||de.error("Error starting recording",r)}}async preAuth(e){this._dailyFactoryOptions=e,await this._daily.preAuth(e)}async initDevices(){var s,a,l,c,d,f,h,b,y,v,S,m;if(!this._daily)throw new ct("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),(f=(d=this._callbacks).onAvailableSpeakersUpdated)==null||f.call(d,o),(b=(h=this._callbacks).onCamUpdated)==null||b.call(h,e.camera),(v=(y=this._callbacks).onMicUpdated)==null||v.call(y,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 ct("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 ct("Transport instance not initialized");e&&(this._dailyFactoryOptions={...this._dailyFactoryOptions,...e}),this.state="connecting";try{await this._daily.join(this._dailyFactoryOptions)}catch(o){throw de.error("Failed to join room",o),this.state="error",new Nd}(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(je.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()?(de.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 fn(s,o.type,o.msg,{blockedBy:o.blockedBy});case"not-found":return o.missingMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new fn(s,o.type,o.msg);case"constraints":return o.failedMedia.forEach(a=>{s.push(a==="video"?"cam":"mic")}),new fn(s,o.type,o.msg,{reason:o.reason});case"cam-in-use":return s.push("cam"),new fn(s,"in-use",o.msg);case"mic-in-use":return s.push("mic"),new fn(s,"in-use",o.msg);case"cam-mic-in-use":return s.push("cam"),s.push("mic"),new fn(s,"in-use",o.msg);case"undefined-mediadevices":case"unknown":default:return s.push("cam"),s.push("mic"),new fn(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 de.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?_r(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?_r(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?_r(e.participant):void 0):(o=(i=this._callbacks).onTrackStopped)==null||o.call(i,e.track,e.participant?_r(e.participant):void 0)}handleParticipantJoined(e){var r,i,o,s;const n=_r(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=_r(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,_r(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;de.error("Daily fatal error",e.errorMsg),this.state="error",this._botId="",(r=(n=this._callbacks).onError)==null||r.call(n,je.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}}}yn.RECORDER_SAMPLE_RATE=16e3,yn.RECORDER_CHUNK_SIZE=512;const _r=t=>({id:t.user_id,local:t.local,name:t.user_name});var Hp={exports:{}},ce={};/**
|
|
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 Ki=Symbol.for("react.element"),
|
|
351
|
+
*/var Ki=Symbol.for("react.element"),nS=Symbol.for("react.portal"),rS=Symbol.for("react.fragment"),iS=Symbol.for("react.strict_mode"),oS=Symbol.for("react.profiler"),sS=Symbol.for("react.provider"),aS=Symbol.for("react.context"),lS=Symbol.for("react.forward_ref"),cS=Symbol.for("react.suspense"),uS=Symbol.for("react.memo"),dS=Symbol.for("react.lazy"),Vp=Symbol.iterator;function fS(t){return t===null||typeof t!="object"?null:(t=Vp&&t[Vp]||t["@@iterator"],typeof t=="function"?t:null)}var Kp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Wp=Object.assign,qp={};function ti(t,e,n){this.props=t,this.context=e,this.refs=qp,this.updater=n||Kp}ti.prototype.isReactComponent={},ti.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")},ti.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Jp(){}Jp.prototype=ti.prototype;function oc(t,e,n){this.props=t,this.context=e,this.refs=qp,this.updater=n||Kp}var sc=oc.prototype=new Jp;sc.constructor=oc,Wp(sc,ti.prototype),sc.isPureReactComponent=!0;var Gp=Array.isArray,Qp=Object.prototype.hasOwnProperty,ac={current:null},Yp={key:!0,ref:!0,__self:!0,__source:!0};function Xp(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)Qp.call(e,r)&&!Yp.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:Ki,type:t,key:o,ref:s,props:i,_owner:ac.current}}function hS(t,e){return{$$typeof:Ki,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function lc(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ki}function pS(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Zp=/\/+/g;function cc(t,e){return typeof t=="object"&&t!==null&&t.key!=null?pS(""+t.key):e.toString(36)}function Ms(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 Ki:case nS:s=!0}}if(s)return s=t,i=i(s),t=r===""?"."+cc(s,0):r,Gp(i)?(n="",t!=null&&(n=t.replace(Zp,"$&/")+"/"),Ms(i,e,n,"",function(c){return c})):i!=null&&(lc(i)&&(i=hS(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(Zp,"$&/")+"/")+t)),e.push(i)),1;if(s=0,r=r===""?".":r+":",Gp(t))for(var a=0;a<t.length;a++){o=t[a];var l=r+cc(o,a);s+=Ms(o,e,n,l,i)}else if(l=fS(t),typeof l=="function")for(t=l.call(t),a=0;!(o=t.next()).done;)o=o.value,l=r+cc(o,a++),s+=Ms(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 As(t,e,n){if(t==null)return t;var r=[],i=0;return Ms(t,r,"","",function(o){return e.call(n,o,i++)}),r}function gS(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 it={current:null},Os={transition:null},mS={ReactCurrentDispatcher:it,ReactCurrentBatchConfig:Os,ReactCurrentOwner:ac};function eg(){throw Error("act(...) is not supported in production builds of React.")}ce.Children={map:As,forEach:function(t,e,n){As(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return As(t,function(){e++}),e},toArray:function(t){return As(t,function(e){return e})||[]},only:function(t){if(!lc(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},ce.Component=ti,ce.Fragment=rS,ce.Profiler=oS,ce.PureComponent=oc,ce.StrictMode=iS,ce.Suspense=cS,ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mS,ce.act=eg,ce.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=Wp({},t.props),i=t.key,o=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,s=ac.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)Qp.call(e,l)&&!Yp.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:Ki,type:t.type,key:i,ref:o,props:r,_owner:s}},ce.createContext=function(t){return t={$$typeof:aS,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:sS,_context:t},t.Consumer=t},ce.createElement=Xp,ce.createFactory=function(t){var e=Xp.bind(null,t);return e.type=t,e},ce.createRef=function(){return{current:null}},ce.forwardRef=function(t){return{$$typeof:lS,render:t}},ce.isValidElement=lc,ce.lazy=function(t){return{$$typeof:dS,_payload:{_status:-1,_result:t},_init:gS}},ce.memo=function(t,e){return{$$typeof:uS,type:t,compare:e===void 0?null:e}},ce.startTransition=function(t){var e=Os.transition;Os.transition={};try{t()}finally{Os.transition=e}},ce.unstable_act=eg,ce.useCallback=function(t,e){return it.current.useCallback(t,e)},ce.useContext=function(t){return it.current.useContext(t)},ce.useDebugValue=function(){},ce.useDeferredValue=function(t){return it.current.useDeferredValue(t)},ce.useEffect=function(t,e){return it.current.useEffect(t,e)},ce.useId=function(){return it.current.useId()},ce.useImperativeHandle=function(t,e,n){return it.current.useImperativeHandle(t,e,n)},ce.useInsertionEffect=function(t,e){return it.current.useInsertionEffect(t,e)},ce.useLayoutEffect=function(t,e){return it.current.useLayoutEffect(t,e)},ce.useMemo=function(t,e){return it.current.useMemo(t,e)},ce.useReducer=function(t,e,n){return it.current.useReducer(t,e,n)},ce.useRef=function(t){return it.current.useRef(t)},ce.useState=function(t){return it.current.useState(t)},ce.useSyncExternalStore=function(t,e,n){return it.current.useSyncExternalStore(t,e,n)},ce.useTransition=function(){return it.current.useTransition()},ce.version="18.3.1",Hp.exports=ce;var oe=Hp.exports;const tg=Xt(oe);var uc={},ng={exports:{}},bt={},rg={exports:{}},ig={};/**
|
|
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(R,j){var Q=R.length;R.push(j);e:for(;0<Q;){var ae=Q-1>>>1,ve=R[ae];if(0<i(ve,j))R[ae]=j,R[Q]=ve,Q=ae;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var j=R[0],Q=R.pop();if(Q!==j){R[0]=Q;e:for(var ae=0,ve=R.length,u=ve>>>1;ae<u;){var g=2*(ae+1)-1,p=R[g],x=g+1,_=R[x];if(0>i(p,Q))x<ve&&0>i(_,p)?(R[ae]=_,R[x]=Q,ae=x):(R[ae]=p,R[g]=Q,ae=g);else if(x<ve&&0>i(_,Q))R[ae]=_,R[x]=Q,ae=x;else break e}}return j}function i(R,j){var Q=R.sortIndex-j.sortIndex;return Q!==0?Q:R.id-j.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,f=null,h=3,b=!1,y=!1,
|
|
359
|
+
*/(function(t){function e(R,j){var Q=R.length;R.push(j);e:for(;0<Q;){var ae=Q-1>>>1,ve=R[ae];if(0<i(ve,j))R[ae]=j,R[Q]=ve,Q=ae;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var j=R[0],Q=R.pop();if(Q!==j){R[0]=Q;e:for(var ae=0,ve=R.length,u=ve>>>1;ae<u;){var g=2*(ae+1)-1,p=R[g],x=g+1,_=R[x];if(0>i(p,Q))x<ve&&0>i(_,p)?(R[ae]=_,R[x]=Q,ae=x):(R[ae]=p,R[g]=Q,ae=g);else if(x<ve&&0>i(_,Q))R[ae]=_,R[x]=Q,ae=x;else break e}}return j}function i(R,j){var Q=R.sortIndex-j.sortIndex;return Q!==0?Q:R.id-j.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,f=null,h=3,b=!1,y=!1,v=!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(R){for(var j=n(c);j!==null;){if(j.callback===null)r(c);else if(j.startTime<=R)r(c),j.sortIndex=j.expirationTime,e(l,j);else break;j=n(c)}}function C(R){if(v=!1,k(R),!y)if(n(l)!==null)y=!0,G(M);else{var j=n(c);j!==null&&ne(C,j.startTime-R)}}function M(R,j){y=!1,v&&(v=!1,m(F),F=-1),b=!0;var Q=h;try{for(k(j),f=n(l);f!==null&&(!(f.expirationTime>j)||R&&!U());){var ae=f.callback;if(typeof ae=="function"){f.callback=null,h=f.priorityLevel;var ve=ae(f.expirationTime<=j);j=t.unstable_now(),typeof ve=="function"?f.callback=ve:f===n(l)&&r(l),k(j)}else r(l);f=n(l)}if(f!==null)var u=!0;else{var g=n(c);g!==null&&ne(C,g.startTime-j),u=!1}return u}finally{f=null,h=Q,b=!1}}var O=!1,D=null,F=-1,J=5,W=-1;function U(){return!(t.unstable_now()-W<J)}function V(){if(D!==null){var R=t.unstable_now();W=R;var j=!0;try{j=D(!0,R)}finally{j?q():(O=!1,D=null)}}else O=!1}var q;if(typeof w=="function")q=function(){w(V)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,H=ie.port2;ie.port1.onmessage=V,q=function(){H.postMessage(null)}}else q=function(){S(V,0)};function G(R){D=R,O||(O=!0,q())}function ne(R,j){F=S(function(){R(t.unstable_now())},j)}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(R){R.callback=null},t.unstable_continueExecution=function(){y||b||(y=!0,G(M))},t.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<R?Math.floor(1e3/R):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(R){switch(h){case 1:case 2:case 3:var j=3;break;default:j=h}var Q=h;h=j;try{return R()}finally{h=Q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(R,j){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var Q=h;h=R;try{return j()}finally{h=Q}},t.unstable_scheduleCallback=function(R,j,Q){var ae=t.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ae+Q:ae):Q=ae,R){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=Q+ve,R={id:d++,callback:j,priorityLevel:R,startTime:Q,expirationTime:ve,sortIndex:-1},Q>ae?(R.sortIndex=Q,e(c,R),n(l)===null&&R===n(c)&&(v?(m(F),F=-1):v=!0,ne(C,Q-ae))):(R.sortIndex=ve,e(l,R),y||b||(y=!0,G(M))),R},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(R){var j=h;return function(){var Q=h;h=j;try{return R.apply(this,arguments)}finally{h=Q}}}})(ig),rg.exports=ig;var vS=rg.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
|
|
368
|
-
`+
|
|
367
|
+
*/var yS=oe,wt=vS;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 og=new Set,Wi={};function Cr(t,e){ni(t,e),ni(t+"Capture",e)}function ni(t,e){for(Wi[t]=e,t=0;t<e.length;t++)og.add(e[t])}var bn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dc=Object.prototype.hasOwnProperty,bS=/^[: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]*$/,sg={},ag={};function wS(t){return dc.call(ag,t)?!0:dc.call(sg,t)?!1:bS.test(t)?ag[t]=!0:(sg[t]=!0,!1)}function SS(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 kS(t,e,n,r){if(e===null||typeof e>"u"||SS(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 ot(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 Ke={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ke[t]=new ot(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ke[e]=new ot(e,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ke[t]=new ot(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ke[t]=new ot(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){Ke[t]=new ot(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){Ke[t]=new ot(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){Ke[t]=new ot(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){Ke[t]=new ot(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){Ke[t]=new ot(t,5,!1,t.toLowerCase(),null,!1,!1)});var fc=/[\-:]([a-z])/g;function hc(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(fc,hc);Ke[e]=new ot(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(fc,hc);Ke[e]=new ot(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(fc,hc);Ke[e]=new ot(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){Ke[t]=new ot(t,1,!1,t.toLowerCase(),null,!1,!1)}),Ke.xlinkHref=new ot("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){Ke[t]=new ot(t,1,!1,t.toLowerCase(),null,!0,!0)});function pc(t,e,n,r){var i=Ke.hasOwnProperty(e)?Ke[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(kS(e,n,i,r)&&(n=null),r||i===null?wS(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 wn=yS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ds=Symbol.for("react.element"),ri=Symbol.for("react.portal"),ii=Symbol.for("react.fragment"),gc=Symbol.for("react.strict_mode"),mc=Symbol.for("react.profiler"),lg=Symbol.for("react.provider"),cg=Symbol.for("react.context"),vc=Symbol.for("react.forward_ref"),yc=Symbol.for("react.suspense"),bc=Symbol.for("react.suspense_list"),wc=Symbol.for("react.memo"),zn=Symbol.for("react.lazy"),ug=Symbol.for("react.offscreen"),dg=Symbol.iterator;function qi(t){return t===null||typeof t!="object"?null:(t=dg&&t[dg]||t["@@iterator"],typeof t=="function"?t:null)}var Ae=Object.assign,Sc;function Ji(t){if(Sc===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Sc=e&&e[1]||""}return`
|
|
368
|
+
`+Sc+t}var kc=!1;function xc(t,e){if(!t||kc)return"";kc=!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{Sc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ji(t):""}function SS(t){switch(t.tag){case 5:return Ji(t.type);case 16:return Ji("Lazy");case 13:return Ji("Suspense");case 19:return Ji("SuspenseList");case 0:case 2:case 15:return t=kc(t.type,!1),t;case 11:return t=kc(t.type.render,!1),t;case 1:return t=kc(t.type,!0),t;default:return""}}function xc(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 ii:return"Fragment";case ri:return"Portal";case gc:return"Profiler";case pc:return"StrictMode";case vc:return"Suspense";case yc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case lg:return(t.displayName||"Context")+".Consumer";case ag:return(t._context.displayName||"Context")+".Provider";case mc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case bc:return e=t.displayName||null,e!==null?e:xc(t.type)||"Memo";case zn:e=t._payload,t=t._init;try{return xc(t(e))}catch{}}return null}function kS(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 xc(e);case 8:return e===pc?"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 Hn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function dg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function xS(t){var e=dg(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 Ds(t){t._valueTracker||(t._valueTracker=xS(t))}function fg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=dg(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ps(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 _c(t,e){var n=e.checked;return Ae({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function hg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Hn(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 pg(t,e){e=e.checked,e!=null&&hc(t,"checked",e,!1)}function Cc(t,e){pg(t,e);var n=Hn(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")?Ec(t,e.type,n):e.hasOwnProperty("defaultValue")&&Ec(t,e.type,Hn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function gg(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 Ec(t,e,n){(e!=="number"||Ps(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Gi=Array.isArray;function oi(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=""+Hn(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 Tc(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(N(91));return Ae({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function mg(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(Gi(n)){if(1<n.length)throw Error(N(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Hn(n)}}function vg(t,e){var n=Hn(e.value),r=Hn(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 yg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function bg(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 Mc(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?bg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Ls,wg=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(Ls=Ls||document.createElement("div"),Ls.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Ls.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Qi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Yi={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},_S=["Webkit","ms","Moz","O"];Object.keys(Yi).forEach(function(t){_S.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Yi[e]=Yi[t]})});function Sg(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Yi.hasOwnProperty(t)&&Yi[t]?(""+e).trim():e+"px"}function kg(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Sg(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var CS=Ae({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 Ac(t,e){if(e){if(CS[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 Oc(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 Dc=null;function Pc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Lc=null,si=null,ai=null;function xg(t){if(t=wo(t)){if(typeof Lc!="function")throw Error(N(280));var e=t.stateNode;e&&(e=na(e),Lc(t.stateNode,t.type,e))}}function _g(t){si?ai?ai.push(t):ai=[t]:si=t}function Cg(){if(si){var t=si,e=ai;if(ai=si=null,xg(t),e)for(t=0;t<e.length;t++)xg(e[t])}}function Eg(t,e){return t(e)}function Tg(){}var Ic=!1;function Mg(t,e,n){if(Ic)return t(e,n);Ic=!0;try{return Eg(t,e,n)}finally{Ic=!1,(si!==null||ai!==null)&&(Tg(),Cg())}}function Xi(t,e){var n=t.stateNode;if(n===null)return null;var r=na(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 Rc=!1;if(bn)try{var Zi={};Object.defineProperty(Zi,"passive",{get:function(){Rc=!0}}),window.addEventListener("test",Zi,Zi),window.removeEventListener("test",Zi,Zi)}catch{Rc=!1}function ES(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 eo=!1,Is=null,Rs=!1,Nc=null,TS={onError:function(t){eo=!0,Is=t}};function MS(t,e,n,r,i,o,s,a,l){eo=!1,Is=null,ES.apply(TS,arguments)}function AS(t,e,n,r,i,o,s,a,l){if(MS.apply(this,arguments),eo){if(eo){var c=Is;eo=!1,Is=null}else throw Error(N(198));Rs||(Rs=!0,Nc=c)}}function Er(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 Ag(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 Og(t){if(Er(t)!==t)throw Error(N(188))}function OS(t){var e=t.alternate;if(!e){if(e=Er(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 Og(i),t;if(o===r)return Og(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 Dg(t){return t=OS(t),t!==null?Pg(t):null}function Pg(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Pg(t);if(e!==null)return e;t=t.sibling}return null}var Lg=wt.unstable_scheduleCallback,Ig=wt.unstable_cancelCallback,DS=wt.unstable_shouldYield,PS=wt.unstable_requestPaint,Ie=wt.unstable_now,LS=wt.unstable_getCurrentPriorityLevel,$c=wt.unstable_ImmediatePriority,Rg=wt.unstable_UserBlockingPriority,Ns=wt.unstable_NormalPriority,IS=wt.unstable_LowPriority,Ng=wt.unstable_IdlePriority,$s=null,rn=null;function RS(t){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot($s,t,void 0,(t.current.flags&128)===128)}catch{}}var Vt=Math.clz32?Math.clz32:FS,NS=Math.log,$S=Math.LN2;function FS(t){return t>>>=0,t===0?32:31-(NS(t)/$S|0)|0}var Fs=64,js=4194304;function to(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 Bs(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=to(a):(o&=s,o!==0&&(r=to(o)))}else s=n&~i,s!==0?r=to(s):o!==0&&(r=to(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-Vt(e),i=1<<n,r|=t[n],e&=~i;return r}function jS(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 BS(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-Vt(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=jS(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}function Fc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function $g(){var t=Fs;return Fs<<=1,!(Fs&4194240)&&(Fs=64),t}function jc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function no(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Vt(e),t[e]=n}function US(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-Vt(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function Bc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Vt(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var ye=0;function Fg(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var jg,Uc,Bg,Ug,zg,zc=!1,Us=[],Vn=null,Kn=null,Wn=null,ro=new Map,io=new Map,qn=[],zS="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 Hg(t,e){switch(t){case"focusin":case"focusout":Vn=null;break;case"dragenter":case"dragleave":Kn=null;break;case"mouseover":case"mouseout":Wn=null;break;case"pointerover":case"pointerout":ro.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":io.delete(e.pointerId)}}function oo(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=wo(e),e!==null&&Uc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function HS(t,e,n,r,i){switch(e){case"focusin":return Vn=oo(Vn,t,e,n,r,i),!0;case"dragenter":return Kn=oo(Kn,t,e,n,r,i),!0;case"mouseover":return Wn=oo(Wn,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return ro.set(o,oo(ro.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,io.set(o,oo(io.get(o)||null,t,e,n,r,i)),!0}return!1}function Vg(t){var e=Tr(t.target);if(e!==null){var n=Er(e);if(n!==null){if(e=n.tag,e===13){if(e=Ag(n),e!==null){t.blockedOn=e,zg(t.priority,function(){Bg(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 zs(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Vc(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Dc=r,n.target.dispatchEvent(r),Dc=null}else return e=wo(n),e!==null&&Uc(e),t.blockedOn=n,!1;e.shift()}return!0}function Kg(t,e,n){zs(t)&&n.delete(e)}function VS(){zc=!1,Vn!==null&&zs(Vn)&&(Vn=null),Kn!==null&&zs(Kn)&&(Kn=null),Wn!==null&&zs(Wn)&&(Wn=null),ro.forEach(Kg),io.forEach(Kg)}function so(t,e){t.blockedOn===e&&(t.blockedOn=null,zc||(zc=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,VS)))}function ao(t){function e(i){return so(i,t)}if(0<Us.length){so(Us[0],t);for(var n=1;n<Us.length;n++){var r=Us[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Vn!==null&&so(Vn,t),Kn!==null&&so(Kn,t),Wn!==null&&so(Wn,t),ro.forEach(e),io.forEach(e),n=0;n<qn.length;n++)r=qn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<qn.length&&(n=qn[0],n.blockedOn===null);)Vg(n),n.blockedOn===null&&qn.shift()}var li=wn.ReactCurrentBatchConfig,Hs=!0;function KS(t,e,n,r){var i=ye,o=li.transition;li.transition=null;try{ye=1,Hc(t,e,n,r)}finally{ye=i,li.transition=o}}function WS(t,e,n,r){var i=ye,o=li.transition;li.transition=null;try{ye=4,Hc(t,e,n,r)}finally{ye=i,li.transition=o}}function Hc(t,e,n,r){if(Hs){var i=Vc(t,e,n,r);if(i===null)au(t,e,r,Vs,n),Hg(t,r);else if(HS(i,t,e,n,r))r.stopPropagation();else if(Hg(t,r),e&4&&-1<zS.indexOf(t)){for(;i!==null;){var o=wo(i);if(o!==null&&jg(o),o=Vc(t,e,n,r),o===null&&au(t,e,r,Vs,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else au(t,e,r,null,n)}}var Vs=null;function Vc(t,e,n,r){if(Vs=null,t=Pc(r),t=Tr(t),t!==null)if(e=Er(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Ag(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 Vs=t,null}function Wg(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(LS()){case $c:return 1;case Rg:return 4;case Ns:case IS:return 16;case Ng:return 536870912;default:return 16}default:return 16}}var Jn=null,Kc=null,Ks=null;function qg(){if(Ks)return Ks;var t,e=Kc,n=e.length,r,i="value"in Jn?Jn.value:Jn.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 Ks=i.slice(t,1<r?1-r:void 0)}function Ws(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 qs(){return!0}function Jg(){return!1}function St(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)?qs:Jg,this.isPropagationStopped=Jg,this}return Ae(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=qs)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=qs)},persist:function(){},isPersistent:qs}),e}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wc=St(ci),lo=Ae({},ci,{view:0,detail:0}),qS=St(lo),qc,Jc,co,Js=Ae({},lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qc,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!==co&&(co&&t.type==="mousemove"?(qc=t.screenX-co.screenX,Jc=t.screenY-co.screenY):Jc=qc=0,co=t),qc)},movementY:function(t){return"movementY"in t?t.movementY:Jc}}),Gg=St(Js),JS=Ae({},Js,{dataTransfer:0}),GS=St(JS),QS=Ae({},lo,{relatedTarget:0}),Gc=St(QS),YS=Ae({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),XS=St(YS),ZS=Ae({},ci,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ek=St(ZS),tk=Ae({},ci,{data:0}),Qg=St(tk),nk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rk={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"},ik={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ok(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=ik[t])?!!e[t]:!1}function Qc(){return ok}var sk=Ae({},lo,{key:function(t){if(t.key){var e=nk[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ws(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?rk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qc,charCode:function(t){return t.type==="keypress"?Ws(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ws(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ak=St(sk),lk=Ae({},Js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yg=St(lk),ck=Ae({},lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qc}),uk=St(ck),dk=Ae({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),fk=St(dk),hk=Ae({},Js,{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=St(hk),gk=[9,13,27,32],Yc=bn&&"CompositionEvent"in window,uo=null;bn&&"documentMode"in document&&(uo=document.documentMode);var mk=bn&&"TextEvent"in window&&!uo,Xg=bn&&(!Yc||uo&&8<uo&&11>=uo),Zg=" ",em=!1;function tm(t,e){switch(t){case"keyup":return gk.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ui=!1;function vk(t,e){switch(t){case"compositionend":return nm(e);case"keypress":return e.which!==32?null:(em=!0,Zg);case"textInput":return t=e.data,t===Zg&&em?null:t;default:return null}}function yk(t,e){if(ui)return t==="compositionend"||!Yc&&tm(t,e)?(t=qg(),Ks=Kc=Jn=null,ui=!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 Xg&&e.locale!=="ko"?null:e.data;default:return null}}var bk={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 rm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!bk[t.type]:e==="textarea"}function im(t,e,n,r){_g(r),e=Zs(e,"onChange"),0<e.length&&(n=new Wc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var fo=null,ho=null;function wk(t){km(t,0)}function Gs(t){var e=gi(t);if(fg(e))return t}function Sk(t,e){if(t==="change")return e}var om=!1;if(bn){var Xc;if(bn){var Zc="oninput"in document;if(!Zc){var sm=document.createElement("div");sm.setAttribute("oninput","return;"),Zc=typeof sm.oninput=="function"}Xc=Zc}else Xc=!1;om=Xc&&(!document.documentMode||9<document.documentMode)}function am(){fo&&(fo.detachEvent("onpropertychange",lm),ho=fo=null)}function lm(t){if(t.propertyName==="value"&&Gs(ho)){var e=[];im(e,ho,t,Pc(t)),Mg(wk,e)}}function kk(t,e,n){t==="focusin"?(am(),fo=e,ho=n,fo.attachEvent("onpropertychange",lm)):t==="focusout"&&am()}function xk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Gs(ho)}function _k(t,e){if(t==="click")return Gs(e)}function Ck(t,e){if(t==="input"||t==="change")return Gs(e)}function Ek(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Kt=typeof Object.is=="function"?Object.is:Ek;function po(t,e){if(Kt(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(!uc.call(e,i)||!Kt(t[i],e[i]))return!1}return!0}function cm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function um(t,e){var n=cm(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=cm(n)}}function dm(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?dm(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function fm(){for(var t=window,e=Ps();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ps(t.document)}return e}function eu(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 Tk(t){var e=fm(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&dm(n.ownerDocument.documentElement,n)){if(r!==null&&eu(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=um(n,o);var s=um(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 Mk=bn&&"documentMode"in document&&11>=document.documentMode,di=null,tu=null,go=null,nu=!1;function hm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;nu||di==null||di!==Ps(r)||(r=di,"selectionStart"in r&&eu(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}),go&&po(go,r)||(go=r,r=Zs(tu,"onSelect"),0<r.length&&(e=new Wc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=di)))}function Qs(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var fi={animationend:Qs("Animation","AnimationEnd"),animationiteration:Qs("Animation","AnimationIteration"),animationstart:Qs("Animation","AnimationStart"),transitionend:Qs("Transition","TransitionEnd")},ru={},pm={};bn&&(pm=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 Ys(t){if(ru[t])return ru[t];if(!fi[t])return t;var e=fi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in pm)return ru[t]=e[n];return t}var gm=Ys("animationend"),mm=Ys("animationiteration"),vm=Ys("animationstart"),ym=Ys("transitionend"),bm=new Map,wm="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 Gn(t,e){bm.set(t,e),Cr(e,[t])}for(var iu=0;iu<wm.length;iu++){var ou=wm[iu],Ak=ou.toLowerCase(),Ok=ou[0].toUpperCase()+ou.slice(1);Gn(Ak,"on"+Ok)}Gn(gm,"onAnimationEnd"),Gn(mm,"onAnimationIteration"),Gn(vm,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(ym,"onTransitionEnd"),ni("onMouseEnter",["mouseout","mouseover"]),ni("onMouseLeave",["mouseout","mouseover"]),ni("onPointerEnter",["pointerout","pointerover"]),ni("onPointerLeave",["pointerout","pointerover"]),Cr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Cr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Cr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Cr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Cr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Cr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mo="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(" "),Dk=new Set("cancel close invalid load scroll toggle".split(" ").concat(mo));function Sm(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,AS(r,e,void 0,t),t.currentTarget=null}function km(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;Sm(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;Sm(i,a,c),o=l}}}if(Rs)throw t=Nc,Rs=!1,Nc=null,t}function Ee(t,e){var n=e[hu];n===void 0&&(n=e[hu]=new Set);var r=t+"__bubble";n.has(r)||(xm(e,t,2,!1),n.add(r))}function su(t,e,n){var r=0;e&&(r|=4),xm(n,t,r,e)}var Xs="_reactListening"+Math.random().toString(36).slice(2);function vo(t){if(!t[Xs]){t[Xs]=!0,ig.forEach(function(n){n!=="selectionchange"&&(Dk.has(n)||su(n,!1,t),su(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Xs]||(e[Xs]=!0,su("selectionchange",!1,e))}}function xm(t,e,n,r){switch(Wg(e)){case 1:var i=KS;break;case 4:i=WS;break;default:i=Hc}n=i.bind(null,e,n,t),i=void 0,!Rc||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 au(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=Tr(a),s===null)return;if(l=s.tag,l===5||l===6){r=o=s;continue e}a=a.parentNode}}r=r.return}Mg(function(){var c=o,d=Pc(n),f=[];e:{var h=bm.get(t);if(h!==void 0){var b=Wc,y=t;switch(t){case"keypress":if(Ws(n)===0)break e;case"keydown":case"keyup":b=ak;break;case"focusin":y="focus",b=Gc;break;case"focusout":y="blur",b=Gc;break;case"beforeblur":case"afterblur":b=Gc;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":b=Gg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":b=GS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":b=uk;break;case gm:case mm:case vm:b=XS;break;case ym:b=fk;break;case"scroll":b=qS;break;case"wheel":b=pk;break;case"copy":case"cut":case"paste":b=ek;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":b=Yg}var m=(e&4)!==0,S=!m&&t==="scroll",v=m?h!==null?h+"Capture":null:h;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=Xi(w,v),C!=null&&m.push(yo(w,C,k)))),S)break;w=w.return}0<m.length&&(h=new b(h,y,null,n,d),f.push({event:h,listeners:m}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",b=t==="mouseout"||t==="pointerout",h&&n!==Dc&&(y=n.relatedTarget||n.fromElement)&&(Tr(y)||y[Sn]))break e;if((b||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,b?(y=n.relatedTarget||n.toElement,b=c,y=y?Tr(y):null,y!==null&&(S=Er(y),y!==S||y.tag!==5&&y.tag!==6)&&(y=null)):(b=null,y=c),b!==y)){if(m=Gg,C="onMouseLeave",v="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(m=Yg,C="onPointerLeave",v="onPointerEnter",w="pointer"),S=b==null?h:gi(b),k=y==null?h:gi(y),h=new m(C,w+"leave",b,n,d),h.target=S,h.relatedTarget=k,C=null,Tr(d)===c&&(m=new m(v,w+"enter",y,n,d),m.target=k,m.relatedTarget=S,C=m),S=C,b&&y)t:{for(m=b,v=y,w=0,k=m;k;k=hi(k))w++;for(k=0,C=v;C;C=hi(C))k++;for(;0<w-k;)m=hi(m),w--;for(;0<k-w;)v=hi(v),k--;for(;w--;){if(m===v||v!==null&&m===v.alternate)break t;m=hi(m),v=hi(v)}m=null}else m=null;b!==null&&_m(f,h,b,m,!1),y!==null&&S!==null&&_m(f,S,y,m,!0)}}e:{if(h=c?gi(c):window,b=h.nodeName&&h.nodeName.toLowerCase(),b==="select"||b==="input"&&h.type==="file")var M=Sk;else if(rm(h))if(om)M=Ck;else{M=xk;var O=kk}else(b=h.nodeName)&&b.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(M=_k);if(M&&(M=M(t,c))){im(f,M,n,d);break e}O&&O(t,h,c),t==="focusout"&&(O=h._wrapperState)&&O.controlled&&h.type==="number"&&Ec(h,"number",h.value)}switch(O=c?gi(c):window,t){case"focusin":(rm(O)||O.contentEditable==="true")&&(di=O,tu=c,go=null);break;case"focusout":go=tu=di=null;break;case"mousedown":nu=!0;break;case"contextmenu":case"mouseup":case"dragend":nu=!1,hm(f,n,d);break;case"selectionchange":if(Mk)break;case"keydown":case"keyup":hm(f,n,d)}var D;if(Yc)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 ui?tm(t,n)&&(F="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(F="onCompositionStart");F&&(Xg&&n.locale!=="ko"&&(ui||F!=="onCompositionStart"?F==="onCompositionEnd"&&ui&&(D=qg()):(Jn=d,Kc="value"in Jn?Jn.value:Jn.textContent,ui=!0)),O=Zs(c,F),0<O.length&&(F=new Qg(F,t,null,n,d),f.push({event:F,listeners:O}),D?F.data=D:(D=nm(n),D!==null&&(F.data=D)))),(D=mk?vk(t,n):yk(t,n))&&(c=Zs(c,"onBeforeInput"),0<c.length&&(d=new Qg("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:c}),d.data=D))}km(f,e)})}function yo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Zs(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=Xi(t,n),o!=null&&r.unshift(yo(t,o,i)),o=Xi(t,e),o!=null&&r.push(yo(t,o,i))),t=t.return}return r}function hi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function _m(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=Xi(n,o),l!=null&&s.unshift(yo(n,l,a))):i||(l=Xi(n,o),l!=null&&s.push(yo(n,l,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var Pk=/\r\n?/g,Lk=/\u0000|\uFFFD/g;function Cm(t){return(typeof t=="string"?t:""+t).replace(Pk,`
|
|
372
|
-
`).replace(Lk,"")}function ea(t,e,n){if(e=Cm(e),Cm(t)!==e&&n)throw Error(N(425))}function ta(){}var lu=null,cu=null;function uu(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 du=typeof setTimeout=="function"?setTimeout:void 0,Ik=typeof clearTimeout=="function"?clearTimeout:void 0,Em=typeof Promise=="function"?Promise:void 0,Rk=typeof queueMicrotask=="function"?queueMicrotask:typeof Em<"u"?function(t){return Em.resolve(null).then(t).catch(Nk)}:du;function Nk(t){setTimeout(function(){throw t})}function fu(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),ao(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);ao(e)}function Qn(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 Tm(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 pi=Math.random().toString(36).slice(2),on="__reactFiber$"+pi,bo="__reactProps$"+pi,Sn="__reactContainer$"+pi,hu="__reactEvents$"+pi,$k="__reactListeners$"+pi,Fk="__reactHandles$"+pi;function Tr(t){var e=t[on];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Sn]||n[on]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Tm(t);t!==null;){if(n=t[on])return n;t=Tm(t)}return e}t=n,n=t.parentNode}return null}function wo(t){return t=t[on]||t[Sn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function gi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(N(33))}function na(t){return t[bo]||null}var pu=[],mi=-1;function Yn(t){return{current:t}}function Te(t){0>mi||(t.current=pu[mi],pu[mi]=null,mi--)}function Ce(t,e){mi++,pu[mi]=t.current,t.current=e}var Xn={},Ye=Yn(Xn),ut=Yn(!1),Mr=Xn;function vi(t,e){var n=t.type.contextTypes;if(!n)return Xn;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 dt(t){return t=t.childContextTypes,t!=null}function ra(){Te(ut),Te(Ye)}function Mm(t,e,n){if(Ye.current!==Xn)throw Error(N(168));Ce(Ye,e),Ce(ut,n)}function Am(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,kS(t)||"Unknown",i));return Ae({},n,r)}function ia(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Xn,Mr=Ye.current,Ce(Ye,t),Ce(ut,ut.current),!0}function Om(t,e,n){var r=t.stateNode;if(!r)throw Error(N(169));n?(t=Am(t,e,Mr),r.__reactInternalMemoizedMergedChildContext=t,Te(ut),Te(Ye),Ce(Ye,t)):Te(ut),Ce(ut,n)}var kn=null,oa=!1,gu=!1;function Dm(t){kn===null?kn=[t]:kn.push(t)}function jk(t){oa=!0,Dm(t)}function Zn(){if(!gu&&kn!==null){gu=!0;var t=0,e=ye;try{var n=kn;for(ye=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}kn=null,oa=!1}catch(i){throw kn!==null&&(kn=kn.slice(t+1)),Lg($c,Zn),i}finally{ye=e,gu=!1}}return null}var yi=[],bi=0,sa=null,aa=0,Dt=[],Pt=0,Ar=null,xn=1,_n="";function Or(t,e){yi[bi++]=aa,yi[bi++]=sa,sa=t,aa=e}function Pm(t,e,n){Dt[Pt++]=xn,Dt[Pt++]=_n,Dt[Pt++]=Ar,Ar=t;var r=xn;t=_n;var i=32-Vt(r)-1;r&=~(1<<i),n+=1;var o=32-Vt(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,xn=1<<32-Vt(e)+i|n<<i|r,_n=o+t}else xn=1<<o|n<<i|r,_n=t}function mu(t){t.return!==null&&(Or(t,1),Pm(t,1,0))}function vu(t){for(;t===sa;)sa=yi[--bi],yi[bi]=null,aa=yi[--bi],yi[bi]=null;for(;t===Ar;)Ar=Dt[--Pt],Dt[Pt]=null,_n=Dt[--Pt],Dt[Pt]=null,xn=Dt[--Pt],Dt[Pt]=null}var kt=null,xt=null,Me=!1,Wt=null;function Lm(t,e){var n=Nt(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 Im(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,kt=t,xt=Qn(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,kt=t,xt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Ar!==null?{id:xn,overflow:_n}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Nt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,kt=t,xt=null,!0):!1;default:return!1}}function yu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function bu(t){if(Me){var e=xt;if(e){var n=e;if(!Im(t,e)){if(yu(t))throw Error(N(418));e=Qn(n.nextSibling);var r=kt;e&&Im(t,e)?Lm(r,n):(t.flags=t.flags&-4097|2,Me=!1,kt=t)}}else{if(yu(t))throw Error(N(418));t.flags=t.flags&-4097|2,Me=!1,kt=t}}}function Rm(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;kt=t}function la(t){if(t!==kt)return!1;if(!Me)return Rm(t),Me=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!uu(t.type,t.memoizedProps)),e&&(e=xt)){if(yu(t))throw Nm(),Error(N(418));for(;e;)Lm(t,e),e=Qn(e.nextSibling)}if(Rm(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){xt=Qn(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}xt=null}}else xt=kt?Qn(t.stateNode.nextSibling):null;return!0}function Nm(){for(var t=xt;t;)t=Qn(t.nextSibling)}function wi(){xt=kt=null,Me=!1}function wu(t){Wt===null?Wt=[t]:Wt.push(t)}var Bk=wn.ReactCurrentBatchConfig;function So(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 ca(t,e){throw t=Object.prototype.toString.call(e),Error(N(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function $m(t){var e=t._init;return e(t._payload)}function Fm(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=ar(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=dd(k,v.mode,C),w.return=v,w):(w=i(w,k),w.return=v,w)}function l(v,w,k,C){var M=k.type;return M===ii?d(v,w,k.props.children,C,k.key):w!==null&&(w.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===zn&&$m(M)===w.type)?(C=i(w,k.props),C.ref=So(v,w,k),C.return=v,C):(C=La(k.type,k.key,k.props,null,v.mode,C),C.ref=So(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=fd(k,v.mode,C),w.return=v,w):(w=i(w,k.children||[]),w.return=v,w)}function d(v,w,k,C,M){return w===null||w.tag!==7?(w=Fr(k,v.mode,C,M),w.return=v,w):(w=i(w,k),w.return=v,w)}function f(v,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=dd(""+w,v.mode,k),w.return=v,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Os:return k=La(w.type,w.key,w.props,null,v.mode,k),k.ref=So(v,null,w),k.return=v,k;case ri:return w=fd(w,v.mode,k),w.return=v,w;case zn:var C=w._init;return f(v,C(w._payload),k)}if(Gi(w)||qi(w))return w=Fr(w,v.mode,k,null),w.return=v,w;ca(v,w)}return null}function h(v,w,k,C){var M=w!==null?w.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return M!==null?null:a(v,w,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Os:return k.key===M?l(v,w,k,C):null;case ri:return k.key===M?c(v,w,k,C):null;case zn:return M=k._init,h(v,w,M(k._payload),C)}if(Gi(k)||qi(k))return M!==null?null:d(v,w,k,C,null);ca(v,k)}return null}function b(v,w,k,C,M){if(typeof C=="string"&&C!==""||typeof C=="number")return v=v.get(k)||null,a(w,v,""+C,M);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Os:return v=v.get(C.key===null?k:C.key)||null,l(w,v,C,M);case ri:return v=v.get(C.key===null?k:C.key)||null,c(w,v,C,M);case zn:var O=C._init;return b(v,w,k,O(C._payload),M)}if(Gi(C)||qi(C))return v=v.get(k)||null,d(w,v,C,M,null);ca(w,C)}return null}function y(v,w,k,C){for(var M=null,O=null,D=w,F=w=0,J=null;D!==null&&F<k.length;F++){D.index>F?(J=D,D=null):J=D.sibling;var W=h(v,D,k[F],C);if(W===null){D===null&&(D=J);break}t&&D&&W.alternate===null&&e(v,D),w=o(W,w,F),O===null?M=W:O.sibling=W,O=W,D=J}if(F===k.length)return n(v,D),Me&&Or(v,F),M;if(D===null){for(;F<k.length;F++)D=f(v,k[F],C),D!==null&&(w=o(D,w,F),O===null?M=D:O.sibling=D,O=D);return Me&&Or(v,F),M}for(D=r(v,D);F<k.length;F++)J=b(D,v,F,k[F],C),J!==null&&(t&&J.alternate!==null&&D.delete(J.key===null?F:J.key),w=o(J,w,F),O===null?M=J:O.sibling=J,O=J);return t&&D.forEach(function(U){return e(v,U)}),Me&&Or(v,F),M}function m(v,w,k,C){var M=qi(k);if(typeof M!="function")throw Error(N(150));if(k=M.call(k),k==null)throw Error(N(151));for(var O=M=null,D=w,F=w=0,J=null,W=k.next();D!==null&&!W.done;F++,W=k.next()){D.index>F?(J=D,D=null):J=D.sibling;var U=h(v,D,W.value,C);if(U===null){D===null&&(D=J);break}t&&D&&U.alternate===null&&e(v,D),w=o(U,w,F),O===null?M=U:O.sibling=U,O=U,D=J}if(W.done)return n(v,D),Me&&Or(v,F),M;if(D===null){for(;!W.done;F++,W=k.next())W=f(v,W.value,C),W!==null&&(w=o(W,w,F),O===null?M=W:O.sibling=W,O=W);return Me&&Or(v,F),M}for(D=r(v,D);!W.done;F++,W=k.next())W=b(D,v,F,W.value,C),W!==null&&(t&&W.alternate!==null&&D.delete(W.key===null?F:W.key),w=o(W,w,F),O===null?M=W:O.sibling=W,O=W);return t&&D.forEach(function(V){return e(v,V)}),Me&&Or(v,F),M}function S(v,w,k,C){if(typeof k=="object"&&k!==null&&k.type===ii&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Os:e:{for(var M=k.key,O=w;O!==null;){if(O.key===M){if(M=k.type,M===ii){if(O.tag===7){n(v,O.sibling),w=i(O,k.props.children),w.return=v,v=w;break e}}else if(O.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===zn&&$m(M)===O.type){n(v,O.sibling),w=i(O,k.props),w.ref=So(v,O,k),w.return=v,v=w;break e}n(v,O);break}else e(v,O);O=O.sibling}k.type===ii?(w=Fr(k.props.children,v.mode,C,k.key),w.return=v,v=w):(C=La(k.type,k.key,k.props,null,v.mode,C),C.ref=So(v,w,k),C.return=v,v=C)}return s(v);case ri:e:{for(O=k.key;w!==null;){if(w.key===O)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=fd(k,v.mode,C),w.return=v,v=w}return s(v);case zn:return O=k._init,S(v,w,O(k._payload),C)}if(Gi(k))return y(v,w,k,C);if(qi(k))return m(v,w,k,C);ca(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=dd(k,v.mode,C),w.return=v,v=w),s(v)):n(v,w)}return S}var Si=Fm(!0),jm=Fm(!1),ua=Yn(null),da=null,ki=null,Su=null;function ku(){Su=ki=da=null}function xu(t){var e=ua.current;Te(ua),t._currentValue=e}function _u(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 xi(t,e){da=t,Su=ki=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(ft=!0),t.firstContext=null)}function Lt(t){var e=t._currentValue;if(Su!==t)if(t={context:t,memoizedValue:e,next:null},ki===null){if(da===null)throw Error(N(308));ki=t,da.dependencies={lanes:0,firstContext:t}}else ki=ki.next=t;return e}var Dr=null;function Cu(t){Dr===null?Dr=[t]:Dr.push(t)}function Bm(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Cu(e)):(n.next=i.next,i.next=n),e.interleaved=n,Cn(t,r)}function Cn(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 er=!1;function Eu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Um(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 En(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function tr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ge&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Cn(t,n)}return i=r.interleaved,i===null?(e.next=e,Cu(r)):(e.next=i.next,i.next=e),r.interleaved=e,Cn(t,n)}function fa(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,Bc(t,n)}}function zm(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 ha(t,e,n,r){var i=t.updateQueue;er=!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 f=i.baseState;s=0,d=c=l=null,a=o;do{var h=a.lane,b=a.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:b,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=t,m=a;switch(h=e,b=n,m.tag){case 1:if(y=m.payload,typeof y=="function"){f=y.call(b,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=m.payload,h=typeof y=="function"?y.call(b,f,h):y,h==null)break e;f=Ae({},f,h);break e;case 2:er=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else b={eventTime:b,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=b,l=f):d=d.next=b,s|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),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);Ir|=s,t.lanes=s,t.memoizedState=f}}function Hm(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 ko={},sn=Yn(ko),xo=Yn(ko),_o=Yn(ko);function Pr(t){if(t===ko)throw Error(N(174));return t}function Tu(t,e){switch(Ce(_o,e),Ce(xo,t),Ce(sn,ko),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Mc(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Mc(e,t)}Te(sn),Ce(sn,e)}function _i(){Te(sn),Te(xo),Te(_o)}function Vm(t){Pr(_o.current);var e=Pr(sn.current),n=Mc(e,t.type);e!==n&&(Ce(xo,t),Ce(sn,n))}function Mu(t){xo.current===t&&(Te(sn),Te(xo))}var Oe=Yn(0);function pa(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 Au=[];function Ou(){for(var t=0;t<Au.length;t++)Au[t]._workInProgressVersionPrimary=null;Au.length=0}var ga=wn.ReactCurrentDispatcher,Du=wn.ReactCurrentBatchConfig,Lr=0,De=null,$e=null,Ue=null,ma=!1,Co=!1,Eo=0,Uk=0;function Xe(){throw Error(N(321))}function Pu(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Kt(t[n],e[n]))return!1;return!0}function Lu(t,e,n,r,i,o){if(Lr=o,De=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ga.current=t===null||t.memoizedState===null?Kk:Wk,t=n(r,i),Co){o=0;do{if(Co=!1,Eo=0,25<=o)throw Error(N(301));o+=1,Ue=$e=null,e.updateQueue=null,ga.current=qk,t=n(r,i)}while(Co)}if(ga.current=ba,e=$e!==null&&$e.next!==null,Lr=0,Ue=$e=De=null,ma=!1,e)throw Error(N(300));return t}function Iu(){var t=Eo!==0;return Eo=0,t}function an(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ue===null?De.memoizedState=Ue=t:Ue=Ue.next=t,Ue}function It(){if($e===null){var t=De.alternate;t=t!==null?t.memoizedState:null}else t=$e.next;var e=Ue===null?De.memoizedState:Ue.next;if(e!==null)Ue=e,$e=t;else{if(t===null)throw Error(N(310));$e=t,t={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},Ue===null?De.memoizedState=Ue=t:Ue=Ue.next=t}return Ue}function To(t,e){return typeof e=="function"?e(t):e}function Ru(t){var e=It(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=$e,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((Lr&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 f={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,s=r):l=l.next=f,De.lanes|=d,Ir|=d}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,Kt(r,e.memoizedState)||(ft=!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,De.lanes|=o,Ir|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Nu(t){var e=It(),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);Kt(o,e.memoizedState)||(ft=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function Km(){}function Wm(t,e){var n=De,r=It(),i=e(),o=!Kt(r.memoizedState,i);if(o&&(r.memoizedState=i,ft=!0),r=r.queue,$u(Gm.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||Ue!==null&&Ue.memoizedState.tag&1){if(n.flags|=2048,Mo(9,Jm.bind(null,n,r,i,e),void 0,null),ze===null)throw Error(N(349));Lr&30||qm(n,e,i)}return i}function qm(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=De.updateQueue,e===null?(e={lastEffect:null,stores:null},De.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Jm(t,e,n,r){e.value=n,e.getSnapshot=r,Qm(e)&&Ym(t)}function Gm(t,e,n){return n(function(){Qm(e)&&Ym(t)})}function Qm(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Kt(t,n)}catch{return!0}}function Ym(t){var e=Cn(t,1);e!==null&&Qt(e,t,1,-1)}function Xm(t){var e=an();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:To,lastRenderedState:t},e.queue=t,t=t.dispatch=Vk.bind(null,De,t),[e.memoizedState,t]}function Mo(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=De.updateQueue,e===null?(e={lastEffect:null,stores:null},De.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 Zm(){return It().memoizedState}function va(t,e,n,r){var i=an();De.flags|=t,i.memoizedState=Mo(1|e,n,void 0,r===void 0?null:r)}function ya(t,e,n,r){var i=It();r=r===void 0?null:r;var o=void 0;if($e!==null){var s=$e.memoizedState;if(o=s.destroy,r!==null&&Pu(r,s.deps)){i.memoizedState=Mo(e,n,o,r);return}}De.flags|=t,i.memoizedState=Mo(1|e,n,o,r)}function ev(t,e){return va(8390656,8,t,e)}function $u(t,e){return ya(2048,8,t,e)}function tv(t,e){return ya(4,2,t,e)}function nv(t,e){return ya(4,4,t,e)}function rv(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 iv(t,e,n){return n=n!=null?n.concat([t]):null,ya(4,4,rv.bind(null,e,t),n)}function Fu(){}function ov(t,e){var n=It();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Pu(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function sv(t,e){var n=It();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Pu(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function av(t,e,n){return Lr&21?(Kt(n,e)||(n=$g(),De.lanes|=n,Ir|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,ft=!0),t.memoizedState=n)}function zk(t,e){var n=ye;ye=n!==0&&4>n?n:4,t(!0);var r=Du.transition;Du.transition={};try{t(!1),e()}finally{ye=n,Du.transition=r}}function lv(){return It().memoizedState}function Hk(t,e,n){var r=or(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cv(t))uv(e,n);else if(n=Bm(t,e,n,r),n!==null){var i=at();Qt(n,t,r,i),dv(n,e,r)}}function Vk(t,e,n){var r=or(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cv(t))uv(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,Kt(a,s)){var l=e.interleaved;l===null?(i.next=i,Cu(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Bm(t,e,i,r),n!==null&&(i=at(),Qt(n,t,r,i),dv(n,e,r))}}function cv(t){var e=t.alternate;return t===De||e!==null&&e===De}function uv(t,e){Co=ma=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function dv(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Bc(t,n)}}var ba={readContext:Lt,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useInsertionEffect:Xe,useLayoutEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useMutableSource:Xe,useSyncExternalStore:Xe,useId:Xe,unstable_isNewReconciler:!1},Kk={readContext:Lt,useCallback:function(t,e){return an().memoizedState=[t,e===void 0?null:e],t},useContext:Lt,useEffect:ev,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,va(4194308,4,rv.bind(null,e,t),n)},useLayoutEffect:function(t,e){return va(4194308,4,t,e)},useInsertionEffect:function(t,e){return va(4,2,t,e)},useMemo:function(t,e){var n=an();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=an();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=Hk.bind(null,De,t),[r.memoizedState,t]},useRef:function(t){var e=an();return t={current:t},e.memoizedState=t},useState:Xm,useDebugValue:Fu,useDeferredValue:function(t){return an().memoizedState=t},useTransition:function(){var t=Xm(!1),e=t[0];return t=zk.bind(null,t[1]),an().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=De,i=an();if(Me){if(n===void 0)throw Error(N(407));n=n()}else{if(n=e(),ze===null)throw Error(N(349));Lr&30||qm(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,ev(Gm.bind(null,r,o,t),[t]),r.flags|=2048,Mo(9,Jm.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=an(),e=ze.identifierPrefix;if(Me){var n=_n,r=xn;n=(r&~(1<<32-Vt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Eo++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Uk++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Wk={readContext:Lt,useCallback:ov,useContext:Lt,useEffect:$u,useImperativeHandle:iv,useInsertionEffect:tv,useLayoutEffect:nv,useMemo:sv,useReducer:Ru,useRef:Zm,useState:function(){return Ru(To)},useDebugValue:Fu,useDeferredValue:function(t){var e=It();return av(e,$e.memoizedState,t)},useTransition:function(){var t=Ru(To)[0],e=It().memoizedState;return[t,e]},useMutableSource:Km,useSyncExternalStore:Wm,useId:lv,unstable_isNewReconciler:!1},qk={readContext:Lt,useCallback:ov,useContext:Lt,useEffect:$u,useImperativeHandle:iv,useInsertionEffect:tv,useLayoutEffect:nv,useMemo:sv,useReducer:Nu,useRef:Zm,useState:function(){return Nu(To)},useDebugValue:Fu,useDeferredValue:function(t){var e=It();return $e===null?e.memoizedState=t:av(e,$e.memoizedState,t)},useTransition:function(){var t=Nu(To)[0],e=It().memoizedState;return[t,e]},useMutableSource:Km,useSyncExternalStore:Wm,useId:lv,unstable_isNewReconciler:!1};function qt(t,e){if(t&&t.defaultProps){e=Ae({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function ju(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ae({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var wa={isMounted:function(t){return(t=t._reactInternals)?Er(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=at(),i=or(t),o=En(r,i);o.payload=e,n!=null&&(o.callback=n),e=tr(t,o,i),e!==null&&(Qt(e,t,i,r),fa(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=at(),i=or(t),o=En(r,i);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=tr(t,o,i),e!==null&&(Qt(e,t,i,r),fa(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=at(),r=or(t),i=En(n,r);i.tag=2,e!=null&&(i.callback=e),e=tr(t,i,r),e!==null&&(Qt(e,t,r,n),fa(e,t,r))}};function fv(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?!po(n,r)||!po(i,o):!0}function hv(t,e,n){var r=!1,i=Xn,o=e.contextType;return typeof o=="object"&&o!==null?o=Lt(o):(i=dt(e)?Mr:Ye.current,r=e.contextTypes,o=(r=r!=null)?vi(t,i):Xn),e=new e(n,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=wa,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function pv(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&&wa.enqueueReplaceState(e,e.state,null)}function Bu(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Eu(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Lt(o):(o=dt(e)?Mr:Ye.current,i.context=vi(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(ju(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&&wa.enqueueReplaceState(i,i.state,null),ha(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Ci(t,e){try{var n="",r=e;do n+=SS(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{kc=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ji(t):""}function xS(t){switch(t.tag){case 5:return Ji(t.type);case 16:return Ji("Lazy");case 13:return Ji("Suspense");case 19:return Ji("SuspenseList");case 0:case 2:case 15:return t=xc(t.type,!1),t;case 11:return t=xc(t.type.render,!1),t;case 1:return t=xc(t.type,!0),t;default:return""}}function _c(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 ii:return"Fragment";case ri:return"Portal";case mc:return"Profiler";case gc:return"StrictMode";case yc:return"Suspense";case bc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case cg:return(t.displayName||"Context")+".Consumer";case lg:return(t._context.displayName||"Context")+".Provider";case vc:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case wc:return e=t.displayName||null,e!==null?e:_c(t.type)||"Memo";case zn:e=t._payload,t=t._init;try{return _c(t(e))}catch{}}return null}function _S(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 _c(e);case 8:return e===gc?"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 Hn(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function fg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function CS(t){var e=fg(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 Ps(t){t._valueTracker||(t._valueTracker=CS(t))}function hg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=fg(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ls(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 Cc(t,e){var n=e.checked;return Ae({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function pg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Hn(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 gg(t,e){e=e.checked,e!=null&&pc(t,"checked",e,!1)}function Ec(t,e){gg(t,e);var n=Hn(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")?Tc(t,e.type,n):e.hasOwnProperty("defaultValue")&&Tc(t,e.type,Hn(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function mg(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 Tc(t,e,n){(e!=="number"||Ls(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Gi=Array.isArray;function oi(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=""+Hn(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 Mc(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(N(91));return Ae({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function vg(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(Gi(n)){if(1<n.length)throw Error(N(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Hn(n)}}function yg(t,e){var n=Hn(e.value),r=Hn(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 bg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function wg(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 Ac(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?wg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Is,Sg=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(Is=Is||document.createElement("div"),Is.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Is.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Qi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Yi={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},ES=["Webkit","ms","Moz","O"];Object.keys(Yi).forEach(function(t){ES.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Yi[e]=Yi[t]})});function kg(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Yi.hasOwnProperty(t)&&Yi[t]?(""+e).trim():e+"px"}function xg(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=kg(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var TS=Ae({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 Oc(t,e){if(e){if(TS[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 Dc(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 Pc=null;function Lc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ic=null,si=null,ai=null;function _g(t){if(t=wo(t)){if(typeof Ic!="function")throw Error(N(280));var e=t.stateNode;e&&(e=ra(e),Ic(t.stateNode,t.type,e))}}function Cg(t){si?ai?ai.push(t):ai=[t]:si=t}function Eg(){if(si){var t=si,e=ai;if(ai=si=null,_g(t),e)for(t=0;t<e.length;t++)_g(e[t])}}function Tg(t,e){return t(e)}function Mg(){}var Rc=!1;function Ag(t,e,n){if(Rc)return t(e,n);Rc=!0;try{return Tg(t,e,n)}finally{Rc=!1,(si!==null||ai!==null)&&(Mg(),Eg())}}function Xi(t,e){var n=t.stateNode;if(n===null)return null;var r=ra(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 Nc=!1;if(bn)try{var Zi={};Object.defineProperty(Zi,"passive",{get:function(){Nc=!0}}),window.addEventListener("test",Zi,Zi),window.removeEventListener("test",Zi,Zi)}catch{Nc=!1}function MS(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 eo=!1,Rs=null,Ns=!1,$c=null,AS={onError:function(t){eo=!0,Rs=t}};function OS(t,e,n,r,i,o,s,a,l){eo=!1,Rs=null,MS.apply(AS,arguments)}function DS(t,e,n,r,i,o,s,a,l){if(OS.apply(this,arguments),eo){if(eo){var c=Rs;eo=!1,Rs=null}else throw Error(N(198));Ns||(Ns=!0,$c=c)}}function Er(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 Og(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 Dg(t){if(Er(t)!==t)throw Error(N(188))}function PS(t){var e=t.alternate;if(!e){if(e=Er(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 Dg(i),t;if(o===r)return Dg(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 Pg(t){return t=PS(t),t!==null?Lg(t):null}function Lg(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Lg(t);if(e!==null)return e;t=t.sibling}return null}var Ig=wt.unstable_scheduleCallback,Rg=wt.unstable_cancelCallback,LS=wt.unstable_shouldYield,IS=wt.unstable_requestPaint,Ie=wt.unstable_now,RS=wt.unstable_getCurrentPriorityLevel,Fc=wt.unstable_ImmediatePriority,Ng=wt.unstable_UserBlockingPriority,$s=wt.unstable_NormalPriority,NS=wt.unstable_LowPriority,$g=wt.unstable_IdlePriority,Fs=null,rn=null;function $S(t){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot(Fs,t,void 0,(t.current.flags&128)===128)}catch{}}var Vt=Math.clz32?Math.clz32:BS,FS=Math.log,jS=Math.LN2;function BS(t){return t>>>=0,t===0?32:31-(FS(t)/jS|0)|0}var js=64,Bs=4194304;function to(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 Us(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=to(a):(o&=s,o!==0&&(r=to(o)))}else s=n&~i,s!==0?r=to(s):o!==0&&(r=to(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-Vt(e),i=1<<n,r|=t[n],e&=~i;return r}function US(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 zS(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-Vt(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=US(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}function jc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Fg(){var t=js;return js<<=1,!(js&4194240)&&(js=64),t}function Bc(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function no(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Vt(e),t[e]=n}function HS(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-Vt(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}function Uc(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Vt(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var be=0;function jg(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Bg,zc,Ug,zg,Hg,Hc=!1,zs=[],Vn=null,Kn=null,Wn=null,ro=new Map,io=new Map,qn=[],VS="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 Vg(t,e){switch(t){case"focusin":case"focusout":Vn=null;break;case"dragenter":case"dragleave":Kn=null;break;case"mouseover":case"mouseout":Wn=null;break;case"pointerover":case"pointerout":ro.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":io.delete(e.pointerId)}}function oo(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=wo(e),e!==null&&zc(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function KS(t,e,n,r,i){switch(e){case"focusin":return Vn=oo(Vn,t,e,n,r,i),!0;case"dragenter":return Kn=oo(Kn,t,e,n,r,i),!0;case"mouseover":return Wn=oo(Wn,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return ro.set(o,oo(ro.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,io.set(o,oo(io.get(o)||null,t,e,n,r,i)),!0}return!1}function Kg(t){var e=Tr(t.target);if(e!==null){var n=Er(e);if(n!==null){if(e=n.tag,e===13){if(e=Og(n),e!==null){t.blockedOn=e,Hg(t.priority,function(){Ug(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 Hs(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Kc(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Pc=r,n.target.dispatchEvent(r),Pc=null}else return e=wo(n),e!==null&&zc(e),t.blockedOn=n,!1;e.shift()}return!0}function Wg(t,e,n){Hs(t)&&n.delete(e)}function WS(){Hc=!1,Vn!==null&&Hs(Vn)&&(Vn=null),Kn!==null&&Hs(Kn)&&(Kn=null),Wn!==null&&Hs(Wn)&&(Wn=null),ro.forEach(Wg),io.forEach(Wg)}function so(t,e){t.blockedOn===e&&(t.blockedOn=null,Hc||(Hc=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,WS)))}function ao(t){function e(i){return so(i,t)}if(0<zs.length){so(zs[0],t);for(var n=1;n<zs.length;n++){var r=zs[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Vn!==null&&so(Vn,t),Kn!==null&&so(Kn,t),Wn!==null&&so(Wn,t),ro.forEach(e),io.forEach(e),n=0;n<qn.length;n++)r=qn[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<qn.length&&(n=qn[0],n.blockedOn===null);)Kg(n),n.blockedOn===null&&qn.shift()}var li=wn.ReactCurrentBatchConfig,Vs=!0;function qS(t,e,n,r){var i=be,o=li.transition;li.transition=null;try{be=1,Vc(t,e,n,r)}finally{be=i,li.transition=o}}function JS(t,e,n,r){var i=be,o=li.transition;li.transition=null;try{be=4,Vc(t,e,n,r)}finally{be=i,li.transition=o}}function Vc(t,e,n,r){if(Vs){var i=Kc(t,e,n,r);if(i===null)lu(t,e,r,Ks,n),Vg(t,r);else if(KS(i,t,e,n,r))r.stopPropagation();else if(Vg(t,r),e&4&&-1<VS.indexOf(t)){for(;i!==null;){var o=wo(i);if(o!==null&&Bg(o),o=Kc(t,e,n,r),o===null&&lu(t,e,r,Ks,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else lu(t,e,r,null,n)}}var Ks=null;function Kc(t,e,n,r){if(Ks=null,t=Lc(r),t=Tr(t),t!==null)if(e=Er(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Og(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 Ks=t,null}function qg(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(RS()){case Fc:return 1;case Ng:return 4;case $s:case NS:return 16;case $g:return 536870912;default:return 16}default:return 16}}var Jn=null,Wc=null,Ws=null;function Jg(){if(Ws)return Ws;var t,e=Wc,n=e.length,r,i="value"in Jn?Jn.value:Jn.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 Ws=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 Js(){return!0}function Gg(){return!1}function St(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)?Js:Gg,this.isPropagationStopped=Gg,this}return Ae(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=Js)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Js)},persist:function(){},isPersistent:Js}),e}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qc=St(ci),lo=Ae({},ci,{view:0,detail:0}),GS=St(lo),Jc,Gc,co,Gs=Ae({},lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yc,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!==co&&(co&&t.type==="mousemove"?(Jc=t.screenX-co.screenX,Gc=t.screenY-co.screenY):Gc=Jc=0,co=t),Jc)},movementY:function(t){return"movementY"in t?t.movementY:Gc}}),Qg=St(Gs),QS=Ae({},Gs,{dataTransfer:0}),YS=St(QS),XS=Ae({},lo,{relatedTarget:0}),Qc=St(XS),ZS=Ae({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),ek=St(ZS),tk=Ae({},ci,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),nk=St(tk),rk=Ae({},ci,{data:0}),Yg=St(rk),ik={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ok={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"},sk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ak(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=sk[t])?!!e[t]:!1}function Yc(){return ak}var lk=Ae({},lo,{key:function(t){if(t.key){var e=ik[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"?ok[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yc,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}}),ck=St(lk),uk=Ae({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xg=St(uk),dk=Ae({},lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yc}),fk=St(dk),hk=Ae({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),pk=St(hk),gk=Ae({},Gs,{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}),mk=St(gk),vk=[9,13,27,32],Xc=bn&&"CompositionEvent"in window,uo=null;bn&&"documentMode"in document&&(uo=document.documentMode);var yk=bn&&"TextEvent"in window&&!uo,Zg=bn&&(!Xc||uo&&8<uo&&11>=uo),em=" ",tm=!1;function nm(t,e){switch(t){case"keyup":return vk.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ui=!1;function bk(t,e){switch(t){case"compositionend":return rm(e);case"keypress":return e.which!==32?null:(tm=!0,em);case"textInput":return t=e.data,t===em&&tm?null:t;default:return null}}function wk(t,e){if(ui)return t==="compositionend"||!Xc&&nm(t,e)?(t=Jg(),Ws=Wc=Jn=null,ui=!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 Zg&&e.locale!=="ko"?null:e.data;default:return null}}var Sk={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 im(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Sk[t.type]:e==="textarea"}function om(t,e,n,r){Cg(r),e=ea(e,"onChange"),0<e.length&&(n=new qc("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var fo=null,ho=null;function kk(t){xm(t,0)}function Qs(t){var e=gi(t);if(hg(e))return t}function xk(t,e){if(t==="change")return e}var sm=!1;if(bn){var Zc;if(bn){var eu="oninput"in document;if(!eu){var am=document.createElement("div");am.setAttribute("oninput","return;"),eu=typeof am.oninput=="function"}Zc=eu}else Zc=!1;sm=Zc&&(!document.documentMode||9<document.documentMode)}function lm(){fo&&(fo.detachEvent("onpropertychange",cm),ho=fo=null)}function cm(t){if(t.propertyName==="value"&&Qs(ho)){var e=[];om(e,ho,t,Lc(t)),Ag(kk,e)}}function _k(t,e,n){t==="focusin"?(lm(),fo=e,ho=n,fo.attachEvent("onpropertychange",cm)):t==="focusout"&&lm()}function Ck(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Qs(ho)}function Ek(t,e){if(t==="click")return Qs(e)}function Tk(t,e){if(t==="input"||t==="change")return Qs(e)}function Mk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Kt=typeof Object.is=="function"?Object.is:Mk;function po(t,e){if(Kt(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(!dc.call(e,i)||!Kt(t[i],e[i]))return!1}return!0}function um(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function dm(t,e){var n=um(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=um(n)}}function fm(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?fm(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function hm(){for(var t=window,e=Ls();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ls(t.document)}return e}function tu(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 Ak(t){var e=hm(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&fm(n.ownerDocument.documentElement,n)){if(r!==null&&tu(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=dm(n,o);var s=dm(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 Ok=bn&&"documentMode"in document&&11>=document.documentMode,di=null,nu=null,go=null,ru=!1;function pm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ru||di==null||di!==Ls(r)||(r=di,"selectionStart"in r&&tu(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}),go&&po(go,r)||(go=r,r=ea(nu,"onSelect"),0<r.length&&(e=new qc("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=di)))}function Ys(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var fi={animationend:Ys("Animation","AnimationEnd"),animationiteration:Ys("Animation","AnimationIteration"),animationstart:Ys("Animation","AnimationStart"),transitionend:Ys("Transition","TransitionEnd")},iu={},gm={};bn&&(gm=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 Xs(t){if(iu[t])return iu[t];if(!fi[t])return t;var e=fi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in gm)return iu[t]=e[n];return t}var mm=Xs("animationend"),vm=Xs("animationiteration"),ym=Xs("animationstart"),bm=Xs("transitionend"),wm=new Map,Sm="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 Gn(t,e){wm.set(t,e),Cr(e,[t])}for(var ou=0;ou<Sm.length;ou++){var su=Sm[ou],Dk=su.toLowerCase(),Pk=su[0].toUpperCase()+su.slice(1);Gn(Dk,"on"+Pk)}Gn(mm,"onAnimationEnd"),Gn(vm,"onAnimationIteration"),Gn(ym,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(bm,"onTransitionEnd"),ni("onMouseEnter",["mouseout","mouseover"]),ni("onMouseLeave",["mouseout","mouseover"]),ni("onPointerEnter",["pointerout","pointerover"]),ni("onPointerLeave",["pointerout","pointerover"]),Cr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Cr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Cr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Cr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Cr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Cr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mo="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(" "),Lk=new Set("cancel close invalid load scroll toggle".split(" ").concat(mo));function km(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,DS(r,e,void 0,t),t.currentTarget=null}function xm(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;km(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;km(i,a,c),o=l}}}if(Ns)throw t=$c,Ns=!1,$c=null,t}function Ee(t,e){var n=e[pu];n===void 0&&(n=e[pu]=new Set);var r=t+"__bubble";n.has(r)||(_m(e,t,2,!1),n.add(r))}function au(t,e,n){var r=0;e&&(r|=4),_m(n,t,r,e)}var Zs="_reactListening"+Math.random().toString(36).slice(2);function vo(t){if(!t[Zs]){t[Zs]=!0,og.forEach(function(n){n!=="selectionchange"&&(Lk.has(n)||au(n,!1,t),au(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Zs]||(e[Zs]=!0,au("selectionchange",!1,e))}}function _m(t,e,n,r){switch(qg(e)){case 1:var i=qS;break;case 4:i=JS;break;default:i=Vc}n=i.bind(null,e,n,t),i=void 0,!Nc||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 lu(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=Tr(a),s===null)return;if(l=s.tag,l===5||l===6){r=o=s;continue e}a=a.parentNode}}r=r.return}Ag(function(){var c=o,d=Lc(n),f=[];e:{var h=wm.get(t);if(h!==void 0){var b=qc,y=t;switch(t){case"keypress":if(qs(n)===0)break e;case"keydown":case"keyup":b=ck;break;case"focusin":y="focus",b=Qc;break;case"focusout":y="blur",b=Qc;break;case"beforeblur":case"afterblur":b=Qc;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":b=Qg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":b=YS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":b=fk;break;case mm:case vm:case ym:b=ek;break;case bm:b=pk;break;case"scroll":b=GS;break;case"wheel":b=mk;break;case"copy":case"cut":case"paste":b=nk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":b=Xg}var v=(e&4)!==0,S=!v&&t==="scroll",m=v?h!==null?h+"Capture":null:h;v=[];for(var w=c,k;w!==null;){k=w;var C=k.stateNode;if(k.tag===5&&C!==null&&(k=C,m!==null&&(C=Xi(w,m),C!=null&&v.push(yo(w,C,k)))),S)break;w=w.return}0<v.length&&(h=new b(h,y,null,n,d),f.push({event:h,listeners:v}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",b=t==="mouseout"||t==="pointerout",h&&n!==Pc&&(y=n.relatedTarget||n.fromElement)&&(Tr(y)||y[Sn]))break e;if((b||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,b?(y=n.relatedTarget||n.toElement,b=c,y=y?Tr(y):null,y!==null&&(S=Er(y),y!==S||y.tag!==5&&y.tag!==6)&&(y=null)):(b=null,y=c),b!==y)){if(v=Qg,C="onMouseLeave",m="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(v=Xg,C="onPointerLeave",m="onPointerEnter",w="pointer"),S=b==null?h:gi(b),k=y==null?h:gi(y),h=new v(C,w+"leave",b,n,d),h.target=S,h.relatedTarget=k,C=null,Tr(d)===c&&(v=new v(m,w+"enter",y,n,d),v.target=k,v.relatedTarget=S,C=v),S=C,b&&y)t:{for(v=b,m=y,w=0,k=v;k;k=hi(k))w++;for(k=0,C=m;C;C=hi(C))k++;for(;0<w-k;)v=hi(v),w--;for(;0<k-w;)m=hi(m),k--;for(;w--;){if(v===m||m!==null&&v===m.alternate)break t;v=hi(v),m=hi(m)}v=null}else v=null;b!==null&&Cm(f,h,b,v,!1),y!==null&&S!==null&&Cm(f,S,y,v,!0)}}e:{if(h=c?gi(c):window,b=h.nodeName&&h.nodeName.toLowerCase(),b==="select"||b==="input"&&h.type==="file")var M=xk;else if(im(h))if(sm)M=Tk;else{M=Ck;var O=_k}else(b=h.nodeName)&&b.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(M=Ek);if(M&&(M=M(t,c))){om(f,M,n,d);break e}O&&O(t,h,c),t==="focusout"&&(O=h._wrapperState)&&O.controlled&&h.type==="number"&&Tc(h,"number",h.value)}switch(O=c?gi(c):window,t){case"focusin":(im(O)||O.contentEditable==="true")&&(di=O,nu=c,go=null);break;case"focusout":go=nu=di=null;break;case"mousedown":ru=!0;break;case"contextmenu":case"mouseup":case"dragend":ru=!1,pm(f,n,d);break;case"selectionchange":if(Ok)break;case"keydown":case"keyup":pm(f,n,d)}var D;if(Xc)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 ui?nm(t,n)&&(F="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(F="onCompositionStart");F&&(Zg&&n.locale!=="ko"&&(ui||F!=="onCompositionStart"?F==="onCompositionEnd"&&ui&&(D=Jg()):(Jn=d,Wc="value"in Jn?Jn.value:Jn.textContent,ui=!0)),O=ea(c,F),0<O.length&&(F=new Yg(F,t,null,n,d),f.push({event:F,listeners:O}),D?F.data=D:(D=rm(n),D!==null&&(F.data=D)))),(D=yk?bk(t,n):wk(t,n))&&(c=ea(c,"onBeforeInput"),0<c.length&&(d=new Yg("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:c}),d.data=D))}xm(f,e)})}function yo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function ea(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=Xi(t,n),o!=null&&r.unshift(yo(t,o,i)),o=Xi(t,e),o!=null&&r.push(yo(t,o,i))),t=t.return}return r}function hi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Cm(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=Xi(n,o),l!=null&&s.unshift(yo(n,l,a))):i||(l=Xi(n,o),l!=null&&s.push(yo(n,l,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var Ik=/\r\n?/g,Rk=/\u0000|\uFFFD/g;function Em(t){return(typeof t=="string"?t:""+t).replace(Ik,`
|
|
372
|
+
`).replace(Rk,"")}function ta(t,e,n){if(e=Em(e),Em(t)!==e&&n)throw Error(N(425))}function na(){}var cu=null,uu=null;function du(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 fu=typeof setTimeout=="function"?setTimeout:void 0,Nk=typeof clearTimeout=="function"?clearTimeout:void 0,Tm=typeof Promise=="function"?Promise:void 0,$k=typeof queueMicrotask=="function"?queueMicrotask:typeof Tm<"u"?function(t){return Tm.resolve(null).then(t).catch(Fk)}:fu;function Fk(t){setTimeout(function(){throw t})}function hu(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),ao(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);ao(e)}function Qn(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 Mm(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 pi=Math.random().toString(36).slice(2),on="__reactFiber$"+pi,bo="__reactProps$"+pi,Sn="__reactContainer$"+pi,pu="__reactEvents$"+pi,jk="__reactListeners$"+pi,Bk="__reactHandles$"+pi;function Tr(t){var e=t[on];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Sn]||n[on]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Mm(t);t!==null;){if(n=t[on])return n;t=Mm(t)}return e}t=n,n=t.parentNode}return null}function wo(t){return t=t[on]||t[Sn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function gi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(N(33))}function ra(t){return t[bo]||null}var gu=[],mi=-1;function Yn(t){return{current:t}}function Te(t){0>mi||(t.current=gu[mi],gu[mi]=null,mi--)}function Ce(t,e){mi++,gu[mi]=t.current,t.current=e}var Xn={},Ye=Yn(Xn),ut=Yn(!1),Mr=Xn;function vi(t,e){var n=t.type.contextTypes;if(!n)return Xn;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 dt(t){return t=t.childContextTypes,t!=null}function ia(){Te(ut),Te(Ye)}function Am(t,e,n){if(Ye.current!==Xn)throw Error(N(168));Ce(Ye,e),Ce(ut,n)}function Om(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,_S(t)||"Unknown",i));return Ae({},n,r)}function oa(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Xn,Mr=Ye.current,Ce(Ye,t),Ce(ut,ut.current),!0}function Dm(t,e,n){var r=t.stateNode;if(!r)throw Error(N(169));n?(t=Om(t,e,Mr),r.__reactInternalMemoizedMergedChildContext=t,Te(ut),Te(Ye),Ce(Ye,t)):Te(ut),Ce(ut,n)}var kn=null,sa=!1,mu=!1;function Pm(t){kn===null?kn=[t]:kn.push(t)}function Uk(t){sa=!0,Pm(t)}function Zn(){if(!mu&&kn!==null){mu=!0;var t=0,e=be;try{var n=kn;for(be=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}kn=null,sa=!1}catch(i){throw kn!==null&&(kn=kn.slice(t+1)),Ig(Fc,Zn),i}finally{be=e,mu=!1}}return null}var yi=[],bi=0,aa=null,la=0,Dt=[],Pt=0,Ar=null,xn=1,_n="";function Or(t,e){yi[bi++]=la,yi[bi++]=aa,aa=t,la=e}function Lm(t,e,n){Dt[Pt++]=xn,Dt[Pt++]=_n,Dt[Pt++]=Ar,Ar=t;var r=xn;t=_n;var i=32-Vt(r)-1;r&=~(1<<i),n+=1;var o=32-Vt(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,xn=1<<32-Vt(e)+i|n<<i|r,_n=o+t}else xn=1<<o|n<<i|r,_n=t}function vu(t){t.return!==null&&(Or(t,1),Lm(t,1,0))}function yu(t){for(;t===aa;)aa=yi[--bi],yi[bi]=null,la=yi[--bi],yi[bi]=null;for(;t===Ar;)Ar=Dt[--Pt],Dt[Pt]=null,_n=Dt[--Pt],Dt[Pt]=null,xn=Dt[--Pt],Dt[Pt]=null}var kt=null,xt=null,Me=!1,Wt=null;function Im(t,e){var n=Nt(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 Rm(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,kt=t,xt=Qn(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,kt=t,xt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Ar!==null?{id:xn,overflow:_n}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Nt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,kt=t,xt=null,!0):!1;default:return!1}}function bu(t){return(t.mode&1)!==0&&(t.flags&128)===0}function wu(t){if(Me){var e=xt;if(e){var n=e;if(!Rm(t,e)){if(bu(t))throw Error(N(418));e=Qn(n.nextSibling);var r=kt;e&&Rm(t,e)?Im(r,n):(t.flags=t.flags&-4097|2,Me=!1,kt=t)}}else{if(bu(t))throw Error(N(418));t.flags=t.flags&-4097|2,Me=!1,kt=t}}}function Nm(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;kt=t}function ca(t){if(t!==kt)return!1;if(!Me)return Nm(t),Me=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!du(t.type,t.memoizedProps)),e&&(e=xt)){if(bu(t))throw $m(),Error(N(418));for(;e;)Im(t,e),e=Qn(e.nextSibling)}if(Nm(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){xt=Qn(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}xt=null}}else xt=kt?Qn(t.stateNode.nextSibling):null;return!0}function $m(){for(var t=xt;t;)t=Qn(t.nextSibling)}function wi(){xt=kt=null,Me=!1}function Su(t){Wt===null?Wt=[t]:Wt.push(t)}var zk=wn.ReactCurrentBatchConfig;function So(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 ua(t,e){throw t=Object.prototype.toString.call(e),Error(N(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Fm(t){var e=t._init;return e(t._payload)}function jm(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=ar(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=fd(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===ii?d(m,w,k.props.children,C,k.key):w!==null&&(w.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===zn&&Fm(M)===w.type)?(C=i(w,k.props),C.ref=So(m,w,k),C.return=m,C):(C=Ia(k.type,k.key,k.props,null,m.mode,C),C.ref=So(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=hd(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=Fr(k,m.mode,C,M),w.return=m,w):(w=i(w,k),w.return=m,w)}function f(m,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=fd(""+w,m.mode,k),w.return=m,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ds:return k=Ia(w.type,w.key,w.props,null,m.mode,k),k.ref=So(m,null,w),k.return=m,k;case ri:return w=hd(w,m.mode,k),w.return=m,w;case zn:var C=w._init;return f(m,C(w._payload),k)}if(Gi(w)||qi(w))return w=Fr(w,m.mode,k,null),w.return=m,w;ua(m,w)}return null}function h(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 Ds:return k.key===M?l(m,w,k,C):null;case ri:return k.key===M?c(m,w,k,C):null;case zn:return M=k._init,h(m,w,M(k._payload),C)}if(Gi(k)||qi(k))return M!==null?null:d(m,w,k,C,null);ua(m,k)}return null}function b(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 Ds:return m=m.get(C.key===null?k:C.key)||null,l(w,m,C,M);case ri:return m=m.get(C.key===null?k:C.key)||null,c(w,m,C,M);case zn:var O=C._init;return b(m,w,k,O(C._payload),M)}if(Gi(C)||qi(C))return m=m.get(k)||null,d(w,m,C,M,null);ua(w,C)}return null}function y(m,w,k,C){for(var M=null,O=null,D=w,F=w=0,J=null;D!==null&&F<k.length;F++){D.index>F?(J=D,D=null):J=D.sibling;var W=h(m,D,k[F],C);if(W===null){D===null&&(D=J);break}t&&D&&W.alternate===null&&e(m,D),w=o(W,w,F),O===null?M=W:O.sibling=W,O=W,D=J}if(F===k.length)return n(m,D),Me&&Or(m,F),M;if(D===null){for(;F<k.length;F++)D=f(m,k[F],C),D!==null&&(w=o(D,w,F),O===null?M=D:O.sibling=D,O=D);return Me&&Or(m,F),M}for(D=r(m,D);F<k.length;F++)J=b(D,m,F,k[F],C),J!==null&&(t&&J.alternate!==null&&D.delete(J.key===null?F:J.key),w=o(J,w,F),O===null?M=J:O.sibling=J,O=J);return t&&D.forEach(function(U){return e(m,U)}),Me&&Or(m,F),M}function v(m,w,k,C){var M=qi(k);if(typeof M!="function")throw Error(N(150));if(k=M.call(k),k==null)throw Error(N(151));for(var O=M=null,D=w,F=w=0,J=null,W=k.next();D!==null&&!W.done;F++,W=k.next()){D.index>F?(J=D,D=null):J=D.sibling;var U=h(m,D,W.value,C);if(U===null){D===null&&(D=J);break}t&&D&&U.alternate===null&&e(m,D),w=o(U,w,F),O===null?M=U:O.sibling=U,O=U,D=J}if(W.done)return n(m,D),Me&&Or(m,F),M;if(D===null){for(;!W.done;F++,W=k.next())W=f(m,W.value,C),W!==null&&(w=o(W,w,F),O===null?M=W:O.sibling=W,O=W);return Me&&Or(m,F),M}for(D=r(m,D);!W.done;F++,W=k.next())W=b(D,m,F,W.value,C),W!==null&&(t&&W.alternate!==null&&D.delete(W.key===null?F:W.key),w=o(W,w,F),O===null?M=W:O.sibling=W,O=W);return t&&D.forEach(function(V){return e(m,V)}),Me&&Or(m,F),M}function S(m,w,k,C){if(typeof k=="object"&&k!==null&&k.type===ii&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Ds:e:{for(var M=k.key,O=w;O!==null;){if(O.key===M){if(M=k.type,M===ii){if(O.tag===7){n(m,O.sibling),w=i(O,k.props.children),w.return=m,m=w;break e}}else if(O.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===zn&&Fm(M)===O.type){n(m,O.sibling),w=i(O,k.props),w.ref=So(m,O,k),w.return=m,m=w;break e}n(m,O);break}else e(m,O);O=O.sibling}k.type===ii?(w=Fr(k.props.children,m.mode,C,k.key),w.return=m,m=w):(C=Ia(k.type,k.key,k.props,null,m.mode,C),C.ref=So(m,w,k),C.return=m,m=C)}return s(m);case ri:e:{for(O=k.key;w!==null;){if(w.key===O)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=hd(k,m.mode,C),w.return=m,m=w}return s(m);case zn:return O=k._init,S(m,w,O(k._payload),C)}if(Gi(k))return y(m,w,k,C);if(qi(k))return v(m,w,k,C);ua(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=fd(k,m.mode,C),w.return=m,m=w),s(m)):n(m,w)}return S}var Si=jm(!0),Bm=jm(!1),da=Yn(null),fa=null,ki=null,ku=null;function xu(){ku=ki=fa=null}function _u(t){var e=da.current;Te(da),t._currentValue=e}function Cu(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 xi(t,e){fa=t,ku=ki=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(ft=!0),t.firstContext=null)}function Lt(t){var e=t._currentValue;if(ku!==t)if(t={context:t,memoizedValue:e,next:null},ki===null){if(fa===null)throw Error(N(308));ki=t,fa.dependencies={lanes:0,firstContext:t}}else ki=ki.next=t;return e}var Dr=null;function Eu(t){Dr===null?Dr=[t]:Dr.push(t)}function Um(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Eu(e)):(n.next=i.next,i.next=n),e.interleaved=n,Cn(t,r)}function Cn(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 er=!1;function Tu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function zm(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 En(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function tr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ge&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Cn(t,n)}return i=r.interleaved,i===null?(e.next=e,Eu(r)):(e.next=i.next,i.next=e),r.interleaved=e,Cn(t,n)}function ha(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,Uc(t,n)}}function Hm(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 pa(t,e,n,r){var i=t.updateQueue;er=!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 f=i.baseState;s=0,d=c=l=null,a=o;do{var h=a.lane,b=a.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:b,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=t,v=a;switch(h=e,b=n,v.tag){case 1:if(y=v.payload,typeof y=="function"){f=y.call(b,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,h=typeof y=="function"?y.call(b,f,h):y,h==null)break e;f=Ae({},f,h);break e;case 2:er=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else b={eventTime:b,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=b,l=f):d=d.next=b,s|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),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);Ir|=s,t.lanes=s,t.memoizedState=f}}function Vm(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 ko={},sn=Yn(ko),xo=Yn(ko),_o=Yn(ko);function Pr(t){if(t===ko)throw Error(N(174));return t}function Mu(t,e){switch(Ce(_o,e),Ce(xo,t),Ce(sn,ko),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ac(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ac(e,t)}Te(sn),Ce(sn,e)}function _i(){Te(sn),Te(xo),Te(_o)}function Km(t){Pr(_o.current);var e=Pr(sn.current),n=Ac(e,t.type);e!==n&&(Ce(xo,t),Ce(sn,n))}function Au(t){xo.current===t&&(Te(sn),Te(xo))}var Oe=Yn(0);function ga(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 Ou=[];function Du(){for(var t=0;t<Ou.length;t++)Ou[t]._workInProgressVersionPrimary=null;Ou.length=0}var ma=wn.ReactCurrentDispatcher,Pu=wn.ReactCurrentBatchConfig,Lr=0,De=null,$e=null,Ue=null,va=!1,Co=!1,Eo=0,Hk=0;function Xe(){throw Error(N(321))}function Lu(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Kt(t[n],e[n]))return!1;return!0}function Iu(t,e,n,r,i,o){if(Lr=o,De=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ma.current=t===null||t.memoizedState===null?qk:Jk,t=n(r,i),Co){o=0;do{if(Co=!1,Eo=0,25<=o)throw Error(N(301));o+=1,Ue=$e=null,e.updateQueue=null,ma.current=Gk,t=n(r,i)}while(Co)}if(ma.current=wa,e=$e!==null&&$e.next!==null,Lr=0,Ue=$e=De=null,va=!1,e)throw Error(N(300));return t}function Ru(){var t=Eo!==0;return Eo=0,t}function an(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ue===null?De.memoizedState=Ue=t:Ue=Ue.next=t,Ue}function It(){if($e===null){var t=De.alternate;t=t!==null?t.memoizedState:null}else t=$e.next;var e=Ue===null?De.memoizedState:Ue.next;if(e!==null)Ue=e,$e=t;else{if(t===null)throw Error(N(310));$e=t,t={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},Ue===null?De.memoizedState=Ue=t:Ue=Ue.next=t}return Ue}function To(t,e){return typeof e=="function"?e(t):e}function Nu(t){var e=It(),n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=t;var r=$e,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((Lr&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 f={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,s=r):l=l.next=f,De.lanes|=d,Ir|=d}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,Kt(r,e.memoizedState)||(ft=!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,De.lanes|=o,Ir|=o,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function $u(t){var e=It(),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);Kt(o,e.memoizedState)||(ft=!0),e.memoizedState=o,e.baseQueue===null&&(e.baseState=o),n.lastRenderedState=o}return[o,r]}function Wm(){}function qm(t,e){var n=De,r=It(),i=e(),o=!Kt(r.memoizedState,i);if(o&&(r.memoizedState=i,ft=!0),r=r.queue,Fu(Qm.bind(null,n,r,t),[t]),r.getSnapshot!==e||o||Ue!==null&&Ue.memoizedState.tag&1){if(n.flags|=2048,Mo(9,Gm.bind(null,n,r,i,e),void 0,null),ze===null)throw Error(N(349));Lr&30||Jm(n,e,i)}return i}function Jm(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=De.updateQueue,e===null?(e={lastEffect:null,stores:null},De.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Gm(t,e,n,r){e.value=n,e.getSnapshot=r,Ym(e)&&Xm(t)}function Qm(t,e,n){return n(function(){Ym(e)&&Xm(t)})}function Ym(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Kt(t,n)}catch{return!0}}function Xm(t){var e=Cn(t,1);e!==null&&Qt(e,t,1,-1)}function Zm(t){var e=an();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:To,lastRenderedState:t},e.queue=t,t=t.dispatch=Wk.bind(null,De,t),[e.memoizedState,t]}function Mo(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=De.updateQueue,e===null?(e={lastEffect:null,stores:null},De.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 ev(){return It().memoizedState}function ya(t,e,n,r){var i=an();De.flags|=t,i.memoizedState=Mo(1|e,n,void 0,r===void 0?null:r)}function ba(t,e,n,r){var i=It();r=r===void 0?null:r;var o=void 0;if($e!==null){var s=$e.memoizedState;if(o=s.destroy,r!==null&&Lu(r,s.deps)){i.memoizedState=Mo(e,n,o,r);return}}De.flags|=t,i.memoizedState=Mo(1|e,n,o,r)}function tv(t,e){return ya(8390656,8,t,e)}function Fu(t,e){return ba(2048,8,t,e)}function nv(t,e){return ba(4,2,t,e)}function rv(t,e){return ba(4,4,t,e)}function iv(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 ov(t,e,n){return n=n!=null?n.concat([t]):null,ba(4,4,iv.bind(null,e,t),n)}function ju(){}function sv(t,e){var n=It();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Lu(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function av(t,e){var n=It();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Lu(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function lv(t,e,n){return Lr&21?(Kt(n,e)||(n=Fg(),De.lanes|=n,Ir|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,ft=!0),t.memoizedState=n)}function Vk(t,e){var n=be;be=n!==0&&4>n?n:4,t(!0);var r=Pu.transition;Pu.transition={};try{t(!1),e()}finally{be=n,Pu.transition=r}}function cv(){return It().memoizedState}function Kk(t,e,n){var r=or(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},uv(t))dv(e,n);else if(n=Um(t,e,n,r),n!==null){var i=at();Qt(n,t,r,i),fv(n,e,r)}}function Wk(t,e,n){var r=or(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(uv(t))dv(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,Kt(a,s)){var l=e.interleaved;l===null?(i.next=i,Eu(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Um(t,e,i,r),n!==null&&(i=at(),Qt(n,t,r,i),fv(n,e,r))}}function uv(t){var e=t.alternate;return t===De||e!==null&&e===De}function dv(t,e){Co=va=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function fv(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Uc(t,n)}}var wa={readContext:Lt,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useInsertionEffect:Xe,useLayoutEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useMutableSource:Xe,useSyncExternalStore:Xe,useId:Xe,unstable_isNewReconciler:!1},qk={readContext:Lt,useCallback:function(t,e){return an().memoizedState=[t,e===void 0?null:e],t},useContext:Lt,useEffect:tv,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,ya(4194308,4,iv.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ya(4194308,4,t,e)},useInsertionEffect:function(t,e){return ya(4,2,t,e)},useMemo:function(t,e){var n=an();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=an();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=Kk.bind(null,De,t),[r.memoizedState,t]},useRef:function(t){var e=an();return t={current:t},e.memoizedState=t},useState:Zm,useDebugValue:ju,useDeferredValue:function(t){return an().memoizedState=t},useTransition:function(){var t=Zm(!1),e=t[0];return t=Vk.bind(null,t[1]),an().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=De,i=an();if(Me){if(n===void 0)throw Error(N(407));n=n()}else{if(n=e(),ze===null)throw Error(N(349));Lr&30||Jm(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,tv(Qm.bind(null,r,o,t),[t]),r.flags|=2048,Mo(9,Gm.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=an(),e=ze.identifierPrefix;if(Me){var n=_n,r=xn;n=(r&~(1<<32-Vt(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Eo++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=Hk++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Jk={readContext:Lt,useCallback:sv,useContext:Lt,useEffect:Fu,useImperativeHandle:ov,useInsertionEffect:nv,useLayoutEffect:rv,useMemo:av,useReducer:Nu,useRef:ev,useState:function(){return Nu(To)},useDebugValue:ju,useDeferredValue:function(t){var e=It();return lv(e,$e.memoizedState,t)},useTransition:function(){var t=Nu(To)[0],e=It().memoizedState;return[t,e]},useMutableSource:Wm,useSyncExternalStore:qm,useId:cv,unstable_isNewReconciler:!1},Gk={readContext:Lt,useCallback:sv,useContext:Lt,useEffect:Fu,useImperativeHandle:ov,useInsertionEffect:nv,useLayoutEffect:rv,useMemo:av,useReducer:$u,useRef:ev,useState:function(){return $u(To)},useDebugValue:ju,useDeferredValue:function(t){var e=It();return $e===null?e.memoizedState=t:lv(e,$e.memoizedState,t)},useTransition:function(){var t=$u(To)[0],e=It().memoizedState;return[t,e]},useMutableSource:Wm,useSyncExternalStore:qm,useId:cv,unstable_isNewReconciler:!1};function qt(t,e){if(t&&t.defaultProps){e=Ae({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Bu(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ae({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Sa={isMounted:function(t){return(t=t._reactInternals)?Er(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=at(),i=or(t),o=En(r,i);o.payload=e,n!=null&&(o.callback=n),e=tr(t,o,i),e!==null&&(Qt(e,t,i,r),ha(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=at(),i=or(t),o=En(r,i);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=tr(t,o,i),e!==null&&(Qt(e,t,i,r),ha(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=at(),r=or(t),i=En(n,r);i.tag=2,e!=null&&(i.callback=e),e=tr(t,i,r),e!==null&&(Qt(e,t,r,n),ha(e,t,r))}};function hv(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?!po(n,r)||!po(i,o):!0}function pv(t,e,n){var r=!1,i=Xn,o=e.contextType;return typeof o=="object"&&o!==null?o=Lt(o):(i=dt(e)?Mr:Ye.current,r=e.contextTypes,o=(r=r!=null)?vi(t,i):Xn),e=new e(n,o),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Sa,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function gv(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&&Sa.enqueueReplaceState(e,e.state,null)}function Uu(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Tu(t);var o=e.contextType;typeof o=="object"&&o!==null?i.context=Lt(o):(o=dt(e)?Mr:Ye.current,i.context=vi(t,o)),i.state=t.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(Bu(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&&Sa.enqueueReplaceState(i,i.state,null),pa(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Ci(t,e){try{var n="",r=e;do n+=xS(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 Uu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function zu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Jk=typeof WeakMap=="function"?WeakMap:Map;function gv(t,e,n){n=En(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ta||(Ta=!0,rd=r),zu(t,e)},n}function mv(t,e,n){n=En(-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(){zu(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){zu(t,e),typeof r!="function"&&(rr===null?rr=new Set([this]):rr.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function vv(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Jk;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=lx.bind(null,t,e,n),e.then(t,t))}function yv(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 bv(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=En(-1,1),e.tag=2,tr(n,e,1))),n.lanes|=1),t)}var Gk=wn.ReactCurrentOwner,ft=!1;function st(t,e,n,r){e.child=t===null?jm(e,null,n,r):Si(e,t.child,n,r)}function wv(t,e,n,r,i){n=n.render;var o=e.ref;return xi(e,i),r=Lu(t,e,n,r,o,i),n=Iu(),t!==null&&!ft?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(Me&&n&&mu(e),e.flags|=1,st(t,e,r,i),e.child)}function Sv(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!ud(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,kv(t,e,o,r,i)):(t=La(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:po,n(s,r)&&t.ref===e.ref)return Tn(t,e,i)}return e.flags|=1,t=ar(o,r),t.ref=e.ref,t.return=e,e.child=t}function kv(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(po(o,r)&&t.ref===e.ref)if(ft=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(ft=!0);else return e.lanes=t.lanes,Tn(t,e,i)}return Hu(t,e,n,r,i)}function xv(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},Ce(Ti,_t),_t|=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,Ce(Ti,_t),_t|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,Ce(Ti,_t),_t|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,Ce(Ti,_t),_t|=r;return st(t,e,i,n),e.child}function _v(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Hu(t,e,n,r,i){var o=dt(n)?Mr:Ye.current;return o=vi(e,o),xi(e,i),n=Lu(t,e,n,r,o,i),r=Iu(),t!==null&&!ft?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(Me&&r&&mu(e),e.flags|=1,st(t,e,n,i),e.child)}function Cv(t,e,n,r,i){if(dt(n)){var o=!0;ia(e)}else o=!1;if(xi(e,i),e.stateNode===null)ka(t,e),hv(e,n,r),Bu(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=Lt(c):(c=dt(n)?Mr:Ye.current,c=vi(e,c));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&pv(e,s,r,c),er=!1;var h=e.memoizedState;s.state=h,ha(e,r,s,i),l=e.memoizedState,a!==r||h!==l||ut.current||er?(typeof d=="function"&&(ju(e,n,d,r),l=e.memoizedState),(a=er||fv(e,n,a,r,h,l,c))?(f||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,Um(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:qt(e.type,a),s.props=c,f=e.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Lt(l):(l=dt(n)?Mr:Ye.current,l=vi(e,l));var b=n.getDerivedStateFromProps;(d=typeof b=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||h!==l)&&pv(e,s,r,l),er=!1,h=e.memoizedState,s.state=h,ha(e,r,s,i);var y=e.memoizedState;a!==f||h!==y||ut.current||er?(typeof b=="function"&&(ju(e,n,b,r),y=e.memoizedState),(c=er||fv(e,n,c,r,h,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&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===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&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return Vu(t,e,n,r,o,i)}function Vu(t,e,n,r,i,o){_v(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&Om(e,n,!1),Tn(t,e,o);r=e.stateNode,Gk.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=Si(e,t.child,null,o),e.child=Si(e,null,a,o)):st(t,e,a,o),e.memoizedState=r.state,i&&Om(e,n,!0),e.child}function Ev(t){var e=t.stateNode;e.pendingContext?Mm(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Mm(t,e.context,!1),Tu(t,e.containerInfo)}function Tv(t,e,n,r,i){return wi(),wu(i),e.flags|=256,st(t,e,n,r),e.child}var Ku={dehydrated:null,treeContext:null,retryLane:0};function Wu(t){return{baseLanes:t,cachePool:null,transitions:null}}function Mv(t,e,n){var r=e.pendingProps,i=Oe.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),Ce(Oe,i&1),t===null)return bu(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=Ia(s,r,0,null),t=Fr(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Wu(n),e.memoizedState=Ku,t):qu(e,s));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Qk(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=ar(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?o=ar(a,o):(o=Fr(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?Wu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=Ku,r}return o=t.child,t=o.sibling,r=ar(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 qu(t,e){return e=Ia({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Sa(t,e,n,r){return r!==null&&wu(r),Si(e,t.child,null,n),t=qu(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Qk(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=Uu(Error(N(422))),Sa(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Ia({mode:"visible",children:r.children},i,0,null),o=Fr(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&Si(e,t.child,null,s),e.child.memoizedState=Wu(s),e.memoizedState=Ku,o);if(!(e.mode&1))return Sa(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=Uu(o,r,void 0),Sa(t,e,s,r)}if(a=(s&t.childLanes)!==0,ft||a){if(r=ze,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,Cn(t,i),Qt(r,t,i,-1))}return cd(),r=Uu(Error(N(421))),Sa(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=cx.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,xt=Qn(i.nextSibling),kt=e,Me=!0,Wt=null,t!==null&&(Dt[Pt++]=xn,Dt[Pt++]=_n,Dt[Pt++]=Ar,xn=t.id,_n=t.overflow,Ar=e),e=qu(e,r.children),e.flags|=4096,e)}function Av(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),_u(t.return,e,n)}function Ju(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 Ov(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(st(t,e,r.children,n),r=Oe.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&&Av(t,n,e);else if(t.tag===19)Av(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(Ce(Oe,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&&pa(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Ju(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&&pa(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Ju(e,!0,n,null,o);break;case"together":Ju(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ka(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Tn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Ir|=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=ar(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=ar(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Yk(t,e,n){switch(e.tag){case 3:Ev(e),wi();break;case 5:Vm(e);break;case 1:dt(e.type)&&ia(e);break;case 4:Tu(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Ce(ua,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Ce(Oe,Oe.current&1),e.flags|=128,null):n&e.child.childLanes?Mv(t,e,n):(Ce(Oe,Oe.current&1),t=Tn(t,e,n),t!==null?t.sibling:null);Ce(Oe,Oe.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Ov(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ce(Oe,Oe.current),r)break;return null;case 22:case 23:return e.lanes=0,xv(t,e,n)}return Tn(t,e,n)}var Dv,Gu,Pv,Lv;Dv=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}},Gu=function(){},Pv=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Pr(sn.current);var o=null;switch(n){case"input":i=_c(t,i),r=_c(t,r),o=[];break;case"select":i=Ae({},i,{value:void 0}),r=Ae({},r,{value:void 0}),o=[];break;case"textarea":i=Tc(t,i),r=Tc(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=ta)}Ac(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"&&(Wi.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"&&(Wi.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ee("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)}},Lv=function(t,e,n,r){n!==r&&(e.flags|=4)};function Ao(t,e){if(!Me)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 Ze(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 Xk(t,e,n){var r=e.pendingProps;switch(vu(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(e),null;case 1:return dt(e.type)&&ra(),Ze(e),null;case 3:return r=e.stateNode,_i(),Te(ut),Te(Ye),Ou(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(la(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Wt!==null&&(sd(Wt),Wt=null))),Gu(t,e),Ze(e),null;case 5:Mu(e);var i=Pr(_o.current);if(n=e.type,t!==null&&e.stateNode!=null)Pv(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 Ze(e),null}if(t=Pr(sn.current),la(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[on]=e,r[bo]=o,t=(e.mode&1)!==0,n){case"dialog":Ee("cancel",r),Ee("close",r);break;case"iframe":case"object":case"embed":Ee("load",r);break;case"video":case"audio":for(i=0;i<mo.length;i++)Ee(mo[i],r);break;case"source":Ee("error",r);break;case"img":case"image":case"link":Ee("error",r),Ee("load",r);break;case"details":Ee("toggle",r);break;case"input":hg(r,o),Ee("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Ee("invalid",r);break;case"textarea":mg(r,o),Ee("invalid",r)}Ac(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&&ea(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&ea(r.textContent,a,t),i=["children",""+a]):Wi.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ee("scroll",r)}switch(n){case"input":Ds(r),gg(r,o,!0);break;case"textarea":Ds(r),yg(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=ta)}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=bg(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[on]=e,t[bo]=r,Dv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Oc(n,r),n){case"dialog":Ee("cancel",t),Ee("close",t),i=r;break;case"iframe":case"object":case"embed":Ee("load",t),i=r;break;case"video":case"audio":for(i=0;i<mo.length;i++)Ee(mo[i],t);i=r;break;case"source":Ee("error",t),i=r;break;case"img":case"image":case"link":Ee("error",t),Ee("load",t),i=r;break;case"details":Ee("toggle",t),i=r;break;case"input":hg(t,r),i=_c(t,r),Ee("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Ae({},r,{value:void 0}),Ee("invalid",t);break;case"textarea":mg(t,r),i=Tc(t,r),Ee("invalid",t);break;default:i=r}Ac(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?kg(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&wg(t,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Qi(t,l):typeof l=="number"&&Qi(t,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Wi.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Ee("scroll",t):l!=null&&hc(t,o,l,s))}switch(n){case"input":Ds(t),gg(t,r,!1);break;case"textarea":Ds(t),yg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Hn(r.value));break;case"select":t.multiple=!!r.multiple,o=r.value,o!=null?oi(t,!!r.multiple,o,!1):r.defaultValue!=null&&oi(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=ta)}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 Ze(e),null;case 6:if(t&&e.stateNode!=null)Lv(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(N(166));if(n=Pr(_o.current),Pr(sn.current),la(e)){if(r=e.stateNode,n=e.memoizedProps,r[on]=e,(o=r.nodeValue!==n)&&(t=kt,t!==null))switch(t.tag){case 3:ea(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ea(r.nodeValue,n,(t.mode&1)!==0)}o&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[on]=e,e.stateNode=r}return Ze(e),null;case 13:if(Te(Oe),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Me&&xt!==null&&e.mode&1&&!(e.flags&128))Nm(),wi(),e.flags|=98560,o=!1;else if(o=la(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[on]=e}else wi(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ze(e),o=!1}else Wt!==null&&(sd(Wt),Wt=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||Oe.current&1?Fe===0&&(Fe=3):cd())),e.updateQueue!==null&&(e.flags|=4),Ze(e),null);case 4:return _i(),Gu(t,e),t===null&&vo(e.stateNode.containerInfo),Ze(e),null;case 10:return xu(e.type._context),Ze(e),null;case 17:return dt(e.type)&&ra(),Ze(e),null;case 19:if(Te(Oe),o=e.memoizedState,o===null)return Ze(e),null;if(r=(e.flags&128)!==0,s=o.rendering,s===null)if(r)Ao(o,!1);else{if(Fe!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=pa(t),s!==null){for(e.flags|=128,Ao(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 Ce(Oe,Oe.current&1|2),e.child}t=t.sibling}o.tail!==null&&Ie()>Mi&&(e.flags|=128,r=!0,Ao(o,!1),e.lanes=4194304)}else{if(!r)if(t=pa(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ao(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Me)return Ze(e),null}else 2*Ie()-o.renderingStartTime>Mi&&n!==1073741824&&(e.flags|=128,r=!0,Ao(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=Ie(),e.sibling=null,n=Oe.current,Ce(Oe,r?n&1|2:n&1),e):(Ze(e),null);case 22:case 23:return ld(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?_t&1073741824&&(Ze(e),e.subtreeFlags&6&&(e.flags|=8192)):Ze(e),null;case 24:return null;case 25:return null}throw Error(N(156,e.tag))}function Zk(t,e){switch(vu(e),e.tag){case 1:return dt(e.type)&&ra(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return _i(),Te(ut),Te(Ye),Ou(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Mu(e),null;case 13:if(Te(Oe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(N(340));wi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Te(Oe),null;case 4:return _i(),null;case 10:return xu(e.type._context),null;case 22:case 23:return ld(),null;case 24:return null;default:return null}}var xa=!1,et=!1,ex=typeof WeakSet=="function"?WeakSet:Set,z=null;function Ei(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(t,e,r)}else n.current=null}function Qu(t,e,n){try{n()}catch(r){Pe(t,e,r)}}var Iv=!1;function tx(t,e){if(lu=Hs,t=fm(),eu(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,f=t,h=null;t:for(;;){for(var b;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(b=f.firstChild)!==null;)h=f,f=b;for(;;){if(f===t)break t;if(h===n&&++c===i&&(a=s),h===o&&++d===r&&(l=s),(b=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=b}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(cu={focusedElem:t,selectionRange:n},Hs=!1,z=e;z!==null;)if(e=z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,z=t;else for(;z!==null;){e=z;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(N(163))}}catch(C){Pe(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,z=t;break}z=e.return}return y=Iv,Iv=!1,y}function Oo(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&&Qu(e,n,o)}i=i.next}while(i!==r)}}function _a(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 Yu(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 Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[on],delete e[bo],delete e[hu],delete e[$k],delete e[Fk])),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 Nv(t){return t.tag===5||t.tag===3||t.tag===4}function $v(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Nv(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 Xu(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=ta));else if(r!==4&&(t=t.child,t!==null))for(Xu(t,e,n),t=t.sibling;t!==null;)Xu(t,e,n),t=t.sibling}function Zu(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(Zu(t,e,n),t=t.sibling;t!==null;)Zu(t,e,n),t=t.sibling}var We=null,Jt=!1;function nr(t,e,n){for(n=n.child;n!==null;)Fv(t,e,n),n=n.sibling}function Fv(t,e,n){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount($s,n)}catch{}switch(n.tag){case 5:et||Ei(n,e);case 6:var r=We,i=Jt;We=null,nr(t,e,n),We=r,Jt=i,We!==null&&(Jt?(t=We,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):We.removeChild(n.stateNode));break;case 18:We!==null&&(Jt?(t=We,n=n.stateNode,t.nodeType===8?fu(t.parentNode,n):t.nodeType===1&&fu(t,n),ao(t)):fu(We,n.stateNode));break;case 4:r=We,i=Jt,We=n.stateNode.containerInfo,Jt=!0,nr(t,e,n),We=r,Jt=i;break;case 0:case 11:case 14:case 15:if(!et&&(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)&&Qu(n,e,s),i=i.next}while(i!==r)}nr(t,e,n);break;case 1:if(!et&&(Ei(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Pe(n,e,a)}nr(t,e,n);break;case 21:nr(t,e,n);break;case 22:n.mode&1?(et=(r=et)||n.memoizedState!==null,nr(t,e,n),et=r):nr(t,e,n);break;default:nr(t,e,n)}}function jv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new ex),e.forEach(function(r){var i=ux.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Gt(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:We=a.stateNode,Jt=!1;break e;case 3:We=a.stateNode.containerInfo,Jt=!0;break e;case 4:We=a.stateNode.containerInfo,Jt=!0;break e}a=a.return}if(We===null)throw Error(N(160));Fv(o,s,i),We=null,Jt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Pe(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Bv(e,t),e=e.sibling}function Bv(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Gt(e,t),ln(t),r&4){try{Oo(3,t,t.return),_a(3,t)}catch(m){Pe(t,t.return,m)}try{Oo(5,t,t.return)}catch(m){Pe(t,t.return,m)}}break;case 1:Gt(e,t),ln(t),r&512&&n!==null&&Ei(n,n.return);break;case 5:if(Gt(e,t),ln(t),r&512&&n!==null&&Ei(n,n.return),t.flags&32){var i=t.stateNode;try{Qi(i,"")}catch(m){Pe(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&&pg(i,o),Oc(a,s);var c=Oc(a,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d==="style"?kg(i,f):d==="dangerouslySetInnerHTML"?wg(i,f):d==="children"?Qi(i,f):hc(i,d,f,c)}switch(a){case"input":Cc(i,o);break;case"textarea":vg(i,o);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var b=o.value;b!=null?oi(i,!!o.multiple,b,!1):h!==!!o.multiple&&(o.defaultValue!=null?oi(i,!!o.multiple,o.defaultValue,!0):oi(i,!!o.multiple,o.multiple?[]:"",!1))}i[bo]=o}catch(m){Pe(t,t.return,m)}}break;case 6:if(Gt(e,t),ln(t),r&4){if(t.stateNode===null)throw Error(N(162));i=t.stateNode,o=t.memoizedProps;try{i.nodeValue=o}catch(m){Pe(t,t.return,m)}}break;case 3:if(Gt(e,t),ln(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ao(e.containerInfo)}catch(m){Pe(t,t.return,m)}break;case 4:Gt(e,t),ln(t);break;case 13:Gt(e,t),ln(t),i=t.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(nd=Ie())),r&4&&jv(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(et=(c=et)||d,Gt(e,t),et=c):Gt(e,t),ln(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(z=t,d=t.child;d!==null;){for(f=z=d;z!==null;){switch(h=z,b=h.child,h.tag){case 0:case 11:case 14:case 15:Oo(4,h,h.return);break;case 1:Ei(h,h.return);var y=h.stateNode;if(typeof y.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(m){Pe(r,n,m)}}break;case 5:Ei(h,h.return);break;case 22:if(h.memoizedState!==null){Hv(f);continue}}b!==null?(b.return=h,z=b):Hv(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Sg("display",s))}catch(m){Pe(t,t.return,m)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(m){Pe(t,t.return,m)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Gt(e,t),ln(t),r&4&&jv(t);break;case 21:break;default:Gt(e,t),ln(t)}}function ln(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Nv(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&&(Qi(i,""),r.flags&=-33);var o=$v(t);Zu(t,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=$v(t);Xu(t,a,s);break;default:throw Error(N(161))}}catch(l){Pe(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function nx(t,e,n){z=t,Uv(t)}function Uv(t,e,n){for(var r=(t.mode&1)!==0;z!==null;){var i=z,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||xa;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||et;a=xa;var c=et;if(xa=s,(et=l)&&!c)for(z=i;z!==null;)s=z,l=s.child,s.tag===22&&s.memoizedState!==null?Vv(i):l!==null?(l.return=s,z=l):Vv(i);for(;o!==null;)z=o,Uv(o),o=o.sibling;z=i,xa=a,et=c}zv(t)}else i.subtreeFlags&8772&&o!==null?(o.return=i,z=o):zv(t)}}function zv(t){for(;z!==null;){var e=z;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:et||_a(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!et)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&&Hm(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}Hm(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 f=d.dehydrated;f!==null&&ao(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(N(163))}et||e.flags&512&&Yu(e)}catch(h){Pe(e,e.return,h)}}if(e===t){z=null;break}if(n=e.sibling,n!==null){n.return=e.return,z=n;break}z=e.return}}function Hv(t){for(;z!==null;){var e=z;if(e===t){z=null;break}var n=e.sibling;if(n!==null){n.return=e.return,z=n;break}z=e.return}}function Vv(t){for(;z!==null;){var e=z;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{_a(4,e)}catch(l){Pe(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Pe(e,i,l)}}var o=e.return;try{Yu(e)}catch(l){Pe(e,o,l)}break;case 5:var s=e.return;try{Yu(e)}catch(l){Pe(e,s,l)}}}catch(l){Pe(e,e.return,l)}if(e===t){z=null;break}var a=e.sibling;if(a!==null){a.return=e.return,z=a;break}z=e.return}}var rx=Math.ceil,Ca=wn.ReactCurrentDispatcher,ed=wn.ReactCurrentOwner,Rt=wn.ReactCurrentBatchConfig,ge=0,ze=null,Ne=null,qe=0,_t=0,Ti=Yn(0),Fe=0,Do=null,Ir=0,Ea=0,td=0,Po=null,ht=null,nd=0,Mi=1/0,Mn=null,Ta=!1,rd=null,rr=null,Ma=!1,ir=null,Aa=0,Lo=0,id=null,Oa=-1,Da=0;function at(){return ge&6?Ie():Oa!==-1?Oa:Oa=Ie()}function or(t){return t.mode&1?ge&2&&qe!==0?qe&-qe:Bk.transition!==null?(Da===0&&(Da=$g()),Da):(t=ye,t!==0||(t=window.event,t=t===void 0?16:Wg(t.type)),t):1}function Qt(t,e,n,r){if(50<Lo)throw Lo=0,id=null,Error(N(185));no(t,n,r),(!(ge&2)||t!==ze)&&(t===ze&&(!(ge&2)&&(Ea|=n),Fe===4&&sr(t,qe)),pt(t,r),n===1&&ge===0&&!(e.mode&1)&&(Mi=Ie()+500,oa&&Zn()))}function pt(t,e){var n=t.callbackNode;BS(t,e);var r=Bs(t,t===ze?qe:0);if(r===0)n!==null&&Ig(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Ig(n),e===1)t.tag===0?jk(Wv.bind(null,t)):Dm(Wv.bind(null,t)),Rk(function(){!(ge&6)&&Zn()}),n=null;else{switch(Fg(r)){case 1:n=$c;break;case 4:n=Rg;break;case 16:n=Ns;break;case 536870912:n=Ng;break;default:n=Ns}n=ey(n,Kv.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Kv(t,e){if(Oa=-1,Da=0,ge&6)throw Error(N(327));var n=t.callbackNode;if(Ai()&&t.callbackNode!==n)return null;var r=Bs(t,t===ze?qe:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Pa(t,r);else{e=r;var i=ge;ge|=2;var o=Jv();(ze!==t||qe!==e)&&(Mn=null,Mi=Ie()+500,Nr(t,e));do try{sx();break}catch(a){qv(t,a)}while(!0);ku(),Ca.current=o,ge=i,Ne!==null?e=0:(ze=null,qe=0,e=Fe)}if(e!==0){if(e===2&&(i=Fc(t),i!==0&&(r=i,e=od(t,i))),e===1)throw n=Do,Nr(t,0),sr(t,r),pt(t,Ie()),n;if(e===6)sr(t,r);else{if(i=t.current.alternate,!(r&30)&&!ix(i)&&(e=Pa(t,r),e===2&&(o=Fc(t),o!==0&&(r=o,e=od(t,o))),e===1))throw n=Do,Nr(t,0),sr(t,r),pt(t,Ie()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(N(345));case 2:$r(t,ht,Mn);break;case 3:if(sr(t,r),(r&130023424)===r&&(e=nd+500-Ie(),10<e)){if(Bs(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){at(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=du($r.bind(null,t,ht,Mn),e);break}$r(t,ht,Mn);break;case 4:if(sr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var s=31-Vt(r);o=1<<s,s=e[s],s>i&&(i=s),r&=~o}if(r=i,r=Ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rx(r/1960))-r,10<r){t.timeoutHandle=du($r.bind(null,t,ht,Mn),r);break}$r(t,ht,Mn);break;case 5:$r(t,ht,Mn);break;default:throw Error(N(329))}}}return pt(t,Ie()),t.callbackNode===n?Kv.bind(null,t):null}function od(t,e){var n=Po;return t.current.memoizedState.isDehydrated&&(Nr(t,e).flags|=256),t=Pa(t,e),t!==2&&(e=ht,ht=n,e!==null&&sd(e)),t}function sd(t){ht===null?ht=t:ht.push.apply(ht,t)}function ix(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(!Kt(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 sr(t,e){for(e&=~td,e&=~Ea,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Vt(e),r=1<<n;t[n]=-1,e&=~r}}function Wv(t){if(ge&6)throw Error(N(327));Ai();var e=Bs(t,0);if(!(e&1))return pt(t,Ie()),null;var n=Pa(t,e);if(t.tag!==0&&n===2){var r=Fc(t);r!==0&&(e=r,n=od(t,r))}if(n===1)throw n=Do,Nr(t,0),sr(t,e),pt(t,Ie()),n;if(n===6)throw Error(N(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,$r(t,ht,Mn),pt(t,Ie()),null}function ad(t,e){var n=ge;ge|=1;try{return t(e)}finally{ge=n,ge===0&&(Mi=Ie()+500,oa&&Zn())}}function Rr(t){ir!==null&&ir.tag===0&&!(ge&6)&&Ai();var e=ge;ge|=1;var n=Rt.transition,r=ye;try{if(Rt.transition=null,ye=1,t)return t()}finally{ye=r,Rt.transition=n,ge=e,!(ge&6)&&Zn()}}function ld(){_t=Ti.current,Te(Ti)}function Nr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Ik(n)),Ne!==null)for(n=Ne.return;n!==null;){var r=n;switch(vu(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ra();break;case 3:_i(),Te(ut),Te(Ye),Ou();break;case 5:Mu(r);break;case 4:_i();break;case 13:Te(Oe);break;case 19:Te(Oe);break;case 10:xu(r.type._context);break;case 22:case 23:ld()}n=n.return}if(ze=t,Ne=t=ar(t.current,null),qe=_t=e,Fe=0,Do=null,td=Ea=Ir=0,ht=Po=null,Dr!==null){for(e=0;e<Dr.length;e++)if(n=Dr[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}Dr=null}return t}function qv(t,e){do{var n=Ne;try{if(ku(),ga.current=ba,ma){for(var r=De.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ma=!1}if(Lr=0,Ue=$e=De=null,Co=!1,Eo=0,ed.current=null,n===null||n.return===null){Fe=1,Do=e,Ne=null;break}e:{var o=t,s=n.return,a=n,l=e;if(e=qe,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var b=yv(s);if(b!==null){b.flags&=-257,bv(b,s,a,o,e),b.mode&1&&vv(o,c,e),e=b,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)){vv(o,c,e),cd();break e}l=Error(N(426))}}else if(Me&&a.mode&1){var S=yv(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),bv(S,s,a,o,e),wu(Ci(l,a));break e}}o=l=Ci(l,a),Fe!==4&&(Fe=2),Po===null?Po=[o]:Po.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var v=gv(o,l,e);zm(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"&&(rr===null||!rr.has(k)))){o.flags|=65536,e&=-e,o.lanes|=e;var C=mv(o,a,e);zm(o,C);break e}}o=o.return}while(o!==null)}Qv(n)}catch(M){e=M,Ne===n&&n!==null&&(Ne=n=n.return);continue}break}while(!0)}function Jv(){var t=Ca.current;return Ca.current=ba,t===null?ba:t}function cd(){(Fe===0||Fe===3||Fe===2)&&(Fe=4),ze===null||!(Ir&268435455)&&!(Ea&268435455)||sr(ze,qe)}function Pa(t,e){var n=ge;ge|=2;var r=Jv();(ze!==t||qe!==e)&&(Mn=null,Nr(t,e));do try{ox();break}catch(i){qv(t,i)}while(!0);if(ku(),ge=n,Ca.current=r,Ne!==null)throw Error(N(261));return ze=null,qe=0,Fe}function ox(){for(;Ne!==null;)Gv(Ne)}function sx(){for(;Ne!==null&&!DS();)Gv(Ne)}function Gv(t){var e=Zv(t.alternate,t,_t);t.memoizedProps=t.pendingProps,e===null?Qv(t):Ne=e,ed.current=null}function Qv(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=Zk(n,e),n!==null){n.flags&=32767,Ne=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Fe=6,Ne=null;return}}else if(n=Xk(n,e,_t),n!==null){Ne=n;return}if(e=e.sibling,e!==null){Ne=e;return}Ne=e=t}while(e!==null);Fe===0&&(Fe=5)}function $r(t,e,n){var r=ye,i=Rt.transition;try{Rt.transition=null,ye=1,ax(t,e,n,r)}finally{Rt.transition=i,ye=r}return null}function ax(t,e,n,r){do Ai();while(ir!==null);if(ge&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(US(t,o),t===ze&&(Ne=ze=null,qe=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ma||(Ma=!0,ey(Ns,function(){return Ai(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Rt.transition,Rt.transition=null;var s=ye;ye=1;var a=ge;ge|=4,ed.current=null,tx(t,n),Bv(n,t),Tk(cu),Hs=!!lu,cu=lu=null,t.current=n,nx(n),PS(),ge=a,ye=s,Rt.transition=o}else t.current=n;if(Ma&&(Ma=!1,ir=t,Aa=i),o=t.pendingLanes,o===0&&(rr=null),RS(n.stateNode),pt(t,Ie()),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(Ta)throw Ta=!1,t=rd,rd=null,t;return Aa&1&&t.tag!==0&&Ai(),o=t.pendingLanes,o&1?t===id?Lo++:(Lo=0,id=t):Lo=0,Zn(),null}function Ai(){if(ir!==null){var t=Fg(Aa),e=Rt.transition,n=ye;try{if(Rt.transition=null,ye=16>t?16:t,ir===null)var r=!1;else{if(t=ir,ir=null,Aa=0,ge&6)throw Error(N(331));var i=ge;for(ge|=4,z=t.current;z!==null;){var o=z,s=o.child;if(z.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(z=c;z!==null;){var d=z;switch(d.tag){case 0:case 11:case 15:Oo(8,d,o)}var f=d.child;if(f!==null)f.return=d,z=f;else for(;z!==null;){d=z;var h=d.sibling,b=d.return;if(Rv(d),d===c){z=null;break}if(h!==null){h.return=b,z=h;break}z=b}}}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)}}z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,z=s;else e:for(;z!==null;){if(o=z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Oo(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,z=v;break e}z=o.return}}var w=t.current;for(z=w;z!==null;){s=z;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,z=k;else e:for(s=w;z!==null;){if(a=z,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:_a(9,a)}}catch(M){Pe(a,a.return,M)}if(a===s){z=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,z=C;break e}z=a.return}}if(ge=i,Zn(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot($s,t)}catch{}r=!0}return r}finally{ye=n,Rt.transition=e}}return!1}function Yv(t,e,n){e=Ci(n,e),e=gv(t,e,1),t=tr(t,e,1),e=at(),t!==null&&(no(t,1,e),pt(t,e))}function Pe(t,e,n){if(t.tag===3)Yv(t,t,n);else for(;e!==null;){if(e.tag===3){Yv(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(rr===null||!rr.has(r))){t=Ci(n,t),t=mv(e,t,1),e=tr(e,t,1),t=at(),e!==null&&(no(e,1,t),pt(e,t));break}}e=e.return}}function lx(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=at(),t.pingedLanes|=t.suspendedLanes&n,ze===t&&(qe&n)===n&&(Fe===4||Fe===3&&(qe&130023424)===qe&&500>Ie()-nd?Nr(t,0):td|=n),pt(t,e)}function Xv(t,e){e===0&&(t.mode&1?(e=js,js<<=1,!(js&130023424)&&(js=4194304)):e=1);var n=at();t=Cn(t,e),t!==null&&(no(t,e,n),pt(t,n))}function cx(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Xv(t,n)}function ux(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),Xv(t,n)}var Zv;Zv=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ut.current)ft=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return ft=!1,Yk(t,e,n);ft=!!(t.flags&131072)}else ft=!1,Me&&e.flags&1048576&&Pm(e,aa,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ka(t,e),t=e.pendingProps;var i=vi(e,Ye.current);xi(e,n),i=Lu(null,e,r,t,i,n);var o=Iu();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,dt(r)?(o=!0,ia(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Eu(e),i.updater=wa,e.stateNode=i,i._reactInternals=e,Bu(e,r,t,n),e=Vu(null,e,r,!0,o,n)):(e.tag=0,Me&&o&&mu(e),st(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(ka(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=fx(r),t=qt(r,t),i){case 0:e=Hu(null,e,r,t,n);break e;case 1:e=Cv(null,e,r,t,n);break e;case 11:e=wv(null,e,r,t,n);break e;case 14:e=Sv(null,e,r,qt(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:qt(r,i),Hu(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:qt(r,i),Cv(t,e,r,i,n);case 3:e:{if(Ev(e),t===null)throw Error(N(387));r=e.pendingProps,o=e.memoizedState,i=o.element,Um(t,e),ha(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=Ci(Error(N(423)),e),e=Tv(t,e,r,n,i);break e}else if(r!==i){i=Ci(Error(N(424)),e),e=Tv(t,e,r,n,i);break e}else for(xt=Qn(e.stateNode.containerInfo.firstChild),kt=e,Me=!0,Wt=null,n=jm(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wi(),r===i){e=Tn(t,e,n);break e}st(t,e,r,n)}e=e.child}return e;case 5:return Vm(e),t===null&&bu(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,uu(r,i)?s=null:o!==null&&uu(r,o)&&(e.flags|=32),_v(t,e),st(t,e,s,n),e.child;case 6:return t===null&&bu(e),null;case 13:return Mv(t,e,n);case 4:return Tu(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Si(e,null,r,n):st(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:qt(r,i),wv(t,e,r,i,n);case 7:return st(t,e,e.pendingProps,n),e.child;case 8:return st(t,e,e.pendingProps.children,n),e.child;case 12:return st(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,Ce(ua,r._currentValue),r._currentValue=s,o!==null)if(Kt(o.value,s)){if(o.children===i.children&&!ut.current){e=Tn(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=En(-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),_u(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),_u(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}st(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,xi(e,n),i=Lt(i),r=r(i),e.flags|=1,st(t,e,r,n),e.child;case 14:return r=e.type,i=qt(r,e.pendingProps),i=qt(r.type,i),Sv(t,e,r,i,n);case 15:return kv(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:qt(r,i),ka(t,e),e.tag=1,dt(r)?(t=!0,ia(e)):t=!1,xi(e,n),hv(e,r,i),Bu(e,r,i,n),Vu(null,e,r,!0,t,n);case 19:return Ov(t,e,n);case 22:return xv(t,e,n)}throw Error(N(156,e.tag))};function ey(t,e){return Lg(t,e)}function dx(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 Nt(t,e,n,r){return new dx(t,e,n,r)}function ud(t){return t=t.prototype,!(!t||!t.isReactComponent)}function fx(t){if(typeof t=="function")return ud(t)?1:0;if(t!=null){if(t=t.$$typeof,t===mc)return 11;if(t===bc)return 14}return 2}function ar(t,e){var n=t.alternate;return n===null?(n=Nt(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 La(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")ud(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ii:return Fr(n.children,i,o,e);case pc:s=8,i|=8;break;case gc:return t=Nt(12,n,e,i|2),t.elementType=gc,t.lanes=o,t;case vc:return t=Nt(13,n,e,i),t.elementType=vc,t.lanes=o,t;case yc:return t=Nt(19,n,e,i),t.elementType=yc,t.lanes=o,t;case cg:return Ia(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ag:s=10;break e;case lg:s=9;break e;case mc:s=11;break e;case bc:s=14;break e;case zn:s=16,r=null;break e}throw Error(N(130,t==null?t:typeof t,""))}return e=Nt(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Fr(t,e,n,r){return t=Nt(7,t,r,e),t.lanes=n,t}function Ia(t,e,n,r){return t=Nt(22,t,r,e),t.elementType=cg,t.lanes=n,t.stateNode={isHidden:!1},t}function dd(t,e,n){return t=Nt(6,t,null,e),t.lanes=n,t}function fd(t,e,n){return e=Nt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function hx(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=jc(0),this.expirationTimes=jc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jc(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function hd(t,e,n,r,i,o,s,a,l){return t=new hx(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Nt(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Eu(o),t}function px(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ri,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function ty(t){if(!t)return Xn;t=t._reactInternals;e:{if(Er(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(dt(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(dt(n))return Am(t,n,e)}return e}function ny(t,e,n,r,i,o,s,a,l){return t=hd(n,r,!0,t,i,o,s,a,l),t.context=ty(null),n=t.current,r=at(),i=or(n),o=En(r,i),o.callback=e??null,tr(n,o,i),t.current.lanes=i,no(t,i,r),pt(t,r),t}function Ra(t,e,n,r){var i=e.current,o=at(),s=or(i);return n=ty(n),e.context===null?e.context=n:e.pendingContext=n,e=En(o,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=tr(i,e,s),t!==null&&(Qt(t,i,s,o),fa(t,i,s)),s}function Na(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 ry(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function pd(t,e){ry(t,e),(t=t.alternate)&&ry(t,e)}function gx(){return null}var iy=typeof reportError=="function"?reportError:function(t){console.error(t)};function gd(t){this._internalRoot=t}$a.prototype.render=gd.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(N(409));Ra(t,e,null,null)},$a.prototype.unmount=gd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Rr(function(){Ra(null,t,null,null)}),e[Sn]=null}};function $a(t){this._internalRoot=t}$a.prototype.unstable_scheduleHydration=function(t){if(t){var e=Ug();t={blockedOn:null,target:t,priority:e};for(var n=0;n<qn.length&&e!==0&&e<qn[n].priority;n++);qn.splice(n,0,t),n===0&&Vg(t)}};function md(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Fa(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function oy(){}function mx(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=Na(s);o.call(c)}}var s=ny(e,r,t,0,null,!1,!1,"",oy);return t._reactRootContainer=s,t[Sn]=s.current,vo(t.nodeType===8?t.parentNode:t),Rr(),s}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=Na(l);a.call(c)}}var l=hd(t,0,!1,null,null,!1,!1,"",oy);return t._reactRootContainer=l,t[Sn]=l.current,vo(t.nodeType===8?t.parentNode:t),Rr(function(){Ra(e,l,n,r)}),l}function ja(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=Na(s);a.call(l)}}Ra(e,s,t,i)}else s=mx(n,e,t,i,r);return Na(s)}jg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=to(e.pendingLanes);n!==0&&(Bc(e,n|1),pt(e,Ie()),!(ge&6)&&(Mi=Ie()+500,Zn()))}break;case 13:Rr(function(){var r=Cn(t,1);if(r!==null){var i=at();Qt(r,t,1,i)}}),pd(t,1)}},Uc=function(t){if(t.tag===13){var e=Cn(t,134217728);if(e!==null){var n=at();Qt(e,t,134217728,n)}pd(t,134217728)}},Bg=function(t){if(t.tag===13){var e=or(t),n=Cn(t,e);if(n!==null){var r=at();Qt(n,t,e,r)}pd(t,e)}},Ug=function(){return ye},zg=function(t,e){var n=ye;try{return ye=t,e()}finally{ye=n}},Lc=function(t,e,n){switch(e){case"input":if(Cc(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=na(r);if(!i)throw Error(N(90));fg(r),Cc(r,i)}}}break;case"textarea":vg(t,n);break;case"select":e=n.value,e!=null&&oi(t,!!n.multiple,e,!1)}},Eg=ad,Tg=Rr;var vx={usingClientEntryPoint:!1,Events:[wo,gi,na,_g,Cg,ad]},Io={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},yx={bundleType:Io.bundleType,version:Io.version,rendererPackageName:Io.rendererPackageName,rendererConfig:Io.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:wn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Dg(t),t===null?null:t.stateNode},findFiberByHostInstance:Io.findFiberByHostInstance||gx,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 Ba=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ba.isDisabled&&Ba.supportsFiber)try{$s=Ba.inject(yx),rn=Ba}catch{}}bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vx,bt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!md(e))throw Error(N(200));return px(t,e,null,n)},bt.createRoot=function(t,e){if(!md(t))throw Error(N(299));var n=!1,r="",i=iy;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=hd(t,1,!1,null,null,n,!1,r,i),t[Sn]=e.current,vo(t.nodeType===8?t.parentNode:t),new gd(e)},bt.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=Dg(e),t=t===null?null:t.stateNode,t},bt.flushSync=function(t){return Rr(t)},bt.hydrate=function(t,e,n){if(!Fa(e))throw Error(N(200));return ja(null,t,e,!0,n)},bt.hydrateRoot=function(t,e,n){if(!md(t))throw Error(N(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=iy;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=ny(e,null,t,1,n??null,i,!1,o,s),t[Sn]=e.current,vo(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 $a(e)},bt.render=function(t,e,n){if(!Fa(e))throw Error(N(200));return ja(null,t,e,!1,n)},bt.unmountComponentAtNode=function(t){if(!Fa(t))throw Error(N(40));return t._reactRootContainer?(Rr(function(){ja(null,null,t,!1,function(){t._reactRootContainer=null,t[Sn]=null})}),!0):!1},bt.unstable_batchedUpdates=ad,bt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Fa(n))throw Error(N(200));if(t==null||t._reactInternals===void 0)throw Error(N(38));return ja(t,e,n,!1,r)},bt.version="18.3.1-next-f1338f8080-20240426";function sy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sy)}catch(t){console.error(t)}}sy(),tg.exports=bt;var bx=tg.exports,ay=bx;cc.createRoot=ay.createRoot,cc.hydrateRoot=ay.hydrateRoot;var ly={exports:{}},Ua={};/**
|
|
374
|
+
`+o.stack}return{value:t,source:e,stack:i,digest:null}}function zu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Hu(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Qk=typeof WeakMap=="function"?WeakMap:Map;function mv(t,e,n){n=En(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ma||(Ma=!0,id=r),Hu(t,e)},n}function vv(t,e,n){n=En(-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(){Hu(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Hu(t,e),typeof r!="function"&&(rr===null?rr=new Set([this]):rr.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function yv(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Qk;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=ux.bind(null,t,e,n),e.then(t,t))}function bv(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 wv(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=En(-1,1),e.tag=2,tr(n,e,1))),n.lanes|=1),t)}var Yk=wn.ReactCurrentOwner,ft=!1;function st(t,e,n,r){e.child=t===null?Bm(e,null,n,r):Si(e,t.child,n,r)}function Sv(t,e,n,r,i){n=n.render;var o=e.ref;return xi(e,i),r=Iu(t,e,n,r,o,i),n=Ru(),t!==null&&!ft?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(Me&&n&&vu(e),e.flags|=1,st(t,e,r,i),e.child)}function kv(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!dd(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,xv(t,e,o,r,i)):(t=Ia(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:po,n(s,r)&&t.ref===e.ref)return Tn(t,e,i)}return e.flags|=1,t=ar(o,r),t.ref=e.ref,t.return=e,e.child=t}function xv(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(po(o,r)&&t.ref===e.ref)if(ft=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(ft=!0);else return e.lanes=t.lanes,Tn(t,e,i)}return Vu(t,e,n,r,i)}function _v(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},Ce(Ti,_t),_t|=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,Ce(Ti,_t),_t|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,Ce(Ti,_t),_t|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,Ce(Ti,_t),_t|=r;return st(t,e,i,n),e.child}function Cv(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Vu(t,e,n,r,i){var o=dt(n)?Mr:Ye.current;return o=vi(e,o),xi(e,i),n=Iu(t,e,n,r,o,i),r=Ru(),t!==null&&!ft?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(Me&&r&&vu(e),e.flags|=1,st(t,e,n,i),e.child)}function Ev(t,e,n,r,i){if(dt(n)){var o=!0;oa(e)}else o=!1;if(xi(e,i),e.stateNode===null)xa(t,e),pv(e,n,r),Uu(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=Lt(c):(c=dt(n)?Mr:Ye.current,c=vi(e,c));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&gv(e,s,r,c),er=!1;var h=e.memoizedState;s.state=h,pa(e,r,s,i),l=e.memoizedState,a!==r||h!==l||ut.current||er?(typeof d=="function"&&(Bu(e,n,d,r),l=e.memoizedState),(a=er||hv(e,n,a,r,h,l,c))?(f||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,zm(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:qt(e.type,a),s.props=c,f=e.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Lt(l):(l=dt(n)?Mr:Ye.current,l=vi(e,l));var b=n.getDerivedStateFromProps;(d=typeof b=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||h!==l)&&gv(e,s,r,l),er=!1,h=e.memoizedState,s.state=h,pa(e,r,s,i);var y=e.memoizedState;a!==f||h!==y||ut.current||er?(typeof b=="function"&&(Bu(e,n,b,r),y=e.memoizedState),(c=er||hv(e,n,c,r,h,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&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===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&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return Ku(t,e,n,r,o,i)}function Ku(t,e,n,r,i,o){Cv(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&Dm(e,n,!1),Tn(t,e,o);r=e.stateNode,Yk.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=Si(e,t.child,null,o),e.child=Si(e,null,a,o)):st(t,e,a,o),e.memoizedState=r.state,i&&Dm(e,n,!0),e.child}function Tv(t){var e=t.stateNode;e.pendingContext?Am(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Am(t,e.context,!1),Mu(t,e.containerInfo)}function Mv(t,e,n,r,i){return wi(),Su(i),e.flags|=256,st(t,e,n,r),e.child}var Wu={dehydrated:null,treeContext:null,retryLane:0};function qu(t){return{baseLanes:t,cachePool:null,transitions:null}}function Av(t,e,n){var r=e.pendingProps,i=Oe.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),Ce(Oe,i&1),t===null)return wu(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=Ra(s,r,0,null),t=Fr(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=qu(n),e.memoizedState=Wu,t):Ju(e,s));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Xk(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=ar(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?o=ar(a,o):(o=Fr(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?qu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=Wu,r}return o=t.child,t=o.sibling,r=ar(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 Ju(t,e){return e=Ra({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ka(t,e,n,r){return r!==null&&Su(r),Si(e,t.child,null,n),t=Ju(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Xk(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=zu(Error(N(422))),ka(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=Ra({mode:"visible",children:r.children},i,0,null),o=Fr(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&Si(e,t.child,null,s),e.child.memoizedState=qu(s),e.memoizedState=Wu,o);if(!(e.mode&1))return ka(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=zu(o,r,void 0),ka(t,e,s,r)}if(a=(s&t.childLanes)!==0,ft||a){if(r=ze,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,Cn(t,i),Qt(r,t,i,-1))}return ud(),r=zu(Error(N(421))),ka(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=dx.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,xt=Qn(i.nextSibling),kt=e,Me=!0,Wt=null,t!==null&&(Dt[Pt++]=xn,Dt[Pt++]=_n,Dt[Pt++]=Ar,xn=t.id,_n=t.overflow,Ar=e),e=Ju(e,r.children),e.flags|=4096,e)}function Ov(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Cu(t.return,e,n)}function Gu(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 Dv(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(st(t,e,r.children,n),r=Oe.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&&Ov(t,n,e);else if(t.tag===19)Ov(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(Ce(Oe,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&&ga(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Gu(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&&ga(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Gu(e,!0,n,null,o);break;case"together":Gu(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function xa(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Tn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Ir|=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=ar(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=ar(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Zk(t,e,n){switch(e.tag){case 3:Tv(e),wi();break;case 5:Km(e);break;case 1:dt(e.type)&&oa(e);break;case 4:Mu(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Ce(da,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Ce(Oe,Oe.current&1),e.flags|=128,null):n&e.child.childLanes?Av(t,e,n):(Ce(Oe,Oe.current&1),t=Tn(t,e,n),t!==null?t.sibling:null);Ce(Oe,Oe.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Dv(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ce(Oe,Oe.current),r)break;return null;case 22:case 23:return e.lanes=0,_v(t,e,n)}return Tn(t,e,n)}var Pv,Qu,Lv,Iv;Pv=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}},Qu=function(){},Lv=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Pr(sn.current);var o=null;switch(n){case"input":i=Cc(t,i),r=Cc(t,r),o=[];break;case"select":i=Ae({},i,{value:void 0}),r=Ae({},r,{value:void 0}),o=[];break;case"textarea":i=Mc(t,i),r=Mc(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=na)}Oc(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"&&(Wi.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"&&(Wi.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ee("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)}},Iv=function(t,e,n,r){n!==r&&(e.flags|=4)};function Ao(t,e){if(!Me)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 Ze(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 ex(t,e,n){var r=e.pendingProps;switch(yu(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(e),null;case 1:return dt(e.type)&&ia(),Ze(e),null;case 3:return r=e.stateNode,_i(),Te(ut),Te(Ye),Du(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(ca(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Wt!==null&&(ad(Wt),Wt=null))),Qu(t,e),Ze(e),null;case 5:Au(e);var i=Pr(_o.current);if(n=e.type,t!==null&&e.stateNode!=null)Lv(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 Ze(e),null}if(t=Pr(sn.current),ca(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[on]=e,r[bo]=o,t=(e.mode&1)!==0,n){case"dialog":Ee("cancel",r),Ee("close",r);break;case"iframe":case"object":case"embed":Ee("load",r);break;case"video":case"audio":for(i=0;i<mo.length;i++)Ee(mo[i],r);break;case"source":Ee("error",r);break;case"img":case"image":case"link":Ee("error",r),Ee("load",r);break;case"details":Ee("toggle",r);break;case"input":pg(r,o),Ee("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Ee("invalid",r);break;case"textarea":vg(r,o),Ee("invalid",r)}Oc(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&&ta(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&ta(r.textContent,a,t),i=["children",""+a]):Wi.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ee("scroll",r)}switch(n){case"input":Ps(r),mg(r,o,!0);break;case"textarea":Ps(r),bg(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=na)}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=wg(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[on]=e,t[bo]=r,Pv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Dc(n,r),n){case"dialog":Ee("cancel",t),Ee("close",t),i=r;break;case"iframe":case"object":case"embed":Ee("load",t),i=r;break;case"video":case"audio":for(i=0;i<mo.length;i++)Ee(mo[i],t);i=r;break;case"source":Ee("error",t),i=r;break;case"img":case"image":case"link":Ee("error",t),Ee("load",t),i=r;break;case"details":Ee("toggle",t),i=r;break;case"input":pg(t,r),i=Cc(t,r),Ee("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Ae({},r,{value:void 0}),Ee("invalid",t);break;case"textarea":vg(t,r),i=Mc(t,r),Ee("invalid",t);break;default:i=r}Oc(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?xg(t,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Sg(t,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Qi(t,l):typeof l=="number"&&Qi(t,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Wi.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Ee("scroll",t):l!=null&&pc(t,o,l,s))}switch(n){case"input":Ps(t),mg(t,r,!1);break;case"textarea":Ps(t),bg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Hn(r.value));break;case"select":t.multiple=!!r.multiple,o=r.value,o!=null?oi(t,!!r.multiple,o,!1):r.defaultValue!=null&&oi(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=na)}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 Ze(e),null;case 6:if(t&&e.stateNode!=null)Iv(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(N(166));if(n=Pr(_o.current),Pr(sn.current),ca(e)){if(r=e.stateNode,n=e.memoizedProps,r[on]=e,(o=r.nodeValue!==n)&&(t=kt,t!==null))switch(t.tag){case 3:ta(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ta(r.nodeValue,n,(t.mode&1)!==0)}o&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[on]=e,e.stateNode=r}return Ze(e),null;case 13:if(Te(Oe),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Me&&xt!==null&&e.mode&1&&!(e.flags&128))$m(),wi(),e.flags|=98560,o=!1;else if(o=ca(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[on]=e}else wi(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ze(e),o=!1}else Wt!==null&&(ad(Wt),Wt=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||Oe.current&1?Fe===0&&(Fe=3):ud())),e.updateQueue!==null&&(e.flags|=4),Ze(e),null);case 4:return _i(),Qu(t,e),t===null&&vo(e.stateNode.containerInfo),Ze(e),null;case 10:return _u(e.type._context),Ze(e),null;case 17:return dt(e.type)&&ia(),Ze(e),null;case 19:if(Te(Oe),o=e.memoizedState,o===null)return Ze(e),null;if(r=(e.flags&128)!==0,s=o.rendering,s===null)if(r)Ao(o,!1);else{if(Fe!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=ga(t),s!==null){for(e.flags|=128,Ao(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 Ce(Oe,Oe.current&1|2),e.child}t=t.sibling}o.tail!==null&&Ie()>Mi&&(e.flags|=128,r=!0,Ao(o,!1),e.lanes=4194304)}else{if(!r)if(t=ga(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ao(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Me)return Ze(e),null}else 2*Ie()-o.renderingStartTime>Mi&&n!==1073741824&&(e.flags|=128,r=!0,Ao(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=Ie(),e.sibling=null,n=Oe.current,Ce(Oe,r?n&1|2:n&1),e):(Ze(e),null);case 22:case 23:return cd(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?_t&1073741824&&(Ze(e),e.subtreeFlags&6&&(e.flags|=8192)):Ze(e),null;case 24:return null;case 25:return null}throw Error(N(156,e.tag))}function tx(t,e){switch(yu(e),e.tag){case 1:return dt(e.type)&&ia(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return _i(),Te(ut),Te(Ye),Du(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Au(e),null;case 13:if(Te(Oe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(N(340));wi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Te(Oe),null;case 4:return _i(),null;case 10:return _u(e.type._context),null;case 22:case 23:return cd(),null;case 24:return null;default:return null}}var _a=!1,et=!1,nx=typeof WeakSet=="function"?WeakSet:Set,z=null;function Ei(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(t,e,r)}else n.current=null}function Yu(t,e,n){try{n()}catch(r){Pe(t,e,r)}}var Rv=!1;function rx(t,e){if(cu=Vs,t=hm(),tu(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,f=t,h=null;t:for(;;){for(var b;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(b=f.firstChild)!==null;)h=f,f=b;for(;;){if(f===t)break t;if(h===n&&++c===i&&(a=s),h===o&&++d===r&&(l=s),(b=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=b}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(uu={focusedElem:t,selectionRange:n},Vs=!1,z=e;z!==null;)if(e=z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,z=t;else for(;z!==null;){e=z;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 v=y.memoizedProps,S=y.memoizedState,m=e.stateNode,w=m.getSnapshotBeforeUpdate(e.elementType===e.type?v:qt(e.type,v),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){Pe(e,e.return,C)}if(t=e.sibling,t!==null){t.return=e.return,z=t;break}z=e.return}return y=Rv,Rv=!1,y}function Oo(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&&Yu(e,n,o)}i=i.next}while(i!==r)}}function Ca(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 Xu(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 Nv(t){var e=t.alternate;e!==null&&(t.alternate=null,Nv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[on],delete e[bo],delete e[pu],delete e[jk],delete e[Bk])),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 $v(t){return t.tag===5||t.tag===3||t.tag===4}function Fv(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||$v(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 Zu(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=na));else if(r!==4&&(t=t.child,t!==null))for(Zu(t,e,n),t=t.sibling;t!==null;)Zu(t,e,n),t=t.sibling}function ed(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(ed(t,e,n),t=t.sibling;t!==null;)ed(t,e,n),t=t.sibling}var We=null,Jt=!1;function nr(t,e,n){for(n=n.child;n!==null;)jv(t,e,n),n=n.sibling}function jv(t,e,n){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(Fs,n)}catch{}switch(n.tag){case 5:et||Ei(n,e);case 6:var r=We,i=Jt;We=null,nr(t,e,n),We=r,Jt=i,We!==null&&(Jt?(t=We,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):We.removeChild(n.stateNode));break;case 18:We!==null&&(Jt?(t=We,n=n.stateNode,t.nodeType===8?hu(t.parentNode,n):t.nodeType===1&&hu(t,n),ao(t)):hu(We,n.stateNode));break;case 4:r=We,i=Jt,We=n.stateNode.containerInfo,Jt=!0,nr(t,e,n),We=r,Jt=i;break;case 0:case 11:case 14:case 15:if(!et&&(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)&&Yu(n,e,s),i=i.next}while(i!==r)}nr(t,e,n);break;case 1:if(!et&&(Ei(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Pe(n,e,a)}nr(t,e,n);break;case 21:nr(t,e,n);break;case 22:n.mode&1?(et=(r=et)||n.memoizedState!==null,nr(t,e,n),et=r):nr(t,e,n);break;default:nr(t,e,n)}}function Bv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new nx),e.forEach(function(r){var i=fx.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Gt(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:We=a.stateNode,Jt=!1;break e;case 3:We=a.stateNode.containerInfo,Jt=!0;break e;case 4:We=a.stateNode.containerInfo,Jt=!0;break e}a=a.return}if(We===null)throw Error(N(160));jv(o,s,i),We=null,Jt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Pe(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Uv(e,t),e=e.sibling}function Uv(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Gt(e,t),ln(t),r&4){try{Oo(3,t,t.return),Ca(3,t)}catch(v){Pe(t,t.return,v)}try{Oo(5,t,t.return)}catch(v){Pe(t,t.return,v)}}break;case 1:Gt(e,t),ln(t),r&512&&n!==null&&Ei(n,n.return);break;case 5:if(Gt(e,t),ln(t),r&512&&n!==null&&Ei(n,n.return),t.flags&32){var i=t.stateNode;try{Qi(i,"")}catch(v){Pe(t,t.return,v)}}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&&gg(i,o),Dc(a,s);var c=Dc(a,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d==="style"?xg(i,f):d==="dangerouslySetInnerHTML"?Sg(i,f):d==="children"?Qi(i,f):pc(i,d,f,c)}switch(a){case"input":Ec(i,o);break;case"textarea":yg(i,o);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var b=o.value;b!=null?oi(i,!!o.multiple,b,!1):h!==!!o.multiple&&(o.defaultValue!=null?oi(i,!!o.multiple,o.defaultValue,!0):oi(i,!!o.multiple,o.multiple?[]:"",!1))}i[bo]=o}catch(v){Pe(t,t.return,v)}}break;case 6:if(Gt(e,t),ln(t),r&4){if(t.stateNode===null)throw Error(N(162));i=t.stateNode,o=t.memoizedProps;try{i.nodeValue=o}catch(v){Pe(t,t.return,v)}}break;case 3:if(Gt(e,t),ln(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ao(e.containerInfo)}catch(v){Pe(t,t.return,v)}break;case 4:Gt(e,t),ln(t);break;case 13:Gt(e,t),ln(t),i=t.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(rd=Ie())),r&4&&Bv(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(et=(c=et)||d,Gt(e,t),et=c):Gt(e,t),ln(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!d&&t.mode&1)for(z=t,d=t.child;d!==null;){for(f=z=d;z!==null;){switch(h=z,b=h.child,h.tag){case 0:case 11:case 14:case 15:Oo(4,h,h.return);break;case 1:Ei(h,h.return);var y=h.stateNode;if(typeof y.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(v){Pe(r,n,v)}}break;case 5:Ei(h,h.return);break;case 22:if(h.memoizedState!==null){Vv(f);continue}}b!==null?(b.return=h,z=b):Vv(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=kg("display",s))}catch(v){Pe(t,t.return,v)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(v){Pe(t,t.return,v)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Gt(e,t),ln(t),r&4&&Bv(t);break;case 21:break;default:Gt(e,t),ln(t)}}function ln(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if($v(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&&(Qi(i,""),r.flags&=-33);var o=Fv(t);ed(t,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=Fv(t);Zu(t,a,s);break;default:throw Error(N(161))}}catch(l){Pe(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function ix(t,e,n){z=t,zv(t)}function zv(t,e,n){for(var r=(t.mode&1)!==0;z!==null;){var i=z,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||_a;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||et;a=_a;var c=et;if(_a=s,(et=l)&&!c)for(z=i;z!==null;)s=z,l=s.child,s.tag===22&&s.memoizedState!==null?Kv(i):l!==null?(l.return=s,z=l):Kv(i);for(;o!==null;)z=o,zv(o),o=o.sibling;z=i,_a=a,et=c}Hv(t)}else i.subtreeFlags&8772&&o!==null?(o.return=i,z=o):Hv(t)}}function Hv(t){for(;z!==null;){var e=z;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:et||Ca(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!et)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&&Vm(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}Vm(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 f=d.dehydrated;f!==null&&ao(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(N(163))}et||e.flags&512&&Xu(e)}catch(h){Pe(e,e.return,h)}}if(e===t){z=null;break}if(n=e.sibling,n!==null){n.return=e.return,z=n;break}z=e.return}}function Vv(t){for(;z!==null;){var e=z;if(e===t){z=null;break}var n=e.sibling;if(n!==null){n.return=e.return,z=n;break}z=e.return}}function Kv(t){for(;z!==null;){var e=z;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Ca(4,e)}catch(l){Pe(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Pe(e,i,l)}}var o=e.return;try{Xu(e)}catch(l){Pe(e,o,l)}break;case 5:var s=e.return;try{Xu(e)}catch(l){Pe(e,s,l)}}}catch(l){Pe(e,e.return,l)}if(e===t){z=null;break}var a=e.sibling;if(a!==null){a.return=e.return,z=a;break}z=e.return}}var ox=Math.ceil,Ea=wn.ReactCurrentDispatcher,td=wn.ReactCurrentOwner,Rt=wn.ReactCurrentBatchConfig,ge=0,ze=null,Ne=null,qe=0,_t=0,Ti=Yn(0),Fe=0,Do=null,Ir=0,Ta=0,nd=0,Po=null,ht=null,rd=0,Mi=1/0,Mn=null,Ma=!1,id=null,rr=null,Aa=!1,ir=null,Oa=0,Lo=0,od=null,Da=-1,Pa=0;function at(){return ge&6?Ie():Da!==-1?Da:Da=Ie()}function or(t){return t.mode&1?ge&2&&qe!==0?qe&-qe:zk.transition!==null?(Pa===0&&(Pa=Fg()),Pa):(t=be,t!==0||(t=window.event,t=t===void 0?16:qg(t.type)),t):1}function Qt(t,e,n,r){if(50<Lo)throw Lo=0,od=null,Error(N(185));no(t,n,r),(!(ge&2)||t!==ze)&&(t===ze&&(!(ge&2)&&(Ta|=n),Fe===4&&sr(t,qe)),pt(t,r),n===1&&ge===0&&!(e.mode&1)&&(Mi=Ie()+500,sa&&Zn()))}function pt(t,e){var n=t.callbackNode;zS(t,e);var r=Us(t,t===ze?qe:0);if(r===0)n!==null&&Rg(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Rg(n),e===1)t.tag===0?Uk(qv.bind(null,t)):Pm(qv.bind(null,t)),$k(function(){!(ge&6)&&Zn()}),n=null;else{switch(jg(r)){case 1:n=Fc;break;case 4:n=Ng;break;case 16:n=$s;break;case 536870912:n=$g;break;default:n=$s}n=ty(n,Wv.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Wv(t,e){if(Da=-1,Pa=0,ge&6)throw Error(N(327));var n=t.callbackNode;if(Ai()&&t.callbackNode!==n)return null;var r=Us(t,t===ze?qe:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=La(t,r);else{e=r;var i=ge;ge|=2;var o=Gv();(ze!==t||qe!==e)&&(Mn=null,Mi=Ie()+500,Nr(t,e));do try{lx();break}catch(a){Jv(t,a)}while(!0);xu(),Ea.current=o,ge=i,Ne!==null?e=0:(ze=null,qe=0,e=Fe)}if(e!==0){if(e===2&&(i=jc(t),i!==0&&(r=i,e=sd(t,i))),e===1)throw n=Do,Nr(t,0),sr(t,r),pt(t,Ie()),n;if(e===6)sr(t,r);else{if(i=t.current.alternate,!(r&30)&&!sx(i)&&(e=La(t,r),e===2&&(o=jc(t),o!==0&&(r=o,e=sd(t,o))),e===1))throw n=Do,Nr(t,0),sr(t,r),pt(t,Ie()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(N(345));case 2:$r(t,ht,Mn);break;case 3:if(sr(t,r),(r&130023424)===r&&(e=rd+500-Ie(),10<e)){if(Us(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){at(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=fu($r.bind(null,t,ht,Mn),e);break}$r(t,ht,Mn);break;case 4:if(sr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var s=31-Vt(r);o=1<<s,s=e[s],s>i&&(i=s),r&=~o}if(r=i,r=Ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ox(r/1960))-r,10<r){t.timeoutHandle=fu($r.bind(null,t,ht,Mn),r);break}$r(t,ht,Mn);break;case 5:$r(t,ht,Mn);break;default:throw Error(N(329))}}}return pt(t,Ie()),t.callbackNode===n?Wv.bind(null,t):null}function sd(t,e){var n=Po;return t.current.memoizedState.isDehydrated&&(Nr(t,e).flags|=256),t=La(t,e),t!==2&&(e=ht,ht=n,e!==null&&ad(e)),t}function ad(t){ht===null?ht=t:ht.push.apply(ht,t)}function sx(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(!Kt(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 sr(t,e){for(e&=~nd,e&=~Ta,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Vt(e),r=1<<n;t[n]=-1,e&=~r}}function qv(t){if(ge&6)throw Error(N(327));Ai();var e=Us(t,0);if(!(e&1))return pt(t,Ie()),null;var n=La(t,e);if(t.tag!==0&&n===2){var r=jc(t);r!==0&&(e=r,n=sd(t,r))}if(n===1)throw n=Do,Nr(t,0),sr(t,e),pt(t,Ie()),n;if(n===6)throw Error(N(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,$r(t,ht,Mn),pt(t,Ie()),null}function ld(t,e){var n=ge;ge|=1;try{return t(e)}finally{ge=n,ge===0&&(Mi=Ie()+500,sa&&Zn())}}function Rr(t){ir!==null&&ir.tag===0&&!(ge&6)&&Ai();var e=ge;ge|=1;var n=Rt.transition,r=be;try{if(Rt.transition=null,be=1,t)return t()}finally{be=r,Rt.transition=n,ge=e,!(ge&6)&&Zn()}}function cd(){_t=Ti.current,Te(Ti)}function Nr(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Nk(n)),Ne!==null)for(n=Ne.return;n!==null;){var r=n;switch(yu(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ia();break;case 3:_i(),Te(ut),Te(Ye),Du();break;case 5:Au(r);break;case 4:_i();break;case 13:Te(Oe);break;case 19:Te(Oe);break;case 10:_u(r.type._context);break;case 22:case 23:cd()}n=n.return}if(ze=t,Ne=t=ar(t.current,null),qe=_t=e,Fe=0,Do=null,nd=Ta=Ir=0,ht=Po=null,Dr!==null){for(e=0;e<Dr.length;e++)if(n=Dr[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}Dr=null}return t}function Jv(t,e){do{var n=Ne;try{if(xu(),ma.current=wa,va){for(var r=De.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}va=!1}if(Lr=0,Ue=$e=De=null,Co=!1,Eo=0,td.current=null,n===null||n.return===null){Fe=1,Do=e,Ne=null;break}e:{var o=t,s=n.return,a=n,l=e;if(e=qe,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var b=bv(s);if(b!==null){b.flags&=-257,wv(b,s,a,o,e),b.mode&1&&yv(o,c,e),e=b,l=c;var y=e.updateQueue;if(y===null){var v=new Set;v.add(l),e.updateQueue=v}else y.add(l);break e}else{if(!(e&1)){yv(o,c,e),ud();break e}l=Error(N(426))}}else if(Me&&a.mode&1){var S=bv(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),wv(S,s,a,o,e),Su(Ci(l,a));break e}}o=l=Ci(l,a),Fe!==4&&(Fe=2),Po===null?Po=[o]:Po.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e;var m=mv(o,l,e);Hm(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"&&(rr===null||!rr.has(k)))){o.flags|=65536,e&=-e,o.lanes|=e;var C=vv(o,a,e);Hm(o,C);break e}}o=o.return}while(o!==null)}Yv(n)}catch(M){e=M,Ne===n&&n!==null&&(Ne=n=n.return);continue}break}while(!0)}function Gv(){var t=Ea.current;return Ea.current=wa,t===null?wa:t}function ud(){(Fe===0||Fe===3||Fe===2)&&(Fe=4),ze===null||!(Ir&268435455)&&!(Ta&268435455)||sr(ze,qe)}function La(t,e){var n=ge;ge|=2;var r=Gv();(ze!==t||qe!==e)&&(Mn=null,Nr(t,e));do try{ax();break}catch(i){Jv(t,i)}while(!0);if(xu(),ge=n,Ea.current=r,Ne!==null)throw Error(N(261));return ze=null,qe=0,Fe}function ax(){for(;Ne!==null;)Qv(Ne)}function lx(){for(;Ne!==null&&!LS();)Qv(Ne)}function Qv(t){var e=ey(t.alternate,t,_t);t.memoizedProps=t.pendingProps,e===null?Yv(t):Ne=e,td.current=null}function Yv(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=tx(n,e),n!==null){n.flags&=32767,Ne=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Fe=6,Ne=null;return}}else if(n=ex(n,e,_t),n!==null){Ne=n;return}if(e=e.sibling,e!==null){Ne=e;return}Ne=e=t}while(e!==null);Fe===0&&(Fe=5)}function $r(t,e,n){var r=be,i=Rt.transition;try{Rt.transition=null,be=1,cx(t,e,n,r)}finally{Rt.transition=i,be=r}return null}function cx(t,e,n,r){do Ai();while(ir!==null);if(ge&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(HS(t,o),t===ze&&(Ne=ze=null,qe=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Aa||(Aa=!0,ty($s,function(){return Ai(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Rt.transition,Rt.transition=null;var s=be;be=1;var a=ge;ge|=4,td.current=null,rx(t,n),Uv(n,t),Ak(uu),Vs=!!cu,uu=cu=null,t.current=n,ix(n),IS(),ge=a,be=s,Rt.transition=o}else t.current=n;if(Aa&&(Aa=!1,ir=t,Oa=i),o=t.pendingLanes,o===0&&(rr=null),$S(n.stateNode),pt(t,Ie()),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(Ma)throw Ma=!1,t=id,id=null,t;return Oa&1&&t.tag!==0&&Ai(),o=t.pendingLanes,o&1?t===od?Lo++:(Lo=0,od=t):Lo=0,Zn(),null}function Ai(){if(ir!==null){var t=jg(Oa),e=Rt.transition,n=be;try{if(Rt.transition=null,be=16>t?16:t,ir===null)var r=!1;else{if(t=ir,ir=null,Oa=0,ge&6)throw Error(N(331));var i=ge;for(ge|=4,z=t.current;z!==null;){var o=z,s=o.child;if(z.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(z=c;z!==null;){var d=z;switch(d.tag){case 0:case 11:case 15:Oo(8,d,o)}var f=d.child;if(f!==null)f.return=d,z=f;else for(;z!==null;){d=z;var h=d.sibling,b=d.return;if(Nv(d),d===c){z=null;break}if(h!==null){h.return=b,z=h;break}z=b}}}var y=o.alternate;if(y!==null){var v=y.child;if(v!==null){y.child=null;do{var S=v.sibling;v.sibling=null,v=S}while(v!==null)}}z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,z=s;else e:for(;z!==null;){if(o=z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Oo(9,o,o.return)}var m=o.sibling;if(m!==null){m.return=o.return,z=m;break e}z=o.return}}var w=t.current;for(z=w;z!==null;){s=z;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,z=k;else e:for(s=w;z!==null;){if(a=z,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ca(9,a)}}catch(M){Pe(a,a.return,M)}if(a===s){z=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,z=C;break e}z=a.return}}if(ge=i,Zn(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot(Fs,t)}catch{}r=!0}return r}finally{be=n,Rt.transition=e}}return!1}function Xv(t,e,n){e=Ci(n,e),e=mv(t,e,1),t=tr(t,e,1),e=at(),t!==null&&(no(t,1,e),pt(t,e))}function Pe(t,e,n){if(t.tag===3)Xv(t,t,n);else for(;e!==null;){if(e.tag===3){Xv(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(rr===null||!rr.has(r))){t=Ci(n,t),t=vv(e,t,1),e=tr(e,t,1),t=at(),e!==null&&(no(e,1,t),pt(e,t));break}}e=e.return}}function ux(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=at(),t.pingedLanes|=t.suspendedLanes&n,ze===t&&(qe&n)===n&&(Fe===4||Fe===3&&(qe&130023424)===qe&&500>Ie()-rd?Nr(t,0):nd|=n),pt(t,e)}function Zv(t,e){e===0&&(t.mode&1?(e=Bs,Bs<<=1,!(Bs&130023424)&&(Bs=4194304)):e=1);var n=at();t=Cn(t,e),t!==null&&(no(t,e,n),pt(t,n))}function dx(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Zv(t,n)}function fx(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),Zv(t,n)}var ey;ey=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ut.current)ft=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return ft=!1,Zk(t,e,n);ft=!!(t.flags&131072)}else ft=!1,Me&&e.flags&1048576&&Lm(e,la,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;xa(t,e),t=e.pendingProps;var i=vi(e,Ye.current);xi(e,n),i=Iu(null,e,r,t,i,n);var o=Ru();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,dt(r)?(o=!0,oa(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Tu(e),i.updater=Sa,e.stateNode=i,i._reactInternals=e,Uu(e,r,t,n),e=Ku(null,e,r,!0,o,n)):(e.tag=0,Me&&o&&vu(e),st(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(xa(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=px(r),t=qt(r,t),i){case 0:e=Vu(null,e,r,t,n);break e;case 1:e=Ev(null,e,r,t,n);break e;case 11:e=Sv(null,e,r,t,n);break e;case 14:e=kv(null,e,r,qt(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:qt(r,i),Vu(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:qt(r,i),Ev(t,e,r,i,n);case 3:e:{if(Tv(e),t===null)throw Error(N(387));r=e.pendingProps,o=e.memoizedState,i=o.element,zm(t,e),pa(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=Ci(Error(N(423)),e),e=Mv(t,e,r,n,i);break e}else if(r!==i){i=Ci(Error(N(424)),e),e=Mv(t,e,r,n,i);break e}else for(xt=Qn(e.stateNode.containerInfo.firstChild),kt=e,Me=!0,Wt=null,n=Bm(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wi(),r===i){e=Tn(t,e,n);break e}st(t,e,r,n)}e=e.child}return e;case 5:return Km(e),t===null&&wu(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,du(r,i)?s=null:o!==null&&du(r,o)&&(e.flags|=32),Cv(t,e),st(t,e,s,n),e.child;case 6:return t===null&&wu(e),null;case 13:return Av(t,e,n);case 4:return Mu(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Si(e,null,r,n):st(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:qt(r,i),Sv(t,e,r,i,n);case 7:return st(t,e,e.pendingProps,n),e.child;case 8:return st(t,e,e.pendingProps.children,n),e.child;case 12:return st(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,Ce(da,r._currentValue),r._currentValue=s,o!==null)if(Kt(o.value,s)){if(o.children===i.children&&!ut.current){e=Tn(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=En(-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),Cu(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),Cu(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}st(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,xi(e,n),i=Lt(i),r=r(i),e.flags|=1,st(t,e,r,n),e.child;case 14:return r=e.type,i=qt(r,e.pendingProps),i=qt(r.type,i),kv(t,e,r,i,n);case 15:return xv(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:qt(r,i),xa(t,e),e.tag=1,dt(r)?(t=!0,oa(e)):t=!1,xi(e,n),pv(e,r,i),Uu(e,r,i,n),Ku(null,e,r,!0,t,n);case 19:return Dv(t,e,n);case 22:return _v(t,e,n)}throw Error(N(156,e.tag))};function ty(t,e){return Ig(t,e)}function hx(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 Nt(t,e,n,r){return new hx(t,e,n,r)}function dd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function px(t){if(typeof t=="function")return dd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===vc)return 11;if(t===wc)return 14}return 2}function ar(t,e){var n=t.alternate;return n===null?(n=Nt(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 Ia(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")dd(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ii:return Fr(n.children,i,o,e);case gc:s=8,i|=8;break;case mc:return t=Nt(12,n,e,i|2),t.elementType=mc,t.lanes=o,t;case yc:return t=Nt(13,n,e,i),t.elementType=yc,t.lanes=o,t;case bc:return t=Nt(19,n,e,i),t.elementType=bc,t.lanes=o,t;case ug:return Ra(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case lg:s=10;break e;case cg:s=9;break e;case vc:s=11;break e;case wc:s=14;break e;case zn:s=16,r=null;break e}throw Error(N(130,t==null?t:typeof t,""))}return e=Nt(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Fr(t,e,n,r){return t=Nt(7,t,r,e),t.lanes=n,t}function Ra(t,e,n,r){return t=Nt(22,t,r,e),t.elementType=ug,t.lanes=n,t.stateNode={isHidden:!1},t}function fd(t,e,n){return t=Nt(6,t,null,e),t.lanes=n,t}function hd(t,e,n){return e=Nt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function gx(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=Bc(0),this.expirationTimes=Bc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bc(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function pd(t,e,n,r,i,o,s,a,l){return t=new gx(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Nt(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tu(o),t}function mx(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ri,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function ny(t){if(!t)return Xn;t=t._reactInternals;e:{if(Er(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(dt(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(dt(n))return Om(t,n,e)}return e}function ry(t,e,n,r,i,o,s,a,l){return t=pd(n,r,!0,t,i,o,s,a,l),t.context=ny(null),n=t.current,r=at(),i=or(n),o=En(r,i),o.callback=e??null,tr(n,o,i),t.current.lanes=i,no(t,i,r),pt(t,r),t}function Na(t,e,n,r){var i=e.current,o=at(),s=or(i);return n=ny(n),e.context===null?e.context=n:e.pendingContext=n,e=En(o,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=tr(i,e,s),t!==null&&(Qt(t,i,s,o),ha(t,i,s)),s}function $a(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 iy(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function gd(t,e){iy(t,e),(t=t.alternate)&&iy(t,e)}function vx(){return null}var oy=typeof reportError=="function"?reportError:function(t){console.error(t)};function md(t){this._internalRoot=t}Fa.prototype.render=md.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(N(409));Na(t,e,null,null)},Fa.prototype.unmount=md.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Rr(function(){Na(null,t,null,null)}),e[Sn]=null}};function Fa(t){this._internalRoot=t}Fa.prototype.unstable_scheduleHydration=function(t){if(t){var e=zg();t={blockedOn:null,target:t,priority:e};for(var n=0;n<qn.length&&e!==0&&e<qn[n].priority;n++);qn.splice(n,0,t),n===0&&Kg(t)}};function vd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function ja(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function sy(){}function yx(t,e,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=$a(s);o.call(c)}}var s=ry(e,r,t,0,null,!1,!1,"",sy);return t._reactRootContainer=s,t[Sn]=s.current,vo(t.nodeType===8?t.parentNode:t),Rr(),s}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=$a(l);a.call(c)}}var l=pd(t,0,!1,null,null,!1,!1,"",sy);return t._reactRootContainer=l,t[Sn]=l.current,vo(t.nodeType===8?t.parentNode:t),Rr(function(){Na(e,l,n,r)}),l}function Ba(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=$a(s);a.call(l)}}Na(e,s,t,i)}else s=yx(n,e,t,i,r);return $a(s)}Bg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=to(e.pendingLanes);n!==0&&(Uc(e,n|1),pt(e,Ie()),!(ge&6)&&(Mi=Ie()+500,Zn()))}break;case 13:Rr(function(){var r=Cn(t,1);if(r!==null){var i=at();Qt(r,t,1,i)}}),gd(t,1)}},zc=function(t){if(t.tag===13){var e=Cn(t,134217728);if(e!==null){var n=at();Qt(e,t,134217728,n)}gd(t,134217728)}},Ug=function(t){if(t.tag===13){var e=or(t),n=Cn(t,e);if(n!==null){var r=at();Qt(n,t,e,r)}gd(t,e)}},zg=function(){return be},Hg=function(t,e){var n=be;try{return be=t,e()}finally{be=n}},Ic=function(t,e,n){switch(e){case"input":if(Ec(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=ra(r);if(!i)throw Error(N(90));hg(r),Ec(r,i)}}}break;case"textarea":yg(t,n);break;case"select":e=n.value,e!=null&&oi(t,!!n.multiple,e,!1)}},Tg=ld,Mg=Rr;var bx={usingClientEntryPoint:!1,Events:[wo,gi,ra,Cg,Eg,ld]},Io={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},wx={bundleType:Io.bundleType,version:Io.version,rendererPackageName:Io.rendererPackageName,rendererConfig:Io.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:wn.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Pg(t),t===null?null:t.stateNode},findFiberByHostInstance:Io.findFiberByHostInstance||vx,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 Ua=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ua.isDisabled&&Ua.supportsFiber)try{Fs=Ua.inject(wx),rn=Ua}catch{}}bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bx,bt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vd(e))throw Error(N(200));return mx(t,e,null,n)},bt.createRoot=function(t,e){if(!vd(t))throw Error(N(299));var n=!1,r="",i=oy;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=pd(t,1,!1,null,null,n,!1,r,i),t[Sn]=e.current,vo(t.nodeType===8?t.parentNode:t),new md(e)},bt.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=Pg(e),t=t===null?null:t.stateNode,t},bt.flushSync=function(t){return Rr(t)},bt.hydrate=function(t,e,n){if(!ja(e))throw Error(N(200));return Ba(null,t,e,!0,n)},bt.hydrateRoot=function(t,e,n){if(!vd(t))throw Error(N(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=oy;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=ry(e,null,t,1,n??null,i,!1,o,s),t[Sn]=e.current,vo(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 Fa(e)},bt.render=function(t,e,n){if(!ja(e))throw Error(N(200));return Ba(null,t,e,!1,n)},bt.unmountComponentAtNode=function(t){if(!ja(t))throw Error(N(40));return t._reactRootContainer?(Rr(function(){Ba(null,null,t,!1,function(){t._reactRootContainer=null,t[Sn]=null})}),!0):!1},bt.unstable_batchedUpdates=ld,bt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!ja(n))throw Error(N(200));if(t==null||t._reactInternals===void 0)throw Error(N(38));return Ba(t,e,n,!1,r)},bt.version="18.3.1-next-f1338f8080-20240426";function ay(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ay)}catch(t){console.error(t)}}ay(),ng.exports=bt;var Sx=ng.exports,ly=Sx;uc.createRoot=ly.createRoot,uc.hydrateRoot=ly.hydrateRoot;var cy={exports:{}},za={};/**
|
|
375
375
|
* @license React
|
|
376
376
|
* react-jsx-runtime.production.min.js
|
|
377
377
|
*
|
|
@@ -379,12 +379,12 @@ 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
|
|
382
|
+
*/var kx=oe,xx=Symbol.for("react.element"),_x=Symbol.for("react.fragment"),Cx=Object.prototype.hasOwnProperty,Ex=kx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Tx={key:!0,ref:!0,__self:!0,__source:!0};function uy(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)Cx.call(e,r)&&!Tx.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:xx,type:t,key:o,ref:s,props:i,_owner:Ex.current}}za.Fragment=_x,za.jsx=uy,za.jsxs=uy,cy.exports=za;var E=cy.exports;const Mx=400,Ax=({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)},Mx);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:`
|
|
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},jr="floe_nudge_state",
|
|
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},jr="floe_nudge_state",dy="floe_nudge_sound_played",Ro={initialDelay:5e3,autoHideDuration:1e4,maxImpressions:3,cooldownDays:7},Ox=({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 f=i||o,[h,b]=oe.useState(!1),[y,v]=oe.useState(!1),[S,m]=oe.useState(!1),w=oe.useRef(null),k=oe.useCallback(()=>{try{const H=localStorage.getItem(jr);if(!H)return!0;const G=JSON.parse(H);return!(G.hasEngaged||G.impressions>=Ro.maxImpressions||G.lastDismissed&&(Date.now()-G.lastDismissed)/864e5<Ro.cooldownDays)}catch{return!0}},[]),C=oe.useCallback(()=>{try{const H=localStorage.getItem(jr),G=H?JSON.parse(H):{impressions:0};G.impressions=(G.impressions||0)+1,G.lastShown=Date.now(),localStorage.setItem(jr,JSON.stringify(G))}catch{}},[]),M=oe.useCallback(()=>{try{const H=localStorage.getItem(jr),G=H?JSON.parse(H):{impressions:0};G.lastDismissed=Date.now(),localStorage.setItem(jr,JSON.stringify(G))}catch{}},[]),O=oe.useCallback(()=>{try{const H=localStorage.getItem(jr),G=H?JSON.parse(H):{impressions:0};G.hasEngaged=!0,localStorage.setItem(jr,JSON.stringify(G))}catch{}},[]),D=oe.useCallback(()=>{try{if(sessionStorage.getItem(dy))return;const H=window.AudioContext||window.webkitAudioContext;if(!H)return;const G=new H;G.state==="suspended"&&G.resume();const ne=G.currentTime,R=G.createOscillator(),j=G.createGain();R.connect(j),j.connect(G.destination),R.frequency.setValueAtTime(659,ne),R.type="sine",j.gain.setValueAtTime(.25,ne),j.gain.exponentialRampToValueAtTime(.01,ne+.3),R.start(ne),R.stop(ne+.3);const Q=G.createOscillator(),ae=G.createGain();Q.connect(ae),ae.connect(G.destination),Q.frequency.setValueAtTime(784,ne+.12),Q.type="sine",ae.gain.setValueAtTime(0,ne),ae.gain.setValueAtTime(.2,ne+.12),ae.gain.exponentialRampToValueAtTime(.01,ne+.5),Q.start(ne+.12),Q.stop(ne+.5);const ve=G.createOscillator(),u=G.createGain();ve.connect(u),u.connect(G.destination),ve.frequency.setValueAtTime(1318,ne),ve.type="sine",u.gain.setValueAtTime(.08,ne),u.gain.exponentialRampToValueAtTime(.001,ne+.2),ve.start(ne),ve.stop(ne+.2),Q.onended=()=>{G.close()},console.log("[Floe] Nudge sound played"),sessionStorage.setItem(dy,"true")}catch{}},[]),F=a!==void 0?a:y&&!S&&!t;oe.useEffect(()=>{if(a===void 0&&d&&f&&!t&&!S){if(!k())return;const H=setTimeout(()=>{v(!0),C(),D()},Ro.initialDelay),G=c===void 0?Ro.autoHideDuration:c;let ne;return G>0&&(ne=setTimeout(()=>{v(!1),M()},Ro.initialDelay+G)),()=>{clearTimeout(H),ne&&clearTimeout(ne)}}},[f,t,S,k,C,M,D,a,d,c]);const J=oe.useCallback(()=>{v(!1),m(!0),M(),l==null||l()},[M,l]),W=oe.useCallback(()=>{v(!1),O(),n==null||n(),f&&!t&&r&&r()},[O,n,f,t,r]),U=oe.useCallback(()=>{O(),n==null||n(),f&&!t&&r&&r()},[O,n,f,t,r]),V=oe.useCallback(H=>{(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),U())},[U]),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"}},ie=f&&!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(Ax,{text:s,isVisible:F,onClick:W,onAutoHide:J,orbSize:ie}),E.jsxs("div",{ref:w,role:"button",tabIndex:0,"aria-label":f?i?"Welcome back - Start Floe":"Start Floe":"Expand Floe",onClick:U,onKeyDown:V,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!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),
|
|
@@ -394,12 +394,12 @@ Error generating stack: `+o.message+`
|
|
|
394
394
|
0% { transform: scale(1); opacity: 0.5; }
|
|
395
395
|
100% { transform: scale(1.6); opacity: 0; }
|
|
396
396
|
}
|
|
397
|
-
`})]})},
|
|
397
|
+
`})]})},Dx=({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(),f=oe.useRef(Array(a).fill(.15));oe.useEffect(()=>{if(s&&s.length>0&&t){const y=Array(a).fill(0).map((v,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,O=0;for(let D=k;D<C;D++)M+=s[D],O++;m=O>0?M/O:0,m=m*(1-S*.08)}return Math.max(.15,Math.min(1,.15+m*.85))});f.current=y}else t||(f.current=Array(a).fill(.15))},[s,t,a]),oe.useEffect(()=>{const y=()=>{c(v=>v.map((S,m)=>{const w=f.current[m]||.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 h=tg.useMemo(()=>{const y=[];for(let v=a-1;v>0;v--)y.push(l[v]);y.push(l[0]);for(let v=1;v<a;v++)y.push(l[v]);return y},[l,a]),b=h.length*i+(h.length-1)*o;return E.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:`${n}px`,width:`${b}px`,gap:`${o}px`},children:h.map((y,v)=>{const S=v===Math.floor(h.length/2),m=Math.max(4,n*y*(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&&y>.3?`0 0 ${6*y}px ${e}50`:"none"}},v)})})},Px=({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:f,onToggleScreenShare:h,onMinimize:b,onResume:y,onStop:v,connectionProgress:S,textModeEnabled:m=!1,onToggleTextMode:w,onSendText:k,planProgress:C})=>{const M=oe.useRef(null),O=oe.useRef(null),[D,F]=oe.useState(!1),[J,W]=oe.useState(""),[U,V]=oe.useState(!1),[q,ie]=oe.useState(!1);oe.useEffect(()=>{var j;(j=M.current)==null||j.scrollIntoView({behavior:"smooth"})},[i,o]),oe.useEffect(()=>{t&&F(!0)},[t]);const H=!n||e==="paused";oe.useEffect(()=>{m&&!H&&O.current&&O.current.focus()},[m,H]);const G=()=>{var j;H||!J.trim()||!k||(k(J.trim()),W(""),(j=O.current)==null||j.focus())},ne=()=>{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"}},R=()=>{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&&!D?null:E.jsx(E.Fragment,{children:E.jsxs("div",{onTransitionEnd:()=>!t&&F(!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 ${R()}40`,boxShadow:`0 0 12px ${R()}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":R()},children:E.jsxs("svg",{width:"16",height:"14",viewBox:"0 0 159 138",fill:"none",children:[E.jsx("path",{fill:R(),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:R(),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:R(),fontWeight:"500",display:"flex",alignItems:"center",gap:"5px"},children:[E.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:R(),boxShadow:`0 0 6px ${R()}`,flexShrink:0}}),ne()]})]})]}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexShrink:0},children:[e!=="paused"&&E.jsx(No,{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"&&y&&E.jsx(No,{onClick:y,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"&&m&&E.jsx(No,{onClick:m,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(No,{onClick:h,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(No,{onClick:b,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"})})})]})]}),C&&(()=>{const j=Number.isFinite(C.progressPercent)?Math.max(0,Math.min(100,C.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 ",C.currentStep," of ",C.totalSteps]}),E.jsxs("span",{children:[Math.round(j),"%"]})]}),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:`${j}%`,transition:"width 0.5s ease"}})}),C.currentTaskTitle&&E.jsx("div",{style:{fontSize:"11px",color:"rgba(255, 255, 255, 0.4)",marginTop:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.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."}),y&&E.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:j=>{j.currentTarget.style.transform="scale(1.02)"},onMouseLeave:j=>{j.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:v?"Type a message to begin your conversation":"Start speaking to begin your conversation"})]}):E.jsxs(E.Fragment,{children:[i.map(j=>E.jsx(dy,{message:j},j.id)),o&&s&&E.jsx(dy,{message:{id:"current",role:s,content:o,timestamp:Date.now(),isPartial:!0}})]}),E.jsx("div",{ref:M})]}),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 ${!v&&!r&&n&&e!=="speaking"?"rgba(239, 68, 68, 0.2)":"rgba(255, 255, 255, 0.06)"}`},children:[E.jsx("button",{onClick:v?w:f,disabled:!n,"aria-label":v?"Switch to voice mode":r?"Mute microphone":"Unmute microphone",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?`${R()}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?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:v?E.jsx("input",{ref:O,type:"text",placeholder:H?"Not connected...":"Type a message...",value:J,disabled:H,onChange:j=>W(j.target.value),onKeyDown:j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),G())},style:{flex:1,padding:"6px 10px",borderRadius:"8px",border:"none",background:"transparent",color:H?"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:H?"not-allowed":"text"}}):E.jsx(E.Fragment,{children:n&&r&&(e==="speaking"||e==="listening")?E.jsx(Ax,{isActive:l,color:R(),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:ne()})]})})}),v?E.jsx("button",{onClick:G,disabled:!J.trim(),"aria-label":"Send message",onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:J.trim()?U?"#2563eb":"#3b82f6":"transparent",color:J.trim()?"white":"rgba(255, 255, 255, 0.3)",cursor:J.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:w,"aria-label":"Switch to text mode",onMouseEnter:()=>ie(!0),onMouseLeave:()=>ie(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:"transparent",color:q?"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:[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 ${R()}40`,boxShadow:`0 0 12px ${R()}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":R()},children:E.jsxs("svg",{width:"16",height:"14",viewBox:"0 0 159 138",fill:"none",children:[E.jsx("path",{fill:R(),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:R(),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:R(),fontWeight:"500",display:"flex",alignItems:"center",gap:"5px"},children:[E.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:R(),boxShadow:`0 0 6px ${R()}`,flexShrink:0}}),ne()]})]})]}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexShrink:0},children:[e!=="paused"&&E.jsx(No,{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"&&y&&E.jsx(No,{onClick:y,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"&&v&&E.jsx(No,{onClick:v,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(No,{onClick:h,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(No,{onClick:b,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"})})})]})]}),C&&(()=>{const j=Number.isFinite(C.progressPercent)?Math.max(0,Math.min(100,C.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 ",C.currentStep," of ",C.totalSteps]}),E.jsxs("span",{children:[Math.round(j),"%"]})]}),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:`${j}%`,transition:"width 0.5s ease"}})}),C.currentTaskTitle&&E.jsx("div",{style:{fontSize:"11px",color:"rgba(255, 255, 255, 0.4)",marginTop:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.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."}),y&&E.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:j=>{j.currentTarget.style.transform="scale(1.02)"},onMouseLeave:j=>{j.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(j=>E.jsx(fy,{message:j},j.id)),o&&s&&E.jsx(fy,{message:{id:"current",role:s,content:o,timestamp:Date.now(),isPartial:!0}})]}),E.jsx("div",{ref:M})]}),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?w:f,disabled:!n,"aria-label":m?"Switch to voice mode":r?"Mute microphone":"Unmute microphone",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?`${R()}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:O,type:"text",placeholder:H?"Not connected...":"Type a message...",value:J,disabled:H,onChange:j=>W(j.target.value),onKeyDown:j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),G())},style:{flex:1,padding:"6px 10px",borderRadius:"8px",border:"none",background:"transparent",color:H?"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:H?"not-allowed":"text"}}):E.jsx(E.Fragment,{children:n&&r&&(e==="speaking"||e==="listening")?E.jsx(Dx,{isActive:l,color:R(),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:ne()})]})})}),m?E.jsx("button",{onClick:G,disabled:!J.trim(),"aria-label":"Send message",onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:J.trim()?U?"#2563eb":"#3b82f6":"transparent",color:J.trim()?"white":"rgba(255, 255, 255, 0.3)",cursor:J.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:w,"aria-label":"Switch to text mode",onMouseEnter:()=>ie(!0),onMouseLeave:()=>ie(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:"none",background:"transparent",color:q?"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:`
|
|
403
403
|
@keyframes pulse {
|
|
404
404
|
0%, 100% { opacity: 1; }
|
|
405
405
|
50% { opacity: 0.5; }
|
|
@@ -426,7 +426,7 @@ Error generating stack: `+o.message+`
|
|
|
426
426
|
from { opacity: 0; transform: translateX(-50%) translateY(4px); }
|
|
427
427
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
428
428
|
}
|
|
429
|
-
`})]})},
|
|
429
|
+
`})]})},fy=({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:`
|
|
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
|
-
`})]})},
|
|
438
|
+
`})]})},Lx=({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:f,transcriptHistory:h=[],onResume:b,pausedSessionId:y,onStop:v,connectionProgress:S,isReturningUser:m=!1,hasSkippedOnboarding:w=!1,onMinimize:k,onExpand:C,textModeEnabled:M=!1,onToggleTextMode:O,onSendText:D,nudgeText:F,showNudge:J,onNudgeDismiss:W,nudgeAutoHideDelay:U,nudgeAutoShow:V,planProgress:q})=>{const[ie,H]=oe.useState(!m&&!w);oe.useEffect(()=>{(m||w)&&!t&&H(!1)},[m,w,t]),oe.useEffect(()=>{t&&H(!0)},[t]),oe.useEffect(()=>{console.log("[AgentUI] Rendering with state:",{connected:t,agentState:n,voiceEnabled:e,screenShareEnabled:o,panelOpen:ie,historyCount:h.length,botTranscript:r==null?void 0:r.substring(0,30),userTranscript:i==null?void 0:i.substring(0,30)})},[t,n,e,o,ie,h.length,r,i]);const{currentTranscript:G,currentRole:ne}=oe.useMemo(()=>n==="speaking"&&r?{currentTranscript:r,currentRole:"assistant"}:n==="listening"&&i?{currentTranscript:i,currentRole:"user"}:{currentTranscript:"",currentRole:void 0},[n,r,i]),R=oe.useCallback(()=>{H(!0),C==null||C()},[C]),j=oe.useCallback(()=>{H(!1),k==null||k()},[k]);return E.jsxs(E.Fragment,{children:[!ie&&E.jsx(Ox,{connected:t,agentState:n,onExpand:R,onToggleConnection:c,isReturningUser:m,hasSkippedOnboarding:w,nudgeText:F,showNudge:J,onNudgeDismiss:W,nudgeAutoHideDelay:U,nudgeAutoShow:V}),E.jsx(Px,{isOpen:ie,agentState:n,connected:t,voiceEnabled:e,messages:h,currentTranscript:G,currentRole:ne,screenShareEnabled:o,isSpeaking:s||a,audioLevels:l,onToggleConnection:c,onToggleMute:d,onToggleScreenShare:f,onMinimize:j,onResume:b,onStop:v,connectionProgress:S,textModeEnabled:M,onToggleTextMode:O,onSendText:D,planProgress:q}),E.jsx("style",{children:`
|
|
439
439
|
/* Smooth scrollbar for sidebar */
|
|
440
440
|
#onboarding-sdk-react-ui *::-webkit-scrollbar {
|
|
441
441
|
width: 6px;
|
|
@@ -450,8 +450,8 @@ 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
|
-
`})]})},Et=class Et{constructor(){L(this,"refCounters",{});L(this,"lastSnapshotHash","")}capture(e){this.refCounters={};const n=[],r={width:window.innerWidth,height:window.innerHeight};try{const s=this.queryInteractiveElements(),a=this.queryCursorPointerElements(),l=this.dedupeElements([...s,...a]);for(const c of l)try{const d=this.processElement(c,r);d&&n.push(d)}catch(d){console.warn("[AccessibleSnapshot] Error processing element:",d)}n.sort((c,d)=>{const f=c.rect.y-d.rect.y;return Math.abs(f)<20?c.rect.x-d.rect.x:f}),this.renumberRefs(n)}catch(s){console.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(Et.INTERACTIVE_SELECTOR)).filter(n=>this.shouldIncludeElement(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 i of Et.SKIP_SELECTORS)if(e.matches(i)||e.closest(i))return!1;if(e.getAttribute("aria-hidden")==="true"||e.closest('[aria-hidden="true"]'))return!1;const n=e.getAttribute("role");if(n==="presentation"||n==="none"||!this.isVisible(e))return!1;const r=e.getBoundingClientRect();return!(r.bottom<0||r.top>window.innerHeight||r.right<0||r.left>window.innerWidth||r.width<=0||r.height<=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=f=>(i.has(f)||i.set(f,this.getElementDepth(f)),i.get(f)),l=f=>(o.has(f)||o.set(f,this.getRole(f)),o.get(f)),c=f=>(s.has(f)||s.set(f,this.computeAccessibleName(f)),s.get(f)),d=[...e].sort((f,h)=>a(h)-a(f));for(const f of d){if(n.has(f))continue;let h=!1;for(const b of r)if(f.contains(b)&&f!==b){const y=l(f),
|
|
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 Et.INPUT_TYPE_ROLES[i]||"textbox"}return r==="a"?e.hasAttribute("href")?"link":"":Et.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,f,h,b,y,
|
|
453
|
+
`})]})},Et=class Et{constructor(){L(this,"refCounters",{});L(this,"lastSnapshotHash","")}capture(e){this.refCounters={};const n=[],r={width:window.innerWidth,height:window.innerHeight};try{const s=this.queryInteractiveElements(),a=this.queryCursorPointerElements(),l=this.dedupeElements([...s,...a]);for(const c of l)try{const d=this.processElement(c,r);d&&n.push(d)}catch(d){console.warn("[AccessibleSnapshot] Error processing element:",d)}n.sort((c,d)=>{const f=c.rect.y-d.rect.y;return Math.abs(f)<20?c.rect.x-d.rect.x:f}),this.renumberRefs(n)}catch(s){console.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(Et.INTERACTIVE_SELECTOR)).filter(n=>this.shouldIncludeElement(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 i of Et.SKIP_SELECTORS)if(e.matches(i)||e.closest(i))return!1;if(e.getAttribute("aria-hidden")==="true"||e.closest('[aria-hidden="true"]'))return!1;const n=e.getAttribute("role");if(n==="presentation"||n==="none"||!this.isVisible(e))return!1;const r=e.getBoundingClientRect();return!(r.bottom<0||r.top>window.innerHeight||r.right<0||r.left>window.innerWidth||r.width<=0||r.height<=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=f=>(i.has(f)||i.set(f,this.getElementDepth(f)),i.get(f)),l=f=>(o.has(f)||o.set(f,this.getRole(f)),o.get(f)),c=f=>(s.has(f)||s.set(f,this.computeAccessibleName(f)),s.get(f)),d=[...e].sort((f,h)=>a(h)-a(f));for(const f of d){if(n.has(f))continue;let h=!1;for(const b of r)if(f.contains(b)&&f!==b){const y=l(f),v=l(b);if(y==="card"||y==="listitem"||y==="option"){if(!c(f)){h=!0;break}}else if(y===v){h=!0;break}}if(!h){for(const b of r)if(b.contains(f)&&b!==f){const y=c(f),v=c(b);if(!y||y===v){h=!0;break}}}h||(n.add(f),r.push(f))}return r}getElementDepth(e){let n=0,r=e;for(;r&&r!==document.body;)n++,r=r.parentElement;return n}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 f=e.options[e.selectedIndex];f&&(d=f.text)}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()}}computeAccessibleName(e){var f,h,b,y,v,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=(f=e.getAttribute("aria-label"))==null?void 0:f.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=(h=e.getAttribute("title"))==null?void 0:h.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=(y=(b=a.querySelector("title"))==null?void 0:b.textContent)==null?void 0:y.trim();if(m)return m.slice(0,100);const w=(S=(v=a.querySelector("desc"))==null?void 0:v.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 Et.INPUT_TYPE_ROLES[i]||"textbox"}return r==="a"?e.hasAttribute("href")?"link":"":Et.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,f,h,b,y,v;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((f=S.textContent)==null?void 0:f.trim().slice(0,50))||null;const m=o.querySelector(':scope > [class*="title"], :scope > [class*="Title"], :scope > [class*="header"] > *');if(m)return((h=m.textContent)==null?void 0:h.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=(b=s.textContent)==null?void 0:b.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=(v=a.textContent)==null?void 0:v.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 f=(a=d.textContent)==null?void 0:a.trim();if(f&&f.length<40)return f}}}catch{}return null}generateRef(e){const n=Et.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=Et.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))}};L(Et,"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"}),L(Et,"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"}),L(Et,"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"}),L(Et,"INTERACTIVE_SELECTOR",`
|
|
455
455
|
button,
|
|
456
456
|
a[href],
|
|
457
457
|
input:not([type="hidden"]),
|
|
@@ -474,8 +474,8 @@ Error generating stack: `+o.message+`
|
|
|
474
474
|
[tabindex]:not([tabindex="-1"]),
|
|
475
475
|
[contenteditable="true"],
|
|
476
476
|
summary
|
|
477
|
-
`.replace(/\s+/g," ").trim()),L(Et,"SKIP_SELECTORS",["#onboarding-overlay","#onboarding-sdk-react-ui","#hse-highlight-element","script","style","noscript","template"]);let vd=Et;const Px=["#onboarding-overlay","#floe-cursor","#onboarding-sdk-react-ui","#hse-highlight-element","#floe-cursor-styles","#onboarding-animations"],Oi="data-floe-widget";function Ct(t){if(!t)return!1;if(t.hasAttribute(Oi))return!0;for(const e of Px)if(t.closest(e))return!0;return!1}function An(){return window.location.origin+window.location.pathname}function za(t){try{const e=new URL(t,window.location.origin);return e.origin+e.pathname}catch{return t}}function fy(t){return t&&t.replace(/\.ng-(untouched|touched|pristine|dirty|valid|invalid)/g,"")}function hy(t){try{const n=document.querySelector(t);if(n)return n}catch{}const e=fy(t);if(e!==t)try{const n=document.querySelector(e);if(n)return console.log(`[AngularFallback] Selector matched after stripping state classes: "${e}"`),n}catch{}return null}function Lx(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 py(t,e={}){var h,b,y,m,S;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&&console.log("[humanLikeClick] 🎯 Using element at point:",d.tagName,"instead of target:",t.tagName);else if(c){if(console.warn("[humanLikeClick] ⚠️ Element at point is unrelated:",c.tagName,(h=c.className)==null?void 0:h.toString().slice(0,50)),console.warn("[humanLikeClick] Expected target:",t.tagName,(b=t.className)==null?void 0:b.toString().slice(0,50)),Lx(c)){const v=`${c.tagName} (${(y=c.className)==null?void 0:y.toString().slice(0,80)})`;throw console.error("[humanLikeClick] ❌ BLOCKED: Modal/dialog overlay is covering the target element.",`Overlay: ${v}`,`Target: ${t.tagName} "${(m=t.textContent)==null?void 0:m.trim().slice(0,50)}"`),new Error(`Click blocked by modal overlay: ${v}. Target "${(S=t.textContent)==null?void 0:S.trim().slice(0,50)}" is behind the modal. Interact with the modal instead.`)}d=t}else console.warn("[humanLikeClick] ⚠️ No element at coordinates, falling back to target"),d=t;n&&typeof d.focus=="function"&&d.focus();const f={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l,screenX:a+window.screenX,screenY:l+window.screenY,button:0,buttons:1};if(r){const v={...f,pointerType:"mouse",isPrimary:!0};d.dispatchEvent(new PointerEvent("pointerdown",v)),d.dispatchEvent(new PointerEvent("pointerup",v))}return o&&(d.dispatchEvent(new MouseEvent("mouseenter",{...f,bubbles:!1})),d.dispatchEvent(new MouseEvent("mouseover",f))),d.dispatchEvent(new MouseEvent("mousedown",f)),d.dispatchEvent(new MouseEvent("mouseup",f)),d.dispatchEvent(new MouseEvent("click",f)),i&&typeof d.click=="function"&&d.click(),console.log("[humanLikeClick] ✅ Completed on",d.tagName,"at (",Math.round(a),",",Math.round(l),")"),d}class gy{constructor(){L(this,"audioContext",null);L(this,"analyzerNode",null);L(this,"sourceNode",null);L(this,"dataArray",new Uint8Array(0));L(this,"isRunning",!1);L(this,"onLevelsCallback",null);L(this,"animationId",null);L(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(),console.log("[AudioAnalyzer] Started analyzing audio stream")}catch(r){console.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,console.log("[AudioAnalyzer] Stopped")}destroy(){this.stop(),this.audioContext&&(this.audioContext.close(),this.audioContext=null)}}class Ix{constructor(){L(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 Rx{constructor(){L(this,"lastSnapshot",null);L(this,"lastSnapshotHash","");L(this,"snapshotInterval",null);L(this,"sendCallback",null);L(this,"correlationCounter",0);L(this,"INTERACTIVE_TAGS",new Set(["button","a","input","select","textarea","label","summary","details","option","menuitem"]));L(this,"INTERACTIVE_ROLES",new Set(["button","link","menuitem","option","tab","checkbox","radio","switch","textbox","combobox","listbox","slider"]));L(this,"mutationObserver",null);L(this,"mutationDebounceTimer",null)}startCapturing(e=1500,n){console.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.sendCallback=n,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),console.log("[DOMIntrospector] Stopped DOM capture")}captureAndSendImmediate(e="immediate"){console.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&&(console.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"].includes(r.attributeName||""))&&(this.mutationDebounceTimer=setTimeout(()=>{console.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","href","src"]}))}captureAndSend(){const e=this.captureSnapshot(),n=this.computeSnapshotHash(e);if(n!==this.lastSnapshotHash){const i={...e,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:"periodic",domChanged:!0};this.lastSnapshot=i,this.lastSnapshotHash=n,this.sendCallback&&(console.log(`[DOMIntrospector] Sending snapshot (DOM changed): ${e.elements.length} elements, ${e.interactiveCount} interactive, corr=${i.correlationId}`),this.sendCallback(i))}else console.debug("[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=f=>f.map(h=>{var b;return`${h.tag}:${(b=h.text)==null?void 0:b.slice(0,20)}:${Math.round(h.rect.x)}:${Math.round(h.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 h;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 f={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,parentTag:((h=a.parentElement)==null?void 0:h.tagName.toLowerCase())||null,depth:this.getElementDepth(a)};e.push(f)}),{timestamp:Date.now(),url:An(),viewport:n,elements:e,totalElements:e.length,interactiveCount:o}}shouldSkipElement(e){if(Ct(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"}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(),f=Math.abs(d.x-e.x)<=10,h=Math.abs(d.y-e.y)<=10,b=Math.abs(d.width-e.width)<=10*2,y=Math.abs(d.height-e.height)<=10*2;if(f&&h&&b&&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?(console.warn(`[DOMIntrospector] ⚠️ Bounding box match REJECTED - text mismatch! Expected: "${r}", Found: "${c}"`),console.warn(`[DOMIntrospector] Element at (${e.x}, ${e.y}) has text "${c}" which doesn't match expected "${r}" - page may have scrolled`),null):(console.log(`[DOMIntrospector] Found ${o.length} candidates by bounding box, best score: ${l.score}, text: "${c}"`),l.element)}return null}}const lr=class lr{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){lr.domIntrospector=e,console.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 console.warn("[HybridTargetResolver] ❌ No target provided"),null;console.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 console.log(`[HybridTargetResolver] consensus results (${n.confidence.toFixed(1)}% confidence)`,this.safeStringify(i,2)),n.element?n.element:null}static resolveTargetWithConsensus(e){var f;const n=performance.now(),r=this.getAvailableStrategies(e);if(r.length===0)return console.warn("[HybridTargetResolver] ⚠️ No strategies available for target"),{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};console.log(`[HybridTargetResolver] 🔄 Running ${r.length} strategies in parallel...`);const i=new Map;for(const h of r){const b=this.executeStrategyMulti(h,e);for(const y of b)Ct(y)||y.isConnected&&(i.has(y)?i.get(y).strategies.push(h):i.set(y,{element:y,strategies:[h],validationScore:0,interactable:!1,confidence:0}))}if(console.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[h,b]of i){if(!h.isConnected){console.warn("[HybridTargetResolver] ⚠️ Candidate element was removed from DOM, skipping");continue}b.validationScore=this.computeValidationScore(h,e),b.interactable=this.checkInteractability(h).ok,b.confidence=this.computeConfidence(b,r.length,e),o.push(b),console.log(`[HybridTargetResolver] <${h.tagName.toLowerCase()}> "${(f=h.textContent)==null?void 0:f.slice(0,25)}..."`),console.log(`[HybridTargetResolver] Strategies: ${b.strategies.join(", ")} (${b.strategies.length}/${r.length})`),console.log(`[HybridTargetResolver] Confidence: ${b.confidence.toFixed(1)}%`)}if(o.length===0)return{element:null,confidence:0,strategies:[],candidateCount:i.size,ambiguous:!1,duration:performance.now()-n};o.sort((h,b)=>b.confidence-h.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&&console.warn("[HybridTargetResolver] ⚠️ AMBIGUOUS: Top candidates have similar confidence"),s.confidence<30)return console.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 h=o.find(b=>b.interactable);if(h&&h.confidence>30)return console.log(`[HybridTargetResolver] ✅ Using interactable candidate (${h.confidence.toFixed(1)}%)`),{element:this.getClickableContainer(h.element),confidence:h.confidence,strategies:h.strategies,candidateCount:i.size,ambiguous:c,duration:l}}return console.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 console.warn(`[HybridTargetResolver] Skipping Playwright-style selector (not CSS): "${e.substring(0,50)}..."`),!1;try{return document.querySelector(e),!0}catch{return console.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=fy(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{console.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){console.warn(`[HybridTargetResolver] Strategy "${e}" threw error:`,i)}return r}static findAllByText(e,n){var b,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)&&(console.log(`[HybridTargetResolver] → Found nearby input for label "${(b=m.textContent)==null?void 0:b.trim().substring(0,30)}": <${S.tagName.toLowerCase()}>`),d.push(S),i.add(S))}r.push(...d);const f=o.toLowerCase(),h=document.querySelectorAll("input, textarea");for(const m of h){const S=m;if(Ct(S)||i.has(S))continue;const v=((y=S.getAttribute("placeholder"))==null?void 0:y.trim().toLowerCase())||"";if(v===f||v&&v.includes(f)&&f.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,f;let r=0,i=0,o=!1,s=!1;if(n.role){i+=25;const h=e.getAttribute("role");if(h===n.role)r+=25;else if(h)o=!0;else{const b=e.tagName.toLowerCase(),y=typeof e.className=="string"?e.className:"";b==="div"||b==="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 h=e.tagName.toLowerCase(),b=n.tag.toLowerCase();h===b?r+=15:n.role==="combobox"&&(h==="input"||h==="div")&&(r+=10)}if(n.text&&!n.optionText){i+=20;const h=(e.textContent||"").toLowerCase().trim(),b=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===b||S.includes(b))&&(r+=20)}else if(h===b)r+=20;else if(h.includes(b)){const y=b.length/h.length;y>.8?r+=15:y>.5?r+=8:(new RegExp(`\\b${lr.escapeRegex(b)}\\b`,"i").test(h)?r+=2:r+=0,console.log(`[HybridTargetResolver] Text length mismatch: "${b}" (${b.length}) in "${h.slice(0,30)}..." (${h.length}), ratio=${y.toFixed(2)}, points=${r}`))}else if(b.includes(h)){const y=h.length/b.length;r+=Math.round(15*y)}}if(n.ariaLabel){i+=15;const h=e.getAttribute("aria-label")||"";h.toLowerCase()===n.ariaLabel.toLowerCase()?r+=15:h.toLowerCase().includes(n.ariaLabel.toLowerCase())&&(r+=10)}if(n.placeholder){i+=15;const h=e.placeholder||"",b=n.placeholder.toLowerCase();if(h.toLowerCase().includes(b))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"]');(((f=m==null?void 0:m.textContent)==null?void 0:f.toLowerCase().trim())||"").includes(b)&&(r+=15)}}if(n.labelText){i+=20;const h=this.getAssociatedLabelText(e);if(h){const b=h.toLowerCase().trim().replace(/\*$/,"").trim(),y=n.labelText.toLowerCase().trim().replace(/\*$/,"").trim();b===y?r+=20:(b.includes(y)||y.includes(b))&&(r+=15)}}if(n.optionText){i+=15;const b=(e.textContent||"").trim().toLowerCase(),y=n.optionText.toLowerCase().trim();b===y?r+=15:b.includes(y)&&(r+=10)}if(i===0)return 100;let a=Math.round(r/i*100);if(o?(a=Math.round(a*.3),console.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),console.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),console.log("[HybridTargetResolver] tabindex=-1 input penalty (85%): likely hidden placeholder"))),n.selector){const h=this.extractSelectorContext(n.selector);if(h.parentTag||h.parentSelector){const b=this.matchesSelectorContext(e,h);b>.5?a=Math.min(100,Math.round(a*1.15)):b<.5&&n.text&&(a=Math.round(a*.7))}}if(n.text){const h=e.tagName.toLowerCase(),b=e.getAttribute("role"),y=["button","a","input","select","textarea"].includes(h),m=["button","link","menuitem","option","tab","checkbox","radio"].includes(b||""),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)),console.log(`[HybridTargetResolver] Interactive element bonus (25%): <${h}> 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 console.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();c===d?(a=100,console.log("[HybridTargetResolver] Selector + exact text match bonus applied")):c.includes(d)?(a=70,console.log("[HybridTargetResolver] Selector + partial text match bonus applied")):(a=20,console.log("[HybridTargetResolver] Selector match but NO text match - reduced bonus"))}else a=100,console.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 console.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"),console.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(Ct(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x),h=Math.abs(d.y-e.y),b=Math.abs(d.width-e.width),y=Math.abs(d.height-e.height);if(f<=i&&h<=i&&b<=i*2&&y<=i*2){let S=100-f-h;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 console.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 console.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 console.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 console.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 console.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 console.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 console.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 console.log(`[HybridTargetResolver] Validation failed: associated label="${s}" !== expected "${n.labelText}"`),!1;console.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 console.log(`[HybridTargetResolver] Validation failed: option text="${s}" !== expected "${n.optionText}"`),!1;r.push("optionText")}return r.length>0&&console.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(f=>f.length>0);for(const f of d){const h=document.getElementById(f);if(h)return((a=h.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 f of d){if(e.contains(f)||f.contains(e)||f.querySelector('input, select, textarea, [role="combobox"]'))continue;if(i.querySelectorAll('input, select, textarea, [role="combobox"]').length===1){const b=(l=f.textContent)==null?void 0:l.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}else if(this.isLabelForElement(f,e,i)){const b=(c=f.textContent)==null?void 0:c.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}}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 f=Math.abs(d.left-i.right),h=Math.abs(o.left-i.right);if(f<h&&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),f=Math.abs(o.left-i.right);if(d<f-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 console.log('[HybridTargetResolver] → Input has tabindex="-1" (hidden placeholder)'),!0;try{const o=window.getComputedStyle(e);if(o.opacity==="0")return console.log("[HybridTargetResolver] → Element has opacity: 0 (hidden placeholder)"),!0;if(o.visibility==="hidden")return console.log("[HybridTargetResolver] → Element has visibility: hidden (hidden placeholder)"),!0;const s=e.getBoundingClientRect();if(s.width<=5&&s.height<=5)return console.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 console.log("[HybridTargetResolver] → Element is tiny absolute-positioned (hidden placeholder)"),!0}}catch{}return!1}static getClickableContainer(e){var o,s;if(!this.isHiddenPlaceholderInput(e))return e;console.log("[HybridTargetResolver] → Looking for clickable container...");const n=['[class*="-control"]','[class*="control"]',".MuiSelect-select",".MuiInputBase-root",".MuiOutlinedInput-root",'[role="button"]','[role="combobox"]:not(input)','[aria-haspopup="listbox"]','[class*="select-container"]','[class*="dropdown-container"]','[class*="picker"]'];let r=e.parentElement,i=0;for(;r&&i<6;){for(const l of n)try{if(r.matches(l)){const c=r.getBoundingClientRect();if(c.width>50&&c.height>20)return console.log(`[HybridTargetResolver] → Found clickable container: ${r.tagName}.${(o=r.className)==null?void 0:o.split(" ").slice(0,2).join(".")}`),r}}catch{}const a=r.getBoundingClientRect();if(a.width>100&&a.height>30){const l=r.getAttribute("role"),c=r.onclick!==null||r.getAttribute("onclick")!==null||r.classList.contains("clickable");if(l==="button"||l==="combobox"||c||r.querySelector('input[role="combobox"]')===e)return console.log(`[HybridTargetResolver] → Found clickable container (generic): ${r.tagName}.${(s=r.className)==null?void 0:s.split(" ").slice(0,2).join(".")}`),r}r=r.parentElement,i++}return console.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,"\\");console.log(`[HybridTargetResolver] → Normalized selector: "${n}"`);const r=n.match(/\[data-option-text="([^"]+)"\]/);if(r){const l=r[1];return console.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 console.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 console.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&&(console.warn(`[HybridTargetResolver] ⚠️ AMBIGUOUS SELECTOR: "${o}" matches ${l.length} elements!`),console.warn("[HybridTargetResolver] ⚠️ Bot should send more specific targeting (text, label, boundingBox, domIndex)"),l.forEach((c,d)=>{const f=c,h=f.getAttribute("placeholder")||"",b=f.getAttribute("aria-label")||"",y=f.id||"";console.log(`[HybridTargetResolver] ${d}: id="${y}" placeholder="${h}" aria-label="${b}"`)}))}const a=document.querySelector(o);return a?this.isAccessibilityOnlyElement(a)?(console.log(`[HybridTargetResolver] → Selector matched a11y-only element (class: ${a.className}), skipping`),null):a:(console.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){var o,s,a;const n=e.toLowerCase().trim(),r=['[role="listbox"]','[role="menu"]','[class*="-menu"]:not([aria-hidden="true"])','[class*="listbox"]','[class*="options-container"]',".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"],i=["singleValue","single-value","selectedValue","selected-value","placeholder","value-container","MuiSelect-select"];for(const l of r){let c;try{c=document.querySelectorAll(l)}catch{continue}for(const d of c){const f=d;if(!lr.isVisible(f)||f.getBoundingClientRect().height<20)continue;const b=d.querySelectorAll('[role="option"], [class*="option"]:not([class*="singleValue"]):not([class*="placeholder"]), nz-option-item, .ant-select-item-option, .ant-select-item-option-content');for(const y of b){const m=y,S=m.className||"";if(i.some(k=>S.toLowerCase().includes(k.toLowerCase()))){console.log(`[HybridTargetResolver] → Skipping display value: "${(o=m.textContent)==null?void 0:o.trim().substring(0,30)}..."`);continue}if(!m.closest('[role="listbox"], [role="menu"], [class*="-menu"]'))continue;const w=((s=m.textContent)==null?void 0:s.trim().toLowerCase())||"";if(w===n||w.includes(n))return console.log(`[HybridTargetResolver] → Found ACTUAL option in open menu: "${(a=m.textContent)==null?void 0:a.trim()}"`),m}}}return console.log(`[HybridTargetResolver] → No option "${e}" found in any open dropdown menu`),console.log("[HybridTargetResolver] → The dropdown may need to be opened first"),null}static findMultiSelectChipRemoveButton(e){var i;const n=e.toLowerCase().trim();console.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)){console.log(`[HybridTargetResolver] → Found chip with text: "${(i=l.textContent)==null?void 0:i.trim().substring(0,30)}..."`);const f=['[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 h of f){const b=l.querySelector(h);if(b&&this.isVisible(b))return console.log(`[HybridTargetResolver] → Found remove button: <${b.tagName.toLowerCase()}> with selector "${h}"`),b}return console.log("[HybridTargetResolver] → No specific remove button found, returning chip container"),l}}}return console.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 console.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 console.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 console.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 b,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 console.warn(`[HybridTargetResolver] → Invalid selector: "${i}"`),null}if(l.length===0)return null;console.log(`[HybridTargetResolver] → Looking for "${i}" associated with label "${e}"`),console.log(`[HybridTargetResolver] → Found ${l.length} elements matching selector`);const c=e.toLowerCase().trim();function d(S){return S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const f=S=>S.toLowerCase().trim().replace(/\*$/,"").trim()===c?!0:new RegExp(`(^|\\s)${d(c)}($|\\s|[:\\*\\?\\.\\,\\)\\]\\}\\-])`,"i").test(S),h=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(!h(S))continue;const v=S.getAttribute("id");if(v)try{const D=document.querySelector(`label[for="${CSS.escape(v)}"]`);if(D&&f(D.textContent||""))return console.log("[HybridTargetResolver] → Found via label[for] attribute"),S}catch{}const w=S.getAttribute("aria-labelledby");if(w){const D=w.split(/\s+/).filter(F=>F.length>0);for(const F of D){const J=document.getElementById(F);if(J&&f(J.textContent||""))return console.log("[HybridTargetResolver] → Found via aria-labelledby"),S}}const k=S.getAttribute("aria-label")||"";if(k&&f(k))return console.log("[HybridTargetResolver] → Found via aria-label"),S;const C=S.getAttribute("placeholder")||"";if(C&&f(C))return console.log("[HybridTargetResolver] → Found via placeholder"),S;let M=S.parentElement,O=0;for(;M&&O<6;){const D=M.querySelectorAll('input, select, textarea, [role="combobox"], [role="listbox"]'),F=Array.from(D),J=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,U=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 V of U){if(S.contains(V)||V.contains(S)||V.querySelector('input, select, textarea, [role="combobox"]'))continue;const q=((b=V.textContent)==null?void 0:b.trim())||"";if(!(q.length>50)&&f(q)){if(D.length===1&&J)return console.log(`[HybridTargetResolver] → Found via label in container: "${q}"`),S;if(J&&this.isTextNearElement(V,S,F))return console.log(`[HybridTargetResolver] → Found via label position: "${q}"`),S}}if(W||O>=3){const V=M.querySelectorAll(":scope > div, :scope > span, :scope > p, :scope > div > div, :scope > div > span, :scope > div > p");for(const q of V){if(q.querySelector('input, select, textarea, [role="combobox"]')||q.contains(S)||S.contains(q))continue;const ie=S.value||"";if(ie&&((y=q.textContent)==null?void 0:y.trim())===ie)continue;const H=((m=q.textContent)==null?void 0:m.trim())||"";if(H.length>0&&H.length<=30&&f(H)){if(D.length===1&&J)return console.log(`[HybridTargetResolver] → Found via nearby text: "${H}"`),S;if(J&&this.isTextNearElement(q,S,F))return console.log(`[HybridTargetResolver] → Found via nearby text (position): "${H}"`),S}}}M=M.parentElement,O++}}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,O,D,F,J,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 U=this.findElementByLabelText(i,r);if(U)return console.log(`[HybridTargetResolver] → Found element matching selector "${r}" associated with label "${i}"`),U}const l=`//${s}[normalize-space(.)=${a}]`;console.log(`[HybridTargetResolver] → XPath exact query: ${l}`);let c;try{c=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(U){console.warn("[HybridTargetResolver] → XPath query failed:",U),c={snapshotLength:0,snapshotItem:()=>null}}if(c.snapshotLength>0){console.log(`[HybridTargetResolver] → Found ${c.snapshotLength} exact match(es), checking visibility...`);let U=null,V=null;for(let q=0;q<c.snapshotLength;q++){const ie=c.snapshotItem(q);if(V||(V=ie),this.isDropdownDisplayValue(ie)){console.log(`[HybridTargetResolver] → Skipping display value (not an option): "${(C=ie.textContent)==null?void 0:C.trim().substring(0,30)}..."`);continue}const H=ie.getBoundingClientRect();if(H.width>0&&H.height>0){U=ie,console.log(`[HybridTargetResolver] → Returning visible match ${q}: "${(M=ie.textContent)==null?void 0:M.trim().substring(0,30)}..."`);break}}if(U)return U;if(V&&!this.isDropdownDisplayValue(V))return console.log("[HybridTargetResolver] → No visible matches, returning first (possibly hidden) element"),V}console.log("[HybridTargetResolver] → No exact match, trying partial match...");const d=`//${s}[contains(normalize-space(.), ${a})]`;console.log(`[HybridTargetResolver] → XPath partial query: ${d}`);let f;try{f=document.evaluate(d,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(U){console.warn("[HybridTargetResolver] → XPath partial query failed:",U),f={snapshotLength:0,snapshotItem:()=>null}}if(f.snapshotLength>0){let U=null,V=-1;const q=r?this.extractSelectorContext(r):{},ie=!!(q.parentTag||q.parentSelector);console.log(`[HybridTargetResolver] → Selector context: parentTag="${q.parentTag||"none"}", expectedTag="${q.expectedTag||"none"}"`);for(let H=0;H<f.snapshotLength;H++){const G=f.snapshotItem(H),ne=(G.textContent||"").trim();if(ne.length===0)continue;const R=ne.toLowerCase(),j=o.length/R.length,Q=G.getBoundingClientRect();if(Q.width===0||Q.height===0||this.isDropdownDisplayValue(G))continue;let ae=j;if(new RegExp(`\\b${lr.escapeRegex(o)}\\b`,"i").test(R))ae+=.5;else if(j<.5)if(ie){if(this.matchesSelectorContext(G,q)<.5){console.log(`[HybridTargetResolver] → Skipping low ratio match that doesn't match selector context: "${ne.slice(0,30)}..."`);continue}}else{console.log(`[HybridTargetResolver] → Skipping low ratio match (${j.toFixed(2)}): "${ne.slice(0,30)}..."`);continue}if(ie){const g=this.matchesSelectorContext(G,q);ae+=g*.3}ae>V&&(V=ae,U=G)}if(U)return console.log(`[HybridTargetResolver] → XPath partial match found (score=${V.toFixed(2)})!`),U}console.log("[HybridTargetResolver] → XPath found nothing, trying fallback...");const h=document.querySelectorAll(n||"*");console.log(`[HybridTargetResolver] → Fallback: checking ${h.length} <${n||"*"}> elements for text "${i}"`);const b=U=>{const V=U;return Ct(V)?!0:V.id==="root"||V.id==="app"||V.id==="__next"||V.tagName==="BODY"||V.tagName==="HTML"};for(const U of h){if(b(U)||(((O=U.textContent)==null?void 0:O.trim().toLowerCase())||"")!==o)continue;const q=U.getBoundingClientRect();if(q.width>0&&q.height>0&&(((D=U.innerText)==null?void 0:D.trim().toLowerCase())||"")===o)return console.log("[HybridTargetResolver] → Found via exact text match"),U}let y=null,m=-1/0;for(const U of h){if(b(U))continue;const V=((F=U.textContent)==null?void 0:F.trim().toLowerCase())||"";if(V.length!==0&&V.includes(o)){const q=o.length/V.length,ie=U.getBoundingClientRect(),H=ie.width*ie.height;if(H>0&&H<5e5){const G=Math.max(0,50-H/1e4),ne=q*50,R=G+ne;R>m&&(m=R,y=U)}}}if(y){const U=y.getBoundingClientRect();return console.log(`[HybridTargetResolver] → Found via textContent (${U.width.toFixed(0)}x${U.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);console.log(`[HybridTargetResolver] → Checking ${v.length} input/textarea elements for placeholder "${i}"`);for(const U of v){const V=U;if(Ct(V))continue;const q=((J=V.getAttribute("placeholder"))==null?void 0:J.trim())||"";if(q.toLowerCase()===o){const ie=V.getBoundingClientRect();if(ie.width>0&&ie.height>0)return console.log(`[HybridTargetResolver] → Found via placeholder match: "${q}"`),V}}let w=null,k=0;for(const U of v){const V=U;if(Ct(V))continue;const q=((W=V.getAttribute("placeholder"))==null?void 0:W.trim().toLowerCase())||"";if(q&&q.includes(o)){const ie=o.length/q.length;if(ie>.6&&ie>k){const H=V.getBoundingClientRect();H.width>0&&H.height>0&&(w=V,k=ie)}}}return w?(console.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 console.log("[HybridTargetResolver] → Found via exact aria-label match"),n;const r=document.querySelectorAll("[aria-label]");console.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 console.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 console.log("[HybridTargetResolver] → Found via exact placeholder match"),n;const r=document.querySelectorAll("input, textarea");console.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 console.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(console.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 console.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(console.log(`[HybridTargetResolver] → Found ${r.length} <${e}> elements`),n){const a=n.toLowerCase().trim();let l=null,c=null,d=0;for(const f of r){const h=f;if(h.id==="root"||h.id==="app"||h.tagName==="BODY"||h.tagName==="HTML"||!lr.isVisible(h)||(((i=h.innerText)==null?void 0:i.length)||0)>200)continue;const y=((o=h.innerText)==null?void 0:o.trim())||"",m=y.toLowerCase();if(m===a){console.log(`[HybridTargetResolver] → Found exact match: "${y.substring(0,50)}..."`),l=h;break}if(m.includes(a)){const S=a.length/m.length;S>.7&&S>d&&(c=h,d=S)}}if(l)return l;if(c){const f=((s=c.innerText)==null?void 0:s.trim().substring(0,50))||"";return console.log(`[HybridTargetResolver] → Found close match (${(d*100).toFixed(0)}%): "${f}..."`),c}return console.log(`[HybridTargetResolver] → No matching <${e}> found for text "${n}"`),null}if(e==="div"||e==="span")return console.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){console.log("[HybridTargetResolver] 📜 Scrolling element into view"),e.scrollIntoView({behavior:"smooth",block:"center",...n})}static async waitForPositionStability(e,n=1e3,r=50,i=2){console.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(h=>setTimeout(h,r));const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return console.warn("[HybridTargetResolver] ⚠️ Element disappeared during stability check"),null;const d=Math.abs(c.x-o.x),f=Math.abs(c.y-o.y);if(d<i&&f<i){if(s++,s>=a)return console.log(`[HybridTargetResolver] ✅ Element position stable at (${c.x.toFixed(0)}, ${c.y.toFixed(0)}) after ${Date.now()-l}ms`),c}else s=0,console.log(`[HybridTargetResolver] 📍 Element still moving: (${o.x.toFixed(0)}, ${o.y.toFixed(0)}) → (${c.x.toFixed(0)}, ${c.y.toFixed(0)})`);o=c}return console.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")};console.log("[HybridTargetResolver] 🔄 Re-resolving with position-independent target (no boundingBox/domIndex)");const i=this.resolveTarget(r);if(!i)return console.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&&console.warn(`[HybridTargetResolver] ⚠️ Element changed during wait: "${o}" → "${s}"`),i}};L(lr,"domIntrospector",null);let be=lr;class Nx{constructor(){L(this,"confirmationSound");L(this,"lastError",null);this.confirmationSound=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=")}humanLikeClick(e,n={}){return py(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(()=>{}),console.log(`[ActionExecutor] Executed ${e.type} on ${e.selector}`)),r}catch(r){return console.error("[ActionExecutor] Failed to execute action:",r),!1}}async executeHybridAction(e,n=!0){this.lastError=null;try{if(console.log("[ActionExecutor] Executing hybrid action:",e),e.action==="navigate"){const s=e.value;if(!s)return console.warn("[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 console.warn("[ActionExecutor] Navigate blocked — disallowed scheme:",l.protocol),this.lastError=`Navigate blocked: disallowed URL scheme "${l.protocol}"`,!1;a=l.href}catch{return console.warn("[ActionExecutor] Navigate blocked — invalid URL:",s),this.lastError=`Navigate blocked: invalid URL "${s}"`,!1}return console.log("[ActionExecutor] 🧭 Navigating to URL:",a),window.location.href=a,!0}if(e.target.optionText&&e.action==="click"){console.log("[ActionExecutor] 🔽 Dropdown option click detected:",e.target.optionText);let s=be.resolveTarget(e.target);if(!s){console.log("[ActionExecutor] Option not visible - dropdown may be closed, attempting to open...");let a=!1;if(e.target.dropdownTriggerSelector){console.log("[ActionExecutor] Using dropdownTriggerSelector:",e.target.dropdownTriggerSelector);const l=hy(e.target.dropdownTriggerSelector);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.labelText){console.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){console.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(console.log("[ActionExecutor] Waiting for dropdown to open..."),await new Promise(l=>setTimeout(l,300)),s=be.resolveTarget(e.target),!s)return console.warn("[ActionExecutor] ❌ Option still not found after opening dropdown:",e.target.optionText),!1;console.log("[ActionExecutor] ✅ Found option after opening dropdown")}else return console.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(()=>{}),console.log(`[ActionExecutor] ✅ Successfully clicked dropdown option: "${e.target.optionText}"`),!0)}const r=be.resolveTarget(e.target);if(!r)return console.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(()=>{}),console.log(`[ActionExecutor] Successfully executed "${e.action}" on element`)),o}catch(r){return console.error("[ActionExecutor] Failed to execute hybrid action:",r),this.lastError=r instanceof Error?r.message:String(r),!1}}async executeOnElement(e,n,r,i){switch(be.scrollIntoView(n),await new Promise(o=>setTimeout(o,300)),e){case"click":await this.expandCollapsedContainer(n),this.simulateClick(n,i);break;case"type":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}))):(n.focus(),n.textContent=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})));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 console.warn("[ActionExecutor] Unknown action type:",e),!1}return!0}async expandCollapsedContainer(e){const n=this.findCollapsedContainer(e);if(n){console.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)),console.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 console.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){console.log("[ActionExecutor] 🎯 Detected dropdown option selector, searching for:",d);const h=this.findDropdownOption(d);if(h){console.log("[ActionExecutor] Found option by text, clicking it"),this.performClick(h);return}console.log("[ActionExecutor] Option not found by text, trying direct click")}const f=this.parseLabelFromSelector(n);if(f){console.log("[ActionExecutor] 🎯 Detected labeled combobox selector:",f);const h=this.findComboboxByLabel(f);if(h){console.log("[ActionExecutor] Found combobox by label, opening it"),this.handleComboboxClick(h);return}console.log("[ActionExecutor] Combobox not found by label, trying direct match")}}const r=this.findComboboxInput(e);if(r){console.log("[ActionExecutor] 🎯 Detected combobox/dropdown - using special handling"),this.handleComboboxClick(r);return}if(this.isDropdownOption(e)){console.log("[ActionExecutor] 🎯 Element is dropdown option - using React onClick + DOM events");const d=this.triggerReactOnClick(e);console.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(console.log("[ActionExecutor] 🎯 Element has React onClick - using direct call only"),this.triggerReactOnClick(i)){this.sendClickMetadata(i,e),console.log("[ActionExecutor] ✅ React onClick executed at",s,a,"on",i.tagName),i!==e&&console.log("[ActionExecutor] Note: Clicked parent",i.tagName,"instead of",e.tagName);return}console.log("[ActionExecutor] ⚠️ React onClick found but call failed, falling back to DOM events")}console.log("[ActionExecutor] Using humanLikeClick (no React onClick or fallback)");const c=this.humanLikeClick(i,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});c!==e&&c!==i&&console.log("[ActionExecutor] Note: humanLikeClick hit",c.tagName,"instead of element",e.tagName,"or clickTarget",i.tagName)}findComboboxInput(e){if(e.getAttribute("role")==="combobox")return console.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 console.log("[ActionExecutor] Found combobox via aria-haspopup container"),o;if(e.tagName==="BUTTON")return console.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 h=n.querySelector('input[role="combobox"]');if(h)return console.log("[ActionExecutor] Found combobox input via control element"),h;const b=n.parentElement;if(b){const m=b.querySelector('input[role="combobox"]');if(m)return console.log("[ActionExecutor] Found combobox input in parent container"),m}const y=n.querySelector('button[aria-haspopup="listbox"]');if(y)return console.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 console.log("[ActionExecutor] Found combobox by label:",e),a}}}return null}handleComboboxClick(e){console.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})),console.log("[ActionExecutor] ✅ Combobox/dropdown humanLikeClick complete, actual element:",i.tagName)}openDropdown(e){this.handleComboboxClick(e)}triggerReactOnClickPublic(e){return this.triggerReactOnClick(e)}findDropdownOption(e){var r;const n=['[role="listbox"]','[role="menu"]','[class*="menu"]:not([aria-hidden])','[class*="listbox"]','[class*="options"]',"[data-radix-popper-content-wrapper]",".MuiMenu-list",".MuiAutocomplete-listbox",".ant-select-dropdown","nz-option-container",".cdk-overlay-pane"];for(const i of n){const o=document.querySelectorAll(i);for(const s of o){if(!be.isVisible(s))continue;const a=['[role="option"]','[class*="option"]','[class*="item"]',"nz-option-item",".ant-select-item-option",".ant-select-item-option-content","li"];for(const l of a){const c=s.querySelectorAll(l);for(const d of c){const f=(r=d.textContent)==null?void 0:r.trim();if(f===e||f!=null&&f.includes(e))return console.log("[ActionExecutor] Found dropdown option:",f),d}}}}return null}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(console.log("[ActionExecutor] Finding clickable element for:",e.tagName,r(e).substring(0,50)),!n.includes(e.tagName))return console.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),f=d.includes("cursor-pointer"),h=(a=i.classList)==null?void 0:a.contains("cursor-pointer"),b=i.hasAttribute("onclick")||i.hasAttribute("data-onclick")||i.getAttribute("role")==="button"||i.getAttribute("role")==="menuitem",y=i.tagName==="BUTTON"||i.tagName==="A";if(console.log(`[ActionExecutor] Checking parent #${s}:`,i.tagName,"cursor:",l.cursor,"hasCursorClass:",f||h,"classes:",d.substring(0,60)),(c||f||h||b||y)&&(o=i,console.log("[ActionExecutor] ✅ Found clickable parent:",i.tagName,d.substring(0,80)),y||i.getAttribute("role")==="button"))break;i=i.parentElement}return console.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(console.log("[ActionExecutor] Found React property:",s),a!=null&&a.onClick){console.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){console.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 console.log("[ActionExecutor] No React onClick handler found"),!1}catch(n){return console.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 f=r(o);if(f){const h=f.trim().split(/\s+/).slice(0,3).join(".");h&&(d+="."+h)}}i.unshift(d),o=o.parentElement}const s=d=>{var b;const f=d.querySelector("span, label, p");if((b=f==null?void 0:f.textContent)!=null&&b.trim())return f.textContent.trim().substring(0,50);let h="";for(const y of Array.from(d.childNodes))y.nodeType===Node.TEXT_NODE&&(h+=(y.textContent||"").trim()+" ");return h=h.trim(),!h&&d.textContent&&(h=d.textContent.trim().substring(0,50)),h},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"};console.log("[ActionExecutor] 📤 Sending React onClick metadata:",c.text,`(source: ${c.source})`),a!=null&&a.sendMetadata?a.sendMetadata(c):console.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){console.log("[ActionExecutor] Virtual selector detected - finding option by text:",i);const s=this.findDropdownOption(i);return s?(this.performClick(s),!0):(console.warn("[ActionExecutor] Option not found by text:",i),!1)}const o=this.parseLabelFromSelector(e.selector);if(o){console.log("[ActionExecutor] Virtual selector detected - finding combobox by label:",o);const s=this.findComboboxByLabel(o);return s?(this.handleComboboxClick(s),!0):(console.warn("[ActionExecutor] Combobox not found by label:",o),!1)}}const n=this.stripVirtualAttributes(e.selector),r=document.querySelector(n);if(!r)return console.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 console.warn("[ActionExecutor] Unknown action type:",e.type),!1}return!0}}class
|
|
477
|
+
`.replace(/\s+/g," ").trim()),L(Et,"SKIP_SELECTORS",["#onboarding-overlay","#onboarding-sdk-react-ui","#hse-highlight-element","script","style","noscript","template"]);let yd=Et;const Ix=["#onboarding-overlay","#floe-cursor","#onboarding-sdk-react-ui","#hse-highlight-element","#floe-cursor-styles","#onboarding-animations"],Oi="data-floe-widget";function Ct(t){if(!t)return!1;if(t.hasAttribute(Oi))return!0;for(const e of Ix)if(t.closest(e))return!0;return!1}function An(){return window.location.origin+window.location.pathname}function Ha(t){try{const e=new URL(t,window.location.origin);return e.origin+e.pathname}catch{return t}}function hy(t){return t&&t.replace(/\.ng-(untouched|touched|pristine|dirty|valid|invalid)/g,"")}function py(t){try{const n=document.querySelector(t);if(n)return n}catch{}const e=hy(t);if(e!==t)try{const n=document.querySelector(e);if(n)return console.log(`[AngularFallback] Selector matched after stripping state classes: "${e}"`),n}catch{}return null}function Rx(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 gy(t,e={}){var h,b,y,v,S;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&&console.log("[humanLikeClick] 🎯 Using element at point:",d.tagName,"instead of target:",t.tagName);else if(c){if(console.warn("[humanLikeClick] ⚠️ Element at point is unrelated:",c.tagName,(h=c.className)==null?void 0:h.toString().slice(0,50)),console.warn("[humanLikeClick] Expected target:",t.tagName,(b=t.className)==null?void 0:b.toString().slice(0,50)),Rx(c)){const m=`${c.tagName} (${(y=c.className)==null?void 0:y.toString().slice(0,80)})`;throw console.error("[humanLikeClick] ❌ BLOCKED: Modal/dialog overlay is covering the target element.",`Overlay: ${m}`,`Target: ${t.tagName} "${(v=t.textContent)==null?void 0:v.trim().slice(0,50)}"`),new Error(`Click blocked by modal overlay: ${m}. Target "${(S=t.textContent)==null?void 0:S.trim().slice(0,50)}" is behind the modal. Interact with the modal instead.`)}d=t}else console.warn("[humanLikeClick] ⚠️ No element at coordinates, falling back to target"),d=t;n&&typeof d.focus=="function"&&d.focus();const f={bubbles:!0,cancelable:!0,view:window,clientX:a,clientY:l,screenX:a+window.screenX,screenY:l+window.screenY,button:0,buttons:1};if(r){const m={...f,pointerType:"mouse",isPrimary:!0};d.dispatchEvent(new PointerEvent("pointerdown",m)),d.dispatchEvent(new PointerEvent("pointerup",m))}return o&&(d.dispatchEvent(new MouseEvent("mouseenter",{...f,bubbles:!1})),d.dispatchEvent(new MouseEvent("mouseover",f))),d.dispatchEvent(new MouseEvent("mousedown",f)),d.dispatchEvent(new MouseEvent("mouseup",f)),d.dispatchEvent(new MouseEvent("click",f)),i&&typeof d.click=="function"&&d.click(),console.log("[humanLikeClick] ✅ Completed on",d.tagName,"at (",Math.round(a),",",Math.round(l),")"),d}class my{constructor(){L(this,"audioContext",null);L(this,"analyzerNode",null);L(this,"sourceNode",null);L(this,"dataArray",new Uint8Array(0));L(this,"isRunning",!1);L(this,"onLevelsCallback",null);L(this,"animationId",null);L(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(),console.log("[AudioAnalyzer] Started analyzing audio stream")}catch(r){console.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,console.log("[AudioAnalyzer] Stopped")}destroy(){this.stop(),this.audioContext&&(this.audioContext.close(),this.audioContext=null)}}class Nx{constructor(){L(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 $x{constructor(){L(this,"lastSnapshot",null);L(this,"lastSnapshotHash","");L(this,"snapshotInterval",null);L(this,"sendCallback",null);L(this,"correlationCounter",0);L(this,"INTERACTIVE_TAGS",new Set(["button","a","input","select","textarea","label","summary","details","option","menuitem"]));L(this,"INTERACTIVE_ROLES",new Set(["button","link","menuitem","option","tab","checkbox","radio","switch","textbox","combobox","listbox","slider"]));L(this,"mutationObserver",null);L(this,"mutationDebounceTimer",null)}startCapturing(e=1500,n){console.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.sendCallback=n,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),console.log("[DOMIntrospector] Stopped DOM capture")}captureAndSendImmediate(e="immediate"){console.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&&(console.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"].includes(r.attributeName||""))&&(this.mutationDebounceTimer=setTimeout(()=>{console.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","href","src"]}))}captureAndSend(){const e=this.captureSnapshot(),n=this.computeSnapshotHash(e);if(n!==this.lastSnapshotHash){const i={...e,correlationId:`dom-${Date.now()}-${++this.correlationCounter}`,captureReason:"periodic",domChanged:!0};this.lastSnapshot=i,this.lastSnapshotHash=n,this.sendCallback&&(console.log(`[DOMIntrospector] Sending snapshot (DOM changed): ${e.elements.length} elements, ${e.interactiveCount} interactive, corr=${i.correlationId}`),this.sendCallback(i))}else console.debug("[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=f=>f.map(h=>{var b;return`${h.tag}:${(b=h.text)==null?void 0:b.slice(0,20)}:${Math.round(h.rect.x)}:${Math.round(h.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 h;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 f={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,parentTag:((h=a.parentElement)==null?void 0:h.tagName.toLowerCase())||null,depth:this.getElementDepth(a)};e.push(f)}),{timestamp:Date.now(),url:An(),viewport:n,elements:e,totalElements:e.length,interactiveCount:o}}shouldSkipElement(e){if(Ct(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"}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 v;const c=l;if(this.shouldSkipElement(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x)<=10,h=Math.abs(d.y-e.y)<=10,b=Math.abs(d.width-e.width)<=10*2,y=Math.abs(d.height-e.height)<=10*2;if(f&&h&&b&&y){let S=100,m=!1;if(n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r){const w=((v=c.innerText)==null?void 0:v.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?(console.warn(`[DOMIntrospector] ⚠️ Bounding box match REJECTED - text mismatch! Expected: "${r}", Found: "${c}"`),console.warn(`[DOMIntrospector] Element at (${e.x}, ${e.y}) has text "${c}" which doesn't match expected "${r}" - page may have scrolled`),null):(console.log(`[DOMIntrospector] Found ${o.length} candidates by bounding box, best score: ${l.score}, text: "${c}"`),l.element)}return null}}const Fx=[".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"]'],jx=['[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"],Bx=['[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(", "),vy=["input.ant-select-selection-search-input",'input[role="combobox"]','input[type="search"]','input[class*="search"]','input[class*="Search"]','input[aria-autocomplete="list"]'];function Ux(t){for(const e of Fx)try{const n=document.querySelector(e);if(n&&t(n)){const r=n.getBoundingClientRect();if(r.height>20&&r.width>20)return console.log("[DropdownHelpers] Dropdown detected as open via:",e),!0}}catch{continue}return!1}function zx(t,e){if(t instanceof HTMLInputElement&&(t.getAttribute("role")==="combobox"||t.classList.contains("ant-select-selection-search-input")||t.type==="search"))return console.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 vy){const a=r.querySelector(s);if(a)return console.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 vy){const l=s.querySelector(a);if(l)return console.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"))?(console.log("[DropdownHelpers] Found search input as active element"),o):(console.log("[DropdownHelpers] No search input found for dropdown"),null)}function Hx(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 $o(t,e){var o;const n=t.toLowerCase().trim();let r=null,i=null;for(const s of jx){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 f=l.querySelectorAll(Bx);for(const h of f){const b=h,y=b.className||"";if(y.toLowerCase().includes("singlevalue")||y.toLowerCase().includes("placeholder"))continue;const v=b.getBoundingClientRect();if(v.height===0||v.width===0)continue;const S=((o=b.textContent)==null?void 0:o.trim().toLowerCase())||"";if(S===n){console.log(`[DropdownHelpers] Found EXACT match for option: "${t}"`),r=b;break}if(!i&&S.includes(n)){const m=n.length/S.length;m>.7&&(console.log(`[DropdownHelpers] Found partial match (${(m*100).toFixed(0)}%): "${S.slice(0,50)}"`),i=b)}}if(r)break}if(r)break}return r||(i?(console.warn(`[DropdownHelpers] Using partial match for "${t}" — verify correctness`),i):(console.log(`[DropdownHelpers] No option found for: "${t}"`),null))}async function Vx(t,e,n){const r=Hx(e);for(const i of r){console.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=$o(e,n);if(o||(await new Promise(s=>setTimeout(s,300)),o=$o(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 lr=class lr{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){lr.domIntrospector=e,console.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 console.warn("[HybridTargetResolver] ❌ No target provided"),null;console.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 console.log(`[HybridTargetResolver] consensus results (${n.confidence.toFixed(1)}% confidence)`,this.safeStringify(i,2)),n.element?n.element:null}static resolveTargetWithConsensus(e){var f;const n=performance.now(),r=this.getAvailableStrategies(e);if(r.length===0)return console.warn("[HybridTargetResolver] ⚠️ No strategies available for target"),{element:null,confidence:0,strategies:[],candidateCount:0,ambiguous:!1,duration:performance.now()-n};console.log(`[HybridTargetResolver] 🔄 Running ${r.length} strategies in parallel...`);const i=new Map;for(const h of r){const b=this.executeStrategyMulti(h,e);for(const y of b)Ct(y)||y.isConnected&&(i.has(y)?i.get(y).strategies.push(h):i.set(y,{element:y,strategies:[h],validationScore:0,interactable:!1,confidence:0}))}if(console.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[h,b]of i){if(!h.isConnected){console.warn("[HybridTargetResolver] ⚠️ Candidate element was removed from DOM, skipping");continue}b.validationScore=this.computeValidationScore(h,e),b.interactable=this.checkInteractability(h).ok,b.confidence=this.computeConfidence(b,r.length,e),o.push(b),console.log(`[HybridTargetResolver] <${h.tagName.toLowerCase()}> "${(f=h.textContent)==null?void 0:f.slice(0,25)}..."`),console.log(`[HybridTargetResolver] Strategies: ${b.strategies.join(", ")} (${b.strategies.length}/${r.length})`),console.log(`[HybridTargetResolver] Confidence: ${b.confidence.toFixed(1)}%`)}if(o.length===0)return{element:null,confidence:0,strategies:[],candidateCount:i.size,ambiguous:!1,duration:performance.now()-n};o.sort((h,b)=>b.confidence-h.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&&console.warn("[HybridTargetResolver] ⚠️ AMBIGUOUS: Top candidates have similar confidence"),s.confidence<30)return console.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 h=o.find(b=>b.interactable);if(h&&h.confidence>30)return console.log(`[HybridTargetResolver] ✅ Using interactable candidate (${h.confidence.toFixed(1)}%)`),{element:this.getClickableContainer(h.element),confidence:h.confidence,strategies:h.strategies,candidateCount:i.size,ambiguous:c,duration:l}}return console.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 console.warn(`[HybridTargetResolver] Skipping Playwright-style selector (not CSS): "${e.substring(0,50)}..."`),!1;try{return document.querySelector(e),!0}catch{return console.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=hy(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{console.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){console.warn(`[HybridTargetResolver] Strategy "${e}" threw error:`,i)}return r}static findAllByText(e,n){var b,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 v=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<v.snapshotLength;S++){const m=v.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 v=document.evaluate(c,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let S=0;S<v.snapshotLength;S++){const m=v.snapshotItem(S);m&&!this.isDropdownDisplayValue(m)&&!i.has(m)&&(r.push(m),i.add(m))}}catch{}const d=[];for(const v of r)if(!this.isInteractiveElement(v)){const S=this.findNearbyInput(v);S&&!i.has(S)&&(console.log(`[HybridTargetResolver] → Found nearby input for label "${(b=v.textContent)==null?void 0:b.trim().substring(0,30)}": <${S.tagName.toLowerCase()}>`),d.push(S),i.add(S))}r.push(...d);const f=o.toLowerCase(),h=document.querySelectorAll("input, textarea");for(const v of h){const S=v;if(Ct(S)||i.has(S))continue;const m=((y=S.getAttribute("placeholder"))==null?void 0:y.trim().toLowerCase())||"";if(m===f||m&&m.includes(f)&&f.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,f;let r=0,i=0,o=!1,s=!1;if(n.role){i+=25;const h=e.getAttribute("role");if(h===n.role)r+=25;else if(h)o=!0;else{const b=e.tagName.toLowerCase(),y=typeof e.className=="string"?e.className:"";b==="div"||b==="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 h=e.tagName.toLowerCase(),b=n.tag.toLowerCase();h===b?r+=15:n.role==="combobox"&&(h==="input"||h==="div")&&(r+=10)}if(n.text&&!n.optionText){i+=20;const h=(e.textContent||"").toLowerCase().trim(),b=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,v=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]'),S=((d=v==null?void 0:v.textContent)==null?void 0:d.toLowerCase().trim())||"";(S===b||S.includes(b))&&(r+=20)}else if(h===b)r+=20;else if(h.includes(b)){const y=b.length/h.length;y>.8?r+=15:y>.5?r+=8:(new RegExp(`\\b${lr.escapeRegex(b)}\\b`,"i").test(h)?r+=2:r+=0,console.log(`[HybridTargetResolver] Text length mismatch: "${b}" (${b.length}) in "${h.slice(0,30)}..." (${h.length}), ratio=${y.toFixed(2)}, points=${r}`))}else if(b.includes(h)){const y=h.length/b.length;r+=Math.round(15*y)}}if(n.ariaLabel){i+=15;const h=e.getAttribute("aria-label")||"";h.toLowerCase()===n.ariaLabel.toLowerCase()?r+=15:h.toLowerCase().includes(n.ariaLabel.toLowerCase())&&(r+=10)}if(n.placeholder){i+=15;const h=e.placeholder||"",b=n.placeholder.toLowerCase();if(h.toLowerCase().includes(b))r+=15;else if(n.role==="combobox"){const y=e.closest('[class*="container"]')||e.parentElement,v=y==null?void 0:y.querySelector('[class*="placeholder"], [id*="placeholder"]');(((f=v==null?void 0:v.textContent)==null?void 0:f.toLowerCase().trim())||"").includes(b)&&(r+=15)}}if(n.labelText){i+=20;const h=this.getAssociatedLabelText(e);if(h){const b=h.toLowerCase().trim().replace(/\*$/,"").trim(),y=n.labelText.toLowerCase().trim().replace(/\*$/,"").trim();b===y?r+=20:(b.includes(y)||y.includes(b))&&(r+=15)}}if(n.optionText){i+=15;const b=(e.textContent||"").trim().toLowerCase(),y=n.optionText.toLowerCase().trim();b===y?r+=15:b.includes(y)&&(r+=10)}if(i===0)return 100;let a=Math.round(r/i*100);if(o?(a=Math.round(a*.3),console.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),console.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),console.log("[HybridTargetResolver] tabindex=-1 input penalty (85%): likely hidden placeholder"))),n.selector){const h=this.extractSelectorContext(n.selector);if(h.parentTag||h.parentSelector){const b=this.matchesSelectorContext(e,h);b>.5?a=Math.min(100,Math.round(a*1.15)):b<.5&&n.text&&(a=Math.round(a*.7))}}if(n.text){const h=e.tagName.toLowerCase(),b=e.getAttribute("role"),y=["button","a","input","select","textarea"].includes(h),v=["button","link","menuitem","option","tab","checkbox","radio"].includes(b||""),S=e.onclick!==null||e.hasAttribute("onclick"),m=e.closest('button, a, [role="button"], [role="link"]');y||v?(a=Math.min(100,Math.round(a*1.25)),console.log(`[HybridTargetResolver] Interactive element bonus (25%): <${h}> 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 console.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();c===d?(a=100,console.log("[HybridTargetResolver] Selector + exact text match bonus applied")):c.includes(d)?(a=70,console.log("[HybridTargetResolver] Selector + partial text match bonus applied")):(a=20,console.log("[HybridTargetResolver] Selector match but NO text match - reduced bonus"))}else a=100,console.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 console.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"),console.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 v;const c=l;if(Ct(c))return;const d=c.getBoundingClientRect(),f=Math.abs(d.x-e.x),h=Math.abs(d.y-e.y),b=Math.abs(d.width-e.width),y=Math.abs(d.height-e.height);if(f<=i&&h<=i&&b<=i*2&&y<=i*2){let S=100-f-h;n&&c.tagName.toLowerCase()===n.toLowerCase()&&(S+=30),r&&(((v=c.innerText)==null?void 0:v.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 console.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 console.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 console.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 console.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 console.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 console.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 console.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 console.log(`[HybridTargetResolver] Validation failed: associated label="${s}" !== expected "${n.labelText}"`),!1;console.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 console.log(`[HybridTargetResolver] Validation failed: option text="${s}" !== expected "${n.optionText}"`),!1;r.push("optionText")}return r.length>0&&console.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(f=>f.length>0);for(const f of d){const h=document.getElementById(f);if(h)return((a=h.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 f of d){if(e.contains(f)||f.contains(e)||f.querySelector('input, select, textarea, [role="combobox"]'))continue;if(i.querySelectorAll('input, select, textarea, [role="combobox"]').length===1){const b=(l=f.textContent)==null?void 0:l.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}else if(this.isLabelForElement(f,e,i)){const b=(c=f.textContent)==null?void 0:c.trim().replace(/\*$/,"").trim();if(b&&b.length>0&&b.length<50)return b}}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 f=Math.abs(d.left-i.right),h=Math.abs(o.left-i.right);if(f<h&&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),f=Math.abs(o.left-i.right);if(d<f-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 console.log('[HybridTargetResolver] → Input has tabindex="-1" (hidden placeholder)'),!0;try{const o=window.getComputedStyle(e);if(o.opacity==="0")return console.log("[HybridTargetResolver] → Element has opacity: 0 (hidden placeholder)"),!0;if(o.visibility==="hidden")return console.log("[HybridTargetResolver] → Element has visibility: hidden (hidden placeholder)"),!0;const s=e.getBoundingClientRect();if(s.width<=5&&s.height<=5)return console.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 console.log("[HybridTargetResolver] → Element is tiny absolute-positioned (hidden placeholder)"),!0}}catch{}return!1}static getClickableContainer(e){var o,s;if(!this.isHiddenPlaceholderInput(e))return e;console.log("[HybridTargetResolver] → Looking for clickable container...");const n=['[class*="-control"]','[class*="control"]',".MuiSelect-select",".MuiInputBase-root",".MuiOutlinedInput-root",'[role="button"]','[role="combobox"]:not(input)','[aria-haspopup="listbox"]','[class*="select-container"]','[class*="dropdown-container"]','[class*="picker"]'];let r=e.parentElement,i=0;for(;r&&i<6;){for(const l of n)try{if(r.matches(l)){const c=r.getBoundingClientRect();if(c.width>50&&c.height>20)return console.log(`[HybridTargetResolver] → Found clickable container: ${r.tagName}.${(o=r.className)==null?void 0:o.split(" ").slice(0,2).join(".")}`),r}}catch{}const a=r.getBoundingClientRect();if(a.width>100&&a.height>30){const l=r.getAttribute("role"),c=r.onclick!==null||r.getAttribute("onclick")!==null||r.classList.contains("clickable");if(l==="button"||l==="combobox"||c||r.querySelector('input[role="combobox"]')===e)return console.log(`[HybridTargetResolver] → Found clickable container (generic): ${r.tagName}.${(s=r.className)==null?void 0:s.split(" ").slice(0,2).join(".")}`),r}r=r.parentElement,i++}return console.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,"\\");console.log(`[HybridTargetResolver] → Normalized selector: "${n}"`);const r=n.match(/\[data-option-text="([^"]+)"\]/);if(r){const l=r[1];return console.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 console.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 console.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&&(console.warn(`[HybridTargetResolver] ⚠️ AMBIGUOUS SELECTOR: "${o}" matches ${l.length} elements!`),console.warn("[HybridTargetResolver] ⚠️ Bot should send more specific targeting (text, label, boundingBox, domIndex)"),l.forEach((c,d)=>{const f=c,h=f.getAttribute("placeholder")||"",b=f.getAttribute("aria-label")||"",y=f.id||"";console.log(`[HybridTargetResolver] ${d}: id="${y}" placeholder="${h}" aria-label="${b}"`)}))}const a=document.querySelector(o);return a?this.isAccessibilityOnlyElement(a)?(console.log(`[HybridTargetResolver] → Selector matched a11y-only element (class: ${a.className}), skipping`),null):a:(console.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 $o(e,lr.isVisible)}static findMultiSelectChipRemoveButton(e){var i;const n=e.toLowerCase().trim();console.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)){console.log(`[HybridTargetResolver] → Found chip with text: "${(i=l.textContent)==null?void 0:i.trim().substring(0,30)}..."`);const f=['[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 h of f){const b=l.querySelector(h);if(b&&this.isVisible(b))return console.log(`[HybridTargetResolver] → Found remove button: <${b.tagName.toLowerCase()}> with selector "${h}"`),b}return console.log("[HybridTargetResolver] → No specific remove button found, returning chip container"),l}}}return console.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 console.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 console.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 console.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 b,y,v;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 console.warn(`[HybridTargetResolver] → Invalid selector: "${i}"`),null}if(l.length===0)return null;console.log(`[HybridTargetResolver] → Looking for "${i}" associated with label "${e}"`),console.log(`[HybridTargetResolver] → Found ${l.length} elements matching selector`);const c=e.toLowerCase().trim();function d(S){return S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const f=S=>S.toLowerCase().trim().replace(/\*$/,"").trim()===c?!0:new RegExp(`(^|\\s)${d(c)}($|\\s|[:\\*\\?\\.\\,\\)\\]\\}\\-])`,"i").test(S),h=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(!h(S))continue;const m=S.getAttribute("id");if(m)try{const D=document.querySelector(`label[for="${CSS.escape(m)}"]`);if(D&&f(D.textContent||""))return console.log("[HybridTargetResolver] → Found via label[for] attribute"),S}catch{}const w=S.getAttribute("aria-labelledby");if(w){const D=w.split(/\s+/).filter(F=>F.length>0);for(const F of D){const J=document.getElementById(F);if(J&&f(J.textContent||""))return console.log("[HybridTargetResolver] → Found via aria-labelledby"),S}}const k=S.getAttribute("aria-label")||"";if(k&&f(k))return console.log("[HybridTargetResolver] → Found via aria-label"),S;const C=S.getAttribute("placeholder")||"";if(C&&f(C))return console.log("[HybridTargetResolver] → Found via placeholder"),S;let M=S.parentElement,O=0;for(;M&&O<6;){const D=M.querySelectorAll('input, select, textarea, [role="combobox"], [role="listbox"]'),F=Array.from(D),J=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,U=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 V of U){if(S.contains(V)||V.contains(S)||V.querySelector('input, select, textarea, [role="combobox"]'))continue;const q=((b=V.textContent)==null?void 0:b.trim())||"";if(!(q.length>50)&&f(q)){if(D.length===1&&J)return console.log(`[HybridTargetResolver] → Found via label in container: "${q}"`),S;if(J&&this.isTextNearElement(V,S,F))return console.log(`[HybridTargetResolver] → Found via label position: "${q}"`),S}}if(W||O>=3){const V=M.querySelectorAll(":scope > div, :scope > span, :scope > p, :scope > div > div, :scope > div > span, :scope > div > p");for(const q of V){if(q.querySelector('input, select, textarea, [role="combobox"]')||q.contains(S)||S.contains(q))continue;const ie=S.value||"";if(ie&&((y=q.textContent)==null?void 0:y.trim())===ie)continue;const H=((v=q.textContent)==null?void 0:v.trim())||"";if(H.length>0&&H.length<=30&&f(H)){if(D.length===1&&J)return console.log(`[HybridTargetResolver] → Found via nearby text: "${H}"`),S;if(J&&this.isTextNearElement(q,S,F))return console.log(`[HybridTargetResolver] → Found via nearby text (position): "${H}"`),S}}}M=M.parentElement,O++}}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,O,D,F,J,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 U=this.findElementByLabelText(i,r);if(U)return console.log(`[HybridTargetResolver] → Found element matching selector "${r}" associated with label "${i}"`),U}const l=`//${s}[normalize-space(.)=${a}]`;console.log(`[HybridTargetResolver] → XPath exact query: ${l}`);let c;try{c=document.evaluate(l,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(U){console.warn("[HybridTargetResolver] → XPath query failed:",U),c={snapshotLength:0,snapshotItem:()=>null}}if(c.snapshotLength>0){console.log(`[HybridTargetResolver] → Found ${c.snapshotLength} exact match(es), checking visibility...`);let U=null,V=null;for(let q=0;q<c.snapshotLength;q++){const ie=c.snapshotItem(q);if(V||(V=ie),this.isDropdownDisplayValue(ie)){console.log(`[HybridTargetResolver] → Skipping display value (not an option): "${(C=ie.textContent)==null?void 0:C.trim().substring(0,30)}..."`);continue}const H=ie.getBoundingClientRect();if(H.width>0&&H.height>0){U=ie,console.log(`[HybridTargetResolver] → Returning visible match ${q}: "${(M=ie.textContent)==null?void 0:M.trim().substring(0,30)}..."`);break}}if(U)return U;if(V&&!this.isDropdownDisplayValue(V))return console.log("[HybridTargetResolver] → No visible matches, returning first (possibly hidden) element"),V}console.log("[HybridTargetResolver] → No exact match, trying partial match...");const d=`//${s}[contains(normalize-space(.), ${a})]`;console.log(`[HybridTargetResolver] → XPath partial query: ${d}`);let f;try{f=document.evaluate(d,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null)}catch(U){console.warn("[HybridTargetResolver] → XPath partial query failed:",U),f={snapshotLength:0,snapshotItem:()=>null}}if(f.snapshotLength>0){let U=null,V=-1;const q=r?this.extractSelectorContext(r):{},ie=!!(q.parentTag||q.parentSelector);console.log(`[HybridTargetResolver] → Selector context: parentTag="${q.parentTag||"none"}", expectedTag="${q.expectedTag||"none"}"`);for(let H=0;H<f.snapshotLength;H++){const G=f.snapshotItem(H),ne=(G.textContent||"").trim();if(ne.length===0)continue;const R=ne.toLowerCase(),j=o.length/R.length,Q=G.getBoundingClientRect();if(Q.width===0||Q.height===0||this.isDropdownDisplayValue(G))continue;let ae=j;if(new RegExp(`\\b${lr.escapeRegex(o)}\\b`,"i").test(R))ae+=.5;else if(j<.5)if(ie){if(this.matchesSelectorContext(G,q)<.5){console.log(`[HybridTargetResolver] → Skipping low ratio match that doesn't match selector context: "${ne.slice(0,30)}..."`);continue}}else{console.log(`[HybridTargetResolver] → Skipping low ratio match (${j.toFixed(2)}): "${ne.slice(0,30)}..."`);continue}if(ie){const g=this.matchesSelectorContext(G,q);ae+=g*.3}ae>V&&(V=ae,U=G)}if(U)return console.log(`[HybridTargetResolver] → XPath partial match found (score=${V.toFixed(2)})!`),U}console.log("[HybridTargetResolver] → XPath found nothing, trying fallback...");const h=document.querySelectorAll(n||"*");console.log(`[HybridTargetResolver] → Fallback: checking ${h.length} <${n||"*"}> elements for text "${i}"`);const b=U=>{const V=U;return Ct(V)?!0:V.id==="root"||V.id==="app"||V.id==="__next"||V.tagName==="BODY"||V.tagName==="HTML"};for(const U of h){if(b(U)||(((O=U.textContent)==null?void 0:O.trim().toLowerCase())||"")!==o)continue;const q=U.getBoundingClientRect();if(q.width>0&&q.height>0&&(((D=U.innerText)==null?void 0:D.trim().toLowerCase())||"")===o)return console.log("[HybridTargetResolver] → Found via exact text match"),U}let y=null,v=-1/0;for(const U of h){if(b(U))continue;const V=((F=U.textContent)==null?void 0:F.trim().toLowerCase())||"";if(V.length!==0&&V.includes(o)){const q=o.length/V.length,ie=U.getBoundingClientRect(),H=ie.width*ie.height;if(H>0&&H<5e5){const G=Math.max(0,50-H/1e4),ne=q*50,R=G+ne;R>v&&(v=R,y=U)}}}if(y){const U=y.getBoundingClientRect();return console.log(`[HybridTargetResolver] → Found via textContent (${U.width.toFixed(0)}x${U.height.toFixed(0)}px, score=${v.toFixed(0)})`),y}const S=n&&["input","textarea"].includes(n.toLowerCase())?n.toLowerCase():"input, textarea",m=document.querySelectorAll(S);console.log(`[HybridTargetResolver] → Checking ${m.length} input/textarea elements for placeholder "${i}"`);for(const U of m){const V=U;if(Ct(V))continue;const q=((J=V.getAttribute("placeholder"))==null?void 0:J.trim())||"";if(q.toLowerCase()===o){const ie=V.getBoundingClientRect();if(ie.width>0&&ie.height>0)return console.log(`[HybridTargetResolver] → Found via placeholder match: "${q}"`),V}}let w=null,k=0;for(const U of m){const V=U;if(Ct(V))continue;const q=((W=V.getAttribute("placeholder"))==null?void 0:W.trim().toLowerCase())||"";if(q&&q.includes(o)){const ie=o.length/q.length;if(ie>.6&&ie>k){const H=V.getBoundingClientRect();H.width>0&&H.height>0&&(w=V,k=ie)}}}return w?(console.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 console.log("[HybridTargetResolver] → Found via exact aria-label match"),n;const r=document.querySelectorAll("[aria-label]");console.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 console.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 console.log("[HybridTargetResolver] → Found via exact placeholder match"),n;const r=document.querySelectorAll("input, textarea");console.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 console.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(console.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 console.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(console.log(`[HybridTargetResolver] → Found ${r.length} <${e}> elements`),n){const a=n.toLowerCase().trim();let l=null,c=null,d=0;for(const f of r){const h=f;if(h.id==="root"||h.id==="app"||h.tagName==="BODY"||h.tagName==="HTML"||!lr.isVisible(h)||(((i=h.innerText)==null?void 0:i.length)||0)>200)continue;const y=((o=h.innerText)==null?void 0:o.trim())||"",v=y.toLowerCase();if(v===a){console.log(`[HybridTargetResolver] → Found exact match: "${y.substring(0,50)}..."`),l=h;break}if(v.includes(a)){const S=a.length/v.length;S>.7&&S>d&&(c=h,d=S)}}if(l)return l;if(c){const f=((s=c.innerText)==null?void 0:s.trim().substring(0,50))||"";return console.log(`[HybridTargetResolver] → Found close match (${(d*100).toFixed(0)}%): "${f}..."`),c}return console.log(`[HybridTargetResolver] → No matching <${e}> found for text "${n}"`),null}if(e==="div"||e==="span")return console.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){console.log("[HybridTargetResolver] 📜 Scrolling element into view"),e.scrollIntoView({behavior:"smooth",block:"center",...n})}static async waitForPositionStability(e,n=1e3,r=50,i=2){console.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(h=>setTimeout(h,r));const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return console.warn("[HybridTargetResolver] ⚠️ Element disappeared during stability check"),null;const d=Math.abs(c.x-o.x),f=Math.abs(c.y-o.y);if(d<i&&f<i){if(s++,s>=a)return console.log(`[HybridTargetResolver] ✅ Element position stable at (${c.x.toFixed(0)}, ${c.y.toFixed(0)}) after ${Date.now()-l}ms`),c}else s=0,console.log(`[HybridTargetResolver] 📍 Element still moving: (${o.x.toFixed(0)}, ${o.y.toFixed(0)}) → (${c.x.toFixed(0)}, ${c.y.toFixed(0)})`);o=c}return console.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")};console.log("[HybridTargetResolver] 🔄 Re-resolving with position-independent target (no boundingBox/domIndex)");const i=this.resolveTarget(r);if(!i)return console.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&&console.warn(`[HybridTargetResolver] ⚠️ Element changed during wait: "${o}" → "${s}"`),i}};L(lr,"domIntrospector",null);let ye=lr;class Kx{constructor(){L(this,"confirmationSound");L(this,"lastError",null);this.confirmationSound=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=")}humanLikeClick(e,n={}){return gy(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(()=>{}),console.log(`[ActionExecutor] Executed ${e.type} on ${e.selector}`)),r}catch(r){return console.error("[ActionExecutor] Failed to execute action:",r),!1}}async executeHybridAction(e,n=!0){this.lastError=null;try{if(console.log("[ActionExecutor] Executing hybrid action:",e),e.action==="navigate"){const s=e.value;if(!s)return console.warn("[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 console.warn("[ActionExecutor] Navigate blocked — disallowed scheme:",l.protocol),this.lastError=`Navigate blocked: disallowed URL scheme "${l.protocol}"`,!1;a=l.href}catch{return console.warn("[ActionExecutor] Navigate blocked — invalid URL:",s),this.lastError=`Navigate blocked: invalid URL "${s}"`,!1}return console.log("[ActionExecutor] 🧭 Navigating to URL:",a),window.location.href=a,!0}if(e.target.optionText&&e.action==="click"){console.log("[ActionExecutor] 🔽 Dropdown option click detected:",e.target.optionText);let s=ye.resolveTarget(e.target);if(!s){console.log("[ActionExecutor] Option not visible - dropdown may be closed, attempting to open...");let a=!1;if(e.target.dropdownTriggerSelector){console.log("[ActionExecutor] Using dropdownTriggerSelector:",e.target.dropdownTriggerSelector);const l=py(e.target.dropdownTriggerSelector);l&&(this.handleComboboxClick(l),a=!0)}if(!a&&e.target.labelText){console.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){console.log("[ActionExecutor] Trying to find dropdown by selector:",e.target.selector);const l={...e.target,optionText:void 0},c=ye.resolveTarget(l);if(c){const d=this.findComboboxInput(c);d&&(this.handleComboboxClick(d),a=!0)}}if(a){if(console.log("[ActionExecutor] Waiting for dropdown to open..."),await new Promise(l=>setTimeout(l,300)),s=ye.resolveTarget(e.target),!s)return console.warn("[ActionExecutor] ❌ Option still not found after opening dropdown:",e.target.optionText),!1;console.log("[ActionExecutor] ✅ Found option after opening dropdown")}else return console.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:(ye.scrollIntoView(s),await new Promise(a=>setTimeout(a,100)),this.performClick(s),this.confirmationSound.play().catch(()=>{}),console.log(`[ActionExecutor] ✅ Successfully clicked dropdown option: "${e.target.optionText}"`),!0)}const r=ye.resolveTarget(e.target);if(!r)return console.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(()=>{}),console.log(`[ActionExecutor] Successfully executed "${e.action}" on element`)),o}catch(r){return console.error("[ActionExecutor] Failed to execute hybrid action:",r),this.lastError=r instanceof Error?r.message:String(r),!1}}async executeOnElement(e,n,r,i){switch(ye.scrollIntoView(n),await new Promise(o=>setTimeout(o,300)),e){case"click":await this.expandCollapsedContainer(n),this.simulateClick(n,i);break;case"type":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}))):(n.focus(),n.textContent=r||"",n.dispatchEvent(new Event("input",{bubbles:!0})));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 console.warn("[ActionExecutor] Unknown action type:",e),!1}return!0}async expandCollapsedContainer(e){const n=this.findCollapsedContainer(e);if(n){console.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)),console.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 console.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){console.log("[ActionExecutor] 🎯 Detected dropdown option selector, searching for:",d);const h=this.findDropdownOption(d);if(h){console.log("[ActionExecutor] Found option by text, clicking it"),this.performClick(h);return}console.log("[ActionExecutor] Option not found by text, trying direct click")}const f=this.parseLabelFromSelector(n);if(f){console.log("[ActionExecutor] 🎯 Detected labeled combobox selector:",f);const h=this.findComboboxByLabel(f);if(h){console.log("[ActionExecutor] Found combobox by label, opening it"),this.handleComboboxClick(h);return}console.log("[ActionExecutor] Combobox not found by label, trying direct match")}}const r=this.findComboboxInput(e);if(r){console.log("[ActionExecutor] 🎯 Detected combobox/dropdown - using special handling"),this.handleComboboxClick(r);return}if(this.isDropdownOption(e)){console.log("[ActionExecutor] 🎯 Element is dropdown option - using React onClick + DOM events");const d=this.triggerReactOnClick(e);console.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(console.log("[ActionExecutor] 🎯 Element has React onClick - using direct call only"),this.triggerReactOnClick(i)){this.sendClickMetadata(i,e),console.log("[ActionExecutor] ✅ React onClick executed at",s,a,"on",i.tagName),i!==e&&console.log("[ActionExecutor] Note: Clicked parent",i.tagName,"instead of",e.tagName);return}console.log("[ActionExecutor] ⚠️ React onClick found but call failed, falling back to DOM events")}console.log("[ActionExecutor] Using humanLikeClick (no React onClick or fallback)");const c=this.humanLikeClick(i,{focus:!0,includePointerEvents:!0,nativeClickFallback:!1});c!==e&&c!==i&&console.log("[ActionExecutor] Note: humanLikeClick hit",c.tagName,"instead of element",e.tagName,"or clickTarget",i.tagName)}findComboboxInput(e){if(e.getAttribute("role")==="combobox")return console.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 console.log("[ActionExecutor] Found combobox via aria-haspopup container"),o;if(e.tagName==="BUTTON")return console.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 h=n.querySelector('input[role="combobox"]');if(h)return console.log("[ActionExecutor] Found combobox input via control element"),h;const b=n.parentElement;if(b){const v=b.querySelector('input[role="combobox"]');if(v)return console.log("[ActionExecutor] Found combobox input in parent container"),v}const y=n.querySelector('button[aria-haspopup="listbox"]');if(y)return console.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 console.log("[ActionExecutor] Found combobox by label:",e),a}}}return null}handleComboboxClick(e){console.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})),console.log("[ActionExecutor] ✅ Combobox/dropdown humanLikeClick complete, actual element:",i.tagName)}openDropdown(e){this.handleComboboxClick(e)}triggerReactOnClickPublic(e){return this.triggerReactOnClick(e)}findDropdownOption(e){return $o(e,ye.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(console.log("[ActionExecutor] Finding clickable element for:",e.tagName,r(e).substring(0,50)),!n.includes(e.tagName))return console.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),f=d.includes("cursor-pointer"),h=(a=i.classList)==null?void 0:a.contains("cursor-pointer"),b=i.hasAttribute("onclick")||i.hasAttribute("data-onclick")||i.getAttribute("role")==="button"||i.getAttribute("role")==="menuitem",y=i.tagName==="BUTTON"||i.tagName==="A";if(console.log(`[ActionExecutor] Checking parent #${s}:`,i.tagName,"cursor:",l.cursor,"hasCursorClass:",f||h,"classes:",d.substring(0,60)),(c||f||h||b||y)&&(o=i,console.log("[ActionExecutor] ✅ Found clickable parent:",i.tagName,d.substring(0,80)),y||i.getAttribute("role")==="button"))break;i=i.parentElement}return console.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(console.log("[ActionExecutor] Found React property:",s),a!=null&&a.onClick){console.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){console.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 console.log("[ActionExecutor] No React onClick handler found"),!1}catch(n){return console.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 f=r(o);if(f){const h=f.trim().split(/\s+/).slice(0,3).join(".");h&&(d+="."+h)}}i.unshift(d),o=o.parentElement}const s=d=>{var b;const f=d.querySelector("span, label, p");if((b=f==null?void 0:f.textContent)!=null&&b.trim())return f.textContent.trim().substring(0,50);let h="";for(const y of Array.from(d.childNodes))y.nodeType===Node.TEXT_NODE&&(h+=(y.textContent||"").trim()+" ");return h=h.trim(),!h&&d.textContent&&(h=d.textContent.trim().substring(0,50)),h},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"};console.log("[ActionExecutor] 📤 Sending React onClick metadata:",c.text,`(source: ${c.source})`),a!=null&&a.sendMetadata?a.sendMetadata(c):console.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){console.log("[ActionExecutor] Virtual selector detected - finding option by text:",i);const s=this.findDropdownOption(i);return s?(this.performClick(s),!0):(console.warn("[ActionExecutor] Option not found by text:",i),!1)}const o=this.parseLabelFromSelector(e.selector);if(o){console.log("[ActionExecutor] Virtual selector detected - finding combobox by label:",o);const s=this.findComboboxByLabel(o);return s?(this.handleComboboxClick(s),!0):(console.warn("[ActionExecutor] Combobox not found by label:",o),!1)}}const n=this.stripVirtualAttributes(e.selector),r=document.querySelector(n);if(!r)return console.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 console.warn("[ActionExecutor] Unknown action type:",e.type),!1}return!0}}class Wx{constructor(){L(this,"container",null);L(this,"highlightEl",null);L(this,"tooltipElement",null);L(this,"floeCursor",null);L(this,"cursorHasBeenPositioned",!1)}inject(){this.container||(this.container=document.createElement("div"),this.container.id="onboarding-overlay",this.container.setAttribute(Oi,"overlay"),this.container.style.cssText=`
|
|
479
479
|
position: fixed;
|
|
480
480
|
top: 0;
|
|
481
481
|
left: 0;
|
|
@@ -549,7 +549,7 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
549
549
|
30% { transform: scale(0.85); }
|
|
550
550
|
100% { transform: scale(1); }
|
|
551
551
|
}
|
|
552
|
-
`,document.head.appendChild(e),document.body.appendChild(this.floeCursor),console.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,console.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=f=>{const h=f-a,b=Math.min(h/r,1),y=1-Math.pow(1-b,3),
|
|
552
|
+
`,document.head.appendChild(e),document.body.appendChild(this.floeCursor),console.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,console.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=f=>{const h=f-a,b=Math.min(h/r,1),y=1-Math.pow(1-b,3),v=l+(e-l)*y,S=c+(n-c)*y;this.floeCursor&&(this.floeCursor.style.left=`${v}px`,this.floeCursor.style.top=`${S}px`),b<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(Oi,"consent-modal"),n.style.cssText=`
|
|
553
553
|
position: fixed;
|
|
554
554
|
top: 0;
|
|
555
555
|
left: 0;
|
|
@@ -716,7 +716,7 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
716
716
|
<p style="margin: 16px 0 0 0; font-size: 11px; color: rgba(255, 255, 255, 0.3); text-align: center;">
|
|
717
717
|
You can enable this anytime from the control panel
|
|
718
718
|
</p>
|
|
719
|
-
`,n.appendChild(r),document.body.appendChild(n);const i=r.querySelector("#screen-share-allow"),o=r.querySelector("#screen-share-deny");i.onmouseenter=()=>{i.style.transform="translateY(-1px)",i.style.background="rgba(255, 255, 255, 1)",i.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)"},i.onmouseleave=()=>{i.style.transform="translateY(0)",i.style.background="rgba(255, 255, 255, 0.95)",i.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.2)"},o.onmouseenter=()=>{o.style.color="rgba(255, 255, 255, 0.8)"},o.onmouseleave=()=>{o.style.color="rgba(255, 255, 255, 0.4)"},i.onclick=()=>{n.style.animation="modalFadeOut 0.2s ease",setTimeout(()=>{n.remove(),e(!0)},200)},o.onclick=()=>{n.style.animation="modalFadeOut 0.2s ease",setTimeout(()=>{n.remove(),e(!1)},200)}})}highlight(e,n={}){const r=document.querySelector(e);if(!r){console.warn("[OverlaySystem] Element not found:",e);return}this.highlightElement(r,n)}highlightTarget(e,n={}){console.log("╔══════════════════════════════════════════════════════════════╗"),console.log("║ [OverlaySystem] 💡 HIGHLIGHT TARGET CALLED ║"),console.log("╚══════════════════════════════════════════════════════════════╝"),console.log("[OverlaySystem] Target:",JSON.stringify(e,null,2)),console.log("[OverlaySystem] Options:",n);const r=
|
|
719
|
+
`,n.appendChild(r),document.body.appendChild(n);const i=r.querySelector("#screen-share-allow"),o=r.querySelector("#screen-share-deny");i.onmouseenter=()=>{i.style.transform="translateY(-1px)",i.style.background="rgba(255, 255, 255, 1)",i.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.3)"},i.onmouseleave=()=>{i.style.transform="translateY(0)",i.style.background="rgba(255, 255, 255, 0.95)",i.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.2)"},o.onmouseenter=()=>{o.style.color="rgba(255, 255, 255, 0.8)"},o.onmouseleave=()=>{o.style.color="rgba(255, 255, 255, 0.4)"},i.onclick=()=>{n.style.animation="modalFadeOut 0.2s ease",setTimeout(()=>{n.remove(),e(!0)},200)},o.onclick=()=>{n.style.animation="modalFadeOut 0.2s ease",setTimeout(()=>{n.remove(),e(!1)},200)}})}highlight(e,n={}){const r=document.querySelector(e);if(!r){console.warn("[OverlaySystem] Element not found:",e);return}this.highlightElement(r,n)}highlightTarget(e,n={}){console.log("╔══════════════════════════════════════════════════════════════╗"),console.log("║ [OverlaySystem] 💡 HIGHLIGHT TARGET CALLED ║"),console.log("╚══════════════════════════════════════════════════════════════╝"),console.log("[OverlaySystem] Target:",JSON.stringify(e,null,2)),console.log("[OverlaySystem] Options:",n);const r=ye.resolveTarget(e);return r?(console.log("[OverlaySystem] ✅ Element found, applying highlight..."),console.log("[OverlaySystem] Element details:"),console.log(" • tagName:",r.tagName),console.log(" • id:",r.id||"(none)"),console.log(" • classes:",r.className||"(none)"),console.log(" • innerText:",(r.innerText||"").substring(0,50)+"..."),this.highlightElement(r,n),console.log("[OverlaySystem] 🎨 Highlight applied successfully!"),!0):(console.warn("[OverlaySystem] ❌ Element not found for target"),!1)}highlightResolvedElement(e,n={}){return this.highlightElement(e,n)}highlightElement(e,n={}){var d;const{color:r="rgba(124, 58, 237, 0.9)",padding:i=4}=n;console.log("[OverlaySystem] highlightElement() called"),console.log("[OverlaySystem] Highlight color:",r),console.log("[OverlaySystem] Highlight padding:",i);let o=124,s=58,a=237,l=r;if(r.startsWith("var(")){const f=r.match(/var\(\s*(--[^,)]+)/);if(f){const h=getComputedStyle(document.documentElement).getPropertyValue(f[1]).trim();h&&(l=h)}}const c=l.match(/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/);if(c){const f=c[1];f.length===6?(o=parseInt(f.substring(0,2),16),s=parseInt(f.substring(2,4),16),a=parseInt(f.substring(4,6),16)):(o=parseInt(f[0]+f[0],16),s=parseInt(f[1]+f[1],16),a=parseInt(f[2]+f[2],16))}else{const f=l.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);f&&(o=parseInt(f[1]),s=parseInt(f[2]),a=parseInt(f[3]))}if(this.highlightEl||(console.log("[OverlaySystem] Creating new highlight element"),this.highlightEl=document.createElement("div"),this.highlightEl.id="hse-highlight-element",this.highlightEl.setAttribute(Oi,"highlight"),(d=this.container)==null||d.appendChild(this.highlightEl)),console.log("[OverlaySystem] Scrolling element into view..."),ye.scrollIntoView(e),console.log("[OverlaySystem] Waiting 300ms for scroll to complete..."),setTimeout(()=>{const f=e.getBoundingClientRect();console.log("[OverlaySystem] Element position after scroll:"),console.log(" • top:",f.top),console.log(" • left:",f.left),console.log(" • width:",f.width),console.log(" • height:",f.height),this.highlightEl&&(this.highlightEl.style.cssText=`
|
|
720
720
|
position: fixed;
|
|
721
721
|
top: ${f.top-i}px;
|
|
722
722
|
left: ${f.left-i}px;
|
|
@@ -801,13 +801,13 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
801
801
|
max-width: 300px;
|
|
802
802
|
text-align: center;
|
|
803
803
|
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(),console.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)"),console.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
|
|
804
|
+
`,this.tooltipElement.textContent=e}hideTooltip(){this.tooltipElement&&(this.tooltipElement.remove(),this.tooltipElement=null)}cleanup(){this.clearHighlight(),this.hideFloeCursor(),this.hideTooltip(),console.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)"),console.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 bd{constructor(e){L(this,"piiPatterns");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){console.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=[],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,f=0,h=0;for(let y=-o;y<=o;y++)for(let v=-o;v<=o;v++){const S=a+v,m=s+y;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],f+=i[w+3],h++}}const b=(s*n.width+a)*4;i[b]=l/h,i[b+1]=c/h,i[b+2]=d/h,i[b+3]=f/h}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 console.warn("[ScreenCapture] Document body not available"),"";const s=[];if(n){const f=this.getAllTextNodes();for(const{node:h,rect:b}of f){const y=this.containsPII(h.textContent||"");y.contains&&s.push({x:b.left,y:b.top,width:b.width,height:b.height,type:y.type||"unknown"})}}const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return console.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((f,h)=>{const b=document.createElement("iframe");b.style.position="fixed",b.style.top="0",b.style.left="0",b.style.width="100%",b.style.height="100%",b.style.border="none",b.style.zIndex="-999999",document.body.appendChild(b);const y=b.contentDocument;if(y.open(),y.write(document.documentElement.outerHTML),y.close(),bd.sanitizeClonedDocument(y),n&&s.length>0){const S=y.createElement("style");if(S.textContent=`
|
|
805
805
|
.pii-redacted {
|
|
806
806
|
filter: blur(5px);
|
|
807
807
|
background: #000;
|
|
808
808
|
color: transparent !important;
|
|
809
809
|
}
|
|
810
|
-
`,y.head.appendChild(S),!y.body){console.warn("[ScreenCapture] Cloned document has no body"),document.body.removeChild(b),this.safeCanvasToDataURL(a,o,i).then(f,h);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(b)}catch{}};setTimeout(()=>{try{if(!b.contentWindow){console.warn("[ScreenCapture] iframe contentWindow not available"),m(),this.safeCanvasToDataURL(a,o,i).then(f,h);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"}),M=URL.createObjectURL(C),O=new Image;O.onload=()=>{if(l.save(),l.scale(r,r),l.drawImage(O,0,0),l.restore(),URL.revokeObjectURL(M),n&&s.length>0)for(const D of s)this.applyBlur(l,{x:D.x*r,y:D.y*r,width:D.width*r,height:D.height*r});m(),this.safeCanvasToDataURL(a,o,i).then(f,h)},O.onerror=()=>{URL.revokeObjectURL(M),console.warn("[ScreenCapture] SVG image render failed, returning blank canvas"),m(),this.safeCanvasToDataURL(a,o,i).then(f,h)},O.src=M}catch(S){console.error("[ScreenCapture] Failed to render iframe content:",S),m(),this.safeCanvasToDataURL(a,o,i).then(f,h)}},100)})}async captureSimple(e={}){return this.captureWithRedaction({...e,redact:!1})}}class Fx{constructor(e){L(this,"sdk");L(this,"domIntrospector",null);L(this,"lastUrl","");L(this,"clickHandler",null);L(this,"focusHandler",null);L(this,"blurHandler",null);L(this,"inputHandler",null);L(this,"keydownHandler",null);L(this,"inputDebounceTimers",new Map);L(this,"isTracking",!1);L(this,"scrollHandler",null);L(this,"scrollDebounceTimer",null);L(this,"urlCheckInterval",null);L(this,"popstateHandler",null);this.sdk=e,this.lastUrl=window.location.href}setDOMIntrospector(e){this.domIntrospector=e,console.log("[PageTracker] DOMIntrospector set for sync captures")}start(){this.isTracking||(this.isTracking=!0,console.log("[PageTracker] Starting page event tracking"),this.sendPageMetadata(),this.setupUrlTracking(),this.clickHandler=e=>{const n=e.target;if(!n||Ct(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}),console.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||(console.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)||Ct(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()}),console.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)||Ct(n))return;const r=n.tagName.toLowerCase();this.sdk.sendMetadata({type:"blur",selector:this.getSelector(n),tagName:r,timestamp:Date.now()}),console.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||Ct(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()}),console.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)||Ct(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()}),console.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),console.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(),console.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=An();this.sdk.sendMetadata({type:"page_metadata",url:e,title:document.title,pathname:window.location.pathname,timestamp:Date.now()}),console.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,f=0;for(;d&&d!==document.body&&f<5;){let h=d.tagName.toLowerCase();const b=d.getAttribute("role"),y=d.getAttribute("data-testid");if(y){c.unshift(`[data-testid="${y}"]`);break}if(b)h+=`[role="${b}"]`;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&&(h+=`.${m.join(".")}`)}c.unshift(h),d=d.parentElement,f++}return c.join(" > ")}getElementMetadata(e){var h,b,y,m;const n=e,r=this.getSelector(e),i=((h=n.innerText)==null?void 0:h.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=(b=S.textContent)==null?void 0:b.trim())}const f=e.getAttribute("id");if(!c&&f)try{const S=document.querySelector(`label[for="${CSS.escape(f)}"]`);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 my{constructor(){L(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"])}isLoading(){for(const e of this.loadingSelectors)try{const n=document.querySelector(e);if(n&&this.isVisible(n))return console.log("[LoadingDetector] Found loading indicator:",e),!0}catch{}return!1}async waitForLoadingComplete(e=5e3){const n=Date.now();for(console.log("[LoadingDetector] Waiting for loading to complete...");Date.now()-n<e;){if(!this.isLoading()&&(await new Promise(r=>setTimeout(r,100)),!this.isLoading()))return console.log("[LoadingDetector] Loading complete"),!0;await new Promise(r=>setTimeout(r,50))}return console.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 jx{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(),console.log("[DOMStabilityChecker] DOM stable"),r()},e)});a.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(()=>{s(),console.log("[DOMStabilityChecker] DOM stable (no mutations)"),r()},e),o=setTimeout(()=>{s(),console.warn("[DOMStabilityChecker] Max wait time reached, proceeding anyway"),r()},n)})}}class Bx{constructor(){L(this,"lastUrl","");L(this,"urlChangeCallback",null);L(this,"loadingDetector");L(this,"domStabilityChecker");L(this,"originalPushState",null);L(this,"originalReplaceState",null);L(this,"popstateHandler",null);L(this,"isStarted",!1);L(this,"handleUrlChange",async()=>{const e=window.location.href;if(e!==this.lastUrl){console.log("[NavigationCompleteDetector] URL changed:",e),this.lastUrl=e;try{await this.waitForPageStable()}catch(n){console.warn("[NavigationCompleteDetector] Error waiting for page stable:",n)}this.urlChangeCallback&&this.urlChangeCallback(An())}});this.lastUrl=window.location.href,this.loadingDetector=new my,this.domStabilityChecker=new jx}start(e){this.isStarted&&(console.warn("[NavigationCompleteDetector] Already started, stopping first"),this.stop()),console.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(){console.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)),console.log("[NavigationCompleteDetector] Page stable")}stop(){this.isStarted&&(console.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 Ux{constructor(e,n){L(this,"overlay");L(this,"loadingDetector");L(this,"domIntrospector",null);L(this,"isExecuting",!1);this.overlay=e,this.loadingDetector=new my}setDOMIntrospector(e){this.domIntrospector=e,console.log("[BatchedActionExecutor] DOMIntrospector set for step captures")}get isBusy(){return this.isExecuting}async executeBatch(e){if(this.isExecuting)return console.warn("[BatchedActionExecutor] Already executing a batch"),{success:!1,completedSteps:0};this.isExecuting=!0;let n=0;console.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(console.log(`[BatchedActionExecutor] Step ${r+1}/${e.steps.length}: ${i.action}`),!await this.executeStep(i))return console.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 console.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 console.warn(`[BatchedActionExecutor] Unknown action: ${e.action}`),!1}}async executeClickStep(e){var a,l,c,d,f;if(!e.target)return console.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();console.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 h=0;h<=o;h++)if(h>0&&(console.log(`[BatchedActionExecutor] Retry ${h}/${o} in ${s[h-1]}ms...`),await new Promise(b=>setTimeout(b,s[h-1]))),i=be.resolveTarget(e.target),i){const b=((d=i.textContent)==null?void 0:d.trim().toLowerCase())||"",y=i.tagName.toLowerCase();if(n&&!b.includes(n)){console.warn(`[BatchedActionExecutor] ⚠️ Found element text "${b.slice(0,50)}" doesn't match expected "${n}"`),i=null;continue}r&&y!==r&&console.log(`[BatchedActionExecutor] Note: Found ${y} instead of expected ${r} (acceptable if it contains the text)`);break}if(!i){if(console.error("[BatchedActionExecutor] ❌ Could not find matching element after retries:",e.target),n){const h=Array.from(document.querySelectorAll("*")).filter(b=>{var y;return(y=b.textContent)==null?void 0:y.toLowerCase().includes(n)}).slice(0,5).map(b=>{var y;return`${b.tagName.toLowerCase()}: "${(y=b.textContent)==null?void 0:y.trim().slice(0,50)}"`});h.length>0&&console.log("[BatchedActionExecutor] Similar elements found:",h)}return!1}return console.log("[BatchedActionExecutor] ✓ Found element:",i.tagName,(f=i.textContent)==null?void 0:f.slice(0,30)),i.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(h=>setTimeout(h,150)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(h=>setTimeout(h,100)),this.simulateClick(i),await new Promise(h=>setTimeout(h,100)),this.overlay.clearHighlight(),this.domIntrospector&&(await new Promise(h=>setTimeout(h,100)),this.domIntrospector.captureAndSendImmediate("post-batch-step-click")),!0}simulateClick(e){var n,r;try{const i=py(e,{focus:!0,includePointerEvents:!0,includeMouseEnter:!0,nativeClickFallback:!1});i.tagName==="A"&&i.href&&console.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))||"";console.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 console.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):(console.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}}class vy extends Ix{constructor(n){super();L(this,"config");L(this,"sessionId");L(this,"overlay");L(this,"capture");L(this,"actionExecutor");L(this,"pipecatClient",null);L(this,"transport",null);L(this,"isInitialized",!1);L(this,"reactRoot",null);L(this,"reactContainer",null);L(this,"agentState","idle");L(this,"pausedSessionId",null);L(this,"pendingResumeSessionId",null);L(this,"botTranscript","");L(this,"userTranscript","");L(this,"transcriptHistory",[]);L(this,"lastUserTranscript","");L(this,"isConnected",!1);L(this,"connectInFlight",!1);L(this,"micEnabled",!0);L(this,"userIsSpeaking",!1);L(this,"botIsSpeaking",!1);L(this,"audioLevels",[]);L(this,"_discoveryPopupShown",!1);L(this,"_pendingDiscoveryStart",!1);L(this,"botAudioAnalyzer",null);L(this,"userAudioAnalyzer",null);L(this,"userMicStream",null);L(this,"userMicStreamRequestId",0);L(this,"audioElements",[]);L(this,"pageTracker");L(this,"screenShareEnabled",!1);L(this,"domIntrospector");L(this,"accessibleSnapshot");L(this,"fastExecutionMode",!1);L(this,"batchedActionExecutor",null);L(this,"navigationCompleteDetector",null);L(this,"_botActionDepth",0);L(this,"endUserStatus",null);L(this,"connectionProgress",null);L(this,"isReturningUser",!1);L(this,"hasSkippedOnboarding",!1);L(this,"_isMinimized",!1);L(this,"textModeEnabled",!1);L(this,"planProgress",null);if(!n.clientKey)throw new Error("Client key is required");const r="https://api.dev.floe.so";this.config={apiUrl:r,enableVideo:!1,enableAudio:!0,enableScreenCapture:!0,debug:!1,...n},this.micEnabled=this.config.enableAudio!==!1;try{localStorage.getItem("floe_text_mode")==="true"&&(this.textModeEnabled=!0)}catch{}this.sessionId=this.generateSessionId(),this.overlay=new $x,this.capture=new yd(this.config.redactionPatterns),this.actionExecutor=new Nx,this.pageTracker=new Fx(this),this.domIntrospector=new Rx,be.setDOMIntrospector(this.domIntrospector),this.accessibleSnapshot=new vd,this.batchedActionExecutor=new Ux(this.overlay,this.actionExecutor),this.batchedActionExecutor.setDOMIntrospector(this.domIntrospector),window.__onboardingSDK=this,this.config.debug&&console.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"?(console.warn("[OnboardingSDK] Client key validation failed due to network/timeout, proceeding anyway:",i),{valid:!0}):(console.warn("[OnboardingSDK] Unexpected error during client key validation:",i),{valid:!1})}}async startScreenShare(){try{this.pipecatClient&&(await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,console.log("[OnboardingSDK] Screen share enabled"),this.sendMetadata({type:"screen_share_status",active:!0}),this.renderReactUI())}catch(n){throw console.error("[OnboardingSDK] Screen share failed:",n),this.screenShareEnabled=!1,n}}async init(){if(this.isInitialized){console.warn("[OnboardingSDK] Already initialized");return}try{const n=await this.validateClientKeyAndBotStatus();if(!n.valid){this.config.debug&&console.log("[OnboardingSDK] Bot is disabled or invalid:",n.error);return}this._finalizePendingNavigation(),this.overlay.inject(),this.initReactUI(),this.config.userInfo&&(this.config.userInfo.externalId||this.config.userInfo.email)&&await this.checkEndUserStatus();const r=this.shouldSkipOnboardingModal();let i=!0;if(r)console.log("[OnboardingSDK] 🔄 Skipping onboarding modal for returning user"),this._discoveryPopupShown=!0,this.isReturningUser=!0,i=!1,console.log("[OnboardingSDK] Bot will stay closed - user clicks to start");else if(this.config.enableDiscoveryPopup!==!1){console.log("[OnboardingSDK] 🎉 Showing welcome popup before connect");const a=await this.showWelcomePopupAsync();this._discoveryPopupShown=!0,this.markUserVisited(),a?(this._pendingDiscoveryStart=!0,console.log("[OnboardingSDK] User chose guided discovery - will start after connect"),i=!0):(console.log("[OnboardingSDK] User skipped onboarding - bot will stay closed"),this.hasSkippedOnboarding=!0,i=!1)}if(!i){console.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 yn,this.pipecatClient=new Ft({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(),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback();const o=`${this.config.apiUrl}/sites/start-session`;console.log("[OnboardingSDK] Starting session via floe-api proxy:",o);const s={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};if(this.config.userInfo&&(s.sessionData.userInfo=this.config.userInfo),await this.pipecatClient.startBotAndConnect({endpoint:o,requestData:s}),this.config.enableScreenCapture)if(await this.overlay.showScreenShareModal())try{await this.startScreenShare()}catch(l){console.error("[OnboardingSDK] Screen share failed:",l)}else console.log("[OnboardingSDK] Screen share declined by user");this.isInitialized=!0,this.emit("ready")}catch(n){throw console.error("[OnboardingSDK] Initialization failed:",n),this.emit("error",n),n}}setupNavigationDetection(){this.navigationCompleteDetector||(this.navigationCompleteDetector=new Bx),this.navigationCompleteDetector.start(n=>{console.log("[OnboardingSDK] Navigation complete detected:",n),this.overlay.cleanup(),this.sendMetadata({type:"navigation_complete",url:n,timestamp:Date.now()})}),console.log("[OnboardingSDK] NavigationCompleteDetector started")}setupAudioPlayback(){this.pipecatClient&&(this.botAudioAnalyzer||(this.botAudioAnalyzer=new gy),this.userAudioAnalyzer||(this.userAudioAnalyzer=new gy),this.textModeEnabled?console.log("[OnboardingSDK] ⌨️ Text mode — skipping user mic analysis"):this.setupUserMicAnalysis(),this.pipecatClient.on("trackStarted",(n,r)=>{if(!(r!=null&&r.local)&&n.kind==="audio"){console.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"&&(console.log("[OnboardingSDK] 🔇 Bot audio track stopped"),this.botAudioAnalyzer&&this.botAudioAnalyzer.stop(),this.audioLevels=[]),r!=null&&r.local&&n.kind==="video"&&this.screenShareEnabled&&(console.log("[OnboardingSDK] 🖥️ Screen share track stopped (browser stop button)"),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1}),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){console.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,console.log("[OnboardingSDK] 🎤 User mic stream captured for visualization"),this.userAudioAnalyzer&&this.userAudioAnalyzer.start(r,i=>{this.userIsSpeaking&&(this.audioLevels=i,this.renderReactUI())})}catch(r){console.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(Oi,"react-ui"),this.reactContainer.style.cssText=`
|
|
810
|
+
`,y.head.appendChild(S),!y.body){console.warn("[ScreenCapture] Cloned document has no body"),document.body.removeChild(b),this.safeCanvasToDataURL(a,o,i).then(f,h);return}const m=y.createTreeWalker(y.body,NodeFilter.SHOW_TEXT);let w;for(;w=m.nextNode();)this.containsPII(w.textContent||"").contains&&w.parentElement&&w.parentElement.classList.add("pii-redacted")}const v=()=>{try{document.body.removeChild(b)}catch{}};setTimeout(()=>{try{if(!b.contentWindow){console.warn("[ScreenCapture] iframe contentWindow not available"),v(),this.safeCanvasToDataURL(a,o,i).then(f,h);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"}),M=URL.createObjectURL(C),O=new Image;O.onload=()=>{if(l.save(),l.scale(r,r),l.drawImage(O,0,0),l.restore(),URL.revokeObjectURL(M),n&&s.length>0)for(const D of s)this.applyBlur(l,{x:D.x*r,y:D.y*r,width:D.width*r,height:D.height*r});v(),this.safeCanvasToDataURL(a,o,i).then(f,h)},O.onerror=()=>{URL.revokeObjectURL(M),console.warn("[ScreenCapture] SVG image render failed, returning blank canvas"),v(),this.safeCanvasToDataURL(a,o,i).then(f,h)},O.src=M}catch(S){console.error("[ScreenCapture] Failed to render iframe content:",S),v(),this.safeCanvasToDataURL(a,o,i).then(f,h)}},100)})}async captureSimple(e={}){return this.captureWithRedaction({...e,redact:!1})}}class qx{constructor(e){L(this,"sdk");L(this,"domIntrospector",null);L(this,"lastUrl","");L(this,"clickHandler",null);L(this,"focusHandler",null);L(this,"blurHandler",null);L(this,"inputHandler",null);L(this,"keydownHandler",null);L(this,"inputDebounceTimers",new Map);L(this,"isTracking",!1);L(this,"scrollHandler",null);L(this,"scrollDebounceTimer",null);L(this,"urlCheckInterval",null);L(this,"popstateHandler",null);this.sdk=e,this.lastUrl=window.location.href}setDOMIntrospector(e){this.domIntrospector=e,console.log("[PageTracker] DOMIntrospector set for sync captures")}start(){this.isTracking||(this.isTracking=!0,console.log("[PageTracker] Starting page event tracking"),this.sendPageMetadata(),this.setupUrlTracking(),this.clickHandler=e=>{const n=e.target;if(!n||Ct(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}),console.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||(console.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)||Ct(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()}),console.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)||Ct(n))return;const r=n.tagName.toLowerCase();this.sdk.sendMetadata({type:"blur",selector:this.getSelector(n),tagName:r,timestamp:Date.now()}),console.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||Ct(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()}),console.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)||Ct(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()}),console.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),console.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(),console.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=An();this.sdk.sendMetadata({type:"page_metadata",url:e,title:document.title,pathname:window.location.pathname,timestamp:Date.now()}),console.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,f=0;for(;d&&d!==document.body&&f<5;){let h=d.tagName.toLowerCase();const b=d.getAttribute("role"),y=d.getAttribute("data-testid");if(y){c.unshift(`[data-testid="${y}"]`);break}if(b)h+=`[role="${b}"]`;else if(d.className&&typeof d.className=="string"){const v=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);v.length>0&&(h+=`.${v.join(".")}`)}c.unshift(h),d=d.parentElement,f++}return c.join(" > ")}getElementMetadata(e){var h,b,y,v;const n=e,r=this.getSelector(e),i=((h=n.innerText)==null?void 0:h.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=(b=S.textContent)==null?void 0:b.trim())}const f=e.getAttribute("id");if(!c&&f)try{const S=document.querySelector(`label[for="${CSS.escape(f)}"]`);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 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=(v=m.textContent)==null?void 0:v.trim().replace(/\*$/,"").trim())}}}return{selector:r,text:i,tagName:o,role:s,ariaLabel:a,placeholder:l,labelText:c}}}class yy{constructor(){L(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"])}isLoading(){for(const e of this.loadingSelectors)try{const n=document.querySelector(e);if(n&&this.isVisible(n))return console.log("[LoadingDetector] Found loading indicator:",e),!0}catch{}return!1}async waitForLoadingComplete(e=5e3){const n=Date.now();for(console.log("[LoadingDetector] Waiting for loading to complete...");Date.now()-n<e;){if(!this.isLoading()&&(await new Promise(r=>setTimeout(r,100)),!this.isLoading()))return console.log("[LoadingDetector] Loading complete"),!0;await new Promise(r=>setTimeout(r,50))}return console.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 Jx{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(),console.log("[DOMStabilityChecker] DOM stable"),r()},e)});a.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),i=setTimeout(()=>{s(),console.log("[DOMStabilityChecker] DOM stable (no mutations)"),r()},e),o=setTimeout(()=>{s(),console.warn("[DOMStabilityChecker] Max wait time reached, proceeding anyway"),r()},n)})}}class Gx{constructor(){L(this,"lastUrl","");L(this,"urlChangeCallback",null);L(this,"loadingDetector");L(this,"domStabilityChecker");L(this,"originalPushState",null);L(this,"originalReplaceState",null);L(this,"popstateHandler",null);L(this,"isStarted",!1);L(this,"handleUrlChange",async()=>{const e=window.location.href;if(e!==this.lastUrl){console.log("[NavigationCompleteDetector] URL changed:",e),this.lastUrl=e;try{await this.waitForPageStable()}catch(n){console.warn("[NavigationCompleteDetector] Error waiting for page stable:",n)}this.urlChangeCallback&&this.urlChangeCallback(An())}});this.lastUrl=window.location.href,this.loadingDetector=new yy,this.domStabilityChecker=new Jx}start(e){this.isStarted&&(console.warn("[NavigationCompleteDetector] Already started, stopping first"),this.stop()),console.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(){console.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)),console.log("[NavigationCompleteDetector] Page stable")}stop(){this.isStarted&&(console.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 Qx{constructor(e,n){L(this,"overlay");L(this,"loadingDetector");L(this,"domIntrospector",null);L(this,"isExecuting",!1);this.overlay=e,this.loadingDetector=new yy}setDOMIntrospector(e){this.domIntrospector=e,console.log("[BatchedActionExecutor] DOMIntrospector set for step captures")}get isBusy(){return this.isExecuting}async executeBatch(e){if(this.isExecuting)return console.warn("[BatchedActionExecutor] Already executing a batch"),{success:!1,completedSteps:0};this.isExecuting=!0;let n=0;console.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(console.log(`[BatchedActionExecutor] Step ${r+1}/${e.steps.length}: ${i.action}`),!await this.executeStep(i))return console.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 console.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 console.warn(`[BatchedActionExecutor] Unknown action: ${e.action}`),!1}}async executeClickStep(e){var a,l,c,d,f;if(!e.target)return console.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();console.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 h=0;h<=o;h++)if(h>0&&(console.log(`[BatchedActionExecutor] Retry ${h}/${o} in ${s[h-1]}ms...`),await new Promise(b=>setTimeout(b,s[h-1]))),i=ye.resolveTarget(e.target),i){const b=((d=i.textContent)==null?void 0:d.trim().toLowerCase())||"",y=i.tagName.toLowerCase();if(n&&!b.includes(n)){console.warn(`[BatchedActionExecutor] ⚠️ Found element text "${b.slice(0,50)}" doesn't match expected "${n}"`),i=null;continue}r&&y!==r&&console.log(`[BatchedActionExecutor] Note: Found ${y} instead of expected ${r} (acceptable if it contains the text)`);break}if(!i){if(console.error("[BatchedActionExecutor] ❌ Could not find matching element after retries:",e.target),n){const h=Array.from(document.querySelectorAll("*")).filter(b=>{var y;return(y=b.textContent)==null?void 0:y.toLowerCase().includes(n)}).slice(0,5).map(b=>{var y;return`${b.tagName.toLowerCase()}: "${(y=b.textContent)==null?void 0:y.trim().slice(0,50)}"`});h.length>0&&console.log("[BatchedActionExecutor] Similar elements found:",h)}return!1}return console.log("[BatchedActionExecutor] ✓ Found element:",i.tagName,(f=i.textContent)==null?void 0:f.slice(0,30)),i.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(h=>setTimeout(h,150)),this.overlay.highlightResolvedElement(i,{color:"rgba(124, 58, 237, 0.4)",padding:4}),await new Promise(h=>setTimeout(h,100)),this.simulateClick(i),await new Promise(h=>setTimeout(h,100)),this.overlay.clearHighlight(),this.domIntrospector&&(await new Promise(h=>setTimeout(h,100)),this.domIntrospector.captureAndSendImmediate("post-batch-step-click")),!0}simulateClick(e){var n,r;try{const i=gy(e,{focus:!0,includePointerEvents:!0,includeMouseEnter:!0,nativeClickFallback:!1});i.tagName==="A"&&i.href&&console.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))||"";console.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 console.warn("[BatchedActionExecutor] Scroll step has no target"),!1;const n=ye.resolveTarget(e.target);return n?(n.scrollIntoView({behavior:"auto",block:"center"}),await new Promise(r=>setTimeout(r,100)),!0):(console.warn("[BatchedActionExecutor] Scroll target not found:",e.target),!0)}async waitForElement(e,n){const r=Date.now();for(;Date.now()-r<n;){if(ye.resolveTarget(e))return!0;await new Promise(o=>setTimeout(o,100))}return!1}}class by extends Nx{constructor(n){super();L(this,"config");L(this,"sessionId");L(this,"overlay");L(this,"capture");L(this,"actionExecutor");L(this,"pipecatClient",null);L(this,"transport",null);L(this,"isInitialized",!1);L(this,"reactRoot",null);L(this,"reactContainer",null);L(this,"agentState","idle");L(this,"pausedSessionId",null);L(this,"pendingResumeSessionId",null);L(this,"botTranscript","");L(this,"userTranscript","");L(this,"transcriptHistory",[]);L(this,"lastUserTranscript","");L(this,"isConnected",!1);L(this,"connectInFlight",!1);L(this,"micEnabled",!0);L(this,"userIsSpeaking",!1);L(this,"botIsSpeaking",!1);L(this,"audioLevels",[]);L(this,"_discoveryPopupShown",!1);L(this,"_pendingDiscoveryStart",!1);L(this,"botAudioAnalyzer",null);L(this,"userAudioAnalyzer",null);L(this,"userMicStream",null);L(this,"userMicStreamRequestId",0);L(this,"audioElements",[]);L(this,"pageTracker");L(this,"screenShareEnabled",!1);L(this,"domIntrospector");L(this,"accessibleSnapshot");L(this,"fastExecutionMode",!1);L(this,"batchedActionExecutor",null);L(this,"navigationCompleteDetector",null);L(this,"_botActionDepth",0);L(this,"endUserStatus",null);L(this,"connectionProgress",null);L(this,"isReturningUser",!1);L(this,"hasSkippedOnboarding",!1);L(this,"_isMinimized",!1);L(this,"textModeEnabled",!1);L(this,"planProgress",null);if(!n.clientKey)throw new Error("Client key is required");const r="https://api.dev.floe.so";this.config={apiUrl:r,enableVideo:!1,enableAudio:!0,enableScreenCapture:!0,debug:!1,...n},this.micEnabled=this.config.enableAudio!==!1;try{localStorage.getItem("floe_text_mode")==="true"&&(this.textModeEnabled=!0)}catch{}this.sessionId=this.generateSessionId(),this.overlay=new Wx,this.capture=new bd(this.config.redactionPatterns),this.actionExecutor=new Kx,this.pageTracker=new qx(this),this.domIntrospector=new $x,ye.setDOMIntrospector(this.domIntrospector),this.accessibleSnapshot=new yd,this.batchedActionExecutor=new Qx(this.overlay,this.actionExecutor),this.batchedActionExecutor.setDOMIntrospector(this.domIntrospector),window.__onboardingSDK=this,this.config.debug&&console.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"?(console.warn("[OnboardingSDK] Client key validation failed due to network/timeout, proceeding anyway:",i),{valid:!0}):(console.warn("[OnboardingSDK] Unexpected error during client key validation:",i),{valid:!1})}}async startScreenShare(){try{this.pipecatClient&&(await this.pipecatClient.enableScreenShare(!0),this.screenShareEnabled=!0,console.log("[OnboardingSDK] Screen share enabled"),this.sendMetadata({type:"screen_share_status",active:!0}),this.renderReactUI())}catch(n){throw console.error("[OnboardingSDK] Screen share failed:",n),this.screenShareEnabled=!1,n}}async init(){if(this.isInitialized){console.warn("[OnboardingSDK] Already initialized");return}try{const n=await this.validateClientKeyAndBotStatus();if(!n.valid){this.config.debug&&console.log("[OnboardingSDK] Bot is disabled or invalid:",n.error);return}this._finalizePendingNavigation(),this.overlay.inject(),this.initReactUI(),this.config.userInfo&&(this.config.userInfo.externalId||this.config.userInfo.email)&&await this.checkEndUserStatus();const r=this.shouldSkipOnboardingModal();let i=!0;if(r)console.log("[OnboardingSDK] 🔄 Skipping onboarding modal for returning user"),this._discoveryPopupShown=!0,this.isReturningUser=!0,i=!1,console.log("[OnboardingSDK] Bot will stay closed - user clicks to start");else if(this.config.enableDiscoveryPopup!==!1){console.log("[OnboardingSDK] 🎉 Showing welcome popup before connect");const a=await this.showWelcomePopupAsync();this._discoveryPopupShown=!0,this.markUserVisited(),a?(this._pendingDiscoveryStart=!0,console.log("[OnboardingSDK] User chose guided discovery - will start after connect"),i=!0):(console.log("[OnboardingSDK] User skipped onboarding - bot will stay closed"),this.hasSkippedOnboarding=!0,i=!1)}if(!i){console.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 yn,this.pipecatClient=new Ft({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(),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback();const o=`${this.config.apiUrl}/sites/start-session`;console.log("[OnboardingSDK] Starting session via floe-api proxy:",o);const s={clientKey:this.config.clientKey,origin:window.location.origin,sessionData:{sessionId:this.sessionId,createDailyRoom:!0,dailyRoomProperties:{start_video_off:!0}}};if(this.config.userInfo&&(s.sessionData.userInfo=this.config.userInfo),await this.pipecatClient.startBotAndConnect({endpoint:o,requestData:s}),this.config.enableScreenCapture)if(await this.overlay.showScreenShareModal())try{await this.startScreenShare()}catch(l){console.error("[OnboardingSDK] Screen share failed:",l)}else console.log("[OnboardingSDK] Screen share declined by user");this.isInitialized=!0,this.emit("ready")}catch(n){throw console.error("[OnboardingSDK] Initialization failed:",n),this.emit("error",n),n}}setupNavigationDetection(){this.navigationCompleteDetector||(this.navigationCompleteDetector=new Gx),this.navigationCompleteDetector.start(n=>{console.log("[OnboardingSDK] Navigation complete detected:",n),this.overlay.cleanup(),this.sendMetadata({type:"navigation_complete",url:n,timestamp:Date.now()})}),console.log("[OnboardingSDK] NavigationCompleteDetector started")}setupAudioPlayback(){this.pipecatClient&&(this.botAudioAnalyzer||(this.botAudioAnalyzer=new my),this.userAudioAnalyzer||(this.userAudioAnalyzer=new my),this.textModeEnabled?console.log("[OnboardingSDK] ⌨️ Text mode — skipping user mic analysis"):this.setupUserMicAnalysis(),this.pipecatClient.on("trackStarted",(n,r)=>{if(!(r!=null&&r.local)&&n.kind==="audio"){console.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"&&(console.log("[OnboardingSDK] 🔇 Bot audio track stopped"),this.botAudioAnalyzer&&this.botAudioAnalyzer.stop(),this.audioLevels=[]),r!=null&&r.local&&n.kind==="video"&&this.screenShareEnabled&&(console.log("[OnboardingSDK] 🖥️ Screen share track stopped (browser stop button)"),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1}),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){console.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,console.log("[OnboardingSDK] 🎤 User mic stream captured for visualization"),this.userAudioAnalyzer&&this.userAudioAnalyzer.start(r,i=>{this.userIsSpeaking&&(this.audioLevels=i,this.renderReactUI())})}catch(r){console.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(Oi,"react-ui"),this.reactContainer.style.cssText=`
|
|
811
811
|
position: fixed;
|
|
812
812
|
top: 0;
|
|
813
813
|
left: 0;
|
|
@@ -815,7 +815,7 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
815
815
|
height: 100%;
|
|
816
816
|
pointer-events: none;
|
|
817
817
|
z-index: 2147483646;
|
|
818
|
-
`,document.body.appendChild(this.reactContainer),this.reactRoot=cc.createRoot(this.reactContainer),this.renderReactUI()}renderReactUI(){var n,r,i;this.reactRoot&&this.reactRoot.render(eg.createElement(Dx,{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,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,console.log("[OnboardingSDK] UI minimized"),this.renderReactUI(),this.emit("minimized")}handleExpand(){this._isMinimized=!1,console.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){console.log("[OnboardingSDK] Disconnecting and minimizing...");try{await this.disconnectAndMinimize()}catch(n){console.error("[OnboardingSDK] Error during disconnect and minimize:",n),this.emit("error",n)}return}if(this.connectInFlight){console.log("[OnboardingSDK] Connection operation already in progress, ignoring...");return}try{await this.connectWithProgress()}catch(n){console.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(),console.log("[OnboardingSDK] Disconnected and minimized"),this.emit("disconnected"),this.emit("minimized")}async connectWithProgress(){if(this.connectInFlight){console.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 yn,this.setConnectionProgress("authenticating","Authenticating...",30),this.pipecatClient=new Ft({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(),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback(),this.setConnectionProgress("connecting","Connecting to server...",50);const n=`${this.config.apiUrl}/sites/start-session`;console.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){console.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;console.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,console.log("[OnboardingSDK] 🎤 Mic state on connect:",this.micEnabled?"ON":"MUTED"),this.textModeEnabled&&this.pipecatClient&&(this.pipecatClient.enableMic(!1),this.micEnabled=!1,console.log("[OnboardingSDK] ⌨️ Text mode active — mic muted on connect")),this.clearConnectionProgress(),this.renderReactUI(),this.emit("connected")},onDisconnected:()=>{console.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&&(console.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(console.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)}),console.log("[OnboardingSDK] DOM Introspection Layer started (with Accessible Snapshot)"),this.pageTracker.setDOMIntrospector(this.domIntrospector),this.pageTracker.start(),console.log("[OnboardingSDK] PageTracker started"),this.config.clientKey){console.log("[OnboardingSDK] Sending site initialization with client key");const r={clientKey:this.config.clientKey,origin:window.location.origin,userInfo:this.config.userInfo};this.pendingResumeSessionId&&(r.resumeSessionId=this.pendingResumeSessionId,console.log(`[OnboardingSDK] Resuming session: ${this.pendingResumeSessionId}`),this.pendingResumeSessionId=null),(n=this.pipecatClient)==null||n.sendClientMessage("site_init",r)}this.emit("botReady"),this._pendingDiscoveryStart&&(console.log("[OnboardingSDK] 🔍 Starting pending guided discovery"),this._pendingDiscoveryStart=!1,setTimeout(()=>{this.isConnected&&this.startGuidedDiscovery()},500))},onUserTranscript:n=>{console.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),this.renderReactUI()},onBotTtsText:n=>{this.textModeEnabled||(console.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&&(console.log("[OnboardingSDK] 🤖 Bot LLM started (text mode)"),this.agentState="speaking",this.botTranscript="",this.renderReactUI())},onBotLlmStopped:()=>{this.textModeEnabled&&(console.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()}),console.log("[OnboardingSDK] 📝 Added assistant message to history (text mode):",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI())},onUserStartedSpeaking:()=>{console.log("[OnboardingSDK] 🎤 User started speaking"),this.agentState="listening",this.userIsSpeaking=!0,this.renderReactUI(),this.emit("userSpeaking",!0)},onUserStoppedSpeaking:()=>{console.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()}),console.log("[OnboardingSDK] 📝 Added user message to history:",this.lastUserTranscript),this.lastUserTranscript=""),this.userTranscript="",this.renderReactUI(),this.emit("userSpeaking",!1)},onBotStartedSpeaking:()=>{console.log("[OnboardingSDK] 🔊 Bot started speaking"),this.agentState="speaking",this.botIsSpeaking=!0,this.userTranscript="",this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!0)},onBotStoppedSpeaking:()=>{console.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()}),console.log("[OnboardingSDK] 📝 Added assistant message to history:",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!1)},onServerMessage:n=>{console.log("[OnboardingSDK] Server message:",n),this.handleServerMessage(n)},onError:n=>{console.error("[OnboardingSDK] Error:",n),this.emit("error",n)}}}async resumeSession(n){console.log(`[OnboardingSDK] Resuming session: ${n}`),this.pendingResumeSessionId=n,this.agentState="idle",console.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(){console.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){console.warn("[OnboardingSDK] Cannot toggle screen share: client not initialized");return}try{this.screenShareEnabled?(console.log("[OnboardingSDK] Stopping screen share"),await this.pipecatClient.enableScreenShare(!1),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1})):(console.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){console.error("[OnboardingSDK] Failed to toggle screen share:",n),this.emit("error",n)}}sendMetadata(n){if(this.pipecatClient&&this.isConnected){const r=n.type||"metadata";console.log(`[OnboardingSDK] Sending metadata: ${r}`,n),this.pipecatClient.sendClientMessage(r,n)}else console.warn("[OnboardingSDK] Cannot send metadata - not connected")}sendDOMSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.2&&console.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&&(console.log(`[OnboardingSDK] Sending accessible snapshot: ${n.elementCount} elements (reduced from DOM)`),this.config.debug&&console.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()}handleServerMessage(n){console.log("[OnboardingSDK] 📥 Server message received:",JSON.stringify(n,null,2));let r=n;if(n.data&&typeof n.data=="object"&&(console.log("[OnboardingSDK] Unwrapping RTVIServerMessageFrame data"),r=n.data),r.type==="ui_action"&&r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received UI action from bot:",r.action),console.log("[OnboardingSDK] Target:",JSON.stringify(r.target,null,2)),this.handleHybridAction({action:r.action,target:r.target,value:r.value,description:r.description,precondition:r.precondition});return}if(r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received direct hybrid action:",r.action),this.handleHybridAction(r);return}r.type==="highlight"?(console.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"?(console.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"?(console.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"?(console.log("[OnboardingSDK] Plan started:",r),this.emit("planStarted",{planName:r.planName,totalSteps:r.totalSteps})):r.type==="plan_complete"?(console.log("[OnboardingSDK] Plan complete:",r),this.planProgress=null,this.overlay.cleanup(),this.renderReactUI(),this.emit("planComplete",{planName:r.planName})):console.log("[OnboardingSDK] Unhandled server message type:",r.type||"unknown")}async handleHybridAction(n){switch(console.log("[OnboardingSDK] 🎯 Handling hybrid action:",n.action),console.log("[OnboardingSDK] Target strategies:",n.target.strategy||"auto-detect"),console.log("[OnboardingSDK] Target text:",n.target.text),console.log("[OnboardingSDK] Target selector:",n.target.selector),console.log("[OnboardingSDK] Target tag:",n.target.tag),n.action){case"highlight":console.log("[OnboardingSDK] 💡 Executing HIGHLIGHT action"),this.overlay.highlightTarget(n.target,{color:"rgba(0, 170, 255, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element highlighted successfully"),n.description&&this.overlay.showTooltip(n.description,{}),this.emit("elementHighlighted",{target:n.target,description:n.description})):(console.warn("[OnboardingSDK] ⚠️ Failed to find element for highlight"),setTimeout(()=>{this.overlay.highlightTarget(n.target,{color:"rgba(255, 193, 7, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element found on retry"),n.description&&this.overlay.showTooltip(n.description,{})):console.error("[OnboardingSDK] ❌ Element not found even after retry:",n.target)},500));break;case"click":console.log("[OnboardingSDK] 👆 Executing CLICK action with Floe cursor");const i=An();if(n.target.optionText){console.log("[OnboardingSDK] 🎯 Dropdown option selection detected:",n.target.optionText),await this.handleDropdownOptionClick(n);break}let o=be.resolveTarget(n.target);if(!o){console.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 h,b;const a=this.findCollapsedSidebar(o);if(a){console.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)),console.log("[OnboardingSDK] 📂 Sidebar expanded")}if(!await be.waitForPositionStability(o,800)){console.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,console.log("[OnboardingSDK] 🔄 Re-resolved element after stability wait")):console.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:(h=n.target.strategy)==null?void 0:h.filter(y=>y!=="boundingBox"&&y!=="domIndex")}};let f=!1;try{f=await this.actionExecutor.executeHybridAction(d,!1)}finally{this._botActionDepth--}if(f){console.log("[OnboardingSDK] ✅ Click executed successfully");const y=(n.target.text||"").toLowerCase().trim(),m=((b=o==null?void 0:o.textContent)==null?void 0:b.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)}"`,console.error(`[OnboardingSDK] ❌ CLICK MISMATCH: ${w}`)),this.domIntrospector&&(await new Promise(k=>setTimeout(k,150)),this.domIntrospector.captureAndSendImmediate("post-bot-click"),console.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:An(),timestamp:Date.now()}),v?console.warn("[OnboardingSDK] ⚠️ Click mismatch reported to server"):console.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance")}else{const y=this.actionExecutor.lastError||"unknown";console.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":console.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":console.log("[OnboardingSDK] 🎯 Executing FOCUS action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"hover":console.log("[OnboardingSDK] 🖱️ Executing HOVER action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"scroll":console.log("[OnboardingSDK] 📜 Executing SCROLL action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"multi_select":console.log("[OnboardingSDK] 📋 Executing MULTI_SELECT action"),await this.handleMultiSelectAction(n);break;case"navigate":console.log("[OnboardingSDK] 🧭 Executing NAVIGATE action to URL:",n.value),this.overlay.cleanup();{const a=n.value;if(!a){console.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 y=new URL(a,window.location.href);if(y.protocol!=="http:"&&y.protocol!=="https:"){console.warn("[OnboardingSDK] ⚠️ Navigate blocked — disallowed scheme:",y.protocol),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:`Blocked: disallowed URL scheme "${y.protocol}"`,timestamp:Date.now()});break}l=y.href}catch{console.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(),f={resolvedUrl:za(l),beforeUrl:za(c),timestamp:d};try{sessionStorage.setItem("floe_pending_navigation",JSON.stringify(f))}catch{}const h=()=>{const y={type:"bot_action_complete",action:"navigate",target:f.resolvedUrl,success:!0,previousUrl:f.beforeUrl,currentUrl:f.resolvedUrl,timestamp:d,beacon:!0};try{const m=this.config.apiUrl||"";m&&navigator.sendBeacon&&navigator.sendBeacon(`${m}/api/v1/events/beacon`,new Blob([JSON.stringify(y)],{type:"application/json"}))}catch{}};window.addEventListener("pagehide",h,{once:!0}),window.location.href=l;const b=await this.waitForNavigation(l,1e4);window.removeEventListener("pagehide",h);try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata({type:"bot_action_complete",action:"navigate",target:za(l),success:b,previousUrl:za(c),currentUrl:An(),...b?{}:{error:"Navigation timed out waiting for URL change"},timestamp:d})}break;case"check_precondition":console.log("[OnboardingSDK] 🔍 Checking precondition"),await this.handleCheckPrecondition(n);break;default:console.warn("[OnboardingSDK] ⚠️ Unknown hybrid action:",n.action)}}async waitForNavigation(n,r){const i=Date.now(),o=200,s=h=>h.length>1&&h.endsWith("/")?h.slice(0,-1):h;let a;try{a=new URL(n)}catch{return console.warn("[OnboardingSDK] ⚠️ waitForNavigation: could not parse expectedUrl, using exact match"),new Promise(h=>{const b=()=>{if(window.location.href===n){h(!0);return}if(Date.now()-i>=r){h(!1);return}setTimeout(b,o)};b()})}const l=a.origin,c=s(a.pathname),d=a.search,f=a.hash;return new Promise(h=>{const b=()=>{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)&&(!f||m.hash===f)){console.log(`[OnboardingSDK] ✅ Navigation completed to: ${window.location.href}`),h(!0);return}}catch{}if(y>=r){console.warn(`[OnboardingSDK] ⏱️ Navigation timeout after ${r}ms. Current: ${window.location.href}, Expected: ${n}`),h(!1);return}setTimeout(b,o)};b()})}_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=An(),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),console.log(`[OnboardingSDK] 🔄 Finalized pending navigation: ${r.resolvedUrl} (success=${o})`)}async handleCheckPrecondition(n){const r=n.precondition;if(!r){console.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){console.log("[OnboardingSDK] 🔍 Opening dropdown to check for option:",o),this._botActionDepth++;try{this.actionExecutor.openDropdown(c)}finally{this._botActionDepth--}await new Promise(f=>setTimeout(f,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(h=>setTimeout(h,100));const f=document.activeElement instanceof HTMLElement?document.activeElement:document.body;f&&f.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(h=>setTimeout(h,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}`}console.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(console.log("[OnboardingSDK] 📋 handleMultiSelectAction for:",r),r.length===0){console.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){console.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),console.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];console.log(`[OnboardingSDK] 📋 Selecting option ${l+1}/${r.length}: "${c}"`);let d=this.findVisibleDropdownOption(c);if(!d){console.log("[OnboardingSDK] ⚠️ Option not visible, checking if dropdown closed..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}if(await new Promise(f=>setTimeout(f,300)),d=this.findVisibleDropdownOption(c),!d){const f=await this.scrollToDropdownOption(c);f&&(d=f)}}if(d)if(d.getAttribute("aria-selected")==="true"||d.classList.contains("selected")||d.closest('[aria-selected="true"]')!==null)o.push(c),console.log(`[OnboardingSDK] ✅ Already selected: "${c}"`);else{this._botActionDepth++;try{const h=d.getBoundingClientRect(),b=h.left+h.width/2,y=h.top+h.height/2,m={bubbles:!0,cancelable:!0,view:window,clientX:b,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),console.log(`[OnboardingSDK] ✅ Selected: "${c}"`)}finally{this._botActionDepth--}}else s.push(c),console.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;console.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;console.log("[OnboardingSDK] 🎯 handleDropdownOptionClick for:",r);let i=this.findVisibleDropdownOption(r);if(i){console.log("[OnboardingSDK] ✅ Option already visible, clicking directly"),await this.clickDropdownOption(i,n);return}const o=this.isDropdownCurrentlyOpen();console.log("[OnboardingSDK] 🔍 Option not visible, dropdown already open:",o);const s=this.findDropdownTrigger(n.target);if(!s){console.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){console.log("[OnboardingSDK] 📜 Dropdown open but option not visible — trying scroll first");const f=await this.scrollToDropdownOption(r);if(f){console.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(f,n);return}}const a=this.findDropdownSearchInput(s);if(a){if(console.log("[OnboardingSDK] ⌨️ Typing to filter dropdown:",r),i=await this.typeToFilterDropdown(a,r),i){console.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}console.log("[OnboardingSDK] ⚠️ Typing to filter did not reveal the option")}if(!o){be.scrollIntoView(s),await new Promise(b=>setTimeout(b,200)),await this.overlay.moveToElementAndClick(s),console.log("[OnboardingSDK] 📂 Opening dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(s)}finally{this._botActionDepth--}if(await new Promise(b=>setTimeout(b,300)),i=this.findVisibleDropdownOption(r),i){console.log("[OnboardingSDK] ✅ Option visible after opening dropdown"),await this.clickDropdownOption(i,n);return}const f=this.findDropdownSearchInput(s);if(f&&(console.log("[OnboardingSDK] ⌨️ Typing to filter after opening dropdown:",r),i=await this.typeToFilterDropdown(f,r),i)){console.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}const h=await this.scrollToDropdownOption(r);if(h){console.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(h,n);return}}const l=1500,c=150;let d=0;for(;d<l;){if(i=this.findVisibleDropdownOption(r),i){console.log("[OnboardingSDK] ✅ Option appeared after",d,"ms (final poll)");break}await new Promise(f=>setTimeout(f,c)),d+=c}if(!i){console.error("[OnboardingSDK] ❌ All strategies failed for option:",r);const f=document.querySelectorAll('[role="option"], [class*="option"], nz-option-item, .ant-select-item-option'),h=Array.from(f).slice(0,10).map(b=>{var y;return(y=b.textContent)==null?void 0:y.trim().slice(0,50)}).filter(Boolean);h.length>0?console.log("[OnboardingSDK] Available options:",h):console.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(){const n=[".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"]'];for(const r of n)try{const i=document.querySelector(r);if(i&&be.isVisible(i)){const o=i.getBoundingClientRect();if(o.height>20&&o.width>20)return console.log("[OnboardingSDK] Dropdown detected as open via:",r),!0}}catch{continue}return!1}findDropdownSearchInput(n){if(n instanceof HTMLInputElement&&(n.getAttribute("role")==="combobox"||n.classList.contains("ant-select-selection-search-input")||n.type==="search"))return console.log("[OnboardingSDK] 🔍 Trigger itself is search input"),n;const r=["input.ant-select-selection-search-input",'input[role="combobox"]','input[type="search"]','input[class*="search"]','input[class*="Search"]','input[aria-autocomplete="list"]'],o=n.closest('nz-select, [class*="select-container"], [class*="Select"], [class*="combobox"]')||n.parentElement;if(o)for(const l of r){const c=o.querySelector(l);if(c)return console.log("[OnboardingSDK] 🔍 Found search input via:",l),c}const s=document.querySelectorAll(".cdk-overlay-pane");for(const l of s)if(be.isVisible(l))for(const c of r){const d=l.querySelector(c);if(d)return console.log("[OnboardingSDK] 🔍 Found search input in CDK overlay via:",c),d}const a=document.activeElement;return a instanceof HTMLInputElement&&(a.getAttribute("role")==="combobox"||a.classList.contains("ant-select-selection-search-input"))?(console.log("[OnboardingSDK] 🔍 Found search input as active element"),a):(console.log("[OnboardingSDK] ⚠️ No search input found for dropdown"),null)}async typeToFilterDropdown(n,r){const i=this.getSearchTermsForOption(r);for(const o of i){console.log(`[OnboardingSDK] ⌨️ Typing search term: "${o}"`),n.focus(),await new Promise(a=>setTimeout(a,50)),n.value="",n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(a=>setTimeout(a,100));for(let a=0;a<o.length;a++){const l=o[a];n.value=o.substring(0,a+1),n.dispatchEvent(new KeyboardEvent("keydown",{key:l,bubbles:!0})),n.dispatchEvent(new KeyboardEvent("keypress",{key:l,bubbles:!0})),n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new KeyboardEvent("keyup",{key:l,bubbles:!0})),await new Promise(c=>setTimeout(c,30))}n.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(a=>setTimeout(a,400));let s=this.findVisibleDropdownOption(r);if(s||(await new Promise(a=>setTimeout(a,300)),s=this.findVisibleDropdownOption(r),s))return s}return n.value="",n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),await new Promise(o=>setTimeout(o,200)),null}getSearchTermsForOption(n){const r=[],i=n.match(/^([^(]+)/),o=i?i[1].trim():n,s=o.split(/\s+/)[0];return s&&s.length>=2&&r.push(s),o!==s&&r.push(o),r.length===0&&r.push(n),r}findVisibleDropdownOption(n){var l;const r=n.toLowerCase().trim(),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(", ");let s=null,a=null;for(const c of i){let d;try{d=document.querySelectorAll(c)}catch{continue}for(const f of d){const h=f;if(!be.isVisible(h)||h.getBoundingClientRect().height<20)continue;const y=f.querySelectorAll(o);for(const m of y){const S=m,v=S.className||"";if(v.toLowerCase().includes("singlevalue")||v.toLowerCase().includes("placeholder"))continue;const w=S.getBoundingClientRect();if(w.height===0||w.width===0)continue;const k=((l=S.textContent)==null?void 0:l.trim().toLowerCase())||"";if(k===r){console.log(`[OnboardingSDK] Found EXACT match for option: "${n}"`),s=S;break}if(!a&&k.includes(r)){const C=r.length/k.length;C>.7&&(console.log(`[OnboardingSDK] Found partial match (${(C*100).toFixed(0)}%): "${k.slice(0,50)}"`),a=S)}}if(s)break}if(s)break}return s||(a?(console.warn(`[OnboardingSDK] ⚠️ Using partial match for "${n}" - verify this is correct`),a):(console.log(`[OnboardingSDK] No option found for: "${n}"`),null))}async scrollToDropdownOption(n){var o;const r=n.toLowerCase().trim();console.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"){console.log(`[OnboardingSDK] Skipping non-scrollable container (${s}), overflow-y: ${d}`);continue}console.log(`[OnboardingSDK] Found scrollable container (${s}), scrollHeight: ${c.scrollHeight}, clientHeight: ${c.clientHeight}, overflow-y: ${d}`);const f=150,h=Math.ceil(c.scrollHeight/f)+2,b=c.scrollTop;for(let y=0;y<h;y++){c.scrollTop=y*f,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 console.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=b}}return console.log(`[OnboardingSDK] Option not found after scrolling: "${n}"`),null}isValidDropdownElement(n,r=!1){if(!n)return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is null"),!1;if(Ct(n))return console.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 console.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 console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has display:none",{id:n.id,className:n.className}),!1;if(i.visibility==="hidden")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has visibility:hidden",{id:n.id,className:n.className}),!1;if(i.pointerEvents==="none")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has pointer-events:none",{id:n.id,className:n.className}),!1;if(i.opacity==="0")return console.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 console.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?(console.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)?(console.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){console.log("[OnboardingSDK] 🎯 Using dropdownTriggerSelector:",n.dropdownTriggerSelector);try{const s=hy(n.dropdownTriggerSelector);if(s){const a=this.getClickableDropdownContainer(s);if(this.isValidDropdownElement(a))return console.log("[OnboardingSDK] ✅ Found trigger via dropdownTriggerSelector"),a;console.warn("[OnboardingSDK] ⚠️ Strategy 1: dropdownTriggerSelector element failed validation")}}catch(s){console.warn("[OnboardingSDK] Invalid dropdownTriggerSelector:",s)}}if(n.labelText){console.log("[OnboardingSDK] 🔍 Finding dropdown by label:",n.labelText);const s=this.findDropdownByLabel(n.labelText);if(s)return console.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 console.log("[OnboardingSDK] ✅ Found focused combobox"),s;console.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 console.log("[OnboardingSDK] ✅ Found expanded combobox"),s;console.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 console.log("[OnboardingSDK] ✅ Found trigger via cleaned selector"),c;console.warn("[OnboardingSDK] ⚠️ Strategy 4: selector element failed validation")}}catch{console.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 f=((o=d.textContent)==null?void 0:o.trim().toLowerCase())||"";if(f===s||f.includes(s)){const h=this.getClickableDropdownContainer(d);if(this.isValidDropdownElement(h,!0))return console.log("[OnboardingSDK] ✅ Found trigger via display value match"),h;console.warn("[OnboardingSDK] ⚠️ Strategy 5: display value match element failed validation",{searchText:s,selector:l,elementText:f})}}}}return console.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 b=document.getElementById(d.htmlFor);if(b)return this.getClickableDropdownContainer(b)}const f=d.id;if(f){const b=document.querySelector(`[aria-labelledby="${f}"]`);if(b)return this.getClickableDropdownContainer(b)}const h=d.closest('[class*="field"], [class*="form-group"], [class*="FormControl"]')||d.parentElement;if(h){const b=h.querySelector('input[role="combobox"], select, [aria-haspopup="listbox"], [class*="control"]');if(b)return this.getClickableDropdownContainer(b)}}}}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)),console.log("[OnboardingSDK] 👆 Clicking dropdown option:",(i=n.textContent)==null?void 0:i.trim()),this._botActionDepth++;try{if(this.actionExecutor.triggerReactOnClickPublic(n))console.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--}console.log("[OnboardingSDK] ✅ Dropdown option clicked successfully"),this.domIntrospector&&(await new Promise(o=>setTimeout(o,150)),this.domIntrospector.captureAndSendImmediate("post-dropdown-select"),console.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()}),console.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:"",f=d.includes("sidebar")||d.includes("nav")||d.includes("menu"),h=d.includes("w-12")||d.includes("w-14")||d.includes("w-16");if(l&&c&&(a||f)||h)return console.log("[OnboardingSDK] Detected collapsed sidebar:",{width:o,height:s,hasTransition:a,hasTailwindCollapsed:h,classes:r.className.substring(0,100)}),r;r=r.parentElement}return null}async executeActionFast(n){console.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 console.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 b;console.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 f=i;if(o&&(f=`${o.replace(/\/$/,"")}/${i.replace(/^\//,"")}`),a&&r==="GET"){const y=new URLSearchParams(a);f=`${f}?${y.toString()}`}try{const y=new URL(f,window.location.href);if(y.origin!==window.location.origin){console.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:f,method:r,timestamp:Date.now()});return}}catch{console.error("[OnboardingSDK] ❌ Invalid URL:",f),this.sendMetadata({type:"api_execution_result",success:!1,error:`Invalid URL: ${f}`,url:f,method:r,timestamp:Date.now()});return}if(!["GET","HEAD","POST","PUT","PATCH","DELETE"].includes(r.toUpperCase())){console.error("[OnboardingSDK] ❌ HTTP method not allowed:",r),this.sendMetadata({type:"api_execution_result",success:!1,error:`HTTP method not allowed: ${r}`,url:f,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)),console.log("[OnboardingSDK] 📤 Making API request:",f);const m=await fetch(f,y);let S;const v=await m.text();try{S=JSON.parse(v)}catch{S={raw:v}}console.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)||((b=S.error)==null?void 0:b.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:f,method:r,timestamp:Date.now()}),console.log(`[OnboardingSDK] ${w?"✅":"❌"} API execution ${w?"succeeded":"failed"}:`,k||C)}catch(y){console.error("[OnboardingSDK] ❌ API execution error:",y),this.sendMetadata({type:"api_execution_result",success:!1,error:y instanceof Error?y.message:"Unknown error",url:f,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(console.log("[OnboardingSDK] ⚡ Received batched navigation request"),!this.batchedActionExecutor){console.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){console.warn("[OnboardingSDK] No steps in batched navigation request");return}this.fastExecutionMode=!0,this._botActionDepth++;try{console.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"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after batched navigation")),i.success?(console.log("[OnboardingSDK] ✅ Batched navigation complete, sending success"),this.sendMetadata({type:"batched_navigation_complete",success:!0,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()})):(console.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=>{console.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:An(),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:An(),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,console.log("[OnboardingSDK] ⌨️ Text mode enabled — mic muted")):((r=this.pipecatClient)==null||r.enableMic(!0),this.micEnabled=!0,console.log("[OnboardingSDK] 🎤 Voice mode enabled — mic unmuted"),this.isConnected&&this.setupUserMicAnalysis());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.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,console.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?(console.warn("[OnboardingSDK] Cannot start discovery - not connected"),!1):(console.log("[OnboardingSDK] 🔍 Starting guided discovery mode"),this.pipecatClient.sendClientMessage("start_discovery",{type:"start_discovery",timestamp:Date.now()}),this.hideWelcomePopup(),!0)}skipDiscovery(){console.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=`
|
|
818
|
+
`,document.body.appendChild(this.reactContainer),this.reactRoot=uc.createRoot(this.reactContainer),this.renderReactUI()}renderReactUI(){var n,r,i;this.reactRoot&&this.reactRoot.render(tg.createElement(Lx,{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,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,console.log("[OnboardingSDK] UI minimized"),this.renderReactUI(),this.emit("minimized")}handleExpand(){this._isMinimized=!1,console.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){console.log("[OnboardingSDK] Disconnecting and minimizing...");try{await this.disconnectAndMinimize()}catch(n){console.error("[OnboardingSDK] Error during disconnect and minimize:",n),this.emit("error",n)}return}if(this.connectInFlight){console.log("[OnboardingSDK] Connection operation already in progress, ignoring...");return}try{await this.connectWithProgress()}catch(n){console.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(),console.log("[OnboardingSDK] Disconnected and minimized"),this.emit("disconnected"),this.emit("minimized")}async connectWithProgress(){if(this.connectInFlight){console.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 yn,this.setConnectionProgress("authenticating","Authenticating...",30),this.pipecatClient=new Ft({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(),await this.pipecatClient.initDevices(),console.log("[OnboardingSDK] Devices initialized"),this.setupAudioPlayback(),this.setConnectionProgress("connecting","Connecting to server...",50);const n=`${this.config.apiUrl}/sites/start-session`;console.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){console.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;console.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,console.log("[OnboardingSDK] 🎤 Mic state on connect:",this.micEnabled?"ON":"MUTED"),this.textModeEnabled&&this.pipecatClient&&(this.pipecatClient.enableMic(!1),this.micEnabled=!1,console.log("[OnboardingSDK] ⌨️ Text mode active — mic muted on connect")),this.clearConnectionProgress(),this.renderReactUI(),this.emit("connected")},onDisconnected:()=>{console.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&&(console.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(console.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)}),console.log("[OnboardingSDK] DOM Introspection Layer started (with Accessible Snapshot)"),this.pageTracker.setDOMIntrospector(this.domIntrospector),this.pageTracker.start(),console.log("[OnboardingSDK] PageTracker started"),this.config.clientKey){console.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,console.log(`[OnboardingSDK] Resuming session: ${this.pendingResumeSessionId}`),this.pendingResumeSessionId=null),(n=this.pipecatClient)==null||n.sendClientMessage("site_init",r)}this.emit("botReady"),this._pendingDiscoveryStart&&(console.log("[OnboardingSDK] 🔍 Starting pending guided discovery"),this._pendingDiscoveryStart=!1,setTimeout(()=>{this.isConnected&&this.startGuidedDiscovery()},500))},onUserTranscript:n=>{console.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),this.renderReactUI()},onBotTtsText:n=>{this.textModeEnabled||(console.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&&(console.log("[OnboardingSDK] 🤖 Bot LLM started (text mode)"),this.agentState="speaking",this.botTranscript="",this.renderReactUI())},onBotLlmStopped:()=>{this.textModeEnabled&&(console.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()}),console.log("[OnboardingSDK] 📝 Added assistant message to history (text mode):",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI())},onUserStartedSpeaking:()=>{console.log("[OnboardingSDK] 🎤 User started speaking"),this.agentState="listening",this.userIsSpeaking=!0,this.renderReactUI(),this.emit("userSpeaking",!0)},onUserStoppedSpeaking:()=>{console.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()}),console.log("[OnboardingSDK] 📝 Added user message to history:",this.lastUserTranscript),this.lastUserTranscript=""),this.userTranscript="",this.renderReactUI(),this.emit("userSpeaking",!1)},onBotStartedSpeaking:()=>{console.log("[OnboardingSDK] 🔊 Bot started speaking"),this.agentState="speaking",this.botIsSpeaking=!0,this.userTranscript="",this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!0)},onBotStoppedSpeaking:()=>{console.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()}),console.log("[OnboardingSDK] 📝 Added assistant message to history:",this.botTranscript.substring(0,50)+"...")),this.botTranscript="",this.renderReactUI(),this.emit("botSpeaking",!1)},onServerMessage:n=>{console.log("[OnboardingSDK] Server message:",n),this.handleServerMessage(n)},onError:n=>{console.error("[OnboardingSDK] Error:",n),this.emit("error",n)}}}async resumeSession(n){console.log(`[OnboardingSDK] Resuming session: ${n}`),this.pendingResumeSessionId=n,this.agentState="idle",console.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(){console.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){console.warn("[OnboardingSDK] Cannot toggle screen share: client not initialized");return}try{this.screenShareEnabled?(console.log("[OnboardingSDK] Stopping screen share"),await this.pipecatClient.enableScreenShare(!1),this.screenShareEnabled=!1,this.sendMetadata({type:"screen_share_status",active:!1})):(console.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){console.error("[OnboardingSDK] Failed to toggle screen share:",n),this.emit("error",n)}}sendMetadata(n){if(this.pipecatClient&&this.isConnected){const r=n.type||"metadata";console.log(`[OnboardingSDK] Sending metadata: ${r}`,n),this.pipecatClient.sendClientMessage(r,n)}else console.warn("[OnboardingSDK] Cannot send metadata - not connected")}sendDOMSnapshot(n){this.pipecatClient&&this.isConnected&&(Math.random()<.2&&console.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&&(console.log(`[OnboardingSDK] Sending accessible snapshot: ${n.elementCount} elements (reduced from DOM)`),this.config.debug&&console.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()}handleServerMessage(n){console.log("[OnboardingSDK] 📥 Server message received:",JSON.stringify(n,null,2));let r=n;if(n.data&&typeof n.data=="object"&&(console.log("[OnboardingSDK] Unwrapping RTVIServerMessageFrame data"),r=n.data),r.type==="ui_action"&&r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received UI action from bot:",r.action),console.log("[OnboardingSDK] Target:",JSON.stringify(r.target,null,2)),this.handleHybridAction({action:r.action,target:r.target,value:r.value,description:r.description,precondition:r.precondition});return}if(r.action&&r.target){console.log("[OnboardingSDK] 🎯 Received direct hybrid action:",r.action),this.handleHybridAction(r);return}r.type==="highlight"?(console.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"?(console.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"?(console.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"?(console.log("[OnboardingSDK] Plan started:",r),this.emit("planStarted",{planName:r.planName,totalSteps:r.totalSteps})):r.type==="plan_complete"?(console.log("[OnboardingSDK] Plan complete:",r),this.planProgress=null,this.overlay.cleanup(),this.renderReactUI(),this.emit("planComplete",{planName:r.planName})):console.log("[OnboardingSDK] Unhandled server message type:",r.type||"unknown")}async handleHybridAction(n){switch(console.log("[OnboardingSDK] 🎯 Handling hybrid action:",n.action),console.log("[OnboardingSDK] Target strategies:",n.target.strategy||"auto-detect"),console.log("[OnboardingSDK] Target text:",n.target.text),console.log("[OnboardingSDK] Target selector:",n.target.selector),console.log("[OnboardingSDK] Target tag:",n.target.tag),n.action){case"highlight":console.log("[OnboardingSDK] 💡 Executing HIGHLIGHT action"),this.overlay.highlightTarget(n.target,{color:"rgba(0, 170, 255, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element highlighted successfully"),n.description&&this.overlay.showTooltip(n.description,{}),this.emit("elementHighlighted",{target:n.target,description:n.description})):(console.warn("[OnboardingSDK] ⚠️ Failed to find element for highlight"),setTimeout(()=>{this.overlay.highlightTarget(n.target,{color:"rgba(255, 193, 7, 0.7)",padding:10})?(console.log("[OnboardingSDK] ✅ Element found on retry"),n.description&&this.overlay.showTooltip(n.description,{})):console.error("[OnboardingSDK] ❌ Element not found even after retry:",n.target)},500));break;case"click":console.log("[OnboardingSDK] 👆 Executing CLICK action with Floe cursor");const i=An();if(n.target.optionText){console.log("[OnboardingSDK] 🎯 Dropdown option selection detected:",n.target.optionText),await this.handleDropdownOptionClick(n);break}let o=ye.resolveTarget(n.target);if(!o){console.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}ye.scrollIntoView(o),setTimeout(async()=>{var h,b;const a=this.findCollapsedSidebar(o);if(a){console.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(v=>setTimeout(v,450)),console.log("[OnboardingSDK] 📂 Sidebar expanded")}if(!await ye.waitForPositionStability(o,800)){console.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=ye.reResolveAndVerify(n.target,o);c?(o=c,console.log("[OnboardingSDK] 🔄 Re-resolved element after stability wait")):console.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:(h=n.target.strategy)==null?void 0:h.filter(y=>y!=="boundingBox"&&y!=="domIndex")}};let f=!1;try{f=await this.actionExecutor.executeHybridAction(d,!1)}finally{this._botActionDepth--}if(f){console.log("[OnboardingSDK] ✅ Click executed successfully");const y=(n.target.text||"").toLowerCase().trim(),v=((b=o==null?void 0:o.textContent)==null?void 0:b.toLowerCase().trim())||"",S=(o==null?void 0:o.tagName.toLowerCase())||"unknown";let m=!1,w="";y&&v&&!v.includes(y)&&!y.includes(v)&&(m=!0,w=`Expected "${n.target.text}", but clicked "${v.slice(0,50)}"`,console.error(`[OnboardingSDK] ❌ CLICK MISMATCH: ${w}`)),this.domIntrospector&&(await new Promise(k=>setTimeout(k,150)),this.domIntrospector.captureAndSendImmediate("post-bot-click"),console.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?v.slice(0,100):void 0,clickedTag:S,mismatch:m,mismatchDetails:w||void 0,previousUrl:i,currentUrl:An(),timestamp:Date.now()}),m?console.warn("[OnboardingSDK] ⚠️ Click mismatch reported to server"):console.log("[OnboardingSDK] 📤 Sent bot_action_complete for auto-advance")}else{const y=this.actionExecutor.lastError||"unknown";console.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":console.log("[OnboardingSDK] ⌨️ Executing TYPE action, value:",n.value);const s=ye.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":console.log("[OnboardingSDK] 🎯 Executing FOCUS action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"hover":console.log("[OnboardingSDK] 🖱️ Executing HOVER action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"scroll":console.log("[OnboardingSDK] 📜 Executing SCROLL action"),await this.actionExecutor.executeHybridAction(n,!1);break;case"multi_select":console.log("[OnboardingSDK] 📋 Executing MULTI_SELECT action"),await this.handleMultiSelectAction(n);break;case"navigate":console.log("[OnboardingSDK] 🧭 Executing NAVIGATE action to URL:",n.value),this.overlay.cleanup();{const a=n.value;if(!a){console.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 y=new URL(a,window.location.href);if(y.protocol!=="http:"&&y.protocol!=="https:"){console.warn("[OnboardingSDK] ⚠️ Navigate blocked — disallowed scheme:",y.protocol),this.sendMetadata({type:"bot_action_complete",action:"navigate",success:!1,error:`Blocked: disallowed URL scheme "${y.protocol}"`,timestamp:Date.now()});break}l=y.href}catch{console.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(),f={resolvedUrl:Ha(l),beforeUrl:Ha(c),timestamp:d};try{sessionStorage.setItem("floe_pending_navigation",JSON.stringify(f))}catch{}const h=()=>{const y={type:"bot_action_complete",action:"navigate",target:f.resolvedUrl,success:!0,previousUrl:f.beforeUrl,currentUrl:f.resolvedUrl,timestamp:d,beacon:!0};try{const v=this.config.apiUrl||"";v&&navigator.sendBeacon&&navigator.sendBeacon(`${v}/api/v1/events/beacon`,new Blob([JSON.stringify(y)],{type:"application/json"}))}catch{}};window.addEventListener("pagehide",h,{once:!0}),window.location.href=l;const b=await this.waitForNavigation(l,1e4);window.removeEventListener("pagehide",h);try{sessionStorage.removeItem("floe_pending_navigation")}catch{}this.sendMetadata({type:"bot_action_complete",action:"navigate",target:Ha(l),success:b,previousUrl:Ha(c),currentUrl:An(),...b?{}:{error:"Navigation timed out waiting for URL change"},timestamp:d})}break;case"check_precondition":console.log("[OnboardingSDK] 🔍 Checking precondition"),await this.handleCheckPrecondition(n);break;default:console.warn("[OnboardingSDK] ⚠️ Unknown hybrid action:",n.action)}}async waitForNavigation(n,r){const i=Date.now(),o=200,s=h=>h.length>1&&h.endsWith("/")?h.slice(0,-1):h;let a;try{a=new URL(n)}catch{return console.warn("[OnboardingSDK] ⚠️ waitForNavigation: could not parse expectedUrl, using exact match"),new Promise(h=>{const b=()=>{if(window.location.href===n){h(!0);return}if(Date.now()-i>=r){h(!1);return}setTimeout(b,o)};b()})}const l=a.origin,c=s(a.pathname),d=a.search,f=a.hash;return new Promise(h=>{const b=()=>{const y=Date.now()-i;try{const v=new URL(window.location.href);if(v.origin===l&&s(v.pathname)===c&&(!d||v.search===d)&&(!f||v.hash===f)){console.log(`[OnboardingSDK] ✅ Navigation completed to: ${window.location.href}`),h(!0);return}}catch{}if(y>=r){console.warn(`[OnboardingSDK] ⏱️ Navigation timeout after ${r}ms. Current: ${window.location.href}, Expected: ${n}`),h(!1);return}setTimeout(b,o)};b()})}_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=An(),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),console.log(`[OnboardingSDK] 🔄 Finalized pending navigation: ${r.resolvedUrl} (success=${o})`)}async handleCheckPrecondition(n){const r=n.precondition;if(!r){console.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){console.log("[OnboardingSDK] 🔍 Opening dropdown to check for option:",o),this._botActionDepth++;try{this.actionExecutor.openDropdown(c)}finally{this._botActionDepth--}await new Promise(f=>setTimeout(f,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(h=>setTimeout(h,100));const f=document.activeElement instanceof HTMLElement?document.activeElement:document.body;f&&f.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),await new Promise(h=>setTimeout(h,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&&ye.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}`}console.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(console.log("[OnboardingSDK] 📋 handleMultiSelectAction for:",r),r.length===0){console.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){console.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}ye.scrollIntoView(i),await new Promise(l=>setTimeout(l,200)),await this.overlay.moveToElementAndClick(i),console.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];console.log(`[OnboardingSDK] 📋 Selecting option ${l+1}/${r.length}: "${c}"`);let d=this.findVisibleDropdownOption(c);if(!d){console.log("[OnboardingSDK] ⚠️ Option not visible, checking if dropdown closed..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(i)}finally{this._botActionDepth--}if(await new Promise(f=>setTimeout(f,300)),d=this.findVisibleDropdownOption(c),!d){const f=await this.scrollToDropdownOption(c);f&&(d=f)}}if(d)if(d.getAttribute("aria-selected")==="true"||d.classList.contains("selected")||d.closest('[aria-selected="true"]')!==null)o.push(c),console.log(`[OnboardingSDK] ✅ Already selected: "${c}"`);else{this._botActionDepth++;try{const h=d.getBoundingClientRect(),b=h.left+h.width/2,y=h.top+h.height/2,v={bubbles:!0,cancelable:!0,view:window,clientX:b,clientY:y};d.dispatchEvent(new MouseEvent("mousedown",v)),d.dispatchEvent(new MouseEvent("mouseup",v)),d.dispatchEvent(new MouseEvent("click",v)),await new Promise(S=>setTimeout(S,200)),o.push(c),console.log(`[OnboardingSDK] ✅ Selected: "${c}"`)}finally{this._botActionDepth--}}else s.push(c),console.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;console.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;console.log("[OnboardingSDK] 🎯 handleDropdownOptionClick for:",r);let i=this.findVisibleDropdownOption(r);if(i){console.log("[OnboardingSDK] ✅ Option already visible, clicking directly"),await this.clickDropdownOption(i,n);return}const o=this.isDropdownCurrentlyOpen();console.log("[OnboardingSDK] 🔍 Option not visible, dropdown already open:",o);const s=this.findDropdownTrigger(n.target);if(!s){console.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){console.log("[OnboardingSDK] 📜 Dropdown open but option not visible — trying scroll first");const f=await this.scrollToDropdownOption(r);if(f){console.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(f,n);return}}const a=this.findDropdownSearchInput(s);if(a){if(console.log("[OnboardingSDK] ⌨️ Typing to filter dropdown:",r),i=await this.typeToFilterDropdown(a,r),i){console.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}console.log("[OnboardingSDK] ⚠️ Typing to filter did not reveal the option")}if(!o){ye.scrollIntoView(s),await new Promise(b=>setTimeout(b,200)),await this.overlay.moveToElementAndClick(s),console.log("[OnboardingSDK] 📂 Opening dropdown..."),this._botActionDepth++;try{this.actionExecutor.openDropdown(s)}finally{this._botActionDepth--}if(await new Promise(b=>setTimeout(b,300)),i=this.findVisibleDropdownOption(r),i){console.log("[OnboardingSDK] ✅ Option visible after opening dropdown"),await this.clickDropdownOption(i,n);return}const f=this.findDropdownSearchInput(s);if(f&&(console.log("[OnboardingSDK] ⌨️ Typing to filter after opening dropdown:",r),i=await this.typeToFilterDropdown(f,r),i)){console.log("[OnboardingSDK] ✅ Found option after typing to filter"),await this.clickDropdownOption(i,n);return}const h=await this.scrollToDropdownOption(r);if(h){console.log("[OnboardingSDK] ✅ Found option after scrolling"),await this.clickDropdownOption(h,n);return}}const l=1500,c=150;let d=0;for(;d<l;){if(i=this.findVisibleDropdownOption(r),i){console.log("[OnboardingSDK] ✅ Option appeared after",d,"ms (final poll)");break}await new Promise(f=>setTimeout(f,c)),d+=c}if(!i){console.error("[OnboardingSDK] ❌ All strategies failed for option:",r);const f=document.querySelectorAll('[role="option"], [class*="option"], nz-option-item, .ant-select-item-option'),h=Array.from(f).slice(0,10).map(b=>{var y;return(y=b.textContent)==null?void 0:y.trim().slice(0,50)}).filter(Boolean);h.length>0?console.log("[OnboardingSDK] Available options:",h):console.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 Ux(ye.isVisible)}findDropdownSearchInput(n){return zx(n,ye.isVisible)}async typeToFilterDropdown(n,r){return Vx(n,r,ye.isVisible)}findVisibleDropdownOption(n){return $o(n,ye.isVisible)}async scrollToDropdownOption(n){var o;const r=n.toLowerCase().trim();console.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(!ye.isVisible(c)||c.scrollHeight<=c.clientHeight+5)continue;const d=window.getComputedStyle(c).overflowY;if(d==="visible"||d==="hidden"){console.log(`[OnboardingSDK] Skipping non-scrollable container (${s}), overflow-y: ${d}`);continue}console.log(`[OnboardingSDK] Found scrollable container (${s}), scrollHeight: ${c.scrollHeight}, clientHeight: ${c.clientHeight}, overflow-y: ${d}`);const f=150,h=Math.ceil(c.scrollHeight/f)+2,b=c.scrollTop;for(let y=0;y<h;y++){c.scrollTop=y*f,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 console.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=b}}return console.log(`[OnboardingSDK] Option not found after scrolling: "${n}"`),null}isValidDropdownElement(n,r=!1){if(!n)return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element is null"),!1;if(Ct(n))return console.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 console.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 console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has display:none",{id:n.id,className:n.className}),!1;if(i.visibility==="hidden")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has visibility:hidden",{id:n.id,className:n.className}),!1;if(i.pointerEvents==="none")return console.warn("[OnboardingSDK] ⚠️ Dropdown validation: element has pointer-events:none",{id:n.id,className:n.className}),!1;if(i.opacity==="0")return console.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 console.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?(console.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)?(console.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){console.log("[OnboardingSDK] 🎯 Using dropdownTriggerSelector:",n.dropdownTriggerSelector);try{const s=py(n.dropdownTriggerSelector);if(s){const a=this.getClickableDropdownContainer(s);if(this.isValidDropdownElement(a))return console.log("[OnboardingSDK] ✅ Found trigger via dropdownTriggerSelector"),a;console.warn("[OnboardingSDK] ⚠️ Strategy 1: dropdownTriggerSelector element failed validation")}}catch(s){console.warn("[OnboardingSDK] Invalid dropdownTriggerSelector:",s)}}if(n.labelText){console.log("[OnboardingSDK] 🔍 Finding dropdown by label:",n.labelText);const s=this.findDropdownByLabel(n.labelText);if(s)return console.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 console.log("[OnboardingSDK] ✅ Found focused combobox"),s;console.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 console.log("[OnboardingSDK] ✅ Found expanded combobox"),s;console.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 console.log("[OnboardingSDK] ✅ Found trigger via cleaned selector"),c;console.warn("[OnboardingSDK] ⚠️ Strategy 4: selector element failed validation")}}catch{console.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 f=((o=d.textContent)==null?void 0:o.trim().toLowerCase())||"";if(f===s||f.includes(s)){const h=this.getClickableDropdownContainer(d);if(this.isValidDropdownElement(h,!0))return console.log("[OnboardingSDK] ✅ Found trigger via display value match"),h;console.warn("[OnboardingSDK] ⚠️ Strategy 5: display value match element failed validation",{searchText:s,selector:l,elementText:f})}}}}return console.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 b=document.getElementById(d.htmlFor);if(b)return this.getClickableDropdownContainer(b)}const f=d.id;if(f){const b=document.querySelector(`[aria-labelledby="${f}"]`);if(b)return this.getClickableDropdownContainer(b)}const h=d.closest('[class*="field"], [class*="form-group"], [class*="FormControl"]')||d.parentElement;if(h){const b=h.querySelector('input[role="combobox"], select, [aria-haspopup="listbox"], [class*="control"]');if(b)return this.getClickableDropdownContainer(b)}}}}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)),console.log("[OnboardingSDK] 👆 Clicking dropdown option:",(i=n.textContent)==null?void 0:i.trim()),this._botActionDepth++;try{if(this.actionExecutor.triggerReactOnClickPublic(n))console.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--}console.log("[OnboardingSDK] ✅ Dropdown option clicked successfully"),this.domIntrospector&&(await new Promise(o=>setTimeout(o,150)),this.domIntrospector.captureAndSendImmediate("post-dropdown-select"),console.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()}),console.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:"",f=d.includes("sidebar")||d.includes("nav")||d.includes("menu"),h=d.includes("w-12")||d.includes("w-14")||d.includes("w-16");if(l&&c&&(a||f)||h)return console.log("[OnboardingSDK] Detected collapsed sidebar:",{width:o,height:s,hasTransition:a,hasTailwindCollapsed:h,classes:r.className.substring(0,100)}),r;r=r.parentElement}return null}async executeActionFast(n){console.log("[OnboardingSDK] ⚡ Fast executing action:",n.action);let r=ye.resolveTarget(n.target);if(!r&&(await new Promise(o=>setTimeout(o,150)),r=ye.resolveTarget(n.target),!r))return console.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 b;console.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 f=i;if(o&&(f=`${o.replace(/\/$/,"")}/${i.replace(/^\//,"")}`),a&&r==="GET"){const y=new URLSearchParams(a);f=`${f}?${y.toString()}`}try{const y=new URL(f,window.location.href);if(y.origin!==window.location.origin){console.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:f,method:r,timestamp:Date.now()});return}}catch{console.error("[OnboardingSDK] ❌ Invalid URL:",f),this.sendMetadata({type:"api_execution_result",success:!1,error:`Invalid URL: ${f}`,url:f,method:r,timestamp:Date.now()});return}if(!["GET","HEAD","POST","PUT","PATCH","DELETE"].includes(r.toUpperCase())){console.error("[OnboardingSDK] ❌ HTTP method not allowed:",r),this.sendMetadata({type:"api_execution_result",success:!1,error:`HTTP method not allowed: ${r}`,url:f,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)),console.log("[OnboardingSDK] 📤 Making API request:",f);const v=await fetch(f,y);let S;const m=await v.text();try{S=JSON.parse(m)}catch{S={raw:m}}console.log("[OnboardingSDK] 📥 API response:",v.status,S);const w=v.ok&&this.evaluateJsonPathCondition(S,l),k=this.extractJsonPath(S,c);let C;w||(C=this.extractJsonPath(S,d)||((b=S.error)==null?void 0:b.message)||S.message||`Request failed with status ${v.status}`),this.sendMetadata({type:"api_execution_result",success:w,status_code:v.status,data:S,result_text:k,error:C,url:f,method:r,timestamp:Date.now()}),console.log(`[OnboardingSDK] ${w?"✅":"❌"} API execution ${w?"succeeded":"failed"}:`,k||C)}catch(y){console.error("[OnboardingSDK] ❌ API execution error:",y),this.sendMetadata({type:"api_execution_result",success:!1,error:y instanceof Error?y.message:"Unknown error",url:f,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(console.log("[OnboardingSDK] ⚡ Received batched navigation request"),!this.batchedActionExecutor){console.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){console.warn("[OnboardingSDK] No steps in batched navigation request");return}this.fastExecutionMode=!0,this._botActionDepth++;try{console.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"),console.log("[OnboardingSDK] 📸 DOM snapshot sent after batched navigation")),i.success?(console.log("[OnboardingSDK] ✅ Batched navigation complete, sending success"),this.sendMetadata({type:"batched_navigation_complete",success:!0,stepCount:r.length,completedSteps:i.completedSteps,timestamp:Date.now()})):(console.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=>{console.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:An(),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:An(),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,console.log("[OnboardingSDK] ⌨️ Text mode enabled — mic muted")):((r=this.pipecatClient)==null||r.enableMic(!0),this.micEnabled=!0,console.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.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,console.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?(console.warn("[OnboardingSDK] Cannot start discovery - not connected"),!1):(console.log("[OnboardingSDK] 🔍 Starting guided discovery mode"),this.pipecatClient.sendClientMessage("start_discovery",{type:"start_discovery",timestamp:Date.now()}),this.hideWelcomePopup(),!0)}skipDiscovery(){console.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
819
|
position: fixed;
|
|
820
820
|
top: 0;
|
|
821
821
|
left: 0;
|
|
@@ -973,5 +973,5 @@ ${e.description||""}`;return confirm(r)}async execute(e){if(e.type==="click"){co
|
|
|
973
973
|
">
|
|
974
974
|
I'll explore on my own
|
|
975
975
|
</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)}),console.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)),console.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&&console.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){console.warn(`[OnboardingSDK] EndUser status check failed: ${c.status}`);return}this.endUserStatus=await c.json(),console.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){console.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 console.log(`[OnboardingSDK] skipOnboardingModal explicitly set to: ${this.config.skipOnboardingModal}`),this.config.skipOnboardingModal;if(((o=this.endUserStatus)==null?void 0:o.isNewUser)===!0)return console.log("[OnboardingSDK] Showing modal: API indicates isNewUser=true"),!1;if((s=this.endUserStatus)!=null&&s.found&&this.endUserStatus.isNewUser===!1)return console.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 console.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",console.log("[OnboardingSDK] Disconnected"),this.emit("disconnected")}}typeof window<"u"&&(window.OnboardingSDK=
|
|
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)}),console.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)),console.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&&console.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){console.warn(`[OnboardingSDK] EndUser status check failed: ${c.status}`);return}this.endUserStatus=await c.json(),console.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){console.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 console.log(`[OnboardingSDK] skipOnboardingModal explicitly set to: ${this.config.skipOnboardingModal}`),this.config.skipOnboardingModal;if(((o=this.endUserStatus)==null?void 0:o.isNewUser)===!0)return console.log("[OnboardingSDK] Showing modal: API indicates isNewUser=true"),!1;if((s=this.endUserStatus)!=null&&s.found&&this.endUserStatus.isNewUser===!1)return console.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 console.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",console.log("[OnboardingSDK] Disconnected"),this.emit("disconnected")}}typeof window<"u"&&(window.OnboardingSDK=by);function Yx(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 wy(t){if(!t.clientKey)throw new Error("[Floe] clientKey is required");const e=Yx(t),n=new by(e);return n.ready=n.init().catch(r=>{throw console.error("[Floe] Initialization failed:",r),r}),n}return typeof window<"u"&&(window.Floe=wy),dn.Floe=wy,Object.defineProperty(dn,Symbol.toStringTag,{value:"Module"}),dn}({});
|
|
977
977
|
//# sourceMappingURL=floe-sdk.iife.js.map
|