@element-hq/element-call-embedded 0.19.2-rc.1 → 0.19.2
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/assets/_sentry-release-injection-file-C4oXeC0H.js +2 -0
- package/dist/assets/{_sentry-release-injection-file-BUU9a5PD.js.map → _sentry-release-injection-file-C4oXeC0H.js.map} +1 -1
- package/dist/assets/{index-Djc6082U.js → index-DzoaVylG.js} +5 -5
- package/dist/assets/{index-Djc6082U.js.map → index-DzoaVylG.js.map} +1 -1
- package/dist/assets/{indexeddb-crypto-store-Bpb_zi4O.js → indexeddb-crypto-store-DDjyMFqS.js} +4 -4
- package/dist/assets/{indexeddb-crypto-store-Bpb_zi4O.js.map → indexeddb-crypto-store-DDjyMFqS.js.map} +1 -1
- package/dist/assets/{matrix-DdWlnjSh.js → matrix-BMlTzVh5.js} +5 -5
- package/dist/assets/{matrix-DdWlnjSh.js.map → matrix-BMlTzVh5.js.map} +1 -1
- package/dist/assets/{pako.esm-xdBZSMA1.js → pako.esm-UZ0EWzai.js} +2 -2
- package/dist/assets/{pako.esm-xdBZSMA1.js.map → pako.esm-UZ0EWzai.js.map} +1 -1
- package/dist/assets/{polyfill-force-BjJnj5Za.js → polyfill-force-CL46JUpA.js} +2 -2
- package/dist/assets/{polyfill-force-BjJnj5Za.js.map → polyfill-force-CL46JUpA.js.map} +1 -1
- package/dist/assets/{polyfill-force-CL7owmpV.js → polyfill-force-Dey3kAQw.js} +2 -2
- package/dist/assets/{polyfill-force-CL7owmpV.js.map → polyfill-force-Dey3kAQw.js.map} +1 -1
- package/dist/assets/{rust-crypto-C0aPoIC0.js → rust-crypto-BB1QAvrJ.js} +2 -2
- package/dist/assets/{rust-crypto-C0aPoIC0.js.map → rust-crypto-BB1QAvrJ.js.map} +1 -1
- package/dist/assets/{spa-D-aVmjgn.js → spa-BW6X0pJ7.js} +2 -2
- package/dist/assets/{spa-D-aVmjgn.js.map → spa-BW6X0pJ7.js.map} +1 -1
- package/dist/assets/{tslib.es6-DQ6HU-p4.js → tslib.es6-Cgt7ctuY.js} +2 -2
- package/dist/assets/{tslib.es6-DQ6HU-p4.js.map → tslib.es6-Cgt7ctuY.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/_sentry-release-injection-file-BUU9a5PD.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./pako.esm-
|
|
2
|
-
try{let e=typeof window<`u`?window:n===void 0?typeof globalThis<`u`?globalThis:typeof self<`u`?self:{}:n,t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`34b1f113-8961-4648-bdef-65d1d96d6fe2`,e._sentryDebugIdIdentifier=`sentry-dbid-34b1f113-8961-4648-bdef-65d1d96d6fe2`)}catch{}import{a as e,n as t,o as n,r,t as i}from"./_sentry-release-injection-file-BUU9a5PD.js";import{$ as a,$n as o,$r as s,$t as c,A as l,An as u,Ar as d,At as f,B as p,Bn as m,Br as h,Bt as g,C as _,Ci as v,Cn as y,Cr as b,D as x,Di as S,Dn as C,Dr as w,E as T,Ei as E,En as D,Er as O,F as k,Fn as A,Fr as j,Ft as M,G as N,Gn as ee,Gr as te,Gt as ne,H as re,Hn as ie,Hr as ae,Ht as oe,I as se,In as ce,Ir as le,It as ue,J as de,Jn as fe,Jr as pe,Jt as P,K as me,Kn as he,Kr as ge,Kt as _e,L as ve,Ln as ye,Lr as be,Lt as xe,M as Se,Mn as Ce,Mr as we,Mt as Te,N as Ee,Nn as De,Nr as Oe,Nt as ke,O as Ae,Oi as F,On as je,Or as Me,P as Ne,Pn as Pe,Pr as Fe,Pt as Ie,Q as Le,Qn as Re,Qr as ze,Qt as Be,R as Ve,Rn as He,Rr as Ue,Rt as We,S as Ge,Si as Ke,Sr as qe,T as Je,Ti as Ye,Tn as Xe,Tr as Ze,U as Qe,Un as $e,Ur as et,Ut as tt,V as nt,Vn as rt,Vr as it,Vt as at,W as ot,Wn as st,Wr as ct,Wt as lt,X as ut,Xn as dt,Xr as ft,Xt as pt,Y as mt,Yn as ht,Yr as gt,Yt as _t,Z as vt,Zn as yt,Zr as bt,Zt as xt,_ as St,_n as Ct,_r as wt,a as Tt,ai as I,an as Et,ar as Dt,at as Ot,b as kt,bi as At,bn as jt,br as Mt,c as Nt,cn as Pt,cr as Ft,ct as It,di as Lt,dn as Rt,dr as zt,ei as Bt,en as Vt,er as Ht,f as Ut,fn as Wt,fr as Gt,ft as Kt,g as qt,gi as Jt,gn as Yt,gr as Xt,h as Zt,hi as Qt,hn as $t,hr as en,i as tn,in as nn,ir as rn,it as an,j as on,jn as sn,jr as cn,jt as ln,k as un,kn as dn,kr as fn,l as pn,li as mn,ln as hn,lr as gn,lt as _n,m as vn,mn as yn,mr as bn,n as xn,ni as Sn,nn as Cn,nr as wn,o as Tn,oi as En,on as Dn,or as On,ot as kn,p as An,pi as jn,pn as Mn,pr as Nn,q as Pn,qn as Fn,qr as In,qt as Ln,r as Rn,ri as zn,rn as Bn,rr as Vn,s as Hn,si as Un,sn as Wn,sr as Gn,st as Kn,t as qn,ti as Jn,tn as Yn,tr as Xn,tt as Zn,u as Qn,un as $n,ur as er,v as tr,vn as nr,vr as rr,w as ir,wi as ar,wn as or,wr as sr,x as cr,xi as lr,xn as ur,xr as dr,y as fr,yi as pr,yn as mr,z as hr,zn as gr,zr as _r,zt as vr}from"./indexeddb-crypto-store-Bpb_zi4O.js";import{c as yr,d as br,f as xr,l as Sr,o as Cr,t as wr,u as Tr}from"./tslib.es6-DQ6HU-p4.js";function Er(e){return typeof e==`string`&&!!e&&e!==`undefined`&&e!==`null`||typeof e==`number`}var Dr=class{constructor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};S(this,`rooms`,{}),S(this,`users`,{}),S(this,`syncToken`,null),S(this,`filters`,new mn(()=>new Map)),S(this,`accountData`,new Map),S(this,`localStorage`,void 0),S(this,`oobMembers`,new Map),S(this,`pendingEvents`,{}),S(this,`clientOptions`,void 0),S(this,`pendingToDeviceBatches`,[]),S(this,`nextToDeviceBatchId`,0),S(this,`createUser`,void 0),S(this,`onRoomMember`,(e,t,n)=>{if(n.membership!==Oe.Invite){var r=this.users[n.userId]||this.createUser?.call(this,n.userId);n.name&&(r.setDisplayName(n.name),n.events.member&&r.setRawDisplayName(n.events.member.getDirectionalContent().displayname)),n.events.member&&n.events.member.getContent().avatar_url&&r.setAvatarUrl(n.events.member.getContent().avatar_url),this.users[r.userId]=r}}),this.localStorage=e.localStorage}getSyncToken(){return this.syncToken}isNewlyCreated(){return Promise.resolve(!0)}setSyncToken(e){this.syncToken=e}storeRoom(e){this.rooms[e.roomId]=e,e.currentState.on(Hn.Members,this.onRoomMember),e.currentState.getMembers().forEach(t=>{this.onRoomMember(null,e.currentState,t)})}setUserCreator(e){this.createUser=e}getRoom(e){return this.rooms[e]||null}getRooms(){return Object.values(this.rooms)}removeRoom(e){this.rooms[e]&&this.rooms[e].currentState.removeListener(Hn.Members,this.onRoomMember),delete this.rooms[e]}getRoomSummaries(){return Object.values(this.rooms).map(function(e){return e.summary})}storeUser(e){this.users[e.userId]=e}getUser(e){return this.users[e]||null}getUsers(){return Object.values(this.users)}scrollback(e,t){return[]}storeEvents(e,t,n,r){}storeFilter(e){!(e!=null&&e.userId)||!(e!=null&&e.filterId)||this.filters.getOrCreate(e.userId).set(e.filterId,e)}getFilter(e,t){return this.filters.get(e)?.get(t)||null}getFilterIdByName(e){if(!this.localStorage)return null;var t=`mxjssdk_memory_filter_`+e;try{var n=this.localStorage.getItem(t);if(Er(n))return n}catch{}return null}setFilterIdByName(e,t){if(this.localStorage){var n=`mxjssdk_memory_filter_`+e;try{Er(t)?this.localStorage.setItem(n,t):this.localStorage.removeItem(n)}catch{}}}storeAccountDataEvents(e){e.forEach(e=>{Object.keys(e.getContent()).length?this.accountData.set(e.getType(),e):this.accountData.delete(e.getType())})}getAccountData(e){return this.accountData.get(e)}setSyncData(e){return Promise.resolve()}wantsSave(){return!1}save(e){return Promise.resolve()}startup(){return Promise.resolve()}getSavedSync(){return Promise.resolve(null)}getSavedSyncToken(){return Promise.resolve(null)}deleteAllData(){return this.rooms={},this.users={},this.syncToken=null,this.filters=new mn(()=>new Map),this.accountData=new Map,Promise.resolve()}getOutOfBandMembers(e){return Promise.resolve(this.oobMembers.get(e)||null)}setOutOfBandMembers(e,t){return this.oobMembers.set(e,t),Promise.resolve()}clearOutOfBandMembers(e){return this.oobMembers.delete(e),Promise.resolve()}getClientOptions(){return Promise.resolve(this.clientOptions)}storeClientOptions(e){return this.clientOptions=Object.assign({},e),Promise.resolve()}getPendingEvents(e){var t=this;return F(function*(){return t.pendingEvents[e]??[]})()}setPendingEvents(e,t){var n=this;return F(function*(){n.pendingEvents[e]=t})()}saveToDeviceBatches(e){for(var t of e)this.pendingToDeviceBatches.push({id:this.nextToDeviceBatchId++,eventType:t.eventType,txnId:t.txnId,batch:t.batch});return Promise.resolve()}getOldestToDeviceBatch(){var e=this;return F(function*(){return e.pendingToDeviceBatches.length===0?null:e.pendingToDeviceBatches[0]})()}removeToDeviceBatch(e){return this.pendingToDeviceBatches=this.pendingToDeviceBatches.filter(t=>t.id!==e),Promise.resolve()}destroy(){return F(function*(){})()}},Or=e(Sn()),kr=function(e){return e.ToWidget=`toWidget`,e.FromWidget=`fromWidget`,e}({});function Ar(e){if(e===kr.ToWidget)return kr.FromWidget;if(e===kr.FromWidget)return kr.ToWidget;throw Error(`Invalid direction`)}var jr=function(e){return e.Prerelease1=`0.0.1`,e.Prerelease2=`0.0.2`,e}({}),Mr=function(e){return e.MSC2762=`org.matrix.msc2762`,e.MSC2762_UPDATE_STATE=`org.matrix.msc2762_update_state`,e.MSC2871=`org.matrix.msc2871`,e.MSC2873=`org.matrix.msc2873`,e.MSC2931=`org.matrix.msc2931`,e.MSC2974=`org.matrix.msc2974`,e.MSC2876=`org.matrix.msc2876`,e.MSC3819=`org.matrix.msc3819`,e.MSC3846=`town.robin.msc3846`,e.MSC3869=`org.matrix.msc3869`,e.MSC3973=`org.matrix.msc3973`,e.MSC4039=`org.matrix.msc4039`,e}({}),Nr=[jr.Prerelease1,jr.Prerelease2,Mr.MSC2762,Mr.MSC2762_UPDATE_STATE,Mr.MSC2871,Mr.MSC2873,Mr.MSC2931,Mr.MSC2974,Mr.MSC2876,Mr.MSC3819,Mr.MSC3846,Mr.MSC3869,Mr.MSC3973,Mr.MSC4039],Pr=class extends Or.EventEmitter{strictOriginCheck=!1;targetOrigin=`*`;timeoutSeconds=10;_ready=!1;_widgetId;outboundRequests=new Map;stopController=new AbortController;get ready(){return this._ready}get widgetId(){return this._widgetId||null}constructor(e,t,n,r){super(),this.sendDirection=e,this.transportWindow=n,this.inboundWindow=r,this._widgetId=t}get nextRequestId(){let e=`widgetapi-${Date.now()}`,t=0,n=e;for(;this.outboundRequests.has(n);)n=`${e}-${t++}`;return this.outboundRequests.set(n,null),n}sendInternal(e){console.log(`[PostmessageTransport] Sending object to ${this.targetOrigin}: `,e),this.transportWindow.postMessage(e,this.targetOrigin)}reply(e,t){return this.sendInternal({...e,response:t})}send(e,t){return this.sendComplete(e,t).then(e=>e.response)}sendComplete(e,t){if(!this.ready||!this.widgetId)return Promise.reject(Error(`Not ready or unknown widget ID`));let n={api:this.sendDirection,widgetId:this.widgetId,requestId:this.nextRequestId,action:e,data:t};return e===Fr.UpdateVisibility&&(n.visible=t.visible),new Promise((e,t)=>{let r=t=>{s(),e(t)},i=e=>{s(),t(e)},a=setTimeout(()=>i(Error(`Request timed out`)),(this.timeoutSeconds||1)*1e3),o=()=>i(Error(`Transport stopped`));this.stopController.signal.addEventListener(`abort`,o);let s=()=>{this.outboundRequests.delete(n.requestId),clearTimeout(a),this.stopController.signal.removeEventListener(`abort`,o)};this.outboundRequests.set(n.requestId,{request:n,resolve:r,reject:i}),this.sendInternal(n)})}start(){this.inboundWindow.addEventListener(`message`,this.handleMessage),this._ready=!0}stop(){this._ready=!1,this.stopController.abort(),this.inboundWindow.removeEventListener(`message`,this.handleMessage)}handleMessage=e=>{if(this.stopController.signal.aborted||!e.data||this.strictOriginCheck&&e.origin!==globalThis.origin)return;let t=e.data;if(!(!t.action||!t.requestId||!t.widgetId))if(t.response){if(t.api!==this.sendDirection)return;this.handleResponse(t)}else{let e=t;if(e.api!==Ar(this.sendDirection))return;this.handleRequest(e)}};handleRequest(e){if(this.widgetId){if(this.widgetId!==e.widgetId)return}else this._widgetId=e.widgetId;this.emit(`message`,new CustomEvent(`message`,{detail:e}))}handleResponse(e){if(e.widgetId!==this.widgetId)return;let t=this.outboundRequests.get(e.requestId);if(t)if(qr(e.response)){let{message:n,...r}=e.response.error;t.reject(new Wr(n,r))}else t.resolve(e)}},Fr=function(e){return e.SupportedApiVersions=`supported_api_versions`,e.Capabilities=`capabilities`,e.NotifyCapabilities=`notify_capabilities`,e.ThemeChange=`theme_change`,e.LanguageChange=`language_change`,e.TakeScreenshot=`screenshot`,e.UpdateVisibility=`visibility`,e.OpenIDCredentials=`openid_credentials`,e.WidgetConfig=`widget_config`,e.CloseModalWidget=`close_modal`,e.ButtonClicked=`button_clicked`,e.SendEvent=`send_event`,e.SendToDevice=`send_to_device`,e.UpdateState=`update_state`,e.UpdateTurnServers=`update_turn_servers`,e}({}),L=function(e){return e.SupportedApiVersions=`supported_api_versions`,e.ContentLoaded=`content_loaded`,e.SendSticker=`m.sticker`,e.UpdateAlwaysOnScreen=`set_always_on_screen`,e.GetOpenIDCredentials=`get_openid`,e.CloseModalWidget=`close_modal`,e.OpenModalWidget=`open_modal`,e.SetModalButtonEnabled=`set_button_enabled`,e.SendEvent=`send_event`,e.SendToDevice=`send_to_device`,e.WatchTurnServers=`watch_turn_servers`,e.UnwatchTurnServers=`unwatch_turn_servers`,e.BeeperReadRoomAccountData=`com.beeper.read_room_account_data`,e.MSC2876ReadEvents=`org.matrix.msc2876.read_events`,e.MSC2931Navigate=`org.matrix.msc2931.navigate`,e.MSC2974RenegotiateCapabilities=`org.matrix.msc2974.request_capabilities`,e.MSC3869ReadRelations=`org.matrix.msc3869.read_relations`,e.MSC3973UserDirectorySearch=`org.matrix.msc3973.user_directory_search`,e.MSC4039GetMediaConfigAction=`org.matrix.msc4039.get_media_config`,e.MSC4039UploadFileAction=`org.matrix.msc4039.upload_file`,e.MSC4039DownloadFileAction=`org.matrix.msc4039.download_file`,e.MSC4157UpdateDelayedEvent=`org.matrix.msc4157.update_delayed_event`,e}({}),Ir=function(e){return e.Allowed=`allowed`,e.Blocked=`blocked`,e.PendingUserConfirmation=`request`,e}({}),Lr=function(e){return e.Custom=`m.custom`,e.JitsiMeet=`m.jitsi`,e.Stickerpicker=`m.stickerpicker`,e}({}),Rr=function(e){return e.Close=`m.close`,e}({}),zr=function(e){return e.Event=`event`,e.State=`state_event`,e.ToDevice=`to_device`,e.RoomAccount=`room_account`,e}({}),Br=function(e){return e.Send=`send`,e.Receive=`receive`,e}({}),Vr=class e{constructor(e,t,n,r,i){this.direction=e,this.eventType=t,this.kind=n,this.keyStr=r,this.raw=i}matchesAsStateEvent(e,t,n){return this.kind!==zr.State||this.direction!==e||this.eventType!==t?!1:this.keyStr===null||this.keyStr===n}matchesAsToDeviceEvent(e,t){return!(this.kind!==zr.ToDevice||this.direction!==e||this.eventType!==t)}matchesAsRoomEvent(e,t,n=null){if(this.kind!==zr.Event||this.direction!==e||this.eventType!==t)return!1;if(this.eventType===`m.room.message`){if(this.keyStr===null||this.keyStr===n)return!0}else return!0;return!1}matchesAsRoomAccountData(e,t){return!(this.kind!==zr.RoomAccount||this.direction!==e||this.eventType!==t)}static forStateEvent(t,n,r){n=n.replace(/#/g,`\\#`),r=r==null?``:`#${r}`;let i=`org.matrix.msc2762.${t}.state_event:${n}${r}`;return e.findEventCapabilities([i])[0]}static forToDeviceEvent(t,n){let r=`org.matrix.msc3819.${t}.to_device:${n}`;return e.findEventCapabilities([r])[0]}static forRoomEvent(t,n){let r=`org.matrix.msc2762.${t}.event:${n}`;return e.findEventCapabilities([r])[0]}static forRoomMessageEvent(t,n){n??=``;let r=`org.matrix.msc2762.${t}.event:m.room.message#${n}`;return e.findEventCapabilities([r])[0]}static forRoomAccountData(t,n){let r=`com.beeper.capabilities.${t}.room_account_data:${n}`;return e.findEventCapabilities([r])[0]}static findEventCapabilities(t){let n=[];for(let r of t){let t=null,i,a=null;if(r.startsWith(`org.matrix.msc2762.send.event:`)?(t=Br.Send,a=zr.Event,i=r.substring(30)):r.startsWith(`org.matrix.msc2762.send.state_event:`)?(t=Br.Send,a=zr.State,i=r.substring(36)):r.startsWith(`org.matrix.msc3819.send.to_device:`)?(t=Br.Send,a=zr.ToDevice,i=r.substring(34)):r.startsWith(`org.matrix.msc2762.receive.event:`)?(t=Br.Receive,a=zr.Event,i=r.substring(33)):r.startsWith(`org.matrix.msc2762.receive.state_event:`)?(t=Br.Receive,a=zr.State,i=r.substring(39)):r.startsWith(`org.matrix.msc3819.receive.to_device:`)?(t=Br.Receive,a=zr.ToDevice,i=r.substring(37)):r.startsWith(`com.beeper.capabilities.receive.room_account_data:`)&&(t=Br.Receive,a=zr.RoomAccount,i=r.substring(50)),t===null||a===null||i===void 0)continue;let o=i.startsWith(`m.room.message#`)||a===zr.State,s=null;if(i.includes(`#`)&&o){let e=i.split(`#`),t=e.findIndex(e=>!e.endsWith(`\\`));i=e.slice(0,t+1).map(e=>e.endsWith(`\\`)?e.substring(0,e.length-1):e).join(`#`),s=e.slice(t+1).join(`#`)}n.push(new e(t,i,a,s,r))}return n}},Hr=function(e){return e.AnyRoom=`*`,e}({}),Ur=function(e){return e.Cancel=`cancel`,e.Restart=`restart`,e.Send=`send`,e}({}),Wr=class extends Error{static{this.prototype.name=this.name}constructor(e,t){super(e),this.data=t}},Gr=class extends Or.EventEmitter{transport;capabilitiesFinished=!1;supportsMSC2974Renegotiate=!1;requestedCapabilities=[];approvedCapabilities;cachedClientVersions;turnServerWatchers=0;constructor(e=null,t=null){if(super(),!globalThis.parent)throw Error(`No parent window. This widget doesn't appear to be embedded properly.`);this.transport=new Pr(kr.FromWidget,e,globalThis.parent,globalThis),this.transport.targetOrigin=t,this.transport.on(`message`,this.handleMessage.bind(this))}hasCapability(e){return Array.isArray(this.approvedCapabilities)?this.approvedCapabilities.includes(e):this.requestedCapabilities.includes(e)}requestCapability(e){if(this.capabilitiesFinished&&!this.supportsMSC2974Renegotiate)throw Error(`Capabilities have already been negotiated`);this.requestedCapabilities.push(e)}requestCapabilities(e){for(let t of e)this.requestCapability(t)}requestCapabilityForRoomTimeline(e){this.requestCapability(`org.matrix.msc2762.timeline:${e}`)}requestCapabilityToSendState(e,t){this.requestCapability(Vr.forStateEvent(Br.Send,e,t).raw)}requestCapabilityToReceiveState(e,t){this.requestCapability(Vr.forStateEvent(Br.Receive,e,t).raw)}requestCapabilityToSendToDevice(e){this.requestCapability(Vr.forToDeviceEvent(Br.Send,e).raw)}requestCapabilityToReceiveToDevice(e){this.requestCapability(Vr.forToDeviceEvent(Br.Receive,e).raw)}requestCapabilityToSendEvent(e){this.requestCapability(Vr.forRoomEvent(Br.Send,e).raw)}requestCapabilityToReceiveEvent(e){this.requestCapability(Vr.forRoomEvent(Br.Receive,e).raw)}requestCapabilityToSendMessage(e){this.requestCapability(Vr.forRoomMessageEvent(Br.Send,e).raw)}requestCapabilityToReceiveMessage(e){this.requestCapability(Vr.forRoomMessageEvent(Br.Receive,e).raw)}requestCapabilityToReceiveRoomAccountData(e){this.requestCapability(Vr.forRoomAccountData(Br.Receive,e).raw)}requestOpenIDConnectToken(){return new Promise((e,t)=>{this.transport.sendComplete(L.GetOpenIDCredentials,{}).then(n=>{let r=n.response;if(r.state===Ir.Allowed)e(r);else if(r.state===Ir.Blocked)t(Error(`User declined to verify their identity`));else if(r.state===Ir.PendingUserConfirmation){let i=a=>{a.preventDefault();let o=a.detail;o.data.original_request_id===n.requestId&&(o.data.state===Ir.Allowed?(e(o.data),this.transport.reply(o,{})):o.data.state===Ir.Blocked?(t(Error(`User declined to verify their identity`)),this.transport.reply(o,{})):(t(Error(`Invalid state on reply: `+r.state)),this.transport.reply(o,{error:{message:`Invalid state`}})),this.off(`action:${Fr.OpenIDCredentials}`,i))};this.on(`action:${Fr.OpenIDCredentials}`,i)}else t(Error(`Invalid state: `+r.state))}).catch(t)})}updateRequestedCapabilities(){return this.transport.send(L.MSC2974RenegotiateCapabilities,{capabilities:this.requestedCapabilities}).then()}sendContentLoaded(){return this.transport.send(L.ContentLoaded,{}).then()}sendSticker(e){return this.transport.send(L.SendSticker,e).then()}setAlwaysOnScreen(e){return this.transport.send(L.UpdateAlwaysOnScreen,{value:e}).then(e=>e.success)}openModalWidget(e,t,n=[],r={},i=Lr.Custom){return this.transport.send(L.OpenModalWidget,{type:i,url:e,name:t,buttons:n,data:r}).then()}closeModalWidget(e={}){return this.transport.send(L.CloseModalWidget,e).then()}sendRoomEvent(e,t,n,r,i,a){return this.sendEvent(e,void 0,t,n,r,i,a)}sendStateEvent(e,t,n,r,i,a){return this.sendEvent(e,t,n,r,i,a)}sendEvent(e,t,n,r,i,a,o){return this.transport.send(L.SendEvent,{type:e,content:n,...t!==void 0&&{state_key:t},...r!==void 0&&{room_id:r},...i!==void 0&&{delay:i},...a!==void 0&&{parent_delay_id:a},...o!==void 0&&{sticky_duration_ms:o}})}cancelScheduledDelayedEvent(e){return this.transport.send(L.MSC4157UpdateDelayedEvent,{delay_id:e,action:Ur.Cancel})}restartScheduledDelayedEvent(e){return this.transport.send(L.MSC4157UpdateDelayedEvent,{delay_id:e,action:Ur.Restart})}sendScheduledDelayedEvent(e){return this.transport.send(L.MSC4157UpdateDelayedEvent,{delay_id:e,action:Ur.Send})}sendToDevice(e,t,n){return this.transport.send(L.SendToDevice,{type:e,encrypted:t,messages:n})}readRoomAccountData(e,t){let n={type:e};return t&&(t.includes(Hr.AnyRoom)?n.room_ids=Hr.AnyRoom:n.room_ids=t),this.transport.send(L.BeeperReadRoomAccountData,n).then(e=>e.events)}readRoomEvents(e,t,n,r,i){let a={type:e,msgtype:n};return t!==void 0&&(a.limit=t),r&&(r.includes(Hr.AnyRoom)?a.room_ids=Hr.AnyRoom:a.room_ids=r),i&&(a.since=i),this.transport.send(L.MSC2876ReadEvents,a).then(e=>e.events)}async readEventRelations(e,t,n,r,i,a,o,s){if(!(await this.getClientVersions()).includes(Mr.MSC3869))throw Error(`The read_relations action is not supported by the client.`);let c={event_id:e,rel_type:n,event_type:r,room_id:t,to:o,from:a,limit:i,direction:s};return this.transport.send(L.MSC3869ReadRelations,c)}readStateEvents(e,t,n,r){let i={type:e,state_key:n===void 0?!0:n};return t!==void 0&&(i.limit=t),r&&(r.includes(Hr.AnyRoom)?i.room_ids=Hr.AnyRoom:i.room_ids=r),this.transport.send(L.MSC2876ReadEvents,i).then(e=>e.events)}setModalButtonEnabled(e,t){if(e===Rr.Close)throw Error(`The close button cannot be disabled`);return this.transport.send(L.SetModalButtonEnabled,{button:e,enabled:t}).then()}navigateTo(e){if(!e||!e.startsWith(`https://matrix.to/#`))throw Error(`Invalid matrix.to URI`);return this.transport.send(L.MSC2931Navigate,{uri:e}).then()}async*getTurnServers(){let e,t=async t=>{t.preventDefault(),e(t.detail.data),this.transport.reply(t.detail,{})};if(this.on(`action:${Fr.UpdateTurnServers}`,t),this.turnServerWatchers===0)try{await this.transport.send(L.WatchTurnServers,{})}catch(e){throw this.off(`action:${Fr.UpdateTurnServers}`,t),e}this.turnServerWatchers++;try{for(;;)yield await new Promise(t=>e=t)}finally{this.off(`action:${Fr.UpdateTurnServers}`,t),this.turnServerWatchers--,this.turnServerWatchers===0&&await this.transport.send(L.UnwatchTurnServers,{})}}async searchUserDirectory(e,t){if(!(await this.getClientVersions()).includes(Mr.MSC3973))throw Error(`The user_directory_search action is not supported by the client.`);let n={search_term:e,limit:t};return this.transport.send(L.MSC3973UserDirectorySearch,n)}async getMediaConfig(){if(!(await this.getClientVersions()).includes(Mr.MSC4039))throw Error(`The get_media_config action is not supported by the client.`);return this.transport.send(L.MSC4039GetMediaConfigAction,{})}async uploadFile(e){if(!(await this.getClientVersions()).includes(Mr.MSC4039))throw Error(`The upload_file action is not supported by the client.`);let t={file:e};return this.transport.send(L.MSC4039UploadFileAction,t)}async downloadFile(e){if(!(await this.getClientVersions()).includes(Mr.MSC4039))throw Error(`The download_file action is not supported by the client.`);let t={content_uri:e};return this.transport.send(L.MSC4039DownloadFileAction,t)}start(){this.transport.start(),this.getClientVersions().then(e=>{e.includes(Mr.MSC2974)&&(this.supportsMSC2974Renegotiate=!0)})}handleMessage(e){let t=new CustomEvent(`action:${e.detail.action}`,{detail:e.detail,cancelable:!0});if(this.emit(`action:${e.detail.action}`,t),!t.defaultPrevented)switch(e.detail.action){case Fr.SupportedApiVersions:return this.replyVersions(e.detail);case Fr.Capabilities:return this.handleCapabilities(e.detail);case Fr.UpdateVisibility:return this.transport.reply(e.detail,{});case Fr.NotifyCapabilities:return this.transport.reply(e.detail,{});default:return this.transport.reply(e.detail,{error:{message:`Unknown or unsupported to-widget action: `+e.detail.action}})}}replyVersions(e){this.transport.reply(e,{supported_versions:Nr})}getClientVersions(){return Array.isArray(this.cachedClientVersions)?Promise.resolve(this.cachedClientVersions):this.transport.send(L.SupportedApiVersions,{}).then(e=>(this.cachedClientVersions=e.supported_versions,e.supported_versions)).catch(e=>(console.warn(`non-fatal error getting supported client versions: `,e),[]))}handleCapabilities(e){return this.capabilitiesFinished?this.transport.reply(e,{error:{message:`Capability negotiation already completed`}}):this.getClientVersions().then(t=>(t.includes(Mr.MSC2871)?this.once(`action:${Fr.NotifyCapabilities}`,e=>{this.approvedCapabilities=e.detail.data.approved,this.emit(`ready`)}):this.emit(`ready`),this.capabilitiesFinished=!0,this.transport.reply(e,{capabilities:this.requestedCapabilities})))}},Kr=function(e){return e.Screenshots=`m.capability.screenshot`,e.StickerSending=`m.sticker`,e.AlwaysOnScreen=`m.always_on_screen`,e.RequiresClient=`io.element.requires_client`,e.MSC2931Navigate=`org.matrix.msc2931.navigate`,e.MSC3846TurnServers=`town.robin.msc3846.turn_servers`,e.MSC3973UserDirectorySearch=`org.matrix.msc3973.user_directory_search`,e.MSC4039UploadFile=`org.matrix.msc4039.upload_file`,e.MSC4039DownloadFile=`org.matrix.msc4039.download_file`,e.MSC4157SendDelayedEvent=`org.matrix.msc4157.send.delayed_event`,e.MSC4157UpdateDelayedEvent=`org.matrix.msc4157.update_delayed_event`,e.MSC4407SendStickyEvent=`org.matrix.msc4407.send.sticky_event`,e.MSC4407ReceiveStickyEvent=`org.matrix.msc4407.receive.sticky_event`,e}({});Kr.StickerSending,Kr.AlwaysOnScreen;function qr(e){let t=e.error;return typeof t==`object`&&!!t&&`message`in t&&typeof t.message==`string`}function Jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Jr(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xr(e){var t,n,r,i=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Zr(t.call(e));n=`@@asyncIterator`,r=`@@iterator`}throw TypeError(`Object is not async iterable`)}function Zr(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return Zr=function(e){this.s=e,this.n=e.next},Zr.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new Zr(e)}var Qr=function(e){return e.PendingEventsChanged=`PendingEvent.pendingEventsChanged`,e}({}),$r=class extends _{constructor(e,t,n,r,i){var a,o;super(r),a=this,this.widgetApi=e,this.capabilities=t,this.roomId=n,S(this,`room`,void 0),S(this,`widgetApiReady`,void 0),S(this,`roomStateSynced`,void 0),S(this,`lifecycle`,void 0),S(this,`syncState`,null),S(this,`pendingSendingEventsTxId`,[]),S(this,`eventEmitter`,new Jn),S(this,`syncApiResolver`,Promise.withResolvers()),S(this,`updateTxId`,function(){var e=F(function*(e){if(e.getSender()===a.getUserId()&&a.pendingSendingEventsTxId.some(t=>e.getType()===t.type)){for(var t=a.pendingSendingEventsTxId.find(t=>t.id===e.getId())?.txId;!t&&a.pendingSendingEventsTxId.length>0;)yield new Promise(e=>a.eventEmitter.once(Qr.PendingEventsChanged,()=>e())),t=a.pendingSendingEventsTxId.find(t=>t.id===e.getId())?.txId;t&&(e.setTxnId(t),e.setUnsigned(Yr(Yr({},e.getUnsigned()),{},{transaction_id:t}))),a.pendingSendingEventsTxId=a.pendingSendingEventsTxId.filter(t=>t.id!==e.getId()),a.pendingSendingEventsTxId.length===0&&a.eventEmitter.emit(Qr.PendingEventsChanged)}});return function(t){return e.apply(this,arguments)}}()),S(this,`onEvent`,function(){var e=F(function*(e){if(e.preventDefault(),e.detail.data.room_id===a.roomId){var t=new pn(e.detail.data);yield a.updateTxId(t),yield a.syncApiResolver.promise,a.syncApi instanceof or?(yield a.supportUpdateState())?yield a.syncApi.injectRoomEvents(a.room,void 0,[],[t]):yield a.syncApi.injectRoomEvents(a.room,[],void 0,[t]):(yield a.supportUpdateState())?yield a.syncApi.injectRoomEvents(a.room,[],[t]):I.error(`slididng sync cannot be used in widget mode if the client widget driver does not support the version: 'org.matrix.msc2762_update_state'`),a.emit(cr.Event,t),t.unstableStickyInfo!==void 0&&a.room._unstable_addStickyEvents([t]),a.setSyncState(Xe.Syncing),I.info(`Received event ${t.getId()} ${t.getType()}`)}else{var{event_id:n,room_id:r}=e.detail.data;I.info(`Received event ${n} for a different room ${r}; discarding`)}yield a.ack(e)});return function(t){return e.apply(this,arguments)}}()),S(this,`onToDevice`,function(){var e=F(function*(e){e.preventDefault();var t=new pn({type:e.detail.data.type,sender:e.detail.data.sender,content:e.detail.data.content});e.detail.data.encrypted&&t.makeEncrypted(j.RoomMessageEncrypted,{},``,``),a.emit(cr.ToDeviceEvent,t),a.setSyncState(Xe.Syncing),yield a.ack(e)});return function(t){return e.apply(this,arguments)}}()),S(this,`onStateUpdate`,function(){var e=F(function*(e){e.preventDefault(),(yield a.supportUpdateState())||I.warn(`received update_state widget action but the widget driver did not claim to support 'org.matrix.msc2762_update_state'`),yield a.syncApiResolver.promise;for(var t of e.detail.data.state)if(t.room_id===a.roomId){var n=new pn(t);a.syncApi instanceof or?yield a.syncApi.injectRoomEvents(a.room,void 0,[n]):yield a.syncApi.injectRoomEvents(a.room,[n]),I.debug(`Updated state entry ${n.getType()} ${n.getStateKey()} to ${n.getId()}`)}else{var{event_id:r,room_id:i}=e.detail.data;I.info(`Received state entry ${r} for a different room ${i}; discarding`)}yield a.ack(e)});return function(t){return e.apply(this,arguments)}}());var s=this.widgetApi.transport.send.bind(this.widgetApi.transport);this.widgetApi.transport.send=function(){var e=F(function*(e,t){try{return yield s(e,t)}catch(e){ei(e)}});return function(t,n){return e.apply(this,arguments)}}();var c=this.widgetApi.transport.sendComplete.bind(this.widgetApi.transport);this.widgetApi.transport.sendComplete=function(){var e=F(function*(e,t){try{return yield c(e,t)}catch(e){ei(e)}});return function(t,n){return e.apply(this,arguments)}}(),this.widgetApiReady=new Promise(e=>this.widgetApi.once(`ready`,e)),this.roomStateSynced=(o=t.receiveState)!=null&&o.length?new Promise(e=>this.widgetApi.once(`action:${Fr.UpdateState}`,e)):Promise.resolve(),this.requestInitialCapabilities(t,n),e.on(`action:${Fr.SendEvent}`,this.onEvent),e.on(`action:${Fr.SendToDevice}`,this.onToDevice),e.on(`action:${Fr.UpdateState}`,this.onStateUpdate),e.start(),i&&e.sendContentLoaded()}requestInitialCapabilities(e,t){var n,r,i,a,o,s,c,l,u,d,f,p;((n=e.sendEvent)!=null&&n.length||(r=e.receiveEvent)!=null&&r.length||e.sendMessage===!0||Array.isArray(e.sendMessage)&&e.sendMessage.length||e.receiveMessage===!0||Array.isArray(e.receiveMessage)&&e.receiveMessage.length||(i=e.sendState)!=null&&i.length||(a=e.receiveState)!=null&&a.length)&&this.widgetApi.requestCapabilityForRoomTimeline(t),(o=e.sendEvent)==null||o.forEach(e=>this.widgetApi.requestCapabilityToSendEvent(e)),(s=e.receiveEvent)==null||s.forEach(e=>this.widgetApi.requestCapabilityToReceiveEvent(e)),e.sendMessage===!0?this.widgetApi.requestCapabilityToSendMessage():Array.isArray(e.sendMessage)&&e.sendMessage.forEach(e=>this.widgetApi.requestCapabilityToSendMessage(e)),e.receiveMessage===!0?this.widgetApi.requestCapabilityToReceiveMessage():Array.isArray(e.receiveMessage)&&e.receiveMessage.forEach(e=>this.widgetApi.requestCapabilityToReceiveMessage(e)),(c=e.sendState)==null||c.forEach(e=>{var{eventType:t,stateKey:n}=e;return this.widgetApi.requestCapabilityToSendState(t,n)}),(l=e.receiveState)==null||l.forEach(e=>{var{eventType:t,stateKey:n}=e;return this.widgetApi.requestCapabilityToReceiveState(t,n)}),(u=e.sendToDevice)==null||u.forEach(e=>this.widgetApi.requestCapabilityToSendToDevice(e)),(d=e.receiveToDevice)==null||d.forEach(e=>this.widgetApi.requestCapabilityToReceiveToDevice(e)),e.sendDelayedEvents&&((f=e.sendEvent)!=null&&f.length||e.sendMessage===!0||Array.isArray(e.sendMessage)&&e.sendMessage.length||(p=e.sendState)!=null&&p.length)&&this.widgetApi.requestCapability(Kr.MSC4157SendDelayedEvent),e.updateDelayedEvents&&this.widgetApi.requestCapability(Kr.MSC4157UpdateDelayedEvent),e.sendSticky&&this.widgetApi.requestCapability(Kr.MSC4407SendStickyEvent),e.receiveSticky&&this.widgetApi.requestCapability(Kr.MSC4407ReceiveStickyEvent),e.turnServers&&this.widgetApi.requestCapability(Kr.MSC3846TurnServers)}supportUpdateState(){var e=this;return F(function*(){return(yield e.widgetApi.getClientVersions()).includes(Mr.MSC2762_UPDATE_STATE)})()}startClient(){var e=arguments,t=this;return F(function*(){var n=e.length>0&&e[0]!==void 0?e[0]:{};t.lifecycle=new AbortController;var r=t.getUserId();r&&t.store.storeUser(new Me(r)),n.slidingSync?t.syncApi=new ke(n.slidingSync,t,n,t.buildSyncApiOptions()):t.syncApi=new or(t,n,t.buildSyncApiOptions()),t.syncApiResolver.resolve(),t.room=t.syncApi.createRoom(t.roomId),t.store.storeRoom(t.room),yield t.widgetApiReady,(yield t.supportUpdateState())?yield t.roomStateSynced:yield Promise.all(t.capabilities.receiveState?.map(function(){var e=F(function*(e){var{eventType:n,stateKey:r}=e,i=(yield t.widgetApi.readStateEvents(n,void 0,r,[t.roomId])).map(e=>new pn(e));t.syncApi instanceof or?yield t.syncApi.injectRoomEvents(t.room,void 0,i):yield t.syncApi.injectRoomEvents(t.room,i),i.forEach(e=>{t.emit(cr.Event,e),I.info(`Backfilled event ${e.getId()} ${e.getType()} ${e.getStateKey()}`)})});return function(t){return e.apply(this,arguments)}}())??[]),n.clientWellKnownPollPeriod!==void 0&&(t.clientWellKnownIntervalID=setInterval(()=>{t.fetchClientWellKnown()},1e3*n.clientWellKnownPollPeriod),t.fetchClientWellKnown()),t.setSyncState(Xe.Syncing),I.info(`Finished initial sync`),t.matrixRTC.start(),t.capabilities.turnServers&&t.watchTurnServers()})()}stopClient(){this.widgetApi.off(`action:${Fr.SendEvent}`,this.onEvent),this.widgetApi.off(`action:${Fr.SendToDevice}`,this.onToDevice),this.widgetApi.off(`action:${Fr.UpdateState}`,this.onStateUpdate),super.stopClient(),this.lifecycle.abort()}joinRoom(e){var t=this;return F(function*(){if(e===t.roomId)return t.room;throw Error(`Unknown room: ${e}`)})()}encryptAndSendEvent(e,t,n,r){var i=this;return F(function*(){var a=r,o;n&<(n)?o=n:a||=n;var s=a?.[`org.matrix.msc4354.sticky_duration_ms`];if(s!==void 0&&typeof s!=`number`)throw Error(`Sticky duration must be a number when defined`);var c=s,l=t.event.redacts?Yr(Yr({},t.getContent()),{},{redacts:t.event.redacts}):t.getContent();if(o){var u=yield i.widgetApi.sendRoomEvent(t.getType(),l,e.roomId,`delay`in o?o.delay:void 0,`parent_delay_id`in o?o.parent_delay_id:void 0,c).catch(ti);return i.validateSendDelayedEventResponse(u)}var d=t.getTxnId();d&&i.pendingSendingEventsTxId.push({type:t.getType(),id:void 0,txId:d});var f;try{f=yield i.widgetApi.sendRoomEvent(t.getType(),l,e.roomId,void 0,void 0,c).catch(ti)}catch(n){throw i.updatePendingEventStatus(e,t,dr.NOT_SENT),n}return e.updatePendingEvent(t,dr.SENT,f.event_id),i.pendingSendingEventsTxId.forEach(e=>{e.txId===d&&(e.id=f.event_id)}),i.eventEmitter.emit(Qr.PendingEventsChanged),{event_id:f.event_id}})()}sendStateEvent(e,t,n){var r=arguments,i=this;return F(function*(){var a=r.length>3&&r[3]!==void 0?r[3]:``,o=yield i.widgetApi.sendStateEvent(t,a,n,e).catch(ti);if(o.event_id===void 0)throw Error(`'event_id' absent from response to an event request`);return{event_id:o.event_id}})()}_unstable_sendDelayedStateEvent(e,t,n,r){var i=arguments,a=this;return F(function*(){var o=i.length>4&&i[4]!==void 0?i[4]:``;if(!(yield a.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`sendDelayedStateEvent`);var s=yield a.widgetApi.sendStateEvent(n,o,r,e,`delay`in t?t.delay:void 0,`parent_delay_id`in t?t.parent_delay_id:void 0).catch(ti);return a.validateSendDelayedEventResponse(s)})()}validateSendDelayedEventResponse(e){if(e.delay_id===void 0)throw Error(`'delay_id' absent from response to a delayed event request`);return{delay_id:e.delay_id}}_unstable_updateDelayedEvent(e,t){var n=this;return F(function*(){if(!(yield n.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`updateDelayedEvent`);var r;switch(t){case tt.Cancel:r=n.widgetApi.cancelScheduledDelayedEvent;break;case tt.Restart:r=n.widgetApi.cancelScheduledDelayedEvent;break;case tt.Send:r=n.widgetApi.sendScheduledDelayedEvent;break}return yield r.call(n.widgetApi,e).catch(ti),{}})()}_unstable_cancelScheduledDelayedEvent(e){var t=this;return F(function*(){if(!(yield t.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`cancelScheduledDelayedEvent`);return yield t.widgetApi.cancelScheduledDelayedEvent(e).catch(ti),{}})()}_unstable_restartScheduledDelayedEvent(e){var t=this;return F(function*(){if(!(yield t.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`restartScheduledDelayedEvent`);return yield t.widgetApi.restartScheduledDelayedEvent(e).catch(ti),{}})()}_unstable_sendScheduledDelayedEvent(e){var t=this;return F(function*(){if(!(yield t.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`sendScheduledDelayedEvent`);return yield t.widgetApi.sendScheduledDelayedEvent(e).catch(ti),{}})()}encryptAndSendToDevice(e,t,n){var r=this;return F(function*(){var i=new mn(()=>new Map);for(var{userId:a,deviceId:o}of t)i.getOrCreate(a).set(o,n);yield r.widgetApi.sendToDevice(e,!0,Jt(i)).catch(ti)})()}sendToDevice(e,t){var n=this;return F(function*(){return yield n.widgetApi.sendToDevice(e,!1,Jt(t)).catch(ti),{}})()}getOpenIdToken(){var e=this;return F(function*(){var t=yield e.widgetApi.requestOpenIDConnectToken().catch(ti);return{access_token:t.access_token,expires_in:t.expires_in,matrix_server_name:t.matrix_server_name,token_type:t.token_type}})()}queueToDevice(e){var t=this;return F(function*(){var{eventType:n,batch:r}=e,i=new mn(()=>new Map);for(var{userId:a,deviceId:o,payload:s}of r)i.getOrCreate(a).set(o,s);yield t.widgetApi.sendToDevice(n,!1,Jt(i)).catch(ti)})()}sendToDeviceViaWidgetApi(e,t,n){var r=this;return F(function*(){yield r.widgetApi.sendToDevice(e,t,Jt(n)).catch(ti)})()}checkTurnServers(){var e=this;return F(function*(){return e.turnServers.length>0})()}getSyncState(){return this.syncState}setSyncState(e){var t=this.syncState;this.syncState=e,this.emit(cr.Sync,e,t)}ack(e){var t=this;return F(function*(){yield t.widgetApi.transport.reply(e.detail,{})})()}watchTurnServers(){var e=this;return F(function*(){var t=e.widgetApi.getTurnServers(),n=()=>{t.return(void 0)};e.lifecycle.signal.addEventListener(`abort`,n);try{var r=!1,i=!1,a;try{for(var o=Xr(t),s;r=!(s=yield o.next()).done;r=!1){var c=s.value;e.turnServers=[{urls:c.uris,username:c.username,credential:c.password}],e.emit(cr.TurnServers,e.turnServers),I.log(`Received TURN server: ${c.uris}`)}}catch(e){i=!0,a=e}finally{try{r&&o.return!=null&&(yield o.return())}finally{if(i)throw a}}}catch(e){I.warn(`Error watching TURN servers`,e)}finally{e.lifecycle.signal.removeEventListener(`abort`,n)}})()}};function ei(e){throw e instanceof Wr&&e.data.matrix_api_error?ee.fromWidgetApiErrorData(e.data.matrix_api_error):e}function ti(e){throw e instanceof Error&&e.message===`Request timed out`?new $e(`widget api timeout`):e}var ni=class{constructor(){S(this,`unthreadedReadReceipts`,new Map),S(this,`threadedReadReceipts`,new mn(()=>new Map))}setUnthreaded(e,t){this.unthreadedReadReceipts.set(e,t)}setThreaded(e,t,n){this.threadedReadReceipts.getOrCreate(e).set(t,n)}allUnthreaded(){return this.unthreadedReadReceipts.entries()}*allThreaded(){for(var e of this.threadedReadReceipts.values())for(var t of e.entries())yield t}consumeEphemeralEvents(e){e?.forEach(e=>{e.type!==j.Receipt||!e.content||Object.keys(e.content).forEach(t=>{Object.entries(e.content[t]).forEach(n=>{var[r,i]=n;if(jn(r))for(var a of Object.keys(i)){var o=e.content[t][r][a],s={data:e.content[t][r][a],type:r,eventId:t};o.thread_id?this.setThreaded(o.thread_id,a,s):this.setUnthreaded(a,s)}})})})}buildAccumulatedReceiptEvent(e){var t={type:j.Receipt,room_id:e,content:{}},n=new mn(()=>new mn(()=>new Map));for(var[r,i]of this.allUnthreaded())n.getOrCreate(i.eventId).getOrCreate(i.type).set(r,i.data);for(var[a,o]of this.allThreaded())n.getOrCreate(o.eventId).getOrCreate(o.type).set(a,o.data);return t.content=Jt(n),n.size>0?t:null}},ri=function(e){return e.Invite=`invite`,e.Leave=`leave`,e.Join=`join`,e.Knock=`knock`,e}({});function ii(e){return`_localTs`in e&&e._localTs!==void 0}var ai=class{constructor(){this.opts=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},S(this,`accountData`,{}),S(this,`inviteRooms`,{}),S(this,`knockRooms`,{}),S(this,`joinRooms`,{}),S(this,`nextBatch`,null),this.opts.maxTimelineEntries=this.opts.maxTimelineEntries||50}accumulate(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.accumulateRooms(e,t),this.accumulateAccountData(e),this.nextBatch=e.next_batch}accumulateAccountData(e){!e.account_data||!e.account_data.events||e.account_data.events.forEach(e=>{this.accountData[e.type]=e})}accumulateRooms(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e.rooms&&(e.rooms.invite&&Object.keys(e.rooms.invite).forEach(n=>{this.accumulateRoom(n,ri.Invite,e.rooms.invite[n],t)}),e.rooms.join&&Object.keys(e.rooms.join).forEach(n=>{this.accumulateRoom(n,ri.Join,e.rooms.join[n],t)}),e.rooms.leave&&Object.keys(e.rooms.leave).forEach(n=>{this.accumulateRoom(n,ri.Leave,e.rooms.leave[n],t)}),e.rooms.knock&&Object.keys(e.rooms.knock).forEach(n=>{this.accumulateRoom(n,ri.Knock,e.rooms.knock[n],t)}))}accumulateRoom(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;switch(t){case ri.Invite:this.knockRooms[e]&&delete this.knockRooms[e],this.accumulateInviteState(e,n);break;case ri.Knock:this.accumulateKnockState(e,n);break;case ri.Join:this.knockRooms[e]?delete this.knockRooms[e]:this.inviteRooms[e]&&delete this.inviteRooms[e],this.accumulateJoinState(e,n,r);break;case ri.Leave:this.knockRooms[e]?delete this.knockRooms[e]:this.inviteRooms[e]?delete this.inviteRooms[e]:delete this.joinRooms[e];break;default:I.error(`Unknown cateogory: `,t)}}accumulateInviteState(e,t){if(!(!t.invite_state||!t.invite_state.events)){if(!this.inviteRooms[e]){this.inviteRooms[e]={invite_state:t.invite_state};return}var n=this.inviteRooms[e];t.invite_state.events.forEach(e=>{for(var t=!1,r=0;r<n.invite_state.events.length;r++){var i=n.invite_state.events[r];i.type===e.type&&i.state_key==e.state_key&&(n.invite_state.events[r]=e,t=!0)}t||n.invite_state.events.push(e)})}}accumulateKnockState(e,t){if(!(!t.knock_state||!t.knock_state.events)){if(!this.knockRooms[e]){this.knockRooms[e]={knock_state:t.knock_state};return}var n=this.knockRooms[e];t.knock_state.events.forEach(e=>{for(var t=!1,r=0;r<n.knock_state.events.length;r++){var i=n.knock_state.events[r];i.type===e.type&&i.state_key==e.state_key&&(n.knock_state.events[r]=e,t=!0)}t||n.knock_state.events.push(e)})}}accumulateJoinState(e,t){var n,r,i,a,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=Date.now();this.joinRooms[e]||(this.joinRooms[e]={_currentState:Object.create(null),_timeline:[],_accountData:Object.create(null),_unreadNotifications:{},_unreadThreadNotifications:{},_summary:{},_receipts:new ni,_stickyEvents:[]});var c=this.joinRooms[e];if(t.account_data&&t.account_data.events&&t.account_data.events.forEach(e=>{c._accountData[e.type]=e}),t.unread_notifications&&(c._unreadNotifications=t.unread_notifications),c._unreadThreadNotifications=t[rr.stable]??t[rr.unstable]??void 0,t.summary){var l=`m.heroes`,u=`m.invited_member_count`,d=`m.joined_member_count`,f=c._summary,p=t.summary;f[l]=p[l]??f[l],f[d]=p[d]??f[d],f[u]=p[u]??f[u]}if(c._receipts.consumeEphemeralEvents(t.ephemeral?.events),t.timeline&&t.timeline.limited&&(c._timeline=[]),(n=t.state)==null||(n=n.events)==null||n.forEach(e=>{oi(c._currentState,e)}),(r=t[`org.matrix.msc4222.state_after`])==null||(r=r.events)==null||r.forEach(e=>{oi(c._currentState,e)}),(i=t.timeline)==null||(i=i.events)==null||i.forEach((e,n)=>{t[`org.matrix.msc4222.state_after`]||oi(c._currentState,e);var r;if(o)r=e;else{r=Object.assign({},e),r.unsigned!==void 0&&(r.unsigned=Object.assign({},r.unsigned));var i=e.unsigned?.age;i!==void 0&&(r._localTs=Date.now()-i)}c._timeline.push({event:r,token:n===0?t.timeline.prev_batch??null:null})}),c._stickyEvents=c._stickyEvents.filter(e=>{var{expiresTs:t}=e;return t>s}),(a=t.msc4354_sticky)!=null&&a.events&&(c._stickyEvents=c._stickyEvents.concat(t.msc4354_sticky.events.map(e=>({event:e,expiresTs:Math.min(e.msc4354_sticky.duration_ms,Nt)+Math.min(e.origin_server_ts,s)})))),c._timeline.length>this.opts.maxTimelineEntries){for(var m=c._timeline.length-this.opts.maxTimelineEntries;m<c._timeline.length;m++)if(c._timeline[m].token){c._timeline=c._timeline.slice(m,c._timeline.length);break}}}getJSON(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t={join:{},invite:{},knock:{},leave:{}};Object.keys(this.inviteRooms).forEach(e=>{t.invite[e]=this.inviteRooms[e]}),Object.keys(this.knockRooms).forEach(e=>{t.knock[e]=this.knockRooms[e]}),Object.keys(this.joinRooms).forEach(n=>{var r,i=this.joinRooms[n],a={ephemeral:{events:[]},account_data:{events:[]},state:{events:[]},"org.matrix.msc4222.state_after":{events:[]},timeline:{events:[],prev_batch:null},unread_notifications:i._unreadNotifications,unread_thread_notifications:i._unreadThreadNotifications,summary:i._summary,msc4354_sticky:(r=i._stickyEvents)!=null&&r.length?{events:i._stickyEvents.map(e=>e.event)}:void 0};Object.keys(i._accountData).forEach(e=>{a.account_data.events.push(i._accountData[e])});var o=i._receipts.buildAccumulatedReceiptEvent(n);o&&a.ephemeral.events.push(o),i._timeline.forEach(t=>{if(!a.timeline.prev_batch){if(!t.token)return;a.timeline.prev_batch=t.token}var n;!e&&ii(t.event)?(n=Object.assign({},t.event),n.unsigned!==void 0&&(n.unsigned=Object.assign({},n.unsigned)),delete n._localTs,n.unsigned=n.unsigned||{},n.unsigned.age=Date.now()-t.event._localTs):n=t.event,a.timeline.events.push(n)});for(var s=Object.create(null),c=a.timeline.events.length-1;c>=0;c--){var l=a.timeline.events[c];if(!(l.state_key===null||l.state_key===void 0)){var u=Lt(l);u.unsigned&&(u.unsigned.prev_content&&(u.content=u.unsigned.prev_content),u.unsigned.prev_sender&&(u.sender=u.unsigned.prev_sender)),oi(s,u)}}Object.keys(i._currentState).forEach(e=>{Object.keys(i._currentState[e]).forEach(t=>{var n=i._currentState[e][t];a[`org.matrix.msc4222.state_after`].events.push(n),s[e]&&s[e][t]&&(n=s[e][t]),a.state.events.push(n)})}),t.join[n]=a});var n=[];return Object.keys(this.accountData).forEach(e=>{n.push(this.accountData[e])}),{nextBatch:this.nextBatch,roomsData:t,accountData:n}}getNextBatchToken(){return this.nextBatch}};function oi(e,t){t.state_key===null||t.state_key===void 0||!t.type||(e[t.type]||(e[t.type]=Object.create(null)),e[t.type][t.state_key]=t)}var si=10,ci=class{constructor(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.client=e,this.timelineSet=t,S(this,`windowLimit`,void 0),S(this,`start`,void 0),S(this,`end`,void 0),S(this,`eventCount`,0),this.windowLimit=r.windowLimit||1e3,(n=t.room)==null||n.on(je.Timeline,this.onTimelineEvent.bind(this))}load(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,n=n=>{if(!n)throw Error(`No timeline given to initFields`);var r,i=n.getEvents();if(!e)r=i.length;else if(r=i.findIndex(t=>t.getId()===e),r<0)throw Error(`getEventTimeline result didn't include requested event`);var a=Math.min(i.length,r+Math.ceil(t/2)),o=Math.max(0,a-t);this.start=new li(n,o-n.getBaseIndex()),this.end=new li(n,a-n.getBaseIndex()),this.eventCount=a-o};return this.timelineSet.getTimelineForEvent(e)?(n(this.timelineSet.getTimelineForEvent(e)),Promise.resolve()):e?this.client.getEventTimeline(this.timelineSet,e).then(n):(n(this.timelineSet.getLiveTimeline()),Promise.resolve())}getTimelineIndex(e){if(e==w.BACKWARDS)return this.start??null;if(e==w.FORWARDS)return this.end??null;throw Error(`Invalid direction '`+e+`'`)}extend(e,t){var n=this.getTimelineIndex(e);if(!n)return!1;var r=e==w.BACKWARDS?n.retreat(t):n.advance(t);if(r){this.eventCount+=r,``+r+this.eventCount;var i=this.eventCount-this.windowLimit;return i>0&&this.unpaginate(i,e!=w.BACKWARDS),!0}return!1}onTimelineEvent(e,t,n,r){r&&this.onEventRemoved()}onEventRemoved(){var e=this.getEvents();e.length>0&&e[e.length-1]===void 0&&this.end&&this.end.index--}canPaginate(e){var t=this.getTimelineIndex(e);if(!t)return!1;if(e==w.BACKWARDS){if(t.index>t.minIndex())return!0}else if(t.index<t.maxIndex())return!0;var n=t.timeline.getNeighbouringTimeline(e),r=t.timeline.getPaginationToken(e);return!!n||!!r}paginate(e,t){var n=arguments,r=this;return F(function*(){var i=n.length>2&&n[2]!==void 0?n[2]:!0,a=n.length>3&&n[3]!==void 0?n[3]:si,o=r.getTimelineIndex(e);if(!o)return!1;if(o.pendingPaginate)return o.pendingPaginate;if(r.extend(e,t))return!0;if(!i||a===0||!o.timeline.getPaginationToken(e))return!1;var s=r.client.paginateEventTimeline(o.timeline,{backwards:e==w.BACKWARDS,limit:t}).finally(function(){o.pendingPaginate=void 0}).then(n=>(``+n,n?r.paginate(e,t,!0,a-1):r.paginate(e,t,!1,0)));return o.pendingPaginate=s,s})()}unpaginate(e,t){var n=t?this.start:this.end;if(!n)throw Error(`Attempting to unpaginate startOfTimeline=${t} but don't have this direction`);if(e>this.eventCount||e<0)throw Error(`Attemting to unpaginate ${e} events, but only have ${this.eventCount} in the timeline`);for(;e>0;){var r=t?n.advance(e):n.retreat(e);if(r<=0)throw Error(`Unable to unpaginate any further, but still have `+this.eventCount+` events`);e-=r,this.eventCount-=r,``+r+this.eventCount}}getEvents(){if(!this.start)return[];for(var e=[],t=this.start.timeline;t;){var n=t.getEvents(),r=0,i=n.length;t===this.start.timeline&&(r=this.start.index+t.getBaseIndex()),t===this.end?.timeline&&(i=this.end.index+t.getBaseIndex());for(var a=r;a<i;a++)e.push(n[a]);if(t===this.end?.timeline)break;t=t.getNeighbouringTimeline(w.FORWARDS)}return e}},li=class{constructor(e,t){this.timeline=e,this.index=t,S(this,`pendingPaginate`,void 0)}minIndex(){return this.timeline.getBaseIndex()*-1}maxIndex(){return this.timeline.getEvents().length-this.timeline.getBaseIndex()}advance(e){if(!e)return 0;var t;if(e<0){if(t=Math.max(e,this.minIndex()-this.index),t<0)return this.index+=t,t}else if(t=Math.min(e,this.maxIndex()-this.index),t>0)return this.index+=t,t;var n=this.timeline.getNeighbouringTimeline(e<0?w.BACKWARDS:w.FORWARDS);return n?(this.timeline=n,e<0?this.index=this.maxIndex():this.index=this.minIndex(),this.advance(e)):0}retreat(e){return this.advance(e*-1)*-1}},ui=`m.login.email.identity`,di=`m.login.msisdn`,fi=function(e){return e.Password=`m.login.password`,e.Recaptcha=`m.login.recaptcha`,e.Terms=`m.login.terms`,e.Email=`m.login.email.identity`,e.Msisdn=`m.login.msisdn`,e.Sso=`m.login.sso`,e.SsoUnstable=`org.matrix.login.sso`,e.Dummy=`m.login.dummy`,e.RegistrationToken=`m.login.registration_token`,e.UnstableRegistrationToken=`org.matrix.msc3231.login.registration_token`,e.OAuth=`m.oauth`,e}({}),pi=class extends Error{constructor(e,t,n){super(e),this.required_stages=t,this.flows=n,S(this,`name`,`NoAuthFlowFoundError`)}},mi=class{constructor(e){var t=this;S(this,`matrixClient`,void 0),S(this,`inputs`,void 0),S(this,`clientSecret`,void 0),S(this,`requestCallback`,void 0),S(this,`busyChangedCallback`,void 0),S(this,`stateUpdatedCallback`,void 0),S(this,`requestEmailTokenCallback`,void 0),S(this,`supportedStages`,void 0),S(this,`data`,void 0),S(this,`emailSid`,void 0),S(this,`requestingEmailToken`,!1),S(this,`attemptAuthDeferred`,null),S(this,`chosenFlow`,null),S(this,`currentStage`,null),S(this,`emailAttempt`,1),S(this,`submitPromise`,null),S(this,`requestEmailToken`,F(function*(){if(t.requestingEmailToken)I.warn(`Could not request email token: Already requesting`);else{I.trace(`Requesting email token. Attempt: `+t.emailAttempt),t.requestingEmailToken=!0;try{t.emailSid=(yield t.requestEmailTokenCallback(t.inputs.emailAddress,t.clientSecret,t.emailAttempt++,t.data.session)).sid,I.trace(`Email token request succeeded`)}finally{t.requestingEmailToken=!1}}})),this.matrixClient=e.matrixClient,this.data=e.authData||{flows:[]},this.requestCallback=e.doRequest,this.busyChangedCallback=e.busyChanged,this.stateUpdatedCallback=e.stateUpdated||e.startAuthStage,this.requestEmailTokenCallback=e.requestEmailToken,this.inputs=e.inputs||{},e.sessionId&&(this.data.session=e.sessionId),this.clientSecret=e.clientSecret||this.matrixClient.generateClientSecret(),this.emailSid=e.emailSid,e.supportedStages!==void 0&&(this.supportedStages=new Set(e.supportedStages))}attemptAuth(){var e=this;return F(function*(){var t;e.attemptAuthDeferred=Promise.withResolvers();var n=e.attemptAuthDeferred.promise;if((t=e.data)!=null&&(t=t.flows)!=null&&t.length)e.startNextAuthStage();else{var r;(r=e.busyChangedCallback)==null||r.call(e,!0);var i=e.data.session?{session:e.data.session}:null;e.doRequest(i).finally(()=>{var t;(t=e.busyChangedCallback)==null||t.call(e,!1)})}return n})()}poll(){var e=this;return F(function*(){if(e.data.session&&e.attemptAuthDeferred&&!e.submitPromise){var t={};if(e.currentStage==ui&&e.emailSid){var n={sid:e.emailSid,client_secret:e.clientSecret},r=e.matrixClient.getIdentityServerUrl();r&&(n.id_server=new URL(r).host),t={type:ui,threepid_creds:n}}e.submitAuthDict(t,!0)}})()}getSessionId(){return this.data?.session}getClientSecret(){return this.clientSecret}getStageParams(e){var t;return(t=this.data)==null||(t=t.params)==null?void 0:t[e]}getChosenFlow(){return this.chosenFlow}submitAuthDict(e){var t=arguments,n=this;return F(function*(){var r,i=t.length>1&&t[1]!==void 0?t[1]:!1;if(!n.attemptAuthDeferred)throw Error(`submitAuthDict() called before attemptAuth()`);if(!i){var a;(a=n.busyChangedCallback)==null||a.call(n,!0)}for(;n.submitPromise;)try{yield n.submitPromise}catch{}var o=(r=n.data)!=null&&r.session?Object.assign({session:n.data.session},e):e;try{n.submitPromise=n.doRequest(o,i),yield n.submitPromise}finally{if(n.submitPromise=null,!i){var s;(s=n.busyChangedCallback)==null||s.call(n,!1)}}})()}getEmailSid(){return this.emailSid}setEmailSid(e){this.emailSid=e}doRequest(e){var t=arguments,n=this;return F(function*(){var r=t.length>1&&t[1]!==void 0?t[1]:!1;try{var i=yield n.requestCallback(e,r);n.attemptAuthDeferred.resolve(i),n.attemptAuthDeferred=null}catch(e){var a,o,s=e instanceof ee?e:null,c=(s==null||(a=s.data)==null?void 0:a.flows)??null,l=n.data?.flows||!!c;if(!s||s.httpStatus!==401||!s.data||!l)if(r)I.log(`Background poll request failed doing UI auth: ignoring`,e);else{var u;(u=n.attemptAuthDeferred)==null||u.reject(e)}s&&!s.data&&(s.data={}),s&&!s.data.flows&&!s.data.completed&&!s.data.session&&(s.data.flows=n.data.flows,s.data.completed=n.data.completed,s.data.session=n.data.session),s&&(n.data=s.data);try{n.startNextAuthStage()}catch(e){n.attemptAuthDeferred.reject(e),n.attemptAuthDeferred=null;return}if(!n.emailSid&&(o=n.chosenFlow)!=null&&o.stages.includes(fi.Email))try{yield n.requestEmailToken()}catch(e){n.attemptAuthDeferred.reject(e),n.attemptAuthDeferred=null}}})()}startNextAuthStage(){var e,t,n=this.chooseStage();if(!n)throw Error(`No incomplete flows from the server`);if(this.currentStage=n,n===fi.Dummy){this.submitAuthDict({type:`m.login.dummy`});return}if((e=this.data)!=null&&e.errcode||(t=this.data)!=null&&t.error){this.stateUpdatedCallback(n,{errcode:this.data?.errcode||``,error:this.data?.error||``});return}this.stateUpdatedCallback(n,n===ui?{emailSid:this.emailSid}:{})}chooseStage(){this.chosenFlow===null&&(this.chosenFlow=this.chooseFlow()),I.log(`Active flow => %s`,JSON.stringify(this.chosenFlow));var e=this.firstUncompletedStage(this.chosenFlow);return I.log(`Next stage: %s`,e),e}scoreFlow(e){var t=e.stages.length;return this.supportedStages!==void 0&&(t+=e.stages.filter(e=>!this.supportedStages.has(e)).length*10),t}chooseFlow(){var e=this.data?.flows||[],t=!!this.inputs.emailAddress||!!this.emailSid,n=!!this.inputs.phoneCountry&&!!this.inputs.phoneNumber;e.sort((e,t)=>this.scoreFlow(e)-this.scoreFlow(t));for(var r of e){var i=!1,a=!1;for(var o of r.stages)o===ui?i=!0:o==di&&(a=!0);if(i==t&&a==n)return r}var s=[];throw t&&s.push(ui),n&&s.push(di),new pi(`No appropriate authentication flow found`,s,e)}firstUncompletedStage(e){var t=this.data?.completed||[];return e.stages.find(e=>!t.includes(e))}},hi=[e=>{e.createObjectStore(`users`,{keyPath:[`userId`]}),e.createObjectStore(`accountData`,{keyPath:[`type`]}),e.createObjectStore(`sync`,{keyPath:[`clobber`]})},e=>{e.createObjectStore(`oob_membership_events`,{keyPath:[`room_id`,`state_key`]}).createIndex(`room`,`room_id`)},e=>{e.createObjectStore(`client_options`,{keyPath:[`clobber`]})},e=>{e.createObjectStore(`to_device_queue`,{autoIncrement:!0})}],gi=hi.length;function _i(e,t,n){var r=e.openCursor(t);return new Promise((t,i)=>{var a=[];r.onerror=()=>{i(Error(`selectQuery failed for ${e.name}`,{cause:r.error}))},r.onsuccess=()=>{var e=r.result;if(!e){t(a);return}a.push(n(e)),e.continue()}})}function vi(e){return new Promise((t,n)=>{e.oncomplete=function(e){t(e)},e.onerror=function(){n(e.error)}})}function yi(e){return new Promise((t,n)=>{e.onsuccess=function(e){t(e)},e.onerror=function(){n(e.error)}})}function bi(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e),e.onerror=e=>n(e)})}function xi(e){return yi(e).then(t=>e.result)}var Si=class{static exists(e,t){return t=`matrix-js-sdk:`+(t||`default`),Rn(e,t)}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`default`;this.indexedDB=e,S(this,`dbName`,void 0),S(this,`syncAccumulator`,void 0),S(this,`db`,void 0),S(this,`disconnected`,!0),S(this,`_isNewlyCreated`,!1),S(this,`syncToDatabasePromise`,void 0),S(this,`pendingUserPresenceData`,[]),this.dbName=`matrix-js-sdk:`+t,this.syncAccumulator=new ai}connect(e){var t=this;if(!this.disconnected)return I.log(`LocalIndexedDBStoreBackend.connect: already connected or connecting`),Promise.resolve();this.disconnected=!1,I.log(`LocalIndexedDBStoreBackend.connect: connecting...`);var n=this.indexedDB.open(this.dbName,gi);return n.onupgradeneeded=e=>{var t=n.result,r=e.oldVersion;I.log(`LocalIndexedDBStoreBackend.connect: upgrading from ${r}`),r<1&&(this._isNewlyCreated=!0),hi.forEach((e,n)=>{r<=n&&e(t)})},n.onblocked=()=>{I.log(`can't yet open LocalIndexedDBStoreBackend because it is open elsewhere`)},I.log(`LocalIndexedDBStoreBackend.connect: awaiting connection...`),yi(n).then(F(function*(){I.log(`LocalIndexedDBStoreBackend.connect: connected`),t.db=n.result,t.db.onversionchange=()=>{var e;(e=t.db)==null||e.close(),t.disconnected=!0,t.db=void 0},t.db.onclose=()=>{t.disconnected=!0,t.db=void 0,e?.()},yield t.init()}))}isNewlyCreated(){return Promise.resolve(this._isNewlyCreated)}init(){return Promise.all([this.loadAccountData(),this.loadSyncData()]).then(e=>{var[t,n]=e;I.log(`LocalIndexedDBStoreBackend: loaded initial data`),this.syncAccumulator.accumulate({next_batch:n.nextBatch,rooms:n.roomsData,account_data:{events:t}},!0)})}getOutOfBandMembers(e){return new Promise((t,n)=>{var r=this.db.transaction([`oob_membership_events`],`readonly`).objectStore(`oob_membership_events`).index(`room`),i=IDBKeyRange.only(e),a=r.openCursor(i),o=[],s=!1;a.onsuccess=()=>{var e=a.result;if(!e)return!o.length&&!s?t(null):t(o);var n=e.value;n.oob_written?s=!0:o.push(n),e.continue()},a.onerror=e=>{n(e)}}).then(t=>(I.log(`LL: got ${t?.length} membershipEvents from storage for room ${e} ...`),t))}setOutOfBandMembers(e,t){var n=this;return F(function*(){I.log(`LL: backend about to store ${t.length} members for ${e}`);var r=n.db.transaction([`oob_membership_events`],`readwrite`),i=r.objectStore(`oob_membership_events`);t.forEach(e=>{i.put(e)});var a={room_id:e,oob_written:!0,state_key:0};i.put(a),yield vi(r),I.log(`LL: backend done storing for ${e}!`)})()}clearOutOfBandMembers(e){var t=this;return F(function*(){var n=t.db.transaction([`oob_membership_events`],`readonly`).objectStore(`oob_membership_events`).index(`room`),r=IDBKeyRange.only(e),i=xi(n.openKeyCursor(r,`next`)).then(e=>(e?.primaryKey)[1]),a=xi(n.openKeyCursor(r,`prev`)).then(e=>(e?.primaryKey)[1]),[o,s]=yield Promise.all([i,a]),c=t.db.transaction([`oob_membership_events`],`readwrite`).objectStore(`oob_membership_events`),l=IDBKeyRange.bound([e,o],[e,s]);I.log(`LL: Deleting all users + marker in storage for room ${e}, with key range:`,[e,o],[e,s]),yield bi(c.delete(l))})()}clearDatabase(){return new Promise(e=>{var t;I.log(`Removing indexeddb instance: ${this.dbName}`),(t=this.db)==null||t.close();var n=this.indexedDB.deleteDatabase(this.dbName);n.onblocked=()=>{I.log(`can't yet delete indexeddb ${this.dbName} because it is open elsewhere`)},n.onerror=()=>{I.warn(`unable to delete js-sdk store indexeddb: ${n.error?.name}`),e()},n.onsuccess=()=>{I.log(`Removed indexeddb instance: ${this.dbName}`),e()}})}getSavedSync(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=this.syncAccumulator.getJSON();return t.nextBatch?e?Promise.resolve(Lt(t)):Promise.resolve(t):Promise.resolve(null)}getNextBatchToken(){return Promise.resolve(this.syncAccumulator.getNextBatchToken())}setSyncData(e){return Promise.resolve().then(()=>{this.syncAccumulator.accumulate(e)})}syncToDatabase(e){var t=this;return F(function*(){return t.syncToDatabasePromise?(I.warn(`Skipping syncToDatabase() as persist already in flight`),t.pendingUserPresenceData.push(...e),t.syncToDatabasePromise):(e.unshift(...t.pendingUserPresenceData),t.syncToDatabasePromise=t.doSyncToDatabase(e),t.syncToDatabasePromise)})()}doSyncToDatabase(e){var t=this;return F(function*(){try{var n=t.syncAccumulator.getJSON(!0);yield Promise.all([t.persistUserPresenceEvents(e),t.persistAccountData(n.accountData),t.persistSyncData(n.nextBatch,n.roomsData)])}finally{t.syncToDatabasePromise=void 0}})()}persistSyncData(e,t){return I.log(`Persisting sync data up to`,e),Qt(()=>{var n=this.db.transaction([`sync`],`readwrite`);return n.objectStore(`sync`).put({clobber:`-`,nextBatch:e,roomsData:t}),vi(n).then(()=>{I.log(`Persisted sync data up to`,e)})})}persistAccountData(e){return Qt(()=>{var t=this.db.transaction([`accountData`],`readwrite`),n=t.objectStore(`accountData`);for(var r of e)n.put(r);return vi(t).then()})}persistUserPresenceEvents(e){return Qt(()=>{var t=this.db.transaction([`users`],`readwrite`),n=t.objectStore(`users`);for(var r of e)n.put({userId:r[0],event:r[1]});return vi(t).then()})}getUserPresenceEvents(){return Qt(()=>_i(this.db.transaction([`users`],`readonly`).objectStore(`users`),void 0,e=>[e.value.userId,e.value.event]))}loadAccountData(){return I.log(`LocalIndexedDBStoreBackend: loading account data...`),Qt(()=>_i(this.db.transaction([`accountData`],`readonly`).objectStore(`accountData`),void 0,e=>e.value).then(e=>(I.log(`LocalIndexedDBStoreBackend: loaded account data`),e)))}loadSyncData(){return I.log(`LocalIndexedDBStoreBackend: loading sync data...`),Qt(()=>_i(this.db.transaction([`sync`],`readonly`).objectStore(`sync`),void 0,e=>e.value).then(e=>(I.log(`LocalIndexedDBStoreBackend: loaded sync data`),e.length>1&&I.warn(`loadSyncData: More than 1 sync row found.`),e.length>0?e[0]:{})))}getClientOptions(){return Promise.resolve().then(()=>_i(this.db.transaction([`client_options`],`readonly`).objectStore(`client_options`),void 0,e=>e.value?.options).then(e=>e[0]))}storeClientOptions(e){var t=this;return F(function*(){var n=t.db.transaction([`client_options`],`readwrite`);n.objectStore(`client_options`).put({clobber:`-`,options:e}),yield vi(n)})()}saveToDeviceBatches(e){var t=this;return F(function*(){var n=t.db.transaction([`to_device_queue`],`readwrite`),r=n.objectStore(`to_device_queue`);for(var i of e)r.add(i);yield vi(n)})()}getOldestToDeviceBatch(){var e=this;return F(function*(){var t=yield xi(e.db.transaction([`to_device_queue`],`readonly`).objectStore(`to_device_queue`).openCursor());if(!t)return null;var n=t.value;return{id:t.key,txnId:n.txnId,eventType:n.eventType,batch:n.batch}})()}removeToDeviceBatch(e){var t=this;return F(function*(){var n=t.db.transaction([`to_device_queue`],`readwrite`);n.objectStore(`to_device_queue`).delete(e),yield vi(n)})()}destroy(){var e=this;return F(function*(){var t;(t=e.db)==null||t.close()})()}},Ci=class{constructor(e,t){this.workerFactory=e,this.dbName=t,S(this,`worker`,void 0),S(this,`nextSeq`,0),S(this,`inFlight`,{}),S(this,`startPromise`,void 0),S(this,`onWorkerMessage`,e=>{var t=e.data;if(t.command==`closed`){var n;(n=this.onClose)==null||n.call(this)}else if(t.command==`cmd_success`||t.command==`cmd_fail`){if(t.seq===void 0){I.error(`Got reply from worker with no seq`);return}var r=this.inFlight[t.seq];if(r===void 0){I.error(`Got reply for unknown seq `+t.seq);return}if(delete this.inFlight[t.seq],t.command==`cmd_success`)r.resolve(t.result);else{var i=Error(t.error.message);i.name=t.error.name,r.reject(i)}}else I.warn(`Unrecognised message from worker: `,t)})}connect(e){return this.onClose=e,this.ensureStarted().then(()=>this.doCmd(`connect`))}clearDatabase(){return this.ensureStarted().then(()=>this.doCmd(`clearDatabase`))}isNewlyCreated(){return this.doCmd(`isNewlyCreated`)}getSavedSync(){return this.doCmd(`getSavedSync`)}getNextBatchToken(){return this.doCmd(`getNextBatchToken`)}setSyncData(e){return this.doCmd(`setSyncData`,[e])}syncToDatabase(e){return this.doCmd(`syncToDatabase`,[e])}getOutOfBandMembers(e){return this.doCmd(`getOutOfBandMembers`,[e])}setOutOfBandMembers(e,t){return this.doCmd(`setOutOfBandMembers`,[e,t])}clearOutOfBandMembers(e){return this.doCmd(`clearOutOfBandMembers`,[e])}getClientOptions(){return this.doCmd(`getClientOptions`)}storeClientOptions(e){return this.doCmd(`storeClientOptions`,[e])}getUserPresenceEvents(){return this.doCmd(`getUserPresenceEvents`)}saveToDeviceBatches(e){var t=this;return F(function*(){return t.doCmd(`saveToDeviceBatches`,[e])})()}getOldestToDeviceBatch(){var e=this;return F(function*(){return e.doCmd(`getOldestToDeviceBatch`)})()}removeToDeviceBatch(e){var t=this;return F(function*(){return t.doCmd(`removeToDeviceBatch`,[e])})()}ensureStarted(){return this.startPromise||=(this.worker=this.workerFactory(),this.worker.onmessage=this.onWorkerMessage,this.doCmd(`setupWorker`,[this.dbName]).then(()=>{I.log(`IndexedDB worker is ready`)})),this.startPromise}doCmd(e,t){return Promise.resolve().then(()=>{var n,r=this.nextSeq++,i=Promise.withResolvers();return this.inFlight[r]=i,(n=this.worker)==null||n.postMessage({command:e,seq:r,args:t}),i.promise})}destroy(){var e=this;return F(function*(){var t;(t=e.worker)==null||t.terminate()})()}},wi=1e3*60*5,Ti=class extends Dr{static exists(e,t){return Si.exists(e,t)}constructor(e){if(super(e),S(this,`backend`,void 0),S(this,`startedUp`,!1),S(this,`syncTs`,0),S(this,`userModifiedMap`,{}),S(this,`emitter`,new Jn),S(this,`onClose`,()=>{this.emitter.emit(`closed`)}),S(this,`getSavedSync`,this.degradable(()=>this.backend.getSavedSync(),`getSavedSync`)),S(this,`isNewlyCreated`,this.degradable(()=>this.backend.isNewlyCreated(),`isNewlyCreated`)),S(this,`getSavedSyncToken`,this.degradable(()=>this.backend.getNextBatchToken(),`getSavedSyncToken`)),S(this,`deleteAllData`,this.degradable(()=>(super.deleteAllData(),this.backend.clearDatabase().then(()=>{I.log(`Deleted indexeddb data.`)},e=>{throw I.error(`Failed to delete indexeddb data: ${e}`),e})),null)),S(this,`reallySave`,this.degradable(()=>{this.syncTs=Date.now();var e=[];for(var t of this.getUsers())this.userModifiedMap[t.userId]!==t.getLastModifiedTime()&&t.events.presence&&(e.push([t.userId,t.events.presence.event]),this.userModifiedMap[t.userId]=t.getLastModifiedTime());return this.backend.syncToDatabase(e)},null)),S(this,`setSyncData`,this.degradable(e=>this.backend.setSyncData(e),`setSyncData`)),S(this,`getOutOfBandMembers`,this.degradable(e=>this.backend.getOutOfBandMembers(e),`getOutOfBandMembers`)),S(this,`setOutOfBandMembers`,this.degradable((e,t)=>(super.setOutOfBandMembers(e,t),this.backend.setOutOfBandMembers(e,t)),`setOutOfBandMembers`)),S(this,`clearOutOfBandMembers`,this.degradable(e=>(super.clearOutOfBandMembers(e),this.backend.clearOutOfBandMembers(e)),`clearOutOfBandMembers`)),S(this,`getClientOptions`,this.degradable(()=>this.backend.getClientOptions(),`getClientOptions`)),S(this,`storeClientOptions`,this.degradable(e=>(super.storeClientOptions(e),this.backend.storeClientOptions(e)),`storeClientOptions`)),!e.indexedDB)throw Error(`Missing required option: indexedDB`);e.workerFactory?this.backend=new Ci(e.workerFactory,e.dbName):this.backend=new Si(e.indexedDB,e.dbName)}on(e,t){this.emitter.on(e,t)}startup(){return this.startedUp?(I.log(`IndexedDBStore.startup: already started`),Promise.resolve()):(I.log(`IndexedDBStore.startup: connecting to backend`),this.backend.connect(this.onClose).then(()=>(I.log(`IndexedDBStore.startup: loading presence events`),this.backend.getUserPresenceEvents())).then(e=>{I.log(`IndexedDBStore.startup: processing presence events`),e.forEach(e=>{var[t,n]=e;if(!this.createUser)throw Error("`IndexedDBStore.startup` must be called after assigning it to the client, not before!");var r=this.createUser(t);n&&r.setPresenceEvent(new pn(n)),this.userModifiedMap[r.userId]=r.getLastModifiedTime(),this.storeUser(r)}),this.startedUp=!0}))}destroy(){return this.backend.destroy()}wantsSave(){return Date.now()-this.syncTs>wi}save(){return arguments.length>0&&arguments[0]!==void 0&&arguments[0]||this.wantsSave()?this.reallySave():Promise.resolve()}degradable(e,t){var n=this,r=t?super[t]:null;return F(function*(){var t=[...arguments];try{return yield e.call(n,...t)}catch(e){I.error(`IndexedDBStore failure, degrading to MemoryStore`,e),n.emitter.emit(`degraded`,e);try{I.log(`IndexedDBStore trying to delete degraded data`),yield n.backend.clearDatabase(),I.log(`IndexedDBStore delete after degrading succeeded`)}catch(e){I.warn(`IndexedDBStore delete after degrading failed`,e)}if(r)return r.call(n,...t)}})}getPendingEvents(e){var t=()=>super.getPendingEvents,n=this;return F(function*(){if(!n.localStorage)return t().call(n,e);var r=n.localStorage.getItem(Ei(e));if(r)try{return JSON.parse(r)}catch(e){I.error(`Could not parse persisted pending events`,e)}return[]})()}setPendingEvents(e,t){var n=()=>super.setPendingEvents,r=this;return F(function*(){if(!r.localStorage)return n().call(r,e,t);t.length>0?r.localStorage.setItem(Ei(e),JSON.stringify(t)):r.localStorage.removeItem(Ei(e))})()}saveToDeviceBatches(e){return this.backend.saveToDeviceBatches(e)}getOldestToDeviceBatch(){return this.backend.getOldestToDeviceBatch()}removeToDeviceBatch(e){return this.backend.removeToDeviceBatch(e)}};function Ei(e){return`mx_pending_events_${e}`}var Di=function(e){return e.Email=`email`,e.Phone=`msisdn`,e}({}),Oi=new E(`oauth_aware_preferred`,`org.matrix.msc3824.delegated_oidc_compatibility`),ki=Oi,Ai=function(e){return e.Gitlab=`gitlab`,e.Github=`github`,e.Apple=`apple`,e.Google=`google`,e.Facebook=`facebook`,e.Twitter=`twitter`,e}({}),ji=function(e){return e.LOGIN=`login`,e.REGISTER=`register`,e}({}),Mi=`m.tz`,Ni=`us.cloke.msc4175.tz`,Pi=class{constructor(e){S(this,`relations`,void 0),this.relations=e.filter(e=>!!e)}getRelations(){return this.relations.reduce((e,t)=>[...e,...t.getRelations()],[])}on(e,t){this.relations.forEach(n=>n.on(e,t))}off(e,t){this.relations.forEach(n=>n.off(e,t))}},Fi=function(e){return e.Global=`Global`,e.SetItemError=`setItem`,e.GetItemError=`getItem`,e.RemoveItemError=`removeItem`,e.ClearError=`clear`,e.QuotaExceededError=`QuotaExceededError`,e}({}),Ii=new class extends Jn{},Li=r({AuthType:()=>fi,AutoDiscovery:()=>Ln,AutoDiscoveryAction:()=>P,AutoDiscoveryError:()=>_t,Beacon:()=>On,BeaconEvent:()=>Gn,CallEvent:()=>Dn,CallFeedEvent:()=>$t,Category:()=>ri,ClientEvent:()=>cr,ClientPrefix:()=>Pe,ClientStoppedError:()=>an,ConditionKind:()=>c,ConditionOperator:()=>Vt,ConnectionError:()=>$e,ContentHelpers:()=>er,DELEGATED_OIDC_COMPATIBILITY:()=>ki,DEVICE_CODE_SCOPE:()=>Ve,DMMemberCountCondition:()=>`2`,DebugLogger:()=>zn,Device:()=>tn,DeviceVerification:()=>Tt,Direction:()=>O,DuplicateStrategy:()=>qe,EVENT_VISIBILITY_CHANGE_TYPE:()=>Fe,EventEmitterEvents:()=>Bt,EventStatus:()=>dr,EventTimeline:()=>w,EventTimelineSet:()=>b,EventType:()=>j,FILTER_RELATED_BY_REL_TYPES:()=>Ut,FILTER_RELATED_BY_SENDERS:()=>An,FeatureSupport:()=>vn,Filter:()=>wt,GET_LOGIN_TOKEN_CAPABILITY:()=>Ge,GroupCall:()=>Pt,GroupCallEvent:()=>hn,GroupCallIntent:()=>$n,GroupCallState:()=>Rt,GroupCallStatsReportEvent:()=>Wt,GroupCallType:()=>Mn,GuestAccess:()=>xe,HTTPError:()=>st,HistoryVisibility:()=>We,HttpApiEvent:()=>ie,IdentityPrefix:()=>A,IdentityProviderBrand:()=>Ai,IndexedDBCryptoStore:()=>qn,IndexedDBStore:()=>Ti,InteractiveAuth:()=>mi,InvalidCryptoStoreError:()=>Ot,InvalidCryptoStoreState:()=>kn,JoinRule:()=>vr,KNOWN_SAFE_ROOM_VERSION:()=>`10`,KeySignatureUploadError:()=>Kn,KnownMembership:()=>Oe,LOCAL_NOTIFICATION_SETTINGS_PREFIX:()=>le,LocalStorageCryptoStore:()=>xn,LocalStorageErrors:()=>Fi,LocationAssetType:()=>Ke,MAIN_ROOM_TIMELINE:()=>At,MAXIMUM_MATRIX_VERSION:()=>pt,MAX_STICKY_DURATION_MS:()=>Nt,MINIMUM_MATRIX_VERSION:()=>xt,MSC3912_RELATION_BASED_REDACTIONS_PROP:()=>be,MXID_PATTERN:()=>d,M_ASSET:()=>v,M_BEACON:()=>ln,M_BEACON_INFO:()=>Te,M_HTML:()=>Gt,M_LOCATION:()=>ar,M_MESSAGE:()=>Nn,M_POLL_END:()=>Xn,M_POLL_KIND_DISCLOSED:()=>wn,M_POLL_KIND_UNDISCLOSED:()=>Vn,M_POLL_RESPONSE:()=>rn,M_POLL_START:()=>Dt,M_TEXT:()=>bn,M_TIMESTAMP:()=>Ye,M_TOPIC:()=>zt,MatrixClient:()=>_,MatrixError:()=>ee,MatrixEvent:()=>pn,MatrixEventEvent:()=>Qn,MatrixHttpApi:()=>De,MatrixSafetyError:()=>he,MatrixSafetyErrorCode:()=>Fn,MatrixScheduler:()=>f,MediaHandlerEvent:()=>M,MediaPrefix:()=>ce,MemoryCryptoStore:()=>Un,MemoryStore:()=>Dr,Method:()=>yt,MsgType:()=>Ue,NoAuthFlowFoundError:()=>pi,NotificationCountType:()=>D,OAUTH_AWARE_PREFERRED_FLOW_FIELD:()=>Oi,OAuthGrantType:()=>hr,OidcError:()=>a,OidcTokenRefresher:()=>ve,PUSHER_DEVICE_ID:()=>_r,PUSHER_ENABLED:()=>h,PendingEventOrdering:()=>ir,Poll:()=>Re,PollEvent:()=>o,Preset:()=>g,ProfileKeyMSC4175Timezone:()=>Ni,ProfileKeyTimezone:()=>Mi,PushRuleActionName:()=>Yn,PushRuleKind:()=>Cn,REFERENCE_RELATION:()=>en,ReceiptType:()=>lr,RelatedRelations:()=>Pi,RelationType:()=>it,Relations:()=>sr,RelationsEvent:()=>Ze,RestrictedAllowType:()=>at,Room:()=>C,RoomCreateTypeField:()=>ae,RoomEvent:()=>je,RoomMember:()=>cn,RoomMemberEvent:()=>we,RoomNameType:()=>dn,RoomState:()=>Tn,RoomStateEvent:()=>Hn,RoomStickyEventsEvent:()=>u,RoomSummary:()=>Mt,RoomType:()=>et,RoomVersionStability:()=>sn,RoomWidgetClient:()=>$r,RoomWidgetClientEvent:()=>Qr,RuleId:()=>Bn,SERVICE_TYPES:()=>_e,SSOAction:()=>ji,STABLE_MSC4133_EXTENDED_PROFILES:()=>Je,SUPPORTED_MATRIX_VERSIONS:()=>Be,SearchOrderBy:()=>ue,SearchResult:()=>ne,SecretStorage:()=>Kt,ServerCapabilities:()=>Ce,SetPresence:()=>y,SlidingSyncEvent:()=>Ie,StatsReport:()=>yn,SyncAccumulator:()=>ai,SyncState:()=>Xe,THREAD_RELATION_TYPE:()=>Zt,Thread:()=>qt,ThreadEvent:()=>St,ThreadFilterType:()=>tr,ThreepidMedium:()=>Di,TimelineIndex:()=>li,TimelineWindow:()=>ci,ToDeviceMessageId:()=>ct,TokenRefreshError:()=>fe,TokenRefreshLogoutError:()=>ht,TweakName:()=>nn,TypedEventEmitter:()=>Jn,UNSIGNED_MEMBERSHIP_FIELD:()=>te,UNSIGNED_THREAD_ID_FIELD:()=>ge,UNSTABLE_ELEMENT_FUNCTIONAL_USERS:()=>In,UNSTABLE_MSC2666_MUTUAL_ROOMS:()=>T,UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS:()=>x,UNSTABLE_MSC2666_SHARED_ROOMS:()=>Ae,UNSTABLE_MSC2716_MARKER:()=>pe,UNSTABLE_MSC3088_ENABLED:()=>gt,UNSTABLE_MSC3088_PURPOSE:()=>ft,UNSTABLE_MSC3089_BRANCH:()=>bt,UNSTABLE_MSC3089_LEAF:()=>ze,UNSTABLE_MSC3089_TREE_SUBTYPE:()=>s,UNSTABLE_MSC3852_LAST_SEEN_UA:()=>un,UNSTABLE_MSC4133_EXTENDED_PROFILES:()=>l,UNSTABLE_MSC4140_DELAYED_EVENTS:()=>on,UNSTABLE_MSC4354_STICKY_EVENTS:()=>Se,UnsupportedDelayedEventsEndpointError:()=>It,UnsupportedStickyEventsEndpointError:()=>_n,UpdateDelayedEventAction:()=>tt,User:()=>Me,UserEvent:()=>fn,Visibility:()=>oe,anySignal:()=>ye,calculateRetryBackoff:()=>He,completeAuthorizationCodeGrant:()=>Qe,createClient:()=>Vi,createNewMatrixCall:()=>Wn,createRoomWidgetClient:()=>Hi,decodeBase64:()=>nr,decodeIdToken:()=>de,determineFeatureSupport:()=>fr,discoverAndValidateOIDCIssuerWellKnown:()=>nt,encodeBase64:()=>mr,encodeUnpaddedBase64:()=>jt,encodeUnpaddedBase64Url:()=>ur,fixNotificationCountOnDecryption:()=>Ee,generateAuthorizationParams:()=>ot,generateAuthorizationUrl:()=>N,generateOidcAuthorizationUrl:()=>me,generateScope:()=>Pn,getBeaconInfoIdentifier:()=>Ft,getHttpUriForMxc:()=>En,inMainTimelineForReceipt:()=>Ne,isDmMemberCountCondition:()=>Et,isEventTypeSame:()=>Xt,isPollEvent:()=>Ht,isSendDelayedEventRequestOpts:()=>lt,isTimestampInDuration:()=>gn,localStorageErrorsEventsEmitter:()=>Ii,parseErrorResponse:()=>gr,registerOidcClient:()=>p,retryNetworkOperation:()=>m,safeGetRetryAfterMs:()=>dt,setCryptoStoreFactory:()=>zi,threadFilterTypeToFilter:()=>kt,threadIdForReceipt:()=>k,timeoutSignal:()=>rt,validateAuthMetadata:()=>mt,validateAuthMetadataAndKeys:()=>re,validateBearerTokenResponse:()=>ut,validateIdToken:()=>vt,validateStoredUserState:()=>Le}),Ri=()=>new Un;function zi(e){Ri=e}function Bi(e){return e.store=e.store??new Dr({localStorage:globalThis.localStorage}),e.scheduler=e.scheduler??new f,e.cryptoStore=e.cryptoStore??Ri(),e}function Vi(e){return new _(Bi(e))}function Hi(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return new $r(e,t,n,Bi(r),i)}if(globalThis.__js_sdk_entrypoint)throw Error(`Multiple matrix-js-sdk entrypoints detected!`);globalThis.__js_sdk_entrypoint=!0;var Ui;try{Ui=globalThis.indexedDB}catch{}Ui&&zi(()=>new qn(Ui,`matrix-js-sdk:crypto`)),globalThis.matrixcs=Li;function Wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Gi(){throw Error(`setTimeout has not been defined`)}function Ki(){throw Error(`clearTimeout has not been defined`)}function qi(e){if(ta===setTimeout)return setTimeout(e,0);if((ta===Gi||!ta)&&setTimeout)return ta=setTimeout,setTimeout(e,0);try{return ta(e,0)}catch{try{return ta.call(null,e,0)}catch{return ta.call(this,e,0)}}}function Ji(e){if(na===clearTimeout)return clearTimeout(e);if((na===Ki||!na)&&clearTimeout)return na=clearTimeout,clearTimeout(e);try{return na(e)}catch{try{return na.call(null,e)}catch{return na.call(this,e)}}}function Yi(){!ia||!aa||(ia=!1,aa.length?ra=aa.concat(ra):oa=-1,ra.length&&Xi())}function Xi(){if(!ia){var e=qi(Yi);ia=!0;for(var t=ra.length;t;){for(aa=ra,ra=[];++oa<t;)aa&&aa[oa].run();oa=-1,t=ra.length}aa=null,ia=!1,Ji(e)}}function Zi(e,t){this.fun=e,this.array=t}function Qi(){}var $i,ea,ta,na,ra,ia,aa,oa,sa,ca,la=t((()=>{$i={exports:{}},ea=$i.exports={},(function(){try{ta=typeof setTimeout==`function`?setTimeout:Gi}catch{ta=Gi}try{na=typeof clearTimeout==`function`?clearTimeout:Ki}catch{na=Ki}})(),ra=[],ia=!1,oa=-1,ea.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];ra.push(new Zi(e,t)),ra.length===1&&!ia&&qi(Xi)},Zi.prototype.run=function(){this.fun.apply(null,this.array)},ea.title=`browser`,ea.browser=!0,ea.env={},ea.argv=[],ea.version=``,ea.versions={},ea.on=Qi,ea.addListener=Qi,ea.once=Qi,ea.off=Qi,ea.removeListener=Qi,ea.removeAllListeners=Qi,ea.emit=Qi,ea.prependListener=Qi,ea.prependOnceListener=Qi,ea.listeners=function(e){return[]},ea.binding=function(e){throw Error(`process.binding is not supported`)},ea.cwd=function(){return`/`},ea.chdir=function(e){throw Error(`process.chdir is not supported`)},ea.umask=function(){return 0},sa=$i.exports,ca=Wi(sa)})),ua=i((e=>{la();var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ee(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ne=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof ca==`object`&&typeof ca.emit==`function`){ca.emit(`uncaughtException`,e);return}console.error(e)},re={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=re,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,ne)}catch(e){ne(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),da=i(((e,t)=>{t.exports=ua()})),fa=i((e=>{var t=da();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),pa=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=fa()})),R=e(da(),1),ma=`popstate`;function ha(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ga(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return xa(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Sa(t)}return wa(t,n,null,e)}function _a(e,t){if(e===!1||e==null)throw Error(t)}function va(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ya(){return Math.random().toString(36).substring(2,10)}function ba(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function xa(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ca(t):t,state:n,key:t&&t.key||r||ya(),unstable_mask:i}}function Sa({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Ca(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function wa(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=ha(e)?e:xa(h.location,e,t);n&&n(r,e),l=u()+1;let d=ba(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=ha(e)?e:xa(h.location,e,t);n&&n(r,e),l=u();let i=ba(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ta(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ma,d),c=e,()=>{i.removeEventListener(ma,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ta(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),_a(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Sa(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function Ea(e,t,n=`/`){return Da(e,t,n,!1)}function Da(e,t,n,r){let i=Ga((typeof t==`string`?Ca(t):t).pathname||`/`,n);if(i==null)return null;let a=ka(e);ja(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Wa(i);o=Va(a[e],t,r)}return o}function Oa(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ka(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;_a(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=eo([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(_a(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ka(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:za(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Aa(e.path))a(e,t,!0,n)}),t}function Aa(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Aa(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ja(e){e.sort((e,t)=>e.score===t.score?Ba(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ma=/^:[\w-]+$/,Na=3,Pa=2,Fa=1,Ia=10,La=-2,Ra=e=>e===`*`;function za(e,t){let n=e.split(`/`),r=n.length;return n.some(Ra)&&(r+=La),t&&(r+=Pa),n.filter(e=>!Ra(e)).reduce((e,t)=>e+(Ma.test(t)?Na:t===``?Fa:Ia),r)}function Ba(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Va(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Ha({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Ha({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:eo([a,u.pathname]),pathnameBase:no(eo([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=eo([a,u.pathnameBase]))}return o}function Ha(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ua(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Ua(e,t=!1,n=!0){va(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Wa(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return va(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ga(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Ka=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function qa(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ca(e):e,a;return n?(n=$a(n),a=n.startsWith(`/`)?Ja(n.substring(1),`/`):Ja(n,t)):a=t,{pathname:a,search:ro(r),hash:io(i)}}function Ja(e,t){let n=to(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ya(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Xa(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Za(e){let t=Xa(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Qa(e,t,n,r=!1){let i;typeof e==`string`?i=Ca(e):(i={...e},_a(!i.pathname||!i.pathname.includes(`?`),Ya(`?`,`pathname`,`search`,i)),_a(!i.pathname||!i.pathname.includes(`#`),Ya(`#`,`pathname`,`hash`,i)),_a(!i.search||!i.search.includes(`#`),Ya(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=qa(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var $a=e=>e.replace(/\/\/+/g,`/`),eo=e=>$a(e.join(`/`)),to=e=>e.replace(/\/+$/,``),no=e=>to(e).replace(/^\/*/,`/`),ro=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,io=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ao=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function oo(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function so(e){return eo(e.map(e=>e.route.path).filter(Boolean))||`/`}var co=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function lo(e,t){let n=e;if(typeof n!=`string`||!Ka.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(co)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Ga(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{va(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var uo=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(uo);var fo=[`GET`,...uo];new Set(fo);var po=R.createContext(null);po.displayName=`DataRouter`;var mo=R.createContext(null);mo.displayName=`DataRouterState`;var ho=R.createContext(!1);function go(){return R.useContext(ho)}var _o=R.createContext({isTransitioning:!1});_o.displayName=`ViewTransition`;var vo=R.createContext(new Map);vo.displayName=`Fetchers`;var yo=R.createContext(null);yo.displayName=`Await`;var bo=R.createContext(null);bo.displayName=`Navigation`;var xo=R.createContext(null);xo.displayName=`Location`;var So=R.createContext({outlet:null,matches:[],isDataRoute:!1});So.displayName=`Route`;var Co=R.createContext(null);Co.displayName=`RouteError`;var wo=`REACT_ROUTER_ERROR`,To=`REDIRECT`,Eo=`ROUTE_ERROR_RESPONSE`;function Do(e){if(e.startsWith(`${wo}:${To}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Oo(e){if(e.startsWith(`${wo}:${Eo}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new ao(t.status,t.statusText,t.data)}catch{}}function ko(e,{relative:t}={}){_a(Ao(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=R.useContext(bo),{hash:i,pathname:a,search:o}=Lo(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:eo([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Ao(){return R.useContext(xo)!=null}function jo(){return _a(Ao(),`useLocation() may be used only in the context of a <Router> component.`),R.useContext(xo).location}function Mo(){return R.useContext(xo).navigationType}var No=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Po(e){R.useContext(bo).static||R.useLayoutEffect(e)}function Fo(){let{isDataRoute:e}=R.useContext(So);return e?ns():Io()}function Io(){_a(Ao(),`useNavigate() may be used only in the context of a <Router> component.`);let e=R.useContext(po),{basename:t,navigator:n}=R.useContext(bo),{matches:r}=R.useContext(So),{pathname:i}=jo(),a=JSON.stringify(Za(r)),o=R.useRef(!1);return Po(()=>{o.current=!0}),R.useCallback((r,s={})=>{if(va(o.current,No),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Qa(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:eo([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}R.createContext(null);function Lo(e,{relative:t}={}){let{matches:n}=R.useContext(So),{pathname:r}=jo(),i=JSON.stringify(Za(n));return R.useMemo(()=>Qa(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ro(e,t){return zo(e,t)}function zo(e,t,n){_a(Ao(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=R.useContext(bo),{matches:i}=R.useContext(So),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;is(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./pako.esm-UZ0EWzai.js","./_sentry-release-injection-file-C4oXeC0H.js","./spa-BW6X0pJ7.js","./indexeddb-crypto-store-DDjyMFqS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
try{let e=typeof window<`u`?window:n===void 0?typeof globalThis<`u`?globalThis:typeof self<`u`?self:{}:n,t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`7d8992ca-9d2e-4500-8b44-1c17d4e07697`,e._sentryDebugIdIdentifier=`sentry-dbid-7d8992ca-9d2e-4500-8b44-1c17d4e07697`)}catch{}import{a as e,n as t,o as n,r,t as i}from"./_sentry-release-injection-file-C4oXeC0H.js";import{$ as a,$n as o,$r as s,$t as c,A as l,An as u,Ar as d,At as f,B as p,Bn as m,Br as h,Bt as g,C as _,Ci as v,Cn as y,Cr as b,D as x,Di as S,Dn as C,Dr as w,E as T,Ei as E,En as D,Er as O,F as k,Fn as A,Fr as j,Ft as M,G as N,Gn as ee,Gr as te,Gt as ne,H as re,Hn as ie,Hr as ae,Ht as oe,I as se,In as ce,Ir as le,It as ue,J as de,Jn as fe,Jr as pe,Jt as P,K as me,Kn as he,Kr as ge,Kt as _e,L as ve,Ln as ye,Lr as be,Lt as xe,M as Se,Mn as Ce,Mr as we,Mt as Te,N as Ee,Nn as De,Nr as Oe,Nt as ke,O as Ae,Oi as F,On as je,Or as Me,P as Ne,Pn as Pe,Pr as Fe,Pt as Ie,Q as Le,Qn as Re,Qr as ze,Qt as Be,R as Ve,Rn as He,Rr as Ue,Rt as We,S as Ge,Si as Ke,Sr as qe,T as Je,Ti as Ye,Tn as Xe,Tr as Ze,U as Qe,Un as $e,Ur as et,Ut as tt,V as nt,Vn as rt,Vr as it,Vt as at,W as ot,Wn as st,Wr as ct,Wt as lt,X as ut,Xn as dt,Xr as ft,Xt as pt,Y as mt,Yn as ht,Yr as gt,Yt as _t,Z as vt,Zn as yt,Zr as bt,Zt as xt,_ as St,_n as Ct,_r as wt,a as Tt,ai as I,an as Et,ar as Dt,at as Ot,b as kt,bi as At,bn as jt,br as Mt,c as Nt,cn as Pt,cr as Ft,ct as It,di as Lt,dn as Rt,dr as zt,ei as Bt,en as Vt,er as Ht,f as Ut,fn as Wt,fr as Gt,ft as Kt,g as qt,gi as Jt,gn as Yt,gr as Xt,h as Zt,hi as Qt,hn as $t,hr as en,i as tn,in as nn,ir as rn,it as an,j as on,jn as sn,jr as cn,jt as ln,k as un,kn as dn,kr as fn,l as pn,li as mn,ln as hn,lr as gn,lt as _n,m as vn,mn as yn,mr as bn,n as xn,ni as Sn,nn as Cn,nr as wn,o as Tn,oi as En,on as Dn,or as On,ot as kn,p as An,pi as jn,pn as Mn,pr as Nn,q as Pn,qn as Fn,qr as In,qt as Ln,r as Rn,ri as zn,rn as Bn,rr as Vn,s as Hn,si as Un,sn as Wn,sr as Gn,st as Kn,t as qn,ti as Jn,tn as Yn,tr as Xn,tt as Zn,u as Qn,un as $n,ur as er,v as tr,vn as nr,vr as rr,w as ir,wi as ar,wn as or,wr as sr,x as cr,xi as lr,xn as ur,xr as dr,y as fr,yi as pr,yn as mr,z as hr,zn as gr,zr as _r,zt as vr}from"./indexeddb-crypto-store-DDjyMFqS.js";import{c as yr,d as br,f as xr,l as Sr,o as Cr,t as wr,u as Tr}from"./tslib.es6-Cgt7ctuY.js";function Er(e){return typeof e==`string`&&!!e&&e!==`undefined`&&e!==`null`||typeof e==`number`}var Dr=class{constructor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};S(this,`rooms`,{}),S(this,`users`,{}),S(this,`syncToken`,null),S(this,`filters`,new mn(()=>new Map)),S(this,`accountData`,new Map),S(this,`localStorage`,void 0),S(this,`oobMembers`,new Map),S(this,`pendingEvents`,{}),S(this,`clientOptions`,void 0),S(this,`pendingToDeviceBatches`,[]),S(this,`nextToDeviceBatchId`,0),S(this,`createUser`,void 0),S(this,`onRoomMember`,(e,t,n)=>{if(n.membership!==Oe.Invite){var r=this.users[n.userId]||this.createUser?.call(this,n.userId);n.name&&(r.setDisplayName(n.name),n.events.member&&r.setRawDisplayName(n.events.member.getDirectionalContent().displayname)),n.events.member&&n.events.member.getContent().avatar_url&&r.setAvatarUrl(n.events.member.getContent().avatar_url),this.users[r.userId]=r}}),this.localStorage=e.localStorage}getSyncToken(){return this.syncToken}isNewlyCreated(){return Promise.resolve(!0)}setSyncToken(e){this.syncToken=e}storeRoom(e){this.rooms[e.roomId]=e,e.currentState.on(Hn.Members,this.onRoomMember),e.currentState.getMembers().forEach(t=>{this.onRoomMember(null,e.currentState,t)})}setUserCreator(e){this.createUser=e}getRoom(e){return this.rooms[e]||null}getRooms(){return Object.values(this.rooms)}removeRoom(e){this.rooms[e]&&this.rooms[e].currentState.removeListener(Hn.Members,this.onRoomMember),delete this.rooms[e]}getRoomSummaries(){return Object.values(this.rooms).map(function(e){return e.summary})}storeUser(e){this.users[e.userId]=e}getUser(e){return this.users[e]||null}getUsers(){return Object.values(this.users)}scrollback(e,t){return[]}storeEvents(e,t,n,r){}storeFilter(e){!(e!=null&&e.userId)||!(e!=null&&e.filterId)||this.filters.getOrCreate(e.userId).set(e.filterId,e)}getFilter(e,t){return this.filters.get(e)?.get(t)||null}getFilterIdByName(e){if(!this.localStorage)return null;var t=`mxjssdk_memory_filter_`+e;try{var n=this.localStorage.getItem(t);if(Er(n))return n}catch{}return null}setFilterIdByName(e,t){if(this.localStorage){var n=`mxjssdk_memory_filter_`+e;try{Er(t)?this.localStorage.setItem(n,t):this.localStorage.removeItem(n)}catch{}}}storeAccountDataEvents(e){e.forEach(e=>{Object.keys(e.getContent()).length?this.accountData.set(e.getType(),e):this.accountData.delete(e.getType())})}getAccountData(e){return this.accountData.get(e)}setSyncData(e){return Promise.resolve()}wantsSave(){return!1}save(e){return Promise.resolve()}startup(){return Promise.resolve()}getSavedSync(){return Promise.resolve(null)}getSavedSyncToken(){return Promise.resolve(null)}deleteAllData(){return this.rooms={},this.users={},this.syncToken=null,this.filters=new mn(()=>new Map),this.accountData=new Map,Promise.resolve()}getOutOfBandMembers(e){return Promise.resolve(this.oobMembers.get(e)||null)}setOutOfBandMembers(e,t){return this.oobMembers.set(e,t),Promise.resolve()}clearOutOfBandMembers(e){return this.oobMembers.delete(e),Promise.resolve()}getClientOptions(){return Promise.resolve(this.clientOptions)}storeClientOptions(e){return this.clientOptions=Object.assign({},e),Promise.resolve()}getPendingEvents(e){var t=this;return F(function*(){return t.pendingEvents[e]??[]})()}setPendingEvents(e,t){var n=this;return F(function*(){n.pendingEvents[e]=t})()}saveToDeviceBatches(e){for(var t of e)this.pendingToDeviceBatches.push({id:this.nextToDeviceBatchId++,eventType:t.eventType,txnId:t.txnId,batch:t.batch});return Promise.resolve()}getOldestToDeviceBatch(){var e=this;return F(function*(){return e.pendingToDeviceBatches.length===0?null:e.pendingToDeviceBatches[0]})()}removeToDeviceBatch(e){return this.pendingToDeviceBatches=this.pendingToDeviceBatches.filter(t=>t.id!==e),Promise.resolve()}destroy(){return F(function*(){})()}},Or=e(Sn()),kr=function(e){return e.ToWidget=`toWidget`,e.FromWidget=`fromWidget`,e}({});function Ar(e){if(e===kr.ToWidget)return kr.FromWidget;if(e===kr.FromWidget)return kr.ToWidget;throw Error(`Invalid direction`)}var jr=function(e){return e.Prerelease1=`0.0.1`,e.Prerelease2=`0.0.2`,e}({}),Mr=function(e){return e.MSC2762=`org.matrix.msc2762`,e.MSC2762_UPDATE_STATE=`org.matrix.msc2762_update_state`,e.MSC2871=`org.matrix.msc2871`,e.MSC2873=`org.matrix.msc2873`,e.MSC2931=`org.matrix.msc2931`,e.MSC2974=`org.matrix.msc2974`,e.MSC2876=`org.matrix.msc2876`,e.MSC3819=`org.matrix.msc3819`,e.MSC3846=`town.robin.msc3846`,e.MSC3869=`org.matrix.msc3869`,e.MSC3973=`org.matrix.msc3973`,e.MSC4039=`org.matrix.msc4039`,e}({}),Nr=[jr.Prerelease1,jr.Prerelease2,Mr.MSC2762,Mr.MSC2762_UPDATE_STATE,Mr.MSC2871,Mr.MSC2873,Mr.MSC2931,Mr.MSC2974,Mr.MSC2876,Mr.MSC3819,Mr.MSC3846,Mr.MSC3869,Mr.MSC3973,Mr.MSC4039],Pr=class extends Or.EventEmitter{strictOriginCheck=!1;targetOrigin=`*`;timeoutSeconds=10;_ready=!1;_widgetId;outboundRequests=new Map;stopController=new AbortController;get ready(){return this._ready}get widgetId(){return this._widgetId||null}constructor(e,t,n,r){super(),this.sendDirection=e,this.transportWindow=n,this.inboundWindow=r,this._widgetId=t}get nextRequestId(){let e=`widgetapi-${Date.now()}`,t=0,n=e;for(;this.outboundRequests.has(n);)n=`${e}-${t++}`;return this.outboundRequests.set(n,null),n}sendInternal(e){console.log(`[PostmessageTransport] Sending object to ${this.targetOrigin}: `,e),this.transportWindow.postMessage(e,this.targetOrigin)}reply(e,t){return this.sendInternal({...e,response:t})}send(e,t){return this.sendComplete(e,t).then(e=>e.response)}sendComplete(e,t){if(!this.ready||!this.widgetId)return Promise.reject(Error(`Not ready or unknown widget ID`));let n={api:this.sendDirection,widgetId:this.widgetId,requestId:this.nextRequestId,action:e,data:t};return e===Fr.UpdateVisibility&&(n.visible=t.visible),new Promise((e,t)=>{let r=t=>{s(),e(t)},i=e=>{s(),t(e)},a=setTimeout(()=>i(Error(`Request timed out`)),(this.timeoutSeconds||1)*1e3),o=()=>i(Error(`Transport stopped`));this.stopController.signal.addEventListener(`abort`,o);let s=()=>{this.outboundRequests.delete(n.requestId),clearTimeout(a),this.stopController.signal.removeEventListener(`abort`,o)};this.outboundRequests.set(n.requestId,{request:n,resolve:r,reject:i}),this.sendInternal(n)})}start(){this.inboundWindow.addEventListener(`message`,this.handleMessage),this._ready=!0}stop(){this._ready=!1,this.stopController.abort(),this.inboundWindow.removeEventListener(`message`,this.handleMessage)}handleMessage=e=>{if(this.stopController.signal.aborted||!e.data||this.strictOriginCheck&&e.origin!==globalThis.origin)return;let t=e.data;if(!(!t.action||!t.requestId||!t.widgetId))if(t.response){if(t.api!==this.sendDirection)return;this.handleResponse(t)}else{let e=t;if(e.api!==Ar(this.sendDirection))return;this.handleRequest(e)}};handleRequest(e){if(this.widgetId){if(this.widgetId!==e.widgetId)return}else this._widgetId=e.widgetId;this.emit(`message`,new CustomEvent(`message`,{detail:e}))}handleResponse(e){if(e.widgetId!==this.widgetId)return;let t=this.outboundRequests.get(e.requestId);if(t)if(qr(e.response)){let{message:n,...r}=e.response.error;t.reject(new Wr(n,r))}else t.resolve(e)}},Fr=function(e){return e.SupportedApiVersions=`supported_api_versions`,e.Capabilities=`capabilities`,e.NotifyCapabilities=`notify_capabilities`,e.ThemeChange=`theme_change`,e.LanguageChange=`language_change`,e.TakeScreenshot=`screenshot`,e.UpdateVisibility=`visibility`,e.OpenIDCredentials=`openid_credentials`,e.WidgetConfig=`widget_config`,e.CloseModalWidget=`close_modal`,e.ButtonClicked=`button_clicked`,e.SendEvent=`send_event`,e.SendToDevice=`send_to_device`,e.UpdateState=`update_state`,e.UpdateTurnServers=`update_turn_servers`,e}({}),L=function(e){return e.SupportedApiVersions=`supported_api_versions`,e.ContentLoaded=`content_loaded`,e.SendSticker=`m.sticker`,e.UpdateAlwaysOnScreen=`set_always_on_screen`,e.GetOpenIDCredentials=`get_openid`,e.CloseModalWidget=`close_modal`,e.OpenModalWidget=`open_modal`,e.SetModalButtonEnabled=`set_button_enabled`,e.SendEvent=`send_event`,e.SendToDevice=`send_to_device`,e.WatchTurnServers=`watch_turn_servers`,e.UnwatchTurnServers=`unwatch_turn_servers`,e.BeeperReadRoomAccountData=`com.beeper.read_room_account_data`,e.MSC2876ReadEvents=`org.matrix.msc2876.read_events`,e.MSC2931Navigate=`org.matrix.msc2931.navigate`,e.MSC2974RenegotiateCapabilities=`org.matrix.msc2974.request_capabilities`,e.MSC3869ReadRelations=`org.matrix.msc3869.read_relations`,e.MSC3973UserDirectorySearch=`org.matrix.msc3973.user_directory_search`,e.MSC4039GetMediaConfigAction=`org.matrix.msc4039.get_media_config`,e.MSC4039UploadFileAction=`org.matrix.msc4039.upload_file`,e.MSC4039DownloadFileAction=`org.matrix.msc4039.download_file`,e.MSC4157UpdateDelayedEvent=`org.matrix.msc4157.update_delayed_event`,e}({}),Ir=function(e){return e.Allowed=`allowed`,e.Blocked=`blocked`,e.PendingUserConfirmation=`request`,e}({}),Lr=function(e){return e.Custom=`m.custom`,e.JitsiMeet=`m.jitsi`,e.Stickerpicker=`m.stickerpicker`,e}({}),Rr=function(e){return e.Close=`m.close`,e}({}),zr=function(e){return e.Event=`event`,e.State=`state_event`,e.ToDevice=`to_device`,e.RoomAccount=`room_account`,e}({}),Br=function(e){return e.Send=`send`,e.Receive=`receive`,e}({}),Vr=class e{constructor(e,t,n,r,i){this.direction=e,this.eventType=t,this.kind=n,this.keyStr=r,this.raw=i}matchesAsStateEvent(e,t,n){return this.kind!==zr.State||this.direction!==e||this.eventType!==t?!1:this.keyStr===null||this.keyStr===n}matchesAsToDeviceEvent(e,t){return!(this.kind!==zr.ToDevice||this.direction!==e||this.eventType!==t)}matchesAsRoomEvent(e,t,n=null){if(this.kind!==zr.Event||this.direction!==e||this.eventType!==t)return!1;if(this.eventType===`m.room.message`){if(this.keyStr===null||this.keyStr===n)return!0}else return!0;return!1}matchesAsRoomAccountData(e,t){return!(this.kind!==zr.RoomAccount||this.direction!==e||this.eventType!==t)}static forStateEvent(t,n,r){n=n.replace(/#/g,`\\#`),r=r==null?``:`#${r}`;let i=`org.matrix.msc2762.${t}.state_event:${n}${r}`;return e.findEventCapabilities([i])[0]}static forToDeviceEvent(t,n){let r=`org.matrix.msc3819.${t}.to_device:${n}`;return e.findEventCapabilities([r])[0]}static forRoomEvent(t,n){let r=`org.matrix.msc2762.${t}.event:${n}`;return e.findEventCapabilities([r])[0]}static forRoomMessageEvent(t,n){n??=``;let r=`org.matrix.msc2762.${t}.event:m.room.message#${n}`;return e.findEventCapabilities([r])[0]}static forRoomAccountData(t,n){let r=`com.beeper.capabilities.${t}.room_account_data:${n}`;return e.findEventCapabilities([r])[0]}static findEventCapabilities(t){let n=[];for(let r of t){let t=null,i,a=null;if(r.startsWith(`org.matrix.msc2762.send.event:`)?(t=Br.Send,a=zr.Event,i=r.substring(30)):r.startsWith(`org.matrix.msc2762.send.state_event:`)?(t=Br.Send,a=zr.State,i=r.substring(36)):r.startsWith(`org.matrix.msc3819.send.to_device:`)?(t=Br.Send,a=zr.ToDevice,i=r.substring(34)):r.startsWith(`org.matrix.msc2762.receive.event:`)?(t=Br.Receive,a=zr.Event,i=r.substring(33)):r.startsWith(`org.matrix.msc2762.receive.state_event:`)?(t=Br.Receive,a=zr.State,i=r.substring(39)):r.startsWith(`org.matrix.msc3819.receive.to_device:`)?(t=Br.Receive,a=zr.ToDevice,i=r.substring(37)):r.startsWith(`com.beeper.capabilities.receive.room_account_data:`)&&(t=Br.Receive,a=zr.RoomAccount,i=r.substring(50)),t===null||a===null||i===void 0)continue;let o=i.startsWith(`m.room.message#`)||a===zr.State,s=null;if(i.includes(`#`)&&o){let e=i.split(`#`),t=e.findIndex(e=>!e.endsWith(`\\`));i=e.slice(0,t+1).map(e=>e.endsWith(`\\`)?e.substring(0,e.length-1):e).join(`#`),s=e.slice(t+1).join(`#`)}n.push(new e(t,i,a,s,r))}return n}},Hr=function(e){return e.AnyRoom=`*`,e}({}),Ur=function(e){return e.Cancel=`cancel`,e.Restart=`restart`,e.Send=`send`,e}({}),Wr=class extends Error{static{this.prototype.name=this.name}constructor(e,t){super(e),this.data=t}},Gr=class extends Or.EventEmitter{transport;capabilitiesFinished=!1;supportsMSC2974Renegotiate=!1;requestedCapabilities=[];approvedCapabilities;cachedClientVersions;turnServerWatchers=0;constructor(e=null,t=null){if(super(),!globalThis.parent)throw Error(`No parent window. This widget doesn't appear to be embedded properly.`);this.transport=new Pr(kr.FromWidget,e,globalThis.parent,globalThis),this.transport.targetOrigin=t,this.transport.on(`message`,this.handleMessage.bind(this))}hasCapability(e){return Array.isArray(this.approvedCapabilities)?this.approvedCapabilities.includes(e):this.requestedCapabilities.includes(e)}requestCapability(e){if(this.capabilitiesFinished&&!this.supportsMSC2974Renegotiate)throw Error(`Capabilities have already been negotiated`);this.requestedCapabilities.push(e)}requestCapabilities(e){for(let t of e)this.requestCapability(t)}requestCapabilityForRoomTimeline(e){this.requestCapability(`org.matrix.msc2762.timeline:${e}`)}requestCapabilityToSendState(e,t){this.requestCapability(Vr.forStateEvent(Br.Send,e,t).raw)}requestCapabilityToReceiveState(e,t){this.requestCapability(Vr.forStateEvent(Br.Receive,e,t).raw)}requestCapabilityToSendToDevice(e){this.requestCapability(Vr.forToDeviceEvent(Br.Send,e).raw)}requestCapabilityToReceiveToDevice(e){this.requestCapability(Vr.forToDeviceEvent(Br.Receive,e).raw)}requestCapabilityToSendEvent(e){this.requestCapability(Vr.forRoomEvent(Br.Send,e).raw)}requestCapabilityToReceiveEvent(e){this.requestCapability(Vr.forRoomEvent(Br.Receive,e).raw)}requestCapabilityToSendMessage(e){this.requestCapability(Vr.forRoomMessageEvent(Br.Send,e).raw)}requestCapabilityToReceiveMessage(e){this.requestCapability(Vr.forRoomMessageEvent(Br.Receive,e).raw)}requestCapabilityToReceiveRoomAccountData(e){this.requestCapability(Vr.forRoomAccountData(Br.Receive,e).raw)}requestOpenIDConnectToken(){return new Promise((e,t)=>{this.transport.sendComplete(L.GetOpenIDCredentials,{}).then(n=>{let r=n.response;if(r.state===Ir.Allowed)e(r);else if(r.state===Ir.Blocked)t(Error(`User declined to verify their identity`));else if(r.state===Ir.PendingUserConfirmation){let i=a=>{a.preventDefault();let o=a.detail;o.data.original_request_id===n.requestId&&(o.data.state===Ir.Allowed?(e(o.data),this.transport.reply(o,{})):o.data.state===Ir.Blocked?(t(Error(`User declined to verify their identity`)),this.transport.reply(o,{})):(t(Error(`Invalid state on reply: `+r.state)),this.transport.reply(o,{error:{message:`Invalid state`}})),this.off(`action:${Fr.OpenIDCredentials}`,i))};this.on(`action:${Fr.OpenIDCredentials}`,i)}else t(Error(`Invalid state: `+r.state))}).catch(t)})}updateRequestedCapabilities(){return this.transport.send(L.MSC2974RenegotiateCapabilities,{capabilities:this.requestedCapabilities}).then()}sendContentLoaded(){return this.transport.send(L.ContentLoaded,{}).then()}sendSticker(e){return this.transport.send(L.SendSticker,e).then()}setAlwaysOnScreen(e){return this.transport.send(L.UpdateAlwaysOnScreen,{value:e}).then(e=>e.success)}openModalWidget(e,t,n=[],r={},i=Lr.Custom){return this.transport.send(L.OpenModalWidget,{type:i,url:e,name:t,buttons:n,data:r}).then()}closeModalWidget(e={}){return this.transport.send(L.CloseModalWidget,e).then()}sendRoomEvent(e,t,n,r,i,a){return this.sendEvent(e,void 0,t,n,r,i,a)}sendStateEvent(e,t,n,r,i,a){return this.sendEvent(e,t,n,r,i,a)}sendEvent(e,t,n,r,i,a,o){return this.transport.send(L.SendEvent,{type:e,content:n,...t!==void 0&&{state_key:t},...r!==void 0&&{room_id:r},...i!==void 0&&{delay:i},...a!==void 0&&{parent_delay_id:a},...o!==void 0&&{sticky_duration_ms:o}})}cancelScheduledDelayedEvent(e){return this.transport.send(L.MSC4157UpdateDelayedEvent,{delay_id:e,action:Ur.Cancel})}restartScheduledDelayedEvent(e){return this.transport.send(L.MSC4157UpdateDelayedEvent,{delay_id:e,action:Ur.Restart})}sendScheduledDelayedEvent(e){return this.transport.send(L.MSC4157UpdateDelayedEvent,{delay_id:e,action:Ur.Send})}sendToDevice(e,t,n){return this.transport.send(L.SendToDevice,{type:e,encrypted:t,messages:n})}readRoomAccountData(e,t){let n={type:e};return t&&(t.includes(Hr.AnyRoom)?n.room_ids=Hr.AnyRoom:n.room_ids=t),this.transport.send(L.BeeperReadRoomAccountData,n).then(e=>e.events)}readRoomEvents(e,t,n,r,i){let a={type:e,msgtype:n};return t!==void 0&&(a.limit=t),r&&(r.includes(Hr.AnyRoom)?a.room_ids=Hr.AnyRoom:a.room_ids=r),i&&(a.since=i),this.transport.send(L.MSC2876ReadEvents,a).then(e=>e.events)}async readEventRelations(e,t,n,r,i,a,o,s){if(!(await this.getClientVersions()).includes(Mr.MSC3869))throw Error(`The read_relations action is not supported by the client.`);let c={event_id:e,rel_type:n,event_type:r,room_id:t,to:o,from:a,limit:i,direction:s};return this.transport.send(L.MSC3869ReadRelations,c)}readStateEvents(e,t,n,r){let i={type:e,state_key:n===void 0?!0:n};return t!==void 0&&(i.limit=t),r&&(r.includes(Hr.AnyRoom)?i.room_ids=Hr.AnyRoom:i.room_ids=r),this.transport.send(L.MSC2876ReadEvents,i).then(e=>e.events)}setModalButtonEnabled(e,t){if(e===Rr.Close)throw Error(`The close button cannot be disabled`);return this.transport.send(L.SetModalButtonEnabled,{button:e,enabled:t}).then()}navigateTo(e){if(!e||!e.startsWith(`https://matrix.to/#`))throw Error(`Invalid matrix.to URI`);return this.transport.send(L.MSC2931Navigate,{uri:e}).then()}async*getTurnServers(){let e,t=async t=>{t.preventDefault(),e(t.detail.data),this.transport.reply(t.detail,{})};if(this.on(`action:${Fr.UpdateTurnServers}`,t),this.turnServerWatchers===0)try{await this.transport.send(L.WatchTurnServers,{})}catch(e){throw this.off(`action:${Fr.UpdateTurnServers}`,t),e}this.turnServerWatchers++;try{for(;;)yield await new Promise(t=>e=t)}finally{this.off(`action:${Fr.UpdateTurnServers}`,t),this.turnServerWatchers--,this.turnServerWatchers===0&&await this.transport.send(L.UnwatchTurnServers,{})}}async searchUserDirectory(e,t){if(!(await this.getClientVersions()).includes(Mr.MSC3973))throw Error(`The user_directory_search action is not supported by the client.`);let n={search_term:e,limit:t};return this.transport.send(L.MSC3973UserDirectorySearch,n)}async getMediaConfig(){if(!(await this.getClientVersions()).includes(Mr.MSC4039))throw Error(`The get_media_config action is not supported by the client.`);return this.transport.send(L.MSC4039GetMediaConfigAction,{})}async uploadFile(e){if(!(await this.getClientVersions()).includes(Mr.MSC4039))throw Error(`The upload_file action is not supported by the client.`);let t={file:e};return this.transport.send(L.MSC4039UploadFileAction,t)}async downloadFile(e){if(!(await this.getClientVersions()).includes(Mr.MSC4039))throw Error(`The download_file action is not supported by the client.`);let t={content_uri:e};return this.transport.send(L.MSC4039DownloadFileAction,t)}start(){this.transport.start(),this.getClientVersions().then(e=>{e.includes(Mr.MSC2974)&&(this.supportsMSC2974Renegotiate=!0)})}handleMessage(e){let t=new CustomEvent(`action:${e.detail.action}`,{detail:e.detail,cancelable:!0});if(this.emit(`action:${e.detail.action}`,t),!t.defaultPrevented)switch(e.detail.action){case Fr.SupportedApiVersions:return this.replyVersions(e.detail);case Fr.Capabilities:return this.handleCapabilities(e.detail);case Fr.UpdateVisibility:return this.transport.reply(e.detail,{});case Fr.NotifyCapabilities:return this.transport.reply(e.detail,{});default:return this.transport.reply(e.detail,{error:{message:`Unknown or unsupported to-widget action: `+e.detail.action}})}}replyVersions(e){this.transport.reply(e,{supported_versions:Nr})}getClientVersions(){return Array.isArray(this.cachedClientVersions)?Promise.resolve(this.cachedClientVersions):this.transport.send(L.SupportedApiVersions,{}).then(e=>(this.cachedClientVersions=e.supported_versions,e.supported_versions)).catch(e=>(console.warn(`non-fatal error getting supported client versions: `,e),[]))}handleCapabilities(e){return this.capabilitiesFinished?this.transport.reply(e,{error:{message:`Capability negotiation already completed`}}):this.getClientVersions().then(t=>(t.includes(Mr.MSC2871)?this.once(`action:${Fr.NotifyCapabilities}`,e=>{this.approvedCapabilities=e.detail.data.approved,this.emit(`ready`)}):this.emit(`ready`),this.capabilitiesFinished=!0,this.transport.reply(e,{capabilities:this.requestedCapabilities})))}},Kr=function(e){return e.Screenshots=`m.capability.screenshot`,e.StickerSending=`m.sticker`,e.AlwaysOnScreen=`m.always_on_screen`,e.RequiresClient=`io.element.requires_client`,e.MSC2931Navigate=`org.matrix.msc2931.navigate`,e.MSC3846TurnServers=`town.robin.msc3846.turn_servers`,e.MSC3973UserDirectorySearch=`org.matrix.msc3973.user_directory_search`,e.MSC4039UploadFile=`org.matrix.msc4039.upload_file`,e.MSC4039DownloadFile=`org.matrix.msc4039.download_file`,e.MSC4157SendDelayedEvent=`org.matrix.msc4157.send.delayed_event`,e.MSC4157UpdateDelayedEvent=`org.matrix.msc4157.update_delayed_event`,e.MSC4407SendStickyEvent=`org.matrix.msc4407.send.sticky_event`,e.MSC4407ReceiveStickyEvent=`org.matrix.msc4407.receive.sticky_event`,e}({});Kr.StickerSending,Kr.AlwaysOnScreen;function qr(e){let t=e.error;return typeof t==`object`&&!!t&&`message`in t&&typeof t.message==`string`}function Jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Jr(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xr(e){var t,n,r,i=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Zr(t.call(e));n=`@@asyncIterator`,r=`@@iterator`}throw TypeError(`Object is not async iterable`)}function Zr(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return Zr=function(e){this.s=e,this.n=e.next},Zr.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new Zr(e)}var Qr=function(e){return e.PendingEventsChanged=`PendingEvent.pendingEventsChanged`,e}({}),$r=class extends _{constructor(e,t,n,r,i){var a,o;super(r),a=this,this.widgetApi=e,this.capabilities=t,this.roomId=n,S(this,`room`,void 0),S(this,`widgetApiReady`,void 0),S(this,`roomStateSynced`,void 0),S(this,`lifecycle`,void 0),S(this,`syncState`,null),S(this,`pendingSendingEventsTxId`,[]),S(this,`eventEmitter`,new Jn),S(this,`syncApiResolver`,Promise.withResolvers()),S(this,`updateTxId`,function(){var e=F(function*(e){if(e.getSender()===a.getUserId()&&a.pendingSendingEventsTxId.some(t=>e.getType()===t.type)){for(var t=a.pendingSendingEventsTxId.find(t=>t.id===e.getId())?.txId;!t&&a.pendingSendingEventsTxId.length>0;)yield new Promise(e=>a.eventEmitter.once(Qr.PendingEventsChanged,()=>e())),t=a.pendingSendingEventsTxId.find(t=>t.id===e.getId())?.txId;t&&(e.setTxnId(t),e.setUnsigned(Yr(Yr({},e.getUnsigned()),{},{transaction_id:t}))),a.pendingSendingEventsTxId=a.pendingSendingEventsTxId.filter(t=>t.id!==e.getId()),a.pendingSendingEventsTxId.length===0&&a.eventEmitter.emit(Qr.PendingEventsChanged)}});return function(t){return e.apply(this,arguments)}}()),S(this,`onEvent`,function(){var e=F(function*(e){if(e.preventDefault(),e.detail.data.room_id===a.roomId){var t=new pn(e.detail.data);yield a.updateTxId(t),yield a.syncApiResolver.promise,a.syncApi instanceof or?(yield a.supportUpdateState())?yield a.syncApi.injectRoomEvents(a.room,void 0,[],[t]):yield a.syncApi.injectRoomEvents(a.room,[],void 0,[t]):(yield a.supportUpdateState())?yield a.syncApi.injectRoomEvents(a.room,[],[t]):I.error(`slididng sync cannot be used in widget mode if the client widget driver does not support the version: 'org.matrix.msc2762_update_state'`),a.emit(cr.Event,t),t.unstableStickyInfo!==void 0&&a.room._unstable_addStickyEvents([t]),a.setSyncState(Xe.Syncing),I.info(`Received event ${t.getId()} ${t.getType()}`)}else{var{event_id:n,room_id:r}=e.detail.data;I.info(`Received event ${n} for a different room ${r}; discarding`)}yield a.ack(e)});return function(t){return e.apply(this,arguments)}}()),S(this,`onToDevice`,function(){var e=F(function*(e){e.preventDefault();var t=new pn({type:e.detail.data.type,sender:e.detail.data.sender,content:e.detail.data.content});e.detail.data.encrypted&&t.makeEncrypted(j.RoomMessageEncrypted,{},``,``),a.emit(cr.ToDeviceEvent,t),a.setSyncState(Xe.Syncing),yield a.ack(e)});return function(t){return e.apply(this,arguments)}}()),S(this,`onStateUpdate`,function(){var e=F(function*(e){e.preventDefault(),(yield a.supportUpdateState())||I.warn(`received update_state widget action but the widget driver did not claim to support 'org.matrix.msc2762_update_state'`),yield a.syncApiResolver.promise;for(var t of e.detail.data.state)if(t.room_id===a.roomId){var n=new pn(t);a.syncApi instanceof or?yield a.syncApi.injectRoomEvents(a.room,void 0,[n]):yield a.syncApi.injectRoomEvents(a.room,[n]),I.debug(`Updated state entry ${n.getType()} ${n.getStateKey()} to ${n.getId()}`)}else{var{event_id:r,room_id:i}=e.detail.data;I.info(`Received state entry ${r} for a different room ${i}; discarding`)}yield a.ack(e)});return function(t){return e.apply(this,arguments)}}());var s=this.widgetApi.transport.send.bind(this.widgetApi.transport);this.widgetApi.transport.send=function(){var e=F(function*(e,t){try{return yield s(e,t)}catch(e){ei(e)}});return function(t,n){return e.apply(this,arguments)}}();var c=this.widgetApi.transport.sendComplete.bind(this.widgetApi.transport);this.widgetApi.transport.sendComplete=function(){var e=F(function*(e,t){try{return yield c(e,t)}catch(e){ei(e)}});return function(t,n){return e.apply(this,arguments)}}(),this.widgetApiReady=new Promise(e=>this.widgetApi.once(`ready`,e)),this.roomStateSynced=(o=t.receiveState)!=null&&o.length?new Promise(e=>this.widgetApi.once(`action:${Fr.UpdateState}`,e)):Promise.resolve(),this.requestInitialCapabilities(t,n),e.on(`action:${Fr.SendEvent}`,this.onEvent),e.on(`action:${Fr.SendToDevice}`,this.onToDevice),e.on(`action:${Fr.UpdateState}`,this.onStateUpdate),e.start(),i&&e.sendContentLoaded()}requestInitialCapabilities(e,t){var n,r,i,a,o,s,c,l,u,d,f,p;((n=e.sendEvent)!=null&&n.length||(r=e.receiveEvent)!=null&&r.length||e.sendMessage===!0||Array.isArray(e.sendMessage)&&e.sendMessage.length||e.receiveMessage===!0||Array.isArray(e.receiveMessage)&&e.receiveMessage.length||(i=e.sendState)!=null&&i.length||(a=e.receiveState)!=null&&a.length)&&this.widgetApi.requestCapabilityForRoomTimeline(t),(o=e.sendEvent)==null||o.forEach(e=>this.widgetApi.requestCapabilityToSendEvent(e)),(s=e.receiveEvent)==null||s.forEach(e=>this.widgetApi.requestCapabilityToReceiveEvent(e)),e.sendMessage===!0?this.widgetApi.requestCapabilityToSendMessage():Array.isArray(e.sendMessage)&&e.sendMessage.forEach(e=>this.widgetApi.requestCapabilityToSendMessage(e)),e.receiveMessage===!0?this.widgetApi.requestCapabilityToReceiveMessage():Array.isArray(e.receiveMessage)&&e.receiveMessage.forEach(e=>this.widgetApi.requestCapabilityToReceiveMessage(e)),(c=e.sendState)==null||c.forEach(e=>{var{eventType:t,stateKey:n}=e;return this.widgetApi.requestCapabilityToSendState(t,n)}),(l=e.receiveState)==null||l.forEach(e=>{var{eventType:t,stateKey:n}=e;return this.widgetApi.requestCapabilityToReceiveState(t,n)}),(u=e.sendToDevice)==null||u.forEach(e=>this.widgetApi.requestCapabilityToSendToDevice(e)),(d=e.receiveToDevice)==null||d.forEach(e=>this.widgetApi.requestCapabilityToReceiveToDevice(e)),e.sendDelayedEvents&&((f=e.sendEvent)!=null&&f.length||e.sendMessage===!0||Array.isArray(e.sendMessage)&&e.sendMessage.length||(p=e.sendState)!=null&&p.length)&&this.widgetApi.requestCapability(Kr.MSC4157SendDelayedEvent),e.updateDelayedEvents&&this.widgetApi.requestCapability(Kr.MSC4157UpdateDelayedEvent),e.sendSticky&&this.widgetApi.requestCapability(Kr.MSC4407SendStickyEvent),e.receiveSticky&&this.widgetApi.requestCapability(Kr.MSC4407ReceiveStickyEvent),e.turnServers&&this.widgetApi.requestCapability(Kr.MSC3846TurnServers)}supportUpdateState(){var e=this;return F(function*(){return(yield e.widgetApi.getClientVersions()).includes(Mr.MSC2762_UPDATE_STATE)})()}startClient(){var e=arguments,t=this;return F(function*(){var n=e.length>0&&e[0]!==void 0?e[0]:{};t.lifecycle=new AbortController;var r=t.getUserId();r&&t.store.storeUser(new Me(r)),n.slidingSync?t.syncApi=new ke(n.slidingSync,t,n,t.buildSyncApiOptions()):t.syncApi=new or(t,n,t.buildSyncApiOptions()),t.syncApiResolver.resolve(),t.room=t.syncApi.createRoom(t.roomId),t.store.storeRoom(t.room),yield t.widgetApiReady,(yield t.supportUpdateState())?yield t.roomStateSynced:yield Promise.all(t.capabilities.receiveState?.map(function(){var e=F(function*(e){var{eventType:n,stateKey:r}=e,i=(yield t.widgetApi.readStateEvents(n,void 0,r,[t.roomId])).map(e=>new pn(e));t.syncApi instanceof or?yield t.syncApi.injectRoomEvents(t.room,void 0,i):yield t.syncApi.injectRoomEvents(t.room,i),i.forEach(e=>{t.emit(cr.Event,e),I.info(`Backfilled event ${e.getId()} ${e.getType()} ${e.getStateKey()}`)})});return function(t){return e.apply(this,arguments)}}())??[]),n.clientWellKnownPollPeriod!==void 0&&(t.clientWellKnownIntervalID=setInterval(()=>{t.fetchClientWellKnown()},1e3*n.clientWellKnownPollPeriod),t.fetchClientWellKnown()),t.setSyncState(Xe.Syncing),I.info(`Finished initial sync`),t.matrixRTC.start(),t.capabilities.turnServers&&t.watchTurnServers()})()}stopClient(){this.widgetApi.off(`action:${Fr.SendEvent}`,this.onEvent),this.widgetApi.off(`action:${Fr.SendToDevice}`,this.onToDevice),this.widgetApi.off(`action:${Fr.UpdateState}`,this.onStateUpdate),super.stopClient(),this.lifecycle.abort()}joinRoom(e){var t=this;return F(function*(){if(e===t.roomId)return t.room;throw Error(`Unknown room: ${e}`)})()}encryptAndSendEvent(e,t,n,r){var i=this;return F(function*(){var a=r,o;n&<(n)?o=n:a||=n;var s=a?.[`org.matrix.msc4354.sticky_duration_ms`];if(s!==void 0&&typeof s!=`number`)throw Error(`Sticky duration must be a number when defined`);var c=s,l=t.event.redacts?Yr(Yr({},t.getContent()),{},{redacts:t.event.redacts}):t.getContent();if(o){var u=yield i.widgetApi.sendRoomEvent(t.getType(),l,e.roomId,`delay`in o?o.delay:void 0,`parent_delay_id`in o?o.parent_delay_id:void 0,c).catch(ti);return i.validateSendDelayedEventResponse(u)}var d=t.getTxnId();d&&i.pendingSendingEventsTxId.push({type:t.getType(),id:void 0,txId:d});var f;try{f=yield i.widgetApi.sendRoomEvent(t.getType(),l,e.roomId,void 0,void 0,c).catch(ti)}catch(n){throw i.updatePendingEventStatus(e,t,dr.NOT_SENT),n}return e.updatePendingEvent(t,dr.SENT,f.event_id),i.pendingSendingEventsTxId.forEach(e=>{e.txId===d&&(e.id=f.event_id)}),i.eventEmitter.emit(Qr.PendingEventsChanged),{event_id:f.event_id}})()}sendStateEvent(e,t,n){var r=arguments,i=this;return F(function*(){var a=r.length>3&&r[3]!==void 0?r[3]:``,o=yield i.widgetApi.sendStateEvent(t,a,n,e).catch(ti);if(o.event_id===void 0)throw Error(`'event_id' absent from response to an event request`);return{event_id:o.event_id}})()}_unstable_sendDelayedStateEvent(e,t,n,r){var i=arguments,a=this;return F(function*(){var o=i.length>4&&i[4]!==void 0?i[4]:``;if(!(yield a.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`sendDelayedStateEvent`);var s=yield a.widgetApi.sendStateEvent(n,o,r,e,`delay`in t?t.delay:void 0,`parent_delay_id`in t?t.parent_delay_id:void 0).catch(ti);return a.validateSendDelayedEventResponse(s)})()}validateSendDelayedEventResponse(e){if(e.delay_id===void 0)throw Error(`'delay_id' absent from response to a delayed event request`);return{delay_id:e.delay_id}}_unstable_updateDelayedEvent(e,t){var n=this;return F(function*(){if(!(yield n.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`updateDelayedEvent`);var r;switch(t){case tt.Cancel:r=n.widgetApi.cancelScheduledDelayedEvent;break;case tt.Restart:r=n.widgetApi.cancelScheduledDelayedEvent;break;case tt.Send:r=n.widgetApi.sendScheduledDelayedEvent;break}return yield r.call(n.widgetApi,e).catch(ti),{}})()}_unstable_cancelScheduledDelayedEvent(e){var t=this;return F(function*(){if(!(yield t.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`cancelScheduledDelayedEvent`);return yield t.widgetApi.cancelScheduledDelayedEvent(e).catch(ti),{}})()}_unstable_restartScheduledDelayedEvent(e){var t=this;return F(function*(){if(!(yield t.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`restartScheduledDelayedEvent`);return yield t.widgetApi.restartScheduledDelayedEvent(e).catch(ti),{}})()}_unstable_sendScheduledDelayedEvent(e){var t=this;return F(function*(){if(!(yield t.doesServerSupportUnstableFeature(`org.matrix.msc4140`)))throw new It(`Server does not support the delayed events API`,`sendScheduledDelayedEvent`);return yield t.widgetApi.sendScheduledDelayedEvent(e).catch(ti),{}})()}encryptAndSendToDevice(e,t,n){var r=this;return F(function*(){var i=new mn(()=>new Map);for(var{userId:a,deviceId:o}of t)i.getOrCreate(a).set(o,n);yield r.widgetApi.sendToDevice(e,!0,Jt(i)).catch(ti)})()}sendToDevice(e,t){var n=this;return F(function*(){return yield n.widgetApi.sendToDevice(e,!1,Jt(t)).catch(ti),{}})()}getOpenIdToken(){var e=this;return F(function*(){var t=yield e.widgetApi.requestOpenIDConnectToken().catch(ti);return{access_token:t.access_token,expires_in:t.expires_in,matrix_server_name:t.matrix_server_name,token_type:t.token_type}})()}queueToDevice(e){var t=this;return F(function*(){var{eventType:n,batch:r}=e,i=new mn(()=>new Map);for(var{userId:a,deviceId:o,payload:s}of r)i.getOrCreate(a).set(o,s);yield t.widgetApi.sendToDevice(n,!1,Jt(i)).catch(ti)})()}sendToDeviceViaWidgetApi(e,t,n){var r=this;return F(function*(){yield r.widgetApi.sendToDevice(e,t,Jt(n)).catch(ti)})()}checkTurnServers(){var e=this;return F(function*(){return e.turnServers.length>0})()}getSyncState(){return this.syncState}setSyncState(e){var t=this.syncState;this.syncState=e,this.emit(cr.Sync,e,t)}ack(e){var t=this;return F(function*(){yield t.widgetApi.transport.reply(e.detail,{})})()}watchTurnServers(){var e=this;return F(function*(){var t=e.widgetApi.getTurnServers(),n=()=>{t.return(void 0)};e.lifecycle.signal.addEventListener(`abort`,n);try{var r=!1,i=!1,a;try{for(var o=Xr(t),s;r=!(s=yield o.next()).done;r=!1){var c=s.value;e.turnServers=[{urls:c.uris,username:c.username,credential:c.password}],e.emit(cr.TurnServers,e.turnServers),I.log(`Received TURN server: ${c.uris}`)}}catch(e){i=!0,a=e}finally{try{r&&o.return!=null&&(yield o.return())}finally{if(i)throw a}}}catch(e){I.warn(`Error watching TURN servers`,e)}finally{e.lifecycle.signal.removeEventListener(`abort`,n)}})()}};function ei(e){throw e instanceof Wr&&e.data.matrix_api_error?ee.fromWidgetApiErrorData(e.data.matrix_api_error):e}function ti(e){throw e instanceof Error&&e.message===`Request timed out`?new $e(`widget api timeout`):e}var ni=class{constructor(){S(this,`unthreadedReadReceipts`,new Map),S(this,`threadedReadReceipts`,new mn(()=>new Map))}setUnthreaded(e,t){this.unthreadedReadReceipts.set(e,t)}setThreaded(e,t,n){this.threadedReadReceipts.getOrCreate(e).set(t,n)}allUnthreaded(){return this.unthreadedReadReceipts.entries()}*allThreaded(){for(var e of this.threadedReadReceipts.values())for(var t of e.entries())yield t}consumeEphemeralEvents(e){e?.forEach(e=>{e.type!==j.Receipt||!e.content||Object.keys(e.content).forEach(t=>{Object.entries(e.content[t]).forEach(n=>{var[r,i]=n;if(jn(r))for(var a of Object.keys(i)){var o=e.content[t][r][a],s={data:e.content[t][r][a],type:r,eventId:t};o.thread_id?this.setThreaded(o.thread_id,a,s):this.setUnthreaded(a,s)}})})})}buildAccumulatedReceiptEvent(e){var t={type:j.Receipt,room_id:e,content:{}},n=new mn(()=>new mn(()=>new Map));for(var[r,i]of this.allUnthreaded())n.getOrCreate(i.eventId).getOrCreate(i.type).set(r,i.data);for(var[a,o]of this.allThreaded())n.getOrCreate(o.eventId).getOrCreate(o.type).set(a,o.data);return t.content=Jt(n),n.size>0?t:null}},ri=function(e){return e.Invite=`invite`,e.Leave=`leave`,e.Join=`join`,e.Knock=`knock`,e}({});function ii(e){return`_localTs`in e&&e._localTs!==void 0}var ai=class{constructor(){this.opts=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},S(this,`accountData`,{}),S(this,`inviteRooms`,{}),S(this,`knockRooms`,{}),S(this,`joinRooms`,{}),S(this,`nextBatch`,null),this.opts.maxTimelineEntries=this.opts.maxTimelineEntries||50}accumulate(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.accumulateRooms(e,t),this.accumulateAccountData(e),this.nextBatch=e.next_batch}accumulateAccountData(e){!e.account_data||!e.account_data.events||e.account_data.events.forEach(e=>{this.accountData[e.type]=e})}accumulateRooms(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e.rooms&&(e.rooms.invite&&Object.keys(e.rooms.invite).forEach(n=>{this.accumulateRoom(n,ri.Invite,e.rooms.invite[n],t)}),e.rooms.join&&Object.keys(e.rooms.join).forEach(n=>{this.accumulateRoom(n,ri.Join,e.rooms.join[n],t)}),e.rooms.leave&&Object.keys(e.rooms.leave).forEach(n=>{this.accumulateRoom(n,ri.Leave,e.rooms.leave[n],t)}),e.rooms.knock&&Object.keys(e.rooms.knock).forEach(n=>{this.accumulateRoom(n,ri.Knock,e.rooms.knock[n],t)}))}accumulateRoom(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;switch(t){case ri.Invite:this.knockRooms[e]&&delete this.knockRooms[e],this.accumulateInviteState(e,n);break;case ri.Knock:this.accumulateKnockState(e,n);break;case ri.Join:this.knockRooms[e]?delete this.knockRooms[e]:this.inviteRooms[e]&&delete this.inviteRooms[e],this.accumulateJoinState(e,n,r);break;case ri.Leave:this.knockRooms[e]?delete this.knockRooms[e]:this.inviteRooms[e]?delete this.inviteRooms[e]:delete this.joinRooms[e];break;default:I.error(`Unknown cateogory: `,t)}}accumulateInviteState(e,t){if(!(!t.invite_state||!t.invite_state.events)){if(!this.inviteRooms[e]){this.inviteRooms[e]={invite_state:t.invite_state};return}var n=this.inviteRooms[e];t.invite_state.events.forEach(e=>{for(var t=!1,r=0;r<n.invite_state.events.length;r++){var i=n.invite_state.events[r];i.type===e.type&&i.state_key==e.state_key&&(n.invite_state.events[r]=e,t=!0)}t||n.invite_state.events.push(e)})}}accumulateKnockState(e,t){if(!(!t.knock_state||!t.knock_state.events)){if(!this.knockRooms[e]){this.knockRooms[e]={knock_state:t.knock_state};return}var n=this.knockRooms[e];t.knock_state.events.forEach(e=>{for(var t=!1,r=0;r<n.knock_state.events.length;r++){var i=n.knock_state.events[r];i.type===e.type&&i.state_key==e.state_key&&(n.knock_state.events[r]=e,t=!0)}t||n.knock_state.events.push(e)})}}accumulateJoinState(e,t){var n,r,i,a,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=Date.now();this.joinRooms[e]||(this.joinRooms[e]={_currentState:Object.create(null),_timeline:[],_accountData:Object.create(null),_unreadNotifications:{},_unreadThreadNotifications:{},_summary:{},_receipts:new ni,_stickyEvents:[]});var c=this.joinRooms[e];if(t.account_data&&t.account_data.events&&t.account_data.events.forEach(e=>{c._accountData[e.type]=e}),t.unread_notifications&&(c._unreadNotifications=t.unread_notifications),c._unreadThreadNotifications=t[rr.stable]??t[rr.unstable]??void 0,t.summary){var l=`m.heroes`,u=`m.invited_member_count`,d=`m.joined_member_count`,f=c._summary,p=t.summary;f[l]=p[l]??f[l],f[d]=p[d]??f[d],f[u]=p[u]??f[u]}if(c._receipts.consumeEphemeralEvents(t.ephemeral?.events),t.timeline&&t.timeline.limited&&(c._timeline=[]),(n=t.state)==null||(n=n.events)==null||n.forEach(e=>{oi(c._currentState,e)}),(r=t[`org.matrix.msc4222.state_after`])==null||(r=r.events)==null||r.forEach(e=>{oi(c._currentState,e)}),(i=t.timeline)==null||(i=i.events)==null||i.forEach((e,n)=>{t[`org.matrix.msc4222.state_after`]||oi(c._currentState,e);var r;if(o)r=e;else{r=Object.assign({},e),r.unsigned!==void 0&&(r.unsigned=Object.assign({},r.unsigned));var i=e.unsigned?.age;i!==void 0&&(r._localTs=Date.now()-i)}c._timeline.push({event:r,token:n===0?t.timeline.prev_batch??null:null})}),c._stickyEvents=c._stickyEvents.filter(e=>{var{expiresTs:t}=e;return t>s}),(a=t.msc4354_sticky)!=null&&a.events&&(c._stickyEvents=c._stickyEvents.concat(t.msc4354_sticky.events.map(e=>({event:e,expiresTs:Math.min(e.msc4354_sticky.duration_ms,Nt)+Math.min(e.origin_server_ts,s)})))),c._timeline.length>this.opts.maxTimelineEntries){for(var m=c._timeline.length-this.opts.maxTimelineEntries;m<c._timeline.length;m++)if(c._timeline[m].token){c._timeline=c._timeline.slice(m,c._timeline.length);break}}}getJSON(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t={join:{},invite:{},knock:{},leave:{}};Object.keys(this.inviteRooms).forEach(e=>{t.invite[e]=this.inviteRooms[e]}),Object.keys(this.knockRooms).forEach(e=>{t.knock[e]=this.knockRooms[e]}),Object.keys(this.joinRooms).forEach(n=>{var r,i=this.joinRooms[n],a={ephemeral:{events:[]},account_data:{events:[]},state:{events:[]},"org.matrix.msc4222.state_after":{events:[]},timeline:{events:[],prev_batch:null},unread_notifications:i._unreadNotifications,unread_thread_notifications:i._unreadThreadNotifications,summary:i._summary,msc4354_sticky:(r=i._stickyEvents)!=null&&r.length?{events:i._stickyEvents.map(e=>e.event)}:void 0};Object.keys(i._accountData).forEach(e=>{a.account_data.events.push(i._accountData[e])});var o=i._receipts.buildAccumulatedReceiptEvent(n);o&&a.ephemeral.events.push(o),i._timeline.forEach(t=>{if(!a.timeline.prev_batch){if(!t.token)return;a.timeline.prev_batch=t.token}var n;!e&&ii(t.event)?(n=Object.assign({},t.event),n.unsigned!==void 0&&(n.unsigned=Object.assign({},n.unsigned)),delete n._localTs,n.unsigned=n.unsigned||{},n.unsigned.age=Date.now()-t.event._localTs):n=t.event,a.timeline.events.push(n)});for(var s=Object.create(null),c=a.timeline.events.length-1;c>=0;c--){var l=a.timeline.events[c];if(!(l.state_key===null||l.state_key===void 0)){var u=Lt(l);u.unsigned&&(u.unsigned.prev_content&&(u.content=u.unsigned.prev_content),u.unsigned.prev_sender&&(u.sender=u.unsigned.prev_sender)),oi(s,u)}}Object.keys(i._currentState).forEach(e=>{Object.keys(i._currentState[e]).forEach(t=>{var n=i._currentState[e][t];a[`org.matrix.msc4222.state_after`].events.push(n),s[e]&&s[e][t]&&(n=s[e][t]),a.state.events.push(n)})}),t.join[n]=a});var n=[];return Object.keys(this.accountData).forEach(e=>{n.push(this.accountData[e])}),{nextBatch:this.nextBatch,roomsData:t,accountData:n}}getNextBatchToken(){return this.nextBatch}};function oi(e,t){t.state_key===null||t.state_key===void 0||!t.type||(e[t.type]||(e[t.type]=Object.create(null)),e[t.type][t.state_key]=t)}var si=10,ci=class{constructor(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.client=e,this.timelineSet=t,S(this,`windowLimit`,void 0),S(this,`start`,void 0),S(this,`end`,void 0),S(this,`eventCount`,0),this.windowLimit=r.windowLimit||1e3,(n=t.room)==null||n.on(je.Timeline,this.onTimelineEvent.bind(this))}load(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,n=n=>{if(!n)throw Error(`No timeline given to initFields`);var r,i=n.getEvents();if(!e)r=i.length;else if(r=i.findIndex(t=>t.getId()===e),r<0)throw Error(`getEventTimeline result didn't include requested event`);var a=Math.min(i.length,r+Math.ceil(t/2)),o=Math.max(0,a-t);this.start=new li(n,o-n.getBaseIndex()),this.end=new li(n,a-n.getBaseIndex()),this.eventCount=a-o};return this.timelineSet.getTimelineForEvent(e)?(n(this.timelineSet.getTimelineForEvent(e)),Promise.resolve()):e?this.client.getEventTimeline(this.timelineSet,e).then(n):(n(this.timelineSet.getLiveTimeline()),Promise.resolve())}getTimelineIndex(e){if(e==w.BACKWARDS)return this.start??null;if(e==w.FORWARDS)return this.end??null;throw Error(`Invalid direction '`+e+`'`)}extend(e,t){var n=this.getTimelineIndex(e);if(!n)return!1;var r=e==w.BACKWARDS?n.retreat(t):n.advance(t);if(r){this.eventCount+=r,``+r+this.eventCount;var i=this.eventCount-this.windowLimit;return i>0&&this.unpaginate(i,e!=w.BACKWARDS),!0}return!1}onTimelineEvent(e,t,n,r){r&&this.onEventRemoved()}onEventRemoved(){var e=this.getEvents();e.length>0&&e[e.length-1]===void 0&&this.end&&this.end.index--}canPaginate(e){var t=this.getTimelineIndex(e);if(!t)return!1;if(e==w.BACKWARDS){if(t.index>t.minIndex())return!0}else if(t.index<t.maxIndex())return!0;var n=t.timeline.getNeighbouringTimeline(e),r=t.timeline.getPaginationToken(e);return!!n||!!r}paginate(e,t){var n=arguments,r=this;return F(function*(){var i=n.length>2&&n[2]!==void 0?n[2]:!0,a=n.length>3&&n[3]!==void 0?n[3]:si,o=r.getTimelineIndex(e);if(!o)return!1;if(o.pendingPaginate)return o.pendingPaginate;if(r.extend(e,t))return!0;if(!i||a===0||!o.timeline.getPaginationToken(e))return!1;var s=r.client.paginateEventTimeline(o.timeline,{backwards:e==w.BACKWARDS,limit:t}).finally(function(){o.pendingPaginate=void 0}).then(n=>(``+n,n?r.paginate(e,t,!0,a-1):r.paginate(e,t,!1,0)));return o.pendingPaginate=s,s})()}unpaginate(e,t){var n=t?this.start:this.end;if(!n)throw Error(`Attempting to unpaginate startOfTimeline=${t} but don't have this direction`);if(e>this.eventCount||e<0)throw Error(`Attemting to unpaginate ${e} events, but only have ${this.eventCount} in the timeline`);for(;e>0;){var r=t?n.advance(e):n.retreat(e);if(r<=0)throw Error(`Unable to unpaginate any further, but still have `+this.eventCount+` events`);e-=r,this.eventCount-=r,``+r+this.eventCount}}getEvents(){if(!this.start)return[];for(var e=[],t=this.start.timeline;t;){var n=t.getEvents(),r=0,i=n.length;t===this.start.timeline&&(r=this.start.index+t.getBaseIndex()),t===this.end?.timeline&&(i=this.end.index+t.getBaseIndex());for(var a=r;a<i;a++)e.push(n[a]);if(t===this.end?.timeline)break;t=t.getNeighbouringTimeline(w.FORWARDS)}return e}},li=class{constructor(e,t){this.timeline=e,this.index=t,S(this,`pendingPaginate`,void 0)}minIndex(){return this.timeline.getBaseIndex()*-1}maxIndex(){return this.timeline.getEvents().length-this.timeline.getBaseIndex()}advance(e){if(!e)return 0;var t;if(e<0){if(t=Math.max(e,this.minIndex()-this.index),t<0)return this.index+=t,t}else if(t=Math.min(e,this.maxIndex()-this.index),t>0)return this.index+=t,t;var n=this.timeline.getNeighbouringTimeline(e<0?w.BACKWARDS:w.FORWARDS);return n?(this.timeline=n,e<0?this.index=this.maxIndex():this.index=this.minIndex(),this.advance(e)):0}retreat(e){return this.advance(e*-1)*-1}},ui=`m.login.email.identity`,di=`m.login.msisdn`,fi=function(e){return e.Password=`m.login.password`,e.Recaptcha=`m.login.recaptcha`,e.Terms=`m.login.terms`,e.Email=`m.login.email.identity`,e.Msisdn=`m.login.msisdn`,e.Sso=`m.login.sso`,e.SsoUnstable=`org.matrix.login.sso`,e.Dummy=`m.login.dummy`,e.RegistrationToken=`m.login.registration_token`,e.UnstableRegistrationToken=`org.matrix.msc3231.login.registration_token`,e.OAuth=`m.oauth`,e}({}),pi=class extends Error{constructor(e,t,n){super(e),this.required_stages=t,this.flows=n,S(this,`name`,`NoAuthFlowFoundError`)}},mi=class{constructor(e){var t=this;S(this,`matrixClient`,void 0),S(this,`inputs`,void 0),S(this,`clientSecret`,void 0),S(this,`requestCallback`,void 0),S(this,`busyChangedCallback`,void 0),S(this,`stateUpdatedCallback`,void 0),S(this,`requestEmailTokenCallback`,void 0),S(this,`supportedStages`,void 0),S(this,`data`,void 0),S(this,`emailSid`,void 0),S(this,`requestingEmailToken`,!1),S(this,`attemptAuthDeferred`,null),S(this,`chosenFlow`,null),S(this,`currentStage`,null),S(this,`emailAttempt`,1),S(this,`submitPromise`,null),S(this,`requestEmailToken`,F(function*(){if(t.requestingEmailToken)I.warn(`Could not request email token: Already requesting`);else{I.trace(`Requesting email token. Attempt: `+t.emailAttempt),t.requestingEmailToken=!0;try{t.emailSid=(yield t.requestEmailTokenCallback(t.inputs.emailAddress,t.clientSecret,t.emailAttempt++,t.data.session)).sid,I.trace(`Email token request succeeded`)}finally{t.requestingEmailToken=!1}}})),this.matrixClient=e.matrixClient,this.data=e.authData||{flows:[]},this.requestCallback=e.doRequest,this.busyChangedCallback=e.busyChanged,this.stateUpdatedCallback=e.stateUpdated||e.startAuthStage,this.requestEmailTokenCallback=e.requestEmailToken,this.inputs=e.inputs||{},e.sessionId&&(this.data.session=e.sessionId),this.clientSecret=e.clientSecret||this.matrixClient.generateClientSecret(),this.emailSid=e.emailSid,e.supportedStages!==void 0&&(this.supportedStages=new Set(e.supportedStages))}attemptAuth(){var e=this;return F(function*(){var t;e.attemptAuthDeferred=Promise.withResolvers();var n=e.attemptAuthDeferred.promise;if((t=e.data)!=null&&(t=t.flows)!=null&&t.length)e.startNextAuthStage();else{var r;(r=e.busyChangedCallback)==null||r.call(e,!0);var i=e.data.session?{session:e.data.session}:null;e.doRequest(i).finally(()=>{var t;(t=e.busyChangedCallback)==null||t.call(e,!1)})}return n})()}poll(){var e=this;return F(function*(){if(e.data.session&&e.attemptAuthDeferred&&!e.submitPromise){var t={};if(e.currentStage==ui&&e.emailSid){var n={sid:e.emailSid,client_secret:e.clientSecret},r=e.matrixClient.getIdentityServerUrl();r&&(n.id_server=new URL(r).host),t={type:ui,threepid_creds:n}}e.submitAuthDict(t,!0)}})()}getSessionId(){return this.data?.session}getClientSecret(){return this.clientSecret}getStageParams(e){var t;return(t=this.data)==null||(t=t.params)==null?void 0:t[e]}getChosenFlow(){return this.chosenFlow}submitAuthDict(e){var t=arguments,n=this;return F(function*(){var r,i=t.length>1&&t[1]!==void 0?t[1]:!1;if(!n.attemptAuthDeferred)throw Error(`submitAuthDict() called before attemptAuth()`);if(!i){var a;(a=n.busyChangedCallback)==null||a.call(n,!0)}for(;n.submitPromise;)try{yield n.submitPromise}catch{}var o=(r=n.data)!=null&&r.session?Object.assign({session:n.data.session},e):e;try{n.submitPromise=n.doRequest(o,i),yield n.submitPromise}finally{if(n.submitPromise=null,!i){var s;(s=n.busyChangedCallback)==null||s.call(n,!1)}}})()}getEmailSid(){return this.emailSid}setEmailSid(e){this.emailSid=e}doRequest(e){var t=arguments,n=this;return F(function*(){var r=t.length>1&&t[1]!==void 0?t[1]:!1;try{var i=yield n.requestCallback(e,r);n.attemptAuthDeferred.resolve(i),n.attemptAuthDeferred=null}catch(e){var a,o,s=e instanceof ee?e:null,c=(s==null||(a=s.data)==null?void 0:a.flows)??null,l=n.data?.flows||!!c;if(!s||s.httpStatus!==401||!s.data||!l)if(r)I.log(`Background poll request failed doing UI auth: ignoring`,e);else{var u;(u=n.attemptAuthDeferred)==null||u.reject(e)}s&&!s.data&&(s.data={}),s&&!s.data.flows&&!s.data.completed&&!s.data.session&&(s.data.flows=n.data.flows,s.data.completed=n.data.completed,s.data.session=n.data.session),s&&(n.data=s.data);try{n.startNextAuthStage()}catch(e){n.attemptAuthDeferred.reject(e),n.attemptAuthDeferred=null;return}if(!n.emailSid&&(o=n.chosenFlow)!=null&&o.stages.includes(fi.Email))try{yield n.requestEmailToken()}catch(e){n.attemptAuthDeferred.reject(e),n.attemptAuthDeferred=null}}})()}startNextAuthStage(){var e,t,n=this.chooseStage();if(!n)throw Error(`No incomplete flows from the server`);if(this.currentStage=n,n===fi.Dummy){this.submitAuthDict({type:`m.login.dummy`});return}if((e=this.data)!=null&&e.errcode||(t=this.data)!=null&&t.error){this.stateUpdatedCallback(n,{errcode:this.data?.errcode||``,error:this.data?.error||``});return}this.stateUpdatedCallback(n,n===ui?{emailSid:this.emailSid}:{})}chooseStage(){this.chosenFlow===null&&(this.chosenFlow=this.chooseFlow()),I.log(`Active flow => %s`,JSON.stringify(this.chosenFlow));var e=this.firstUncompletedStage(this.chosenFlow);return I.log(`Next stage: %s`,e),e}scoreFlow(e){var t=e.stages.length;return this.supportedStages!==void 0&&(t+=e.stages.filter(e=>!this.supportedStages.has(e)).length*10),t}chooseFlow(){var e=this.data?.flows||[],t=!!this.inputs.emailAddress||!!this.emailSid,n=!!this.inputs.phoneCountry&&!!this.inputs.phoneNumber;e.sort((e,t)=>this.scoreFlow(e)-this.scoreFlow(t));for(var r of e){var i=!1,a=!1;for(var o of r.stages)o===ui?i=!0:o==di&&(a=!0);if(i==t&&a==n)return r}var s=[];throw t&&s.push(ui),n&&s.push(di),new pi(`No appropriate authentication flow found`,s,e)}firstUncompletedStage(e){var t=this.data?.completed||[];return e.stages.find(e=>!t.includes(e))}},hi=[e=>{e.createObjectStore(`users`,{keyPath:[`userId`]}),e.createObjectStore(`accountData`,{keyPath:[`type`]}),e.createObjectStore(`sync`,{keyPath:[`clobber`]})},e=>{e.createObjectStore(`oob_membership_events`,{keyPath:[`room_id`,`state_key`]}).createIndex(`room`,`room_id`)},e=>{e.createObjectStore(`client_options`,{keyPath:[`clobber`]})},e=>{e.createObjectStore(`to_device_queue`,{autoIncrement:!0})}],gi=hi.length;function _i(e,t,n){var r=e.openCursor(t);return new Promise((t,i)=>{var a=[];r.onerror=()=>{i(Error(`selectQuery failed for ${e.name}`,{cause:r.error}))},r.onsuccess=()=>{var e=r.result;if(!e){t(a);return}a.push(n(e)),e.continue()}})}function vi(e){return new Promise((t,n)=>{e.oncomplete=function(e){t(e)},e.onerror=function(){n(e.error)}})}function yi(e){return new Promise((t,n)=>{e.onsuccess=function(e){t(e)},e.onerror=function(){n(e.error)}})}function bi(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e),e.onerror=e=>n(e)})}function xi(e){return yi(e).then(t=>e.result)}var Si=class{static exists(e,t){return t=`matrix-js-sdk:`+(t||`default`),Rn(e,t)}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`default`;this.indexedDB=e,S(this,`dbName`,void 0),S(this,`syncAccumulator`,void 0),S(this,`db`,void 0),S(this,`disconnected`,!0),S(this,`_isNewlyCreated`,!1),S(this,`syncToDatabasePromise`,void 0),S(this,`pendingUserPresenceData`,[]),this.dbName=`matrix-js-sdk:`+t,this.syncAccumulator=new ai}connect(e){var t=this;if(!this.disconnected)return I.log(`LocalIndexedDBStoreBackend.connect: already connected or connecting`),Promise.resolve();this.disconnected=!1,I.log(`LocalIndexedDBStoreBackend.connect: connecting...`);var n=this.indexedDB.open(this.dbName,gi);return n.onupgradeneeded=e=>{var t=n.result,r=e.oldVersion;I.log(`LocalIndexedDBStoreBackend.connect: upgrading from ${r}`),r<1&&(this._isNewlyCreated=!0),hi.forEach((e,n)=>{r<=n&&e(t)})},n.onblocked=()=>{I.log(`can't yet open LocalIndexedDBStoreBackend because it is open elsewhere`)},I.log(`LocalIndexedDBStoreBackend.connect: awaiting connection...`),yi(n).then(F(function*(){I.log(`LocalIndexedDBStoreBackend.connect: connected`),t.db=n.result,t.db.onversionchange=()=>{var e;(e=t.db)==null||e.close(),t.disconnected=!0,t.db=void 0},t.db.onclose=()=>{t.disconnected=!0,t.db=void 0,e?.()},yield t.init()}))}isNewlyCreated(){return Promise.resolve(this._isNewlyCreated)}init(){return Promise.all([this.loadAccountData(),this.loadSyncData()]).then(e=>{var[t,n]=e;I.log(`LocalIndexedDBStoreBackend: loaded initial data`),this.syncAccumulator.accumulate({next_batch:n.nextBatch,rooms:n.roomsData,account_data:{events:t}},!0)})}getOutOfBandMembers(e){return new Promise((t,n)=>{var r=this.db.transaction([`oob_membership_events`],`readonly`).objectStore(`oob_membership_events`).index(`room`),i=IDBKeyRange.only(e),a=r.openCursor(i),o=[],s=!1;a.onsuccess=()=>{var e=a.result;if(!e)return!o.length&&!s?t(null):t(o);var n=e.value;n.oob_written?s=!0:o.push(n),e.continue()},a.onerror=e=>{n(e)}}).then(t=>(I.log(`LL: got ${t?.length} membershipEvents from storage for room ${e} ...`),t))}setOutOfBandMembers(e,t){var n=this;return F(function*(){I.log(`LL: backend about to store ${t.length} members for ${e}`);var r=n.db.transaction([`oob_membership_events`],`readwrite`),i=r.objectStore(`oob_membership_events`);t.forEach(e=>{i.put(e)});var a={room_id:e,oob_written:!0,state_key:0};i.put(a),yield vi(r),I.log(`LL: backend done storing for ${e}!`)})()}clearOutOfBandMembers(e){var t=this;return F(function*(){var n=t.db.transaction([`oob_membership_events`],`readonly`).objectStore(`oob_membership_events`).index(`room`),r=IDBKeyRange.only(e),i=xi(n.openKeyCursor(r,`next`)).then(e=>(e?.primaryKey)[1]),a=xi(n.openKeyCursor(r,`prev`)).then(e=>(e?.primaryKey)[1]),[o,s]=yield Promise.all([i,a]),c=t.db.transaction([`oob_membership_events`],`readwrite`).objectStore(`oob_membership_events`),l=IDBKeyRange.bound([e,o],[e,s]);I.log(`LL: Deleting all users + marker in storage for room ${e}, with key range:`,[e,o],[e,s]),yield bi(c.delete(l))})()}clearDatabase(){return new Promise(e=>{var t;I.log(`Removing indexeddb instance: ${this.dbName}`),(t=this.db)==null||t.close();var n=this.indexedDB.deleteDatabase(this.dbName);n.onblocked=()=>{I.log(`can't yet delete indexeddb ${this.dbName} because it is open elsewhere`)},n.onerror=()=>{I.warn(`unable to delete js-sdk store indexeddb: ${n.error?.name}`),e()},n.onsuccess=()=>{I.log(`Removed indexeddb instance: ${this.dbName}`),e()}})}getSavedSync(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=this.syncAccumulator.getJSON();return t.nextBatch?e?Promise.resolve(Lt(t)):Promise.resolve(t):Promise.resolve(null)}getNextBatchToken(){return Promise.resolve(this.syncAccumulator.getNextBatchToken())}setSyncData(e){return Promise.resolve().then(()=>{this.syncAccumulator.accumulate(e)})}syncToDatabase(e){var t=this;return F(function*(){return t.syncToDatabasePromise?(I.warn(`Skipping syncToDatabase() as persist already in flight`),t.pendingUserPresenceData.push(...e),t.syncToDatabasePromise):(e.unshift(...t.pendingUserPresenceData),t.syncToDatabasePromise=t.doSyncToDatabase(e),t.syncToDatabasePromise)})()}doSyncToDatabase(e){var t=this;return F(function*(){try{var n=t.syncAccumulator.getJSON(!0);yield Promise.all([t.persistUserPresenceEvents(e),t.persistAccountData(n.accountData),t.persistSyncData(n.nextBatch,n.roomsData)])}finally{t.syncToDatabasePromise=void 0}})()}persistSyncData(e,t){return I.log(`Persisting sync data up to`,e),Qt(()=>{var n=this.db.transaction([`sync`],`readwrite`);return n.objectStore(`sync`).put({clobber:`-`,nextBatch:e,roomsData:t}),vi(n).then(()=>{I.log(`Persisted sync data up to`,e)})})}persistAccountData(e){return Qt(()=>{var t=this.db.transaction([`accountData`],`readwrite`),n=t.objectStore(`accountData`);for(var r of e)n.put(r);return vi(t).then()})}persistUserPresenceEvents(e){return Qt(()=>{var t=this.db.transaction([`users`],`readwrite`),n=t.objectStore(`users`);for(var r of e)n.put({userId:r[0],event:r[1]});return vi(t).then()})}getUserPresenceEvents(){return Qt(()=>_i(this.db.transaction([`users`],`readonly`).objectStore(`users`),void 0,e=>[e.value.userId,e.value.event]))}loadAccountData(){return I.log(`LocalIndexedDBStoreBackend: loading account data...`),Qt(()=>_i(this.db.transaction([`accountData`],`readonly`).objectStore(`accountData`),void 0,e=>e.value).then(e=>(I.log(`LocalIndexedDBStoreBackend: loaded account data`),e)))}loadSyncData(){return I.log(`LocalIndexedDBStoreBackend: loading sync data...`),Qt(()=>_i(this.db.transaction([`sync`],`readonly`).objectStore(`sync`),void 0,e=>e.value).then(e=>(I.log(`LocalIndexedDBStoreBackend: loaded sync data`),e.length>1&&I.warn(`loadSyncData: More than 1 sync row found.`),e.length>0?e[0]:{})))}getClientOptions(){return Promise.resolve().then(()=>_i(this.db.transaction([`client_options`],`readonly`).objectStore(`client_options`),void 0,e=>e.value?.options).then(e=>e[0]))}storeClientOptions(e){var t=this;return F(function*(){var n=t.db.transaction([`client_options`],`readwrite`);n.objectStore(`client_options`).put({clobber:`-`,options:e}),yield vi(n)})()}saveToDeviceBatches(e){var t=this;return F(function*(){var n=t.db.transaction([`to_device_queue`],`readwrite`),r=n.objectStore(`to_device_queue`);for(var i of e)r.add(i);yield vi(n)})()}getOldestToDeviceBatch(){var e=this;return F(function*(){var t=yield xi(e.db.transaction([`to_device_queue`],`readonly`).objectStore(`to_device_queue`).openCursor());if(!t)return null;var n=t.value;return{id:t.key,txnId:n.txnId,eventType:n.eventType,batch:n.batch}})()}removeToDeviceBatch(e){var t=this;return F(function*(){var n=t.db.transaction([`to_device_queue`],`readwrite`);n.objectStore(`to_device_queue`).delete(e),yield vi(n)})()}destroy(){var e=this;return F(function*(){var t;(t=e.db)==null||t.close()})()}},Ci=class{constructor(e,t){this.workerFactory=e,this.dbName=t,S(this,`worker`,void 0),S(this,`nextSeq`,0),S(this,`inFlight`,{}),S(this,`startPromise`,void 0),S(this,`onWorkerMessage`,e=>{var t=e.data;if(t.command==`closed`){var n;(n=this.onClose)==null||n.call(this)}else if(t.command==`cmd_success`||t.command==`cmd_fail`){if(t.seq===void 0){I.error(`Got reply from worker with no seq`);return}var r=this.inFlight[t.seq];if(r===void 0){I.error(`Got reply for unknown seq `+t.seq);return}if(delete this.inFlight[t.seq],t.command==`cmd_success`)r.resolve(t.result);else{var i=Error(t.error.message);i.name=t.error.name,r.reject(i)}}else I.warn(`Unrecognised message from worker: `,t)})}connect(e){return this.onClose=e,this.ensureStarted().then(()=>this.doCmd(`connect`))}clearDatabase(){return this.ensureStarted().then(()=>this.doCmd(`clearDatabase`))}isNewlyCreated(){return this.doCmd(`isNewlyCreated`)}getSavedSync(){return this.doCmd(`getSavedSync`)}getNextBatchToken(){return this.doCmd(`getNextBatchToken`)}setSyncData(e){return this.doCmd(`setSyncData`,[e])}syncToDatabase(e){return this.doCmd(`syncToDatabase`,[e])}getOutOfBandMembers(e){return this.doCmd(`getOutOfBandMembers`,[e])}setOutOfBandMembers(e,t){return this.doCmd(`setOutOfBandMembers`,[e,t])}clearOutOfBandMembers(e){return this.doCmd(`clearOutOfBandMembers`,[e])}getClientOptions(){return this.doCmd(`getClientOptions`)}storeClientOptions(e){return this.doCmd(`storeClientOptions`,[e])}getUserPresenceEvents(){return this.doCmd(`getUserPresenceEvents`)}saveToDeviceBatches(e){var t=this;return F(function*(){return t.doCmd(`saveToDeviceBatches`,[e])})()}getOldestToDeviceBatch(){var e=this;return F(function*(){return e.doCmd(`getOldestToDeviceBatch`)})()}removeToDeviceBatch(e){var t=this;return F(function*(){return t.doCmd(`removeToDeviceBatch`,[e])})()}ensureStarted(){return this.startPromise||=(this.worker=this.workerFactory(),this.worker.onmessage=this.onWorkerMessage,this.doCmd(`setupWorker`,[this.dbName]).then(()=>{I.log(`IndexedDB worker is ready`)})),this.startPromise}doCmd(e,t){return Promise.resolve().then(()=>{var n,r=this.nextSeq++,i=Promise.withResolvers();return this.inFlight[r]=i,(n=this.worker)==null||n.postMessage({command:e,seq:r,args:t}),i.promise})}destroy(){var e=this;return F(function*(){var t;(t=e.worker)==null||t.terminate()})()}},wi=1e3*60*5,Ti=class extends Dr{static exists(e,t){return Si.exists(e,t)}constructor(e){if(super(e),S(this,`backend`,void 0),S(this,`startedUp`,!1),S(this,`syncTs`,0),S(this,`userModifiedMap`,{}),S(this,`emitter`,new Jn),S(this,`onClose`,()=>{this.emitter.emit(`closed`)}),S(this,`getSavedSync`,this.degradable(()=>this.backend.getSavedSync(),`getSavedSync`)),S(this,`isNewlyCreated`,this.degradable(()=>this.backend.isNewlyCreated(),`isNewlyCreated`)),S(this,`getSavedSyncToken`,this.degradable(()=>this.backend.getNextBatchToken(),`getSavedSyncToken`)),S(this,`deleteAllData`,this.degradable(()=>(super.deleteAllData(),this.backend.clearDatabase().then(()=>{I.log(`Deleted indexeddb data.`)},e=>{throw I.error(`Failed to delete indexeddb data: ${e}`),e})),null)),S(this,`reallySave`,this.degradable(()=>{this.syncTs=Date.now();var e=[];for(var t of this.getUsers())this.userModifiedMap[t.userId]!==t.getLastModifiedTime()&&t.events.presence&&(e.push([t.userId,t.events.presence.event]),this.userModifiedMap[t.userId]=t.getLastModifiedTime());return this.backend.syncToDatabase(e)},null)),S(this,`setSyncData`,this.degradable(e=>this.backend.setSyncData(e),`setSyncData`)),S(this,`getOutOfBandMembers`,this.degradable(e=>this.backend.getOutOfBandMembers(e),`getOutOfBandMembers`)),S(this,`setOutOfBandMembers`,this.degradable((e,t)=>(super.setOutOfBandMembers(e,t),this.backend.setOutOfBandMembers(e,t)),`setOutOfBandMembers`)),S(this,`clearOutOfBandMembers`,this.degradable(e=>(super.clearOutOfBandMembers(e),this.backend.clearOutOfBandMembers(e)),`clearOutOfBandMembers`)),S(this,`getClientOptions`,this.degradable(()=>this.backend.getClientOptions(),`getClientOptions`)),S(this,`storeClientOptions`,this.degradable(e=>(super.storeClientOptions(e),this.backend.storeClientOptions(e)),`storeClientOptions`)),!e.indexedDB)throw Error(`Missing required option: indexedDB`);e.workerFactory?this.backend=new Ci(e.workerFactory,e.dbName):this.backend=new Si(e.indexedDB,e.dbName)}on(e,t){this.emitter.on(e,t)}startup(){return this.startedUp?(I.log(`IndexedDBStore.startup: already started`),Promise.resolve()):(I.log(`IndexedDBStore.startup: connecting to backend`),this.backend.connect(this.onClose).then(()=>(I.log(`IndexedDBStore.startup: loading presence events`),this.backend.getUserPresenceEvents())).then(e=>{I.log(`IndexedDBStore.startup: processing presence events`),e.forEach(e=>{var[t,n]=e;if(!this.createUser)throw Error("`IndexedDBStore.startup` must be called after assigning it to the client, not before!");var r=this.createUser(t);n&&r.setPresenceEvent(new pn(n)),this.userModifiedMap[r.userId]=r.getLastModifiedTime(),this.storeUser(r)}),this.startedUp=!0}))}destroy(){return this.backend.destroy()}wantsSave(){return Date.now()-this.syncTs>wi}save(){return arguments.length>0&&arguments[0]!==void 0&&arguments[0]||this.wantsSave()?this.reallySave():Promise.resolve()}degradable(e,t){var n=this,r=t?super[t]:null;return F(function*(){var t=[...arguments];try{return yield e.call(n,...t)}catch(e){I.error(`IndexedDBStore failure, degrading to MemoryStore`,e),n.emitter.emit(`degraded`,e);try{I.log(`IndexedDBStore trying to delete degraded data`),yield n.backend.clearDatabase(),I.log(`IndexedDBStore delete after degrading succeeded`)}catch(e){I.warn(`IndexedDBStore delete after degrading failed`,e)}if(r)return r.call(n,...t)}})}getPendingEvents(e){var t=()=>super.getPendingEvents,n=this;return F(function*(){if(!n.localStorage)return t().call(n,e);var r=n.localStorage.getItem(Ei(e));if(r)try{return JSON.parse(r)}catch(e){I.error(`Could not parse persisted pending events`,e)}return[]})()}setPendingEvents(e,t){var n=()=>super.setPendingEvents,r=this;return F(function*(){if(!r.localStorage)return n().call(r,e,t);t.length>0?r.localStorage.setItem(Ei(e),JSON.stringify(t)):r.localStorage.removeItem(Ei(e))})()}saveToDeviceBatches(e){return this.backend.saveToDeviceBatches(e)}getOldestToDeviceBatch(){return this.backend.getOldestToDeviceBatch()}removeToDeviceBatch(e){return this.backend.removeToDeviceBatch(e)}};function Ei(e){return`mx_pending_events_${e}`}var Di=function(e){return e.Email=`email`,e.Phone=`msisdn`,e}({}),Oi=new E(`oauth_aware_preferred`,`org.matrix.msc3824.delegated_oidc_compatibility`),ki=Oi,Ai=function(e){return e.Gitlab=`gitlab`,e.Github=`github`,e.Apple=`apple`,e.Google=`google`,e.Facebook=`facebook`,e.Twitter=`twitter`,e}({}),ji=function(e){return e.LOGIN=`login`,e.REGISTER=`register`,e}({}),Mi=`m.tz`,Ni=`us.cloke.msc4175.tz`,Pi=class{constructor(e){S(this,`relations`,void 0),this.relations=e.filter(e=>!!e)}getRelations(){return this.relations.reduce((e,t)=>[...e,...t.getRelations()],[])}on(e,t){this.relations.forEach(n=>n.on(e,t))}off(e,t){this.relations.forEach(n=>n.off(e,t))}},Fi=function(e){return e.Global=`Global`,e.SetItemError=`setItem`,e.GetItemError=`getItem`,e.RemoveItemError=`removeItem`,e.ClearError=`clear`,e.QuotaExceededError=`QuotaExceededError`,e}({}),Ii=new class extends Jn{},Li=r({AuthType:()=>fi,AutoDiscovery:()=>Ln,AutoDiscoveryAction:()=>P,AutoDiscoveryError:()=>_t,Beacon:()=>On,BeaconEvent:()=>Gn,CallEvent:()=>Dn,CallFeedEvent:()=>$t,Category:()=>ri,ClientEvent:()=>cr,ClientPrefix:()=>Pe,ClientStoppedError:()=>an,ConditionKind:()=>c,ConditionOperator:()=>Vt,ConnectionError:()=>$e,ContentHelpers:()=>er,DELEGATED_OIDC_COMPATIBILITY:()=>ki,DEVICE_CODE_SCOPE:()=>Ve,DMMemberCountCondition:()=>`2`,DebugLogger:()=>zn,Device:()=>tn,DeviceVerification:()=>Tt,Direction:()=>O,DuplicateStrategy:()=>qe,EVENT_VISIBILITY_CHANGE_TYPE:()=>Fe,EventEmitterEvents:()=>Bt,EventStatus:()=>dr,EventTimeline:()=>w,EventTimelineSet:()=>b,EventType:()=>j,FILTER_RELATED_BY_REL_TYPES:()=>Ut,FILTER_RELATED_BY_SENDERS:()=>An,FeatureSupport:()=>vn,Filter:()=>wt,GET_LOGIN_TOKEN_CAPABILITY:()=>Ge,GroupCall:()=>Pt,GroupCallEvent:()=>hn,GroupCallIntent:()=>$n,GroupCallState:()=>Rt,GroupCallStatsReportEvent:()=>Wt,GroupCallType:()=>Mn,GuestAccess:()=>xe,HTTPError:()=>st,HistoryVisibility:()=>We,HttpApiEvent:()=>ie,IdentityPrefix:()=>A,IdentityProviderBrand:()=>Ai,IndexedDBCryptoStore:()=>qn,IndexedDBStore:()=>Ti,InteractiveAuth:()=>mi,InvalidCryptoStoreError:()=>Ot,InvalidCryptoStoreState:()=>kn,JoinRule:()=>vr,KNOWN_SAFE_ROOM_VERSION:()=>`10`,KeySignatureUploadError:()=>Kn,KnownMembership:()=>Oe,LOCAL_NOTIFICATION_SETTINGS_PREFIX:()=>le,LocalStorageCryptoStore:()=>xn,LocalStorageErrors:()=>Fi,LocationAssetType:()=>Ke,MAIN_ROOM_TIMELINE:()=>At,MAXIMUM_MATRIX_VERSION:()=>pt,MAX_STICKY_DURATION_MS:()=>Nt,MINIMUM_MATRIX_VERSION:()=>xt,MSC3912_RELATION_BASED_REDACTIONS_PROP:()=>be,MXID_PATTERN:()=>d,M_ASSET:()=>v,M_BEACON:()=>ln,M_BEACON_INFO:()=>Te,M_HTML:()=>Gt,M_LOCATION:()=>ar,M_MESSAGE:()=>Nn,M_POLL_END:()=>Xn,M_POLL_KIND_DISCLOSED:()=>wn,M_POLL_KIND_UNDISCLOSED:()=>Vn,M_POLL_RESPONSE:()=>rn,M_POLL_START:()=>Dt,M_TEXT:()=>bn,M_TIMESTAMP:()=>Ye,M_TOPIC:()=>zt,MatrixClient:()=>_,MatrixError:()=>ee,MatrixEvent:()=>pn,MatrixEventEvent:()=>Qn,MatrixHttpApi:()=>De,MatrixSafetyError:()=>he,MatrixSafetyErrorCode:()=>Fn,MatrixScheduler:()=>f,MediaHandlerEvent:()=>M,MediaPrefix:()=>ce,MemoryCryptoStore:()=>Un,MemoryStore:()=>Dr,Method:()=>yt,MsgType:()=>Ue,NoAuthFlowFoundError:()=>pi,NotificationCountType:()=>D,OAUTH_AWARE_PREFERRED_FLOW_FIELD:()=>Oi,OAuthGrantType:()=>hr,OidcError:()=>a,OidcTokenRefresher:()=>ve,PUSHER_DEVICE_ID:()=>_r,PUSHER_ENABLED:()=>h,PendingEventOrdering:()=>ir,Poll:()=>Re,PollEvent:()=>o,Preset:()=>g,ProfileKeyMSC4175Timezone:()=>Ni,ProfileKeyTimezone:()=>Mi,PushRuleActionName:()=>Yn,PushRuleKind:()=>Cn,REFERENCE_RELATION:()=>en,ReceiptType:()=>lr,RelatedRelations:()=>Pi,RelationType:()=>it,Relations:()=>sr,RelationsEvent:()=>Ze,RestrictedAllowType:()=>at,Room:()=>C,RoomCreateTypeField:()=>ae,RoomEvent:()=>je,RoomMember:()=>cn,RoomMemberEvent:()=>we,RoomNameType:()=>dn,RoomState:()=>Tn,RoomStateEvent:()=>Hn,RoomStickyEventsEvent:()=>u,RoomSummary:()=>Mt,RoomType:()=>et,RoomVersionStability:()=>sn,RoomWidgetClient:()=>$r,RoomWidgetClientEvent:()=>Qr,RuleId:()=>Bn,SERVICE_TYPES:()=>_e,SSOAction:()=>ji,STABLE_MSC4133_EXTENDED_PROFILES:()=>Je,SUPPORTED_MATRIX_VERSIONS:()=>Be,SearchOrderBy:()=>ue,SearchResult:()=>ne,SecretStorage:()=>Kt,ServerCapabilities:()=>Ce,SetPresence:()=>y,SlidingSyncEvent:()=>Ie,StatsReport:()=>yn,SyncAccumulator:()=>ai,SyncState:()=>Xe,THREAD_RELATION_TYPE:()=>Zt,Thread:()=>qt,ThreadEvent:()=>St,ThreadFilterType:()=>tr,ThreepidMedium:()=>Di,TimelineIndex:()=>li,TimelineWindow:()=>ci,ToDeviceMessageId:()=>ct,TokenRefreshError:()=>fe,TokenRefreshLogoutError:()=>ht,TweakName:()=>nn,TypedEventEmitter:()=>Jn,UNSIGNED_MEMBERSHIP_FIELD:()=>te,UNSIGNED_THREAD_ID_FIELD:()=>ge,UNSTABLE_ELEMENT_FUNCTIONAL_USERS:()=>In,UNSTABLE_MSC2666_MUTUAL_ROOMS:()=>T,UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS:()=>x,UNSTABLE_MSC2666_SHARED_ROOMS:()=>Ae,UNSTABLE_MSC2716_MARKER:()=>pe,UNSTABLE_MSC3088_ENABLED:()=>gt,UNSTABLE_MSC3088_PURPOSE:()=>ft,UNSTABLE_MSC3089_BRANCH:()=>bt,UNSTABLE_MSC3089_LEAF:()=>ze,UNSTABLE_MSC3089_TREE_SUBTYPE:()=>s,UNSTABLE_MSC3852_LAST_SEEN_UA:()=>un,UNSTABLE_MSC4133_EXTENDED_PROFILES:()=>l,UNSTABLE_MSC4140_DELAYED_EVENTS:()=>on,UNSTABLE_MSC4354_STICKY_EVENTS:()=>Se,UnsupportedDelayedEventsEndpointError:()=>It,UnsupportedStickyEventsEndpointError:()=>_n,UpdateDelayedEventAction:()=>tt,User:()=>Me,UserEvent:()=>fn,Visibility:()=>oe,anySignal:()=>ye,calculateRetryBackoff:()=>He,completeAuthorizationCodeGrant:()=>Qe,createClient:()=>Vi,createNewMatrixCall:()=>Wn,createRoomWidgetClient:()=>Hi,decodeBase64:()=>nr,decodeIdToken:()=>de,determineFeatureSupport:()=>fr,discoverAndValidateOIDCIssuerWellKnown:()=>nt,encodeBase64:()=>mr,encodeUnpaddedBase64:()=>jt,encodeUnpaddedBase64Url:()=>ur,fixNotificationCountOnDecryption:()=>Ee,generateAuthorizationParams:()=>ot,generateAuthorizationUrl:()=>N,generateOidcAuthorizationUrl:()=>me,generateScope:()=>Pn,getBeaconInfoIdentifier:()=>Ft,getHttpUriForMxc:()=>En,inMainTimelineForReceipt:()=>Ne,isDmMemberCountCondition:()=>Et,isEventTypeSame:()=>Xt,isPollEvent:()=>Ht,isSendDelayedEventRequestOpts:()=>lt,isTimestampInDuration:()=>gn,localStorageErrorsEventsEmitter:()=>Ii,parseErrorResponse:()=>gr,registerOidcClient:()=>p,retryNetworkOperation:()=>m,safeGetRetryAfterMs:()=>dt,setCryptoStoreFactory:()=>zi,threadFilterTypeToFilter:()=>kt,threadIdForReceipt:()=>k,timeoutSignal:()=>rt,validateAuthMetadata:()=>mt,validateAuthMetadataAndKeys:()=>re,validateBearerTokenResponse:()=>ut,validateIdToken:()=>vt,validateStoredUserState:()=>Le}),Ri=()=>new Un;function zi(e){Ri=e}function Bi(e){return e.store=e.store??new Dr({localStorage:globalThis.localStorage}),e.scheduler=e.scheduler??new f,e.cryptoStore=e.cryptoStore??Ri(),e}function Vi(e){return new _(Bi(e))}function Hi(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return new $r(e,t,n,Bi(r),i)}if(globalThis.__js_sdk_entrypoint)throw Error(`Multiple matrix-js-sdk entrypoints detected!`);globalThis.__js_sdk_entrypoint=!0;var Ui;try{Ui=globalThis.indexedDB}catch{}Ui&&zi(()=>new qn(Ui,`matrix-js-sdk:crypto`)),globalThis.matrixcs=Li;function Wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Gi(){throw Error(`setTimeout has not been defined`)}function Ki(){throw Error(`clearTimeout has not been defined`)}function qi(e){if(ta===setTimeout)return setTimeout(e,0);if((ta===Gi||!ta)&&setTimeout)return ta=setTimeout,setTimeout(e,0);try{return ta(e,0)}catch{try{return ta.call(null,e,0)}catch{return ta.call(this,e,0)}}}function Ji(e){if(na===clearTimeout)return clearTimeout(e);if((na===Ki||!na)&&clearTimeout)return na=clearTimeout,clearTimeout(e);try{return na(e)}catch{try{return na.call(null,e)}catch{return na.call(this,e)}}}function Yi(){!ia||!aa||(ia=!1,aa.length?ra=aa.concat(ra):oa=-1,ra.length&&Xi())}function Xi(){if(!ia){var e=qi(Yi);ia=!0;for(var t=ra.length;t;){for(aa=ra,ra=[];++oa<t;)aa&&aa[oa].run();oa=-1,t=ra.length}aa=null,ia=!1,Ji(e)}}function Zi(e,t){this.fun=e,this.array=t}function Qi(){}var $i,ea,ta,na,ra,ia,aa,oa,sa,ca,la=t((()=>{$i={exports:{}},ea=$i.exports={},(function(){try{ta=typeof setTimeout==`function`?setTimeout:Gi}catch{ta=Gi}try{na=typeof clearTimeout==`function`?clearTimeout:Ki}catch{na=Ki}})(),ra=[],ia=!1,oa=-1,ea.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];ra.push(new Zi(e,t)),ra.length===1&&!ia&&qi(Xi)},Zi.prototype.run=function(){this.fun.apply(null,this.array)},ea.title=`browser`,ea.browser=!0,ea.env={},ea.argv=[],ea.version=``,ea.versions={},ea.on=Qi,ea.addListener=Qi,ea.once=Qi,ea.off=Qi,ea.removeListener=Qi,ea.removeAllListeners=Qi,ea.emit=Qi,ea.prependListener=Qi,ea.prependOnceListener=Qi,ea.listeners=function(e){return[]},ea.binding=function(e){throw Error(`process.binding is not supported`)},ea.cwd=function(){return`/`},ea.chdir=function(e){throw Error(`process.chdir is not supported`)},ea.umask=function(){return 0},sa=$i.exports,ca=Wi(sa)})),ua=i((e=>{la();var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ee(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ne=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof ca==`object`&&typeof ca.emit==`function`){ca.emit(`uncaughtException`,e);return}console.error(e)},re={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=re,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,ne)}catch(e){ne(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),da=i(((e,t)=>{t.exports=ua()})),fa=i((e=>{var t=da();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),pa=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=fa()})),R=e(da(),1),ma=`popstate`;function ha(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ga(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return xa(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Sa(t)}return wa(t,n,null,e)}function _a(e,t){if(e===!1||e==null)throw Error(t)}function va(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ya(){return Math.random().toString(36).substring(2,10)}function ba(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function xa(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ca(t):t,state:n,key:t&&t.key||r||ya(),unstable_mask:i}}function Sa({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Ca(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function wa(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=ha(e)?e:xa(h.location,e,t);n&&n(r,e),l=u()+1;let d=ba(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=ha(e)?e:xa(h.location,e,t);n&&n(r,e),l=u();let i=ba(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ta(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ma,d),c=e,()=>{i.removeEventListener(ma,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ta(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),_a(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Sa(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function Ea(e,t,n=`/`){return Da(e,t,n,!1)}function Da(e,t,n,r){let i=Ga((typeof t==`string`?Ca(t):t).pathname||`/`,n);if(i==null)return null;let a=ka(e);ja(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Wa(i);o=Va(a[e],t,r)}return o}function Oa(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ka(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;_a(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=eo([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(_a(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ka(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:za(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Aa(e.path))a(e,t,!0,n)}),t}function Aa(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Aa(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ja(e){e.sort((e,t)=>e.score===t.score?Ba(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ma=/^:[\w-]+$/,Na=3,Pa=2,Fa=1,Ia=10,La=-2,Ra=e=>e===`*`;function za(e,t){let n=e.split(`/`),r=n.length;return n.some(Ra)&&(r+=La),t&&(r+=Pa),n.filter(e=>!Ra(e)).reduce((e,t)=>e+(Ma.test(t)?Na:t===``?Fa:Ia),r)}function Ba(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Va(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Ha({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Ha({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:eo([a,u.pathname]),pathnameBase:no(eo([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=eo([a,u.pathnameBase]))}return o}function Ha(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ua(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Ua(e,t=!1,n=!0){va(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Wa(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return va(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ga(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Ka=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function qa(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ca(e):e,a;return n?(n=$a(n),a=n.startsWith(`/`)?Ja(n.substring(1),`/`):Ja(n,t)):a=t,{pathname:a,search:ro(r),hash:io(i)}}function Ja(e,t){let n=to(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ya(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Xa(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Za(e){let t=Xa(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Qa(e,t,n,r=!1){let i;typeof e==`string`?i=Ca(e):(i={...e},_a(!i.pathname||!i.pathname.includes(`?`),Ya(`?`,`pathname`,`search`,i)),_a(!i.pathname||!i.pathname.includes(`#`),Ya(`#`,`pathname`,`hash`,i)),_a(!i.search||!i.search.includes(`#`),Ya(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=qa(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var $a=e=>e.replace(/\/\/+/g,`/`),eo=e=>$a(e.join(`/`)),to=e=>e.replace(/\/+$/,``),no=e=>to(e).replace(/^\/*/,`/`),ro=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,io=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ao=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function oo(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function so(e){return eo(e.map(e=>e.route.path).filter(Boolean))||`/`}var co=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function lo(e,t){let n=e;if(typeof n!=`string`||!Ka.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(co)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Ga(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{va(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var uo=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(uo);var fo=[`GET`,...uo];new Set(fo);var po=R.createContext(null);po.displayName=`DataRouter`;var mo=R.createContext(null);mo.displayName=`DataRouterState`;var ho=R.createContext(!1);function go(){return R.useContext(ho)}var _o=R.createContext({isTransitioning:!1});_o.displayName=`ViewTransition`;var vo=R.createContext(new Map);vo.displayName=`Fetchers`;var yo=R.createContext(null);yo.displayName=`Await`;var bo=R.createContext(null);bo.displayName=`Navigation`;var xo=R.createContext(null);xo.displayName=`Location`;var So=R.createContext({outlet:null,matches:[],isDataRoute:!1});So.displayName=`Route`;var Co=R.createContext(null);Co.displayName=`RouteError`;var wo=`REACT_ROUTER_ERROR`,To=`REDIRECT`,Eo=`ROUTE_ERROR_RESPONSE`;function Do(e){if(e.startsWith(`${wo}:${To}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Oo(e){if(e.startsWith(`${wo}:${Eo}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new ao(t.status,t.statusText,t.data)}catch{}}function ko(e,{relative:t}={}){_a(Ao(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=R.useContext(bo),{hash:i,pathname:a,search:o}=Lo(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:eo([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Ao(){return R.useContext(xo)!=null}function jo(){return _a(Ao(),`useLocation() may be used only in the context of a <Router> component.`),R.useContext(xo).location}function Mo(){return R.useContext(xo).navigationType}var No=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Po(e){R.useContext(bo).static||R.useLayoutEffect(e)}function Fo(){let{isDataRoute:e}=R.useContext(So);return e?ns():Io()}function Io(){_a(Ao(),`useNavigate() may be used only in the context of a <Router> component.`);let e=R.useContext(po),{basename:t,navigator:n}=R.useContext(bo),{matches:r}=R.useContext(So),{pathname:i}=jo(),a=JSON.stringify(Za(r)),o=R.useRef(!1);return Po(()=>{o.current=!0}),R.useCallback((r,s={})=>{if(va(o.current,No),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Qa(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:eo([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}R.createContext(null);function Lo(e,{relative:t}={}){let{matches:n}=R.useContext(So),{pathname:r}=jo(),i=JSON.stringify(Za(n));return R.useMemo(()=>Qa(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ro(e,t){return zo(e,t)}function zo(e,t,n){_a(Ao(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=R.useContext(bo),{matches:i}=R.useContext(So),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;is(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
3
|
|
|
4
4
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=jo(),d;if(t){let e=typeof t==`string`?Ca(t):t;_a(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=Ea(e,{pathname:p});va(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),va(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Ko(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:eo([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:eo([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?R.createElement(xo.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function Bo(){let e=ts(),t=oo(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=R.createElement(R.Fragment,null,R.createElement(`p`,null,`💿 Hey developer 👋`),R.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,R.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,R.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),R.createElement(R.Fragment,null,R.createElement(`h2`,null,`Unexpected Application Error!`),R.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?R.createElement(`pre`,{style:i},n):null,o)}var Vo=R.createElement(Bo,null),Ho=class extends R.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Oo(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:R.createElement(So.Provider,{value:this.props.routeContext},R.createElement(Co.Provider,{value:e,children:this.props.component}));return this.context?R.createElement(Wo,{error:e},t):t}};Ho.contextType=ho;var Uo=new WeakMap;function Wo({children:e,error:t}){let{basename:n}=R.useContext(bo);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Do(t.digest);if(e){let r=Uo.get(t);if(r)throw r;let i=lo(e.location,n);if(co&&!Uo.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Uo.set(t,n),n}return R.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Go({routeContext:e,match:t,children:n}){let r=R.useContext(po);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),R.createElement(So.Provider,{value:e},n)}function Ko(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);_a(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:so(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Vo,o&&(s<0&&c===0?(is(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?R.createElement(n.route.Component,null):n.route.element?n.route.element:e,R.createElement(Go,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?R.createElement(Ho,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function qo(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Jo(e){let t=R.useContext(po);return _a(t,qo(e)),t}function Yo(e){let t=R.useContext(mo);return _a(t,qo(e)),t}function Xo(e){let t=R.useContext(So);return _a(t,qo(e)),t}function Zo(e){let t=Xo(e),n=t.matches[t.matches.length-1];return _a(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Qo(){return Zo(`useRouteId`)}function $o(){return Yo(`useNavigation`).navigation}function es(){let{matches:e,loaderData:t}=Yo(`useMatches`);return R.useMemo(()=>e.map(e=>Oa(e,t)),[e,t])}function ts(){let e=R.useContext(Co),t=Yo(`useRouteError`),n=Zo(`useRouteError`);return e===void 0?t.errors?.[n]:e}function ns(){let{router:e}=Jo(`useNavigate`),t=Zo(`useNavigate`),n=R.useRef(!1);return Po(()=>{n.current=!0}),R.useCallback(async(r,i={})=>{va(n.current,No),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var rs={};function is(e,t,n){!t&&!rs[e]&&(rs[e]=!0,va(!1,n))}R.useOptimistic,R.memo(as);function as({routes:e,future:t,state:n,isStatic:r,onError:i}){return zo(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function os(e){_a(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function ss({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){_a(!Ao(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=R.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Ca(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=R.useMemo(()=>{let e=Ga(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return va(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:R.createElement(bo.Provider,{value:c},R.createElement(xo.Provider,{children:t,value:h}))}function cs({children:e,location:t}){return Ro(ls(e),t)}R.Component;function ls(e,t=[]){let n=[];return R.Children.forEach(e,(e,r)=>{if(!R.isValidElement(e))return;let i=[...t,r];if(e.type===R.Fragment){n.push.apply(n,ls(e.props.children,i));return}_a(e.type===os,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),_a(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=ls(e.props.children,i)),n.push(a)}),n}var us=`get`,ds=`application/x-www-form-urlencoded`;function fs(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function ps(e){return fs(e)&&e.tagName.toLowerCase()===`button`}function ms(e){return fs(e)&&e.tagName.toLowerCase()===`form`}function hs(e){return fs(e)&&e.tagName.toLowerCase()===`input`}function gs(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _s(e,t){return e.button===0&&(!t||t===`_self`)&&!gs(e)}var vs=null;function ys(){if(vs===null)try{new FormData(document.createElement(`form`),0),vs=!1}catch{vs=!0}return vs}var bs=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function xs(e){return e!=null&&!bs.has(e)?(va(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ds}"`),null):e}function Ss(e,t){let n,r,i,a,o;if(ms(e)){let o=e.getAttribute(`action`);r=o?Ga(o,t):null,n=e.getAttribute(`method`)||us,i=xs(e.getAttribute(`enctype`))||ds,a=new FormData(e)}else if(ps(e)||hs(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Ga(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||us,i=xs(e.getAttribute(`formenctype`))||xs(o.getAttribute(`enctype`))||ds,a=new FormData(o,e),!ys()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(fs(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=us,r=null,i=ds,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Cs={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},ws=/[&><\u2028\u2029]/g;function Ts(e){return e.replace(ws,e=>Cs[e])}function Es(e,t){if(e===!1||e==null)throw Error(t)}function Ds(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Ga(i.pathname,t)===`/`?i.pathname=`${to(t)}/_root.${r}`:i.pathname=`${to(i.pathname)}.${r}`,i}async function Os(e,t){if(e.id in t)return t[e.id];try{let n=await se(()=>import(e.module),[],import.meta.url);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ks(e){return e!=null&&typeof e.page==`string`}function As(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function js(e,t,n){return Is((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Os(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(As).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Ms(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Ns(e,t,{includeHydrateFallback:n}={}){return Ps(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Ps(e){return[...new Set(e)]}function Fs(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Is(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!ks(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Fs(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Ls(){let e=R.useContext(po);return Es(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Rs(){let e=R.useContext(mo);return Es(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var zs=R.createContext(void 0);zs.displayName=`FrameworkContext`;function Bs(){let e=R.useContext(zs);return Es(e,`You must render this element inside a <HydratedRouter> element`),e}function Vs(e,t){let n=R.useContext(zs),[r,i]=R.useState(!1),[a,o]=R.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=R.useRef(null);R.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),R.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Hs(s,p),onBlur:Hs(c,m),onMouseEnter:Hs(l,p),onMouseLeave:Hs(u,m),onTouchStart:Hs(d,p)}]:[a,f,{}]:[!1,f,{}]}function Hs(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Us({page:e,...t}){let n=go(),{router:r}=Ls(),i=R.useMemo(()=>Ea(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?R.createElement(Gs,{page:e,matches:i,...t}):R.createElement(Ks,{page:e,matches:i,...t}):null}function Ws(e){let{manifest:t,routeModules:n}=Bs(),[r,i]=R.useState([]);return R.useEffect(()=>{let r=!1;return js(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Gs({page:e,matches:t,...n}){let r=jo(),{future:i}=Bs(),{basename:a}=Ls(),o=R.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ds(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return R.createElement(R.Fragment,null,o.map(e=>R.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Ks({page:e,matches:t,...n}){let r=jo(),{future:i,manifest:a,routeModules:o}=Bs(),{basename:s}=Ls(),{loaderData:c,matches:l}=Rs(),u=R.useMemo(()=>Ms(e,t,l,a,r,`data`),[e,t,l,a,r]),d=R.useMemo(()=>Ms(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=R.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Ds(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=R.useMemo(()=>Ns(d,a),[d,a]),m=Ws(d);return R.createElement(R.Fragment,null,f.map(e=>R.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>R.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>R.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function qs(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}R.Component;var Js=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Js&&(window.__reactRouterVersion=`7.14.1`)}catch{}function Ys({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=R.useRef();i.current??=ga({window:r,v5Compat:!0});let a=i.current,[o,s]=R.useState({action:a.action,location:a.location}),c=R.useCallback(e=>{n===!1?s(e):R.startTransition(()=>s(e))},[n]);return R.useLayoutEffect(()=>a.listen(c),[a,c]),R.createElement(ss,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Xs({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=R.useState({action:n.action,location:n.location}),o=R.useCallback(e=>{r===!1?a(e):R.startTransition(()=>a(e))},[r]);return R.useLayoutEffect(()=>n.listen(o),[n,o]),R.createElement(ss,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Xs.displayName=`unstable_HistoryRouter`;var Zs=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qs=R.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=R.useContext(bo),v=typeof l==`string`&&Zs.test(l),y=lo(l,h);l=y.to;let b=ko(l,{relative:r}),x=jo(),S=null;if(o){let e=Qa(o,[],x.unstable_mask?x.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:eo([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Vs(n,p),E=ac(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=R.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:qs(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?R.createElement(R.Fragment,null,k,R.createElement(Us,{page:b})):k});Qs.displayName=`Link`;var $s=R.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Lo(a,{relative:c.relative}),d=jo(),f=R.useContext(mo),{navigator:p,basename:m}=R.useContext(bo),h=f!=null&&hc(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Ga(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return R.createElement(Qs,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});$s.displayName=`NavLink`;var ec=R.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=us,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=R.useContext(bo),g=cc(),_=lc(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Zs.test(s);return R.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?R.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ec.displayName=`Form`;function tc({getKey:e,storageKey:t,...n}){let r=R.useContext(zs),{basename:i}=R.useContext(bo),a=jo(),o=es();pc({getKey:e,storageKey:t});let s=R.useMemo(()=>{if(!r||!e)return null;let t=fc(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return R.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ts(JSON.stringify(t||uc))}, ${Ts(JSON.stringify(s))})`}})}tc.displayName=`ScrollRestoration`;function nc(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rc(e){let t=R.useContext(po);return _a(t,nc(e)),t}function ic(e){let t=R.useContext(mo);return _a(t,nc(e)),t}function ac(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=Fo(),d=jo(),f=Lo(e,{relative:o});return R.useCallback(p=>{if(_s(p,t)){p.preventDefault();let t=n===void 0?Sa(d)===Sa(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?R.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var oc=0,sc=()=>`__${String(++oc)}__`;function cc(){let{router:e}=rc(`useSubmit`),{basename:t}=R.useContext(bo),n=Qo(),r=e.fetch,i=e.navigate;return R.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ss(e,t);a.navigate===!1?await r(a.fetcherKey||sc(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function lc(e,{relative:t}={}){let{basename:n}=R.useContext(bo),r=R.useContext(So);_a(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Lo(e||`.`,{relative:t})},o=jo();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:eo([n,a.pathname])),Sa(a)}var uc=`react-router-scroll-positions`,dc={};function fc(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Ga(e.pathname,n)||e.pathname},t)),i??=e.key,i}function pc({getKey:e,storageKey:t}={}){let{router:n}=rc(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=ic(`useScrollRestoration`),{basename:a}=R.useContext(bo),o=jo(),s=es(),c=$o();R.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),mc(R.useCallback(()=>{if(c.state===`idle`){let t=fc(o,s,a,e);dc[t]=window.scrollY}try{sessionStorage.setItem(t||uc,JSON.stringify(dc))}catch(e){va(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(R.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||uc);e&&(dc=JSON.parse(e))}catch{}},[t]),R.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(dc,()=>window.scrollY,e?(t,n)=>fc(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),R.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{va(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function mc(e,t){let{capture:n}=t||{};R.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function hc(e,{relative:t}={}){let n=R.useContext(_o);_a(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=rc(`useViewTransitionState`),i=Lo(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ga(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ga(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ha(i.pathname,o)!=null||Ha(i.pathname,a)!=null}var gc=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,_c=`8.55.1`,vc=globalThis;function yc(e,t,n){let r=n||vc,i=r.__SENTRY__=r.__SENTRY__||{},a=i[_c]=i[`8.55.1`]||{};return a[e]||(a[e]=t())}var bc=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,xc=`Sentry Logger `,Sc=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Cc={};function wc(e){if(!(`console`in vc))return e();let t=vc.console,n={},r=Object.keys(Cc);r.forEach(e=>{let r=Cc[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Tc(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return bc?Sc.forEach(n=>{t[n]=(...t)=>{e&&wc(()=>{vc.console[n](`${xc}[${n}]:`,...t)})}}):Sc.forEach(e=>{t[e]=()=>void 0}),t}var Ec=yc(`logger`,Tc),Dc=50,Oc=/\(error: (.*)\)/,kc=/captureMessage|captureException/;function Ac(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
|
|
5
5
|
`);for(let e=n;e<a.length;e++){let n=a[e];if(n.length>1024)continue;let o=Oc.test(n)?n.replace(Oc,`$1`):n;if(!o.match(/\S*Error: /)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=Dc+r)break}}return Mc(i.slice(r))}}function jc(e){return Array.isArray(e)?Ac(...e):e}function Mc(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Nc(t).function||``)&&t.pop(),t.reverse(),kc.test(Nc(t).function||``)&&(t.pop(),kc.test(Nc(t).function||``)&&t.pop()),t.slice(0,Dc).map(e=>({...e,filename:e.filename||Nc(t).filename,function:e.function||`?`}))}function Nc(e){return e[e.length-1]||{}}var Pc=`<anonymous>`;function Fc(e){try{return!e||typeof e!=`function`?Pc:e.name||Pc}catch{return Pc}}function Ic(e){let t=e.exception;if(t){let e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function Lc(){return Rc(vc),vc}function Rc(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`8.55.1`,t[_c]=t[`8.55.1`]||{}}var zc=Object.prototype.toString;function Bc(e){switch(zc.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return el(e,Error)}}function Vc(e,t){return zc.call(e)===`[object ${t}]`}function Hc(e){return Vc(e,`ErrorEvent`)}function Uc(e){return Vc(e,`DOMError`)}function Wc(e){return Vc(e,`DOMException`)}function Gc(e){return Vc(e,`String`)}function Kc(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function qc(e){return e===null||Kc(e)||typeof e!=`object`&&typeof e!=`function`}function Jc(e){return Vc(e,`Object`)}function Yc(e){return typeof Event<`u`&&el(e,Event)}function Xc(e){return typeof Element<`u`&&el(e,Element)}function Zc(e){return Vc(e,`RegExp`)}function Qc(e){return!!(e&&e.then&&typeof e.then==`function`)}function $c(e){return Jc(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function el(e,t){try{return e instanceof t}catch{return!1}}function tl(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue))}var nl=vc,rl=80;function il(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||rl;for(;n&&i++<5&&(o=al(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=n.parentNode;return r.reverse().join(` > `)}catch{return`<unknown>`}}function al(e,t){let n=e,r=[];if(!n||!n.tagName)return``;if(nl.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());let i=t&&t.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i&&i.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let e=n.className;if(e&&Gc(e)){let t=e.split(/\s+/);for(let e of t)r.push(`.${e}`)}}for(let e of[`aria-label`,`type`,`name`,`title`,`alt`]){let t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join(``)}function ol(){try{return nl.document.location.href}catch{return``}}function sl(e){return nl.document&&nl.document.querySelector?nl.document.querySelector(e):null}function cl(e){if(!nl.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function ll(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function ul(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{tl(r)?n.push(`[VueViewModel]`):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function dl(e,t,n=!1){return Gc(e)?Zc(t)?t.test(e):Gc(t)?n?e===t:e.includes(t):!1:!1}function fl(e,t=[],n=!1){return t.some(t=>dl(e,t,n))}function pl(e,t,n){if(!(t in e))return;let r=e[t],i=n(r);typeof i==`function`&&hl(i,r);try{e[t]=i}catch{bc&&Ec.log(`Failed to replace method "${t}" in object`,e)}}function ml(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{bc&&Ec.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function hl(e,t){try{e.prototype=t.prototype=t.prototype||{},ml(e,`__sentry_original__`,t)}catch{}}function gl(e){return e.__sentry_original__}function _l(e){if(Bc(e))return{message:e.message,name:e.name,stack:e.stack,...yl(e)};if(Yc(e)){let t={type:e.type,target:vl(e.target),currentTarget:vl(e.currentTarget),...yl(e)};return typeof CustomEvent<`u`&&el(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function vl(e){try{return Xc(e)?il(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function yl(e){if(typeof e==`object`&&e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function bl(e,t=40){let n=Object.keys(_l(e));n.sort();let r=n[0];if(!r)return`[object has no keys]`;if(r.length>=t)return ll(r,t);for(let e=n.length;e>0;e--){let r=n.slice(0,e).join(`, `);if(!(r.length>t))return e===n.length?r:ll(r,t)}return``}function xl(e){return Sl(e,new Map)}function Sl(e,t){if(Cl(e)){let n=t.get(e);if(n!==void 0)return n;let r={};t.set(e,r);for(let n of Object.getOwnPropertyNames(e))e[n]!==void 0&&(r[n]=Sl(e[n],t));return r}if(Array.isArray(e)){let n=t.get(e);if(n!==void 0)return n;let r=[];return t.set(e,r),e.forEach(e=>{r.push(Sl(e,t))}),r}return e}function Cl(e){if(!Jc(e))return!1;try{let t=Object.getPrototypeOf(e).constructor.name;return!t||t===`Object`}catch{return!0}}var wl=1e3;function Tl(){return Date.now()/wl}function El(){let{performance:e}=vc;if(!e||!e.now)return Tl;let t=Date.now()-e.now(),n=e.timeOrigin==null?t:e.timeOrigin;return()=>(n+e.now())/wl}var Dl=El(),Ol=(()=>{let{performance:e}=vc;if(!e||!e.now)return;let t=3600*1e3,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,a=i<t,o=e.timing&&e.timing.navigationStart,s=typeof o==`number`?Math.abs(o+n-r):t;return a||s<t?i<=s?e.timeOrigin:o:r})();function kl(){let e=vc,t=e.crypto||e.msCrypto,n=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,``);t&&t.getRandomValues&&(n=()=>{let e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return`10000000100040008000100000000000`.replace(/[018]/g,e=>(e^(n()&15)>>e/4).toString(16))}function Al(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function jl(e){let{message:t,event_id:n}=e;if(t)return t;let r=Al(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Ml(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function Nl(e,t){let n=Al(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i&&i.data,...t.data};n.mechanism.data=e}}function Pl(e){if(Fl(e))return!0;try{ml(e,`__sentry_captured__`,!0)}catch{}return!1}function Fl(e){try{return e.__sentry_captured__}catch{}}var Il;(function(e){e[e.PENDING=0]=`PENDING`,e[e.RESOLVED=1]=`RESOLVED`,e[e.REJECTED=2]=`REJECTED`})(Il||={});function Ll(e){return new zl(t=>{t(e)})}function Rl(e){return new zl((t,n)=>{n(e)})}var zl=class e{constructor(t){e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),this._state=Il.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(e){this._reject(e)}}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}__init(){this._resolve=e=>{this._setResult(Il.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Il.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===Il.PENDING){if(Qc(t)){t.then(this._resolve,this._reject);return}this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Il.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===Il.RESOLVED&&e[1](this._value),this._state===Il.REJECTED&&e[2](this._value),!0)})}}};function Bl(e){let t=Dl(),n={sid:kl(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Ul(n)};return e&&Vl(n,e),n}function Vl(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Dl(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:kl()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Hl(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Vl(e,n)}function Ul(e){return xl({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}function Wl(){return kl()}function Gl(){return kl().substring(16)}function Kl(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&t&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=Kl(r[e],t[e],n-1));return r}var ql=`_sentrySpan`;function Jl(e,t){t?ml(e,ql,t):delete e[ql]}function Yl(e){return e[ql]}var Xl=100,Zl=class e{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:Wl(),spanId:Gl()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,Jl(t,Yl(this)),t}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&&Vl(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,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},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,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,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;let t=typeof e==`function`?e(this):e,[n,r]=t instanceof Zl?[t.getScopeData(),t.getRequestSession()]:Jc(t)?[e,e.requestSession]:[],{tags:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),r&&(this._requestSession=r),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,Jl(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Wl()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:Xl;if(n<=0)return this;let r={timestamp:Tl(),...e};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),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:Yl(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Kl(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:Gl(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t&&t.event_id?t.event_id:kl();if(!this._client)return Ec.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n&&n.event_id?n.event_id:kl();if(!this._client)return Ec.warn(`No client configured on scope - will not capture message!`),r;let i=Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=t&&t.event_id?t.event_id:kl();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Ec.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function Ql(){return yc(`defaultCurrentScope`,()=>new Zl)}function $l(){return yc(`defaultIsolationScope`,()=>new Zl)}var eu=class{constructor(e,t){let n;n=e||new Zl;let r;r=t||new Zl,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return Qc(n)?n.then(e=>(this._popScope(),e),e=>{throw this._popScope(),e}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function tu(){let e=Rc(Lc());return e.stack=e.stack||new eu(Ql(),$l())}function nu(e){return tu().withScope(e)}function ru(e,t){let n=tu();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function iu(e){return tu().withScope(()=>e(tu().getIsolationScope()))}function au(){return{withIsolationScope:iu,withScope:nu,withSetScope:ru,withSetIsolationScope:(e,t)=>iu(t),getCurrentScope:()=>tu().getScope(),getIsolationScope:()=>tu().getIsolationScope()}}function ou(e){let t=Rc(e);return t.acs?t.acs:au()}function su(){return ou(Lc()).getCurrentScope()}function cu(){return ou(Lc()).getIsolationScope()}function lu(){return yc(`globalScope`,()=>new Zl)}function uu(...e){let t=ou(Lc());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function du(){return su().getClient()}function fu(e){let{traceId:t,spanId:n,parentSpanId:r}=e.getPropagationContext();return xl({trace_id:t,span_id:n,parent_span_id:r})}var pu=`_sentryMetrics`;function mu(e){let t=e[pu];if(!t)return;let n={};for(let[,[e,r]]of t)(n[e]||(n[e]=[])).push(xl(r));return n}var hu=`sentry.source`,gu=`sentry.sample_rate`,_u=`sentry.op`,vu=`sentry.origin`,yu=`sentry.idle_span_finish_reason`,bu=`sentry.measurement_unit`,xu=`sentry.measurement_value`,Su=`sentry.custom_span_name`,Cu=`sentry.profile_id`,wu=`sentry.exclusive_time`;function Tu(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:`unauthenticated`};case 403:return{code:2,message:`permission_denied`};case 404:return{code:2,message:`not_found`};case 409:return{code:2,message:`already_exists`};case 413:return{code:2,message:`failed_precondition`};case 429:return{code:2,message:`resource_exhausted`};case 499:return{code:2,message:`cancelled`};default:return{code:2,message:`invalid_argument`}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:`unimplemented`};case 503:return{code:2,message:`unavailable`};case 504:return{code:2,message:`deadline_exceeded`};default:return{code:2,message:`internal_error`}}return{code:2,message:`unknown_error`}}function Eu(e,t){e.setAttribute(`http.response.status_code`,t);let n=Tu(t);n.message!==`unknown_error`&&e.setStatus(n)}var Du=`sentry-`,Ou=/^sentry-/;function ku(e){let t=ju(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(Ou)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function Au(e){if(e)return Nu(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`${Du}${t}`]=n),e),{}))}function ju(e){if(!(!e||!Gc(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=Mu(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Mu(e)}function Mu(e){return e.split(`,`).map(e=>e.split(`=`).map(e=>decodeURIComponent(e.trim()))).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function Nu(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(bc&&Ec.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}var Pu=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Fu(e){if(!e)return;let t=e.match(Pu);if(!t)return;let n;return t[3]===`1`?n=!0:t[3]===`0`&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Iu(e,t){let n=Fu(e),r=ku(t);if(!n||!n.traceId)return{traceId:Wl(),spanId:Gl()};let{traceId:i,parentSpanId:a,parentSampled:o}=n;return{traceId:i,parentSpanId:a,spanId:Gl(),sampled:o,dsc:r||{}}}function Lu(e=Wl(),t=Gl(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}var Ru=!1;function zu(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:a,status:o,origin:s}=Wu(e);return xl({parent_span_id:a,span_id:t,trace_id:n,data:r,op:i,status:o,origin:s})}function Bu(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext();return xl({parent_span_id:r?t:Wu(e).parent_span_id,span_id:r?Gl():t,trace_id:n})}function Vu(e){let{traceId:t,spanId:n}=e.spanContext();return Lu(t,n,qu(e))}function Hu(e){return typeof e==`number`?Uu(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Uu(e.getTime()):Dl()}function Uu(e){return e>9999999999?e/1e3:e}function Wu(e){if(Ku(e))return e.getSpanJSON();try{let{spanId:t,traceId:n}=e.spanContext();if(Gu(e)){let{attributes:r,startTime:i,name:a,endTime:o,parentSpanId:s,status:c}=e;return xl({span_id:t,trace_id:n,data:r,description:a,parent_span_id:s,start_timestamp:Hu(i),timestamp:Hu(o)||void 0,status:Ju(c),op:r[_u],origin:r[vu],_metrics_summary:mu(e)})}return{span_id:t,trace_id:n}}catch{return{}}}function Gu(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Ku(e){return typeof e.getSpanJSON==`function`}function qu(e){let{traceFlags:t}=e.spanContext();return t===1}function Ju(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`unknown_error`}var Yu=`_sentryChildSpans`,Xu=`_sentryRootSpan`;function Zu(e,t){ml(t,Xu,e[Xu]||e),e[Yu]?e[Yu].add(t):ml(e,Yu,new Set([t]))}function Qu(e,t){e[Yu]&&e[Yu].delete(t)}function $u(e){let t=new Set;function n(e){if(!t.has(e)&&qu(e)){t.add(e);let r=e[Yu]?Array.from(e[Yu]):[];for(let e of r)n(e)}}return n(e),Array.from(t)}function ed(e){return e[Xu]||e}function td(){let e=ou(Lc());return e.getActiveSpan?e.getActiveSpan():Yl(su())}function nd(){Ru||=(wc(()=>{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.")}),!0)}function rd(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=du(),n=e||t&&t.getOptions();return!!n&&(n.enableTracing||`tracesSampleRate`in n||`tracesSampler`in n)}var id=`production`,ad=`_frozenDsc`;function od(e,t){ml(e,ad,t)}function sd(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i=xl({environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e});return t.emit(`createDsc`,i),i}function cd(e,t){let n=t.getPropagationContext();return n.dsc||sd(n.traceId,e)}function ld(e){let t=du();if(!t)return{};let n=ed(e),r=n[ad];if(r)return r;let i=n.spanContext().traceState,a=i&&i.get(`sentry.dsc`),o=a&&ku(a);if(o)return o;let s=sd(e.spanContext().traceId,t),c=Wu(n),l=c.data||{},u=l[gu];u!=null&&(s.sample_rate=`${u}`);let d=l[hu],f=c.description;return d!==`url`&&f&&(s.transaction=f),rd()&&(s.sampled=String(qu(n))),t.emit(`createDsc`,s,n),s}function ud(){let e=typeof WeakSet==`function`,t=e?new WeakSet:[];function n(n){if(e)return t.has(n)?!0:(t.add(n),!1);for(let e=0;e<t.length;e++)if(t[e]===n)return!0;return t.push(n),!1}function r(n){if(e)t.delete(n);else for(let e=0;e<t.length;e++)if(t[e]===n){t.splice(e,1);break}}return[n,r]}function dd(e,t=100,n=1/0){try{return pd(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function fd(e,t=3,n=100*1024){let r=dd(e,t);return _d(r)>n?fd(e,t-1,n):r}function pd(e,t,n=1/0,r=1/0,i=ud()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=md(e,t);if(!s.startsWith(`[object `))return s;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__==`number`?t.__sentry_override_normalization_depth__:n;if(c===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let l=t;if(l&&typeof l.toJSON==`function`)try{return pd(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=_l(t);for(let e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(d>=r){u[e]=`[MaxProperties ~]`;break}let t=f[e];u[e]=pd(e,t,c-1,r,i),d++}return o(t),u}function md(e,t){try{if(e===`domain`&&t&&typeof t==`object`&&t._events)return`[Domain]`;if(e===`domainEmitter`)return`[DomainEmitter]`;if(n!==void 0&&t===n)return`[Global]`;if(typeof window<`u`&&t===window)return`[Window]`;if(typeof document<`u`&&t===document)return`[Document]`;if(tl(t))return`[VueViewModel]`;if($c(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${Fc(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let r=hd(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}}function hd(e){let t=Object.getPrototypeOf(e);return t?t.constructor.name:`null prototype`}function gd(e){return~-encodeURI(e).split(/%..|./).length}function _d(e){return gd(JSON.stringify(e))}function vd(e,t,n,r=0){return new zl((i,a)=>{let o=e[r];if(t===null||typeof o!=`function`)i(t);else{let s=o({...t},n);gc&&o.id&&s===null&&Ec.log(`Event processor "${o.id}" dropped event`),Qc(s)?s.then(t=>vd(e,t,n,r+1).then(i)).then(null,a):vd(e,s,n,r+1).then(i).then(null,a)}})}var yd,bd,xd;function Sd(e){let t=vc._sentryDebugIds;if(!t)return{};let n=Object.keys(t);return xd&&n.length===bd?xd:(bd=n.length,xd=n.reduce((n,r)=>{yd||={};let i=yd[r];if(i)n[i[0]]=i[1];else{let i=e(r);for(let e=i.length-1;e>=0;e--){let a=i[e],o=a&&a.filename,s=t[r];if(o&&s){n[o]=s,yd[r]=[o,s];break}}}return n},{}),xd)}function Cd(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Ed(e,t),r&&kd(e,r),Ad(e,n),Dd(e,i),Od(e,a)}function wd(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:f,transactionName:p,span:m}=t;Td(e,`extra`,n),Td(e,`tags`,r),Td(e,`user`,i),Td(e,`contexts`,a),e.sdkProcessingMetadata=Kl(e.sdkProcessingMetadata,s,2),o&&(e.level=o),p&&(e.transactionName=p),m&&(e.span=m),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...f}}function Td(e,t,n){e[t]=Kl(e[t],n,1)}function Ed(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t,c=xl(n);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});let l=xl(r);l&&Object.keys(l).length&&(e.tags={...l,...e.tags});let u=xl(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});let d=xl(a);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function Dd(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Od(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function kd(e,t){e.contexts={trace:Bu(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ld(t),...e.sdkProcessingMetadata};let n=Wu(ed(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Ad(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}function jd(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||kl(),timestamp:t.timestamp||Tl()},l=n.integrations||e.integrations.map(e=>e.name);Md(c,e),Fd(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Nd(c,e.stackParser);let u=Ld(r,n.captureContext);n.mechanism&&Nl(c,n.mechanism);let d=i?i.getEventProcessors():[],f=lu().getScopeData();a&&wd(f,a.getScopeData()),u&&wd(f,u.getScopeData());let p=[...n.attachments||[],...f.attachments];return p.length&&(n.attachments=p),Cd(c,f),vd([...d,...f.eventProcessors],c,n).then(e=>(e&&Pd(e),typeof o==`number`&&o>0?Id(e,o,s):e))}function Md(e,t){let{environment:n,release:r,dist:i,maxValueLength:a=250}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i),e.message&&=ll(e.message,a);let o=e.exception&&e.exception.values&&e.exception.values[0];o&&o.value&&(o.value=ll(o.value,a));let s=e.request;s&&s.url&&(s.url=ll(s.url,a))}function Nd(e,t){let n=Sd(t);try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{n&&e.filename&&(e.debug_id=n[e.filename])})})}catch{}}function Pd(e){let t={};try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function Fd(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Id(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:dd(e.data,t,n)}}))},...e.user&&{user:dd(e.user,t,n)},...e.contexts&&{contexts:dd(e.contexts,t,n)},...e.extra&&{extra:dd(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=dd(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:dd(e.data,t,n)}}))),e.contexts&&e.contexts.flags&&r.contexts&&(r.contexts.flags=dd(e.contexts.flags,3,n)),r}function Ld(e,t){if(!t)return e;let n=e?e.clone():new Zl;return n.update(t),n}function Rd(e){if(e)return zd(e)||Vd(e)?{captureContext:e}:e}function zd(e){return e instanceof Zl||typeof e==`function`}var Bd=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`requestSession`,`propagationContext`];function Vd(e){return Object.keys(e).some(e=>Bd.includes(e))}function Hd(e,t){return su().captureException(e,Rd(t))}function Ud(e,t){return su().captureEvent(e,t)}function Wd(e,t){cu().setContext(e,t)}function Gd(){return cu().lastEventId()}function Kd(){let e=du();return!!e&&e.getOptions().enabled!==!1&&!!e.getTransport()}function qd(e){let t=du(),n=cu(),r=su(),{release:i,environment:a=id}=t&&t.getOptions()||{},{userAgent:o}=vc.navigator||{},s=Bl({release:i,environment:a,user:r.getUser()||n.getUser(),...o&&{userAgent:o},...e}),c=n.getSession();return c&&c.status===`ok`&&Vl(c,{status:`exited`}),Jd(),n.setSession(s),r.setSession(s),s}function Jd(){let e=cu(),t=su(),n=t.getSession()||e.getSession();n&&Hl(n),Yd(),e.setSession(),t.setSession()}function Yd(){let e=cu(),t=su(),n=du(),r=t.getSession()||e.getSession();r&&n&&n.captureSession(r)}function Xd(e=!1){if(e){Jd();return}Yd()}var Zd={"font-body-xs-regular":`_font-body-xs-regular_6v6n8_12`,"font-body-xs-semibold":`_font-body-xs-semibold_6v6n8_17`,"font-body-xs-medium":`_font-body-xs-medium_6v6n8_22`,"font-body-sm-regular":`_font-body-sm-regular_6v6n8_31`,"font-body-sm-semibold":`_font-body-sm-semibold_6v6n8_36`,"font-body-sm-medium":`_font-body-sm-medium_6v6n8_41`,"font-body-md-regular":`_font-body-md-regular_6v6n8_50`,"font-body-md-semibold":`_font-body-md-semibold_6v6n8_55`,"font-body-md-medium":`_font-body-md-medium_6v6n8_60`,"font-body-lg-regular":`_font-body-lg-regular_6v6n8_69`,"font-body-lg-semibold":`_font-body-lg-semibold_6v6n8_74`,"font-body-lg-medium":`_font-body-lg-medium_6v6n8_79`,"font-heading-sm-regular":`_font-heading-sm-regular_6v6n8_88`,"font-heading-sm-semibold":`_font-heading-sm-semibold_6v6n8_93`,"font-heading-sm-medium":`_font-heading-sm-medium_6v6n8_98`,"font-heading-md-regular":`_font-heading-md-regular_6v6n8_107`,"font-heading-md-semibold":`_font-heading-md-semibold_6v6n8_112`,"font-heading-lg-regular":`_font-heading-lg-regular_6v6n8_121`,"font-heading-lg-semibold":`_font-heading-lg-semibold_6v6n8_126`,"font-heading-xl-regular":`_font-heading-xl-regular_6v6n8_135`,"font-heading-xl-semibold":`_font-heading-xl-semibold_6v6n8_140`,typography:`_typography_6v6n8_153`},Qd=i(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()})),$d=i((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ef=i(((e,t)=>{t.exports=$d()})),z=e(Qd(),1),B=ef(),tf=({as:e,children:t,type:n=`body`,weight:r=`regular`,size:i=`md`,className:a,...o})=>(0,B.jsx)(e||`p`,{...o,className:(0,z.default)(Zd.typography,Zd[`font-${n}-${i}-${r}`],a),children:t}),nf=({as:e=`p`,children:t,...n})=>(0,B.jsx)(tf,{as:e,type:`body`,...n,children:t}),rf={button:`_button_13vu4_8`,"icon-only":`_icon-only_13vu4_53`,"has-icon":`_has-icon_13vu4_60`,destructive:`_destructive_13vu4_110`},af=(0,R.forwardRef)(function({as:e,children:t,className:n,disabled:r,...i},a){let o=e||`button`,{onClick:s,onSubmit:c,onPointerDown:l,onPointerUp:u,onKeyDown:d,onKeyUp:f,onKeyPress:p,...m}=i,h=r?{}:{onClick:s,onSubmit:c,onPointerDown:l,onPointerUp:u,onKeyDown:d,onKeyUp:f,onKeyPress:p};return(0,B.jsx)(o,{ref:a,className:n,role:e===`a`?`link`:`button`,tabIndex:0,"aria-disabled":r,...m,...h,children:t})}),of=(0,R.forwardRef)(function({as:e,kind:t=`primary`,size:n=`lg`,children:r,className:i,iconOnly:a,Icon:o,destructive:s,disabled:c,...l},u){let[d,f]=t===`destructive`?[`secondary`,!0]:[t,s],p=(0,z.default)(rf.button,i,{[rf[`has-icon`]]:o,[rf[`icon-only`]]:a,[rf.destructive]:f}),m=a&&n===`lg`?24:20;return(0,B.jsxs)(af,{...l,as:e||`button`,ref:u,className:p,"data-size":n,"data-kind":d,tabIndex:0,disabled:c,children:[o&&(0,B.jsx)(o,{width:m,height:m,className:rf.icon,"aria-hidden":!0}),r]})}),sf={"indicator-icon":`_indicator-icon_147l5_17`},cf=(0,R.forwardRef)(function({children:e,className:t,size:n=`100%`,colour:r,indicator:i},a){return(0,B.jsx)(`div`,{ref:a,className:(0,z.default)(sf[`indicator-icon`],t),"data-indicator":i,style:{"--cpd-icon-button-size":n,"--cpd-color-icon-tertiary":r},children:R.Children.only(e)})});function lf(){return typeof window<`u`}function uf(e){return pf(e)?(e.nodeName||``).toLowerCase():`#document`}function df(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ff(e){return((pf(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function pf(e){return lf()?e instanceof Node||e instanceof df(e).Node:!1}function V(e){return lf()?e instanceof Element||e instanceof df(e).Element:!1}function mf(e){return lf()?e instanceof HTMLElement||e instanceof df(e).HTMLElement:!1}function hf(e){return!lf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof df(e).ShadowRoot}function gf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Df(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _f(e){return/^(table|td|th)$/.test(uf(e))}function vf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yf=/transform|translate|scale|rotate|perspective|filter/,bf=/paint|layout|strict|content/,xf=e=>!!e&&e!==`none`,Sf;function Cf(e){let t=V(e)?Df(e):e;return xf(t.transform)||xf(t.translate)||xf(t.scale)||xf(t.rotate)||xf(t.perspective)||!Tf()&&(xf(t.backdropFilter)||xf(t.filter))||yf.test(t.willChange||``)||bf.test(t.contain||``)}function wf(e){let t=kf(e);for(;mf(t)&&!Ef(t);){if(Cf(t))return t;if(vf(t))return null;t=kf(t)}return null}function Tf(){return Sf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sf}function Ef(e){return/^(html|body|#document)$/.test(uf(e))}function Df(e){return df(e).getComputedStyle(e)}function Of(e){return V(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kf(e){if(uf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hf(e)&&e.host||ff(e);return hf(t)?t.host:t}function Af(e){let t=kf(e);return Ef(t)?e.ownerDocument?e.ownerDocument.body:e.body:mf(t)&&gf(t)?t:Af(t)}function jf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Af(e),i=r===e.ownerDocument?.body,a=df(r);if(i){let e=Mf(a);return t.concat(a,a.visualViewport||[],gf(r)?r:[],e&&n?jf(e):[])}else return t.concat(r,jf(r,[],n))}function Mf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Nf=[`top`,`right`,`bottom`,`left`],Pf=Math.min,Ff=Math.max,If=Math.round,Lf=Math.floor,Rf=e=>({x:e,y:e}),zf={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Bf(e,t,n){return Ff(e,Pf(t,n))}function Vf(e,t){return typeof e==`function`?e(t):e}function Hf(e){return e.split(`-`)[0]}function Uf(e){return e.split(`-`)[1]}function Wf(e){return e===`x`?`y`:`x`}function Gf(e){return e===`y`?`height`:`width`}function Kf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function qf(e){return Wf(Kf(e))}function Jf(e,t,n){n===void 0&&(n=!1);let r=Uf(e),i=qf(e),a=Gf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=rp(o)),[o,rp(o)]}function Yf(e){let t=rp(e);return[Xf(e),t,Xf(t)]}function Xf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Zf=[`left`,`right`],Qf=[`right`,`left`],$f=[`top`,`bottom`],ep=[`bottom`,`top`];function tp(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Qf:Zf:t?Zf:Qf;case`left`:case`right`:return t?$f:ep;default:return[]}}function np(e,t,n,r){let i=Uf(e),a=tp(Hf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Xf)))),a}function rp(e){let t=Hf(e);return zf[t]+e.slice(t.length)}function ip(e){return{top:0,right:0,bottom:0,left:0,...e}}function ap(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ip(e)}function op(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}var sp=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),cp=typeof Element>`u`,lp=cp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,up=!cp&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},dp=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):dp(e.parentNode))},fp=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},pp=function(e,t,n){if(dp(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(sp));return t&&lp.call(e,sp)&&r.unshift(e),r=r.filter(n),r},mp=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!dp(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=mp(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{lp.call(a,sp)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!dp(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=mp(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},hp=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},gp=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||fp(e))&&!hp(e)?0:e.tabIndex},_p=function(e,t){var n=gp(e);return n<0&&t&&!hp(e)?0:n},vp=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},yp=function(e){return e.tagName===`INPUT`},bp=function(e){return yp(e)&&e.type===`hidden`},xp=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},Sp=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},Cp=function(e){if(!e.name)return!0;var t=e.form||up(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=Sp(r,e.form);return!i||i===e},wp=function(e){return yp(e)&&e.type===`radio`},Tp=function(e){return wp(e)&&!Cp(e)},Ep=function(e){var t=e&&up(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=up(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},Dp=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Op=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=lp.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(lp.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=up(e);if(o&&!o.shadowRoot&&r(o)===!0)return Dp(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(Ep(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return Dp(e);return!1},kp=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return lp.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},Ap=function(e,t){return!(t.disabled||bp(t)||Op(t,e)||xp(t)||kp(t))},jp=function(e,t){return!(Tp(t)||gp(t)<0||!Ap(e,t))},Mp=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},Np=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=_p(a,i),s=i?Np(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(vp).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Pp=function(e,t){return t||={},Np(t.getShadowRoot?mp([e],t.includeContainer,{filter:jp.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Mp}):pp(e,t.includeContainer,jp.bind(null,t)))};function Fp(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Ip(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function Lp(){return/apple/i.test(navigator.vendor)}function Rp(){return Fp().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function zp(){return Ip().includes(`jsdom/`)}var Bp=`data-floating-ui-focusable`,Vp=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function Hp(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Up(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&hf(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Wp(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Gp(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Kp(e){return e.matches(`html,body`)}function qp(e){return e?.ownerDocument||document}function Jp(e){return mf(e)&&e.matches(Vp)}function Yp(e){if(!e||zp())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Xp(e){return e?e.hasAttribute(Bp)?e:e.querySelector(`[`+Bp+`]`)||e:null}function Zp(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Zp(e,t.id,n)])}function Qp(e){return`nativeEvent`in e}function $p(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var em=typeof document<`u`?R.useLayoutEffect:function(){},tm={...R};function nm(e){let t=R.useRef(e);return em(()=>{t.current=e}),t}var rm=tm.useInsertionEffect||(e=>e());function im(e){let t=R.useRef(()=>{});return rm(()=>{t.current=e}),R.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var am=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function om(e,t){let n=Pp(e,am()),r=n.length;if(r===0)return;let i=Hp(qp(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function sm(e){return om(qp(e).body,1)||e}function cm(e){return om(qp(e).body,-1)||e}function lm(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Up(n,r)}function um(e){Pp(e,am()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function dm(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var fm=e(pa(),1);function pm(e,t,n){let{reference:r,floating:i}=e,a=Kf(t),o=qf(t),s=Gf(o),c=Hf(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Uf(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function mm(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Vf(t,e),p=ap(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=op(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=op(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hm=50,gm=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mm},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=pm(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hm&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=pm(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},_m=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Vf(e,t)||{};if(l==null)return{};let d=ap(u),f={x:n,y:r},p=qf(i),m=Gf(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Pf(d[_],T),D=Pf(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Bf(O,A,k),M=!c.arrow&&Uf(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),vm=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Vf(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Hf(r),_=Kf(o),v=Hf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[rp(o)]:Yf(o)),x=p!==`none`;!d&&x&&b.push(...np(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Jf(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Kf(t))||T.every(e=>Kf(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Kf(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ym(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bm(e){return Nf.some(t=>e[t]>=0)}var xm=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Vf(e,t);switch(i){case`referenceHidden`:{let e=ym(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bm(e)}}}case`escaped`:{let e=ym(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bm(e)}}}default:return{}}}}},Sm=new Set([`left`,`top`]);async function Cm(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Hf(n),s=Uf(n),c=Kf(n)===`y`,l=Sm.has(o)?-1:1,u=a&&c?-1:1,d=Vf(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wm=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cm(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tm=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Vf(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Kf(Hf(i)),p=Wf(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Bf(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Bf(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Em=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Vf(e,t),u={x:n,y:r},d=Kf(i),f=Wf(d),p=u[f],m=u[d],h=Vf(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sm.has(Hf(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dm=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Vf(e,t),u=await o.detectOverflow(t,l),d=Hf(i),f=Uf(i),p=Kf(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Pf(h-u[g],v),x=Pf(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Ff(u.left,0),t=Ff(u.right,0),n=Ff(u.top,0),r=Ff(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Ff(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Ff(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Om(e){let t=Df(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=mf(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=If(n)!==a||If(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function km(e){return V(e)?e:e.contextElement}function Am(e){let t=km(e);if(!mf(t))return Rf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Om(t),o=(a?If(n.width):n.width)/r,s=(a?If(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var jm=Rf(0);function Mm(e){let t=df(e);return!Tf()||!t.visualViewport?jm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Nm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==df(e)?!1:t}function Pm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=km(e),o=Rf(1);t&&(r?V(r)&&(o=Am(r)):o=Am(e));let s=Nm(a,n,r)?Mm(a):Rf(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=df(a),t=r&&V(r)?df(r):r,n=e,i=Mf(n);for(;i&&r&&t!==n;){let e=Am(i),t=i.getBoundingClientRect(),r=Df(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=df(i),i=Mf(n)}}return op({width:u,height:d,x:c,y:l})}function Fm(e,t){let n=Of(e).scrollLeft;return t?t.left+n:Pm(ff(e)).left+n}function Im(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Fm(e,n),y:n.top+t.scrollTop}}function Lm(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ff(r),s=t?vf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Rf(1),u=Rf(0),d=mf(r);if((d||!d&&!a)&&((uf(r)!==`body`||gf(o))&&(c=Of(r)),d)){let e=Pm(r);l=Am(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Im(o,c):Rf(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Rm(e){return Array.from(e.getClientRects())}function zm(e){let t=ff(e),n=Of(e),r=e.ownerDocument.body,i=Ff(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ff(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Fm(e),s=-n.scrollTop;return Df(r).direction===`rtl`&&(o+=Ff(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Bm=25;function Vm(e,t){let n=df(e),r=ff(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Tf();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Fm(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Bm&&(a-=o)}else l<=Bm&&(a+=l);return{width:a,height:o,x:s,y:c}}function Hm(e,t){let n=Pm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=mf(e)?Am(e):Rf(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Um(e,t,n){let r;if(t===`viewport`)r=Vm(e,n);else if(t===`document`)r=zm(ff(e));else if(V(t))r=Hm(t,n);else{let n=Mm(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return op(r)}function Wm(e,t){let n=kf(e);return n===t||!V(n)||Ef(n)?!1:Df(n).position===`fixed`||Wm(n,t)}function Gm(e,t){let n=t.get(e);if(n)return n;let r=jf(e,[],!1).filter(e=>V(e)&&uf(e)!==`body`),i=null,a=Df(e).position===`fixed`,o=a?kf(e):e;for(;V(o)&&!Ef(o);){let t=Df(o),n=Cf(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||gf(o)&&!n&&Wm(e,o))?r=r.filter(e=>e!==o):i=t,o=kf(o)}return t.set(e,r),r}function Km(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vf(t)?[]:Gm(t,this._c):[].concat(n),r],o=Um(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Um(t,a[e],i);s=Ff(n.top,s),c=Pf(n.right,c),l=Pf(n.bottom,l),u=Ff(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qm(e){let{width:t,height:n}=Om(e);return{width:t,height:n}}function Jm(e,t,n){let r=mf(t),i=ff(t),a=n===`fixed`,o=Pm(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Rf(0);function l(){c.x=Fm(i)}if(r||!r&&!a)if((uf(t)!==`body`||gf(i))&&(s=Of(t)),r){let e=Pm(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Im(i,s):Rf(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Ym(e){return Df(e).position===`static`}function Xm(e,t){if(!mf(e)||Df(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ff(e)===n&&(n=n.ownerDocument.body),n}function Zm(e,t){let n=df(e);if(vf(e))return n;if(!mf(e)){let t=kf(e);for(;t&&!Ef(t);){if(V(t)&&!Ym(t))return t;t=kf(t)}return n}let r=Xm(e,t);for(;r&&_f(r)&&Ym(r);)r=Xm(r,t);return r&&Ef(r)&&Ym(r)&&!Cf(r)?n:r||wf(e)||n}var Qm=async function(e){let t=this.getOffsetParent||Zm,n=this.getDimensions,r=await n(e.floating);return{reference:Jm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $m(e){return Df(e).direction===`rtl`}var eh={convertOffsetParentRelativeRectToViewportRelativeRect:Lm,getDocumentElement:ff,getClippingRect:Km,getOffsetParent:Zm,getElementRects:Qm,getClientRects:Rm,getDimensions:qm,getScale:Am,isElement:V,isRTL:$m};function th(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nh(e,t){let n=null,r,i=ff(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Lf(d),h=Lf(i.clientWidth-(u+f)),g=Lf(i.clientHeight-(d+p)),_=Lf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ff(0,Pf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!th(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function rh(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=km(e),u=i||a?[...l?jf(l):[],...t?jf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?nh(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Pm(e):null;c&&g();function g(){let t=Pm(e);h&&!th(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ih=wm,ah=Tm,oh=vm,sh=Dm,ch=xm,lh=_m,uh=Em,dh=(e,t,n)=>{let r=new Map,i={platform:eh,...n},a={...i.platform,_c:r};return gm(e,t,{...i,platform:a})},fh=typeof document<`u`?R.useLayoutEffect:function(){};function ph(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ph(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ph(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function mh(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hh(e,t){let n=mh(e);return Math.round(t*n)/n}function gh(e){let t=R.useRef(e);return fh(()=>{t.current=e}),t}function _h(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=R.useState(r);ph(f,r)||p(r);let[m,h]=R.useState(null),[g,_]=R.useState(null),v=R.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=R.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=R.useRef(null),C=R.useRef(null),w=R.useRef(u),T=c!=null,E=gh(c),D=gh(i),O=gh(l),k=R.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),dh(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!ph(w.current,t)&&(w.current=t,fm.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);fh(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=R.useRef(!1);fh(()=>(A.current=!0,()=>{A.current=!1}),[]),fh(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=R.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=R.useMemo(()=>({reference:b,floating:x}),[b,x]),N=R.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=hh(M.floating,u.x),r=hh(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...mh(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return R.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var vh=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:lh({element:r.current,padding:i}).fn(n):r?lh({element:r,padding:i}).fn(n):{}}}},yh=(e,t)=>{let n=ih(e);return{name:n.name,fn:n.fn,options:[e,t]}},bh=(e,t)=>{let n=ah(e);return{name:n.name,fn:n.fn,options:[e,t]}},xh=(e,t)=>({fn:uh(e).fn,options:[e,t]}),Sh=(e,t)=>{let n=oh(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ch=(e,t)=>{let n=sh(e);return{name:n.name,fn:n.fn,options:[e,t]}},wh=(e,t)=>{let n=ch(e);return{name:n.name,fn:n.fn,options:[e,t]}},Th=(e,t)=>{let n=vh(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Eh(e){let t=R.useRef(void 0),n=R.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return R.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}var Dh=`data-floating-ui-focusable`,Oh=`active`,kh=`selected`,Ah=`ArrowLeft`,jh=`ArrowRight`,Mh=`ArrowUp`,Nh=`ArrowDown`,Ph=[Ah,jh],Fh=[Mh,Nh];[...Ph,...Fh];var Ih={...R},Lh=!1,Rh=0,zh=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+ Rh++;function Bh(){let[e,t]=R.useState(()=>Lh?zh():void 0);return em(()=>{e??t(zh())},[]),R.useEffect(()=>{Lh=!0},[]),e}var Vh=Ih.useId||Bh,Hh=R.forwardRef(function(e,t){let{context:{placement:n,elements:{floating:r},middlewareData:{arrow:i,shift:a}},width:o=14,height:s=7,tipRadius:c=0,strokeWidth:l=0,staticOffset:u,stroke:d,d:f,style:{transform:p,...m}={},...h}=e,g=Vh(),[_,v]=R.useState(!1);if(em(()=>{r&&Df(r).direction===`rtl`&&v(!0)},[r]),!r)return null;let[y,b]=n.split(`-`),x=y===`top`||y===`bottom`,S=u;(x&&a!=null&&a.x||!x&&a!=null&&a.y)&&(S=null);let C=l*2,w=C/2,T=o/2*(c/-8+1),E=s/2*c/4,D=!!f,O=S&&b===`end`?`bottom`:`top`,k=S&&b===`end`?`right`:`left`;S&&_&&(k=b===`end`?`left`:`right`);let A=i?.x==null?``:S||i.x,j=i?.y==null?``:S||i.y,M=f||`M0,0`+(` H`+o)+(` L`+(o-T)+`,`+(s-E))+(` Q`+o/2+`,`+s+` `+T+`,`+(s-E))+` Z`,N={top:D?`rotate(180deg)`:``,left:D?`rotate(90deg)`:`rotate(-90deg)`,bottom:D?``:`rotate(180deg)`,right:D?`rotate(-90deg)`:`rotate(90deg)`}[y];return(0,B.jsxs)(`svg`,{...h,"aria-hidden":!0,ref:t,width:D?o:o+C,height:o,viewBox:`0 0 `+o+` `+(s>o?s:o),style:{position:`absolute`,pointerEvents:`none`,[k]:A,[O]:j,[y]:x||D?`100%`:`calc(100% - `+C/2+`px)`,transform:[N,p].filter(e=>!!e).join(` `),...m},children:[C>0&&(0,B.jsx)(`path`,{clipPath:`url(#`+g+`)`,fill:`none`,stroke:d,strokeWidth:C+ +!f,d:M}),(0,B.jsx)(`path`,{stroke:C&&!f?h.fill:`none`,d:M}),(0,B.jsx)(`clipPath`,{id:g,children:(0,B.jsx)(`rect`,{x:-w,y:w*(D?-1:1),width:o+C,height:o})})]})});function Uh(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var Wh=R.createContext(null),Gh=R.createContext(null),Kh=()=>R.useContext(Wh)?.id||null,qh=()=>R.useContext(Gh);function Jh(e){return`data-floating-ui-`+e}function Yh(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var Xh=Jh(`safe-polygon`);function Zh(e,t,n){if(n&&!$p(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function Qh(e){return typeof e==`function`?e():e}function $h(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=qh(),m=Kh(),h=nm(l),g=nm(c),_=nm(n),v=nm(d),y=R.useRef(),b=R.useRef(-1),x=R.useRef(),S=R.useRef(-1),C=R.useRef(!0),w=R.useRef(!1),T=R.useRef(()=>{}),E=R.useRef(!1),D=im(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});R.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||(Yh(b),Yh(S),C.current=!0,E.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),R.useEffect(()=>{if(!s||!h.current||!n)return;function e(e){D()&&r(!1,e,`hover`)}let t=qp(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,D]);let O=R.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Zh(g.current,`close`,y.current);i&&!x.current?(Yh(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Yh(b),r(!1,e,n))},[g,r]),k=im(()=>{T.current(),x.current=void 0}),A=im(()=>{if(w.current){let e=qp(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(Xh),w.current=!1}}),j=im(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);R.useEffect(()=>{if(!s)return;function e(e){if(Yh(b),C.current=!1,u&&!$p(y.current)||Qh(v.current)>0&&!Zh(g.current,`open`))return;let t=Zh(g.current,`open`,y.current);t?b.current=window.setTimeout(()=>{_.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(j()){A();return}T.current();let t=qp(o.floating);if(Yh(S),E.current=!1,h.current&&i.current.floatingContext){n||Yh(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),j()||O(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),T.current=()=>{t.removeEventListener(`mousemove`,r)};return}(y.current!==`touch`||!Up(o.floating,e.relatedTarget))&&O(e)}function a(e){j()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),j()||O(e)}})(e))}function c(){Yh(b)}function l(e){j()||O(e,!1)}if(V(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,O,k,A,r,n,_,p,g,h,i,j,v]),em(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&D()){w.current=!0;let e=o.floating;if(V(o.domReference)&&e){var t;let n=qp(o.floating).body;n.setAttribute(Xh,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,D]),em(()=>{n||(y.current=void 0,E.current=!1,k(),A())},[n,k,A]),R.useEffect(()=>()=>{k(),Yh(b),Yh(S),A()},[s,o.domReference,k,A]);let M=R.useMemo(()=>{function e(e){y.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!C.current&&!_.current&&r(!0,t,`hover`)}u&&!$p(y.current)||n||Qh(v.current)===0||E.current&&e.movementX**2+e.movementY**2<2||(Yh(S),y.current===`touch`?i():(E.current=!0,S.current=window.setTimeout(i,Qh(v.current))))}}},[u,r,n,_,v]);return R.useMemo(()=>s?{reference:M}:{},[s,M])}var eg=()=>{},tg=R.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:eg,setState:eg,isInstantPhase:!1}),ng=()=>R.useContext(tg);function rg(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=R.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=R.useRef(null),s=R.useCallback(e=>{a({currentId:e})},[]);return em(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),(0,B.jsx)(tg.Provider,{value:R.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}function ig(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{id:a,enabled:o=!0}=t,s=a??i,c=ng(),{currentId:l,setCurrentId:u,initialDelay:d,setState:f,timeoutMs:p}=c;return em(()=>{o&&l&&(f({delay:{open:1,close:Zh(d,`close`)}}),l!==s&&r(!1))},[o,s,r,f,l,d]),em(()=>{function e(){r(!1),f({delay:d,currentId:null})}if(o&&l&&!n&&l===s){if(p){let t=window.setTimeout(e,p);return()=>{clearTimeout(t)}}e()}},[o,n,f,l,s,r,d,p]),em(()=>{o&&(u===eg||!n||u(s))},[o,n,u,s]),c}var ag={border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`fixed`,whiteSpace:`nowrap`,width:`1px`,top:0,left:0},og=R.forwardRef(function(e,t){let[n,r]=R.useState();em(()=>{Lp()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[Jh(`focus-guard`)]:``,style:ag};return(0,B.jsx)(`span`,{...e,...i})}),sg={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},cg=R.createContext(null),lg=Jh(`portal`);function ug(e){e===void 0&&(e={});let{id:t,root:n}=e,r=Vh(),i=fg(),[a,o]=R.useState(null),s=R.useRef(null);return em(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),em(()=>{if(!r||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement(`div`);n.id=r,n.setAttribute(lg,``),e.appendChild(n),s.current=n,o(n)},[t,r]),em(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!pf(e)&&(e=e.current),e||=document.body;let a=null;t&&(a=document.createElement(`div`),a.id=t,e.appendChild(a));let c=document.createElement(`div`);c.id=r,c.setAttribute(lg,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function dg(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=ug({id:n,root:r}),[o,s]=R.useState(null),c=R.useRef(null),l=R.useRef(null),u=R.useRef(null),d=R.useRef(null),f=o?.modal,p=o?.open,m=!!o&&!o.modal&&o.open&&i&&!!(r||a);return R.useEffect(()=>{if(!a||!i||f)return;function e(e){a&&lm(e)&&(e.type===`focusin`?dm:um)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,f]),R.useEffect(()=>{a&&(p||dm(a))},[p,a]),(0,B.jsxs)(cg.Provider,{value:R.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:a,setFocusManagerState:s}),[i,a]),children:[m&&a&&(0,B.jsx)(og,{"data-type":`outside`,ref:c,onFocus:e=>{if(lm(e,a)){var t;(t=u.current)==null||t.focus()}else cm(o?o.domReference:null)?.focus()}}),m&&a&&(0,B.jsx)(`span`,{"aria-owns":a.id,style:sg}),a&&fm.createPortal(t,a),m&&a&&(0,B.jsx)(og,{"data-type":`outside`,ref:l,onFocus:e=>{if(lm(e,a)){var t;(t=d.current)==null||t.focus()}else sm(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var fg=()=>R.useContext(cg),pg={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},mg={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},hg=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function gg(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=qh(),g=im(typeof c==`function`?c:()=>!1),_=typeof c==`function`?g:c,v=R.useRef(!1),{escapeKey:y,outsidePress:b}=hg(p),{escapeKey:x,outsidePress:S}=hg(m),C=R.useRef(!1),w=im(e=>{if(!n||!o||!s||e.key!==`Escape`||C.current)return;let t=a.current.floatingContext?.nodeId,i=h?Zp(h.nodesRef.current,t):[];if(!y&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}r(!1,Qp(e)?e.nativeEvent:e,`escape-key`)}),T=im(e=>{var t;let n=()=>{var t;w(e),(t=Wp(e))==null||t.removeEventListener(`keydown`,n)};(t=Wp(e))==null||t.addEventListener(`keydown`,n)}),E=im(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=v.current;if(v.current=!1,l===`click`&&n||t||typeof _==`function`&&!_(e))return;let o=Wp(e),s=`[`+Jh(`inert`)+`]`,c=qp(i.floating).querySelectorAll(s),u=V(o)?o:null;for(;u&&!Ef(u);){let e=kf(u);if(Ef(e)||!V(e))break;u=e}if(c.length&&V(o)&&!Kp(o)&&!Up(o,i.floating)&&Array.from(c).every(e=>!Up(u,e)))return;if(mf(o)&&k){let t=Ef(o),n=Df(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&Zp(h.nodesRef.current,d).some(t=>Gp(e,t.context?.elements.floating));if(Gp(e,i.floating)||Gp(e,i.domReference)||f)return;let p=h?Zp(h.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}r(!1,e,`outside-press`)}),D=im(e=>{var t;let n=()=>{var t;E(e),(t=Wp(e))==null||t.removeEventListener(l,n)};(t=Wp(e))==null||t.addEventListener(l,n)});R.useEffect(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=b;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),C.current=!0}function u(){e=window.setTimeout(()=>{C.current=!1},Tf()?5:0)}let d=qp(i.floating);s&&(d.addEventListener(`keydown`,x?T:w,x),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),_&&d.addEventListener(l,S?D:E,S);let p=[];return f&&(V(i.domReference)&&(p=jf(i.domReference)),V(i.floating)&&(p=p.concat(jf(i.floating))),!V(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(jf(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{s&&(d.removeEventListener(`keydown`,x?T:w,x),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),_&&d.removeEventListener(l,S?D:E,S),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,_,l,n,r,f,o,y,b,w,x,T,E,S,D]),R.useEffect(()=>{a.current.insideReactTree=!1},[a,_,l]);let O=R.useMemo(()=>({onKeyDown:w,...u&&{[pg[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[w,r,u,d]),k=R.useMemo(()=>{function e(e){e.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:e,onMouseUp:e,[mg[l]]:()=>{a.current.insideReactTree=!0}}},[w,l,a]);return R.useMemo(()=>o?{reference:O,floating:k}:{},[o,O,k])}function _g(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=Vh(),a=R.useRef({}),[o]=R.useState(()=>Uh()),s=Kh()!=null,[c,l]=R.useState(r.reference),u=im((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=R.useMemo(()=>({setPositionReference:l}),[]),f=R.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return R.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function vg(e){e===void 0&&(e={});let{nodeId:t}=e,n=_g({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=R.useState(null),[s,c]=R.useState(null),l=i?.domReference||a,u=R.useRef(null),d=qh();em(()=>{l&&(u.current=l)},[l]);let f=_h({...e,elements:{...i,...s&&{reference:s}}}),p=R.useCallback(e=>{let t=V(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;c(t),f.refs.setReference(t)},[f.refs]),m=R.useCallback(e=>{(V(e)||e===null)&&(u.current=e,o(e)),(V(f.refs.reference.current)||f.refs.reference.current===null||e!==null&&!V(e))&&f.refs.setReference(e)},[f.refs]),h=R.useMemo(()=>({...f.refs,setReference:m,setPositionReference:p,domReference:u}),[f.refs,m,p]),g=R.useMemo(()=>({...f.elements,domReference:l}),[f.elements,l]),_=R.useMemo(()=>({...f,...r,refs:h,elements:g,nodeId:t}),[f,h,g,t,r]);return em(()=>{r.dataRef.current.floatingContext=_;let e=d?.nodesRef.current.find(e=>e.id===t);e&&(e.context=_)}),R.useMemo(()=>({...f,context:_,refs:h,elements:g}),[f,h,g,_])}function yg(){return Rp()&&Lp()}function bg(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,events:i,dataRef:a,elements:o}=e,{enabled:s=!0,visibleOnly:c=!0}=t,l=R.useRef(!1),u=R.useRef(-1),d=R.useRef(!0);R.useEffect(()=>{if(!s)return;let e=df(o.domReference);function t(){!n&&mf(o.domReference)&&o.domReference===Hp(qp(o.domReference))&&(l.current=!0)}function r(){d.current=!0}function i(){d.current=!1}return e.addEventListener(`blur`,t),yg()&&(e.addEventListener(`keydown`,r,!0),e.addEventListener(`pointerdown`,i,!0)),()=>{e.removeEventListener(`blur`,t),yg()&&(e.removeEventListener(`keydown`,r,!0),e.removeEventListener(`pointerdown`,i,!0))}},[o.domReference,n,s]),R.useEffect(()=>{if(!s)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(l.current=!0)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[i,s]),R.useEffect(()=>()=>{Yh(u)},[]);let f=R.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(e){if(l.current)return;let t=Wp(e.nativeEvent);if(c&&V(t)){if(yg()&&!e.relatedTarget){if(!d.current&&!Jp(t))return}else if(!Yp(t))return}r(!0,e.nativeEvent,`focus`)},onBlur(e){l.current=!1;let t=e.relatedTarget,n=e.nativeEvent,i=V(t)&&t.hasAttribute(Jh(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;u.current=window.setTimeout(()=>{let e=Hp(o.domReference?o.domReference.ownerDocument:document);!t&&e===o.domReference||Up(a.current.floatingContext?.refs.floating.current,e)||Up(o.domReference,e)||i||r(!1,n,`focus`)})}}),[a,o.domReference,r,c]);return R.useMemo(()=>s?{reference:f}:{},[s,f])}function xg(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[Oh]:t,[kh]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[Dh]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[Oh,kh].includes(n)))if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}),e),{})}}function Sg(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=R.useCallback(t=>xg(t,e,`reference`),t),a=R.useCallback(t=>xg(t,e,`floating`),n),o=R.useCallback(t=>xg(t,e,`item`),r);return R.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var Cg=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function wg(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=Vh(),c=r.domReference?.id||s,l=R.useMemo(()=>Xp(r.floating)?.id||i,[r.floating,i]),u=Cg.get(o)??o,d=Kh()!=null,f=R.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=R.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=R.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return R.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}var Tg={open:300,close:0},Eg=({children:e})=>(0,B.jsx)(rg,{delay:Tg,timeoutMs:300,children:e});Eg.displayName=`TooltipProvider`;function Dg({open:e,disabled:t=!1,onOpenChange:n,placement:r=`bottom`,isTriggerInteractive:i,caption:a,"aria-atomic":o,"aria-live":s,...c}){let l=Vh(),u=Vh(),d=(0,R.useRef)(null),[f,p]=(0,R.useState)(!1),m=t?!1:e??f,h=(t,r,i)=>{n?.(t,r,i),e===void 0&&p(t)},g=vg({placement:r,open:m,onOpenChange:h,whileElementsMounted:rh,middleware:[yh(6),Sh({crossAxis:r.includes(`-`),fallbackAxisSideDirection:`start`,padding:5}),bh({padding:5}),Th({element:d})]}),_=g.context,{delay:v,initialDelay:y}=ig(_);if(y!==Tg)throw Error(`Tooltips must be wrapped in a global <TooltipProvider>`);let b=$h(_,{move:!1,enabled:e===void 0,delay:i?v:{},mouseOnly:!0}),x=bg(_,{enabled:e===void 0}),S=(0,R.useRef)(void 0);(0,R.useEffect)(()=>()=>window.clearTimeout(S.current),[]);let C=(0,R.useMemo)(()=>{let e=()=>{S.current===void 0?S.current=window.setTimeout(()=>{h(!1),S.current=void 0},1500):window.clearTimeout(S.current)};return{reference:{onTouchStart:()=>{S.current!==void 0&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{h(!0),S.current=void 0},500)},onTouchEnd:e,onTouchCancel:e}}},[]),w=gg(_),T=`label`in c?`label`:`description`,E=wg(_,{enabled:T===`description`,role:`tooltip`}),D=Sg([b,x,C,w,E,(0,R.useMemo)(()=>T===`label`?{reference:{"aria-labelledby":l,"aria-describedby":a?u:void 0}}:{},[T,l,u])]);return(0,R.useMemo)(()=>({labelId:l,captionId:a?u:void 0,caption:a,purpose:T,open:m,setOpen:h,tooltipProps:{"aria-atomic":o,"aria-live":s},...D,...g,arrowRef:d}),[l,u,a,E,m,h,D,g,d])}var Og=(0,R.createContext)(null);function kg(){let e=(0,R.useContext)(Og);if(e==null)throw Error(`Tooltip components must be wrapped in <Tooltip />`);return e}var Ag={tooltip:`_tooltip_1nqnq_8`,invisible:`_invisible_1nqnq_21`,caption:`_caption_1nqnq_28`,arrow:`_arrow_1nqnq_33`},jg=e=>`label`in e&&!!e.label;function Mg({children:e,isTriggerInteractive:t=!0,nonInteractiveTriggerTabIndex:n=0,...r}){let i=Dg({isTriggerInteractive:t,...r});return(0,B.jsxs)(Og.Provider,{value:i,children:[(0,B.jsx)(Fg,{isTriggerInteractive:t,nonInteractiveTriggerTabIndex:n,children:e}),(0,B.jsxs)(Pg,{children:[(0,B.jsx)(`span`,{id:i.labelId,children:jg(r)?r.label:r.description}),(0,B.jsx)(Ng,{})]})]})}function Ng(){let{caption:e,captionId:t}=kg();return e?(0,B.jsx)(typeof e==`string`?`span`:`div`,{id:t,className:(0,z.default)(Ag.caption,`cpd-theme-dark`),children:e}):null}function Pg({children:e}){let{context:t,open:n,arrowRef:r,purpose:i,...a}=kg();return!n&&i!==`label`?null:(0,B.jsx)(dg,{children:(0,B.jsxs)(`div`,{ref:a.refs.setFloating,style:a.floatingStyles,...a.tooltipProps,...a.getFloatingProps(),className:(0,z.default)(Ag.tooltip,{[Ag.invisible]:i===`label`&&!n}),children:[(0,B.jsx)(Hh,{ref:r,context:t,width:10,height:6,className:Ag.arrow}),e]})})}var Fg=({children:e,isTriggerInteractive:t,nonInteractiveTriggerTabIndex:n})=>{let r=kg(),i=e?.ref,a=Eh([r.refs.setReference,i]),o=(0,R.useMemo)(()=>{if((0,R.isValidElement)(e)){if(t)return(0,R.cloneElement)(e,r.getReferenceProps({...typeof e.props==`object`?e.props:{},ref:a}));{let{"aria-labelledby":t,"aria-describedby":i,...o}=r.getReferenceProps({ref:a,tabIndex:n});return(0,B.jsx)(`span`,{tabIndex:n,...o,children:(0,R.cloneElement)(e,{"aria-labelledby":t,"aria-describedby":i})})}}},[r,a,e]);if(!o)throw Error(`Tooltip anchor must be a single valid React element`);return o},Ig={"icon-button":`_icon-button_1215g_8`,"no-background":`_no-background_1215g_42`,destructive:`_destructive_1215g_95`},Lg=(0,R.forwardRef)(function({kind:e=`primary`,children:t,className:n,indicator:r,size:i=`32px`,style:a,disabled:o,destructive:s,tooltip:c,tooltipPlacement:l,noBackground:u=!1,...d},f){let p=(0,B.jsx)(af,{as:`button`,ref:f,className:(0,z.default)(Ig[`icon-button`],n,{[Ig.destructive]:s,[Ig[`no-background`]]:u}),style:{"--cpd-icon-button-size":i,...a},disabled:o,...d,"data-indicator":r,"data-kind":e,children:(0,B.jsx)(cf,{indicator:r,colour:o?`var(--cpd-color-icon-disabled)`:void 0,children:R.Children.only(t)})});return c?(0,B.jsx)(Mg,{label:c,placement:l,children:p}):p}),Rg={alert:`_alert_zx76t_10`,content:`_content_zx76t_37`,"text-content":`_text-content_zx76t_44`,title:`_title_zx76t_48`,icon:`_icon_zx76t_48`,actions:`_actions_zx76t_64`};function zg(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`m10.6 13.8-2.15-2.15a.95.95 0 0 0-.7-.275.95.95 0 0 0-.7.275.95.95 0 0 0-.275.7q0 .425.275.7L9.9 15.9q.3.3.7.3t.7-.3l5.65-5.65a.95.95 0 0 0 .275-.7.95.95 0 0 0-.275-.7.95.95 0 0 0-.7-.275.95.95 0 0 0-.7.275zM12 22a9.7 9.7 0 0 1-3.9-.788 10.1 10.1 0 0 1-3.175-2.137q-1.35-1.35-2.137-3.175A9.7 9.7 0 0 1 2 12q0-2.075.788-3.9a10.1 10.1 0 0 1 2.137-3.175q1.35-1.35 3.175-2.137A9.7 9.7 0 0 1 12 2q2.075 0 3.9.788a10.1 10.1 0 0 1 3.175 2.137q1.35 1.35 2.137 3.175A9.7 9.7 0 0 1 22 12a9.7 9.7 0 0 1-.788 3.9 10.1 10.1 0 0 1-2.137 3.175q-1.35 1.35-3.175 2.137A9.7 9.7 0 0 1 12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12t2.325 5.675T12 20`})})}zg.displayName=`CheckCircleIcon`;var Bg=(0,R.forwardRef)(zg);function Vg(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M12 17q.424 0 .713-.288A.97.97 0 0 0 13 16a.97.97 0 0 0-.287-.713A.97.97 0 0 0 12 15a.97.97 0 0 0-.713.287A.97.97 0 0 0 11 16q0 .424.287.712.288.288.713.288m0-4q.424 0 .713-.287A.97.97 0 0 0 13 12V8a.97.97 0 0 0-.287-.713A.97.97 0 0 0 12 7a.97.97 0 0 0-.713.287A.97.97 0 0 0 11 8v4q0 .424.287.713.288.287.713.287m0 9a9.7 9.7 0 0 1-3.9-.788 10.1 10.1 0 0 1-3.175-2.137q-1.35-1.35-2.137-3.175A9.7 9.7 0 0 1 2 12q0-2.075.788-3.9a10.1 10.1 0 0 1 2.137-3.175q1.35-1.35 3.175-2.137A9.7 9.7 0 0 1 12 2q2.075 0 3.9.788a10.1 10.1 0 0 1 3.175 2.137q1.35 1.35 2.137 3.175A9.7 9.7 0 0 1 22 12a9.7 9.7 0 0 1-.788 3.9 10.1 10.1 0 0 1-2.137 3.175q-1.35 1.35-3.175 2.137A9.7 9.7 0 0 1 12 22`})})}Vg.displayName=`ErrorSolidIcon`;var Hg=(0,R.forwardRef)(Vg);function Ug(e,t){return(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:[(0,B.jsx)(`path`,{d:`M11.288 7.288A.97.97 0 0 1 12 7q.424 0 .713.287Q13 7.576 13 8t-.287.713A.97.97 0 0 1 12 9a.97.97 0 0 1-.713-.287A.97.97 0 0 1 11 8q0-.424.287-.713m.001 4.001A.97.97 0 0 1 12 11q.424 0 .713.287.287.288.287.713v4q0 .424-.287.712A.97.97 0 0 1 12 17a.97.97 0 0 1-.713-.288A.97.97 0 0 1 11 16v-4q0-.424.287-.713`}),(0,B.jsx)(`path`,{fillRule:`evenodd`,d:`M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 1-16 0 8 8 0 0 1 16 0`,clipRule:`evenodd`})]})}Ug.displayName=`InfoIcon`;var Wg=(0,R.forwardRef)(Ug);function Gg(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M6.293 6.293a1 1 0 0 1 1.414 0L12 10.586l4.293-4.293a1 1 0 1 1 1.414 1.414L13.414 12l4.293 4.293a1 1 0 0 1-1.414 1.414L12 13.414l-4.293 4.293a1 1 0 0 1-1.414-1.414L10.586 12 6.293 7.707a1 1 0 0 1 0-1.414`})})}Gg.displayName=`CloseIcon`;var Kg=(0,R.forwardRef)(Gg),qg=({type:e,title:t,children:n,className:r,actions:i,onClose:a,...o})=>{let s=(0,z.default)(Rg.alert,r),c=(0,R.useCallback)(t=>{switch(e){case`critical`:return(0,B.jsx)(Hg,{...t});case`info`:return(0,B.jsx)(Wg,{...t});case`success`:return(0,B.jsx)(Bg,{...t})}},[e]);return(0,B.jsxs)(`div`,{...o,className:s,"data-type":e,children:[c({width:24,height:24,className:Rg.icon,"aria-hidden":!0}),(0,B.jsxs)(`div`,{className:Rg.content,children:[(0,B.jsxs)(`div`,{className:Rg[`text-content`],children:[(0,B.jsx)(nf,{size:`md`,weight:`semibold`,children:t}),(0,B.jsx)(nf,{size:`sm`,weight:`regular`,children:n})]}),i&&(0,B.jsx)(`div`,{className:Rg.actions,children:i})]}),a&&(0,B.jsx)(Lg,{onClick:a,"aria-label":`Close`,role:`button`,className:Rg.close,children:(0,B.jsx)(Kg,{})})]})},Jg=new Intl.Segmenter;function Yg(e){if(e.length<1)return``;let t=e[0];[`@`,`#`,`+`].includes(t)&&(e=e.substring(1));let n=Jg.segment(e)[Symbol.iterator]().next();return n.done?``:n.value.segment}function Xg(e){return e.split(``).reduce((e,t)=>e+t.charCodeAt(0),0)%6+1}var Zg={avatar:`_avatar_va14e_8`,image:`_image_va14e_43`,"avatar-imageless":`_avatar-imageless_va14e_55`,"stacked-avatars":`_stacked-avatars_va14e_109`,"clip-path":`_clip-path_va14e_128`};function Qg(e){return!!(e.onClick||e.onKeyDown||e.onKeyUp)}var $g=(0,R.forwardRef)(function({src:e,id:t,name:n=``,type:r=`round`,className:i=``,size:a,style:o={},onError:s,...c},l){return R.createElement(Qg(c)?`button`:`span`,{ref:l,role:`img`,"aria-label":t,...c,"data-type":r,"data-color":Xg(t),className:(0,z.default)(Zg.avatar,i,{[Zg[`avatar-imageless`]]:!e}),style:{...o,"--cpd-avatar-size":a}},(0,B.jsx)(R.Fragment,{children:e?(0,B.jsx)(`img`,{loading:`lazy`,alt:``,src:e,referrerPolicy:`no-referrer`,className:(0,z.default)(Zg.image),"data-type":r,style:o,width:a,height:a,onError:s}):Yg(n)}))});typeof window<`u`&&window.document&&window.document.createElement;function e_(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function t_(e,t){let n=R.createContext(t),r=e=>{let{children:t,...r}=e,i=R.useMemo(()=>r,Object.values(r));return(0,B.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=R.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function n_(e,t=[]){let n=[];function r(t,r){let i=R.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=R.useMemo(()=>o,Object.values(o));return(0,B.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=R.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>R.createContext(e));return function(n){let r=n?.[e]||t;return R.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,r_(i,...t)]}function r_(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function i_(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function a_(...e){return t=>{let n=!1,r=e.map(e=>{let r=i_(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():i_(e[t],null)}}}}function o_(...e){return R.useCallback(a_(...e),e)}function s_(e){let t=c_(e),n=R.forwardRef((e,n)=>{let{children:r,...i}=e,a=R.Children.toArray(r),o=a.find(u_);if(o){let e=o.props.children,r=a.map(t=>t===o?R.Children.count(e)>1?R.Children.only(null):R.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:R.isValidElement(e)?R.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function c_(e){let t=R.forwardRef((e,t)=>{let{children:n,...r}=e;if(R.isValidElement(n)){let e=f_(n),i=d_(r,n.props);return n.type!==R.Fragment&&(i.ref=t?a_(t,e):e),R.cloneElement(n,i)}return R.Children.count(n)>1?R.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var l_=Symbol(`radix.slottable`);function u_(e){return R.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===l_}function d_(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function f_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var p_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=s_(`Primitive.${t}`),r=R.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function m_(e,t){e&&fm.flushSync(()=>e.dispatchEvent(t))}function h_(e){let t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>(...e)=>t.current?.(...e),[])}function g_(e,t=globalThis?.document){let n=h_(e);R.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var __=`DismissableLayer`,v_=`dismissableLayer.update`,y_=`dismissableLayer.pointerDownOutside`,b_=`dismissableLayer.focusOutside`,x_,S_=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),C_=R.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=R.useContext(S_),[u,d]=R.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=R.useState({}),m=o_(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=E_(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=D_(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return g_(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),R.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(x_=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),O_(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=x_)}},[u,f,n,l]),R.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),O_())},[u,l]),R.useEffect(()=>{let e=()=>p({});return document.addEventListener(v_,e),()=>document.removeEventListener(v_,e)},[]),(0,B.jsx)(p_.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:e_(e.onFocusCapture,S.onFocusCapture),onBlurCapture:e_(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:e_(e.onPointerDownCapture,x.onPointerDownCapture)})});C_.displayName=__;var w_=`DismissableLayerBranch`,T_=R.forwardRef((e,t)=>{let n=R.useContext(S_),r=R.useRef(null),i=o_(t,r);return R.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,B.jsx)(p_.div,{...e,ref:i})});T_.displayName=w_;function E_(e,t=globalThis?.document){let n=h_(e),r=R.useRef(!1),i=R.useRef(()=>{});return R.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){k_(y_,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function D_(e,t=globalThis?.document){let n=h_(e),r=R.useRef(!1);return R.useEffect(()=>{let e=e=>{e.target&&!r.current&&k_(b_,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function O_(){let e=new CustomEvent(v_);document.dispatchEvent(e)}function k_(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?m_(i,a):i.dispatchEvent(a)}var A_=0;function j_(){R.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??M_()),document.body.insertAdjacentElement(`beforeend`,e[1]??M_()),A_++,()=>{A_===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),A_--}},[])}function M_(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var N_=`focusScope.autoFocusOnMount`,P_=`focusScope.autoFocusOnUnmount`,F_={bubbles:!1,cancelable:!0},I_=`FocusScope`,L_=R.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=R.useState(null),l=h_(i),u=h_(a),d=R.useRef(null),f=o_(t,e=>c(e)),p=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:W_(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||W_(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&W_(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),R.useEffect(()=>{if(s){G_.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(N_,F_);s.addEventListener(N_,l),s.dispatchEvent(t),t.defaultPrevented||(R_(J_(B_(s)),{select:!0}),document.activeElement===e&&W_(s))}return()=>{s.removeEventListener(N_,l),setTimeout(()=>{let t=new CustomEvent(P_,F_);s.addEventListener(P_,u),s.dispatchEvent(t),t.defaultPrevented||W_(e??document.body,{select:!0}),s.removeEventListener(P_,u),G_.remove(p)},0)}}},[s,l,u,p]);let m=R.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=z_(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&W_(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&W_(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,B.jsx)(p_.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});L_.displayName=I_;function R_(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(W_(r,{select:t}),document.activeElement!==n)return}function z_(e){let t=B_(e);return[V_(t,e),V_(t.reverse(),e)]}function B_(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function V_(e,t){for(let n of e)if(!H_(n,{upTo:t}))return n}function H_(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function U_(e){return e instanceof HTMLInputElement&&`select`in e}function W_(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&U_(e)&&t&&e.select()}}var G_=K_();function K_(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=q_(e,t),e.unshift(t)},remove(t){e=q_(e,t),e[0]?.resume()}}}function q_(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function J_(e){return e.filter(e=>e.tagName!==`A`)}var Y_=globalThis?.document?R.useLayoutEffect:()=>{},X_=R.useId||(()=>void 0),Z_=0;function Q_(e){let[t,n]=R.useState(X_());return Y_(()=>{e||n(e=>e??String(Z_++))},[e]),e||(t?`radix-${t}`:``)}var $_=`Portal`,ev=R.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=R.useState(!1);Y_(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?fm.createPortal((0,B.jsx)(p_.div,{...r,ref:t}),o):null});ev.displayName=$_;function tv(e,t){return R.useReducer((e,n)=>t[e][n]??e,e)}var nv=e=>{let{present:t,children:n}=e,r=rv(t),i=typeof n==`function`?n({present:r.isPresent}):R.Children.only(n),a=o_(r.ref,av(i));return typeof n==`function`||r.isPresent?R.cloneElement(i,{ref:a}):null};nv.displayName=`Presence`;function rv(e){let[t,n]=R.useState(),r=R.useRef(null),i=R.useRef(e),a=R.useRef(`none`),[o,s]=tv(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return R.useEffect(()=>{let e=iv(r.current);a.current=o===`mounted`?e:`none`},[o]),Y_(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=iv(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Y_(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=iv(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=iv(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:R.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function iv(e){return e?.animationName||`none`}function av(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ov=R.useInsertionEffect||Y_;function sv({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=cv({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=R.useRef(e!==void 0);R.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,R.useCallback(t=>{if(s){let n=lv(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function cv({defaultProp:e,onChange:t}){let[n,r]=R.useState(e),i=R.useRef(n),a=R.useRef(t);return ov(()=>{a.current=t},[t]),R.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function lv(e){return typeof e==`function`}var uv=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},dv=new WeakMap,fv=new WeakMap,pv={},mv=0,hv=function(e){return e&&(e.host||hv(e.parentNode))},gv=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=hv(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},_v=function(e,t,n,r){var i=gv(t,Array.isArray(e)?e:[e]);pv[n]||(pv[n]=new WeakMap);var a=pv[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(dv.get(e)||0)+1,l=(a.get(e)||0)+1;dv.set(e,c),a.set(e,l),o.push(e),c===1&&i&&fv.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),mv++,function(){o.forEach(function(e){var t=dv.get(e)-1,i=a.get(e)-1;dv.set(e,t),a.set(e,i),t||(fv.has(e)||e.removeAttribute(r),fv.delete(e)),i||e.removeAttribute(n)}),mv--,mv||(dv=new WeakMap,dv=new WeakMap,fv=new WeakMap,pv={})}},vv=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||uv(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),_v(r,i,n,`aria-hidden`)):function(){return null}};xr();var yv=`right-scroll-bar-position`,bv=`width-before-scroll-bar`,xv=`with-scroll-bars-hidden`,Sv=`--removed-body-scroll-bar-size`;function Cv(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function wv(e,t){var n=(0,R.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Tv=typeof window<`u`?R.useLayoutEffect:R.useEffect,Ev=new WeakMap;function Dv(e,t){var n=wv(t||null,function(t){return e.forEach(function(e){return Cv(e,t)})});return Tv(function(){var t=Ev.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Cv(e,null)}),i.forEach(function(e){r.has(e)||Cv(e,a)})}Ev.set(n,e)},[e]),n}function Ov(e){return e}function kv(e,t){t===void 0&&(t=Ov);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Av(e){e===void 0&&(e={});var t=kv(null);return t.options=wr({async:!0,ssr:!1},e),t}xr();var jv=function(e){var t=e.sideCar,n=Sr(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return R.createElement(r,wr({},n))};jv.isSideCarExport=!0;function Mv(e,t){return e.useMedium(t),jv}var Nv=Av();xr();var Pv=function(){},Fv=R.forwardRef(function(e,t){var n=R.useRef(null),r=R.useState({onScrollCapture:Pv,onWheelCapture:Pv,onTouchMoveCapture:Pv}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Sr(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Dv([n,t]),C=wr(wr({},b),i);return R.createElement(R.Fragment,null,u&&R.createElement(x,{sideCar:Nv,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?R.cloneElement(R.Children.only(s),wr(wr({},C),{ref:S})):R.createElement(v,wr({},C,{className:c,ref:S}),s))});Fv.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Fv.classNames={fullWidth:bv,zeroRight:yv};var Iv,Lv=function(){if(Iv)return Iv;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Rv(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Lv();return t&&e.setAttribute(`nonce`,t),e}function zv(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Bv(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Vv=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Rv())&&(zv(t,n),Bv(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Hv=function(){var e=Vv();return function(t,n){R.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Uv=function(){var e=Hv();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Wv={left:0,top:0,right:0,gap:0},Gv=function(e){return parseInt(e||``,10)||0},Kv=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Gv(n),Gv(r),Gv(i)]},qv=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Wv;var t=Kv(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Jv=Uv(),Yv=`data-scroll-locked`,Xv=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
@@ -50,12 +50,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
50
50
|
[data-state=closed]
|
|
51
51
|
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function gb(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function _b(){return Sb(/^Mac/)}function vb(){return Sb(/^iPhone/)}function yb(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function bb(){return Sb(/^iPad/)||_b()&&navigator.maxTouchPoints>1}function xb(){return vb()||bb()}function Sb(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var Cb=24,wb=typeof window<`u`?R.useLayoutEffect:R.useEffect;function Tb(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var Eb=typeof document<`u`&&window.visualViewport;function Db(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Ob(e){for(Db(e)&&(e=e.parentElement);e&&!Db(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var kb=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),Ab=0,jb;function Mb(e={}){let{isDisabled:t}=e;wb(()=>{if(!t)return Ab++,Ab===1&&xb()&&(jb=Nb()),()=>{Ab--,Ab===0&&jb?.()}},[t])}function Nb(){let e,t=0,n=n=>{e=Ob(n.target),!(e===document.documentElement&&e===document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;Lb(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;Lb(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,Eb&&(Eb.height<window.innerHeight?requestAnimationFrame(()=>{Ib(t)}):Eb.addEventListener(`resize`,()=>Ib(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=Tb(Pb(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Tb(Fb(document,`touchstart`,n,{passive:!1,capture:!0}),Fb(document,`touchmove`,r,{passive:!1,capture:!0}),Fb(document,`touchend`,i,{passive:!1,capture:!0}),Fb(document,`focus`,a,!0),Fb(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function Pb(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Fb(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Ib(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=Ob(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+Cb&&(t.scrollTop+=r-n)}e=t.parentElement}}function Lb(e){return e instanceof HTMLInputElement&&!kb.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Rb(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function zb(...e){return t=>e.forEach(e=>Rb(e,t))}function Bb(...e){return R.useCallback(zb(...e),e)}var Vb=new WeakMap;function Hb(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&Vb.set(e,r)}function Ub(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Vb.get(e);n&&(e.style[t]=n[t])}var Wb=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function Gb(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[Wb(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[Wb(t)?5:4]):null)}function Kb(e){return 8*(Math.log(e+1)-2)}function qb(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var Jb={DURATION:.5,EASE:[.32,.72,0,1]},Yb=.4,Xb=.25,Zb=100,Qb=8,$b=16,ex=26,tx=`vaul-dragging`;function nx(e){let t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function rx({defaultProp:e,onChange:t}){let n=R.useState(e),[r]=n,i=R.useRef(r),a=nx(t);return R.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function ix({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=rx({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=nx(n);return[o,R.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function ax({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=ix({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=R.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);R.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=R.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=R.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=R.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),Wb(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=R.useMemo(()=>h===null?null:_?.[h],[_,h]),y=R.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),Hb(r.current,{transition:`transform ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`,transform:Wb(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?Hb(i.current,{transition:`opacity ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`,opacity:`0`}):Hb(i.current,{transition:`opacity ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);R.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&Hb(i.current,{transition:`opacity ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=Wb(s)?window.innerHeight:window.innerWidth;if(r>Yb&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||Hb(r.current,{transform:Wb(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function ox(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=hb(),a=R.useRef(null),o=(0,R.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-ex)/window.innerWidth}R.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&qb(document.body,{background:`black`}),qb(t,{transformOrigin:Wb(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${Jb.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Jb.EASE.join(`,`)})`});let n=qb(t,{borderRadius:`${Qb}px`,overflow:`hidden`,...Wb(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},Jb.DURATION*1e3)}}},[t,n,o])}var sx=null;function cx({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=R.useState(()=>typeof window<`u`?window.location.href:``),c=R.useRef(0),l=R.useCallback(()=>{if(yb()&&sx===null&&e&&!a){sx={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=R.useCallback(()=>{if(yb()&&sx!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,sx),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),sx=null}},[o]);return R.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),R.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),R.useEffect(()=>{n||!r||(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function lx({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=Xb,scrollLockTimeout:l=Zb,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:O=!1}){let[k=!1,A]=ix({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&Te(),setTimeout(()=>{E?.(e)},Jb.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[j,M]=R.useState(!1),[N,ee]=R.useState(!1),[te,ne]=R.useState(!1),re=R.useRef(null),ie=R.useRef(null),ae=R.useRef(null),oe=R.useRef(null),se=R.useRef(null),ce=R.useRef(!1),le=R.useRef(null),ue=R.useRef(0),de=R.useRef(!1),fe=R.useRef(!x),pe=R.useRef(0),P=R.useRef(null),me=R.useRef(P.current?.getBoundingClientRect().height||0),he=R.useRef(P.current?.getBoundingClientRect().width||0),ge=R.useRef(0),{activeSnapPoint:_e,activeSnapPointIndex:ve,setActiveSnapPoint:ye,onRelease:be,snapPointsOffset:xe,onDrag:Se,shouldFade:Ce,getPercentageDragged:we}=ax({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:P,fadeFromIndex:f,overlayRef:re,onSnapPointChange:R.useCallback(e=>{a&&e===xe.length-1&&(ie.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});Mb({isDisabled:!k||N||!g||te||!j||!T||!S});let{restorePositionSetting:Te}=cx({isOpen:k,modal:g,nested:v??!1,hasBeenOpened:j,preventScrollRestoration:w,noBodyStyles:y});function Ee(){return(window.innerWidth-ex)/window.innerWidth}function De(e){!u&&!a||P.current&&!P.current.contains(e.target)||(me.current=P.current?.getBoundingClientRect().height||0,he.current=P.current?.getBoundingClientRect().width||0,ee(!0),ae.current=new Date,xb()&&window.addEventListener(`touchend`,()=>ce.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),ue.current=Wb(b)?e.pageY:e.pageX)}function Oe(e,t){let n=e,r=window.getSelection()?.toString(),i=P.current?Gb(P.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(ie.current&&a.getTime()-ie.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(se.current&&a.getTime()-se.current.getTime()<l&&i===0||t)return se.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return se.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function ke(e){if(P.current&&N){let t=b===`bottom`||b===`right`?1:-1,n=(ue.current-(Wb(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&ve===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?me.current:he.current),p=we(c,i);if(p!==null&&(d=p),s&&d>=1||!ce.current&&!Oe(e.target,i))return;if(P.current.classList.add(tx),ce.current=!0,Hb(P.current,{transition:`none`}),Hb(re.current,{transition:`none`}),a&&Se({draggedDistance:n}),i&&!a){let e=Kb(n),r=Math.min(e*-1,0)*t;Hb(P.current,{transform:Wb(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((Ce||f&&ve===f-1)&&(r?.(e,d),Hb(re.current,{opacity:`${m}`,transition:`none`},!0)),l&&re.current&&o){let e=Math.min(Ee()+d*(1-Ee()),1),t=8-d*8,n=Math.max(0,14-d*14);Hb(l,{borderRadius:`${t}px`,transform:Wb(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;Hb(P.current,{transform:Wb(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}R.useEffect(()=>{window.requestAnimationFrame(()=>{fe.current=!0})},[]),R.useEffect(()=>{var e;function t(){if(!P.current||!T)return;let e=document.activeElement;if(Lb(e)||de.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=P.current.getBoundingClientRect().height||0,i=r>t*.8;ge.current||=r;let o=P.current.getBoundingClientRect().top;if(Math.abs(pe.current-n)>60&&(de.current=!de.current),a&&a.length>0&&xe&&ve){let e=xe[ve]||0;n+=e}if(pe.current=n,r>e||de.current){let t=P.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:ex)),h?P.current.style.height=`${t-Math.max(n,0)}px`:P.current.style.height=`${Math.max(r,e-o)}px`}else gb()||(P.current.style.height=`${ge.current}px`);a&&a.length>0&&!de.current?P.current.style.bottom=`0px`:P.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[ve,a,xe]);function Ae(e){je(),_?.(),e||A(!1),setTimeout(()=>{a&&ye(a[0])},Jb.DURATION*1e3)}function F(){if(!P.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=Gb(P.current,b);Hb(P.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`}),Hb(re.current,{transition:`opacity ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&k&&Hb(e,{borderRadius:`${Qb}px`,overflow:`hidden`,...Wb(b)?{transform:`scale(${Ee()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${Ee()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${Jb.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Jb.EASE.join(`,`)})`},!0)}function je(){!N||!P.current||(P.current.classList.remove(tx),ce.current=!1,ee(!1),oe.current=new Date)}function Me(e){if(!N||!P.current)return;P.current.classList.remove(tx),ce.current=!1,ee(!1),oe.current=new Date;let t=Gb(P.current,b);if(!e||!Oe(e.target,!1)||!t||Number.isNaN(t)||ae.current===null)return;let n=oe.current.getTime()-ae.current.getTime(),r=ue.current-(Wb(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(ne(!0),setTimeout(()=>{ne(!1)},200)),a){be({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:Ae,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){F(),i?.(e,!0);return}if(o>Yb){Ae(),i?.(e,!1);return}let s=Math.min(P.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(P.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){Ae(),i?.(e,!1);return}i?.(e,!0),F()}R.useEffect(()=>(k&&(Hb(document.documentElement,{scrollBehavior:`auto`}),ie.current=new Date),()=>{Ub(document.documentElement,`scrollBehavior`)}),[k]);function Ne(e){let t=e?(window.innerWidth-$b)/window.innerWidth:1,n=e?-$b:0;le.current&&window.clearTimeout(le.current),Hb(P.current,{transition:`transform ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`,transform:Wb(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&P.current&&(le.current=setTimeout(()=>{let e=Gb(P.current,b);Hb(P.current,{transition:`none`,transform:Wb(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function Pe(e,t){if(t<0)return;let n=(window.innerWidth-$b)/window.innerWidth,r=n+t*(1-n),i=-$b+t*$b;Hb(P.current,{transform:Wb(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function Fe(e,t){let n=Wb(b)?window.innerHeight:window.innerWidth,r=t?(n-$b)/n:1,i=t?-$b:0;t&&Hb(P.current,{transition:`transform ${Jb.DURATION}s cubic-bezier(${Jb.EASE.join(`,`)})`,transform:Wb(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return R.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),R.createElement(ab,{defaultOpen:x,onOpenChange:e=>{!u&&!e||(e?M(!0):Ae(!0),A(e))},open:k},R.createElement(mb.Provider,{value:{activeSnapPoint:_e,snapPoints:a,setActiveSnapPoint:ye,drawerRef:P,overlayRef:re,onOpenChange:t,onPress:De,onRelease:Me,onDrag:ke,dismissible:u,shouldAnimate:fe,handleOnly:d,isOpen:k,isDragging:N,shouldFade:Ce,closeDrawer:Ae,onNestedDrag:Pe,onNestedOpenChange:Ne,onNestedRelease:Fe,keyboardIsOpen:de,modal:g,snapPointsOffset:xe,activeSnapPointIndex:ve,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:O}},n))}var ux=R.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=hb(),l=Bb(t,n),u=r&&r.length>0;if(!s)return null;let d=R.useCallback(e=>i(e),[i]);return R.createElement(cb,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});ux.displayName=`Drawer.Overlay`;var dx=R.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=hb(),[b,x]=R.useState(!1),S=Bb(i,a),C=R.useRef(null),w=R.useRef(null),T=R.useRef(!1),E=h&&h.length>0;ox();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};R.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function O(e){C.current=null,T.current=!1,s(e)}return R.createElement(lb,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),O(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&O(w.current)}})});dx.displayName=`Drawer.Content`;var fx=250,px=120,mx=R.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=hb(),m=R.useRef(null),h=R.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},px)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},fx)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return R.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},R.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});mx.displayName=`Drawer.Handle`;function hx({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=hb();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return R.createElement(lx,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function gx(e){let t=hb(),{container:n=t.container,...r}=e;return R.createElement(sb,{container:n,...r})}var _x={Root:lx,NestedRoot:hx,Content:dx,Overlay:ux,Trigger:ob,Portal:gx,Handle:mx,Close:fb,Title:ub,Description:db},vx={glass:`_glass_sepwu_8`},yx=(0,R.forwardRef)(({children:e,className:t,...n},r)=>(0,B.jsx)(`div`,{ref:r,className:(0,z.default)(t,vx.glass),...n,children:R.Children.only(e)}));yx.displayName=`Glass`;var bx=({as:e=`h1`,children:t,...n})=>(0,B.jsx)(tf,{as:e,type:`heading`,...n,children:t}),xx={"big-icon":`_big-icon_1ssbv_8`};function Sx({className:e,size:t=`lg`,kind:n=`primary`,children:r}){return(0,B.jsx)(`div`,{className:(0,z.default)(xx[`big-icon`],e),"data-size":t,"data-kind":n,children:R.Children.only(r)})}var Cx={link:`_link_k9ljz_8`},wx=(0,R.forwardRef)(function({children:e,className:t,kind:n=`primary`,size:r=`md`,...i},a){return(0,B.jsx)(`a`,{ref:a,...i,rel:`noreferrer noopener`,className:(0,z.default)(Cx.link,t),"data-kind":n,"data-size":r,children:e})}),Tx=Symbol.for(`react.lazy`),Ex=R.use;function Dx(e){return typeof e==`object`&&!!e&&`then`in e}function Ox(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Tx&&`_payload`in e&&Dx(e._payload)}function kx(e){let t=jx(e),n=R.forwardRef((e,n)=>{let{children:r,...i}=e;Ox(r)&&typeof Ex==`function`&&(r=Ex(r._payload));let a=R.Children.toArray(r),o=a.find(Nx);if(o){let e=o.props.children,r=a.map(t=>t===o?R.Children.count(e)>1?R.Children.only(null):R.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:R.isValidElement(e)?R.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Ax=kx(`Slot`);function jx(e){let t=R.forwardRef((e,t)=>{let{children:n,...r}=e;if(Ox(n)&&typeof Ex==`function`&&(n=Ex(n._payload)),R.isValidElement(n)){let e=Fx(n),i=Px(r,n.props);return n.type!==R.Fragment&&(i.ref=t?a_(t,e):e),R.cloneElement(n,i)}return R.Children.count(n)>1?R.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Mx=Symbol(`radix.slottable`);function Nx(e){return R.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Mx}function Px(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Fx(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ix=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=kx(`Primitive.${t}`),r=R.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lx(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M12 14.95q-.2 0-.375-.062a.9.9 0 0 1-.325-.213l-4.6-4.6a.95.95 0 0 1-.275-.7q0-.425.275-.7a.95.95 0 0 1 .7-.275q.425 0 .7.275l3.9 3.9 3.9-3.9a.95.95 0 0 1 .7-.275q.425 0 .7.275a.95.95 0 0 1 .275.7.95.95 0 0 1-.275.7l-4.6 4.6q-.15.15-.325.212a1.1 1.1 0 0 1-.375.063`})})}Lx.displayName=`ChevronDownIcon`;var Rx=(0,R.forwardRef)(Lx),zx=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);Kx(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},Bx={},Vx=(e,t,n,r)=>{Kx(n)&&Bx[n]||(Kx(n)&&(Bx[n]=new Date),zx(e,t,n,r))},Hx=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},Ux=(e,t,n)=>{e.loadNamespaces(t,Hx(e,n))},Wx=(e,t,n,r)=>{if(Kx(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Ux(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Hx(e,r))},Gx=(e,t,n={})=>!t.languages||!t.languages.length?(Vx(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),Kx=e=>typeof e==`string`,qx=e=>typeof e==`object`&&!!e,Jx=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Yx={"&":`&`,"&":`&`,"<":`<`,"<":`<`,">":`>`,">":`>`,"'":`'`,"'":`'`,""":`"`,""":`"`," ":` `," ":` `,"©":`©`,"©":`©`,"®":`®`,"®":`®`,"…":`…`,"…":`…`,"/":`/`,"/":`/`},Xx=e=>Yx[e],Zx=e=>e.replace(Jx,Xx),Qx={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:Zx,transDefaultProps:void 0},$x=(e={})=>{Qx={...Qx,...e}},eS=()=>Qx,tS,nS=e=>{tS=e},rS=()=>tS,iS={type:`3rdParty`,init(e){$x(e.options.react),nS(e)}},aS=(0,R.createContext)(),oS=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},sS=i((e=>{var t=da();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),cS=i(((e,t)=>{t.exports=sS()}))(),lS={t:(e,t)=>{if(Kx(t))return t;if(qx(t)&&Kx(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},uS=()=>()=>{},dS=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,R.useContext)(aS)||{},a=n||r||rS();a&&!a.reportNamespaces&&(a.reportNamespaces=new oS),a||Vx(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next`);let o=(0,R.useMemo)(()=>({...eS(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=Kx(l)?[l]:l||[`translation`],d=(0,R.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,R.useRef)(0),p=(0,R.useCallback)(e=>{if(!a)return uS;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,R.useRef)(),h=(0,R.useCallback)(()=>{if(!a)return lS;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>Gx(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,R.useState)(0),{t:v,ready:y}=(0,cS.useSyncExternalStore)(p,h,h);(0,R.useEffect)(()=>{if(a&&!y&&!s){let e=()=>_(e=>e+1);t.lng?Wx(a,t.lng,d,e):Ux(a,d,e)}},[a,t.lng,d,y,s,g]);let b=a||{},x=(0,R.useRef)(null),S=(0,R.useRef)(),C=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,`__original`,{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},w=(0,R.useMemo)(()=>{let e=b,t=e?.language,n=e;e&&(x.current&&x.current.__original===e&&S.current===t?n=x.current:(n=C(e),x.current=n,S.current=t));let r=!y&&!s?(...e)=>(Vx(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),v(...e)):v,i=[r,n,y];return i.t=r,i.i18n=n,i.ready=y,i},[v,b,y,b.resolvedLanguage,b.language,b.languages]);if(a&&s&&!y)throw new Promise(e=>{let n=()=>e();t.lng?Wx(a,t.lng,d,n):Ux(a,d,n)});return w};function fS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`m12 10.775-3.9 3.9a.95.95 0 0 1-.7.275.95.95 0 0 1-.7-.275.95.95 0 0 1-.275-.7q0-.425.275-.7l4.6-4.6q.15-.15.325-.212Q11.8 8.4 12 8.4t.375.063a.9.9 0 0 1 .325.212l4.6 4.6a.95.95 0 0 1 .275.7.95.95 0 0 1-.275.7.95.95 0 0 1-.7.275.95.95 0 0 1-.7-.275z`})})}fS.displayName=`ChevronUpIcon`;var pS=(0,R.forwardRef)(fS);function mS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`m2.765 16.02-2.47-2.416A1.02 1.02 0 0 1 0 12.852q0-.456.295-.751a15.6 15.6 0 0 1 5.316-3.786A15.9 15.9 0 0 1 12 7q3.355 0 6.39 1.329a16 16 0 0 1 5.315 3.772q.295.294.295.751t-.295.752l-2.47 2.416a1.047 1.047 0 0 1-1.396.108l-3.114-2.363a1.1 1.1 0 0 1-.322-.376 1.1 1.1 0 0 1-.108-.483v-2.27a13.6 13.6 0 0 0-2.12-.524C13.459 9.996 12 9.937 12 9.937s-1.459.059-2.174.175q-1.074.174-2.121.523v2.271q0 .268-.108.483a1.1 1.1 0 0 1-.322.376l-3.114 2.363a1.047 1.047 0 0 1-1.396-.107`})})}mS.displayName=`EndCallIcon`;var hS=(0,R.forwardRef)(mS);function gS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M6 22q-.825 0-1.412-.587A1.93 1.93 0 0 1 4 20V10q0-.825.588-1.412a2 2 0 0 1 .702-.463L1.333 4.167a1 1 0 0 1 1.414-1.414L7 7.006v-.012l13 13v.012l1.247 1.247a1 1 0 1 1-1.414 1.414l-.896-.896A1.94 1.94 0 0 1 18 22zm14-4.834V10q0-.825-.587-1.412A1.93 1.93 0 0 0 18 8h-1V6q0-2.075-1.463-3.537Q14.075 1 12 1T8.463 2.463a4.9 4.9 0 0 0-1.22 1.946L9 6.166V6q0-1.25.875-2.125A2.9 2.9 0 0 1 12 3q1.25 0 2.125.875T15 6v2h-4.166z`})})}gS.displayName=`LockOffIcon`;var _S=(0,R.forwardRef)(gS);function vS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M6 22q-.824 0-1.412-.587A1.93 1.93 0 0 1 4 20V10q0-.825.588-1.412A1.93 1.93 0 0 1 6 8h1V6q0-2.075 1.463-3.537Q9.926 1 12 1q2.075 0 3.537 1.463Q17 3.925 17 6v2h1q.824 0 1.413.588Q20 9.175 20 10v10q0 .824-.587 1.413A1.93 1.93 0 0 1 18 22zM9 8h6V6q0-1.25-.875-2.125A2.9 2.9 0 0 0 12 3q-1.25 0-2.125.875A2.9 2.9 0 0 0 9 6z`})})}vS.displayName=`LockSolidIcon`;var yS=(0,R.forwardRef)(vS);function bS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M8 8v-.006l6.831 6.832-.002.002 1.414 1.415.003-.003 1.414 1.414-.003.003L20.5 20.5a1 1 0 0 1-1.414 1.414l-3.022-3.022A7.95 7.95 0 0 1 13 19.938V21a1 1 0 0 1-2 0v-1.062A8 8 0 0 1 4 12a1 1 0 1 1 2 0 6 6 0 0 0 8.587 5.415l-1.55-1.55A4.005 4.005 0 0 1 8 12v-1.172L2.086 4.914A1 1 0 0 1 3.5 3.5zm9.417 6.583 1.478 1.477A7.96 7.96 0 0 0 20 12a1 1 0 0 0-2 0c0 .925-.21 1.8-.583 2.583M8.073 5.238l7.793 7.793q.132-.495.134-1.031V6a4 4 0 0 0-7.927-.762`})})}bS.displayName=`MicOffSolidIcon`;var xS=(0,R.forwardRef)(bS);function SS(e,t){return(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:[(0,B.jsx)(`path`,{d:`M8 6a4 4 0 1 1 8 0v6a4 4 0 0 1-8 0z`}),(0,B.jsx)(`path`,{d:`M5 11a1 1 0 0 1 1 1 6 6 0 0 0 12 0 1 1 0 1 1 2 0 8 8 0 0 1-7 7.938V21a1 1 0 1 1-2 0v-1.062A8 8 0 0 1 4 12a1 1 0 0 1 1-1`})]})}SS.displayName=`MicOnSolidIcon`;var CS=(0,R.forwardRef)(SS);function wS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M6 14q-.824 0-1.412-.588A1.93 1.93 0 0 1 4 12q0-.825.588-1.412A1.93 1.93 0 0 1 6 10q.824 0 1.412.588Q8 11.175 8 12t-.588 1.412A1.93 1.93 0 0 1 6 14m6 0q-.825 0-1.412-.588A1.93 1.93 0 0 1 10 12q0-.825.588-1.412A1.93 1.93 0 0 1 12 10q.825 0 1.412.588Q14 11.175 14 12t-.588 1.412A1.93 1.93 0 0 1 12 14m6 0q-.824 0-1.413-.588A1.93 1.93 0 0 1 16 12q0-.825.587-1.412A1.93 1.93 0 0 1 18 10q.824 0 1.413.588Q20 11.175 20 12t-.587 1.412A1.93 1.93 0 0 1 18 14`})})}wS.displayName=`OverflowHorizontalIcon`;var TS=(0,R.forwardRef)(wS);function ES(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M12 20q-.825 0-1.412-.587A1.93 1.93 0 0 1 10 18q0-.824.588-1.413A1.93 1.93 0 0 1 12 16q.825 0 1.412.587Q14 17.176 14 18t-.588 1.413A1.93 1.93 0 0 1 12 20m0-6q-.825 0-1.412-.588A1.93 1.93 0 0 1 10 12q0-.825.588-1.412A1.93 1.93 0 0 1 12 10q.825 0 1.412.588Q14 11.175 14 12t-.588 1.412A1.93 1.93 0 0 1 12 14m0-6q-.825 0-1.412-.588A1.93 1.93 0 0 1 10 6q0-.824.588-1.412A1.93 1.93 0 0 1 12 4q.825 0 1.412.588Q14 5.175 14 6q0 .824-.588 1.412A1.93 1.93 0 0 1 12 8`})})}ES.displayName=`OverflowVerticalIcon`;var DS=(0,R.forwardRef)(ES);function OS(e,t){return(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:[(0,B.jsx)(`path`,{d:`M5 3h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2`}),(0,B.jsx)(`path`,{d:`M15 3h5a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V6.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L17.586 5H15a1 1 0 1 1 0-2`})]})}OS.displayName=`PopOutIcon`;var kS=(0,R.forwardRef)(OS);function AS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M11 3a1 1 0 1 1 2 0v8.5a.5.5 0 0 0 1 0V4a1 1 0 1 1 2 0v10.2l3.284-2.597a1.081 1.081 0 0 1 1.47 1.577c-.613.673-1.214 1.367-1.818 2.064-1.267 1.463-2.541 2.934-3.943 4.235A6 6 0 0 1 5 15V7a1 1 0 0 1 1.999 0v5.5a.5.5 0 0 0 1 0V4a1 1 0 0 1 2 0v7.5a.5.5 0 0 0 1 0z`})})}AS.displayName=`RaisedHandSolidIcon`;var jS=(0,R.forwardRef)(AS);function MS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{fillRule:`evenodd`,d:`M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10m3.536-6.464a1 1 0 0 0-1.415-1.415A3 3 0 0 1 12 15a3 3 0 0 1-2.121-.879 1 1 0 1 0-1.414 1.415A5 5 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464M10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3`,clipRule:`evenodd`})})}MS.displayName=`ReactionSolidIcon`;var NS=(0,R.forwardRef)(MS);function PS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M1.288 20.713Q1.575 21 2 21h20q.424 0 .712-.288A.97.97 0 0 0 23 20a.97.97 0 0 0-.288-.712A.97.97 0 0 0 22 19H2a.97.97 0 0 0-.712.288A.97.97 0 0 0 1 20q0 .424.288.712m1.3-3.299A1.93 1.93 0 0 1 2 16V5q0-.824.587-1.412A1.93 1.93 0 0 1 4 3h16q.824 0 1.413.587Q22 4.176 22 5v11q0 .824-.587 1.413A1.93 1.93 0 0 1 20 18H4q-.824 0-1.412-.587m10.12-10.12a1 1 0 0 0-1.415 0l-2.5 2.5a1 1 0 0 0 1.414 1.414l.793-.793V13a1 1 0 1 0 2 0v-2.586l.793.793a1 1 0 0 0 1.414-1.414z`})})}PS.displayName=`ShareScreenSolidIcon`;var FS=(0,R.forwardRef)(PS);function IS(e,t){return(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:[(0,B.jsx)(`path`,{d:`M9.175 13.825Q10.35 15 12 15t2.825-1.175T16 11t-1.175-2.825T12 7 9.175 8.175 8 11t1.175 2.825m4.237-1.412A1.93 1.93 0 0 1 12 13q-.825 0-1.412-.588A1.93 1.93 0 0 1 10 11q0-.825.588-1.412A1.93 1.93 0 0 1 12 9q.825 0 1.412.588Q14 10.175 14 11t-.588 1.412`}),(0,B.jsx)(`path`,{d:`M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0`}),(0,B.jsx)(`path`,{d:`M16.23 18.792a13 13 0 0 0-1.455-.455 11.6 11.6 0 0 0-5.55 0q-.73.18-1.455.455a8 8 0 0 1-1.729-1.454q1.336-.618 2.709-.95A13.8 13.8 0 0 1 12 16q1.65 0 3.25.387 1.373.333 2.709.95a8 8 0 0 1-1.73 1.455`})]})}IS.displayName=`UserProfileIcon`;var LS=(0,R.forwardRef)(IS);function RS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M2.747 2.753 4.35 4.355l.007-.003L18 17.994v.012l3.247 3.247a1 1 0 0 1-1.414 1.414l-2.898-2.898A2 2 0 0 1 16 20H6a4 4 0 0 1-4-4V8c0-.892.292-1.715.785-2.38L1.333 4.166a1 1 0 0 1 1.414-1.414M18 15.166 6.834 4H16a2 2 0 0 1 2 2v4.286l3.35-2.871a1 1 0 0 1 1.65.76v7.65a1 1 0 0 1-1.65.76L18 13.715z`})})}RS.displayName=`VideoCallOffSolidIcon`;var zS=(0,R.forwardRef)(RS);function BS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M6 4h10a2 2 0 0 1 2 2v4.286l3.35-2.871a1 1 0 0 1 1.65.76v7.65a1 1 0 0 1-1.65.76L18 13.715V18a2 2 0 0 1-2 2H6a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4`})})}BS.displayName=`VideoCallSolidIcon`;var VS=(0,R.forwardRef)(BS);function HS(e,t){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:(0,B.jsx)(`path`,{d:`M3.5 3.5a1 1 0 1 0-1.414 1.414L5.172 8H5a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h2l3.293 3.293c.63.63 1.707.184 1.707-.707v-3.758l7.086 7.086A1 1 0 0 0 20.5 20.5l-2.136-2.136.003-.003-1.414-1.414-.003.003-1.414-1.414.003-.003-1.415-1.415-.002.003L12 12v-.006L7.503 7.497 7.5 7.5zm11.496 8.662 1.661 1.66c.222-.564.343-1.18.343-1.822 0-1.38-.56-2.632-1.464-3.536a1 1 0 1 0-1.414 1.414 3 3 0 0 1 .874 2.284m3.164 3.165 1.462 1.46A8.96 8.96 0 0 0 21 12a8.98 8.98 0 0 0-2.636-6.364A1 1 0 0 0 16.95 7.05 6.98 6.98 0 0 1 19 12a7 7 0 0 1-.84 3.326M8.917 6.083 12 9.166V5.414c0-.89-1.077-1.337-1.707-.707z`})})}HS.displayName=`VolumeOffSolidIcon`;var US=(0,R.forwardRef)(HS);function WS(e,t){return(0,B.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 24 24`,ref:t,...e,children:[(0,B.jsx)(`path`,{d:`M3 14v-4a2 2 0 0 1 2-2h2l3.293-3.293c.63-.63 1.707-.184 1.707.707v13.172c0 .89-1.077 1.337-1.707.707L7 16H5a2 2 0 0 1-2-2m11.122-5.536a1 1 0 0 1 1.414 0A5 5 0 0 1 17 12c0 1.38-.56 2.632-1.464 3.536a1 1 0 0 1-1.415-1.415 3 3 0 0 0 .88-2.121c0-.829-.335-1.577-.88-2.121a1 1 0 0 1 0-1.415`}),(0,B.jsx)(`path`,{d:`M16.95 5.636a1 1 0 0 1 1.414 0A8.98 8.98 0 0 1 21 12a8.98 8.98 0 0 1-2.636 6.364 1 1 0 0 1-1.414-1.414A6.98 6.98 0 0 0 19 12a6.98 6.98 0 0 0-2.05-4.95 1 1 0 0 1 0-1.414`})]})}WS.displayName=`VolumeOnSolidIcon`;var GS=(0,R.forwardRef)(WS),KS={header:`_header_p1omj_8`,nav:`_nav_p1omj_18`,headerLogo:`_headerLogo_p1omj_26`,leftNav:`_leftNav_p1omj_33`,hideMobile:`_hideMobile_p1omj_33`,rightNav:`_rightNav_p1omj_45`,roomHeaderInfo:`_roomHeaderInfo_p1omj_61`,roomAvatar:`_roomAvatar_p1omj_76`,nameLine:`_nameLine_p1omj_81`,participantsLine:`_participantsLine_p1omj_100`},qS=(0,R.forwardRef)((e,t)=>(0,B.jsxs)(`svg`,{width:260,height:30,viewBox:`0 0 260 30`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,ref:t,...e,children:[(0,B.jsx)(`desc`,{children:`Element Call (Beta)`}),(0,B.jsx)(`circle`,{cx:15,cy:15,r:13,fill:`white`}),(0,B.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15 30C23.2843 30 30 23.2843 30 15C30 6.71573 23.2843 0 15 0C6.71573 0 0 6.71573 0 15C0 23.2843 6.71573 30 15 30ZM12.2579 6.98923C12.2579 6.38376 12.7497 5.89292 13.3565 5.89292C17.4687 5.89292 20.8024 9.21967 20.8024 13.3234C20.8024 13.9289 20.3106 14.4197 19.7038 14.4197C19.0971 14.4197 18.6052 13.9289 18.6052 13.3234C18.6052 10.4306 16.2553 8.08554 13.3565 8.08554C12.7497 8.08554 12.2579 7.59471 12.2579 6.98923ZM24.1066 13.3235C24.1066 12.7181 23.6148 12.2272 23.008 12.2272C22.4013 12.2272 21.9094 12.7181 21.9094 13.3235C21.9094 16.2163 19.5595 18.5614 16.6607 18.5614C16.0539 18.5614 15.5621 19.0523 15.5621 19.6577C15.5621 20.2632 16.0539 20.754 16.6607 20.754C20.7729 20.754 24.1066 17.4273 24.1066 13.3235ZM17.7601 23.011C17.7601 23.6164 17.2682 24.1073 16.6615 24.1073C12.5492 24.1073 9.21553 20.7805 9.21553 16.6768C9.21553 16.0713 9.70739 15.5805 10.3141 15.5805C10.9209 15.5805 11.4127 16.0713 11.4127 16.6768C11.4127 19.5696 13.7627 21.9146 16.6615 21.9146C17.2682 21.9146 17.7601 22.4055 17.7601 23.011ZM5.89281 16.6769C5.89281 17.2824 6.38466 17.7732 6.9914 17.7732C7.59813 17.7732 8.08999 17.2824 8.08999 16.6769C8.08999 13.7841 10.4399 11.439 13.3388 11.439C13.9455 11.439 14.4373 10.9482 14.4373 10.3427C14.4373 9.73722 13.9455 9.24639 13.3388 9.24639C9.22647 9.24639 5.89281 12.5731 5.89281 16.6769Z`,fill:`#0DBD8B`}),(0,B.jsx)(`path`,{d:`M53.5406 17.258H42.8052C42.932 18.3814 43.3397 19.2782 44.0282 19.9486C44.7167 20.6009 45.6227 20.927 46.746 20.927C47.4889 20.927 48.1593 20.7459 48.7572 20.3835C49.3551 20.0211 49.7809 19.5319 50.0346 18.9159H53.296C52.8611 20.3472 52.0458 21.5068 50.8499 22.3947C49.6722 23.2644 48.2771 23.6992 46.6645 23.6992C44.5627 23.6992 42.8596 23.0016 41.555 21.6065C40.2686 20.2114 39.6254 18.4448 39.6254 16.3068C39.6254 14.2231 40.2776 12.4747 41.5822 11.0614C42.8867 9.64814 44.5718 8.94151 46.6373 8.94151C48.7029 8.94151 50.3698 9.63908 51.6381 11.0342C52.9245 12.4112 53.5677 14.1506 53.5677 16.2524L53.5406 17.258ZM46.6373 11.5778C45.6227 11.5778 44.7801 11.8767 44.1098 12.4747C43.4394 13.0726 43.0226 13.8698 42.8596 14.8663H50.3607C50.2158 13.8698 49.8172 13.0726 49.1649 12.4747C48.5126 11.8767 47.6701 11.5778 46.6373 11.5778Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M55.7934 19.1605V2.9895H59.0276V19.2148C59.0276 19.9396 59.4262 20.302 60.2234 20.302L60.7941 20.2748V23.3459C60.4861 23.4003 60.16 23.4274 59.8157 23.4274C58.4206 23.4274 57.3969 23.0741 56.7446 22.3675C56.1104 21.6609 55.7934 20.5919 55.7934 19.1605Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M75.8563 17.258H65.121C65.2478 18.3814 65.6555 19.2782 66.344 19.9486C67.0325 20.6009 67.9384 20.927 69.0618 20.927C69.8047 20.927 70.4751 20.7459 71.073 20.3835C71.6709 20.0211 72.0967 19.5319 72.3503 18.9159H75.6117C75.1769 20.3472 74.3615 21.5068 73.1657 22.3947C71.988 23.2644 70.5928 23.6992 68.9803 23.6992C66.8785 23.6992 65.1753 23.0016 63.8708 21.6065C62.5843 20.2114 61.9411 18.4448 61.9411 16.3068C61.9411 14.2231 62.5934 12.4747 63.898 11.0614C65.2025 9.64814 66.8875 8.94151 68.9531 8.94151C71.0186 8.94151 72.6855 9.63908 73.9539 11.0342C75.2403 12.4112 75.8835 14.1506 75.8835 16.2524L75.8563 17.258ZM68.9531 11.5778C67.9384 11.5778 67.0959 11.8767 66.4255 12.4747C65.7551 13.0726 65.3384 13.8698 65.1753 14.8663H72.6765C72.5315 13.8698 72.1329 13.0726 71.4806 12.4747C70.8284 11.8767 69.9859 11.5778 68.9531 11.5778Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M90.448 15.274V23.3731H87.2138V14.9207C87.2138 12.7827 86.326 11.7137 84.5503 11.7137C83.59 11.7137 82.82 12.0217 82.2402 12.6377C81.6785 13.2538 81.3977 14.0963 81.3977 15.1653V23.3731H78.1635V9.26764H81.1531V11.1429C81.4973 10.5088 82.0228 9.98333 82.7294 9.5666C83.436 9.14987 84.3148 8.94151 85.3657 8.94151C87.3225 8.94151 88.7358 9.68438 89.6055 11.1701C90.8013 9.68438 92.3958 8.94151 94.3888 8.94151C96.0376 8.94151 97.3059 9.45789 98.1937 10.4907C99.0816 11.5053 99.5255 12.8461 99.5255 14.513V23.3731H96.2913V14.9207C96.2913 12.7827 95.4035 11.7137 93.6278 11.7137C92.6494 11.7137 91.8703 12.0308 91.2905 12.6649C90.7288 13.2809 90.448 14.1506 90.448 15.274Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M115.61 17.258H104.874C105.001 18.3814 105.409 19.2782 106.097 19.9486C106.786 20.6009 107.692 20.927 108.815 20.927C109.558 20.927 110.228 20.7459 110.826 20.3835C111.424 20.0211 111.85 19.5319 112.104 18.9159H115.365C114.93 20.3472 114.115 21.5068 112.919 22.3947C111.741 23.2644 110.346 23.6992 108.734 23.6992C106.632 23.6992 104.929 23.0016 103.624 21.6065C102.338 20.2114 101.694 18.4448 101.694 16.3068C101.694 14.2231 102.347 12.4747 103.651 11.0614C104.956 9.64814 106.641 8.94151 108.706 8.94151C110.772 8.94151 112.439 9.63908 113.707 11.0342C114.994 12.4112 115.637 14.1506 115.637 16.2524L115.61 17.258ZM108.706 11.5778C107.692 11.5778 106.849 11.8767 106.179 12.4747C105.508 13.0726 105.092 13.8698 104.929 14.8663H112.43C112.285 13.8698 111.886 13.0726 111.234 12.4747C110.582 11.8767 109.739 11.5778 108.706 11.5778Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M120.906 9.26764V11.1429C121.232 10.5269 121.767 10.0105 122.51 9.59378C123.271 9.15893 124.186 8.94151 125.255 8.94151C126.922 8.94151 128.208 9.44883 129.114 10.4635C130.038 11.4781 130.5 12.828 130.5 14.513V23.3731H127.266V14.9207C127.266 13.9242 127.03 13.1451 126.559 12.5834C126.106 12.0036 125.409 11.7137 124.467 11.7137C123.434 11.7137 122.619 12.0217 122.021 12.6377C121.441 13.2538 121.151 14.1053 121.151 15.1925V23.3731H117.917V9.26764H120.906Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M139.946 20.4922V23.2915C139.547 23.4003 138.985 23.4546 138.261 23.4546C135.507 23.4546 134.13 22.0685 134.13 19.2964V11.8496H131.982V9.26764H134.13V5.5986H137.364V9.26764H140V11.8496H137.364V18.9702C137.364 20.0755 137.889 20.6281 138.94 20.6281L139.946 20.4922Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M148.304 20.864C146.768 19.184 146 17.056 146 14.48C146 11.904 146.768 9.784 148.304 8.12C149.856 6.44 151.896 5.6 154.424 5.6C156.504 5.6 158.264 6.176 159.704 7.328C161.144 8.48 162.064 10.024 162.464 11.96H160.616C160.28 10.52 159.552 9.376 158.432 8.528C157.312 7.68 155.976 7.256 154.424 7.256C152.44 7.256 150.84 7.92 149.624 9.248C148.424 10.576 147.824 12.32 147.824 14.48C147.824 16.64 148.424 18.384 149.624 19.712C150.84 21.04 152.44 21.704 154.424 21.704C155.976 21.704 157.312 21.28 158.432 20.432C159.552 19.584 160.28 18.44 160.616 17H162.464C162.064 18.936 161.144 20.48 159.704 21.632C158.264 22.784 156.504 23.36 154.424 23.36C151.896 23.36 149.856 22.528 148.304 20.864Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M173.63 17.192C171.438 17.192 169.942 17.24 169.142 17.336C168.358 17.416 167.782 17.552 167.414 17.744C166.758 18.112 166.43 18.704 166.43 19.52C166.43 21.088 167.358 21.872 169.214 21.872C170.638 21.872 171.726 21.552 172.478 20.912C173.246 20.272 173.63 19.416 173.63 18.344V17.192ZM169.022 23.288C167.63 23.288 166.566 22.952 165.83 22.28C165.11 21.592 164.75 20.688 164.75 19.568C164.75 18.832 164.942 18.176 165.326 17.6C165.726 17.024 166.27 16.6 166.958 16.328C167.534 16.104 168.278 15.96 169.19 15.896C170.102 15.816 171.582 15.776 173.63 15.776V14.984C173.63 12.968 172.478 11.96 170.174 11.96C168.19 11.96 167.038 12.768 166.718 14.384H165.062C165.238 13.2 165.742 12.256 166.574 11.552C167.422 10.848 168.646 10.496 170.246 10.496C171.958 10.496 173.23 10.896 174.062 11.696C174.91 12.496 175.334 13.6 175.334 15.008V23H173.702V21.224C172.854 22.6 171.294 23.288 169.022 23.288Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M179.418 20.312V5H181.122V20.12C181.122 20.616 181.202 20.96 181.362 21.152C181.538 21.344 181.85 21.44 182.298 21.44L182.778 21.392V22.952C182.506 23 182.21 23.024 181.89 23.024C180.242 23.024 179.418 22.12 179.418 20.312Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M185.582 20.312V5H187.286V20.12C187.286 20.616 187.366 20.96 187.526 21.152C187.702 21.344 188.014 21.44 188.462 21.44L188.942 21.392V22.952C188.67 23 188.374 23.024 188.054 23.024C186.406 23.024 185.582 22.12 185.582 20.312Z`,fill:`currentColor`}),(0,B.jsx)(`path`,{d:`M201 10C201 5.58172 204.582 2 209 2H252C256.418 2 260 5.58172 260 10V20C260 24.4183 256.418 28 252 28H209C204.582 28 201 24.4183 201 20V10Z`,fill:`#368BD6`}),(0,B.jsx)(`path`,{d:`M212.076 20H216.492C218.99 20 220.215 18.7269 220.215 17.0277C220.215 15.3764 219.043 14.407 217.882 14.3484V14.2418C218.947 13.9915 219.789 13.2457 219.789 11.9194C219.789 10.2947 218.617 9.09091 216.252 9.09091H212.076V20ZM214.052 18.3487V15.1527H216.231C217.451 15.1527 218.207 15.8984 218.207 16.8732C218.207 17.7415 217.61 18.3487 216.178 18.3487H214.052ZM214.052 13.7305V10.7209H216.05C217.211 10.7209 217.813 11.3335 217.813 12.1751C217.813 13.1339 217.035 13.7305 216.007 13.7305H214.052ZM221.934 20H229.072V18.3434H223.911V15.3658H228.662V13.7092H223.911V10.7475H229.03V9.09091H221.934V20ZM230.566 10.7475H233.938V20H235.898V10.7475H239.27V9.09091H230.566V10.7475ZM241.031 20L241.931 17.31H246.032L246.938 20H249.047L245.201 9.09091H242.762L238.921 20H241.031ZM242.464 15.7227L243.939 11.3281H244.024L245.5 15.7227H242.464Z`,fill:`white`})]})),JS=class extends Or.default{constructor(...e){super(...e),this.eventBacklogs=new Map}emit(e,...t){let n=super.emit(e,...t);if(!n){let n=this.eventBacklogs.get(e);n?n.push(t):this.eventBacklogs.set(e,[t])}return n}on(e,t){super.on(e,t);let n=this.eventBacklogs.get(e);if(n){for(let t of n)super.emit(e,...t);this.eventBacklogs.delete(e)}return this}addListener(e,t){return this.on(e,t)}once(e,t){super.once(e,t);let n=this.eventBacklogs.get(e);return n&&(super.emit(e,...n[0]),n.length===1?this.eventBacklogs.delete(e):n.shift()),this}},YS=typeof n==`object`&&n&&n.Object===Object&&n,XS=typeof self==`object`&&self&&self.Object===Object&&self,ZS=YS||XS||Function(`return this`)(),QS=ZS.Symbol,$S=Object.prototype,eC=$S.hasOwnProperty,tC=$S.toString,nC=QS?QS.toStringTag:void 0;function rC(e){var t=eC.call(e,nC),n=e[nC];try{e[nC]=void 0;var r=!0}catch{}var i=tC.call(e);return r&&(t?e[nC]=n:delete e[nC]),i}var iC=Object.prototype.toString;function aC(e){return iC.call(e)}var oC=`[object Null]`,sC=`[object Undefined]`,cC=QS?QS.toStringTag:void 0;function lC(e){return e==null?e===void 0?sC:oC:cC&&cC in Object(e)?rC(e):aC(e)}function uC(e){return typeof e==`object`&&!!e}var dC=`[object Symbol]`;function fC(e){return typeof e==`symbol`||uC(e)&&lC(e)==dC}function pC(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var mC=Array.isArray,hC=1/0,gC=QS?QS.prototype:void 0,_C=gC?gC.toString:void 0;function vC(e){if(typeof e==`string`)return e;if(mC(e))return pC(e,vC)+``;if(fC(e))return _C?_C.call(e):``;var t=e+``;return t==`0`&&1/e==-hC?`-0`:t}var yC=/\s/;function bC(e){for(var t=e.length;t--&&yC.test(e.charAt(t)););return t}var xC=/^\s+/;function SC(e){return e&&e.slice(0,bC(e)+1).replace(xC,``)}function CC(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var wC=NaN,TC=/^[-+]0x[0-9a-f]+$/i,EC=/^0b[01]+$/i,DC=/^0o[0-7]+$/i,OC=parseInt;function kC(e){if(typeof e==`number`)return e;if(fC(e))return wC;if(CC(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=CC(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=SC(e);var n=EC.test(e);return n||DC.test(e)?OC(e.slice(2),n?2:8):TC.test(e)?wC:+e}function AC(e){return e}var jC=`[object AsyncFunction]`,MC=`[object Function]`,NC=`[object GeneratorFunction]`,PC=`[object Proxy]`;function FC(e){if(!CC(e))return!1;var t=lC(e);return t==MC||t==NC||t==jC||t==PC}var IC=ZS[`__core-js_shared__`],LC=function(){var e=/[^.]+$/.exec(IC&&IC.keys&&IC.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function RC(e){return!!LC&&LC in e}var zC=Function.prototype.toString;function BC(e){if(e!=null){try{return zC.call(e)}catch{}try{return e+``}catch{}}return``}var VC=/[\\^$.*+?()[\]{}|]/g,HC=/^\[object .+?Constructor\]$/,UC=Function.prototype,WC=Object.prototype,GC=UC.toString,KC=WC.hasOwnProperty,qC=RegExp(`^`+GC.call(KC).replace(VC,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function JC(e){return!CC(e)||RC(e)?!1:(FC(e)?qC:HC).test(BC(e))}function YC(e,t){return e?.[t]}function XC(e,t){var n=YC(e,t);return JC(n)?n:void 0}var ZC=XC(ZS,`WeakMap`),QC=Object.create,$C=function(){function e(){}return function(t){if(!CC(t))return{};if(QC)return QC(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function ew(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function tw(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var nw=800,rw=16,iw=Date.now;function aw(e){var t=0,n=0;return function(){var r=iw(),i=rw-(r-n);if(n=r,i>0){if(++t>=nw)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function ow(e){return function(){return e}}var sw=function(){try{var e=XC(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),cw=aw(sw?function(e,t){return sw(e,`toString`,{configurable:!0,enumerable:!1,value:ow(t),writable:!0})}:AC),lw=9007199254740991,uw=/^(?:0|[1-9]\d*)$/;function dw(e,t){var n=typeof e;return t??=lw,!!t&&(n==`number`||n!=`symbol`&&uw.test(e))&&e>-1&&e%1==0&&e<t}function fw(e,t,n){t==`__proto__`&&sw?sw(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function pw(e,t){return e===t||e!==e&&t!==t}var mw=Object.prototype.hasOwnProperty;function hw(e,t,n){var r=e[t];(!(mw.call(e,t)&&pw(r,n))||n===void 0&&!(t in e))&&fw(e,t,n)}function gw(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?fw(n,s,c):hw(n,s,c)}return n}var _w=Math.max;function vw(e,t,n){return t=_w(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=_w(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),ew(e,this,s)}}function yw(e,t){return cw(vw(e,t,AC),e+``)}var bw=9007199254740991;function xw(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=bw}function Sw(e){return e!=null&&xw(e.length)&&!FC(e)}function Cw(e,t,n){if(!CC(n))return!1;var r=typeof t;return(r==`number`?Sw(n)&&dw(t,n.length):r==`string`&&t in n)?pw(n[t],e):!1}function ww(e){return yw(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Cw(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Tw=Object.prototype;function Ew(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Tw)}function Dw(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Ow=`[object Arguments]`;function kw(e){return uC(e)&&lC(e)==Ow}var Aw=Object.prototype,jw=Aw.hasOwnProperty,Mw=Aw.propertyIsEnumerable,Nw=kw(function(){return arguments}())?kw:function(e){return uC(e)&&jw.call(e,`callee`)&&!Mw.call(e,`callee`)};function Pw(){return!1}var Fw=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Iw=Fw&&typeof module==`object`&&module&&!module.nodeType&&module,Lw=Iw&&Iw.exports===Fw?ZS.Buffer:void 0,Rw=(Lw?Lw.isBuffer:void 0)||Pw,zw=`[object Arguments]`,Bw=`[object Array]`,Vw=`[object Boolean]`,Hw=`[object Date]`,Uw=`[object Error]`,Ww=`[object Function]`,Gw=`[object Map]`,Kw=`[object Number]`,qw=`[object Object]`,Jw=`[object RegExp]`,Yw=`[object Set]`,Xw=`[object String]`,Zw=`[object WeakMap]`,Qw=`[object ArrayBuffer]`,$w=`[object DataView]`,eT=`[object Float32Array]`,tT=`[object Float64Array]`,nT=`[object Int8Array]`,rT=`[object Int16Array]`,iT=`[object Int32Array]`,aT=`[object Uint8Array]`,oT=`[object Uint8ClampedArray]`,sT=`[object Uint16Array]`,cT=`[object Uint32Array]`,H={};H[eT]=H[tT]=H[nT]=H[rT]=H[iT]=H[aT]=H[oT]=H[sT]=H[cT]=!0,H[zw]=H[Bw]=H[Qw]=H[Vw]=H[$w]=H[Hw]=H[Uw]=H[Ww]=H[Gw]=H[Kw]=H[qw]=H[Jw]=H[Yw]=H[Xw]=H[Zw]=!1;function lT(e){return uC(e)&&xw(e.length)&&!!H[lC(e)]}function uT(e){return function(t){return e(t)}}var dT=typeof exports==`object`&&exports&&!exports.nodeType&&exports,fT=dT&&typeof module==`object`&&module&&!module.nodeType&&module,pT=fT&&fT.exports===dT&&YS.process,mT=function(){try{return fT&&fT.require&&fT.require(`util`).types||pT&&pT.binding&&pT.binding(`util`)}catch{}}(),hT=mT&&mT.isTypedArray,gT=hT?uT(hT):lT,_T=Object.prototype.hasOwnProperty;function vT(e,t){var n=mC(e),r=!n&&Nw(e),i=!n&&!r&&Rw(e),a=!n&&!r&&!i&&gT(e),o=n||r||i||a,s=o?Dw(e.length,String):[],c=s.length;for(var l in e)(t||_T.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||dw(l,c)))&&s.push(l);return s}function yT(e,t){return function(n){return e(t(n))}}var bT=yT(Object.keys,Object),xT=Object.prototype.hasOwnProperty;function ST(e){if(!Ew(e))return bT(e);var t=[];for(var n in Object(e))xT.call(e,n)&&n!=`constructor`&&t.push(n);return t}function CT(e){return Sw(e)?vT(e):ST(e)}function wT(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var TT=Object.prototype.hasOwnProperty;function ET(e){if(!CC(e))return wT(e);var t=Ew(e),n=[];for(var r in e)r==`constructor`&&(t||!TT.call(e,r))||n.push(r);return n}function DT(e){return Sw(e)?vT(e,!0):ET(e)}var OT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kT=/^\w*$/;function AT(e,t){if(mC(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||fC(e)?!0:kT.test(e)||!OT.test(e)||t!=null&&e in Object(t)}var jT=XC(Object,`create`);function MT(){this.__data__=jT?jT(null):{},this.size=0}function NT(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var PT=`__lodash_hash_undefined__`,FT=Object.prototype.hasOwnProperty;function IT(e){var t=this.__data__;if(jT){var n=t[e];return n===PT?void 0:n}return FT.call(t,e)?t[e]:void 0}var LT=Object.prototype.hasOwnProperty;function RT(e){var t=this.__data__;return jT?t[e]!==void 0:LT.call(t,e)}var zT=`__lodash_hash_undefined__`;function BT(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=jT&&t===void 0?zT:t,this}function VT(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}VT.prototype.clear=MT,VT.prototype.delete=NT,VT.prototype.get=IT,VT.prototype.has=RT,VT.prototype.set=BT;function HT(){this.__data__=[],this.size=0}function UT(e,t){for(var n=e.length;n--;)if(pw(e[n][0],t))return n;return-1}var WT=Array.prototype.splice;function GT(e){var t=this.__data__,n=UT(t,e);return n<0?!1:(n==t.length-1?t.pop():WT.call(t,n,1),--this.size,!0)}function KT(e){var t=this.__data__,n=UT(t,e);return n<0?void 0:t[n][1]}function qT(e){return UT(this.__data__,e)>-1}function JT(e,t){var n=this.__data__,r=UT(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function YT(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}YT.prototype.clear=HT,YT.prototype.delete=GT,YT.prototype.get=KT,YT.prototype.has=qT,YT.prototype.set=JT;var XT=XC(ZS,`Map`);function ZT(){this.size=0,this.__data__={hash:new VT,map:new(XT||YT),string:new VT}}function QT(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function $T(e,t){var n=e.__data__;return QT(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function eE(e){var t=$T(this,e).delete(e);return this.size-=+!!t,t}function tE(e){return $T(this,e).get(e)}function nE(e){return $T(this,e).has(e)}function rE(e,t){var n=$T(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function iE(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}iE.prototype.clear=ZT,iE.prototype.delete=eE,iE.prototype.get=tE,iE.prototype.has=nE,iE.prototype.set=rE;var aE=`Expected a function`;function oE(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(aE);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(oE.Cache||iE),n}oE.Cache=iE;var sE=500;function cE(e){var t=oE(e,function(e){return n.size===sE&&n.clear(),e}),n=t.cache;return t}var lE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,uE=/\\(\\)?/g,dE=cE(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(lE,function(e,n,r,i){t.push(r?i.replace(uE,`$1`):n||e)}),t});function fE(e){return e==null?``:vC(e)}function pE(e,t){return mC(e)?e:AT(e,t)?[e]:dE(fE(e))}var mE=1/0;function hE(e){if(typeof e==`string`||fC(e))return e;var t=e+``;return t==`0`&&1/e==-mE?`-0`:t}function gE(e,t){t=pE(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[hE(t[n++])];return n&&n==r?e:void 0}function _E(e,t,n){var r=e==null?void 0:gE(e,t);return r===void 0?n:r}function vE(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var yE=yT(Object.getPrototypeOf,Object),bE=`[object Object]`,xE=Function.prototype,SE=Object.prototype,CE=xE.toString,wE=SE.hasOwnProperty,TE=CE.call(Object);function EE(e){if(!uC(e)||lC(e)!=bE)return!1;var t=yE(e);if(t===null)return!0;var n=wE.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&CE.call(n)==TE}function DE(){this.__data__=new YT,this.size=0}function OE(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function kE(e){return this.__data__.get(e)}function AE(e){return this.__data__.has(e)}var jE=200;function ME(e,t){var n=this.__data__;if(n instanceof YT){var r=n.__data__;if(!XT||r.length<jE-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new iE(r)}return n.set(e,t),this.size=n.size,this}function NE(e){this.size=(this.__data__=new YT(e)).size}NE.prototype.clear=DE,NE.prototype.delete=OE,NE.prototype.get=kE,NE.prototype.has=AE,NE.prototype.set=ME;var PE=typeof exports==`object`&&exports&&!exports.nodeType&&exports,FE=PE&&typeof module==`object`&&module&&!module.nodeType&&module,IE=FE&&FE.exports===PE?ZS.Buffer:void 0,LE=IE?IE.allocUnsafe:void 0;function RE(e,t){if(t)return e.slice();var n=e.length,r=LE?LE(n):new e.constructor(n);return e.copy(r),r}function zE(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function BE(){return[]}var VE=Object.prototype.propertyIsEnumerable,HE=Object.getOwnPropertySymbols,UE=HE?function(e){return e==null?[]:(e=Object(e),zE(HE(e),function(t){return VE.call(e,t)}))}:BE,WE=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)vE(t,UE(e)),e=yE(e);return t}:BE;function GE(e,t,n){var r=t(e);return mC(e)?r:vE(r,n(e))}function KE(e){return GE(e,CT,UE)}function qE(e){return GE(e,DT,WE)}var JE=XC(ZS,`DataView`),YE=XC(ZS,`Promise`),XE=XC(ZS,`Set`),ZE=`[object Map]`,QE=`[object Object]`,$E=`[object Promise]`,eD=`[object Set]`,tD=`[object WeakMap]`,nD=`[object DataView]`,rD=BC(JE),iD=BC(XT),aD=BC(YE),oD=BC(XE),sD=BC(ZC),cD=lC;(JE&&cD(new JE(new ArrayBuffer(1)))!=nD||XT&&cD(new XT)!=ZE||YE&&cD(YE.resolve())!=$E||XE&&cD(new XE)!=eD||ZC&&cD(new ZC)!=tD)&&(cD=function(e){var t=lC(e),n=t==QE?e.constructor:void 0,r=n?BC(n):``;if(r)switch(r){case rD:return nD;case iD:return ZE;case aD:return $E;case oD:return eD;case sD:return tD}return t});var lD=cD,uD=ZS.Uint8Array;function dD(e){var t=new e.constructor(e.byteLength);return new uD(t).set(new uD(e)),t}function fD(e,t){var n=t?dD(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function pD(e){return typeof e.constructor==`function`&&!Ew(e)?$C(yE(e)):{}}var mD=`__lodash_hash_undefined__`;function hD(e){return this.__data__.set(e,mD),this}function gD(e){return this.__data__.has(e)}function _D(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new iE;++t<n;)this.add(e[t])}_D.prototype.add=_D.prototype.push=hD,_D.prototype.has=gD;function vD(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function yD(e,t){return e.has(t)}var bD=1,xD=2;function SD(e,t,n,r,i,a){var o=n&bD,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&xD?new _D:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!vD(t,function(e,t){if(!yD(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}function CD(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function wD(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var TD=1,ED=2,DD=`[object Boolean]`,OD=`[object Date]`,kD=`[object Error]`,AD=`[object Map]`,jD=`[object Number]`,MD=`[object RegExp]`,ND=`[object Set]`,PD=`[object String]`,FD=`[object Symbol]`,ID=`[object ArrayBuffer]`,LD=`[object DataView]`,RD=QS?QS.prototype:void 0,zD=RD?RD.valueOf:void 0;function BD(e,t,n,r,i,a,o){switch(n){case LD:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ID:return!(e.byteLength!=t.byteLength||!a(new uD(e),new uD(t)));case DD:case OD:case jD:return pw(+e,+t);case kD:return e.name==t.name&&e.message==t.message;case MD:case PD:return e==t+``;case AD:var s=CD;case ND:var c=r&TD;if(s||=wD,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=ED,o.set(e,t);var u=SD(s(e),s(t),r,i,a,o);return o.delete(e),u;case FD:if(zD)return zD.call(e)==zD.call(t)}return!1}var VD=1,HD=Object.prototype.hasOwnProperty;function UD(e,t,n,r,i,a){var o=n&VD,s=KE(e),c=s.length;if(c!=KE(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:HD.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var WD=1,GD=`[object Arguments]`,KD=`[object Array]`,qD=`[object Object]`,JD=Object.prototype.hasOwnProperty;function YD(e,t,n,r,i,a){var o=mC(e),s=mC(t),c=o?KD:lD(e),l=s?KD:lD(t);c=c==GD?qD:c,l=l==GD?qD:l;var u=c==qD,d=l==qD,f=c==l;if(f&&Rw(e)){if(!Rw(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new NE,o||gT(e)?SD(e,t,n,r,i,a):BD(e,t,c,n,r,i,a);if(!(n&WD)){var p=u&&JD.call(e,`__wrapped__`),m=d&&JD.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new NE,i(h,g,n,r,a)}}return f?(a||=new NE,UD(e,t,n,r,i,a)):!1}function XD(e,t,n,r,i){return e===t?!0:e==null||t==null||!uC(e)&&!uC(t)?e!==e&&t!==t:YD(e,t,n,r,XD,i)}var ZD=1,QD=2;function $D(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new NE;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?XD(u,l,ZD|QD,r,d):f))return!1}}return!0}function eO(e){return e===e&&!CC(e)}function tO(e){for(var t=CT(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,eO(i)]}return t}function nO(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function rO(e){var t=tO(e);return t.length==1&&t[0][2]?nO(t[0][0],t[0][1]):function(n){return n===e||$D(n,e,t)}}function iO(e,t){return e!=null&&t in Object(e)}function aO(e,t,n){t=pE(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=hE(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&xw(i)&&dw(o,i)&&(mC(e)||Nw(e)))}function oO(e,t){return e!=null&&aO(e,t,iO)}var sO=1,cO=2;function lO(e,t){return AT(e)&&eO(t)?nO(hE(e),t):function(n){var r=_E(n,e);return r===void 0&&r===t?oO(n,e):XD(t,r,sO|cO)}}function uO(e){return function(t){return t?.[e]}}function dO(e){return function(t){return gE(t,e)}}function fO(e){return AT(e)?uO(hE(e)):dO(e)}function pO(e){return typeof e==`function`?e:e==null?AC:typeof e==`object`?mC(e)?lO(e[0],e[1]):rO(e):fO(e)}function mO(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var hO=mO(),gO=function(){return ZS.Date.now()},_O=`Expected a function`,vO=Math.max,yO=Math.min;function bO(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(_O);t=kC(t)||0,CC(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?vO(kC(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?yO(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=gO();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(gO())}function x(){var e=gO(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}function xO(e,t,n){(n!==void 0&&!pw(e[t],n)||n===void 0&&!(t in e))&&fw(e,t,n)}function SO(e){return uC(e)&&Sw(e)}function CO(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}function wO(e){return gw(e,DT(e))}function TO(e,t,n,r,i,a,o){var s=CO(e,n),c=CO(t,n),l=o.get(c);if(l){xO(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=mC(c),p=!f&&Rw(c),m=!f&&!p&&gT(c);u=c,f||p||m?mC(s)?u=s:SO(s)?u=tw(s):p?(d=!1,u=RE(c,!0)):m?(d=!1,u=fD(c,!0)):u=[]:EE(c)||Nw(c)?(u=s,Nw(s)?u=wO(s):(!CC(s)||FC(s))&&(u=pD(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),xO(e,n,u)}function EO(e,t,n,r,i){e!==t&&hO(t,function(a,o){if(i||=new NE,CC(a))TO(e,t,o,n,EO,r,i);else{var s=r?r(CO(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),xO(e,o,s)}},DT)}var DO=ww(function(e,t,n){EO(e,t,n)});function OO(e,t,n,r){if(!CC(e))return e;t=pE(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=hE(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=CC(u)?u:dw(t[i+1])?[]:{})}hw(s,c,l),s=s[c]}return e}function kO(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=gE(e,o);n(s,o)&&OO(a,pE(o,e),s)}return a}function AO(e,t){if(e==null)return{};var n=pC(qE(e),function(e){return[e]});return t=pO(t),kO(e,n,function(e,n){return t(e,n[0])})}var jO=`Expected a function`;function MO(e,t,n){var r=!0,i=!0;if(typeof e!=`function`)throw TypeError(jO);return CC(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),bO(e,t,{leading:r,maxWait:t,trailing:i})}var NO={default_server_config:{"m.homeserver":{base_url:`http://localhost:8008`,server_name:`localhost`}},features:{feature_use_device_session_member_events:!0},ssla:`https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf`};function PO(e){return!(e.ok||e.url.startsWith(`file:`)&&e.status===0)}var FO=class e{static get(){if(!this.internalInstance?.config)throw Error(`Config instance read before config got initialized`);return this.internalInstance.config}static async init(){if(!e.internalInstance?.initPromise){let t=new e;e.internalInstance=t;let n;n=window.location.pathname.endsWith(`/room/`)||window.location.pathname.endsWith(`/room`)?new URL(`/config.json`,window.location.href).href:`config.json`,e.internalInstance.initPromise=IO(n).then(e=>{t.config=DO({},NO,e)})}return e.internalInstance.initPromise}static initDefault(){e.internalInstance=new e,e.internalInstance.config={...NO}}static defaultHomeserverUrl(){return WO().homeserver??e.get().default_server_config?.[`m.homeserver`].base_url}static defaultServerName(){let t=WO().homeserver;return t?new URL(t).hostname:e.get().default_server_config?.[`m.homeserver`].server_name}};async function IO(e){let t=await fetch(e);return PO(t)?NO:t.json()}var LO=function(e){return e[e.NONE=0]=`NONE`,e[e.PER_PARTICIPANT=1]=`PER_PARTICIPANT`,e[e.SHARED_KEY=2]=`SHARED_KEY`,e}({}),RO=/android/i.test(navigator.userAgent)?`android`:/iPad|iPhone|iPod|Mac/.test(navigator.userAgent)&&`ontouchend`in document?`ios`:`desktop`,zO=()=>{let{userAgent:e}=navigator;return e.includes(`Firefox`)},BO=function(e){return e.StartNewCall=`start_call`,e.JoinExistingCall=`join_existing`,e.StartNewCallVoice=`start_call_voice`,e.JoinExistingCallVoice=`join_existing_voice`,e.StartNewCallDM=`start_call_dm`,e.StartNewCallDMVoice=`start_call_dm_voice`,e.JoinExistingCallDM=`join_existing_dm`,e.JoinExistingCallDMVoice=`join_existing_dm_voice`,e.Unknown=`unknown`,e}({}),VO=function(e){return e.None=`none`,e.Standard=`standard`,e.AppBar=`app_bar`,e}({}),HO=class{constructor(e,t){this.queryParams=new URLSearchParams(e);let n=t.indexOf(`?`);this.fragmentParams=new URLSearchParams(n===-1?``:t.substring(n))}getParam(e){return this.fragmentParams.get(e)??this.queryParams.get(e)}getEnumParam(e,t){let n=this.getParam(e);if(n!==null&&Object.values(t).includes(n))return n}getAllParams(e){return[...this.fragmentParams.getAll(e),...this.queryParams.getAll(e)]}getFlagParam(e,t=!1){let n=this.getParam(e);return n===null?t:n!==`false`}getFlag(e){let t=this.getParam(e);return t===null?void 0:t!==`false`}},UO={},WO=(e=window.location.search,t=window.location.hash)=>{if(UO.search===e&&UO.hash===t&&UO.params)return UO.params;let n=GO(e,t);return UO={search:e,hash:t,params:n},n},GO=(e=``,t=``)=>{let n=new HO(e,t),r=parseFloat(n.getParam(`fontScale`)??``),i=n.getParam(`widgetId`),a=n.getParam(`parentUrl`),o=!!i&&!!a,s=o?n.getEnumParam(`intent`,BO)??BO.Unknown:BO.Unknown,c={confineToRoom:!0,preload:!1,header:RO===`desktop`?VO.None:VO.AppBar,showControls:!0,hideScreensharing:!1,allowIceFallback:!0,perParticipantE2EE:!0,controlledAudioDevices:RO!==`desktop`,skipLobby:!0,returnToLobby:!1,sendNotificationType:`notification`,autoLeaveWhenOthersLeft:!1,waitForCallPickup:!1};switch(s){case BO.StartNewCall:c.skipLobby=!1,c.callIntent=`video`;break;case BO.JoinExistingCall:c.skipLobby=!1,c.callIntent=`video`;break;case BO.StartNewCallVoice:c.skipLobby=!1,c.callIntent=`audio`;break;case BO.JoinExistingCallVoice:c.skipLobby=!1,c.callIntent=`audio`;break;case BO.StartNewCallDMVoice:c.callIntent=`audio`;case BO.StartNewCallDM:c.skipLobby=!0,c.sendNotificationType=`ring`,c.autoLeaveWhenOthersLeft=!0,c.waitForCallPickup=!0,c.callIntent=c.callIntent??`video`;break;case BO.JoinExistingCallDMVoice:c.callIntent=`audio`;case BO.JoinExistingCallDM:c.skipLobby=!0,c.autoLeaveWhenOthersLeft=!0,c.callIntent=c.callIntent??`video`;break;default:c={confineToRoom:!1,preload:!1,header:VO.Standard,showControls:!0,hideScreensharing:!1,allowIceFallback:!1,perParticipantE2EE:!1,controlledAudioDevices:!1,skipLobby:!1,returnToLobby:!1,sendNotificationType:void 0,autoLeaveWhenOthersLeft:!1,waitForCallPickup:!1}}let l={widgetId:i,parentUrl:a,roomId:n.getParam(`roomId`),password:n.getParam(`password`),userId:o?n.getParam(`userId`):null,displayName:n.getParam(`displayName`),deviceId:o?n.getParam(`deviceId`):null,baseUrl:o?n.getParam(`baseUrl`):null,lang:n.getParam(`lang`),fonts:n.getAllParams(`font`),fontScale:Number.isNaN(r)?null:r,theme:n.getParam(`theme`),viaServers:o?null:n.getParam(`viaServers`),homeserver:o?null:n.getParam(`homeserver`),posthogApiHost:n.getParam(`posthogApiHost`),posthogApiKey:n.getParam(`posthogApiKey`),posthogUserId:n.getParam(`posthogUserId`),rageshakeSubmitUrl:n.getParam(`rageshakeSubmitUrl`),sentryDsn:n.getParam(`sentryDsn`),sentryEnvironment:n.getParam(`sentryEnvironment`),e2eEnabled:n.getFlagParam(`enableE2EE`,!0)},u={confineToRoom:n.getFlag(`confineToRoom`),preload:o?n.getFlag(`preload`):void 0,header:n.getEnumParam(`header`,VO),showControls:n.getFlag(`showControls`),hideScreensharing:n.getFlag(`hideScreensharing`),allowIceFallback:n.getFlag(`allowIceFallback`),perParticipantE2EE:n.getFlag(`perParticipantE2EE`),controlledAudioDevices:n.getFlag(`controlledAudioDevices`),skipLobby:o?n.getFlag(`skipLobby`):!1,returnToLobby:o?n.getFlag(`returnToLobby`):!1,sendNotificationType:n.getEnumParam(`sendNotificationType`,[`ring`,`notification`]),waitForCallPickup:n.getFlag(`waitForCallPickup`),autoLeaveWhenOthersLeft:n.getFlag(`autoLeave`),noiseSuppression:n.getFlagParam(`noiseSuppression`,!0),echoCancellation:n.getFlagParam(`echoCancellation`,!0)};return I.info(`UrlParams: final set of url params
|
|
52
52
|
`,`intent:`,s,`
|
|
53
|
-
properties:`,l,`configuration:`,u),{...l,...c,...AO(u,e=>e!==void 0)}},KO=()=>{let{search:e,hash:t}=jo();return(0,R.useMemo)(()=>WO(e,t),[e,t])};function qO(e,t,n){let r=null;e=e.substring(1);let i=e.split(`/`),a=i[0]==`room`,o=i.length>1;n===``||n.startsWith(`#?`)?(o&&a&&(r=i[1]),a||(r=i[0])):r=n,r=r?.split(`?`)[0]??null,r&&(r.length<=1?r=null:(r.startsWith(`#`)||(r=`#${r}`),r.includes(`:`)||(r=`${r}:${FO.defaultServerName()}`)));let s=new HO(t,n),c=s.getParam(`roomId`);return c!==null&&(c=c.replaceAll(/^[^ -~]+|[^ -~]+$/g,``),c.startsWith(`!`)&&c.includes(``)||(c=null)),{roomAlias:r,roomId:c,viaServers:s.getAllParams(`viaServers`)}}var JO=()=>{let{pathname:e,search:t,hash:n}=jo();return(0,R.useMemo)(()=>qO(e,t,n),[e,t,n])};function YO(e,t,n){let r=new URLSearchParams;switch(t?.kind){case LO.SHARED_KEY:{let e=encodeURIComponent(t.secret);e!==t.secret&&I.info(`Encoded call password used non URL-safe chars: buggy client?`),r.set(`password`,e);break}case LO.PER_PARTICIPANT:r.set(`perParticipantE2EE`,`true`);break}return r.set(`roomId`,e),n?.forEach(e=>r.set(`viaServers`,e)),r}var XO=``+new URL(`cat-4r_NkDcK.ogg`,import.meta.url).href,ZO=``+new URL(`cat-Dd8bv_2W.mp3`,import.meta.url).href,QO=``+new URL(`clap-AxCMZLTd.ogg`,import.meta.url).href,$O=``+new URL(`clap-Dxm5qGyl.mp3`,import.meta.url).href,ek=``+new URL(`crickets-DUJdcuUa.ogg`,import.meta.url).href,tk=``+new URL(`crickets-CcwrRdbq.mp3`,import.meta.url).href,nk=``+new URL(`dog-CxIWtkNX.ogg`,import.meta.url).href,rk=``+new URL(`dog-BoQdnF-w.mp3`,import.meta.url).href,ik=``+new URL(`generic-BBbS3Wph.ogg`,import.meta.url).href,ak=``+new URL(`generic-BFeSb6fL.mp3`,import.meta.url).href,ok=``+new URL(`lightbulb-BIeJtAR_.ogg`,import.meta.url).href,sk=``+new URL(`lightbulb-BrnY00qi.mp3`,import.meta.url).href,ck=``+new URL(`party-D7rIOhAQ.ogg`,import.meta.url).href,lk=``+new URL(`party-BZPeTgC3.mp3`,import.meta.url).href,uk=``+new URL(`deer-DPSlVch4.ogg`,import.meta.url).href,dk=``+new URL(`deer-91r1Gyrx.mp3`,import.meta.url).href,fk=``+new URL(`rock-BVCJXNC-.ogg`,import.meta.url).href,pk=``+new URL(`rock-CHdnB31m.mp3`,import.meta.url).href,mk=``+new URL(`wave-FiiOzicp.ogg`,import.meta.url).href,hk=``+new URL(`wave-Bzf1LSMH.mp3`,import.meta.url).href,gk=``+new URL(`baduntss-Ca1ZuBEK.ogg`,import.meta.url).href,_k=``+new URL(`baduntss-DOe0oFuS.mp3`,import.meta.url).href,vk=`io.element.call.reaction`,yk={name:`generic`,emoji:``,sound:{mp3:ak,ogg:ik}},bk=[{emoji:`👍`,name:`thumbsup`,alias:[`+1`,`yes`,`thumbs up`]},{emoji:`🎉`,name:`party`,alias:[`hurray`,`success`],sound:{ogg:ck,mp3:lk}},{emoji:`👏`,name:`clapping`,alias:[`celebrate`,`success`],sound:{ogg:QO,mp3:$O}},{emoji:`🐶`,name:`dog`,alias:[`doggo`,`pupper`,`woofer`,`bark`],sound:{ogg:nk,mp3:rk}},{emoji:`🐱`,name:`cat`,alias:[`meow`,`kitty`],sound:{ogg:XO,mp3:ZO}},{emoji:`💡`,name:`lightbulb`,alias:[`bulb`,`light`,`idea`,`ping`],sound:{ogg:ok,mp3:sk}},{emoji:`🦗`,name:`crickets`,alias:[`awkward`,`silence`],sound:{ogg:ek,mp3:tk}},{emoji:`👎`,name:`thumbsdown`,alias:[`-1`,`no`,`thumbs no`]},{emoji:`😵💫`,name:`dizzy`,alias:[`dazed`,`confused`]},{emoji:`👌`,name:`ok`,alias:[`okay`,`cool`]},{emoji:`🥰`,name:`heart`,alias:[`heart`,`love`,`smiling`]},{emoji:`😄`,name:`laugh`,alias:[`giggle`,`joy`,`smiling`]},{emoji:`🦌`,name:`deer`,alias:[`stag`,`doe`,`bleat`],sound:{ogg:uk,mp3:dk}},{emoji:`🤘`,name:`rock`,alias:[`cool`,`horns`,`guitar`],sound:{ogg:fk,mp3:pk}},{emoji:`👋`,name:`wave`,alias:[`hand`,`waving`],sound:{ogg:mk,mp3:hk}},{emoji:`🥁`,name:`drum`,alias:[`joke`],sound:{ogg:gk,mp3:_k}}],xk=function(e){return e.JoinCall=`io.element.join`,e.HangupCall=`im.vector.hangup`,e.Close=`io.element.close`,e.DeviceMute=`io.element.device_mute`,e}({}),Sk,Ck=(e=`m.call`,t=!1)=>{try{let{widgetId:n,parentUrl:r,roomId:i,userId:a,deviceId:o,baseUrl:s,e2eEnabled:c,allowIceFallback:l}=WO();if(!i)throw Error(`Room ID must be supplied`);if(!a)throw Error(`User ID must be supplied`);if(!o)throw Error(`Device ID must be supplied`);if(!s)throw Error(`Base URL must be supplied`);if(n&&r){let u=new URL(r).origin;I.info(`Widget API is available`);let d=new Gr(n,u);d.requestCapability(Kr.AlwaysOnScreen),d.requestCapability(Kr.MSC4039DownloadFile);let f=new JS;[Fr.ThemeChange,xk.JoinCall,xk.HangupCall,xk.DeviceMute].forEach(e=>{d.on(`action:${e}`,t=>{t.preventDefault(),f.emit(e,t)})});let p=[j.CallNotify,j.RTCNotification];t&&p.push(j.RoomMessage);let m=[`org.matrix.rageshake_request`,j.CallEncryptionKeysPrefix,j.Reaction,j.RoomRedaction,vk,j.RTCDecline,j.RTCMembership],h=[a,`_${a}_${o}_${e}`,`${a}_${o}_${e}`].map(e=>({eventType:j.GroupCallMemberPrefix,stateKey:e})),g=[{eventType:j.RoomCreate},{eventType:j.RoomName},{eventType:j.RoomMember},{eventType:j.RoomEncryption},{eventType:j.GroupCallMemberPrefix}],_=[j.CallInvite,j.CallCandidates,j.CallAnswer,j.CallHangup,j.CallReject,j.CallSelectAnswer,j.CallNegotiate,j.CallSDPStreamMetadataChanged,j.CallSDPStreamMetadataChangedPrefix,j.CallReplaces,j.CallEncryptionKeysPrefix],v=Hi(d,{sendEvent:[...p,...m],receiveEvent:m,sendState:h,receiveState:g,sendToDevice:_,receiveToDevice:_,turnServers:!1,sendDelayedEvents:!0,updateDelayedEvents:!0,sendSticky:!0,receiveSticky:!0},i,{baseUrl:s,userId:a,deviceId:o,timelineSupport:!0,useE2eForGroupCall:c,fallbackICEServerAllowed:l},!1);Sk={api:d,lazyActions:f,client:(async()=>(await FO.init(),await v.startClient({clientWellKnownPollPeriod:600}),v))()}}else I.info(`No widget API available`),Sk=null}catch(e){I.warn(`Continuing without the widget API`,e),Sk=null}},wk=function(e){return e.XS=`xs`,e.SM=`sm`,e.MD=`md`,e.LG=`lg`,e.XL=`xl`,e}({}),Tk=new Map([[wk.XS,22],[wk.SM,32],[wk.MD,36],[wk.LG,42],[wk.XL,90]]);function Ek(e,t,n=96){let r=Math.floor(n*window.devicePixelRatio),i=Math.floor(n*window.devicePixelRatio),a=n<=96?`crop`:`scale`;return t?e.mxcUrlToHttp(t,r,i,a,!1,!0,!0):null}var Dk=({className:e,id:t,name:n,src:r,size:i=wk.MD,style:a,...o})=>{let s=dR(),c=(0,R.useMemo)(()=>Object.values(wk).includes(i)?Tk.get(i):i,[i]),[l,u]=(0,R.useState)(void 0);return(0,R.useEffect)(()=>{if(!r){u(void 0);return}let e;if(Sk?.api)e=kk(Sk.api,r);else if(s?.state===`valid`&&s.authenticated?.client&&c)e=Ok(s.authenticated.client,r,c);else{u(void 0);return}let t,n=!1;return e.then(e=>{n||(t=URL.createObjectURL(e),u(t))}).catch(e=>{n||u(void 0)}),()=>{n=!0,t&&URL.revokeObjectURL(t)}},[s,r,c]),(0,B.jsx)($g,{className:e,id:t,name:n,size:`${c}px`,src:l,style:a,...o})};async function Ok(e,t,n){let r=Ek(e,t,n);if(!r)throw Error(`Failed to get http avatar URL`);let i=e.getAccessToken();if(!i)throw Error(`Failed to get access token`);return await(await fetch(r,{headers:{Authorization:`Bearer ${i}`}})).blob()}async function kk(e,t){let n=(await e.downloadFile(t)).file;if(n instanceof Blob)return n;if(typeof n==`string`){let e=Uint8Array.from(atob(n),e=>e.charCodeAt(0));return new Blob([e])}throw Error(`Downloaded file format is not supported: `+typeof n)}var Ak={lock:`_lock_zf62g_8`},jk=({encrypted:e})=>{let{t}=dS(),n=e?yS:_S;return(0,B.jsx)(Mg,{label:t(e?`common.encrypted`:`common.unencrypted`),placement:`right`,isTriggerInteractive:!1,children:(0,B.jsx)(n,{width:16,height:16,className:Ak.lock,"data-encrypted":e})})};function Mk(e){let t=(0,R.useMemo)(()=>window.matchMedia(e),[e]);return(0,R.useSyncExternalStore)((0,R.useCallback)(e=>(t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)),[t]),(0,R.useCallback)(()=>t.matches,[t]))}var Nk={banner:`_banner_sye6n_8`},Pk=({children:e,className:t,...n})=>{let{t:r}=dS(),i=dR(),a=!1;return i?.state===`valid`&&(a=i.disconnected),(0,B.jsx)(B.Fragment,{children:a&&(0,B.jsxs)(`div`,{className:(0,z.default)(Nk.banner,t),...n,children:[e,r(`disconnected_banner`)]})})},Fk=({ref:e,children:t,className:n,disconnectedBanner:r=!0,...i})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`header`,{ref:e,className:(0,z.default)(KS.header,n),...i,children:t}),r&&(0,B.jsx)(Pk,{})]});Fk.displayName=`Header`;var Ik=({children:e,className:t,hideMobile:n,...r})=>(0,B.jsx)(`div`,{className:(0,z.default)(KS.nav,KS.leftNav,{[KS.hideMobile]:n},t),...r,children:e}),Lk=({children:e,className:t,hideMobile:n,...r})=>(0,B.jsx)(`div`,{className:(0,z.default)(KS.nav,KS.rightNav,{[KS.hideMobile]:n},t),...r,children:e}),Rk=({className:e})=>{let{t}=dS();return(0,B.jsx)(Qs,{className:(0,z.default)(KS.headerLogo,e),to:`/`,"aria-label":t(`header_label`),children:(0,B.jsx)(qS,{})})},zk=({id:e,name:t,avatarUrl:n,encrypted:r,participantCount:i})=>{let{t:a}=dS(),o=Mk(`(max-width: 550px)`)?`sm`:`lg`;return(0,B.jsxs)(`div`,{className:KS.roomHeaderInfo,"data-size":o,children:[(0,B.jsx)(Dk,{className:KS.roomAvatar,id:e,name:t,size:o===`sm`?wk.SM:56,src:n??void 0}),(0,B.jsxs)(`div`,{className:KS.nameLine,children:[(0,B.jsx)(bx,{type:o===`sm`?`body`:`heading`,size:o===`sm`?`lg`:`md`,weight:`semibold`,"data-testid":`roomHeader_roomName`,children:t}),(0,B.jsx)(jk,{encrypted:r})]}),(i??0)>0&&(0,B.jsxs)(`div`,{className:KS.participantsLine,children:[(0,B.jsx)(LS,{width:20,height:20,"aria-label":a(`header_participants_label`)}),(0,B.jsx)(nf,{as:`span`,size:`sm`,weight:`medium`,"data-testid":`roomHeader_participants_count`,children:a(`participant_count`,{count:i??0})})]})]})},Bk={page:`_page_fvtgn_8`,header:`_header_fvtgn_16`,container:`_container_fvtgn_20`,content:`_content_fvtgn_28`,wideButton:`_wideButton_fvtgn_47`,sendLogsSection:`_sendLogsSection_fvtgn_52`},Vk={rageshakeControl:`_rageshakeControl_65ekp_8`},Hk=1024*1024*5,Uk=2*1e3,Wk=3,Gk=function(e){return e.Log=`log`,e}(Gk||{}),Kk=class extends Or.default{constructor(...e){super(...e),this.logs=``,this.log=(e,...t)=>{let n=new Date().toISOString();t=t.map(e=>{if(e instanceof DOMException)return e.message+` (${e.name} | ${e.code})`;if(e instanceof Error)return e.message+(e.stack?`\n${e.stack}`:``);if(typeof e==`object`)try{return JSON.stringify(e,Qk())}catch{return`<$ failed to serialize object $>`}else return e});let r=`${n} ${e} ${t.join(` `)}\n`;r=r.replace(/token=[a-zA-Z0-9-]+/gm,`token=xxxxx`),this.logs+=r,this.emit(Gk.Log)}}popLogs(){let e=this.logs;return this.logs=``,e}peekLogs(){return this.logs}},qk=class{constructor(e,t){this.indexedDB=e,this.loggerInstance=t,this.index=0,this.onLoggerLog=()=>{this.db&&this.throttledFlush()},this.throttledFlush=MO(()=>this.flush,Uk,{leading:!1,trailing:!0}),this.flush=async()=>this.flushPromise?(this.flushAgainPromise||=this.flushPromise.then(this.flush).then(()=>{this.flushAgainPromise=void 0}),this.flushAgainPromise):(this.flushPromise=new Promise((e,t)=>{if(!this.db){t(Error(`No connected database`));return}let n=this.loggerInstance.popLogs();if(n.length===0){e();return}let r=this.db.transaction([`logs`,`logslastmod`],`readwrite`),i=r.objectStore(`logs`);r.oncomplete=()=>{e()},r.onerror=e=>{I.error(`Failed to flush logs : `,e),t(Error(`Failed to write logs: `+r?.error?.message))},i.add(this.generateLogEntry(n)),r.objectStore(`logslastmod`).put(this.generateLastModifiedTime())}).then(()=>{this.flushPromise=void 0}),this.flushPromise),this.id=`instance-`+Ct(16),t.on(Gk.Log,this.onLoggerLog),window.addEventListener(`beforeunload`,()=>{this.flush().catch(e=>I.error(`Failed to flush logs before unload`,e))})}async connect(){let e=this.indexedDB.open(`logs`);return new Promise((t,n)=>{e.onsuccess=()=>{this.db=e.result,t()},e.onerror=()=>{let t=`Failed to open log database: `+e?.error?.name;I.error(t),n(Error(t))},e.onupgradeneeded=()=>{let t=e.result,n=t.createObjectStore(`logs`,{keyPath:[`id`,`index`]});n.createIndex(`id`,`id`,{unique:!1}),n.add(this.generateLogEntry(new Date+` ::: Log database was created.`)),t.createObjectStore(`logslastmod`,{keyPath:`id`}).add(this.generateLastModifiedTime())}})}async consume(){let e=this.db;if(!e)return Promise.reject(Error(`No connected database`));async function t(t,n){let r=e.transaction(`logs`,`readonly`).objectStore(`logs`);return new Promise((e,i)=>{let a=r.index(`id`).openCursor(IDBKeyRange.only(t),`prev`),o=``;a.onerror=()=>{i(Error(`Query failed: `+a?.error?.message))},a.onsuccess=()=>{let t=a.result;if(!t){e(o);return}o=t.value.lines+o,o.length>=n?e(o):t.continue()}})}async function n(){return Jk(e.transaction(`logslastmod`,`readonly`).objectStore(`logslastmod`),void 0,e=>({id:e.value.id,ts:e.value.ts})).then(e=>e.sort((e,t)=>t.ts-e.ts).map(e=>e.id))}async function r(t){return new Promise((n,r)=>{let i=e.transaction([`logs`,`logslastmod`],`readwrite`),a=i.objectStore(`logs`),o=a.index(`id`).openKeyCursor(IDBKeyRange.only(t));o.onsuccess=()=>{let e=o.result;e&&(a.delete(e.primaryKey),e.continue())},i.oncomplete=()=>{n()},i.onerror=()=>{r(Error(`Failed to delete logs for '${t}' : ${i?.error?.message}`))},i.objectStore(`logslastmod`).delete(t)})}let i=await n(),a=[],o=[],s=0;for(let e=0;e<i.length;e++){let n=await t(i[e],Hk-s);if(o.push({lines:n,id:i[e]}),s+=n.length,s>=Hk){a=i.slice(e+1).map(e=>parseInt(e,10));break}}return a.length>0&&(I.log(`Removing logs: `,a),Promise.all(a.map(async e=>r(e))).then(()=>{I.log(`Removed ${a.length} old logs.`)},e=>{I.error(e)})),o}generateLogEntry(e){return{id:this.id,lines:e,index:this.index++}}generateLastModifiedTime(){return{id:this.id,ts:Date.now()}}};async function Jk(e,t,n){let r=e.openCursor(t);return new Promise((e,t)=>{let i=[];r.onerror=()=>{t(Error(`Query failed: `+r?.error?.message))},r.onsuccess=()=>{let t=r.result;if(!t){e(i);return}i.push(n(t)),t.continue()}})}async function Yk(){return n.mx_rage_logger=new Kk,eA(I,n.mx_rage_logger.log),[`trace`,`debug`,`info`,`warn`,`error`].forEach(e=>{let t=window.console[e];if(!t)return;let r=`${e.toUpperCase()} matrix_sdk`;window.console[e]=(...i)=>{t(...i),typeof i[0]==`string`&&i[0].startsWith(r)&&n.mx_rage_logger.log($k[e],`matrix_sdk`,...i)}}),Xk()}async function Xk(){if(n.mx_rage_initStoragePromise)return n.mx_rage_initStoragePromise;I.log(`Configuring rageshake persistence...`);let e;try{e=window.indexedDB}catch(e){I.warn(`Could not get indexDB from window.`,e)}return e?(n.mx_rage_store=new qk(e,n.mx_rage_logger),n.mx_rage_initStoragePromise=n.mx_rage_store.connect(),n.mx_rage_initStoragePromise):(n.mx_rage_initStoragePromise=Promise.resolve(),n.mx_rage_initStoragePromise)}async function Zk(){if(!n.mx_rage_logger)throw Error(`No console logger, did you forget to call init()?`);return n.mx_rage_store?(await n.mx_rage_store.flush(),n.mx_rage_store.consume()):[{lines:n.mx_rage_logger.peekLogs(),id:`-`}]}var Qk=()=>{let e=new WeakSet,t=new WeakMap;return function(n,r){if(typeof r==`object`&&r){if(e.has(r))return`<$ cycle-trimmed $>`;e.add(r);let n=0;if(this&&(n=t.get(this)??0),t.set(r,n+1),n>Wk)return`<$ object-pruned $>`}return r}},$k=function(e){return e[e.trace=0]=`trace`,e[e.debug=1]=`debug`,e[e.info=2]=`info`,e[e.warn=3]=`warn`,e[e.error=4]=`error`,e[e.silent=5]=`silent`,e}($k||{});function eA(e,t){let n=e,r=n.methodFactory;n.methodFactory=function(e,n,i){let a=r(e,n,i),o=$k[e],s=o>=n&&o<$k.silent;return(...e)=>{a.apply(this,e),s&&t(o,i?.toString(),...e)}},n.setLevel(n.getLevel())}var tA=async e=>{let{gzip:t}=await se(async()=>{let{gzip:e}=await import(`./pako.esm-xdBZSMA1.js`);return{gzip:e}},__vite__mapDeps([0,1]),import.meta.url),n=new TextEncoder().encode(e);return new Blob([t(n)])};async function nA(e,t){t.append(`crypto_version`,e.getVersion());let n=await e.getOwnDeviceKeys(),r=[`curve25519:${n.curve25519}`,`ed25519:${n.ed25519}`];t.append(`device_keys`,r.join(`, `));let i=await e.getCrossSigningStatus();t.append(`cross_signing_ready`,String(await e.isCrossSigningReady())),t.append(`cross_signing_key`,await e.getCrossSigningKeyId()??`n/a`),t.append(`cross_signing_privkey_in_secret_storage`,String(i.privateKeysInSecretStorage)),t.append(`cross_signing_master_privkey_cached`,String(i.privateKeysCachedLocally.masterKey)),t.append(`cross_signing_self_signing_privkey_cached`,String(i.privateKeysCachedLocally.selfSigningKey)),t.append(`cross_signing_user_signing_privkey_cached`,String(i.privateKeysCachedLocally.userSigningKey))}async function rA(e,t,n){let r=e.secretStorage;n.append(`secret_storage_ready`,String(await t.isSecretStorageReady())),n.append(`secret_storage_key_in_account`,String(await r.hasKey())),n.append(`session_backup_key_in_secret_storage`,String(!!await e.isKeyBackupKeyStored()));let i=await t.getSessionBackupPrivateKey();n.append(`session_backup_key_cached`,String(!!i)),n.append(`session_backup_key_well_formed`,String(i instanceof Uint8Array))}function iA(){return WO().rageshakeSubmitUrl??void 0}function aA(e=iA){let{client:t}=fR(),[{sending:n,sent:r,error:i},a]=(0,R.useState)({sending:!1,sent:!1,error:void 0});return{submitRageshake:(0,R.useCallback)(async r=>{let i=e();if(!i)throw Error(`No rageshake URL is configured`);if(!n)try{a({sending:!0,sent:!1,error:void 0});let e=`UNKNOWN`;window.navigator&&window.navigator.userAgent&&(e=window.navigator.userAgent);let n=`UNKNOWN`;try{n=String(window.matchMedia(`(pointer: coarse)`).matches)}catch(e){I.warn(`Could not get coarse pointer for rageshake submit.`,e)}let o=r.rageshakeRequestId?`Rageshake ${r.rageshakeRequestId}`:``;r.description&&(o+=`: ${r.description}`);let s=new FormData;if(s.append(`text`,o??`User did not supply any additional text.`),s.append(`app`,`matrix-video-chat`),s.append(`version`,`embedded-v0.19.2-rc.1`),s.append(`user_agent`,e),s.append(`installed_pwa`,`false`),s.append(`touch_input`,n),s.append(`call_backend`,`livekit`),s.append(`hostname`,window.location.hostname),t){let e=t.getUserId(),n=t.getUser(e);s.append(`display_name`,n?.displayName??``),s.append(`user_id`,t.credentials.userId??``),s.append(`device_id`,t.deviceId??``),r.roomId&&s.append(`room_id`,r.roomId);let i=t.getCrypto();i&&(await nA(i,s),await rA(t,i,s))}if(r.label&&s.append(`label`,r.label),navigator.storage&&navigator.storage.persisted)try{s.append(`storageManager_persisted`,String(await navigator.storage.persisted()))}catch(e){I.warn(`coulr not get navigator peristed storage`,e)}else if(document.hasStorageAccess)try{s.append(`storageManager_persisted`,String(await document.hasStorageAccess()))}catch(e){I.warn(`could not get storage access`,e)}if(navigator.storage&&navigator.storage.estimate)try{let e=await navigator.storage.estimate();s.append(`storageManager_quota`,String(e.quota)),s.append(`storageManager_usage`,String(e.usage)),e.usageDetails&&Object.keys(e.usageDetails).forEach(t=>{s.append(`storageManager_usage_${t}`,String(e.usageDetails[t]))})}catch(e){I.warn(`could not obatain storage estimate`,e)}if(r.sendLogs){let e=await Zk();for(let t of e)s.append(`compressed-log`,await tA(t.lines),t.id)}r.rageshakeRequestId&&s.append(`group_call_rageshake_request_id`,r.rageshakeRequestId);let c=await fetch(i,{method:`POST`,body:s});if(c.status!==200)throw Error(`Failed to submit feedback: receive HTTP ${c.status} ${c.statusText}`);a({sending:!1,sent:!0,error:void 0})}catch(e){a({sending:!1,sent:!1,error:e}),I.error(e)}},[t,n,e]),sending:n,sent:r,error:i,available:!!e()}}function oA(){let{client:e}=fR();return(0,R.useCallback)((t,n)=>{e.sendEvent(t,`org.matrix.rageshake_request`,{request_id:n}).catch(e=>{I.error(`Failed to send org.matrix.rageshake_request event`,e)})},[e])}function sA(e){let[t,n]=(0,R.useState)(!1),r=(0,R.useCallback)(()=>n(!1),[n]),{client:i}=fR(),[a,o]=(0,R.useState)();return(0,R.useEffect)(()=>{if(!i)return;let t=t=>{t.getType()===`org.matrix.rageshake_request`&&e===t.getRoomId()&&i.getUserId()!==t.getSender()&&(o(t.getContent().request_id),n(!0))};return i.on(cr.Event,t),()=>{i.removeListener(cr.Event,t)}},[n,e,i]),{rageshakeRequestId:a??``,roomId:e,open:t,onDismiss:r}}var cA=({description:e})=>{let{submitRageshake:t,sending:n,sent:r,error:i}=aA(),{t:a}=dS(),o=(0,R.useCallback)(()=>{t({description:e,sendLogs:!0}).catch(e=>{I.error(`Failed to send rageshake`,e)})},[t,e]);if(!FO.get().rageshake?.submit_url)return null;let s=null;if(n)s=(0,B.jsx)(`span`,{children:a(`rageshake_sending`)});else if(r)s=(0,B.jsx)(`div`,{children:a(`rageshake_sent`)});else{let e=a(`rageshake_send_logs`);i&&(e=a(`rageshake_button_error_caption`)),s=(0,B.jsx)(of,{onClick:o,className:Vk.wideButton,disabled:n,children:e})}return(0,B.jsx)(`div`,{className:Vk.rageshakeControl,children:s})},lA={error:`_error_17zfc_1`,icon:`_icon_17zfc_9`},uA={endCall:`_endCall_bwclo_8`},dA={footer:`_footer_17bu0_8`,hidden:`_hidden_17bu0_25`,overlay:`_overlay_17bu0_29`,settingsLogoContainer:`_settingsLogoContainer_17bu0_52`,logo:`_logo_17bu0_60`,buttons:`_buttons_17bu0_68`,layout:`_layout_17bu0_75`,settingsOnlyShowNarrow:`_settingsOnlyShowNarrow_17bu0_87`,settingsOnlyShowWide:`_settingsOnlyShowWide_17bu0_90`,shareScreen:`_shareScreen_17bu0_132`,raiseHand:`_raiseHand_17bu0_149`},fA=({enabled:e,...t})=>{let{t:n}=dS(),r=e?CS:xS;return(0,B.jsx)(Mg,{label:n(e?`mute_microphone_button_label`:`unmute_microphone_button_label`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:r,kind:e?`primary`:`secondary`,role:`switch`,"aria-checked":e,...t})})},pA=({enabled:e,...t})=>{let{t:n}=dS(),r=e?VS:zS;return(0,B.jsx)(Mg,{label:n(e?`stop_video_button_label`:`start_video_button_label`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:r,kind:e?`primary`:`secondary`,role:`switch`,"aria-checked":e,...t})})},mA=({enabled:e,...t})=>{let{t:n}=dS();return(0,B.jsx)(Mg,{label:n(e?`stop_screenshare_button_label`:`screenshare_button_label`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:FS,kind:e?`primary`:`secondary`,role:`switch`,"aria-checked":e,...t})})},hA=({className:e,...t})=>{let{t:n}=dS();return(0,B.jsx)(Mg,{label:n(`hangup_button_label`),children:(0,B.jsx)(of,{className:(0,z.default)(e,uA.endCall),iconOnly:!0,Icon:hS,destructive:!0,...t})})},gA=({loudspeakerModeEnabled:e,...t})=>{let{t:n}=dS();return(0,B.jsx)(Mg,{label:n(e?`settings.devices.loudspeaker`:`settings.devices.handset`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:e?GS:US,...t,kind:e?`primary`:`secondary`,"aria-checked":e})})};function _A(e,t){return(0,z.default)(e,{[dA.settingsOnlyShowWide]:t===`wide`,[dA.settingsOnlyShowNarrow]:t===`narrow`})}var vA=({showForScreenWidth:e,className:t,...n})=>{let{t:r}=dS(),i=RO===`android`?DS:TS;return(0,B.jsx)(Mg,{label:r(`common.settings`),children:(0,B.jsx)(Lg,{className:_A(t,e),...n,children:(0,B.jsx)(i,{"aria-hidden":!0})})})},yA=({showForScreenWidth:e,className:t,...n})=>{let{t:r}=dS();return(0,B.jsx)(Mg,{label:r(`common.settings`),children:(0,B.jsx)(of,{className:_A(t,e),iconOnly:!0,Icon:RO===`android`?DS:TS,kind:`secondary`,...n})})},bA={external:`_external_jhjdf_8`};function xA(e,t){return[ko(e),ac(e,{state:t})]}var SA=({ref:e,to:t,state:n,...r})=>{let[i,a]=xA(t,n);return(0,B.jsx)(wx,{ref:e,...r,href:i,onClick:a})},CA=({ref:e,className:t,children:n,...r})=>(0,B.jsx)(`a`,{ref:e,className:(0,z.default)(t,bA.external),target:`_blank`,rel:`noreferrer noopener`,...r,children:n}),wA=({ref:e,to:t,state:n,...r})=>{let[i,a]=xA(t,n);return(0,B.jsx)(of,{as:`a`,ref:e,...r,href:i,onClick:a})};function TA(e,t,n,r){(0,R.useEffect)(()=>{if(e)return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)},[e,t,n,r])}function EA(e,t,n){(0,R.useEffect)(()=>(e.on(t,n),()=>{e.off(t,n)}),[e,t,n])}function DA(e,t,n){return(0,R.useSyncExternalStore)((0,R.useCallback)(n=>(e.on(t,n),()=>{e.off(t,n)}),[e,t]),n)}function OA(e){return DA(e,Zn.MembershipsChanged,(0,R.useCallback)(()=>e.memberships,[e]))}function kA(e){return(0,R.useSyncExternalStore)((0,R.useCallback)(t=>{let n=e.subscribe(t);return()=>n.unsubscribe()},[e]),(0,R.useCallback)(()=>e.value,[e]))}var AA=(0,R.createContext)(void 0),jA=()=>{let e=(0,R.use)(AA);if(!e)throw Error(`useReactions must be used within a ReactionsProvider`);return e},MA=({children:e,rtcSession:t,vm:n})=>{let r=OA(t),i=dR(),a=i?.state===`valid`&&i.supportedFeatures.reactions,o=t.room,s=o.client.getUserId(),c=o.client.getDeviceId(),l=`${s}:${c}`,u=(0,R.useMemo)(()=>r.find(e=>e.userId===s&&e.deviceId===c)?.eventId,[r,s,c]),d=kA(n.reactions$),f=(0,R.useMemo)(()=>l===void 0?void 0:d[l],[l,d]),p=kA(n.handsRaised$),m=(0,R.useMemo)(()=>l===void 0?void 0:p[l],[l,p]);return(0,B.jsx)(AA,{value:{supportsReactions:a,toggleRaisedHand:(0,R.useCallback)(async()=>{if(!l)return;let e=m?.reactionEventId;if(e)try{await o.client.redactEvent(t.room.roomId,e),I.debug(`Redacted raise hand event`)}catch(t){throw I.error(`Failed to redact reaction event`,e,t),t}else try{if(!u)throw Error(`Cannot find own membership event`);let e=await o.client.sendEvent(t.room.roomId,j.Reaction,{"m.relates_to":{rel_type:it.Annotation,event_id:u,key:`🖐️`}});I.debug(`Sent raise hand event`,e.event_id)}catch(e){I.error(`Failed to send raised hand`,e)}},[u,l,m,t,o]),sendReaction:(0,R.useCallback)(async e=>{if(!(!l||f)){if(!u)throw Error(`Cannot find own membership event`);await o.client.sendEvent(t.room.roomId,vk,{"m.relates_to":{rel_type:it.Reference,event_id:u},emoji:e.emoji,name:e.name})}},[u,f,o,l,t])},children:e})},NA={raisedButton:`_raisedButton_unw54_1`,reactionPopupMenu:`_reactionPopupMenu_unw54_5`,reactionPopupMenuRoot:`_reactionPopupMenuRoot_unw54_21`,reactionPopupMenuModal:`_reactionPopupMenuModal_unw54_21`,reactionsMenuSection:`_reactionsMenuSection_unw54_47`,reactionsMenu:`_reactionsMenu_unw54_47`,reactionButton:`_reactionButton_unw54_81`,verticalSeperator:`_verticalSeperator_unw54_91`,alert:`_alert_unw54_99`,"grow-in":`_grow-in_unw54_1`},PA=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),FA=`VisuallyHidden`,IA=R.forwardRef((e,t)=>(0,B.jsx)(Ix.span,{...e,ref:t,style:{...PA,...e.style}}));IA.displayName=FA;var LA={modal:`_modal_lmgdq_8`,dialog:`_dialog_lmgdq_14`,content:`_content_lmgdq_21`,drawer:`_drawer_lmgdq_32`,close:`_close_lmgdq_59`,header:`_header_lmgdq_84`,body:`_body_lmgdq_114`,tabbed:`_tabbed_lmgdq_129`,handle:`_handle_lmgdq_133`},RA={bg:`_bg_180k3_8`,animate:`_animate_180k3_23`,"fade-in":`_fade-in_180k3_1`,"fade-out":`_fade-out_180k3_1`,overlay:`_overlay_180k3_42`,"zoom-in":`_zoom-in_180k3_1`,"zoom-out":`_zoom-out_180k3_1`},zA=({title:e,hideHeader:t,children:n,className:r,classNameDrawer:i,classNameModal:a,open:o,onDismiss:s,tabbed:c,...l})=>{let{t:u}=dS(),d=Mk(`(hover: none) or (pointer: coarse)`),f=(0,R.useCallback)(e=>{e||s?.()},[s]);if(d)return(0,B.jsx)(_x.Root,{open:o,onOpenChange:f,dismissible:s!==void 0,children:(0,B.jsxs)(_x.Portal,{children:[(0,B.jsx)(_x.Overlay,{className:(0,z.default)(RA.bg)}),(0,B.jsx)(_x.Content,{className:(0,z.default)(r,i,RA.overlay,LA.modal,LA.drawer,{[LA.tabbed]:c}),role:`dialog`,"aria-describedby":void 0,...l,children:(0,B.jsxs)(`div`,{className:LA.content,children:[(0,B.jsxs)(`div`,{className:LA.header,children:[(0,B.jsx)(`div`,{className:LA.handle}),(0,B.jsx)(IA,{asChild:!0,children:(0,B.jsx)(_x.Title,{children:e})})]}),(0,B.jsx)(`div`,{className:LA.body,children:n})]})})]})});{let i=(0,B.jsx)(ub,{asChild:!0,children:(0,B.jsx)(bx,{as:`h2`,weight:`semibold`,size:`md`,children:e})}),d=(0,B.jsxs)(`div`,{className:LA.header,children:[i,s!==void 0&&(0,B.jsx)(fb,{className:LA.close,"data-testid":`modal_close`,"aria-label":u(`action.close`),children:(0,B.jsx)(Kg,{width:20,height:20})})]});return(0,B.jsx)(ab,{open:o,onOpenChange:f,children:(0,B.jsxs)(sb,{children:[(0,B.jsx)(cb,{className:(0,z.default)(RA.bg,RA.animate)}),(0,B.jsx)(lb,{asChild:!0,"aria-describedby":void 0,role:`dialog`,...l,children:(0,B.jsx)(yx,{className:(0,z.default)(r,a,RA.overlay,RA.animate,LA.modal,LA.dialog,{[LA.tabbed]:c}),children:(0,B.jsxs)(`div`,{className:LA.content,children:[t?null:d,t?(0,B.jsx)(IA,{asChild:!0,children:i}):null,(0,B.jsx)(`div`,{className:LA.body,children:n})]})})})]})})}},BA=({raised:e,open:t,...n})=>{let{t:r}=dS();return(0,B.jsx)(Mg,{label:r(`common.reactions`),children:(0,B.jsx)(of,{className:(0,z.default)(e&&NA.raisedButton),"aria-expanded":t,"aria-haspopup":!0,kind:e||t?`primary`:`secondary`,iconOnly:!0,Icon:e?jS:NS,...n})})};function VA({sendReaction:e,toggleRaisedHand:t,isHandRaised:n,canReact:r,errorText:i}){let{t:a}=dS(),[o,s]=(0,R.useState)(!1),c=(0,R.useMemo)(()=>o?bk:bk.slice(0,5),[o]),l=a(n?`action.lower_hand`:`action.raise_hand`);return(0,B.jsxs)(B.Fragment,{children:[i&&(0,B.jsx)(qg,{className:NA.alert,type:`critical`,title:a(`error.generic`),children:i}),(0,B.jsxs)(`div`,{className:NA.reactionPopupMenu,children:[(0,B.jsx)(`section`,{className:NA.handRaiseSection,children:(0,B.jsx)(Mg,{label:l,caption:`H`,children:(0,B.jsx)(of,{kind:n?`primary`:`secondary`,"aria-keyshortcuts":`H`,"aria-pressed":n,"aria-label":l,onClick:()=>t(),iconOnly:!0,Icon:jS})})}),(0,B.jsx)(`div`,{className:NA.verticalSeperator}),(0,B.jsx)(`section`,{className:NA.reactionsMenuSection,children:(0,B.jsx)(`menu`,{className:(0,z.default)(o&&NA.reactionsMenuExpanded,NA.reactionsMenu),children:c.map((t,n)=>(0,B.jsx)(`li`,{children:(0,B.jsx)(Mg,{label:t.name,caption:n<5?(n+1).toString():void 0,children:(0,B.jsx)(of,{kind:`secondary`,className:NA.reactionButton,disabled:!r,onClick:()=>e(t),"aria-keyshortcuts":n<5?(n+1).toString():void 0,children:t.emoji})})},t.name))})}),(0,B.jsx)(`section`,{style:{marginLeft:`var(--cpd-separator-spacing)`},children:(0,B.jsx)(Mg,{label:a(o?`action.show_less`:`action.show_more`),children:(0,B.jsx)(of,{iconOnly:!0,"aria-label":a(o?`action.show_less`:`action.show_more`),Icon:o?pS:Rx,kind:`tertiary`,onClick:()=>s(!o)})})})]})]})}function HA({identifier:e,reactionData:{handsRaised$:t,reactions$:n},...r}){let{t:i}=dS(),{toggleRaisedHand:a,sendReaction:o}=jA(),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(!1),[d,f]=(0,R.useState)(),p=!!kA(t)[e],m=!kA(n)[e];(0,R.useEffect)(()=>{f(void 0)},[l]);let h=(0,R.useCallback)(async e=>{try{c(!0),await o(e),f(void 0),u(!1)}catch(e){f(e instanceof Error?e.message:`Unknown error`),I.error(`Failed to send reaction`,e)}finally{c(!1)}},[o]),g=(0,R.useCallback)(()=>{(async()=>{try{c(!0),await a(),u(!1)}catch(e){f(e instanceof Error?e.message:`Unknown error`),I.error(`Failed to raise/lower hand`,e)}finally{c(!1)}})()},[a]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(BA,{disabled:s,onClick:()=>u(e=>!e),raised:!!p,open:l,...r}),(0,B.jsx)(zA,{open:l,title:i(`action.pick_reaction`),hideHeader:!0,classNameModal:NA.reactionPopupMenuModal,className:NA.reactionPopupMenuRoot,onDismiss:()=>u(!1),children:(0,B.jsx)(VA,{errorText:d,isHandRaised:!!p,canReact:!s&&!!m,sendReaction:e=>void h(e),toggleRaisedHand:g})})]})}var UA=({Icon:e,title:t,rageshake:n,fatal:r,children:i,widget:a})=>{let{t:o}=dS(),{confineToRoom:s}=KO(),c=(0,R.useCallback)(()=>{window.location.href=`/`},[]);return(0,B.jsxs)(`div`,{className:lA.error,children:[(0,B.jsx)(Sx,{className:lA.icon,children:(0,B.jsx)(e,{"aria-hidden":!0})}),(0,B.jsx)(bx,{as:`h1`,weight:`semibold`,size:`md`,children:t}),i,n&&(0,B.jsx)(cA,{description:`***Error View***: ${t}`}),a?(0,B.jsx)(({widget:e})=>(0,B.jsx)(of,{kind:`primary`,onClick:()=>{e.api.transport.send(xk.Close,{}).catch(e=>{I.error(`Failed to send close action`,e)}).finally(()=>{e.api.transport.stop()})},children:o(`action.close`)}),{widget:a}):!s&&(0,B.jsx)(()=>r||location.pathname===`/`?(0,B.jsx)(of,{kind:`tertiary`,className:lA.homeLink,onClick:c,children:o(`return_home_button`)}):(0,B.jsx)(wA,{kind:`tertiary`,className:lA.homeLink,to:`/`,children:o(`return_home_button`)}),{})]})},WA=class extends Error{constructor(e,t){super(e),this.richMessage=t}},GA=()=>{let{t:e}=dS();return(0,B.jsx)(UA,{widget:Sk,Icon:kS,title:e(`error.open_elsewhere`),children:(0,B.jsx)(`p`,{children:e(`error.open_elsewhere_description`,{brand:`Element Call`})})})},KA=class extends WA{constructor(){super(`App opened in another tab`,(0,B.jsx)(GA,{}))}},qA=({className:e,children:t})=>{let{header:n}=KO();return(0,B.jsxs)(`div`,{className:(0,z.default)(Bk.page,e),children:[n===`standard`&&(0,B.jsxs)(Fk,{children:[(0,B.jsx)(Ik,{children:(0,B.jsx)(Rk,{})}),(0,B.jsx)(Lk,{})]}),(0,B.jsx)(`div`,{className:Bk.container,children:(0,B.jsx)(`div`,{className:Bk.content,children:t})})]})},JA=({error:e,widget:t})=>{let{t:n}=dS();return(0,R.useEffect)(()=>{I.error(e),Hd(e)},[e]),(0,B.jsx)(qA,{children:e instanceof WA?e.richMessage:(0,B.jsx)(UA,{widget:t,Icon:Hg,title:n(`error.generic`),rageshake:!0,fatal:!0,children:(0,B.jsx)(`p`,{children:n(`error.generic_description`)})})})},YA=()=>{let{t:e}=dS();return(0,B.jsx)(qA,{children:(0,B.jsx)(`h1`,{children:e(`common.loading`)})})};function XA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?XA(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XA(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ZA(e){return ZA=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},ZA(e)}function W(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function QA(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&QA(e.prototype,t),n&&QA(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $A(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ej(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||n.return==null||n.return()}finally{if(s)throw i}}return a}}(e,t)||nj(e,t)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
53
|
+
properties:`,l,`configuration:`,u),{...l,...c,...AO(u,e=>e!==void 0)}},KO=()=>{let{search:e,hash:t}=jo();return(0,R.useMemo)(()=>WO(e,t),[e,t])};function qO(e,t,n){let r=null;e=e.substring(1);let i=e.split(`/`),a=i[0]==`room`,o=i.length>1;n===``||n.startsWith(`#?`)?(o&&a&&(r=i[1]),a||(r=i[0])):r=n,r=r?.split(`?`)[0]??null,r&&(r.length<=1?r=null:(r.startsWith(`#`)||(r=`#${r}`),r.includes(`:`)||(r=`${r}:${FO.defaultServerName()}`)));let s=new HO(t,n),c=s.getParam(`roomId`);return c!==null&&(c=c.replaceAll(/^[^ -~]+|[^ -~]+$/g,``),c.startsWith(`!`)&&c.includes(``)||(c=null)),{roomAlias:r,roomId:c,viaServers:s.getAllParams(`viaServers`)}}var JO=()=>{let{pathname:e,search:t,hash:n}=jo();return(0,R.useMemo)(()=>qO(e,t,n),[e,t,n])};function YO(e,t,n){let r=new URLSearchParams;switch(t?.kind){case LO.SHARED_KEY:{let e=encodeURIComponent(t.secret);e!==t.secret&&I.info(`Encoded call password used non URL-safe chars: buggy client?`),r.set(`password`,e);break}case LO.PER_PARTICIPANT:r.set(`perParticipantE2EE`,`true`);break}return r.set(`roomId`,e),n?.forEach(e=>r.set(`viaServers`,e)),r}var XO=``+new URL(`cat-4r_NkDcK.ogg`,import.meta.url).href,ZO=``+new URL(`cat-Dd8bv_2W.mp3`,import.meta.url).href,QO=``+new URL(`clap-AxCMZLTd.ogg`,import.meta.url).href,$O=``+new URL(`clap-Dxm5qGyl.mp3`,import.meta.url).href,ek=``+new URL(`crickets-DUJdcuUa.ogg`,import.meta.url).href,tk=``+new URL(`crickets-CcwrRdbq.mp3`,import.meta.url).href,nk=``+new URL(`dog-CxIWtkNX.ogg`,import.meta.url).href,rk=``+new URL(`dog-BoQdnF-w.mp3`,import.meta.url).href,ik=``+new URL(`generic-BBbS3Wph.ogg`,import.meta.url).href,ak=``+new URL(`generic-BFeSb6fL.mp3`,import.meta.url).href,ok=``+new URL(`lightbulb-BIeJtAR_.ogg`,import.meta.url).href,sk=``+new URL(`lightbulb-BrnY00qi.mp3`,import.meta.url).href,ck=``+new URL(`party-D7rIOhAQ.ogg`,import.meta.url).href,lk=``+new URL(`party-BZPeTgC3.mp3`,import.meta.url).href,uk=``+new URL(`deer-DPSlVch4.ogg`,import.meta.url).href,dk=``+new URL(`deer-91r1Gyrx.mp3`,import.meta.url).href,fk=``+new URL(`rock-BVCJXNC-.ogg`,import.meta.url).href,pk=``+new URL(`rock-CHdnB31m.mp3`,import.meta.url).href,mk=``+new URL(`wave-FiiOzicp.ogg`,import.meta.url).href,hk=``+new URL(`wave-Bzf1LSMH.mp3`,import.meta.url).href,gk=``+new URL(`baduntss-Ca1ZuBEK.ogg`,import.meta.url).href,_k=``+new URL(`baduntss-DOe0oFuS.mp3`,import.meta.url).href,vk=`io.element.call.reaction`,yk={name:`generic`,emoji:``,sound:{mp3:ak,ogg:ik}},bk=[{emoji:`👍`,name:`thumbsup`,alias:[`+1`,`yes`,`thumbs up`]},{emoji:`🎉`,name:`party`,alias:[`hurray`,`success`],sound:{ogg:ck,mp3:lk}},{emoji:`👏`,name:`clapping`,alias:[`celebrate`,`success`],sound:{ogg:QO,mp3:$O}},{emoji:`🐶`,name:`dog`,alias:[`doggo`,`pupper`,`woofer`,`bark`],sound:{ogg:nk,mp3:rk}},{emoji:`🐱`,name:`cat`,alias:[`meow`,`kitty`],sound:{ogg:XO,mp3:ZO}},{emoji:`💡`,name:`lightbulb`,alias:[`bulb`,`light`,`idea`,`ping`],sound:{ogg:ok,mp3:sk}},{emoji:`🦗`,name:`crickets`,alias:[`awkward`,`silence`],sound:{ogg:ek,mp3:tk}},{emoji:`👎`,name:`thumbsdown`,alias:[`-1`,`no`,`thumbs no`]},{emoji:`😵💫`,name:`dizzy`,alias:[`dazed`,`confused`]},{emoji:`👌`,name:`ok`,alias:[`okay`,`cool`]},{emoji:`🥰`,name:`heart`,alias:[`heart`,`love`,`smiling`]},{emoji:`😄`,name:`laugh`,alias:[`giggle`,`joy`,`smiling`]},{emoji:`🦌`,name:`deer`,alias:[`stag`,`doe`,`bleat`],sound:{ogg:uk,mp3:dk}},{emoji:`🤘`,name:`rock`,alias:[`cool`,`horns`,`guitar`],sound:{ogg:fk,mp3:pk}},{emoji:`👋`,name:`wave`,alias:[`hand`,`waving`],sound:{ogg:mk,mp3:hk}},{emoji:`🥁`,name:`drum`,alias:[`joke`],sound:{ogg:gk,mp3:_k}}],xk=function(e){return e.JoinCall=`io.element.join`,e.HangupCall=`im.vector.hangup`,e.Close=`io.element.close`,e.DeviceMute=`io.element.device_mute`,e}({}),Sk,Ck=(e=`m.call`,t=!1)=>{try{let{widgetId:n,parentUrl:r,roomId:i,userId:a,deviceId:o,baseUrl:s,e2eEnabled:c,allowIceFallback:l}=WO();if(!i)throw Error(`Room ID must be supplied`);if(!a)throw Error(`User ID must be supplied`);if(!o)throw Error(`Device ID must be supplied`);if(!s)throw Error(`Base URL must be supplied`);if(n&&r){let u=new URL(r).origin;I.info(`Widget API is available`);let d=new Gr(n,u);d.requestCapability(Kr.AlwaysOnScreen),d.requestCapability(Kr.MSC4039DownloadFile);let f=new JS;[Fr.ThemeChange,xk.JoinCall,xk.HangupCall,xk.DeviceMute].forEach(e=>{d.on(`action:${e}`,t=>{t.preventDefault(),f.emit(e,t)})});let p=[j.CallNotify,j.RTCNotification];t&&p.push(j.RoomMessage);let m=[`org.matrix.rageshake_request`,j.CallEncryptionKeysPrefix,j.Reaction,j.RoomRedaction,vk,j.RTCDecline,j.RTCMembership],h=[a,`_${a}_${o}_${e}`,`${a}_${o}_${e}`].map(e=>({eventType:j.GroupCallMemberPrefix,stateKey:e})),g=[{eventType:j.RoomCreate},{eventType:j.RoomName},{eventType:j.RoomMember},{eventType:j.RoomEncryption},{eventType:j.GroupCallMemberPrefix}],_=[j.CallInvite,j.CallCandidates,j.CallAnswer,j.CallHangup,j.CallReject,j.CallSelectAnswer,j.CallNegotiate,j.CallSDPStreamMetadataChanged,j.CallSDPStreamMetadataChangedPrefix,j.CallReplaces,j.CallEncryptionKeysPrefix],v=Hi(d,{sendEvent:[...p,...m],receiveEvent:m,sendState:h,receiveState:g,sendToDevice:_,receiveToDevice:_,turnServers:!1,sendDelayedEvents:!0,updateDelayedEvents:!0,sendSticky:!0,receiveSticky:!0},i,{baseUrl:s,userId:a,deviceId:o,timelineSupport:!0,useE2eForGroupCall:c,fallbackICEServerAllowed:l},!1);Sk={api:d,lazyActions:f,client:(async()=>(await FO.init(),await v.startClient({clientWellKnownPollPeriod:600}),v))()}}else I.info(`No widget API available`),Sk=null}catch(e){I.warn(`Continuing without the widget API`,e),Sk=null}},wk=function(e){return e.XS=`xs`,e.SM=`sm`,e.MD=`md`,e.LG=`lg`,e.XL=`xl`,e}({}),Tk=new Map([[wk.XS,22],[wk.SM,32],[wk.MD,36],[wk.LG,42],[wk.XL,90]]);function Ek(e,t,n=96){let r=Math.floor(n*window.devicePixelRatio),i=Math.floor(n*window.devicePixelRatio),a=n<=96?`crop`:`scale`;return t?e.mxcUrlToHttp(t,r,i,a,!1,!0,!0):null}var Dk=({className:e,id:t,name:n,src:r,size:i=wk.MD,style:a,...o})=>{let s=dR(),c=(0,R.useMemo)(()=>Object.values(wk).includes(i)?Tk.get(i):i,[i]),[l,u]=(0,R.useState)(void 0);return(0,R.useEffect)(()=>{if(!r){u(void 0);return}let e;if(Sk?.api)e=kk(Sk.api,r);else if(s?.state===`valid`&&s.authenticated?.client&&c)e=Ok(s.authenticated.client,r,c);else{u(void 0);return}let t,n=!1;return e.then(e=>{n||(t=URL.createObjectURL(e),u(t))}).catch(e=>{n||u(void 0)}),()=>{n=!0,t&&URL.revokeObjectURL(t)}},[s,r,c]),(0,B.jsx)($g,{className:e,id:t,name:n,size:`${c}px`,src:l,style:a,...o})};async function Ok(e,t,n){let r=Ek(e,t,n);if(!r)throw Error(`Failed to get http avatar URL`);let i=e.getAccessToken();if(!i)throw Error(`Failed to get access token`);return await(await fetch(r,{headers:{Authorization:`Bearer ${i}`}})).blob()}async function kk(e,t){let n=(await e.downloadFile(t)).file;if(n instanceof Blob)return n;if(typeof n==`string`){let e=Uint8Array.from(atob(n),e=>e.charCodeAt(0));return new Blob([e])}throw Error(`Downloaded file format is not supported: `+typeof n)}var Ak={lock:`_lock_zf62g_8`},jk=({encrypted:e})=>{let{t}=dS(),n=e?yS:_S;return(0,B.jsx)(Mg,{label:t(e?`common.encrypted`:`common.unencrypted`),placement:`right`,isTriggerInteractive:!1,children:(0,B.jsx)(n,{width:16,height:16,className:Ak.lock,"data-encrypted":e})})};function Mk(e){let t=(0,R.useMemo)(()=>window.matchMedia(e),[e]);return(0,R.useSyncExternalStore)((0,R.useCallback)(e=>(t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)),[t]),(0,R.useCallback)(()=>t.matches,[t]))}var Nk={banner:`_banner_sye6n_8`},Pk=({children:e,className:t,...n})=>{let{t:r}=dS(),i=dR(),a=!1;return i?.state===`valid`&&(a=i.disconnected),(0,B.jsx)(B.Fragment,{children:a&&(0,B.jsxs)(`div`,{className:(0,z.default)(Nk.banner,t),...n,children:[e,r(`disconnected_banner`)]})})},Fk=({ref:e,children:t,className:n,disconnectedBanner:r=!0,...i})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`header`,{ref:e,className:(0,z.default)(KS.header,n),...i,children:t}),r&&(0,B.jsx)(Pk,{})]});Fk.displayName=`Header`;var Ik=({children:e,className:t,hideMobile:n,...r})=>(0,B.jsx)(`div`,{className:(0,z.default)(KS.nav,KS.leftNav,{[KS.hideMobile]:n},t),...r,children:e}),Lk=({children:e,className:t,hideMobile:n,...r})=>(0,B.jsx)(`div`,{className:(0,z.default)(KS.nav,KS.rightNav,{[KS.hideMobile]:n},t),...r,children:e}),Rk=({className:e})=>{let{t}=dS();return(0,B.jsx)(Qs,{className:(0,z.default)(KS.headerLogo,e),to:`/`,"aria-label":t(`header_label`),children:(0,B.jsx)(qS,{})})},zk=({id:e,name:t,avatarUrl:n,encrypted:r,participantCount:i})=>{let{t:a}=dS(),o=Mk(`(max-width: 550px)`)?`sm`:`lg`;return(0,B.jsxs)(`div`,{className:KS.roomHeaderInfo,"data-size":o,children:[(0,B.jsx)(Dk,{className:KS.roomAvatar,id:e,name:t,size:o===`sm`?wk.SM:56,src:n??void 0}),(0,B.jsxs)(`div`,{className:KS.nameLine,children:[(0,B.jsx)(bx,{type:o===`sm`?`body`:`heading`,size:o===`sm`?`lg`:`md`,weight:`semibold`,"data-testid":`roomHeader_roomName`,children:t}),(0,B.jsx)(jk,{encrypted:r})]}),(i??0)>0&&(0,B.jsxs)(`div`,{className:KS.participantsLine,children:[(0,B.jsx)(LS,{width:20,height:20,"aria-label":a(`header_participants_label`)}),(0,B.jsx)(nf,{as:`span`,size:`sm`,weight:`medium`,"data-testid":`roomHeader_participants_count`,children:a(`participant_count`,{count:i??0})})]})]})},Bk={page:`_page_fvtgn_8`,header:`_header_fvtgn_16`,container:`_container_fvtgn_20`,content:`_content_fvtgn_28`,wideButton:`_wideButton_fvtgn_47`,sendLogsSection:`_sendLogsSection_fvtgn_52`},Vk={rageshakeControl:`_rageshakeControl_65ekp_8`},Hk=1024*1024*5,Uk=2*1e3,Wk=3,Gk=function(e){return e.Log=`log`,e}(Gk||{}),Kk=class extends Or.default{constructor(...e){super(...e),this.logs=``,this.log=(e,...t)=>{let n=new Date().toISOString();t=t.map(e=>{if(e instanceof DOMException)return e.message+` (${e.name} | ${e.code})`;if(e instanceof Error)return e.message+(e.stack?`\n${e.stack}`:``);if(typeof e==`object`)try{return JSON.stringify(e,Qk())}catch{return`<$ failed to serialize object $>`}else return e});let r=`${n} ${e} ${t.join(` `)}\n`;r=r.replace(/token=[a-zA-Z0-9-]+/gm,`token=xxxxx`),this.logs+=r,this.emit(Gk.Log)}}popLogs(){let e=this.logs;return this.logs=``,e}peekLogs(){return this.logs}},qk=class{constructor(e,t){this.indexedDB=e,this.loggerInstance=t,this.index=0,this.onLoggerLog=()=>{this.db&&this.throttledFlush()},this.throttledFlush=MO(()=>this.flush,Uk,{leading:!1,trailing:!0}),this.flush=async()=>this.flushPromise?(this.flushAgainPromise||=this.flushPromise.then(this.flush).then(()=>{this.flushAgainPromise=void 0}),this.flushAgainPromise):(this.flushPromise=new Promise((e,t)=>{if(!this.db){t(Error(`No connected database`));return}let n=this.loggerInstance.popLogs();if(n.length===0){e();return}let r=this.db.transaction([`logs`,`logslastmod`],`readwrite`),i=r.objectStore(`logs`);r.oncomplete=()=>{e()},r.onerror=e=>{I.error(`Failed to flush logs : `,e),t(Error(`Failed to write logs: `+r?.error?.message))},i.add(this.generateLogEntry(n)),r.objectStore(`logslastmod`).put(this.generateLastModifiedTime())}).then(()=>{this.flushPromise=void 0}),this.flushPromise),this.id=`instance-`+Ct(16),t.on(Gk.Log,this.onLoggerLog),window.addEventListener(`beforeunload`,()=>{this.flush().catch(e=>I.error(`Failed to flush logs before unload`,e))})}async connect(){let e=this.indexedDB.open(`logs`);return new Promise((t,n)=>{e.onsuccess=()=>{this.db=e.result,t()},e.onerror=()=>{let t=`Failed to open log database: `+e?.error?.name;I.error(t),n(Error(t))},e.onupgradeneeded=()=>{let t=e.result,n=t.createObjectStore(`logs`,{keyPath:[`id`,`index`]});n.createIndex(`id`,`id`,{unique:!1}),n.add(this.generateLogEntry(new Date+` ::: Log database was created.`)),t.createObjectStore(`logslastmod`,{keyPath:`id`}).add(this.generateLastModifiedTime())}})}async consume(){let e=this.db;if(!e)return Promise.reject(Error(`No connected database`));async function t(t,n){let r=e.transaction(`logs`,`readonly`).objectStore(`logs`);return new Promise((e,i)=>{let a=r.index(`id`).openCursor(IDBKeyRange.only(t),`prev`),o=``;a.onerror=()=>{i(Error(`Query failed: `+a?.error?.message))},a.onsuccess=()=>{let t=a.result;if(!t){e(o);return}o=t.value.lines+o,o.length>=n?e(o):t.continue()}})}async function n(){return Jk(e.transaction(`logslastmod`,`readonly`).objectStore(`logslastmod`),void 0,e=>({id:e.value.id,ts:e.value.ts})).then(e=>e.sort((e,t)=>t.ts-e.ts).map(e=>e.id))}async function r(t){return new Promise((n,r)=>{let i=e.transaction([`logs`,`logslastmod`],`readwrite`),a=i.objectStore(`logs`),o=a.index(`id`).openKeyCursor(IDBKeyRange.only(t));o.onsuccess=()=>{let e=o.result;e&&(a.delete(e.primaryKey),e.continue())},i.oncomplete=()=>{n()},i.onerror=()=>{r(Error(`Failed to delete logs for '${t}' : ${i?.error?.message}`))},i.objectStore(`logslastmod`).delete(t)})}let i=await n(),a=[],o=[],s=0;for(let e=0;e<i.length;e++){let n=await t(i[e],Hk-s);if(o.push({lines:n,id:i[e]}),s+=n.length,s>=Hk){a=i.slice(e+1).map(e=>parseInt(e,10));break}}return a.length>0&&(I.log(`Removing logs: `,a),Promise.all(a.map(async e=>r(e))).then(()=>{I.log(`Removed ${a.length} old logs.`)},e=>{I.error(e)})),o}generateLogEntry(e){return{id:this.id,lines:e,index:this.index++}}generateLastModifiedTime(){return{id:this.id,ts:Date.now()}}};async function Jk(e,t,n){let r=e.openCursor(t);return new Promise((e,t)=>{let i=[];r.onerror=()=>{t(Error(`Query failed: `+r?.error?.message))},r.onsuccess=()=>{let t=r.result;if(!t){e(i);return}i.push(n(t)),t.continue()}})}async function Yk(){return n.mx_rage_logger=new Kk,eA(I,n.mx_rage_logger.log),[`trace`,`debug`,`info`,`warn`,`error`].forEach(e=>{let t=window.console[e];if(!t)return;let r=`${e.toUpperCase()} matrix_sdk`;window.console[e]=(...i)=>{t(...i),typeof i[0]==`string`&&i[0].startsWith(r)&&n.mx_rage_logger.log($k[e],`matrix_sdk`,...i)}}),Xk()}async function Xk(){if(n.mx_rage_initStoragePromise)return n.mx_rage_initStoragePromise;I.log(`Configuring rageshake persistence...`);let e;try{e=window.indexedDB}catch(e){I.warn(`Could not get indexDB from window.`,e)}return e?(n.mx_rage_store=new qk(e,n.mx_rage_logger),n.mx_rage_initStoragePromise=n.mx_rage_store.connect(),n.mx_rage_initStoragePromise):(n.mx_rage_initStoragePromise=Promise.resolve(),n.mx_rage_initStoragePromise)}async function Zk(){if(!n.mx_rage_logger)throw Error(`No console logger, did you forget to call init()?`);return n.mx_rage_store?(await n.mx_rage_store.flush(),n.mx_rage_store.consume()):[{lines:n.mx_rage_logger.peekLogs(),id:`-`}]}var Qk=()=>{let e=new WeakSet,t=new WeakMap;return function(n,r){if(typeof r==`object`&&r){if(e.has(r))return`<$ cycle-trimmed $>`;e.add(r);let n=0;if(this&&(n=t.get(this)??0),t.set(r,n+1),n>Wk)return`<$ object-pruned $>`}return r}},$k=function(e){return e[e.trace=0]=`trace`,e[e.debug=1]=`debug`,e[e.info=2]=`info`,e[e.warn=3]=`warn`,e[e.error=4]=`error`,e[e.silent=5]=`silent`,e}($k||{});function eA(e,t){let n=e,r=n.methodFactory;n.methodFactory=function(e,n,i){let a=r(e,n,i),o=$k[e],s=o>=n&&o<$k.silent;return(...e)=>{a.apply(this,e),s&&t(o,i?.toString(),...e)}},n.setLevel(n.getLevel())}var tA=async e=>{let{gzip:t}=await se(async()=>{let{gzip:e}=await import(`./pako.esm-UZ0EWzai.js`);return{gzip:e}},__vite__mapDeps([0,1]),import.meta.url),n=new TextEncoder().encode(e);return new Blob([t(n)])};async function nA(e,t){t.append(`crypto_version`,e.getVersion());let n=await e.getOwnDeviceKeys(),r=[`curve25519:${n.curve25519}`,`ed25519:${n.ed25519}`];t.append(`device_keys`,r.join(`, `));let i=await e.getCrossSigningStatus();t.append(`cross_signing_ready`,String(await e.isCrossSigningReady())),t.append(`cross_signing_key`,await e.getCrossSigningKeyId()??`n/a`),t.append(`cross_signing_privkey_in_secret_storage`,String(i.privateKeysInSecretStorage)),t.append(`cross_signing_master_privkey_cached`,String(i.privateKeysCachedLocally.masterKey)),t.append(`cross_signing_self_signing_privkey_cached`,String(i.privateKeysCachedLocally.selfSigningKey)),t.append(`cross_signing_user_signing_privkey_cached`,String(i.privateKeysCachedLocally.userSigningKey))}async function rA(e,t,n){let r=e.secretStorage;n.append(`secret_storage_ready`,String(await t.isSecretStorageReady())),n.append(`secret_storage_key_in_account`,String(await r.hasKey())),n.append(`session_backup_key_in_secret_storage`,String(!!await e.isKeyBackupKeyStored()));let i=await t.getSessionBackupPrivateKey();n.append(`session_backup_key_cached`,String(!!i)),n.append(`session_backup_key_well_formed`,String(i instanceof Uint8Array))}function iA(){return WO().rageshakeSubmitUrl??void 0}function aA(e=iA){let{client:t}=fR(),[{sending:n,sent:r,error:i},a]=(0,R.useState)({sending:!1,sent:!1,error:void 0});return{submitRageshake:(0,R.useCallback)(async r=>{let i=e();if(!i)throw Error(`No rageshake URL is configured`);if(!n)try{a({sending:!0,sent:!1,error:void 0});let e=`UNKNOWN`;window.navigator&&window.navigator.userAgent&&(e=window.navigator.userAgent);let n=`UNKNOWN`;try{n=String(window.matchMedia(`(pointer: coarse)`).matches)}catch(e){I.warn(`Could not get coarse pointer for rageshake submit.`,e)}let o=r.rageshakeRequestId?`Rageshake ${r.rageshakeRequestId}`:``;r.description&&(o+=`: ${r.description}`);let s=new FormData;if(s.append(`text`,o??`User did not supply any additional text.`),s.append(`app`,`matrix-video-chat`),s.append(`version`,`embedded-v0.19.2`),s.append(`user_agent`,e),s.append(`installed_pwa`,`false`),s.append(`touch_input`,n),s.append(`call_backend`,`livekit`),s.append(`hostname`,window.location.hostname),t){let e=t.getUserId(),n=t.getUser(e);s.append(`display_name`,n?.displayName??``),s.append(`user_id`,t.credentials.userId??``),s.append(`device_id`,t.deviceId??``),r.roomId&&s.append(`room_id`,r.roomId);let i=t.getCrypto();i&&(await nA(i,s),await rA(t,i,s))}if(r.label&&s.append(`label`,r.label),navigator.storage&&navigator.storage.persisted)try{s.append(`storageManager_persisted`,String(await navigator.storage.persisted()))}catch(e){I.warn(`coulr not get navigator peristed storage`,e)}else if(document.hasStorageAccess)try{s.append(`storageManager_persisted`,String(await document.hasStorageAccess()))}catch(e){I.warn(`could not get storage access`,e)}if(navigator.storage&&navigator.storage.estimate)try{let e=await navigator.storage.estimate();s.append(`storageManager_quota`,String(e.quota)),s.append(`storageManager_usage`,String(e.usage)),e.usageDetails&&Object.keys(e.usageDetails).forEach(t=>{s.append(`storageManager_usage_${t}`,String(e.usageDetails[t]))})}catch(e){I.warn(`could not obatain storage estimate`,e)}if(r.sendLogs){let e=await Zk();for(let t of e)s.append(`compressed-log`,await tA(t.lines),t.id)}r.rageshakeRequestId&&s.append(`group_call_rageshake_request_id`,r.rageshakeRequestId);let c=await fetch(i,{method:`POST`,body:s});if(c.status!==200)throw Error(`Failed to submit feedback: receive HTTP ${c.status} ${c.statusText}`);a({sending:!1,sent:!0,error:void 0})}catch(e){a({sending:!1,sent:!1,error:e}),I.error(e)}},[t,n,e]),sending:n,sent:r,error:i,available:!!e()}}function oA(){let{client:e}=fR();return(0,R.useCallback)((t,n)=>{e.sendEvent(t,`org.matrix.rageshake_request`,{request_id:n}).catch(e=>{I.error(`Failed to send org.matrix.rageshake_request event`,e)})},[e])}function sA(e){let[t,n]=(0,R.useState)(!1),r=(0,R.useCallback)(()=>n(!1),[n]),{client:i}=fR(),[a,o]=(0,R.useState)();return(0,R.useEffect)(()=>{if(!i)return;let t=t=>{t.getType()===`org.matrix.rageshake_request`&&e===t.getRoomId()&&i.getUserId()!==t.getSender()&&(o(t.getContent().request_id),n(!0))};return i.on(cr.Event,t),()=>{i.removeListener(cr.Event,t)}},[n,e,i]),{rageshakeRequestId:a??``,roomId:e,open:t,onDismiss:r}}var cA=({description:e})=>{let{submitRageshake:t,sending:n,sent:r,error:i}=aA(),{t:a}=dS(),o=(0,R.useCallback)(()=>{t({description:e,sendLogs:!0}).catch(e=>{I.error(`Failed to send rageshake`,e)})},[t,e]);if(!FO.get().rageshake?.submit_url)return null;let s=null;if(n)s=(0,B.jsx)(`span`,{children:a(`rageshake_sending`)});else if(r)s=(0,B.jsx)(`div`,{children:a(`rageshake_sent`)});else{let e=a(`rageshake_send_logs`);i&&(e=a(`rageshake_button_error_caption`)),s=(0,B.jsx)(of,{onClick:o,className:Vk.wideButton,disabled:n,children:e})}return(0,B.jsx)(`div`,{className:Vk.rageshakeControl,children:s})},lA={error:`_error_17zfc_1`,icon:`_icon_17zfc_9`},uA={endCall:`_endCall_bwclo_8`},dA={footer:`_footer_17bu0_8`,hidden:`_hidden_17bu0_25`,overlay:`_overlay_17bu0_29`,settingsLogoContainer:`_settingsLogoContainer_17bu0_52`,logo:`_logo_17bu0_60`,buttons:`_buttons_17bu0_68`,layout:`_layout_17bu0_75`,settingsOnlyShowNarrow:`_settingsOnlyShowNarrow_17bu0_87`,settingsOnlyShowWide:`_settingsOnlyShowWide_17bu0_90`,shareScreen:`_shareScreen_17bu0_132`,raiseHand:`_raiseHand_17bu0_149`},fA=({enabled:e,...t})=>{let{t:n}=dS(),r=e?CS:xS;return(0,B.jsx)(Mg,{label:n(e?`mute_microphone_button_label`:`unmute_microphone_button_label`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:r,kind:e?`primary`:`secondary`,role:`switch`,"aria-checked":e,...t})})},pA=({enabled:e,...t})=>{let{t:n}=dS(),r=e?VS:zS;return(0,B.jsx)(Mg,{label:n(e?`stop_video_button_label`:`start_video_button_label`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:r,kind:e?`primary`:`secondary`,role:`switch`,"aria-checked":e,...t})})},mA=({enabled:e,...t})=>{let{t:n}=dS();return(0,B.jsx)(Mg,{label:n(e?`stop_screenshare_button_label`:`screenshare_button_label`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:FS,kind:e?`primary`:`secondary`,role:`switch`,"aria-checked":e,...t})})},hA=({className:e,...t})=>{let{t:n}=dS();return(0,B.jsx)(Mg,{label:n(`hangup_button_label`),children:(0,B.jsx)(of,{className:(0,z.default)(e,uA.endCall),iconOnly:!0,Icon:hS,destructive:!0,...t})})},gA=({loudspeakerModeEnabled:e,...t})=>{let{t:n}=dS();return(0,B.jsx)(Mg,{label:n(e?`settings.devices.loudspeaker`:`settings.devices.handset`),children:(0,B.jsx)(of,{iconOnly:!0,Icon:e?GS:US,...t,kind:e?`primary`:`secondary`,"aria-checked":e})})};function _A(e,t){return(0,z.default)(e,{[dA.settingsOnlyShowWide]:t===`wide`,[dA.settingsOnlyShowNarrow]:t===`narrow`})}var vA=({showForScreenWidth:e,className:t,...n})=>{let{t:r}=dS(),i=RO===`android`?DS:TS;return(0,B.jsx)(Mg,{label:r(`common.settings`),children:(0,B.jsx)(Lg,{className:_A(t,e),...n,children:(0,B.jsx)(i,{"aria-hidden":!0})})})},yA=({showForScreenWidth:e,className:t,...n})=>{let{t:r}=dS();return(0,B.jsx)(Mg,{label:r(`common.settings`),children:(0,B.jsx)(of,{className:_A(t,e),iconOnly:!0,Icon:RO===`android`?DS:TS,kind:`secondary`,...n})})},bA={external:`_external_jhjdf_8`};function xA(e,t){return[ko(e),ac(e,{state:t})]}var SA=({ref:e,to:t,state:n,...r})=>{let[i,a]=xA(t,n);return(0,B.jsx)(wx,{ref:e,...r,href:i,onClick:a})},CA=({ref:e,className:t,children:n,...r})=>(0,B.jsx)(`a`,{ref:e,className:(0,z.default)(t,bA.external),target:`_blank`,rel:`noreferrer noopener`,...r,children:n}),wA=({ref:e,to:t,state:n,...r})=>{let[i,a]=xA(t,n);return(0,B.jsx)(of,{as:`a`,ref:e,...r,href:i,onClick:a})};function TA(e,t,n,r){(0,R.useEffect)(()=>{if(e)return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)},[e,t,n,r])}function EA(e,t,n){(0,R.useEffect)(()=>(e.on(t,n),()=>{e.off(t,n)}),[e,t,n])}function DA(e,t,n){return(0,R.useSyncExternalStore)((0,R.useCallback)(n=>(e.on(t,n),()=>{e.off(t,n)}),[e,t]),n)}function OA(e){return DA(e,Zn.MembershipsChanged,(0,R.useCallback)(()=>e.memberships,[e]))}function kA(e){return(0,R.useSyncExternalStore)((0,R.useCallback)(t=>{let n=e.subscribe(t);return()=>n.unsubscribe()},[e]),(0,R.useCallback)(()=>e.value,[e]))}var AA=(0,R.createContext)(void 0),jA=()=>{let e=(0,R.use)(AA);if(!e)throw Error(`useReactions must be used within a ReactionsProvider`);return e},MA=({children:e,rtcSession:t,vm:n})=>{let r=OA(t),i=dR(),a=i?.state===`valid`&&i.supportedFeatures.reactions,o=t.room,s=o.client.getUserId(),c=o.client.getDeviceId(),l=`${s}:${c}`,u=(0,R.useMemo)(()=>r.find(e=>e.userId===s&&e.deviceId===c)?.eventId,[r,s,c]),d=kA(n.reactions$),f=(0,R.useMemo)(()=>l===void 0?void 0:d[l],[l,d]),p=kA(n.handsRaised$),m=(0,R.useMemo)(()=>l===void 0?void 0:p[l],[l,p]);return(0,B.jsx)(AA,{value:{supportsReactions:a,toggleRaisedHand:(0,R.useCallback)(async()=>{if(!l)return;let e=m?.reactionEventId;if(e)try{await o.client.redactEvent(t.room.roomId,e),I.debug(`Redacted raise hand event`)}catch(t){throw I.error(`Failed to redact reaction event`,e,t),t}else try{if(!u)throw Error(`Cannot find own membership event`);let e=await o.client.sendEvent(t.room.roomId,j.Reaction,{"m.relates_to":{rel_type:it.Annotation,event_id:u,key:`🖐️`}});I.debug(`Sent raise hand event`,e.event_id)}catch(e){I.error(`Failed to send raised hand`,e)}},[u,l,m,t,o]),sendReaction:(0,R.useCallback)(async e=>{if(!(!l||f)){if(!u)throw Error(`Cannot find own membership event`);await o.client.sendEvent(t.room.roomId,vk,{"m.relates_to":{rel_type:it.Reference,event_id:u},emoji:e.emoji,name:e.name})}},[u,f,o,l,t])},children:e})},NA={raisedButton:`_raisedButton_unw54_1`,reactionPopupMenu:`_reactionPopupMenu_unw54_5`,reactionPopupMenuRoot:`_reactionPopupMenuRoot_unw54_21`,reactionPopupMenuModal:`_reactionPopupMenuModal_unw54_21`,reactionsMenuSection:`_reactionsMenuSection_unw54_47`,reactionsMenu:`_reactionsMenu_unw54_47`,reactionButton:`_reactionButton_unw54_81`,verticalSeperator:`_verticalSeperator_unw54_91`,alert:`_alert_unw54_99`,"grow-in":`_grow-in_unw54_1`},PA=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),FA=`VisuallyHidden`,IA=R.forwardRef((e,t)=>(0,B.jsx)(Ix.span,{...e,ref:t,style:{...PA,...e.style}}));IA.displayName=FA;var LA={modal:`_modal_lmgdq_8`,dialog:`_dialog_lmgdq_14`,content:`_content_lmgdq_21`,drawer:`_drawer_lmgdq_32`,close:`_close_lmgdq_59`,header:`_header_lmgdq_84`,body:`_body_lmgdq_114`,tabbed:`_tabbed_lmgdq_129`,handle:`_handle_lmgdq_133`},RA={bg:`_bg_180k3_8`,animate:`_animate_180k3_23`,"fade-in":`_fade-in_180k3_1`,"fade-out":`_fade-out_180k3_1`,overlay:`_overlay_180k3_42`,"zoom-in":`_zoom-in_180k3_1`,"zoom-out":`_zoom-out_180k3_1`},zA=({title:e,hideHeader:t,children:n,className:r,classNameDrawer:i,classNameModal:a,open:o,onDismiss:s,tabbed:c,...l})=>{let{t:u}=dS(),d=Mk(`(hover: none) or (pointer: coarse)`),f=(0,R.useCallback)(e=>{e||s?.()},[s]);if(d)return(0,B.jsx)(_x.Root,{open:o,onOpenChange:f,dismissible:s!==void 0,children:(0,B.jsxs)(_x.Portal,{children:[(0,B.jsx)(_x.Overlay,{className:(0,z.default)(RA.bg)}),(0,B.jsx)(_x.Content,{className:(0,z.default)(r,i,RA.overlay,LA.modal,LA.drawer,{[LA.tabbed]:c}),role:`dialog`,"aria-describedby":void 0,...l,children:(0,B.jsxs)(`div`,{className:LA.content,children:[(0,B.jsxs)(`div`,{className:LA.header,children:[(0,B.jsx)(`div`,{className:LA.handle}),(0,B.jsx)(IA,{asChild:!0,children:(0,B.jsx)(_x.Title,{children:e})})]}),(0,B.jsx)(`div`,{className:LA.body,children:n})]})})]})});{let i=(0,B.jsx)(ub,{asChild:!0,children:(0,B.jsx)(bx,{as:`h2`,weight:`semibold`,size:`md`,children:e})}),d=(0,B.jsxs)(`div`,{className:LA.header,children:[i,s!==void 0&&(0,B.jsx)(fb,{className:LA.close,"data-testid":`modal_close`,"aria-label":u(`action.close`),children:(0,B.jsx)(Kg,{width:20,height:20})})]});return(0,B.jsx)(ab,{open:o,onOpenChange:f,children:(0,B.jsxs)(sb,{children:[(0,B.jsx)(cb,{className:(0,z.default)(RA.bg,RA.animate)}),(0,B.jsx)(lb,{asChild:!0,"aria-describedby":void 0,role:`dialog`,...l,children:(0,B.jsx)(yx,{className:(0,z.default)(r,a,RA.overlay,RA.animate,LA.modal,LA.dialog,{[LA.tabbed]:c}),children:(0,B.jsxs)(`div`,{className:LA.content,children:[t?null:d,t?(0,B.jsx)(IA,{asChild:!0,children:i}):null,(0,B.jsx)(`div`,{className:LA.body,children:n})]})})})]})})}},BA=({raised:e,open:t,...n})=>{let{t:r}=dS();return(0,B.jsx)(Mg,{label:r(`common.reactions`),children:(0,B.jsx)(of,{className:(0,z.default)(e&&NA.raisedButton),"aria-expanded":t,"aria-haspopup":!0,kind:e||t?`primary`:`secondary`,iconOnly:!0,Icon:e?jS:NS,...n})})};function VA({sendReaction:e,toggleRaisedHand:t,isHandRaised:n,canReact:r,errorText:i}){let{t:a}=dS(),[o,s]=(0,R.useState)(!1),c=(0,R.useMemo)(()=>o?bk:bk.slice(0,5),[o]),l=a(n?`action.lower_hand`:`action.raise_hand`);return(0,B.jsxs)(B.Fragment,{children:[i&&(0,B.jsx)(qg,{className:NA.alert,type:`critical`,title:a(`error.generic`),children:i}),(0,B.jsxs)(`div`,{className:NA.reactionPopupMenu,children:[(0,B.jsx)(`section`,{className:NA.handRaiseSection,children:(0,B.jsx)(Mg,{label:l,caption:`H`,children:(0,B.jsx)(of,{kind:n?`primary`:`secondary`,"aria-keyshortcuts":`H`,"aria-pressed":n,"aria-label":l,onClick:()=>t(),iconOnly:!0,Icon:jS})})}),(0,B.jsx)(`div`,{className:NA.verticalSeperator}),(0,B.jsx)(`section`,{className:NA.reactionsMenuSection,children:(0,B.jsx)(`menu`,{className:(0,z.default)(o&&NA.reactionsMenuExpanded,NA.reactionsMenu),children:c.map((t,n)=>(0,B.jsx)(`li`,{children:(0,B.jsx)(Mg,{label:t.name,caption:n<5?(n+1).toString():void 0,children:(0,B.jsx)(of,{kind:`secondary`,className:NA.reactionButton,disabled:!r,onClick:()=>e(t),"aria-keyshortcuts":n<5?(n+1).toString():void 0,children:t.emoji})})},t.name))})}),(0,B.jsx)(`section`,{style:{marginLeft:`var(--cpd-separator-spacing)`},children:(0,B.jsx)(Mg,{label:a(o?`action.show_less`:`action.show_more`),children:(0,B.jsx)(of,{iconOnly:!0,"aria-label":a(o?`action.show_less`:`action.show_more`),Icon:o?pS:Rx,kind:`tertiary`,onClick:()=>s(!o)})})})]})]})}function HA({identifier:e,reactionData:{handsRaised$:t,reactions$:n},...r}){let{t:i}=dS(),{toggleRaisedHand:a,sendReaction:o}=jA(),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(!1),[d,f]=(0,R.useState)(),p=!!kA(t)[e],m=!kA(n)[e];(0,R.useEffect)(()=>{f(void 0)},[l]);let h=(0,R.useCallback)(async e=>{try{c(!0),await o(e),f(void 0),u(!1)}catch(e){f(e instanceof Error?e.message:`Unknown error`),I.error(`Failed to send reaction`,e)}finally{c(!1)}},[o]),g=(0,R.useCallback)(()=>{(async()=>{try{c(!0),await a(),u(!1)}catch(e){f(e instanceof Error?e.message:`Unknown error`),I.error(`Failed to raise/lower hand`,e)}finally{c(!1)}})()},[a]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(BA,{disabled:s,onClick:()=>u(e=>!e),raised:!!p,open:l,...r}),(0,B.jsx)(zA,{open:l,title:i(`action.pick_reaction`),hideHeader:!0,classNameModal:NA.reactionPopupMenuModal,className:NA.reactionPopupMenuRoot,onDismiss:()=>u(!1),children:(0,B.jsx)(VA,{errorText:d,isHandRaised:!!p,canReact:!s&&!!m,sendReaction:e=>void h(e),toggleRaisedHand:g})})]})}var UA=({Icon:e,title:t,rageshake:n,fatal:r,children:i,widget:a})=>{let{t:o}=dS(),{confineToRoom:s}=KO(),c=(0,R.useCallback)(()=>{window.location.href=`/`},[]);return(0,B.jsxs)(`div`,{className:lA.error,children:[(0,B.jsx)(Sx,{className:lA.icon,children:(0,B.jsx)(e,{"aria-hidden":!0})}),(0,B.jsx)(bx,{as:`h1`,weight:`semibold`,size:`md`,children:t}),i,n&&(0,B.jsx)(cA,{description:`***Error View***: ${t}`}),a?(0,B.jsx)(({widget:e})=>(0,B.jsx)(of,{kind:`primary`,onClick:()=>{e.api.transport.send(xk.Close,{}).catch(e=>{I.error(`Failed to send close action`,e)}).finally(()=>{e.api.transport.stop()})},children:o(`action.close`)}),{widget:a}):!s&&(0,B.jsx)(()=>r||location.pathname===`/`?(0,B.jsx)(of,{kind:`tertiary`,className:lA.homeLink,onClick:c,children:o(`return_home_button`)}):(0,B.jsx)(wA,{kind:`tertiary`,className:lA.homeLink,to:`/`,children:o(`return_home_button`)}),{})]})},WA=class extends Error{constructor(e,t){super(e),this.richMessage=t}},GA=()=>{let{t:e}=dS();return(0,B.jsx)(UA,{widget:Sk,Icon:kS,title:e(`error.open_elsewhere`),children:(0,B.jsx)(`p`,{children:e(`error.open_elsewhere_description`,{brand:`Element Call`})})})},KA=class extends WA{constructor(){super(`App opened in another tab`,(0,B.jsx)(GA,{}))}},qA=({className:e,children:t})=>{let{header:n}=KO();return(0,B.jsxs)(`div`,{className:(0,z.default)(Bk.page,e),children:[n===`standard`&&(0,B.jsxs)(Fk,{children:[(0,B.jsx)(Ik,{children:(0,B.jsx)(Rk,{})}),(0,B.jsx)(Lk,{})]}),(0,B.jsx)(`div`,{className:Bk.container,children:(0,B.jsx)(`div`,{className:Bk.content,children:t})})]})},JA=({error:e,widget:t})=>{let{t:n}=dS();return(0,R.useEffect)(()=>{I.error(e),Hd(e)},[e]),(0,B.jsx)(qA,{children:e instanceof WA?e.richMessage:(0,B.jsx)(UA,{widget:t,Icon:Hg,title:n(`error.generic`),rageshake:!0,fatal:!0,children:(0,B.jsx)(`p`,{children:n(`error.generic_description`)})})})},YA=()=>{let{t:e}=dS();return(0,B.jsx)(qA,{children:(0,B.jsx)(`h1`,{children:e(`common.loading`)})})};function XA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?XA(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XA(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ZA(e){return ZA=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},ZA(e)}function W(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function QA(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&QA(e.prototype,t),n&&QA(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $A(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ej(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||n.return==null||n.return()}finally{if(s)throw i}}return a}}(e,t)||nj(e,t)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
54
54
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function tj(e){return function(e){if(Array.isArray(e))return rj(e)}(e)||function(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}(e)||nj(e)||function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
55
55
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function nj(e,t){if(e){if(typeof e==`string`)return rj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rj(e,t):void 0}}function rj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ij(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=nj(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
56
56
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}var aj={DEBUG:!1,LIB_VERSION:`1.160.3`},oj=Array.isArray,sj=Object.prototype,cj=sj.hasOwnProperty,lj=sj.toString,uj=oj||function(e){return lj.call(e)===`[object Array]`},dj=function(e){return typeof e==`function`},fj=function(e){return e===Object(e)&&!uj(e)},pj=function(e){if(fj(e)){for(var t in e)if(cj.call(e,t))return!1;return!0}return!1},q=function(e){return e===void 0},mj=function(e){return lj.call(e)==`[object String]`},hj=function(e){return mj(e)&&e.trim().length===0},gj=function(e){return e===null},_j=function(e){return q(e)||gj(e)},vj=function(e){return lj.call(e)==`[object Number]`},yj=function(e){return lj.call(e)===`[object Boolean]`},bj=function(e){return e instanceof FormData},J=typeof window<`u`?window:void 0,xj=typeof globalThis<`u`?globalThis:J,Sj=Array.prototype,Cj=Sj.forEach,wj=Sj.indexOf,Tj=xj?.navigator,Y=xj?.document,Ej=xj?.location,Dj=xj?.fetch,Oj=xj!=null&&xj.XMLHttpRequest&&`withCredentials`in new xj.XMLHttpRequest?xj.XMLHttpRequest:void 0,kj=xj?.AbortController,Aj=Tj?.userAgent,jj=J??{},Mj=`[PostHog.js]`,X={_log:function(e){if(J&&(aj.DEBUG||jj.POSTHOG_DEBUG)&&!q(J.console)&&J.console){for(var t=(`__rrweb_original__`in J.console[e])?J.console[e].__rrweb_original__:J.console[e],n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];t.apply(void 0,[Mj].concat(r))}},info:function(){var e=[...arguments];X._log.apply(X,[`log`].concat(e))},warn:function(){var e=[...arguments];X._log.apply(X,[`warn`].concat(e))},error:function(){var e=[...arguments];X._log.apply(X,[`error`].concat(e))},critical:function(){for(var e,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[Mj].concat(n))},uninitializedWarning:function(e){X.error(`You must initialize PostHog before calling ${e}`)}},Nj={},Pj=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``)};function Fj(e,t,n){if(uj(e)){if(Cj&&e.forEach===Cj)e.forEach(t,n);else if(`length`in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===Nj)return}}}function Z(e,t,n){if(!_j(e)){if(uj(e))return Fj(e,t,n);if(bj(e)){var r,i=ij(e.entries());try{for(i.s();!(r=i.n()).done;){var a=r.value;if(t.call(n,a[1],a[0])===Nj)return}}catch(e){i.e(e)}finally{i.f()}}else for(var o in e)if(cj.call(e,o)&&t.call(n,e[o],o)===Nj)return}}var Ij=function(e){return Fj([...arguments].slice(1),(function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])})),e};function Q(e,t){return e.indexOf(t)!==-1}function Lj(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Rj=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},zj=function(e){try{return e()}catch{return}},Bj=function(e){return function(){try{var t=[...arguments];return e.apply(this,t)}catch(e){X.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),X.critical(e)}}},Vj=function(e){var t={};return Z(e,(function(e,n){mj(e)&&e.length>0&&(t[n]=e)})),t},Hj=function(e){return e.replace(/^\$/,``)};function Uj(e,t){return n=e,r=function(e){return mj(e)&&!gj(t)?e.slice(0,t):e},i=new Set,function e(t,n){return t===Object(t)?i.has(t)?void 0:(i.add(t),uj(t)?(a=[],Fj(t,(function(t){a.push(e(t))}))):(a={},Z(t,(function(t,n){i.has(t)||(a[n]=e(t,n))}))),a):r?r(t,n):t;var a}(n);var n,r,i}var Wj,Gj=function(e){var t,n,r,i,a=``;for(t=n=0,r=(e=(e+``).replace(/\r\n/g,`
|
|
57
57
|
`).replace(/\r/g,`
|
|
58
58
|
`)).length,i=0;i<r;i++){var o=e.charCodeAt(i),s=null;o<128?n++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),gj(s)||(n>t&&(a+=e.substring(t,n)),a+=s,t=n=i+1)}return n>t&&(a+=e.substring(t,e.length)),a},Kj=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,n,r,i,a){if(t)if(t.addEventListener&&!i)t.addEventListener(n,r,!!a);else{var o=`on`+n;t[o]=function(t,n,r){return function(i){if(i||=e(J?.event)){var a,o=!0;dj(r)&&(a=r(i));var s=n.call(t,i);return!1!==a&&!1!==s||(o=!1),o}}}(t,r,t[o])}else X.error(`No valid element provided to register_event`)}}();function qj(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}(function(e){e.GZipJS=`gzip-js`,e.Base64=`base64`})(Wj||={});var Jj=`$people_distinct_id`,Yj=`__alias`,Xj=`__timers`,Zj=`$autocapture_disabled_server_side`,Qj=`$heatmaps_enabled_server_side`,$j=`$exception_capture_enabled_server_side`,eM=`$exception_capture_endpoint_suffix`,tM=`$web_vitals_enabled_server_side`,nM=`$session_recording_enabled_server_side`,rM=`$console_log_recording_enabled_server_side`,iM=`$session_recording_network_payload_capture`,aM=`$session_recording_canvas_recording`,oM=`$replay_sample_rate`,sM=`$replay_minimum_duration`,cM=`$sesid`,lM=`$session_is_sampled`,uM=`$enabled_feature_flags`,dM=`$early_access_features`,fM=`$stored_person_properties`,pM=`$stored_group_properties`,mM=`$surveys`,hM=`$surveys_activated`,gM=`$flag_call_reported`,_M=`$user_state`,vM=`$client_session_props`,yM=`$capture_rate_limit`,bM=`$initial_campaign_params`,xM=`$initial_referrer_info`,SM=`$initial_person_info`,CM=`$epp`,wM=`__POSTHOG_TOOLBAR__`,TM=[Jj,Yj,`__cmpns`,Xj,nM,Qj,cM,uM,_M,dM,pM,fM,mM,gM,vM,yM,bM,xM,CM],EM=`$active_feature_flags`,DM=`$override_feature_flags`,OM=`$feature_flag_payloads`,kM=function(e){var t,n={},r=ij(Lj(e||{}));try{for(r.s();!(t=r.n()).done;){var i=ej(t.value,2),a=i[0],o=i[1];o&&(n[a]=o)}}catch(e){r.e(e)}finally{r.f()}return n},AM=function(){function e(t){W(this,e),this.instance=t,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return G(e,[{key:`getFlags`,value:function(){return Object.keys(this.getFlagVariants())}},{key:`getFlagVariants`,value:function(){var e=this.instance.get_property(uM),t=this.instance.get_property(DM);if(!t)return e||{};for(var n=Ij({},e),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this._override_warning||=(X.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}},{key:`getFlagPayloads`,value:function(){return this.instance.get_property(OM)||{}}},{key:`reloadFeatureFlags`,value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:`setAnonymousDistinctId`,value:function(e){this.$anon_distinct_id=e}},{key:`setReloadingPaused`,value:function(e){this.reloadFeatureFlagsInAction=e}},{key:`resetRequestQueue`,value:function(){this.reloadFeatureFlagsQueued=!1}},{key:`_startReloadTimer`,value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout((function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())}),5)}},{key:`_reloadFeatureFlagsRequest`,value:function(){var e=this;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var t=this.instance.config.token,n=this.instance.get_property(fM),r=this.instance.get_property(pM),i={token:t,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:n,group_properties:r,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:`POST`,url:this.instance.requestRouter.endpointFor(`api`,`/decide/?v=3`),data:i,compression:this.instance.config.disable_compression?void 0:Wj.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(t){e.setReloadingPaused(!1);var n=!0;t.statusCode===200&&(e.$anon_distinct_id=void 0,n=!1),e.receivedFeatureFlags(t.json??{},n),e._startReloadTimer()}})}}},{key:`getFeatureFlag`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var n,r=this.getFlagVariants()[e],i=`${r}`,a=this.instance.get_property(gM)||{};return(t.send_event||!(`send_event`in t))&&(!(e in a)||!a[e].includes(i))&&(uj(a[e])?a[e].push(i):a[e]=[i],(n=this.instance.persistence)==null||n.register(K({},gM,a)),this.instance.capture(`$feature_flag_called`,{$feature_flag:e,$feature_flag_response:r})),r}X.warn(`getFeatureFlag for key "`+e+`" failed. Feature flags didn't load in time.`)}},{key:`getFeatureFlagPayload`,value:function(e){return this.getFlagPayloads()[e]}},{key:`isFeatureEnabled`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);X.warn(`isFeatureEnabled for key "`+e+`" failed. Feature flags didn't load in time.`)}},{key:`addFeatureFlagsHandler`,value:function(e){this.featureFlagEventHandlers.push(e)}},{key:`removeFeatureFlagsHandler`,value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((function(t){return t!==e}))}},{key:`receivedFeatureFlags`,value:function(e,t){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads();(function(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=e.featureFlags,o=e.featureFlagPayloads;if(a)if(uj(a)){var s,c={};if(a)for(var l=0;l<a.length;l++)c[a[l]]=!0;t&&t.register((K(s={},EM,a),K(s,uM,c),s))}else{var u=a,d=o;e.errorsWhileComputingFlags&&(u=U(U({},r),u),d=U(U({},i),d)),t&&t.register((K(n={},EM,Object.keys(kM(u))),K(n,uM,u||{}),K(n,OM,d||{}),n))}})(e,this.instance.persistence,n,r),this._fireFeatureFlagsCallbacks(t)}}},{key:`override`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return X.uninitializedWarning(`posthog.feature_flags.override`);if(this._override_warning=t,!1===e)this.instance.persistence.unregister(DM);else if(uj(e)){for(var n={},r=0;r<e.length;r++)n[e[r]]=!0;this.instance.persistence.register(K({},DM,n))}else this.instance.persistence.register(K({},DM,e))}},{key:`onFeatureFlags`,value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var n=this._prepareFeatureFlagsForCallbacks(),r=n.flags,i=n.flagVariants;e(r,i)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:`updateEarlyAccessFeatureEnrollment`,value:function(e,t){var n,r,i=K({},`\$feature_enrollment/${e}`,t);this.instance.capture(`$feature_enrollment_update`,{$feature_flag:e,$feature_enrollment:t,$set:i}),this.setPersonPropertiesForFlags(i,!1);var a=U(U({},this.getFlagVariants()),{},K({},e,t));(n=this.instance.persistence)==null||n.register((K(r={},EM,Object.keys(kM(a))),K(r,uM,a),r)),this._fireFeatureFlagsCallbacks()}},{key:`getEarlyAccessFeatures`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=this.instance.get_property(dM);if(r&&!n)return e(r);this.instance._send_request({transport:`XHR`,url:this.instance.requestRouter.endpointFor(`api`,`/api/early_access_features/?token=${this.instance.config.token}`),method:`GET`,callback:function(n){var r;if(n.json){var i=n.json.earlyAccessFeatures;return(r=t.instance.persistence)==null||r.register(K({},dM,i)),e(i)}}})}},{key:`_prepareFeatureFlagsForCallbacks`,value:function(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((function(e){return t[e]})),flagVariants:Object.keys(t).filter((function(e){return t[e]})).reduce((function(e,n){return e[n]=t[n],e}),{})}}},{key:`_fireFeatureFlagsCallbacks`,value:function(e){var t=this._prepareFeatureFlagsForCallbacks(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((function(t){return t(n,r,{errorsLoading:e})}))}},{key:`setPersonPropertiesForFlags`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this.instance.get_property(fM)||{};this.instance.register(K({},fM,U(U({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:`resetPersonPropertiesForFlags`,value:function(){this.instance.unregister(fM)}},{key:`setGroupPropertiesForFlags`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this.instance.get_property(pM)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((function(t){n[t]=U(U({},n[t]),e[t]),delete e[t]})),this.instance.register(K({},pM,U(U({},n),e))),t&&this.instance.reloadFeatureFlags()}},{key:`resetGroupPropertiesForFlags`,value:function(e){if(e){var t=this.instance.get_property(pM)||{};this.instance.register(K({},pM,U(U({},t),{},K({},e,{}))))}else this.instance.unregister(pM)}}]),e}();Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return vj(e)&&isFinite(e)&&Math.floor(e)===e});var jM=`0123456789abcdef`,MM=function(){function e(t){if(W(this,e),this.bytes=t,t.length!==16)throw TypeError(`not 128-bit length`)}return G(e,[{key:`toString`,value:function(){for(var e=``,t=0;t<this.bytes.length;t++)e=e+jM.charAt(this.bytes[t]>>>4)+jM.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}},{key:`clone`,value:function(){return new e(this.bytes.slice(0))}},{key:`equals`,value:function(e){return this.compareTo(e)===0}},{key:`compareTo`,value:function(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}}],[{key:`fromFieldsV7`,value:function(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}}]),e}(),NM=function(){function e(){W(this,e),K(this,`timestamp`,0),K(this,`counter`,0),K(this,`random`,new IM)}return G(e,[{key:`generate`,value:function(){var e=this.generateOrAbort();if(q(e)){this.timestamp=0;var t=this.generateOrAbort();if(q(t))throw Error(`Could not generate UUID after timestamp reset`);return t}return e}},{key:`generateOrAbort`,value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return MM.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}},{key:`resetCounter`,value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),e}(),PM=function(e){if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};J&&!q(J.crypto)&&crypto.getRandomValues&&(PM=function(e){return crypto.getRandomValues(e)});var FM,IM=function(){function e(){W(this,e),K(this,`buffer`,new Uint32Array(8)),K(this,`cursor`,1/0)}return G(e,[{key:`nextUint32`,value:function(){return this.cursor>=this.buffer.length&&(PM(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),e}(),LM=function(){return RM().toString()},RM=function(){return(FM||=new NM).generate()},zM=`Thu, 01 Jan 1970 00:00:00 GMT`,BM=``,VM=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function HM(e,t){if(t){var n=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Y;if(BM)return BM;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+LM(),a=RegExp(`(^|;)\\s*`+i+`=1`);!BM&&r--;){var o=n.slice(r).join(`.`),s=i+`=1;domain=.`+o;t.cookie=s,a.test(t.cookie)&&(t.cookie=s+`;expires=`+zM,BM=o)}return BM}(e);if(!n){var r=function(e){var t=e.match(VM);return t?t[0]:``}(e);r!==n&&X.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}var UM,WM={is_supported:function(){return!!Y},error:function(e){X.error(`cookieStore error: `+e)},get:function(e){if(Y){try{for(var t=e+`=`,n=Y.cookie.split(`;`).filter((function(e){return e.length})),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(WM.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(Y)try{var a=``,o=``,s=HM(Y.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),a=`; expires=`+c.toUTCString()}i&&(o=`; secure`);var l=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return l.length>3686.4&&X.warn(`cookieStore warning: large cookie, len=`+l.length),Y.cookie=l,l}catch{return}},remove:function(e,t){try{WM.set(e,``,-1,t)}catch{return}}},GM=null,KM={is_supported:function(){if(!gj(GM))return GM;var e=!0;if(q(J))e=!1;else try{var t=`__mplssupport__`;KM.set(t,`xyz`),KM.get(t)!==`"xyz"`&&(e=!1),KM.remove(t)}catch{e=!1}return e||X.error(`localStorage unsupported; falling back to cookie store`),GM=e,e},error:function(e){X.error(`localStorage error: `+e)},get:function(e){try{return J?.localStorage.getItem(e)}catch(e){KM.error(e)}return null},parse:function(e){try{return JSON.parse(KM.get(e))||{}}catch{}return null},set:function(e,t){try{J?.localStorage.setItem(e,JSON.stringify(t))}catch(e){KM.error(e)}},remove:function(e){try{J?.localStorage.removeItem(e)}catch(e){KM.error(e)}}},qM=[`distinct_id`,cM,lM,CM],JM=U(U({},KM),{},{parse:function(e){try{var t={};try{t=WM.parse(e)||{}}catch{}var n=Ij(t,JSON.parse(KM.get(e)||`{}`));return KM.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,a){try{KM.set(e,t,void 0,void 0,a);var o={};qM.forEach((function(e){t[e]&&(o[e]=t[e])})),Object.keys(o).length&&WM.set(e,o,n,r,i,a)}catch(e){KM.error(e)}},remove:function(e,t){try{J?.localStorage.removeItem(e),WM.remove(e,t)}catch(e){KM.error(e)}}}),YM={},XM={is_supported:function(){return!0},error:function(e){X.error(`memoryStorage error: `+e)},get:function(e){return YM[e]||null},parse:function(e){return YM[e]||null},set:function(e,t){YM[e]=t},remove:function(e){delete YM[e]}},ZM=null,QM={is_supported:function(){if(!gj(ZM))return ZM;if(ZM=!0,q(J))ZM=!1;else try{var e=`__support__`;QM.set(e,`xyz`),QM.get(e)!==`"xyz"`&&(ZM=!1),QM.remove(e)}catch{ZM=!1}return ZM},error:function(e){X.error(`sessionStorage error: `,e)},get:function(e){try{return J?.sessionStorage.getItem(e)}catch(e){QM.error(e)}return null},parse:function(e){try{return JSON.parse(QM.get(e))||null}catch{}return null},set:function(e,t){try{J?.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){QM.error(e)}},remove:function(e){try{J?.sessionStorage.removeItem(e)}catch(e){QM.error(e)}}},$M=[`localhost`,`127.0.0.1`],eN=function(e){var t=Y?.createElement(`a`);return q(t)?null:(t.href=e,t)},tN=function(e,t){return!!function(e){try{new RegExp(e)}catch{return!1}return!0}(t)&&new RegExp(t).test(e)},nN=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`&`,i=[];return Z(e,(function(e,r){q(e)||q(r)||r===`undefined`||(t=encodeURIComponent(function(e){return e instanceof File}(e)?e.name:e.toString()),n=encodeURIComponent(r),i[i.length]=n+`=`+t)})),i.join(r)},rN=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(`?`)[1]||``).split(`&`),i=0;i<r.length;i++){var a=r[i].split(`=`);if(a[0]===t){n=a;break}}if(!uj(n)||n.length<2)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{X.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},iN=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},aN=`Mobile`,oN=`iOS`,sN=`Android`,cN=`Tablet`,lN=sN+` `+cN,uN=`iPad`,dN=`Apple`,fN=dN+` Watch`,pN=`Safari`,mN=`BlackBerry`,hN=`Samsung`,gN=hN+`Browser`,_N=hN+` Internet`,vN=`Chrome`,yN=vN+` OS`,bN=vN+` `+oN,xN=`Internet Explorer`,SN=xN+` `+aN,CN=`Opera`,wN=CN+` Mini`,TN=`Edge`,EN=`Microsoft `+TN,DN=`Firefox`,ON=DN+` `+oN,kN=`Nintendo`,AN=`PlayStation`,jN=`Xbox`,MN=sN+` `+aN,NN=aN+` `+pN,PN=`Windows`,FN=PN+` Phone`,IN=`Nokia`,LN=`Ouya`,RN=`Generic`,zN=RN+` `+aN.toLowerCase(),BN=RN+` `+cN.toLowerCase(),VN=`Konqueror`,HN=`(\\d+(\\.\\d+)?)`,UN=RegExp(`Version/`+HN),WN=new RegExp(jN,`i`),GN=RegExp(AN+` \\w+`,`i`),KN=RegExp(kN+` \\w+`,`i`),qN=RegExp(mN+`|PlayBook|BB10`,`i`),JN={"NT3.51":`NT 3.11`,"NT4.0":`NT 4.0`,"5.0":`2000`,5.1:`XP`,5.2:`XP`,"6.0":`Vista`,6.1:`7`,6.2:`8`,6.3:`8.1`,6.4:`10`,"10.0":`10`},YN=function(e,t){return t&&Q(t,dN)||function(e){return Q(e,pN)&&!Q(e,vN)&&!Q(e,sN)}(e)},XN=function(e,t){return t||=``,Q(e,` OPR/`)&&Q(e,`Mini`)?wN:Q(e,` OPR/`)?CN:qN.test(e)?mN:Q(e,`IE`+aN)||Q(e,`WPDesktop`)?SN:Q(e,gN)?_N:Q(e,TN)||Q(e,`Edg/`)?EN:Q(e,`FBIOS`)?`Facebook `+aN:Q(e,`UCWEB`)||Q(e,`UCBrowser`)?`UC Browser`:Q(e,`CriOS`)?bN:Q(e,`CrMo`)?vN:Q(e,sN)&&Q(e,pN)?MN:Q(e,vN)?vN:Q(e,`FxiOS`)?ON:Q(e.toLowerCase(),VN.toLowerCase())?VN:YN(e,t)?Q(e,aN)?NN:pN:Q(e,DN)?DN:Q(e,`MSIE`)||Q(e,`Trident/`)?xN:Q(e,`Gecko`)?DN:``},ZN=(K(UM={},SN,[RegExp(`rv:`+HN)]),K(UM,EN,[RegExp(TN+`?\\/`+HN)]),K(UM,vN,[RegExp(`(`+vN+`|CrMo)\\/`+HN)]),K(UM,bN,[RegExp(`CriOS\\/`+HN)]),K(UM,`UC Browser`,[RegExp(`(UCBrowser|UCWEB)\\/`+HN)]),K(UM,pN,[UN]),K(UM,NN,[UN]),K(UM,CN,[RegExp(`(Opera|OPR)\\/`+HN)]),K(UM,DN,[RegExp(DN+`\\/`+HN)]),K(UM,ON,[RegExp(`FxiOS\\/`+HN)]),K(UM,VN,[RegExp(`Konqueror[:/]?`+HN,`i`)]),K(UM,mN,[RegExp(mN+` `+HN),UN]),K(UM,MN,[RegExp(`android\\s`+HN,`i`)]),K(UM,_N,[RegExp(gN+`\\/`+HN)]),K(UM,xN,[RegExp(`(rv:|MSIE )`+HN)]),K(UM,`Mozilla`,[RegExp(`rv:`+HN)]),UM),QN=[[RegExp(jN+`; `+jN+` (.*?)[);]`,`i`),function(e){return[jN,e&&e[1]||``]}],[new RegExp(kN,`i`),[kN,``]],[new RegExp(AN,`i`),[AN,``]],[qN,[mN,``]],[new RegExp(PN,`i`),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[FN,``];if(new RegExp(aN).test(t)&&!/IEMobile\b/.test(t))return[PN+` `+aN,``];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=JN[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[PN,r]}return[PN,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){return e&&e[3]?[oN,[e[3],e[4],e[5]||`0`].join(`.`)]:[oN,``]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t=``;return e&&e.length>=3&&(t=q(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+sN+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+sN+`)`,`i`),function(e){return e&&e[2]?[sN,[e[2],e[3],e[4]||`0`].join(`.`)]:[sN,``]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=[`Mac OS X`,``];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||`0`].join(`.`)),t}],[/Mac/i,[`Mac OS X`,``]],[/CrOS/,[yN,``]],[/Linux|debian/i,[`Linux`,``]]],$N=function(e){return KN.test(e)?kN:GN.test(e)?AN:WN.test(e)?jN:new RegExp(LN,`i`).test(e)?LN:RegExp(`(`+FN+`|WPDesktop)`,`i`).test(e)?FN:/iPad/.test(e)?uN:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?fN:qN.test(e)?mN:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(IN,`i`).test(e)?IN:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?`Kindle Fire`:/(Android|ZTE)/i.test(e)?!new RegExp(aN).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?sN:lN:sN:RegExp(`(pda|`+aN+`)`,`i`).test(e)?zN:new RegExp(cN,`i`).test(e)&&!RegExp(cN+` pc`,`i`).test(e)?BN:``},eP=`https?://(.*)`,tP=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gclid`,`gad_source`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`mc_cid`,`igshid`,`ttclid`,`rdt_cid`],nP={campaignParams:function(e){return Y?this._campaignParamsFromUrl(Y.URL,e):{}},_campaignParamsFromUrl:function(e,t){var n=tP.concat(t||[]),r={};return Z(n,(function(t){var n=rN(e,t);n&&(r[t]=n)})),r},_searchEngine:function(e){return e?e.search(eP+`google.([^/?]*)`)===0?`google`:e.search(eP+`bing.com`)===0?`bing`:e.search(eP+`yahoo.com`)===0?`yahoo`:e.search(eP+`duckduckgo.com`)===0?`duckduckgo`:null:null},_searchInfoFromReferrer:function(e){var t=nP._searchEngine(e),n=t==`yahoo`?`p`:`q`,r={};if(!gj(t)){r.$search_engine=t;var i=Y?rN(Y.referrer,n):``;i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var e=Y?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:XN,browserVersion:function(e,t){var n=ZN[XN(e,t)];if(q(n))return null;for(var r=0;r<n.length;r++){var i=n[r],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(e){for(var t=0;t<QN.length;t++){var n=ej(QN[t],2),r=n[0],i=n[1],a=r.exec(e),o=a&&(dj(i)?i(a,e):i);if(o)return o}return[``,``]},device:$N,deviceType:function(e){var t=$N(e);return t===uN||t===lN||t===`Kobo`||t===`Kindle Fire`||t===BN?cN:t===kN||t===jN||t===AN||t===LN?`Console`:t===fN?`Wearable`:t?aN:`Desktop`},referrer:function(){return Y?.referrer||`$direct`},referringDomain:function(){return Y!=null&&Y.referrer&&eN(Y.referrer)?.host||`$direct`},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:Ej?.href}},initialPersonPropsFromInfo:function(e){var t=e.r,n=e.u,r={$initial_referrer:t,$initial_referring_domain:t==null?void 0:t==`$direct`?`$direct`:eN(t)?.host};if(n){r.$initial_current_url=n;var i=eN(n);r.$initial_host=i?.host,r.$initial_pathname=i?.pathname,Z(this._campaignParamsFromUrl(n),(function(e,t){r[`$initial_`+Hj(t)]=e}))}return t&&Z(this._searchInfoFromReferrer(t),(function(e,t){r[`$initial_`+Hj(t)]=e})),r},properties:function(){if(!Aj)return{};var e=ej(nP.os(Aj),2),t=e[0],n=e[1];return Ij(Vj({$os:t,$os_version:n,$browser:nP.browser(Aj,navigator.vendor),$device:nP.device(Aj),$device_type:nP.deviceType(Aj)}),{$current_url:Ej?.href,$host:Ej?.host,$pathname:Ej?.pathname,$raw_user_agent:Aj.length>1e3?Aj.substring(0,997)+`...`:Aj,$browser_version:nP.browserVersion(Aj,navigator.vendor),$browser_language:nP.browserLanguage(),$screen_height:J?.screen.height,$screen_width:J?.screen.width,$viewport_height:J?.innerHeight,$viewport_width:J?.innerWidth,$lib:`web`,$lib_version:aj.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Rj()/1e3})},people_properties:function(){if(!Aj)return{};var e=ej(nP.os(Aj),2),t=e[0],n=e[1];return Ij(Vj({$os:t,$os_version:n,$browser:nP.browser(Aj,navigator.vendor)}),{$browser_version:nP.browserVersion(Aj,navigator.vendor)})}},rP=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],iP=function(){function e(t){W(this,e),this.config=t,this.props={},this.campaign_params_saved=!1,this.name=function(e){var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`}(t),this.storage=this.buildStorage(t),this.load(),t.debug&&X.info(`Persistence loaded`,t.persistence,U({},this.props)),this.update_config(t,t),this.save()}return G(e,[{key:`buildStorage`,value:function(e){rP.indexOf(e.persistence.toLowerCase())===-1&&(X.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);var t=e.persistence.toLowerCase();return t===`localstorage`&&KM.is_supported()?KM:t===`localstorage+cookie`&&JM.is_supported()?JM:t===`sessionstorage`&&QM.is_supported()?QM:t===`memory`?XM:t===`cookie`?WM:JM.is_supported()?JM:WM}},{key:`properties`,value:function(){var e={};return Z(this.props,(function(t,n){if(n===uM&&fj(t))for(var r=Object.keys(t),i=0;i<r.length;i++)e[`\$feature/${r[i]}`]=t[r[i]];else o=n,s=!1,(gj(a=TM)?s:wj&&a.indexOf===wj?a.indexOf(o)!=-1:(Z(a,(function(e){if(s||=e===o)return Nj})),s))||(e[n]=t);var a,o,s})),e}},{key:`load`,value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Ij({},e))}}},{key:`save`,value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}},{key:`remove`,value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:`clear`,value:function(){this.remove(),this.props={}}},{key:`register_once`,value:function(e,t,n){var r=this;if(fj(e)){q(t)&&(t=`None`),this.expire_days=q(n)?this.default_expiry:n;var i=!1;if(Z(e,(function(e,n){r.props.hasOwnProperty(n)&&r.props[n]!==t||(r.props[n]=e,i=!0)})),i)return this.save(),!0}return!1}},{key:`register`,value:function(e,t){var n=this;if(fj(e)){this.expire_days=q(t)?this.default_expiry:t;var r=!1;if(Z(e,(function(t,i){e.hasOwnProperty(i)&&n.props[i]!==t&&(n.props[i]=t,r=!0)})),r)return this.save(),!0}return!1}},{key:`unregister`,value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:`update_campaign_params`,value:function(){this.campaign_params_saved||=(this.register(nP.campaignParams(this.config.custom_campaign_params)),!0)}},{key:`update_search_keyword`,value:function(){this.register(nP.searchInfo())}},{key:`update_referrer_info`,value:function(){this.register_once(nP.referrerInfo(),void 0)}},{key:`set_initial_person_info`,value:function(){this.props[bM]||this.props[xM]||this.register_once(K({},SM,nP.initialPersonInfo()),void 0)}},{key:`get_referrer_info`,value:function(){return Vj({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:`get_initial_props`,value:function(){var e=this,t={};Z([xM,bM],(function(n){var r=e.props[n];r&&Z(r,(function(e,n){t[`$initial_`+Hj(n)]=e}))}));var n=this.props[SM];return n&&Ij(t,nP.initialPersonPropsFromInfo(n)),t}},{key:`safe_merge`,value:function(e){return Z(this.props,(function(t,n){n in e||(e[n]=t)})),e}},{key:`update_config`,value:function(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.buildStorage(e),r=this.props;this.clear(),this.storage=n,this.props=r,this.save()}}},{key:`set_disabled`,value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:`set_cross_subdomain`,value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:`get_cross_subdomain`,value:function(){return!!this.cross_subdomain}},{key:`set_secure`,value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:`set_event_timer`,value:function(e,t){var n=this.props[Xj]||{};n[e]=t,this.props[Xj]=n,this.save()}},{key:`remove_event_timer`,value:function(e){var t=(this.props[Xj]||{})[e];return q(t)||(delete this.props[Xj][e],this.save()),t}},{key:`get_property`,value:function(e){return this.props[e]}},{key:`set_property`,value:function(e,t){this.props[e]=t,this.save()}}]),e}();function aP(e){return JSON.stringify(e,(t=[],function(e,n){if(fj(n)){for(;t.length>0&&t.at(-1)!==this;)t.pop();return t.includes(n)?`[Circular]`:(t.push(n),n)}return n})).length;var t}var oP=2,sP=4;function cP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),r=e.data.slice(0,n),i=e.data.slice(n);return[cP({size:aP(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),cP({size:aP(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap((function(e){return e}))}return[e]}var lP=function(e){return e[e.DomContentLoaded=0]=`DomContentLoaded`,e[e.Load=1]=`Load`,e[e.FullSnapshot=2]=`FullSnapshot`,e[e.IncrementalSnapshot=3]=`IncrementalSnapshot`,e[e.Meta=4]=`Meta`,e[e.Custom=5]=`Custom`,e[e.Plugin=6]=`Plugin`,e}(lP||{}),uP=function(e){return e[e.Mutation=0]=`Mutation`,e[e.MouseMove=1]=`MouseMove`,e[e.MouseInteraction=2]=`MouseInteraction`,e[e.Scroll=3]=`Scroll`,e[e.ViewportResize=4]=`ViewportResize`,e[e.Input=5]=`Input`,e[e.TouchMove=6]=`TouchMove`,e[e.MediaInteraction=7]=`MediaInteraction`,e[e.StyleSheetRule=8]=`StyleSheetRule`,e[e.CanvasMutation=9]=`CanvasMutation`,e[e.Font=10]=`Font`,e[e.Log=11]=`Log`,e[e.Drag=12]=`Drag`,e[e.StyleDeclaration=13]=`StyleDeclaration`,e[e.Selection=14]=`Selection`,e[e.AdoptedStyleSheet=15]=`AdoptedStyleSheet`,e[e.CustomElement=16]=`CustomElement`,e}(uP||{});function dP(e){return e?Pj(e).split(/\s+/):[]}function fP(e){var t=J?.location.href;return!!(t&&e&&e.some((function(e){return t.match(e)})))}function pP(e){var t=``;switch(ZA(e.className)){case`string`:t=e.className;break;case`object`:t=(e.className&&`baseVal`in e.className?e.className.baseVal:null)||e.getAttribute(`class`)||``;break;default:t=``}return dP(t)}function mP(e){return _j(e)?null:Pj(e).split(/(\s+)/).filter((function(e){return jP(e)})).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function hP(e){var t=``;return CP(e)&&!wP(e)&&e.childNodes&&e.childNodes.length&&Z(e.childNodes,(function(e){vP(e)&&e.textContent&&(t+=mP(e.textContent)??``)})),Pj(t)}function gP(e){return!!e&&e.nodeType===1}function _P(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function vP(e){return!!e&&e.nodeType===3}function yP(e){return!!e&&e.nodeType===11}var bP=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function xP(e){var t=e.parentNode;return!(!t||!gP(t))&&t}function SP(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!J||!e||_P(e,`html`)||!gP(e)||n!=null&&n.url_allowlist&&!fP(n.url_allowlist)||n!=null&&n.url_ignorelist&&fP(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var a=n.dom_event_allowlist;if(a&&!a.some((function(e){return t.type===e})))return!1}for(var o=!1,s=[e],c=!0,l=e;l.parentNode&&!_P(l,`body`);)if(yP(l.parentNode))s.push(l.parentNode.host),l=l.parentNode.host;else{if(!(c=xP(l)))break;if(r||bP.indexOf(c.tagName.toLowerCase())>-1)o=!0;else{var u=J.getComputedStyle(c);u&&u.getPropertyValue(`cursor`)===`pointer`&&(o=!0)}s.push(c),l=c}if(!function(e,t){var n=t?.element_allowlist;if(q(n))return!0;var r,i=ij(e);try{var a=function(){var e=r.value;if(n.some((function(t){return e.tagName.toLowerCase()===t})))return{v:!0}};for(i.s();!(r=i.n()).done;){var o=a();if(ZA(o)===`object`)return o.v}}catch(e){i.e(e)}finally{i.f()}return!1}(s,n)||!function(e,t){var n=t?.css_selector_allowlist;if(q(n))return!0;var r,i=ij(e);try{var a=function(){var e=r.value;if(n.some((function(t){return e.matches(t)})))return{v:!0}};for(i.s();!(r=i.n()).done;){var o=a();if(ZA(o)===`object`)return o.v}}catch(e){i.e(e)}finally{i.f()}return!1}(s,n))return!1;var d=J.getComputedStyle(e);if(d&&d.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0;var f=e.tagName.toLowerCase();switch(f){case`html`:return!1;case`form`:return(i||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(i||[`change`,`click`]).indexOf(t.type)>=0;default:return o?(i||[`click`]).indexOf(t.type)>=0:(i||[`click`]).indexOf(t.type)>=0&&(bP.indexOf(f)>-1||e.getAttribute(`contenteditable`)===`true`)}}function CP(e){for(var t=e;t.parentNode&&!_P(t,`body`);t=t.parentNode){var n=pP(t);if(Q(n,`ph-sensitive`)||Q(n,`ph-no-capture`))return!1}if(Q(pP(e),`ph-include`))return!0;var r=e.type||``;if(mj(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}var i=e.name||e.id||``;return!(mj(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``)))}function wP(e){return!!(_P(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||_P(e,`select`)||_P(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var TP=`(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})`,EP=RegExp(`^(?:${TP})\$`),DP=new RegExp(TP),OP=`\\d{3}-?\\d{2}-?\\d{4}`,kP=RegExp(`^(${OP})\$`),AP=RegExp(`(${OP})`);function jP(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(_j(e)||mj(e)&&(e=Pj(e),(t?EP:DP).test((e||``).replace(/[- ]/g,``))||(t?kP:AP).test(e)))}function MP(e){var t=hP(e);return jP(t=`${t} ${NP(e)}`.trim())?t:``}function NP(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&Z(e.childNodes,(function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{var n=hP(e);t=`${t} ${n}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${NP(e)}`.trim())}catch(e){X.error(e)}})),t}function PP(e){return function(e){return e.map((function(e){var t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class){e.attr_class.sort();var n,r=ij(e.attr_class);try{for(r.s();!(n=r.n()).done;){var i=n.value;t+=`.${i.replace(/"/g,``)}`}}catch(e){r.e(e)}finally{r.f()}}var a=U(U(U(U({},e.text?{text:e.text}:{}),{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),o={};return Lj(a).sort((function(e,t){var n=ej(e,1)[0],r=ej(t,1)[0];return n.localeCompare(r)})).forEach((function(e){var t=ej(e,2),n=t[0],r=t[1];return o[FP(n.toString())]=FP(r.toString())})),t+=`:`,t+=Lj(a).map((function(e){var t=ej(e,2);return`${t[0]}="${t[1]}"`})).join(``)})).join(`;`)}(function(e){return e.map((function(e){var t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:IP(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Lj(e).filter((function(e){return ej(e,1)[0].indexOf(`attr__`)===0})).forEach((function(e){var n=ej(e,2),r=n[0],i=n[1];return t.attributes[r]=i})),t}))}(e))}function FP(e){return e.replace(/"|\\"/g,`\\"`)}function IP(e){var t=e.attr__class;return t?uj(t)?t:dP(t):void 0}var LP=`[SessionRecording]`,RP=`redacted`,zP={initiatorTypes:[`audio`,`beacon`,`body`,`css`,`early-hint`,`embed`,`fetch`,`frame`,`iframe`,`icon`,`image`,`img`,`input`,`link`,`navigation`,`object`,`ping`,`script`,`track`,`video`,`xmlhttprequest`],maskRequestFn:function(e){return e},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:[`first-input`,`navigation`,`paint`,`resource`],payloadSizeLimitBytes:1e6,payloadHostDenyList:[`.lr-ingest.io`,`.ingest.sentry.io`]},BP=[`authorization`,`x-forwarded-for`,`authorization`,`cookie`,`set-cookie`,`x-api-key`,`x-real-ip`,`remote-addr`,`forwarded`,`proxy-authorization`,`x-csrf-token`,`x-csrftoken`,`x-xsrf-token`],VP=[`password`,`secret`,`passwd`,`api_key`,`apikey`,`auth`,`credentials`,`mysql_pwd`,`privatekey`,`private_key`,`token`],HP=[`/s/`,`/e/`,`/i/`];function UP(e,t,n,r){if(_j(e))return e;var i=t?.[`content-length`]||function(e){return new Blob([e]).size}(e);return mj(i)&&(i=parseInt(i)),i>n?LP+` ${r} body too large to record (${i} bytes)`:e}function WP(e,t){if(_j(e))return e;var n=e;return jP(n,!1)||(n=LP+` `+t+` body `+RP),Z(VP,(function(e){var r;(r=n)!=null&&r.length&&n?.indexOf(e)!==-1&&(n=LP+` `+t+` body `+RP+` as might contain: `+e)})),n}var GP,KP=function(e,t){var n,r,i={payloadSizeLimitBytes:zP.payloadSizeLimitBytes,performanceEntryTypeToObserve:tj(zP.performanceEntryTypeToObserve),payloadHostDenyList:[].concat(tj(t.payloadHostDenyList||[]),tj(zP.payloadHostDenyList))},a=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,s=!1!==e.capture_performance&&t.recordPerformance,c=(n=i,r=Math.min(1e6,n.payloadSizeLimitBytes??1e6),function(e){return e!=null&&e.requestBody&&(e.requestBody=UP(e.requestBody,e.requestHeaders,r,`Request`)),e!=null&&e.responseBody&&(e.responseBody=UP(e.responseBody,e.responseHeaders,r,`Response`)),e}),l=function(e){return c(function(e){var t=eN(e.name);if(!(t&&t.pathname&&HP.some((function(e){return t.pathname.indexOf(e)===0}))))return e}((n=(t=e).requestHeaders,_j(n)||Z(Object.keys(n??{}),(function(e){BP.includes(e.toLowerCase())&&(n[e]=RP)})),t)));var t,n},u=dj(e.session_recording.maskNetworkRequestFn);return u&&dj(e.session_recording.maskCapturedNetworkRequestFn)&&X.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(e.session_recording.maskCapturedNetworkRequestFn=function(t){var n=e.session_recording.maskNetworkRequestFn({url:t.name});return U(U({},t),{},{name:n?.url})}),i.maskRequestFn=dj(e.session_recording.maskCapturedNetworkRequestFn)?function(t){var n,r,i=l(t);return i&&(n=(r=e.session_recording).maskCapturedNetworkRequestFn?.call(r,i))!=null?n:void 0}:function(e){return function(e){if(!q(e))return e.requestBody=WP(e.requestBody,`Request`),e.responseBody=WP(e.responseBody,`Response`),e}(l(e))},U(U(U({},zP),i),{},{recordHeaders:a,recordBody:o,recordPerformance:s,recordInitialRequests:s})},qP=G((function e(t){var n=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};W(this,e),K(this,`bucketSize`,100),K(this,`refillRate`,10),K(this,`mutationBuckets`,{}),K(this,`loggedTracker`,{}),K(this,`refillBuckets`,(function(){Object.keys(n.mutationBuckets).forEach((function(e){n.mutationBuckets[e]=n.mutationBuckets[e]+n.refillRate,n.mutationBuckets[e]>=n.bucketSize&&delete n.mutationBuckets[e]}))})),K(this,`getNodeOrRelevantParent`,(function(e){var t=n.rrweb.mirror.getNode(e);if(t?.nodeName!==`svg`&&t instanceof Element){var r=t.closest(`svg`);if(r)return[n.rrweb.mirror.getId(r),r]}return[e,t]})),K(this,`numberOfChanges`,(function(e){return(e.removes?.length??0)+(e.attributes?.length??0)+(e.texts?.length??0)+(e.adds?.length??0)})),K(this,`throttleMutations`,(function(e){if(e.type!==3||e.data.source!==0)return e;var t=e.data,r=n.numberOfChanges(t);t.attributes&&=t.attributes.filter((function(e){var t,r,i=ej(n.getNodeOrRelevantParent(e.id),2),a=i[0],o=i[1];return n.mutationBuckets[a]===0?!1:((n.mutationBuckets[a]=n.mutationBuckets[a]??n.bucketSize,n.mutationBuckets[a]=Math.max(n.mutationBuckets[a]-1,0),n.mutationBuckets[a]===0)&&(n.loggedTracker[a]||(n.loggedTracker[a]=!0,(t=(r=n.options).onBlockedNode)==null||t.call(r,a,o))),e)}));var i=n.numberOfChanges(t);return i!==0||r===i?e:void 0})),this.rrweb=t,this.options=r,this.refillRate=this.options.refillRate??this.refillRate,this.bucketSize=this.options.bucketSize??this.bucketSize,setInterval((function(){n.refillBuckets()}),1e3)})),JP=3e5,YP=[uP.MouseMove,uP.MouseInteraction,uP.Scroll,uP.ViewportResize,uP.Input,uP.TouchMove,uP.MediaInteraction,uP.Drag],XP=function(e){return{rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}},ZP=`[SessionRecording]`,QP=function(){function e(t){var n=this;if(W(this,e),K(this,`queuedRRWebEvents`,[]),K(this,`isIdle`,!1),K(this,`_linkedFlagSeen`,!1),K(this,`_lastActivityTimestamp`,Date.now()),K(this,`_linkedFlag`,null),K(this,`_forceAllowLocalhostNetworkCapture`,!1),K(this,`_onBeforeUnload`,(function(){n._flushBuffer()})),K(this,`_onOffline`,(function(){n._tryAddCustomEvent(`browser offline`,{})})),K(this,`_onOnline`,(function(){n._tryAddCustomEvent(`browser online`,{})})),K(this,`_onVisibilityChange`,(function(){if(Y!=null&&Y.visibilityState){var e=`window `+Y.visibilityState;n._tryAddCustomEvent(e,{})}})),K(this,`_samplingSessionListener`,null),this.instance=t,this._captureStarted=!1,this._endpoint=`/s/`,this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw X.error(ZP+` started without valid sessionManager`),Error(ZP+` started without valid sessionManager. This is a bug.`);var r=this.sessionManager.checkAndGetSessionAndWindowId(),i=r.sessionId,a=r.windowId;this.sessionId=i,this.windowId=a,this.buffer=this.clearBuffer(),this._setupSampling()}return G(e,[{key:`rrwebRecord`,get:function(){var e;return jj==null||(e=jj.rrweb)==null?void 0:e.record}},{key:`started`,get:function(){return this._captureStarted}},{key:`sessionManager`,get:function(){if(!this.instance.sessionManager)throw Error(ZP+` must be started with a valid sessionManager.`);return this.instance.sessionManager}},{key:`fullSnapshotIntervalMillis`,get:function(){return this.instance.config.session_recording?.full_snapshot_interval_millis||JP}},{key:`isSampled`,get:function(){var e=this.instance.get_property(lM);return yj(e)?e:null}},{key:`sessionDuration`,get:function(){var e=this.buffer?.data[this.buffer?.data.length-1],t=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return e?e.timestamp-t:null}},{key:`isRecordingEnabled`,get:function(){var e=!!this.instance.get_property(nM),t=!this.instance.config.disable_session_recording;return J&&e&&t}},{key:`isConsoleLogCaptureEnabled`,get:function(){var e=!!this.instance.get_property(rM);return this.instance.config.enable_recording_console_log??e}},{key:`canvasRecording`,get:function(){var e=this.instance.get_property(aM);return e&&e.fps&&e.quality?{enabled:e.enabled,fps:e.fps,quality:e.quality}:void 0}},{key:`networkPayloadCapture`,get:function(){var e=this.instance.get_property(iM),t={recordHeaders:this.instance.config.session_recording?.recordHeaders,recordBody:this.instance.config.session_recording?.recordBody},n=t?.recordHeaders||e?.recordHeaders,r=t?.recordBody||e?.recordBody,i=fj(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(yj(i)?i:e?.capturePerformance);return n||r||a?{recordHeaders:n,recordBody:r,recordPerformance:a}:void 0}},{key:`sampleRate`,get:function(){var e=this.instance.get_property(oM);return vj(e)?e:null}},{key:`minimumDuration`,get:function(){var e=this.instance.get_property(sM);return vj(e)?e:null}},{key:`status`,get:function(){return this.receivedDecide?this.isRecordingEnabled?_j(this._linkedFlag)||this._linkedFlagSeen?yj(this.isSampled)?this.isSampled?`sampled`:`disabled`:`active`:`buffering`:`disabled`:`buffering`}},{key:`startIfEnabledOrStop`,value:function(){this.isRecordingEnabled?(this._startCapture(),J?.addEventListener(`beforeunload`,this._onBeforeUnload),J?.addEventListener(`offline`,this._onOffline),J?.addEventListener(`online`,this._onOnline),J?.addEventListener(`visibilitychange`,this._onVisibilityChange),X.info(ZP+` started`)):(this.stopRecording(),this.clearBuffer(),clearInterval(this._fullSnapshotTimer))}},{key:`stopRecording`,value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,J?.removeEventListener(`beforeunload`,this._onBeforeUnload),J?.removeEventListener(`offline`,this._onOffline),J?.removeEventListener(`online`,this._onOnline),J?.removeEventListener(`visibilitychange`,this._onVisibilityChange),X.info(ZP+` stopped`))}},{key:`makeSamplingDecision`,value:function(e){var t,n=this.sessionId!==e,r=this.sampleRate;if(vj(r)){var i,a=this.isSampled,o=n||!yj(a);i=o?Math.random()<r:a,!i&&o&&X.warn(ZP+` Sample rate (${r}) has determined that this sessionId (${e}) will not be sent to the server.`),this._tryAddCustomEvent(`samplingDecisionMade`,{sampleRate:r}),(t=this.instance.persistence)==null||t.register(K({},lM,i))}else{var s;(s=this.instance.persistence)==null||s.register(K({},lM,null))}}},{key:`afterDecideResponse`,value:function(e){var t,n=this;if((this._persistDecideResponse(e),this._linkedFlag=e.sessionRecording?.linkedFlag||null,(t=e.sessionRecording)!=null&&t.endpoint)&&(this._endpoint=e.sessionRecording?.endpoint),this._setupSampling(),!_j(this._linkedFlag)&&!this._linkedFlagSeen){var r=mj(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,i=mj(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((function(e,t){var a=fj(t)&&r in t,o=i?t[r]===i:a;if(o){var s={linkedFlag:r,linkedVariant:i},c=`linked flag matched`;X.info(ZP+` `+c,s),n._tryAddCustomEvent(c,s)}n._linkedFlagSeen=o}))}this.receivedDecide=!0,this.startIfEnabledOrStop()}},{key:`_setupSampling`,value:function(){var e=this;vj(this.sampleRate)&&gj(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((function(t){e.makeSamplingDecision(t)})))}},{key:`_persistDecideResponse`,value:function(e){if(this.instance.persistence){var t=this.instance.persistence,n=function(){var n,r=e.sessionRecording?.sampleRate,i=_j(r)?null:parseFloat(r),a=e.sessionRecording?.minimumDurationMilliseconds;t.register((K(n={},nM,!!e.sessionRecording),K(n,rM,e.sessionRecording?.consoleLogRecordingEnabled),K(n,iM,U({capturePerformance:e.capturePerformance},e.sessionRecording?.networkPayloadCapture)),K(n,aM,{enabled:e.sessionRecording?.recordCanvas,fps:e.sessionRecording?.canvasFps,quality:e.sessionRecording?.canvasQuality}),K(n,oM,i),K(n,sM,q(a)?null:a),n))};n(),this.sessionManager.onSessionId(n)}}},{key:`log`,value:function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`log`;(t=this.instance.sessionRecording)==null||t.onRRwebEmit({type:6,data:{plugin:`rrweb/console@1`,payload:{level:n,trace:[],payload:[JSON.stringify(e)]}},timestamp:Rj()})}},{key:`_startCapture`,value:function(){var e=this;q(Object.assign)||this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut()||(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():this.instance.requestRouter.loadScript(`/static/recorder.js?v=${aj.LIB_VERSION}`,(function(t){if(t)return X.error(ZP+` could not load recorder.js`,t);e._onScriptLoaded()})))}},{key:`isInteractiveEvent`,value:function(e){return e.type===3&&YP.indexOf(e.data?.source)!==-1}},{key:`_updateWindowAndSessionIds`,value:function(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>3e5&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._flushBuffer());var n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent(`sessionNoLongerIdle`,{reason:`user activity`,type:e.type}),n=!0)),!this.isIdle){var r=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),i=r.windowId,a=r.sessionId,o=this.sessionId!==a,s=this.windowId!==i;this.windowId=i,this.sessionId=a,(n||[oP,sP].indexOf(e.type)===-1&&(s||o||q(this._fullSnapshotTimer)))&&this._tryTakeFullSnapshot()}}},{key:`_tryRRWebMethod`,value:function(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):X.warn(ZP+` could not emit queued rrweb event.`,t,e),!1}}},{key:`_tryAddCustomEvent`,value:function(e,t){var n=this;return this._tryRRWebMethod(XP((function(){return n.rrwebRecord.addCustomEvent(e,t)})))}},{key:`_tryTakeFullSnapshot`,value:function(){var e=this;return this._tryRRWebMethod(XP((function(){return e.rrwebRecord.takeFullSnapshot()})))}},{key:`_onScriptLoaded`,value:function(){for(var e=this,t={blockClass:`ph-no-capture`,blockSelector:void 0,ignoreClass:`ph-ignore-input`,maskTextClass:`ph-mask`,maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},n=this.instance.config.session_recording,r=0,i=Object.entries(n||{});r<i.length;r++){var a=ej(i[r],2),o=a[0],s=a[1];o in t&&(o===`maskInputOptions`?t.maskInputOptions=U({password:!0},s):t[o]=s)}if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:`image/webp`,quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=this.mutationRateLimiter??new qP(this.rrwebRecord,{onBlockedNode:function(t,n){var r=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;X.info(r,{node:n}),e.log(ZP+` `+r,`warn`)}});var c=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(U({emit:function(t){e.onRRwebEmit(t)},plugins:c},t)),this.instance._addCaptureHook((function(t){try{if(t===`$pageview`){var n=J?e._maskUrl(J.location.href):``;if(!n)return;e._tryAddCustomEvent(`$pageview`,{href:n})}}catch(e){X.error(`Could not add $pageview to rrweb session`,e)}})),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent(`$session_options`,{sessionRecordingOptions:t,activePlugins:c.map((function(e){return e?.name}))}),this._tryAddCustomEvent(`$posthog_config`,{config:this.instance.config})}else X.error(ZP+`onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.`)}},{key:`_scheduleFullSnapshot`,value:function(){var e=this;if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval((function(){e._tryTakeFullSnapshot()}),t))}}},{key:`_gatherRRWebPlugins`,value:function(){var e=[];return(jj.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&e.push(jj.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&dj(jj.getRecordNetworkPlugin))&&(!$M.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(jj.getRecordNetworkPlugin(KP(this.instance.config,this.networkPayloadCapture))):X.info(ZP+` NetworkCapture not started because we are on localhost.`)),e}},{key:`onRRwebEmit`,value:function(e){if(this._processQueuedEvents(),e&&fj(e)){if(e.type===lP.Meta){var t=this._maskUrl(e.data.href);if(this._lastHref=t,!t)return;e.data.href=t}else this._pageViewFallBack();e.type===lP.FullSnapshot&&this._scheduleFullSnapshot();var n=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(n){var r=function(e){var t=e;if(t&&fj(t)&&t.type===6&&fj(t.data)&&t.data.plugin===`rrweb/console@1`){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push(`...[truncated]`));for(var n=[],r=0;r<t.data.payload.payload.length;r++)t.data.payload.payload[r]&&t.data.payload.payload[r].length>2e3?n.push(t.data.payload.payload[r].slice(0,2e3)+`...[truncated]`):n.push(t.data.payload.payload[r]);return t.data.payload.payload=n,e}return e}(n),i=aP(r);if(this._updateWindowAndSessionIds(r),!this.isIdle||r.type===lP.Custom){var a={$snapshot_bytes:i,$snapshot_data:r,$session_id:this.sessionId,$window_id:this.windowId};this.status===`disabled`?this.clearBuffer():this._captureSnapshotBuffered(a)}}}}},{key:`_pageViewFallBack`,value:function(){if(!this.instance.config.capture_pageview&&J){var e=this._maskUrl(J.location.href);this._lastHref!==e&&(this._tryAddCustomEvent(`$url_changed`,{href:e}),this._lastHref=e)}}},{key:`_processQueuedEvents`,value:function(){var e=this;if(this.queuedRRWebEvents.length){var t=tj(this.queuedRRWebEvents);this.queuedRRWebEvents=[],t.forEach((function(t){Date.now()-t.enqueuedAt<=2e3&&e._tryRRWebMethod(t)}))}}},{key:`_maskUrl`,value:function(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var n={url:e};return(n=t.maskNetworkRequestFn(n))?.url}return e}},{key:`clearBuffer`,value:function(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}},{key:`_flushBuffer`,value:function(){var e=this;this.flushBufferTimer&&=(clearTimeout(this.flushBufferTimer),void 0);var t=this.minimumDuration,n=this.sessionDuration,r=vj(n)&&n>=0,i=vj(t)&&r&&n<t;return this.status===`buffering`||i?(this.flushBufferTimer=setTimeout((function(){e._flushBuffer()}),2e3),this.buffer):(this.buffer.data.length>0&&cP(this.buffer).forEach((function(t){e._captureSnapshot({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId})})),this.clearBuffer())}},{key:`_captureSnapshotBuffered`,value:function(e){var t=this,n=2+(this.buffer?.data.length||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+n>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((function(){t._flushBuffer()}),2e3))}},{key:`_captureSnapshot`,value:function(e){this.instance.capture(`$snapshot`,e,{_url:this.instance.requestRouter.endpointFor(`api`,this._endpoint),_noTruncate:!0,_batchKey:`recordings`,skip_client_rate_limiting:!0})}},{key:`overrideLinkedFlag`,value:function(){this._linkedFlagSeen=!0}}]),e}(),$P=function(){function e(t){W(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return G(e,[{key:`call`,value:function(){var e=this,t={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(fM),group_properties:this.instance.get_property(pM),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:`POST`,url:this.instance.requestRouter.endpointFor(`api`,`/decide/?v=3`),data:t,compression:this.instance.config.disable_compression?void 0:Wj.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(t){return e.parseDecideResponse(t.json)}})}},{key:`parseDecideResponse`,value:function(e){var t=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var n=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e??{},n),n)X.error(`Failed to fetch feature flags from PostHog.`);else{if(!Y||!Y.body)return X.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((function(){t.parseDecideResponse(e)}),500);if(this.instance._afterDecideResponse(e),e.siteApps)if(this.instance.config.opt_in_site_apps){var r,i=ij(e.siteApps);try{var a=function(){var e=r.value,n=e.id,i=e.url,a=t.instance.requestRouter.endpointFor(`api`,i);jj[`__\$\$ph_site_app_${n}`]=t.instance,t.instance.requestRouter.loadScript(a,(function(e){if(e)return X.error(`Error while initializing PostHog app with config id ${n}`,e)}))};for(i.s();!(r=i.n()).done;)a()}catch(e){i.e(e)}finally{i.f()}}else e.siteApps.length>0&&X.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}}]),e}(),eF=J!=null&&J.location?iN(J.location.hash,`__posthog`)||iN(location.hash,`state`):null,tF=`_postHogToolbarParams`;(function(e){e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.LOADING=1]=`LOADING`,e[e.LOADED=2]=`LOADED`})(GP||={});var nF=function(){function e(t){W(this,e),this.instance=t}return G(e,[{key:`setToolbarState`,value:function(e){jj.ph_toolbar_state=e}},{key:`getToolbarState`,value:function(){return jj.ph_toolbar_state??GP.UNINITIALIZED}},{key:`maybeLoadToolbar`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!J||!Y)return!1;e??=J.location,n??=J.history;try{if(!t){try{J.localStorage.setItem(`test`,`test`),J.localStorage.removeItem(`test`)}catch{return!1}t=J?.localStorage}var r,i=eF||iN(e.hash,`__posthog`)||iN(e.hash,`state`),a=i?zj((function(){return JSON.parse(atob(decodeURIComponent(i)))}))||zj((function(){return JSON.parse(decodeURIComponent(i))})):null;return a&&a.action===`ph_authorize`?((r=a).source=`url`,r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):((r=JSON.parse(t.getItem(tF)||`{}`)).source=`localstorage`,delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}},{key:`_callLoadToolbar`,value:function(e){(jj.ph_load_toolbar||jj.ph_load_editor)(e,this.instance)}},{key:`loadToolbar`,value:function(e){var t=this,n=!(Y==null||!Y.getElementById(wM));if(!J||n)return!1;var r=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,i=U(U({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor(`ui`)},r?{instrument:!1}:{});if(J.localStorage.setItem(tF,JSON.stringify(U(U({},i),{},{source:void 0}))),this.getToolbarState()===GP.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===GP.UNINITIALIZED){this.setToolbarState(GP.LOADING);var a=3e5,o=Math.floor(Date.now()/a)*a;this.instance.requestRouter.loadScript(`/static/toolbar.js?t=${o}`,(function(e){if(e)return X.error(`Failed to load toolbar`,e),void t.setToolbarState(GP.UNINITIALIZED);t.setToolbarState(GP.LOADED),t._callLoadToolbar(i)})),Kj(J,`turbolinks:load`,(function(){t.setToolbarState(GP.UNINITIALIZED),t.loadToolbar(i)}))}return!0}},{key:`_loadEditor`,value:function(e){return this.loadToolbar(e)}},{key:`maybeLoadEditor`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,n)}}]),e}(),rF=function(){function e(t){W(this,e),K(this,`isPaused`,!0),K(this,`queue`,[]),K(this,`flushTimeoutMs`,3e3),this.sendRequest=t}return G(e,[{key:`enqueue`,value:function(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}},{key:`unload`,value:function(){var e=this;this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t);[].concat(tj(n.filter((function(e){return e.url.indexOf(`/e`)===0}))),tj(n.filter((function(e){return e.url.indexOf(`/e`)!==0})))).map((function(t){e.sendRequest(U(U({},t),{},{transport:`sendBeacon`}))}))}},{key:`enable`,value:function(){this.isPaused=!1,this.setFlushTimeout()}},{key:`setFlushTimeout`,value:function(){var e=this;this.isPaused||(this.flushTimeout=setTimeout((function(){if(e.clearFlushTimeout(),e.queue.length>0){var t=e.formatQueue(),n=function(n){var r=t[n],i=new Date().getTime();r.data&&uj(r.data)&&Z(r.data,(function(e){e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.sendRequest(r)};for(var r in t)n(r)}}),this.flushTimeoutMs))}},{key:`clearFlushTimeout`,value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:`formatQueue`,value:function(){var e={};return Z(this.queue,(function(t){var n,r=t,i=(r?r.batchKey:null)||r.url;q(e[i])&&(e[i]=U(U({},r),{},{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.queue=[],e}}]),e}(),iF=Uint8Array,aF=Uint16Array,oF=Uint32Array,sF=new iF([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cF=new iF([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),lF=new iF([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),uF=function(e,t){for(var n=new aF(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new oF(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},dF=uF(sF,2),fF=dF[0],pF=dF[1];fF[28]=258,pF[258]=28;for(var mF=uF(cF,0)[1],hF=new aF(32768),$=0;$<32768;++$){var gF=(43690&$)>>>1|(21845&$)<<1;gF=(61680&(gF=(52428&gF)>>>2|(13107&gF)<<2))>>>4|(3855&gF)<<4,hF[$]=((65280&gF)>>>8|(255&gF)<<8)>>>1}var _F=function(e,t,n){for(var r=e.length,i=0,a=new aF(t);i<r;++i)++a[e[i]-1];var o,s=new aF(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new aF(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)o[hF[d]>>>c]=l}else for(o=new aF(r),i=0;i<r;++i)o[i]=hF[s[e[i]-1]++]>>>15-e[i];return o},vF=new iF(288);for($=0;$<144;++$)vF[$]=8;for($=144;$<256;++$)vF[$]=9;for($=256;$<280;++$)vF[$]=7;for($=280;$<288;++$)vF[$]=8;var yF=new iF(32);for($=0;$<32;++$)yF[$]=5;var bF=_F(vF,9,0),xF=_F(yF,5,0),SF=function(e){return(e/8>>0)+(7&e&&1)},CF=function(e,t,n){(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof aF?aF:e instanceof oF?oF:iF)(n-t);return r.set(e.subarray(t,n)),r},wF=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},TF=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},EF=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new iF(0),0];if(i==1){var o=new iF(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new aF(f+1),m=DF(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<i;++r){var v=a[r].s;if(!(p[v]>t))break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return[new iF(p),m]},DF=function e(t,n,r){return t.s==-1?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},OF=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new aF(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},kF=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},AF=function(e,t,n){var r=n.length,i=SF(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},jF=function(e,t,n,r,i,a,o,s,c,l,u){wF(t,u++,n),++i[256];for(var d=EF(i,15),f=d[0],p=d[1],m=EF(a,15),h=m[0],g=m[1],_=OF(f),v=_[0],y=_[1],b=OF(h),x=b[0],S=b[1],C=new aF(19),w=0;w<v.length;++w)C[31&v[w]]++;for(w=0;w<x.length;++w)C[31&x[w]]++;for(var T=EF(C,7),E=T[0],D=T[1],O=19;O>4&&!E[lF[O-1]];--O);var k,A,j,M,N=l+5<<3,ee=kF(i,vF)+kF(a,yF)+o,te=kF(i,f)+kF(a,h)+o+14+3*O+kF(C,E)+(2*C[16]+3*C[17]+7*C[18]);if(N<=ee&&N<=te)return AF(t,u,e.subarray(c,c+l));if(wF(t,u,1+(te<ee)),u+=2,te<ee){k=_F(f,p,0),A=f,j=_F(h,g,0),M=h;var ne=_F(E,D,0);for(wF(t,u,y-257),wF(t,u+5,S-1),wF(t,u+10,O-4),u+=14,w=0;w<O;++w)wF(t,u+3*w,E[lF[w]]);u+=3*O;for(var re=[v,x],ie=0;ie<2;++ie){var ae=re[ie];for(w=0;w<ae.length;++w){var oe=31&ae[w];wF(t,u,ne[oe]),u+=E[oe],oe>15&&(wF(t,u,ae[w]>>>5&127),u+=ae[w]>>>12)}}}else k=bF,A=vF,j=xF,M=yF;for(w=0;w<s;++w)if(r[w]>255){oe=r[w]>>>18&31,TF(t,u,k[oe+257]),u+=A[oe+257],oe>7&&(wF(t,u,r[w]>>>23&31),u+=sF[oe]);var se=31&r[w];TF(t,u,j[se]),u+=M[se],se>3&&(TF(t,u,r[w]>>>5&8191),u+=cF[se])}else TF(t,u,k[r[w]]),u+=A[r[w]];return TF(t,u,k[256]),u+A[256]},MF=new oF([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),NF=new iF(0),PF=function(){for(var e=new oF(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),FF=function(e,t,n,r,i){return function(e,t,n,r,i,a){var o=e.length,s=new iF(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=AF(c,l,e.subarray(u,d)):(c[u]=a,l=AF(c,l,e.subarray(u,o)))}else{for(var f=MF[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new aF(32768),_=new aF(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new oF(25e3),S=new aF(288),C=new aF(32),w=0,T=0,E=(u=0,0),D=0,O=0;u<o;++u){var k=b(u),A=32767&u,j=_[k];if(g[A]=j,_[k]=A,D<=u){var M=o-u;if((w>7e3||E>24576)&&M>423){l=jF(e,c,0,x,S,C,T,E,O,u-O,l),E=w=T=0,O=u;for(var N=0;N<286;++N)S[N]=0;for(N=0;N<30;++N)C[N]=0}var ee=2,te=0,ne=m,re=A-j&32767;if(M>2&&k==b(u-re))for(var ie=Math.min(p,M)-1,ae=Math.min(32767,u),oe=Math.min(258,M);re<=ae&&--ne&&A!=j;){if(e[u+ee]==e[u+ee-re]){for(var se=0;se<oe&&e[u+se]==e[u+se-re];++se);if(se>ee){if(ee=se,te=re,se>ie)break;var ce=Math.min(re,se-2),le=0;for(N=0;N<ce;++N){var ue=u-re+N+32768&32767,de=ue-g[ue]+32768&32767;de>le&&(le=de,j=ue)}}}re+=(A=j)-(j=g[A])+32768&32767}if(te){x[E++]=268435456|pF[ee]<<18|mF[te];var fe=31&pF[ee],pe=31&mF[te];T+=sF[fe]+cF[pe],++S[257+fe],++C[pe],D=u+ee,++w}else x[E++]=e[u],++S[e[u]]}}l=jF(e,c,a,x,S,C,T,E,O,u-O,l),a||(l=AF(c,l,NF))}return CF(s,0,r+SF(l)+i)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!i)},IF=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function LF(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=PF[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a=FF(e,t,10+((i=t).filename&&i.filename.length+1||0),8),o=a.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&IF(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}}(a,t),IF(a,o-8,n.d()),IF(a,o-4,r),a}var RF=!!Oj||!!Dj,zF=`text/plain`,BF=function(e,t){var n=ej(e.split(`?`),2),r=n[0],i=n[1],a=U({},t);i?.split(`&`).forEach((function(e){var t=ej(e.split(`=`),1)[0];delete a[t]}));var o=nN(a);return o=o?(i?i+`&`:``)+o:i,`${r}?${o}`},VF=function(e){return`data=`+encodeURIComponent(typeof e==`string`?e:JSON.stringify(e))},HF=function(e){var t=e.data,n=e.compression;if(t){if(n===Wj.GZipJS){var r=LF(function(e,t){var n=e.length;if(!t&&typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new iF(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new iF(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);c<128||t?a(c):c<2048?(a(192|c>>>6),a(128|63&c)):c>55295&&c<57344?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return CF(r,0,i)}(JSON.stringify(t)),{mtime:0});return{contentType:zF,body:new Blob([r],{type:zF})}}return n===Wj.Base64?{contentType:`application/x-www-form-urlencoded`,body:VF(function(e){var t,n,r,i,a,o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,s=0,c=0,l=``,u=[];if(!e)return e;e=Gj(e);do t=(a=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=a>>12&63,r=a>>6&63,i=63&a,u[c++]=o.charAt(t)+o.charAt(n)+o.charAt(r)+o.charAt(i);while(s<e.length);switch(l=u.join(``),e.length%3){case 1:l=l.slice(0,-2)+`==`;break;case 2:l=l.slice(0,-1)+`=`}return l}(JSON.stringify(t)))}:{contentType:`application/json`,body:JSON.stringify(t)}}},UF=[];Oj&&UF.push({transport:`XHR`,method:function(e){var t=new Oj;t.open(e.method||`GET`,e.url,!0);var n=HF(e)??{},r=n.contentType,i=n.body;Z(e.headers,(function(e,n){t.setRequestHeader(n,e)})),r&&t.setRequestHeader(`Content-Type`,r),e.timeout&&(t.timeout=e.timeout),t.withCredentials=!0,t.onreadystatechange=function(){if(t.readyState===4){var n,r={statusCode:t.status,text:t.responseText};if(t.status===200)try{r.json=JSON.parse(t.responseText)}catch{}(n=e.callback)==null||n.call(e,r)}},t.send(i)}}),Dj&&UF.push({transport:`fetch`,method:function(e){var t=HF(e)??{},n=t.contentType,r=t.body,i=new Headers;Z(e.headers,(function(e,t){i.append(t,e)})),n&&i.append(`Content-Type`,n);var a=e.url,o=null;if(kj){var s=new kj;o={signal:s.signal,timeout:setTimeout((function(){return s.abort()}),e.timeout)}}Dj(a,{method:e?.method||`GET`,headers:i,keepalive:e.method===`POST`,body:r,signal:o?.signal}).then((function(t){return t.text().then((function(n){var r,i={statusCode:t.status,text:n};if(t.status===200)try{i.json=JSON.parse(n)}catch(e){X.error(e)}(r=e.callback)==null||r.call(e,i)}))})).catch((function(t){var n;X.error(t),(n=e.callback)==null||n.call(e,{statusCode:0,text:t})})).finally((function(){return o?clearTimeout(o.timeout):null}))}}),Tj!=null&&Tj.sendBeacon&&UF.push({transport:`sendBeacon`,method:function(e){var t=BF(e.url,{beacon:`1`});try{var n=HF(e)??{},r=n.contentType,i=n.body,a=typeof i==`string`?new Blob([i],{type:r}):i;Tj.sendBeacon(t,a)}catch{}}});var WF=[`retriesPerformedSoFar`],GF,KF=function(){function e(t){var n=this;W(this,e),K(this,`isPolling`,!1),K(this,`pollIntervalMs`,3e3),K(this,`queue`,[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!q(J)&&`onLine`in J.navigator&&(this.areWeOnline=J.navigator.onLine,J.addEventListener(`online`,(function(){n.areWeOnline=!0,n.flush()})),J.addEventListener(`offline`,(function(){n.areWeOnline=!1})))}return G(e,[{key:`retriableRequest`,value:function(e){var t=this,n=e.retriesPerformedSoFar,r=$A(e,WF);vj(n)&&n>0&&(r.url=BF(r.url,{retry_count:n})),this.instance._send_request(U(U({},r),{},{callback:function(e){var i;e.statusCode!==200&&(e.statusCode<400||e.statusCode>=500)&&(n??0)<10?t.enqueue(U({retriesPerformedSoFar:n},r)):(i=r.callback)==null||i.call(r,e)}}))}},{key:`enqueue`,value:function(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=Date.now()+n;this.queue.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in ${n}`;navigator.onLine||(i+=` (Browser is offline)`),X.warn(i),this.isPolling||(this.isPolling=!0,this.poll())}},{key:`poll`,value:function(){var e=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout((function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()}),this.pollIntervalMs)}},{key:`flush`,value:function(){var e=Date.now(),t=[],n=this.queue.filter((function(n){return n.retryAt<e||(t.push(n),!1)}));if(this.queue=t,n.length>0){var r,i=ij(n);try{for(i.s();!(r=i.n()).done;){var a=r.value.requestOptions;this.retriableRequest(a)}}catch(e){i.e(e)}finally{i.f()}}}},{key:`unload`,value:function(){this.poller&&=(clearTimeout(this.poller),void 0);var e,t=ij(this.queue);try{for(t.s();!(e=t.n()).done;){var n=e.value.requestOptions;try{this.instance._send_request(U(U({},n),{},{transport:`sendBeacon`}))}catch(e){X.error(e)}}}catch(e){t.e(e)}finally{t.f()}this.queue=[]}}]),e}(),qF=1800,JF=function(){function e(t,n,r,i){var a;W(this,e),K(this,`_sessionIdChangedHandlers`,[]),this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=r||LM,this._windowIdGenerator=i||LM;var o=t.persistence_name||t.token,s=t.session_idle_timeout_seconds||qF;if(vj(s)?s>qF?X.warn(`session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead.`):s<60&&X.warn(`session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead.`):(X.warn(`session_idle_timeout_seconds must be a number. Defaulting to 30 minutes.`),s=qF),this._sessionTimeoutMs=1e3*Math.min(Math.max(s,60),qF),this._window_id_storage_key=`ph_`+o+`_window_id`,this._primary_window_exists_storage_key=`ph_`+o+`_primary_window_exists`,this._canUseSessionStorage()){var c=QM.parse(this._window_id_storage_key),l=QM.parse(this._primary_window_exists_storage_key);c&&!l?this._windowId=c:QM.remove(this._window_id_storage_key),QM.set(this._primary_window_exists_storage_key,!0)}if((a=this.config.bootstrap)!=null&&a.sessionID)try{var u=function(e){var t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),u)}catch(e){X.error(`Invalid sessionID in bootstrap`,e)}this._listenToReloadWindow()}return G(e,[{key:`onSessionId`,value:function(e){var t=this;return q(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),function(){t._sessionIdChangedHandlers=t._sessionIdChangedHandlers.filter((function(t){return t!==e}))}}},{key:`_canUseSessionStorage`,value:function(){return this.config.persistence!==`memory`&&!this.persistence.disabled&&QM.is_supported()}},{key:`_setWindowId`,value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&QM.set(this._window_id_storage_key,e))}},{key:`_getWindowId`,value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?QM.parse(this._window_id_storage_key):null}},{key:`_setSessionId`,value:function(e,t,n){e===this._sessionId&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register(K({},cM,[t,e,n])))}},{key:`_getSessionId`,value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[cM];return uj(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}},{key:`resetSessionId`,value:function(){this._setSessionId(null,null,null)}},{key:`_listenToReloadWindow`,value:function(){var e=this;J?.addEventListener(`beforeunload`,(function(){e._canUseSessionStorage()&&QM.remove(e._primary_window_exists_storage_key)}))}},{key:`checkAndGetSessionAndWindowId`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),n=ej(this._getSessionId(),3),r=n[0],i=n[1],a=n[2],o=this._getWindowId(),s=a&&a>0&&Math.abs(t-a)>864e5,c=!1,l=!i,u=!e&&Math.abs(t-r)>this._sessionTimeoutMs;l||u||s?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),X.info(`[SessionId] new session ID generated`,{sessionId:i,windowId:o,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}}),a=t,c=!0):o||(o=this._windowIdGenerator(),c=!0);var d=r===0||!e||s?t:r,f=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(i,d,f),c&&this._sessionIdChangedHandlers.forEach((function(e){return e(i,o)})),{sessionId:i,windowId:o,sessionStartTimestamp:f}}}]),e}();(function(e){e.US=`us`,e.EU=`eu`,e.CUSTOM=`custom`})(GF||={});var YF=`i.posthog.com`,XF=function(){function e(t){W(this,e),K(this,`_regionCache`,{}),this.instance=t}return G(e,[{key:`apiHost`,get:function(){var e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}},{key:`uiHost`,get:function(){var e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.${YF}`,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}},{key:`region`,get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=GF.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=GF.EU:this._regionCache[this.apiHost]=GF.CUSTOM),this._regionCache[this.apiHost]}},{key:`endpointFor`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``;if(t&&=t[0]===`/`?t:`/${t}`,e===`ui`)return this.uiHost+t;if(this.region===GF.CUSTOM)return this.apiHost+t;var n=YF+t;switch(e){case`assets`:return`https://${this.region}-assets.${n}`;case`api`:return`https://${this.region}.${n}`}}},{key:`loadScript`,value:function(e,t){if(this.instance.config.disable_external_dependency_loading)return X.warn(`${e} was requested but loading of external scripts is disabled.`),t(`Loading of external scripts is disabled`);var n=e[0]===`/`?this.endpointFor(`assets`,e):e,r=function(){if(!Y)return t(`document not found`);var e=Y.createElement(`script`);e.type=`text/javascript`,e.src=n,e.onload=function(e){return t(void 0,e)},e.onerror=function(e){return t(e)};var r,i=Y.querySelectorAll(`body > script`);i.length>0?(r=i[0].parentNode)==null||r.insertBefore(e,i[0]):Y.body.appendChild(e)};Y!=null&&Y.body?r():Y?.addEventListener(`DOMContentLoaded`,r)}}]),e}(),ZF=`posthog-js`;function QF(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.organization,r=t.projectId,i=t.prefix,a=t.severityAllowList,o=a===void 0?[`error`]:a;return function(t){if(!(o===`*`||o.includes(t.level))||!e.__loaded)return t;t.tags||={};var a=e.requestRouter.endpointFor(`ui`,`/project/${e.config.token}/person/${e.get_distinct_id()}`);t.tags[`PostHog Person URL`]=a,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var s=t.exception?.values||[],c={$exception_message:s[0]?.value||t.message,$exception_type:s[0]?.type,$exception_personURL:a,$exception_level:t.level,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:s[0]?.value||t.message,$sentry_exception_type:s[0]?.type,$sentry_tags:t.tags,$level:t.level};return n&&r&&(c.$sentry_url=(i||`https://sentry.io/organizations/`)+n+`/issues/?project=`+r+`&query=`+t.event_id),e.exceptions.sendExceptionEvent(c),t}}var $F=G((function e(t,n,r,i,a){W(this,e),this.name=ZF,this.setupOnce=function(e){e(QF(t,{organization:n,projectId:r,prefix:i,severityAllowList:a}))}}));function eI(e,t){var n=e.config.segment;if(!n)return t();(function(e,t){var n=e.config.segment;if(!n)return t();var r=function(n){var r=function(){return n.anonymousId()||LM()};e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(_M,`identified`)),t()},i=n.user();`then`in i&&dj(i.then)?i.then((function(e){return r(e)})):r(i)})(e,(function(){n.register(function(e){Promise&&Promise.resolve||X.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=function(t,n){if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(X.info(`Segment integration does not have a userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(X.info(`Segment integration has a userId set, identifying with PostHog`),e.identify(t.event.userId));var r=e._calculate_event_properties(n,t.event.properties??{},new Date);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,`$pageview`)},identify:function(e){return t(e,`$identify`)},screen:function(e){return t(e,`$screen`)}}}(e)).then((function(){t()}))}))}var tI,nI,rI,iI=function(){function e(t){W(this,e),this._instance=t}return G(e,[{key:`doPageView`,value:function(e){var t=this._previousPageViewProperties(e);return this._currentPath=J?.location.pathname??``,this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=e,t}},{key:`doPageLeave`,value:function(e){return this._previousPageViewProperties(e)}},{key:`_previousPageViewProperties`,value:function(e){var t=this._currentPath,n=this._prevPageviewTimestamp,r=this._instance.scrollManager.getContext();if(!n)return{};var i={};if(r){var a=r.maxScrollHeight,o=r.lastScrollY,s=r.maxScrollY,c=r.maxContentHeight,l=r.lastContentY,u=r.maxContentY;q(a)||q(o)||q(s)||q(c)||q(l)||q(u)||(a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u),i={$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:a<=1?1:aI(o/a,0,1),$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:a<=1?1:aI(s/a,0,1),$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:c<=1?1:aI(l/c,0,1),$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:c<=1?1:aI(u/c,0,1)})}return t&&(i.$prev_pageview_pathname=t),n&&(i.$prev_pageview_duration=(e.getTime()-n.getTime())/1e3),i}}]),e}();function aI(e,t,n){return Math.max(t,Math.min(e,n))}(function(e){e.Popover=`popover`,e.API=`api`,e.Widget=`widget`})(tI||={}),function(e){e.Open=`open`,e.MultipleChoice=`multiple_choice`,e.SingleChoice=`single_choice`,e.Rating=`rating`,e.Link=`link`}(nI||={}),function(e){e.NextQuestion=`next_question`,e.End=`end`,e.ResponseBased=`response_based`,e.SpecificQuestion=`specific_question`}(rI||={});var oI=function(){function e(){W(this,e),K(this,`events`,{}),this.events={}}return G(e,[{key:`on`,value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter((function(e){return e!==t}))}}},{key:`emit`,value:function(e,t){var n,r=ij(this.events[e]||[]);try{for(r.s();!(n=r.n()).done;)(0,n.value)(t)}catch(e){r.e(e)}finally{r.f()}var i,a=ij(this.events[`*`]||[]);try{for(a.s();!(i=a.n()).done;)(0,i.value)(e,t)}catch(e){a.e(e)}finally{a.f()}}}]),e}(),sI=function(){function e(t){var n=this;W(this,e),K(this,`_debugEventEmitter`,new oI),K(this,`checkStep`,(function(e,t){return n.checkStepEvent(e,t)&&n.checkStepUrl(e,t)&&n.checkStepElement(e,t)})),K(this,`checkStepEvent`,(function(e,t){return t==null||!t.event||e?.event===t?.event})),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}return G(e,[{key:`init`,value:function(){var e=this;if(!q(this.instance?._addCaptureHook)){var t;(t=this.instance)==null||t._addCaptureHook((function(t,n){e.on(t,n)}))}}},{key:`register`,value:function(e){var t,n=this;if(!q(this.instance?._addCaptureHook)&&(e.forEach((function(e){var t,r;(t=n.actionRegistry)==null||t.add(e),(r=e.steps)==null||r.forEach((function(e){var t;(t=n.actionEvents)==null||t.add(e?.event||``)}))})),(t=this.instance)!=null&&t.autocapture)){var r,i=new Set;e.forEach((function(e){var t;(t=e.steps)==null||t.forEach((function(e){e!=null&&e.selector&&i.add(e?.selector)}))})),(r=this.instance)==null||r.autocapture.setElementSelectors(i)}}},{key:`on`,value:function(e,t){var n=this;t!=null&&e.length!=0&&(this.actionEvents.has(e)||this.actionEvents.has(t?.event))&&this.actionRegistry&&this.actionRegistry?.size>0&&this.actionRegistry.forEach((function(e){n.checkAction(t,e)&&n._debugEventEmitter.emit(`actionCaptured`,e.name)}))}},{key:`_addActionHook`,value:function(e){this.onAction(`actionCaptured`,(function(t){return e(t)}))}},{key:`checkAction`,value:function(e,t){if(t?.steps==null)return!1;var n,r=ij(t.steps);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(this.checkStep(e,i))return!0}}catch(e){r.e(e)}finally{r.f()}return!1}},{key:`onAction`,value:function(e,t){return this._debugEventEmitter.on(e,t)}},{key:`checkStepUrl`,value:function(t,n){if(n!=null&&n.url){var r,i=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!i||typeof i!=`string`||!e.matchString(i,n?.url,n?.url_matching||`contains`))return!1}return!0}},{key:`checkStepElement`,value:function(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(t).some((function(t){return!(n!=null&&n.href&&!e.matchString(t.href||``,n?.href,n?.href_matching||`exact`))&&(n==null||!n.tag_name||t.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!e.matchString(t.text||``,n?.text,n?.text_matching||`exact`)&&!e.matchString(t.$el_text||``,n?.text,n?.text_matching||`exact`))})))return!1;if(n!=null&&n.selector){var r,i=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(!i||!i.includes(n?.selector))return!1}return!0}},{key:`getElementsList`,value:function(e){return e?.properties.$elements==null?[]:e?.properties.$elements}}],[{key:`matchString`,value:function(t,n,r){switch(r){case`regex`:return!!J&&tN(t,n);case`exact`:return n===t;case`contains`:return tN(t,e.escapeStringRegexp(n).replace(/_/g,`.`).replace(/%/g,`.*`));default:return!1}}},{key:`escapeStringRegexp`,value:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}}]),e}(),cI=function(){function e(t){W(this,e),this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}return G(e,[{key:`register`,value:function(e){q(this.instance?._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}},{key:`setupActionBasedSurveys`,value:function(e){var t=this,n=e.filter((function(e){var t,n,r;return e.conditions?.actions&&((t=e.conditions)==null||(n=t.actions)==null||(r=n.values)==null?void 0:r.length)>0}));n.length!==0&&(this.actionMatcher??(this.actionMatcher=new sI(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook((function(e){t.onAction(e)}))),n.forEach((function(e){var n,r,i,a,o,s,c,l,u,d;e.conditions&&(n=e.conditions)!=null&&n.actions&&(r=e.conditions)!=null&&(i=r.actions)!=null&&i.values&&((a=e.conditions)==null||(o=a.actions)==null||(s=o.values)==null?void 0:s.length)>0&&((c=t.actionMatcher)==null||c.register(e.conditions.actions.values),(l=e.conditions)==null||(u=l.actions)==null||(d=u.values)==null||d.forEach((function(n){if(n&&n.name){var r=t.actionToSurveys.get(n.name);r&&r.push(e.id),t.actionToSurveys.set(n.name,r||[e.id])}})))})))}},{key:`setupEventBasedSurveys`,value:function(e){var t,n=this;e.filter((function(e){var t,n,r;return e.conditions?.events&&((t=e.conditions)==null||(n=t.events)==null||(r=n.values)==null?void 0:r.length)>0})).length!==0&&((t=this.instance)==null||t._addCaptureHook((function(e,t){n.onEvent(e,t)})),e.forEach((function(e){var t,r,i;(t=e.conditions)==null||(r=t.events)==null||(i=r.values)==null||i.forEach((function(t){if(t&&t.name){var r=n.eventToSurveys.get(t.name);r&&r.push(e.id),n.eventToSurveys.set(t.name,r||[e.id])}}))})))}},{key:`onEvent`,value:function(t,n){var r,i,a=((r=this.instance)==null||(i=r.persistence)==null?void 0:i.props[hM])||[];if(e.SURVEY_SHOWN_EVENT_NAME==t&&n&&a.length>0){var o,s=n==null||(o=n.properties)==null?void 0:o.$survey_id;if(s){var c=a.indexOf(s);c>=0&&(a.splice(c,1),this._updateActivatedSurveys(a))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(a.concat(this.eventToSurveys.get(t)||[]))}},{key:`onAction`,value:function(e){var t,n,r=((t=this.instance)==null||(n=t.persistence)==null?void 0:n.props[hM])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(r.concat(this.actionToSurveys.get(e)||[]))}},{key:`_updateActivatedSurveys`,value:function(e){var t,n;(t=this.instance)==null||(n=t.persistence)==null||n.register(K({},hM,tj(new Set(e))))}},{key:`getSurveys`,value:function(){var e,t;return((e=this.instance)==null||(t=e.persistence)==null?void 0:t.props[hM])||[]}},{key:`getEventToSurveys`,value:function(){return this.eventToSurveys}},{key:`_getActionMatcher`,value:function(){return this.actionMatcher}}]),e}();K(cI,`SURVEY_SHOWN_EVENT_NAME`,`survey shown`);var lI=`[Surveys]`,uI={icontains:function(e){return!!J&&J.location.href.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e){return!!J&&J.location.href.toLowerCase().indexOf(e.toLowerCase())===-1},regex:function(e){return!!J&&tN(J.location.href,e)},not_regex:function(e){return!!J&&!tN(J.location.href,e)},exact:function(e){return J?.location.href===e},is_not:function(e){return J?.location.href!==e}},dI=function(){function e(t){W(this,e),this.instance=t,this._surveyEventReceiver=null}return G(e,[{key:`afterDecideResponse`,value:function(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}},{key:`loadIfEnabled`,value:function(){var e=this,t=jj?.extendPostHogWithSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||t||(this._surveyEventReceiver??=new cI(this.instance),this.instance.requestRouter.loadScript(`/static/surveys.js`,(function(t){if(t)return X.error(lI,`Could not load surveys script`,t);e._surveyManager=jj.extendPostHogWithSurveys(e.instance)})))}},{key:`getSurveys`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return e([]);this._surveyEventReceiver??=new cI(this.instance);var r=this.instance.get_property(mM);if(r&&!n)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor(`api`,`/api/surveys/?token=${this.instance.config.token}`),method:`GET`,transport:`XHR`,callback:function(n){var r;if(n.statusCode!==200||!n.json)return e([]);var i,a=n.json.surveys||[],o=a.filter((function(e){var t,n,r,i,a,o,s,c,l,u;return e.conditions?.events&&((t=e.conditions)==null||(n=t.events)==null?void 0:n.values)&&((r=e.conditions)==null||(i=r.events)==null||(a=i.values)==null?void 0:a.length)>0||e.conditions?.actions&&((o=e.conditions)==null||(s=o.actions)==null?void 0:s.values)&&((c=e.conditions)==null||(l=c.actions)==null||(u=l.values)==null?void 0:u.length)>0}));return o.length>0&&((i=t._surveyEventReceiver)==null||i.register(o)),(r=t.instance.persistence)==null||r.register(K({},mM,a)),e(a)}})}},{key:`getActiveMatchingSurveys`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys((function(n){var r=n.filter((function(e){return!(!e.start_date||e.end_date)})).filter((function(e){var t,n;if(!e.conditions)return!0;var r=(t=e.conditions)==null||!t.url||uI[e.conditions?.urlMatchType??`icontains`](e.conditions.url),i=(n=e.conditions)==null||!n.selector||Y?.querySelector(e.conditions.selector);return r&&i})),i=t._surveyEventReceiver?.getSurveys();return e(r.filter((function(e){var n,r,a,o,s,c,l,u;if(!e.linked_flag_key&&!e.targeting_flag_key&&!e.internal_targeting_flag_key)return!0;var d=!e.linked_flag_key||t.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),f=!e.targeting_flag_key||t.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),p=e.conditions?.events&&((n=e.conditions)==null||(r=n.events)==null?void 0:r.values)&&((a=e.conditions)==null||(o=a.events)==null?void 0:o.values.length)>0,m=e.conditions?.actions&&((s=e.conditions)==null||(c=s.actions)==null?void 0:c.values)&&((l=e.conditions)==null||(u=l.actions)==null?void 0:u.values.length)>0,h=!p&&!m||i?.includes(e.id),g=t._canActivateRepeatedly(e),_=!(e.internal_targeting_flag_key&&!g)||t.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key);return d&&f&&_&&h})))}),n)}},{key:`getNextSurveyStep`,value:function(e,t,n){var r,i=e.questions[t],a=t+1;if((r=i.branching)==null||!r.type)return t===e.questions.length-1?rI.End:a;if(i.branching.type===rI.End)return rI.End;if(i.branching.type===rI.SpecificQuestion){if(Number.isInteger(i.branching.index))return i.branching.index}else if(i.branching.type===rI.ResponseBased){if(i.type===nI.SingleChoice){var o,s,c=i.choices.indexOf(`${n}`);if((o=i.branching)!=null&&(s=o.responseValues)!=null&&s.hasOwnProperty(c)){var l=i.branching.responseValues[c];return Number.isInteger(l)?l:l===rI.End?rI.End:a}}else if(i.type===nI.Rating){var u,d;if(typeof n!=`number`||!Number.isInteger(n))throw Error(`The response type must be an integer`);var f=function(e,t){if(t===3){if(e<1||e>3)throw Error(`The response must be in range 1-3`);return e===1?`negative`:e===2?`neutral`:`positive`}if(t===5){if(e<1||e>5)throw Error(`The response must be in range 1-5`);return e<=2?`negative`:e===3?`neutral`:`positive`}if(t===10){if(e<0||e>10)throw Error(`The response must be in range 0-10`);return e<=6?`detractors`:e<=8?`passives`:`promoters`}throw Error(`The scale must be one of: 3, 5, 10`)}(n,i.scale);if((u=i.branching)!=null&&(d=u.responseValues)!=null&&d.hasOwnProperty(f)){var p=i.branching.responseValues[f];return Number.isInteger(p)?p:p===rI.End?rI.End:a}}return a}return X.warn(lI,`Falling back to next question index due to unexpected branching type`),a}},{key:`_canActivateRepeatedly`,value:function(e){return _j(jj.__PosthogExtensions__.canActivateRepeatedly)&&X.warn(lI,`canActivateRepeatedly is not defined, must init before calling`),jj.__PosthogExtensions__.canActivateRepeatedly(e)}},{key:`canRenderSurvey`,value:function(e){var t=this;_j(this._surveyManager)?X.warn(lI,`canActivateRepeatedly is not defined, must init before calling`):this.getSurveys((function(n){var r=n.filter((function(t){return t.id===e}))[0];t._surveyManager.canRenderSurvey(r)}))}},{key:`renderSurvey`,value:function(e,t){var n=this;_j(this._surveyManager)?X.warn(lI,`canActivateRepeatedly is not defined, must init before calling`):this.getSurveys((function(r){var i=r.filter((function(t){return t.id===e}))[0];n._surveyManager.renderSurvey(i,Y?.querySelector(t))}))}}]),e}(),fI=function(){function e(t){var n=this;W(this,e),K(this,`serverLimits`,{}),K(this,`lastEventRateLimited`,!1),K(this,`checkForLimiting`,(function(e){var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((function(e){X.info(`[RateLimiter] ${e||`events`} is quota limited.`),n.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){X.warn(`[RateLimiter] could not rate limit - continuing. Error: "${e?.message}"`,{text:t});return}})),this.instance=t,this.captureEventsPerSecond=t.config.rate_limiting?.events_per_second||10,this.captureEventsBurstLimit=Math.max(t.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return G(e,[{key:`clientRateLimitContext`,value:function(){var e,t=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=new Date().getTime(),r=this.instance.persistence?.get_property(yM)??{tokens:this.captureEventsBurstLimit,last:n};r.tokens+=(n-r.last)/1e3*this.captureEventsPerSecond,r.last=n,r.tokens>this.captureEventsBurstLimit&&(r.tokens=this.captureEventsBurstLimit);var i=r.tokens<1;return i||t||(r.tokens=Math.max(0,r.tokens-1)),!i||this.lastEventRateLimited||t||this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to ${this.captureEventsPerSecond} events per second and ${this.captureEventsBurstLimit} events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=i,(e=this.instance.persistence)==null||e.set_property(yM,r),{isRateLimited:i,remainingTokens:r.tokens}}},{key:`isServerRateLimited`,value:function(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}}]),e}(),pI=function(){return U({initialPathName:Ej?.pathname||``,referringDomain:nP.referringDomain()},nP.campaignParams())},mI=function(){function e(t,n,r){var i=this;W(this,e),K(this,`_onSessionIdCallback`,(function(e){var t=i._getStoredProps();if(!t||t.sessionId!==e){var n={sessionId:e,props:i._sessionSourceParamGenerator()};i._persistence.register(K({},vM,n))}})),this._sessionIdManager=t,this._persistence=n,this._sessionSourceParamGenerator=r||pI,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return G(e,[{key:`_getStoredProps`,value:function(){return this._persistence.props[vM]}},{key:`getSessionProps`,value:function(){var e=this._getStoredProps()?.props;return e?{$client_session_initial_referring_host:e.referringDomain,$client_session_initial_pathname:e.initialPathName,$client_session_initial_utm_source:e.utm_source,$client_session_initial_utm_campaign:e.utm_campaign,$client_session_initial_utm_medium:e.utm_medium,$client_session_initial_utm_content:e.utm_content,$client_session_initial_utm_term:e.utm_term}:{}}}]),e}(),hI=`ahrefsbot,ahrefssiteaudit,applebot,baiduspider,bingbot,bingpreview,bot.htm,bot.php,crawler,deepscan,duckduckbot,facebookexternal,facebookcatalog,gptbot,http://yandex.com/bots,hubspot,ia_archiver,linkedinbot,mj12bot,msnbot,nessus,petalbot,pinterest,prerender,rogerbot,screaming frog,semrushbot,sitebulb,slurp,turnitin,twitterbot,vercelbot,yahoo! slurp,yandexbot,headlesschrome,cypress,Google-HotelAdsVerifier,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleweblight,mediapartners-google,storebot-google,Bytespider;`.split(`,`),gI=function(e,t){if(!e)return!1;var n=e.toLowerCase();return hI.concat(t||[]).some((function(e){var t=e.toLowerCase();return n.indexOf(t)!==-1}))},_I=function(){function e(){W(this,e),this.clicks=[]}return G(e,[{key:`isRageClick`,value:function(e,t,n){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}();function vI(e){var t;return e.id===wM||!((t=e.closest)==null||!t.call(e,`#`+wM))}var yI=function(){function e(t){var n,r=this;W(this,e),K(this,`rageclicks`,new _I),K(this,`_enabledServerSide`,!1),K(this,`_initialized`,!1),K(this,`_flushInterval`,null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)==null||!n.props[Qj]),J?.addEventListener(`beforeunload`,(function(){r.flush()}))}return G(e,[{key:`flushIntervalMilliseconds`,get:function(){var e=5e3;return fj(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}},{key:`isEnabled`,get:function(){return q(this.instance.config.capture_heatmaps)?q(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}},{key:`startIfEnabled`,value:function(){if(this.isEnabled){if(this._initialized)return;X.info(`[heatmaps] starting...`),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else clearInterval(this._flushInterval??void 0),this.getAndClearBuffer()}},{key:`afterDecideResponse`,value:function(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register(K({},Qj,t)),this._enabledServerSide=t,this.startIfEnabled()}},{key:`getAndClearBuffer`,value:function(){var e=this.buffer;return this.buffer=void 0,e}},{key:`_setupListeners`,value:function(){var e=this;J&&Y&&(Kj(Y,`click`,(function(t){return e._onClick(t||J?.event)}),!1,!0),Kj(Y,`mousemove`,(function(t){return e._onMouseMove(t||J?.event)}),!1,!0),this._initialized=!0)}},{key:`_getProperties`,value:function(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(e,t,n){for(var r=e;r&&!_P(r,`body`);){if(r===n)return!1;if(Q(t,J?.getComputedStyle(r).position))return!0;r=xP(r)}return!1}(e.target,[`fixed`,`sticky`],i);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:n),target_fixed:a,type:t}}},{key:`_onClick`,value:function(e){var t;if(!vI(e.target)){var n=this._getProperties(e,`click`);(t=this.rageclicks)!=null&&t.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._capture(U(U({},n),{},{type:`rageclick`})),this._capture(n)}}},{key:`_onMouseMove`,value:function(e){var t=this;vI(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((function(){t._capture(t._getProperties(e,`mousemove`))}),500))}},{key:`_capture`,value:function(e){if(J){var t=J.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}}},{key:`flush`,value:function(){this.buffer&&!pj(this.buffer)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),bI=function(){function e(t){var n=this;W(this,e),K(this,`_updateScrollData`,(function(){n.context||={};var e=n.scrollElement(),t=n.scrollY(),r=e?Math.max(0,e.scrollHeight-e.clientHeight):0,i=t+(e?.clientHeight||0),a=e?.scrollHeight||0;n.context.lastScrollY=Math.ceil(t),n.context.maxScrollY=Math.max(t,n.context.maxScrollY??0),n.context.maxScrollHeight=Math.max(r,n.context.maxScrollHeight??0),n.context.lastContentY=i,n.context.maxContentY=Math.max(i,n.context.maxContentY??0),n.context.maxContentHeight=Math.max(a,n.context.maxContentHeight??0)})),this.instance=t}return G(e,[{key:`getContext`,value:function(){return this.context}},{key:`resetContext`,value:function(){var e=this.context;return setTimeout(this._updateScrollData,0),e}},{key:`startMeasuringScrollPosition`,value:function(){J?.addEventListener(`scroll`,this._updateScrollData,!0),J?.addEventListener(`scrollend`,this._updateScrollData,!0),J?.addEventListener(`resize`,this._updateScrollData)}},{key:`scrollElement`,value:function(){if(!this.instance.config.scroll_root_selector)return J?.document.documentElement;var e,t=ij(uj(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]);try{for(t.s();!(e=t.n()).done;){var n=e.value,r=J?.document.querySelector(n);if(r)return r}}catch(e){t.e(e)}finally{t.f()}}},{key:`scrollY`,value:function(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return J&&(J.scrollY||J.pageYOffset||J.document.documentElement.scrollTop)||0}},{key:`scrollX`,value:function(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return J&&(J.scrollX||J.pageXOffset||J.document.documentElement.scrollLeft)||0}}]),e}(),xI=`$copy_autocapture`;function SI(e,t){return t.length>e?t.slice(0,e)+`...`:t}var CI,wI=function(){function e(t){W(this,e),K(this,`_initialized`,!1),K(this,`_isDisabledServerSide`,null),K(this,`rageclicks`,new _I),K(this,`_elementsChainAsString`,!1),this.instance=t,this._elementSelectors=null}return G(e,[{key:`config`,get:function(){var e=fj(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=e.url_allowlist?.map((function(e){return new RegExp(e)})),e.url_ignorelist=e.url_ignorelist?.map((function(e){return new RegExp(e)})),e}},{key:`_addDomEventHandlers`,value:function(){var e=this;if(this.isBrowserSupported()){if(J&&Y){var t=function(t){t||=J?.event;try{e._captureEvent(t)}catch(e){X.error(`Failed to capture event`,e)}},n=function(t){t||=J?.event,e._captureEvent(t,xI)};Kj(Y,`submit`,t,!1,!0),Kj(Y,`change`,t,!1,!0),Kj(Y,`click`,t,!1,!0),this.config.capture_copied_text&&(Kj(Y,`copy`,n,!1,!0),Kj(Y,`cut`,n,!1,!0))}}else X.info(`Disabling Automatic Event Collection because this browser is not supported`)}},{key:`startIfEnabled`,value:function(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}},{key:`afterDecideResponse`,value:function(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(K({},Zj,!!e.autocapture_opt_out)),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:`setElementSelectors`,value:function(e){this._elementSelectors=e}},{key:`getElementSelectors`,value:function(e){var t,n=[];return(t=this._elementSelectors)==null||t.forEach((function(t){(Y?.querySelectorAll(t))?.forEach((function(r){e===r&&n.push(t)}))})),n}},{key:`isEnabled`,get:function(){var e=this.instance.persistence?.props[Zj],t=this._isDisabledServerSide;if(gj(t)&&!yj(e)&&!this.instance.config.advanced_disable_decide)return!1;var n=this._isDisabledServerSide??!!e;return!!this.instance.config.autocapture&&!n}},{key:`_previousElementSibling`,value:function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!gP(t));return t}},{key:`_getAugmentPropertiesFromElement`,value:function(e){if(!CP(e))return{};var t={};return Z(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&jP(r)&&(t[n]=r)}})),t}},{key:`_getPropertiesFromElement`,value:function(e,t,n){var r=e.tagName.toLowerCase(),i={tag_name:r};bP.indexOf(r)>-1&&!n&&(r.toLowerCase()===`a`||r.toLowerCase()===`button`?i.$el_text=SI(1024,MP(e)):i.$el_text=SI(1024,hP(e)));var a=pP(e);a.length>0&&(i.classes=a.filter((function(e){return e!==``})));var o=this.config?.element_attribute_ignorelist;Z(e.attributes,(function(n){var r;if((!wP(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(o==null||!o.includes(n.name))&&!t&&jP(n.value)&&(r=n.name,!mj(r)||r.substring(0,10)!==`_ngcontent`&&r.substring(0,7)!==`_nghost`)){var a=n.value;n.name===`class`&&(a=dP(a).join(` `)),i[`attr__`+n.name]=SI(1024,a)}}));for(var s=1,c=1,l=e;l=this._previousElementSibling(l);)s++,l.tagName===e.tagName&&c++;return i.nth_child=s,i.nth_of_type=c,i}},{key:`_getDefaultProperties`,value:function(e){return{$event_type:e,$ce_version:1}}},{key:`_getEventTarget`,value:function(e){return q(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}},{key:`_captureEvent`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`$autocapture`;if(this.isEnabled){var r,i=this._getEventTarget(e);vP(i)&&(i=i.parentNode||null),n===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._captureEvent(e,`$rageclick`);var a=n===xI;if(i&&SP(i,e,this.config,a,a?[`copy`,`cut`]:void 0)){for(var o,s=[i],c=i;c.parentNode&&!_P(c,`body`);)yP(c.parentNode)?(s.push(c.parentNode.host),c=c.parentNode.host):(s.push(c.parentNode),c=c.parentNode);var l,u,d=[],f={},p=!1;if(Z(s,(function(e){var n=CP(e);e.tagName.toLowerCase()===`a`&&(l=e.getAttribute(`href`),l=n&&jP(l)&&l),Q(pP(e),`ph-no-capture`)&&(p=!0),d.push(t._getPropertiesFromElement(e,t.instance.config.mask_all_element_attributes,t.instance.config.mask_all_text)),Ij(f,t._getAugmentPropertiesFromElement(e))})),this.instance.config.mask_all_text||(i.tagName.toLowerCase()===`a`||i.tagName.toLowerCase()===`button`?d[0].$el_text=MP(i):d[0].$el_text=hP(i)),l){var m;d[0].attr__href=l;var h=eN(l)?.host,g=J==null||(m=J.location)==null?void 0:m.host;h&&g&&h!==g&&(u=l)}if(p)return!1;var _=Ij(this._getDefaultProperties(e.type),this._elementsChainAsString?{$elements_chain:PP(d)}:{$elements:d},(o=d[0])!=null&&o.$el_text?{$el_text:d[0]?.$el_text}:{},u&&e.type===`click`?{$external_click_url:u}:{},f),v=this.getElementSelectors(i);if(v&&v.length>0&&(_.$element_selectors=v),n===xI){var y,b=mP(J==null||(y=J.getSelection())==null?void 0:y.toString()),x=e.type||`clipboard`;if(!b)return!1;_.$selected_content=b,_.$copy_type=x}return this.instance.capture(n,_),!0}}}},{key:`isBrowserSupported`,value:function(){return dj(Y?.querySelectorAll)}}]),e}(),TI=function(){function e(t){var n=this;W(this,e),K(this,`_restoreXHRPatch`,void 0),K(this,`_restoreFetchPatch`,void 0),K(this,`_startCapturing`,(function(){q(n._restoreXHRPatch)&&jj.postHogTracingHeadersPatchFns._patchXHR(n.instance.sessionManager),q(n._restoreFetchPatch)&&jj.postHogTracingHeadersPatchFns._patchFetch(n.instance.sessionManager)})),this.instance=t}return G(e,[{key:`_loadScript`,value:function(e){jj.postHogTracingHeadersPatchFns&&e(),this.instance.requestRouter.loadScript(`/static/tracing-headers.js?v=${aj.LIB_VERSION}`,(function(t){if(t)return X.error(`[TRACING-HEADERS] failed to load script`,t);e()}))}},{key:`startIfEnabledOrStop`,value:function(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((e=this._restoreXHRPatch)==null||e.call(this),(t=this._restoreFetchPatch)==null||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}]),e}();(function(e){e[e.PENDING=-1]=`PENDING`,e[e.DENIED=0]=`DENIED`,e[e.GRANTED=1]=`GRANTED`})(CI||={});var EI=function(){function e(t){W(this,e),this.instance=t}return G(e,[{key:`config`,get:function(){return this.instance.config}},{key:`consent`,get:function(){return this.getDnt()?CI.DENIED:this.storedConsent}},{key:`isOptedOut`,value:function(){return this.consent===CI.DENIED||this.consent===CI.PENDING&&this.config.opt_out_capturing_by_default}},{key:`isOptedIn`,value:function(){return!this.isOptedOut()}},{key:`optInOut`,value:function(e){this.storage.set(this.storageKey,+!!e,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}},{key:`reset`,value:function(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}},{key:`storageKey`,get:function(){var e=this.instance.config,t=e.token;return(e.opt_out_capturing_cookie_prefix||`__ph_opt_in_out_`)+t}},{key:`storedConsent`,get:function(){var e=this.storage.get(this.storageKey);return e===`1`?CI.GRANTED:e===`0`?CI.DENIED:CI.PENDING}},{key:`storage`,get:function(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage=e===`localStorage`?KM:WM;var t=e===`localStorage`?WM:KM;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(t.get(this.storageKey)===`1`),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}},{key:`getDnt`,value:function(){return!!this.config.respect_dnt&&!!qj([Tj?.doNotTrack,Tj?.msDoNotTrack,jj.doNotTrack],(function(e){return Q([!0,1,`1`,`yes`],e)}))}}]),e}(),DI=`[Exception Autocapture]`,OI=function(){function e(t){var n,r=this;W(this,e),K(this,`originalOnUnhandledRejectionHandler`,void 0),K(this,`startCapturing`,(function(){if(J&&r.isEnabled&&!r.hasHandlers&&!r.isCapturing){var e=J.posthogErrorWrappingFunctions.wrapOnError,t=J.posthogErrorWrappingFunctions.wrapUnhandledRejection;if(e&&t)try{r.unwrapOnError=e(r.captureException.bind(r)),r.unwrapUnhandledRejection=t(r.captureException.bind(r))}catch(e){X.error(DI+` failed to start`,e),r.stopCapturing()}else X.error(DI+` failed to load error wrapping functions - cannot start`)}})),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)==null||!n.props[$j]),this.startIfEnabled()}return G(e,[{key:`isEnabled`,get:function(){var e;return(e=this.remoteEnabled)!=null&&e}},{key:`isCapturing`,get:function(){var e;return!(J==null||(e=J.onerror)==null||!e.__POSTHOG_INSTRUMENTED__)}},{key:`hasHandlers`,get:function(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}},{key:`startIfEnabled`,value:function(){this.isEnabled&&!this.isCapturing&&(X.info(DI+` enabled, starting...`),this.loadScript(this.startCapturing))}},{key:`loadScript`,value:function(e){this.hasHandlers&&e(),this.instance.requestRouter.loadScript(`/static/exception-autocapture.js?v=${aj.LIB_VERSION}`,(function(t){if(t)return X.error(DI+` failed to load script`,t);e()}))}},{key:`stopCapturing`,value:function(){var e,t;(e=this.unwrapOnError)==null||e.call(this),(t=this.unwrapUnhandledRejection)==null||t.call(this)}},{key:`afterDecideResponse`,value:function(e){this.remoteEnabled=!!e.autocaptureExceptions||!1,this.instance.persistence&&this.instance.persistence.register(K({},$j,this.remoteEnabled)),this.startIfEnabled()}},{key:`captureException`,value:function(e){e.$exception_personURL=`${this.instance.requestRouter.endpointFor(`ui`)}/project/${this.instance.config.token}/person/${this.instance.get_distinct_id()}`,this.instance.exceptions.sendExceptionEvent(e)}}]),e}(),kI=9e5,AI=`[Web Vitals]`,jI=function(){function e(t){var n,r=this;W(this,e),K(this,`_enabledServerSide`,!1),K(this,`_initialized`,!1),K(this,`buffer`,{url:void 0,metrics:[],firstMetricTimestamp:void 0}),K(this,`_flushToCapture`,(function(){clearTimeout(r._delayedFlushTimer),r.buffer.metrics.length!==0&&(r.instance.capture(`$web_vitals`,r.buffer.metrics.reduce((function(e,t){var n;return U(U({},e),{},(K(n={},`\$web_vitals_${t.name}_event`,U({},t)),K(n,`\$web_vitals_${t.name}_value`,t.value),n))}),{})),r.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})})),K(this,`_addToBuffer`,(function(e){var t=r.instance.sessionManager?.checkAndGetSessionAndWindowId(!0);if(q(t))X.error(AI+`Could not read session ID. Dropping metrics!`);else{r.buffer=r.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=r._currentURL();q(n)||(_j(e?.name)||_j(e?.value)?X.error(AI+`Invalid metric received`,e):r._maxAllowedValue&&e.value>=r._maxAllowedValue?X.error(AI+`Ignoring metric with value >= `+r._maxAllowedValue,e):(r.buffer.url!==n&&(r._flushToCapture(),r._delayedFlushTimer=setTimeout(r._flushToCapture,8e3)),q(r.buffer.url)&&(r.buffer.url=n),r.buffer.firstMetricTimestamp=q(r.buffer.firstMetricTimestamp)?Date.now():r.buffer.firstMetricTimestamp,r.buffer.metrics.push(U(U({},e),{},{$current_url:n,$session_id:t.sessionId,$window_id:t.windowId,timestamp:Date.now()})),r.buffer.metrics.length===4&&r._flushToCapture()))}})),K(this,`_startCapturing`,(function(){var e=jj.postHogWebVitalsCallbacks,t=e.onLCP,n=e.onCLS,i=e.onFCP,a=e.onINP;t&&n&&i&&a?(t(r._addToBuffer),n(r._addToBuffer),i(r._addToBuffer),a(r._addToBuffer),r._initialized=!0):X.error(AI+`web vitals callbacks not loaded - not starting`)})),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)==null||!n.props[tM]),this.startIfEnabled()}return G(e,[{key:`_maxAllowedValue`,get:function(){var e=fj(this.instance.config.capture_performance)&&vj(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:kI;return 0<e&&e<=6e4?kI:e}},{key:`isEnabled`,get:function(){var e=fj(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return yj(e)?e:this._enabledServerSide}},{key:`startIfEnabled`,value:function(){this.isEnabled&&!this._initialized&&(X.info(AI+` enabled, starting...`),this.loadScript(this._startCapturing))}},{key:`afterDecideResponse`,value:function(e){var t=fj(e.capturePerformance)&&!!e.capturePerformance.web_vitals;this.instance.persistence&&this.instance.persistence.register(K({},tM,t)),this._enabledServerSide=t,this.startIfEnabled()}},{key:`loadScript`,value:function(e){J.postHogWebVitalsCallbacks&&e(),this.instance.requestRouter.loadScript(`/static/web-vitals.js?v=${aj.LIB_VERSION}`,(function(t){t?X.error(AI+` failed to load script`,t):e()}))}},{key:`_currentURL`,value:function(){var e=J?J.location.href:void 0;return e||X.error(AI+`Could not determine current URL`),e}}]),e}(),MI=`/e/`,NI=function(){function e(t){W(this,e),this.instance=t,this._endpointSuffix=this.instance.persistence?.props[eM]||MI}return G(e,[{key:`endpoint`,get:function(){return this.instance.requestRouter.endpointFor(`api`,this._endpointSuffix)}},{key:`afterDecideResponse`,value:function(e){var t=e.autocaptureExceptions;this._endpointSuffix=fj(t)&&t.endpoint||MI,this.instance.persistence&&this.instance.persistence.register(K({},eM,this._endpointSuffix))}},{key:`sendExceptionEvent`,value:function(e){this.instance.capture(`$exception`,e,{_noTruncate:!0,_batchKey:`exceptionEvent`,_url:this.endpoint})}}]),e}(),PI={},FI=function(){},II=`posthog`,LI=!RF&&Aj?.indexOf(`MSIE`)===-1&&Aj?.indexOf(`Mozilla`)===-1,RI=function(){var e,t,n;return{api_host:`https://us.i.posthog.com`,ui_host:null,token:``,autocapture:!0,rageclick:!0,cross_subdomain_cookie:(t=Y?.location,n=t?.hostname,!!mj(n)&&n.split(`.`).slice(-2).join(`.`)!==`herokuapp.com`),persistence:`localStorage+cookie`,persistence_name:``,loaded:FI,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:`if_capture_pageview`,debug:Ej&&mj(Ej?.search)&&Ej.search.indexOf(`__posthog_debug=true`)!==-1||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:(J==null||(e=J.location)==null?void 0:e.protocol)===`https:`,ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:`localStorage`,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:`//`,inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:function(e){var t=`Bad HTTP status: `+e.statusCode+` `+e.text;X.error(t)},get_device_id:function(e){return e},_onCapture:FI,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:`always`,__add_tracing_headers:!1}},zI=function(e){var t={};q(e.process_person)||(t.person_profiles=e.process_person),q(e.xhr_headers)||(t.request_headers=e.xhr_headers),q(e.cookie_name)||(t.persistence_name=e.cookie_name),q(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);var n=Ij({},t,e);return uj(e.property_blacklist)&&(q(e.property_denylist)?n.property_denylist=e.property_blacklist:uj(e.property_denylist)?n.property_denylist=[].concat(tj(e.property_blacklist),tj(e.property_denylist)):X.error(`Invalid value for property_denylist config: `+e.property_denylist)),n},BI=function(){function e(){W(this,e),K(this,`__forceAllowLocalhost`,!1)}return G(e,[{key:`_forceAllowLocalhost`,get:function(){return this.__forceAllowLocalhost},set:function(e){X.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),VI=function(){function e(){var t=this;W(this,e),K(this,`webPerformance`,new BI),K(this,`version`,aj.LIB_VERSION),K(this,`_internalEventEmitter`,new oI),this.config=RI(),this.decideEndpointWasHit=!1,this.SentryIntegration=$F,this.sentryIntegration=function(e){return function(e,t){var n=QF(e,t);return{name:ZF,processEvent:function(e){return n(e)}}}(t,e)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this._initialPageviewCaptured=!1,this.featureFlags=new AM(this),this.toolbar=new nF(this),this.scrollManager=new bI(this),this.pageViewManager=new iI(this),this.surveys=new dI(this),this.exceptions=new NI(this),this.rateLimiter=new fI(this),this.requestRouter=new XF(this),this.consent=new EI(this),this.people={set:function(e,n,r){var i=mj(e)?K({},e,n):e;t.setPersonProperties(i),r?.({})},set_once:function(e,n,r){var i=mj(e)?K({},e,n):e;t.setPersonProperties(void 0,i),r?.({})}},this.on(`eventCaptured`,(function(e){return X.info(`send`,e)}))}return G(e,[{key:`init`,value:function(t,n,r){if(r&&r!==II){var i=PI[r]??new e;return i._init(t,n,r),PI[r]=i,PI[II][r]=i,i}return this._init(t,n,r)}},{key:`_init`,value:function(e){var t,n=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(q(e)||hj(e))return X.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return X.warn(`You have already initialized PostHog! Re-initializing is a no-op`),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config(Ij({},RI(),zI(r),{name:i,token:e})),this.config.on_xhr_error&&X.error(`[posthog] on_xhr_error is deprecated. Use on_request_error instead`),this.compression=r.disable_compression?void 0:Wj.GZipJS,this.persistence=new iP(this.config),this.sessionPersistence=this.config.persistence===`sessionStorage`?this.persistence:new iP(U(U({},this.config),{},{persistence:`sessionStorage`}));var a=U({},this.persistence.props),o=U({},this.sessionPersistence.props);if(this._requestQueue=new rF((function(e){return n._send_retriable_request(e)})),this._retryQueue=new KF(this),this.__request_queue=[],this.sessionManager=new JF(this.config,this.persistence),this.sessionPropsManager=new mI(this.sessionManager,this.persistence),new TI(this).startIfEnabledOrStop(),this.sessionRecording=new QP(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new wI(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new yI(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new jI(this),this.exceptionObserver=new OI(this),this.exceptionObserver.startIfEnabled(),aj.DEBUG=aj.DEBUG||this.config.debug,aj.DEBUG&&X.info(`Starting in debug mode`,{this:this,config:r,thisC:U({},this.config),p:a,s:o}),this._sync_opt_out_with_persistence(),r.bootstrap?.distinctID!==void 0){var s,c,l=this.config.get_device_id(LM()),u=(s=r.bootstrap)!=null&&s.isIdentifiedID?l:r.bootstrap.distinctID;this.persistence.set_property(_M,(c=r.bootstrap)!=null&&c.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:r.bootstrap.distinctID,$device_id:u})}if(this._hasBootstrappedFeatureFlags()){var d=Object.keys(r.bootstrap?.featureFlags||{}).filter((function(e){var t,n;return!((t=r.bootstrap)==null||(n=t.featureFlags)==null||!n[e])})).reduce((function(e,t){var n,i;return e[t]=((n=r.bootstrap)==null||(i=n.featureFlags)==null?void 0:i[t])||!1,e}),{}),f=Object.keys(r.bootstrap?.featureFlagPayloads||{}).filter((function(e){return d[e]})).reduce((function(e,t){var n,i,a,o;return(n=r.bootstrap)!=null&&(i=n.featureFlagPayloads)!=null&&i[t]&&(e[t]=(a=r.bootstrap)==null||(o=a.featureFlagPayloads)==null?void 0:o[t]),e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:d,featureFlagPayloads:f})}if(!this.get_distinct_id()){var p=this.config.get_device_id(LM());this.register_once({distinct_id:p,$device_id:p},``),this.persistence.set_property(_M,`anonymous`)}return J==null||(t=J.addEventListener)==null||t.call(J,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),r.segment?eI(this,(function(){return n._loaded()})):this._loaded(),dj(this.config._onCapture)&&this.on(`eventCaptured`,(function(e){return n.config._onCapture(e.event,e)})),this}},{key:`_afterDecideResponse`,value:function(e){var t,n,r,i,a,o,s,c;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Q(e.supportedCompression,Wj.GZipJS)?Wj.GZipJS:Q(e.supportedCompression,Wj.Base64)?Wj.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),(n=this.sessionRecording)==null||n.afterDecideResponse(e),(r=this.autocapture)==null||r.afterDecideResponse(e),(i=this.heatmaps)==null||i.afterDecideResponse(e),(a=this.surveys)==null||a.afterDecideResponse(e),(o=this.webVitalsAutocapture)==null||o.afterDecideResponse(e),(s=this.exceptions)==null||s.afterDecideResponse(e),(c=this.exceptionObserver)==null||c.afterDecideResponse(e)}},{key:`_loaded`,value:function(){var e=this,t=this.config.advanced_disable_decide;t||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){X.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((function(){e.consent.isOptedIn()&&e._captureInitialPageview()}),1),t||(new $P(this).call(),this.featureFlags.resetRequestQueue())}},{key:`_start_queue_if_opted_in`,value:function(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)==null||e.enable())}},{key:`_dom_loaded`,value:function(){var e=this;this.has_opted_out_capturing()||Fj(this.__request_queue,(function(t){return e._send_retriable_request(t)})),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:`_handle_unload`,value:function(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(`$pageleave`),(e=this._requestQueue)==null||e.unload(),(t=this._retryQueue)==null||t.unload()):this._shouldCapturePageleave()&&this.capture(`$pageleave`,null,{transport:`sendBeacon`})}},{key:`_send_request`,value:function(e){var t=this;this.__loaded&&(LI?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=BF(e.url,{ip:+!!this.config.ip}),e.headers=U({},this.config.request_headers),e.compression=e.compression===`best-available`?this.compression:e.compression,function(e){var t=U({},e);t.timeout=t.timeout||6e4,t.url=BF(t.url,{_:new Date().getTime().toString(),ver:aj.LIB_VERSION,compression:t.compression});var n=t.transport??`XHR`,r=qj(UF,(function(e){return e.transport===n}))?.method??UF[0].method;if(!r)throw Error(`No available transport method`);r(t)}(U(U({},e),{},{callback:function(n){var r,i,a;(t.rateLimiter.checkForLimiting(n),n.statusCode>=400)&&((i=(a=t.config).on_request_error)==null||i.call(a,n)),(r=e.callback)==null||r.call(e,n)}}))))}},{key:`_send_retriable_request`,value:function(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}},{key:`_execute_array`,value:function(e){var t,n=this,r=[],i=[],a=[];Fj(e,(function(e){e&&(t=e[0],uj(t)?a.push(e):dj(e)?e.call(n):uj(e)&&t===`alias`?r.push(e):uj(e)&&t.indexOf(`capture`)!==-1&&dj(n[t])?a.push(e):i.push(e))}));var o=function(e,t){Fj(e,(function(e){if(uj(e[0])){var n=t;Z(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};o(r,this),o(i,this),o(a,this)}},{key:`_hasBootstrappedFeatureFlags`,value:function(){return this.config.bootstrap?.featureFlags&&Object.keys(this.config.bootstrap?.featureFlags).length>0||!1}},{key:`push`,value:function(e){this._execute_array([e])}},{key:`capture`,value:function(e,t,n){if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!q(e)&&mj(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var r=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(r==null||!r.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var i=new Date,a=n?.timestamp||i,o={uuid:LM(),event:e,properties:this._calculate_event_properties(e,t||{},a)};r&&(o.properties.$lib_rate_limit_remaining_tokens=r.remainingTokens),n!=null&&n.$set&&(o.$set=n?.$set);var s=this._calculate_set_once_properties(n?.$set_once);s&&(o.$set_once=s),(o=Uj(o,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,q(n?.timestamp)||(o.properties.$event_time_override_provided=!0,o.properties.$event_time_override_system_time=i);var c=U(U({},o.properties.$set),o.$set);pj(c)||this.setPersonPropertiesForFlags(c),this._internalEventEmitter.emit(`eventCaptured`,o);var l={method:`POST`,url:n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),data:o,compression:`best-available`,batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this._send_retriable_request(l):this._requestQueue.enqueue(l),o}X.critical(`This capture call is ignored due to client rate limiting.`)}}else X.error(`No event name provided to posthog.capture`)}else X.uninitializedWarning(`posthog.capture`)}},{key:`_addCaptureHook`,value:function(e){this.on(`eventCaptured`,(function(t){return e(t.event,t)}))}},{key:`_calculate_event_properties`,value:function(e,t,n){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;var r=this.persistence.remove_event_timer(e),i=U({},t);if(i.token=this.config.token,e===`$snapshot`){var a=U(U({},this.persistence.properties()),this.sessionPersistence.properties());return i.distinct_id=a.distinct_id,(!mj(i.distinct_id)&&!vj(i.distinct_id)||hj(i.distinct_id))&&X.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),i}var o=nP.properties();if(this.sessionManager){var s=this.sessionManager.checkAndGetSessionAndWindowId(),c=s.sessionId,l=s.windowId;i.$session_id=c,i.$window_id=l}if(this.requestRouter.region===GF.CUSTOM&&(i.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(e===`$pageview`||e===`$pageleave`||e===`$autocapture`)){var u=this.sessionPropsManager.getSessionProps();i=Ij(i,u)}if(!this.config.disable_scroll_properties){var d={};e===`$pageview`?d=this.pageViewManager.doPageView(n):e===`$pageleave`&&(d=this.pageViewManager.doPageLeave(n)),i=Ij(i,d)}if(e===`$pageview`&&Y&&(i.title=Y.title),!q(r)){var f=n.getTime()-r;i.$duration=parseFloat((f/1e3).toFixed(3))}Aj&&this.config.opt_out_useragent_filter&&(i.$browser_type=this._is_bot()?`bot`:`browser`),(i=Ij({},o,this.persistence.properties(),this.sessionPersistence.properties(),i)).$is_identified=this._isIdentified(),uj(this.config.property_denylist)?Z(this.config.property_denylist,(function(e){delete i[e]})):X.error(`Invalid value for property_denylist config: `+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var p=this.config.sanitize_properties;return p&&(i=p(i,e)),i.$process_person_profile=this._hasPersonProcessing(),i}},{key:`_calculate_set_once_properties`,value:function(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=Ij({},this.persistence.get_initial_props(),e||{});return pj(t)?void 0:t}},{key:`register`,value:function(e,t){var n;(n=this.persistence)==null||n.register(e,t)}},{key:`register_once`,value:function(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}},{key:`register_for_session`,value:function(e){var t;(t=this.sessionPersistence)==null||t.register(e)}},{key:`unregister`,value:function(e){var t;(t=this.persistence)==null||t.unregister(e)}},{key:`unregister_for_session`,value:function(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}},{key:`_register_single`,value:function(e,t){this.register(K({},e,t))}},{key:`getFeatureFlag`,value:function(e,t){return this.featureFlags.getFeatureFlag(e,t)}},{key:`getFeatureFlagPayload`,value:function(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}},{key:`isFeatureEnabled`,value:function(e,t){return this.featureFlags.isFeatureEnabled(e,t)}},{key:`reloadFeatureFlags`,value:function(){this.featureFlags.reloadFeatureFlags()}},{key:`updateEarlyAccessFeatureEnrollment`,value:function(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}},{key:`getEarlyAccessFeatures`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}},{key:`on`,value:function(e,t){return this._internalEventEmitter.on(e,t)}},{key:`onFeatureFlags`,value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:`onSessionId`,value:function(e){return this.sessionManager?.onSessionId(e)??function(){}}},{key:`getSurveys`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,t)}},{key:`getActiveMatchingSurveys`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}},{key:`renderSurvey`,value:function(e,t){this.surveys.renderSurvey(e,t)}},{key:`canRenderSurvey`,value:function(e){this.surveys.canRenderSurvey(e)}},{key:`getNextSurveyStep`,value:function(e,t,n){return this.surveys.getNextSurveyStep(e,t,n)}},{key:`identify`,value:function(e,t,n){if(!this.__loaded||!this.persistence)return X.uninitializedWarning(`posthog.identify`);if(vj(e)&&(e=e.toString(),X.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),e){if([`distinct_id`,`distinctid`].includes(e.toLowerCase()))X.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`);else if(this._requirePersonProcessing(`posthog.identify`)){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property(`$device_id`)){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},``)}e!==r&&e!==this.get_property(Yj)&&(this.unregister(Yj),this.register({distinct_id:e}));var a=(this.persistence.get_property(_M)||`anonymous`)===`anonymous`;e!==r&&a?(this.persistence.set_property(_M,`identified`),this.setPersonPropertiesForFlags(t||{},!1),this.capture(`$identify`,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(gM))}}else X.error(`Unique user id has not been set in posthog.identify`)}},{key:`setPersonProperties`,value:function(e,t){(e||t)&&this._requirePersonProcessing(`posthog.setPersonProperties`)&&(this.setPersonPropertiesForFlags(e||{}),this.capture(`$set`,{$set:e||{},$set_once:t||{}}))}},{key:`group`,value:function(e,t,n){if(e&&t){if(this._requirePersonProcessing(`posthog.group`)){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:U(U({},r),{},K({},e,t))}),n&&(this.capture(`$groupidentify`,{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags(K({},e,n))),r[e]===t||n||this.reloadFeatureFlags()}}else X.error(`posthog.group requires a group type and group key`)}},{key:`resetGroups`,value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:`setPersonPropertiesForFlags`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing(`posthog.setPersonPropertiesForFlags`)&&this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:`resetPersonPropertiesForFlags`,value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:`setGroupPropertiesForFlags`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing(`posthog.setGroupPropertiesForFlags`)&&this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:`resetGroupPropertiesForFlags`,value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:`reset`,value:function(e){var t,n,r,i;if(X.info(`reset`),!this.__loaded)return X.uninitializedWarning(`posthog.reset`);var a=this.get_property(`$device_id`);this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),(r=this.persistence)==null||r.set_property(_M,`anonymous`),(i=this.sessionManager)==null||i.resetSessionId();var o=this.config.get_device_id(LM());this.register_once({distinct_id:o,$device_id:e?o:a},``)}},{key:`get_distinct_id`,value:function(){return this.get_property(`distinct_id`)}},{key:`getGroups`,value:function(){return this.get_property(`$groups`)||{}}},{key:`get_session_id`,value:function(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}},{key:`get_session_replay_url`,value:function(e){if(!this.sessionManager)return``;var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=t.sessionId,r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor(`ui`,`/project/${this.config.token}/replay/${n}`);if(e!=null&&e.withTimestamp&&r){var a=e.timestampLookBack??10;if(!r)return i;var o=Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0);i+=`?t=${o}`}return i}},{key:`alias`,value:function(e,t){return e===this.get_property(Jj)?(X.critical(`Attempting to create alias for existing People user - aborting.`),-2):this._requirePersonProcessing(`posthog.alias`)?(q(t)&&(t=this.get_distinct_id()),e===t?(X.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this._register_single(Yj,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}},{key:`set_config`,value:function(e){var t,n,r,i,a=U({},this.config);fj(e)&&(Ij(this.config,zI(e)),(t=this.persistence)==null||t.update_config(this.config,a),this.sessionPersistence=this.config.persistence===`sessionStorage`?this.persistence:new iP(U(U({},this.config),{},{persistence:`sessionStorage`})),KM.is_supported()&&KM.get(`ph_debug`)===`true`&&(this.config.debug=!0),this.config.debug&&(aj.DEBUG=!0,X.info(`set_config`,{config:e,oldConfig:a,newConfig:U({},this.config)})),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(r=this.autocapture)==null||r.startIfEnabled(),(i=this.heatmaps)==null||i.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:`startSessionRecording`,value:function(e){var t,n=yj(e)&&e;if(n||e!=null&&e.sampling){var r,i=this.sessionManager?.checkAndGetSessionAndWindowId();(r=this.persistence)==null||r.register(K({},lM,!0)),X.info(`Session recording started with sampling override for session: `,i?.sessionId)}(n||e!=null&&e.linked_flag)&&((t=this.sessionRecording)==null||t.overrideLinkedFlag(),X.info(`Session recording started with linked_flags override`)),this.set_config({disable_session_recording:!1})}},{key:`stopSessionRecording`,value:function(){this.set_config({disable_session_recording:!0})}},{key:`sessionRecordingStarted`,value:function(){var e;return!((e=this.sessionRecording)==null||!e.started)}},{key:`captureException`,value:function(e,t){var n=dj(jj.parseErrorAsProperties)?jj.parseErrorAsProperties([e.message,void 0,void 0,void 0,e]):U({$exception_type:e.name,$exception_message:e.message,$exception_level:`error`},t);this.exceptions.sendExceptionEvent(n)}},{key:`loadToolbar`,value:function(e){return this.toolbar.loadToolbar(e)}},{key:`get_property`,value:function(e){return this.persistence?.props[e]}},{key:`getSessionProperty`,value:function(e){return this.sessionPersistence?.props[e]}},{key:`toString`,value:function(){var e=this.config.name??II;return e!==II&&(e=II+`.`+e),e}},{key:`_isIdentified`,value:function(){return this.persistence?.get_property(_M)===`identified`||this.sessionPersistence?.get_property(_M)===`identified`}},{key:`_hasPersonProcessing`,value:function(){var e,t,n,r;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&pj(this.getGroups())&&((e=this.persistence)==null||(t=e.props)==null||!t[Yj])&&((n=this.persistence)==null||(r=n.props)==null||!r[CM]))}},{key:`_shouldCapturePageleave`,value:function(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&this.config.capture_pageview}},{key:`createPersonProfile`,value:function(){this._hasPersonProcessing()||this._requirePersonProcessing(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}},{key:`_requirePersonProcessing`,value:function(e){return this.config.person_profiles===`never`?(X.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this._register_single(CM,!0),!0)}},{key:`_sync_opt_out_with_persistence`,value:function(){var e,t,n=this.consent.isOptedOut(),r=this.config.opt_out_persistence_by_default,i=this.config.disable_persistence||n&&!!r;this.persistence?.disabled!==i&&((e=this.persistence)==null||e.set_disabled(i)),this.sessionPersistence?.disabled!==i&&((t=this.sessionPersistence)==null||t.set_disabled(i))}},{key:`opt_in_capturing`,value:function(e){(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),q(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture(e?.captureEventName??`$opt_in`,e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}},{key:`opt_out_capturing`,value:function(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}},{key:`has_opted_in_capturing`,value:function(){return this.consent.isOptedIn()}},{key:`has_opted_out_capturing`,value:function(){return this.consent.isOptedOut()}},{key:`clear_opt_in_out_capturing`,value:function(){this.consent.reset(),this._sync_opt_out_with_persistence()}},{key:`_is_bot`,value:function(){return Tj?function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&gI(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((function(e){return gI(e?.brand,t)})))return!0}catch{}return!!e.webdriver}(Tj,this.config.custom_blocked_useragents):void 0}},{key:`_captureInitialPageview`,value:function(){Y&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture(`$pageview`,{title:Y.title},{send_instantly:!0}))}},{key:`debug`,value:function(e){!1===e?(J?.console.log(`You've disabled debug mode.`),localStorage&&localStorage.removeItem(`ph_debug`),this.set_config({debug:!1})):(J?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem(`ph_debug`,`true`),this.set_config({debug:!0}))}}]),e}();(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=Bj(e.prototype[t[n]])})(VI,[`identify`]);var HI,UI=(HI=PI[II]=new VI,function(){function e(){e.done||(e.done=!0,LI=!1,Z(PI,(function(e){e._dom_loaded()})))}Y!=null&&Y.addEventListener&&(Y.readyState===`complete`?e():Y.addEventListener(`DOMContentLoaded`,e,!1)),J&&Kj(J,`load`,e,!0)}(),HI),WI=class{constructor(){this.cache={startTime:new Date(0),maxParticipantsCount:0}}cacheStartCall(e){this.cache.startTime=e}cacheParticipantCountChanged(e){this.cache.maxParticipantsCount=Math.max(e,this.cache.maxParticipantsCount)}track(e,t,n,r){lR.instance.trackEvent({eventName:`CallEnded`,callId:e,callParticipantsMax:this.cache.maxParticipantsCount,callParticipantsOnLeave:t,callDuration:(Date.now()-this.cache.startTime.getTime())/1e3,roomEventEncryptionKeysSent:r.statistics.counters.roomEventEncryptionKeysSent,roomEventEncryptionKeysReceived:r.statistics.counters.roomEventEncryptionKeysReceived,roomEventEncryptionKeysReceivedAverageAge:r.statistics.counters.roomEventEncryptionKeysReceived>0?r.statistics.totals.roomEventEncryptionKeysReceivedTotalAge/r.statistics.counters.roomEventEncryptionKeysReceived:0},{send_instantly:n})}},GI=class{track(e){lR.instance.trackEvent({eventName:`CallStarted`,callId:e})}},KI=class{constructor(){this.cache={signupStart:new Date(0),signupEnd:new Date(0)}}cacheSignupStart(e){this.cache.signupStart=e}getSignupEndTime(){return this.cache.signupEnd}cacheSignupEnd(e){this.cache.signupEnd=e}track(){lR.instance.trackEvent({eventName:`Signup`,signupDuration:Date.now()-this.cache.signupStart.getTime()}),lR.instance.setRegistrationType(cR.Registered)}},qI=class{track(){lR.instance.trackEvent({eventName:`Login`}),lR.instance.setRegistrationType(cR.Registered)}},JI=class{track(e,t){lR.instance.trackEvent({eventName:`MuteMicrophone`,targetMuteState:e?`mute`:`unmute`,callId:t})}},YI=class{track(e,t){lR.instance.trackEvent({eventName:`MuteCamera`,targetMuteState:e?`mute`:`unmute`,callId:t})}},XI=class{track(e){lR.instance.trackEvent({eventName:`UndecryptableToDeviceEvent`,callId:e})}},ZI=class{track(e,t,n){lR.instance.trackEvent({eventName:`QualitySurvey`,callId:e,feedbackText:t,stars:n})}},QI=class{track(e){lR.instance.trackEvent({eventName:`CallDisconnected`,reason:e})}},$I=class{constructor(){this.connectStart=0,this.websocketConnected=0}cacheConnectStart(){this.connectStart=Date.now()}cacheWsConnect(){this.websocketConnected=Date.now()}track(e={log:!1}){let t=Date.now(),n=t-this.connectStart,r=this.websocketConnected-this.connectStart,i=t-this.websocketConnected;lR.instance.trackEvent({eventName:`CallConnectDuration`,totalDuration:n,websocketDuration:r,peerConnectionDuration:i}),e.log&&I.log(`Time to connect:\ntotal: ${n}ms\npeerConnection: ${r}ms\nwebsocket: ${i}ms`)}};function eL(e){return typeof e==`function`}function tL(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var nL=tL(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
59
59
|
`+t.map(function(e,t){return t+1+`) `+e.toString()}).join(`
|
|
60
|
-
`):``,this.name=`UnsubscriptionError`,this.errors=t}});function rL(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}xr();var iL=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=br(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var c=this.initialTeardown;if(eL(c))try{c()}catch(e){i=e instanceof nL?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=br(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{sL(f)}catch(e){i??=[],e instanceof nL?i=Tr(Tr([],yr(i)),yr(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new nL(i)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)sL(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&rL(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&rL(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),aL=iL.EMPTY;function oL(e){return e instanceof iL||e&&`closed`in e&&eL(e.remove)&&eL(e.add)&&eL(e.unsubscribe)}function sL(e){eL(e)?e():e.unsubscribe()}var cL={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};xr();var lL={setTimeout:function(e,t){var n=[...arguments].slice(2),r=lL.delegate;return r?.setTimeout?r.setTimeout.apply(r,Tr([e,t],yr(n))):setTimeout.apply(void 0,Tr([e,t],yr(n)))},clearTimeout:function(e){return(lL.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function uL(e){lL.setTimeout(function(){var t=cL.onUnhandledError;if(t)t(e);else throw e})}function dL(){}var fL=(function(){return hL(`C`,void 0,void 0)})();function pL(e){return hL(`E`,void 0,e)}function mL(e){return hL(`N`,e,void 0)}function hL(e,t,n){return{kind:e,value:t,error:n}}var gL=null;function _L(e){if(cL.useDeprecatedSynchronousErrorHandling){var t=!gL;if(t&&(gL={errorThrown:!1,error:null}),e(),t){var n=gL,r=n.errorThrown,i=n.error;if(gL=null,r)throw i}}else e()}function vL(e){cL.useDeprecatedSynchronousErrorHandling&&gL&&(gL.errorThrown=!0,gL.error=e)}xr();var yL=function(e){Cr(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,oL(t)&&t.add(n)):n.destination=DL,n}return t.create=function(e,t,n){return new CL(e,t,n)},t.prototype.next=function(e){this.isStopped?EL(mL(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?EL(pL(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?EL(fL,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(iL),bL=Function.prototype.bind;function xL(e,t){return bL.call(e,t)}var SL=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){wL(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){wL(e)}else wL(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){wL(e)}},e}(),CL=function(e){Cr(t,e);function t(t,n,r){var i=e.call(this)||this,a;if(eL(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&cL.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&xL(t.next,o),error:t.error&&xL(t.error,o),complete:t.complete&&xL(t.complete,o)}):a=t}return i.destination=new SL(a),i}return t}(yL);function wL(e){cL.useDeprecatedSynchronousErrorHandling?vL(e):uL(e)}function TL(e){throw e}function EL(e,t){var n=cL.onStoppedNotification;n&&lL.setTimeout(function(){return n(e,t)})}var DL={closed:!0,next:dL,error:TL,complete:dL},OL=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function kL(e){return e}function AL(e){return e.length===0?kL:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var jL=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=PL(e)?e:new CL(e,t,n);return _L(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=ML(t),new t(function(t,r){var i=new CL({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[OL]=function(){return this},e.prototype.pipe=function(){return AL([...arguments])(this)},e.prototype.toPromise=function(e){var t=this;return e=ML(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function ML(e){return e??cL.Promise??Promise}function NL(e){return e&&eL(e.next)&&eL(e.error)&&eL(e.complete)}function PL(e){return e&&e instanceof yL||NL(e)&&oL(e)}var FL=tL(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}});xr();var IL=function(e){Cr(t,e);function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t.prototype.lift=function(e){var t=new LL(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new FL},t.prototype.next=function(e){var t=this;_L(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=br(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;_L(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;_L(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,`observed`,{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?aL:(this.currentObservers=null,a.push(e),new iL(function(){t.currentObservers=null,rL(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new jL;return e.source=this,e},t.create=function(e,t){return new LL(e,t)},t}(jL),LL=function(e){Cr(t,e);function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},t.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},t.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??aL},t}(IL);xr();var RL=function(e){Cr(t,e);function t(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(t.prototype,`value`,{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(IL),zL=class{constructor(e,t){this.defaultValue=t,this.setValue=(e,t)=>{this._value$.next(e),this._lastUpdateReason$.next(t??null),localStorage.setItem(this.key,JSON.stringify(e))},this.getValue=()=>this._value$.getValue(),this.key=`matrix-setting-${e}`;let n=localStorage.getItem(this.key),r=t;if(n!==null)try{r=JSON.parse(n)}catch(t){I.warn(`Invalid value stored for setting ${e}: ${n}.`,t)}this._value$=new RL(r),this.value$=this._value$,this._lastUpdateReason$=new RL(null),this.lastUpdateReason$=this._lastUpdateReason$}};function BL(e){return[kA(e.value$),e.setValue]}var VL=new zL(`opt-in-analytics`,null),HL=()=>{let e=BL(VL);return lR.instance.isEnabled()?e:[!1,null]},UL=new zL(`developer-settings-tab`,!1),WL=new zL(`duplicate-tiles`,0),GL=new zL(`debug-tile-layout`,!1),KL=new zL(`show-connection-stats`,!1),qL=new zL(`audio-input`,void 0),JL=new zL(`audio-output`,void 0),YL=new zL(`video-input`,void 0),XL=new zL(`background-blur`,!1),ZL=new zL(`hand-raised-show-timer`,!1),QL=new zL(`reactions-show`,!0),$L=new zL(`reactions-play-sound`,!0),eR=new zL(`sound-effect-volume`,.5),tR=new zL(`mute-all-audio`,!1),nR=new zL(`always-show-self`,!0),rR=new zL(`always-show-iphone-earpiece`,!1),iR=function(e){return e.Legacy=`legacy`,e.Compatibility=`compatibility`,e.Matrix_2_0=`matrix_2_0`,e}({}),aR=new zL(`matrix-rtc-mode`,iR.Legacy),oR=new zL(`custom-livekit-url`,null),sR=function(e){return e[e.Disabled=0]=`Disabled`,e[e.Anonymous=1]=`Anonymous`,e[e.Pseudonymous=2]=`Pseudonymous`,e}({}),cR=function(e){return e[e.Guest=0]=`Guest`,e[e.Registered=1]=`Registered`,e}({}),lR=class e{static{this.ANALYTICS_EVENT_TYPE=`im.vector.analytics`}static{this.internalInstance=null}static hasInstance(){return!!this.internalInstance}static get instance(){return this.internalInstance||=new e(UI),this.internalInstance}static resetInstance(){this.internalInstance=null}constructor(e){this.posthog=e,this.enabled=!1,this.anonymity=sR.Disabled,this.platformSuperProperties={},this.registrationType=cR.Guest,this.optInListener=null,this.sanitizeProperties=(e,t)=>(this.anonymity==sR.Anonymous&&(e.$referrer=null,e.$referring_domain=null,e.$initial_referrer=null,e.$initial_referring_domain=null,e.$device_id=null),e.$current_url=e.$current_url.split(`/`).slice(0,3).join(``),e),this.eventCallEnded=new WI,this.eventSignup=new KI,this.eventCallStarted=new GI,this.eventLogin=new qI,this.eventMuteMicrophone=new JI,this.eventMuteCamera=new YI,this.eventUndecryptableToDevice=new XI,this.eventQualitySurvey=new ZI,this.eventCallDisconnected=new QI,this.eventCallConnectDuration=new $I;let t,n;t=WO().posthogApiKey??void 0,n=WO().posthogApiHost??void 0,t&&n?(this.posthog.init(t,{api_host:n,autocapture:!1,mask_all_text:!0,mask_all_element_attributes:!0,capture_pageview:!1,sanitize_properties:this.sanitizeProperties,respect_dnt:!0,advanced_disable_decide:!0}),this.enabled=!0):(I.info(`Posthog is not enabled because there is no api key or no host given in the config`),this.enabled=!1)}registerSuperProperties(e){this.enabled&&this.posthog.register(e)}static getPlatformProperties(){return{appVersion:`embedded-v0.19.2-rc.1`,matrixBackend:Sk?`embedded`:`jssdk`,callBackend:`livekit`,cryptoVersion:Sk?void 0:window.matrixclient?.getCrypto()?.getVersion()}}capture(e,t,n){this.enabled&&this.posthog.capture(e,{...t},n)}isEnabled(){return this.enabled}setAnonymity(e){this.enabled&&(e==sR.Disabled||e==sR.Anonymous)&&(this.posthog.reset(),this.updateSuperProperties()),this.anonymity=e}static getRandomAnalyticsId(){return[...crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16)).join(``)}async identifyUser(e){if(this.anonymity==sR.Pseudonymous&&this.enabled){let t=await this.getAnalyticsId();try{!t&&!Sk&&(t=e(),await this.setAccountAnalyticsId(t))}catch(e){I.log(`Unable to identify user for tracking`+e?.toString())}t?this.posthog.identify(t):I.info(`No analyticsID is available. Should not try to setup posthog`)}}async getAnalyticsId(){let t=window.matrixclient;return Sk?WO().posthogUserId:(await t.getAccountDataFromServer(e.ANALYTICS_EVENT_TYPE))?.id??null}async setAccountAnalyticsId(t){if(!Sk){let n=window.matrixclient,r=await n.getAccountDataFromServer(e.ANALYTICS_EVENT_TYPE);await n.setAccountData(e.ANALYTICS_EVENT_TYPE,Object.assign({id:t},r))}}getAnonymity(){return this.anonymity}logout(){this.enabled&&this.posthog.reset(),this.optInListener?.unsubscribe(),this.optInListener=null,this.setAnonymity(sR.Disabled)}onLoginStatusChanged(){this.maybeIdentifyUser().catch(()=>I.log(`Could not identify user on login status change`))}updateSuperProperties(){this.platformSuperProperties=e.getPlatformProperties(),this.registerSuperProperties({...this.platformSuperProperties,registrationType:this.registrationType==cR.Guest?`Guest`:`Registered`})}userRegisteredInThisSession(){return this.eventSignup.getSignupEndTime()>new Date(0)}async maybeIdentifyUser(){window.matrixclient&&(this.anonymity===sR.Pseudonymous&&(this.setRegistrationType(window.matrixclient.isGuest()||window.passwordlessUser?cR.Guest:cR.Registered),this.identificationPromise=this.identifyUser(e.getRandomAnalyticsId),await this.identificationPromise,this.userRegisteredInThisSession()&&this.eventSignup.track()),this.anonymity!==sR.Disabled&&this.updateSuperProperties())}trackEvent({eventName:e,...t},n){let r=()=>{this.anonymity==sR.Disabled||this.anonymity==sR.Anonymous||this.capture(e,t,n)};this.identificationPromise?this.identificationPromise.then(r,e=>{I.error(`Failed to identify user for tracking`,e)}):r()}startListeningToSettingsChanges(){this.optInListener??=VL.value$.subscribe(e=>{this.setAnonymity(e?sR.Pseudonymous:sR.Disabled),this.maybeIdentifyUser().catch(()=>I.log(`Could not identify user`))})}setRegistrationType(e){this.registrationType=e,!(this.anonymity==sR.Disabled||this.anonymity==sR.Anonymous)&&this.updateSuperProperties()}},uR=(0,R.createContext)(void 0);uR.Provider;var dR=()=>(0,R.use)(uR);function fR(){let e,t,n=dR();return n?.state===`valid`&&(e=n.authenticated?.client,t=n.setClient),{client:e,setClient:t}}function pR(){let e=dR(),t,n,r=!1,i=!0,a,o=!1,s;return e?.state===`valid`?(t=e.authenticated?.client,n=e.setClient,r=e.authenticated?.isPasswordlessUser??!1,i=!1,o=t!==void 0,s=e.authenticated?.logout):e?.state===`error`&&(a=e.error,i=!1),{client:t,setClient:n,passwordlessUser:r,loading:i,authenticated:o,logout:s,error:a}}var mR=`BroadcastChannel`in window?new BroadcastChannel(`load`):null,hR=({children:e})=>{let t=Fo(),[n,r]=(0,R.useState)(void 0),i=(0,R.useRef)(!1);(0,R.useEffect)(()=>{i.current||(i.current=!0,gR().then(e=>{r(e),lR.instance.isEnabled()&&lR.instance.startListeningToSettingsChanges()}).catch(e=>I.error(e)).finally(()=>i.current=!1))},[]);let a=(0,R.useCallback)(async e=>{let t=yR();!n?.client||!t||(await n.client.setPassword({type:`m.login.password`,identifier:{type:`m.id.user`,user:t.user_id},user:t.user_id,password:t.tempPassword},e),vR({...t,passwordlessUser:!1}),r({...n,passwordlessUser:!1}))},[n]),o=(0,R.useCallback)((e,t)=>{let i=n?.client;i&&i!==e&&i.stopClient(),vR(t),r({widgetApi:null,client:e,passwordlessUser:t.passwordlessUser}),lR.instance.isEnabled()&&lR.instance.startListeningToSettingsChanges()},[n?.client]),s=(0,R.useCallback)(async()=>{let e=n?.client;e&&(await e.logout(!0),await e.clearStores(),_R(),r(null),await t(`/`),lR.instance.logout(),lR.instance.setRegistrationType(cR.Guest))},[t,n?.client]);(0,R.useEffect)(()=>{Sk||mR?.postMessage({})},[]);let[c,l]=(0,R.useState)(void 0);TA(mR,`message`,(0,R.useCallback)(()=>{n?.client.stopClient(),l(new KA)},[n?.client,l]));let[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),m=(0,R.useMemo)(()=>{if(c)return{state:`error`,error:c};if(n!==void 0)return{state:`valid`,authenticated:n===null?void 0:{client:n.client,isPasswordlessUser:n.passwordlessUser,changePassword:a,logout:s},setClient:o,disconnected:u,supportedFeatures:{reactions:f}}},[c,a,n,s,o,u,f]),h=(0,R.useCallback)((e,t,n)=>{d(bR(e,n))},[]);return(0,R.useEffect)(()=>{if(n){if(window.matrixclient=n.client,window.passwordlessUser=n.passwordlessUser,lR.hasInstance()&&lR.instance.onLoginStatusChanged(),n.client&&n.client.on(cr.Sync,h),n.widgetApi){let e=n.widgetApi.hasCapability(`org.matrix.msc2762.send.event:m.reaction`),t=n.widgetApi.hasCapability(`org.matrix.msc2762.send.event:m.room.redaction`),r=n.widgetApi.hasCapability(`org.matrix.msc2762.receive.event:m.reaction`),i=n.widgetApi.hasCapability(`org.matrix.msc2762.receive.event:m.room.redaction`);!e||!r||!t||!i?(I.warn(`Widget does not support reactions`),p(!1)):p(!0)}else p(!0);return()=>{n.client&&n.client.removeListener(cr.Sync,h)}}},[n,h]),c?(0,B.jsx)(JA,{widget:Sk,error:c}):(0,B.jsx)(uR,{value:m,children:e})};async function gR(){if(Sk){I.log(`Using a matryoshka client`);let e=await Sk.client;return{widgetApi:Sk.api,client:e,passwordlessUser:!1}}else{let{initSPA:e}=await se(async()=>{let{initSPA:e}=await import(`./spa-D-aVmjgn.js`);return{initSPA:e}},__vite__mapDeps([2,1,3]),import.meta.url);return e(yR,_R)}}var _R=()=>localStorage.removeItem(`matrix-auth-store`),vR=e=>localStorage.setItem(`matrix-auth-store`,JSON.stringify(e)),yR=()=>{let e=localStorage.getItem(`matrix-auth-store`);if(e)return JSON.parse(e)},bR=(e,t)=>e===`ERROR`&&t?.error?.name===`ConnectionError`;function xR(e){return new Worker(``+new URL(`IndexedDBWorker-Dfh2gGKd.js`,import.meta.url).href,{type:`module`,name:e?.name})}var SR=new Jn;function CR(e){return[DA(SR,e,(0,R.useCallback)(()=>localStorage.getItem(e),[e])),(0,R.useCallback)(t=>wR(e,t),[e])]}var wR=(e,t)=>{localStorage.setItem(e,t),SR.emit(e)};function TR(e,t){localStorage.getItem(ER(e))!==t&&wR(ER(e),t)}var ER=e=>`room-shared-key-${e}`,DR=(e,t)=>{let[n,r]=CR(ER(e));return(0,R.useEffect)(()=>{t&&r(t)},[t,r]),[t??n,r]};function OR(e){let{roomId:t,password:n}=WO();return e!==t&&I.warn(`requested key for a roomId which is not the current call room id (from the URL)`,e,t),n??localStorage.getItem(ER(e))}function kR(e){let{client:t}=fR(),[n]=DR(ER(e),OR(e)??void 0),r=t?.getRoom(e);return(0,R.useMemo)(()=>r?n?{kind:LO.SHARED_KEY,secret:n}:r.hasEncryptionStateEvent()?{kind:LO.PER_PARTICIPANT}:{kind:LO.NONE}:{kind:LO.NONE},[r,n])}var AR=`element-call-sync`;async function jR(e){let t=!!await e.store.getSavedSyncToken();return new Promise((n,r)=>{let i=(a,o,s)=>{a===`PREPARED`?t?t=!1:(e.removeListener(cr.Sync,i),n()):a===`ERROR`&&(e.removeListener(cr.Sync,i),r(s?.error))};e.on(cr.Sync,i)})}async function MR(e,t){let n;try{n=window.indexedDB}catch(e){I.warn(`Could not get indexDB from window.`,e)}let r={fallbackICEServerAllowed:!1,isVoipWithNoMediaAllowed:FO.get().features?.feature_group_calls_without_video_and_audio};n&&localStorage?r.store=new Ti({indexedDB:window.indexedDB,localStorage,dbName:AR,workerFactory:()=>new xR}):localStorage&&(r.store=new Dr({localStorage}));let{e2eEnabled:i}=WO();i||I.info(`Disabling E2E: group call signalling will NOT be encrypted.`);let a=Vi({...r,...e,useAuthorizationHeader:!0,localTimeoutMs:5e3,useE2eForGroupCall:i,fallbackICEServerAllowed:!1});t||await a.clearStores();try{await a.store.startup()}catch(e){I.error(`Error starting matrix client indexDB store. Falling back to memory store.`,e),a.store=new Dr({localStorage}),await a.store.startup()}try{await a.initRustCrypto()}catch(e){I.warn(e,`Make sure to clear client stores before initializing the rust crypto.`)}let o=jR(a);return await a.startClient({clientWellKnownPollPeriod:600}),await o,a}function NR(e){return e.trim().replace(/\s/g,`-`).replace(/[^\w-]/g,``).toLowerCase()}function PR(e,t){return`#${NR(e)}:${t.getDomain()}`}function FR(e){let t=e.split(`:`,2);if(t.length===2&&t[0][0]===`#`){if(t[1]===FO.defaultServerName())return t[0];throw Error(`Unsupported remote room alias`)}return e}async function IR(e,t,n){I.log(`Creating room for group call`);let r=e.createRoom({visibility:oe.Private,preset:g.PublicChat,name:t,room_alias_name:n?void 0:NR(t),power_level_content_override:{invite:100,kick:100,ban:100,redact:50,state_default:0,events_default:0,users_default:0,events:{"m.room.power_levels":100,"m.room.history_visibility":100,"m.room.tombstone":100,"m.room.encryption":100,"m.room.name":50,"m.room.message":0,"m.room.encrypted":50,"m.sticker":50,"org.matrix.msc3401.call.member":0},users:{[e.getUserId()]:100}}}),i=await new Promise((t,n)=>{r.catch(e=>{n(e),a()});let i=e=>{r.then(n=>{e.roomId===n.room_id&&(t(e.roomId),a())},e=>{I.error(`Failed to wait for the room to arrive`,e)})},a=()=>{e.off(cr.Room,i)};e.on(cr.Room,i)}),a;return n==LO.SHARED_KEY&&(a=Yt(16),TR(i,a)),{roomId:i,alias:n?void 0:PR(t,e),password:a}}function LR(e,t,n,r){return`${window.location.protocol}//${window.location.host}${RR(e,t,n,r)}`}function RR(e,t,n,r){return`/room/#${n?`/`+NR(n):``}?${YO(e,t,r).toString()}`}async function zR(e){let t=0;for(;;)try{return await e()}catch(e){t++;let n=He(e,t,!0);if(n<0)throw e;await pr(n)}}export{HA as $,Ys as $i,_h as $n,ou as $r,xS as $t,ZL as A,Wc as Ai,j_ as An,zu as Ar,Dk as At,OL as B,Lc as Bi,Kg as Bn,yu as Br,JO as Bt,GL as C,fl as Ci,vv as Cn,Ju as Cr,Yk as Ct,tR as D,ol as Di,Q_ as Dn,Hu as Dr,Lk as Dt,aR as E,sl as Ei,ev as En,qu as Er,Ik as Et,YL as F,Kc as Fi,s_ as Fn,Au as Fr,vk as Ft,iL as G,Sc as Gi,Eh as Gn,gu as Gr,FO as Gt,yL as H,Ic as Hi,Lg as Hn,xu as Hr,zO as Ht,RL as I,Jc as Ii,a_ as In,Eu as Ir,yk as It,eL as J,Cc as Ji,wh as Jn,du as Jr,US as Jt,rL as K,wc as Ki,Th as Kn,hu as Kr,PO as Kt,IL as L,qc as Li,o_ as Ln,wu as Lr,bk as Lt,eR as M,Hc as Mi,h_ as Mn,Lu as Mr,xk as Mt,HL as N,Yc as Ni,p_ as Nn,Iu as Nr,Ck as Nt,$L as O,il as Oi,Y_ as On,Wu as Or,zk as Ot,BL as P,el as Pi,m_ as Pn,Du as Pr,Sk as Pt,UA as Q,gc as Qi,Ch as Qn,uu as Qr,CS as Qt,jL as R,Gc as Ri,n_ as Rn,Cu as Rr,VO as Rt,oR as S,ul as Si,wy as Sn,$u as Sr,aA as St,WL as T,cl as Ti,nv as Tn,nd as Tr,Rk as Tt,dL as U,Fc as Ui,Mg as Un,_u as Ur,RO as Ut,CL as V,Ac as Vi,Hg as Vn,bu as Vr,KO as Vt,uL as W,jc as Wi,Eg as Wn,vu as Wr,LO as Wt,qA as X,vc as Xi,yh as Xn,cu as Xr,LS as Xt,JA as Y,bc as Yi,xh as Yn,su as Yr,VS as Yt,YA as Z,_c as Zi,bh as Zn,fu as Zr,TS as Zt,rR as _,xl as _i,lb as _n,ld as _r,mA as _t,MR as a,jo as aa,zl as ai,eS as an,Ud as ar,OA as at,JL as b,gl as bi,ab as bn,td as br,oA as bt,OR as c,pa as ca,Nl as ci,Kx as cn,Kd as cr,DA as ct,hR as d,ca as da,jl as di,Ix as dn,qd as dr,SA as dt,Qs as ea,Yl as ei,hS as en,rh as er,zA as et,fR as f,Vi as fa,kl as fi,Ax as fn,jd as fr,hA as ft,iR as g,ml as gi,fb as gn,cd as gr,vA as gt,lR as h,Dl as hi,_x as hn,od as hr,yA as ht,RR as i,Ea as ia,Vl as ii,rS as in,Qd as ir,kA as it,QL as j,Bc as ji,C_ as jn,Pu as jr,wk as jt,KL as k,Uc as ki,L_ as kn,Vu as kr,Mk as kt,TR as l,da as la,Ml as li,zx as ln,Gd as lr,wA as lt,dR as m,Fr as ma,Tl as mi,bx as mn,fd as mr,fA as mt,zR as n,cs as na,Gl as ni,aS as nn,nf as nr,MA as nt,NR as o,Fo as oa,Rl as oi,Zx as on,Hd as or,TA as ot,pR as p,mi as pa,Ol as pi,Sx as pn,dd as pr,gA as pt,tL as q,Ec as qi,Sh as qn,mu as qr,GS as qt,LR as r,ls as ra,Wl as ri,iS as rn,ef as rr,jA as rt,FR as s,Mo as sa,Ll as si,qx as sn,Xd as sr,EA as st,IR as t,os as ta,Jl as ti,dS as tn,of as tr,RA as tt,kR as u,la as ua,Pl as ui,Vx as un,Wd as ur,CA as ut,nR as v,bl as vi,cb as vn,rd as vr,pA as vt,UL as w,ll as wi,sv as wn,Qu as wr,Fk as wt,XL as x,hl as xi,ub as xn,ed as xr,sA as xt,qL as y,pl as yi,sb as yn,Zu as yr,dA as yt,kL as z,Qc as zi,e_ as zn,Su as zr,WO as zt};
|
|
61
|
-
//# sourceMappingURL=matrix-
|
|
60
|
+
`):``,this.name=`UnsubscriptionError`,this.errors=t}});function rL(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}xr();var iL=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=br(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var c=this.initialTeardown;if(eL(c))try{c()}catch(e){i=e instanceof nL?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=br(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{sL(f)}catch(e){i??=[],e instanceof nL?i=Tr(Tr([],yr(i)),yr(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new nL(i)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)sL(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&rL(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&rL(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),aL=iL.EMPTY;function oL(e){return e instanceof iL||e&&`closed`in e&&eL(e.remove)&&eL(e.add)&&eL(e.unsubscribe)}function sL(e){eL(e)?e():e.unsubscribe()}var cL={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};xr();var lL={setTimeout:function(e,t){var n=[...arguments].slice(2),r=lL.delegate;return r?.setTimeout?r.setTimeout.apply(r,Tr([e,t],yr(n))):setTimeout.apply(void 0,Tr([e,t],yr(n)))},clearTimeout:function(e){return(lL.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function uL(e){lL.setTimeout(function(){var t=cL.onUnhandledError;if(t)t(e);else throw e})}function dL(){}var fL=(function(){return hL(`C`,void 0,void 0)})();function pL(e){return hL(`E`,void 0,e)}function mL(e){return hL(`N`,e,void 0)}function hL(e,t,n){return{kind:e,value:t,error:n}}var gL=null;function _L(e){if(cL.useDeprecatedSynchronousErrorHandling){var t=!gL;if(t&&(gL={errorThrown:!1,error:null}),e(),t){var n=gL,r=n.errorThrown,i=n.error;if(gL=null,r)throw i}}else e()}function vL(e){cL.useDeprecatedSynchronousErrorHandling&&gL&&(gL.errorThrown=!0,gL.error=e)}xr();var yL=function(e){Cr(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,oL(t)&&t.add(n)):n.destination=DL,n}return t.create=function(e,t,n){return new CL(e,t,n)},t.prototype.next=function(e){this.isStopped?EL(mL(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?EL(pL(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?EL(fL,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(iL),bL=Function.prototype.bind;function xL(e,t){return bL.call(e,t)}var SL=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){wL(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){wL(e)}else wL(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){wL(e)}},e}(),CL=function(e){Cr(t,e);function t(t,n,r){var i=e.call(this)||this,a;if(eL(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&cL.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&xL(t.next,o),error:t.error&&xL(t.error,o),complete:t.complete&&xL(t.complete,o)}):a=t}return i.destination=new SL(a),i}return t}(yL);function wL(e){cL.useDeprecatedSynchronousErrorHandling?vL(e):uL(e)}function TL(e){throw e}function EL(e,t){var n=cL.onStoppedNotification;n&&lL.setTimeout(function(){return n(e,t)})}var DL={closed:!0,next:dL,error:TL,complete:dL},OL=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function kL(e){return e}function AL(e){return e.length===0?kL:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var jL=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=PL(e)?e:new CL(e,t,n);return _L(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=ML(t),new t(function(t,r){var i=new CL({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[OL]=function(){return this},e.prototype.pipe=function(){return AL([...arguments])(this)},e.prototype.toPromise=function(e){var t=this;return e=ML(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function ML(e){return e??cL.Promise??Promise}function NL(e){return e&&eL(e.next)&&eL(e.error)&&eL(e.complete)}function PL(e){return e&&e instanceof yL||NL(e)&&oL(e)}var FL=tL(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}});xr();var IL=function(e){Cr(t,e);function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t.prototype.lift=function(e){var t=new LL(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new FL},t.prototype.next=function(e){var t=this;_L(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=br(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;_L(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;_L(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,`observed`,{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?aL:(this.currentObservers=null,a.push(e),new iL(function(){t.currentObservers=null,rL(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new jL;return e.source=this,e},t.create=function(e,t){return new LL(e,t)},t}(jL),LL=function(e){Cr(t,e);function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},t.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},t.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??aL},t}(IL);xr();var RL=function(e){Cr(t,e);function t(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(t.prototype,`value`,{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(IL),zL=class{constructor(e,t){this.defaultValue=t,this.setValue=(e,t)=>{this._value$.next(e),this._lastUpdateReason$.next(t??null),localStorage.setItem(this.key,JSON.stringify(e))},this.getValue=()=>this._value$.getValue(),this.key=`matrix-setting-${e}`;let n=localStorage.getItem(this.key),r=t;if(n!==null)try{r=JSON.parse(n)}catch(t){I.warn(`Invalid value stored for setting ${e}: ${n}.`,t)}this._value$=new RL(r),this.value$=this._value$,this._lastUpdateReason$=new RL(null),this.lastUpdateReason$=this._lastUpdateReason$}};function BL(e){return[kA(e.value$),e.setValue]}var VL=new zL(`opt-in-analytics`,null),HL=()=>{let e=BL(VL);return lR.instance.isEnabled()?e:[!1,null]},UL=new zL(`developer-settings-tab`,!1),WL=new zL(`duplicate-tiles`,0),GL=new zL(`debug-tile-layout`,!1),KL=new zL(`show-connection-stats`,!1),qL=new zL(`audio-input`,void 0),JL=new zL(`audio-output`,void 0),YL=new zL(`video-input`,void 0),XL=new zL(`background-blur`,!1),ZL=new zL(`hand-raised-show-timer`,!1),QL=new zL(`reactions-show`,!0),$L=new zL(`reactions-play-sound`,!0),eR=new zL(`sound-effect-volume`,.5),tR=new zL(`mute-all-audio`,!1),nR=new zL(`always-show-self`,!0),rR=new zL(`always-show-iphone-earpiece`,!1),iR=function(e){return e.Legacy=`legacy`,e.Compatibility=`compatibility`,e.Matrix_2_0=`matrix_2_0`,e}({}),aR=new zL(`matrix-rtc-mode`,iR.Legacy),oR=new zL(`custom-livekit-url`,null),sR=function(e){return e[e.Disabled=0]=`Disabled`,e[e.Anonymous=1]=`Anonymous`,e[e.Pseudonymous=2]=`Pseudonymous`,e}({}),cR=function(e){return e[e.Guest=0]=`Guest`,e[e.Registered=1]=`Registered`,e}({}),lR=class e{static{this.ANALYTICS_EVENT_TYPE=`im.vector.analytics`}static{this.internalInstance=null}static hasInstance(){return!!this.internalInstance}static get instance(){return this.internalInstance||=new e(UI),this.internalInstance}static resetInstance(){this.internalInstance=null}constructor(e){this.posthog=e,this.enabled=!1,this.anonymity=sR.Disabled,this.platformSuperProperties={},this.registrationType=cR.Guest,this.optInListener=null,this.sanitizeProperties=(e,t)=>(this.anonymity==sR.Anonymous&&(e.$referrer=null,e.$referring_domain=null,e.$initial_referrer=null,e.$initial_referring_domain=null,e.$device_id=null),e.$current_url=e.$current_url.split(`/`).slice(0,3).join(``),e),this.eventCallEnded=new WI,this.eventSignup=new KI,this.eventCallStarted=new GI,this.eventLogin=new qI,this.eventMuteMicrophone=new JI,this.eventMuteCamera=new YI,this.eventUndecryptableToDevice=new XI,this.eventQualitySurvey=new ZI,this.eventCallDisconnected=new QI,this.eventCallConnectDuration=new $I;let t,n;t=WO().posthogApiKey??void 0,n=WO().posthogApiHost??void 0,t&&n?(this.posthog.init(t,{api_host:n,autocapture:!1,mask_all_text:!0,mask_all_element_attributes:!0,capture_pageview:!1,sanitize_properties:this.sanitizeProperties,respect_dnt:!0,advanced_disable_decide:!0}),this.enabled=!0):(I.info(`Posthog is not enabled because there is no api key or no host given in the config`),this.enabled=!1)}registerSuperProperties(e){this.enabled&&this.posthog.register(e)}static getPlatformProperties(){return{appVersion:`embedded-v0.19.2`,matrixBackend:Sk?`embedded`:`jssdk`,callBackend:`livekit`,cryptoVersion:Sk?void 0:window.matrixclient?.getCrypto()?.getVersion()}}capture(e,t,n){this.enabled&&this.posthog.capture(e,{...t},n)}isEnabled(){return this.enabled}setAnonymity(e){this.enabled&&(e==sR.Disabled||e==sR.Anonymous)&&(this.posthog.reset(),this.updateSuperProperties()),this.anonymity=e}static getRandomAnalyticsId(){return[...crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16)).join(``)}async identifyUser(e){if(this.anonymity==sR.Pseudonymous&&this.enabled){let t=await this.getAnalyticsId();try{!t&&!Sk&&(t=e(),await this.setAccountAnalyticsId(t))}catch(e){I.log(`Unable to identify user for tracking`+e?.toString())}t?this.posthog.identify(t):I.info(`No analyticsID is available. Should not try to setup posthog`)}}async getAnalyticsId(){let t=window.matrixclient;return Sk?WO().posthogUserId:(await t.getAccountDataFromServer(e.ANALYTICS_EVENT_TYPE))?.id??null}async setAccountAnalyticsId(t){if(!Sk){let n=window.matrixclient,r=await n.getAccountDataFromServer(e.ANALYTICS_EVENT_TYPE);await n.setAccountData(e.ANALYTICS_EVENT_TYPE,Object.assign({id:t},r))}}getAnonymity(){return this.anonymity}logout(){this.enabled&&this.posthog.reset(),this.optInListener?.unsubscribe(),this.optInListener=null,this.setAnonymity(sR.Disabled)}onLoginStatusChanged(){this.maybeIdentifyUser().catch(()=>I.log(`Could not identify user on login status change`))}updateSuperProperties(){this.platformSuperProperties=e.getPlatformProperties(),this.registerSuperProperties({...this.platformSuperProperties,registrationType:this.registrationType==cR.Guest?`Guest`:`Registered`})}userRegisteredInThisSession(){return this.eventSignup.getSignupEndTime()>new Date(0)}async maybeIdentifyUser(){window.matrixclient&&(this.anonymity===sR.Pseudonymous&&(this.setRegistrationType(window.matrixclient.isGuest()||window.passwordlessUser?cR.Guest:cR.Registered),this.identificationPromise=this.identifyUser(e.getRandomAnalyticsId),await this.identificationPromise,this.userRegisteredInThisSession()&&this.eventSignup.track()),this.anonymity!==sR.Disabled&&this.updateSuperProperties())}trackEvent({eventName:e,...t},n){let r=()=>{this.anonymity==sR.Disabled||this.anonymity==sR.Anonymous||this.capture(e,t,n)};this.identificationPromise?this.identificationPromise.then(r,e=>{I.error(`Failed to identify user for tracking`,e)}):r()}startListeningToSettingsChanges(){this.optInListener??=VL.value$.subscribe(e=>{this.setAnonymity(e?sR.Pseudonymous:sR.Disabled),this.maybeIdentifyUser().catch(()=>I.log(`Could not identify user`))})}setRegistrationType(e){this.registrationType=e,!(this.anonymity==sR.Disabled||this.anonymity==sR.Anonymous)&&this.updateSuperProperties()}},uR=(0,R.createContext)(void 0);uR.Provider;var dR=()=>(0,R.use)(uR);function fR(){let e,t,n=dR();return n?.state===`valid`&&(e=n.authenticated?.client,t=n.setClient),{client:e,setClient:t}}function pR(){let e=dR(),t,n,r=!1,i=!0,a,o=!1,s;return e?.state===`valid`?(t=e.authenticated?.client,n=e.setClient,r=e.authenticated?.isPasswordlessUser??!1,i=!1,o=t!==void 0,s=e.authenticated?.logout):e?.state===`error`&&(a=e.error,i=!1),{client:t,setClient:n,passwordlessUser:r,loading:i,authenticated:o,logout:s,error:a}}var mR=`BroadcastChannel`in window?new BroadcastChannel(`load`):null,hR=({children:e})=>{let t=Fo(),[n,r]=(0,R.useState)(void 0),i=(0,R.useRef)(!1);(0,R.useEffect)(()=>{i.current||(i.current=!0,gR().then(e=>{r(e),lR.instance.isEnabled()&&lR.instance.startListeningToSettingsChanges()}).catch(e=>I.error(e)).finally(()=>i.current=!1))},[]);let a=(0,R.useCallback)(async e=>{let t=yR();!n?.client||!t||(await n.client.setPassword({type:`m.login.password`,identifier:{type:`m.id.user`,user:t.user_id},user:t.user_id,password:t.tempPassword},e),vR({...t,passwordlessUser:!1}),r({...n,passwordlessUser:!1}))},[n]),o=(0,R.useCallback)((e,t)=>{let i=n?.client;i&&i!==e&&i.stopClient(),vR(t),r({widgetApi:null,client:e,passwordlessUser:t.passwordlessUser}),lR.instance.isEnabled()&&lR.instance.startListeningToSettingsChanges()},[n?.client]),s=(0,R.useCallback)(async()=>{let e=n?.client;e&&(await e.logout(!0),await e.clearStores(),_R(),r(null),await t(`/`),lR.instance.logout(),lR.instance.setRegistrationType(cR.Guest))},[t,n?.client]);(0,R.useEffect)(()=>{Sk||mR?.postMessage({})},[]);let[c,l]=(0,R.useState)(void 0);TA(mR,`message`,(0,R.useCallback)(()=>{n?.client.stopClient(),l(new KA)},[n?.client,l]));let[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),m=(0,R.useMemo)(()=>{if(c)return{state:`error`,error:c};if(n!==void 0)return{state:`valid`,authenticated:n===null?void 0:{client:n.client,isPasswordlessUser:n.passwordlessUser,changePassword:a,logout:s},setClient:o,disconnected:u,supportedFeatures:{reactions:f}}},[c,a,n,s,o,u,f]),h=(0,R.useCallback)((e,t,n)=>{d(bR(e,n))},[]);return(0,R.useEffect)(()=>{if(n){if(window.matrixclient=n.client,window.passwordlessUser=n.passwordlessUser,lR.hasInstance()&&lR.instance.onLoginStatusChanged(),n.client&&n.client.on(cr.Sync,h),n.widgetApi){let e=n.widgetApi.hasCapability(`org.matrix.msc2762.send.event:m.reaction`),t=n.widgetApi.hasCapability(`org.matrix.msc2762.send.event:m.room.redaction`),r=n.widgetApi.hasCapability(`org.matrix.msc2762.receive.event:m.reaction`),i=n.widgetApi.hasCapability(`org.matrix.msc2762.receive.event:m.room.redaction`);!e||!r||!t||!i?(I.warn(`Widget does not support reactions`),p(!1)):p(!0)}else p(!0);return()=>{n.client&&n.client.removeListener(cr.Sync,h)}}},[n,h]),c?(0,B.jsx)(JA,{widget:Sk,error:c}):(0,B.jsx)(uR,{value:m,children:e})};async function gR(){if(Sk){I.log(`Using a matryoshka client`);let e=await Sk.client;return{widgetApi:Sk.api,client:e,passwordlessUser:!1}}else{let{initSPA:e}=await se(async()=>{let{initSPA:e}=await import(`./spa-BW6X0pJ7.js`);return{initSPA:e}},__vite__mapDeps([2,1,3]),import.meta.url);return e(yR,_R)}}var _R=()=>localStorage.removeItem(`matrix-auth-store`),vR=e=>localStorage.setItem(`matrix-auth-store`,JSON.stringify(e)),yR=()=>{let e=localStorage.getItem(`matrix-auth-store`);if(e)return JSON.parse(e)},bR=(e,t)=>e===`ERROR`&&t?.error?.name===`ConnectionError`;function xR(e){return new Worker(``+new URL(`IndexedDBWorker-Dfh2gGKd.js`,import.meta.url).href,{type:`module`,name:e?.name})}var SR=new Jn;function CR(e){return[DA(SR,e,(0,R.useCallback)(()=>localStorage.getItem(e),[e])),(0,R.useCallback)(t=>wR(e,t),[e])]}var wR=(e,t)=>{localStorage.setItem(e,t),SR.emit(e)};function TR(e,t){localStorage.getItem(ER(e))!==t&&wR(ER(e),t)}var ER=e=>`room-shared-key-${e}`,DR=(e,t)=>{let[n,r]=CR(ER(e));return(0,R.useEffect)(()=>{t&&r(t)},[t,r]),[t??n,r]};function OR(e){let{roomId:t,password:n}=WO();return e!==t&&I.warn(`requested key for a roomId which is not the current call room id (from the URL)`,e,t),n??localStorage.getItem(ER(e))}function kR(e){let{client:t}=fR(),[n]=DR(ER(e),OR(e)??void 0),r=t?.getRoom(e);return(0,R.useMemo)(()=>r?n?{kind:LO.SHARED_KEY,secret:n}:r.hasEncryptionStateEvent()?{kind:LO.PER_PARTICIPANT}:{kind:LO.NONE}:{kind:LO.NONE},[r,n])}var AR=`element-call-sync`;async function jR(e){let t=!!await e.store.getSavedSyncToken();return new Promise((n,r)=>{let i=(a,o,s)=>{a===`PREPARED`?t?t=!1:(e.removeListener(cr.Sync,i),n()):a===`ERROR`&&(e.removeListener(cr.Sync,i),r(s?.error))};e.on(cr.Sync,i)})}async function MR(e,t){let n;try{n=window.indexedDB}catch(e){I.warn(`Could not get indexDB from window.`,e)}let r={fallbackICEServerAllowed:!1,isVoipWithNoMediaAllowed:FO.get().features?.feature_group_calls_without_video_and_audio};n&&localStorage?r.store=new Ti({indexedDB:window.indexedDB,localStorage,dbName:AR,workerFactory:()=>new xR}):localStorage&&(r.store=new Dr({localStorage}));let{e2eEnabled:i}=WO();i||I.info(`Disabling E2E: group call signalling will NOT be encrypted.`);let a=Vi({...r,...e,useAuthorizationHeader:!0,localTimeoutMs:5e3,useE2eForGroupCall:i,fallbackICEServerAllowed:!1});t||await a.clearStores();try{await a.store.startup()}catch(e){I.error(`Error starting matrix client indexDB store. Falling back to memory store.`,e),a.store=new Dr({localStorage}),await a.store.startup()}try{await a.initRustCrypto()}catch(e){I.warn(e,`Make sure to clear client stores before initializing the rust crypto.`)}let o=jR(a);return await a.startClient({clientWellKnownPollPeriod:600}),await o,a}function NR(e){return e.trim().replace(/\s/g,`-`).replace(/[^\w-]/g,``).toLowerCase()}function PR(e,t){return`#${NR(e)}:${t.getDomain()}`}function FR(e){let t=e.split(`:`,2);if(t.length===2&&t[0][0]===`#`){if(t[1]===FO.defaultServerName())return t[0];throw Error(`Unsupported remote room alias`)}return e}async function IR(e,t,n){I.log(`Creating room for group call`);let r=e.createRoom({visibility:oe.Private,preset:g.PublicChat,name:t,room_alias_name:n?void 0:NR(t),power_level_content_override:{invite:100,kick:100,ban:100,redact:50,state_default:0,events_default:0,users_default:0,events:{"m.room.power_levels":100,"m.room.history_visibility":100,"m.room.tombstone":100,"m.room.encryption":100,"m.room.name":50,"m.room.message":0,"m.room.encrypted":50,"m.sticker":50,"org.matrix.msc3401.call.member":0},users:{[e.getUserId()]:100}}}),i=await new Promise((t,n)=>{r.catch(e=>{n(e),a()});let i=e=>{r.then(n=>{e.roomId===n.room_id&&(t(e.roomId),a())},e=>{I.error(`Failed to wait for the room to arrive`,e)})},a=()=>{e.off(cr.Room,i)};e.on(cr.Room,i)}),a;return n==LO.SHARED_KEY&&(a=Yt(16),TR(i,a)),{roomId:i,alias:n?void 0:PR(t,e),password:a}}function LR(e,t,n,r){return`${window.location.protocol}//${window.location.host}${RR(e,t,n,r)}`}function RR(e,t,n,r){return`/room/#${n?`/`+NR(n):``}?${YO(e,t,r).toString()}`}async function zR(e){let t=0;for(;;)try{return await e()}catch(e){t++;let n=He(e,t,!0);if(n<0)throw e;await pr(n)}}export{HA as $,Ys as $i,_h as $n,ou as $r,xS as $t,ZL as A,Wc as Ai,j_ as An,zu as Ar,Dk as At,OL as B,Lc as Bi,Kg as Bn,yu as Br,JO as Bt,GL as C,fl as Ci,vv as Cn,Ju as Cr,Yk as Ct,tR as D,ol as Di,Q_ as Dn,Hu as Dr,Lk as Dt,aR as E,sl as Ei,ev as En,qu as Er,Ik as Et,YL as F,Kc as Fi,s_ as Fn,Au as Fr,vk as Ft,iL as G,Sc as Gi,Eh as Gn,gu as Gr,FO as Gt,yL as H,Ic as Hi,Lg as Hn,xu as Hr,zO as Ht,RL as I,Jc as Ii,a_ as In,Eu as Ir,yk as It,eL as J,Cc as Ji,wh as Jn,du as Jr,US as Jt,rL as K,wc as Ki,Th as Kn,hu as Kr,PO as Kt,IL as L,qc as Li,o_ as Ln,wu as Lr,bk as Lt,eR as M,Hc as Mi,h_ as Mn,Lu as Mr,xk as Mt,HL as N,Yc as Ni,p_ as Nn,Iu as Nr,Ck as Nt,$L as O,il as Oi,Y_ as On,Wu as Or,zk as Ot,BL as P,el as Pi,m_ as Pn,Du as Pr,Sk as Pt,UA as Q,gc as Qi,Ch as Qn,uu as Qr,CS as Qt,jL as R,Gc as Ri,n_ as Rn,Cu as Rr,VO as Rt,oR as S,ul as Si,wy as Sn,$u as Sr,aA as St,WL as T,cl as Ti,nv as Tn,nd as Tr,Rk as Tt,dL as U,Fc as Ui,Mg as Un,_u as Ur,RO as Ut,CL as V,Ac as Vi,Hg as Vn,bu as Vr,KO as Vt,uL as W,jc as Wi,Eg as Wn,vu as Wr,LO as Wt,qA as X,vc as Xi,yh as Xn,cu as Xr,LS as Xt,JA as Y,bc as Yi,xh as Yn,su as Yr,VS as Yt,YA as Z,_c as Zi,bh as Zn,fu as Zr,TS as Zt,rR as _,xl as _i,lb as _n,ld as _r,mA as _t,MR as a,jo as aa,zl as ai,eS as an,Ud as ar,OA as at,JL as b,gl as bi,ab as bn,td as br,oA as bt,OR as c,pa as ca,Nl as ci,Kx as cn,Kd as cr,DA as ct,hR as d,ca as da,jl as di,Ix as dn,qd as dr,SA as dt,Qs as ea,Yl as ei,hS as en,rh as er,zA as et,fR as f,Vi as fa,kl as fi,Ax as fn,jd as fr,hA as ft,iR as g,ml as gi,fb as gn,cd as gr,vA as gt,lR as h,Dl as hi,_x as hn,od as hr,yA as ht,RR as i,Ea as ia,Vl as ii,rS as in,Qd as ir,kA as it,QL as j,Bc as ji,C_ as jn,Pu as jr,wk as jt,KL as k,Uc as ki,L_ as kn,Vu as kr,Mk as kt,TR as l,da as la,Ml as li,zx as ln,Gd as lr,wA as lt,dR as m,Fr as ma,Tl as mi,bx as mn,fd as mr,fA as mt,zR as n,cs as na,Gl as ni,aS as nn,nf as nr,MA as nt,NR as o,Fo as oa,Rl as oi,Zx as on,Hd as or,TA as ot,pR as p,mi as pa,Ol as pi,Sx as pn,dd as pr,gA as pt,tL as q,Ec as qi,Sh as qn,mu as qr,GS as qt,LR as r,ls as ra,Wl as ri,iS as rn,ef as rr,jA as rt,FR as s,Mo as sa,Ll as si,qx as sn,Xd as sr,EA as st,IR as t,os as ta,Jl as ti,dS as tn,of as tr,RA as tt,kR as u,la as ua,Pl as ui,Vx as un,Wd as ur,CA as ut,nR as v,bl as vi,cb as vn,rd as vr,pA as vt,UL as w,ll as wi,sv as wn,Qu as wr,Fk as wt,XL as x,hl as xi,ub as xn,ed as xr,sA as xt,qL as y,pl as yi,sb as yn,Zu as yr,dA as yt,kL as z,Qc as zi,e_ as zn,Su as zr,WO as zt};
|
|
61
|
+
//# sourceMappingURL=matrix-BMlTzVh5.js.map
|