@arcgis/core 4.27.0-rc.2 → 4.27.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{a8565d1c676f3bfbcebb.js → 002fe1ec63ea33e6972d.js} +1 -1
- package/assets/esri/core/workers/chunks/{0610691a0c0d9fbbd6d2.js → 013de5c2955801b329b3.js} +1 -1
- package/assets/esri/core/workers/chunks/07163dcbb871f927a580.js +1 -0
- package/assets/esri/core/workers/chunks/0e46687004392c493c06.js +1 -0
- package/assets/esri/core/workers/chunks/0e65e00173b66c7fec2e.js +1 -0
- package/assets/esri/core/workers/chunks/1aa8dd317ecd3c41e0ea.js +1 -0
- package/assets/esri/core/workers/chunks/21328f3dd26abe84a10d.js +1 -0
- package/assets/esri/core/workers/chunks/28c67c98039503b62e6e.js +1 -0
- package/assets/esri/core/workers/chunks/{da57eba2fe25495ea217.js → 2faa8f08f2fdaac3f4af.js} +1 -1
- package/assets/esri/core/workers/chunks/{0407bf97ad621c89a734.js → 3160af63b860b52db389.js} +1 -1
- package/assets/esri/core/workers/chunks/3767b9e7660873b018c2.js +1 -0
- package/assets/esri/core/workers/chunks/39ae4b9b766f674bc6f2.js +1 -0
- package/assets/esri/core/workers/chunks/45629ff775e77234b227.js +1 -0
- package/assets/esri/core/workers/chunks/4a4f14a3d8da270059c4.js +1 -0
- package/assets/esri/core/workers/chunks/{3e239bfad611985e50fb.js → 50f910797c17c3028521.js} +1 -1
- package/assets/esri/core/workers/chunks/642c5a93c0a454bdd115.js +1 -0
- package/assets/esri/core/workers/chunks/{14145959a3dab1437818.js → 6627f1bc9ee6b620e3aa.js} +1 -1
- package/assets/esri/core/workers/chunks/{170bdbdb4e21bf91a17f.js → 6eaa7a51efde2dd4a5a4.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bdc63395c7466ce1641.js → 7053c2f5a958d4c8629b.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c35c663528f710e8c78.js → 79cb672c85ea29e8484a.js} +1 -1
- package/assets/esri/core/workers/chunks/82939ead43848a13f765.js +1 -0
- package/assets/esri/core/workers/chunks/89001ee8d3f69fa03cc1.js +1 -0
- package/assets/esri/core/workers/chunks/8b6b963230df56850580.js +1 -0
- package/assets/esri/core/workers/chunks/9472184ef1432fc55d6b.js +1 -0
- package/assets/esri/core/workers/chunks/a6ddf80eb324c35076e1.js +1 -0
- package/assets/esri/core/workers/chunks/a80a6267d88246ede5d3.js +1 -0
- package/assets/esri/core/workers/chunks/{f505ebd4bd3bfb6c790d.js → b6a55fdfe16795ebf02c.js} +1 -1
- package/assets/esri/core/workers/chunks/bf9e1fde9f6b2b4f10c0.js +1 -0
- package/assets/esri/core/workers/chunks/cfa3b2b1e184681e9af4.js +1 -0
- package/assets/esri/core/workers/chunks/{1f69fb9687de9ebfcf90.js → d4ba894a2583f3930a4f.js} +1 -1
- package/assets/esri/core/workers/chunks/d5dfd3d693d5e393a542.js +1 -0
- package/assets/esri/core/workers/chunks/{74fd2059ddda9083cbcc.js → dc6c97a43d642eeaf477.js} +1 -1
- package/assets/esri/core/workers/chunks/{2154d395f405be3cd3ba.js → eca0c3d57b3a1e3a14ee.js} +1 -1
- package/assets/esri/core/workers/chunks/f36697f6aac782007d1a.js +1 -0
- package/assets/esri/core/workers/chunks/f52054f27619a98b7bb7.js +1 -0
- package/assets/esri/core/workers/chunks/fb7fe307a583b6a22218.js +1 -0
- package/assets/esri/core/workers/chunks/fbd3c78ee8e2219a6c7a.js +1 -0
- package/assets/esri/core/workers/chunks/ff42585e1b1d0c5497af.js +1 -0
- package/assets/esri/images/portal/livestreamvideolayer16.png +0 -0
- package/assets/esri/images/portal/{mediaservice16.png → videolayer16.png} +0 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +19 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/geometry/support/DoubleArray.js +1 -1
- package/interfaces.d.ts +84 -0
- package/kernel.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/request.js +1 -1
- package/support/requestUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +2 -2
- package/webmap/initialViewPropertiesUtils.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflowData.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.d.ts +4 -0
- package/widgets/UtilityNetworkValidateTopology.d.ts +4 -0
- package/widgets/support/geolocationUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0fcb8d408696075338e2.js +0 -1
- package/assets/esri/core/workers/chunks/16e459b16bdd6e1a821b.js +0 -1
- package/assets/esri/core/workers/chunks/1b8074269800b384ecf6.js +0 -1
- package/assets/esri/core/workers/chunks/2b55295590b4a0503749.js +0 -1
- package/assets/esri/core/workers/chunks/3ba2fcb9110230f8790c.js +0 -1
- package/assets/esri/core/workers/chunks/5576858f56314afcb4d5.js +0 -1
- package/assets/esri/core/workers/chunks/5706edf45402dff279a6.js +0 -1
- package/assets/esri/core/workers/chunks/659b7bad7281c0e2aed3.js +0 -1
- package/assets/esri/core/workers/chunks/6cd248d065f6d1616294.js +0 -1
- package/assets/esri/core/workers/chunks/9326120c750799eb2d28.js +0 -1
- package/assets/esri/core/workers/chunks/99e0cec47e3ef72c1de4.js +0 -1
- package/assets/esri/core/workers/chunks/9c0e1e87790424f42d7e.js +0 -1
- package/assets/esri/core/workers/chunks/9e66af3b1c70cf25fb32.js +0 -1
- package/assets/esri/core/workers/chunks/a1c31bb8c12831539328.js +0 -1
- package/assets/esri/core/workers/chunks/b0cda39b53ecd6c44cd0.js +0 -1
- package/assets/esri/core/workers/chunks/c08e03165043df67c11b.js +0 -1
- package/assets/esri/core/workers/chunks/c26148d4bfab3b3dfab2.js +0 -1
- package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +0 -1
- package/assets/esri/core/workers/chunks/eeaf8010e38b65a101ac.js +0 -1
- package/assets/esri/core/workers/chunks/f235392c56063fbf89c6.js +0 -1
- package/assets/esri/core/workers/chunks/fdd0d3616c97e408b104.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{NATIVE_ARRAY_MAX_SIZE as r,isArray as n}from"../../core/typedArrayUtil.js";function t(n,t=!1){return n<=r?t?new Array(n).fill(0):new Array(n):new Float64Array(n)}function e(t){return(n(t)?t.length:t.byteLength/8)<=r?Array.from(t):new Float64Array(t)}function a(r,n,t){return Array.isArray(r)?r.slice(n,n+t):r.subarray(n,n+t)}function o(r,n){for(let t=0;t<n.length;++t)r[t]=n[t];return r}export{o as copyInto,e as doubleArrayFrom,a as doubleSubArray,t as newDoubleArray};
|
|
5
|
+
import{NATIVE_ARRAY_MAX_SIZE as r,isArray as n}from"../../core/typedArrayUtil.js";function t(n,t=!1){return n<=r?t?new Array(n).fill(0):new Array(n):new Float64Array(n)}function e(t){return(n(t)?t.length:t.byteLength/8)<=r?Array.from(t):new Float64Array(t)}function a(r,n,t){return Array.isArray(r)?r.slice(n,n+t):r.subarray(n,n+t)}function o(r,n){for(let t=0;t<n.length;++t)r[t]=n[t];return r}function y(r){return Array.isArray(r)?new Float64Array(r):r}export{o as copyInto,e as doubleArrayFrom,a as doubleSubArray,t as newDoubleArray,y as toFloat64Array};
|
package/interfaces.d.ts
CHANGED
|
@@ -110877,6 +110877,90 @@ declare namespace __esri {
|
|
|
110877
110877
|
symbol: SimpleMarkerSymbol | PictureMarkerSymbol;
|
|
110878
110878
|
}
|
|
110879
110879
|
|
|
110880
|
+
export class UtilityNetworkValidateTopology extends Widget {
|
|
110881
|
+
/**
|
|
110882
|
+
* Determines the utility network to use.
|
|
110883
|
+
*
|
|
110884
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology.html#utilityNetwork)
|
|
110885
|
+
*/
|
|
110886
|
+
utilityNetwork: UtilityNetwork;
|
|
110887
|
+
/**
|
|
110888
|
+
* The view from which the widget will operate.
|
|
110889
|
+
*
|
|
110890
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology.html#view)
|
|
110891
|
+
*/
|
|
110892
|
+
view: MapView;
|
|
110893
|
+
/**
|
|
110894
|
+
* The view model for this widget.
|
|
110895
|
+
*
|
|
110896
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology.html#viewModel)
|
|
110897
|
+
*/
|
|
110898
|
+
viewModel: UtilityNetworkValidateTopologyViewModel;
|
|
110899
|
+
/**
|
|
110900
|
+
* The `UtilityNetworkValidateTopology` widget provides the ability to validate the utility network topology against the current view extent, or the entire utility network.
|
|
110901
|
+
*
|
|
110902
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology.html)
|
|
110903
|
+
*/
|
|
110904
|
+
constructor(properties?: UtilityNetworkValidateTopologyProperties);
|
|
110905
|
+
}
|
|
110906
|
+
|
|
110907
|
+
/** @deprecated Import the UtilityNetworkValidateTopology class instead. */
|
|
110908
|
+
export type UtilityNetworkValidateTopologyConstructor = typeof UtilityNetworkValidateTopology;
|
|
110909
|
+
|
|
110910
|
+
interface UtilityNetworkValidateTopologyProperties extends WidgetProperties {
|
|
110911
|
+
/**
|
|
110912
|
+
* Determines the utility network to use.
|
|
110913
|
+
*
|
|
110914
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology.html#utilityNetwork)
|
|
110915
|
+
*/
|
|
110916
|
+
utilityNetwork?: UtilityNetworkProperties;
|
|
110917
|
+
/**
|
|
110918
|
+
* The view from which the widget will operate.
|
|
110919
|
+
*
|
|
110920
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology.html#view)
|
|
110921
|
+
*/
|
|
110922
|
+
view?: MapViewProperties;
|
|
110923
|
+
/**
|
|
110924
|
+
* The view model for this widget.
|
|
110925
|
+
*
|
|
110926
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology.html#viewModel)
|
|
110927
|
+
*/
|
|
110928
|
+
viewModel?: UtilityNetworkValidateTopologyViewModel;
|
|
110929
|
+
}
|
|
110930
|
+
|
|
110931
|
+
export class UtilityNetworkValidateTopologyViewModel {
|
|
110932
|
+
/**
|
|
110933
|
+
* The view model's state.
|
|
110934
|
+
*
|
|
110935
|
+
* @default ready
|
|
110936
|
+
*
|
|
110937
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology-UtilityNetworkValidateTopologyViewModel.html#state)
|
|
110938
|
+
*/
|
|
110939
|
+
readonly state: "disabled" | "executing" | "failed" | "loading" | "ready" | "success";
|
|
110940
|
+
/**
|
|
110941
|
+
* Determines the utility network to use.
|
|
110942
|
+
*
|
|
110943
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology-UtilityNetworkValidateTopologyViewModel.html#utilityNetwork)
|
|
110944
|
+
*/
|
|
110945
|
+
utilityNetwork: UtilityNetwork;
|
|
110946
|
+
/**
|
|
110947
|
+
* The view from which the widget will operate.
|
|
110948
|
+
*
|
|
110949
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology-UtilityNetworkValidateTopologyViewModel.html#view)
|
|
110950
|
+
*/
|
|
110951
|
+
view: MapView;
|
|
110952
|
+
constructor(properties?: any);
|
|
110953
|
+
/**
|
|
110954
|
+
* Validates the network topology of the [utility network](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology-UtilityNetworkValidateTopologyViewModel.html#utilityNetwork).
|
|
110955
|
+
*
|
|
110956
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkValidateTopology-UtilityNetworkValidateTopologyViewModel.html#validateTopology)
|
|
110957
|
+
*/
|
|
110958
|
+
validateTopology(): void;
|
|
110959
|
+
}
|
|
110960
|
+
|
|
110961
|
+
/** @deprecated Import the UtilityNetworkValidateTopologyViewModel class instead. */
|
|
110962
|
+
export type UtilityNetworkValidateTopologyViewModelConstructor = typeof UtilityNetworkValidateTopologyViewModel;
|
|
110963
|
+
|
|
110880
110964
|
export class ValuePicker extends Widget {
|
|
110881
110965
|
/**
|
|
110882
110966
|
* Returns `true` if the ValuePicker can be advanced to the next position.
|
package/kernel.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"./core/has.js";import{getInterceptor as t,addQueryParameter as e}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";const a="4.27";let s=a;s="4.27.0-rc.
|
|
5
|
+
import has from"./core/has.js";import{getInterceptor as t,addQueryParameter as e}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";const a="4.27";let s=a;s="4.27.0-rc.3";const r={async request(e,a){const{default:s}=await import("./request.js"),r=e.options,n=r.responseType;r.signal=a?.signal,r.responseType="native"===n||"native-request-init"===n?"native-request-init":n&&["blob","json","text"].includes(n)&&t(e.url)?.after?n:"array-buffer";const o=await s(e.url,r),i={data:o.data,httpStatus:o.httpStatus,ssl:o.ssl};switch(o.requestOptions?.responseType){case"native-request-init":return delete i.data.signal,i;case"blob":i.data=await i.data.arrayBuffer();break;case"json":i.data=(new TextEncoder).encode(JSON.stringify(i.data)).buffer;break;case"text":i.data=(new TextEncoder).encode(i.data).buffer}return{result:i,transferList:[i.data]}}};let n;function o(t){n=t}function i(t){const a=n?.findCredential(t);return a?.token?e(t,"token",a.token):t}has("host-webworker");export{i as addTokenParameter,s as fullVersion,n as id,o as setId,a as version,r as workerMessages};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import has from"../../../core/has.js";import s from"../../../core/Logger.js";import a from"../../../core/PooledArray.js";import{EsriPromiseMixin as r}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,initial as n,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as _}from"../../../geometry/projection.js";import{create as c,intersectsSphere as p}from"../../../geometry/support/aaBoundingRect.js";import{makeDehydratedPoint as m}from"../dehydratedFeatures.js";import{PromiseQueue as g}from"../../support/PromiseQueue.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as x}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import{NodeState as w,CacheState as v}from"../../../views/3d/layers/i3s/I3SNode.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as D}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as L,getIndexCrs as S,findIntersectingNodes as V}from"../../../views/3d/layers/i3s/I3SUtil.js";import I from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{FadeDirection as A}from"../../../views/3d/layers/support/I3SLayerView.js";import{toBoundingRect as F}from"../../../views/3d/support/extentUtils.js";import{ClientType as M,maxDownloadSlots as O}from"../../../views/3d/support/index.js";import{extractSafeScaleBounds as U,scaleBoundsPredicate as P}from"../../../views/support/layerViewUtils.js";import{noBudget as G}from"../../../views/support/Scheduler.js";const q="esri.layers.graphics.controllers.I3SOnDemandController",j=s.getLogger(q),Q=100,T=2,E=1e4,H=1e-4,R=1.2,k=500,B=1.5;let z=class extends(r(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(M.I3S_INDEX);return new D(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(M.I3S_DATA);return new D(e,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return S(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){if(null!=this._index){const e=this._index.rootNode;if(null!=e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new a({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new a,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new i,this._idleQueue=new g,this._elevationUpdateNodes=new a({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then((([i])=>{if(this.destroyed||!e||e.destroyed||!i)return;const{view:s,clientGeometry:a}=e,{resourceController:r}=s;if(this._setClippingArea(s.clippingArea),this.addHandles([o((()=>s?.pointsOfInterest?.focus?.renderLocation),(e=>this._pointOfInterestChanged(e)),n),o((()=>r.memoryController.memoryFactor),(()=>this._setCameraDirty()),l),o((()=>e.contentVisible),(e=>{const t=e?()=>this._updateIdleState(!0):()=>this._updateViewData(),i=e?()=>this._updateIdleState(!1):()=>{};e&&null!=this._index&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=r.scheduler.registerIdleStateCallbacks(t,i)}),n),f(e.view.resourceController.scheduler,this),o((()=>e.uncompressedTextureDownsamplingEnabled),(()=>this.restartNodeLoading())),o((()=>[this.featureTarget,this.fixedFeatureTarget]),(()=>{this._setCameraDirty(),this._stableFeatureLOD=!1})),o((()=>s.state?.contentCamera),(()=>this._setCameraDirty())),o((()=>t.elevationInfo),(e=>this._elevationInfoChanged(e))),o((()=>t.effectiveScaleRange),(()=>this._scaleBoundsChanged())),o((()=>e.lodFactor),(()=>this._setCameraDirty())),o((()=>e.availableFields),(()=>this._requiredFieldsChange())),o((()=>e.holeFilling),(e=>null!=this._index&&(this._index.holeFilling=e)))]),this._updateScaleHandles(),this._viewportQueries=new I(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?s.basemapTerrain:s.elevationProvider,y(s.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new x(this.layer.uid,this.crsIndex,s.renderCoordsHelper.spatialReference,this.layerView.view.resourceController.memoryController),this._index=new b(t,i,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,j,e.holeFilling,(t=>e.isNodeLoaded(t)),(t=>e.isNodeReloading(t)),(e=>this._shouldLoadNode(e)),(e=>this._enableFromGPUCache(e,w.Leaf)),(e=>this._needsUpdate(e)),(()=>!this.indexStreamController.busy),(t=>e.computeVisibilityObb?e.computeVisibilityObb(t):null),e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",(e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)})))}this._startNodeLoading()}))),this._tmpPoint=m(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll((e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)})),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,K.prune(),null!=W&&(W.hide(),W=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map((i=>{const s=$(e,i),a=$(t,i);return s>=0&&a>=0?{index:s,name:t[a].name,field:t[a],attributeStorageInfo:e[s]}:null})).filter((e=>null!=e&&e.name!==i))}_requiredFieldsChange(){const e=this._getRequiredAttributes();X(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=c();F(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateUpdating(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null==this._index||null==t)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._loadedNodeScales.delete(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}updateElevationChanged(e,t){const i=this._index;if(null==i||null==i.rootNode||null==t)return null;this.crsIndex.equals(t)||(_(e,t,Y,this.crsIndex),e=Y);const s=this._elevationUpdateNodes;return s.clear(),V(e,i.rootNode,i,(e=>s.push(e.index))),s.length&&(s.forAll((e=>i.updateElevationChanged(e))),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getRenderMbs(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this._areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),e)}_scaleBoundsChanged(){this._areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(null==i)return;null!=i.rootNode&&_(e,t,Y,this.crsIndex)&&this._loadedNodeScales.forEach(((e,t)=>{const s=i.getNode(t);null!=s&&p(Y,s.mbs)&&this._loadedNodeScales.set(t,this._computeScale(s))}))}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get _areScaleBoundsActive(){const{minScale:e,maxScale:t}=U(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateUpdating(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?j.error("Error during processing: "+i):50===this._errorCount&&j.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run((()=>this._processIndex(e))),this._updateFeatureLOD(),e.run((()=>this._processCache(e))),this._isIntegratedMesh&&(e.enabled=!0),e.run((()=>this._processNodes(e,t))),this._idleQueue.runTask(e),e.run((()=>this._prefetchIndex())),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run((()=>this._lodHandling.lodGlobalHandling(e))),this._evaluateUpdating())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,(e=>this.updateNodeModificationStatus(e))),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>k){if(this._featureLOD<=H)return;this._featureLOD/=B,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=E||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,a=this._index.checkFeatureTarget(t,s);a!==s&&(this._featureLOD=a/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=H)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(E,Math.max(H,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&(!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s));s=t.getParent(s.index))if(this._enableFromGPUCache(s,w.Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?Q:T)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const a=this._index.getNode(s.add.back());if(null==a||a.cacheState!==v.Cached&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(a),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach((e=>e.abort())),this._loadingNodes.clear(),this._updatingNodes.forEach((e=>e.abort())),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=T)&&(this._downloadingCount<O&&!this.dataStreamController.busy)}_evaluateUpdating(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(null!=this._index?this._index.indexMissing:0)+3*(null!=this._index?this._index.updates.add.length:0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.updating=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return null!=this._index&&this._index.isGeometryVisible(e.index)}updateVisibility(e){null!=this._index&&this._index.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){null!=this._index&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){null!=this._index&&this._index.invalidateVisibilityObbs()}modificationsChanged(){null!=this._index&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&(!(null==this._index||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataStreamController,j,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e=>this._isNodeInScaleBounds(e)),((e,t)=>this._removeNodes(e,t,Z.fadeout)),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;K.clear(),this.layerView.getLoadedNodeIndices(K);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return K.filterInPlace((e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)||!this._isNodeInScaleBounds(i)})),K.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(K,e,Z.pop),!(i&&this._lodDropFactor<1)&&(0===K.length||(K.clear(),!1))}markNodeToRemove(e){K.push(e)}removeMarkedNodes(){this._removeNodes(K,G,Z.pop)}_removeNodes(e,t,i){const s=e.length;if(0!==s&&!t.done){for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),a=this._index;i===Z.fadeout&&this.layerView.nodeFadeoutEnabled&&null!=a&&a.isGeometryVisible(s)?this.layerView.fadeNode(s,A.FadeOut,!0):this.layerView.removeNode(s),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;t<s;t++){const i=e.data[t];this._loadedNodeScales.delete(i)}}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateUpdating();try{const i=X(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes);let s=null;s=i?await Promise.resolve(this.layerView.getAttributeData(e.index)):await this._loadAttributes(e,this._requiredAttributes,t.signal),await this.schedule((()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal)),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void j.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then((i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())})).catch((e=>{if(!d(e))throw e})).finally((()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()}))}_loadAndAddNode(e,t){return e.cacheState===v.Uncached?this._loadUncached(e,t).then((()=>!1)):this._loadCached(e,t).then((t=>!t&&(e.cacheState=v.Uncached,!0))).catch((t=>!d(t)&&(e.cacheState=v.Uncached,!0)))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(t===w.Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t&&null!=t.attributeInfo&&X(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,w.Leaf))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),a=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),r=e.index>=0?s:a,d=await this.schedule((()=>i.loadCachedNodeData(e,t,r)),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule((()=>this._loadAttributes(e,o,t)),t);return await this.reschedule((()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t)),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch((e=>{throw this._downloadingCount--,e})).then((i=>(this._downloadingCount--,this.schedule((()=>this.layerView.addNode(e,i,t)),t)))).then((()=>{this._nodeAdded(),e.cacheState=v.Cached})).catch((t=>{if(!d(t))throw j.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,null!=this._index&&this._index.requestUpdate(),t}))}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this._areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:s}=U(this.layer);return P(t,i,s)}updateStats(e){e.index=null!=this._index?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this._baseLOD),null!=this._index&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){null!=e._index&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],z.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],z.prototype,"isGraphics3D",null),e([h({readOnly:!0})],z.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],z.prototype,"indexStreamController",null),e([h({readOnly:!0})],z.prototype,"dataStreamController",null),e([h({readOnly:!0})],z.prototype,"crsVertex",null),e([h({readOnly:!0})],z.prototype,"crsIndex",null),e([h()],z.prototype,"screenSizeFactor",void 0),e([h()],z.prototype,"featureTarget",void 0),e([h()],z.prototype,"fixedFeatureTarget",void 0),e([h()],z.prototype,"layerView",void 0),e([h()],z.prototype,"layer",null),e([h()],z.prototype,"updating",void 0),e([h({readOnly:!0})],z.prototype,"running",null),e([h()],z.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],z.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],z.prototype,"scaleVisibilityEnabled",void 0),e([h({readOnly:!0,dependsOn:[]})],z.prototype,"rootNodeVisible",null),z=e([u(q)],z);const K=new a({deallocator:null});let W;function X(e,t){return null!=e&&e.length===t.length&&e.every((e=>$(t,e.name)>=0))}function $(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const J={factorIM:.2,factor3dObject:.05,distancePenalty:10},Y=c();var Z;!function(e){e[e.pop=0]="pop",e[e.fadeout=1]="fadeout"}(Z||(Z={}));const ee=z;export{ee as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import has from"../../../core/has.js";import s from"../../../core/Logger.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,initial as n,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as _}from"../../../geometry/projection.js";import{create as c,intersectsSphere as p}from"../../../geometry/support/aaBoundingRect.js";import{makeDehydratedPoint as m}from"../dehydratedFeatures.js";import{PromiseQueue as g}from"../../support/PromiseQueue.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as x}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import{NodeState as w,CacheState as v}from"../../../views/3d/layers/i3s/I3SNode.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as D}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as L,getIndexCrs as S,findIntersectingNodes as V}from"../../../views/3d/layers/i3s/I3SUtil.js";import I from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{FadeDirection as A}from"../../../views/3d/layers/support/I3SLayerView.js";import{toBoundingRect as F}from"../../../views/3d/support/extentUtils.js";import{ClientType as O,maxDownloadSlots as M}from"../../../views/3d/support/index.js";import{extractSafeScaleBounds as U,scaleBoundsPredicate as P}from"../../../views/support/layerViewUtils.js";import{noBudget as G}from"../../../views/support/Scheduler.js";const q="esri.layers.graphics.controllers.I3SOnDemandController",j=s.getLogger(q),Q=100,T=2,E=1e4,H=1e-4,k=1.2,R=500,B=1.5;let z=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(O.I3S_INDEX);return new D(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(O.I3S_DATA);return new D(e,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return S(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){if(null!=this._index){const e=this._index.rootNode;if(null!=e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new r({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new i,this._idleQueue=new g,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then((([i])=>{if(this.destroyed||!e||e.destroyed||!i)return;const{view:s,clientGeometry:r}=e,{resourceController:a}=s;if(this._setClippingArea(s.clippingArea),this.addHandles([o((()=>s?.pointsOfInterest?.focus?.renderLocation),(e=>this._pointOfInterestChanged(e)),n),o((()=>a.memoryController.memoryFactor),(()=>this._setCameraDirty()),l),o((()=>e.contentVisible),(e=>{const t=e?()=>this._updateIdleState(!0):()=>this._updateViewData(),i=e?()=>this._updateIdleState(!1):()=>{};e&&null!=this._index&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=a.scheduler.registerIdleStateCallbacks(t,i)}),n),f(e.view.resourceController.scheduler,this),o((()=>e.uncompressedTextureDownsamplingEnabled),(()=>this.restartNodeLoading())),o((()=>[this.featureTarget,this.fixedFeatureTarget]),(()=>{this._setCameraDirty(),this._stableFeatureLOD=!1})),o((()=>s.state?.contentCamera),(()=>this._setCameraDirty())),o((()=>t.elevationInfo),(e=>this._elevationInfoChanged(e))),o((()=>t.effectiveScaleRange),(()=>this._scaleBoundsChanged())),o((()=>e.lodFactor),(()=>this._setCameraDirty())),o((()=>e.availableFields),(()=>this._requiredFieldsChange())),o((()=>e.holeFilling),(e=>null!=this._index&&(this._index.holeFilling=e)))]),this._updateScaleHandles(),this._viewportQueries=new I(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?s.basemapTerrain:s.elevationProvider,y(s.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new x(this.layer.uid,this.crsIndex,s.renderCoordsHelper.spatialReference,this.layerView.view.resourceController.memoryController,this.worker),this._index=new b(t,i,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,j,e.holeFilling,(t=>e.isNodeLoaded(t)),(t=>e.isNodeReloading(t)),(e=>this._shouldLoadNode(e)),(e=>this._enableFromGPUCache(e,w.Leaf)),(e=>this._needsUpdate(e)),(()=>!this.indexStreamController.busy),(t=>e.computeVisibilityObb?e.computeVisibilityObb(t):null),e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),null!=r){for(const e of r)this._addMesh(e.mesh,e.oid);this.addHandles(r.on("change",(e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)})))}this._startNodeLoading()}))),this._tmpPoint=m(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll((e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)})),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,K.prune(),null!=W&&(W.hide(),W=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map((i=>{const s=$(e,i),r=$(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null})).filter((e=>null!=e&&e.name!==i))}_requiredFieldsChange(){const e=this._getRequiredAttributes();X(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=c();F(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateUpdating(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null==this._index||null==t)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._loadedNodeScales.delete(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}updateElevationChanged(e,t){const i=this._index;if(null==i||null==i.rootNode||null==t)return null;this.crsIndex.equals(t)||(_(e,t,Y,this.crsIndex),e=Y);const s=this._elevationUpdateNodes;return s.clear(),V(e,i.rootNode,i,(e=>s.push(e.index))),s.length&&(s.forAll((e=>i.updateElevationChanged(e))),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getRenderMbs(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this._areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),e)}_scaleBoundsChanged(){this._areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(null==i)return;null!=i.rootNode&&_(e,t,Y,this.crsIndex)&&this._loadedNodeScales.forEach(((e,t)=>{const s=i.getNode(t);null!=s&&p(Y,s.mbs)&&this._loadedNodeScales.set(t,this._computeScale(s))}))}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get _areScaleBoundsActive(){const{minScale:e,maxScale:t}=U(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateUpdating(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?j.error("Error during processing: "+i):50===this._errorCount&&j.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run((()=>this._processIndex(e))),this._updateFeatureLOD(),e.run((()=>this._processCache(e))),this._isIntegratedMesh&&(e.enabled=!0),e.run((()=>this._processNodes(e,t))),this._idleQueue.runTask(e),e.run((()=>this._prefetchIndex())),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run((()=>this._lodHandling.lodGlobalHandling(e))),this._evaluateUpdating())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,(e=>this.updateNodeModificationStatus(e))),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>R){if(this._featureLOD<=H)return;this._featureLOD/=B,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=E||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*k||e&&i.estimate>t))return;if(this._featureLOD<=H)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(E,Math.max(H,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&(!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s));s=t.getParent(s.index))if(this._enableFromGPUCache(s,w.Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?Q:T)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||r.cacheState!==v.Cached&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach((e=>e.abort())),this._loadingNodes.clear(),this._updatingNodes.forEach((e=>e.abort())),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=T)&&(this._downloadingCount<M&&!this.dataStreamController.busy)}_evaluateUpdating(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(null!=this._index?this._index.indexMissing:0)+3*(null!=this._index?this._index.updates.add.length:0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.updating=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return null!=this._index&&this._index.isGeometryVisible(e.index)}updateVisibility(e){null!=this._index&&this._index.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){null!=this._index&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){null!=this._index&&this._index.invalidateVisibilityObbs()}modificationsChanged(){null!=this._index&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&(!(null==this._index||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataStreamController,j,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e=>this._isNodeInScaleBounds(e)),((e,t)=>this._removeNodes(e,t,Z.fadeout)),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;K.clear(),this.layerView.getLoadedNodeIndices(K);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return K.filterInPlace((e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)||!this._isNodeInScaleBounds(i)})),K.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(K,e,Z.pop),!(i&&this._lodDropFactor<1)&&(0===K.length||(K.clear(),!1))}markNodeToRemove(e){K.push(e)}removeMarkedNodes(){this._removeNodes(K,G,Z.pop)}_removeNodes(e,t,i){const s=e.length;if(0!==s&&!t.done){for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;i===Z.fadeout&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,A.FadeOut,!0):this.layerView.removeNode(s),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;t<s;t++){const i=e.data[t];this._loadedNodeScales.delete(i)}}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateUpdating();try{const i=X(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes);let s=null;s=i?await Promise.resolve(this.layerView.getAttributeData(e.index)):await this._loadAttributes(e,this._requiredAttributes,t.signal),await this.schedule((()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal)),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void j.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then((i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())})).catch((e=>{if(!d(e))throw e})).finally((()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()}))}_loadAndAddNode(e,t){return e.cacheState===v.Uncached?this._loadUncached(e,t).then((()=>!1)):this._loadCached(e,t).then((t=>!t&&(e.cacheState=v.Uncached,!0))).catch((t=>!d(t)&&(e.cacheState=v.Uncached,!0)))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(t===w.Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t&&null!=t.attributeInfo&&X(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,w.Leaf))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule((()=>i.loadCachedNodeData(e,t,a)),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule((()=>this._loadAttributes(e,o,t)),t);return await this.reschedule((()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t)),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch((e=>{throw this._downloadingCount--,e})).then((i=>(this._downloadingCount--,this.schedule((()=>this.layerView.addNode(e,i,t)),t)))).then((()=>{this._nodeAdded(),e.cacheState=v.Cached})).catch((t=>{if(!d(t))throw j.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,null!=this._index&&this._index.requestUpdate(),t}))}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this._areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:s}=U(this.layer);return P(t,i,s)}updateStats(e){e.index=null!=this._index?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this._baseLOD),null!=this._index&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){null!=e._index&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],z.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],z.prototype,"isGraphics3D",null),e([h({readOnly:!0})],z.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],z.prototype,"indexStreamController",null),e([h({readOnly:!0})],z.prototype,"dataStreamController",null),e([h({readOnly:!0})],z.prototype,"crsVertex",null),e([h({readOnly:!0})],z.prototype,"crsIndex",null),e([h()],z.prototype,"screenSizeFactor",void 0),e([h()],z.prototype,"featureTarget",void 0),e([h()],z.prototype,"fixedFeatureTarget",void 0),e([h()],z.prototype,"layerView",void 0),e([h()],z.prototype,"layer",null),e([h()],z.prototype,"updating",void 0),e([h({readOnly:!0})],z.prototype,"running",null),e([h()],z.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],z.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],z.prototype,"scaleVisibilityEnabled",void 0),e([h({constructOnly:!0})],z.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],z.prototype,"rootNodeVisible",null),z=e([u(q)],z);const K=new r({deallocator:null});let W;function X(e,t){return null!=e&&e.length===t.length&&e.every((e=>$(t,e.name)>=0))}function $(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const J={factorIM:.2,factor3dObject:.05,distancePenalty:10},Y=c();var Z;!function(e){e[e.pop=0]="pop",e[e.fadeout=1]="fadeout"}(Z||(Z={}));const ee=z;export{ee as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getMimeTypeFormatId as o,getFilenameFormatId as
|
|
5
|
+
import{getMimeTypeFormatId as o,getFilenameFormatId as t}from"./infoFor3D.js";import{getEffectiveLayerCapabilities as n,getEffectiveEditingEnabled as r}from"./layerUtils.js";function e(o){return!(!(o&&"object"==typeof o&&"loaded"in o&&o.loaded&&n(o)?.operations?.supportsEditing&&"type"in o)||"editingEnabled"in o&&!r(o)||"scene"===o.type&&!i(o))}function i(n){const r=n.infoFor3D;if(!r)return!0;const{supportedFormats:e,queryFormats:i}=r,s=o("model/gltf-binary",e)??t("glb",e);return null!=s&&i.includes(s)}export{e as isEditableLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return u(e)||i(e)}function r(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function i(e){return"scene"===e?.type}function u(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function s(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function a(e){return null!=e&&"type"in e&&"group"===e.type}const c={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function o(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function l(e){return"voxel"===e?.type}function f(e){return"imagery-tile"===e?.type}function y(e){return null!=e&&null!=e.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function p(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function g(e){return("feature"===e?.type||"subtype-group"===e?.type)&&"feature-layer"===e.source?.type}function d(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function b(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function m(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function v(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function h(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.substring(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:c}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return c?.owningSystemUrl||null}function w(e){if(!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function j(e){return!!e&&"isTable"in e&&!!e.isTable}function E(e){return w(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function L(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function S(e){return!!L(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{S as getEffectiveEditingEnabled,E as getEffectiveLayerCapabilities,h as getOwningPortalUrl,v as getTileMaxtrixSetFromActiveLayer,y as isBaseLayer,n as isBasemap3DSupportedLayer,u as isBasemapSupportedTiledLayer,p as isFeatureCollectionLayer,r as isFeatureLayer,d as isFeatureServiceLayer,a as isGroupLayer,f as isImageryTileLayer,g as isLayerWithFeatureLayerSource,
|
|
5
|
+
import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return u(e)||i(e)}function r(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function i(e){return"scene"===e?.type}function u(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function s(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function a(e){return null!=e&&"type"in e&&"group"===e.type}const c={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function o(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function l(e){return"voxel"===e?.type}function f(e){return"imagery-tile"===e?.type}function y(e){return null!=e&&null!=e.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function p(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function g(e){return("feature"===e?.type||"subtype-group"===e?.type)&&"feature-layer"===e.source?.type}function d(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function b(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function m(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function v(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function h(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.substring(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:c}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return c?.owningSystemUrl||null}function w(e){if(!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function j(e){return!!e&&"isTable"in e&&!!e.isTable}function E(e){return w(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function L(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function S(e){return!!L(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{S as getEffectiveEditingEnabled,E as getEffectiveLayerCapabilities,h as getOwningPortalUrl,v as getTileMaxtrixSetFromActiveLayer,y as isBaseLayer,n as isBasemap3DSupportedLayer,u as isBasemapSupportedTiledLayer,p as isFeatureCollectionLayer,r as isFeatureLayer,d as isFeatureServiceLayer,a as isGroupLayer,f as isImageryTileLayer,g as isLayerWithFeatureLayerSource,i as isSceneLayer,o as isSceneServiceLayer,j as isTable,s as isTiledLayer,l as isVoxelLayer,c as sceneServiceLayerTypeToClassName,b as serializeLayerDefinitions,m as serializeTimeOptions};
|
package/package.json
CHANGED
package/portal/PortalItem.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{id as i}from"../kernel.js";import r from"../core/Error.js";import{JSONSupportMixin as o}from"../core/JSONSupport.js";import{clone as s,fixJson as a}from"../core/lang.js";import n from"../core/Loadable.js";import{unwrapOrThrow as l}from"../core/maybe.js";import{isDataProtocol as p,makeAbsolute as c}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import g from"../geometry/Extent.js";import y from"./Portal.js";import w from"./PortalItemResource.js";import v from"./PortalRating.js";var f;const b=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),k=new Set(["KML","GeoJson","CSV"]);let S=f=class extends(o(n)){static from(e){return u(f,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e&&(i="Insights Report"),i}readExtent(e){return e&&e.length?new g(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?"mediaservice":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"360 vr experience"===e?"360vr":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"data pipeline"===e?"datapipelines":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&b.has(this.type)}get itemCdnUrl(){let e=this.itemUrl;return e&&i&&!i.findCredential(e)&&(e=i._normalizeAGOLorgDomain(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("portal.user.username");if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=y.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof v&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new v({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:s(this.applicationProxies),avgRating:this.avgRating,categories:s(this.categories),created:s(this.created),culture:this.culture,description:this.description,extent:s(this.extent),groupCategories:s(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:s(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:s(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new f({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await l(this.portal).request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return l(this.portal).request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await l(this.portal).request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new v(t)):null}fetchRelatedItems(e,t){return l(this.portal).requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},f)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return l(this.portal).request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>l(this.portal).signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new r("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:i}=this;await l(t).signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},p={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:c}=await t.request(`${i}/copy`,p);return new f({id:c,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)p(t)?r.query={data:t}:r.query={url:c(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResource:r}=await import("./support/resourceUtils.js");return e.portalItem=this,r(e,"add",t,i)}async removeResource(e,t){const{removeResource:i}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new r("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new w({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:s(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};return a(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new f({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([d({type:["private","shared","org","public"]})],S.prototype,"access",void 0),e([d()],S.prototype,"accessInformation",void 0),e([d({type:String})],S.prototype,"apiKey",void 0),e([d({json:{read:{source:"appProxies"}}})],S.prototype,"applicationProxies",void 0),e([d()],S.prototype,"avgRating",void 0),e([d()],S.prototype,"categories",void 0),e([d({type:Date})],S.prototype,"created",void 0),e([d()],S.prototype,"culture",void 0),e([d()],S.prototype,"description",void 0),e([d({readOnly:!0})],S.prototype,"displayName",null),e([d({type:g})],S.prototype,"extent",void 0),e([m("extent")],S.prototype,"readExtent",null),e([d()],S.prototype,"groupCategories",void 0),e([d({readOnly:!0})],S.prototype,"iconUrl",null),e([d()],S.prototype,"id",void 0),e([d({readOnly:!0})],S.prototype,"isLayer",null),e([d({type:Boolean,readOnly:!0})],S.prototype,"isOrgItem",void 0),e([d()],S.prototype,"itemControl",void 0),e([d({readOnly:!0})],S.prototype,"itemPageUrl",null),e([d({readOnly:!0})],S.prototype,"itemUrl",null),e([d()],S.prototype,"licenseInfo",void 0),e([d({type:Date})],S.prototype,"modified",void 0),e([d()],S.prototype,"name",void 0),e([d()],S.prototype,"numComments",void 0),e([d()],S.prototype,"numRatings",void 0),e([d()],S.prototype,"numViews",void 0),e([d()],S.prototype,"owner",void 0),e([d()],S.prototype,"ownerFolder",void 0),e([d({type:y})],S.prototype,"portal",void 0),e([d()],S.prototype,"screenshots",void 0),e([d()],S.prototype,"size",void 0),e([d()],S.prototype,"snippet",void 0),e([d()],S.prototype,"sourceJSON",void 0),e([d({type:String})],S.prototype,"sourceUrl",void 0),e([d({type:String})],S.prototype,"spatialReference",void 0),e([d()],S.prototype,"tags",void 0),e([d()],S.prototype,"thumbnail",void 0),e([d({readOnly:!0})],S.prototype,"thumbnailUrl",null),e([d()],S.prototype,"title",void 0),e([d()],S.prototype,"type",void 0),e([d()],S.prototype,"typeKeywords",void 0),e([d({type:String,json:{read(e,t){if(k.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],S.prototype,"url",void 0),e([d({readOnly:!0})],S.prototype,"userItemUrl",null),S=f=e([h("esri.portal.PortalItem")],S);const x=S;export{x as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{id as i}from"../kernel.js";import r from"../core/Error.js";import{JSONSupportMixin as o}from"../core/JSONSupport.js";import{clone as s,fixJson as a}from"../core/lang.js";import n from"../core/Loadable.js";import{unwrapOrThrow as l}from"../core/maybe.js";import{isDataProtocol as p,makeAbsolute as c}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import g from"../geometry/Extent.js";import y from"./Portal.js";import v from"./PortalItemResource.js";import w from"./PortalRating.js";var f;const b=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),k=new Set(["KML","GeoJson","CSV"]);let S=f=class extends(o(n)){static from(e){return u(f,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e&&(i="Insights Report"),i}readExtent(e){return e&&e.length?new g(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"360 vr experience"===e?"360vr":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"data pipeline"===e?"datapipelines":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&b.has(this.type)}get itemCdnUrl(){let e=this.itemUrl;return e&&i&&!i.findCredential(e)&&(e=i._normalizeAGOLorgDomain(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("portal.user.username");if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=y.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof w&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new w({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:s(this.applicationProxies),avgRating:this.avgRating,categories:s(this.categories),created:s(this.created),culture:this.culture,description:this.description,extent:s(this.extent),groupCategories:s(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:s(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:s(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new f({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await l(this.portal).request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return l(this.portal).request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await l(this.portal).request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new w(t)):null}fetchRelatedItems(e,t){return l(this.portal).requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},f)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return l(this.portal).request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>l(this.portal).signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new r("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:i}=this;await l(t).signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},p={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:c}=await t.request(`${i}/copy`,p);return new f({id:c,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)p(t)?r.query={data:t}:r.query={url:c(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResource:r}=await import("./support/resourceUtils.js");return e.portalItem=this,r(e,"add",t,i)}async removeResource(e,t){const{removeResource:i}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new r("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new v({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:s(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};return a(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new f({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([d({type:["private","shared","org","public"]})],S.prototype,"access",void 0),e([d()],S.prototype,"accessInformation",void 0),e([d({type:String})],S.prototype,"apiKey",void 0),e([d({json:{read:{source:"appProxies"}}})],S.prototype,"applicationProxies",void 0),e([d()],S.prototype,"avgRating",void 0),e([d()],S.prototype,"categories",void 0),e([d({type:Date})],S.prototype,"created",void 0),e([d()],S.prototype,"culture",void 0),e([d()],S.prototype,"description",void 0),e([d({readOnly:!0})],S.prototype,"displayName",null),e([d({type:g})],S.prototype,"extent",void 0),e([m("extent")],S.prototype,"readExtent",null),e([d()],S.prototype,"groupCategories",void 0),e([d({readOnly:!0})],S.prototype,"iconUrl",null),e([d()],S.prototype,"id",void 0),e([d({readOnly:!0})],S.prototype,"isLayer",null),e([d({type:Boolean,readOnly:!0})],S.prototype,"isOrgItem",void 0),e([d()],S.prototype,"itemControl",void 0),e([d({readOnly:!0})],S.prototype,"itemPageUrl",null),e([d({readOnly:!0})],S.prototype,"itemUrl",null),e([d()],S.prototype,"licenseInfo",void 0),e([d({type:Date})],S.prototype,"modified",void 0),e([d()],S.prototype,"name",void 0),e([d()],S.prototype,"numComments",void 0),e([d()],S.prototype,"numRatings",void 0),e([d()],S.prototype,"numViews",void 0),e([d()],S.prototype,"owner",void 0),e([d()],S.prototype,"ownerFolder",void 0),e([d({type:y})],S.prototype,"portal",void 0),e([d()],S.prototype,"screenshots",void 0),e([d()],S.prototype,"size",void 0),e([d()],S.prototype,"snippet",void 0),e([d()],S.prototype,"sourceJSON",void 0),e([d({type:String})],S.prototype,"sourceUrl",void 0),e([d({type:String})],S.prototype,"spatialReference",void 0),e([d()],S.prototype,"tags",void 0),e([d()],S.prototype,"thumbnail",void 0),e([d({readOnly:!0})],S.prototype,"thumbnailUrl",null),e([d()],S.prototype,"title",void 0),e([d()],S.prototype,"type",void 0),e([d()],S.prototype,"typeKeywords",void 0),e([d({type:String,json:{read(e,t){if(k.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],S.prototype,"url",void 0),e([d({readOnly:!0})],S.prototype,"userItemUrl",null),S=f=e([h("esri.portal.PortalItem")],S);const x=S;export{x as default};
|
package/request.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{onAbort as o,isAbortError as a,createAbortError as n,isAborted as i}from"./core/promiseUtils.js";import{queryToObject as l,isDataProtocol as u,isBlobProtocol as c,normalize as d,getInterceptor as p,isTrustedServer as h,getOrigin as m,toHTTPS as f,addQueryParameter as y,objectToQuery as w,getProxyRule as g,getProxyUrl as b,addQueryParameters as q,hasSameOrigin as T,getAppUrl as k,addProxyRule as S}from"./core/urlUtils.js";import{isSecureProxyService as O}from"./portal/support/urlUtils.js";import{supportsApiKey as C}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as v,isNoCorsRequestRequired as x,sendNoCorsRequest as E,loadImageAsync as L}from"./support/requestUtils.js";async function U(e,t){e instanceof URL&&(e=e.toString()),t?.query instanceof URLSearchParams&&(t.query=l(t.query.toString().replaceAll("+"," ")));const r=u(e),s=c(e);s||r||(e=d(e));const a={url:e,requestOptions:{...t}};let n=p(e);if(n){const e=await G(n,a);if(null!=e)return{data:e,getHeader:I,httpStatus:200,requestOptions:a.requestOptions,url:a.url};n.after||n.error||(n=null)}if(e=a.url,"image"===(t=a.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw N("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),a);if("head"===t.method){if(t.body)throw N("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),a);if(r||s)throw N("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),a)}if(await B(),j)return j.execute(e,t);const i=new AbortController;o(t,(()=>i.abort()));const h={controller:i,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:n,params:a,redoRequest:!1,useIdentity:P.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},m=await Q(h);return n?.after?.(m),m}let j;const P=e.request,D="FormData"in globalThis,_=[499,498,403,401],A=["COM_0056","COM_0057","SB_0008"],F=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],I=()=>null,R=Symbol();function M(e){const t=m(e);t&&!U._corsServers.includes(t)&&U._corsServers.push(t)}function H(e){const t=m(e);return!t||t.endsWith(".arcgis.com")||U._corsServers.includes(t)||h(t)}function N(e,t,o,i){let l="Error";const u={url:o.url,requestOptions:o.requestOptions,getHeader:I,ssl:!1};if(t instanceof r)return t.details?(t.details=s(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=u,t;if(t){const e=i&&(e=>i.headers.get(e)),r=i?.status,s=t.message;s&&(l=s),e&&(u.getHeader=e),u.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,u.subCode=t.subcode,u.messageCode=t.messageCode,"string"==typeof t.details?u.messages=[t.details]:u.messages=t.details,u.raw=R in t?t[R]:t}return a(t)?n():new r(e,l,u)}async function B(){has("host-webworker")?j||(j=await import("./core/workers/request.js")):U._abortableFetch||(U._abortableFetch=globalThis.fetch.bind(globalThis))}async function $(){t||await import("./identity/IdentityManager.js")}async function z(r){const s=r.params.url,o=r.params.requestOptions,a=r.controller.signal,n=o.body;let l=null,u=null;if(D&&"HTMLFormElement"in globalThis&&(n instanceof FormData?l=n:n instanceof HTMLFormElement&&(l=new FormData(n))),"string"==typeof n&&(u=n),r.fetchOptions={cache:o.cacheBust&&!("polyfill"in U._abortableFetch)?"no-cache":"default",credentials:"same-origin",headers:o.headers||{},method:"head"===o.method?"HEAD":"GET",mode:"cors",priority:P.priority,redirect:"follow",signal:a},(l||u)&&(r.fetchOptions.body=l||u),"anonymous"===o.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(s)||o.query?.token||l?.get("token")),!r.hasToken&&e.apiKey&&C(s)&&(o.query||(o.query={}),o.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!K(s)&&!i(a)){let e;"immediate"===o.authMode?(await $(),e=await t.getCredential(s,{signal:a}),r.credential=e):"no-prompt"===o.authMode?(await $(),e=await t.getCredential(s,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(s)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function K(e){return F.some((t=>t.test(e)))}async function W(e){let r=e.params.url;const s=e.params.requestOptions,o=e.fetchOptions??{},a=c(r)||u(r),i=s.responseType||"json",l=a?0:null!=s.timeout?s.timeout:P.timeout;let d=!1;if(!a){e.useSSL&&(r=f(r)),s.cacheBust&&"default"===o.cache&&(r=y(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let n=w(a);has("esri-url-encodes-apostrophe")&&(n=n.replaceAll("'","%27"));const i=r.length+1+n.length;let l;d="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||i>P.maxUrlLength;const u=s.useProxy||!!g(r);if(u){const e=b(r);l=e.path,!d&&l.length+1+i>P.maxUrlLength&&(d=!0),e.query&&(a={...e.query,...a})}if("HEAD"===o.method&&(d||u)){if(d){if(i>P.maxUrlLength)throw N("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw N("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(u)throw N("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(o.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=q(r,a):(o.body=w(a),o.headers||(o.headers={}),o.headers["Content-Type"]="application/x-www-form-urlencoded")):r=q(r,a),u&&(e.useProxy=!0,r=`${l}?${r}`),a.token&&D&&o.body instanceof FormData&&!O(r)&&o.body.set("token",a.token),s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!T(r,k()))if(h(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s?.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(o.credentials="include",x(r)&&await E(d?q(r,a):r))}let p,C,v=0,L=!1;l>0&&(v=setTimeout((()=>{L=!0,e.controller.abort()}),l));try{if("native-request-init"===s.responseType)C=o,C.url=r;else if("image"!==s.responseType||"default"!==o.cache||"GET"!==o.method||d||J(s.headers)||!a&&!e.useProxy&&P.proxyUrl&&!H(r)){if(p=await U._abortableFetch(r,o),e.useProxy||M(r),"native"===s.responseType)C=p;else if("HEAD"!==o.method)if(p.ok){switch(i){case"array-buffer":C=await p.arrayBuffer();break;case"blob":case"image":C=await p.blob();break;default:C=await p.text()}if(v&&(clearTimeout(v),v=0),"json"===i||"xml"===i||"document"===i)if(C)switch(i){case"json":C=JSON.parse(C);break;case"xml":C=X(C,"application/xml");break;case"document":C=X(C,"text/html")}else C=null;if(C){if("array-buffer"===i||"blob"===i){const e=p.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&C["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(C).json();e.error&&(C=e)}catch{}}"image"===i&&C instanceof Blob&&(C=await Y(URL.createObjectURL(C),e,!0))}}else{C=await p.text();try{C=JSON.parse(C)}catch{}}}else C=await Y(r,e)}catch(j){if("AbortError"===j.name){if(L)throw new Error("Timeout exceeded");throw n("Request canceled")}if(!(!p&&j instanceof TypeError&&P.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||H(r))throw j;e.redoRequest=!0,S({proxyUrl:P.proxyUrl,urlPrefix:m(r)??""})}finally{v&&clearTimeout(v)}return[p,C]}async function G(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,a;try{a=await e.before(t)}catch(s){o=N("request:interceptor",s,t)}if((a instanceof Error||a instanceof r)&&(o=N("request:interceptor",a,t)),o)throw e.error&&e.error(o),o;return a}}function J(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function X(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function Q(e){let r,s;await z(e);try{do{[r,s]=await W(e)}while(!await V(e,r,s))}catch(n){const t=N("request:server",n,e.params,r);throw t.details.ssl=e.useSSL,e.interceptor?.error&&e.interceptor.error(t),t}const o=e.params.url;if(s&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!h(o)){const e=m(o,!0);e&&P.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&v(s.authorizedCrossOriginNoCorsDomains)}const a=e.credential;if(a&&t){const e=t.findServerInfo(a.server);let r=e?.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,a.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:s,getHeader:r?e=>r?.headers.get(e):I,httpStatus:r?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function V(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let a,n;if(s&&(s.error?a=s.error:"error"===s.status&&Array.isArray(s.messages)&&(a={...s},a[R]=s,a.details=s.messages)),!a&&!r.ok)throw a=new Error(`Unable to load ${r.url} status: ${r.status}`),a[R]=s,a;let i,l=null;a&&(n=Number(a.code),l=a.hasOwnProperty("subcode")?Number(a.subcode):null,i=a.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===n&&(4===l||a.message?.toLowerCase().includes("ssl")&&!a.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===n)&&void 0!==n&&_.includes(n)&&!K(e.params.url)&&(403!==n||i&&!A.includes(i)&&(null==l||2===l&&e.credentialToken))){await $();try{const r=await t.getCredential(e.params.url,{error:N("request:server",a,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;a=c}}if(a)throw a;return!0}function Y(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=P.priority,o.src=e,L(o,e,r,s)}U._abortableFetch=null,U._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{U as default};
|
|
5
|
+
import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{onAbort as o,isAbortError as a,createAbortError as n,isAborted as i}from"./core/promiseUtils.js";import{queryToObject as l,isDataProtocol as u,isBlobProtocol as c,normalize as d,getInterceptor as p,isTrustedServer as h,getOrigin as m,toHTTPS as f,addQueryParameter as y,objectToQuery as w,getProxyRule as g,getProxyUrl as b,addQueryParameters as q,hasSameOrigin as T,getAppUrl as k,addProxyRule as S}from"./core/urlUtils.js";import{isSecureProxyService as O}from"./portal/support/urlUtils.js";import{supportsApiKey as C}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as v,isNoCorsRequestRequired as x,sendNoCorsRequest as L,createTimeoutError as E,loadImageAsync as U}from"./support/requestUtils.js";async function j(e,t){e instanceof URL&&(e=e.toString()),t?.query instanceof URLSearchParams&&(t.query=l(t.query.toString().replaceAll("+"," ")));const r=u(e),s=c(e);s||r||(e=d(e));const a={url:e,requestOptions:{...t}};let n=p(e);if(n){const e=await J(n,a);if(null!=e)return{data:e,getHeader:R,httpStatus:200,requestOptions:a.requestOptions,url:a.url};n.after||n.error||(n=null)}if(e=a.url,"image"===(t=a.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw B("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),a);if("head"===t.method){if(t.body)throw B("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),a);if(r||s)throw B("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),a)}if(await $(),P)return P.execute(e,t);const i=new AbortController;o(t,(()=>i.abort()));const h={controller:i,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:n,params:a,redoRequest:!1,useIdentity:D.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},m=await V(h);return n?.after?.(m),m}let P;const D=e.request,_="FormData"in globalThis,A=[499,498,403,401],F=["COM_0056","COM_0057","SB_0008"],I=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],R=()=>null,M=Symbol();function H(e){const t=m(e);t&&!j._corsServers.includes(t)&&j._corsServers.push(t)}function N(e){const t=m(e);return!t||t.endsWith(".arcgis.com")||j._corsServers.includes(t)||h(t)}function B(e,t,o,i){let l="Error";const u={url:o.url,requestOptions:o.requestOptions,getHeader:R,ssl:!1};if(t instanceof r)return t.details?(t.details=s(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=u,t;if(t){const e=i&&(e=>i.headers.get(e)),r=i?.status,s=t.message;s&&(l=s),e&&(u.getHeader=e),u.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,u.subCode=t.subcode,u.messageCode=t.messageCode,"string"==typeof t.details?u.messages=[t.details]:u.messages=t.details,u.raw=M in t?t[M]:t}return a(t)?n():new r(e,l,u)}async function $(){has("host-webworker")?P||(P=await import("./core/workers/request.js")):j._abortableFetch||(j._abortableFetch=globalThis.fetch.bind(globalThis))}async function z(){t||await import("./identity/IdentityManager.js")}async function K(r){const s=r.params.url,o=r.params.requestOptions,a=r.controller.signal,n=o.body;let l=null,u=null;if(_&&"HTMLFormElement"in globalThis&&(n instanceof FormData?l=n:n instanceof HTMLFormElement&&(l=new FormData(n))),"string"==typeof n&&(u=n),r.fetchOptions={cache:o.cacheBust&&!("polyfill"in j._abortableFetch)?"no-cache":"default",credentials:"same-origin",headers:o.headers||{},method:"head"===o.method?"HEAD":"GET",mode:"cors",priority:D.priority,redirect:"follow",signal:a},(l||u)&&(r.fetchOptions.body=l||u),"anonymous"===o.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(s)||o.query?.token||l?.get("token")),!r.hasToken&&e.apiKey&&C(s)&&(o.query||(o.query={}),o.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!W(s)&&!i(a)){let e;"immediate"===o.authMode?(await z(),e=await t.getCredential(s,{signal:a}),r.credential=e):"no-prompt"===o.authMode?(await z(),e=await t.getCredential(s,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(s)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function W(e){return I.some((t=>t.test(e)))}async function G(e){let r=e.params.url;const s=e.params.requestOptions,o=e.fetchOptions??{},a=c(r)||u(r),i=s.responseType||"json",l=a?0:null!=s.timeout?s.timeout:D.timeout;let d=!1;if(!a){e.useSSL&&(r=f(r)),s.cacheBust&&"default"===o.cache&&(r=y(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let n=w(a);has("esri-url-encodes-apostrophe")&&(n=n.replaceAll("'","%27"));const i=r.length+1+n.length;let l;d="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||i>D.maxUrlLength;const u=s.useProxy||!!g(r);if(u){const e=b(r);l=e.path,!d&&l.length+1+i>D.maxUrlLength&&(d=!0),e.query&&(a={...e.query,...a})}if("HEAD"===o.method&&(d||u)){if(d){if(i>D.maxUrlLength)throw B("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw B("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(u)throw B("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(o.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=q(r,a):(o.body=w(a),o.headers||(o.headers={}),o.headers["Content-Type"]="application/x-www-form-urlencoded")):r=q(r,a),u&&(e.useProxy=!0,r=`${l}?${r}`),a.token&&_&&o.body instanceof FormData&&!O(r)&&o.body.set("token",a.token),s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!T(r,k()))if(h(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s?.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(o.credentials="include",x(r)&&await L(d?q(r,a):r))}let p,C,v=0,U=!1;l>0&&(v=setTimeout((()=>{U=!0,e.controller.abort()}),l));try{if("native-request-init"===s.responseType)C=o,C.url=r;else if("image"!==s.responseType||"default"!==o.cache||"GET"!==o.method||d||X(s.headers)||!a&&!e.useProxy&&D.proxyUrl&&!N(r)){if(p=await j._abortableFetch(r,o),e.useProxy||H(r),"native"===s.responseType)C=p;else if("HEAD"!==o.method)if(p.ok){switch(i){case"array-buffer":C=await p.arrayBuffer();break;case"blob":case"image":C=await p.blob();break;default:C=await p.text()}if(v&&(clearTimeout(v),v=0),"json"===i||"xml"===i||"document"===i)if(C)switch(i){case"json":C=JSON.parse(C);break;case"xml":C=Q(C,"application/xml");break;case"document":C=Q(C,"text/html")}else C=null;if(C){if("array-buffer"===i||"blob"===i){const e=p.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&C["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(C).json();e.error&&(C=e)}catch{}}"image"===i&&C instanceof Blob&&(C=await Z(URL.createObjectURL(C),e,!0))}}else{C=await p.text();try{C=JSON.parse(C)}catch{}}}else C=await Z(r,e)}catch(P){if("AbortError"===P.name){if(U)throw E();throw n("Request canceled")}if(!(!p&&P instanceof TypeError&&D.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||N(r))throw P;e.redoRequest=!0,S({proxyUrl:D.proxyUrl,urlPrefix:m(r)??""})}finally{v&&clearTimeout(v)}return[p,C]}async function J(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,a;try{a=await e.before(t)}catch(s){o=B("request:interceptor",s,t)}if((a instanceof Error||a instanceof r)&&(o=B("request:interceptor",a,t)),o)throw e.error&&e.error(o),o;return a}}function X(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function Q(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function V(e){let r,s;await K(e);try{do{[r,s]=await G(e)}while(!await Y(e,r,s))}catch(n){const t=B("request:server",n,e.params,r);throw t.details.ssl=e.useSSL,e.interceptor?.error&&e.interceptor.error(t),t}const o=e.params.url;if(s&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!h(o)){const e=m(o,!0);e&&D.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&v(s.authorizedCrossOriginNoCorsDomains)}const a=e.credential;if(a&&t){const e=t.findServerInfo(a.server);let r=e?.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,a.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:s,getHeader:r?e=>r?.headers.get(e):R,httpStatus:r?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function Y(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let a,n;if(s&&(s.error?a=s.error:"error"===s.status&&Array.isArray(s.messages)&&(a={...s},a[M]=s,a.details=s.messages)),!a&&!r.ok)throw a=new Error(`Unable to load ${r.url} status: ${r.status}`),a[M]=s,a;let i,l=null;a&&(n=Number(a.code),l=a.hasOwnProperty("subcode")?Number(a.subcode):null,i=a.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===n&&(4===l||a.message?.toLowerCase().includes("ssl")&&!a.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===n)&&void 0!==n&&A.includes(n)&&!W(e.params.url)&&(403!==n||i&&!F.includes(i)&&(null==l||2===l&&e.credentialToken))){await z();try{const r=await t.getCredential(e.params.url,{error:B("request:server",a,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;a=c}}if(a)throw a;return!0}function Z(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=D.priority,o.src=e,U(o,e,r,s)}j._abortableFetch=null,j._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{j as default};
|
package/support/requestUtils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import e from"../config.js";import has from"../core/has.js";import{isAborted as r}from"../core/promiseUtils.js";import{getOrigin as o,hasSameOrigin as t,getAppUrl as n,urlToObject as s}from"../core/urlUtils.js";function i(e,o,t=!1,n){return new Promise(((s,i)=>{if(r(n))return void i(c());let a=()=>{l(),i(new Error(`Unable to load ${o}`))},u=()=>{const r=e;l(),s(r)},m=()=>{if(!e)return;const r=e;l(),r.src="",i(c())};const l=()=>{has("esri-image-decode")||(e.removeEventListener("error",a),e.removeEventListener("load",u)),a=null,u=null,e=null,null!=n&&n.removeEventListener("abort",m),m=null,t&&URL.revokeObjectURL(o)};null!=n&&n.addEventListener("abort",m),has("esri-image-decode")?e.decode().then(u,a):(e.addEventListener("error",a),e.addEventListener("load",u))}))}function c(){try{return new DOMException("Aborted","AbortError")}catch{const e=new Error;return e.name="AbortError",e}}const a="Timeout exceeded";function u(){return new Error(a)}function m(e){return"object"==typeof e&&!!e&&"message"in e&&e.message===a}function l(r){e.request.crossOriginNoCorsDomains||(e.request.crossOriginNoCorsDomains={});const t=e.request.crossOriginNoCorsDomains;for(let e of r)e=e.toLowerCase(),/^https?:\/\//.test(e)?t[o(e)??""]=0:(t[o("http://"+e)??""]=0,t[o("https://"+e)??""]=0)}function d(r){const s=e.request.crossOriginNoCorsDomains;if(s){let e=o(r);if(e)return e=e.toLowerCase(),!t(e,n())&&s[e]<Date.now()-36e5}return!1}async function f(r){const t=e.request.crossOriginNoCorsDomains,n=o(r);t&&n&&(t[n.toLowerCase()]=Date.now());const i=s(r);r=i.path,"json"===i.query?.f&&(r+="?f=json");try{await fetch(r,{mode:"no-cors",credentials:"include"})}catch{}}export{u as createTimeoutError,d as isNoCorsRequestRequired,m as isTimeoutError,i as loadImageAsync,l as registerNoCorsDomains,f as sendNoCorsRequest};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20230605",f="4cfe901fa802198fee41b77e223b90a2baef3175";export{e as buildDate,f as commitHash};
|