export async function load(e){e&&"function"==typeof e.load&&await e.load(),await ready(e)}export async function ready(e){e&&"function"==typeof e.when&&await e.when()}export function getAllFieldInfos(e){const t=Array.isArray(e.content)?e.content.filter((e=>"fields"===e.type)).map((e=>e.fieldInfos||[])):[];return(e.fieldInfos||[]).concat(...t)}const e=/\{(expression[\\/])?[\w.]+\}/g,t=/\{relationships[\\/][\w.]+[\\/][\w.]+\}/g,n=/\$feature\.([\w.]+)|\$feature\["([\w.]+)"\]/g;export function getAllReferencedFieldNames(r){const o=new Set,i=[],s=[];return i.push(r.title),r.expressionInfos&&r.expressionInfos.forEach((e=>{null!=e.expression&&s.push(e.expression),null!=e.title&&s.push(e.title)})),Array.isArray(r.content)?r.content.forEach((e=>{if("type"in e)if("text"===e.type)i.push(e.text);else if("media"===e.type){let t=e.mediaInfos||[];t=Array.isArray(t)?t:[t],t.forEach((e=>{i.push(e.title,e.caption),isImageMediaInfo(e)?e.value&&i.push(e.value.linkURL,e.value.sourceURL):e.value&&(o.add(e.value.tooltipField),o.add(e.value.normalizeField),(e.value.fields||[]).forEach((e=>o.add(e))))}))}})):"string"==typeof r.content&&i.push(r.content),s.filter((e=>!!e)).forEach((e=>{const t=e.matchAll(n);for(const e of t)o.add(e[1]??e[2])})),i.filter((e=>!!e)).forEach((n=>{let r;const i=new RegExp(e),s=new RegExp(t),p=e=>{const t=new RegExp(e);for(r=t.exec(n);r&&"string"==typeof r[0];)o.add(r[1]??r[0].replace(/\{|\}/g,"").split(":")[0]),r=t.exec(n)};p(i),p(s)})),Array.from(o.values()).filter((e=>!!e))}export function isCodedValueDomain(e){return"esri.layers.support.CodedValueDomain"===e?.declaredClass}export function isColor(e){return"esri.Color"===e?.declaredClass}export function isImageMediaInfo(e){return"esri.popup.content.ImageMediaInfo"===e?.declaredClass}export function isPopupTemplate(e){return"esri.PopupTemplate"===e?.declaredClass}export function isField(e){return"esri.layers.support.Field"===e?.declaredClass}export function isAttachmentsContent(e){return"esri.popup.content.AttachmentsContent"===e?.declaredClass}export function isCustomContent(e){return"esri.popup.content.CustomContent"===e?.declaredClass}export function isExpressionContent(e){return"esri.popup.content.ExpressionContent"===e?.declaredClass}export function isFieldsContent(e){return"esri.popup.content.FieldsContent"===e?.declaredClass}export function isMediaContent(e){return"esri.popup.content.MediaContent"===e?.declaredClass}export function isTextContent(e){return"esri.popup.content.TextContent"===e?.declaredClass}export function isRelationshipContent(e){return"esri.popup.content.RelationshipContent"===e?.declaredClass}export function isPopupContent(e){return isAttachmentsContent(e)||isExpressionContent(e)||isCustomContent(e)||isFieldsContent(e)||isTextContent(e)||isMediaContent(e)||isRelationshipContent(e)}export function isFeatureSet(e){return"esri.rest.support.FeatureSet"===e?.declaredClass}export function isFeatureType(e){return"esri.layers.support.FeatureType"===e?.declaredClass}export function isViewpoint(e){return"esri.Viewpoint"===e?.declaredClass}export function isPortalItem(e){return"esri.portal.PortalItem"===e?.declaredClass}export function isGraphic(e){return"esri.Graphic"===e?.declaredClass}export function isSpatialReference(e){return"esri.geometry.SpatialReference"===e?.declaredClass}export function isEsriObject(e){return!!e?.declaredClass}export function isGeometry(e){return isPoint(e)||isMultipoint(e)||isPolyline(e)||isPolygon(e)||isExtent(e)||isMesh(e)}export function isPoint(e){return isEsriObject(e)&&"point"===e?.type}export function isMultipoint(e){return isEsriObject(e)&&"multipoint"===e?.type}export function isPolyline(e){return isEsriObject(e)&&"polyline"===e?.type}export function isPolygon(e){return isEsriObject(e)&&"polygon"===e?.type}export function isExtent(e){return isEsriObject(e)&&"extent"===e?.type}export function isMesh(e){return isEsriObject(e)&&"mesh"===e?.type}