@arcgis/core 5.2.0-next.98 → 5.2.0-next.99

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 (40) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{dd55737fba0a8fe68101.js → d7659d2b2aea0dd1202d.js} +3 -3
  3. package/chunks/GlobalIllumination.glsl.js +3 -3
  4. package/config.js +1 -1
  5. package/kernel.js +1 -1
  6. package/package.json +2 -2
  7. package/rest/featureService/types.d.ts +3 -1
  8. package/rest/featureService/utils.d.ts +3 -1
  9. package/rest/featureService/utils.js +1 -1
  10. package/support/revision.js +1 -1
  11. package/versionManagement/VersionManagementService.js +1 -1
  12. package/versionManagement/VersionManager.js +1 -1
  13. package/versionManagement/versionAdapters/AnnotationFeatureLayerVersionAdapter.js +2 -0
  14. package/versionManagement/versionAdapters/DimensionFeatureLayerVersionAdapter.js +2 -0
  15. package/versionManagement/versionAdapters/types.d.ts +4 -2
  16. package/versionManagement/versionAdapters/utils.d.ts +4 -2
  17. package/versionManagement/versionAdapters/utils.js +1 -1
  18. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  19. package/views/2d/engine/webgl/Overlay.js +1 -1
  20. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  21. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  22. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  23. package/views/View.js +1 -1
  24. package/views/support/drapedUtils.js +1 -1
  25. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +12 -3
  26. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  27. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  28. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  29. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  30. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  31. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  32. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  33. package/widgets/Editor/legacy/MergeFeaturesWorkflow.js +1 -1
  34. package/widgets/Editor/legacy/SplitFeatureWorkflow.js +1 -1
  35. package/widgets/Editor/legacy/UpdateFeaturesWorkflow.js +1 -1
  36. package/widgets/Editor/legacy/UpdateRecordWorkflow.js +1 -1
  37. package/widgets/FeatureForm/FeatureFormViewModel.d.ts +15 -3
  38. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  39. package/widgets/Sketch/SelectionToolVisibilityMap.d.ts +2 -2
  40. package/widgets/Sketch/SelectionToolVisibilityMap.js +1 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import o from"../core/Collection.js";import t from"../core/Error.js";import i from"../core/Logger.js";import{watch as s,on as n}from"../core/reactiveUtils.js";import{removeTrailingSlash as a}from"../core/urlUtils.js";import{property as u,subclass as l}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../core/support/UpdatingHandles.js";import{getOwningPortalUrl as h}from"../layers/support/layerUtils.js";import p from"../portal/Portal.js";import{hasPrivilege as v}from"../portal/support/utils.js";import m from"../rest/featureService/FeatureService.js";import{createFeatureServices as c}from"../rest/featureService/utils.js";import{getVersioningStates as g}from"./utils.js";import w from"./VersioningState.js";import f from"./VersionManagementService.js";import{createVersionAdapters as _}from"./versionAdapters/utils.js";let E=class extends r{constructor(e){super(e),this._portalLookup=new Map,this._updatingHandlesLoad=new d,this._updatingHandlesExecute=new d,this.executionError=void 0,this.featureServiceLookup=new Map,this.loadError=void 0,this.serverVersionLookup=new Map,this.serviceNameLookup=new Map,this.userLookup=new Map,this.versionAdministratorLookup=new Map,this.versioningStateLookup=new Map,this.view=null,this.versioningStates=null}initialize(){this._viewChangeHandle(),this.addHandles([s(()=>this.view,()=>{this._resetAllLookupProperties(),this._viewChangeHandle()}),s(()=>this.versioningStates,()=>{this._resetVersioningLookupProperties(),this._setVersioningStatesLookups()})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":this.executionError?"failed":"ready"}async alterVersion(e){return this._updatingHandlesExecute.addPromise(this._alterVersionInternal(e))}async changeVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._changeVersionInternal(e,r,o))}async createVersion(e){return this._updatingHandlesExecute.addPromise(this._createVersionInternal(e))}async deleteVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._deleteVersionInternal(e,r,o))}async getVersionInfos(e){return this._updatingHandlesExecute.addPromise(this._getVersionInfosInternal(e))}async _alterVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.versioningStateLookup.get(e.featureServerUrl);if(!r)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");if(!this.serverVersionLookup.has(e.featureServerUrl)||this.serverVersionLookup.get(e.featureServerUrl)<=11.1)throw this._logError("version-management-view-model:execution-error","no-valid-enterprise-version"),new t("version-management-view-model:execution-error",this.executionError??"");const{featureServerUrl:o,versionIdentifier:i,...s}=e,n=await r.alterVersion(i,s).catch(e=>{throw this._logExecutionError(e),e});return await this.getVersionInfos(o),n}async _changeVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await i.changeVersion(s).catch(e=>{throw this._logExecutionError(e),e})}_updateVersionableItems(e){this._updatingHandlesLoad.consumePromise((async()=>{_(e.added).forEach(e=>{const r=e.featureServiceUrl,o=this.versioningStateLookup.get(r);o&&(o.versionableItems.find(r=>r.versionableItem===e.versionableItem)||o.versionableItems.add(e))});_(e.removed).forEach(e=>{const{allLayers:r,allTables:o}=this.view.map,t=e.featureServiceUrl,i=this.versioningStateLookup.get(t);if(!i)return void this._logError("version-management-view-model:execution-error","no-version-management-service-found");const s=e=>("feature"===e.type||"subtype-group"===e.type)&&(e.url?.includes(t)??!1);[...r.filter(s),...o.filter(s)].length||(this.featureServiceLookup.delete(t),this.serviceNameLookup.delete(t),this.versioningStateLookup.delete(t),this.versioningStates.remove(i));const n=i.versionableItems.find(r=>r.versionableItem===e.versionableItem);n&&i.versionableItems.remove(n)})})())}async _createVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=e.featureServerUrl,o=this.versioningStateLookup.get(r);if(!o)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");const i=this.userLookup.get(r).toUpperCase(),s=this._isEmptyString(e.ownerName)?i:e.ownerName?.trim().toUpperCase();if(s!==i&&this.serverVersionLookup.get(r)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new t("version-management-view-model:execution-error",this.executionError??"");let n=await(this.versioningStateLookup.get(r)?.getVersionInfos());if("SDE"===s?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase()||n?.find(r=>r.versionIdentifier.name.toUpperCase()===(s+"."+e.versionName).toUpperCase()||r.versionIdentifier.name.toUpperCase()===(i+"."+e.versionName).toUpperCase()))throw this._logError("version-management-view-model:execution-error","no-valid-version-name"),new t("version-management-view-model:execution-error",this.executionError??"");const a=await o.versionManagementService.createVersion({versionName:e.versionName,access:s!==i?"public":e.access,description:e.description}).catch(e=>{throw this._logExecutionError(e),e});if(s!==i){const{guid:o,name:t}=a.versionIdentifier,n={featureServerUrl:r,versionIdentifier:{guid:o,name:t},access:e.access,ownerName:s};await this.alterVersion(n)||this.deleteVersion(r,i+"."+e.versionName,a.versionIdentifier.guid).catch(()=>{})}return await this.getVersionInfos(r),n=await(this.versioningStateLookup.get(r)?.getVersionInfos()),n?.find(e=>e.versionIdentifier.guid===a.versionIdentifier.guid)}async _deleteVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");if(this.serverVersionLookup.get(e)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new t("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await i.deleteVersion(s).catch(e=>{throw this._logExecutionError(e),new t("version-management-view-model:execution-error",this.executionError??"")})}async _getVersionInfosInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.featureServiceLookup.get(e)?.featureService;if(!r)throw this._logError("version-management-view-model:execution-error","no-feature-service-found"),new t("version-management-view-model:execution-error",this.executionError??"");r.loaded||await r.load().catch(e=>{throw this._logExecutionError(e),e});const o=r.url;this.serverVersionLookup.set(o,r.sourceJSON?.currentVersion??0);const i=this.userLookup.get(e);this._portalLookup.get(e)&&i?this.versionAdministratorLookup.set(o,await v(this._portalLookup.get(e),i,"features:user:manageVersions")):this.versionAdministratorLookup.set(o,!1);const s=this.versioningStateLookup.get(e);if(!s)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");s.loaded||await s.load().catch(e=>{throw this._logExecutionError(e),e});return await s.getVersionInfos(!0).catch(e=>{throw this._logExecutionError(e),e})}_isEmptyString(e){return!e||0===e.trim().length}_logError(e,r){switch(i.getLogger(this).error(new t(e,r??"")),e){case"version-management-view-model:load-error":this._setLoadError(r);break;case"version-management-view-model:execution-error":this._setExecutionError(r)}}_logExecutionError(e){this._logError("version-management-view-model:execution-error",e.message)}async _viewChangeHandle(){this._updatingHandlesLoad.consumePromise((async()=>{if(this._setLoadError(),!this.view)return void this._setLoadError("no-view-property");if(this.view&&"2d"!==this.view.type)return void this._logError("version-management-view-model:load-error","sceneView-not-supported");this.removeHandles("map-change-handle"),this.addHandles([s(()=>this.view?.map,()=>{this._resetAllLookupProperties(),this._mapChangeHandle(this.versioningStates)})],"map-change-handle");const e=await this._getVersioningStates();await this._mapChangeHandle(e)})())}async _mapChangeHandle(e){this._updatingHandlesLoad.consumePromise((async()=>{this._setLoadError(),this.removeHandles("map-layers-tables-change-handle"),this.addHandles([n(()=>this.view?.map.allLayers,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))}),n(()=>this.view?.map.allTables,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))})],"map-layers-tables-change-handle"),await this._propertiesChangeInternal(e)})())}async _propertiesChangeInternal(e){this._updatingHandlesLoad.consumePromise((async()=>{const r=e=>"feature"===e.type||"subtype-group"===e.type,{allLayers:o,allTables:t}=this.view.map;if(this._setLoadError(),this.featureServiceLookup=c([...o.filter(r),...t.filter(r)]),this.featureServiceLookup.size){this._updateFeatureServiceLookup(e),this.serviceNameLookup=new Map;for(const e of this.featureServiceLookup.values()){const{featureService:r,featureService:{url:o}}=e;if(!this.serviceNameLookup.has(o)){if(r.loaded||await r.load().catch(e=>{i.getLogger(this).error(e)}),!r.versionManagementServiceUrl){this.featureServiceLookup.delete(o);continue}const e=await h(o),t=new p({authMode:"immediate",url:e});await t.load().catch(e=>{i.getLogger(this).error(e)});const s=t.user?.username;if(!r.loaded||!t.loaded||!s)continue;this.serviceNameLookup.set(a(o),o.split("/").at(-2)),this.userLookup.set(o,s),this._portalLookup.set(o,t)}}e.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(e),this.versioningStates=e}else this._logError("version-management-view-model:load-error","no-feature-services")})())}_updateFeatureServiceLookup(e){for(const r of e){const e=r.featureServiceUrl;if(!this.featureServiceLookup.has(e)){const o=new m({url:e}),t=r.versionableItems.toArray().flatMap(e=>"network"===e.type?null:e.versionableItem).filter(e=>!!e);this.featureServiceLookup.set(e,{featureService:o,layers:t})}}}async _updateVersioningStates(e){for(const r of this.featureServiceLookup.values()){const t=r.featureService;if(!t.versionManagementServiceUrl)continue;if(!e.find(e=>e.featureServiceUrl===t.url)&&t.versionManagementServiceUrl){const i=new o(_(r.layers)),s=new w({versionManagementService:new f({url:t.versionManagementServiceUrl}),versionableItems:i});e.add(s),this._handleVersioningStateLookupUpdate(s)}await this.getVersionInfos(t.url)}}async _getVersioningStates(){return this.versioningStates&&this.versioningStates.length?this.versioningStates:this.view?await g(this.view,!1):(this._logError("version-management-view-model:load-error","no-view-property"),new o)}_handleVersioningStateLookupUpdate(e){this.versioningStateLookup.set(e.featureServiceUrl,e)}async _setVersioningStatesLookups(){this._updatingHandlesLoad.consumePromise((async()=>{this.versioningStates&&(this._updateFeatureServiceLookup(this.versioningStates),this.versioningStates.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(this.versioningStates))})())}_resetVersioningLookupProperties(){this.versioningStateLookup=new Map}_resetAllLookupProperties(){this._portalLookup=new Map,this.serverVersionLookup=new Map,this.userLookup=new Map,this.versioningStates=new o,this._resetVersioningLookupProperties(),this._resetServiceRelatedLookupProperties()}_resetServiceRelatedLookupProperties(){this.featureServiceLookup=new Map,this.serviceNameLookup=new Map}_setExecutionError(e){this._set("executionError",e)}_setLoadError(e){this._set("loadError",e)}};e([u()],E.prototype,"_portalLookup",void 0),e([u({readOnly:!0})],E.prototype,"executionError",void 0),e([u()],E.prototype,"featureServiceLookup",void 0),e([u({readOnly:!0})],E.prototype,"loadError",void 0),e([u()],E.prototype,"serverVersionLookup",void 0),e([u()],E.prototype,"serviceNameLookup",void 0),e([u({readOnly:!0})],E.prototype,"state",null),e([u()],E.prototype,"userLookup",void 0),e([u()],E.prototype,"versionAdministratorLookup",void 0),e([u()],E.prototype,"versioningStateLookup",void 0),e([u()],E.prototype,"view",void 0),e([u()],E.prototype,"versioningStates",void 0),E=e([l("esri.versionManagement.VersionManager")],E);const L=E;export{L as default};
2
+ import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import t from"../core/Collection.js";import o from"../core/Error.js";import i from"../core/Logger.js";import{watch as s,on as n}from"../core/reactiveUtils.js";import{removeTrailingSlash as a}from"../core/urlUtils.js";import{property as d,subclass as u}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../core/support/UpdatingHandles.js";import{getOwningPortalUrl as p}from"../layers/support/layerUtils.js";import h from"../portal/Portal.js";import{hasPrivilege as m}from"../portal/support/utils.js";import v from"../rest/featureService/FeatureService.js";import{createFeatureServices as c}from"../rest/featureService/utils.js";import{getVersioningStates as g}from"./utils.js";import w from"./VersioningState.js";import f from"./VersionManagementService.js";import{createVersionAdapters as _}from"./versionAdapters/utils.js";let E=class extends r{constructor(e){super(e),this._portalLookup=new Map,this._updatingHandlesLoad=new l,this._updatingHandlesExecute=new l,this.executionError=void 0,this.featureServiceLookup=new Map,this.loadError=void 0,this.serverVersionLookup=new Map,this.serviceNameLookup=new Map,this.userLookup=new Map,this.versionAdministratorLookup=new Map,this.versioningStateLookup=new Map,this.view=null,this.versioningStates=null}initialize(){this._viewChangeHandle(),this.addHandles([s(()=>this.view,()=>{this._resetAllLookupProperties(),this._viewChangeHandle()}),s(()=>this.versioningStates,()=>{this._resetVersioningLookupProperties(),this._setVersioningStatesLookups()})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":this.executionError?"failed":"ready"}async alterVersion(e){return this._updatingHandlesExecute.addPromise(this._alterVersionInternal(e))}async changeVersion(e,r,t){return this._updatingHandlesExecute.addPromise(this._changeVersionInternal(e,r,t))}async createVersion(e){return this._updatingHandlesExecute.addPromise(this._createVersionInternal(e))}async deleteVersion(e,r,t){return this._updatingHandlesExecute.addPromise(this._deleteVersionInternal(e,r,t))}async getVersionInfos(e){return this._updatingHandlesExecute.addPromise(this._getVersionInfosInternal(e))}async _alterVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.versioningStateLookup.get(e.featureServerUrl);if(!r)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");if(!this.serverVersionLookup.has(e.featureServerUrl)||this.serverVersionLookup.get(e.featureServerUrl)<=11.1)throw this._logError("version-management-view-model:execution-error","no-valid-enterprise-version"),new o("version-management-view-model:execution-error",this.executionError??"");const{featureServerUrl:t,versionIdentifier:i,...s}=e,n=await r.alterVersion(i,s).catch(e=>{throw this._logExecutionError(e),e});return await this.getVersionInfos(t),n}async _changeVersionInternal(e,r,t){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:t};return await i.changeVersion(s).catch(e=>{throw this._logExecutionError(e),e})}_updateVersionableItems(e){this._updatingHandlesLoad.consumePromise((async()=>{_(e.added).forEach(e=>{const r=e.featureServiceUrl,t=this.versioningStateLookup.get(r);t&&(t.versionableItems.find(r=>r.versionableItem===e.versionableItem)||t.versionableItems.add(e))});_(e.removed).forEach(e=>{const{allLayers:r,allTables:t}=this.view.map,o=e.featureServiceUrl,i=this.versioningStateLookup.get(o);if(!i)return void this._logError("version-management-view-model:execution-error","no-version-management-service-found");const s=e=>("feature"===e.type||"subtype-group"===e.type||"annotation-feature"===e.type||"dimension-feature"===e.type)&&(e.url?.includes(o)??!1);[...r.filter(s),...t.filter(s)].length||(this.featureServiceLookup.delete(o),this.serviceNameLookup.delete(o),this.versioningStateLookup.delete(o),this.versioningStates.remove(i));const n=i.versionableItems.find(r=>r.versionableItem===e.versionableItem);n&&i.versionableItems.remove(n)})})())}async _createVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=e.featureServerUrl,t=this.versioningStateLookup.get(r);if(!t)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");const i=this.userLookup.get(r).toUpperCase(),s=this._isEmptyString(e.ownerName)?i:e.ownerName?.trim().toUpperCase();if(s!==i&&this.serverVersionLookup.get(r)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new o("version-management-view-model:execution-error",this.executionError??"");let n=await(this.versioningStateLookup.get(r)?.getVersionInfos());if("SDE"===s?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase()||n?.find(r=>r.versionIdentifier.name.toUpperCase()===(s+"."+e.versionName).toUpperCase()||r.versionIdentifier.name.toUpperCase()===(i+"."+e.versionName).toUpperCase()))throw this._logError("version-management-view-model:execution-error","no-valid-version-name"),new o("version-management-view-model:execution-error",this.executionError??"");const a=await t.versionManagementService.createVersion({versionName:e.versionName,access:s!==i?"public":e.access,description:e.description}).catch(e=>{throw this._logExecutionError(e),e});if(s!==i){const{guid:t,name:o}=a.versionIdentifier,n={featureServerUrl:r,versionIdentifier:{guid:t,name:o},access:e.access,ownerName:s};await this.alterVersion(n)||this.deleteVersion(r,i+"."+e.versionName,a.versionIdentifier.guid).catch(()=>{})}return await this.getVersionInfos(r),n=await(this.versioningStateLookup.get(r)?.getVersionInfos()),n?.find(e=>e.versionIdentifier.guid===a.versionIdentifier.guid)}async _deleteVersionInternal(e,r,t){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");if(this.serverVersionLookup.get(e)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new o("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:t};return await i.deleteVersion(s).catch(e=>{throw this._logExecutionError(e),new o("version-management-view-model:execution-error",this.executionError??"")})}async _getVersionInfosInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.featureServiceLookup.get(e)?.featureService;if(!r)throw this._logError("version-management-view-model:execution-error","no-feature-service-found"),new o("version-management-view-model:execution-error",this.executionError??"");r.loaded||await r.load().catch(e=>{throw this._logExecutionError(e),e});const t=r.url;this.serverVersionLookup.set(t,r.sourceJSON?.currentVersion??0);const i=this.userLookup.get(e);this._portalLookup.get(e)&&i?this.versionAdministratorLookup.set(t,await m(this._portalLookup.get(e),i,"features:user:manageVersions")):this.versionAdministratorLookup.set(t,!1);const s=this.versioningStateLookup.get(e);if(!s)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");s.loaded||await s.load().catch(e=>{throw this._logExecutionError(e),e});return await s.getVersionInfos(!0).catch(e=>{throw this._logExecutionError(e),e})}_isEmptyString(e){return!e||0===e.trim().length}_logError(e,r){switch(i.getLogger(this).error(new o(e,r??"")),e){case"version-management-view-model:load-error":this._setLoadError(r);break;case"version-management-view-model:execution-error":this._setExecutionError(r)}}_logExecutionError(e){this._logError("version-management-view-model:execution-error",e.message)}async _viewChangeHandle(){this._updatingHandlesLoad.consumePromise((async()=>{if(this._setLoadError(),!this.view)return void this._setLoadError("no-view-property");if(this.view&&"2d"!==this.view.type)return void this._logError("version-management-view-model:load-error","sceneView-not-supported");this.removeHandles("map-change-handle"),this.addHandles([s(()=>this.view?.map,()=>{this._resetAllLookupProperties(),this._mapChangeHandle(this.versioningStates)})],"map-change-handle");const e=await this._getVersioningStates();await this._mapChangeHandle(e)})())}async _mapChangeHandle(e){this._updatingHandlesLoad.consumePromise((async()=>{this._setLoadError(),this.removeHandles("map-layers-tables-change-handle"),this.addHandles([n(()=>this.view?.map.allLayers,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e)||e.added.some(({type:e})=>"annotation-feature"===e)||e.removed.some(({type:e})=>"annotation-feature"===e)||e.added.some(({type:e})=>"dimension-feature"===e)||e.removed.some(({type:e})=>"dimension-feature"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))}),n(()=>this.view?.map.allTables,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e)||e.added.some(({type:e})=>"annotation-feature"===e)||e.removed.some(({type:e})=>"annotation-feature"===e)||e.added.some(({type:e})=>"dimension-feature"===e)||e.removed.some(({type:e})=>"dimension-feature"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))})],"map-layers-tables-change-handle"),await this._propertiesChangeInternal(e)})())}async _propertiesChangeInternal(e){this._updatingHandlesLoad.consumePromise((async()=>{const r=e=>"feature"===e.type||"subtype-group"===e.type||"annotation-feature"===e.type||"dimension-feature"===e.type,{allLayers:t,allTables:o}=this.view.map;if(this._setLoadError(),this.featureServiceLookup=c([...t.filter(r),...o.filter(r)]),this.featureServiceLookup.size){this._updateFeatureServiceLookup(e),this.serviceNameLookup=new Map;for(const e of this.featureServiceLookup.values()){const{featureService:r,featureService:{url:t}}=e;if(!this.serviceNameLookup.has(t)){if(r.loaded||await r.load().catch(e=>{i.getLogger(this).error(e)}),!r.versionManagementServiceUrl){this.featureServiceLookup.delete(t);continue}const e=await p(t),o=new h({authMode:"immediate",url:e});await o.load().catch(e=>{i.getLogger(this).error(e)});const s=o.user?.username;if(!r.loaded||!o.loaded||!s)continue;this.serviceNameLookup.set(a(t),t.split("/").at(-2)),this.userLookup.set(t,s),this._portalLookup.set(t,o)}}e.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(e),this.versioningStates=e}else this._logError("version-management-view-model:load-error","no-feature-services")})())}_updateFeatureServiceLookup(e){for(const r of e){const e=r.featureServiceUrl;if(!this.featureServiceLookup.has(e)){const t=new v({url:e}),o=r.versionableItems.toArray().flatMap(e=>"network"===e.type?null:e.versionableItem).filter(e=>!!e);this.featureServiceLookup.set(e,{featureService:t,layers:o})}}}async _updateVersioningStates(e){for(const r of this.featureServiceLookup.values()){const o=r.featureService;if(!o.versionManagementServiceUrl)continue;if(!e.find(e=>e.featureServiceUrl===o.url)&&o.versionManagementServiceUrl){const i=new t(_(r.layers)),s=new w({versionManagementService:new f({url:o.versionManagementServiceUrl}),versionableItems:i});e.add(s),this._handleVersioningStateLookupUpdate(s)}await this.getVersionInfos(o.url)}}async _getVersioningStates(){return this.versioningStates&&this.versioningStates.length?this.versioningStates:this.view?await g(this.view,!1):(this._logError("version-management-view-model:load-error","no-view-property"),new t)}_handleVersioningStateLookupUpdate(e){this.versioningStateLookup.set(e.featureServiceUrl,e)}async _setVersioningStatesLookups(){this._updatingHandlesLoad.consumePromise((async()=>{this.versioningStates&&(this._updateFeatureServiceLookup(this.versioningStates),this.versioningStates.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(this.versioningStates))})())}_resetVersioningLookupProperties(){this.versioningStateLookup=new Map}_resetAllLookupProperties(){this._portalLookup=new Map,this.serverVersionLookup=new Map,this.userLookup=new Map,this.versioningStates=new t,this._resetVersioningLookupProperties(),this._resetServiceRelatedLookupProperties()}_resetServiceRelatedLookupProperties(){this.featureServiceLookup=new Map,this.serviceNameLookup=new Map}_setExecutionError(e){this._set("executionError",e)}_setLoadError(e){this._set("loadError",e)}};e([d()],E.prototype,"_portalLookup",void 0),e([d({readOnly:!0})],E.prototype,"executionError",void 0),e([d()],E.prototype,"featureServiceLookup",void 0),e([d({readOnly:!0})],E.prototype,"loadError",void 0),e([d()],E.prototype,"serverVersionLookup",void 0),e([d()],E.prototype,"serviceNameLookup",void 0),e([d({readOnly:!0})],E.prototype,"state",null),e([d()],E.prototype,"userLookup",void 0),e([d()],E.prototype,"versionAdministratorLookup",void 0),e([d()],E.prototype,"versioningStateLookup",void 0),e([d()],E.prototype,"view",void 0),e([d()],E.prototype,"versioningStates",void 0),E=e([u("esri.versionManagement.VersionManager")],E);const L=E;export{L as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as t}from"../../core/accessorSupport/decorators.js";class r{constructor(e){this.versionableItem=e,this.type="annotation-feature-layer"}get gdbVersion(){return this.versionableItem.gdbVersion}set gdbVersion(e){this.versionableItem.gdbVersion=e}get historicMoment(){return this.versionableItem.historicMoment}set historicMoment(e){this.versionableItem.historicMoment=e}get featureServiceUrl(){const e=/^(.*\/FeatureServer)\/\d+$/;return this.versionableItem.url.replace(e,"$1")}}e([t({readOnly:!0})],r.prototype,"type",void 0),e([t()],r.prototype,"gdbVersion",null),e([t({type:Date})],r.prototype,"historicMoment",null),e([t({readOnly:!0})],r.prototype,"featureServiceUrl",null);export{r as AnnotationFeatureLayerVersionAdapter};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as t}from"../../core/accessorSupport/decorators.js";class r{constructor(e){this.versionableItem=e,this.type="dimension-feature-layer"}get gdbVersion(){return this.versionableItem.gdbVersion}set gdbVersion(e){this.versionableItem.gdbVersion=e}get historicMoment(){return this.versionableItem.historicMoment}set historicMoment(e){this.versionableItem.historicMoment=e}get featureServiceUrl(){const e=/^(.*\/FeatureServer)\/\d+$/;return this.versionableItem.url.replace(e,"$1")}}e([t({readOnly:!0})],r.prototype,"type",void 0),e([t()],r.prototype,"gdbVersion",null),e([t({type:Date})],r.prototype,"historicMoment",null),e([t({readOnly:!0})],r.prototype,"featureServiceUrl",null);export{r as DimensionFeatureLayerVersionAdapter};
@@ -1,3 +1,5 @@
1
+ import type AnnotationFeatureLayer from "../../layers/AnnotationFeatureLayer.js";
2
+ import type DimensionFeatureLayer from "../../layers/DimensionFeatureLayer.js";
1
3
  import type FeatureLayer from "../../layers/FeatureLayer.js";
2
4
  import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
3
5
  import type Network from "../../networks/Network.js";
@@ -13,13 +15,13 @@ export interface VersionAdapter {
13
15
  *
14
16
  * @since 5.0
15
17
  */
16
- versionableItem: FeatureLayer | Network | SubtypeGroupLayer;
18
+ versionableItem: FeatureLayer | Network | SubtypeGroupLayer | AnnotationFeatureLayer | DimensionFeatureLayer;
17
19
  /**
18
20
  * The type of versionable item.
19
21
  *
20
22
  * @since 5.0
21
23
  */
22
- type: "feature-layer" | "subtype-group-layer" | "network";
24
+ type: "feature-layer" | "subtype-group-layer" | "network" | "annotation-feature-layer" | "dimension-feature-layer";
23
25
  /**
24
26
  * The current gdbVersion of a versionable item.
25
27
  *
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * @since 4.30
5
5
  */
6
+ import type AnnotationFeatureLayer from "../../layers/AnnotationFeatureLayer.js";
7
+ import type DimensionFeatureLayer from "../../layers/DimensionFeatureLayer.js";
6
8
  import type FeatureLayer from "../../layers/FeatureLayer.js";
7
9
  import type GroupLayer from "../../layers/GroupLayer.js";
8
10
  import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
@@ -20,7 +22,7 @@ import type { VersionAdapter } from "./types.js";
20
22
  * });
21
23
  * const adapter = utils.createVersionAdapter(layer);
22
24
  */
23
- export function createVersionAdapter(input: Network | FeatureLayer | SubtypeGroupLayer): VersionAdapter | null | undefined;
25
+ export function createVersionAdapter(input: Network | AnnotationFeatureLayer | DimensionFeatureLayer | FeatureLayer | SubtypeGroupLayer): VersionAdapter | null | undefined;
24
26
 
25
27
  /**
26
28
  * Used to create an array of [VersionAdapters](https://developers.arcgis.com/javascript/latest/references/core/versionManagement/versionAdapters/types/#VersionAdapter).
@@ -36,4 +38,4 @@ export function createVersionAdapter(input: Network | FeatureLayer | SubtypeGrou
36
38
  * });
37
39
  * const adapters = utils.createVersionAdapters([layer1, layer2]);
38
40
  */
39
- export function createVersionAdapters(inputs: (Network | FeatureLayer | SubtypeGroupLayer | GroupLayer)[]): VersionAdapter[];
41
+ export function createVersionAdapters(inputs: (Network | AnnotationFeatureLayer | DimensionFeatureLayer | FeatureLayer | SubtypeGroupLayer | GroupLayer)[]): VersionAdapter[];
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isLayerFromCatalog as e}from"../../layers/catalog/catalogUtils.js";import{FeatureLayerVersionAdapter as r}from"./FeatureLayerVersionAdapter.js";import{NetworkVersionAdapter as t}from"./NetworkVersionAdapter.js";import{SubTypeGroupLayerVersionAdapter as o}from"./SubTypeGroupLayerVersionAdapter.js";function n(n){return"networkServiceUrl"in n?new t(n):"feature"!==n.type||e(n)?"subtype-group"!==n.type||e(n)?null:new o(n):new r(n)}function p(e){const r=[];for(const t of e)if("group"===t.type){const e=t,o=e.allTables.concat(e.allLayers);for(const t of o)if("feature"===t.type||"subtype-group"===t.type){const e=n(t);e&&r.push(e)}}else{const e=n(t);e&&r.push(e)}return r}export{n as createVersionAdapter,p as createVersionAdapters};
2
+ import{isLayerFromCatalog as e}from"../../layers/catalog/catalogUtils.js";import{AnnotationFeatureLayerVersionAdapter as t}from"./AnnotationFeatureLayerVersionAdapter.js";import{DimensionFeatureLayerVersionAdapter as r}from"./DimensionFeatureLayerVersionAdapter.js";import{FeatureLayerVersionAdapter as o}from"./FeatureLayerVersionAdapter.js";import{NetworkVersionAdapter as n}from"./NetworkVersionAdapter.js";import{SubTypeGroupLayerVersionAdapter as a}from"./SubTypeGroupLayerVersionAdapter.js";function p(p){return"networkServiceUrl"in p?new n(p):"feature"!==p.type||e(p)?"annotation-feature"!==p.type||e(p)?"dimension-feature"!==p.type||e(p)?"subtype-group"!==p.type||e(p)?null:new a(p):new r(p):new t(p):new o(p)}function s(e){const t=[];for(const r of e)if("group"===r.type){const e=r,o=e.allTables.concat(e.allLayers);for(const r of o)if("feature"===r.type||"subtype-group"===r.type||"annotation-feature"===r.type||"dimension-feature"===r.type){const e=p(r);e&&t.push(e)}}else{const e=p(r);e&&t.push(e)}return t}export{p as createVersionAdapter,s as createVersionAdapters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{open as t}from"../../../../core/workers.js";import{sdfBufferServer as e}from"./definitions.js";import i from"./Rect.js";import s from"../../../webgl/Texture.js";import{TextureDescriptor as r}from"../../../webgl/TextureDescriptor.js";const h={width:5,height:2,left:0,top:0},o=new i(0,0,11,8),a=new i(11,0,11,8);class n{constructor(t,e,i,s){this._snapCoords=i,this._setTextureBinding=s,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._textures=[],this._worker=this._load(),this.width=t,this.height=e,this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0}async openMessagePorts(){return(await this._worker).connection.openPorts()}async rasterizeText(t,e,i){return(await this._worker).worker.rasterizeText(t,e,i)}getTexture(t,e){if(!this._textures[e]){const i=new r(this.width,this.height);i.pixelFormat=6406,i.wrapMode=33071,this._textures[e]=new s(t,i,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}bind(t,e,i,s){const r=this.getTexture(t,i);r.setSamplingMode(e),t.bindTexture(r,s)}async _load(){const i={getOptions:()=>({width:this.width,height:this.height,snapCoords:!!this._snapCoords}),recordGlyphs:t=>{const i=e;for(const e of t)e.sdf&&this.recordGlyph(e.mosaicItem,e.rect,e.sdf.buffer,i),this._setTextureBinding&&0!==e.mosaicItem.textureBinding&&this._setTextureBinding(e.mosaicItem)}},s=await t("GlyphWorker",{client:i,strategy:"dedicated"});return{worker:s.createInvokeProxy(),connection:s}}_invalidate(){this._dirties[this._currentPage]=!0}recordGlyph(t,e,i,s){const{page:r,rect:h}=t;if(0===e.width)return;const o=e.width+2*s,a=e.height+2*s;this._pageData[r]||this._allocNewPage(r);const n=this._pageData[r];for(let c=0;c<a;c++){const t=o*c,e=this.width*(h.y+c)+h.x;for(let s=0;s<o;s++)n[e+s]=i[t+s]}has("esri-glyph-debug")&&this._showDebugPage(n),this._invalidate()}_allocNewPage(t){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=t,this._pageData[t]=new Uint8Array(this.width*this.height),this._dirties[t]=!0,this._textures[t]=null,this._initDecorationGlyphs()}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],i=[],s=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=0;t<11;t++){const h=e>=3&&e<5&&t>=3&&t<8?255:0;i.push(r),s.push(h)}}const r=new Uint8Array(i),n={rect:o,page:this._currentPage,sdf:!0},c=new Uint8Array(s),d={rect:a,page:this._currentPage,sdf:!0};this.recordGlyph(n,h,r,e),this.recordGlyph(d,h,c,e)}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),s=new ImageData(this.width,this.height),r=s.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let h=0;h<t.length;++h)r[4*h]=t[h],r[4*h+1]=0,r[4*h+2]=0,r[4*h+3]=255;i.putImageData(s,0,0),document.body.appendChild(e)}}export{n as GlyphMosaic,h as decorGlyphRect};
2
+ import has from"../../../../core/has.js";import{open as t}from"../../../../core/workers.js";import{sdfBufferServer as e}from"./definitions.js";import i from"./Rect.js";import s from"../../../webgl/Texture.js";import{TextureDescriptor as r}from"../../../webgl/TextureDescriptor.js";const h={width:5,height:2,left:0,top:0},o=new i(0,0,11,8),n=new i(11,0,11,8);class a{constructor(t,e,i,s){this._snapCoords=i,this._setTextureBinding=s,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._textures=[],this._worker=this._load(),this.width=t,this.height=e,this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0,this._worker.then(t=>t.connection.close())}async openMessagePorts(){return(await this._worker).connection.openPorts()}async rasterizeText(t,e,i){return(await this._worker).worker.rasterizeText(t,e,i)}getTexture(t,e){if(!this._textures[e]){const i=new r(this.width,this.height);i.pixelFormat=6406,i.wrapMode=33071,this._textures[e]=new s(t,i,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}bind(t,e,i,s){const r=this.getTexture(t,i);r.setSamplingMode(e),t.bindTexture(r,s)}async _load(){const i={getOptions:()=>({width:this.width,height:this.height,snapCoords:!!this._snapCoords}),recordGlyphs:t=>{const i=e;for(const e of t)e.sdf&&this.recordGlyph(e.mosaicItem,e.rect,e.sdf.buffer,i),this._setTextureBinding&&0!==e.mosaicItem.textureBinding&&this._setTextureBinding(e.mosaicItem)}},s=await t("GlyphWorker",{client:i,strategy:"dedicated"});return{worker:s.createInvokeProxy(),connection:s}}_invalidate(){this._dirties[this._currentPage]=!0}recordGlyph(t,e,i,s){const{page:r,rect:h}=t;if(0===e.width)return;const o=e.width+2*s,n=e.height+2*s;this._pageData[r]||this._allocNewPage(r);const a=this._pageData[r];for(let c=0;c<n;c++){const t=o*c,e=this.width*(h.y+c)+h.x;for(let s=0;s<o;s++)a[e+s]=i[t+s]}has("esri-glyph-debug")&&this._showDebugPage(a),this._invalidate()}_allocNewPage(t){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=t,this._pageData[t]=new Uint8Array(this.width*this.height),this._dirties[t]=!0,this._textures[t]=null,this._initDecorationGlyphs()}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],i=[],s=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=0;t<11;t++){const h=e>=3&&e<5&&t>=3&&t<8?255:0;i.push(r),s.push(h)}}const r=new Uint8Array(i),a={rect:o,page:this._currentPage,sdf:!0},c=new Uint8Array(s),d={rect:n,page:this._currentPage,sdf:!0};this.recordGlyph(a,h,r,e),this.recordGlyph(d,h,c,e)}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),s=new ImageData(this.width,this.height),r=s.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let h=0;h<t.length;++h)r[4*h]=t[h],r[4*h+1]=0,r[4*h+2]=0,r[4*h+3]=255;i.putImageData(s,0,0),document.body.appendChild(e)}}export{a as GlyphMosaic,h as decorGlyphRect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,initial as a,when as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{getClosestDenormalizedXToReference as h}from"../../../../geometry/support/normalizeUtils.js";import{isVideoElement as u}from"../../../../support/mediaLayerUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createPlayer as f,updateIfNeeded as y}from"./animatedFormats/utils.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const _=[1,1],v=d(),g={none:"None",loop:"Loop",oscillate:"Oscillate"};function A(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?g[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class R extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=p(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._playAnimation=!0,this._handles.add([o(()=>this.elementView.element.opacity,e=>this.opacity=e,a),o(()=>[this.elementView.coords],()=>{this.requestRender()},a),o(()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions],()=>{this.texture=s(this.texture),this.requestRender()},a),l(()=>this.elementView.element.loaded,()=>{const e=this.elementView.element;this.ready(),u(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",()=>this.requestRender()),t(e.content,"loadeddata",()=>this.requestRender()),t(e.content,"loaded",()=>this.requestRender())]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback(()=>this.requestRender()):this._handles.add([t(e.content,"seeked",()=>this.requestRender())]),this.requestRender())},a)]),n.element.load().catch(t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))})}getMesh(e){throw new Error("Method not implemented.")}destroy(){super.destroy(),this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return _}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const i=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,n=i?r.naturalWidth:s?r.videoWidth:r.width,o=i?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(n,o),this.texture)if(s)if(r.readyState>=r.HAVE_CURRENT_DATA)e.animationsEnabled&&this._updateTextureAndRequestRender(r);else{const e=()=>{this._updateTextureAndRequestRender(r),r.removeEventListener("canplay",e),r.removeEventListener("seeked",e)};r.addEventListener("canplay",e),r.addEventListener("seeked",e)}else"getFrame"in r&&e.animationsEnabled&&this.requestRender();else{const e=new x(n,o);if(e.wrapMode=33071,e.preMultiplyAlpha=!0,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new w(t,e,r)};if("animationOptions"in this.elementView.element){const e=A(this.elementView.element.animationOptions);this._playAnimation=e.playAnimation??!1,this._player=f(r,e,null,i)}}else this.texture=new w(t,e,r);this.texture.generateMipmap(),s&&this._requestVideoFrame(r)}}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),this._requestVideoFrame(e)}_requestVideoFrame(e){"requestVideoFrameCallback"in e?e.requestVideoFrameCallback(()=>this.requestRender()):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?(this._playAnimation&&y(e,this._player),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:_,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._indices})):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,p=(n[0]+n[2])/2,u=h(e.x,p,s.spatialReference),c=e.y,f=e.x-u;m.set([a[0]-u,a[1]-c,o[0]-u,o[1]-c,l[0]-u,l[1]-c,d[0]-u,d[1]-c]);let y=t;if(i){const e=n[0]+f,t=n[2]+f,{worldWidth:r,xBounds:s}=i,[o,a]=s;e<o?y=r:t>a&&(y=-r)}this.wrapAroundShift=y,this.isWrapAround=0!==y}_updatePerspectiveTransform(e,t){const r=this._vertices;n(v,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,v[6]/v[8]*e,v[7]/v[8]*t)}}export{R as default};
2
+ import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,initial as a,when as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{getClosestDenormalizedXToReference as h}from"../../../../geometry/support/normalizeUtils.js";import{isVideoElement as u}from"../../../../support/mediaLayerUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createPlayer as f,updateIfNeeded as y}from"./animatedFormats/utils.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const _=[1,1],v=d(),g={none:"None",loop:"Loop",oscillate:"Oscillate"};function A(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?g[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class R extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=p(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._playAnimation=!0,this._handles.add([o(()=>this.elementView.element.opacity,e=>this.opacity=e,a),o(()=>[this.elementView.coords],()=>{this.requestRender()},a),o(()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions],()=>{this.texture=s(this.texture),this.requestRender()},a),l(()=>this.elementView.element.loaded,()=>{const e=this.elementView.element;this.ready(),u(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",()=>this.requestRender()),t(e.content,"loadeddata",()=>this.requestRender()),t(e.content,"loaded",()=>this.requestRender())]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback(()=>this.requestRender()):this._handles.add([t(e.content,"seeked",()=>this.requestRender())]),this.requestRender())},a)]),n.element.load().catch(t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))})}getMesh(e){throw new Error("Method not implemented.")}destroy(){super.destroy(),this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return _}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const i=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,n=i?r.naturalWidth:s?r.videoWidth:r.width,o=i?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(n,o),this.texture)if(s)if(r.readyState>=r.HAVE_CURRENT_DATA)e.animationsEnabled&&this._updateTextureAndRequestRender(r);else{const e=()=>{this._updateTextureAndRequestRender(r),r.removeEventListener("canplay",e),r.removeEventListener("seeked",e)};r.addEventListener("canplay",e),r.addEventListener("seeked",e)}else"getFrame"in r&&e.animationsEnabled&&this.requestRender();else{const e=new x(n,o);if(e.wrapMode=33071,e.preMultiplyAlpha=!0,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new w(t,e,r)};if("animationOptions"in this.elementView.element){const e=A(this.elementView.element.animationOptions);this._playAnimation=e.playAnimation??!1,this._player=f(r,e,null,i)}}else this.texture=new w(t,e,r);this.texture.generateMipmap(),s&&this._requestVideoFrame(r)}}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),this._requestVideoFrame(e)}_requestVideoFrame(e){"requestVideoFrameCallback"in e?e.requestVideoFrameCallback(()=>this.requestRender()):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?(this._playAnimation&&y(e,this._player),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:_,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._indices})):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,p=(n[0]+n[2])/2,u=h(e.x,p,s.spatialReference),c=e.y;m.set([a[0]-u,a[1]-c,o[0]-u,o[1]-c,l[0]-u,l[1]-c,d[0]-u,d[1]-c]);let f=0;if(i){const{worldWidth:e}=i,t=e/2,r=n[0]-u,s=n[2]-u;r<-t?f=e:s>t&&(f=-e)}this.wrapAroundShift=f,this.isWrapAround=0!==f}_updatePerspectiveTransform(e,t){const r=this._vertices;n(v,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,v[6]/v[8]*e,v[7]/v[8]*t)}}export{R as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../../core/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as a,scaleAndAdd as s,subtract as n,length as o,dot as l}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as h,a as p}from"../../../../../chunks/boundedPlane.js";import{getInfo as u}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as _}from"./Manipulation.js";import{onGrabChangedHandle as d}from"./utils.js";import{createManipulatorDragEventPipeline as m,screenToMap as f}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as g}from"../../../../interactive/GraphicManipulator.js";import{apply as v}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const b=10,x=1e-6,C=.3;function y(t){const i=o(t.basis1),e=o(t.basis2);return C*Math.min(i,e)}class j extends _{constructor(i){super(),this._handles=new t,this._planeStart=h(),this._displayPlaneStart=h(),this._originCache=c(),this._axisCache=r(),this._renderStartCache=c(),this._renderEndCache=c(),this._resizeOriginCache=c(),this._view=i.view,this._tool=i.tool,this._graphic=i.graphic,this._direction=i.direction,this._preserveAspectRatio=i.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",t=>d(t,this._manipulator))]),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,1)}createDragPipeline(t,r){let c=null,h=null,_=null,d=0,g=null,C=null;const j=this._planeStart,w=this._displayPlaneStart,S=this._direction;return m(this._manipulator,(m,E)=>{E.next(i=>{if("start"===i.action){m.cursor="grabbing";const i=t();c=i.plane,h=i.displayPlane,_=i.editGeometryOperations,d=b*this._view.resolution,p(c,j),p(h,w);const e=u(_.data.spatialReference);g=e?e.valid[1]-e.valid[0]-3*b*this._view.resolution:null}return i}).next(f(this._view)).next(t=>{const i=a(this._renderStartCache,[t.mapStart.x,t.mapStart.y,0]),e=a(this._renderEndCache,[t.mapEnd.x,t.mapEnd.y,0]),r=a(this._resizeOriginCache,w.origin);s(r,r,w.basis1,-S[0]),s(r,r,w.basis2,-S[1]),n(e,e,r),n(i,i,r);const c=0!==S[0]&&0!==S[1],p=y(w),u=y(h)/p,_=(t,r)=>{if(0===t)return 1;let a=o(r),s=.5*t*l(r,e)/a;const n=s<0?-1:1;if(c){s+=(a-.5*t*l(r,i)/a)*n*u}const h=a<1.5*d?1:x;return a=Math.max(a-d,x),n>0&&(s-=b*this._view.resolution),n*Math.max(n*(s/a),h)},m=_(S[0],w.basis1),f=_(S[1],w.basis2);return{...t,direction:S,factor1:m,factor2:f}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(t=>{const n=a(this._originCache,j.origin);s(n,n,j.basis1,-S[0]),s(n,n,j.basis2,-S[1]);const o=i(this._axisCache,j.basis1[0],j.basis1[1]);e(o,o);const l=_.data.allVerticesUnordered,h="start"===t.action?0:1,u=_.scaleVertices(l,n,o,t.factor1,t.factor2,h,1);return g&&g<_.data.geometry.extent.width&&C?_.updateVertices(l,C):(p(j,c),v(u,c),C=u.operation,r(t,u)),t}).next(t=>("end"===t.action&&(m.cursor="grab"),t))})}_createManipulator(){return new g({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}export{j as ScaleManipulation,y as calculateDiagonalResizeHandleScale};
2
+ import t from"../../../../../core/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as a,scaleAndAdd as s,subtract as n,length as o,dot as l}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as h,a as p}from"../../../../../chunks/boundedPlane.js";import{getClosestDenormalizedXToReference as u}from"../../../../../geometry/support/normalizeUtils.js";import{getInfo as m}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as _}from"./Manipulation.js";import{onGrabChangedHandle as d}from"./utils.js";import{createManipulatorDragEventPipeline as f,screenToMap as g}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as v}from"../../../../interactive/GraphicManipulator.js";import{apply as b}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const x=10,y=1e-6,C=.3;function S(t){const i=o(t.basis1),e=o(t.basis2);return C*Math.min(i,e)}class j extends _{constructor(i){super(),this._handles=new t,this._planeStart=h(),this._displayPlaneStart=h(),this._originCache=c(),this._axisCache=r(),this._renderStartCache=c(),this._renderEndCache=c(),this._resizeOriginCache=c(),this._view=i.view,this._tool=i.tool,this._graphic=i.graphic,this._direction=i.direction,this._preserveAspectRatio=i.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",t=>d(t,this._manipulator))]),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,1)}createDragPipeline(t,r){let c=null,h=null,_=null,d=0,v=null,C=null,j=0;const w=this._planeStart,E=this._displayPlaneStart,M=this._direction;return f(this._manipulator,(f,P)=>{P.next(i=>{if("start"===i.action){f.cursor="grabbing";const i=t();c=i.plane,h=i.displayPlane,_=i.editGeometryOperations,d=x*this._view.resolution,p(c,w),p(h,E);const e=m(_.data.spatialReference);v=e?e.valid[1]-e.valid[0]-3*x*this._view.resolution:null}return i}).next(g(this._view)).next(t=>{if("start"===t.action){const i=E.origin[0]+M[0]*E.basis1[0]+M[1]*E.basis2[0],e=_.data.spatialReference,r=u(t.mapStart.x,i,e);j=r-t.mapStart.x}const i=a(this._renderStartCache,[t.mapStart.x+j,t.mapStart.y,0]),e=a(this._renderEndCache,[t.mapEnd.x+j,t.mapEnd.y,0]),r=a(this._resizeOriginCache,E.origin);s(r,r,E.basis1,-M[0]),s(r,r,E.basis2,-M[1]),n(e,e,r),n(i,i,r);const c=0!==M[0]&&0!==M[1],p=S(E),m=S(h)/p,f=(t,r)=>{if(0===t)return 1;let a=o(r),s=.5*t*l(r,e)/a;const n=s<0?-1:1;if(c){s+=(a-.5*t*l(r,i)/a)*n*m}const h=a<1.5*d?1:y;return a=Math.max(a-d,y),n>0&&(s-=x*this._view.resolution),n*Math.max(n*(s/a),h)},g=f(M[0],E.basis1),v=f(M[1],E.basis2);return{...t,direction:M,factor1:g,factor2:v}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(t=>{const n=a(this._originCache,w.origin);s(n,n,w.basis1,-M[0]),s(n,n,w.basis2,-M[1]);const o=i(this._axisCache,w.basis1[0],w.basis1[1]);e(o,o);const l=_.data.allVerticesUnordered,h="start"===t.action?0:1,u=_.scaleVertices(l,n,o,t.factor1,t.factor2,h,1);return v&&v<_.data.geometry.extent.width&&C?_.updateVertices(l,C):(p(w,c),b(u,c),C=u.operation,r(t,u)),t}).next(t=>("end"===t.action&&(f.cursor="grab"),t))})}_createManipulator(){return new v({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}export{j as ScaleManipulation,S as calculateDiagonalResizeHandleScale};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,isScreenRect as l,pt2px as n}from"../../../core/screenUtils.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{diff as y,hasDiff as u}from"../../../core/accessorSupport/diffUtils.js";import c from"../../../geometry/Point.js";import{create as d}from"../../../geometry/support/aaBoundingRect.js";import{equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as _}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as f,tileSizeInPixels as g}from"../engine/vectorTiles/constants.js";import{TileHandler as m}from"../engine/vectorTiles/TileHandler.js";import{TileManager as T}from"../engine/vectorTiles/TileManager.js";import{VectorTile as C}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as v}from"../engine/vectorTiles/VectorTileContainer.js";import w from"../engine/vectorTiles/VectorTileFeatureIndex.js";import R from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as H}from"./LayerView2D.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import S from"../../layers/VectorTileLayerView.js";import{TaskPriority as P}from"../../support/Scheduler.js";const b=2.5;let V=class extends(H(S)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(l(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const o=has("esri-vtl-search-tolerance")??0,h=o>0?o:b,y=this.view.state,{rotation:u,pixelRatio:c}=this.view.state,d=n(h)*c;let p=null;const _=this._vectorTileContainer?.symbolRepository;_&&(p=_.querySymbols(r[0],d,s.decluttererOffset,{}));const f=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,d,y,p);if(p=p?.filter(e=>this._styleRepository.getStyleLayerVisibility(e.styleLayerUID)),(!f||0===f.length)&&0===p?.length)return null;e=e.clone().normalize();const g=[],m=[];for(const a of f)g.push(this._queryTile(m,e,d,u,a,p?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(g),m}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new R(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new v(this._tileInfoView),this._tileHandler=new m(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1,this.view.glyphMosaic),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=y(i.layout,e.layout);if(null!=s){if(u(s,"visibility")&&1===D(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return p(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading||!this._isTileHandlerReady}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:P.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:P.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(o){i.getLogger(this).error("error applying vector-tiles style update",o.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set,r=new Set;for(const i of e){if(3!==i.type&&2!==i.type)continue;const e=2===i.type?i.data.layer.id:i.data.layer,a=t.getLayerById(e);a&&(s.add(a.uid),3===a.type&&r.add(a.uid))}const a=this._vectorTileContainer.children,l=this._vectorTileContainer?.symbolFader?.symbolRepository;l&&r.size>0&&l.deleteStyleLayers(Array.from(r));const n=new Set;if(e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&n.add(e.uid)}}),s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),n.size>0){const e=Array.from(n),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new R(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(d(),e),i=this._tileInfoView.getTileResolution(e.level);return new C(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,y]=this._tileInfoView.getTileBounds(d(),r.key,!0),u=f*((t.x-n)/(h-n)),c=f*(1-(t.y-o)/(y-o)),p=this.view.featuresTilingScheme.tileInfo.scaleToZoom(this.view.state.scale)-r.key.level,m=p>0?2**p:1,T=i/m*(f/g),C=await l.queryAttributes(u,c,T,s,a,m);for(const d of C)d.graphic.geometry=this._tileToMapPoint(d.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:d.graphic,mapPoint:t.clone()});e.sort((e,t)=>(_(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(_(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new c({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=w.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function D(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([o()],V.prototype,"_isTileHandlerReady",void 0),V=e([h("esri.views.2d.layers.VectorTileLayerView2D")],V);const j=V;export{j as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,isScreenRect as l,pt2px as n}from"../../../core/screenUtils.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{diff as y,hasDiff as u}from"../../../core/accessorSupport/diffUtils.js";import c from"../../../geometry/Point.js";import{create as d}from"../../../geometry/support/aaBoundingRect.js";import{equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as _}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as f,tileSizeInPixels as g}from"../engine/vectorTiles/constants.js";import{TileHandler as m}from"../engine/vectorTiles/TileHandler.js";import{TileManager as T}from"../engine/vectorTiles/TileManager.js";import{VectorTile as C}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as v}from"../engine/vectorTiles/VectorTileContainer.js";import w from"../engine/vectorTiles/VectorTileFeatureIndex.js";import R from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as H}from"./LayerView2D.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import S from"../../layers/VectorTileLayerView.js";import{TaskPriority as P}from"../../support/Scheduler.js";const b=2.5;let V=class extends(H(S)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(l(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const o=has("esri-vtl-search-tolerance")??0,h=o>0?o:b,y=this.view.state,{rotation:u,pixelRatio:c}=this.view.state,d=n(h)*c;let p=null;const _=this._vectorTileContainer?.symbolRepository;_&&(p=_.querySymbols(r[0],d,s.decluttererOffset,{}));const f=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,d,y,p);if(p=p?.filter(e=>this._styleRepository.getStyleLayerVisibility(e.styleLayerUID)),(!f||0===f.length)&&0===p?.length)return null;e=e.clone().normalize();const g=[],m=[];for(const a of f)g.push(this._queryTile(m,e,d,u,a,p?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(g),m}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new R(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new v(this._tileInfoView),this._tileHandler=new m(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1,this.view.glyphMosaic()),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=y(i.layout,e.layout);if(null!=s){if(u(s,"visibility")&&1===D(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return p(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading||!this._isTileHandlerReady}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:P.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:P.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(o){i.getLogger(this).error("error applying vector-tiles style update",o.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set,r=new Set;for(const i of e){if(3!==i.type&&2!==i.type)continue;const e=2===i.type?i.data.layer.id:i.data.layer,a=t.getLayerById(e);a&&(s.add(a.uid),3===a.type&&r.add(a.uid))}const a=this._vectorTileContainer.children,l=this._vectorTileContainer?.symbolFader?.symbolRepository;l&&r.size>0&&l.deleteStyleLayers(Array.from(r));const n=new Set;if(e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&n.add(e.uid)}}),s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),n.size>0){const e=Array.from(n),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new R(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this.view.glyphMosaic(),this._styleRepository,this._tileInfoView),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(d(),e),i=this._tileInfoView.getTileResolution(e.level);return new C(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,y]=this._tileInfoView.getTileBounds(d(),r.key,!0),u=f*((t.x-n)/(h-n)),c=f*(1-(t.y-o)/(y-o)),p=this.view.featuresTilingScheme.tileInfo.scaleToZoom(this.view.state.scale)-r.key.level,m=p>0?2**p:1,T=i/m*(f/g),C=await l.queryAttributes(u,c,T,s,a,m);for(const d of C)d.graphic.geometry=this._tileToMapPoint(d.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:d.graphic,mapPoint:t.clone()});e.sort((e,t)=>(_(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(_(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new c({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=w.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function D(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([o()],V.prototype,"_isTileHandlerReady",void 0),V=e([h("esri.views.2d.layers.VectorTileLayerView2D")],V);const j=V;export{j as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as l,destroyMaybe as r}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as a,watch as n,initial as o}from"../../../core/reactiveUtils.js";import{property as h,subclass as c}from"../../../core/accessorSupport/decorators.js";import{SchemaHelper as d}from"../../2d/engine/vectorTiles/SchemaHelper.js";import m from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import y from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as g}from"./LayerView3D.js";import{TiledLayerView3D as f}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as u,test as v}from"../terrain/terrainUtils.js";import S from"../../layers/VectorTileLayerView.js";let _=class extends(f(g(S))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=has("disable-feature:vtl-level-shift")?0:1}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,groundView:i,spatialReference:l,state:r,viewingMode:h}=this.view,c="local"===h&&!u(l)||v.force512VTL?this.layer.tileInfo:this.layer.tileInfo.getCompatibleForVTL(256),g=this._getTileInfoSupportError(c,this.layer.fullExtent);if(null!=g)return this.addResolvingPromise(Promise.reject(g));const f=a(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const t=e.tilingScheme,l=t.pixelSize,r=256===l?1:2,s=i.spatialReference?.isGeographic&&256===l?1:0,a=i.spatialReference?.isGeographic||256!==l?0:1;let n;this.schemaHelper=new d(r,s,this.levelShift+a),n=256===l||512===l?this.layer.tileInfo.getCompatibleForVTL(l):this.layer.tileInfo;const o=this._getTileInfoCompatibilityError(n,t);if(o)throw o;this.tileInfo=n});this._tileHandlerController=new AbortController;const S=this.view.resourceController;this._memCache=S.memoryController.newCache(`vtl-${this.layer.uid}`,e=>e.release()),this.addHandles(n(()=>this.view.qualitySettings.memoryLimit,e=>this._memCache.maxSize=Math.ceil(e/10*1048576),o));const _=new y(this.layer.currentStyleInfo.style),w=this.view.glyphMosaic;this._tileHandler=new m(this.layer,_,r.contentPixelRatio,w,this._memCache);const C=this._tileHandlerController.signal,R=H(S),L=this._tileHandler.start({signal:C,schedule:R}),x=this._tileHandler.spriteMosaic;x.then(e=>{!s(C)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))}),L.then(()=>this._tileHandlerController=null);const T=()=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const e=this.layer.currentStyleInfo.style,t=this.view.state?.contentPixelRatio??1,i=new y(e),l=new m(this.layer,i,t,w,this._memCache),r=l.start({signal:this._tileHandlerController.signal,schedule:R}),s=l.spriteMosaic;r.then(()=>this._tileHandlerController=null),this._updatingHandles.consumePromise(Promise.all([r,s]).then(([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new p(e,l.glyphMosaic),this._tileHandler=l,this.emit("data-changed"),t.destroy(),i&&i.dispose()}))};this._updatingHandles.add(()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio}),T),this.addHandles([this.layer.on("paint-change",()=>this.emit("data-changed")),this.layer.on("style-layer-change",T),this.layer.on("delete-style-layer",T),this.layer.on("spriteSource-change",()=>this.emit("data-changed")),this.layer.on("layout-change",()=>this.emit("data-changed")),this.layer.on("style-layer-visibility-change",()=>this.emit("data-changed"))]);const j=Promise.all([f,L,x]);this.addResolvingPromise(j)}destroy(){this.painter=i(this.painter),this._tileHandlerController=l(this._tileHandlerController),this._tileHandler=r(this._tileHandler),this._memCache=r(this._memCache)}get contentZoom(){return has("disable-feature:vtl-level-shift")?1:this.view.qualitySettings.tiledSurface.vtlContentZoom}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,i=this.layer.maxScale||e[e.length-1].scale,l=this.levelRangeFromScaleRange(t,i);return this.layer.maxScale?l.maxLevel++:l.maxLevel+=this.levelShift,l}get dataScaleRange(){const e=this.tileInfo.lods;return{minScale:e[0].scale,maxScale:e[e.length-1].scale}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange,i=this.levelRangeFromScaleRange(e,t);return 1===i.minLevel&&256===this.tileInfo.size[0]&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(e,t){const i=this.schemaHelper.getLevelRowColumn(e);return this._tileHandler.getVectorTile(i,t)}get hasVisibleFeatures(){return!0}async doRefresh(){this.suspended||this.emit("data-changed")}};e([h()],_.prototype,"levelShift",void 0),e([h()],_.prototype,"contentZoom",null),e([h()],_.prototype,"displayLevelRange",null),e([h()],_.prototype,"tileInfo",void 0),e([h()],_.prototype,"dataScaleRange",null),e([h()],_.prototype,"dataLevelRange",null),e([h()],_.prototype,"updatingProgressValue",void 0),_=e([c("esri.views.3d.layers.VectorTileLayerView3D")],_);const w=_;function H(e){return t=>e.immediate.schedule(t)}export{w as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as l,destroyMaybe as r}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as a,watch as n,initial as o}from"../../../core/reactiveUtils.js";import{property as h,subclass as c}from"../../../core/accessorSupport/decorators.js";import{SchemaHelper as d}from"../../2d/engine/vectorTiles/SchemaHelper.js";import m from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import y from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as g}from"./LayerView3D.js";import{TiledLayerView3D as f}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as u,test as v}from"../terrain/terrainUtils.js";import S from"../../layers/VectorTileLayerView.js";let _=class extends(f(g(S))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=has("disable-feature:vtl-level-shift")?0:1}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,groundView:i,spatialReference:l,state:r,viewingMode:h}=this.view,c="local"===h&&!u(l)||v.force512VTL?this.layer.tileInfo:this.layer.tileInfo.getCompatibleForVTL(256),g=this._getTileInfoSupportError(c,this.layer.fullExtent);if(null!=g)return this.addResolvingPromise(Promise.reject(g));const f=a(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const t=e.tilingScheme,l=t.pixelSize,r=256===l?1:2,s=i.spatialReference?.isGeographic&&256===l?1:0,a=i.spatialReference?.isGeographic||256!==l?0:1;let n;this.schemaHelper=new d(r,s,this.levelShift+a),n=256===l||512===l?this.layer.tileInfo.getCompatibleForVTL(l):this.layer.tileInfo;const o=this._getTileInfoCompatibilityError(n,t);if(o)throw o;this.tileInfo=n});this._tileHandlerController=new AbortController;const S=this.view.resourceController;this._memCache=S.memoryController.newCache(`vtl-${this.layer.uid}`,e=>e.release()),this.addHandles(n(()=>this.view.qualitySettings.memoryLimit,e=>this._memCache.maxSize=Math.ceil(e/10*1048576),o));const _=new y(this.layer.currentStyleInfo.style),w=this.view.glyphMosaic();this._tileHandler=new m(this.layer,_,r.contentPixelRatio,w,this._memCache);const C=this._tileHandlerController.signal,R=H(S),L=this._tileHandler.start({signal:C,schedule:R}),x=this._tileHandler.spriteMosaic;x.then(e=>{!s(C)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))}),L.then(()=>this._tileHandlerController=null);const T=()=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const e=this.layer.currentStyleInfo.style,t=this.view.state?.contentPixelRatio??1,i=new y(e),l=new m(this.layer,i,t,w,this._memCache),r=l.start({signal:this._tileHandlerController.signal,schedule:R}),s=l.spriteMosaic;r.then(()=>this._tileHandlerController=null),this._updatingHandles.consumePromise(Promise.all([r,s]).then(([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new p(e,l.glyphMosaic),this._tileHandler=l,this.emit("data-changed"),t.destroy(),i&&i.dispose()}))};this._updatingHandles.add(()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio}),T),this.addHandles([this.layer.on("paint-change",()=>this.emit("data-changed")),this.layer.on("style-layer-change",T),this.layer.on("delete-style-layer",T),this.layer.on("spriteSource-change",()=>this.emit("data-changed")),this.layer.on("layout-change",()=>this.emit("data-changed")),this.layer.on("style-layer-visibility-change",()=>this.emit("data-changed"))]);const j=Promise.all([f,L,x]);this.addResolvingPromise(j)}destroy(){this.painter=i(this.painter),this._tileHandlerController=l(this._tileHandlerController),this._tileHandler=r(this._tileHandler),this._memCache=r(this._memCache)}get contentZoom(){return has("disable-feature:vtl-level-shift")?1:this.view.qualitySettings.tiledSurface.vtlContentZoom}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,i=this.layer.maxScale||e[e.length-1].scale,l=this.levelRangeFromScaleRange(t,i);return this.layer.maxScale?l.maxLevel++:l.maxLevel+=this.levelShift,l}get dataScaleRange(){const e=this.tileInfo.lods;return{minScale:e[0].scale,maxScale:e[e.length-1].scale}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange,i=this.levelRangeFromScaleRange(e,t);return 1===i.minLevel&&256===this.tileInfo.size[0]&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(e,t){const i=this.schemaHelper.getLevelRowColumn(e);return this._tileHandler.getVectorTile(i,t)}get hasVisibleFeatures(){return!0}async doRefresh(){this.suspended||this.emit("data-changed")}};e([h()],_.prototype,"levelShift",void 0),e([h()],_.prototype,"contentZoom",null),e([h()],_.prototype,"displayLevelRange",null),e([h()],_.prototype,"tileInfo",void 0),e([h()],_.prototype,"dataScaleRange",null),e([h()],_.prototype,"dataLevelRange",null),e([h()],_.prototype,"updatingProgressValue",void 0),_=e([c("esri.views.3d.layers.VectorTileLayerView3D")],_);const w=_;function H(e){return t=>e.immediate.schedule(t)}export{w as default};
package/views/View.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as h}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{watch as f,sync as w,whenOnce as v,when as _,syncAndInitial as M}from"../core/reactiveUtils.js";import{property as V,subclass as b}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import T from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as x}from"../support/AnalysesCollection.js";import{GraphicsCollection as C}from"../support/GraphicsCollection.js";import{system as F}from"../time/constants.js";import k from"../time/TimeExtent.js";import{isTimeZoneValid as O}from"../time/timeZoneUtils.js";import H from"./BasemapView.js";import I from"./Magnifier.js";import Z from"./SelectionManager.js";import W from"./Theme.js";import{ToolViewManager as q}from"./ToolViewManager.js";import{GlyphMosaic as A}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as P}from"./3d/support/DefaultHighlights.js";import D from"./input/Input.js";import{ViewEvents as U}from"./input/ViewEvents.js";import z from"./navigation/Navigation.js";import{deduplicateAttributionItems as G}from"./support/attributionUtils.js";import{DefaultsFromMap as N}from"./support/DefaultsFromMap.js";import{defaultHighlightName as $}from"./support/HighlightDefaults.js";import B from"./support/HighlightOptions.js";import J from"./support/LayerViewManager.js";import K from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as Q}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as X}from"./support/WebGLRequirements.js";var Y;let ee=class extends(n(m)){static{Y=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new s({getCollections:()=>this.layerviewCollections,getChildrenFunction:ie}),this.animationsEnabled=!0,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new C,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new I,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new D,this.navigation=new z,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new U(this),this.requiredFieldsOptions=new K,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new g,this.handles.add(f(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,Y.views.add(this)):(this._lockedSpatialReference=null,Y.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}this._glyphMosaic=new A(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},w)),this.analyses=new x}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,v(()=>this.ready)))),this.basemapView=new H({view:this}),this.layerViewManager=new J({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new q({view:this}),this.selectionManager=new Z({view:this}),this.addHandles([_(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),f(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},M),f(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)},w),f(()=>this._userSpatialReference,e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)},M)])}get _layerToLayerviewMapping(){return Y._layerToLayerview}static{this._layerToLayerview=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.basemap.groundLayers","view.basemapView.groundLayerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"],["view.map.layers","view.layerViews"]]}destroy(){this.destroyed||(Y.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.analysisViewManager=y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get("analyses")}set analyses(e){this._set("analyses",e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get attributionItems(){return this.suspended?[]:G(this._get("attributionItems"),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new N({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get("highlights")??P()}set highlights(e){this._set("highlights",a(e,this._get("highlights"),r.ofType(B)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===$)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;const{map:e,spatialReference:t}=this;return!(this.fatalError||!this._isValid||this._readyCycleForced||!e||h(e)&&!e.loaded||0===this.width||0===this.height||!t||!this._validateSpatialReference(t)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const{_userSpatialReference:e}=this;if(e&&null!==e.vcsWkid)return e;const t=e||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(t&&this.defaultsFromMap?.required?.heightModelInfo){const e=t.clone();return e.vcsWkid=this.defaultsFromMap.vcsWkid,e.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,e}return t}set spatialReference(e){const t=!L(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??F}set timeZone(e){this._userTimeZone=e,O(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},s=p(()=>i.remove(r));return i.add(r),this.addHandles(s),s}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new W}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){const e=X(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn("#validate()",e.message),e;const t=await Q();if(t)throw d.getLogger(this).warn("#validate()",t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(_(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){const e=document.createElement("div");e.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const t=document.createElement("div");t.innerHTML="Unable to display map. WebGL2 support is required.",t.setAttribute("style","font-size: 24px; font-weight: bold;");const i=document.createElement("div");i.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",i.setAttribute("style","font-size: 18px;");const r=document.createElement("a");r.innerHTML="https://esriurl.com/webgl-faq",r.target="_blank",r.setAttribute("style","font-size: 18px;"),r.href="https://esriurl.com/webgl-faq",e.appendChild(t),e.appendChild(i),e.appendChild(r);const s=this.getSurface();s&&s.appendChild(e)}};e([V()],ee.prototype,"_userSpatialReference",void 0),e([V()],ee.prototype,"activeTool",null),e([V({readOnly:!0})],ee.prototype,"allLayerViews",void 0),e([V({readOnly:!0})],ee.prototype,"layerviewCollections",null),e([V(R(x,"analyses"))],ee.prototype,"analyses",null),e([V()],ee.prototype,"animation",null),e([V()],ee.prototype,"animationsEnabled",void 0),e([V({readOnly:!0})],ee.prototype,"attributionItems",null),e([V()],ee.prototype,"attributionVisible",void 0),e([V()],ee.prototype,"basemapView",void 0),e([V()],ee.prototype,"center",null),e([V()],ee.prototype,"defaultsFromMapSettings",null),e([V()],ee.prototype,"defaultsFromMap",null),e([V()],ee.prototype,"dependencies",void 0),e([V()],ee.prototype,"displayFilterEnabled",void 0),e([V({type:T})],ee.prototype,"extent",null),e([V()],ee.prototype,"fatalError",void 0),e([V(R(C,"graphics"))],ee.prototype,"graphics",void 0),e([V({readOnly:!0,type:j})],ee.prototype,"heightModelInfo",null),e([V({readOnly:!0,type:A})],ee.prototype,"glyphMosaic",null),e([V({type:r.ofType(B)})],ee.prototype,"highlights",null),e([V({readOnly:!0})],ee.prototype,"interacting",null),e([V({constructOnly:!0})],ee.prototype,"layerViewFilter",void 0),e([V({readOnly:!0})],ee.prototype,"navigating",null),e([V({readOnly:!0})],ee.prototype,"preconditionsReady",null),e([V({readOnly:!0})],ee.prototype,"typeSpecificPreconditionsReady",void 0),e([V({type:r,readOnly:!0})],ee.prototype,"layerViews",void 0),e([V()],ee.prototype,"resolution",null),e([V({type:I})],ee.prototype,"magnifier",void 0),e([V({value:null,type:t})],ee.prototype,"map",null),e([V()],ee.prototype,"padding",void 0),e([V({readOnly:!0})],ee.prototype,"ready",void 0),e([V({readOnly:!0})],ee.prototype,"canZoomIn",null),e([V({readOnly:!0})],ee.prototype,"canZoomOut",null),e([V()],ee.prototype,"_readyStateWaitingTask",void 0),e([V({readOnly:!0})],ee.prototype,"readyState",null),e([V({type:E})],ee.prototype,"spatialReference",null),e([V()],ee.prototype,"stationary",null),e([V({type:k})],ee.prototype,"timeExtent",null),e([V({type:String,nonNullable:!0})],ee.prototype,"timeZone",null),e([V()],ee.prototype,"tools",null),e([V()],ee.prototype,"toolViewManager",void 0),e([V({readOnly:!0})],ee.prototype,"type",void 0),e([V({type:Number})],ee.prototype,"scale",void 0),e([V({readOnly:!0})],ee.prototype,"updating",void 0),e([V({readOnly:!0})],ee.prototype,"initialExtentRequired",void 0),e([V({readOnly:!0})],ee.prototype,"initialExtent",null),e([V()],ee.prototype,"cursor",null),e([V({readOnly:!0})],ee.prototype,"input",void 0),e([V({type:z,nonNullable:!0})],ee.prototype,"navigation",void 0),e([V()],ee.prototype,"layerViewManager",void 0),e([V()],ee.prototype,"analysisViewManager",void 0),e([V()],ee.prototype,"selectionManager",void 0),e([V()],ee.prototype,"width",void 0),e([V()],ee.prototype,"height",void 0),e([V({readOnly:!0})],ee.prototype,"resizing",void 0),e([V({value:null,readOnly:!0})],ee.prototype,"size",null),e([V({readOnly:!0})],ee.prototype,"suspended",void 0),e([V({readOnly:!0})],ee.prototype,"viewEvents",void 0),e([V()],ee.prototype,"_isValid",void 0),e([V()],ee.prototype,"_readyCycleForced",void 0),e([V()],ee.prototype,"_lockedSpatialReference",void 0),e([V()],ee.prototype,"_userTimeZone",void 0),e([V()],ee.prototype,"_lockedTimeZone",void 0),e([V()],ee.prototype,"_userTimeExtent",void 0),e([V()],ee.prototype,"_lockedTimeExtent",void 0),e([V({type:W})],ee.prototype,"theme",void 0),e([V({readOnly:!0,type:W})],ee.prototype,"effectiveTheme",null),e([V({readOnly:!0})],ee.prototype,"registeredComponents",void 0),ee=Y=e([b("esri.views.View")],ee);const te=globalThis.$arcgis;function ie(e){return e.layerViews}te&&!te.views&&Object.defineProperty(te,"views",{configurable:!1,enumerable:!0,writable:!1,value:ee.views});export{ee as default};
2
+ import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as h}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{watch as f,sync as w,whenOnce as v,when as _,syncAndInitial as M}from"../core/reactiveUtils.js";import{property as V,subclass as b}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import T from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as x}from"../support/AnalysesCollection.js";import{GraphicsCollection as C}from"../support/GraphicsCollection.js";import{system as F}from"../time/constants.js";import k from"../time/TimeExtent.js";import{isTimeZoneValid as O}from"../time/timeZoneUtils.js";import H from"./BasemapView.js";import I from"./Magnifier.js";import Z from"./SelectionManager.js";import W from"./Theme.js";import{ToolViewManager as q}from"./ToolViewManager.js";import{GlyphMosaic as A}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as P}from"./3d/support/DefaultHighlights.js";import D from"./input/Input.js";import{ViewEvents as U}from"./input/ViewEvents.js";import z from"./navigation/Navigation.js";import{deduplicateAttributionItems as G}from"./support/attributionUtils.js";import{DefaultsFromMap as N}from"./support/DefaultsFromMap.js";import{defaultHighlightName as $}from"./support/HighlightDefaults.js";import B from"./support/HighlightOptions.js";import J from"./support/LayerViewManager.js";import K from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as Q}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as X}from"./support/WebGLRequirements.js";var Y;let ee=class extends(n(m)){static{Y=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new s({getCollections:()=>this.layerviewCollections,getChildrenFunction:ie}),this.animationsEnabled=!0,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new C,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new I,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new D,this.navigation=new z,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new U(this),this.requiredFieldsOptions=new K,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new g,this.handles.add(f(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,Y.views.add(this)):(this._lockedSpatialReference=null,Y.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}this._glyphMosaic=new A(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},w)),this.analyses=new x}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,v(()=>this.ready)))),this.basemapView=new H({view:this}),this.layerViewManager=new J({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new q({view:this}),this.selectionManager=new Z({view:this}),this.addHandles([_(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),f(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},M),f(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)},w),f(()=>this._userSpatialReference,e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)},M)])}get _layerToLayerviewMapping(){return Y._layerToLayerview}static{this._layerToLayerview=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.basemap.groundLayers","view.basemapView.groundLayerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"],["view.map.layers","view.layerViews"]]}destroy(){this.destroyed||(Y.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.analysisViewManager=y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get("analyses")}set analyses(e){this._set("analyses",e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get attributionItems(){return this.suspended?[]:G(this._get("attributionItems"),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new N({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get("highlights")??P()}set highlights(e){this._set("highlights",a(e,this._get("highlights"),r.ofType(B)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===$)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;const{map:e,spatialReference:t}=this;return!(this.fatalError||!this._isValid||this._readyCycleForced||!e||h(e)&&!e.loaded||0===this.width||0===this.height||!t||!this._validateSpatialReference(t)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const{_userSpatialReference:e}=this;if(e&&null!==e.vcsWkid)return e;const t=e||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(t&&this.defaultsFromMap?.required?.heightModelInfo){const e=t.clone();return e.vcsWkid=this.defaultsFromMap.vcsWkid,e.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,e}return t}set spatialReference(e){const t=!L(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??F}set timeZone(e){this._userTimeZone=e,O(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},s=p(()=>i.remove(r));return i.add(r),this.addHandles(s),s}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new W}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){const e=X(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn("#validate()",e.message),e;const t=await Q();if(t)throw d.getLogger(this).warn("#validate()",t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(_(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){const e=document.createElement("div");e.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const t=document.createElement("div");t.innerHTML="Unable to display map. WebGL2 support is required.",t.setAttribute("style","font-size: 24px; font-weight: bold;");const i=document.createElement("div");i.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",i.setAttribute("style","font-size: 18px;");const r=document.createElement("a");r.innerHTML="https://esriurl.com/webgl-faq",r.target="_blank",r.setAttribute("style","font-size: 18px;"),r.href="https://esriurl.com/webgl-faq",e.appendChild(t),e.appendChild(i),e.appendChild(r);const s=this.getSurface();s&&s.appendChild(e)}};e([V()],ee.prototype,"_userSpatialReference",void 0),e([V()],ee.prototype,"activeTool",null),e([V({readOnly:!0})],ee.prototype,"allLayerViews",void 0),e([V({readOnly:!0})],ee.prototype,"layerviewCollections",null),e([V(R(x,"analyses"))],ee.prototype,"analyses",null),e([V()],ee.prototype,"animation",null),e([V()],ee.prototype,"animationsEnabled",void 0),e([V({readOnly:!0})],ee.prototype,"attributionItems",null),e([V()],ee.prototype,"attributionVisible",void 0),e([V()],ee.prototype,"basemapView",void 0),e([V()],ee.prototype,"center",null),e([V()],ee.prototype,"defaultsFromMapSettings",null),e([V()],ee.prototype,"defaultsFromMap",null),e([V()],ee.prototype,"dependencies",void 0),e([V()],ee.prototype,"displayFilterEnabled",void 0),e([V({type:T})],ee.prototype,"extent",null),e([V()],ee.prototype,"fatalError",void 0),e([V(R(C,"graphics"))],ee.prototype,"graphics",void 0),e([V({readOnly:!0,type:j})],ee.prototype,"heightModelInfo",null),e([V({type:r.ofType(B)})],ee.prototype,"highlights",null),e([V({readOnly:!0})],ee.prototype,"interacting",null),e([V({constructOnly:!0})],ee.prototype,"layerViewFilter",void 0),e([V({readOnly:!0})],ee.prototype,"navigating",null),e([V({readOnly:!0})],ee.prototype,"preconditionsReady",null),e([V({readOnly:!0})],ee.prototype,"typeSpecificPreconditionsReady",void 0),e([V({type:r,readOnly:!0})],ee.prototype,"layerViews",void 0),e([V()],ee.prototype,"resolution",null),e([V({type:I})],ee.prototype,"magnifier",void 0),e([V({value:null,type:t})],ee.prototype,"map",null),e([V()],ee.prototype,"padding",void 0),e([V({readOnly:!0})],ee.prototype,"ready",void 0),e([V({readOnly:!0})],ee.prototype,"canZoomIn",null),e([V({readOnly:!0})],ee.prototype,"canZoomOut",null),e([V()],ee.prototype,"_readyStateWaitingTask",void 0),e([V({readOnly:!0})],ee.prototype,"readyState",null),e([V({type:E})],ee.prototype,"spatialReference",null),e([V()],ee.prototype,"stationary",null),e([V({type:k})],ee.prototype,"timeExtent",null),e([V({type:String,nonNullable:!0})],ee.prototype,"timeZone",null),e([V()],ee.prototype,"tools",null),e([V()],ee.prototype,"toolViewManager",void 0),e([V({readOnly:!0})],ee.prototype,"type",void 0),e([V({type:Number})],ee.prototype,"scale",void 0),e([V({readOnly:!0})],ee.prototype,"updating",void 0),e([V({readOnly:!0})],ee.prototype,"initialExtentRequired",void 0),e([V({readOnly:!0})],ee.prototype,"initialExtent",null),e([V()],ee.prototype,"cursor",null),e([V({readOnly:!0})],ee.prototype,"input",void 0),e([V({type:z,nonNullable:!0})],ee.prototype,"navigation",void 0),e([V()],ee.prototype,"layerViewManager",void 0),e([V()],ee.prototype,"analysisViewManager",void 0),e([V()],ee.prototype,"selectionManager",void 0),e([V()],ee.prototype,"width",void 0),e([V()],ee.prototype,"height",void 0),e([V({readOnly:!0})],ee.prototype,"resizing",void 0),e([V({value:null,readOnly:!0})],ee.prototype,"size",null),e([V({readOnly:!0})],ee.prototype,"suspended",void 0),e([V({readOnly:!0})],ee.prototype,"viewEvents",void 0),e([V()],ee.prototype,"_isValid",void 0),e([V()],ee.prototype,"_readyCycleForced",void 0),e([V()],ee.prototype,"_lockedSpatialReference",void 0),e([V()],ee.prototype,"_userTimeZone",void 0),e([V()],ee.prototype,"_lockedTimeZone",void 0),e([V()],ee.prototype,"_userTimeExtent",void 0),e([V()],ee.prototype,"_lockedTimeExtent",void 0),e([V({type:W})],ee.prototype,"theme",void 0),e([V({readOnly:!0,type:W})],ee.prototype,"effectiveTheme",null),e([V({readOnly:!0})],ee.prototype,"registeredComponents",void 0),ee=Y=e([b("esri.views.View")],ee);const te=globalThis.$arcgis;function ie(e){return e.layerViews}te&&!te.views&&Object.defineProperty(te,"views",{configurable:!1,enumerable:!0,writable:!1,value:ee.views});export{ee as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getMetersPerUnitForSR as e}from"../../core/units.js";import t from"../../geometry/Extent.js";import{calculateTolerance as n}from"../../renderers/support/clickToleranceUtils.js";function r(n,r,i,a=new t){let o=0;if("2d"===i.type)o=r*(i.resolution??0);else if("3d"===i.type){const t=i.overlayPixelSizeInMapUnits(n),{groundSpatialReference:a}=i;o=null==a||a.equals(i.spatialReference)?r*t:e(a)/e(i.spatialReference)}const s=n.x-o,l=n.y-o,c=n.x+o,m=n.y+o,{spatialReference:p}=i;return a.xmin=Math.min(s,c),a.ymin=Math.min(l,m),a.xmax=Math.max(s,c),a.ymax=Math.max(l,m),a.spatialReference=p,a}function i(e,t,i){const o=i.toMap(e);if(null==o)return!1;return r(o,n(),i,a).intersects(t)}let a=new t;function o(){a=new t}export{o as cleanupDrapedUtils,r as createQueryGeometry,i as intersectsDrapedGeometry};
2
+ import{getMetersPerUnitForSR as e}from"../../core/units.js";import t from"../../geometry/Extent.js";import{tryProject as n}from"../../geometry/projectionUtils.js";import{getClosestDenormalizedXToReference as r}from"../../geometry/support/normalizeUtils.js";import{calculateTolerance as i}from"../../renderers/support/clickToleranceUtils.js";function o(n,r,i,o=new t){let a=0;if("2d"===i.type)a=r*(i.resolution??0);else if("3d"===i.type){const t=i.overlayPixelSizeInMapUnits(n),{groundSpatialReference:o}=i;a=null==o||o.equals(i.spatialReference)?r*t:e(o)/e(i.spatialReference)}const s=n.x-a,l=n.y-a,m=n.x+a,p=n.y+a,{spatialReference:c}=i;return o.xmin=Math.min(s,m),o.ymin=Math.min(l,p),o.xmax=Math.max(s,m),o.ymax=Math.max(l,p),o.spatialReference=c,o}function a(e,t,a){const l=a.toMap(e);if(null==l)return!1;const m=n(t.extent?.center??l,a.spatialReference)??l;l.x=r(l.x,m.x,a.spatialReference);return o(l,i(),a,s).intersects(t)}let s=new t;function l(){s=new t}export{l as cleanupDrapedUtils,o as createQueryGeometry,a as intersectsDrapedGeometry};
@@ -11,11 +11,12 @@ import type UtilityNetworkAssociationsElementInput from "./inputs/UtilityNetwork
11
11
  import type { EventedAccessor } from "../../core/Evented.js";
12
12
  import type { FieldValue } from "../../layers/support/fieldUtils.js";
13
13
  import type { TimeZone } from "../../time/types.js";
14
+ import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
14
15
  import type { AssociationsLayerUnion, AttachmentsChangeEvent, AttributeFormSupportedLayerInfo, AttributeFormSupportedLayerUnion, BatchAttributeFormMode, BatchAttributeFormState, PendingAttachmentEdits, SelectedAttachmentIdentifier, SelectedAttachmentDetails, SubmitEvent, ValueChangeEvent, ValuesChangeEvent } from "./types.js";
15
16
  import type { FormInput } from "./inputs/types.js";
16
17
  import type { EditType } from "../support/forms/types.js";
17
18
 
18
- export interface BatchAttributeFormViewModelProperties extends Partial<Pick<BatchAttributeFormViewModel, "activeFeatureIndex" | "attachmentsEnabled" | "disabled" | "editType" | "features" | "layerInfos" | "map" | "readOnly" | "selectedAttachment" | "selectedAttachmentAddElementId" | "selectedAttachmentListElementId" | "showingSelectedAttachmentReplacePage" | "submitHasBeenAttempted" | "timeZone" | "userHasChangedValues">> {}
19
+ export interface BatchAttributeFormViewModelProperties extends Partial<Pick<BatchAttributeFormViewModel, "activeFeatureIndex" | "attachmentsEnabled" | "disabled" | "editType" | "features" | "layerInfos" | "map" | "readOnly" | "selectedAttachment" | "selectedAttachmentAddElementId" | "selectedAttachmentListElementId" | "showingSelectedAttachmentReplacePage" | "submitHasBeenAttempted" | "timeZone" | "userHasChangedValues" | "view">> {}
19
20
 
20
21
  export interface BatchAttributeFormViewModelEvents {
21
22
  /**
@@ -193,6 +194,7 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
193
194
  get layers(): AttributeFormSupportedLayerUnion[];
194
195
  /**
195
196
  * A reference to the associated [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/).
197
+ * By default, this is inherited from the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
196
198
  *
197
199
  * > [!WARNING]
198
200
  * >
@@ -260,10 +262,11 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
260
262
  */
261
263
  accessor submitHasBeenAttempted: boolean;
262
264
  /**
263
- * The time zone used to interpret date values in the form. If this property is `null` or set to `"unknown"`, date values are displayed in the time zone specified by the layer's [FeatureLayer.preferredTimeZone](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#preferredTimeZone). If none is provided there, date values are interpreted in UTC.
265
+ * The time zone used to interpret date values in the form. By default, the time zone is inherited from the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#timeZone).
266
+ *
267
+ * If no time zone is inherited or the resolved value is `unknown`, date values are displayed in the time zone specified by the layer's [FeatureLayer.preferredTimeZone](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#preferredTimeZone). If none is provided there, date values are interpreted in UTC.
264
268
  *
265
269
  * @see [FeatureLayer.preferredTimeZone](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#preferredTimeZone)
266
- * @see [View2D.timeZone](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#timeZone)
267
270
  */
268
271
  accessor timeZone: TimeZone | null | undefined;
269
272
  /**
@@ -282,6 +285,12 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
282
285
  accessor userHasChangedValues: boolean;
283
286
  /** Returns true if all fields for all features in the form are valid, with no validation errors present. */
284
287
  get valid(): boolean;
288
+ /**
289
+ * A reference to the [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) associated with the form.
290
+ *
291
+ * @internal
292
+ */
293
+ accessor view: MapViewOrSceneView | null | undefined;
285
294
  /**
286
295
  * An array of inputs in the active form that are currently visible to the user.
287
296
  * This array includes only those inputs that are not hidden by visibility settings or expressions.