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