@vertigis/arcgis-extensions 41.0.0 → 41.1.0

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.
package/data/Feature.d.ts CHANGED
@@ -9,6 +9,7 @@ import type { GeometryJson } from "../json/GeometryJson.js";
9
9
  import type { CancelToken } from "../support/Cancellable.js";
10
10
  import type { PropertyDefs } from "../support/Serializable.js";
11
11
  import type { WatchCallback } from "../support/esri.js";
12
+ import { CaseInsensitiveObservableMap } from "../utilities/CaseInsensitiveObservableMap.js";
12
13
  import { ObservableMap } from "../utilities/ObservableMap.js";
13
14
  import { ReadOnlyMap } from "../utilities/ReadOnlyMap.js";
14
15
  import { type FormatOptions as FormatOptionsBase } from "../utilities/string.js";
@@ -98,7 +99,7 @@ export declare class Feature extends EntityBase<FeatureProperties> {
98
99
  /**
99
100
  * The feature's attributes, keyed by field name.
100
101
  */
101
- readonly attributes: ObservableMap<string, unknown>;
102
+ readonly attributes: CaseInsensitiveObservableMap<unknown>;
102
103
  /**
103
104
  * The feature's geometry. For non-spatial features, this will be undefined.
104
105
  */
package/data/Feature.js CHANGED
@@ -1 +1 @@
1
- import{__decorate as e}from"tslib";import t from"@arcgis/core/Graphic";import s from"@arcgis/core/core/Collection";import{fromJSON as i}from"@arcgis/core/geometry/support/jsonUtils";import{EntityBase as r}from"../Entity.js";import{Hyperlink as a}from"../Hyperlink.js";import{InvalidOperationError as o}from"../InvalidOperationError.js";import{ItemType as n}from"../ItemType.js";import{serializable as h}from"../support/Serializable.js";import{CaseInsensitiveObservableMap as l}from"../utilities/CaseInsensitiveObservableMap.js";import{MapTransformCollection as p}from"../utilities/MapTransformCollection.js";import{ObservableMap as u}from"../utilities/ObservableMap.js";import{ReadOnlyMap as c}from"../utilities/ReadOnlyMap.js";import{flatten as m,groupBy as f}from"../utilities/array.js";import{checkArg as d}from"../utilities/checkArg.js";import{compare as g}from"../utilities/collection.js";import{parse as y,esriFormatToGeocortexFormat as _}from"../utilities/date.js";import{isCodedValueDomain as b,isGeometry as x}from"../utilities/esri.js";import{fieldWithArcadeXRegex as w,fieldWithRelationshipRegex as F}from"../utilities/field.js";import{some as v,map as I,concat as z,forEach as A,find as E}from"../utilities/iterable.js";import{getLogger as S}from"../utilities/log.js";import{parse as j,NumberFormat as T}from"../utilities/number.js";import{map as k}from"../utilities/promise.js";import{caseInsensitiveEquals as R}from"../utilities/string.js";import{format as C}from"../utilities/string.js";import{onCollectionPropertyChange as M}from"../utilities/watch.js";import{FeatureSettings as O}from"./FeatureSettings.js";import{Schema as N}from"./Schema.js";const P=S("geocortex.api.data.Feature");export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let V=class extends r{get geometry(){return this._geometry}set geometry(e){this.notifyChange("geometryType"),this._geometry=x(e)||!e?e:i(e),this.schema.spatialReference=this._geometry?.spatialReference}get geometryType(){return this.geometry?this.geometry.type:void 0}get source(){return this._source}set source(e){this._source&&this.settings.parent===this._source.featureSettings&&(this.settings.parent=void 0),this._source&&this.schema.parent===this._source.schema&&(this.schema.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0),this.notifyChange("attachmentsInitialized"),this.notifyChange("relatedFeaturesInitialized")}get primaryKey(){const e=this.attributes.get(this.schema.primaryKeyField);return null!=e?`${e}`:void 0}get hasGlobalId(){return!!this.schema.fields.find((e=>"global-id"===e.type))}get globalId(){const e=this.schema.fields.find((e=>"global-id"===e.type));return e?this.attributes.get(e.name):void 0}set globalId(e){const t=this.schema.fields.find((e=>"global-id"===e.type));if(!t)throw new o("Cannot set global ID on feature -- no global ID field.");this.attributes.set(t.name,e)}get presentableAttributes(){return this._presentableAttributes=this._presentableAttributes||new G(this),this._presentableAttributes}get title(){return this.format(this._title||"")}get description(){return this.format(this._description)}get hyperlinks(){return this._hyperlinks||(this._hyperlinks=new B(this))}get relatedFeatures(){return this._relatedFeatures}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find((t=>t.id===e))}}get attachmentsInitialized(){return!this.source||this._attachmentsInitialized}get relatedFeaturesInitialized(){return!this.source||this.source.relationships.every((e=>this._initializedRelationships.has(e)))}get expressionsInitialized(){return!this.settings.popupTemplate?.expressionInfos?.length||this._expressionsInitialized}get _hydrationStatus(){return this._featureHydrationStatus?this._featureHydrationStatus:this.source?.capabilities?.supportsQuery&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _key(){return`${this.source?.id}//${this.primaryKey??this.globalId??this.id}`}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){if(this.settings.popupTemplate?.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find((e=>"text"===e.type));if(e)return e.text}}return""}constructor(e){super(e),this._itemType=n.FEATURE,this._expressionFieldValues=new u,this._expressionValuesUpdatePending=!1,this._attachmentsInitialized=!1,this._expressionsInitialized=!1,this._initializedRelationships=new WeakSet,this.settings=new O,this.settings._setFeature(this),this.schema=new N,this.schema._featureSettings=this.settings,this.attachments=new s,this.attributes=new l,this._relatedFeatures=new u,this.expressionFieldValues=new $(this._expressionFieldValues,this),M(this,"source.relationships",(()=>{this.notifyChange("relatedFeaturesInitialized")}),!0),this.settings.watch("popupTemplate",((e,t)=>{e!==t&&(this._expressionsInitialized=!1,this.notifyChange("expressionsInitialized"))}),!0)}format(e,...t){let s="string"==typeof e?{format:e}:e;d("options",s).isNotMissing();const{format:i}=s;d("format",i).isNotMissing();let r=s.format.replace(H,J);return r=r.replace(L,((e,t,i,r,a)=>q(this,t||i,r,{...s,format:a?`{0:${a}}`:"{0}"}))),r=r.replace(Z,"{{"),s={...s},s.format=r,C(s,...t)}clearExpressionInfos(){this._expressionFieldValues.clear()}toGraphic(){return toGraphic(this)}async fetchExpressionInfos(e=!1){const{expressionInfos:t}=this.settings.popupTemplate??{};if(!t)return;const{runAsyncArcadeExpression:s}=await import("../utilities/arcade.js");if(await Promise.all(t.map((async e=>{try{const t=this.source?.layer??this.source?.sublayer;let i=this.source?.mapExtension;if(!i){const e=this.source?.layerExtension;i=e?.mapExtension}this._expressionFieldValues.set(e.name,await s(e.expression,{layer:t,map:i?.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&P.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValues.set(e.name,Q)}}))),e)return this.attributes.on("change",(async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout((async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()}),0))}));this._expressionsInitialized=!0,this.notifyChange("expressionsInitialized")}async fetchRelatedFeatures(e,t){if(!this.source)return;let s=[];if(e){const t=new Set(Array.isArray(e)?e:[e]);for(const e of t){const t="string"==typeof e?this.source.relationships.find((t=>t.id===e)):e;if(!t||!this.source.relationships.includes(t))throw new o("Relationship not found in feature source.");s.push(t)}}else s=this.source.relationships.toArray();const i=await k(s,(async e=>[e,await(async()=>{const s=await e.getRelatedFeatures(this,t);return this._initializedRelationships.add(e),s})()]));for(const e of i)this._relatedFeatures.set(e[0],e[1]);this.notifyChange("relatedFeaturesInitialized")}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);g(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>this.attachments.remove(e),onNew:(e,t)=>{this.attachments.add(e)},onMatch:(e,t,s,i)=>{this.attachments.splice(s,1,t)}}),this._attachmentsInitialized=!0,this.notifyChange("attachmentsInitialized")}}async addAttachment(e){return this.source?.addAttachment(this,e)}async deleteAttachments(e){return this.source?.deleteAttachments(this,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{const t={};if("project"===e&&this.primaryKey&&(this.source?.capabilities).supportsQuery)t[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,s]of this.attributes.entries())t[e]=s;return t},deserialize:e=>{if(this.attributes.clear(),e instanceof Map)e.forEach(((e,t)=>{this.attributes.set(t,e)}));else for(const[t,s]of Object.entries(e))this.attributes.set(t,s)}},geometry:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("geometry"):this.geometry?.toJSON(),deserialize:e=>{this.geometry=e}},settings:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)},schema:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)},source:["project"]}}_watchProperty(e,t,s,i){if("title"===e||"description"===e){const r=super._watchProperty(e,t,s,i),a="title"===e?"settings.popupTemplate.title":"settings.popupTemplate.content",o=this.watch(a,(()=>{this.notifyChange(e)})),n=this.presentableAttributes.on("change",(()=>{this.notifyChange(e)}));return{remove(){r.remove(),o.remove(),n.remove()}}}return super._watchProperty(e,t,s,i)}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map((e=>e.id)).toArray():[],s=[];for(const i of e)t.includes(i)?s.push(this.fetchRelatedFeatures(i)):P.error("Could not find relationship '{0}' referenced in feature title or description.",i);await Promise.all(s)}_findRelationshipIds(...e){const t=[];for(const s of e){let e;const i=s.replace(H,J);for(;e=K.exec(i),null!==e;){const s=e[0];t.includes(s)||t.push(e[1])}}return t}};V=e([h],V);export{V as Feature};export function toFeature(e,t){const s=new V(t);if(e.attributes)for(const t of Object.keys(e.attributes))s.attributes.set(t,e.attributes[t]);return s.geometry=e.geometry,e.popupTemplate&&(s.settings.popupTemplate=e.popupTemplate),s}export function toGraphic(e){const s=new t;s.attributes={};for(const t of e.attributes.keys())s.attributes[t]=e.attributes.get(t);return e.source?.layer&&(s.layer=e.source?.layer),s.geometry=e.geometry,e.settings.popupTemplate&&(s.popupTemplate=e.settings.popupTemplate),s}const D="Presentable attributes are read-only.",U="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class $ extends c{constructor(e,t){super(e),this._feature=t}get(e){if(!super.has(e)){const{spatialReference:t}=this._feature.schema,s=this._feature.settings.popupTemplate?.expressionInfos?.find((t=>t.name===e));if(!s)return;(async()=>{const{isArcadeScriptAsync:i,runAsyncArcadeExpression:r,arcadeScriptUsesGeometry:a,runArcadeExpression:o}=await import("../utilities/arcade.js");try{if(i(s.expression,t)){const i=this._feature.source?.layer??this._feature.source?.sublayer;let a=this._feature.source?.mapExtension;if(!a){const e=this._feature.source?.layerExtension;a=e?.mapExtension}this._originalMap.set(e,await r(s.expression,{feature:this._feature,layer:i,map:a?.map,spatialReference:t}))}else{if(a(s.expression,t)){const{enableGeometrySupport:e}=await import("@arcgis/core/arcade/arcade");await e()}this._originalMap.set(e,o(s.expression,{feature:this._feature,spatialReference:t}))}}catch(t){t instanceof Error&&P.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,Q)}})()}return super.get(e)}}class G extends c{get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}constructor(e){super(new u),this._feature=e}clear(){throw new o(D)}delete(e){throw new o(D)}forEach(e,t){d("callback",e).isNotMissing();for(const s of this.keys())e.call(t,this.get(s),s,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){return v(this.keys(),(t=>R(t,e)))}set(...e){throw new o(D)}*entries(){yield*I(this.keys(),(e=>[e,this.get(e)]))}*keys(){const e=this._feature.schema.fields.expressionFields.map((e=>e.name)),t=[];this._feature.source?.relationships&&this._feature.source.relationships.filter((e=>"one-to-one"===e.cardinality||"many-to-one"===e.cardinality)).forEach((e=>t.push(...e.relatedSource.schema.fields.map((t=>`relationships/${e.id}/${t.name}`)).toArray()))),yield*z(this._feature.attributes.keys(),e.toArray(),t)}*values(){yield*I(this.keys(),(e=>this.get(e)))}[(Symbol.toStringTag,Symbol.iterator)](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(d("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,s=()=>{t.forEach((e=>e.remove())),t.clear()},i=()=>{const t={added:Array.from(this.entries()).filter((t=>t[1]!==e.get(t[0]))),removed:Array.from(e.entries()).filter((e=>!this.has(e[0])||e[1]!==this.get(e[0]))),target:this};(t.added.length||t.removed.length)&&(this.emit("change",t),r())},r=()=>{e.clear(),s(),A(this.keys(),(s=>{const r=this._getFieldExtension(s);let a="{0}";if(r){const e=r.watch("format",(()=>{i()}));t.add(e),r.format&&(a=r.format)}e.set(s,this._formatAttribute(s,a))}))};r();const a=this._feature.attributes.on("change",(()=>{i()})),o=this._feature.schema.fieldExtensions.on("change",(()=>{i()})),n=this._feature.settings.formatSettings.watch(["numberFormat","dateFormat","locale"],(()=>{i()})),h=this._feature.expressionFieldValues.on("change",(()=>{i()})),l=this._feature.schema.fields.on("change",(e=>{(e.added?.some((e=>null!==e.name.match(w)))||e.removed?.some((e=>null!==e.name.match(w))))&&i()})),p=this._feature.settings.watch("popupTemplate",(()=>{i()}));this._onAllObserversRemoved=()=>{h.remove(),a.remove(),o.remove(),l.remove(),n.remove(),p.remove(),e.clear(),s()}}const s=super.on("change",t);return this._numObservers++,{remove:()=>{s.remove(),this._numObservers--,this._numObservers||this._onAllObserversRemoved()}}}watch(e,t){if("size"===e){const e=this._feature.attributes.watch("size",((e,s)=>{t(e+this._feature.schema.fields._expressionFieldsLength,s+this._feature.schema.fields._expressionFieldsLength,"size",this)})),s=this._feature.schema.fields.watch("_expressionFieldsLength",((e,s)=>{t(e+this._feature.attributes.size,s+this._feature.attributes.size,"size",this)}));return{remove:()=>{e.remove(),s.remove()}}}return super.watch(e,t)}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const s=e.match(w),i=e.match(F);if(s)return q(this._feature,"expression",s[1],{format:t});if(i){const[,e,s]=i;return q(this._feature,e,s,{format:t})}return q(this._feature,void 0,e,{format:t})}}const L=/\{(?:relationships[\\/]([\w-]*)[\\/])?(?:(expression)[\\/])?([_a-zA-ZÀ-ÖØ-öø-ÿ][._a-zA-ZÀ-ÖØ-öø-ÿ0-9]*)(?::([^}]*))?\}/g,K=/\{relationships\/([\w-]*)[\\/]([^}]*)\}/g,H=/{{/g,J="\0MAGIC\0",Z=new RegExp(J,"g"),Q="#INVALID";class B extends p{constructor(e){super(e.settings.hyperlinkTemplates,(e=>this._getHyperlink(e))),this._feature=e}_getHyperlink(e){return this._hyperlinks=this._hyperlinks||new WeakMap,this._hyperlinks.has(e)||this._hyperlinks.set(e,new W(this._feature,e)),this._hyperlinks.get(e)}}let W=class extends a{get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new o(U)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new o(U)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new o(U)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new o(U)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new o(U)}constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t}_watchProperty(e,t,s,i){const r=super._watchProperty(e,t,s,i),a=this._template.watch(e,(()=>{this.notifyChange(e)})),o=this._feature.presentableAttributes.on("change",(()=>{this.notifyChange(e)})),n=this._feature.relatedFeatures.on("change",(()=>{this.notifyChange(e)}));return{remove:()=>{r.remove(),a.remove(),o.remove(),n.remove()}}}_getSerializableProperties(){return{}}};function q(e,t,s,i={format:"{0}"}){if("expression"!==t){if(t){const r=E(e.relatedFeatures.keys(),(e=>e.id===t));if(!r)return P.debug("Could not resolve related field '{0}/{1}",t,s),Q;const a=Array.from(e.relatedFeatures.get(r));return"many-to-one"===r.cardinality||"one-to-one"===r.cardinality?a.length<1?(P.debug("Could not resolve related field '{0}/{1}",t,s),Q):X(a[0],s,i):a.map((e=>X(e,s,i))).filter((e=>""!==e)).join(",")}return X(e,s,i)}if(!e.settings.popupTemplate?.expressionInfos?.find((e=>e.name===s)))return P.debug("Could not find expression '{0}'.",s),Q;try{const t=e.expressionFieldValues.get(s)??i.defaultExpressionValue??"",r=e.schema.findFieldByName(`expression/${s}`);let a=i;if(r){const t=e.schema.fieldExtensions.forField(r);a=te(e,s,ee(t.formatSettings),a)}return Y(e,t,a)}catch(e){if(e instanceof Error)return P.error({message:"Error evaluating expression '{0}': {1}.",error:e},s,e.message),Q;throw e}}function X(e,t,s){let i=e.attributes.get(t);if(null==i)return"";const r=e.schema.findFieldByName(t);let a={format:"{0}"};const o=e.type?.domains?.[r?.name??t];if(R(t,e.schema.typeIdField))i=e.type?e.type.name:i;else if(b(o)){const e=o.codedValues.find((e=>`${e.code}`==`${i.toString()}`));i=e?e.name:i}else if(r)if(b(r.domain)){const e=r.domain.codedValues.find((e=>`${e.code}`==`${i.toString()}`));e&&(i=e.name)}else{switch(r.type){case"integer":case"small-integer":case"single":case"double":i=j(i);break;case"date":i=y({timeZone:e.schema.timeZone},i);break;default:i=`${i.toString()}`}const t=e.schema.fieldExtensions.forField(r);t&&(a=ee(t.formatSettings))}return Y(e,i,te(e,t,a,s))}function Y(e,t,s){let i=s;if("number"==typeof t||t instanceof Date){i={...ee(e.settings.formatSettings),...s}}return"{0}"===i.format&&"string"==typeof t?t:C(i,t)}function ee(e){return{format:"{0}",dateFormat:e.dateFormat,numberFormat:e.numberFormat,currency:e.currency,fractionalDigits:e.fractionalDigits,locale:e.locale,timeZone:e.timeZone}}function te(e,t,s,i){const{popupTemplate:r}=e.settings,a=r?.fieldInfos?r.fieldInfos.find((e=>e.fieldName===t)):void 0,o=a?a.format:void 0;let n;return o&&(n={format:"{0}",numberFormat:o.digitSeparator?T.NUMBER:T.FIXED_POINT,dateFormat:_(o.dateFormat),fractionalDigits:o.places}),{...n,...s,...i}}W=e([h],W);export async function resolveRelatedFeatures(e){const t=f(e,(e=>e.source));await Promise.all(m([...t.keys()].map((e=>e.relationships.toArray()))).map((e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach((([t,s])=>{t.relatedFeatures.set(e,s)}))})(e))))}
1
+ import{__decorate as e}from"tslib";import t from"@arcgis/core/Graphic";import s from"@arcgis/core/core/Collection";import{fromJSON as i}from"@arcgis/core/geometry/support/jsonUtils";import{EntityBase as r}from"../Entity.js";import{Hyperlink as a}from"../Hyperlink.js";import{InvalidOperationError as o}from"../InvalidOperationError.js";import{ItemType as n}from"../ItemType.js";import{serializable as h}from"../support/Serializable.js";import{CaseInsensitiveObservableMap as l}from"../utilities/CaseInsensitiveObservableMap.js";import{MapTransformCollection as p}from"../utilities/MapTransformCollection.js";import{ObservableMap as u}from"../utilities/ObservableMap.js";import{ReadOnlyMap as c}from"../utilities/ReadOnlyMap.js";import{flatten as m,groupBy as f}from"../utilities/array.js";import{checkArg as d}from"../utilities/checkArg.js";import{compare as g}from"../utilities/collection.js";import{parse as y,esriFormatToGeocortexFormat as _}from"../utilities/date.js";import{isCodedValueDomain as b,isGeometry as x}from"../utilities/esri.js";import{fieldWithArcadeXRegex as w,fieldWithRelationshipRegex as F}from"../utilities/field.js";import{some as v,map as I,concat as z,forEach as A,find as E}from"../utilities/iterable.js";import{getLogger as S}from"../utilities/log.js";import{parse as j,NumberFormat as T}from"../utilities/number.js";import{map as k}from"../utilities/promise.js";import{caseInsensitiveEquals as R}from"../utilities/string.js";import{format as C}from"../utilities/string.js";import{onCollectionPropertyChange as M}from"../utilities/watch.js";import{FeatureSettings as O}from"./FeatureSettings.js";import{Schema as N}from"./Schema.js";const P=S("geocortex.api.data.Feature");export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let V=class extends r{get geometry(){return this._geometry}set geometry(e){this.notifyChange("geometryType"),this._geometry=x(e)||!e?e:i(e),this.schema.spatialReference=this._geometry?.spatialReference}get geometryType(){return this.geometry?this.geometry.type:void 0}get source(){return this._source}set source(e){this._source&&this.settings.parent===this._source.featureSettings&&(this.settings.parent=void 0),this._source&&this.schema.parent===this._source.schema&&(this.schema.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0),this.notifyChange("attachmentsInitialized"),this.notifyChange("relatedFeaturesInitialized")}get primaryKey(){const e=this.attributes.get(this.schema.primaryKeyField);return null!=e?`${e}`:void 0}get hasGlobalId(){return!!this.schema.fields.find((e=>"global-id"===e.type))}get globalId(){const e=this.schema.fields.find((e=>"global-id"===e.type));return e?this.attributes.get(e.name):void 0}set globalId(e){const t=this.schema.fields.find((e=>"global-id"===e.type));if(!t)throw new o("Cannot set global ID on feature -- no global ID field.");this.attributes.set(t.name,e)}get presentableAttributes(){return this._presentableAttributes=this._presentableAttributes||new G(this),this._presentableAttributes}get title(){return this.format(this._title||"")}get description(){return this.format(this._description)}get hyperlinks(){return this._hyperlinks||(this._hyperlinks=new B(this))}get relatedFeatures(){return this._relatedFeatures}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find((t=>t.id===e))}}get attachmentsInitialized(){return!this.source||this._attachmentsInitialized}get relatedFeaturesInitialized(){return!this.source||this.source.relationships.every((e=>this._initializedRelationships.has(e)))}get expressionsInitialized(){return!this.settings.popupTemplate?.expressionInfos?.length||this._expressionsInitialized}get _hydrationStatus(){return this._featureHydrationStatus?this._featureHydrationStatus:this.source?.capabilities?.supportsQuery&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _key(){return`${this.source?.id}//${this.primaryKey??this.globalId??this.id}`}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){if(this.settings.popupTemplate?.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find((e=>"text"===e.type));if(e)return e.text}}return""}constructor(e){super(e),this._itemType=n.FEATURE,this._expressionFieldValues=new u,this._expressionValuesUpdatePending=!1,this._attachmentsInitialized=!1,this._expressionsInitialized=!1,this._initializedRelationships=new WeakSet,this.settings=new O,this.settings._setFeature(this),this.schema=new N,this.schema._featureSettings=this.settings,this.attachments=new s,this.attributes=new l,this._relatedFeatures=new u,this.expressionFieldValues=new $(this._expressionFieldValues,this),M(this,"source.relationships",(()=>{this.notifyChange("relatedFeaturesInitialized")}),!0),this.settings.watch("popupTemplate",((e,t)=>{e!==t&&(this._expressionsInitialized=!1,this.notifyChange("expressionsInitialized"))}),!0)}format(e,...t){let s="string"==typeof e?{format:e}:e;d("options",s).isNotMissing();const{format:i}=s;d("format",i).isNotMissing();let r=s.format.replace(H,J);return r=r.replace(L,((e,t,i,r,a)=>q(this,t||i,r,{...s,format:a?`{0:${a}}`:"{0}"}))),r=r.replace(Z,"{{"),s={...s},s.format=r,C(s,...t)}clearExpressionInfos(){this._expressionFieldValues.clear()}toGraphic(){return toGraphic(this)}async fetchExpressionInfos(e=!1){const{expressionInfos:t}=this.settings.popupTemplate??{};if(!t)return;const{runAsyncArcadeExpression:s}=await import("../utilities/arcade.js");if(await Promise.all(t.map((async e=>{try{const t=this.source?.layer??this.source?.sublayer;let i=this.source?.mapExtension;if(!i){const e=this.source?.layerExtension;i=e?.mapExtension}this._expressionFieldValues.set(e.name,await s(e.expression,{layer:t,map:i?.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&P.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValues.set(e.name,Q)}}))),e)return this.attributes.on("change",(async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout((async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()}),0))}));this._expressionsInitialized=!0,this.notifyChange("expressionsInitialized")}async fetchRelatedFeatures(e,t){if(!this.source)return;let s=[];if(e){const t=new Set(Array.isArray(e)?e:[e]);for(const e of t){const t="string"==typeof e?this.source.relationships.find((t=>t.id===e)):e;if(!t||!this.source.relationships.includes(t))throw new o("Relationship not found in feature source.");s.push(t)}}else s=this.source.relationships.toArray();const i=await k(s,(async e=>[e,await(async()=>{const s=await e.getRelatedFeatures(this,t);return this._initializedRelationships.add(e),s})()]));for(const e of i)this._relatedFeatures.set(e[0],e[1]);this.notifyChange("relatedFeaturesInitialized")}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);g(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>this.attachments.remove(e),onNew:(e,t)=>{this.attachments.add(e)},onMatch:(e,t,s,i)=>{this.attachments.splice(s,1,t)}}),this._attachmentsInitialized=!0,this.notifyChange("attachmentsInitialized")}}async addAttachment(e){return this.source?.addAttachment(this,e)}async deleteAttachments(e){return this.source?.deleteAttachments(this,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{const t={};if("project"===e&&this.primaryKey&&(this.source?.capabilities).supportsQuery)t[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,s]of this.attributes.entries())t[e]=s;return t},deserialize:e=>{if(this.attributes.clear(),e instanceof Map)e.forEach(((e,t)=>{this.attributes.set(t,e)}));else for(const[t,s]of Object.entries(e))this.attributes.set(t,s)}},geometry:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("geometry"):this.geometry?.toJSON(),deserialize:e=>{this.geometry=e}},settings:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)},schema:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)},source:["project"]}}_watchProperty(e,t,s,i){if("title"===e||"description"===e){const r=super._watchProperty(e,t,s,i),a="title"===e?"settings.popupTemplate.title":"settings.popupTemplate.content",o=this.watch(a,(()=>{this.notifyChange(e)})),n=this.presentableAttributes.on("change",(()=>{this.notifyChange(e)}));return{remove(){r.remove(),o.remove(),n.remove()}}}return super._watchProperty(e,t,s,i)}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map((e=>e.id)).toArray():[],s=[];for(const i of e)t.includes(i)?s.push(this.fetchRelatedFeatures(i)):P.error("Could not find relationship '{0}' referenced in feature title or description.",i);await Promise.all(s)}_findRelationshipIds(...e){const t=[];for(const s of e){let e;const i=s.replace(H,J);for(;e=K.exec(i),null!==e;){const s=e[0];t.includes(s)||t.push(e[1])}}return t}};V=e([h],V);export{V as Feature};export function toFeature(e,t){const s=new V(t);if(e.attributes)for(const t of Object.keys(e.attributes))s.attributes.set(t,e.attributes[t]);return s.geometry=e.geometry,e.popupTemplate&&(s.settings.popupTemplate=e.popupTemplate),s}export function toGraphic(e){const s=new t;s.attributes={};for(const t of e.attributes.keys())s.attributes[t]=e.attributes.get(t);return e.source?.layer&&(s.layer=e.source?.layer),s.geometry=e.geometry,e.settings.popupTemplate&&(s.popupTemplate=e.settings.popupTemplate),s}const D="Presentable attributes are read-only.",U="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class $ extends c{constructor(e,t){super(e),this._feature=t}get(e){if(!super.has(e)){const{spatialReference:t}=this._feature.schema,s=this._feature.settings.popupTemplate?.expressionInfos?.find((t=>t.name===e));if(!s)return;(async()=>{const{isArcadeScriptAsync:i,runAsyncArcadeExpression:r,arcadeScriptUsesGeometry:a,runArcadeExpression:o}=await import("../utilities/arcade.js");try{if(i(s.expression,t)){const i=this._feature.source?.layer??this._feature.source?.sublayer;let a=this._feature.source?.mapExtension;if(!a){const e=this._feature.source?.layerExtension;a=e?.mapExtension}this._originalMap.set(e,await r(s.expression,{feature:this._feature,layer:i,map:a?.map,spatialReference:t}))}else{if(a(s.expression,t)){const{enableGeometrySupport:e}=await import("@arcgis/core/arcade/arcade");await e()}this._originalMap.set(e,o(s.expression,{feature:this._feature,spatialReference:t}))}}catch(t){t instanceof Error&&P.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,Q)}})()}return super.get(e)}}class G extends c{get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}constructor(e){super(new l),this._feature=e}clear(){throw new o(D)}delete(e){throw new o(D)}forEach(e,t){d("callback",e).isNotMissing();for(const s of this.keys())e.call(t,this.get(s),s,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){return v(this.keys(),(t=>R(t,e)))}set(...e){throw new o(D)}*entries(){yield*I(this.keys(),(e=>[e,this.get(e)]))}*keys(){const e=this._feature.schema.fields.expressionFields.map((e=>e.name)),t=[];this._feature.source?.relationships&&this._feature.source.relationships.filter((e=>"one-to-one"===e.cardinality||"many-to-one"===e.cardinality)).forEach((e=>t.push(...e.relatedSource.schema.fields.map((t=>`relationships/${e.id}/${t.name}`)).toArray()))),yield*z(this._feature.attributes.keys(),e.toArray(),t)}*values(){yield*I(this.keys(),(e=>this.get(e)))}[(Symbol.toStringTag,Symbol.iterator)](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(d("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,s=()=>{t.forEach((e=>e.remove())),t.clear()},i=()=>{const t={added:Array.from(this.entries()).filter((t=>t[1]!==e.get(t[0]))),removed:Array.from(e.entries()).filter((e=>!this.has(e[0])||e[1]!==this.get(e[0]))),target:this};(t.added.length||t.removed.length)&&(this.emit("change",t),r())},r=()=>{e.clear(),s(),A(this.keys(),(s=>{const r=this._getFieldExtension(s);let a="{0}";if(r){const e=r.watch("format",(()=>{i()}));t.add(e),r.format&&(a=r.format)}e.set(s,this._formatAttribute(s,a))}))};r();const a=this._feature.attributes.on("change",(()=>{i()})),o=this._feature.schema.fieldExtensions.on("change",(()=>{i()})),n=this._feature.settings.formatSettings.watch(["numberFormat","dateFormat","locale"],(()=>{i()})),h=this._feature.expressionFieldValues.on("change",(()=>{i()})),l=this._feature.schema.fields.on("change",(e=>{(e.added?.some((e=>null!==e.name.match(w)))||e.removed?.some((e=>null!==e.name.match(w))))&&i()})),p=this._feature.settings.watch("popupTemplate",(()=>{i()}));this._onAllObserversRemoved=()=>{h.remove(),a.remove(),o.remove(),l.remove(),n.remove(),p.remove(),e.clear(),s()}}const s=super.on("change",t);return this._numObservers++,{remove:()=>{s.remove(),this._numObservers--,this._numObservers||this._onAllObserversRemoved()}}}watch(e,t){if("size"===e){const e=this._feature.attributes.watch("size",((e,s)=>{t(e+this._feature.schema.fields._expressionFieldsLength,s+this._feature.schema.fields._expressionFieldsLength,"size",this)})),s=this._feature.schema.fields.watch("_expressionFieldsLength",((e,s)=>{t(e+this._feature.attributes.size,s+this._feature.attributes.size,"size",this)}));return{remove:()=>{e.remove(),s.remove()}}}return super.watch(e,t)}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const s=e.match(w),i=e.match(F);if(s)return q(this._feature,"expression",s[1],{format:t});if(i){const[,e,s]=i;return q(this._feature,e,s,{format:t})}return q(this._feature,void 0,e,{format:t})}}const L=/\{(?:relationships[\\/]([\w-]*)[\\/])?(?:(expression)[\\/])?([_a-zA-ZÀ-ÖØ-öø-ÿ][._a-zA-ZÀ-ÖØ-öø-ÿ0-9]*)(?::([^}]*))?\}/g,K=/\{relationships\/([\w-]*)[\\/]([^}]*)\}/g,H=/{{/g,J="\0MAGIC\0",Z=new RegExp(J,"g"),Q="#INVALID";class B extends p{constructor(e){super(e.settings.hyperlinkTemplates,(e=>this._getHyperlink(e))),this._feature=e}_getHyperlink(e){return this._hyperlinks=this._hyperlinks||new WeakMap,this._hyperlinks.has(e)||this._hyperlinks.set(e,new W(this._feature,e)),this._hyperlinks.get(e)}}let W=class extends a{get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new o(U)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new o(U)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new o(U)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new o(U)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new o(U)}constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t}_watchProperty(e,t,s,i){const r=super._watchProperty(e,t,s,i),a=this._template.watch(e,(()=>{this.notifyChange(e)})),o=this._feature.presentableAttributes.on("change",(()=>{this.notifyChange(e)})),n=this._feature.relatedFeatures.on("change",(()=>{this.notifyChange(e)}));return{remove:()=>{r.remove(),a.remove(),o.remove(),n.remove()}}}_getSerializableProperties(){return{}}};function q(e,t,s,i={format:"{0}"}){if("expression"!==t){if(t){const r=E(e.relatedFeatures.keys(),(e=>e.id===t));if(!r)return P.debug("Could not resolve related field '{0}/{1}",t,s),Q;const a=Array.from(e.relatedFeatures.get(r));return"many-to-one"===r.cardinality||"one-to-one"===r.cardinality?a.length<1?(P.debug("Could not resolve related field '{0}/{1}",t,s),Q):X(a[0],s,i):a.map((e=>X(e,s,i))).filter((e=>""!==e)).join(",")}return X(e,s,i)}if(!e.settings.popupTemplate?.expressionInfos?.find((e=>R(e.name,s))))return P.debug("Could not find expression '{0}'.",s),Q;try{const t=e.expressionFieldValues.get(s)??i.defaultExpressionValue??"",r=e.schema.findFieldByName(`expression/${s}`);let a=i;if(r){const t=e.schema.fieldExtensions.forField(r);a=te(e,s,ee(t.formatSettings),a)}return Y(e,t,a)}catch(e){if(e instanceof Error)return P.error({message:"Error evaluating expression '{0}': {1}.",error:e},s,e.message),Q;throw e}}function X(e,t,s){let i=e.attributes.get(t);if(null==i)return"";const r=e.schema.findFieldByName(t);let a={format:"{0}"};const o=e.type?.domains?.[r?.name??t];if(R(t,e.schema.typeIdField))i=e.type?e.type.name:i;else if(b(o)){const e=o.codedValues.find((e=>`${e.code}`==`${i.toString()}`));i=e?e.name:i}else if(r)if(b(r.domain)){const e=r.domain.codedValues.find((e=>`${e.code}`==`${i.toString()}`));e&&(i=e.name)}else{switch(r.type){case"integer":case"small-integer":case"single":case"double":i=j(i);break;case"date":i=y({timeZone:e.schema.timeZone},i);break;default:i=`${i.toString()}`}const t=e.schema.fieldExtensions.forField(r);t&&(a=ee(t.formatSettings))}return Y(e,i,te(e,t,a,s))}function Y(e,t,s){let i=s;if("number"==typeof t||t instanceof Date){i={...ee(e.settings.formatSettings),...s}}return"{0}"===i.format&&"string"==typeof t?t:C(i,t)}function ee(e){return{format:"{0}",dateFormat:e.dateFormat,numberFormat:e.numberFormat,currency:e.currency,fractionalDigits:e.fractionalDigits,locale:e.locale,timeZone:e.timeZone}}function te(e,t,s,i){const{popupTemplate:r}=e.settings,a=r?.fieldInfos?r.fieldInfos.find((e=>R(e.fieldName,t))):void 0,o=a?a.format:void 0;let n;return o&&(n={format:"{0}",numberFormat:o.digitSeparator?T.NUMBER:T.FIXED_POINT,dateFormat:_(o.dateFormat),fractionalDigits:o.places}),{...n,...s,...i}}W=e([h],W);export async function resolveRelatedFeatures(e){const t=f(e,(e=>e.source));await Promise.all(m([...t.keys()].map((e=>e.relationships.toArray()))).map((e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach((([t,s])=>{t.relatedFeatures.set(e,s)}))})(e))))}
@@ -1 +1 @@
1
- import{__decorate as t}from"tslib";import e from"@arcgis/core/PopupTemplate";import{Hyperlink as i}from"../Hyperlink.js";import{isPopupContentExtension as n}from"../ItemType.js";import{ArrayWrappedCollection as o}from"../mapping/support/ArrayWrappedCollection.js";import{FormatSettings as s}from"../support/FormatSettings.js";import{InitializableCollectionProxy as r}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as p,isDefault as a,serializable as u,shouldExcludeDefaults as l}from"../support/Serializable.js";import{Settings as h}from"../support/Settings.js";import{compare as f}from"../utilities/array.js";import{checkArg as m}from"../utilities/checkArg.js";import{getAllFieldInfos as d,getAllReferencedFieldNames as c,isPopupTemplate as _}from"../utilities/esri.js";import{fieldWithArcadeXRegex as g,fieldWithRelationshipRegex as S}from"../utilities/field.js";import{isQueryBasedRelationship as C}from"../utilities/relationships.js";import{onCollectionPropertyChange as y}from"../utilities/watch.js";import{PopupContentExtension as T,_popupContentExtensionMap as x}from"./PopupContentExtension.js";let z=class extends h{get _popupContent(){return this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let i;i=t instanceof Object&&!_(t)?e.fromJSON(t):t;const n=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();i&&n&&(i.content=i.content??n.content,i.fieldInfos=i.fieldInfos??n.fieldInfos),this._setSetting("popupTemplate",i),this._isDefaultPopupTemplate=!1}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new s))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(t){this._setSetting("returnGeometry",t)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(t){this._setSetting("outFields",t)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(t){this._setSetting("outSpatialReference",t)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(t){this._setSetting("maxAllowableOffset",t)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(t){this._setSetting("zoomScale",t)}get zoomFactor(){const t=this._feature?this._feature.schema:this._featureSource?.schema,e=t&&"point"===t.geometryType?void 0:1.5;return this._getSetting("zoomFactor",e)}set zoomFactor(t){this._setSetting("zoomFactor",t)}get featureSource(){return this._featureSource}get feature(){return this._feature}constructor(t){super(t),this._isDefaultPopupTemplate=!1,this._popupContentCollection=this._createPopupContentCollection(),this.popupContentExtensions=new E(this)}get _defaultOutFields(){const t=d(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(t&&e){const i=new Set;i.add(e);const n=this.featureSource.schema.fields.toArray().map((t=>t.name)),o=new Set([...c(this.popupTemplate),...this.hyperlinkTemplates.toArray().flatMap((t=>t.getReferencedFields()))]),s=t.filter((t=>t.visible||t.isEditable&&this.featureSource.capabilities.supportsEditing)).map((t=>t.fieldName)).concat(...o).filter((t=>n.includes(t)));return this._featureSource.relationships.forEach((t=>{C(t)&&s.push(t.keyField)})),s.filter((t=>!(t.match(g)||t.match(S)))).forEach((t=>i.add(t))),Array.from(i.values())}return["*"]}_setFeatureSource(t){this._featureSource=t,this.notifyChange("featureSource")}_setFeature(t){this._feature=t,this.notifyChange("feature")}toJSON(t="all"){const e=p(this._getSerializableProperties(),this,t)||{},i=e.popupContentExtensions?.filter((t=>{const e=this.parent;return!e?.popupContentExtensions?.some((e=>e.id===t.id))}));if(e)for(const t of Object.keys(e))this.isModified(t)||delete e[t];if(i?.length&&(e.popupContentExtensions=i),!l(t)||!a(e))return e}_createPopupContentCollection(){return new o({parent:this,targetProperty:"popupTemplate",arrayProperty:"content"})}_getSerializableProperties(){return{hyperlinkTemplates:{serializeModes:["initial"],deserialize:t=>{t.forEach((t=>{this.hyperlinkTemplates.find((e=>this._hyperlinksAreEquivalent(e,t)))||this.hyperlinkTemplates.add(t instanceof i?t:new i(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const i=this.hyperlinkTemplates.indexOf(e),n=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));n<0?this.hyperlinkTemplates.removeAt(i):n!==i&&this.hyperlinkTemplates.reorder(e,n)}))}},popupTemplate:{serialize:!1},formatSettings:"initial",outFields:{serializeModes:["initial"],serialize:()=>this.isModified("outFields")?this.outFields:void 0},returnGeometry:{serializeModes:["initial"],default:!0},outSpatialReference:"initial",maxAllowableOffset:"initial",zoomScale:"initial",zoomFactor:{serializeModes:["initial"],isDefault:t=>{const e=this._feature?this._feature.schema:this._featureSource?.schema;return t===(e&&"point"===e.geometryType?void 0:1.5)}},popupContentExtensions:{serializeModes:["initial"],serialize:t=>this.popupContentExtensions.map((e=>e.toJSON(t))).filter((t=>!(t&&2===Object.keys(t).length&&t.id&&t.content))).toArray(),deserialize:t=>{t&&f(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(n(t)?t:new T(t),e)},onMatch:(t,e,i,o)=>{n(e)||t.assignProperties(e),i!==o&&this.popupContentExtensions.reorder(t,o)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>n(e)?e===t||e.id===t.id:!(!e?.content||!T.matchesRef(this.popupContentExtensions.toArray(),this.popupContentExtensions.indexOf(t),e.content))||t.id===e.id})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const i=t=>t||"";return i(t.text)===i(e.text)&&i(t.url)===i(e.url)&&i(t.iconUrl)===i(e.iconUrl)&&i(t.target)===i(e.target)&&i(t.tooltip)===i(e.tooltip)}};z=t([u],z);export{z as FeatureSettings};class E extends r{get _collection(){return this._featureSettings._popupContent.map((t=>this._forContent(t))).concat(Array.from(this._uninitializedPopupContentExtensions))}get _popupTemplateIsInherited(){return this._featureSettings.parent&&this._featureSettings.popupTemplate===this._featureSettings.parent.popupTemplate}constructor(t){super(),this._uninitializedPopupContentExtensions=new Set,this._featureSettings=t,y(this._featureSettings,"_popupContent",(t=>{const e={added:(t.added||[]).map((t=>this._forContent(t))),moved:(t.moved||[]).map((t=>this._forContent(t))),removed:(t.removed||[]).map((t=>this._forContent(t))),target:this};this.emit("change",e)})),t.watch("_popupContent.length",(()=>this.notifyChange("length")))}forContent(t){if(m("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,i){if(m("contentX",t).isNotMissing(),this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),t.featureSettings&&t.featureSettings.popupContentExtensions.remove(t),t._setFeatureSettings(this._featureSettings),t.content){const e=x.get(t.content);if(x.set(t.content,t),e&&e!==t&&this._onRemoved(e),this._featureSettings._popupContent.includes(t.content))if(void 0===i){const i={added:[t],moved:[],removed:e?[e]:[],target:this};this.emit("change",i)}else this._featureSettings._popupContent.reorder(t.content,i);else this._featureSettings._popupContent.add(t.content,i)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e)}return this._onAdded(t),this}removeAt(t){const i=this.getItemAt(t);if(void 0!==i){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(i)){this._uninitializedPopupContentExtensions.delete(i);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t)}else this._featureSettings._popupContent.remove(i.content);return this._onRemoved(i),i}}reorder(t,i){if(t&&this._featureSettings._popupContent.includes(t.content))return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.reorder(t.content,i),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,i)=>t(this._forContent(e),this._forContent(i)))),this}_itemIsInitialized(t){return super._itemIsInitialized(t)&&!!t.content}_onAdded(t){}_onRemoved(t){t.featureSettings===this._featureSettings&&t._setFeatureSettings(void 0)}_forContent(t){if(this._uninitializedPopupContentExtensions.size)for(const t of this._uninitializedPopupContentExtensions)t._resolveContent(),t.content&&(x.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!x.has(t)){const e=new T({content:t});x.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return x.get(t)}}
1
+ import{__decorate as t}from"tslib";import e from"@arcgis/core/PopupTemplate";import{Hyperlink as i}from"../Hyperlink.js";import{isPopupContentExtension as n}from"../ItemType.js";import{ArrayWrappedCollection as o}from"../mapping/support/ArrayWrappedCollection.js";import{FormatSettings as s}from"../support/FormatSettings.js";import{InitializableCollectionProxy as r}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as p,isDefault as a,serializable as u,shouldExcludeDefaults as l}from"../support/Serializable.js";import{Settings as h}from"../support/Settings.js";import{compare as f}from"../utilities/array.js";import{checkArg as m}from"../utilities/checkArg.js";import{getAllFieldInfos as d,getAllReferencedFieldNames as c,isPopupTemplate as _}from"../utilities/esri.js";import{fieldWithArcadeXRegex as g,fieldWithRelationshipRegex as S}from"../utilities/field.js";import{isQueryBasedRelationship as C}from"../utilities/relationships.js";import{caseInsensitiveEquals as y}from"../utilities/string.js";import{onCollectionPropertyChange as T}from"../utilities/watch.js";import{PopupContentExtension as x,_popupContentExtensionMap as z}from"./PopupContentExtension.js";let E=class extends h{get _popupContent(){return this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let i;i=t instanceof Object&&!_(t)?e.fromJSON(t):t;const n=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();i&&n&&(i.content=i.content??n.content,i.fieldInfos=i.fieldInfos??n.fieldInfos),this._setSetting("popupTemplate",i),this._isDefaultPopupTemplate=!1}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new s))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(t){this._setSetting("returnGeometry",t)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(t){this._setSetting("outFields",t)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(t){this._setSetting("outSpatialReference",t)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(t){this._setSetting("maxAllowableOffset",t)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(t){this._setSetting("zoomScale",t)}get zoomFactor(){const t=this._feature?this._feature.schema:this._featureSource?.schema,e=t&&"point"===t.geometryType?void 0:1.5;return this._getSetting("zoomFactor",e)}set zoomFactor(t){this._setSetting("zoomFactor",t)}get featureSource(){return this._featureSource}get feature(){return this._feature}constructor(t){super(t),this._isDefaultPopupTemplate=!1,this._popupContentCollection=this._createPopupContentCollection(),this.popupContentExtensions=new v(this)}get _defaultOutFields(){const t=d(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(t&&e){const i=new Set;i.add(e);const n=this.featureSource.schema.fields.toArray().map((t=>t.name)),o=new Set([...c(this.popupTemplate),...this.hyperlinkTemplates.toArray().flatMap((t=>t.getReferencedFields()))]),s=t.filter((t=>t.visible||t.isEditable&&this.featureSource.capabilities.supportsEditing)).map((t=>t.fieldName)).concat(...o).filter((t=>n.some((e=>y(e,t)))));return this._featureSource.relationships.forEach((t=>{C(t)&&s.push(t.keyField)})),s.filter((t=>!(t.match(g)||t.match(S)))).forEach((t=>i.add(t))),Array.from(i.values())}return["*"]}_setFeatureSource(t){this._featureSource=t,this.notifyChange("featureSource")}_setFeature(t){this._feature=t,this.notifyChange("feature")}toJSON(t="all"){const e=p(this._getSerializableProperties(),this,t)||{},i=e.popupContentExtensions?.filter((t=>{const e=this.parent;return!e?.popupContentExtensions?.some((e=>e.id===t.id))}));if(e)for(const t of Object.keys(e))this.isModified(t)||delete e[t];if(i?.length&&(e.popupContentExtensions=i),!l(t)||!a(e))return e}_createPopupContentCollection(){return new o({parent:this,targetProperty:"popupTemplate",arrayProperty:"content"})}_getSerializableProperties(){return{hyperlinkTemplates:{serializeModes:["initial"],deserialize:t=>{t.forEach((t=>{this.hyperlinkTemplates.find((e=>this._hyperlinksAreEquivalent(e,t)))||this.hyperlinkTemplates.add(t instanceof i?t:new i(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const i=this.hyperlinkTemplates.indexOf(e),n=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));n<0?this.hyperlinkTemplates.removeAt(i):n!==i&&this.hyperlinkTemplates.reorder(e,n)}))}},popupTemplate:{serialize:!1},formatSettings:"initial",outFields:{serializeModes:["initial"],serialize:()=>this.isModified("outFields")?this.outFields:void 0},returnGeometry:{serializeModes:["initial"],default:!0},outSpatialReference:"initial",maxAllowableOffset:"initial",zoomScale:"initial",zoomFactor:{serializeModes:["initial"],isDefault:t=>{const e=this._feature?this._feature.schema:this._featureSource?.schema;return t===(e&&"point"===e.geometryType?void 0:1.5)}},popupContentExtensions:{serializeModes:["initial"],serialize:t=>this.popupContentExtensions.map((e=>e.toJSON(t))).filter((t=>!(t&&2===Object.keys(t).length&&t.id&&t.content))).toArray(),deserialize:t=>{t&&f(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(n(t)?t:new x(t),e)},onMatch:(t,e,i,o)=>{n(e)||t.assignProperties(e),i!==o&&this.popupContentExtensions.reorder(t,o)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>n(e)?e===t||e.id===t.id:!(!e?.content||!x.matchesRef(this.popupContentExtensions.toArray(),this.popupContentExtensions.indexOf(t),e.content))||t.id===e.id})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const i=t=>t||"";return i(t.text)===i(e.text)&&i(t.url)===i(e.url)&&i(t.iconUrl)===i(e.iconUrl)&&i(t.target)===i(e.target)&&i(t.tooltip)===i(e.tooltip)}};E=t([u],E);export{E as FeatureSettings};class v extends r{get _collection(){return this._featureSettings._popupContent.map((t=>this._forContent(t))).concat(Array.from(this._uninitializedPopupContentExtensions))}get _popupTemplateIsInherited(){return this._featureSettings.parent&&this._featureSettings.popupTemplate===this._featureSettings.parent.popupTemplate}constructor(t){super(),this._uninitializedPopupContentExtensions=new Set,this._featureSettings=t,T(this._featureSettings,"_popupContent",(t=>{const e={added:(t.added||[]).map((t=>this._forContent(t))),moved:(t.moved||[]).map((t=>this._forContent(t))),removed:(t.removed||[]).map((t=>this._forContent(t))),target:this};this.emit("change",e)})),t.watch("_popupContent.length",(()=>this.notifyChange("length")))}forContent(t){if(m("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,i){if(m("contentX",t).isNotMissing(),this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),t.featureSettings&&t.featureSettings.popupContentExtensions.remove(t),t._setFeatureSettings(this._featureSettings),t.content){const e=z.get(t.content);if(z.set(t.content,t),e&&e!==t&&this._onRemoved(e),this._featureSettings._popupContent.includes(t.content))if(void 0===i){const i={added:[t],moved:[],removed:e?[e]:[],target:this};this.emit("change",i)}else this._featureSettings._popupContent.reorder(t.content,i);else this._featureSettings._popupContent.add(t.content,i)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e)}return this._onAdded(t),this}removeAt(t){const i=this.getItemAt(t);if(void 0!==i){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(i)){this._uninitializedPopupContentExtensions.delete(i);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t)}else this._featureSettings._popupContent.remove(i.content);return this._onRemoved(i),i}}reorder(t,i){if(t&&this._featureSettings._popupContent.includes(t.content))return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.reorder(t.content,i),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,i)=>t(this._forContent(e),this._forContent(i)))),this}_itemIsInitialized(t){return super._itemIsInitialized(t)&&!!t.content}_onAdded(t){}_onRemoved(t){t.featureSettings===this._featureSettings&&t._setFeatureSettings(void 0)}_forContent(t){if(this._uninitializedPopupContentExtensions.size)for(const t of this._uninitializedPopupContentExtensions)t._resolveContent(),t.content&&(z.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!z.has(t)){const e=new x({content:t});z.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return z.get(t)}}
@@ -1 +1 @@
1
- var e;import{__decorate as i}from"tslib";import t from"@arcgis/core/layers/support/Field";import{EntityBase as s}from"../Entity.js";import{InvalidOperationError as r}from"../InvalidOperationError.js";import{isFieldExtension as o,ItemType as f}from"../ItemType.js";import{FormatSettings as a}from"../support/FormatSettings.js";import{serializable as n}from"../support/Serializable.js";import{esriFormatToGeocortexFormat as d}from"../utilities/date.js";import{isField as l}from"../utilities/esri.js";import{fieldWithArcadeXRegex as h}from"../utilities/field.js";import{NumberFormat as m}from"../utilities/number.js";import{deepClone as _}from"../utilities/object.js";import{caseInsensitiveEquals as p}from"../utilities/string.js";export const _fieldExtensionMap=new WeakMap;let c=e=class extends s{get field(){return this._field}get schema(){return this._schema}get fieldInfo(){if(this._fieldInfo)return this._fieldInfo;if(!this.field?.name)return;const e=this._schema?._featureSettings?.popupTemplate,i=e?.fieldInfos||[];return this._fieldInfo=i.find((e=>e.fieldName===this.field.name)),this._fieldInfo}constructor(e){super(e),this.format="{0}",this.formatSettings=new g(this),this.searchable=!0,this._itemType=f.FIELD_EXTENSION;const{field:i}=e??{};l(i)?this._setField(i):"string"==typeof i?this._deferredFieldProperties={$ref:i}:i?i.$ref?this._deferredFieldProperties=i:this._setField(t.fromJSON(i)):this._setField(new t),this.watch("_schema.featureSource",(()=>this.notifyChange("fieldInfo"))),this.watch("_schema._featureSettings",(e=>{this.formatSettings.parent=e?e.formatSettings:void 0}),!0)}static matchesRef(e,i){return o(e)?p(e.field?.name??e._deferredFieldProperties?.$ref,i.$ref):p(e.name,i.$ref)}_setSchema(e){this._schema=e,this._resolveField(),this.notifyChange("schema"),this.notifyChange("fieldInfo")}_resolveField(){if(this._field||!this._deferredFieldProperties||!this._schema)return;const i=this._schema.fields.find((i=>e.matchesRef(i,this._deferredFieldProperties)));i&&(this._setField(i),this.assignProperties({field:this._deferredFieldProperties}),this._originalRef=this._deferredFieldProperties.$ref,delete this._deferredFieldProperties,_fieldExtensionMap.set(i,this))}_getSerializableProperties(){return{...super._getSerializableProperties(),field:{serializeModes:["initial"],serialize:()=>this.field?this._originalRef?{$ref:this._originalRef}:this._schema?.fields.includes(this._field)&&this.field.name?{$ref:this.field.name}:this.field.toJSON():this._deferredFieldProperties?_(this._deferredFieldProperties):void 0,deserialize:e=>{if(l(e)&&e!==this.field)throw new Error("Property 'field' is read-only.")}},searchable:{serializeModes:["initial"],isDefault:e=>e!==this._isArcadeExpressionField},format:{serializeModes:["initial"],default:"{0}"},formatSettings:"initial"}}async _onInitialize(){if(this._resolveField(),!this._field){const e=this._deferredFieldProperties.$ref;throw this._schema?new r(`Field not found with name: ${e}. Field does not exist.`):new r(`Field not found with name: ${e}. Field does not have a parent schema.`)}}_setField(e){this._field=e,this._isArcadeExpressionField&&(this.searchable=!1),this.notifyChange("field"),this.notifyChange("fieldInfo")}get _isArcadeExpressionField(){return!!this._field&&!!this._field.name&&!!this._field.name.match(h)}};c=e=i([n],c);export{c as FieldExtension};let g=class extends a{constructor(e,i){super(i),this.fieldExtension=e,e.watch("fieldInfo.format.places",(()=>this.notifyChange("fractionalDigits"))),e.watch("fieldInfo.format.digitSeparator",(()=>this.notifyChange("numberFormat"))),e.watch("fieldInfo.format.dateFormat",(()=>this.notifyChange("dateFormat")))}get fractionalDigits(){const e=this.fieldExtension.fieldInfo?.format?.places;return!this.isModified("fractionalDigits")&&this.useFieldInfo&&e?e:this._getSetting("fractionalDigits")}set fractionalDigits(e){this._setSetting("fractionalDigits",e)}get numberFormat(){const e=this.fieldExtension.fieldInfo?.format?.digitSeparator;return!this.isModified("numberFormat")&&this.useFieldInfo&&e?e?m.NUMBER:m.FIXED_POINT:this._getSetting("numberFormat")}set numberFormat(e){this._setSetting("numberFormat",e)}get dateFormat(){const e=this.fieldExtension.fieldInfo?.format?.dateFormat;return!this.isModified("dateFormat")&&this.useFieldInfo&&e?d(e):this._getSetting("dateFormat")}set dateFormat(e){this._setSetting("dateFormat",e)}};g=i([n],g);
1
+ var e;import{__decorate as i}from"tslib";import t from"@arcgis/core/layers/support/Field";import{EntityBase as s}from"../Entity.js";import{InvalidOperationError as r}from"../InvalidOperationError.js";import{isFieldExtension as o,ItemType as f}from"../ItemType.js";import{FormatSettings as a}from"../support/FormatSettings.js";import{serializable as n}from"../support/Serializable.js";import{esriFormatToGeocortexFormat as d}from"../utilities/date.js";import{isField as l}from"../utilities/esri.js";import{fieldWithArcadeXRegex as h}from"../utilities/field.js";import{NumberFormat as m}from"../utilities/number.js";import{deepClone as _}from"../utilities/object.js";import{caseInsensitiveEquals as p}from"../utilities/string.js";export const _fieldExtensionMap=new WeakMap;let c=e=class extends s{get field(){return this._field}get schema(){return this._schema}get fieldInfo(){if(this._fieldInfo)return this._fieldInfo;if(!this.field?.name)return;const e=this._schema?._featureSettings?.popupTemplate,i=e?.fieldInfos||[];return this._fieldInfo=i.find((e=>p(e.fieldName,this.field.name))),this._fieldInfo}constructor(e){super(e),this.format="{0}",this.formatSettings=new g(this),this.searchable=!0,this._itemType=f.FIELD_EXTENSION;const{field:i}=e??{};l(i)?this._setField(i):"string"==typeof i?this._deferredFieldProperties={$ref:i}:i?i.$ref?this._deferredFieldProperties=i:this._setField(t.fromJSON(i)):this._setField(new t),this.watch("_schema.featureSource",(()=>this.notifyChange("fieldInfo"))),this.watch("_schema._featureSettings",(e=>{this.formatSettings.parent=e?e.formatSettings:void 0}),!0)}static matchesRef(e,i){return o(e)?p(e.field?.name??e._deferredFieldProperties?.$ref,i.$ref):p(e.name,i.$ref)}_setSchema(e){this._schema=e,this._resolveField(),this.notifyChange("schema"),this.notifyChange("fieldInfo")}_resolveField(){if(this._field||!this._deferredFieldProperties||!this._schema)return;const i=this._schema.fields.find((i=>e.matchesRef(i,this._deferredFieldProperties)));i&&(this._setField(i),this.assignProperties({field:this._deferredFieldProperties}),this._originalRef=this._deferredFieldProperties.$ref,delete this._deferredFieldProperties,_fieldExtensionMap.set(i,this))}_getSerializableProperties(){return{...super._getSerializableProperties(),field:{serializeModes:["initial"],serialize:()=>this.field?this._originalRef?{$ref:this._originalRef}:this._schema?.fields.includes(this._field)&&this.field.name?{$ref:this.field.name}:this.field.toJSON():this._deferredFieldProperties?_(this._deferredFieldProperties):void 0,deserialize:e=>{if(l(e)&&e!==this.field)throw new Error("Property 'field' is read-only.")}},searchable:{serializeModes:["initial"],isDefault:e=>e!==this._isArcadeExpressionField},format:{serializeModes:["initial"],default:"{0}"},formatSettings:"initial"}}async _onInitialize(){if(this._resolveField(),!this._field){const e=this._deferredFieldProperties.$ref;throw this._schema?new r(`Field not found with name: ${e}. Field does not exist.`):new r(`Field not found with name: ${e}. Field does not have a parent schema.`)}}_setField(e){this._field=e,this._isArcadeExpressionField&&(this.searchable=!1),this.notifyChange("field"),this.notifyChange("fieldInfo")}get _isArcadeExpressionField(){return!!this._field&&!!this._field.name&&!!this._field.name.match(h)}};c=e=i([n],c);export{c as FieldExtension};let g=class extends a{constructor(e,i){super(i),this.fieldExtension=e,e.watch("fieldInfo.format.places",(()=>this.notifyChange("fractionalDigits"))),e.watch("fieldInfo.format.digitSeparator",(()=>this.notifyChange("numberFormat"))),e.watch("fieldInfo.format.dateFormat",(()=>this.notifyChange("dateFormat")))}get fractionalDigits(){const e=this.fieldExtension.fieldInfo?.format?.places;return!this.isModified("fractionalDigits")&&this.useFieldInfo&&e?e:this._getSetting("fractionalDigits")}set fractionalDigits(e){this._setSetting("fractionalDigits",e)}get numberFormat(){const e=this.fieldExtension.fieldInfo?.format?.digitSeparator;return!this.isModified("numberFormat")&&this.useFieldInfo&&e?e?m.NUMBER:m.FIXED_POINT:this._getSetting("numberFormat")}set numberFormat(e){this._setSetting("numberFormat",e)}get dateFormat(){const e=this.fieldExtension.fieldInfo?.format?.dateFormat;return!this.isModified("dateFormat")&&this.useFieldInfo&&e?d(e):this._getSetting("dateFormat")}set dateFormat(e){this._setSetting("dateFormat",e)}};g=i([n],g);
package/data/Schema.js CHANGED
@@ -1 +1 @@
1
- var e;import{__decorate as t}from"tslib";import i from"@arcgis/core/PopupTemplate";import s from"@arcgis/core/core/Collection";import o from"@arcgis/core/layers/support/FeatureType";import n from"@arcgis/core/layers/support/Field";import l from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError as r}from"../InvalidOperationError.js";import{isFieldExtension as d}from"../ItemType.js";import{jsonToGeometryType as a}from"../json/GeometryJson.js";import{InitializableCollectionProxy as h}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as p,isDefault as m,serializable as f,shouldExcludeDefaults as c}from"../support/Serializable.js";import{Settings as u}from"../support/Settings.js";import{CollectionProxy as _}from"../utilities/CollectionProxy.js";import{checkArg as g}from"../utilities/checkArg.js";import{compare as y}from"../utilities/collection.js";import{isValidTimeZone as F,ERR_TIME_ZONE_INVALID as b}from"../utilities/date.js";import{isFeatureType as x,isField as v}from"../utilities/esri.js";import{fieldWithArcadeXRegex as S,fieldWithRelationshipRegex as z}from"../utilities/field.js";import{caseInsensitiveEquals as I}from"../utilities/string.js";import{onCollectionPropertyChange as T}from"../utilities/watch.js";import{_fieldExtensionMap as w,FieldExtension as E}from"./FieldExtension.js";const N=new Map;N.set("objectid","oid"),N.set("oid","oid"),N.set("fid","oid"),N.set("shape","geometry"),N.set("shape__length","double"),N.set("shape_length","double"),N.set("shape__area","double"),N.set("shape_area","double"),N.set("area","double"),N.set("perimeter","double"),N.set("length","double"),N.set("fnode_","double"),N.set("tnode_","double"),N.set("lpoly_","double"),N.set("rpoly_","double"),N.set("cover_","integer"),N.set("cover_id","integer"),N.set("idtic","integer"),N.set("xtic","double"),N.set("ytic","double"),N.set("xmin","double"),N.set("ymin","double"),N.set("xmax","double"),N.set("ymax","double"),N.set("arc_","double"),N.set("subclass_","integer"),N.set("subclass_id","integer"),N.set("routelink","integer"),N.set("arclink","integer"),N.set("f_meas","double"),N.set("t_meas","double"),N.set("f_pos","double"),N.set("t_pos","double"),N.set("f_meas","double"),N.set("globalid","global-id"),N.set("guid","guid");export{S as fieldWithArcadeXRegex,z as fieldWithRelationshipRegex};const j=new WeakMap;let M=e=class extends u{get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){const e=this._getSetting("primaryKeyField");if(!e){const e=this.fields.filter((e=>"oid"===e.type));if(1===e.length)return e.getItemAt(0).name}return e}set primaryKeyField(e){this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){!this._featureSettings?.popupTemplate||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){g("timeZone",e).satisfies((e=>F(e)),b(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}constructor(e){super(e),this.fieldExtensions=new A(this),this.fields=new k(this)}static createFieldInfoFromField(e){let t=!0;const i=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||N.has(i)&&N.get(i)===e.type)&&(t=!1),new l({visible:t,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0,isEditable:e.editable})}findFieldByName(e){return this.fields.find((t=>I(t.name,e)))}toJSON(e="all"){const t=p(this._getSerializableProperties(),this,e)||{};let i=t.fieldExtensions;this.parent&&(i=i?.filter((e=>{const t=this.parent;return!t?.fieldExtensions?.some((t=>t.id===e.id))})));const{fields:s}=t;if(t)for(const e of Object.keys(t))this.isModified(e)||delete t[e];if(s&&(t.fields=s),i?.length&&(t.fieldExtensions=i),!c(e)||!m(t))return t}createPopupTemplate(){const e=this.createAllFieldInfos();return new i({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((t=>e.createFieldInfoFromField(t)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=e?a(e):void 0}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>e.toJSON())):void 0,deserialize:e=>{if(!e)return;const t=e.map((e=>v(e)?e:n.fromJSON(e)));y(this.fields,t,{onNew:(e,t)=>{this.fields.add(e,t)},onMatch:(e,t,i,s)=>{e!==t&&(e.alias=t.alias,e.editable=t.editable,e.length=t.length,e.nullable=t.nullable,e.type=t.type),i!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,t)=>e.name===t.name})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.toArray().map((t=>t.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))),deserialize:e=>{e&&y(this.fieldExtensions,e,{onNew:(e,t)=>{this.fieldExtensions.add(d(e)?e:new E(e),t)},onMatch:(e,t,i,s)=>{d(t)||e.assignProperties(t),i!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,t)=>d(t)?t===e:!(!t?.field||!E.matchesRef(e,t.field))||e.id===t.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const t=e.map((e=>x(e)||!e?e:o.fromJSON(e)));y(this.types,t,{onNew:(e,t)=>{this.types.add(e,t)},onMatch:(e,t,i,s)=>{e!==t&&(e.name=t.name,e.templates=t.templates?[...t.templates]:[],e.domains=t.domains),i!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,t)=>e.id===t.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};M=e=t([f],M);export{M as Schema};class k extends _{get _createFieldLookup(){return this._collection.reduce(((e,t)=>(e.add(t),e)),new WeakSet)}get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){if(!this._popupTemplate?.fieldInfos||!this._popupTemplate?.expressionInfos)return new s;const e=new s;for(const t of this._popupTemplate.fieldInfos){const i=t.fieldName.match(S);if(i){const s=this._popupTemplate.expressionInfos.find((e=>e.name===i[1]));if(s){if(!j.has(t)){const e=new n({name:t.fieldName,alias:t.label||s.title||t.fieldName,type:"number"===s.returnType?"double":"string",editable:!1});j.set(t,e)}e.add(j.get(t))}}}return e}get _collection(){return this._schema._fields.concat(this.expressionFields)}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}constructor(e){super(),this._schema=e,T(this._schema,"_fields",(e=>{this.emit("change",e),this._fieldLookup=void 0})),e.watch("_fields.length",(()=>this.notifyChange("length")))}includes(e){return this._fieldLookup=this._fieldLookup??this._createFieldLookup,this._fieldLookup.has(e)}clone(){return new k(this._schema)}add(e,t){g("field",e).isNotMissing(),this._fieldLookup=void 0;const i=e.name?e.name.match(S):void 0;if(i){if(!this._popupTemplate)throw new r("Cannot create a field that references an arcade expression without a feature source and popup template.");const t=this._popupTemplate.expressionInfos.find((e=>e.name===i[1]));if(!t)throw new r("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((t=>t.fieldName===e.name));s||(s=new l({fieldName:e.name,label:t.title}),this._popupTemplate.fieldInfos.push(s));const o=j.get(s);j.set(s,e);const n={added:[e],moved:[],removed:o?[o]:[],target:this};this.emit("change",n),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.add(e,t);return this}removeAt(e){g("index",e).isNotMissing();const t=this.getItemAt(e);if(!t)return;this._fieldLookup=void 0;if(t.name?t.name.match(S):void 0){const e=this._popupTemplate.fieldInfos.findIndex((e=>e.fieldName===t.name));this._popupTemplate.fieldInfos.splice(e,1);const i={added:[],moved:[],removed:[t],target:this};this.emit("change",i),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.remove(t);return t}reorder(e,t){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,t),e}sort(e){return this._schema._fields.sort(e),this}}class A extends h{get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}constructor(e){super(),this._uninitializedFieldExtensions=new Set,this._schema=e,T(this._schema,"fields",(e=>{const t={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",t)})),e.watch("fields.length",(()=>this.notifyChange("length")))}forField(e){if(g("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,t){if(g("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const i=w.get(e.field);if(w.set(e.field,e),i&&i!==e&&this._onRemoved(i),this._schema.fields.includes(e.field))if(void 0===t){const t={added:[e],moved:[],removed:i?[i]:[],target:this};this.emit("change",t)}else this._schema.fields.reorder(e.field,t);else this._schema.fields.add(e.field,t)}else{this._uninitializedFieldExtensions.add(e);const t={added:[e],moved:[],removed:[],target:this};this.emit("change",t)}return this._onAdded(e),this}removeAt(e){const t=this.getItemAt(e);if(void 0!==t){if(this._uninitializedFieldExtensions.has(t)){this._uninitializedFieldExtensions.delete(t);const e={added:[],moved:[],removed:[t],target:this};this.emit("change",e)}else this._schema.fields.remove(t.field);return this._onRemoved(t),t}}reorder(e,t){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,t),e}sort(e){return this._schema.fields.sort(((t,i)=>e(this._forField(t),this._forField(i)))),this}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(w.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!w.has(e)){const t=new E({field:e});w.set(e,t),t._setSchema(this._schema),this._onAdded(t)}return w.get(e)}}
1
+ var e;import{__decorate as t}from"tslib";import i from"@arcgis/core/PopupTemplate";import s from"@arcgis/core/core/Collection";import o from"@arcgis/core/layers/support/FeatureType";import n from"@arcgis/core/layers/support/Field";import l from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError as r}from"../InvalidOperationError.js";import{isFieldExtension as d}from"../ItemType.js";import{jsonToGeometryType as a}from"../json/GeometryJson.js";import{InitializableCollectionProxy as h}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as p,isDefault as m,serializable as f,shouldExcludeDefaults as c}from"../support/Serializable.js";import{Settings as u}from"../support/Settings.js";import{CollectionProxy as _}from"../utilities/CollectionProxy.js";import{checkArg as g}from"../utilities/checkArg.js";import{compare as y}from"../utilities/collection.js";import{isValidTimeZone as F,ERR_TIME_ZONE_INVALID as b}from"../utilities/date.js";import{isFeatureType as x,isField as v}from"../utilities/esri.js";import{fieldWithArcadeXRegex as S,fieldWithRelationshipRegex as z}from"../utilities/field.js";import{caseInsensitiveEquals as I}from"../utilities/string.js";import{onCollectionPropertyChange as T}from"../utilities/watch.js";import{_fieldExtensionMap as w,FieldExtension as E}from"./FieldExtension.js";const N=new Map;N.set("objectid","oid"),N.set("oid","oid"),N.set("fid","oid"),N.set("shape","geometry"),N.set("shape__length","double"),N.set("shape_length","double"),N.set("shape__area","double"),N.set("shape_area","double"),N.set("area","double"),N.set("perimeter","double"),N.set("length","double"),N.set("fnode_","double"),N.set("tnode_","double"),N.set("lpoly_","double"),N.set("rpoly_","double"),N.set("cover_","integer"),N.set("cover_id","integer"),N.set("idtic","integer"),N.set("xtic","double"),N.set("ytic","double"),N.set("xmin","double"),N.set("ymin","double"),N.set("xmax","double"),N.set("ymax","double"),N.set("arc_","double"),N.set("subclass_","integer"),N.set("subclass_id","integer"),N.set("routelink","integer"),N.set("arclink","integer"),N.set("f_meas","double"),N.set("t_meas","double"),N.set("f_pos","double"),N.set("t_pos","double"),N.set("f_meas","double"),N.set("globalid","global-id"),N.set("guid","guid");export{S as fieldWithArcadeXRegex,z as fieldWithRelationshipRegex};const j=new WeakMap;let M=e=class extends u{get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){const e=this._getSetting("primaryKeyField");if(!e){const e=this.fields.filter((e=>"oid"===e.type));if(1===e.length)return e.getItemAt(0).name}return e}set primaryKeyField(e){this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){!this._featureSettings?.popupTemplate||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){g("timeZone",e).satisfies((e=>F(e)),b(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}constructor(e){super(e),this.fieldExtensions=new A(this),this.fields=new k(this)}static createFieldInfoFromField(e){let t=!0;const i=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||N.has(i)&&N.get(i)===e.type)&&(t=!1),new l({visible:t,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0,isEditable:e.editable})}findFieldByName(e){return this.fields.find((t=>I(t.name,e)))}toJSON(e="all"){const t=p(this._getSerializableProperties(),this,e)||{};let i=t.fieldExtensions;this.parent&&(i=i?.filter((e=>{const t=this.parent;return!t?.fieldExtensions?.some((t=>t.id===e.id))})));const{fields:s}=t;if(t)for(const e of Object.keys(t))this.isModified(e)||delete t[e];if(s&&(t.fields=s),i?.length&&(t.fieldExtensions=i),!c(e)||!m(t))return t}createPopupTemplate(){const e=this.createAllFieldInfos();return new i({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((t=>e.createFieldInfoFromField(t)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=e?a(e):void 0}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>e.toJSON())):void 0,deserialize:e=>{if(!e)return;const t=e.map((e=>v(e)?e:n.fromJSON(e)));y(this.fields,t,{onNew:(e,t)=>{this.fields.add(e,t)},onMatch:(e,t,i,s)=>{e!==t&&(e.alias=t.alias,e.editable=t.editable,e.length=t.length,e.nullable=t.nullable,e.type=t.type),i!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,t)=>I(e.name,t.name)})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.toArray().map((t=>t.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))),deserialize:e=>{e&&y(this.fieldExtensions,e,{onNew:(e,t)=>{this.fieldExtensions.add(d(e)?e:new E(e),t)},onMatch:(e,t,i,s)=>{d(t)||e.assignProperties(t),i!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,t)=>d(t)?t===e:!(!t?.field||!E.matchesRef(e,t.field))||e.id===t.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const t=e.map((e=>x(e)||!e?e:o.fromJSON(e)));y(this.types,t,{onNew:(e,t)=>{this.types.add(e,t)},onMatch:(e,t,i,s)=>{e!==t&&(e.name=t.name,e.templates=t.templates?[...t.templates]:[],e.domains=t.domains),i!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,t)=>e.id===t.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};M=e=t([f],M);export{M as Schema};class k extends _{get _createFieldLookup(){return this._collection.reduce(((e,t)=>(e.add(t),e)),new WeakSet)}get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){if(!this._popupTemplate?.fieldInfos||!this._popupTemplate?.expressionInfos)return new s;const e=new s;for(const t of this._popupTemplate.fieldInfos){const i=t.fieldName.match(S);if(i){const s=this._popupTemplate.expressionInfos.find((e=>e.name===i[1]));if(s){if(!j.has(t)){const e=new n({name:t.fieldName,alias:t.label||s.title||t.fieldName,type:"number"===s.returnType?"double":"string",editable:!1});j.set(t,e)}e.add(j.get(t))}}}return e}get _collection(){return this._schema._fields.concat(this.expressionFields)}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}constructor(e){super(),this._schema=e,T(this._schema,"_fields",(e=>{this.emit("change",e),this._fieldLookup=void 0})),e.watch("_fields.length",(()=>this.notifyChange("length")))}includes(e){return this._fieldLookup=this._fieldLookup??this._createFieldLookup,this._fieldLookup.has(e)}clone(){return new k(this._schema)}add(e,t){g("field",e).isNotMissing(),this._fieldLookup=void 0;const i=e.name?e.name.match(S):void 0;if(i){if(!this._popupTemplate)throw new r("Cannot create a field that references an arcade expression without a feature source and popup template.");const t=this._popupTemplate.expressionInfos.find((e=>e.name===i[1]));if(!t)throw new r("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((t=>I(t.fieldName,e.name)));s||(s=new l({fieldName:e.name,label:t.title}),this._popupTemplate.fieldInfos.push(s));const o=j.get(s);j.set(s,e);const n={added:[e],moved:[],removed:o?[o]:[],target:this};this.emit("change",n),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.add(e,t);return this}removeAt(e){g("index",e).isNotMissing();const t=this.getItemAt(e);if(!t)return;this._fieldLookup=void 0;if(t.name?t.name.match(S):void 0){const e=this._popupTemplate.fieldInfos.findIndex((e=>I(e.fieldName,t.name)));this._popupTemplate.fieldInfos.splice(e,1);const i={added:[],moved:[],removed:[t],target:this};this.emit("change",i),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.remove(t);return t}reorder(e,t){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,t),e}sort(e){return this._schema._fields.sort(e),this}}class A extends h{get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}constructor(e){super(),this._uninitializedFieldExtensions=new Set,this._schema=e,T(this._schema,"fields",(e=>{const t={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",t)})),e.watch("fields.length",(()=>this.notifyChange("length")))}forField(e){if(g("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,t){if(g("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const i=w.get(e.field);if(w.set(e.field,e),i&&i!==e&&this._onRemoved(i),this._schema.fields.includes(e.field))if(void 0===t){const t={added:[e],moved:[],removed:i?[i]:[],target:this};this.emit("change",t)}else this._schema.fields.reorder(e.field,t);else this._schema.fields.add(e.field,t)}else{this._uninitializedFieldExtensions.add(e);const t={added:[e],moved:[],removed:[],target:this};this.emit("change",t)}return this._onAdded(e),this}removeAt(e){const t=this.getItemAt(e);if(void 0!==t){if(this._uninitializedFieldExtensions.has(t)){this._uninitializedFieldExtensions.delete(t);const e={added:[],moved:[],removed:[t],target:this};this.emit("change",e)}else this._schema.fields.remove(t.field);return this._onRemoved(t),t}}reorder(e,t){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,t),e}sort(e){return this._schema.fields.sort(((t,i)=>e(this._forField(t),this._forField(i)))),this}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(w.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!w.has(e)){const t=new E({field:e});w.set(e,t),t._setSchema(this._schema),this._onAdded(t)}return w.get(e)}}
package/data/convert.js CHANGED
@@ -1 +1 @@
1
- import e from"@arcgis/core/geometry/Point";import t from"@arcgis/core/geometry/SpatialReference";import{geometryTypeToJson as r}from"../json/GeometryJson.js";import{translate as o}from"../locale/language.js";import{INVARIANT as n}from"../locale.js";import{checkArg as a,assertNever as i}from"../utilities/checkArg.js";import{parse as s,format as c,DEFAULT_PARSING_FORMATS as m,DateFormat as l,INVALID_DATE as u}from"../utilities/date.js";import{isPoint as f,isMultipoint as d,isPolyline as p,isPolygon as y,isExtent as g}from"../utilities/esri.js";import{project as w,esriToWKT as h,wktToEsri as F,esriWkidToWkt as N,esriWktToWkid as S,esriToGeoJSON as O,geoJSONToEsri as T}from"../utilities/geometry.js";import{getLogger as R}from"../utilities/log.js";import{isNumeric as G,parse as D,format as b,NumberFormat as A}from"../utilities/number.js";import{caseInsensitiveEquals as E}from"../utilities/string.js";import{Feature as x}from"./Feature.js";import{FeatureSet as M}from"./FeatureSet.js";const I=["=","-","+","@"],_='"',v="\r\n",L="\n",P=[...m.map(pe),"M/d/yy"],C=/(\w+)_(point|multipoint|polyline|polygon)z?/;var U;function $(){return R("geocortex.api.data.convert")}!function(e){e.DATE="D",e.NUMBER="N",e.STRING="C",e.BOOLEAN="L"}(U||(U={}));export const FIELD_NAME_REGEX=/[^a-zA-Z\d_]/g;export var GeometryFormat;!function(e){e.NONE="NONE",e.WKT="WKT",e.XY="XY",e.XYZ="XYZ",e.LAT_LON="LAT_LONG",e.GEO_JSON="GEO_JSON",e.ARCGIS_JSON="ARCGIS_JSON"}(GeometryFormat||(GeometryFormat={}));export const geometryTypeHeaders={[GeometryFormat.XYZ]:[["x","y","z"]],[GeometryFormat.XY]:[["x","y"]],[GeometryFormat.LAT_LON]:[["latitude","longitude"],["lat","lon"],["lat","long"]],[GeometryFormat.ARCGIS_JSON]:[["geometry"]],[GeometryFormat.GEO_JSON]:[["geometry"]],[GeometryFormat.WKT]:[["geometry"]]};const j=[[GeometryFormat.ARCGIS_JSON,ne],[GeometryFormat.GEO_JSON,ae],[GeometryFormat.WKT,ie]],J=new Map(j);export async function uploadDataToFeatureSet(t){const n=await async function(t){const{data:r,includeHeaderRow:o,geometryFormat:n,geometryFields:a,locale:s,numberFormat:c,inSpatialReference:m}=t,l=o?r.slice(1):r;if(n===GeometryFormat.NONE)return{columnIndices:[]};const u=e=>me(e,s,c),f=(t,r)=>{const o=r===GeometryFormat.XYZ,n=r===GeometryFormat.LAT_LON;return{columnIndices:t,geometries:l.map((r=>{if(r.length>=Math.max(...t)&&G(r[t[0]]?.raw,s)&&G(r[t[1]]?.raw,s)&&(!o||G(r[t[2]]?.raw,s)))return new e({x:u(n?r[t[1]].raw:r[t[0]].raw),y:u(n?r[t[0]].raw:r[t[1]].raw),z:o?u(r[t[2]].raw):0,spatialReference:m})}))}},d=async(e,t)=>({columnIndices:[e],geometries:await Promise.all(l.map((t=>t[e])).map((e=>{if(e?.raw)return t(e.raw.toString(),m)})))}),p=async(e,t)=>{switch(t){case GeometryFormat.NONE:return{columnIndices:[0]};case GeometryFormat.LAT_LON:case GeometryFormat.XYZ:case GeometryFormat.XY:return f(e,t);case GeometryFormat.ARCGIS_JSON:return d(e[0],ne);case GeometryFormat.GEO_JSON:return d(e[0],ae);case GeometryFormat.WKT:return d(e[0],ie);default:return i(t,new Error(`Unknown geometry format "${t}".`))}};if(n){const e=se(o?r[0]:r[0].map(((e,t)=>({raw:t.toString()}))),n,o?a:a.map((e=>""+(parseInt(e.match(/\d+/g)[0])-1))));if(o&&void 0===e)throw new Error(`Error parsing file data: Expected geometry columns ${geometryTypeHeaders[n][0].join(",")} are missing for GeometryType.${n}`);return p(e??[0],n)}const[y,g]=await le(r,m,o);if(y===GeometryFormat.NONE)return{columnIndices:[]};return g.length>1?f(g,y):d(g[0],J.get(y))}(t),a=function(e,t){const{data:n,displayField:a,includeHeaderRow:i,inSpatialReference:s,outSpatialReference:c,generatePrimaryKey:m}=e,l={fields:[]},u=e=>!(!t.columnIndices||0===t.columnIndices.length)&&t.columnIndices.includes(e);let{primaryKeyField:f}=e,d=0;for(let t=0;t<n[0].length;t++){if(u(t))continue;const r=fe(e,t,!m&&!f&&!l.fields.find((e=>"esriFieldTypeOID"===e.type)));let a=n[0][t]?.raw?.toString(),s=a?.replace(FIELD_NAME_REGEX,"_");i&&s||(s="field"+ ++d,a=o("gcx.api.data.convert.import-field-alias",d)),l.fields.push({alias:a,name:s,type:r}),"esriFieldTypeOID"===r&&(f=s)}if(l.spatialReference=c??t.geometries?.[0]?.spatialReference??s,t.geometries?.length){const e=t.geometries.filter((e=>void 0!==e)).map((e=>e.type)),o=e[0];l.geometryType=e.every((e=>e===o))?r(o):void 0}if(!l.fields.find((e=>"esriFieldTypeOID"===e.type))){const e=l.fields.length+1,t=!!l.fields.find((e=>"objectid"===e.name.toLowerCase()));f=t?`OBJECTID_${e}`:"OBJECTID",l.fields.push({name:f,alias:f,type:"esriFieldTypeOID"})}return l.displayField=a??l.fields.find((e=>e.name!==f&&"esriFieldTypeString"===e.type))?.name??l.fields.find((e=>e.name!==f))?.name??f,l.primaryKeyField=f,l}(t,n),s=await async function(e,t,r){const{data:o,includeHeaderRow:n,outFields:a,escapeFormulaChars:i,locale:s,numberFormat:c,dateFormat:m}=e,{spatialReference:l}=r,u=[],f=n?o.slice(1):o,d=(e,r)=>!t.columnIndices||0===t.columnIndices.length||!t.columnIndices.includes(r);return await Promise.all(f.map((async(e,o)=>{const n=new x;for(let t=0;t<r.fields.length;t++){const l=r.fields[t],u=e.filter(d);if(a.includes("*")||a.includes(l.name)){let e=await de(u[t]?.raw,l,{escapeFormulaChars:i,dateFormat:m,numberFormat:c,locale:s});"esriFieldTypeOID"===l.type&&null===e&&(e=o),n.attributes.set(l.name,e)}}t.geometries&&(n.geometry=await K(t.geometries[o],l)),u.push(n)}))),u}(t,n,a);return new M({features:s,schema:a})}export async function toCsv(e,r){a("featureSet",e).isNotMissing();const o=Array.from(e),n={...{useFormattedValues:!1,alwaysQuote:!1,escapeFormulaChars:!0,delimiter:",",dateFormat:l.ROUND_TRIP,geometryFormat:o.some((e=>void 0!==e.geometry&&null!==e.geometry))?GeometryFormat.WKT:GeometryFormat.NONE,includeByteOrderMark:!0,outSpatialReference:t.WGS84,includeHeaderRow:!0,outFields:B(e.source),rowDelimiter:navigator.platform.startsWith("Win")?v:L},...r},{includeByteOrderMark:i,includeHeaderRow:s,delimiter:c,outFields:m,rowDelimiter:u}=n,f=[];i&&f.push("\ufeff");const d=Y(o,n),p=k(o,m,e.schema,!0),y=k(o,m,e.schema,!1);if(s){const e=[];for(const t of d)e.push(V(t,n));for(const t of p)e.push(V(t,n));for(const t of y)e.push(V(t,n));const t=e.join(c)+u;f.push(t)}await Promise.all(o.map((async e=>{const t=[],r=(t,r)=>V(q(Q(e,t,r),r),r);t.push(...await async function(e,t){let r=await Z(e,t);t.geometryFormat!==GeometryFormat.XYZ&&t.geometryFormat!==GeometryFormat.XY&&t.geometryFormat!==GeometryFormat.LAT_LON||(r=r.map((e=>void 0===e?"":q(e,t))));return r.map((e=>""===e?"":V(e,t)))}(e.geometry,n)),t.push(...p.map((e=>r(e,n)))),t.push(...y.map((e=>r(e,n))));const o=`${t.join(c)}${u}`;f.push(o)})));return new Blob(f,{type:"text/plain",endings:u===L||u===v?"transparent":"native"})}export async function csvToUploadData(e,t){let r;if(a("csvData",e).isNotMissing(),e instanceof Blob){const t=new Promise(((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsText(e)}));r=await t}else r=e;const i=H(t),s=i.rowDelimiter||function(e){let t=L;return oe(e,v,((r,o)=>(0===r&&o===e.length||(t=v),!1))),t}(r),c=i.delimiter??function(e,t,r){const o=",";if(0===e.length)return o;const a=[];if(oe(e,t,((t,r)=>(r!==e.length||t!==r)&&(a.push(e.substring(t,r)),a.length<3))),0===a.length)return o;let i=[{delimiter:",",rowsDelimiterOccurrences:[],rowsNumberAdjacentOccurrences:[]},{delimiter:";",rowsDelimiterOccurrences:[]},{delimiter:"|",rowsDelimiterOccurrences:[]},{delimiter:"\t",rowsDelimiterOccurrences:[]},{delimiter:" ",rowsDelimiterOccurrences:[]}].filter((e=>a[0].includes(e.delimiter)));if(0===i.length)return o;for(const e of a)for(const t of i){let o=0,n=0;oe(e,t.delimiter,((a,i)=>{if(i!==e.length&&o++,","===t.delimiter){const t=e.charAt(i-1),o=e.charAt(i+1);G(t,r)&&G(o,r)&&n++}return!0})),t.rowsDelimiterOccurrences.push(o),","===t.delimiter&&t.rowsNumberAdjacentOccurrences.push(n)}if(i=i.filter((e=>e.rowsDelimiterOccurrences.every((t=>e.rowsDelimiterOccurrences[0]===t)))).sort(((e,t)=>t.rowsDelimiterOccurrences[0]-e.rowsDelimiterOccurrences[0])),i.length>1&&","===i[0].delimiter&&null!=r&&r!==n){const e=i[0];if(null!=e&&","===e.delimiter&&","===Intl.NumberFormat(r).formatToParts(1.1).find((e=>"decimal"===e.type))?.value)for(let t=0;t<e.rowsDelimiterOccurrences.length;t++)if(e.rowsDelimiterOccurrences[t]<=e.rowsNumberAdjacentOccurrences[t]){i=i.filter((e=>","!==e.delimiter));break}}if(0===i.length)return o;return i[0].delimiter}(r,s,t.locale),m=function(e,t,r){const o=[],n=(e,t)=>{const o=[];return oe(e,r,((r,n)=>{const a=e.substring(r,n);return o.push({raw:re(a,t,o.length)}),!0})),o};if(oe(e,t,((t,r)=>{const a=e.substring(t,r);return a.length>0&&o.push(n(a,o.length)),!0})),o.length){const e=o[0].length;o.forEach(((t,r)=>{if(t.length!==e)throw new Error(`Detected invalid CSV: Row ${r} does not have expected number of columns: ${e}`)}))}return o}(r,s,c);let{geometryFormat:l,geometryFields:u}=t;if(!l){const[e,t]=await le(m,i.inSpatialReference,i.includeHeaderRow);l=e,u=t.map((e=>i.includeHeaderRow?m[0][e]?.raw??o("gcx.api.data.convert.import-field-alias",(e+1).toString()):o("gcx.api.data.convert.import-field-alias",(e+1).toString())))}return{data:m,...i,geometryFormat:l,geometryFields:u}}export async function csvToFeatureSet(e,t){const r=H(t);return uploadDataToFeatureSet(await csvToUploadData(e,r))}export async function toXLSX(e,r){a("featureSet",e).isNotMissing();const o=Array.from(e),n={...{useFormattedValues:!1,includeHeaderRow:!0,escapeFormulaChars:!0,geometryFormat:o.some((e=>void 0!==e.geometry&&null!==e.geometry))?GeometryFormat.WKT:GeometryFormat.NONE,outFields:B(e.source),outSpatialReference:t.WGS84,dateFormat:l.DEFAULT,numberFormat:A.DEFAULT,sheetName:"sheet1"},...r},{outFields:i,includeHeaderRow:s,dateFormat:c,numberFormat:m}=n,u=[],f=Y(o,n),d=k(o,i,e.schema,!0),p=k(o,i,e.schema,!1);if(s){const t=f.concat(d).concat(function(e,t){const r=t?.schema?.fieldExtensions.initializedItems.map((e=>e.field));return e.map((e=>r?.find((t=>t.name===e))?.alias??e))}(p,e.source));u.push(t)}await Promise.all(o.map((async e=>{const t=[];t.push(...await Z(e.geometry,n));for(const r of d){const o=ge(e.attributes.get(r),n);t.push(o)}for(const r of p){const o=ge(Q(e,r,n),n);t.push(o)}t.every((e=>"string"!=typeof e||e.length<=32767))?u.push(t):$().warn(`toXLSX cell limit exceeded, feature (${e.primaryKey??e.id}) omitted.`)})));const y=await import("xlsx"),g={SheetNames:[],Sheets:{}},w=y.utils.aoa_to_sheet(u,{cellDates:!0});for(const e of Object.keys(w).filter((e=>!e.startsWith("!")))){const t=w[e];"d"===t.t?t.z=pe(c??l.ROUND_TRIP):"n"===t.t&&(t.z=ye(m))}g.SheetNames.push(n.sheetName),g.Sheets[n.sheetName]=w;const h=y.write(g,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),F=new Uint8Array(h.length);for(let e=0;e<h.length;e++)F[e]=h.charCodeAt(e);return new Blob([F.buffer],{type:"text/plain"})}export async function xlsxToUploadData(e,t){a("xlsxData",e).isNotMissing();const r=X(t),n=await async function(e,t){const r=await import("xlsx"),o=new Promise(((o,n)=>{const a=new FileReader;a.onload=()=>{const e=new Uint8Array(a.result);let n="";for(const t of e)n+=String.fromCharCode(t);const i=r.read(n,{type:"binary",cellDates:!0}),s=t.sheetName||i.SheetNames[0],c=i.Sheets[s];o(c)},a.onerror=()=>{n(a.error)},a.readAsArrayBuffer(e)})),n=await o,a=r.utils.decode_range(n["!ref"]),i=[];for(let e=a.s.r;e<=a.e.r;e++){const t=[];for(let o=a.s.c;o<=a.e.c;o++){const a=n[`${r.utils.encode_cell({r:e,c:o})}`];t.push(a?{raw:a.v,formatted:"s"===a.t?void 0:a.w}:{raw:""})}i.push(t)}return i}(e,r);let{geometryFormat:i,geometryFields:s}=t;if(!i){const[e,t]=await le(n,r.inSpatialReference,r.includeHeaderRow);i=e,s=t.map((e=>r.includeHeaderRow?n[0][e]?.raw.toString()??o("gcx.api.data.convert.import-field-alias",(e+1).toString()):o("gcx.api.data.convert.import-field-alias",(e+1).toString())))}return{data:n,...r,geometryFormat:i,geometryFields:s}}export async function xlsxToFeatureSet(e,t){a("xlsxData",e).isNotMissing();const r=X(t);return uploadDataToFeatureSet(await xlsxToUploadData(e,r))}export async function toShapefile(e,r){a("featureSet",e).isNotMissing();const[{default:o},n]=await Promise.all([import("jszip"),import("../forked-libs/shp-write/index.js")]),i=Array.from(e),s={...{useFormattedValues:!1,outFields:B(e.source),fileName:e.title||"export"},...r},{outFields:c,outSpatialReference:m,fileName:l}=s,u=e=>e.geometry.hasZ||e.geometry.hasM,w=new Map,h=i.filter((e=>f(e.geometry)));w.set("POINTZ",h.filter(u)),w.set("POINT",h.filter((e=>!u(e))));const F=i.filter((e=>d(e.geometry)));w.set("MULTIPOINTZ",F.filter(u)),w.set("MULTIPOINT",F.filter((e=>!u(e))));const S=i.filter((e=>p(e.geometry)));w.set("POLYLINEZ",S.filter(u)),w.set("POLYLINE",S.filter((e=>!u(e))));const O=i.filter((e=>y(e.geometry)||g(e.geometry)));w.set("POLYGONZ",O.filter(u)),w.set("POLYGON",O.filter((e=>!u(e))));const T=k(i,c,e.schema,!0);let R=k(i,c,e.schema,!1);R=T.concat(R);const G=new o,D=Array.from(w.keys()).filter((e=>w.get(e).length>0));await Promise.all(D.map((async r=>{const o=w.get(r),a=await Promise.all(o.map((e=>K(e.geometry,m)))),i=await async function(e){const{wkid:r,wkt:o}=e[0].spatialReference;if(!e.every((e=>e.spatialReference.wkid===r&&e.spatialReference.wkt===o)))throw new Error("Cannot create shapefile that contains geometries with different spatial references.");return o??await N(r??t.WGS84.wkid)}(a),c=s.useFormattedValues?Object.assign({},...R.map((e=>({[e]:U.STRING})))):function(e,t,r,o){const n={};for(const a of t){if(e.some((e=>ee(e,a)))){n[a]=U.STRING;continue}const t=r?r.fields.find((e=>e.name===a)):void 0;if(t){switch(t.type){case"oid":case"double":case"integer":case"single":case"small-integer":n[a]=U.NUMBER;break;case"date":n[a]=o?U.NUMBER:U.DATE;break;default:n[a]=U.STRING}continue}const i=(e,t)=>e.attributes.get(t)??e.presentableAttributes.get(t);e.every((e=>i(e,a)instanceof Date||void 0===i(e,a)))&&e.some((e=>i(e,a)instanceof Date))?n[a]=o?U.NUMBER:U.DATE:e.every((e=>"number"==typeof i(e,a)||void 0===i(e,a)))&&e.some((e=>"number"==typeof i(e,a)))?n[a]=U.NUMBER:e.every((e=>"boolean"==typeof i(e,a)||void 0===i(e,a)))&&e.some((e=>"boolean"==typeof i(e,a)))?n[a]=U.BOOLEAN:n[a]=U.STRING}return n}(o,R,e.schema,"timestamp"===s.dateFormat),u=function(e){return e.map((e=>{if(f(e)){const{x:t,y:r,z:o,m:n}=e,a=[t,r];return e.hasZ&&a.push(o),e.hasM&&a.push(n),we(a,e)}if(d(e))return he(e.points,e);if(p(e))return Fe(e.paths,e);if(y(e))return Fe(e.rings,e);if(g(e)){const t=[e.xmin,e.ymax];return[[t,[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],t]]}throw new Error("Unsupported geometry type.")}))}(a),h=function(e,t,r,o){const n=[];for(const a of e){const e={};for(const n of t){let t=Q(a,n,o);if(null==t&&(t=""),o.useFormattedValues)t=t.toString();else{t=Ne(t,r[n],o)}e[n]=t}n.push(e)}return n}(o,R,c,s);n.write(h,r,u,((e,t)=>{const o=D.length>1?`${l}_${r.toLowerCase()}`:l;G.file(`${o}.shp`,t.shp.buffer,{binary:!0}),G.file(`${o}.shx`,t.shx.buffer,{binary:!0}),G.file(`${o}.dbf`,t.dbf.buffer,{binary:!0}),G.file(`${o}.prj`,i)}))})));const b=await G.generateAsync({type:"uint8array"});return new Blob([b.buffer],{type:"text/plain"})}export async function shapefileToUploadData(r,o){a("shapefileData",r).isNotMissing();const n=z(o),i=new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{e(o.result)},o.onerror=()=>{t(o.error)},o.readAsArrayBuffer(r)})),[{default:s},{default:c}]=await Promise.all([import("jszip"),import("shpjs")]),m=await i,l=await s.loadAsync(new Uint8Array(m)),u=l.filter((()=>!0)).map((e=>e.name));let d,p=u.filter((e=>e.endsWith(".shp"))).map((e=>e.substring(0,e.length-4)));if(p=function(e){if(!e.length)return[];let t=e[0];const r=t.match(C);return r?(t=r[1],e.filter((e=>{const r=e.match(C);return r&&r[1]===t}))):[t]}(p),u.some((e=>e.endsWith(".prj")))&&!p.every((e=>u.includes(`${e}.prj`))))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");await Promise.all(u.filter((e=>e.endsWith(".prj"))).map((async e=>{const t=await l.file(e).async("string");if(d){if(t!==d)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else d=t})));let y=[],g=[];for(const e of p){if(!u.includes(`${e}.shx`)||!u.includes(`${e}.dbf`))throw new Error("Shapefile must contain shp, shx, and dbf files.");const t=await l.file(`${e}.shp`).async("uint8array"),r=c.parseShp(t),o=await l.file(`${e}.dbf`).async("uint8array"),n=c.parseDbf(o);if(n.length!==r.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");y=y.concat(n),g=g.concat(r)}const w=await Promise.all(g.map((r=>async function(r,o){const n=f(r)?function(r){a("geometry.coordinates",r.type).matches("Point"),a("geometry.coordinates",r.coordinates).satisfies((e=>"number"==typeof e||Array.isArray(e)));const[o,n,i]=r.coordinates,s=new e({x:o,y:n,spatialReference:t.WGS84});if(Array.isArray(i)){const[e,t]=i;!e&&!t||e?s.z=e:s.m=t}return s}(r):await T(r);if(o){let e;try{const r=await S(o);e=new t({wkid:D(r)})}catch{}e||(e=new t({wkt:o})),n.spatialReference=e}return n}(r,d)))),h=geometryTypeHeaders[GeometryFormat.ARCGIS_JSON][0][0];y.forEach(((e,t)=>e[h]=JSON.stringify(w[t].toJSON())));return{data:function(e){const t=e.map((e=>Object.keys(e))).reduce(((e,t)=>e.concat(t.filter((t=>!e.includes(t))))),[]);return[t.map((e=>({raw:e}))),...e.map((e=>t.map((t=>({raw:e[t]})))))]}(y),...n,includeHeaderRow:!0,geometryFormat:GeometryFormat.ARCGIS_JSON,geometryFields:[h],inSpatialReference:w[0]?.spatialReference??t.fromJSON({wkid:4326})}}export async function shapefileToFeatureSet(e,t){a("shapefileData",e).isNotMissing();const r=z(t);return uploadDataToFeatureSet(await shapefileToUploadData(e,r))}function W(e){return{escapeFormulaChars:!0,outFields:["*"],generatePrimaryKey:!1,locale:n,detectOid:!e?.primaryKeyField}}function H(e){return{...{includeHeaderRow:!0,inSpatialReference:t.WGS84,...W(e)},...e}}function X(e){return{...{includeHeaderRow:!0,inSpatialReference:t.WGS84,...W(e)},...e}}function z(e){return{...{...W(e)},...e}}function Y(e,t){return t.geometryFormat===GeometryFormat.XYZ?["x","y","z"]:t.geometryFormat===GeometryFormat.XY?["x","y"]:t.geometryFormat===GeometryFormat.LAT_LON?["latitude","longitude"]:t.geometryFormat===GeometryFormat.NONE?[]:["geometry"]}function k(e,t,r,o){const n=r.fields.filter((e=>"oid"===e.type)).map((e=>e.name)).toArray();if(o)return n;if(t&&!t.includes("*"))return t.filter((e=>!n.includes(e)));{const t=r.fields.filter((e=>"oid"!==e.type)).map((e=>e.name)).toArray();let o=[];for(const r of e)for(const e of r.attributes.keys())t.includes(e)||n.includes(e)||o.includes(e)||o.push(e);return o=o.sort(),t.concat(o)}}function B(e){if(!e)return["*"];const t=e.featureSettings.popupTemplate?.content;return(Array.isArray(t)?t.find((e=>"fields"===e.type))?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName)):void 0)??e.featureSettings.popupTemplate?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName))??["*"]}async function Z(e,t){const r=await K(e,t.outSpatialReference);if(t.geometryFormat===GeometryFormat.XYZ){if(!r)return["","",""];if(!f(r))throw new Error("Cannot use geometry format XYZ with non-point geometry");return[r.x,r.y,r.z]}if(t.geometryFormat===GeometryFormat.XY){if(!r)return["",""];if(!f(r))throw new Error("Cannot use geometry format XY with non-point geometry");return[r.x,r.y]}if(t.geometryFormat===GeometryFormat.LAT_LON){if(!r)return["",""];if(!f(r))throw new Error("Cannot use geometry format LAT_LONG with non-point geometry");return[r.y,r.x]}return t.geometryFormat===GeometryFormat.ARCGIS_JSON?r?[JSON.stringify(r.toJSON())]:[""]:t.geometryFormat===GeometryFormat.WKT?r?[await h(r)]:[""]:t.geometryFormat===GeometryFormat.GEO_JSON?r?[JSON.stringify(await O(r))]:[""]:[]}async function K(e,t){return e?.spatialReference&&!e.spatialReference.equals(t)&&t?(await w([e],t))[0]:e}function V(e,t){const r=[t.delimiter,_,"\r","\n",t.rowDelimiter];if(t.alwaysQuote||r.some((t=>e.includes(t)))){const t=e.replace(new RegExp(_,"g"),`${_}${_}`);return`${_}${t}${_}`}return e}function q(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e){const r=t.numberFormat||A.ROUND_TRIP;return b(r,e)}if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime().toString():c({format:t.dateFormat,timeZone:"UTC"},e)}let r=e.toString();return t.escapeFormulaChars&&(r=te(r)),r}function Q(e,t,r){if(r.useFormattedValues||ee(e,t))return e.presentableAttributes.get(t)??e.attributes.get(t);if("date"===e.schema.findFieldByName(t)?.type){const r=s(e.attributes.get(t));if(!isNaN(r.getTime()))return r}return e.attributes.get(t)??e.presentableAttributes.get(t)}function ee(e,t){return!!E(t,e.schema.typeIdField)||("coded-value"===e.type?.domains?.[t]?.type||"coded-value"===e.schema.findFieldByName(t)?.domain?.type)}function te(e){for(const t of I)if(e.startsWith(t))return`\t${e}`;return e}function re(e,t,r){const o=e.startsWith(_),n=e.endsWith(_);if(o&&!n||!o&&n)throw new Error(`Detected invalid CSV: Missing opening or closing quote for value at row:${t} column:${r}`);const a=o?e.substring(_.length,e.length-_.length):e;let i=-1;return oe(a,_,((e,o)=>{if(o===a.length)return!0;if(i<0){if(o!==a.length)return i=o,!0}else if(o===i+_.length)return i=-1,!0;throw new Error(`Detected invalid CSV: Non-escaped quote for value at row:${t} column:${r}`)})),a.replace(new RegExp(`${_}${_}`,"g"),_)}function oe(e,t,r){let o,n=!1,a=0,i=0;for(;o=e.indexOf(t,a),!(o<0);){for(let t=a;t<o;)e.substring(t).startsWith(_)?(n=!n,t+=_.length):t++;const s=o+t.length;if(!n){const e=r(i,o);if(i=s,!e)return}a=s}r(i,e.length)}async function ne(e,t){const r=JSON.parse(e),o=(await import("@arcgis/core/geometry/support/jsonUtils")).fromJSON(r);return r.spatialReference||(o.spatialReference=t),o}async function ae(e,t){const r=await T(JSON.parse(e));return r.spatialReference=t,r}async function ie(e,t){const r=await F(e);return r.spatialReference=t,r}function se(e,t,r){const o=r?[r]:geometryTypeHeaders[t];for(const t of o){const r=t.map((t=>e.map((e=>e?.raw?.toString().trim().toLowerCase())).indexOf(t.trim().toLowerCase())));if(r.every((e=>e>=0)))return r}}async function ce(e,t){return(await Promise.all(e.map((async(e,r)=>{const o=e?.raw;if("string"==typeof o&&""!==o)try{return await t(o,void 0),r}catch{return}})))).find((e=>void 0!==e))}function me(e,t,r){return"inv"===t?"string"==typeof e?parseFloat(e.replaceAll(",","")):e:D({locale:t,format:r},e)}async function le(e,t,r){const o=r?e.slice(1):e;if(r){const r=se(e[0],GeometryFormat.ARCGIS_JSON);if(void 0!==r)for(const[e,n]of j){try{await ue(r[0],n,t,o)}catch(e){continue}return[e,[r[0]]]}const n=[GeometryFormat.XYZ,GeometryFormat.XY,GeometryFormat.LAT_LON];for(const t of n){const r=se(e[0],t);if(void 0!==r)return[t,r]}}for(const[e,r]of j){const n=await ce(o[0],r);if(void 0!==n){try{await ue(n,r,t,o)}catch(e){continue}return[e,[n]]}}return[GeometryFormat.NONE,[]]}async function ue(e,t,r,o){return{columnIndices:[e],geometries:await Promise.all(o.map((t=>t[e])).map((e=>{if(e?.raw)return t(e.raw.toString(),r)})))}}function fe(e,t,r){let o=!1,n=!0,a=!0,i=!0;const c=new Set,{data:l,includeHeaderRow:f,dateFormat:d,primaryKeyField:p,locale:y}=e,g=f?l[0]:[],w=f?l.slice(1):l;for(const e of w){const r=e[t];r?.raw&&(c.add(r.raw),o=!0,n&&(n=G(r.raw,y)||Number.isNaN(r.raw)),a&&(a=r.raw instanceof Date||s(d||m,r.raw)!==u),i&&(i=s(d||P,r.formatted)!==u))}const h=c.size===w.length;return p&&g[t]?.raw===p||r&&o&&h&&n?"esriFieldTypeOID":o&&i?"esriFieldTypeDate":o&&n?"esriFieldTypeDouble":o&&a?"esriFieldTypeDate":"esriFieldTypeString"}async function de(e,t,r){const{escapeFormulaChars:o,locale:n,numberFormat:a,dateFormat:i}=r;if("esriFieldTypeDouble"===t.type||"esriFieldTypeOID"===t.type)return"number"==typeof e?e:e?me(e,n,a):null;if("esriFieldTypeDate"===t.type){if(e instanceof Date)return e.getTime();if("number"==typeof e){const t=(await import("xlsx")).SSF.parse_date_code(e);return t?new Date(t.y,t.m-1,t.d,t.H,t.M,t.S).getTime():void 0}return""===e?null:s({locale:n,format:i},e).getTime()}const c=e?.toString()??"";if(o&&c.startsWith("\t"))for(const e of I)if(c.length>1&&c.charAt(1)===e)return c.substring(1);return c}function pe(e){switch(e){case l.DATE_SHORT:return"dd/MM/yyyy";case l.DATE_LONG:return"MMMM d, yyyy";case l.TIME_SHORT:return"h:mm AM/PM";case l.TIME_LONG:return"h:mm:ss AM/PM";case l.DATE_TIME_SHORT:case l.DEFAULT:return"MMM d yyyy h:mm AM/PM";case l.DATE_TIME_LONG:return"MMMM d yyyy h:mm AM/PM";case l.FULL:return"dddd, MMMM d yyyy h:mm AM/PM";case l.ISO_8601:case l.ROUND_TRIP:return'yyyy-MM-dd"T"HH:mm:ss';default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("z")&&$().warn("Warning: Excel will not recognize timezone format 'z', 'zz', or 'zzz'"),t.includes("h")&&!t.includes("AM/PM")&&$().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function ye(e){switch(e){case A.ACCOUNTING:return'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';case A.CURRENCY:return'"$"#,##0.00';case A.FIXED_POINT:case A.DEFAULT:return"0.0000";case A.NUMBER:return"#,##0.0000";case A.PERCENT:return"0%";case A.ROUND_TRIP:return"0.00000";default:return e}}function ge(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e)return e;if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime():e}let r=e.toString();return t.escapeFormulaChars&&(r=te(r)),r}function we(e,t){return 3===e.length&&!t.hasZ&&t.hasM?[e[0],e[1],void 0,e[2]]:e}function he(e,t){return e.map((e=>we(e,t)))}function Fe(e,t){return e.map((e=>he(e,t)))}function Ne(e,t,r){switch(t){case U.NUMBER:return e instanceof Date?e.getTime():D(e);case U.STRING:return e instanceof Date?c({format:r.dateFormat??l.ROUND_TRIP,timeZone:"UTC"},e):"number"==typeof e?b(r.numberFormat??A.DEFAULT,e):e.toString();case U.BOOLEAN:return!!e;case U.DATE:return s(e);default:return e.toString()}}
1
+ import e from"@arcgis/core/geometry/Point";import t from"@arcgis/core/geometry/SpatialReference";import{geometryTypeToJson as r}from"../json/GeometryJson.js";import{translate as o}from"../locale/language.js";import{INVARIANT as n}from"../locale.js";import{checkArg as a,assertNever as i}from"../utilities/checkArg.js";import{parse as s,format as c,DEFAULT_PARSING_FORMATS as m,DateFormat as l,INVALID_DATE as u}from"../utilities/date.js";import{isPoint as f,isMultipoint as d,isPolyline as p,isPolygon as y,isExtent as g}from"../utilities/esri.js";import{project as w,esriToWKT as h,wktToEsri as F,esriWkidToWkt as N,esriWktToWkid as S,esriToGeoJSON as O,geoJSONToEsri as T}from"../utilities/geometry.js";import{getLogger as R}from"../utilities/log.js";import{isNumeric as G,parse as D,format as b,NumberFormat as A}from"../utilities/number.js";import{caseInsensitiveEquals as E}from"../utilities/string.js";import{Feature as x}from"./Feature.js";import{FeatureSet as M}from"./FeatureSet.js";const I=["=","-","+","@"],_='"',v="\r\n",L="\n",P=[...m.map(pe),"M/d/yy"],C=/(\w+)_(point|multipoint|polyline|polygon)z?/;var U;function $(){return R("geocortex.api.data.convert")}!function(e){e.DATE="D",e.NUMBER="N",e.STRING="C",e.BOOLEAN="L"}(U||(U={}));export const FIELD_NAME_REGEX=/[^a-zA-Z\d_]/g;export var GeometryFormat;!function(e){e.NONE="NONE",e.WKT="WKT",e.XY="XY",e.XYZ="XYZ",e.LAT_LON="LAT_LONG",e.GEO_JSON="GEO_JSON",e.ARCGIS_JSON="ARCGIS_JSON"}(GeometryFormat||(GeometryFormat={}));export const geometryTypeHeaders={[GeometryFormat.XYZ]:[["x","y","z"]],[GeometryFormat.XY]:[["x","y"]],[GeometryFormat.LAT_LON]:[["latitude","longitude"],["lat","lon"],["lat","long"]],[GeometryFormat.ARCGIS_JSON]:[["geometry"]],[GeometryFormat.GEO_JSON]:[["geometry"]],[GeometryFormat.WKT]:[["geometry"]]};const j=[[GeometryFormat.ARCGIS_JSON,ne],[GeometryFormat.GEO_JSON,ae],[GeometryFormat.WKT,ie]],J=new Map(j);export async function uploadDataToFeatureSet(t){const n=await async function(t){const{data:r,includeHeaderRow:o,geometryFormat:n,geometryFields:a,locale:s,numberFormat:c,inSpatialReference:m}=t,l=o?r.slice(1):r;if(n===GeometryFormat.NONE)return{columnIndices:[]};const u=e=>me(e,s,c),f=(t,r)=>{const o=r===GeometryFormat.XYZ,n=r===GeometryFormat.LAT_LON;return{columnIndices:t,geometries:l.map((r=>{if(r.length>=Math.max(...t)&&G(r[t[0]]?.raw,s)&&G(r[t[1]]?.raw,s)&&(!o||G(r[t[2]]?.raw,s)))return new e({x:u(n?r[t[1]].raw:r[t[0]].raw),y:u(n?r[t[0]].raw:r[t[1]].raw),z:o?u(r[t[2]].raw):0,spatialReference:m})}))}},d=async(e,t)=>({columnIndices:[e],geometries:await Promise.all(l.map((t=>t[e])).map((e=>{if(e?.raw)return t(e.raw.toString(),m)})))}),p=async(e,t)=>{switch(t){case GeometryFormat.NONE:return{columnIndices:[0]};case GeometryFormat.LAT_LON:case GeometryFormat.XYZ:case GeometryFormat.XY:return f(e,t);case GeometryFormat.ARCGIS_JSON:return d(e[0],ne);case GeometryFormat.GEO_JSON:return d(e[0],ae);case GeometryFormat.WKT:return d(e[0],ie);default:return i(t,new Error(`Unknown geometry format "${t}".`))}};if(n){const e=se(o?r[0]:r[0].map(((e,t)=>({raw:t.toString()}))),n,o?a:a.map((e=>""+(parseInt(e.match(/\d+/g)[0])-1))));if(o&&void 0===e)throw new Error(`Error parsing file data: Expected geometry columns ${geometryTypeHeaders[n][0].join(",")} are missing for GeometryType.${n}`);return p(e??[0],n)}const[y,g]=await le(r,m,o);if(y===GeometryFormat.NONE)return{columnIndices:[]};return g.length>1?f(g,y):d(g[0],J.get(y))}(t),a=function(e,t){const{data:n,displayField:a,includeHeaderRow:i,inSpatialReference:s,outSpatialReference:c,generatePrimaryKey:m}=e,l={fields:[]},u=e=>!(!t.columnIndices||0===t.columnIndices.length)&&t.columnIndices.includes(e);let{primaryKeyField:f}=e,d=0;for(let t=0;t<n[0].length;t++){if(u(t))continue;const r=fe(e,t,!m&&!f&&!l.fields.find((e=>"esriFieldTypeOID"===e.type)));let a=n[0][t]?.raw?.toString(),s=a?.replace(FIELD_NAME_REGEX,"_");i&&s||(s="field"+ ++d,a=o("gcx.api.data.convert.import-field-alias",d)),l.fields.push({alias:a,name:s,type:r}),"esriFieldTypeOID"===r&&(f=s)}if(l.spatialReference=c??t.geometries?.[0]?.spatialReference??s,t.geometries?.length){const e=t.geometries.filter((e=>void 0!==e)).map((e=>e.type)),o=e[0];l.geometryType=e.every((e=>e===o))?r(o):void 0}if(!l.fields.find((e=>"esriFieldTypeOID"===e.type))){const e=l.fields.length+1,t=!!l.fields.find((e=>"objectid"===e.name.toLowerCase()));f=t?`OBJECTID_${e}`:"OBJECTID",l.fields.push({name:f,alias:f,type:"esriFieldTypeOID"})}return l.displayField=a??l.fields.find((e=>!E(e.name,f)&&"esriFieldTypeString"===e.type))?.name??l.fields.find((e=>!E(e.name,f)))?.name??f,l.primaryKeyField=f,l}(t,n),s=await async function(e,t,r){const{data:o,includeHeaderRow:n,outFields:a,escapeFormulaChars:i,locale:s,numberFormat:c,dateFormat:m}=e,{spatialReference:l}=r,u=[],f=n?o.slice(1):o,d=(e,r)=>!t.columnIndices||0===t.columnIndices.length||!t.columnIndices.includes(r);return await Promise.all(f.map((async(e,o)=>{const n=new x;for(let t=0;t<r.fields.length;t++){const l=r.fields[t],u=e.filter(d);if(a.includes("*")||a.filter((e=>E(e,l.name))).length>0){let e=await de(u[t]?.raw,l,{escapeFormulaChars:i,dateFormat:m,numberFormat:c,locale:s});"esriFieldTypeOID"===l.type&&null===e&&(e=o),n.attributes.set(l.name,e)}}t.geometries&&(n.geometry=await K(t.geometries[o],l)),u.push(n)}))),u}(t,n,a);return new M({features:s,schema:a})}export async function toCsv(e,r){a("featureSet",e).isNotMissing();const o=Array.from(e),n={...{useFormattedValues:!1,alwaysQuote:!1,escapeFormulaChars:!0,delimiter:",",dateFormat:l.ROUND_TRIP,geometryFormat:o.some((e=>void 0!==e.geometry&&null!==e.geometry))?GeometryFormat.WKT:GeometryFormat.NONE,includeByteOrderMark:!0,outSpatialReference:t.WGS84,includeHeaderRow:!0,outFields:B(e.source),rowDelimiter:navigator.platform.startsWith("Win")?v:L},...r},{includeByteOrderMark:i,includeHeaderRow:s,delimiter:c,outFields:m,rowDelimiter:u}=n,f=[];i&&f.push("\ufeff");const d=Y(o,n),p=k(o,m,e.schema,!0),y=k(o,m,e.schema,!1);if(s){const e=[];for(const t of d)e.push(V(t,n));for(const t of p)e.push(V(t,n));for(const t of y)e.push(V(t,n));const t=e.join(c)+u;f.push(t)}await Promise.all(o.map((async e=>{const t=[],r=(t,r)=>V(q(Q(e,t,r),r),r);t.push(...await async function(e,t){let r=await Z(e,t);t.geometryFormat!==GeometryFormat.XYZ&&t.geometryFormat!==GeometryFormat.XY&&t.geometryFormat!==GeometryFormat.LAT_LON||(r=r.map((e=>void 0===e?"":q(e,t))));return r.map((e=>""===e?"":V(e,t)))}(e.geometry,n)),t.push(...p.map((e=>r(e,n)))),t.push(...y.map((e=>r(e,n))));const o=`${t.join(c)}${u}`;f.push(o)})));return new Blob(f,{type:"text/plain",endings:u===L||u===v?"transparent":"native"})}export async function csvToUploadData(e,t){let r;if(a("csvData",e).isNotMissing(),e instanceof Blob){const t=new Promise(((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsText(e)}));r=await t}else r=e;const i=H(t),s=i.rowDelimiter||function(e){let t=L;return oe(e,v,((r,o)=>(0===r&&o===e.length||(t=v),!1))),t}(r),c=i.delimiter??function(e,t,r){const o=",";if(0===e.length)return o;const a=[];if(oe(e,t,((t,r)=>(r!==e.length||t!==r)&&(a.push(e.substring(t,r)),a.length<3))),0===a.length)return o;let i=[{delimiter:",",rowsDelimiterOccurrences:[],rowsNumberAdjacentOccurrences:[]},{delimiter:";",rowsDelimiterOccurrences:[]},{delimiter:"|",rowsDelimiterOccurrences:[]},{delimiter:"\t",rowsDelimiterOccurrences:[]},{delimiter:" ",rowsDelimiterOccurrences:[]}].filter((e=>a[0].includes(e.delimiter)));if(0===i.length)return o;for(const e of a)for(const t of i){let o=0,n=0;oe(e,t.delimiter,((a,i)=>{if(i!==e.length&&o++,","===t.delimiter){const t=e.charAt(i-1),o=e.charAt(i+1);G(t,r)&&G(o,r)&&n++}return!0})),t.rowsDelimiterOccurrences.push(o),","===t.delimiter&&t.rowsNumberAdjacentOccurrences.push(n)}if(i=i.filter((e=>e.rowsDelimiterOccurrences.every((t=>e.rowsDelimiterOccurrences[0]===t)))).sort(((e,t)=>t.rowsDelimiterOccurrences[0]-e.rowsDelimiterOccurrences[0])),i.length>1&&","===i[0].delimiter&&null!=r&&r!==n){const e=i[0];if(null!=e&&","===e.delimiter&&","===Intl.NumberFormat(r).formatToParts(1.1).find((e=>"decimal"===e.type))?.value)for(let t=0;t<e.rowsDelimiterOccurrences.length;t++)if(e.rowsDelimiterOccurrences[t]<=e.rowsNumberAdjacentOccurrences[t]){i=i.filter((e=>","!==e.delimiter));break}}if(0===i.length)return o;return i[0].delimiter}(r,s,t.locale),m=function(e,t,r){const o=[],n=(e,t)=>{const o=[];return oe(e,r,((r,n)=>{const a=e.substring(r,n);return o.push({raw:re(a,t,o.length)}),!0})),o};if(oe(e,t,((t,r)=>{const a=e.substring(t,r);return a.length>0&&o.push(n(a,o.length)),!0})),o.length){const e=o[0].length;o.forEach(((t,r)=>{if(t.length!==e)throw new Error(`Detected invalid CSV: Row ${r} does not have expected number of columns: ${e}`)}))}return o}(r,s,c);let{geometryFormat:l,geometryFields:u}=t;if(!l){const[e,t]=await le(m,i.inSpatialReference,i.includeHeaderRow);l=e,u=t.map((e=>i.includeHeaderRow?m[0][e]?.raw??o("gcx.api.data.convert.import-field-alias",(e+1).toString()):o("gcx.api.data.convert.import-field-alias",(e+1).toString())))}return{data:m,...i,geometryFormat:l,geometryFields:u}}export async function csvToFeatureSet(e,t){const r=H(t);return uploadDataToFeatureSet(await csvToUploadData(e,r))}export async function toXLSX(e,r){a("featureSet",e).isNotMissing();const o=Array.from(e),n={...{useFormattedValues:!1,includeHeaderRow:!0,escapeFormulaChars:!0,geometryFormat:o.some((e=>void 0!==e.geometry&&null!==e.geometry))?GeometryFormat.WKT:GeometryFormat.NONE,outFields:B(e.source),outSpatialReference:t.WGS84,dateFormat:l.DEFAULT,numberFormat:A.DEFAULT,sheetName:"sheet1"},...r},{outFields:i,includeHeaderRow:s,dateFormat:c,numberFormat:m}=n,u=[],f=Y(o,n),d=k(o,i,e.schema,!0),p=k(o,i,e.schema,!1);if(s){const t=f.concat(d).concat(function(e,t){const r=t?.schema?.fieldExtensions.initializedItems.map((e=>e.field));return e.map((e=>r?.find((t=>E(t.name,e)))?.alias??e))}(p,e.source));u.push(t)}await Promise.all(o.map((async e=>{const t=[];t.push(...await Z(e.geometry,n));for(const r of d){const o=ge(e.attributes.get(r),n);t.push(o)}for(const r of p){const o=ge(Q(e,r,n),n);t.push(o)}t.every((e=>"string"!=typeof e||e.length<=32767))?u.push(t):$().warn(`toXLSX cell limit exceeded, feature (${e.primaryKey??e.id}) omitted.`)})));const y=await import("xlsx"),g={SheetNames:[],Sheets:{}},w=y.utils.aoa_to_sheet(u,{cellDates:!0});for(const e of Object.keys(w).filter((e=>!e.startsWith("!")))){const t=w[e];"d"===t.t?t.z=pe(c??l.ROUND_TRIP):"n"===t.t&&(t.z=ye(m))}g.SheetNames.push(n.sheetName),g.Sheets[n.sheetName]=w;const h=y.write(g,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),F=new Uint8Array(h.length);for(let e=0;e<h.length;e++)F[e]=h.charCodeAt(e);return new Blob([F.buffer],{type:"text/plain"})}export async function xlsxToUploadData(e,t){a("xlsxData",e).isNotMissing();const r=X(t),n=await async function(e,t){const r=await import("xlsx"),o=new Promise(((o,n)=>{const a=new FileReader;a.onload=()=>{const e=new Uint8Array(a.result);let n="";for(const t of e)n+=String.fromCharCode(t);const i=r.read(n,{type:"binary",cellDates:!0}),s=t.sheetName||i.SheetNames[0],c=i.Sheets[s];o(c)},a.onerror=()=>{n(a.error)},a.readAsArrayBuffer(e)})),n=await o,a=r.utils.decode_range(n["!ref"]),i=[];for(let e=a.s.r;e<=a.e.r;e++){const t=[];for(let o=a.s.c;o<=a.e.c;o++){const a=n[`${r.utils.encode_cell({r:e,c:o})}`];t.push(a?{raw:a.v,formatted:"s"===a.t?void 0:a.w}:{raw:""})}i.push(t)}return i}(e,r);let{geometryFormat:i,geometryFields:s}=t;if(!i){const[e,t]=await le(n,r.inSpatialReference,r.includeHeaderRow);i=e,s=t.map((e=>r.includeHeaderRow?n[0][e]?.raw.toString()??o("gcx.api.data.convert.import-field-alias",(e+1).toString()):o("gcx.api.data.convert.import-field-alias",(e+1).toString())))}return{data:n,...r,geometryFormat:i,geometryFields:s}}export async function xlsxToFeatureSet(e,t){a("xlsxData",e).isNotMissing();const r=X(t);return uploadDataToFeatureSet(await xlsxToUploadData(e,r))}export async function toShapefile(e,r){a("featureSet",e).isNotMissing();const[{default:o},n]=await Promise.all([import("jszip"),import("../forked-libs/shp-write/index.js")]),i=Array.from(e),s={...{useFormattedValues:!1,outFields:B(e.source),fileName:e.title||"export"},...r},{outFields:c,outSpatialReference:m,fileName:l}=s,u=e=>e.geometry.hasZ||e.geometry.hasM,w=new Map,h=i.filter((e=>f(e.geometry)));w.set("POINTZ",h.filter(u)),w.set("POINT",h.filter((e=>!u(e))));const F=i.filter((e=>d(e.geometry)));w.set("MULTIPOINTZ",F.filter(u)),w.set("MULTIPOINT",F.filter((e=>!u(e))));const S=i.filter((e=>p(e.geometry)));w.set("POLYLINEZ",S.filter(u)),w.set("POLYLINE",S.filter((e=>!u(e))));const O=i.filter((e=>y(e.geometry)||g(e.geometry)));w.set("POLYGONZ",O.filter(u)),w.set("POLYGON",O.filter((e=>!u(e))));const T=k(i,c,e.schema,!0);let R=k(i,c,e.schema,!1);R=T.concat(R);const G=new o,D=Array.from(w.keys()).filter((e=>w.get(e).length>0));await Promise.all(D.map((async r=>{const o=w.get(r),a=await Promise.all(o.map((e=>K(e.geometry,m)))),i=await async function(e){const{wkid:r,wkt:o}=e[0].spatialReference;if(!e.every((e=>e.spatialReference.wkid===r&&e.spatialReference.wkt===o)))throw new Error("Cannot create shapefile that contains geometries with different spatial references.");return o??await N(r??t.WGS84.wkid)}(a),c=s.useFormattedValues?Object.assign({},...R.map((e=>({[e]:U.STRING})))):function(e,t,r,o){const n={};for(const a of t){if(e.some((e=>ee(e,a)))){n[a]=U.STRING;continue}const t=r?r.fields.find((e=>E(e.name,a))):void 0;if(t){switch(t.type){case"oid":case"double":case"integer":case"single":case"small-integer":n[a]=U.NUMBER;break;case"date":n[a]=o?U.NUMBER:U.DATE;break;default:n[a]=U.STRING}continue}const i=(e,t)=>e.attributes.get(t)??e.presentableAttributes.get(t);e.every((e=>i(e,a)instanceof Date||void 0===i(e,a)))&&e.some((e=>i(e,a)instanceof Date))?n[a]=o?U.NUMBER:U.DATE:e.every((e=>"number"==typeof i(e,a)||void 0===i(e,a)))&&e.some((e=>"number"==typeof i(e,a)))?n[a]=U.NUMBER:e.every((e=>"boolean"==typeof i(e,a)||void 0===i(e,a)))&&e.some((e=>"boolean"==typeof i(e,a)))?n[a]=U.BOOLEAN:n[a]=U.STRING}return n}(o,R,e.schema,"timestamp"===s.dateFormat),u=function(e){return e.map((e=>{if(f(e)){const{x:t,y:r,z:o,m:n}=e,a=[t,r];return e.hasZ&&a.push(o),e.hasM&&a.push(n),we(a,e)}if(d(e))return he(e.points,e);if(p(e))return Fe(e.paths,e);if(y(e))return Fe(e.rings,e);if(g(e)){const t=[e.xmin,e.ymax];return[[t,[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],t]]}throw new Error("Unsupported geometry type.")}))}(a),h=function(e,t,r,o){const n=[];for(const a of e){const e={};for(const n of t){let t=Q(a,n,o);if(null==t&&(t=""),o.useFormattedValues)t=t.toString();else{t=Ne(t,r[n],o)}e[n]=t}n.push(e)}return n}(o,R,c,s);n.write(h,r,u,((e,t)=>{const o=D.length>1?`${l}_${r.toLowerCase()}`:l;G.file(`${o}.shp`,t.shp.buffer,{binary:!0}),G.file(`${o}.shx`,t.shx.buffer,{binary:!0}),G.file(`${o}.dbf`,t.dbf.buffer,{binary:!0}),G.file(`${o}.prj`,i)}))})));const b=await G.generateAsync({type:"uint8array"});return new Blob([b.buffer],{type:"text/plain"})}export async function shapefileToUploadData(r,o){a("shapefileData",r).isNotMissing();const n=z(o),i=new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{e(o.result)},o.onerror=()=>{t(o.error)},o.readAsArrayBuffer(r)})),[{default:s},{default:c}]=await Promise.all([import("jszip"),import("shpjs")]),m=await i,l=await s.loadAsync(new Uint8Array(m)),u=l.filter((()=>!0)).map((e=>e.name));let d,p=u.filter((e=>e.endsWith(".shp"))).map((e=>e.substring(0,e.length-4)));if(p=function(e){if(!e.length)return[];let t=e[0];const r=t.match(C);return r?(t=r[1],e.filter((e=>{const r=e.match(C);return r&&r[1]===t}))):[t]}(p),u.some((e=>e.endsWith(".prj")))&&!p.every((e=>u.includes(`${e}.prj`))))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");await Promise.all(u.filter((e=>e.endsWith(".prj"))).map((async e=>{const t=await l.file(e).async("string");if(d){if(t!==d)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else d=t})));let y=[],g=[];for(const e of p){if(!u.includes(`${e}.shx`)||!u.includes(`${e}.dbf`))throw new Error("Shapefile must contain shp, shx, and dbf files.");const t=await l.file(`${e}.shp`).async("uint8array"),r=c.parseShp(t),o=await l.file(`${e}.dbf`).async("uint8array"),n=c.parseDbf(o);if(n.length!==r.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");y=y.concat(n),g=g.concat(r)}const w=await Promise.all(g.map((r=>async function(r,o){const n=f(r)?function(r){a("geometry.coordinates",r.type).matches("Point"),a("geometry.coordinates",r.coordinates).satisfies((e=>"number"==typeof e||Array.isArray(e)));const[o,n,i]=r.coordinates,s=new e({x:o,y:n,spatialReference:t.WGS84});if(Array.isArray(i)){const[e,t]=i;!e&&!t||e?s.z=e:s.m=t}return s}(r):await T(r);if(o){let e;try{const r=await S(o);e=new t({wkid:D(r)})}catch{}e||(e=new t({wkt:o})),n.spatialReference=e}return n}(r,d)))),h=geometryTypeHeaders[GeometryFormat.ARCGIS_JSON][0][0];y.forEach(((e,t)=>e[h]=JSON.stringify(w[t].toJSON())));return{data:function(e){const t=e.map((e=>Object.keys(e))).reduce(((e,t)=>e.concat(t.filter((t=>!e.includes(t))))),[]);return[t.map((e=>({raw:e}))),...e.map((e=>t.map((t=>({raw:e[t]})))))]}(y),...n,includeHeaderRow:!0,geometryFormat:GeometryFormat.ARCGIS_JSON,geometryFields:[h],inSpatialReference:w[0]?.spatialReference??t.fromJSON({wkid:4326})}}export async function shapefileToFeatureSet(e,t){a("shapefileData",e).isNotMissing();const r=z(t);return uploadDataToFeatureSet(await shapefileToUploadData(e,r))}function W(e){return{escapeFormulaChars:!0,outFields:["*"],generatePrimaryKey:!1,locale:n,detectOid:!e?.primaryKeyField}}function H(e){return{...{includeHeaderRow:!0,inSpatialReference:t.WGS84,...W(e)},...e}}function X(e){return{...{includeHeaderRow:!0,inSpatialReference:t.WGS84,...W(e)},...e}}function z(e){return{...{...W(e)},...e}}function Y(e,t){return t.geometryFormat===GeometryFormat.XYZ?["x","y","z"]:t.geometryFormat===GeometryFormat.XY?["x","y"]:t.geometryFormat===GeometryFormat.LAT_LON?["latitude","longitude"]:t.geometryFormat===GeometryFormat.NONE?[]:["geometry"]}function k(e,t,r,o){const n=r.fields.filter((e=>"oid"===e.type)).map((e=>e.name)).toArray();if(o)return n;if(t&&!t.includes("*"))return t.filter((e=>!n.includes(e)));{const t=r.fields.filter((e=>"oid"!==e.type)).map((e=>e.name)).toArray();let o=[];for(const r of e)for(const e of r.attributes.keys())t.includes(e)||n.includes(e)||o.includes(e)||o.push(e);return o=o.sort(),t.concat(o)}}function B(e){if(!e)return["*"];const t=e.featureSettings.popupTemplate?.content;return(Array.isArray(t)?t.find((e=>"fields"===e.type))?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName)):void 0)??e.featureSettings.popupTemplate?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName))??["*"]}async function Z(e,t){const r=await K(e,t.outSpatialReference);if(t.geometryFormat===GeometryFormat.XYZ){if(!r)return["","",""];if(!f(r))throw new Error("Cannot use geometry format XYZ with non-point geometry");return[r.x,r.y,r.z]}if(t.geometryFormat===GeometryFormat.XY){if(!r)return["",""];if(!f(r))throw new Error("Cannot use geometry format XY with non-point geometry");return[r.x,r.y]}if(t.geometryFormat===GeometryFormat.LAT_LON){if(!r)return["",""];if(!f(r))throw new Error("Cannot use geometry format LAT_LONG with non-point geometry");return[r.y,r.x]}return t.geometryFormat===GeometryFormat.ARCGIS_JSON?r?[JSON.stringify(r.toJSON())]:[""]:t.geometryFormat===GeometryFormat.WKT?r?[await h(r)]:[""]:t.geometryFormat===GeometryFormat.GEO_JSON?r?[JSON.stringify(await O(r))]:[""]:[]}async function K(e,t){return e?.spatialReference&&!e.spatialReference.equals(t)&&t?(await w([e],t))[0]:e}function V(e,t){const r=[t.delimiter,_,"\r","\n",t.rowDelimiter];if(t.alwaysQuote||r.some((t=>e.includes(t)))){const t=e.replace(new RegExp(_,"g"),`${_}${_}`);return`${_}${t}${_}`}return e}function q(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e){const r=t.numberFormat||A.ROUND_TRIP;return b(r,e)}if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime().toString():c({format:t.dateFormat,timeZone:"UTC"},e)}let r=e.toString();return t.escapeFormulaChars&&(r=te(r)),r}function Q(e,t,r){if(r.useFormattedValues||ee(e,t))return e.presentableAttributes.get(t)??e.attributes.get(t);if("date"===e.schema.findFieldByName(t)?.type){const r=s(e.attributes.get(t));if(!isNaN(r.getTime()))return r}return e.attributes.get(t)??e.presentableAttributes.get(t)}function ee(e,t){return!!E(t,e.schema.typeIdField)||("coded-value"===e.type?.domains?.[t]?.type||"coded-value"===e.schema.findFieldByName(t)?.domain?.type)}function te(e){for(const t of I)if(e.startsWith(t))return`\t${e}`;return e}function re(e,t,r){const o=e.startsWith(_),n=e.endsWith(_);if(o&&!n||!o&&n)throw new Error(`Detected invalid CSV: Missing opening or closing quote for value at row:${t} column:${r}`);const a=o?e.substring(_.length,e.length-_.length):e;let i=-1;return oe(a,_,((e,o)=>{if(o===a.length)return!0;if(i<0){if(o!==a.length)return i=o,!0}else if(o===i+_.length)return i=-1,!0;throw new Error(`Detected invalid CSV: Non-escaped quote for value at row:${t} column:${r}`)})),a.replace(new RegExp(`${_}${_}`,"g"),_)}function oe(e,t,r){let o,n=!1,a=0,i=0;for(;o=e.indexOf(t,a),!(o<0);){for(let t=a;t<o;)e.substring(t).startsWith(_)?(n=!n,t+=_.length):t++;const s=o+t.length;if(!n){const e=r(i,o);if(i=s,!e)return}a=s}r(i,e.length)}async function ne(e,t){const r=JSON.parse(e),o=(await import("@arcgis/core/geometry/support/jsonUtils")).fromJSON(r);return r.spatialReference||(o.spatialReference=t),o}async function ae(e,t){const r=await T(JSON.parse(e));return r.spatialReference=t,r}async function ie(e,t){const r=await F(e);return r.spatialReference=t,r}function se(e,t,r){const o=r?[r]:geometryTypeHeaders[t];for(const t of o){const r=t.map((t=>e.map((e=>e?.raw?.toString().trim().toLowerCase())).indexOf(t.trim().toLowerCase())));if(r.every((e=>e>=0)))return r}}async function ce(e,t){return(await Promise.all(e.map((async(e,r)=>{const o=e?.raw;if("string"==typeof o&&""!==o)try{return await t(o,void 0),r}catch{return}})))).find((e=>void 0!==e))}function me(e,t,r){return"inv"===t?"string"==typeof e?parseFloat(e.replaceAll(",","")):e:D({locale:t,format:r},e)}async function le(e,t,r){const o=r?e.slice(1):e;if(r){const r=se(e[0],GeometryFormat.ARCGIS_JSON);if(void 0!==r)for(const[e,n]of j){try{await ue(r[0],n,t,o)}catch(e){continue}return[e,[r[0]]]}const n=[GeometryFormat.XYZ,GeometryFormat.XY,GeometryFormat.LAT_LON];for(const t of n){const r=se(e[0],t);if(void 0!==r)return[t,r]}}for(const[e,r]of j){const n=await ce(o[0],r);if(void 0!==n){try{await ue(n,r,t,o)}catch(e){continue}return[e,[n]]}}return[GeometryFormat.NONE,[]]}async function ue(e,t,r,o){return{columnIndices:[e],geometries:await Promise.all(o.map((t=>t[e])).map((e=>{if(e?.raw)return t(e.raw.toString(),r)})))}}function fe(e,t,r){let o=!1,n=!0,a=!0,i=!0;const c=new Set,{data:l,includeHeaderRow:f,dateFormat:d,primaryKeyField:p,locale:y}=e,g=f?l[0]:[],w=f?l.slice(1):l;for(const e of w){const r=e[t];r?.raw&&(c.add(r.raw),o=!0,n&&(n=G(r.raw,y)||Number.isNaN(r.raw)),a&&(a=r.raw instanceof Date||s(d||m,r.raw)!==u),i&&(i=s(d||P,r.formatted)!==u))}const h=c.size===w.length;return p&&g[t]?.raw===p||r&&o&&h&&n?"esriFieldTypeOID":o&&i?"esriFieldTypeDate":o&&n?"esriFieldTypeDouble":o&&a?"esriFieldTypeDate":"esriFieldTypeString"}async function de(e,t,r){const{escapeFormulaChars:o,locale:n,numberFormat:a,dateFormat:i}=r;if("esriFieldTypeDouble"===t.type||"esriFieldTypeOID"===t.type)return"number"==typeof e?e:e?me(e,n,a):null;if("esriFieldTypeDate"===t.type){if(e instanceof Date)return e.getTime();if("number"==typeof e){const t=(await import("xlsx")).SSF.parse_date_code(e);return t?new Date(t.y,t.m-1,t.d,t.H,t.M,t.S).getTime():void 0}return""===e?null:s({locale:n,format:i},e).getTime()}const c=e?.toString()??"";if(o&&c.startsWith("\t"))for(const e of I)if(c.length>1&&c.charAt(1)===e)return c.substring(1);return c}function pe(e){switch(e){case l.DATE_SHORT:return"dd/MM/yyyy";case l.DATE_LONG:return"MMMM d, yyyy";case l.TIME_SHORT:return"h:mm AM/PM";case l.TIME_LONG:return"h:mm:ss AM/PM";case l.DATE_TIME_SHORT:case l.DEFAULT:return"MMM d yyyy h:mm AM/PM";case l.DATE_TIME_LONG:return"MMMM d yyyy h:mm AM/PM";case l.FULL:return"dddd, MMMM d yyyy h:mm AM/PM";case l.ISO_8601:case l.ROUND_TRIP:return'yyyy-MM-dd"T"HH:mm:ss';default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("z")&&$().warn("Warning: Excel will not recognize timezone format 'z', 'zz', or 'zzz'"),t.includes("h")&&!t.includes("AM/PM")&&$().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function ye(e){switch(e){case A.ACCOUNTING:return'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';case A.CURRENCY:return'"$"#,##0.00';case A.FIXED_POINT:case A.DEFAULT:return"0.0000";case A.NUMBER:return"#,##0.0000";case A.PERCENT:return"0%";case A.ROUND_TRIP:return"0.00000";default:return e}}function ge(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e)return e;if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime():e}let r=e.toString();return t.escapeFormulaChars&&(r=te(r)),r}function we(e,t){return 3===e.length&&!t.hasZ&&t.hasM?[e[0],e[1],void 0,e[2]]:e}function he(e,t){return e.map((e=>we(e,t)))}function Fe(e,t){return e.map((e=>he(e,t)))}function Ne(e,t,r){switch(t){case U.NUMBER:return e instanceof Date?e.getTime():D(e);case U.STRING:return e instanceof Date?c({format:r.dateFormat??l.ROUND_TRIP,timeZone:"UTC"},e):"number"==typeof e?b(r.numberFormat??A.DEFAULT,e):e.toString();case U.BOOLEAN:return!!e;case U.DATE:return s(e);default:return e.toString()}}
@@ -140,7 +140,7 @@ have geometry.</p>
140
140
  </div></section>
141
141
  <section class="tsd-panel tsd-member"><a id="attributes" class="tsd-anchor"></a>
142
142
  <h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>attributes</span><a href="#attributes" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
143
- <div class="tsd-signature"><span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">:</span> <a href="utilities_ObservableMap.ObservableMap.html" class="tsd-signature-type tsd-kind-class">ObservableMap</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">&gt;</span></div>
143
+ <div class="tsd-signature"><span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">:</span> <a href="utilities_CaseInsensitiveObservableMap.CaseInsensitiveObservableMap.html" class="tsd-signature-type tsd-kind-class">CaseInsensitiveObservableMap</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">&gt;</span></div>
144
144
  <div class="tsd-comment tsd-typography"><p>The feature&#39;s attributes, keyed by field name.</p>
145
145
  </div></section>
146
146
  <section class="tsd-panel tsd-member"><a id="expressionFieldValues" class="tsd-anchor"></a>
@@ -550,13 +550,13 @@ multiple properties and nesting.</p>
550
550
  <h4 class="tsd-parameters-title">Parameters</h4>
551
551
  <ul class="tsd-parameter-list">
552
552
  <li>
553
- <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">failureMode</span><span class="tsd-signature-symbol">?: </span><a href="../types/FailureMode.FailureMode.html" class="tsd-signature-type tsd-kind-type-alias">FailureMode</a><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">geometry</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; clone?: () =&gt; Point; copy?: (other: Point) =&gt; void; ... 19 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ m?: number; x?: string | number; y?: string | number; z?: string | number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; points?: number[][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; paths?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; rings?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ xmin?: number; xmax?: number; ymin?: number; ymax?: number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
553
+ <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">failureMode</span><span class="tsd-signature-symbol">?: </span><a href="../types/FailureMode.FailureMode.html" class="tsd-signature-type tsd-kind-type-alias">FailureMode</a><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">geometry</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; clone?: () =&gt; Point; copy?: (other: Point) =&gt; void; ... 19 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ m?: number; x?: string | number; y?: string | number; z?: string | number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; points?: number[][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; paths?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; rings?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ xmin?: number; xmax?: number; ymin?: number; ymax?: number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
554
554
  <div class="tsd-comment tsd-typography"><p>A plain object containing property values to set, keyed
555
555
  by property name.</p>
556
556
  </div>
557
557
  <ul class="tsd-parameters">
558
558
  <li class="tsd-parameter">
559
- <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span></h5>
559
+ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span></h5>
560
560
  <div class="tsd-comment tsd-typography"><p>The feature&#39;s attributes, keyed by field name.</p>
561
561
  </div></li>
562
562
  <li class="tsd-parameter">
@@ -599,13 +599,13 @@ the properties.</p>
599
599
  <h4 class="tsd-parameters-title">Parameters</h4>
600
600
  <ul class="tsd-parameter-list">
601
601
  <li>
602
- <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">failureMode</span><span class="tsd-signature-symbol">?: </span><a href="../types/FailureMode.FailureMode.html" class="tsd-signature-type tsd-kind-type-alias">FailureMode</a><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">geometry</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; clone?: () =&gt; Point; copy?: (other: Point) =&gt; void; ... 19 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ m?: number; x?: string | number; y?: string | number; z?: string | number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; points?: number[][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; paths?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; rings?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ xmin?: number; xmax?: number; ymin?: number; ymax?: number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
602
+ <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">failureMode</span><span class="tsd-signature-symbol">?: </span><a href="../types/FailureMode.FailureMode.html" class="tsd-signature-type tsd-kind-type-alias">FailureMode</a><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">geometry</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; clone?: () =&gt; Point; copy?: (other: Point) =&gt; void; ... 19 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ m?: number; x?: string | number; y?: string | number; z?: string | number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; points?: number[][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; paths?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ hasM?: boolean; hasZ?: boolean; rings?: number[][][]; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ xmin?: number; xmax?: number; ymin?: number; ymax?: number; spatialReference?: { latestWkid?: number; wkid?: number; wkt?: string; vcsWkid?: number; latestVcsWkid?: number; }; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
603
603
  <div class="tsd-comment tsd-typography"><p>A plain object containing property values to set, keyed
604
604
  by property name.</p>
605
605
  </div>
606
606
  <ul class="tsd-parameters">
607
607
  <li class="tsd-parameter">
608
- <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span></h5>
608
+ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">attributes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type ">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">(</span>{}<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ [x: string]: {}; }<span class="tsd-signature-symbol">)</span></h5>
609
609
  <div class="tsd-comment tsd-typography"><p>The feature&#39;s attributes, keyed by field name.</p>
610
610
  </div></li>
611
611
  <li class="tsd-parameter">
@@ -441,12 +441,12 @@ criteria.</p>
441
441
  <h4 class="tsd-parameters-title">Parameters</h4>
442
442
  <ul class="tsd-parameter-list">
443
443
  <li>
444
- <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">featureSet</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
444
+ <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">featureSet</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 ...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
445
445
  <div class="tsd-comment tsd-typography"><p>An object containing property values to set.</p>
446
446
  </div>
447
447
  <ul class="tsd-parameters">
448
448
  <li class="tsd-parameter">
449
- <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">feature<wbr/>Set</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span></h5>
449
+ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">feature<wbr/>Set</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 ...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span></h5>
450
450
  <div class="tsd-comment tsd-typography"><p>The features contained in the list.</p>
451
451
  </div></li>
452
452
  <li class="tsd-parameter">
@@ -473,13 +473,13 @@ the properties.</p>
473
473
  <h4 class="tsd-parameters-title">Parameters</h4>
474
474
  <ul class="tsd-parameter-list">
475
475
  <li>
476
- <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">featureSet</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
476
+ <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">featureSet</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 ...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
477
477
  <div class="tsd-comment tsd-typography"><p>A plain object containing property values to set, keyed
478
478
  by property name.</p>
479
479
  </div>
480
480
  <ul class="tsd-parameters">
481
481
  <li class="tsd-parameter">
482
- <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">feature<wbr/>Set</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span></h5>
482
+ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">feature<wbr/>Set</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>{ features?: ({ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; ... 22 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 ...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type ">Set</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">&gt;</span></h5>
483
483
  <div class="tsd-comment tsd-typography"><p>The features contained in the list.</p>
484
484
  </div></li>
485
485
  <li class="tsd-parameter">
@@ -315,12 +315,12 @@ multiple properties and nesting.</p>
315
315
  <h4 class="tsd-parameters-title">Parameters</h4>
316
316
  <ul class="tsd-parameter-list">
317
317
  <li>
318
- <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
318
+ <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
319
319
  <div class="tsd-comment tsd-typography"><p>An object containing property values to set.</p>
320
320
  </div>
321
321
  <ul class="tsd-parameters">
322
322
  <li class="tsd-parameter">
323
- <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5>
323
+ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5>
324
324
  <div class="tsd-comment tsd-typography"><p>The features contained in the set.</p>
325
325
  </div></li>
326
326
  <li class="tsd-parameter">
@@ -359,13 +359,13 @@ the properties.</p>
359
359
  <h4 class="tsd-parameters-title">Parameters</h4>
360
360
  <ul class="tsd-parameter-list">
361
361
  <li>
362
- <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
362
+ <h5><span class="tsd-kind-parameter">properties</span>: <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">id</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">?: </span>{ geometryType?: GeometryJsonType; spatialReference?: { imageCoordinateSystem?: any; readonly isGeographic?: boolean; readonly isWebMercator?: boolean; readonly isWGS84?: boolean; ... 18 more ...; toJSON?: () =&gt; any; }; ... 6 more ...; types?: ({ ...; } | { ...; })[]; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span>{ hyperlinkTemplates?: ({ url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; } | { url?: string; text?: string; iconUrl?: string; target?: string; tooltip?: string; getReferencedFields?: () =&gt; string[]; ... 13 more ...; on?: (type: string | string[], listener: EventHandler) =&gt; IHandle;...<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">source</span><span class="tsd-signature-symbol">?: </span>{ attachmentTypes?: string[]; onAddFeature?: string | { name?: string; arguments?: {}; } | (string | { name?: string; arguments?: {}; })[]; onEditFeature?: string | { name?: string; arguments?: {}; } | (string | { ...; })[]; ... 27 more ...; destroy?: () =&gt; Promise&lt;...&gt;; }<span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h5>
363
363
  <div class="tsd-comment tsd-typography"><p>A plain object containing property values to set, keyed
364
364
  by property name.</p>
365
365
  </div>
366
366
  <ul class="tsd-parameters">
367
367
  <li class="tsd-parameter">
368
- <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;{}, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ....<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: { [x: string]: {}; } | Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5>
368
+ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">features</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>{ readonly attributes?: Map&lt;string, {}&gt;; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; y?: number; z?: number; ... 21 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 mo...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span>{ attributes?: Map&lt;string, {}&gt; | { [x: string]: {}; }; geometry?: { readonly cache?: any; readonly extent?: { readonly center?: { latitude?: number; longitude?: number; m?: number; readonly type?: &quot;point&quot;; x?: number; ... 23 more ...; toJSON?: () =&gt; any; }; ... 37 more ...; toJSON?: () =&gt; any; }; ... 16 more ...; to...<span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5>
369
369
  <div class="tsd-comment tsd-typography"><p>The features contained in the set.</p>
370
370
  </div></li>
371
371
  <li class="tsd-parameter">
@@ -16,7 +16,7 @@
16
16
  <li><a href="../modules/version.html">version</a></li>
17
17
  <li><a href="version.version.html">version</a></li></ul>
18
18
  <h1>Variable version<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
19
- <div class="tsd-signature"><span class="tsd-kind-variable">version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;41.0.0&quot;</span><span class="tsd-signature-symbol"> = &quot;41.0.0&quot;</span></div>
19
+ <div class="tsd-signature"><span class="tsd-kind-variable">version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;41.1.0&quot;</span><span class="tsd-signature-symbol"> = &quot;41.1.0&quot;</span></div>
20
20
  <div class="tsd-comment tsd-typography"><p>The current version of the Geocortex ArcGIS Extensions API.</p>
21
21
  </div></div>
22
22
  <div class="col-sidebar">
@@ -1 +1 @@
1
- import{__decorate as e}from"tslib";import r from"@arcgis/core/config";import t from"@arcgis/core/core/Collection";import i from"@arcgis/core/geometry/SpatialReference";import{jsonToLayer as s}from"../json/LayerJson.js";import{serializable as a}from"../support/Serializable.js";import{ReadOnlyCollection as o}from"../utilities/ReadOnlyCollection.js";import{isGeoRssLayer as n}from"../utilities/_layers.js";import{map as l}from"../utilities/promise.js";import{FeatureCollectionLayerExtension as c}from"./FeatureCollectionLayerExtension.js";import{LayerExtension as u,LayerExtensionSchema as p}from"./_LayerExtension.js";export const DEFAULT_GEO_RSS_UTILITY="https://utility.arcgis.com/sharing/rss";let y=class extends u{constructor(){super(...arguments),this._featureLayerXCache=[]}get layer(){return super.layer}get _featureLayerExtensions(){return this._featureLayerXCache}get hasFeatures(){return!0}_capabilities(){return Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1,supportsStandardizedQueries:!0})}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,layer:{...this._toPropertyDef(e.layer),default:{layerType:"GeoRSS"}}}}_isSupportedLayer(e){return n(e)}_createSchema(){return new f(this)}async _initializeLayer(){r.geoRSSServiceUrl||(r.geoRSSServiceUrl=DEFAULT_GEO_RSS_UTILITY)}async _onInitialize(){await super._onInitialize(),this.layer.featureCollections&&(this._featureLayerXCache=await l(this.layer.featureCollections,(async e=>{const r={layerType:"ArcGISFeatureLayer",featureCollection:{layers:[e]}};return new c({layer:await s(r)})})))}};y=e([a],y);export{y as GeoRSSLayerExtension};let f=class extends p{constructor(e){super(e),this._fieldsCollection=new m(e)}_getPropertyBindings(){return{spatialReference:{value:i.WGS84}}}get _fields(){return this._fieldsCollection}};f=e([a],f);class m extends o{get _collection(){if(!this.layerExtension?.layer)return new t;let e=new t;return this.layerExtension._featureLayerExtensions.forEach((r=>{const t=r.layer.fields.filter((r=>!e.some((e=>this._fieldsEqual(r,e)))));e=e.concat(t)})),e}constructor(e){super(),this.layerExtension=e}_fieldsEqual(e,r){return e.alias===r.alias&&e.name===r.name&&e.type===r.type}}
1
+ import{__decorate as e}from"tslib";import r from"@arcgis/core/config";import t from"@arcgis/core/core/Collection";import i from"@arcgis/core/geometry/SpatialReference";import{jsonToLayer as s}from"../json/LayerJson.js";import{serializable as a}from"../support/Serializable.js";import{ReadOnlyCollection as o}from"../utilities/ReadOnlyCollection.js";import{isGeoRssLayer as n}from"../utilities/_layers.js";import{map as l}from"../utilities/promise.js";import{caseInsensitiveEquals as u}from"../utilities/string.js";import{FeatureCollectionLayerExtension as c}from"./FeatureCollectionLayerExtension.js";import{LayerExtension as p,LayerExtensionSchema as y}from"./_LayerExtension.js";export const DEFAULT_GEO_RSS_UTILITY="https://utility.arcgis.com/sharing/rss";let f=class extends p{constructor(){super(...arguments),this._featureLayerXCache=[]}get layer(){return super.layer}get _featureLayerExtensions(){return this._featureLayerXCache}get hasFeatures(){return!0}_capabilities(){return Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1,supportsStandardizedQueries:!0})}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,layer:{...this._toPropertyDef(e.layer),default:{layerType:"GeoRSS"}}}}_isSupportedLayer(e){return n(e)}_createSchema(){return new m(this)}async _initializeLayer(){r.geoRSSServiceUrl||(r.geoRSSServiceUrl=DEFAULT_GEO_RSS_UTILITY)}async _onInitialize(){await super._onInitialize(),this.layer.featureCollections&&(this._featureLayerXCache=await l(this.layer.featureCollections,(async e=>{const r={layerType:"ArcGISFeatureLayer",featureCollection:{layers:[e]}};return new c({layer:await s(r)})})))}};f=e([a],f);export{f as GeoRSSLayerExtension};let m=class extends y{constructor(e){super(e),this._fieldsCollection=new _(e)}_getPropertyBindings(){return{spatialReference:{value:i.WGS84}}}get _fields(){return this._fieldsCollection}};m=e([a],m);class _ extends o{get _collection(){if(!this.layerExtension?.layer)return new t;let e=new t;return this.layerExtension._featureLayerExtensions.forEach((r=>{const t=r.layer.fields.filter((r=>!e.some((e=>this._fieldsEqual(r,e)))));e=e.concat(t)})),e}constructor(e){super(),this.layerExtension=e}_fieldsEqual(e,r){return!(!u(e.alias,r.alias)||!u(e.name,r.name)||e.type!==r.type)}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vertigis/arcgis-extensions",
3
3
  "license": "SEE LICENSE IN LICENSE",
4
- "version": "41.0.0",
4
+ "version": "41.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://dev.azure.com/vertigis/Studio/_git/arcgis-extensions-ts"
@@ -1 +1 @@
1
- import e from"@arcgis/core/core/Collection";import r from"@arcgis/core/layers/support/Field";import t from"@arcgis/core/portal/Portal";import o from"@arcgis/core/portal/PortalItem";import i from"@arcgis/core/rest/support/DirectionLine";import a from"@arcgis/core/rest/support/DirectionPoint";import s from"@arcgis/core/rest/support/PointBarrier";import n from"@arcgis/core/rest/support/PolygonBarrier";import l from"@arcgis/core/rest/support/PolylineBarrier";import p from"@arcgis/core/rest/support/RouteInfo";import y from"@arcgis/core/rest/support/Stop";import{isCSVLayer as f,isFeatureLayer as u,isGraphicsLayer as c,isStreamLayer as m,isMapNotesLayer as d,isRouteLayer as g}from"../utilities/_layers.js";import{groupBy as P}from"../utilities/array.js";import{checkArg as h}from"../utilities/checkArg.js";import{isGraphic as L}from"../utilities/esri.js";import{isNumeric as T}from"../utilities/number.js";import{Feature as b}from"./Feature.js";import{Field as E}from"./Field.js";import{FormInfo as I}from"./FormInfo.js";import{GeometryType as A}from"./Geometry.js";import{LayerDefinition as w}from"./LayerDefinition.js";import{PopupInfo as D}from"./PopupInfo.js";import{defaultLineRenderer as G,defaultPointRenderer as O,defaultPolygonRenderer as F}from"./Renderer.js";import{toEsriApiSymbol as _}from"./Symbol.js";import{Type as C}from"./Type.js";import{GRAPHICS_LAYER_ID as S}from"./_FeatureLayer.js";import{ERR_LAYER_TYPE_MISMATCH as v,applyLayerBaseToEsriApiLayer as M,applyOperationalLayerToEsriApiLayer as N,fromEsriApiLayerToLayerBase as R,fromEsriApiLayerToOperationalLayer as j}from"./_layerHelper.js";const x="Feature layer graphics must have the same geometry types.",V="graphic-id";export const POLYGON_LAYER_TITLE_3X="Areas";export const POLYGON_LAYER_TITLE_4X="Polygons";export const POLYLINE_LAYER_TITLE_3X="Lines";export const POLYLINE_LAYER_TITLE_4X="Polylines";export const MULTIPOINTS_LAYER_TITLE="Multipoints";export const POINTS_LAYER_TITLE="Points";export const TEXT_LAYER_TITLE="Text";const k=[{layerProperty:"polygonLayer",title:"Areas",geometryType:"esriGeometryPolygon",version:3},{layerProperty:"polygonLayer",title:"Polygons",geometryType:"esriGeometryPolygon",version:4},{layerProperty:"polylineLayer",title:"Lines",geometryType:"esriGeometryPolyline",version:3},{layerProperty:"polylineLayer",title:"Polylines",geometryType:"esriGeometryPolyline",version:4},{layerProperty:"multipointLayer",title:"Multipoints",geometryType:"esriGeometryMultipoint",version:4},{layerProperty:"pointLayer",title:"Points",geometryType:"esriGeometryPoint",version:4},{layerProperty:"textLayer",title:"Text",geometryType:"esriGeometryPoint",version:4}],J=[{layerProperty:"routeInfo",title:"RouteInfo",geometryType:"esriGeometryPolyline"},{layerProperty:"directionLines",title:"DirectionLines",geometryType:"esriGeometryPolyline"},{layerProperty:"directionPoints",title:"DirectionPoints",geometryType:"esriGeometryPoint"},{layerProperty:"stops",title:"Stops",geometryType:"esriGeometryPoint"},{layerProperty:"pointBarriers",title:"PointBarriers",geometryType:"esriGeometryPoint",updateConfigProperty:"readPointBarriers"},{layerProperty:"polylineBarriers",title:"PolylineBarriers",geometryType:"esriGeometryPolyline"},{layerProperty:"polygonBarriers",title:"PolygonBarriers",geometryType:"esriGeometryPolygon"}];export var FeatureLayer;!function(i){async function a(i,a,p){h("layerJson",i).isNotMissing(),h("layerJson.layerType",i.layerType).satisfies((e=>!e||"ArcGISFeatureLayer"===e||"ArcGISStreamLayer"===e||"CSV"===e),v),h("layer",a).isNotMissing().satisfies((e=>u(e)||m(e)||f(e)||c(e)||d(e)||g(e)),v),u(a)||m(a)||f(a)?(h("layerJson",i).satisfies((e=>!s(e))),i.hasOwnProperty("disablePopup")&&(a.popupEnabled=!i.disablePopup),i.hasOwnProperty("screenSizePerspective")&&(a.screenSizePerspectiveEnabled=i.screenSizePerspective),i.hasOwnProperty("showLabels")&&(a.labelsVisible=i.showLabels),i.hasOwnProperty("featureCollection")?(h("layerJson.url",i).satisfies((e=>!e.url)),h("layerJson.featureCollection.layers",i.featureCollection?.layers).isNotMissing(),h("layerJson.featureCollection.layers",i.featureCollection?.layers).satisfies((e=>1===e.length)),await async function(r,t){const o=r.featureCollection.layers[0];if(M(r,t),N(r,t),t.legendEnabled=r.featureCollection.showLegend,o.hasOwnProperty("layerDefinition")){const e=o.layerDefinition;await w.applyToEsriApiLayer(e,t),t.version=X(e),e.hasOwnProperty("types")&&(t.types=e.types.map((e=>C.toEsriApiFeatureType(e))))}o.hasOwnProperty("popupInfo")&&(t.popupTemplate=D.toEsriApiPopupTemplate(o.popupInfo));o.hasOwnProperty("formInfo")&&(t.formTemplate=I.toEsriApiFormTemplate(o.formInfo));t.source||(t.source=new e);o.hasOwnProperty("featureSet")&&o.featureSet.geometryType&&(t.geometryType=A.toEsriApiGeometryType(o.featureSet.geometryType),o.featureSet.features&&!t.loaded&&(t.source.removeAll(),t.source.addMany(o.featureSet.features.map(b.toEsriApiGraphic))))}(i,a)):(h("layerJson.source",i).satisfies((e=>!e.featureCollection)),await async function(e,r,i){M(e,r),N(e,r),e.hasOwnProperty("url")&&(r.url=e.url);u(r)&&(e.hasOwnProperty("itemId")&&(r.portalItem?r.portalItem.id=e.itemId:r.portalItem=new o({id:e.itemId,portal:i||t.getDefault()})),e.hasOwnProperty("formInfo")&&(r.formTemplate=I.toEsriApiFormTemplate(e.formInfo)));e.hasOwnProperty("popupInfo")&&(r.popupTemplate=D.toEsriApiPopupTemplate(e.popupInfo));e.hasOwnProperty("mode")&&(r.mode=e.mode);e.hasOwnProperty("layerDefinition")&&(await w.applyToEsriApiLayer(e.layerDefinition,r),r.version=X(e.layerDefinition))}(i,a,p))):c(a)?(i.hasOwnProperty("featureCollection")&&h("layerJson",i).satisfies(s),function(e,r){M(e,r),r.id=r.id.replace(S,"");const t=r;t._fields||(t._fields=[]);e.featureCollectionType&&(r.featureCollectionType=e.featureCollectionType);if(e.featureCollection?.layers){const o=e.featureCollection.layers.filter((e=>!!e.featureSet?.features)),i=B(o);t._fields=[...Y(o,t._fields)];const a=e=>e.attributes[V];i.every((e=>"number"==typeof a(e)))&&i.sort(((e,r)=>a(e)>a(r)?1:a(e)<a(r)?-1:0));for(const e of i.toArray())delete e.attributes[V];r.graphics.removeAll(),r.graphics.addMany(i)}}(i,a)):d(a)?(i.hasOwnProperty("featureCollection")&&h("layerJson",i).satisfies(n),function(e,r){M(e,r),N(e,r);const t=r;t._fields||(t._fields=[]);let o=0;for(const t of k){const i=r[t.layerProperty],a=e.featureCollection?.layers.find((e=>e.layerDefinition?.name===t.title));if(i&&a){e.visibleLayers&&(i.visible=e.visibleLayers.includes(o));const r=B([a]);i.graphics.addMany(r),o++}}t._fields=Y(e.featureCollection?.layers??[],t._fields)}(i,a)):g(a)&&(i.hasOwnProperty("featureCollection")&&h("layerJson",i).satisfies(l),function(e,t){M(e,t),N(e,t);const o=t;o._fields||(o._fields=[]);const i={};let a=1;for(const o of J){const s=e.featureCollection?.layers.find((e=>e.layerDefinition?.name===o.title));if(s){let e=t._fields?.find((e=>"global-id"===e.type))?.name;if(!e){const o=new r({type:"global-id",name:"globalid"});t._fields.push(o),s.layerDefinition.fields=(s.layerDefinition.fields??[]).concat(E.fromEsriApiField(o)),e=o.name}let n=B([s]);switch(n.forEach((r=>r.setAttribute(e,a++))),o.layerProperty){case"routeInfo":n=n.map((e=>fromRouteLayerGraphic(e,"route-info"))).getItemAt(0);break;case"directionLines":n=n.map((e=>fromRouteLayerGraphic(e,"direction-line")));break;case"directionPoints":n=n.map((e=>fromRouteLayerGraphic(e,"direction-point")));break;case"stops":n=n.map((e=>fromRouteLayerGraphic(e,"stop")));break;case"pointBarriers":n=n.map((e=>fromRouteLayerGraphic(e,"barrier-point")));break;case"polylineBarriers":n=n.map((e=>fromRouteLayerGraphic(e,"barrier-line")));break;case"polygonBarriers":n=n.map((e=>fromRouteLayerGraphic(e,"barrier-area")))}i[o.updateConfigProperty??o.layerProperty]=n}}i.routeInfo&&t.update(i);o._fields=Y(e.featureCollection?.layers??[],o._fields)}(i,a)),u(a)&&i.customParameters?.hasOwnProperty("gdbVersion")&&(a.gdbVersion=i.customParameters.gdbVersion);const y=i.capabilities??i.layerDefinition?.capabilities;null!=y&&u(a)&&(a.editingEnabled=y.toLowerCase().split(",").includes("editing"))}function s(e){return e.id?.startsWith(S)||e.$ref&&"graphics-layer"===e.$ref.subtype||"ArcGISFeatureLayer"===e.layerType&&e.featureCollection?.layers?.length>1}function n(e){return"notes"===e.featureCollectionType||e.$ref&&"map-notes-layer"===e.$ref.subtype}function l(e){return"route"===e.featureCollectionType||e.$ref&&"route-layer"===e.$ref.subtype}i.esriFeatureLayerDefaults={labelsVisible:!0,legendEnabled:!0,popupEnabled:!0,hasM:!1,hasZ:!1,visible:!0,opacity:1,wkid:4326,minScale:0,maxScale:0,screenSizePerspective:!0},i.toEsriApiLayer=async function(e,r){let t;return h("layerJson",e).isNotMissing(),h("layerJson.layerType",e.layerType).satisfies((e=>!e||"ArcGISFeatureLayer"===e),v),t=n(e)?new((await import("@arcgis/core/layers/MapNotesLayer")).default):l(e)?new((await import("@arcgis/core/layers/RouteLayer")).default):s(e)?new((await import("@arcgis/core/layers/GraphicsLayer")).default):new((await import("@arcgis/core/layers/FeatureLayer")).default),function(e){if(!e.featureCollection?.layers)return;for(const r of e.featureCollection.layers)if(r.layerDefinition?.geometryType){r.layerDefinition.drawingInfo=r.layerDefinition.drawingInfo||{};let{renderer:e}=r.layerDefinition.drawingInfo;if(!e)switch(r.layerDefinition.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":e=O;break;case"esriGeometryPolyline":e=G;break;case"esriGeometryPolygon":case"esriGeometryEnvelope":e=F}r.layerDefinition.drawingInfo.renderer=e}}(e),await a(e,t,r),t},i.applyToEsriApiLayer=a,i.fromEsriApiFeatureLayer=function(r){h("layer",r).isNotMissing(),h("layer.source",r).satisfies((r=>!(e.isCollection(r.source)&&r.url)),"Feature layer must have a URL or a source, but not both.");const t={...R(r,i.esriFeatureLayerDefaults),...j(r),layerType:"ArcGISFeatureLayer"};return r.popupEnabled!==i.esriFeatureLayerDefaults.popupEnabled&&(t.disablePopup=!r.popupEnabled),r.screenSizePerspectiveEnabled!==i.esriFeatureLayerDefaults.screenSizePerspective&&(t.screenSizePerspective=r.screenSizePerspectiveEnabled),r.labelsVisible!==i.esriFeatureLayerDefaults.labelsVisible&&(t.showLabels=r.labelsVisible),u(r)&&r.gdbVersion&&(t.customParameters={...t.customParameters,gdbVersion:r.gdbVersion}),u(r)&&e.isCollection(r.source)?function(e,r){h("layer",e).isNotMissing(),h("featureLayer",r).isNotMissing(),h("layer.geometryType",e.geometryType).isNotMissing(),h("layer.source",e).satisfies(U,x);const t={featureSet:{features:e.source.map(b.fromEsriApiGraphic).toArray(),geometryType:A.fromEsriApiGeometryType(e.geometryType)},layerDefinition:w.fromEsriApiLayer(e)};e.types&&(t.layerDefinition.types=e.types.map((e=>C.fromEsriApiFeatureType(e))));e.typeIdField&&(t.layerDefinition.typeIdField=e.typeIdField);e.popupTemplate&&(t.popupInfo=D.fromEsriApiPopupTemplate(e.popupTemplate));e.formTemplate&&(r.formInfo=I.fromEsriApiFormTemplate(e.formTemplate));r.featureCollection={layers:[t],showLegend:e.legendEnabled}}(r,t):z(r,t),t},i.fromEsriApiMapNotesLayer=function(e){h("layer",e).isNotMissing();const r={...R(e,i.esriFeatureLayerDefaults),layerType:"ArcGISFeatureLayer",featureCollectionType:"notes",visibleLayers:[],featureCollection:{layers:[],showLegend:!1}};let t=-1;for(const o of k.filter((e=>4===e.version))){t++;const{layerProperty:i,geometryType:a}=o,s=e[i];if(!s)continue;const{graphics:n}=s,l=q({layer:e,geometryType:a,graphics:n,layerDefinition:w.fromEsriApiLayer(s),includeAllFields:!0});r.featureCollection.layers.push(l),s.visible&&r.visibleLayers.push(t)}return r},i.fromEsriApiRouteLayer=function(e){h("layer",e).isNotMissing();const r={...R(e,i.esriFeatureLayerDefaults),layerType:"ArcGISFeatureLayer",featureCollectionType:"route",visibleLayers:[],featureCollection:{layers:[],showLegend:!1}},t=w.fromEsriApiLayer(e);for(const o of J){const{layerProperty:i,geometryType:a}=o,s="routeInfo"===i?e[i]&&[toRouteLayerGraphic(e[i])]:e[i]?.toArray().map(toRouteLayerGraphic);if(!s?.length)continue;const n=q({layer:e,geometryType:a,graphics:s,layerDefinition:{...t,name:o.title,type:"Feature Layer"}});r.featureCollection.layers.push(n),r.visibleLayers.push(r.visibleLayers.length)}return r},i.fromEsriApiGraphicsLayer=function(e){h("layer",e).isNotMissing();const r={...R(e,i.esriFeatureLayerDefaults),layerType:"ArcGISFeatureLayer",featureCollection:{layers:[],showLegend:!1}};if(r.id=S+r.id,!e.graphics)return r;const t=P(e.graphics.toArray(),(e=>A.fromEsriApiGeometryType(e.geometry.type))),o=w.fromEsriApiLayer(e);for(const[i,a]of t.entries()){const t=q({layer:e,geometryType:i,graphics:a.map((r=>({graphic:r,attributes:{[V]:e.graphics.indexOf(r)}}))),layerDefinition:o});r.featureCollection.layers.push(t)}return r},i.isGraphicsLayerJson=s,i.isFeatureCollection=function(e){return!e.id?.startsWith(S)&&e.$ref&&"feature-collection-layer"===e.$ref.subtype||1===e.featureCollection?.layers?.length},i.isMapNotesLayerJson=n,i.isRouteLayerJson=l}(FeatureLayer||(FeatureLayer={}));export var FeatureLayerMode;function B(r){const t=new e;for(const e of r){if(!e.featureSet?.features)return t;t.addMany(e.featureSet.features.map(b.toEsriApiGraphic)),t.forEach((r=>{null===r.symbol&&(r.symbol=$(r,e.layerDefinition))})),e.popupInfo&&t.forEach((r=>{null===r.popupTemplate&&(r.popupTemplate=D.toEsriApiPopupTemplate(e.popupInfo))}))}return t}function Y(e,r=[]){const t=new Map;r.forEach((e=>t.set(e.name,e)));for(const r of e)r.layerDefinition?.fields?.forEach((e=>{t.set(e.name,E.toEsriApiField(e))}));return[...t.values()]}function $(e,r){let t;if(r?.drawingInfo?.renderer)if("uniqueValue"===r.drawingInfo.renderer.type&&r.drawingInfo.renderer.uniqueValueInfos.length>0){const{uniqueValueInfos:o}=r.drawingInfo.renderer,i=o.find((r=>r.value===e.attributes.TYPEID.toString()));i&&(t=_(i.symbol))}else"simple"===r.drawingInfo.renderer.type&&(t=_(r.drawingInfo.renderer.symbol));return t}function z(e,r){h("layer",e).isNotMissing(),h("featureLayer",r).isNotMissing(),u(e)?(r.url=T(e.layerId)?`${e.url}/${e.layerId}`:e.url,e.portalItem&&(r.itemId=e.portalItem.id),e.formTemplate&&(r.formInfo=I.fromEsriApiFormTemplate(e.formTemplate))):r.url=e.url,r.layerDefinition=w.fromEsriApiLayer(e,FeatureLayer.esriFeatureLayerDefaults),e.popupTemplate&&(r.popupInfo=D.fromEsriApiPopupTemplate(e.popupTemplate)),isNaN(e.mode)||(r.mode=e.mode)}function X(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:void 0}function U(e){return!(e.source&&e.source.length>0)||e.source.every((r=>r.geometry.type===e.geometryType))}function q(e){const{geometryType:r,graphics:t,layerDefinition:o,layer:i,includeAllFields:a}=e,s=i?._fields?.map((e=>E.fromEsriApiField(e)))??[],n=new Set(a?s:[]),l={featureSet:{features:[],geometryType:r},layerDefinition:{geometryType:r,fields:[],...o}};for(const e of t){const[r,t]=L(e)?[e,void 0]:[e.graphic,e.attributes];if(t){r.attributes||(r.attributes={});for(const[e,o]of Object.entries(t))r.attributes[e]=o}const o=b.fromEsriApiGraphic(r);for(const[e,t]of Object.entries(r.attributes??{})){let r=s.find((r=>r.name===e));r?n.add(r):(r={name:e,alias:e,editable:!0,nullable:!0},"number"==typeof t?r.type="esriFieldTypeDouble":t instanceof Date?r.type="esriFieldTypeDate":r.type="esriFieldTypeString",s.push(r),n.add(r))}l.featureSet.features.push(o)}return l.layerDefinition.fields=[...n],l.layerDefinition.objectIdField=l.layerDefinition.fields.find((e=>"esriFieldTypeOID"===e.type))?.name,l}!function(e){e[e.MODE_SNAPSHOT=0]="MODE_SNAPSHOT",e[e.MODE_ONDEMAND=1]="MODE_ONDEMAND",e[e.MODE_SELECTION=2]="MODE_SELECTION",e[e.MODE_AUTO=6]="MODE_AUTO"}(FeatureLayerMode||(FeatureLayerMode={}));const H="__gcxGlobalId";export function fromRouteLayerGraphic(e,r){let t;switch(r){case"barrier-area":t=n.fromGraphic(e);break;case"barrier-line":t=l.fromGraphic(e);break;case"barrier-point":t=s.fromGraphic(e);break;case"direction-line":t=i.fromGraphic(e);break;case"direction-point":t=a.fromGraphic(e);break;case"route-info":t=p.fromGraphic(e);break;case"stop":t=y.fromGraphic(e)}return t[H]=e.getAttribute("globalid"),t}export function toRouteLayerGraphic(e){const r=e.toGraphic();return e[H]&&r.setAttribute("globalid",e[H]),r}
1
+ import e from"@arcgis/core/core/Collection";import r from"@arcgis/core/layers/support/Field";import t from"@arcgis/core/portal/Portal";import o from"@arcgis/core/portal/PortalItem";import i from"@arcgis/core/rest/support/DirectionLine";import a from"@arcgis/core/rest/support/DirectionPoint";import s from"@arcgis/core/rest/support/PointBarrier";import n from"@arcgis/core/rest/support/PolygonBarrier";import l from"@arcgis/core/rest/support/PolylineBarrier";import p from"@arcgis/core/rest/support/RouteInfo";import y from"@arcgis/core/rest/support/Stop";import{isCSVLayer as f,isFeatureLayer as u,isGraphicsLayer as c,isStreamLayer as m,isMapNotesLayer as d,isRouteLayer as g}from"../utilities/_layers.js";import{groupBy as P}from"../utilities/array.js";import{checkArg as h}from"../utilities/checkArg.js";import{isGraphic as L}from"../utilities/esri.js";import{isNumeric as T}from"../utilities/number.js";import{caseInsensitiveEquals as b}from"../utilities/string.js";import{Feature as E}from"./Feature.js";import{Field as I}from"./Field.js";import{FormInfo as A}from"./FormInfo.js";import{GeometryType as w}from"./Geometry.js";import{LayerDefinition as D}from"./LayerDefinition.js";import{PopupInfo as G}from"./PopupInfo.js";import{defaultLineRenderer as O,defaultPointRenderer as F,defaultPolygonRenderer as _}from"./Renderer.js";import{toEsriApiSymbol as C}from"./Symbol.js";import{Type as S}from"./Type.js";import{GRAPHICS_LAYER_ID as v}from"./_FeatureLayer.js";import{ERR_LAYER_TYPE_MISMATCH as M,applyLayerBaseToEsriApiLayer as N,applyOperationalLayerToEsriApiLayer as R,fromEsriApiLayerToLayerBase as j,fromEsriApiLayerToOperationalLayer as x}from"./_layerHelper.js";const V="Feature layer graphics must have the same geometry types.",k="graphic-id";export const POLYGON_LAYER_TITLE_3X="Areas";export const POLYGON_LAYER_TITLE_4X="Polygons";export const POLYLINE_LAYER_TITLE_3X="Lines";export const POLYLINE_LAYER_TITLE_4X="Polylines";export const MULTIPOINTS_LAYER_TITLE="Multipoints";export const POINTS_LAYER_TITLE="Points";export const TEXT_LAYER_TITLE="Text";const J=[{layerProperty:"polygonLayer",title:"Areas",geometryType:"esriGeometryPolygon",version:3},{layerProperty:"polygonLayer",title:"Polygons",geometryType:"esriGeometryPolygon",version:4},{layerProperty:"polylineLayer",title:"Lines",geometryType:"esriGeometryPolyline",version:3},{layerProperty:"polylineLayer",title:"Polylines",geometryType:"esriGeometryPolyline",version:4},{layerProperty:"multipointLayer",title:"Multipoints",geometryType:"esriGeometryMultipoint",version:4},{layerProperty:"pointLayer",title:"Points",geometryType:"esriGeometryPoint",version:4},{layerProperty:"textLayer",title:"Text",geometryType:"esriGeometryPoint",version:4}],B=[{layerProperty:"routeInfo",title:"RouteInfo",geometryType:"esriGeometryPolyline"},{layerProperty:"directionLines",title:"DirectionLines",geometryType:"esriGeometryPolyline"},{layerProperty:"directionPoints",title:"DirectionPoints",geometryType:"esriGeometryPoint"},{layerProperty:"stops",title:"Stops",geometryType:"esriGeometryPoint"},{layerProperty:"pointBarriers",title:"PointBarriers",geometryType:"esriGeometryPoint",updateConfigProperty:"readPointBarriers"},{layerProperty:"polylineBarriers",title:"PolylineBarriers",geometryType:"esriGeometryPolyline"},{layerProperty:"polygonBarriers",title:"PolygonBarriers",geometryType:"esriGeometryPolygon"}];export var FeatureLayer;!function(i){async function a(i,a,p){h("layerJson",i).isNotMissing(),h("layerJson.layerType",i.layerType).satisfies((e=>!e||"ArcGISFeatureLayer"===e||"ArcGISStreamLayer"===e||"CSV"===e),M),h("layer",a).isNotMissing().satisfies((e=>u(e)||m(e)||f(e)||c(e)||d(e)||g(e)),M),u(a)||m(a)||f(a)?(h("layerJson",i).satisfies((e=>!s(e))),i.hasOwnProperty("disablePopup")&&(a.popupEnabled=!i.disablePopup),i.hasOwnProperty("screenSizePerspective")&&(a.screenSizePerspectiveEnabled=i.screenSizePerspective),i.hasOwnProperty("showLabels")&&(a.labelsVisible=i.showLabels),i.hasOwnProperty("featureCollection")?(h("layerJson.url",i).satisfies((e=>!e.url)),h("layerJson.featureCollection.layers",i.featureCollection?.layers).isNotMissing(),h("layerJson.featureCollection.layers",i.featureCollection?.layers).satisfies((e=>1===e.length)),await async function(r,t){const o=r.featureCollection.layers[0];if(N(r,t),R(r,t),t.legendEnabled=r.featureCollection.showLegend,o.hasOwnProperty("layerDefinition")){const e=o.layerDefinition;await D.applyToEsriApiLayer(e,t),t.version=U(e),e.hasOwnProperty("types")&&(t.types=e.types.map((e=>S.toEsriApiFeatureType(e))))}o.hasOwnProperty("popupInfo")&&(t.popupTemplate=G.toEsriApiPopupTemplate(o.popupInfo));o.hasOwnProperty("formInfo")&&(t.formTemplate=A.toEsriApiFormTemplate(o.formInfo));t.source||(t.source=new e);o.hasOwnProperty("featureSet")&&o.featureSet.geometryType&&(t.geometryType=w.toEsriApiGeometryType(o.featureSet.geometryType),o.featureSet.features&&!t.loaded&&(t.source.removeAll(),t.source.addMany(o.featureSet.features.map(E.toEsriApiGraphic))))}(i,a)):(h("layerJson.source",i).satisfies((e=>!e.featureCollection)),await async function(e,r,i){N(e,r),R(e,r),e.hasOwnProperty("url")&&(r.url=e.url);u(r)&&(e.hasOwnProperty("itemId")&&(r.portalItem?r.portalItem.id=e.itemId:r.portalItem=new o({id:e.itemId,portal:i||t.getDefault()})),e.hasOwnProperty("formInfo")&&(r.formTemplate=A.toEsriApiFormTemplate(e.formInfo)));e.hasOwnProperty("popupInfo")&&(r.popupTemplate=G.toEsriApiPopupTemplate(e.popupInfo));e.hasOwnProperty("mode")&&(r.mode=e.mode);e.hasOwnProperty("layerDefinition")&&(await D.applyToEsriApiLayer(e.layerDefinition,r),r.version=U(e.layerDefinition))}(i,a,p))):c(a)?(i.hasOwnProperty("featureCollection")&&h("layerJson",i).satisfies(s),function(e,r){N(e,r),r.id=r.id.replace(v,"");const t=r;t._fields||(t._fields=[]);e.featureCollectionType&&(r.featureCollectionType=e.featureCollectionType);if(e.featureCollection?.layers){const o=e.featureCollection.layers.filter((e=>!!e.featureSet?.features)),i=Y(o);t._fields=[...$(o,t._fields)];const a=e=>e.attributes[k];i.every((e=>"number"==typeof a(e)))&&i.sort(((e,r)=>a(e)>a(r)?1:a(e)<a(r)?-1:0));for(const e of i.toArray())delete e.attributes[k];r.graphics.removeAll(),r.graphics.addMany(i)}}(i,a)):d(a)?(i.hasOwnProperty("featureCollection")&&h("layerJson",i).satisfies(n),function(e,r){N(e,r),R(e,r);const t=r;t._fields||(t._fields=[]);let o=0;for(const t of J){const i=r[t.layerProperty],a=e.featureCollection?.layers.find((e=>e.layerDefinition?.name===t.title));if(i&&a){e.visibleLayers&&(i.visible=e.visibleLayers.includes(o));const r=Y([a]);i.graphics.addMany(r),o++}}t._fields=$(e.featureCollection?.layers??[],t._fields)}(i,a)):g(a)&&(i.hasOwnProperty("featureCollection")&&h("layerJson",i).satisfies(l),function(e,t){N(e,t),R(e,t);const o=t;o._fields||(o._fields=[]);const i={};let a=1;for(const o of B){const s=e.featureCollection?.layers.find((e=>e.layerDefinition?.name===o.title));if(s){let e=t._fields?.find((e=>"global-id"===e.type))?.name;if(!e){const o=new r({type:"global-id",name:"globalid"});t._fields.push(o),s.layerDefinition.fields=(s.layerDefinition.fields??[]).concat(I.fromEsriApiField(o)),e=o.name}let n=Y([s]);switch(n.forEach((r=>r.setAttribute(e,a++))),o.layerProperty){case"routeInfo":n=n.map((e=>fromRouteLayerGraphic(e,"route-info"))).getItemAt(0);break;case"directionLines":n=n.map((e=>fromRouteLayerGraphic(e,"direction-line")));break;case"directionPoints":n=n.map((e=>fromRouteLayerGraphic(e,"direction-point")));break;case"stops":n=n.map((e=>fromRouteLayerGraphic(e,"stop")));break;case"pointBarriers":n=n.map((e=>fromRouteLayerGraphic(e,"barrier-point")));break;case"polylineBarriers":n=n.map((e=>fromRouteLayerGraphic(e,"barrier-line")));break;case"polygonBarriers":n=n.map((e=>fromRouteLayerGraphic(e,"barrier-area")))}i[o.updateConfigProperty??o.layerProperty]=n}}i.routeInfo&&t.update(i);o._fields=$(e.featureCollection?.layers??[],o._fields)}(i,a)),u(a)&&i.customParameters?.hasOwnProperty("gdbVersion")&&(a.gdbVersion=i.customParameters.gdbVersion);const y=i.capabilities??i.layerDefinition?.capabilities;null!=y&&u(a)&&(a.editingEnabled=y.toLowerCase().split(",").includes("editing"))}function s(e){return e.id?.startsWith(v)||e.$ref&&"graphics-layer"===e.$ref.subtype||"ArcGISFeatureLayer"===e.layerType&&e.featureCollection?.layers?.length>1}function n(e){return"notes"===e.featureCollectionType||e.$ref&&"map-notes-layer"===e.$ref.subtype}function l(e){return"route"===e.featureCollectionType||e.$ref&&"route-layer"===e.$ref.subtype}i.esriFeatureLayerDefaults={labelsVisible:!0,legendEnabled:!0,popupEnabled:!0,hasM:!1,hasZ:!1,visible:!0,opacity:1,wkid:4326,minScale:0,maxScale:0,screenSizePerspective:!0},i.toEsriApiLayer=async function(e,r){let t;return h("layerJson",e).isNotMissing(),h("layerJson.layerType",e.layerType).satisfies((e=>!e||"ArcGISFeatureLayer"===e),M),t=n(e)?new((await import("@arcgis/core/layers/MapNotesLayer")).default):l(e)?new((await import("@arcgis/core/layers/RouteLayer")).default):s(e)?new((await import("@arcgis/core/layers/GraphicsLayer")).default):new((await import("@arcgis/core/layers/FeatureLayer")).default),function(e){if(!e.featureCollection?.layers)return;for(const r of e.featureCollection.layers)if(r.layerDefinition?.geometryType){r.layerDefinition.drawingInfo=r.layerDefinition.drawingInfo||{};let{renderer:e}=r.layerDefinition.drawingInfo;if(!e)switch(r.layerDefinition.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":e=F;break;case"esriGeometryPolyline":e=O;break;case"esriGeometryPolygon":case"esriGeometryEnvelope":e=_}r.layerDefinition.drawingInfo.renderer=e}}(e),await a(e,t,r),t},i.applyToEsriApiLayer=a,i.fromEsriApiFeatureLayer=function(r){h("layer",r).isNotMissing(),h("layer.source",r).satisfies((r=>!(e.isCollection(r.source)&&r.url)),"Feature layer must have a URL or a source, but not both.");const t={...j(r,i.esriFeatureLayerDefaults),...x(r),layerType:"ArcGISFeatureLayer"};return r.popupEnabled!==i.esriFeatureLayerDefaults.popupEnabled&&(t.disablePopup=!r.popupEnabled),r.screenSizePerspectiveEnabled!==i.esriFeatureLayerDefaults.screenSizePerspective&&(t.screenSizePerspective=r.screenSizePerspectiveEnabled),r.labelsVisible!==i.esriFeatureLayerDefaults.labelsVisible&&(t.showLabels=r.labelsVisible),u(r)&&r.gdbVersion&&(t.customParameters={...t.customParameters,gdbVersion:r.gdbVersion}),u(r)&&e.isCollection(r.source)?function(e,r){h("layer",e).isNotMissing(),h("featureLayer",r).isNotMissing(),h("layer.geometryType",e.geometryType).isNotMissing(),h("layer.source",e).satisfies(q,V);const t={featureSet:{features:e.source.map(E.fromEsriApiGraphic).toArray(),geometryType:w.fromEsriApiGeometryType(e.geometryType)},layerDefinition:D.fromEsriApiLayer(e)};e.types&&(t.layerDefinition.types=e.types.map((e=>S.fromEsriApiFeatureType(e))));e.typeIdField&&(t.layerDefinition.typeIdField=e.typeIdField);e.popupTemplate&&(t.popupInfo=G.fromEsriApiPopupTemplate(e.popupTemplate));e.formTemplate&&(r.formInfo=A.fromEsriApiFormTemplate(e.formTemplate));r.featureCollection={layers:[t],showLegend:e.legendEnabled}}(r,t):X(r,t),t},i.fromEsriApiMapNotesLayer=function(e){h("layer",e).isNotMissing();const r={...j(e,i.esriFeatureLayerDefaults),layerType:"ArcGISFeatureLayer",featureCollectionType:"notes",visibleLayers:[],featureCollection:{layers:[],showLegend:!1}};let t=-1;for(const o of J.filter((e=>4===e.version))){t++;const{layerProperty:i,geometryType:a}=o,s=e[i];if(!s)continue;const{graphics:n}=s,l=H({layer:e,geometryType:a,graphics:n,layerDefinition:D.fromEsriApiLayer(s),includeAllFields:!0});r.featureCollection.layers.push(l),s.visible&&r.visibleLayers.push(t)}return r},i.fromEsriApiRouteLayer=function(e){h("layer",e).isNotMissing();const r={...j(e,i.esriFeatureLayerDefaults),layerType:"ArcGISFeatureLayer",featureCollectionType:"route",visibleLayers:[],featureCollection:{layers:[],showLegend:!1}},t=D.fromEsriApiLayer(e);for(const o of B){const{layerProperty:i,geometryType:a}=o,s="routeInfo"===i?e[i]&&[toRouteLayerGraphic(e[i])]:e[i]?.toArray().map(toRouteLayerGraphic);if(!s?.length)continue;const n=H({layer:e,geometryType:a,graphics:s,layerDefinition:{...t,name:o.title,type:"Feature Layer"}});r.featureCollection.layers.push(n),r.visibleLayers.push(r.visibleLayers.length)}return r},i.fromEsriApiGraphicsLayer=function(e){h("layer",e).isNotMissing();const r={...j(e,i.esriFeatureLayerDefaults),layerType:"ArcGISFeatureLayer",featureCollection:{layers:[],showLegend:!1}};if(r.id=v+r.id,!e.graphics)return r;const t=P(e.graphics.toArray(),(e=>w.fromEsriApiGeometryType(e.geometry.type))),o=D.fromEsriApiLayer(e);for(const[i,a]of t.entries()){const t=H({layer:e,geometryType:i,graphics:a.map((r=>({graphic:r,attributes:{[k]:e.graphics.indexOf(r)}}))),layerDefinition:o});r.featureCollection.layers.push(t)}return r},i.isGraphicsLayerJson=s,i.isFeatureCollection=function(e){return!e.id?.startsWith(v)&&e.$ref&&"feature-collection-layer"===e.$ref.subtype||1===e.featureCollection?.layers?.length},i.isMapNotesLayerJson=n,i.isRouteLayerJson=l}(FeatureLayer||(FeatureLayer={}));export var FeatureLayerMode;function Y(r){const t=new e;for(const e of r){if(!e.featureSet?.features)return t;t.addMany(e.featureSet.features.map(E.toEsriApiGraphic)),t.forEach((r=>{null===r.symbol&&(r.symbol=z(r,e.layerDefinition))})),e.popupInfo&&t.forEach((r=>{null===r.popupTemplate&&(r.popupTemplate=G.toEsriApiPopupTemplate(e.popupInfo))}))}return t}function $(e,r=[]){const t=new Map;r.forEach((e=>t.set(e.name,e)));for(const r of e)r.layerDefinition?.fields?.forEach((e=>{t.set(e.name,I.toEsriApiField(e))}));return[...t.values()]}function z(e,r){let t;if(r?.drawingInfo?.renderer)if("uniqueValue"===r.drawingInfo.renderer.type&&r.drawingInfo.renderer.uniqueValueInfos.length>0){const{uniqueValueInfos:o}=r.drawingInfo.renderer,i=o.find((r=>r.value===e.attributes.TYPEID.toString()));i&&(t=C(i.symbol))}else"simple"===r.drawingInfo.renderer.type&&(t=C(r.drawingInfo.renderer.symbol));return t}function X(e,r){h("layer",e).isNotMissing(),h("featureLayer",r).isNotMissing(),u(e)?(r.url=T(e.layerId)?`${e.url}/${e.layerId}`:e.url,e.portalItem&&(r.itemId=e.portalItem.id),e.formTemplate&&(r.formInfo=A.fromEsriApiFormTemplate(e.formTemplate))):r.url=e.url,r.layerDefinition=D.fromEsriApiLayer(e,FeatureLayer.esriFeatureLayerDefaults),e.popupTemplate&&(r.popupInfo=G.fromEsriApiPopupTemplate(e.popupTemplate)),isNaN(e.mode)||(r.mode=e.mode)}function U(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:void 0}function q(e){return!(e.source&&e.source.length>0)||e.source.every((r=>r.geometry.type===e.geometryType))}function H(e){const{geometryType:r,graphics:t,layerDefinition:o,layer:i,includeAllFields:a}=e,s=i?._fields?.map((e=>I.fromEsriApiField(e)))??[],n=new Set(a?s:[]),l={featureSet:{features:[],geometryType:r},layerDefinition:{geometryType:r,fields:[],...o}};for(const e of t){const[r,t]=L(e)?[e,void 0]:[e.graphic,e.attributes];if(t){r.attributes||(r.attributes={});for(const[e,o]of Object.entries(t))r.attributes[e]=o}const o=E.fromEsriApiGraphic(r);for(const[e,t]of Object.entries(r.attributes??{})){let r=s.find((r=>b(r.name,e)));r?n.add(r):(r={name:e,alias:e,editable:!0,nullable:!0},"number"==typeof t?r.type="esriFieldTypeDouble":t instanceof Date?r.type="esriFieldTypeDate":r.type="esriFieldTypeString",s.push(r),n.add(r))}l.featureSet.features.push(o)}return l.layerDefinition.fields=[...n],l.layerDefinition.objectIdField=l.layerDefinition.fields.find((e=>"esriFieldTypeOID"===e.type))?.name,l}!function(e){e[e.MODE_SNAPSHOT=0]="MODE_SNAPSHOT",e[e.MODE_ONDEMAND=1]="MODE_ONDEMAND",e[e.MODE_SELECTION=2]="MODE_SELECTION",e[e.MODE_AUTO=6]="MODE_AUTO"}(FeatureLayerMode||(FeatureLayerMode={}));const W="__gcxGlobalId";export function fromRouteLayerGraphic(e,r){let t;switch(r){case"barrier-area":t=n.fromGraphic(e);break;case"barrier-line":t=l.fromGraphic(e);break;case"barrier-point":t=s.fromGraphic(e);break;case"direction-line":t=i.fromGraphic(e);break;case"direction-point":t=a.fromGraphic(e);break;case"route-info":t=p.fromGraphic(e);break;case"stop":t=y.fromGraphic(e)}return t[W]=e.getAttribute("globalid"),t}export function toRouteLayerGraphic(e){const r=e.toGraphic();return e[W]&&r.setAttribute("globalid",e[W]),r}
@@ -1 +1 @@
1
- import{isLayerExtension as e}from"../../ItemType.js";import{toFeature as t}from"../../data/Feature.js";import*as r from"../../utilities/asyncIterable.js";import{isPoint as i}from"../../utilities/esri.js";import{isBuildingComponentSublayer as s}from"../../utilities/layers.js";import{IdentifyProviderBase as n}from"./IdentifyProviderBase.js";export class HitTestIdentifyProvider extends n{isSupported(e,t,r){return"point"===t?.type||!this._supportsQuery(e)}_identify(i,s,n){const a=this,u={...n};return async function*(){const n=await o(i,s),y=e(i)?i.layer:i.sublayer;if(n?.length){const e="point-cloud"===y.type?void 0:y.objectIdField;if(a.queryProvider&&a._supportsQuery(i)&&e&&(l=n[0],!i.featureSettings.outFields.every((e=>l.attributes.hasOwnProperty(e))))){const t="string"===y.fields?.find((t=>t.name===e))?.type,r=n.map((r=>`${e} = ${t?`'${r.getAttribute(e)}'`:r.getAttribute(e)}`)).join(" OR ");yield*a.queryProvider.query(i,r,u)}else yield*n.map((e=>t(e,{source:i})))}else yield*r.empty();var l}()}async _count(e,t,r){const i=await o(e,t);return{source:e,count:i?i.length:0}}_supportsQuery(e){return!0}async _applyTolerance(e){return e}}async function o(e,t){const r=s(e.sublayer),n=r?e.layerExtension?.mapExtension:e.mapExtension,o=r?e.sublayer:e.layer,u=e._layerView.view;if("map"===n.viewMode||!u)return;const y=await u.hitTest(u.toScreen(i(t)?t:t.extent.center));let l=y?y.results.sort(a).map((e=>e.graphic)).filter((e=>(e.sourceLayer??e.layer)===o)):void 0;const p=r?e.sublayer.objectIdField:e.layer.objectIdField;if(l&&p){const e=new Set(l.map((e=>e.getAttribute(p))));l=[...e].map((e=>l.find((t=>t.getAttribute(p)===e))))}return l}function a(e,t){return e.distance<=t.distance?-1:1}
1
+ import{isLayerExtension as e}from"../../ItemType.js";import{toFeature as t}from"../../data/Feature.js";import*as r from"../../utilities/asyncIterable.js";import{isPoint as i}from"../../utilities/esri.js";import{isBuildingComponentSublayer as s}from"../../utilities/layers.js";import{caseInsensitiveEquals as n}from"../../utilities/string.js";import{IdentifyProviderBase as o}from"./IdentifyProviderBase.js";export class HitTestIdentifyProvider extends o{isSupported(e,t,r){return"point"===t?.type||!this._supportsQuery(e)}_identify(i,s,o){const u=this,y={...o};return async function*(){const o=await a(i,s),l=e(i)?i.layer:i.sublayer;if(o?.length){const e="point-cloud"===l.type?void 0:l.objectIdField;if(u.queryProvider&&u._supportsQuery(i)&&e&&(p=o[0],!i.featureSettings.outFields.every((e=>p.attributes.hasOwnProperty(e))))){const t="string"===l.fields?.find((t=>n(t.name,e)))?.type,r=o.map((r=>`${e} = ${t?`'${r.getAttribute(e)}'`:r.getAttribute(e)}`)).join(" OR ");yield*u.queryProvider.query(i,r,y)}else yield*o.map((e=>t(e,{source:i})))}else yield*r.empty();var p}()}async _count(e,t,r){const i=await a(e,t);return{source:e,count:i?i.length:0}}_supportsQuery(e){return!0}async _applyTolerance(e){return e}}async function a(e,t){const r=s(e.sublayer),n=r?e.layerExtension?.mapExtension:e.mapExtension,o=r?e.sublayer:e.layer,a=e._layerView.view;if("map"===n.viewMode||!a)return;const y=await a.hitTest(a.toScreen(i(t)?t:t.extent.center));let l=y?y.results.sort(u).map((e=>e.graphic)).filter((e=>(e.sourceLayer??e.layer)===o)):void 0;const p=r?e.sublayer.objectIdField:e.layer.objectIdField;if(l&&p){const e=new Set(l.map((e=>e.getAttribute(p))));l=[...e].map((e=>l.find((t=>t.getAttribute(p)===e))))}return l}function u(e,t){return e.distance<=t.distance?-1:1}
@@ -1 +1 @@
1
- import{DateFormat as e}from"../../utilities/date.js";import{isCodedValueDomain as t}from"../../utilities/esri.js";import{format as r,NumberFormat as i}from"../../utilities/number.js";export function getSearchableValue(s,a){const o=Array.from(s.attributes.keys()).find((e=>e.toLowerCase()===a.name.toLowerCase())),n=s.attributes.get(o);if(null==n)return"";if(t(s.type?.domains?.[o])||t(a.domain))return s.presentableAttributes.get(o);switch(a.type){case"integer":case"small-integer":case"double":case"single":case"oid":return[s.presentableAttributes.get(o),s.format(`{${o}:#.####################}`),s.format(`{${o}:#,#.####################}`),r(i.ROUND_TRIP,n)].join("\t");case"date":return[s.presentableAttributes.get(o),s.format(`{${o}:${e.FULL}}`),s.format(`{${o}:${e.DATE_SHORT}}`)].join("\t");default:return s.presentableAttributes.get(o)}}
1
+ import{DateFormat as t}from"../../utilities/date.js";import{isCodedValueDomain as e}from"../../utilities/esri.js";import{format as r,NumberFormat as i}from"../../utilities/number.js";import{caseInsensitiveEquals as s}from"../../utilities/string.js";export function getSearchableValue(a,n){const o=Array.from(a.attributes.keys()).find((t=>s(t,n.name))),u=a.attributes.get(o);if(null==u)return"";if(e(a.type?.domains?.[o])||e(n.domain))return a.presentableAttributes.get(o);switch(n.type){case"integer":case"small-integer":case"double":case"single":case"oid":return[a.presentableAttributes.get(o),a.format(`{${o}:#.####################}`),a.format(`{${o}:#,#.####################}`),r(i.ROUND_TRIP,u)].join("\t");case"date":return[a.presentableAttributes.get(o),a.format(`{${o}:${t.FULL}}`),a.format(`{${o}:${t.DATE_SHORT}}`)].join("\t");default:return a.presentableAttributes.get(o)}}
@@ -1 +1 @@
1
- import{settings as t}from"./FormatSettings.js";import{checkArg as e}from"./checkArg.js";import{DateFormatter as r,isValidTimeZone as n,ERR_TIME_ZONE_INVALID as o}from"./date.js";import{NumberFormatter as a}from"./number.js";export{settings}from"./FormatSettings.js";export function caseInsensitiveCompare(t,e){return null==t&&null==e?0:t?.localeCompare(e,void 0,{sensitivity:"accent"})??1}export function caseInsensitiveEquals(t,e){return 0===caseInsensitiveCompare(t,e)}export function escapeRegExp(t){return t?t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):t}export function camelToKebabCase(t){return t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))}export function kebabToCamelCase(t){return t.replace(/-[a-z]/g,(t=>t[1].toUpperCase()))}export function format(t,...e){return i.format(t,...e)}export class StringFormatter{constructor(){this._numberFormatter=new a,this._dateFormatter=new r}get numberFormat(){return this._numberFormat}set numberFormat(t){this._numberFormat=t}get dateFormat(){return this._dateFormat}set dateFormat(t){this._dateFormat=t}get currency(){return this._currency}set currency(t){this._currency=t}get fractionalDigits(){return this._fractionalDigits}set fractionalDigits(t){this._fractionalDigits=t}get timeZone(){return this._timeZone}set timeZone(t){e("timezone",t).satisfies((t=>n(t)),o(t)),this._timeZone=t}format(t,...r){const n="string"==typeof t?{format:t}:t;e("options",n).isNotMissing();let{format:o}=n;e("format",o).isNotMissing(),o=o.replace(m,c);return o.replace(s,((t,o,a)=>{const i=parseInt(o);let s,m;try{e(`token ${o}`,o).isInRange(0,r.length-1),s=r[i]}catch(t){const e=parseInt(o,10);if(isNaN(e)||e<0)throw t;console.warn(`Error encountered while formatting string: ${t.toString()}`)}if("number"==typeof s){const t={locale:n.locale,format:a||n.numberFormat||this.numberFormat,currency:n.currency||this.currency,fractionalDigits:n.fractionalDigits??this.fractionalDigits};m=this._numberFormatter.format(t,s)}else if(s instanceof Date){const t={locale:n.locale,format:a||n.dateFormat||this.dateFormat,timeZone:n.timeZone||this.timeZone};m=this._dateFormatter.format(t,s)}else m=null==s?"":String(s);return m})).replace(u,"{").replace("}}","}")}}const i=new class extends StringFormatter{get numberFormat(){return t.numberFormat}set numberFormat(e){t.numberFormat=e}get dateFormat(){return t.dateFormat}set dateFormat(e){t.dateFormat=e}get timeZone(){return t.timeZone}set timeZone(e){t.timeZone=e}get currency(){return t.currency}set currency(e){t.currency=e}get fractionalDigits(){return t.fractionalDigits}set fractionalDigits(e){t.fractionalDigits=e}},s=/\{([-\d]+)(?::([^}]*))?\}/g,m=/{{/g,c="\0MAGIC\0",u=new RegExp(c,"g");
1
+ import{settings as t}from"./FormatSettings.js";import{checkArg as e}from"./checkArg.js";import{DateFormatter as r,isValidTimeZone as n,ERR_TIME_ZONE_INVALID as o}from"./date.js";import{NumberFormatter as a}from"./number.js";export{settings}from"./FormatSettings.js";export function caseInsensitiveCompare(t,e){return null==t&&null==e?0:t?.localeCompare(e,void 0,{sensitivity:"accent"})??1}export function caseInsensitiveEquals(t,e){return t?.toLowerCase()===e?.toLowerCase()}export function escapeRegExp(t){return t?t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):t}export function camelToKebabCase(t){return t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))}export function kebabToCamelCase(t){return t.replace(/-[a-z]/g,(t=>t[1].toUpperCase()))}export function format(t,...e){return i.format(t,...e)}export class StringFormatter{constructor(){this._numberFormatter=new a,this._dateFormatter=new r}get numberFormat(){return this._numberFormat}set numberFormat(t){this._numberFormat=t}get dateFormat(){return this._dateFormat}set dateFormat(t){this._dateFormat=t}get currency(){return this._currency}set currency(t){this._currency=t}get fractionalDigits(){return this._fractionalDigits}set fractionalDigits(t){this._fractionalDigits=t}get timeZone(){return this._timeZone}set timeZone(t){e("timezone",t).satisfies((t=>n(t)),o(t)),this._timeZone=t}format(t,...r){const n="string"==typeof t?{format:t}:t;e("options",n).isNotMissing();let{format:o}=n;e("format",o).isNotMissing(),o=o.replace(m,c);return o.replace(s,((t,o,a)=>{const i=parseInt(o);let s,m;try{e(`token ${o}`,o).isInRange(0,r.length-1),s=r[i]}catch(t){const e=parseInt(o,10);if(isNaN(e)||e<0)throw t;console.warn(`Error encountered while formatting string: ${t.toString()}`)}if("number"==typeof s){const t={locale:n.locale,format:a||n.numberFormat||this.numberFormat,currency:n.currency||this.currency,fractionalDigits:n.fractionalDigits??this.fractionalDigits};m=this._numberFormatter.format(t,s)}else if(s instanceof Date){const t={locale:n.locale,format:a||n.dateFormat||this.dateFormat,timeZone:n.timeZone||this.timeZone};m=this._dateFormatter.format(t,s)}else m=null==s?"":String(s);return m})).replace(u,"{").replace("}}","}")}}const i=new class extends StringFormatter{get numberFormat(){return t.numberFormat}set numberFormat(e){t.numberFormat=e}get dateFormat(){return t.dateFormat}set dateFormat(e){t.dateFormat=e}get timeZone(){return t.timeZone}set timeZone(e){t.timeZone=e}get currency(){return t.currency}set currency(e){t.currency=e}get fractionalDigits(){return t.fractionalDigits}set fractionalDigits(e){t.fractionalDigits=e}},s=/\{([-\d]+)(?::([^}]*))?\}/g,m=/{{/g,c="\0MAGIC\0",u=new RegExp(c,"g");
package/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * The current version of the Geocortex ArcGIS Extensions API.
3
3
  */
4
- export declare const version = "41.0.0";
4
+ export declare const version = "41.1.0";
package/version.js CHANGED
@@ -1 +1 @@
1
- export const version="41.0.0";
1
+ export const version="41.1.0";