/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{ensureOneOfType as t}from"../../core/accessorSupport/ensureType.js";import e from"../elements/AttachmentElement.js";import o from"../elements/Element.js";import p from"../elements/FieldElement.js";import r from"../elements/RelationshipElement.js";import i from"../elements/TextElement.js";import n from"../elements/UtilityNetworkAssociationsElement.js";const s=t=>"field"===t.type,u=t=>"group"===t.type,m=t=>"text"===t.type,y=t=>"relationship"===t.type,l=t=>"utilityNetworkAssociations"===t.type;function a(t){return f(t)||c(t)}function f(t){return"text-area"===t.type}function c(t){return"text-box"===t.type}function h(t){return{typesWithGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,group:t,relationship:r,text:i,utilityNetworkAssociations:n}},typesWithoutGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,relationship:r,text:i,utilityNetworkAssociations:n}}}}function x(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>p[t.type].fromJSON(t))}function G(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>t.toJSON())}function W(e,o,p=!0){return e?e.map(e=>t(p?o.typesWithGroup:o.typesWithoutGroup,e)):null}export{h as buildTypeMaps,W as ensureType,x as fromJSON,s as isFieldElement,u as isGroupElement,y as isRelationshipElement,f as isTextAreaInput,c as isTextBoxInput,m as isTextElement,a as isTextInput,l as isUtilityNetworkAssociationsElement,G as toJSON};
