import React from"react";import{renderTitle,renderDescription,renderError}from"./common.js";import{TitleLocation}from"./constants.js";import{makeSafeClassName,makeUniqueId}from"./utils.js";export default React.forwardRef((e,r)=>{const{children:t,className:o,component:a,element:i,errorClassName:s,htmlElementType:n,...l}=e;var m=a.props.host;const p=[];var c=makeUniqueId(a.props.name),d=renderTitle(i,m,c),u=renderDescription(i,m,c),h=renderError(i,m),m=null===(e=null==d?void 0:d.props)||void 0===e?void 0:e.id,e=null===(e=null==u?void 0:u.props)||void 0===e?void 0:e.id;const f=[];o&&f.push(...o.split(" ")),i.titleLocation===TitleLocation.BESIDE&&f.push("inline-title"),i.styleName&&f.push(makeSafeClassName(i.styleName)),h&&s&&f.push(s);r={"aria-labelledby":m,"aria-describedby":e,className:f.join(" "),id:c,ref:r,...l};return p.push(d),i.titleLocation===TitleLocation.BESIDE?p.push(React.createElement("div",{className:"form-element-content"},u,h,t)):(p.push(u),p.push(h),p.push(t)),React.createElement(n||"div",r,...p)});