iobroker.javascript 9.0.6 → 9.0.7

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.
Files changed (26) hide show
  1. package/README.md +3 -5
  2. package/admin/assets/OpenAiDialog-CVjeP8wR.js +34 -0
  3. package/admin/assets/{Save-BKC3BS3x.js → Save-DgI3b32B.js} +1 -1
  4. package/admin/assets/{ScriptEditor-CzFTsfG9.js → ScriptEditor-CXV4FkqA.js} +1 -1
  5. package/admin/assets/{ScriptEditorVanillaMonaco-DEgxOslR.js → ScriptEditorVanillaMonaco-D-2WOvcn.js} +1 -1
  6. package/admin/assets/{createSvgIcon-BQT-7-GS.js → createSvgIcon-Dtl7HhPO.js} +3 -3
  7. package/admin/assets/{index-glyB1sbj.js → index-BwNmFzfy.js} +1 -1
  8. package/admin/assets/{index-DnqHzUyv.js → index-C5V5CZI4.js} +1 -1
  9. package/admin/assets/{index-JSzqpJXf.js → index-C8bcOa64.js} +9 -9
  10. package/admin/assets/{index-Cek-i92T.js → index-DLBeMhRC.js} +4 -4
  11. package/admin/assets/{index-BHQhuPkd.js → index-D_7ZHRw9.js} +1 -1
  12. package/admin/assets/{index-CpeX0MWe.js → index-Del0XJb9.js} +1 -1
  13. package/admin/assets/{inheritsLoose--KnFDOw1.js → inheritsLoose-C9MZGDit.js} +1 -1
  14. package/admin/assets/{useTheme-DF6qfrtI.js → useTheme-g_P2Itm2.js} +1 -1
  15. package/admin/custom/assets/{index-DxyyYdTq.js → index-B6ima1M5.js} +7 -7
  16. package/admin/custom/assets/index-CoMexdpH.js +1399 -0
  17. package/admin/custom/customComponents.js +2 -2
  18. package/admin/google-blockly/own/blocks_procedures.js +15 -9
  19. package/admin/google-blockly/own/blocks_time.js +20 -6
  20. package/admin/mf-manifest.json +1 -1
  21. package/admin/remoteEntry.js +2 -2
  22. package/admin/tab.html +4 -4
  23. package/io-package.json +14 -14
  24. package/package.json +1 -1
  25. package/admin/assets/OpenAiDialog-9N4LihWY.js +0 -34
  26. package/admin/custom/assets/index-Coei6-WB.js +0 -1399
@@ -1,18 +1,18 @@
1
- import{w as _e,u as ur,l as Nr,a as lr}from"./createTheme-BwMO3rTt.js";import{C as b,R as n}from"./ConfigCustomJavascriptSet__loadShare__react__loadShare__-CzzIM-HW.js";import{C as g}from"./ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-BlV79j8y.js";import{C as m,a as oc,D as jn,u as rc}from"./index-B8sZ2j0S.js";import{g as Mc}from"./_commonjsHelpers-D6-XlEtG.js";import{u as nc}from"./useTheme-CDtRWagv.js";import"./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-BaLGCXMi.js";import"./useTheme-MELayQMj.js";import"./useThemeWithoutDefault-C-hl_s0Z.js";import"./defaultTheme-avbtL0lf.js";const Ai=11/23/100;function Lr(i){const e={r:0,g:0,b:0};if(i.length===7)e.r=parseInt(i.substring(1,3),16),e.g=parseInt(i.substring(3,5),16),e.b=parseInt(i.substring(5,7),16);else if(i.length===4){const t=i[1],s=i[2],o=i[3];e.r=parseInt(t+t,16),e.g=parseInt(s+s,16),e.b=parseInt(o+o,16)}return e}function ac(i){return`#${Math.round(i.r).toString(16)}${Math.round(i.g).toString(16)}${Math.round(i.b).toString(16)}`}function cc(i,e,t){const s=Lr(i),o=Lr(e);return s.r+=o.r*(.05+Ai*(t-1)),s.g+=o.g*(.05+Ai*(t-1)),s.b+=o.b*(.05+Ai*(t-1)),ac(s)}function jr(i,e){const t={};for(let s=1;s<=24;s++)t[`elevation${s}`]={backgroundColor:cc(i,e,s)};return t}function uc(i,e){var M,a,u,N,l,c,L,j,T,D,I;let t,s;i==="dark"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#272727"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[200],"&:hover":{color:_e[100]}}},MuiPaper:jr("#121212","#fff")},t={name:i,palette:{mode:"dark",background:{paper:"#121212",default:"#121212"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):i==="blue"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#3399CC"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"dark",background:{paper:"#151d21",default:"#151d21"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):i==="colored"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#2a3135"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[200],"&:hover":{color:_e[100]}}},MuiPaper:jr("#151d21","#fff")},t={name:i,palette:{mode:"light",primary:{main:"#3399CC"},secondary:{main:"#164477"},expert:"#96fc96"}}):i==="PT"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#0F99DE"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"light",primary:{main:"#0F99DE"},secondary:{main:"#88A536"},expert:"#BD1B24"}}):i==="DX"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#a9a9a9"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"light",primary:{main:"#F5F5F7"},secondary:{main:"#a9a9a9"},expert:"#BD1B24",text:{primary:"#007AFE",secondary:"#007AFE",disabled:"#007AFEAA"}}}):(s={MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"light",primary:{main:"#3399CC",dark:"#256c97",light:"#76d0fd"},secondary:{main:"#164477"},expert:"#14bb00"}}),t.toolbar={height:48},t.saveToolbar={background:(a=(M=t.palette)==null?void 0:M.primary)==null?void 0:a.main,button:{borderRadius:3,height:32}},t.palette&&(t.palette.grey={main:ur[300],dark:ur[400]});const o=Nr(t),r=o.palette;return Nr(o,{...e||void 0,components:{...s,MuiButton:{variants:[{props:{variant:"contained",color:"grey"},style:{backgroundColor:(u=r.grey)==null?void 0:u[300],color:r.getContrastText&&((N=r.grey)!=null&&N[300])?r.getContrastText(r.grey[300]):void 0}},{props:{variant:"outlined",color:"grey"},style:{color:(l=r.text)==null?void 0:l.primary,borderColor:r.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)","&.Mui-disabled":{border:`1px solid ${(c=r.action)==null?void 0:c.disabledBackground}`},"&:hover":{borderColor:r.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)",backgroundColor:lr(((L=r.text)==null?void 0:L.primary)||"",((j=r.action)==null?void 0:j.hoverOpacity)||.04)}}},{props:{variant:"text",color:"grey"},style:{color:(T=r.text)==null?void 0:T.primary,"&:hover":{backgroundColor:lr(((D=r.text)==null?void 0:D.primary)||"",((I=r.action)==null?void 0:I.hoverOpacity)||.04)}}}]},...(e==null?void 0:e.components)||void 0}})}function Nc(){let i,e;const t=new Promise((s,o)=>{i=s,e=o});return t.resolve=i,t.reject=e,t}function Vi(i){return(i==null?void 0:i.rows.map(e=>e.value).filter(e=>!!e))??[]}function Ke(i){return i!=null&&i.startsWith("system.host.")||(i=`system.host.${i}`),i}function Ms(i){return i!=null&&i.startsWith("system.host.")&&(i=i.substring(12)),i}function gr(i){return new Promise(e=>{setTimeout(e,i)})}function xs(i){i=(i||"").toString();const e=i[0]==="*",t=i[i.length-1]==="*";return i=i.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*"),(e?"":"^")+i+(t?"":"$")}var Re;(function(i){i[i.CONNECTING=0]="CONNECTING",i[i.CONNECTED=1]="CONNECTED",i[i.OBJECTS_LOADED=2]="OBJECTS_LOADED",i[i.READY=3]="READY"})(Re||(Re={}));var ye;(function(i){i.PERMISSION_ERROR="permissionError",i.NOT_CONNECTED="notConnectedError",i.TIMEOUT="timeout",i.NOT_ADMIN="Allowed only in admin",i.NOT_SUPPORTED="Not supported"})(ye||(ye={}));const r4e=ye.PERMISSION_ERROR;ye.NOT_CONNECTED;const lc=["material","echarts","vis"];class je{constructor(e){this.props=this.applyDefaultProps(e),this.connId=`${this.props.name?`${this.props.name}-`:""}${Math.round(Math.random()*1e6).toString().padStart(6,"0")}`,this.waitForSocketLib().then(()=>this.startSocket()).catch(t=>{alert(`Socket connection could not be initialized: ${t}`)})}applyDefaultProps(e){return{...e,protocol:e.protocol||window.location.protocol,host:e.host||window.location.hostname,port:e.port||(window.location.port==="3000"?8081:window.location.port),ioTimeout:Math.max(e.ioTimeout||2e4,2e4),cmdTimeout:Math.max(e.cmdTimeout||5e3,5e3),admin5only:e.admin5only||!1,autoSubscribes:e.autoSubscribes??[],autoSubscribeLog:e.autoSubscribeLog??!1,doNotLoadACL:e.doNotLoadACL??!0,doNotLoadAllObjects:e.doNotLoadAllObjects??!0}}props;connId;lastAccessToken=null;ignoreState="";connected=!1;subscribed=!1;firstConnect=!0;waitForRestart=!1;loaded=!1;simStates={};statesSubscribes={};filesSubscribes={};objectsSubscribes={};objects={};states={};acl=null;isSecure=!1;onReadyDone=!1;onConnectionHandlers=[];onLogHandlers=[];onCmdStdoutHandler;onCmdStderrHandler;onCmdExitHandler;onError(e){(this.props.onError??console.error)(e)}_socket;_waitForSocketPromise;_waitForFirstConnectionPromise=Nc();_instanceSubscriptions={};_promises={};_authTimer=null;_refreshTimer=null;_systemConfig;get systemConfig(){return this._systemConfig}systemLang="en";static isWeb(){return window.socketUrl!==void 0}waitForSocketLib(){return this._waitForSocketPromise?this._waitForSocketPromise:(this._waitForSocketPromise=new Promise(async(e,t)=>{if(typeof window.io>"u"&&typeof window.iob>"u")if(typeof window.registerSocketOnLoad=="function")window.registerSocketOnLoad(()=>e());else{for(let s=1;s<=30;s++){if(window.io||window.iob)return e();await gr(100)}t(new Error("Socket library could not be loaded!"))}else e()}),this._waitForSocketPromise)}async startSocket(){if(this._socket)return;let e=this.props.host,t=this.props.port,s=(this.props.protocol||window.location.protocol).replace(":",""),o=window.location.pathname;if(window.location.hostname==="iobroker.net"||window.location.hostname==="iobroker.pro")o="";else{if(window.socketUrl){const a=new URL(window.socketUrl);e=a.hostname,t=a.port,s=a.protocol.replace(":","")}const M=o.lastIndexOf("/");if(M!==-1&&(o=o.substring(0,M+1)),je.isWeb()){const a=o.split("/");a.length>2&&(a.pop(),a.pop(),lc.includes(a[a.length-1])&&a.pop(),o=a.join("/"),o.endsWith("/")||(o+="/"))}}const r=t?`${s}://${e}:${t}`:`${s}://${e}`;return this._socket=(window.io||window.iob).connect(r,{path:o.endsWith("/")?`${o}socket.io`:`${o}/socket.io`,query:"ws=true",name:this.props.name,timeout:this.props.ioTimeout,uuid:this.props.uuid,token:this.props.token}),this._socket.on("connect",M=>{window.addEventListener("storage",this.onAccessTokenUpdated);const a=je.readTokens();if(a&&!a.owner){const u=Date.now();this.saveTokens({access_token:a.access_token,refresh_token:a.refresh_token,expires_in:Math.round((a.expires_in.getTime()-u)/1e3),refresh_token_expires_in:Math.round((a.refresh_token_expires_in.getTime()-u)/1e3),token_type:"Bearer"},a.stayLoggedIn)}this.onReadyDone=!1,M!==!0?(this.connected=!0,setTimeout(()=>this.getVersion().then(u=>{const[N,l,c]=u.version.split(".");parseInt(N,10)*1e4+parseInt(l,10)*100+parseInt(c,10)<40102?(this._authTimer=null,this.onPreConnect(!1,!1)):this._socket.emit("authenticate",(j,T)=>this.onPreConnect(j,T))}).catch(u=>this.onError({message:u.toString(),operation:"getVersion"})),500)):this._socket.emit("authenticate",(u,N)=>{this.onPreConnect(u,N)})}),this._socket.on("reconnect",()=>{var M,a;this.onReadyDone=!1,(a=(M=this.props).onProgress)==null||a.call(M,Re.READY),this.connected=!0,this.waitForRestart?window.location.reload():(this._subscribe(!0),this.onConnectionHandlers.forEach(u=>u(!0)))}),this._socket.on("disconnect",()=>{var M,a;this.onReadyDone=!1,this.connected=!1,this.subscribed=!1,(a=(M=this.props).onProgress)==null||a.call(M,Re.CONNECTING),this.onConnectionHandlers.forEach(u=>u(!1))}),this._socket.on("reauthenticate",()=>this.authenticate()),this._socket.on("log",M=>{var a,u;(u=(a=this.props).onLog)==null||u.call(a,M),this.onLogHandlers.forEach(N=>N(M))}),this._socket.on("error",M=>{let a;M==null?a="":typeof M.toString=="function"?a=M.toString():(a=JSON.stringify(M),console.error(`Received strange error: ${a}`)),a.includes("User not authorized")?this.authenticate():a.includes("websocket error")?(console.error(`Socket Error => reload: ${M}`),window.location.reload()):console.error(`Socket Error: ${M}`)}),this._socket.on("connect_error",M=>console.error(`Connect error: ${M}`)),this._socket.on("permissionError",M=>this.onError({message:"no permission",operation:M.operation,type:M.type,id:M.id||""})),this._socket.on("objectChange",(M,a)=>{setTimeout(()=>this.objectChange(M,a),0)}),this._socket.on("stateChange",(M,a)=>{setTimeout(()=>this.stateChange(M,a),0)}),this._socket.on("im",(M,a,u)=>{setTimeout(()=>this.instanceMessage(M,a,u),0)}),this._socket.on("fileChange",(M,a,u)=>{setTimeout(()=>this.fileChange(M,a,u),0)}),this._socket.on("cmdStdout",(M,a)=>{var u;(u=this.onCmdStdoutHandler)==null||u.call(this,M,a)}),this._socket.on("cmdStderr",(M,a)=>{var u;(u=this.onCmdStderrHandler)==null||u.call(this,M,a)}),this._socket.on("cmdExit",(M,a)=>{var u;(u=this.onCmdExitHandler)==null||u.call(this,M,a)}),Promise.resolve()}onPreConnect(e,t){var s,o;this._authTimer&&(clearTimeout(this._authTimer),this._authTimer=null),this.connected=!0,this.isSecure=t,this.waitForRestart?window.location.reload():(this.firstConnect?this.loadData().catch(r=>console.error(`Cannot load data: ${r}`)):(o=(s=this.props).onProgress)==null||o.call(s,Re.READY),this._subscribe(!0),this.onConnectionHandlers.forEach(r=>r(!0)),this.checkAccessTokenExpire()),this._waitForFirstConnectionPromise.resolve()}static readTokens(){let e=window.sessionStorage.getItem("iob_tokens");const t=!e;if(e||(e=window.localStorage.getItem("iob_tokens")),!e)return null;const[s,o,r,M,a]=e.split(";"),u=new Date(o);return u.getTime()<Date.now()?null:{refresh_token:s,refresh_token_expires_in:u,access_token:r,expires_in:new Date(M),owner:a,stayLoggedIn:t}}static saveTokensStatic(e,t,s){const o=`${e.refresh_token};${new Date(Date.now()+e.refresh_token_expires_in*1e3).toISOString()};${e.access_token};${new Date(Date.now()+e.expires_in*1e3).toISOString()}${s?`;${s}`:""}`;t?window.localStorage.setItem("iob_tokens",o):window.sessionStorage.setItem("iob_tokens",o)}saveTokens(e,t){je.saveTokensStatic(e,t,this.connId)}static deleteTokensStatic(){window.localStorage.removeItem("iob_tokens"),window.sessionStorage.removeItem("iob_tokens")}deleteTokens(e,t){const s=je.readTokens();s&&(t?je.deleteTokensStatic():s.stayLoggedIn===e&&s.owner===this.connId&&(s.stayLoggedIn?window.localStorage.removeItem("iob_tokens"):window.sessionStorage.removeItem("iob_tokens")))}onAccessTokenUpdated=e=>{if(e.key==="iob_tokens"){const t=je.readTokens();t&&(console.log(`Tab ${this.connId} received updated token: ${t.access_token}`),this.updateTokenExpiration(t.access_token))}};updateTokenExpiration(e){this.lastAccessToken!==e&&(this.lastAccessToken=e,this._socket.emit("updateTokenExpiration",e,(t,s)=>{t?(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${t}`),window.location.reload()):s?console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${e}`):(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`),window.location.reload())})),this.checkAccessTokenExpire()}refreshTokens(e,t){if(!e){console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`),setTimeout(()=>window.location.reload(),500);return}t||!e.owner||e.owner===this.connId?(console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`),this.acquireTokenLock()?(console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`),fetch("./oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`grant_type=refresh_token&refresh_token=${e.refresh_token}&client_id=ioBroker&stayloggedin=${e.stayLoggedIn}`}).then(s=>{if(s.ok)return s.json();throw new Error("Cannot refresh access token")}).then(s=>{if(s.access_token)console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${s.access_token}`),this.saveTokens(s,e.stayLoggedIn),this.releaseTokenLock(),this.updateTokenExpiration(s.access_token);else throw new Error("Cannot get access token")}).catch(s=>{console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${s}`),this.releaseTokenLock(),this.deleteTokens(e.stayLoggedIn),console.error(s),window.location.reload()})):(console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`),this.checkAccessTokenExpire())):this.lastAccessToken!==e.access_token&&this.updateTokenExpiration(e.access_token)}acquireTokenLock(){const e=Date.now(),t=localStorage.getItem("iob_token_semaphore");if(t)try{const o=JSON.parse(t);if(e<o.expiry)return!1}catch{}const s={connId:this.connId,expiry:e+10*1e3};return localStorage.setItem("iob_token_semaphore",JSON.stringify(s)),!0}releaseTokenLock(){const e=localStorage.getItem("iob_token_semaphore");if(e)try{JSON.parse(e).connId===this.connId&&localStorage.removeItem("iob_token_semaphore")}catch{localStorage.removeItem("iob_token_semaphore")}}checkAccessTokenExpire(){if(this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null),this.isSecure){const e=je.readTokens();if(e){const t=e.expires_in.getTime();if(t<Date.now()+3e4){const s=t<Date.now()+5500;console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${e.access_token}`),e.refresh_token?e.owner===this.connId||s?(e.owner===this.connId?console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`):console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`),this.props.tokenTimeoutHandler?(console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`),this.props.tokenTimeoutHandler(t).then(o=>{o?(console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`),this.refreshTokens(e,s)):(console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))})):(console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`),this.refreshTokens(e,s))):this.lastAccessToken!==e.access_token?(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`),this.refreshTokens(e)):(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`),this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},3e3)):(console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))}else this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},t-Date.now()-3e4>12e4?12e4:t-Date.now()-3e4)}}}static isCloud(){return window.location.hostname.includes("amazonaws.com")||window.location.hostname.includes("iobroker.in")?!0:typeof window.socketUrl>"u"?!1:window.socketUrl.includes("iobroker.in")||window.socketUrl.includes("amazonaws")}isConnected(){return this.connected}waitForFirstConnection(){return this._waitForFirstConnectionPromise}async getUserPermissions(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getUserPermissions",(s,o)=>{s?t(s):e(o||null)})}})}async loadData(){if(this.loaded)return;const e=10;for(let t=1;t<=e;t++){if(this.doLoadData().catch(s=>console.error(`Cannot load data: ${s}`)),this.loaded)return;await gr(je.isCloud()?5e3:1e3)}}async doLoadData(){var e,t,s,o,r,M,a,u,N;if(!this.loaded){if(!this.props.doNotLoadACL)try{this.acl=await this.getUserPermissions()}catch(l){this.onError(`Cannot read user permissions: ${l}`);return}try{this.props.admin5only&&!je.isWeb()&&(!window.vendorPrefix||window.vendorPrefix==="@@vendorPrefix@@")?this._systemConfig=await this.getCompactSystemConfig():this._systemConfig=await this.getSystemConfig()}catch(l){this.onError(`Cannot read system config: ${l}`);return}this._systemConfig&&(this.systemLang=(e=this._systemConfig.common)==null?void 0:e.language,this.systemLang||(this.systemLang=window.navigator.userLanguage||window.navigator.language,/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(this.systemLang)?this.systemLang=this.systemLang.substring(0,2):/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(this.systemLang)||(this.systemLang="en"),this._systemConfig.common.language=this.systemLang)),(s=(t=this.props).onLanguage)==null||s.call(t,this.systemLang),this.loaded=!0,(r=(o=this.props).onProgress)==null||r.call(o,Re.CONNECTED),this.firstConnect=!1,this.props.doNotLoadAllObjects?this.props.admin5only?this.objects={}:this.objects={"system.config":this._systemConfig}:this.objects=await this.getObjects(),(a=(M=this.props).onProgress)==null||a.call(M,Re.READY),this.onReadyDone||(this.onReadyDone=!0,(N=(u=this.props).onReady)==null||N.call(u,this.objects))}}authenticate(){window.location.search.includes("&href=")?window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}`:window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}?login&href=${encodeURIComponent(window.location.search+window.location.hash)}`}async subscribeState(...e){let t,s,o;e.length===3?[t,s,o]=e:([t,o]=e,s=!1);let r;if(Array.isArray(t)?r=t:r=[t],typeof o!="function")throw new Error("The state change handler must be a function!");const M=[];for(let a=0;a<r.length;a++){const u=r[a];this.statesSubscribes[u]?!this.statesSubscribes[u].cbs.includes(o)&&this.statesSubscribes[u].cbs.push(o):(this.statesSubscribes[u]={reg:new RegExp(xs(u)),cbs:[o]},t!==this.ignoreState&&M.push(u))}if(this.connected)if(M.length&&this._socket.emit("subscribe",M),s){let a;for(let u=0;u<r.length;u++){try{a=await this.getBinaryState(r[u])}catch(N){console.error(`Cannot getBinaryState "${r[u]}": ${JSON.stringify(N)}`),a=void 0}a!=null&&o(r[u],a)}}else if(r.find(a=>a.includes("*"))){let a;for(let u=0;u<r.length;u++){try{a=await this.getForeignStates(r[u])}catch(N){console.error(`Cannot getForeignStates "${r[u]}": ${JSON.stringify(N)}`);return}if(a)for(const[N,l]of Object.entries(a)){const c=o(N,l);c instanceof Promise&&c.catch(L=>console.error(`Cannot call state change handler: ${L}`))}}}else try{const a=await(je.isWeb()?this.getStates(r):this.getForeignStates(r));if(a)for(const[u,N]of Object.entries(a)){const l=o(u,N);l instanceof Promise&&l.catch(c=>console.error(`Cannot call state change handler: ${c}`))}}catch(a){console.error(`Cannot getState "${r.join(", ")}": ${a.message}`);return}}async subscribeStateAsync(e,t){return this.subscribeState(e,t)}unsubscribeState(e,t){var r;let s;Array.isArray(e)?s=e:s=[e];const o=[];for(let M=0;M<s.length;M++){const a=s[M];if(this.statesSubscribes[a]){const u=this.statesSubscribes[a];if(t){const N=u.cbs.indexOf(t);N!==-1&&u.cbs.splice(N,1)}else u.cbs=[];(r=u.cbs)!=null&&r.length||(delete this.statesSubscribes[a],a!==this.ignoreState&&o.push(a))}}this.connected&&o.length&&this._socket.emit("unsubscribe",s)}subscribeObject(e,t){let s;if(Array.isArray(e)?s=e:s=[e],typeof t!="function")throw new Error("The object change handler must be a function!");const o=[];for(let r=0;r<s.length;r++){const M=s[r];this.objectsSubscribes[M]?!this.objectsSubscribes[M].cbs.includes(t)&&this.objectsSubscribes[M].cbs.push(t):(this.objectsSubscribes[M]={reg:new RegExp(xs(M)),cbs:[t]},o.push(M))}return this.connected&&o.length&&this._socket.emit("subscribeObjects",o),Promise.resolve()}unsubscribeObject(e,t){var r;let s;Array.isArray(e)?s=e:s=[e];const o=[];for(let M=0;M<s.length;M++){const a=s[M];if(this.objectsSubscribes[a]){const u=this.objectsSubscribes[a];if(t){const N=u.cbs.indexOf(t);N!==-1&&u.cbs.splice(N,1)}else u.cbs=[];(r=u.cbs)!=null&&r.length||(delete this.objectsSubscribes[a],o.push(a))}}return this.connected&&o.length&&this._socket.emit("unsubscribeObjects",o),Promise.resolve()}objectChange(e,t){var r,M;let s;this.objects[e]&&(s={_id:e,type:this.objects[e].type});let o=!1;t?(t._rev&&this.objects[e]&&(this.objects[e]._rev=t._rev),(!this.objects[e]||JSON.stringify(this.objects[e])!==JSON.stringify(t))&&(this.objects[e]=t,o=!0)):this.objects[e]&&(delete this.objects[e],o=!0);for(const[a,u]of Object.entries(this.objectsSubscribes))(a===e||u.reg.test(e))&&u.cbs.forEach(N=>{try{const l=N(e,t,s);l instanceof Promise&&l.catch(c=>console.error(`Cannot call object change handler: ${c}`))}catch(l){console.error(`Error by callback of objectChange: ${l}`)}});if(o){const a=(M=(r=this.props).onObjectChange)==null?void 0:M.call(r,e,t);a instanceof Promise&&a.catch(u=>console.error(`Cannot call object change handler: ${u}`))}}stateChange(e,t){for(const s of Object.values(this.statesSubscribes))if(s.reg.test(e))for(const o of s.cbs)try{const r=o(e,t??null);r instanceof Promise&&r.catch(M=>console.error(`Cannot call state change handler: ${M}`))}catch(r){console.error(`Error by callback of stateChanged: ${r}`)}}instanceMessage(e,t,s){var o;(o=this._instanceSubscriptions[t])==null||o.forEach(r=>{if(r.messageType===e){const M=r.callback(s,t,e);M instanceof Promise&&M.catch(a=>console.error(`Cannot call instance message handler: ${a}`))}})}fileChange(e,t,s){for(const o of Object.values(this.filesSubscribes))if(o.regId.test(e)&&o.regFilePattern.test(t))for(const r of o.cbs)try{r(e,t,s)}catch(M){console.error(`Error by callback of fileChange: ${M}`)}}async subscribeFiles(e,t,s){if(typeof s!="function")throw new Error("The state change handler must be a function!");let o;Array.isArray(t)?o=t:o=[t];const r=[];for(let M=0;M<o.length;M++){const a=o[M],u=`${e}$%$${a}`;this.filesSubscribes[u]?!this.filesSubscribes[u].cbs.includes(s)&&this.filesSubscribes[u].cbs.push(s):(this.filesSubscribes[u]={regId:new RegExp(xs(e)),regFilePattern:new RegExp(xs(a)),cbs:[s]},r.push(a))}return this.connected&&r.length&&this._socket.emit("subscribeFiles",e,r),Promise.resolve()}unsubscribeFiles(e,t,s){var M;let o;Array.isArray(t)?o=t:o=[t];const r=[];for(let a=0;a<o.length;a++){const u=o[a],N=`${e}$%$${u}`;if(this.filesSubscribes[N]){const l=this.filesSubscribes[N];if(s){const c=l.cbs.indexOf(s);c!==-1&&l.cbs.splice(c,1)}else l.cbs=[];(M=l.cbs)!=null&&M.length||(delete this.filesSubscribes[N],r.push(u))}}this.connected&&r.length&&this._socket.emit("unsubscribeFiles",e,r)}async request({cacheKey:e,forceUpdate:t,commandTimeout:s,onTimeout:o,requireAdmin:r,requireFeatures:M,executor:a}){if(r&&je.isWeb())return Promise.reject(new Error(ye.NOT_ADMIN));if(e&&!t&&e in this._promises)return this._promises[e];if(!this.connected)return Promise.reject(new Error(ye.NOT_CONNECTED));if(M!=null&&M.length){for(const N of M)if(!await this.checkFeatureSupported(N))throw new Error(ye.NOT_SUPPORTED)}const u=new Promise(async(N,l)=>{const c={elapsed:!1,clearTimeout:()=>{}};let L;s!==!1&&(L=setTimeout(()=>{c.elapsed=!0,o==null||o(),e&&this._promises[e]instanceof Promise&&delete this._promises[e],l(new Error(ye.TIMEOUT))},s??this.props.cmdTimeout),c.clearTimeout=()=>{clearTimeout(L)});try{await a(N,l,c)}catch(j){e&&this._promises[e]instanceof Promise&&delete this._promises[e],l(new Error(j.toString()))}});return e&&(this._promises[e]=u),u}resetCache(e,t){t?Object.keys(this._promises).filter(s=>s.startsWith(e)).forEach(s=>{delete this._promises[s]}):delete this._promises[e]}getStates(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getStates",e,(o,r)=>{this.states=r??{},o?s(o):t(this.states)})}})}getState(e){return this.request({commandTimeout:!1,executor:(t,s)=>{if(e&&e===this.ignoreState){t(this.simStates[e]||{val:null,ack:!0});return}this._socket.emit("getState",e,(o,r)=>{o?s(o):t(r)})}})}getBinaryState(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getBinaryState",e,(o,r)=>{o?s(o):t(r)})}})}setBinaryState(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("setBinaryState",e,t,r=>{r?o(r):s()})}})}setState(e,t,s){return typeof s=="boolean"&&(t={val:t,ack:s}),this.request({commandTimeout:!1,executor:(o,r)=>{if(e&&e===this.ignoreState){let M;if(typeof s=="boolean"||typeof t=="object"&&t.val!==void 0?M=t:M={val:t,ack:!1,ts:Date.now(),lc:Date.now(),from:"system.adapter.vis.0"},this.simStates[e]=M,this.statesSubscribes[e])for(const a of this.statesSubscribes[e].cbs)try{const u=a(e,M);u instanceof Promise&&u.catch(N=>console.error(`Cannot call state change handler: ${N}`))}catch(u){console.error(`Error by callback of stateChanged: ${u}`)}o();return}this._socket.emit("setState",e,t,M=>{M?r(M):o()})}})}getObjects(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{if(!e&&this.objects){s(this.objects);return}this._socket.emit(je.isWeb()?"getObjects":"getAllObjects",(r,M)=>{var a,u;t||(u=(a=this.props).onProgress)==null||u.call(a,Re.OBJECTS_LOADED),r?o(r):(this.objects=M??{},s(this.objects))})}})}getObjectsById(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjects",e,(o,r)=>{o?s(o):t(r)})}})}_subscribe(e){var t,s;if(e&&!this.subscribed){this.subscribed=!0,(t=this.props.autoSubscribes)!=null&&t.length&&this._socket.emit("subscribeObjects",this.props.autoSubscribes);const o=Object.keys(this.objectsSubscribes);o.length&&this._socket.emit("subscribeObjects",o),Object.keys(this.objectsSubscribes).forEach(r=>this._socket.emit("subscribeObjects",r)),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!0),Object.keys(this.statesSubscribes).forEach(r=>this._socket.emit("subscribe",r)),Object.keys(this.filesSubscribes).forEach(r=>{const[M,a]=r.split("$%$");this._socket.emit("subscribeFiles",M,a)})}else if(!e&&this.subscribed){this.subscribed=!1,(s=this.props.autoSubscribes)!=null&&s.length&&this._socket.emit("unsubscribeObjects",this.props.autoSubscribes);const o=Object.keys(this.objectsSubscribes);o.length&&this._socket.emit("unsubscribeObjects",o),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!1),Object.keys(this.statesSubscribes).forEach(r=>this._socket.emit("unsubscribe",r)),Object.keys(this.filesSubscribes).forEach(r=>{const[M,a]=r.split("$%$");this._socket.emit("unsubscribeFiles",M,a)})}}requireLog(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("requireLog",e,o=>{o?s(o):t()})}})}delObject(e,t=!1){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("delObject",e,{maintenance:t},r=>{r?o(r):s()})}})}delObjects(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("delObjects",e,{maintenance:t},r=>{r?o(r):s()})}})}setObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("setObject",e,t,r=>{r?o(r):s()})}})):Promise.reject(new Error("Null object is not allowed"))}getObject(e){return this.request({commandTimeout:!1,executor:(t,s)=>{if(e&&e===this.ignoreState){t({_id:this.ignoreState,type:"state",common:{name:"ignored state",type:"mixed"}});return}this._socket.emit("getObject",e,(o,r)=>{o?s(o):t(r)})}})}sendTo(e,t,s){return this.request({commandTimeout:!1,executor:o=>{this._socket.emit("sendTo",e,t,s,r=>{o(r)})}})}extendObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("extendObject",e,t,r=>{r?o(r):s()})}})):Promise.reject(new Error("Null object is not allowed"))}registerLogHandler(e){this.onLogHandlers.includes(e)||this.onLogHandlers.push(e)}unregisterLogHandler(e){const t=this.onLogHandlers.indexOf(e);t!==-1&&this.onLogHandlers.splice(t,1)}registerConnectionHandler(e){this.onConnectionHandlers.includes(e)||this.onConnectionHandlers.push(e)}unregisterConnectionHandler(e){const t=this.onConnectionHandlers.indexOf(e);t!==-1&&this.onConnectionHandlers.splice(t,1)}registerCmdStdoutHandler(e){this.onCmdStdoutHandler=e}unregisterCmdStdoutHandler(){this.onCmdStdoutHandler=void 0}registerCmdStderrHandler(e){this.onCmdStderrHandler=e}unregisterCmdStderrHandler(){this.onCmdStderrHandler=void 0}registerCmdExitHandler(e){this.onCmdExitHandler=e}unregisterCmdExitHandler(){this.onCmdExitHandler=void 0}getEnums(e,t){return this.request({cacheKey:`enums_${e||"all"}`,forceUpdate:t,commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getObjectView","system","enum",{startkey:`enum.${e||""}`,endkey:e?`enum.${e}.香`:"enum.香"},(r,M)=>{if(r)o(r);else{const a={};if(M)for(let u=0;u<M.rows.length;u++)e&&M.rows[u].id===`enum.${e}`||(a[M.rows[u].id]=M.rows[u].value);s(a)}})}})}getObjectView(e,t,s){return this.getObjectViewCustom("system",s,e,t)}getObjectViewSystem(e,t,s){return this.getObjectViewCustom("system",e,t,s)}getObjectViewCustom(e,t,s,o){return this.request({commandTimeout:!1,executor:(r,M)=>{s=s||"",o=o||"香",this._socket.emit("getObjectView",e,t,{startkey:s,endkey:o},(a,u)=>{if(a)M(a);else{const N={};if(u&&u.rows)for(let l=0;l<u.rows.length;l++)N[u.rows[l].id]=u.rows[l].value;r(N)}})}})}readMetaItems(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getObjectView","system","meta",{startkey:"",endkey:"香"},(s,o)=>{var r;s?t(s):e((r=o.rows)==null?void 0:r.map(M=>M.value).filter(M=>!!M))})}})}readDir(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("readDir",e,t,(r,M)=>{r?o(r):s(M)})}})}readFile(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit(s?"readFile64":"readFile",e,t,(M,a,u)=>{M?r(M):o({file:a,mimeType:u})})}})}writeFile64(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{if(typeof s=="string")this._socket.emit("writeFile",e,t,s,M=>{M?r(M):o()});else{const M=btoa(new Uint8Array(s).reduce((a,u)=>a+String.fromCharCode(u),""));this._socket.emit("writeFile64",e,t,M,a=>{a?r(a):o()})}}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFile",e,t,r=>{r?o(r):s()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFolder",e,t,r=>{r?o(r):s()})}})}rename(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("rename",e,t,s,M=>{M?r(M):o()})}})}renameFile(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("renameFile",e,t,s,M=>{M?r(M):o()})}})}cmdExec(e,t,s,o){return this.request({commandTimeout:o,executor:(r,M,a)=>{e=Ke(e),this._socket.emit("cmdExec",e,s,t,u=>{a.elapsed||(a.clearTimeout(),u?M(u):r())})}})}getSystemConfig(e){return this.request({cacheKey:"systemConfig",forceUpdate:e,commandTimeout:!1,executor:async t=>{let s=await this.getObject("system.config");s??={},s.common??={},s.native??={},t(s)}})}getCompactSystemConfig(e){return this.request({cacheKey:"systemConfigCommon",forceUpdate:e,commandTimeout:!1,requireAdmin:!0,executor:(t,s)=>{this._socket.emit("getCompactSystemConfig",(o,r)=>{o?s(o):(r??={},r.common??={},r.native??={},t(r))})}})}getForeignStates(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getForeignStates",e||"*",(o,r)=>{o?s(o):t(r??{})})}})}getForeignObjects(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getForeignObjects",e||"*",t,(r,M)=>{r?o(r):s(M)})}})}setSystemConfig(e){return this.setObject("system.config",e)}getRawSocket(){return this._socket}getHistory(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getHistory",e,t,(r,M)=>{r?o(r):s(M)})}})}getHistoryEx(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getHistory",e,t,(r,M,a,u)=>{r?o(r):s({values:M,sessionId:u,step:a})})}})}getIpAddresses(e,t){return e=Ke(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=await this.getObject(e);s((o==null?void 0:o.common.address)??[])}})}getVersion(e){return this.request({cacheKey:"version",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getVersion",(o,r,M)=>{o&&!r&&typeof o=="string"&&o.match(/\d+\.\d+\.\d+/)?t({version:o,serverName:"socketio"}):o?s(o):t({version:r,serverName:M})})}})}getWebServerName(){return this.request({cacheKey:"webName",commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getAdapterName",(s,o)=>{s?t(s):e(o)})}})}fileExists(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("fileExists",e,t,(r,M)=>{r?o(r):s(!!M)})}})}getCurrentUser(){return this.request({commandTimeout:!1,executor:e=>{this._socket.emit("authEnabled",(t,s)=>{e(s)})}})}getUuid(){return this.request({cacheKey:"uuid",commandTimeout:!1,executor:async e=>{var s;const t=await this.getObject("system.meta.uuid");e((s=t==null?void 0:t.native)==null?void 0:s.uuid)}})}checkFeatureSupported(e,t){return this.request({cacheKey:`supportedFeatures_${e}`,forceUpdate:t,commandTimeout:!1,executor:(s,o)=>{this._socket.emit("checkFeatureSupported",e,(r,M)=>{r?o(r):s(M)})}})}getAdapterInstances(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`instances_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=e?`system.adapter.${e}.`:"system.adapter.",r=`${o}香`,M=await this.getObjectViewSystem("instance",o,r),a=Object.values(M);s(e?a.filter(u=>u.common.name===e):a)}})}getAdapters(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`adapter_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=await this.getObjectViewSystem("adapter",`system.adapter.${e||""}`,`system.adapter.${e||"香"}`),r=Object.values(o);s(e?r.filter(M=>M.common.name===e):r)}})}getGroups(e){return this.request({cacheKey:"groups",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjectView","system","group",{startkey:"system.group.",endkey:"system.group.香"},(o,r)=>{o?s(o):t(Vi(r))})}})}logout(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("logout",s=>{s?t(s):e(null)})}})}subscribeOnInstance(e,t,s,o){return this.request({commandTimeout:!1,executor:(r,M)=>{this._socket.emit("clientSubscribe",e,t,s,(a,u)=>{a?M(a):u&&(u.error?M(u.error):(e.startsWith("system.adapter.")||(e=`system.adapter.${e}`),this._instanceSubscriptions[e]=this._instanceSubscriptions[e]||[],this._instanceSubscriptions[e].find(N=>N.messageType===t&&N.callback===o)||this._instanceSubscriptions[e].push({messageType:t,callback:o}),r(u)))})}})}unsubscribeFromInstance(e,t,s){var M;e.startsWith("system.adapter.")||(e=`system.adapter.${e}`);let o;const r=[];do{o=!1;const a=(M=this._instanceSubscriptions[e])==null?void 0:M.findIndex(u=>(!t||u.messageType===t)&&(!s||u.callback===s));if(a!=null&&a!==-1){o=!0;const u=this._instanceSubscriptions[e][a].messageType;this._instanceSubscriptions[e].splice(a,1),this._instanceSubscriptions[e].length||delete this._instanceSubscriptions[e],this._instanceSubscriptions[e]&&this._instanceSubscriptions[e].find(l=>l.messageType===u)||r.push(this.request({commandTimeout:!1,executor:(l,c)=>{this._socket.emit("clientUnsubscribe",e,t,(L,j)=>L?c(L):l(j))}}))}}while(o&&(!s||!t));return r.length?Promise.all(r).then(a=>!!a.find(u=>u)):Promise.resolve(!1)}log(e,t){return e?this.request({commandTimeout:!1,executor:s=>(this._socket.emit("log",e,t),s(null))}):Promise.resolve(null)}setStateToIgnore(e){this.ignoreState=e}}function Lc(i,e){if(!e)return;let t;if(e.length<700&&(e.indexOf("/")!==-1||e.indexOf("\\")!==-1))if(i.toLowerCase().includes("private"))t="private";else if(e.toLowerCase().includes("private"))t="private";else if(i.toLowerCase().includes("public"))t="public";else if(e.toLowerCase().includes("public"))t="public";else if(i.toLowerCase().includes("chain"))t="chained";else if(e.toLowerCase().includes("chain"))t="chained";else return;else t=e.substring(0,26)==="-----BEGIN RSA PRIVATE KEY"||e.substring(0,22)==="-----BEGIN PRIVATE KEY"?"private":"public",t==="public"&&e.split("-----END CERTIFICATE-----").filter(o=>o.replace(/\r\n|\r|\n/,"").trim()).length>1&&(t="chained");return{name:i,type:t}}function jc(i){var s,o,r,M;const e=[{name:"[IPv4] 0.0.0.0 - Listen on all IPs",address:"0.0.0.0",family:"ipv4"}],t=[{name:"[IPv6] :: - Listen on all IPs",address:"::",family:"ipv6"}];if((o=(s=i.native)==null?void 0:s.hardware)!=null&&o.networkInterfaces){const a=(M=(r=i.native)==null?void 0:r.hardware)==null?void 0:M.networkInterfaces;Object.keys(a).forEach(u=>{a[u].forEach(N=>{N.family!=="IPv6"?e.push({name:`[${N.family}] ${N.address} - ${u}`,address:N.address,family:"ipv4"}):t.push({name:`[${N.family}] ${N.address} - ${u}`,address:N.address,family:"ipv6"})})})}return{IPs4:e,IPs6:t}}class M4e extends je{constructor(e){super(e)}request(e){return super.request({requireAdmin:!0,...e})}getCertificates(e){return this.request({cacheKey:"cert",forceUpdate:e,commandTimeout:!1,executor:async t=>{var o;const s=await this.getObject("system.certificates");(o=s==null?void 0:s.native)!=null&&o.certificates?t(Object.entries(s.native.certificates).map(([r,M])=>Lc(r,M)).filter(r=>!!r)):t([])}})}getLogs(e,t=200){return this.request({commandTimeout:!1,executor:s=>{this._socket.emit("sendToHost",e,"getLogs",t||200,o=>{s(o)})}})}upgradeAdapterWithWebserver(e,t){return this.request({commandTimeout:!1,executor:s=>{this._socket.emit("sendToHost",e,"upgradeAdapterWithWebserver",t,o=>{s(o)})}})}upgradeController(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("sendToHost",e,"upgradeController",{version:t,adminInstance:s},M=>{const a=M;a.error?r(a.error):o(a.result)})}})}updateLicenses(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("updateLicenses",e,t,(r,M)=>{r?o(r):s(M)})}})}upgradeOsPackages(e,t,s){return this.request({commandTimeout:!1,executor:o=>{this._socket.emit("sendToHost",e,"upgradeOsPackages",{packages:t,restart:!!s},r=>{o(r)})}})}getLogsFiles(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("readLogs",e,(o,r)=>{o&&s(o),t(r)})}})}delLogs(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("sendToHost",e,"delLogs",null,o=>{o&&s(o),t()})}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFile",e,t,r=>{r&&o(r),s()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFolder",e,t,r=>{r&&o(r),s()})}})}rename(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("rename",e,t,s,M=>{M&&r(M),o()})}})}renameFile(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("renameFile",e,t,s,M=>{M&&r(M),o()})}})}getHosts(e){return this.request({cacheKey:"hosts",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjectView","system","host",{startkey:"system.host.",endkey:"system.host.香"},(o,r)=>{o?s(o):t(Vi(r))})}})}getUsers(e){return this.request({cacheKey:"users",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjectView","system","user",{startkey:"system.user.",endkey:"system.user.香"},(o,r)=>{o?s(o):t(Vi(r))})}})}renameGroup(e,t,s){return this.request({commandTimeout:!1,executor:async o=>{const r=await this.getGroups(!0),M=r.filter(u=>u._id.startsWith(`${e}.`));for(const u of M){const N=u._id,l=t+u._id.substring(e.length);u._id=l,await this.setObject(l,u),await this.delObject(N)}const a=r.find(u=>u._id===e);if(a){const u=a._id;a._id=t,s!==void 0&&(a.common??={},a.common.name=s),await this.setObject(t,a),await this.delObject(u)}o()}})}getHostInfo(e,t,s){return e=Ke(e),this.request({cacheKey:`hostInfo_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("sendToHost",e,"getHostInfo",null,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getHostInfo"'):a?o(a):r('Cannot read "getHostInfo"'))})}})}getHostInfoShort(e,t,s){return e=Ke(e),this.request({cacheKey:`hostInfoShort_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("sendToHost",e,"getHostInfoShort",null,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getHostInfoShort"'):a?o(a):r('Cannot read "getHostInfoShort"'))})}})}getRepository(e,t,s,o){return this.request({cacheKey:`repository_${e}`,forceUpdate:s,commandTimeout:o,executor:(r,M,a)=>{this._socket.emit("sendToHost",e,"getRepository",t,u=>{a.elapsed||(a.clearTimeout(),u===ye.PERMISSION_ERROR?M('May not read "getRepository"'):u?r(u):M('Cannot read "getRepository"'))})}})}getInstalled(e,t,s){return e=Ke(e),this.request({cacheKey:`installed_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("sendToHost",e,"getInstalled",null,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getInstalled"'):a?o(a):r('Cannot read "getInstalled"'))})}})}cmdExec(e,t,s,o){return this.request({commandTimeout:o,executor:(r,M,a)=>{e=Ke(e),this._socket.emit("cmdExec",e,s,t,u=>{a.elapsed||(a.clearTimeout(),u&&M(u),r())})}})}readBaseSettings(e){return e=Ms(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(t,s,o)=>{this._socket.emit("sendToHost",e,"readBaseSettings",null,r=>{o.elapsed||(o.clearTimeout(),r===ye.PERMISSION_ERROR?s('May not read "BaseSettings"'):r?r.error?s(new Error(r.error)):t(r):s('Cannot read "BaseSettings"'))})}})}writeBaseSettings(e,t){return e=Ms(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"writeBaseSettings",t,M=>{r.elapsed||(r.clearTimeout(),M===ye.PERMISSION_ERROR?o('May not write "BaseSettings"'):M?s(M):o('Cannot write "BaseSettings"'))})}})}restartController(e){return e=Ms(e),this.request({executor:(t,s,o)=>{this._socket.emit("sendToHost",e,"restartController",null,()=>{o.elapsed||(o.clearTimeout(),t(!0))})}})}getDiagData(e,t){return e=Ms(e),this.request({executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"getDiagData",t,M=>{r.elapsed||(r.clearTimeout(),s(M||null))})}})}changePassword(e,t){return this.request({executor:(s,o,r)=>{this._socket.emit("changePassword",e,t,M=>{r.elapsed||(r.clearTimeout(),M&&o(M),s())})}})}getIpAddresses(e,t){return e=Ke(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=await this.getObject(e);s((o==null?void 0:o.common.address)??[])}})}getHostByIp(e,t){return e=Ms(e),this.request({cacheKey:`rIPs_${e}`,forceUpdate:t,executor:(s,o,r)=>{this._socket.emit("getHostByIp",e,(M,a)=>{if(r.elapsed)return;r.clearTimeout();const{IPs4:u,IPs6:N}=jc(a);s([...u,...N])})}})}encrypt(e){return this.request({executor:(t,s,o)=>{this._socket.emit("encrypt",e,(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}decrypt(e){return this.request({executor:(t,s,o)=>{this._socket.emit("decrypt",e,(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}chmodFile(e,t,s){return this.request({executor:(o,r,M)=>{this._socket.emit("chmodFile",e,t,s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}chownFile(e,t,s){return this.request({executor:(o,r,M)=>{this._socket.emit("chownFile",e,t,s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}getNotifications(e,t){return this.request({executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"getNotifications",{category:t},M=>{r.elapsed||(r.clearTimeout(),s(M))})}})}clearNotifications(e,t){return this.request({executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"clearNotifications",{category:t},M=>{r.elapsed||(r.clearTimeout(),s(M))})}})}getIsEasyModeStrict(){return this.request({executor:(e,t,s)=>{this._socket.emit("getIsEasyModeStrict",(o,r)=>{s.elapsed||(s.clearTimeout(),o&&t(o),e(!!r))})}})}getEasyMode(){return this.request({executor:(e,t,s)=>{this._socket.emit("getEasyMode",(o,r)=>{s.elapsed||(s.clearTimeout(),o?t(new Error(o)):e(r))})}})}getRatings(e){return this.request({executor:(t,s,o)=>{this._socket.emit("getRatings",!!e,(r,M)=>{o.elapsed||(o.clearTimeout(),r?s(new Error(r)):t(M))})}})}getCurrentSession(e){const t=new AbortController;return this.request({commandTimeout:e||5e3,onTimeout:()=>{t.abort()},executor:async(s,o,r)=>{try{const M=await fetch("./session",{signal:t.signal});if(r.elapsed)return;r.clearTimeout();const a=await M.json();s(a)}catch(M){o(`getCurrentSession: ${M}`)}}})}getCurrentInstance(){return this.request({cacheKey:"currentInstance",executor:(e,t,s)=>{this._socket.emit("getCurrentInstance",(o,r)=>{s.elapsed||(s.clearTimeout(),o?t(o):e(r))})}})}getAdapterInstances(e,t){let s;return typeof e=="boolean"?(t=e,s=""):s=e||"",this.request({cacheKey:`instances_${s}`,forceUpdate:t,executor:(o,r,M)=>{this._socket.emit("getAdapterInstances",s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}getAdapters(e,t){let s;return typeof e=="boolean"?(t=e,s=""):s=e||"",this.request({cacheKey:`adapter_${s}`,forceUpdate:t,executor:(o,r,M)=>{this._socket.emit("getAdapters",s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}getCompactAdapters(e){return this.request({cacheKey:"compactAdapters",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactAdapters",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}getAdaptersResetCache(e){e=e??"",this.resetCache(`adapter_${e}`),this.resetCache("compactAdapters")}getCompactInstances(e){return this.request({cacheKey:"compactInstances",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactInstances",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}getAdapterInstancesResetCache(e){e=e??"",this.resetCache(`instances_${e}`),this.resetCache("compactInstances")}getCompactInstalled(e,t,s){return e=Ke(e),this.request({cacheKey:`installedCompact_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("getCompactInstalled",e,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getCompactInstalled"'):a?o(a):r('Cannot read "getCompactInstalled"'))})}})}getInstalledResetCache(e){e?(this.resetCache(`installedCompact_${e}`),this.resetCache(`installed_${e}`)):(this.resetCache("installedCompact_",!0),this.resetCache("installed_",!0))}getCompactRepository(e,t,s){return e=Ke(e),this.request({cacheKey:`repositoryCompact_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("getCompactRepository",e,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getCompactRepository"'):a?o(a):r('Cannot read "getCompactRepository"'))})}})}getRepositoryResetCache(e){e?(this.resetCache(`repositoryCompact_${e}`),this.resetCache(`repository_${e}`)):(this.resetCache("repositoryCompact_",!0),this.resetCache("repository_",!0))}getCompactHosts(e){return this.request({cacheKey:"hostsCompact",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactHosts",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}getCompactSystemRepositories(e){return this.request({cacheKey:"repositoriesCompact",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactSystemRepositories",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}}const Z=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ot="9.30.0",te=globalThis;function Ni(){return li(te),te}function li(i){const e=i.__SENTRY__=i.__SENTRY__||{};return e.version=e.version||Ot,e[Ot]=e[Ot]||{}}function Li(i,e,t=te){const s=t.__SENTRY__=t.__SENTRY__||{},o=s[Ot]=s[Ot]||{};return o[i]||(o[i]=e())}const gn=Object.prototype.toString;function Yo(i){switch(gn.call(i)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Tt(i,Error)}}function es(i,e){return gn.call(i)===`[object ${e}]`}function Tn(i){return es(i,"ErrorEvent")}function Tr(i){return es(i,"DOMError")}function gc(i){return es(i,"DOMException")}function tt(i){return es(i,"String")}function Qo(i){return typeof i=="object"&&i!==null&&"__sentry_template_string__"in i&&"__sentry_template_values__"in i}function Uo(i){return i===null||Qo(i)||typeof i!="object"&&typeof i!="function"}function ds(i){return es(i,"Object")}function ji(i){return typeof Event<"u"&&Tt(i,Event)}function Tc(i){return typeof Element<"u"&&Tt(i,Element)}function yc(i){return es(i,"RegExp")}function gi(i){return!!(i!=null&&i.then&&typeof i.then=="function")}function Dc(i){return ds(i)&&"nativeEvent"in i&&"preventDefault"in i&&"stopPropagation"in i}function Tt(i,e){try{return i instanceof e}catch{return!1}}function yn(i){return!!(typeof i=="object"&&i!==null&&(i.__isVue||i._isVue))}function dc(i){return typeof Request<"u"&&Tt(i,Request)}const vo=te,zc=80;function Dn(i,e={}){if(!i)return"<unknown>";try{let t=i;const s=5,o=[];let r=0,M=0;const a=" > ",u=a.length;let N;const l=Array.isArray(e)?e:e.keyAttrs,c=!Array.isArray(e)&&e.maxStringLength||zc;for(;t&&r++<s&&(N=Ic(t,l),!(N==="html"||r>1&&M+o.length*u+N.length>=c));)o.push(N),M+=N.length,t=t.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function Ic(i,e){const t=i,s=[];if(!(t!=null&&t.tagName))return"";if(vo.HTMLElement&&t instanceof HTMLElement&&t.dataset){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}s.push(t.tagName.toLowerCase());const o=e!=null&&e.length?e.filter(M=>t.getAttribute(M)).map(M=>[M,t.getAttribute(M)]):null;if(o!=null&&o.length)o.forEach(M=>{s.push(`[${M[0]}="${M[1]}"]`)});else{t.id&&s.push(`#${t.id}`);const M=t.className;if(M&&tt(M)){const a=M.split(/\s+/);for(const u of a)s.push(`.${u}`)}}const r=["aria-label","type","name","title","alt"];for(const M of r){const a=t.getAttribute(M);a&&s.push(`[${M}="${a}"]`)}return s.join("")}function bo(){try{return vo.document.location.href}catch{return""}}function wc(i){if(!vo.HTMLElement)return null;let e=i;const t=5;for(let s=0;s<t;s++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}const Cc="Sentry Logger ",Zi=["debug","info","warn","error","log","assert","trace"],ti={};function ts(i){if(!("console"in te))return i();const e=te.console,t={},s=Object.keys(ti);s.forEach(o=>{const r=ti[o];t[o]=e[o],e[o]=r});try{return i()}finally{s.forEach(o=>{e[o]=t[o]})}}function hc(){let i=!1;const e={enable:()=>{i=!0},disable:()=>{i=!1},isEnabled:()=>i};return Z?Zi.forEach(t=>{e[t]=(...s)=>{i&&ts(()=>{te.console[t](`${Cc}[${t}]:`,...s)})}}):Zi.forEach(t=>{e[t]=()=>{}}),e}const B=Li("logger",hc);function si(i,e=0){return typeof i!="string"||e===0||i.length<=e?i:`${i.slice(0,e)}...`}function yr(i,e){if(!Array.isArray(i))return"";const t=[];for(let s=0;s<i.length;s++){const o=i[s];try{yn(o)?t.push("[VueViewModel]"):t.push(String(o))}catch{t.push("[value cannot be serialized]")}}return t.join(e)}function Ac(i,e,t=!1){return tt(i)?yc(e)?e.test(i):tt(e)?t?i===e:i.includes(e):!1:!1}function Ti(i,e=[],t=!1){return e.some(s=>Ac(i,s,t))}function Ee(i,e,t){if(!(e in i))return;const s=i[e];if(typeof s!="function")return;const o=t(s);typeof o=="function"&&dn(o,s);try{i[e]=o}catch{Z&&B.log(`Failed to replace method "${e}" in object`,i)}}function Et(i,e,t){try{Object.defineProperty(i,e,{value:t,writable:!0,configurable:!0})}catch{Z&&B.log(`Failed to add non-enumerable property "${e}" to object`,i)}}function dn(i,e){try{const t=e.prototype||{};i.prototype=e.prototype=t,Et(i,"__sentry_original__",e)}catch{}}function $o(i){return i.__sentry_original__}function zn(i){if(Yo(i))return{message:i.message,name:i.name,stack:i.stack,...dr(i)};if(ji(i)){const e={type:i.type,target:Dr(i.target),currentTarget:Dr(i.currentTarget),...dr(i)};return typeof CustomEvent<"u"&&Tt(i,CustomEvent)&&(e.detail=i.detail),e}else return i}function Dr(i){try{return Tc(i)?Dn(i):Object.prototype.toString.call(i)}catch{return"<unknown>"}}function dr(i){if(typeof i=="object"&&i!==null){const e={};for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e}else return{}}function pc(i,e=40){const t=Object.keys(zn(i));t.sort();const s=t[0];if(!s)return"[object has no keys]";if(s.length>=e)return si(s,e);for(let o=t.length;o>0;o--){const r=t.slice(0,o).join(", ");if(!(r.length>e))return o===t.length?r:si(r,e)}return""}function mc(){const i=te;return i.crypto||i.msCrypto}function fe(i=mc()){let e=()=>Math.random()*16;try{if(i!=null&&i.randomUUID)return i.randomUUID().replace(/-/g,"");i!=null&&i.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return i.getRandomValues(t),t[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,t=>(t^(e()&15)>>t/4).toString(16))}function In(i){var e,t;return(t=(e=i.exception)==null?void 0:e.values)==null?void 0:t[0]}function pt(i){const{message:e,event_id:t}=i;if(e)return e;const s=In(i);return s?s.type&&s.value?`${s.type}: ${s.value}`:s.type||s.value||t||"<unknown>":t||"<unknown>"}function Xi(i,e,t){const s=i.exception=i.exception||{},o=s.values=s.values||[],r=o[0]=o[0]||{};r.value||(r.value=e||""),r.type||(r.type="Error")}function Zt(i,e){const t=In(i);if(!t)return;const s={type:"generic",handled:!0},o=t.mechanism;if(t.mechanism={...s,...o,...e},e&&"data"in e){const r={...o==null?void 0:o.data,...e.data};t.mechanism.data=r}}function zr(i){if(Oc(i))return!0;try{Et(i,"__sentry_captured__",!0)}catch{}return!1}function Oc(i){try{return i.__sentry_captured__}catch{}}const wn=1e3;function ps(){return Date.now()/wn}function Ec(){const{performance:i}=te;if(!(i!=null&&i.now))return ps;const e=Date.now()-i.now(),t=i.timeOrigin==null?e:i.timeOrigin;return()=>(t+i.now())/wn}const st=Ec();function _c(i){const e=st(),t={sid:fe(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>xc(t)};return i&&Xt(t,i),t}function Xt(i,e={}){if(e.user&&(!i.ipAddress&&e.user.ip_address&&(i.ipAddress=e.user.ip_address),!i.did&&!e.did&&(i.did=e.user.id||e.user.email||e.user.username)),i.timestamp=e.timestamp||st(),e.abnormal_mechanism&&(i.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(i.ignoreDuration=e.ignoreDuration),e.sid&&(i.sid=e.sid.length===32?e.sid:fe()),e.init!==void 0&&(i.init=e.init),!i.did&&e.did&&(i.did=`${e.did}`),typeof e.started=="number"&&(i.started=e.started),i.ignoreDuration)i.duration=void 0;else if(typeof e.duration=="number")i.duration=e.duration;else{const t=i.timestamp-i.started;i.duration=t>=0?t:0}e.release&&(i.release=e.release),e.environment&&(i.environment=e.environment),!i.ipAddress&&e.ipAddress&&(i.ipAddress=e.ipAddress),!i.userAgent&&e.userAgent&&(i.userAgent=e.userAgent),typeof e.errors=="number"&&(i.errors=e.errors),e.status&&(i.status=e.status)}function Sc(i,e){let t={};i.status==="ok"&&(t={status:"exited"}),Xt(i,t)}function xc(i){return{sid:`${i.sid}`,init:i.init,started:new Date(i.started*1e3).toISOString(),timestamp:new Date(i.timestamp*1e3).toISOString(),status:i.status,errors:i.errors,did:typeof i.did=="number"||typeof i.did=="string"?`${i.did}`:void 0,duration:i.duration,abnormal_mechanism:i.abnormal_mechanism,attrs:{release:i.release,environment:i.environment,ip_address:i.ipAddress,user_agent:i.userAgent}}}function ms(i,e,t=2){if(!e||typeof e!="object"||t<=0)return e;if(i&&Object.keys(e).length===0)return i;const s={...i};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(s[o]=ms(s[o],e[o],t-1));return s}const Ki="_sentrySpan";function Ir(i,e){e?Et(i,Ki,e):delete i[Ki]}function wr(i){return i[Ki]}function Cr(){return fe()}function Cn(){return fe().substring(16)}const fc=100;class it{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:Cr(),sampleRand:Math.random()}}clone(){const e=new it;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Ir(e,wr(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Xt(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}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;const t=typeof e=="function"?e(this):e,s=t instanceof it?t.getScopeData():ds(t)?e:void 0,{tags:o,extra:r,user:M,contexts:a,level:u,fingerprint:N=[],propagationContext:l}=s||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...r},this._contexts={...this._contexts,...a},M&&Object.keys(M).length&&(this._user=M),u&&(this._level=u),N.length&&(this._fingerprint=N),l&&(this._propagationContext=l),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._session=void 0,Ir(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Cr(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){var r;const s=typeof t=="number"?t:fc;if(s<=0)return this;const o={timestamp:ps(),...e,message:e.message?si(e.message,2048):e.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>s&&(this._breadcrumbs=this._breadcrumbs.slice(-s),(r=this._client)==null||r.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:wr(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ms(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const s=(t==null?void 0:t.event_id)||fe();if(!this._client)return B.warn("No client configured on scope - will not capture exception!"),s;const o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...t,event_id:s},this),s}captureMessage(e,t,s){const o=(s==null?void 0:s.event_id)||fe();if(!this._client)return B.warn("No client configured on scope - will not capture message!"),o;const r=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:r,...s,event_id:o},this),o}captureEvent(e,t){const s=(t==null?void 0:t.event_id)||fe();return this._client?(this._client.captureEvent(e,{...t,event_id:s},this),s):(B.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function kc(){return Li("defaultCurrentScope",()=>new it)}function Yc(){return Li("defaultIsolationScope",()=>new it)}class Qc{constructor(e,t){let s;e?s=e:s=new it;let o;t?o=t:o=new it,this._stack=[{scope:s}],this._isolationScope=o}withScope(e){const t=this._pushScope();let s;try{s=e(t)}catch(o){throw this._popScope(),o}return gi(s)?s.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(this._popScope(),s)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Kt(){const i=Ni(),e=li(i);return e.stack=e.stack||new Qc(kc(),Yc())}function Uc(i){return Kt().withScope(i)}function vc(i,e){const t=Kt();return t.withScope(()=>(t.getStackTop().scope=i,e(i)))}function hr(i){return Kt().withScope(()=>i(Kt().getIsolationScope()))}function bc(){return{withIsolationScope:hr,withScope:Uc,withSetScope:vc,withSetIsolationScope:(i,e)=>hr(e),getCurrentScope:()=>Kt().getScope(),getIsolationScope:()=>Kt().getIsolationScope()}}function Po(i){const e=li(i);return e.acs?e.acs:bc()}function ot(){const i=Ni();return Po(i).getCurrentScope()}function Os(){const i=Ni();return Po(i).getIsolationScope()}function $c(){return Li("globalScope",()=>new it)}function Pc(...i){const e=Ni(),t=Po(e);if(i.length===2){const[s,o]=i;return s?t.withSetScope(s,o):t.withScope(o)}return t.withScope(i[0])}function we(){return ot().getClient()}function Wc(i){const e=i.getPropagationContext(),{traceId:t,parentSpanId:s,propagationSpanId:o}=e,r={trace_id:t,span_id:o||Cn()};return s&&(r.parent_span_id=s),r}const Rc="sentry.source",Jc="sentry.sample_rate",Bc="sentry.previous_trace_sample_rate",Fc="sentry.op",Gc="sentry.origin",hn="sentry.profile_id",An="sentry.exclusive_time",Hc=0,Vc=1,Zc="_sentryScope",Xc="_sentryIsolationScope";function pn(i){return{scope:i[Zc],isolationScope:i[Xc]}}function Kc(i){if(typeof i=="boolean")return Number(i);const e=typeof i=="string"?parseFloat(i):i;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const qc="sentry-",eu=/^sentry-/;function tu(i){const e=su(i);if(!e)return;const t=Object.entries(e).reduce((s,[o,r])=>{if(o.match(eu)){const M=o.slice(qc.length);s[M]=r}return s},{});if(Object.keys(t).length>0)return t}function su(i){if(!(!i||!tt(i)&&!Array.isArray(i)))return Array.isArray(i)?i.reduce((e,t)=>{const s=Ar(t);return Object.entries(s).forEach(([o,r])=>{e[o]=r}),e},{}):Ar(i)}function Ar(i){return i.split(",").map(e=>e.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((e,[t,s])=>(t&&s&&(e[t]=s),e),{})}const mn=1;let pr=!1;function iu(i){const{spanId:e,traceId:t,isRemote:s}=i.spanContext(),o=s?e:Wo(i).parent_span_id,r=pn(i).scope,M=s?(r==null?void 0:r.getPropagationContext().propagationSpanId)||Cn():e;return{parent_span_id:o,span_id:M,trace_id:t}}function ou(i){if(i&&i.length>0)return i.map(({context:{spanId:e,traceId:t,traceFlags:s,...o},attributes:r})=>({span_id:e,trace_id:t,sampled:s===mn,attributes:r,...o}))}function mr(i){return typeof i=="number"?Or(i):Array.isArray(i)?i[0]+i[1]/1e9:i instanceof Date?Or(i.getTime()):st()}function Or(i){return i>9999999999?i/1e3:i}function Wo(i){var s;if(Mu(i))return i.getSpanJSON();const{spanId:e,traceId:t}=i.spanContext();if(ru(i)){const{attributes:o,startTime:r,name:M,endTime:a,status:u,links:N}=i,l="parentSpanId"in i?i.parentSpanId:"parentSpanContext"in i?(s=i.parentSpanContext)==null?void 0:s.spanId:void 0;return{span_id:e,trace_id:t,data:o,description:M,parent_span_id:l,start_timestamp:mr(r),timestamp:mr(a)||void 0,status:au(u),op:o[Fc],origin:o[Gc],links:ou(N)}}return{span_id:e,trace_id:t,start_timestamp:0,data:{}}}function ru(i){const e=i;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Mu(i){return typeof i.getSpanJSON=="function"}function nu(i){const{traceFlags:e}=i.spanContext();return e===mn}function au(i){if(!(!i||i.code===Hc))return i.code===Vc?"ok":i.message||"unknown_error"}const cu="_sentryRootSpan";function On(i){return i[cu]||i}function Er(){pr||(ts(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),pr=!0)}const En=50,_t="?",_r=/\(error: (.*)\)/,Sr=/captureMessage|captureException/;function _n(...i){const e=i.sort((t,s)=>t[0]-s[0]).map(t=>t[1]);return(t,s=0,o=0)=>{const r=[],M=t.split(`
2
- `);for(let a=s;a<M.length;a++){const u=M[a];if(u.length>1024)continue;const N=_r.test(u)?u.replace(_r,"$1"):u;if(!N.match(/\S*Error: /)){for(const l of e){const c=l(N);if(c){r.push(c);break}}if(r.length>=En+o)break}}return Nu(r.slice(o))}}function uu(i){return Array.isArray(i)?_n(...i):i}function Nu(i){if(!i.length)return[];const e=Array.from(i);return/sentryWrapped/.test(fs(e).function||"")&&e.pop(),e.reverse(),Sr.test(fs(e).function||"")&&(e.pop(),Sr.test(fs(e).function||"")&&e.pop()),e.slice(0,En).map(t=>({...t,filename:t.filename||fs(e).filename,function:t.function||_t}))}function fs(i){return i[i.length-1]||{}}const pi="<anonymous>";function yt(i){try{return!i||typeof i!="function"?pi:i.name||pi}catch{return pi}}function xr(i){const e=i.exception;if(e){const t=[];try{return e.values.forEach(s=>{s.stacktrace.frames&&t.push(...s.stacktrace.frames)}),t}catch{return}}}const Vs={},fr={};function kt(i,e){Vs[i]=Vs[i]||[],Vs[i].push(e)}function Yt(i,e){if(!fr[i]){fr[i]=!0;try{e()}catch(t){Z&&B.error(`Error while instrumenting ${i}`,t)}}}function ve(i,e){const t=i&&Vs[i];if(t)for(const s of t)try{s(e)}catch(o){Z&&B.error(`Error while triggering instrumentation handler.
1
+ import{w as _e,u as ur,l as Nr,a as lr}from"./createTheme-BwMO3rTt.js";import{C as b,R as n}from"./ConfigCustomJavascriptSet__loadShare__react__loadShare__-CzzIM-HW.js";import{C as g}from"./ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-BlV79j8y.js";import{C as m,a as oc,D as jn,u as rc}from"./index-B8sZ2j0S.js";import{g as Mc}from"./_commonjsHelpers-D6-XlEtG.js";import{u as nc}from"./useTheme-CDtRWagv.js";import"./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-BaLGCXMi.js";import"./useTheme-MELayQMj.js";import"./useThemeWithoutDefault-C-hl_s0Z.js";import"./defaultTheme-avbtL0lf.js";const Ai=11/23/100;function Lr(i){const e={r:0,g:0,b:0};if(i.length===7)e.r=parseInt(i.substring(1,3),16),e.g=parseInt(i.substring(3,5),16),e.b=parseInt(i.substring(5,7),16);else if(i.length===4){const t=i[1],s=i[2],o=i[3];e.r=parseInt(t+t,16),e.g=parseInt(s+s,16),e.b=parseInt(o+o,16)}return e}function ac(i){return`#${Math.round(i.r).toString(16)}${Math.round(i.g).toString(16)}${Math.round(i.b).toString(16)}`}function cc(i,e,t){const s=Lr(i),o=Lr(e);return s.r+=o.r*(.05+Ai*(t-1)),s.g+=o.g*(.05+Ai*(t-1)),s.b+=o.b*(.05+Ai*(t-1)),ac(s)}function jr(i,e){const t={};for(let s=1;s<=24;s++)t[`elevation${s}`]={backgroundColor:cc(i,e,s)};return t}function uc(i,e){var M,a,u,N,l,c,L,j,T,D,I;let t,s;i==="dark"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#272727"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[200],"&:hover":{color:_e[100]}}},MuiPaper:jr("#121212","#fff")},t={name:i,palette:{mode:"dark",background:{paper:"#121212",default:"#121212"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):i==="blue"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#3399CC"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"dark",background:{paper:"#151d21",default:"#151d21"},primary:{main:"#4dabf5"},secondary:{main:"#436a93"},expert:"#14bb00",text:{primary:"#ffffff",secondary:"#ffffff"}}}):i==="colored"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#2a3135"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[200],"&:hover":{color:_e[100]}}},MuiPaper:jr("#151d21","#fff")},t={name:i,palette:{mode:"light",primary:{main:"#3399CC"},secondary:{main:"#164477"},expert:"#96fc96"}}):i==="PT"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#0F99DE"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"light",primary:{main:"#0F99DE"},secondary:{main:"#88A536"},expert:"#BD1B24"}}):i==="DX"?(s={MuiAppBar:{colorDefault:{backgroundColor:"#a9a9a9"}},MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"light",primary:{main:"#F5F5F7"},secondary:{main:"#a9a9a9"},expert:"#BD1B24",text:{primary:"#007AFE",secondary:"#007AFE",disabled:"#007AFEAA"}}}):(s={MuiLink:{root:{textTransform:"uppercase",transition:"color .3s ease",color:_e[400],"&:hover":{color:_e[300]}}}},t={name:i,palette:{mode:"light",primary:{main:"#3399CC",dark:"#256c97",light:"#76d0fd"},secondary:{main:"#164477"},expert:"#14bb00"}}),t.toolbar={height:48},t.saveToolbar={background:(a=(M=t.palette)==null?void 0:M.primary)==null?void 0:a.main,button:{borderRadius:3,height:32}},t.palette&&(t.palette.grey={main:ur[300],dark:ur[400]});const o=Nr(t),r=o.palette;return Nr(o,{...e||void 0,components:{...s,MuiButton:{variants:[{props:{variant:"contained",color:"grey"},style:{backgroundColor:(u=r.grey)==null?void 0:u[300],color:r.getContrastText&&((N=r.grey)!=null&&N[300])?r.getContrastText(r.grey[300]):void 0}},{props:{variant:"outlined",color:"grey"},style:{color:(l=r.text)==null?void 0:l.primary,borderColor:r.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)","&.Mui-disabled":{border:`1px solid ${(c=r.action)==null?void 0:c.disabledBackground}`},"&:hover":{borderColor:r.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)",backgroundColor:lr(((L=r.text)==null?void 0:L.primary)||"",((j=r.action)==null?void 0:j.hoverOpacity)||.04)}}},{props:{variant:"text",color:"grey"},style:{color:(T=r.text)==null?void 0:T.primary,"&:hover":{backgroundColor:lr(((D=r.text)==null?void 0:D.primary)||"",((I=r.action)==null?void 0:I.hoverOpacity)||.04)}}}]},...(e==null?void 0:e.components)||void 0}})}function Nc(){let i,e;const t=new Promise((s,o)=>{i=s,e=o});return t.resolve=i,t.reject=e,t}function Vi(i){return(i==null?void 0:i.rows.map(e=>e.value).filter(e=>!!e))??[]}function Ke(i){return i!=null&&i.startsWith("system.host.")||(i=`system.host.${i}`),i}function Ms(i){return i!=null&&i.startsWith("system.host.")&&(i=i.substring(12)),i}function gr(i){return new Promise(e=>{setTimeout(e,i)})}function xs(i){i=(i||"").toString();const e=i[0]==="*",t=i[i.length-1]==="*";return i=i.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*"),(e?"":"^")+i+(t?"":"$")}var Re;(function(i){i[i.CONNECTING=0]="CONNECTING",i[i.CONNECTED=1]="CONNECTED",i[i.OBJECTS_LOADED=2]="OBJECTS_LOADED",i[i.READY=3]="READY"})(Re||(Re={}));var ye;(function(i){i.PERMISSION_ERROR="permissionError",i.NOT_CONNECTED="notConnectedError",i.TIMEOUT="timeout",i.NOT_ADMIN="Allowed only in admin",i.NOT_SUPPORTED="Not supported"})(ye||(ye={}));const r4e=ye.PERMISSION_ERROR;ye.NOT_CONNECTED;const lc=["material","echarts","vis"];class je{constructor(e){this.props=this.applyDefaultProps(e),this.connId=`${this.props.name?`${this.props.name}-`:""}${Math.round(Math.random()*1e6).toString().padStart(6,"0")}`,this.waitForSocketLib().then(()=>this.startSocket()).catch(t=>{alert(`Socket connection could not be initialized: ${t}`)})}applyDefaultProps(e){return{...e,protocol:e.protocol||window.location.protocol,host:e.host||window.location.hostname,port:e.port||(window.location.port==="3000"?8081:window.location.port),ioTimeout:Math.max(e.ioTimeout||2e4,2e4),cmdTimeout:Math.max(e.cmdTimeout||5e3,5e3),admin5only:e.admin5only||!1,autoSubscribes:e.autoSubscribes??[],autoSubscribeLog:e.autoSubscribeLog??!1,doNotLoadACL:e.doNotLoadACL??!0,doNotLoadAllObjects:e.doNotLoadAllObjects??!0}}props;connId;lastAccessToken=null;ignoreState="";connected=!1;subscribed=!1;firstConnect=!0;waitForRestart=!1;loaded=!1;simStates={};statesSubscribes={};filesSubscribes={};objectsSubscribes={};objects={};states={};acl=null;isSecure=!1;onReadyDone=!1;onConnectionHandlers=[];onLogHandlers=[];onCmdStdoutHandler;onCmdStderrHandler;onCmdExitHandler;onError(e){(this.props.onError??console.error)(e)}_socket;_waitForSocketPromise;_waitForFirstConnectionPromise=Nc();_instanceSubscriptions={};_promises={};_authTimer=null;_refreshTimer=null;_systemConfig;get systemConfig(){return this._systemConfig}systemLang="en";static isWeb(){return window.socketUrl!==void 0}waitForSocketLib(){return this._waitForSocketPromise?this._waitForSocketPromise:(this._waitForSocketPromise=new Promise(async(e,t)=>{if(typeof window.io>"u"&&typeof window.iob>"u")if(typeof window.registerSocketOnLoad=="function")window.registerSocketOnLoad(()=>e());else{for(let s=1;s<=30;s++){if(window.io||window.iob)return e();await gr(100)}t(new Error("Socket library could not be loaded!"))}else e()}),this._waitForSocketPromise)}async startSocket(){if(this._socket)return;let e=this.props.host,t=this.props.port,s=(this.props.protocol||window.location.protocol).replace(":",""),o=window.location.pathname;if(window.location.hostname==="iobroker.net"||window.location.hostname==="iobroker.pro")o="";else{if(window.socketUrl){const a=new URL(window.socketUrl);e=a.hostname,t=a.port,s=a.protocol.replace(":","")}const M=o.lastIndexOf("/");if(M!==-1&&(o=o.substring(0,M+1)),je.isWeb()){const a=o.split("/");a.length>2&&(a.pop(),a.pop(),lc.includes(a[a.length-1])&&a.pop(),o=a.join("/"),o.endsWith("/")||(o+="/"))}}const r=t?`${s}://${e}:${t}`:`${s}://${e}`;return this._socket=(window.io||window.iob).connect(r,{path:o.endsWith("/")?`${o}socket.io`:`${o}/socket.io`,query:"ws=true",name:this.props.name,timeout:this.props.ioTimeout,uuid:this.props.uuid,token:this.props.token}),this._socket.on("connect",M=>{window.addEventListener("storage",this.onAccessTokenUpdated);const a=je.readTokens();if(a&&!a.owner){const u=Date.now();this.saveTokens({access_token:a.access_token,refresh_token:a.refresh_token,expires_in:Math.round((a.expires_in.getTime()-u)/1e3),refresh_token_expires_in:Math.round((a.refresh_token_expires_in.getTime()-u)/1e3),token_type:"Bearer"},a.stayLoggedIn)}this.onReadyDone=!1,M!==!0?(this.connected=!0,setTimeout(()=>this.getVersion().then(u=>{const[N,l,c]=u.version.split(".");parseInt(N,10)*1e4+parseInt(l,10)*100+parseInt(c,10)<40102?(this._authTimer=null,this.onPreConnect(!1,!1)):this._socket.emit("authenticate",(j,T)=>this.onPreConnect(j,T))}).catch(u=>this.onError({message:u.toString(),operation:"getVersion"})),500)):this._socket.emit("authenticate",(u,N)=>{this.onPreConnect(u,N)})}),this._socket.on("reconnect",()=>{var M,a;this.onReadyDone=!1,(a=(M=this.props).onProgress)==null||a.call(M,Re.READY),this.connected=!0,this.waitForRestart?window.location.reload():(this._subscribe(!0),this.onConnectionHandlers.forEach(u=>u(!0)))}),this._socket.on("disconnect",()=>{var M,a;this.onReadyDone=!1,this.connected=!1,this.subscribed=!1,(a=(M=this.props).onProgress)==null||a.call(M,Re.CONNECTING),this.onConnectionHandlers.forEach(u=>u(!1))}),this._socket.on("reauthenticate",()=>this.authenticate()),this._socket.on("log",M=>{var a,u;(u=(a=this.props).onLog)==null||u.call(a,M),this.onLogHandlers.forEach(N=>N(M))}),this._socket.on("error",M=>{let a;M==null?a="":typeof M.toString=="function"?a=M.toString():(a=JSON.stringify(M),console.error(`Received strange error: ${a}`)),a.includes("User not authorized")?this.authenticate():a.includes("websocket error")?(console.error(`Socket Error => reload: ${M}`),window.location.reload()):console.error(`Socket Error: ${M}`)}),this._socket.on("connect_error",M=>console.error(`Connect error: ${M}`)),this._socket.on("permissionError",M=>this.onError({message:"no permission",operation:M.operation,type:M.type,id:M.id||""})),this._socket.on("objectChange",(M,a)=>{setTimeout(()=>this.objectChange(M,a),0)}),this._socket.on("stateChange",(M,a)=>{setTimeout(()=>this.stateChange(M,a),0)}),this._socket.on("im",(M,a,u)=>{setTimeout(()=>this.instanceMessage(M,a,u),0)}),this._socket.on("fileChange",(M,a,u)=>{setTimeout(()=>this.fileChange(M,a,u),0)}),this._socket.on("cmdStdout",(M,a)=>{var u;(u=this.onCmdStdoutHandler)==null||u.call(this,M,a)}),this._socket.on("cmdStderr",(M,a)=>{var u;(u=this.onCmdStderrHandler)==null||u.call(this,M,a)}),this._socket.on("cmdExit",(M,a)=>{var u;(u=this.onCmdExitHandler)==null||u.call(this,M,a)}),Promise.resolve()}onPreConnect(e,t){var s,o;this._authTimer&&(clearTimeout(this._authTimer),this._authTimer=null),this.connected=!0,this.isSecure=t,this.waitForRestart?window.location.reload():(this.firstConnect?this.loadData().catch(r=>console.error(`Cannot load data: ${r}`)):(o=(s=this.props).onProgress)==null||o.call(s,Re.READY),this._subscribe(!0),this.onConnectionHandlers.forEach(r=>r(!0)),this.checkAccessTokenExpire()),this._waitForFirstConnectionPromise.resolve()}static readTokens(){let e=window.sessionStorage.getItem("iob_tokens");const t=!e;if(e||(e=window.localStorage.getItem("iob_tokens")),!e)return null;const[s,o,r,M,a]=e.split(";"),u=new Date(o);return u.getTime()<Date.now()?null:{refresh_token:s,refresh_token_expires_in:u,access_token:r,expires_in:new Date(M),owner:a,stayLoggedIn:t}}static saveTokensStatic(e,t,s){const o=`${e.refresh_token};${new Date(Date.now()+e.refresh_token_expires_in*1e3).toISOString()};${e.access_token};${new Date(Date.now()+e.expires_in*1e3).toISOString()}${s?`;${s}`:""}`;t?window.localStorage.setItem("iob_tokens",o):window.sessionStorage.setItem("iob_tokens",o)}saveTokens(e,t){je.saveTokensStatic(e,t,this.connId)}static deleteTokensStatic(){window.localStorage.removeItem("iob_tokens"),window.sessionStorage.removeItem("iob_tokens")}deleteTokens(e,t){const s=je.readTokens();s&&(t?je.deleteTokensStatic():s.stayLoggedIn===e&&s.owner===this.connId&&(s.stayLoggedIn?window.localStorage.removeItem("iob_tokens"):window.sessionStorage.removeItem("iob_tokens")))}onAccessTokenUpdated=e=>{if(e.key==="iob_tokens"){const t=je.readTokens();t&&(console.log(`Tab ${this.connId} received updated token: ${t.access_token}`),this.updateTokenExpiration(t.access_token))}};updateTokenExpiration(e){this.lastAccessToken!==e&&(this.lastAccessToken=e,this._socket.emit("updateTokenExpiration",e,(t,s)=>{t?(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${t}`),window.location.reload()):s?console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${e}`):(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`),window.location.reload())})),this.checkAccessTokenExpire()}refreshTokens(e,t){if(!e){console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`),setTimeout(()=>window.location.reload(),500);return}t||!e.owner||e.owner===this.connId?(console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`),this.acquireTokenLock()?(console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`),fetch("./oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`grant_type=refresh_token&refresh_token=${e.refresh_token}&client_id=ioBroker&stayloggedin=${e.stayLoggedIn}`}).then(s=>{if(s.ok)return s.json();throw new Error("Cannot refresh access token")}).then(s=>{if(s.access_token)console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${s.access_token}`),this.saveTokens(s,e.stayLoggedIn),this.releaseTokenLock(),this.updateTokenExpiration(s.access_token);else throw new Error("Cannot get access token")}).catch(s=>{console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${s}`),this.releaseTokenLock(),this.deleteTokens(e.stayLoggedIn),console.error(s),window.location.reload()})):(console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`),this.checkAccessTokenExpire())):this.lastAccessToken!==e.access_token&&this.updateTokenExpiration(e.access_token)}acquireTokenLock(){const e=Date.now(),t=localStorage.getItem("iob_token_semaphore");if(t)try{const o=JSON.parse(t);if(e<o.expiry)return!1}catch{}const s={connId:this.connId,expiry:e+10*1e3};return localStorage.setItem("iob_token_semaphore",JSON.stringify(s)),!0}releaseTokenLock(){const e=localStorage.getItem("iob_token_semaphore");if(e)try{JSON.parse(e).connId===this.connId&&localStorage.removeItem("iob_token_semaphore")}catch{localStorage.removeItem("iob_token_semaphore")}}checkAccessTokenExpire(){if(this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null),this.isSecure){const e=je.readTokens();if(e){const t=e.expires_in.getTime();if(t<Date.now()+3e4){const s=t<Date.now()+5500;console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${e.access_token}`),e.refresh_token?e.owner===this.connId||s?(e.owner===this.connId?console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`):console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`),this.props.tokenTimeoutHandler?(console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`),this.props.tokenTimeoutHandler(t).then(o=>{o?(console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`),this.refreshTokens(e,s)):(console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))})):(console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`),this.refreshTokens(e,s))):this.lastAccessToken!==e.access_token?(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`),this.refreshTokens(e)):(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`),this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},3e3)):(console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`),setTimeout(()=>window.location.reload(),Date.now()>t?500:t-Date.now()))}else this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},t-Date.now()-3e4>12e4?12e4:t-Date.now()-3e4)}}}static isCloud(){return window.location.hostname.includes("amazonaws.com")||window.location.hostname.includes("iobroker.in")?!0:typeof window.socketUrl>"u"?!1:window.socketUrl.includes("iobroker.in")||window.socketUrl.includes("amazonaws")}isConnected(){return this.connected}waitForFirstConnection(){return this._waitForFirstConnectionPromise}async getUserPermissions(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getUserPermissions",(s,o)=>{s?t(s):e(o||null)})}})}async loadData(){if(this.loaded)return;const e=10;for(let t=1;t<=e;t++){if(this.doLoadData().catch(s=>console.error(`Cannot load data: ${s}`)),this.loaded)return;await gr(je.isCloud()?5e3:1e3)}}async doLoadData(){var e,t,s,o,r,M,a,u,N;if(!this.loaded){if(!this.props.doNotLoadACL)try{this.acl=await this.getUserPermissions()}catch(l){this.onError(`Cannot read user permissions: ${l}`);return}try{this.props.admin5only&&!je.isWeb()&&(!window.vendorPrefix||window.vendorPrefix==="@@vendorPrefix@@")?this._systemConfig=await this.getCompactSystemConfig():this._systemConfig=await this.getSystemConfig()}catch(l){this.onError(`Cannot read system config: ${l}`);return}this._systemConfig&&(this.systemLang=(e=this._systemConfig.common)==null?void 0:e.language,this.systemLang||(this.systemLang=window.navigator.userLanguage||window.navigator.language,/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(this.systemLang)?this.systemLang=this.systemLang.substring(0,2):/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(this.systemLang)||(this.systemLang="en"),this._systemConfig.common.language=this.systemLang)),(s=(t=this.props).onLanguage)==null||s.call(t,this.systemLang),this.loaded=!0,(r=(o=this.props).onProgress)==null||r.call(o,Re.CONNECTED),this.firstConnect=!1,this.props.doNotLoadAllObjects?this.props.admin5only?this.objects={}:this.objects={"system.config":this._systemConfig}:this.objects=await this.getObjects(),(a=(M=this.props).onProgress)==null||a.call(M,Re.READY),this.onReadyDone||(this.onReadyDone=!0,(N=(u=this.props).onReady)==null||N.call(u,this.objects))}}authenticate(){window.location.search.includes("&href=")?window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}`:window.location.href=`${window.location.protocol}//${window.location.host}${window.location.pathname}?login&href=${encodeURIComponent(window.location.search+window.location.hash)}`}async subscribeState(...e){let t,s,o;e.length===3?[t,s,o]=e:([t,o]=e,s=!1);let r;if(Array.isArray(t)?r=t:r=[t],typeof o!="function")throw new Error("The state change handler must be a function!");const M=[];for(let a=0;a<r.length;a++){const u=r[a];this.statesSubscribes[u]?!this.statesSubscribes[u].cbs.includes(o)&&this.statesSubscribes[u].cbs.push(o):(this.statesSubscribes[u]={reg:new RegExp(xs(u)),cbs:[o]},t!==this.ignoreState&&M.push(u))}if(this.connected)if(M.length&&this._socket.emit("subscribe",M),s){let a;for(let u=0;u<r.length;u++){try{a=await this.getBinaryState(r[u])}catch(N){console.error(`Cannot getBinaryState "${r[u]}": ${JSON.stringify(N)}`),a=void 0}a!=null&&o(r[u],a)}}else if(r.find(a=>a.includes("*"))){let a;for(let u=0;u<r.length;u++){try{a=await this.getForeignStates(r[u])}catch(N){console.error(`Cannot getForeignStates "${r[u]}": ${JSON.stringify(N)}`);return}if(a)for(const[N,l]of Object.entries(a)){const c=o(N,l);c instanceof Promise&&c.catch(L=>console.error(`Cannot call state change handler: ${L}`))}}}else try{const a=await(je.isWeb()?this.getStates(r):this.getForeignStates(r));if(a)for(const[u,N]of Object.entries(a)){const l=o(u,N);l instanceof Promise&&l.catch(c=>console.error(`Cannot call state change handler: ${c}`))}}catch(a){console.error(`Cannot getState "${r.join(", ")}": ${a.message}`);return}}async subscribeStateAsync(e,t){return this.subscribeState(e,t)}unsubscribeState(e,t){var r;let s;Array.isArray(e)?s=e:s=[e];const o=[];for(let M=0;M<s.length;M++){const a=s[M];if(this.statesSubscribes[a]){const u=this.statesSubscribes[a];if(t){const N=u.cbs.indexOf(t);N!==-1&&u.cbs.splice(N,1)}else u.cbs=[];(r=u.cbs)!=null&&r.length||(delete this.statesSubscribes[a],a!==this.ignoreState&&o.push(a))}}this.connected&&o.length&&this._socket.emit("unsubscribe",s)}subscribeObject(e,t){let s;if(Array.isArray(e)?s=e:s=[e],typeof t!="function")throw new Error("The object change handler must be a function!");const o=[];for(let r=0;r<s.length;r++){const M=s[r];this.objectsSubscribes[M]?!this.objectsSubscribes[M].cbs.includes(t)&&this.objectsSubscribes[M].cbs.push(t):(this.objectsSubscribes[M]={reg:new RegExp(xs(M)),cbs:[t]},o.push(M))}return this.connected&&o.length&&this._socket.emit("subscribeObjects",o),Promise.resolve()}unsubscribeObject(e,t){var r;let s;Array.isArray(e)?s=e:s=[e];const o=[];for(let M=0;M<s.length;M++){const a=s[M];if(this.objectsSubscribes[a]){const u=this.objectsSubscribes[a];if(t){const N=u.cbs.indexOf(t);N!==-1&&u.cbs.splice(N,1)}else u.cbs=[];(r=u.cbs)!=null&&r.length||(delete this.objectsSubscribes[a],o.push(a))}}return this.connected&&o.length&&this._socket.emit("unsubscribeObjects",o),Promise.resolve()}objectChange(e,t){var r,M;let s;this.objects[e]&&(s={_id:e,type:this.objects[e].type});let o=!1;t?(t._rev&&this.objects[e]&&(this.objects[e]._rev=t._rev),(!this.objects[e]||JSON.stringify(this.objects[e])!==JSON.stringify(t))&&(this.objects[e]=t,o=!0)):this.objects[e]&&(delete this.objects[e],o=!0);for(const[a,u]of Object.entries(this.objectsSubscribes))(a===e||u.reg.test(e))&&u.cbs.forEach(N=>{try{const l=N(e,t,s);l instanceof Promise&&l.catch(c=>console.error(`Cannot call object change handler: ${c}`))}catch(l){console.error(`Error by callback of objectChange: ${l}`)}});if(o){const a=(M=(r=this.props).onObjectChange)==null?void 0:M.call(r,e,t);a instanceof Promise&&a.catch(u=>console.error(`Cannot call object change handler: ${u}`))}}stateChange(e,t){for(const s of Object.values(this.statesSubscribes))if(s.reg.test(e))for(const o of s.cbs)try{const r=o(e,t??null);r instanceof Promise&&r.catch(M=>console.error(`Cannot call state change handler: ${M}`))}catch(r){console.error(`Error by callback of stateChanged: ${r}`)}}instanceMessage(e,t,s){var o;(o=this._instanceSubscriptions[t])==null||o.forEach(r=>{if(r.messageType===e){const M=r.callback(s,t,e);M instanceof Promise&&M.catch(a=>console.error(`Cannot call instance message handler: ${a}`))}})}fileChange(e,t,s){for(const o of Object.values(this.filesSubscribes))if(o.regId.test(e)&&o.regFilePattern.test(t))for(const r of o.cbs)try{r(e,t,s)}catch(M){console.error(`Error by callback of fileChange: ${M}`)}}async subscribeFiles(e,t,s){if(typeof s!="function")throw new Error("The state change handler must be a function!");let o;Array.isArray(t)?o=t:o=[t];const r=[];for(let M=0;M<o.length;M++){const a=o[M],u=`${e}$%$${a}`;this.filesSubscribes[u]?!this.filesSubscribes[u].cbs.includes(s)&&this.filesSubscribes[u].cbs.push(s):(this.filesSubscribes[u]={regId:new RegExp(xs(e)),regFilePattern:new RegExp(xs(a)),cbs:[s]},r.push(a))}return this.connected&&r.length&&this._socket.emit("subscribeFiles",e,r),Promise.resolve()}unsubscribeFiles(e,t,s){var M;let o;Array.isArray(t)?o=t:o=[t];const r=[];for(let a=0;a<o.length;a++){const u=o[a],N=`${e}$%$${u}`;if(this.filesSubscribes[N]){const l=this.filesSubscribes[N];if(s){const c=l.cbs.indexOf(s);c!==-1&&l.cbs.splice(c,1)}else l.cbs=[];(M=l.cbs)!=null&&M.length||(delete this.filesSubscribes[N],r.push(u))}}this.connected&&r.length&&this._socket.emit("unsubscribeFiles",e,r)}async request({cacheKey:e,forceUpdate:t,commandTimeout:s,onTimeout:o,requireAdmin:r,requireFeatures:M,executor:a}){if(r&&je.isWeb())return Promise.reject(new Error(ye.NOT_ADMIN));if(e&&!t&&e in this._promises)return this._promises[e];if(!this.connected)return Promise.reject(new Error(ye.NOT_CONNECTED));if(M!=null&&M.length){for(const N of M)if(!await this.checkFeatureSupported(N))throw new Error(ye.NOT_SUPPORTED)}const u=new Promise(async(N,l)=>{const c={elapsed:!1,clearTimeout:()=>{}};let L;s!==!1&&(L=setTimeout(()=>{c.elapsed=!0,o==null||o(),e&&this._promises[e]instanceof Promise&&delete this._promises[e],l(new Error(ye.TIMEOUT))},s??this.props.cmdTimeout),c.clearTimeout=()=>{clearTimeout(L)});try{await a(N,l,c)}catch(j){e&&this._promises[e]instanceof Promise&&delete this._promises[e],l(new Error(j.toString()))}});return e&&(this._promises[e]=u),u}resetCache(e,t){t?Object.keys(this._promises).filter(s=>s.startsWith(e)).forEach(s=>{delete this._promises[s]}):delete this._promises[e]}getStates(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getStates",e,(o,r)=>{this.states=r??{},o?s(o):t(this.states)})}})}getState(e){return this.request({commandTimeout:!1,executor:(t,s)=>{if(e&&e===this.ignoreState){t(this.simStates[e]||{val:null,ack:!0});return}this._socket.emit("getState",e,(o,r)=>{o?s(o):t(r)})}})}getBinaryState(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getBinaryState",e,(o,r)=>{o?s(o):t(r)})}})}setBinaryState(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("setBinaryState",e,t,r=>{r?o(r):s()})}})}setState(e,t,s){return typeof s=="boolean"&&(t={val:t,ack:s}),this.request({commandTimeout:!1,executor:(o,r)=>{if(e&&e===this.ignoreState){let M;if(typeof s=="boolean"||typeof t=="object"&&t.val!==void 0?M=t:M={val:t,ack:!1,ts:Date.now(),lc:Date.now(),from:"system.adapter.vis.0"},this.simStates[e]=M,this.statesSubscribes[e])for(const a of this.statesSubscribes[e].cbs)try{const u=a(e,M);u instanceof Promise&&u.catch(N=>console.error(`Cannot call state change handler: ${N}`))}catch(u){console.error(`Error by callback of stateChanged: ${u}`)}o();return}this._socket.emit("setState",e,t,M=>{M?r(M):o()})}})}getObjects(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{if(!e&&this.objects){s(this.objects);return}this._socket.emit(je.isWeb()?"getObjects":"getAllObjects",(r,M)=>{var a,u;t||(u=(a=this.props).onProgress)==null||u.call(a,Re.OBJECTS_LOADED),r?o(r):(this.objects=M??{},s(this.objects))})}})}getObjectsById(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjects",e,(o,r)=>{o?s(o):t(r)})}})}_subscribe(e){var t,s;if(e&&!this.subscribed){this.subscribed=!0,(t=this.props.autoSubscribes)!=null&&t.length&&this._socket.emit("subscribeObjects",this.props.autoSubscribes);const o=Object.keys(this.objectsSubscribes);o.length&&this._socket.emit("subscribeObjects",o),Object.keys(this.objectsSubscribes).forEach(r=>this._socket.emit("subscribeObjects",r)),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!0),Object.keys(this.statesSubscribes).forEach(r=>this._socket.emit("subscribe",r)),Object.keys(this.filesSubscribes).forEach(r=>{const[M,a]=r.split("$%$");this._socket.emit("subscribeFiles",M,a)})}else if(!e&&this.subscribed){this.subscribed=!1,(s=this.props.autoSubscribes)!=null&&s.length&&this._socket.emit("unsubscribeObjects",this.props.autoSubscribes);const o=Object.keys(this.objectsSubscribes);o.length&&this._socket.emit("unsubscribeObjects",o),this.props.autoSubscribeLog&&this._socket.emit("requireLog",!1),Object.keys(this.statesSubscribes).forEach(r=>this._socket.emit("unsubscribe",r)),Object.keys(this.filesSubscribes).forEach(r=>{const[M,a]=r.split("$%$");this._socket.emit("unsubscribeFiles",M,a)})}}requireLog(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("requireLog",e,o=>{o?s(o):t()})}})}delObject(e,t=!1){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("delObject",e,{maintenance:t},r=>{r?o(r):s()})}})}delObjects(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("delObjects",e,{maintenance:t},r=>{r?o(r):s()})}})}setObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("setObject",e,t,r=>{r?o(r):s()})}})):Promise.reject(new Error("Null object is not allowed"))}getObject(e){return this.request({commandTimeout:!1,executor:(t,s)=>{if(e&&e===this.ignoreState){t({_id:this.ignoreState,type:"state",common:{name:"ignored state",type:"mixed"}});return}this._socket.emit("getObject",e,(o,r)=>{o?s(o):t(r)})}})}sendTo(e,t,s){return this.request({commandTimeout:!1,executor:o=>{this._socket.emit("sendTo",e,t,s,r=>{o(r)})}})}extendObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("extendObject",e,t,r=>{r?o(r):s()})}})):Promise.reject(new Error("Null object is not allowed"))}registerLogHandler(e){this.onLogHandlers.includes(e)||this.onLogHandlers.push(e)}unregisterLogHandler(e){const t=this.onLogHandlers.indexOf(e);t!==-1&&this.onLogHandlers.splice(t,1)}registerConnectionHandler(e){this.onConnectionHandlers.includes(e)||this.onConnectionHandlers.push(e)}unregisterConnectionHandler(e){const t=this.onConnectionHandlers.indexOf(e);t!==-1&&this.onConnectionHandlers.splice(t,1)}registerCmdStdoutHandler(e){this.onCmdStdoutHandler=e}unregisterCmdStdoutHandler(){this.onCmdStdoutHandler=void 0}registerCmdStderrHandler(e){this.onCmdStderrHandler=e}unregisterCmdStderrHandler(){this.onCmdStderrHandler=void 0}registerCmdExitHandler(e){this.onCmdExitHandler=e}unregisterCmdExitHandler(){this.onCmdExitHandler=void 0}getEnums(e,t){return this.request({cacheKey:`enums_${e||"all"}`,forceUpdate:t,commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getObjectView","system","enum",{startkey:`enum.${e||""}`,endkey:e?`enum.${e}.香`:"enum.香"},(r,M)=>{if(r)o(r);else{const a={};if(M)for(let u=0;u<M.rows.length;u++)e&&M.rows[u].id===`enum.${e}`||(a[M.rows[u].id]=M.rows[u].value);s(a)}})}})}getObjectView(e,t,s){return this.getObjectViewCustom("system",s,e,t)}getObjectViewSystem(e,t,s){return this.getObjectViewCustom("system",e,t,s)}getObjectViewCustom(e,t,s,o){return this.request({commandTimeout:!1,executor:(r,M)=>{s=s||"",o=o||"香",this._socket.emit("getObjectView",e,t,{startkey:s,endkey:o},(a,u)=>{if(a)M(a);else{const N={};if(u&&u.rows)for(let l=0;l<u.rows.length;l++)N[u.rows[l].id]=u.rows[l].value;r(N)}})}})}readMetaItems(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getObjectView","system","meta",{startkey:"",endkey:"香"},(s,o)=>{var r;s?t(s):e((r=o.rows)==null?void 0:r.map(M=>M.value).filter(M=>!!M))})}})}readDir(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("readDir",e,t,(r,M)=>{r?o(r):s(M)})}})}readFile(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit(s?"readFile64":"readFile",e,t,(M,a,u)=>{M?r(M):o({file:a,mimeType:u})})}})}writeFile64(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{if(typeof s=="string")this._socket.emit("writeFile",e,t,s,M=>{M?r(M):o()});else{const M=btoa(new Uint8Array(s).reduce((a,u)=>a+String.fromCharCode(u),""));this._socket.emit("writeFile64",e,t,M,a=>{a?r(a):o()})}}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFile",e,t,r=>{r?o(r):s()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFolder",e,t,r=>{r?o(r):s()})}})}rename(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("rename",e,t,s,M=>{M?r(M):o()})}})}renameFile(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("renameFile",e,t,s,M=>{M?r(M):o()})}})}cmdExec(e,t,s,o){return this.request({commandTimeout:o,executor:(r,M,a)=>{e=Ke(e),this._socket.emit("cmdExec",e,s,t,u=>{a.elapsed||(a.clearTimeout(),u?M(u):r())})}})}getSystemConfig(e){return this.request({cacheKey:"systemConfig",forceUpdate:e,commandTimeout:!1,executor:async t=>{let s=await this.getObject("system.config");s??={},s.common??={},s.native??={},t(s)}})}getCompactSystemConfig(e){return this.request({cacheKey:"systemConfigCommon",forceUpdate:e,commandTimeout:!1,requireAdmin:!0,executor:(t,s)=>{this._socket.emit("getCompactSystemConfig",(o,r)=>{o?s(o):(r??={},r.common??={},r.native??={},t(r))})}})}getForeignStates(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getForeignStates",e||"*",(o,r)=>{o?s(o):t(r??{})})}})}getForeignObjects(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getForeignObjects",e||"*",t,(r,M)=>{r?o(r):s(M)})}})}setSystemConfig(e){return this.setObject("system.config",e)}getRawSocket(){return this._socket}getHistory(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getHistory",e,t,(r,M)=>{r?o(r):s(M)})}})}getHistoryEx(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("getHistory",e,t,(r,M,a,u)=>{r?o(r):s({values:M,sessionId:u,step:a})})}})}getIpAddresses(e,t){return e=Ke(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=await this.getObject(e);s((o==null?void 0:o.common.address)??[])}})}getVersion(e){return this.request({cacheKey:"version",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getVersion",(o,r,M)=>{o&&!r&&typeof o=="string"&&o.match(/\d+\.\d+\.\d+/)?t({version:o,serverName:"socketio"}):o?s(o):t({version:r,serverName:M})})}})}getWebServerName(){return this.request({cacheKey:"webName",commandTimeout:!1,executor:(e,t)=>{this._socket.emit("getAdapterName",(s,o)=>{s?t(s):e(o)})}})}fileExists(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("fileExists",e,t,(r,M)=>{r?o(r):s(!!M)})}})}getCurrentUser(){return this.request({commandTimeout:!1,executor:e=>{this._socket.emit("authEnabled",(t,s)=>{e(s)})}})}getUuid(){return this.request({cacheKey:"uuid",commandTimeout:!1,executor:async e=>{var s;const t=await this.getObject("system.meta.uuid");e((s=t==null?void 0:t.native)==null?void 0:s.uuid)}})}checkFeatureSupported(e,t){return this.request({cacheKey:`supportedFeatures_${e}`,forceUpdate:t,commandTimeout:!1,executor:(s,o)=>{this._socket.emit("checkFeatureSupported",e,(r,M)=>{r?o(r):s(M)})}})}getAdapterInstances(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`instances_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=e?`system.adapter.${e}.`:"system.adapter.",r=`${o}香`,M=await this.getObjectViewSystem("instance",o,r),a=Object.values(M);s(e?a.filter(u=>u.common.name===e):a)}})}getAdapters(e,t){return typeof e=="boolean"&&(t=e,e=""),e=e||"",this.request({cacheKey:`adapter_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=await this.getObjectViewSystem("adapter",`system.adapter.${e||""}`,`system.adapter.${e||"香"}`),r=Object.values(o);s(e?r.filter(M=>M.common.name===e):r)}})}getGroups(e){return this.request({cacheKey:"groups",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjectView","system","group",{startkey:"system.group.",endkey:"system.group.香"},(o,r)=>{o?s(o):t(Vi(r))})}})}logout(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit("logout",s=>{s?t(s):e(null)})}})}subscribeOnInstance(e,t,s,o){return this.request({commandTimeout:!1,executor:(r,M)=>{this._socket.emit("clientSubscribe",e,t,s,(a,u)=>{a?M(a):u&&(u.error?M(u.error):(e.startsWith("system.adapter.")||(e=`system.adapter.${e}`),this._instanceSubscriptions[e]=this._instanceSubscriptions[e]||[],this._instanceSubscriptions[e].find(N=>N.messageType===t&&N.callback===o)||this._instanceSubscriptions[e].push({messageType:t,callback:o}),r(u)))})}})}unsubscribeFromInstance(e,t,s){var M;e.startsWith("system.adapter.")||(e=`system.adapter.${e}`);let o;const r=[];do{o=!1;const a=(M=this._instanceSubscriptions[e])==null?void 0:M.findIndex(u=>(!t||u.messageType===t)&&(!s||u.callback===s));if(a!=null&&a!==-1){o=!0;const u=this._instanceSubscriptions[e][a].messageType;this._instanceSubscriptions[e].splice(a,1),this._instanceSubscriptions[e].length||delete this._instanceSubscriptions[e],this._instanceSubscriptions[e]&&this._instanceSubscriptions[e].find(l=>l.messageType===u)||r.push(this.request({commandTimeout:!1,executor:(l,c)=>{this._socket.emit("clientUnsubscribe",e,t,(L,j)=>L?c(L):l(j))}}))}}while(o&&(!s||!t));return r.length?Promise.all(r).then(a=>!!a.find(u=>u)):Promise.resolve(!1)}log(e,t){return e?this.request({commandTimeout:!1,executor:s=>(this._socket.emit("log",e,t),s(null))}):Promise.resolve(null)}setStateToIgnore(e){this.ignoreState=e}}function Lc(i,e){if(!e)return;let t;if(e.length<700&&(e.indexOf("/")!==-1||e.indexOf("\\")!==-1))if(i.toLowerCase().includes("private"))t="private";else if(e.toLowerCase().includes("private"))t="private";else if(i.toLowerCase().includes("public"))t="public";else if(e.toLowerCase().includes("public"))t="public";else if(i.toLowerCase().includes("chain"))t="chained";else if(e.toLowerCase().includes("chain"))t="chained";else return;else t=e.substring(0,26)==="-----BEGIN RSA PRIVATE KEY"||e.substring(0,22)==="-----BEGIN PRIVATE KEY"?"private":"public",t==="public"&&e.split("-----END CERTIFICATE-----").filter(o=>o.replace(/\r\n|\r|\n/,"").trim()).length>1&&(t="chained");return{name:i,type:t}}function jc(i){var s,o,r,M;const e=[{name:"[IPv4] 0.0.0.0 - Listen on all IPs",address:"0.0.0.0",family:"ipv4"}],t=[{name:"[IPv6] :: - Listen on all IPs",address:"::",family:"ipv6"}];if((o=(s=i.native)==null?void 0:s.hardware)!=null&&o.networkInterfaces){const a=(M=(r=i.native)==null?void 0:r.hardware)==null?void 0:M.networkInterfaces;Object.keys(a).forEach(u=>{a[u].forEach(N=>{N.family!=="IPv6"?e.push({name:`[${N.family}] ${N.address} - ${u}`,address:N.address,family:"ipv4"}):t.push({name:`[${N.family}] ${N.address} - ${u}`,address:N.address,family:"ipv6"})})})}return{IPs4:e,IPs6:t}}class M4e extends je{constructor(e){super(e)}request(e){return super.request({requireAdmin:!0,...e})}getCertificates(e){return this.request({cacheKey:"cert",forceUpdate:e,commandTimeout:!1,executor:async t=>{var o;const s=await this.getObject("system.certificates");(o=s==null?void 0:s.native)!=null&&o.certificates?t(Object.entries(s.native.certificates).map(([r,M])=>Lc(r,M)).filter(r=>!!r)):t([])}})}getLogs(e,t=200){return this.request({commandTimeout:!1,executor:s=>{this._socket.emit("sendToHost",e,"getLogs",t||200,o=>{s(o)})}})}upgradeAdapterWithWebserver(e,t){return this.request({commandTimeout:!1,executor:s=>{this._socket.emit("sendToHost",e,"upgradeAdapterWithWebserver",t,o=>{s(o)})}})}upgradeController(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("sendToHost",e,"upgradeController",{version:t,adminInstance:s},M=>{const a=M;a.error?r(a.error):o(a.result)})}})}updateLicenses(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("updateLicenses",e,t,(r,M)=>{r?o(r):s(M)})}})}upgradeOsPackages(e,t,s){return this.request({commandTimeout:!1,executor:o=>{this._socket.emit("sendToHost",e,"upgradeOsPackages",{packages:t,restart:!!s},r=>{o(r)})}})}getLogsFiles(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("readLogs",e,(o,r)=>{o&&s(o),t(r)})}})}delLogs(e){return this.request({commandTimeout:!1,executor:(t,s)=>{this._socket.emit("sendToHost",e,"delLogs",null,o=>{o&&s(o),t()})}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFile",e,t,r=>{r&&o(r),s()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(s,o)=>{this._socket.emit("deleteFolder",e,t,r=>{r&&o(r),s()})}})}rename(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("rename",e,t,s,M=>{M&&r(M),o()})}})}renameFile(e,t,s){return this.request({commandTimeout:!1,executor:(o,r)=>{this._socket.emit("renameFile",e,t,s,M=>{M&&r(M),o()})}})}getHosts(e){return this.request({cacheKey:"hosts",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjectView","system","host",{startkey:"system.host.",endkey:"system.host.香"},(o,r)=>{o?s(o):t(Vi(r))})}})}getUsers(e){return this.request({cacheKey:"users",forceUpdate:e,commandTimeout:!1,executor:(t,s)=>{this._socket.emit("getObjectView","system","user",{startkey:"system.user.",endkey:"system.user.香"},(o,r)=>{o?s(o):t(Vi(r))})}})}renameGroup(e,t,s){return this.request({commandTimeout:!1,executor:async o=>{const r=await this.getGroups(!0),M=r.filter(u=>u._id.startsWith(`${e}.`));for(const u of M){const N=u._id,l=t+u._id.substring(e.length);u._id=l,await this.setObject(l,u),await this.delObject(N)}const a=r.find(u=>u._id===e);if(a){const u=a._id;a._id=t,s!==void 0&&(a.common??={},a.common.name=s),await this.setObject(t,a),await this.delObject(u)}o()}})}getHostInfo(e,t,s){return e=Ke(e),this.request({cacheKey:`hostInfo_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("sendToHost",e,"getHostInfo",null,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getHostInfo"'):a?o(a):r('Cannot read "getHostInfo"'))})}})}getHostInfoShort(e,t,s){return e=Ke(e),this.request({cacheKey:`hostInfoShort_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("sendToHost",e,"getHostInfoShort",null,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getHostInfoShort"'):a?o(a):r('Cannot read "getHostInfoShort"'))})}})}getRepository(e,t,s,o){return this.request({cacheKey:`repository_${e}`,forceUpdate:s,commandTimeout:o,executor:(r,M,a)=>{this._socket.emit("sendToHost",e,"getRepository",t,u=>{a.elapsed||(a.clearTimeout(),u===ye.PERMISSION_ERROR?M('May not read "getRepository"'):u?r(u):M('Cannot read "getRepository"'))})}})}getInstalled(e,t,s){return e=Ke(e),this.request({cacheKey:`installed_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("sendToHost",e,"getInstalled",null,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getInstalled"'):a?o(a):r('Cannot read "getInstalled"'))})}})}cmdExec(e,t,s,o){return this.request({commandTimeout:o,executor:(r,M,a)=>{e=Ke(e),this._socket.emit("cmdExec",e,s,t,u=>{a.elapsed||(a.clearTimeout(),u&&M(u),r())})}})}readBaseSettings(e){return e=Ms(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(t,s,o)=>{this._socket.emit("sendToHost",e,"readBaseSettings",null,r=>{o.elapsed||(o.clearTimeout(),r===ye.PERMISSION_ERROR?s('May not read "BaseSettings"'):r?r.error?s(new Error(r.error)):t(r):s('Cannot read "BaseSettings"'))})}})}writeBaseSettings(e,t){return e=Ms(e),this.request({requireFeatures:["CONTROLLER_READWRITE_BASE_SETTINGS"],executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"writeBaseSettings",t,M=>{r.elapsed||(r.clearTimeout(),M===ye.PERMISSION_ERROR?o('May not write "BaseSettings"'):M?s(M):o('Cannot write "BaseSettings"'))})}})}restartController(e){return e=Ms(e),this.request({executor:(t,s,o)=>{this._socket.emit("sendToHost",e,"restartController",null,()=>{o.elapsed||(o.clearTimeout(),t(!0))})}})}getDiagData(e,t){return e=Ms(e),this.request({executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"getDiagData",t,M=>{r.elapsed||(r.clearTimeout(),s(M||null))})}})}changePassword(e,t){return this.request({executor:(s,o,r)=>{this._socket.emit("changePassword",e,t,M=>{r.elapsed||(r.clearTimeout(),M&&o(M),s())})}})}getIpAddresses(e,t){return e=Ke(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async s=>{const o=await this.getObject(e);s((o==null?void 0:o.common.address)??[])}})}getHostByIp(e,t){return e=Ms(e),this.request({cacheKey:`rIPs_${e}`,forceUpdate:t,executor:(s,o,r)=>{this._socket.emit("getHostByIp",e,(M,a)=>{if(r.elapsed)return;r.clearTimeout();const{IPs4:u,IPs6:N}=jc(a);s([...u,...N])})}})}encrypt(e){return this.request({executor:(t,s,o)=>{this._socket.emit("encrypt",e,(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}decrypt(e){return this.request({executor:(t,s,o)=>{this._socket.emit("decrypt",e,(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}chmodFile(e,t,s){return this.request({executor:(o,r,M)=>{this._socket.emit("chmodFile",e,t,s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}chownFile(e,t,s){return this.request({executor:(o,r,M)=>{this._socket.emit("chownFile",e,t,s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}getNotifications(e,t){return this.request({executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"getNotifications",{category:t},M=>{r.elapsed||(r.clearTimeout(),s(M))})}})}clearNotifications(e,t){return this.request({executor:(s,o,r)=>{this._socket.emit("sendToHost",e,"clearNotifications",{category:t},M=>{r.elapsed||(r.clearTimeout(),s(M))})}})}getIsEasyModeStrict(){return this.request({executor:(e,t,s)=>{this._socket.emit("getIsEasyModeStrict",(o,r)=>{s.elapsed||(s.clearTimeout(),o&&t(o),e(!!r))})}})}getEasyMode(){return this.request({executor:(e,t,s)=>{this._socket.emit("getEasyMode",(o,r)=>{s.elapsed||(s.clearTimeout(),o?t(new Error(o)):e(r))})}})}getRatings(e){return this.request({executor:(t,s,o)=>{this._socket.emit("getRatings",!!e,(r,M)=>{o.elapsed||(o.clearTimeout(),r?s(new Error(r)):t(M))})}})}getCurrentSession(e){const t=new AbortController;return this.request({commandTimeout:e||5e3,onTimeout:()=>{t.abort()},executor:async(s,o,r)=>{try{const M=await fetch("./session",{signal:t.signal});if(r.elapsed)return;r.clearTimeout();const a=await M.json();s(a)}catch(M){o(`getCurrentSession: ${M}`)}}})}getCurrentInstance(){return this.request({cacheKey:"currentInstance",executor:(e,t,s)=>{this._socket.emit("getCurrentInstance",(o,r)=>{s.elapsed||(s.clearTimeout(),o?t(o):e(r))})}})}getAdapterInstances(e,t){let s;return typeof e=="boolean"?(t=e,s=""):s=e||"",this.request({cacheKey:`instances_${s}`,forceUpdate:t,executor:(o,r,M)=>{this._socket.emit("getAdapterInstances",s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}getAdapters(e,t){let s;return typeof e=="boolean"?(t=e,s=""):s=e||"",this.request({cacheKey:`adapter_${s}`,forceUpdate:t,executor:(o,r,M)=>{this._socket.emit("getAdapters",s,(a,u)=>{M.elapsed||(M.clearTimeout(),a&&r(a),o(u))})}})}getCompactAdapters(e){return this.request({cacheKey:"compactAdapters",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactAdapters",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}getAdaptersResetCache(e){e=e??"",this.resetCache(`adapter_${e}`),this.resetCache("compactAdapters")}getCompactInstances(e){return this.request({cacheKey:"compactInstances",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactInstances",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}getAdapterInstancesResetCache(e){e=e??"",this.resetCache(`instances_${e}`),this.resetCache("compactInstances")}getCompactInstalled(e,t,s){return e=Ke(e),this.request({cacheKey:`installedCompact_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("getCompactInstalled",e,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getCompactInstalled"'):a?o(a):r('Cannot read "getCompactInstalled"'))})}})}getInstalledResetCache(e){e?(this.resetCache(`installedCompact_${e}`),this.resetCache(`installed_${e}`)):(this.resetCache("installedCompact_",!0),this.resetCache("installed_",!0))}getCompactRepository(e,t,s){return e=Ke(e),this.request({cacheKey:`repositoryCompact_${e}`,forceUpdate:t,commandTimeout:s,executor:(o,r,M)=>{this._socket.emit("getCompactRepository",e,a=>{M.elapsed||(M.clearTimeout(),a===ye.PERMISSION_ERROR?r('May not read "getCompactRepository"'):a?o(a):r('Cannot read "getCompactRepository"'))})}})}getRepositoryResetCache(e){e?(this.resetCache(`repositoryCompact_${e}`),this.resetCache(`repository_${e}`)):(this.resetCache("repositoryCompact_",!0),this.resetCache("repository_",!0))}getCompactHosts(e){return this.request({cacheKey:"hostsCompact",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactHosts",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}getCompactSystemRepositories(e){return this.request({cacheKey:"repositoriesCompact",forceUpdate:e,executor:(t,s,o)=>{this._socket.emit("getCompactSystemRepositories",(r,M)=>{o.elapsed||(o.clearTimeout(),r&&s(r),t(M))})}})}}const Z=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,te=globalThis,Ot="9.33.0";function Ni(){return li(te),te}function li(i){const e=i.__SENTRY__=i.__SENTRY__||{};return e.version=e.version||Ot,e[Ot]=e[Ot]||{}}function Li(i,e,t=te){const s=t.__SENTRY__=t.__SENTRY__||{},o=s[Ot]=s[Ot]||{};return o[i]||(o[i]=e())}const gc="Sentry Logger ",Zi=["debug","info","warn","error","log","assert","trace"],ti={};function es(i){if(!("console"in te))return i();const e=te.console,t={},s=Object.keys(ti);s.forEach(o=>{const r=ti[o];t[o]=e[o],e[o]=r});try{return i()}finally{s.forEach(o=>{e[o]=t[o]})}}function Tc(){let i=!1;const e={enable:()=>{i=!0},disable:()=>{i=!1},isEnabled:()=>i};return Z?Zi.forEach(t=>{e[t]=(...s)=>{i&&es(()=>{te.console[t](`${gc}[${t}]:`,...s)})}}):Zi.forEach(t=>{e[t]=()=>{}}),e}const B=Li("logger",Tc),gn=50,Et="?",Tr=/\(error: (.*)\)/,yr=/captureMessage|captureException/;function Tn(...i){const e=i.sort((t,s)=>t[0]-s[0]).map(t=>t[1]);return(t,s=0,o=0)=>{const r=[],M=t.split(`
2
+ `);for(let a=s;a<M.length;a++){const u=M[a];if(u.length>1024)continue;const N=Tr.test(u)?u.replace(Tr,"$1"):u;if(!N.match(/\S*Error: /)){for(const l of e){const c=l(N);if(c){r.push(c);break}}if(r.length>=gn+o)break}}return Dc(r.slice(o))}}function yc(i){return Array.isArray(i)?Tn(...i):i}function Dc(i){if(!i.length)return[];const e=Array.from(i);return/sentryWrapped/.test(fs(e).function||"")&&e.pop(),e.reverse(),yr.test(fs(e).function||"")&&(e.pop(),yr.test(fs(e).function||"")&&e.pop()),e.slice(0,gn).map(t=>({...t,filename:t.filename||fs(e).filename,function:t.function||Et}))}function fs(i){return i[i.length-1]||{}}const pi="<anonymous>";function Tt(i){try{return!i||typeof i!="function"?pi:i.name||pi}catch{return pi}}function Dr(i){const e=i.exception;if(e){const t=[];try{return e.values.forEach(s=>{s.stacktrace.frames&&t.push(...s.stacktrace.frames)}),t}catch{return}}}const Vs={},dr={};function kt(i,e){Vs[i]=Vs[i]||[],Vs[i].push(e)}function Yt(i,e){if(!dr[i]){dr[i]=!0;try{e()}catch(t){Z&&B.error(`Error while instrumenting ${i}`,t)}}}function ve(i,e){const t=i&&Vs[i];if(t)for(const s of t)try{s(e)}catch(o){Z&&B.error(`Error while triggering instrumentation handler.
3
3
  Type: ${i}
4
- Name: ${yt(s)}
5
- Error:`,o)}}let mi=null;function lu(i){const e="error";kt(e,i),Yt(e,Lu)}function Lu(){mi=te.onerror,te.onerror=function(i,e,t,s,o){return ve("error",{column:s,error:o,line:t,msg:i,url:e}),mi?mi.apply(this,arguments):!1},te.onerror.__SENTRY_INSTRUMENTED__=!0}let Oi=null;function ju(i){const e="unhandledrejection";kt(e,i),Yt(e,gu)}function gu(){Oi=te.onunhandledrejection,te.onunhandledrejection=function(i){return ve("unhandledrejection",i),Oi?Oi.apply(this,arguments):!0},te.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Tu(i){var t;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=i||((t=we())==null?void 0:t.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const Ro="production",yu=/^o(\d+)\./,Du=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function du(i){return i==="http"||i==="https"}function yi(i,e=!1){const{host:t,path:s,pass:o,port:r,projectId:M,protocol:a,publicKey:u}=i;return`${a}://${u}${e&&o?`:${o}`:""}@${t}${r?`:${r}`:""}/${s&&`${s}/`}${M}`}function zu(i){const e=Du.exec(i);if(!e){ts(()=>{console.error(`Invalid Sentry Dsn: ${i}`)});return}const[t,s,o="",r="",M="",a=""]=e.slice(1);let u="",N=a;const l=N.split("/");if(l.length>1&&(u=l.slice(0,-1).join("/"),N=l.pop()),N){const c=N.match(/^\d+/);c&&(N=c[0])}return Sn({host:r,pass:o,path:u,projectId:N,port:M,protocol:t,publicKey:s})}function Sn(i){return{protocol:i.protocol,publicKey:i.publicKey||"",pass:i.pass||"",host:i.host,port:i.port||"",path:i.path||"",projectId:i.projectId}}function Iu(i){if(!Z)return!0;const{port:e,projectId:t,protocol:s}=i;return["protocol","publicKey","host","projectId"].find(M=>i[M]?!1:(B.error(`Invalid Sentry Dsn: ${M} missing`),!0))?!1:t.match(/^\d+$/)?du(s)?e&&isNaN(parseInt(e,10))?(B.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(B.error(`Invalid Sentry Dsn: Invalid protocol ${s}`),!1):(B.error(`Invalid Sentry Dsn: Invalid projectId ${t}`),!1)}function wu(i){const e=i.match(yu);return e==null?void 0:e[1]}function Cu(i){const e=typeof i=="string"?zu(i):Sn(i);if(!(!e||!Iu(e)))return e}const hu="_frozenDsc";function xn(i,e){const t=e.getOptions(),{publicKey:s,host:o}=e.getDsn()||{};let r;t.orgId?r=String(t.orgId):o&&(r=wu(o));const M={environment:t.environment||Ro,release:t.release,public_key:s,trace_id:i,org_id:r};return e.emit("createDsc",M),M}function Au(i,e){const t=e.getPropagationContext();return t.dsc||xn(t.traceId,i)}function pu(i){var T;const e=we();if(!e)return{};const t=On(i),s=Wo(t),o=s.data,r=t.spanContext().traceState,M=(r==null?void 0:r.get("sentry.sample_rate"))??o[Jc]??o[Bc];function a(D){return(typeof M=="number"||typeof M=="string")&&(D.sample_rate=`${M}`),D}const u=t[hu];if(u)return a(u);const N=r==null?void 0:r.get("sentry.dsc"),l=N&&tu(N);if(l)return a(l);const c=xn(i.spanContext().traceId,e),L=o[Rc],j=s.description;return L!=="url"&&j&&(c.transaction=j),Tu()&&(c.sampled=String(nu(t)),c.sample_rand=(r==null?void 0:r.get("sentry.sample_rand"))??((T=pn(t).scope)==null?void 0:T.getPropagationContext().sampleRand.toString())),a(c),e.emit("createDsc",c,t),c}function qe(i,e=100,t=1/0){try{return qi("",i,e,t)}catch(s){return{ERROR:`**non-serializable** (${s})`}}}function fn(i,e=3,t=100*1024){const s=qe(i,e);return _u(s)>t?fn(i,e-1,t):s}function qi(i,e,t=1/0,s=1/0,o=Su()){const[r,M]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=mu(i,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const u=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:t;if(u===0)return a.replace("object ","");if(r(e))return"[Circular ~]";const N=e;if(N&&typeof N.toJSON=="function")try{const j=N.toJSON();return qi("",j,u-1,s,o)}catch{}const l=Array.isArray(e)?[]:{};let c=0;const L=zn(e);for(const j in L){if(!Object.prototype.hasOwnProperty.call(L,j))continue;if(c>=s){l[j]="[MaxProperties ~]";break}const T=L[j];l[j]=qi(j,T,u-1,s,o),c++}return M(e),l}function mu(i,e){try{if(i==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(i==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(yn(e))return"[VueViewModel]";if(Dc(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${yt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const t=Ou(e);return/^HTML(\w*)Element$/.test(t)?`[HTMLElement: ${t}]`:`[object ${t}]`}catch(t){return`**non-serializable** (${t})`}}function Ou(i){const e=Object.getPrototypeOf(i);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function Eu(i){return~-encodeURI(i).split(/%..|./).length}function _u(i){return Eu(JSON.stringify(i))}function Su(){const i=new WeakSet;function e(s){return i.has(s)?!0:(i.add(s),!1)}function t(s){i.delete(s)}return[e,t]}function Es(i,e=[]){return[i,e]}function xu(i,e){const[t,s]=i;return[t,[...s,e]]}function kr(i,e){const t=i[1];for(const s of t){const o=s[0].type;if(e(s,o))return!0}return!1}function eo(i){const e=li(te);return e.encodePolyfill?e.encodePolyfill(i):new TextEncoder().encode(i)}function fu(i){const[e,t]=i;let s=JSON.stringify(e);function o(r){typeof s=="string"?s=typeof r=="string"?s+r:[eo(s),r]:s.push(typeof r=="string"?eo(r):r)}for(const r of t){const[M,a]=r;if(o(`
4
+ Name: ${Tt(s)}
5
+ Error:`,o)}}let mi=null;function dc(i){const e="error";kt(e,i),Yt(e,zc)}function zc(){mi=te.onerror,te.onerror=function(i,e,t,s,o){return ve("error",{column:s,error:o,line:t,msg:i,url:e}),mi?mi.apply(this,arguments):!1},te.onerror.__SENTRY_INSTRUMENTED__=!0}let Oi=null;function Ic(i){const e="unhandledrejection";kt(e,i),Yt(e,wc)}function wc(){Oi=te.onunhandledrejection,te.onunhandledrejection=function(i){return ve("unhandledrejection",i),Oi?Oi.apply(this,arguments):!0},te.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const yn=Object.prototype.toString;function Yo(i){switch(yn.call(i)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return yt(i,Error)}}function ts(i,e){return yn.call(i)===`[object ${e}]`}function Dn(i){return ts(i,"ErrorEvent")}function zr(i){return ts(i,"DOMError")}function Cc(i){return ts(i,"DOMException")}function tt(i){return ts(i,"String")}function Qo(i){return typeof i=="object"&&i!==null&&"__sentry_template_string__"in i&&"__sentry_template_values__"in i}function Uo(i){return i===null||Qo(i)||typeof i!="object"&&typeof i!="function"}function ds(i){return ts(i,"Object")}function ji(i){return typeof Event<"u"&&yt(i,Event)}function hc(i){return typeof Element<"u"&&yt(i,Element)}function Ac(i){return ts(i,"RegExp")}function gi(i){return!!(i!=null&&i.then&&typeof i.then=="function")}function pc(i){return ds(i)&&"nativeEvent"in i&&"preventDefault"in i&&"stopPropagation"in i}function yt(i,e){try{return i instanceof e}catch{return!1}}function dn(i){return!!(typeof i=="object"&&i!==null&&(i.__isVue||i._isVue))}function mc(i){return typeof Request<"u"&&yt(i,Request)}const vo=te,Oc=80;function zn(i,e={}){if(!i)return"<unknown>";try{let t=i;const s=5,o=[];let r=0,M=0;const a=" > ",u=a.length;let N;const l=Array.isArray(e)?e:e.keyAttrs,c=!Array.isArray(e)&&e.maxStringLength||Oc;for(;t&&r++<s&&(N=Ec(t,l),!(N==="html"||r>1&&M+o.length*u+N.length>=c));)o.push(N),M+=N.length,t=t.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function Ec(i,e){const t=i,s=[];if(!(t!=null&&t.tagName))return"";if(vo.HTMLElement&&t instanceof HTMLElement&&t.dataset){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}s.push(t.tagName.toLowerCase());const o=e!=null&&e.length?e.filter(M=>t.getAttribute(M)).map(M=>[M,t.getAttribute(M)]):null;if(o!=null&&o.length)o.forEach(M=>{s.push(`[${M[0]}="${M[1]}"]`)});else{t.id&&s.push(`#${t.id}`);const M=t.className;if(M&&tt(M)){const a=M.split(/\s+/);for(const u of a)s.push(`.${u}`)}}const r=["aria-label","type","name","title","alt"];for(const M of r){const a=t.getAttribute(M);a&&s.push(`[${M}="${a}"]`)}return s.join("")}function bo(){try{return vo.document.location.href}catch{return""}}function _c(i){if(!vo.HTMLElement)return null;let e=i;const t=5;for(let s=0;s<t;s++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function si(i,e=0){return typeof i!="string"||e===0||i.length<=e?i:`${i.slice(0,e)}...`}function Ir(i,e){if(!Array.isArray(i))return"";const t=[];for(let s=0;s<i.length;s++){const o=i[s];try{dn(o)?t.push("[VueViewModel]"):t.push(String(o))}catch{t.push("[value cannot be serialized]")}}return t.join(e)}function Sc(i,e,t=!1){return tt(i)?Ac(e)?e.test(i):tt(e)?t?i===e:i.includes(e):!1:!1}function Ti(i,e=[],t=!1){return e.some(s=>Sc(i,s,t))}function Ee(i,e,t){if(!(e in i))return;const s=i[e];if(typeof s!="function")return;const o=t(s);typeof o=="function"&&In(o,s);try{i[e]=o}catch{Z&&B.log(`Failed to replace method "${e}" in object`,i)}}function _t(i,e,t){try{Object.defineProperty(i,e,{value:t,writable:!0,configurable:!0})}catch{Z&&B.log(`Failed to add non-enumerable property "${e}" to object`,i)}}function In(i,e){try{const t=e.prototype||{};i.prototype=e.prototype=t,_t(i,"__sentry_original__",e)}catch{}}function $o(i){return i.__sentry_original__}function wn(i){if(Yo(i))return{message:i.message,name:i.name,stack:i.stack,...Cr(i)};if(ji(i)){const e={type:i.type,target:wr(i.target),currentTarget:wr(i.currentTarget),...Cr(i)};return typeof CustomEvent<"u"&&yt(i,CustomEvent)&&(e.detail=i.detail),e}else return i}function wr(i){try{return hc(i)?zn(i):Object.prototype.toString.call(i)}catch{return"<unknown>"}}function Cr(i){if(typeof i=="object"&&i!==null){const e={};for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e}else return{}}function xc(i,e=40){const t=Object.keys(wn(i));t.sort();const s=t[0];if(!s)return"[object has no keys]";if(s.length>=e)return si(s,e);for(let o=t.length;o>0;o--){const r=t.slice(0,o).join(", ");if(!(r.length>e))return o===t.length?r:si(r,e)}return""}function fc(){const i=te;return i.crypto||i.msCrypto}function fe(i=fc()){let e=()=>Math.random()*16;try{if(i!=null&&i.randomUUID)return i.randomUUID().replace(/-/g,"");i!=null&&i.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return i.getRandomValues(t),t[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,t=>(t^(e()&15)>>t/4).toString(16))}function Cn(i){var e,t;return(t=(e=i.exception)==null?void 0:e.values)==null?void 0:t[0]}function pt(i){const{message:e,event_id:t}=i;if(e)return e;const s=Cn(i);return s?s.type&&s.value?`${s.type}: ${s.value}`:s.type||s.value||t||"<unknown>":t||"<unknown>"}function Xi(i,e,t){const s=i.exception=i.exception||{},o=s.values=s.values||[],r=o[0]=o[0]||{};r.value||(r.value=e||""),r.type||(r.type="Error")}function Zt(i,e){const t=Cn(i);if(!t)return;const s={type:"generic",handled:!0},o=t.mechanism;if(t.mechanism={...s,...o,...e},e&&"data"in e){const r={...o==null?void 0:o.data,...e.data};t.mechanism.data=r}}function hr(i){if(kc(i))return!0;try{_t(i,"__sentry_captured__",!0)}catch{}return!1}function kc(i){try{return i.__sentry_captured__}catch{}}const hn=1e3;function ps(){return Date.now()/hn}function Yc(){const{performance:i}=te;if(!(i!=null&&i.now))return ps;const e=Date.now()-i.now(),t=i.timeOrigin==null?e:i.timeOrigin;return()=>(t+i.now())/hn}const st=Yc();function Qc(i){const e=st(),t={sid:fe(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>vc(t)};return i&&Xt(t,i),t}function Xt(i,e={}){if(e.user&&(!i.ipAddress&&e.user.ip_address&&(i.ipAddress=e.user.ip_address),!i.did&&!e.did&&(i.did=e.user.id||e.user.email||e.user.username)),i.timestamp=e.timestamp||st(),e.abnormal_mechanism&&(i.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(i.ignoreDuration=e.ignoreDuration),e.sid&&(i.sid=e.sid.length===32?e.sid:fe()),e.init!==void 0&&(i.init=e.init),!i.did&&e.did&&(i.did=`${e.did}`),typeof e.started=="number"&&(i.started=e.started),i.ignoreDuration)i.duration=void 0;else if(typeof e.duration=="number")i.duration=e.duration;else{const t=i.timestamp-i.started;i.duration=t>=0?t:0}e.release&&(i.release=e.release),e.environment&&(i.environment=e.environment),!i.ipAddress&&e.ipAddress&&(i.ipAddress=e.ipAddress),!i.userAgent&&e.userAgent&&(i.userAgent=e.userAgent),typeof e.errors=="number"&&(i.errors=e.errors),e.status&&(i.status=e.status)}function Uc(i,e){let t={};i.status==="ok"&&(t={status:"exited"}),Xt(i,t)}function vc(i){return{sid:`${i.sid}`,init:i.init,started:new Date(i.started*1e3).toISOString(),timestamp:new Date(i.timestamp*1e3).toISOString(),status:i.status,errors:i.errors,did:typeof i.did=="number"||typeof i.did=="string"?`${i.did}`:void 0,duration:i.duration,abnormal_mechanism:i.abnormal_mechanism,attrs:{release:i.release,environment:i.environment,ip_address:i.ipAddress,user_agent:i.userAgent}}}function ms(i,e,t=2){if(!e||typeof e!="object"||t<=0)return e;if(i&&Object.keys(e).length===0)return i;const s={...i};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(s[o]=ms(s[o],e[o],t-1));return s}function Ar(){return fe()}function An(){return fe().substring(16)}const Ki="_sentrySpan";function pr(i,e){e?_t(i,Ki,e):delete i[Ki]}function mr(i){return i[Ki]}const bc=100;class it{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:Ar(),sampleRand:Math.random()}}clone(){const e=new it;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,pr(e,mr(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Xt(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}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;const t=typeof e=="function"?e(this):e,s=t instanceof it?t.getScopeData():ds(t)?e:void 0,{tags:o,extra:r,user:M,contexts:a,level:u,fingerprint:N=[],propagationContext:l}=s||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...r},this._contexts={...this._contexts,...a},M&&Object.keys(M).length&&(this._user=M),u&&(this._level=u),N.length&&(this._fingerprint=N),l&&(this._propagationContext=l),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._session=void 0,pr(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ar(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){var r;const s=typeof t=="number"?t:bc;if(s<=0)return this;const o={timestamp:ps(),...e,message:e.message?si(e.message,2048):e.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>s&&(this._breadcrumbs=this._breadcrumbs.slice(-s),(r=this._client)==null||r.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:mr(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ms(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const s=(t==null?void 0:t.event_id)||fe();if(!this._client)return B.warn("No client configured on scope - will not capture exception!"),s;const o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...t,event_id:s},this),s}captureMessage(e,t,s){const o=(s==null?void 0:s.event_id)||fe();if(!this._client)return B.warn("No client configured on scope - will not capture message!"),o;const r=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:r,...s,event_id:o},this),o}captureEvent(e,t){const s=(t==null?void 0:t.event_id)||fe();return this._client?(this._client.captureEvent(e,{...t,event_id:s},this),s):(B.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function $c(){return Li("defaultCurrentScope",()=>new it)}function Pc(){return Li("defaultIsolationScope",()=>new it)}class Wc{constructor(e,t){let s;e?s=e:s=new it;let o;t?o=t:o=new it,this._stack=[{scope:s}],this._isolationScope=o}withScope(e){const t=this._pushScope();let s;try{s=e(t)}catch(o){throw this._popScope(),o}return gi(s)?s.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(this._popScope(),s)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Kt(){const i=Ni(),e=li(i);return e.stack=e.stack||new Wc($c(),Pc())}function Rc(i){return Kt().withScope(i)}function Jc(i,e){const t=Kt();return t.withScope(()=>(t.getStackTop().scope=i,e(i)))}function Or(i){return Kt().withScope(()=>i(Kt().getIsolationScope()))}function Bc(){return{withIsolationScope:Or,withScope:Rc,withSetScope:Jc,withSetIsolationScope:(i,e)=>Or(e),getCurrentScope:()=>Kt().getScope(),getIsolationScope:()=>Kt().getIsolationScope()}}function Po(i){const e=li(i);return e.acs?e.acs:Bc()}function ot(){const i=Ni();return Po(i).getCurrentScope()}function Os(){const i=Ni();return Po(i).getIsolationScope()}function Fc(){return Li("globalScope",()=>new it)}function Gc(...i){const e=Ni(),t=Po(e);if(i.length===2){const[s,o]=i;return s?t.withSetScope(s,o):t.withScope(o)}return t.withScope(i[0])}function we(){return ot().getClient()}function Hc(i){const e=i.getPropagationContext(),{traceId:t,parentSpanId:s,propagationSpanId:o}=e,r={trace_id:t,span_id:o||An()};return s&&(r.parent_span_id=s),r}const Vc="sentry.source",Zc="sentry.sample_rate",Xc="sentry.previous_trace_sample_rate",Kc="sentry.op",qc="sentry.origin",pn="sentry.profile_id",mn="sentry.exclusive_time",eu=0,tu=1,su="_sentryScope",iu="_sentryIsolationScope";function On(i){return{scope:i[su],isolationScope:i[iu]}}const ou="sentry-",ru=/^sentry-/;function Mu(i){const e=nu(i);if(!e)return;const t=Object.entries(e).reduce((s,[o,r])=>{if(o.match(ru)){const M=o.slice(ou.length);s[M]=r}return s},{});if(Object.keys(t).length>0)return t}function nu(i){if(!(!i||!tt(i)&&!Array.isArray(i)))return Array.isArray(i)?i.reduce((e,t)=>{const s=Er(t);return Object.entries(s).forEach(([o,r])=>{e[o]=r}),e},{}):Er(i)}function Er(i){return i.split(",").map(e=>e.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((e,[t,s])=>(t&&s&&(e[t]=s),e),{})}function au(i){if(typeof i=="boolean")return Number(i);const e=typeof i=="string"?parseFloat(i):i;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const En=1;let _r=!1;function cu(i){const{spanId:e,traceId:t,isRemote:s}=i.spanContext(),o=s?e:Wo(i).parent_span_id,r=On(i).scope,M=s?(r==null?void 0:r.getPropagationContext().propagationSpanId)||An():e;return{parent_span_id:o,span_id:M,trace_id:t}}function uu(i){if(i&&i.length>0)return i.map(({context:{spanId:e,traceId:t,traceFlags:s,...o},attributes:r})=>({span_id:e,trace_id:t,sampled:s===En,attributes:r,...o}))}function Sr(i){return typeof i=="number"?xr(i):Array.isArray(i)?i[0]+i[1]/1e9:i instanceof Date?xr(i.getTime()):st()}function xr(i){return i>9999999999?i/1e3:i}function Wo(i){var s;if(lu(i))return i.getSpanJSON();const{spanId:e,traceId:t}=i.spanContext();if(Nu(i)){const{attributes:o,startTime:r,name:M,endTime:a,status:u,links:N}=i,l="parentSpanId"in i?i.parentSpanId:"parentSpanContext"in i?(s=i.parentSpanContext)==null?void 0:s.spanId:void 0;return{span_id:e,trace_id:t,data:o,description:M,parent_span_id:l,start_timestamp:Sr(r),timestamp:Sr(a)||void 0,status:ju(u),op:o[Kc],origin:o[qc],links:uu(N)}}return{span_id:e,trace_id:t,start_timestamp:0,data:{}}}function Nu(i){const e=i;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function lu(i){return typeof i.getSpanJSON=="function"}function Lu(i){const{traceFlags:e}=i.spanContext();return e===En}function ju(i){if(!(!i||i.code===eu))return i.code===tu?"ok":i.message||"unknown_error"}const gu="_sentryRootSpan";function _n(i){return i[gu]||i}function fr(){_r||(es(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),_r=!0)}function Tu(i){var t;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=i||((t=we())==null?void 0:t.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const Ro="production",yu=/^o(\d+)\./,Du=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function du(i){return i==="http"||i==="https"}function yi(i,e=!1){const{host:t,path:s,pass:o,port:r,projectId:M,protocol:a,publicKey:u}=i;return`${a}://${u}${e&&o?`:${o}`:""}@${t}${r?`:${r}`:""}/${s&&`${s}/`}${M}`}function zu(i){const e=Du.exec(i);if(!e){es(()=>{console.error(`Invalid Sentry Dsn: ${i}`)});return}const[t,s,o="",r="",M="",a=""]=e.slice(1);let u="",N=a;const l=N.split("/");if(l.length>1&&(u=l.slice(0,-1).join("/"),N=l.pop()),N){const c=N.match(/^\d+/);c&&(N=c[0])}return Sn({host:r,pass:o,path:u,projectId:N,port:M,protocol:t,publicKey:s})}function Sn(i){return{protocol:i.protocol,publicKey:i.publicKey||"",pass:i.pass||"",host:i.host,port:i.port||"",path:i.path||"",projectId:i.projectId}}function Iu(i){if(!Z)return!0;const{port:e,projectId:t,protocol:s}=i;return["protocol","publicKey","host","projectId"].find(M=>i[M]?!1:(B.error(`Invalid Sentry Dsn: ${M} missing`),!0))?!1:t.match(/^\d+$/)?du(s)?e&&isNaN(parseInt(e,10))?(B.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(B.error(`Invalid Sentry Dsn: Invalid protocol ${s}`),!1):(B.error(`Invalid Sentry Dsn: Invalid projectId ${t}`),!1)}function wu(i){const e=i.match(yu);return e==null?void 0:e[1]}function Cu(i){const e=typeof i=="string"?zu(i):Sn(i);if(!(!e||!Iu(e)))return e}const hu="_frozenDsc";function xn(i,e){const t=e.getOptions(),{publicKey:s,host:o}=e.getDsn()||{};let r;t.orgId?r=String(t.orgId):o&&(r=wu(o));const M={environment:t.environment||Ro,release:t.release,public_key:s,trace_id:i,org_id:r};return e.emit("createDsc",M),M}function Au(i,e){const t=e.getPropagationContext();return t.dsc||xn(t.traceId,i)}function pu(i){var T;const e=we();if(!e)return{};const t=_n(i),s=Wo(t),o=s.data,r=t.spanContext().traceState,M=(r==null?void 0:r.get("sentry.sample_rate"))??o[Zc]??o[Xc];function a(D){return(typeof M=="number"||typeof M=="string")&&(D.sample_rate=`${M}`),D}const u=t[hu];if(u)return a(u);const N=r==null?void 0:r.get("sentry.dsc"),l=N&&Mu(N);if(l)return a(l);const c=xn(i.spanContext().traceId,e),L=o[Vc],j=s.description;return L!=="url"&&j&&(c.transaction=j),Tu()&&(c.sampled=String(Lu(t)),c.sample_rand=(r==null?void 0:r.get("sentry.sample_rand"))??((T=On(t).scope)==null?void 0:T.getPropagationContext().sampleRand.toString())),a(c),e.emit("createDsc",c,t),c}function qe(i,e=100,t=1/0){try{return qi("",i,e,t)}catch(s){return{ERROR:`**non-serializable** (${s})`}}}function fn(i,e=3,t=100*1024){const s=qe(i,e);return _u(s)>t?fn(i,e-1,t):s}function qi(i,e,t=1/0,s=1/0,o=Su()){const[r,M]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=mu(i,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const u=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:t;if(u===0)return a.replace("object ","");if(r(e))return"[Circular ~]";const N=e;if(N&&typeof N.toJSON=="function")try{const j=N.toJSON();return qi("",j,u-1,s,o)}catch{}const l=Array.isArray(e)?[]:{};let c=0;const L=wn(e);for(const j in L){if(!Object.prototype.hasOwnProperty.call(L,j))continue;if(c>=s){l[j]="[MaxProperties ~]";break}const T=L[j];l[j]=qi(j,T,u-1,s,o),c++}return M(e),l}function mu(i,e){try{if(i==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(i==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(dn(e))return"[VueViewModel]";if(pc(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Tt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const t=Ou(e);return/^HTML(\w*)Element$/.test(t)?`[HTMLElement: ${t}]`:`[object ${t}]`}catch(t){return`**non-serializable** (${t})`}}function Ou(i){const e=Object.getPrototypeOf(i);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function Eu(i){return~-encodeURI(i).split(/%..|./).length}function _u(i){return Eu(JSON.stringify(i))}function Su(){const i=new WeakSet;function e(s){return i.has(s)?!0:(i.add(s),!1)}function t(s){i.delete(s)}return[e,t]}function Es(i,e=[]){return[i,e]}function xu(i,e){const[t,s]=i;return[t,[...s,e]]}function kr(i,e){const t=i[1];for(const s of t){const o=s[0].type;if(e(s,o))return!0}return!1}function eo(i){const e=li(te);return e.encodePolyfill?e.encodePolyfill(i):new TextEncoder().encode(i)}function fu(i){const[e,t]=i;let s=JSON.stringify(e);function o(r){typeof s=="string"?s=typeof r=="string"?s+r:[eo(s),r]:s.push(typeof r=="string"?eo(r):r)}for(const r of t){const[M,a]=r;if(o(`
6
6
  ${JSON.stringify(M)}
7
- `),typeof a=="string"||a instanceof Uint8Array)o(a);else{let u;try{u=JSON.stringify(a)}catch{u=JSON.stringify(qe(a))}o(u)}}return typeof s=="string"?s:ku(s)}function ku(i){const e=i.reduce((o,r)=>o+r.length,0),t=new Uint8Array(e);let s=0;for(const o of i)t.set(o,s),s+=o.length;return t}function Yu(i){const e=typeof i.data=="string"?eo(i.data):i.data;return[{type:"attachment",length:e.length,filename:i.filename,content_type:i.contentType,attachment_type:i.attachmentType},e]}const Qu={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Yr(i){return Qu[i]}function kn(i){if(!(i!=null&&i.sdk))return;const{name:e,version:t}=i.sdk;return{name:e,version:t}}function Uu(i,e,t,s){var r;const o=(r=i.sdkProcessingMetadata)==null?void 0:r.dynamicSamplingContext;return{event_id:i.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!t&&s&&{dsn:yi(s)},...o&&{trace:o}}}function vu(i,e){return e&&(i.sdk=i.sdk||{},i.sdk.name=i.sdk.name||e.name,i.sdk.version=i.sdk.version||e.version,i.sdk.integrations=[...i.sdk.integrations||[],...e.integrations||[]],i.sdk.packages=[...i.sdk.packages||[],...e.packages||[]]),i}function bu(i,e,t,s){const o=kn(t),r={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!s&&e&&{dsn:yi(e)}},M="aggregates"in i?[{type:"sessions"},i]:[{type:"session"},i.toJSON()];return Es(r,[M])}function $u(i,e,t,s){const o=kn(t),r=i.type&&i.type!=="replay_event"?i.type:"event";vu(i,t==null?void 0:t.sdk);const M=Uu(i,o,s,e);return delete i.sdkProcessingMetadata,Es(M,[[{type:r},i]])}var et;(function(i){i[i.PENDING=0]="PENDING";const t=1;i[i.RESOLVED=t]="RESOLVED";const s=2;i[i.REJECTED=s]="REJECTED"})(et||(et={}));function St(i){return new Dt(e=>{e(i)})}function ii(i){return new Dt((e,t)=>{t(i)})}class Dt{constructor(e){this._state=et.PENDING,this._handlers=[],this._runExecutor(e)}then(e,t){return new Dt((s,o)=>{this._handlers.push([!1,r=>{if(!e)s(r);else try{s(e(r))}catch(M){o(M)}},r=>{if(!t)o(r);else try{s(t(r))}catch(M){o(M)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new Dt((t,s)=>{let o,r;return this.then(M=>{r=!1,o=M,e&&e()},M=>{r=!0,o=M,e&&e()}).then(()=>{if(r){s(o);return}t(o)})})}_executeHandlers(){if(this._state===et.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===et.RESOLVED&&t[1](this._value),this._state===et.REJECTED&&t[2](this._value),t[0]=!0)})}_runExecutor(e){const t=(r,M)=>{if(this._state===et.PENDING){if(gi(M)){M.then(s,o);return}this._state=r,this._value=M,this._executeHandlers()}},s=r=>{t(et.RESOLVED,r)},o=r=>{t(et.REJECTED,r)};try{e(s,o)}catch(r){o(r)}}}function to(i,e,t,s=0){return new Dt((o,r)=>{const M=i[s];if(e===null||typeof M!="function")o(e);else{const a=M({...e},t);Z&&M.id&&a===null&&B.log(`Event processor "${M.id}" dropped event`),gi(a)?a.then(u=>to(i,u,t,s+1).then(o)).then(null,r):to(i,a,t,s+1).then(o).then(null,r)}})}let ks,Qr,Ys;function Pu(i){const e=te._sentryDebugIds;if(!e)return{};const t=Object.keys(e);return Ys&&t.length===Qr||(Qr=t.length,Ys=t.reduce((s,o)=>{ks||(ks={});const r=ks[o];if(r)s[r[0]]=r[1];else{const M=i(o);for(let a=M.length-1;a>=0;a--){const u=M[a],N=u==null?void 0:u.filename,l=e[o];if(N&&l){s[N]=l,ks[o]=[N,l];break}}}return s},{})),Ys}function Wu(i,e){const{fingerprint:t,span:s,breadcrumbs:o,sdkProcessingMetadata:r}=e;Ru(i,e),s&&Fu(i,s),Gu(i,t),Ju(i,o),Bu(i,r)}function Ur(i,e){const{extra:t,tags:s,user:o,contexts:r,level:M,sdkProcessingMetadata:a,breadcrumbs:u,fingerprint:N,eventProcessors:l,attachments:c,propagationContext:L,transactionName:j,span:T}=e;Qs(i,"extra",t),Qs(i,"tags",s),Qs(i,"user",o),Qs(i,"contexts",r),i.sdkProcessingMetadata=ms(i.sdkProcessingMetadata,a,2),M&&(i.level=M),j&&(i.transactionName=j),T&&(i.span=T),u.length&&(i.breadcrumbs=[...i.breadcrumbs,...u]),N.length&&(i.fingerprint=[...i.fingerprint,...N]),l.length&&(i.eventProcessors=[...i.eventProcessors,...l]),c.length&&(i.attachments=[...i.attachments,...c]),i.propagationContext={...i.propagationContext,...L}}function Qs(i,e,t){i[e]=ms(i[e],t,1)}function Ru(i,e){const{extra:t,tags:s,user:o,contexts:r,level:M,transactionName:a}=e;Object.keys(t).length&&(i.extra={...t,...i.extra}),Object.keys(s).length&&(i.tags={...s,...i.tags}),Object.keys(o).length&&(i.user={...o,...i.user}),Object.keys(r).length&&(i.contexts={...r,...i.contexts}),M&&(i.level=M),a&&i.type!=="transaction"&&(i.transaction=a)}function Ju(i,e){const t=[...i.breadcrumbs||[],...e];i.breadcrumbs=t.length?t:void 0}function Bu(i,e){i.sdkProcessingMetadata={...i.sdkProcessingMetadata,...e}}function Fu(i,e){i.contexts={trace:iu(e),...i.contexts},i.sdkProcessingMetadata={dynamicSamplingContext:pu(e),...i.sdkProcessingMetadata};const t=On(e),s=Wo(t).description;s&&!i.transaction&&i.type==="transaction"&&(i.transaction=s)}function Gu(i,e){i.fingerprint=i.fingerprint?Array.isArray(i.fingerprint)?i.fingerprint:[i.fingerprint]:[],e&&(i.fingerprint=i.fingerprint.concat(e)),i.fingerprint.length||delete i.fingerprint}function Hu(i,e,t,s,o,r){const{normalizeDepth:M=3,normalizeMaxBreadth:a=1e3}=i,u={...e,event_id:e.event_id||t.event_id||fe(),timestamp:e.timestamp||ps()},N=t.integrations||i.integrations.map(I=>I.name);Vu(u,i),Ku(u,N),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Zu(u,i.stackParser);const l=eN(s,t.captureContext);t.mechanism&&Zt(u,t.mechanism);const c=o?o.getEventProcessors():[],L=$c().getScopeData();if(r){const I=r.getScopeData();Ur(L,I)}if(l){const I=l.getScopeData();Ur(L,I)}const j=[...t.attachments||[],...L.attachments];j.length&&(t.attachments=j),Wu(u,L);const T=[...c,...L.eventProcessors];return to(T,u,t).then(I=>(I&&Xu(I),typeof M=="number"&&M>0?qu(I,M,a):I))}function Vu(i,e){const{environment:t,release:s,dist:o,maxValueLength:r=250}=e;i.environment=i.environment||t||Ro,!i.release&&s&&(i.release=s),!i.dist&&o&&(i.dist=o);const M=i.request;M!=null&&M.url&&(M.url=si(M.url,r))}function Zu(i,e){var s,o;const t=Pu(e);(o=(s=i.exception)==null?void 0:s.values)==null||o.forEach(r=>{var M,a;(a=(M=r.stacktrace)==null?void 0:M.frames)==null||a.forEach(u=>{u.filename&&(u.debug_id=t[u.filename])})})}function Xu(i){var s,o;const e={};if((o=(s=i.exception)==null?void 0:s.values)==null||o.forEach(r=>{var M,a;(a=(M=r.stacktrace)==null?void 0:M.frames)==null||a.forEach(u=>{u.debug_id&&(u.abs_path?e[u.abs_path]=u.debug_id:u.filename&&(e[u.filename]=u.debug_id),delete u.debug_id)})}),Object.keys(e).length===0)return;i.debug_meta=i.debug_meta||{},i.debug_meta.images=i.debug_meta.images||[];const t=i.debug_meta.images;Object.entries(e).forEach(([r,M])=>{t.push({type:"sourcemap",code_file:r,debug_id:M})})}function Ku(i,e){e.length>0&&(i.sdk=i.sdk||{},i.sdk.integrations=[...i.sdk.integrations||[],...e])}function qu(i,e,t){var o,r;if(!i)return null;const s={...i,...i.breadcrumbs&&{breadcrumbs:i.breadcrumbs.map(M=>({...M,...M.data&&{data:qe(M.data,e,t)}}))},...i.user&&{user:qe(i.user,e,t)},...i.contexts&&{contexts:qe(i.contexts,e,t)},...i.extra&&{extra:qe(i.extra,e,t)}};return(o=i.contexts)!=null&&o.trace&&s.contexts&&(s.contexts.trace=i.contexts.trace,i.contexts.trace.data&&(s.contexts.trace.data=qe(i.contexts.trace.data,e,t))),i.spans&&(s.spans=i.spans.map(M=>({...M,...M.data&&{data:qe(M.data,e,t)}}))),(r=i.contexts)!=null&&r.flags&&s.contexts&&(s.contexts.flags=qe(i.contexts.flags,3,t)),s}function eN(i,e){if(!e)return i;const t=i?i.clone():new it;return t.update(e),t}function tN(i,e){return ot().captureException(i,void 0)}function Yn(i,e){return ot().captureEvent(i,e)}function vr(i){const e=Os(),t=ot(),{userAgent:s}=te.navigator||{},o=_c({user:t.getUser()||e.getUser(),...s&&{userAgent:s},...i}),r=e.getSession();return(r==null?void 0:r.status)==="ok"&&Xt(r,{status:"exited"}),Qn(),e.setSession(o),o}function Qn(){const i=Os(),t=ot().getSession()||i.getSession();t&&Sc(t),Un(),i.setSession()}function Un(){const i=Os(),e=we(),t=i.getSession();t&&e&&e.captureSession(t)}function br(i=!1){if(i){Qn();return}Un()}const sN="7";function iN(i){const e=i.protocol?`${i.protocol}:`:"",t=i.port?`:${i.port}`:"";return`${e}//${i.host}${t}${i.path?`/${i.path}`:""}/api/`}function oN(i){return`${iN(i)}${i.projectId}/envelope/`}function rN(i,e){const t={sentry_version:sN};return i.publicKey&&(t.sentry_key=i.publicKey),e&&(t.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(t).toString()}function MN(i,e,t){return e||`${oN(i)}?${rN(i,t)}`}const $r=[];function nN(i){const e={};return i.forEach(t=>{const{name:s}=t,o=e[s];o&&!o.isDefaultInstance&&t.isDefaultInstance||(e[s]=t)}),Object.values(e)}function aN(i){const e=i.defaultIntegrations||[],t=i.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let s;if(Array.isArray(t))s=[...e,...t];else if(typeof t=="function"){const o=t(e);s=Array.isArray(o)?o:[o]}else s=e;return nN(s)}function cN(i,e){const t={};return e.forEach(s=>{s&&vn(i,s,t)}),t}function Pr(i,e){for(const t of e)t!=null&&t.afterAllSetup&&t.afterAllSetup(i)}function vn(i,e,t){if(t[e.name]){Z&&B.log(`Integration skipped because it was already installed: ${e.name}`);return}if(t[e.name]=e,$r.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),$r.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(i),typeof e.preprocessEvent=="function"){const s=e.preprocessEvent.bind(e);i.on("preprocessEvent",(o,r)=>s(o,r,i))}if(typeof e.processEvent=="function"){const s=e.processEvent.bind(e),o=Object.assign((r,M)=>s(r,M,i),{id:e.name});i.addEventProcessor(o)}Z&&B.log(`Integration installed: ${e.name}`)}function bn(i){const e=[];i.message&&e.push(i.message);try{const t=i.exception.values[i.exception.values.length-1];t!=null&&t.value&&(e.push(t.value),t.type&&e.push(`${t.type}: ${t.value}`))}catch{}return e}function uN(i){var u;const{trace_id:e,parent_span_id:t,span_id:s,status:o,origin:r,data:M,op:a}=((u=i.contexts)==null?void 0:u.trace)??{};return{data:M??{},description:i.transaction,op:a,parent_span_id:t,span_id:s??"",start_timestamp:i.start_timestamp??0,status:o,timestamp:i.timestamp,trace_id:e??"",origin:r,profile_id:M==null?void 0:M[hn],exclusive_time:M==null?void 0:M[An],measurements:i.measurements,is_segment:!0}}function NN(i){return{type:"transaction",timestamp:i.timestamp,start_timestamp:i.start_timestamp,transaction:i.description,contexts:{trace:{trace_id:i.trace_id,span_id:i.span_id,parent_span_id:i.parent_span_id,op:i.op,status:i.status,origin:i.origin,data:{...i.data,...i.profile_id&&{[hn]:i.profile_id},...i.exclusive_time&&{[An]:i.exclusive_time}}}},measurements:i.measurements}}function lN(i,e,t){const s=[{type:"client_report"},{timestamp:ps(),discarded_events:i}];return Es(e?{dsn:e}:{},[s])}const Wr="Not capturing exception because it's already been captured.",Rr="Discarded session because of missing or non-string release",$n=Symbol.for("SentryInternalError"),Pn=Symbol.for("SentryDoNotSendEventError");function Zs(i){return{message:i,[$n]:!0}}function Ei(i){return{message:i,[Pn]:!0}}function Jr(i){return!!i&&typeof i=="object"&&$n in i}function Br(i){return!!i&&typeof i=="object"&&Pn in i}class LN{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Cu(e.dsn):Z&&B.warn("No DSN provided, client will not send events."),this._dsn){const t=MN(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,s){const o=fe();if(zr(e))return Z&&B.log(Wr),o;const r={event_id:o,...t};return this._process(this.eventFromException(e,r).then(M=>this._captureEvent(M,r,s))),r.event_id}captureMessage(e,t,s,o){const r={event_id:fe(),...s},M=Qo(e)?e:String(e),a=Uo(e)?this.eventFromMessage(M,t,r):this.eventFromException(e,r);return this._process(a.then(u=>this._captureEvent(u,r,o))),r.event_id}captureEvent(e,t,s){const o=fe();if(t!=null&&t.originalException&&zr(t.originalException))return Z&&B.log(Wr),o;const r={event_id:o,...t},M=e.sdkProcessingMetadata||{},a=M.capturedSpanScope,u=M.capturedSpanIsolationScope;return this._process(this._captureEvent(e,r,a||s,u)),r.event_id}captureSession(e){this.sendSession(e),Xt(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then(s=>t.flush(e).then(o=>s&&o))):St(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,this.emit("close"),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];vn(this,e,this._integrations),t||Pr(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let s=$u(e,this._dsn,this._options._metadata,this._options.tunnel);for(const r of t.attachments||[])s=xu(s,Yu(r));const o=this.sendEnvelope(s);o&&o.then(r=>this.emit("afterSendEvent",e,r),null)}sendSession(e){const{release:t,environment:s=Ro}=this._options;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t){Z&&B.warn(Rr);return}r.release=r.release||t,r.environment=r.environment||s,e.attrs=r}else{if(!e.release&&!t){Z&&B.warn(Rr);return}e.release=e.release||t,e.environment=e.environment||s}this.emit("beforeSendSession",e);const o=bu(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,t,s=1){if(this._options.sendClientReports){const o=`${e}:${t}`;Z&&B.log(`Recording outcome: "${o}"${s>1?` (${s} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+s}}on(e,t){const s=this._hooks[e]=this._hooks[e]||[];return s.push(t),()=>{const o=s.indexOf(t);o>-1&&s.splice(o,1)}}emit(e,...t){const s=this._hooks[e];s&&s.forEach(o=>o(...t))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,t=>(Z&&B.error("Error while sending envelope:",t),t)):(Z&&B.error("Transport disabled"),St({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=cN(this,e),Pr(this,e)}_updateSessionFromEvent(e,t){var u;let s=t.level==="fatal",o=!1;const r=(u=t.exception)==null?void 0:u.values;if(r){o=!0;for(const N of r){const l=N.mechanism;if((l==null?void 0:l.handled)===!1){s=!0;break}}}const M=e.status==="ok";(M&&e.errors===0||M&&s)&&(Xt(e,{...s&&{status:"crashed"},errors:e.errors||Number(o||s)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Dt(t=>{let s=0;const o=1,r=setInterval(()=>{this._numProcessing==0?(clearInterval(r),t(!0)):(s+=o,e&&s>=e&&(clearInterval(r),t(!1)))},o)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,s,o){const r=this.getOptions(),M=Object.keys(this._integrations);return!t.integrations&&(M!=null&&M.length)&&(t.integrations=M),this.emit("preprocessEvent",e,t),e.type||o.setLastEventId(e.event_id||t.event_id),Hu(r,e,t,s,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,t),a.contexts={trace:Wc(s),...a.contexts};const u=Au(this,s);return a.sdkProcessingMetadata={dynamicSamplingContext:u,...a.sdkProcessingMetadata},a})}_captureEvent(e,t={},s=ot(),o=Os()){return Z&&so(e)&&B.log(`Captured error event \`${bn(e)[0]||"<unknown>"}\``),this._processEvent(e,t,s,o).then(r=>r.event_id,r=>{Z&&(Br(r)?B.log(r.message):Jr(r)?B.warn(r.message):B.warn(r))})}_processEvent(e,t,s,o){const r=this.getOptions(),{sampleRate:M}=r,a=Wn(e),u=so(e),N=e.type||"error",l=`before send for type \`${N}\``,c=typeof M>"u"?void 0:Kc(M);if(u&&typeof c=="number"&&Math.random()>c)return this.recordDroppedEvent("sample_rate","error"),ii(Ei(`Discarding event because it's not included in the random sample (sampling rate = ${M})`));const L=N==="replay_event"?"replay":N;return this._prepareEvent(e,t,s,o).then(j=>{if(j===null)throw this.recordDroppedEvent("event_processor",L),Ei("An event processor returned `null`, will not send event.");if(t.data&&t.data.__sentry__===!0)return j;const D=gN(this,r,j,t);return jN(D,l)}).then(j=>{var I;if(j===null){if(this.recordDroppedEvent("before_send",L),a){const E=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",E)}throw Ei(`${l} returned \`null\`, will not send event.`)}const T=s.getSession()||o.getSession();if(u&&T&&this._updateSessionFromEvent(T,j),a){const C=((I=j.sdkProcessingMetadata)==null?void 0:I.spanCountBeforeProcessing)||0,E=j.spans?j.spans.length:0,A=C-E;A>0&&this.recordDroppedEvent("before_send","span",A)}const D=j.transaction_info;if(a&&D&&j.transaction!==e.transaction){const C="custom";j.transaction_info={...D,source:C}}return this.sendEvent(j,t),j}).then(null,j=>{throw Br(j)||Jr(j)?j:(this.captureException(j,{data:{__sentry__:!0},originalException:j}),Zs(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
8
- Reason: ${j}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,s])=>{const[o,r]=t.split(":");return{reason:o,category:r,quantity:s}})}_flushOutcomes(){Z&&B.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){Z&&B.log("No outcomes to send");return}if(!this._dsn){Z&&B.log("No dsn provided, will not send outcomes");return}Z&&B.log("Sending outcomes:",e);const t=lN(e,this._options.tunnel&&yi(this._dsn));this.sendEnvelope(t)}}function jN(i,e){const t=`${e} must return \`null\` or a valid event.`;if(gi(i))return i.then(s=>{if(!ds(s)&&s!==null)throw Zs(t);return s},s=>{throw Zs(`${e} rejected with ${s}`)});if(!ds(i)&&i!==null)throw Zs(t);return i}function gN(i,e,t,s){const{beforeSend:o,beforeSendTransaction:r,beforeSendSpan:M}=e;let a=t;if(so(a)&&o)return o(a,s);if(Wn(a)){if(M){const u=M(uN(a));if(u?a=ms(t,NN(u)):Er(),a.spans){const N=[];for(const l of a.spans){const c=M(l);c?N.push(c):(Er(),N.push(l))}a.spans=N}}if(r){if(a.spans){const u=a.spans.length;a.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return r(a,s)}}return a}function so(i){return i.type===void 0}function Wn(i){return i.type==="transaction"}function TN(i){return[{type:"log",item_count:i.length,content_type:"application/vnd.sentry.items.log+json"},{items:i}]}function yN(i,e,t,s){const o={};return e!=null&&e.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),t&&s&&(o.dsn=yi(s)),Es(o,[TN(i)])}te._sentryClientToLogBufferMap=new WeakMap;function _i(i,e){var r;const t=DN(i)??[];if(t.length===0)return;const s=i.getOptions(),o=yN(t,s._metadata,s.tunnel,i.getDsn());(r=te._sentryClientToLogBufferMap)==null||r.set(i,[]),i.emit("flushLogs"),i.sendEnvelope(o)}function DN(i){var e;return(e=te._sentryClientToLogBufferMap)==null?void 0:e.get(i)}function dN(i,e){e.debug===!0&&(Z?B.enable():ts(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),ot().update(e.initialScope);const s=new i(e);return zN(s),s.init(),s}function zN(i){ot().setClient(i)}const Rn=Symbol.for("SentryBufferFullError");function IN(i){const e=[];function t(){return i===void 0||e.length<i}function s(M){return e.splice(e.indexOf(M),1)[0]||Promise.resolve(void 0)}function o(M){if(!t())return ii(Rn);const a=M();return e.indexOf(a)===-1&&e.push(a),a.then(()=>s(a)).then(null,()=>s(a).then(null,()=>{})),a}function r(M){return new Dt((a,u)=>{let N=e.length;if(!N)return a(!0);const l=setTimeout(()=>{M&&M>0&&a(!1)},M);e.forEach(c=>{St(c).then(()=>{--N||(clearTimeout(l),a(!0))},u)})})}return{$:e,add:o,drain:r}}const wN=60*1e3;function CN(i,e=Date.now()){const t=parseInt(`${i}`,10);if(!isNaN(t))return t*1e3;const s=Date.parse(`${i}`);return isNaN(s)?wN:s-e}function hN(i,e){return i[e]||i.all||0}function AN(i,e,t=Date.now()){return hN(i,e)>t}function pN(i,{statusCode:e,headers:t},s=Date.now()){const o={...i},r=t==null?void 0:t["x-sentry-rate-limits"],M=t==null?void 0:t["retry-after"];if(r)for(const a of r.trim().split(",")){const[u,N,,,l]=a.split(":",5),c=parseInt(u,10),L=(isNaN(c)?60:c)*1e3;if(!N)o.all=s+L;else for(const j of N.split(";"))j==="metric_bucket"?(!l||l.split(";").includes("custom"))&&(o[j]=s+L):o[j]=s+L}else M?o.all=s+CN(M,s):e===429&&(o.all=s+60*1e3);return o}const mN=64;function ON(i,e,t=IN(i.bufferSize||mN)){let s={};const o=M=>t.drain(M);function r(M){const a=[];if(kr(M,(c,L)=>{const j=Yr(L);AN(s,j)?i.recordDroppedEvent("ratelimit_backoff",j):a.push(c)}),a.length===0)return St({});const u=Es(M[0],a),N=c=>{kr(u,(L,j)=>{i.recordDroppedEvent(c,Yr(j))})},l=()=>e({body:fu(u)}).then(c=>(c.statusCode!==void 0&&(c.statusCode<200||c.statusCode>=300)&&Z&&B.warn(`Sentry responded with status code ${c.statusCode} to sent event.`),s=pN(s,c),c),c=>{throw N("network_error"),Z&&B.error("Encountered error running transport request:",c),c});return t.add(l).then(c=>c,c=>{if(c===Rn)return Z&&B.error("Skipped sending event because buffer is full."),N("queue_overflow"),St({});throw c})}return{send:r,flush:o}}function EN(i){var e;((e=i.user)==null?void 0:e.ip_address)===void 0&&(i.user={...i.user,ip_address:"{{auto}}"})}function _N(i){var e;"aggregates"in i?((e=i.attrs)==null?void 0:e.ip_address)===void 0&&(i.attrs={...i.attrs,ip_address:"{{auto}}"}):i.ipAddress===void 0&&(i.ipAddress="{{auto}}")}function SN(i,e,t=[e],s="npm"){const o=i._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${e}`,packages:t.map(r=>({name:`${s}:@sentry/${r}`,version:Ot})),version:Ot}),i._metadata=o}const xN=100;function xt(i,e){const t=we(),s=Os();if(!t)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:r=xN}=t.getOptions();if(r<=0)return;const a={timestamp:ps(),...i},u=o?ts(()=>o(a,e)):a;u!==null&&(t.emit&&t.emit("beforeAddBreadcrumb",u,e),s.addBreadcrumb(u,r))}let Fr;const fN="FunctionToString",Gr=new WeakMap,kN=()=>({name:fN,setupOnce(){Fr=Function.prototype.toString;try{Function.prototype.toString=function(...i){const e=$o(this),t=Gr.has(we())&&e!==void 0?e:this;return Fr.apply(t,i)}}catch{}},setup(i){Gr.set(i,!0)}}),YN=kN,QN=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],UN="EventFilters",vN=(i={})=>{let e;return{name:UN,setup(t){const s=t.getOptions();e=Hr(i,s)},processEvent(t,s,o){if(!e){const r=o.getOptions();e=Hr(i,r)}return $N(t,e)?null:t}}},bN=(i={})=>({...vN(i),name:"InboundFilters"});function Hr(i={},e={}){return{allowUrls:[...i.allowUrls||[],...e.allowUrls||[]],denyUrls:[...i.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...i.ignoreErrors||[],...e.ignoreErrors||[],...i.disableErrorDefaults?[]:QN],ignoreTransactions:[...i.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function $N(i,e){if(i.type){if(i.type==="transaction"&&WN(i,e.ignoreTransactions))return Z&&B.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
7
+ `),typeof a=="string"||a instanceof Uint8Array)o(a);else{let u;try{u=JSON.stringify(a)}catch{u=JSON.stringify(qe(a))}o(u)}}return typeof s=="string"?s:ku(s)}function ku(i){const e=i.reduce((o,r)=>o+r.length,0),t=new Uint8Array(e);let s=0;for(const o of i)t.set(o,s),s+=o.length;return t}function Yu(i){const e=typeof i.data=="string"?eo(i.data):i.data;return[{type:"attachment",length:e.length,filename:i.filename,content_type:i.contentType,attachment_type:i.attachmentType},e]}const Qu={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Yr(i){return Qu[i]}function kn(i){if(!(i!=null&&i.sdk))return;const{name:e,version:t}=i.sdk;return{name:e,version:t}}function Uu(i,e,t,s){var r;const o=(r=i.sdkProcessingMetadata)==null?void 0:r.dynamicSamplingContext;return{event_id:i.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!t&&s&&{dsn:yi(s)},...o&&{trace:o}}}function vu(i,e){return e&&(i.sdk=i.sdk||{},i.sdk.name=i.sdk.name||e.name,i.sdk.version=i.sdk.version||e.version,i.sdk.integrations=[...i.sdk.integrations||[],...e.integrations||[]],i.sdk.packages=[...i.sdk.packages||[],...e.packages||[]]),i}function bu(i,e,t,s){const o=kn(t),r={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!s&&e&&{dsn:yi(e)}},M="aggregates"in i?[{type:"sessions"},i]:[{type:"session"},i.toJSON()];return Es(r,[M])}function $u(i,e,t,s){const o=kn(t),r=i.type&&i.type!=="replay_event"?i.type:"event";vu(i,t==null?void 0:t.sdk);const M=Uu(i,o,s,e);return delete i.sdkProcessingMetadata,Es(M,[[{type:r},i]])}var et;(function(i){i[i.PENDING=0]="PENDING";const t=1;i[i.RESOLVED=t]="RESOLVED";const s=2;i[i.REJECTED=s]="REJECTED"})(et||(et={}));function St(i){return new Dt(e=>{e(i)})}function ii(i){return new Dt((e,t)=>{t(i)})}class Dt{constructor(e){this._state=et.PENDING,this._handlers=[],this._runExecutor(e)}then(e,t){return new Dt((s,o)=>{this._handlers.push([!1,r=>{if(!e)s(r);else try{s(e(r))}catch(M){o(M)}},r=>{if(!t)o(r);else try{s(t(r))}catch(M){o(M)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new Dt((t,s)=>{let o,r;return this.then(M=>{r=!1,o=M,e&&e()},M=>{r=!0,o=M,e&&e()}).then(()=>{if(r){s(o);return}t(o)})})}_executeHandlers(){if(this._state===et.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===et.RESOLVED&&t[1](this._value),this._state===et.REJECTED&&t[2](this._value),t[0]=!0)})}_runExecutor(e){const t=(r,M)=>{if(this._state===et.PENDING){if(gi(M)){M.then(s,o);return}this._state=r,this._value=M,this._executeHandlers()}},s=r=>{t(et.RESOLVED,r)},o=r=>{t(et.REJECTED,r)};try{e(s,o)}catch(r){o(r)}}}function to(i,e,t,s=0){return new Dt((o,r)=>{const M=i[s];if(e===null||typeof M!="function")o(e);else{const a=M({...e},t);Z&&M.id&&a===null&&B.log(`Event processor "${M.id}" dropped event`),gi(a)?a.then(u=>to(i,u,t,s+1).then(o)).then(null,r):to(i,a,t,s+1).then(o).then(null,r)}})}function Pu(i,e){const{fingerprint:t,span:s,breadcrumbs:o,sdkProcessingMetadata:r}=e;Wu(i,e),s&&Bu(i,s),Fu(i,t),Ru(i,o),Ju(i,r)}function Qr(i,e){const{extra:t,tags:s,user:o,contexts:r,level:M,sdkProcessingMetadata:a,breadcrumbs:u,fingerprint:N,eventProcessors:l,attachments:c,propagationContext:L,transactionName:j,span:T}=e;ks(i,"extra",t),ks(i,"tags",s),ks(i,"user",o),ks(i,"contexts",r),i.sdkProcessingMetadata=ms(i.sdkProcessingMetadata,a,2),M&&(i.level=M),j&&(i.transactionName=j),T&&(i.span=T),u.length&&(i.breadcrumbs=[...i.breadcrumbs,...u]),N.length&&(i.fingerprint=[...i.fingerprint,...N]),l.length&&(i.eventProcessors=[...i.eventProcessors,...l]),c.length&&(i.attachments=[...i.attachments,...c]),i.propagationContext={...i.propagationContext,...L}}function ks(i,e,t){i[e]=ms(i[e],t,1)}function Wu(i,e){const{extra:t,tags:s,user:o,contexts:r,level:M,transactionName:a}=e;Object.keys(t).length&&(i.extra={...t,...i.extra}),Object.keys(s).length&&(i.tags={...s,...i.tags}),Object.keys(o).length&&(i.user={...o,...i.user}),Object.keys(r).length&&(i.contexts={...r,...i.contexts}),M&&(i.level=M),a&&i.type!=="transaction"&&(i.transaction=a)}function Ru(i,e){const t=[...i.breadcrumbs||[],...e];i.breadcrumbs=t.length?t:void 0}function Ju(i,e){i.sdkProcessingMetadata={...i.sdkProcessingMetadata,...e}}function Bu(i,e){i.contexts={trace:cu(e),...i.contexts},i.sdkProcessingMetadata={dynamicSamplingContext:pu(e),...i.sdkProcessingMetadata};const t=_n(e),s=Wo(t).description;s&&!i.transaction&&i.type==="transaction"&&(i.transaction=s)}function Fu(i,e){i.fingerprint=i.fingerprint?Array.isArray(i.fingerprint)?i.fingerprint:[i.fingerprint]:[],e&&(i.fingerprint=i.fingerprint.concat(e)),i.fingerprint.length||delete i.fingerprint}let Ys,Ur,Qs;function Gu(i){const e=te._sentryDebugIds;if(!e)return{};const t=Object.keys(e);return Qs&&t.length===Ur||(Ur=t.length,Qs=t.reduce((s,o)=>{Ys||(Ys={});const r=Ys[o];if(r)s[r[0]]=r[1];else{const M=i(o);for(let a=M.length-1;a>=0;a--){const u=M[a],N=u==null?void 0:u.filename,l=e[o];if(N&&l){s[N]=l,Ys[o]=[N,l];break}}}return s},{})),Qs}function Hu(i,e,t,s,o,r){const{normalizeDepth:M=3,normalizeMaxBreadth:a=1e3}=i,u={...e,event_id:e.event_id||t.event_id||fe(),timestamp:e.timestamp||ps()},N=t.integrations||i.integrations.map(I=>I.name);Vu(u,i),Ku(u,N),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Zu(u,i.stackParser);const l=eN(s,t.captureContext);t.mechanism&&Zt(u,t.mechanism);const c=o?o.getEventProcessors():[],L=Fc().getScopeData();if(r){const I=r.getScopeData();Qr(L,I)}if(l){const I=l.getScopeData();Qr(L,I)}const j=[...t.attachments||[],...L.attachments];j.length&&(t.attachments=j),Pu(u,L);const T=[...c,...L.eventProcessors];return to(T,u,t).then(I=>(I&&Xu(I),typeof M=="number"&&M>0?qu(I,M,a):I))}function Vu(i,e){const{environment:t,release:s,dist:o,maxValueLength:r=250}=e;i.environment=i.environment||t||Ro,!i.release&&s&&(i.release=s),!i.dist&&o&&(i.dist=o);const M=i.request;M!=null&&M.url&&(M.url=si(M.url,r))}function Zu(i,e){var s,o;const t=Gu(e);(o=(s=i.exception)==null?void 0:s.values)==null||o.forEach(r=>{var M,a;(a=(M=r.stacktrace)==null?void 0:M.frames)==null||a.forEach(u=>{u.filename&&(u.debug_id=t[u.filename])})})}function Xu(i){var s,o;const e={};if((o=(s=i.exception)==null?void 0:s.values)==null||o.forEach(r=>{var M,a;(a=(M=r.stacktrace)==null?void 0:M.frames)==null||a.forEach(u=>{u.debug_id&&(u.abs_path?e[u.abs_path]=u.debug_id:u.filename&&(e[u.filename]=u.debug_id),delete u.debug_id)})}),Object.keys(e).length===0)return;i.debug_meta=i.debug_meta||{},i.debug_meta.images=i.debug_meta.images||[];const t=i.debug_meta.images;Object.entries(e).forEach(([r,M])=>{t.push({type:"sourcemap",code_file:r,debug_id:M})})}function Ku(i,e){e.length>0&&(i.sdk=i.sdk||{},i.sdk.integrations=[...i.sdk.integrations||[],...e])}function qu(i,e,t){var o,r;if(!i)return null;const s={...i,...i.breadcrumbs&&{breadcrumbs:i.breadcrumbs.map(M=>({...M,...M.data&&{data:qe(M.data,e,t)}}))},...i.user&&{user:qe(i.user,e,t)},...i.contexts&&{contexts:qe(i.contexts,e,t)},...i.extra&&{extra:qe(i.extra,e,t)}};return(o=i.contexts)!=null&&o.trace&&s.contexts&&(s.contexts.trace=i.contexts.trace,i.contexts.trace.data&&(s.contexts.trace.data=qe(i.contexts.trace.data,e,t))),i.spans&&(s.spans=i.spans.map(M=>({...M,...M.data&&{data:qe(M.data,e,t)}}))),(r=i.contexts)!=null&&r.flags&&s.contexts&&(s.contexts.flags=qe(i.contexts.flags,3,t)),s}function eN(i,e){if(!e)return i;const t=i?i.clone():new it;return t.update(e),t}function tN(i,e){return ot().captureException(i,void 0)}function Yn(i,e){return ot().captureEvent(i,e)}function vr(i){const e=Os(),t=ot(),{userAgent:s}=te.navigator||{},o=Qc({user:t.getUser()||e.getUser(),...s&&{userAgent:s},...i}),r=e.getSession();return(r==null?void 0:r.status)==="ok"&&Xt(r,{status:"exited"}),Qn(),e.setSession(o),o}function Qn(){const i=Os(),t=ot().getSession()||i.getSession();t&&Uc(t),Un(),i.setSession()}function Un(){const i=Os(),e=we(),t=i.getSession();t&&e&&e.captureSession(t)}function br(i=!1){if(i){Qn();return}Un()}const sN="7";function iN(i){const e=i.protocol?`${i.protocol}:`:"",t=i.port?`:${i.port}`:"";return`${e}//${i.host}${t}${i.path?`/${i.path}`:""}/api/`}function oN(i){return`${iN(i)}${i.projectId}/envelope/`}function rN(i,e){const t={sentry_version:sN};return i.publicKey&&(t.sentry_key=i.publicKey),e&&(t.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(t).toString()}function MN(i,e,t){return e||`${oN(i)}?${rN(i,t)}`}const $r=[];function nN(i){const e={};return i.forEach(t=>{const{name:s}=t,o=e[s];o&&!o.isDefaultInstance&&t.isDefaultInstance||(e[s]=t)}),Object.values(e)}function aN(i){const e=i.defaultIntegrations||[],t=i.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let s;if(Array.isArray(t))s=[...e,...t];else if(typeof t=="function"){const o=t(e);s=Array.isArray(o)?o:[o]}else s=e;return nN(s)}function cN(i,e){const t={};return e.forEach(s=>{s&&vn(i,s,t)}),t}function Pr(i,e){for(const t of e)t!=null&&t.afterAllSetup&&t.afterAllSetup(i)}function vn(i,e,t){if(t[e.name]){Z&&B.log(`Integration skipped because it was already installed: ${e.name}`);return}if(t[e.name]=e,$r.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),$r.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(i),typeof e.preprocessEvent=="function"){const s=e.preprocessEvent.bind(e);i.on("preprocessEvent",(o,r)=>s(o,r,i))}if(typeof e.processEvent=="function"){const s=e.processEvent.bind(e),o=Object.assign((r,M)=>s(r,M,i),{id:e.name});i.addEventProcessor(o)}Z&&B.log(`Integration installed: ${e.name}`)}function uN(i,e,t){const s=[{type:"client_report"},{timestamp:ps(),discarded_events:i}];return Es(e?{dsn:e}:{},[s])}function bn(i){const e=[];i.message&&e.push(i.message);try{const t=i.exception.values[i.exception.values.length-1];t!=null&&t.value&&(e.push(t.value),t.type&&e.push(`${t.type}: ${t.value}`))}catch{}return e}function NN(i){var u;const{trace_id:e,parent_span_id:t,span_id:s,status:o,origin:r,data:M,op:a}=((u=i.contexts)==null?void 0:u.trace)??{};return{data:M??{},description:i.transaction,op:a,parent_span_id:t,span_id:s??"",start_timestamp:i.start_timestamp??0,status:o,timestamp:i.timestamp,trace_id:e??"",origin:r,profile_id:M==null?void 0:M[pn],exclusive_time:M==null?void 0:M[mn],measurements:i.measurements,is_segment:!0}}function lN(i){return{type:"transaction",timestamp:i.timestamp,start_timestamp:i.start_timestamp,transaction:i.description,contexts:{trace:{trace_id:i.trace_id,span_id:i.span_id,parent_span_id:i.parent_span_id,op:i.op,status:i.status,origin:i.origin,data:{...i.data,...i.profile_id&&{[pn]:i.profile_id},...i.exclusive_time&&{[mn]:i.exclusive_time}}}},measurements:i.measurements}}const Wr="Not capturing exception because it's already been captured.",Rr="Discarded session because of missing or non-string release",$n=Symbol.for("SentryInternalError"),Pn=Symbol.for("SentryDoNotSendEventError");function Zs(i){return{message:i,[$n]:!0}}function Ei(i){return{message:i,[Pn]:!0}}function Jr(i){return!!i&&typeof i=="object"&&$n in i}function Br(i){return!!i&&typeof i=="object"&&Pn in i}class LN{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Cu(e.dsn):Z&&B.warn("No DSN provided, client will not send events."),this._dsn){const t=MN(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,s){const o=fe();if(hr(e))return Z&&B.log(Wr),o;const r={event_id:o,...t};return this._process(this.eventFromException(e,r).then(M=>this._captureEvent(M,r,s))),r.event_id}captureMessage(e,t,s,o){const r={event_id:fe(),...s},M=Qo(e)?e:String(e),a=Uo(e)?this.eventFromMessage(M,t,r):this.eventFromException(e,r);return this._process(a.then(u=>this._captureEvent(u,r,o))),r.event_id}captureEvent(e,t,s){const o=fe();if(t!=null&&t.originalException&&hr(t.originalException))return Z&&B.log(Wr),o;const r={event_id:o,...t},M=e.sdkProcessingMetadata||{},a=M.capturedSpanScope,u=M.capturedSpanIsolationScope;return this._process(this._captureEvent(e,r,a||s,u)),r.event_id}captureSession(e){this.sendSession(e),Xt(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then(s=>t.flush(e).then(o=>s&&o))):St(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,this.emit("close"),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];vn(this,e,this._integrations),t||Pr(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let s=$u(e,this._dsn,this._options._metadata,this._options.tunnel);for(const r of t.attachments||[])s=xu(s,Yu(r));const o=this.sendEnvelope(s);o&&o.then(r=>this.emit("afterSendEvent",e,r),null)}sendSession(e){const{release:t,environment:s=Ro}=this._options;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t){Z&&B.warn(Rr);return}r.release=r.release||t,r.environment=r.environment||s,e.attrs=r}else{if(!e.release&&!t){Z&&B.warn(Rr);return}e.release=e.release||t,e.environment=e.environment||s}this.emit("beforeSendSession",e);const o=bu(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,t,s=1){if(this._options.sendClientReports){const o=`${e}:${t}`;Z&&B.log(`Recording outcome: "${o}"${s>1?` (${s} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+s}}on(e,t){const s=this._hooks[e]=this._hooks[e]||[];return s.push(t),()=>{const o=s.indexOf(t);o>-1&&s.splice(o,1)}}emit(e,...t){const s=this._hooks[e];s&&s.forEach(o=>o(...t))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,t=>(Z&&B.error("Error while sending envelope:",t),t)):(Z&&B.error("Transport disabled"),St({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=cN(this,e),Pr(this,e)}_updateSessionFromEvent(e,t){var u;let s=t.level==="fatal",o=!1;const r=(u=t.exception)==null?void 0:u.values;if(r){o=!0;for(const N of r){const l=N.mechanism;if((l==null?void 0:l.handled)===!1){s=!0;break}}}const M=e.status==="ok";(M&&e.errors===0||M&&s)&&(Xt(e,{...s&&{status:"crashed"},errors:e.errors||Number(o||s)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Dt(t=>{let s=0;const o=1,r=setInterval(()=>{this._numProcessing==0?(clearInterval(r),t(!0)):(s+=o,e&&s>=e&&(clearInterval(r),t(!1)))},o)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,s,o){const r=this.getOptions(),M=Object.keys(this._integrations);return!t.integrations&&(M!=null&&M.length)&&(t.integrations=M),this.emit("preprocessEvent",e,t),e.type||o.setLastEventId(e.event_id||t.event_id),Hu(r,e,t,s,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,t),a.contexts={trace:Hc(s),...a.contexts};const u=Au(this,s);return a.sdkProcessingMetadata={dynamicSamplingContext:u,...a.sdkProcessingMetadata},a})}_captureEvent(e,t={},s=ot(),o=Os()){return Z&&so(e)&&B.log(`Captured error event \`${bn(e)[0]||"<unknown>"}\``),this._processEvent(e,t,s,o).then(r=>r.event_id,r=>{Z&&(Br(r)?B.log(r.message):Jr(r)?B.warn(r.message):B.warn(r))})}_processEvent(e,t,s,o){const r=this.getOptions(),{sampleRate:M}=r,a=Wn(e),u=so(e),N=e.type||"error",l=`before send for type \`${N}\``,c=typeof M>"u"?void 0:au(M);if(u&&typeof c=="number"&&Math.random()>c)return this.recordDroppedEvent("sample_rate","error"),ii(Ei(`Discarding event because it's not included in the random sample (sampling rate = ${M})`));const L=N==="replay_event"?"replay":N;return this._prepareEvent(e,t,s,o).then(j=>{if(j===null)throw this.recordDroppedEvent("event_processor",L),Ei("An event processor returned `null`, will not send event.");if(t.data&&t.data.__sentry__===!0)return j;const D=gN(this,r,j,t);return jN(D,l)}).then(j=>{var I;if(j===null){if(this.recordDroppedEvent("before_send",L),a){const E=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",E)}throw Ei(`${l} returned \`null\`, will not send event.`)}const T=s.getSession()||o.getSession();if(u&&T&&this._updateSessionFromEvent(T,j),a){const C=((I=j.sdkProcessingMetadata)==null?void 0:I.spanCountBeforeProcessing)||0,E=j.spans?j.spans.length:0,A=C-E;A>0&&this.recordDroppedEvent("before_send","span",A)}const D=j.transaction_info;if(a&&D&&j.transaction!==e.transaction){const C="custom";j.transaction_info={...D,source:C}}return this.sendEvent(j,t),j}).then(null,j=>{throw Br(j)||Jr(j)?j:(this.captureException(j,{data:{__sentry__:!0},originalException:j}),Zs(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
8
+ Reason: ${j}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,s])=>{const[o,r]=t.split(":");return{reason:o,category:r,quantity:s}})}_flushOutcomes(){Z&&B.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){Z&&B.log("No outcomes to send");return}if(!this._dsn){Z&&B.log("No dsn provided, will not send outcomes");return}Z&&B.log("Sending outcomes:",e);const t=uN(e,this._options.tunnel&&yi(this._dsn));this.sendEnvelope(t)}}function jN(i,e){const t=`${e} must return \`null\` or a valid event.`;if(gi(i))return i.then(s=>{if(!ds(s)&&s!==null)throw Zs(t);return s},s=>{throw Zs(`${e} rejected with ${s}`)});if(!ds(i)&&i!==null)throw Zs(t);return i}function gN(i,e,t,s){const{beforeSend:o,beforeSendTransaction:r,beforeSendSpan:M}=e;let a=t;if(so(a)&&o)return o(a,s);if(Wn(a)){if(M){const u=M(NN(a));if(u?a=ms(t,lN(u)):fr(),a.spans){const N=[];for(const l of a.spans){const c=M(l);c?N.push(c):(fr(),N.push(l))}a.spans=N}}if(r){if(a.spans){const u=a.spans.length;a.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return r(a,s)}}return a}function so(i){return i.type===void 0}function Wn(i){return i.type==="transaction"}function TN(i){return[{type:"log",item_count:i.length,content_type:"application/vnd.sentry.items.log+json"},{items:i}]}function yN(i,e,t,s){const o={};return e!=null&&e.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),t&&s&&(o.dsn=yi(s)),Es(o,[TN(i)])}te._sentryClientToLogBufferMap=new WeakMap;function _i(i,e){var r;const t=DN(i)??[];if(t.length===0)return;const s=i.getOptions(),o=yN(t,s._metadata,s.tunnel,i.getDsn());(r=te._sentryClientToLogBufferMap)==null||r.set(i,[]),i.emit("flushLogs"),i.sendEnvelope(o)}function DN(i){var e;return(e=te._sentryClientToLogBufferMap)==null?void 0:e.get(i)}function dN(i,e){e.debug===!0&&(Z?B.enable():es(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),ot().update(e.initialScope);const s=new i(e);return zN(s),s.init(),s}function zN(i){ot().setClient(i)}const Rn=Symbol.for("SentryBufferFullError");function IN(i){const e=[];function t(){return i===void 0||e.length<i}function s(M){return e.splice(e.indexOf(M),1)[0]||Promise.resolve(void 0)}function o(M){if(!t())return ii(Rn);const a=M();return e.indexOf(a)===-1&&e.push(a),a.then(()=>s(a)).then(null,()=>s(a).then(null,()=>{})),a}function r(M){return new Dt((a,u)=>{let N=e.length;if(!N)return a(!0);const l=setTimeout(()=>{M&&M>0&&a(!1)},M);e.forEach(c=>{St(c).then(()=>{--N||(clearTimeout(l),a(!0))},u)})})}return{$:e,add:o,drain:r}}const wN=60*1e3;function CN(i,e=Date.now()){const t=parseInt(`${i}`,10);if(!isNaN(t))return t*1e3;const s=Date.parse(`${i}`);return isNaN(s)?wN:s-e}function hN(i,e){return i[e]||i.all||0}function AN(i,e,t=Date.now()){return hN(i,e)>t}function pN(i,{statusCode:e,headers:t},s=Date.now()){const o={...i},r=t==null?void 0:t["x-sentry-rate-limits"],M=t==null?void 0:t["retry-after"];if(r)for(const a of r.trim().split(",")){const[u,N,,,l]=a.split(":",5),c=parseInt(u,10),L=(isNaN(c)?60:c)*1e3;if(!N)o.all=s+L;else for(const j of N.split(";"))j==="metric_bucket"?(!l||l.split(";").includes("custom"))&&(o[j]=s+L):o[j]=s+L}else M?o.all=s+CN(M,s):e===429&&(o.all=s+60*1e3);return o}const mN=64;function ON(i,e,t=IN(i.bufferSize||mN)){let s={};const o=M=>t.drain(M);function r(M){const a=[];if(kr(M,(c,L)=>{const j=Yr(L);AN(s,j)?i.recordDroppedEvent("ratelimit_backoff",j):a.push(c)}),a.length===0)return St({});const u=Es(M[0],a),N=c=>{kr(u,(L,j)=>{i.recordDroppedEvent(c,Yr(j))})},l=()=>e({body:fu(u)}).then(c=>(c.statusCode!==void 0&&(c.statusCode<200||c.statusCode>=300)&&Z&&B.warn(`Sentry responded with status code ${c.statusCode} to sent event.`),s=pN(s,c),c),c=>{throw N("network_error"),Z&&B.error("Encountered error running transport request:",c),c});return t.add(l).then(c=>c,c=>{if(c===Rn)return Z&&B.error("Skipped sending event because buffer is full."),N("queue_overflow"),St({});throw c})}return{send:r,flush:o}}function EN(i){var e;((e=i.user)==null?void 0:e.ip_address)===void 0&&(i.user={...i.user,ip_address:"{{auto}}"})}function _N(i){var e;"aggregates"in i?((e=i.attrs)==null?void 0:e.ip_address)===void 0&&(i.attrs={...i.attrs,ip_address:"{{auto}}"}):i.ipAddress===void 0&&(i.ipAddress="{{auto}}")}function SN(i,e,t=[e],s="npm"){const o=i._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${e}`,packages:t.map(r=>({name:`${s}:@sentry/${r}`,version:Ot})),version:Ot}),i._metadata=o}const xN=100;function xt(i,e){const t=we(),s=Os();if(!t)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:r=xN}=t.getOptions();if(r<=0)return;const a={timestamp:ps(),...i},u=o?es(()=>o(a,e)):a;u!==null&&(t.emit&&t.emit("beforeAddBreadcrumb",u,e),s.addBreadcrumb(u,r))}let Fr;const fN="FunctionToString",Gr=new WeakMap,kN=()=>({name:fN,setupOnce(){Fr=Function.prototype.toString;try{Function.prototype.toString=function(...i){const e=$o(this),t=Gr.has(we())&&e!==void 0?e:this;return Fr.apply(t,i)}}catch{}},setup(i){Gr.set(i,!0)}}),YN=kN,QN=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],UN="EventFilters",vN=(i={})=>{let e;return{name:UN,setup(t){const s=t.getOptions();e=Hr(i,s)},processEvent(t,s,o){if(!e){const r=o.getOptions();e=Hr(i,r)}return $N(t,e)?null:t}}},bN=(i={})=>({...vN(i),name:"InboundFilters"});function Hr(i={},e={}){return{allowUrls:[...i.allowUrls||[],...e.allowUrls||[]],denyUrls:[...i.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...i.ignoreErrors||[],...e.ignoreErrors||[],...i.disableErrorDefaults?[]:QN],ignoreTransactions:[...i.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function $N(i,e){if(i.type){if(i.type==="transaction"&&WN(i,e.ignoreTransactions))return Z&&B.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
9
9
  Event: ${pt(i)}`),!0}else{if(PN(i,e.ignoreErrors))return Z&&B.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
10
10
  Event: ${pt(i)}`),!0;if(FN(i))return Z&&B.warn(`Event dropped due to not having an error message, error type or stacktrace.
11
11
  Event: ${pt(i)}`),!0;if(RN(i,e.denyUrls))return Z&&B.warn(`Event dropped due to being matched by \`denyUrls\` option.
12
12
  Event: ${pt(i)}.
13
13
  Url: ${oi(i)}`),!0;if(!JN(i,e.allowUrls))return Z&&B.warn(`Event dropped due to not being matched by \`allowUrls\` option.
14
14
  Event: ${pt(i)}.
15
- Url: ${oi(i)}`),!0}return!1}function PN(i,e){return e!=null&&e.length?bn(i).some(t=>Ti(t,e)):!1}function WN(i,e){if(!(e!=null&&e.length))return!1;const t=i.transaction;return t?Ti(t,e):!1}function RN(i,e){if(!(e!=null&&e.length))return!1;const t=oi(i);return t?Ti(t,e):!1}function JN(i,e){if(!(e!=null&&e.length))return!0;const t=oi(i);return t?Ti(t,e):!0}function BN(i=[]){for(let e=i.length-1;e>=0;e--){const t=i[e];if(t&&t.filename!=="<anonymous>"&&t.filename!=="[native code]")return t.filename||null}return null}function oi(i){var e,t;try{const s=[...((e=i.exception)==null?void 0:e.values)??[]].reverse().find(r=>{var M,a,u;return((M=r.mechanism)==null?void 0:M.parent_id)===void 0&&((u=(a=r.stacktrace)==null?void 0:a.frames)==null?void 0:u.length)}),o=(t=s==null?void 0:s.stacktrace)==null?void 0:t.frames;return o?BN(o):null}catch{return Z&&B.error(`Cannot extract url for event ${pt(i)}`),null}}function FN(i){var e,t;return(t=(e=i.exception)==null?void 0:e.values)!=null&&t.length?!i.message&&!i.exception.values.some(s=>s.stacktrace||s.type&&s.type!=="Error"||s.value):!1}function GN(i,e,t,s,o,r){var a;if(!((a=o.exception)!=null&&a.values)||!r||!Tt(r.originalException,Error))return;const M=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;M&&(o.exception.values=io(i,e,s,r.originalException,t,o.exception.values,M,0))}function io(i,e,t,s,o,r,M,a){if(r.length>=t+1)return r;let u=[...r];if(Tt(s[o],Error)){Vr(M,a);const N=i(e,s[o]),l=u.length;Zr(N,o,l,a),u=io(i,e,t,s[o],o,[N,...u],N,l)}return Array.isArray(s.errors)&&s.errors.forEach((N,l)=>{if(Tt(N,Error)){Vr(M,a);const c=i(e,N),L=u.length;Zr(c,`errors[${l}]`,L,a),u=io(i,e,t,N,o,[c,...u],c,L)}}),u}function Vr(i,e){i.mechanism=i.mechanism||{type:"generic",handled:!0},i.mechanism={...i.mechanism,...i.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Zr(i,e,t,s){i.mechanism=i.mechanism||{type:"generic",handled:!0},i.mechanism={...i.mechanism,type:"chained",source:e,exception_id:t,parent_id:s}}function HN(i){const e="console";kt(e,i),Yt(e,VN)}function VN(){"console"in te&&Zi.forEach(function(i){i in te.console&&Ee(te.console,i,function(e){return ti[i]=e,function(...t){ve("console",{args:t,level:i});const o=ti[i];o==null||o.apply(te.console,t)}})})}function ZN(i){return i==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(i)?i:"log"}const XN="Dedupe",KN=()=>{let i;return{name:XN,processEvent(e){if(e.type)return e;try{if(qN(e,i))return Z&&B.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return i=e}}},Jn=KN;function qN(i,e){return e?!!(el(i,e)||tl(i,e)):!1}function el(i,e){const t=i.message,s=e.message;return!(!t&&!s||t&&!s||!t&&s||t!==s||!Fn(i,e)||!Bn(i,e))}function tl(i,e){const t=Xr(e),s=Xr(i);return!(!t||!s||t.type!==s.type||t.value!==s.value||!Fn(i,e)||!Bn(i,e))}function Bn(i,e){let t=xr(i),s=xr(e);if(!t&&!s)return!0;if(t&&!s||!t&&s||(t=t,s=s,s.length!==t.length))return!1;for(let o=0;o<s.length;o++){const r=s[o],M=t[o];if(r.filename!==M.filename||r.lineno!==M.lineno||r.colno!==M.colno||r.function!==M.function)return!1}return!0}function Fn(i,e){let t=i.fingerprint,s=e.fingerprint;if(!t&&!s)return!0;if(t&&!s||!t&&s)return!1;t=t,s=s;try{return t.join("")===s.join("")}catch{return!1}}function Xr(i){var e;return((e=i.exception)==null?void 0:e.values)&&i.exception.values[0]}function Si(i){if(!i)return{};const e=i.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const t=e[6]||"",s=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:t,hash:s,relative:e[5]+t+s}}function Gn(i){if(i!==void 0)return i>=400&&i<500?"warning":i>=500?"error":void 0}const zs=te;function sl(){return"history"in zs&&!!zs.history}function il(){if(!("fetch"in zs))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function oo(i){return i&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(i.toString())}function ol(){var t;if(typeof EdgeRuntime=="string")return!0;if(!il())return!1;if(oo(zs.fetch))return!0;let i=!1;const e=zs.document;if(e&&typeof e.createElement=="function")try{const s=e.createElement("iframe");s.hidden=!0,e.head.appendChild(s),(t=s.contentWindow)!=null&&t.fetch&&(i=oo(s.contentWindow.fetch)),e.head.removeChild(s)}catch(s){Z&&B.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",s)}return i}function rl(i,e){const t="fetch";kt(t,i),Yt(t,()=>Ml(void 0,e))}function Ml(i,e=!1){e&&!ol()||Ee(te,"fetch",function(t){return function(...s){const o=new Error,{method:r,url:M}=nl(s),a={args:s,fetchData:{method:r,url:M},startTimestamp:st()*1e3,virtualError:o,headers:al(s)};return ve("fetch",{...a}),t.apply(te,s).then(async u=>(ve("fetch",{...a,endTimestamp:st()*1e3,response:u}),u),u=>{if(ve("fetch",{...a,endTimestamp:st()*1e3,error:u}),Yo(u)&&u.stack===void 0&&(u.stack=o.stack,Et(u,"framesToPop",1)),u instanceof TypeError&&(u.message==="Failed to fetch"||u.message==="Load failed"||u.message==="NetworkError when attempting to fetch resource."))try{const N=new URL(a.fetchData.url);u.message=`${u.message} (${N.host})`}catch{}throw u})}})}function ro(i,e){return!!i&&typeof i=="object"&&!!i[e]}function Kr(i){return typeof i=="string"?i:i?ro(i,"url")?i.url:i.toString?i.toString():"":""}function nl(i){if(i.length===0)return{method:"GET",url:""};if(i.length===2){const[t,s]=i;return{url:Kr(t),method:ro(s,"method")?String(s.method).toUpperCase():"GET"}}const e=i[0];return{url:Kr(e),method:ro(e,"method")?String(e.method).toUpperCase():"GET"}}function al(i){const[e,t]=i;try{if(typeof t=="object"&&t!==null&&"headers"in t&&t.headers)return new Headers(t.headers);if(dc(e))return new Headers(e.headers)}catch{}}function cl(){return"npm"}const Me=te;let Mo=0;function Hn(){return Mo>0}function ul(){Mo++,setTimeout(()=>{Mo--})}function qt(i,e={}){function t(o){return typeof o=="function"}if(!t(i))return i;try{const o=i.__sentry_wrapped__;if(o)return typeof o=="function"?o:i;if($o(i))return i}catch{return i}const s=function(...o){try{const r=o.map(M=>qt(M,e));return i.apply(this,r)}catch(r){throw ul(),Pc(M=>{M.addEventProcessor(a=>(e.mechanism&&(Xi(a,void 0),Zt(a,e.mechanism)),a.extra={...a.extra,arguments:o},a)),tN(r)}),r}};try{for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&(s[o]=i[o])}catch{}dn(s,i),Et(i,"__sentry_wrapped__",s);try{Object.getOwnPropertyDescriptor(s,"name").configurable&&Object.defineProperty(s,"name",{get(){return i.name}})}catch{}return s}function Nl(){const i=bo(),{referrer:e}=Me.document||{},{userAgent:t}=Me.navigator||{},s={...e&&{Referer:e},...t&&{"User-Agent":t}};return{url:i,headers:s}}function Jo(i,e){const t=Bo(i,e),s={type:Tl(e),value:yl(e)};return t.length&&(s.stacktrace={frames:t}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function ll(i,e,t,s){const o=we(),r=o==null?void 0:o.getOptions().normalizeDepth,M=wl(e),a={__serialized__:fn(e,r)};if(M)return{exception:{values:[Jo(i,M)]},extra:a};const u={exception:{values:[{type:ji(e)?e.constructor.name:s?"UnhandledRejection":"Error",value:zl(e,{isUnhandledRejection:s})}]},extra:a};if(t){const N=Bo(i,t);N.length&&(u.exception.values[0].stacktrace={frames:N})}return u}function xi(i,e){return{exception:{values:[Jo(i,e)]}}}function Bo(i,e){const t=e.stacktrace||e.stack||"",s=jl(e),o=gl(e);try{return i(t,s,o)}catch{}return[]}const Ll=/Minified React error #\d+;/i;function jl(i){return i&&Ll.test(i.message)?1:0}function gl(i){return typeof i.framesToPop=="number"?i.framesToPop:0}function Vn(i){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?i instanceof WebAssembly.Exception:!1}function Tl(i){const e=i==null?void 0:i.name;return!e&&Vn(i)?i.message&&Array.isArray(i.message)&&i.message.length==2?i.message[0]:"WebAssembly.Exception":e}function yl(i){const e=i==null?void 0:i.message;return Vn(i)?Array.isArray(i.message)&&i.message.length==2?i.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Dl(i,e,t,s){const o=(t==null?void 0:t.syntheticException)||void 0,r=Fo(i,e,o,s);return Zt(r),r.level="error",t!=null&&t.event_id&&(r.event_id=t.event_id),St(r)}function dl(i,e,t="info",s,o){const r=(s==null?void 0:s.syntheticException)||void 0,M=no(i,e,r,o);return M.level=t,s!=null&&s.event_id&&(M.event_id=s.event_id),St(M)}function Fo(i,e,t,s,o){let r;if(Tn(e)&&e.error)return xi(i,e.error);if(Tr(e)||gc(e)){const M=e;if("stack"in e)r=xi(i,e);else{const a=M.name||(Tr(M)?"DOMError":"DOMException"),u=M.message?`${a}: ${M.message}`:a;r=no(i,u,t,s),Xi(r,u)}return"code"in M&&(r.tags={...r.tags,"DOMException.code":`${M.code}`}),r}return Yo(e)?xi(i,e):ds(e)||ji(e)?(r=ll(i,e,t,o),Zt(r,{synthetic:!0}),r):(r=no(i,e,t,s),Xi(r,`${e}`),Zt(r,{synthetic:!0}),r)}function no(i,e,t,s){const o={};if(s&&t){const r=Bo(i,t);r.length&&(o.exception={values:[{value:e,stacktrace:{frames:r}}]}),Zt(o,{synthetic:!0})}if(Qo(e)){const{__sentry_template_string__:r,__sentry_template_values__:M}=e;return o.logentry={message:r,params:M},o}return o.message=e,o}function zl(i,{isUnhandledRejection:e}){const t=pc(i),s=e?"promise rejection":"exception";return Tn(i)?`Event \`ErrorEvent\` captured as ${s} with message \`${i.message}\``:ji(i)?`Event \`${Il(i)}\` (type=${i.type}) captured as ${s}`:`Object captured as ${s} with keys: ${t}`}function Il(i){try{const e=Object.getPrototypeOf(i);return e?e.constructor.name:void 0}catch{}}function wl(i){for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const t=i[e];if(t instanceof Error)return t}}const Cl=5e3;class hl extends LN{constructor(e){const t=Al(e),s=Me.SENTRY_SDK_SOURCE||cl();SN(t,"browser",["browser"],s),super(t);const{sendDefaultPii:o,sendClientReports:r,_experiments:M}=this._options,a=M==null?void 0:M.enableLogs;Me.document&&(r||a)&&Me.document.addEventListener("visibilitychange",()=>{Me.document.visibilityState==="hidden"&&(r&&this._flushOutcomes(),a&&_i(this))}),a&&(this.on("flush",()=>{_i(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{_i(this)},Cl)})),o&&(this.on("postprocessEvent",EN),this.on("beforeSendSession",_N))}eventFromException(e,t){return Dl(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",s){return dl(this._options.stackParser,e,t,s,this._options.attachStacktrace)}_prepareEvent(e,t,s,o){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,s,o)}}function Al(i){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=Me.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...i}}const pl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ze=te,ml=1e3;let qr,ao,co;function Ol(i){const e="dom";kt(e,i),Yt(e,El)}function El(){if(!ze.document)return;const i=ve.bind(null,"dom"),e=eM(i,!0);ze.document.addEventListener("click",e,!1),ze.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(t=>{var r,M;const o=(r=ze[t])==null?void 0:r.prototype;(M=o==null?void 0:o.hasOwnProperty)!=null&&M.call(o,"addEventListener")&&(Ee(o,"addEventListener",function(a){return function(u,N,l){if(u==="click"||u=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},L=c[u]=c[u]||{refCount:0};if(!L.handler){const j=eM(i);L.handler=j,a.call(this,u,j,l)}L.refCount++}catch{}return a.call(this,u,N,l)}}),Ee(o,"removeEventListener",function(a){return function(u,N,l){if(u==="click"||u=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},L=c[u];L&&(L.refCount--,L.refCount<=0&&(a.call(this,u,L.handler,l),L.handler=void 0,delete c[u]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,u,N,l)}}))})}function _l(i){if(i.type!==ao)return!1;try{if(!i.target||i.target._sentryId!==co)return!1}catch{}return!0}function Sl(i,e){return i!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function eM(i,e=!1){return t=>{if(!t||t._sentryCaptured)return;const s=xl(t);if(Sl(t.type,s))return;Et(t,"_sentryCaptured",!0),s&&!s._sentryId&&Et(s,"_sentryId",fe());const o=t.type==="keypress"?"input":t.type;_l(t)||(i({event:t,name:o,global:e}),ao=t.type,co=s?s._sentryId:void 0),clearTimeout(qr),qr=ze.setTimeout(()=>{co=void 0,ao=void 0},ml)}}function xl(i){try{return i.target}catch{return null}}let Us;function Zn(i){const e="history";kt(e,i),Yt(e,fl)}function fl(){if(ze.addEventListener("popstate",()=>{const e=ze.location.href,t=Us;if(Us=e,t===e)return;ve("history",{from:t,to:e})}),!sl())return;function i(e){return function(...t){const s=t.length>2?t[2]:void 0;if(s){const o=Us,r=kl(String(s));if(Us=r,o===r)return e.apply(this,t);ve("history",{from:o,to:r})}return e.apply(this,t)}}Ee(ze.history,"pushState",i),Ee(ze.history,"replaceState",i)}function kl(i){try{return new URL(i,ze.location.origin).toString()}catch{return i}}const Xs={};function Yl(i){const e=Xs[i];if(e)return e;let t=ze[i];if(oo(t))return Xs[i]=t.bind(ze);const s=ze.document;if(s&&typeof s.createElement=="function")try{const o=s.createElement("iframe");o.hidden=!0,s.head.appendChild(o);const r=o.contentWindow;r!=null&&r[i]&&(t=r[i]),s.head.removeChild(o)}catch(o){pl&&B.warn(`Could not create sandbox iframe for ${i} check, bailing to window.${i}: `,o)}return t&&(Xs[i]=t.bind(ze))}function tM(i){Xs[i]=void 0}const ls="__sentry_xhr_v3__";function Ql(i){const e="xhr";kt(e,i),Yt(e,Ul)}function Ul(){if(!ze.XMLHttpRequest)return;const i=XMLHttpRequest.prototype;i.open=new Proxy(i.open,{apply(e,t,s){const o=new Error,r=st()*1e3,M=tt(s[0])?s[0].toUpperCase():void 0,a=vl(s[1]);if(!M||!a)return e.apply(t,s);t[ls]={method:M,url:a,request_headers:{}},M==="POST"&&a.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const u=()=>{const N=t[ls];if(N&&t.readyState===4){try{N.status_code=t.status}catch{}const l={endTimestamp:st()*1e3,startTimestamp:r,xhr:t,virtualError:o};ve("xhr",l)}};return"onreadystatechange"in t&&typeof t.onreadystatechange=="function"?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(N,l,c){return u(),N.apply(l,c)}}):t.addEventListener("readystatechange",u),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(N,l,c){const[L,j]=c,T=l[ls];return T&&tt(L)&&tt(j)&&(T.request_headers[L.toLowerCase()]=j),N.apply(l,c)}}),e.apply(t,s)}}),i.send=new Proxy(i.send,{apply(e,t,s){const o=t[ls];if(!o)return e.apply(t,s);s[0]!==void 0&&(o.body=s[0]);const r={startTimestamp:st()*1e3,xhr:t};return ve("xhr",r),e.apply(t,s)}})}function vl(i){if(tt(i))return i;try{return i.toString()}catch{}}function bl(i,e=Yl("fetch")){let t=0,s=0;function o(r){const M=r.body.length;t+=M,s++;const a={body:r.body,method:"POST",referrerPolicy:"strict-origin",headers:i.headers,keepalive:t<=6e4&&s<15,...i.fetchOptions};if(!e)return tM("fetch"),ii("No fetch implementation available");try{return e(i.url,a).then(u=>(t-=M,s--,{statusCode:u.status,headers:{"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")}}))}catch(u){return tM("fetch"),t-=M,s--,ii(u)}}return ON(i,o)}const $l=30,Pl=50;function uo(i,e,t,s){const o={filename:i,function:e==="<anonymous>"?_t:e,in_app:!0};return t!==void 0&&(o.lineno=t),s!==void 0&&(o.colno=s),o}const Wl=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Rl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Jl=/\((\S*)(?::(\d+))(?::(\d+))\)/,Bl=i=>{const e=Wl.exec(i);if(e){const[,s,o,r]=e;return uo(s,_t,+o,+r)}const t=Rl.exec(i);if(t){if(t[2]&&t[2].indexOf("eval")===0){const M=Jl.exec(t[2]);M&&(t[2]=M[1],t[3]=M[2],t[4]=M[3])}const[o,r]=Xn(t[1]||_t,t[2]);return uo(r,o,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},Fl=[$l,Bl],Gl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Hl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vl=i=>{const e=Gl.exec(i);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=Hl.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let s=e[3],o=e[1]||_t;return[o,s]=Xn(o,s),uo(s,o,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Zl=[Pl,Vl],Xl=[Fl,Zl],Kl=_n(...Xl),Xn=(i,e)=>{const t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:_t,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[i,e]},Di=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,vs=1024,ql="Breadcrumbs",e4=(i={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...i};return{name:ql,setup(t){e.console&&HN(o4(t)),e.dom&&Ol(i4(t,e.dom)),e.xhr&&Ql(r4(t)),e.fetch&&rl(M4(t)),e.history&&Zn(n4(t)),e.sentry&&t.on("beforeSendEvent",s4(t))}}},t4=e4;function s4(i){return function(t){we()===i&&xt({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:pt(t)},{event:t})}}function i4(i,e){return function(s){if(we()!==i)return;let o,r,M=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>vs&&(Di&&B.warn(`\`dom.maxStringLength\` cannot exceed ${vs}, but a value of ${a} was configured. Sentry will use ${vs} instead.`),a=vs),typeof M=="string"&&(M=[M]);try{const N=s.event,l=a4(N)?N.target:N;o=Dn(l,{keyAttrs:M,maxStringLength:a}),r=wc(l)}catch{o="<unknown>"}if(o.length===0)return;const u={category:`ui.${s.name}`,message:o};r&&(u.data={"ui.component_name":r}),xt(u,{event:s.event,name:s.name,global:s.global})}}function o4(i){return function(t){if(we()!==i)return;const s={category:"console",data:{arguments:t.args,logger:"console"},level:ZN(t.level),message:yr(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)s.message=`Assertion failed: ${yr(t.args.slice(1)," ")||"console.assert"}`,s.data.arguments=t.args.slice(1);else return;xt(s,{input:t.args,level:t.level})}}function r4(i){return function(t){if(we()!==i)return;const{startTimestamp:s,endTimestamp:o}=t,r=t.xhr[ls];if(!s||!o||!r)return;const{method:M,url:a,status_code:u,body:N}=r,l={method:M,url:a,status_code:u},c={xhr:t.xhr,input:N,startTimestamp:s,endTimestamp:o},L={category:"xhr",data:l,type:"http",level:Gn(u)};i.emit("beforeOutgoingRequestBreadcrumb",L,c),xt(L,c)}}function M4(i){return function(t){if(we()!==i)return;const{startTimestamp:s,endTimestamp:o}=t;if(o&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.fetchData.method,t.fetchData.url,t.error){const r=t.fetchData,M={data:t.error,input:t.args,startTimestamp:s,endTimestamp:o},a={category:"fetch",data:r,level:"error",type:"http"};i.emit("beforeOutgoingRequestBreadcrumb",a,M),xt(a,M)}else{const r=t.response,M={...t.fetchData,status_code:r==null?void 0:r.status};t.fetchData.request_body_size,t.fetchData.response_body_size,r==null||r.status;const a={input:t.args,response:r,startTimestamp:s,endTimestamp:o},u={category:"fetch",data:M,type:"http",level:Gn(M.status_code)};i.emit("beforeOutgoingRequestBreadcrumb",u,a),xt(u,a)}}}function n4(i){return function(t){if(we()!==i)return;let s=t.from,o=t.to;const r=Si(Me.location.href);let M=s?Si(s):void 0;const a=Si(o);M!=null&&M.path||(M=r),r.protocol===a.protocol&&r.host===a.host&&(o=a.relative),r.protocol===M.protocol&&r.host===M.host&&(s=M.relative),xt({category:"navigation",data:{from:s,to:o}})}}function a4(i){return!!i&&!!i.target}const c4=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],u4="BrowserApiErrors",N4=(i={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...i};return{name:u4,setupOnce(){e.setTimeout&&Ee(Me,"setTimeout",sM),e.setInterval&&Ee(Me,"setInterval",sM),e.requestAnimationFrame&&Ee(Me,"requestAnimationFrame",L4),e.XMLHttpRequest&&"XMLHttpRequest"in Me&&Ee(XMLHttpRequest.prototype,"send",j4);const t=e.eventTarget;t&&(Array.isArray(t)?t:c4).forEach(o=>g4(o,e))}}},l4=N4;function sM(i){return function(...e){const t=e[0];return e[0]=qt(t,{mechanism:{data:{function:yt(i)},handled:!1,type:"instrument"}}),i.apply(this,e)}}function L4(i){return function(e){return i.apply(this,[qt(e,{mechanism:{data:{function:"requestAnimationFrame",handler:yt(i)},handled:!1,type:"instrument"}})])}}function j4(i){return function(...e){const t=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in t&&typeof t[o]=="function"&&Ee(t,o,function(r){const M={mechanism:{data:{function:o,handler:yt(r)},handled:!1,type:"instrument"}},a=$o(r);return a&&(M.mechanism.data.handler=yt(a)),qt(r,M)})}),i.apply(this,e)}}function g4(i,e){var o,r;const s=(o=Me[i])==null?void 0:o.prototype;(r=s==null?void 0:s.hasOwnProperty)!=null&&r.call(s,"addEventListener")&&(Ee(s,"addEventListener",function(M){return function(a,u,N){try{T4(u)&&(u.handleEvent=qt(u.handleEvent,{mechanism:{data:{function:"handleEvent",handler:yt(u),target:i},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&y4(this,a,u),M.apply(this,[a,qt(u,{mechanism:{data:{function:"addEventListener",handler:yt(u),target:i},handled:!1,type:"instrument"}}),N])}}),Ee(s,"removeEventListener",function(M){return function(a,u,N){try{const l=u.__sentry_wrapped__;l&&M.call(this,a,l,N)}catch{}return M.call(this,a,u,N)}}))}function T4(i){return typeof i.handleEvent=="function"}function y4(i,e,t){i&&typeof i=="object"&&"removeEventListener"in i&&typeof i.removeEventListener=="function"&&i.removeEventListener(e,t)}const D4=()=>({name:"BrowserSession",setupOnce(){if(typeof Me.document>"u"){Di&&B.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}vr({ignoreDuration:!0}),br(),Zn(({from:i,to:e})=>{i!==void 0&&i!==e&&(vr({ignoreDuration:!0}),br())})}}),d4="GlobalHandlers",z4=(i={})=>{const e={onerror:!0,onunhandledrejection:!0,...i};return{name:d4,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(w4(t),iM("onerror")),e.onunhandledrejection&&(C4(t),iM("onunhandledrejection"))}}},I4=z4;function w4(i){lu(e=>{const{stackParser:t,attachStacktrace:s}=Kn();if(we()!==i||Hn())return;const{msg:o,url:r,line:M,column:a,error:u}=e,N=p4(Fo(t,u||o,void 0,s,!1),r,M,a);N.level="error",Yn(N,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function C4(i){ju(e=>{const{stackParser:t,attachStacktrace:s}=Kn();if(we()!==i||Hn())return;const o=h4(e),r=Uo(o)?A4(o):Fo(t,o,void 0,s,!0);r.level="error",Yn(r,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function h4(i){if(Uo(i))return i;try{if("reason"in i)return i.reason;if("detail"in i&&"reason"in i.detail)return i.detail.reason}catch{}return i}function A4(i){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}}function p4(i,e,t,s){const o=i.exception=i.exception||{},r=o.values=o.values||[],M=r[0]=r[0]||{},a=M.stacktrace=M.stacktrace||{},u=a.frames=a.frames||[],N=s,l=t,c=tt(e)&&e.length>0?e:bo();return u.length===0&&u.push({colno:N,filename:c,function:_t,in_app:!0,lineno:l}),i}function iM(i){Di&&B.log(`Global Handler attached: ${i}`)}function Kn(){const i=we();return(i==null?void 0:i.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const m4=()=>({name:"HttpContext",preprocessEvent(i){var s;if(!Me.navigator&&!Me.location&&!Me.document)return;const e=Nl(),t={...e.headers,...(s=i.request)==null?void 0:s.headers};i.request={...e,...i.request,headers:t}}}),O4="cause",E4=5,_4="LinkedErrors",S4=(i={})=>{const e=i.limit||E4,t=i.key||O4;return{name:_4,preprocessEvent(s,o,r){const M=r.getOptions();GN(Jo,M.stackParser,t,e,s,o)}}},x4=S4;function f4(){return k4()?(Di&&ts(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function k4(){var r;if(typeof Me.window>"u")return!1;const i=Me;if(i.nw)return!1;const e=i.chrome||i.browser;if(!((r=e==null?void 0:e.runtime)!=null&&r.id))return!1;const t=bo(),s=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Me===Me.top&&s.some(M=>t.startsWith(`${M}://`)))}function Y4(i){return[bN(),YN(),l4(),t4(),I4(),x4(),Jn(),m4(),D4()]}function Q4(i={}){const e=!i.skipBrowserExtensionCheck&&f4(),t={...i,enabled:e?!1:i.enabled,stackParser:uu(i.stackParser||Kl),integrations:aN({integrations:i.integrations,defaultIntegrations:i.defaultIntegrations==null?Y4():i.defaultIntegrations}),transport:i.transport||bl};return dN(hl,t)}function U4(){console.log(`
15
+ Url: ${oi(i)}`),!0}return!1}function PN(i,e){return e!=null&&e.length?bn(i).some(t=>Ti(t,e)):!1}function WN(i,e){if(!(e!=null&&e.length))return!1;const t=i.transaction;return t?Ti(t,e):!1}function RN(i,e){if(!(e!=null&&e.length))return!1;const t=oi(i);return t?Ti(t,e):!1}function JN(i,e){if(!(e!=null&&e.length))return!0;const t=oi(i);return t?Ti(t,e):!0}function BN(i=[]){for(let e=i.length-1;e>=0;e--){const t=i[e];if(t&&t.filename!=="<anonymous>"&&t.filename!=="[native code]")return t.filename||null}return null}function oi(i){var e,t;try{const s=[...((e=i.exception)==null?void 0:e.values)??[]].reverse().find(r=>{var M,a,u;return((M=r.mechanism)==null?void 0:M.parent_id)===void 0&&((u=(a=r.stacktrace)==null?void 0:a.frames)==null?void 0:u.length)}),o=(t=s==null?void 0:s.stacktrace)==null?void 0:t.frames;return o?BN(o):null}catch{return Z&&B.error(`Cannot extract url for event ${pt(i)}`),null}}function FN(i){var e,t;return(t=(e=i.exception)==null?void 0:e.values)!=null&&t.length?!i.message&&!i.exception.values.some(s=>s.stacktrace||s.type&&s.type!=="Error"||s.value):!1}function GN(i,e,t,s,o,r){var a;if(!((a=o.exception)!=null&&a.values)||!r||!yt(r.originalException,Error))return;const M=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;M&&(o.exception.values=io(i,e,s,r.originalException,t,o.exception.values,M,0))}function io(i,e,t,s,o,r,M,a){if(r.length>=t+1)return r;let u=[...r];if(yt(s[o],Error)){Vr(M,a);const N=i(e,s[o]),l=u.length;Zr(N,o,l,a),u=io(i,e,t,s[o],o,[N,...u],N,l)}return Array.isArray(s.errors)&&s.errors.forEach((N,l)=>{if(yt(N,Error)){Vr(M,a);const c=i(e,N),L=u.length;Zr(c,`errors[${l}]`,L,a),u=io(i,e,t,N,o,[c,...u],c,L)}}),u}function Vr(i,e){i.mechanism=i.mechanism||{type:"generic",handled:!0},i.mechanism={...i.mechanism,...i.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Zr(i,e,t,s){i.mechanism=i.mechanism||{type:"generic",handled:!0},i.mechanism={...i.mechanism,type:"chained",source:e,exception_id:t,parent_id:s}}function HN(i){const e="console";kt(e,i),Yt(e,VN)}function VN(){"console"in te&&Zi.forEach(function(i){i in te.console&&Ee(te.console,i,function(e){return ti[i]=e,function(...t){ve("console",{args:t,level:i});const o=ti[i];o==null||o.apply(te.console,t)}})})}function ZN(i){return i==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(i)?i:"log"}const XN="Dedupe",KN=()=>{let i;return{name:XN,processEvent(e){if(e.type)return e;try{if(qN(e,i))return Z&&B.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return i=e}}},Jn=KN;function qN(i,e){return e?!!(el(i,e)||tl(i,e)):!1}function el(i,e){const t=i.message,s=e.message;return!(!t&&!s||t&&!s||!t&&s||t!==s||!Fn(i,e)||!Bn(i,e))}function tl(i,e){const t=Xr(e),s=Xr(i);return!(!t||!s||t.type!==s.type||t.value!==s.value||!Fn(i,e)||!Bn(i,e))}function Bn(i,e){let t=Dr(i),s=Dr(e);if(!t&&!s)return!0;if(t&&!s||!t&&s||(t=t,s=s,s.length!==t.length))return!1;for(let o=0;o<s.length;o++){const r=s[o],M=t[o];if(r.filename!==M.filename||r.lineno!==M.lineno||r.colno!==M.colno||r.function!==M.function)return!1}return!0}function Fn(i,e){let t=i.fingerprint,s=e.fingerprint;if(!t&&!s)return!0;if(t&&!s||!t&&s)return!1;t=t,s=s;try{return t.join("")===s.join("")}catch{return!1}}function Xr(i){var e;return((e=i.exception)==null?void 0:e.values)&&i.exception.values[0]}function Si(i){if(!i)return{};const e=i.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const t=e[6]||"",s=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:t,hash:s,relative:e[5]+t+s}}function Gn(i){if(i!==void 0)return i>=400&&i<500?"warning":i>=500?"error":void 0}const zs=te;function sl(){return"history"in zs&&!!zs.history}function il(){if(!("fetch"in zs))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function oo(i){return i&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(i.toString())}function ol(){var t;if(typeof EdgeRuntime=="string")return!0;if(!il())return!1;if(oo(zs.fetch))return!0;let i=!1;const e=zs.document;if(e&&typeof e.createElement=="function")try{const s=e.createElement("iframe");s.hidden=!0,e.head.appendChild(s),(t=s.contentWindow)!=null&&t.fetch&&(i=oo(s.contentWindow.fetch)),e.head.removeChild(s)}catch(s){Z&&B.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",s)}return i}function rl(i,e){const t="fetch";kt(t,i),Yt(t,()=>Ml(void 0,e))}function Ml(i,e=!1){e&&!ol()||Ee(te,"fetch",function(t){return function(...s){const o=new Error,{method:r,url:M}=nl(s),a={args:s,fetchData:{method:r,url:M},startTimestamp:st()*1e3,virtualError:o,headers:al(s)};return ve("fetch",{...a}),t.apply(te,s).then(async u=>(ve("fetch",{...a,endTimestamp:st()*1e3,response:u}),u),u=>{if(ve("fetch",{...a,endTimestamp:st()*1e3,error:u}),Yo(u)&&u.stack===void 0&&(u.stack=o.stack,_t(u,"framesToPop",1)),u instanceof TypeError&&(u.message==="Failed to fetch"||u.message==="Load failed"||u.message==="NetworkError when attempting to fetch resource."))try{const N=new URL(a.fetchData.url);u.message=`${u.message} (${N.host})`}catch{}throw u})}})}function ro(i,e){return!!i&&typeof i=="object"&&!!i[e]}function Kr(i){return typeof i=="string"?i:i?ro(i,"url")?i.url:i.toString?i.toString():"":""}function nl(i){if(i.length===0)return{method:"GET",url:""};if(i.length===2){const[t,s]=i;return{url:Kr(t),method:ro(s,"method")?String(s.method).toUpperCase():"GET"}}const e=i[0];return{url:Kr(e),method:ro(e,"method")?String(e.method).toUpperCase():"GET"}}function al(i){const[e,t]=i;try{if(typeof t=="object"&&t!==null&&"headers"in t&&t.headers)return new Headers(t.headers);if(mc(e))return new Headers(e.headers)}catch{}}function cl(){return"npm"}const Me=te;let Mo=0;function Hn(){return Mo>0}function ul(){Mo++,setTimeout(()=>{Mo--})}function qt(i,e={}){function t(o){return typeof o=="function"}if(!t(i))return i;try{const o=i.__sentry_wrapped__;if(o)return typeof o=="function"?o:i;if($o(i))return i}catch{return i}const s=function(...o){try{const r=o.map(M=>qt(M,e));return i.apply(this,r)}catch(r){throw ul(),Gc(M=>{M.addEventProcessor(a=>(e.mechanism&&(Xi(a,void 0),Zt(a,e.mechanism)),a.extra={...a.extra,arguments:o},a)),tN(r)}),r}};try{for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&(s[o]=i[o])}catch{}In(s,i),_t(i,"__sentry_wrapped__",s);try{Object.getOwnPropertyDescriptor(s,"name").configurable&&Object.defineProperty(s,"name",{get(){return i.name}})}catch{}return s}function Nl(){const i=bo(),{referrer:e}=Me.document||{},{userAgent:t}=Me.navigator||{},s={...e&&{Referer:e},...t&&{"User-Agent":t}};return{url:i,headers:s}}function Jo(i,e){const t=Bo(i,e),s={type:Tl(e),value:yl(e)};return t.length&&(s.stacktrace={frames:t}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function ll(i,e,t,s){const o=we(),r=o==null?void 0:o.getOptions().normalizeDepth,M=wl(e),a={__serialized__:fn(e,r)};if(M)return{exception:{values:[Jo(i,M)]},extra:a};const u={exception:{values:[{type:ji(e)?e.constructor.name:s?"UnhandledRejection":"Error",value:zl(e,{isUnhandledRejection:s})}]},extra:a};if(t){const N=Bo(i,t);N.length&&(u.exception.values[0].stacktrace={frames:N})}return u}function xi(i,e){return{exception:{values:[Jo(i,e)]}}}function Bo(i,e){const t=e.stacktrace||e.stack||"",s=jl(e),o=gl(e);try{return i(t,s,o)}catch{}return[]}const Ll=/Minified React error #\d+;/i;function jl(i){return i&&Ll.test(i.message)?1:0}function gl(i){return typeof i.framesToPop=="number"?i.framesToPop:0}function Vn(i){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?i instanceof WebAssembly.Exception:!1}function Tl(i){const e=i==null?void 0:i.name;return!e&&Vn(i)?i.message&&Array.isArray(i.message)&&i.message.length==2?i.message[0]:"WebAssembly.Exception":e}function yl(i){const e=i==null?void 0:i.message;return Vn(i)?Array.isArray(i.message)&&i.message.length==2?i.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Dl(i,e,t,s){const o=(t==null?void 0:t.syntheticException)||void 0,r=Fo(i,e,o,s);return Zt(r),r.level="error",t!=null&&t.event_id&&(r.event_id=t.event_id),St(r)}function dl(i,e,t="info",s,o){const r=(s==null?void 0:s.syntheticException)||void 0,M=no(i,e,r,o);return M.level=t,s!=null&&s.event_id&&(M.event_id=s.event_id),St(M)}function Fo(i,e,t,s,o){let r;if(Dn(e)&&e.error)return xi(i,e.error);if(zr(e)||Cc(e)){const M=e;if("stack"in e)r=xi(i,e);else{const a=M.name||(zr(M)?"DOMError":"DOMException"),u=M.message?`${a}: ${M.message}`:a;r=no(i,u,t,s),Xi(r,u)}return"code"in M&&(r.tags={...r.tags,"DOMException.code":`${M.code}`}),r}return Yo(e)?xi(i,e):ds(e)||ji(e)?(r=ll(i,e,t,o),Zt(r,{synthetic:!0}),r):(r=no(i,e,t,s),Xi(r,`${e}`),Zt(r,{synthetic:!0}),r)}function no(i,e,t,s){const o={};if(s&&t){const r=Bo(i,t);r.length&&(o.exception={values:[{value:e,stacktrace:{frames:r}}]}),Zt(o,{synthetic:!0})}if(Qo(e)){const{__sentry_template_string__:r,__sentry_template_values__:M}=e;return o.logentry={message:r,params:M},o}return o.message=e,o}function zl(i,{isUnhandledRejection:e}){const t=xc(i),s=e?"promise rejection":"exception";return Dn(i)?`Event \`ErrorEvent\` captured as ${s} with message \`${i.message}\``:ji(i)?`Event \`${Il(i)}\` (type=${i.type}) captured as ${s}`:`Object captured as ${s} with keys: ${t}`}function Il(i){try{const e=Object.getPrototypeOf(i);return e?e.constructor.name:void 0}catch{}}function wl(i){for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const t=i[e];if(t instanceof Error)return t}}const Cl=5e3;class hl extends LN{constructor(e){const t=Al(e),s=Me.SENTRY_SDK_SOURCE||cl();SN(t,"browser",["browser"],s),super(t);const{sendDefaultPii:o,sendClientReports:r,_experiments:M}=this._options,a=M==null?void 0:M.enableLogs;Me.document&&(r||a)&&Me.document.addEventListener("visibilitychange",()=>{Me.document.visibilityState==="hidden"&&(r&&this._flushOutcomes(),a&&_i(this))}),a&&(this.on("flush",()=>{_i(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{_i(this)},Cl)})),o&&(this.on("postprocessEvent",EN),this.on("beforeSendSession",_N))}eventFromException(e,t){return Dl(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",s){return dl(this._options.stackParser,e,t,s,this._options.attachStacktrace)}_prepareEvent(e,t,s,o){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,s,o)}}function Al(i){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=Me.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...i}}const pl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ze=te,ml=1e3;let qr,ao,co;function Ol(i){const e="dom";kt(e,i),Yt(e,El)}function El(){if(!ze.document)return;const i=ve.bind(null,"dom"),e=eM(i,!0);ze.document.addEventListener("click",e,!1),ze.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(t=>{var r,M;const o=(r=ze[t])==null?void 0:r.prototype;(M=o==null?void 0:o.hasOwnProperty)!=null&&M.call(o,"addEventListener")&&(Ee(o,"addEventListener",function(a){return function(u,N,l){if(u==="click"||u=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},L=c[u]=c[u]||{refCount:0};if(!L.handler){const j=eM(i);L.handler=j,a.call(this,u,j,l)}L.refCount++}catch{}return a.call(this,u,N,l)}}),Ee(o,"removeEventListener",function(a){return function(u,N,l){if(u==="click"||u=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},L=c[u];L&&(L.refCount--,L.refCount<=0&&(a.call(this,u,L.handler,l),L.handler=void 0,delete c[u]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,u,N,l)}}))})}function _l(i){if(i.type!==ao)return!1;try{if(!i.target||i.target._sentryId!==co)return!1}catch{}return!0}function Sl(i,e){return i!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function eM(i,e=!1){return t=>{if(!t||t._sentryCaptured)return;const s=xl(t);if(Sl(t.type,s))return;_t(t,"_sentryCaptured",!0),s&&!s._sentryId&&_t(s,"_sentryId",fe());const o=t.type==="keypress"?"input":t.type;_l(t)||(i({event:t,name:o,global:e}),ao=t.type,co=s?s._sentryId:void 0),clearTimeout(qr),qr=ze.setTimeout(()=>{co=void 0,ao=void 0},ml)}}function xl(i){try{return i.target}catch{return null}}let Us;function Zn(i){const e="history";kt(e,i),Yt(e,fl)}function fl(){if(ze.addEventListener("popstate",()=>{const e=ze.location.href,t=Us;if(Us=e,t===e)return;ve("history",{from:t,to:e})}),!sl())return;function i(e){return function(...t){const s=t.length>2?t[2]:void 0;if(s){const o=Us,r=kl(String(s));if(Us=r,o===r)return e.apply(this,t);ve("history",{from:o,to:r})}return e.apply(this,t)}}Ee(ze.history,"pushState",i),Ee(ze.history,"replaceState",i)}function kl(i){try{return new URL(i,ze.location.origin).toString()}catch{return i}}const Xs={};function Yl(i){const e=Xs[i];if(e)return e;let t=ze[i];if(oo(t))return Xs[i]=t.bind(ze);const s=ze.document;if(s&&typeof s.createElement=="function")try{const o=s.createElement("iframe");o.hidden=!0,s.head.appendChild(o);const r=o.contentWindow;r!=null&&r[i]&&(t=r[i]),s.head.removeChild(o)}catch(o){pl&&B.warn(`Could not create sandbox iframe for ${i} check, bailing to window.${i}: `,o)}return t&&(Xs[i]=t.bind(ze))}function tM(i){Xs[i]=void 0}const ls="__sentry_xhr_v3__";function Ql(i){const e="xhr";kt(e,i),Yt(e,Ul)}function Ul(){if(!ze.XMLHttpRequest)return;const i=XMLHttpRequest.prototype;i.open=new Proxy(i.open,{apply(e,t,s){const o=new Error,r=st()*1e3,M=tt(s[0])?s[0].toUpperCase():void 0,a=vl(s[1]);if(!M||!a)return e.apply(t,s);t[ls]={method:M,url:a,request_headers:{}},M==="POST"&&a.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const u=()=>{const N=t[ls];if(N&&t.readyState===4){try{N.status_code=t.status}catch{}const l={endTimestamp:st()*1e3,startTimestamp:r,xhr:t,virtualError:o};ve("xhr",l)}};return"onreadystatechange"in t&&typeof t.onreadystatechange=="function"?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(N,l,c){return u(),N.apply(l,c)}}):t.addEventListener("readystatechange",u),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(N,l,c){const[L,j]=c,T=l[ls];return T&&tt(L)&&tt(j)&&(T.request_headers[L.toLowerCase()]=j),N.apply(l,c)}}),e.apply(t,s)}}),i.send=new Proxy(i.send,{apply(e,t,s){const o=t[ls];if(!o)return e.apply(t,s);s[0]!==void 0&&(o.body=s[0]);const r={startTimestamp:st()*1e3,xhr:t};return ve("xhr",r),e.apply(t,s)}})}function vl(i){if(tt(i))return i;try{return i.toString()}catch{}}function bl(i,e=Yl("fetch")){let t=0,s=0;function o(r){const M=r.body.length;t+=M,s++;const a={body:r.body,method:"POST",referrerPolicy:"strict-origin",headers:i.headers,keepalive:t<=6e4&&s<15,...i.fetchOptions};if(!e)return tM("fetch"),ii("No fetch implementation available");try{return e(i.url,a).then(u=>(t-=M,s--,{statusCode:u.status,headers:{"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")}}))}catch(u){return tM("fetch"),t-=M,s--,ii(u)}}return ON(i,o)}const $l=30,Pl=50;function uo(i,e,t,s){const o={filename:i,function:e==="<anonymous>"?Et:e,in_app:!0};return t!==void 0&&(o.lineno=t),s!==void 0&&(o.colno=s),o}const Wl=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Rl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Jl=/\((\S*)(?::(\d+))(?::(\d+))\)/,Bl=i=>{const e=Wl.exec(i);if(e){const[,s,o,r]=e;return uo(s,Et,+o,+r)}const t=Rl.exec(i);if(t){if(t[2]&&t[2].indexOf("eval")===0){const M=Jl.exec(t[2]);M&&(t[2]=M[1],t[3]=M[2],t[4]=M[3])}const[o,r]=Xn(t[1]||Et,t[2]);return uo(r,o,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},Fl=[$l,Bl],Gl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Hl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vl=i=>{const e=Gl.exec(i);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=Hl.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let s=e[3],o=e[1]||Et;return[o,s]=Xn(o,s),uo(s,o,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Zl=[Pl,Vl],Xl=[Fl,Zl],Kl=Tn(...Xl),Xn=(i,e)=>{const t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:Et,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[i,e]},Di=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,vs=1024,ql="Breadcrumbs",e4=(i={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...i};return{name:ql,setup(t){e.console&&HN(o4(t)),e.dom&&Ol(i4(t,e.dom)),e.xhr&&Ql(r4(t)),e.fetch&&rl(M4(t)),e.history&&Zn(n4(t)),e.sentry&&t.on("beforeSendEvent",s4(t))}}},t4=e4;function s4(i){return function(t){we()===i&&xt({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:pt(t)},{event:t})}}function i4(i,e){return function(s){if(we()!==i)return;let o,r,M=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>vs&&(Di&&B.warn(`\`dom.maxStringLength\` cannot exceed ${vs}, but a value of ${a} was configured. Sentry will use ${vs} instead.`),a=vs),typeof M=="string"&&(M=[M]);try{const N=s.event,l=a4(N)?N.target:N;o=zn(l,{keyAttrs:M,maxStringLength:a}),r=_c(l)}catch{o="<unknown>"}if(o.length===0)return;const u={category:`ui.${s.name}`,message:o};r&&(u.data={"ui.component_name":r}),xt(u,{event:s.event,name:s.name,global:s.global})}}function o4(i){return function(t){if(we()!==i)return;const s={category:"console",data:{arguments:t.args,logger:"console"},level:ZN(t.level),message:Ir(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)s.message=`Assertion failed: ${Ir(t.args.slice(1)," ")||"console.assert"}`,s.data.arguments=t.args.slice(1);else return;xt(s,{input:t.args,level:t.level})}}function r4(i){return function(t){if(we()!==i)return;const{startTimestamp:s,endTimestamp:o}=t,r=t.xhr[ls];if(!s||!o||!r)return;const{method:M,url:a,status_code:u,body:N}=r,l={method:M,url:a,status_code:u},c={xhr:t.xhr,input:N,startTimestamp:s,endTimestamp:o},L={category:"xhr",data:l,type:"http",level:Gn(u)};i.emit("beforeOutgoingRequestBreadcrumb",L,c),xt(L,c)}}function M4(i){return function(t){if(we()!==i)return;const{startTimestamp:s,endTimestamp:o}=t;if(o&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.fetchData.method,t.fetchData.url,t.error){const r=t.fetchData,M={data:t.error,input:t.args,startTimestamp:s,endTimestamp:o},a={category:"fetch",data:r,level:"error",type:"http"};i.emit("beforeOutgoingRequestBreadcrumb",a,M),xt(a,M)}else{const r=t.response,M={...t.fetchData,status_code:r==null?void 0:r.status};t.fetchData.request_body_size,t.fetchData.response_body_size,r==null||r.status;const a={input:t.args,response:r,startTimestamp:s,endTimestamp:o},u={category:"fetch",data:M,type:"http",level:Gn(M.status_code)};i.emit("beforeOutgoingRequestBreadcrumb",u,a),xt(u,a)}}}function n4(i){return function(t){if(we()!==i)return;let s=t.from,o=t.to;const r=Si(Me.location.href);let M=s?Si(s):void 0;const a=Si(o);M!=null&&M.path||(M=r),r.protocol===a.protocol&&r.host===a.host&&(o=a.relative),r.protocol===M.protocol&&r.host===M.host&&(s=M.relative),xt({category:"navigation",data:{from:s,to:o}})}}function a4(i){return!!i&&!!i.target}const c4=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],u4="BrowserApiErrors",N4=(i={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...i};return{name:u4,setupOnce(){e.setTimeout&&Ee(Me,"setTimeout",sM),e.setInterval&&Ee(Me,"setInterval",sM),e.requestAnimationFrame&&Ee(Me,"requestAnimationFrame",L4),e.XMLHttpRequest&&"XMLHttpRequest"in Me&&Ee(XMLHttpRequest.prototype,"send",j4);const t=e.eventTarget;t&&(Array.isArray(t)?t:c4).forEach(o=>g4(o,e))}}},l4=N4;function sM(i){return function(...e){const t=e[0];return e[0]=qt(t,{mechanism:{data:{function:Tt(i)},handled:!1,type:"instrument"}}),i.apply(this,e)}}function L4(i){return function(e){return i.apply(this,[qt(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Tt(i)},handled:!1,type:"instrument"}})])}}function j4(i){return function(...e){const t=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in t&&typeof t[o]=="function"&&Ee(t,o,function(r){const M={mechanism:{data:{function:o,handler:Tt(r)},handled:!1,type:"instrument"}},a=$o(r);return a&&(M.mechanism.data.handler=Tt(a)),qt(r,M)})}),i.apply(this,e)}}function g4(i,e){var o,r;const s=(o=Me[i])==null?void 0:o.prototype;(r=s==null?void 0:s.hasOwnProperty)!=null&&r.call(s,"addEventListener")&&(Ee(s,"addEventListener",function(M){return function(a,u,N){try{T4(u)&&(u.handleEvent=qt(u.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Tt(u),target:i},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&y4(this,a,u),M.apply(this,[a,qt(u,{mechanism:{data:{function:"addEventListener",handler:Tt(u),target:i},handled:!1,type:"instrument"}}),N])}}),Ee(s,"removeEventListener",function(M){return function(a,u,N){try{const l=u.__sentry_wrapped__;l&&M.call(this,a,l,N)}catch{}return M.call(this,a,u,N)}}))}function T4(i){return typeof i.handleEvent=="function"}function y4(i,e,t){i&&typeof i=="object"&&"removeEventListener"in i&&typeof i.removeEventListener=="function"&&i.removeEventListener(e,t)}const D4=()=>({name:"BrowserSession",setupOnce(){if(typeof Me.document>"u"){Di&&B.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}vr({ignoreDuration:!0}),br(),Zn(({from:i,to:e})=>{i!==void 0&&i!==e&&(vr({ignoreDuration:!0}),br())})}}),d4="GlobalHandlers",z4=(i={})=>{const e={onerror:!0,onunhandledrejection:!0,...i};return{name:d4,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(w4(t),iM("onerror")),e.onunhandledrejection&&(C4(t),iM("onunhandledrejection"))}}},I4=z4;function w4(i){dc(e=>{const{stackParser:t,attachStacktrace:s}=Kn();if(we()!==i||Hn())return;const{msg:o,url:r,line:M,column:a,error:u}=e,N=p4(Fo(t,u||o,void 0,s,!1),r,M,a);N.level="error",Yn(N,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function C4(i){Ic(e=>{const{stackParser:t,attachStacktrace:s}=Kn();if(we()!==i||Hn())return;const o=h4(e),r=Uo(o)?A4(o):Fo(t,o,void 0,s,!0);r.level="error",Yn(r,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function h4(i){if(Uo(i))return i;try{if("reason"in i)return i.reason;if("detail"in i&&"reason"in i.detail)return i.detail.reason}catch{}return i}function A4(i){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}}function p4(i,e,t,s){const o=i.exception=i.exception||{},r=o.values=o.values||[],M=r[0]=r[0]||{},a=M.stacktrace=M.stacktrace||{},u=a.frames=a.frames||[],N=s,l=t,c=tt(e)&&e.length>0?e:bo();return u.length===0&&u.push({colno:N,filename:c,function:Et,in_app:!0,lineno:l}),i}function iM(i){Di&&B.log(`Global Handler attached: ${i}`)}function Kn(){const i=we();return(i==null?void 0:i.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const m4=()=>({name:"HttpContext",preprocessEvent(i){var s;if(!Me.navigator&&!Me.location&&!Me.document)return;const e=Nl(),t={...e.headers,...(s=i.request)==null?void 0:s.headers};i.request={...e,...i.request,headers:t}}}),O4="cause",E4=5,_4="LinkedErrors",S4=(i={})=>{const e=i.limit||E4,t=i.key||O4;return{name:_4,preprocessEvent(s,o,r){const M=r.getOptions();GN(Jo,M.stackParser,t,e,s,o)}}},x4=S4;function f4(){return k4()?(Di&&es(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function k4(){var r;if(typeof Me.window>"u")return!1;const i=Me;if(i.nw)return!1;const e=i.chrome||i.browser;if(!((r=e==null?void 0:e.runtime)!=null&&r.id))return!1;const t=bo(),s=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Me===Me.top&&s.some(M=>t.startsWith(`${M}://`)))}function Y4(i){return[bN(),YN(),l4(),t4(),I4(),x4(),Jn(),m4(),D4()]}function Q4(i={}){const e=!i.skipBrowserExtensionCheck&&f4(),t={...i,enabled:e?!1:i.enabled,stackParser:yc(i.stackParser||Kl),integrations:aN({integrations:i.integrations,defaultIntegrations:i.defaultIntegrations==null?Y4():i.defaultIntegrations}),transport:i.transport||bl};return dN(hl,t)}function U4(){console.log(`
16
16
  ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
17
17
  ██║██╔═══██╗██╔══██╗██╔══██╗██╔═══██╗██║ ██╔╝██╔════╝██╔══██╗
18
18
  ██║██║ ██║██████╔╝██████╔╝██║ ██║█████╔╝ █████╗ ██████╔╝