PageSourceSearch

https://app.upmetrics.co/chunks/Bka-mCcU.js

js upmetrics.co collected 2026-10-01 11:50:32 UTC 13,536 bytes, 1 lines download raw bytes

1import{r as m,j as e}from"./Dem1e8VV.js";import{u as oe,G as f,S as J,w as ue,c as Z,y as W,P as ee,s as me,bF as xe,D as de,B as se,dl as fe,dm as he}from"../entry/CcVTEBpa.js";import{S as pe}from"./DLljA4ge.js";import{u as ge}from"./C4o0HCI3.js";import{P as te}from"./CE_AUhsl.js";import{T as Ee}from"./BaqFNWGq.js";import{m as be,X as Ne,as as le,e$ as Te,a3 as ve,v as re,f0 as je,d as Se,u as _e,W as Pe,al as ae,j as Ie,a7 as Le,c as Ce}from"./dWhdajSv.js";import{u as ye}from"./t8UF6ojH.js";import"./BnZNklX7.js";import"./phrJN640.js";import"./Dh95b2SR.js";import"./GT6AFM3O.js";import"./De7pillk.js";import"./DuSPsHJa.js";import"./CkPMUjKw.js";import"./DYyFy-YE.js";function Ae({selectedId:t,onSelect:n,onSelectedName:c,heading:p}){const a=oe(),[g,d]=m.useState("grid"),{filter:j,setFilter:M,showSourceSwitch:q,counts:E,query:u,setQuery:L,isLoading:D,docs:S,filtered:h,thumbMap:C,hoveredId:k,hoverIndex:O,hoverSlides:H,handleMouseEnter:B,handleMouseLeave:F,previewTemplate:_,setPreviewTemplate:P}=ge();return m.useEffect(()=>{if(!t||!c)return;const s=S.find(o=>o._id===t);s!=null&&s.name&&c(s.name)},[t,S,c]),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p&&e.jsx("div",{className:"min-w-0 me-auto",children:p}),q&&e.jsx("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-surface p-0.5 w-fit",children:[{key:"library",label:a("PITCH_DECK_TEMPLATE.GALLERY.TAB_LIBRARY")},{key:"shared",label:a("PITCH_DECK_TEMPLATE.GALLERY.TAB_SHARED")}].map(({key:s,label:o})=>{const x=j===s;return e.jsxs("button",{type:"button",onClick:()=>M(s),"aria-pressed":x,className:f("inline-flex items-center gap-1.5 px-3 h-7 rounded-md text-xs font-medium transition-colors cursor-pointer",x?"bg-foreground text-surface":"text-muted-foreground hover:text-foreground"),children:[o,E&&e.jsx("span",{className:f("rounded px-1 text-[10px] font-semibold leading-tight",x?"bg-surface/25":"bg-muted"),children:E[s]})]},s)})}),e.jsxs("div",{className:"ms-auto flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-56",children:[e.jsx(be,{className:"absolute start-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-20"}),e.jsx("input",{type:"text",value:u,onChange:s=>L(s.target.value),placeholder:a("PITCH_DECK_TEMPLATE.GALLERY.SEARCH_PLACEHOLDER"),className:f("w-full h-8 rounded-lg border border-border bg-surface ps-9 relative z-10",u?"pe-9":"pe-3","text-sm placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/40 transition-all")}),u&&e.jsx("button",{type:"button",onClick:()=>L(""),className:"absolute end-2 top-1/2 -translate-y-1/2 flex items-center justify-center h-5 w-5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors cursor-pointer z-20","aria-label":a("PITCH_DECK_TEMPLATE.GALLERY.CLEAR_SEARCH"),children:e.jsx(Ne,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"flex items-center rounded-lg border border-border bg-surface p-0.5 h-8 shrink-0",children:[{m:"grid",Icon:le,label:a("PITCH_SETUP.COMPONENTS.AI_BRIEF_STEP.VIEW_GRID")},{m:"list",Icon:Te,label:a("PITCH_SETUP.COMPONENTS.AI_BRIEF_STEP.VIEW_LIST")}].map(({m:s,Icon:o,label:x})=>e.jsx("button",{type:"button",onClick:()=>d(s),"aria-label":x,"aria-pressed":g===s,className:f("flex size-6 items-center justify-center rounded-md transition-colors cursor-pointer",g===s?"bg-foreground text-surface":"text-muted-foreground hover:text-foreground"),children:e.jsx(o,{className:"size-3.5"})},s))})]})]}),D?e.jsx("div",{className:"grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(180px,200px))] justify-start",children:Array.from({length:12}).map((s,o)=>e.jsxs("div",{className:"rounded-xl border border-border bg-surface overflow-hidden",children:[e.jsx(J,{className:"aspect-video w-full rounded-none"}),e.jsxs("div",{className:"px-3 py-2.5 border-t border-border space-y-1.5",children:[e.jsx(J,{className:"h-3.5 w-3/4"}),e.jsx(J,{className:"h-3 w-1/3"})]})]},o))}):h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center text-center text-sm text-muted-foreground py-12",children:[e.jsx(ve,{className:"h-10 w-10 mb-3 opacity-40"}),S.length>0?e.jsx("p",{className:"font-medium",children:a("PITCH_DECK_TEMPLATE.GALLERY.NO_SEARCH_RESULTS",{query:u})}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-medium",children:a(j==="shared"?"PITCH_DECK_TEMPLATE.GALLERY.SHARED_EMPTY_TITLE":"PITCH_DECK_TEMPLATE.GALLERY.EMPTY_TITLE")}),e.jsx("p",{className:"text-xs mt-1",children:a(j==="shared"?"PITCH_DECK_TEMPLATE.GALLERY.SHARED_EMPTY_DESC":"PITCH_DECK_TEMPLATE.GALLERY.EMPTY_DESC")})]})]}):e.jsx("div",{className:f("grid gap-3 max-h-[60vh] overflow-y-auto pe-1 -me-1",g==="grid"?"[grid-template-columns:repeat(auto-fill,minmax(180px,200px
1))] justify-start":"grid-cols-1 sm:grid-cols-2"),children:h.map(s=>{var G,T,z,U,A,Y,$,w,R,K;const o=k===s._id,x=t===s._id,y=H[O],I=(z=(T=s.slideCount)!=null?T:(G=s.slides)==null?void 0:G.length)!=null?z:0,N=g==="list";return e.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":x,onClick:()=>n(s._id,s.name),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),n(s._id,s.name))},onMouseEnter:()=>B(s._id),onMouseLeave:F,className:f("group text-start rounded-xl border-2 bg-surface overflow-hidden transition-all duration-200 cursor-pointer",N&&"flex items-center gap-4 p-2",x?"border-foreground ring-2 ring-foreground/15 shadow-md":"border-border hover:border-foreground/30 hover:shadow-sm"),children:[e.jsxs("div",{className:f("bg-muted/20 relative overflow-hidden",N?"w-40 shrink-0 aspect-video rounded-lg":"aspect-video"),children:[e.jsx(te,{blocks:s.pitchId?(U=C.get(s.pitchId))==null?void 0:U.blocks:void 0,slide:(Y=s.slides[0])!=null?Y:s.pitchId?(A=C.get(s.pitchId))==null?void 0:A.background:void 0,theme:($=s.theme)!=null?$:void 0,businessId:(w=s.businessId)!=null?w:null}),o&&y&&e.jsx("div",{className:"absolute inset-0 animate-in fade-in duration-300",children:e.jsx(te,{slide:y,theme:(R=s.theme)!=null?R:void 0,businessId:(K=s.businessId)!=null?K:null})}),x&&!N&&e.jsx("div",{className:"absolute top-2 end-2 flex items-center justify-center size-6 rounded-full bg-foreground text-surface shadow-sm",children:e.jsx(re,{className:"size-4"})}),e.jsxs("button",{type:"button","aria-label":a("PITCH_DECK_TEMPLATE.GALLERY.PREVIEW"),onClick:v=>{v.stopPropagation(),P(s)},className:"absolute bottom-2 end-2 flex items-center gap-1 rounded-full bg-surface/95 px-2.5 py-1 text-xs font-medium text-foreground shadow-sm opacity-0 transition-opacity group-hover:opacity-100 cursor-pointer",children:[e.jsx(je,{className:"size-3.5"}),a("PITCH_SETUP.COMPONENTS.AI_BRIEF_STEP.PREVIEW")]})]}),e.jsxs("div",{className:f(N?"flex-1 min-w-0 pe-2":"px-3 py-2.5 border-t border-border"),children:[e.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:s.name}),I>0&&e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a("PITCH_SETUP.COMPONENTS.AI_BRIEF_STEP.SLIDE_COUNT",{count:I})})]}),N&&x&&e.jsx("div",{className:"me-2 flex shrink-0 items-center justify-center size-6 rounded-full bg-foreground text-surface",children:e.jsx(re,{className:"size-4"})})]},s._id)})}),_&&e.jsx(Ee,{template:_,isOpen:!0,onClose:()=>P(null),onUseTemplate:s=>{n(s,_.name),P(null)},isProcessing:!1})]})}const l="PITCH_SETUP.COMPONENTS.AI_BRIEF_STEP";function ie(t){var n,c,p,a,g;return JSON.stringify({purpose:((n=t==null?void 0:t.purpose)!=null?n:"").trim(),audience:((c=t==null?void 0:t.audience)!=null?c:"").trim(),tone:((p=t==null?void 0:t.tone)!=null?p:"").trim(),length:(a=t==null?void 0:t.length)!=null?a:"standard",businessType:((g=t==null?void 0:t.businessType)!=null?g:"").trim()})}
1function ne({number:t,title:n,badge:c,badgeVariant:p,trailing:a}){return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-foreground text-sm font-semibold text-surface",children:t}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:n}),c&&e.jsx(de,{variant:"secondary",className:f("rounded-full text-[11px] font-medium",p==="required"?"bg-foreground/10 text-foreground":"bg-muted text-muted-foreground"),children:c}),a&&e.jsx("div",{className:"ms-auto",children:a})]})}function Je(){var Q,X;const t=oe(),{pitchId:n,isProcessing:c,commitCreateFromTemplate:p,aiPermitted:a}=ye(),{showUpgradeDialog:g}=ue(),{businessId:d=""}=Se(),j=_e(),[M]=Z("pitchStudio.saveBrief"),E=Pe().state,[u,L]=m.useState((Q=E==null?void 0:E.templateId)!=null?Q:null),[D,S]=m.useState((X=E==null?void 0:E.templateName)!=null?X:null),[h,C]=m.useState("ai"),[k,O]=m.useState(""),[H,B]=m.useState(""),[F,_]=m.useState(""),[P,s]=m.useState("standard"),o=W(()=>{var i;const r=(i=ee.findOne(n))==null?void 0:i.brief;return r?JSON.stringify(r):null},[n]),x=W(()=>{var r,i,b,V;return((V=(b=(i=(r=ee.findOne(n))==null?void 0:r.outline)==null?void 0:i.slides)==null?void 0:b.length)!=null?V:0)>0},[n]),y=m.useRef(!1);m.useEffect(()=>{if(y.current||!o)return;y.current=!0;const r=JSON.parse(o);r.purpose&&O(r.purpose),r.audience&&B(r.audience),r.tone&&_(r.tone),r.length&&s(r.length),L(i=>{var b;return(b=i!=null?i:r.templateId)!=null?b:null})},[o]);const I=!!u,N=I&&h==="ai",G=(r,i)=>{L(r),S(i)},T={purpose:k||void 0,audience:H.trim()||void 0,tone:F.trim()||void 0,length:P,templateId:u!=null?u:void 0},z=async()=>{if(!(c||!u)){if(h==="ai"){if(!a){g({businessId:d});return}const r=o?JSON.parse(o):null,i=x&&ie(T)===ie(r);try{await M(d,n,T)}catch(V){}const b=he(d,n);j(i?b:`${b}?fresh=true`,{state:{brief:T}});return}p(u)}},U=async()=>{try{await M(d,n,T)}catch(r){}j(fe(d))},[A]=Z("pitchStudio.brainReadiness"),Y=me(),$=d?Y.isOwner(d):!1,[w,R]=m.useState(null),K=W(()=>{const r=xe.findOne({businessId:d},{fields:{updatedAt:1}});return r!=null&&r.updatedAt?new Date(r.updatedAt).getTime():0},[d]);m.useEffect(()=>{if(!d)return;let r=!1;return A(d).then(i=>{r||R(typeof(i==null?void 0:i.substance)=="number"?i.substance:null)}).catch(()=>{r||R(null)}),()=>{r=!0}},[d,K,A]);const v=w!==null&&w<6,ce=t(h==="ai"?`${l}.GENERATE_OUTLINE_BUTTON`:`${l}.USE_TEMPLATE_BUTTON`);return e.jsx("div",{className:"flex h-full",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col bg-background",children:[e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6 py-6 space-y-8",children:e.jsxs("div",{className:"rounded-2xl border border-border bg-surface shadow-sm overflow-hidden divide-y divide-border",children:[e.jsx("div",{className:"px-6 py-5 pb-6",children:e.jsx(Ae,{heading:e.jsx(ne,{number:1,title:t(`${l}.STEP_DESIGN`),badge:t(`${l}
1.STEP_DESIGN_BADGE`),badgeVariant:"required"}),selectedId:u,onSelect:G,onSelectedName:S})}),I&&e.jsxs("div",{children:[e.jsx("div",{className:"px-6 py-5",children:e.jsx(ne,{number:2,title:t(`${l}.STEP_FILL`)})}),e.jsxs("div",{className:"px-6 pb-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>C("ai"),className:f("flex items-start gap-3 rounded-xl border-2 p-4 text-start transition-all cursor-pointer",h==="ai"?"border-ai/50 bg-ai/[0.04]":"border-border hover:border-ai/30"),children:[e.jsx(ae,{className:"mt-0.5 size-4 shrink-0 text-ai"}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:t(`${l}.FILL_AI`)}),!a&&e.jsxs(de,{variant:"outline",className:"gap-1 text-[10px]",children:[e.jsx(Ie,{className:"size-2.5 text-yellow-500"}),t(`${l}.FILL_AI_UPGRADE`)]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(`${l}.FILL_AI_DESC`)})]})]}),e.jsxs("button",{type:"button",onClick:()=>C("asis"),className:f("flex items-start gap-3 rounded-xl border-2 p-4 text-start transition-all cursor-pointer",h==="asis"?"border-primary bg-primary/5":"border-border hover:border-primary/40"),children:[e.jsx(le,{className:"mt-0.5 size-4 shrink-0 text-foreground/70"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:t(`${l}.FILL_ASIS`)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(`${l}.FILL_ASIS_DESC`)})]})]})]}),N&&e.jsx(pe,{purpose:k,audience:H,tone:F,length:P,onPurposeChange:O,onAudienceChange:B,onToneChange:_,onLengthChange:s})]})]})]})})}),e.jsx("div",{className:"shrink-0 border-t border-border bg-surface",children:e.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6 h-[60px] flex items-center justify-between gap-4",children:[v&&h==="ai"?e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(Le,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-500"}),e.jsx("p",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t(`${l}.THIN_PROFILE`)}),$&&e.jsx(se,{variant:"outline",size:"sm",className:"shrink-0 cursor-pointer",onClick:()=>{U()},children:t(`${l}.THIN_PROFILE_ACTION`)})]}):e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:u&&D?t(`${l}.SELECTED_SUMMARY`,{name:D}):t(`${l}.SELECT_TEMPLATE_HINT`)}),e.jsxs(se,{onClick:z,disabled:c||!I,className:f("cursor-pointer shrink-0 text-white",h==="ai"?"bg-ai hover:bg-ai/90":""),children:[c?e.jsx(Ce,{className:"h-4 w-4 animate-spin"}):h==="ai"?e.jsx(ae,{className:"h-4 w-4"}):null,ce]})]})})]})})}export{Je 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.