chunk-65BYCSII.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import {
  2. F,
  3. K,
  4. Q,
  5. X,
  6. _,
  7. b,
  8. vt,
  9. z
  10. } from "./chunk-VBRY5KJM.js";
  11. import {
  12. r
  13. } from "./chunk-GZT4BVFP.js";
  14. // node_modules/@arcgis/core/chunks/persistableUrlUtils.js
  15. function i(e, o) {
  16. const s = o && o.url && o.url.path;
  17. if (e && s && (e = Q(e, s, { preserveProtocolRelative: true }), o.portalItem && o.readResourcePaths)) {
  18. const r2 = _(e, o.portalItem.itemUrl);
  19. v.test(r2) && o.readResourcePaths.push(o.portalItem.resourceFromPath(r2).path);
  20. }
  21. return y(e, o && o.portal);
  22. }
  23. function c(e, a, u = I.YES) {
  24. if (!e)
  25. return e;
  26. !K(e) && a && a.blockedRelativeUrls && a.blockedRelativeUrls.push(e);
  27. let n = Q(e);
  28. if (a) {
  29. const r2 = a.verifyItemRelativeUrls && a.verifyItemRelativeUrls.rootPath || a.url && a.url.path;
  30. if (r2) {
  31. const o = y(r2, a.portal);
  32. n = _(y(n, a.portal), o, o), n !== e && a.verifyItemRelativeUrls && a.verifyItemRelativeUrls.writtenUrls.push(n);
  33. }
  34. }
  35. return n = U(n, a && a.portal), K(n) && (n = F(n)), a?.resources && a?.portalItem && !K(n) && !X(n) && u === I.YES && a.resources.toKeep.push({ resource: a.portalItem.resourceFromPath(n) }), n;
  36. }
  37. function m(e, r2, t) {
  38. return i(e, t);
  39. }
  40. function p(e, r2, t, o) {
  41. const s = c(e, o);
  42. s !== void 0 && (r2[t] = s);
  43. }
  44. var f = /\/items\/([^\/]+)\/resources\//;
  45. var v = /^\.\/resources\//;
  46. function h(r2) {
  47. const t = r(r2) ? r2.match(f) : null;
  48. return r(t) ? t[1] : null;
  49. }
  50. function U(e, r2) {
  51. return r2 && !r2.isPortal && r2.urlKey && r2.customBaseUrl ? vt(e, `${r2.urlKey}.${r2.customBaseUrl}`, r2.portalHostname) : e;
  52. }
  53. function y(e, r2) {
  54. if (!r2 || r2.isPortal || !r2.urlKey || !r2.customBaseUrl)
  55. return e;
  56. const t = `${r2.urlKey}.${r2.customBaseUrl}`, o = b();
  57. return z(o, `${o.scheme}://${t}`) ? vt(e, r2.portalHostname, t) : vt(e, t, r2.portalHostname);
  58. }
  59. var I;
  60. !function(e) {
  61. e[e.YES = 0] = "YES", e[e.NO = 1] = "NO";
  62. }(I || (I = {}));
  63. var R = Object.freeze(Object.defineProperty({ __proto__: null, fromJSON: i, toJSON: c, read: m, write: p, itemIdFromResourceUrl: h, ensureMainOnlineDomain: U, get MarkKeep() {
  64. return I;
  65. } }, Symbol.toStringTag, { value: "Module" }));
  66. export {
  67. i,
  68. c,
  69. m,
  70. p,
  71. h,
  72. U,
  73. I,
  74. R
  75. };
  76. //# sourceMappingURL=chunk-65BYCSII.js.map