1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32927],{11244:(e,t,s)=>{s.d(t,{B:()=>d});var a=s(95155);s(12115);var r=s(80222),i=s(90568);let l={catalog:.5,rail:.32},n={inert:""};function d({artifact:e,context:t,label:s,variant:c,className:o}){let h=l[c],x=`${100/h}%`;return(0,a.jsx)("div",{"data-testid":e?`chart-designer-artifact-preview-${e.id}`:"chart-designer-artifact-preview-missing",className:(0,i.cn)("relative aspect-video w-full overflow-hidden rounded-sm border border-slate-200 bg-white shadow-inner","catalog"===c?"min-h-[150px]":"min-h-[102px]",o),children:e?(0,a.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 overflow-hidden",...n,children:(0,a.jsx)("div",{className:"absolute left-0 top-0 origin-top-left",style:{width:x,height:x,transform:`scale(${h})`},children:(0,a.jsx)("div",{className:"h-full w-full bg-white",children:(0,a.jsx)(r.A,{context:`ChartDesignerArtifactPreview:${e.id}`,children:e.render(t)})})})}):(0,a.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-semibold text-red-700",children:"Preview unavailable"}),(0,a.jsx)("div",{className:"mt-1 text-[11px] text-slate-500",children:s})]})})})}},48227:(e,t,s)=>{s.d(t,{YN:()=>d,_J:()=>c,lM:()=>n});var a=s(66645),r=s(90287),i=s(61391);async function l(e){let t=await e.json().catch(()=>null);if(!e.ok||!t?.success)throw Error(t?.error??`Chart Designer request failed with ${e.status}`);let s=r.D1.safeParse(t.data);if(!s.success)throw a.vF.error("[ChartDesigner] API returned invalid deck document",{issues:s.error.issues}),Error("Chart Designer deck response is invalid.");return s.data}async function n(e){return l(await fetch(`/api/analyses/${e}/chart-designer/deck`,{method:"GET",headers:{Accept:"application/json"}}))}async function d(e,t){let s=r.RH.parse({document:t});return l(await fetch(`/api/analyses/${e}/chart-designer/deck`,{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)}))}async function c(e,t){let s=await n(e);return d(e,(0,i.nU)(s,t))}},61391:(e,t,s)=>{function a(e,t,s=new Date){return{...e,slides:[...e.slides,function(e,t=new Date){return{id:function(e){if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return`${e}_${crypto.randomUUID()}`;throw Error("Chart Designer requires crypto.randomUUID to create slides.")}("slide"),artifact:e,createdAt:t.toISOString()}}(t,s)]}}function r(e,t){return{...e,slides:e.slides.filter(e=>e.id!==t)}}function i(e,t,s){let a=e.slides.findIndex(e=>e.id===t);if(-1===a)return e;let r=Math.max(0,Math.min(e.slides.length-1,s));if(a===r)return e;let i=[...e.slides],[l]=i.splice(a,1);return i.splice(r,0,l),{...e,slides:i}}s.d(t,{TA:()=>r,bu:()=>i,nU:()=>a})},76741:(e,t,s)=>{s.d(t,{C:()=>j});var a=s(95155),r=s(43772),i=s(12115),l=s(23876),n=s(94774),d=s(2125),c=s(85618),o=s(42763),h=s(35942),x=s(47687),m=s(90568),u=s(15141),f=s(11244);function b({kind:e}){return"table"===e?(0,a.jsx)(l.A,{className:"h-4 w-4"}):(0,a.jsx)(n.A,{className:"h-4 w-4"})}function p({kind:e,sectionLabel:t}){return(0,a.jsx)("div",{className:"flex h-64 items-center justify-center rounded-md border border-dashed border-slate-300 bg-slate-50 p-8 text-center",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-sm font-semibold text-slate-900",children:["No ","table"===e?"tables":"charts"," registered"]}),(0,a.jsxs)("div",{className:"mt-1 max-w-sm text-xs text-slate-500",children:[t," does not expose supported ","table"===e?"tables":"charts"," for Chart Designer yet."]})]})})}function j({open:e,initialSectionId:t,context:s,isSaving:g=!1,onOpenChange:v,onAdd:N}){let w=(0,u.j)(s.analysisId),y=i.useMemo(()=>(0,u.Nf)(w.artifacts),[w.artifacts]),[k,I]=i.useState(y[0]?.sectionId??""),[A,C]=i.useState("table"),D=i.useMemo(()=>y.find(e=>e.sectionId===k)??y[0]??null,[y,k]),_=i.useMemo(()=>D?.artifacts.filter(e=>"table"===e.kind)??[],[D]),Y=i.useMemo(()=>D?.artifacts.filter(e=>"chart"===e.kind)??[],[D]);i.useEffect(()=>{if(!e)return;let s=y.find(e=>e.sectionId===t)??y[0]??null;s&&(I(s.sectionId),C(s.artifacts.some(e=>"table"===e.kind)?"table":"chart"))},[y,t,e]),i.useEffect(()=>{!D||D.artifacts.some(e=>e.kind===A)||C(D.artifacts.some(e=>"table"===e.kind)?"table":"chart")},[A,D]);let E=(e,t)=>(0,a.jsx)(h.F,{className:"h-[520px]",children:(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 p-5",children:t.length>0?t.map(e=>(0,a.jsxs)("div",{role:"button",tabIndex:g?-1:0,"aria-disabled":g,"aria-label":`Add ${e.label} as one slide`,onClick:()=>{g||N(e)},onKeyDown:t=>{g||("Enter"===t.key||" "===t.key)&&(t.preventDefault(),N(e))},className:(0,m.cn)("group cursor-pointer rounded-lg border border-slate-200 bg-white p-3 text-left shadow-sm transition hover:border-blue-300 hover:bg-blue-50 focus-visible:outline-hidden focu
1s-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",g&&"cursor-not-allowed opacity-60"),children:[(0,a.jsx)(f.B,{artifact:e,context:s,label:e.label,variant:"catalog"}),(0,a.jsxs)("div",{className:"mt-3 flex items-start justify-between gap-3",children:[(0,a.jsx)("div",{className:"min-w-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(b,{kind:e.kind}),(0,a.jsx)("span",{className:"text-sm font-semibold text-slate-900",children:e.label})]})}),(0,a.jsx)("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-slate-400 transition group-hover:bg-white group-hover:text-blue-600",children:(0,a.jsx)(d.A,{className:"h-4 w-4"})})]})]},e.id)):D?(0,a.jsx)("div",{className:"col-span-2",children:(0,a.jsx)(p,{kind:e,sectionLabel:D.sectionLabel})}):null})});return(0,a.jsx)(o.lG,{open:e,onOpenChange:v,children:(0,a.jsxs)(o.Cf,{className:"max-h-[84vh] max-w-5xl gap-0 overflow-hidden p-0",showCloseButton:!0,children:[(0,a.jsxs)(o.c7,{className:"border-b border-slate-200 px-6 py-4",children:[(0,a.jsx)(o.L3,{className:"text-base",children:"Add to Chart Designer"}),(0,a.jsx)(o.rr,{children:"Choose a supported table or chart from an analysis area. Each selection becomes one slide."})]}),(0,a.jsxs)("div",{className:"grid min-h-[560px] grid-cols-[240px_1fr]",children:[(0,a.jsxs)("aside",{className:"border-r border-slate-200 bg-slate-50",children:[(0,a.jsx)("div",{className:"border-b border-slate-200 px-4 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"}),"Analysis Areas"]})}),(0,a.jsx)(h.F,{className:"h-[520px]",children:(0,a.jsx)("div",{className:"space-y-1 p-3",children:y.map(e=>{let t=e.sectionId===k,s=e.artifacts.filter(e=>"table"===e.kind).length,r=e.artifacts.filter(e=>"chart"===e.kind).length;return(0,a.jsxs)("button",{type:"button",onClick:()=>I(e.sectionId),className:(0,m.cn)("w-full rounded-md px-3 py-2 text-left transition",t?"bg-white text-slate-950 shadow-sm ring-1 ring-blue-200":"text-slate-600 hover:bg-white hover:text-slate-950"),children:[(0,a.jsx)("span",{className:"block text-sm font-medium",children:e.sectionLabel}),(0,a.jsxs)("span",{className:"mt-1 flex items-center gap-2 text-[11px] text-slate-500",children:[(0,a.jsxs)("span",{children:[s," tables"]}),(0,a.jsxs)("span",{children:[r," charts"]})]})]},e.sectionId)})})})]}),(0,a.jsx)("section",{className:"min-w-0 bg-white",children:(0,a.jsxs)(x.tU,{value:A,onValueChange:e=>C(e),children:[(0,a.jsxs)("div",{className:"flex h-16 items-center justify-between border-b border-slate-200 px-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm font-semibold text-slate-900",children:D?.sectionLabel??"Analysis"}),(0,a.jsx)("div",{className:"text-xs text-slate-500",children:"Select one item to add it as a new slide."})]}),(0,a.jsxs)(x.j7,{className:"h-9 rounded-md border border-slate-200 bg-slate-50 p-1",children:[(0,a.jsxs)(x.Xi,{value:"table",className:"h-7 gap-1.5 rounded px-3 text-xs",children:[(0,a.jsx)(l.A,{className:"h-3.5 w-3.5"}),"Tables"]}),(0,a.jsxs)(x.Xi,{value:"chart",className:"h-7 gap-1.5 rounded px-3 text-xs",children:[(0,a.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Charts"]})]})]}),(0,a.jsx)(x.av,{value:"table",className:"m-0",children:E("table",_)}),(0,a.jsxs)(x.av,{value:"chart",className:"m-0",children:[D?.sectionId==="waterfalls"&&w.isLoading?(0,a.jsx)("div",{className:"border-b border-slate-200 bg-slate-50 px-5 py-2 text-xs text-slate-500",children:"Loading saved Waterfalls charts..."}):null,D?.sectionId==="waterfalls"&&w.error?(0,a.jsx)("div",{className:"border-b border-red-200 bg-red-50 px-5 py-2 text-xs font-medium text-red-700",children:(0,r.A)(w.error,"We couldn't load the available charts. Refresh the analysis and try again.","ui_boundary_features_chart_designer_chartdesignerartifactpickerdialog_chartdesignerartifactpickerdialog_1_failed")}):null,E("chart",Y)]})]})})]})]})})}},90287:(e,t,s)=>{s.d(t,{D1:()=>d,RH:()=>c,dX:()=>o});var a=s(79179);let r=a.k5(["chart","table"]),i=a.Ik({artifactId:a.Yj().trim().min(1),kind:r,tabId:a.Yj().trim().min(1),sectionId:a.Yj().trim().min(1),label:a.Yj().trim().min(1),addedFrom:a.k5(["catalog","inline"]).optional(),params:a.g1(a.Yj(),a.L5()).optional()}).strict(),l=a.Ik({id:a.Yj().trim().min(1),artifact:i,createdAt:a.Yj().datetime()}).strict(),n=a.Ik({source:a.eu("executive-summary"),seededAt:a.Yj().datetime()}).strict(),d=a.Ik({version:a.eu(1),deckId:a.Yj().trim().min(1),name:a.Yj().trim().min(1),slides:a.YO(l),initialSeed:n.optional()}).strict(),c=a.Ik({document:d}).strict();function o(e={}){return{version:1,deckId:e.deckId??"default",name:e.name??"Chart Designer",slides:[]}}}}]);
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.