executable-stories-react 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,7 +69,7 @@ ${this.parser.parse(e)}</blockquote>
69
69
  ${e}</tr>
70
70
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),l=e.header?"th":"td";return(e.align?`<${l} align="${e.align}">`:`<${l}>`)+t+`</${l}>
71
71
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Vt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:l}){let n=this.parser.parseInline(l),a=Ny(e);if(a===null)return n;e=a;let i='<a href="'+e+'"';return t&&(i+=' title="'+Vt(t)+'"'),i+=">"+n+"</a>",i}image({href:e,title:t,text:l,tokens:n}){n&&(l=this.parser.parseInline(n,this.parser.textRenderer));let a=Ny(e);if(a===null)return Vt(l);e=a;let i=`<img src="${e}" alt="${Vt(l)}"`;return t&&(i+=` title="${Vt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Vt(e.text)}},Sf=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},kt=class df{options;renderer;textRenderer;constructor(t){this.options=t||_n,this.options.renderer=this.options.renderer||new Xu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Sf}static parse(t,l){return new df(l).parse(t)}static parseInline(t,l){return new df(l).parseInline(t)}parse(t){this.renderer.parser=this;let l="";for(let n=0;n<t.length;n++){let a=t[n];if(this.options.extensions?.renderers?.[a.type]){let r=a,u=this.options.extensions.renderers[r.type].call({parser:this},r);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(r.type)){l+=u||"";continue}}let i=a;switch(i.type){case"space":{l+=this.renderer.space(i);break}case"hr":{l+=this.renderer.hr(i);break}case"heading":{l+=this.renderer.heading(i);break}case"code":{l+=this.renderer.code(i);break}case"table":{l+=this.renderer.table(i);break}case"blockquote":{l+=this.renderer.blockquote(i);break}case"list":{l+=this.renderer.list(i);break}case"checkbox":{l+=this.renderer.checkbox(i);break}case"html":{l+=this.renderer.html(i);break}case"def":{l+=this.renderer.def(i);break}case"paragraph":{l+=this.renderer.paragraph(i);break}case"text":{l+=this.renderer.text(i);break}default:{let r='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return l}parseInline(t,l=this.renderer){this.renderer.parser=this;let n="";for(let a=0;a<t.length;a++){let i=t[a];if(this.options.extensions?.renderers?.[i.type]){let u=this.options.extensions.renderers[i.type].call({parser:this},i);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=u||"";continue}}let r=i;switch(r.type){case"escape":{n+=l.text(r);break}case"html":{n+=l.html(r);break}case"link":{n+=l.link(r);break}case"image":{n+=l.image(r);break}case"checkbox":{n+=l.checkbox(r);break}case"strong":{n+=l.strong(r);break}case"em":{n+=l.em(r);break}case"codespan":{n+=l.codespan(r);break}case"br":{n+=l.br(r);break}case"del":{n+=l.del(r);break}case"text":{n+=l.text(r);break}default:{let u='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return n}},Fi=class{options;block;constructor(e){this.options=e||_n}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Et.lex:Et.lexInline}provideParser(e=this.block){return e?kt.parse:kt.parseInline}},oR=class{defaults=pf();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=kt;Renderer=Xu;TextRenderer=Sf;Lexer=Et;Tokenizer=ju;Hooks=Fi;constructor(...e){this.use(...e)}walkTokens(e,t){let l=[];for(let n of e)switch(l=l.concat(t.call(this,n)),n.type){case"table":{let a=n;for(let i of a.header)l=l.concat(this.walkTokens(i.tokens,t));for(let i of a.rows)for(let r of i)l=l.concat(this.walkTokens(r.tokens,t));break}case"list":{let a=n;l=l.concat(this.walkTokens(a.items,t));break}default:{let a=n;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(i=>{let r=a[i].flat(1/0);l=l.concat(this.walkTokens(r,t))}):a.tokens&&(l=l.concat(this.walkTokens(a.tokens,t)))}}return l}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(l=>{let n={...l};if(n.async=this.defaults.async||n.async||!1,l.extensions&&(l.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let i=t.renderers[a.name];i?t.renderers[a.name]=function(...r){let u=a.renderer.apply(this,r);return u===!1&&(u=i.apply(this,r)),u}:t.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[a.level];i?i.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),n.extensions=t),l.renderer){let a=this.defaults.renderer||new Xu(this.defaults);for(let i in l.renderer){if(!(i in a))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let r=i,u=l.renderer[r],o=a[r];a[r]=(...s)=>{let p=u.apply(a,s);return p===!1&&(p=o.apply(a,s)),p||""}}n.renderer=a}if(l.tokenizer){let a=this.defaults.tokenizer||new ju(this.defaults);for(let i in l.tokenizer){if(!(i in a))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let r=i,u=l.tokenizer[r],o=a[r];a[r]=(...s)=>{let p=u.apply(a,s);return p===!1&&(p=o.apply(a,s)),p}}n.tokenizer=a}if(l.hooks){let a=this.defaults.hooks||new Fi;for(let i in l.hooks){if(!(i in a))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let r=i,u=l.hooks[r],o=a[r];Fi.passThroughHooks.has(i)?a[r]=s=>{if(this.defaults.async&&Fi.passThroughHooksRespectAsync.has(i))return(async()=>{let f=await u.call(a,s);return o.call(a,f)})();let p=u.call(a,s);return o.call(a,p)}:a[r]=(...s)=>{if(this.defaults.async)return(async()=>{let f=await u.apply(a,s);return f===!1&&(f=await o.apply(a,s)),f})();let p=u.apply(a,s);return p===!1&&(p=o.apply(a,s)),p}}n.hooks=a}if(l.walkTokens){let a=this.defaults.walkTokens,i=l.walkTokens;n.walkTokens=function(r){let u=[];return u.push(i.call(this,r)),a&&(u=u.concat(a.call(this,r))),u}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Et.lex(e,t??this.defaults)}parser(e,t){return kt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,l)=>{let n={...l},a={...this.defaults,...n},i=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&n.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let r=a.hooks?await a.hooks.preprocess(t):t,u=await(a.hooks?await a.hooks.provideLexer(e):e?Et.lex:Et.lexInline)(r,a),o=a.hooks?await a.hooks.processAllTokens(u):u;a.walkTokens&&await Promise.all(this.walkTokens(o,a.walkTokens));let s=await(a.hooks?await a.hooks.provideParser(e):e?kt.parse:kt.parseInline)(o,a);return a.hooks?await a.hooks.postprocess(s):s})().catch(i);try{a.hooks&&(t=a.hooks.preprocess(t));let r=(a.hooks?a.hooks.provideLexer(e):e?Et.lex:Et.lexInline)(t,a);a.hooks&&(r=a.hooks.processAllTokens(r)),a.walkTokens&&this.walkTokens(r,a.walkTokens);let u=(a.hooks?a.hooks.provideParser(e):e?kt.parse:kt.parseInline)(r,a);return a.hooks&&(u=a.hooks.postprocess(u)),u}catch(r){return i(r)}}}onError(e,t){return l=>{if(l.message+=`
72
- Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+Vt(l.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(l);throw l}}},Cn=new oR;function K(e,t){return Cn.parse(e,t)}K.options=K.setOptions=function(e){return Cn.setOptions(e),K.defaults=Cn.defaults,Dy(K.defaults),K};K.getDefaults=pf;K.defaults=_n;K.use=function(...e){return Cn.use(...e),K.defaults=Cn.defaults,Dy(K.defaults),K};K.walkTokens=function(e,t){return Cn.walkTokens(e,t)};K.parseInline=Cn.parseInline;K.Parser=kt;K.parser=kt.parse;K.Renderer=Xu;K.TextRenderer=Sf;K.Lexer=Et;K.lexer=Et.lex;K.Tokenizer=ju;K.Hooks=Fi;K.parse=K;var mT=K.options,hT=K.setOptions,gT=K.use,yT=K.walkTokens,bT=K.parseInline;var vT=kt.parse,xT=Et.lex;function Il(e){if(!e)return;let t=e.trim(),l=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!(l&&!/^https?$/i.test(l[1]??"")))return t}function Qy(e){if(!e)return;let t=e.trim();return/^data:image\//i.test(t)?t:Il(t)}function Ju(e){return/^(?:[/\\]|[A-Za-z]:[/\\])/.test(e)}var Pl=x(T(),1);function jy(e){return Il(e)??"#"}function sR(e){return K.parse(e,{async:!1}).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<\/?(?:iframe|object|embed|form|base)\b[^>]*>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"").replace(/\son[a-z]+\s*=\s*'[^']*'/gi,"").replace(/\son[a-z]+\s*=\s*[^\s>]+/gi,"").replace(/(href|src)\s*=\s*"([^"]*)"/gi,(l,n,a)=>`${n}="${jy(a)}"`).replace(/(href|src)\s*=\s*'([^']*)'/gi,(l,n,a)=>`${n}='${jy(a)}'`)}function Xy({entry:e}){let t=_a();if(t.section)return(0,Pl.jsx)(Pl.Fragment,{children:t.section(e)});let l=sR(e.markdown);return(0,Pl.jsxs)("section",{className:"my-3 text-sm","aria-label":e.title,children:[e.title?(0,Pl.jsx)("h4",{className:"mb-1 font-semibold text-foreground",children:e.title}):null,(0,Pl.jsx)("div",{className:"es-doc-prose text-muted-foreground",dangerouslySetInnerHTML:{__html:l}})]})}var hl=x(T(),1);function Rf({entry:e,ref:t}){return(0,hl.jsxs)("figure",{ref:t,className:"my-3","aria-label":e.title??"Diagram",children:[e.title?(0,hl.jsx)("figcaption",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:e.title}):null,(0,hl.jsx)("pre",{"data-mermaid":!0,tabIndex:0,className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs text-foreground",children:e.code})]})}function Zy({entry:e}){let t=_a();return t.mermaid?(0,hl.jsx)(hl.Fragment,{children:t.mermaid(e)}):(0,hl.jsx)(Rf,{entry:e})}var gl=x(T(),1);function Ky({entry:e}){let t=Ju(e.path)?void 0:Qy(e.path);return t?(0,gl.jsxs)("figure",{className:"my-3",children:[(0,gl.jsx)("img",{src:t,alt:e.alt??"",loading:"lazy",className:"max-w-full rounded-md border border-border"}),e.alt?(0,gl.jsx)("figcaption",{className:"mt-1.5 text-xs text-muted-foreground",children:e.alt}):null]}):(0,gl.jsxs)("figure",{className:"my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground",children:[(0,gl.jsx)("div",{className:"font-medium",children:"Screenshot unavailable"}),(0,gl.jsx)("div",{className:"mt-1 break-all font-mono text-xs",children:e.path}),e.alt?(0,gl.jsx)("figcaption",{className:"mt-1.5 text-xs",children:e.alt}):null]})}var yl=x(T(),1);function Jy({entry:e}){if(Ju(e.path))return(0,yl.jsxs)("figure",{className:"my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground",children:[(0,yl.jsx)("div",{className:"font-medium",children:"Video unavailable"}),(0,yl.jsx)("div",{className:"mt-1 break-all font-mono text-xs",children:e.path}),e.caption?(0,yl.jsx)("figcaption",{className:"mt-1.5 text-xs",children:e.caption}):null]});let t=Il(e.path),l=Il(e.poster);return(0,yl.jsxs)("figure",{className:"my-3",children:[(0,yl.jsx)("video",{controls:!0,preload:"metadata",...t?{src:t}:{},...l?{poster:l}:{},className:"max-w-full rounded-md border border-border"}),e.caption?(0,yl.jsx)("figcaption",{className:"mt-1 text-xs text-muted-foreground",children:e.caption}):null]})}var wn=x(T(),1);function $y({entry:e}){let t=typeof e.height=="number"?`${e.height}px`:e.height??"400px",l=e.title??"Embedded HTML",n=Il(e.url??e.path),a=e.content!==void 0?{srcDoc:e.content}:{src:n??""};return(0,wn.jsxs)("figure",{className:"my-3 overflow-hidden rounded-md border border-border",children:[(0,wn.jsxs)("figcaption",{className:"flex items-center justify-between border-b border-border bg-muted/40 px-3 py-1.5 text-xs font-medium text-muted-foreground",children:[(0,wn.jsx)("span",{children:e.title??"HTML"}),n?(0,wn.jsx)("a",{href:n,target:"_blank",rel:"noreferrer noopener","aria-label":"Open in new tab",title:"Open in new tab",className:"text-primary",children:"\u2197"}):null]}),(0,wn.jsx)("iframe",{...a,sandbox:"allow-scripts",loading:"lazy",title:l,className:"block w-full border-0",style:{height:t}})]})}var en=x(T(),1);function Fy({entry:e}){let l=Sy()[e.type];return l?(0,en.jsx)(en.Fragment,{children:l(e)}):(0,en.jsxs)("div",{className:"my-2","data-type":e.type,children:[(0,en.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:e.type}),(0,en.jsx)("pre",{tabIndex:0,className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs text-foreground",children:cR(e.data)})]})}function cR(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}var it=x(T(),1);function Wy({entry:e}){switch(e.kind){case"note":return(0,it.jsx)(Mg,{entry:e});case"tag":return(0,it.jsx)(vy,{entry:e});case"kv":return(0,it.jsx)(xy,{entry:e});case"code":return(0,it.jsx)(Ry,{entry:e});case"table":return(0,it.jsx)(Ty,{entry:e});case"link":return(0,it.jsx)(Ey,{entry:e});case"section":return(0,it.jsx)(Xy,{entry:e});case"mermaid":return(0,it.jsx)(Zy,{entry:e});case"screenshot":return(0,it.jsx)(Ky,{entry:e});case"video":return(0,it.jsx)(Jy,{entry:e});case"html":return(0,it.jsx)($y,{entry:e});case"custom":return(0,it.jsx)(Fy,{entry:e})}}var Ii=x(T(),1);function $u({entries:e}){return e.length===0?null:(0,Ii.jsx)(Ii.Fragment,{children:e.map((t,l)=>(0,Ii.jsx)(Wy,{entry:t},l))})}var Py=x(T(),1),fR=/"[^"]*"|(?<![\w.-])\d+(?:\.\d+)?(?![\w.-])/g;function Iy(e){let t=Array.from(e.matchAll(fR));if(t.length===0)return e;let l=[],n=0;return t.forEach((a,i)=>{let r=a.index,u=r+a[0].length;r>n&&l.push(e.slice(n,r)),l.push((0,Py.jsx)("span",{className:"font-medium text-step-param italic",children:a[0]},i)),n=u}),n<e.length&&l.push(e.slice(n)),l}var rt=x(T(),1),dR={passed:"\u2713",failed:"\u2717",skipped:"\u25CB",pending:"\u25CB"},pR={passed:"text-pass",failed:"text-fail",skipped:"text-skip",pending:"text-pend"};function eb({scenario:e}){return e.steps.length===0?null:(0,rt.jsx)("ol",{"data-slot":"steps",className:"flex flex-col",children:e.steps.map(t=>(0,rt.jsx)(mR,{step:t},t.id))})}function mR({step:e}){let t=e.keyword.toLowerCase(),l=t==="and"||t==="but";return(0,rt.jsxs)("li",{id:e.id,"data-status":e.status,className:H("py-1.5 text-[0.8125rem] leading-normal",l&&"pl-5"),children:[(0,rt.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,rt.jsx)("span",{"aria-hidden":!0,className:H("w-4 shrink-0 text-center text-xs",pR[e.status]),children:dR[e.status]??"\u25CB"}),(0,rt.jsx)("span",{className:H("min-w-[52px] shrink-0 font-mono text-xs font-semibold capitalize",l?"font-medium text-muted-foreground":"text-keyword"),children:e.keyword}),(0,rt.jsx)("span",{className:"flex-1 text-foreground",children:Iy(e.text)}),e.durationMs>0?(0,rt.jsx)("span",{className:"shrink-0 whitespace-nowrap font-mono text-[0.6875rem] text-muted-foreground",children:pl(e.durationMs)}):null]}),e.errorMessage?(0,rt.jsx)("pre",{role:"alert",className:"mt-2.5 ml-6 overflow-x-auto rounded-md border border-fail-border bg-fail-bg px-4 py-3.5 font-mono text-xs leading-relaxed whitespace-pre-wrap text-fail",children:e.errorMessage}):null,e.docEntries.length>0?(0,rt.jsx)("div",{"data-es-docs":!0,className:"mt-2 ml-6",children:(0,rt.jsx)($u,{entries:e.docEntries})}):null]})}var At=x(T(),1);function tb({attachments:e}){return e.length===0?null:(0,At.jsx)("div",{role:"group","aria-label":"Attachments",className:"mt-3 flex flex-col gap-2",children:e.map((t,l)=>{let n=t.contentEncoding==="BASE64"?`data:${t.mediaType};base64,${t.body}`:`data:${t.mediaType},${encodeURIComponent(t.body)}`,a=t.mediaType.startsWith("image/");return(0,At.jsx)("figure",{className:"m-0",children:a?(0,At.jsxs)(At.Fragment,{children:[(0,At.jsx)("img",{src:n,alt:t.name,loading:"lazy",className:"max-w-full rounded-md border border-border"}),(0,At.jsx)("figcaption",{className:"mt-1 text-xs text-muted-foreground",children:t.name})]}):(0,At.jsxs)("a",{href:n,download:t.name,className:"text-xs text-link underline underline-offset-2",children:[t.name," ",(0,At.jsxs)("span",{className:"text-muted-foreground",children:["(",t.mediaType,")"]})]})},`${t.name}-${l}`)})})}var hR=new Set(["ok","error","unset"]),gR=e=>hR.has(e)?e:"unset";function yR(e){let t=[];for(let l of e){if(!l||typeof l.spanId!="string"||typeof l.name!="string")continue;let n,a;if(l.startTimeMs!=null&&l.durationMs!=null)n=l.startTimeMs,a=l.durationMs;else if(l.startTimeUnixNano!=null&&l.endTimeUnixNano!=null)n=l.startTimeUnixNano/1e6,a=(l.endTimeUnixNano-l.startTimeUnixNano)/1e6;else continue;a=Math.max(0,a),!(!isFinite(n)||!isFinite(a))&&t.push({spanId:l.spanId,parentSpanId:l.parentSpanId,name:l.name,startTimeMs:n,durationMs:a,status:gR(l.status),statusMessage:l.statusMessage})}return t}function lb(e){let t=yR(e);if(t.length===0)return[];let l=new Map;for(let u of t){let o=u.spanId,s=2;for(;l.has(o);)o=`${u.spanId}__dup${s++}`;l.set(o,{span:{...u,spanId:o},children:[],depth:0})}let n=[];for(let u of l.values()){let o=u.span.parentSpanId?l.get(u.span.parentSpanId):void 0;o&&o!==u?o.children.push(u):n.push(u)}for(let u of l.values())u.children.sort((o,s)=>o.span.startTimeMs-s.span.startTimeMs);n.sort((u,o)=>u.span.startTimeMs-o.span.startTimeMs);let a=[],i=new Set,r=(u,o)=>{if(!i.has(u.span.spanId)){i.add(u.span.spanId),a.push({...u.span,depth:o});for(let s of u.children)r(s,o+1)}};for(let u of n)r(u,0);for(let u of l.values())i.has(u.span.spanId)||r(u,0);return a}function nb(e){let t=1/0,l=-1/0;for(let a of e)t=Math.min(t,a.startTimeMs),l=Math.max(l,a.startTimeMs+a.durationMs);let n=l-t;return{minStartMs:isFinite(t)?t:0,totalMs:n>0?n:1}}var Qt=x(T(),1),bR={ok:"bg-pass",error:"bg-fail",unset:"bg-skip"};function ab({spans:e}){if(!e||e.length===0)return null;let t=lb(e);if(t.length===0)return null;let{minStartMs:l,totalMs:n}=nb(t);return(0,Qt.jsxs)("details",{className:"mt-3 rounded-md border border-border bg-muted/30",children:[(0,Qt.jsxs)("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-foreground",children:["Trace (",t.length," span",t.length===1?"":"s",", ",pl(n),")"]}),(0,Qt.jsx)("ul",{className:"flex flex-col gap-0.5 px-3 pb-3 font-mono text-[0.6875rem]",children:t.map((a,i)=>{let r=(a.startTimeMs-l)/n*100,u=Math.max(a.durationMs/n*100,.5);return(0,Qt.jsxs)("li",{className:"flex items-center gap-2",children:[(0,Qt.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",style:{paddingLeft:`${a.depth*12}px`},title:a.statusMessage?`${a.name} \u2014 ${a.statusMessage}`:a.name,children:a.name}),(0,Qt.jsx)("span",{className:"relative h-3 w-1/2 shrink-0 overflow-hidden rounded-sm bg-border/40",children:(0,Qt.jsx)("span",{className:H("absolute top-0 h-full rounded-sm",bR[a.status]),style:{left:`${r}%`,width:`${u}%`}})}),(0,Qt.jsx)("span",{className:"w-16 shrink-0 text-right text-muted-foreground",children:pl(a.durationMs)})]},`${a.spanId}-${i}`)})})]})}var Fu=x($(),1),ib=(0,Fu.createContext)(null),rb=ib.Provider;function ub(){return(0,Fu.useContext)(ib)}function vR(e){let t=e[e.length-1];if(!t)return;let l=0;for(let n=e.length-1;n>=0&&e[n].status===t.status;n--)l++;return{status:t.status,count:l}}var xR={passed:"Passing",failed:"Failing",skipped:"Skipped",pending:"Pending"};function Tf(e){let l=`${e.filter(a=>a.status==="passed").length}/${e.length} runs passed`,n=vR(e);return!n||e.length<2?l:`${l} \xB7 ${xR[n.status]} for the last ${n.count===1?"run":`${n.count} runs`}`}var SR=3;function ob(e){let t=e.filter(i=>i.status==="passed"||i.status==="failed");if(t.length<SR)return"stable";let l=0;for(let i=1;i<t.length;i++)t[i].status!==t[i-1].status&&l++;let n=l/(t.length-1),a=t.filter(i=>i.status==="failed").length/t.length;return n>.5||n>.3&&a>.2?"flaky":n>.2||a>.3?"unstable":"stable"}function sb(e,t){let l=!1,n={newlyFailing:[],newlyPassing:[],added:[]};for(let a of t){let i=e[a.id];if(!i||i.length===0)continue;let r=i[i.length-1],u=i[i.length-2];if(!u){n.added.push(a);continue}l=!0,r.status==="failed"&&u.status!=="failed"?n.newlyFailing.push(a):r.status==="passed"&&u.status==="failed"&&n.newlyPassing.push(a)}return l?n:void 0}var tn=x(T(),1),RR=10,TR={passed:"bg-pass",failed:"bg-fail",skipped:"bg-skip",pending:"bg-pend"};function ER(e){let t=[new Date(e.timestamp).toLocaleString(),e.status];return e.commitSha&&t.push(e.commitSha.slice(0,8)),t.join(" \xB7 ")}function cb({scenarioId:e}){let l=ub()?.[e];if(!l||l.length<2)return null;let n=l.slice(-RR),a=ob(n)==="flaky",i=a?`${Tf(n)} \xB7 Flaky`:Tf(n);return(0,tn.jsxs)(tn.Fragment,{children:[a?(0,tn.jsx)(Tt,{variant:"pending","aria-label":"Flaky: status flips between recent runs",title:i,children:"Flaky"}):null,(0,tn.jsx)("span",{role:"img","aria-label":`Run history: ${i}`,title:i,className:"flex shrink-0 items-center gap-[3px]",children:n.map((r,u)=>(0,tn.jsx)("span",{"aria-hidden":!0,title:ER(r),className:H("inline-block size-1.5 rounded-full",TR[r.status],u===n.length-1&&"ring-1 ring-border ring-offset-1 ring-offset-card")},`${r.timestamp}-${u}`))})]})}var zt=x($(),1),fb=(0,zt.createContext)(null),db=fb.Provider;function Wu(){return(0,zt.useContext)(fb)}var pb="es-collapsed-ids";function kR(){if(typeof localStorage>"u")return new Set;try{let e=localStorage.getItem(pb);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Ef(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(pb,JSON.stringify([...e]))}catch{}}function mb(){let[e,t]=(0,zt.useState)(kR),l=(0,zt.useCallback)(r=>e.has(r),[e]),n=(0,zt.useCallback)(r=>{t(u=>{let o=new Set(u);return o.has(r)?o.delete(r):o.add(r),Ef(o),o})},[]),a=(0,zt.useCallback)(r=>{t(()=>{let u=new Set(r);return Ef(u),u})},[]),i=(0,zt.useCallback)(()=>{t(()=>{let r=new Set;return Ef(r),r})},[]);return{api:{isCollapsed:l,toggle:n},collapseAll:a,expandAll:i}}var Iu=x($(),1),hb=(0,Iu.createContext)(null),gb=hb.Provider;function yb(){return(0,Iu.useContext)(hb)}function bb(e){let t=[`## ${e.title} _(${e.status})_`,""];for(let l of e.steps)t.push(`- **${l.keyword}** ${l.text}`);return e.errorMessage&&t.push("","```",e.errorMessage.trim(),"```"),t.join(`
72
+ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+Vt(l.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(l);throw l}}},Cn=new oR;function K(e,t){return Cn.parse(e,t)}K.options=K.setOptions=function(e){return Cn.setOptions(e),K.defaults=Cn.defaults,Dy(K.defaults),K};K.getDefaults=pf;K.defaults=_n;K.use=function(...e){return Cn.use(...e),K.defaults=Cn.defaults,Dy(K.defaults),K};K.walkTokens=function(e,t){return Cn.walkTokens(e,t)};K.parseInline=Cn.parseInline;K.Parser=kt;K.parser=kt.parse;K.Renderer=Xu;K.TextRenderer=Sf;K.Lexer=Et;K.lexer=Et.lex;K.Tokenizer=ju;K.Hooks=Fi;K.parse=K;var mT=K.options,hT=K.setOptions,gT=K.use,yT=K.walkTokens,bT=K.parseInline;var vT=kt.parse,xT=Et.lex;function Il(e){if(!e)return;let t=e.trim(),l=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!(l&&!/^https?$/i.test(l[1]??"")))return t}function Qy(e){if(!e)return;let t=e.trim();return/^data:image\//i.test(t)?t:Il(t)}function Ju(e){return/^(?:[/\\]|[A-Za-z]:[/\\])/.test(e)}var Pl=x(T(),1);function jy(e){return Il(e)??"#"}function sR(e){return K.parse(e,{async:!1}).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<\/?(?:iframe|object|embed|form|base)\b[^>]*>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"").replace(/\son[a-z]+\s*=\s*'[^']*'/gi,"").replace(/\son[a-z]+\s*=\s*[^\s>]+/gi,"").replace(/(href|src)\s*=\s*"([^"]*)"/gi,(l,n,a)=>`${n}="${jy(a)}"`).replace(/(href|src)\s*=\s*'([^']*)'/gi,(l,n,a)=>`${n}='${jy(a)}'`)}function Xy({entry:e}){let t=_a();if(t.section)return(0,Pl.jsx)(Pl.Fragment,{children:t.section(e)});let l=sR(e.markdown);return(0,Pl.jsxs)("section",{className:"my-3 text-sm","aria-label":e.title,children:[e.title?(0,Pl.jsx)("h4",{className:"mb-1 font-semibold text-foreground",children:e.title}):null,(0,Pl.jsx)("div",{className:"es-doc-prose prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:l}})]})}var hl=x(T(),1);function Rf({entry:e,ref:t}){return(0,hl.jsxs)("figure",{ref:t,className:"my-3","aria-label":e.title??"Diagram",children:[e.title?(0,hl.jsx)("figcaption",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:e.title}):null,(0,hl.jsx)("pre",{"data-mermaid":!0,tabIndex:0,className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs text-foreground",children:e.code})]})}function Zy({entry:e}){let t=_a();return t.mermaid?(0,hl.jsx)(hl.Fragment,{children:t.mermaid(e)}):(0,hl.jsx)(Rf,{entry:e})}var gl=x(T(),1);function Ky({entry:e}){let t=Ju(e.path)?void 0:Qy(e.path);return t?(0,gl.jsxs)("figure",{className:"my-3",children:[(0,gl.jsx)("img",{src:t,alt:e.alt??"",loading:"lazy",className:"max-w-full rounded-md border border-border"}),e.alt?(0,gl.jsx)("figcaption",{className:"mt-1.5 text-xs text-muted-foreground",children:e.alt}):null]}):(0,gl.jsxs)("figure",{className:"my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground",children:[(0,gl.jsx)("div",{className:"font-medium",children:"Screenshot unavailable"}),(0,gl.jsx)("div",{className:"mt-1 break-all font-mono text-xs",children:e.path}),e.alt?(0,gl.jsx)("figcaption",{className:"mt-1.5 text-xs",children:e.alt}):null]})}var yl=x(T(),1);function Jy({entry:e}){if(Ju(e.path))return(0,yl.jsxs)("figure",{className:"my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground",children:[(0,yl.jsx)("div",{className:"font-medium",children:"Video unavailable"}),(0,yl.jsx)("div",{className:"mt-1 break-all font-mono text-xs",children:e.path}),e.caption?(0,yl.jsx)("figcaption",{className:"mt-1.5 text-xs",children:e.caption}):null]});let t=Il(e.path),l=Il(e.poster);return(0,yl.jsxs)("figure",{className:"my-3",children:[(0,yl.jsx)("video",{controls:!0,preload:"metadata",...t?{src:t}:{},...l?{poster:l}:{},className:"max-w-full rounded-md border border-border"}),e.caption?(0,yl.jsx)("figcaption",{className:"mt-1 text-xs text-muted-foreground",children:e.caption}):null]})}var wn=x(T(),1);function $y({entry:e}){let t=typeof e.height=="number"?`${e.height}px`:e.height??"400px",l=e.title??"Embedded HTML",n=Il(e.url??e.path),a=e.content!==void 0?{srcDoc:e.content}:{src:n??""};return(0,wn.jsxs)("figure",{className:"my-3 overflow-hidden rounded-md border border-border",children:[(0,wn.jsxs)("figcaption",{className:"flex items-center justify-between border-b border-border bg-muted/40 px-3 py-1.5 text-xs font-medium text-muted-foreground",children:[(0,wn.jsx)("span",{children:e.title??"HTML"}),n?(0,wn.jsx)("a",{href:n,target:"_blank",rel:"noreferrer noopener","aria-label":"Open in new tab",title:"Open in new tab",className:"text-primary",children:"\u2197"}):null]}),(0,wn.jsx)("iframe",{...a,sandbox:"allow-scripts",loading:"lazy",title:l,className:"block w-full border-0",style:{height:t}})]})}var en=x(T(),1);function Fy({entry:e}){let l=Sy()[e.type];return l?(0,en.jsx)(en.Fragment,{children:l(e)}):(0,en.jsxs)("div",{className:"my-2","data-type":e.type,children:[(0,en.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:e.type}),(0,en.jsx)("pre",{tabIndex:0,className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs text-foreground",children:cR(e.data)})]})}function cR(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}var it=x(T(),1);function Wy({entry:e}){switch(e.kind){case"note":return(0,it.jsx)(Mg,{entry:e});case"tag":return(0,it.jsx)(vy,{entry:e});case"kv":return(0,it.jsx)(xy,{entry:e});case"code":return(0,it.jsx)(Ry,{entry:e});case"table":return(0,it.jsx)(Ty,{entry:e});case"link":return(0,it.jsx)(Ey,{entry:e});case"section":return(0,it.jsx)(Xy,{entry:e});case"mermaid":return(0,it.jsx)(Zy,{entry:e});case"screenshot":return(0,it.jsx)(Ky,{entry:e});case"video":return(0,it.jsx)(Jy,{entry:e});case"html":return(0,it.jsx)($y,{entry:e});case"custom":return(0,it.jsx)(Fy,{entry:e})}}var Ii=x(T(),1);function $u({entries:e}){return e.length===0?null:(0,Ii.jsx)(Ii.Fragment,{children:e.map((t,l)=>(0,Ii.jsx)(Wy,{entry:t},l))})}var Py=x(T(),1),fR=/"[^"]*"|(?<![\w.-])\d+(?:\.\d+)?(?![\w.-])/g;function Iy(e){let t=Array.from(e.matchAll(fR));if(t.length===0)return e;let l=[],n=0;return t.forEach((a,i)=>{let r=a.index,u=r+a[0].length;r>n&&l.push(e.slice(n,r)),l.push((0,Py.jsx)("span",{className:"font-medium text-step-param italic",children:a[0]},i)),n=u}),n<e.length&&l.push(e.slice(n)),l}var rt=x(T(),1),dR={passed:"\u2713",failed:"\u2717",skipped:"\u25CB",pending:"\u25CB"},pR={passed:"text-pass",failed:"text-fail",skipped:"text-skip",pending:"text-pend"};function eb({scenario:e}){return e.steps.length===0?null:(0,rt.jsx)("ol",{"data-slot":"steps",className:"flex flex-col",children:e.steps.map(t=>(0,rt.jsx)(mR,{step:t},t.id))})}function mR({step:e}){let t=e.keyword.toLowerCase(),l=t==="and"||t==="but";return(0,rt.jsxs)("li",{id:e.id,"data-status":e.status,className:H("py-1.5 text-[0.8125rem] leading-normal",l&&"pl-5"),children:[(0,rt.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,rt.jsx)("span",{"aria-hidden":!0,className:H("w-4 shrink-0 text-center text-xs",pR[e.status]),children:dR[e.status]??"\u25CB"}),(0,rt.jsx)("span",{className:H("min-w-[52px] shrink-0 font-mono text-xs font-semibold capitalize",l?"font-medium text-muted-foreground":"text-keyword"),children:e.keyword}),(0,rt.jsx)("span",{className:"flex-1 text-foreground",children:Iy(e.text)}),e.durationMs>0?(0,rt.jsx)("span",{className:"shrink-0 whitespace-nowrap font-mono text-[0.6875rem] text-muted-foreground",children:pl(e.durationMs)}):null]}),e.errorMessage?(0,rt.jsx)("pre",{role:"alert",className:"mt-2.5 ml-6 overflow-x-auto rounded-md border border-fail-border bg-fail-bg px-4 py-3.5 font-mono text-xs leading-relaxed whitespace-pre-wrap text-fail",children:e.errorMessage}):null,e.docEntries.length>0?(0,rt.jsx)("div",{"data-es-docs":!0,className:"mt-2 ml-6",children:(0,rt.jsx)($u,{entries:e.docEntries})}):null]})}var At=x(T(),1);function tb({attachments:e}){return e.length===0?null:(0,At.jsx)("div",{role:"group","aria-label":"Attachments",className:"mt-3 flex flex-col gap-2",children:e.map((t,l)=>{let n=t.contentEncoding==="BASE64"?`data:${t.mediaType};base64,${t.body}`:`data:${t.mediaType},${encodeURIComponent(t.body)}`,a=t.mediaType.startsWith("image/");return(0,At.jsx)("figure",{className:"m-0",children:a?(0,At.jsxs)(At.Fragment,{children:[(0,At.jsx)("img",{src:n,alt:t.name,loading:"lazy",className:"max-w-full rounded-md border border-border"}),(0,At.jsx)("figcaption",{className:"mt-1 text-xs text-muted-foreground",children:t.name})]}):(0,At.jsxs)("a",{href:n,download:t.name,className:"text-xs text-link underline underline-offset-2",children:[t.name," ",(0,At.jsxs)("span",{className:"text-muted-foreground",children:["(",t.mediaType,")"]})]})},`${t.name}-${l}`)})})}var hR=new Set(["ok","error","unset"]),gR=e=>hR.has(e)?e:"unset";function yR(e){let t=[];for(let l of e){if(!l||typeof l.spanId!="string"||typeof l.name!="string")continue;let n,a;if(l.startTimeMs!=null&&l.durationMs!=null)n=l.startTimeMs,a=l.durationMs;else if(l.startTimeUnixNano!=null&&l.endTimeUnixNano!=null)n=l.startTimeUnixNano/1e6,a=(l.endTimeUnixNano-l.startTimeUnixNano)/1e6;else continue;a=Math.max(0,a),!(!isFinite(n)||!isFinite(a))&&t.push({spanId:l.spanId,parentSpanId:l.parentSpanId,name:l.name,startTimeMs:n,durationMs:a,status:gR(l.status),statusMessage:l.statusMessage})}return t}function lb(e){let t=yR(e);if(t.length===0)return[];let l=new Map;for(let u of t){let o=u.spanId,s=2;for(;l.has(o);)o=`${u.spanId}__dup${s++}`;l.set(o,{span:{...u,spanId:o},children:[],depth:0})}let n=[];for(let u of l.values()){let o=u.span.parentSpanId?l.get(u.span.parentSpanId):void 0;o&&o!==u?o.children.push(u):n.push(u)}for(let u of l.values())u.children.sort((o,s)=>o.span.startTimeMs-s.span.startTimeMs);n.sort((u,o)=>u.span.startTimeMs-o.span.startTimeMs);let a=[],i=new Set,r=(u,o)=>{if(!i.has(u.span.spanId)){i.add(u.span.spanId),a.push({...u.span,depth:o});for(let s of u.children)r(s,o+1)}};for(let u of n)r(u,0);for(let u of l.values())i.has(u.span.spanId)||r(u,0);return a}function nb(e){let t=1/0,l=-1/0;for(let a of e)t=Math.min(t,a.startTimeMs),l=Math.max(l,a.startTimeMs+a.durationMs);let n=l-t;return{minStartMs:isFinite(t)?t:0,totalMs:n>0?n:1}}var Qt=x(T(),1),bR={ok:"bg-pass",error:"bg-fail",unset:"bg-skip"};function ab({spans:e}){if(!e||e.length===0)return null;let t=lb(e);if(t.length===0)return null;let{minStartMs:l,totalMs:n}=nb(t);return(0,Qt.jsxs)("details",{className:"mt-3 rounded-md border border-border bg-muted/30",children:[(0,Qt.jsxs)("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-foreground",children:["Trace (",t.length," span",t.length===1?"":"s",", ",pl(n),")"]}),(0,Qt.jsx)("ul",{className:"flex flex-col gap-0.5 px-3 pb-3 font-mono text-[0.6875rem]",children:t.map((a,i)=>{let r=(a.startTimeMs-l)/n*100,u=Math.max(a.durationMs/n*100,.5);return(0,Qt.jsxs)("li",{className:"flex items-center gap-2",children:[(0,Qt.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",style:{paddingLeft:`${a.depth*12}px`},title:a.statusMessage?`${a.name} \u2014 ${a.statusMessage}`:a.name,children:a.name}),(0,Qt.jsx)("span",{className:"relative h-3 w-1/2 shrink-0 overflow-hidden rounded-sm bg-border/40",children:(0,Qt.jsx)("span",{className:H("absolute top-0 h-full rounded-sm",bR[a.status]),style:{left:`${r}%`,width:`${u}%`}})}),(0,Qt.jsx)("span",{className:"w-16 shrink-0 text-right text-muted-foreground",children:pl(a.durationMs)})]},`${a.spanId}-${i}`)})})]})}var Fu=x($(),1),ib=(0,Fu.createContext)(null),rb=ib.Provider;function ub(){return(0,Fu.useContext)(ib)}function vR(e){let t=e[e.length-1];if(!t)return;let l=0;for(let n=e.length-1;n>=0&&e[n].status===t.status;n--)l++;return{status:t.status,count:l}}var xR={passed:"Passing",failed:"Failing",skipped:"Skipped",pending:"Pending"};function Tf(e){let l=`${e.filter(a=>a.status==="passed").length}/${e.length} runs passed`,n=vR(e);return!n||e.length<2?l:`${l} \xB7 ${xR[n.status]} for the last ${n.count===1?"run":`${n.count} runs`}`}var SR=3;function ob(e){let t=e.filter(i=>i.status==="passed"||i.status==="failed");if(t.length<SR)return"stable";let l=0;for(let i=1;i<t.length;i++)t[i].status!==t[i-1].status&&l++;let n=l/(t.length-1),a=t.filter(i=>i.status==="failed").length/t.length;return n>.5||n>.3&&a>.2?"flaky":n>.2||a>.3?"unstable":"stable"}function sb(e,t){let l=!1,n={newlyFailing:[],newlyPassing:[],added:[]};for(let a of t){let i=e[a.id];if(!i||i.length===0)continue;let r=i[i.length-1],u=i[i.length-2];if(!u){n.added.push(a);continue}l=!0,r.status==="failed"&&u.status!=="failed"?n.newlyFailing.push(a):r.status==="passed"&&u.status==="failed"&&n.newlyPassing.push(a)}return l?n:void 0}var tn=x(T(),1),RR=10,TR={passed:"bg-pass",failed:"bg-fail",skipped:"bg-skip",pending:"bg-pend"};function ER(e){let t=[new Date(e.timestamp).toLocaleString(),e.status];return e.commitSha&&t.push(e.commitSha.slice(0,8)),t.join(" \xB7 ")}function cb({scenarioId:e}){let l=ub()?.[e];if(!l||l.length<2)return null;let n=l.slice(-RR),a=ob(n)==="flaky",i=a?`${Tf(n)} \xB7 Flaky`:Tf(n);return(0,tn.jsxs)(tn.Fragment,{children:[a?(0,tn.jsx)(Tt,{variant:"pending","aria-label":"Flaky: status flips between recent runs",title:i,children:"Flaky"}):null,(0,tn.jsx)("span",{role:"img","aria-label":`Run history: ${i}`,title:i,className:"flex shrink-0 items-center gap-[3px]",children:n.map((r,u)=>(0,tn.jsx)("span",{"aria-hidden":!0,title:ER(r),className:H("inline-block size-1.5 rounded-full",TR[r.status],u===n.length-1&&"ring-1 ring-border ring-offset-1 ring-offset-card")},`${r.timestamp}-${u}`))})]})}var zt=x($(),1),fb=(0,zt.createContext)(null),db=fb.Provider;function Wu(){return(0,zt.useContext)(fb)}var pb="es-collapsed-ids";function kR(){if(typeof localStorage>"u")return new Set;try{let e=localStorage.getItem(pb);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Ef(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(pb,JSON.stringify([...e]))}catch{}}function mb(){let[e,t]=(0,zt.useState)(kR),l=(0,zt.useCallback)(r=>e.has(r),[e]),n=(0,zt.useCallback)(r=>{t(u=>{let o=new Set(u);return o.has(r)?o.delete(r):o.add(r),Ef(o),o})},[]),a=(0,zt.useCallback)(r=>{t(()=>{let u=new Set(r);return Ef(u),u})},[]),i=(0,zt.useCallback)(()=>{t(()=>{let r=new Set;return Ef(r),r})},[]);return{api:{isCollapsed:l,toggle:n},collapseAll:a,expandAll:i}}var Iu=x($(),1),hb=(0,Iu.createContext)(null),gb=hb.Provider;function yb(){return(0,Iu.useContext)(hb)}function bb(e){let t=[`## ${e.title} _(${e.status})_`,""];for(let l of e.steps)t.push(`- **${l.keyword}** ${l.text}`);return e.errorMessage&&t.push("","```",e.errorMessage.trim(),"```"),t.join(`
73
73
  `)}function vb(e){let t=[`A test scenario is ${e.status}. Investigate the likely cause and propose a fix.`,"",`Scenario: ${e.title}`,"Steps:"];for(let l of e.steps){let n=l.status==="failed"?" \u27F5 failed here":"";t.push(` ${l.keyword} ${l.text}${n}`)}return e.errorMessage&&t.push("","Error:",e.errorMessage.trim()),e.errorStack&&t.push("","Stack:",e.errorStack.trim()),t.join(`
74
74
  `)}function xb(e){return typeof location>"u"?`#${e.id}`:`${location.href.split("#")[0]}#${e.id}`}var EE=x($(),1);var Pu=x(T(),1);function Sb({className:e,...t}){return(0,Pu.jsx)("div",{"data-slot":"card",className:H("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",e),...t})}function Rb({className:e,...t}){return(0,Pu.jsx)("div",{"data-slot":"card-header",className:H("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Tb({className:e,...t}){return(0,Pu.jsx)("div",{"data-slot":"card-content",className:H("px-6",e),...t})}var j=x(T(),1),AR={passed:"Passed",failed:"Failed",skipped:"Skipped",pending:"Pending"},zR={passed:"\u2713",failed:"\u2717",skipped:"\u25CB",pending:"\u25CB"},MR={passed:"text-pass",failed:"text-fail",skipped:"text-skip",pending:"text-pend"},NR={passed:"passed",failed:"failed",skipped:"skipped",pending:"pending"};function Eb({scenario:e,hideTitle:t=!1}){let l=`${e.id}-title`,n=`${e.id}-body`,a=e.planned?"Planned":AR[e.status],i=Wu(),r=i!==null&&!t,u=r?i.isCollapsed(e.id):!1,o=yb();return(0,j.jsxs)(Sb,{id:e.id,"data-status":e.status,...t?{"aria-label":`${e.title} \u2014 ${a}`}:{"aria-labelledby":l},className:"gap-0 py-0",children:[(0,j.jsxs)(Rb,{className:"px-4 py-3",children:[(0,j.jsxs)("div",{className:H("flex items-start gap-4",t?"justify-end":"justify-between"),children:[t?null:(0,j.jsxs)("h3",{id:l,className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[r?(0,j.jsx)("button",{type:"button",onClick:()=>i.toggle(e.id),"aria-expanded":!u,"aria-controls":n,"aria-label":`Toggle ${e.title}`,className:"shrink-0 cursor-pointer text-muted-foreground hover:text-foreground",children:(0,j.jsx)("span",{"aria-hidden":!0,className:H("inline-block text-xs transition-transform",!u&&"rotate-90"),children:"\u25B8"})}):null,(0,j.jsx)("span",{"aria-hidden":!0,className:H("text-sm leading-none",MR[e.status]),children:zR[e.status]}),(0,j.jsx)("span",{children:e.title})]}),(0,j.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,j.jsx)(cb,{scenarioId:e.id}),e.durationMs>0?(0,j.jsx)("span",{className:"whitespace-nowrap font-mono text-[0.6875rem] text-muted-foreground",children:pl(e.durationMs)}):null,(0,j.jsx)(Tt,{variant:NR[e.status],"aria-label":`Status: ${a}`,children:a}),o?(0,j.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,j.jsx)("button",{type:"button",onClick:()=>o.copyLink(e),"aria-label":`Copy link to ${e.title}`,title:"Copy permalink",className:"cursor-pointer rounded px-1 py-0.5 font-mono text-[0.625rem] text-muted-foreground hover:bg-muted hover:text-foreground",children:"link"}),(0,j.jsx)("button",{type:"button",onClick:()=>o.copyMarkdown(e),"aria-label":`Copy ${e.title} as Markdown`,title:"Copy as Markdown",className:"cursor-pointer rounded px-1 py-0.5 font-mono text-[0.625rem] text-muted-foreground hover:bg-muted hover:text-foreground",children:"md"}),(0,j.jsx)("button",{type:"button",onClick:()=>o.copyPrompt(e),"aria-label":`Copy ${e.title} as an AI investigation prompt`,title:"Copy as AI prompt",className:"cursor-pointer rounded px-1 py-0.5 font-mono text-[0.625rem] text-muted-foreground hover:bg-muted hover:text-foreground",children:"ai"})]}):null]})]}),e.tags.length>0||(e.tickets?.length??0)>0?(0,j.jsxs)("ul",{"aria-label":"Tags and tickets",className:"flex flex-wrap gap-1.5",children:[e.tags.map(s=>(0,j.jsx)("li",{children:(0,j.jsx)(Tt,{variant:"tag",children:s})},`tag-${s}`)),(e.tickets??[]).map(s=>(0,j.jsx)("li",{children:s.url?(0,j.jsx)("a",{href:s.url,target:"_blank",rel:"noreferrer noopener",children:(0,j.jsx)(Tt,{variant:"outline",children:s.id})}):(0,j.jsx)(Tt,{variant:"outline",children:s.id})},`ticket-${s.id}`))]}):null]}),(0,j.jsxs)(Tb,{id:n,hidden:u,className:"px-4 pt-0 pb-4",children:[e.errorMessage?(0,j.jsx)("pre",{role:"alert",className:"mb-1 overflow-x-auto rounded-md border border-fail-border bg-fail-bg px-4 py-3.5 font-mono text-xs leading-relaxed whitespace-pre-wrap text-fail",children:e.errorMessage}):null,(0,j.jsx)(eb,{scenario:e}),e.docEntries.length>0?(0,j.jsx)("div",{"data-es-docs":!0,className:"mt-3",children:(0,j.jsx)($u,{entries:e.docEntries})}):null,(0,j.jsx)(tb,{attachments:e.attachments}),(0,j.jsx)(ab,{spans:e.otelSpans})]})]})}var Pi=x(T(),1);function kb({feature:e}){return(0,Pi.jsx)(Pi.Fragment,{children:e.scenarios.map(t=>(0,Pi.jsx)(Eb,{scenario:t},t.id))})}var Oe=x(T(),1);function Ab({feature:e}){let t=`${e.id}-title`,l=`${e.id}-body`,n=e.summary,a=n.skipped+n.pending,i=Wu(),r=i?.isCollapsed(e.id)??!1;return(0,Oe.jsxs)("section",{id:e.id,"data-slot":"feature","aria-labelledby":t,className:"overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[(0,Oe.jsxs)("div",{className:"flex items-center justify-between gap-4 border-b border-border bg-muted/40 px-4 py-3",children:[(0,Oe.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[i?(0,Oe.jsx)("button",{type:"button",onClick:()=>i.toggle(e.id),"aria-expanded":!r,"aria-controls":l,"aria-label":`Toggle ${e.title}`,className:"shrink-0 cursor-pointer text-muted-foreground hover:text-foreground",children:(0,Oe.jsx)("span",{"aria-hidden":!0,className:H("inline-block text-xs transition-transform",!r&&"rotate-90"),children:"\u25B8"})}):null,(0,Oe.jsxs)("div",{className:"min-w-0",children:[(0,Oe.jsx)("h2",{id:t,className:"text-sm font-semibold tracking-tight text-foreground",children:e.title}),(0,Oe.jsx)("p",{className:"mt-0.5 truncate font-mono text-xs text-muted-foreground",children:e.sourceFile})]})]}),(0,Oe.jsxs)("div",{role:"img",className:"flex shrink-0 items-center gap-2.5 font-mono text-xs font-medium","aria-label":`${n.passed} passed, ${n.failed} failed, ${a} skipped`,children:[(0,Oe.jsxs)("span",{"aria-hidden":!0,className:"text-pass",children:["\u2713",n.passed]}),(0,Oe.jsxs)("span",{"aria-hidden":!0,className:"text-fail",children:["\u2717",n.failed]}),(0,Oe.jsxs)("span",{"aria-hidden":!0,className:"text-skip",children:["\u25CB",a]})]})]}),(0,Oe.jsx)("div",{id:l,hidden:r,className:"flex flex-col gap-2 p-3",children:(0,Oe.jsx)(kb,{feature:e})})]})}var er=x(T(),1);function zb(){let e=Jl();return(0,er.jsx)(er.Fragment,{children:e.features.map(t=>(0,er.jsx)(Ab,{feature:t},t.id))})}var eo=x(T(),1);function Mb({className:e,...t}){return(0,eo.jsx)("div",{"data-slot":"empty",className:H("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",e),...t})}function Nb({className:e,...t}){return(0,eo.jsx)("div",{"data-slot":"empty-header",className:H("flex max-w-sm flex-col items-center gap-2 text-center",e),...t})}var FE=Bu("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function Cb({className:e,...t}){return(0,eo.jsx)("div",{"data-slot":"empty-title",className:H("text-lg font-medium tracking-tight",e),...t})}var to=x(T(),1);function _b({message:e}){return(0,to.jsx)(Mb,{"aria-live":"polite",className:"border",children:(0,to.jsx)(Nb,{children:(0,to.jsx)(Cb,{children:e??"No scenarios in this report."})})})}var Ge=x(T(),1);function wb({className:e}){let t=Jl();return(0,Ge.jsx)(CR,{summary:t.summary,...e!==void 0&&{className:e},ariaLabel:"Run summary"})}function CR({summary:e,className:t,ariaLabel:l}){return(0,Ge.jsxs)("p",{className:H("text-sm text-muted-foreground",t),"aria-label":l,children:[(0,Ge.jsxs)("span",{children:[(0,Ge.jsx)("strong",{className:"font-semibold text-foreground",children:e.total})," scenario",e.total===1?"":"s"]})," \xB7 ",(0,Ge.jsxs)("span",{"data-status":"passed",className:"text-pass",children:[e.passed," passed"]})," \xB7 ",(0,Ge.jsxs)("span",{"data-status":"failed",className:"text-fail",children:[e.failed," failed"]}),e.skipped>0?(0,Ge.jsxs)(Ge.Fragment,{children:[" \xB7 ",(0,Ge.jsxs)("span",{"data-status":"skipped",className:"text-skip",children:[e.skipped," skipped"]})]}):null,e.pending>0?(0,Ge.jsxs)(Ge.Fragment,{children:[" \xB7 ",(0,Ge.jsxs)("span",{"data-status":"pending",className:"text-pend",children:[e.pending," pending"]})]}):null]})}function Db(e){if(e.finishedAtMs&&e.finishedAtMs>0)return e.finishedAtMs;if(e.startedAtMs&&e.startedAtMs>0)return e.startedAtMs}function Ob(e,t){let l=Math.max(0,t-e),n=Math.floor(l/6e4);if(n<1)return"just now";if(n<60)return`${n} minute${n===1?"":"s"} ago`;let a=Math.floor(n/60);if(a<24)return`${a} hour${a===1?"":"s"} ago`;let i=Math.floor(a/24);return`${i} day${i===1?"":"s"} ago`}function Hb(e,t,l){return e===void 0||t<=0?!1:l-e>=t*864e5}var _R={github:"GitHub Actions",gitlab:"GitLab CI",circleci:"CircleCI",jenkins:"Jenkins",azure:"Azure DevOps",buildkite:"Buildkite",travis:"Travis CI",ci:"CI"};function kf(e){return _R[e]??e}function Ub(e,t){let l=e?.commitSha??t;if(!e?.url||!l)return;let n=e.url.match(/^(https?:\/\/[^/]+\/[^/]+\/[^/]+)\/actions\/runs\//);if(n)return`${n[1]}/commit/${l}`;let a=e.url.match(/^(https?:\/\/.+)\/-\/pipelines\//);if(a)return`${a[1]}/-/commit/${l}`}function Bb(e){if(!e?.url||!e.prNumber)return;let t=e.url.match(/^(https?:\/\/[^/]+\/[^/]+\/[^/]+)\/actions\/runs\//);if(t)return`${t[1]}/pull/${e.prNumber}`}var bl=x(T(),1);function Lb(){let e=Jl(),t=[],l="text-primary underline underline-offset-2";e.startedAtMs&&t.push({label:"Started",value:new Date(e.startedAtMs).toLocaleString()}),e.durationMs&&t.push({label:"Duration",value:pl(e.durationMs)}),e.packageVersion&&t.push({label:"Version",value:e.packageVersion}),e.ci?.branch&&t.push({label:"Branch",value:e.ci.branch});let n=e.ci?.commitSha??e.gitSha;if(n){let a=Ub(e.ci,e.gitSha),i=n.slice(0,8);t.push({label:"Commit",value:a?(0,bl.jsx)("a",{href:a,target:"_blank",rel:"noreferrer noopener",className:l,children:i}):i})}if(e.ci&&t.push({label:"CI",value:e.ci.url?(0,bl.jsxs)("a",{href:e.ci.url,target:"_blank",rel:"noreferrer noopener",className:l,children:[kf(e.ci.name),e.ci.buildNumber?` #${e.ci.buildNumber}`:""]}):`${kf(e.ci.name)}${e.ci.buildNumber?` #${e.ci.buildNumber}`:""}`}),e.ci?.prNumber){let a=Bb(e.ci),i=`#${e.ci.prNumber}`;t.push({label:"PR",value:a?(0,bl.jsx)("a",{href:a,target:"_blank",rel:"noreferrer noopener",className:l,children:i}):i})}return t.length===0?null:(0,bl.jsx)("dl",{"aria-label":"Run metadata",className:"flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted-foreground",children:t.map(a=>(0,bl.jsxs)("div",{className:"flex gap-1.5",children:[(0,bl.jsx)("dt",{className:"font-medium",children:a.label}),(0,bl.jsx)("dd",{className:"font-mono text-foreground",children:a.value})]},a.label))})}var Mt=x(T(),1);function qb({error:e}){return(0,Mt.jsxs)("section",{className:"es-schema-error",role:"alert","aria-live":"assertive",children:[(0,Mt.jsx)("p",{children:(0,Mt.jsx)("strong",{children:"Report could not be displayed."})}),(0,Mt.jsx)("p",{children:e.message}),e.code==="SCHEMA_VERSION_MISMATCH"?(0,Mt.jsxs)("p",{children:["The report bundle is newer than this version of ",(0,Mt.jsx)("code",{children:"executable-stories-react"}),". Upgrade the package, or regenerate the report with an older formatters CLI."]}):null,e.issues&&e.issues.length>0?(0,Mt.jsxs)("details",{children:[(0,Mt.jsxs)("summary",{children:[e.issues.length," validation issue",e.issues.length===1?"":"s"]}),(0,Mt.jsx)("pre",{children:e.issues.slice(0,20).map(t=>`${t.path}: ${t.message}`).join(`
75
75
  `)})]}):null]})}var jt=x(T(),1);function Gb({title:e}){return(0,jt.jsxs)(jt.Fragment,{children:[(0,jt.jsx)("h1",{children:e??"Story Report"}),(0,jt.jsx)(wb,{}),(0,jt.jsx)(Lb,{})]})}function Yb({error:e,className:t,title:l,dataTheme:n}){return(0,jt.jsx)("main",{className:H("es-report",t),"aria-label":l??"Test report","data-theme":n,children:(0,jt.jsx)(qb,{error:e})})}var lo=x($(),1),Oa=x(T(),1),Vb=(0,lo.forwardRef)(function(t,l){let{value:n,onChange:a,matchedCount:i,totalCount:r,placeholder:u="Search scenarios, tags, or step text\u2026",className:o}=t,s=(0,lo.useId)(),p=typeof i=="number"&&typeof r=="number";function f(h){a(h.target.value)}function d(h){h.key==="Escape"&&n!==""&&(a(""),h.preventDefault())}return(0,Oa.jsxs)("div",{className:["es-search",o].filter(Boolean).join(" "),children:[(0,Oa.jsx)("label",{htmlFor:s,className:"es-search-label",children:"Search"}),(0,Oa.jsx)("input",{ref:l,id:s,type:"search",value:n,onChange:f,onKeyDown:d,placeholder:u,autoComplete:"off",spellCheck:!1,"aria-keyshortcuts":"/"}),p?(0,Oa.jsx)("span",{className:"es-search-counts","aria-live":"polite",children:n?`${i} of ${r}`:`${r} total`}):null]})});var Qb=x($(),1);function wR(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ln(e,t={}){if(typeof document>"u")return;let l=document.getElementById(e);l&&(l.scrollIntoView({behavior:wR()?"auto":"smooth",block:"start"}),t.updateHash!==!1&&typeof history<"u"&&history.replaceState(null,"",`#${e}`))}var Ha=x(T(),1);function jb({failures:e}){let t=e[0],l=(0,Qb.useCallback)(()=>{t&&ln(t.scenarioId)},[t]);return e.length===0?null:(0,Ha.jsxs)("div",{className:"es-failure-banner",role:"status","aria-live":"polite","aria-label":"Failure summary",children:[(0,Ha.jsxs)("span",{className:"es-failure-banner-text",children:[(0,Ha.jsx)("strong",{children:e.length})," ","failure",e.length===1?"":"s"]}),(0,Ha.jsx)("button",{type:"button",className:"es-failure-banner-jump",onClick:l,"aria-label":"Jump to first failure",children:"Jump to first \u2193"})]})}var no=x($(),1);var Xt=x(T(),1);function Xb({lastRunMs:e,ciUrl:t,staleAfterDays:l,nowMs:n}){let[a,i]=(0,no.useState)(n);if((0,no.useEffect)(()=>{n===void 0&&i(Date.now())},[n]),e===void 0||a===void 0)return null;let r=Ob(e,a),u=t?(0,Xt.jsx)("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"underline underline-offset-2",children:"View CI run"}):null;return Hb(e,l,a)?(0,Xt.jsxs)("div",{className:"es-stale-banner",role:"status","aria-label":"Report freshness",children:[(0,Xt.jsxs)("span",{children:[(0,Xt.jsxs)("strong",{children:["Last verified ",r,"."]})," This report may no longer match the current behavior \u2014 look for a newer run."]}),u]}):(0,Xt.jsxs)("p",{className:"es-freshness","aria-label":"Report freshness",children:["Verified ",r,u?(0,Xt.jsxs)(Xt.Fragment,{children:[" \xB7 ",u]}):null]})}var He=x(T(),1),Af=5;function Zb({scenarios:e,tone:t}){return(0,He.jsxs)(He.Fragment,{children:[e.slice(0,Af).map((l,n)=>(0,He.jsxs)("span",{children:[n>0?", ":"",(0,He.jsx)("a",{href:`#${l.id}`,className:H("underline underline-offset-2 hover:no-underline",t),children:l.title})]},l.id)),e.length>Af?(0,He.jsxs)("span",{children:[" and ",e.length-Af," more"]}):null]})}function Kb({history:e,report:t}){if(!e)return null;let l=t.features.flatMap(u=>u.scenarios.map(o=>({id:o.id,title:o.title}))),n=sb(e,l);if(!n)return null;let{newlyFailing:a,newlyPassing:i,added:r}=n;return a.length===0&&i.length===0&&r.length===0?(0,He.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"es-last-run-delta",children:"Since last run: no behavior changes."}):(0,He.jsxs)("p",{className:"text-xs text-muted-foreground","data-testid":"es-last-run-delta",children:[(0,He.jsx)("span",{className:"font-medium text-foreground",children:"Since last run:"}),a.length>0?(0,He.jsxs)("span",{className:"ml-2 text-fail",children:[a.length," newly failing (",(0,He.jsx)(Zb,{scenarios:a,tone:"text-fail"}),")"]}):null,i.length>0?(0,He.jsxs)("span",{className:"ml-2 text-pass",children:[i.length," fixed (",(0,He.jsx)(Zb,{scenarios:i,tone:"text-pass"}),")"]}):null,r.length>0?(0,He.jsxs)("span",{className:"ml-2",children:[r.length," new"]}):null]})}var ao=x($(),1),Nt=x(T(),1),DR=[{keys:"/",description:"Focus search"},{keys:"f",description:"Jump to next failure"},{keys:"Shift+F",description:"Jump to previous failure"},{keys:"Esc",description:"Clear search / close dialog"},{keys:"?",description:"Toggle this help"}];function Jb({open:e,onClose:t}){let l=(0,ao.useRef)(null);return(0,ao.useEffect)(()=>{let n=l.current;n&&(e&&!n.open?n.showModal():!e&&n.open&&n.close())},[e]),(0,Nt.jsxs)("dialog",{ref:l,className:"es-shortcuts-help","aria-label":"Keyboard shortcuts",onClose:t,children:[(0,Nt.jsx)("h2",{children:"Keyboard shortcuts"}),(0,Nt.jsx)("dl",{children:DR.map(n=>(0,Nt.jsxs)("div",{children:[(0,Nt.jsx)("dt",{children:(0,Nt.jsx)("kbd",{children:n.keys})}),(0,Nt.jsx)("dd",{children:n.description})]},n.keys))}),(0,Nt.jsx)("form",{method:"dialog",children:(0,Nt.jsx)("button",{type:"submit",className:"es-shortcuts-close",children:"Close"})})]})}var io=x($(),1);function OR(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function $b(e){let t=(0,io.useRef)(e);t.current=e,(0,io.useEffect)(()=>{function l(n){let a=t.current;if(n.key==="Escape"){a.onEscape?.();return}if(!OR(n.target)&&!(n.metaKey||n.ctrlKey||n.altKey))switch(n.key){case"/":a.onFocusSearch?.(),n.preventDefault();return;case"?":a.onToggleHelp?.(),n.preventDefault();return;case"f":a.onNextFailure?.(),n.preventDefault();return;case"F":a.onPrevFailure?.(),n.preventDefault();return;case"e":a.onExpandAll?.(),n.preventDefault();return;case"c":a.onCollapseAll?.(),n.preventDefault();return;default:return}}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[])}var Fb=x($(),1);function Wb(){(0,Fb.useEffect)(()=>{function e(){let t=window.location.hash.replace(/^#/,"");t&&requestAnimationFrame(()=>{ln(t,{updateHash:!1})})}return e(),window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[])}function HR(e){return e.trim().toLowerCase()}function Ib(e){let t=new Set;for(let l of e.features)for(let n of l.scenarios)for(let a of n.tags)t.add(a);return[...t]}function UR(e,t){if(t===""||e.title.toLowerCase().includes(t))return!0;for(let l of e.tags)if(l.toLowerCase().includes(t))return!0;for(let l of e.steps)if(l.text.toLowerCase().includes(t))return!0;return!1}function BR(e,t,l,n){return l!=="all"&&e.status!==l||n.length>0&&!n.some(a=>e.tags.includes(a))?!1:UR(e,t)}function LR(e){let t=0,l=0,n=0,a=0,i=0,r=0;for(let u of e)t+=1,r+=u.durationMs,u.status==="passed"?l+=1:u.status==="failed"?n+=1:u.status==="skipped"?a+=1:i+=1;return{total:t,passed:l,failed:n,skipped:a,pending:i,durationMs:r}}function Pb(e,t){let l=typeof t=="string"?{query:t}:t,n=HR(l.query??""),a=l.status??"all",i=l.tags??[];if(n===""&&a==="all"&&i.length===0)return e;let r=[],u=0,o=0,s=0,p=0,f=0,d=0;for(let h of e.features){let v=h.scenarios.filter(C=>BR(C,n,a,i));if(v.length===0)continue;let R=LR(v);r.push({...h,summary:R,scenarios:v}),u+=R.total,o+=R.passed,s+=R.failed,p+=R.skipped,f+=R.pending,d+=R.durationMs}return{...e,summary:{total:u,passed:o,failed:s,skipped:p,pending:f,durationMs:d},features:r}}function e0(e){let t=[];for(let l of e.features)for(let n of l.scenarios)if(n.status==="failed"){let a={featureId:l.id,scenarioId:n.id,scenarioTitle:n.title};n.errorMessage!==void 0&&(a.errorMessage=n.errorMessage),t.push(a)}return t}var Zt=x(T(),1);function t0({statuses:e,status:t,onStatus:l,tags:n,activeTags:a,onToggleTag:i}){return e.length===0&&n.length===0?null:(0,Zt.jsxs)("div",{className:"flex flex-col gap-2",children:[e.length>0?(0,Zt.jsx)("div",{role:"group","aria-label":"Filter by status",className:"flex flex-wrap gap-1",children:e.map(r=>{let u=t===r.key;return(0,Zt.jsxs)("button",{type:"button","aria-pressed":u,onClick:()=>l(u&&r.key!=="all"?"all":r.key),className:H("cursor-pointer rounded-md border px-2 py-1 text-xs transition-colors",u?"border-primary bg-primary text-primary-foreground":"border-border text-muted-foreground hover:bg-muted hover:text-foreground"),children:[r.label,(0,Zt.jsx)("span",{className:"ml-1 font-mono opacity-70",children:r.count})]},r.key)})}):null,n.length>0?(0,Zt.jsx)("ul",{"aria-label":"Filter by tag",className:"flex flex-wrap gap-1.5",children:n.map(r=>{let u=a.includes(r);return(0,Zt.jsx)("li",{children:(0,Zt.jsx)("button",{type:"button","aria-pressed":u,onClick:()=>i(r),className:"cursor-pointer",children:(0,Zt.jsx)(Tt,{variant:u?"default":"tag",children:r})})},r)})}):null]})}var Ua=x($(),1);var Ct=x(T(),1),qR={passed:"text-pass",failed:"text-fail",skipped:"text-skip",pending:"text-pend"};function l0(){let e=Jl(),[t,l]=(0,Ua.useState)(null),n=(0,Ua.useMemo)(()=>e.features.flatMap(a=>a.scenarios.map(i=>i.id)),[e]);return(0,Ua.useEffect)(()=>{if(typeof IntersectionObserver>"u")return;let a=n.map(r=>document.getElementById(r)).filter(r=>r!==null);if(a.length===0)return;let i=new IntersectionObserver(r=>{let u=r.filter(o=>o.isIntersecting).sort((o,s)=>o.boundingClientRect.top-s.boundingClientRect.top);u[0]&&l(u[0].target.id)},{rootMargin:"-8% 0px -80% 0px"});return a.forEach(r=>i.observe(r)),()=>i.disconnect()},[n]),e.features.length===0?null:(0,Ct.jsx)("nav",{"aria-label":"Table of contents",className:"sticky top-4 hidden h-fit w-56 shrink-0 self-start text-xs lg:block",children:(0,Ct.jsx)("ul",{className:"flex flex-col gap-3",children:e.features.map(a=>(0,Ct.jsxs)("li",{children:[(0,Ct.jsx)("p",{className:"mb-1 truncate font-semibold text-foreground",children:a.title}),(0,Ct.jsx)("ul",{className:"flex flex-col",children:a.scenarios.map(i=>{let r=t===i.id;return(0,Ct.jsx)("li",{children:(0,Ct.jsxs)("a",{href:`#${i.id}`,onClick:u=>{u.preventDefault(),ln(i.id,{updateHash:!0})},"aria-current":r?"true":void 0,className:H("flex items-center gap-1.5 truncate border-l-2 py-0.5 pl-2 hover:text-foreground",r?"border-primary font-medium text-foreground":"border-border text-muted-foreground"),children:[(0,Ct.jsx)("span",{"aria-hidden":!0,className:H("shrink-0",qR[i.status]),children:"\u2022"}),(0,Ct.jsx)("span",{className:"truncate",children:i.title})]})},i.id)})})]},a.id))})})}var Ba=x($(),1),a0="es-theme";function n0(e){typeof document<"u"&&document.documentElement.setAttribute("data-theme",e)}function GR(){if(typeof localStorage<"u"){let e=localStorage.getItem(a0);if(e==="light"||e==="dark")return e}return typeof document<"u"&&document.documentElement.getAttribute("data-theme")==="dark"||typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function i0(){let[e,t]=(0,Ba.useState)("light");(0,Ba.useEffect)(()=>{let n=GR();t(n),n0(n)},[]);let l=(0,Ba.useCallback)(()=>{t(n=>{let a=n==="dark"?"light":"dark";n0(a);try{localStorage.setItem(a0,a)}catch{}return a})},[]);return{theme:e,toggle:l}}var J=x(T(),1);function r0(e){let{report:t,className:l,title:n,dataTheme:a}=e,i=vg(t);return i.ok?(0,J.jsx)(YR,{...e,report:i.data}):(0,J.jsx)(Yb,{error:i.error,className:l,title:n,dataTheme:a})}function YR({report:e,customRenderers:t,renderers:l,className:n,title:a,dataTheme:i,hideHeader:r=!1,staleAfterDays:u=7,scenarioHistory:o}){let[s,p]=(0,I.useState)(""),[f,d]=(0,I.useState)("all"),[h,v]=(0,I.useState)([]),[R,C]=(0,I.useState)("full"),[m,c]=(0,I.useState)(!1),{theme:g,toggle:y}=i0(),k=(0,I.useRef)(null),_=(0,I.useDeferredValue)(s),E=(0,I.useMemo)(()=>e0(e),[e]),S=(0,I.useMemo)(()=>Pb(e,{query:_,status:f,tags:h}),[e,_,f,h]),N=s!==_,B=(0,I.useMemo)(()=>{let Y=e.summary,fe=[{key:"all",label:"All",count:Y.total}];return Y.passed&&fe.push({key:"passed",label:"Passed",count:Y.passed}),Y.failed&&fe.push({key:"failed",label:"Failed",count:Y.failed}),Y.skipped&&fe.push({key:"skipped",label:"Skipped",count:Y.skipped}),Y.pending&&fe.push({key:"pending",label:"Pending",count:Y.pending}),fe},[e]),Je=(0,I.useMemo)(()=>Ib(e),[e]),vl=(0,I.useCallback)(Y=>v(fe=>fe.includes(Y)?fe.filter(Bn=>Bn!==Y):[...fe,Y]),[]),[Ga,On]=(0,I.useState)(null),_t=(0,I.useRef)(null),Ue=(0,I.useCallback)(Y=>{On(Y),_t.current&&clearTimeout(_t.current),_t.current=setTimeout(()=>On(null),1800)},[]),ut=(0,I.useCallback)((Y,fe)=>{typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(Y).then(()=>Ue(fe),()=>Ue("Copy failed"))},[Ue]),Ya=(0,I.useMemo)(()=>({copyLink:Y=>ut(xb(Y),"Link copied"),copyMarkdown:Y=>ut(bb(Y),"Markdown copied"),copyPrompt:Y=>ut(vb(Y),"Prompt copied")}),[ut]),nn=(0,I.useRef)(0),M=mb(),Va=(0,I.useMemo)(()=>e.features.flatMap(Y=>[Y.id,...Y.scenarios.map(fe=>fe.id)]),[e]),Qa=(0,I.useCallback)(()=>M.collapseAll(Va),[M,Va]),tr=(0,I.useCallback)(()=>{k.current?.focus()},[]),Hn=(0,I.useCallback)(Y=>{if(E.length===0)return;nn.current=(nn.current+Y+E.length)%E.length;let fe=E[nn.current];fe&&ln(fe.scenarioId)},[E]),Re=(0,I.useCallback)(()=>{c(Y=>!Y)},[]),Ae=(0,I.useCallback)(()=>{m?c(!1):s!==""&&p("")},[m,s]);$b({onFocusSearch:tr,onNextFailure:()=>Hn(1),onPrevFailure:()=>Hn(-1),onToggleHelp:Re,onEscape:Ae,onExpandAll:M.expandAll,onCollapseAll:Qa}),Wb();let Un=S.features.length>0,lr=e.summary.total,me=S.summary.total;return(0,J.jsx)(db,{value:M.api,children:(0,J.jsx)(gb,{value:Ya,children:(0,J.jsx)(rb,{value:o??null,children:(0,J.jsx)(kg,{report:S,customRenderers:t,renderers:l,children:(0,J.jsxs)("main",{className:H("es-report","es-report-interactive",n),"aria-label":a??"Test report","aria-busy":N,"data-theme":i,"data-detail-level":R,children:[(0,J.jsxs)("header",{className:"es-report-header",children:[r?null:(0,J.jsx)(Gb,{title:a}),(0,J.jsx)(Xb,{lastRunMs:Db(e),ciUrl:e.ci?.url,staleAfterDays:u}),(0,J.jsx)(Kb,{history:o,report:e}),(0,J.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,J.jsx)(Vb,{ref:k,value:s,onChange:p,matchedCount:me,totalCount:lr}),(0,J.jsxs)("div",{className:"flex shrink-0 gap-1",children:[(0,J.jsx)("button",{type:"button",onClick:M.expandAll,"aria-keyshortcuts":"e",className:"cursor-pointer rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:"Expand all"}),(0,J.jsx)("button",{type:"button",onClick:Qa,"aria-keyshortcuts":"c",className:"cursor-pointer rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:"Collapse all"}),(0,J.jsx)("button",{type:"button",onClick:()=>C(Y=>Y==="full"?"minimal":"full"),"aria-pressed":R==="minimal",className:"cursor-pointer rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:R==="full"?"Hide docs":"Show docs"}),(0,J.jsx)("button",{type:"button",onClick:y,"aria-label":`Switch to ${g==="dark"?"light":"dark"} theme`,className:"cursor-pointer rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:g==="dark"?"\u2600 Light":"\u263E Dark"})]})]}),(0,J.jsx)(t0,{statuses:B,status:f,onStatus:d,tags:Je,activeTags:h,onToggleTag:vl})]}),(0,J.jsx)(jb,{failures:E}),Un?(0,J.jsxs)("div",{className:"flex gap-6",children:[(0,J.jsx)(l0,{}),(0,J.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:(0,J.jsx)(zb,{})})]}):(0,J.jsx)(_b,{message:s?"No scenarios match the search.":void 0}),(0,J.jsx)("button",{type:"button",className:"es-shortcuts-trigger","aria-label":"Keyboard shortcuts","aria-keyshortcuts":"Shift+?",onClick:Re,children:"?"}),(0,J.jsx)(Jb,{open:m,onClose:()=>c(!1)}),Ga?(0,J.jsx)("div",{role:"status","aria-live":"polite",className:"fixed bottom-4 left-1/2 -translate-x-1/2 rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background shadow-lg",children:Ga}):null]})})})})})}var Dn=x($(),1);var qa=x($(),1);var La=x(T(),1);function VR(e){let t=e?.closest("[data-theme]");return t?.dataset.theme==="dark"?!0:t?.dataset.theme==="light"?!1:typeof window<"u"&&!!window.matchMedia?.("(prefers-color-scheme: dark)").matches}function u0({entry:e,load:t}){let l=(0,qa.useRef)(null),[n,a]=(0,qa.useState)(null);return(0,qa.useEffect)(()=>{let i=!1,r=async()=>{try{let s=await t();s.initialize({startOnLoad:!1,securityLevel:"strict",theme:VR(l.current)?"dark":"default"});let p=`es-mermaid-${Math.random().toString(36).slice(2)}`,{svg:f}=await s.render(p,e.code);i||a(f)}catch{i||a(null)}};r();let u=l.current?.closest("[data-theme]"),o=u?new MutationObserver(()=>{r()}):void 0;return o?.observe(u,{attributes:!0,attributeFilter:["data-theme"]}),()=>{i=!0,o?.disconnect()}},[e.code,t]),n?(0,La.jsxs)("figure",{ref:l,className:"my-3",children:[e.title?(0,La.jsx)("figcaption",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:e.title}):null,(0,La.jsx)("div",{role:"img","aria-label":e.title??"Mermaid diagram",className:"overflow-x-auto rounded-md border border-border bg-card p-3 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full",dangerouslySetInnerHTML:{__html:n}})]}):(0,La.jsx)(Rf,{entry:e,ref:l})}var ro=x(T(),1),QR="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/es/highlight.min.js",jR="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";function o0(e){let t;return()=>(t??=import(e).then(l=>l.default??l),t)}var XR=o0(jR),ZR=o0(QR);function KR({entry:e}){let[t,l]=(0,Dn.useState)(null);return(0,Dn.useEffect)(()=>{let n=!1;return(async()=>{try{let a=await ZR(),i=e.lang&&a.getLanguage(e.lang)?e.lang:void 0,r=i?a.highlight(e.content,{language:i,ignoreIllegals:!0}):a.highlightAuto(e.content);n||l(r.value)}catch{n||l(null)}})(),()=>{n=!0}},[e.content,e.lang]),(0,ro.jsx)(sf,{label:e.label,children:t!==null?(0,ro.jsx)("code",{className:H("hljs font-mono text-xs",e.lang&&`language-${e.lang}`),dangerouslySetInnerHTML:{__html:t}}):(0,ro.jsx)("code",{className:H("font-mono text-xs",e.lang&&`language-${e.lang}`),children:e.content})})}function s0(e){let t={};return e.mermaid&&(t.mermaid=l=>(0,Dn.createElement)(u0,{entry:l,load:XR})),e.syntaxHighlighting&&(t.code=l=>(0,Dn.createElement)(KR,{entry:l})),t}function c0(e){if(e===null||typeof e!="object")return $c({message:"Expected a StoryReport object.",code:"INVALID_INPUT"});let t=e.schemaVersion;if(typeof t=="string"){let l=t.split(".")[0];if(l!==String(1))return $c({message:`Schema major ${l} is not supported by this version of executable-stories-react (expected ${1}.x). Upgrade the package.`,code:"SCHEMA_VERSION_MISMATCH"})}return Jc(e)}var $R="es-report-root",FR="es-report-data",WR="es-report-history";function IR(){let e=document.getElementById(WR);if(e?.textContent)try{let t=JSON.parse(e.textContent);return typeof t!="object"||t===null||Array.isArray(t)?void 0:t}catch{return}}function zf(){let e=document.getElementById($R),t=document.getElementById(FR);if(!e||!t?.textContent)return;let l;try{l=JSON.parse(t.textContent)}catch{return}let n=c0(l),a=e.getAttribute("data-title")??void 0,i=s0({syntaxHighlighting:e.getAttribute("data-es-syntax")!=="false",mermaid:e.getAttribute("data-es-mermaid")!=="false"}),r=e.getAttribute("data-es-stale-days"),u=r===null?Number.NaN:Number(r),o=Number.isFinite(u)&&u>=0?u:7;(0,d0.createRoot)(e).render((0,f0.createElement)(r0,{report:n,title:a,renderers:i,staleAfterDays:o,scenarioHistory:IR()}))}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",zf):zf());return v0(PR);})();
package/dist/ssr.cjs CHANGED
@@ -275,7 +275,7 @@ function DocSection({ entry }) {
275
275
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
276
276
  "div",
277
277
  {
278
- className: "es-doc-prose text-muted-foreground",
278
+ className: "es-doc-prose prose prose-sm max-w-none",
279
279
  dangerouslySetInnerHTML: { __html: html }
280
280
  }
281
281
  )