"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5414],{25414:(e,t,n)=>{let r,a;n.d(t,{A:()=>u});var o=n(74848),l=n(96540);function i(e){let t,{value:n,format:r}=e;if(!n)return 0;try{t="string"===r?n.toString().replace(/\D/g,"").replace(/\B(?=(\d{3})+(?!\d))/g,","):parseInt(n.toString().replace(/\D/g,""))}catch(e){t=0,console.log(e)}return t}function s(e){var t;let n,{value:r,format:a,decimals:o}=e,l=(null==r?void 0:null===(t=r.toString())||void 0===t?void 0:t.match(/^\-/))?"-":"";try{if("string"===a){let e=r.toString().split(".");n=l+e[0].toString().replace(/[^0-9\.]/g,"").replace(/\B(?=(\d{3})+(?!\d))/g,",")+(e[1]?o?".".concat(e[1].substring(0,o)):".".concat(e[1].substring(0,2)):"")}else n=parseFloat(l+r.toString().replace(/[^0-9\.]/g,""))}catch(e){n=0,console.log(e)}return n}function u(e){try{let{title:d,name:p,defaultValue:v,placeholder:g,autoComplete:m,onInputHandler:h,required:w,inputType:f,setAlert:x,prefix:b,minValue:S,maxValue:y,encrypted:j,numberText:I,appendCurrency:N,elementRef:T,onChangeHandler:F,value:L,step:D,decimal:M,pattern:k,info:E,fontSize:W,maxWidth:C,setValue:R,id:_}=e;function t(e){e.target.value.match(/./)?(e.target.classList.remove("warning"),x&&x(null)):e.target.required&&e.target.classList.add("warning"),I&&(e.target.value=e.target.value.toString().match(/^0+$/)?"0":e.target.value.toString().replace(M?/[^0-9\.]/g:/\D/g,"").replace(/^0*/,"").replace(/\B(?=(\d{3})+(?!\d))/g,",")),h&&h(e),F&&F(e)}function n(e){if(e.type.match(/enter/i)&&window.innerWidth<1200)return;let t=e.target.closest(".info-wrapper"),n=t.querySelector(".info-dropdown");if(e.type.match(/leave/i)&&!n.classList.contains("hidden")){n.classList.add("hidden");return}if(!(e.type.match(/leave/i)&&n.classList.contains("hidden"))){if(!t){n.classList.add("hidden");return}if(n.classList.contains("hidden")){n.classList.remove("hidden");return}n.classList.add("hidden")}}let q=T||l.useRef();function u(e){var t;let n=M?parseFloat(s({value:(null===(t=q.current)||void 0===t?void 0:t.value)||0}).toString())-(D?parseFloat(D.toString()):20):parseInt(i({value:q.current.value}).toString())-(D||20),r=M?s({value:n,format:"raw"}):i({value:n,format:"raw"});S&&"number"==typeof r&&ry||(q.current.value=n.toString(),R&&R(q.current.value))}return(0,o.jsxs)("div",{className:"form-input-wrapper flex flex-col items-start gap-0.5 w-full relative",style:{...C?{maxWidth:C}:{}},children:[d&&(0,o.jsx)("label",{htmlFor:p,children:d}),(0,o.jsxs)("div",{className:"flex items-center w-full relative",children:[b&&(0,o.jsx)("div",{className:"absolute left-4 bottom-2 text-lg",children:b}),(0,o.jsx)("input",{type:f||"text",name:p,id:_||p,ref:q,placeholder:g||d||"",autoComplete:m,onInput:e=>{t(e)},onChange:e=>{t(e)},value:L||void 0,defaultValue:L?void 0:v||void 0,pattern:k?k.toString():void 0,required:!!w&&w,style:{...W?{fontSize:W}:{},...b?{paddingLeft:"35px"}:{}},min:S,max:y,"data-encrypted":j||null,"data-appendcurrency":N||null,className:"bg-white"+(E?" pr-16":"")}),I&&(0,o.jsxs)("div",{className:"absolute gap-1"+(E?" right-12":" right-4"),style:{top:"50%",transform:"translate(0,-50%)"},children:[(0,o.jsx)("span",{className:"number-text-button w-10 md:w-8 h-10 md:h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center cursor-pointer hover:bg-slate-200 text-2xl font-semibold touch-none",onMouseDown:e=>{e.preventDefault(),window.innerWidth<1200||(u(e),r=setTimeout(()=>{a=setInterval(()=>{u(e)},50)},200))},onTouchStart:e=>{e.preventDefault(),window.innerWidth>=1200||(u(e),r=setTimeout(()=>{a=setInterval(()=>{u(e)},50)},200))},onMouseUp:e=>{window.clearTimeout(r),window.clearInterval(a)},onTouchEnd:e=>{window.clearTimeout(r),window.clearInterval(a)},onMouseLeave:e=>{window.clearTimeout(r),window.clearInterval(a)},onTouchMove:e=>{e.preventDefault()},children:(0,o.jsx)("span",{className:"pointer-events-none",children:"-"})}),(0,o.jsx)("span",{className:"number-text-button w-10 md:w-8 h-10 md:h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center cursor-pointer hover:bg-slate-200 text-2xl font-semibold touch-none",onMouseDown:e=>{e.preventDefault(),window.innerWidth<1200||(c(e),r=setTimeout(()=>{a=setInterval(()=>{c(e)},50)},200))},onTouchStart:e=>{e.preventDefault(),window.innerWidth>=1200||(c(e),r=setTimeout(()=>{a=setInterval(()=>{c(e)},50)},200))},onMouseUp:e=>{window.clearTimeout(r),window.clearInterval(a)},onTouchEnd:e=>{window.clearTimeout(r),window.clearInterval(a)},onMouseLeave:e=>{window.clearTimeout(r),window.clearInterval(a)},children:(0,o.jsx)("span",{className:"pointer-events-none",children:"+"})})]}),E&&(0,o.jsxs)("div",{className:"info-wrapper absolute right-2 w-8 h-8 rounded-full bg-white flex items-center justify-center z-10",style:{top:"50%",transform:"translate(0,-50%)"},onMouseEnter:n,onMouseLeave:n,onClick:n,children:[(0,o.jsx)("img",{src:"/images/info-outlined-black.png",alt:"",className:"w-6 h-6 object-contain opacity-60 pointer-events-none"}),(0,o.jsx)("div",{className:"info-dropdown absolute top-9 right-0 bg-white w-52 md:w-96 p-2 sm:p-6 shadow-xl rounded hidden text-center border border-slate-300 border-solid",children:(0,o.jsx)("span",{children:E})}),(0,o.jsx)("div",{className:"absolute -top-2 w-12",style:{height:"45px"}})]})]})]})}catch(e){return console.log("ERROR in FormInput =>",e),(0,o.jsx)("div",{children:"Form Input Error"})}}}}]);