var v=Object.defineProperty,H=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var u=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var d=(i,t,o)=>t in i?v(i,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[t]=o,h=(i,t)=>{for(var o in t||(t={}))I.call(t,o)&&d(i,o,t[o]);if(u)for(var o of u(t))L.call(t,o)&&d(i,o,t[o]);return i},g=(i,t)=>H(i,y(t));import{jsxs as r,jsx as e}from"react/jsx-runtime";import{I as b}from"./input-error-BbsDx4-P.js";import{L as B}from"./loading-button-B_LaGOAp.js";import{H as F,J as M,K as O,e as _,M as E,N as T,L as f,I as q,O as A,Q as J,B as K}from"./ui-components-B24mpb8o.js";import{o as Q}from"./inertia-FIn3q7f1.js";import{useForm as k}from"@inertiajs/react";import{useState as z}from"react";import{Editor as G}from"richtor";/* empty css                */import"lucide-react";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";const Bt=({title:i,newsletter:t,handler:o,translate:j})=>{const[C,p]=z(!1),{input:s,button:n}=j||{input:{subject:"Subject"},button:{close:"Close",submit:"Submit"}},{data:m,setData:l,post:D,put:S,errors:c,processing:x}=k({subject:t?t.subject:"",description:t?t.description:""});return r(F,{open:C,onOpenChange:p,children:[e(M,{children:o}),e(O,{className:"p-0",children:r(_,{className:"max-h-[90vh] p-6",children:[e(E,{className:"mb-6",children:e(T,{children:i})}),r("form",{onSubmit:a=>{a.preventDefault(),t?S(route("newsletters.update",{id:t.id}),{onSuccess:()=>p(!1)}):D(route("newsletters.store"),{onSuccess:()=>p(!1)})},className:"space-y-4 p-0.5",children:[r("div",{children:[e(f,{children:s.subject}),e(q,{required:!0,type:"text",name:"subject",value:m.subject,placeholder:s.subject,onChange:a=>Q(a,l)}),e(b,{message:c.subject})]}),r("div",{children:[e(f,{children:s.description}),e(G,{ssr:!0,output:"html",placeholder:{paragraph:s.description_placeholder,imageCaption:s.image_url_placeholder},contentMinHeight:256,contentMaxHeight:640,initialContent:m.description,onContentChange:a=>l(N=>g(h({},N),{description:a}))}),e(b,{message:c.description})]}),r(A,{className:"flex justify-end space-x-2 pt-4",children:[e(J,{asChild:!0,children:e(K,{type:"button",variant:"outline",children:n.close})}),e(B,{loading:x,children:n.submit})]})]})]})})]})};export{Bt as default};
