1import{c as ze,t as Be,an as qe,r as s,j as e,ao as Ft,x as L,v as q,al as $t,w as Lt,ap as Vt,aq as Ht,ar as zt,u as ge,at as Bt,z as U,aJ as ce,aD as z,ac as qt,ab as Ue,a2 as Ie,a1 as Ut,aa as Kt,af as Ke,k as Ge,E as Oe,d as $,a8 as ae,aK as We,a9 as Fe,e as Qe,P as Wt,p as Qt,o as Jt,aL as Yt,A as Xt}from"./index-DWFhj9Zq.js";import{S as Se,u as Zt,a as er,b as tr,c as rr,d as ar,e as sr,A as nr}from"./AdminLayout-DiaH2eXh.js";import{B as Ee}from"./badge-DFZTKsAx.js";import{D as Je,a as Ye,b as Xe,c as Ze,d as et}from"./dialog-C5wL21az.js";import{T as me}from"./textarea-zD45ywaQ.js";import{R as or,P as lr,O as ir,C as cr}from"./index-CKyFg96D.js";import{u as se}from"./index-C4x7pZBE.js";import{S as Te}from"./search-BUXxFsxG.js";import{L as W}from"./label-BGxv4pSS.js";import{I as dr}from"./input-CIl_HQ0C.js";import{C as ur}from"./checkbox-CmoMQ3ox.js";import{P as mr,a as pr,b as fr}from"./popover-C4q7gIuc.js";import{S as hr,a as gr,b as xr,c as vr,d as ye}from"./select-CDGoL31S.js";import{c as tt,R as br,I as yr}from"./index-B38kUt_t.js";import{u as jr}from"./index-o1TwvfHP.js";import{S as rt}from"./settings-CkQjZjPY.js";import{T as wr}from"./triangle-alert-sY6lyL_n.js";import{I as Cr,B as Nr}from"./image-C6ff1eLe.js";import{V as Sr}from"./video-BM_x7uxI.js";import{C as kr}from"./clipboard-check-C_vToQHv.js";import{T as Pr}from"./trending-up-F4uL_WMK.js";import{E as at}from"./eye-D6z-wfu-.js";import{I as Rr,C as Ir,a as Er}from"./ContentPreviewDialog-CdyNuipw.js";import{F as Tr}from"./file-text-WN9sslry.js";import{E as _r}from"./eye-off-02PC1NZH.js";import"./hq-sidebar-gradient.png.asset-CNsDmNo0.js";import"./sheet-BbDJWRoo.js";import"./users-D8f9Pe-N.js";import"./log-out-Coz57yrg.js";import"./layout-dashboard-BvUAKFZC.js";import"./book-open-Cb_Z_zqi.js";import"./swords-CcMnFne3.js";import"./clipboard-list-BHMiKcov.js";import"./Combination-I95EJuRQ.js";import"./index-Bs5hKfL9.js";import"./index-BdQq_4o_.js";import"./chevron-up-BzwCumj7.js";import"./card-YlcXEDE1.js";import"./external-link-OcPCPZ7-.js";import"./htmlSanitizer-BMNGKltX.js";import"./purify.es-dhnUglUx.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ar=ze("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Dr=ze("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);var je,xe="HoverCard",[st,xs]=Be(xe,[qe]),ve=qe(),[Mr,_e]=st(xe),nt=t=>{const{__scopeHoverCard:a,children:r,open:l,defaultOpen:n,onOpenChange:i,openDelay:c=700,closeDelay:u=300}=t,p=ve(a),d=s.useRef(0),m=s.useRef(0),h=s.useRef(!1),C=s.useRef(!1),[N,x]=ge({prop:l,defaultProp:n??!1,onChange:i,caller:xe}),E=s.useCallback(()=>{clearTimeout(m.current),d.current=window.setTimeout(()=>x(!0),c)},[c,x]),R=s.useCallback(()=>{clearTimeout(d.current),!h.current&&!C.current&&(m.current=window.setTimeout(()=>x(!1),u))},[u,x]),I=s.useCallback(()=>x(!1),[x]);return s.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(m.current)},[]),e.jsx(Mr,{scope:a,open:N,onOpenChange:x,onOpen:E,onClose:R,onDismiss:I,hasSelectionRef:h,isPointerDownOnContentRef:C,children:e.jsx(Bt,{...p,children:r})})};nt.displayName=xe;var ot="HoverCardTrigger",lt=s.forwardRef((t,a)=>{const{__scopeHoverCard:r,...l}=t,n=_e(ot,r),i=ve(r);return e.jsx(Ft,{asChild:!0,...i,children:e.jsx(L.a,{"data-state":n.open?"open":"closed",...l,ref:a,onPointerEnter:q(t.onPointerEnter,fe(n.onOpen)),onPointerLeave:q(t.onPointerLeave,fe(n.onClose)),onFocus:q(t.onFocus,n.onOpen),onBlur:q(t.onBlur,n.onClose),onTouchStart:q(t.onTouchStart,c=>c.preventDefault())})})});lt.displayName=ot;var Gr="HoverCardPortal",[vs,Or]=st(Gr,{forceMount:void 0}),pe="HoverCardContent",it=s.forwardRef((t,a)=>{const r=Or(pe,t.__scopeHoverCard),{forceMount:l=r.forceMount,...n}=t,i=_e(pe,t.__scopeHoverCard);return e.jsx($t,{present:l||i.open,children:e.jsx(Fr,{"data-state":i.open?"open":"closed",...n,onPointerEnter:q(t.onPointerEnter,fe(i.onOpen)),onPointerLeave:q(t.onPointerLeave,fe(i.onClose)),ref:a})})});it.displayName=pe;var Fr=s.forwardRef((t,a)=>{const{__scopeHoverCard:r,onEscapeKeyDown:l,onPointerDownOutside:n,onFocusOutside:i,onInteractOutside:c,...u}=t,p=_e(pe,r),d=ve(r),m=s.useRef(null),h=Lt(a,m),[C,N]=s.useState(!1);return s.useEffect(()=>{if(C){const x=document.body;return je=x.style.userSelect||x.style.webkitUserSelect,x.style.userSelect="none",x.style.webkitUserSelect="none",()=>{x.style.userSelect=je,x.style.webkitUserSelect=je}}},[C]),s.useEffect(()=>{if(m.current){const x=()=>{N(!1),p.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var R;((R=document.getSelection())==null?void 0:R.toString())!==""&&(p.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",x),()=>{document.removeEventListener("pointerup",x),p.hasSelectionRef.current=!1,p.isPointerDownOnContentRef.current=!1}}},[p.isPointerDownOnContentRef,p.hasSelectionRef]),s.useEffect(()=>{m.current&&Vr(m.current).forEach(E=>E.setAttribute("tabindex","-1"))}),e.jsx(Vt,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:c,onEscapeKeyDown:l,onPointerDownOutside:n,onFocusOutside:q(i,x=>{x.preventDefault()}),onDismiss:p.onDismiss,children:e.jsx(Ht,{...d,...u,onPointerDown:q(u.onPointerDown,x=>{x.currentTarget.contains(x.target)&&N(!0),p.hasSelectionRef.current=!1,p.isPointerDownOnContentRef.current=!0}),ref:h,style:{...u.style,userSelect:C?"text":void 0,WebkitUserSelect:C?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),$r="HoverCardArrow",Lr=s.forwardRef((t,a)=>{const{__scopeHoverCard:r,...l}=t,n=ve(r);return e.jsx(zt,{...n,...l,ref:a})});Lr.displayName=$r;function fe(t){return a=>a.pointerType==="touch"?void 0:t()}function Vr(t){const a=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)a.push(r.currentNode);return a}var Hr=nt,zr=lt,ct=it;const Br=Hr,qr=zr,dt=s.forwardRef(({className:t,align:a="center",sideOffset:r=4,...l},n)=>e.jsx(ct,{ref:n,align:a,sideOffset:r,className:U("z-50 w-64 roun
vendor: 11,689 bytes, line 11
11ded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...l}));dt.displayName=ct.displayName;var $e=1,Ur=.9,Kr=.8,Wr=.17,we=.1,Ce=.999,Qr=.9999,Jr=.99,Yr=/[\\\/_+.#"@\[\(\{&]/,Xr=/[\\\/_+.#"@\[\(\{&]/g,Zr=/[\s-]/,ut=/[\s-]/g;function ke(t,a,r,l,n,i,c){if(i===a.length)return n===t.length?$e:Jr;var u=`${n},${i}`;if(c[u]!==void 0)return c[u];for(var p=l.charAt(i),d=r.indexOf(p,n),m=0,h,C,N,x;d>=0;)h=ke(t,a,r,l,d+1,i+1,c),h>m&&(d===n?h*=$e:Yr.test(t.charAt(d-1))?(h*=Kr,N=t.slice(n,d-1).match(Xr),N&&n>0&&(h*=Math.pow(Ce,N.length))):Zr.test(t.charAt(d-1))?(h*=Ur,x=t.slice(n,d-1).match(ut),x&&n>0&&(h*=Math.pow(Ce,x.length))):(h*=Wr,n>0&&(h*=Math.pow(Ce,d-n))),t.charAt(d)!==a.charAt(i)&&(h*=Qr)),(h<we&&r.charAt(d-1)===l.charAt(i+1)||l.charAt(i+1)===l.charAt(i)&&r.charAt(d-1)!==l.charAt(i))&&(C=ke(t,a,r,l,d+1,i+2,c),C*we>h&&(h=C*we)),h>m&&(m=h),d=r.indexOf(p,d+1);return c[u]=m,m}function Le(t){return t.toLowerCase().replace(ut," ")}function ea(t,a,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ke(t,a,Le(t),Le(a),0,0,{})}var ie='[cmdk-group=""]',Ne='[cmdk-group-items=""]',ta='[cmdk-group-heading=""]',mt='[cmdk-item=""]',Ve=`${mt}:not([aria-disabled="true"])`,Pe="cmdk-item-select",te="data-value",ra=(t,a,r)=>ea(t,a,r),pt=s.createContext(void 0),de=()=>s.useContext(pt),ft=s.createContext(void 0),Ae=()=>s.useContext(ft),ht=s.createContext(void 0),gt=s.forwardRef((t,a)=>{let r=re(()=>{var o,b;return{search:"",value:(b=(o=t.value)!=null?o:t.defaultValue)!=null?b:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),l=re(()=>new Set),n=re(()=>new Map),i=re(()=>new Map),c=re(()=>new Set),u=xt(t),{label:p,children:d,value:m,onValueChange:h,filter:C,shouldFilter:N,loop:x,disablePointerSelection:E=!1,vimBindings:R=!0,...I}=t,B=se(),O=se(),V=se(),A=s.useRef(null),y=pa();Z(()=>{if(m!==void 0){let o=m.trim();r.current.value=o,g.emit()}},[m]),Z(()=>{y(6,ee)},[]);let g=s.useMemo(()=>({subscribe:o=>(c.current.add(o),()=>c.current.delete(o)),snapshot:()=>r.current,setState:(o,b,w)=>{var f,S,k,G;if(!Object.is(r.current[o],b)){if(r.current[o]=b,o==="search")Y(),P(),y(1,H);else if(o==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let _=document.getElementById(V);_?_.focus():(f=document.getElementById(B))==null||f.focus()}if(y(7,()=>{var _;r.current.selectedItemId=(_=K())==null?void 0:_.id,g.emit()}),w||y(5,ee),((S=u.current)==null?void 0:S.value)!==void 0){let _=b??"";(G=(k=u.current).onValueChange)==null||G.call(k,_);return}}g.emit()}},emit:()=>{c.current.forEach(o=>o())}}),[]),T=s.useMemo(()=>({value:(o,b,w)=>{var f;b!==((f=i.current.get(o))==null?void 0:f.value)&&(i.current.set(o,{value:b,keywords:w}),r.current.filtered.items.set(o,v(b,w)),y(2,()=>{P(),g.emit()}))},item:(o,b)=>(l.current.add(o),b&&(n.current.has(b)?n.current.get(b).add(o):n.current.set(b,new Set([o]))),y(3,()=>{Y(),P(),r.current.value||H(),g.emit()}),()=>{i.current.delete(o),l.current.delete(o),r.current.filtered.items.delete(o);let w=K();y(4,()=>{Y(),(w==null?void 0:w.getAttribute("id"))===o&&H(),g.emit()})}),group:o=>(n.current.has(o)||n.current.set(o,new Set),()=>{i.current.delete(o),n.current.delete(o)}),filter:()=>u.current.shouldFilter,label:p||t["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:B,inputId:V,labelId:O,listInnerRef:A}),[]);function v(o,b){var w,f;let S=(f=(w=u.current)==null?void 0:w.filter)!=null?f:ra;return o?S(o,r.current.search,b):0}function P(){if(!r.current.search||u.current.shouldFilter===!1)return;let o=r.current.filtered.items,b=[];r.current.filtered.groups.forEach(f=>{let S=n.current.get(f),k=0;S.forEach(G=>{let _=o.get(G);k=Math.max(_,k)}),b.push([f,k])});let w=A.current;X().sort((f,S)=>{var k,G;let _=f.getAttribute("id"),ue=S.getAttribute("id");return((k=o.get(ue))!=null?k:0)-((G=o.get(_))!=null?G:0)}).forEach(f=>{let S=f.closest(Ne);S?S.appendChild(f.parentElement===S?f:f.closest(`${Ne} > *`)):w.appendChild(f.parentElement===w?f:f.closest(`${Ne} > *`))}),b.sort((f,S)=>S[1]-f[1]).forEach(f=>{var S;let k=(S=A.current)==null?void 0:S.querySelector(`${ie}[${te}="${encodeURIComponent(f[0])}"]`);k==null||k.parentElement.appendChild(k)})}function H(){let o=X().find(w=>w.getAttribute("aria-disabled")!=="true"),b=o==null?void 0:o.getAttribute(te);g.setState("value",b||void 0)}function Y(){var o,b,w,f;if(!r.current.search||u.current.shouldFilter===!1){r.current.filtered.count=l.current.size;return}r.current.filtered.groups=new Set;let S=0;for(let k of l.current){let G=(b=(o=i.current.get(k))==null?void 0:o.value)!=null?b:"",_=(f=(w=i.current.get(k))==null?void 0:w.keywords)!=null?f:[],ue=v(G,_);r.current.filtered.items.set(k,ue),ue>0&&S++}for(let[k,G]of n.current)for(let _ of G)if(r.current.filtered.items.get(_)>0){r.current.filtered.groups.add(k);break}r.current.filtered.count=S}function ee(){var o,b,w;let f=K();f&&(((o=f.parentElement)==null?void 0:o.firstChild)===f&&((w=(b=f.closest(ie))==null?void 0:b.querySelector(ta))==null||w.scrollIntoView({block:"nearest"})),f.scrollIntoView({block:"nearest"}))}function K(){var o;return(o=A.current)==null?void 0:o.querySelector(`${mt}[aria-selected="true"]`)}function X(){var o;return Array.from(((o=A.current)==null?void 0:o.querySelectorAll(Ve))||[])}function ne(o){let b=X()[o];b&&g.setState("value",b.getAttribute(te))}function oe(o){var b;let w=K(),f=X(),S=f.findIndex(G=>G===w),k=f[S+o];(b=u.current)!=null&&b.loop&&(k=S+o<0?f[f.length-1]:S+o===f.length?f[0]:f[S+o]),k&&g.setState("value",k.getAttribute(te))}function le(o){let b=K(),w=b==null?void 0:b.closest(ie),f;for(;w&&!f;)w=o>0?ua(w,ie):ma(w,ie),f=w==null?void 0:w.querySelector(Ve);f?g.setState("value",f.getAttribute(te)):oe(o)}let j=()=>ne(X().length-1),F=o=>{o.preventDefault(),o.metaKey?j():o.altKey?le(1):oe(1)},D=o=>{o.preventDefault(),o.metaKey?ne(0):o.altKey?le(-1):oe(-1)};return s.createElement(L.div,{ref:a,tabIndex:-1,...I,"cmdk-root":"",onKeyDown:o=>{var b;(b=I.onKeyDown)==null||b.call(I,o);let w=o.nativeEvent.isComposing||o.keyCode===229;if(!(o.defaultPrevented||w))switch(o.key){case"n":case"j":{R&&o.ctrlKey&&F(o);break}case"ArrowDown":{F(o);break}case"p":case"k":{R&&o.ctrlKey&&D(o);break}case"ArrowUp":{D(o);break}case"Home":{o.preventDefault(),ne(0);break}case"End":{o.preventDefault(),j();break}case"Enter":{o.preventDefault();let f=K();if(f){let S=new Event(Pe);f.dispatchEvent(S)}}}}},s.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:ha},p),be(t,o=>s.createElement(ft.Provider,{value:g},s.createElement(pt.Provider,{value:T},o))))}),aa=s.forwardRef((t,a)=>{var r,l;let n=se(),i=s.useRef(null),c=s.useContext(ht),u=de(),p=xt(t),d=(l=(r=p.current)==null?void 0:r.forceMount)!=null?l:c==null?void 0:c.forceMount;Z(()=>{if(!d)return u.item(n,c==null?void 0:c.id)},[d]);let m=vt(n,i,[t.value,t.children,i],t.keywords),h=Ae(),C=Q(y=>y.value&&y.value===m.current),N=Q(y=>d||u.filter()===!1?!0:y.search?y.filtered.items.get(n)>0:!0);s.useEffect(()=>{let y=i.current;if(!(!y||t.disabled))return y.addEventListener(Pe,x),()=>y.removeEventListener(Pe,x)},[N,t.onSelect,t.disabled]);function x(){var y,g;E(),(g=(y=p.current).onSelect)==null||g.call(y,m.current)}function E(){h.setState("value",m.current,!0)}if(!N)return null;let{disabled:R,value:I,onSelect:B,forceMount:O,keywords:V,...A}=t;return s.createElement(L.div,{ref:ce(i,a),...A,id:n,"cmdk-item":"",role:"option","aria-disabled":!!R,"aria-selected":!!C,"data-disabled":!!R,"data-selected":!!C,onPointerMove:R||u.getDisablePointerSelection()?void 0:E,onClick:R?void 0:x},t.children)}),sa=s.forwardRef((t,a)=>{let{heading:r,children:l,forceMount:n,...i}=t,c=se(),u=s.useRef(null),p=s.useRef(null),d=se(),m=de(),h=Q(N=>n||m.filter()===!1?!0:N.search?N.filtered.groups.has(c):!0);Z(()=>m.group(c),[]),vt(c,u,[t.value,t.heading,p]);let C=s.useMemo(()=>({id:c,forceMount:n}),[n]);return s.createElement(L.div,{ref:ce(u,a),...i,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&s.createElement("div",{ref:p,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),be(t,N=>s.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},s.createElement(ht.Provider,{value:C},N))))}),na=s.forwardRef((t,a)=>{let{alwaysRender:r,...l}=t,n=s.useRef(null),i=Q(c=>!c.search);return!r&&!i?null:s.createElement(L.div,{ref:ce(n,a),...l,"cmdk-separator":"",role:"separator"})}),oa=s.forwardRef((t,a)=>{let{onValueChange:r,...l}=t,n=t.value!=null,i=Ae(),c=Q(d=>d.search),u=Q(d=>d.selectedItemId),p=de();return s.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),s.createElement(L.input,{ref:a,...l,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":p.listId,"aria-labelledby":p.labelId,"aria-activedescendant":u,id:p.inputId,type:"text",value:n?t.value:c,onChange:d=>{n||i.setState("search",d.target.value),r==null||r(d.target.value)}})}),la=s.forwardRef((t,a)=>{let{children:r,label:l="Suggestions",...n}=t,i=s.useRef(null),c=s.useRef(null),u=Q(d=>d.selectedItemId),p=de();return s.useEffect(()=>{if(c.current&&i.current){let d=c.current,m=i.current,h,C=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let N=d.offsetHeight;m.style.setProperty("--cmdk-list-height",N.toFixed(1)+"px")})});return C.observe(d),()=>{cancelAnimationFrame(h),C.unobserve(d)}}},[]),s.createElement(L.div,{ref:ce(i,a),...n,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":l,id:p.listId},be(t,d=>s.createElement("div",{ref:ce(c,p.listInnerRef),"cmdk-list-sizer":""},d)))}),ia=s.forwardRef((t,a)=>{let{open:r,onOpenChange:l,overlayClassName:n,contentClassName:i,container:c,...u}=t;return s.createElement(or,{open:r,onOpenChange:l},s.createElement(lr,{container:c},s.createElement(ir,{"cmdk-overlay":"",className:n}),s.createElement(cr,{"aria-label":t.label,"cmdk-dialog":"",className:i},s.createElement(gt,{ref:a,...u}))))}),ca=s.forwardRef((t,a)=>Q(r=>r.filtered.count===0)?s.createElement(L.div,{ref:a,...t,"cmdk-empty":"",role:"presentation"}):null),da=s.forwardRef((t,a)=>{let{progress:r,children:l,label:n="Loading...",...i}=t;return s.createElement(L.div,{ref:a,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},be(t,c=>s.createElement("div",{"aria-hidden":!0},c)))}),M=Object.assign(gt,{List:la,Item:aa,Input:oa,Group:sa,Separator:na,Dialog:ia,Empty:ca,Loading:da});function ua(t,a){let r=t.nextElementSibling;for(;r;){if(r.matches(a))return r;r=r.nextElementSibling}}function ma(t,a){let r=t.previousElementSibling;for(;r;){if(r.matches(a))return r;r=r.previousElementSibling}}function xt(t){let a=s.useRef(t);return Z(()=>{a.current=t}),a}var Z=typeof window>"u"?s.useEffect:s.useLayoutEffect;function re(t){let a=s.useRef();return a.current===void 0&&(a.current=t()),a}function Q(t){let a=Ae(),r=()=>t(a.snapshot());return s.useSyncExternalStore(a.subscribe,r,r)}function vt(t,a,r,l=[]){let n=s.useRef(),i=de();return Z(()=>{var c;let u=(()=>{var d;for(let m of r){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(d=m.current.textContent)==null?void 0:d.trim():n.current}})(),p=l.map(d=>d.trim());i.value(t,u,p),(c=a.current)==null||c.setAttribute(te,u),n.current=u}),n}var pa=()=>
11{let[t,a]=s.useState(),r=re(()=>new Map);return Z(()=>{r.current.forEach(l=>l()),r.current=new Map},[t]),(l,n)=>{r.current.set(l,n),a({})}};function fa(t){let a=t.type;return typeof a=="function"?a(t.props):"render"in a?a.render(t.props):t}function be({asChild:t,children:a},r){return t&&s.isValidElement(a)?s.cloneElement(fa(a),{ref:a.ref},r(a.props.children)):r(a)}var ha={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const bt=s.forwardRef(({className:t,...a},r)=>e.jsx(M,{ref:r,className:U("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...a}));bt.displayName=M.displayName;const yt=s.forwardRef(({className:t,...a},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Te,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(M.Input,{ref:r,className:U("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...a})]}));yt.displayName=M.Input.displayName;const jt=s.forwardRef(({className:t,...a},r)=>e.jsx(M.List,{ref:r,className:U("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...a}));jt.displayName=M.List.displayName;const wt=s.forwardRef((t,a)=>e.jsx(M.Empty,{ref:a,className:"py-6 text-center text-sm",...t}));wt.displayName=M.Empty.displayName;const Ct=s.forwardRef(({className:t,...a},r)=>e.jsx(M.Group,{ref:r,className:U("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...a}));Ct.displayName=M.Group.displayName;const ga=s.forwardRef(({className:t,...a},r)=>e.jsx(M.Separator,{ref:r,className:U("-mx-1 h-px bg-border",t),...a}));ga.displayName=M.Separator.displayName;const Nt=s.forwardRef(({className:t,...a},r)=>e.jsx(M.Item,{ref:r,className:U("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...a}));Nt.displayName=M.Item.displayName;var St="Toggle",De=s.forwardRef((t,a)=>{const{pressed:r,defaultPressed:l,onPressedChange:n,...i}=t,[c,u]=ge({prop:r,onChange:n,defaultProp:l??!1,caller:St});return e.jsx(L.button,{type:"button","aria-pressed":c,"data-state":c?"on":"off","data-disabled":t.disabled?"":void 0,...i,ref:a,onClick:q(t.onClick,()=>{t.disabled||u(!c)})})});De.displayName=St;var kt=De,J="ToggleGroup",[Pt,bs]=Be(J,[tt]),Rt=tt(),Me=z.forwardRef((t,a)=>{const{type:r,...l}=t;if(r==="single"){const n=l;return e.jsx(xa,{...n,ref:a})}if(r==="multiple"){const n=l;return e.jsx(va,{...n,ref:a})}throw new Error(`Missing prop \`type\` expected on \`${J}\``)});Me.displayName=J;var[It,Et]=Pt(J),xa=z.forwardRef((t,a)=>{const{value:r,defaultValue:l,onValueChange:n=()=>{},...i}=t,[c,u]=ge({prop:r,defaultProp:l??"",onChange:n,caller:J});return e.jsx(It,{scope:t.__scopeToggleGroup,type:"single",value:z.useMemo(()=>c?[c]:[],[c]),onItemActivate:u,onItemDeactivate:z.useCallback(()=>u(""),[u]),children:e.jsx(Tt,{...i,ref:a})})}),va=z.forwardRef((t,a)=>{const{value:r,defaultValue:l,onValueChange:n=()=>{},...i}=t,[c,u]=ge({prop:r,defaultProp:l??[],onChange:n,caller:J}),p=z.useCallback(m=>u((h=[])=>[...h,m]),[u]),d=z.useCallback(m=>u((h=[])=>h.filter(C=>C!==m)),[u]);return e.jsx(It,{scope:t.__scopeToggleGroup,type:"multiple",value:c,onItemActivate:p,onItemDeactivate:d,children:e.jsx(Tt,{...i,ref:a})})});Me.displayName=J;var[ba,ya]=Pt(J),Tt=z.forwardRef((t,a)=>{const{__scopeToggleGroup:r,disabled:l=!1,rovingFocus:n=!0,orientation:i,dir:c,loop:u=!0,...p}=t,d=Rt(r),m=jr(c),h={role:"group",dir:m,...p};return e.jsx(ba,{scope:r,rovingFocus:n,disabled:l,children:n?e.jsx(br,{asChild:!0,...d,orientation:i,dir:m,loop:u,children:e.jsx(L.div,{...h,ref:a})}):e.jsx(L.div,{...h,ref:a})})}),he="ToggleGroupItem",_t=z.forwardRef((t,a)=>{const r=Et(he,t.__scopeToggleGroup),l=ya(he,t.__scopeToggleGroup),n=Rt(t.__scopeToggleGroup),i=r.value.includes(t.value),c=l.disabled||t.disabled,u={...t,pressed:i,disabled:c},p=z.useRef(null);return l.rovingFocus?e.jsx(yr,{asChild:!0,...n,focusable:!c,active:i,ref:p,children:e.jsx(He,{...u,ref:a})}):e.jsx(He,{...u,ref:a})});_t.displayName=he;var He=z.forwardRef((t,a)=>{const{__scopeToggleGroup:r,value:l,...n}=t,i=Et(he,r),c={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},u=i.type==="single"?c:void 0;
11return e.jsx(De,{...u,...n,ref:a,onPressedChange:p=>{p?i.onItemActivate(l):i.onItemDeactivate(l)}})}),At=Me,Dt=_t;const Mt=qt("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),ja=s.forwardRef(({className:t,variant:a,size:r,...l},n)=>e.jsx(kt,{ref:n,className:U(Mt({variant:a,size:r,className:t})),...l}));ja.displayName=kt.displayName;const Gt=s.createContext({size:"default",variant:"default"}),Ot=s.forwardRef(({className:t,variant:a,size:r,children:l,...n},i)=>e.jsx(At,{ref:i,className:U("flex items-center justify-center gap-1",t),...n,children:e.jsx(Gt.Provider,{value:{variant:a,size:r},children:l})}));Ot.displayName=At.displayName;const Re=s.forwardRef(({className:t,children:a,variant:r,size:l,...n},i)=>{const c=s.useContext(Gt);return e.jsx(Dt,{ref:i,className:U(Mt({variant:c.variant||r,size:c.size||l}),t),...n,children:a})});Re.displayName=Dt.displayName;function wa(){return Ue({mutationFn:async({agentId:t,topic:a,vibe:r})=>{const{data:l,error:n}=await Ie.functions.invoke("ai-agent-meme-ideas",{body:{agent_id:t,topic:a,vibe:r}});if(n)throw n;return l}})}function Ca(t=!0){return Ut({queryKey:["memelord-credits"],queryFn:async()=>{const{data:a,error:r}=await Ie.functions.invoke("memelord-credits",{method:"GET"});if(r)throw r;return a},enabled:t,staleTime:3e4})}function Na(){const t=Kt();return Ue({mutationFn:async a=>{const{data:r,error:l}=await Ie.functions.invoke("memelord-credits",{method:"POST",body:{total_credits_purchased:a}});if(l)throw l;return r},onSuccess:()=>{t.invalidateQueries({queryKey:["memelord-credits"]})}})}function Sa({agent:t,open:a,onOpenChange:r,onGenerate:l,isRunning:n}){const[i,c]=s.useState(""),[u,p]=s.useState([]),[d,m]=s.useState(new Set),[h,C]=s.useState("brainstorm"),[N,x]=s.useState(""),[E,R]=s.useState("mix"),[I,B]=s.useState("image"),{toast:O}=Ke(),{mutateAsync:V,isPending:A}=wa(),{data:y,isLoading:g}=Ca(a),{mutateAsync:T,isPending:v}=Na(),P=(y==null?void 0:y.remaining)??null,H=d.size,Y=H*(I==="video"?5:1),ee=P!==null&&P<Y,K=()=>{c(""),p([]),m(new Set),C("brainstorm"),R("mix"),B("image")},X=async()=>{try{const j=await V({agentId:t.id,topic:i.trim()||void 0,vibe:E});j.ideas&&j.ideas.length>0?(p(j.ideas),m(new Set(j.ideas.map((F,D)=>D))),C("select")):O({title:"No ideas generated",description:"Try a different topic hint.",variant:"destructive"})}catch(j){O({title:"Error",description:j instanceof Error?j.message:"Failed to get ideas",variant:"destructive"})}},ne=j=>{m(F=>{const D=new Set(F);return D.has(j)?D.delete(j):D.add(j),D})},oe=async()=>{const j=u.filter((D,o)=>d.has(o));if(j.length===0)return;r(!1);const F=I==="video"?"video meme":"meme";O({title:`Generating ${j.length} ${F}${j.length>1?"s":""}`,description:I==="video"?"Videos take longer to render. They'll appear in your content queue when ready.":"They'll appear in your content queue shortly."});try{await l(t,{category:E,format:I,prompts:j.map(D=>({prompt:D.prompt,caption:D.description,pain_point:D.pain_point}))})}catch{}K()},le=j=>{j||K(),r(j)};return e.jsx(Je,{open:a,onOpenChange:le,children:e.jsxs(Ye,{className:"sm:max-w-lg max-h-[85vh] flex flex-col",children:[e.jsx(Xe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ze,{className:"flex items-center gap-2",children:h==="brainstorm"?e.jsxs(e.Fragment,{children:[e.jsx(Ge,{className:"h-5 w-5 text-yellow-400"})," Brainstorm Meme Ideas"]}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"h-5 w-5 text-pink-400"})," Select & Generate"]})}),!g&&P!==null&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(Ee,{variant:P<=0?"de
11structive":P<=5?"secondary":"outline",className:"flex items-center gap-1 text-xs",children:[e.jsx(Ar,{className:"h-3 w-3"}),P," credit",P!==1?"s":""," left"]}),e.jsxs(mr,{children:[e.jsx(pr,{asChild:!0,children:e.jsx($,{variant:"ghost",size:"icon",className:"h-6 w-6",children:e.jsx(rt,{className:"h-3.5 w-3.5"})})}),e.jsx(fr,{className:"w-64",align:"end",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm font-medium",children:"Manage Credits"}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("p",{children:["Purchased: ",(y==null?void 0:y.total_purchased)??0]}),e.jsxs("p",{children:["Used: ",(y==null?void 0:y.total_used)??0]}),e.jsxs("p",{children:["Remaining: ",P]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(W,{className:"text-xs",children:"Total purchased credits"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(dr,{type:"number",min:0,value:N,onChange:j=>x(j.target.value),placeholder:String((y==null?void 0:y.total_purchased)??0),className:"h-8 text-sm"}),e.jsx($,{size:"sm",className:"h-8",disabled:!N||v,onClick:async()=>{try{await T(Number(N)),x(""),O({title:"Credits updated"})}catch{O({title:"Failed to update credits",variant:"destructive"})}},children:v?e.jsx(ae,{className:"h-3 w-3 animate-spin"}):"Save"})]})]})]})})]})]})]})}),h==="brainstorm"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-muted bg-muted/30 p-3 text-sm text-muted-foreground flex gap-2",children:[e.jsx(wr,{className:"h-4 w-4 shrink-0 mt-0.5 text-yellow-500"}),e.jsx("span",{children:"AI will generate 8 meme ideas based on your site content and proptech pain points. You'll pick which ones to render."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Format"}),e.jsxs(Ot,{type:"single",value:I,onValueChange:j=>j&&B(j),className:"justify-start",children:[e.jsxs(Re,{value:"image",className:"gap-1.5 data-[state=on]:bg-primary/10 data-[state=on]:text-primary",children:[e.jsx(Cr,{className:"h-4 w-4"})," Image Memes"]}),e.jsxs(Re,{value:"video",className:"gap-1.5 data-[state=on]:bg-primary/10 data-[state=on]:text-primary",children:[e.jsx(Sr,{className:"h-4 w-4"})," Video Memes"]})]}),I==="video"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Video memes cost 5 credits each (vs 1 for images). Rendering takes 1-2 minutes per video â they'll appear in your content queue when ready."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Vibe"}),e.jsxs(hr,{value:E,onValueChange:j=>R(j),children:[e.jsx(gr,{className:"w-full",children:e.jsx(xr,{})}),e.jsxs(vr,{children:[e.jsx(ye,{value:"mix",children:"Mix of Both (default)"}),e.jsx(ye,{value:"trending",children:"Trending & Timely"}),e.jsx(ye,{value:"classic",children:"Evergreen Classics"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Topic hint (optional)"}),e.jsx(me,{placeholder:"e.g. move-in season chaos, maintenance request memes, WiFi complaints",value:i,onChange:j=>c(j.target.value),rows:2})]})]}):e.jsxs("div",{className:"space-y-3 overflow-y-auto flex-1 min-h-0 pr-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[H," of ",u.length," selected"]}),P!==null&&e.jsxs("span",{className:ee?"text-destructive font-medium":"",children:["Cost: ",Y," credit",Y!==1?"s":"",I==="video"&&e.jsx("span",{className:"text-xs ml-1",children:"(5 per video)"}),ee&&" â insufficient credits!"]})]}),u.map((j,F)=>e.jsxs("label",{className:`flex gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${d.has(F)?"border-primary/50 bg-primary/5":"border-muted hover:border-muted-foreground/30"}`,children:[e.jsx(ur,{checked:d.has(F),onCheckedChange:()=>ne(F),className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:j.idea}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:j.description}),j.overlay_text&&e.jsxs("p",{className:"text-xs italic text-foreground
11/70 mt-1",children:['"',j.overlay_text,'"']}),e.jsx("div",{className:"flex gap-2 mt-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:j.pain_point})})]})]},F))]}),e.jsxs(et,{className:"gap-2",children:[h==="select"&&e.jsx($,{variant:"ghost",size:"sm",onClick:()=>C("brainstorm"),className:"mr-auto",children:"â Back"}),e.jsx($,{variant:"outline",onClick:()=>le(!1),children:"Cancel"}),h==="brainstorm"?e.jsxs($,{onClick:X,disabled:A,children:[A?e.jsx(ae,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(Ge,{className:"h-4 w-4 mr-1"}),"Get Ideas"]}):e.jsxs($,{onClick:oe,disabled:H===0||n||ee,children:[n?e.jsx(ae,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(Oe,{className:"h-4 w-4 mr-1"}),"Generate ",H," ",I==="video"?"Video":"Meme",H!==1?"s":""]})]})]})})}const ka={research:Te,blog_writer:Se,blog_remix:Jt,site_audit:kr,seo:Pr,competitor_tracker:at,meme_generator:Dr},Pa={research:"border-blue-500/30 text-blue-400",blog_writer:"border-green-500/30 text-green-400",blog_remix:"border-purple-500/30 text-purple-400",site_audit:"border-orange-500/30 text-orange-400",seo:"border-cyan-500/30 text-cyan-400",competitor_tracker:"border-red-500/30 text-red-400",meme_generator:"border-pink-500/30 text-pink-400"},Ra={research:{label:"Research topic",placeholder:"e.g. smart parking trends 2026"},blog_writer:{label:"Blog topic or brief",placeholder:"e.g. Water leak detection for multifamily"},blog_remix:{label:"Post ID or slug to remix",placeholder:"e.g. smart-thermostat-roi"},site_audit:{label:"Focus area (optional)",placeholder:"e.g. competitor pages"},seo:{label:"Target page (optional)",placeholder:"e.g. /pricing"},competitor_tracker:{label:"Focus area (optional)",placeholder:"e.g. pricing changes"},meme_generator:{label:"Topic hint (optional)",placeholder:"e.g. move-in season, maintenance requests"}};function Ia({agent:t,schedule:a,onRunNow:r,isRunning:l}){const[n,i]=s.useState(!1),[c,u]=s.useState(!1),[p,d]=s.useState(""),[m,h]=s.useState([]),[C,N]=s.useState(""),x=t.type==="meme_generator",E=t.type==="blog_remix",{data:R}=We(),I=(R||[]).filter(g=>g.status==="published"),B=ka[t.type]||Te,O=Pa[t.type]||"border-muted-foreground/30 text-muted-foreground",V=Ra[t.type],A=g=>{h(T=>T.includes(g)?T.filter(v=>v!==g):[...T,g])},y=async()=>{if(E){const g={};m.length>0&&(g.post_ids=m),p.trim()&&(g.topic=p.trim());const T=C.split(` 12`).map(v=>v.trim()).filter(Boolean);T.length>0&&(g.external_urls=T),await r(t,Object.keys(g).length?g:void 0)}else{const g=p.trim()?{topic:p.trim()}:void 0;await r(t,g)}d(""),h([]),N(""),i(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(Br,{openDelay:200,closeDelay:100,children:[e.jsx(qr,{asChild:!0,children:e.jsxs($,{variant:"outline",size:"sm",className:`gap-1.5 rounded-full border ${O} bg-transparent hover:bg-accent/50`,disabled:!t.is_enabled,children:[e.jsx(B,{className:"h-3.5 w-3.5"}),t.name]})}),e.jsxs(dt,{side:"bottom",align:"start",className:"w-72 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm text-foreground",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.description})]}),e.jsx(Ee,{variant:t.is_enabled?"default":"secondary",className:"text-[10px] shrink-0",children:t.is_enabled?"Active":"Off"})]}),a&&e.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5",children:[a.last_run_at&&e.jsxs("p",{children:["Last: ",Fe(new Date(a.last_run_at),"MMM d, h:mm a")]}),a.next_run_at&&e.jsxs("p",{children:["Next: ",Fe(new Date(a.next_run_at),"MMM d, h:mm a")]}),t.schedule_cron&&e.jsxs("p",{className:"font-mono text-[10px]",children:["Cron: ",t.schedule_cron]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx($,{variant:"ghost",size:"sm",className:"flex-1 h-8 text-xs",asChild:!0,children:e.jsxs(Qe,{to:`/admin/agents/${t.id}`,children:[e.jsx(rt,{className:"h-3 w-3 mr-1"})," Config"]})}),e.jsxs($,{size:"sm",className:"flex-1 h-8 text-xs",disabled:!t.is_enabled||l,onClick:()=>x?u(!0):i(!0),children:[l?e.jsx(ae,{className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Wt,{className:"h-3 w-3 mr-1"}),"Run Now"]})]})]})]}),e.jsx(Je,{open:n,onOpenChange:i,children:e.jsxs(Ye,{className:"sm:max-w-lg",children:[e.jsx(Xe,{children:e.jsxs(Ze,{children:["Run ",t.name]})}),E?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(W,{children:["Select posts to remix ",m.length>0&&e.jsxs("span",{className:"text-muted-foreground",children:["(",m.length," selected)"]})]}),e.jsxs(bt,{className:"border rounded-md overflow-hidden",children:[e.jsx(yt,{placeholder:"Search posts..."}),e.jsxs(jt,{className:"max-h-[200px] overflow-y-auto",children:[e.jsx(wt,{children:"No posts found."}),e.jsx(Ct,{children:I.map(g=>e.jsxs(Nt,{value:g.title,onSelect:()=>A(g.id),className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(Qt,{className:`h-3.5 w-3.5 shrink-0 ${m.includes(g.id)?"opacity-100":"opacity-0"}`}),e.jsx("span",{className:"truncate",children:g.title})]},g.id))})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Exter
12nal URLs (one per line)"}),e.jsx(me,{placeholder:`e.g. https://competitor.com/blog/smart-home-trends 13https://example.com/article`,value:C,onChange:g=>N(g.target.value),rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Remix instructions (optional)"}),e.jsx(me,{placeholder:"e.g. Target senior living audience",value:p,onChange:g=>d(g.target.value),rows:3})]})]}):V?e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:V.label}),e.jsx(me,{placeholder:V.placeholder,value:p,onChange:g=>d(g.target.value),rows:3})]}):null,e.jsxs(et,{children:[e.jsx($,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsxs($,{onClick:y,disabled:l,children:[l&&e.jsx(ae,{className:"h-4 w-4 animate-spin mr-1"}),"Start"]})]})]})}),x&&e.jsx(Sa,{agent:t,open:c,onOpenChange:u,onGenerate:r,isRunning:l})]})}function ys(){const{data:t=[]}=Yt(),{data:a=[]}=We(),{data:r,isLoading:l}=Zt(),{data:n}=er(),i=tr(),{data:c}=rr("pending"),u=ar(),p=sr(),{toast:d}=Ke(),[m,h]=s.useState(null),[C,N]=s.useState(null),[x,E]=s.useState(null),R=t.filter(v=>v.is_enabled).length,I=a.filter(v=>v.status==="published").length,B=a.filter(v=>v.status==="draft").length,O=[{label:"Total Pages",value:t.length,icon:Tr},{label:"Enabled Pages",value:R,icon:at},{label:"Disabled Pages",value:t.length-R,icon:_r},{label:"Published Posts",value:I,icon:Se},{label:"Draft Posts",value:B,icon:Se}],V=async(v,P)=>{h(v.id);try{await i.mutateAsync({agentId:v.id,type:v.type,params:P}),d({title:"Agent started",description:`${v.name} is running.`})}catch(H){d({title:"Error",description:H.message,variant:"destructive"})}finally{h(null)}},A=async v=>{N(v.id);try{await p.mutateAsync(v),d({title:"Published!"})}catch(P){d({title:"Error",description:P.message,variant:"destructive"})}finally{N(null)}},y=async v=>{try{await u.mutateAsync({id:v.id,status:"rejected"}),d({title:"Rejected"})}catch(P){d({title:"Error",description:P.message,variant:"destructive"})}},g=(c==null?void 0:c.slice(0,5))??[],T=(c==null?void 0:c.length)??0;return e.jsxs(nr,{children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground mb-6 font-display",children:"Dashboard"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:O.map(v=>e.jsxs("div",{className:"p-5 rounded-lg border border-border bg-card space-y-2",children:[e.jsx(v.icon,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("p",{className:"text-2xl font-semibold text-card-foreground",children:v.value}),e.jsx("p",{className:"text-xs text-muted-foreground",children:v.label})]},v.label))}),e.jsxs("div",{className:"mt-8",children:[e.jsxs("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2 mb-3",children:[e.jsx(Nr,{className:"h-4 w-4"})," Quick Run"]}),l?e.jsx(ae,{className:"h-5 w-5 animate-spin text-muted-foreground"}):e.jsx("div",{className:"flex flex-wrap gap-2",children:r==null?void 0:r.map(v=>e.jsx(Ia,{agent:v,schedule:n==null?void 0:n.find(P=>P.agent_id===v.id),onRunNow:V,isRunning:m===v.id},v.id))})]}),e.jsxs("div",{className:"mt-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsxs("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2",children:[e.jsx(Rr,{className:"h-4 w-4"})," Pending Review"]}),T>0&&e.jsx(Ee,{variant:"secondary",children:T})]}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No pending items."}):e.jsxs("div",{className:"space-y-2",children:[g.map(v=>e.jsx(Ir,{item:v,onApprove:A,onReject:y,onPreview:E,onEdit:()=>{},isPublishing:C===v.id},v.id)),T>5&&e.jsx($,{variant:"link",size:"sm",className:"mt-1",asChild:!0,children:e.jsxs(Qe,{to:"/admin/agents",children:["View all ",T," items ",e.jsx(Xt,{className:"h-3 w-3 ml-1"})]})})]})]}),e.jsx(Er,{item:x,open:!!x,onOpenChange:v=>!v&&E(null)})]})}export{ys as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.