@arcgis/portal-components 6.0.0-next.20 → 6.0.0-next.21

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 (172) hide show
  1. package/dist/cdn/{EHHFEPC2.js → 22TDAUX4.js} +1 -1
  2. package/dist/cdn/{5D5INKHG.js → 234TH32X.js} +1 -1
  3. package/dist/cdn/2D3FQXJ4.js +2 -0
  4. package/dist/cdn/{AXKMKCEW.js → 2DXO6FVX.js} +1 -1
  5. package/dist/cdn/{57MT7FOI.js → 2XJX2JUO.js} +1 -1
  6. package/dist/cdn/{SCRIVOPW.js → 3EQGUCO4.js} +1 -1
  7. package/dist/cdn/{HXFKOELM.js → 3J3ISO3E.js} +1 -1
  8. package/dist/cdn/{PXG2SRSN.js → 3RTST3I6.js} +1 -1
  9. package/dist/cdn/{TKTMO2NO.js → 3XH3JHOI.js} +1 -1
  10. package/dist/cdn/{SASCLFKY.js → 4ONCJSSP.js} +1 -1
  11. package/dist/cdn/{O5MB4QQ2.js → 4WQA7UAJ.js} +1 -1
  12. package/dist/cdn/5OWIWCEQ.js +2 -0
  13. package/dist/cdn/{AYHYABMC.js → 5R4JJWGB.js} +1 -1
  14. package/dist/cdn/{SQCDEL42.js → 63HYFDRU.js} +1 -1
  15. package/dist/cdn/{IRCWBDGJ.js → 6MATPHXT.js} +10 -10
  16. package/dist/cdn/{565U4WSN.js → 7IP3RVPH.js} +1 -1
  17. package/dist/cdn/{QKGHH3FS.js → 7ISSDO2T.js} +1 -1
  18. package/dist/cdn/AKTIIRJQ.js +2 -0
  19. package/dist/cdn/{APLSVK3C.js → ASID6YW7.js} +1 -1
  20. package/dist/cdn/{OQ3OHDEB.js → B3HV5JVN.js} +1 -1
  21. package/dist/cdn/B6666VUQ.js +2 -0
  22. package/dist/cdn/{LVUKORME.js → BOO7GG5L.js} +1 -1
  23. package/dist/cdn/CZ4FC4GM.js +2 -0
  24. package/dist/cdn/{LY7NVMME.js → D3LZFIHV.js} +1 -1
  25. package/dist/cdn/{UYROTXZP.js → D3Q72PPN.js} +1 -1
  26. package/dist/cdn/{RAWBYOFF.js → DABNV2OO.js} +1 -1
  27. package/dist/cdn/DOCNBKQZ.js +2 -0
  28. package/dist/cdn/{VXYEF3XW.js → EP7NWEC5.js} +1 -1
  29. package/dist/cdn/{MK2KDBUL.js → EQRBP6H6.js} +1 -1
  30. package/dist/cdn/{AAWXEOVL.js → ESKKH4DE.js} +1 -1
  31. package/dist/cdn/{CUJG43PQ.js → EUQQZIRW.js} +1 -1
  32. package/dist/cdn/F2HT5PVQ.js +2 -0
  33. package/dist/cdn/FE3O23SE.js +2 -0
  34. package/dist/cdn/{U4PHGRXB.js → FGRMURKX.js} +1 -1
  35. package/dist/cdn/{ULTSLT4L.js → FYVATGMR.js} +1 -1
  36. package/dist/cdn/{5SKCVK2P.js → G3WDR53S.js} +1 -1
  37. package/dist/cdn/GAU6DNV5.js +2 -0
  38. package/dist/cdn/GPAIXN52.js +2 -0
  39. package/dist/cdn/GRSBU4PD.js +2 -0
  40. package/dist/cdn/{4I7NKRIH.js → H7FA5HFE.js} +1 -1
  41. package/dist/cdn/{3ZC26CT6.js → HHGKNVCH.js} +1 -1
  42. package/dist/cdn/{OQE662U3.js → HJLWIQDI.js} +1 -1
  43. package/dist/cdn/I3EWDYTU.js +2 -0
  44. package/dist/cdn/{I4ZRFXQ3.js → IKPVMXXW.js} +1 -1
  45. package/dist/cdn/{C5FTQSU6.js → IOFXDIWC.js} +1 -1
  46. package/dist/cdn/IPHBVKMY.js +2 -0
  47. package/dist/cdn/{ZS3JUQN3.js → IUIFCQQU.js} +1 -1
  48. package/dist/cdn/{QJB32L7F.js → IVDZGUNZ.js} +1 -1
  49. package/dist/cdn/J6SI4Z4F.js +2 -0
  50. package/dist/cdn/K7LYYLUF.js +2 -0
  51. package/dist/cdn/{Y72W3QFF.js → KDORI7H4.js} +1 -1
  52. package/dist/cdn/{2267AKWE.js → LGJWULAW.js} +1 -1
  53. package/dist/cdn/LTMPXQTC.js +2 -0
  54. package/dist/cdn/M5STJJRX.js +2 -0
  55. package/dist/cdn/{VAJV46OF.js → M7J7RAM4.js} +1 -1
  56. package/dist/cdn/{HIPJAMO4.js → N4ZRMYZL.js} +1 -1
  57. package/dist/cdn/NBCYYUHP.js +2 -0
  58. package/dist/cdn/NHVPNSNH.js +2 -0
  59. package/dist/cdn/{VNVGVYX6.js → NQ2IAQKL.js} +2 -2
  60. package/dist/cdn/NXGTEDK4.js +2 -0
  61. package/dist/cdn/{I3ECBIYX.js → NYOXMT6S.js} +1 -1
  62. package/dist/cdn/O3JP4FQ3.js +2 -0
  63. package/dist/cdn/{MXUHZ474.js → ODSA6NNS.js} +1 -1
  64. package/dist/cdn/{PVPTFK7N.js → OHAQPQAP.js} +1 -1
  65. package/dist/cdn/OOXTSCQT.js +2 -0
  66. package/dist/cdn/OQ2JULON.js +2 -0
  67. package/dist/cdn/{7XBN6ZF4.js → OVH4YLTS.js} +1 -1
  68. package/dist/cdn/{6T4X4RAB.js → QB5BGHLA.js} +1 -1
  69. package/dist/cdn/QKCRNS75.js +2 -0
  70. package/dist/cdn/{6XAFP5OI.js → RKMW4FUN.js} +1 -1
  71. package/dist/cdn/{E26PFYPI.js → RT26JZP5.js} +1 -1
  72. package/dist/cdn/SKHFISBA.js +2 -0
  73. package/dist/cdn/SKIDJ4QI.js +2 -0
  74. package/dist/cdn/{VXDDXPD7.js → SSCKCDXD.js} +1 -1
  75. package/dist/cdn/{YERFI6P2.js → T66G7GIR.js} +1 -1
  76. package/dist/cdn/{MOE6L5RN.js → TIMYD2HM.js} +1 -1
  77. package/dist/cdn/TJWJ3LTU.js +2 -0
  78. package/dist/cdn/{EXEAVQRP.js → TMR4BRFI.js} +1 -1
  79. package/dist/cdn/{ZJWAM6OL.js → TTQGRN2V.js} +1 -1
  80. package/dist/cdn/{YTVLEHJT.js → UHOW7Q65.js} +1 -1
  81. package/dist/cdn/{2XIDYV73.js → US3N5L73.js} +1 -1
  82. package/dist/cdn/W5POIPYP.js +2 -0
  83. package/dist/cdn/{EQTGOMBD.js → WJWWYBZ7.js} +1 -1
  84. package/dist/cdn/WNEPEEPZ.js +2 -0
  85. package/dist/cdn/{NDCMZLMU.js → WPAZDJHU.js} +1 -1
  86. package/dist/cdn/WT72SOAU.js +2 -0
  87. package/dist/cdn/XJGKRAN5.js +2 -0
  88. package/dist/cdn/{MSP6STQ7.js → XS5EOWBK.js} +1 -1
  89. package/dist/cdn/{7PBECSW5.js → YCIFVZ4J.js} +1 -1
  90. package/dist/cdn/{TNRHHR67.js → YDXJHNDI.js} +1 -1
  91. package/dist/cdn/{TRFH3KNJ.js → YIOJIA4Y.js} +1 -1
  92. package/dist/cdn/{I57CRKF7.js → YK6FCXWU.js} +1 -1
  93. package/dist/cdn/{FLUCWAMC.js → YPDHSE2J.js} +1 -1
  94. package/dist/cdn/{ZJCG6JI7.js → YQLFXHFG.js} +1 -1
  95. package/dist/cdn/{QSRWVCWP.js → YSVPB3BO.js} +1 -1
  96. package/dist/cdn/{SHGPWFEC.js → YUOVGTP5.js} +1 -1
  97. package/dist/cdn/{GOUAS2Q5.js → Z5CA4C6H.js} +1 -1
  98. package/dist/cdn/{GDCXUNOL.js → ZD6XJVGV.js} +1 -1
  99. package/dist/cdn/{4B2URSFO.js → ZHQXYCPA.js} +1 -1
  100. package/dist/cdn/{Y6WQZMYW.js → ZOX4RLS4.js} +1 -1
  101. package/dist/cdn/assets/portal-item-card-sublayer-select/t9n/messages.en.json +1 -0
  102. package/dist/cdn/index.js +1 -1
  103. package/dist/cdn/main.css +1 -1
  104. package/dist/chunks/item2.js +29 -25
  105. package/dist/chunks/itemThumbnail.js +21 -21
  106. package/dist/chunks/request.js +51 -43
  107. package/dist/chunks/utils3.js +88 -657
  108. package/dist/chunks/utils4.js +664 -0
  109. package/dist/components/arcgis-portal-account-switcher/customElement.js +1 -1
  110. package/dist/components/arcgis-portal-classification-banner/customElement.js +2 -2
  111. package/dist/components/arcgis-portal-classification-config/customElement.js +1 -1
  112. package/dist/components/arcgis-portal-classification-favorite/customElement.js +1 -1
  113. package/dist/components/arcgis-portal-classification-form-element/customElement.js +1 -1
  114. package/dist/components/arcgis-portal-entity-picker/customElement.d.ts +1 -1
  115. package/dist/components/arcgis-portal-item-card/customElement.d.ts +20 -8
  116. package/dist/components/arcgis-portal-item-card/customElement.js +79 -70
  117. package/dist/components/arcgis-portal-item-card/index.js +1 -0
  118. package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.d.ts +102 -0
  119. package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.js +352 -0
  120. package/dist/components/arcgis-portal-item-card-sublayer-select/index.d.ts +1 -0
  121. package/dist/components/arcgis-portal-item-card-sublayer-select/index.js +8 -0
  122. package/dist/components/arcgis-portal-item-card-sublayer-select/types.d.ts +22 -0
  123. package/dist/components/arcgis-portal-item-thumbnail/customElement.d.ts +1 -0
  124. package/dist/components/arcgis-portal-item-thumbnail/customElement.js +13 -13
  125. package/dist/components/arcgis-portal-item-type/customElement.js +1 -1
  126. package/dist/components/arcgis-portal-navigation/customElement.js +1 -1
  127. package/dist/components/arcgis-portal-navigation/index.js +4 -4
  128. package/dist/components/arcgis-portal-sublayer-type/customElement.js +13 -103
  129. package/dist/docs/api.json +1 -1
  130. package/dist/docs/docs.json +1 -1
  131. package/dist/docs/vscode.html-custom-data.json +1 -1
  132. package/dist/docs/web-types.json +1 -1
  133. package/dist/index.d.ts +10 -0
  134. package/dist/loader.js +2 -1
  135. package/dist/types/item.d.ts +11 -11
  136. package/dist/types/lumina.d.ts +9 -1
  137. package/dist/types/preact.d.ts +10 -1
  138. package/dist/types/react.d.ts +11 -1
  139. package/dist/types/services.d.ts +3 -0
  140. package/dist/types/stencil.d.ts +9 -1
  141. package/package.json +7 -7
  142. package/dist/cdn/225AERRK.js +0 -2
  143. package/dist/cdn/5VAV267L.js +0 -2
  144. package/dist/cdn/67QXUNKX.js +0 -2
  145. package/dist/cdn/6BQUKFTK.js +0 -2
  146. package/dist/cdn/723D3EKN.js +0 -2
  147. package/dist/cdn/AEPP4WJM.js +0 -2
  148. package/dist/cdn/B474WTYE.js +0 -2
  149. package/dist/cdn/C7KQT5QW.js +0 -2
  150. package/dist/cdn/CL5FABMT.js +0 -2
  151. package/dist/cdn/FTT33ZZJ.js +0 -2
  152. package/dist/cdn/FXTPC2Q5.js +0 -2
  153. package/dist/cdn/GJNGP34L.js +0 -2
  154. package/dist/cdn/IAK4F5SX.js +0 -2
  155. package/dist/cdn/JOQEFKCE.js +0 -2
  156. package/dist/cdn/K5Q4ZROX.js +0 -2
  157. package/dist/cdn/K6LF5U7K.js +0 -2
  158. package/dist/cdn/MUW2YNAS.js +0 -2
  159. package/dist/cdn/OQUQ7Z3E.js +0 -2
  160. package/dist/cdn/P74FP43E.js +0 -2
  161. package/dist/cdn/RA75BDVB.js +0 -2
  162. package/dist/cdn/RLI7T32U.js +0 -2
  163. package/dist/cdn/RYPYVJ5U.js +0 -2
  164. package/dist/cdn/TLZO6KZO.js +0 -2
  165. package/dist/cdn/UD4KPMGF.js +0 -2
  166. package/dist/cdn/UL3XBQUT.js +0 -2
  167. package/dist/cdn/VH2IMPMN.js +0 -2
  168. package/dist/cdn/VRGGPMVR.js +0 -2
  169. package/dist/cdn/WQWJVM5B.js +0 -2
  170. package/dist/cdn/XT6IKL7A.js +0 -2
  171. /package/dist/cdn/{OUMTV5H5.js → KHKREBVZ.js} +0 -0
  172. /package/dist/cdn/{XYT4533U.js → U2HTYOBB.js} +0 -0
@@ -0,0 +1,352 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import { c as A } from "../../chunks/runtime.js";
3
+ import { formatNumber as L } from "@arcgis/core/intl.js";
4
+ import { LitElement as x, createEvent as y, nothing as q } from "@arcgis/lumina";
5
+ import { css as N, html as u } from "lit";
6
+ import { createRef as R, ref as G } from "lit/directives/ref.js";
7
+ import { u as U } from "../../chunks/useT9n.js";
8
+ import { j as g } from "../../chunks/item2.js";
9
+ import { b, g as O } from "../../chunks/items.js";
10
+ import { g as P } from "../../chunks/utils3.js";
11
+ import { r as k, i as j, c as B, f as D } from "../../chunks/request.js";
12
+ import { isAbortError as M } from "@arcgis/core/core/promiseUtils.js";
13
+ import { log as J } from "@arcgis/toolkit/log";
14
+ import { g as T, b as F } from "../../chunks/portal.js";
15
+ const z = N`:host,.dropdown{display:block}.title{max-inline-size:32rem;overflow-wrap:anywhere}.dropdown-group{max-block-size:10rem;overflow:auto}calcite-alert{--calcite-z-index-toast: 999;z-index:999}`;
16
+ function p(e, s, t) {
17
+ if (e.id === void 0)
18
+ throw new Error("The service layer has no ID.");
19
+ return {
20
+ description: e.description,
21
+ fieldAliases: e.fields?.map((i) => i.alias ?? ""),
22
+ fields: e.fields,
23
+ geometryType: t ? "table" : e.geometryType,
24
+ id: e.id,
25
+ title: e.name || e.title || "",
26
+ type: e.type,
27
+ matched: s?.find((i) => i.id === e.id)?.matched,
28
+ sourceJSON: e
29
+ };
30
+ }
31
+ async function S(e, s, t, i, r) {
32
+ const a = s.portalMode === "multitenant", l = new URL(T(s)).hostname, o = e.includes(".arcgis.com/"), n = ["//services", "//tiles", "//features", "//locationservices"].some(
33
+ (h) => e.includes(h)
34
+ ), d = s.supportsHostedServices && e.includes(l) && a;
35
+ return await k({
36
+ url: e,
37
+ portal: s,
38
+ method: "post",
39
+ options: {
40
+ useProxy: !1,
41
+ timeout: a ? 5e3 : 6e4,
42
+ addSSL: o && n || !o && d,
43
+ ...t ? {} : { addTokenManually: !1 },
44
+ disableIdentityLookup: !1,
45
+ signal: r
46
+ }
47
+ });
48
+ }
49
+ function $(e) {
50
+ if (typeof e != "object" || e === null)
51
+ return;
52
+ if ("code" in e && typeof e.code == "number")
53
+ return e.code;
54
+ const s = "details" in e ? e.details : void 0, t = typeof s == "object" && s !== null && "raw" in s ? s.raw : void 0;
55
+ return typeof t == "object" && t !== null && "code" in t && typeof t.code == "number" ? t.code : void 0;
56
+ }
57
+ function C(e) {
58
+ return typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : void 0;
59
+ }
60
+ function H(e) {
61
+ return [404, 500].includes($(e) ?? 0) || C(e) === "Invalid URL";
62
+ }
63
+ function _(e, s, t) {
64
+ const i = $(s), r = C(s);
65
+ return !e && (i === 499 && (r === "Token Required" || r === "Token required.") || i === 403 || i === 498 && r === "Invalid Token") && !!t.user;
66
+ }
67
+ function w(e, s, t, i) {
68
+ const r = t?.tables, a = !!t?.layers?.length || !!r, l = [...t?.layers ?? [], ...t?.tables ?? []].map((o) => o.id);
69
+ return (e ?? []).filter(({ id: o, type: n }) => !a || n === "Table" && !r || l.includes(o)).map((o) => p(o, s, i));
70
+ }
71
+ async function K({
72
+ serviceInfo: e,
73
+ item: s,
74
+ portal: t,
75
+ layers: i,
76
+ isSecure: r,
77
+ allowLoginWindow: a,
78
+ data: l,
79
+ signal: o
80
+ }) {
81
+ if (!e.layers?.length && !e.tables?.length && e.fields)
82
+ return { result: { sublayers: [p(e, i)], serviceInfo: e } };
83
+ try {
84
+ const n = await S(
85
+ `${s.url}/layers`,
86
+ t,
87
+ r,
88
+ a,
89
+ o
90
+ );
91
+ return {
92
+ result: {
93
+ sublayers: [
94
+ ...w(n.layers, i, l),
95
+ ...w(n.tables, i, l, !0)
96
+ ].sort((d, c) => d.id - c.id),
97
+ serviceInfo: e
98
+ }
99
+ };
100
+ } catch {
101
+ return { error: { code: "unhandledError" } };
102
+ }
103
+ }
104
+ async function W(e, s, t) {
105
+ try {
106
+ const i = new URL(`${T(s)}content/items/${e.id}/data`);
107
+ i.searchParams.set("f", "json");
108
+ const r = F(s);
109
+ r && i.searchParams.set("token", r);
110
+ const l = await (await fetch(i, { signal: t })).text();
111
+ return l ? JSON.parse(l) : void 0;
112
+ } catch (i) {
113
+ if (t?.aborted || M(i))
114
+ throw i;
115
+ J("warn", "portal.services.layers", "Unable to read optional item data; loading the service directly.", {
116
+ detail: { error: i }
117
+ });
118
+ return;
119
+ }
120
+ }
121
+ async function I({
122
+ item: e,
123
+ portal: s,
124
+ layers: t,
125
+ isSecure: i = !1,
126
+ data: r,
127
+ allowLoginWindow: a,
128
+ retry: l,
129
+ signal: o
130
+ }) {
131
+ try {
132
+ const n = r ?? (l ? void 0 : await W(e, s, o));
133
+ if (n?.error?.code === 403 && n.error.messageCode === "SB_0006")
134
+ return { error: { code: "serviceNotExist" } };
135
+ if (e.type === "Feature Collection" && n?.layers)
136
+ return {
137
+ result: {
138
+ sublayers: n.layers.map(({ layerDefinition: d }, c) => {
139
+ if (!d)
140
+ throw new Error("A feature collection layer has no layer definition.");
141
+ return {
142
+ ...p({ ...d, id: c }),
143
+ description: "",
144
+ matched: !1,
145
+ sourceJSON: void 0
146
+ };
147
+ })
148
+ }
149
+ };
150
+ try {
151
+ if (!e.url)
152
+ throw new Error("Invalid URL");
153
+ const d = await S(e.url, s, i, a, o), c = await K({
154
+ serviceInfo: d,
155
+ item: e,
156
+ portal: s,
157
+ layers: t,
158
+ isSecure: i,
159
+ allowLoginWindow: a,
160
+ data: n,
161
+ signal: o
162
+ });
163
+ return b(e).includes("SubtypeGroupLayer") && c.result && n?.layers?.length && (c.result.sublayers = c.result.sublayers.flatMap((h) => {
164
+ const m = n?.layers?.find(({ id: f }) => f === h.id);
165
+ return m?.layerType === "SubtypeGroupLayer" && m.layers?.length ? [
166
+ h,
167
+ ...m.layers.map((f) => ({
168
+ ...p(f),
169
+ // use the parent layer as the geometry type
170
+ geometryType: h.geometryType
171
+ }))
172
+ ] : [h];
173
+ })), c;
174
+ } catch (d) {
175
+ return !o?.aborted && _(i, d, s) ? await I({ item: e, portal: s, layers: t, data: n, isSecure: !0, allowLoginWindow: a, signal: o }) : { error: { code: H(d) ? "serviceNotExist" : "unhandledError" } };
176
+ }
177
+ } catch {
178
+ return { error: { code: "unhandledError" } };
179
+ }
180
+ }
181
+ const Q = {
182
+ esriGeometryPoint: "point",
183
+ esriGeometryPolyline: "polyline",
184
+ esriGeometryPolygon: "polygon",
185
+ esriGeometryMultipoint: "multipoint"
186
+ };
187
+ function E(e) {
188
+ return {
189
+ id: e.id,
190
+ title: e.title,
191
+ description: e.description ?? "",
192
+ fieldAliases: Array.isArray(e.fieldAliases) ? e.fieldAliases.join(",") : e.fieldAliases ?? "",
193
+ geometryType: !e.geometryType || e.geometryType === "table" ? "nonspatial" : Q[e.geometryType] ?? "nonspatial",
194
+ sourceJSON: e.sourceJSON
195
+ };
196
+ }
197
+ function v(e) {
198
+ let s;
199
+ const t = typeof e == "object" && e !== null && "details" in e ? e.details : void 0, i = typeof t == "object" && t !== null && "raw" in t ? t.raw : void 0;
200
+ for (const r of [e, t, i])
201
+ typeof r != "object" || r === null || "messageCode" in r && typeof r.messageCode == "string" && (s = r.messageCode);
202
+ return { error: { code: s === "OAUTH_0070" ? "notebookAccessBlocked" : "serviceUnavailable" } };
203
+ }
204
+ function V(e) {
205
+ return g(e) || !e.id ? void 0 : j("serviceInfo", e.id)?.result?.sublayers.map(E);
206
+ }
207
+ function X(e) {
208
+ e.id && B("serviceInfo", e.id);
209
+ }
210
+ async function Y({
211
+ item: e,
212
+ portal: s,
213
+ signal: t
214
+ }) {
215
+ try {
216
+ if (t.throwIfAborted(), g(e)) {
217
+ if (!e.url)
218
+ throw new Error("The geoprocessing item has no service URL.");
219
+ const r = await k({
220
+ url: e.url,
221
+ portal: s,
222
+ options: { signal: t, addTokenManually: !1 }
223
+ }), a = r.tasks ?? (r.parameters ? [e.url.split("/GPServer/").pop() ?? ""] : void 0);
224
+ if (!a)
225
+ throw new Error("The geoprocessing service did not return tasks.");
226
+ return { result: { tasks: a } };
227
+ }
228
+ if (!e.id)
229
+ throw new Error("The item has no ID.");
230
+ const i = await D({
231
+ requester: async () => await I({ item: e, portal: s, isSecure: !1, allowLoginWindow: !0 }),
232
+ key: "serviceInfo",
233
+ id: e.id
234
+ });
235
+ return t.throwIfAborted(), i.result ? { result: { sublayers: i.result.sublayers.map(E) } } : v(i.error);
236
+ } catch (i) {
237
+ return v(i);
238
+ }
239
+ }
240
+ class Z extends x {
241
+ constructor() {
242
+ super(...arguments), this.messages = U({ blocking: !0 }), this.dropdown = R(), this.selectedEntries = [], this.loading = !1, this.fetched = !1, this.selectedItems = [], this.allowedGeometries = [], this.width = "auto", this.appearance = "outline", this.selection = "single", this.disabled = !1, this.arcgisItemCardSelect = y(), this.arcgisItemCardSelectError = y();
243
+ }
244
+ static {
245
+ this.properties = { sublayers: 16, tasks: 16, loading: 16, fetched: 16, error: 16, item: 0, portal: 0, selectedItems: 0, allowedGeometries: 0, width: 1, appearance: 1, selection: 1, disabled: 7, messageOverrides: 0 };
246
+ }
247
+ static {
248
+ this.styles = z;
249
+ }
250
+ get isTask() {
251
+ return g(this.item);
252
+ }
253
+ get sortedSublayers() {
254
+ return [...this.sublayers ?? []].sort((s, t) => Number(this.isAllowed(t)) - Number(this.isAllowed(s)) || t.id - s.id);
255
+ }
256
+ get selectText() {
257
+ const s = this.selectedEntries, { messages: t } = this;
258
+ if (this.isTask) {
259
+ const r = s[0];
260
+ return s.length === 1 && r && "task" in r ? t.selectedTask.replace("${task}", r.task) : t.selectTask;
261
+ }
262
+ if (!s.length && !this.sublayers?.length)
263
+ return this.isSelected() ? t.selectedSingle : t.select;
264
+ if (!s.length)
265
+ return this.selection === "multiple" ? t.selectLayers : t.select;
266
+ if (this.selection === "multiple")
267
+ return t.selectedLayers.replace("${num}", L(s.length));
268
+ const i = s[0];
269
+ return i && "sublayer" in i ? t.selectedName.replace("${name}", i.sublayer.title) : t.select;
270
+ }
271
+ willUpdate(s) {
272
+ if (s.has("disabled") && this.disabled && (this.requestController?.abort(), this.loading = !1, this.dropdown.value && (this.dropdown.value.open = !1)), (s.has("item") || s.has("selectedItems")) && (this.selectedEntries = this.selectedItems.filter((t) => "item" in t && t.item.id === this.item?.id)), (s.has("item") || s.has("portal")) && (this.requestController?.abort(), this.sublayers = this.item ? O(this.item).sublayers : void 0, this.tasks = void 0, this.loading = !1, this.fetched = !1, this.error = void 0, this.item && !this.sublayers)) {
273
+ const t = V(this.item);
274
+ t && (this.sublayers = t, this.fetched = !0);
275
+ }
276
+ }
277
+ disconnectedCallback() {
278
+ super.disconnectedCallback(), this.requestController?.abort(), this.loading = !1;
279
+ }
280
+ isSelected(s, t) {
281
+ return this.selectedItems.some((i) => "item" in i ? i.item.id === this.item.id && (s ? "sublayer" in i && i.sublayer.id === s.id : t !== void 0 && "task" in i && i.task === t) : !s && t === void 0 && i.id === this.item.id);
282
+ }
283
+ isAllowed(s) {
284
+ return !this.allowedGeometries.length || this.allowedGeometries.includes(s.geometryType);
285
+ }
286
+ select(s, t, i = this.selection === "single" || !this.isSelected(s, t)) {
287
+ this.disabled || (this.arcgisItemCardSelect.emit({
288
+ item: this.item,
289
+ ...s ? { sublayer: s } : {},
290
+ ...t !== void 0 ? { task: t } : {},
291
+ selected: i
292
+ }), this.requestUpdate(), this.reconcileSelection());
293
+ }
294
+ async reconcileSelection() {
295
+ await this.updateComplete;
296
+ const s = this.sortedSublayers;
297
+ this.dropdown.value?.querySelectorAll("calcite-dropdown-item").forEach((t, i) => {
298
+ t.selected = this.isTask ? this.isSelected(void 0, this.tasks?.[i]) : this.isSelected(s[i]);
299
+ });
300
+ }
301
+ async handleTrigger(s = !1) {
302
+ if (this.loading || this.disabled)
303
+ return;
304
+ this.requestController?.abort();
305
+ const t = new AbortController();
306
+ this.requestController = t;
307
+ const { item: i, portal: r } = this, a = () => !t.signal.aborted && this.item === i && this.portal === r && this.el.isConnected, l = s || !this.fetched && (this.isTask || !this.sublayers && this.item.type !== "Image Service" || b(this.item).includes("SubtypeGroupLayer"));
308
+ if (l) {
309
+ s && (X(i), this.fetched = !1), this.loading = !0, this.error = void 0;
310
+ const n = await Y({ item: i, portal: r, signal: t.signal });
311
+ if (!a())
312
+ return;
313
+ if (this.loading = !1, n.error || !n.result) {
314
+ this.error = n.error ?? { code: "serviceUnavailable" }, this.arcgisItemCardSelectError.emit({ item: i, error: this.error });
315
+ return;
316
+ }
317
+ if (this.sublayers = n.result.sublayers, this.tasks = n.result.tasks, this.fetched = !0, await this.updateComplete, !a())
318
+ return;
319
+ }
320
+ if (l && this.isTask && this.tasks?.length === 1) {
321
+ this.dropdown.value && (this.dropdown.value.open = !1), this.select(void 0, this.tasks[0], !0);
322
+ return;
323
+ }
324
+ if (!this.isTask && !this.sublayers?.length) {
325
+ s || this.select(void 0, void 0, !this.isSelected());
326
+ return;
327
+ }
328
+ const o = this.dropdown.value;
329
+ o && (await o.componentOnReady(), a() && (o.open = l || !o.open));
330
+ }
331
+ renderButton(s) {
332
+ return u`<calcite-button slot=${(s ? "trigger" : void 0) ?? q} class="dropdown" .loading=${this.loading} .disabled=${this.loading || this.disabled} .appearance=${this.selectedEntries.length || this.isSelected() ? "solid" : this.appearance} kind=neutral .iconEnd=${s ? "chevron-down" : void 0} .width=${this.width} @click=${(t) => {
333
+ t.stopPropagation(), this.handleTrigger();
334
+ }}>${this.selectText}</calcite-button>`;
335
+ }
336
+ render() {
337
+ if (!this.item || !this.portal || !this.messages._lang)
338
+ return null;
339
+ const s = this.sortedSublayers;
340
+ return u`${s.length || this.isTask ? u`<calcite-dropdown class="dropdown" width=l .placement=${this.appearance === "solid" ? "top" : "bottom-end"} .closeOnSelectDisabled=${!this.isTask && this.selection === "multiple"} overlay-positioning=fixed ${G(this.dropdown)}>${this.renderButton(!0)}<calcite-dropdown-group class="dropdown-group" .selectionMode=${this.selection} .groupTitle=${this.isTask && this.tasks?.length ? this.messages.selectTaskFrom.replace("${title}", this.item.title ?? "") : void 0}>${this.isTask ? this.tasks?.map((t) => u`<calcite-dropdown-item .disabled=${this.disabled} .selected=${this.isSelected(void 0, t)} @calciteDropdownItemSelect=${() => this.select(void 0, t)}><span class="title">${t}</span></calcite-dropdown-item>`) : s.map((t) => u`<calcite-dropdown-item .id=${`sublayer-${t.id}`} .iconStart=${P({ geometry: t.geometryType }).icon} .disabled=${this.disabled || !this.isAllowed(t)} .selected=${this.isSelected(t)} @calciteDropdownItemSelect=${() => {
341
+ this.isAllowed(t) && this.select(t);
342
+ }}><span class="title">${t.title}</span></calcite-dropdown-item>${!this.isAllowed(t) && u`<calcite-tooltip .referenceElement=${`sublayer-${t.id}`} overlay-positioning=fixed>${this.messages.geometryNotAllowed}</calcite-tooltip>` || ""}`)}</calcite-dropdown-group></calcite-dropdown>` : this.renderButton(!1)}<calcite-alert .label=${this.messages.errorTitle} icon kind=danger .open=${!!this.error} @calciteAlertClose=${() => {
343
+ this.error = void 0;
344
+ }}><div slot=title>${this.messages.errorTitle}</div><div slot=message>${this.error?.code === "notebookAccessBlocked" ? this.messages.notebookErrorBody : this.messages.errorBody}</div><calcite-link slot=link @click=${(t) => {
345
+ t.stopPropagation(), this.handleTrigger(!0);
346
+ }}>${this.messages.retry}</calcite-link></calcite-alert>`;
347
+ }
348
+ }
349
+ A("arcgis-portal-item-card-sublayer-select", Z);
350
+ export {
351
+ Z as ArcgisPortalItemCardSublayerSelect
352
+ };
@@ -0,0 +1 @@
1
+ export * from "./customElement.js";
@@ -0,0 +1,8 @@
1
+ import "@esri/calcite-components/components/calcite-button";
2
+ import "@esri/calcite-components/components/calcite-dropdown";
3
+ import "@esri/calcite-components/components/calcite-dropdown-group";
4
+ import "@esri/calcite-components/components/calcite-dropdown-item";
5
+ import "@esri/calcite-components/components/calcite-tooltip";
6
+ import "@esri/calcite-components/components/calcite-alert";
7
+ import "@esri/calcite-components/components/calcite-link";
8
+ export * from "./customElement.js";
@@ -0,0 +1,22 @@
1
+ import type PortalItem from "@arcgis/core/portal/PortalItem.js";
2
+ import type { SearchResultSublayer } from "../../types/item.js";
3
+
4
+ export type PortalItemCardSelectedItem = PortalItem | {
5
+ item: PortalItem;
6
+ sublayer: SearchResultSublayer;
7
+ } | {
8
+ item: PortalItem;
9
+ task: string;
10
+ };
11
+
12
+ export interface PortalItemCardSublayerSelectDetail {
13
+ item: PortalItem;
14
+ sublayer?: SearchResultSublayer;
15
+ task?: string;
16
+ selected: boolean;
17
+ }
18
+
19
+ export interface PortalItemCardSelectErrorDetail {
20
+ item: PortalItem;
21
+ error: unknown;
22
+ }
@@ -24,6 +24,7 @@ export abstract class ArcgisPortalItemThumbnail extends LitElement {
24
24
  /**
25
25
  * Set to true to force loading thumbnails from the production ArcGIS Online endpoint.
26
26
  * This is only useful in Enterprise when viewing ArcGIS Online content.
27
+ * The current portal's token is not included in production thumbnail URLs.
27
28
  *
28
29
  * @default false
29
30
  */
@@ -4,13 +4,13 @@ import { LitElement as E, createEvent as F, safeClassMap as v, nothing as D } fr
4
4
  import { css as V, html as w } from "lit";
5
5
  import { i as O } from "../../chunks/functionalities.js";
6
6
  import { a as g, b as S, g as R } from "../../chunks/itemThumbnail.js";
7
- import { j as x, u as U } from "../../chunks/item2.js";
7
+ import { k as x, u as k } from "../../chunks/item2.js";
8
8
  import { b as A } from "../../chunks/portal.js";
9
9
  import { execute as B } from "@arcgis/core/rest/geoprocessor.js";
10
10
  function G(e) {
11
11
  return e ? `${e.xmin},${e.ymin},${e.xmax},${e.ymax}` : "";
12
12
  }
13
- function $(e) {
13
+ function U(e) {
14
14
  return e && e.xmin >= -180 && e.xmax <= 180 && e.ymin >= -90 && e.ymax <= 90 && e.xmin <= e.xmax && e.ymin <= e.ymax ? [
15
15
  [e.xmin, e.ymin],
16
16
  [e.xmax, e.ymax]
@@ -129,7 +129,7 @@ async function _(e, t) {
129
129
  i?.destroy(), r?.destroy();
130
130
  }
131
131
  }
132
- async function k({
132
+ async function $({
133
133
  webMap: e,
134
134
  extent: t,
135
135
  portal: r,
@@ -182,14 +182,14 @@ async function C({
182
182
  }
183
183
  ]
184
184
  };
185
- return await k({
185
+ return await $({
186
186
  webMap: c,
187
- extent: $(e.extent),
187
+ extent: U(e.extent),
188
188
  portal: t,
189
189
  spatialReference: { wkid: 4326 }
190
190
  });
191
191
  }
192
- async function j({
192
+ async function W({
193
193
  item: e,
194
194
  portal: t
195
195
  }) {
@@ -216,14 +216,14 @@ async function j({
216
216
  authoringAppVersion: "5.3",
217
217
  version: "2.10"
218
218
  };
219
- return await k({
219
+ return await $({
220
220
  webMap: i,
221
- extent: $(e.extent),
221
+ extent: U(e.extent),
222
222
  portal: t,
223
223
  spatialReference: { wkid: 102100 }
224
224
  });
225
225
  }
226
- async function W({
226
+ async function j({
227
227
  item: e,
228
228
  portal: t,
229
229
  serviceInfo: r
@@ -231,7 +231,7 @@ async function W({
231
231
  const i = g(e), n = e.type ?? "";
232
232
  let a;
233
233
  try {
234
- O(["Image Service", "Map Service", "Feature Service"], n) && (a = await K({ item: e, portal: t, serviceInfo: r }) || i), n === "Vector Tile Service" && (a = await j({ item: e, portal: t }) || i), n === "KML" && (a = await C({ item: e, portal: t }) || i);
234
+ O(["Image Service", "Map Service", "Feature Service"], n) && (a = await K({ item: e, portal: t, serviceInfo: r }) || i), n === "Vector Tile Service" && (a = await W({ item: e, portal: t }) || i), n === "KML" && (a = await C({ item: e, portal: t }) || i);
235
235
  } catch {
236
236
  return { error: { code: "unhandledError" } };
237
237
  }
@@ -244,14 +244,14 @@ function z(e, t) {
244
244
  return !e.includes("images/transparent.gif") && (t?.isPortal ? !i : !r);
245
245
  }
246
246
  function q(e, t) {
247
- const r = !!t && U(e, t), i = e.type === "Dashboard";
247
+ const r = !!t && k(e, t), i = e.type === "Dashboard";
248
248
  return !S(e) && r && i;
249
249
  }
250
250
  function J(e, t, r) {
251
251
  const i = S(e), n = z(i, t), a = ["Feature Service", "Vector Tile Service"].includes(e.type) && !n, l = e.type === "Feature Service" && e.typeKeywords?.includes("Location Tracking Service"), c = e.typeKeywords?.includes("Table");
252
252
  if (e.type === "Image" || i && !a || l || c)
253
253
  return !1;
254
- const s = e.typeKeywords?.includes("Tiled Imagery"), p = e.type === "Image Service" && !s || e.type === "Map Service", m = !!r && U(e, r);
254
+ const s = e.typeKeywords?.includes("Tiled Imagery"), p = e.type === "Image Service" && !s || e.type === "Map Service", m = !!r && k(e, r);
255
255
  return m && p || m && e.type === "Feature Service" || e.type === "Vector Tile Service" || m && e.type === "KML";
256
256
  }
257
257
  const H = V`:host{display:block;height:100%;position:relative;width:100%}.outer{position:relative;width:100%;height:100%;aspect-ratio:3 / 2;min-height:0}.inner{position:absolute;inset:0;background-color:var(--calcite-color-background)}.inner--loading{animation:thumbnail-shimmer 1s linear infinite;background-image:linear-gradient(to right,var(--calcite-color-background) 0%,var(--calcite-color-foreground-2),var(--calcite-color-background) 40%,var(--calcite-color-background) 100%);background-repeat:no-repeat;background-size:800px 100%}.thumbnail{display:block;width:100%;height:100%;object-fit:cover;opacity:1;transition:opacity .3s linear}.thumbnail--loading{opacity:0}.fallback{display:flex;height:100%;width:100%;align-items:center;justify-content:center;background-color:var(--calcite-color-foreground-2);color:var(--calcite-color-text-3)}@keyframes thumbnail-shimmer{0%{background-position:-468px 0}to{background-position:468px 0}}`;
@@ -271,7 +271,7 @@ class Y extends E {
271
271
  return this.thumbnailUri ?? "";
272
272
  try {
273
273
  this.generating = !0;
274
- const n = t ? g(r) : await W({
274
+ const n = t ? g(r) : await j({
275
275
  item: r,
276
276
  portal: i,
277
277
  serviceInfo: this.serviceInfo
@@ -3,7 +3,7 @@ import { g as d, c as g } from "../../chunks/runtime.js";
3
3
  import { css as y, html as c } from "lit";
4
4
  import { LitElement as f, nothing as p, safeClassMap as x } from "@arcgis/lumina";
5
5
  import { u } from "../../chunks/useT9n.js";
6
- import { g as w } from "../../chunks/utils3.js";
6
+ import { g as w } from "../../chunks/utils4.js";
7
7
  const v = y`:host{display:inline-flex;align-items:center}:host([scale="s"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size--2);--arcgis-portal-item-type-spacing: 1rem}:host([scale="m"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size--1);--arcgis-portal-item-type-spacing: 1rem}:host([scale="l"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size-0);--arcgis-portal-item-type-spacing: 1rem}.icon{display:block;flex-grow:0;flex-shrink:0;width:var(--arcgis-portal-item-type-spacing);height:var(--arcgis-portal-item-type-spacing)}.text{color:var(--calcite-text-color-2);font-size:var(--arcgis-portal-item-type-font-size);line-height:1.25rem}.text--ellipsis{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.text--spaced{margin-inline-start:calc(var(--arcgis-portal-item-type-spacing) / 2);word-wrap:break-word;word-break:break-word}`;
8
8
  class I extends f {
9
9
  constructor() {
@@ -11,7 +11,7 @@ import { m as Nt } from "../../chunks/icons.js";
11
11
  import { i as T, c as ge, a as Tt } from "../../chunks/user2.js";
12
12
  import { b as Ct, c as Mt, d as Ot, e as Lt, f as Et } from "../../chunks/portal2.js";
13
13
  import { c as jt, d as Dt, e as zt } from "../../chunks/user.js";
14
- import { i as Ne, a as Gt } from "../../chunks/utils3.js";
14
+ import { i as Ne, a as Gt } from "../../chunks/utils4.js";
15
15
  import { e as Ut, g as Te } from "../../chunks/item.js";
16
16
  import { g as Bt } from "../../chunks/request.js";
17
17
  import { keyed as le } from "lit/directives/keyed.js";
@@ -2,14 +2,14 @@ import "@esri/calcite-components/components/calcite-chip";
2
2
  import "@esri/calcite-components/components/calcite-tooltip";
3
3
  import "@esri/calcite-components/components/calcite-list-item";
4
4
  import "@esri/calcite-components/components/calcite-action";
5
- import "../arcgis-portal-item-type/index.js";
6
- import "@esri/calcite-components/components/calcite-button";
7
- import "@esri/calcite-components/components/calcite-list";
8
- import "@esri/calcite-components/components/calcite-input";
9
5
  import "@esri/calcite-components/components/calcite-icon";
10
6
  import "@esri/calcite-components/components/calcite-popover";
7
+ import "@esri/calcite-components/components/calcite-list";
8
+ import "../arcgis-portal-item-type/index.js";
11
9
  import "@esri/calcite-components/components/calcite-loader";
10
+ import "@esri/calcite-components/components/calcite-button";
12
11
  import "@esri/calcite-components/components/calcite-dropdown-item";
12
+ import "@esri/calcite-components/components/calcite-input";
13
13
  import "@esri/calcite-components/components/calcite-dropdown";
14
14
  import "../arcgis-portal-user-avatar/index.js";
15
15
  import "@esri/calcite-components/components/calcite-dropdown-group";