import{_ as t,$ as s,e3 as F,a0 as L,cp as M,dT as Y,iJ as be,iL as $t,e4 as O,cK as j,dN as V,t as A,s as mt,g as x,dR as Se,U as ne,jG as Pe,et as It,dy as ft,a as h,cl as ht,a7 as vt,cJ as X,cy as Re,cA as wt,cL as q,aL as K,k as ye,dP as At,e2 as je,dK as jt,c1 as Lt,dM as Ot,ct as _,i5 as Dt,ih as Jt,eC as _t,eD as Ct,eE as Mt,Y as kt,cH as xt,hY as Ft,cz as Et,eT as rt,y as ot,jf as Ut,bP as Gt,cs as Wt,bO as qt,jH as st,m as Zt,jI as zt,dc as Vt,bA as Kt,cx as Ht,fY as Yt,cu as Qt}from"./index.6c049565.js";import{i as Xt}from"./originUtils.2d0aad75.js";import{f as er}from"./portalItemUtils.6b2af26d.js";import{y as ee,N as Le,U as tr,r as Oe,A as gt,R as rr,c as or,n as sr,w as ir,S as nr,d as it,s as ar,e as lr,i as pr,j as ur,k as cr,b as ae,h as le,O as re,g as oe,f as se,D as ie,a as de,t as yr,l as dr}from"./Stop.236eb374.js";import"./multiOriginJSONSupportUtils.38b69b9c.js";let Z=class extends M{constructor(e){super(e),this.break=new Y({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}}),this.first=new Y({color:[0,255,0],size:20,outline:{color:[255,255,255],width:4}}),this.unlocated=new Y({color:[255,0,0],size:12,outline:{color:[255,255,255],width:3}}),this.last=new Y({color:[255,0,0],size:20,outline:{color:[255,255,255],width:4}}),this.middle=new Y({color:[51,51,51],size:12,outline:{color:[0,122,194],width:3}}),this.waypoint=new Y({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}})}};t([s({types:F})],Z.prototype,"break",void 0),t([s({types:F})],Z.prototype,"first",void 0),t([s({types:F})],Z.prototype,"unlocated",void 0),t([s({types:F})],Z.prototype,"last",void 0),t([s({types:F})],Z.prototype,"middle",void 0),t([s({types:F})],Z.prototype,"waypoint",void 0),Z=t([L("esri.layers.support.RouteStopSymbols")],Z);const St=Z;let G=class extends M{constructor(e){super(e),this.directionLines=new be({color:[0,122,194],width:6}),this.directionPoints=new Y({color:[255,255,255],size:6,outline:{color:[0,122,194],width:2}}),this.pointBarriers=new Y({style:"x",size:10,outline:{color:[255,0,0],width:3}}),this.polygonBarriers=new $t({color:[255,170,0,.6],outline:{width:7.5,color:[255,0,0,.6]}}),this.polylineBarriers=new be({width:7.5,color:[255,85,0,.7]}),this.routeInfo=new be({width:8,color:[20,89,127]}),this.stops=new St}};t([s({types:F})],G.prototype,"directionLines",void 0),t([s({types:F})],G.prototype,"directionPoints",void 0),t([s({types:F})],G.prototype,"pointBarriers",void 0),t([s({types:F})],G.prototype,"polygonBarriers",void 0),t([s({types:F})],G.prototype,"polylineBarriers",void 0),t([s({types:F})],G.prototype,"routeInfo",void 0),t([s({type:St})],G.prototype,"stops",void 0),G=t([L("esri.layers.support.RouteSymbols")],G);const bt=G;let E=class extends M{constructor(e){super(e),this.dataType=null,this.name=null,this.parameterNames=null,this.restrictionUsageParameterName=null,this.timeNeutralAttributeName=null,this.trafficSupport=null,this.units=null,this.usageType=null}};t([s({type:String})],E.prototype,"dataType",void 0),t([O(ee,{ignoreUnknown:!1})],E.prototype,"name",void 0),t([s({type:[String]})],E.prototype,"parameterNames",void 0),t([s({type:String})],E.prototype,"restrictionUsageParameterName",void 0),t([O(Le,{ignoreUnknown:!1})],E.prototype,"timeNeutralAttributeName",void 0),t([s({type:String})],E.prototype,"trafficSupport",void 0),t([s({type:String})],E.prototype,"units",void 0),t([O(tr)],E.prototype,"usageType",void 0),E=t([L("esri.rest.support.NetworkAttribute")],E);const mr=E;let H=class extends M{constructor(e){super(e),this.buildTime=null,this.name=null,this.networkAttributes=null,this.networkSources=null,this.state=null}};t([s({type:Number})],H.prototype,"buildTime",void 0),t([s({type:String})],H.prototype,"name",void 0),t([s({type:[mr]})],H.prototype,"networkAttributes",void 0),t([s()],H.prototype,"networkSources",void 0),t([s({type:String})],H.prototype,"state",void 0),H=t([L("esri.rest.support.NetworkDataset")],H);const fr=H;let J=class extends M{constructor(e){super(e),this.accumulateAttributeNames=null,this.currentVersion=null,this.defaultTravelMode=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsSupportedLanguages=null,this.directionsTimeAttribute=null,this.hasZ=null,this.impedance=null,this.networkDataset=null,this.supportedTravelModes=null}readAccumulateAttributes(e){return A(e)?null:e.map(r=>ee.fromJSON(r))}writeAccumulateAttributes(e,r,o){!A(e)&&e.length&&(r[o]=e.map(i=>ee.toJSON(i)))}};t([s()],J.prototype,"accumulateAttributeNames",void 0),t([j("accumulateAttributeNames")],J.prototype,"readAccumulateAttributes",null),t([V("accumulateAttributeNames")],J.prototype,"writeAccumulateAttributes",null),t([s()],J.prototype,"currentVersion",void 0),t([s()],J.prototype,"defaultTravelMode",void 0),t([s()],J.prototype,"directionsLanguage",void 0),t([O(Oe)],J.prototype,"directionsLengthUnits",void 0),t([s()],J.prototype,"directionsSupportedLanguages",void 0),t([O(Le,{ignoreUnknown:!1})],J.prototype,"directionsTimeAttribute",void 0),t([s()],J.prototype,"hasZ",void 0),t([O(ee,{ignoreUnknown:!1})],J.prototype,"impedance",void 0),t([s({type:fr})],J.prototype,"networkDataset",void 0),t([s({type:[gt]})],J.prototype,"supportedTravelModes",void 0),J=t([L("esri.rest.support.NetworkServiceDescription")],J);const hr=J,vr=mt.getLogger("esri.rest.networkService");function me(e,r,o,i){i[o]=[r.length,r.length+e.length],e.forEach(n=>{r.push(n.geometry)})}function wr(e,r){for(let o=0;o=10.4?br(e,r,o):Sr(e,o),{defaultTravelMode:u,supportedTravelModes:p}=await d;return n.defaultTravelMode=u,n.supportedTravelModes=p,hr.fromJSON(n)}async function Sr(e,r){var N,I,B;const o=Se({f:"json"},r),{data:i}=await ne(e.replace(/\/rest\/.*$/i,"/info"),o);if(!i||!i.owningSystemUrl)return{supportedTravelModes:[],defaultTravelMode:null};const{owningSystemUrl:n}=i,d=Pe(n)+"/sharing/rest/portals/self",{data:u}=await ne(d,o),p=It("helperServices.routingUtilities.url",u);if(!p)return{supportedTravelModes:[],defaultTravelMode:null};const f=ft(n),S=/\/solve$/i.test(f.path)?"Route":/\/solveclosestfacility$/i.test(f.path)?"ClosestFacility":"ServiceAreas",a=Se({f:"json",serviceName:S},r),b=Pe(p)+"/GetTravelModes/execute",P=await ne(b,a),v=[];let y=null;if((I=(N=P==null?void 0:P.data)==null?void 0:N.results)!=null&&I.length){const l=P.data.results;for(const g of l)if(g.paramName==="supportedTravelModes"){if((B=g.value)!=null&&B.features){for(const{attributes:w}of g.value.features)if(w){const R=JSON.parse(w.TravelMode);v.push(R)}}}else g.paramName==="defaultTravelMode"&&(y=g.value)}return{supportedTravelModes:v,defaultTravelMode:y}}async function br(e,r,o){try{const i=Se({f:"json",token:r},o),n=Pe(e)+"/retrieveTravelModes",{data:{supportedTravelModes:d,defaultTravelMode:u}}=await ne(n,i);return{supportedTravelModes:d,defaultTravelMode:u}}catch(i){throw new x("network-service:retrieveTravelModes","Could not get to the NAServer's retrieveTravelModes.",{error:i})}}const nt=new ht({esriJobMessageTypeInformative:"informative",esriJobMessageTypeProcessDefinition:"process-definition",esriJobMessageTypeProcessStart:"process-start",esriJobMessageTypeProcessStop:"process-stop",esriJobMessageTypeWarning:"warning",esriJobMessageTypeError:"error",esriJobMessageTypeEmpty:"empty",esriJobMessageTypeAbort:"abort"});let pe=class extends M{constructor(e){super(e),this.description=null,this.type=null}};t([s({type:String,json:{write:!0}})],pe.prototype,"description",void 0),t([s({type:String,json:{read:nt.read,write:nt.write}})],pe.prototype,"type",void 0),pe=t([L("esri.rest.support.GPMessage")],pe);const Tr=pe,at=new ht({0:"informative",1:"process-definition",2:"process-start",3:"process-stop",50:"warning",100:"error",101:"empty",200:"abort"});let we=class extends Tr{constructor(e){super(e),this.type=null}};t([s({type:String,json:{read:at.read,write:at.write}})],we.prototype,"type",void 0),we=t([L("esri.rest.support.NAMessage")],we);const Br=we;let ue=class extends M{constructor(e){super(e)}};t([s({json:{read:{source:"string"}}})],ue.prototype,"text",void 0),t([O(rr,{name:"stringType"})],ue.prototype,"type",void 0),ue=t([L("esri.rest.support.DirectionsString")],ue);const Bt=ue;let z=class extends M{constructor(e){super(e),this.arriveTime=null,this.arriveTimeOffset=null,this.geometry=null,this.strings=null}readArriveTimeOffset(e,r){return or(r.ETA,r.arriveTimeUTC)}readGeometry(e,r){return vt.fromJSON(r.point)}};t([s({type:Date,json:{read:{source:"arriveTimeUTC"}}})],z.prototype,"arriveTime",void 0),t([s()],z.prototype,"arriveTimeOffset",void 0),t([j("arriveTimeOffset",["arriveTimeUTC","ETA"])],z.prototype,"readArriveTimeOffset",null),t([s({type:vt})],z.prototype,"geometry",void 0),t([j("geometry",["point"])],z.prototype,"readGeometry",null),t([s({type:[Bt]})],z.prototype,"strings",void 0),z=t([L("esri.rest.support.DirectionsEvent")],z);const Nr=z;function Pr(e){if(A(e)||e==="")return null;let r=0,o=0,i=0,n=0;const d=[];let u,p,f,S,a,b,P,v,y=0,N=0,I=0;if(a=e.match(/((\+|\-)[^\+\-\|]+|\|)/g),a||(a=[]),parseInt(a[y],32)===0){y=2;const B=parseInt(a[y],32);y++,b=parseInt(a[y],32),y++,1&B&&(N=a.indexOf("|")+1,P=parseInt(a[N],32),N++),2&B&&(I=a.indexOf("|",N)+1,v=parseInt(a[I],32),I++)}else b=parseInt(a[y],32),y++;for(;y0,hasM:I>0}}let te=class extends X{constructor(e){super(e),this.events=null,this.strings=null}readGeometry(e,r){const o=Pr(r.compressedGeometry);return h(o)?Re.fromJSON(o):null}};t([s({type:[Nr]})],te.prototype,"events",void 0),t([j("geometry",["compressedGeometry"])],te.prototype,"readGeometry",null),t([s({type:[Bt]})],te.prototype,"strings",void 0),te=t([L("esri.rest.support.DirectionsFeature")],te);const Rr=te;function $r(e,r){if(e.length===0)return new Re({spatialReference:r});const o=[];for(const u of e)for(const p of u.paths)o.push(...p);const i=[];o.forEach((u,p)=>{p!==0&&u[0]===o[p-1][0]&&u[1]===o[p-1][1]||i.push(u)});const{hasM:n,hasZ:d}=e[0];return new Re({hasM:n,hasZ:d,paths:[i],spatialReference:r})}let C=class extends q{constructor(e){super(e),this.extent=null,this.features=null,this.geometryType="polyline",this.routeId=null,this.routeName=null,this.totalDriveTime=null,this.totalLength=null,this.totalTime=null}readFeatures(e,r){var n;if(!e)return[];const o=(n=r.summary.envelope.spatialReference)!=null?n:r.spatialReference,i=o&&K.fromJSON(o);return e.map(d=>{const u=Rr.fromJSON(d);if(h(u.geometry)&&(u.geometry.spatialReference=i),h(u.events))for(const p of u.events)h(p.geometry)&&(p.geometry.spatialReference=i);return u})}get mergedGeometry(){return this.features?$r(this.features.map(({geometry:e})=>ye(e)),this.extent.spatialReference):null}get strings(){return this.features.map(({strings:e})=>e).flat().filter(h)}};t([s({type:wt,json:{read:{source:"summary.envelope"}}})],C.prototype,"extent",void 0),t([s()],C.prototype,"features",void 0),t([j("features")],C.prototype,"readFeatures",null),t([s()],C.prototype,"geometryType",void 0),t([s({readOnly:!0})],C.prototype,"mergedGeometry",null),t([s()],C.prototype,"routeId",void 0),t([s()],C.prototype,"routeName",void 0),t([s({value:null,readOnly:!0})],C.prototype,"strings",null),t([s({json:{read:{source:"summary.totalDriveTime"}}})],C.prototype,"totalDriveTime",void 0),t([s({json:{read:{source:"summary.totalLength"}}})],C.prototype,"totalLength",void 0),t([s({json:{read:{source:"summary.totalTime"}}})],C.prototype,"totalTime",void 0),C=t([L("esri.rest.support.DirectionsFeatureSet")],C);const Ir=C;let k=class extends M{constructor(e){super(e),this.directionLines=null,this.directionPoints=null,this.directions=null,this.route=null,this.routeName=null,this.stops=null,this.traversedEdges=null,this.traversedJunctions=null,this.traversedTurns=null}};t([s({type:q,json:{write:!0}})],k.prototype,"directionLines",void 0),t([s({type:q,json:{write:!0}})],k.prototype,"directionPoints",void 0),t([s({type:Ir,json:{write:!0}})],k.prototype,"directions",void 0),t([s({type:X,json:{write:!0}})],k.prototype,"route",void 0),t([s({type:String,json:{write:!0}})],k.prototype,"routeName",void 0),t([s({type:[X],json:{write:!0}})],k.prototype,"stops",void 0),t([s({type:q,json:{write:!0}})],k.prototype,"traversedEdges",void 0),t([s({type:q,json:{write:!0}})],k.prototype,"traversedJunctions",void 0),t([s({type:q,json:{write:!0}})],k.prototype,"traversedTurns",void 0),k=t([L("esri.rest.support.RouteResult")],k);const Ar=k;function Te(e){return e&&q.fromJSON(e).features.map(r=>r)}let U=class extends M{constructor(e){super(e),this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(e,r){return Te(r.barriers)}readPolylineBarriers(e){return Te(e)}readPolygonBarriers(e){return Te(e)}};t([s({type:[Br]})],U.prototype,"messages",void 0),t([s({type:[X]})],U.prototype,"pointBarriers",void 0),t([j("pointBarriers",["barriers"])],U.prototype,"readPointBarriers",null),t([s({type:[X]})],U.prototype,"polylineBarriers",void 0),t([j("polylineBarriers")],U.prototype,"readPolylineBarriers",null),t([s({type:[X]})],U.prototype,"polygonBarriers",void 0),t([j("polygonBarriers")],U.prototype,"readPolygonBarriers",null),t([s({type:[Ar]})],U.prototype,"routeResults",void 0),U=t([L("esri.rest.support.RouteSolveResult")],U);const jr=U;function fe(e){return e instanceof q}async function Lr(e,r,o){const i=[],n=[],d={},u={},p=ft(e),{path:f}=p;fe(r.stops)&&me(r.stops.features,n,"stops.features",d),fe(r.pointBarriers)&&me(r.pointBarriers.features,n,"pointBarriers.features",d),fe(r.polylineBarriers)&&me(r.polylineBarriers.features,n,"polylineBarriers.features",d),fe(r.polygonBarriers)&&me(r.polygonBarriers.features,n,"polygonBarriers.features",d);const S=await At(n);for(const v in d){const y=d[v];i.push(v),u[v]=S.slice(y[0],y[1])}if(gr(u,i)){let v=null;try{v=await Tt(f,r.apiKey,o)}catch{}v&&!v.hasZ&&wr(u,i)}for(const v in u)u[v].forEach((y,N)=>{r.get(v)[N].geometry=y});const a={...o,query:{...p.query,...sr(r),f:"json"}},b=f.endsWith("/solve")?f:`${f}/solve`,{data:P}=await ne(b,a);return Or(P)}function Or(e){var B;const{barriers:r,directionLines:o,directionPoints:i,directions:n,messages:d,polygonBarriers:u,polylineBarriers:p,routes:f,stops:S,traversedEdges:a,traversedJunctions:b,traversedTurns:P}=e,v=l=>{const g=N.find(R=>R.routeName===l);if(h(g))return g;const w={routeId:N.length+1,routeName:l};return N.push(w),w},y=l=>{const g=N.find(R=>R.routeId===l);if(h(g))return g;const w={routeId:l,routeName:null};return N.push(w),w},N=[];f==null||f.features.forEach((l,g)=>{l.geometry.spatialReference=f.spatialReference;const w=l.attributes.Name,R=g+1;N.push({routeId:R,routeName:w,route:l})}),n==null||n.forEach(l=>{const{routeName:g}=l;v(g).directions=l});const I=((B=S==null?void 0:S.features.every(l=>A(l.attributes.RouteName)))!=null?B:!1)&&N.length>0?N[0].routeName:null;return S==null||S.features.forEach(l=>{var $,D;var g;l.geometry&&(($=(g=l.geometry).spatialReference)!=null||(g.spatialReference=S.spatialReference));const w=I!=null?I:l.attributes.RouteName,R=v(w);(D=R.stops)!=null||(R.stops=[]),R.stops.push(l)}),o==null||o.features.forEach(l=>{var D;const g=l.attributes.RouteID,w=y(g),{geometryType:R,spatialReference:$}=o;(D=w.directionLines)!=null||(w.directionLines={features:[],geometryType:R,spatialReference:$}),w.directionLines.features.push(l)}),i==null||i.features.forEach(l=>{var D;const g=l.attributes.RouteID,w=y(g),{geometryType:R,spatialReference:$}=i;(D=w.directionPoints)!=null||(w.directionPoints={features:[],geometryType:R,spatialReference:$}),w.directionPoints.features.push(l)}),a==null||a.features.forEach(l=>{var D;const g=l.attributes.RouteID,w=y(g),{geometryType:R,spatialReference:$}=a;(D=w.traversedEdges)!=null||(w.traversedEdges={features:[],geometryType:R,spatialReference:$}),w.traversedEdges.features.push(l)}),b==null||b.features.forEach(l=>{var D;const g=l.attributes.RouteID,w=y(g),{geometryType:R,spatialReference:$}=b;(D=w.traversedJunctions)!=null||(w.traversedJunctions={features:[],geometryType:R,spatialReference:$}),w.traversedJunctions.features.push(l)}),P==null||P.features.forEach(l=>{var R;const g=l.attributes.RouteID,w=y(g);(R=w.traversedTurns)!=null||(w.traversedTurns={features:[]}),w.traversedTurns.features.push(l)}),jr.fromJSON({routeResults:N,barriers:r,polygonBarriers:u,polylineBarriers:p,messages:d})}const Dr={type:String,json:{read:{source:"token"},write:{target:"token"}}};let W=class extends je(M){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.geometry=null,this.geometryType=null,this.name=null,this.spatialRelationship=null,this.type="layer",this.where=null}};t([s({type:Boolean,json:{write:!0}})],W.prototype,"doNotLocateOnRestrictedElements",void 0),t([s({types:jt,json:{read:Lt,write:!0}})],W.prototype,"geometry",void 0),t([O(ir)],W.prototype,"geometryType",void 0),t([s({type:String,json:{name:"layerName",write:!0}})],W.prototype,"name",void 0),t([O(nr,{name:"spatialRel"})],W.prototype,"spatialRelationship",void 0),t([s({type:String,json:{write:!0}})],W.prototype,"type",void 0),t([s({type:String,json:{write:!0}})],W.prototype,"where",void 0),W=t([L("esri.rest.support.DataLayer")],W);const Jr=W;var $e;let ge=$e=class extends q{constructor(e){super(e),this.doNotLocateOnRestrictedElements=null}clone(){return new $e({doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements,...this.cloneProperties()})}};t([s({type:Boolean,json:{write:!0}})],ge.prototype,"doNotLocateOnRestrictedElements",void 0),ge=$e=t([L("esri.rest.support.NetworkFeatureSet")],ge);const _r=ge;let ce=class extends je(M){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.url=null}};t([s({type:Boolean,json:{write:!0}})],ce.prototype,"doNotLocateOnRestrictedElements",void 0),t([s({type:String,json:{write:!0}})],ce.prototype,"url",void 0),ce=t([L("esri.rest.support.NetworkUrl")],ce);const Cr=ce;var Ie;function Mr(e){return e&&"type"in e}function kr(e){return e&&"features"in e&&"doNotLocateOnRestrictedElements"in e}function xr(e){return e&&"url"in e}function Fr(e){return e&&"features"in e}function Er(e){return Mr(e)?Jr.fromJSON(e):xr(e)?Cr.fromJSON(e):kr(e)?_r.fromJSON(e):Fr(e)?q.fromJSON(e):null}function he(e,r,o){h(e)&&(r[o]=_.isCollection(e)?{features:e.toArray().map(i=>i.toJSON())}:e.toJSON())}let c=Ie=class extends je(M){constructor(e){super(e),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(e){return Ot(Ie,e)}readAccumulateAttributes(e){return A(e)?null:e.map(r=>ee.fromJSON(r))}writeAccumulateAttributes(e,r,o){!A(e)&&e.length&&(r[o]=e.map(i=>ee.toJSON(i)))}writePointBarriers(e,r,o){he(e,r,o)}writePolygonBarrier(e,r,o){he(e,r,o)}writePolylineBarrier(e,r,o){he(e,r,o)}readRestrictionAttributes(e){return A(e)?null:e.map(r=>it.fromJSON(r))}writeRestrictionAttributes(e,r,o){!A(e)&&e.length&&(r[o]=e.map(i=>it.toJSON(i)))}readStartTime(e,r){const{startTime:o}=r;return A(o)?null:o==="now"?"now":new Date(o)}writeStartTime(e,r){A(e)||(r.startTime=e==="now"?"now":e.getTime())}readStops(e,r){return Er(r.stops)}writeStops(e,r,o){he(e,r,o)}};t([s({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],c.prototype,"accumulateAttributes",void 0),t([j("accumulateAttributes")],c.prototype,"readAccumulateAttributes",null),t([V("accumulateAttributes")],c.prototype,"writeAccumulateAttributes",null),t([s(Dr)],c.prototype,"apiKey",void 0),t([s({json:{write:!0}})],c.prototype,"attributeParameterValues",void 0),t([s({type:String,json:{write:!0}})],c.prototype,"directionsLanguage",void 0),t([O(Oe)],c.prototype,"directionsLengthUnits",void 0),t([O(ar)],c.prototype,"directionsOutputType",void 0),t([O(lr)],c.prototype,"directionsStyleName",void 0),t([O(Le,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],c.prototype,"directionsTimeAttribute",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"findBestSequence",void 0),t([s({type:Number,json:{write:!0}})],c.prototype,"geometryPrecision",void 0),t([s({type:Number,json:{write:!0}})],c.prototype,"geometryPrecisionM",void 0),t([s({type:Number,json:{write:!0}})],c.prototype,"geometryPrecisionZ",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"ignoreInvalidLocations",void 0),t([O(ee,{name:"impedanceAttributeName",ignoreUnknown:!1})],c.prototype,"impedanceAttribute",void 0),t([s({type:Number,json:{write:!0}})],c.prototype,"outputGeometryPrecision",void 0),t([O(pr)],c.prototype,"outputGeometryPrecisionUnits",void 0),t([O(ur)],c.prototype,"outputLines",void 0),t([s({type:K,json:{name:"outSR",write:!0}})],c.prototype,"outSpatialReference",void 0),t([s({json:{write:!0}})],c.prototype,"overrides",void 0),t([s({json:{name:"barriers",write:!0}})],c.prototype,"pointBarriers",void 0),t([V("pointBarriers")],c.prototype,"writePointBarriers",null),t([s({json:{write:!0}})],c.prototype,"polygonBarriers",void 0),t([V("polygonBarriers")],c.prototype,"writePolygonBarrier",null),t([s({json:{write:!0}})],c.prototype,"polylineBarriers",void 0),t([V("polylineBarriers")],c.prototype,"writePolylineBarrier",null),t([s({type:Boolean,json:{write:!0}})],c.prototype,"preserveFirstStop",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"preserveLastStop",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"preserveObjectID",void 0),t([s({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],c.prototype,"restrictionAttributes",void 0),t([j("restrictionAttributes")],c.prototype,"readRestrictionAttributes",null),t([V("restrictionAttributes")],c.prototype,"writeRestrictionAttributes",null),t([O(cr)],c.prototype,"restrictUTurns",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnBarriers",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnDirections",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnPolygonBarriers",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnPolylineBarriers",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnRoutes",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnStops",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnTraversedEdges",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnTraversedJunctions",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnTraversedTurns",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"returnZ",void 0),t([s({type:Date,json:{type:Number,write:!0}})],c.prototype,"startTime",void 0),t([j("startTime")],c.prototype,"readStartTime",null),t([V("startTime")],c.prototype,"writeStartTime",null),t([s({type:Boolean,json:{write:!0}})],c.prototype,"startTimeIsUTC",void 0),t([s({json:{write:!0}})],c.prototype,"stops",void 0),t([j("stops")],c.prototype,"readStops",null),t([V("stops")],c.prototype,"writeStops",null),t([s({type:Boolean,json:{write:!0}})],c.prototype,"timeWindowsAreUTC",void 0),t([s({type:gt,json:{write:!0}})],c.prototype,"travelMode",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"useHierarchy",void 0),t([s({type:Boolean,json:{write:!0}})],c.prototype,"useTimeWindows",void 0),c=Ie=t([L("esri.rest.support.RouteParameters")],c);const lt=c;function Be(e){return e.length?e:null}function Nt(e){const{defaultTravelMode:r,supportedTravelModes:o}=e;return o==null?void 0:o.find(({id:i})=>i===r)}function Ae(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:Ae("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:Ae("esriGeometryPolyline")}}}function ve(e){return"layers"in e}function Ur(e){return e.declaredClass==="esri.rest.support.FeatureSet"}function Gr(e){return e.declaredClass==="esri.rest.support.NetworkFeatureSet"}function Wr(e,r,o){var De,Je,_e,Ce,Me,ke,xe,Fe,Ee,Ue,Ge,We,qe,Ze,ze,Ve,Ke,He,Ye,Qe,Xe,et;const i=(De=r.networkDataset)==null?void 0:De.networkAttributes,n=(Je=i==null?void 0:i.filter(m=>m.usageType==="cost"))!=null?Je:[],d=Nt(r),u=(_e=o.travelMode)!=null?_e:d;if(A(u))return void Rt.warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:p,distanceAttributeName:f}=u,S=n.find(m=>m.name===p),a=n.find(m=>m.name===f),b=(ke=(Me=(Ce=ye(o.travelMode))==null?void 0:Ce.impedanceAttributeName)!=null?Me:ye(o.impedanceAttribute))!=null?ke:r.impedance,P=yr.fromJSON(S==null?void 0:S.units),v=Oe.fromJSON(a==null?void 0:a.units);if(!P||!v)throw new x("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const y=(xe=o.directionsLanguage)!=null?xe:r.directionsLanguage,N=(Ee=(Fe=ye(o.accumulateAttributes))!=null?Fe:r.accumulateAttributeNames)!=null?Ee:[],I=new Set(n.filter(({name:m})=>m===p||m===f||m===b||m!=null&&N.includes(m)).map(({name:m})=>m)),B=m=>{for(const tt in m)I.has(tt)||delete m[tt]};for(const m of e.pointBarriers)h(m.costs)&&(m.addedCost=(Ue=m.costs[b])!=null?Ue:0,B(m.costs));for(const m of e.polygonBarriers)h(m.costs)&&(m.scaleFactor=(Ge=m.costs[b])!=null?Ge:1,B(m.costs));for(const m of e.polylineBarriers)h(m.costs)&&(m.scaleFactor=(We=m.costs[b])!=null?We:1,B(m.costs));const{routeInfo:l}=e,{findBestSequence:g,preserveFirstStop:w,preserveLastStop:R,startTimeIsUTC:$,timeWindowsAreUTC:D}=o;l.analysisSettings=new dr({accumulateAttributes:N,directionsLanguage:y,findBestSequence:g,preserveFirstStop:w,preserveLastStop:R,startTimeIsUTC:$,timeWindowsAreUTC:D,travelMode:u}),l.totalDuration=Q((qe=l.totalCosts[p])!=null?qe:0,P),l.totalDistance=Ne((Ze=l.totalCosts[f])!=null?Ze:0,v),l.totalLateDuration=Q((ze=l.totalViolations[p])!=null?ze:0,P),l.totalWaitDuration=Q((Ve=l.totalWait[p])!=null?Ve:0,P),h(l.totalCosts)&&B(l.totalCosts),h(l.totalViolations)&&B(l.totalViolations),h(l.totalWait)&&B(l.totalWait);for(const m of e.stops)h(m.serviceCosts)&&(m.serviceDuration=Q((Ke=m.serviceCosts[p])!=null?Ke:0,P),m.serviceDistance=Ne((He=m.serviceCosts[f])!=null?He:0,v),B(m.serviceCosts)),h(m.cumulativeCosts)&&(m.cumulativeDuration=Q((Ye=m.cumulativeCosts[p])!=null?Ye:0,P),m.cumulativeDistance=Ne((Qe=m.cumulativeCosts[f])!=null?Qe:0,v),B(m.cumulativeCosts)),h(m.violations)&&(m.lateDuration=Q((Xe=m.violations[p])!=null?Xe:0,P),B(m.violations)),h(m.wait)&&(m.waitDuration=Q((et=m.wait[p])!=null?et:0,P),B(m.wait))}async function pt(e){const r=K.WGS84;return await Kt(e.spatialReference,r),Ht(e,r)}function Q(e,r){switch(r){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function Ne(e,r){return r==="decimal-degrees"||r==="points"||r==="unknown"?e:Yt(e,r,"meters")}function qr(e){const{attributes:r,geometry:o,popupTemplate:i,symbol:n}=e.toGraphic().toJSON();return{attributes:r,geometry:o,popupInfo:i,symbol:n}}const Zr=_.ofType(ae),zr=_.ofType(le),ut=_.ofType(re),ct=_.ofType(oe),yt=_.ofType(se),dt=_.ofType(ie),Pt="esri.layers.RouteLayer",Rt=mt.getLogger(Pt);let T=class extends Dt(Jt(_t(Ct(Mt(kt(Qt)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new bt,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ut,this.polygonBarriers=new ct,this.polylineBarriers=new yt,this.routeInfo=null,this.spatialReference=K.WGS84,this.stops=new dt,this.type="route";const r=()=>{this._setStopSymbol(this.stops)};this.addHandles(xt(()=>this.stops,"change",r,{sync:!0,onListenerAdd:r}))}writeFeatureCollectionWebmap(e,r,o,i){const n=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter(p=>!!p),d=n.map((p,f)=>f),u=i.origin==="web-map"?"featureCollection.layers":"layers";Ft(u,n,r),r.opacity=this.opacity,r.visibility=this.visible,r.visibleLayers=d}readDirectionLines(e,r){return this._getNetworkFeatures(r,"DirectionLines",o=>ae.fromGraphic(o))}readDirectionPoints(e,r){return this._getNetworkFeatures(r,"DirectionPoints",o=>le.fromGraphic(o))}get fullExtent(){var n;const e=new wt({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:K.WGS84});if(h(this.routeInfo)&&h(this.routeInfo.geometry))return(n=this.routeInfo.geometry.extent)!=null?n:e;if(A(this.stops))return e;const r=this.stops.filter(d=>h(d.geometry));if(r.length<2)return e;const{spatialReference:o}=r.getItemAt(0).geometry;if(A(o))return e;const i=r.toArray().map(d=>{const u=d.geometry;return[u.x,u.y]});return new Et({points:i,spatialReference:o}).extent}readMaxScale(e,r){var o,i;return(i=(o=(ve(r)?r.layers:r.featureCollection.layers).find(n=>h(n.layerDefinition.maxScale)))==null?void 0:o.layerDefinition.maxScale)!=null?i:0}readMinScale(e,r){var o,i;return(i=(o=(ve(r)?r.layers:r.featureCollection.layers).find(n=>h(n.layerDefinition.minScale)))==null?void 0:o.layerDefinition.minScale)!=null?i:0}readPointBarriers(e,r){return this._getNetworkFeatures(r,"Barriers",o=>re.fromGraphic(o))}readPolygonBarriers(e,r){return this._getNetworkFeatures(r,"PolygonBarriers",o=>oe.fromGraphic(o))}readPolylineBarriers(e,r){return this._getNetworkFeatures(r,"PolylineBarriers",o=>se.fromGraphic(o))}readRouteInfo(e,r){const o=this._getNetworkFeatures(r,"RouteInfo",i=>de.fromGraphic(i));return o.length>0?o.getItemAt(0):null}readSpatialReference(e,r){var p,f,S,a,b;const o=ve(r)?r.layers:r.featureCollection.layers;if(!o.length)return K.WGS84;const{layerDefinition:i,featureSet:n}=o[0],d=n.features[0],u=(b=(a=(S=(f=(p=ye(d==null?void 0:d.geometry))==null?void 0:p.spatialReference)!=null?f:n.spatialReference)!=null?S:i.spatialReference)!=null?a:i.extent.spatialReference)!=null?b:rt;return K.fromJSON(u)}readStops(e,r){return this._getNetworkFeatures(r,"Stops",o=>ie.fromGraphic(o),o=>this._setStopSymbol(o))}get title(){return h(this.routeInfo)&&h(this.routeInfo.name)?this.routeInfo.name:"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return ot.routeServiceUrl}set url(e){e!=null?this._set("url",Ut(e,Rt)):this._set("url",ot.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){h(this.directionLines)&&(this.directionLines.removeAll(),this._set("directionLines",null)),h(this.directionPoints)&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),h(this.routeInfo)&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:r}=this;if(!r)throw new x("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!r.id)throw new x("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if(r.type!=="Feature Collection")throw new x("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(A(this.routeInfo))throw new x("routelayer:route-unsolved","save() requires a solved route");const{portal:o}=r;await o._signIn(),o.user||await r.reload();const{itemUrl:i,itemControl:n}=r;if(n!=="admin"&&n!=="update")throw new x("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const d={messages:[],origin:"portal-item",portal:o,url:i&&Gt(i),writtenProperties:[]},u=this.write(null,d);return r.extent=await pt(e),r.title=this.title,await r.update({data:u}),r}async saveAs(e,r={}){var p,f,S;if(await this.load(),A(this.routeInfo))throw new x("routelayer:route-unsolved","saveAs() requires a solved route");const o=Wt.from(e).clone();(p=o.extent)!=null||(o.extent=await pt(this.fullExtent)),o.id=null,(f=o.portal)!=null||(o.portal=qt.getDefault()),(S=o.title)!=null||(o.title=this.title),o.type="Feature Collection",o.typeKeywords=["Data","Feature Collection",er.MULTI_LAYER,"Route Layer"];const{portal:i}=o,n={messages:[],origin:"portal-item",portal:i,url:null,writtenProperties:[]};await i._signIn();const d=r==null?void 0:r.folder,u=this.write(null,n);return await i.user.addItem({item:o,folder:d,data:u}),this.portalItem=o,Xt(n),n.portalItem=o,o}async solve(e,r){var B,l,g,w,R;const o=(B=e==null?void 0:e.stops)!=null?B:this.stops,i=(l=e==null?void 0:e.pointBarriers)!=null?l:Be(this.pointBarriers),n=(g=e==null?void 0:e.polylineBarriers)!=null?g:Be(this.polylineBarriers),d=(w=e==null?void 0:e.polygonBarriers)!=null?w:Be(this.polygonBarriers);if(A(o))throw new x("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Ur(o)||Gr(o))&&o.features.length<2||_.isCollection(o)&&o.length<2)throw new x("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(_.isCollection(o))for(const $ of o)$.routeName=null;const u=e==null?void 0:e.apiKey,p=this.url,f=await this._getServiceDescription(p,u,r),S=Nt(f),a=(R=e==null?void 0:e.travelMode)!=null?R:S,b=st(e==null?void 0:e.accumulateAttributes,[]);h(a)&&(b.push(a.distanceAttributeName),a.timeAttributeName&&b.push(a.timeAttributeName));const P={startTime:new Date},v={accumulateAttributes:b,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:i,polylineBarriers:n,polygonBarriers:d,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!i,returnDirections:!0,returnPolygonBarriers:!!d,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:o},y=e?lt.from(e):new lt;for(const $ in P)y[$]==null&&(y[$]=P[$]);let N;y.set(v);try{N=await Lr(p,y,r)}catch($){throw Zt($)?$:new x("routelayer:failed-route-request","the routing request failed",{error:$})}const I=this._toRouteLayerSolution(N);return this._isOverridden("title")||(this.title=st(I.routeInfo.name,"Route")),Wr(I,f,y),I}update(e){const{stops:r,directionLines:o,directionPoints:i,pointBarriers:n,polylineBarriers:d,polygonBarriers:u,routeInfo:p}=e;this.set({stops:r,pointBarriers:n,polylineBarriers:d,polygonBarriers:u}),this._set("directionLines",o),this._set("directionPoints",i),this._set("routeInfo",p),h(p.geometry)&&(this.spatialReference=p.geometry.spatialReference)}_getNetworkFeatures(e,r,o,i){var y,N,I;const n=(ve(e)?e.layers:e.featureCollection.layers).find(B=>B.layerDefinition.name===r);if(A(n))return new _;const{layerDefinition:d,popupInfo:u,featureSet:p}=n,f=d.drawingInfo.renderer,{features:S}=p,a=(I=(N=(y=p.spatialReference)!=null?y:d.spatialReference)!=null?N:d.extent.spatialReference)!=null?I:rt,b=f&&zt(f),P=K.fromJSON(a),v=S.map(B=>{var w,R,$;const l=X.fromJSON(B);h(l.geometry)&&h(B.geometry)&&A(B.geometry.spatialReference)&&(l.geometry.spatialReference=P);const g=o(l);return(R=g.symbol)!=null||(g.symbol=(w=b==null?void 0:b.getSymbol(l))!=null?w:this._getNetworkSymbol(r)),($=g.popupTemplate)!=null||(g.popupTemplate=u&&Vt.fromJSON(u)),g});return i&&v.some(B=>!B.symbol)&&i(v),new _(v)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,r,o){if(h(this._cachedServiceDescription)&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const i=await Tt(e,r,o);return this._cachedServiceDescription={serviceDescription:i,url:e},i}_setStopSymbol(e){if(!e||e.length===0||A(this.defaultSymbols.stops)||e.every(a=>h(a.symbol)))return;const{first:r,last:o,middle:i,unlocated:n,waypoint:d,break:u}=this.defaultSymbols.stops;if(A(this.routeInfo)||e.length===1)return void e.forEach((a,b)=>{switch(b){case 0:a.symbol=r;break;case e.length-1:a.symbol=o;break;default:a.symbol=i}});const p=e.map(a=>a.sequence).filter(a=>h(a)),f=Math.min(...p),S=Math.max(...p);for(const a of e)a.sequence!==f?a.sequence!==S?a.status==="ok"||a.status==="not-located-on-closest"?a.locationType!=="waypoint"?a.locationType!=="break"?a.symbol=i:a.symbol=u:a.symbol=d:a.symbol=n:a.symbol=o:a.symbol=r}_toRouteLayerSolution(e){var f,S,a,b,P;const r=e.routeResults[0].stops.map(v=>ie.fromJSON(v.toJSON()));this._setStopSymbol(r);const o=new dt(r),i=new ct((f=e.polygonBarriers)==null?void 0:f.map(v=>{const y=oe.fromJSON(v.toJSON());return y.symbol=this.defaultSymbols.polygonBarriers,y})),n=new yt((S=e.polylineBarriers)==null?void 0:S.map(v=>{const y=se.fromJSON(v.toJSON());return y.symbol=this.defaultSymbols.polylineBarriers,y})),d=new ut((a=e.pointBarriers)==null?void 0:a.map(v=>{const y=re.fromJSON(v.toJSON());return y.symbol=this.defaultSymbols.pointBarriers,y})),u=de.fromJSON(e.routeResults[0].route.toJSON());u.symbol=this.defaultSymbols.routeInfo;const p=new zr((b=e.routeResults[0].directionPoints)==null?void 0:b.features.map(v=>{const y=le.fromJSON(v.toJSON());return y.symbol=this.defaultSymbols.directionPoints,y}));return{directionLines:new Zr((P=e.routeResults[0].directionLines)==null?void 0:P.features.map(v=>{const y=ae.fromJSON(v.toJSON());return y.symbol=this.defaultSymbols.directionLines,y})),directionPoints:p,pointBarriers:d,polygonBarriers:i,polylineBarriers:n,routeInfo:u,stops:o}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",ae.fields,ae.popupInfo,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",le.fields,le.popupInfo,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,r,o,i,n,d,u){if(A(e)||!e.length)return null;const p=this.spatialReference.toJSON(),{fullExtent:f,maxScale:S,minScale:a}=this;return{featureSet:{features:e.toArray().map(b=>qr(b)),geometryType:o,spatialReference:p},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:h(r)?r.toJSON():Ae(o)}},extent:f.toJSON(),fields:i,geometryType:o,hasM:!1,hasZ:!1,maxScale:S,minScale:a,name:d,objectIdField:"ObjectID",spatialReference:p,title:u,type:"Feature Layer",typeIdField:""},popupInfo:n}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",re.fields,re.popupInfo,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",oe.fields,oe.popupInfo,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",se.fields,se.popupInfo,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(h(this.routeInfo)?new _([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",de.fields,de.popupInfo,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",ie.fields,ie.popupInfo,"Stops","Stops");if(A(e))return null;const{stops:r}=this.defaultSymbols,o=h(r)&&h(r.first)&&r.first.toJSON(),i=h(r)&&h(r.middle)&&r.middle.toJSON(),n=h(r)&&h(r.last)&&r.last.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:i,uniqueValueInfos:[{value:"1",symbol:o,label:"First Stop"},{value:`${this.stops.length}`,symbol:n,label:"Last Stop"}]},e}};t([s({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:this.portalItem==null}}}}}}})],T.prototype,"_featureCollection",void 0),t([V(["web-map","portal-item"],"_featureCollection")],T.prototype,"writeFeatureCollectionWebmap",null),t([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:this.portalItem!=null}}}}}}})],T.prototype,"_type",void 0),t([s({nonNullable:!0,type:bt})],T.prototype,"defaultSymbols",void 0),t([s({readOnly:!0})],T.prototype,"directionLines",void 0),t([j(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],T.prototype,"readDirectionLines",null),t([s({readOnly:!0})],T.prototype,"directionPoints",void 0),t([j(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],T.prototype,"readDirectionPoints",null),t([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],T.prototype,"featureCollectionType",void 0),t([s({readOnly:!0})],T.prototype,"fullExtent",null),t([s({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],T.prototype,"legendEnabled",void 0),t([s({type:["show","hide"]})],T.prototype,"listMode",void 0),t([s({type:Number,nonNullable:!0,json:{write:!1}})],T.prototype,"maxScale",void 0),t([j(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],T.prototype,"readMaxScale",null),t([s({type:Number,nonNullable:!0,json:{write:!1}})],T.prototype,"minScale",void 0),t([j(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],T.prototype,"readMinScale",null),t([s({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],T.prototype,"operationalLayerType",void 0),t([s({nonNullable:!0,type:_.ofType(re)})],T.prototype,"pointBarriers",void 0),t([j(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],T.prototype,"readPointBarriers",null),t([s({nonNullable:!0,type:_.ofType(oe)})],T.prototype,"polygonBarriers",void 0),t([j(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],T.prototype,"readPolygonBarriers",null),t([s({nonNullable:!0,type:_.ofType(se)})],T.prototype,"polylineBarriers",void 0),t([j(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],T.prototype,"readPolylineBarriers",null),t([s({readOnly:!0})],T.prototype,"routeInfo",void 0),t([j(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],T.prototype,"readRouteInfo",null),t([s({type:K})],T.prototype,"spatialReference",void 0),t([j(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],T.prototype,"readSpatialReference",null),t([s({nonNullable:!0,type:_.ofType(ie)})],T.prototype,"stops",void 0),t([j(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],T.prototype,"readStops",null),t([s()],T.prototype,"title",null),t([s({readOnly:!0,json:{read:!1}})],T.prototype,"type",void 0),t([s()],T.prototype,"url",null),T=t([L(Pt)],T);const Xr=T;export{Xr as default};