/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../webgl/Geometry"],(function(e){"use strict";var t;return function(e){e[e.moveTo=1]="moveTo",e[e.lineTo=2]="lineTo",e[e.close=7]="close"}(t||(t={})),function(){function s(e,t){this.values={};const s=t.keys,o=t.values;for(;e.next();)switch(e.tag()){case 1:this.id=e.getUInt64();break;case 2:{const t=e.getMessage(),n=this.values;for(;!t.empty();){const e=t.getUInt32(),r=t.getUInt32();n[s[e]]=o[r]}t.release();break}case 3:this.type=e.getUInt32();break;case 4:this._pbfGeometry=e.getMessage();break;default:e.skip()}}return s.prototype.getGeometry=function(s){if(void 0!==this._geometry)return this._geometry;if(!this._pbfGeometry)return null;const o=this._pbfGeometry;let n,r;this._pbfGeometry=null,s?s.reset(this.type):n=[];let i,a=t.moveTo,l=0,c=0,u=0;for(;!o.empty();){if(0===l){const e=o.getUInt32();a=7&e,l=e>>3}switch(l--,a){case t.moveTo:c+=o.getSInt32(),u+=o.getSInt32(),s?s.moveTo(c,u):(r&&n.push(r),r=[],r.push(new e.Point(c,u)));break;case t.lineTo:c+=o.getSInt32(),u+=o.getSInt32(),s?s.lineTo(c,u):r.push(new e.Point(c,u));break;case t.close:s?s.close():r&&!r[0].equals(c,u)&&r.push(r[0].clone());break;default:throw o.release(),new Error("Invalid path operation")}}return s?i=s.result():(r&&n.push(r),i=n),o.release(),this._geometry=i,i},s}()}));
