@arcgis/core 4.28.0-rc.3 → 4.28.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.
Files changed (62) hide show
  1. package/arcade/ArcadeDate.js +1 -1
  2. package/arcade/functions/featuresetbase.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/1da721608993783dc9cf.js +1 -0
  5. package/assets/esri/core/workers/chunks/{78e2fa121760383b08ec.js → 3dcb2a82e1e4b520c9c9.js} +2 -2
  6. package/assets/esri/core/workers/chunks/{969a82b674eda9f8720f.js → 6bc1f6f8a2408fa4bb6a.js} +1 -1
  7. package/assets/esri/core/workers/chunks/78e49a70193e5adea17c.js +1 -0
  8. package/assets/esri/core/workers/chunks/830d99e6c58a52a58973.js +1 -0
  9. package/assets/esri/core/workers/chunks/8f7997e8e6ee9e56239f.js +1 -0
  10. package/assets/esri/core/workers/chunks/{a4341ec0fe89b865d849.js → a160576f21ada91995ac.js} +1 -1
  11. package/assets/esri/core/workers/chunks/b6bd31674076e543d8b2.js +1 -0
  12. package/assets/esri/core/workers/chunks/{562eafa5090827ebb7ec.js → c87e9280681c20d042b5.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{2c560a075d9ef2069ed1.js → ed97761ac077a96aeb29.js} +1 -1
  14. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +6 -4
  15. package/assets/esri/themes/base/widgets/_Features.scss +5 -0
  16. package/assets/esri/themes/base/widgets/_Popup.scss +0 -1
  17. package/assets/esri/themes/dark/main.css +1 -1
  18. package/assets/esri/themes/light/main.css +1 -1
  19. package/assets/esri/themes/light/view.css +1 -1
  20. package/interfaces.d.ts +252 -52
  21. package/intl/date.js +1 -1
  22. package/kernel.js +1 -1
  23. package/layers/FeatureLayer.js +1 -1
  24. package/layers/OrientedImageryLayer.js +1 -1
  25. package/layers/graphics/data/QueryEngineResult.js +1 -1
  26. package/layers/support/LayerContingentValuesCache.js +1 -1
  27. package/package.json +1 -1
  28. package/smartMapping/support/utils.js +1 -1
  29. package/statistics/utils.js +1 -1
  30. package/support/basemapUtils.js +1 -1
  31. package/support/revision.js +1 -1
  32. package/views/2d/engine/Container.js +1 -1
  33. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  34. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  35. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  36. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  37. package/views/3d/webgl-engine/core/FBOPool.js +1 -1
  38. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -2
  39. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  40. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  41. package/views/draw/DrawOperation.js +1 -1
  42. package/views/interactive/sketch/constraints.js +1 -1
  43. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  44. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  45. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  46. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  47. package/webdoc/support/writeUtils.js +1 -1
  48. package/widgets/Editor/EditorViewModel.js +1 -1
  49. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  50. package/widgets/Editor/VisibleElements.js +1 -1
  51. package/widgets/Editor/workflowUtils.js +1 -1
  52. package/widgets/Editor.js +1 -1
  53. package/widgets/FeatureForm/FieldInput.js +1 -1
  54. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  55. package/widgets/FeatureForm.js +1 -1
  56. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.d.ts +4 -0
  57. package/widgets/support/dateUtils.js +1 -1
  58. package/assets/esri/core/workers/chunks/7648f3341b7dff2825c3.js +0 -1
  59. package/assets/esri/core/workers/chunks/9c77d69a13ec22cdd760.js +0 -1
  60. package/assets/esri/core/workers/chunks/a821fa1870b83fed5d31.js +0 -1
  61. package/assets/esri/core/workers/chunks/c416df0668f6c596095f.js +0 -1
  62. package/assets/esri/core/workers/chunks/f0d342303fc20e266d27.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import{read as t}from"../renderers/support/jsonUtils.js";import{rendererTypes as i,webSceneRendererTypes as o}from"../renderers/support/types.js";import s from"../request.js";import{symbolTypes as a}from"../symbols.js";import{ClonableMixin as n}from"../core/Clonable.js";import l from"../core/Collection.js";import p from"../core/Error.js";import{clone as u}from"../core/lang.js";import d from"../core/Logger.js";import{MultiOriginJSONMixin as y}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../core/object.js";import{debounce as m,throwIfAbortError as f,whenOrAbort as h}from"../core/promiseUtils.js";import{sqlAnd as b}from"../core/sql.js";import{urlToObject as g,join as w}from"../core/urlUtils.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import{reader as S}from"../core/accessorSupport/decorators/reader.js";import{subclass as F}from"../core/accessorSupport/decorators/subclass.js";import{writer as T}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as I}from"../core/accessorSupport/layerContainerType.js";import E from"../form/FormTemplate.js";import D from"../geometry/SpatialReference.js";import L from"./Layer.js";import{MemorySource as _}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as x}from"./mixins/APIKeyMixin.js";import{ArcGISService as P}from"./mixins/ArcGISService.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{CustomParametersMixin as q}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as C}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as O}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as R}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as A}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as U}from"./mixins/OperationalLayer.js";import{OrderedLayer as V}from"./mixins/OrderedLayer.js";import{PortalLayer as Q}from"./mixins/PortalLayer.js";import{PublishableLayer as N}from"./mixins/PublishableLayer.js";import{RefreshableLayer as $}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as G}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as J}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as W,parse as B,cleanTitle as Z}from"./support/arcgisLayerUrl.js";import{id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as re,computeEffectiveEditingEnabled as te,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,queryAttachments as ce,queryObjectIds as me,queryFeatureCount as fe,queryExtent as he,queryRelatedFeatures as be,queryRelatedFeaturesCount as ge,hasDataChanged as we,geometryTypeKebabDict as ve}from"./support/featureLayerUtils.js";import je from"./support/FeatureTemplate.js";import Se from"./support/FeatureType.js";import{defineFieldProperties as Fe}from"./support/fieldProperties.js";import{fixRendererFields as Te,fixTimeInfoFields as Ie}from"./support/fieldUtils.js";import Ee from"./support/LabelClass.js";import{reader as De}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Le}from"./support/serviceCapabilitiesUtils.js";import _e from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as xe}from"./support/versionUtils.js";import{DataLayerSource as Pe}from"./support/source/DataLayerSource.js";import{loadStyleRenderer as Me}from"../renderers/support/styleUtils.js";import qe from"../rest/support/FeatureSet.js";import Ce from"../rest/support/Query.js";import Oe from"../rest/support/TopFeaturesQuery.js";import{createPopupTemplate as Re}from"../support/popupUtils.js";import{SaveOperationType as Ae}from"../webdoc/interfaces.js";import{opacityToTransparency as Ue}from"../webdoc/support/opacityUtils.js";const Ve="FeatureLayer",Qe="esri.layers.FeatureLayer",Ne=d.getLogger(Qe);function $e(e,r){return new p("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}function Ge(e){return e&&e instanceof l}const Je=Fe();function We(e,r,t){const i=!!t?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Be=class extends(R(A(O(N(C(M(V(J(G($(P(U(Q(y(q(x(n(L)))))))))))))))))){constructor(...e){super(...e),this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=D.WGS84,this.subtypeCode=null,this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=m((async(e,r,t)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Ae.SAVE:return i(this,r);case Ae.SAVE_AS:return o(this,t,r)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(r).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const t=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(f).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstLayerId(r);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new p("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(r))})).then((()=>re(this,"load",e)));return this.addResolvingPromise(t),Promise.resolve(this)}readCapabilities(e,r){return r=r.layerDefinition||r,Le(r,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,r){return this._readEditingEnabled(r,!1)}readEditingEnabledFromWebMap(e,r,t){return this._readEditingEnabled(r,!0,t)}writeEditingEnabled(e,r){this._writeEditingEnabled(e,r,!1)}writeEditingEnabledToWebMap(e,r,t,i){this._writeEditingEnabled(e,r,!0,i)}get effectiveEditingEnabled(){return te(this)}readIsTable(e,r){return"Table"===(r=r?.layerDefinition??r).type||!r.geometryType}writeIsTable(e,r,t,i){i?.writeLayerSchema&&c(t,e?"Table":"Feature Layer",r)}readGlobalIdField(e,r){return ie(r.layerDefinition||r)}readObjectIdField(e,r){return oe(r.layerDefinition||r)}get parsedUrl(){const e=g(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=w(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=w(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Te(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,r,i){r=r.layerDefinition||r;const o=r.drawingInfo?.renderer;if(o){const e=t(o,r,i)??void 0;return e||Ne.error("Failed to create renderer",{rendererDefinition:r.drawingInfo.renderer,layer:this,context:i}),e}return se(r,i)}set source(e){const r=this._get("source");r!==e&&(Ge(r)&&this._resetMemorySource(r),Ge(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof l?new _({layer:this,items:e}):e:null}readSource(e,r){const t=qe.fromJSON(r.featureSet);return new _({layer:this,items:t?.features??[]})}readTemplates(e,r){const t=r.editFieldsInfo,i=t?.creatorField,o=t?.editorField;return e=e?.map((e=>je.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,r){const t=r.layerDefinition?.name??r.name,i=r.title||r.layerDefinition?.title;if(t){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?W(this.url,t):t;let r=t;if(!r&&this.url){const e=B(this.url);null!=e&&(r=e.title)}if(!r)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==r&&(r=e+" - "+r),Z(r)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,r){return r.title||r.layerDefinition?.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return t}readTypes(e,r){e=(r=r.layerDefinition||r).types;const t=r.editFieldsInfo,i=t?.creatorField,o=t?.editorField;return e?.map((e=>(e=Se.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,r){return null!=r.layerDefinition?.defaultVisibility?!!r.layerDefinition.defaultVisibility:null!=r.visibility?!!r.visibility:void 0}async addAttachment(e,r){return ae(this,e,r,Ve)}async updateAttachment(e,r,t){return ne(this,e,r,t,Ve)}async applyEdits(e,r){return le(this,e,r)}async uploadAssets(e,r){return pe(this,e,r)}on(e,r){return super.on(e,r)}createPopupTemplate(e){return Re(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:r}=await h(import("./graphics/sources/FeatureLayerSource.js"),e);return new r({layer:this}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const r=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,t=b(this.definitionExpression,r);return e.where=t||"1=1",e}async deleteAttachments(e,r){return de(this,e,r,Ve)}async fetchRecomputedExtents(e){return ye(this,e,Ve)}getFeatureType(e){const{typeIdField:r,types:t}=this;if(!r||!e)return null;const i=e.attributes?e.attributes[r]:void 0;if(null==i)return null;let o=null;return t?.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}async queryAttachments(e,r){return ce(this,e,r,Ve)}async queryFeatures(e,r){const t=await this.load(),i=await t.source.queryFeatures(Ce.from(e)??t.createQuery(),r);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=t;return i}async queryObjectIds(e,r){return me(this,e,r,Ve)}async queryFeatureCount(e,r){return fe(this,e,r,Ve)}async queryExtent(e,r){return he(this,e,r,Ve)}async queryRelatedFeatures(e,r){return be(this,e,r,Ve)}async queryRelatedFeaturesCount(e,r){return ge(this,e,r,Ve)}async queryTopFeatures(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new p(Ve,"Layer source does not support queryTopFeatures capability");const o=await t.queryTopFeatures(Oe.from(e),r);if(o?.features)for(const s of o.features)s.layer=s.sourceLayer=this;return o}async queryTopObjectIds(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new p(Ve,"Layer source does not support queryTopObjectIds capability");return t.queryTopObjectIds(Oe.from(e),r)}async queryTopFeaturesExtent(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new p(Ve,"Layer source does not support queryTopExtents capability");return t.queryTopExtents(Oe.from(e),r)}async queryTopFeatureCount(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new p(Ve,"Layer source does not support queryFeatureCount capability");return t.queryTopCount(Oe.from(e),r)}read(e,r){const t=e.featureCollection;if(t){const e=t.layers;e&&1===e.length&&(super.read(e[0],r),null!=t.showLegend&&super.read({showLegend:t.showLegend},r))}super.read(e,r),r&&"service"===r.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,r){r={...r,origin:r?.origin??void 0,writeLayerSchema:r?.writeLayerSchema??this._hasMemorySource()};const{origin:t,layerContainerType:i,messages:o}=r;if(this.dynamicDataSource)return o?.push($e(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===t||"web-scene"===t)&&"tables"!==i)return o?.push($e(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push($e(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===t||"web-scene"===t)&&"tables"===i)return o?.push($e(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,r)}clone(){if(this._hasMemorySource())throw new p(Ve,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||xe(this,e))}async save(e){return this._debouncedSaveOperations(Ae.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(Ae.SAVE_AS,r,e)}_readEditingEnabled(e,r,t){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,r&&"web-map"===t?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,r,t,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";c("layerDefinition.capabilities",e,r),t&&!i?.writeLayerSchema&&(r.capabilities=e)}}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}_fetchFirstLayerId(e){return s(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const r=e.data;if(r)return Array.isArray(r.layers)&&r.layers.length>0?r.layers[0].id:Array.isArray(r.tables)&&r.tables.length>0?r.tables[0].id:void 0}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Te(this.renderer,this.fieldsIndex),Ie(this.timeInfo,this.fieldsIndex),Me(this,{origin:"service"})}async hasDataChanged(){return we(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,r){e&&e.forEach((e=>{const t=e.prototype?.attributes;t&&r&&delete t[r]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new p("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new p("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}};e([S("service","capabilities")],Be.prototype,"readCapabilities",null),e([v({json:{origins:{"web-scene":{write:!1}},write:!0}})],Be.prototype,"charts",void 0),e([v({readOnly:!0})],Be.prototype,"createQueryVersion",null),e([v({json:{read:{source:"layerDefinition.copyrightText"}}})],Be.prototype,"copyright",void 0),e([v({json:{read:{source:"layerDefinition.displayField"}}})],Be.prototype,"displayField",void 0),e([v({types:a,readOnly:!0})],Be.prototype,"defaultSymbol",void 0),e([v({type:Pe})],Be.prototype,"dynamicDataSource",void 0),e([v({type:Boolean})],Be.prototype,"editingEnabled",null),e([S(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Be.prototype,"readEditingEnabled",null),e([S("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Be.prototype,"readEditingEnabledFromWebMap",null),e([T(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Be.prototype,"writeEditingEnabled",null),e([T("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Be.prototype,"writeEditingEnabledToWebMap",null),e([v({readOnly:!0})],Be.prototype,"effectiveEditingEnabled",null),e([v({...Je.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:We}}}}})],Be.prototype,"fields",void 0),e([v(Je.fieldsIndex)],Be.prototype,"fieldsIndex",void 0),e([v({type:E,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Be.prototype,"formTemplate",void 0),e([v({json:{read:{source:"layerDefinition.extent"}}})],Be.prototype,"fullExtent",void 0),e([v({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:We,writer(e,r,t){const i=e?ve.toJSON(e):null;i&&c(t,i,r)}}}},read:{source:"layerDefinition.geometryType",reader:ve.read}}})],Be.prototype,"geometryType",void 0),e([v({json:{read:{source:"layerDefinition.hasM"}}})],Be.prototype,"hasM",void 0),e([v({json:{read:{source:"layerDefinition.hasZ"}}})],Be.prototype,"hasZ",void 0),e([v(H)],Be.prototype,"id",void 0),e([v({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Be.prototype,"infoFor3D",void 0),e([v({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Be.prototype,"isTable",void 0),e([S("service","isTable",["type","geometryType"]),S("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Be.prototype,"readIsTable",null),e([T("web-map","isTable")],Be.prototype,"writeIsTable",null),e([v(k)],Be.prototype,"labelsVisible",void 0),e([v({type:[Ee],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:De,write:!1},"web-scene":{name:"layerDefinition.drawingInfo.labelingInfo",read:De,write:{enabled:!0,layerContainerTypes:I}}},name:"layerDefinition.drawingInfo.labelingInfo",read:De,write:!0}})],Be.prototype,"labelingInfo",void 0),e([v((()=>{const e=u(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,r,t){c(t,Ue(e),r)}}},e})())],Be.prototype,"opacity",void 0),e([v(K)],Be.prototype,"legendEnabled",void 0),e([v({type:["show","hide"],json:(()=>{const e=u(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Be.prototype,"listMode",void 0),e([S("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Be.prototype,"readGlobalIdField",null),e([v({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:We}}}}})],Be.prototype,"objectIdField",void 0),e([S("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Be.prototype,"readObjectIdField",null),e([v({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],Be.prototype,"operationalLayerType",void 0),e([v(Je.outFields)],Be.prototype,"outFields",void 0),e([v({readOnly:!0})],Be.prototype,"parsedUrl",null),e([v({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Be.prototype,"path",void 0),e([v(Y)],Be.prototype,"popupEnabled",void 0),e([v({type:r,json:{name:"popupInfo",write:!0}})],Be.prototype,"popupTemplate",void 0),e([v({readOnly:!0})],Be.prototype,"defaultPopupTemplate",null),e([v({types:i,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:o,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:I,overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}})],Be.prototype,"renderer",null),e([S("service","renderer",["drawingInfo.renderer","defaultSymbol"]),S("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Be.prototype,"readRenderer",null),e([v((()=>{const e=u(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Be.prototype,"screenSizePerspectiveEnabled",void 0),e([v({clonable:!1})],Be.prototype,"source",null),e([j("source")],Be.prototype,"castSource",null),e([S("portal-item","source",["featureSet"]),S("web-map","source",["featureSet"])],Be.prototype,"readSource",null),e([v({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Be.prototype,"spatialReference",void 0),e([v({type:Number})],Be.prototype,"subtypeCode",void 0),e([v({type:[je]})],Be.prototype,"templates",void 0),e([S("templates",["editFieldsInfo","creatorField","editorField","templates"])],Be.prototype,"readTemplates",null),e([v({type:_e})],Be.prototype,"timeInfo",void 0),e([v()],Be.prototype,"title",void 0),e([S("service","title",["name"]),S("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Be.prototype,"readTitle",null),e([S("web-map","title",["layerDefinition.name","title"])],Be.prototype,"readTitleFromWebMap",null),e([v({type:String})],Be.prototype,"sublayerTitleMode",void 0),e([v({json:{read:!1}})],Be.prototype,"type",void 0),e([v({type:String})],Be.prototype,"typeIdField",void 0),e([S("service","typeIdField"),S("typeIdField",["layerDefinition.typeIdField"])],Be.prototype,"readTypeIdField",null),e([v({type:[Se]})],Be.prototype,"types",void 0),e([S("service","types",["types"]),S("types",["layerDefinition.types"])],Be.prototype,"readTypes",null),e([v({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],Be.prototype,"visible",void 0),e([S("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Be.prototype,"readVisible",null),Be=e([F(Qe)],Be);const Ze=Be;export{Ze as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import{read as t}from"../renderers/support/jsonUtils.js";import{rendererTypes as i,webSceneRendererTypes as o}from"../renderers/support/types.js";import s from"../request.js";import{symbolTypes as a}from"../symbols.js";import{ClonableMixin as n}from"../core/Clonable.js";import l from"../core/Collection.js";import p from"../core/Error.js";import{clone as u}from"../core/lang.js";import d from"../core/Logger.js";import{MultiOriginJSONMixin as y}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../core/object.js";import{debounce as m,throwIfAbortError as f,whenOrAbort as h}from"../core/promiseUtils.js";import{sqlAnd as b}from"../core/sql.js";import{urlToObject as g,join as w}from"../core/urlUtils.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import{reader as S}from"../core/accessorSupport/decorators/reader.js";import{subclass as F}from"../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as T}from"../core/accessorSupport/layerContainerType.js";import E from"../form/FormTemplate.js";import D from"../geometry/SpatialReference.js";import L from"./Layer.js";import{MemorySource as _}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as x}from"./mixins/APIKeyMixin.js";import{ArcGISService as P}from"./mixins/ArcGISService.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{CustomParametersMixin as q}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as C}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as O}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as R}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as A}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as V}from"./mixins/OperationalLayer.js";import{OrderedLayer as U}from"./mixins/OrderedLayer.js";import{PortalLayer as Q}from"./mixins/PortalLayer.js";import{PublishableLayer as N}from"./mixins/PublishableLayer.js";import{RefreshableLayer as $}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as G}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as J}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as W,parse as B,cleanTitle as Z}from"./support/arcgisLayerUrl.js";import{id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as re,computeEffectiveEditingEnabled as te,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,queryAttachments as ce,queryObjectIds as me,queryFeatureCount as fe,queryExtent as he,queryRelatedFeatures as be,queryRelatedFeaturesCount as ge,hasDataChanged as we,geometryTypeKebabDict as ve}from"./support/featureLayerUtils.js";import je from"./support/FeatureTemplate.js";import Se from"./support/FeatureType.js";import{defineFieldProperties as Fe}from"./support/fieldProperties.js";import{fixRendererFields as Ie,fixTimeInfoFields as Te}from"./support/fieldUtils.js";import Ee from"./support/LabelClass.js";import{reader as De}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Le}from"./support/serviceCapabilitiesUtils.js";import _e from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as xe}from"./support/versionUtils.js";import{DataLayerSource as Pe}from"./support/source/DataLayerSource.js";import{loadStyleRenderer as Me}from"../renderers/support/styleUtils.js";import qe from"../rest/support/FeatureSet.js";import Ce from"../rest/support/Query.js";import Oe from"../rest/support/TopFeaturesQuery.js";import{createPopupTemplate as Re}from"../support/popupUtils.js";import{SaveOperationType as Ae}from"../webdoc/interfaces.js";import{opacityToTransparency as Ve}from"../webdoc/support/opacityUtils.js";const Ue="FeatureLayer",Qe="esri.layers.FeatureLayer",Ne=d.getLogger(Qe);function $e(e,r){return new p("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}function Ge(e){return e&&e instanceof l}const Je=Fe();function We(e,r,t){const i=!!t?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Be=class extends(R(A(O(N(C(M(U(J(G($(P(V(Q(y(q(x(n(L)))))))))))))))))){constructor(...e){super(...e),this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=D.WGS84,this.subtypeCode=null,this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=m((async(e,r,t)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Ae.SAVE:return i(this,r);case Ae.SAVE_AS:return o(this,t,r)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(r).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const t=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(f).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(r);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new p("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(r))})).then((()=>re(this,"load",e)));return this.addResolvingPromise(t),Promise.resolve(this)}readCapabilities(e,r){return r=r.layerDefinition||r,Le(r,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,r){return this._readEditingEnabled(r,!1)}readEditingEnabledFromWebMap(e,r,t){return this._readEditingEnabled(r,!0,t)}writeEditingEnabled(e,r){this._writeEditingEnabled(e,r,!1)}writeEditingEnabledToWebMap(e,r,t,i){this._writeEditingEnabled(e,r,!0,i)}get effectiveEditingEnabled(){return te(this)}readIsTable(e,r){return"Table"===(r=r?.layerDefinition??r).type||!r.geometryType}writeIsTable(e,r,t,i){i?.writeLayerSchema&&c(t,e?"Table":"Feature Layer",r)}readGlobalIdField(e,r){return ie(r.layerDefinition||r)}readObjectIdField(e,r){return oe(r.layerDefinition||r)}get parsedUrl(){const e=g(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=w(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=w(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Ie(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,r,i){r=r.layerDefinition||r;const o=r.drawingInfo?.renderer;if(o){const e=t(o,r,i)??void 0;return e||Ne.error("Failed to create renderer",{rendererDefinition:r.drawingInfo.renderer,layer:this,context:i}),e}return se(r,i)}set source(e){const r=this._get("source");r!==e&&(Ge(r)&&this._resetMemorySource(r),Ge(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof l?new _({layer:this,items:e}):e:null}readSource(e,r){const t=qe.fromJSON(r.featureSet);return new _({layer:this,items:t?.features??[]})}readTemplates(e,r){const t=r.editFieldsInfo,i=t?.creatorField,o=t?.editorField;return e=e?.map((e=>je.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,r){const t=r.layerDefinition?.name??r.name,i=r.title||r.layerDefinition?.title;if(t){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?W(this.url,t):t;let r=t;if(!r&&this.url){const e=B(this.url);null!=e&&(r=e.title)}if(!r)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==r&&(r=e+" - "+r),Z(r)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,r){return r.title||r.layerDefinition?.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return t}readTypes(e,r){e=(r=r.layerDefinition||r).types;const t=r.editFieldsInfo,i=t?.creatorField,o=t?.editorField;return e?.map((e=>(e=Se.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,r){return null!=r.layerDefinition?.defaultVisibility?!!r.layerDefinition.defaultVisibility:null!=r.visibility?!!r.visibility:void 0}async addAttachment(e,r){return ae(this,e,r,Ue)}async updateAttachment(e,r,t){return ne(this,e,r,t,Ue)}async applyEdits(e,r){return le(this,e,r)}async uploadAssets(e,r){return pe(this,e,r)}on(e,r){return super.on(e,r)}createPopupTemplate(e){return Re(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:r}=await h(import("./graphics/sources/FeatureLayerSource.js"),e);return new r({layer:this}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const r=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,t=b(this.definitionExpression,r);return e.where=t||"1=1",e}async deleteAttachments(e,r){return de(this,e,r,Ue)}async fetchRecomputedExtents(e){return ye(this,e,Ue)}getFeatureType(e){const{typeIdField:r,types:t}=this;if(!r||!e)return null;const i=e.attributes?e.attributes[r]:void 0;if(null==i)return null;let o=null;return t?.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}async queryAttachments(e,r){return ce(this,e,r,Ue)}async queryFeatures(e,r){const t=await this.load(),i=await t.source.queryFeatures(Ce.from(e)??t.createQuery(),r);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=t;return i}async queryObjectIds(e,r){return me(this,e,r,Ue)}async queryFeatureCount(e,r){return fe(this,e,r,Ue)}async queryExtent(e,r){return he(this,e,r,Ue)}async queryRelatedFeatures(e,r){return be(this,e,r,Ue)}async queryRelatedFeaturesCount(e,r){return ge(this,e,r,Ue)}async queryTopFeatures(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new p(Ue,"Layer source does not support queryTopFeatures capability");const o=await t.queryTopFeatures(Oe.from(e),r);if(o?.features)for(const s of o.features)s.layer=s.sourceLayer=this;return o}async queryTopObjectIds(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new p(Ue,"Layer source does not support queryTopObjectIds capability");return t.queryTopObjectIds(Oe.from(e),r)}async queryTopFeaturesExtent(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new p(Ue,"Layer source does not support queryTopExtents capability");return t.queryTopExtents(Oe.from(e),r)}async queryTopFeatureCount(e,r){const{source:t,capabilities:i}=await this.load();if(!t.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new p(Ue,"Layer source does not support queryFeatureCount capability");return t.queryTopCount(Oe.from(e),r)}read(e,r){const t=e.featureCollection;if(t){this.resourceInfo=e;const i=t.layers;i&&1===i.length&&(super.read(i[0],r),null!=t.showLegend&&super.read({showLegend:t.showLegend},r))}super.read(e,r),r&&"service"===r.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,r){r={...r,origin:r?.origin??void 0,writeLayerSchema:r?.writeLayerSchema??this._hasMemorySource()};const{origin:t,layerContainerType:i,messages:o}=r;if(this.dynamicDataSource)return o?.push($e(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===t||"web-scene"===t)&&"tables"!==i)return o?.push($e(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push($e(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===t||"web-scene"===t)&&"tables"===i)return o?.push($e(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,r)}clone(){if(this._hasMemorySource())throw new p(Ue,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||xe(this,e))}async save(e){return this._debouncedSaveOperations(Ae.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(Ae.SAVE_AS,r,e)}_readEditingEnabled(e,r,t){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,r&&"web-map"===t?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,r,t,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";c("layerDefinition.capabilities",e,r),t&&!i?.writeLayerSchema&&(r.capabilities=e)}}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}_fetchFirstValidLayerId(e){return s(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const r=e.data;if(r)return this.findFirstValidLayerId(r)}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Ie(this.renderer,this.fieldsIndex),Te(this.timeInfo,this.fieldsIndex),Me(this,{origin:"service"})}async hasDataChanged(){return we(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,r){e&&e.forEach((e=>{const t=e.prototype?.attributes;t&&r&&delete t[r]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new p("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new p("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};e([S("service","capabilities")],Be.prototype,"readCapabilities",null),e([v({json:{origins:{"web-scene":{write:!1}},write:!0}})],Be.prototype,"charts",void 0),e([v({readOnly:!0})],Be.prototype,"createQueryVersion",null),e([v({json:{read:{source:"layerDefinition.copyrightText"}}})],Be.prototype,"copyright",void 0),e([v({json:{read:{source:"layerDefinition.displayField"}}})],Be.prototype,"displayField",void 0),e([v({types:a,readOnly:!0})],Be.prototype,"defaultSymbol",void 0),e([v({type:Pe})],Be.prototype,"dynamicDataSource",void 0),e([v({type:Boolean})],Be.prototype,"editingEnabled",null),e([S(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Be.prototype,"readEditingEnabled",null),e([S("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Be.prototype,"readEditingEnabledFromWebMap",null),e([I(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Be.prototype,"writeEditingEnabled",null),e([I("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Be.prototype,"writeEditingEnabledToWebMap",null),e([v({readOnly:!0})],Be.prototype,"effectiveEditingEnabled",null),e([v({...Je.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:We}}}}})],Be.prototype,"fields",void 0),e([v(Je.fieldsIndex)],Be.prototype,"fieldsIndex",void 0),e([v({type:E,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Be.prototype,"formTemplate",void 0),e([v({json:{read:{source:"layerDefinition.extent"}}})],Be.prototype,"fullExtent",void 0),e([v({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:We,writer(e,r,t){const i=e?ve.toJSON(e):null;i&&c(t,i,r)}}}},read:{source:"layerDefinition.geometryType",reader:ve.read}}})],Be.prototype,"geometryType",void 0),e([v({json:{read:{source:"layerDefinition.hasM"}}})],Be.prototype,"hasM",void 0),e([v({json:{read:{source:"layerDefinition.hasZ"}}})],Be.prototype,"hasZ",void 0),e([v(H)],Be.prototype,"id",void 0),e([v({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Be.prototype,"infoFor3D",void 0),e([v({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Be.prototype,"isTable",void 0),e([S("service","isTable",["type","geometryType"]),S("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Be.prototype,"readIsTable",null),e([I("web-map","isTable")],Be.prototype,"writeIsTable",null),e([v(k)],Be.prototype,"labelsVisible",void 0),e([v({type:[Ee],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:De,write:!1},"web-scene":{name:"layerDefinition.drawingInfo.labelingInfo",read:De,write:{enabled:!0,layerContainerTypes:T}}},name:"layerDefinition.drawingInfo.labelingInfo",read:De,write:!0}})],Be.prototype,"labelingInfo",void 0),e([v((()=>{const e=u(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,r,t){c(t,Ve(e),r)}}},e})())],Be.prototype,"opacity",void 0),e([v(K)],Be.prototype,"legendEnabled",void 0),e([v({type:["show","hide"],json:(()=>{const e=u(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Be.prototype,"listMode",void 0),e([S("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Be.prototype,"readGlobalIdField",null),e([v({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:We}}}}})],Be.prototype,"objectIdField",void 0),e([S("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Be.prototype,"readObjectIdField",null),e([v({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],Be.prototype,"operationalLayerType",void 0),e([v(Je.outFields)],Be.prototype,"outFields",void 0),e([v({readOnly:!0})],Be.prototype,"parsedUrl",null),e([v({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Be.prototype,"path",void 0),e([v(Y)],Be.prototype,"popupEnabled",void 0),e([v({type:r,json:{name:"popupInfo",write:!0}})],Be.prototype,"popupTemplate",void 0),e([v({readOnly:!0})],Be.prototype,"defaultPopupTemplate",null),e([v({types:i,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:o,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:T,overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}})],Be.prototype,"renderer",null),e([S("service","renderer",["drawingInfo.renderer","defaultSymbol"]),S("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Be.prototype,"readRenderer",null),e([v()],Be.prototype,"resourceInfo",void 0),e([v((()=>{const e=u(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Be.prototype,"screenSizePerspectiveEnabled",void 0),e([v({clonable:!1})],Be.prototype,"source",null),e([j("source")],Be.prototype,"castSource",null),e([S("portal-item","source",["featureSet"]),S("web-map","source",["featureSet"])],Be.prototype,"readSource",null),e([v({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Be.prototype,"spatialReference",void 0),e([v({type:Number})],Be.prototype,"subtypeCode",void 0),e([v({type:[je]})],Be.prototype,"templates",void 0),e([S("templates",["editFieldsInfo","creatorField","editorField","templates"])],Be.prototype,"readTemplates",null),e([v({type:_e})],Be.prototype,"timeInfo",void 0),e([v()],Be.prototype,"title",void 0),e([S("service","title",["name"]),S("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Be.prototype,"readTitle",null),e([S("web-map","title",["layerDefinition.name","title"])],Be.prototype,"readTitleFromWebMap",null),e([v({type:String})],Be.prototype,"sublayerTitleMode",void 0),e([v({json:{read:!1}})],Be.prototype,"type",void 0),e([v({type:String})],Be.prototype,"typeIdField",void 0),e([S("service","typeIdField"),S("typeIdField",["layerDefinition.typeIdField"])],Be.prototype,"readTypeIdField",null),e([v({type:[Se]})],Be.prototype,"types",void 0),e([S("service","types",["types"]),S("types",["layerDefinition.types"])],Be.prototype,"readTypes",null),e([v({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],Be.prototype,"visible",void 0),e([S("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Be.prototype,"readVisible",null),Be=e([F(Qe)],Be);const Ze=Be;export{Ze as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{JSONMap as r}from"../core/jsonMap.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{orientedImageryTypeMap as p,timeIntervalUnitTypeMap as s,getEffectiveElevationSource as m}from"./orientedImagery/core/utils.js";function l(e,t,r){return{name:`orientedImageryProperties.${e}`,write:!t||{target:`orientedImageryProperties.${e}`,writer:t},origins:{service:{name:`orientedImageryInfo.orientedImageryProperties.${e}`,write:t,read:r}}}}let y=class extends n{constructor(){super(...arguments),this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.type="oriented-imagery",this.timeIntervalUnit=null,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null}get effectiveElevationSource(){const{elevationSource:e,demPathPrefix:t,demPathSuffix:r}=this;return m(e,t,r)}_verifySource(){if(super._verifySource(),"point"!==this.geometryType)throw new t("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};e([i({type:Number,json:l("cameraHeading")})],y.prototype,"cameraHeading",void 0),e([i({type:Number,json:l("cameraHeight")})],y.prototype,"cameraHeight",void 0),e([i({type:Number,json:l("cameraPitch")})],y.prototype,"cameraPitch",void 0),e([i({type:Number,json:l("cameraRoll")})],y.prototype,"cameraRoll",void 0),e([i({type:Number,json:l("coveragePercent")})],y.prototype,"coveragePercent",void 0),e([i({type:String,json:l("demPathPrefix")})],y.prototype,"demPathPrefix",void 0),e([i({type:String,json:l("demPathSuffix")})],y.prototype,"demPathSuffix",void 0),e([i({type:String,json:l("depthImagePathPrefix")})],y.prototype,"depthImagePathPrefix",void 0),e([i({type:String,json:l("depthImagePathSuffix")})],y.prototype,"depthImagePathSuffix",void 0),e([i({type:Object,json:l("elevationSource")})],y.prototype,"elevationSource",void 0),e([i()],y.prototype,"effectiveElevationSource",null),e([i({type:Number,json:l("farDistance")})],y.prototype,"farDistance",void 0),e([i({json:{write:!0}})],y.prototype,"geometryType",void 0),e([i({type:Number,json:l("horizontalFieldOfView")})],y.prototype,"horizontalFieldOfView",void 0),e([i({type:String,json:l("horizontalMeasurementUnit")})],y.prototype,"horizontalMeasurementUnit",void 0),e([i({type:String,json:l("imagePathPrefix")})],y.prototype,"imagePathPrefix",void 0),e([i({type:String,json:l("imagePathSuffix")})],y.prototype,"imagePathSuffix",void 0),e([i({type:Number,json:l("imageRotation")})],y.prototype,"imageRotation",void 0),e([i({type:Number,json:l("maximumDistance")})],y.prototype,"maximumDistance",void 0),e([i({type:Number,json:l("nearDistance")})],y.prototype,"nearDistance",void 0),e([i({type:["OrientedImageryLayer"]})],y.prototype,"operationalLayerType",void 0),e([i({json:l("orientationAccuracy",((e,t)=>{e&&(t.orientationAccuracy=e.join(","))}))}),o((e=>e?e.trim().split(",").map(Number):null))],y.prototype,"orientationAccuracy",void 0),e([i({json:{...l("orientedImageryType",p.write,p.read),type:p.apiValues}})],y.prototype,"orientedImageryType",void 0),e([i({json:{read:!1},value:"oriented-imagery",readOnly:!0})],y.prototype,"type",void 0),e([i({json:{...l("timeIntervalUnit",s.write,s.read),type:s.apiValues}})],y.prototype,"timeIntervalUnit",void 0),e([i({type:Number,json:l("verticalFieldOfView")})],y.prototype,"verticalFieldOfView",void 0),e([i({json:{...l("verticalMeasurementUnit"),type:new r({Feet:"feet",Meter:"meter"}).apiValues}})],y.prototype,"verticalMeasurementUnit",void 0),e([i({type:String,json:l("videoPathPrefix")})],y.prototype,"videoPathPrefix",void 0),e([i({type:String,json:l("videoPathSuffix")})],y.prototype,"videoPathSuffix",void 0),y=e([a("esri.layers.OrientedImageryLayer")],y);const u=y;export{u as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{JSONMap as r}from"../core/jsonMap.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{orientedImageryTypeMap as p,timeIntervalUnitTypeMap as s,getEffectiveElevationSource as y}from"./orientedImagery/core/utils.js";function l(e,t,r){return{name:`orientedImageryProperties.${e}`,write:!t||{target:`orientedImageryProperties.${e}`,writer:t},origins:{service:{name:`orientedImageryInfo.orientedImageryProperties.${e}`,write:t,read:r}}}}let m=class extends n{constructor(){super(...arguments),this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.type="oriented-imagery",this.timeIntervalUnit=null,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null}get effectiveElevationSource(){const{elevationSource:e,demPathPrefix:t,demPathSuffix:r}=this;return y(e,t,r)}findFirstValidLayerId(e){return e.layers?.find((e=>"Oriented Imagery Layer"===e.type))?.id}_verifySource(){if(super._verifySource(),"point"!==this.geometryType)throw new t("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};e([i({type:Number,json:l("cameraHeading")})],m.prototype,"cameraHeading",void 0),e([i({type:Number,json:l("cameraHeight")})],m.prototype,"cameraHeight",void 0),e([i({type:Number,json:l("cameraPitch")})],m.prototype,"cameraPitch",void 0),e([i({type:Number,json:l("cameraRoll")})],m.prototype,"cameraRoll",void 0),e([i({type:Number,json:l("coveragePercent")})],m.prototype,"coveragePercent",void 0),e([i({type:String,json:l("demPathPrefix")})],m.prototype,"demPathPrefix",void 0),e([i({type:String,json:l("demPathSuffix")})],m.prototype,"demPathSuffix",void 0),e([i({type:String,json:l("depthImagePathPrefix")})],m.prototype,"depthImagePathPrefix",void 0),e([i({type:String,json:l("depthImagePathSuffix")})],m.prototype,"depthImagePathSuffix",void 0),e([i({type:Object,json:l("elevationSource")})],m.prototype,"elevationSource",void 0),e([i()],m.prototype,"effectiveElevationSource",null),e([i({type:Number,json:l("farDistance")})],m.prototype,"farDistance",void 0),e([i({json:{write:!0}})],m.prototype,"geometryType",void 0),e([i({type:Number,json:l("horizontalFieldOfView")})],m.prototype,"horizontalFieldOfView",void 0),e([i({type:String,json:l("horizontalMeasurementUnit")})],m.prototype,"horizontalMeasurementUnit",void 0),e([i({type:String,json:l("imagePathPrefix")})],m.prototype,"imagePathPrefix",void 0),e([i({type:String,json:l("imagePathSuffix")})],m.prototype,"imagePathSuffix",void 0),e([i({type:Number,json:l("imageRotation")})],m.prototype,"imageRotation",void 0),e([i({type:Number,json:l("maximumDistance")})],m.prototype,"maximumDistance",void 0),e([i({type:Number,json:l("nearDistance")})],m.prototype,"nearDistance",void 0),e([i({type:["OrientedImageryLayer"]})],m.prototype,"operationalLayerType",void 0),e([i({json:l("orientationAccuracy",((e,t)=>{e&&(t.orientationAccuracy=e.join(","))}))}),o((e=>e?e.trim().split(",").map(Number):null))],m.prototype,"orientationAccuracy",void 0),e([i({json:{...l("orientedImageryType",p.write,p.read),type:p.apiValues}})],m.prototype,"orientedImageryType",void 0),e([i({json:{read:!1},value:"oriented-imagery",readOnly:!0})],m.prototype,"type",void 0),e([i({json:{...l("timeIntervalUnit",s.write,s.read),type:s.apiValues}})],m.prototype,"timeIntervalUnit",void 0),e([i({type:Number,json:l("verticalFieldOfView")})],m.prototype,"verticalFieldOfView",void 0),e([i({json:{...l("verticalMeasurementUnit"),type:new r({Feet:"feet",Meter:"meter"}).apiValues}})],m.prototype,"verticalMeasurementUnit",void 0),e([i({type:String,json:l("videoPathPrefix")})],m.prototype,"videoPathPrefix",void 0),e([i({type:String,json:l("videoPathSuffix")})],m.prototype,"videoPathSuffix",void 0),m=e([a("esri.layers.OrientedImageryLayer")],m);const u=m;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../core/lang.js";import{polygonCentroid as t,extentCentroid as s}from"../../../geometry/support/centroid.js";import{getPolygonExtent as i,getGeometryExtent as a}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as n,equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import l from"./AttributesBuilder.js";import{cleanFromGeometryEngine as u,getGeometry as c,transformCentroid as d}from"./geometryUtils.js";import{project as m}from"./projectionSupport.js";import{makeEdgeCandidate as h,makeVertexCandidate as g}from"./SnappingCandidate.js";import{isDateField as f,isDateOnlyField as p,isTimestampOffsetField as y,isStringField as x,isTimeOnlyField as I}from"../../support/fieldUtils.js";import{isNullCountSupported as V,calculateStringStatistics as T,calculateStatistics as F,processSummaryStatisticsResult as S,calculateUniqueValuesCount as _,createUVResult as v,calculateClassBreaks as b,resolveCBResult as R,calculateHistogram as A,getAttributeComparator as z,calculatePercentile as M}from"../../../statistics/utils.js";class q{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new l(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!n.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,r);s.push(t)}n.set(a,this._calculateUniqueValues(s,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:i,items:a}=u[t],r=i.join(",");s&&!e.validateItems(a,s)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse(this.query):await this._createStatisticsQueryResponse(this.query)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;n(this.query.outSR)&&!o(t.spatialReference,this.query.outSR)?e.queryGeometry=u({spatialReference:this.query.outSR,...m(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=u({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t){const s=this.featureAdapter,i=C(this.hasZ,this.hasM),{point:a,mode:r}=e,n="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y,l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c=this._getPointCreator(r,this.spatialReference,t),d=new D(null,0),m=new D(null,0),f={x:0,y:0,z:0};for(const p of this.items){const t=s.getGeometry(p);if(null==t)continue;const{coords:r,lengths:y}=t;if(d.coords=r,m.coords=r,e.returnEdge){let e=0;for(let t=0;t<y.length;t++){const r=y[t];for(let t=0;t<r;t++,e+=i){const u=d;if(u.coordsIndex=e,t!==r-1){const t=m;t.coordsIndex=e+i;const r=f;N(f,a,u,t);const d=(a.x-r.x)/n,g=(a.y-r.y)/o,y=d*d+g*g;y<=1&&l.candidates.push(h(s.getObjectId(p),c(r),Math.sqrt(y),c(u),c(t)))}}}}if("none"!==e.vertexMode){const t=u?r.length-i:r.length;if("all"===e.vertexMode)for(let e=0;e<t;e+=i){const t=d;t.coordsIndex=e;const i=(a.x-t.x)/n,r=(a.y-t.y)/o,u=i*i+r*r;u<=1&&l.candidates.push(g(s.getObjectId(p),c(t),Math.sqrt(u)))}else if("ends"===e.vertexMode){const e=[0];u||e.push(r.length-i);for(const t of e){const e=d;e.coordsIndex=t;const i=(a.x-e.x)/n,r=(a.y-e.y)/o,u=i*i+r*r;u<=1&&l.candidates.push(g(s.getObjectId(p),c(e),Math.sqrt(u)))}}}}return l.candidates.sort(((e,t)=>e.distance-t.distance)),l}_getPointCreator(e,t,s){const i=null==s||o(t,s)?e=>e:e=>m(e,t,s),{hasZ:a}=this,r=0;return"3d"===e?a?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:r}):({x:e,y:t})=>i({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u}=e,c=this.fieldsIndex.get(t),d=f(c)||p(c)||y(c),m=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u}),h=V({normalizationType:a,normalizationField:i,minValue:n,maxValue:o}),g={value:.5,fieldType:c?.type},I=x(c)?T({values:m,supportsNullCount:h,percentileParams:g}):F({values:m,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:h,percentileParams:g});return S(I,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:r,timeZone:n},!1),l=_(o);return v(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:d,timeZone:m}=e,h=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:d,timeZone:m}),g=b(h,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return R(g,n)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:d,timeZone:m}=e,h=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:d,timeZone:m});return A(h,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.reverse()){const t=i.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=z(r?.type,n);e.sort(((e,t)=>{const i=s(e,a,r),n=s(t,a,r);return o(i,n)}))}}_createFeatureQueryResponse(e){const t=this.items,{geometryType:s,hasM:i,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:c,quantizationParameters:d,resultRecordCount:m,resultOffset:h,returnZ:g,returnM:f}=e,p=null!=m&&t.length>(h||0)+m,y=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:p,features:this._createFeatures(e,t),fields:y,geometryType:s,hasM:i&&f,hasZ:a&&g,objectIdFieldName:n,spatialReference:u(c||o),transform:d&&r(d)||null}}_createFeatures(e,t){const s=new l(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:u,returnCentroid:m,maxAllowableOffset:h,resultOffset:g,resultRecordCount:f,returnZ:p=!1,returnM:y=!1}=e,x=a&&p,I=i&&y;let V=[],T=0;const F=[...t];if(this._sortFeatures(F,n,((e,t,i)=>s.getFieldValue(e,t,i))),u||m){const e=r(o)??void 0;if(u&&!m)for(const t of F)V[T++]={attributes:s.getAttributes(t),geometry:c(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),h,e,x,I)};else if(!u&&m)for(const t of F)V[T++]={attributes:s.getAttributes(t),centroid:d(this,this.featureAdapter.getCentroid(t,this),e)};else for(const t of F)V[T++]={attributes:s.getAttributes(t),centroid:d(this,this.featureAdapter.getCentroid(t,this),e),geometry:c(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),h,e,x,I)}}else for(const r of F){const e=s.getAttributes(r);e&&(V[T++]={attributes:e})}const S=g||0;if(null!=f){const e=S+f;V=V.slice(S,Math.min(V.length,e))}return V}_createExceedsLimitQueryResponse(e){let t=!1,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;for(const r of e.outStatistics??[])if("exceedslimit"===r.statisticType){s=null!=r.maxPointCount?r.maxPointCount:Number.POSITIVE_INFINITY,i=null!=r.maxRecordCount?r.maxRecordCount:Number.POSITIVE_INFINITY,a=null!=r.maxVertexCount?r.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)t=this.items.length>s;else if(this.items.length>i)t=!0;else{const e=C(this.hasZ,this.hasM),s=this.featureAdapter;t=this.items.reduce(((e,t)=>{const i=s.getGeometry(t);return e+(null!=i&&i.coords.length||0)}),0)/e>a}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(t)}}]}}async _createStatisticsQueryResponse(e){const t={attributes:{}},s=[],i=new Map,a=new Map,r=new Map,n=new Map,o=new l(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:d,orderByFields:m,resultRecordCount:h}=e,g=c?.length,f=!!g,p=f?c[0]:null,y=f&&!this.fieldsIndex.get(p);for(const l of u??[]){const{outStatisticFieldName:e,statisticType:u}=l,m=l,I="exceedslimit"!==u?l.onStatisticField:void 0,V="percentile_disc"===u||"percentile_cont"===u,T="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,F=f&&1===g&&(I===p||y)&&"count"===u;if(f){if(!r.has(I)){const e=[];for(const t of c){const s=this._getAttributeValues(o,t,i);e.push(s)}r.set(I,this._calculateUniqueValues(e,!T&&o.returnDistinctValues))}const t=r.get(I);if(!t)continue;const s=Object.keys(t);h&&(s.sort(),s.length=h);for(const a of s){const{count:s,data:r,items:l,itemPositions:u}=t[a],h=r.join(",");if(!d||o.validateItems(l,d)){const t=n.get(h)||{attributes:{}};if(T){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(m,l);t.aggregateGeometries[s]=e}else{let a=null;if(F)a=s;else{const e=this._getAttributeValues(o,I,i),t=u.map((t=>e[t]));a=V&&"statisticParameters"in m?this._getPercentileValue(m,t):this._getStatisticValue(m,t,null,o.returnDistinctValues)}t.attributes[e]=a}let a=0;c.forEach(((e,s)=>t.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++a]=r[s])),n.set(h,t)}}}else if(T){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(m,this.items);t.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(o,I,i);t.attributes[e]=V&&"statisticParameters"in m?this._getPercentileValue(m,s):this._getStatisticValue(m,s,a,o.returnDistinctValues)}const S="min"!==u&&"max"!==u||!x(this.fieldsIndex.get(I))&&!this._isAnyDateField(I)?null:this.fieldsIndex.get(I)?.type;s.push({name:e,alias:e,type:S||"esriFieldTypeDouble"})}const I=f?Array.from(n.values()):[t];return this._sortFeatures(I,m,((e,t)=>e.attributes[t])),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return f(t)||p(t)||y(t)||I(t)}async _getAggregateGeometry(e,r){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:d,spatialReference:m,geometryType:h,hasZ:g,hasM:f}=this,p=r.map((e=>c(h,g,f,d.getGeometry(e)))),y=n(m,p,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=y?i(y):a(o(m,p));x.aggregateGeometries={...e,spatialReference:m},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=y?t(y):s(a(o(m,p)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=y,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:r}=e;let n=null;n=s?.has(a)?s.get(a):x(this.fieldsIndex.get(a))||this._isAnyDateField(a)?T({values:t,returnDistinct:i}):F({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:r,orderBy:n}=i,o=this.fieldsIndex.get(s);return M(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s){if(s.has(t))return s.get(t);const i=this.fieldsIndex.get(t),a=this.items.map((s=>e.getFieldValue(s,t,i)));return s.set(t,a),a}_calculateUniqueValues(e,t){const s={},i=this.items,a=i.length;for(let r=0;r<a;r++){const a=i[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(t||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,s=!0){const i=new l(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:a,scale:r,timeZone:n}=t;return a?i.getExpressionValues(this.items,a,{viewingMode:"map",scale:r,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},n):i.getDataValues(this.items,e(t),s)}}function N(e,t,s,i){const a=i.x-s.x,r=i.y-s.y,n=a*a+r*r,o=(t.x-s.x)*a+(t.y-s.y)*r,l=Math.min(1,Math.max(0,o/n));e.x=s.x+a*l,e.y=s.y+r*l}function C(e,t){return e?t?4:3:t?3:2}class D{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}export{q as QueryEngineResult};
5
+ import{clone as e}from"../../../core/lang.js";import{polygonCentroid as t,extentCentroid as s}from"../../../geometry/support/centroid.js";import{getPolygonExtent as i,getGeometryExtent as a}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as n,equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import l from"./AttributesBuilder.js";import{cleanFromGeometryEngine as u,getGeometry as c,transformCentroid as d}from"./geometryUtils.js";import{project as m}from"./projectionSupport.js";import{makeEdgeCandidate as h,makeVertexCandidate as g}from"./SnappingCandidate.js";import{isDateField as f,isDateOnlyField as p,isTimestampOffsetField as y,isStringField as x,isTimeOnlyField as I}from"../../support/fieldUtils.js";import{isNullCountSupported as T,calculateStringStatistics as V,calculateStatistics as F,processSummaryStatisticsResult as S,calculateUniqueValuesCount as _,createUVResult as v,calculateClassBreaks as b,resolveCBResult as R,calculateHistogram as A,getAttributeComparator as z,calculatePercentile as M}from"../../../statistics/utils.js";class q{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new l(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!n.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,r);s.push(t)}n.set(a,this._calculateUniqueValues(s,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:i,items:a}=u[t],r=i.join(",");s&&!e.validateItems(a,s)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse(this.query):await this._createStatisticsQueryResponse(this.query)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;n(this.query.outSR)&&!o(t.spatialReference,this.query.outSR)?e.queryGeometry=u({spatialReference:this.query.outSR,...m(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=u({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t){const s=this.featureAdapter,i=C(this.hasZ,this.hasM),{point:a,mode:r}=e,n="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y,l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c=this._getPointCreator(r,this.spatialReference,t),d=new D(null,0),m=new D(null,0),f={x:0,y:0,z:0};for(const p of this.items){const t=s.getGeometry(p);if(null==t)continue;const{coords:r,lengths:y}=t;if(d.coords=r,m.coords=r,e.returnEdge){let e=0;for(let t=0;t<y.length;t++){const r=y[t];for(let t=0;t<r;t++,e+=i){const u=d;if(u.coordsIndex=e,t!==r-1){const t=m;t.coordsIndex=e+i;const r=f;N(f,a,u,t);const d=(a.x-r.x)/n,g=(a.y-r.y)/o,y=d*d+g*g;y<=1&&l.candidates.push(h(s.getObjectId(p),c(r),Math.sqrt(y),c(u),c(t)))}}}}if("none"!==e.vertexMode){const t=u?r.length-i:r.length;if("all"===e.vertexMode)for(let e=0;e<t;e+=i){const t=d;t.coordsIndex=e;const i=(a.x-t.x)/n,r=(a.y-t.y)/o,u=i*i+r*r;u<=1&&l.candidates.push(g(s.getObjectId(p),c(t),Math.sqrt(u)))}else if("ends"===e.vertexMode){const e=[0];u||e.push(r.length-i);for(const t of e){const e=d;e.coordsIndex=t;const i=(a.x-e.x)/n,r=(a.y-e.y)/o,u=i*i+r*r;u<=1&&l.candidates.push(g(s.getObjectId(p),c(e),Math.sqrt(u)))}}}}return l.candidates.sort(((e,t)=>e.distance-t.distance)),l}_getPointCreator(e,t,s){const i=null==s||o(t,s)?e=>e:e=>m(e,t,s),{hasZ:a}=this,r=0;return"3d"===e?a?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:r}):({x:e,y:t})=>i({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u}=e,c=this.fieldsIndex.get(t),d=f(c)||p(c)||y(c),m=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u}),h=T({normalizationType:a,normalizationField:i,minValue:n,maxValue:o}),g={value:.5,fieldType:c?.type},I=x(c)?V({values:m,supportsNullCount:h,percentileParams:g}):F({values:m,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:h,percentileParams:g});return S(I,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:r,timeZone:n},!1),l=_(o);return v(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:d,timeZone:m}=e,h=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:d,timeZone:m}),g=b(h,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return R(g,n)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:d,timeZone:m}=e,h=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:d,timeZone:m});return A(h,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.reverse()){const t=i.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=z(r?.type,n);e.sort(((e,t)=>{const i=s(e,a,r),n=s(t,a,r);return o(i,n)}))}}_createFeatureQueryResponse(e){const t=this.items,{geometryType:s,hasM:i,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:c,quantizationParameters:d,resultRecordCount:m,resultOffset:h,returnZ:g,returnM:f}=e,p=null!=m&&t.length>(h||0)+m,y=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:p,features:this._createFeatures(e,t),fields:y,geometryType:s,hasM:i&&f,hasZ:a&&g,objectIdFieldName:n,spatialReference:u(c||o),transform:d&&r(d)||null}}_createFeatures(e,t){const s=new l(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:u,returnCentroid:m,maxAllowableOffset:h,resultOffset:g,resultRecordCount:f,returnZ:p=!1,returnM:y=!1}=e,x=a&&p,I=i&&y;let T=[],V=0;const F=[...t];if(this._sortFeatures(F,n,((e,t,i)=>s.getFieldValue(e,t,i))),this.geometryType&&(u||m)){const e=r(o)??void 0;if(u&&!m)for(const t of F)T[V++]={attributes:s.getAttributes(t),geometry:c(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),h,e,x,I)};else if(!u&&m)for(const t of F)T[V++]={attributes:s.getAttributes(t),centroid:d(this,this.featureAdapter.getCentroid(t,this),e)};else for(const t of F)T[V++]={attributes:s.getAttributes(t),centroid:d(this,this.featureAdapter.getCentroid(t,this),e),geometry:c(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),h,e,x,I)}}else for(const r of F){const e=s.getAttributes(r);e&&(T[V++]={attributes:e})}const S=g||0;if(null!=f){const e=S+f;T=T.slice(S,Math.min(T.length,e))}return T}_createExceedsLimitQueryResponse(e){let t=!1,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;for(const r of e.outStatistics??[])if("exceedslimit"===r.statisticType){s=null!=r.maxPointCount?r.maxPointCount:Number.POSITIVE_INFINITY,i=null!=r.maxRecordCount?r.maxRecordCount:Number.POSITIVE_INFINITY,a=null!=r.maxVertexCount?r.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)t=this.items.length>s;else if(this.items.length>i)t=!0;else{const e=C(this.hasZ,this.hasM),s=this.featureAdapter;t=this.items.reduce(((e,t)=>{const i=s.getGeometry(t);return e+(null!=i&&i.coords.length||0)}),0)/e>a}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(t)}}]}}async _createStatisticsQueryResponse(e){const t={attributes:{}},s=[],i=new Map,a=new Map,r=new Map,n=new Map,o=new l(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:d,orderByFields:m,resultRecordCount:h}=e,g=c?.length,f=!!g,p=f?c[0]:null,y=f&&!this.fieldsIndex.get(p);for(const l of u??[]){const{outStatisticFieldName:e,statisticType:u}=l,m=l,I="exceedslimit"!==u?l.onStatisticField:void 0,T="percentile_disc"===u||"percentile_cont"===u,V="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,F=f&&1===g&&(I===p||y)&&"count"===u;if(f){if(!r.has(I)){const e=[];for(const t of c){const s=this._getAttributeValues(o,t,i);e.push(s)}r.set(I,this._calculateUniqueValues(e,!V&&o.returnDistinctValues))}const t=r.get(I);if(!t)continue;const s=Object.keys(t);h&&(s.sort(),s.length=Math.min(h,s.length));for(const a of s){const{count:s,data:r,items:l,itemPositions:u}=t[a],h=r.join(",");if(!d||o.validateItems(l,d)){const t=n.get(h)||{attributes:{}};if(V){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(m,l);t.aggregateGeometries[s]=e}else{let a=null;if(F)a=s;else{const e=this._getAttributeValues(o,I,i),t=u.map((t=>e[t]));a=T&&"statisticParameters"in m?this._getPercentileValue(m,t):this._getStatisticValue(m,t,null,o.returnDistinctValues)}t.attributes[e]=a}let a=0;c.forEach(((e,s)=>t.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++a]=r[s])),n.set(h,t)}}}else if(V){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(m,this.items);t.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(o,I,i);t.attributes[e]=T&&"statisticParameters"in m?this._getPercentileValue(m,s):this._getStatisticValue(m,s,a,o.returnDistinctValues)}const S="min"!==u&&"max"!==u||!x(this.fieldsIndex.get(I))&&!this._isAnyDateField(I)?null:this.fieldsIndex.get(I)?.type;s.push({name:e,alias:e,type:S||"esriFieldTypeDouble"})}const I=f?Array.from(n.values()):[t];return this._sortFeatures(I,m,((e,t)=>e.attributes[t])),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return f(t)||p(t)||y(t)||I(t)}async _getAggregateGeometry(e,r){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:d,spatialReference:m,geometryType:h,hasZ:g,hasM:f}=this,p=r.map((e=>c(h,g,f,d.getGeometry(e)))),y=n(m,p,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=y?i(y):a(o(m,p));x.aggregateGeometries={...e,spatialReference:m},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=y?t(y):s(a(o(m,p)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=y,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:r}=e;let n=null;n=s?.has(a)?s.get(a):x(this.fieldsIndex.get(a))||this._isAnyDateField(a)?V({values:t,returnDistinct:i}):F({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:r,orderBy:n}=i,o=this.fieldsIndex.get(s);return M(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s){if(s.has(t))return s.get(t);const i=this.fieldsIndex.get(t),a=this.items.map((s=>e.getFieldValue(s,t,i)));return s.set(t,a),a}_calculateUniqueValues(e,t){const s={},i=this.items,a=i.length;for(let r=0;r<a;r++){const a=i[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(t||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,s=!0){const i=new l(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:a,scale:r,timeZone:n}=t;return a?i.getExpressionValues(this.items,a,{viewingMode:"map",scale:r,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},n):i.getDataValues(this.items,e(t),s)}}function N(e,t,s,i){const a=i.x-s.x,r=i.y-s.y,n=a*a+r*r,o=(t.x-s.x)*a+(t.y-s.y)*r,l=Math.min(1,Math.max(0,o/n));e.x=s.x+a*l,e.y=s.y+r*l}function C(e,t){return e?t?4:3:t?3:2}class D{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}export{q as QueryEngineResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";var h;let g=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){const{layer:e}=this;return"subtype-group"===e.type?e.subtypeField:e.typeIdField}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await h._staticFetchEnterpriseFeatureRoot(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await h._staticFetchEnterpriseFieldGroup(n,t);if(i){const t=i.map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names})));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const r of this.fieldGroups){const o=r.isEditingRestrictive?"error":"warning";if(t&&!r.fields.some((e=>t.includes(e))))continue;if(!r.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:r,type:o}));continue}let a=!1;const l=e[this.subtypeFieldName],c=r.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:r,type:o}))}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,r={};let o=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));o.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const r in n.values){const o=n.values[r];if(t!==r){if(void 0!==e[r]&&"any"!==o.objectType)if("null"===o.objectType)null!==e[r]&&(s=!1);else if("code"===o.objectType)e[r]!==o.codedValue.code&&(s=!1);else if("range"===o.objectType){const t=e[r];(t<o.minValue||t>o.maxValue)&&(s=!1)}}else i=o,c=c||"range"===o.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=this._generateKey(i);p[e]||a.push(i),p[e]=!0}}c&&(a=this._joinRange(a)),r[l.name]=a,o=n?this._filterIntersection(o,a):[]}return 1===a.length&&n&&(o=[]),new p({contingentValuesAllGroups:o,contingentValuesByFieldGroup:r})}_generateKey(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}_joinRange(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}_filterIntersection(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?this._intersectRanges(e,t):this._intersectValues(e,t)}_intersectRanges(e,t){const n=[];let i,s=0;for(const r of e)for(;s<t.length;s++){const e=t[s];if("null"===r.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===r.objectType)break;if("null"===e.objectType)continue}if(r.maxValue<e.minValue)break;if(r.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:r.maxValue,maxValue:e.minValue}));break}if(!(r.minValue>e.maxValue))if(r.minValue!==e.maxValue){if(i=r.minValue>e.minValue?r.minValue:e.minValue,r.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:r.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:r.minValue,maxValue:e.maxValue}))}return n}_intersectValues(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}static async _staticFetchEnterpriseFeatureRoot(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}static async _staticFetchEnterpriseFieldGroup(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups))}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await this._fetchAGOLFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:this._fetchEnterpriseFeatureRoot(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await this._fetchEnterpriseFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchAGOLFieldGroup(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups))}async _fetchEnterpriseFieldGroup(e,t,n){return h._staticFetchEnterpriseFieldGroup(e,t,n)}async _fetchEnterpriseFeatureRoot(e,t){return h._staticFetchEnterpriseFeatureRoot(e,t)}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await this._fetchAGOLContingentValues(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const r=await this._fetchEnterpriseContingentValues(s,i,t);return this._constructFieldGroupsEnterprise(e,r)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const r of n??[]){const n=this._parseAGOLContingency(r,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,r=!!e.retired&&1===e.retired,o={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],r=n.typeCodes[e.types[a]];if("Code"===r){let t=e.values[l];l++;const r=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===r.name));e&&(t=e.entries[t])}const u=r.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});o[s]=p}else if("Range"===r){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],r=new c({minValue:n,maxValue:i,objectType:"range"});o[s]=r}else if("Any"===r){const e=new c({objectType:"any"});o[s]=e}else{const e=new c({objectType:"null"});o[s]=e}}return new l({id:s,isRetired:r,subtype:i,values:o})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,r=this._getSubtypeEnterprise(n.subtypeCode),o={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(r,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});o[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});o[i]=n}else if(s){const e=new c({objectType:"any"});o[i]=e}else{const e=new c({objectType:"null"});o[i]=e}}return new l({id:i,isRetired:s,subtype:r,values:o})}));return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}async _fetchEnterpriseContingentValues(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async _fetchAGOLContingentValues(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?e.domains?.[t]:this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};e([r({constructOnly:!0})],g.prototype,"layer",void 0),e([r({constructOnly:!0})],g.prototype,"request",void 0),e([r({type:[d]})],g.prototype,"fieldGroups",void 0),e([r({constructOnly:!0})],g.prototype,"fieldGroupDefinitions",void 0),e([r()],g.prototype,"subtypeFieldName",null),g=h=e([o("esri.layers.support.LayerContingentValuesCache")],g);const V=g;export{V as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";var h;let g=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){const{layer:e}=this;return"subtype-group"===e.type?e.subtypeField:e.typeIdField}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await h._staticFetchEnterpriseFeatureRoot(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await h._staticFetchEnterpriseFieldGroup(n,t);if(i){const t=i.map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names})));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const r of this.fieldGroups){const o=r.isEditingRestrictive?"error":"warning";if(t&&!r.fields.some((e=>t.includes(e))))continue;if(!r.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:r,type:o}));continue}let a=!1;const l=e[this.subtypeFieldName],c=r.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:r,type:o}))}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,r={};let o=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));o.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const r in n.values){const o=n.values[r];if(t!==r){if(void 0!==e[r]&&"any"!==o.objectType)if("null"===o.objectType)null!==e[r]&&(s=!1);else if("code"===o.objectType)e[r]!==o.codedValue.code&&(s=!1);else if("range"===o.objectType){const t=e[r];(t<o.minValue||t>o.maxValue)&&(s=!1)}}else i=o,c=c||"range"===o.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=this._generateKey(i);p[e]||a.push(i),p[e]=!0}}c&&(a=this._joinRange(a)),r[l.name]=a,o=n?this._filterIntersection(o,a):[]}return 1===a.length&&n&&(o=[]),new p({contingentValuesAllGroups:o,contingentValuesByFieldGroup:r})}_generateKey(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}_joinRange(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}_filterIntersection(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?this._intersectRanges(e,t):this._intersectValues(e,t)}_intersectRanges(e,t){const n=[];let i,s=0;for(const r of e)for(;s<t.length;s++){const e=t[s];if("null"===r.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===r.objectType)break;if("null"===e.objectType)continue}if(r.maxValue<e.minValue)break;if(r.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:r.maxValue,maxValue:e.minValue}));break}if(!(r.minValue>e.maxValue))if(r.minValue!==e.maxValue){if(i=r.minValue>e.minValue?r.minValue:e.minValue,r.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:r.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:r.minValue,maxValue:e.maxValue}))}return n}_intersectValues(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}static async _staticFetchEnterpriseFeatureRoot(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}static async _staticFetchEnterpriseFieldGroup(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups))}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await this._fetchAGOLFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:this._fetchEnterpriseFeatureRoot(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await this._fetchEnterpriseFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchAGOLFieldGroup(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups))}async _fetchEnterpriseFieldGroup(e,t,n){return h._staticFetchEnterpriseFieldGroup(e,t,n)}async _fetchEnterpriseFeatureRoot(e,t){return h._staticFetchEnterpriseFeatureRoot(e,t)}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await this._fetchAGOLContingentValues(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const r=await this._fetchEnterpriseContingentValues(s,i,t);return this._constructFieldGroupsEnterprise(e,r)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const r of n??[]){const n=this._parseAGOLContingency(r,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,r=!!e.retired&&1===e.retired,o={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],r=n.typeCodes[e.types[a]];if("Code"===r){let t=e.values[l];l++;const r=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===r?.name));e&&(t=e.entries[t])}const u=r?.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});o[s]=p}else if("Range"===r){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],r=new c({minValue:n,maxValue:i,objectType:"range"});o[s]=r}else if("Any"===r){const e=new c({objectType:"any"});o[s]=e}else{const e=new c({objectType:"null"});o[s]=e}}return new l({id:s,isRetired:r,subtype:i,values:o})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,r=this._getSubtypeEnterprise(n.subtypeCode),o={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(r,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});o[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});o[i]=n}else if(s){const e=new c({objectType:"any"});o[i]=e}else{const e=new c({objectType:"null"});o[i]=e}}return new l({id:i,isRetired:s,subtype:r,values:o})}));return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}async _fetchEnterpriseContingentValues(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async _fetchAGOLContingentValues(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_findDomainByFieldName(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find((([e])=>e.trim().toLowerCase()===t.trim().toLowerCase()))||[];return i||null}return null}_getDomain(e,t){const n=e?this._findDomainByFieldName(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};e([r({constructOnly:!0})],g.prototype,"layer",void 0),e([r({constructOnly:!0})],g.prototype,"request",void 0),e([r({type:[d]})],g.prototype,"fieldGroups",void 0),e([r({constructOnly:!0})],g.prototype,"fieldGroupDefinitions",void 0),e([r()],g.prototype,"subtypeFieldName",null),g=h=e([o("esri.layers.support.LayerContingentValuesCache")],g);const V=g;export{V as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.28.0-rc.3",
3
+ "version": "4.28.0",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{convertDateFormatToIntlOptions as t,formatDate as e,formatTimestamp as r,formatTimeOnly as i,formatDateOnly as n}from"../../intl/date.js";import{isDateField as s,isDateOnlyField as o,isTimestampOffsetField as a}from"../../layers/support/fieldUtils.js";import{loadArcade as c}from"../../support/arcadeOnDemand.js";import{getWellKnownBasemapId as l}from"../../support/basemapUtils.js";import{getTimeZoneFormattingOptions as g,utc as m}from"../../time/timeZoneUtils.js";const d=",",u={light:["streets","gray","topo","terrain","oceans","osm","gray-vector","streets-vector","topo-vector","streets-relief-vector","streets-navigation-vector","topo-3d","navigation-3d","arcgis-light-gray","arcgis-navigation","arcgis-streets","arcgis-streets-relief","arcgis-topographic","arcgis-oceans","osm-standard","osm-standard-relief","osm-streets","osm-streets-relief","osm-light-gray","arcgis-terrain","arcgis-charted-territory","arcgis-community","arcgis-colored-pencil","arcgis-modern-antique","arcgis-midcentury","arcgis-newspaper","arcgis-hillshade-light"],dark:["satellite","hybrid","dark-gray","dark-gray-vector","streets-night-vector","navigation-dark-3d","arcgis-imagery","arcgis-imagery-standard","arcgis-dark-gray","arcgis-navigation-night","arcgis-streets-night","osm-dark-gray","arcgis-nova","arcgis-hillshade-dark"]},f="percent-of-total",p="field",h={years:365,months:30,days:1,hours:1/24,minutes:1/1440,seconds:1/86400,milliseconds:1/864e5},y=new Set(["integer","small-integer"]);let v=null;const T=["date","date-only","timestamp-offset"];function Z(t){return s(t)||o(t)||a(t)}async function $(t){const{field:e,field2:r,field3:i,normalizationField:n,valueExpression:s}=t;let o=[];if(s){if(!v){const{arcadeUtils:t}=await c();v=t}o=v.extractFieldNames(s)}return e&&o.push(e),r&&o.push(r),i&&o.push(i),n&&o.push(n),o}function U(t){let e=t.normalizationType;return e||(t.normalizationField?e=p:null!=t.normalizationTotal&&(e=f)),e??void 0}function w(t){return String(t).padStart(2,"0")}function k(t,e,r){let i;if("date"===e||"number"===e){"number"===e&&(t=new Date(t));i=`TIMESTAMP'${r?t.getFullYear():t.getUTCFullYear()}-${w((r?t.getMonth():t.getUTCMonth())+1)}-${w(r?t.getDate():t.getUTCDate())} ${w(r?t.getHours():t.getUTCHours())}:${w(r?t.getMinutes():t.getUTCMinutes())}:${w(r?t.getSeconds():t.getUTCSeconds())}'`}else i=t;return i}function C(t,e,r,i){const{hasQueryEngine:n}=t,s=`(${k(r,F(t,r),n)} - ${k(e,F(t,e),n)})`;let o=h[i],a="/";o<1&&(o=1/o,a="*");return{sqlExpression:1===o?s:`(${s} ${a} ${o})`,sqlWhere:null}}function F(t,e){if(e instanceof Date)return"date";if("number"==typeof e)return"number";if("string"==typeof e){const r=t.getField(e);if("<now>"===e.toLowerCase())return;if(s(r))return"field"}}function b(t,e=u){for(const r in e)if(e[r].includes(t))return r}function D(t,e,r=!0){let i=null;return t&&("string"==typeof t?e.includes(t)&&(i=t):i=l(t)),r?i||"gray":i}function M(t,e){const r=e&&t.getField(e);return!!r&&y.has(r.type)}function S(t){return`cast(${t} as float)`}function j(s,o){const{format:a,timeZoneOptions:c,fieldType:l}=o??{};let d,u;switch(c&&({timeZone:d,timeZoneName:u}=g(c.layerTimeZone,c.datesInUnknownTimezone,c.viewTimeZone,t(a||"short-date-short-time"),l)),l){case"date-only":{const r=t(a||"short-date");return"string"==typeof s?n(s,{...r}):e(s,{...r,timeZone:m})}case"time-only":{const r=t(a||"short-time");return"string"==typeof s?i(s,r):e(s,{...r,timeZone:m})}case"timestamp-offset":{const i=a||c?t(a||"short-date-short-time"):void 0,n=i?{...i,timeZone:d,timeZoneName:u}:void 0;return"string"==typeof s?r(s,n):e(s,n)}default:{const r=a||c?t(a||"short-date-short-time"):void 0;return e("string"==typeof s?new Date(s):s,r?{...r,timeZone:d,timeZoneName:u}:void 0)}}}export{S as castIntegerFieldToFloat,T as dateTypes,u as defaultBasemapGroups,d as fieldDelimiter,j as formatAnyDate,b as getBasemapGroup,D as getBasemapId,C as getDateDiffSQL,F as getDateType,$ as getFieldsList,U as getNormalizationType,Z as isAnyDateField,M as isIntegerField,h as unitValueInDays};
5
+ import{convertDateFormatToIntlOptions as t,formatDate as e,formatTimestamp as r,formatTimeOnly as i,formatDateOnly as n}from"../../intl/date.js";import{isDateField as s,isDateOnlyField as o,isTimestampOffsetField as a}from"../../layers/support/fieldUtils.js";import{loadArcade as c}from"../../support/arcadeOnDemand.js";import{getWellKnownBasemapId as l}from"../../support/basemapUtils.js";import{getTimeZoneFormattingOptions as g,utc as m}from"../../time/timeZoneUtils.js";const d=",",u={light:["streets","gray","topo","terrain","oceans","osm","gray-vector","streets-vector","topo-vector","streets-relief-vector","streets-navigation-vector","topo-3d","navigation-3d","arcgis-light-gray","arcgis-navigation","arcgis-streets","arcgis-streets-relief","arcgis-topographic","arcgis-oceans","osm-standard","osm-standard-relief","osm-streets","osm-streets-relief","osm-light-gray","arcgis-terrain","arcgis-charted-territory","arcgis-community","arcgis-colored-pencil","arcgis-modern-antique","arcgis-midcentury","arcgis-newspaper","arcgis-hillshade-light"],dark:["satellite","hybrid","dark-gray","dark-gray-vector","streets-night-vector","navigation-dark-3d","arcgis-imagery","arcgis-imagery-standard","arcgis-dark-gray","arcgis-navigation-night","arcgis-streets-night","osm-dark-gray","arcgis-nova","arcgis-hillshade-dark"]},f="percent-of-total",p="field",y={years:365,months:30,days:1,hours:1/24,minutes:1/1440,seconds:1/86400,milliseconds:1/864e5},h=new Set(["integer","small-integer"]);let v=null;const T=["date","date-only","timestamp-offset"];function Z(t){return s(t)||o(t)||a(t)}async function $(t){const{field:e,field2:r,field3:i,normalizationField:n,valueExpression:s}=t;let o=[];if(s){if(!v){const{arcadeUtils:t}=await c();v=t}o=v.extractFieldNames(s)}return e&&o.push(e),r&&o.push(r),i&&o.push(i),n&&o.push(n),o}function w(t){let e=t.normalizationType;return e||(t.normalizationField?e=p:null!=t.normalizationTotal&&(e=f)),e??void 0}function U(t){return String(t).padStart(2,"0")}function k(t,e,r){let i;if("date"===e||"number"===e){"number"===e&&(t=new Date(t));i=`TIMESTAMP'${r?t.getFullYear():t.getUTCFullYear()}-${U((r?t.getMonth():t.getUTCMonth())+1)}-${U(r?t.getDate():t.getUTCDate())} ${U(r?t.getHours():t.getUTCHours())}:${U(r?t.getMinutes():t.getUTCMinutes())}:${U(r?t.getSeconds():t.getUTCSeconds())}'`}else i=t;return i}function D(t,e,r,i){const{hasQueryEngine:n}=t,s=`(${k(r,S(t,r),n)} - ${k(e,S(t,e),n)})`;let o=y[i],a="/";o<1&&(o=1/o,a="*");return{sqlExpression:1===o?s:`(${s} ${a} ${o})`,sqlWhere:null}}function S(t,e){if(e instanceof Date)return"date";if("number"==typeof e)return"number";if("string"==typeof e){const r=t.getField(e);if("<now>"===e.toLowerCase())return;if(s(r))return"field"}}function C(t,e=u){for(const r in e)if(e[r].includes(t))return r}function F(t,e,r=!0){let i=null;return t&&("string"==typeof t?e.includes(t)&&(i=t):i=l(t)),r?i||"gray":i}function b(t,e){const r=e&&t.getField(e);return!!r&&h.has(r.type)}function M(t){return`cast(${t} as float)`}function N(s,o){const{format:a,timeZoneOptions:c,fieldType:l}=o??{};let d,u;if(c&&({timeZone:d,timeZoneName:u}=g(c.layerTimeZone,c.datesInUnknownTimezone,c.viewTimeZone,t(a||"short-date-short-time"),l)),"string"==typeof s&&isNaN(Date.parse("time-only"===l?`1970-01-01T${s}Z`:s)))return s;switch(l){case"date-only":{const r=t(a||"short-date");return"string"==typeof s?n(s,{...r}):e(s,{...r,timeZone:m})}case"time-only":{const r=t(a||"short-time");return"string"==typeof s?i(s,r):e(s,{...r,timeZone:m})}case"timestamp-offset":{if(!d&&"string"==typeof s&&new Date(s).toISOString()!==s)return s;const i=a||c?t(a||"short-date-short-time"):void 0,n=i?{...i,timeZone:d,timeZoneName:u}:void 0;return"string"==typeof s?r(s,n):e(s,n)}default:{const r=a||c?t(a||"short-date-short-time"):void 0;return e("string"==typeof s?new Date(s):s,r?{...r,timeZone:d,timeZoneName:u}:void 0)}}}export{M as castIntegerFieldToFloat,T as dateTypes,u as defaultBasemapGroups,d as fieldDelimiter,N as formatAnyDate,C as getBasemapGroup,F as getBasemapId,D as getDateDiffSQL,S as getDateType,$ as getFieldsList,w as getNormalizationType,Z as isAnyDateField,b as isIntegerField,y as unitValueInDays};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import n from"../rest/support/ClassBreaksDefinition.js";import{createGenerateRendererClassBreaks as e}from"../rest/support/generateRendererUtils.js";const t="<Null>",l="equal-interval",i=1,a=5,r=10,o=/\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi,u=new Set(["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeSingle","esriFieldTypeDouble"]),s=["min","max","avg","stddev","count","sum","variance","nullcount","median"];function c(n){return null==n||"string"==typeof n&&!n?t:n}function m(n){const e=null!=n.normalizationField||null!=n.normalizationType,t=null!=n.minValue||null!=n.maxValue,l=!!n.sqlExpression&&n.supportsSQLExpression;return!e&&!t&&!l}function f(n){const e=n.returnDistinct?[...new Set(n.values)]:n.values,t=e.filter((n=>null!=n)).sort(),l=t.length,i={count:l,min:t[0],max:t[l-1]};return n.supportsNullCount&&(i.nullcount=e.length-l),n.percentileParams&&(i.median=p(e,n.percentileParams)),i}function d(n){const{values:e,useSampleStdDev:t,supportsNullCount:l}=n;let i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,r=null,o=null,u=null,s=null,c=0;const m=null==n.minValue?-1/0:n.minValue,f=null==n.maxValue?1/0:n.maxValue;for(const p of e)Number.isFinite(p)?p>=m&&p<=f&&(r=null===r?p:r+p,i=Math.min(i,p),a=Math.max(a,p),c++):"string"==typeof p&&c++;if(c&&null!=r){o=r/c;let n=0;for(const t of e)Number.isFinite(t)&&t>=m&&t<=f&&(n+=(t-o)**2);s=t?c>1?n/(c-1):0:c>0?n/c:0,u=Math.sqrt(s)}else i=null,a=null;const d={avg:o,count:c,max:a,min:i,stddev:u,sum:r,variance:s};return l&&(d.nullcount=e.length-c),n.percentileParams&&(d.median=p(e,n.percentileParams)),d}function p(n,e){const{fieldType:t,value:l,orderBy:i,isDiscrete:a}=e,r=v(t,"desc"===i);if(0===(n=[...n].filter((n=>null!=n)).sort(((n,e)=>r(n,e)))).length)return null;if(l<=0)return n[0];if(l>=1)return n[n.length-1];const o=(n.length-1)*l,u=Math.floor(o),s=u+1,c=o%1,m=n[u],f=n[s];return s>=n.length||a||"string"==typeof m||"string"==typeof f?m:m*(1-c)+f*c}function v(n,e){const t=e?1:-1,l=h(e),i=V(e);if(!(!!n&&["esriFieldTypeDate","esriFieldTypeString","esriFieldTypeGUID","esriFieldTypeGlobalID",...u].includes(n)))return(n,e)=>"number"==typeof n&&"number"==typeof e?l(n,e):"string"==typeof n&&"string"==typeof e?i(n,e):t;if("esriFieldTypeDate"===n)return(n,e)=>{const i=new Date(n).getTime(),a=new Date(e).getTime();return isNaN(i)||isNaN(a)?t:l(i,a)};if(u.has(n))return(n,e)=>l(n,e);if("esriFieldTypeString"===n)return(n,e)=>i(n,e);if("esriFieldTypeGUID"===n||"esriFieldTypeGlobalID"===n){const n=V(e);return(e,t)=>n(T(e),T(t))}return e?(n,e)=>1:(n,e)=>-1}function b(n,e,t){if(t){if(null==n)return null==e?0:1;if(null==e)return-1}else{if(null==n)return null==e?0:-1;if(null==e)return 1}return null}function V(n){return n?(n,e)=>{const t=b(n,e,!0);return null!=t?t:(n=n.toUpperCase())>(e=e.toUpperCase())?-1:n<e?1:0}:(n,e)=>{const t=b(n,e,!1);return null!=t?t:(n=n.toUpperCase())<(e=e.toUpperCase())?-1:n>e?1:0}}function h(n){return n?(n,e)=>{const t=b(n,e,!0);return null!=t?t:e-n}:(n,e)=>{const t=b(n,e,!1);return null!=t?t:n-e}}function T(n){return n.substr(24,12)+n.substr(19,4)+n.substr(16,2)+n.substr(14,2)+n.substr(11,2)+n.substr(9,2)+n.substr(6,2)+n.substr(4,2)+n.substr(2,2)+n.substr(0,2)}function g(n,e){let t;for(t in n)s.includes(t)&&(Number.isFinite(n[t])||(n[t]=null));return e?(["avg","stddev","variance"].forEach((e=>{null!=n[e]&&(n[e]=Math.ceil(n[e]??0))})),n):n}function x(n){const e={};for(let t of n)(null==t||"string"==typeof t&&""===t.trim())&&(t=null),null==e[t]?e[t]={count:1,data:t}:e[t].count++;return{count:e}}function y(n){return"coded-value"!==n?.type?[]:n.codedValues.map((n=>n.code))}function F(n,e,t,l){const i=n.count,a=[];if(t&&e){const n=[],t=y(e[0]);for(const i of t)if(e[1]){const t=y(e[1]);for(const a of t)if(e[2]){const t=y(e[2]);for(const e of t)n.push(`${c(i)}${l}${c(a)}${l}${c(e)}`)}else n.push(`${c(i)}${l}${c(a)}`)}else n.push(i);for(const e of n)i.hasOwnProperty(e)||(i[e]={data:e,count:0})}for(const r in i){const n=i[r];a.push({value:n.data,count:n.count,label:n.label})}return{uniqueValueInfos:a}}function z(n,e,t,l){let i=null;switch(e){case"log":0!==n&&(i=Math.log(n)*Math.LOG10E);break;case"percent-of-total":Number.isFinite(l)&&0!==l&&(i=n/l*100);break;case"field":Number.isFinite(t)&&0!==t&&(i=n/t);break;case"natural-log":n>0&&(i=Math.log(n));break;case"square-root":n>0&&(i=n**.5)}return i}function D(n,t){const l=N({field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,classificationMethod:t.classificationMethod,standardDeviationInterval:t.standardDeviationInterval,breakCount:t.numClasses||a});return n=I(n,t.minValue,t.maxValue),e({definition:l,values:n,normalizationTotal:t.normalizationTotal})}function I(n,e,t){const l=e??-1/0,i=t??1/0;return n.filter((n=>Number.isFinite(n)&&n>=l&&n<=i))}function N(e){const{breakCount:t,field:a,normalizationField:r,normalizationType:o}=e,u=e.classificationMethod||l,s="standard-deviation"===u?e.standardDeviationInterval||i:void 0;return new n({breakCount:t,classificationField:a,classificationMethod:u,normalizationField:"field"===o?r:void 0,normalizationType:o,standardDeviationInterval:s})}function S(n,e){let t=n.classBreaks;const l=t.length,i=t[0]?.minValue,a=t[l-1]?.maxValue,r="standard-deviation"===e,u=o;return t=t.map((n=>{const e=n.label,t={minValue:n.minValue,maxValue:n.maxValue,label:e};if(r&&e){const n=e.match(u),l=n?.map((n=>+n.trim()))??[];2===l.length?(t.minStdDev=l[0],t.maxStdDev=l[1],l[0]<0&&l[1]>0&&(t.hasAvg=!0)):1===l.length&&(e.includes("<")?(t.minStdDev=null,t.maxStdDev=l[0]):e.includes(">")&&(t.minStdDev=l[0],t.maxStdDev=null))}return t})),{minValue:i,maxValue:a,classBreakInfos:t,normalizationTotal:n.normalizationTotal}}function M(n,e){const t=C(n,e);if(null==t.min&&null==t.max)return{bins:[],minValue:t.min,maxValue:t.max,normalizationTotal:e.normalizationTotal};const l=t.intervals,i=t.min??0,a=t.max??0,r=l.map(((n,e)=>({minValue:l[e][0],maxValue:l[e][1],count:0})));for(const o of n)if(null!=o&&o>=i&&o<=a){const n=k(l,o);n>-1&&r[n].count++}return{bins:r,minValue:i,maxValue:a,normalizationTotal:e.normalizationTotal}}function C(n,e){const{field:t,classificationMethod:l,standardDeviationInterval:i,normalizationType:a,normalizationField:o,normalizationTotal:u,minValue:s,maxValue:c}=e,f=e.numBins||r;let p=null,v=null,b=null;if((!l||"equal-interval"===l)&&!a){if(null!=s&&null!=c)p=s,v=c;else{const e=d({values:n,minValue:s,maxValue:c,useSampleStdDev:!a,supportsNullCount:m({normalizationType:a,normalizationField:o,minValue:s,maxValue:c})});p=e.min??null,v=e.max??null}b=$(p??0,v??0,f)}else{const{classBreaks:e}=D(n,{field:t,normalizationType:a,normalizationField:o,normalizationTotal:u,classificationMethod:l,standardDeviationInterval:i,minValue:s,maxValue:c,numClasses:f});p=e[0].minValue,v=e[e.length-1].maxValue,b=e.map((n=>[n.minValue,n.maxValue]))}return{min:p,max:v,intervals:b}}function k(n,e){let t=-1;for(let l=n.length-1;l>=0;l--){if(e>=n[l][0]){t=l;break}}return t}function $(n,e,t){const l=(e-n)/t,i=[];let a,r=n;for(let o=1;o<=t;o++)a=r+l,a=Number(a.toFixed(16)),i.push([r,o===t?e:a]),r=a;return i}export{D as calculateClassBreaks,M as calculateHistogram,p as calculatePercentile,d as calculateStatistics,f as calculateStringStatistics,x as calculateUniqueValuesCount,N as createClassBreaksDefinition,F as createUVResult,v as getAttributeComparator,$ as getEqualIntervalBins,z as getNormalizedValue,m as isNullCountSupported,c as processNullValue,g as processSummaryStatisticsResult,S as resolveCBResult,s as statisticTypes};
5
+ import n from"../rest/support/ClassBreaksDefinition.js";import{createGenerateRendererClassBreaks as e}from"../rest/support/generateRendererUtils.js";const t="<Null>",l="equal-interval",i=1,a=5,o=10,r=/\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi,u=new Set(["esriFieldTypeDate","esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeOID","esriFieldTypeBigInteger"]),s=new Set(["esriFieldTypeTimeOnly","esriFieldTypeDateOnly"]),m=["min","max","avg","stddev","count","sum","variance","nullcount","median"];function c(n){return null==n||"string"==typeof n&&!n?t:n}function f(n){const e=null!=n.normalizationField||null!=n.normalizationType,t=null!=n.minValue||null!=n.maxValue,l=!!n.sqlExpression&&n.supportsSQLExpression;return!e&&!t&&!l}function d(n){const e=n.returnDistinct?[...new Set(n.values)]:n.values,t=e.filter((n=>null!=n)).sort(),l=t.length,i={count:l,min:t[0],max:t[l-1]};return n.supportsNullCount&&(i.nullcount=e.length-l),n.percentileParams&&(i.median=v(e,n.percentileParams)),i}function p(n){const{values:e,useSampleStdDev:t,supportsNullCount:l}=n;let i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=null,r=null,u=null,s=null,m=0;const c=null==n.minValue?-1/0:n.minValue,f=null==n.maxValue?1/0:n.maxValue;for(const p of e)Number.isFinite(p)?p>=c&&p<=f&&(o=null===o?p:o+p,i=Math.min(i,p),a=Math.max(a,p),m++):"string"==typeof p&&m++;if(m&&null!=o){r=o/m;let n=0;for(const t of e)Number.isFinite(t)&&t>=c&&t<=f&&(n+=(t-r)**2);s=t?m>1?n/(m-1):0:m>0?n/m:0,u=Math.sqrt(s)}else i=null,a=null;const d={avg:r,count:m,max:a,min:i,stddev:u,sum:o,variance:s};return l&&(d.nullcount=e.length-m),n.percentileParams&&(d.median=v(e,n.percentileParams)),d}function v(n,e){const{fieldType:t,value:l,orderBy:i,isDiscrete:a}=e,o=T(t,"desc"===i);if(0===(n=[...n].filter((n=>null!=n)).sort(((n,e)=>o(n,e)))).length)return null;if(l<=0)return n[0];if(l>=1)return n[n.length-1];const r=(n.length-1)*l,u=Math.floor(r),s=u+1,m=r%1,c=n[u],f=n[s];return s>=n.length||a||"string"==typeof c||"string"==typeof f?c:c*(1-m)+f*m}function T(n,e){if(n){if(u.has(n))return S(e);if(s.has(n))return z(e,!1);if("esriFieldTypeTimestampOffset"===n)return x(e);const t=z(e,!0);if("esriFieldTypeString"===n)return t;if("esriFieldTypeGUID"===n||"esriFieldTypeGlobalID"===n)return(n,e)=>t(M(n),M(e))}const t=e?1:-1,l=S(e),i=z(e,!0);return(n,e)=>"number"==typeof n&&"number"==typeof e?l(n,e):"string"==typeof n&&"string"==typeof e?i(n,e):t}const g=(n,e)=>null==n?null==e?0:1:null==e?-1:null,h=(n,e)=>null==n?null==e?0:-1:null==e?1:null;function V(n){return n?g:h}const b=(n,e)=>h(n,e)??(n===e?0:new Date(n).getTime()-new Date(e).getTime()),y=(n,e)=>g(n,e)??(n===e?0:new Date(e).getTime()-new Date(n).getTime());function x(n){return n?y:b}const F=(n,e)=>h(n,e)??(n===e?0:n<e?-1:1),D=(n,e)=>g(n,e)??(n===e?0:n<e?1:-1);function z(n,e){if(!e)return n?D:F;const t=V(n);return n?(n,e)=>{const l=t(n,e);return null!=l?l:(n=n.toUpperCase())>(e=e.toUpperCase())?-1:n<e?1:0}:(n,e)=>{const l=t(n,e);return null!=l?l:(n=n.toUpperCase())<(e=e.toUpperCase())?-1:n>e?1:0}}const I=(n,e)=>g(n,e)??e-n,N=(n,e)=>h(n,e)??n-e;function S(n){return n?I:N}function M(n){return n.substr(24,12)+n.substr(19,4)+n.substr(16,2)+n.substr(14,2)+n.substr(11,2)+n.substr(9,2)+n.substr(6,2)+n.substr(4,2)+n.substr(2,2)+n.substr(0,2)}function C(n,e){let t;for(t in n)m.includes(t)&&(Number.isFinite(n[t])||(n[t]=null));return e?(["avg","stddev","variance"].forEach((e=>{null!=n[e]&&(n[e]=Math.ceil(n[e]??0))})),n):n}function k(n){const e={};for(let t of n)(null==t||"string"==typeof t&&""===t.trim())&&(t=null),null==e[t]?e[t]={count:1,data:t}:e[t].count++;return{count:e}}function w(n){return"coded-value"!==n?.type?[]:n.codedValues.map((n=>n.code))}function $(n,e,t,l){const i=n.count,a=[];if(t&&e){const n=[],t=w(e[0]);for(const i of t)if(e[1]){const t=w(e[1]);for(const a of t)if(e[2]){const t=w(e[2]);for(const e of t)n.push(`${c(i)}${l}${c(a)}${l}${c(e)}`)}else n.push(`${c(i)}${l}${c(a)}`)}else n.push(i);for(const e of n)i.hasOwnProperty(e)||(i[e]={data:e,count:0})}for(const o in i){const n=i[o];a.push({value:n.data,count:n.count,label:n.label})}return{uniqueValueInfos:a}}function B(n,e,t,l){let i=null;switch(e){case"log":0!==n&&(i=Math.log(n)*Math.LOG10E);break;case"percent-of-total":Number.isFinite(l)&&0!==l&&(i=n/l*100);break;case"field":Number.isFinite(t)&&0!==t&&(i=n/t);break;case"natural-log":n>0&&(i=Math.log(n));break;case"square-root":n>0&&(i=n**.5)}return i}function E(n,t){const l=q({field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,classificationMethod:t.classificationMethod,standardDeviationInterval:t.standardDeviationInterval,breakCount:t.numClasses||a});return n=O(n,t.minValue,t.maxValue),e({definition:l,values:n,normalizationTotal:t.normalizationTotal})}function O(n,e,t){const l=e??-1/0,i=t??1/0;return n.filter((n=>Number.isFinite(n)&&n>=l&&n<=i))}function q(e){const{breakCount:t,field:a,normalizationField:o,normalizationType:r}=e,u=e.classificationMethod||l,s="standard-deviation"===u?e.standardDeviationInterval||i:void 0;return new n({breakCount:t,classificationField:a,classificationMethod:u,normalizationField:"field"===r?o:void 0,normalizationType:r,standardDeviationInterval:s})}function P(n,e){let t=n.classBreaks;const l=t.length,i=t[0]?.minValue,a=t[l-1]?.maxValue,o="standard-deviation"===e,u=r;return t=t.map((n=>{const e=n.label,t={minValue:n.minValue,maxValue:n.maxValue,label:e};if(o&&e){const n=e.match(u),l=n?.map((n=>+n.trim()))??[];2===l.length?(t.minStdDev=l[0],t.maxStdDev=l[1],l[0]<0&&l[1]>0&&(t.hasAvg=!0)):1===l.length&&(e.includes("<")?(t.minStdDev=null,t.maxStdDev=l[0]):e.includes(">")&&(t.minStdDev=l[0],t.maxStdDev=null))}return t})),{minValue:i,maxValue:a,classBreakInfos:t,normalizationTotal:n.normalizationTotal}}function U(n,e){const t=G(n,e);if(null==t.min&&null==t.max)return{bins:[],minValue:t.min,maxValue:t.max,normalizationTotal:e.normalizationTotal};const l=t.intervals,i=t.min??0,a=t.max??0,o=l.map(((n,e)=>({minValue:l[e][0],maxValue:l[e][1],count:0})));for(const r of n)if(null!=r&&r>=i&&r<=a){const n=L(l,r);n>-1&&o[n].count++}return{bins:o,minValue:i,maxValue:a,normalizationTotal:e.normalizationTotal}}function G(n,e){const{field:t,classificationMethod:l,standardDeviationInterval:i,normalizationType:a,normalizationField:r,normalizationTotal:u,minValue:s,maxValue:m}=e,c=e.numBins||o;let d=null,v=null,T=null;if((!l||"equal-interval"===l)&&!a){if(null!=s&&null!=m)d=s,v=m;else{const e=p({values:n,minValue:s,maxValue:m,useSampleStdDev:!a,supportsNullCount:f({normalizationType:a,normalizationField:r,minValue:s,maxValue:m})});d=e.min??null,v=e.max??null}T=j(d??0,v??0,c)}else{const{classBreaks:e}=E(n,{field:t,normalizationType:a,normalizationField:r,normalizationTotal:u,classificationMethod:l,standardDeviationInterval:i,minValue:s,maxValue:m,numClasses:c});d=e[0].minValue,v=e[e.length-1].maxValue,T=e.map((n=>[n.minValue,n.maxValue]))}return{min:d,max:v,intervals:T}}function L(n,e){let t=-1;for(let l=n.length-1;l>=0;l--){if(e>=n[l][0]){t=l;break}}return t}function j(n,e,t){const l=(e-n)/t,i=[];let a,o=n;for(let r=1;r<=t;r++)a=o+l,a=Number(a.toFixed(16)),i.push([o,r===t?e:a]),o=a;return i}export{E as calculateClassBreaks,U as calculateHistogram,v as calculatePercentile,p as calculateStatistics,d as calculateStringStatistics,k as calculateUniqueValuesCount,q as createClassBreaksDefinition,$ as createUVResult,T as getAttributeComparator,j as getEqualIntervalBins,B as getNormalizedValue,f as isNullCountSupported,c as processNullValue,C as processSummaryStatisticsResult,P as resolveCBResult,m as statisticTypes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../Basemap.js";import r from"../config.js";import t from"../core/Collection.js";import n from"../core/Logger.js";import{destroyMaybe as a,mappedFind as i}from"../core/maybe.js";import{Url as l,makeAbsolute as s,normalize as u}from"../core/urlUtils.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import{effectEquals as o}from"../layers/effects/utils.js";import{esriBasemapDefinitions as f}from"./basemapDefinitions.js";const p=n.getLogger("esri.support.basemapUtils");function y(){return{}}function m(e){for(const r in e){const t=e[r];a(t),delete e[r]}}function d(t,n){let a;if("string"==typeof t){const i=t in f,l=!i&&t.includes("/");if(!i&&!l){const e=Object.entries(f).filter((([e,t])=>r.apiKey&&!t.classic||!r.apiKey&&(t.classic||t.is3d))).map((([e])=>`"${e}"`)).sort().join(", ");return p.warn(`Unable to find basemap definition for: ${t}. Try one of these: ${e}`),null}n&&(a=n[t]),a||(a=i?e.fromId(t):new e({style:{id:t}}),n&&(n[t]=a))}else a=c(e,t);return a?.destroyed&&(p.warn("The provided basemap is already destroyed",{basemap:a}),a=null),a}function b(e){return"Web Scene"===e.portalItem?.type}function L(e){return!!e?.portalItem?.tags?.map((e=>e.toLowerCase())).includes("beta")}function S(e,r){return e.basemap?.referenceLayers?.some((e=>e.uid===r))||e.basemap?.baseLayers?.some((e=>e.uid===r))}function v(e,r=null){const t=d(e);if(!t)return null;const n=t.clone();return r&&(n.baseLayers=T(n.baseLayers,r.baseLayers),n.referenceLayers=T(n.referenceLayers,r.referenceLayers)),n}let g;function h(e){if(g)return g(e);let r=null;const t=M(e),n=!t?.baseLayers.length;for(const a in f){const e=K(t,$(f[a]),{mustMatchReferences:n});if("equal"===e){r=a;break}"base-layers-equal"===e&&(r=a)}return r}function I(e){g=e}function R(e,r){if(e===r)return!0;if(null!=e?.portalItem?.id&&e.portalItem.id===r?.portalItem?.id)return!0;return"equal"===K(M(e),M(r),{mustMatchReferences:!0})}function T(e,r){const n=new t;return e.forEach((e=>{const t=r.find((r=>"scene"!==r.type&&D(A(e),A(r))))||e;n.includes(t)?n.push(e):n.push(t)})),n}function w(e){return!!e?.baseLayers.concat(e.referenceLayers).some(j)}function j(e){if(x(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const t=e.sourceNameToSource[r];if(x(t?.sourceUrl))return!0}return!1}function U(e,r){if(null==r||null==e)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const t=r.baseLayers.at(0);switch(t.loadStatus){case"not-loaded":t.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const n=(("supportedSpatialReferences"in t?t.supportedSpatialReferences:null)||["tileInfo"in t?t.tileInfo?.spatialReference:t.spatialReference]).filter(Boolean),a=e.spatialReference;return a?{spatialReference:n.find((e=>a.equals(e)))??n[0]??null,updating:!1}:{spatialReference:n[0],updating:!1}}const q=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function x(e){if(!e)return!1;const r=new l(s(e));return!!r.authority&&q.test(r.authority)}function M(e){return e?!e.loaded&&e.resourceInfo?$(e.resourceInfo.data):{baseLayers:k(e.baseLayers),referenceLayers:k(e.referenceLayers)}:null}function k(e){return(t.isCollection(e)?e.toArray():e).map(A)}function A(e){return{type:e.type,effect:"effect"in e?e.effect:void 0,url:E("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl||""),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||null==e.sublayers?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function C(e){return e.isReference||"ArcGISSceneServiceLayer"===e.layerType}function $(e){return e?{baseLayers:G((e.baseMapLayers??[]).filter((e=>!C(e)))),referenceLayers:G((e.baseMapLayers??[]).filter((e=>C(e))))}:null}function G(e){return e.map((e=>B(e)))}function B(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;case"ArcGISSceneServiceLayer":r="scene";break;default:r="unknown"}return{type:r,effect:e.effect,url:E(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:e.minScale??0,maxScale:e.maxScale??0,opacity:e.opacity??1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function K(e,r,t){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!N(e.baseLayers,r.baseLayers))return"not-equal";return N(e.referenceLayers,r.referenceLayers)?"equal":t.mustMatchReferences?"not-equal":"base-layers-equal"}function N(e,r){if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!D(e[t],r[t]))return!1;return!0}function D(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(!o(e.effect,r.effect))return!1;if(null!=e.activeLayerId||null!=r.activeLayerId)return e.activeLayerId===r.activeLayerId;if(null!=e.sublayers||null!=r.sublayers){if(null==e.sublayers||null==r.sublayers||e.sublayers.length!==r.sublayers.length)return!1;for(let t=0;t<e.sublayers.length;t++){const n=e.sublayers.at(t),a=r.sublayers.at(t);if(n?.id!==a?.id||n?.visible!==a?.visible)return!1}}return!0}function E(e){return e?u(e).replace(/^\s*https?:/i,"").toLowerCase():""}function O(e){if(!e)return null;const{thumbnailUrl:r}=e;if(r)return r;const t=h(e);return t?f[t].thumbnailUrl:i(e.baseLayers,V)}function V(e){return"portalItem"in e?e.portalItem?.thumbnailUrl:void 0}export{v as clonePreservingTiledLayers,R as contentEquals,y as createCache,m as destroyCache,d as ensureType,U as findSpatialReference,O as getBasemapThumbnailUrl,h as getWellKnownBasemapId,w as hasDeveloperBasemapLayer,b as isBasemap3D,L as isBasemapInBeta,S as isBasemapLayer,j as isDeveloperBasemapLayer,I as overrideGetWellKnownBasemapId};
5
+ import e from"../Basemap.js";import r from"../config.js";import t from"../core/Collection.js";import n from"../core/Logger.js";import{destroyMaybe as a,mappedFind as i}from"../core/maybe.js";import{Url as l,makeAbsolute as s,normalize as u}from"../core/urlUtils.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import{effectEquals as o}from"../layers/effects/utils.js";import{esriBasemapDefinitions as f}from"./basemapDefinitions.js";const p=n.getLogger("esri.support.basemapUtils");function y(){return{}}function m(e){for(const r in e){const t=e[r];a(t),delete e[r]}}function b(t,n){let a;if("string"==typeof t){const i=t in f,l=!i&&t.includes("/");if(!i&&!l){const e=Object.entries(f).filter((([e,t])=>r.apiKey&&!t.classic||!r.apiKey&&(t.classic||t.is3d))).map((([e])=>`"${e}"`)).sort().join(", ");return p.warn(`Unable to find basemap definition for: ${t}. Try one of these: ${e}`),null}n&&(a=n[t]),a||(a=i?e.fromId(t):new e({style:{id:t}}),n&&(n[t]=a))}else a=c(e,t);return a?.destroyed&&(p.warn("The provided basemap is already destroyed",{basemap:a}),a=null),a}function d(e){return"Web Scene"===e.portalItem?.type}function L(e){return!!e?.portalItem?.tags?.some((e=>"beta"===e.toLowerCase()))}function S(e,r){return e.basemap?.referenceLayers?.some((e=>e.uid===r))||e.basemap?.baseLayers?.some((e=>e.uid===r))}function v(e,r=null){const t=b(e);if(!t)return null;const n=t.clone();return r&&(n.baseLayers=T(n.baseLayers,r.baseLayers),n.referenceLayers=T(n.referenceLayers,r.referenceLayers)),n}let g;function h(e){if(g)return g(e);let r=null;const t=M(e),n=!t?.baseLayers.length;for(const a in f){const e=K(t,$(f[a]),{mustMatchReferences:n});if("equal"===e){r=a;break}"base-layers-equal"===e&&(r=a)}return r}function I(e){g=e}function R(e,r){if(e===r)return!0;if(null!=e?.portalItem?.id&&e.portalItem.id===r?.portalItem?.id)return!0;return"equal"===K(M(e),M(r),{mustMatchReferences:!0})}function T(e,r){const n=new t;return e.forEach((e=>{const t=r.find((r=>"scene"!==r.type&&D(A(e),A(r))))||e;n.includes(t)?n.push(e):n.push(t)})),n}function w(e){return!!e?.baseLayers.concat(e.referenceLayers).some(j)}function j(e){if(x(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const t=e.sourceNameToSource[r];if(x(t?.sourceUrl))return!0}return!1}function U(e,r){if(null==r||null==e)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const t=r.baseLayers.at(0);switch(t.loadStatus){case"not-loaded":t.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const n=(("supportedSpatialReferences"in t?t.supportedSpatialReferences:null)||["tileInfo"in t?t.tileInfo?.spatialReference:t.spatialReference]).filter(Boolean),a=e.spatialReference;return a?{spatialReference:n.find((e=>a.equals(e)))??n[0]??null,updating:!1}:{spatialReference:n[0],updating:!1}}const q=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function x(e){if(!e)return!1;const r=new l(s(e));return!!r.authority&&q.test(r.authority)}function M(e){return e?!e.loaded&&e.resourceInfo?$(e.resourceInfo.data):{baseLayers:k(e.baseLayers),referenceLayers:k(e.referenceLayers)}:null}function k(e){return(t.isCollection(e)?e.toArray():e).map(A)}function A(e){return{type:e.type,effect:"effect"in e?e.effect:void 0,url:E("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl||""),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||null==e.sublayers?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function C(e){return e.isReference||"ArcGISSceneServiceLayer"===e.layerType}function $(e){return e?{baseLayers:G((e.baseMapLayers??[]).filter((e=>!C(e)))),referenceLayers:G((e.baseMapLayers??[]).filter((e=>C(e))))}:null}function G(e){return e.map((e=>B(e)))}function B(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;case"ArcGISSceneServiceLayer":r="scene";break;default:r="unknown"}return{type:r,effect:e.effect,url:E(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:e.minScale??0,maxScale:e.maxScale??0,opacity:e.opacity??1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function K(e,r,t){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!N(e.baseLayers,r.baseLayers))return"not-equal";return N(e.referenceLayers,r.referenceLayers)?"equal":t.mustMatchReferences?"not-equal":"base-layers-equal"}function N(e,r){if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!D(e[t],r[t]))return!1;return!0}function D(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(!o(e.effect,r.effect))return!1;if(null!=e.activeLayerId||null!=r.activeLayerId)return e.activeLayerId===r.activeLayerId;if(null!=e.sublayers||null!=r.sublayers){if(null==e.sublayers||null==r.sublayers||e.sublayers.length!==r.sublayers.length)return!1;for(let t=0;t<e.sublayers.length;t++){const n=e.sublayers.at(t),a=r.sublayers.at(t);if(n?.id!==a?.id||n?.visible!==a?.visible)return!1}}return!0}function E(e){return e?u(e).replace(/^\s*https?:/i,"").toLowerCase():""}function O(e){if(!e)return null;const{thumbnailUrl:r}=e;if(r)return r;const t=h(e);return t?f[t].thumbnailUrl:i(e.baseLayers,V)}function V(e){return"portalItem"in e?e.portalItem?.thumbnailUrl:void 0}export{v as clonePreservingTiledLayers,R as contentEquals,y as createCache,m as destroyCache,b as ensureType,U as findSpatialReference,O as getBasemapThumbnailUrl,h as getWellKnownBasemapId,w as hasDeveloperBasemapLayer,d as isBasemap3D,L as isBasemapInBeta,S as isBasemapLayer,j as isDeveloperBasemapLayer,I as overrideGetWellKnownBasemapId};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const e="20231018",f="e24989861d68ed5ec13f4f100e212ee98f9d370f";export{e as buildDate,f as commitHash};
5
+ const c="20231023",d="ff64aa17ecd4e5f93d69c581f360d899c18525d4";export{c as buildDate,d as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{c as e}from"../../../chunks/mat3f32.js";import{EffectView as t}from"../../../layers/effects/EffectView.js";import{DisplayObject as i}from"./DisplayObject.js";import s from"./webgl/effects/highlight/HighlightGradient.js";class h extends i{constructor(){super(...arguments),this._childrenSet=new Set,this._needsSort=!1,this.children=[],this._effectView=null,this._highlightOptions=null,this._highlightGradient=null}get blendMode(){return this._blendMode}set blendMode(e){this._blendMode=e,this.requestRender()}get clips(){return this._clips}set clips(e){this._clips=e,this.children.forEach((t=>t.clips=e))}get computedEffects(){return this._effectView?.effects??null}get effect(){return this._effectView?.effect??""}set effect(e){(this._effectView||e)&&(this._effectView||(this._effectView=new t),this._effectView.effect=e,this.requestRender())}get highlightOptions(){return this._highlightOptions}set highlightOptions(e){if(!e)return this._highlightOptions=null,void(this._highlightGradient&&(this._highlightGradient.destroy(),this._highlightGradient=null,this.requestRender()));this._highlightOptions&&this._highlightOptions.equals(e)||(this._highlightOptions=e,this._highlightGradient||(this._highlightGradient=new s),this._highlightGradient.setHighlightOptions(e),this.requestRender())}get hasBlending(){return!!this.blendMode}get hasHighlight(){return this.children.some((e=>e.hasHighlight))}get hasLabels(){return this.children.some((e=>e.hasLabels))}get requiresDedicatedFBO(){return this.children.some((e=>"blendMode"in e&&e.blendMode&&"normal"!==e.blendMode))}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._effectView&&(this._effectView.transitionStep(e,t),this._effectView.transitioning&&this.requestRender())}doRender(e){const t=this.createRenderParams(e),{painter:i}=t;i.beforeRenderLayer(t,this._clips?255:0,this.computedOpacity),this.renderChildren(t),i.afterRenderLayer(t,this.computedOpacity)}addChild(e){return this.addChildAt(e,this.children.length)}addChildAt(e,t=this.children.length){if(!e)return e;if(this.contains(e))return e;this._needsSort=!0;const i=e.parent;return i&&i!==this&&i.removeChild(e),t>=this.children.length?this.children.push(e):this.children.splice(t,0,e),this._childrenSet.add(e),e.parent=this,e.stage=this.stage,this!==this.stage&&(e.clips=this.clips),this.requestRender(),e}contains(e){return this._childrenSet.has(e)}endTransitions(){super.endTransitions(),this._effectView&&(this._effectView.endTransitions(),this.requestRender())}removeAllChildren(){this._childrenSet.clear(),this._needsSort=!0;for(const e of this.children)this!==this.stage&&(e.clips=null),e.stage=null,e.parent=null;this.children.length=0}removeChild(e){return this.contains(e)?this.removeChildAt(this.children.indexOf(e)):e}removeChildAt(e){if(e<0||e>=this.children.length)return null;this._needsSort=!0;const t=this.children.splice(e,1)[0];return this._childrenSet.delete(t),this!==this.stage&&(t.clips=null),t.stage=null,t.parent=null,t}sortChildren(e){this._needsSort&&(this.children.sort(e),this._needsSort=!1)}beforeRender(e){super.beforeRender(e);for(const t of this.children)t.beforeRender(e)}afterRender(e){super.afterRender(e);for(const t of this.children)t.afterRender(e)}_createTransforms(){return{dvs:e()}}onAttach(){super.onAttach();const e=this.stage;for(const t of this.children)t.stage=e}onDetach(){super.onDetach();for(const e of this.children)e.stage=null}renderChildren(e){for(const t of this.children)t.processRender(e)}createRenderParams(e){return{...e,requireFBO:this.requiresDedicatedFBO,blendMode:this.blendMode,effects:this.computedEffects,globalOpacity:e.globalOpacity*this.computedOpacity,inFadeTransition:this.inFadeTransition,highlightGradient:this._highlightGradient||e.highlightGradient}}}export{h as Container};
5
+ import{c as e}from"../../../chunks/mat3f32.js";import{EffectView as t}from"../../../layers/effects/EffectView.js";import{DisplayObject as i}from"./DisplayObject.js";import s from"./webgl/effects/highlight/HighlightGradient.js";class h extends i{constructor(){super(...arguments),this._childrenSet=new Set,this._needsSort=!1,this.children=[],this._effectView=null,this._highlightOptions=null,this._highlightGradient=null}get blendMode(){return this._blendMode}set blendMode(e){this._blendMode=e,this.requestRender()}get clips(){return this._clips}set clips(e){this._clips=e,this.children.forEach((t=>t.clips=e))}get computedEffects(){return this._effectView?.effects??null}get effect(){return this._effectView?.effect??""}set effect(e){(this._effectView||e)&&(this._effectView||(this._effectView=new t),this._effectView.effect=e,this.requestRender())}get highlightOptions(){return this._highlightOptions}set highlightOptions(e){if(!e)return this._highlightOptions=null,void(this._highlightGradient&&(this._highlightGradient.destroy(),this._highlightGradient=null,this.requestRender()));this._highlightOptions&&this._highlightOptions.equals(e)||(this._highlightOptions=e,this._highlightGradient||(this._highlightGradient=new s),this._highlightGradient.setHighlightOptions(e),this.requestRender())}get hasBlending(){return!!this.blendMode}get hasHighlight(){return this.children.some((e=>e.hasHighlight))}get hasLabels(){return this.children.some((e=>e.hasLabels))}get requiresDedicatedFBO(){return this.children.some((e=>"blendMode"in e&&e.blendMode&&"normal"!==e.blendMode))}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._effectView&&(this._effectView.transitionStep(e,t),this._effectView.transitioning&&this.requestRender())}doRender(e){const t=this.createRenderParams(e),{painter:i}=t;i.beforeRenderLayer(t,this._clips?.length?255:0,this.computedOpacity),this.renderChildren(t),i.afterRenderLayer(t,this.computedOpacity)}addChild(e){return this.addChildAt(e,this.children.length)}addChildAt(e,t=this.children.length){if(!e)return e;if(this.contains(e))return e;this._needsSort=!0;const i=e.parent;return i&&i!==this&&i.removeChild(e),t>=this.children.length?this.children.push(e):this.children.splice(t,0,e),this._childrenSet.add(e),e.parent=this,e.stage=this.stage,this!==this.stage&&(e.clips=this.clips),this.requestRender(),e}contains(e){return this._childrenSet.has(e)}endTransitions(){super.endTransitions(),this._effectView&&(this._effectView.endTransitions(),this.requestRender())}removeAllChildren(){this._childrenSet.clear(),this._needsSort=!0;for(const e of this.children)this!==this.stage&&(e.clips=null),e.stage=null,e.parent=null;this.children.length=0}removeChild(e){return this.contains(e)?this.removeChildAt(this.children.indexOf(e)):e}removeChildAt(e){if(e<0||e>=this.children.length)return null;this._needsSort=!0;const t=this.children.splice(e,1)[0];return this._childrenSet.delete(t),this!==this.stage&&(t.clips=null),t.stage=null,t.parent=null,t}sortChildren(e){this._needsSort&&(this.children.sort(e),this._needsSort=!1)}beforeRender(e){super.beforeRender(e);for(const t of this.children)t.beforeRender(e)}afterRender(e){super.afterRender(e);for(const t of this.children)t.afterRender(e)}_createTransforms(){return{dvs:e()}}onAttach(){super.onAttach();const e=this.stage;for(const t of this.children)t.stage=e}onDetach(){super.onDetach();for(const e of this.children)e.stage=null}renderChildren(e){for(const t of this.children)t.processRender(e)}createRenderParams(e){return{...e,requireFBO:this.requiresDedicatedFBO,blendMode:this.blendMode,effects:this.computedEffects,globalOpacity:e.globalOpacity*this.computedOpacity,inFadeTransition:this.inFadeTransition,highlightGradient:this._highlightGradient||e.highlightGradient}}}export{h as Container};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{multiplyOpacity as t,getContrast as r}from"../../../../core/colorUtils.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as n}from"./sliceToolUtils.js";import{Manipulator3D as s}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as l}from"../../interactive/manipulatorUtils.js";import{RenderObject as a}from"../../interactive/RenderObject.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as m}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as u}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as d}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as p}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as f}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as b}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as w}from"../../../interactive/interfaces.js";class g extends s{constructor(n,s){const a=new f({transparent:!0,writeDepth:!1,renderOccluded:d.Opaque,isDecoration:!0}),c=l.calloutWidth,m=new b({width:c,renderOccluded:d.OccludeAndTransparent,isDecoration:!0});super({view:n,...j({imageMaterial:a,calloutMaterial:m})}),this._currentTexture=null,this._themeHandle=i((()=>n.effectiveTheme),(({accentColor:i})=>{const o=t(i,.5),n=r(i),l=this._currentTexture,c=s(o,n);a.setParameters({textureId:c.texture.id}),m.setParameters({color:e.toUnitRGBA(i)}),this._currentTexture=c,l?.release()}),o)}destroy(){this._themeHandle.remove(),this._currentTexture?.release(),super.destroy()}}function j({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=l,s=o*r,d=(e,t)=>{const r=[0,1,2,2,3,0];return new m(t,[[p.POSITION,new c([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[p.UV0,new c([0,0,1,0,1,1,0,1],r,2,!0)]])},f=u(t,[[0,0,0],[i-o,0,0]]),b=u(t,[[0,0,0],[i-s,0,0]]),g=n;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new a(d(o,e),w.Unfocused|g),new a(f,w.Unfocused|g),new a(d(s,e),w.Focused|g),new a(b,w.Focused|g)],state:g}}export{g as RotateManipulator};
5
+ import e from"../../../../Color.js";import{multiplyOpacity as t,getContrast as r}from"../../../../core/colorUtils.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as n}from"./sliceToolUtils.js";import{Manipulator3D as s}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as l}from"../../interactive/manipulatorUtils.js";import{RenderObject as a}from"../../interactive/RenderObject.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as m}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as u}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as d}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as p}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as f}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as b}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as w}from"../../../interactive/interfaces.js";class g extends s{constructor(n,s){const a=new f({transparent:!0,writeDepth:!1,renderOccluded:d.Opaque,isDecoration:!0}),c=l.calloutWidth,m=new b({width:c,renderOccluded:d.OccludeAndTransparent,isDecoration:!0});super({view:n,...j({imageMaterial:a,calloutMaterial:m})}),this._currentTexture=null,this._themeHandle=i((()=>n.effectiveTheme.accentColor),(i=>{const o=t(i,.5),n=r(i),l=this._currentTexture,c=s(o,n);a.setParameters({textureId:c.texture.id}),m.setParameters({color:e.toUnitRGBA(i)}),this._currentTexture=c,l?.release()}),o)}destroy(){this._themeHandle.remove(),this._currentTexture?.release(),super.destroy()}}function j({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=l,s=o*r,d=(e,t)=>{const r=[0,1,2,2,3,0];return new m(t,[[p.POSITION,new c([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[p.UV0,new c([0,0,1,0,1,1,0,1],r,2,!0)]])},f=u(t,[[0,0,0],[i-o,0,0]]),b=u(t,[[0,0,0],[i-s,0,0]]),g=n;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new a(d(o,e),w.Unfocused|g),new a(f,w.Unfocused|g),new a(d(s,e),w.Focused|g),new a(b,w.Focused|g)],state:g}}export{g as RotateManipulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{g as n,w as s,b as a,F as i,m as c}from"../../../../chunks/mat4.js";import{a as l}from"../../../../chunks/mat4f64.js";import{r as m}from"../../../../chunks/quat.js";import{f as u,n as p,i as f,g as d,s as g}from"../../../../chunks/vec3.js";import{c as h,f as b}from"../../../../chunks/vec3f64.js";import{sv3d as j,sm4d as O,sq4d as w}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as M,shiftRestartTipRadius as R,shiftRestartTipLength as v,shiftRestartArrowOutlineWidth as C,shiftRestartArrowLength as T,shiftRestartTubeRadius as U,shiftRestartTubeFocusMultiplier as _,shiftRestartTipFocusMultiplier as A}from"./sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as E,IsShiftEdgeOnScreenFlag as N}from"./sliceToolUtils.js";import{Manipulator3D as k}from"../../interactive/Manipulator3D.js";import{RenderObject as F}from"../../interactive/RenderObject.js";import{CullFaceOptions as y}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as B,createConeGeometry as D,createPathExtrusionGeometry as L}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as P}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as G}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as q}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as x}from"../../../interactive/interfaces.js";var H;!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(H||(H={}));class I extends k{constructor(n,s){const a=new q({width:1,renderOccluded:P.OccludeAndTransparent,isDecoration:!0}),i=new G({cullFace:y.Back,renderOccluded:P.Opaque,isDecoration:!0}),c=new G({cullFace:y.Back,renderOccluded:P.Opaque,isDecoration:!0}),l=new G({cullFace:y.Back,renderOccluded:P.Opaque,isDecoration:!0}),m=new G({writeDepth:!1,cullFace:y.Front,renderOccluded:P.Transparent,isDecoration:!0});super({view:n,...S({offsetMode:s,tubeMaterial:i,tipMaterial:c,capMaterial:l,outlineMaterial:m,calloutMaterial:a})}),this._themeHandle=r((()=>n.effectiveTheme),(({accentColor:r})=>{const o=t(r),n=e.toUnitRGBA(r),s=e.toUnitRGBA(o),u=e.toUnitRGBA(e.blendColors(o,r,.4)),p=e.toUnitRGBA(e.blendColors(o,r,.14));a.setParameters({color:n}),i.setParameters({color:p}),c.setParameters({color:s}),l.setParameters({color:u}),m.setParameters({color:n})}),o)}destroy(){this._themeHandle.remove(),super.destroy()}}function S({offsetMode:e,tubeMaterial:t,tipMaterial:r,capMaterial:o,outlineMaterial:n,calloutMaterial:s}){const a=e===H.CENTER_ON_CALLOUT?M:0,i=[b(a,0,-T/2),b(a,0,T/2)],c=J(i,!0),l=W({vertices:i,padding:0,materials:{tube:t,tip:r,cap:o}}),m=W({vertices:i,padding:C,materials:{tube:n,tip:n,cap:n}}),u=B(s,[[a,0,0],[a-M,0,0]]),p=B(s,[[a,0,0],[a-M,0,0]]);return{renderObjects:[...l.normal.map((e=>new F(e,x.Unfocused|E))),...m.normal.map((e=>new F(e,x.Unfocused|E))),new F(u,x.Unfocused|E|N),...l.focused.map((e=>new F(e,x.Focused|E))),...m.focused.map((e=>new F(e,x.Focused|E))),new F(p,x.Focused|E|N)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[c]},collisionPriority:1,radius:R,state:E}}function W({vertices:e,padding:t,materials:r}){const o=o=>{const M=e.slice(0),C=u(j.get(),M[0],M[1]);p(C,C);const T=u(j.get(),M[M.length-1],M[M.length-2]);if(p(T,T),t>0){const e=f(h(),T,-t);M[M.length-1]=d(e,e,M[M.length-1]);const r=f(h(),C,-t);M[0]=d(r,r,M[0])}const E=o?A:1,N=v*E,k=R*E,F=n(O.get());if(t>0){const e=N/4,r=g(j.get(),0,e,0),o=1+t/e;s(F,F,r),a(F,F,g(j.get(),o,o,o)),s(F,F,f(r,r,-1/o))}const y=n(l()),B=b(0,1,0),L=i(l(),m(w.get(),B,T));L[12]=M[M.length-1][0],L[13]=M[M.length-1][1],L[14]=M[M.length-1][2],c(L,L,F);const P=r.tube,G=z(U*(o?_:1)+t,M,P);G.transformation=y;const q=[G],x=r.tip,H=D(x,N,k,24,!1,!1,!0);H.transformation=L,q.push(H);const I=r.cap,S=D(I,N,k,24,!1,!0,!1);S.transformation=L,q.push(S);const W=i(l(),m(w.get(),B,C));return W[12]=M[0][0],W[13]=M[0][1],W[14]=M[0][2],c(W,W,F),q.push(H.instantiate({transformation:W})),q.push(S.instantiate({transformation:W})),q};return{normal:o(!1),focused:o(!0)}}function z(e,t,r){const o=[],n=12;for(let s=0;s<n;s++){const t=s/n*2*Math.PI;o.push([Math.cos(t)*e,Math.sin(t)*e])}return L(r,o,t,[],[],!1)}function J(e,t){const r=u(h(),e[e.length-1],e[e.length-2]);if(p(r,r),f(r,r,v),d(r,r,e[e.length-1]),t){const t=u(h(),e[0],e[1]);return p(t,t),f(t,t,v),d(t,t,e[0]),[t,...e,r]}return[...e,r]}export{H as OffsetMode,I as ShiftManipulator};
5
+ import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{g as n,w as s,b as a,F as i,m as c}from"../../../../chunks/mat4.js";import{a as l}from"../../../../chunks/mat4f64.js";import{r as m}from"../../../../chunks/quat.js";import{f as u,n as p,i as f,g as d,s as g}from"../../../../chunks/vec3.js";import{c as h,f as b}from"../../../../chunks/vec3f64.js";import{sv3d as j,sm4d as O,sq4d as w}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as M,shiftRestartTipRadius as R,shiftRestartTipLength as v,shiftRestartArrowOutlineWidth as C,shiftRestartArrowLength as T,shiftRestartTubeRadius as U,shiftRestartTubeFocusMultiplier as _,shiftRestartTipFocusMultiplier as A}from"./sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as E,IsShiftEdgeOnScreenFlag as N}from"./sliceToolUtils.js";import{Manipulator3D as k}from"../../interactive/Manipulator3D.js";import{RenderObject as F}from"../../interactive/RenderObject.js";import{CullFaceOptions as y}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as B,createConeGeometry as D,createPathExtrusionGeometry as L}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as P}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as G}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as q}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as x}from"../../../interactive/interfaces.js";var H;!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(H||(H={}));class I extends k{constructor(n,s){const a=new q({width:1,renderOccluded:P.OccludeAndTransparent,isDecoration:!0}),i=new G({cullFace:y.Back,renderOccluded:P.Opaque,isDecoration:!0}),c=new G({cullFace:y.Back,renderOccluded:P.Opaque,isDecoration:!0}),l=new G({cullFace:y.Back,renderOccluded:P.Opaque,isDecoration:!0}),m=new G({writeDepth:!1,cullFace:y.Front,renderOccluded:P.Transparent,isDecoration:!0});super({view:n,...S({offsetMode:s,tubeMaterial:i,tipMaterial:c,capMaterial:l,outlineMaterial:m,calloutMaterial:a})}),this._themeHandle=r((()=>n.effectiveTheme.accentColor),(r=>{const o=t(r),n=e.toUnitRGBA(r),s=e.toUnitRGBA(o),u=e.toUnitRGBA(e.blendColors(o,r,.4)),p=e.toUnitRGBA(e.blendColors(o,r,.14));a.setParameters({color:n}),i.setParameters({color:p}),c.setParameters({color:s}),l.setParameters({color:u}),m.setParameters({color:n})}),o)}destroy(){this._themeHandle.remove(),super.destroy()}}function S({offsetMode:e,tubeMaterial:t,tipMaterial:r,capMaterial:o,outlineMaterial:n,calloutMaterial:s}){const a=e===H.CENTER_ON_CALLOUT?M:0,i=[b(a,0,-T/2),b(a,0,T/2)],c=J(i,!0),l=W({vertices:i,padding:0,materials:{tube:t,tip:r,cap:o}}),m=W({vertices:i,padding:C,materials:{tube:n,tip:n,cap:n}}),u=B(s,[[a,0,0],[a-M,0,0]]),p=B(s,[[a,0,0],[a-M,0,0]]);return{renderObjects:[...l.normal.map((e=>new F(e,x.Unfocused|E))),...m.normal.map((e=>new F(e,x.Unfocused|E))),new F(u,x.Unfocused|E|N),...l.focused.map((e=>new F(e,x.Focused|E))),...m.focused.map((e=>new F(e,x.Focused|E))),new F(p,x.Focused|E|N)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[c]},collisionPriority:1,radius:R,state:E}}function W({vertices:e,padding:t,materials:r}){const o=o=>{const M=e.slice(0),C=u(j.get(),M[0],M[1]);p(C,C);const T=u(j.get(),M[M.length-1],M[M.length-2]);if(p(T,T),t>0){const e=f(h(),T,-t);M[M.length-1]=d(e,e,M[M.length-1]);const r=f(h(),C,-t);M[0]=d(r,r,M[0])}const E=o?A:1,N=v*E,k=R*E,F=n(O.get());if(t>0){const e=N/4,r=g(j.get(),0,e,0),o=1+t/e;s(F,F,r),a(F,F,g(j.get(),o,o,o)),s(F,F,f(r,r,-1/o))}const y=n(l()),B=b(0,1,0),L=i(l(),m(w.get(),B,T));L[12]=M[M.length-1][0],L[13]=M[M.length-1][1],L[14]=M[M.length-1][2],c(L,L,F);const P=r.tube,G=z(U*(o?_:1)+t,M,P);G.transformation=y;const q=[G],x=r.tip,H=D(x,N,k,24,!1,!1,!0);H.transformation=L,q.push(H);const I=r.cap,S=D(I,N,k,24,!1,!0,!1);S.transformation=L,q.push(S);const W=i(l(),m(w.get(),B,C));return W[12]=M[0][0],W[13]=M[0][1],W[14]=M[0][2],c(W,W,F),q.push(H.instantiate({transformation:W})),q.push(S.instantiate({transformation:W})),q};return{normal:o(!1),focused:o(!0)}}function z(e,t,r){const o=[],n=12;for(let s=0;s<n;s++){const t=s/n*2*Math.PI;o.push([Math.cos(t)*e,Math.sin(t)*e])}return L(r,o,t,[],[],!1)}function J(e,t){const r=u(h(),e[e.length-1],e[e.length-2]);if(p(r,r),f(r,r,v),d(r,r,e[e.length-1]),t){const t=u(h(),e[0],e[1]);return p(t,t),f(t,t,v),d(t,t,e[0]),[t,...e,r]}return[...e,r]}export{H as OffsetMode,I as ShiftManipulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../Color.js";import{multiplyOpacityToUnitRGBA as e,colorEquals as i,getContrast as s}from"../../../../../core/colorUtils.js";import a from"../../../../../core/Handles.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as r,sync as l}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as o}from"../../../../../core/screenUtils.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{Manipulator3D as _}from"../../Manipulator3D.js";import{createSphereManipulator as u,createManipulatorMaterial as d}from"../../manipulatorUtils.js";import{RenderObject as p}from"../../RenderObject.js";import{PickResult as c}from"../support/PickRequest.js";import{LaserlineVisualElement as m}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as g}from"../../../webgl-engine/lib/GeometryUtil.js";import{newIntersector as w}from"../../../webgl-engine/lib/Intersector.js";import{StoreResults as v}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{ManipulatorCollection as f}from"../../../../interactive/ManipulatorCollection.js";class y{constructor(t){this.vertexManipulators=[],this._destroyed=!1,this._isManipulatorsOwner=!0,this._visible=!0,this._laserLine=null,this._cursorManipulator=null,this._listenerHandles=null,this._tempHandlePosition=h();const{analysisViewData:e,manipulators:i,toolState:s,view:a,visible:n}=t;this._analysisViewData=e,this._toolState=s,null!=i?(this._manipulators=i,this._isManipulatorsOwner=!1):this._manipulators=new f,this._view=a,this._intersector=w(a.state.viewingMode),this._intersector.options.store=v.MIN;const r=u(a,this._handleColor);r.available=!1,r.radius=L,r.interactive=!1,this._manipulators.add(r),this._cursorManipulator=r,this._laserLine=new m({view:a,attached:!0,style:{glowWidth:b,glowFalloff:D,innerWidth:M},isDecoration:!0}),this._updateVisibility(n??!0)}destroy(){this._listenerHandles=n(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=n(this._manipulators):this._manipulators=null,this._laserLine=n(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._visible}set visible(t){t?this.show():this.hide()}get testData(){const t=this._laserLine.testData;return{laserLineRenderer:null!=t?{heightManifoldEnabled:t.heightManifoldEnabled,heightManifoldTarget:t.heightManifoldTarget,pointDistanceEnabled:t.pointDistanceEnabled,pointDistanceOrigin:t.pointDistanceOrigin,pointDistanceTarget:t.pointDistanceTarget,lineVerticalPlaneEnabled:t.lineVerticalPlaneEnabled}:{heightManifoldEnabled:!1,heightManifoldTarget:null,pointDistanceEnabled:!1,pointDistanceOrigin:null,pointDistanceTarget:null,lineVerticalPlaneEnabled:!1}}}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(t){this._destroyed||this._visible===t||this._updateVisibility(t)}_updateVisibility(t){this._visible=t,this._laserLine.visible=t,t?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach((({manipulator:t})=>this._removeVertexManipulator(t))),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(t,e){const i=this._manipulators.intersect(t,e);return i?.metadata}pick(t){const e=this._view.spatialReference,i=o(t.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(i,this._intersector);const s=this._intersector.results.min,a=h();if(!s.getIntersectionPoint(a))return null;const n=this._view.renderCoordsHelper.fromRenderCoords(a,e);return null==n?null:new c(a,n)}_updateAll(){this._visible&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const t=d(this._handleColor),e=[new p(g(t,1,32,32))],i=new _({view:this._view,renderObjects:e});return i.radius=L,this._manipulators.add(i),{manipulator:i,material:t}}_removeVertexManipulator(t){this._manipulators.remove(t)}_updateVertexManipulators(){const{viewData:t}=this._analysisViewData,e=this._analysisViewData.path?this._analysisViewData.path.vertices:[],i=this.vertexManipulators;V(i,e.length,(()=>this._createVertexManipulator()),(({manipulator:t})=>this._removeVertexManipulator(t))),i.forEach((({manipulator:i},s)=>{i.metadata=e[s],i.renderLocation=t.positionsRenderCoords[s],i.cursor=0===s&&"drawing"===this._toolState.polygonState?"crosshair":null})),"drawing"===this._toolState.polygonState&&null!=this._analysisViewData.stagedPoint?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisViewData.stagedPoint):this._cursorManipulator.available=!1}get _handleColor(){return e(this._view.effectiveTheme.accentColor,.5)}_getFocusPoint(){const{lastDraggedVertex:t}=this._analysisViewData;switch(this._toolState.polygonState){case"drawing":return null!=this._analysisViewData.stagedPoint?this._analysisViewData.stagedPoint:null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):this._analysisViewData.path.lastPoint;case"editing":return null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):null;default:return this._analysisViewData.stagedPoint}}_updateLaserLine(){const t="measured"!==this._toolState.polygonState&&this._toolState.active,e=this._getFocusPoint();if(t&&null!=e){const t=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(e,t),this._laserLine.heightManifoldTarget=t}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new a,this._listenerHandles.add([r((()=>this._toolState.polygonState),(()=>this._updateLaserLine())),r((()=>this._analysisViewData.viewData),(()=>this._updateAll()),l),r((()=>({lastDraggedVertex:this._analysisViewData.lastDraggedVertex,cursorPoint:this._analysisViewData.stagedPoint})),(()=>this._updateLaserLine())),r((()=>this._toolState.active),(()=>this._updateAll())),r((()=>this._view.effectiveTheme.accentColor),(i=>{const a=e(i,.5);for(const{material:t}of this.vertexManipulators)t.setParameters({color:a});const n=t.toUnitRGB(i),r=t.toUnitRGB(s(i)),l=.75*i.a,o=this._laserLine,h=o.style;o.style={...h,glowColor:n,innerColor:r,globalAlpha:l}}),{initial:!0,equals:i})])}_destroyListeners(){this._listenerHandles=n(this._listenerHandles)}}function V(t,e,i,s){for(;t.length<e;)t.push(i());if(s)for(;t.length>e;){s(t.pop())}else t.length=e}const b=8,D=8,M=1,L=5;export{y as default};
5
+ import t from"../../../../../Color.js";import{multiplyOpacityToUnitRGBA as e,colorEquals as i,getContrast as s}from"../../../../../core/colorUtils.js";import a from"../../../../../core/Handles.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as r,sync as o}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as l}from"../../../../../core/screenUtils.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{Manipulator3D as _}from"../../Manipulator3D.js";import{createManipulatorMaterial as u}from"../../manipulatorUtils.js";import{RenderObject as d}from"../../RenderObject.js";import{PickResult as p}from"../support/PickRequest.js";import{LaserlineVisualElement as c}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as m}from"../../../webgl-engine/lib/GeometryUtil.js";import{newIntersector as g}from"../../../webgl-engine/lib/Intersector.js";import{StoreResults as w}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{ManipulatorCollection as v}from"../../../../interactive/ManipulatorCollection.js";class f{constructor(t){this.vertexManipulators=[],this._destroyed=!1,this._isManipulatorsOwner=!0,this._visible=!0,this._listenerHandles=null,this._tempHandlePosition=h();const{analysisViewData:e,manipulators:i,toolState:s,view:a,visible:n}=t;this._analysisViewData=e,this._toolState=s,null!=i?(this._manipulators=i,this._isManipulatorsOwner=!1):this._manipulators=new v,this._view=a,this._intersector=g(a.state.viewingMode),this._intersector.options.store=w.MIN;const r=u(this._handleColor),o=[new d(m(r,1,32,32))],l=new _({view:a,renderObjects:o});l.available=!1,l.radius=M,l.interactive=!1,this._manipulators.add(l),this._cursorManipulator=l,this._cursorManipulatorMaterial=r,this._laserLine=new c({view:a,attached:!0,style:{glowWidth:V,glowFalloff:b,innerWidth:D},isDecoration:!0}),this._updateVisibility(n??!0)}destroy(){this._listenerHandles=n(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=n(this._manipulators):this._manipulators=null,this._laserLine=n(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._visible}set visible(t){t?this.show():this.hide()}get testData(){const t=this._laserLine.testData;return{laserLineRenderer:null!=t?{heightManifoldEnabled:t.heightManifoldEnabled,heightManifoldTarget:t.heightManifoldTarget,pointDistanceEnabled:t.pointDistanceEnabled,pointDistanceOrigin:t.pointDistanceOrigin,pointDistanceTarget:t.pointDistanceTarget,lineVerticalPlaneEnabled:t.lineVerticalPlaneEnabled}:{heightManifoldEnabled:!1,heightManifoldTarget:null,pointDistanceEnabled:!1,pointDistanceOrigin:null,pointDistanceTarget:null,lineVerticalPlaneEnabled:!1}}}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(t){this._destroyed||this._visible===t||this._updateVisibility(t)}_updateVisibility(t){this._visible=t,this._laserLine.visible=t,t?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach((({manipulator:t})=>this._removeVertexManipulator(t))),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(t,e){const i=this._manipulators.intersect(t,e);return i?.metadata}pick(t){const e=this._view.spatialReference,i=l(t.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(i,this._intersector);const s=this._intersector.results.min,a=h();if(!s.getIntersectionPoint(a))return null;const n=this._view.renderCoordsHelper.fromRenderCoords(a,e);return null==n?null:new p(a,n)}_updateAll(){this._visible&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const t=u(this._handleColor),e=[new d(m(t,1,32,32))],i=new _({view:this._view,renderObjects:e});return i.radius=M,this._manipulators.add(i),{manipulator:i,material:t}}_removeVertexManipulator(t){this._manipulators.remove(t)}_updateVertexManipulators(){const{viewData:t}=this._analysisViewData,e=this._analysisViewData.path?this._analysisViewData.path.vertices:[],i=this.vertexManipulators;y(i,e.length,(()=>this._createVertexManipulator()),(({manipulator:t})=>this._removeVertexManipulator(t))),i.forEach((({manipulator:i},s)=>{i.metadata=e[s],i.renderLocation=t.positionsRenderCoords[s],i.cursor=0===s&&"drawing"===this._toolState.polygonState?"crosshair":null})),"drawing"===this._toolState.polygonState&&null!=this._analysisViewData.stagedPoint?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisViewData.stagedPoint):this._cursorManipulator.available=!1}get _handleColor(){return e(this._view.effectiveTheme.accentColor,.5)}_getFocusPoint(){const{lastDraggedVertex:t}=this._analysisViewData;switch(this._toolState.polygonState){case"drawing":return null!=this._analysisViewData.stagedPoint?this._analysisViewData.stagedPoint:null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):this._analysisViewData.path.lastPoint;case"editing":return null!=t?this._analysisViewData.path.getVertexPositionAsPoint(t):null;default:return this._analysisViewData.stagedPoint}}_updateLaserLine(){const t="measured"!==this._toolState.polygonState&&this._toolState.active,e=this._getFocusPoint();if(t&&null!=e){const t=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(e,t),this._laserLine.heightManifoldTarget=t}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new a,this._listenerHandles.add([r((()=>this._toolState.polygonState),(()=>this._updateLaserLine())),r((()=>this._analysisViewData.viewData),(()=>this._updateAll()),o),r((()=>({lastDraggedVertex:this._analysisViewData.lastDraggedVertex,cursorPoint:this._analysisViewData.stagedPoint})),(()=>this._updateLaserLine())),r((()=>this._toolState.active),(()=>this._updateAll())),r((()=>this._view.effectiveTheme.accentColor),(i=>{const a=e(i,.5);for(const{material:t}of this.vertexManipulators)t.setParameters({color:a});this._cursorManipulatorMaterial.setParameters({color:a});const n=t.toUnitRGB(i),r=t.toUnitRGB(s(i)),o=.75*i.a,l=this._laserLine,h=l.style;l.style={...h,glowColor:n,innerColor:r,globalAlpha:o}}),{initial:!0,equals:i})])}_destroyListeners(){this._listenerHandles=n(this._listenerHandles)}}function y(t,e,i,s){for(;t.length<e;)t.push(i());if(s)for(;t.length>e;){s(t.pop())}else t.length=e}const V=8,b=8,D=1,M=5;export{f as default};