{"version":3,"sources":["node_modules/@arcgis/core/layers/support/labelUtils.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 { replace as e } from \"../../core/string.js\";\nconst n = \"__begin__\",\n r = \"__end__\",\n s = new RegExp(n, \"ig\"),\n t = new RegExp(r, \"ig\"),\n l = new RegExp(\"^\" + n, \"i\"),\n o = new RegExp(r + \"$\", \"i\"),\n i = '\"',\n a = i + \" + \",\n c = \" + \" + i;\nfunction p(e) {\n return e.replaceAll(new RegExp(\"\\\\[\", \"g\"), \"{\").replaceAll(new RegExp(\"\\\\]\", \"g\"), \"}\");\n}\nfunction u(e) {\n return e.replaceAll(new RegExp(\"\\\\{\", \"g\"), \"[\").replaceAll(new RegExp(\"\\\\}\", \"g\"), \"]\");\n}\nfunction x(e) {\n const n = {\n expression: \"\",\n type: \"none\"\n };\n return e.labelExpressionInfo ? e.labelExpressionInfo.value ? (n.expression = e.labelExpressionInfo.value, n.type = \"conventional\") : e.labelExpressionInfo.expression && (n.expression = e.labelExpressionInfo.expression, n.type = \"arcade\") : null != e.labelExpression && (n.expression = p(e.labelExpression), n.type = \"conventional\"), n;\n}\nfunction f(e) {\n const n = x(e);\n if (!n) return null;\n switch (n.type) {\n case \"conventional\":\n return E(n.expression);\n case \"arcade\":\n return n.expression;\n }\n return null;\n}\nfunction g(e) {\n const n = x(e);\n if (!n) return null;\n switch (n.type) {\n case \"conventional\":\n return $(n.expression);\n case \"arcade\":\n return _(n.expression);\n }\n return null;\n}\nfunction E(p) {\n let u;\n return p ? (u = e(p, e => n + '$feature[\"' + e + '\"]' + r), u = l.test(u) ? u.replace(l, \"\") : i + u, u = o.test(u) ? u.replace(o, \"\") : u + i, u = u.replaceAll(s, a).replaceAll(t, c)) : u = '\"\"', u;\n}\nconst w = /^\\s*\\{([^}]+)\\}\\s*$/i;\nfunction $(e) {\n const n = e?.match(w);\n return n?.[1].trim() || null;\n}\nconst b = /^\\s*(?:(?:\\$feature\\.(\\w+))|(?:\\$feature\\[([\"'])(.+)(\\2)\\]));?\\s*$/i,\n m = /^\\s*(?:(?:\\$feature\\.(\\w+))|(?:\\$feature\\[([\"'])(.+)(\\2)\\]));?\\s*(?:DomainName\\(\\s*\\$feature\\s*,\\s*([\"'])(\\1|\\3)(\\5)\\s*\\));?\\s*$/i,\n R = /^\\s*(?:DomainName\\(\\s*\\$feature\\s*,\\s*([\"'])(.+)(\\1)\\s*\\));?\\s*$/i;\nfunction _(e) {\n if (!e) return null;\n let n = b.exec(e) || m.exec(e);\n return n ? n[1] || n[3] : (n = R.exec(e), n ? n[2] : null);\n}\nexport { E as convertTemplatedStringToArcade, x as getLabelExpression, f as getLabelExpressionArcade, g as getLabelExpressionSingleField, _ as getSingleFieldArcadeExpression, $ as getSingleFieldTemplatedString, p as sqlToTemplateString, u as templateStringToSql };"],"mappings":"wCAKA,IAAMA,EAAI,YACRC,EAAI,UACJC,EAAI,IAAI,OAAOF,EAAG,IAAI,EACtBG,EAAI,IAAI,OAAOF,EAAG,IAAI,EACtBG,EAAI,IAAI,OAAO,IAAMJ,EAAG,GAAG,EAC3BK,EAAI,IAAI,OAAOJ,EAAI,IAAK,GAAG,EAC3BK,EAAI,IACJC,EAAID,EAAI,MACRE,EAAI,MAAQF,EACd,SAASG,EAAEC,EAAG,CACZ,OAAOA,EAAE,WAAW,IAAI,OAAO,MAAO,GAAG,EAAG,GAAG,EAAE,WAAW,IAAI,OAAO,MAAO,GAAG,EAAG,GAAG,CACzF,CACA,SAASC,EAAED,EAAG,CACZ,OAAOA,EAAE,WAAW,IAAI,OAAO,MAAO,GAAG,EAAG,GAAG,EAAE,WAAW,IAAI,OAAO,MAAO,GAAG,EAAG,GAAG,CACzF,CACA,SAASE,EAAEF,EAAG,CACZ,IAAMV,EAAI,CACR,WAAY,GACZ,KAAM,MACR,EACA,OAAOU,EAAE,oBAAsBA,EAAE,oBAAoB,OAASV,EAAE,WAAaU,E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