import{a as l}from"./chunk-QPV2G662.mjs";import{a}from"./chunk-3PFH3U2T.mjs";var f=(t,n,e=[])=>{if(t!==l){if(t===void 0){let r=`__CONFLICT_MARKER::${n}__`;return e.push(n),r}if(Array.isArray(t))return t.map((r,s)=>f(r,`${n}[${s}]`,e)).filter(r=>r!==void 0);if(t&&typeof t=="object"){let r={};for(let[s,i]of Object.entries(t)){let o=f(i,n?`${n}.${s}`:s,e);o!==void 0&&(r[s]=o)}return r}return t}},k=async(t,n,e,r)=>{let s=[],i=f(t,"",s),o=await a(r,i);for(let c of s){let g=p(n,c),m=p(e,c),[_,d]=await Promise.all([g,m].map(C=>a(r,C))),$=["<<<<<<< ours",y(_,2),"=======",y(d,2),">>>>>>> theirs"].join(`
`),u=`__CONFLICT_MARKER::${c}__`;o=o.replace(/json/.test(r)?JSON.stringify(u):u,$)}return o},p=(t,n)=>{let e=n.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean),r=t;for(let s of e)r=r==null?void 0:r[s];return r},y=(t,n)=>{let e=" ".repeat(n);return t.split(`
`).map(r=>r&&e+r).join(`
`)};export{k as a};
