import{j as o}from"./index-CmAiVN5e.js";import{r as n}from"./vendor-animations-CsoOZIH8.js";import{I as r}from"./inputmask-Cr-e3LsO.js";import{T as a}from"./TextInput-wB5aOs8O.js";import{T as u}from"./TextInput-Do8kQcsL.js";const s={"*":{validator:"[0-9A-Za-z.!@#$%&'*+/=?^_`{|}~-]",casing:"lower"}},i={telegram:new r({mask:"t.me/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/^https?:\/\//g,"")},definitions:s}),twitch:new r({mask:"twitch.com/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/(^https?:\/\/(www.twitch.tv\/)?)|(^www.twitch.tv\/)/g,"")},definitions:s}),youtube:new r({mask:"youtube.com/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/(^https?:\/\/(www.)?)|(^www.)/g,"")},definitions:s}),vk:new r({mask:"vk.com/*{*}",placeholder:"",clearMaskOnLostFocus:!0,autoUnmask:!0,onBeforePaste:function(t){return t.replace(/^https?:\/\//g,"")},definitions:s})},p={telegram:"t.me/",youtube:"youtube.com/",twitch:"twitch.com/",vk:"vk.com/"};class w extends n.Component{constructor(){super(...arguments),this.inputRef=n.createRef()}componentDidMount(){this.inputRef.current&&!this.props.isLoading&&i[this.props.type].mask(this.inputRef.current)}componentDidUpdate(e){!this.props.isLoading&&this.props.isLoading!==e.isLoading&&this.inputRef.current&&!this.inputRef.current.inputmask&&i[this.props.type].mask(this.inputRef.current)}render(){return this.props.inputVersion===2?o.jsx(a,{inputRef:this.inputRef,title:this.props.title,placeholder:p[this.props.type],value:this.props.value,onChange:e=>this.props.setValue(e),onEnter:this.props.onEnter,errorText:this.props.errorText}):o.jsx(u,{inputRef:this.inputRef,title:this.props.title,placeholder:p[this.props.type],value:this.props.value,onChange:e=>this.props.setValue(e.target.value),onEnter:this.props.onEnter,errorText:this.props.errorText})}}export{w as S};