/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import{property as r,subclass as s}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Polyline.js";import p from"./DirectionsEvent.js";import n from"./DirectionsString.js";import{reader as i}from"../../core/accessorSupport/decorators/reader.js";function a(t){if(null==t||""===t)return null;let e=0,r=0,s=0,o=0;const p=[];let n,i,a,l,m,u,c,y,f=0,d=0,h=0;if(m=t.match(/((\+|-)[^+\-|]+|\|)/g),m||(m=[]),0===parseInt(m[f],32)){f=2;const t=parseInt(m[f],32);f++,u=parseInt(m[f],32),f++,1&t&&(d=m.indexOf("|")+1,c=parseInt(m[d],32),d++),2&t&&(h=m.indexOf("|",d)+1,y=parseInt(m[h],32),h++)}else u=parseInt(m[f],32),f++;for(;f<m.length&&"|"!==m[f];){n=parseInt(m[f],32)+e,f++,e=n,i=parseInt(m[f],32)+r,f++,r=i;const t=[n/u,i/u];d&&(l=parseInt(m[d],32)+s,d++,s=l,t.push(l/c)),h&&(a=parseInt(m[h],32)+o,h++,o=a,t.push(a/y)),p.push(t)}return{paths:[p],hasZ:d>0,hasM:h>0}}let l=class extends e{constructor(t){super(t),this.events=null,this.geometry=null,this.strings=null}set attributes(t){super.attributes=t}readGeometry(t,e){const r=a(e.compressedGeometry);return null!=r?o.fromJSON(r):null}};t([r({type:[p]})],l.prototype,"events",void 0),t([r({type:o})],l.prototype,"geometry",void 0),t([i("geometry",["compressedGeometry"])],l.prototype,"readGeometry",null),t([r({type:[n]})],l.prototype,"strings",void 0),l=t([s("esri.rest.support.DirectionsFeature")],l);const m=l;export{m as default};
