import { f } from "./chunk-4ONPMX2F.js"; import { At, Ct, G, j } from "./chunk-VEGAOVMY.js"; import { r, t } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/layers/support/arcgisLayerUrl.js var c = { mapserver: "MapServer", imageserver: "ImageServer", featureserver: "FeatureServer", sceneserver: "SceneServer", streamserver: "StreamServer", vectortileserver: "VectorTileServer" }; var a = Object.values(c); var f2 = new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`, "i"); var v = new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`, "i"); var p = /(.*?)\/(?:layers\/)?(\d+)\/?$/i; function d(e) { return !!f2.test(e); } function m(r2) { if (t(r2)) return null; const n = j(r2), s = n.path.match(f2) || n.path.match(v); if (!s) return null; const [, l, u, i, o] = s, a2 = u.indexOf("/"); return { title: h(-1 !== a2 ? u.slice(a2 + 1) : u), serverType: c[i.toLowerCase()], sublayer: null != o && "" !== o ? parseInt(o, 10) : null, url: { path: l } }; } function w(e) { const r2 = j(e).path.match(p); return r2 ? { serviceUrl: r2[1], sublayerId: Number(r2[2]) } : null; } function h(e) { return (e = e.replace(/\s*[/_]+\s*/g, " "))[0].toUpperCase() + e.slice(1); } function y2(e, t2) { const n = []; if (e) { const t3 = m(e); r(t3) && t3.title && n.push(t3.title); } if (t2) { const e2 = h(t2); n.push(e2); } if (2 === n.length) { if (n[0].toLowerCase().includes(n[1].toLowerCase())) return n[0]; if (n[1].toLowerCase().includes(n[0].toLowerCase())) return n[1]; } return n.join(" - "); } function g(e) { if (!e) return false; const r2 = ".arcgis.com/", t2 = "//services", n = "//tiles", s = "//features", l = (e = e.toLowerCase()).includes(r2), u = e.includes(t2) || e.includes(n) || e.includes(s); return l && u; } function S(e, r2) { return e ? Ct(At(e, r2)) : e; } function L(e) { let { url: l } = e; if (!l) return { url: l }; l = At(l, e.logger); const u = j(l), i = m(u.path); let o; if (r(i)) null != i.sublayer && null == e.layer.layerId && (o = i.sublayer), l = i.url.path; else if (e.nonStandardUrlAllowed) { const e2 = w(u.path); r(e2) && (l = e2.serviceUrl, o = e2.sublayerId); } return { url: Ct(l), layerId: o }; } function b(e, r2, t2, n, s) { f(r2, n, "url", s), n.url && null != e.layerId && (n.url = G(n.url, t2, e.layerId.toString())); } function I(e) { if (!e) return false; const r2 = e.toLowerCase(), t2 = r2.includes("/services/"), n = r2.includes("/mapserver/wmsserver"), s = r2.includes("/imageserver/wmsserver"), l = r2.includes("/wmsserver"); return t2 && (n || s || l); } export { d, m, w, h, y2 as y, g, S, L, b, I }; //# sourceMappingURL=chunk-SZFMKPVM.js.map