// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("exports ../request ../core/accessorSupport/get ../geometry/support/normalizeUtils ./networkService ./utils ./route/utils ./support/ClosestFacilitySolveResult ./support/FeatureSet".split(" "),function(n,q,r,t,c,u,v,w,x){function h(e){return e instanceof x}n.solve=async function(e,a,f){const m=[];var d=[],b={};const k={},p=u.parseUrl(e);({path:e}=p);h(a.incidents)&&c.collectGeometries(a.incidents.features,d,"incidents.features",b);h(a.facilities)&&c.collectGeometries(a.facilities.features,d, "facilities.features",b);h(a.pointBarriers)&&c.collectGeometries(a.pointBarriers.features,d,"pointBarriers.features",b);h(a.polylineBarriers)&&c.collectGeometries(a.polylineBarriers.features,d,"polylineBarriers.features",b);h(a.polygonBarriers)&&c.collectGeometries(a.polygonBarriers.features,d,"polygonBarriers.features",b);d=await t.normalizeCentralMeridian(d);for(const g in b){const l=b[g];m.push(g);k[g]=d.slice(l[0],l[1])}if(c.isInputGeometryZAware(k,m)){b=null;try{b=await c.fetchServiceDescription(e, a.apiKey,f)}catch{}b&&!b.hasZ&&c.dropZValuesOffInputGeometry(k,m)}for(const g in k)k[g].forEach((l,y)=>{r.get(a,g)[y].geometry=l});f={...f,query:{...p.query,...v.closestFacilityParametersToQueryParameters(a),f:"json"}};({data:f}=await q(`${e}/solveClosestFacility`,f));return w.fromJSON(f)};Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});