@vertigis/arcgis-extensions 45.5.1 → 45.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/TableExtension.d.ts +1 -1
- package/declarations/arcgis-js-api-extensions/index.d.ts +8 -35
- package/docs/html/variables/version.version.html +1 -1
- package/mapping/LayerExtension.d.ts +1 -1
- package/mapping/MapExtension.js +1 -1
- package/mapping/MapNotesLayerExtension.d.ts +1 -1
- package/mapping/MapNotesSublayerExtension.d.ts +1 -1
- package/mapping/RouteLayerExtension.d.ts +1 -1
- package/package.json +11 -10
- package/tasks/search/SearchService.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/data/TableExtension.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TableExtension } from "./_TableExtension.js";
|
|
2
|
-
export type { TableExtensionProperties, TableProperties, TableReference
|
|
2
|
+
export type { TableExtensionProperties, TableProperties, TableReference } from "./_TableExtension.js";
|
|
@@ -59,15 +59,9 @@ declare module "@arcgis/core/arcade/arcade" {
|
|
|
59
59
|
parameters: unknown,
|
|
60
60
|
spatialReference: __esri.SpatialReference
|
|
61
61
|
): unknown | Promise<unknown>;
|
|
62
|
-
export function parseScript(
|
|
63
|
-
script: string,
|
|
64
|
-
spatialReference?: __esri.SpatialReference
|
|
65
|
-
): __esri.ArcadeScript;
|
|
62
|
+
export function parseScript(script: string, spatialReference?: __esri.SpatialReference): __esri.ArcadeScript;
|
|
66
63
|
export function enableFeatureSetSupport(): Promise<void>;
|
|
67
|
-
export function executeScript(
|
|
68
|
-
arcadeScript: __esri.ArcadeScript,
|
|
69
|
-
parameters: any
|
|
70
|
-
): unknown | Promise<unknown>;
|
|
64
|
+
export function executeScript(arcadeScript: __esri.ArcadeScript, parameters: any): unknown | Promise<unknown>;
|
|
71
65
|
export function scriptIsAsync(
|
|
72
66
|
arcadeScript: __esri.ArcadeScript,
|
|
73
67
|
scriptDependencies: undefined | unknown[]
|
|
@@ -97,17 +91,9 @@ declare module "@arcgis/core/support/arcadeUtils" {
|
|
|
97
91
|
unknownBoolean: true,
|
|
98
92
|
variables: string[]
|
|
99
93
|
): Promise<void>;
|
|
100
|
-
export function getViewInfo(params: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export function createFunction(
|
|
104
|
-
syntaxTree: __esri.ArcadeScript,
|
|
105
|
-
context: ArcadeContext
|
|
106
|
-
): ArcadeFunction;
|
|
107
|
-
export function executeAsyncFunction(
|
|
108
|
-
arcadeFunction: ArcadeFunction,
|
|
109
|
-
context: ArcadeContext
|
|
110
|
-
): Promise<string>;
|
|
94
|
+
export function getViewInfo(params: { spatialReference: __esri.SpatialReference }): ArcadeViewInfo;
|
|
95
|
+
export function createFunction(syntaxTree: __esri.ArcadeScript, context: ArcadeContext): ArcadeFunction;
|
|
96
|
+
export function executeAsyncFunction(arcadeFunction: ArcadeFunction, context: ArcadeContext): Promise<string>;
|
|
111
97
|
export function createExecContext(graphic: Graphic, info: ArcadeViewInfo): ArcadeContext;
|
|
112
98
|
export function convertMapToFeatureSetCollection(args: {
|
|
113
99
|
map: __esri.Map;
|
|
@@ -137,10 +123,7 @@ declare module "@arcgis/core/arcade/featureset/sources/FeatureLayerMemory" {
|
|
|
137
123
|
}
|
|
138
124
|
|
|
139
125
|
interface FeatureLayerMemory {}
|
|
140
|
-
export function create(
|
|
141
|
-
a: createFeatureLayerMemoryParams,
|
|
142
|
-
b: __esri.SpatialReference
|
|
143
|
-
): Promise<FeatureLayerMemory>;
|
|
126
|
+
export function create(a: createFeatureLayerMemoryParams, b: __esri.SpatialReference): Promise<FeatureLayerMemory>;
|
|
144
127
|
}
|
|
145
128
|
|
|
146
129
|
declare module "@arcgis/core/arcade/functions/featuresetbase.js";
|
|
@@ -200,23 +183,13 @@ declare module "@arcgis/core/views/2d/layers/KMLLayerView2D" {
|
|
|
200
183
|
}
|
|
201
184
|
|
|
202
185
|
declare module "@arcgis/core/views/draw/support/drawUtils" {
|
|
203
|
-
export function cloneMove(
|
|
204
|
-
geometry: Geometry,
|
|
205
|
-
newX: number,
|
|
206
|
-
newY: number,
|
|
207
|
-
view: MapView
|
|
208
|
-
): Geometry;
|
|
186
|
+
export function cloneMove(geometry: Geometry, newX: number, newY: number, view: MapView): Geometry;
|
|
209
187
|
|
|
210
188
|
export function scale(geometry: Geometry, scaleX: number, scaleY: number);
|
|
211
189
|
}
|
|
212
190
|
|
|
213
191
|
declare module "esri/views/draw/support/drawUtils" {
|
|
214
|
-
export function cloneMove(
|
|
215
|
-
geometry: Geometry,
|
|
216
|
-
newX: number,
|
|
217
|
-
newY: number,
|
|
218
|
-
view: MapView
|
|
219
|
-
): Geometry;
|
|
192
|
+
export function cloneMove(geometry: Geometry, newX: number, newY: number, view: MapView): Geometry;
|
|
220
193
|
|
|
221
194
|
export function scale(geometry: Geometry, scaleX: number, scaleY: number);
|
|
222
195
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>version | @vertigis/arcgis-extensions</title><meta name="description" content="Documentation for @vertigis/arcgis-extensions"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vertigis/arcgis-extensions</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vertigis/arcgis-extensions</a></li><li><a href="../modules/version.html">version</a></li><li><a href="version.version.html">version</a></li></ul><h1>Variable version<code class="tsd-tag ts-flagConst">Const</code> </h1></div><div class="tsd-signature"><span class="tsd-kind-variable">version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"45.5.
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>version | @vertigis/arcgis-extensions</title><meta name="description" content="Documentation for @vertigis/arcgis-extensions"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vertigis/arcgis-extensions</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vertigis/arcgis-extensions</a></li><li><a href="../modules/version.html">version</a></li><li><a href="version.version.html">version</a></li></ul><h1>Variable version<code class="tsd-tag ts-flagConst">Const</code> </h1></div><div class="tsd-signature"><span class="tsd-kind-variable">version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"45.5.2"</span><span class="tsd-signature-symbol"> = "45.5.2"</span></div><div class="tsd-comment tsd-typography"><p>The current version of the Geocortex ArcGIS Extensions API.</p>
|
|
2
2
|
</div><div class="tsd-comment tsd-typography"></div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-1"></use></svg><span>@vertigis/arcgis-extensions</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li><a href="../modules/AccessDeniedError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>AccessDeniedError</a></li><li><a href="../modules/ArgumentError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>ArgumentError</a></li><li><a href="../modules/ArgumentMissingError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>ArgumentMissingError</a></li><li><a href="../modules/ArgumentOutOfRangeError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>ArgumentOutOfRangeError</a></li><li><a href="../modules/Entity.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>Entity</a></li><li><a href="../modules/ErrorBase.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>ErrorBase</a></li><li><a href="../modules/FailureMode.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>FailureMode</a></li><li><a href="../modules/Hyperlink.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>Hyperlink</a></li><li><a href="../modules/InvalidOperationError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>InvalidOperationError</a></li><li><a href="../modules/ItemType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>ItemType</a></li><li><a href="../modules/LanguageResources.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>LanguageResources</a></li><li><a href="../modules/NotFoundError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>NotFoundError</a></li><li><a href="../modules/PortalUri.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>PortalUri</a></li><li><a href="../modules/config.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>config</a></li><details class="tsd-index-accordion" data-key="data"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg><span>data</span></summary><div class="tsd-accordion-details"><ul class="tsd-nested-navigation"><li><a href="../modules/data_ArcGISServiceTableExtension.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>ArcGISServiceTableExtension</a></li><li><a href="../modules/data_Attachment.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>Attachment</a></li><li><a href="../modules/data_Capabilities.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>Capabilities</a></li><li><a href="../modules/data_Feature.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>Feature</a></li><li><a href="../modules/data_FeatureList.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>FeatureList</a></li><li><a href="../modules/data_FeatureSaveError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2"></use></svg>FeatureSaveError</a></li></ul></div></details><li>Loading...</li></ul></nav></div></div></div><div class="overlay"></div><svg style="display: none"><g id="icon-1"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-2"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g><g id="icon-8"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z" fill="var(--color-text)"></path></g><g id="icon-16"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-32"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)"></path></g><g id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g><g id="icon-512"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-1024"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-2048"><rect fill="var(--color-icon-background)" stroke="#FF4DB8" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-4096"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-8192"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-16384"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-32768"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-65536"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-131072"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-262144"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-524288"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-1048576"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="#FF4D82" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z" fill="var(--color-text)"></path></g><g id="icon-chevronDown"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></g><g id="icon-chevronSmall"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-text)"></path></g><g id="icon-menu"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></g><g id="icon-search"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></g><g id="icon-anchor"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></g></svg></body></html>
|
|
@@ -2,4 +2,4 @@ import type { LayerExtensionProperties, LayerProperties, LayerReference, LayerEx
|
|
|
2
2
|
import { LayerExtension, LayerExtensionSchema, _assignLayerExtensions } from "./_LayerExtension.js";
|
|
3
3
|
import { ArrayWrappedCollection } from "./support/ArrayWrappedCollection.js";
|
|
4
4
|
export { ArrayWrappedCollection, LayerExtension, LayerExtensionSchema, _assignLayerExtensions };
|
|
5
|
-
export type { LayerExtensionProperties, LayerProperties, LayerReference, LayerExtensionSchemaPropertyBinding
|
|
5
|
+
export type { LayerExtensionProperties, LayerProperties, LayerReference, LayerExtensionSchemaPropertyBinding };
|
package/mapping/MapExtension.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as e}from"tslib";import t from"@arcgis/core/core/Collection";import{ArgumentError as i}from"../ArgumentError.js";import{EntityBase as s}from"../Entity.js";import{InvalidOperationError as a}from"../InvalidOperationError.js";import{isBasemapExtension as n,isBookmark as o,isGroundExtension as r,isLayerPreset as p,isMenu as h,isTableExtension as m,ItemType as l}from"../ItemType.js";import{TableExtension as d}from"../data/TableExtension.js";import{layerToParentJsonCache as c}from"../json/LayerJson.js";import{applyJsonToWebMap as b}from"../json/WebMapJson.js";import{applyJsonToWebScene as _}from"../json/WebSceneJson.js";import{LayerPreset as u}from"../layer-preset/LayerPreset.js";import{Menu as E}from"../menus/Menu.js";import{DefaultArcGISRequestHelper as w}from"../support/ArcGISRequestHelper.js";import{FormatSettings as x}from"../support/FormatSettings.js";import{InitializableCollectionProxy as f}from"../support/InitializableCollectionProxy.js";import{ReadOnlyInitializableCollection as y}from"../support/ReadOnlyInitializableCollection.js";import{serializable as M}from"../support/Serializable.js";import{WellKnownBasemap as g}from"../support/esri.js";import{ReadOnlyCollection as I}from"../utilities/ReadOnlyCollection.js";import{basemapsAreEquivalent as v,createStandardBasemap as S,getStandardBasemapId as z,isStandardBasemap as O}from"../utilities/basemaps.js";import{checkArg as A}from"../utilities/checkArg.js";import{compare as P}from"../utilities/collection.js";import{load as T}from"../utilities/esri.js";import{isGroupLayerExtension as C}from"../utilities/extensions.js";import{filter as V}from"../utilities/iterable.js";import{isWMTSLayer as k,layersAreEquivalent as j}from"../utilities/layers.js";import{getLogger as B}from"../utilities/log.js";import{getMapSpatialReference as L,isMap as N,isWebMap as R,isWebScene as W}from"../utilities/mapping.js";import{toPortalItem as H}from"../utilities/portal.js";import{parallelEach as J}from"../utilities/promise.js";import{onCollectionPropertyChange as q,onEach as F}from"../utilities/watch.js";import{BasemapExtension as G}from"./BasemapExtension.js";import{Bookmark as D}from"./Bookmark.js";import{GroundExtension as U}from"./GroundExtension.js";import{MapConstraints as $}from"./MapConstraints.js";import{UnsupportedLayerExtension as X}from"./UnsupportedLayerExtension.js";import{_assignLayerExtensions as Y}from"./_LayerExtension.js";import{LayerExtensionCollectionBase as K}from"./support/_LayerExtensionCollection.js";const Q=B("MapExtension");let Z=class extends s{get webMap(){return this._webMap}get webScene(){return this._webScene}get map(){return this._currentMap}get viewMode(){return this.map?W(this.map)?"scene":"map":this.initialViewMode}get initialViewMode(){return this.webMap&&this.webScene?this._initialViewMode||"map":W(this.map)||this.webScene&&!this.webMap?"scene":"map"}set initialViewMode(e){this._initialViewMode=e}get requestHelper(){return this._requestHelper||(this._requestHelper=new w),this._requestHelper}set requestHelper(e){this._requestHelper=e}get basemapExtension(){return this._basemapExtension}set basemapExtension(e){const t=this._basemapExtension;if(t!==e)if(t&&t._setMapExtension(void 0),e){if(e._setMapExtension(this),this.isInitialized&&!e.basemap){if(e.isInitialized)throw e._setMapExtension(void 0),new a("Cannot set MapExtension.basemapExtension without a valid Esri Basemap object");e.initialize()}this._ensureIsBasemapOption(e),this.map&&e.basemap&&e.basemap!==this.map.basemap?this.map.basemap=e.basemap:this._basemapExtension=e}else this.map.basemap=void 0,this._basemapExtension=void 0}get groundExtension(){return this._groundExtension||(this.groundExtension=U.create({ground:this.map?.ground})),this._groundExtension}set groundExtension(e){if(!e)throw new a("Cannot set map.ground to undefined");const t=this._groundExtension;t!==e&&(t&&t._setMapExtension(void 0),e._setMapExtension(this),e._resolveGround(),e.ground?(this._groundExtensions.set(e.ground,e),this.map&&e.ground!==this.map.ground?this.map.ground=e.ground:this._groundExtension=e):this._groundExtension=e)}get basemapOptions(){return this._basemapOptions}get bookmarks(){return this._bookmarks}get initialBasemapExtension(){return this._initialBasemapExtension}get initialLayerPreset(){return this._initialLayerPreset}set initialLayerPreset(e){if(!e)return void(this._initialLayerPreset=void 0);const t=p(e)?e:new u(e);this._initialLayerPreset=t}get _spatialReference(){return L(this.map)}get webMapItemTitle(){if(this._webMapItem)return this._webMapItem.title}get webSceneItemTitle(){if(this._webSceneItem)return this._webSceneItem.title}get title(){return this._title?this._title:this._webMapItem&&"map"===this.viewMode?this.webMapItemTitle:this._webSceneItem&&"scene"===this.viewMode?this.webSceneItemTitle:void 0}set title(e){this._title=e}formatSettings;constraints;onClick;onHover;onHoverEnd;onInitialized;onViewpointChanged;get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&Q.error({message:"An error occurred while initializing context menu.",error:e})}})()}isSwitchingMap=!1;_layerViews=new t;get _allLayerViews(){const e=i=>{const s=[i];return t.isCollection(i.sublayerViews)?s.push(...i.sublayerViews.toArray().flatMap(e)):t.isCollection(i.layerViews)&&s.push(...i.layerViews.toArray().flatMap(e)),s};return this._layerViews.toArray().flatMap(e)}get layerExtensions(){return this._layerExtensions}tableExtensions;allLayerExtensions;_itemType=l.MAP_EXTENSION;_map;_scene;_deserializedMapPromise;_deserializedViewMode;_deserializedViewModePromise;_deferredProperties;_currentMap;_requestHelper;_basemapExtension;_groundExtension;_basemapOptions;_groundExtensions;_bookmarks;_layerExtensions;_webMap;_webMapItem;_webScene;_webSceneItem;_title;_initialViewMode;_initialLayerPreset;_initialBasemapExtension;_skipBasemapOptions=!1;_createScenePromise;_createMapPromise;_contextMenu;constructor(e){super(e);let s={...e};this._basemapOptions=new te(this),this._groundExtensions=new WeakMap,this._layerExtensions=this._createLayerExtensionCollection(),this.tableExtensions=this._createTableExtensionCollection(),this.formatSettings=this._createFormatSettings(),this._bookmarks=new t,this.constraints=new $,this.watch(["_map","_scene"],(e=>{e&&(F(e.layers,"layerview-create",(e=>{this._layerViews.add(e.layerView)})),F(e.layers,"layerview-destroy",(e=>{this._layerViews.remove(e.layerView)})))}));const{webMap:a,webScene:n,initialViewMode:o,map:r,basemapOptions:p}=s;if(this._webMap=a,this._webScene=n,this._webMapItem=ae(a),this._webSceneItem=ae(n),this.initialViewMode=o,W(r)&&n)throw new i("Cannot specify webScene property if map is initialized to a WebScene instance.");if(N(r)&&a)throw new i("Cannot specify webMap property if map is initialized to a 2D Map instance.");if(W(r)||R(r)||N(r))this.assignProperties({basemapOptions:p}),this._skipBasemapOptions=!!p;else{const{layerExtensions:e,tableExtensions:t,groundExtension:i,basemapOptions:a,basemapExtension:n,...o}=s;this._deferredProperties={layerExtensions:e,tableExtensions:t,groundExtension:i,basemapOptions:a,basemapExtension:n},s=o,a&&(this._skipBasemapOptions=!0)}this._initMapFromProperties(s),this.watch("map.basemap",(()=>this._onBasemapChange()),!0),this.watch("map.ground",(()=>this._onGroundChange()),!0),this.allLayerExtensions=new se(this),this.map?.basemap&&this._onBasemapChange()}getAllFeatureSources(e=(()=>!0)){const t=[],i=a=>{a.hasFeatures&&t.push(a);for(const t of a.sublayerExtensions.initializedItems.filter(e).toArray())s(t);if(C(a))for(const t of a.layerExtensions.initializedItems.filter(e).toArray())i(t)},s=i=>{t.push(i);for(const t of i.sublayerExtensions.initializedItems.filter(e).toArray())s(t)};for(const t of this.layerExtensions.initializedItems.filter(e).toArray())i(t);for(const i of this.tableExtensions.initializedItems.filter(e).toArray())t.push(i);if(this.basemapExtension){for(const t of this.basemapExtension.baseLayerExtensions.initializedItems.filter(e).toArray())i(t);for(const t of this.basemapExtension.referenceLayerExtensions.initializedItems.filter(e).toArray())i(t)}return t}isSupportedViewMode(e){return e===this.viewMode||!(!this.webMap&&!this.webScene)&&("scene"===e?!!this.webScene:!!this.webMap)}async switchViewMode(e){if(A("viewMode",e).isNotMissing().satisfies((e=>this.isSupportedViewMode(e)),"Unsupported view mode."),this.viewMode===e)return;let t;"scene"===e?(await this._createScene(),t=this._scene):(await this._createMap(),t=this._map),t.basemap=this.map.basemap,await this.switchMap(t),this.notifyChange("viewMode"),this.notifyChange("title")}async switchMap(e){if(A("newMap",e).isNotMissing(),e===this.map)return;if(!this.map)return void this._setMap(e);this.isSwitchingMap=!0,this.isInitialized&&await re(e);const t=new Map(this.map.layers.map((e=>[e,this.layerExtensions.forLayer(e)]))),i=new Map(this.map.tables.map((e=>[e,this.tableExtensions.forTable(e)]))),{basemapExtension:s}=this;this._setMap(e),this._updateBookmarks();const a=[];for(const e of this.map.layers.toArray()){const i=[...V(t.entries(),(([t])=>j(t,e)))];if(1===i.length){const[t]=i;a.push((async()=>{const i=t[1];await i._switchLayer(e),this._layerExtensions._register(i)})())}else{const t=this._layerExtensions._forLayer(e);t&&t.layer!==e&&a.push(t._switchLayer(e))}}for(const e of this.map.tables.toArray()){const t=[...V(i.entries(),(([t])=>j(t,e)))];if(1===t.length){const[i]=t;a.push((async()=>{const t=i[1];await t._switchTable(e),this.tableExtensions.add(t)})())}else{const t=this.tableExtensions.forTable(e);t&&t.table!==e&&a.push(t._switchTable(e))}}this.map.basemap&&s&&v(this.map.basemap,s.basemap)&&a.push((async()=>{await s._switchBasemap(this.map.basemap),this.basemapExtension=s})()),await Promise.all(a),this.isInitialized&&await this._initializeChildren(),this.isSwitchingMap=!1}async setWebMap(e){if(!e&&this.webMap&&!this.webScene)throw new a("Cannot unset both webMap and webScene.");this._webMap=e,this._map=void 0,this._createMapPromise=void 0,this._webMapItem=ae(e),await T(this._webMapItem),"map"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createMap(),await this.switchMap(this._map),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("scene")),this.notifyChange("webMap"),this.notifyChange("initialViewMode"),this.notifyChange("title")}async setWebScene(e){if(!e&&this.webScene&&!this.webMap)throw new a("Cannot unset both webMap and webScene.");this._webScene=e,this._scene=void 0,this._createScenePromise=void 0,this._webSceneItem=ae(e),await T(this._webSceneItem),"scene"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createScene(),await this.switchMap(this._scene),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("map")),this.notifyChange("webScene"),this.notifyChange("initialViewMode"),this.notifyChange("title")}getDefaults(){const e=super.getDefaults();return e.initialViewMode="map",e}async _createScene(){if(!this._scene&&this.webScene)return this._createScenePromise=this._createScenePromise??(async()=>{const e=(await import("@arcgis/core/WebScene")).default;ne(this.webScene)?(this._webSceneItem.type="Web Scene",this._scene=new e({portalItem:this._webSceneItem})):this._scene=e.fromJSON(this.webScene)})()}async _createMap(){if(!this._map&&this.webMap)return this._createMapPromise=this._createMapPromise??(async()=>{const e=(await import("@arcgis/core/WebMap")).default;ne(this.webMap)?(this._webMapItem.type="Web Map",this._map=new e({portalItem:this._webMapItem})):this._map=e.fromJSON(this.webMap)})()}_getSerializableProperties(){return{...super._getSerializableProperties(),layerExtensions:{serializeModes:["initial","project"],deserialize:e=>{if(this.map&&e){const t="map"===this.viewMode,i=(t?this._scene:this._map)?.layers.toArray()??[],s=e.filter((e=>!i.includes(e.layer)&&!i.some((t=>e.layer&&j(t,e.layer)))));Y(this.layerExtensions,s)}},serialize:e=>{if(this._deferredProperties?.layerExtensions)return this._deferredProperties.layerExtensions;{const t="map"===this.viewMode,i=(t?this._map:this._scene)?.layers.toArray();let s=(t?this._scene:this._map)?.layers.toArray()??[];return s=s.filter((e=>!i.find((t=>j(t,e))))),this.layerExtensions.concat(s.map((e=>this._layerExtensions._forLayer(e)))).filter((t=>!(t instanceof X||"initial"===e)||!t.dynamicallyAddedLayer)).toArray()}}},tableExtensions:{serializeModes:["initial","project"],deserialize:e=>{this.map?P(this.tableExtensions,e,{onNew:(e,t)=>{this.tableExtensions.add(m(e)?e:d.create(e),t)},onMatch:(e,t,i,s)=>{m(t)||e.assignProperties(t),i!==s&&this.tableExtensions.reorder(e,s)},equals:(e,t)=>m(t)?t===e:!!d._matchesRef(e,t.table)||e.id===t.id}):this._deferredProperties={...this._deferredProperties,tableExtensions:e}},serialize:()=>this._deferredProperties?.tableExtensions?this._deferredProperties?.tableExtensions:this.tableExtensions.toArray()},basemapExtension:{serializeModes:["project"],deserialize:e=>{if(this.map)if(e)if(n(e))this.basemapExtension=e;else{if(this.basemapExtension)return this.basemapExtension.assignPropertiesAsync(e);this.basemapExtension=G.create(e)}else this.basemapExtension=void 0;else this._deferredProperties={...this._deferredProperties,basemapExtension:e}},serialize:()=>this._deferredProperties?.basemapExtension?this._deferredProperties?.basemapExtension:this.basemapExtension},basemapOptions:{serializeModes:["initial"],deserialize:e=>{this._skipBasemapOptions?this._skipBasemapOptions=!1:(P(this.basemapOptions,e,{onNew:(e,t)=>{this.basemapOptions.add(n(e)?e:G.create(e),t)},onMatch:(e,t,i,s)=>{n(t)||e.assignProperties(t),i!==s&&this.basemapOptions.reorder(e,s)},onMissing:e=>{this.basemapOptions.remove(e)},equals:(e,t)=>{if(n(t))return t===e;if(e.id&&t.id)return e.id===t.id;{const i=e.toJSON();return v(i.basemap,t.basemap||t.baseMap)}}}),this.basemapExtension&&this._ensureIsBasemapOption(this.basemapExtension),this.isInitialized&&J(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())))},serialize:()=>this._deferredProperties?.basemapOptions?this._deferredProperties?.basemapOptions:this.basemapOptions.toArray()},groundExtension:{serializeModes:["initial"],deserialize:e=>{if(this.map){if(!r(e))return this.groundExtension.assignPropertiesAsync(e);this.groundExtension=e}else this._deferredProperties={...this._deferredProperties,groundExtension:e}},serialize:()=>this._deferredProperties?.groundExtension?this._deferredProperties?.groundExtension:this.groundExtension},bookmarks:{serialize:()=>this.bookmarks.map((e=>e.toJSON())).toArray(),deserialize:e=>{this.bookmarks.addMany(e.map((e=>o(e)?e:new D(e))))}},webMap:{serializeModes:["initial"],deserialize:!1},webScene:{serializeModes:["initial"],deserialize:!1},initialLayerPreset:"initial",initialViewMode:{serializeModes:["initial","project"],serialize:e=>"project"===e?this.viewMode:"scene"!==this.initialViewMode||!this.webScene&&this.webMap?"map":"scene",deserialize:e=>{this.viewMode!==e&&(this._deserializedViewMode=e),this._initialViewMode=e},isDefault:(e,t)=>"project"!==t&&"map"===e},formatSettings:"initial",constraints:"initial",title:"initial",onClick:"initial",onHover:"initial",onHoverEnd:"initial",onInitialized:"initial",onViewpointChanged:"initial",contextMenu:{serializeModes:["initial"],deserialize:e=>{e?h(e)?this.contextMenu=e:this.contextMenu?this.contextMenu.assignProperties(e):this.contextMenu=E.create(e):this.contextMenu=void 0}},map:{serializeModes:["project"],serialize:()=>{c.lookup=new WeakMap;const e=this.layerExtensions.toArray().filter((e=>e.layer)).map((e=>e._getProjectWebmapJSON())),t=this.tableExtensions.toArray().filter((e=>e.table)).map((e=>({id:e.table.id,title:e.table.title})));return c.lookup=void 0,{operationalLayers:e,tables:t}},deserialize:e=>{if(!this.map)throw new i("Cannot specify JSON object for the 'map' property. It must be an ArcGIS API Map instance. To specify JSON, use 'webMap' or 'webScene' instead.");if(N(e)||R(e)||W(e)){if(e!==this.map)throw new i("properties.map","Property 'map' is read-only.")}else this._deserializedMapPromise=(async()=>{this._deserializedViewMode&&this.webMap&&this.webScene&&(this._deserializedViewModePromise=this.switchViewMode(this._deserializedViewMode),await this._deserializedViewModePromise,this._deserializedViewMode=void 0,this._deserializedViewModePromise=void 0),await this._applyMapProperties(e,this.map),this._deserializedMapPromise=void 0})()}},requestHelper:{serialize:!1}}}async _applyMapProperties(e,t,i){await J(this.basemapOptions.toArray(),(e=>e._createBackingBasemap()));let s=e;const a=this.basemapOptions.find((e=>v(e.basemap,s.baseMap)));a&&(t.basemap=a.basemap,s={...s,baseMap:{...s.baseMap,title:t.basemap.title}}),W(t)?await _(s,t,i):await b(s,t,i)}_createFormatSettings(){return new x}_createLayerExtensionCollection(){return new ee(this)}_createTableExtensionCollection(){return new ie(this)}async _onInitialize(){await super._onInitialize();const{basemapOptions:e,basemapExtension:t,webMap:i,webScene:s,...a}=this._deferredProperties??{};if(this.map||("scene"===this.initialViewMode?(await this._createScene(),this._setMap(this._scene)):(await this._createMap(),this._setMap(this._map))),this._webMapItem||this._webSceneItem?(await Promise.all([re(this.map),T(this._webMapItem),T(this._webSceneItem)]),oe(this._webMapItem,"webMap","Web Map"),oe(this._webSceneItem,"webScene","Web Scene")):await re(this.map),t&&(!n(t)&&t.basemap?this.basemapExtension=G.create(t):await this.assignPropertiesAsync({basemapExtension:t}),await this.basemapExtension._createBackingBasemap()),e){const t=e.find((e=>n(e)&&v(this.map.basemap,e.toJSON().basemap)));if(t){const e=t.toJSON().basemap?.id??t.basemap?.id,i=t.toJSON().basemap?.title;await t._switchBasemap(this.map.basemap),this.basemapExtension=t,e&&(this.map.basemap.id=e),i&&(this.map.basemap.title=i)}await this.assignPropertiesAsync({basemapOptions:e})}await this.assignPropertiesAsync(a),this._deferredProperties=void 0,this._initialBasemapExtension=this.basemapExtension,this._updateBookmarks();for(const e of this.layerExtensions.toArray())await e._createBackingLayer();await Promise.all(this.tableExtensions.map((e=>e._createBackingTable())).toArray())}async _postInitialize(){await super._postInitialize(),await this._createStandardBasemapOptions(),await J(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())),this.initialLayerPreset&&await this.initialLayerPreset.applyTo(this)}*_initializableChildCollections(){yield*super._initializableChildCollections();const e=new t(this.layerExtensions.filter((e=>!!e.layer)));e.remove=e=>{this.layerExtensions.remove(e)};const i=new t(this.tableExtensions.filter((e=>!!e.table)));if(i.remove=e=>{this.tableExtensions.remove(e)},yield e,yield i,this.basemapExtension){const e=new t;e.add(this.basemapExtension),yield e}const s=new t;s.add(this.groundExtension),yield s}_initMapFromProperties(e){const t=e.map;N(t)||R(t)||W(t)?this._setMap(t):"scene"===this.initialViewMode?e.webScene&&!ne(e.webScene)&&(this._deferredProperties={webScene:e.webScene,...this._deferredProperties}):e.webMap&&!ne(e.webMap)&&(this._deferredProperties={webMap:e.webMap,...this._deferredProperties})}_setMap(e){W(e)?this._scene=e:this._map=e,this._currentMap=e,this.basemapExtension?.basemap&&!e.basemap&&(e.basemap=this.basemapExtension.basemap),this.groundExtension?.ground&&!e.ground&&(e.ground=this.groundExtension.ground),this.notifyChange("map")}_onBasemapChange(){if(this._basemapExtension){if(this.basemapExtension.basemap==this.map.basemap)return;this._basemapExtension._setMapExtension(void 0)}if(this.map.basemap){let e=this.basemapOptions.find((e=>this.map.basemap===e.basemap));if(!e){const t=this.basemapOptions.find((e=>v(e.basemap,this.map.basemap)));t?(e=t,e._switchBasemap(this.map.basemap)):(e=G.create({basemap:this.map.basemap}),this._basemapOptions.addInternal(e,0))}e.mapExtension!==this&&e._setMapExtension(this),this._basemapExtension=e}else this._basemapExtension=void 0;this.notifyChange("basemapExtension")}_onGroundChange(){if(this._groundExtension){if(this.map.ground&&this.groundExtension.ground===this.map.ground)return void(this._groundExtensions.has(this.map.ground)||this._groundExtensions.set(this.map.ground,this.groundExtension));this.groundExtension._setMapExtension(void 0)}this.map.ground&&!this._groundExtensions.has(this.map.ground)&&this._groundExtensions.set(this.map.ground,U.create({ground:this.map.ground}));const e=this._groundExtensions.get(this.map.ground);e&&e.mapExtension!==this&&e._setMapExtension(this),this._groundExtension=e,this.notifyChange("groundExtension")}async _createStandardBasemapOptions(){const e=this._spatialReference;!this._basemapOptions.isExplicitlyModified&&e&&e.isWebMercator&&await J([g.SATELLITE,g.HYBRID_VECTOR,g.STREETS_VECTOR,g.TOPO_VECTOR,g.STREETS_NAVIGATION_VECTOR,g.STREETS_NIGHT_VECTOR,g.TERRAIN_VECTOR,g.DARK_GRAY_VECTOR,g.GRAY_VECTOR,g.OCEANS_VECTOR,g.OPEN_STREET_MAP_VECTOR],(async e=>{const t=await S(e);v(this.map.basemap,t)?this._basemapOptions.addInternal(this.basemapExtension):this._basemapOptions.addInternal(G.create({basemap:t}),void 0,!1)}))}_ensureIsBasemapOption(e){const t=this.basemapOptions.findIndex((t=>t.basemap===e.basemap));t>=0?this._basemapOptions.getItemAt(t)!==e&&(this._basemapOptions.removeAtInternal(t),this._basemapOptions.addInternal(e,t)):this._basemapOptions.addInternal(e,0)}_updateBookmarks(){this.bookmarks.removeMany(this.bookmarks.filter((e=>"map"===e.source))),R(this.map)&&this.map.bookmarks?.length>0?this.map.bookmarks.forEach((e=>{this.bookmarks.add(new D({source:"map",title:e.name,viewpoint:e.viewpoint}))})):W(this.map)&&this.map.presentation?.slides?.length>0&&this.map.presentation.slides.forEach((e=>{const t={source:"map",title:e.title.text,viewpoint:e.viewpoint},i=new D(t);this.bookmarks.add(i)}))}};Z=e([M],Z);export{Z as MapExtension};class ee extends K{get _mapExtension(){return this._parent}constructor(e){super(e,"map.layers")}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(l.LAYER_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}}class te extends f{isExplicitlyModified=!1;_mapExtension;constructor(e){super(new t),this._mapExtension=e}add(e,t){return super.add(e,t),this.isExplicitlyModified=!0,1===this.length&&this._mapExtension.map&&!this._mapExtension.basemapExtension&&(this._mapExtension.basemapExtension=e),this}addMany(e,t){return super.addMany(e,t),this.isExplicitlyModified=!0,this}addInternal(e,t,i=!0){const s=e=>{const t="-vector";return e?.endsWith(t)?e.substring(0,e.length-7):e};let a;if(e.basemap){const t=s(e.basemap.id);if(a=this.findIndex((e=>s(e.basemap?.id)===t)),O(e.basemap)&&a>=0){if(!i)return;super.removeAt(a)}}super.add(e,t??(a>=0?a:void 0))}removeAt(e){const t=super.removeAt(e);return t&&(this.isExplicitlyModified=!0,t===this._mapExtension.basemapExtension&&(e<this.length?this._mapExtension.basemapExtension=this.getItemAt(e):this.length?this._mapExtension.basemapExtension=this.getItemAt(e-1):this._mapExtension.basemapExtension=void 0)),t}removeAll(){this._mapExtension.basemapExtension=void 0,super.removeAll()}removeAtInternal(e){return super.removeAt(e)}removeAllInternal(){for(;this.length;)this.removeAtInternal(this.length-1)}reorder(e,t){return super.reorder(e,t),this.isExplicitlyModified=!0,e}reorderInternal(e,t){return super.reorder(e,t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.basemap}}class ie extends f{get _collection(){return this._tables.map((e=>this._forTable(e))).concat(Array.from(this._uninitializedTableExtensions))}get _tables(){return this._mapExtension.map?.tables??new I(new t)}_mapExtension;_tableExtensionMap=new WeakMap;_uninitializedTableExtensions=new Set;constructor(e){super(),this._mapExtension=e,q(this._mapExtension,"map.tables",(e=>{const t={added:(e.added||[]).map((e=>this._forTable(e))),moved:(e.moved||[]).map((e=>this._forTable(e))),removed:(e.removed||[]).map((e=>this._forTable(e))),target:this};this.emit("change",t)})),this._mapExtension.watch("map.tables.length",(()=>this.notifyChange("length")))}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(l.TABLE_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}clone(){const e=new ie(this._mapExtension);return e._tableExtensionMap=this._tableExtensionMap,e}findById(e){return A("id",e).isNotMissing(),this.find((t=>t.id===e))}findByTableId(e){return A("id",e).isNotMissing(),this.find((t=>t._tableId===e))}forTable(e){if(A("table",e).isNotMissing(),this._tables.includes(e))return this._forTable(e)}add(e,t){if(A("tableX",e).isNotMissing(),e.mapExtension&&e.mapExtension.tableExtensions.remove(e),e._setMapExtension(this._mapExtension),e.table){const i=this._tableExtensionMap.get(e.table);if(this._tableExtensionMap.set(e.table,e),i&&i!==e&&this._onRemoved(i),this._tables.includes(e.table))if(void 0===t){const t={added:[e],moved:[],removed:i?[i]:[],target:this};this.emit("change",t)}else this._tables.reorder(e.table,t);else this._tables.add(e.table,t)}else{this._uninitializedTableExtensions.add(e);const t={added:[e],moved:[],removed:[],target:this};this.emit("change",t)}return this._onAdded(e),this}removeAt(e){const t=this.getItemAt(e);if(void 0!==t){if(this._uninitializedTableExtensions.has(t)){this._uninitializedTableExtensions.delete(t);const e={added:[],moved:[],removed:[t],target:this};this.emit("change",e)}else this._tables.remove(t.table);return this._onRemoved(t),t}}reorder(e,t){if(e&&this._tables.includes(e.table))return this._tables.reorder(e.table,t),e}sort(e){return this._tables.sort(((t,i)=>e(this._forTable(t),this._forTable(i)))),this}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.table}_onAdded(e){}_onRemoved(e){e._setMapExtension(void 0)}_forTable(e){for(const e of this._uninitializedTableExtensions)e._resolveTable(),e.table&&(this._tableExtensionMap.set(e.table,e),this._uninitializedTableExtensions.delete(e));if(!this._tableExtensionMap.has(e)){const t=d.create({table:e});this._tableExtensionMap.set(e,t),t._setMapExtension(this._mapExtension),this._onAdded(t)}return this._tableExtensionMap.get(e)}}class se extends y{get _collection(){let e=this._mapExtension.layerExtensions.flatten((e=>C(e)?e.layerExtensions:[]));return this._mapExtension.basemapExtension&&(e=e.concat(this._mapExtension.basemapExtension.baseLayerExtensions.toArray()).concat(this._mapExtension.basemapExtension.referenceLayerExtensions.toArray())),e=e.concat(this._mapExtension.groundExtension.layerExtensions.toArray()),e}_mapExtension;constructor(e){super(),this._mapExtension=e}findById(e){return A("id",e).isNotMissing(),this.find((t=>t.id===e))}findByLayerId(e){return A("id",e).isNotMissing(),this.find((t=>t._layerId===e))}forLayer(e){return A("layer",e).isNotMissing(),this.findByLayerId(e.id)}emit(e,i){if("change"===e){const s=new t;s.addMany(i.added);const a=s.flatten((e=>C(e)?e.layerExtensions:[])).toArray(),n=new t;n.addMany(i.removed);const o=n.flatten((e=>C(e)?e.layerExtensions:[])).toArray(),r=new t;r.addMany(i.moved);const p=r.flatten((e=>C(e)?e.layerExtensions:[])).toArray();super.emit(e,{added:a,removed:o,moved:p,target:this})}return super.emit(e,i)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.layer}}function ae(e){if("object"!=typeof e||!e?.baseMap)return H(e)}function ne(e){return"object"!=typeof e||e&&!e.baseMap}function oe(e,t,i){if(e?.type&&e.type!==i)throw new Error(`Invalid portal item type "${e.type}" for property ${t}.`)}async function re(e){await T(e),e.basemap&&(await T(e.basemap),e.basemap.baseLayers.filter((e=>k(e))).map((e=>{const t=e;return t.activeLayer.imageFormat=t.activeLayer.imageFormat??(t.activeLayer.imageFormats?.length>0?t.activeLayer.imageFormats[0]:""),t.activeLayer.styleId=t.activeLayer.styleId??"",t})),e.basemap.id=z(e.basemap)??e.basemap.id)}
|
|
1
|
+
import{__decorate as e}from"tslib";import t from"@arcgis/core/core/Collection";import{ArgumentError as i}from"../ArgumentError.js";import{EntityBase as s}from"../Entity.js";import{InvalidOperationError as a}from"../InvalidOperationError.js";import{isBasemapExtension as n,isBookmark as o,isGroundExtension as r,isLayerPreset as p,isMenu as h,isTableExtension as m,ItemType as l}from"../ItemType.js";import{TableExtension as d}from"../data/TableExtension.js";import{layerToParentJsonCache as c}from"../json/LayerJson.js";import{applyJsonToWebMap as b}from"../json/WebMapJson.js";import{applyJsonToWebScene as _}from"../json/WebSceneJson.js";import{LayerPreset as u}from"../layer-preset/LayerPreset.js";import{Menu as E}from"../menus/Menu.js";import{DefaultArcGISRequestHelper as w}from"../support/ArcGISRequestHelper.js";import{FormatSettings as x}from"../support/FormatSettings.js";import{InitializableCollectionProxy as f}from"../support/InitializableCollectionProxy.js";import{ReadOnlyInitializableCollection as y}from"../support/ReadOnlyInitializableCollection.js";import{serializable as M}from"../support/Serializable.js";import{WellKnownBasemap as g}from"../support/esri.js";import{ReadOnlyCollection as I}from"../utilities/ReadOnlyCollection.js";import{basemapsAreEquivalent as v,createStandardBasemap as S,getStandardBasemapId as z,isStandardBasemap as O}from"../utilities/basemaps.js";import{checkArg as A}from"../utilities/checkArg.js";import{compare as P}from"../utilities/collection.js";import{load as T}from"../utilities/esri.js";import{isGroupLayerExtension as C}from"../utilities/extensions.js";import{filter as V}from"../utilities/iterable.js";import{isWMTSLayer as k,layersAreEquivalent as j}from"../utilities/layers.js";import{getLogger as B}from"../utilities/log.js";import{getMapSpatialReference as L,isMap as N,isWebMap as R,isWebScene as W}from"../utilities/mapping.js";import{toPortalItem as H}from"../utilities/portal.js";import{parallelEach as J}from"../utilities/promise.js";import{onCollectionPropertyChange as q,onEach as F}from"../utilities/watch.js";import{BasemapExtension as G}from"./BasemapExtension.js";import{Bookmark as D}from"./Bookmark.js";import{GroundExtension as U}from"./GroundExtension.js";import{MapConstraints as $}from"./MapConstraints.js";import{UnsupportedLayerExtension as X}from"./UnsupportedLayerExtension.js";import{_assignLayerExtensions as Y}from"./_LayerExtension.js";import{LayerExtensionCollectionBase as K}from"./support/_LayerExtensionCollection.js";const Q=B("MapExtension");let Z=class extends s{get webMap(){return this._webMap}get webScene(){return this._webScene}get map(){return this._currentMap}get viewMode(){return this.map?W(this.map)?"scene":"map":this.initialViewMode}get initialViewMode(){return this.webMap&&this.webScene?this._initialViewMode||"map":W(this.map)||this.webScene&&!this.webMap?"scene":"map"}set initialViewMode(e){this._initialViewMode=e}get requestHelper(){return this._requestHelper||(this._requestHelper=new w),this._requestHelper}set requestHelper(e){this._requestHelper=e}get basemapExtension(){return this._basemapExtension}set basemapExtension(e){const t=this._basemapExtension;if(t!==e)if(t&&t._setMapExtension(void 0),e){if(e._setMapExtension(this),this.isInitialized&&!e.basemap){if(e.isInitialized)throw e._setMapExtension(void 0),new a("Cannot set MapExtension.basemapExtension without a valid Esri Basemap object");e.initialize()}this._ensureIsBasemapOption(e),this.map&&e.basemap&&e.basemap!==this.map.basemap?this.map.basemap=e.basemap:this._basemapExtension=e}else this.map.basemap=void 0,this._basemapExtension=void 0}get groundExtension(){return this._groundExtension||(this.groundExtension=U.create({ground:this.map?.ground})),this._groundExtension}set groundExtension(e){if(!e)throw new a("Cannot set map.ground to undefined");const t=this._groundExtension;t!==e&&(t&&t._setMapExtension(void 0),e._setMapExtension(this),e._resolveGround(),e.ground?(this._groundExtensions.set(e.ground,e),this.map&&e.ground!==this.map.ground?this.map.ground=e.ground:this._groundExtension=e):this._groundExtension=e)}get basemapOptions(){return this._basemapOptions}get bookmarks(){return this._bookmarks}get initialBasemapExtension(){return this._initialBasemapExtension}get initialLayerPreset(){return this._initialLayerPreset}set initialLayerPreset(e){if(!e)return void(this._initialLayerPreset=void 0);const t=p(e)?e:new u(e);this._initialLayerPreset=t}get _spatialReference(){return L(this.map)}get webMapItemTitle(){if(this._webMapItem)return this._webMapItem.title}get webSceneItemTitle(){if(this._webSceneItem)return this._webSceneItem.title}get title(){return this._title?this._title:this._webMapItem&&"map"===this.viewMode?this.webMapItemTitle:this._webSceneItem&&"scene"===this.viewMode?this.webSceneItemTitle:void 0}set title(e){this._title=e}formatSettings;constraints;onClick;onHover;onHoverEnd;onInitialized;onViewpointChanged;get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&Q.error({message:"An error occurred while initializing context menu.",error:e})}})()}isSwitchingMap=!1;_layerViews=new t;get _allLayerViews(){const e=i=>{const s=[i];return t.isCollection(i.sublayerViews)?s.push(...i.sublayerViews.toArray().flatMap(e)):t.isCollection(i.layerViews)&&s.push(...i.layerViews.toArray().flatMap(e)),s};return this._layerViews.toArray().flatMap(e)}get layerExtensions(){return this._layerExtensions}tableExtensions;allLayerExtensions;_itemType=l.MAP_EXTENSION;_map;_scene;_deserializedMapPromise;_deserializedViewMode;_deserializedViewModePromise;_deferredProperties;_currentMap;_requestHelper;_basemapExtension;_groundExtension;_basemapOptions;_groundExtensions;_bookmarks;_layerExtensions;_webMap;_webMapItem;_webScene;_webSceneItem;_title;_initialViewMode;_initialLayerPreset;_initialBasemapExtension;_skipBasemapOptions=!1;_createScenePromise;_createMapPromise;_contextMenu;constructor(e){super(e);let s={...e};this._basemapOptions=new te(this),this._groundExtensions=new WeakMap,this._layerExtensions=this._createLayerExtensionCollection(),this.tableExtensions=this._createTableExtensionCollection(),this.formatSettings=this._createFormatSettings(),this._bookmarks=new t,this.constraints=new $,this.watch(["_map","_scene"],(e=>{e&&(F(e.layers,"layerview-create",(e=>{this._layerViews.add(e.layerView)})),F(e.layers,"layerview-destroy",(e=>{this._layerViews.remove(e.layerView)})))}));const{webMap:a,webScene:n,initialViewMode:o,map:r,basemapOptions:p}=s;if(this._webMap=a,this._webScene=n,this._webMapItem=ae(a),this._webSceneItem=ae(n),this.initialViewMode=o,W(r)&&n)throw new i("Cannot specify webScene property if map is initialized to a WebScene instance.");if(N(r)&&a)throw new i("Cannot specify webMap property if map is initialized to a 2D Map instance.");if(W(r)||R(r)||N(r))this.assignProperties({basemapOptions:p}),this._skipBasemapOptions=!!p;else{const{layerExtensions:e,tableExtensions:t,groundExtension:i,basemapOptions:a,basemapExtension:n,...o}=s;this._deferredProperties={layerExtensions:e,tableExtensions:t,groundExtension:i,basemapOptions:a,basemapExtension:n},s=o,a&&(this._skipBasemapOptions=!0)}this._initMapFromProperties(s),this.watch("map.basemap",(()=>this._onBasemapChange()),!0),this.watch("map.ground",(()=>this._onGroundChange()),!0),this.allLayerExtensions=new se(this),this.map?.basemap&&this._onBasemapChange()}getAllFeatureSources(e=(()=>!0)){const t=[],i=a=>{a.hasFeatures&&t.push(a);for(const t of a.sublayerExtensions.initializedItems.filter(e).toArray())s(t);if(C(a))for(const t of a.layerExtensions.initializedItems.filter(e).toArray())i(t)},s=i=>{t.push(i);for(const t of i.sublayerExtensions.initializedItems.filter(e).toArray())s(t)};for(const t of this.layerExtensions.initializedItems.filter(e).toArray())i(t);for(const i of this.tableExtensions.initializedItems.filter(e).toArray())t.push(i);if(this.basemapExtension){for(const t of this.basemapExtension.baseLayerExtensions.initializedItems.filter(e).toArray())i(t);for(const t of this.basemapExtension.referenceLayerExtensions.initializedItems.filter(e).toArray())i(t)}return t}isSupportedViewMode(e){return e===this.viewMode||!(!this.webMap&&!this.webScene)&&("scene"===e?!!this.webScene:!!this.webMap)}async switchViewMode(e){if(A("viewMode",e).isNotMissing().satisfies((e=>this.isSupportedViewMode(e)),"Unsupported view mode."),this.viewMode===e)return;let t;"scene"===e?(await this._createScene(),t=this._scene):(await this._createMap(),t=this._map),t.basemap=this.map.basemap,await this.switchMap(t),this.notifyChange("viewMode"),this.notifyChange("title")}async switchMap(e){if(A("newMap",e).isNotMissing(),e===this.map)return;if(!this.map)return void this._setMap(e);this.isSwitchingMap=!0,this.isInitialized&&await re(e);const t=new Map(this.map.layers.map((e=>[e,this.layerExtensions.forLayer(e)]))),i=new Map(this.map.tables.map((e=>[e,this.tableExtensions.forTable(e)]))),{basemapExtension:s}=this;this._setMap(e),this._updateBookmarks();const a=[];for(const e of this.map.layers.toArray()){const i=[...V(t.entries(),(([t])=>j(t,e)))];if(1===i.length){const[t]=i;a.push((async()=>{const i=t[1];await i._switchLayer(e),this._layerExtensions._register(i)})())}else{const t=this._layerExtensions._forLayer(e);t&&t.layer!==e&&a.push(t._switchLayer(e))}}for(const e of this.map.tables.toArray()){const t=[...V(i.entries(),(([t])=>j(t,e)))];if(1===t.length){const[i]=t;a.push((async()=>{const t=i[1];await t._switchTable(e),this.tableExtensions.add(t)})())}else{const t=this.tableExtensions.forTable(e);t&&t.table!==e&&a.push(t._switchTable(e))}}this.map.basemap&&s&&v(this.map.basemap,s.basemap)&&a.push((async()=>{await s._switchBasemap(this.map.basemap),this.basemapExtension=s})()),await Promise.all(a),this.isInitialized&&await this._initializeChildren(),this.isSwitchingMap=!1}async setWebMap(e){if(!e&&this.webMap&&!this.webScene)throw new a("Cannot unset both webMap and webScene.");this._webMap=e,this._map=void 0,this._createMapPromise=void 0,this._webMapItem=ae(e),await T(this._webMapItem),"map"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createMap(),await this.switchMap(this._map),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("scene")),this.notifyChange("webMap"),this.notifyChange("initialViewMode"),this.notifyChange("title")}async setWebScene(e){if(!e&&this.webScene&&!this.webMap)throw new a("Cannot unset both webMap and webScene.");this._webScene=e,this._scene=void 0,this._createScenePromise=void 0,this._webSceneItem=ae(e),await T(this._webSceneItem),"scene"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createScene(),await this.switchMap(this._scene),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("map")),this.notifyChange("webScene"),this.notifyChange("initialViewMode"),this.notifyChange("title")}getDefaults(){const e=super.getDefaults();return e.initialViewMode="map",e}async _createScene(){if(!this._scene&&this.webScene)return this._createScenePromise=this._createScenePromise??(async()=>{const e=(await import("@arcgis/core/WebScene")).default;ne(this.webScene)?(this._webSceneItem.type="Web Scene",this._scene=new e({portalItem:this._webSceneItem})):this._scene=e.fromJSON(this.webScene)})()}async _createMap(){if(!this._map&&this.webMap)return this._createMapPromise=this._createMapPromise??(async()=>{const e=(await import("@arcgis/core/WebMap")).default;ne(this.webMap)?(this._webMapItem.type="Web Map",this._map=new e({portalItem:this._webMapItem})):this._map=e.fromJSON(this.webMap)})()}_getSerializableProperties(){return{...super._getSerializableProperties(),layerExtensions:{serializeModes:["initial","project"],deserialize:e=>{if(this.map&&e){const t="map"===this.viewMode,i=(t?this._scene:this._map)?.layers.toArray()??[],s=e.filter((e=>!i.includes(e.layer)&&!i.some((t=>e.layer&&j(t,e.layer)))));Y(this.layerExtensions,s)}},serialize:e=>{if(this._deferredProperties?.layerExtensions)return this._deferredProperties.layerExtensions;{const t="map"===this.viewMode,i=(t?this._map:this._scene)?.layers.toArray();let s=(t?this._scene:this._map)?.layers.toArray()??[];return s=s.filter((e=>!i.find((t=>j(t,e))))),this.layerExtensions.concat(s.map((e=>this._layerExtensions._forLayer(e)))).filter((t=>!(t instanceof X||"initial"===e)||!t.dynamicallyAddedLayer)).toArray()}}},tableExtensions:{serializeModes:["initial","project"],deserialize:e=>{this.map?P(this.tableExtensions,e,{onNew:(e,t)=>{this.tableExtensions.add(m(e)?e:d.create(e),t)},onMatch:(e,t,i,s)=>{m(t)||e.assignProperties(t),i!==s&&this.tableExtensions.reorder(e,s)},equals:(e,t)=>m(t)?t===e:!!d._matchesRef(e,t.table)||e.id===t.id}):this._deferredProperties={...this._deferredProperties,tableExtensions:e}},serialize:()=>this._deferredProperties?.tableExtensions?this._deferredProperties?.tableExtensions:this.tableExtensions.toArray()},basemapExtension:{serializeModes:["project"],deserialize:e=>{if(this.map)if(e)if(n(e))this.basemapExtension=e;else{if(this.basemapExtension)return this.basemapExtension.assignPropertiesAsync(e);this.basemapExtension=G.create(e)}else this.basemapExtension=void 0;else this._deferredProperties={...this._deferredProperties,basemapExtension:e}},serialize:()=>this._deferredProperties?.basemapExtension?this._deferredProperties?.basemapExtension:this.basemapExtension},basemapOptions:{serializeModes:["initial"],deserialize:e=>{this._skipBasemapOptions?this._skipBasemapOptions=!1:(P(this.basemapOptions,e,{onNew:(e,t)=>{this.basemapOptions.add(n(e)?e:G.create(e),t)},onMatch:(e,t,i,s)=>{n(t)||e.assignProperties(t),i!==s&&this.basemapOptions.reorder(e,s)},onMissing:e=>{this.basemapOptions.remove(e)},equals:(e,t)=>{if(n(t))return t===e;if(e.id&&t.id)return e.id===t.id;{const i=e.toJSON();return v(i.basemap,t.basemap||t.baseMap)}}}),this.basemapExtension&&this._ensureIsBasemapOption(this.basemapExtension),this.isInitialized&&J(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())))},serialize:()=>this._deferredProperties?.basemapOptions?this._deferredProperties?.basemapOptions:this.basemapOptions.toArray()},groundExtension:{serializeModes:["initial"],deserialize:e=>{if(this.map){if(!r(e))return this.groundExtension.assignPropertiesAsync(e);this.groundExtension=e}else this._deferredProperties={...this._deferredProperties,groundExtension:e}},serialize:()=>this._deferredProperties?.groundExtension?this._deferredProperties?.groundExtension:this.groundExtension},bookmarks:{serialize:()=>this.bookmarks.map((e=>e.toJSON())).toArray(),deserialize:e=>{this.bookmarks.addMany(e.map((e=>o(e)?e:new D(e))))}},webMap:{serializeModes:["initial"],deserialize:!1},webScene:{serializeModes:["initial"],deserialize:!1},initialLayerPreset:"initial",initialViewMode:{serializeModes:["initial","project"],serialize:e=>"project"===e?this.viewMode:"scene"!==this.initialViewMode||!this.webScene&&this.webMap?"map":"scene",deserialize:e=>{this.viewMode!==e&&(this._deserializedViewMode=e),this._initialViewMode=e},isDefault:(e,t)=>"project"!==t&&"map"===e},formatSettings:"initial",constraints:"initial",title:"initial",onClick:"initial",onHover:"initial",onHoverEnd:"initial",onInitialized:"initial",onViewpointChanged:"initial",contextMenu:{serializeModes:["initial"],deserialize:e=>{e?h(e)?this.contextMenu=e:this.contextMenu?this.contextMenu.assignProperties(e):this.contextMenu=E.create(e):this.contextMenu=void 0}},map:{serializeModes:["project"],serialize:()=>{c.lookup=new WeakMap;const e=this.layerExtensions.toArray().filter((e=>e.layer)).map((e=>e._getProjectWebmapJSON())),t=this.tableExtensions.toArray().filter((e=>e.table)).map((e=>({id:e.table.id,title:e.table.title})));return c.lookup=void 0,{operationalLayers:e,tables:t}},deserialize:e=>{if(!this.map)throw new i("Cannot specify JSON object for the 'map' property. It must be an ArcGIS API Map instance. To specify JSON, use 'webMap' or 'webScene' instead.");if(N(e)||R(e)||W(e)){if(e!==this.map)throw new i("properties.map","Property 'map' is read-only.")}else this._deserializedMapPromise=(async()=>{this._deserializedViewMode&&this.webMap&&this.webScene&&(this._deserializedViewModePromise=this.switchViewMode(this._deserializedViewMode),await this._deserializedViewModePromise,this._deserializedViewMode=void 0,this._deserializedViewModePromise=void 0),await this._applyMapProperties(e,this.map),this._deserializedMapPromise=void 0})()}},requestHelper:{serialize:!1}}}async _applyMapProperties(e,t,i){await J(this.basemapOptions.toArray(),(e=>e._createBackingBasemap()));let s=e;const a=this.basemapOptions.find((e=>v(e.basemap,s.baseMap)));a&&(t.basemap=a.basemap,s={...s,baseMap:{...s.baseMap,title:t.basemap.title}}),W(t)?await _(s,t,i):await b(s,t,i)}_createFormatSettings(){return new x}_createLayerExtensionCollection(){return new ee(this)}_createTableExtensionCollection(){return new ie(this)}async _onInitialize(){await super._onInitialize();const{basemapOptions:e,basemapExtension:t,webMap:i,webScene:s,...a}=this._deferredProperties??{};if(this.map||("scene"===this.initialViewMode?(await this._createScene(),this._setMap(this._scene)):(await this._createMap(),this._setMap(this._map))),this._webMapItem||this._webSceneItem?(await Promise.all([re(this.map),T(this._webMapItem),T(this._webSceneItem)]),oe(this._webMapItem,"webMap","Web Map"),oe(this._webSceneItem,"webScene","Web Scene")):await re(this.map),t&&(!n(t)&&t.basemap?this.basemapExtension=G.create(t):await this.assignPropertiesAsync({basemapExtension:t}),await this.basemapExtension._createBackingBasemap()),e){const t=e.find((e=>n(e)&&v(this.map.basemap,e.toJSON().basemap)));if(t){const e=t.toJSON().basemap?.id??t.basemap?.id,i=t.toJSON().basemap?.title;await t._switchBasemap(this.map.basemap),this.basemapExtension=t,e&&(this.map.basemap.id=e),i&&(this.map.basemap.title=i)}await this.assignPropertiesAsync({basemapOptions:e})}await this.assignPropertiesAsync(a),this._deferredProperties=void 0,this._initialBasemapExtension=this.basemapExtension,this._updateBookmarks();for(const e of this.layerExtensions.toArray())await e._createBackingLayer();await Promise.all(this.tableExtensions.map((e=>e._createBackingTable())).toArray())}async _postInitialize(){await super._postInitialize(),await this._createStandardBasemapOptions(),await J(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())),this.initialLayerPreset&&await this.initialLayerPreset.applyTo(this)}*_initializableChildCollections(){yield*super._initializableChildCollections();const e=new t(this.layerExtensions.filter((e=>!!e.layer)));e.remove=e=>{this.layerExtensions.remove(e)};const i=new t(this.tableExtensions.filter((e=>!!e.table)));if(i.remove=e=>{this.tableExtensions.remove(e)},yield e,yield i,this.basemapExtension){const e=new t;e.add(this.basemapExtension),yield e}const s=new t;s.add(this.groundExtension),yield s}_initMapFromProperties(e){const t=e.map;N(t)||R(t)||W(t)?this._setMap(t):"scene"===this.initialViewMode?e.webScene&&!ne(e.webScene)&&(this._deferredProperties={webScene:e.webScene,...this._deferredProperties}):e.webMap&&!ne(e.webMap)&&(this._deferredProperties={webMap:e.webMap,...this._deferredProperties})}_setMap(e){W(e)?this._scene=e:this._map=e,this._currentMap=e,this.basemapExtension?.basemap&&!e.basemap&&(e.basemap=this.basemapExtension.basemap),this.groundExtension?.ground&&!e.ground&&(e.ground=this.groundExtension.ground),this.notifyChange("map")}_onBasemapChange(){if(this._basemapExtension){if(this.basemapExtension.basemap==this.map.basemap)return;this._basemapExtension._setMapExtension(void 0)}if(this.map.basemap){let e=this.basemapOptions.find((e=>this.map.basemap===e.basemap));if(!e){const t=this.basemapOptions.find((e=>v(e.basemap,this.map.basemap)));t?(e=t,e._switchBasemap(this.map.basemap)):(e=G.create({basemap:this.map.basemap}),this._basemapOptions.addInternal(e,0))}e.mapExtension!==this&&e._setMapExtension(this),this._basemapExtension=e}else this._basemapExtension=void 0;this.notifyChange("basemapExtension")}_onGroundChange(){if(this._groundExtension){if(this.map.ground&&this.groundExtension.ground===this.map.ground)return void(this._groundExtensions.has(this.map.ground)||this._groundExtensions.set(this.map.ground,this.groundExtension));this.groundExtension._setMapExtension(void 0)}this.map.ground&&!this._groundExtensions.has(this.map.ground)&&this._groundExtensions.set(this.map.ground,U.create({ground:this.map.ground}));const e=this._groundExtensions.get(this.map.ground);e&&e.mapExtension!==this&&e._setMapExtension(this),this._groundExtension=e,this.notifyChange("groundExtension")}async _createStandardBasemapOptions(){const e=this._spatialReference;!this._basemapOptions.isExplicitlyModified&&e?.isWebMercator&&await J([g.SATELLITE,g.HYBRID_VECTOR,g.STREETS_VECTOR,g.TOPO_VECTOR,g.STREETS_NAVIGATION_VECTOR,g.STREETS_NIGHT_VECTOR,g.TERRAIN_VECTOR,g.DARK_GRAY_VECTOR,g.GRAY_VECTOR,g.OCEANS_VECTOR,g.OPEN_STREET_MAP_VECTOR],(async e=>{const t=await S(e);v(this.map.basemap,t)?this._basemapOptions.addInternal(this.basemapExtension):this._basemapOptions.addInternal(G.create({basemap:t}),void 0,!1)}))}_ensureIsBasemapOption(e){const t=this.basemapOptions.findIndex((t=>t.basemap===e.basemap));t>=0?this._basemapOptions.getItemAt(t)!==e&&(this._basemapOptions.removeAtInternal(t),this._basemapOptions.addInternal(e,t)):this._basemapOptions.addInternal(e,0)}_updateBookmarks(){this.bookmarks.removeMany(this.bookmarks.filter((e=>"map"===e.source))),R(this.map)&&this.map.bookmarks?.length>0?this.map.bookmarks.forEach((e=>{this.bookmarks.add(new D({source:"map",title:e.name,viewpoint:e.viewpoint}))})):W(this.map)&&this.map.presentation?.slides?.length>0&&this.map.presentation.slides.forEach((e=>{const t={source:"map",title:e.title.text,viewpoint:e.viewpoint},i=new D(t);this.bookmarks.add(i)}))}};Z=e([M],Z);export{Z as MapExtension};class ee extends K{get _mapExtension(){return this._parent}constructor(e){super(e,"map.layers")}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(l.LAYER_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}}class te extends f{isExplicitlyModified=!1;_mapExtension;constructor(e){super(new t),this._mapExtension=e}add(e,t){return super.add(e,t),this.isExplicitlyModified=!0,1===this.length&&this._mapExtension.map&&!this._mapExtension.basemapExtension&&(this._mapExtension.basemapExtension=e),this}addMany(e,t){return super.addMany(e,t),this.isExplicitlyModified=!0,this}addInternal(e,t,i=!0){const s=e=>{const t="-vector";return e?.endsWith(t)?e.substring(0,e.length-7):e};let a;if(e.basemap){const t=s(e.basemap.id);if(a=this.findIndex((e=>s(e.basemap?.id)===t)),O(e.basemap)&&a>=0){if(!i)return;super.removeAt(a)}}super.add(e,t??(a>=0?a:void 0))}removeAt(e){const t=super.removeAt(e);return t&&(this.isExplicitlyModified=!0,t===this._mapExtension.basemapExtension&&(e<this.length?this._mapExtension.basemapExtension=this.getItemAt(e):this.length?this._mapExtension.basemapExtension=this.getItemAt(e-1):this._mapExtension.basemapExtension=void 0)),t}removeAll(){this._mapExtension.basemapExtension=void 0,super.removeAll()}removeAtInternal(e){return super.removeAt(e)}removeAllInternal(){for(;this.length;)this.removeAtInternal(this.length-1)}reorder(e,t){return super.reorder(e,t),this.isExplicitlyModified=!0,e}reorderInternal(e,t){return super.reorder(e,t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.basemap}}class ie extends f{get _collection(){return this._tables.map((e=>this._forTable(e))).concat(Array.from(this._uninitializedTableExtensions))}get _tables(){return this._mapExtension.map?.tables??new I(new t)}_mapExtension;_tableExtensionMap=new WeakMap;_uninitializedTableExtensions=new Set;constructor(e){super(),this._mapExtension=e,q(this._mapExtension,"map.tables",(e=>{const t={added:(e.added||[]).map((e=>this._forTable(e))),moved:(e.moved||[]).map((e=>this._forTable(e))),removed:(e.removed||[]).map((e=>this._forTable(e))),target:this};this.emit("change",t)})),this._mapExtension.watch("map.tables.length",(()=>this.notifyChange("length")))}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(l.TABLE_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}clone(){const e=new ie(this._mapExtension);return e._tableExtensionMap=this._tableExtensionMap,e}findById(e){return A("id",e).isNotMissing(),this.find((t=>t.id===e))}findByTableId(e){return A("id",e).isNotMissing(),this.find((t=>t._tableId===e))}forTable(e){if(A("table",e).isNotMissing(),this._tables.includes(e))return this._forTable(e)}add(e,t){if(A("tableX",e).isNotMissing(),e.mapExtension&&e.mapExtension.tableExtensions.remove(e),e._setMapExtension(this._mapExtension),e.table){const i=this._tableExtensionMap.get(e.table);if(this._tableExtensionMap.set(e.table,e),i&&i!==e&&this._onRemoved(i),this._tables.includes(e.table))if(void 0===t){const t={added:[e],moved:[],removed:i?[i]:[],target:this};this.emit("change",t)}else this._tables.reorder(e.table,t);else this._tables.add(e.table,t)}else{this._uninitializedTableExtensions.add(e);const t={added:[e],moved:[],removed:[],target:this};this.emit("change",t)}return this._onAdded(e),this}removeAt(e){const t=this.getItemAt(e);if(void 0!==t){if(this._uninitializedTableExtensions.has(t)){this._uninitializedTableExtensions.delete(t);const e={added:[],moved:[],removed:[t],target:this};this.emit("change",e)}else this._tables.remove(t.table);return this._onRemoved(t),t}}reorder(e,t){if(e&&this._tables.includes(e.table))return this._tables.reorder(e.table,t),e}sort(e){return this._tables.sort(((t,i)=>e(this._forTable(t),this._forTable(i)))),this}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.table}_onAdded(e){}_onRemoved(e){e._setMapExtension(void 0)}_forTable(e){for(const e of this._uninitializedTableExtensions)e._resolveTable(),e.table&&(this._tableExtensionMap.set(e.table,e),this._uninitializedTableExtensions.delete(e));if(!this._tableExtensionMap.has(e)){const t=d.create({table:e});this._tableExtensionMap.set(e,t),t._setMapExtension(this._mapExtension),this._onAdded(t)}return this._tableExtensionMap.get(e)}}class se extends y{get _collection(){let e=this._mapExtension.layerExtensions.flatten((e=>C(e)?e.layerExtensions:[]));return this._mapExtension.basemapExtension&&(e=e.concat(this._mapExtension.basemapExtension.baseLayerExtensions.toArray()).concat(this._mapExtension.basemapExtension.referenceLayerExtensions.toArray())),e=e.concat(this._mapExtension.groundExtension.layerExtensions.toArray()),e}_mapExtension;constructor(e){super(),this._mapExtension=e}findById(e){return A("id",e).isNotMissing(),this.find((t=>t.id===e))}findByLayerId(e){return A("id",e).isNotMissing(),this.find((t=>t._layerId===e))}forLayer(e){return A("layer",e).isNotMissing(),this.findByLayerId(e.id)}emit(e,i){if("change"===e){const s=new t;s.addMany(i.added);const a=s.flatten((e=>C(e)?e.layerExtensions:[])).toArray(),n=new t;n.addMany(i.removed);const o=n.flatten((e=>C(e)?e.layerExtensions:[])).toArray(),r=new t;r.addMany(i.moved);const p=r.flatten((e=>C(e)?e.layerExtensions:[])).toArray();super.emit(e,{added:a,removed:o,moved:p,target:this})}return super.emit(e,i)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.layer}}function ae(e){if("object"!=typeof e||!e?.baseMap)return H(e)}function ne(e){return"object"!=typeof e||e&&!e.baseMap}function oe(e,t,i){if(e?.type&&e.type!==i)throw new Error(`Invalid portal item type "${e.type}" for property ${t}.`)}async function re(e){await T(e),e.basemap&&(await T(e.basemap),e.basemap.baseLayers.filter((e=>k(e))).map((e=>{const t=e;return t.activeLayer.imageFormat=t.activeLayer.imageFormat??(t.activeLayer.imageFormats?.length>0?t.activeLayer.imageFormats[0]:""),t.activeLayer.styleId=t.activeLayer.styleId??"",t})),e.basemap.id=z(e.basemap)??e.basemap.id)}
|
|
@@ -5,8 +5,8 @@ import type { QuerySourceCapabilities } from "../data/QuerySourceCapabilities.js
|
|
|
5
5
|
import { type FeatureLayerJson } from "../json/FeatureLayerJson.js";
|
|
6
6
|
import type { OperationalLayerJson } from "../json/OperationalLayerJson.js";
|
|
7
7
|
import type { PropertyDefs } from "../support/Serializable.js";
|
|
8
|
-
import { MapNotesSublayerExtension } from "./MapNotesSublayerExtension.js";
|
|
9
8
|
import type { MapNotesSublayerExtensionProperties } from "./MapNotesSublayerExtension.js";
|
|
9
|
+
import { MapNotesSublayerExtension } from "./MapNotesSublayerExtension.js";
|
|
10
10
|
import type { LayerExtensionProperties, LayerProperties } from "./_LayerExtension.js";
|
|
11
11
|
import { LayerExtension } from "./_LayerExtension.js";
|
|
12
12
|
import { SublayerExtensionCollectionBase } from "./support/_SublayerExtensionCollection.js";
|
|
@@ -3,8 +3,8 @@ import type { Schema } from "../data/Schema.js";
|
|
|
3
3
|
import type { InitializableCollection } from "../support/InitializableCollectionProxy.js";
|
|
4
4
|
import type { GeometryType, MapNotesSublayer, SublayerLike } from "../support/esri.js";
|
|
5
5
|
import type { MapNotesLayerExtension } from "./MapNotesLayerExtension.js";
|
|
6
|
-
import { SublayerExtension, SublayerSchema, SubSublayerExtensionCollection } from "./_SublayerExtension.js";
|
|
7
6
|
import type { SublayerExtensionProperties, SublayerProperties } from "./_SublayerExtension.js";
|
|
7
|
+
import { SublayerExtension, SublayerSchema, SubSublayerExtensionCollection } from "./_SublayerExtension.js";
|
|
8
8
|
/**
|
|
9
9
|
* Properties that can be passed into the constructor for
|
|
10
10
|
* {@link MapNotesSublayerExtension}.
|
|
@@ -5,8 +5,8 @@ import type { QuerySourceCapabilities } from "../data/QuerySourceCapabilities.js
|
|
|
5
5
|
import type { Schema } from "../data/Schema.js";
|
|
6
6
|
import { type FeatureLayerJson } from "../json/FeatureLayerJson.js";
|
|
7
7
|
import type { PropertyDefs } from "../support/Serializable.js";
|
|
8
|
-
import { LayerExtension, LayerExtensionSchema } from "./_LayerExtension.js";
|
|
9
8
|
import type { LayerExtensionProperties, LayerProperties } from "./_LayerExtension.js";
|
|
9
|
+
import { LayerExtension, LayerExtensionSchema } from "./_LayerExtension.js";
|
|
10
10
|
/**
|
|
11
11
|
* Ref type for route layer extension.
|
|
12
12
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertigis/arcgis-extensions",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE",
|
|
4
|
-
"version": "45.5.
|
|
4
|
+
"version": "45.5.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://dev.azure.com/vertigis/Studio/_git/arcgis-extensions-ts"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"app-schema": "node build/js/appSchema.js",
|
|
34
34
|
"audit": "npx --yes audit-ci@^6 --config ./audit-ci.jsonc",
|
|
35
35
|
"docs": "typedoc",
|
|
36
|
-
"build": "npm run -s cleanup-build && npm run -s copy-static-files && tsc -p src/tsconfig.bundle.json && tsc-strict -p src/tsconfig.bundle.json && npm run -s
|
|
36
|
+
"build": "npm run -s cleanup-build && npm run -s copy-static-files && tsc -p src/tsconfig.bundle.json && tsc-strict -p src/tsconfig.bundle.json && npm run -s minify && npm run -s docs && npm run -s app-schema",
|
|
37
37
|
"build-debug": "npm run -s cleanup-build && npm run -s copy-static-files && tsc -p src/tsconfig.bundle.json && tsc-strict -p src/tsconfig.bundle.json",
|
|
38
38
|
"cleanup-build": "del-cli *.js *.js.map *.d.ts \"!jest.config.js\" data forked-libs layer-preset locale mapping menus portal printing reports support tasks tests utilities workflow",
|
|
39
39
|
"copy-static-files": "cpx \"src/**/*.{js,d.ts}\" \"./\"",
|
|
40
40
|
"initialize": "del-cli build/js && tsc -p build && node build/js/postInstall.js",
|
|
41
|
-
"lint": "eslint
|
|
41
|
+
"lint": "eslint --max-warnings=0 ./src",
|
|
42
42
|
"minify": "node build/js/minify.js",
|
|
43
43
|
"prettier": "prettier --write \"**/*.ts\" \"**/*.json\" \"**/*.js\" ",
|
|
44
44
|
"prepare": "in-install && npm run -s initialize || not-in-install",
|
|
@@ -68,25 +68,26 @@
|
|
|
68
68
|
"@types/jest": "29.5.11",
|
|
69
69
|
"@types/luxon": "3.4.1",
|
|
70
70
|
"@types/node": "20.11.5",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "6.18.1",
|
|
72
|
-
"@typescript-eslint/parser": "6.18.1",
|
|
73
71
|
"canvas": "2.11.2",
|
|
74
72
|
"chai": "4.4.1",
|
|
75
73
|
"chai-as-promised": "7.1.1",
|
|
76
74
|
"cpx2": "7.0.1",
|
|
77
75
|
"cross-env": "7.0.3",
|
|
78
76
|
"del-cli": "5.1.0",
|
|
79
|
-
"eslint": "8.
|
|
77
|
+
"eslint": "8.57.0",
|
|
80
78
|
"eslint-config-prettier": "9.1.0",
|
|
81
79
|
"eslint-plugin-import": "2.29.1",
|
|
82
|
-
"eslint-plugin-
|
|
83
|
-
"eslint-plugin-
|
|
80
|
+
"eslint-plugin-jest": "28.2.0",
|
|
81
|
+
"eslint-plugin-jest-extended": "^2.4.0",
|
|
82
|
+
"eslint-plugin-jsdoc": "48.2.3",
|
|
83
|
+
"eslint-plugin-no-autofix": "2.0.0",
|
|
84
84
|
"eslint-plugin-only-warn": "1.1.0",
|
|
85
85
|
"globby": "14.0.0",
|
|
86
86
|
"in-publish": "2.0.1",
|
|
87
87
|
"jest": "29.7.0",
|
|
88
88
|
"jest-enhanced-resolve": "1.0.1",
|
|
89
89
|
"jest-environment-jsdom": "29.7.0",
|
|
90
|
+
"jest-extended": "4.0.2",
|
|
90
91
|
"jest-mock": "29.7.0",
|
|
91
92
|
"jest-testdouble": "2.1.0",
|
|
92
93
|
"jest-util": "29.7.0",
|
|
@@ -104,6 +105,7 @@
|
|
|
104
105
|
"testdouble": "3.20.1",
|
|
105
106
|
"typedoc": "0.25.7",
|
|
106
107
|
"typescript": "~5.3.3",
|
|
108
|
+
"typescript-eslint": "7.8.0",
|
|
107
109
|
"typescript-strict-plugin": "^2.4.3",
|
|
108
110
|
"weaktuplemap": "1.0.0",
|
|
109
111
|
"whatwg-fetch": "3.6.20"
|
|
@@ -120,7 +122,6 @@
|
|
|
120
122
|
"pre-commit": "npx lint-staged"
|
|
121
123
|
},
|
|
122
124
|
"lint-staged": {
|
|
123
|
-
"*.{js,json,ts,md,xml,xsd}": "prettier --write"
|
|
124
|
-
"*.{ts, tsx}": "eslint --max-warnings 0"
|
|
125
|
+
"*.{js,json,ts,md,xml,xsd}": "prettier --write"
|
|
125
126
|
}
|
|
126
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as e}from"tslib";import t from"@arcgis/core/core/Collection";import i from"@arcgis/core/geometry/Point";import{distance as r}from"@arcgis/core/geometry/geometryEngineAsync";import{isLayerExtension as a,isMapExtension as o,isSublayerExtension as s}from"../../ItemType.js";import{SCORE_FIELD as n,SCORE_FIELD_ORIGINAL as c}from"../../data/Feature.js";import{MapExtension as l}from"../../mapping/MapExtension.js";import{cancelify as p}from"../../support/Cancellable.js";import{InitializableBase as u}from"../../support/InitializableBase.js";import{serializable as m}from"../../support/Serializable.js";import{isCancellation as f}from"../../support/utilities.js";import{groupBy as d}from"../../utilities/array.js";import{AsyncQueue as w}from"../../utilities/asyncIterable.js";import{checkArg as h}from"../../utilities/checkArg.js";import{isMap as y}from"../../utilities/mapping.js";import{parallelEach as g}from"../../utilities/promise.js";import{SearchError as S}from"./SearchError.js";import{SearchOptions as v}from"./SearchOptions.js";let
|
|
1
|
+
import{__decorate as e}from"tslib";import t from"@arcgis/core/core/Collection";import i from"@arcgis/core/geometry/Point";import{distance as r}from"@arcgis/core/geometry/geometryEngineAsync";import{isLayerExtension as a,isMapExtension as o,isSublayerExtension as s}from"../../ItemType.js";import{SCORE_FIELD as n,SCORE_FIELD_ORIGINAL as c}from"../../data/Feature.js";import{MapExtension as l}from"../../mapping/MapExtension.js";import{cancelify as p}from"../../support/Cancellable.js";import{InitializableBase as u}from"../../support/InitializableBase.js";import{serializable as m}from"../../support/Serializable.js";import{isCancellation as f}from"../../support/utilities.js";import{groupBy as d}from"../../utilities/array.js";import{AsyncQueue as w}from"../../utilities/asyncIterable.js";import{checkArg as h}from"../../utilities/checkArg.js";import{isMap as y}from"../../utilities/mapping.js";import{parallelEach as g}from"../../utilities/promise.js";import{SearchError as S}from"./SearchError.js";import{SearchOptions as v}from"./SearchOptions.js";let j=class extends u{providers=new t;isSupported(e){return!!this.providers.find((t=>t.isSupported(e)))}search(e,a,s){h("sources",e).isNotMissing();const n={...v.DEFAULTS,...s},{outSpatialReference:c,onSourceComplete:p}=n;let u,m=[];t.isCollection(e)?m=e.toArray():o(e)?u=e:y(e)?u=new l({map:e}):m=[...e];let j=0;const z=new w,b=new Map,A=(e,t)=>{if(!t||0===e.length)return;j++;const o=new Map;for(const t of e)o.set(t,{source:t,count:0,time:-1});(async()=>{const l=await async function(e){if(!e.near||!e.initialSearchArea?.extent?.spatialReference.equals(e.near.spatialReference))return;const{extent:t}=e.initialSearchArea,{spatialReference:a}=t,[o,s,n,c]=await Promise.all([r(new i({x:t.xmin,y:t.ymin,spatialReference:a}),e.near,void 0),r(new i({x:t.xmin,y:t.ymax,spatialReference:a}),e.near,void 0),r(new i({x:t.xmax,y:t.ymin,spatialReference:a}),e.near,void 0),r(new i({x:t.xmax,y:t.ymax,spatialReference:a}),e.near,void 0)]);return Math.max(o,s,n,c)}(n),u=[];try{if(z.isDone)return;const i=Date.now();await g(e,(e=>e.initialize()));for await(const r of t.search(e,a,s)){const e=o.get(r.source);if(e&&(e.count++,e.time<0&&(e.time=Date.now()-i)),z.isDone)return;c&&(r.schema.spatialReference=c),await x(r,l,s);let t=!1;u.push(r.attributes.on("change",(async()=>{t||(t=!0,await x(r,l,s),t=!1)}))),z.add(r)}for(const t of e){const e=o.get(t);e&&e.time<0&&(e.time=Date.now()-i)}}catch(t){for(const i of e){o.get(i).failureReason=t}if(f(t))return void z.reject(t);b.set(e,t)}finally{u.forEach((e=>e.remove()));for(const t of e){const e=o.get(t);p?.(e)}}0==--j&&(b.size?z.reject(new S(b)):z.done())})()};return(async()=>{try{u&&(await u.initialize(),m=u.getAllFeatureSources(isSearchable))}catch(e){z.reject(new Error("Map failed to initialize.",{cause:e}))}await this.initialize(),d(m,(e=>this.providers.find((t=>t.isSupported(e))))).forEach(A),0===j&&z.done()})(),z}count(e,i,r){h("sources",e).isNotMissing();const a={...r,returnGeometry:!1};let s,n=[];t.isCollection(e)?n=e.toArray():o(e)?s=e:y(e)?s=new l({map:e}):n=[...e];let c=0;const p=new w,u=new Map,m=(e,t)=>{t&&(c++,(async()=>{if(!p.isDone){try{if(await g(e,(e=>e.initialize())),p.isDone)return;p.addMany(await t.count(e,i,a))}catch(t){if(f(t))return void p.reject(t);u.set(e,t)}0==--c&&(u.size?p.reject(new S(u)):p.done())}})())};return(async()=>{try{s&&(await s.initialize(),n=s.getAllFeatureSources(isSearchable))}catch(e){p.reject(new Error("Map failed to initialize.",{cause:e}))}await this.initialize(),d(n,(e=>this.providers.find((t=>t.isSupported(e))))).forEach(m),0===c&&p.done()})(),p}async suggest(e,t,i){h("sources",e).isNotMissing();const r={...v.DEFAULTS,...i};return p(this._suggest(e,t,r),r.cancelToken)}async _onInitialize(){await super._onInitialize();const{QuerySearchProvider:e,ArcGISGeocoderSearchProvider:t,GeocoderSearchProvider:i}=await import("./defaultProviders.js"),r=new e;await r.queryService.initialize(),this.providers.add(r),this.providers.add(new t),this.providers.add(new i)}async _suggest(e,i,r){let a,s=[];t.isCollection(e)?s=e.toArray():o(e)?a=e:y(e)?a=new l({map:e}):s=[...e];const n=[];if(a)try{await a.initialize(),s=a.getAllFeatureSources(isSearchable)}catch(e){throw new Error("Map failed to initialize.",{cause:e})}await this.initialize();const c=d(s,(e=>this.providers.find((t=>t.isSupported(e)))));return await g(c.entries(),(async([e,t])=>{if(e)try{const a=await e.suggest(t,i,r);for(const e of a){const t=n.findIndex((t=>t.suggestion===e.suggestion));t>=0?e.score>n[t].score&&(n[t]=e):n.push(e)}}catch(e){throw f(e)?e:new S([[t,e]])}})),n.sort(((e,t)=>t.score-e.score)).slice(0,r.maxSuggestions)}};j=e([m],j);export{j as SearchService};export function isSearchable(e){return!!e.taskSettings.enableSearch&&(a(e)?e.layer?.visible:!s(e)||e.sublayer?.visible)}async function x(e,t,i){if(!(t&&i.near&&i.initialSearchArea&&e.geometry&&i.near.spatialReference.equals(e.geometry.spatialReference)&&e.attributes.has(n)))return;const a=(t-await r(e.geometry,i.near,void 0))/t,o=(2*e.attributes.get(c)+a)/3;e.attributes.set(n,o)}
|
package/version.d.ts
CHANGED
package/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version="45.5.
|
|
1
|
+
export const version="45.5.2";
|