chunk-IN44RUPP.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import {
  2. i
  3. } from "./chunk-IZUZZJS7.js";
  4. import {
  5. n
  6. } from "./chunk-I4RYNNL6.js";
  7. import {
  8. R,
  9. U,
  10. d as d2,
  11. m,
  12. p,
  13. x
  14. } from "./chunk-4ONPMX2F.js";
  15. import {
  16. G,
  17. K,
  18. V,
  19. kt
  20. } from "./chunk-VEGAOVMY.js";
  21. import {
  22. d,
  23. s,
  24. t3 as t
  25. } from "./chunk-2Z2TG5CU.js";
  26. // node_modules/@arcgis/core/portal/support/resourceExtension.js
  27. function t2(i2) {
  28. return o[p2(i2)] || e;
  29. }
  30. function p2(i2) {
  31. return i2 instanceof Blob ? i2.type : n2(i2.url);
  32. }
  33. function n2(t3) {
  34. const p3 = kt(t3);
  35. return g[p3] || a;
  36. }
  37. var o = {};
  38. var a = "text/plain";
  39. var e = o[a];
  40. var g = { png: "image/png", jpeg: "image/jpeg", jpg: "image/jpg", bmp: "image/bmp", gif: "image/gif", json: "application/json", txt: "text/plain", xml: "application/xml", svg: "image/svg+xml", zip: "application/zip", pbf: "application/vnd.mapbox-vector-tile", gz: "application/gzip", "bin.gz": "application/octet-stream" };
  41. for (const c in g)
  42. o[g[c]] = c;
  43. // node_modules/@arcgis/core/core/accessorSupport/decorators/persistable.js
  44. function g2(t3) {
  45. var _a;
  46. const r = (_a = t3 == null ? void 0 : t3.origins) != null ? _a : [void 0];
  47. return (e2, o2) => {
  48. const s2 = h(t3, e2, o2);
  49. for (const t4 of r) {
  50. const r2 = d(e2, t4, o2);
  51. for (const t5 in s2)
  52. r2[t5] = s2[t5];
  53. }
  54. };
  55. }
  56. function h(t3, r, e2) {
  57. var _a;
  58. if ("resource" === (t3 == null ? void 0 : t3.type))
  59. return v(t3, r, e2);
  60. switch ((_a = t3 == null ? void 0 : t3.type) != null ? _a : "other") {
  61. case "other":
  62. return { read: true, write: true };
  63. case "url": {
  64. const { read: t4, write: r2 } = x;
  65. return { read: t4, write: r2 };
  66. }
  67. }
  68. }
  69. function v(o2, s2, n3) {
  70. const p3 = s(s2, n3);
  71. return { type: String, read: (t3, r, e2) => {
  72. const o3 = p(t3, r, e2);
  73. return p3.type === String ? o3 : "function" == typeof p3.type ? new p3.type({ url: o3 }) : void 0;
  74. }, write: { writer(s3, i2, u, c) {
  75. if (!c || !c.resources)
  76. return "string" == typeof s3 ? void (i2[u] = m(s3, c)) : void (i2[u] = s3.write({}, c));
  77. const y = x2(s3), d3 = m(y, { ...c, verifyItemRelativeUrls: c && c.verifyItemRelativeUrls ? { writtenUrls: c.verifyItemRelativeUrls.writtenUrls, rootPath: void 0 } : void 0 }, R.NO), g3 = p3.type !== String && (!i(this) || c && c.origin && this.originIdOf(n3) > t(c.origin)), h2 = { object: this, propertyName: n3, value: s3, targetUrl: d3, dest: i2, targetPropertyName: u, context: c, params: o2 };
  78. c && c.portalItem && d3 && !K(d3) ? g3 ? w(h2) : j(h2) : c && c.portalItem && (null == d3 || null != U(d3) || V(d3) || g3) ? U2(h2) : i2[u] = d3;
  79. } } };
  80. }
  81. function U2(t3) {
  82. var _a, _b, _c;
  83. const { targetUrl: r, params: s2, value: i2, context: a2, dest: p3, targetPropertyName: c } = t3;
  84. if (!a2.portalItem)
  85. return;
  86. const l = d2(r), m2 = (_a = l == null ? void 0 : l.filename) != null ? _a : n(), f = (_b = s2 == null ? void 0 : s2.prefix) != null ? _b : l == null ? void 0 : l.prefix, d3 = N(i2, r, a2), g3 = G(f, m2), h2 = `${g3}.${t2(d3)}`, v2 = a2.portalItem.resourceFromPath(h2);
  87. V(r) && a2.resources && a2.resources.pendingOperations.push(P(r).then((t4) => {
  88. v2.path = `${g3}.${t2(t4)}`, p3[c] = v2.itemRelativeUrl;
  89. }).catch(() => {
  90. }));
  91. const U3 = (_c = s2 == null ? void 0 : s2.compress) != null ? _c : false;
  92. a2.resources && I({ ...t3, resource: v2, content: d3, compress: U3, updates: a2.resources.toAdd }), p3[c] = v2.itemRelativeUrl;
  93. }
  94. function w(t3) {
  95. var _a;
  96. const { context: r, targetUrl: e2, params: o2, value: n3, dest: i2, targetPropertyName: a2 } = t3;
  97. if (!r.portalItem)
  98. return;
  99. const p3 = r.portalItem.resourceFromPath(e2), c = N(n3, e2, r), l = t2(c), m2 = kt(p3.path), f = (_a = o2 == null ? void 0 : o2.compress) != null ? _a : false;
  100. l === m2 ? (r.resources && I({ ...t3, resource: p3, content: c, compress: f, updates: r.resources.toUpdate }), i2[a2] = e2) : U2(t3);
  101. }
  102. function j({ context: t3, targetUrl: r, dest: e2, targetPropertyName: o2 }) {
  103. t3.portalItem && t3.resources && (t3.resources.toKeep.push({ resource: t3.portalItem.resourceFromPath(r), compress: false }), e2[o2] = r);
  104. }
  105. function I({ object: t3, propertyName: r, updates: e2, resource: o2, content: s2, compress: n3 }) {
  106. e2.push({ resource: o2, content: s2, compress: n3, finish: (e3) => {
  107. O(t3, r, e3);
  108. } });
  109. }
  110. function N(t3, r, e2) {
  111. return "string" == typeof t3 ? { url: r } : new Blob([JSON.stringify(t3.toJSON(e2))], { type: "application/json" });
  112. }
  113. async function P(t3) {
  114. const r = (await import("./request-TKJSZZ4X.js")).default, { data: e2 } = await r(t3, { responseType: "blob" });
  115. return e2;
  116. }
  117. function x2(t3) {
  118. return null == t3 ? null : "string" == typeof t3 ? t3 : t3.url;
  119. }
  120. function O(t3, r, e2) {
  121. "string" == typeof t3[r] ? t3[r] = e2.url : t3[r].url = e2.url;
  122. }
  123. export {
  124. g2 as g
  125. };
  126. //# sourceMappingURL=chunk-IN44RUPP.js.map