import React from"react";const DESCRIPTION_SUFFIX="-description",TITLE_SUFFIX="-title";function textToHtml(e,t){return{__html:t.renderHtml(e)}}function getTitleId(e){return`${e}${TITLE_SUFFIX}`}function getDescriptionId(e){return`${e}${DESCRIPTION_SUFFIX}`}function renderTitle(e,t,n,r){e=textToHtml(e.title,t);return 0<(null===(t=null==e?void 0:e.__html)||void 0===t?void 0:t.length)?(r=r||"form-element-title",React.createElement("span",{className:r,dangerouslySetInnerHTML:e,id:getTitleId(n)})):null}function renderDescription(e,t,n,r){e=textToHtml(e.description,t);return 0<(null===(t=null==e?void 0:e.__html)||void 0===t?void 0:t.length)?React.createElement("aside",{className:r,dangerouslySetInnerHTML:e,id:getDescriptionId(n)}):null}function renderError(e,t){e=textToHtml(e.error,t);return 0<(null===(t=null==e?void 0:e.__html)||void 0===t?void 0:t.length)?React.createElement("div",{className:"notice",dangerouslySetInnerHTML:e,role:"alert"}):null}function renderFocus(e,t,n){null===e||e.disabled||n.renderFocus(e,t)}export{getTitleId,getDescriptionId,renderTitle,renderDescription,renderError,renderFocus};