import { l } from "./chunk-ICWTATWH.js"; import { y4 as y2 } from "./chunk-2Z2TG5CU.js"; import { s3 as s } from "./chunk-E5O6P5I2.js"; import { t, y } from "./chunk-SPWQ3AWG.js"; import { r } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/webdoc/support/writeUtils.js var l2 = /* @__PURE__ */ new Set(["bing-maps", "imagery", "imagery-tile", "map-image", "open-street-map", "tile", "unknown", "unsupported", "vector-tile", "web-tile", "wms", "wmts"]); var a = /* @__PURE__ */ new Set(["csv", "feature", "geo-rss", "geojson", "group", "imagery", "imagery-tile", "kml", "map-image", "map-notes", "ogc-feature", "route", "subtype-group", "tile", "unknown", "unsupported", "vector-tile", "web-tile", "wfs", "wms", "wmts"]); function m(e) { return "basemap" === e.layerContainerType ? l2 : "operational-layers" === e.layerContainerType ? a : null; } function c(e, t2) { if (t2.restrictedWebMapWriting) { const r2 = m(t2); return !r(r2) || r2.has(e.type) && !l(e); } return true; } function u(e, t2) { if (l(e)) { const n = t("featureCollection.layers", t2), i = n && n[0] && n[0].layerDefinition; i && d(e, i); } else if ("stream" === e.type) { d(e, t2.layerDefinition = t2.layerDefinition || {}); } else "group" !== e.type && d(e, t2); } function d(e, t2) { "maxScale" in e && (t2.maxScale = y2(e.maxScale)), "minScale" in e && (t2.minScale = y2(e.minScale)); } function f(e, t2) { if (u(e, t2), "blendMode" in e && (t2.blendMode = e.blendMode, "normal" === t2.blendMode && delete t2.blendMode), t2.opacity = y2(e.opacity), t2.title = e.title || "Layer", t2.visibility = e.visible, "legendEnabled" in e && "wmts" !== e.type) if (l(e)) { const n = t2.featureCollection; n && (n.showLegend = e.legendEnabled); } else t2.showLegend = e.legendEnabled; } function y3(r2, i, o) { if (!("write" in r2) || !r2.write) return o && o.messages && o.messages.push(new s("layer:unsupported", `Layers (${r2.title}, ${r2.id}) of type '${r2.declaredClass}' cannot be persisted`, { layer: r2 })), null; if (c(r2, o)) { const e = {}; return r2.write(e, o) ? e : null; } return r(i) && f(r2, i = y(i)), i; } export { y3 as y }; //# sourceMappingURL=chunk-QRRIN2JN.js.map