@arcgis/coding-components 4.31.0-next.10 → 4.31.0-next.13
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/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
- package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +29 -7
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-8cf09bcc.js → p-0238f1c9.js} +1 -1
- package/dist/arcgis-coding-components/p-056c22f6.js +6 -0
- package/dist/arcgis-coding-components/{p-193ac44f.js → p-30a27259.js} +1 -1
- package/dist/arcgis-coding-components/{p-8196fa73.js → p-46ee5802.js} +2 -2
- package/dist/arcgis-coding-components/{p-960aa9dc.js → p-48800c64.js} +2 -2
- package/dist/arcgis-coding-components/{p-6e28fd70.js → p-5f9d02cd.js} +2 -2
- package/dist/arcgis-coding-components/p-6b06bf1f.entry.js +6 -0
- package/dist/arcgis-coding-components/{p-4fc79a07.entry.js → p-6dd5c8ac.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-767b17ee.entry.js → p-70be15ef.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-ad75160d.js → p-7ce92237.js} +3 -3
- package/dist/arcgis-coding-components/p-7db90261.js +6 -0
- package/dist/arcgis-coding-components/{p-ab78d6c4.js → p-817249dc.js} +3 -3
- package/dist/arcgis-coding-components/{p-790067b1.js → p-9521dcf8.js} +12 -12
- package/dist/arcgis-coding-components/{p-da9431ba.js → p-af89dfbf.js} +2 -2
- package/dist/arcgis-coding-components/{p-923858b5.js → p-b3831336.js} +2 -2
- package/dist/arcgis-coding-components/{p-02cae55d.js → p-b7351b5a.js} +3 -3
- package/dist/arcgis-coding-components/{p-22253750.js → p-dc1f177d.js} +1 -1
- package/dist/arcgis-coding-components/p-e8f28ec2.js +6 -0
- package/dist/arcgis-coding-components/p-f6939275.js +6 -0
- package/dist/cjs/{app-globals-bade840e.js → app-globals-5c2eb6c4.js} +1 -1
- package/dist/cjs/arcade-defaults-f0f15084.js +349 -0
- package/dist/cjs/{arcade-language-features-747fb1da.js → arcade-language-features-d1ca02a6.js} +2 -2
- package/dist/cjs/{arcade-mode-dce44622.js → arcade-mode-f16e383a.js} +3 -4
- package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +7 -14
- package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
- package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
- package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
- package/dist/cjs/{css-077ba0c5.js → css-f9c7e7cd.js} +1 -1
- package/dist/cjs/{cssMode-7f2030db.js → cssMode-22b5188b.js} +2 -3
- package/dist/cjs/{html-e3a243e9.js → html-35ace5ce.js} +2 -3
- package/dist/cjs/{htmlMode-c273d6dc.js → htmlMode-03149da9.js} +2 -3
- package/dist/cjs/{index-37a86ff4.js → index-168881c0.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{javascript-7a33cca7.js → javascript-20775679.js} +3 -4
- package/dist/cjs/{jsonMode-6b4e0850.js → jsonMode-74a5f024.js} +2 -3
- package/dist/cjs/{language-defaults-base-b32cb091.js → language-defaults-base-9b48f557.js} +800 -1024
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{sql-expr-defaults-8a5834f3.js → sql-expr-defaults-7c0204a1.js} +78 -24
- package/dist/cjs/{sql-expr-mode-a72a1f92.js → sql-expr-mode-5d08be72.js} +19971 -20969
- package/dist/cjs/{tsMode-c2edcd57.js → tsMode-8ed4166e.js} +2 -3
- package/dist/cjs/{typescript-c50c5516.js → typescript-821d6d32.js} +2 -3
- package/dist/components/arcade-defaults.js +238 -4
- package/dist/components/arcade-language-features.js +1 -1
- package/dist/components/arcade-mode.js +1 -1
- package/dist/components/arcade-results.js +3 -3
- package/dist/components/arcade-suggestions.js +2 -2
- package/dist/components/arcade-variables.js +2 -2
- package/dist/components/arcgis-arcade-editor.js +2 -2
- package/dist/components/arcgis-arcade-results.js +1 -1
- package/dist/components/arcgis-arcade-suggestions.js +1 -1
- package/dist/components/arcgis-arcade-variables.js +1 -1
- package/dist/components/arcgis-assets.d.ts +1 -1
- package/dist/components/arcgis-assets.js +1 -1
- package/dist/components/arcgis-code-editor.js +1 -1
- package/dist/components/arcgis-language-api-panel.js +1 -1
- package/dist/components/arcgis-sql-expression-editor.js +2 -2
- package/dist/components/arcgis-sql-expression-fields.js +1 -1
- package/dist/components/{chunk-3IUJHIAA.js → chunk-2JTWBRMN.js} +2 -2
- package/dist/components/code-editor.js +7 -14
- package/dist/components/fields.js +4 -4
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/language-api-panel.js +2 -2
- package/dist/components/language-defaults-base.js +47 -273
- package/dist/components/markdown.js +1 -1
- package/dist/components/sql-expr-defaults.js +77 -24
- package/dist/components/sql-expr-mode.js +19969 -20967
- package/dist/components/sql-expression-fields.js +2 -2
- package/dist/components/useT9n.js +2 -2
- package/dist/components/utilities.js +1 -1
- package/dist/esm/{app-globals-ed47e16d.js → app-globals-b9f25e63.js} +1 -1
- package/dist/esm/arcade-defaults-0b98d37c.js +344 -0
- package/dist/esm/{arcade-language-features-8edb3527.js → arcade-language-features-ca303d47.js} +2 -2
- package/dist/esm/{arcade-mode-ad036f46.js → arcade-mode-fca51be8.js} +3 -4
- package/dist/esm/arcgis-arcade-editor_6.entry.js +8 -15
- package/dist/esm/arcgis-coding-components.js +4 -4
- package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
- package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
- package/dist/esm/{css-810518f1.js → css-ba350248.js} +1 -1
- package/dist/esm/{cssMode-a7208024.js → cssMode-d8267564.js} +2 -3
- package/dist/esm/{html-e187d7d8.js → html-8ed39dee.js} +2 -3
- package/dist/esm/{htmlMode-06b7bae2.js → htmlMode-b26c455f.js} +2 -3
- package/dist/esm/{index-3743d31f.js → index-658e1601.js} +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/{javascript-04a3f866.js → javascript-a8c18cd8.js} +3 -4
- package/dist/esm/{jsonMode-ee8bb2ea.js → jsonMode-1a25e1fd.js} +2 -3
- package/dist/esm/{language-defaults-base-52a397f5.js → language-defaults-base-8d2a6ab5.js} +797 -1024
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{sql-expr-defaults-f7c2d5ef.js → sql-expr-defaults-02ec1eb4.js} +78 -25
- package/dist/esm/{sql-expr-mode-433b4a39.js → sql-expr-mode-6e9cd3f1.js} +19971 -20970
- package/dist/esm/{tsMode-c80c462e.js → tsMode-36db3afb.js} +2 -3
- package/dist/esm/{typescript-a9b8caa7.js → typescript-8ff4383d.js} +2 -3
- package/dist/loader/cdn.js +1 -1
- package/dist/loader/index.cjs.js +1 -1
- package/dist/loader/index.es2017.js +1 -1
- package/dist/loader/index.js +1 -1
- package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
- package/dist/types/utils/fields.d.ts +2 -2
- package/dist/types/utils/profile/editor-profile.d.ts +7 -6
- package/dist/types/utils/profile/types.d.ts +3 -0
- package/dist/types/utils/profile/utils.d.ts +4 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +45 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -11
- package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +0 -1
- package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +17 -39
- package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +34 -1
- package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +0 -7
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +6 -5
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +3 -3
- package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +2 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +9 -6
- package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +9 -0
- package/dist/types/utils/sql-expr-monaco/types.d.ts +4 -6
- package/package.json +10 -10
- package/dist/arcgis-coding-components/p-025fda85.js +0 -6
- package/dist/arcgis-coding-components/p-50484a4f.js +0 -6
- package/dist/arcgis-coding-components/p-7164c348.js +0 -6
- package/dist/arcgis-coding-components/p-9956a574.js +0 -6
- package/dist/arcgis-coding-components/p-f452d4b8.entry.js +0 -6
- package/dist/cjs/arcade-defaults-8b8d6c07.js +0 -116
- package/dist/esm/arcade-defaults-562fe19b.js +0 -111
- package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
- package/dist/types/utils/sql-expr-monaco/libraries/date/properties/index.d.ts +0 -59
- package/dist/types/utils/sql-expr-monaco/libraries/numeric/properties/index.d.ts +0 -295
- package/dist/types/utils/sql-expr-monaco/libraries/string/properties/index.d.ts +0 -135
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-adapter.d.ts +0 -3
- package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.13
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const index = require('./index-37a86ff4.js');
|
|
9
|
-
|
|
10
8
|
function _interopNamespace(e) {
|
|
11
9
|
if (e && e.__esModule) return e;
|
|
12
10
|
var n = Object.create(null);
|
|
@@ -120616,7 +120614,7 @@ registerLanguage({
|
|
|
120616
120614
|
mimetypes: ["text/css"],
|
|
120617
120615
|
loader: () => {
|
|
120618
120616
|
{
|
|
120619
|
-
return Promise.resolve().then(function () { return require('./css-
|
|
120617
|
+
return Promise.resolve().then(function () { return require('./css-f9c7e7cd.js'); });
|
|
120620
120618
|
}
|
|
120621
120619
|
}
|
|
120622
120620
|
});
|
|
@@ -120634,7 +120632,7 @@ registerLanguage({
|
|
|
120634
120632
|
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
|
|
120635
120633
|
loader: () => {
|
|
120636
120634
|
{
|
|
120637
|
-
return Promise.resolve().then(function () { return require('./html-
|
|
120635
|
+
return Promise.resolve().then(function () { return require('./html-35ace5ce.js'); });
|
|
120638
120636
|
}
|
|
120639
120637
|
}
|
|
120640
120638
|
});
|
|
@@ -120654,7 +120652,7 @@ registerLanguage({
|
|
|
120654
120652
|
mimetypes: ["text/javascript"],
|
|
120655
120653
|
loader: () => {
|
|
120656
120654
|
{
|
|
120657
|
-
return Promise.resolve().then(function () { return require('./javascript-
|
|
120655
|
+
return Promise.resolve().then(function () { return require('./javascript-20775679.js'); });
|
|
120658
120656
|
}
|
|
120659
120657
|
}
|
|
120660
120658
|
});
|
|
@@ -120672,7 +120670,7 @@ registerLanguage({
|
|
|
120672
120670
|
mimetypes: ["text/typescript"],
|
|
120673
120671
|
loader: () => {
|
|
120674
120672
|
{
|
|
120675
|
-
return Promise.resolve().then(function () { return require('./typescript-
|
|
120673
|
+
return Promise.resolve().then(function () { return require('./typescript-821d6d32.js'); });
|
|
120676
120674
|
}
|
|
120677
120675
|
}
|
|
120678
120676
|
});
|
|
@@ -120793,7 +120791,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3("less", optionsDefault$1, m
|
|
|
120793
120791
|
monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
|
|
120794
120792
|
function getMode$3() {
|
|
120795
120793
|
{
|
|
120796
|
-
return Promise.resolve().then(function () { return require('./cssMode-
|
|
120794
|
+
return Promise.resolve().then(function () { return require('./cssMode-22b5188b.js'); });
|
|
120797
120795
|
}
|
|
120798
120796
|
}
|
|
120799
120797
|
monaco_editor_core_exports$3.languages.onLanguage("less", () => {
|
|
@@ -120918,7 +120916,7 @@ monaco_editor_core_exports$2.languages.html = {
|
|
|
120918
120916
|
};
|
|
120919
120917
|
function getMode$2() {
|
|
120920
120918
|
{
|
|
120921
|
-
return Promise.resolve().then(function () { return require('./htmlMode-
|
|
120919
|
+
return Promise.resolve().then(function () { return require('./htmlMode-03149da9.js'); });
|
|
120922
120920
|
}
|
|
120923
120921
|
}
|
|
120924
120922
|
function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
|
|
@@ -121020,7 +121018,7 @@ var jsonDefaults = new LanguageServiceDefaultsImpl$1("json", diagnosticDefault,
|
|
|
121020
121018
|
monaco_editor_core_exports$1.languages.json = { jsonDefaults };
|
|
121021
121019
|
function getMode$1() {
|
|
121022
121020
|
{
|
|
121023
|
-
return Promise.resolve().then(function () { return require('./jsonMode-
|
|
121021
|
+
return Promise.resolve().then(function () { return require('./jsonMode-74a5f024.js'); });
|
|
121024
121022
|
}
|
|
121025
121023
|
}
|
|
121026
121024
|
monaco_editor_core_exports$1.languages.register({
|
|
@@ -121289,7 +121287,7 @@ monaco_editor_core_exports.languages.typescript = {
|
|
|
121289
121287
|
};
|
|
121290
121288
|
function getMode() {
|
|
121291
121289
|
{
|
|
121292
|
-
return Promise.resolve().then(function () { return require('./tsMode-
|
|
121290
|
+
return Promise.resolve().then(function () { return require('./tsMode-8ed4166e.js'); });
|
|
121293
121291
|
}
|
|
121294
121292
|
}
|
|
121295
121293
|
monaco_editor_core_exports.languages.onLanguage("typescript", () => {
|
|
@@ -166736,6 +166734,760 @@ class ToggleHighContrast extends EditorAction {
|
|
|
166736
166734
|
}
|
|
166737
166735
|
registerEditorAction(ToggleHighContrast);
|
|
166738
166736
|
|
|
166737
|
+
// src/index.ts
|
|
166738
|
+
var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis && !("forceESM" in window.$arcgis);
|
|
166739
|
+
function isDefaultModule(module) {
|
|
166740
|
+
return module.default !== void 0;
|
|
166741
|
+
}
|
|
166742
|
+
async function importLayersFeatureLayer() {
|
|
166743
|
+
if (isAMD) {
|
|
166744
|
+
return await window.$arcgis.import("esri/layers/FeatureLayer");
|
|
166745
|
+
}
|
|
166746
|
+
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/layers/FeatureLayer.js')); });
|
|
166747
|
+
return isDefaultModule(module) ? module.default : module;
|
|
166748
|
+
}
|
|
166749
|
+
async function newLayersFeatureLayer(properties) {
|
|
166750
|
+
const ModConstructor = await importLayersFeatureLayer();
|
|
166751
|
+
return new ModConstructor(properties);
|
|
166752
|
+
}
|
|
166753
|
+
async function importPortalPortalItem() {
|
|
166754
|
+
if (isAMD) {
|
|
166755
|
+
return await window.$arcgis.import("esri/portal/PortalItem");
|
|
166756
|
+
}
|
|
166757
|
+
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/portal/PortalItem.js')); });
|
|
166758
|
+
return isDefaultModule(module) ? module.default : module;
|
|
166759
|
+
}
|
|
166760
|
+
async function newPortalPortalItem(properties) {
|
|
166761
|
+
const ModConstructor = await importPortalPortalItem();
|
|
166762
|
+
return new ModConstructor(properties);
|
|
166763
|
+
}
|
|
166764
|
+
async function importWebMap() {
|
|
166765
|
+
if (isAMD) {
|
|
166766
|
+
return await window.$arcgis.import("esri/WebMap");
|
|
166767
|
+
}
|
|
166768
|
+
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebMap.js')); });
|
|
166769
|
+
return isDefaultModule(module) ? module.default : module;
|
|
166770
|
+
}
|
|
166771
|
+
async function newWebMap(properties) {
|
|
166772
|
+
const ModConstructor = await importWebMap();
|
|
166773
|
+
return new ModConstructor(properties);
|
|
166774
|
+
}
|
|
166775
|
+
async function importWebScene() {
|
|
166776
|
+
if (isAMD) {
|
|
166777
|
+
return await window.$arcgis.import("esri/WebScene");
|
|
166778
|
+
}
|
|
166779
|
+
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebScene.js')); });
|
|
166780
|
+
return isDefaultModule(module) ? module.default : module;
|
|
166781
|
+
}
|
|
166782
|
+
async function newWebScene(properties) {
|
|
166783
|
+
const ModConstructor = await importWebScene();
|
|
166784
|
+
return new ModConstructor(properties);
|
|
166785
|
+
}
|
|
166786
|
+
async function importArcade() {
|
|
166787
|
+
if (isAMD) {
|
|
166788
|
+
return await window.$arcgis.import("esri/arcade");
|
|
166789
|
+
}
|
|
166790
|
+
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/arcade.js')); });
|
|
166791
|
+
return isDefaultModule(module) ? module.default : module;
|
|
166792
|
+
}
|
|
166793
|
+
async function importRequest() {
|
|
166794
|
+
if (isAMD) {
|
|
166795
|
+
return await window.$arcgis.import("esri/request");
|
|
166796
|
+
}
|
|
166797
|
+
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/request.js')); });
|
|
166798
|
+
return isDefaultModule(module) ? module.default : module;
|
|
166799
|
+
}
|
|
166800
|
+
|
|
166801
|
+
//#region Type Guards
|
|
166802
|
+
function isFeatureLayerLikeInstance(item) {
|
|
166803
|
+
return (!!item &&
|
|
166804
|
+
typeof item === "object" &&
|
|
166805
|
+
"declaredClass" in item &&
|
|
166806
|
+
typeof item.declaredClass === "string" &&
|
|
166807
|
+
item.declaredClass.startsWith("esri.layers.") &&
|
|
166808
|
+
isFieldsDefinition(item) &&
|
|
166809
|
+
"queryFeatures" in item &&
|
|
166810
|
+
typeof item.queryFeatures === "function");
|
|
166811
|
+
}
|
|
166812
|
+
function isGroupLayerCapable(item) {
|
|
166813
|
+
return (!!item &&
|
|
166814
|
+
typeof item === "object" &&
|
|
166815
|
+
"allLayers" in item &&
|
|
166816
|
+
"allTables" in item &&
|
|
166817
|
+
typeof item.allLayers === "object" &&
|
|
166818
|
+
typeof item.allTables === "object");
|
|
166819
|
+
}
|
|
166820
|
+
function isMapInstance(item) {
|
|
166821
|
+
return (!!item &&
|
|
166822
|
+
typeof item === "object" &&
|
|
166823
|
+
"declaredClass" in item &&
|
|
166824
|
+
typeof item.declaredClass === "string" &&
|
|
166825
|
+
(item.declaredClass === "esri.Map" ||
|
|
166826
|
+
item.declaredClass === "esri.WebMap" ||
|
|
166827
|
+
item.declaredClass === "esri.WebScene"));
|
|
166828
|
+
}
|
|
166829
|
+
function isLoadAllCapable(item) {
|
|
166830
|
+
return !!item && typeof item === "object" && "loadAll" in item && typeof item.loadAll === "function";
|
|
166831
|
+
}
|
|
166832
|
+
function isPortalItemDefinition(item) {
|
|
166833
|
+
return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
|
|
166834
|
+
}
|
|
166835
|
+
function isFeatureLayerItemDefinition(item) {
|
|
166836
|
+
return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
|
|
166837
|
+
}
|
|
166838
|
+
function isFieldsDefinition(item) {
|
|
166839
|
+
return !!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields);
|
|
166840
|
+
}
|
|
166841
|
+
function isUrlDefinition(item) {
|
|
166842
|
+
return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
|
|
166843
|
+
}
|
|
166844
|
+
function isSupportedServiceUrlDefinition(item) {
|
|
166845
|
+
return isUrlDefinition(item) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(item.url);
|
|
166846
|
+
}
|
|
166847
|
+
function isFeatureDefinition(item) {
|
|
166848
|
+
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
166849
|
+
}
|
|
166850
|
+
function isFeatureSetDefinition(item) {
|
|
166851
|
+
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
166852
|
+
}
|
|
166853
|
+
function isFeatureSetCollectionDefinition(item) {
|
|
166854
|
+
return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
|
|
166855
|
+
}
|
|
166856
|
+
function isSubtypeInstance(item) {
|
|
166857
|
+
return (!!item &&
|
|
166858
|
+
typeof item === "object" &&
|
|
166859
|
+
"declaredClass" in item &&
|
|
166860
|
+
item.declaredClass === "esri.layers.support.Subtype");
|
|
166861
|
+
}
|
|
166862
|
+
function isCodedValueDomainInstance(item) {
|
|
166863
|
+
return (!!item &&
|
|
166864
|
+
typeof item === "object" &&
|
|
166865
|
+
"declaredClass" in item &&
|
|
166866
|
+
item.declaredClass === "esri.layers.support.CodedValueDomain");
|
|
166867
|
+
}
|
|
166868
|
+
function isInheritedDomainInstance(item) {
|
|
166869
|
+
return (!!item &&
|
|
166870
|
+
typeof item === "object" &&
|
|
166871
|
+
"declaredClass" in item &&
|
|
166872
|
+
item.declaredClass === "esri.layers.support.InheritedDomain");
|
|
166873
|
+
}
|
|
166874
|
+
function isPredefinedProfile(item) {
|
|
166875
|
+
return (!!item &&
|
|
166876
|
+
typeof item === "object" &&
|
|
166877
|
+
"id" in item &&
|
|
166878
|
+
typeof item.id === "string" &&
|
|
166879
|
+
"definitions" in item &&
|
|
166880
|
+
typeof item.definitions === "object" &&
|
|
166881
|
+
!Array.isArray(item.definitions));
|
|
166882
|
+
}
|
|
166883
|
+
function isTitleCapableSource(item) {
|
|
166884
|
+
return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
|
|
166885
|
+
}
|
|
166886
|
+
function isUrlCapableSource(item) {
|
|
166887
|
+
return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
|
|
166888
|
+
}
|
|
166889
|
+
function isLayerIdCapableSource(item) {
|
|
166890
|
+
return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
|
|
166891
|
+
}
|
|
166892
|
+
function isFeatureTypesCapableLayer(item) {
|
|
166893
|
+
return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
|
|
166894
|
+
}
|
|
166895
|
+
function isDomainsCapableLayer(item) {
|
|
166896
|
+
return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
|
|
166897
|
+
}
|
|
166898
|
+
function isSubtypeFieldCapableLayer(item) {
|
|
166899
|
+
return !!item && typeof item === "object" && "subtypeField" in item;
|
|
166900
|
+
}
|
|
166901
|
+
function isSubtypesCapableLayer(item) {
|
|
166902
|
+
return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
|
|
166903
|
+
}
|
|
166904
|
+
function isPortalItemCapable(item) {
|
|
166905
|
+
return !!item && typeof item === "object" && "portalItem" in item;
|
|
166906
|
+
}
|
|
166907
|
+
function isRelationshipsCapableLayer(item) {
|
|
166908
|
+
return (isLayerIdCapableSource(item) &&
|
|
166909
|
+
"relationships" in item &&
|
|
166910
|
+
"url" in item &&
|
|
166911
|
+
Array.isArray(item.relationships) &&
|
|
166912
|
+
typeof item.url === "string");
|
|
166913
|
+
}
|
|
166914
|
+
function isTableCapableLayer(item) {
|
|
166915
|
+
return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
|
|
166916
|
+
}
|
|
166917
|
+
function isLoadableSource(item) {
|
|
166918
|
+
return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
|
|
166919
|
+
}
|
|
166920
|
+
//#endregion
|
|
166921
|
+
//#region Service Metadata
|
|
166922
|
+
async function supportedSourceFromDefinition(definition) {
|
|
166923
|
+
if (!definition) {
|
|
166924
|
+
return null;
|
|
166925
|
+
}
|
|
166926
|
+
let source = null;
|
|
166927
|
+
if (isFieldsDefinition(definition)) {
|
|
166928
|
+
source = definition;
|
|
166929
|
+
}
|
|
166930
|
+
else {
|
|
166931
|
+
source = await newLayersFeatureLayer(definition);
|
|
166932
|
+
}
|
|
166933
|
+
if (isLoadableSource(source)) {
|
|
166934
|
+
await source.load();
|
|
166935
|
+
}
|
|
166936
|
+
return source;
|
|
166937
|
+
}
|
|
166938
|
+
async function serviceMetaData(url) {
|
|
166939
|
+
url += "/layers";
|
|
166940
|
+
const request = await importRequest();
|
|
166941
|
+
const response = await request(url, { responseType: "json", query: { f: "json" } });
|
|
166942
|
+
const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
|
|
166943
|
+
const layers = getSupportedLayerInfos(response.data?.layers, queryCapability);
|
|
166944
|
+
const tables = getSupportedLayerInfos(response.data?.tables, queryCapability);
|
|
166945
|
+
return { layers, tables };
|
|
166946
|
+
}
|
|
166947
|
+
function getSupportedLayerInfos(layers, queryCapability) {
|
|
166948
|
+
if (!layers) {
|
|
166949
|
+
return [];
|
|
166950
|
+
}
|
|
166951
|
+
return layers.filter((layer) => {
|
|
166952
|
+
switch (layer.type) {
|
|
166953
|
+
case "Feature Layer":
|
|
166954
|
+
case "Oriented Imagery Layer":
|
|
166955
|
+
case "Catalog Layer":
|
|
166956
|
+
case "Table": {
|
|
166957
|
+
const capabilities = layer.capabilities
|
|
166958
|
+
? layer.capabilities
|
|
166959
|
+
.toLowerCase()
|
|
166960
|
+
.split(",")
|
|
166961
|
+
.map((value) => value.trim())
|
|
166962
|
+
: [];
|
|
166963
|
+
return capabilities.includes(queryCapability);
|
|
166964
|
+
}
|
|
166965
|
+
default:
|
|
166966
|
+
return false;
|
|
166967
|
+
}
|
|
166968
|
+
});
|
|
166969
|
+
}
|
|
166970
|
+
//#endregion
|
|
166971
|
+
|
|
166972
|
+
// src/array-utils.ts
|
|
166973
|
+
|
|
166974
|
+
// src/deferred.ts
|
|
166975
|
+
var Deferred = class {
|
|
166976
|
+
/**
|
|
166977
|
+
* Resolves the promise.
|
|
166978
|
+
* @param value The value to resolve the promise with.
|
|
166979
|
+
*/
|
|
166980
|
+
resolve(_value) {
|
|
166981
|
+
}
|
|
166982
|
+
/**
|
|
166983
|
+
* Rejects the promise.
|
|
166984
|
+
*/
|
|
166985
|
+
reject(_error) {
|
|
166986
|
+
}
|
|
166987
|
+
/**
|
|
166988
|
+
* Creates a new deferred promise.
|
|
166989
|
+
*/
|
|
166990
|
+
constructor() {
|
|
166991
|
+
this.promise = new Promise((resolve, reject) => {
|
|
166992
|
+
this.resolve = resolve;
|
|
166993
|
+
this.reject = reject;
|
|
166994
|
+
});
|
|
166995
|
+
}
|
|
166996
|
+
};
|
|
166997
|
+
|
|
166998
|
+
// src/dom.ts
|
|
166999
|
+
function inTargetElement(element, targetElement) {
|
|
167000
|
+
let currentElement = element;
|
|
167001
|
+
while (currentElement) {
|
|
167002
|
+
if (currentElement === targetElement) {
|
|
167003
|
+
return true;
|
|
167004
|
+
}
|
|
167005
|
+
if (!currentElement.parentNode) {
|
|
167006
|
+
return false;
|
|
167007
|
+
}
|
|
167008
|
+
if (currentElement.parentNode instanceof ShadowRoot) {
|
|
167009
|
+
currentElement = currentElement.parentNode.host;
|
|
167010
|
+
} else {
|
|
167011
|
+
currentElement = currentElement.parentNode;
|
|
167012
|
+
}
|
|
167013
|
+
}
|
|
167014
|
+
return false;
|
|
167015
|
+
}
|
|
167016
|
+
function observeAncestorsMutation(element, attributeFilter, callback) {
|
|
167017
|
+
const { subscribe } = observe(attributeFilter);
|
|
167018
|
+
return subscribe((mutations) => {
|
|
167019
|
+
const matched = mutations.some((mutation) => inTargetElement(element, mutation.target));
|
|
167020
|
+
if (matched) {
|
|
167021
|
+
callback();
|
|
167022
|
+
}
|
|
167023
|
+
});
|
|
167024
|
+
}
|
|
167025
|
+
var observers = {};
|
|
167026
|
+
function observe(attributeFilter) {
|
|
167027
|
+
const attributes = attributeFilter.join(",");
|
|
167028
|
+
const previousObserver = observers[attributes];
|
|
167029
|
+
if (previousObserver !== void 0) {
|
|
167030
|
+
return previousObserver;
|
|
167031
|
+
}
|
|
167032
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
167033
|
+
const mutationObserver = new MutationObserver((mutations) => subscribers.forEach((callback) => callback(mutations)));
|
|
167034
|
+
mutationObserver.observe(document.documentElement, {
|
|
167035
|
+
attributes: true,
|
|
167036
|
+
attributeFilter,
|
|
167037
|
+
subtree: true
|
|
167038
|
+
});
|
|
167039
|
+
const observer = {
|
|
167040
|
+
subscribe(callback) {
|
|
167041
|
+
subscribers.add(callback);
|
|
167042
|
+
return {
|
|
167043
|
+
remove: () => {
|
|
167044
|
+
subscribers.delete(callback);
|
|
167045
|
+
if (subscribers.size === 0) {
|
|
167046
|
+
mutationObserver.disconnect();
|
|
167047
|
+
observers[attributes] = void 0;
|
|
167048
|
+
}
|
|
167049
|
+
}
|
|
167050
|
+
};
|
|
167051
|
+
}
|
|
167052
|
+
};
|
|
167053
|
+
observers[attributes] = observer;
|
|
167054
|
+
return observer;
|
|
167055
|
+
}
|
|
167056
|
+
function closestElement(base, selector) {
|
|
167057
|
+
let currentElement = base;
|
|
167058
|
+
while (currentElement) {
|
|
167059
|
+
const element = currentElement.closest(selector);
|
|
167060
|
+
if (element) {
|
|
167061
|
+
return element;
|
|
167062
|
+
}
|
|
167063
|
+
const rootElement = currentElement.getRootNode();
|
|
167064
|
+
if (rootElement === document) {
|
|
167065
|
+
return null;
|
|
167066
|
+
}
|
|
167067
|
+
currentElement = rootElement.host;
|
|
167068
|
+
}
|
|
167069
|
+
return null;
|
|
167070
|
+
}
|
|
167071
|
+
function getElementTheme(base) {
|
|
167072
|
+
const themeElt = closestElement(base, ":is(.calcite-mode-light, .calcite-mode-dark)");
|
|
167073
|
+
return themeElt && themeElt.classList.contains("calcite-mode-dark") ? "dark" : "light";
|
|
167074
|
+
}
|
|
167075
|
+
function getElementAttribute(el, prop, fallbackValue) {
|
|
167076
|
+
const closest = closestElement(el, `[${prop}]`);
|
|
167077
|
+
return closest?.getAttribute(prop) ?? fallbackValue;
|
|
167078
|
+
}
|
|
167079
|
+
function isElement(ref) {
|
|
167080
|
+
return ref.nodeType === Node.ELEMENT_NODE;
|
|
167081
|
+
}
|
|
167082
|
+
function isHTMLWithSetFocus(ref) {
|
|
167083
|
+
return "setFocus" in ref && typeof ref.setFocus === "function";
|
|
167084
|
+
}
|
|
167085
|
+
function setFocus(ref, selector = "") {
|
|
167086
|
+
if (!isElement(ref)) {
|
|
167087
|
+
return false;
|
|
167088
|
+
}
|
|
167089
|
+
if (ref.matches(selector)) {
|
|
167090
|
+
if (isHTMLWithSetFocus(ref)) {
|
|
167091
|
+
setTimeout(() => ref.setFocus(), 0);
|
|
167092
|
+
}
|
|
167093
|
+
return true;
|
|
167094
|
+
}
|
|
167095
|
+
for (const child of ref.children) {
|
|
167096
|
+
if (setFocus(child, selector)) {
|
|
167097
|
+
return true;
|
|
167098
|
+
}
|
|
167099
|
+
}
|
|
167100
|
+
const shadowRoot = ref.shadowRoot;
|
|
167101
|
+
if (shadowRoot) {
|
|
167102
|
+
for (const child of shadowRoot.children) {
|
|
167103
|
+
if (setFocus(child, selector)) {
|
|
167104
|
+
return true;
|
|
167105
|
+
}
|
|
167106
|
+
}
|
|
167107
|
+
}
|
|
167108
|
+
return false;
|
|
167109
|
+
}
|
|
167110
|
+
function setFocusOnElement(ref, selector) {
|
|
167111
|
+
if (!ref?.shadowRoot) {
|
|
167112
|
+
return;
|
|
167113
|
+
}
|
|
167114
|
+
if (ref.hasAttribute("hydrated") || ref.hasAttribute("calcite-hydrated")) {
|
|
167115
|
+
setFocus(ref, selector);
|
|
167116
|
+
return;
|
|
167117
|
+
}
|
|
167118
|
+
const mutationObserver = new MutationObserver(() => {
|
|
167119
|
+
mutationObserver.disconnect();
|
|
167120
|
+
setFocus(ref, selector);
|
|
167121
|
+
});
|
|
167122
|
+
mutationObserver.observe(ref, {
|
|
167123
|
+
attributes: true,
|
|
167124
|
+
attributeFilter: ["hydrated", "calcite-hydrated"]
|
|
167125
|
+
});
|
|
167126
|
+
}
|
|
167127
|
+
|
|
167128
|
+
// src/errors.ts
|
|
167129
|
+
function safeCall(callback, thisContext, ...rest) {
|
|
167130
|
+
try {
|
|
167131
|
+
return callback?.call(thisContext, ...rest);
|
|
167132
|
+
} catch (error) {
|
|
167133
|
+
console.error(error, callback);
|
|
167134
|
+
}
|
|
167135
|
+
return void 0;
|
|
167136
|
+
}
|
|
167137
|
+
async function safeAsyncCall(callback, thisContext, ...rest) {
|
|
167138
|
+
try {
|
|
167139
|
+
const result = callback?.call(thisContext, ...rest);
|
|
167140
|
+
return result instanceof Promise ? await result : result;
|
|
167141
|
+
} catch (error) {
|
|
167142
|
+
console.error(error, callback);
|
|
167143
|
+
}
|
|
167144
|
+
return void 0;
|
|
167145
|
+
}
|
|
167146
|
+
|
|
167147
|
+
// src/guid.ts
|
|
167148
|
+
function gen(count) {
|
|
167149
|
+
let out = "";
|
|
167150
|
+
for (let i = 0; i < count; i++) {
|
|
167151
|
+
out += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
167152
|
+
}
|
|
167153
|
+
return out;
|
|
167154
|
+
}
|
|
167155
|
+
function generateGuid() {
|
|
167156
|
+
return [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
|
|
167157
|
+
}
|
|
167158
|
+
|
|
167159
|
+
// src/intl.ts
|
|
167160
|
+
var supportedLocalesArray = [
|
|
167161
|
+
"ar",
|
|
167162
|
+
"bg",
|
|
167163
|
+
"bs",
|
|
167164
|
+
"ca",
|
|
167165
|
+
"cs",
|
|
167166
|
+
"da",
|
|
167167
|
+
"de",
|
|
167168
|
+
"el",
|
|
167169
|
+
"en",
|
|
167170
|
+
"es",
|
|
167171
|
+
"et",
|
|
167172
|
+
"fi",
|
|
167173
|
+
"fr",
|
|
167174
|
+
"he",
|
|
167175
|
+
"hr",
|
|
167176
|
+
"hu",
|
|
167177
|
+
"id",
|
|
167178
|
+
"it",
|
|
167179
|
+
"ja",
|
|
167180
|
+
"ko",
|
|
167181
|
+
"lt",
|
|
167182
|
+
"lv",
|
|
167183
|
+
"nl",
|
|
167184
|
+
"nb",
|
|
167185
|
+
"pl",
|
|
167186
|
+
"pt-BR",
|
|
167187
|
+
"pt-PT",
|
|
167188
|
+
"ro",
|
|
167189
|
+
"ru",
|
|
167190
|
+
"sk",
|
|
167191
|
+
"sl",
|
|
167192
|
+
"sr",
|
|
167193
|
+
"sv",
|
|
167194
|
+
"th",
|
|
167195
|
+
"tr",
|
|
167196
|
+
"uk",
|
|
167197
|
+
"vi",
|
|
167198
|
+
"zh-CN",
|
|
167199
|
+
"zh-HK",
|
|
167200
|
+
"zh-TW"
|
|
167201
|
+
];
|
|
167202
|
+
var supportedLocales = new Set(supportedLocalesArray);
|
|
167203
|
+
var defaultLocale = "en";
|
|
167204
|
+
var localeEquivalencies = {
|
|
167205
|
+
// We use `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
|
|
167206
|
+
pt: "pt-PT",
|
|
167207
|
+
// We support both 'nb' and 'no' (BCP 47) for Norwegian but only `nb` has corresponding bundle
|
|
167208
|
+
no: "nb",
|
|
167209
|
+
// We can `zh-CN` as base translation for chinese locales which has no corresponding bundle.
|
|
167210
|
+
zh: "zh-CN"
|
|
167211
|
+
};
|
|
167212
|
+
async function fetchT9nStringsBundle(locale, assetsPath, prefix = "") {
|
|
167213
|
+
const path = `${assetsPath}/${prefix}`;
|
|
167214
|
+
const filePath = `${path}${locale}.json`;
|
|
167215
|
+
t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
|
|
167216
|
+
return await t9nStringsCache[filePath];
|
|
167217
|
+
}
|
|
167218
|
+
var t9nStringsCache = {};
|
|
167219
|
+
async function fetchBundle(locale, path) {
|
|
167220
|
+
const filePath = `${path}${locale}.json`;
|
|
167221
|
+
try {
|
|
167222
|
+
const response = await fetch(filePath);
|
|
167223
|
+
if (response.ok) {
|
|
167224
|
+
return await response.json();
|
|
167225
|
+
}
|
|
167226
|
+
} catch (error) {
|
|
167227
|
+
console.error(error);
|
|
167228
|
+
return {};
|
|
167229
|
+
}
|
|
167230
|
+
if (locale === defaultLocale) {
|
|
167231
|
+
return {};
|
|
167232
|
+
}
|
|
167233
|
+
return await fetchBundle(defaultLocale, path);
|
|
167234
|
+
}
|
|
167235
|
+
function getElementLocales(element) {
|
|
167236
|
+
const lang = getElementAttribute(element, "lang", navigator.language || defaultLocale);
|
|
167237
|
+
return { lang, t9nLocale: langToLocale(lang) };
|
|
167238
|
+
}
|
|
167239
|
+
function langToLocale(lang) {
|
|
167240
|
+
const parts = lang.split("-");
|
|
167241
|
+
const normalized = `${parts[0].toLowerCase()}${parts.slice(1).join("-").toUpperCase()}`;
|
|
167242
|
+
if (supportedLocales.has(normalized)) {
|
|
167243
|
+
return normalized;
|
|
167244
|
+
}
|
|
167245
|
+
const languageCode = normalized.slice(0, 2).toLowerCase();
|
|
167246
|
+
const locale = localeEquivalencies[languageCode] ?? languageCode;
|
|
167247
|
+
if (supportedLocales.has(locale)) {
|
|
167248
|
+
return locale;
|
|
167249
|
+
}
|
|
167250
|
+
return defaultLocale;
|
|
167251
|
+
}
|
|
167252
|
+
function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
|
|
167253
|
+
let result = void 0;
|
|
167254
|
+
const callback = () => void updateComponentLocateState(element, assetsPath, assetName).then((newResult) => {
|
|
167255
|
+
if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings) {
|
|
167256
|
+
onUpdated(newResult);
|
|
167257
|
+
}
|
|
167258
|
+
result = newResult;
|
|
167259
|
+
}).catch(console.error);
|
|
167260
|
+
callback();
|
|
167261
|
+
return observeAncestorsMutation(element, ["lang"], callback);
|
|
167262
|
+
}
|
|
167263
|
+
async function updateComponentLocateState(element, assetsPath, assetName = element.tagName.toLowerCase().replace("arcgis-", "")) {
|
|
167264
|
+
const { lang, t9nLocale } = getElementLocales(element);
|
|
167265
|
+
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
167266
|
+
const prefix = `${assetName}.t9n.`;
|
|
167267
|
+
const t9nStrings = await fetchT9nStringsBundle(t9nLocale, t9nAssetsPath, prefix);
|
|
167268
|
+
return { lang, t9nLocale, t9nStrings };
|
|
167269
|
+
}
|
|
167270
|
+
|
|
167271
|
+
// src/strings.ts
|
|
167272
|
+
var doubleQuote = '"';
|
|
167273
|
+
var singleQuote = "'";
|
|
167274
|
+
function repeatString(value, n) {
|
|
167275
|
+
return new Array(n + 1).join(value);
|
|
167276
|
+
}
|
|
167277
|
+
function quoteString(value) {
|
|
167278
|
+
let quote = doubleQuote;
|
|
167279
|
+
let alternateQuote = singleQuote;
|
|
167280
|
+
const avoidEscape = value.includes(quote) && !value.includes(alternateQuote);
|
|
167281
|
+
if (avoidEscape) {
|
|
167282
|
+
alternateQuote = doubleQuote;
|
|
167283
|
+
quote = singleQuote;
|
|
167284
|
+
}
|
|
167285
|
+
const alternateEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${alternateQuote})+)`, "gu");
|
|
167286
|
+
value = value.replace(
|
|
167287
|
+
alternateEscape,
|
|
167288
|
+
(_, boundaryChar, leadingEscapedSlashes, escapedQuoteChars) => (
|
|
167289
|
+
// We divide the escapedQuoteChars by 2 since there are 2 characters in each escaped part ('\\"'.length === 2)
|
|
167290
|
+
boundaryChar + leadingEscapedSlashes + repeatString(alternateQuote, escapedQuoteChars.length / 2)
|
|
167291
|
+
)
|
|
167292
|
+
);
|
|
167293
|
+
const quoteEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${quote}+)`, "gu");
|
|
167294
|
+
value = value.replace(
|
|
167295
|
+
quoteEscape,
|
|
167296
|
+
(_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString(`\\${quote}`, quoteChars.length)
|
|
167297
|
+
);
|
|
167298
|
+
return quote + value + quote;
|
|
167299
|
+
}
|
|
167300
|
+
function createFilterExpression(filterWord) {
|
|
167301
|
+
const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu, "\\$&") : "^.*$";
|
|
167302
|
+
return new RegExp(sanitizedWord, "i");
|
|
167303
|
+
}
|
|
167304
|
+
function setValuesInString(message, values = {}) {
|
|
167305
|
+
return (message ?? "").replace(/\{(?<valueName>.*?)\}/gu, (match, valueName) => values[valueName] ?? match);
|
|
167306
|
+
}
|
|
167307
|
+
function addLTRMark(value) {
|
|
167308
|
+
return `\u200E${value ?? ""}\u200E`;
|
|
167309
|
+
}
|
|
167310
|
+
|
|
167311
|
+
// src/timeouts.ts
|
|
167312
|
+
function devToolsAwareTimeout(callback, timeout) {
|
|
167313
|
+
const interval = timeout > longTimeoutThreshold ? longTimeoutInterval : timeout / shortTimeoutIntervals;
|
|
167314
|
+
let elapsed = 0;
|
|
167315
|
+
const reference = setInterval(() => {
|
|
167316
|
+
elapsed += interval;
|
|
167317
|
+
if (elapsed >= timeout) {
|
|
167318
|
+
clearInterval(reference);
|
|
167319
|
+
callback();
|
|
167320
|
+
}
|
|
167321
|
+
}, interval);
|
|
167322
|
+
return reference;
|
|
167323
|
+
}
|
|
167324
|
+
var longTimeoutThreshold = 4e3;
|
|
167325
|
+
var longTimeoutInterval = 2e3;
|
|
167326
|
+
var shortTimeoutIntervals = 4;
|
|
167327
|
+
|
|
167328
|
+
// src/type-guards.ts
|
|
167329
|
+
function isNotNull(item) {
|
|
167330
|
+
return item !== null;
|
|
167331
|
+
}
|
|
167332
|
+
function isNotUndefined(item) {
|
|
167333
|
+
return item !== void 0;
|
|
167334
|
+
}
|
|
167335
|
+
|
|
167336
|
+
// src/ui.ts
|
|
167337
|
+
function debounce(func, waitFor = 100) {
|
|
167338
|
+
let timeout;
|
|
167339
|
+
return (...args) => {
|
|
167340
|
+
const later = () => {
|
|
167341
|
+
clearTimeout(timeout);
|
|
167342
|
+
func(...args);
|
|
167343
|
+
};
|
|
167344
|
+
clearTimeout(timeout);
|
|
167345
|
+
timeout = setTimeout(later, waitFor);
|
|
167346
|
+
};
|
|
167347
|
+
}
|
|
167348
|
+
|
|
167349
|
+
// src/url.ts
|
|
167350
|
+
function hasSameOrigin(url1, url2, ignoreProtocol = false) {
|
|
167351
|
+
if (!url1 || !url2) {
|
|
167352
|
+
return false;
|
|
167353
|
+
}
|
|
167354
|
+
const url1Obj = new URL(url1);
|
|
167355
|
+
const url2Obj = new URL(url2);
|
|
167356
|
+
if (!ignoreProtocol && url1Obj.protocol !== url2Obj.protocol) {
|
|
167357
|
+
return false;
|
|
167358
|
+
}
|
|
167359
|
+
if (url1Obj.host == null || url2Obj.host == null) {
|
|
167360
|
+
return false;
|
|
167361
|
+
}
|
|
167362
|
+
return url1Obj.host.toLowerCase() === url2Obj.host.toLowerCase() && url1Obj.port === url2Obj.port;
|
|
167363
|
+
}
|
|
167364
|
+
function isURL(url) {
|
|
167365
|
+
try {
|
|
167366
|
+
new URL(url);
|
|
167367
|
+
return true;
|
|
167368
|
+
} catch (e) {
|
|
167369
|
+
return false;
|
|
167370
|
+
}
|
|
167371
|
+
}
|
|
167372
|
+
|
|
167373
|
+
/**
|
|
167374
|
+
* Filters a collection of items by the given keys and filter word.
|
|
167375
|
+
*/
|
|
167376
|
+
function filterCollection(collection, keys, filterWord, beforeFilteringFn) {
|
|
167377
|
+
if (!keys) {
|
|
167378
|
+
return [];
|
|
167379
|
+
}
|
|
167380
|
+
const _keys = !Array.isArray(keys) ? [keys] : keys;
|
|
167381
|
+
if (!_keys.length) {
|
|
167382
|
+
return [];
|
|
167383
|
+
}
|
|
167384
|
+
const filterExpression = createFilterExpression(filterWord);
|
|
167385
|
+
return collection.filter((item) => {
|
|
167386
|
+
if (beforeFilteringFn) {
|
|
167387
|
+
const res = beforeFilteringFn(item);
|
|
167388
|
+
if (res !== null || res !== undefined) {
|
|
167389
|
+
return res;
|
|
167390
|
+
}
|
|
167391
|
+
}
|
|
167392
|
+
return _keys.some((key) => filterExpression.test(String(item[key] ?? "")));
|
|
167393
|
+
});
|
|
167394
|
+
}
|
|
167395
|
+
/**
|
|
167396
|
+
* Returns the url to the portal item.
|
|
167397
|
+
*/
|
|
167398
|
+
function portalItemPageUrl(portalItem) {
|
|
167399
|
+
if (!portalItem) {
|
|
167400
|
+
return "";
|
|
167401
|
+
}
|
|
167402
|
+
return `${portalItem.portal.url}/home/item.html?id=${portalItem.id}`;
|
|
167403
|
+
}
|
|
167404
|
+
//#endregion
|
|
167405
|
+
|
|
167406
|
+
/**
|
|
167407
|
+
* Returns an icon name for the field type
|
|
167408
|
+
*/
|
|
167409
|
+
function fieldTypeToIconName(field) {
|
|
167410
|
+
switch (field.type) {
|
|
167411
|
+
case "oid":
|
|
167412
|
+
return "key";
|
|
167413
|
+
case "small-integer":
|
|
167414
|
+
case "big-integer":
|
|
167415
|
+
case "integer":
|
|
167416
|
+
case "single":
|
|
167417
|
+
case "double":
|
|
167418
|
+
case "long":
|
|
167419
|
+
return "number";
|
|
167420
|
+
case "global-id":
|
|
167421
|
+
case "guid":
|
|
167422
|
+
return "key";
|
|
167423
|
+
case "string":
|
|
167424
|
+
return "string";
|
|
167425
|
+
case "date":
|
|
167426
|
+
return "date-time";
|
|
167427
|
+
case "date-only":
|
|
167428
|
+
return "calendar";
|
|
167429
|
+
case "time-only":
|
|
167430
|
+
return "clock";
|
|
167431
|
+
case "timestamp-offset":
|
|
167432
|
+
return "time-zone";
|
|
167433
|
+
default:
|
|
167434
|
+
return "cube";
|
|
167435
|
+
}
|
|
167436
|
+
}
|
|
167437
|
+
/**
|
|
167438
|
+
* Returns the ApiValueVariable type for the given field.
|
|
167439
|
+
*/
|
|
167440
|
+
function fieldTypeToApiValueVarType(field) {
|
|
167441
|
+
switch (field.type) {
|
|
167442
|
+
case "small-integer":
|
|
167443
|
+
case "integer":
|
|
167444
|
+
case "big-integer":
|
|
167445
|
+
case "single":
|
|
167446
|
+
case "double":
|
|
167447
|
+
case "long":
|
|
167448
|
+
case "oid":
|
|
167449
|
+
return "number";
|
|
167450
|
+
case "global-id":
|
|
167451
|
+
case "guid":
|
|
167452
|
+
case "string":
|
|
167453
|
+
return "text";
|
|
167454
|
+
case "date":
|
|
167455
|
+
return "date";
|
|
167456
|
+
case "date-only":
|
|
167457
|
+
return "dateOnly";
|
|
167458
|
+
case "time-only":
|
|
167459
|
+
return "time";
|
|
167460
|
+
default:
|
|
167461
|
+
return "text";
|
|
167462
|
+
}
|
|
167463
|
+
}
|
|
167464
|
+
function supportedFields(fields) {
|
|
167465
|
+
return (fields ?? []).filter((field) => {
|
|
167466
|
+
switch (field.type) {
|
|
167467
|
+
case "string":
|
|
167468
|
+
case "small-integer":
|
|
167469
|
+
case "integer":
|
|
167470
|
+
case "big-integer":
|
|
167471
|
+
case "single":
|
|
167472
|
+
case "double":
|
|
167473
|
+
case "long":
|
|
167474
|
+
case "date":
|
|
167475
|
+
case "date-only":
|
|
167476
|
+
case "time-only":
|
|
167477
|
+
case "timestamp-offset":
|
|
167478
|
+
case "oid":
|
|
167479
|
+
case "guid":
|
|
167480
|
+
case "global-id":
|
|
167481
|
+
return true;
|
|
167482
|
+
default:
|
|
167483
|
+
return false;
|
|
167484
|
+
}
|
|
167485
|
+
});
|
|
167486
|
+
}
|
|
167487
|
+
function fieldAlias(field) {
|
|
167488
|
+
return field.alias || field.name;
|
|
167489
|
+
}
|
|
167490
|
+
|
|
166739
167491
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
166740
167492
|
|
|
166741
167493
|
function commonjsRequire (path) {
|
|
@@ -169011,751 +169763,6 @@ var main = {exports: {}};
|
|
|
169011
169763
|
});
|
|
169012
169764
|
}(main, main.exports));
|
|
169013
169765
|
|
|
169014
|
-
// src/index.ts
|
|
169015
|
-
var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis && !("forceESM" in window.$arcgis);
|
|
169016
|
-
function isDefaultModule(module) {
|
|
169017
|
-
return module.default !== void 0;
|
|
169018
|
-
}
|
|
169019
|
-
async function importLayersFeatureLayer() {
|
|
169020
|
-
if (isAMD) {
|
|
169021
|
-
return await window.$arcgis.import("esri/layers/FeatureLayer");
|
|
169022
|
-
}
|
|
169023
|
-
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/layers/FeatureLayer.js')); });
|
|
169024
|
-
return isDefaultModule(module) ? module.default : module;
|
|
169025
|
-
}
|
|
169026
|
-
async function newLayersFeatureLayer(properties) {
|
|
169027
|
-
const ModConstructor = await importLayersFeatureLayer();
|
|
169028
|
-
return new ModConstructor(properties);
|
|
169029
|
-
}
|
|
169030
|
-
async function importPortalPortalItem() {
|
|
169031
|
-
if (isAMD) {
|
|
169032
|
-
return await window.$arcgis.import("esri/portal/PortalItem");
|
|
169033
|
-
}
|
|
169034
|
-
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/portal/PortalItem.js')); });
|
|
169035
|
-
return isDefaultModule(module) ? module.default : module;
|
|
169036
|
-
}
|
|
169037
|
-
async function newPortalPortalItem(properties) {
|
|
169038
|
-
const ModConstructor = await importPortalPortalItem();
|
|
169039
|
-
return new ModConstructor(properties);
|
|
169040
|
-
}
|
|
169041
|
-
async function importWebMap() {
|
|
169042
|
-
if (isAMD) {
|
|
169043
|
-
return await window.$arcgis.import("esri/WebMap");
|
|
169044
|
-
}
|
|
169045
|
-
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebMap.js')); });
|
|
169046
|
-
return isDefaultModule(module) ? module.default : module;
|
|
169047
|
-
}
|
|
169048
|
-
async function newWebMap(properties) {
|
|
169049
|
-
const ModConstructor = await importWebMap();
|
|
169050
|
-
return new ModConstructor(properties);
|
|
169051
|
-
}
|
|
169052
|
-
async function importWebScene() {
|
|
169053
|
-
if (isAMD) {
|
|
169054
|
-
return await window.$arcgis.import("esri/WebScene");
|
|
169055
|
-
}
|
|
169056
|
-
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebScene.js')); });
|
|
169057
|
-
return isDefaultModule(module) ? module.default : module;
|
|
169058
|
-
}
|
|
169059
|
-
async function newWebScene(properties) {
|
|
169060
|
-
const ModConstructor = await importWebScene();
|
|
169061
|
-
return new ModConstructor(properties);
|
|
169062
|
-
}
|
|
169063
|
-
async function importArcade() {
|
|
169064
|
-
if (isAMD) {
|
|
169065
|
-
return await window.$arcgis.import("esri/arcade");
|
|
169066
|
-
}
|
|
169067
|
-
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/arcade.js')); });
|
|
169068
|
-
return isDefaultModule(module) ? module.default : module;
|
|
169069
|
-
}
|
|
169070
|
-
async function importRequest() {
|
|
169071
|
-
if (isAMD) {
|
|
169072
|
-
return await window.$arcgis.import("esri/request");
|
|
169073
|
-
}
|
|
169074
|
-
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/request.js')); });
|
|
169075
|
-
return isDefaultModule(module) ? module.default : module;
|
|
169076
|
-
}
|
|
169077
|
-
|
|
169078
|
-
//#region Type Guards
|
|
169079
|
-
function isFeatureLayerLikeInstance(item) {
|
|
169080
|
-
return (!!item &&
|
|
169081
|
-
typeof item === "object" &&
|
|
169082
|
-
"declaredClass" in item &&
|
|
169083
|
-
typeof item.declaredClass === "string" &&
|
|
169084
|
-
item.declaredClass.startsWith("esri.layers.") &&
|
|
169085
|
-
isFieldsDefinition(item) &&
|
|
169086
|
-
"queryFeatures" in item &&
|
|
169087
|
-
typeof item.queryFeatures === "function");
|
|
169088
|
-
}
|
|
169089
|
-
function isGroupLayerCapable(item) {
|
|
169090
|
-
return (!!item &&
|
|
169091
|
-
typeof item === "object" &&
|
|
169092
|
-
"allLayers" in item &&
|
|
169093
|
-
"allTables" in item &&
|
|
169094
|
-
typeof item.allLayers === "object" &&
|
|
169095
|
-
typeof item.allTables === "object");
|
|
169096
|
-
}
|
|
169097
|
-
function isMapInstance(item) {
|
|
169098
|
-
return (!!item &&
|
|
169099
|
-
typeof item === "object" &&
|
|
169100
|
-
"declaredClass" in item &&
|
|
169101
|
-
typeof item.declaredClass === "string" &&
|
|
169102
|
-
(item.declaredClass === "esri.Map" ||
|
|
169103
|
-
item.declaredClass === "esri.WebMap" ||
|
|
169104
|
-
item.declaredClass === "esri.WebScene"));
|
|
169105
|
-
}
|
|
169106
|
-
function isLoadAllCapable(item) {
|
|
169107
|
-
return !!item && typeof item === "object" && "loadAll" in item && typeof item.loadAll === "function";
|
|
169108
|
-
}
|
|
169109
|
-
function isPortalItemDefinition(item) {
|
|
169110
|
-
return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
|
|
169111
|
-
}
|
|
169112
|
-
function isFeatureLayerItemDefinition(item) {
|
|
169113
|
-
return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
|
|
169114
|
-
}
|
|
169115
|
-
function isFieldsDefinition(item) {
|
|
169116
|
-
return !!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields);
|
|
169117
|
-
}
|
|
169118
|
-
function isUrlDefinition(item) {
|
|
169119
|
-
return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
|
|
169120
|
-
}
|
|
169121
|
-
function isSupportedServiceUrlDefinition(item) {
|
|
169122
|
-
return isUrlDefinition(item) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(item.url);
|
|
169123
|
-
}
|
|
169124
|
-
function isSubtypeInstance(item) {
|
|
169125
|
-
return (!!item &&
|
|
169126
|
-
typeof item === "object" &&
|
|
169127
|
-
"declaredClass" in item &&
|
|
169128
|
-
item.declaredClass === "esri.layers.support.Subtype");
|
|
169129
|
-
}
|
|
169130
|
-
function isCodedValueDomainInstance(item) {
|
|
169131
|
-
return (!!item &&
|
|
169132
|
-
typeof item === "object" &&
|
|
169133
|
-
"declaredClass" in item &&
|
|
169134
|
-
item.declaredClass === "esri.layers.support.CodedValueDomain");
|
|
169135
|
-
}
|
|
169136
|
-
function isInheritedDomainInstance(item) {
|
|
169137
|
-
return (!!item &&
|
|
169138
|
-
typeof item === "object" &&
|
|
169139
|
-
"declaredClass" in item &&
|
|
169140
|
-
item.declaredClass === "esri.layers.support.InheritedDomain");
|
|
169141
|
-
}
|
|
169142
|
-
function isPredefinedProfile(item) {
|
|
169143
|
-
return (!!item &&
|
|
169144
|
-
typeof item === "object" &&
|
|
169145
|
-
"id" in item &&
|
|
169146
|
-
typeof item.id === "string" &&
|
|
169147
|
-
"definitions" in item &&
|
|
169148
|
-
typeof item.definitions === "object" &&
|
|
169149
|
-
!Array.isArray(item.definitions));
|
|
169150
|
-
}
|
|
169151
|
-
function isTitleCapableSource(item) {
|
|
169152
|
-
return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
|
|
169153
|
-
}
|
|
169154
|
-
function isUrlCapableSource(item) {
|
|
169155
|
-
return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
|
|
169156
|
-
}
|
|
169157
|
-
function isLayerIdCapableSource(item) {
|
|
169158
|
-
return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
|
|
169159
|
-
}
|
|
169160
|
-
function isFeatureTypesCapableLayer(item) {
|
|
169161
|
-
return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
|
|
169162
|
-
}
|
|
169163
|
-
function isDomainsCapableLayer(item) {
|
|
169164
|
-
return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
|
|
169165
|
-
}
|
|
169166
|
-
function isSubtypeFieldCapableLayer(item) {
|
|
169167
|
-
return !!item && typeof item === "object" && "subtypeField" in item;
|
|
169168
|
-
}
|
|
169169
|
-
function isSubtypesCapableLayer(item) {
|
|
169170
|
-
return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
|
|
169171
|
-
}
|
|
169172
|
-
function isPortalItemCapable(item) {
|
|
169173
|
-
return !!item && typeof item === "object" && "portalItem" in item;
|
|
169174
|
-
}
|
|
169175
|
-
function isRelationshipsCapableLayer(item) {
|
|
169176
|
-
return (isLayerIdCapableSource(item) &&
|
|
169177
|
-
"relationships" in item &&
|
|
169178
|
-
"url" in item &&
|
|
169179
|
-
Array.isArray(item.relationships) &&
|
|
169180
|
-
typeof item.url === "string");
|
|
169181
|
-
}
|
|
169182
|
-
function isTableCapableLayer(item) {
|
|
169183
|
-
return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
|
|
169184
|
-
}
|
|
169185
|
-
function isLoadableSource(item) {
|
|
169186
|
-
return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
|
|
169187
|
-
}
|
|
169188
|
-
//#endregion
|
|
169189
|
-
//#region Service Metadata
|
|
169190
|
-
async function supportedSourceFromDefinition(definition) {
|
|
169191
|
-
if (!definition) {
|
|
169192
|
-
return null;
|
|
169193
|
-
}
|
|
169194
|
-
let source = null;
|
|
169195
|
-
if (isFieldsDefinition(definition)) {
|
|
169196
|
-
source = definition;
|
|
169197
|
-
}
|
|
169198
|
-
else {
|
|
169199
|
-
source = await newLayersFeatureLayer(definition);
|
|
169200
|
-
}
|
|
169201
|
-
if (isLoadableSource(source)) {
|
|
169202
|
-
await source.load();
|
|
169203
|
-
}
|
|
169204
|
-
return source;
|
|
169205
|
-
}
|
|
169206
|
-
async function serviceMetaData(url) {
|
|
169207
|
-
url += "/layers";
|
|
169208
|
-
const request = await importRequest();
|
|
169209
|
-
const response = await request(url, { responseType: "json", query: { f: "json" } });
|
|
169210
|
-
const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
|
|
169211
|
-
const layers = getSupportedLayerInfos(response.data?.layers, queryCapability);
|
|
169212
|
-
const tables = getSupportedLayerInfos(response.data?.tables, queryCapability);
|
|
169213
|
-
return { layers, tables };
|
|
169214
|
-
}
|
|
169215
|
-
function getSupportedLayerInfos(layers, queryCapability) {
|
|
169216
|
-
if (!layers) {
|
|
169217
|
-
return [];
|
|
169218
|
-
}
|
|
169219
|
-
return layers.filter((layer) => {
|
|
169220
|
-
switch (layer.type) {
|
|
169221
|
-
case "Feature Layer":
|
|
169222
|
-
case "Oriented Imagery Layer":
|
|
169223
|
-
case "Catalog Layer":
|
|
169224
|
-
case "Table": {
|
|
169225
|
-
const capabilities = layer.capabilities
|
|
169226
|
-
? layer.capabilities
|
|
169227
|
-
.toLowerCase()
|
|
169228
|
-
.split(",")
|
|
169229
|
-
.map((value) => value.trim())
|
|
169230
|
-
: [];
|
|
169231
|
-
return capabilities.includes(queryCapability);
|
|
169232
|
-
}
|
|
169233
|
-
default:
|
|
169234
|
-
return false;
|
|
169235
|
-
}
|
|
169236
|
-
});
|
|
169237
|
-
}
|
|
169238
|
-
//#endregion
|
|
169239
|
-
|
|
169240
|
-
// src/array-utils.ts
|
|
169241
|
-
|
|
169242
|
-
// src/deferred.ts
|
|
169243
|
-
var Deferred = class {
|
|
169244
|
-
/**
|
|
169245
|
-
* Resolves the promise.
|
|
169246
|
-
* @param value The value to resolve the promise with.
|
|
169247
|
-
*/
|
|
169248
|
-
resolve(_value) {
|
|
169249
|
-
}
|
|
169250
|
-
/**
|
|
169251
|
-
* Rejects the promise.
|
|
169252
|
-
*/
|
|
169253
|
-
reject(_error) {
|
|
169254
|
-
}
|
|
169255
|
-
/**
|
|
169256
|
-
* Creates a new deferred promise.
|
|
169257
|
-
*/
|
|
169258
|
-
constructor() {
|
|
169259
|
-
this.promise = new Promise((resolve, reject) => {
|
|
169260
|
-
this.resolve = resolve;
|
|
169261
|
-
this.reject = reject;
|
|
169262
|
-
});
|
|
169263
|
-
}
|
|
169264
|
-
};
|
|
169265
|
-
|
|
169266
|
-
// src/dom.ts
|
|
169267
|
-
function inTargetElement(element, targetElement) {
|
|
169268
|
-
let currentElement = element;
|
|
169269
|
-
while (currentElement) {
|
|
169270
|
-
if (currentElement === targetElement) {
|
|
169271
|
-
return true;
|
|
169272
|
-
}
|
|
169273
|
-
if (!currentElement.parentNode) {
|
|
169274
|
-
return false;
|
|
169275
|
-
}
|
|
169276
|
-
if (currentElement.parentNode instanceof ShadowRoot) {
|
|
169277
|
-
currentElement = currentElement.parentNode.host;
|
|
169278
|
-
} else {
|
|
169279
|
-
currentElement = currentElement.parentNode;
|
|
169280
|
-
}
|
|
169281
|
-
}
|
|
169282
|
-
return false;
|
|
169283
|
-
}
|
|
169284
|
-
function observeAncestorsMutation(element, attributeFilter, callback) {
|
|
169285
|
-
const { subscribe } = observe(attributeFilter);
|
|
169286
|
-
return subscribe((mutations) => {
|
|
169287
|
-
const matched = mutations.some((mutation) => inTargetElement(element, mutation.target));
|
|
169288
|
-
if (matched) {
|
|
169289
|
-
callback();
|
|
169290
|
-
}
|
|
169291
|
-
});
|
|
169292
|
-
}
|
|
169293
|
-
var observers = {};
|
|
169294
|
-
function observe(attributeFilter) {
|
|
169295
|
-
const attributes = attributeFilter.join(",");
|
|
169296
|
-
const previousObserver = observers[attributes];
|
|
169297
|
-
if (previousObserver !== void 0) {
|
|
169298
|
-
return previousObserver;
|
|
169299
|
-
}
|
|
169300
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
169301
|
-
const mutationObserver = new MutationObserver((mutations) => subscribers.forEach((callback) => callback(mutations)));
|
|
169302
|
-
mutationObserver.observe(document.documentElement, {
|
|
169303
|
-
attributes: true,
|
|
169304
|
-
attributeFilter,
|
|
169305
|
-
subtree: true
|
|
169306
|
-
});
|
|
169307
|
-
const observer = {
|
|
169308
|
-
subscribe(callback) {
|
|
169309
|
-
subscribers.add(callback);
|
|
169310
|
-
return {
|
|
169311
|
-
remove: () => {
|
|
169312
|
-
subscribers.delete(callback);
|
|
169313
|
-
if (subscribers.size === 0) {
|
|
169314
|
-
mutationObserver.disconnect();
|
|
169315
|
-
observers[attributes] = void 0;
|
|
169316
|
-
}
|
|
169317
|
-
}
|
|
169318
|
-
};
|
|
169319
|
-
}
|
|
169320
|
-
};
|
|
169321
|
-
observers[attributes] = observer;
|
|
169322
|
-
return observer;
|
|
169323
|
-
}
|
|
169324
|
-
function closestElement(base, selector) {
|
|
169325
|
-
let currentElement = base;
|
|
169326
|
-
while (currentElement) {
|
|
169327
|
-
const element = currentElement.closest(selector);
|
|
169328
|
-
if (element) {
|
|
169329
|
-
return element;
|
|
169330
|
-
}
|
|
169331
|
-
const rootElement = currentElement.getRootNode();
|
|
169332
|
-
if (rootElement === document) {
|
|
169333
|
-
return null;
|
|
169334
|
-
}
|
|
169335
|
-
currentElement = rootElement.host;
|
|
169336
|
-
}
|
|
169337
|
-
return null;
|
|
169338
|
-
}
|
|
169339
|
-
function getElementTheme(base) {
|
|
169340
|
-
const themeElt = closestElement(base, ":is(.calcite-mode-light, .calcite-mode-dark)");
|
|
169341
|
-
return themeElt && themeElt.classList.contains("calcite-mode-dark") ? "dark" : "light";
|
|
169342
|
-
}
|
|
169343
|
-
function getElementAttribute(el, prop, fallbackValue) {
|
|
169344
|
-
const closest = closestElement(el, `[${prop}]`);
|
|
169345
|
-
return closest?.getAttribute(prop) ?? fallbackValue;
|
|
169346
|
-
}
|
|
169347
|
-
function isElement(ref) {
|
|
169348
|
-
return ref.nodeType === Node.ELEMENT_NODE;
|
|
169349
|
-
}
|
|
169350
|
-
function isHTMLWithSetFocus(ref) {
|
|
169351
|
-
return "setFocus" in ref && typeof ref.setFocus === "function";
|
|
169352
|
-
}
|
|
169353
|
-
function setFocus(ref, selector = "") {
|
|
169354
|
-
if (!isElement(ref)) {
|
|
169355
|
-
return false;
|
|
169356
|
-
}
|
|
169357
|
-
if (ref.matches(selector)) {
|
|
169358
|
-
if (isHTMLWithSetFocus(ref)) {
|
|
169359
|
-
setTimeout(() => ref.setFocus(), 0);
|
|
169360
|
-
}
|
|
169361
|
-
return true;
|
|
169362
|
-
}
|
|
169363
|
-
for (const child of ref.children) {
|
|
169364
|
-
if (setFocus(child, selector)) {
|
|
169365
|
-
return true;
|
|
169366
|
-
}
|
|
169367
|
-
}
|
|
169368
|
-
const shadowRoot = ref.shadowRoot;
|
|
169369
|
-
if (shadowRoot) {
|
|
169370
|
-
for (const child of shadowRoot.children) {
|
|
169371
|
-
if (setFocus(child, selector)) {
|
|
169372
|
-
return true;
|
|
169373
|
-
}
|
|
169374
|
-
}
|
|
169375
|
-
}
|
|
169376
|
-
return false;
|
|
169377
|
-
}
|
|
169378
|
-
function setFocusOnElement(ref, selector) {
|
|
169379
|
-
if (!ref?.shadowRoot) {
|
|
169380
|
-
return;
|
|
169381
|
-
}
|
|
169382
|
-
if (ref.hasAttribute("hydrated") || ref.hasAttribute("calcite-hydrated")) {
|
|
169383
|
-
setFocus(ref, selector);
|
|
169384
|
-
return;
|
|
169385
|
-
}
|
|
169386
|
-
const mutationObserver = new MutationObserver(() => {
|
|
169387
|
-
mutationObserver.disconnect();
|
|
169388
|
-
setFocus(ref, selector);
|
|
169389
|
-
});
|
|
169390
|
-
mutationObserver.observe(ref, {
|
|
169391
|
-
attributes: true,
|
|
169392
|
-
attributeFilter: ["hydrated", "calcite-hydrated"]
|
|
169393
|
-
});
|
|
169394
|
-
}
|
|
169395
|
-
|
|
169396
|
-
// src/errors.ts
|
|
169397
|
-
function safeCall(callback, thisContext, ...rest) {
|
|
169398
|
-
try {
|
|
169399
|
-
return callback?.call(thisContext, ...rest);
|
|
169400
|
-
} catch (error) {
|
|
169401
|
-
console.error(error, callback);
|
|
169402
|
-
}
|
|
169403
|
-
return void 0;
|
|
169404
|
-
}
|
|
169405
|
-
async function safeAsyncCall(callback, thisContext, ...rest) {
|
|
169406
|
-
try {
|
|
169407
|
-
const result = callback?.call(thisContext, ...rest);
|
|
169408
|
-
return result instanceof Promise ? await result : result;
|
|
169409
|
-
} catch (error) {
|
|
169410
|
-
console.error(error, callback);
|
|
169411
|
-
}
|
|
169412
|
-
return void 0;
|
|
169413
|
-
}
|
|
169414
|
-
|
|
169415
|
-
// src/guid.ts
|
|
169416
|
-
function gen(count) {
|
|
169417
|
-
let out = "";
|
|
169418
|
-
for (let i = 0; i < count; i++) {
|
|
169419
|
-
out += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
169420
|
-
}
|
|
169421
|
-
return out;
|
|
169422
|
-
}
|
|
169423
|
-
function generateGuid() {
|
|
169424
|
-
return [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
|
|
169425
|
-
}
|
|
169426
|
-
|
|
169427
|
-
// src/intl.ts
|
|
169428
|
-
var supportedLocalesArray = [
|
|
169429
|
-
"ar",
|
|
169430
|
-
"bg",
|
|
169431
|
-
"bs",
|
|
169432
|
-
"ca",
|
|
169433
|
-
"cs",
|
|
169434
|
-
"da",
|
|
169435
|
-
"de",
|
|
169436
|
-
"el",
|
|
169437
|
-
"en",
|
|
169438
|
-
"es",
|
|
169439
|
-
"et",
|
|
169440
|
-
"fi",
|
|
169441
|
-
"fr",
|
|
169442
|
-
"he",
|
|
169443
|
-
"hr",
|
|
169444
|
-
"hu",
|
|
169445
|
-
"id",
|
|
169446
|
-
"it",
|
|
169447
|
-
"ja",
|
|
169448
|
-
"ko",
|
|
169449
|
-
"lt",
|
|
169450
|
-
"lv",
|
|
169451
|
-
"nl",
|
|
169452
|
-
"nb",
|
|
169453
|
-
"pl",
|
|
169454
|
-
"pt-BR",
|
|
169455
|
-
"pt-PT",
|
|
169456
|
-
"ro",
|
|
169457
|
-
"ru",
|
|
169458
|
-
"sk",
|
|
169459
|
-
"sl",
|
|
169460
|
-
"sr",
|
|
169461
|
-
"sv",
|
|
169462
|
-
"th",
|
|
169463
|
-
"tr",
|
|
169464
|
-
"uk",
|
|
169465
|
-
"vi",
|
|
169466
|
-
"zh-CN",
|
|
169467
|
-
"zh-HK",
|
|
169468
|
-
"zh-TW"
|
|
169469
|
-
];
|
|
169470
|
-
var supportedLocales = new Set(supportedLocalesArray);
|
|
169471
|
-
var defaultLocale = "en";
|
|
169472
|
-
var localeEquivalencies = {
|
|
169473
|
-
// We use `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
|
|
169474
|
-
pt: "pt-PT",
|
|
169475
|
-
// We support both 'nb' and 'no' (BCP 47) for Norwegian but only `nb` has corresponding bundle
|
|
169476
|
-
no: "nb",
|
|
169477
|
-
// We can `zh-CN` as base translation for chinese locales which has no corresponding bundle.
|
|
169478
|
-
zh: "zh-CN"
|
|
169479
|
-
};
|
|
169480
|
-
async function fetchT9nStringsBundle(locale, assetsPath, prefix = "") {
|
|
169481
|
-
const path = `${assetsPath}/${prefix}`;
|
|
169482
|
-
const filePath = `${path}${locale}.json`;
|
|
169483
|
-
t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
|
|
169484
|
-
return await t9nStringsCache[filePath];
|
|
169485
|
-
}
|
|
169486
|
-
var t9nStringsCache = {};
|
|
169487
|
-
async function fetchBundle(locale, path) {
|
|
169488
|
-
const filePath = `${path}${locale}.json`;
|
|
169489
|
-
try {
|
|
169490
|
-
const response = await fetch(filePath);
|
|
169491
|
-
if (response.ok) {
|
|
169492
|
-
return await response.json();
|
|
169493
|
-
}
|
|
169494
|
-
} catch (error) {
|
|
169495
|
-
console.error(error);
|
|
169496
|
-
return {};
|
|
169497
|
-
}
|
|
169498
|
-
if (locale === defaultLocale) {
|
|
169499
|
-
return {};
|
|
169500
|
-
}
|
|
169501
|
-
return await fetchBundle(defaultLocale, path);
|
|
169502
|
-
}
|
|
169503
|
-
function getElementLocales(element) {
|
|
169504
|
-
const lang = getElementAttribute(element, "lang", navigator.language || defaultLocale);
|
|
169505
|
-
return { lang, t9nLocale: langToLocale(lang) };
|
|
169506
|
-
}
|
|
169507
|
-
function langToLocale(lang) {
|
|
169508
|
-
const parts = lang.split("-");
|
|
169509
|
-
const normalized = `${parts[0].toLowerCase()}${parts.slice(1).join("-").toUpperCase()}`;
|
|
169510
|
-
if (supportedLocales.has(normalized)) {
|
|
169511
|
-
return normalized;
|
|
169512
|
-
}
|
|
169513
|
-
const languageCode = normalized.slice(0, 2).toLowerCase();
|
|
169514
|
-
const locale = localeEquivalencies[languageCode] ?? languageCode;
|
|
169515
|
-
if (supportedLocales.has(locale)) {
|
|
169516
|
-
return locale;
|
|
169517
|
-
}
|
|
169518
|
-
return defaultLocale;
|
|
169519
|
-
}
|
|
169520
|
-
function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
|
|
169521
|
-
let result = void 0;
|
|
169522
|
-
const callback = () => void updateComponentLocateState(element, assetsPath, assetName).then((newResult) => {
|
|
169523
|
-
if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings) {
|
|
169524
|
-
onUpdated(newResult);
|
|
169525
|
-
}
|
|
169526
|
-
result = newResult;
|
|
169527
|
-
}).catch(console.error);
|
|
169528
|
-
callback();
|
|
169529
|
-
return observeAncestorsMutation(element, ["lang"], callback);
|
|
169530
|
-
}
|
|
169531
|
-
async function updateComponentLocateState(element, assetsPath, assetName = element.tagName.toLowerCase().replace("arcgis-", "")) {
|
|
169532
|
-
const { lang, t9nLocale } = getElementLocales(element);
|
|
169533
|
-
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
169534
|
-
const prefix = `${assetName}.t9n.`;
|
|
169535
|
-
const t9nStrings = await fetchT9nStringsBundle(t9nLocale, t9nAssetsPath, prefix);
|
|
169536
|
-
return { lang, t9nLocale, t9nStrings };
|
|
169537
|
-
}
|
|
169538
|
-
|
|
169539
|
-
// src/strings.ts
|
|
169540
|
-
var doubleQuote = '"';
|
|
169541
|
-
var singleQuote = "'";
|
|
169542
|
-
function repeatString(value, n) {
|
|
169543
|
-
return new Array(n + 1).join(value);
|
|
169544
|
-
}
|
|
169545
|
-
function quoteString(value) {
|
|
169546
|
-
let quote = doubleQuote;
|
|
169547
|
-
let alternateQuote = singleQuote;
|
|
169548
|
-
const avoidEscape = value.includes(quote) && !value.includes(alternateQuote);
|
|
169549
|
-
if (avoidEscape) {
|
|
169550
|
-
alternateQuote = doubleQuote;
|
|
169551
|
-
quote = singleQuote;
|
|
169552
|
-
}
|
|
169553
|
-
const alternateEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${alternateQuote})+)`, "gu");
|
|
169554
|
-
value = value.replace(
|
|
169555
|
-
alternateEscape,
|
|
169556
|
-
(_, boundaryChar, leadingEscapedSlashes, escapedQuoteChars) => (
|
|
169557
|
-
// We divide the escapedQuoteChars by 2 since there are 2 characters in each escaped part ('\\"'.length === 2)
|
|
169558
|
-
boundaryChar + leadingEscapedSlashes + repeatString(alternateQuote, escapedQuoteChars.length / 2)
|
|
169559
|
-
)
|
|
169560
|
-
);
|
|
169561
|
-
const quoteEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${quote}+)`, "gu");
|
|
169562
|
-
value = value.replace(
|
|
169563
|
-
quoteEscape,
|
|
169564
|
-
(_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString(`\\${quote}`, quoteChars.length)
|
|
169565
|
-
);
|
|
169566
|
-
return quote + value + quote;
|
|
169567
|
-
}
|
|
169568
|
-
function createFilterExpression(filterWord) {
|
|
169569
|
-
const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu, "\\$&") : "^.*$";
|
|
169570
|
-
return new RegExp(sanitizedWord, "i");
|
|
169571
|
-
}
|
|
169572
|
-
function setValuesInString(message, values = {}) {
|
|
169573
|
-
return (message ?? "").replace(/\{(?<valueName>.*?)\}/gu, (match, valueName) => values[valueName] ?? match);
|
|
169574
|
-
}
|
|
169575
|
-
function addLTRMark(value) {
|
|
169576
|
-
return `\u200E${value ?? ""}\u200E`;
|
|
169577
|
-
}
|
|
169578
|
-
|
|
169579
|
-
// src/timeouts.ts
|
|
169580
|
-
function devToolsAwareTimeout(callback, timeout) {
|
|
169581
|
-
const interval = timeout > longTimeoutThreshold ? longTimeoutInterval : timeout / shortTimeoutIntervals;
|
|
169582
|
-
let elapsed = 0;
|
|
169583
|
-
const reference = setInterval(() => {
|
|
169584
|
-
elapsed += interval;
|
|
169585
|
-
if (elapsed >= timeout) {
|
|
169586
|
-
clearInterval(reference);
|
|
169587
|
-
callback();
|
|
169588
|
-
}
|
|
169589
|
-
}, interval);
|
|
169590
|
-
return reference;
|
|
169591
|
-
}
|
|
169592
|
-
var longTimeoutThreshold = 4e3;
|
|
169593
|
-
var longTimeoutInterval = 2e3;
|
|
169594
|
-
var shortTimeoutIntervals = 4;
|
|
169595
|
-
|
|
169596
|
-
// src/type-guards.ts
|
|
169597
|
-
function isNotNull(item) {
|
|
169598
|
-
return item !== null;
|
|
169599
|
-
}
|
|
169600
|
-
function isNotUndefined(item) {
|
|
169601
|
-
return item !== void 0;
|
|
169602
|
-
}
|
|
169603
|
-
|
|
169604
|
-
// src/ui.ts
|
|
169605
|
-
function debounce(func, waitFor = 100) {
|
|
169606
|
-
let timeout;
|
|
169607
|
-
return (...args) => {
|
|
169608
|
-
const later = () => {
|
|
169609
|
-
clearTimeout(timeout);
|
|
169610
|
-
func(...args);
|
|
169611
|
-
};
|
|
169612
|
-
clearTimeout(timeout);
|
|
169613
|
-
timeout = setTimeout(later, waitFor);
|
|
169614
|
-
};
|
|
169615
|
-
}
|
|
169616
|
-
|
|
169617
|
-
// src/url.ts
|
|
169618
|
-
function hasSameOrigin(url1, url2, ignoreProtocol = false) {
|
|
169619
|
-
if (!url1 || !url2) {
|
|
169620
|
-
return false;
|
|
169621
|
-
}
|
|
169622
|
-
const url1Obj = new URL(url1);
|
|
169623
|
-
const url2Obj = new URL(url2);
|
|
169624
|
-
if (!ignoreProtocol && url1Obj.protocol !== url2Obj.protocol) {
|
|
169625
|
-
return false;
|
|
169626
|
-
}
|
|
169627
|
-
if (url1Obj.host == null || url2Obj.host == null) {
|
|
169628
|
-
return false;
|
|
169629
|
-
}
|
|
169630
|
-
return url1Obj.host.toLowerCase() === url2Obj.host.toLowerCase() && url1Obj.port === url2Obj.port;
|
|
169631
|
-
}
|
|
169632
|
-
function isURL(url) {
|
|
169633
|
-
try {
|
|
169634
|
-
new URL(url);
|
|
169635
|
-
return true;
|
|
169636
|
-
} catch (e) {
|
|
169637
|
-
return false;
|
|
169638
|
-
}
|
|
169639
|
-
}
|
|
169640
|
-
|
|
169641
|
-
/**
|
|
169642
|
-
* Filters a collection of items by the given keys and filter word.
|
|
169643
|
-
*/
|
|
169644
|
-
function filterCollection(collection, keys, filterWord, beforeFilteringFn) {
|
|
169645
|
-
if (!keys) {
|
|
169646
|
-
return [];
|
|
169647
|
-
}
|
|
169648
|
-
const _keys = !Array.isArray(keys) ? [keys] : keys;
|
|
169649
|
-
if (!_keys.length) {
|
|
169650
|
-
return [];
|
|
169651
|
-
}
|
|
169652
|
-
const filterExpression = createFilterExpression(filterWord);
|
|
169653
|
-
return collection.filter((item) => {
|
|
169654
|
-
if (beforeFilteringFn) {
|
|
169655
|
-
const res = beforeFilteringFn(item);
|
|
169656
|
-
if (res !== null || res !== undefined) {
|
|
169657
|
-
return res;
|
|
169658
|
-
}
|
|
169659
|
-
}
|
|
169660
|
-
return _keys.some((key) => filterExpression.test(String(item[key] ?? "")));
|
|
169661
|
-
});
|
|
169662
|
-
}
|
|
169663
|
-
/**
|
|
169664
|
-
* Returns the url to the portal item.
|
|
169665
|
-
*/
|
|
169666
|
-
function portalItemPageUrl(portalItem) {
|
|
169667
|
-
if (!portalItem) {
|
|
169668
|
-
return "";
|
|
169669
|
-
}
|
|
169670
|
-
return `${portalItem.portal.url}/home/item.html?id=${portalItem.id}`;
|
|
169671
|
-
}
|
|
169672
|
-
//#endregion
|
|
169673
|
-
|
|
169674
|
-
/**
|
|
169675
|
-
* Returns an icon name for the field type
|
|
169676
|
-
*/
|
|
169677
|
-
function fieldTypeToIconName(field) {
|
|
169678
|
-
switch (field.type) {
|
|
169679
|
-
case "oid":
|
|
169680
|
-
return "key";
|
|
169681
|
-
case "small-integer":
|
|
169682
|
-
case "big-integer":
|
|
169683
|
-
case "integer":
|
|
169684
|
-
case "single":
|
|
169685
|
-
case "double":
|
|
169686
|
-
case "long":
|
|
169687
|
-
return "number";
|
|
169688
|
-
case "global-id":
|
|
169689
|
-
case "guid":
|
|
169690
|
-
return "key";
|
|
169691
|
-
case "string":
|
|
169692
|
-
return "string";
|
|
169693
|
-
case "date":
|
|
169694
|
-
return "date-time";
|
|
169695
|
-
case "date-only":
|
|
169696
|
-
return "calendar";
|
|
169697
|
-
case "time-only":
|
|
169698
|
-
return "clock";
|
|
169699
|
-
case "timestamp-offset":
|
|
169700
|
-
return "time-zone";
|
|
169701
|
-
default:
|
|
169702
|
-
return "cube";
|
|
169703
|
-
}
|
|
169704
|
-
}
|
|
169705
|
-
/**
|
|
169706
|
-
* Returns the Arcade type for the given field.
|
|
169707
|
-
*/
|
|
169708
|
-
function fieldTypeToArcadeType(field) {
|
|
169709
|
-
switch (field.type) {
|
|
169710
|
-
case "small-integer":
|
|
169711
|
-
case "integer":
|
|
169712
|
-
case "big-integer":
|
|
169713
|
-
case "single":
|
|
169714
|
-
case "double":
|
|
169715
|
-
case "long":
|
|
169716
|
-
case "oid":
|
|
169717
|
-
return "number";
|
|
169718
|
-
case "global-id":
|
|
169719
|
-
case "guid":
|
|
169720
|
-
case "string":
|
|
169721
|
-
return "text";
|
|
169722
|
-
case "date":
|
|
169723
|
-
return "date";
|
|
169724
|
-
case "date-only":
|
|
169725
|
-
return "dateOnly";
|
|
169726
|
-
case "time-only":
|
|
169727
|
-
return "time";
|
|
169728
|
-
default:
|
|
169729
|
-
return "text";
|
|
169730
|
-
}
|
|
169731
|
-
}
|
|
169732
|
-
function supportedFields(fields) {
|
|
169733
|
-
return (fields ?? []).filter((field) => {
|
|
169734
|
-
switch (field.type) {
|
|
169735
|
-
case "string":
|
|
169736
|
-
case "small-integer":
|
|
169737
|
-
case "integer":
|
|
169738
|
-
case "big-integer":
|
|
169739
|
-
case "single":
|
|
169740
|
-
case "double":
|
|
169741
|
-
case "long":
|
|
169742
|
-
case "date":
|
|
169743
|
-
case "date-only":
|
|
169744
|
-
case "time-only":
|
|
169745
|
-
case "timestamp-offset":
|
|
169746
|
-
case "oid":
|
|
169747
|
-
case "guid":
|
|
169748
|
-
case "global-id":
|
|
169749
|
-
return true;
|
|
169750
|
-
default:
|
|
169751
|
-
return false;
|
|
169752
|
-
}
|
|
169753
|
-
});
|
|
169754
|
-
}
|
|
169755
|
-
function fieldAlias(field) {
|
|
169756
|
-
return field.alias || field.name;
|
|
169757
|
-
}
|
|
169758
|
-
|
|
169759
169766
|
//#endregion
|
|
169760
169767
|
//#region Support functions
|
|
169761
169768
|
async function getRelatedFeatureLayer(layer, relationship) {
|
|
@@ -169813,81 +169820,23 @@ function getMapPortalItem(map) {
|
|
|
169813
169820
|
}
|
|
169814
169821
|
return null;
|
|
169815
169822
|
}
|
|
169816
|
-
|
|
169817
|
-
|
|
169818
|
-
|
|
169819
|
-
|
|
169820
|
-
|
|
169821
|
-
case "dictionary":
|
|
169822
|
-
return await dictionaryToLSDictionary(editorVariable, kind);
|
|
169823
|
-
case "feature":
|
|
169824
|
-
return await featureToLSFeature(editorVariable, kind);
|
|
169825
|
-
default:
|
|
169826
|
-
return variableToLSVariable(editorVariable, kind);
|
|
169827
|
-
}
|
|
169828
|
-
}));
|
|
169829
|
-
}
|
|
169830
|
-
function variableToLSVariable(editorVariable, kind) {
|
|
169831
|
-
const { name, type } = editorVariable;
|
|
169832
|
-
const description = editorVariable.getDescription();
|
|
169833
|
-
return {
|
|
169834
|
-
name,
|
|
169835
|
-
description,
|
|
169836
|
-
type,
|
|
169837
|
-
completion: {
|
|
169838
|
-
label: name,
|
|
169839
|
-
detail: name,
|
|
169840
|
-
insertText: name,
|
|
169841
|
-
insertTextMode: main.exports.InsertTextMode.asIs,
|
|
169842
|
-
insertTextFormat: main.exports.InsertTextFormat.PlainText,
|
|
169843
|
-
kind,
|
|
169844
|
-
documentation: { kind: "markdown", value: description },
|
|
169845
|
-
},
|
|
169846
|
-
};
|
|
169847
|
-
}
|
|
169848
|
-
async function featureToLSFeature(editorFeature, kind) {
|
|
169849
|
-
// Get the source for the definition
|
|
169850
|
-
const source = await editorFeature.loadSource();
|
|
169851
|
-
const { name } = editorFeature;
|
|
169852
|
-
const description = editorFeature.getDescription();
|
|
169853
|
-
const resultCompletion = {
|
|
169854
|
-
label: name,
|
|
169855
|
-
detail: name,
|
|
169856
|
-
insertText: name,
|
|
169857
|
-
insertTextMode: main.exports.InsertTextMode.asIs,
|
|
169858
|
-
insertTextFormat: main.exports.InsertTextFormat.PlainText,
|
|
169859
|
-
kind,
|
|
169860
|
-
};
|
|
169861
|
-
const result = {
|
|
169862
|
-
name,
|
|
169863
|
-
description,
|
|
169864
|
-
type: "dictionary",
|
|
169865
|
-
properties: [],
|
|
169866
|
-
completion: resultCompletion,
|
|
169867
|
-
};
|
|
169868
|
-
// No source definition, then it will be a feature without any known fields
|
|
169869
|
-
if (!source) {
|
|
169870
|
-
return result;
|
|
169871
|
-
}
|
|
169872
|
-
// Create properties for the fields and the aliases
|
|
169873
|
-
// Also improve the feature completion documentation
|
|
169874
|
-
let featureCompletionDescription = description;
|
|
169823
|
+
/**
|
|
169824
|
+
* converts fields to profile values and calculates the feature completion description all in one iteration
|
|
169825
|
+
*/
|
|
169826
|
+
function fieldsToProfileValues(fields, initialFeatureCompletionDescription, includeAliases = false) {
|
|
169827
|
+
let featureCompletionDescription = initialFeatureCompletionDescription;
|
|
169875
169828
|
const fieldProfileValues = [];
|
|
169876
169829
|
const aliasProfileValues = [];
|
|
169877
|
-
supportedFields(
|
|
169878
|
-
let fieldCompletionDescription = `**${field.name}** \n${field.type}`;
|
|
169879
|
-
if (field.description) {
|
|
169880
|
-
fieldCompletionDescription += ` \n'${field.description}`;
|
|
169881
|
-
}
|
|
169830
|
+
supportedFields(fields).forEach((field) => {
|
|
169882
169831
|
if (featureCompletionDescription) {
|
|
169883
169832
|
featureCompletionDescription += " \n \n";
|
|
169884
169833
|
}
|
|
169885
|
-
featureCompletionDescription += `**${field.name}** (${
|
|
169834
|
+
featureCompletionDescription += `**${field.name}** (${field.alias}) \n${field.type}`;
|
|
169886
169835
|
if (field.description) {
|
|
169887
169836
|
featureCompletionDescription += ` \n'${field.description}`;
|
|
169888
169837
|
}
|
|
169889
169838
|
// The property for the field
|
|
169890
|
-
const type =
|
|
169839
|
+
const type = fieldTypeToApiValueVarType(field);
|
|
169891
169840
|
const insertText = getMemberExpressionProperty(field.name, false);
|
|
169892
169841
|
const description = fieldAlias(field);
|
|
169893
169842
|
fieldProfileValues.push({
|
|
@@ -169901,65 +169850,35 @@ async function featureToLSFeature(editorFeature, kind) {
|
|
|
169901
169850
|
insertTextMode: main.exports.InsertTextMode.asIs,
|
|
169902
169851
|
insertTextFormat: main.exports.InsertTextFormat.PlainText,
|
|
169903
169852
|
kind: main.exports.CompletionItemKind.Field,
|
|
169904
|
-
documentation: { kind: "markdown", value: fieldCompletionDescription },
|
|
169905
169853
|
},
|
|
169906
169854
|
});
|
|
169907
|
-
if (
|
|
169908
|
-
|
|
169909
|
-
|
|
169910
|
-
|
|
169911
|
-
|
|
169912
|
-
|
|
169913
|
-
|
|
169855
|
+
if (includeAliases) {
|
|
169856
|
+
if (!field.alias || field.alias.toLowerCase() === field.name.toLowerCase()) {
|
|
169857
|
+
return;
|
|
169858
|
+
}
|
|
169859
|
+
// The property for the alias if different than the field name
|
|
169860
|
+
let aliasCompletionDescription = `**${field.alias}** \n${field.type}`;
|
|
169861
|
+
if (field.description) {
|
|
169862
|
+
aliasCompletionDescription += ` \n'${field.description}`;
|
|
169863
|
+
}
|
|
169864
|
+
aliasProfileValues.push({
|
|
169865
|
+
name: field.alias,
|
|
169866
|
+
description: field.name,
|
|
169867
|
+
type,
|
|
169868
|
+
completion: {
|
|
169869
|
+
label: field.alias,
|
|
169870
|
+
detail: field.name,
|
|
169871
|
+
insertText,
|
|
169872
|
+
insertTextMode: main.exports.InsertTextMode.asIs,
|
|
169873
|
+
insertTextFormat: main.exports.InsertTextFormat.PlainText,
|
|
169874
|
+
kind: main.exports.CompletionItemKind.Field,
|
|
169875
|
+
documentation: { kind: "markdown", value: aliasCompletionDescription },
|
|
169876
|
+
},
|
|
169877
|
+
});
|
|
169914
169878
|
}
|
|
169915
|
-
aliasProfileValues.push({
|
|
169916
|
-
name: field.alias,
|
|
169917
|
-
description: field.name,
|
|
169918
|
-
type,
|
|
169919
|
-
completion: {
|
|
169920
|
-
label: field.alias,
|
|
169921
|
-
detail: field.name,
|
|
169922
|
-
insertText,
|
|
169923
|
-
insertTextMode: main.exports.InsertTextMode.asIs,
|
|
169924
|
-
insertTextFormat: main.exports.InsertTextFormat.PlainText,
|
|
169925
|
-
kind: main.exports.CompletionItemKind.Field,
|
|
169926
|
-
documentation: { kind: "markdown", value: aliasCompletionDescription },
|
|
169927
|
-
},
|
|
169928
|
-
});
|
|
169929
169879
|
});
|
|
169930
|
-
|
|
169931
|
-
|
|
169932
|
-
return result;
|
|
169933
|
-
}
|
|
169934
|
-
async function dictionaryToLSDictionary(editorDictionary, kind) {
|
|
169935
|
-
const { name, dictionaryVariables: variables } = editorDictionary;
|
|
169936
|
-
const description = editorDictionary.getDescription();
|
|
169937
|
-
const completionDescription = variables.reduce((previous, p) => {
|
|
169938
|
-
if (previous !== "") {
|
|
169939
|
-
previous += " \n \n";
|
|
169940
|
-
}
|
|
169941
|
-
previous += `**${p.name}** \n${p.type}`;
|
|
169942
|
-
const description = p.getDescription();
|
|
169943
|
-
if (description) {
|
|
169944
|
-
previous += ` \n${description}`;
|
|
169945
|
-
}
|
|
169946
|
-
return previous;
|
|
169947
|
-
}, description);
|
|
169948
|
-
return {
|
|
169949
|
-
name,
|
|
169950
|
-
description,
|
|
169951
|
-
type: "dictionary",
|
|
169952
|
-
properties: await variablesToLSVariable(variables, main.exports.CompletionItemKind.Field),
|
|
169953
|
-
completion: {
|
|
169954
|
-
label: name,
|
|
169955
|
-
detail: name,
|
|
169956
|
-
insertText: name,
|
|
169957
|
-
insertTextMode: main.exports.InsertTextMode.asIs,
|
|
169958
|
-
insertTextFormat: main.exports.InsertTextFormat.PlainText,
|
|
169959
|
-
kind,
|
|
169960
|
-
documentation: { kind: "markdown", value: completionDescription },
|
|
169961
|
-
},
|
|
169962
|
-
};
|
|
169880
|
+
const properties = [...fieldProfileValues, ...aliasProfileValues];
|
|
169881
|
+
return [properties, featureCompletionDescription];
|
|
169963
169882
|
}
|
|
169964
169883
|
/**
|
|
169965
169884
|
* Represents a item in the EditorProfile. The profile is converted into an optimized way for
|
|
@@ -170871,14 +170790,6 @@ class EditorProfile extends DictionaryVariable {
|
|
|
170871
170790
|
get supportFeatureSetFunctions() {
|
|
170872
170791
|
return this.definition?.bundles?.includes("data-access") ?? false;
|
|
170873
170792
|
}
|
|
170874
|
-
/**
|
|
170875
|
-
* Returns the language service profile. It is different than the editor profile as it is optimized for Monaco.
|
|
170876
|
-
*/
|
|
170877
|
-
async toLSProfile() {
|
|
170878
|
-
const { apiVersion, bundles, hiddenApiItems } = this.definition ?? {};
|
|
170879
|
-
const variables = await variablesToLSVariable(this.dictionaryVariables);
|
|
170880
|
-
return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
|
|
170881
|
-
}
|
|
170882
170793
|
/**
|
|
170883
170794
|
* Returns the EditorProfile as a json. The EditorProfile may have been updated. This function allows to
|
|
170884
170795
|
* get the new json representing mutations.
|
|
@@ -170892,144 +170803,6 @@ class EditorProfile extends DictionaryVariable {
|
|
|
170892
170803
|
}
|
|
170893
170804
|
//#endregion
|
|
170894
170805
|
|
|
170895
|
-
function isFeatureDefinition(item) {
|
|
170896
|
-
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
170897
|
-
}
|
|
170898
|
-
function isFeatureSetDefinition(item) {
|
|
170899
|
-
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
170900
|
-
}
|
|
170901
|
-
function isFeatureSetCollectionDefinition(item) {
|
|
170902
|
-
return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
|
|
170903
|
-
}
|
|
170904
|
-
/**
|
|
170905
|
-
* Get a PredefinedProfile for a locale. If not already loaded then fetch it.
|
|
170906
|
-
* If the locale doesn't exist or the locale profile file doesn't exist then returns
|
|
170907
|
-
* the english version of the profile.
|
|
170908
|
-
*/
|
|
170909
|
-
async function getSdkPredefinedProfiles(locale = "en") {
|
|
170910
|
-
const profiles = sdkPredefinedProfilesMap.get(locale);
|
|
170911
|
-
if (profiles) {
|
|
170912
|
-
return profiles;
|
|
170913
|
-
}
|
|
170914
|
-
if (!supportedLocales.has(locale)) {
|
|
170915
|
-
return await getSdkPredefinedProfiles("en");
|
|
170916
|
-
}
|
|
170917
|
-
try {
|
|
170918
|
-
const response = await fetch(index.getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
|
|
170919
|
-
if (response.ok) {
|
|
170920
|
-
return cacheSdkPredefinedProfiles(locale, (await response.json()));
|
|
170921
|
-
}
|
|
170922
|
-
if (locale === "en") {
|
|
170923
|
-
return null;
|
|
170924
|
-
}
|
|
170925
|
-
return await getSdkPredefinedProfiles("en");
|
|
170926
|
-
}
|
|
170927
|
-
catch {
|
|
170928
|
-
return null;
|
|
170929
|
-
}
|
|
170930
|
-
}
|
|
170931
|
-
const sdkPredefinedProfilesMap = new Map();
|
|
170932
|
-
/**
|
|
170933
|
-
* Convert a stored profile into a PredefinedProfile and add it to the in-memory
|
|
170934
|
-
* Map of profiles per locale.
|
|
170935
|
-
*/
|
|
170936
|
-
function cacheSdkPredefinedProfiles(locale, profiles) {
|
|
170937
|
-
const map = new Map();
|
|
170938
|
-
profiles.forEach((profile) => {
|
|
170939
|
-
map.set(profile.id, profile);
|
|
170940
|
-
});
|
|
170941
|
-
sdkPredefinedProfilesMap.set(locale, map);
|
|
170942
|
-
return map;
|
|
170943
|
-
}
|
|
170944
|
-
async function getSdkPredefinedProfile(id, locale = "en") {
|
|
170945
|
-
const profiles = await getSdkPredefinedProfiles(locale);
|
|
170946
|
-
return profiles?.get(id) ?? null;
|
|
170947
|
-
}
|
|
170948
|
-
function isExtendedPredefinedProfileDefinition(item) {
|
|
170949
|
-
return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
|
|
170950
|
-
}
|
|
170951
|
-
function convertApiVariables(variables) {
|
|
170952
|
-
return variables?.map(convertApiVariable);
|
|
170953
|
-
}
|
|
170954
|
-
function convertApiVariable(variable) {
|
|
170955
|
-
switch (variable.type) {
|
|
170956
|
-
case "dictionary":
|
|
170957
|
-
return {
|
|
170958
|
-
...variable,
|
|
170959
|
-
type: variable.type,
|
|
170960
|
-
properties: convertApiVariables(variable.properties),
|
|
170961
|
-
};
|
|
170962
|
-
case "array": {
|
|
170963
|
-
return {
|
|
170964
|
-
...variable,
|
|
170965
|
-
type: variable.type,
|
|
170966
|
-
elementType: { type: "number", name: "number" },
|
|
170967
|
-
};
|
|
170968
|
-
}
|
|
170969
|
-
default:
|
|
170970
|
-
return { ...variable, type: variable.type };
|
|
170971
|
-
}
|
|
170972
|
-
}
|
|
170973
|
-
async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
|
|
170974
|
-
if (!isPredefinedProfile(predefinedProfile)) {
|
|
170975
|
-
return undefined;
|
|
170976
|
-
}
|
|
170977
|
-
const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
|
|
170978
|
-
if (!sdkPredefinedProfile) {
|
|
170979
|
-
return undefined;
|
|
170980
|
-
}
|
|
170981
|
-
const editorProfile = {
|
|
170982
|
-
bundles: [...sdkPredefinedProfile.bundles],
|
|
170983
|
-
variables: [],
|
|
170984
|
-
hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
|
|
170985
|
-
};
|
|
170986
|
-
// Merge the SDK variables' definitions/properties with the predefined profile definitions.
|
|
170987
|
-
sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
|
|
170988
|
-
// Don't include disabled variables
|
|
170989
|
-
if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
|
|
170990
|
-
return;
|
|
170991
|
-
}
|
|
170992
|
-
// Try to get a definition from the predefined profile, for the variable that needs one.
|
|
170993
|
-
const definition = predefinedProfile.definitions[predefinedVariable.name];
|
|
170994
|
-
// Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
|
|
170995
|
-
// despite the type checking from the switch statement.
|
|
170996
|
-
switch (predefinedVariable.type) {
|
|
170997
|
-
case "dictionary": {
|
|
170998
|
-
// For dictionary, we support properties overrride
|
|
170999
|
-
return editorProfile.variables.push(convertApiVariable({
|
|
171000
|
-
...predefinedVariable,
|
|
171001
|
-
type: predefinedVariable.type,
|
|
171002
|
-
properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
|
|
171003
|
-
}));
|
|
171004
|
-
}
|
|
171005
|
-
case "feature":
|
|
171006
|
-
// If the definition is not valid, then we don't include it.
|
|
171007
|
-
if (!isFeatureDefinition(definition)) {
|
|
171008
|
-
return;
|
|
171009
|
-
}
|
|
171010
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
171011
|
-
case "featureSet":
|
|
171012
|
-
// If the definition is not valid, then we don't include it.
|
|
171013
|
-
if (!isFeatureSetDefinition(definition)) {
|
|
171014
|
-
return;
|
|
171015
|
-
}
|
|
171016
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
171017
|
-
case "featureSetCollection":
|
|
171018
|
-
// If the definition is not valid, then we don't include it.
|
|
171019
|
-
if (!isFeatureSetCollectionDefinition(definition)) {
|
|
171020
|
-
return;
|
|
171021
|
-
}
|
|
171022
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
171023
|
-
default:
|
|
171024
|
-
return editorProfile.variables.push(convertApiVariable(predefinedVariable));
|
|
171025
|
-
}
|
|
171026
|
-
});
|
|
171027
|
-
if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
|
|
171028
|
-
editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
|
|
171029
|
-
}
|
|
171030
|
-
return editorProfile;
|
|
171031
|
-
}
|
|
171032
|
-
|
|
171033
170806
|
// this file contains the building blocks for a language default provider
|
|
171034
170807
|
const defaultContext = {
|
|
171035
170808
|
locale: "en",
|
|
@@ -171128,12 +170901,12 @@ exports.Range = Range;
|
|
|
171128
170901
|
exports.Uri = Uri;
|
|
171129
170902
|
exports.addLTRMark = addLTRMark;
|
|
171130
170903
|
exports.commonjsGlobal = commonjsGlobal;
|
|
171131
|
-
exports.convertToEditorProfileDefinition = convertToEditorProfileDefinition;
|
|
171132
170904
|
exports.createFilterExpression = createFilterExpression;
|
|
171133
170905
|
exports.debounce = debounce;
|
|
171134
170906
|
exports.devToolsAwareTimeout = devToolsAwareTimeout;
|
|
171135
170907
|
exports.editor = editor;
|
|
171136
170908
|
exports.fetchT9nStringsBundle = fetchT9nStringsBundle;
|
|
170909
|
+
exports.fieldsToProfileValues = fieldsToProfileValues;
|
|
171137
170910
|
exports.filterCollection = filterCollection;
|
|
171138
170911
|
exports.generateGuid = generateGuid;
|
|
171139
170912
|
exports.generateTokensCSSForColorMap = generateTokensCSSForColorMap;
|
|
@@ -171142,6 +170915,8 @@ exports.getElementTheme = getElementTheme;
|
|
|
171142
170915
|
exports.hasSameOrigin = hasSameOrigin;
|
|
171143
170916
|
exports.importArcade = importArcade;
|
|
171144
170917
|
exports.importRequest = importRequest;
|
|
170918
|
+
exports.isFeatureDefinition = isFeatureDefinition;
|
|
170919
|
+
exports.isFeatureSetCollectionDefinition = isFeatureSetCollectionDefinition;
|
|
171145
170920
|
exports.isFeatureSetDefinition = isFeatureSetDefinition;
|
|
171146
170921
|
exports.isNotUndefined = isNotUndefined;
|
|
171147
170922
|
exports.isPredefinedProfile = isPredefinedProfile;
|
|
@@ -171157,4 +170932,5 @@ exports.setFocusOnElement = setFocusOnElement;
|
|
|
171157
170932
|
exports.setValuesInString = setValuesInString;
|
|
171158
170933
|
exports.startLocaleObserver = startLocaleObserver;
|
|
171159
170934
|
exports.supportedFields = supportedFields;
|
|
170935
|
+
exports.supportedLocales = supportedLocales;
|
|
171160
170936
|
exports.typescriptDefaults = typescriptDefaults;
|