PageSourceSearch

https://app.visiblie.com/assets/PromptsManagement-BU12CfSR.js

js visiblie.com collected 2026-10-06 12:45:02 UTC 21,134 bytes, 11 lines download raw bytes

1import{K as Ne,a as Ye,d as _e,r as i,ag as Ke,f as Qe,P as O,fT as qe,g0 as Je,g1 as Xe,n as e,a4 as C,bQ as J,cu as X,cs as ge,ct as fe,cv as ve,J as l,fQ as Ze,aL as et,M as Z,a1 as je,br as tt,O as st,Q as at,bR as B,aI as nt,am as rt,a5 as it,D as ee,v as te,w as se,x as ae,av as ne,aw as ye}from"./index-CnX2Zt_w.js";import{S as lt}from"./SuggestedPromptsModal-9Qmcc3c9.js";import{A as R,u as ot,i as ct}from"./use-prompt-actions-B3Dovajt.js";import{R as dt,M as mt,a as ut}from"./RegionLanguageDisplay-B0_fxHzw.js";import{C as ht}from"./CsvUpload-D9v-DzT6.js";import{C as Ce}from"./checkbox-EVfyTDEY.js";import{A as pt}from"./archive-BPq4yjBa.js";import{T as be}from"./trash-2-CNY3-CVn.js";import{F as xt}from"./flag-B3JD7qXD.js";import{C as gt}from"./chevron-left-DEZ8LHW4.js";import"./popover-DT9PH_Ky.js";import"./useBrandSettings-CgmIeZ6V.js";import"./countries-languages-BYMEnks5.js";import"./progress-CMPmbYYR.js";import"./circle-check-D63V5LTR.js";import"./circle-x-C3SyCtWO.js";/**
2 * @license lucide-react v0.544.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 ft=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],re=Ne("circle-pause",ft);/**
7 * @license lucide-react v0.544.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 vt=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ie=Ne("circle-play",vt),A=20;function le(b){return b.status?b.status:b.active!==!1?"ACTIVE":"INACTIVE"}function Rt({embedded:b=!1,brandId:we}){const{user:u}=Ye(),I=we||u?.brandId,{data:oe}=_e(I),$=oe?.languageCountryPairs??[],E=oe?.llmModel??["CHATGPT","PERPLEXITY"],[N,ce]=i.useState(""),[M,de]=i.useState(["CHATGPT"]),me=i.useRef(!1),[Se,ue]=i.useState(!1),[g,Ae]=i.useState(null),[Me,he]=i.useState(!1),[jt,yt]=i.useState(!1),[w,ke]=i.useState(""),[Pe,T]=i.useState(!1),[Ct,bt]=i.useState([]),[De,U]=i.useState(!1),[h,pe]=i.useState(null),[S,z]=i.useState([]),[Ie,k]=i.useState(!1),[d,L]=i.useState(null),[Ee,V]=i.useState(1),[m,p]=i.useState([]),{toast:P}=Ke();i.useEffect(()=>{p([])},[w]);const{data:Te,isLoading:H,error:F}=Qe({pageSize:1e4,statuses:[O.ACTIVE,O.INACTIVE,O.ARCHIVED]},I,!!I),W=qe(),Y=Je();Xe();const f=Te?.data||[];i.useEffect(()=>{if(me.current||!E?.length)return;const t=R.map(s=>s.id).filter(s=>E.includes(s));t.length>0&&(de(t),me.current=!0)},[E]);const a=ot({brandId:I,promptsData:f}),x=M.length,Ue=async()=>{if(!N.trim())return;if(!u?.brandId){P({title:"Error",description:"Brand ID not available",variant:"destructive"});return}if(!a.canAddUnits(x)){P({title:"Prompt limit reached",description:`Adding this prompt with ${x} model(s) would exceed your brand limit of ${a.limit}. You currently use ${a.usage} units. Deactivate or remove prompts first.`,variant:"destructive"});return}let t,s;if(g)t=g.langCountryCode,s=g.regionDetails||void 0;else{const r=$??[];if(r.length>0){const n=r[0];t=`${n.language}, ${n.countryCode}`,s=n.regionDetails||void 0}}try{M.length>1?await Y.mutateAsync({brandId:u.brandId,prompts:[{text:N.trim(),models:M}],langCountryCode:t,regionDetails:s}):await W.mutateAsync({brandId:u.brandId,prompt:N.trim(),langCountryCode:t,regionDetails:s}),P({title:"Success",description:"Prompt added successfully"}),ce("")}catch(r){console.error("Failed to create prompt:",r),P({title:"Error",description:"Failed to add prompt. Please try again.",variant:"destructive"})}},[D,_]=i.useState(null),Le=t=>{_(t),T(!0)},Fe=async()=>{if(!D)return;const t=D.entries.map(r=>r.id);await a.handleBulkDelete(t)&&(T(!1),_(null))},Ge=()=>{T(!1),_(null)},Oe=t=>{pe(t);const s=f.filter(n=>n.prompt===t.prompt&&n.langCountryCode===t.langCountryCode),r=[...new Set(s.filter(n=>le(n)==="ACTIVE").map(n=>n.aiModel).filter(Boolean))];z(r),U(!0)},Be=t=>{z(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t])},K=i.useMemo(()=>
11{if(!h)return new Set;const t=f.filter(s=>s.prompt===h.prompt&&s.langCountryCode===h.langCountryCode&&le(s)==="ACTIVE");return new Set(t.map(s=>s.aiModel||"").filter(Boolean))},[h,f]),v=i.useMemo(()=>{if(!h)return{toActivate:0,toDeactivate:0,netNew:0};const t=S.filter(r=>!K.has(r)).length,s=[...K].filter(r=>!S.includes(r)).length;return{toActivate:t,toDeactivate:s,netNew:t-s}},[h,S,K]),Q=a.hasLimit&&v.toActivate>0&&ct(a.limit,a.usage,v.netNew),Re=async()=>{if(!h)return;const s=f.filter(n=>n.prompt===h.prompt&&n.langCountryCode===h.langCountryCode).map(n=>n.id);await a.handleBulkUpdateModels(s,S)&&(U(!1),pe(null),z([]))},$e=t=>{L(t),k(!0)},xe=async t=>{if(!d)return;if(!t){const r=d.entries.map(o=>o.id);await a.handleBulkStatusUpdate(r,!1)&&(k(!1),L(null));return}const s=d.entries.find(r=>r.aiModel==="CHATGPT");if(s)await a.handleBulkStatusUpdate([s.id],!0)&&(k(!1),L(null));else{d.entries[0];const r=d.entries.map(o=>o.id);await a.handleBulkUpdateModels(r,["CHATGPT"])&&(k(!1),L(null))}},ze=async()=>{const s=j.filter(n=>m.includes(n.key)).flatMap(n=>n.entries.map(o=>o.id));await a.handleBulkStatusUpdate(s,!0)&&p([])},Ve=async()=>{const s=j.filter(n=>m.includes(n.key)).flatMap(n=>n.entries.map(o=>o.id));await a.handleBulkStatusUpdate(s,!1)&&p([])},He=async()=>{const s=j.filter(n=>m.includes(n.key)).flatMap(n=>n.entries.map(o=>o.id));await a.handleArchive(s)&&p([])},We=async()=>{const s=j.filter(n=>m.includes(n.key)).flatMap(n=>n.entries.map(o=>o.id));await a.handleBulkDelete(s)&&p([])},j=i.useMemo(()=>{const t=new Map;return f.forEach(s=>{const r=s.regionDetails||"",n=`${s.prompt}|||${s.langCountryCode}|||${r}`;t.has(n)||t.set(n,{key:n,prompt:s.prompt,langCountryCode:s.langCountryCode,regionDetails:r,entries:[],activeModels:[],activeCount:0,hasActive:!1,allInactive:!0,isArchived:!1});const o=t.get(n);o.entries.push(s),le(s)==="ACTIVE"&&(o.hasActive=!0,o.allInactive=!1,o.activeCount++,s.aiModel&&o.activeModels.push(s.aiModel))}),t.forEach(s=>{s.isArchived=s.entries.length>0&&s.entries.every(r=>r.status===O.ARCHIVED)}),Array.from(t.values())},[f]),c=i.useMemo(()=>{if(!w.trim())return j;const t=w.toLowerCase();return j.filter(s=>s.prompt.toLowerCase().includes(t))},[j,w]),G=Math.max(1,Math.ceil(c.length/A)),y=Math.min(Ee,G),q=c.slice((y-1)*A,y*A);return e.jsxs("div",{className:C(b?"w-full space-y-6 pt-1":"container mx-auto p-6 space-y-6"),children:[!b&&e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Manage Prompts"}),e.jsx("p",{className:"text-muted-foreground",children:"Add, remove, or modify prompts to track"})]})}),a.hasLimit&&e.jsx(J,{className:"border-l-4 border-l-[#E97132]",children:e.jsxs(X,{className:"py-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Brand Prompt Unit Usage"}),e.jsxs("span",{className:C("text-sm font-semibold tabular-nums",a.isAtOrOverLimit?"text-red-600":"text-foreground"),children:[a.usage," / ",a.limit]})]}),e.jsx("div",{className:"relative h-2.5 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:C("h-full rounded-full transition-all",a.isAtOrOverLimit?"bg-red-500":a.percentage>=80?"bg-amber-500":"bg-gradient-to-r from-[#E97132] to-[#f59e6c]"),style:{width:`${Math.min(a.percentage,100)}%`}})}),e.jsxs("div",{className:"flex justify-between mt-1.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:a.remaining===1/0?"No limit set":`${a.remaining} remaining`}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[Math.round(a.percentage),"% used"]})]}),a.isAtOrOverLimit&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:a.isOverLimit?"You have exceeded your prompt limit. Remove or deactivate prompts to free up units.":"You have reached your prompt limit. Remove or deactivate prompts to free up units."})]})}),e.jsxs(J,{children:[e.jsxs(ge,{className:"flex flex-row items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(fe,{className:"text-lg",children:"Add New Prompt"}),e.jsx(ve,{children:"Create a new prompt to track specific queries and topics"})]}),u?.brandId&&e.jsxs(l,{size:"sm",variant:"outline",className:"h-8 text-[12px] gap-1.5 border-[#e8e8e8] shrink-0",onClick:()=>he(!0),children:[e.jsx(Ze,{className:"w-3.5 h-3.5 text-[#E97132]"}),"Suggest Prompts"]})]}),e.jsxs(X,{className:"space-y-4",children:[e.jsx("div",{children:e.jsx(et,{placeholder:"Enter your prompt here... (e.g., What are the best tools for market research?)",value:N,onChange:t=>ce(t.target.value),className:"min-h-[80px]"})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground mb-1.5 block",children:"Language & Region"}),e.jsx(dt,{value:(()=>{const t=($??[])[0];return g||(t?{langCountryCode:`${t.language}, ${t.countryCode}
11`,regionDetails:t.regionDetails||"",language:t.language,countryCode:t.countryCode,country:t.country,reachType:t.countryCode?t.countryCode==="WW"?"worldwide":t.regionDetails?"local":"nationwide":""}:null)})(),onEdit:()=>ue(!0)})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-sm font-medium text-muted-foreground mb-2 block",children:["Select AI Models",x>0&&e.jsxs("span",{className:"ml-2 text-xs font-normal",children:["(",x," unit",x!==1?"s":""," will be used)"]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:R.map(t=>{const s=M.includes(t.id);return e.jsxs("button",{type:"button",className:C("flex items-center gap-2 rounded-md px-3 py-1.5 border text-sm transition-colors",s?"bg-[#E97132]/10 border-[#E97132] text-[#E97132] font-medium":"bg-background border-border text-muted-foreground hover:border-[#E97132]/50"),onClick:()=>{de(r=>r.includes(t.id)?r.filter(n=>n!==t.id):[...r,t.id])},children:[e.jsx(Z,{model:t.id,className:"w-3.5 h-3.5"}),t.name,s&&e.jsx(je,{className:"w-3 h-3"})]},t.id)})})]}),a.hasLimit&&!a.canAddUnits(x)&&N.trim()&&e.jsxs("div",{className:"text-xs text-red-600 bg-red-50 border border-red-200 rounded-md px-3 py-2",children:[e.jsx("span",{className:"font-semibold",children:"Limit exceeded."})," Adding this prompt with ",x," ","model(s) would exceed your brand limit of ",a.limit,". You currently use ",a.usage," ","units."]}),e.jsxs(l,{onClick:Ue,disabled:!N.trim()||M.length===0||W.isPending||Y.isPending||a.hasLimit&&!a.canAddUnits(x),className:"gap-2",children:[e.jsx(tt,{className:"w-4 h-4"}),W.isPending||Y.isPending?"Adding...":"Add Prompt"]})]})]}),e.jsx(ht,{moduleType:"prompt",brandId:u?.brandId,allowedModels:E,onSuccess:()=>{P({title:"Success",description:"Prompts imported successfully"})},title:"Bulk Import Prompts",description:"Upload a CSV file to import multiple prompts at once",compact:!1}),e.jsxs(J,{children:[e.jsxs(ge,{children:[e.jsx(fe,{className:"text-lg",children:"Prompts"}),e.jsx(ve,{children:"Prompts are grouped by text & region. Each model is a separate unit."})]}),e.jsx(X,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(st,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4"}),e.jsx(at,{placeholder:"Search prompts...",value:w,onChange:t=>{ke(t.target.value),V(1)},className:"pl-10"})]}),!H&&!F&&q.length>0&&e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 p-3 bg-muted/40 rounded-lg border border-dashed",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(Ce,{id:"select-all-prompts",checked:c.length>0&&m.length===c.length,onCheckedChange:t=>{p(t?c.map(s=>s.key):[])}}),e.jsx("label",{htmlFor:"select-all-prompts",className:"text-sm font-medium leading-none cursor-pointer select-none",children:m.length===c.length&&c.length>0?`All ${c.length} selected`:"Select All"}),m.length>0&&m.length<c.length&&e.jsxs("span",{className:"text-xs text-muted-foreground bg-background px-2 py-0.5 rounded border",children:[m.length," selected"]})]}),m.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(l,{size:"sm",variant:"outline",className:"h-8 text-xs gap-1 hover:bg-green-50 hover:text-green-700 hover:border-green-200",onClick:ze,disabled:a.isUpdatingStatus,children:[e.jsx(ie,{className:"w-3.5 h-3.5 text-green-600"}),"Activate"]}),e.jsxs(l,{size:"sm",variant:"outline",className:"h-8 text-xs gap-1 hover:bg-orange-50 hover:text-orange-700 hover:border-orange-200",onClick:Ve,disabled:a.isUpdatingStatus,children:[e.jsx(re,{className:"w-3.5 h-3.5 text-orange-600"}),"Deactivate"]}),e.jsxs(l,{size:"sm",variant:"outline",className:"h-8 text-xs gap-1 hover:bg-slate-100 hover:text-slate-700 hover:border-slate-300",onClick:He,disabled:a.isUpdatingStatus,children:[e.jsx(pt,{className:"w-3.5 h-3.5 text-slate-500"}),"Archive"]}),e.jsxs(l,{size:"sm",variant:"outline",className:"h-8 text-xs gap-1 text-destructive hover:bg-red-50 hover:text-destructive hover:border-red-200",onClick:We,disabled:a.isDeletingPrompts,children:[e.jsx(be,{className:"w-3.5 h-3.5"}),"Delete"]}),e.jsx(l,{size:"sm",variant:"ghost",className:"h-8 px-2 text-xs text-muted-foreground hover:bg-muted",onClick:()=>p([]),children:"Cancel"})]})]}),H&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading prompts..."}),F&&e.jsxs("div",{className:"text-center py-8 text-destructive",children:["Error loading prompts: ",F.message]}),!H&&!F&&e.jsx("div",{className:"space-y-3",children:q.length>0?q.map(t=>e.jsx("div",{className:"p-4 rounded-lg border bg-background hover:bg-slate-50/50 transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"pt-0.5",children:e.jsx(Ce,{checked:m.includes(t.key),onCheckedChange:()=>{p(s=>s.includes(t.key)?s.filter(r=>r!==t.key):[...s,t.key])}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium leading-relaxed",children:t.prompt}),e.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[e.jsxs(B,{variant:"outline",className:"text-xs gap-1",children:[t.regionDetail
11s?e.jsx(mt,{className:"w-3 h-3 text-[#E97132]"}):t.langCountryCode.includes("WW")?e.jsx(nt,{className:"w-3 h-3 text-[#E97132]"}):e.jsx(xt,{className:"w-3 h-3 text-[#E97132]"}),t.langCountryCode,t.regionDetails&&` · ${t.regionDetails}`]}),t.activeModels.map(s=>e.jsxs(B,{variant:"outline",className:"text-xs gap-1 bg-green-50 text-green-700 border-green-200",children:[e.jsx(Z,{model:s,className:"w-3.5 h-3.5"}),R.find(r=>r.id===s)?.name||s]},s)),t.isArchived?e.jsx(B,{variant:"outline",className:"text-xs bg-amber-50 text-amber-700 border-amber-200 animate-pulse",children:"Archived"}):t.allInactive?e.jsx(B,{variant:"outline",className:"text-xs bg-gray-50 text-gray-500 border-gray-200",children:"All Inactive"}):null,e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[t.activeCount," active unit",t.activeCount!==1?"s":""]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(l,{size:"sm",variant:"outline",onClick:s=>{s.stopPropagation(),$e(t)},className:"text-xs gap-1",title:"Change status",children:t.hasActive?e.jsx(re,{className:"w-3.5 h-3.5 text-orange-600"}):e.jsx(ie,{className:"w-3.5 h-3.5 text-green-600"})}),e.jsx(l,{size:"sm",variant:"outline",onClick:s=>{s.stopPropagation(),Oe(t.entries[0])},className:"text-xs gap-1",title:"Update models",children:e.jsx(rt,{className:"w-3.5 h-3.5"})}),e.jsx(l,{size:"sm",variant:"outline",onClick:s=>{s.stopPropagation(),Le(t)},disabled:a.isDeletingPrompts,className:"text-destructive hover:text-destructive",children:e.jsx(be,{className:"w-4 h-4"})})]})]})},t.key)):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:w?"No prompts match your search.":"No prompts found."})}),c.length>A&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Showing ",(y-1)*A+1,"–",Math.min(y*A,c.length)," of"," ",c.length," prompts"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>V(t=>Math.max(1,t-1)),disabled:y<=1,children:e.jsx(gt,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:[y," / ",G]}),e.jsx(l,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>V(t=>Math.min(G,t+1)),disabled:y>=G,children:e.jsx(it,{className:"h-4 w-4"})})]})]})]})})]}),e.jsx(ee,{open:Pe,onOpenChange:T,children:e.jsxs(te,{children:[e.jsxs(se,{children:[e.jsx(ae,{children:"Confirm Deletion"}),e.jsx(ne,{children:D?e.jsxs(e.Fragment,{children:["Are you sure you want to remove this prompt and all its model entries (",D.entries.length," ","unit",D.entries.length!==1?"s":"",")? This action will affect analytics."]}):"Are you sure you want to remove this prompt? This action will affect analytics."})]}),e.jsxs(ye,{children:[e.jsx(l,{variant:"outline",onClick:Ge,children:"Cancel"}),e.jsx(l,{variant:"destructive",onClick:Fe,disabled:a.isDeletingPrompts,children:a.isDeletingPrompts?"Deleting...":"Confirm"})]})]})}),e.jsx(ee,{open:Ie,onOpenChange:k,children:e.jsxs(te,{className:"sm:max-w-[380px]",children:[e.jsxs(se,{children:[e.jsx(ae,{children:"Change Status"}),e.jsxs(ne,{children:["Set the status for all entries of this prompt",d&&e.jsxs(e.Fragment,{children:[" ","(",d.entries.length," unit",d.entries.length!==1?"s":"",")"]}),"."]})]}),d&&e.jsxs("div",{className:"flex flex-col gap-2 py-4",children:[e.jsxs(l,{variant:"outline",className:"justify-start gap-2",disabled:a.isUpdatingStatus||a.isUpdatingModels||d.activeModels.includes("CHATGPT")||a.isAtOrOverLimit,onClick:()=>xe(!0),children:[e.jsx(ie,{className:"w-4 h-4 text-green-600"}),"Activate (ChatGPT)",a.hasLimit&&a.isAtOrOverLimit&&e.jsx("span",{className:"ml-auto text-xs text-red-500",children:a.isOverLimit?"Limit exceeded":"Limit reached"})]}),e.jsxs(l,{variant:"outline",className:"justify-start gap-2",disabled:a.isUpdatingStatus||d.allInactive,onClick:()=>xe(!1),children:[e.jsx(re,{className:"w-4 h-4 text-orange-600"}),"Set All Inactive"]})]})]})}),e.jsx(ut,{open:Se,onOpenChange:ue,value:(()=>
11{if(g)return g;const t=($??[])[0];return t?{langCountryCode:`${t.language}, ${t.countryCode}`,regionDetails:t.regionDetails||"",language:t.language,countryCode:t.countryCode,country:t.country,reachType:t.countryCode?t.countryCode==="WW"?"worldwide":t.regionDetails?"local":"nationwide":""}:{langCountryCode:"",regionDetails:"",language:"",countryCode:"",country:"",reachType:""}})(),onConfirm:Ae,title:"Language & Region for New Prompt",description:"Select the language and target market. This will apply to the prompt you are creating.",confirmLabel:"Apply"}),e.jsx(ee,{open:De,onOpenChange:U,children:e.jsxs(te,{className:"sm:max-w-[425px]",children:[e.jsxs(se,{children:[e.jsx(ae,{children:"Update Models"}),e.jsx(ne,{children:"Select the AI models to run for this prompt. Each model consumes one unit."})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx("div",{className:"space-y-2",children:R.map(t=>{const s=S.includes(t.id);return e.jsxs("div",{className:C("flex cursor-pointer select-none items-center rounded-md px-3 py-2 border transition-colors hover:bg-accent hover:text-accent-foreground",s&&"bg-accent/50 border-primary"),onClick:()=>Be(t.id),children:[e.jsx("div",{className:C("mr-3 flex h-4 w-4 items-center justify-center rounded border border-primary/30",s?"bg-primary text-primary-foreground border-primary":"opacity-50"),children:s&&e.jsx(je,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx(Z,{model:t.id,className:"w-4 h-4"}),e.jsx("span",{className:"font-medium",children:t.name})]})]},t.id)})}),a.hasLimit&&e.jsx("div",{className:C("text-[12px] rounded-md px-3 py-2 border",Q?"text-red-700 bg-red-50 border-red-200":"text-[#666] bg-gray-50 border-gray-200"),children:Q?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold",children:"Limit exceeded."})," You have ",a.usage,"/",a.limit," active prompts used. This action would add ",v.toActivate," ","new unit(s). Remove or deactivate some prompts first."]}):e.jsxs(e.Fragment,{children:["Active usage: ",a.usage,"/",a.limit," prompts.",v.toActivate>0&&e.jsxs(e.Fragment,{children:[" +",v.toActivate," unit(s) to activate."]}),v.toDeactivate>0&&e.jsxs(e.Fragment,{children:[" −",v.toDeactivate," unit(s) to deactivate."]})]})})]}),e.jsxs(ye,{children:[e.jsx(l,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),e.jsx(l,{onClick:Re,disabled:a.isUpdatingModels||S.length===0||Q,children:a.isUpdatingModels?"Updating...":"Update Models"})]})]})}),u?.brandId&&e.jsx(lt,{open:Me,onOpenChange:he,brandId:u.brandId,agencyId:u.agencyId})]})}export{Rt 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.