The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
import{j as h,k as E,g as u,l,ac as v,u as S,aq as A,b as L}from"./BKFspo1J.js";import{a as f}from"./h7yRWCtK.js";import{g as O}from"./BHvJp7nu.js";function st(...s){return s.filter(Boolean).join(" ")}const M=typeof document<"u";let C=0;class U{#t=h(E([]));get toasts(){return u(this.#t)}set toasts(t){l(this.#t,t,!0)}#e=h(E([]));get heights(){return u(this.#e)}set heights(t){l(this.#e,t,!0)}#s=t=>{const e=this.toasts.findIndex(r=>r.id===t);return e===-1?null:e};addToast=t=>{M&&this.toasts.unshift(t)};updateToast=({id:t,data:e,type:r,message:n})=>{const a=this.toasts.findIndex(i=>i.id===t),o=this.toasts[a];this.toasts[a]={...o,...e,id:t,title:n,type:r,updated:!0}};create=t=>{const{message:e,...r}=t,n=typeof t?.id=="number"||t.id&&t.id?.length>0?t.id:C++,a=t.dismissable===void 0?!0:t.dismissable,o=t.type===void 0?"default":t.type;return v(()=>{this.toasts.find(d=>d.id===n)?this.updateToast({id:n,data:t,type:o,message:e,dismissable:a}):this.addToast({...r,id:n,title:e,dismissable:a,type:o})}),n};dismiss=t=>(v(()=>{if(t===void 0){this.toasts=this.toasts.map(r=>({...r,dismiss:!0}));return}const e=this.toasts.findIndex(r=>r.id===t);this.toasts[e]&&(this.toasts[e]={...this.toasts[e],dismiss:!0})}),t);remove=t=>{if(t===void 0){this.toasts=[];return}const e=this.#s(t);if(e!==null)return this.toasts.splice(e,1),t};message=(t,e)=>this.create({...e,type:"default",message:t});error=(t,e)=>this.create({...e,type:"error",message:t});success=(t,e)=>this.create({...e,type:"success",message:t});info=(t,e)=>this.create({...e,type:"info",message:t});warning=(t,e)=>this.create({...e,type:"warning",message:t});loading=(t,e)=>this.create({...e,type:"loading",message:t});promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create({...e,promise:t,type:"loading",message:typeof e.loading=="string"?e.loading:e.loading()}));const n=t instanceof Promise?t:t();let a=r!==void 0;return n.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){a=!1;const i=H(o);this.create({id:r,type:"error",message:i})}else if(e.success!==void 0){a=!1;const i=typeof e.success=="function"?e.success(o):e.success;this.create({id:r,type:"success",message:i})}}).catch(o=>{if(e.error!==void 0){a=!1;const i=typeof e.error=="function"?e.error(o):e.error;this.create({id:r,type:"error",message:i})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),e.finally?.()}),r};custom=(t,e)=>{const r=e?.id||C++;return this.create({component:t,id:r,...e}),r};removeHeight=t=>{this.heights=this.heights.filter(e=>e.toastId!==t)};setHeight=t=>{const e=this.#s(t.toastId);if(e===null){this.heights.push(t);return}this.heights[e]=t};reset=()=>{this.toasts=[],this.heights=[]}}function H(s){return s&&typeof s=="object"&&"status"in s?`HTTP error! Status: ${s.status}`:`Error! ${s}`}const c=new U;function $(s,t){return c.create({message:s,...t})}class rt{#t=S(()=>c.toasts.filter(t=>!t.dismiss));get toasts(){return u(this.#t)}}const D=$,T=Object.assign(D,{success:c.success,info:c.info,warning:c.warning,error:c.error,custom:c.custom,message:c.message,promise:c.promise,dismiss:c.dismiss,loading:c.loading,getActiveToasts:()=>c.toasts.filter(s=>!s.dismiss)}),G="/api";let b=!1,R="";async function P(s,t,e,r){const n=f.token,a={"Content-Type":"application/json"};n&&(a.Authorization=`Bearer ${n}`);let o=`${G}${t}`;r?.projectId&&!r?.skipProjectId&&(o+=`${t.includes("?")?"&":"?"}projectId=${r.projectId}`);const i=await fetch(o,{method:s,headers:a,body:e?JSON.stringify(e):void 0});if(f.token!==n)throw Object.assign(new Error("Session changed"),{status:401});if(i.status===401)throw f.logout(),Object.assign(new Error("Unauthorized"),{status:401});if(i.status===403){const d=await i.json().catch(()=>({})),I=d.error||(s==="GET"?"Forbidden":"You don't have permission to perform this action");if(!b){b=!0;try{const g=new URL(o,window.location.origin).searchParams.get("projectId"),w=g?await P("GET","/me/login-bundle").catch(()=>null):null;if(w&&(f.setOrganizations(w.organizations??[]),y.setProjects(w.projects??[])),f.token===n)if(w&&g&&!y.projects.some(j=>j.id===g)){R!==g&&(R=g,T.warning("That project is no longer available"));const j=new URL(window.location.href);j.searchParams.get("projectId")===g&&y.currentProjectId&&(j.searchParams.set("projectId",y.currentProjectId),await O(j.pathname+j.search,{replaceState:!0}))}else s!=="GET"?T.error(I):(T.warning("You don't have permission to access that feature"),window.location.pathname!=="/"&&await O("/",{replaceState:!0}))}finally{b=!1}}throw Object.assign(new Error(I),{status:403,body:d})}if(i.status===422){const d=await i.json().catch(()=>({}));throw Object.assign(new Error(d.error||"Validation failed"),{status:422,body:d})}if(!i.ok)throw Object.assign(new Error(`API Error: ${i.statusText}`),{status:i.status});return i.json()}const p={get:(s,t)=>P("GET",s,void 0,t),post:(s,t,e)=>P("POST",s,t,e),put:(s,t,e)=>P("PUT",s,t,e),delete:(s,t,e)=>P("DELETE",s,e,t)},x=["react","svelte","vuejs","jquery","react-native","flutter","android","ios"],_=["react","svelte","vuejs","nextjs","nestjs","express","remix","jquery","react-native"],k={gin:"Gin",fiber:"Fiber",chi:"Chi",fasthttp:"FastHTTP",stdlib:"Standard Library",custom:"Custom",react:"React",svelte:"Svelte",vuejs:"Vue.js",nextjs:"Next.js",nestjs:"NestJS",express:"Express",remix:"Remix",jquery:"jQuery","react-native":"React Native",hono:"Hono",cloudflare:"Cloudflare",opentelemetry:"OpenTelemetry",symfony:"Symfony",laravel:"Laravel",django:"Django",flutter:"Flutter",android:"Android",ios:"iOS"};function q(s){return k[s]??s}function F(s){return x.includes(s)}function B(s){return!F(s)}function N(s){return _.includes(s)}function W(s){return N(s)||s==="flutter"||s==="ios"||s==="android"}const J=["webjs","nodejs","javascript","typescript"];function K(s){return!!s&&J.includes(s.toLowerCase())}function V(s){return s==="opentelemetry"||s==="hono"}function Y(s){return s==="cloudflare"}function z(s){return s?s.role?s.role==="readonly":s.organizationId?f.getRoleForOrganization(s.organizationId)==="readonly":!1:!1}const m="PROJECTS_CACHE_V2";class Q{#t=h(E(JSON.parse(localStorage.getItem(m)||"[]")));get projects(){return u(this.#t)}set projects(t){l(this.#t,t,!0)}#e=h(E(localStorage.getItem("CURRENT_PROJECT_ID")));get currentProjectId(){return u(this.#e)}set currentProjectId(t){l(this.#e,t,!0)}#s=h(!1);get loading(){return u(this.#s)}set loading(t){l(this.#s,t,!0)}#r=h(null);get error(){return u(this.#r)}set error(t){l(this.#r,t,!0)}#o=h(!1);get loaded(){return u(this.#o)}set loaded(t){l(this.#o,t,!0)}#i=S(()=>this.projects.find(t=>t.id===this.currentProjectId)||this.projects[0]||null);get currentProject(){return u(this.#i)}set currentProject(t){l(this.#i,t)}#n=S(()=>{const t=this.currentProject?.organizationId;return t?f.canManageOrganization(t):!1});get canManageCurrentProject(){return u(this.#n)}set canManageCurrentProject(t){l(this.#n,t)}#a=S(()=>!z(this.currentProject));get canWriteCurrentProject(){return u(this.#a)}set canWriteCurrentProject(t){l(this.#a,t)}constructor(){A(()=>{L(()=>{this.currentProjectId?localStorage.setItem("CURRENT_PROJECT_ID",this.currentProjectId):localStorage.removeItem("CURRENT_PROJECT_ID")})})}setProjects(t){this.projects=t,this.loaded=!0,(!this.currentProjectId||!this.projects.find(e=>e.id===this.currentProjectId))&&(this.currentProjectId=this.projects.length>0?this.projects[0].id:null),localStorage.setItem(m,JSON.stringify(this.projects))}async loadProjects(){this.loading=!0,this.error=null;try{const t=await p.get("/projects");this.setProjects(t)}catch(t){const e=t instanceof Error?t.message:"Failed to load projects";this.error=e;const r=localStorage.getItem(m);r&&(this.projects=JSON.parse(r))}finally{this.loading=!1,this.loaded=!0}}async createProjects(t,e){const r=await p.post("/projects/batch",{organizationId:t,projects:e});return await this.loadProjects(),r.projects}async createProject(t,e="gin",r){const n=r??this.currentProject?.organizationId;if(!n)throw new Error("No organization selected");return(await this.createProjects(n,[{name:t,framework:e}]))[0]}async updateProject(t,e,r,n,a,o,i,d){const I=await p.put("/projects",{name:e,framework:r,dropHealthyHealthchecks:n,healthcheckPaths:a,profileLabelAllowlist:o,aiFlaggedTerms:i,aiFlaggedLanguages:d},{projectId:t});return await this.loadProjects(),I}async deleteProject(t,e){await p.delete("/projects",{projectId:t},{name:e}),await this.loadProjects()}async generateSourceMapToken(){const t=await p.post("/projects/source-map-token",{},{projectId:this.currentProjectId??void 0});return await this.loadProjects(),t.sourceMapToken}selectProject(t){this.currentProjectId=t}clear(){this.projects=[],this.currentProjectId=null,this.loaded=!1,localStorage.removeItem(m)}initFromCache(){const t=localStorage.getItem(m);t&&(this.projects=JSON.parse(t))}}const y=new Q,ot=Object.freeze(Object.defineProperty({__proto__:null,FRAMEWORK_LABELS:k,FRONTEND_FRAMEWORKS:x,JS_FRAMEWORKS:_,JS_LANGUAGES:J,getFrameworkLabel:q,isBackendFramework:B,isCloudflareFramework:Y,isFrontendFramework:F,isJsFramework:N,isJsLanguage:K,isOtelFramework:V,isProjectReadonly:z,projectsState:y,supportsSymbolUpload:W},Symbol.toStringTag,{value:"Module"}));export{k as F,rt as S,p as a,V as b,Y as c,N as d,K as e,F as f,q as g,z as h,B as i,c as j,st as k,ot as l,y as p,W as s,T as t};