/*
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 e from"../../../core/Error.js";import{parseUrl as o,asValidOptions as s,encode as i}from"../../utils.js";import{addServerVersion as t}from"./serverVersionUtils.js";import n from"./support/ReconcileResult.js";const c=new Map;async function m(m,p,a,f){c.has(m)||await t(c,m);const u=c.get(m);if((u?.serverVersion??0)<=11.1)throw new e("reconcile:enterprise-version","versioning API requires ArcGIS Enterprise version 11.2 or higher");if(!p)throw new e("reconcile:missing-guid","guid for version is missing");const h=o(m),l=a.toJSON(),g=s(h.query,{query:i({...l,f:"json"}),...f,method:"post"});p.startsWith("{")&&(p=p.slice(1,-1));const v=`${h.path}/versions/${p}/reconcile`,{data:w}=await r(v,g);return n.fromJSON(w)}export{m as reconcile,c as serverVersionCacheMap};
