@esri/solutions-components 5.1.0-next.94 → 5.1.0-next.95
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/2ID55IJB.js +2 -0
- package/dist/cdn/2SGR44DX.js +2 -0
- package/dist/cdn/{C4UB6MNN.js → 3J47AYBV.js} +97 -97
- package/dist/cdn/{VOF34LDF.js → 4B7NJE47.js} +1 -1
- package/dist/cdn/{YVDSW2OQ.js → 5LTIZSXG.js} +1 -1
- package/dist/cdn/74MDW73I.js +2 -0
- package/dist/cdn/ADPYDJG6.js +2 -0
- package/dist/cdn/{FDE2V7FU.js → AJZHT4GA.js} +1 -1
- package/dist/cdn/{JQXKQHAG.js → DI7PQSFH.js} +1 -1
- package/dist/cdn/FVXS4LF5.js +2 -0
- package/dist/cdn/IRRMUFW7.js +2 -0
- package/dist/cdn/ITLTQWCX.js +2 -0
- package/dist/cdn/IYUTLV2O.js +2 -0
- package/dist/cdn/{3XGF3ZJO.js → KW6YOUWC.js} +1 -1
- package/dist/cdn/{LUZYJVG5.js → KYFNXHOH.js} +1 -1
- package/dist/cdn/{NXL2QN3P.js → R3MCMOLS.js} +1 -1
- package/dist/cdn/R4VHCXKS.js +2 -0
- package/dist/cdn/{5Z45KDQY.js → UHPN75WT.js} +1 -1
- package/dist/cdn/VESARS2D.js +7 -0
- package/dist/cdn/{D4GI6KPZ.js → WVRKV5SS.js} +1 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/solutions-deployed-list/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/solutions-deployed-list/t9n/messages.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/converter.js +82 -86
- package/dist/chunks/get.js +387 -0
- package/dist/components/arcgis-solutions-assistant/customElement.js +5766 -5676
- package/dist/components/consent-manager/customElement.js +609 -638
- package/dist/components/solution-configure-titles/customElement.js +31 -28
- package/dist/components/solution-delete-dialog/customElement.js +57 -54
- package/dist/components/solution-deployed-card-panel/customElement.js +40 -37
- package/dist/components/solution-details-card/customElement.d.ts +4 -0
- package/dist/components/solution-details-card/customElement.js +45 -29
- package/dist/components/solution-details-card/index.js +1 -0
- package/dist/components/solution-item-accordion/customElement.d.ts +3 -2
- package/dist/components/solution-item-accordion/customElement.js +52 -35
- package/dist/components/solution-item-accordion/index.js +2 -0
- package/dist/components/solutions-all-panel/customElement.js +11 -11
- package/dist/components/solutions-deployed-list/customElement.d.ts +33 -0
- package/dist/components/solutions-deployed-list/customElement.js +38 -0
- package/dist/components/solutions-deployed-list/index.d.ts +1 -0
- package/dist/components/solutions-deployed-list/index.js +1 -0
- 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 +10 -0
- package/dist/loader.js +3 -2
- package/dist/solutions-components_commit.txt +7 -7
- package/dist/types/lumina.d.ts +6 -0
- package/dist/types/preact.d.ts +7 -0
- package/dist/types/react.d.ts +8 -0
- package/dist/types/stencil.d.ts +6 -0
- package/dist/utils/getRelatedInfos.d.ts +4 -0
- package/dist/utils/interfaces.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cdn/2L3RREZ4.js +0 -2
- package/dist/cdn/2WHAF4H7.js +0 -2
- package/dist/cdn/AKKTG2RD.js +0 -2
- package/dist/cdn/DLH53PYM.js +0 -7
- package/dist/cdn/P24CZ4HM.js +0 -2
- package/dist/cdn/R2G4DDRZ.js +0 -2
- package/dist/cdn/SO3S3WP4.js +0 -2
- package/dist/cdn/UBLDT5XD.js +0 -2
- package/dist/cdn/ZONXYZVU.js +0 -2
- package/dist/chunks/get-portal-url.js +0 -345
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
function V(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
function x(e, t) {
|
|
6
|
+
var r = {};
|
|
7
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
8
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
9
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
10
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
|
11
|
+
return r;
|
|
12
|
+
}
|
|
13
|
+
function A(e) {
|
|
14
|
+
return Object.keys(e).some((t) => {
|
|
15
|
+
let r = e[t];
|
|
16
|
+
if (!r)
|
|
17
|
+
return !1;
|
|
18
|
+
switch (r && r.toParam && (r = r.toParam()), r.constructor.name) {
|
|
19
|
+
case "Array":
|
|
20
|
+
return !1;
|
|
21
|
+
case "Object":
|
|
22
|
+
return !1;
|
|
23
|
+
case "Date":
|
|
24
|
+
return !1;
|
|
25
|
+
case "Function":
|
|
26
|
+
return !1;
|
|
27
|
+
case "Boolean":
|
|
28
|
+
return !1;
|
|
29
|
+
case "String":
|
|
30
|
+
return !1;
|
|
31
|
+
case "Number":
|
|
32
|
+
return !1;
|
|
33
|
+
default:
|
|
34
|
+
return !0;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function C(e) {
|
|
39
|
+
const t = {};
|
|
40
|
+
return Object.keys(e).forEach((r) => {
|
|
41
|
+
var n, i;
|
|
42
|
+
let o = e[r];
|
|
43
|
+
if (o && o.toParam && (o = o.toParam()), !o && o !== 0 && typeof o != "boolean" && typeof o != "string")
|
|
44
|
+
return;
|
|
45
|
+
const s = o.constructor.name;
|
|
46
|
+
let a;
|
|
47
|
+
switch (s) {
|
|
48
|
+
case "Array":
|
|
49
|
+
const f = (i = (n = o[0]) === null || n === void 0 ? void 0 : n.constructor) === null || i === void 0 ? void 0 : i.name;
|
|
50
|
+
a = f === "Array" ? o : f === "Object" ? JSON.stringify(o) : o.join(",");
|
|
51
|
+
break;
|
|
52
|
+
case "Object":
|
|
53
|
+
a = JSON.stringify(o);
|
|
54
|
+
break;
|
|
55
|
+
case "Date":
|
|
56
|
+
a = o.valueOf();
|
|
57
|
+
break;
|
|
58
|
+
case "Function":
|
|
59
|
+
a = null;
|
|
60
|
+
break;
|
|
61
|
+
case "Boolean":
|
|
62
|
+
a = o + "";
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
a = o;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
(a || a === 0 || typeof a == "string" || Array.isArray(a)) && (t[r] = a);
|
|
69
|
+
}), t;
|
|
70
|
+
}
|
|
71
|
+
function O(e, t) {
|
|
72
|
+
return Array.isArray(t) && t[0] && Array.isArray(t[0]) ? t.map((r) => O(e, r)).join("&") : encodeURIComponent(e) + "=" + encodeURIComponent(t);
|
|
73
|
+
}
|
|
74
|
+
function T(e) {
|
|
75
|
+
const t = C(e);
|
|
76
|
+
return Object.keys(t).map((r) => O(r, t[r])).join("&");
|
|
77
|
+
}
|
|
78
|
+
const G = globalThis.FormData;
|
|
79
|
+
function $(e, t) {
|
|
80
|
+
const r = A(e) || t, n = C(e);
|
|
81
|
+
if (r) {
|
|
82
|
+
const i = new G();
|
|
83
|
+
return Object.keys(n).forEach((o) => {
|
|
84
|
+
if (typeof Blob < "u" && n[o] instanceof Blob) {
|
|
85
|
+
const s = n.fileName || n[o].name || o;
|
|
86
|
+
i.append(o, n[o], s);
|
|
87
|
+
} else
|
|
88
|
+
i.append(o, n[o]);
|
|
89
|
+
}), i;
|
|
90
|
+
} else
|
|
91
|
+
return T(e);
|
|
92
|
+
}
|
|
93
|
+
class m extends Error {
|
|
94
|
+
/**
|
|
95
|
+
* Create a new `ArcGISRequestError` object.
|
|
96
|
+
*
|
|
97
|
+
* @param message - The error message from the API
|
|
98
|
+
* @param code - The error code from the API
|
|
99
|
+
* @param response - The original response from the API that caused the error
|
|
100
|
+
* @param url - The original url of the request
|
|
101
|
+
* @param options - The original options and parameters of the request
|
|
102
|
+
*/
|
|
103
|
+
constructor(t, r, n, i, o) {
|
|
104
|
+
super(t);
|
|
105
|
+
const s = new.target.prototype;
|
|
106
|
+
Object.setPrototypeOf(this, s), t = t || "UNKNOWN_ERROR", r = r || "UNKNOWN_ERROR_CODE", this.name = "ArcGISRequestError", this.message = r === "UNKNOWN_ERROR_CODE" ? t : `${r}: ${t}`, this.originalMessage = t, this.code = r, this.response = n, this.url = i, this.options = o;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const k = {
|
|
110
|
+
noCorsDomains: [],
|
|
111
|
+
crossOriginNoCorsDomains: {},
|
|
112
|
+
pendingNoCorsRequests: {}
|
|
113
|
+
}, R = "ARCGIS_REST_JS_NO_CORS";
|
|
114
|
+
globalThis[R] || (globalThis[R] = Object.assign({}, k));
|
|
115
|
+
const u = globalThis[R];
|
|
116
|
+
function L(e) {
|
|
117
|
+
const t = new URL(e);
|
|
118
|
+
e = t.origin + t.pathname, t.search.includes("f=json") && (e += "?f=json");
|
|
119
|
+
const r = t.origin;
|
|
120
|
+
return u.pendingNoCorsRequests[r] || (u.pendingNoCorsRequests[r] = fetch(e, {
|
|
121
|
+
mode: "no-cors",
|
|
122
|
+
credentials: "include",
|
|
123
|
+
cache: "no-store"
|
|
124
|
+
}).then((n) => {
|
|
125
|
+
u.noCorsDomains.indexOf(r) === -1 && u.noCorsDomains.push(r), u.crossOriginNoCorsDomains[r.toLowerCase()] = Date.now(), delete u.pendingNoCorsRequests[r];
|
|
126
|
+
}).catch((n) => (delete u.pendingNoCorsRequests[r], Promise.reject(new Error(`no-cors request to ${r} failed`))))), u.pendingNoCorsRequests[r];
|
|
127
|
+
}
|
|
128
|
+
function F(e) {
|
|
129
|
+
e.forEach((t) => {
|
|
130
|
+
t = t.toLowerCase(), /^https?:\/\//.test(t) ? p(t) : (p("http://" + t), p("https://" + t));
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function p(e) {
|
|
134
|
+
const r = new URL(e).origin;
|
|
135
|
+
u.noCorsDomains.indexOf(r) === -1 && u.noCorsDomains.push(r);
|
|
136
|
+
}
|
|
137
|
+
function N(e) {
|
|
138
|
+
let t = !1;
|
|
139
|
+
if (u.noCorsDomains.length) {
|
|
140
|
+
const r = new URL(e).origin.toLowerCase();
|
|
141
|
+
t = u.noCorsDomains.some((n) => r.includes(n));
|
|
142
|
+
}
|
|
143
|
+
return t;
|
|
144
|
+
}
|
|
145
|
+
function W(e) {
|
|
146
|
+
let t = !1;
|
|
147
|
+
if (N(e)) {
|
|
148
|
+
const r = new URL(e).origin.toLowerCase(), n = u.crossOriginNoCorsDomains[r] || 0;
|
|
149
|
+
Date.now() - 60 * 6e4 > n && (t = !0);
|
|
150
|
+
}
|
|
151
|
+
return t;
|
|
152
|
+
}
|
|
153
|
+
function M(e) {
|
|
154
|
+
console && console.warn && console.warn.apply(console, [e]);
|
|
155
|
+
}
|
|
156
|
+
function B() {
|
|
157
|
+
return Promise.resolve({
|
|
158
|
+
fetch: globalThis.fetch,
|
|
159
|
+
Headers: globalThis.Headers,
|
|
160
|
+
Response: globalThis.Response,
|
|
161
|
+
Request: globalThis.Request
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function J(e, t) {
|
|
165
|
+
var r;
|
|
166
|
+
if (!t && !window || !e)
|
|
167
|
+
return !1;
|
|
168
|
+
{
|
|
169
|
+
t = t || window;
|
|
170
|
+
const n = (r = t.location) === null || r === void 0 ? void 0 : r.origin;
|
|
171
|
+
return e.startsWith(n);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const H = "@esri/arcgis-rest-js";
|
|
175
|
+
function K() {
|
|
176
|
+
return globalThis.DEFAULT_ARCGIS_REQUEST_OPTIONS || {
|
|
177
|
+
httpMethod: "POST",
|
|
178
|
+
params: {
|
|
179
|
+
f: "json"
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
class S extends m {
|
|
184
|
+
/**
|
|
185
|
+
* Create a new `ArcGISAuthError` object.
|
|
186
|
+
*
|
|
187
|
+
* @param message - The error message from the API
|
|
188
|
+
* @param code - The error code from the API
|
|
189
|
+
* @param response - The original response from the API that caused the error
|
|
190
|
+
* @param url - The original url of the request
|
|
191
|
+
* @param options - The original options of the request
|
|
192
|
+
*/
|
|
193
|
+
constructor(t = "AUTHENTICATION_ERROR", r = "AUTHENTICATION_ERROR_CODE", n, i, o) {
|
|
194
|
+
super(t, r, n, i, o), this.name = "ArcGISAuthError", this.message = r === "AUTHENTICATION_ERROR_CODE" ? t : `${r}: ${t}`;
|
|
195
|
+
const s = new.target.prototype;
|
|
196
|
+
Object.setPrototypeOf(this, s);
|
|
197
|
+
}
|
|
198
|
+
retry(t, r = 1) {
|
|
199
|
+
let n = 0;
|
|
200
|
+
const i = (o, s) => {
|
|
201
|
+
n = n + 1, t(this.url, this.options).then((a) => {
|
|
202
|
+
const f = Object.assign(Object.assign({}, this.options), { authentication: a });
|
|
203
|
+
return j(this.url, f);
|
|
204
|
+
}).then((a) => {
|
|
205
|
+
o(a);
|
|
206
|
+
}).catch((a) => {
|
|
207
|
+
a.name === "ArcGISAuthError" && n < r ? i(o, s) : a.name === this.name && a.message === this.message && n >= r ? s(this) : s(a);
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
return new Promise((o, s) => {
|
|
211
|
+
i(o, s);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function z(e, t, r, n, i) {
|
|
216
|
+
if (e.code >= 400) {
|
|
217
|
+
const { message: o, code: s } = e;
|
|
218
|
+
throw new m(o, s, e, t, n);
|
|
219
|
+
}
|
|
220
|
+
if (e.error) {
|
|
221
|
+
const { message: o, code: s, messageCode: a } = e.error, f = a || s || "UNKNOWN_ERROR_CODE";
|
|
222
|
+
throw s === 498 || s === 499 ? i || new S(o, f, e, t, n) : new m(o, f, e, t, n);
|
|
223
|
+
}
|
|
224
|
+
if (e.status === "failed" || e.status === "failure") {
|
|
225
|
+
let o, s = "UNKNOWN_ERROR_CODE";
|
|
226
|
+
try {
|
|
227
|
+
o = JSON.parse(e.statusMessage).message, s = JSON.parse(e.statusMessage).code;
|
|
228
|
+
} catch {
|
|
229
|
+
o = e.statusMessage || e.message;
|
|
230
|
+
}
|
|
231
|
+
throw new m(o, s, e, t, n);
|
|
232
|
+
}
|
|
233
|
+
return e;
|
|
234
|
+
}
|
|
235
|
+
function j(e, t) {
|
|
236
|
+
const r = K(), n = Object.assign(Object.assign(Object.assign({ httpMethod: "POST" }, r), t), {
|
|
237
|
+
params: Object.assign(Object.assign({}, r.params), t.params),
|
|
238
|
+
headers: Object.assign(Object.assign({}, r.headers), t.headers)
|
|
239
|
+
}), { httpMethod: i, rawResponse: o } = n, s = Object.assign({ f: "json" }, n.params);
|
|
240
|
+
let a = null;
|
|
241
|
+
const f = {
|
|
242
|
+
method: i,
|
|
243
|
+
signal: n.signal,
|
|
244
|
+
/* ensures behavior mimics XMLHttpRequest.
|
|
245
|
+
needed to support sending IWA cookies */
|
|
246
|
+
credentials: n.credentials || "same-origin"
|
|
247
|
+
};
|
|
248
|
+
N(e) && (f.credentials = "include"), n.headers && n.headers["X-Esri-Auth-Client-Id"] && e.indexOf("/oauth2/platformSelf") > -1 && (f.credentials = "include");
|
|
249
|
+
let g;
|
|
250
|
+
if (typeof n.authentication == "string") {
|
|
251
|
+
const c = n.authentication;
|
|
252
|
+
g = {
|
|
253
|
+
portal: "https://www.arcgis.com/sharing/rest",
|
|
254
|
+
getToken: () => Promise.resolve(c)
|
|
255
|
+
};
|
|
256
|
+
!n.authentication.startsWith("AAPK") && !n.authentication.startsWith("AAPT") && !n.authentication.startsWith("AATK") && // doesn't look like an API Key
|
|
257
|
+
!n.authentication.startsWith("AAST") && // doesn't look like a session token
|
|
258
|
+
!n.suppressWarnings && // user doesn't want to suppress warnings for this request
|
|
259
|
+
!globalThis.ARCGIS_REST_JS_SUPPRESS_TOKEN_WARNING && (M("Using an oAuth 2.0 access token directly in the token option is discouraged. Consider using ArcGISIdentityManager or Application session. See https://esriurl.com/arcgis-rest-js-direct-token-warning for more information."), globalThis.ARCGIS_REST_JS_SUPPRESS_TOKEN_WARNING = !0);
|
|
260
|
+
} else
|
|
261
|
+
g = n.authentication;
|
|
262
|
+
const U = e;
|
|
263
|
+
let b = !1;
|
|
264
|
+
typeof window < "u" && (b = J(e));
|
|
265
|
+
const I = !b && W(e);
|
|
266
|
+
n.headers && n.headers["X-Esri-Auth-Client-Id"] && e.indexOf("/oauth2/platformSelf") > -1 && (f.credentials = "include");
|
|
267
|
+
let E = Promise.resolve();
|
|
268
|
+
return I && (f.credentials = "include", E = L(e)), E.then(() => g ? g.getToken(e).catch((c) => (c.url = e, c.options = n, a = c, Promise.resolve(""))) : Promise.resolve("")).then((c) => {
|
|
269
|
+
c.length && (s.token = c), g && g.getDomainCredentials && (f.credentials = g.getDomainCredentials(e));
|
|
270
|
+
const l = {};
|
|
271
|
+
if (f.method === "GET") {
|
|
272
|
+
s.token && n.hideToken && // Sharing API does not support preflight check required by modern browsers https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request
|
|
273
|
+
typeof window > "u" && (l["X-Esri-Authorization"] = `Bearer ${s.token}`, delete s.token);
|
|
274
|
+
const d = T(s), w = d === "" ? (
|
|
275
|
+
/* istanbul ignore next -- @preserve */
|
|
276
|
+
e
|
|
277
|
+
) : `${e}?${d}`;
|
|
278
|
+
// This would exceed the maximum length for URLs by 2000 as default or as specified by the consumer and requires POST
|
|
279
|
+
n.maxUrlLength && w.length > n.maxUrlLength || !n.maxUrlLength && w.length > 2e3 || // Or if the customer requires the token to be hidden and it has not already been hidden in the header (for browsers)
|
|
280
|
+
s.token && n.hideToken ? (f.method = "POST", c.length && n.hideToken && (s.token = c, delete l["X-Esri-Authorization"])) : e = w;
|
|
281
|
+
}
|
|
282
|
+
const h = new RegExp("/items/.+/updateResources").test(e);
|
|
283
|
+
f.method === "POST" && (f.body = $(s, h)), f.headers = Object.assign(Object.assign({}, l), n.headers);
|
|
284
|
+
(typeof window > "u" || window && typeof window.document > "u") && !f.headers.referer && (f.headers.referer = H);
|
|
285
|
+
!A(s) && !h && (f.headers["Content-Type"] = "application/x-www-form-urlencoded");
|
|
286
|
+
return globalThis.fetch ? globalThis.fetch(e, f) : B().then(({ fetch: d }) => d(e, f));
|
|
287
|
+
}).then((c) => {
|
|
288
|
+
if (!c.ok)
|
|
289
|
+
return c.json().then((l) => {
|
|
290
|
+
const { status: h, statusText: d } = c, { message: w, details: y } = l.error, v = `${w}. ${y ? y.join(" ") : ""}`.trim();
|
|
291
|
+
throw new m(v, `HTTP ${h} ${d}`, l, e, n);
|
|
292
|
+
}).catch((l) => {
|
|
293
|
+
if (l.name === "ArcGISRequestError")
|
|
294
|
+
throw l;
|
|
295
|
+
const { status: h, statusText: d } = c;
|
|
296
|
+
throw new m(d, `HTTP ${h}`, c, e, n);
|
|
297
|
+
});
|
|
298
|
+
if (o)
|
|
299
|
+
return console.warn("rawResponse option is deprecated and will be removed in ArcGIS REST JS v5.0."), c;
|
|
300
|
+
switch (s.f) {
|
|
301
|
+
case "json":
|
|
302
|
+
return c.json();
|
|
303
|
+
case "geojson":
|
|
304
|
+
return c.json();
|
|
305
|
+
case "html":
|
|
306
|
+
return c.text();
|
|
307
|
+
case "text":
|
|
308
|
+
return c.text();
|
|
309
|
+
/* istanbul ignore next blob responses are difficult to make cross platform we will just have to trust that isomorphic fetch will do its job */
|
|
310
|
+
default:
|
|
311
|
+
return c.blob();
|
|
312
|
+
}
|
|
313
|
+
}).then((c) => {
|
|
314
|
+
if ((s.f === "json" || s.f === "geojson") && !o) {
|
|
315
|
+
const l = z(c, U, s, n, a);
|
|
316
|
+
if (c && /\/sharing\/rest\/(accounts|portals)\/self/i.test(e) && Array.isArray(c.authorizedCrossOriginNoCorsDomains) && F(c.authorizedCrossOriginNoCorsDomains), a) {
|
|
317
|
+
const h = e.toLowerCase().split(/\/rest(\/admin)?\/services\//)[0];
|
|
318
|
+
n.authentication.federatedServers[h] = {
|
|
319
|
+
token: [],
|
|
320
|
+
// default to 24 hours
|
|
321
|
+
expires: new Date(Date.now() + 86400 * 1e3)
|
|
322
|
+
}, a = null;
|
|
323
|
+
}
|
|
324
|
+
return l;
|
|
325
|
+
} else
|
|
326
|
+
return c;
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function _(e, t = { params: { f: "json" } }) {
|
|
330
|
+
const { request: r } = t, n = x(t, ["request"]);
|
|
331
|
+
return r ? r(e, n) : j(e, n).catch((i) => i instanceof S && t.authentication && typeof t.authentication != "string" && t.authentication.canRefresh && t.authentication.refreshCredentials ? i.retry(() => t.authentication.refreshCredentials(), 1) : Promise.reject(i));
|
|
332
|
+
}
|
|
333
|
+
function Q(e) {
|
|
334
|
+
return typeof e != "string" || (e = e.trim(), e[e.length - 1] === "/" && (e = e.slice(0, -1))), e;
|
|
335
|
+
}
|
|
336
|
+
function P(e = {}) {
|
|
337
|
+
return e.portal ? Q(e.portal) : e.authentication && typeof e.authentication != "string" ? e.authentication.portal : "https://www.arcgis.com/sharing/rest";
|
|
338
|
+
}
|
|
339
|
+
function Y(e) {
|
|
340
|
+
return e.owner ? Promise.resolve(e.owner) : e.item && e.item.owner ? Promise.resolve(e.item.owner) : e.authentication && e.authentication.getUsername ? e.authentication.getUsername() : Promise.reject(new Error("Could not determine the owner of this item. Pass the `owner`, `item.owner`, or `authentication` option."));
|
|
341
|
+
}
|
|
342
|
+
function Z(e) {
|
|
343
|
+
return Array.isArray(e) && Array.isArray(e[0]) && Array.isArray(e[1]);
|
|
344
|
+
}
|
|
345
|
+
function q(e) {
|
|
346
|
+
return e.join(",");
|
|
347
|
+
}
|
|
348
|
+
function X(e, t, r) {
|
|
349
|
+
if (!e)
|
|
350
|
+
return e;
|
|
351
|
+
let n = null;
|
|
352
|
+
return typeof e.thumbnail == "string" && (n = `${t}/content/items/${e.id}/info/${e.thumbnail}`, n && e.access !== "public" && r && (n += `?${r}`)), Object.assign(Object.assign({}, e), n ? { thumbnailUrl: n } : {});
|
|
353
|
+
}
|
|
354
|
+
function ee(e, t) {
|
|
355
|
+
const r = D(e, t), n = Object.assign({ httpMethod: "GET" }, t);
|
|
356
|
+
return _(r, n).then(async (i) => {
|
|
357
|
+
const o = t?.portal || P(t);
|
|
358
|
+
let s;
|
|
359
|
+
if (t?.authentication && typeof t.authentication != "string" && i.access !== "public")
|
|
360
|
+
try {
|
|
361
|
+
s = await t.authentication.getToken(r);
|
|
362
|
+
} catch {
|
|
363
|
+
}
|
|
364
|
+
return X(i, o, s);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
const D = (e, t) => `${typeof t == "string" ? t : P(t)}/content/items/${e}`;
|
|
368
|
+
function te(e, t) {
|
|
369
|
+
const r = `${D(e, t)}/data`, n = Object.assign({ httpMethod: "GET", params: {} }, t);
|
|
370
|
+
return n.file && (n.params.f = null), _(r, n).catch((i) => {
|
|
371
|
+
if (!RegExp(/The string did not match the expected pattern|(Unexpected end of (JSON input|data at line 1 column 1))/i).test(i.message))
|
|
372
|
+
throw i;
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
export {
|
|
376
|
+
x as _,
|
|
377
|
+
X as a,
|
|
378
|
+
q as b,
|
|
379
|
+
V as c,
|
|
380
|
+
Y as d,
|
|
381
|
+
ee as e,
|
|
382
|
+
te as f,
|
|
383
|
+
P as g,
|
|
384
|
+
Z as i,
|
|
385
|
+
_ as r,
|
|
386
|
+
M as w
|
|
387
|
+
};
|