import{d as b,_ as p,o as l,k as s,y as o,z as r,p as d,n as m,m as f}from"./app-DZcRemIr.js";const t=Number.isNaN||window.isNaN,g=/^-?(?:\d+|\d+\.\d+|\.\d+)(?:[eE][-+]?\d+)?$/,y=/\.\d*(?:0|9){10}\d*$/,u=(e,a=1e11)=>y.test(String(e))?Math.round(e*a)/a:e,h=b({name:"VueNumberInput",props:{attrs:{type:Object,default:void 0},center:Boolean,controls:Boolean,disabled:Boolean,inputtable:{type:Boolean,default:!0},inline:Boolean,max:{type:Number,default:1/0},min:{type:Number,default:-1/0},name:{type:String,default:void 0},placeholder:{type:String,default:void 0},readonly:Boolean,rounded:Boolean,size:{type:String,default:void 0},step:{type:Number,default:1},modelValue:{type:Number,default:NaN}},emits:["update:modelValue"],data(){return{value:NaN}},computed:{increasable(){return t(this.value)||this.value<this.max},decreasable(){return t(this.value)||this.value>this.min}},watch:{modelValue:{immediate:!0,handler(e,a){!(t(e)&&typeof a>"u")&&e!==this.value&&this.setValue(e)}}},methods:{isNaN:t,change(e){this.setValue(e.target.value)},paste(e){const a=e.clipboardData||window.clipboardData;a&&!g.test(a.getData("text"))&&e.preventDefault()},decrease(){if(this.decreasable){let{value:e}=this;t(e)&&(e=0),this.setValue(u(e-this.step))}},increase(){if(this.increasable){let{value:e}=this;t(e)&&(e=0),this.setValue(u(e+this.step))}},setValue(e){const a=this.value;let i=typeof e!="number"?parseFloat(e):e;t(i)||(this.min<=this.max&&(i=Math.min(this.max,Math.max(this.min,i))),this.rounded&&(i=Math.round(i))),this.value=i,i===a&&(this.$refs.input.value=String(i)),this.$emit("update:modelValue",i,a)}}}),v=["disabled"],w=["name","value","min","max","step","readonly","disabled","placeholder"],N=["disabled"];function z(e,a,i,k,c,V){return l(),s("div",{class:r(["relative max-w-full overflow-hidden",{"inline-block":e.inline,"inline-block w-24":e.inline&&e.size==="small","inline-block w-60":e.inline&&e.size==="large","inline-block w-[12.5rem]":e.inline&&!e.size}])},[e.controls?(l(),s("button",{key:0,class:r(["vue-number-input__button vue-number-input__button--minus absolute top-px bottom-px left-px z-10 flex items-center justify-center border-r border-gray-300 rounded-l disabled:opacity-65 focus:outline-none leading-none text-gray-700 dark:text-gray-200",[e.size==="small"?"w-8":e.size==="large"?"w-12":"w-10",e.size==="large"?"text-xl":"text-base","bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600"]]),type:"button",tabindex:"-1",disabled:e.disabled||e.readonly||!e.decreasable,onClick:a[0]||(a[0]=o((...n)=>e.decrease&&e.decrease(...n),["prevent"]))},"−",10,v)):d("v-if",!0),m("input",f({ref:"input",class:["block min-w-[3rem] max-w-full min-h-[1.5rem] border transition-colors focus:outline-none",["border-gray-300 focus:border-blue-600 bg-white text-black","dark:border-gray-600 dark:bg-black dark:text-white",e.center&&"text-center",e.controls&&!e.size&&"px-14",e.controls&&e.size==="small"&&"px-10",e.controls&&e.size==="large"&&"px-16",!e.controls&&!e.size&&"px-3.5 py-1.75",e.size==="small"&&"text-sm rounded-sm py-1",e.size==="large"&&"text-xl rounded-md py-2",e.inline&&e.size==="small"&&"w-24",e.inline&&!e.size&&"w-48",e.inline&&e.size==="large"&&"w-60",!e.inline&&"w-full"]]},e.attrs,{type:"number",name:e.name,value:isNaN(e.value)?"":e.value,min:e.min,max:e.max,step:e.step,readonly:e.readonly||!e.inputtable,disabled:e.disabled||!e.decreasable&&!e.increasable,placeholder:e.placeholder,autocomplete:"off",onChange:a[1]||(a[1]=(...n)=>e.change&&e.change(...n)),onPaste:a[2]||(a[2]=(...n)=>e.paste&&e.paste(...n))}),null,16,w),e.controls?(l(),s("button",{key:1,class:r(["vue-number-input__button absolute top-px bottom-px right-px z-10 flex items-center justify-center border-l border-gray-300 rounded-r disabled:opacity-65 focus:outline-none leading-none text-gray-700 dark:text-gray-200",[e.size==="small"?"w-8":e.size==="large"?"w-12":"w-10",e.size==="large"?"text-xl":"text-base","bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600"]]),type:"button",tabindex:"-1",disabled:e.disabled||e.readonly||!e.increasable,onClick:a[3]||(a[3]=o((...n)=>e.increase&&e.increase(...n),["prevent"]))},"+",10,N)):d("v-if",!0)],2)}const $=p(h,[["render",z],["__file","/var/www/resources/js/components/vue-number-input.vue"]]);export{$ as v};
