@wafertools/wafermap 0.35.0 → 0.36.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.
Files changed (97) hide show
  1. package/AGENTS.md +18 -9
  2. package/CHANGELOG.md +246 -0
  3. package/README.md +7 -4
  4. package/dist/packages/canvas-adapter/chartPrefs.d.ts +16 -0
  5. package/dist/packages/canvas-adapter/chartPrefs.js +1 -0
  6. package/dist/packages/canvas-adapter/charts/boxplot.js +1 -1
  7. package/dist/packages/canvas-adapter/charts/capability.js +1 -1
  8. package/dist/packages/canvas-adapter/charts/correlation.js +1 -1
  9. package/dist/packages/canvas-adapter/charts/histogram.js +1 -1
  10. package/dist/packages/canvas-adapter/dataTab.js +1 -1
  11. package/dist/packages/canvas-adapter/drilldown.js +1 -1
  12. package/dist/packages/canvas-adapter/index.d.ts +1 -0
  13. package/dist/packages/canvas-adapter/index.js +1 -1
  14. package/dist/packages/canvas-adapter/insightsTab.d.ts +7 -0
  15. package/dist/packages/canvas-adapter/insightsTab.js +1 -1
  16. package/dist/packages/canvas-adapter/renderWaferGallery.d.ts +20 -5
  17. package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
  18. package/dist/packages/canvas-adapter/renderWaferMap.d.ts +85 -38
  19. package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
  20. package/dist/packages/canvas-adapter/summaryPanel.d.ts +38 -12
  21. package/dist/packages/canvas-adapter/summaryPanel.js +4 -2
  22. package/dist/packages/canvas-adapter/summaryToggle.d.ts +11 -0
  23. package/dist/packages/canvas-adapter/summaryToggle.js +1 -0
  24. package/dist/packages/canvas-adapter/testValueOffer.d.ts +14 -0
  25. package/dist/packages/canvas-adapter/testValueOffer.js +1 -0
  26. package/dist/packages/canvas-adapter/toCanvas.js +1 -1
  27. package/dist/packages/canvas-adapter/toolbar.d.ts +2 -0
  28. package/dist/packages/canvas-adapter/toolbar.js +2 -2
  29. package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
  30. package/dist/packages/canvas-adapter/userGuideHtml.js +46 -23
  31. package/dist/packages/canvas-adapter/version.d.ts +2 -2
  32. package/dist/packages/canvas-adapter/version.js +1 -1
  33. package/dist/packages/canvas-adapter/warnings.js +1 -1
  34. package/dist/packages/core/aggregates.d.ts +10 -0
  35. package/dist/packages/core/aggregates.js +1 -1
  36. package/dist/packages/core/classify.d.ts +5 -0
  37. package/dist/packages/core/classify.js +1 -1
  38. package/dist/packages/core/dieTable.d.ts +31 -0
  39. package/dist/packages/core/dieTable.js +1 -1
  40. package/dist/packages/core/passBins.d.ts +6 -0
  41. package/dist/packages/core/passBins.js +1 -1
  42. package/dist/packages/core/wafer.d.ts +10 -1
  43. package/dist/packages/core/wafer.js +1 -1
  44. package/dist/packages/renderer/buildView.d.ts +5 -0
  45. package/dist/packages/renderer/buildView.js +1 -1
  46. package/dist/packages/renderer/buildWaferMap.d.ts +50 -4
  47. package/dist/packages/renderer/buildWaferMap.js +1 -1
  48. package/dist/packages/renderer/derivedTests/parser.js +1 -1
  49. package/dist/packages/renderer/fmt.d.ts +10 -0
  50. package/dist/packages/renderer/fmt.js +1 -1
  51. package/dist/packages/renderer/index.d.ts +1 -0
  52. package/dist/packages/renderer/index.js +1 -1
  53. package/dist/packages/renderer/spec.d.ts +4 -0
  54. package/dist/packages/renderer/spec.js +1 -1
  55. package/dist/packages/renderer/valueFilter.d.ts +55 -0
  56. package/dist/packages/renderer/valueFilter.js +1 -0
  57. package/dist/packages/stats/analyzeWaferLot.d.ts +16 -0
  58. package/dist/packages/stats/analyzeWaferLot.js +1 -1
  59. package/dist/packages/stats/analyzeWaferMap.d.ts +62 -4
  60. package/dist/packages/stats/analyzeWaferMap.js +1 -1
  61. package/dist/packages/stats/capability.d.ts +5 -0
  62. package/dist/packages/stats/capability.js +1 -1
  63. package/dist/packages/stats/clusterDetection.js +1 -1
  64. package/dist/packages/stats/connectedComponents.d.ts +19 -0
  65. package/dist/packages/stats/connectedComponents.js +1 -1
  66. package/dist/packages/stats/correlation.d.ts +36 -4
  67. package/dist/packages/stats/correlation.js +1 -1
  68. package/dist/packages/stats/filterFindings.d.ts +1 -1
  69. package/dist/packages/stats/filterFindings.js +1 -1
  70. package/dist/packages/stats/findingText.d.ts +8 -0
  71. package/dist/packages/stats/findingText.js +2 -2
  72. package/dist/packages/stats/index.d.ts +2 -1
  73. package/dist/packages/stats/index.js +1 -1
  74. package/dist/packages/stats/lotDrift.js +1 -1
  75. package/dist/packages/stats/lotPattern.js +1 -1
  76. package/dist/packages/stats/math.d.ts +25 -3
  77. package/dist/packages/stats/math.js +1 -1
  78. package/dist/packages/stats/mergeTestDefs.js +1 -1
  79. package/dist/packages/stats/patternClassification.d.ts +44 -18
  80. package/dist/packages/stats/patternClassification.js +1 -1
  81. package/dist/packages/stats/plotData.d.ts +11 -0
  82. package/dist/packages/stats/plotData.js +1 -1
  83. package/dist/packages/stats/regions.d.ts +6 -0
  84. package/dist/packages/stats/regions.js +1 -1
  85. package/dist/packages/stats/renderSummaryReport.js +33 -33
  86. package/dist/packages/stats/reportHtml.d.ts +12 -18
  87. package/dist/packages/stats/reportHtml.js +112 -48
  88. package/dist/packages/stats/synthesis.d.ts +48 -17
  89. package/dist/packages/stats/synthesis.js +1 -1
  90. package/dist/packages/stats/testPassRate.js +1 -1
  91. package/dist/packages/stats/testValueBudget.d.ts +15 -0
  92. package/dist/packages/stats/testValueBudget.js +1 -0
  93. package/dist/packages/stats/types.d.ts +89 -22
  94. package/llms.txt +2 -2
  95. package/package.json +1 -1
  96. package/dist/packages/canvas-adapter/summaryRail.d.ts +0 -7
  97. package/dist/packages/canvas-adapter/summaryRail.js +0 -1
@@ -1,67 +1,67 @@
1
- import{waferDisplayLabel as _}from"../core/waferLabel.js";import{binPassSets as Re,binPassSetsByWafer as We,mergeBinDefs as Q,resolveBinColors as Ne,resolveBinColorsByWafer as Ie}from"../renderer/binColors.js";import{commonPassBins as Me,itemPassBins as M,passBinsLabel as Le}from"../core/passBins.js";import{itemRingCount as Ee}from"../core/ringCount.js";import{isParametricTest as ke,isBuiltMap as V}from"../renderer/buildWaferMap.js";import{buildRingRegions as U,buildQuadrantRegions as K,buildRegionYieldData as He}from"./regions.js";import{openHtmlReport as je}from"./renderFindingsReport.js";import{analyzeWaferLot as Ae}from"./analyzeWaferLot.js";import{computeFunctionalYield as qe,analyzeWaferMap as ze}from"./analyzeWaferMap.js";import{mergeTestDefs as Ge}from"./mergeTestDefs.js";import{buildFacetTable as Oe,facetValueOf as _e,FACET_NONE_VALUE as Qe}from"./facets.js";import{visibleFindings as L}from"./filterFindings.js";import{buildYieldDataCombined as Ve}from"./yield.js";import{describeWaferPopulation as J,populationLabel as Ue}from"./population.js";import{buildTestPassRateData as Ke,hasJudgeableTests as Je,poolFunctionalYield as Xe}from"./testPassRate.js";import{buildCapabilityData as Ze}from"./capability.js";import{buildSynthesis as et}from"./synthesis.js";import{binBreakdownRows as tt,binBreakdownTitle as nt,binCountsFrom as st,pooledBinCounts as at,totalOf as it}from"./binRows.js";import{MEAN_WAFER_YIELD_LABEL as ot,shortfallLegend as E}from"./presentation.js";import{regionYieldRows as X,waferYieldRows as rt}from"./yieldRows.js";import{describeValues as lt}from"./math.js";import{fmt as C}from"../renderer/fmt.js";import{getDieKey as ct,isPositionedDie as dt,diePassStatus as Z}from"../core/dies.js";import{testValue as ut}from"../core/dieTable.js";import{findingsTableHtml as ee,synthesisSectionHtml as ft,LIVE_FINDINGS_SCRIPT as k,barCell as R,deltaCell as H,withSectionNav as te,renderMetadataSection as ne,renderMetricGrid as se,renderSection as D,renderTable as P,reportStyles as j}from"./reportHtml.js";import{escHtml as S}from"../core/utils.js";function ae(t,a){return a===0?"\u2014":`${(t/a*100).toFixed(1)}%`}function mt(t){if(!t)return"";const a=t.lot??t.lotId,i=t.wafer??t.waferId,n=[a,i].filter(Boolean).map(String);return n.length?` \u2014 ${n.map(S).join(" \xB7 ")}`:""}function ie(t,a,i,n,r){if(!t.size)return"";const e=tt(t,a,n).map(c=>{const s=c.passing?"muted-row":"",d=m=>({html:S(m),className:s});return[d(String(c.bin)),d(c.name??"\u2014"),d(String(c.count)),R(c.percent,`${c.percent.toFixed(1)}%`,s,r?.get(c.bin))]});return D(nt(i,it(t)),P(["Bin","Name","Dies","Share"],e,{className:"compact"}))}function pt(t,a,i,n,r,e){const c=Re(t,r);return["hard","soft"].map(s=>ie(st(t,s,s==="hard"?n.hard:n.soft),s==="hard"?a:i,s,c[s],e[s])).join(`
2
- `)}function oe(t,a,i,n){const r=new Set(n),e=new Map(i.map(o=>[ct(o),o]));if(!i.some(o=>o.hbin!=null||o.sbin!=null)||!a.length)return"";const s=[];for(const o of a){let p=0,g=0;for(const b of o.dieKeys){const w=e.get(b);if(!w||w.partial||w.edgeExcluded)continue;const y=Z(w,r);y!==void 0&&(g++,y&&p++)}g&&s.push({label:o.label,pass:p,total:g})}if(!s.length)return"";const{rows:d}=X(s.map(o=>({key:o.label,label:o.label,n:o.total,passDies:o.pass,yieldPercent:o.pass/o.total*100}))),m=d.map(o=>[S(o.label),String(o.passDies),String(o.n),R(o.yieldPercent,ae(o.passDies,o.n)),H(o.delta)]);return D(t,P(["Region","Pass","Total","Yield","vs wafer"],m,{className:"compact"})+`<p class="report-legend">${E("the wafer")}</p>`)}function gt(t,a){const i=new Float64Array(t.length);let n=0;for(const g of t){const b=ut(g,a);b!==void 0&&Number.isFinite(b)&&(i[n++]=b)}if(n===0)return;const{count:r,min:e,mean:c,max:s,q1:d,median:m,q3:o,stddev:p}=lt(i.subarray(0,n));return{testNumber:a,count:r,min:e,mean:c,max:s,q1:d,median:m,q3:o,stddev:p}}function re(t,a,i,n,r){if(!a.length)return"";const e=t.filter(l=>!l.partial&&!l.edgeExcluded),c=new Map((i??[]).map(l=>[l.testNumber,l])),s=new Map((n??[]).map(l=>[l.testNumber,l.yieldPercent])),d=[];for(const l of a.filter(ke)){const u=c.get(l.testNumber)??gt(e,l.testNumber);u&&d.push({name:l.name,unit:l.unit||void 0,stats:u,limitYield:s.get(l.testNumber)})}if(!d.length)return"";const m=l=>d.every(u=>u.stats[l]!==void 0),o=m("q1")&&m("median")&&m("q3"),p=m("stddev"),g=d.some(l=>l.limitYield!==void 0&&l.limitYield!==null),b=(l,u)=>l===void 0?"\u2014":C(l,u),w=["Test","N","Min",...o?["Q1","Median"]:[],"Mean",...o?["Q3"]:[],"Max",...p?["StdDev"]:[],...g?["Limit yield"]:[]],y=d.map(({name:l,unit:u,stats:h,limitYield:$})=>[S(l),{html:String(h.count),className:"numeric"},b(h.min,u),...o?[b(h.q1,u),b(h.median,u)]:[],b(h.mean,u),...o?[b(h.q3,u)]:[],b(h.max,u),...p?[b(h.stddev,u)]:[],...g?[$==null?"\u2014":`${$.toFixed(1)}%`]:[]]);return D("Test Values",P(w,y,{className:"compact"})+`<p class="report-legend">${p?"StdDev is the sample standard deviation (n\u22121). ":""}${r??""}</p>`)}function le(t,a,i){const n=i??qe(t,a);if(!n?.length)return"";const r=n.map(e=>[S(e.label),String(e.totalDies),String(e.passDies),String(e.failDies),e.passRatePercent!==null?`${e.passRatePercent.toFixed(1)}%`:"\u2014"]);return D("Functional Tests",P(["Test","N","Pass","Fail","Pass Rate"],r,{className:"compact"}))}function ce(t,a){const i=Ze(t,a);if(!i.length)return"";const n=e=>e===null?"\u2014":e.toFixed(2),r=i.map(e=>[S(e.label),e.hasSpec?e.limitBasis==="spec"?`LSL ${C(e.lsl,e.unit)} \u2013 USL ${C(e.usl,e.unit)}`:`Lo limit ${C(e.lsl,e.unit)} \u2013 Hi limit ${C(e.usl,e.unit)}`:"\u2014",C(e.mean,e.unit),n(e.cp),n(e.cpk),n(e.pp),n(e.ppk)]);return D("Process Capability",P(["Test","Limits","Mean","Cp","Cpk","Pp","Ppk"],r,{className:"compact"}))}function de(t,a,i="",n=!1){const r=L(t);return r.length?D("Findings",ee(r,a,i,n)):""}function ue(t,a,i=""){const n=new Set(L(t.findings).map(r=>r.id));return ft(et(t,{passBins:a?[...a]:void 0}),n,i)}export function renderSummaryReportHtml(t,a={}){const{wafer:i,dies:n,yieldSummary:r,dataCoverage:e,hbinDefs:c,sbinDefs:s,testDefs:d=[],statsSummary:m,passBins:o,ringCount:p}=t,g=t.binColors??Ne(n,{passBins:o,hbinDefs:c,sbinDefs:s}),b=i.metadata,w=mt(b),y=a.title??`Wafer Summary${w}`,l=new Date().toLocaleString(),u=n.filter(dt),h=U(u,i,p),$=K(u,i,p),v=[{label:"Total dies",value:String(r.totalDies)},{label:"Filled dies",value:String(e.filledDies),hint:`${ae(e.filledDies,e.totalDies)} fill`},{label:"Pass dies",value:String(r.passDies)},{label:"Fail dies",value:String(r.failDies)},...r.partialDies>0?[{label:"Partial",value:String(r.partialDies)}]:[],...r.yieldPercent!==null?[{label:`Yield (pass: ${Le([o])})`,value:`${r.yieldPercent.toFixed(1)}%`}]:[],...r.edgeExcludedDies>0?[{label:"Edge excluded (outer zone)",value:String(r.edgeExcludedDies)}]:[]],x=[ne([{metadata:i.metadata}]),D("Summary",[se(v)].filter(Boolean).join(`
3
- `)),m?ue(m,o):"",pt(n,c,s,{hard:m?.stats.hardBinCounts,soft:m?.stats.softBinCounts},o,g),oe("Ring Yield",h,n,o),oe("Quadrant Yield",$,n,o),re(n,d,m?.stats.perTestStats,m?.stats.testSpecYield),le(n,d,m?.stats.functionalYield),ce([{dies:n}],d),m?de(m.findings,void 0,"",t.live):""].filter(Boolean).join(`
1
+ import{waferDisplayLabel as I}from"../core/waferLabel.js";import{binPassSets as Le,binPassSetsByWafer as Ie,mergeBinDefs as X,resolveBinColors as Ee,resolveBinColorsByWafer as ke}from"../renderer/binColors.js";import{commonPassBins as He,itemPassBins as E,passBinsLabel as Ae}from"../core/passBins.js";import{itemRingCount as je}from"../core/ringCount.js";import{isParametricTest as k,isBuiltMap as Z}from"../renderer/buildWaferMap.js";import{buildRingRegions as ee,buildQuadrantRegions as te,buildRegionYieldData as Ge}from"./regions.js";import{openHtmlReport as qe}from"./renderFindingsReport.js";import{analyzeWaferLot as ze}from"./analyzeWaferLot.js";import{computeFunctionalYield as Oe,analyzeWaferMap as _e}from"./analyzeWaferMap.js";import{mergeTestDefs as Qe}from"./mergeTestDefs.js";import{buildFacetTable as Ve,facetValueOf as Ue,FACET_NONE_VALUE as Ke}from"./facets.js";import{visibleFindings as H}from"./filterFindings.js";import{buildYieldDataCombined as Je}from"./yield.js";import{describeWaferPopulation as ne,populationLabel as Xe}from"./population.js";import{buildTestPassRateData as Ze,hasJudgeableTests as et,poolFunctionalYield as tt}from"./testPassRate.js";import{buildCapabilityData as nt,pooledTestStatsSteps as st}from"./capability.js";import{buildSynthesis as at}from"./synthesis.js";import{binBreakdownRows as it,binBreakdownTitle as ot,binCountsFrom as rt,pooledBinCounts as lt,totalOf as ct}from"./binRows.js";import{MEAN_WAFER_YIELD_LABEL as dt,shortfallLegend as A}from"./presentation.js";import{regionYieldRows as se,waferYieldRows as ut}from"./yieldRows.js";import{describeValues as ft}from"./math.js";import{fmt as Y}from"../renderer/fmt.js";import{getDieKey as mt,isPositionedDie as pt,diePassStatus as ae}from"../core/dies.js";import{excludedCounts as gt,testValue as ht}from"../core/dieTable.js";import{limitSetName as bt}from"../renderer/valueFilter.js";import{findingsTableHtml as ie,findingAnchor as yt,synthesisSectionHtml as St,reportScripts as j,barCell as M,deltaCell as G,withSectionNav as oe,renderMetadataSection as re,renderMetricGrid as le,renderSection as D,renderTable as P,reportStyles as q}from"./reportHtml.js";import{escHtml as $,drain as wt}from"../core/utils.js";function ce(e,i){return i===0?"\u2014":`${(e/i*100).toFixed(1)}%`}function $t(e){if(!e)return"";const i=e.lot??e.lotId,o=e.wafer??e.waferId,s=[i,o].filter(Boolean).map(String);return s.length?` \u2014 ${s.map($).join(" \xB7 ")}`:""}function de(e,i,o,s,r){if(!e.size)return"";const t=it(e,i,s).map(a=>{const l=a.passing?"muted-row":"",c=u=>({html:$(u),className:l});return[c(String(a.bin)),c(a.name??"\u2014"),c(String(a.count)),M(a.percent,`${a.percent.toFixed(1)}%`,l,r?.get(a.bin))]});return D(ot(o,ct(e)),P(["Bin","Name","Dies","Share"],t,{className:"compact"}))}function vt(e,i,o,s,r,t){const a=Le(e,r);return["hard","soft"].map(l=>de(rt(e,l,l==="hard"?s.hard:s.soft),l==="hard"?i:o,l,a[l],t[l])).join(`
2
+ `)}function ue(e,i,o,s){const r=new Set(s),t=new Map(o.map(n=>[mt(n),n]));if(!o.some(n=>n.hbin!=null||n.sbin!=null)||!i.length)return"";const l=[];for(const n of i){let f=0,S=0;for(const v of n.dieKeys){const y=t.get(v);if(!y||y.partial||y.edgeExcluded)continue;const p=ae(y,r);p!==void 0&&(S++,p&&f++)}S&&l.push({label:n.label,pass:f,total:S})}if(!l.length)return"";const{rows:c}=se(l.map(n=>({key:n.label,label:n.label,n:n.total,passDies:n.pass,yieldPercent:n.pass/n.total*100}))),u=c.map(n=>[$(n.label),String(n.passDies),String(n.n),M(n.yieldPercent,ce(n.passDies,n.n)),G(n.delta)]);return D(e,P(["Region","Pass","Total","Yield","vs wafer"],u,{className:"compact"})+`<p class="report-legend">${A("the wafer")}</p>`)}function xt(e,i){const o=new Float64Array(e.length);let s=0;for(const S of e){const v=ht(S,i);v!==void 0&&Number.isFinite(v)&&(o[s++]=v)}if(s===0)return;const{count:r,min:t,mean:a,max:l,q1:c,median:u,q3:n,stddev:f}=ft(o.subarray(0,s));return{testNumber:i,count:r,min:t,mean:a,max:l,q1:c,median:u,q3:n,stddev:f}}function fe(e,i,o,s,r,t){if(!i.length)return"";const a=e.filter(d=>!d.partial&&!d.edgeExcluded),l=new Map((o??[]).map(d=>[d.testNumber,d])),c=new Map((s??[]).map(d=>[d.testNumber,d.yieldPercent])),u=[];for(const d of i.filter(k)){const m=l.get(d.testNumber)??xt(a,d.testNumber);m&&u.push({name:d.name,unit:d.unit||void 0,stats:m,limitYield:c.get(d.testNumber)})}if(!u.length)return"";const n=d=>u.every(m=>m.stats[d]!==void 0),f=n("q1")&&n("median")&&n("q3"),S=n("stddev"),v=u.some(d=>d.limitYield!==void 0&&d.limitYield!==null),y=(d,m)=>d===void 0?"\u2014":Y(d,m),p=gt(a),g=p?`${[...p.counts.values()].reduce((d,m)=>d+m,0).toLocaleString("en-GB")} values outside the ${bt(p.by)} are excluded (not in N): `+[...p.counts].map(([d,m])=>`${$(i.find(w=>w.testNumber===d)?.name??`test ${d}`)} ${m.toLocaleString("en-GB")}`).join(", ")+". ":"",b=["Test","N","Min",...f?["Q1","Median"]:[],"Mean",...f?["Q3"]:[],"Max",...S?["StdDev"]:[],...v?["Limit yield"]:[]],x=u.map(({name:d,unit:m,stats:w,limitYield:F})=>[$(d),{html:String(w.count),className:"numeric"},y(w.min,m),...f?[y(w.q1,m),y(w.median,m)]:[],y(w.mean,m),...f?[y(w.q3,m)]:[],y(w.max,m),...S?[y(w.stddev,m)]:[],...v?[F==null?"\u2014":`${F.toFixed(1)}%`]:[]]);return D("Test Values",P(b,x,{className:"compact"})+`<p class="report-legend">${S?"StdDev is the sample standard deviation (n\u22121). ":""}${g}${r??""}</p>`,"",t)}function me(e,i,o,s){const r=o??Oe(e,i);if(!r?.length)return"";const t=r.map(a=>[$(a.label),String(a.totalDies),String(a.passDies),String(a.failDies),a.passRatePercent!==null?`${a.passRatePercent.toFixed(1)}%`:"\u2014"]);return D("Functional Tests",P(["Test","N","Pass","Fail","Pass Rate"],t,{className:"compact"}),"",s)}function pe(e,i){const o=nt(e,i);if(!o.length)return"";const s=t=>t===null?"\u2014":t.toFixed(2),r=o.map(t=>[$(t.label),t.hasSpec?t.limitBasis==="spec"?`LSL ${Y(t.lsl,t.unit)} \u2013 USL ${Y(t.usl,t.unit)}`:`Lo limit ${Y(t.lsl,t.unit)} \u2013 Hi limit ${Y(t.usl,t.unit)}`:"\u2014",Y(t.mean,t.unit),s(t.cp),s(t.cpk),s(t.pp),s(t.ppk)]);return D("Process Capability",P(["Test","Limits","Mean","Cp","Cpk","Pp","Ppk"],r,{className:"compact"}))}function ge(e,i,o="",s=!1){const r=H(e);return r.length?D("Findings",ie(r,i,o,s)):""}const z=e=>`report-tests-${e}`,O=e=>`report-functional-${e}`;function he(e,i,o,s){const r=new Set(H(e.findings).map(a=>a.id)),t=a=>a.kind==="finding"?r.has(a.id)?yt(a.id,o):void 0:s.get(a.testNumber);return St(at(e,{passBins:i?[...i]:void 0}),t)}function be(e,i,o,s){const r=new Map;for(const t of e)(k(t)?o:s)&&r.set(t.testNumber,k(t)?z(i):O(i));return r}export function renderSummaryReportHtml(e,i={}){const{wafer:o,dies:s,yieldSummary:r,dataCoverage:t,hbinDefs:a,sbinDefs:l,testDefs:c=[],statsSummary:u,passBins:n,ringCount:f}=e,S=e.binColors??Ee(s,{passBins:n,hbinDefs:a,sbinDefs:l}),v=o.metadata,y=$t(v),p=i.title??`Wafer Summary${y}`,g=new Date().toLocaleString(),b=s.filter(pt),x=ee(b,o,f),d=te(b,o,f),m=[{label:"Total dies",value:String(r.totalDies)},{label:"Filled dies",value:String(t.filledDies),hint:`${ce(t.filledDies,t.totalDies)} fill`},{label:"Pass dies",value:String(r.passDies)},{label:"Fail dies",value:String(r.failDies)},...r.partialDies>0?[{label:"Partial",value:String(r.partialDies)}]:[],...r.yieldPercent!==null?[{label:`Yield (pass: ${Ae([n])})`,value:`${r.yieldPercent.toFixed(1)}%`}]:[],...r.edgeExcludedDies>0?[{label:"Edge excluded (outer zone)",value:String(r.edgeExcludedDies)}]:[]],w=fe(s,c,u?.stats.perTestStats,u?.stats.testSpecYield,void 0,z("")),F=me(s,c,u?.stats.functionalYield,O("")),B=[re([{metadata:o.metadata}]),D("Summary",[le(m)].filter(Boolean).join(`
3
+ `)),u?he(u,n,"",be(c,"",!!w,!!F)):"",vt(s,a,l,{hard:u?.stats.hardBinCounts,soft:u?.stats.softBinCounts},n,S),ue("Ring Yield",x,s,n),ue("Quadrant Yield",d,s,n),w,F,pe([{dies:s}],c),u?ge(u.findings,void 0,"",e.live):""].filter(Boolean).join(`
4
4
  `);return`<!DOCTYPE html>
5
5
  <html lang="en">
6
6
  <head>
7
7
  <meta charset="UTF-8">
8
- <title>${S(y)}</title>
8
+ <title>${$(p)}</title>
9
9
  <style>
10
- ${j()}
10
+ ${q()}
11
11
  </style>
12
12
  </head>
13
13
  <body>
14
14
  <main class="report">
15
15
  <header class="report-header">
16
- <h1>${S(y)}</h1>
17
- <p class="report-subtitle">Generated ${S(l)}</p>
16
+ <h1>${$(p)}</h1>
17
+ <p class="report-subtitle">Generated ${$(g)}</p>
18
18
  </header>
19
- ${te(x)}
20
- <p class="footer">Generated ${S(l)}</p>
19
+ ${oe(B)}
20
+ <p class="footer">Generated ${$(g)}</p>
21
21
  </main>
22
- ${t.live?k:""}
22
+ ${j(e.live)}
23
23
  </body>
24
- </html>`}function ht(t,a){const i=t.perWafer.flatMap(e=>{const c=e.summary.stats.yieldPercent;return c===null?[]:[{waferIndex:e.waferIndex,yieldPercent:c}]}),n=new Map(rt(i).rows.map(e=>[e.waferIndex,e])),r=t.perWafer.map(e=>{const c=S(_(a[e.waferIndex],e.waferIndex)),s=n.get(e.waferIndex);return s?[s.outlier?`${c} \xB7 ${s.outlier} outlier`:c,R(s.yieldPercent,`${s.yieldPercent.toFixed(1)}%`),H(s.delta)]:[c,"N/A",""]});return P(["Wafer","Yield","vs lot median"],r,{className:"compact"})+`<p class="report-legend">${E("the lot median")}</p>`}function bt(t){const a=[];for(const e of t.perWafer){const c=L(e.summary.findings);if(!c.length)continue;const s=e.summary.wafer?.waferId??`Wafer ${e.waferIndex+1}`;a.push(`<h3 class="report-subheading">${S(s)}</h3>`+ee(c))}if(!a.length)return"";const i=a.length,n=t.perWafer.length,r=`<p class="report-note">${i} of ${n} wafer${n===1?"":"s"} have per-wafer findings; the rest had none.</p>`;return D("Findings by Wafer",r+a.join(`
25
- `))}const yt=3;function St(t,a,i){const n=t.map(d=>({metadata:d.wafer?.metadata})),r=Oe(n,{facetableOnly:!0}).filter(d=>d.splittable);if(!r.length)return"";const e=r.slice(0,yt),c=[];for(const d of e){const m=new Map;t.forEach((l,u)=>{const h=_e(l.wafer?.metadata,d.key)??Qe;(m.get(h)??m.set(h,[]).get(h)).push(u)});const o=[...m.entries()].map(([l,u])=>({key:l,items:u.map(h=>t[h])}));if(o.length<2)continue;const p=o.map(l=>[S(l.key),S(l.items.map(u=>u.label).join(", "))]),g=Ve(o.map(l=>({key:l.key,items:l.items.map(u=>({label:u.label,dies:u.dies,passBins:M(u,i)}))}))).map(l=>[S(l.label),String(l.itemCount),`${l.percent.toFixed(1)}%`]),b=[P([d.label,"Wafers"],p,{className:"compact"}),P([d.label,"Wafers","Yield"],g,{className:"compact"})],w=t.flatMap(l=>l.dies??[]);let y=0;for(const l of["spec","testFlag","functional"]){if(!Je(a,l,w))continue;const u=Ke(o.map(v=>({key:v.key,items:v.items.map(x=>({dies:x.dies,testSpecYield:x.statsSummary?.stats.testSpecYield,functionalYield:x.statsSummary?.stats.functionalYield}))})),a,l);if(!u.rows.length)continue;const h=u.rows.map(v=>[S(v.label),...v.byGroup.map(x=>x.passRatePercent===null?"\u2014":`${x.passRatePercent.toFixed(1)}%`),v.overall.passRatePercent===null?"\u2014":`${v.overall.passRatePercent.toFixed(1)}%`]),$=l==="spec"?"Pass rate \xB7 test limits":l==="testFlag"?"Pass rate \xB7 tester flag":"Pass rate \xB7 functional";u.disagreementDies&&(y=u.disagreementDies),b.push(`<h4 class="report-subheading">${S($)}</h4>`+P(["Test",...u.groups,"All"],h,{className:"compact"}))}y&&b.push(`<p class="report-note">${y.toLocaleString()} dies judged differently by limits and tester flag.</p>`),c.push(`<h3 class="report-subheading">${S(d.label)}</h3>${b.join(`
26
- `)}`)}if(!c.length)return"";const s=r.length>e.length?`<p class="report-note">${r.length-e.length} further splittable field(s) not shown.</p>`:"";return D("Split Comparison",c.join(`
27
- `)+s)}function wt(t,a,i,n,r,e){const c=We(r);return["hard","soft"].map(s=>ie(at(n,t,s),s==="hard"?a:i,s,c[s],e[s])).join(`
28
- `)}function fe(t,a,i,n,r,e){const c=He(i,n,r,d=>e[d],a);if(!c.length)return"";const s=X(c).rows.map(d=>[S(d.label),R(d.yieldPercent,`${d.yieldPercent.toFixed(1)}%`),H(d.delta)]);return D(t,P(["Region","Yield","vs lot"],s,{className:"compact"})+`<p class="report-legend">${E("the lot")}</p>`)}function $t(t,a,i,n){let r;if(i?.length&&i.every(e=>e.stats.perTestStats!==void 0)){const e=new Map;for(const c of i)for(const s of c.stats.perTestStats??[]){const d=e.get(s.testNumber)??{n:0,sum:0,min:1/0,max:-1/0,parts:[]};d.n+=s.count,d.sum+=s.mean*s.count,d.min=Math.min(d.min,s.min),d.max=Math.max(d.max,s.max),d.parts.push({n:s.count,mean:s.mean,sd:s.stddev}),e.set(s.testNumber,d)}r=[...e.entries()].map(([c,s])=>{const d=s.sum/s.n,m=s.parts.every(p=>p.sd!==void 0),o=m&&s.n>1?s.parts.reduce((p,g)=>p+Math.max(0,g.n-1)*g.sd**2+g.n*(g.mean-d)**2,0)/(s.n-1):m?0:void 0;return{testNumber:c,count:s.n,min:s.min,max:s.max,mean:d,...o!==void 0?{stddev:Math.sqrt(o)}:{}}})}return re(t,a,r,n,r?"Quartiles are not shown for a lot: they cannot be combined from each wafer\u2019s own.":void 0)}function vt(t,a,i){const n=Xe(i);return le(t,a,n)}const A=["lot","product","testProgram","temperature"];function xt(t){const a=new Map(A.map(e=>[e,new Set]));for(const e of t)for(const c of A){const s=e.wafer?.metadata?.[c];s!=null&&s!==""&&a.get(c).add(String(s))}const i=A.filter(e=>a.get(e).size>1);if(i.length===0)return[{label:"",items:t,varying:i}];const n=new Map,r=[];for(const e of t){const c=i.map(s=>String(e.wafer?.metadata?.[s]??"(none)")).join(" \xB7 ");n.has(c)||(n.set(c,[]),r.push(c)),n.get(c).push(e)}return r.map(e=>({label:e,items:n.get(e),varying:i}))}function me(t,a,i,n,r,e,c,s,d="",m=!1){const o=Ae(t.map(f=>f.source??f),{perWaferSummaries:t.map(f=>f.statsSummary),...c}),p=[],g=[],b=[],w=[];for(const f of t){const T=f.dies??[];f.wafer&&(p.push(f.wafer),b.push(T),w.push(M(f,r)));for(const F of T)g.push(F)}const y=t.map(f=>({dies:f.dies??[],passBins:M(f,r)})),l=s??Ie(y,{hbinDefs:a,sbinDefs:i}).colors,u=g.some(f=>f.hbin!=null),h=g.some(f=>f.sbin!=null),$=u||h,v=o.perWafer.map(f=>f.summary.stats.yieldPercent).filter(f=>f!==null),x=v.length?v.reduce((f,T)=>f+T,0)/v.length:null;let q=0,B=0,Y=0,W=0,N=0;for(const f of y){const T=new Set(f.passBins);for(const F of f.dies){if(q++,F.edgeExcluded&&W++,F.partial&&N++,F.partial||F.edgeExcluded)continue;const O=Z(F,T);O!==void 0&&(B++,O&&Y++)}}const ge=B-Y,z=B>0?Y/B*100:null,he=[{label:"Wafers",value:String(o.stats.waferCount)},{label:"Total dies",value:String(q)},...$?[{label:"Good dies",value:String(Y)},{label:"Bad dies",value:String(ge)}]:[],...W>0?[{label:"Edge excluded",value:String(W)}]:[],...N>0?[{label:"Partial dies",value:String(N)}]:[],...x!==null?[{label:ot,value:`${x.toFixed(1)}%`}]:[],...z!==null?[{label:"Total yield",value:`${z.toFixed(1)}%`}]:[]],be=J(o.perWafer.map(f=>f.summary.wafer)),ye=D(be.lotId!==void 0?"Lot Summary":"Summary",se(he)),Se=ne(t.map(f=>({metadata:f.wafer?.metadata}))),we=D("Per-Wafer Yield",ht(o,t)),G=e??Ee(t[0]),$e=St(t,n,r),I=o.perWafer.map(f=>f.summary),ve=$?wt(g,a,i,I,y,l):"",xe=$&&p.length?fe("Ring Yield (All Wafers)",U,b,p,G,w):"",De=$&&p.length?fe("Quadrant Yield (All Wafers)",K,b,p,G,w):"",Pe=n.length?$t(g,n,I,o.stats.testSpecYield):"",Fe=n.length?vt(g,n,I):"",Te=n.length?ce(t,n):"",Ce=o.findings.length?de(o.findings,o.stats.waferCount,d,m):"",Be=bt(o),Ye=[ye,ue(o,Me(y.map(f=>f.passBins)),d),Se,we,$e,ve,xe,De,Pe,Fe,Te,Ce,Be].filter(Boolean).join(`
29
- `);return{lotSummary:o,sections:Ye}}function pe(t,a,i,n=""){return`<main class="report">
24
+ </html>`}function Dt(e,i){const o=e.perWafer.flatMap(t=>{const a=t.summary.stats.yieldPercent;return a===null?[]:[{waferIndex:t.waferIndex,yieldPercent:a}]}),s=new Map(ut(o).rows.map(t=>[t.waferIndex,t])),r=e.perWafer.map(t=>{const a=$(I(i[t.waferIndex],t.waferIndex)),l=s.get(t.waferIndex);return l?[l.outlier?`${a} \xB7 ${l.outlier} outlier`:a,M(l.yieldPercent,`${l.yieldPercent.toFixed(1)}%`),G(l.delta)]:[a,"N/A",""]});return P(["Wafer","Yield","vs lot median"],r,{className:"compact"})+`<p class="report-legend">${A("the lot median")}</p>`}function Pt(e){const i=[];for(const t of e.perWafer){const a=H(t.summary.findings);if(!a.length)continue;const l=I({wafer:{metadata:t.summary.wafer}},t.waferIndex);i.push(`<h3 class="report-subheading">${$(l)}</h3>`+ie(a))}if(!i.length)return"";const o=i.length,s=e.perWafer.length,r=`<p class="report-note">${o} of ${s} wafer${s===1?"":"s"} have per-wafer findings; the rest had none.</p>`;return D("Findings by Wafer",r+i.join(`
25
+ `))}const Ft=3;function Tt(e,i,o){const s=e.map(c=>({metadata:c.wafer?.metadata})),r=Ve(s,{facetableOnly:!0}).filter(c=>c.splittable);if(!r.length)return"";const t=r.slice(0,Ft),a=[];for(const c of t){const u=new Map;e.forEach((g,b)=>{const x=Ue(g.wafer?.metadata,c.key)??Ke;(u.get(x)??u.set(x,[]).get(x)).push(b)});const n=[...u.entries()].map(([g,b])=>({key:g,items:b.map(x=>e[x])}));if(n.length<2)continue;const f=n.map(g=>[$(g.key),$(g.items.map(b=>b.label).join(", "))]),S=Je(n.map(g=>({key:g.key,items:g.items.map(b=>({label:b.label,dies:b.dies,passBins:E(b,o)}))}))).map(g=>[$(g.label),String(g.itemCount),`${g.percent.toFixed(1)}%`]),v=[P([c.label,"Wafers"],f,{className:"compact"}),P([c.label,"Wafers","Yield"],S,{className:"compact"})],y=e.flatMap(g=>g.dies??[]);let p=0;for(const g of["spec","testFlag","functional"]){if(!et(i,g,y))continue;const b=Ze(n.map(m=>({key:m.key,items:m.items.map(w=>({dies:w.dies,testSpecYield:w.statsSummary?.stats.testSpecYield,functionalYield:w.statsSummary?.stats.functionalYield}))})),i,g);if(!b.rows.length)continue;const x=b.rows.map(m=>[$(m.label),...m.byGroup.map(w=>w.passRatePercent===null?"\u2014":`${w.passRatePercent.toFixed(1)}%`),m.overall.passRatePercent===null?"\u2014":`${m.overall.passRatePercent.toFixed(1)}%`]),d=g==="spec"?"Pass rate \xB7 test limits":g==="testFlag"?"Pass rate \xB7 tester flag":"Pass rate \xB7 functional";b.disagreementDies&&(p=b.disagreementDies),v.push(`<h4 class="report-subheading">${$(d)}</h4>`+P(["Test",...b.groups,"All"],x,{className:"compact"}))}p&&v.push(`<p class="report-note">${p.toLocaleString()} dies judged differently by limits and tester flag.</p>`),a.push(`<h3 class="report-subheading">${$(c.label)}</h3>${v.join(`
26
+ `)}`)}if(!a.length)return"";const l=r.length>t.length?`<p class="report-note">${r.length-t.length} further splittable field(s) not shown.</p>`:"";return D("Split Comparison",a.join(`
27
+ `)+l)}function Bt(e,i,o,s,r,t){const a=Ie(r);return["hard","soft"].map(l=>de(lt(s,e,l),l==="hard"?i:o,l,a[l],t[l])).join(`
28
+ `)}function ye(e,i,o,s,r,t){const a=Ge(o,s,r,c=>t[c],i);if(!a.length)return"";const l=se(a).rows.map(c=>[$(c.label),M(c.yieldPercent,`${c.yieldPercent.toFixed(1)}%`),G(c.delta)]);return D(e,P(["Region","Yield","vs lot"],l,{className:"compact"})+`<p class="report-legend">${A("the lot")}</p>`)}function Ct(e,i,o,s,r,t){let a;if(s?.length&&s.every(c=>c.stats.perTestStats!==void 0)){const c=new Map;for(const u of s)for(const n of u.stats.perTestStats??[]){const f=c.get(n.testNumber)??{n:0,sum:0,min:1/0,max:-1/0,parts:[]};f.n+=n.count,f.sum+=n.mean*n.count,f.min=Math.min(f.min,n.min),f.max=Math.max(f.max,n.max),f.parts.push({n:n.count,mean:n.mean,sd:n.stddev}),c.set(n.testNumber,f)}a=[...c.entries()].map(([u,n])=>{const f=n.sum/n.n,S=n.parts.every(y=>y.sd!==void 0),v=S&&n.n>1?n.parts.reduce((y,p)=>y+Math.max(0,p.n-1)*p.sd**2+p.n*(p.mean-f)**2,0)/(n.n-1):S?0:void 0;return{testNumber:u,count:n.n,min:n.min,max:n.max,mean:f,...v!==void 0?{stddev:Math.sqrt(v)}:{}}})}const l=a?void 0:[...wt(st(e,o)).stats].map(([c,u])=>({testNumber:c,...u}));return fe(i,o,a??l,r,a?"Quartiles are not shown for a lot: they cannot be combined from each wafer\u2019s own.":void 0,t)}function Yt(e,i,o,s){const r=tt(o);return me(e,i,r,s)}const _=["lot","product","testProgram","temperature"];function Nt(e){const i=new Map(_.map(t=>[t,new Set]));for(const t of e)for(const a of _){const l=t.wafer?.metadata?.[a];l!=null&&l!==""&&i.get(a).add(String(l))}const o=_.filter(t=>i.get(t).size>1);if(o.length===0)return[{label:"",items:e,varying:o}];const s=new Map,r=[];for(const t of e){const a=o.map(l=>String(t.wafer?.metadata?.[l]??"(none)")).join(" \xB7 ");s.has(a)||(s.set(a,[]),r.push(a)),s.get(a).push(t)}return r.map(t=>({label:t,items:s.get(t),varying:o}))}function Se(e,i,o,s,r,t,a,l,c="",u=!1){const n=ze(e.map(h=>h.source??h),{perWaferSummaries:e.map(h=>h.statsSummary),...a}),f=[],S=[],v=[],y=[];for(const h of e){const C=h.dies??[];h.wafer&&(f.push(h.wafer),v.push(C),y.push(E(h,r)));for(const T of C)S.push(T)}const p=e.map(h=>({dies:h.dies??[],passBins:E(h,r)})),g=l??ke(p,{hbinDefs:i,sbinDefs:o}).colors,b=S.some(h=>h.hbin!=null),x=S.some(h=>h.sbin!=null),d=b||x,m=n.perWafer.map(h=>h.summary.stats.yieldPercent).filter(h=>h!==null),w=m.length?m.reduce((h,C)=>h+C,0)/m.length:null;let F=0,B=0,N=0,R=0,W=0;for(const h of p){const C=new Set(h.passBins);for(const T of h.dies){if(F++,T.edgeExcluded&&R++,T.partial&&W++,T.partial||T.edgeExcluded)continue;const J=ae(T,C);J!==void 0&&(B++,J&&N++)}}const $e=B-N,Q=B>0?N/B*100:null,ve=[{label:"Wafers",value:String(n.stats.waferCount)},{label:"Total dies",value:String(F)},...d?[{label:"Good dies",value:String(N)},{label:"Bad dies",value:String($e)}]:[],...R>0?[{label:"Edge excluded",value:String(R)}]:[],...W>0?[{label:"Partial dies",value:String(W)}]:[],...w!==null?[{label:dt,value:`${w.toFixed(1)}%`}]:[],...Q!==null?[{label:"Total yield",value:`${Q.toFixed(1)}%`}]:[]],xe=ne(n.perWafer.map(h=>h.summary.wafer)),De=D(xe.lotId!==void 0?"Lot Summary":"Summary",le(ve)),Pe=re(e.map(h=>({metadata:h.wafer?.metadata}))),Fe=D("Per-Wafer Yield",Dt(n,e)),V=t??je(e[0]),Te=Tt(e,s,r),L=n.perWafer.map(h=>h.summary),Be=d?Bt(S,i,o,L,p,g):"",Ce=d&&f.length?ye("Ring Yield (All Wafers)",ee,v,f,V,y):"",Ye=d&&f.length?ye("Quadrant Yield (All Wafers)",te,v,f,V,y):"",U=s.length?Ct(e,S,s,L,n.stats.testSpecYield,z(c)):"",K=s.length?Yt(S,s,L,O(c)):"",Ne=s.length?pe(e,s):"",Me=n.findings.length?ge(n.findings,n.stats.waferCount,c,u):"",Re=Pt(n),We=[De,he(n,He(p.map(h=>h.passBins)),c,be(s,c,!!U,!!K)),Pe,Fe,Te,Be,Ce,Ye,U,K,Ne,Me,Re].filter(Boolean).join(`
29
+ `);return{lotSummary:n,sections:We}}function we(e,i,o,s=""){return`<main class="report">
30
30
  <header class="report-header">
31
- <h1>${S(t)}</h1>
32
- <p class="report-subtitle">Generated ${S(i)}</p>
31
+ <h1>${$(e)}</h1>
32
+ <p class="report-subtitle">Generated ${$(o)}</p>
33
33
  </header>
34
- ${te(a,n)}
35
- <p class="footer">Generated ${S(i)}</p>
36
- </main>`}export function renderLotSummaryReportHtml(t,a={}){const{items:i,hbinDefs:n,sbinDefs:r,testDefs:e=[],passBins:c,ringCount:s,analyzeOptions:d}=t,m=new Date().toLocaleString(),o=xt(i);if(o.length===1){const{lotSummary:y,sections:l}=me(o[0].items,n,r,e,c,s,d,t.binColors,"",t.live),u=J(y.perWafer.map($=>$.summary.wafer)),h=a.title??(u.lotId!==void 0?`Lot Summary \u2014 ${u.lotId}`:`Summary \u2014 ${Ue(u)}`);return`<!DOCTYPE html>
34
+ ${oe(i,s)}
35
+ <p class="footer">Generated ${$(o)}</p>
36
+ </main>`}export function renderLotSummaryReportHtml(e,i={}){const{items:o,hbinDefs:s,sbinDefs:r,testDefs:t=[],passBins:a,ringCount:l,analyzeOptions:c}=e,u=new Date().toLocaleString(),n=Nt(o);if(n.length===1){const{lotSummary:p,sections:g}=Se(n[0].items,s,r,t,a,l,c,e.binColors,"",e.live),b=ne(p.perWafer.map(d=>d.summary.wafer)),x=i.title??(b.lotId!==void 0?`Lot Summary \u2014 ${b.lotId}`:`Summary \u2014 ${Xe(b)}`);return`<!DOCTYPE html>
37
37
  <html lang="en">
38
38
  <head>
39
39
  <meta charset="UTF-8">
40
- <title>${S(h)}</title>
40
+ <title>${$(x)}</title>
41
41
  <style>
42
- ${j()}
42
+ ${q()}
43
43
  </style>
44
44
  </head>
45
45
  <body>
46
- ${pe(h,l,m)}
47
- ${t.live?k:""}
46
+ ${we(x,g,u)}
47
+ ${j(e.live)}
48
48
  </body>
49
- </html>`}const p=a.title??"Summary",g=o.map((y,l)=>{const u=`g${l+1}-`,{lotSummary:h,sections:$}=me(y.items,n,r,e,c,s,d,t.binColors,u,t.live),v=y.varying.includes("lot")?void 0:h.lot?.lot??h.lot?.lotId,x=v?`${y.label} \xB7 Lot ${String(v)}`:y.label;return pe(`${p} \u2014 ${x}`,$,m,u)}),b=`<p style="max-width:1080px;margin:0 auto 8px;padding:8px 12px;background:var(--report-surface);border:1px solid var(--report-line);border-radius:4px;font-size:12px;color:var(--report-muted);">This load spans ${o.length} groups by identity \u2014 shown separately below so stats are never pooled across them.</p>`,w=g.map((y,l)=>`${l===0?"":'<hr style="max-width:1080px;margin:32px auto 0;border:none;border-top:3px solid var(--report-line-strong);">'}
50
- ${y}`).join(`
49
+ </html>`}const f=i.title??"Summary",S=n.map((p,g)=>{const b=`g${g+1}-`,{lotSummary:x,sections:d}=Se(p.items,s,r,t,a,l,c,e.binColors,b,e.live),m=p.varying.includes("lot")?void 0:x.lot?.lot??x.lot?.lotId,w=m?`${p.label} \xB7 Lot ${String(m)}`:p.label;return we(`${f} \u2014 ${w}`,d,u,b)}),v=`<p style="max-width:1080px;margin:0 auto 8px;padding:8px 12px;background:var(--report-surface);border:1px solid var(--report-line);border-radius:4px;font-size:12px;color:var(--report-muted);">This load spans ${n.length} groups by identity \u2014 shown separately below so stats are never pooled across them.</p>`,y=S.map((p,g)=>`${g===0?"":'<hr style="max-width:1080px;margin:32px auto 0;border:none;border-top:3px solid var(--report-line-strong);">'}
50
+ ${p}`).join(`
51
51
  `);return`<!DOCTYPE html>
52
52
  <html lang="en">
53
53
  <head>
54
54
  <meta charset="UTF-8">
55
- <title>${S(p)}</title>
55
+ <title>${$(f)}</title>
56
56
  <style>
57
- ${j()}
57
+ ${q()}
58
58
  </style>
59
59
  </head>
60
60
  <body>
61
61
  <div class="report" style="padding-top:24px;">
62
- ${b}
62
+ ${v}
63
63
  </div>
64
- ${w}
65
- ${t.live?k:""}
64
+ ${y}
65
+ ${j(e.live)}
66
66
  </body>
67
- </html>`}export{je as openHtmlReport};export function renderWaferReportHtml(t,a,i={}){return renderSummaryReportHtml({wafer:t.wafer,dies:t.dies,yieldSummary:t.yield,dataCoverage:t.dataCoverage,hbinDefs:t.hbinDefs,sbinDefs:t.sbinDefs,testDefs:t.testDefs,statsSummary:a??t.statsSummary??(V(t)?ze(t):void 0),passBins:[...t.passBins],ringCount:t.ringCount,binColors:i.binColors,live:i.live},i)}export function renderLotReportHtml(t,a={}){const i=Q(t.map(e=>e.hbinDefs)),n=Q(t.map(e=>e.sbinDefs)),r=t.some(e=>e.testDefs?.length)?Ge([...t]).defs:void 0;return renderLotSummaryReportHtml({items:t.map((e,c)=>({label:_(e,c),wafer:e.wafer,dies:e.dies,passBins:[...e.passBins],statsSummary:e.statsSummary,source:V(e)?e:void 0})),hbinDefs:i.length?i:void 0,sbinDefs:n.length?n:void 0,testDefs:r,ringCount:t[0]?.ringCount,analyzeOptions:a.analyzeOptions,binColors:a.binColors,live:a.live},{title:a.title})}
67
+ </html>`}export{qe as openHtmlReport};export function renderWaferReportHtml(e,i,o={}){return renderSummaryReportHtml({wafer:e.wafer,dies:e.dies,yieldSummary:e.yield,dataCoverage:e.dataCoverage,hbinDefs:e.hbinDefs,sbinDefs:e.sbinDefs,testDefs:e.testDefs,statsSummary:i??e.statsSummary??(Z(e)?_e(e):void 0),passBins:[...e.passBins],ringCount:e.ringCount,binColors:o.binColors,live:o.live},o)}export function renderLotReportHtml(e,i={}){const o=X(e.map(t=>t.hbinDefs)),s=X(e.map(t=>t.sbinDefs)),r=e.some(t=>t.testDefs?.length)?Qe([...e]).defs:void 0;return renderLotSummaryReportHtml({items:e.map((t,a)=>({label:I(t,a),wafer:t.wafer,dies:t.dies,passBins:[...t.passBins],statsSummary:t.statsSummary,source:Z(t)?t:void 0})),hbinDefs:o.length?o:void 0,sbinDefs:s.length?s:void 0,testDefs:r,ringCount:e[0]?.ringCount,analyzeOptions:i.analyzeOptions,binColors:i.binColors,live:i.live},{title:i.title})}
@@ -1,5 +1,5 @@
1
1
  import type { StatsFinding, StatsSeverity } from './types.js';
2
- import { type Synthesis } from './synthesis.js';
2
+ import { type Synthesis, type SynthesisTarget } from './synthesis.js';
3
3
  import { type MeterTier } from './presentation.js';
4
4
  export type { MeterTier };
5
5
  import { type FacetItem } from './facets.js';
@@ -8,7 +8,7 @@ export interface MetricItem {
8
8
  value: string;
9
9
  hint?: string;
10
10
  }
11
- export declare function renderSection(title: string, body: string, className?: string): string;
11
+ export declare function renderSection(title: string, body: string, className?: string, id?: string): string;
12
12
  export declare function renderDefinitionList(entries: Array<{
13
13
  label: string;
14
14
  value: string;
@@ -52,9 +52,10 @@ export declare function renderMeter(tier: MeterTier, word: string): string;
52
52
  export declare function renderSeverityMeter(severity: StatsSeverity): string;
53
53
  export declare const severityTier: (severity: StatsSeverity) => MeterTier;
54
54
  /**
55
- * A value with a bar behind it, for scanning a column of yields or shares. The figure is always
55
+ * A value with a bar beside it, for scanning a column of yields or shares. The figure is always
56
56
  * printed; the bar is a second way to read it, scaled 0–100 (so a yield bar is never stretched
57
- * to its own column's range).
57
+ * to its own column's range). The figure sits beside the bar, never on it: a bar takes the bin's
58
+ * own colour, and no one ink reads on every colour a bin can have.
58
59
  */
59
60
  export declare function barCell(percent: number, text: string, className?: string, color?: string): TableCell;
60
61
  /** A signed difference in yield points, tinted by `shortfallStep` (only a shortfall of a point or more). */
@@ -92,23 +93,16 @@ export declare function derivedFindingsKeyHtml(findings: StatsFinding[]): string
92
93
  * finding ids can never share an anchor, and valid in an `id` attribute whatever the id holds.
93
94
  */
94
95
  export declare function findingAnchor(id: string, scope?: string): string;
95
- /**
96
- * `anchorScope`: give each row an `id` so the synthesis can link to it, prefixed so two summaries in
97
- * one document cannot share one. Only for the page's one table per summary — a per-wafer table
98
- * repeats ids that another wafer's table also carries — so it is left out there.
99
- */
100
96
  export declare function findingsTableHtml(findings: StatsFinding[], totalWafers?: number, anchorScope?: string, live?: boolean): string;
101
97
  /**
102
- * The synthesis as a section: the headline, the loss items each linked to the finding rows that
103
- * carry their figures, and what was compared. A part links only when its row is on the page
104
- * (`anchorIds`), so a sentence never points at nothing.
105
- */
106
- export declare function synthesisSectionHtml(synthesis: Synthesis, anchorIds: ReadonlySet<string>, scope?: string): string;
107
- /**
108
- * For a report shown inside the app (the panel's modal): a click on a finding's row tells the page that
109
- * holds the report, which selects that finding on the map. Inert when the report is opened on its own
110
- * (no parent window) or where scripts are blocked, and the rows stay a plain table either way.
98
+ * The synthesis as a section: the headline, the items, and what was compared. Every item links to its
99
+ * evidence the same way — the lead by a "See" line naming its target and its parts, each further item and
100
+ * Watch line by its own text — wherever `anchorFor` finds that evidence on the page, so a link never points
101
+ * at nothing and no item is linked only because of where its figures came from.
111
102
  */
103
+ export declare function synthesisSectionHtml(synthesis: Synthesis, anchorFor: (target: SynthesisTarget) => string | undefined): string;
104
+ /** The scripts at the foot of every report document: in-page links, and for a `live` report the finding clicks. */
105
+ export declare function reportScripts(live: boolean | undefined): string;
112
106
  export declare const LIVE_FINDINGS_SCRIPT = "<script>\ndocument.addEventListener('click', function (e) {\n var row = e.target.closest && e.target.closest('[data-finding]');\n if (row && window.parent !== window) window.parent.postMessage({ wmapFinding: row.getAttribute('data-finding') }, '*');\n});\n</script>";
113
107
  export declare function formatFindingCoverage(finding: Pick<StatsFinding, 'stats'>, total?: number): string;
114
108
  export declare function reportStyles(): string;
@@ -1,28 +1,28 @@
1
- import{SYNTHESIS_SMALLER_HEADING as f,synthesisRowShare as u}from"./synthesis.js";import{formatFindingTooltip as x}from"./findingText.js";import{arrangeFindings as v}from"./filterFindings.js";import{SEVERITY_MARK as h,METER_DOTS as $,filledDots as w,impactWord as y,impactShortWord as k,shortfallColor as g,shortfallStep as S,formatPoints as z,barPercent as M}from"./presentation.js";import{fmt as b,plainBinTerms as j}from"../renderer/fmt.js";import{buildFacetTable as T,attributeLabel as F}from"./facets.js";import{escHtml as a}from"../core/utils.js";import{derivedKeyText as N,derivedFields as A}from"../renderer/testLabel.js";export function renderSection(t,e,r=""){return`<section class="${["report-section",r].filter(Boolean).join(" ")}">
2
- <h2>${a(t)}</h2>
3
- ${e}
4
- </section>`}export function renderDefinitionList(t,e="meta-list"){if(!t.length)return"";const r=t.map(o=>`<div class="definition-item"><dt>${a(o.label)}</dt><dd>${a(o.value)}</dd></div>`).join(`
5
- `);return`<dl class="${e}">
6
- ${r}
7
- </dl>`}export function buildMetadataRows(t){return T(t,{facetableOnly:t.length>1}).map(r=>({label:F(r.key),value:r.values.map(o=>o.value).join(", ")}))}export function renderMetadataSection(t){const e=buildMetadataRows(t);return e.length?renderSection("Wafer Info",renderDefinitionList(e)):""}export function renderMetricGrid(t){return t.length?`<dl class="metric-grid">
8
- ${t.map(r=>`<div class="metric">
9
- <dt>${a(r.label)}</dt>
10
- <dd>${a(r.value)}</dd>
11
- ${r.hint?`<span class="metric-hint">${a(r.hint)}</span>`:""}
1
+ import{SYNTHESIS_ALSO_HEADING as v,synthesisMoreTests as w,synthesisRowShare as $}from"./synthesis.js";import{formatFindingTooltip as y,findingMetricLabel as k,isProportionFinding as S}from"./findingText.js";import{arrangeFindings as z}from"./filterFindings.js";import{SEVERITY_MARK as b,METER_DOTS as j,filledDots as T,impactWord as N,impactShortWord as I,shortfallColor as h,shortfallStep as M,formatPoints as F,barPercent as A}from"./presentation.js";import{fmt as f,plainBinTerms as E}from"../renderer/fmt.js";import{buildFacetTable as L,attributeLabel as D}from"./facets.js";import{escHtml as o}from"../core/utils.js";import{derivedKeyText as _,derivedFields as R}from"../renderer/testLabel.js";export function renderSection(e,r,t="",a){return`<section class="${["report-section",t].filter(Boolean).join(" ")}"${a?` id="${o(a)}"`:""}>
2
+ <h2>${o(e)}</h2>
3
+ ${r}
4
+ </section>`}export function renderDefinitionList(e,r="meta-list"){if(!e.length)return"";const t=e.map(a=>`<div class="definition-item"><dt>${o(a.label)}</dt><dd>${o(a.value)}</dd></div>`).join(`
5
+ `);return`<dl class="${r}">
6
+ ${t}
7
+ </dl>`}export function buildMetadataRows(e){return L(e,{facetableOnly:e.length>1}).map(t=>({label:D(t.key),value:t.values.map(a=>a.value).join(", ")}))}export function renderMetadataSection(e){const r=buildMetadataRows(e);return r.length?renderSection("Wafer Info",renderDefinitionList(r)):""}export function renderMetricGrid(e){return e.length?`<dl class="metric-grid">
8
+ ${e.map(t=>`<div class="metric">
9
+ <dt>${o(t.label)}</dt>
10
+ <dd>${o(t.value)}</dd>
11
+ ${t.hint?`<span class="metric-hint">${o(t.hint)}</span>`:""}
12
12
  </div>`).join(`
13
13
  `)}
14
- </dl>`:""}export function renderTable(t,e,r={}){if(!e.length)return`<p class="no-data">${a(r.emptyMessage??"No data")}</p>`;const o=["report-table",r.className].filter(Boolean).join(" "),s=t.map(n=>`<th>${a(n)}</th>`).join(""),m=n=>typeof n=="string"?`<td>${n}</td>`:`<td${n.className?` class="${n.className}"`:""}>${n.html}</td>`,l=e.map(n=>`<tr>${n.map(m).join("")}</tr>`).join(`
15
- `);return`<table class="${o}">
16
- <thead><tr>${s}</tr></thead>
17
- <tbody>${l}</tbody>
18
- </table>`}export function renderMeter(t,e){const r=w(t);return`<span class="meter"><span class="meter-dots" aria-hidden="true">${"\u25CF".repeat(r)}${"\u25CB".repeat($-r)}</span><span class="meter-word">${a(e)}</span></span>`}export function renderSeverityMeter(t){const{tier:e,word:r}=h[t];return renderMeter(e,r)}export const severityTier=t=>h[t].tier;export function barCell(t,e,r="",o){const s=o?`;background:${a(o)}`:"";return{html:`<span class="cellbar"><i style="width:${M(t).toFixed(1)}%${s}"></i><span>${a(e)}</span></span>`,className:["barcell",r].filter(Boolean).join(" ")}}export function deltaCell(t){const e=S(t);return{html:a(z(t)),className:["numeric",e?`low-${e}`:""].filter(Boolean).join(" ")}}export function withSectionNav(t,e=""){const r=[];let o=0;const s=t.replace(/<section class="(report-section[^"]*)">(\s*<h2>)(.*?)(<\/h2>)/g,(l,n,i,p,d)=>{const c=`sec-${e}${++o}`;return r.push({id:c,title:p}),`<section class="${n}" id="${c}">${i}${p}${d}`});return r.length<4?t:`<nav class="report-toc" aria-label="Sections">${r.map(l=>`<a href="#${l.id}">${l.title}</a>`).join("")}</nav>
19
- ${s}`}export function formatFindingDelta(t){const e=t.effect.absoluteDelta??0,r=e>0?"+":e<0?"\u2212":"";if(t.variable.kind==="yield"||t.variable.kind==="hardBin"||t.variable.kind==="softBin")return`${r}${Math.abs(e*100).toFixed(1)} pp`;if(t.variable.kind==="test"){if(t.effect.relativeDelta!==void 0&&Number.isFinite(t.effect.relativeDelta)){const o=Math.abs(t.effect.relativeDelta*100).toFixed(1);return`${r}${o}%`}return`${r}${b(Math.abs(e),t.variable.unit)}`}return`${r}${b(Math.abs(e),t.variable.unit)}`}export function derivedFindingsKeyHtml(t){const e=N(t.map(r=>({label:r.variable.label,...A(r.variable)})));return e?`<p class="report-note">${a(e)}</p>`:""}export function findingAnchor(t,e=""){return`finding-${e}`+t.replace(/[^A-Za-z0-9]/g,r=>`_${r.charCodeAt(0).toString(16)}_`)}export function findingsTableHtml(t,e,r,o=!1){const s=v(t),m=[...s.patterns.flatMap(i=>[{f:i.finding,nested:!1},...i.children.map(p=>({f:p,nested:!0}))]),...s.groups.flatMap(i=>i.findings.map(p=>({f:p,nested:!1})))],l=m.length?m.map(({f:i,nested:p})=>`<tr class="tier-${severityTier(i.severity)}${p?" nested":""}${o?" live":""}"${r!==void 0?` id="${findingAnchor(i.id,r)}"`:""}${o?` data-finding="${a(i.id)}"`:""} title="${a(x(i))}${o?`
14
+ </dl>`:""}export function renderTable(e,r,t={}){if(!r.length)return`<p class="no-data">${o(t.emptyMessage??"No data")}</p>`;const a=["report-table",t.className].filter(Boolean).join(" "),l=e.map(s=>`<th>${o(s)}</th>`).join(""),c=s=>typeof s=="string"?`<td>${s}</td>`:`<td${s.className?` class="${s.className}"`:""}>${s.html}</td>`,p=r.map(s=>`<tr>${s.map(c).join("")}</tr>`).join(`
15
+ `);return`<table class="${a}">
16
+ <thead><tr>${l}</tr></thead>
17
+ <tbody>${p}</tbody>
18
+ </table>`}export function renderMeter(e,r){const t=T(e);return`<span class="meter"><span class="meter-dots" aria-hidden="true">${"\u25CF".repeat(t)}${"\u25CB".repeat(j-t)}</span><span class="meter-word">${o(r)}</span></span>`}export function renderSeverityMeter(e){const{tier:r,word:t}=b[e];return renderMeter(r,t)}export const severityTier=e=>b[e].tier;export function barCell(e,r,t="",a){const l=a?`;background:${o(a)}`:"";return{html:`<span class="cellbar"><span class="cellbar-value">${o(r)}</span><span class="cellbar-track" aria-hidden="true"><i style="width:${A(e).toFixed(1)}%${l}"></i></span></span>`,className:["barcell",t].filter(Boolean).join(" ")}}export function deltaCell(e){const r=M(e);return{html:o(F(e)),className:["numeric",r?`low-${r}`:""].filter(Boolean).join(" ")}}export function withSectionNav(e,r=""){const t=[];let a=0;const l=e.replace(/<section class="(report-section[^"]*)"(?: id="([^"]*)")?>(\s*<h2>)(.*?)(<\/h2>)/g,(p,s,n,d,m,i)=>{++a;const g=n??`sec-${r}${a}`;return t.push({id:g,title:m}),`<section class="${s}" id="${g}">${d}${m}${i}`});return t.length<4?e:`<nav class="report-toc" aria-label="Sections">${t.map(p=>`<a href="#${p.id}">${p.title}</a>`).join("")}</nav>
19
+ ${l}`}export function formatFindingDelta(e){if(e.variable.kind==="spatialPattern")return"\u2014";const r=e.effect.absoluteDelta??0,t=r>0?"+":r<0?"\u2212":"";if(S(e))return`${t}${Math.abs(r*100).toFixed(1)} pp`;if(e.variable.kind==="test"){if(e.effect.relativeDelta!==void 0&&Number.isFinite(e.effect.relativeDelta)){const a=Math.abs(e.effect.relativeDelta*100).toFixed(1);return`${t}${a}%`}return`${t}${f(Math.abs(r),e.variable.unit)}`}return`${t}${f(Math.abs(r),e.variable.unit)}`}export function derivedFindingsKeyHtml(e){const r=_(e.map(t=>({label:t.variable.label,...R(t.variable)})));return r?`<p class="report-note">${o(r)}</p>`:""}export function findingAnchor(e,r=""){return`finding-${r}`+e.replace(/[^A-Za-z0-9]/g,t=>`_${t.charCodeAt(0).toString(16)}_`)}const B="Indented rows are the findings a pattern explains, most severe first. The other findings follow, grouped by region, most severe first.";export function findingsTableHtml(e,r,t,a=!1){const l=z(e),c=[...l.patterns.flatMap(n=>[{f:n.finding,nested:!1},...n.children.map(d=>({f:d,nested:!0}))]),...l.groups.flatMap(n=>n.findings.map(d=>({f:d,nested:!1})))],p=c.length?c.map(({f:n,nested:d})=>`<tr class="tier-${severityTier(n.severity)}${d?" nested":""}${a?" live":""}"${t!==void 0?` id="${findingAnchor(n.id,t)}"`:""}${a?` data-finding="${o(n.id)}"`:""} title="${o(y(n))}${a?`
20
20
  Click to show it on the map`:""}">
21
- <td class="tight">${renderSeverityMeter(i.severity)}</td>
22
- <td class="tight">${a(i.comparison.left)}</td>
23
- <td>${a(j(i.variable.label))}</td>
24
- <td class="numeric">${a(formatFindingDelta(i))}</td>
25
- <td class="numeric">${a(formatFindingCoverage(i,e))}</td>
21
+ <td class="tight">${renderSeverityMeter(n.severity)}</td>
22
+ <td class="tight">${o(n.comparison.left)}</td>
23
+ <td>${o(E(k(n)))}</td>
24
+ <td class="numeric">${o(formatFindingDelta(n))}</td>
25
+ <td class="numeric">${o(formatFindingCoverage(n,r))}</td>
26
26
  </tr>`).join(`
27
27
  `):'<tr><td colspan="5" class="no-data">No significant findings</td></tr>';return`<table class="report-table findings-table compact">
28
28
  <thead>
@@ -31,33 +31,79 @@ Click to show it on the map`:""}">
31
31
  <th>Region</th>
32
32
  <th>Metric</th>
33
33
  <th class="numeric">Delta</th>
34
- <th class="numeric">${e!==void 0?"Wafers":"N (region/rest)"}</th>
34
+ <th class="numeric">${r!==void 0?"Wafers":"N (region/rest)"}</th>
35
35
  </tr>
36
36
  </thead>
37
37
  <tbody>
38
- ${l}
38
+ ${p}
39
39
  </tbody>
40
- </table>${derivedFindingsKeyHtml(t)}`}export function synthesisSectionHtml(t,e,r=""){const o=d=>d.map(c=>c.target&&e.has(c.target.id)?`<a href="#${findingAnchor(c.target.id,r)}">${a(c.text)}</a>`:a(c.text)).join(""),[s,...m]=t.items,l=[...m,...t.also?.items??[]],n=t.also?.more??0,i=s?`<ol class="synthesis-items">
41
- <li class="tier-${s.impact}">${renderMeter(s.impact,y(s.impact))}<span>${o(s.parts)}</span></li>
42
- </ol>`:`<p class="synthesis-none">${a(t.nothing??"Nothing stands out.")}</p>`,p=l.length?`<p class="synthesis-smaller">${a(f)}</p>
40
+ </table>${l.patterns.length?`<p class="report-note">${o(B)}</p>`:""}${derivedFindingsKeyHtml(e)}`}export function synthesisSectionHtml(e,r){const t=(i,g)=>{const u=r(g);return u?`<a href="#${o(u)}">${o(i)}</a>`:o(i)},[a,...l]=e.items,c=[...l,...e.also?.items??[]],p=e.also?.more??0,s=a?[t(a.subject,a.target),...a.chips.map(i=>t(i.label,i.target))]:[],n=a&&w(a);n&&s.push(o(n));const d=a?`<ol class="synthesis-items">
41
+ <li class="tier-${a.impact}">${renderMeter(a.impact,N(a.impact))}<span>${o(a.text)}<span class="synthesis-see">See: ${s.join(" \xB7 ")}</span></span></li>
42
+ </ol>`:`<p class="synthesis-none">${o(e.nothing??"Nothing stands out.")}</p>`,m=c.length?`<p class="synthesis-smaller">${o(v)}</p>
43
43
  <ul class="synthesis-more">
44
- ${l.map(d=>`<li>${renderMeter(d.impact,k(d.impact))}<span>${o([d.brief])}</span><span class="synthesis-share">${a(u(d))}</span></li>`).join(`
45
- `)}${n?`
46
- <li class="synthesis-rest"><span></span><span>and ${n} more</span><span></span></li>`:""}
47
- </ul>`:"";return renderSection("What stands out",`<p class="synthesis-headline">${o(t.headline)}</p>
48
- ${i}
49
- ${p}
50
- ${t.watch?`<ul class="synthesis-watch">${t.watch.map(d=>`<li><strong>Watch</strong> ${o(d.parts)}</li>`).join("")}</ul>`:""}
51
- <p class="synthesis-checked">${a(t.checked)}</p>`,"synthesis")}export const LIVE_FINDINGS_SCRIPT=`<script>
44
+ ${c.map(i=>`<li>${renderMeter(i.impact,I(i.impact))}<span>${t(i.brief,i.target)}</span><span class="synthesis-share">${o($(i))}</span></li>`).join(`
45
+ `)}${p?`
46
+ <li class="synthesis-rest"><span></span><span>and ${p} more</span><span></span></li>`:""}
47
+ </ul>`:"";return renderSection("What stands out",`<p class="synthesis-headline">${o(e.headline)}</p>
48
+ ${d}
49
+ ${m}
50
+ ${e.watch?`<ul class="synthesis-watch">${e.watch.map(i=>`<li><strong>Watch</strong> ${t(i.text,i.target)}</li>`).join("")}</ul>`:""}
51
+ <p class="synthesis-checked">${o(e.checked)}</p>`,"synthesis")}const x=`<script>
52
+ (function () {
53
+ var embedded = location.href === 'about:srcdoc';
54
+ var stack = [];
55
+ var btn = document.createElement('button');
56
+ btn.type = 'button';
57
+ btn.className = 'report-back';
58
+ btn.textContent = '\u2190 Back';
59
+ btn.title = 'Back to where you were (Alt+\u2190)';
60
+ btn.hidden = true;
61
+ document.body.appendChild(btn);
62
+ function restore() {
63
+ var from = stack.pop();
64
+ if (!from) return;
65
+ window.scrollTo(0, from.y);
66
+ if (from.link) from.link.focus({ preventScroll: true });
67
+ btn.hidden = stack.length === 0;
68
+ }
69
+ function goBack() { if (stack.length) { if (embedded) restore(); else history.back(); } }
70
+ document.addEventListener('click', function (e) {
71
+ var a = e.target.closest && e.target.closest('a[href^="#"]');
72
+ if (!a) return;
73
+ var id = decodeURIComponent(a.getAttribute('href').slice(1));
74
+ var target = document.getElementById(id);
75
+ if (!target) return;
76
+ e.preventDefault();
77
+ stack.push({ y: window.scrollY, link: a });
78
+ if (!embedded) history.pushState({ wmapReportJump: stack.length }, '', '#' + id);
79
+ target.scrollIntoView({ block: 'start' });
80
+ if (!target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');
81
+ target.focus({ preventScroll: true });
82
+ // Marked for a moment: near the end of the page the target cannot reach the top, and
83
+ // without the mark nothing says which row the link meant.
84
+ target.classList.remove('report-jumped');
85
+ void target.offsetWidth;
86
+ target.classList.add('report-jumped');
87
+ btn.hidden = false;
88
+ });
89
+ btn.addEventListener('click', goBack);
90
+ document.addEventListener('keydown', function (e) {
91
+ if (e.altKey && e.key === 'ArrowLeft' && stack.length) { e.preventDefault(); goBack(); }
92
+ });
93
+ window.addEventListener('popstate', function () { if (stack.length) restore(); });
94
+ })();
95
+ <\/script>`;export function reportScripts(e){return e?`${x}
96
+ ${LIVE_FINDINGS_SCRIPT}`:x}export const LIVE_FINDINGS_SCRIPT=`<script>
52
97
  document.addEventListener('click', function (e) {
53
98
  var row = e.target.closest && e.target.closest('[data-finding]');
54
99
  if (row && window.parent !== window) window.parent.postMessage({ wmapFinding: row.getAttribute('data-finding') }, '*');
55
100
  });
56
- <\/script>`;export function formatFindingCoverage(t,e){return e!==void 0?`${t.stats.sampleSizeLeft}/${e}`:`${t.stats.sampleSizeLeft}/${t.stats.sampleSizeRight}`}export function reportStyles(){return`
101
+ <\/script>`;export function formatFindingCoverage(e,r){return r!==void 0?`${e.stats.sampleSizeLeft}/${r}`:`${e.stats.sampleSizeLeft}/${e.stats.sampleSizeRight}`}export function reportStyles(){return`
57
102
  :root {
58
103
  --report-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
59
104
  --report-text: #1f2328;
60
105
  --report-muted: #5c6570;
106
+ --report-link: #0b5cad;
61
107
  --report-subtle: #7a828d;
62
108
  --report-line: #d8dee6;
63
109
  --report-line-strong: #c7ced8;
@@ -71,9 +117,9 @@ document.addEventListener('click', function (e) {
71
117
  --report-tier-medium-edge: #a8741a;
72
118
  --report-tier-low-bg: #edf2f7;
73
119
  --report-tier-low-edge: #5f7f9f;
74
- --report-low-1: ${g(1)};
75
- --report-low-2: ${g(2)};
76
- --report-low-3: ${g(3)};
120
+ --report-low-1: ${h(1)};
121
+ --report-low-2: ${h(2)};
122
+ --report-low-3: ${h(3)};
77
123
  --report-bar: #9db8d3;
78
124
  }
79
125
 
@@ -145,7 +191,8 @@ document.addEventListener('click', function (e) {
145
191
  .synthesis-watch li { margin: 0 0 3px; }
146
192
  .synthesis-watch strong { margin-right: 6px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--report-muted); }
147
193
  .synthesis-checked, .synthesis-none { color: var(--report-muted); margin: 0; }
148
- .synthesis a { color: inherit; text-decoration: underline dotted; }
194
+ .synthesis a { color: var(--report-link); text-decoration: underline; text-underline-offset: 2px; }
195
+ .synthesis-see { display: block; margin-top: 4px; color: var(--report-muted); }
149
196
 
150
197
  .report-subheading {
151
198
  margin: 14px 0 6px;
@@ -334,19 +381,35 @@ document.addEventListener('click', function (e) {
334
381
  .report-toc a { color: var(--report-muted); text-decoration: none; }
335
382
  .report-toc a:hover { color: var(--report-text); text-decoration: underline; }
336
383
 
337
- /* The value is always printed; the bar behind it is for scanning a column. */
384
+ /* Shown after an in-page jump; returns to where the reader was. */
385
+ .report-back {
386
+ position: fixed; right: 16px; bottom: 16px; z-index: 10;
387
+ font: 600 13px var(--report-font); color: var(--report-link);
388
+ background: #fff; border: 1px solid var(--report-line-strong); border-radius: 4px;
389
+ padding: 6px 12px; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
390
+ }
391
+ .report-back:hover { background: var(--report-surface); }
392
+ .report-back:focus-visible { outline: 2px solid var(--report-link); outline-offset: 2px; }
393
+ .report-back[hidden] { display: none; }
394
+ [tabindex="-1"]:focus { outline: none; }
395
+ .report-jumped { animation: report-jumped 2s ease-out; }
396
+ @keyframes report-jumped {
397
+ 0%, 60% { outline: 2px solid var(--report-link); outline-offset: -2px; }
398
+ 100% { outline: 2px solid transparent; outline-offset: -2px; }
399
+ }
400
+ @media (prefers-reduced-motion: reduce) { .report-jumped { animation-duration: 0.01s; animation-delay: 1.5s; animation-fill-mode: backwards; } }
401
+
402
+ /* The value is always printed; the bar beside it is for scanning a column. */
338
403
  table.report-table td.barcell { min-width: 150px; }
339
- .cellbar { position: relative; display: block; }
404
+ .cellbar { display: flex; align-items: center; gap: 8px; }
405
+ .cellbar-value { flex: none; min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
406
+ .cellbar-track { flex: 1; height: 12px; }
340
407
  .cellbar i {
341
- position: absolute;
342
- left: 0;
343
- top: 50%;
344
- height: 12px;
345
- transform: translateY(-50%);
408
+ display: block;
409
+ height: 100%;
346
410
  background: var(--report-bar);
347
411
  border-radius: 0 2px 2px 0;
348
412
  }
349
- .cellbar span { position: relative; padding-left: 4px; }
350
413
 
351
414
  /* Shortfall below the reference, light to strong. Full ink on every tint (see the tier tokens). */
352
415
  table.report-table td.low-1 { background: var(--report-low-1); }
@@ -414,6 +477,7 @@ document.addEventListener('click', function (e) {
414
477
  }
415
478
 
416
479
  .report-toc { display: none; }
480
+ .report-back { display: none; }
417
481
 
418
482
  section.report-section,
419
483
  tr {