import{r as s,j as n}from"./router.chunk.YsRm4bSN.js";import{Z as e,J as a,bT as o,i as r,O as d,P as i,Q as l,a6 as u,a7 as t,a8 as c,K as f,a9 as g,B as h}from"./main.chunk.N-eZ2ybB.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{k as m,z as j}from"./forms.chunk.Bz8aaTWe.js";import{S as p}from"./select-field.chunk.BsBigbOV.js";const x=j.object({fund_id:j.string({message:"Fund is required"})}),k=({children:j,open:k,onOpenChange:w,onReassign:b,loading:C=!1})=>{const R=m({resolver:a(x),defaultValues:e(x)}),v=o("useAllFundsQuery"),F=v?.(),_=s.useMemo(()=>r(F?.data)?F.data.map(s=>({value:s.id,label:s.title})):[],[F?.data]);return n.jsxs(d,{open:k,onOpenChange:w,children:[n.jsx(i,{asChild:!0,children:j}),n.jsxs(l,{children:[n.jsxs(u,{children:[n.jsx(t,{children:__("Reassign donations to fund","growfund")}),n.jsx(c,{})]}),n.jsxs(f,{...R,children:[n.jsx("div",{className:"growfund-px-4",children:n.jsx(p,{control:R.control,label:__("Revenue from the selected donations will be reassigned to this fund:","growfund"),name:"fund_id",options:_,placeholder:__("Select a fund","growfund"),className:"growfund-bg-background-surface"})}),n.jsxs(g,{children:[n.jsx(h,{variant:"outline",onClick:()=>{w(!1)},children:__("Cancel","growfund")}),n.jsx(h,{loading:C,onClick:()=>{const s=R.getValues();b(()=>{w(!1)},s.fund_id)},children:__("Reassign","growfund")})]})]})]})]})};k.displayName="ReassignFundDialog";export{k as R};
