!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","esri/geometry/Point","../../Errors","../../Validation"],e)}(function(e,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var m=e("tslib").__importDefault(e("esri/geometry/Point")),g=e("../../Errors"),f=e("../../Validation"),e=(t.prototype.execute=function(s){var l=this;return new Promise(function(o,e){if(!l.geolocation)return e(new g.GenericActivityError("WF0016","Geolocation is not supported."));function t(e){return o({position:new m.default({x:e.coords.longitude,y:e.coords.latitude,spatialReference:{wkid:4326}}),accuracy:e.coords.accuracy,altitude:e.coords.altitude,altitudeAccuracy:e.coords.altitudeAccuracy,heading:e.coords.heading,latitude:e.coords.latitude,longitude:e.coords.longitude,speed:e.coords.speed,timestamp:e.timestamp})}function i(e){return o({errorCode:e.code,errorMessage:e.message})}var c,r,a,n,u,d,e={enableHighAccuracy:f.validation.boolean("enableHighAccuracy",s.enableHighAccuracy,void 0),maximumAge:f.validation.number("maximumAge",s.maximumAge,void 0),timeout:f.validation.number("timeout",s.timeout,2e4)};s.useMultipleReadings?(r=f.validation.number("accuracyThreshold",s.accuracyThreshold,10),a=!1,n=function(){a||(a=!0,l.geolocation.clearWatch(d),clearTimeout(u),c?t(c):i({code:3,message:"A geolocated position could not be obtained before the timeout."}))},u=setTimeout(function(){n()},e.timeout),d=l.geolocation.watchPosition(function(e){(c=!c||e.coords.accuracy<=c.coords.accuracy?e:c).coords.accuracy<=r&&n()},i,e)):l.geolocation.getCurrentPosition(t,i,e)})},t.action="gcx:wf:arcgis::GetCurrentPosition",t.suite="gcx:wf:builtin",t);function t(){this.geolocation=navigator.geolocation}o.GetCurrentPosition=e});