/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import r from"../../../request.js";import s from"../../../core/Error.js";import{parseUrl as o,asValidOptions as i,encode as t}from"../../utils.js";import{addServerVersion as e}from"./serverVersionUtils.js";import n from"./support/ConflictsResult.js";const c=new Map;async function f(f,m,p,a){c.has(f)||await e(c,f);const u=c.get(f);if((u?.serverVersion??0)<=11.1)throw new s("conflicts:enterprise-version","versioning API requires ArcGIS Enterprise version 11.2 or higher");if(!m)throw new s("conflicts:missing-guid","guid for version is missing");const h=o(f),l=p.toJSON(),g=i(h.query,{query:t({...l,f:"json"}),...a,method:"post"});m.startsWith("{")&&(m=m.slice(1,-1));const v=`${h.path}/versions/${m}/conflicts`,{data:w}=await r(v,g);return n.fromJSON(w)}export{f as conflicts,c as serverVersionCacheMap};
