import { o } from "./chunk-5IVP3KUS.js"; import { h as h2 } from "./chunk-DX5KJRJR.js"; import { d, e as e2, t } from "./chunk-K3NLQPKD.js"; import { f, h, y } from "./chunk-I26BWYY3.js"; import "./chunk-NDUYF7XW.js"; import "./chunk-JEA4MMTV.js"; import "./chunk-RG3AHHRL.js"; import "./chunk-XHRNCFJT.js"; import "./chunk-OKUFE7TO.js"; import "./chunk-GZBNC76D.js"; import "./chunk-3Z755LKF.js"; import "./chunk-LTZ5XXDV.js"; import "./chunk-DLMAGHHC.js"; import "./chunk-JOYXMSKE.js"; import "./chunk-ECY35CJI.js"; import "./chunk-PT62335L.js"; import "./chunk-MCWCB5IY.js"; import "./chunk-4ONPMX2F.js"; import "./chunk-CRGY2SDS.js"; import "./chunk-4T5ZGMEN.js"; import "./chunk-3OSQ6GXO.js"; import "./chunk-3WQOA5CB.js"; import "./chunk-FZQZIM7U.js"; import "./chunk-CZBRZ6SU.js"; import "./chunk-VGWC3IKZ.js"; import "./chunk-2H5MD622.js"; import { e, u } from "./chunk-UVVU4UUO.js"; import { l } from "./chunk-X4SA4ELJ.js"; import "./chunk-5N7JLUJJ.js"; import "./chunk-ZAY3CMAZ.js"; import "./chunk-P3XKUGLS.js"; import "./chunk-2ZSOO377.js"; import "./chunk-LU5IJZB4.js"; import "./chunk-7IBV2TRE.js"; import "./chunk-ZLNEXZAN.js"; import "./chunk-5UVJ64RB.js"; import "./chunk-SFEFRQCL.js"; import "./chunk-ZYRIJWLX.js"; import "./chunk-RYY6632W.js"; import "./chunk-DW42UVIT.js"; import "./chunk-YAEIHDJH.js"; import "./chunk-TJNOJH33.js"; import "./chunk-OSHI574D.js"; import "./chunk-ETGAZ7LF.js"; import "./chunk-75U5LM2V.js"; import "./chunk-RMDDCMKS.js"; import "./chunk-VCH45Q2I.js"; import "./chunk-LBW34VZ2.js"; import "./chunk-GSSTTHIT.js"; import "./chunk-YFSLJIO4.js"; import "./chunk-IM3LVQXV.js"; import "./chunk-55RWC67C.js"; import "./chunk-HZRKBTHJ.js"; import "./chunk-DVUG3KID.js"; import "./chunk-FWSQEIAR.js"; import "./chunk-VEGAOVMY.js"; import "./chunk-6T6G6LCQ.js"; import "./chunk-YEJL5NEF.js"; import "./chunk-PQFTYGF5.js"; import "./chunk-2Z2TG5CU.js"; import "./chunk-6KZ2LTDA.js"; import "./chunk-U2XHEJM7.js"; import "./chunk-SQOPWYIT.js"; import "./chunk-V6P2MAQQ.js"; import { s3 as s } from "./chunk-E5O6P5I2.js"; import "./chunk-SPWQ3AWG.js"; import "./chunk-2TIUKVZN.js"; import "./chunk-YXWMMD76.js"; import "./chunk-S5KM4IGW.js"; // node_modules/@arcgis/core/views/support/colorUtils.js function e3(r2) { let { r: n, g: a, b: o2, a: e4 } = r2; return e4 < 1 && (n = Math.round(e4 * n + 255 * (1 - e4)), a = Math.round(e4 * a + 255 * (1 - e4)), o2 = Math.round(e4 * o2 + 255 * (1 - e4))), new l({ r: n, g: a, b: o2 }); } function u2(t2) { const { r: r2, g: n, b: a } = e3(t2); return 0.2126 * r2 + 0.7152 * n + 0.0722 * a; } // node_modules/@arcgis/core/symbols/support/previewSymbol2D.js var p = "picture-fill"; var d2 = "picture-marker"; var f2 = "simple-fill"; var y2 = "simple-line"; var w = "simple-marker"; var g = "text"; var v = "Aa"; var b = t.size; var x = t.maxSize; var k = t.maxOutlineSize; var M = t.lineWidth; var z = 225; var L = document.createElement("canvas"); function j(e4, t2) { const a = L.getContext("2d"), n = []; return t2 && (t2.weight && n.push(t2.weight), t2.size && n.push(t2.size + "px"), t2.family && n.push(t2.family)), a.font = n.join(" "), a.measureText(e4).width; } var C = 7.2 / 2.54; var S = 72 / 2.54; function F(e4) { if (0 === e4.length) return 0; if (e4.length > 2) { const t2 = e(1), a = parseFloat(e4); switch (e4.slice(-2)) { case "px": return a; case "pt": return a * t2; case "in": return 72 * a * t2; case "pc": return 12 * a * t2; case "mm": return a * C * t2; case "cm": return a * S * t2; } } return parseFloat(e4); } function E(e4) { const t2 = e4 == null ? void 0 : e4.size; return { width: null != t2 && "object" == typeof t2 && "width" in t2 ? u(t2.width) : null, height: null != t2 && "object" == typeof t2 && "height" in t2 ? u(t2.height) : null }; } async function U(e4, t2) { const a = t2.fill, n = e4.color; if ("pattern" === (a == null ? void 0 : a.type) && n && e4.type !== p) { const e5 = await h(a.src, n.toCss(true)); a.src = e5, t2.fill = a; } } async function Z(e4, t2, n, l2) { if (!("font" in e4) || !e4.font || "text" !== t2.shape.type) return; try { await o(e4.font); } catch { } const { width: i } = E(l2), s2 = /[\uE600-\uE6FF]/.test(t2.shape.text); null != i || s2 || (n[0] = j(t2.shape.text, { weight: t2.font.weight, size: t2.font.size, family: t2.font.family })); } function q(e4, t2) { return e4 > t2 ? "dark" : "light"; } function D(e4, t2) { var _a; const a = "number" == typeof (t2 == null ? void 0 : t2.size) ? t2 == null ? void 0 : t2.size : null, l2 = null != a ? u(a) : null, o2 = null != (t2 == null ? void 0 : t2.maxSize) ? u(t2.maxSize) : null, r2 = null != (t2 == null ? void 0 : t2.rotation) ? t2.rotation : "angle" in e4 ? e4.angle : null, m = f(e4); let u3 = y(e4); "dark" !== T(e4, 245) || (t2 == null ? void 0 : t2.ignoreWhiteSymbols) || (u3 = { width: 0.75, ...u3, color: "#bdc3c7" }); const h3 = { shape: null, fill: m, stroke: u3, offset: [0, 0] }; (u3 == null ? void 0 : u3.width) && (u3.width = Math.min(u3.width, k)); const z2 = (u3 == null ? void 0 : u3.width) || 0; let L2 = null != (t2 == null ? void 0 : t2.size) && (null == (t2 == null ? void 0 : t2.scale) || (t2 == null ? void 0 : t2.scale)), C2 = 0, S2 = 0, U2 = false; switch (e4.type) { case w: { const a2 = e4.style, { width: i, height: s2 } = E(t2), c = i === s2 && null != i ? i : null != l2 ? l2 : Math.min(u(e4.size), o2 || x); switch (C2 = c, S2 = c, a2) { case "circle": h3.shape = { type: "circle", cx: 0, cy: 0, r: 0.5 * c }, L2 || (C2 += z2, S2 += z2); break; case "cross": h3.shape = { type: "path", path: [{ command: "M", values: [0, 0.5 * S2] }, { command: "L", values: [C2, 0.5 * S2] }, { command: "M", values: [0.5 * C2, 0] }, { command: "L", values: [0.5 * C2, S2] }] }; break; case "diamond": h3.shape = { type: "path", path: [{ command: "M", values: [0, 0.5 * S2] }, { command: "L", values: [0.5 * C2, 0] }, { command: "L", values: [C2, 0.5 * S2] }, { command: "L", values: [0.5 * C2, S2] }, { command: "Z", values: [] }] }, L2 || (C2 += z2, S2 += z2); break; case "square": h3.shape = { type: "path", path: [{ command: "M", values: [0, 0] }, { command: "L", values: [C2, 0] }, { command: "L", values: [C2, S2] }, { command: "L", values: [0, S2] }, { command: "Z", values: [] }] }, L2 || (C2 += z2, S2 += z2), r2 && (U2 = true); break; case "triangle": h3.shape = { type: "path", path: [{ command: "M", values: [0.5 * C2, 0] }, { command: "L", values: [C2, S2] }, { command: "L", values: [0, S2] }, { command: "Z", values: [] }] }, L2 || (C2 += z2, S2 += z2), r2 && (U2 = true); break; case "x": h3.shape = { type: "path", path: [{ command: "M", values: [0, 0] }, { command: "L", values: [C2, S2] }, { command: "M", values: [C2, 0] }, { command: "L", values: [0, S2] }] }, r2 && (U2 = true); break; case "path": h3.shape = { type: "path", path: e4.path || "" }, L2 || (C2 += z2, S2 += z2), r2 && (U2 = true), L2 = true; } break; } case y2: { const { width: e5, height: a2 } = E(t2), n = null != a2 ? a2 : null != l2 ? l2 : z2, i = null != e5 ? e5 : M; u3 && (u3.width = n), C2 = i, S2 = n; const s2 = ((_a = h3 == null ? void 0 : h3.stroke) == null ? void 0 : _a.cap) || "butt", o3 = "round" === s2; L2 = true, h3.stroke && (h3.stroke.cap = "butt" === s2 ? "square" : s2), h3.shape = { type: "path", path: [{ command: "M", values: [o3 ? n / 2 : 0, S2 / 2] }, { command: "L", values: [o3 ? C2 - n / 2 : C2, S2 / 2] }] }; break; } case p: case f2: { const e5 = "object" == typeof (t2 == null ? void 0 : t2.symbolConfig) && (t2 == null ? void 0 : t2.symbolConfig.isSquareFill), { width: a2, height: n } = E(t2); C2 = !e5 && a2 !== n || null == a2 ? null != l2 ? l2 : b : a2, S2 = !e5 && a2 !== n || null == n ? C2 : n, L2 || (C2 += z2, S2 += z2), L2 = true, h3.shape = e5 ? { type: "path", path: [{ command: "M", values: [0, 0] }, { command: "L", values: [C2, 0] }, { command: "L", values: [C2, S2] }, { command: "L", values: [0, S2] }, { command: "L", values: [0, 0] }, { command: "Z", values: [] }] } : e2.fill[0]; break; } case d2: { const a2 = Math.min(u(e4.width), o2 || x), i = Math.min(u(e4.height), o2 || x), { width: s2, height: c } = E(t2), m2 = s2 === c && null != s2 ? s2 : null != l2 ? l2 : Math.max(a2, i), u4 = a2 / i; C2 = u4 <= 1 ? Math.ceil(m2 * u4) : m2, S2 = u4 <= 1 ? m2 : Math.ceil(m2 / u4), h3.shape = { type: "image", x: -Math.round(C2 / 2), y: -Math.round(S2 / 2), width: C2, height: S2, src: e4.url || "" }, r2 && (U2 = true); break; } case g: { const a2 = e4, i = (t2 == null ? void 0 : t2.overrideText) || a2.text || v, s2 = a2.font, { width: r3, height: c } = E(t2), m2 = null != c ? c : null != l2 ? l2 : Math.min(u(s2.size), o2 || x), u4 = j(i, { weight: s2.weight, size: m2, family: s2.family }), p2 = /[\uE600-\uE6FF]/.test(i); C2 = r3 != null ? r3 : p2 ? m2 : u4, S2 = m2; let d3 = 0.25 * F((s2 ? m2 : 0).toString()); p2 && (d3 += 5), h3.shape = { type: "text", text: i, x: a2.xoffset || 0, y: a2.yoffset || d3, align: "middle", alignBaseline: a2.verticalAlignment, decoration: s2 && s2.decoration, rotated: a2.rotated, kerning: a2.kerning }, h3.font = s2 && { size: m2, style: s2.style, decoration: s2.decoration, weight: s2.weight, family: s2.family }; break; } } return { shapeDescriptor: h3, size: [C2, S2], renderOptions: { node: t2 == null ? void 0 : t2.node, scale: L2, opacity: t2 == null ? void 0 : t2.opacity, rotation: r2, useRotationSize: U2, effectView: t2 == null ? void 0 : t2.effectView } }; } async function O(e4, a) { const { shapeDescriptor: n, size: l2, renderOptions: i } = D(e4, a); if (!n.shape) throw new s("symbolPreview: renderPreviewHTML2D", "symbol not supported."); await U(e4, n), await Z(e4, n, l2, a); const s2 = [[n]]; if ("object" == typeof (a == null ? void 0 : a.symbolConfig) && (a == null ? void 0 : a.symbolConfig.applyColorModulation)) { const e5 = 0.6 * l2[0]; s2.unshift([{ ...n, offset: [-e5, 0], fill: d(n.fill, -0.3) }]), s2.push([{ ...n, offset: [e5, 0], fill: d(n.fill, 0.3) }]), l2[0] += 2 * e5, i.scale = false; } return h2(s2, l2, i); } function T(t2, a = z) { const n = f(t2), l2 = y(t2), o2 = !n || "type" in n ? null : new l(n), r2 = (l2 == null ? void 0 : l2.color) ? new l(l2 == null ? void 0 : l2.color) : null, c = o2 ? q(u2(o2), a) : null, m = r2 ? q(u2(r2), a) : null; return m ? c ? c === m ? c : a >= z ? "light" : "dark" : m : c; } export { T as getContrastingBackgroundTheme, D as getRenderSymbolParameters, O as previewSymbol2D }; //# sourceMappingURL=previewSymbol2D-OWVXJGGW.js.map