1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4861],{700:e=>{e.exports={style:{fontFamily:"'Poppins', 'Poppins Fallback'",fontStyle:"normal"},className:"__className_6bee3b"}},17060:(e,o,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/monitors",function(){return s(78262)}])},78262:(e,o,s)=>{"use strict";s.r(o),s.d(o,{default:()=>y});var t=s(37876),n=s(700),l=s.n(n),i=s(14232),r=s(44681),a=s(80581),d=s(21389),c=s(73193),u=s(82209),m=s(25521),p=s(6275),f=s(48239),g=s(89099),h=s(89359),x=s(8563),b=s(89750);function y(){let[e,o]=(0,i.useState)(!1),[s,n]=(0,i.useState)(null),{monitors:y,createMonitor:j,updateMonitor:N,deleteMonitor:v,areMonitorsLoading:w,statuses:_,startPolling:M,fetchMonitors:k}=(0,c.f)(),{projects:P,setCurrentProject:A,currentProject:C}=(0,x.Y)(),{personas:E}=(0,m.v)(),[S,F]=(0,i.useState)(null),{savePrompts:I}=(0,u.F)(),L=(0,i.useRef)(new Set),T=(0,g.useRouter)(),{isAuthenticated:O,isAuthStateLoading:Y,isPaid:R,signOut:X}=(0,h.A)(),{user:z}=(0,h.A)();(0,i.useEffect)(()=>{O||Y||T.replace("/auth/login")},[Y,O]),(0,i.useEffect)(()=>{y&&y.length>0&&y.forEach(e=>{e.id&&!L.current.has(e.id)&&(console.log("Starting polling for monitor on monitors page:",e.id),L.current.add(e.id),M(e.id))})},[y,M]);let B=e=>{let o=y.find(o=>o.id===e);if(o&&o.project_id!==(null==C?void 0:C.id)){let e=P.find(e=>e.id===o.project_id);e&&A(e)}T.push("/monitor?id=".concat(e))},D=(e,s)=>{e.stopPropagation(),n(s),o(!0)},G=(e,o)=>{e.stopPropagation();let s=y.find(e=>e.id===o);s&&window.confirm('Are you sure you want to delete the monitor "'.concat(s.name,'"?'))&&(F(o),v(o,()=>{console.log("Monitor deleted successfully"),F(null)},e=>{console.log("Monitor deletion failed",e),F(null),alert("Failed to delete monitor. Please try again.")}))},J=()=>{n(null),o(!0)},U=async e=>{fetch("/api/monitors/run_batch_common_job",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:null==z?void 0:z.id,projectId:null==C?void 0:C.id,monitorId:e})}),T.push("/dashboard")},q=e=>{let o=E.find(o=>o.id===e);return o?o.name:"Unknown Persona"};return(console.log("monitors",y),w)?(0,t.jsx)(p.A,{message:"Loading Monitors..."}):(0,t.jsxs)("div",{className:l().className,children:[(0,t.jsx)(b.A,{}),(0,t.jsxs)("main",{className:"py-10 pl-6 pr-6 lg:pl-32 lg:pr-12",children:[(0,t.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-3xl font-bold mb-2",children:"Monitors"}),(0,t.jsx)("p",{className:"text-gray-600",children:"Track and analyze brand mentions across LLMs"})]}),(0,t.jsxs)("button",{onClick:J,className:"px-4 py-2 bg-[#0080ff] text-white rounded-lg flex items-center gap-2 font-medium hover:bg-[#0066cc] transition-colors hover:cursor-pointer",children:[(0,t.jsx)(r.A,{className:"h-5 w-5"}),"Add Monitor"]})]}),y&&y.length>0?(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6",children:y.map(e=>(0,t.jsx)(f.A,{monitor:e,onClick:B,onEdit:D,onDelete:G,getPersonaNameById:q,deletingMonitorId:S,statuses:_},e.id))}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 bg-white rounded-lg border border-gray-200 shadow-sm text-center",children:[(0,t.jsx)("div",{className:"w-20 h-20 bg-blue-100 rounded-full flex items-center justify-center mb-6",children:(0,t.jsx)(a.A,{className:"h-10 w-10 text-[#0080ff]"})}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"No Monitors Yet"}),(0,t.jsx)("p",{className:"text-gray-600 max-w-md mb-8",children:"Monitors help you track your brand visibility across LLMs. Create your first monitor to start tracking mentions."}),(0,t.jsxs)("button",{onClick:J,className:"px-6 py-3 bg-[#0080ff] text-white rounded-lg flex items-center gap-2 font-medium hover:bg-[#0066cc] transition-colors hover:cursor-pointer",children:[(0,t.jsx)(r.A,{className:"h-5 w-5"}),"Create Your First Monitor"]})]})]}),(0,t.jsx)(d.A,{open:e,onClose:()=>o(!1),onSave:(e,o,t)=>{s?N(e,()=>{console.log("Monitor updated successfully"),o&&o()},e=>{console.log("Monitor update failed",e),t&&t(e)}):j(e,s=>{I(s,e.prompts,null==e?void 0:e.language,(null==e?void 0:e.location)||"Global",()=>{console.log("Prompts saved successfully"),k(!0),o&&o(),U(s)},e=>{console.log("Prompt saving failed",e),t&&t(e)})},e=>{console.log("Monitor creation failed",e),t&&t(e)})},editingMonitor:s,personas:E})]})]})}}},e=>{var o=o=>e(e.s=o);e.O(0,[4587,8989,8036,2285,9924,3345,6049,8270,7369,6769,636,6593,8792],()=>o(17060)),_N_E=e.O()}]);
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.