import{a as i,b as r,c}from"./chunk-RIT5WMHA.mjs";import{a as h}from"./chunk-JD45QQDD.mjs";import{a as g,c as n,d as p,e as b,f as m}from"./chunk-QPV2G662.mjs";import{a as l,b as o,g as t,h as f}from"./chunk-IFUYCFBO.mjs";import"./chunk-76CZ6Z7T.mjs";f.mock("./strategy-resolver",()=>({resolveStrategies:f.fn(()=>["ours","theirs","merge"])}));var u=()=>({config:{debug:!1},strategies:{},_strategyCache:new Map});l("statusToString",()=>{o("maps known statuses",()=>{t(i(n)).toBe("OK"),t(i(p)).toBe("CONTINUE"),t(i(b)).toBe("FAIL"),t(i(m)).toBe("SKIP"),t(i(999)).toMatch(/UNKNOWN/)})});l("BuiltInStrategies",()=>{let e={ours:1,theirs:2,base:0,path:"x",ctx:u(),conflicts:[]};o("ours returns ours",()=>{let s=r.ours(e);t(s).toEqual({status:n,value:1})}),o("theirs returns theirs",()=>{let s=r.theirs(e);t(s).toEqual({status:n,value:2})}),o("base returns base",()=>{let s=r.base(e);t(s).toEqual({status:n,value:0})}),o("drop returns DROP symbol",()=>{let s=r.drop(e);t(s.value).toBe(g)}),o("skip returns SKIP",()=>{let s=r.skip(e);t(s.status).toBe(m),t(s.reason).toMatch(/Skip/)}),o("non-empty prefers ours \u2192 theirs \u2192 base",()=>{t(r["non-empty"]({...e,ours:"ours"}).value).toBe("ours"),t(r["non-empty"]({...e,ours:"",theirs:"theirs"}).value).toBe("theirs"),t(r["non-empty"]({...e,ours:"",theirs:"",base:"base"}).value).toBe("base"),t(r["non-empty"]({...e,ours:"",theirs:"",base:""}).status).toBe(p)}),o("update keeps theirs if ours defined",()=>{t(r.update({...e,ours:"x",theirs:"y"}).value).toBe("y")}),o("update drops if ours undefined",()=>{t(r.update({...e,ours:void 0,theirs:"y"}).value).toBe(g)}),o("merge plain objects recurses",async()=>{let s={...e,ours:{a:1},theirs:{a:2},base:{a:0},path:"obj"},y=await r.merge(s);t(y.status).toBe(n),t(y.value).toEqual({a:1})}),o("merge unmergeable types \u2192 CONTINUE",async()=>{let s=await r.merge({...e,ours:1,theirs:"str"});t(s.status).toBe(p)})});l("mergeObject",()=>{o("returns ours if equal",async()=>{let a=u(),e=[],s=await c({ours:1,theirs:1,base:0,path:"x",ctx:a,conflicts:e});t(s).toBe(1),t(e).toHaveLength(0)}),o("applies strategy OK result",async()=>{h.mockReturnValueOnce(["theirs"]);let a=u(),s=await c({ours:1,theirs:2,path:"p",ctx:a,conflicts:[]});t(s).toBe(2)}),o("records SKIP as conflict",async()=>{h.mockReturnValueOnce(["skip"]);let a=u(),e=[],s=await c({ours:"a",theirs:"b",path:"p",ctx:a,conflicts:e});t(s).toBeUndefined(),t(e[0].reason).toMatch(/Skip/)}),o.skip("adds conflict if all CONTINUE",async()=>{h.mockReturnValueOnce(["non-empty"]);let a=u(),e=[],s=await c({ours:"",theirs:"",base:"",path:"p",ctx:a,conflicts:e});t(s).toBeUndefined(),t(e[0]).toMatchObject({path:"p",reason:t.stringContaining("All strategies failed")})})});
