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