/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as i,h as t,F as s,H as e,g as a}from"./index-12b1e13a.js";import{c as d}from"./clsx-09a06a12.js";import{t as l}from"./i18n-5fe08f1c.js";import{a as o,g as n,c as h}from"./component-names-d278f819.js";import{h as c,s as f}from"./reuse-32931294.js";import{K as r}from"./FormFieldMsg-eb41f84c.js";import"./i18n-7ea9f137.js";import"./Alert-5705426b.js";import"./tslib.es6-2e5096f8.js";import"./dev.utils-fab45cbc.js";const u=class{constructor(t){i(this,t),this.slotName="input",this.catchInputSlot=t=>{c(this.host,t,this.slotName)},this._accessKey=void 0,this._alert=!0,this._currentLength=void 0,this._disabled=!1,this._hasCounter=!1,this._hideError=!1,this._hideLabel=!1,this._hint="",this._icons=void 0,this._id=void 0,this._label=void 0,this._maxLength=void 0,this._msg=void 0,this._readOnly=!1,this._renderNoLabel=!1,this._required=!1,this._shortKey=void 0,this._slotName=void 0,this._suggestions=void 0,this._smartButton=void 0,this._tooltipAlign="top",this._touched=!1}componentWillRender(){this.slotName=this._slotName?this._slotName:"input"}getIconStyles(t){return t&&"object"==typeof t&&t.style?t.style:{}}render(){var i,a,c,_,u,b,m,p,g,y,v,k;const j="object"==typeof this._msg&&null!==this._msg&&"string"==typeof(null===(i=this._msg)||void 0===i?void 0:i._description)&&(null===(a=this._msg)||void 0===a?void 0:a._description.length)>0&&(!0===this._touched||"error"!==(null===(c=this._msg)||void 0===c?void 0:c._type)),B=f(this._label),L="string"==typeof this._hint&&this._hint.length>0,N=!B&&this._hideLabel;return t(e,{key:"f387b8c961abba887df0af3acdc992fdc780bf67",class:d("kol-input",this.getModifierClassNameByMsgType(j),{disabled:!0===this._disabled,[(null===(_=this._msg)||void 0===_?void 0:_._type)||"error"]:!0===j,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-error":!0===this._hideError})},t("label",{key:"46d5a787dc011c63d78b23f5041d3bddd4bf35b9",class:"input-label",id:N?void 0:`${this._id}-label`,hidden:N,htmlFor:this._id},t("span",{key:"d704939fe7f625fa71fcced90cfc57ad88f9d3f5",class:"input-label-span"},t("slot",{key:"717a440a4755fa1cc878ccc697a2339a236cc2ca",name:"label"}))),L&&t("span",{key:"cf2a32a4850aa36c47640044ee8131cd039437f3",class:"hint",id:`${this._id}-hint`},this._hint),t("div",{key:"908ad6c86b9f897a203babfa6a647482fd963ee7",class:{input:!0,"icon-left":"object"==typeof(null===(u=this._icons)||void 0===u?void 0:u.left),"icon-right":"object"==typeof(null===(b=this._icons)||void 0===b?void 0:b.right)}},(null===(m=this._icons)||void 0===m?void 0:m.left)&&t(n,{key:"8d34322e538ef59f93ea0d91c18865c09acdc806",_label:"",_icons:(null===(p=this._icons)||void 0===p?void 0:p.left).icon,style:this.getIconStyles(null===(g=this._icons)||void 0===g?void 0:g.left)}),t("div",{key:"63e0601882b3b4708004514ee16eea9d10eaa79e",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&t(h,{key:"90e62c7fd3205e54abeaf277ff6cb84cc9f808e2",_customClass:this._smartButton._customClass,_disabled:this._smartButton._disabled,_icons:this._smartButton._icons,_hideLabel:!0,_id:this._smartButton._id,_label:this._smartButton._label,_on:this._smartButton._on,_tooltipAlign:this._smartButton._tooltipAlign,_variant:this._smartButton._variant}),(null===(y=this._icons)||void 0===y?void 0:y.right)&&t(n,{key:"78820371cd0eea944bba2249fa206dfa1f7ea9a8",_label:"",_icons:(null===(v=this._icons)||void 0===v?void 0:v.right).icon,style:this.getIconStyles(null===(k=this._icons)||void 0===k?void 0:k.right)})),N&&t(o,{key:"23f8131f06b0ade72a2ac6de4bc45d87c537ecf8","aria-hidden":"true",class:"input-tooltip",_badgeText:this._accessKey||this._shortKey,_align:this._tooltipAlign,_id:this._hideLabel?`${this._id}-label`:void 0,_label:this._label}),j&&t(r,{key:"d7913257b81e5b0ad00da22c589cf22e31ba809f",_alert:this._alert,_hideError:this._hideError,_msg:this._msg,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&t("datalist",{key:"3d900634935d030abd1d25b62bce6872989488b6",id:`${this._id}-list`},this._suggestions.map((i=>t("option",{value:i})))),this._hasCounter&&t("span",{key:"72ffb636b35c38cae343fda5e00ad2726d23009c",class:"counter","aria-atomic":"true","aria-live":"polite","data-testid":"input-counter"},this._currentLength,this._maxLength&&t(s,null,t("span",{key:"5316e7ddca828a22191faabf95d762261cd3e7e0","aria-label":l("kol-of"),role:"img"},"/"),this._maxLength)," ",t("span",{key:"2ec4c8bb02a35daffbea7a9d58d15a5e487b9652"},l("kol-characters"))))}getModifierClassNameByMsgType(t){var i,s;if(t&&(null===(i=this._msg)||void 0===i?void 0:i._type))return{default:"msg-type-default",info:"msg-type-info",success:"msg-type-success",warning:"msg-type-warning",error:"msg-type-error"}[null===(s=this._msg)||void 0===s?void 0:s._type]}get host(){return a(this)}};export{u as kol_input};