import{a}from"./chunk-AUIVUOKV.mjs";import{a as i,b as e,g as s}from"./chunk-IFUYCFBO.mjs";import"./chunk-76CZ6Z7T.mjs";i("parseConflictContent",()=>{let o=(r,t)=>`
{
  "name": "test",
<<<<<<< ours
${r}
=======
${t}
>>>>>>> theirs
}
`.trim();e("parses simple JSON conflict",async()=>{let r=o('  "value": 1','  "value": 2'),t=await a(r,{parsers:"json"});s(t.format).toBe("json"),s(t.ours).toEqual({name:"test",value:1}),s(t.theirs).toEqual({name:"test",value:2})}),e("respects filename extension hint (yaml)",async()=>{let t=await a(`
key: value
<<<<<<< ours
ours: 1
=======
theirs: 2
>>>>>>> theirs
`,{filename:"config.yaml"});s(t.format).toBe("yaml"),s(t.ours).toHaveProperty("ours",1),s(t.theirs).toHaveProperty("theirs",2)}),e("respects explicit parsers array (json5 fallback)",async()=>{let r=o("  value: 1,","  value: 2,"),t=await a(r,{parsers:["json5"]});s(t.format).toBe("json5"),s(t.ours).toMatchObject({value:1}),s(t.theirs).toMatchObject({value:2})}),e("supports custom parser",async()=>{let r=o("ours-side","theirs-side"),n=await a(r,{parsers:{name:"custom",parser:c=>({parsed:c.trim()})}});s(n.format).toBe("custom"),s(n.ours).toMatchObject({parsed:s.stringContaining("ours-side")}),s(n.theirs).toMatchObject({parsed:s.stringContaining("theirs-side")})}),e("throws if parsing fails for all parsers",async()=>{await s(a("invalid",{parsers:["json"]})).rejects.toThrow(/Failed to parse/)}),e("throws if conflict markers produce empty side",async()=>{await s(a(`
<<<<<<< ours
only ours
>>>>>>> theirs
`,{parsers:"json"})).rejects.toThrow(/empty content/)})});
