// All material copyright ESRI, All Rights Reserved, unless otherwise specified.// See https://js.arcgis.com/4.6/esri/copyright.txt for details.//>>builtdefine("require exports ../core/tsSupport/declareExtendsHelper ../core/tsSupport/decorateHelper ../core/accessorSupport/decorators ./Geometry ./SpatialReference ./support/spatialReferenceUtils ./support/webMercatorUtils".split(" "),function(l,v,q,f,d,r,t,u,m){functionp(d){returnd&&("esri.SpatialReference"===d.declaredClass||null!=d.wkid)}varn=[0,0];l=function(l){functionb(a,c,b,g,d){a=l.call(this)||this;a.x=0;a.y=0;a.z=void0;a.m=void0;a.type="point";returna}q(b,l);h=b;b.copy=function(a,c){c.x=a.x;c.y=a.y;c.z=a.z;c.m=a.m;c.spatialReference=Object.isFrozen(a.spatialReference)?a.spatialReference:a.spatialReference.clone()};b.distance=function(a,c){varb=a.x-c.x,g=a.y-c.y;a=a.hasZ&&c.hasZ?a.z-c.z:0;returnMath.sqrt(b*b+g*g+a*a)};b.prototype.normalizeCtorArgs=function(a,c,b,g,d){vare;Array.isArray(a)?(e=a,d=c,a=e[0],c=e[1],b=e[2],g=e[3]):a&&"object"===typeofa?(e=a,a=null!=e.x?e.x:e.longitude,c=null!=e.y?e.y:e.latitude,b=null!=e.z?e.z:e.altitude,g=e.m,(d=e.spatialReference)&&"esri.SpatialReference"!==d.declaredClass&&(d=newt(d)),!e.declaredClass&&d&&d.isWebMercator&&null!=e.longitude&&null!=e.latitude&&(c=m.lngLatToXY(e.longitude,e.latitude,n),a=c[0],c=c[1])):p(b)?(d=b,b=null):p(g)&&(d=g,g=null);a={x:a,y:c};null!=d&&(a.spatialReference=d);null!=b&&(a.z=b);null!=g&&(a.m=g);returna};Object.defineProperty(b.prototype,"hasM",{get:function(){returnvoid0!==this.m},set:function(a){varc=this._get("hasM");a!==c&&(this._set("m",a?0:void0),this._set("hasM",a))},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"hasZ",{get:function(){returnvoid0!==this.z},set:function(a){varc=this._get("hasZ");a!==c&&(this._set("z",a?0:void0),this._set("hasZ",a))},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"latitude",{get:function(){vara=this._get("spatialReference");if(a){if(a.isWebMercator)returnm.xyToLngLat(this.x,this.y,n)[1];if(a.isWGS84)returnthis._get("y")}returnnull},set:function(a){varc=this._get("spatialReference");c&&(c.isWebMercator?this._set("y",m.lngLatToXY(this.x,a,n)[1]):c.isWGS84&&this._set("y",a),this._set("latitude",a))},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"longitude",{get:function(){vara=this._get("spatialReference");if(a){if(a.isWebMercator)returnm.xyToLngLat(this._get("x"),this._get("y"),n)[0];if(a.isWGS84)returnthis._get("x")}returnnull},set:function(a){varc=this._get("spatialReference");c&&(c.isWebMercator?this._set("x",m.lngLatToXY(a,this._get("y"),n)[0]):c.isWGS84&&this._set("x",a),this._set("longitude",a))},enumerable:!0,configurable:!0});b.prototype.clone=function(){vara=newh;a.x=this.x;a.y=this.y;a.z=this.z;a.m=this.m;a.spatialReference=this.spatialReference;returna};b.prototype.copy=function(a){h.copy(a,this);returnthis};b.prototype.equals=function(a){if(!a)return!1;varc=this.x,b=this.y,d=this.z,f=this.m,e=this.spatialReference,l=a.z,n=a.m,h=a.x,k=a.y;a=a.spatialReference;if(!e.equals(a))if(e.isWebMercator&&a.isWGS84)k=m.lngLatToXY(h,k),h=k[0],k=k[1],a=e;elseif(e.isWGS84&&a.isWebMercator)k=m.xyToLngLat(h,k),h=k[0],k=k[1],a=e;elsereturn!1;returnc===h&&b===k&&d===l&&f===n&&e.wkid===a.wkid};b.prototype.offset=function(a,c,b){this.x+=a;this.y+=c;null!=b&&this.hasZ&&(this.z+=b);returnthis};b.prototype.normalize=function(){if(!this.spatialReference)returnthis;vara=u.getInfo(this.spatialReference);if(!a)returnthis;varc=this.x,b=a.valid,a=b[0],d=b[1],b=2*d;c>d?(a=Math.ceil(Math.abs(c-d)/b),c-=a*b):c<a&&(a=Math.ceil(Math.abs(c-a)/b),c+=a*b);this._set("x",c);returnthis};b.prototype.distance=function(a){returnh.distance(this,a)};b.prototype.toArray=function(){vara=this.hasZ,b=this.hasM;returna&&b?[this.x,this.y,this.z,this.m]:a?[this.x,this.y,this.z]:b?[this.x,this.y,this.m]:[this.x,this.y]};b.prototype.toJSON=function(a){returnthis.write(null,a)};f([d.property({dependsOn:["x","y","z","m","spatialReference"]})],b.prototype,"cache",void0);f([d.property({type:Boolean,dependsOn:["m"],json:{write:{enabled:!1,overridePolicy:null}}})],b.prototype,"hasM",null);f([d.property({type:Boolean,dependsOn:["z"],json:{write:{enabled:!1,overridePolicy:null}}})],b.prototype,"hasZ",null);f([d.property({type:Number,dependsOn:["y"]})],b.prototype,"latitude",null);f([d.property({type:Number,dependsOn:["x"]})],b.prototype,"longitude",null);f([d.property({type:Number,json:{write:{isRequired:!0}}})],b.prototype,"x",void0);f([d.property({type:Number,json:{write:!0}})],b.prototype,"y",void0);f([d.property({type:Number,json:{write:{overridePolicy:function(){return{enabled:this.hasZ}}}}})],b.prototype,"z",void0);f([d.property({type:Number,json:{write:{overridePolicy:function(){return{enabled:this.hasM}}}}})],b.prototype,"m",void0);returnb=h=f([d.subclass("esri.geometry.Point")],b);varh}(d.declared(r));l.prototype.toJSON.isDefaultToJSON=!0;returnl});