1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5150,23626],{2180:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(97968).A)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},5150:(e,a,s)=>{s.r(a),s.d(a,{AnglesTab:()=>z});var t=s(73797),n=s(56865),l=s(44668),r=s(36597),i=s(45556),o=s(80512),d=s(33078),c=s(28636),m=s(77316),u=s(74281),g=s(2180),x=s(8638),h=s(96278),p=s(18879),f=s(23626),v=s(97451);let j=(0,v.createServerReference)("60d8008b5749fb36431b0a3b353f82c9cb47e29b2b",v.callServer,void 0,v.findSourceMapURL,"createAngle"),b=(0,v.createServerReference)("608e57a334fbfadd353c1a1398facd19734b6da519",v.callServer,void 0,v.findSourceMapURL,"updateAngle"),y=(0,v.createServerReference)("408231ad1cb2c60b3478d0983a98b3901c39f2a1bc",v.callServer,void 0,v.findSourceMapURL,"deleteAngle"),N=(0,v.createServerReference)("6053f24fdd0edb4adacb8a135441002198eba83810",v.callServer,void 0,v.findSourceMapURL,"generateAngleFromContext");var w=s(71026),A=s(65363);let k=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),C=new Intl.NumberFormat(void 0,{maximumFractionDigits:1,notation:"compact"}),S="size-11 sm:size-6 [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3",_="h-11 w-full sm:h-8 sm:w-auto",L="h-11 sm:h-9";function z({projectId:e,angles:a,onAnglesChange:s}){let[r,i]=(0,n.useTransition)(),[o,d]=(0,n.useState)(!1),[c,g]=(0,n.useState)(null),[x,h]=(0,n.useState)(null),p=n.useCallback(e=>{g(e)},[]),f=n.useCallback(e=>{h(e)},[]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("section",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:"Message angles"}),(0,t.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:"Define the promise each ad should lead with and the claims it should avoid."})]}),(0,t.jsxs)(l.Button,{size:"sm",className:_,onClick:()=>d(!0),children:[(0,t.jsx)(u.A,{}),"Add Angle"]})]}),0===a.length?(0,t.jsxs)("div",{className:"max-w-xl rounded-xl border px-6 py-10",children:[(0,t.jsx)("h3",{className:"font-medium",children:"Name the promise you want to test"}),(0,t.jsx)("p",{className:"mt-1 mb-4 text-sm leading-6 text-muted-foreground",children:"Start with a clear frame such as customer proof, cost savings, or speed to value."}),(0,t.jsxs)(l.Button,{className:L,onClick:()=>d(!0),children:[(0,t.jsx)(u.A,{}),"Create first angle"]})]}):(0,t.jsx)("div",{className:"max-h-[calc(100vh-16rem)] divide-y overflow-y-auto overscroll-contain rounded-xl border",role:"list","aria-label":"Messaging angles",children:a.map(e=>(0,t.jsx)(D,{angle:e,isPending:r,onEdit:p,onDelete:f},e.id))})]}),(0,t.jsx)(B,{open:o,onOpenChange:d,onSubmit:t=>{if(!t.name?.trim())return void A.o.error("Angle name is required");let n={name:t.name.trim(),description:t.description?.trim()||void 0,do_say:t.do_say,dont_say:t.dont_say,context_snapshot_id:"context_snapshot_id"in t?t.context_snapshot_id:void 0};i(async()=>{try{let t=await j(e,n);s([...a,(0,w.C2)(t)]),d(!1),A.o.success("Angle created")}catch(e){console.error("Create angle failed:",e),A.o.error(M(e,"Failed to create angle. Your draft is still available."))}})},isPending:r,projectId:e}),(0,t.jsx)(B,{open:!!c,onOpenChange:e=>!e&&g(null),angle:c||void 0,onSubmit:e=>{if(!c)return;if(void 0!==e.name&&!e.name.trim())return void A.o.error("Angle name is required");let t={...e,name:e.name?.trim(),description:e.description?.trim()||null};i(async()=>{try{let e=await b(c.id,t),n=(0,w.C2)(e);s(a.map(e=>e.id===n.id?n:e)),g(null),A.o.success("Angle updated")}catch(e){console.error("Update angle failed:",e),A.o.error(M(e,"Failed to update angle. Your changes were not cleared."))}})},isPending:r,projectId:e}),(0,t.jsx)(m.K,{open:!!x,onOpenChange:e=>!e&&h(null),title:"Delete angle?",description:`Are you sure you want to delete "${x?.name}
1"? Text entries linked to this angle will lose the association.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>{x&&i(async()=>{try{await y(x.id),s(a.filter(e=>e.id!==x.id)),h(null),A.o.success("Angle deleted")}catch(e){console.error("Delete angle failed:",e),A.o.error(M(e,"Failed to delete angle. Please try again."))}})}})]})}function M(e,a){return e instanceof Error&&e.message?e.message:"string"==typeof e&&e.trim()?e:a}function F(e){return(e>=1e4?C:k).format(e)}let D=n.memo(function({angle:e,isPending:a,onEdit:s,onDelete:i}){let o=n.useMemo(()=>e.do_say.length+e.dont_say.length,[e]),d=o>0,c=n.useCallback(()=>s(e),[s,e]),m=n.useCallback(()=>i(e),[i,e]),u=n.useCallback(a=>{a&&window.location.hash===`#angle-${e.id}`&&a.scrollIntoView({block:"center"})},[e.id]);return(0,t.jsxs)("div",{id:`angle-${e.id}`,ref:u,className:"group min-w-0 scroll-mt-20 px-4 py-4 transition-colors [contain-intrinsic-size:112px] [content-visibility:auto] hover:bg-muted/30 target:bg-primary/5",role:"listitem",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-1.5",children:[(0,t.jsx)("h4",{className:"min-w-0 break-words text-sm font-medium leading-5 hyphens-auto [overflow-wrap:anywhere]",dir:"auto",title:e.name,children:e.name}),(0,t.jsx)(r.Badge,{variant:d?"secondary":"outline",className:"shrink-0 px-1.5 font-normal",children:d?F(o):"New"})]}),e.description?(0,t.jsx)("p",{className:"mt-1 break-words text-xs leading-5 text-muted-foreground line-clamp-2 hyphens-auto [overflow-wrap:anywhere]",dir:"auto",title:e.description,children:e.description}):(0,t.jsx)("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"No description yet"})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,t.jsx)(l.Button,{size:"icon-xs",variant:"ghost",className:S,onClick:c,disabled:a,"aria-label":`Edit ${e.name}`,children:(0,t.jsx)(g.A,{})}),(0,t.jsx)(l.Button,{size:"icon-xs",variant:"ghost",className:S,onClick:m,disabled:a,"aria-label":`Delete ${e.name}`,children:(0,t.jsx)(x.A,{})})]})]}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap gap-1",children:[e.do_say.length>0&&(0,t.jsxs)(r.Badge,{variant:"outline",className:"px-1.5 font-normal",children:[(0,t.jsx)(h.A,{className:"text-primary"}),"Do ",F(e.do_say.length)]}),e.dont_say.length>0&&(0,t.jsxs)(r.Badge,{variant:"outline",className:"px-1.5 font-normal",children:[(0,t.jsx)(p.A,{className:"text-destructive"}),"Avoid ",F(e.dont_say.length)]}),!d&&(0,t.jsx)(r.Badge,{variant:"outline",className:"px-1.5 font-normal",children:"Needs guardrails"})]})]})});function B({open:e,onOpenChange:a,angle:s,onSubmit:r,isPending:m,projectId:u}){let g=!!s,x=n.useId(),v=`${x}-angle-name`,j=`${x}-angle-description`,b=`${x}-angle-do-say`,y=`${x}-angle-dont-say`,[w,k]=(0,n.useState)(""),[C,S]=(0,n.useState)(""),[z,M]=(0,n.useState)(""),[F,D]=(0,n.useState)(""),[E,$]=(0,n.useState)(!1),[I,R]=(0,n.useState)(""),[U,P]=(0,n.useState)();n.useEffect(()=>{e&&R(""),e&&s?(k(s.name),S(s.description||""),M(s.do_say.join("\n")),D(s.dont_say.join("\n")),P(void 0)):e&&(k(""),S(""),M(""),D(""),P(void 0))},[e,s]);let T=e=>e.split("\n").map(e=>e.trim()).filter(Boolean),q=async()=>{$(!0);try{let e=await N(u,{focus:I});e.success?(k(e.data.name),S(e.data.description||""),M(e.data.do_say.join("\n")),D(e.data.dont_say.join("\n")),P(e.contextSnapshotId),A.o.success("Angle generated! Review and edit before saving.")):A.o.error(e.error||"Failed to generate angle")}catch(e){console.error("Error generating angle:",e),A.o.error("An error occurred while generating the angle")}finally{$(!1)}};return(0,t.jsx)(i.lG,{open:e,onOpenChange:a,children:(0,t.jsxs)(i.Cf,{size:"lg",className:"max-h-[90vh] overflow-y-auto",children:[(0,t.jsxs)(i.c7,{children:[(0,t.jsx)(i.L3,{children:g?"Edit Angle":"Create Angle"}),(0,t.jsx)(i.rr,{children:"Define a messaging angle to guide AI content generation. Use one item per line for lists."})]}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault();let a=w.trim();a?r({name:a,description:C.trim()||void 0,do_say:T(z),dont_say:T(F),context_snapshot_id:U}):A.o.error("Angle name is required")},className:"space-y-4","aria-busy":m||E,children:[!g&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-dashed bg-muted/50 p-3 sm:flex-row sm:items-center",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Generate from project context"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Create a new option from your project context."}),(0,t.jsx)(c.Label,{htmlFor:`${x}-generation-focus`,className:"mt-3 block",children:"Focus (optional)"}),(0,t.jsx)(o.p,{id:`${x}
1-generation-focus`,value:I,onChange:e=>R(e.target.value),maxLength:500,disabled:E||m,placeholder:"e.g., Lead with convenience for first-time customers"})]}),(0,t.jsxs)(l.Button,{type:"button",variant:"outline",size:"sm",onClick:q,disabled:E||m,loading:E,loadingLabel:(0,t.jsx)("span",{className:"shimmer",children:"Generating..."}),className:_,children:[(0,t.jsx)(f.A,{}),"Generate"]})]}),!g&&!w&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(c.Label,{children:"Quick Start Templates"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:[{name:"Social Proof",desc:"Leverage testimonials and user success stories"},{name:"Urgency",desc:"Create time-sensitive or scarcity-based messaging"},{name:"Value/Price",desc:"Emphasize cost savings and ROI"},{name:"Problem-Agitate-Solve",desc:"Highlight pain points then offer solution"},{name:"Aspirational",desc:"Focus on desired future state and transformation"},{name:"Educational",desc:"Teach and inform to build trust"}].map(e=>(0,t.jsx)(l.Button,{type:"button",variant:"outline",size:"sm",className:"min-h-11 sm:min-h-8",onClick:()=>{k(e.name),S(e.desc)},children:e.name},e.name))})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(c.Label,{htmlFor:v,children:"Name *"}),(0,t.jsx)(o.p,{id:v,value:w,onChange:e=>k(e.target.value),placeholder:"e.g., Social Proof, Urgency, Value Proposition",maxLength:120,autoComplete:"off",required:!0})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(c.Label,{htmlFor:j,children:"Description"}),(0,t.jsx)(d.T,{id:j,value:C,onChange:e=>S(e.target.value),placeholder:"How to approach messaging with this angle...",maxLength:500,rows:2})]}),(0,t.jsxs)("details",{className:"rounded-lg border px-3 py-2",open:g||void 0,children:[(0,t.jsxs)("summary",{className:"cursor-pointer text-sm font-medium",children:["Claim guardrails",(0,t.jsx)("span",{className:"ml-1 font-normal text-muted-foreground",children:"(optional)"})]}),(0,t.jsxs)("div",{className:"space-y-4 pt-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c.Label,{htmlFor:b,className:"flex items-center gap-2",children:[(0,t.jsx)(h.A,{className:"text-primary"}),"Do Say (one per line)"]}),(0,t.jsx)(d.T,{id:b,value:z,onChange:e=>M(e.target.value),placeholder:"Mention specific results\nUse customer testimonials\nInclude numbers and data",maxLength:3e3,rows:4}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Guidelines for what to include in messaging with this angle"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c.Label,{htmlFor:y,className:"flex items-center gap-2",children:[(0,t.jsx)(p.A,{className:"text-destructive"}),"Don't Say (one per line)"]}),(0,t.jsx)(d.T,{id:y,value:F,onChange:e=>D(e.target.value),placeholder:"Avoid vague claims\nDon't use competitor names\nNo unverified statistics",maxLength:3e3,rows:4}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Guidelines for what to avoid in messaging with this angle"})]})]})]}),(0,t.jsxs)(i.Es,{children:[(0,t.jsx)(l.Button,{type:"button",variant:"outline",className:L,onClick:()=>a(!1),disabled:m,children:"Cancel"}),(0,t.jsx)(l.Button,{type:"submit",className:L,disabled:!w.trim()||E,loading:m,loadingLabel:"Saving...",children:g?"Save Changes":"Create Angle"})]})]})]})})}},18879:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(97968).A)("thumbs-down",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]])},23626:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(97968).A)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}
1],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]])},28636:(e,a,s)=>{s.d(a,{Label:()=>r});var t=s(73797);function n(e){return(0,t.jsx)("label",{...e})}s(56865);var l=s(76843);function r({className:e,...a}){return(0,t.jsx)(n,{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...a})}},45556:(e,a,s)=>{s.d(a,{Cf:()=>g,Es:()=>h,L3:()=>p,c7:()=>x,lG:()=>o,rr:()=>f,zM:()=>d});var t=s(73797);s(56865);var n=s(58871),l=s(49721),r=s(76843),i=s(44668);function o({...e}){return(0,t.jsx)(l.bL,{"data-slot":"dialog",...e})}function d({...e}){return(0,t.jsx)(l.l9,{"data-slot":"dialog-trigger",...e})}function c({...e}){return(0,t.jsx)(l.ZL,{"data-slot":"dialog-portal",...e})}function m({className:e,...a}){return(0,t.jsx)(l.hJ,{"data-slot":"dialog-overlay",className:(0,r.cn)("motion-dialog-overlay fixed inset-0 z-50 bg-black/50 data-[closed]:!pointer-events-none",e),...a})}let u={default:"sm:max-w-lg",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-3xl","2xl":"sm:max-w-7xl",full:"sm:max-w-[calc(100vw-4rem)]"};function g({className:e,children:a,showCloseButton:s=!0,size:i="default",...o}){return(0,t.jsxs)(c,{"data-slot":"dialog-portal",children:[(0,t.jsx)(m,{}),(0,t.jsxs)(l.UC,{"data-slot":"dialog-content",className:(0,r.cn)("motion-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none data-[closed]:!pointer-events-none",u[i],e),...o,children:[a,s&&(0,t.jsxs)(l.bm,{"data-slot":"dialog-close",className:"absolute top-2 right-2 inline-flex size-11 items-center justify-center rounded-md opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[open]:bg-accent data-[open]:text-muted-foreground sm:top-3 sm:right-3 sm:size-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,t.jsx)(n.A,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function x({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"dialog-header",className:(0,r.cn)("flex flex-col gap-2 text-center sm:text-left",e),...a})}function h({className:e,showCloseButton:a=!1,children:s,...n}){return(0,t.jsxs)("div",{"data-slot":"dialog-footer",className:(0,r.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n,children:[s,a&&(0,t.jsx)(l.bm,{render:(0,t.jsx)(i.Button,{variant:"outline",children:"Close"})})]})}function p({className:e,...a}){return(0,t.jsx)(l.hE,{"data-slot":"dialog-title",className:(0,r.cn)("text-lg leading-none font-semibold",e),...a})}function f({className:e,...a}){return(0,t.jsx)(l.VY,{"data-slot":"dialog-description",className:(0,r.cn)("text-sm text-muted-foreground",e),...a})}},58871:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(97968).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},96278:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(97968).A)("thumbs-up",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]])}}]);
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.