@arcgis/portal-components 6.0.0-next.44 → 6.0.0-next.45
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/cdn/2H4XUTGC.js +2 -0
- package/dist/cdn/2SXAFTBV.js +2 -0
- package/dist/cdn/43PDHAIF.js +76 -0
- package/dist/cdn/44XWSV22.js +2 -0
- package/dist/cdn/5ASHV75J.js +2 -0
- package/dist/cdn/A3C27QXY.js +2 -0
- package/dist/cdn/CNTCDLAV.js +2 -0
- package/dist/cdn/CZE75G6W.js +2 -0
- package/dist/cdn/DLPVBMPX.js +2 -0
- package/dist/cdn/KIII5IQV.js +2 -0
- package/dist/cdn/NPLIEXAH.js +2 -0
- package/dist/cdn/QZPNR6GF.js +2 -0
- package/dist/cdn/RSKKZ7MS.js +2 -0
- package/dist/cdn/SHUSYAET.js +2 -0
- package/dist/cdn/{K3Z2K3M4.js → SW5C6THN.js} +12 -12
- package/dist/cdn/VPVDVHQA.js +2 -0
- package/dist/cdn/YXTLFAFP.js +2 -0
- package/dist/cdn/assets/portal-item-card/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/portal-review-layer-sharing-check-notice/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/fieldAddDelete.js +1 -1
- package/dist/chunks/item.js +10 -10
- package/dist/chunks/portal-review-layer-sharing.js +595 -0
- package/dist/chunks/privileges.js +26 -0
- package/dist/chunks/utils4.js +39 -58
- package/dist/components/arcgis-portal-account-switcher/customElement.d.ts +38 -6
- package/dist/components/arcgis-portal-account-switcher-accounts/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-account-switcher-list/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-account-switcher-signout/customElement.d.ts +38 -6
- package/dist/components/arcgis-portal-add-gps-metadata/customElement.d.ts +38 -6
- package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +36 -7
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +337 -324
- package/dist/components/arcgis-portal-ai-assistant/index.js +1 -0
- package/dist/components/arcgis-portal-ai-assistant-diagnostics/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-browser/customElement.d.ts +54 -8
- package/dist/components/arcgis-portal-browser-actions/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-browser-filter-status/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-browser-pagination/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-browser-search/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-browser-sort/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-browser-top-bar/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-browser-view/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-classification-banner/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-classification-config/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-classification-favorite/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-classification-form-element/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-delete-items/customElement.d.ts +38 -6
- package/dist/components/arcgis-portal-delete-items-review/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-entity-picker/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-extent-picker/customElement.d.ts +38 -6
- package/dist/components/arcgis-portal-field-delete/customElement.d.ts +42 -7
- package/dist/components/arcgis-portal-group-badges/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-group-browser/customElement.d.ts +62 -12
- package/dist/components/arcgis-portal-group-browser-card/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-group-browser-preview/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-group-browser-preview-card/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-group-card/customElement.d.ts +38 -6
- package/dist/components/arcgis-portal-group-picker/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-group-thumbnail/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-info-banner/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-item-actions/customElement.d.ts +44 -7
- package/dist/components/arcgis-portal-item-actions/customElement.js +44 -44
- package/dist/components/arcgis-portal-item-badge/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-item-badges/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-item-card/customElement.d.ts +57 -9
- package/dist/components/arcgis-portal-item-card/customElement.js +80 -68
- package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.js +1 -1
- package/dist/components/arcgis-portal-item-favorite/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-item-picker/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-item-preview/customElement.d.ts +38 -6
- package/dist/components/arcgis-portal-item-preview-copy/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-item-preview-field/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-item-preview-sublayer/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-item-share-summary/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-item-share-summary-editable/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-item-status-card/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-item-thumbnail/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-item-thumbnail/customElement.js +9 -9
- package/dist/components/arcgis-portal-item-type/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-mentionable-text-area/customElement.d.ts +46 -8
- package/dist/components/arcgis-portal-navigation/customElement.d.ts +42 -7
- package/dist/components/arcgis-portal-navigation/customElement.js +12 -11
- package/dist/components/arcgis-portal-preview-panel/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-replacement-item-redirect/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-review-layer-sharing/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-review-layer-sharing/customElement.js +17 -588
- package/dist/components/arcgis-portal-review-layer-sharing-check-notice/customElement.d.ts +79 -0
- package/dist/components/arcgis-portal-review-layer-sharing-check-notice/customElement.js +57 -0
- package/dist/components/arcgis-portal-review-layer-sharing-check-notice/index.d.ts +1 -0
- package/dist/components/arcgis-portal-review-layer-sharing-check-notice/index.js +5 -0
- package/dist/components/arcgis-portal-review-related-items/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-sublayer-type/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-user-avatar/customElement.d.ts +17 -1
- package/dist/components/arcgis-portal-user-picker/customElement.d.ts +30 -4
- package/dist/components/arcgis-portal-user-popup/customElement.d.ts +34 -5
- package/dist/components/arcgis-portal-voice-input/customElement.d.ts +46 -8
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +50 -235
- package/dist/loader.d.ts +65 -2
- package/dist/loader.js +1 -0
- package/dist/types/lumina.d.ts +192 -358
- package/dist/types/portalAssistantCurrentContext.d.ts +11 -9
- package/dist/types/preact.d.ts +192 -424
- package/dist/types/react.d.ts +192 -493
- package/dist/types/stencil.d.ts +133 -299
- package/package.json +9 -9
- package/dist/cdn/36DGXQLJ.js +0 -2
- package/dist/cdn/3ZVDEJPF.js +0 -2
- package/dist/cdn/42AN66SK.js +0 -2
- package/dist/cdn/7JDXAVUG.js +0 -2
- package/dist/cdn/CERDMRFQ.js +0 -2
- package/dist/cdn/FINVGL3V.js +0 -2
- package/dist/cdn/GA4OWLSO.js +0 -2
- package/dist/cdn/GHDMQJG4.js +0 -2
- package/dist/cdn/JDW7ECBF.js +0 -2
- package/dist/cdn/PM33STYQ.js +0 -2
- package/dist/cdn/TQX5BOZG.js +0 -2
- package/dist/cdn/YZZQ3Y6G.js +0 -73
- package/dist/cdn/ZOOEWYFB.js +0 -2
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import { c as A } from "./runtime.js";
|
|
3
|
+
import { repeat as F } from "lit/directives/repeat.js";
|
|
4
|
+
import O from "@arcgis/core/portal/PortalItem.js";
|
|
5
|
+
import { LitElement as _, createEvent as E, safeClassMap as N } from "@arcgis/lumina";
|
|
6
|
+
import { css as W, html as g } from "lit";
|
|
7
|
+
import { createRef as H, ref as j } from "lit/directives/ref.js";
|
|
8
|
+
import { Task as J } from "@lit/task";
|
|
9
|
+
import { log as $ } from "@arcgis/toolkit/log";
|
|
10
|
+
import { u as k } from "./useT9n.js";
|
|
11
|
+
import { i as V, a as z, b as w } from "./item2.js";
|
|
12
|
+
import { g as Q } from "./help.js";
|
|
13
|
+
import { d as X, a as Y, g as Z } from "./portal.js";
|
|
14
|
+
import { g as L } from "./portal-item-status-card.js";
|
|
15
|
+
import "../components/arcgis-portal-item-preview/customElement.js";
|
|
16
|
+
import "../components/arcgis-portal-preview-panel/customElement.js";
|
|
17
|
+
import { c as ee } from "./previewSessionController.js";
|
|
18
|
+
import { r as y, f as te, c as re } from "./request.js";
|
|
19
|
+
import { s as se } from "./item.js";
|
|
20
|
+
import { i as b } from "./functionalities.js";
|
|
21
|
+
import { d as ie } from "./groups.js";
|
|
22
|
+
import { substitute as P } from "@arcgis/core/intl.js";
|
|
23
|
+
const ae = W`:host{display:block}calcite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-content-top-space: 0;--calcite-dialog-content-bottom-space: 0;--calcite-dialog-size-x: 1080px;--calcite-dialog-size-y: min(922px, 75vh)}.header{font:var(--calcite-font-weight-medium) var(--calcite-font-size-0) / 1.25rem var(--calcite-sans-family);color:var(--calcite-color-text-1);margin-block-end:.5rem}.status{font:var(--calcite-font-weight-normal) var(--calcite-font-size--1) / 1.125rem var(--calcite-sans-family);color:var(--calcite-color-text-2)}.status--error{color:var(--calcite-color-status-danger)}.content{display:grid;gap:.75rem;flex:1;min-block-size:0;position:relative}.scrim--overlay{z-index:1}.content>.status{padding:.75rem}.top-bar{color:var(--calcite-color-text-2);font:var(--calcite-font-weight-normal) var(--calcite-font-size--1) / 1.25rem var(--calcite-sans-family);margin-block-end:.25rem;padding-block-end:.75rem;border-block-end:1px solid var(--calcite-color-border-3)}.result-list,.result-sections{display:grid;gap:1rem}.results{display:grid;grid-template-columns:minmax(0,1fr);min-inline-size:0;min-block-size:0}.content--preview .results{grid-template-columns:300px minmax(0,1fr)}.review-content{box-sizing:border-box;min-inline-size:0;min-block-size:0;padding:.75rem}.content--preview .review-content{overflow:auto}.preview{min-inline-size:0;min-block-size:0}.preview arcgis-portal-preview-panel{--arcgis-portal-preview-panel-width: 100%;position:relative;display:block;block-size:100%}.preview arcgis-portal-item-preview{--calcite-panel-header-content-space: initial}@media(max-width:51rem){.content--preview .results{grid-template-columns:minmax(0,1fr);gap:.75rem;block-size:auto}.preview{inline-size:100%;block-size:min(34rem,50vh)}}.result-section{display:grid;gap:1rem;padding-block-start:.75rem}.result-section__title{color:var(--calcite-color-text-1);font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium)}`;
|
|
24
|
+
async function ne({
|
|
25
|
+
itemId: r,
|
|
26
|
+
portal: e,
|
|
27
|
+
relationship: t,
|
|
28
|
+
includeRecycleBin: s,
|
|
29
|
+
num: a,
|
|
30
|
+
nextkey: i
|
|
31
|
+
}) {
|
|
32
|
+
const { relationshipRules: l, direction: o } = t, d = `${e.restUrl}/content/items/${r}/relatedItems`, u = {
|
|
33
|
+
f: "json",
|
|
34
|
+
includeRecycleBin: s,
|
|
35
|
+
includeSystemManaged: "true",
|
|
36
|
+
excludedFlags: "legacy,exclude",
|
|
37
|
+
num: a,
|
|
38
|
+
direction: o,
|
|
39
|
+
...l?.length ? { relationshipRules: l.join(",") } : {},
|
|
40
|
+
...i != null ? { nextkey: i } : {}
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
return {
|
|
44
|
+
result: await y({
|
|
45
|
+
url: d,
|
|
46
|
+
portal: e,
|
|
47
|
+
params: u
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
} catch (n) {
|
|
51
|
+
return console.error(n), { error: { code: "unhandledError" } };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function oe(r) {
|
|
55
|
+
const e = [];
|
|
56
|
+
let t = 0, s;
|
|
57
|
+
do {
|
|
58
|
+
const a = await r(s);
|
|
59
|
+
if (a.error || !a.result)
|
|
60
|
+
return { error: { code: "unhandledError" } };
|
|
61
|
+
e.push(...a.result.relatedItems), t = a.result.aggregations?.total?.count ?? t, s = a.result.nextKey;
|
|
62
|
+
} while (s != null);
|
|
63
|
+
return {
|
|
64
|
+
result: {
|
|
65
|
+
relatedItems: e,
|
|
66
|
+
countOfAccessibleItem: e.length,
|
|
67
|
+
totalCountOfRelatedItems: t
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async function le({
|
|
72
|
+
itemId: r,
|
|
73
|
+
portal: e,
|
|
74
|
+
relationship: t,
|
|
75
|
+
includeRecycleBin: s,
|
|
76
|
+
num: a
|
|
77
|
+
}) {
|
|
78
|
+
return await oe(
|
|
79
|
+
async (i) => await ne({
|
|
80
|
+
itemId: r,
|
|
81
|
+
portal: e,
|
|
82
|
+
relationship: t,
|
|
83
|
+
includeRecycleBin: s,
|
|
84
|
+
num: a,
|
|
85
|
+
...i != null ? { nextkey: i } : {}
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
const T = {
|
|
90
|
+
needsGroupUpdate: !1,
|
|
91
|
+
needsShareLevelUpdate: !1,
|
|
92
|
+
canEditShareLevel: !0,
|
|
93
|
+
premium: !1
|
|
94
|
+
}, U = {
|
|
95
|
+
private: 0,
|
|
96
|
+
shared: 1,
|
|
97
|
+
org: 2,
|
|
98
|
+
public: 3
|
|
99
|
+
}, ce = [
|
|
100
|
+
"Location Tracking Service",
|
|
101
|
+
"Location Tracking View",
|
|
102
|
+
"IoTFeed",
|
|
103
|
+
"IoTFeatureLayer",
|
|
104
|
+
"IoTMapImageLayer",
|
|
105
|
+
"IoTStreamLayer",
|
|
106
|
+
"Administrative Report",
|
|
107
|
+
"EditExtensionIndoorsSpaces",
|
|
108
|
+
"ArcgisWorkflowJobLocation",
|
|
109
|
+
"Integration Info",
|
|
110
|
+
"Analysis Model Web Tool"
|
|
111
|
+
], de = ["Data Store", "Knowledge Graph", "Pro Project", "Workflow"], ue = [
|
|
112
|
+
"Vector Tile Service",
|
|
113
|
+
"Map Service",
|
|
114
|
+
"Scene Service",
|
|
115
|
+
"Feature Service"
|
|
116
|
+
];
|
|
117
|
+
function pe(r, e) {
|
|
118
|
+
const t = ce.some((o) => r.typeKeywords?.includes(o)), s = r.type === "Image Service" && r.url?.includes("://iservices") && r.url.includes("arcgis.com"), a = r.type === "Geoprocessing Service" && r.typeKeywords?.includes("Notebook Web Tool"), i = b(de, r.type), l = r.type === "Parquet Feature Layer" && e.isPortal;
|
|
119
|
+
return t || s || a || i || l;
|
|
120
|
+
}
|
|
121
|
+
function he(r) {
|
|
122
|
+
return r.typeKeywords?.includes("Hosted Service") && b(ue, r.type);
|
|
123
|
+
}
|
|
124
|
+
const me = ["Trial Developer", "Developer", "Developer Subscription"], ge = [
|
|
125
|
+
"needEditableLayers",
|
|
126
|
+
"needsShareLevelUpdateLayers"
|
|
127
|
+
], fe = [
|
|
128
|
+
"needPubliclyEditableLayers",
|
|
129
|
+
"needDataCollectionLayers",
|
|
130
|
+
"premiumLayers",
|
|
131
|
+
"notEditableLayers",
|
|
132
|
+
"needAuthentication"
|
|
133
|
+
];
|
|
134
|
+
async function ve({
|
|
135
|
+
sharingDetailResult: r,
|
|
136
|
+
mainAccess: e,
|
|
137
|
+
developerPortal: t,
|
|
138
|
+
portal: s
|
|
139
|
+
}) {
|
|
140
|
+
const { sourceItem: a, detail: i } = r, { canEditShareLevel: l, needsGroupUpdate: o, needsShareLevelUpdate: d, premium: u } = i;
|
|
141
|
+
return !o && !d && !u ? null : !l && !u ? "notEditableLayers" : e === "public" ? u ? "premiumLayers" : a.access !== "public" && t && he(a) ? "notEditableLayers" : a.access !== "public" && await V(a, s) ? a.typeKeywords.includes("Public Data Collection") ? "needEditableLayers" : "needDataCollectionLayers" : "needsShareLevelUpdateLayers" : u ? null : "needsShareLevelUpdateLayers";
|
|
142
|
+
}
|
|
143
|
+
function ye(r) {
|
|
144
|
+
return !!(r && b(me, r));
|
|
145
|
+
}
|
|
146
|
+
function R(r, e) {
|
|
147
|
+
if (!r)
|
|
148
|
+
return [];
|
|
149
|
+
const t = e === "updatable" ? ge : fe, s = /* @__PURE__ */ new Map();
|
|
150
|
+
return t.forEach((a) => {
|
|
151
|
+
r[a].forEach((i) => {
|
|
152
|
+
s.has(i.sourceItem.id) || s.set(i.sourceItem.id, {
|
|
153
|
+
itemResult: i,
|
|
154
|
+
state: a
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}), Array.from(s.values());
|
|
158
|
+
}
|
|
159
|
+
function we({
|
|
160
|
+
mainAccess: r,
|
|
161
|
+
sourceItem: e,
|
|
162
|
+
sourceGroups: t,
|
|
163
|
+
mainGroupIds: s,
|
|
164
|
+
isMainItemSharedWithCollabGroups: a,
|
|
165
|
+
sourceHasSameOwningSystem: i,
|
|
166
|
+
portalIsPortal: l
|
|
167
|
+
}) {
|
|
168
|
+
const o = { ...T }, d = new Set((t ?? []).map((c) => c.id)), u = r === "public";
|
|
169
|
+
if (u && pe(e, { isPortal: l }))
|
|
170
|
+
return { ...o, needsShareLevelUpdate: !0, canEditShareLevel: !1 };
|
|
171
|
+
const n = e.access;
|
|
172
|
+
return n !== "public" ? (o.canEditShareLevel = be(e.itemControl), o.needsShareLevelUpdate = Se(r, n), o.needsGroupUpdate = (!u || a) && x(s, d), o) : (o.premium = Ee(e), o.needsGroupUpdate = Ie({
|
|
173
|
+
sourceItem: e,
|
|
174
|
+
isMainItemSharedToPublic: u,
|
|
175
|
+
isMainItemSharedWithCollabGroups: a,
|
|
176
|
+
mainGroupIds: s,
|
|
177
|
+
sourceGroupIds: d,
|
|
178
|
+
sourceHasSameOwningSystem: i
|
|
179
|
+
}), o);
|
|
180
|
+
}
|
|
181
|
+
function be(r) {
|
|
182
|
+
return r === "admin" || r === "update";
|
|
183
|
+
}
|
|
184
|
+
function Se(r, e) {
|
|
185
|
+
return !(e === "private" && r === "shared") && U[r] > U[e];
|
|
186
|
+
}
|
|
187
|
+
function Ie({
|
|
188
|
+
sourceItem: r,
|
|
189
|
+
isMainItemSharedToPublic: e,
|
|
190
|
+
isMainItemSharedWithCollabGroups: t,
|
|
191
|
+
mainGroupIds: s,
|
|
192
|
+
sourceGroupIds: a,
|
|
193
|
+
sourceHasSameOwningSystem: i
|
|
194
|
+
}) {
|
|
195
|
+
return !e || !t || r.owner === "esri_apps" || !i ? !1 : x(s, a);
|
|
196
|
+
}
|
|
197
|
+
function x(r, e) {
|
|
198
|
+
for (const t of r)
|
|
199
|
+
if (!e.has(t))
|
|
200
|
+
return !0;
|
|
201
|
+
return !1;
|
|
202
|
+
}
|
|
203
|
+
function Ee(r) {
|
|
204
|
+
const e = r.owner?.toLowerCase() ?? "", t = r.typeKeywords ?? [];
|
|
205
|
+
return e.includes("esri") && (t.includes("Requires Credits") || t.includes("Requires Subscription"));
|
|
206
|
+
}
|
|
207
|
+
async function $e(r) {
|
|
208
|
+
const e = await B(r);
|
|
209
|
+
return e.error || !e.result ? { error: e.error ?? { code: "unhandledError" } } : { result: e.result.buckets };
|
|
210
|
+
}
|
|
211
|
+
async function B({
|
|
212
|
+
portal: r,
|
|
213
|
+
mainItems: e
|
|
214
|
+
}) {
|
|
215
|
+
try {
|
|
216
|
+
const t = await ke(r, e);
|
|
217
|
+
if (t.error || !t.result)
|
|
218
|
+
return { error: t.error ?? { code: "unhandledError" } };
|
|
219
|
+
const s = await Le({ portal: r, mainItems: t.result });
|
|
220
|
+
return s.error || !s.result ? { error: s.error ?? { code: "unhandledError" } } : { result: { mainItems: t.result, buckets: s.result } };
|
|
221
|
+
} catch (t) {
|
|
222
|
+
return console.error(t), { error: { code: "unhandledError" } };
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
async function ke(r, e) {
|
|
226
|
+
const t = [];
|
|
227
|
+
for (const { id: i } of e) {
|
|
228
|
+
if (!i)
|
|
229
|
+
return console.error("Main items must have an ID to refresh sharing metadata."), { error: { code: "unhandledError" } };
|
|
230
|
+
t.push(i);
|
|
231
|
+
}
|
|
232
|
+
const s = await Promise.all(t.map(async (i) => await z(r, i))), a = [];
|
|
233
|
+
for (const i of s) {
|
|
234
|
+
if (i.error || !i.result)
|
|
235
|
+
return console.error("Unable to load current main item sharing metadata.", i.error), { error: i.error ?? { code: "unhandledError" } };
|
|
236
|
+
a.push(i.result);
|
|
237
|
+
}
|
|
238
|
+
return { result: a };
|
|
239
|
+
}
|
|
240
|
+
async function Le({
|
|
241
|
+
portal: r,
|
|
242
|
+
mainItems: e
|
|
243
|
+
}) {
|
|
244
|
+
if (!e.length)
|
|
245
|
+
return { error: { code: "unhandledError", message: "At least one main item is required." } };
|
|
246
|
+
const t = e.filter((n) => n.access !== "private");
|
|
247
|
+
if (!t.length)
|
|
248
|
+
return { result: C() };
|
|
249
|
+
const s = C(), a = X(r), i = ye(a.subscriptionInfo?.type);
|
|
250
|
+
for (const n of t) {
|
|
251
|
+
if (!se(n))
|
|
252
|
+
continue;
|
|
253
|
+
const c = {
|
|
254
|
+
mainItemId: n.id,
|
|
255
|
+
sourceItem: n,
|
|
256
|
+
detail: { ...T }
|
|
257
|
+
};
|
|
258
|
+
s.needAuthentication.push(c), s.allRelatedItems.push(c);
|
|
259
|
+
}
|
|
260
|
+
const l = /* @__PURE__ */ new Map();
|
|
261
|
+
for (const n of t) {
|
|
262
|
+
const { result: c, error: p } = await Pe(r, n.id);
|
|
263
|
+
if (p || !c)
|
|
264
|
+
return { error: p ?? { code: "unhandledError" } };
|
|
265
|
+
l.set(n.id, c);
|
|
266
|
+
}
|
|
267
|
+
const o = /* @__PURE__ */ new Map();
|
|
268
|
+
for (const n of t)
|
|
269
|
+
l.get(n.id)?.length && o.set(n.id, await w(r, n.id));
|
|
270
|
+
const u = t.some(
|
|
271
|
+
(n) => n.access === "public" && o.get(n.id)?.some((c) => c.capabilities?.includes("distributed")) && l.get(n.id)?.some((c) => c.access === "public" && c.owner !== "esri_apps" && c.url)
|
|
272
|
+
) ? await D(r, r.restUrl) : void 0;
|
|
273
|
+
for (const n of t) {
|
|
274
|
+
const c = l.get(n.id) ?? [];
|
|
275
|
+
if (!c.length)
|
|
276
|
+
continue;
|
|
277
|
+
const p = o.get(n.id) ?? [], h = new Set(p.map((m) => m.id)), S = p.some(
|
|
278
|
+
(m) => m.capabilities?.includes("distributed")
|
|
279
|
+
), q = await Promise.all(
|
|
280
|
+
c.map(async (m) => {
|
|
281
|
+
const f = await w(r, m.id);
|
|
282
|
+
let I = !1;
|
|
283
|
+
if (n.access === "public" && m.access === "public" && S && m.owner !== "esri_apps" && m.url && [...h].some((v) => !f.some((K) => K.id === v))) {
|
|
284
|
+
const v = await D(r, m.url);
|
|
285
|
+
I = !!(v && u && v === u);
|
|
286
|
+
}
|
|
287
|
+
const G = we({
|
|
288
|
+
mainAccess: n.access,
|
|
289
|
+
sourceItem: m,
|
|
290
|
+
sourceGroups: f,
|
|
291
|
+
mainGroupIds: h,
|
|
292
|
+
isMainItemSharedWithCollabGroups: S,
|
|
293
|
+
sourceHasSameOwningSystem: I,
|
|
294
|
+
portalIsPortal: r.isPortal
|
|
295
|
+
});
|
|
296
|
+
return { mainItemId: n.id, sourceItem: m, detail: G };
|
|
297
|
+
})
|
|
298
|
+
);
|
|
299
|
+
(await Promise.all(
|
|
300
|
+
q.map(async (m) => ({
|
|
301
|
+
itemResult: m,
|
|
302
|
+
bucket: await ve({
|
|
303
|
+
sharingDetailResult: m,
|
|
304
|
+
mainAccess: n.access,
|
|
305
|
+
developerPortal: i,
|
|
306
|
+
portal: r
|
|
307
|
+
})
|
|
308
|
+
}))
|
|
309
|
+
)).forEach(({ itemResult: m, bucket: f }) => {
|
|
310
|
+
s.allRelatedItems.push(m), f && s[f].push(m);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
return { result: s };
|
|
314
|
+
}
|
|
315
|
+
async function D(r, e) {
|
|
316
|
+
const t = new URL(e), s = t.pathname.match(/^.*?\/rest(?:\/|$)/iu)?.[0];
|
|
317
|
+
t.pathname = `${(s ?? t.pathname).replace(/\/$/u, "")}/info`, t.search = "", t.hash = "";
|
|
318
|
+
const a = t.href;
|
|
319
|
+
try {
|
|
320
|
+
return (await te({
|
|
321
|
+
key: "portalInfo",
|
|
322
|
+
id: a,
|
|
323
|
+
requester: async () => await y({
|
|
324
|
+
url: a,
|
|
325
|
+
portal: r,
|
|
326
|
+
options: { addTokenManually: !1, disableIdentityLookup: !0 }
|
|
327
|
+
})
|
|
328
|
+
})).owningSystemUrl;
|
|
329
|
+
} catch (i) {
|
|
330
|
+
throw re("portalInfo", a), i;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
async function Pe(r, e) {
|
|
334
|
+
const t = /* @__PURE__ */ new Map(), { error: s, result: a } = await le({
|
|
335
|
+
itemId: e,
|
|
336
|
+
portal: r,
|
|
337
|
+
relationship: { direction: "reverse" }
|
|
338
|
+
});
|
|
339
|
+
if (s || !a)
|
|
340
|
+
return { error: s ?? { code: "unhandledError" } };
|
|
341
|
+
for (const i of a.relatedItems)
|
|
342
|
+
i.id !== e && t.set(i.id, i);
|
|
343
|
+
return { result: Array.from(t.values()) };
|
|
344
|
+
}
|
|
345
|
+
const C = () => ({
|
|
346
|
+
allRelatedItems: [],
|
|
347
|
+
needEditableLayers: [],
|
|
348
|
+
needPubliclyEditableLayers: [],
|
|
349
|
+
needDataCollectionLayers: [],
|
|
350
|
+
needsShareLevelUpdateLayers: [],
|
|
351
|
+
premiumLayers: [],
|
|
352
|
+
notEditableLayers: [],
|
|
353
|
+
needAuthentication: []
|
|
354
|
+
});
|
|
355
|
+
async function Ue({
|
|
356
|
+
portal: r,
|
|
357
|
+
mainItems: e,
|
|
358
|
+
sourceItems: t,
|
|
359
|
+
shareLevel: s,
|
|
360
|
+
updateGroups: a
|
|
361
|
+
}) {
|
|
362
|
+
if (!t.length)
|
|
363
|
+
return { result: [] };
|
|
364
|
+
try {
|
|
365
|
+
const i = a ? await Re(
|
|
366
|
+
r,
|
|
367
|
+
e,
|
|
368
|
+
s === "public" || e.every(({ access: p }) => p === "public")
|
|
369
|
+
) : [], l = {
|
|
370
|
+
confirmItemControl: !0,
|
|
371
|
+
...i.length ? { groups: i.join(",") } : {},
|
|
372
|
+
...s ? De(s) : {}
|
|
373
|
+
}, o = Y(r), d = r.user;
|
|
374
|
+
if (d && t.every(({ owner: p }) => p === d.username)) {
|
|
375
|
+
const { results: p } = await y({
|
|
376
|
+
url: `${o}content/users/${d.username}/shareItems`,
|
|
377
|
+
portal: r,
|
|
378
|
+
params: { ...l, items: t.map(({ id: h }) => h).join(",") },
|
|
379
|
+
method: "post"
|
|
380
|
+
});
|
|
381
|
+
return M(p, t);
|
|
382
|
+
}
|
|
383
|
+
const u = await Promise.allSettled(
|
|
384
|
+
t.map(async ({ id: p }) => {
|
|
385
|
+
const h = await y({
|
|
386
|
+
url: `${o}content/items/${p}/share`,
|
|
387
|
+
portal: r,
|
|
388
|
+
params: l,
|
|
389
|
+
method: "post"
|
|
390
|
+
});
|
|
391
|
+
return { ...h, success: !h.error && !h.notSharedWith?.length };
|
|
392
|
+
})
|
|
393
|
+
), n = [];
|
|
394
|
+
let c = !1;
|
|
395
|
+
return u.forEach((p) => {
|
|
396
|
+
p.status === "fulfilled" ? n.push(p.value) : (c = !0, console.error("Unable to update related item sharing", p.reason));
|
|
397
|
+
}), c ? { result: n, error: { code: "unhandledError" } } : M(n, t);
|
|
398
|
+
} catch (i) {
|
|
399
|
+
return console.error("Unable to update related item sharing", i), { error: { code: "unhandledError" } };
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
async function Re(r, e, t) {
|
|
403
|
+
if (!e.length)
|
|
404
|
+
throw new Error("Main items are required to update group sharing.");
|
|
405
|
+
const s = await Promise.all(e.map(async ({ id: l }) => await w(r, l))), a = s.slice(1).map((l) => new Set(l.map(({ id: o }) => o))), i = /* @__PURE__ */ new Set();
|
|
406
|
+
return s[0].filter((l) => {
|
|
407
|
+
const { id: o } = l;
|
|
408
|
+
return i.has(o) || !a.every((d) => d.has(o)) || t && !ie(l) ? !1 : (i.add(o), !0);
|
|
409
|
+
}).map(({ id: l }) => l);
|
|
410
|
+
}
|
|
411
|
+
function De(r) {
|
|
412
|
+
return {
|
|
413
|
+
org: r === "org",
|
|
414
|
+
everyone: r === "public"
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function M(r, e) {
|
|
418
|
+
const t = r.filter(
|
|
419
|
+
({ success: a, error: i, notSharedWith: l }) => !a || i || l?.length
|
|
420
|
+
), s = new Set(r.map(({ itemId: a }) => a));
|
|
421
|
+
return r.length !== e.length || s.size !== e.length || e.some(({ id: a }) => !s.has(a)) || t.length ? (console.error("Some related items were not successfully shared.", r), { result: r, error: { code: "unhandledError" } }) : { result: r };
|
|
422
|
+
}
|
|
423
|
+
class Ce extends _ {
|
|
424
|
+
constructor() {
|
|
425
|
+
super(...arguments), this.messages = k({ blocking: !0 }), this.analysisRequestId = 0, this.statusMessages = k({ name: "portal-item-status-card", blocking: !0 }), this.previewElement = H(), this.displayItemsById = /* @__PURE__ */ new Map(), this.previewSession = ee({
|
|
426
|
+
onOpen: ({ preview: e }) => {
|
|
427
|
+
const { updatable: t, nonUpdatable: s } = this.displayItems;
|
|
428
|
+
this.previewItem = [...t, ...s].find(({ itemResult: a }) => a.sourceItem.id === e.id);
|
|
429
|
+
},
|
|
430
|
+
onClose: () => {
|
|
431
|
+
this.previewItem = void 0;
|
|
432
|
+
}
|
|
433
|
+
}), this.previewTask = new J(this, {
|
|
434
|
+
args: () => [this.previewItem, this.portal],
|
|
435
|
+
task: async ([e, t]) => {
|
|
436
|
+
if (!e)
|
|
437
|
+
return;
|
|
438
|
+
const s = await z(t, e.itemResult.sourceItem.id);
|
|
439
|
+
if (s.error || !s.result)
|
|
440
|
+
return $("error", this, "Unable to load review item preview.", { detail: { error: s.error } }), { error: !0 };
|
|
441
|
+
const a = L(e.state), i = a?.i18nKey === "pdc" ? "120004130" : a?.i18nKey === "premium" ? "120001307" : void 0, l = i ? await Q(t, this.messages._lang) : void 0, o = i ? l?.[i] : void 0, d = this.createDisplayItem(s.result, t);
|
|
442
|
+
return await d.load(), {
|
|
443
|
+
item: d,
|
|
444
|
+
helpUrl: o ? `${Z(t)}${o}` : void 0
|
|
445
|
+
};
|
|
446
|
+
},
|
|
447
|
+
onComplete: () => {
|
|
448
|
+
this.focusPreview();
|
|
449
|
+
},
|
|
450
|
+
onError: (e) => {
|
|
451
|
+
$("error", this, "Unable to load review item preview.", { detail: { error: e } });
|
|
452
|
+
}
|
|
453
|
+
}), this.loading = !1, this.updatingSharing = !1, this.open = !1, this.arcgisClose = E(), this.arcgisComplete = E();
|
|
454
|
+
}
|
|
455
|
+
static {
|
|
456
|
+
this.properties = { loading: 16, buckets: 16, errorMessage: 16, updatingSharing: 16, updateError: 16, previewItem: 16, portal: 0, items: 0, open: 5 };
|
|
457
|
+
}
|
|
458
|
+
static {
|
|
459
|
+
this.styles = ae;
|
|
460
|
+
}
|
|
461
|
+
willUpdate(e) {
|
|
462
|
+
if (e.has("open") || e.has("items") || e.has("portal")) {
|
|
463
|
+
this.updateError = void 0, this.previewItem = void 0, this.displayItemsById.clear();
|
|
464
|
+
const t = ++this.analysisRequestId;
|
|
465
|
+
this.open && this.analyzeLayerSharing(t);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
async analyzeLayerSharing(e) {
|
|
469
|
+
this.loading = !0, this.buckets = void 0, this.errorMessage = void 0;
|
|
470
|
+
const t = await $e({
|
|
471
|
+
portal: this.portal,
|
|
472
|
+
mainItems: this.items
|
|
473
|
+
});
|
|
474
|
+
if (!(e !== this.analysisRequestId || !this.open)) {
|
|
475
|
+
if (this.loading = !1, t.error || !t.result) {
|
|
476
|
+
this.errorMessage = this.messages.analysisError;
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
this.buckets = t.result;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
closeDialog() {
|
|
483
|
+
!this.open || this.updatingSharing || (this.open = !1, this.arcgisClose.emit());
|
|
484
|
+
}
|
|
485
|
+
get displayItems() {
|
|
486
|
+
return {
|
|
487
|
+
nonUpdatable: R(this.buckets, "nonUpdatable"),
|
|
488
|
+
updatable: R(this.buckets, "updatable")
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
getDisplayItem(e) {
|
|
492
|
+
let t = this.displayItemsById.get(e.id);
|
|
493
|
+
return t || (t = this.createDisplayItem(e), this.displayItemsById.set(e.id, t)), t;
|
|
494
|
+
}
|
|
495
|
+
createDisplayItem(e, t = this.portal) {
|
|
496
|
+
return new O({
|
|
497
|
+
id: e.id,
|
|
498
|
+
title: e.title,
|
|
499
|
+
owner: e.owner,
|
|
500
|
+
access: e.access,
|
|
501
|
+
type: e.type,
|
|
502
|
+
typeKeywords: e.typeKeywords,
|
|
503
|
+
snippet: e.snippet,
|
|
504
|
+
url: e.url,
|
|
505
|
+
modified: new Date(e.modified),
|
|
506
|
+
sourceJSON: e,
|
|
507
|
+
portal: t
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
async updateSharing() {
|
|
511
|
+
if (this.updatingSharing || !this.buckets || !this.displayItems.updatable.length)
|
|
512
|
+
return;
|
|
513
|
+
const e = this.buckets, t = this.analysisRequestId, s = this.portal;
|
|
514
|
+
this.updatingSharing = !0, this.updateError = void 0;
|
|
515
|
+
const a = await B({ portal: s, mainItems: this.items });
|
|
516
|
+
if (t !== this.analysisRequestId || !this.open) {
|
|
517
|
+
this.updatingSharing = !1;
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
if (a.error || !a.result) {
|
|
521
|
+
this.updatingSharing = !1, this.updateError = this.messages.updateError;
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const { mainItems: i, buckets: l } = a.result;
|
|
525
|
+
this.buckets = l, this.previewItem = void 0, this.displayItemsById.clear();
|
|
526
|
+
const o = [...l.needEditableLayers, ...l.needsShareLevelUpdateLayers];
|
|
527
|
+
if (!o.length) {
|
|
528
|
+
this.updatingSharing = !1;
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
const d = Array.from(new Map(o.map(({ sourceItem: h }) => [h.id, h])).values()), u = o.some(({ detail: h }) => h.needsShareLevelUpdate), n = o.some(({ detail: h }) => h.needsGroupUpdate), c = i[0]?.access;
|
|
532
|
+
if (u && (!c || i.some((h) => h.access !== c))) {
|
|
533
|
+
this.updatingSharing = !1, this.updateError = this.messages.updateError;
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
const p = await Ue({
|
|
537
|
+
portal: s,
|
|
538
|
+
mainItems: i,
|
|
539
|
+
sourceItems: d,
|
|
540
|
+
shareLevel: u ? c : void 0,
|
|
541
|
+
updateGroups: n
|
|
542
|
+
});
|
|
543
|
+
if (this.updatingSharing = !1, !(t !== this.analysisRequestId || !this.open)) {
|
|
544
|
+
if (p.error) {
|
|
545
|
+
this.updateError = this.messages.updateError;
|
|
546
|
+
const h = ++this.analysisRequestId;
|
|
547
|
+
this.analyzeLayerSharing(h);
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
this.open = !1, this.arcgisComplete.emit({ updatedSourceItems: d, oldSharingDetail: e });
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
async focusPreview() {
|
|
554
|
+
await this.updateComplete, await this.previewElement.value?.setFocus();
|
|
555
|
+
}
|
|
556
|
+
async closePreview() {
|
|
557
|
+
this.previewItem = void 0, await this.updateComplete, await this.previewSession.closePreview({ restoreFocus: !0 });
|
|
558
|
+
}
|
|
559
|
+
renderResultSection(e, t) {
|
|
560
|
+
return t.length ? g`<section class="result-section"><div class="result-section__title">${e}</div><div class="result-list">${F(t, ({ itemResult: s, state: a }) => `${a}-${s.mainItemId}-${s.sourceItem.id}`, ({ itemResult: s, state: a }) => g`<arcgis-portal-item-status-card .item=${this.getDisplayItem(s.sourceItem)} .portal=${this.portal} .previewed=${this.previewItem?.itemResult.sourceItem.id === s.sourceItem.id} @arcgisItemBrowserCardPreview=${(i) => {
|
|
561
|
+
i.stopPropagation(), !i.detail || this.previewItem?.itemResult.sourceItem.id === i.detail.id ? this.closePreview() : this.previewSession.handlePreview(i.detail, i.composedPath()[0]);
|
|
562
|
+
}} .state=${a}></arcgis-portal-item-status-card>`)}</div></section>` : null;
|
|
563
|
+
}
|
|
564
|
+
renderPreview() {
|
|
565
|
+
if (!this.previewItem)
|
|
566
|
+
return null;
|
|
567
|
+
const e = L(this.previewItem.state);
|
|
568
|
+
return g`<aside class="preview"><arcgis-portal-preview-panel open @arcgisOpen=${() => {
|
|
569
|
+
this.focusPreview();
|
|
570
|
+
}} @arcgisClose=${(t) => {
|
|
571
|
+
t.stopPropagation(), this.closePreview();
|
|
572
|
+
}}>${this.previewTask.render({
|
|
573
|
+
error: () => this.renderPreviewError(),
|
|
574
|
+
complete: (t) => t && "item" in t ? g`<arcgis-portal-item-preview .item=${t.item} .portal=${this.portal} @arcgisClose=${(s) => {
|
|
575
|
+
s.stopPropagation(), this.closePreview();
|
|
576
|
+
}} ${j(this.previewElement)}>${e && g`<calcite-notice slot=summary-top open .kind=${e.kind}><div slot=message>${this.statusMessages.status[e.i18nKey].panel}</div>${t.helpUrl && (e.i18nKey === "pdc" || e.i18nKey === "premium") && g`<calcite-link slot=link .href=${t.helpUrl} target=_blank rel=noopener icon-end=launch>${this.statusMessages.status[e.i18nKey].learnMore}</calcite-link>` || ""}</calcite-notice>` || ""}</arcgis-portal-item-preview>` : this.renderPreviewError()
|
|
577
|
+
})}</arcgis-portal-preview-panel></aside>`;
|
|
578
|
+
}
|
|
579
|
+
renderPreviewError() {
|
|
580
|
+
return g`<div class="status status--error" role=alert>${this.messages.previewError}</div>`;
|
|
581
|
+
}
|
|
582
|
+
render() {
|
|
583
|
+
const { messages: e, displayItems: t, errorMessage: s, buckets: a, loading: i, open: l, portal: o, updatingSharing: d, updateError: u } = this;
|
|
584
|
+
if (!e._lang)
|
|
585
|
+
return;
|
|
586
|
+
const { nonUpdatable: n, updatable: c } = t, p = c.length > 0 || n.length > 0;
|
|
587
|
+
return g`<calcite-dialog .heading=${e.heading} modal .open=${l} outside-close-disabled escape-disabled overlay-positioning=fixed placement=center scale=l @calciteDialogClose=${this.closeDialog}><div class=${N({ content: !0, "content--preview": !!this.previewItem })}>${d && g`<calcite-scrim class="scrim--overlay" role=status><calcite-loader .label=${e.updatingSharing}></calcite-loader></calcite-scrim>` || ""}${i && g`<div class="status">${e.loadingSourceItems}</div>` || ""}${s && g`<div class="status status--error">${s}</div>` || ""}${u && g`<div class="status status--error" role=alert>${u}</div>` || ""}${!i && !s && a ? g`<div class="results">${this.renderPreview()}<div class="review-content"><div class="top-bar" .innerHTML=${e[o.isPortal ? "noticeEnterprise" : "notice"] ?? ""}></div>${p ? g`<div class="result-sections">${this.renderResultSection(P(e.updatableSectionTitle, { count: c.length }), c)}${this.renderResultSection(P(e.nonUpdatableSectionTitle, { count: n.length }), n)}</div>` : g`<div class="status">${e.noIssues}</div>`}</div></div>` : null}</div><calcite-button slot=footer-end appearance=outline .disabled=${d} @click=${this.closeDialog}>${e.close}</calcite-button>${c.length > 0 && g`<calcite-button slot=footer-end .disabled=${d} @click=${this.updateSharing}>${e.updateSharing}</calcite-button>` || ""}</calcite-dialog>`;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
A("arcgis-portal-review-layer-sharing", Ce);
|
|
591
|
+
export {
|
|
592
|
+
Ce as A,
|
|
593
|
+
$e as a,
|
|
594
|
+
R as g
|
|
595
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import { u as t, a as l } from "./item.js";
|
|
3
|
+
const c = (n) => typeof n?.role == "string" && n?.role ? n?.role : n?.roleId ?? n?.sourceJSON?.id;
|
|
4
|
+
function i(n) {
|
|
5
|
+
return n ? ["org_admin", "account_admin"].includes(c(n)) && !n?.roleId : !1;
|
|
6
|
+
}
|
|
7
|
+
function d(n) {
|
|
8
|
+
return !!(n?.roleId && n.roleId.length > 0);
|
|
9
|
+
}
|
|
10
|
+
function s(n) {
|
|
11
|
+
return !!n?.privileges?.includes("portal:admin:deleteItems");
|
|
12
|
+
}
|
|
13
|
+
function m(n, e) {
|
|
14
|
+
return e ? t(n, e) || n.itemControl === "update" || l([n], e) && i(e) : !1;
|
|
15
|
+
}
|
|
16
|
+
function g(n, e) {
|
|
17
|
+
if (!e)
|
|
18
|
+
return !1;
|
|
19
|
+
const o = l([n], e), r = t(n, e) || i(e) && o, a = d(e) && s(e);
|
|
20
|
+
return !!(r || o && a);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
g as a,
|
|
24
|
+
m as c,
|
|
25
|
+
i
|
|
26
|
+
};
|