import { Et, F, K, Lt, Q, X, _, b, z } from "./chunk-VEGAOVMY.js"; import { e } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/chunks/persistableUrlUtils.js function c(e2, o) { const l = o && o.url && o.url.path; if (e2 && l && (e2 = Q(e2, l, { preserveProtocolRelative: true }), o.portalItem && o.readResourcePaths)) { const r = _(e2, o.portalItem.itemUrl); null != r && v.test(r) && o.readResourcePaths.push(o.portalItem.resourceFromPath(r).path); } return I(e2, o && o.portal); } function m(e2, n, a = R.YES) { if (null == e2) return e2; !K(e2) && n && n.blockedRelativeUrls && n.blockedRelativeUrls.push(e2); let u = Q(e2); if (n) { const r = n.verifyItemRelativeUrls && n.verifyItemRelativeUrls.rootPath || n.url && n.url.path; if (r) { const o = I(r, n.portal); u = _(I(u, n.portal), o, o), null != u && u !== e2 && n.verifyItemRelativeUrls && n.verifyItemRelativeUrls.writtenUrls.push(u); } } return u = y(u, n == null ? void 0 : n.portal), K(u) && (u = F(u)), (n == null ? void 0 : n.resources) && (n == null ? void 0 : n.portalItem) && !K(u) && !X(u) && a === R.YES && n.resources.toKeep.push({ resource: n.portalItem.resourceFromPath(u), compress: false }), u; } function p(e2, r, t) { return c(e2, t); } function f(e2, r, t, o) { const l = m(e2, o); void 0 !== l && (r[t] = l); } var h = /\/items\/([^\/]+)\/resources\/(.*)/; var v = /^\.\/resources\//; function U(e2) { var _a, _b, _c; return (_c = (_b = (_a = e2 == null ? void 0 : e2.match(h)) != null ? _a : null) == null ? void 0 : _b[1]) != null ? _c : null; } function d(r) { var _a; const t = (_a = r == null ? void 0 : r.match(h)) != null ? _a : null; if (null == t) return null; const o = t[2], l = o.lastIndexOf("/"); if (-1 === l) { const { path: r2, extension: t2 } = Et(o); return { prefix: null, filename: r2, extension: e(t2) }; } const { path: s, extension: a } = Et(o.slice(l + 1)); return { prefix: o.slice(0, l), filename: s, extension: e(a) }; } function y(e2, r) { return r && !r.isPortal && r.urlKey && r.customBaseUrl ? Lt(e2, `${r.urlKey}.${r.customBaseUrl}`, r.portalHostname) : e2; } function I(e2, r) { if (!r || r.isPortal || !r.urlKey || !r.customBaseUrl) return e2; const t = `${r.urlKey}.${r.customBaseUrl}`, o = b(); return z(o, `${o.scheme}://${t}`) ? Lt(e2, r.portalHostname, t) : Lt(e2, t, r.portalHostname); } var R; !function(e2) { e2[e2.YES = 0] = "YES", e2[e2.NO = 1] = "NO"; }(R || (R = {})); var x = Object.freeze(Object.defineProperty({ __proto__: null, fromJSON: c, toJSON: m, read: p, write: f, itemIdFromResourceUrl: U, prefixAndFilenameFromResourceUrl: d, ensureMainOnlineDomain: y, get MarkKeep() { return R; } }, Symbol.toStringTag, { value: "Module" })); export { c, m, p, f, U, d, y, R, x }; //# sourceMappingURL=chunk-4ONPMX2F.js.map