text: // COPYRIGHT © 2021 Esri
  //
  // All rights reserved under the copyright laws of the United States
  // and applicable international laws, treaties, and conventions.
  //
  // This material is licensed for use under the Esri Master License
  // Agreement (MLA), and is bound by the terms of that agreement.
  // You may redistribute and use this code without modification,
  // provided you adhere to the terms of the MLA and include this
  // copyright notice.
  //
  // See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english
  //
  // For additional information, contact:
  // Environmental Systems Research Institute, Inc.
  // Attn: Contracts and Legal Services Department
  // 380 New York Street
  // Redlands, California, USA 92373
  // USA
  //
  // email: contracts@esri.com
  //
  // See http://js.arcgis.com/3.37/esri/copyright.txt for details.
  
  define("require exports esri/kernel module esri/geometry/Geometry esri/geometry/Polygon esri/geometry/Polyline esri/geometry/Point esri/geometry/Extent esri/geometry/Multipoint esri/workers/WorkerClient esri/arcade/polyfill/promiseUtils".split(" "),function(F,T,N,O,z,G,H,E,I,J,P,p){function Q(b){if(void 0===E.fromJson){if(void 0!==b.x&&void 0!==b.y)return new E(b);if(void 0!==b.paths)return new H(b);if(void 0!==b.rings)return new G(b);if(void 0!==b.points)return new J(b);if(void 0!==b.xmin&&void 0!==
  b.ymin&&void 0!==b.xmax&&void 0!==b.ymax)return new I(b)}else{if(void 0!==b.x&&void 0!==b.y)return E.fromJson(b);if(void 0!==b.paths)return H.fromJson(b);if(void 0!==b.rings)return G.fromJson(b);if(void 0!==b.points)return J.fromJson(b);if(void 0!==b.xmin&&void 0!==b.ymin&&void 0!==b.xmax&&void 0!==b.ymax)return I.fromJson(b)}}function v(b,a){if(null==b||void 0===b||"number"===typeof b)return b;var c=b.toString();if(""===c)return null;if(2==a){var e=R[c];if(void 0!==e)return e}else if(0==a){e=K[c];
  if(void 0!==e)return e;e=L[b];if(void 0!==e)return e}else if(3==a&&(e=K[c],void 0!==e))return e;if(1==a&&(e=L[b],void 0!==e))return e;if(!0===/^\d+$/.test(c))return parseInt(c);throw Error("Unrecognised Unit Type");}function B(b){if(void 0!==b&&null!==b)switch(b){case "loxodrome":return 1;case "great-elliptic":return 2;case "normal-section":return 3;case "shape-preserving":return 4}return 0}function l(b){if(null===b||void 0===b)return null;if(A)switch(b.type){case "point":return{x:b.x,y:b.y,z:b.z,
  m:b.m};case "multipoint":return{points:b.points,hasZ:b.hasZ,hasM:b.hasM};case "polyline":return{paths:b.paths,hasZ:b.hasZ,hasM:b.hasM};case "polygon":return{rings:b.rings,hasZ:b.hasZ,hasM:b.hasM};case "extent":return{xmin:b.xmin,ymin:b.ymin,xmax:b.xmax,ymax:b.ymax,zmin:b.zmin,zmax:b.zmax,mmin:b.mmin,mmax:b.mmax}}else switch(b.type){case "point":return{x:b.x,y:b.y};case "multipoint":return{points:b.points};case "polyline":return{paths:b.paths};case "polygon":return{rings:b.rings};case "extent":return{xmin:b.xmin,
  ymin:b.ymin,xmax:b.xmax,ymax:b.ymax}}return null}function r(b,a){if(null===b)return null;b=Q(b);A?b.set("spatialReference",a):b.setSpatialReference(a);return b}function q(b){return null==b||void 0===b?null:-1!=b.wkid&&null!==b.wkid&&void 0!==b.wkid?{wkid:b.wkid}:""!==b.wkt&&void 0!==b.wkt&&null!==b.wkt?{wkt:b.wkt}:null}function C(b,a,c){return p.create(function(e,g){var f=a.spatialReference;n.g({action:b,geoma:l(a),geomb:l(c),spatialReference:q(a.spatialReference)}).then(function(d){0===d.status?
  g(Error(d.error.message)):e(r(d.result,f))},function(d){g(d)})})}function y(b,a,c){return p.create(function(e,g){n.g({action:b,geoma:l(a),geomb:l(c),spatialReference:q(a.spatialReference)}).then(function(f){0===f.status?g(Error(f.error.message)):e(f.result)},function(f){g(f)})})}var A=0==N.version.indexOf("4."),M;(function(b){b[b.Linear=0]="Linear";b[b.Angular=1]="Angular";b[b.Area=2]="Area";b[b.LinearOrAngular=3]="LinearOrAngular"})(M||(M={}));var K={feet:9002,kilometers:9036,meters:9001,miles:9035,
  "nautical-miles":9030,yards:9096},R={acres:109402,ares:109463,hectares:109401,"square-feet":109405,"square-kilometers":109414,"square-meters":109404,"square-miles":109413,"square-yards":109442},L={degrees:9102,radians:9101},S=function(){function b(){this.i=!0;this.s=null}b.prototype.G=function(a){var c=this;this.s=new P;this.s.setWorker(this.B(),function(){c.i=!1;a()})};b.prototype.B=function(){return F.H?F.H("./geometryenginewebworker"):O.id.replace(/\/[^\/]*$/ig,"/")+"./geometryenginewebworker"};
  return b}(),n=function(){function b(){}b.g=function(a){return p.create(function(c,e){b.o.push({task:a,d:{resolve:c,reject:e}});b.j()})};b.j=function(){if(0<b.o.length){for(var a=null,c=0;c<b.h.length;c++)if(!1===b.h[c].i){a=b.h[c];break}null===a&&b.h.length<b.l&&(c=new S,b.h.push(c),c.G(function(){b.j()}));if(null!==a){var e=this.o.shift();a.i=!0;a.s.postMessage(e.task).then(function(g){a.i=!1;try{e.d.resolve(g)}catch(f){}b.j()},function(g){a.i=!1;try{e.d.reject(g)}catch(f){}b.j()})}}};b.h=[];b.o=
  [];b.l=4;return b}();return function(){function b(){}b._removeAllWorkers=function(){n.h=[]};b._setMaxWorkers=function(a){b._removeAllWorkers();n.l=a};b._getMaxWorkers=function(){return n.l};b._getNumWorkers=function(){return n.h.length};b.extendedSpatialReferenceInfo=function(a){return p.create(function(c,e){n.g({action:"extendedspatialreferenceinfo",spatialReference:q(a)}).then(function(g){0===g.status?e(Error(g.error.message)):c(g.result)},function(g){e(g)})})};b.equals=function(a,c){return null===
  a&&null!==c||null===c&&null!==a?!1:y("equals",a,c)};b.intersects=function(a,c){if(null===a||null===c)throw Error("Illegal Argument Exception");return y("intersects",a,c)};b.touches=function(a,c){if(null===a||null===c)throw Error("Illegal Argument Exception");return y("touches",a,c)};b.within=function(a,c){if(null===a||null===c)throw Error("Illegal Argument Exception");return y("within",a,c)};b.disjoint=function(a,c){if(null===a||null===c)throw Error("Illegal Argument Exception");return y("disjoint",
  a,c)};b.overlaps=function(a,c){if(null===a||null===c)throw Error("Illegal Argument Exception");return y("overlaps",a,c)};b.crosses=function(a,c){if(null===a||null===c)throw Error("Illegal Argument Exception");return y("crosses",a,c)};b.contains=function(a,c){if(null===a||null===c)throw Error("Illegal Argument Exception");return y("contains",a,c)};b.isSimple=function(a){return y("issimple",a,null)};b.clip=function(a,c){return C("clip",a,c)};b.simplify=function(a){return p.create(function(c,e){var g=
  a.spatialReference;n.g({action:"simplify",geoma:l(a),spatialReference:q(a.spatialReference)}).then(function(f){0===f.status?e(Error(f.error.message)):c(r(f.result,g))},function(f){e(f)})})};b.rotate=function(a,c,e){return p.create(function(g,f){var d=a.spatialReference;if(void 0===e||null===e)switch(a.type){case "point":e=a;break;case "extent":e=A?a.get("center"):a.getCenter();break;default:e=A?a.get("extent").get("center"):a.getExtent().getCenter()}n.g({action:"rotate",geoma:l(a),spatialReference:q(a.spatialReference),
  angle:c,rotpt:l(e)}).then(function(k){0===k.status?f(Error(k.error.message)):g(r(k.result,d))},function(k){f(k)})})};b.flipHorizontal=function(a,c){return p.create(function(e,g){var f=a.spatialReference;if(void 0===c||null===c)switch(a.type){case "point":c=a;break;case "extent":c=A?a.get("center"):a.getCenter();break;default:c=A?a.get("extent").get("center"):a.getExtent().getCenter()}n.g({action:"fliph",geoma:l(a),spatialReference:q(a.spatialReference),flippt:l(c)}).then(function(d){0===d.status?
  g(Error(d.error.message)):e(r(d.result,f))},function(d){g(d)})})};b.flipVertical=function(a,c){return p.create(function(e,g){var f=a.spatialReference;if(void 0===c||null===c)switch(a.type){case "point":c=a;break;case "extent":c=A?a.get("center"):a.getCenter();break;default:c=A?a.get("extent").get("center"):a.getExtent().getCenter()}n.g({action:"flipv",geoma:l(a),spatialReference:q(a.spatialReference),flippt:l(c)}).then(function(d){0===d.status?g(Error(d.error.message)):e(r(d.result,f))},function(d){g(d)})})};
  b.distance=function(a,c,e){return p.create(function(g,f){n.g({action:"distance",geoma:l(a),geomb:l(c),spatialReference:q(a.spatialReference),distanceunits:v(e,3)}).then(function(d){0===d.status?f(Error(d.error.message)):g(d.result)},function(d){f(d)})})};b.relate=function(a,c,e){return p.create(function(g,f){n.g({action:"relate",geoma:l(a),geomb:l(c),relation:e,spatialReference:q(a.spatialReference)}).then(function(d){0===d.status?f(Error(d.error.message)):g(d.result)},function(d){f(d)})})};b.nearestCoordinate=
  function(a,c,e){return p.create(function(g,f){var d=a.spatialReference;n.g({action:"nearestcoord",geoma:l(a),geomb:l(c),spatialReference:q(a.spatialReference),testinterior:void 0===e?!0:e}).then(function(k){0===k.status?f(Error(k.error.message)):(k.result.coordinate=r(k.result.coordinate,d),g(k.result))},function(k){f(k)})})};b.nearestVertex=function(a,c){return p.create(function(e,g){var f=a.spatialReference;n.g({action:"nearestvertex",geoma:l(a),geomb:l(c),spatialReference:q(a.spatialReference)}).then(function(d){0===
  d.status?g(Error(d.error.message)):(d.result.coordinate=r(d.result.coordinate,f),e(d.result))},function(d){g(d)})})};b.nearestVertices=function(a,c,e,g){return p.create(function(f,d){var k=a.spatialReference;n.g({action:"nearestvertices",geoma:l(a),geomb:l(c),spatialReference:q(a.spatialReference),searchradius:e,maxreturn:g}).then(function(h){if(0===h.status)d(Error(h.error.message));else{for(var m=0;m<h.result.length;m++)h.result[m].coordinate=r(h.result[m].coordinate,k);f(h.result)}},function(h){d(h)})})};
  b.cut=function(a,c){return p.create(function(e,g){var f=a.spatialReference;n.g({action:"cut",geoma:l(a),geomb:l(c),spatialReference:q(a.spatialReference)}).then(function(d){if(0===d.status)g(Error(d.error.message));else{for(var k=0;k<d.result.length;k++)d.result[k]=r(d.result[k],f);e(d.result)}},function(d){g(d)})})};b.generalize=function(a,c,e,g){return p.create(function(f,d){var k=a.spatialReference;n.g({action:"generalize",geoma:l(a),maxdeviation:c,removedegenerateparts:e,maxdeviationunit:v(g,
  3),spatialReference:q(a.spatialReference)}).then(function(h){0===h.status?d(Error(h.error.message)):f(r(h.result,k))},function(h){d(h)})})};b.densify=function(a,c,e){return p.create(function(g,f){var d=a.spatialReference;n.g({action:"densify",geoma:l(a),maxsegmentlength:c,maxsegmentlengthunit:v(e,3),spatialReference:q(a.spatialReference)}).then(function(k){0===k.status?f(Error(k.error.message)):g(r(k.result,d))},function(k){f(k)})})};b.geodesicDensify=function(a,c,e,g){void 0===g&&(g=0);return p.create(function(f,
  d){var k=a.spatialReference;n.g({action:"geodensify",geoma:l(a),maxsegmentlength:c,maxsegmentlengthunit:v(e,3),spatialReference:q(a.spatialReference),curveType:g}).then(function(h){0===h.status?d(Error(h.error.message)):f(r(h.result,k))},function(h){d(h)})})};b.intersect=function(a,c){return a instanceof z?C("intersect",a,c):b.C(a,c)};b.C=function(a,c){return p.create(function(e,g){for(var f=[],d=0;d<a.length;d++)f.push(l(a[d]));var k=c.spatialReference;n.g({action:"intersectmany",geom:l(c),geometries:f,
  spatialReference:q(c.spatialReference)}).then(function(h){if(0===h.status)g(Error(h.error.message));else{for(var m=0;m<h.result.length;m++)h.result[m]=r(h.result[m],k);e(h.result)}},function(h){g(h)})})};b.difference=function(a,c){return a instanceof z?C("difference",a,c):b.A(a,c)};b.A=function(a,c){return p.create(function(e,g){for(var f=[],d=0;d<a.length;d++)f.push(l(a[d]));var k=c.spatialReference;n.g({action:"differencemany",geom:l(c),geometries:f,spatialReference:q(c.spatialReference)}).then(function(h){if(0===
  h.status)g(Error(h.error.message));else{for(var m=0;m<h.result.length;m++)h.result[m]=r(h.result[m],k);e(h.result)}},function(h){g(h)})})};b.symmetricDifference=function(a,c){return a instanceof z?C("symdifference",a,c):b.F(a,c)};b.F=function(a,c){return p.create(function(e,g){for(var f=[],d=0;d<a.length;d++)f.push(l(a[d]));var k=c.spatialReference;n.g({action:"symdifferencemany",geom:l(c),geometries:f,spatialReference:q(c.spatialReference)}).then(function(h){if(0===h.status)g(Error(h.error.message));
  else{for(var m=0;m<h.result.length;m++)h.result[m]=r(h.result[m],k);e(h.result)}},function(h){g(h)})})};b.union=function(a,c){void 0===c&&(c=null);return p.create(function(e,g){var f=[];if(null===a)e(null);else if(a instanceof z&&(a=[a],null!==c&&a.push(c)),0===a.length)e(null);else{for(var d=0;d<a.length;d++)f.push(l(a[d]));var k=a[0].spatialReference;n.g({action:"unionmany",geometries:f,spatialReference:q(k)}).then(function(h){0===h.status?g(Error(h.error.message)):e(r(h.result,k))},function(h){g(h)})}})};
  b.buffer=function(a,c,e,g){void 0===g&&(g=!1);if(a instanceof z)return p.create(function(h,m){var x=a.spatialReference;n.g({action:"buffer",geoma:l(a),spatialReference:q(a.spatialReference),distance:c,unit:v(e,3),geodesic:!1,geodesicmaxdeviation:NaN,geodesiccurvetype:0}).then(function(t){0===t.status?m(Error(t.error.message)):h(r(t.result,x))},function(t){m(t)})});if("[object Array]"!==Object.prototype.toString.call(c)){for(var f=[],d=0;d<a.length;d++)f.push(c);c=f}if(c.length!=a.length){if(0==c.length)throw Error("Illegal Argument Exception");
  f=[];var k=0;for(d=0;d<a.length;d++)void 0===c[d]?f.push(k):(f.push(c[d]),k=c[d]);c=f}return b.u(a,c,e,!1,g,"geodesic",NaN)};b.geodesicBuffer=function(a,c,e,g,f,d){if(a instanceof z)return p.create(function(x,t){void 0===f&&(f=NaN);var w=a.spatialReference;n.g({action:"buffer",geoma:l(a),spatialReference:q(a.spatialReference),distance:c,unit:v(e,0),geodesic:!0,geodesicmaxdeviation:f,geodesiccurvetype:B(g)}).then(function(u){0===u.status?t(Error(u.error.message)):x(r(u.result,w))},function(u){t(u)})});
  if("[object Array]"!==Object.prototype.toString.call(c)){for(var k=[],h=0;h<a.length;h++)k.push(c);c=k}if(c.length!=a.length){if(0==c.length)throw Error("Illegal Argument Exception");k=[];var m=0;for(h=0;h<a.length;h++)void 0===c[h]?k.push(m):(k.push(c[h]),m=c[h]);c=k}return b.u(a,c,e,!0,g,f,d)};b.u=function(a,c,e,g,f,d,k){return p.create(function(h,m){var x=[];void 0===k&&(k=NaN);if(null===a)h(null);else if(0===a.length)h(null);else{for(var t=0;t<a.length;t++)x.push(l(a[t]));e=g?v(e,0):v(e,3);var w=
  a[0].spatialReference;n.g({action:"buffermany",geometries:x,spatialReference:q(w),distances:c,tounionresults:f,unit:e,geodesic:g,geodesicmaxdeviation:k,geodesiccurvetype:B(d)}).then(function(u){if(0===u.status)m(Error(u.error.message));else{for(var D=0;D<u.result.length;D++)u.result[D]=r(u.result[D],w);h(u.result)}},function(u){m(u)})}})};b.convexHull=function(a,c){void 0===c&&(c=!1);return a instanceof z?p.create(function(e,g){var f=a.spatialReference;n.g({action:"convexhull",geoma:l(a),spatialReference:q(a.spatialReference)}).then(function(d){0===
  d.status?g(Error(d.error.message)):e(r(d.result,f))},function(d){g(d)})}):b.v(a,c)};b.v=function(a,c){return p.create(function(e,g){for(var f=[],d=0;d<a.length;d++)f.push(l(a[d]));var k=0<a.length?a[0].spatialReference:null;n.g({action:"convexhullmany",geometries:f,merge:c}).then(function(h){if(0===h.status)g(Error(h.error.message));else{for(var m=0;m<h.result.length;m++)h.result[m]=r(h.result[m],k);e(h.result)}},function(h){g(h)})})};b.offset=function(a,c,e,g,f,d){var k=0;if(null!=g&&void 0!=g)switch(g){case "round":k=
  0;break;case "bevel":k=1;break;case "miter":k=2;break;case "square":k=3}return a instanceof z?p.create(function(h,m){var x=a.spatialReference;n.g({action:"offset",geoma:l(a),spatialReference:q(a.spatialReference),distance:c,joins:k,bevelratio:f,flattenerror:d,offsetunit:v(e,3)}).then(function(t){0===t.status?m(Error(t.error.message)):h(r(t.result,x))},function(t){m(t)})}):b.D(a,c,e,k,f,d)};b.D=function(a,c,e,g,f,d){return p.create(function(k,h){for(var m=[],x=0;x<a.length;x++)m.push(l(a[x]));var t=
  0<a.length?a[0].spatialReference:null;n.g({action:"offsetmany",geometries:m,spatialReference:q(t),distance:c,joins:g,bevelratio:f,offsetunit:v(e,3),flattenerror:d}).then(function(w){if(0===w.status)h(Error(w.error.message));else{for(var u=0;u<w.result.length;u++)w.result[u]=r(w.result[u],t);k(w.result)}},function(w){h(w)})})};b.planarArea=function(a,c){return p.create(function(e,g){n.g({action:"area",geoma:l(a),unit:v(c,2),spatialReference:q(a.spatialReference)}).then(function(f){0===f.status?g(Error(f.error.message)):
  e(f.result)},function(f){g(f)})})};b.planarLength=function(a,c){return p.create(function(e,g){n.g({action:"length",geoma:l(a),unit:v(c,3),spatialReference:q(a.spatialReference)}).then(function(f){0===f.status?g(Error(f.error.message)):e(f.result)},function(f){g(f)})})};b.geodesicArea=function(a,c,e){return p.create(function(g,f){n.g({action:"geodesicarea",geoma:l(a),unit:v(c,2),geodesiccurvetype:B(e),spatialReference:q(a.spatialReference)}).then(function(d){0===d.status?f(Error(d.error.message)):
  g(d.result)},function(d){f(d)})})};b.geodesicLength=function(a,c,e){return p.create(function(g,f){n.g({action:"geodesiclength",geoma:l(a),unit:v(c,0),geodesiccurvetype:B(e),spatialReference:q(a.spatialReference)}).then(function(d){0===d.status?f(Error(d.error.message)):g(d.result)},function(d){f(d)})})};return b}()});
  