import{r,aE as V,g as D,aF as h,j as c,y as T}from"./index-Bf3Szspx.js";import{u as A}from"./styles-B4EP7QEU.js";import{d as B}from"./circle_images-CNsFIm_y.js";const E=200;function Y({disabled:e=!1,error:n=!1,value:i,placeholder:f="#000000",name:l,className:p="",onChange:u=()=>{},onBlur:g=()=>{},allowNull:b,...y}){const o=i||(b?null:"#000000"),[j,m]=r.useState(!1),[x,C]=r.useState(()=>o),a=A(y),I=r.useRef(null),d={backgroundColor:o||"#000000"};(o===""||V(o)||n)&&(d.border=`1px solid ${D.gray.normal}`);const S=r.useCallback(h((s,t)=>{s.target.value=t,s.target.name=l,u(s),g(s)},E),[u,g]),k=r.useCallback(h(s=>{u(s)},E),[u]),N=s=>{var t;C(((t=s==null?void 0:s.target)==null?void 0:t.value)||""),k(s)},F=()=>{m(!0)},R=s=>{m(!1),g(s)};return r.useEffect(()=>{o!==x&&C(o)},[o]),c.jsxs("div",{className:T([a.root,p],{[a.disabled]:e,[a.focus]:!e&&j,[a.error]:n}),children:[c.jsx("input",{type:"text",name:l,className:a.inputText,placeholder:f,onChange:N,onFocus:F,onBlur:R,value:x,disabled:e}),c.jsx("button",{type:"button",className:a.buttonColor,style:d,disabled:e,onClick:s=>{const t=s.currentTarget.nextSibling;t.focus(),t.click()},children:"color"}),c.jsx("input",{type:"color",ref:I,className:a.inputColor,value:o,onChange:s=>{const t=s.target.value;S(s,t)}})]})}function _({src:e="",alt:n="",onLoad:i=()=>{},...f}){const[l,p]=r.useState(!1),u=()=>{p(!0)};return c.jsx("img",{...f,src:l?B:e,alt:n,onLoad:i,onError:l?i:u})}export{Y as I,_ as a};