(()=>{const l=window.React,p=window.KIND_REGISTRY;if(!l)return;const e=l.createElement,d=l.useState,g=l.useMemo,r=[{id:"emailVerification",name:"Email Verification",intent:"transactional",catalogRow:"02-email.yaml row 2.16",deployTarget:"email/transactional/email-verification",subject:"Confirm your email",preheader:"Verify your email address to finish setting up your account.",cta:"Verify email",mergeFields:["first_name","verify_url","code","expiry_minutes"],notes:"6-digit code fallback under the button, styled as a monospace chip, for recipients who can't click through."},{id:"magicLinkSignin",name:"Magic Link Sign-In",intent:"transactional",catalogRow:"02-email.yaml row 2.17",deployTarget:"email/transactional/magic-link-otp",subject:"Your sign-in link",preheader:"Tap the button or enter your one-time code to finish signing in.",cta:"Sign in",mergeFields:["magic_link","otp_code","expiry_minutes","device","location"],notes:"Passwordless flow: one large button plus a secondary OTP-code block, and a \u201Cdidn't request this?\u201D security line naming device/location below the fold."},{id:"paymentFailed",name:"Payment Failed",intent:"transactional",catalogRow:"02-email.yaml row 2.18",deployTarget:"email/transactional/payment-failed",subject:"Payment issue on your account",preheader:"We couldn't process your payment for {{plan_name}} \u2014 you have {{grace_days}} days to update it.",cta:"Update payment method",mergeFields:["first_name","plan_name","amount","retry_date","grace_days","update_url"],notes:"Calm, non-alarming dunning tone (no red/error styling); states the grace period and next retry date plainly, one sentence each."},{id:"teamInvite",name:"Team Invite",intent:"transactional",catalogRow:"02-email.yaml row 2.19",deployTarget:"email/transactional/team-invite",subject:"{{inviter_name}} invited you to {{org_name}}",preheader:"Join {{org_name}} on AaaS as a {{role}} \u2014 invite expires in {{expiry_days}} days.",cta:"Accept invite",mergeFields:["inviter_name","org_name","role","accept_url","expiry_days"],notes:"Leads with a compact identity card showing inviter_name \u2192 org_name and the role being granted, above the button."},{id:"featureNudge",name:"Feature Nudge",intent:"lifecycle",catalogRow:"02-email.yaml row 2.20",deployTarget:"email/lifecycle/feature-nudge",subject:"A faster way to {{job_to_be_done}}",preheader:"See how {{feature_name}} helps: {{feature_benefit}}.",cta:"Try {{feature_name}}",mergeFields:["first_name","feature_name","feature_benefit","job_to_be_done","cta_url"],notes:"One feature, one benefit statement, one screenshot slot beneath the headline \u2014 no feature grid, no secondary links."},{id:"usageLimitUpgrade",name:"Usage Limit Upgrade",intent:"lifecycle",catalogRow:"02-email.yaml row 2.21",deployTarget:"email/lifecycle/usage-limit-upgrade",subject:"You're at {{usage_pct}}% of your {{limit_metric}}",preheader:"Upgrade from {{current_plan}} to keep going without interruption.",cta:"Upgrade plan",mergeFields:["first_name","usage_pct","current_plan","limit_metric","upgrade_url"],notes:"Horizontal usage meter bound to usage_pct directly under the headline; frames the CTA around upgrade value, not scarcity or fear."},{id:"maintenanceStatus",name:"Maintenance Status",intent:"announcement",catalogRow:"02-email.yaml row 2.22",deployTarget:"email/announcement/maintenance-status",subject:"Scheduled maintenance {{window_start}}",preheader:"Planned maintenance from {{window_start}} to {{window_end}} \u2014 see affected services.",cta:"View status page",mergeFields:["window_start","window_end","affected_services","status_url"],notes:"States the window_start\u2013window_end window prominently at the top, followed by a compact bulleted list bound to affected_services."}],m={transactional:{label:"Transactional",accent:"var(--app-series-1)"},lifecycle:{label:"Lifecycle",accent:"var(--app-series-4)"},announcement:{label:"Announcement",accent:"var(--app-series-3)"}},y=["transactional","lifecycle","announcement"],u="email-templates-style";function h(){if(document.getElementById(u))return;const t=`
    .email-templates{display:flex;flex-direction:column;gap:14px;height:100%;min-height:0;font-size:14px;line-height:1.45;color:var(--app-ink);font-family:var(--app-font-body);}
    .email-templates *,.email-templates *::before,.email-templates *::after{box-sizing:border-box;}
    .email-templates button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;padding:0;}
    .email-templates .mono{font-family:var(--app-font-mono);font-variant-numeric:tabular-nums;}

    .et-banner{padding:8px 12px;border-radius:var(--app-radius-sm);background:var(--app-signal-dim);border:1px solid var(--app-signal);color:var(--app-signal);font-size:12px;font-weight:600;}

    .et-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;}
    .et-search{flex:1 1 220px;padding:8px 12px;border-radius:var(--app-radius-sm);background:var(--app-surface);border:1px solid var(--app-rule);color:var(--app-ink);font-size:13px;}
    .et-search::placeholder{color:var(--app-ink-faint);}
    .et-chip{padding:6px 12px;border-radius:var(--app-radius-pill);font-size:12px;font-weight:600;border:1px solid var(--app-rule);background:var(--app-surface);color:var(--app-ink-soft);white-space:nowrap;}
    .et-chip.active{background:var(--app-accent-dim);border-color:var(--app-accent);color:var(--app-accent);}
    .et-count{margin-left:auto;font-size:12px;color:var(--app-ink-faint);}

    .et-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:12px;overflow:auto;min-height:0;padding-right:2px;}
    .et-card{background:var(--app-surface);border:1px solid var(--app-rule);border-radius:var(--app-radius-md);padding:14px 16px;display:flex;flex-direction:column;gap:8px;}
    .et-card:hover{border-color:var(--app-accent);}
    .et-card .head{display:flex;align-items:center;justify-content:space-between;gap:8px;}
    .et-card .name{font-size:14px;font-weight:700;color:var(--app-ink);}
    .et-card .draft-badge{padding:2px 8px;border-radius:var(--app-radius-pill);font-size:10px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;background:var(--app-signal-dim);color:var(--app-signal);border:1px solid var(--app-signal);white-space:nowrap;}
    .et-card .intent-swatch{width:8px;height:8px;border-radius:2px;display:inline-block;margin-right:6px;}
    .et-card .subject{font-size:13px;font-weight:600;color:var(--app-ink);}
    .et-card .preheader{font-size:12px;color:var(--app-ink-soft);}
    .et-card .cta-row{margin-top:2px;}
    .et-card .cta{display:inline-block;padding:7px 14px;border-radius:var(--app-radius-sm);background:var(--app-accent);color:var(--app-accent-ink);font-size:12px;font-weight:700;}
    .et-card .fields{display:flex;flex-wrap:wrap;gap:6px;}
    .et-card .field{font-family:var(--app-font-mono);font-size:10px;padding:2px 6px;border-radius:var(--app-radius-sm);background:var(--app-elevated);color:var(--app-ink-faint);border:1px solid var(--app-rule);}
    .et-card .notes{font-size:11px;color:var(--app-ink-faint);}
    .et-card .target{font-family:var(--app-font-mono);font-size:10px;color:var(--app-ink-faint);}
    .et-empty{padding:24px;text-align:center;color:var(--app-ink-faint);font-size:13px;}
  `,i=document.createElement("style");i.id=u,i.textContent=t,document.head.appendChild(i)}function s(){h();const[t,i]=d(""),[o,f]=d("all"),c=g(()=>{const a=t.trim().toLowerCase();return r.filter(n=>o!=="all"&&n.intent!==o?!1:a?n.name.toLowerCase().includes(a)||n.subject.toLowerCase().includes(a)||n.deployTarget.toLowerCase().includes(a):!0)},[t,o]);return e("div",{className:"email-templates"},[e("div",{className:"et-banner",key:"banner"},"Draft briefs from AaaS-Love/AaaS.Love (shipped_prs: [] upstream) \u2014 real subject/preheader/CTA/merge-field copy, no production TSX artifact promoted yet."),e("div",{className:"et-toolbar",key:"toolbar"},[e("input",{key:"search",className:"et-search",type:"text",placeholder:"Search email templates\u2026",value:t,onChange:a=>i(a.target.value)}),e("button",{key:"all",className:"et-chip"+(o==="all"?" active":""),onClick:()=>f("all")},`All (${r.length})`),...y.map(a=>e("button",{key:a,className:"et-chip"+(o===a?" active":""),onClick:()=>f(a)},`${m[a].label} (${r.filter(n=>n.intent===a).length})`)),e("span",{className:"et-count",key:"count"},`${c.length} shown`)]),e("div",{className:"et-grid",key:"grid"},c.length===0?e("div",{className:"et-empty"},"No email templates match this filter."):c.map(a=>e("div",{className:"et-card",key:a.id},[e("div",{className:"head",key:"head"},[e("span",{key:"n"},[e("span",{className:"intent-swatch",key:"sw",style:{background:m[a.intent].accent}}),e("span",{className:"name",key:"nm"},a.name)]),e("span",{className:"draft-badge",key:"badge"},"Draft brief")]),e("div",{className:"subject",key:"subj"},a.subject),e("div",{className:"preheader",key:"pre"},a.preheader),e("div",{className:"cta-row",key:"ctarow"},[e("span",{className:"cta",key:"cta"},a.cta)]),e("div",{className:"fields",key:"fields"},a.mergeFields.map(n=>e("span",{className:"field mono",key:n},`{{${n}}}`))),e("div",{className:"notes",key:"notes"},a.notes),e("div",{className:"target mono",key:"target"},`${a.deployTarget} \xB7 ${a.catalogRow}`)])))])}s.displayName="EmailTemplatesView",window.EMAIL_TEMPLATES_VIEW_FN=s,window.VIEWS=window.VIEWS||{},window.VIEWS.emailTemplates=s,p&&(p.emailTemplates={id:"emailTemplates",label:"Email Templates",workspaceLabel:"Email Templates",workspaceIcon:"mail",description:"G10 Email \u2014 the 7 cross-company gap-email draft briefs shipped in AaaS.Love PR #3295 (packages/design-catalog/catalog/02-email.yaml rows 2.16-2.22): real subject/preheader/CTA/merge-field copy, rendered as labelled draft-brief previews. No production TSX artifact has been promoted for these yet.",defaultView:"emailTemplates",defaultDetail:"none",agentTreatment:"implicit",primaryAction:{label:"Search templates",kind:"primary",icon:"search"},secondaryActions:[],heroKpis:[{label:"templates",value:`${r.length}`,trend:"flat"},{label:"transactional",value:`${r.filter(t=>t.intent==="transactional").length}`,trend:"flat"},{label:"lifecycle",value:`${r.filter(t=>t.intent==="lifecycle").length}`,trend:"flat"},{label:"announcement",value:`${r.filter(t=>t.intent==="announcement").length}`,trend:"flat"}]})})();
