@arcgis/core 4.32.0-next.20241206 → 4.32.0-next.20241208

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{geometryMember as e,getNestedOptionalValue as t}from"../containerUtils.js";import n from"../Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as a}from"../executionError.js";import i from"../Feature.js";import o from"../ImmutablePointArray.js";import{B as l,m as s,s as f,M as c,C as m,n as u,v as p,f as h,g as w,k as y,j as R,i as g,b as d,H as P,z as v,F as I}from"../../chunks/languageUtils.js";import{angle2D as b,angleBetween2D as F,bearing2D as O,bearingBetween2D as S,pathsSelfIntersecting as j}from"./centroid.js";import N from"../../geometry/Extent.js";import x from"../../geometry/Geometry.js";import J from"../../geometry/Multipoint.js";import D from"../../geometry/Point.js";import G from"../../geometry/Polygon.js";import k from"../../geometry/Polyline.js";import{isClockwise as Z}from"../../geometry/support/coordsUtils.js";import{fromJSON as z}from"../../geometry/support/jsonUtils.js";import{isArray as W,isString as A,isNumber as M,isBoolean as q}from"../../support/guards.js";function L(L,U){L.ringisclockwise=function(e,t){return U(e,t,((n,i,f)=>{l(f,1,1,e,t);let c=[];if(null===f[0])return!1;if(W(f[0]))for(const o of f[0]){if(!(o instanceof D))throw new r(e,a.InvalidParameter,t);c.push(o.hasZ?o.hasM?[o.x,o.y,o.z,o.m]:[o.x,o.y,o.z]:[o.x,o.y])}else if(f[0]instanceof o)c=f[0]._elements;else{if(!s(f[0]))throw new r(e,a.InvalidParameter,t);for(const n of f[0].toArray()){if(!(n instanceof D))throw new r(e,a.InvalidParameter,t);c.push(n.hasZ?n.hasM?[n.x,n.y,n.z,n.m]:[n.x,n.y,n.z]:[n.x,n.y])}}return!(c.length<3)&&Z(c)}))},L.polygon=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof G==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof G)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new G(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.polyline=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof k==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof k)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new k(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.point=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof D==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof D)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new D(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.multipoint=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof J==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof J)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new J(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.extent=function(e,t){return U(e,t,((o,s,u)=>{u=m(u),l(u,1,1,e,t);let p=null;if(u[0]instanceof n)p=f(i.parseGeometryFromDictionary(u[0],e.spatialReference),e.spatialReference);else if(u[0]instanceof D){const e={xmin:u[0].x,ymin:u[0].y,xmax:u[0].x,ymax:u[0].y,spatialReference:u[0].spatialReference.toJSON()},t=u[0];t.hasZ?(e.zmin=t.z,e.zmax=t.z):t.hasM&&(e.mmin=t.m,e.mmax=t.m),p=z(e)}else if(u[0]instanceof G)p=z(u[0].extent?.toJSON());else if(u[0]instanceof k)p=z(u[0].extent?.toJSON());else if(u[0]instanceof J)p=z(u[0].extent?.toJSON());else if(u[0]instanceof N)p=z(u[0].toJSON());else{const t=JSON.parse(u[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),p=f(new N(t),e.spatialReference)}if(null!==p&&!1===p.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(p)}))},L.geometry=function(e,t){return U(e,t,((o,s,m)=>{l(m,1,1,e,t);let p=null;if(null===m[0])return null;if(u(m[0]))p=f(m[0].geometry(),e.spatialReference);else if(m[0]instanceof n)p=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),p=f(z(t),e.spatialReference)}if(null!==p&&!1===p.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(p)}))},L.setgeometry=function(e,t){return U(e,t,((n,i,o)=>{if(l(o,2,2,e,t),!u(o[0]))throw new r(e,a.InvalidParameter,t);if(!0===o[0].immutable)throw new r(e,a.Immutable,t);if(!(o[1]instanceof x||null===o[1]))throw new r(e,a.InvalidParameter,t);return o[0]._geometry=o[1],p}))},L.feature=function(e,t){return U(e,t,((o,l,s)=>{if(0===s.length)throw new r(e,a.WrongNumberOfParameters,t);let c;if(1===s.length)if(A(s[0]))c=i.fromJson(JSON.parse(s[0]),e.timeZone);else if(u(s[0]))c=i.createFromArcadeFeature(s[0]);else if(s[0]instanceof x)c=i.createFromGraphicLikeObject(s[0],null,null,e.timeZone);else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);{let t=s[0].hasField("geometry")?s[0].field("geometry"):null,r=s[0].hasField("attributes")?s[0].field("attributes"):null;null!==t&&t instanceof n&&(t=i.parseGeometryFromDictionary(t,e.spatialReference)),null!==r&&(r=i.parseAttributesFromDictionary(r)),c=i.createFromGraphicLikeObject(t,r,null,e.timeZone)}}else if(2===s.length){let o=null,l=null;if(null!==s[0])if(s[0]instanceof x)o=s[0];else{if(!(o instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseGeometryFromDictionary(s[0],e.spatialReference)}if(null!==s[1]){if(!(s[1]instanceof n))throw new r(e,a.InvalidParameter,t);l=i.parseAttributesFromDictionary(s[1])}c=i.createFromGraphicLikeObject(o,l,null,e.timeZone)}else{let o=null;const l={};if(null!==s[0])if(s[0]instanceof x)o=s[0];else{if(!(o instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseGeometryFromDictionary(s[0],e.spatialReference)}for(let n=1;n<s.length;n+=2){const i=h(s[n]),o=s[n+1];if(!(null==o||A(o)||isNaN(o)||w(o)||M(o)||y(o)||R(o)||q(o)))throw new r(e,a.InvalidParameter,t);if(g(o)||!1===d(o))throw new r(e,a.InvalidParameter,t);l[i]=o===p?null:o}c=i.createFromGraphicLikeObject(o,l,null,e.timeZone)}return c._geometry=f(c.geometry(),e.spatialReference),c.immutable=!1,c}))},L.dictionary=function(e,t){return U(e,t,((i,o,l)=>{if(0===l.length||1===l.length&&null===l[0]){const e=new n;return e.immutable=!1,e}if(1===l.length&&A(l[0]))try{const t=JSON.parse(l[0]),r=n.convertObjectToArcadeDictionary(t,P(e),!1);return r.immutable=!1,r}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&l[0]instanceof x)try{const t=l[0].toJSON();t.hasZ=!0===l[0].hasZ,t.hasM=!0===l[0].hasM;const r=n.convertObjectToArcadeDictionary(t,P(e),!1);return r.immutable=!1,r}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&u(l[0]))try{const e=new n;e.immutable=!1,e.setField("geometry",l[0].geometry());const t=new n;t.immutable=!1,e.setField("attributes",t);for(const n of l[0].keys())t.setField(n,l[0].field(n));return e}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&l[0]instanceof n)try{const e=new n;e.immutable=!1;for(const t of l[0].keys())e.setField(t,l[0].field(t));return e}catch(m){throw new r(e,a.InvalidParameter,t)}if(2===l.length&&l[0]instanceof n&&q(l[1]))try{if(!(!0===l[1])){const e=new n;e.immutable=!1;for(const t of l[0].keys())e.setField(t,l[0].field(t));return e}return l[0].deepClone()}catch(m){throw new r(e,a.InvalidParameter,t)}if(l.length%2!=0)throw new r(e,a.WrongNumberOfParameters,t);const f={};for(let n=0;n<l.length;n+=2){const i=h(l[n]),o=l[n+1];if(!(null==o||A(o)||isNaN(o)||w(o)||M(o)||q(o)||R(o)||y(o)||W(o)||s(o)))throw new r(e,a.InvalidParameter,t);if(g(o))throw new r(e,a.InvalidParameter,t);f[i]=o===p?null:o}const c=new n(f);return c.immutable=!1,c}))},L.haskey=function(t,i){return U(t,i,((o,s,f)=>{l(f,2,2,t,i);const c=h(f[1]);if(u(f[0]))return f[0].hasField(c);if(f[0]instanceof n)return f[0].hasField(c);if(f[0]instanceof x){const t=e(f[0],c,null,null,2);return!t||"notfound"!==t.keystate}throw new r(t,a.InvalidParameter,i)}))},L.hasvalue=function(e,n){return U(e,n,((r,a,i)=>(l(i,2,2,e,n),null!=t(i[0],i[1]))))},L.indexof=function(e,t){return U(e,t,((n,i,o)=>{l(o,2,2,e,t);const f=o[1];if(W(o[0])){for(let e=0;e<o[0].length;e++)if(v(f,o[0][e]))return e;return-1}if(s(o[0])){const e=o[0].length();for(let t=0;t<e;t++)if(v(f,o[0].get(t)))return t;return-1}throw new r(e,a.InvalidParameter,t)}))},L.angle=function(e,t){return U(e,t,((n,i,o)=>{if(o=m(o),l(o,2,3,e,t),!(o[0]instanceof D))throw new r(e,a.InvalidParameter,t);if(!(o[1]instanceof D))throw new r(e,a.InvalidParameter,t);if(o.length>2&&!(o[2]instanceof D))throw new r(e,a.InvalidParameter,t);return 2===o.length?b(o[0],o[1]):F(o[0],o[1],o[2])}))},L.bearing=function(e,t){return U(e,t,((n,i,o)=>{if(o=m(o),l(o,2,3,e,t),!(o[0]instanceof D))throw new r(e,a.InvalidParameter,t);if(!(o[1]instanceof D))throw new r(e,a.InvalidParameter,t);if(o.length>2&&!(o[2]instanceof D))throw new r(e,a.InvalidParameter,t);return 2===o.length?O(o[0],o[1]):S(o[0],o[1],o[2])}))},L.isselfintersecting=function(e,t){return U(e,t,((n,r,a)=>{a=m(a),l(a,1,1,e,t);let i=a[0];if(i instanceof G)return i.isSelfIntersecting;if(i instanceof k)return j(i.paths);if(i instanceof J){const e=i.points;for(let t=0;t<e.length;t++)for(let n=0;n<e.length;n++)if(n!==t){let r=!0;for(let a=0;a<e[t].length;a++)if(e[t][a]!==e[n][a]){r=!1;break}if(!0===r)return!0}}if(W(i)||s(i)){const t=I(i,e.spatialReference);return null!==t&&(i=t.paths),j(i)}return!1}))}}export{L as registerFunctions};
5
+ import{geometryMember as e,getNestedOptionalValue as t}from"../containerUtils.js";import n from"../Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as a}from"../executionError.js";import i from"../Feature.js";import o from"../ImmutablePointArray.js";import{B as l,m as s,s as f,M as c,C as m,n as u,v as p,f as h,g as w,k as y,j as R,i as g,b as d,H as P,z as v,F as I}from"../../chunks/languageUtils.js";import{angle2D as b,angleBetween2D as F,bearing2D as O,bearingBetween2D as S,pathsSelfIntersecting as j}from"./centroid.js";import N from"../../geometry/Extent.js";import x from"../../geometry/Geometry.js";import J from"../../geometry/Multipoint.js";import D from"../../geometry/Point.js";import G from"../../geometry/Polygon.js";import k from"../../geometry/Polyline.js";import{isClockwise as Z}from"../../geometry/support/coordsUtils.js";import{fromJSON as z}from"../../geometry/support/jsonUtils.js";import{isArray as W,isString as A,isNumber as M,isBoolean as q}from"../../support/guards.js";function L(L,U){L.ringisclockwise=function(e,t){return U(e,t,((n,i,f)=>{l(f,1,1,e,t);let c=[];if(null===f[0])return!1;if(W(f[0]))for(const o of f[0]){if(!(o instanceof D))throw new r(e,a.InvalidParameter,t);c.push(o.hasZ?o.hasM?[o.x,o.y,o.z,o.m]:[o.x,o.y,o.z]:[o.x,o.y])}else if(f[0]instanceof o)c=f[0]._elements;else{if(!s(f[0]))throw new r(e,a.InvalidParameter,t);for(const n of f[0].toArray()){if(!(n instanceof D))throw new r(e,a.InvalidParameter,t);c.push(n.hasZ?n.hasM?[n.x,n.y,n.z,n.m]:[n.x,n.y,n.z]:[n.x,n.y])}}return!(c.length<3)&&Z(c)}))},L.polygon=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof G==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof G)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new G(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.polyline=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof k==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof k)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new k(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.point=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof D==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof D)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new D(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.multipoint=function(e,t){return U(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof J==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof J)u=z(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new J(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},L.extent=function(e,t){return U(e,t,((o,s,u)=>{u=m(u),l(u,1,1,e,t);let p=null;if(u[0]instanceof n)p=f(i.parseGeometryFromDictionary(u[0],e.spatialReference),e.spatialReference);else if(u[0]instanceof D){const e={xmin:u[0].x,ymin:u[0].y,xmax:u[0].x,ymax:u[0].y,spatialReference:u[0].spatialReference.toJSON()},t=u[0];t.hasZ&&(e.zmin=t.z,e.zmax=t.z),t.hasM&&(e.mmin=t.m,e.mmax=t.m),p=z(e)}else if(u[0]instanceof G)p=z(u[0].extent?.toJSON());else if(u[0]instanceof k)p=z(u[0].extent?.toJSON());else if(u[0]instanceof J)p=z(u[0].extent?.toJSON());else if(u[0]instanceof N)p=z(u[0].toJSON());else{const t=JSON.parse(u[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),p=f(new N(t),e.spatialReference)}if(null!==p&&!1===p.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(p)}))},L.geometry=function(e,t){return U(e,t,((o,s,m)=>{l(m,1,1,e,t);let p=null;if(null===m[0])return null;if(u(m[0]))p=f(m[0].geometry(),e.spatialReference);else if(m[0]instanceof n)p=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),p=f(z(t),e.spatialReference)}if(null!==p&&!1===p.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(p)}))},L.setgeometry=function(e,t){return U(e,t,((n,i,o)=>{if(l(o,2,2,e,t),!u(o[0]))throw new r(e,a.InvalidParameter,t);if(!0===o[0].immutable)throw new r(e,a.Immutable,t);if(!(o[1]instanceof x||null===o[1]))throw new r(e,a.InvalidParameter,t);return o[0]._geometry=o[1],p}))},L.feature=function(e,t){return U(e,t,((o,l,s)=>{if(0===s.length)throw new r(e,a.WrongNumberOfParameters,t);let c;if(1===s.length)if(A(s[0]))c=i.fromJson(JSON.parse(s[0]),e.timeZone);else if(u(s[0]))c=i.createFromArcadeFeature(s[0]);else if(s[0]instanceof x)c=i.createFromGraphicLikeObject(s[0],null,null,e.timeZone);else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);{let t=s[0].hasField("geometry")?s[0].field("geometry"):null,r=s[0].hasField("attributes")?s[0].field("attributes"):null;null!==t&&t instanceof n&&(t=i.parseGeometryFromDictionary(t,e.spatialReference)),null!==r&&(r=i.parseAttributesFromDictionary(r)),c=i.createFromGraphicLikeObject(t,r,null,e.timeZone)}}else if(2===s.length){let o=null,l=null;if(null!==s[0])if(s[0]instanceof x)o=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseGeometryFromDictionary(s[0],e.spatialReference)}if(null!==s[1]){if(!(s[1]instanceof n))throw new r(e,a.InvalidParameter,t);l=i.parseAttributesFromDictionary(s[1])}c=i.createFromGraphicLikeObject(o,l,null,e.timeZone)}else{let o=null;const l={};if(null!==s[0])if(s[0]instanceof x)o=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseGeometryFromDictionary(s[0],e.spatialReference)}for(let n=1;n<s.length;n+=2){const i=h(s[n]),o=s[n+1];if(!(null==o||A(o)||isNaN(o)||w(o)||M(o)||y(o)||R(o)||q(o)))throw new r(e,a.InvalidParameter,t);if(g(o)||!1===d(o))throw new r(e,a.InvalidParameter,t);l[i]=o===p?null:o}c=i.createFromGraphicLikeObject(o,l,null,e.timeZone)}return c._geometry=f(c.geometry(),e.spatialReference),c.immutable=!1,c}))},L.dictionary=function(e,t){return U(e,t,((i,o,l)=>{if(0===l.length||1===l.length&&null===l[0]){const e=new n;return e.immutable=!1,e}if(1===l.length&&A(l[0]))try{const t=JSON.parse(l[0]),r=n.convertObjectToArcadeDictionary(t,P(e),!1);return r.immutable=!1,r}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&l[0]instanceof x)try{const t=l[0].toJSON();t.hasZ=!0===l[0].hasZ,t.hasM=!0===l[0].hasM;const r=n.convertObjectToArcadeDictionary(t,P(e),!1);return r.immutable=!1,r}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&u(l[0]))try{const e=new n;e.immutable=!1,e.setField("geometry",l[0].geometry());const t=new n;t.immutable=!1,e.setField("attributes",t);for(const n of l[0].keys())t.setField(n,l[0].field(n));return e}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&l[0]instanceof n)try{const e=new n;e.immutable=!1;for(const t of l[0].keys())e.setField(t,l[0].field(t));return e}catch(m){throw new r(e,a.InvalidParameter,t)}if(2===l.length&&l[0]instanceof n&&q(l[1]))try{if(!(!0===l[1])){const e=new n;e.immutable=!1;for(const t of l[0].keys())e.setField(t,l[0].field(t));return e}return l[0].deepClone()}catch(m){throw new r(e,a.InvalidParameter,t)}if(l.length%2!=0)throw new r(e,a.WrongNumberOfParameters,t);const f={};for(let n=0;n<l.length;n+=2){const i=h(l[n]),o=l[n+1];if(!(null==o||A(o)||isNaN(o)||w(o)||M(o)||q(o)||R(o)||y(o)||W(o)||s(o)))throw new r(e,a.InvalidParameter,t);if(g(o))throw new r(e,a.InvalidParameter,t);f[i]=o===p?null:o}const c=new n(f);return c.immutable=!1,c}))},L.haskey=function(t,i){return U(t,i,((o,s,f)=>{l(f,2,2,t,i);const c=h(f[1]);if(u(f[0]))return f[0].hasField(c);if(f[0]instanceof n)return f[0].hasField(c);if(f[0]instanceof x){const t=e(f[0],c,null,null,2);return!t||"notfound"!==t.keystate}throw new r(t,a.InvalidParameter,i)}))},L.hasvalue=function(e,n){return U(e,n,((r,a,i)=>(l(i,2,2,e,n),null!=t(i[0],i[1]))))},L.indexof=function(e,t){return U(e,t,((n,i,o)=>{l(o,2,2,e,t);const f=o[1];if(W(o[0])){for(let e=0;e<o[0].length;e++)if(v(f,o[0][e]))return e;return-1}if(s(o[0])){const e=o[0].length();for(let t=0;t<e;t++)if(v(f,o[0].get(t)))return t;return-1}throw new r(e,a.InvalidParameter,t)}))},L.angle=function(e,t){return U(e,t,((n,i,o)=>{if(o=m(o),l(o,2,3,e,t),!(o[0]instanceof D))throw new r(e,a.InvalidParameter,t);if(!(o[1]instanceof D))throw new r(e,a.InvalidParameter,t);if(o.length>2&&!(o[2]instanceof D))throw new r(e,a.InvalidParameter,t);return 2===o.length?b(o[0],o[1]):F(o[0],o[1],o[2])}))},L.bearing=function(e,t){return U(e,t,((n,i,o)=>{if(o=m(o),l(o,2,3,e,t),!(o[0]instanceof D))throw new r(e,a.InvalidParameter,t);if(!(o[1]instanceof D))throw new r(e,a.InvalidParameter,t);if(o.length>2&&!(o[2]instanceof D))throw new r(e,a.InvalidParameter,t);return 2===o.length?O(o[0],o[1]):S(o[0],o[1],o[2])}))},L.isselfintersecting=function(e,t){return U(e,t,((n,r,a)=>{a=m(a),l(a,1,1,e,t);let i=a[0];if(i instanceof G)return i.isSelfIntersecting;if(i instanceof k)return j(i.paths);if(i instanceof J){const e=i.points;for(let t=0;t<e.length;t++)for(let n=0;n<e.length;n++)if(n!==t){let r=!0;for(let a=0;a<e[t].length;a++)if(e[t][a]!==e[n][a]){r=!1;break}if(!0===r)return!0}}if(W(i)||s(i)){const t=I(i,e.spatialReference);return null!==t&&(i=t.paths),j(i)}return!1}))}}export{L as registerFunctions};