{"version":3,"sources":["node_modules/@arcgis/core/layers/effects/jsonUtils.js"],"sourcesContent":["/*\nAll material copyright ESRI, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/4.31/esri/copyright.txt for details.\n*/\nimport e from \"../../core/Error.js\";\nimport { setDeepValue as t } from \"../../core/object.js\";\nimport { parse as r } from \"./parser.js\";\nimport { isEffectFunctions as s } from \"./utils.js\";\nfunction n(e, t, r) {\n try {\n return c(e);\n } catch (s) {\n r?.messages?.push(s);\n }\n return null;\n}\nfunction a(e, r, s, n) {\n try {\n const n = o(e);\n t(s, n, r);\n } catch (a) {\n n.messages && n.messages.push(a);\n }\n}\nfunction o(e) {\n const t = r(e);\n return t ? s(t) ? t.map(e => e.toJSON()) : t.map(({\n scale: e,\n effects: t\n }) => ({\n scale: e,\n value: t.map(e => e.toJSON())\n })) : null;\n}\nfunction c(e) {\n if (!e || 0 === e.length) return null;\n if (f(e)) {\n const t = [];\n for (const r of e) t.push({\n scale: r.scale,\n value: i(r.value)\n });\n return t;\n }\n return i(e);\n}\nfunction f(e) {\n const t = e[0];\n return !!t && \"scale\" in t;\n}\nfunction i(e) {\n if (!e?.length) return \"\";\n const t = [];\n for (const s of e) {\n let e = [];\n switch (s.type) {\n case \"grayscale\":\n case \"sepia\":\n case \"saturate\":\n case \"invert\":\n case \"brightness\":\n case \"contrast\":\n case \"opacity\":\n e = [u(s, \"amount\")];\n break;\n case \"blur\":\n e = [u(s, \"radius\", \"pt\")];\n break;\n case \"hue-rotate\":\n e = [u(s, \"angle\", \"deg\")];\n break;\n case \"drop-shadow\":\n e = [u(s, \"xoffset\", \"pt\"), u(s, \"yoffset\", \"pt\"), u(s, \"blurRadius\", \"pt\"), l(s, \"color\")];\n break;\n case \"bloom\":\n e = [u(s, \"strength\"), u(s, \"radius\", \"pt\"), u(s, \"threshold\")];\n }\n const n = `${s.type}(${e.filter(Boolean).join(\" \")})`;\n r(n), t.push(n);\n }\n return t.join(\" \");\n}\nfunction u(t, r, s) {\n if (null == t[r]) throw new e(\"effect:missing-parameter\", `Missing parameter '${r}' in ${t.type} effect`, {\n effect: t\n });\n return s ? t[r] + s : \"\" + t[r];\n}\nfunction l(t, r) {\n if (null == t[r]) throw new e(\"effect:missing-parameter\", `Missing parameter '${r}' in ${t.type} effect`, {\n effect: t\n });\n const s = t[r];\n return `rgba(${s[0] || 0}, ${s[1] || 0}, ${s[2] || 0}, ${s[3] / 255 || 0})`;\n}\nexport { i as effectFunctionsFromJSON, c as fromJSON, n as read, o as toJSON, a as write };"],"mappings":"0HAQA,SAASA,EAAEC,EAAGC,EAAGC,EAAG,CAClB,GAAI,CACF,OAAOC,EAAEH,CAAC,CACZ,OAASI,EAAG,CACVF,GAAG,UAAU,KAAKE,CAAC,CACrB,CACA,OAAO,IACT,CACA,SAASC,EAAEL,EAAGE,EAAGE,EAAGL,EAAG,CACrB,GAAI,CACF,IAAMA,EAAIO,EAAEN,CAAC,EACbA,EAAEI,EAAGL,EAAGG,CAAC,CACX,OAASG,EAAG,CACVN,EAAE,UAAYA,EAAE,SAAS,KAAKM,CAAC,CACjC,CACF,CACA,SAASC,EAAEN,EAAG,CACZ,IAAMC,EAAIM,EAAEP,CAAC,EACb,OAAOC,EAAIO,EAAEP,CAAC,EAAIA,EAAE,IAAI,GAAK,EAAE,OAAO,CAAC,EAAIA,EAAE,IAAI,CAAC,CAChD,MAAO,EACP,QAASA,CACX,KAAO,CACL,MAAO,EACP,MAAOA,EAAE,IAAID,GAAKA,EAAE,OAAO,CAAC,CAC9B,EAAE,EAAI,IACR,CACA,SAASG,EAAEH,EAAG,CACZ,GAAI,CAACA,GAAWA,EAAE,SAAR,EAAgB,OAAO,KACjC,GAAIS,EAAET,CAAC,EAAG,CACR,IAAMC,EAAI,CAAC,EACX,QAAWC,KAAKF,EAAGC,EAAE,KAAK,CACxB,MAAOC,EAAE,MACT,MAAOQ,EAAER,EAAE,KAAK,CAClB,CAAC,EACD,OAAOD,CACT,CACA,OAAOS,EAAEV,CAAC,C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