import{d as g,av as N,a as m,m as u,f as a,i as E,j as x,k as p,t as d,p as v,h as y,Y as C,o as l,v as b}from"./CCqMIw4K.js";import{_ as S}from"./Dg_TZ7-t.js";import"./D5lo6U3Q.js";const R=/(^|@)\S+:\d+/,h=/^\s*at .*(\S+:\d+|\(native\))/m,$=/^(eval@)?(\[native code])?$/;function _(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return A(n);if(n.stack&&n.stack.match(h))return O(n);if(n.stack)return w(n);throw new Error("Cannot parse given Error object")}function f(n){if(!n.includes(":"))return[n];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(n.replace(/[()]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]}function O(n){return n.stack.split(`
`).filter(e=>!!e.match(h)).map(e=>{e.includes("(eval ")&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let s=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,"");const t=s.match(/ (\(.+\)$)/);s=t?s.replace(t[0],""):s;const r=f(t?t[1]:s),o=t&&s||void 0,i=["eval","<anonymous>"].includes(r[0])?void 0:r[0];return{functionName:o,fileName:i,lineNumber:r[1]?+r[1]:void 0,columnNumber:r[2]?+r[2]:void 0,source:e}})}function w(n){return n.stack.split(`
`).filter(e=>!e.match($)).map(e=>{if(e.includes(" > eval")&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!e.includes("@")&&!e.includes(":"))return{functionName:e};{const s=/((.*".+"[^@]*)?[^@]*)(?:@)/,t=e.match(s),r=t&&t[1]?t[1]:void 0,o=f(e.replace(s,""));return{functionName:r,fileName:o[0],lineNumber:o[1]?+o[1]:void 0,columnNumber:o[2]?+o[2]:void 0,source:e}}})}function A(n){return!n.stacktrace||n.message.includes(`
`)&&n.message.split(`
`).length>n.stacktrace.split(`
`).length?I(n):n.stack?P(n):F(n)}function I(n){const c=/Line (\d+).*script (?:in )?(\S+)/i,e=n.message.split(`
`),s=[];for(let t=2,r=e.length;t<r;t+=2){const o=c.exec(e[t]);o&&s.push({fileName:o[2],lineNumber:+o[1],source:e[t]})}return s}function F(n){const c=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,e=n.stacktrace.split(`
`),s=[];for(let t=0,r=e.length;t<r;t+=2){const o=c.exec(e[t]);o&&s.push({functionName:o[3]||void 0,fileName:o[2],lineNumber:o[1]?+o[1]:void 0,source:e[t]})}return s}function P(n){return n.stack.split(`
`).filter(e=>!!e.match(R)&&!e.match(/^Error created at/)).map(e=>{const s=e.split("@"),t=f(s.pop()),r=s.shift()||"",o=r.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;let i;r.match(/\(([^)]*)\)/)&&(i=r.replace(/^[^(]+\(([^)]*)\)$/,"$1"));const k=i===void 0||i==="[arguments not available]"?void 0:i.split(",");return{functionName:o,args:k,fileName:t[0],lineNumber:t[1]?+t[1]:void 0,columnNumber:t[2]?+t[2]:void 0,source:e}})}const T={p6:""},V={key:0},B={"text-6xl":""},X={key:0,op75:""},D={my4:"","text-xl":"","text-red":""},G={key:1,"of-auto":"",rounded:"","bg-active":"",p2:""},L=p("div",{px1:"",op50:""}," Stacktrace ",-1),M=["textContent"],j={key:1,op50:""},U=g({__name:"error",setup(n){const c=N(),e=m(()=>{const t=c.value?.nuxt?.payload?.error;return t&&(console.error("[Nuxt DevTools] Error in payload:"),console.error(t),console.error({...t})),t}),s=m(()=>{if(!e.value?.stack)return[];try{return e.value.stack.startsWith("<pre>")?_({stack:e.value.stack.replace(/<.*?>/g,"")}):_(e.value)}catch(t){return console.error(t),[]}});return(t,r)=>{const o=C,i=S;return l(),u("div",T,[a(e)?(l(),u("div",V,[E(o,{n:"red",icon:"i-carbon-warning-alt-filled",mb5:""},{default:x(()=>[b(" Error occurred in this page ")]),_:1}),p("div",B,d(a(e).statusCode||"Client Error"),1),a(e).statusMessage?(l(),u("div",X,d(a(e).statusMessage),1)):v("",!0),p("div",D,d(a(e).message||a(e).description||"Unknown error"),1),a(s).length||a(e).stack?(l(),u("div",G,[L,a(s).length?(l(),y(i,{key:0,px2:"",stacktrace:a(s)},null,8,["stacktrace"])):(l(),u("pre",{key:1,textContent:d(a(e).stack)},null,8,M))])):v("",!0)])):(l(),u("div",j," No error "))])}}});export{U as default};
