text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See https://js.arcgis.com/4.11/esri/copyright.txt for details.
  //>>built
  define("require exports ../Dictionary ../Feature ../ImmutablePointArray ../languageUtils ../../geometry/Extent ../../geometry/Geometry ../../geometry/Multipoint ../../geometry/Point ../../geometry/Polygon ../../geometry/Polyline ../../geometry/support/jsonUtils ../../geometry/support/coordsUtils".split(" "),function(A,v,l,g,x,d,w,q,r,p,t,u,n,y){Object.defineProperty(v,"__esModule",{value:!0});v.registerFunctions=function(k,m){k.ringisclockwise=function(c,e){return m(c,e,function(b,c,a){d.pcCheck(a,
  1,1);b=[];var f=c=!1;if(null===a[0])return!1;if(d.isArray(a[0])){for(var e=0,g=a[0];e<g.length;e++){var h=g[e];if(h instanceof p)b.push(h.hasZ?h.hasM?[h.x,h.y,h.z,h.m]:[h.x,h.y,h.z]:[h.x,h.y]);else throw Error("Invalid Argument");}0<b.length&&(c=a[0][0].hasZ,f=a[0][0].hasM)}else if(a[0]instanceof x)b=a[0]._elements,0<b.length&&(c=a[0]._hasZ,f=a[0]._hasM);else if(d.isImmutableArray(a[0])){e=0;for(g=a[0].toArray();e<g.length;e++)if(h=g[e],h instanceof p)b.push(h.hasZ?h.hasM?[h.x,h.y,h.z,h.m]:[h.x,h.y,
  h.z]:[h.x,h.y]);else throw Error("Invalid Argument");0<b.length&&(c=a[0].get(0).hasZ,f=a[0].get(0).hasM)}else throw Error("Invalid Argument");return 3>b.length?!1:y.isClockwise(b,f,c)})};k.polygon=function(c,e){return m(c,e,function(b,f,a){d.pcCheck(a,1,1);b=null;if(a[0]instanceof l){if(b=d.fixSpatialReference(g.parseGeometryFromDictionary(a[0]),c.spatialReference),!1===b instanceof t)throw Error("Illegal Parameter");}else b=a[0]instanceof t?n.fromJSON(a[0].toJSON()):d.fixSpatialReference(new t(JSON.parse(a[0])),
  c.spatialReference);if(null!==b&&!1===b.spatialReference.equals(c.spatialReference))throw Error("Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.");return d.fixNullGeometry(b)})};k.polyline=function(c,e){return m(c,e,function(b,f,a){d.pcCheck(a,1,1);b=null;if(a[0]instanceof l){if(b=d.fixSpatialReference(g.parseGeometryFromDictionary(a[0]),c.spatialReference),!1===b instanceof u)throw Error("Illegal Parameter");}else b=a[0]instanceof u?n.fromJSON(a[0].toJSON()):
  d.fixSpatialReference(new u(JSON.parse(a[0])),c.spatialReference);if(null!==b&&!1===b.spatialReference.equals(c.spatialReference))throw Error("Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.");return d.fixNullGeometry(b)})};k.point=function(c,e){return m(c,e,function(b,f,a){d.pcCheck(a,1,1);b=null;if(a[0]instanceof l){if(b=d.fixSpatialReference(g.parseGeometryFromDictionary(a[0]),c.spatialReference),!1===b instanceof p)throw Error("Illegal Parameter");
  }else b=a[0]instanceof p?n.fromJSON(a[0].toJSON()):d.fixSpatialReference(new p(JSON.parse(a[0])),c.spatialReference);if(null!==b&&!1===b.spatialReference.equals(c.spatialReference))throw Error("Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.");return d.fixNullGeometry(b)})};k.multipoint=function(c,e){return m(c,e,function(b,f,a){d.pcCheck(a,1,1);b=null;if(a[0]instanceof l){if(b=d.fixSpatialReference(g.parseGeometryFromDictionary(a[0]),c.spatialReference),
  !1===b instanceof r)throw Error("Illegal Parameter");}else b=a[0]instanceof r?n.fromJSON(a[0].toJSON()):d.fixSpatialReference(new r(JSON.parse(a[0])),c.spatialReference);if(null!==b&&!1===b.spatialReference.equals(c.spatialReference))throw Error("Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.");return d.fixNullGeometry(b)})};k.extent=function(c,e){return m(c,e,function(b,f,a){a=d.autoCastFeatureToGeometry(a);d.pcCheck(a,1,1);b=null;a[0]instanceof l?
  b=d.fixSpatialReference(g.parseGeometryFromDictionary(a[0]),c.spatialReference):a[0]instanceof p?(b={xmin:a[0].x,ymin:a[0].y,xmax:a[0].x,ymax:a[0].y,spatialReference:a[0].spatialReference.toJSON()},a[0].hasZ?(b.zmin=a[0].z,b.zmax=a[0].z):a[0].hasM&&(b.mmin=a[0].m,b.mmax=a[0].m),b=n.fromJSON(b)):b=a[0]instanceof t?n.fromJSON(a[0].extent.toJSON()):a[0]instanceof u?n.fromJSON(a[0].extent.toJSON()):a[0]instanceof r?n.fromJSON(a[0].extent.toJSON()):a[0]instanceof w?n.fromJSON(a[0].toJSON()):d.fixSpatialReference(new w(JSON.parse(a[0])),
  c.spatialReference);if(null!==b&&!1===b.spatialReference.equals(c.spatialReference))throw Error("Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.");return d.fixNullGeometry(b)})};k.geometry=function(c,e){return m(c,e,function(b,f,a){d.pcCheck(a,1,1);b=null;b=a[0]instanceof g?d.fixSpatialReference(a[0].geometry(),c.spatialReference):a[0]instanceof l?d.fixSpatialReference(g.parseGeometryFromDictionary(a[0]),c.spatialReference):d.fixSpatialReference(n.fromJSON(JSON.parse(a[0])),
  c.spatialReference);if(null!==b&&!1===b.spatialReference.equals(c.spatialReference))throw Error("Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.");return d.fixNullGeometry(b)})};k.setgeometry=function(c,e){return m(c,e,function(b,c,a){d.pcCheck(a,2,2);if(a[0]instanceof g){if(!0===a[0].immutable)throw Error("Feature is Immutable");if(a[1]instanceof q||null===a[1])a[0]._geometry=a[1];else throw Error("Illegal Argument");}else throw Error("Illegal Argument");
  return d.voidOperation})};k.feature=function(c,e){return m(c,e,function(b,f,a){if(0===a.length)throw Error("Missing Parameters");b=null;if(1===a.length)if(d.isString(a[0]))b=g.fromJson(JSON.parse(a[0]));else if(a[0]instanceof g)b=g.createFromArcadeFeature(a[0]);else if(a[0]instanceof q)b=g.createFromGraphicLikeObject(a[0],null,null);else if(a[0]instanceof l)b=a[0].hasField("geometry")?a[0].field("geometry"):null,f=a[0].hasField("attributes")?a[0].field("attributes"):null,null!==b&&b instanceof l&&
  (b=g.parseGeometryFromDictionary(b)),null!==f&&(f=g.parseAttributesFromDictionary(f)),b=g.createFromGraphicLikeObject(b,f,null);else throw Error("Illegal Argument");else{if(2===a.length){f=b=null;if(null!==a[0])if(a[0]instanceof q)b=a[0];else if(b instanceof l)b=g.parseGeometryFromDictionary(a[0]);else throw Error("Illegal Argument");if(null!==a[1])if(a[1]instanceof l)f=g.parseAttributesFromDictionary(a[1]);else throw Error("Illegal Argument");}else{b=null;f={};if(null!==a[0])if(a[0]instanceof q)b=
  a[0];else if(b instanceof l)b=g.parseGeometryFromDictionary(a[0]);else throw Error("Illegal Argument");for(var e=1;e<a.length;e+=2){var z=d.toString(a[e]),k=a[e+1];if(null===k||void 0===k||d.isString(k)||isNaN(k)||d.isDate(k)||d.isNumber(k)||d.isBoolean(k)){if(d.isFunctionParameter(k)||!1===d.isSimpleType(k))throw Error("Illegal Argument");f[z]=k===d.voidOperation?null:k}else throw Error("Illegal Argument");}}b=g.createFromGraphicLikeObject(b,f,null)}b._geometry=d.fixSpatialReference(b.geometry(),
  c.spatialReference);b.immutable=!1;return b})};k.dictionary=function(c,e){return m(c,e,function(b,c,a){if(0===a.length)throw Error("Missing Parameters");if(0!==a.length%2)throw Error("Missing Parameters");b={};for(c=0;c<a.length;c+=2){var e=d.toString(a[c]),f=a[c+1];if(null===f||void 0===f||d.isString(f)||isNaN(f)||d.isDate(f)||d.isNumber(f)||d.isBoolean(f)||d.isArray(f)||d.isImmutableArray(f)){if(d.isFunctionParameter(f))throw Error("Illegal Argument");b[e]=f===d.voidOperation?null:f}else throw Error("Illegal Argument");
  }a=new l(b);a.immutable=!1;return a})};k.haskey=function(c,e){return m(c,e,function(b,c,a){d.pcCheck(a,2,2);b=d.toString(a[1]);if(a[0]instanceof g||a[0]instanceof l)return a[0].hasField(b);throw Error("Illegal Argument");})};k.indexof=function(c,e){return m(c,e,function(b,c,a){d.pcCheck(a,2,2);b=a[1];if(d.isArray(a[0])){for(c=0;c<a[0].length;c++)if(d.equalityTest(b,a[0][c]))return c;return-1}if(d.isImmutableArray(a[0])){var e=a[0].length();for(c=0;c<e;c++)if(d.equalityTest(b,a[0].get(c)))return c;
  return-1}throw Error("Illegal Argument");})}}});