1import{j as e,u as Y}from"./query-DmstuUoN.js";import{l as $e,h as Me,i as qe,a as i,L as K}from"./vendor-CHI41uxr.js";import{c as Ce,K as Te,ak as Ae,H as Q,al as U,B as w,am as A,L as ie,y as D,E as P,b as B,z as ce,A as oe,l as G,Z as ge,U as Ue,s as Fe,D as Be,d as Oe,e as He,f as Ve,g as Ke,an as Qe,t as Ge,v as Ye,M as je,S as Ne,w as Xe,x as se,ao as Ze,X as We}from"./index-CT7kTiav.js";import{p as Je,M as de,S as es,b as ss,C as as,F,H as ts,a as Se,Q as rs,d as ls,e as me,f as ns}from"./QuickSendModal-fc8TmXFK.js";import{u as is}from"./useDocumentTitle-BOGfSQQj.js";import{B as I}from"./badge-CIRiQWe_.js";import{S as ae}from"./separator-Ze28ghRy.js";import{I as cs}from"./input-Dvd23oTk.js";import{T as os,a as ds,b as we,c as ye}from"./tabs-CLdUJLBs.js";import{A as te}from"./arrow-right-CPLP7bUF.js";import{L as ms}from"./loader-2-DBtHWqj4.js";import{D as re}from"./AreaChart-BbjuXgQC.js";import{E as _e}from"./external-link-toS3VXTH.js";import{C as xs}from"./select-rx-Gp2-j.js";import{T as hs,B as us}from"./target-M1bY3lO6.js";import{L as ve}from"./layers-osaYmonJ.js";import{S as ps}from"./search-CMCprIi4.js";import{T as fs}from"./trending-up-BJitD4Ir.js";import"./ui-WgsiDFN4.js";import"./checkbox-CcaDavml.js";import"./switch-Toae-IaB.js";import"./mail-D42Ko5db.js";import"./alert-circle-Bk1rTHL-.js";const be=Ce("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const ke=Ce("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);function gs(l){const c=/<a[^>]*href="([^"]*)"[^>]*>([^<]*)<\/a>/gi,r=[];let d=0,o,f=0;for(;(o=c.exec(l))!==null;){o.index>d&&r.push(l.slice(d,o.index));const[,m,p]=o;r.push(e.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",onClick:x=>x.stopPropagation(),children:p},f++)),d=o.index+o[0].length}return d<l.length&&r.push(l.slice(d)),r.length>0?r:[l]}function js(l){return!!l&&"global"in l&&typeof l.global=="object"}function xe(l){if(!l)return null;if(js(l)){const c=l.global.delivered;if(Array.isArray(c)&&c.length>0){const r=c[c.length-1];if(Array.isArray(r)&&r.length===2)return r[1]}return null}return"delivered"in l&&Array.isArray(l.delivered)?l.delivered[l.delivered.length-1]??null:null}function le(){const{setTheme:l,resolvedTheme:c}=Te();return e.jsxs(Ge,{children:[e.jsx(Ye,{asChild:!0,children:e.jsxs(w,{variant:"ghost",size:"icon",children:[c==="dark"?e.jsx(je,{className:"h-5 w-5"}):e.jsx(Ne,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),e.jsxs(Xe,{align:"end",children:[e.jsxs(se,{onClick:()=>l("light"),children:[e.jsx(Ne,{className:"mr-2 h-4 w-4"}),"Light"]}),e.jsxs(se,{onClick:()=>l("dark"),children:[e.jsx(je,{className:"mr-2 h-4 w-4"}),"Dark"]}),e.jsxs(se,{onClick:()=>l("system"),children:[e.jsx(Ze,{className:"mr-2 h-4 w-4"}),"System"]})]})]})}function Ns({tweetId:l,theme:c}){const r=i.useRef(null),d=i.useRef(null),[o,f]=i.useState(!1),[m,p]=i.useState(!1),x=i.useRef(!0);return i.useEffect(()=>{if(f(!1),p(!1),x.current=!0,d.current&&r.current){try{r.current.removeChild(d.current)}catch{}d.current=null}const _=r.current;if(!_)return;const j=document.createElement("div");d.current=j,_.appendChild(j);const R=()=>{if(!(!x.current||!j.parentNode)){if(!window.twttr?.widgets?.createTweet){p(!0);return}window.twttr.widgets.createTweet(l,j,{theme:c,conversation:"none",dnt:!0}).then(L=>{x.current&&(L?f(!0):p(!0))}).catch(L=>{x.current&&p(!0)})}};return(()=>{if(window.twttr?.widgets?.createTweet){R();return}if(document.getElementById("twitter-wjs")){const k=setInterval(()=>{window.twttr?.widgets?.createTweet&&(clearInterval(k),R())},100);setTimeout(()=>{clearInterval(k),!o&&x.current&&p(!0)},1e4);return}const N=document.createElement("script");N.src="https://platform.twitter.com/widgets.js",N.id="twitter-wjs",N.async=!0,N.onload=()=>{const k=setInterval(()=>{window.twttr?.widgets?.createTweet&&(clearInterval(k),R())},100);setTimeout(()=>clearInterval(k),1e4)},N.onerror=()=>{x.current&&p(!0)},document.body.appendChild(N)})(),()=>{if(x.current=!1,d.current&&r.current){try{r.current.removeChild(d.current)}catch{}d.current=null}}},[l,c]),e.jsxs("div",{ref:r,className:B("min-h-[200px]",!o&&!m&&"flex items-center justify-center"),children:[!
1o&&!m&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading tweet..."}),m&&e.jsx("div",{className:"text-sm text-muted-foreground",children:e.jsx("a",{href:`https://twitter.com/i/web/status/${l}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View tweet on X â"})})]})}function ws({tweetUrl:l,theme:c}){const r=i.useMemo(()=>{const d=/^https?:\/\/(twitter\.com|x\.com)\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)/,o=l.match(d);return o?o[4]:null},[l]);return r?e.jsx(Ns,{tweetId:r,theme:c},`${r}-${c}`):null}function Le({videoUrl:l,isExpanded:c,onToggleExpand:r}){const[d,o]=i.useState(!1),f=i.useMemo(()=>{const m=l.match(/vimeo\.com\/(?:video\/)?(\d+)/);return m?m[1]:null},[l]);return f?e.jsx(D,{className:B(c&&"col-span-full"),children:e.jsx(P,{className:"p-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(w,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 z-10 h-7 w-7 bg-background/80 hover:bg-background",onClick:r,title:c?"Collapse":"Expand",children:c?e.jsx(de,{className:"h-4 w-4"}):e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:[!d&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted/20 rounded-lg",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading video..."})}),e.jsx("iframe",{src:`https://player.vimeo.com/video/${f}?badge=0&autopause=0&player_id=0&app_id=58479`,className:"absolute inset-0 w-full h-full rounded-lg",frameBorder:"0",allow:"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media",title:"Vimeo video",onLoad:()=>o(!0)})]})]})})}):null}function ys({videos:l,expandedUrl:c,onExpandChange:r}){const d=f=>{r(c===f?null:f)},o=c!==null;return e.jsx("div",{className:"space-y-4",children:l.map(f=>{const m=c===f;return o&&!m?null:e.jsx(Le,{videoUrl:f,isExpanded:m,onToggleExpand:()=>d(f)},f)})})}function vs({blogUrl:l}){const c=i.useMemo(()=>{try{const o=new URL(l).pathname.split("/").filter(Boolean),m=(o[o.length-1]||"").split("-").slice(0,-1).join(" ");return m?m.split(" ").map(p=>p.charAt(0).toUpperCase()+p.slice(1).toLowerCase()).join(" "):"Blog Post"}catch{return"Blog Post"}},[l]),r=i.useMemo(()=>{try{return new URL(l).hostname}catch{return"blog.delivr.to"}},[l]);return e.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border bg-card hover:border-primary/50 transition-colors overflow-hidden",children:e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"w-2 flex-shrink-0 bg-primary"}),e.jsx("div",{className:"flex-1 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-card border flex items-center justify-center",children:e.jsx(U,{size:32,className:"text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-base line-clamp-2",children:c}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1 flex items-center gap-1",children:[e.jsx(_e,{className:"h-3 w-3"}),r]})]})]})})]})})}function bs(l){const c=[],r=[],d=[],o=[],f=new Set;for(const m of l){if(!m||typeof m!="string"||!m.trim())continue;const p=m.trim();if(f.has(p))continue;f.add(p);let x="";try{x=new URL(p).hostname.toLowerCase()}catch{o.push(p);continue}x==="twitter.com"||x==="www.twitter.com"||x==="x.com"||x==="www.x.com"?c.push(p):x==="vimeo.com"||x==="www.vimeo.com"||x==="player.vimeo.com"?r.push(p):x==="blog.delivr.to"?d.push(p):o.push(p)}return{twitter:c,vimeo:r,blogs:d,other:o}}function ne({allPayloads:l,onSelectPayload:c,search:r,onSearchChange:d,activeTab:o,onTabChange:f,selectedTemplateId:m,onTemplateSelect:p}){const x=i.useRef(null),_=i.useRef(null),{data:j=[],isLoading:R}=Y({queryKey:["public","payloads","list"],queryFn:me.list,staleTime:1e3*60*5,initialData:l.length>0?l:void 0}),{data:b=[],isLoading:L}=Y({queryKey:["public","templates","list"],queryFn:ns.list,staleTime:1e3*60*5}),N=i.useMemo(()=>!m||!b.length?null:b.find(t=>t.template_id===m)||null,[m,b]),k=i.useMemo(()=>
1{if(!N?.recipe_ids||!j.length)return[];const t=new Set(N.recipe_ids);return j.filter(g=>t.has(g.recipe_id)).sort((g,u)=>{const E=g.added_epoch??0;return(u.added_epoch??0)-E})},[N,j]),O=i.useMemo(()=>[...j].sort((t,h)=>{const g=t.added_epoch??0;return(h.added_epoch??0)-g}),[j]),H=i.useMemo(()=>{if(!r.trim())return O;const t=r.toLowerCase();return O.filter(h=>h.name.toLowerCase().includes(t)||h.description?.toLowerCase().includes(t)||h.tags?.some(g=>g.toLowerCase().includes(t)))},[O,r]),$=i.useMemo(()=>[...b].sort((t,h)=>t.template_name.localeCompare(h.template_name)),[b]),M=i.useMemo(()=>{if(!$.length)return[];if(!r.trim())return $;const t=r.toLowerCase();return $.filter(h=>h.template_name.toLowerCase().includes(t)||h.template_description?.toLowerCase().includes(t)||h.tags?.some(g=>g.toLowerCase().includes(t)))},[$,r]),z=o==="payloads"?R:L;return i.useEffect(()=>{if(m){const t=setTimeout(()=>{if(x.current&&_.current){const h=x.current,g=_.current,u=h.getBoundingClientRect().top,q=g.getBoundingClientRect().top-u+h.scrollTop;h.scrollTo({top:q,behavior:"smooth"})}},150);return()=>clearTimeout(t)}},[m]),e.jsx("div",{className:"space-y-4",children:e.jsxs(os,{value:o,onValueChange:f,children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs(ds,{children:[e.jsxs(we,{value:"payloads",className:"gap-2",children:[e.jsx(F,{className:"h-4 w-4"}),"Payloads"]}),e.jsxs(we,{value:"templates",className:"gap-2",children:[e.jsx(ve,{className:"h-4 w-4"}),"Templates"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(cs,{placeholder:"Search "+o+"...",value:r,onChange:t=>d(t.target.value),className:"pl-9"})]}),e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:o==="payloads"?j.length+" payloads":b.length+" templates"})]})]}),e.jsxs(ye,{value:"payloads",className:"mt-4",children:[z?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(ie,{size:48,className:"text-primary"})}):e.jsx("div",{className:"max-h-[calc(100vh-8rem)] overflow-y-auto pr-2",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:H.map(t=>{const h=t.name.split(".").pop()?.toLowerCase()||"",g=xe(t.metrics_history);return e.jsx(D,{className:"h-full hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>c(t.recipe_id),children:e.jsx(P,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:"/images/"+h+".png",alt:h,className:"h-8 w-8 flex-shrink-0",onError:u=>{u.target.src="/images/blank.png"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-medium text-sm truncate",children:t.name}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,3).map(u=>e.jsx(I,{variant:"secondary",className:"text-xs",children:u},u))}),typeof g=="number"&&e.jsxs("div",{className:"flex items-center gap-1 mt-2 text-xs text-muted-foreground",children:[e.jsx(fs,{className:"h-3 w-3"}),e.jsxs("span",{children:[g.toFixed(0),"% delivered"]})]})]})]})})},t.recipe_id)})})}),!z&&H.length===0&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:['No payloads found matching "',r,'"']})]}),e.jsxs(ye,{value:"templates",className:"mt-4",children:[L?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(ie,{size:48,className:"text-primary"})}):e.jsxs("div",{className:"flex gap-6",children:[e.jsx("div",{ref:x,className:B("transition-all flex-1 min-w-0 max-h-[calc(100vh-8rem)] overflow-y-auto pr-2",N&&"max-w-[50%]"),children:e.jsx("div",{className:B("grid gap-4",N?"grid-cols-1":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),children:M.map(t=>{const h=N?.template_id===t.template_id,g=ls(t);return e.jsx("div",{ref:h?_:void 0,className:"p-0.5",children:e.jsxs(D,{className:B("h-full hover:border-primary/50 transition-colors overflow-hidden cursor-pointer",h&&"ring-2 ring-primary"),onClick:()=>p(h?null:t.template_id),children:[g&&e.jsx("div",{className:"aspect-video w-full bg-muted/20 overflow-hidden",children:e.jsx("img",{src:g,alt:t.template_name,className:"w-full h-full object-cover",onError:u=>{u.target.parentElement.style.display="none"}})}),e.jsx(P,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[!g&&e.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded bg-primary/10 flex items-center justify-center",children:e.jsx(ve,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-medium text-sm truncate",children:t.template_name}),t.template_description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-4",children:gs(t.template_description)}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:t.tags.slice(0,3).map(u=>e.jsx(I,{variant:"secondary",className:"text-xs",children:u},u))}),e.jsxs("div",{className:"flex items-center gap-1 mt-2 text-xs text-muted-foreground",children:[e.jsx(F,{className:"h-3 w-3"}),e.jsx("span",{children:(t.payload_count||"0")+" payloads"})]})]})]})})]})},t.template_id)})})}),N&&e.jsx("div",{className:"w-[50%] flex-shrink-0",children:e.jsxs(D,{className:"sticky top-24 max-h-[calc(100vh-8rem)] flex flex-col",children:[e.jsx(ce,{className:"pb-3 flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(oe,{className:"text-base",children:N.template_name}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[k.length," payloads in this template"]})]}),e.jsx(w,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>p(null),children:e.jsx(We,{className:"h-4 w-4"})})]})}),e.jsx(P,{className:"flex-1 overflow-y-auto min-h-0",children:k.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"No payloads found for this template"}):e.jsx("div",{className:"space-y-2",children:k.map(t=>{const h=t.name.split(".").pop()?.toLowerCase()||"",g=xe(t.metrics_history);return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>c(t.recipe_id),children:[e.jsx("img",{src:"/images/"+h+".png",alt:h,className:"h-6 w-6 flex-shrink-0",onError:u=>{u.target.src="/images/blank.png"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:t.name}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,2).map(u=>e.jsx(I,{variant:"secondary",className:"text-xs",children:u},u))})]}),typeof g=="number"&&e.jsxs("div",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[g.toFixed(0),"%"]})]},t.recipe_id)})})})]})})]}),!L&&M.length===0&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:['No templates found matching "',r,'"']})]})]})})}function ks(){const{payloadId:l}=$e(),c=Me(),[r,d]=qe(),[o,f]=i.useState(!1),[m,p]=i.useState(null),[x,_]=i.useState(null),[j,R]=i.useState(null),[b,L]=i.useState(!1),[N,k]=i.useState(!1),[O,H]=i.useState(!1),{resolvedTheme:$}=Te(),{isAuthenticated:M}=Ae(),z=i.useRef(null),[t,h]=i.useState(null),g=i.useRef(!1),u=l||r.get("id")||void 0,E=r.get("explore")==="1",q=r.get("q")||r.get("search")||"",he=r.get("tab")||"payloads",X=r.get("template")||null,C=i.useCallback(s=>{d(n=>{const S=new URLSearchParams(n);
1return Object.entries(s).forEach(([y,v])=>{v===null||v===""?S.delete(y):S.set(y,v)}),S},{replace:!0})},[d]);i.useEffect(()=>{if(g.current)return;const s=r.get("search");if(s&&!r.get("q")){g.current=!0;const n=new URLSearchParams(r);n.delete("search"),n.set("q",s),n.has("tab")||n.set("tab","payloads"),d(n,{replace:!0})}},[]);const De=i.useCallback(()=>{C({explore:E?null:"1"})},[E,C]),Z=i.useCallback(s=>{const n=new URLSearchParams(r);c(`/payloads/${s}?${n.toString()}`,{replace:!1}),window.scrollTo({top:0,behavior:"smooth"})},[c,r]),Pe=i.useCallback(()=>{const s=`${window.location.origin}/payloads/${u}`;navigator.clipboard.writeText(s).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)})},[u]),W=i.useCallback((s,n)=>{navigator.clipboard.writeText(n).then(()=>{p(s),Q.success(`${s} copied to clipboard`),setTimeout(()=>p(null),2e3)})},[]),Re=i.useCallback(async s=>{if(!b){L(!0),Q.loading("Preparing download...",{id:"payload-download"});try{const n=await Je.download(s);if(n.type==="redirect")window.open(n.url,"_blank"),Q.success(`Download started: ${n.filename}`,{id:"payload-download"});else{const S=URL.createObjectURL(n.blob),y=document.createElement("a");y.href=S,y.download=n.filename,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(S),Q.success(`Downloaded: ${n.filename}`,{id:"payload-download"})}}catch{Q.error("Failed to download payload",{id:"payload-download"})}finally{L(!1)}}},[b]),{data:a,isLoading:Ee,error:ze}=Y({queryKey:["public","payload",u],queryFn:()=>me.get(u),enabled:!!u,staleTime:1e3*60*5});is(a?.name??"Payloads",[a?.name]);const{data:J=[]}=Y({queryKey:["public","payloads","list"],queryFn:me.list,staleTime:1e3*60*5});i.useEffect(()=>{R(null),_(null)},[u]),i.useEffect(()=>{if(!z.current)return;const s=()=>{z.current&&h(z.current.offsetHeight)};s();const n=new ResizeObserver(s);return n.observe(z.current),()=>n.disconnect()},[a]);const T=i.useMemo(()=>a?.references?bs(a.references):{twitter:[],vimeo:[],blogs:[],other:[]},[a?.references]),ue=T.twitter.length>0||T.vimeo.length>0||T.blogs.length>0||T.other.length>0||a?.image,pe=a?.name.split(".").pop()?.toLowerCase()||"",fe=xe(a?.metrics_history),Ie=$==="dark"?"dark":"light";return u?Ee?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(ie,{size:64,className:"text-primary"})}):ze||!a?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(K,{to:"/",className:"flex items-center gap-2",children:[e.jsx(U,{size:28,className:"text-primary"}),e.jsx("span",{className:"text-lg font-semibold text-foreground",children:"delivr.to"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{}),e.jsx(w,{asChild:!0,variant:"default",size:"sm",children:e.jsx("a",{href:A("/app/payloads"),children:"Sign In"})})]})]})})}),e.jsxs("div",{className:"container max-w-4xl mx-auto py-12 px-4",children:[e.jsx(D,{children:e.jsxs(P,{className:"py-12 text-center",children:[e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Payload Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"The requested payload could not be found or may have been removed."}),e.jsxs(w,{onClick:()=>C({explore:"1"}),variant:"outline",children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),"Explore Payload Library"]})]})}),E&&e.jsx("div",{className:"mt-8",children:e.jsx(ne,{allPayloads:J,onSelectPayload:Z,search:q,onSearchChange:s=>C({q:s||null}),activeTab:he,onTabChange:s=>C({tab:s==="payloads"?null:s}),selectedTemplateId:X,onTemplateSelect:s=>C({template:s})})})]})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(K,{to:"/",className:"flex items-center gap-2",children:[e.jsx(U,{size:28,className:"text-primary"}),e.jsx("span",{className:"text-lg font-semibold text-foreground",children:"delivr.to"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{}),e.jsx(w,{asChild:!0,variant:"default",size:"sm",children:e.jsxs("a",{href:A("/app/payloads"),className:"gap-2",children:["Test Your Email Security",e.jsx(te,{className:"h-4 w-4"})]})})]})]})})}),e.jsxs("main",{className:"container max-w-6xl mx-auto py-8 px-4",children:[x&&e.jsx("div",{className:"mb-8",children:e.jsx(Le,{videoUrl:x,isExpanded:!0,onToggleExpand:()=>_(null)})}),j&&e.jsx("div",{className:"mb-8",children:e.jsx(D,{children:e.jsx(P,{className:"p-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(w,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 h-7 w-7 bg-background/80 hover:bg-background",onClick:()=>R(null),title:"Collapse",children:e.jsx(de,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1 pl-1",children:[e.jsx(be,{className:"h-3 w-3"}),"Payload Structure"]}),e.jsx("img",{src:j,alt:"Payload structure",className:"max-w-full h-auto rounded-lg mx-auto"})]})})})}),!x&&!j&&e.jsxs("div",{className:B("grid gap-8 mb-8",ue?"lg:grid-cols-[1fr,380px]":"grid-cols-1"),children:[e.jsx("div",{className:"space-y-6 min-w-0",ref:z,children:e.jsxs(D,{className:"overflow-hidden",children:[e.jsx(ce,{className:"pb-4",children:e.jsxs("div",{className:"flex items-start gap-4 min-w-0",children:[e.jsx("img",{src:"/images/"+pe+".png",alt:pe,className:"h-12 w-12 flex-shrink-0",onError:s=>{s.target.src="/images/blank.png"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 min-w-0",children:[e.jsx(oe,{className:"text-2xl truncate min-w-0 flex-1",children:a.name}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(w,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Pe,title:"Copy link to share",children:o?e.jsx(G,{className:"h-4 w-4 text-success"}):e.jsx(es,{className:"h-4 w-4"})}),M&&a.downloadable!==!1&&e.jsx(w,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Re(a.payload_id),disabled:b,title:"Download payload",children:b?e.jsx(ms,{className:"h-4 w-4 animate-spin"}):e.jsx(re,{className:"h-4 w-4"})}),M&&e.jsx(w,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>k(!0),title:"Quick send to validated email",children:e.jsx(ge,{className:"h-4 w-4 text-yellow-500"})})]})]}),a.tags&&a.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:a.tags.map(s=>e.jsx(I,{variant:"secondary",children:s},s))})]}),fe!==null&&e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsxs("div",{className:"text-3xl font-bold text-chart-purple",children:[fe.toFixed(0),"%"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Global Deliverability"})]})]})}),!M&&a.downloadable!==!1&&e.jsxs("div",{className:"mx-6 mb-2 flex items-center justify-between gap-4 roun
1ded-lg border border-primary/20 bg-primary/5 p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:"Download this payload for free"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"No credit card required"})]}),e.jsxs(w,{className:"shrink-0 gap-2",onClick:()=>H(!0),children:[e.jsx(re,{className:"h-4 w-4"}),"Download"]})]}),e.jsxs(P,{className:"space-y-6",children:[a.description&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:"Description"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-line",children:a.description})]}),a.metrics_history&&e.jsxs(e.Fragment,{children:[e.jsx(ae,{}),e.jsxs("div",{children:[e.jsx(ss,{metricsHistory:a.metrics_history,title:"Global Deliverability (30 days)",globalOnly:!0}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"This shows how often this payload bypasses email security controls globally."})]})]}),(a.groups?.length||a.techniques?.length||a.file_types?.length)&&e.jsxs(e.Fragment,{children:[e.jsx(ae,{}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.groups&&a.groups.length>0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ue,{className:"h-4 w-4 text-muted-foreground mt-1 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:"Associated Threat Actors"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.groups.map(s=>e.jsx(I,{variant:"outline",children:s},s))})]})]}),a.techniques&&a.techniques.length>0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(as,{className:"h-4 w-4 text-muted-foreground mt-1 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:"MITRE ATT&CK Techniques"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.techniques.map(s=>e.jsx(I,{variant:"outline",children:s},s))})]})]}),a.file_types&&a.file_types.length>0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(F,{className:"h-4 w-4 text-muted-foreground mt-1 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:"File Types"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.file_types.map(s=>e.jsx(I,{variant:"outline",children:s},s))})]})]})]})]}),(a.hash||a.payload_id||a.recipe_id)&&e.jsxs(e.Fragment,{children:[e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Technical Details"}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.hash&&e.jsxs("div",{className:"flex items-start gap-3",children:[m==="MD5 Hash"?e.jsx(G,{className:"h-4 w-4 text-success mt-1 flex-shrink-0"}):e.jsx(ts,{className:"h-4 w-4 text-muted-foreground mt-1 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"text-sm font-medium mb-1.5",children:"MD5 Hash"}),e.jsx("div",{className:"bg-muted/50 rounded-md px-3 py-2 cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>W("MD5 Hash",a.hash),title:"Click to copy",children:e.jsx("span",{className:"font-mono text-xs break-all",children:a.hash})})]})]}),a.payload_id&&e.jsxs("div",{className:"flex items-start gap-3",children:[m==="Payload ID"?e.jsx(G,{className:"h-4 w-4 text-success mt-1 flex-shrink-0"}):e.jsx(F,{className:"h-4 w-4 text-muted-foreground mt-1 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"text-sm font-medium mb-1.5",children:"Payload ID"}),e.jsx("div",{className:"bg-muted/50 rounded-md px-3 py-2 cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>W("Payload ID",a.payload_id),title:"Click to copy",children:e.jsx("span",{className:"font-mono text-xs break-all",children:a.payload_id})})]})]}),a.recipe_id&&e.jsxs("div",{className:"flex items-start gap-3",children:[m==="Recipe ID"?e.jsx(G,{className:"h-4 w-4 text-success mt-1 flex-shrink-0"}):e.jsx(F,{className:"h-4 w-4 text-muted-foreground mt-1 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"text-sm font-medium mb-1.5",children:"Recipe ID"}),e.jsx("div",{className:"bg-muted/50 rounded-md px-3 py-2 cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>W("Recipe ID",a.recipe_id),title:"Click to copy",children:e.jsx("span",{className:"font-mono text-xs break-all",children:a.recipe_id})})]})]})]})]})]})]})]})}),ue&&e.jsxs("div",{className:"space-y-4 self-start overflow-y-auto pr-2",style:{maxHeight:t?`${t}px`:"calc(100vh - 8rem)"},children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Related Media & References"}),a.image&&e.jsx(D,{children:e.jsx(P,{className:"p-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(w,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 h-7 w-7 bg-background/80 hover:bg-background",onClick:()=>R(j?null:`data:image/png;base64,${a.image}`),title:j?"Collapse":"Expand",children:j?e.jsx(de,{className:"h-4 w-4"}):e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1 pl-1",children:[e.jsx(be,{className:"h-3 w-3"}),"Payload Structure"]}),e.jsx("img",{src:`data:image/png;base64,${a.image}`,alt:"Payload structure",className:"max-w-full h-auto rounded-lg mx-auto"})]})})}),T.vimeo.length>0&&e.jsx(ys,{videos:T.vimeo,expandedUrl:x,onExpandChange:_}),T.twitter.length>0&&e.jsx("div",{className:"space-y-4",children:T.twitter.map(s=>e.jsx(D,{children:e.jsx(P,{className:"p-4",children:e.jsx(ws,{tweetUrl:s,theme:Ie})})},s))}),T.blogs.length>0&&e.jsx("div",{className:"space-y-4",children:T.blogs.map(s=>e.jsx(vs,{blogUrl:s},s))}),T.other.length>0&&e.jsxs(D,{children:[e.jsx(ce,{className:"pb-2",children:e.jsx(oe,{className:"text-sm font-medium",children:"References"})}),e.jsx(P,{children:e.jsx("ul",{className:"space-y-2",children:T.other.map(s=>e.jsx("li",{children:e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-2 text-sm",children:[e.jsx(_e,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:s})]})},s))})})]})]})]}),e.jsxs("div",{className:"border-t pt-8",children:[e.jsxs(w,{variant:"outline",size:"lg",className:"w-full",onClick:De,children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),E?"Hide":"Explore"," Library",E?e.jsx(xs,{className:"h-4 w-4 ml-2"}):e.jsx(Fe,{className:"h-4 w-4 ml-2"})]}),E&&e.jsx("div",{className:"mt-6",children:e.jsx(ne,{allPayloads:J,onSelectPayload:Z,search:q,onSearchChange:s=>C({q:s||null}),activeTab:he,onTabChange:s=>C({tab:s==="payloads"?null:s}),selectedTemplateId:X,onTemplateSelect:s=>C({template:s})})})]})]}),e.jsxs("section",{className:"py-16 relative overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 bg-gray-50 dark:bg-[#030712]",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-gray-100 via-gray-50 to-gray-100 dark:from-[#030712] dark:via-[#0a1628] dark:to-[#030712]"}),e.jsxs("div",{className:"absolute top-0 left-0 w-full h-full overflow-hidden",children:[e.jsx("div",{className:"absolute w-[700px] h-[500px] rounded-full blur-[120px] animate-pulse",style:{background:"radial-gradient(ellipse, rgba(63, 203, 255, 0.15) 0%, transparent 70%)",top:"30%",left:"20%",transform:"translate(-50%, -50%)",animationDuration:"8s"}}),e.jsx("div",{className:"absolute w-[600px] h-[400px] rounded-full blur-[100px] animate-pulse",style:{background:"radial-gradient(ellipse, rgba(76, 219, 196, 0.12) 0%, transparent 70%)",top:"60%",left:"70%",transform:"translate(-50%, -50%)",animationDuration:"10s",animationDelay:"2s"}}),e.jsx("div",{className:"absolute w-[500px] h-[350px] rounded-full blur-[80px] animate-pulse",style:{background:"radial-gradient(ellipse, rgba(99, 102, 241, 0.12) 0%, transparent 70%)",top:"50%",left:"50%",transform:"translate(-50%, -50%)",animationDuration:"12s",animationDelay:"4s"}})]}),e.jsxs("div",{className:"absolute inset-0 dark:block hidden",children:[Array.from({length:60},(s,n)=>{const S=(n*17+127)%100,y=(n*23+254)%100,v=.5+(n*7+127)%10/10,V=.3+(n*11+127)%7/10,ee=n*13%5;return e.jsx("div",{className:"absolute rounded-full bg-white",style:{left:`${S}%`,top:`${y}%`,width:`${v}px`,height:`${v}px`,opacity:V*.6,animation:`twinkle 3s ease-in-out infinite ${ee}s`}},`small-${n}`)}),Array.from({length:20},(s,n)=>{const S=(n*17+89)%100,y=(n*23+178)%100,v=.5+(n*7+89)%10/10,V=.3+(n*11+89)%7/10,ee=n*13%5;return e.jsx("div",{className:"absolute rounded-full bg-white",style:{left:`${S}%`,top:`${y}%`,width:`${v*1.5}px`,height:`${v*1.5}px`,opacity:V*.8,animation:`twinkle 4s ease-in-out infinite ${ee+.5}s`}},`medium-${n}`)}),Array.from({length:8},(s,n)=>{const S=(n*17+53)%100,y=(n*23+106)%100,v=.5+(n*7+53)%10/10,V=n*13%5;return e.jsx("div",{className:"absolute",style:{left:`${S}%`,top:`${y}%`,animation:`twinkle 5s ease-in-out infinite ${V+1}s`},children:e.jsx("div",{className:"rounded-full bg-white",style:{width:`${v*2}px`,height:`${v*2}px`,boxShadow:`0 0 ${v*4}px ${v}px rgba(63, 203, 255, 0.3)`}})},`large-${n}`)})]})]}),e.jsx("style",{children:` 2 @keyframes twinkle { 3 0%, 100% { opacity: 0.3; transform: scale(1); } 4 50% { opacity: 1; transform: scale(1.2); } 5 } 6 `}),e.jsxs("div",{className:"container max-w-6xl mx-auto px-4 relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("h2",{className:"text-2xl font-bold mb-2 text-foreground",children:["What is ",e.jsx("span",{className:"text-primary",children:"delivr.to"}),"?"]}),e.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"A payload delivery testing platform that helps security team
6s validate their email and web defences using real-world threat techniques."})]}),e.jsxs("div",{className:"grid md:grid-cols-4 gap-6 mb-8",children:[e.jsxs("div",{className:"text-center p-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/20 flex items-center justify-center mx-auto mb-3",children:e.jsx(F,{className:"h-6 w-6 text-primary"})}),e.jsx("h3",{className:"font-semibold mb-1 text-foreground",children:"Real Threat Payloads"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Access payloads based on in-the-wild malware delivery techniques"})]}),e.jsxs("div",{className:"text-center p-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/20 flex items-center justify-center mx-auto mb-3",children:e.jsx(hs,{className:"h-6 w-6 text-primary"})}),e.jsx("h3",{className:"font-semibold mb-1 text-foreground",children:"Test Your Controls"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run campaigns against your own environment to find gaps"})]}),e.jsxs("div",{className:"text-center p-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/20 flex items-center justify-center mx-auto mb-3",children:e.jsx(us,{className:"h-6 w-6 text-primary"})}),e.jsx("h3",{className:"font-semibold mb-1 text-foreground",children:"Detailed Reports"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Get visibility into what's blocked and what reaches inboxes"})]}),e.jsxs("div",{className:"text-center p-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/20 flex items-center justify-center mx-auto mb-3",children:e.jsx(ge,{className:"h-6 w-6 text-primary"})}),e.jsx("h3",{className:"font-semibold mb-1 text-foreground",children:"Stay Current"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"New payloads added regularly as threats evolve"})]})]}),e.jsx("div",{className:"text-center",children:e.jsx(w,{asChild:!0,size:"lg",className:"gap-2",children:e.jsxs("a",{href:A("/app"),children:["Get Started Free",e.jsx(te,{className:"h-4 w-4"})]})})})]})]}),e.jsx("footer",{className:"border-t py-8",children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{size:24,className:"text-primary"}),e.jsx("span",{className:"font-semibold",children:"delivr.to"}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"â Test your email and web defences with real-world threats"})]}),e.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[e.jsx("a",{href:"https://blog.delivr.to",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",children:"Blog"}),e.jsx(K,{to:"/privacy",className:"text-muted-foreground hover:text-foreground transition-colors",children:"Privacy"}),e.jsx("a",{href:A("/app"),className:"text-primary hover:underline",children:"Sign In"})]})]})})}),a&&e.jsx(rs,{open:N,onOpenChange:k,payload:{payload_id:a.payload_id,recipe_id:a.recipe_id,name:a.name,description:a.description,delivery:a.delivery}}),e.jsx(Be,{open:O,onOpenChange:H,children:e.jsxs(Oe,{className:"sm:max-w-md",children:[e.jsxs(He,{children:[e.jsxs(Ve,{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-5 w-5 text-primary"}),"Download this payload for free"]}),e.jsxs(Ke,{className:"pt-2 space-y-2",children:[e.jsx("span",{className:"block",children:"Create a free delivr.to account to download this payload and access 100+ more for security testing."}),e.jsx("span",{className:"block text-xs font-medium text-muted-foreground/80",children:"No credit card required."})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[e.jsx(w,{onClick:()=>{window.location.href=Qe(window.location.pathname)},children:"Create free account"}),e.jsx(w,{variant:"outline",onClick:()=>{window.location.href=A(window.location.pathname)},children:"Sign in to existing account"})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(K,{to:"/",className:"flex items-center gap-2",children:[e.jsx(U,{size:28,className:"text-primary"}),e.jsx("span",{className:"text-lg font-semibold text-foreground",children:"delivr.to"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{}),e.jsx(w,{asChild:!0,variant:"default",size:"sm",children:e.jsxs("a",{href:A("/app/payloads"),className:"gap-2",children:["Test Your Email Security",e.jsx(te,{className:"h-4 w-4"})]})})]})]})})}),e.jsxs("main",{className:"container max-w-6xl mx-auto py-8 px-4",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Payload Catalogue"}),e.jsx("p",{className:"text-muted-foreground",children:"Browse our library of 800+ payloads and templates for testing email security."})]}),e.jsx(ne,{allPayloads:J,onSelectPayload:Z,search:q,onSearchChange:s=>C({q:s||null}),activeTab:r.get("tab")||"templates",onTabChange:s=>C({tab:s==="templates"?null:s}),selectedTemplateId:X,onTemplateSelect:s=>C({template:s})})]}),e.jsx("footer",{className:"border-t bg-card/30 mt-16",children:e.jsx("div",{className:"container max-w-6xl mx-auto px-4 py-8",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs(K,{to:"/",className:"flex items-center gap-2",children:[e.jsx(U,{size:24,className:"text-primary"}),e.jsx("span",{className:"font-semibold text-foreground",children:"delivr.to"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["© ",new Date().getFullYear()," delivr.to. Test your email security with real-world malware replications."]})]})})})]})}function Gs(){return e.jsx(ks,{})}export{Gs as PublicPayload};
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.