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