import{n as e}from"./lib.Bp2YInuy.js";function t(){}function n(){}var r=a(`end`),i=a(`start`);function a(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function o(e){let t=i(e),n=r(e);if(t&&n)return{start:t,end:n}}var s=typeof self==`object`?self:globalThis,c=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new s[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new s[a](o),i)};return r},l=e=>c(new Map,e)(0),u=``,{toString:d}={},{keys:f}=Object,p=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=d.call(e).slice(8,-1);switch(n){case`Array`:return[1,u];case`Object`:return[2,u];case`Date`:return[3,u];case`RegExp`:return[4,u];case`Map`:return[5,u];case`Set`:return[6,u];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},m=([e,t])=>e===0&&(t===`function`||t===`symbol`),h=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=p(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of f(r))(e||!m(p(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(m(p(n))||m(p(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!m(p(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},g=(e,{json:t,lossy:n}={})=>{let r=[];return h(!(t||n),!!t,new Map,r)(e),r},_=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?l(g(e,t)):structuredClone(e):(e,t)=>l(g(e,t));function v(t,n,r,i){let a,o,s;typeof n==`function`&&typeof r!=`function`?(o=void 0,s=n,a=r):(o=n,s=r,a=i),e(t,o,c,a);function c(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return s(e,r,n)}}export{o as a,i,_ as n,t as o,r,n as s,v as t};