import{C as E,r as o,b as D,P as j,d as A,g as f,f as _,D as c}from"./index-BhJeFDTB.js";import{T as N}from"./button.esm-DWW_mTBz.js";var C={root:"p-float-label"},k=`
@layer primereact {
    .p-float-label {
        display: block;
        position: relative;
    }
    
    .p-float-label label {
        position: absolute;
        pointer-events: none;
        top: 50%;
        margin-top: -.5rem;
        transition-property: all;
        transition-timing-function: ease;
        line-height: 1;
    }
    
    .p-float-label:has(textarea) label {
        top: 1rem;
    }
    
    .p-float-label:has(input:focus) label,
    .p-float-label:has(input.p-filled) label,
    .p-float-label:has(input:-webkit-autofill) label,
    .p-float-label:has(textarea:focus) label,
    .p-float-label:has(textarea.p-filled) label,
    .p-float-label:has(.p-inputwrapper-focus) label,
    .p-float-label:has(.p-inputwrapper-filled) label {
        top: -.75rem;
        font-size: 12px;
    }
    
    .p-float-label .p-placeholder,
    .p-float-label input::placeholder,
    .p-float-label .p-inputtext::placeholder {
        opacity: 0;
        transition-property: all;
        transition-timing-function: ease;
    }
    
    .p-float-label .p-focus .p-placeholder,
    .p-float-label input:focus::placeholder,
    .p-float-label .p-inputtext:focus::placeholder {
        opacity: 1;
        transition-property: all;
        transition-timing-function: ease;
    }
}`,b=E.extend({defaultProps:{__TYPE:"FloatLabel",children:void 0},css:{classes:C,styles:k}}),L=o.memo(o.forwardRef(function(t,e){var n=D(),r=o.useContext(j),a=b.getProps(t,r),l=o.useRef(e),p=b.setMetaData({props:a}),g=p.ptm,P=p.cx,s=p.isUnstyled;A(b.css.styles,s,{name:"floatlabel"}),o.useEffect(function(){f.combinedRefs(l,e)},[l,e]);var h=n({ref:l,className:_(P("root"))},b.getOtherProps(a),g("root"));return o.createElement("span",h,a.children)}));L.displayName="FloatLabel";function I(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function U(t){if(Array.isArray(t))return I(t)}function $(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function z(t,e){if(t){if(typeof t=="string")return I(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(t,e):void 0}}function H(){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 V(t){return U(t)||$(t)||z(t)||H()}var d={DEFAULT_MASKS:{pint:/[\d]/,int:/[\d\-]/,pnum:/[\d\.]/,money:/[\d\.\s,]/,num:/[\d\-\.]/,hex:/[0-9a-f]/i,email:/[a-z0-9_\.\-@]/i,alpha:/[a-z_]/i,alphanum:/[a-z0-9_]/i},getRegex:function(e){return d.DEFAULT_MASKS[e]?d.DEFAULT_MASKS[e]:e},onBeforeInput:function(e,n,r){r||!c.isAndroid()||this.validateKey(e,e.data,n)},onKeyPress:function(e,n,r){r||c.isAndroid()||e.ctrlKey||e.altKey||e.metaKey||this.validateKey(e,e.key,n)},onPaste:function(e,n,r){if(!r){var a=this.getRegex(n),l=e.clipboardData.getData("text");V(l).forEach(function(p){if(!a.test(p))return e.preventDefault(),!1})}},validateKey:function(e,n,r){if(n!=null){var a=n.length<=2;if(a){var l=this.getRegex(r);l.test(n)||e.preventDefault()}}},validate:function(e,n){var r=e.target.value,a=!0,l=this.getRegex(n);return r&&!l.test(r)&&(a=!1),a}};function v(){return v=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},v.apply(null,arguments)}function y(t){"@babel/helpers - typeof";return y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(t)}function Y(t,e){if(y(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(y(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function W(t){var e=Y(t,"string");return y(e)=="symbol"?e:e+""}function q(t,e,n){return(e=W(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var G={root:function(e){var n=e.props,r=e.isFilled,a=e.context;return _("p-inputtext p-component",{"p-disabled":n.disabled,"p-filled":r,"p-invalid":n.invalid,"p-variant-filled":n.variant?n.variant==="filled":a&&a.inputStyle==="filled"})}},m=E.extend({defaultProps:{__TYPE:"InputText",__parentMetadata:null,children:void 0,className:null,invalid:!1,variant:null,keyfilter:null,onBeforeInput:null,onInput:null,onKeyDown:null,onPaste:null,tooltip:null,tooltipOptions:null,validateOnly:!1,iconPosition:null},css:{classes:G}});function S(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function K(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?S(Object(n),!0).forEach(function(r){q(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var J=o.memo(o.forwardRef(function(t,e){var n=D(),r=o.useContext(j),a=m.getProps(t,r),l=m.setMetaData(K(K({props:a},a.__parentMetadata),{},{context:{disabled:a.disabled,iconPosition:a.iconPosition}})),p=l.ptm,g=l.cx,P=l.isUnstyled;A(m.css.styles,P,{name:"inputtext",styled:!0});var s=o.useRef(e),h=function(i){a.onKeyDown&&a.onKeyDown(i),a.keyfilter&&d.onKeyPress(i,a.keyfilter,a.validateOnly)},T=function(i){a.onBeforeInput&&a.onBeforeInput(i),a.keyfilter&&d.onBeforeInput(i,a.keyfilter,a.validateOnly)},F=function(i){var O=i.target,w=!0;a.keyfilter&&a.validateOnly&&(w=d.validate(i,a.keyfilter)),a.onInput&&a.onInput(i,w),f.isNotEmpty(O.value)?c.addClass(O,"p-filled"):c.removeClass(O,"p-filled")},R=function(i){a.onPaste&&a.onPaste(i),a.keyfilter&&d.onPaste(i,a.keyfilter,a.validateOnly)};o.useEffect(function(){f.combinedRefs(s,e)},[s,e]);var x=o.useMemo(function(){return f.isNotEmpty(a.value)||f.isNotEmpty(a.defaultValue)},[a.value,a.defaultValue]),B=f.isNotEmpty(a.tooltip);o.useEffect(function(){var u;x||(u=s.current)!==null&&u!==void 0&&u.value?c.addClass(s.current,"p-filled"):c.removeClass(s.current,"p-filled")},[a.disabled,x]);var M=n({className:_(a.className,g("root",{context:r,isFilled:x})),onBeforeInput:T,onInput:F,onKeyDown:h,onPaste:R},m.getOtherProps(a),p("root"));return o.createElement(o.Fragment,null,o.createElement("input",v({ref:s},M)),B&&o.createElement(N,v({target:s,content:a.tooltip,pt:p("tooltip")},a.tooltipOptions)))}));J.displayName="InputText";export{L as F,J as I};
