PageSourceSearch

https://app.ordify.ai/_next/static/chunks/3259.620a4d79963f350d.js

js ordify.ai collected 2026-10-05 13:11:08 UTC 29,969 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3259],{73259:(e,r,t)=>{t.r(r),t.d(r,{JobExplorer:()=>B});var a=t(37876),s=t(89099),i=t(14232),n=t(25016),o=t(97736),l=t(19508),d=t(54352),c=t(92871),u=t(78642),m=t(20046),x=t(41367),p=t(89198),g=t(63302),h=t(61970),b=t(77514),f=t(98490),v=t(9775),w=t(63921),y=t(77949),j=t(74871),k=t(4728),N=t(44295),_=t(38866);function C(e,r){return!!r&&"organization"===e}var $=t(27561),E=t(70368),S=t(82727),A=t(388),z=t(25540),D=t(18490);function O({task:e,agents:r,tasks:t}){let s=(0,j.xh)();if(!e)return(0,a.jsx)("div",{className:"text-center py-10",children:(0,a.jsx)("p",{className:`${s.text.muted}`,children:"No task selected"})});let{config:i}=e,n=r.find(e=>e.id===i.agent_id),o=i.dependencies?.map(e=>{let r=t.find(r=>r.id===e);return r?r.config.name:"Unknown task"})||[];return(0,a.jsxs)("div",{className:`space-y-6 max-w-3xl mx-auto ${s.modal.section} ${s.border.default} border rounded-lg p-6 max-h-[80vh] overflow-y-auto`,children:[(0,a.jsx)("div",{children:(0,a.jsx)("h3",{className:`text-xl font-semibold ${s.text.primary}`,children:i.name})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:`text-sm font-medium ${s.text.primary} mb-2 uppercase tracking-wider`,children:"Description"}),(0,a.jsx)("div",{className:`${s.modal.input} rounded-lg p-4`,children:(0,a.jsx)("p",{className:`${s.text.muted} text-sm whitespace-pre-line max-h-[150px] overflow-y-auto`,children:i.description})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:`text-sm font-medium ${s.text.primary} mb-2 uppercase tracking-wider`,children:"Assigned Agent"}),(0,a.jsx)("div",{className:`${s.modal.input} rounded-lg p-4 flex items-center gap-3`,children:n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:`w-8 h-8 rounded-full overflow-hidden ${s.background.secondary} flex items-center justify-center ${s.text.primary} font-semibold`,children:n.config.agent_image_url?(0,a.jsx)("img",{src:n.config.agent_image_url,alt:n.config.role,className:"w-full h-full object-cover"}):n.config.role.charAt(0)}),(0,a.jsx)("div",{children:(0,a.jsx)("p",{className:`${s.text.muted} text-sm`,children:n.config.role})})]}):(0,a.jsx)("p",{className:`${s.text.muted} text-sm`,children:"No agent assigned"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:`text-sm font-medium ${s.text.primary} mb-2 uppercase tracking-wider`,children:"Expected Output"}),(0,a.jsx)("div",{className:`${s.modal.input} rounded-lg p-4`,children:(0,a.jsx)("p",{className:`${s.text.muted} text-sm whitespace-pre-line max-h-[150px] overflow-y-auto`,children:i.expected_output})})]}),i.output_file&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:`text-sm font-medium ${s.text.primary} mb-2 uppercase tracking-wider`,children:"Output File"}),(0,a.jsx)("div",{className:`${s.modal.input} rounded-lg p-4`,children:(0,a.jsx)("p",{className:`${s.text.muted} text-sm font-mono`,children:i.output_file})})]}),o.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:`text-sm font-medium ${s.text.primary} mb-2 uppercase tracking-wider`,children:"Dependencies"}),(0,a.jsx)("div",{className:`${s.modal.input} rounded-lg p-4`,children:(0,a.jsx)("ul",{className:"space-y-2 max-h-[150px] overflow-y-auto",children:o.map((e,r)=>(0,a.jsxs)("li",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-[#0EA5E9] rounded-full mr-2"}),(0,a.jsx)("span",{className:`${s.text.muted} text-sm`,children:e})]},r))})})]}),i.context_requirements&&i.context_requirements.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:`text-sm font-medium ${s.text.primary} mb-2 uppercase tracking-wider`,children:"Context Requirements"}),(0,a.jsx)("div",{className:`${s.modal.input} rounded-lg p-4`,children:(0,a.jsx)("ul",{className:"space-y-2 max-h-[150px] overflow-y-auto",children:i.context_requirements.map((e,r)=>(0,a.jsxs)("li",{className:"flex items-start",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-[#0EA5E9] rounded-full mr-2 mt-1.5"}),(0,a.jsx)("span",{className:`${s.text.muted} text-sm`,children:e})]},r))})})]}),(0,a.jsxs)("div",{className:`text-xs ${s.text.muted} pt-2`,children:[(0,a.jsxs)("p",{children:["Created: ",new Date(e.created_at).toLocaleStr
1ing()]}),(0,a.jsxs)("p",{children:["Last Updated: ",new Date(e.updated_at).toLocaleString()]})]})]})}let I=({agents:e})=>{let{detailType:r,selectedAgentDetails:t,selectedTaskDetails:s,closeDetailView:i}=(0,w.CA)(),{data:n=[]}=(0,l.X1)({enabled:"task"===r}),o=(0,j.xh)();return r?(0,a.jsx)("div",{className:"fixed inset-0 z-[120] overflow-hidden",onClick:i,children:(0,a.jsxs)("div",{className:"flex items-center justify-center h-full p-4",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity",onClick:i,children:(0,a.jsx)("div",{className:`absolute inset-0 ${o.background.overlay}`})}),(0,a.jsxs)("div",{className:`relative w-full max-w-4xl max-h-[90vh] overflow-y-auto ${o.background.primary} border ${o.border.default} rounded-lg shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{onClick:i,className:`absolute top-4 right-4 p-2 rounded-full ${o.background.secondary} hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors shadow-sm`,"aria-label":"Close details",children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",className:`h-5 w-5 ${o.text.primary}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,a.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),(0,a.jsxs)("div",{className:"p-6",children:["agent"===r&&t&&(0,a.jsx)(D.O,{agent:t,onClose:i}),"task"===r&&s&&(0,a.jsx)(O,{task:s,agents:e,tasks:n})]})]})]})}):null};var T=t(92211),F=t(2271),L=t(14792),R=t(87597);let P=(e,r)=>()=>{},U=()=>{let e=(0,j.xh)();return(0,a.jsx)("div",{className:`fixed inset-0 z-50 ${e.background.overlay} flex items-center justify-center`,children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-blue-500"})})};U.displayName="ModalLoading";let J=i.memo(R.o);function B({crews:e,userApi:r,hasAccessToCrew:t,getSubscriptionBadge:D,agents:O,categories:R,departments:M,onDataUpdate:q,onClose:V,onSidebarToggle:G}){let Y=(0,i.useRef)(0),H=(0,i.useRef)(Date.now()),K=(0,j.xh)();(0,i.useEffect)(()=>{let r=Date.now(),t=r-H.current;Y.current++,t>100&&(P(`JobExplorer rendered (count: ${Y.current}, time since last: ${t}ms)`,{crewCount:e.length,agentCount:O.length}),H.current=r)},[e.length,O.length]);let W=(0,s.useRouter)(),Q=(0,k.useUIStore)(e=>e.setShowAgentPanel);(0,k.useUIStore)();let{detailType:X,closeDetailView:Z,searchTerm:ee,selectedAgent:er,selectedCategory:et,selectedDepartment:ea,selectedSource:es,activeView:ei,setUserCrews:en,groupBy:eo,showSavedOnly:el,showSharedWithMe:ed,dateSort:ec,setShowEditModal:eu,showEditModal:em}=(0,w.CA)(),[ex,ep]=(0,i.useState)(!1),[eg,eh]=(0,i.useState)("edit"),eb=(0,m.R)(),{getWorkflow:ef}=(0,x.r)(),{addFavoriteCrew:ev,removeFavoriteCrew:ew,favorites:ey}=(0,f.T)(),{hasAccess:ej}=(0,h.J)(),ek=(0,k.useUIStore)(e=>e.setGlobalError),eN=(0,k.useUIStore)(e=>e.setGlobalSuccess),e_=(0,k.useUIStore)(e=>e.useWorkflowBuilder),{connections:eC,canBlockOnConnections:e$}=(0,d.lv)(),{userSchedules:eE}=(0,c.G)(),{triggerMappings:eS}=(0,u.T)(),eA=(0,i.useMemo)(()=>new Set(eE.map(e=>e.crew_id)),[eE]),ez=(0,i.useMemo)(()=>new Set(eS.map(e=>e.crew_id)),[eS]),{publicCrews:eD,userCrews:eO,archivedCrews:eI,allAgents:eT,userAgents:eF,orgAgents:eL,allAvailableAgents:eR,refetchUserCrews:eP,refetchArchivedCrews:eU,archiveCrew:eJ,unarchiveCrew:eB,copyCrew:eM,promoteToPublic:eq,isCrewDetailOpen:eV,toggleCrewDetail:eG,activeCrew:eY,selectCrew:eH}=(0,n.C)(!0,!1),{deleteCrew:eK,archivePublicCrew:eW,unarchivePublicCrew:eQ}=(0,o.mc)(),[eX,eZ]=(0,i.useState)(null),[e0,e1]=(0,i.useState)(!1),[e2,e5]=(0,i.useState)(!1),[e4,e3]=(0,i.useState)("pro"),[e7,e8]=(0,i.useState)(null),[e6,e9]=(0,i.useState)(!1),[re,rr]=(0,i.useState)(null),[rt,ra]=(0,i.useState)(!1),{useOrganizationCrewsQuery:rs,useOrganizationReviewCrewsQuery:ri,usePrimaryOrganizationId:rn,useIsOrgAdmin:ro,useOrganizationMembers:rl,useArchiveOrganizationCrew:rd,useUnarchiveOrganizationCrew:rc,useDeleteOrganizationCrew:ru}=(0,v.bd)(),rm=rn(),rx=ro(rm),{data:rp}=rl(rm||""),rg=rd(),rh=rc(),rb=ru(),{data:rf=[]}=rs(rm||"",{enabled:!!rm&&("jobs"===ei||"favorites"===ei||"departments"===ei)}),{data:rv=[]}=ri(rm||"",{enabled:!!rm&&"org-review"===ei}),{usePublishCrewToOrgMutation:rw,useApproveOrgCrewMutation:ry,useDeclineOrgCrewMutation:rj}=(0,n.C)();rw(),ry(),rj();let rk="user"===es?"user":"organization"===es?"organization":void 0,{mappings:rN}
1=(0,z.G)(rm||void 0,rk),r_=(0,i.useRef)(ei);(0,i.useEffect)(()=>{r_.current===ei||(P(`View changed to ${ei}`),(async()=>{switch(ei){case"archive":await eU();break;case"jobs":await eP()}})(),r_.current=ei)},[ei,eU,eP]);let rC=(0,y.useSubscriptionStore)(y.selectSubscriptionType);(0,y.useSubscriptionStore)(y.selectIsPro);let r$=(0,y.useSubscriptionStore)(y.selectIsAdmin),rE=(0,i.useRef)({searchTerm:ee,selectedCategory:et,selectedDepartment:ea,selectedAgent:er,activeView:ei}),rS=(0,i.useMemo)(()=>{P("Computing filteredCrews",{activeView:ei,searchTerm:ee,selectedCategory:et,selectedDepartment:ea,selectedAgent:er,showSavedOnly:el,showSharedWithMe:ed,dateSort:ec});let r=[];switch(ei){case"archive":r=[...eI,...rf.filter(e=>e.is_archived),...r$?e.filter(e=>("public"===e.owner_type||null==e.owner_type)&&e.is_archived):[]];break;case"favorites":let t=[];("all"===es||"public"===es)&&(t=[...t,...e]),("all"===es||"user"===es)&&(t=[...t,...eO]),("all"===es||"organization"===es)&&(t=[...t,...rf]),r=t.filter(e=>!e.is_archived&&ey.some(r=>r.id===e.id));break;case"org-review":r=rv;break;default:let a=e.filter(e=>{let r="public"===e.owner_type||null==e.owner_type,t=e.config?.subscription_level==="admin",a=e.config?.subscription_level==="enterprise";return t?r&&"admin"===rC:a?r&&("enterprise"===rC||"admin"===rC):r}).filter(e=>!e.is_archived);if("public"===es){let e=new Set;r=a.filter(r=>!e.has(r.id)&&(e.add(r.id),!0))}else if("organization"===es){let e=new Set;r=rf.filter(e=>!e.is_archived).filter(r=>!e.has(r.id)&&(e.add(r.id),!0))}else if("user"===es){let e=new Set;r=eO.filter(e=>!e.is_archived).filter(r=>!e.has(r.id)&&(e.add(r.id),!0))}else{let e=[...a,...rf.filter(e=>!e.is_archived),...eO.filter(e=>!e.is_archived)],t=new Set;r=e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))}}P(`Base crews count: ${r.length}`);let s=r;if(ee){let e=ee.toLowerCase();s=s.filter(r=>r.config?.name?.toLowerCase().includes(e)||r.config?.description?.toLowerCase().includes(e))}return et&&(s=s.filter(e=>e.config?.category===et)),ea&&(s=s.filter(e=>e.config?.department===ea)),er&&(s=s.filter(e=>e.config?.agent_ids?.includes(er))),el&&(s=s.filter(e=>ey.some(r=>r.id===e.id))),ed&&(s=s.filter(e=>!!e.sharing_info)),[...s].sort((e,r)=>"newest"===ec?new Date(r.created_at).getTime()-new Date(e.created_at).getTime():"oldest"===ec?new Date(e.created_at).getTime()-new Date(r.created_at).getTime():"updated"===ec?new Date(r.updated_at).getTime()-new Date(e.updated_at).getTime():0)},[e,eO,eI,ee,et,ea,er,ei,ey,rf,rv,rC,el,ed,es,ec]);(0,i.useEffect)(()=>{let e={searchTerm:ee,selectedCategory:et,selectedDepartment:ea,selectedAgent:er,selectedSource:es,activeView:ei},r=rE.current;r&&e.searchTerm===r.searchTerm&&e.selectedCategory===r.selectedCategory&&e.selectedDepartment===r.selectedDepartment&&e.selectedAgent===r.selectedAgent&&e.selectedSource===r.selectedSource&&e.activeView===r.activeView||(P("Filters changed, resetting page to 1"),rE.current=e)},[ee,et,ea,er,es,ei]);let rA=(0,i.useCallback)(async e=>{P(`Toggle favorite for crew: ${e.id}`);try{if(!ej(e))return void ek("Please upgrade your subscription to add pro jobs to favorites.");ey.some(r=>r.id===e.id)?await ew(e.id):await ev(e.id)}catch(e){ek("Failed to update favorites. Please try again.")}},[ej,ey,ev,ew,ek]),rz=(0,i.useCallback)(async e=>{P(`Run job: ${e.id}`);let r=E.A.getSubscriptionCheck(rC,e.config?.subscription_level);if(!r.canAccess){r.requiredLevel&&"free"!==r.requiredLevel&&(e3(r.requiredLevel),e8(e.id),e5(!0));return}try{let r=await (0,l.KK)(e.id,e.config?.task_ids||[]),{isValid:t,missingApps:a}=(0,_.PR)(e,r,eC);if(e$&&!t)return void ek(`Please connect the following app(s) before running this job: ${a.join(", ")}`);await (0,$.b)(e.id,W,Q)}catch(e){console.error("Error running job:",e),ek("Failed to run job. Please try again.")}},[rC,eC,e$,W,Q,ek,e3,e8,e5]),rD=(0,i.useCallback)(async(e,r="edit")=>{P(`Open workflow builder: ${e.id}`);try{let t=e.config?.task_ids||[],a=await (0,l.KK)(e.id,t);a.length<t.length&&console.warn(`[JobExplorer] Partial task load for crew ${e.id||"(draft)"}: resolved ${a.length}/${t.length} tasks. baseline_config retains full task_ids for parity.`);let s=await (0,N.Dm)(e,a,eR);eb.initializeFromCrew(e,a,s),await (0,g.G)(e,a.map(e=>e.id),ef),eh(r),ep(!0)}catch{ek("Failed to open workflow builder. Please try again.")}},[eR,eb,ek,ef]),rO=(0,i.useCallback)(e=>{P(`Open classic job editor: ${e.id}`),eZ(e),eu(!0)},[eu]),rI=(0,i.useCallback)(async e=>{P(`Unarchive job: ${e.id}`);try{if("organization"===e.owner_type){let r=e.organization_id||rm;if(!r)throw Error("Organization ID is missing");await rh.mutateAsync({orgId:r,crewId:e.id})}else if("public"===e.owner_type||null==e.owner_type)if(r$)await eQ(e.id);else throw Error("You do not have permission to restore template jobs.");else await eB.mutateAsync(e.id);await q(),eN("Job restored successfully!")}catch(e){console.error("Failed to unarchive job:",e),ek("Failed to restore job. Please try again.")}},[eB,rh,eQ,r$,rm,q,ek,eN]),rT=(0,i.useCallback)(async e=>{if(P(`Archive job: ${e.id}`),window.confirm(`Are you sure you want to archive "${e.config?.name}"? You can restore it later from the Archive section.`))try{if("organization"===e.owner_type){let r=e.organization_id||rm;if(!r)throw Error("Organization ID is missing");await rg.mutateAsync({orgId:r,crewId:e.id})}else if("public"===e.owner_type||null==e.owner_type)if(r$)await eW(e.id);else throw Error("You do not have permission to archive template jobs.");else await eJ.mutateAsync(e.id);await q(),eN("Job archived successfully!")}catch(e){console.error("Failed to archive job:",e),ek("Failed to archive job. Please try again.")}},[eJ,rg,eW,r$,rm,q,ek,eN]),rF=(0,i.useCallback)(async e=>{if(P(`Delete job: ${e.id}`),window.confirm(`Are you sure you want to permanently delete "${e.config?.name}"? This action cannot be undone.`))try{if("organization"===e.owner_type){let r=e.organization_id||rm;if(!r)throw Error("Organization ID is missing");await rb.mutateAsync({orgId:r,crewId:e.id})}else if("public"===e.owner_type||null==e.owner_type)if(r$)await eK(e.id);else throw Error("You do not have permission to delete template jobs.");else await eK(e.id);await q(),eN("Job deleted successfully!")}catch(e){console.error("Failed to delete job:",e),ek("Failed to delete job. Please try again.")}},[eK,rb,rm,r$,q,ek,eN]),rL=(0,i.useCallback)(async()=>
1{if(0!==rS.length&&window.confirm(`Are you sure you want to permanently delete ALL ${rS.length} archived jobs? This action cannot be undone.`))try{e1(!0),await Promise.all(rS.map(e=>{if("organization"===e.owner_type){let r=e.organization_id||rm;return r?rb.mutateAsync({orgId:r,crewId:e.id}):Promise.resolve()}return"public"!==e.owner_type&&null!=e.owner_type?eK(e.id):r$?eK(e.id):Promise.resolve()})),await q(),eN(`Successfully deleted ${rS.length} jobs!`)}catch(e){console.error("Failed to delete all jobs:",e),ek("Failed to delete all jobs. Please try again.")}finally{e1(!1)}},[rS,eK,rb,rm,r$,q,ek,eN]),rR=(0,i.useCallback)(async()=>{P("Close edit modal"),eZ(null),eu(!1),await q()},[q,eu]),rP=(0,i.useCallback)(async()=>{if(P("Create new job"),"enterprise"!==rC&&"admin"!==rC)return void W.push("/upgrade");if(C(es,rm)&&rp&&!rx)return void ek("Organization admin access is required to create organization workflows.");let{owner_type:e,organization_id:r}=C(es,rm)?{owner_type:"organization",organization_id:rm}:{owner_type:"user",organization_id:void 0},t={id:"",config:{name:"",description:"",process:"sequential",subscription_level:"free",task_ids:[],agent_ids:[],task_agent_map:{},global_context:{},input_schema:[]},owner_type:e,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),is_archived:!1,organization_id:r,created_by:"",version:"1"};e_?rD(t,"create"):(eZ(t),eu(!0))},[rC,W,e_,rD,eZ,eu,rm,es,rx,rp,ek]),rU=(0,i.useCallback)(async()=>{P("Close new job modal"),e9(!1),rr(null),await q()},[q]),rJ=(0,i.useCallback)(async e=>{P("Import successful"),await q(),e&&eH(e)},[q,eH]),rB=(0,i.useMemo)(()=>{if(P(`Computing groupedCrews - groupBy: ${eo}, crews: ${rS.length}`),"none"===eo)return{ungrouped:rS};let e=rS.reduce((e,r)=>{let t="department"===eo?r.config?.department||"Other":r.config?.category||"Other";return e[t]||(e[t]=[]),e[t].push(r),e},{});return"user"!==es||e.Other||(e.Other=[]),P(`Groups created: ${Object.keys(e).length}`),e},[rS,eo,es]);return(0,b.i)({onEscape:rR,isEnabled:em}),(0,i.useEffect)(()=>(P("JobExplorer mounted"),()=>{P("JobExplorer unmounted")}),[]),(0,a.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,a.jsxs)(i.Suspense,{fallback:(0,a.jsx)(U,{}),children:[em&&eX&&(0,a.jsx)(S.E,{selectedCrew:eX,onClose:rR,onUpdate:q}),e6&&re&&(0,a.jsx)(S.E,{selectedCrew:re,onClose:rU,onUpdate:q}),X&&(0,a.jsx)(I,{agents:[...O,...eL||[]]})]}),(0,a.jsx)(T.Q,{categories:R,departments:M,agents:[...O,...eL||[]],onClose:V,onImportClick:()=>ra(!0),onSidebarToggle:G}),"archive"===ei&&rS.length>0&&(0,a.jsx)("div",{className:`${K.border.default} border-b ${K.background.primary} bg-opacity-60 backdrop-blur-sm`,children:(0,a.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,a.jsx)("div",{className:"flex items-center gap-4",children:(0,a.jsxs)("h2",{className:`text-lg font-semibold ${K.text.primary}`,children:["Archived Jobs (",rS.length,")"]})}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)("button",{onClick:rL,disabled:e0,className:`px-4 py-2 text-sm font-medium rounded-lg transition-colors ${e0?"bg-gray-400 text-gray-600 cursor-not-allowed":"bg-red-600 hover:bg-red-700 text-white"}`,children:e0?"Deleting...":"Delete All"})})]})}),(0,a.jsxs)("div",{className:`flex-1 overflow-y-auto p-4 md:p-6 ${K.scrollbarSidebar}`,children:[(0,a.jsxs)("div",{className:"mb-4 md:mb-6 flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl md:text-2xl font-bold text-gray-900 dark:text-gray-50 mb-1",children:"user"===es?"My Jobs":"public"===es?"Job Templates":"Jobs"}),(0,a.jsx)(L.o,{variant:"muted",className:"mb-2",children:"user"===es?"Manage and customize your personal AI jobs":"public"===es?"Explore and use ready-made job templates":"Explore and use available jobs"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,a.jsx)("button",{"data-tour":"create-job-btn",onClick:rP,disabled:e0,className:`flex items-center justify-center gap-1.5 px-3 py-1.5 text-sm font-medium ${K.background.secondary} hover:bg-gray-100 dark:hover:bg-zinc-800 ${K.text.primary} border ${K.border.default} rounded-md transition-colors shadow-sm disabled:opacity-50 disabled:cursor-not-allowed`,children:e0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"animate-spin w-4 h-4 border-2 border-gray-400 dark:border-gray-500 border-t-transparent roun
1ded-full"}),"Creating..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"New Job"]})})})]}),"none"!==eo&&rS.length>0&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("p",{className:`text-sm ${K.text.muted}`,children:["Jobs organized by"," ","department"===eo?"Departments":"Categories"]})}),0===rS.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[(0,a.jsx)("p",{className:`${K.text.muted} mb-2`,children:"user"===es?"You haven't created any jobs yet. Create a new job or copy an existing one to get started!":"No jobs match the current filters"}),"user"===es?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,a.jsxs)("button",{"data-tour":"create-job-btn",onClick:rP,className:`border-2 border-dashed border-gray-300 dark:border-zinc-700 hover:border-[#eebb65] hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors ${K.text.muted} hover:${K.text.primary} rounded-lg p-8 flex flex-col items-center gap-4 group relative`,children:[(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),(0,a.jsx)("span",{className:"text-lg",children:"Create New Job"}),"enterprise"!==rC&&"admin"!==rC&&(0,a.jsx)("span",{className:"absolute top-0 right-0 bg-amber-500/20 text-amber-300 text-xs px-2 py-1 rounded-bl-lg rounded-tr-lg",children:"Upgrade"})]}),(0,a.jsxs)("button",{onClick:()=>ra(!0),className:`border-2 border-dashed border-gray-300 dark:border-zinc-700 hover:border-[#0EA5E9] hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors ${K.text.muted} hover:${K.text.primary} rounded-lg p-6 flex flex-col items-center gap-3 group relative`,children:[(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z",clipRule:"evenodd"})}),(0,a.jsx)("span",{className:"text-sm",children:"Import from YAML"})]})]}):(0,a.jsx)("button",{onClick:()=>w.CA.getState().clearFilters(),className:"text-sm text-[#0EA5E9] hover:text-[#0284C7]",children:"Clear all filters and view all jobs"})]}):(0,a.jsx)("div",{className:"space-y-6",children:Object.entries(rB).sort(([e],[r])=>"Other"===e?1:"Other"===r?-1:e.localeCompare(r)).map(([e,r])=>{let s,i,n;return(0,a.jsxs)("div",{className:"space-y-4",children:["ungrouped"!==e&&("department"===eo&&("user"===es||"organization"===es)?(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,a.jsxs)("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-50",children:["Department: ",e]}),(s=rN.find(r=>r.department===e&&("user"===es?"user"===r.owner_type:"organization"===r.owner_type)),i="user"===es?eF:eL,(n=s?.agent_id?i?.find(e=>e.id===s.agent_id):void 0)?(0,a.jsxs)("div",{className:`flex items-center gap-2 rounded-full border pl-1 pr-3 py-1 ${K.border.default} ${K.background.secondary}`,children:[n.config.agent_image_url?(0,a.jsx)("img",{src:n.config.agent_image_url,alt:"",className:"h-7 w-7 rounded-full object-cover"}):(0,a.jsx)("div",{className:`flex h-7 w-7 items-center justify-center rounded-full text-xs font-bold ${K.background.tertiary} ${K.text.primary}`,children:Array.from(n.config.role||"?")[0]||"A"}),(0,a.jsx)("span",{className:`text-sm font-medium max-w-[220px] truncate ${K.text.primary}`,children:n.config.role})]}):null)]}):(0,a.jsx)("h3",{className:"text-xl font-semibold mb-3 text-gray-900 dark:text-gray-50",children:"department"===eo?`Department: ${e}`:"category"===eo?`Category: ${e}`:e})),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 ga
1p-4",children:["user"===es&&"Other"===e&&(0,a.jsxs)("button",{"data-tour":"create-job-btn",onClick:rP,className:`border-2 border-dashed border-gray-300 dark:border-zinc-700 hover:border-[#eebb65] hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors ${K.text.muted} hover:${K.text.primary} rounded-lg p-8 flex flex-col items-center gap-4 h-full group relative`,children:[(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),(0,a.jsx)("span",{className:"text-lg",children:"Create New Job"}),"enterprise"!==rC&&"admin"!==rC&&(0,a.jsx)("span",{className:"absolute top-0 right-0 bg-amber-500/20 text-amber-300 text-xs px-2 py-1 rounded-bl-lg rounded-tr-lg",children:"Upgrade"})]}),r.map((e,r)=>(0,a.jsx)("div",{className:"h-full",children:(0,a.jsx)(J,{crew:e,hasAccess:t(e),userConnectionsList:eC,canBlockOnConnections:e$,primaryOrgId:rm,isOrgAdmin:rx,isAdmin:r$,isFavorite:ey.some(r=>r.id===e.id),isScheduled:eA.has(e.id),isTriggered:ez.has(e.id),onToggleBookmark:()=>rA(e),onRun:()=>rz(e),subscriptionBadge:D(e.config?.subscription_level),onDataUpdate:q,onClick:()=>{let r="public"===e.owner_type||null==e.owner_type,t="user"===e.owner_type||r$&&r||rx&&"organization"===e.owner_type;"archive"!==ei&&t?e_?rD(e):rO(e):(eH(e.id),eG(!0))},onEdit:e_?rD:rO,onArchive:"archive"!==ei?rT:void 0,onUnarchive:"archive"===ei?rI:void 0,onDelete:"archive"===ei?rF:void 0,isArchiveView:"archive"===ei,groupBy:eo})},e.id))]})]},e)})})]}),(0,a.jsxs)(i.Suspense,{fallback:null,children:[(0,a.jsx)(p.i,{isOpen:ex,onClose:()=>ep(!1),mode:eg,onUpdate:q}),(0,a.jsx)(A.default,{isOpen:e2,onClose:()=>e5(!1),requiredSubscription:e4}),(0,a.jsx)(F.ImportToolModal,{isOpen:rt,onClose:()=>ra(!1),onImportSuccess:rJ})]})]})}},87597:(e,r,t)=>{t.d(r,{o:()=>x});var a=t(37876),s=t(14232),i=t(5424),n=t(74871),o=t(45029),l=t(14792),d=t(62652),c=t(35269),u=t(80847),m=t(66944);function x({crew:e,hasAccess:r,onToggleBookmark:t,onRun:p,subscriptionBadge:g,onDataUpdate:h,onClick:b,onEdit:f,onArchive:v,onUnarchive:w,onDelete:y,hideEditButton:j,groupBy:k="none",isArchiveView:N=!1,userConnectionsList:_=[],canBlockOnConnections:C=!0,primaryOrgId:$=null,isOrgAdmin:E=!1,isAdmin:S=!1,isFavorite:A=!1,isScheduled:z=!1,isTriggered:D=!1}){let O=(0,n.xh)(),I=(0,i.useDynamicCrewStore)(e=>e.setActiveCrewId),T=(0,i.useDynamicCrewStore)(e=>e.toggleCrewDetail),[F,L]=s.useState(!1),R="pending"===e.governance_status,P="declined"===e.governance_status,U=(0,s.useCallback)(()=>{L(!1)},[]),J=(0,c.x)(e.owner_type),B=`${J.border} ${J.hoverBorder}`,M=(0,s.useCallback)(()=>{b?b():(I(e.id),T(!0))},[b,e.id,I,T]);return(0,a.jsxs)(o.Zp,{"data-tour":"job-card",onClick:M,className:`cursor-pointer group h-full flex flex-col transition-all duration-300 hover:shadow-md border-2 ${O.background.tertiary} ${B} ${!r?"opacity-80":""}`,children:[(0,a.jsxs)(o.Wu,{className:"p-3 flex-1 min-h-0 flex flex-col overflow-hidden",children:[(0,a.jsx)("div",{className:"mb-1.5",children:(0,a.jsx)(l.o,{variant:"h3",className:`${O.text.primary} font-semibold text-sm leading-tight line-clamp-1`,children:e.config?.name})}),(0,a.jsx)("div",{className:"min-h-[2rem] mb-2.5",children:(0,a.jsx)(l.o,{variant:"muted",className:`text-xs line-clamp-2 ${O.text.muted}`,children:e.config?.description})}),(0,a.jsx)("div",{className:"flex-1 min-h-0"}),(0,a.jsx)("div",{className:"z-10 relative",children:(0,a.jsx)(m.x,{crew:e,hasAccess:r,onToggleBookmark:t,onRun:p,onDataUpdate:h,onEdit:f,onArchive:v,onUnarchive:w,onDelete:y,hideEditButton:j,isArchiveView:N,userConnectionsList:_,canBlockOnConnections:C,primaryOrgId:$,isOrgAdmin:E,isAdmin:S,isFavorite:A})}),(0,a.jsx)("div",{className:`px-0 pt-2 pb-1 ${O.border.default} border-t flex-shrink-0 mt-auto`,children:(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.config?.subscription_level&&"free"!==e.config.subscription_level&&(0,a.jsx)(d.E,{variant:"secondary",className:`text-[10px] rounded px-1.5 py-0.5 flex-shrink-0 font-medium border ${"pro"===e.config.subscription_level?"bg-[#eebb65]/10 text-[#d9a246] border-[#eebb65]/30":"enterprise"===e.config.subscription_level?"bg-[#0EA5E9]/10 text-[#0284C7] border-[#0EA5E9]/30":"admin"===e.config.subscription_level?"bg-red-500/10 text-red-600 border-red-500/30":"bg-gray-100 dark:bg-zinc-800 text-gray-700 dark:text-gray-300 border-gray-200 dark:border-zinc-700"}`,children:e.config.subscription_level.charAt(0).toUpperCase()+e.config.subscription_level.slice(1)}),e.config.category&&"category"!==k&&(0,a.jsx)(d.E,{variant:"secondary",className:"text-[10px] bg-gray-100 dark:bg-zinc-800 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-zinc-700 rounded px-1.5 py-0.5 truncate max-w-[90px] flex-shrink-0",children:e.config.category}),e.config.department&&"department"!==k&&(0,a.jsx)(d.E,{variant:"secondary",className:`text-[10px] rounded px-1.5 py-0.5 truncate max-w-[90px] flex-shrink-0 ${"bg-black"===O.background.primary?"bg-gray-700 text-gray-200":"bg-gray-200 text-gray-700"}`,children:e.config.department}),z&&(0,a.jsx)(d.E,{variant:"secondary",className:"text-[10px] rounded px-1.5 py-0.5 flex-shrink-0 font-medium border bg-[#0EA5E9]/10 text-[#0284C7] border-[#0EA5E9]/30",title:"This 
1job runs on a schedule",children:"Scheduled"}),D&&(0,a.jsx)(d.E,{variant:"secondary",className:"text-[10px] rounded px-1.5 py-0.5 flex-shrink-0 font-medium border bg-[#eebb65]/10 text-[#d9a246] border-[#eebb65]/30",title:"This job runs on a trigger",children:"Triggered"}),!r&&(0,a.jsx)(d.E,{variant:"destructive",className:"text-[10px] rounded px-1.5 py-0.5 flex-shrink-0",children:"Requires Upgrade"}),R&&(0,a.jsx)(d.E,{variant:"secondary",className:"text-[10px] bg-amber-100 text-amber-700 rounded px-1.5 py-0.5 flex-shrink-0",children:"Pending Review"}),P&&(0,a.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),L(!0)},className:"text-[10px] bg-red-100 text-red-700 hover:bg-red-200 rounded px-1.5 py-0.5 flex-shrink-0 cursor-pointer transition-colors",children:"Declined (View Reason)"})]})})]}),F&&(0,a.jsx)(u.o,{isOpen:F,onClose:U,itemName:e.config?.name??"This job",reason:e.decline_reason??""})]})}}}]);

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.