import{r as s,P as Yn,a as Qn,D,O as F,c as j,I as _e}from"./iframe-B4rglaWu.js";import{u as _n,C as er,a as nr,e as rr,c as tr,d as Re}from"./componentbase.esm-O764U3c0.js";import{I as rn}from"./iconbase.esm-CeJUwaxq.js";import{I as ur}from"./inputtext.esm-PyaMa37F.js";import{R as en}from"./ripple.esm-Bd7Vm0vw.js";import{T as ar}from"./tooltip.esm-C17X5ypA.js";function Oe(){return Oe=Object.assign?Object.assign.bind():function(i){for(var o=1;o<arguments.length;o++){var c=arguments[o];for(var p in c)({}).hasOwnProperty.call(c,p)&&(i[p]=c[p])}return i},Oe.apply(null,arguments)}var tn=s.memo(s.forwardRef(function(i,o){var c=rn.getPTI(i);return s.createElement("svg",Oe({ref:o,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},c),s.createElement("path",{d:"M3.58659 4.5007C3.68513 4.50023 3.78277 4.51945 3.87379 4.55723C3.9648 4.59501 4.04735 4.65058 4.11659 4.7207L7.11659 7.7207L10.1166 4.7207C10.2619 4.65055 10.4259 4.62911 10.5843 4.65956C10.7427 4.69002 10.8871 4.77074 10.996 4.88976C11.1049 5.00877 11.1726 5.15973 11.1889 5.32022C11.2052 5.48072 11.1693 5.6422 11.0866 5.7807L7.58659 9.2807C7.44597 9.42115 7.25534 9.50004 7.05659 9.50004C6.85784 9.50004 6.66722 9.42115 6.52659 9.2807L3.02659 5.7807C2.88614 5.64007 2.80725 5.44945 2.80725 5.2507C2.80725 5.05195 2.88614 4.86132 3.02659 4.7207C3.09932 4.64685 3.18675 4.58911 3.28322 4.55121C3.37969 4.51331 3.48305 4.4961 3.58659 4.5007Z",fill:"currentColor"}))}));tn.displayName="AngleDownIcon";function Ee(){return Ee=Object.assign?Object.assign.bind():function(i){for(var o=1;o<arguments.length;o++){var c=arguments[o];for(var p in c)({}).hasOwnProperty.call(c,p)&&(i[p]=c[p])}return i},Ee.apply(null,arguments)}var un=s.memo(s.forwardRef(function(i,o){var c=rn.getPTI(i);return s.createElement("svg",Ee({ref:o,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},c),s.createElement("path",{d:"M10.4134 9.49931C10.3148 9.49977 10.2172 9.48055 10.1262 9.44278C10.0352 9.405 9.95263 9.34942 9.88338 9.27931L6.88338 6.27931L3.88338 9.27931C3.73811 9.34946 3.57409 9.3709 3.41567 9.34044C3.25724 9.30999 3.11286 9.22926 3.00395 9.11025C2.89504 8.99124 2.82741 8.84028 2.8111 8.67978C2.79478 8.51928 2.83065 8.35781 2.91338 8.21931L6.41338 4.71931C6.55401 4.57886 6.74463 4.49997 6.94338 4.49997C7.14213 4.49997 7.33276 4.57886 7.47338 4.71931L10.9734 8.21931C11.1138 8.35994 11.1927 8.55056 11.1927 8.74931C11.1927 8.94806 11.1138 9.13868 10.9734 9.27931C10.9007 9.35315 10.8132 9.41089 10.7168 9.44879C10.6203 9.48669 10.5169 9.5039 10.4134 9.49931Z",fill:"currentColor"}))}));un.displayName="AngleUpIcon";function ae(){return ae=Object.assign?Object.assign.bind():function(i){for(var o=1;o<arguments.length;o++){var c=arguments[o];for(var p in c)({}).hasOwnProperty.call(c,p)&&(i[p]=c[p])}return i},ae.apply(null,arguments)}function Fe(i,o){(o==null||o>i.length)&&(o=i.length);for(var c=0,p=Array(o);c<o;c++)p[c]=i[c];return p}function ir(i){if(Array.isArray(i))return Fe(i)}function or(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function an(i,o){if(i){if(typeof i=="string")return Fe(i,o);var c={}.toString.call(i).slice(8,-1);return c==="Object"&&i.constructor&&(c=i.constructor.name),c==="Map"||c==="Set"?Array.from(i):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?Fe(i,o):void 0}}function lr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cr(i){return ir(i)||or(i)||an(i)||lr()}function ie(i){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},ie(i)}function sr(i,o){if(ie(i)!="object"||!i)return i;var c=i[Symbol.toPrimitive];if(c!==void 0){var p=c.call(i,o);if(ie(p)!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(i)}function pr(i){var o=sr(i,"string");return ie(o)=="symbol"?o:o+""}function fr(i,o,c){return(o=pr(o))in i?Object.defineProperty(i,o,{value:c,enumerable:!0,configurable:!0,writable:!0}):i[o]=c,i}function mr(i){if(Array.isArray(i))return i}function dr(i,o){var c=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(c!=null){var p,n,W,M,H=[],q=!0,ee=!1;try{if(W=(c=c.call(i)).next,o!==0)for(;!(q=(p=W.call(c)).done)&&(H.push(p.value),H.length!==o);q=!0);}catch(ne){ee=!0,n=ne}finally{try{if(!q&&c.return!=null&&(M=c.return(),Object(M)!==M))return}finally{if(ee)throw n}}return H}}function gr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vr(i,o){return mr(i)||dr(i,o)||an(i,o)||gr()}var br={root:function(o){var c=o.props,p=o.focusedState,n=o.stacked,W=o.horizontal,M=o.vertical;return j("p-inputnumber p-component p-inputwrapper",{"p-inputwrapper-filled":c.value!=null&&c.value.toString().length>0,"p-inputwrapper-focus":p,"p-inputnumber-buttons-stacked":n,"p-inputnumber-buttons-horizontal":W,"p-inputnumber-buttons-vertical":M,"p-invalid":c.invalid})},input:function(o){var c=o.props,p=o.context;return j("p-inputnumber-input",{"p-variant-filled":c.variant?c.variant==="filled":p&&p.inputStyle==="filled"})},buttonGroup:"p-inputnumber-button-group",incrementButton:function(o){var c=o.props;return j("p-inputnumber-button p-inputnumber-button-up p-button p-button-icon-only p-component",{"p-disabled":c.disabled})},incrementIcon:"p-button-icon",decrementButton:function(o){var c=o.props;return j("p-inputnumber-button p-inputnumber-button-down p-button p-button-icon-only p-component",{"p-disabled":c.disabled})},decrementIcon:"p-button-icon"},yr=`
@layer primereact {
    .p-inputnumber {
        display: inline-flex;
    }
    
    .p-inputnumber-button {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }
    
    .p-inputnumber-buttons-stacked .p-button.p-inputnumber-button .p-button-label,
    .p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button .p-button-label {
        display: none;
    }
    
    .p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-up {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding: 0;
    }
    
    .p-inputnumber-buttons-stacked .p-inputnumber-input {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    
    .p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-down {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 0;
        padding: 0;
    }
    
    .p-inputnumber-buttons-stacked .p-inputnumber-button-group {
        display: flex;
        flex-direction: column;
    }
    
    .p-inputnumber-buttons-stacked .p-inputnumber-button-group .p-button.p-inputnumber-button {
        flex: 1 1 auto;
    }
    
    .p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-up {
        order: 3;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
    
    .p-inputnumber-buttons-horizontal .p-inputnumber-input {
        order: 2;
        border-radius: 0;
    }
    
    .p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-down {
        order: 1;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    
    .p-inputnumber-buttons-vertical {
        flex-direction: column;
    }
    
    .p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-up {
        order: 1;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        width: 100%;
    }
    
    .p-inputnumber-buttons-vertical .p-inputnumber-input {
        order: 2;
        border-radius: 0;
        text-align: center;
    }
    
    .p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-down {
        order: 3;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        width: 100%;
    }
    
    .p-inputnumber-input {
        flex: 1 1 auto;
    }
    
    .p-fluid .p-inputnumber {
        width: 100%;
    }
    
    .p-fluid .p-inputnumber .p-inputnumber-input {
        width: 1%;
    }
    
    .p-fluid .p-inputnumber-buttons-vertical .p-inputnumber-input {
        width: 100%;
    }
}
`,de=er.extend({defaultProps:{__TYPE:"InputNumber",__parentMetadata:null,allowEmpty:!0,ariaLabelledBy:null,autoFocus:!1,buttonLayout:"stacked",className:null,currency:void 0,currencyDisplay:void 0,decrementButtonClassName:null,decrementButtonIcon:null,disabled:!1,format:!0,id:null,incrementButtonClassName:null,incrementButtonIcon:null,inputClassName:null,inputId:null,inputMode:null,inputRef:null,inputStyle:null,invalid:!1,variant:null,locale:void 0,localeMatcher:void 0,max:null,maxFractionDigits:void 0,maxLength:null,min:null,minFractionDigits:void 0,mode:"decimal",name:null,onBlur:null,onChange:null,onFocus:null,onKeyDown:null,onKeyUp:null,onValueChange:null,pattern:null,placeholder:null,prefix:null,readOnly:!1,required:!1,roundingMode:void 0,showButtons:!1,size:null,step:1,style:null,suffix:null,tabIndex:null,tooltip:null,tooltipOptions:null,type:"text",useGrouping:!0,value:null,children:void 0},css:{classes:br,styles:yr}});function nn(i,o){var c=Object.keys(i);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(i);o&&(p=p.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),c.push.apply(c,p)}return c}function _(i){for(var o=1;o<arguments.length;o++){var c=arguments[o]!=null?arguments[o]:{};o%2?nn(Object(c),!0).forEach(function(p){fr(i,p,c[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):nn(Object(c)).forEach(function(p){Object.defineProperty(i,p,Object.getOwnPropertyDescriptor(c,p))})}return i}var hr=s.memo(s.forwardRef(function(i,o){var c=_n(),p=s.useContext(Yn),n=de.getProps(i,p),W=s.useState(!1),M=vr(W,2),H=M[0],q=M[1],ee=_(_({props:n},n.__parentMetadata),{},{state:{focused:H}}),ne=de.setMetaData(ee),A=ne.ptm,G=ne.cx,on=ne.isUnstyled;nr(de.css.styles,on,{name:"inputnumber"});var ge=s.useRef(null),d=s.useRef(null),ve=s.useRef(null),be=s.useRef(null),ye=s.useRef(null),oe=s.useRef(null),N=s.useRef(null),le=s.useRef(null),ce=s.useRef(null),P=s.useRef(null),I=s.useRef(null),C=s.useRef(null),k=s.useRef(null),v=s.useRef(null),he=s.useRef(null),J=s.useRef(null),se=s.useRef(null),Me=s.useRef(null),xe=s.useRef(!1),x=n.locale||p&&p.locale||Qn.locale,Ae=n.showButtons&&n.buttonLayout==="stacked",ln=n.showButtons&&n.buttonLayout==="horizontal",cn=n.showButtons&&n.buttonLayout==="vertical",Ie=n.inputMode||(n.mode==="decimal"&&!n.minFractionDigits&&!n.maxFractionDigits?"numeric":"decimal"),pe=function(){var e,r;return{localeMatcher:n.localeMatcher,style:n.mode,currency:n.currency,currencyDisplay:n.currencyDisplay,useGrouping:n.useGrouping,minimumFractionDigits:(e=n.minFractionDigits)!==null&&e!==void 0?e:void 0,maximumFractionDigits:(r=n.maxFractionDigits)!==null&&r!==void 0?r:void 0,roundingMode:n.roundingMode}},Ne=function(){ye.current=new Intl.NumberFormat(x,pe());var e=cr(new Intl.NumberFormat(x,{useGrouping:!1}).format(9876543210)).reverse(),r=new Map(e.map(function(t,u){return[t,u]}));P.current=new RegExp("[".concat(e.join(""),"]"),"g"),I.current=fn(),C.current=mn(),k.current=dn(),v.current=pn(),he.current=sn(),J.current=vn(),se.current=gn(),Me.current=function(t){return r.get(t)}},ke=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},sn=function(){return new Intl.NumberFormat(x,{useGrouping:!1}).format(1.1).trim().replace(P.current,"")},pn=function(){var e=new Intl.NumberFormat(x,_(_({},pe()),{},{useGrouping:!1}));return new RegExp("[".concat(e.format(1.1).replace(k.current,"").trim().replace(P.current,""),"]"),"g")},fn=function(){var e=new Intl.NumberFormat(x,{useGrouping:!0});return oe.current=e.format(1e6).trim().replace(P.current,"").charAt(0),new RegExp("[".concat(oe.current,"]"),"g")},mn=function(){var e=new Intl.NumberFormat(x,{useGrouping:!1});return new RegExp("[".concat(e.format(-1).trim().replace(P.current,""),"]"),"g")},dn=function(){if(n.currency){var e=new Intl.NumberFormat(x,{style:"currency",currency:n.currency,currencyDisplay:n.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0,roundingMode:n.roundingMode});return new RegExp("[".concat(e.format(1).replace(/\s/g,"").replace(P.current,"").replace(I.current,""),"]"),"g")}return new RegExp("[]","g")},gn=function(){if(n.prefix)N.current=n.prefix;else{var e=new Intl.NumberFormat(x,{style:n.mode,currency:n.currency,currencyDisplay:n.currencyDisplay});N.current=e.format(1).split("1")[0]}return new RegExp("".concat(ke(N.current||"")),"g")},vn=function(){if(n.suffix)le.current=n.suffix;else{var e=new Intl.NumberFormat(x,{style:n.mode,currency:n.currency,currencyDisplay:n.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0,roundingMode:n.roundingMode});le.current=e.format(1).split("1")[1]}return new RegExp("".concat(ke(le.current||"")),"g")},R=function(e){if(e!=null){if(e==="-")return e;if(n.format){var r=new Intl.NumberFormat(x,pe()),t=r.format(e);return n.prefix&&(t=n.prefix+t),n.suffix&&(t=t+n.suffix),t}return e.toString()}return""},S=function(e){var r=e.replace(J.current,"").replace(se.current,"").trim().replace(/\s/g,"").replace(k.current,"").replace(I.current,"").replace(C.current,"-").replace(v.current,".").replace(P.current,Me.current);if(r){if(r==="-")return r;var t=+r;return isNaN(t)?null:t}return null},bn=function(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10;return Math.round((e+r)*t)/t},re=function(e,r,t){var u=r||500;O(),ve.current=setTimeout(function(){re(e,40,t)},u),we(e,t)},we=function(e,r){if(d.current){var t=n.step*r,u=S(d.current.value)||0,a=te(bn(u,t));if(n.maxLength&&n.maxLength<R(a).length)return;$e(e,u,a),!D.isTouchDevice()&&He(a,null,"spin"),K(e,a)}},yn=function(e){!n.disabled&&!n.readOnly&&(D.isTouchDevice()||D.focus(d.current,n.autoFocus),re(e,null,1),e.preventDefault())},hn=function(){!n.disabled&&!n.readOnly&&O()},xn=function(){!n.disabled&&!n.readOnly&&O()},In=function(){!n.disabled&&!n.readOnly&&O()},wn=function(e){!n.disabled&&!n.readOnly&&(e.keyCode===32||e.keyCode===13)&&re(e,null,1)},Dn=function(e){!n.disabled&&!n.readOnly&&(D.isTouchDevice()||D.focus(d.current,n.autoFocus),re(e,null,-1),e.preventDefault())},Cn=function(){!n.disabled&&!n.readOnly&&O()},Sn=function(){!n.disabled&&!n.readOnly&&O()},Bn=function(){!n.disabled&&!n.readOnly&&O()},Pn=function(e){!n.disabled&&!n.readOnly&&(e.keyCode===32||e.keyCode===13)&&re(e,null,-1)},Rn=function(e){if(!(n.disabled||n.readOnly)&&(ce.current&&(e.target.value=be.current,ce.current=!1),!D.isAndroid())){var r=e.nativeEvent.inputType,t=e.nativeEvent.data;r==="insertText"&&/\D/.test(t)&&(e.target.value=be.current)}},On=function(e){if(!(!D.isAndroid()||n.disabled||n.readOnly)&&!(n.onKeyUp&&(n.onKeyUp(e),e.defaultPrevented))){var r=e.which||e.keyCode;r!==13&&e.preventDefault();var t=String.fromCharCode(r),u=z(t),a=Ue(t);48<=r&&r<=57||a||u?Ce(e,t,{isDecimalSign:u,isMinusSign:a}):w(e,e.target.value,null,"delete-single")}},En=function(e){if(!(n.disabled||n.readOnly)){if(e.altKey||e.ctrlKey||e.metaKey){e.key.toLowerCase()==="x"&&(e.ctrlKey||e.metaKey)?ce.current=!1:ce.current=!0;return}if(!(n.onKeyDown&&(n.onKeyDown(e),e.defaultPrevented))&&(be.current=e.target.value,!D.isAndroid())){var r=e.target.selectionStart,t=e.target.selectionEnd,u=e.target.value,a=null;switch(e.code){case"ArrowUp":we(e,1),e.preventDefault();break;case"ArrowDown":we(e,-1),e.preventDefault();break;case"ArrowLeft":U(u.charAt(r-1))||e.preventDefault();break;case"ArrowRight":U(u.charAt(r))||e.preventDefault();break;case"Tab":case"Enter":case"NumpadEnter":a=te(S(u)),d.current.value=R(a),d.current.setAttribute("aria-valuenow",a),K(e,a);break;case"Backspace":if(e.preventDefault(),r===t){var f=u.charAt(r-1);if(U(f)){var m=Te(u),y=m.decimalCharIndex,h=m.decimalCharIndexWithoutPrefix,$=Xe(u);if(I.current.test(f))I.current.lastIndex=0,a=u.slice(0,r-2)+u.slice(r-1);else if(v.current.test(f))v.current.lastIndex=0,$?d.current.setSelectionRange(r-1,r-1):a=u.slice(0,r-1)+u.slice(r);else if(y>0&&r>y){var X=Le()&&(n.minFractionDigits||0)<$?"":"0";a=u.slice(0,r-1)+X+u.slice(r)}else h===1?(a=u.slice(0,r-1)+"0"+u.slice(r),a=S(a)>0?a:""):a=u.slice(0,r-1)+u.slice(r)}else if(k.current.test(f)){var g=je(u),E=g.minusCharIndex,Z=g.currencyCharIndex;E===Z-1&&(a=u.slice(0,E)+u.slice(r))}w(e,a,null,"delete-single")}else a=ze(u,r,t),w(e,a,null,"delete-range");break;case"Delete":if(e.preventDefault(),r===t){var b=u.charAt(r),Y=Te(u),L=Y.decimalCharIndex,Q=Y.decimalCharIndexWithoutPrefix;if(U(b)){var T=Xe(u);if(I.current.test(b))I.current.lastIndex=0,a=u.slice(0,r)+u.slice(r+2);else if(v.current.test(b))v.current.lastIndex=0,T?d.current.setSelectionRange(r+1,r+1):a=u.slice(0,r)+u.slice(r+1);else if(L>0&&r>L){var V=Le()&&(n.minFractionDigits||0)<T?"":"0";a=u.slice(0,r)+V+u.slice(r+1)}else Q===1?(a=u.slice(0,r)+"0"+u.slice(r+1),a=S(a)>0?a:""):a=u.slice(0,r)+u.slice(r+1)}w(e,a,null,"delete-back-single")}else a=ze(u,r,t),w(e,a,null,"delete-range");break;case"End":e.preventDefault(),F.isEmpty(n.max)||K(e,n.max);break;case"Home":e.preventDefault(),F.isEmpty(n.min)||K(e,n.min);break;default:e.preventDefault();var B=e.key;if(B){B==="."&&(B=he.current);var me=z(B),ue=Ue(B);(Number(B)>=0&&Number(B)<=9||ue||me)&&Ce(e,B,{isDecimalSign:me,isMinusSign:ue})}break}}}},Fn=function(e){if(e.preventDefault(),!(n.disabled||n.readOnly)){var r=(e.clipboardData||window.clipboardData).getData("Text");if(r){var t=S(r);if(t!=null)if(De(t)){var u=R(t);d.current.value=u,K(e,t)}else Ce(e,t.toString())}}},Mn=function(){return F.isEmpty(n.min)||n.min<0},Ue=function(e){return C.current.test(e)||e==="-"?(C.current.lastIndex=0,!0):!1},Ke=function(e){return De(e)?e.toString().replace(/\.(?=[^.]*$)/,he.current):e},z=function(e){return v.current.test(e)||De(e)?(v.current.lastIndex=0,!0):!1},Le=function(){return n.mode==="decimal"},De=function(e){var r=new Intl.NumberFormat(x,pe()),t=S(r.format(e));return t===null?!1:t%1!==0},Te=function(e){var r=e.search(v.current);v.current.lastIndex=0;var t=e.replace(se.current,"").trim().replace(/\s/g,"").replace(k.current,""),u=t.search(v.current);return v.current.lastIndex=0,{decimalCharIndex:r,decimalCharIndexWithoutPrefix:u}},je=function(e){var r=e.search(v.current);v.current.lastIndex=0;var t=e.search(C.current);C.current.lastIndex=0;var u=e.search(J.current);J.current.lastIndex=0;var a=e.search(k.current);return a===0&&N.current&&N.current.length>1&&(a=N.current.trim().length),k.current.lastIndex=0,{decimalCharIndex:r,minusCharIndex:t,suffixCharIndex:u,currencyCharIndex:a}},Ce=function(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{isDecimalSign:!1,isMinusSign:!1},u=r.search(C.current);if(C.current.lastIndex=0,!(!Mn()&&u!==-1)){var a=d.current.selectionStart,f=d.current.selectionEnd,m=d.current.value.trim(),y=je(m),h=y.decimalCharIndex,$=y.minusCharIndex,X=y.suffixCharIndex,g=y.currencyCharIndex,E=ye.current.resolvedOptions().maximumFractionDigits,Z=n.min||n.max||n.suffix||n.prefix,b;if(t.isMinusSign){var Y=$===-1;(a===0||a===g+1)&&(b=m,(Y||f!==0)&&(b=fe(m,r,0,f)),w(e,b,r,"insert"))}else if(t.isDecimalSign){if(h>0&&a===h)w(e,m,r,"insert");else if(h>a&&h<f)b=fe(m,r,a,f),w(e,b,r,"insert");else if(h===-1&&(E||n.maxFractionDigits)){var L=Ie!=="numeric"||Ie==="numeric"&&Z;L&&(b=fe(m,r,a,f),w(e,b,r,"insert"))}}else{var Q=a!==f?"range-insert":"insert";if(h>0&&a>h){if(a+r.length-(h+1)<=E){var T=g>=a?g-1:X>=a?X:m.length;b=m.slice(0,a)+r+m.slice(a+r.length,T)+m.slice(T),w(e,b,r,Q)}}else b=fe(m,r,a,f),w(e,b,r,Q)}}},Ge=function(e){return e&&e.replace(J.current,"").trim().replace(/\s/g,"").replace(k.current,"")},fe=function(e,r,t,u){var a=z(r)?r:r.split(v.current);if(a.length===2){var f=e.slice(t,u).search(v.current);return v.current.lastIndex=0,f>0?e.slice(0,t)+R(r)+Ge(e).slice(u):e||R(r)}else{if(z(r)&&e.length===0)return R("0.");if(u-t===e.length)return R(r);if(t===0){var m=F.isLetter(e[u])?u-1:u;return r+e.slice(m)}else if(u===e.length)return e.slice(0,t)+r}var y=e.slice(t,u),h=/\s$/.test(y)?" ":"";return e.slice(0,t)+r+h+e.slice(u)},ze=function(e,r,t){var u;return t-r===e.length?u="":r===0?u=e.slice(t):t===e.length?u=e.slice(0,r):u=e.slice(0,r)+e.slice(t),u},Se=function(){var e=d.current.selectionStart,r=d.current.value,t=r.length,u=null,a=(N.current||"").length;r=r.replace(se.current,""),e=e-a;var f=r.charAt(e);if(U(f))return e+a;for(var m=e-1;m>=0;)if(f=r.charAt(m),U(f)){u=m+a;break}else m--;if(u!==null)d.current.setSelectionRange(u+1,u+1);else{for(m=e;m<t;)if(f=r.charAt(m),U(f)){u=m+a;break}else m++;u!==null&&d.current.setSelectionRange(u,u)}return u||0},An=function(){xe.current=!0},Nn=function(){Se()},U=function(e){return e.length===1&&(P.current.test(e)||v.current.test(e)||I.current.test(e)||C.current.test(e))?(kn(),!0):!1},kn=function(){P.current.lastIndex=0,v.current.lastIndex=0,I.current.lastIndex=0,C.current.lastIndex=0},w=function(e,r,t,u){var a=d.current.value,f=null;r!=null&&(f=Be(S(r)),He(f,t,u,r),$e(e,a,f))},Be=function(e){return!e&&!n.allowEmpty?n.min||0:e},$e=function(e,r,t){n.onChange&&Ve(r,t)&&n.onChange({originalEvent:e,value:t})},Ve=function(e,r){if(r===null&&e!==null)return!0;if(r!=null){var t=typeof e=="string"?S(e):e;return r!==t}return!1},te=function(e){return e==="-"?null:We(e)},We=function(e){return F.isEmpty(e)?null:n.min!==null&&e<n.min?n.min:n.max!==null&&e>n.max?n.max:e},He=function(e,r,t,u){r=r||"";var a=d.current,f=a.value,m=R(e),y=f.length;if(m!==u&&(m=Un(m,u)),y===0){a.value=m,a.setSelectionRange(0,0);var h=Se(),$=h+r.length+(z(r)?1:0);a.setSelectionRange($,$)}else{var X=a.selectionStart,g=a.selectionEnd;if(n.maxLength&&n.maxLength<m.length)return;a.value=m;var E=m.length;if(t==="range-insert"){var Z=S((f||"").slice(0,X)),b=Z!==null?Z.toString():"",Y=b.split("").join("(".concat(oe.current,")?")),L=new RegExp(Y,"g");L.test(m);var Q=r.split("").join("(".concat(oe.current,")?")),T=new RegExp(Q,"g");T.test(m.slice(L.lastIndex)),g=L.lastIndex+T.lastIndex,a.setSelectionRange(g,g)}else if(E===y)if(t==="insert"||t==="delete-back-single"){var V=g;r==="0"?V=g+1:V=V+Number(z(e)||z(r)),a.setSelectionRange(V,V)}else t==="delete-single"?a.setSelectionRange(g-1,g-1):(t==="delete-range"||t==="spin")&&a.setSelectionRange(g,g);else if(t==="delete-back-single"){var B=f.charAt(g-1),me=f.charAt(g),ue=y-E,Ye=I.current.test(me);Ye&&ue===1?g=g+1:!Ye&&U(B)&&(g=g+(-1*ue+1)),I.current.lastIndex=0,a.setSelectionRange(g,g)}else if(f==="-"&&t==="insert"){a.setSelectionRange(0,0);var Zn=Se(),Qe=Zn+r.length+1;a.setSelectionRange(Qe,Qe)}else g=g+(E-y),a.setSelectionRange(g,g)}a.setAttribute("aria-valuenow",e)},qe=function(e){e=Be(e);var r=d.current,t=r.value,u=Je(e);t!==u&&(r.value=u,r.setAttribute("aria-valuenow",e))},Je=function(e){return R(Be(e))},Un=function(e,r){if(e&&r){var t=r.search(v.current);v.current.lastIndex=0;var u=Ke(e).split(v.current)[0].replace(J.current,"").trim();return t!==-1?u+r.slice(t):e}return e},Xe=function(e){if(e){var r=e.split(v.current);if(r.length===2)return Ge(r[1]).length}return 0},K=function(e,r){n.onValueChange&&n.onValueChange({originalEvent:e,value:r,stopPropagation:function(){e?.stopPropagation()},preventDefault:function(){e?.preventDefault()},target:{name:n.name,id:n.id,value:r}})},Kn=function(e){if(q(!0),n.onFocus&&n.onFocus(e),(n.suffix||n.currency||n.prefix)&&d.current&&!xe.current){var r=d.current.value,t=(N.current||"").length,u=(le.current||"").length,a=r.length===0?0:r.length-u;d.current.setSelectionRange(t,a)}},Ln=function(e){if(q(!1),xe.current=!1,d.current){var r=d.current.value;if(Ve(r,n.value)){var t=te(S(r));qe(t),K(e,t)}}n.onBlur&&n.onBlur(e)},O=function(){ve.current&&clearInterval(ve.current)},Ze=function(){var e=We(n.value);qe(n.format?e:Ke(e));var r=te(n.value);n.value!==null&&n.value!==r&&K(null,r)},Tn=function(){return ye.current};s.useImperativeHandle(o,function(){return{props:n,focus:function(){return D.focus(d.current)},getFormatter:Tn,getElement:function(){return ge.current},getInput:function(){return d.current}}}),s.useEffect(function(){F.combinedRefs(d,n.inputRef)},[d,n.inputRef]),rr(function(){O()}),tr(function(){Ne();var l=te(n.value);n.value!==null&&n.value!==l&&K(null,l)}),Re(function(){Ne(),Ze()},[x,n.locale,n.localeMatcher,n.mode,n.currency,n.currencyDisplay,n.useGrouping,n.minFractionDigits,n.maxFractionDigits,n.suffix,n.prefix]),Re(function(){Ze()},[n.value]),Re(function(){n.disabled&&O()},[n.disabled]);var jn=function(){var e=j(n.inputClassName,G("input",{context:p})),r=Je(n.value);return s.createElement(ur,ae({ref:d,id:n.inputId,style:n.inputStyle,role:"spinbutton",className:e,defaultValue:r,type:n.type,size:n.size,tabIndex:n.tabIndex,inputMode:Ie,maxLength:n.maxLength,disabled:n.disabled,required:n.required,pattern:n.pattern,placeholder:n.placeholder,readOnly:n.readOnly,name:n.name,autoFocus:n.autoFocus,onKeyDown:En,onKeyPress:On,onInput:Rn,onClick:Nn,onPointerDown:An,onBlur:Ln,onFocus:Kn,onPaste:Fn,min:n.min,max:n.max,"aria-valuemin":n.min,"aria-valuemax":n.max,"aria-valuenow":n.value},Hn,Wn,{pt:A("input"),unstyled:n.unstyled,__parentMetadata:{parent:ee}}))},Gn=function(){var e=c({className:G("incrementIcon")},A("incrementIcon")),r=n.incrementButtonIcon||s.createElement(un,e),t=_e.getJSXIcon(r,_({},e),{props:n}),u=c({type:"button",className:j(n.incrementButtonClassName,G("incrementButton")),onPointerLeave:xn,onPointerDown:function(f){return yn(f)},onPointerUp:hn,onKeyDown:function(f){return wn(f)},onKeyUp:In,disabled:n.disabled,tabIndex:-1,"aria-hidden":!0},A("incrementButton"));return s.createElement("button",u,t,s.createElement(en,null))},zn=function(){var e=c({className:G("decrementIcon")},A("decrementIcon")),r=n.decrementButtonIcon||s.createElement(tn,e),t=_e.getJSXIcon(r,_({},e),{props:n}),u=c({type:"button",className:j(n.decrementButtonClassName,G("decrementButton")),onPointerLeave:Sn,onPointerDown:function(f){return Dn(f)},onPointerUp:Cn,onKeyDown:function(f){return Pn(f)},onKeyUp:Bn,disabled:n.disabled,tabIndex:-1,"aria-hidden":!0},A("decrementButton"));return s.createElement("button",u,t,s.createElement(en,null))},$n=function(){var e=n.showButtons&&Gn(),r=n.showButtons&&zn(),t=c({className:G("buttonGroup")},A("buttonGroup"));return Ae?s.createElement("span",t,e,r):s.createElement(s.Fragment,null,e,r)},Vn=F.isNotEmpty(n.tooltip),Pe=de.getOtherProps(n),Wn=F.reduceKeys(Pe,D.DATA_PROPS),Hn=F.reduceKeys(Pe,D.ARIA_PROPS),qn=jn(),Jn=$n(),Xn=c({id:n.id,className:j(n.className,G("root",{focusedState:H,stacked:Ae,horizontal:ln,vertical:cn})),style:n.style},Pe,A("root"));return s.createElement(s.Fragment,null,s.createElement("span",ae({ref:ge},Xn),qn,Jn),Vn&&s.createElement(ar,ae({target:ge,content:n.tooltip,pt:A("tooltip")},n.tooltipOptions)))}));hr.displayName="InputNumber";export{hr as I};
