@arcgis/portal-components 5.2.0-next.160 → 5.2.0-next.162

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/cdn/{NICTB76A.js → 2DIAUHE5.js} +1 -1
  2. package/dist/cdn/{5GTO7PTH.js → 2IKXUDFM.js} +1 -1
  3. package/dist/cdn/{MSO7PIO4.js → 2IRP3ZVE.js} +1 -1
  4. package/dist/cdn/{XKC6SPS4.js → 3HINDHV7.js} +1 -1
  5. package/dist/cdn/{USGROSML.js → 3NTQM2R7.js} +1 -1
  6. package/dist/cdn/{55FL7WQV.js → 3PK47DQP.js} +1 -1
  7. package/dist/cdn/{K6PWSEML.js → 3TLHOVLW.js} +1 -1
  8. package/dist/cdn/3ZHDGFSL.js +2 -0
  9. package/dist/cdn/42VKNALC.js +2 -0
  10. package/dist/cdn/453JLSJV.js +2 -0
  11. package/dist/cdn/{FAOIT32R.js → 4YPPX4Y3.js} +1 -1
  12. package/dist/cdn/{RT6SXACX.js → 4Z7OQ6QY.js} +1 -1
  13. package/dist/cdn/{D7LRCAK4.js → 53GR4QVG.js} +1 -1
  14. package/dist/cdn/57DQMVPP.js +2 -0
  15. package/dist/cdn/{REJN2DGR.js → 5CBXYHFU.js} +1 -1
  16. package/dist/cdn/{JDUO5LCR.js → 64QA6IBU.js} +1 -1
  17. package/dist/cdn/66MA5EIA.js +2 -0
  18. package/dist/cdn/{LTC6K4DZ.js → 6RAOSMME.js} +1 -1
  19. package/dist/cdn/{S5HIKMGQ.js → 6VTAWA6R.js} +1 -1
  20. package/dist/cdn/74XEOQEV.js +2 -0
  21. package/dist/cdn/765N2BRQ.js +2 -0
  22. package/dist/cdn/{UTA2UBBS.js → 7D7RSVSQ.js} +1 -1
  23. package/dist/cdn/{TMG43PBB.js → AARKDW3L.js} +1 -1
  24. package/dist/cdn/{DIKRXF22.js → BFYTNFAM.js} +1 -1
  25. package/dist/cdn/{QU2JYXVL.js → BKU43GE5.js} +1 -1
  26. package/dist/cdn/{KIKEE2KY.js → C3W4HTWD.js} +1 -1
  27. package/dist/cdn/{KYNL256E.js → C7NJCXTN.js} +1 -1
  28. package/dist/cdn/CKEGCEEU.js +2 -0
  29. package/dist/cdn/{V5YXPHYD.js → CWGXNX3W.js} +1 -1
  30. package/dist/cdn/{RUTSKSEA.js → DITALHT7.js} +1 -1
  31. package/dist/cdn/{MC3LJZSI.js → EL5IQDXK.js} +1 -1
  32. package/dist/cdn/{SG7Z5VLB.js → EX5JJTWQ.js} +1 -1
  33. package/dist/cdn/{LNWWUPFK.js → FD7SPNGP.js} +1 -1
  34. package/dist/cdn/{3D3X4POQ.js → FZUEX6YH.js} +1 -1
  35. package/dist/cdn/{EEGDBRHR.js → GTD6FUPM.js} +1 -1
  36. package/dist/cdn/{VDOEP33G.js → HCCPATGO.js} +1 -1
  37. package/dist/cdn/{MFJVE4UZ.js → HOWXDT3E.js} +1 -1
  38. package/dist/cdn/HT4JMB5R.js +2 -0
  39. package/dist/cdn/HTTYI276.js +2 -0
  40. package/dist/cdn/{MQISQ7P3.js → HWDSHH76.js} +1 -1
  41. package/dist/cdn/HXDTSREX.js +2 -0
  42. package/dist/cdn/I7NJ6E6I.js +2 -0
  43. package/dist/cdn/{BLCHSMT7.js → IJLJOGU3.js} +1 -1
  44. package/dist/cdn/J4M77DLV.js +2 -0
  45. package/dist/cdn/JI63K67U.js +2 -0
  46. package/dist/cdn/{33J7647P.js → JIWLTMFC.js} +1 -1
  47. package/dist/cdn/{6BMWSGLA.js → K3ROLJNC.js} +1 -1
  48. package/dist/cdn/{WDMKBY5P.js → K4LOZYJF.js} +1 -1
  49. package/dist/cdn/{OUFIJDIW.js → KLQ5GKNI.js} +1 -1
  50. package/dist/cdn/{4NM7IXBT.js → KQEU5AFO.js} +1 -1
  51. package/dist/cdn/{FUCC4ZHI.js → LU7EPIPR.js} +1 -1
  52. package/dist/cdn/{7NQY5QJK.js → M6AFYDDU.js} +1 -1
  53. package/dist/cdn/{OQGUCK3G.js → MEBV5YAO.js} +1 -1
  54. package/dist/cdn/{TAREB43U.js → MOJGAOYF.js} +1 -1
  55. package/dist/cdn/{V2OG75CK.js → MTY2ZUR2.js} +1 -1
  56. package/dist/cdn/{RBGARTND.js → MXL2BB47.js} +1 -1
  57. package/dist/cdn/{EL6F7I65.js → NKRXJF72.js} +1 -1
  58. package/dist/cdn/{SKVSGN5R.js → O6KBOBTA.js} +1 -1
  59. package/dist/cdn/{OV5O7YP4.js → OUZPGGZR.js} +1 -1
  60. package/dist/cdn/{2QH66WX5.js → P2XPGJIH.js} +1 -1
  61. package/dist/cdn/{YJS5PGLO.js → P5WD6JVL.js} +1 -1
  62. package/dist/cdn/{OV4DNSQV.js → PGVE7V53.js} +1 -1
  63. package/dist/cdn/PLGWH6LA.js +2 -0
  64. package/dist/cdn/PO54NFLO.js +2 -0
  65. package/dist/cdn/{3WHDCXCM.js → PPHEHA5I.js} +3 -3
  66. package/dist/cdn/{QVMZCD3A.js → PS5BTYGD.js} +1 -1
  67. package/dist/cdn/{UGRFT75G.js → Q53MAFDQ.js} +1 -1
  68. package/dist/cdn/{D6SIWTME.js → QQ6MQPCH.js} +1 -1
  69. package/dist/cdn/{A3MNR4AI.js → QS53VF2B.js} +1 -1
  70. package/dist/cdn/{2XTCMELJ.js → RAAM3NQL.js} +1 -1
  71. package/dist/cdn/{AQBDDI5G.js → RVZXDXUC.js} +1 -1
  72. package/dist/cdn/S62RRECO.js +2 -0
  73. package/dist/cdn/{YEMT55I6.js → S6R4ZQPM.js} +1 -1
  74. package/dist/cdn/{FQYC25GN.js → SFNAWLR5.js} +1 -1
  75. package/dist/cdn/{F575CWKZ.js → SOLQD7DU.js} +1 -1
  76. package/dist/cdn/{PJGJZYBY.js → ST7YCKG6.js} +1 -1
  77. package/dist/cdn/{JDIMTYM2.js → TA456NXC.js} +1 -1
  78. package/dist/cdn/{ADZAKBOJ.js → TFGNQADN.js} +1 -1
  79. package/dist/cdn/TNNIKT2R.js +2 -0
  80. package/dist/cdn/{456JKNCU.js → UANMZWU3.js} +1 -1
  81. package/dist/cdn/UC42OQDP.js +2 -0
  82. package/dist/cdn/{WPZ5FJSC.js → UCE5G5TL.js} +1 -1
  83. package/dist/cdn/{7EOHRU5A.js → UQSYMUOF.js} +1 -1
  84. package/dist/cdn/URZI7SU4.js +2 -0
  85. package/dist/cdn/{WXD774JG.js → V4XGNCNI.js} +1 -1
  86. package/dist/cdn/{CWSEBETE.js → VAFMKDDD.js} +1 -1
  87. package/dist/cdn/VSNBZIZ4.js +2 -0
  88. package/dist/cdn/{CVOWIH4J.js → W3UGJC24.js} +1 -1
  89. package/dist/cdn/{VMQIDO4Z.js → WNDPRHBO.js} +1 -1
  90. package/dist/cdn/{BQZ34JPU.js → X4E3B7EQ.js} +1 -1
  91. package/dist/cdn/{X4LJOMMF.js → XGRVBCMF.js} +1 -1
  92. package/dist/cdn/XRF3NMPE.js +2 -0
  93. package/dist/cdn/XYH7L6WW.js +2 -0
  94. package/dist/cdn/XYZFL54V.js +2 -0
  95. package/dist/cdn/{23X56P4K.js → Y2EJ24EM.js} +1 -1
  96. package/dist/cdn/{7G7MPSXD.js → ZYZ3EIB7.js} +1 -1
  97. package/dist/cdn/index.js +1 -1
  98. package/dist/chunks/functionalities.js +14 -8
  99. package/dist/components/arcgis-portal-account-switcher/customElement.js +1 -1
  100. package/dist/components/arcgis-portal-add-gps-metadata/customElement.js +145 -124
  101. package/dist/components/arcgis-portal-delete-items/customElement.js +151 -158
  102. package/dist/components/arcgis-portal-delete-items/index.js +1 -1
  103. package/dist/docs/api.json +1 -1
  104. package/dist/docs/docs.json +1 -1
  105. package/dist/docs/web-types.json +1 -1
  106. package/package.json +7 -7
  107. package/dist/cdn/24PB4CMZ.js +0 -2
  108. package/dist/cdn/2GBRZSEC.js +0 -2
  109. package/dist/cdn/3SRD2O7D.js +0 -2
  110. package/dist/cdn/7GHMHFBI.js +0 -2
  111. package/dist/cdn/AOZUSTFQ.js +0 -2
  112. package/dist/cdn/BYWI4K4N.js +0 -2
  113. package/dist/cdn/FORXD2BX.js +0 -2
  114. package/dist/cdn/FQOOFBPI.js +0 -2
  115. package/dist/cdn/GQ72VSNC.js +0 -2
  116. package/dist/cdn/HJE457T5.js +0 -2
  117. package/dist/cdn/IFN5ZRZD.js +0 -2
  118. package/dist/cdn/LCQW3IG6.js +0 -2
  119. package/dist/cdn/LX4CTYFB.js +0 -2
  120. package/dist/cdn/NUEXG7VJ.js +0 -2
  121. package/dist/cdn/PRIG3TBV.js +0 -2
  122. package/dist/cdn/Q6BRXAQD.js +0 -2
  123. package/dist/cdn/QBV7VDQK.js +0 -2
  124. package/dist/cdn/R54T4WBW.js +0 -2
  125. package/dist/cdn/S5J33LIC.js +0 -2
  126. package/dist/cdn/UETPYEHR.js +0 -2
  127. package/dist/cdn/V77BFG3A.js +0 -2
  128. package/dist/cdn/V7GVZLEG.js +0 -2
  129. package/dist/cdn/WDUH4TEH.js +0 -2
  130. package/dist/cdn/YGF6ENPU.js +0 -2
  131. /package/dist/cdn/{R74ZHFA6.js → JMA56SOB.js} +0 -0
@@ -1,12 +1,18 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const t = (e) => {
3
- throw new Error(`Unexpected value: ${e}`);
4
- }, a = async (e) => {
5
- await new Promise((s) => setTimeout(s, e));
6
- }, n = (e, s) => e.includes(s), o = (e) => Object.keys(e);
2
+ const n = (t) => {
3
+ throw new Error(`Unexpected value: ${t}`);
4
+ }, a = async (t) => {
5
+ await new Promise((e) => setTimeout(e, t));
6
+ }, o = async (t, e = 10) => {
7
+ for (let s = 0; s < e; s++)
8
+ if (s > 0 && await a(500 * 2 ** Math.floor((s - 1) / 2)), await t())
9
+ return !0;
10
+ return !1;
11
+ }, r = (t, e) => t.includes(e), i = (t) => Object.keys(t);
7
12
  export {
8
- t as a,
9
- o as b,
10
- n as i,
13
+ n as a,
14
+ i as b,
15
+ r as i,
16
+ o as p,
11
17
  a as t
12
18
  };
@@ -346,7 +346,7 @@ class ee extends T {
346
346
  const { portal: s, user: t, clientId: i } = this;
347
347
  if (!s || !t || !e)
348
348
  return;
349
- const n = h(t.sourceJSON.orgUrlKey ?? "", s), a = p.findCredential(n, t.id || t.username);
349
+ const n = h(t.sourceJSON.orgUrlKey ?? "", s), a = p.findCredential(n, t.username);
350
350
  a && U({ config: { baseUrl: n, restBaseUrl: `${n}/sharing/rest` }, token: a?.token, clientId: i }), F(e, s, i);
351
351
  }
352
352
  signoutAll(e) {
@@ -1,58 +1,59 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as F } from "../../chunks/runtime.js";
3
- import q from "@arcgis/core/layers/Layer.js";
4
- import O from "@arcgis/core/portal/PortalItem.js";
5
- import { LitElement as P, createEvent as h } from "@arcgis/lumina";
6
- import { css as V, html as c } from "lit";
7
- import { u as S } from "../../chunks/useT9n.js";
8
- import m from "@arcgis/core/request.js";
9
- import { r as b } from "../../chunks/request.js";
10
- const D = V`:host{background-color:var(--calcite-color-foreground-1)}.scrim-container{position:relative}.base-fields-control{margin-inline-end:.75rem}.added{display:inline-flex;gap:.5rem;flex-shrink:0;white-space:nowrap}.added calcite-icon{color:var(--calcite-color-status-success)}.add-fields-button{margin:.75rem 0}calcite-block{border-bottom:0}calcite-list-item:last-child:after{display:block;margin-inline-start:var(--calcite-spacing-md);border-block-end:1px solid var(--calcite-list-border-color, var(--calcite-color-border-3));content:""}`;
11
- async function v({
2
+ import { c as S } from "../../chunks/runtime.js";
3
+ import v from "@arcgis/core/layers/Layer.js";
4
+ import I from "@arcgis/core/portal/PortalItem.js";
5
+ import { LitElement as C, createEvent as f } from "@arcgis/lumina";
6
+ import { css as L, html as m } from "lit";
7
+ import { u as A } from "../../chunks/useT9n.js";
8
+ import g from "@arcgis/core/request.js";
9
+ import { r as O } from "../../chunks/request.js";
10
+ import { p as z } from "../../chunks/functionalities.js";
11
+ const w = L`:host{background-color:var(--calcite-color-foreground-1)}.scrim-container{position:relative}.base-fields-control{margin-inline-end:.75rem}.added{display:inline-flex;gap:.5rem;flex-shrink:0;white-space:nowrap}.added calcite-icon{color:var(--calcite-color-status-success)}.add-fields-button{margin:.75rem 0}calcite-block{border-bottom:0}calcite-list-item:last-child:after{display:block;margin-inline-start:var(--calcite-spacing-md);border-block-end:1px solid var(--calcite-list-border-color, var(--calcite-color-border-3));content:""}`;
12
+ async function b({
12
13
  item: s,
13
14
  layers: e
14
15
  }) {
15
- const { url: l } = s, a = /* @__PURE__ */ new Map();
16
- if (!l)
17
- return { result: a };
16
+ const { url: t } = s, l = /* @__PURE__ */ new Map();
17
+ if (!t)
18
+ return { result: l };
18
19
  try {
19
- const i = (await m(l, {
20
+ const i = (await g(t, {
20
21
  cacheBust: !0,
21
22
  query: { f: "json" },
22
23
  responseType: "json"
23
24
  })).data;
24
25
  if (i.fields) {
25
26
  const n = e?.[0];
26
- return e?.length === 1 && n?.layerId != null && a.set(n.layerId, i.fields), { result: a };
27
+ return e?.length === 1 && n?.layerId != null && l.set(n.layerId, i.fields), { result: l };
27
28
  }
28
29
  if (!i.layers?.length)
29
- return { result: a };
30
- const t = l.replace(/\/$/u, "");
30
+ return { result: l };
31
+ const a = t.replace(/\/$/u, "");
31
32
  return await Promise.all(
32
33
  i.layers.map(async ({ id: n }) => {
33
- const r = (await m(`${t}/${n}`, {
34
+ const r = (await g(`${a}/${n}`, {
34
35
  cacheBust: !0,
35
36
  query: { f: "json" },
36
37
  responseType: "json"
37
38
  })).data;
38
- a.set(n, r.fields ?? []);
39
+ l.set(n, r.fields ?? []);
39
40
  })
40
- ), { result: a };
41
+ ), { result: l };
41
42
  } catch (i) {
42
43
  return console.error("Error getting layer fields:", i), { error: { code: "unhandledError" } };
43
44
  }
44
45
  }
45
- const f = (s) => {
46
+ const P = (s) => {
46
47
  const { url: e } = s;
47
48
  return e ? e.replace("/rest/services", "/rest/admin/services").replace(/\/$/u, "") : null;
48
49
  };
49
- async function I({
50
+ async function x({
50
51
  fields: s,
51
52
  item: e,
52
- portal: l,
53
- layerId: a
53
+ portal: t,
54
+ layerId: l
54
55
  }) {
55
- const i = f(e);
56
+ const i = P(e);
56
57
  if (!i)
57
58
  return {
58
59
  error: {
@@ -61,35 +62,35 @@ async function I({
61
62
  }
62
63
  };
63
64
  try {
64
- const t = await b({
65
- url: `${i}/${a != null ? `${a}/` : ""}addToDefinition`,
66
- portal: l,
65
+ const a = await O({
66
+ url: `${i}/${l != null ? `${l}/` : ""}addToDefinition`,
67
+ portal: t,
67
68
  method: "post",
68
69
  params: {
69
70
  addToDefinition: JSON.stringify({ fields: s })
70
71
  }
71
72
  });
72
- return t.success === !1 || t.error ? {
73
+ return a.success === !1 || a.error ? {
73
74
  error: {
74
75
  code: "unhandledError",
75
- message: t.error?.message
76
+ message: a.error?.message
76
77
  }
77
- } : { result: t };
78
- } catch (t) {
79
- return console.error("Error adding fields to the feature service definition:", t), {
78
+ } : { result: a };
79
+ } catch (a) {
80
+ return console.error("Error adding fields to the feature service definition:", a), {
80
81
  error: {
81
82
  code: "unhandledError"
82
83
  }
83
84
  };
84
85
  }
85
86
  }
86
- async function C({
87
+ async function G({
87
88
  fields: s,
88
89
  item: e,
89
- portal: l,
90
- layerId: a
90
+ portal: t,
91
+ layerId: l
91
92
  }) {
92
- const i = f(e);
93
+ const i = P(e);
93
94
  if (!i)
94
95
  return {
95
96
  error: {
@@ -98,61 +99,61 @@ async function C({
98
99
  }
99
100
  };
100
101
  try {
101
- const t = await b({
102
- url: `${i}/${a != null ? `${a}/` : ""}updateDefinition`,
103
- portal: l,
102
+ const a = await O({
103
+ url: `${i}/${l != null ? `${l}/` : ""}updateDefinition`,
104
+ portal: t,
104
105
  method: "post",
105
106
  params: {
106
107
  updateDefinition: JSON.stringify({ fields: s })
107
108
  }
108
109
  });
109
- return t.success === !1 || t.error ? {
110
+ return a.success === !1 || a.error ? {
110
111
  error: {
111
112
  code: "unhandledError",
112
- message: t.error?.message ?? "Failed to update the feature service definition."
113
+ message: a.error?.message ?? "Failed to update the feature service definition."
113
114
  }
114
- } : { result: t };
115
- } catch (t) {
116
- return console.error("Error updating the feature service definition:", t), {
115
+ } : { result: a };
116
+ } catch (a) {
117
+ return console.error("Error updating the feature service definition:", a), {
117
118
  error: {
118
119
  code: "unhandledError"
119
120
  }
120
121
  };
121
122
  }
122
123
  }
123
- async function L(s) {
124
+ async function R(s) {
124
125
  const { url: e } = s;
125
126
  if (!e)
126
127
  return { error: { code: "unhandledError" } };
127
128
  try {
128
- return { result: (await m(e, { query: { f: "json" } })).data };
129
- } catch (l) {
130
- return console.error("Error getting service info:", l), { error: { code: "unhandledError" } };
129
+ return { result: (await g(e, { query: { f: "json" } })).data };
130
+ } catch (t) {
131
+ return console.error("Error getting service info:", t), { error: { code: "unhandledError" } };
131
132
  }
132
133
  }
133
- const A = (s, e) => {
134
- const l = s.domain ?? null, a = e.domain ?? null;
135
- return l === null || a === null ? l === a : l.type !== a.type ? !1 : l.type === "codedValue" && a.type === "codedValue" ? l.name === a.name && l.codedValues.length === a.codedValues.length && l.codedValues.every(
136
- ({ code: i, name: t }, n) => i === a.codedValues[n]?.code && t === a.codedValues[n]?.name
137
- ) : l.type === "range" && a.type === "range" ? l.name === a.name && l.range[0] === a.range[0] && l.range[1] === a.range[1] : !0;
138
- }, z = (s, e) => {
139
- const l = new Map(e.map((t) => [t.name, t])), a = [], i = [];
140
- for (const t of s) {
141
- const n = l.get(t.name);
142
- n ? A(t, n) || i.push({ name: t.name, domain: t.domain }) : a.push(t);
134
+ const E = (s, e) => {
135
+ const t = s.domain ?? null, l = e.domain ?? null;
136
+ return t === null || l === null ? t === l : t.type !== l.type ? !1 : t.type === "codedValue" && l.type === "codedValue" ? t.codedValues.length === l.codedValues.length && t.codedValues.every(
137
+ ({ code: i, name: a }, n) => i === l.codedValues[n]?.code && a === l.codedValues[n]?.name
138
+ ) : t.type === "range" && l.type === "range" ? t.range[0] === l.range[0] && t.range[1] === l.range[1] : !0;
139
+ }, N = (s, e) => {
140
+ const t = new Map(e.map((a) => [a.name, a])), l = [], i = [];
141
+ for (const a of s) {
142
+ const n = t.get(a.name);
143
+ n ? E(a, n) || i.push({ name: a.name, domain: a.domain }) : l.push(a);
143
144
  }
144
- return { missingFields: a, modifiedFields: i };
145
- }, g = (s) => {
145
+ return { missingFields: l, modifiedFields: i };
146
+ }, M = (s) => {
146
147
  switch (s) {
147
148
  case "esriGeometryPolyline":
148
149
  case "esriGeometryPolygon":
149
- return [...G];
150
+ return [...k];
150
151
  case "esriGeometryPoint":
151
- return [...R];
152
+ return [...$];
152
153
  default:
153
154
  return [];
154
155
  }
155
- }, x = (s) => s === "esriGeometryPoint" ? [...E] : [], w = (s) => s === "esriGeometryPoint" ? [...N] : [], G = [
156
+ }, _ = (s) => s === "esriGeometryPoint" ? [...B] : [], F = (s) => s === "esriGeometryPoint" ? [...U] : [], k = [
156
157
  {
157
158
  name: "esrignss_avg_h_rms",
158
159
  type: "esriFieldTypeDouble",
@@ -224,7 +225,7 @@ const A = (s, e) => {
224
225
  domain: null,
225
226
  defaultValue: null
226
227
  }
227
- ], R = [
228
+ ], $ = [
228
229
  {
229
230
  name: "esrignss_speed",
230
231
  type: "esriFieldTypeDouble",
@@ -635,7 +636,7 @@ const A = (s, e) => {
635
636
  domain: null,
636
637
  defaultValue: null
637
638
  }
638
- ], E = [
639
+ ], B = [
639
640
  {
640
641
  name: "esrisnsr_tilt_azimuth_accuracy",
641
642
  type: "esriFieldTypeDouble",
@@ -693,7 +694,7 @@ const A = (s, e) => {
693
694
  },
694
695
  defaultValue: null
695
696
  }
696
- ], N = [
697
+ ], U = [
697
698
  {
698
699
  name: "esrignss_cp1_latitude",
699
700
  type: "esriFieldTypeDouble",
@@ -1182,64 +1183,67 @@ const A = (s, e) => {
1182
1183
  defaultValue: null
1183
1184
  }
1184
1185
  ];
1185
- function M(s) {
1186
+ function K(s) {
1186
1187
  if (s.geometryType === "polyline" || s.geometryType === "polygon") {
1187
1188
  const e = s.capabilities;
1188
1189
  return e?.data?.supportsAttachment && e?.operations?.supportsQueryAttachments;
1189
1190
  }
1190
1191
  return !0;
1191
1192
  }
1192
- const $ = (s) => s.every(M), B = ["point", "polyline", "polygon"], T = (s) => s?.type === "Feature Service";
1193
- class k extends P {
1193
+ const Y = (s) => s.every(K), H = ["point", "polyline", "polygon"], q = (s) => s?.type === "Feature Service";
1194
+ class j extends C {
1194
1195
  constructor() {
1195
- super(...arguments), this.messages = S({ blocking: !0 }), this.initCount = 0, this.supportsAttachments = !1, this.layersLoaded = !1, this.pointLayers = [], this.lineOrPolygonLayers = [], this.loadedItem = null, this.gpsFieldFixesBySet = null, this.addFieldsDisabled = !0, this.initializing = !0, this.hasLineOrPolygonLayer = !1, this.hasPointFeatureLayer = !1, this.addingGPSFieldMetadata = [], this.item = null, this.itemId = null, this.messageOverrides = {}, this.arcgisGPSMetadataFieldsAdded = h(), this.arcgisReadOnlyMode = h();
1196
+ super(...arguments), this.messages = A({ blocking: !0 }), this.initCount = 0, this.supportsAttachments = !1, this.layersLoaded = !1, this.pointLayers = [], this.lineOrPolygonLayers = [], this.loadedItem = null, this.gpsFieldFixesBySet = null, this.addFieldsDisabled = !0, this.initializing = !0, this.hasLineOrPolygonLayer = !1, this.hasPointFeatureLayer = !1, this.addingGPSFieldMetadata = [], this.item = null, this.itemId = null, this.messageOverrides = {}, this.arcgisGPSMetadataFieldsAdded = f(), this.arcgisReadOnlyMode = f();
1196
1197
  }
1197
1198
  static {
1198
1199
  this.properties = { loadedItem: 16, gpsFieldFixesBySet: 16, addFieldsDisabled: 16, initializing: 16, hasLineOrPolygonLayer: 16, hasPointFeatureLayer: 16, addingGPSFieldMetadata: 16, item: 0, itemId: 1, portal: 0, messageOverrides: 0 };
1199
1200
  }
1200
1201
  static {
1201
- this.styles = D;
1202
+ this.styles = w;
1203
+ }
1204
+ connectedCallback() {
1205
+ super.connectedCallback(), this.hasUpdated && this.initItem();
1202
1206
  }
1203
1207
  willUpdate(e) {
1204
1208
  (e.has("item") || e.has("itemId")) && this.initItem();
1205
1209
  }
1206
1210
  async initItem({ showLoading: e = !0 } = {}) {
1207
- const l = ++this.initCount;
1211
+ const t = ++this.initCount;
1208
1212
  if (!this.item && !this.itemId) {
1209
1213
  this.resetItemState(), this.initializing = !1;
1210
1214
  return;
1211
1215
  }
1212
1216
  e && (this.resetItemState(), this.initializing = !0);
1213
- const { item: a, itemId: i, portal: t } = this, n = a ? await a.load() : await new O({
1217
+ const { item: l, itemId: i, portal: a } = this, n = l ? await l.load() : await new I({
1214
1218
  id: i,
1215
- portal: t
1219
+ portal: a
1216
1220
  }).load();
1217
- if (!this.isCurrentInitialization(l))
1221
+ if (!this.isCurrentInitialization(t))
1218
1222
  return;
1219
- if (!T(n)) {
1223
+ if (!q(n)) {
1220
1224
  this.resetItemState(), this.initializing = !1;
1221
1225
  return;
1222
1226
  }
1223
1227
  this.loadedItem = n;
1224
- const r = !e && this.layersLoaded ? [...this.pointLayers, ...this.lineOrPolygonLayers] : await this.getFeatureLayers(n), { result: y } = await L(n);
1225
- if (!this.isCurrentInitialization(l))
1228
+ const r = !e && this.layersLoaded ? [...this.pointLayers, ...this.lineOrPolygonLayers] : await this.getFeatureLayers(n), { result: p } = await R(n);
1229
+ if (!this.isCurrentInitialization(t))
1226
1230
  return;
1227
1231
  this.layersLoaded = !0, this.pointLayers = r.filter((d) => d.geometryType === "point"), this.lineOrPolygonLayers = r.filter((d) => d.geometryType === "polyline" || d.geometryType === "polygon"), this.hasLineOrPolygonLayer = r.some((d) => d.geometryType === "polyline" || d.geometryType === "polygon"), this.hasPointFeatureLayer = r.some((d) => d.geometryType === "point");
1228
- const { result: o, error: u } = r.length > 0 ? await v({ item: n, layers: r }) : {};
1229
- if (!this.isCurrentInitialization(l))
1232
+ const { result: o, error: h } = r.length > 0 ? await b({ item: n, layers: r }) : {};
1233
+ if (!this.isCurrentInitialization(t))
1230
1234
  return;
1231
- if (u) {
1235
+ if (h) {
1232
1236
  this.resetItemState(), this.initializing = !1;
1233
1237
  return;
1234
1238
  }
1235
- const p = o ?? /* @__PURE__ */ new Map();
1239
+ const y = o ?? /* @__PURE__ */ new Map();
1236
1240
  this.gpsFieldFixesBySet = {
1237
- base: this.analyzeFieldSet([...this.pointLayers, ...this.lineOrPolygonLayers], p, "base"),
1238
- gnss: this.analyzeFieldSet(this.pointLayers, p, "gnss"),
1239
- rangefinder: this.analyzeFieldSet(this.pointLayers, p, "rangefinder")
1240
- }, this.supportsAttachments = $(r);
1241
- const _ = y?.sourceSchemaChangesAllowed !== !1;
1242
- this.addFieldsDisabled = !this.supportsAttachments || !_, this.initializing = !1;
1241
+ base: this.analyzeFieldSet([...this.pointLayers, ...this.lineOrPolygonLayers], y, "base"),
1242
+ gnss: this.analyzeFieldSet(this.pointLayers, y, "gnss"),
1243
+ rangefinder: this.analyzeFieldSet(this.pointLayers, y, "rangefinder")
1244
+ }, this.supportsAttachments = Y(r);
1245
+ const T = p?.sourceSchemaChangesAllowed !== !1;
1246
+ this.addFieldsDisabled = !this.supportsAttachments || !T, this.initializing = !1;
1243
1247
  }
1244
1248
  isCurrentInitialization(e) {
1245
1249
  return e === this.initCount;
@@ -1248,11 +1252,11 @@ class k extends P {
1248
1252
  this.loadedItem = null, this.layersLoaded = !1, this.pointLayers = [], this.lineOrPolygonLayers = [], this.gpsFieldFixesBySet = null, this.addFieldsDisabled = !0, this.hasLineOrPolygonLayer = !1, this.hasPointFeatureLayer = !1;
1249
1253
  }
1250
1254
  async getFeatureLayers(e) {
1251
- const l = await q.fromPortalItem({ portalItem: e });
1252
- return await l.load(), "layers" in l ? (await Promise.all(l.layers.map(async (i) => (await i.load(), this.isSupportedFeatureLayer(i) ? i : null)))).filter((i) => !!i) : this.isSupportedFeatureLayer(l) ? [l] : [];
1255
+ const t = await v.fromPortalItem({ portalItem: e });
1256
+ return await t.load(), "layers" in t ? (await Promise.all(t.layers.map(async (i) => (await i.load(), this.isSupportedFeatureLayer(i) ? i : null)))).filter((i) => !!i) : this.isSupportedFeatureLayer(t) ? [t] : [];
1253
1257
  }
1254
1258
  isSupportedFeatureLayer(e) {
1255
- return e.type === "feature" && B.some((l) => l === e.geometryType);
1259
+ return e.type === "feature" && H.some((t) => t === e.geometryType);
1256
1260
  }
1257
1261
  getCompatibleEsriGeometryType(e) {
1258
1262
  switch (e.geometryType) {
@@ -1266,14 +1270,14 @@ class k extends P {
1266
1270
  return null;
1267
1271
  }
1268
1272
  }
1269
- analyzeFieldSet(e, l, a) {
1273
+ analyzeFieldSet(e, t, l) {
1270
1274
  const i = [];
1271
- for (const t of e) {
1272
- if (t.layerId == null)
1275
+ for (const a of e) {
1276
+ if (a.layerId == null)
1273
1277
  continue;
1274
- const n = l.get(t.layerId) ?? [], r = this.getCompatibleEsriGeometryType(t), y = r ? a === "base" ? g(r) : a === "gnss" ? x(r) : w(r) : [], o = z(y, n);
1278
+ const n = t.get(a.layerId) ?? [], r = this.getCompatibleEsriGeometryType(a), p = r ? l === "base" ? M(r) : l === "gnss" ? _(r) : F(r) : [], o = N(p, n);
1275
1279
  (o.missingFields.length > 0 || o.modifiedFields.length > 0) && i.push({
1276
- layerId: t.layerId,
1280
+ layerId: a.layerId,
1277
1281
  fieldsToAdd: o.missingFields,
1278
1282
  domainsToUpdate: o.modifiedFields
1279
1283
  });
@@ -1287,46 +1291,63 @@ class k extends P {
1287
1291
  return this.addingGPSFieldMetadata.includes(e);
1288
1292
  }
1289
1293
  async addFields(e) {
1290
- const l = this.portal ?? this.loadedItem?.portal, a = this.loadedItem, i = this.gpsFieldFixesBySet;
1291
- if (!(!l || !a || !i)) {
1292
- if (l.isReadOnly) {
1293
- this.arcgisReadOnlyMode.emit();
1294
+ const t = this.portal ?? this.loadedItem?.portal, l = this.loadedItem, i = this.gpsFieldFixesBySet;
1295
+ if (!t || !l || !i)
1296
+ return;
1297
+ if (t.isReadOnly) {
1298
+ this.arcgisReadOnlyMode.emit();
1299
+ return;
1300
+ }
1301
+ this.addingGPSFieldMetadata = [...this.addingGPSFieldMetadata, e];
1302
+ const a = [...this.pointLayers, ...this.lineOrPolygonLayers];
1303
+ try {
1304
+ const n = i[e], p = (await Promise.all(n.filter(({ fieldsToAdd: u }) => u.length > 0).map(async ({ fieldsToAdd: u, layerId: c }) => await x({ fields: u, item: l, layerId: c, portal: t })))).every(({ error: u }) => !u), o = p ? await Promise.all(n.filter(({ domainsToUpdate: u }) => u.length > 0).map(async ({ domainsToUpdate: u, layerId: c }) => await G({ fields: u, item: l, layerId: c, portal: t }))) : [], h = p && o.every(({ error: u }) => !u);
1305
+ if (!h || this.loadedItem !== l)
1294
1306
  return;
1295
- }
1296
- this.addingGPSFieldMetadata = [...this.addingGPSFieldMetadata, e];
1297
- try {
1298
- const t = i[e], r = (await Promise.all(t.filter(({ fieldsToAdd: u }) => u.length > 0).map(async ({ fieldsToAdd: u, layerId: p }) => await I({ fields: u, item: a, layerId: p, portal: l })))).every(({ error: u }) => !u), y = r ? await Promise.all(t.filter(({ domainsToUpdate: u }) => u.length > 0).map(async ({ domainsToUpdate: u, layerId: p }) => await C({ fields: u, item: a, layerId: p, portal: l }))) : [], o = r && y.every(({ error: u }) => !u);
1299
- await this.initItem({ showLoading: !1 }), r && o && this.gpsFieldFixesBySet && !this.hasFieldChanges(e) && this.arcgisGPSMetadataFieldsAdded.emit(e);
1300
- } finally {
1301
- this.addingGPSFieldMetadata = this.addingGPSFieldMetadata.filter((t) => t !== e);
1302
- }
1307
+ let y;
1308
+ if (await z(async () => {
1309
+ if (this.loadedItem !== l)
1310
+ return !0;
1311
+ const { result: u, error: c } = await b({ item: l, layers: a });
1312
+ if (c || this.loadedItem !== l)
1313
+ return !0;
1314
+ if (!u)
1315
+ return !1;
1316
+ const V = e === "base" ? a : a.filter((D) => D.geometryType === "point");
1317
+ return this.analyzeFieldSet(V, u, e).length > 0 ? !1 : (y = u, !0);
1318
+ }, 10) || console.warn("Fields were not verified on the service.", {
1319
+ itemId: l.id,
1320
+ fieldSet: e
1321
+ }), !y || this.loadedItem !== l)
1322
+ return;
1323
+ await this.initItem({ showLoading: !1 }), p && h && this.gpsFieldFixesBySet && !this.hasFieldChanges(e) && this.arcgisGPSMetadataFieldsAdded.emit(e);
1324
+ } finally {
1325
+ this.addingGPSFieldMetadata = this.addingGPSFieldMetadata.filter((n) => n !== e);
1303
1326
  }
1304
1327
  }
1305
1328
  canShowAddGPSMetadata() {
1306
1329
  const e = this.loadedItem ?? this.item;
1307
- return !!e && T(e);
1330
+ return !!e && q(e);
1308
1331
  }
1309
1332
  showAdvancedFields() {
1310
1333
  const e = this.gpsFieldFixesBySet;
1311
- return !this.hasPointFeatureLayer || !e ? !1 : this.pointLayers.some((l) => {
1312
- if (l.layerId == null)
1313
- return !1;
1314
- const a = this.getCompatibleEsriGeometryType(l), i = a ? g(a) : [];
1315
- return (e.base.find(({ layerId: n }) => n === l.layerId)?.fieldsToAdd ?? []).length < i.length;
1316
- });
1334
+ return !this.hasPointFeatureLayer || !e ? !1 : this.hasFieldChanges("base") ? this.pointLayers.some((t) => t.layerId == null ? !1 : ["gnss", "rangefinder"].some((l) => {
1335
+ const i = l === "gnss" ? _("esriGeometryPoint") : F("esriGeometryPoint");
1336
+ return (e[l].find(({ layerId: n }) => n === t.layerId)?.fieldsToAdd ?? []).length < i.length;
1337
+ })) : !0;
1317
1338
  }
1318
- renderAddFieldsControl(e, l = !1) {
1319
- const a = this.gpsFieldFixesBySet;
1320
- if (!l && a && !this.hasFieldChanges(e))
1321
- return c`<span slot=actions-end class="added"><calcite-icon icon=check-circle scale=s aria-hidden></calcite-icon>${this.messages.added}</span>`;
1339
+ renderAddFieldsControl(e, t = !1) {
1340
+ const l = this.gpsFieldFixesBySet;
1341
+ if (!t && l && !this.hasFieldChanges(e))
1342
+ return m`<span slot=actions-end class="added"><calcite-icon icon=check-circle scale=s aria-hidden></calcite-icon>${this.messages.added}</span>`;
1322
1343
  const i = this.isLoading(e);
1323
- return c`<calcite-button slot=actions-end class="add-fields-button" appearance=outline-fill .disabled=${l || !a || i || this.addFieldsDisabled} .loading=${i} @click=${async () => await this.addFields(e)}>${i ? this.messages.addingFields : this.messages.addFields}</calcite-button>`;
1344
+ return m`<calcite-button slot=actions-end class="add-fields-button" appearance=outline-fill .disabled=${t || !l || i || this.addFieldsDisabled} .loading=${i} @click=${async () => await this.addFields(e)}>${i ? this.messages.addingFields : this.messages.addFields}</calcite-button>`;
1324
1345
  }
1325
1346
  render() {
1326
- return this.canShowAddGPSMetadata() ? c`<div class="scrim-container"><calcite-block scale=m expanded>${this.initializing && c`<calcite-scrim loading></calcite-scrim>` || ""}<calcite-list .label=${this.messages.gpsOptions} selection-mode=none><calcite-list-item .label=${this.messages.accordionHeading}>${this.renderAddFieldsControl("base")}</calcite-list-item>${this.showAdvancedFields() && c`<calcite-list-item .label=${this.messages.gnssReceiverFields}>${this.renderAddFieldsControl("gnss")}</calcite-list-item><calcite-list-item .label=${this.messages.laserRangefinderFields}>${this.renderAddFieldsControl("rangefinder")}</calcite-list-item>` || ""}</calcite-list></calcite-block></div>` : null;
1347
+ return this.canShowAddGPSMetadata() ? m`<div class="scrim-container"><calcite-block scale=m expanded>${this.initializing && m`<calcite-scrim loading></calcite-scrim>` || ""}<calcite-list .label=${this.messages.gpsOptions} selection-mode=none><calcite-list-item .label=${this.messages.accordionHeading}>${this.renderAddFieldsControl("base")}</calcite-list-item>${this.showAdvancedFields() && m`<calcite-list-item .label=${this.messages.gnssReceiverFields}>${this.renderAddFieldsControl("gnss")}</calcite-list-item><calcite-list-item .label=${this.messages.laserRangefinderFields}>${this.renderAddFieldsControl("rangefinder")}</calcite-list-item>` || ""}</calcite-list></calcite-block></div>` : null;
1327
1348
  }
1328
1349
  }
1329
- F("arcgis-portal-add-gps-metadata", k);
1350
+ S("arcgis-portal-add-gps-metadata", j);
1330
1351
  export {
1331
- k as ArcgisPortalAddGpsMetadata
1352
+ j as ArcgisPortalAddGpsMetadata
1332
1353
  };