/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
export default $arcgis.t(([{replace:a}])=>{function u(e){return e!=null&&typeof e=="object"&&"type"in e&&e.type==="feature"}function g(e){return u(e)&&e?.type==="feature"&&e.source?.type==="feature-layer"}function l(e){return u(e)&&g(e)}var s=/^\s*expression\//iu,y=/href=(""|'')/giu,h=/(\{([^{\r\n]+)\})/gu,N=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/giu,I=/'/gu,C="relationships/",w=/^(?:mailto:|tel:)/u;function T(e,n){let r=new Map;if(!e)return r;for(let t of e){if(!t.fieldName)continue;let o=c(t.fieldName,n);t.fieldName=o,r.set(o.toLowerCase(),t)}return r}function q(e){let n=[];if(!e)return n;let{fieldInfos:r,content:t}=e;return r&&n.push(...r),!t||!Array.isArray(t)||t.forEach(o=>{if(o.type==="fields"){let i=o?.fieldInfos;i&&n.push(...i)}}),n}function O(e,n){return e?.getEffectivePopupTemplate(n)??void 0}function P(e){if(e!=null)return"sourceLayer"in e&&e.sourceLayer?e.sourceLayer:e.layer??void 0}function L(e=""){return e?e.includes(C):!1}function R(e=""){if(e)return!w.test(e.trim().toLowerCase())}function c(e,n){let r=m(n,e);return r?r.name:e}function U(e,n){return e?.map(r=>c(r,n))}function d(e){return e?s.test(e):!1}function A(e,n){if(!n||!d(n)||!e)return;let r=n.replace(s,"").toLowerCase();return e.find(({name:t})=>t.toLowerCase()===r)}function W(e,n){if(!(!e?.length||!n))return e.find(r=>r.fieldName?.toLowerCase()===n.toLowerCase())}function F({fieldInfo:e,graphic:n}){return!!e?.fieldName&&!d(e.fieldName)&&!L(e.fieldName)&&!n?.isAggregate&&!n?.popupTemplate}function z({expressionInfos:e,fieldInfo:n,graphic:r,isContentFieldInfos:t,layer:o}){if(!n?.fieldName)return null;let i=A(e,n?.fieldName);if(i)return i.title||null;if(l(o)&&F({fieldInfo:n,graphic:r})){let f=o.getFieldAlias(n.fieldName);return t?n.label||f||n.fieldName:f||n.fieldName}return n.label||n.fieldName}function H({fieldInfo:e,isContentFieldInfos:n,layer:r}){if(!e?.fieldName)return null;if(l(r)){let t=r?.getFieldConfiguration?.(e.fieldName)?.fieldFormat;return n&&e.fieldFormat||t}return null}function p(e){return e.trim()}function v(e){return e.replaceAll(y,"")}function b(e,n){return`{${n.get(e.toLowerCase())?.fieldName||e}}`}function x({formattedValues:e,template:n,fieldInfoMap:r}){return p(v(a(a(n,t=>b(t,r)),e)))}function m(e,n){return!(e&&"getField"in e&&typeof e.getField=="function")||!n?null:e.getField(n)??null}function M(e,n){return e.replaceAll(h,(r,t,o)=>{let i=m(n,o);return i?`{${i.name}}`:t})}function j(e,n,r=!1){let t=n[e];if(typeof t=="string"){let o=(r?encodeURIComponent(t):t).replaceAll(I,"%27");n[e]=o}}function E(e,n=!1){let r={...e};return Object.keys(r).forEach(t=>j(t,r,n)),r}function V(e,n,r){n=p(n);let t=n&&!n.startsWith("{");return a(e,E(r,t||!1))}function $(e,n,r){let t=M(e,r);return t&&t.replaceAll(N,(o,i,f)=>V(o,i||f,n))}function _({values:e,globalValues:n,layer:r,text:t,fieldInfoMap:o}){return t?x({formattedValues:n,template:$(t,{...n,...e},r),fieldInfoMap:o}):""}async function B({type:e,value:n,event:r}){try{return typeof n=="function"?n(r):await n}catch(t){console.error(`[arcgis-feature] An error occurred when calling the "${e}" function`,{error:t,graphic:r.graphic,value:n});return}}return{a:l,b:T,c:q,d:O,e:P,f:L,g:R,h:c,i:U,j:d,k:W,l:F,m:z,n:H,o:x,p:M,q:_,r:B}},"applications/Components/stringUtils")