@arcgis/core 4.28.0-rc.2 → 4.28.0-rc.4

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 (163) 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/{0e354096ad8817971eed.js → 02d235849ba93541d7ad.js} +1 -1
  5. package/assets/esri/core/workers/chunks/0422c5160491fbcf01dc.js +1 -0
  6. package/assets/esri/core/workers/chunks/1da721608993783dc9cf.js +1 -0
  7. package/assets/esri/core/workers/chunks/224e79f6c172da444e0a.js +1 -0
  8. package/assets/esri/core/workers/chunks/{ca3d5803cdf035d7389d.js → 30776102fbab294bfe7b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{61dec8399919b278b636.js → 3ac9001b19a90faf5573.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{fa6103e3d4e857b0035b.js → 3dcb2a82e1e4b520c9c9.js} +11 -8
  11. package/assets/esri/core/workers/chunks/41081c921037e543a22f.js +1 -0
  12. package/assets/esri/core/workers/chunks/4564a7885d045a850887.js +1 -0
  13. package/assets/esri/core/workers/chunks/4adf3a8c6b49c381a633.js +1 -0
  14. package/assets/esri/core/workers/chunks/{2721aa6b6941b28b9758.js → 63c8bf00120a4e67f5b0.js} +1 -1
  15. package/assets/esri/core/workers/chunks/6bc1f6f8a2408fa4bb6a.js +1 -0
  16. package/assets/esri/core/workers/chunks/74951370a341f02d3714.js +1 -0
  17. package/assets/esri/core/workers/chunks/78e49a70193e5adea17c.js +1 -0
  18. package/assets/esri/core/workers/chunks/7b8377b3a9f78f9d3613.js +1 -0
  19. package/assets/esri/core/workers/chunks/{fd28400141a6751327ae.js → 7cf7f2b991a7cbdad2ce.js} +1 -1
  20. package/assets/esri/core/workers/chunks/830d99e6c58a52a58973.js +1 -0
  21. package/assets/esri/core/workers/chunks/{1a723bb4a341f645e5fe.js → 83b8141f0c80e3448012.js} +1 -1
  22. package/assets/esri/core/workers/chunks/8f7997e8e6ee9e56239f.js +1 -0
  23. package/assets/esri/core/workers/chunks/934c32c49bb9e21482fd.js +1 -0
  24. package/assets/esri/core/workers/chunks/{a4341ec0fe89b865d849.js → a160576f21ada91995ac.js} +1 -1
  25. package/assets/esri/core/workers/chunks/a1e16c33f1843dbdce26.js +1 -0
  26. package/assets/esri/core/workers/chunks/{d07235ce2765a25b9be4.js → a50ec5b647a160199cb2.js} +1 -1
  27. package/assets/esri/core/workers/chunks/b6bd31674076e543d8b2.js +1 -0
  28. package/assets/esri/core/workers/chunks/{77923afde29ae1ff10ca.js → b6e86e179f99b5cf8dff.js} +1 -1
  29. package/assets/esri/core/workers/chunks/c3ddf5dbc34f118002df.js +1 -0
  30. package/assets/esri/core/workers/chunks/{562eafa5090827ebb7ec.js → c87e9280681c20d042b5.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{7b3d5f044c96e2c2af11.js → d191267d91a53db42956.js} +1 -1
  32. package/assets/esri/core/workers/chunks/ffa330a19a09679212fb.js +1 -0
  33. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +9 -13
  34. package/assets/esri/themes/base/widgets/_Features.scss +5 -0
  35. package/assets/esri/themes/base/widgets/_Legend.scss +1 -1
  36. package/assets/esri/themes/base/widgets/_Popup.scss +0 -1
  37. package/assets/esri/themes/base/widgets/_TimeZoneLabel.scss +3 -3
  38. package/assets/esri/themes/dark/main.css +1 -1
  39. package/assets/esri/themes/light/main.css +1 -1
  40. package/assets/esri/themes/light/view.css +1 -1
  41. package/geometry/support/meshUtils/georeference.js +1 -1
  42. package/interfaces.d.ts +1506 -314
  43. package/intl/date.js +1 -1
  44. package/kernel.js +1 -1
  45. package/layers/FeatureLayer.js +1 -1
  46. package/layers/GroupLayer.js +1 -1
  47. package/layers/OrientedImageryLayer.js +1 -1
  48. package/layers/SceneLayer.js +1 -1
  49. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  50. package/layers/graphics/data/QueryEngineResult.js +1 -1
  51. package/layers/graphics/data/queryValidationUtils.js +1 -1
  52. package/layers/mixins/ArcGISMapService.js +1 -1
  53. package/layers/save/groupLayerUtils.js +1 -1
  54. package/layers/save/utils.js +1 -1
  55. package/layers/support/ImageElement.js +1 -1
  56. package/layers/support/LayerContingentValuesCache.js +1 -1
  57. package/layers/support/Sublayer.js +1 -1
  58. package/layers/support/Subtype.d.ts +4 -0
  59. package/layers/support/Subtype.js +1 -1
  60. package/layers/support/imageryRendererUtils.js +1 -1
  61. package/networks/Network.js +1 -1
  62. package/package.json +1 -1
  63. package/portal/support/jsonContext.js +1 -1
  64. package/portal/support/layersLoader.js +1 -1
  65. package/rest/featureService/FeatureService.d.ts +4 -0
  66. package/rest/featureService/FeatureService.js +1 -1
  67. package/rest/featureService/utils.d.ts +4 -0
  68. package/rest/query/operations/query.js +1 -1
  69. package/smartMapping/support/utils.js +1 -1
  70. package/statistics/utils.js +1 -1
  71. package/support/basemapUtils.js +1 -1
  72. package/support/revision.js +1 -1
  73. package/versionManagement/VersionManagementService.d.ts +4 -0
  74. package/versionManagement/VersionManagementService.js +1 -1
  75. package/views/2d/engine/Container.js +1 -1
  76. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  77. package/views/2d/engine/webgl/Overlay.js +1 -1
  78. package/views/2d/input/handlers/KeyPan.js +1 -1
  79. package/views/2d/interactive/editingTools/manipulations/DragManipulation.js +1 -1
  80. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  81. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  82. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  83. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  84. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  85. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  86. package/views/3d/layers/I3SMeshView3D.js +1 -1
  87. package/views/3d/layers/MediaLayerView3D.js +1 -1
  88. package/views/3d/layers/SceneLayerWorker.js +1 -1
  89. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  90. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  91. package/views/3d/layers/graphics/elevationAlignPointsInFeatures.js +1 -1
  92. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  93. package/views/3d/support/MemoryController.js +1 -1
  94. package/views/3d/support/PBFDecoder.js +1 -1
  95. package/views/3d/support/ResourceController.js +1 -1
  96. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  97. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  98. package/views/3d/webgl-engine/core/FBOPool.js +5 -0
  99. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +9 -6
  100. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -2
  101. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  102. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  103. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  104. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  105. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  106. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  107. package/views/3d/webgl-engine/lib/textureUtils.js +1 -1
  108. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  109. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  110. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  111. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +1 -1
  112. package/views/draw/DrawOperation.js +1 -1
  113. package/views/draw/support/Reshape.js +1 -1
  114. package/views/interactive/sketch/constraints.js +1 -1
  115. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  116. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  117. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  118. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  119. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  120. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  121. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  122. package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
  123. package/webdoc/support/writeUtils.js +1 -1
  124. package/widgets/BasemapGallery.js +1 -1
  125. package/widgets/DirectionalPad.js +1 -1
  126. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  127. package/widgets/Editor/EditorViewModel.js +1 -1
  128. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  129. package/widgets/Editor/UpdateWorkflow.js +1 -1
  130. package/widgets/Editor/VisibleElements.js +1 -1
  131. package/widgets/Editor/workflowUtils.js +1 -1
  132. package/widgets/Editor.js +1 -1
  133. package/widgets/FeatureForm/FieldInput.js +1 -1
  134. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  135. package/widgets/FeatureForm.js +1 -1
  136. package/widgets/Features.js +1 -1
  137. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.d.ts +4 -0
  138. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  139. package/widgets/OrientedImageryViewer.js +1 -1
  140. package/widgets/TimeSlider.js +1 -1
  141. package/widgets/TimeZoneLabel.js +1 -1
  142. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  143. package/widgets/UtilityNetworkTrace.js +1 -1
  144. package/widgets/support/dateUtils.js +1 -1
  145. package/assets/esri/core/workers/chunks/00da3c16741a9bc47f3a.js +0 -1
  146. package/assets/esri/core/workers/chunks/0e4646d14fa0775bf463.js +0 -1
  147. package/assets/esri/core/workers/chunks/4e0bf30da4281070e453.js +0 -1
  148. package/assets/esri/core/workers/chunks/51b8913dff24e693bd25.js +0 -1
  149. package/assets/esri/core/workers/chunks/5e907ec0ee1565b5fbbc.js +0 -1
  150. package/assets/esri/core/workers/chunks/7388fd97e7b1a2142744.js +0 -1
  151. package/assets/esri/core/workers/chunks/7648f3341b7dff2825c3.js +0 -1
  152. package/assets/esri/core/workers/chunks/92d8f75e616afa5c761e.js +0 -1
  153. package/assets/esri/core/workers/chunks/9c77d69a13ec22cdd760.js +0 -1
  154. package/assets/esri/core/workers/chunks/a821fa1870b83fed5d31.js +0 -1
  155. package/assets/esri/core/workers/chunks/a877a4826cd6a46ec99b.js +0 -1
  156. package/assets/esri/core/workers/chunks/b251d8a856dc8b9406e0.js +0 -1
  157. package/assets/esri/core/workers/chunks/c416df0668f6c596095f.js +0 -1
  158. package/assets/esri/core/workers/chunks/d8c696da42f8f8919b83.js +0 -1
  159. package/assets/esri/core/workers/chunks/f0d342303fc20e266d27.js +0 -1
  160. package/assets/esri/core/workers/chunks/fac3e57784d7f37053af.js +0 -1
  161. package/assets/esri/core/workers/chunks/fc95b1a36ed68b851400.js +0 -1
  162. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +0 -4
  163. package/widgets/DirectionalPad.d.ts +0 -4
@@ -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 s}from"../../core/arrayUtils.js";import r from"../../core/Error.js";import{IdentifiableMixin as i}from"../../core/Identifiable.js";import{JSONSupportMixin as a}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import n from"../../core/Loadable.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/SpatialReference.js";import{getFeatureJSON as c,getFeatureIds as m,getAttachmentEditsJSON as y,isProtectedOrPrivateVersionError as f,unpackEditResultData as h,createEditedFeatures as S}from"../../layers/graphics/applyEditsUtils.js";import{checkEditingCapabilities as v,normalizeEdits as g,normalizeGeometries as R}from"../../layers/graphics/editingSupport.js";import{emitApplyEditsEvent as b}from"../../layers/mixins/EditBusLayer.js";import{parseUrl as E,asValidOptions as w,encode as F}from"../utils.js";import{unapplyEditsZUnitScaling as j}from"../query/operations/editsZScale.js";import{readBoolean as A,readNumber as k}from"../support/jsonUtils.js";import{isSafeToEditVersion as O,isVersionInEditSession as V,currentSessionId as C}from"../../versionManagement/support/versionManagementUtils.js";function I(e){return{data:M(e),sync:x(e),operations:D(e.capabilities,e),query:N(e),editing:U(e)}}function M(e){return{isDataVersioned:A(e,"hasVersionedData",!1)}}function D(e,t){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],r=s.includes("query"),i=s.includes("editing")&&!t.datesInUnknownTimezone;let a=i&&s.includes("create"),o=i&&s.includes("delete"),n=i&&s.includes("update");return i&&!(a||o||n)&&(a=o=n=!0),{supportsAdd:a,supportsDelete:o,supportsEditing:i,supportsChangeTracking:s.includes("changetracking"),supportsQuery:r,supportsQueryDataElements:A(t,"supportsQueryDataElements",!1),supportsQueryDomains:A(t,"supportsQueryDomains",!1),supportsQueryContingentValues:A(t,"supportsQueryContingentValues",!1),supportsSync:s.includes("sync"),supportsUpdate:n}}function N(e){return{maxRecordCountFactor:k(e,"maxRecordCountFactor",void 0),maxRecordCount:k(e,"maxRecordCount",void 0)}}function U(e){const t=e?.advancedEditingCapabilities;return{supportsGlobalId:A(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:A(t,"supportsReturnServiceEditsInSourceSR",!1),supportsSplit:A(t,"supportsSplit",!1),supportsAsyncApplyEdits:A(t,"supportsAsyncApplyEdits",!1)}}function x(e){const t=e?.syncCapabilities,s=t?.supportedSyncDataOptions;return{supportsAsync:A(t,"supportsAsync",!1),supportedSyncDataOptions:{annotations:1==(1&s),dimensions:2==(2&s),contingentValues:4==(4&s),attributeRules:8==(8&s),utilityNetworkSystem:16==(16&s),annotationFullModel:32==(32&s),include3DObjects:64==(64&s),utilityNetworkMissingLayers:128==(128&s),preserveTrueCurves:256==(256&s)}}}let J=class extends(a(i(n))){constructor(e){super(e),this.sourceJSON=null,this.userTypeExtensions=[],this.layerInfos=[],this.tableInfos=[],this.capabilities=null}read(e,t){this.sourceJSON=e,super.read(e,t)}get utilityNetworkUrl(){for(const e of this.sourceJSON.layers)if("Utility Network Layer"===e.type)return`${this.url}/${e.id}`;return null}get versionManagementServiceUrl(){return this.sourceJSON.hasBranchVersionedData?this.url.replace(/\/FeatureServer/i,"/VersionManagementServer"):null}readCapabilities(e,t){return I(t)}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async applyEdits(e,t){let s=null;try{const{results:r,edits:i,editedFeatures:a}=await this._internalApplyEdits(e,t),n=e=>e.filter((e=>!e.error)).map(o);let u=0;return r.map((e=>{s=b(this.url,e.id,t?.gdbVersion,!0);const r={edits:i[u],addedFeatures:n(e.addFeatureResults),updatedFeatures:n(e.updateFeatureResults),deletedFeatures:n(e.deleteFeatureResults),addedAttachments:n(e.addAttachmentResults),updatedAttachments:n(e.updateAttachmentResults),deletedAttachments:n(e.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:e.editMoment?new Date(e.editMoment):null};u+=1,a.length>0&&(r.editedFeatures=a),s.resolve(r),s=null})),r}catch(r){throw s&&s.reject(r),r}}async _internalApplyEdits(e,r){const i=r?.globalIdUsed??!1,a=p.fromJSON(this.sourceJSON.spatialReference),{edits:o,options:n}=await this._processApplyEditsParams(e,r),u=await Promise.all(o.map((async e=>{const t=e.addFeatures?.map((e=>c({spatialReference:a},e,null)))??[],r=(await Promise.all(t)).filter(s),o=e.updateFeatures?.map((e=>c({spatialReference:a},e,null)))??[],n=(await Promise.all(o)).filter(s),u=m(e.identifierFields,e.deleteFeatures,i);j(r,n,a);const d=await y(e.identifierFields,e);return{id:e.id,adds:r,updates:n,deletes:u,attachments:d}}))),d={gdbVersion:n?.gdbVersion,rollbackOnFailure:!0,useGlobalIds:i,returnEditMoment:!0,honorSequenceOfEdits:n?.honorSequenceOfEdits,usePreviousEditMoment:n?.usePreviousEditMoment,returnServiceEditsInSourceSR:n?.returnServiceEditsInSourceSR,returnServiceEditOption:"originalAndCurrentFeatures",async:!1};await O(this.url,r?.gdbVersion,!0);const l=V(this.url,r?.gdbVersion||null);d.edits=JSON.stringify(u);const h=E(this.url),S=w(h.query,{query:F({...d,f:"json"}),method:"post"});let v;l&&(S.authMode="immediate",S.query.sessionId=C);try{v=await t(this.url+"/applyEdits",S)}catch(g){if(!f(g))throw g;S.authMode="immediate",v=await t(this.url+"/applyEdits",S)}return{...this._createServiceEditsResult(v),edits:o}}_createServiceEditsResult(e){const t=e.data,s=[];return{results:t.map((e=>{const t={addResults:e.addResults??[],updateResults:e.updateResults??[],deleteResults:e.deleteResults??[],attachments:e.attachments,editMoment:e.editMoment},r=h(t),i=e.editedFeatures,a=i?.spatialReference?new p({wkid:i?.spatialReference.wkid,wkt:i?.spatialReference.wkt,latestWkid:i?.spatialReference.latestWkid,latestVcsWkid:i?.spatialReference.latestVcsWkid,vcsWkid:i?.spatialReference.vcsWkid}):null,o=i?S(i,a):null;return o&&s.push({layerId:e.id,editedFeatures:o}),{id:e.id,editedFeatures:o,...r}})),editedFeatures:s}}async _processApplyEditsParams(e,t){const s={...t};return{edits:await Promise.all(e.map((async e=>{const s=this.capabilities,i=e&&(e.addFeatures||e.updateFeatures||e.deleteFeatures),a=e&&(e.addAttachments||e.updateAttachments||e.deleteAttachments);if(v(e,s,t,!!i,!!a,"feature-service"),!s.data.isDataVersioned&&t?.gdbVersion)throw new r("feature-service:invalid-parameter","'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");const o=g(e,s,"feature-service");return{...await R(o),id:e.id,identifierFields:e.identifierFields}}))),options:s}}async _fetchService(e,s){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:E(e)});const r=await t(e,{responseType:"json",query:{f:"json"},...s});this.read(r.data)}};e([u()],J.prototype,"url",void 0),e([u()],J.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],J.prototype,"utilityNetworkUrl",null),e([u({readOnly:!0})],J.prototype,"versionManagementServiceUrl",null),e([u()],J.prototype,"userTypeExtensions",void 0),e([u({json:{read:{source:"layers"}}})],J.prototype,"layerInfos",void 0),e([u({json:{read:{source:"tables"}}})],J.prototype,"tableInfos",void 0),e([u({readOnly:!0,json:{read:{source:["hasVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"]}}})],J.prototype,"capabilities",void 0),e([d("service","capabilities")],J.prototype,"readCapabilities",null),J=e([l("esri.services.FeatureService")],J);const q=J;export{q as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as s}from"../../core/arrayUtils.js";import r from"../../core/Error.js";import{IdentifiableMixin as i}from"../../core/Identifiable.js";import{JSONSupportMixin as a}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import n from"../../core/Loadable.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/SpatialReference.js";import{getFeatureJSON as c,getFeatureIds as m,getAttachmentEditsJSON as y,isProtectedOrPrivateVersionError as h,unpackEditResultData as f,createEditedFeatures as S}from"../../layers/graphics/applyEditsUtils.js";import{checkEditingCapabilities as v,normalizeEdits as g,normalizeGeometries as R}from"../../layers/graphics/editingSupport.js";import{emitApplyEditsEvent as b}from"../../layers/mixins/EditBusLayer.js";import{parseUrl as E,asValidOptions as w,encode as F}from"../utils.js";import{unapplyEditsZUnitScaling as j}from"../query/operations/editsZScale.js";import{readBoolean as A,readNumber as k}from"../support/jsonUtils.js";import{isSafeToEditVersion as O,isVersionInEditSession as V,currentSessionId as C}from"../../versionManagement/support/versionManagementUtils.js";function I(e){return{data:M(e),sync:x(e),operations:D(e.capabilities,e),query:N(e),editing:U(e)}}function M(e){return{isDataVersioned:A(e,"hasVersionedData",!1)}}function D(e,t){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],r=s.includes("query"),i=s.includes("editing")&&!t.datesInUnknownTimezone;let a=i&&s.includes("create"),o=i&&s.includes("delete"),n=i&&s.includes("update");return i&&!(a||o||n)&&(a=o=n=!0),{supportsAdd:a,supportsDelete:o,supportsEditing:i,supportsChangeTracking:s.includes("changetracking"),supportsQuery:r,supportsQueryDataElements:A(t,"supportsQueryDataElements",!1),supportsQueryDomains:A(t,"supportsQueryDomains",!1),supportsQueryContingentValues:A(t,"supportsQueryContingentValues",!1),supportsSync:s.includes("sync"),supportsUpdate:n}}function N(e){return{maxRecordCountFactor:k(e,"maxRecordCountFactor",void 0),maxRecordCount:k(e,"maxRecordCount",void 0)}}function U(e){const t=e?.advancedEditingCapabilities;return{supportsGlobalId:A(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:A(t,"supportsReturnServiceEditsInSourceSR",!1),supportsSplit:A(t,"supportsSplit",!1),supportsAsyncApplyEdits:A(t,"supportsAsyncApplyEdits",!1)}}function x(e){const t=e?.syncCapabilities,s=t?.supportedSyncDataOptions;return{supportsAsync:A(t,"supportsAsync",!1),supportedSyncDataOptions:{annotations:1==(1&s),dimensions:2==(2&s),contingentValues:4==(4&s),attributeRules:8==(8&s),utilityNetworkSystem:16==(16&s),annotationFullModel:32==(32&s),include3DObjects:64==(64&s),utilityNetworkMissingLayers:128==(128&s),preserveTrueCurves:256==(256&s)}}}let J=class extends(a(i(n))){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.userTypeExtensions=[],this.layerInfos=[],this.tableInfos=[],this.capabilities=null}read(e,t){this.sourceJSON=e,super.read(e,t)}get utilityNetworkUrl(){for(const e of this.sourceJSON.layers)if("Utility Network Layer"===e.type)return`${this.url}/${e.id}`;return null}get versionManagementServiceUrl(){return this.sourceJSON.hasBranchVersionedData?this.url.replace(/\/FeatureServer/i,"/VersionManagementServer"):null}readCapabilities(e,t){return I(t)}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async applyEdits(e,t){let s=null;try{const{results:r,edits:i,editedFeatures:a}=await this._internalApplyEdits(e,t),n=e=>e.filter((e=>!e.error)).map(o);let u=0;return r.map((e=>{s=b(this.url,e.id,t?.gdbVersion,!0);const r={edits:i[u],addedFeatures:n(e.addFeatureResults),updatedFeatures:n(e.updateFeatureResults),deletedFeatures:n(e.deleteFeatureResults),addedAttachments:n(e.addAttachmentResults),updatedAttachments:n(e.updateAttachmentResults),deletedAttachments:n(e.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:e.editMoment?new Date(e.editMoment):null};u+=1,a.length>0&&(r.editedFeatures=a),s.resolve(r),s=null})),r}catch(r){throw s&&s.reject(r),r}}async _internalApplyEdits(e,r){const i=r?.globalIdUsed??!1,a=p.fromJSON(this.sourceJSON.spatialReference),{edits:o,options:n}=await this._processApplyEditsParams(e,r),u=await Promise.all(o.map((async e=>{const t=e.addFeatures?.map((e=>c({spatialReference:a},e,null)))??[],r=(await Promise.all(t)).filter(s),o=e.updateFeatures?.map((e=>c({spatialReference:a},e,null)))??[],n=(await Promise.all(o)).filter(s),u=m(e.identifierFields,e.deleteFeatures,i);j(r,n,a);const d=await y(e.identifierFields,e);return{id:e.id,adds:r,updates:n,deletes:u,attachments:d}}))),d={gdbVersion:n?.gdbVersion,rollbackOnFailure:!0,useGlobalIds:i,returnEditMoment:!0,honorSequenceOfEdits:n?.honorSequenceOfEdits,usePreviousEditMoment:n?.usePreviousEditMoment,returnServiceEditsInSourceSR:n?.returnServiceEditsInSourceSR,returnServiceEditsOption:"originalAndCurrentFeatures",async:!1};await O(this.url,r?.gdbVersion,!0);const l=V(this.url,r?.gdbVersion||null);d.edits=JSON.stringify(u);const f=E(this.url),S=w(f.query,{query:F({...d,f:"json"}),method:"post"});let v;l&&(S.authMode="immediate",S.query.sessionId=C);try{v=await t(this.url+"/applyEdits",S)}catch(g){if(!h(g))throw g;S.authMode="immediate",v=await t(this.url+"/applyEdits",S)}return{...this._createServiceEditsResult(v),edits:o}}_createServiceEditsResult(e){const t=e.data,s=[];return{results:t.map((e=>{const t={addResults:e.addResults??[],updateResults:e.updateResults??[],deleteResults:e.deleteResults??[],attachments:e.attachments,editMoment:e.editMoment},r=f(t),i=e.editedFeatures,a=i?.spatialReference?new p({wkid:i?.spatialReference.wkid,wkt:i?.spatialReference.wkt,latestWkid:i?.spatialReference.latestWkid,latestVcsWkid:i?.spatialReference.latestVcsWkid,vcsWkid:i?.spatialReference.vcsWkid}):null,o=i?S(i,a):null;return o&&s.push({layerId:e.id,editedFeatures:o}),{id:e.id,editedFeatures:o,...r}})),editedFeatures:s}}async _processApplyEditsParams(e,t){const s={...t};return{edits:await Promise.all(e.map((async e=>{const s=this.capabilities,i=e&&(e.addFeatures||e.updateFeatures||e.deleteFeatures),a=e&&(e.addAttachments||e.updateAttachments||e.deleteAttachments);if(v(e,s,t,!!i,!!a,"feature-service"),!s.data.isDataVersioned&&t?.gdbVersion)throw new r("feature-service:invalid-parameter","'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");const o=g(e,s,"feature-service");return{...await R(o),id:e.id,identifierFields:e.identifierFields}}))),options:s}}async _fetchService(e,s){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:E(e)});const r=await t(e,{responseType:"json",query:{f:"json"},...s});this.read(r.data)}};e([u()],J.prototype,"url",void 0),e([u()],J.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],J.prototype,"utilityNetworkUrl",null),e([u({readOnly:!0})],J.prototype,"versionManagementServiceUrl",null),e([u()],J.prototype,"userTypeExtensions",void 0),e([u({json:{read:{source:"layers"}}})],J.prototype,"layerInfos",void 0),e([u({json:{read:{source:"tables"}}})],J.prototype,"tableInfos",void 0),e([u({readOnly:!0,json:{read:{source:["hasVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"]}}})],J.prototype,"capabilities",void 0),e([d("service","capabilities")],J.prototype,"readCapabilities",null),J=e([l("esri.services.FeatureService")],J);const q=J;export{q as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import featureServiceUtils = __esri.featureServiceUtils;
4
+ export = featureServiceUtils;
@@ -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"../../../request.js";import{urlToObject as t,join as n}from"../../../core/urlUtils.js";import{getJsonType as r}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as i}from"../../../geometry/support/normalizeUtils.js";import{srToRESTValue as a}from"../../../geometry/support/spatialReferenceUtils.js";import{mapParameters as o}from"../../operations/urlUtils.js";import{parsePBFFeatureQuery as u}from"./pbfQueryUtils.js";import{applyFeatureSetZUnitScaling as l}from"./queryZScale.js";const s="Layer does not support extent calculation.";function m(e,t){if(t&&"extent"===e.type)return`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`;if(t&&"point"===e.type)return`${e.x},${e.y}`;const n=e.toJSON();return delete n.spatialReference,JSON.stringify(n)}function c(e,t){const n=e.geometry,i=e.toJSON();delete i.compactGeometryEnabled,delete i.defaultSpatialReferenceEnabled;const o=i;let u,l,s;if(null!=n&&(l=n.spatialReference,s=a(l),o.geometryType=r(n),o.geometry=m(n,e.compactGeometryEnabled),o.inSR=s),i.groupByFieldsForStatistics&&(o.groupByFieldsForStatistics=i.groupByFieldsForStatistics.join(",")),i.objectIds&&(o.objectIds=i.objectIds.join(",")),i.orderByFields&&(o.orderByFields=i.orderByFields.join(",")),!i.outFields||!i.returnDistinctValues&&(t?.returnCountOnly||t?.returnExtentOnly||t?.returnIdsOnly)?delete o.outFields:i.outFields.includes("*")?o.outFields="*":o.outFields=i.outFields.join(","),i.outSR?(o.outSR=a(i.outSR),u=e.outSpatialReference):n&&(i.returnGeometry||i.returnCentroid)&&(o.outSR=o.inSR,u=l),i.returnGeometry&&delete i.returnGeometry,i.outStatistics&&(o.outStatistics=JSON.stringify(i.outStatistics)),i.fullText&&(i.fullText.forEach((e=>{e.searchTerm&&(e.searchTerm=encodeURIComponent(e.searchTerm))})),o.fullText=JSON.stringify(i.fullText)),i.pixelSize&&(o.pixelSize=JSON.stringify(i.pixelSize)),i.quantizationParameters&&(e.defaultSpatialReferenceEnabled&&null!=l&&null!=e.quantizationParameters?.extent&&l.equals(e.quantizationParameters.extent.spatialReference)&&delete i.quantizationParameters.extent.spatialReference,o.quantizationParameters=JSON.stringify(i.quantizationParameters)),i.parameterValues&&(o.parameterValues=JSON.stringify(i.parameterValues)),i.rangeValues&&(o.rangeValues=JSON.stringify(i.rangeValues)),i.dynamicDataSource&&(o.layer=JSON.stringify({source:i.dynamicDataSource}),delete i.dynamicDataSource),i.timeExtent){const e=i.timeExtent,{start:t,end:n}=e;null==t&&null==n||(o.time=t===n?t:`${t??"null"},${n??"null"}`),delete i.timeExtent}return e.defaultSpatialReferenceEnabled&&null!=l&&null!=u&&l.equals(u)&&(o.defaultSR=o.inSR,delete o.inSR,delete o.outSR),o}async function y(e,t,n,r){const i=null!=t.timeExtent&&t.timeExtent.isEmpty?{data:{features:[]}}:await E(e,t,"json",r);return l(t,n,i.data),i}async function f(e,t,n,r){if(null!=t.timeExtent&&t.timeExtent.isEmpty)return{data:n.createFeatureResult()};const i=await d(e,t,r),a=i;return a.data=u(i.data,n),a}function d(e,t,n){return E(e,t,"pbf",n)}function p(e,t,n){return null!=t.timeExtent&&t.timeExtent.isEmpty?Promise.resolve({data:{objectIds:[]}}):E(e,t,"json",n,{returnIdsOnly:!0})}function S(e,t,n){return null!=t.timeExtent&&t.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):E(e,t,"json",n,{returnIdsOnly:!0,returnCountOnly:!0})}async function x(e,t,n){if(null!=t.timeExtent&&t.timeExtent.isEmpty)return{data:{count:0,extent:null}};const r=await E(e,t,"json",n,{returnExtentOnly:!0,returnCountOnly:!0}),i=r.data;if(i.hasOwnProperty("extent"))return r;if(i.features)throw new Error(s);if(i.hasOwnProperty("count"))throw new Error(s);return r}async function E(r,a,u,l={},s={}){const m="string"==typeof r?t(r):r,y=a.geometry?[a.geometry]:[],f=await i(y,null,{signal:l.signal}),d=f?.[0];null!=d&&((a=a.clone()).geometry=d);const p=o({...m.query,f:u,...s,...c(a,s)});return e(n(m.path,g(a,s)?"query3d":"query"),{...l,responseType:"pbf"===u?"array-buffer":"json",query:{...p,...l.query}})}function g(e,t){return null!=e.formatOf3DObjects&&!(t.returnCountOnly||t.returnExtentOnly||t.returnIdsOnly)}export{m as encodeGeometry,y as executeQuery,S as executeQueryForCount,x as executeQueryForExtent,p as executeQueryForIds,f as executeQueryPBF,d as executeQueryPBFBuffer,c as queryToQueryStringParameters,E as runQuery};
5
+ import t from"../../../request.js";import{urlToObject as e,join as n}from"../../../core/urlUtils.js";import{getJsonType as r}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as i}from"../../../geometry/support/normalizeUtils.js";import{srToRESTValue as a}from"../../../geometry/support/spatialReferenceUtils.js";import{mapParameters as o}from"../../operations/urlUtils.js";import{parsePBFFeatureQuery as u}from"./pbfQueryUtils.js";import{applyFeatureSetZUnitScaling as l}from"./queryZScale.js";const s="Layer does not support extent calculation.";function m(t,e){if(e&&"extent"===t.type)return`${t.xmin},${t.ymin},${t.xmax},${t.ymax}`;if(e&&"point"===t.type)return`${t.x},${t.y}`;const n=t.toJSON();return delete n.spatialReference,JSON.stringify(n)}function y(t,e){const n=t.geometry,i=t.toJSON();delete i.compactGeometryEnabled,delete i.defaultSpatialReferenceEnabled;const o=i;let u,l,s;if(null!=n&&(l=n.spatialReference,s=a(l),o.geometryType=r(n),o.geometry=m(n,t.compactGeometryEnabled),o.inSR=s),i.groupByFieldsForStatistics&&(o.groupByFieldsForStatistics=i.groupByFieldsForStatistics.join(",")),i.objectIds&&(o.objectIds=i.objectIds.join(",")),i.orderByFields&&(o.orderByFields=i.orderByFields.join(",")),!i.outFields||!i.returnDistinctValues&&(e?.returnCountOnly||e?.returnExtentOnly||e?.returnIdsOnly)?delete o.outFields:i.outFields.includes("*")?o.outFields="*":o.outFields=i.outFields.join(","),i.outSR?(o.outSR=a(i.outSR),u=t.outSpatialReference):n&&(i.returnGeometry||i.returnCentroid)&&(o.outSR=o.inSR,u=l),i.returnGeometry&&delete i.returnGeometry,i.outStatistics&&(o.outStatistics=JSON.stringify(i.outStatistics)),i.fullText&&(o.fullText=JSON.stringify(i.fullText)),i.pixelSize&&(o.pixelSize=JSON.stringify(i.pixelSize)),i.quantizationParameters&&(t.defaultSpatialReferenceEnabled&&null!=l&&null!=t.quantizationParameters?.extent&&l.equals(t.quantizationParameters.extent.spatialReference)&&delete i.quantizationParameters.extent.spatialReference,o.quantizationParameters=JSON.stringify(i.quantizationParameters)),i.parameterValues&&(o.parameterValues=JSON.stringify(i.parameterValues)),i.rangeValues&&(o.rangeValues=JSON.stringify(i.rangeValues)),i.dynamicDataSource&&(o.layer=JSON.stringify({source:i.dynamicDataSource}),delete i.dynamicDataSource),i.timeExtent){const t=i.timeExtent,{start:e,end:n}=t;null==e&&null==n||(o.time=e===n?e:`${e??"null"},${n??"null"}`),delete i.timeExtent}return t.defaultSpatialReferenceEnabled&&null!=l&&null!=u&&l.equals(u)&&(o.defaultSR=o.inSR,delete o.inSR,delete o.outSR),o}async function c(t,e,n,r){const i=null!=e.timeExtent&&e.timeExtent.isEmpty?{data:{features:[]}}:await E(t,e,"json",r);return l(e,n,i.data),i}async function f(t,e,n,r){if(null!=e.timeExtent&&e.timeExtent.isEmpty)return{data:n.createFeatureResult()};const i=await d(t,e,r),a=i;return a.data=u(i.data,n),a}function d(t,e,n){return E(t,e,"pbf",n)}function p(t,e,n){return null!=e.timeExtent&&e.timeExtent.isEmpty?Promise.resolve({data:{objectIds:[]}}):E(t,e,"json",n,{returnIdsOnly:!0})}function S(t,e,n){return null!=e.timeExtent&&e.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):E(t,e,"json",n,{returnIdsOnly:!0,returnCountOnly:!0})}async function x(t,e,n){if(null!=e.timeExtent&&e.timeExtent.isEmpty)return{data:{count:0,extent:null}};const r=await E(t,e,"json",n,{returnExtentOnly:!0,returnCountOnly:!0}),i=r.data;if(i.hasOwnProperty("extent"))return r;if(i.features)throw new Error(s);if(i.hasOwnProperty("count"))throw new Error(s);return r}async function E(r,a,u,l={},s={}){const m="string"==typeof r?e(r):r,c=a.geometry?[a.geometry]:[],f=await i(c,null,{signal:l.signal}),d=f?.[0];null!=d&&((a=a.clone()).geometry=d);const p=o({...m.query,f:u,...s,...y(a,s)});return t(n(m.path,g(a,s)?"query3d":"query"),{...l,responseType:"pbf"===u?"array-buffer":"json",query:{...p,...l.query}})}function g(t,e){return null!=t.formatOf3DObjects&&!(e.returnCountOnly||e.returnExtentOnly||e.returnIdsOnly)}export{m as encodeGeometry,c as executeQuery,S as executeQueryForCount,x as executeQueryForExtent,p as executeQueryForIds,f as executeQueryPBF,d as executeQueryPBFBuffer,y as queryToQueryStringParameters,E as runQuery};
@@ -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,r){return e.basemap?.referenceLayers?.some((e=>e.uid===r))||e.basemap?.baseLayers?.some((e=>e.uid===r))}function S(e,r=null){const t=d(e);if(!t)return null;const n=t.clone();return r&&(n.baseLayers=R(n.baseLayers,r.baseLayers),n.referenceLayers=R(n.referenceLayers,r.referenceLayers)),n}let v;function g(e){if(v)return v(e);let r=null;const t=x(e),n=!t?.baseLayers.length;for(const a in f){const e=B(t,$(f[a]),{mustMatchReferences:n});if("equal"===e){r=a;break}"base-layers-equal"===e&&(r=a)}return r}function h(e){v=e}function I(e,r){if(e===r)return!0;if(null!=e?.portalItem?.id&&e.portalItem.id===r?.portalItem?.id)return!0;return"equal"===B(x(e),x(r),{mustMatchReferences:!0})}function R(e,r){const n=new t;return e.forEach((e=>{const t=r.find((r=>"scene"!==r.type&&N(k(e),k(r))))||e;n.includes(t)?n.push(e):n.push(t)})),n}function T(e){return!!e?.baseLayers.concat(e.referenceLayers).some(j)}function j(e){if(q(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const t=e.sourceNameToSource[r];if(q(t?.sourceUrl))return!0}return!1}function w(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 U=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function q(e){if(!e)return!1;const r=new l(s(e));return!!r.authority&&U.test(r.authority)}function x(e){return e?!e.loaded&&e.resourceInfo?$(e.resourceInfo.data):{baseLayers:M(e.baseLayers),referenceLayers:M(e.referenceLayers)}:null}function M(e){return(t.isCollection(e)?e.toArray():e).map(k)}function k(e){return{type:e.type,effect:"effect"in e?e.effect:void 0,url:D("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 A(e){return e.isReference||"ArcGISSceneServiceLayer"===e.layerType}function $(e){return e?{baseLayers:C((e.baseMapLayers??[]).filter((e=>!A(e)))),referenceLayers:C((e.baseMapLayers??[]).filter((e=>A(e))))}:null}function C(e){return e.map((e=>G(e)))}function G(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:D(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 B(e,r,t){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!K(e.baseLayers,r.baseLayers))return"not-equal";return K(e.referenceLayers,r.referenceLayers)?"equal":t.mustMatchReferences?"not-equal":"base-layers-equal"}function K(e,r){if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!N(e[t],r[t]))return!1;return!0}function N(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 D(e){return e?u(e).replace(/^\s*https?:/i,"").toLowerCase():""}function E(e){if(!e)return null;const{thumbnailUrl:r}=e;if(r)return r;const t=g(e);return t?f[t].thumbnailUrl:i(e.baseLayers,O)}function O(e){return"portalItem"in e?e.portalItem?.thumbnailUrl:void 0}export{S as clonePreservingTiledLayers,I as contentEquals,y as createCache,m as destroyCache,d as ensureType,w as findSpatialReference,E as getBasemapThumbnailUrl,g as getWellKnownBasemapId,T as hasDeveloperBasemapLayer,b as isBasemap3D,L as isBasemapLayer,j as isDeveloperBasemapLayer,h 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 a="20231012",c="d1de50796612a27d9365af45a54fccfbbe422688";export{a as buildDate,c as commitHash};
5
+ const b="20231020",c="8258b69bcc290fae80b10247ad2d7a61bdc26760";export{b as buildDate,c as commitHash};
@@ -0,0 +1,4 @@
1
+ import "../interfaces";
2
+
3
+ import VersionManagementService = __esri.VersionManagementService;
4
+ export default VersionManagementService;
@@ -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{JSONSupportMixin as r}from"../core/JSONSupport.js";import i from"../core/Loadable.js";import{removeTrailingSlash as s,Url as n}from"../core/urlUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as a}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{onApplyEditsEvent as l,emitUpdateMomentEvent as c}from"../layers/mixins/EditBusLayer.js";import{parseUrl as m}from"../rest/utils.js";import g from"./support/EditMomentStack.js";import{versionCollection as p,versionCollectionCount as f,defaultVersionNameLookup as h,currentSessionId as V}from"./support/versionManagementUtils.js";let v=class extends(r(i)){constructor(e){super(e),this.sourceJSON=null,this.capabilities=null,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:i}=e;t===this._featureServiceUrl&&i.then((e=>{const t=e.historicMoment;t&&this._addMomentToVersionItem(r,t)}))}}initialize(){this.url=s(this.url),this._featureServiceUrl=this.url.replace(/\/VersionManagementServer/i,"/FeatureServer"),p.has(this.url)||p.set(this.url,new Map);const e=(f.get(this.url)??0)+1;f.set(this.url,e),this.when().then((()=>this.addHandles(l(this._applyEditsHandler))),(()=>{}))}destroy(){const e=(f.get(this.url)??1)-1;f.set(this.url,e),0===e&&p.delete(this.url),h.delete(this._featureServiceUrl)}read(e,t){this.sourceJSON=e,super.read(e,t)}readDefaultVersionIdentifier(e,t){return{name:t.defaultVersionName,guid:t.defaultVersionGuid}}writeDefaultVersionIdentifier(e,t){t.defaultVersionName=e.name,t.defaultVersionGuid=e.guid}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async createVersion(e){const[{createVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/createVersion.js"),import("../rest/versionManagement/support/CreateVersionParameters.js")]),i=r.from(e);return t(this.url,i)}async deleteVersion(e){const[{deleteVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/deleteVersion.js"),import("../rest/versionManagement/support/DeleteVersionParameters.js")]);let i;e.guid&&p.get(this.url)?.has(e.guid)&&(i=V??void 0);const s=new r({versionName:e.name,sessionId:i});return t(this.url,s)}async getVersionInfoExtended(e){const{getVersion:t}=await import("../rest/versionManagement/getVersion.js");return t(this.url,e.guid)}async getVersionInfos(e={}){const[{getVersionInfos:t},{default:r}]=await Promise.all([import("../rest/versionManagement/getVersionInfos.js"),import("../rest/versionManagement/support/GetVersionInfosParameters.js")]),i=r.from(e);return t(this.url,i)}async reconcile(e,t={}){const[{reconcile:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/reconcile.js"),import("../rest/versionManagement/gdbVersion/support/ReconcileParameters.js")]),s=i.from(t);return s.sessionId=V,r(this.url,e.guid,s)}async post(e){const[{post:t},{default:r}]=await Promise.all([import("../rest/versionManagement/gdbVersion/post.js"),import("../rest/versionManagement/gdbVersion/support/PostParameters.js")]),i=r.from({sessionId:V});return t(this.url,e.guid,i)}async alterVersion(e,t){const[{alterVersion:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/alterVersion.js"),import("../rest/versionManagement/gdbVersion/support/AlterVersionParameters.js")]),s=i.from(t);return r(this.url,e.guid,s)}async startReading(e){const{startReading:t}=await import("../rest/versionManagement/gdbVersion/startReading.js"),r=await t(this.url,e.guid,V);if(r){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),i={name:t.versionIdentifier.name,moment:r,lockType:"read"};this._addOrUpdateItem(e.guid,i),c(this._featureServiceUrl,null,e.name,r)}return r}async stopReading(e){const{stopReading:t}=await import("../rest/versionManagement/gdbVersion/stopReading.js"),r=await t(this.url,e.guid,V);return r&&(p.get(this.url)?.delete(e.guid),c(this._featureServiceUrl,null,e.name,null)),r}async startEditing(e){const{startEditing:t}=await import("../rest/versionManagement/gdbVersion/startEditing.js"),r=await t(this.url,e.guid,V);if(r){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),i=new g(r),s={name:e.name,moment:r,lockType:"edit",stack:i};this._addOrUpdateItem(e.guid,s),c(this._featureServiceUrl,null,e.name,r)}return r}async stopEditing(e,t){if(t){const t=p.get(this.url)?.get(e.guid);if(t?.stack?.canRedo()){const[{deleteForwardEdits:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/deleteForwardEdits.js"),import("../rest/versionManagement/gdbVersion/support/DeleteForwardEditsParameters.js")]);if(!await r(this.url,e.guid,new i({sessionId:V,moment:t.moment})))return!1}}const{stopEditing:r}=await import("../rest/versionManagement/gdbVersion/stopEditing.js"),i=await r(this.url,e.guid,V,t);if(i){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate);this._addOrUpdateItem(e.guid,{name:e.name,moment:r,lockType:"read",editMomentStack:void 0}),c(this._featureServiceUrl,null,e.name,r)}return i}getLockType(e){const t=p.get(this.url)?.get(e.guid)?.lockType;return t??"none"}changeVersionInternal(e,t,r){let i=null,s=null,n=null,o=null;const a=e=>!e||e===this.defaultVersionIdentifier.name,d=e=>{const t=p?.get(this.url)?.get(e.guid);n=e.name,o=t?.moment??null},u=(e,t)=>!e&&!t||!(!e||!t)&&e.toISOString()===t.toISOString();if("name"in t){if("none"!==this.getLockType(t))return!1;i=t.name,s=null,"name"in r?d(r):(n=this.defaultVersionIdentifier.name,o=r)}else i=this.defaultVersionIdentifier.name,s=t,"name"in r?d(r):(n=this.defaultVersionIdentifier.name,o=r);return(a(i)&&a(e.gdbVersion)&&u(e.historicMoment,s)||i===e.gdbVersion&&u(e.historicMoment,s))&&(e.gdbVersion=n,e.historicMoment=o),!0}changeVersion(e,t,r){if("networkServiceUrl"in e){if(this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase())return this.changeVersionInternal(e,t,r)}else{let i;"layers"in e?(i=e.allTables.concat(e.allLayers),e.utilityNetworks&&e.utilityNetworks.forEach((e=>{this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase()&&this.changeVersionInternal(e,t,r)}))):i=e;for(const e of i)if("feature"===e.type){const i=/^(.*\/FeatureServer)\/\d+$/,s=e.url.replace(i,"$1");if(this._featureServiceUrl.toLowerCase()===s.toLowerCase()&&!this.changeVersionInternal(e,t,r))return!1}}return!0}async getVersionIdentifierFromName(e){try{const t=await this.getVersionInfos({includeHidden:!0});return t.find((t=>t.versionIdentifier.name===e))?.versionIdentifier||null}catch{return null}}async getVersionIdentifierFromGuid(e){const{getVersion:t}=await import("../rest/versionManagement/getVersion.js");try{return(await t(this.url,e)).versionIdentifier}catch{return null}}canUndo(e){const t=p.get(this.url)?.get(e.guid);return!!t?.stack?.canUndo()}canRedo(e){const t=p.get(this.url)?.get(e.guid);return!!t?.stack?.canRedo()}undo(e){const t=p.get(this.url)?.get(e.guid),r=t?.stack?.undo()||void 0;if(t&&r){const r=t.stack.peek();c(this._featureServiceUrl,null,e.name,r),p.get(this.url)?.set(e.guid,{...t,moment:r})}}redo(e){const t=p.get(this.url)?.get(e.guid),r=t?.stack?.redo()||void 0;t&&r&&(c(this._featureServiceUrl,null,e.name,r),p.get(this.url)?.set(e.guid,{...t,moment:r}))}_addMomentToVersionItem(e,t){const r=p.get(this.url);if(r)for(const[i,s]of r){s.name===e&&this._addToStack(i,t)}}_canAddToStack(e,t){if(e){return e.getTime()<t.getTime()}return!0}_addToStack(e,t){const r=p.get(this.url),i=r?.get(e);return!!i?.stack&&(this._canAddToStack(i.stack.peek(),t)&&i.stack.push(t),r.set(e,{...i,moment:t}),!0)}_addOrUpdateItem(e,t){const r=p.get(this.url),i=r?.get(e);return i?(r.set(e,{...i,...t}),!0):!(!t.name||!t.lockType)&&(r?.set(e,{...t,lockType:t.lockType}),!0)}async _fetchService(e,r){if(this.sourceJSON){this.read(this.sourceJSON,{origin:"service",url:m(e)});const t=new n(this.url).host;return void h.set(t,this.defaultVersionIdentifier.name)}const i=await t(e,{responseType:"json",query:{f:"json"},...r});this.read(i.data)}};e([o()],v.prototype,"url",void 0),e([o()],v.prototype,"sourceJSON",void 0),e([o({type:String,json:{write:!0}})],v.prototype,"name",void 0),e([o({json:{write:{target:{defaultVersionName:{type:String},defaultVersionGuid:{type:String}}},read:{source:["defaultVersionName","defaultVersionGuid"]}}})],v.prototype,"defaultVersionIdentifier",void 0),e([a("defaultVersionIdentifier",["defaultVersionName","defaultVersionGuid"])],v.prototype,"readDefaultVersionIdentifier",null),e([u("defaultVersionIdentifier",{defaultVersionName:{type:String},defaultVersionGuid:{type:String}})],v.prototype,"writeDefaultVersionIdentifier",null),e([o({json:{write:!0}})],v.prototype,"capabilities",void 0),v=e([d("esri.versionManagement.VersionManagementService")],v);const y=v;export{y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import i from"../core/Loadable.js";import{removeTrailingSlash as s,Url as n}from"../core/urlUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as a}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import{onApplyEditsEvent as u,emitUpdateMomentEvent as c}from"../layers/mixins/EditBusLayer.js";import{parseUrl as m}from"../rest/utils.js";import g from"./support/EditMomentStack.js";import{versionCollection as p,versionCollectionCount as f,defaultVersionNameLookup as h,currentSessionId as V}from"./support/versionManagementUtils.js";let v=class extends(r(i)){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.name=null,this.defaultVersionIdentifier=null,this.capabilities=null,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:i}=e;t===this._featureServiceUrl&&i.then((e=>{const t=e.historicMoment;t&&this._addMomentToVersionItem(r,t)}))}}initialize(){this.url=s(this.url),this._featureServiceUrl=this.url.replace(/\/VersionManagementServer/i,"/FeatureServer"),p.has(this.url)||p.set(this.url,new Map);const e=(f.get(this.url)??0)+1;f.set(this.url,e),this.when().then((()=>this.addHandles(u(this._applyEditsHandler))),(()=>{}))}destroy(){const e=(f.get(this.url)??1)-1;f.set(this.url,e),0===e&&p.delete(this.url),h.delete(this._featureServiceUrl)}read(e,t){this.sourceJSON=e,super.read(e,t)}readDefaultVersionIdentifier(e,t){return{name:t.defaultVersionName,guid:t.defaultVersionGuid}}writeDefaultVersionIdentifier(e,t){t.defaultVersionName=e.name,t.defaultVersionGuid=e.guid}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async createVersion(e){const[{createVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/createVersion.js"),import("../rest/versionManagement/support/CreateVersionParameters.js")]),i=r.from(e);return t(this.url,i)}async deleteVersion(e){const[{deleteVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/deleteVersion.js"),import("../rest/versionManagement/support/DeleteVersionParameters.js")]);let i;e.guid&&p.get(this.url)?.has(e.guid)&&(i=V??void 0);const s=new r({versionName:e.name,sessionId:i});return t(this.url,s)}async getVersionInfoExtended(e){const{getVersion:t}=await import("../rest/versionManagement/getVersion.js");return t(this.url,e.guid)}async getVersionInfos(e={}){const[{getVersionInfos:t},{default:r}]=await Promise.all([import("../rest/versionManagement/getVersionInfos.js"),import("../rest/versionManagement/support/GetVersionInfosParameters.js")]),i=r.from(e);return t(this.url,i)}async reconcile(e,t={}){const[{reconcile:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/reconcile.js"),import("../rest/versionManagement/gdbVersion/support/ReconcileParameters.js")]),s=i.from(t);return s.sessionId=V,r(this.url,e.guid,s)}async post(e){const[{post:t},{default:r}]=await Promise.all([import("../rest/versionManagement/gdbVersion/post.js"),import("../rest/versionManagement/gdbVersion/support/PostParameters.js")]),i=r.from({sessionId:V});return t(this.url,e.guid,i)}async alterVersion(e,t){const[{alterVersion:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/alterVersion.js"),import("../rest/versionManagement/gdbVersion/support/AlterVersionParameters.js")]),s=i.from(t);return r(this.url,e.guid,s)}async startReading(e){const{startReading:t}=await import("../rest/versionManagement/gdbVersion/startReading.js"),r=await t(this.url,e.guid,V);if(r){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),i={name:t.versionIdentifier.name,moment:r,lockType:"read"};this._addOrUpdateItem(e.guid,i),c(this._featureServiceUrl,null,e.name,r)}return r}async stopReading(e){const{stopReading:t}=await import("../rest/versionManagement/gdbVersion/stopReading.js"),r=await t(this.url,e.guid,V);return r&&(p.get(this.url)?.delete(e.guid),c(this._featureServiceUrl,null,e.name,null)),r}async startEditing(e){const{startEditing:t}=await import("../rest/versionManagement/gdbVersion/startEditing.js"),r=await t(this.url,e.guid,V);if(r){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),i=new g(r),s={name:e.name,moment:r,lockType:"edit",stack:i};this._addOrUpdateItem(e.guid,s),c(this._featureServiceUrl,null,e.name,r)}return r}async stopEditing(e,t){if(t){const t=p.get(this.url)?.get(e.guid);if(t?.stack?.canRedo()){const[{deleteForwardEdits:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/deleteForwardEdits.js"),import("../rest/versionManagement/gdbVersion/support/DeleteForwardEditsParameters.js")]);if(!await r(this.url,e.guid,new i({sessionId:V,moment:t.moment})))return!1}}const{stopEditing:r}=await import("../rest/versionManagement/gdbVersion/stopEditing.js"),i=await r(this.url,e.guid,V,t);if(i){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate);this._addOrUpdateItem(e.guid,{name:e.name,moment:r,lockType:"read",editMomentStack:void 0}),c(this._featureServiceUrl,null,e.name,r)}return i}getLockType(e){const t=p.get(this.url)?.get(e.guid)?.lockType;return t??"none"}changeVersionInternal(e,t,r){let i=null,s=null,n=null,o=null;const a=e=>!e||e===this.defaultVersionIdentifier.name,d=e=>{const t=p?.get(this.url)?.get(e.guid);n=e.name,o=t?.moment??null},l=(e,t)=>!e&&!t||!(!e||!t)&&e.toISOString()===t.toISOString();if("name"in t){if("none"!==this.getLockType(t))return!1;i=t.name,s=null,"name"in r?d(r):(n=this.defaultVersionIdentifier.name,o=r)}else i=this.defaultVersionIdentifier.name,s=t,"name"in r?d(r):(n=this.defaultVersionIdentifier.name,o=r);return(a(i)&&a(e.gdbVersion)&&l(e.historicMoment,s)||i===e.gdbVersion&&l(e.historicMoment,s))&&(e.gdbVersion=n,e.historicMoment=o),!0}changeVersion(e,t,r){if("networkServiceUrl"in e){if(this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase())return this.changeVersionInternal(e,t,r)}else{let i;"layers"in e?(i=e.allTables.concat(e.allLayers),e.utilityNetworks&&e.utilityNetworks.forEach((e=>{this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase()&&this.changeVersionInternal(e,t,r)}))):i=e;for(const e of i)if("feature"===e.type){const i=/^(.*\/FeatureServer)\/\d+$/,s=e.url.replace(i,"$1");if(this._featureServiceUrl.toLowerCase()===s.toLowerCase()&&!this.changeVersionInternal(e,t,r))return!1}}return!0}async getVersionIdentifierFromName(e){try{const t=await this.getVersionInfos({includeHidden:!0});return t.find((t=>t.versionIdentifier.name===e))?.versionIdentifier||null}catch{return null}}async getVersionIdentifierFromGuid(e){const{getVersion:t}=await import("../rest/versionManagement/getVersion.js");try{return(await t(this.url,e)).versionIdentifier}catch{return null}}canUndo(e){const t=p.get(this.url)?.get(e.guid);return!!t?.stack?.canUndo()}canRedo(e){const t=p.get(this.url)?.get(e.guid);return!!t?.stack?.canRedo()}undo(e){const t=p.get(this.url)?.get(e.guid),r=t?.stack?.undo()||void 0;if(t&&r){const r=t.stack.peek();c(this._featureServiceUrl,null,e.name,r),p.get(this.url)?.set(e.guid,{...t,moment:r})}}redo(e){const t=p.get(this.url)?.get(e.guid),r=t?.stack?.redo()||void 0;t&&r&&(c(this._featureServiceUrl,null,e.name,r),p.get(this.url)?.set(e.guid,{...t,moment:r}))}_addMomentToVersionItem(e,t){const r=p.get(this.url);if(r)for(const[i,s]of r){s.name===e&&this._addToStack(i,t)}}_canAddToStack(e,t){if(e){return e.getTime()<t.getTime()}return!0}_addToStack(e,t){const r=p.get(this.url),i=r?.get(e);return!!i?.stack&&(this._canAddToStack(i.stack.peek(),t)&&i.stack.push(t),r.set(e,{...i,moment:t}),!0)}_addOrUpdateItem(e,t){const r=p.get(this.url),i=r?.get(e);return i?(r.set(e,{...i,...t}),!0):!(!t.name||!t.lockType)&&(r?.set(e,{...t,lockType:t.lockType}),!0)}async _fetchService(e,r){if(this.sourceJSON){this.read(this.sourceJSON,{origin:"service",url:m(e)});const t=new n(this.url).host;return void h.set(t,this.defaultVersionIdentifier.name)}const i=await t(e,{responseType:"json",query:{f:"json"},...r});this.read(i.data)}};e([o()],v.prototype,"url",void 0),e([o()],v.prototype,"sourceJSON",void 0),e([o({type:String,json:{write:!0}})],v.prototype,"name",void 0),e([o({json:{write:{target:{defaultVersionName:{type:String},defaultVersionGuid:{type:String}}},read:{source:["defaultVersionName","defaultVersionGuid"]}}})],v.prototype,"defaultVersionIdentifier",void 0),e([a("defaultVersionIdentifier",["defaultVersionName","defaultVersionGuid"])],v.prototype,"readDefaultVersionIdentifier",null),e([l("defaultVersionIdentifier",{defaultVersionName:{type:String},defaultVersionGuid:{type:String}})],v.prototype,"writeDefaultVersionIdentifier",null),e([o({json:{write:!0}})],v.prototype,"capabilities",void 0),v=e([d("esri.versionManagement.VersionManagementService")],v);const y=v;export{y 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{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{disposeMaybe as e}from"../../../../core/maybe.js";import{vtlBrushes as t}from"../vtlBrushes.js";import s from"./shaders/VTLMaterialManager.js";import{StyleLayerType as r,Visibility as a}from"./style/StyleDefinition.js";import{CompareFunction as n,BlendFactor as i}from"../../../webgl/enums.js";const o=1e-6;class l{constructor(e,t){this.spriteMosaic=e,this.glyphMosaic=t,this._brushCache=new Map,this._vtlMaterialManager=new s}dispose(){this._brushCache&&(this._brushCache.forEach((e=>e.dispose())),this._brushCache=null),this._vtlMaterialManager=e(this._vtlMaterialManager),this.spriteMosaic.dispose(),this.glyphMosaic.dispose()}get vectorTilesMaterialManager(){return this._vtlMaterialManager}drawSymbols(e,t,s){const n=s.layers;e.renderPass="translucent";for(let i=0;i<n.length;i++){const s=n[i];if(s.type!==r.SYMBOL)continue;const l=s.getLayoutProperty("visibility");if(l&&l.getValue()===a.NONE)continue;const c=e.displayLevel;void 0!==s.minzoom&&s.minzoom>c+o||void 0!==s.maxzoom&&s.maxzoom<=c-o||(e.styleLayerUID=s.uid,e.styleLayer=s,this._drawWithBrush(e,t,"vtlSymbol"))}}drawBackground(e,t,s){if(0===s.backgroundBucketIds.length)return;const{context:n,displayLevel:i}=e;n.setBlendingEnabled(!0),n.setDepthTestEnabled(!1),n.setStencilTestEnabled(!1),e.renderPass="background",s.backgroundBucketIds.forEach((n=>{const l=s.getLayerById(n);if(l.type!==r.BACKGROUND)return;const c=l.getLayoutProperty("visibility");c&&c.getValue()===a.NONE||void 0!==l.minzoom&&l.minzoom>i+o||void 0!==l.maxzoom&&l.maxzoom<=i-o||(e.styleLayerUID=l.uid,e.styleLayer=l,this._drawWithBrush(e,t,"vtlBackground"))}))}drawTile(e,t,s,r){const{context:a}=e,o=s.layers;a.setBlendingEnabled(!1),a.setDepthTestEnabled(!0),a.setDepthWriteEnabled(!0),a.setDepthFunction(n.LEQUAL),e.renderPass="opaque";for(let n=o.length-1;n>=0;n--){const s=o[n];null!=r&&r!==s.type||this._renderStyleLayer(s,e,t,!1)}a.setDepthWriteEnabled(!1),a.setBlendingEnabled(!0),a.setBlendFunctionSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let n=0;n<o.length;n++){const s=o[n];null!=r&&r!==s.type||this._renderStyleLayer(s,e,t,!1)}a.setDepthTestEnabled(!1),a.bindVAO()}_renderStyleLayer(e,t,s,n){if(!(n||e&&s.layerData.has(e.uid)))return;const i=e.getLayoutProperty("visibility");if(i&&i.getValue()===a.NONE)return;const{renderPass:l}=t;let c;switch(e.type){case r.BACKGROUND:if("background"!==l)return;c="vtlBackground";break;case r.FILL:if("opaque"!==l&&"translucent"!==t.renderPass)return;c="vtlFill";break;case r.LINE:if("translucent"!==l)return;c="vtlLine";break;case r.CIRCLE:if("translucent"!==l)return;c="vtlCircle";break;case r.SYMBOL:if("translucent"!==l)return;c="vtlSymbol"}const d=t.displayLevel;if(void 0!==e.minzoom&&e.minzoom>d+o||void 0!==e.maxzoom&&e.maxzoom<=d-o)return;const{context:h}=t;h.setStencilTestEnabled(!1),h.setStencilWriteMask(0),t.styleLayerUID=e.uid,t.styleLayer=e,this._drawWithBrush(t,s,c)}_drawWithBrush(e,s,r){if(!this._brushCache.has(r)){const e=t[r];this._brushCache.set(r,new e)}this._brushCache.get(r).drawMany(e,[s])}}export{l as default};
5
+ import{disposeMaybe as e}from"../../../../core/maybe.js";import{vtlBrushes as t}from"../vtlBrushes.js";import s from"./shaders/VTLMaterialManager.js";import{StyleLayerType as r,Visibility as a}from"./style/StyleDefinition.js";import{CompareFunction as n,BlendFactor as i}from"../../../webgl/enums.js";const o=1e-6;class l{constructor(e,t){this.spriteMosaic=e,this.glyphMosaic=t,this._brushCache=new Map,this._vtlMaterialManager=new s}dispose(){this._brushCache&&(this._brushCache.forEach((e=>e.dispose())),this._brushCache=null),this._vtlMaterialManager=e(this._vtlMaterialManager),this.spriteMosaic.dispose(),this.glyphMosaic.dispose()}get vectorTilesMaterialManager(){return this._vtlMaterialManager}drawSymbols(e,t,s){const n=s.layers;e.renderPass="translucent";for(let i=0;i<n.length;i++){const s=n[i];if(s.type!==r.SYMBOL)continue;const l=s.getLayoutProperty("visibility");if(l&&l.getValue()===a.NONE)continue;const c=e.displayLevel;void 0!==s.minzoom&&s.minzoom>c+o||void 0!==s.maxzoom&&s.maxzoom<=c-o||(e.styleLayerUID=s.uid,e.styleLayer=s,this._drawWithBrush(e,t,"vtlSymbol"))}}drawBackground(e,t,s){if(0===s.backgroundBucketIds.length)return;const{context:n,displayLevel:i,requiredLevel:l}=e;t.key.level=l,n.setBlendingEnabled(!0),n.setDepthTestEnabled(!1),n.setStencilTestEnabled(!1),e.renderPass="background",s.backgroundBucketIds.forEach((n=>{const l=s.getLayerById(n);if(l.type!==r.BACKGROUND)return;const c=l.getLayoutProperty("visibility");c&&c.getValue()===a.NONE||void 0!==l.minzoom&&l.minzoom>i+o||void 0!==l.maxzoom&&l.maxzoom<=i-o||(e.styleLayerUID=l.uid,e.styleLayer=l,this._drawWithBrush(e,t,"vtlBackground"))}))}drawTile(e,t,s,r){const{context:a}=e,o=s.layers;a.setBlendingEnabled(!1),a.setDepthTestEnabled(!0),a.setDepthWriteEnabled(!0),a.setDepthFunction(n.LEQUAL),e.renderPass="opaque";for(let n=o.length-1;n>=0;n--){const s=o[n];null!=r&&r!==s.type||this._renderStyleLayer(s,e,t,!1)}a.setDepthWriteEnabled(!1),a.setBlendingEnabled(!0),a.setBlendFunctionSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let n=0;n<o.length;n++){const s=o[n];null!=r&&r!==s.type||this._renderStyleLayer(s,e,t,!1)}a.setDepthTestEnabled(!1),a.bindVAO()}_renderStyleLayer(e,t,s,n){if(!(n||e&&s.layerData.has(e.uid)))return;const i=e.getLayoutProperty("visibility");if(i&&i.getValue()===a.NONE)return;const{renderPass:l}=t;let c;switch(e.type){case r.BACKGROUND:if("background"!==l)return;c="vtlBackground";break;case r.FILL:if("opaque"!==l&&"translucent"!==t.renderPass)return;c="vtlFill";break;case r.LINE:if("translucent"!==l)return;c="vtlLine";break;case r.CIRCLE:if("translucent"!==l)return;c="vtlCircle";break;case r.SYMBOL:if("translucent"!==l)return;c="vtlSymbol"}const d=t.displayLevel;if(void 0!==e.minzoom&&e.minzoom>d+o||void 0!==e.maxzoom&&e.maxzoom<=d-o)return;const{context:h}=t;h.setStencilTestEnabled(!1),h.setStencilWriteMask(0),t.styleLayerUID=e.uid,t.styleLayer=e,this._drawWithBrush(t,s,c)}_drawWithBrush(e,s,r){if(!this._brushCache.has(r)){const e=t[r];this._brushCache.set(r,new e)}this._brushCache.get(r).drawMany(e,[s])}}export{l 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 e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Logger.js";import{isPowerOfTwo as s}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as o}from"../../../../core/perspectiveUtils.js";import{watch as n,when as a,initial as m}from"../../../../core/reactiveUtils.js";import{a as l}from"../../../../chunks/mat3f64.js";import{s as h}from"../../../../chunks/vec2.js";import{a as p}from"../../../../chunks/vec2f64.js";import{AnimatedSymbolRepeatType as c}from"../../../../symbols/cim/enums.js";import{DisplayObject as u}from"../DisplayObject.js";import{play as d}from"./animatedFormats/utils.js";import{BufferObject as f}from"../../../webgl/BufferObject.js";import{ContextType as w}from"../../../webgl/contextUtils.js";import{TextureWrapMode as y,Usage as g}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as x}from"../../../webgl/VertexArrayObject.js";const _=l(),V={none:c.None,loop:c.Loop,oscillate:c.Oscillate};function b(e){return e?{...e,repeatType:e.repeatType?V[e.repeatType]:void 0}:{}}class T extends u{constructor(s){super(),this.elementView=s,this.isWrapAround=!1,this.perspectiveTransform=p(),this._vertices=new Float32Array(20),this._handles=[],this._handles.push(n((()=>this.elementView.element.opacity),(e=>this.opacity=e),m),n((()=>[this.elementView.coords]),(()=>{this.requestRender()}),m),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&this._handles.push(t(e.content,"play",(()=>this.requestRender())))}),m)),s.element.load().catch((t=>{r.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:s,error:t}))}))}destroy(){this._handles.forEach((e=>e.remove())),this.texture=i(this.texture)}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,o=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(o,n),this.texture)i&&!r.paused&&(this.texture.setData(r),this.requestRender(),(t.type===w.WEBGL2||s(o)&&s(n))&&this.texture.generateMipmap());else{const e=new j;if(e.wrapMode=y.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=o,e.height=n,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new v(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.push(d(r,b(this.elementView.element.animationOptions),null,s))}else this.texture=new v(t,e,r);(t.type===w.WEBGL2||s(o)&&s(n))&&this.texture.generateMipmap(),i&&!r.paused&&this.requestRender()}}super.beforeRender(e)}_createTransforms(){return null}updateDrawCoords(e,t){const r=this.elementView.coords;if(null==r)return;const[s,i,o,n]=r.rings[0],a=this._vertices,{x:m,y:l}=e,h=0!==t;h?a.set([i[0]-m,i[1]-l,s[0]-m,s[1]-l,o[0]-m,o[1]-l,n[0]-m,n[1]-l,n[0]-m,n[1]-l,i[0]+t-m,i[1]-l,i[0]+t-m,i[1]-l,s[0]+t-m,s[1]-l,o[0]+t-m,o[1]-l,n[0]+t-m,n[1]-l]):a.set([i[0]-m,i[1]-l,s[0]-m,s[1]-l,o[0]-m,o[1]-l,n[0]-m,n[1]-l]),this.isWrapAround=h}getVAO(e,t,r){if(null==this.elementView.coords)return null;const s=this._vertices;if(this._vao)this._geometryVbo.setData(s);else{this._geometryVbo=f.createVertex(e,g.DYNAMIC_DRAW,s);const i=f.createVertex(e,g.STATIC_DRAW,new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]));this._vao=new x(e,r,t,{geometry:this._geometryVbo,tex:i})}return this._vao}_updatePerspectiveTransform(e,t){const r=this._vertices;o(_,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),h(this.perspectiveTransform,_[6]/_[8]*e,_[7]/_[8]*t)}}export{T as default};
5
+ import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Logger.js";import{isPowerOfTwo as s}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as o}from"../../../../core/perspectiveUtils.js";import{watch as n,when as a,initial as m}from"../../../../core/reactiveUtils.js";import{a as l}from"../../../../chunks/mat3f64.js";import{s as h}from"../../../../chunks/vec2.js";import{a as p}from"../../../../chunks/vec2f64.js";import{AnimatedSymbolRepeatType as c}from"../../../../symbols/cim/enums.js";import{DisplayObject as u}from"../DisplayObject.js";import{play as d}from"./animatedFormats/utils.js";import{BufferObject as f}from"../../../webgl/BufferObject.js";import{ContextType as y}from"../../../webgl/contextUtils.js";import{TextureWrapMode as w,Usage as g}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as _}from"../../../webgl/VertexArrayObject.js";const j=l(),V={none:c.None,loop:c.Loop,oscillate:c.Oscillate};function b(e){return e?{...e,playAnimation:e.playing,repeatType:e.repeatType?V[e.repeatType]:void 0}:{}}class T extends u{constructor(s){super(),this.elementView=s,this.isWrapAround=!1,this.perspectiveTransform=p(),this._playHandle=null,this._vertices=new Float32Array(20),this._handles=[],this._handles.push(n((()=>this.elementView.element.opacity),(e=>this.opacity=e),m),n((()=>[this.elementView.coords]),(()=>{this.requestRender()}),m),n((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._playHandle?.remove(),this.texture=i(this.texture),this.requestRender()}),m),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&this._handles.push(t(e.content,"play",(()=>this.requestRender())))}),m)),s.element.load().catch((t=>{r.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:s,error:t}))}))}destroy(){this._playHandle?.remove(),this._handles.forEach((e=>e.remove())),this.texture=i(this.texture)}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,o=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(o,n),this.texture)i&&!r.paused&&(this.texture.setData(r),this.requestRender(),(t.type===y.WEBGL2||s(o)&&s(n))&&this.texture.generateMipmap());else{const e=new x;if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=o,e.height=n,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new v(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&(this._playHandle=d(r,b(this.elementView.element.animationOptions),null,s))}else this.texture=new v(t,e,r);(t.type===y.WEBGL2||s(o)&&s(n))&&this.texture.generateMipmap(),i&&!r.paused&&this.requestRender()}}super.beforeRender(e)}_createTransforms(){return null}updateDrawCoords(e,t){const r=this.elementView.coords;if(null==r)return;const[s,i,o,n]=r.rings[0],a=this._vertices,{x:m,y:l}=e,h=0!==t;h?a.set([i[0]-m,i[1]-l,s[0]-m,s[1]-l,o[0]-m,o[1]-l,n[0]-m,n[1]-l,n[0]-m,n[1]-l,i[0]+t-m,i[1]-l,i[0]+t-m,i[1]-l,s[0]+t-m,s[1]-l,o[0]+t-m,o[1]-l,n[0]+t-m,n[1]-l]):a.set([i[0]-m,i[1]-l,s[0]-m,s[1]-l,o[0]-m,o[1]-l,n[0]-m,n[1]-l]),this.isWrapAround=h}getVAO(e,t,r){if(null==this.elementView.coords)return null;const s=this._vertices;if(this._vao)this._geometryVbo.setData(s);else{this._geometryVbo=f.createVertex(e,g.DYNAMIC_DRAW,s);const i=f.createVertex(e,g.STATIC_DRAW,new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]));this._vao=new _(e,r,t,{geometry:this._geometryVbo,tex:i})}return this._vao}_updatePerspectiveTransform(e,t){const r=this._vertices;o(j,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),h(this.perspectiveTransform,j[6]/j[8]*e,j[7]/j[8]*t)}}export{T 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{InputHandler as i}from"../../../input/InputHandler.js";import{onVisibilityChange as t}from"../../../input/VisibilityChange.js";class e extends i{constructor(i,e,s){super(!0),this.view=i,this.keys=e,this._isSticky=!1,this._pressedKeys=new Set,this._timeout=void 0,this._currentDirection=void 0,this._stickyKeyDuration=200,this._handleKey=i=>{const t=this._keyMap[i.data.key];if(null==t||i.modifiers.has("Meta")||i.modifiers.has("Ctrl"))return;i.stopPropagation(),i.preventDefault();const e="key-down"===i.type;if(this._pressedKeys[e?"add":"delete"](t),e){if(this._direction===t)return;this._direction=t,this._isSticky=!1,this._setTimeout((()=>{this._isSticky&&this._handlePopKey()}))}else{const i=void 0===this._timeout,t=this._pressedKeys.size>0;i||t?this._handlePopKey():this._isSticky=!0}},this._handlePopKey=()=>{this._direction=Array.from(this._pressedKeys).pop(),null==this._direction&&this._stopMovement()},this._stopMovement=()=>{this._isSticky=!1,this._direction=void 0,this._pressedKeys.clear(),this._setTimeout(void 0)},this._keyMap={[e.left]:"left",[e.right]:"right",[e.up]:"up",[e.down]:"down"},this.registerIncoming("key-down",s,this._handleKey),this.registerIncoming("key-up",s,this._handleKey),this.registerIncoming("blur",s,this._stopMovement),this._visibilityHandle=t((i=>i?null:this._stopMovement()))}onUninstall(){this._stopMovement(),this._visibilityHandle?.remove()}get _direction(){return this._currentDirection}set _direction(i){const t=null!=this._currentDirection;if(null!=i){if(t||this.view.mapViewNavigation.begin(),this._currentDirection!==i)switch(i){case"left":this.view.mapViewNavigation.continousPanLeft();break;case"right":this.view.mapViewNavigation.continousPanRight();break;case"up":this.view.mapViewNavigation.continousPanUp();break;case"down":this.view.mapViewNavigation.continousPanDown()}}else t&&this.view.mapViewNavigation.stop();this._currentDirection=i}_setTimeout(i){clearTimeout(this._timeout),this._timeout=void 0===i?void 0:setTimeout((()=>{this._timeout=void 0,i()}),this._stickyKeyDuration)}}export{e as KeyPan};
5
+ import{InputHandler as i}from"../../../input/InputHandler.js";import{onVisibilityChange as t}from"../../../input/VisibilityChange.js";class e extends i{constructor(i,e,s){super(!0),this.view=i,this.keys=e,this._isSticky=!1,this._pressedKeys=new Set,this._timeout=void 0,this._currentDirection=void 0,this._stickyKeyDuration=200,this._handleKey=i=>{const t=this._keyMap[i.data.key];if(i.modifiers.has("Meta")||i.modifiers.has("Ctrl"))return void this._stopMovement();if(null==t)return;i.stopPropagation(),i.preventDefault();const e="key-down"===i.type;if(this._pressedKeys[e?"add":"delete"](t),e){if(this._direction===t)return;this._direction=t,this._isSticky=!1,this._setTimeout((()=>{this._isSticky&&this._handlePopKey()}))}else{const i=void 0===this._timeout,t=this._pressedKeys.size>0;i||t?this._handlePopKey():this._isSticky=!0}},this._handlePopKey=()=>{this._direction=Array.from(this._pressedKeys).pop(),null==this._direction&&this._stopMovement()},this._stopMovement=()=>{this._isSticky=!1,this._direction=void 0,this._pressedKeys.clear(),this._setTimeout(void 0)},this._keyMap={[e.left]:"left",[e.right]:"right",[e.up]:"up",[e.down]:"down"},this.registerIncoming("key-down",s,this._handleKey),this.registerIncoming("key-up",s,this._handleKey),this.registerIncoming("blur",s,this._stopMovement),this._visibilityHandle=t((i=>i?null:this._stopMovement()))}onUninstall(){this._stopMovement(),this._visibilityHandle?.remove()}get _direction(){return this._currentDirection}set _direction(i){const t=null!=this._currentDirection;if(null!=i){if(t||this.view.mapViewNavigation.begin(),this._currentDirection!==i)switch(i){case"left":this.view.mapViewNavigation.continousPanLeft();break;case"right":this.view.mapViewNavigation.continousPanRight();break;case"up":this.view.mapViewNavigation.continousPanUp();break;case"down":this.view.mapViewNavigation.continousPanDown()}}else t&&this.view.mapViewNavigation.stop();this._currentDirection=i}_setTimeout(i){clearTimeout(this._timeout),this._timeout=void 0===i?void 0:setTimeout((()=>{this._timeout=void 0,i()}),this._stickyKeyDuration)}}export{e as KeyPan};
@@ -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{Manipulation as t,ManipulatorType as i}from"./Manipulation.js";import{createManipulatorDragEventPipeline as r,screenToMap as a}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as o}from"../../../../interactive/GraphicManipulator.js";import{AccumulationBehaviour as e}from"../../../../interactive/editGeometry/interfaces.js";import{getSymbolInfo as s}from"../../../../interactive/support/utils.js";class n extends t{constructor(t){super(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._manipulator=this._createManipulator(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}destroy(){this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._tool=null,this._view=null,this._manipulator=null,this._graphic=null}forEachManipulator(t){t(this._manipulator,i.TRANSLATE_XY)}createDragPipeline(t,i){let o=null,n=null,c=0,l=0,p=0;const{offsetX:m,offsetY:h,size:u}=s(this._graphic.symbol);return r(this._manipulator,((r,s)=>{s.next((i=>{if("start"===i.action){const i=t();o=i.editGeometryOperations,n=i.constraints}return i})).next(a(this._view)).next((t=>{const{x:r,y:a,z:s}=t.mapEnd;if(n&&(r+m<n.xmin||a+h-u<n.ymin||r+m>n.xmax||a+h-u>n.ymax))return t;"start"===t.action&&(c=t.mapStart.x,l=t.mapStart.y,p=t.mapStart.z);const _=r-c,f=a-l,v=s-p;c=r,l=a,p=s;const x=[];for(const i of o.data.components)x.push(...i.vertices);const d="start"===t.action?e.NEW_STEP:e.ACCUMULATE_STEPS,E=o.moveVertices(x,_,f,v,d);return i(t,E),t}))}))}_createManipulator(){const t=this._view,i=this._graphic;return new o({view:t,graphic:i,selectable:!0,cursor:"move"})}}export{n as DragManipulation};
5
+ import{Manipulation as t,ManipulatorType as i}from"./Manipulation.js";import{createManipulatorDragEventPipeline as r,screenToMap as a}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as o}from"../../../../interactive/GraphicManipulator.js";import{AccumulationBehaviour as e}from"../../../../interactive/editGeometry/interfaces.js";import{getSymbolInfo as s}from"../../../../interactive/support/utils.js";class n extends t{constructor(t){super(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._manipulator=this._createManipulator(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}destroy(){this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._tool=null,this._view=null,this._manipulator=null,this._graphic=null}forEachManipulator(t){t(this._manipulator,i.TRANSLATE_XY)}createDragPipeline(t,i){let o=null,n=null,c=0,l=0,p=0;const{offsetX:m,offsetY:h,size:u}=s(this._graphic.symbol);return r(this._manipulator,((r,s)=>{s.next((i=>{if("start"===i.action){const i=t();o=i.editGeometryOperations,n=i.constraints}return i})).next(a(this._view)).next((t=>{const{x:r,y:a,z:s}=t.mapEnd;if(n&&(r+m<n.xmin||a+h-u<n.ymin||r+m>n.xmax||a+h-u>n.ymax))return t;("start"===t.action||0===c&&0===l&&0===p)&&(c=t.mapStart.x,l=t.mapStart.y,p=t.mapStart.z);const _=r-c,f=a-l,v=s-p;c=r,l=a,p=s;const x=[];for(const i of o.data.components)x.push(...i.vertices);const d="start"===t.action?e.NEW_STEP:e.ACCUMULATE_STEPS,E=o.moveVertices(x,_,f,v,d);return i(t,E),t}))}))}_createManipulator(){const t=this._view,i=this._graphic;return new o({view:t,graphic:i,selectable:!0,cursor:"move"})}}export{n as DragManipulation};
@@ -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"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import{isSome as r}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import a from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{clone as o}from"../../../core/lang.js";import l from"../../../core/Logger.js";import{destroyMaybe as u,removeMaybe as d}from"../../../core/maybe.js";import{debounce as h,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as y,initial as g}from"../../../core/reactiveUtils.js";import{pt2px as f}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import b from"../../../layers/effects/FeatureEffectView.js";import v from"../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as R}from"../../../layers/support/layerUtils.js";import w from"../../../rest/support/AggregateFeatureSet.js";import x from"../../../rest/support/FeatureSet.js";import S from"../../../rest/support/Query.js";import{maxFilters as F}from"../engine/webgl/definitions.js";import{LayerView2DMixin as U}from"./LayerView2D.js";import{createSchema as C}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as I}from"./features/tileRenderers.js";import{isRendererSupported as q}from"./features/support/rendererUtils.js";import{findSizeVV as V,createClusterCountSizeVariable as E,injectDynamicLevelDependentSizeVisualVariable as O,isClusterCompatibleRenderer as T,createClusterRenderer as j}from"./support/clusterUtils.js";import A from"./support/FeatureCommandQueue.js";import L from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as Q}from"./support/util.js";import{getSizeForValueSimple as N}from"./support/visualVariableSimpleUtils.js";import{TileManager as k}from"../tiling/TileManager.js";import H from"../../layers/FeatureLayerView.js";import P from"../../layers/LayerView.js";import z from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as J}from"../../webgl/capabilities.js";import D from"../../../geometry/Extent.js";function M(e){return e&&"openPorts"in e}function B(e){for(const t of e){const e="featureReduction"in t&&t.featureReduction&&"labelingInfo"in t.featureReduction?t.featureReduction:void 0,i=[...t.labelingInfo||[],...e?.labelingInfo||[]];if(!t.labelsVisible||!i.length)continue;if(i.some((e=>"none"===e.deconflictionStrategy)))return!0}return!1}function $(e){return t=>f(N(t,e))}function G(e){const t=null!=e&&"visualVariables"in e&&e.visualVariables;if(!t)return null;for(const i of t)if("size"===i.type)return $(i);return null}let K=class extends(H(z(U(P)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new A({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=h((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new b,this._lastDefinitionExpression=null}destroy(){this._updateClusterSizeTask?.remove(),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.addHandles([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),c((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),y)],"constructor"),this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new a("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});if(("feature"===e.type||"subtype-group"===e.type)&&!R(e)?.operations.supportsQuery)throw new a("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const t=this._createClientOptions();return this._set("_proxy",new L({client:t})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get _effectiveFeatureReduction(){if(!("featureReduction"in this.layer))return null;const e=this.layer.featureReduction;return e&&(!("maxScale"in e)||!e.maxScale||e.maxScale<this.view.scale)?e:null}get orderByFields(){return"stream"!==this._serviceOptions?.type?this._serviceOptions?.orderByFields:void 0}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get labelingCollisionInfos(){const{tileRenderer:e,layer:t}=this;if(null==e)return null;const i="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer],r=t.geometryType,s=!B(i),a={};if("subtype-group"!==t.type){if("heatmap"===e?.type)return null;const i=G(t.renderer);a[0]=i}return[{tileRenderer:e,vvEvaluators:a,deconflictionEnabled:s,geometryType:r,visible:!this.suspended}]}get queryMode(){return this._serviceOptions?.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="gdbVersion"in t?t.gdbVersion:void 0,o="historicMoment"in t?t.historicMoment?.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,h="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,p=JSON.stringify(this.clips),c=this._effectiveFeatureReduction?.toJSON(),y="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),f="subtypeCode"in this.layer&&this.layer.subtypeCode;return JSON.stringify({orderBy:y,sublayerHash:g,subtypeCode:f,filterHash:null!=this.filter&&this.filter.toJSON(),effectHash:null!=this.featureEffect&&this.featureEffect.toJSON(),streamFilter:h,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:i,clipsHash:p,featureReduction:c,customParameters:u,apiKey:d,timeZone:this.view.timeZone})}highlight(e){let t;e instanceof i?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:s.isCollection(e)&&e.length>0?t=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const a=t?.filter(r);return a?.length?(this._addHighlight(a),n((()=>this._removeHighlight(a)))):n()}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;has("featurelayer-force-marker-text-draw-order")&&s.sort(((e,t)=>e-t));const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((i=>this._createGraphicHit(e,t.fromJSON(i)))),...a.map((t=>this._createGraphicHit(e,i.fromJSON(t))))]}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryAggregateSummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryAggregateUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryAggregateClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}async queryAggregateHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryAggregates(e,t){const i=await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t),r=w.fromJSON(i);return r.features.forEach((e=>this._setLayersForFeature(e))),r}queryAggregateIds(e,t){return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e),t)}queryAggregateCount(e,t){return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e),t)}queryAggregateJSON(e,t){return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t)}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:D.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new k({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.addAttachHandles(c((()=>this.renderingConfigHash),(()=>this._update()),g)),"stream"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.tileRenderer?.uninstall(this.container),this.tileRenderer=null,this._tileStrategy=u(this._tileStrategy),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,i=null!=this._updatingRequiredFieldsPromise,r=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,a=null==this.tileRenderer||this.tileRenderer?.updating,n=e&&(t||i||r||s||this.dataUpdating||a);return has("esri-2d-log-updating")&&console.log(`Updating FLV2D (${this.layer.id}): ${n}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${i}\n -> updatingProxy ${r}\n -> updatingPipeline ${s}\n -> updatingData: ${this.dataUpdating}\n -> updatingTileRenderer ${a}\n`),n}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},setDataUpdating:e=>{this._set("dataUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,{layer:i}=this,r="editingInfo"in i&&i.editingInfo?.lastEditDate,s="refreshInterval"in i&&!!i.refreshInterval,a=!r&&s,n=R(i);if(t&&("feature"===i.type||"subtype-group"===i.type)&&"point"===i.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!a&&has("featurelayer-snapshot-enabled"))try{const e=await i.queryFeatureCount();if(e<=has("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=has("featurelayer-snapshot-point-max-threshold"),r=has("featurelayer-snapshot-point-coverage"),s=this.view.extent,a=i.fullExtent,n=a?.clone().intersection(s),o=null!=n?n.width*n.height:0,l=a?.width*a?.height;if(e<=t&&(0===l?0:o/l)>=r)return{mode:"snapshot",featureCount:e}}catch(o){l.getLogger(this).warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:o})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const t=R(e),{capabilities:i,objectIdField:r}=e,s=e.fieldsIndex.toJSON(),a=s.fields,n=null!=e.fullExtent?e.fullExtent.toJSON():null,l=Q(e.geometryType),u="timeInfo"in e&&e.timeInfo?.toJSON()||null,d=e.spatialReference?e.spatialReference.toJSON():null,h="feature"===e.type?e.globalIdField:null;let p;"ogc-feature"===e.type?p=e.source.getSource():M(e.source)?p=await e.source.openPorts():e.parsedUrl&&(p=o(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(p.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=("subtypeField"in this.layer?this.layer.subtypeField:null)??null,{mode:g,featureCount:f}=await this._detectQueryMode(p);let m=this.layer.objectIdField;if("feature"===this.layer.type&&null!=this.layer.orderBy&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(m=e)}return{type:g,typeIdField:"typeIdField"in e&&e.typeIdField||void 0,types:"types"in e&&e.types?.map((e=>e.toJSON()))||void 0,timeReferenceUnknownClient:c,subtypeField:y,featureCount:f,globalIdField:h,maxRecordCount:i.query.maxRecordCount,tileMaxRecordCount:i.query.tileMaxRecordCount,capabilities:i,effectiveCapabilities:t,fields:a,fieldsIndex:s,fullExtent:n,geometryType:l,objectIdField:r,source:p,timeInfo:u,spatialReference:d,orderByFields:m}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=S.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_cleanUpAggregateQuery(e){const t=S.from(e)||this.createAggregateQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this.attached&&this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(l.getLogger(this).error(new a("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;if(await this._updateRequiredFields(),this.destroyed)return;const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=this._createConfiguration(s,i,t.filter),n=this._lastDefinitionExpression!==a.schema.source.definitionExpression;this._lastDefinitionExpression=a.schema.source.definitionExpression;const o=a.schema.tileRenderer,u=this._createTileRendererHash(o);if("snapshot"===this._serviceOptions.type&&(a.schema.source.initialFeatureCount=this._serviceOptions.featureCount),u!==this._tileRendererHash){this._initTileRenderer(o,r);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(r),"stream"!==e.type&&M(e.source)&&(t.source=await e.source.openPorts());const i={added:this._tileStrategy.tileKeys(),removed:[]};has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Proxy startup"),await this._proxy.startup(this.view.featuresTilingScheme,a,t,i),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy startup"),this.hasHighlight()&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating highlight"),await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished highlight update")),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate start"),this.tileRenderer.onConfigUpdate(r),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate end")}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.changedFeatureCount=await this.layer.queryFeatureCount()),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating proxy");const t=await this._proxy.update(a);has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy update"),(t.mesh||t.targets?.aggregate)&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Locking GPU Uploads"),this._lockGPUUploads());try{has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Applying update to proxy"),await this._proxy.applyUpdate(t),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished applying update to proxy")}catch(e){p(e)||l.getLogger(this).error(e)}(t.mesh||t.targets?.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=u,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){p(t),0}}async _doRefresh(e){this._lockGPUUploads();try{let t;e&&"snapshot"===this.queryMode&&"queryFeatureCount"in this.layer&&(t=await this.layer.queryFeatureCount()),await this._proxy.refresh({dataChanged:e,featureCount:t})}catch(t){p(t),0}this._unlockGPUUploads(),this._effectiveFeatureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return c((()=>this._aggregateValueRanges),(i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=V(e.visualVariables);if(null!=r&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=E(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e=this.layer,t="renderer"in e?e.renderer:null,i=this._effectiveFeatureReduction;if(this._updateClusterSizeTask=d(this._updateClusterSizeTask),i&&"renderer"in i&&i.renderer&&!i.renderer.authoringInfo?.isAutoGenerated){const e=i.fields;if("cluster"===i.type){const{renderer:t,didInject:r}=O(i.renderer,i,this._aggregateValueRanges);return r&&(this._updateClusterSizeTask=this._createUpdateClusterSizeTask(t,i)),{renderer:t,aggregateFields:e,featureReduction:i}}return{renderer:i.renderer,aggregateFields:e,featureReduction:i}}if(i&&"cluster"===i.type&&t&&T(t)){const e=i,r=[],s=j(r,t,e,this._aggregateValueRanges,!0);return this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,e),{renderer:s,aggregateFields:r,featureReduction:i}}return{renderer:t,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}_initTileRenderer(e,t){const i=I(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer=u(this.tileRenderer)),this.destroyed?null:(this._proxy.tileRenderer=i,this._set("tileRenderer",i),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=null!=e?e.timeExtent:null,i=null!=this.timeExtent&&null!=t?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=null!=e?e.where:null;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return null!=e?e.toJSON():null;(e=null!=e&&e.clone()||new v).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e?.length)return i;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const r=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));r.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",r.join(", ")),null!=i&&i.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),i=i.replace(e,""),i=i.replaceAll(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+a:a}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion??void 0:void 0,a=new Array(F),n=this._injectOverrides(t);a[0]=n,a[1]=null!=i?i.toJSON():null;const o=C(e);if(null==o)return null;const l=J("2d");return{availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize,timeZone:this.view.timeZone}}_hasRequiredSupport(e){return!("renderer"in e)||q(e.renderer)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e=this.layer;return{renderer:"renderer"in e?e.renderer:null,spatialReference:e.spatialReference,timeExtent:"timeExtent"in e?e.timeExtent:null,definitionExpression:e.definitionExpression,featureReduction:this._effectiveFeatureReduction,fields:e.fields,geometryType:e.geometryType,historicMoment:"historicMoment"in e?e.historicMoment:null,labelsVisible:"labelsVisible"in e&&e.labelsVisible,labelingInfo:"labelingInfo"in e?e.labelingInfo:null,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:"gdbVersion"in e?e.gdbVersion:null,pixelBuffer:0,orderBy:"orderBy"in e&&e.orderBy?e.orderBy:null,customParameters:{..."customParameters"in e?e.customParameters:void 0,token:"apiKey"in e?e.apiKey??void 0:void 0},subtypeCode:"subtypeCode"in e?e.subtypeCode:void 0,subtypeField:"subtypeField"in e?e.subtypeField:void 0}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{p(e)||l.getLogger(this).error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{p(e)||l.getLogger(this).error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([m()],K.prototype,"_serviceOptions",void 0),e([m()],K.prototype,"_proxy",void 0),e([m()],K.prototype,"_pipelineIsUpdating",void 0),e([m()],K.prototype,"_effectiveRenderer",void 0),e([m()],K.prototype,"_effectiveFeatureReduction",null),e([m()],K.prototype,"_aggregateValueRanges",void 0),e([m()],K.prototype,"_commandsQueue",void 0),e([m()],K.prototype,"featureEffectView",void 0),e([m()],K.prototype,"labelsVisible",null),e([m()],K.prototype,"labelingCollisionInfos",null),e([m({readOnly:!0})],K.prototype,"queryMode",null),e([m()],K.prototype,"renderingConfigHash",null),e([m()],K.prototype,"tileRenderer",void 0),e([m()],K.prototype,"updating",void 0),K=e([_("esri.views.2d.layers.FeatureLayerView2D")],K);const Z=K;export{Z as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import a from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{clone as o}from"../../../core/lang.js";import l from"../../../core/Logger.js";import{destroyMaybe as u,removeMaybe as d}from"../../../core/maybe.js";import{debounce as h,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as y,initial as g}from"../../../core/reactiveUtils.js";import{pt2px as f}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import b from"../../../layers/effects/FeatureEffectView.js";import v from"../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as w}from"../../../layers/support/layerUtils.js";import R from"../../../rest/support/AggregateFeatureSet.js";import x from"../../../rest/support/FeatureSet.js";import S from"../../../rest/support/Query.js";import{maxFilters as F}from"../engine/webgl/definitions.js";import{LayerView2DMixin as U}from"./LayerView2D.js";import{createSchema as C}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as I}from"./features/tileRenderers.js";import{isRendererSupported as q}from"./features/support/rendererUtils.js";import{findSizeVV as V,createClusterCountSizeVariable as E,injectDynamicLevelDependentSizeVisualVariable as O,isClusterCompatibleRenderer as T,createClusterRenderer as j}from"./support/clusterUtils.js";import A from"./support/FeatureCommandQueue.js";import L from"./support/FeatureLayerProxy.js";import{getSizeForValueSimple as P}from"./support/visualVariableSimpleUtils.js";import{TileManager as Q}from"../tiling/TileManager.js";import N from"../../layers/FeatureLayerView.js";import k from"../../layers/LayerView.js";import H from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as z}from"../../webgl/capabilities.js";import J from"../../../geometry/Extent.js";function D(e){return e&&"openPorts"in e}function M(e){for(const t of e){const e="featureReduction"in t&&t.featureReduction&&"labelingInfo"in t.featureReduction?t.featureReduction:void 0,r=[...t.labelingInfo||[],...e?.labelingInfo||[]];if(!t.labelsVisible||!r.length)continue;if(r.some((e=>"none"===e.deconflictionStrategy)))return!0}return!1}function G(e){return t=>f(P(t,e))}function B(e){const t=null!=e&&"visualVariables"in e&&e.visualVariables;if(!t)return null;for(const r of t)if("size"===r.type)return G(r);return null}const $="esri.views.2d.layers.FeatureLayerView2D";function K(e){switch(e.geometryType){case"point":return"esriGeometryPoint";case"polyline":return"esriGeometryPolyline";case"polygon":case"multipatch":return"esriGeometryPolygon";case"multipoint":return"esriGeometryMultipoint";default:return l.getLogger($).error(new a("unsupported-geometry-type",`Geometry type of ${e.geometryType} is not supported`)),null}}let Z=class extends(N(H(U(k)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new A({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=h((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new b,this._lastDefinitionExpression=null}destroy(){this._updateClusterSizeTask?.remove(),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.addHandles([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),c((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),y)],"constructor"),this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new a("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});if(("feature"===e.type||"subtype-group"===e.type)&&!w(e)?.operations.supportsQuery)throw new a("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const t=this._createClientOptions();return this._set("_proxy",new L({client:t})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get _effectiveFeatureReduction(){if(!("featureReduction"in this.layer))return null;const e=this.layer.featureReduction;return e&&(!("maxScale"in e)||!e.maxScale||e.maxScale<this.view.scale)?e:null}get orderByFields(){return"stream"!==this._serviceOptions?.type?this._serviceOptions?.orderByFields:void 0}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get labelingCollisionInfos(){const{tileRenderer:e,layer:t}=this;if(null==e)return null;const r="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer],i=t.geometryType,s=!M(r),a={};if("subtype-group"!==t.type){if("heatmap"===e?.type)return null;const r=B(t.renderer);a[0]=r}return[{tileRenderer:e,vvEvaluators:a,deconflictionEnabled:s,geometryType:i,visible:!this.suspended}]}get queryMode(){return this._serviceOptions?.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,r=this.view.floors,{definitionExpression:i}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="gdbVersion"in t?t.gdbVersion:void 0,o="historicMoment"in t?t.historicMoment?.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,h="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,p=JSON.stringify(this.clips),c=this._effectiveFeatureReduction?.toJSON(),y="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),f="subtypeCode"in this.layer&&this.layer.subtypeCode;return JSON.stringify({orderBy:y,sublayerHash:g,subtypeCode:f,filterHash:null!=this.filter&&this.filter.toJSON(),effectHash:null!=this.featureEffect&&this.featureEffect.toJSON(),streamFilter:h,gdbVersion:n,definitionExpression:i,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:r,clipsHash:p,featureReduction:c,customParameters:u,apiKey:d,timeZone:this.view.timeZone})}highlight(e){let t;e instanceof r?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:s.isCollection(e)&&e.length>0?t=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const a=t?.filter(i);return a?.length?(this._addHighlight(a),n((()=>this._removeHighlight(a)))):n()}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,i){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(i);if(0===s.length)return null;has("featurelayer-force-marker-text-draw-order")&&s.sort(((e,t)=>e-t));const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),i,r)}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e),i,r)}async queryUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),i,r)}async queryAggregateUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e),i,r)}async queryClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),i,r)}async queryAggregateClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e),i,r)}async queryHistogram(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),i,r)}async queryAggregateHistogram(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e),i,r)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryAggregates(e,t){const r=await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t),i=R.fromJSON(r);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e),t)}queryAggregateCount(e,t){return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e),t)}queryAggregateJSON(e,t){return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t)}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:J.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:r,removed:i}=this._tileStrategy.update(e);(r.length||i.length)&&this._proxy.updateTiles({added:r,removed:i}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new Q({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.addAttachHandles(c((()=>this.renderingConfigHash),(()=>this._update()),g)),"stream"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.tileRenderer?.uninstall(this.container),this.tileRenderer=null,this._tileStrategy=u(this._tileStrategy),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,r=null!=this._updatingRequiredFieldsPromise,i=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,a=null==this.tileRenderer||this.tileRenderer?.updating,n=e&&(t||r||i||s||this.dataUpdating||a);return has("esri-2d-log-updating")&&console.log(`Updating FLV2D (${this.layer.id}): ${n}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${r}\n -> updatingProxy ${i}\n -> updatingPipeline ${s}\n -> updatingData: ${this.dataUpdating}\n -> updatingTileRenderer ${a}\n`),n}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},setDataUpdating:e=>{this._set("dataUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,{layer:r}=this,i="editingInfo"in r&&r.editingInfo?.lastEditDate,s="refreshInterval"in r&&!!r.refreshInterval,a=!i&&s,n=w(r);if(t&&("feature"===r.type||"subtype-group"===r.type)&&"point"===r.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!a&&has("featurelayer-snapshot-enabled"))try{const e=await r.queryFeatureCount();if(e<=has("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=has("featurelayer-snapshot-point-max-threshold"),i=has("featurelayer-snapshot-point-coverage"),s=this.view.extent,a=r.fullExtent,n=a?.clone().intersection(s),o=null!=n?n.width*n.height:0,l=a?.width*a?.height;if(e<=t&&(0===l?0:o/l)>=i)return{mode:"snapshot",featureCount:e}}catch(o){l.getLogger(this).warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:o})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const t=w(e),{capabilities:r,objectIdField:i}=e,s=e.fieldsIndex.toJSON(),a=s.fields,n=null!=e.fullExtent?e.fullExtent.toJSON():null,l=K(e),u="timeInfo"in e&&e.timeInfo?.toJSON()||null,d=e.spatialReference?e.spatialReference.toJSON():null,h="feature"===e.type?e.globalIdField:null;let p;"ogc-feature"===e.type?p=e.source.getSource():D(e.source)?p=await e.source.openPorts():e.parsedUrl&&(p=o(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(p.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=("subtypeField"in this.layer?this.layer.subtypeField:null)??null,{mode:g,featureCount:f}=await this._detectQueryMode(p);let m=this.layer.objectIdField;if("feature"===this.layer.type&&null!=this.layer.orderBy&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(m=e)}return{type:g,typeIdField:"typeIdField"in e&&e.typeIdField||void 0,types:"types"in e&&e.types?.map((e=>e.toJSON()))||void 0,timeReferenceUnknownClient:c,subtypeField:y,featureCount:f,globalIdField:h,maxRecordCount:r.query.maxRecordCount,tileMaxRecordCount:r.query.tileMaxRecordCount,capabilities:r,effectiveCapabilities:t,fields:a,fieldsIndex:s,fullExtent:n,geometryType:l,objectIdField:i,source:p,timeInfo:u,spatialReference:d,orderByFields:m}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=S.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_cleanUpAggregateQuery(e){const t=S.from(e)||this.createAggregateQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this.attached&&this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);return r&&!i?(l.getLogger(this).error(new a("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:r}=this;if(await this._updateRequiredFields(),this.destroyed)return;const{renderer:i}=this._getEffectiveRenderer();this._set("_effectiveRenderer",i);const s=this._createSchemaConfig(),a=this._createConfiguration(s,r,t.filter),n=this._lastDefinitionExpression!==a.schema.source.definitionExpression;this._lastDefinitionExpression=a.schema.source.definitionExpression;const o=a.schema.tileRenderer,u=this._createTileRendererHash(o);if("snapshot"===this._serviceOptions.type&&(a.schema.source.initialFeatureCount=this._serviceOptions.featureCount),u!==this._tileRendererHash){this._initTileRenderer(o,i);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(i),"stream"!==e.type&&D(e.source)&&(t.source=await e.source.openPorts());const r={added:this._tileStrategy.tileKeys(),removed:[]};has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Proxy startup"),await this._proxy.startup(this.view.featuresTilingScheme,a,t,r),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy startup"),this.hasHighlight()&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating highlight"),await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished highlight update")),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate start"),this.tileRenderer.onConfigUpdate(i),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate end")}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.changedFeatureCount=await this.layer.queryFeatureCount()),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating proxy");const t=await this._proxy.update(a);has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy update"),(t.mesh||t.targets?.aggregate)&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Locking GPU Uploads"),this._lockGPUUploads());try{has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Applying update to proxy"),await this._proxy.applyUpdate(t),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished applying update to proxy")}catch(e){p(e)||l.getLogger(this).error(e)}(t.mesh||t.targets?.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(i),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=u,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){p(t),0}}async _doRefresh(e){this._lockGPUUploads();try{let t;e&&"snapshot"===this.queryMode&&"queryFeatureCount"in this.layer&&(t=await this.layer.queryFeatureCount()),await this._proxy.refresh({dataChanged:e,featureCount:t})}catch(t){p(t),0}this._unlockGPUUploads(),this._effectiveFeatureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return c((()=>this._aggregateValueRanges),(r=>{this._updateClusterEffectiveRendererSizeVariable(e,t,r),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,r){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const i=V(e.visualVariables);if(null!=i&&"cluster_count"===i.field){const s=e.visualVariables.indexOf(i);e.visualVariables[s]=E(t,r);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e=this.layer,t="renderer"in e?e.renderer:null,r=this._effectiveFeatureReduction;if(this._updateClusterSizeTask=d(this._updateClusterSizeTask),r&&"renderer"in r&&r.renderer&&!r.renderer.authoringInfo?.isAutoGenerated){const e=r.fields;if("cluster"===r.type){const{renderer:t,didInject:i}=O(r.renderer,r,this._aggregateValueRanges);return i&&(this._updateClusterSizeTask=this._createUpdateClusterSizeTask(t,r)),{renderer:t,aggregateFields:e,featureReduction:r}}return{renderer:r.renderer,aggregateFields:e,featureReduction:r}}if(r&&"cluster"===r.type&&t&&T(t)){const e=r,i=[],s=j(i,t,e,this._aggregateValueRanges,!0);return this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,e),{renderer:s,aggregateFields:i,featureReduction:r}}return{renderer:t,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}_initTileRenderer(e,t){const r=I(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer=u(this.tileRenderer)),this.destroyed?null:(this._proxy.tileRenderer=r,this._set("tileRenderer",r),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=null!=e?e.timeExtent:null,r=null!=this.timeExtent&&null!=t?this.timeExtent.intersection(t):this.timeExtent||t;let i=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=null!=e?e.where:null;i=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!r&&!s)return null!=e?e.toJSON():null;(e=null!=e&&e.clone()||new v).timeExtent=r,i&&(e.where=i);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let r=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e?.length)return r;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const i=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));i.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",i.join(", ")),null!=r&&r.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");r=r.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),r=r.replace(e,""),r=r.replaceAll(/\s+/g," ").trim()}r=""!==r?"("+r+") AND "+a:a}return""!==r?r:null}_createConfiguration(e,t,r){const i="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion??void 0:void 0,a=new Array(F),n=this._injectOverrides(t);a[0]=n,a[1]=null!=r?r.toJSON():null;const o=C(e);if(null==o)return null;const l=z("2d");return{availableFields:this.availableFields,gdbVersion:s,historicMoment:i,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize,timeZone:this.view.timeZone}}_hasRequiredSupport(e){return!("renderer"in e)||q(e.renderer)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e=this.layer;return{renderer:"renderer"in e?e.renderer:null,spatialReference:e.spatialReference,timeExtent:"timeExtent"in e?e.timeExtent:null,definitionExpression:e.definitionExpression,featureReduction:this._effectiveFeatureReduction,fields:e.fields,geometryType:e.geometryType,historicMoment:"historicMoment"in e?e.historicMoment:null,labelsVisible:"labelsVisible"in e&&e.labelsVisible,labelingInfo:"labelingInfo"in e?e.labelingInfo:null,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:"gdbVersion"in e?e.gdbVersion:null,pixelBuffer:0,orderBy:"orderBy"in e&&e.orderBy?e.orderBy:null,customParameters:{..."customParameters"in e?e.customParameters:void 0,token:"apiKey"in e?e.apiKey??void 0:void 0},subtypeCode:"subtypeCode"in e?e.subtypeCode:void 0,subtypeField:"subtypeField"in e?e.subtypeField:void 0}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{p(e)||l.getLogger(this).error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{p(e)||l.getLogger(this).error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([m()],Z.prototype,"_serviceOptions",void 0),e([m()],Z.prototype,"_proxy",void 0),e([m()],Z.prototype,"_pipelineIsUpdating",void 0),e([m()],Z.prototype,"_effectiveRenderer",void 0),e([m()],Z.prototype,"_effectiveFeatureReduction",null),e([m()],Z.prototype,"_aggregateValueRanges",void 0),e([m()],Z.prototype,"_commandsQueue",void 0),e([m()],Z.prototype,"featureEffectView",void 0),e([m()],Z.prototype,"labelsVisible",null),e([m()],Z.prototype,"labelingCollisionInfos",null),e([m({readOnly:!0})],Z.prototype,"queryMode",null),e([m()],Z.prototype,"renderingConfigHash",null),e([m()],Z.prototype,"tileRenderer",void 0),e([m()],Z.prototype,"updating",void 0),Z=e([_($)],Z);const W=Z;export{W 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 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};