diff --git a/docs/chartRuntime.js b/docs/chartRuntime.js index 09bdea733..e54ca4ebd 100644 --- a/docs/chartRuntime.js +++ b/docs/chartRuntime.js @@ -1,4 +1,4 @@ -var CM=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var wM=CM((cm,B$)=>{B$.exports={"fig-deployment-mask":{ariaDescription:"A row of deployment steps on the left maps by index into bit positions in a uint256 mask on the right. Each step sets its bit only when code exists at that configured address.",ariaLabel:"Deployment mask maps ordered deployment steps to bits",height:220,nodes:[{children:[{attributes:{id:"arrow-deployment-mask",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-blue",x:"40",y:"42",width:"220",height:"42",rx:"8"},tag:"rect"},{attributes:{class:"svg-blue",x:"40",y:"94",width:"220",height:"42",rx:"8"},tag:"rect"},{attributes:{class:"svg-blue",x:"40",y:"146",width:"220",height:"42",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"150",y:"69","text-anchor":"middle"},children:[{text:"step 0"}],tag:"text"},{attributes:{class:"svg-label",x:"150",y:"121","text-anchor":"middle"},children:[{text:"step 1"}],tag:"text"},{attributes:{class:"svg-label",x:"150",y:"173","text-anchor":"middle"},children:[{text:"step 2"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deployment-mask)",d:"M 260 63 H 390"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deployment-mask)",d:"M 260 115 H 390"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deployment-mask)",d:"M 260 167 H 390"},tag:"path"},{attributes:{class:"svg-box",x:"390",y:"42",width:"470",height:"146",rx:"10"},tag:"rect"},{attributes:{class:"svg-gold",x:"420",y:"84",width:"90",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-gold",x:"530",y:"84",width:"90",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-gold",x:"640",y:"84",width:"90",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-box",x:"750",y:"84",width:"80",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"465",y:"110","text-anchor":"middle"},children:[{text:"bit 0"}],tag:"text"},{attributes:{class:"svg-label",x:"575",y:"110","text-anchor":"middle"},children:[{text:"bit 1"}],tag:"text"},{attributes:{class:"svg-label",x:"685",y:"110","text-anchor":"middle"},children:[{text:"bit 2"}],tag:"text"},{attributes:{class:"svg-label",x:"790",y:"110","text-anchor":"middle"},children:[{text:"..."}],tag:"text"},{attributes:{class:"svg-small",x:"465",y:"132","text-anchor":"middle"},children:[{text:"code?"}],tag:"text"},{attributes:{class:"svg-small",x:"575",y:"132","text-anchor":"middle"},children:[{text:"code?"}],tag:"text"},{attributes:{class:"svg-small",x:"685",y:"132","text-anchor":"middle"},children:[{text:"code?"}],tag:"text"},{attributes:{class:"svg-small",x:"625",y:"62","text-anchor":"middle"},children:[{text:"returned uint256"}],tag:"text"}],width:920},"fig-escalation-game-module-split":{ariaDescription:"A left-hand inheritance chain runs from shared storage and state into calculations, carry, escrow, settlement, and the public game contract. A deposit delegate uses the same storage layout through delegatecall, while a separate proof verifier feeds verified math back into the mutable stack without acquiring storage authority.",ariaLabel:"EscalationGame module split between inherited state modules, the deposit delegate, and the external proof verifier",height:360,nodes:[{children:[{attributes:{id:"escalation-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{x:"30",y:"100",width:"130",height:"50",rx:"10",class:"svg-slate"},tag:"rect"},{attributes:{x:"95",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Types"}],tag:"text"},{attributes:{x:"195",y:"100",width:"160",height:"50",rx:"10",class:"svg-blue"},tag:"rect"},{attributes:{x:"275",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Storage / State"}],tag:"text"},{attributes:{x:"390",y:"100",width:"140",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"460",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Calculations"}],tag:"text"},{attributes:{x:"570",y:"100",width:"110",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"625",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Carry"}],tag:"text"},{attributes:{x:"390",y:"215",width:"140",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"460",y:"246","text-anchor":"middle",class:"svg-label"},children:[{text:"Escrow"}],tag:"text"},{attributes:{x:"570",y:"215",width:"120",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"630",y:"246","text-anchor":"middle",class:"svg-label"},children:[{text:"Settlement"}],tag:"text"},{attributes:{x:"710",y:"155",width:"200",height:"50",rx:"10",class:"svg-amber"},tag:"rect"},{attributes:{x:"810",y:"186","text-anchor":"middle",class:"svg-label"},children:[{text:"EscalationGame"}],tag:"text"},{attributes:{x:"710",y:"55",width:"200",height:"50",rx:"10",class:"svg-rose"},tag:"rect"},{attributes:{x:"810",y:"86","text-anchor":"middle",class:"svg-label"},children:[{text:"ProofVerifier"}],tag:"text"},{attributes:{x:"710",y:"260",width:"200",height:"50",rx:"10",class:"svg-amber"},tag:"rect"},{attributes:{x:"810",y:"291","text-anchor":"middle",class:"svg-label"},children:[{text:"DepositDelegate"}],tag:"text"},{attributes:{x1:"355",y1:"125",x2:"390",y2:"125",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"530",y1:"125",x2:"570",y2:"125",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"625",y1:"150",x2:"480",y2:"215",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"530",y1:"240",x2:"570",y2:"240",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"690",y1:"240",x2:"710",y2:"190",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"160",y1:"125",x2:"195",y2:"125",stroke:"currentColor","stroke-width":"2","stroke-dasharray":"6 5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"710",y1:"80",x2:"675",y2:"113",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"810",y1:"205",x2:"810",y2:"260",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{points:"710,285 275,285 275,150",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-dasharray":"6 5","marker-end":"url(#escalation-arrow)"},tag:"polyline"},{attributes:{x:"95",y:"79","text-anchor":"middle",class:"svg-note"},children:[{text:"shared definitions"}],tag:"text"},{attributes:{x:"810",y:"34","text-anchor":"middle",class:"svg-note"},children:[{text:"storage-free proof math"}],tag:"text"},{attributes:{x:"500",y:"336","text-anchor":"middle",class:"svg-note"},children:[{text:"delegatecall preserves the game's shared storage surface"}],tag:"text"}],width:920},"fig-invariant-layers":{ariaDescription:`Four connected layers run from local authority guards through +var fH=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var IM=fH((Ma,JC)=>{JC.exports={"fig-deployment-mask":{ariaDescription:"A row of deployment steps on the left maps by index into bit positions in a uint256 mask on the right. Each step sets its bit only when code exists at that configured address.",ariaLabel:"Deployment mask maps ordered deployment steps to bits",height:220,nodes:[{children:[{attributes:{id:"arrow-deployment-mask",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-blue",x:"40",y:"42",width:"220",height:"42",rx:"8"},tag:"rect"},{attributes:{class:"svg-blue",x:"40",y:"94",width:"220",height:"42",rx:"8"},tag:"rect"},{attributes:{class:"svg-blue",x:"40",y:"146",width:"220",height:"42",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"150",y:"69","text-anchor":"middle"},children:[{text:"step 0"}],tag:"text"},{attributes:{class:"svg-label",x:"150",y:"121","text-anchor":"middle"},children:[{text:"step 1"}],tag:"text"},{attributes:{class:"svg-label",x:"150",y:"173","text-anchor":"middle"},children:[{text:"step 2"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deployment-mask)",d:"M 260 63 H 390"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deployment-mask)",d:"M 260 115 H 390"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deployment-mask)",d:"M 260 167 H 390"},tag:"path"},{attributes:{class:"svg-box",x:"390",y:"42",width:"470",height:"146",rx:"10"},tag:"rect"},{attributes:{class:"svg-gold",x:"420",y:"84",width:"90",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-gold",x:"530",y:"84",width:"90",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-gold",x:"640",y:"84",width:"90",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-box",x:"750",y:"84",width:"80",height:"62",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"465",y:"110","text-anchor":"middle"},children:[{text:"bit 0"}],tag:"text"},{attributes:{class:"svg-label",x:"575",y:"110","text-anchor":"middle"},children:[{text:"bit 1"}],tag:"text"},{attributes:{class:"svg-label",x:"685",y:"110","text-anchor":"middle"},children:[{text:"bit 2"}],tag:"text"},{attributes:{class:"svg-label",x:"790",y:"110","text-anchor":"middle"},children:[{text:"..."}],tag:"text"},{attributes:{class:"svg-small",x:"465",y:"132","text-anchor":"middle"},children:[{text:"code?"}],tag:"text"},{attributes:{class:"svg-small",x:"575",y:"132","text-anchor":"middle"},children:[{text:"code?"}],tag:"text"},{attributes:{class:"svg-small",x:"685",y:"132","text-anchor":"middle"},children:[{text:"code?"}],tag:"text"},{attributes:{class:"svg-small",x:"625",y:"62","text-anchor":"middle"},children:[{text:"returned uint256"}],tag:"text"}],width:920},"fig-escalation-game-module-split":{ariaDescription:"A left-hand inheritance chain runs from shared storage and state into calculations, carry, escrow, settlement, and the public game contract. A deposit delegate uses the same storage layout through delegatecall, while a separate proof verifier feeds verified math back into the mutable stack without acquiring storage authority.",ariaLabel:"EscalationGame module split between inherited state modules, the deposit delegate, and the external proof verifier",height:360,nodes:[{children:[{attributes:{id:"escalation-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{x:"30",y:"100",width:"130",height:"50",rx:"10",class:"svg-slate"},tag:"rect"},{attributes:{x:"95",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Types"}],tag:"text"},{attributes:{x:"195",y:"100",width:"160",height:"50",rx:"10",class:"svg-blue"},tag:"rect"},{attributes:{x:"275",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Storage / State"}],tag:"text"},{attributes:{x:"390",y:"100",width:"140",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"460",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Calculations"}],tag:"text"},{attributes:{x:"570",y:"100",width:"110",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"625",y:"131","text-anchor":"middle",class:"svg-label"},children:[{text:"Carry"}],tag:"text"},{attributes:{x:"390",y:"215",width:"140",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"460",y:"246","text-anchor":"middle",class:"svg-label"},children:[{text:"Escrow"}],tag:"text"},{attributes:{x:"570",y:"215",width:"120",height:"50",rx:"10",class:"svg-green"},tag:"rect"},{attributes:{x:"630",y:"246","text-anchor":"middle",class:"svg-label"},children:[{text:"Settlement"}],tag:"text"},{attributes:{x:"710",y:"155",width:"200",height:"50",rx:"10",class:"svg-amber"},tag:"rect"},{attributes:{x:"810",y:"186","text-anchor":"middle",class:"svg-label"},children:[{text:"EscalationGame"}],tag:"text"},{attributes:{x:"710",y:"55",width:"200",height:"50",rx:"10",class:"svg-rose"},tag:"rect"},{attributes:{x:"810",y:"86","text-anchor":"middle",class:"svg-label"},children:[{text:"ProofVerifier"}],tag:"text"},{attributes:{x:"710",y:"260",width:"200",height:"50",rx:"10",class:"svg-amber"},tag:"rect"},{attributes:{x:"810",y:"291","text-anchor":"middle",class:"svg-label"},children:[{text:"DepositDelegate"}],tag:"text"},{attributes:{x1:"355",y1:"125",x2:"390",y2:"125",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"530",y1:"125",x2:"570",y2:"125",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"625",y1:"150",x2:"480",y2:"215",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"530",y1:"240",x2:"570",y2:"240",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"690",y1:"240",x2:"710",y2:"190",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"160",y1:"125",x2:"195",y2:"125",stroke:"currentColor","stroke-width":"2","stroke-dasharray":"6 5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"710",y1:"80",x2:"675",y2:"113",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{x1:"810",y1:"205",x2:"810",y2:"260",stroke:"currentColor","stroke-width":"2.5","marker-end":"url(#escalation-arrow)"},tag:"line"},{attributes:{points:"710,285 275,285 275,150",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-dasharray":"6 5","marker-end":"url(#escalation-arrow)"},tag:"polyline"},{attributes:{x:"95",y:"79","text-anchor":"middle",class:"svg-note"},children:[{text:"shared definitions"}],tag:"text"},{attributes:{x:"810",y:"34","text-anchor":"middle",class:"svg-note"},children:[{text:"storage-free proof math"}],tag:"text"},{attributes:{x:"500",y:"336","text-anchor":"middle",class:"svg-note"},children:[{text:"delegatecall preserves the game's shared storage surface"}],tag:"text"}],width:920},"fig-invariant-layers":{ariaDescription:`Four connected layers run from local authority guards through cross-contract conservation and lifecycle liveness to economic security. A failure in an earlier layer invalidates the safety claims built above it.`,ariaLabel:"Protocol invariant layers",height:260,nodes:[{children:[{attributes:{id:"arrow-invariant-layers",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-blue",x:"25",y:"72",width:"190",height:"112",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"120",y:"108","text-anchor":"middle"},children:[{text:` @@ -597,55 +597,55 @@ var CM=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var wM=CM((cm,B$) `}],tag:"text"}],width:940},"fig-auction-lifecycle":{ariaDescription:`Auction Lifecycle After migration closes, a child-pool shortfall can be repaired through auction. ETH bids restore collateral, while winning claims are settled into vault accounting. REP doesn't leave the system. Finalization accounts the ETH actually raised and - rejects contribution-only ETH, so bidder settlement never depends on a donor.`,ariaLabel:"Migration closes, child pool shortfall is detected, auction starts, ETH bids are submitted, auction finalizes, and results settle into vault accounting.",height:180,nodes:[{children:[{attributes:{id:"auction-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-red",x:"20",y:"50",width:"150",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"95",y:"80","text-anchor":"middle"},children:[{text:"Shortfall"}],tag:"text"},{attributes:{class:"svg-small",x:"95",y:"103","text-anchor":"middle"},children:[{text:"child pool lacks ETH"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-arrow)",d:"M 170 85 H 230"},tag:"path"},{attributes:{class:"svg-blue",x:"230",y:"50",width:"150",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"305",y:"80","text-anchor":"middle"},children:[{text:"Start Auction"}],tag:"text"},{attributes:{class:"svg-small",x:"305",y:"103","text-anchor":"middle"},children:[{text:"repair target set"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-arrow)",d:"M 380 85 H 440"},tag:"path"},{attributes:{class:"svg-gold",x:"440",y:"50",width:"150",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"515",y:"80","text-anchor":"middle"},children:[{text:"Bid"}],tag:"text"},{attributes:{class:"svg-small",x:"515",y:"103","text-anchor":"middle"},children:[{text:"ETH supplied"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-arrow)",d:"M 590 85 H 650"},tag:"path"},{attributes:{class:"svg-green",x:"650",y:"50",width:"190",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"745",y:"80","text-anchor":"middle"},children:[{text:"Settle"}],tag:"text"},{attributes:{class:"svg-small",x:"745",y:"103","text-anchor":"middle"},children:[{text:"bids settle → operational"}],tag:"text"}],width:880},"fig-auction-clearing-ladder":{ariaDescription:"High-price bids are considered first. If cumulative demand reaches the ETH raise cap or REP sale cap, the first binding tick sets normal uniform clearing. If neither cap is reached, finalization selects bids at or above the cap-implied qualification tick and allocates the complete REP sale cap among them at one effective price. With no qualifying bids, every bid refunds.",ariaLabel:"Auction demand is evaluated from high ticks to low ticks before uniform or underfunded clearing",height:360,nodes:[{children:[{attributes:{id:"auction-clearing-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-small",x:"40",y:"34"},children:[{text:"higher ETH/REP limit"}],tag:"text"},{attributes:{class:"svg-green",x:"40",y:"52",width:"230",height:"64",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"155",y:"80","text-anchor":"middle"},children:[{text:"High tick bids"}],tag:"text"},{attributes:{class:"svg-small",x:"155",y:"101","text-anchor":"middle"},children:[{text:"evaluated first"}],tag:"text"},{attributes:{class:"svg-gold",x:"40",y:"142",width:"230",height:"64",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"155",y:"170","text-anchor":"middle"},children:[{text:"Binding tick"}],tag:"text"},{attributes:{class:"svg-small",x:"155",y:"191","text-anchor":"middle"},children:[{text:"marginal fill boundary"}],tag:"text"},{attributes:{class:"svg-red",x:"40",y:"232",width:"230",height:"64",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"155",y:"260","text-anchor":"middle"},children:[{text:"Lower tick bids"}],tag:"text"},{attributes:{class:"svg-small",x:"155",y:"281","text-anchor":"middle"},children:[{text:"refunded below boundary"}],tag:"text"},{attributes:{class:"svg-small",x:"40",y:"326"},children:[{text:"lower ETH/REP limit"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 270 84 C 330 84 330 120 390 120"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 270 174 H 390"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 270 264 C 330 264 330 228 390 228"},tag:"path"},{attributes:{class:"svg-blue",x:"390",y:"110",width:"220",height:"128",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"500",y:"150","text-anchor":"middle"},children:[{text:"Descending demand"}],tag:"text"},{attributes:{class:"svg-small",x:"500",y:"177","text-anchor":"middle"},children:[{text:"accumulate ETH and REP"}],tag:"text"},{attributes:{class:"svg-small",x:"500",y:"201","text-anchor":"middle"},children:[{text:"until a cap binds"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 610 146 H 700"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 610 214 H 700"},tag:"path"},{attributes:{class:"svg-green",x:"700",y:"64",width:"240",height:"94",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"820",y:"98","text-anchor":"middle"},children:[{text:"Uniform clearing"}],tag:"text"},{attributes:{class:"svg-small",x:"820",y:"124","text-anchor":"middle"},children:[{text:"first ETH or REP cap reached"}],tag:"text"},{attributes:{class:"svg-gold",x:"700",y:"198",width:"240",height:"108",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"820",y:"232","text-anchor":"middle"},children:[{text:"Underfunded clearing"}],tag:"text"},{attributes:{class:"svg-small",x:"820",y:"258","text-anchor":"middle"},children:[{text:"cap-implied qualification tick"}],tag:"text"},{attributes:{class:"svg-small",x:"820",y:"280","text-anchor":"middle"},children:[{text:"complete REP cap shared pro rata"}],tag:"text"}],width:980},"fig-zoltar-fork-branch-set":{ariaDescription:"Universe tree. A fork creates the full valid branch set; no branch is privileged by the contract.",ariaLabel:"A parent universe forks into children for Invalid and each valid outcome.",height:430,nodes:[{children:[{attributes:{id:"arrow-universe",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-box",x:"330",y:"28",width:"260",height:"76",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"460",y:"61","text-anchor":"middle"},children:[{text:"Parent universe"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"84","text-anchor":"middle"},children:[{text:"fork on disputed question"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 460 106 V 160"},tag:"path"},{attributes:{class:"svg-gold",x:"324",y:"164",width:"272",height:"82",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"460",y:"198","text-anchor":"middle"},children:[{text:"parentUniverseId"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"222","text-anchor":"middle"},children:[{text:"deterministic child ids"}],tag:"text"},{attributes:{class:"svg-line",d:"M 460 248 V 286"},tag:"path"},{attributes:{class:"svg-line",d:"M 170 286 H 750"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 170 286 V 326"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 360 286 V 326"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 560 286 V 326"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 750 286 V 326"},tag:"path"},{attributes:{class:"svg-teal",x:"76",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"266",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"466",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"656",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"170",y:"365","text-anchor":"middle"},children:[{text:"Invalid"}],tag:"text"},{attributes:{class:"svg-label",x:"360",y:"365","text-anchor":"middle"},children:[{text:"Outcome 1"}],tag:"text"},{attributes:{class:"svg-label",x:"560",y:"365","text-anchor":"middle"},children:[{text:"Outcome 2"}],tag:"text"},{attributes:{class:"svg-label",x:"750",y:"365","text-anchor":"middle"},children:[{text:"Outcome N"}],tag:"text"}],width:920},"fig-zoltar-threshold-deposit":{ariaDescription:"Threshold Deposit Split. The full parent-REP threshold leaves parent supply. Most is re-expressed as migratable child-REP credit; the haircut is not credited.",ariaLabel:"Fork threshold deposit leaves the parent universe. After flooring the approximately 20 percent uncredited haircut, the remainder is an approximately 80 percent migration balance.",height:360,nodes:[{children:[{attributes:{id:"arrow-deposit",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-label",x:"430",y:"42","text-anchor":"middle"},children:[{text:"Fork initiator deposits forkThreshold REP"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deposit)",d:"M 430 58 V 94"},tag:"path"},{attributes:{class:"svg-gold",x:"286",y:"98",width:"288",height:"76",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"430",y:"130","text-anchor":"middle"},children:[{text:"Threshold deposit"}],tag:"text"},{attributes:{class:"svg-small",x:"430",y:"153","text-anchor":"middle"},children:[{text:"≈5% of theoretical REP supply"}],tag:"text"},{attributes:{class:"svg-line",d:"M 430 176 V 222"},tag:"path"},{attributes:{class:"svg-line",d:"M 250 222 H 610"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deposit)",d:"M 250 222 V 260"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deposit)",d:"M 610 222 V 260"},tag:"path"},{attributes:{class:"svg-red",x:"134",y:"264",width:"232",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-teal",x:"494",y:"264",width:"232",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"250",y:"286","text-anchor":"middle","aria-label":"approximately 20 percent uncredited haircut"},children:[{attributes:{x:"250"},children:[{text:"≈20% uncredited"}],tag:"tspan"},{attributes:{class:"svg-small",x:"250",dy:"20"},children:[{text:"haircut"}],tag:"tspan"}],tag:"text"},{attributes:{class:"svg-label",x:"610",y:"286","text-anchor":"middle","aria-label":"approximately 80 percent migration balance"},children:[{attributes:{x:"610"},children:[{text:"≈80% migration"}],tag:"tspan"},{attributes:{class:"svg-small",x:"610",dy:"20"},children:[{text:"balance"}],tag:"tspan"}],tag:"text"}],width:860},"fig-zoltar-migration-reproduction":{ariaDescription:"Migration Balance Reproduction. Selecting multiple branches mints child REP in each selected child universe from the same migration balance.",ariaLabel:"A migration balance can mint REP into one selected child or be reproduced across multiple selected children.",height:520,nodes:[{children:[{attributes:{id:"arrow-split",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-gold",x:"315",y:"28",width:"300",height:"70",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"465",y:"59","text-anchor":"middle"},children:[{text:"Post-fork migration balance"}],tag:"text"},{attributes:{class:"svg-small",x:"465",y:"81","text-anchor":"middle"},children:[{text:"splitMigrationRep(selected outcomes)"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 465 100 V 136"},tag:"path"},{attributes:{class:"svg-line",x1:"465",y1:"136",x2:"465",y2:"168"},tag:"line"},{attributes:{class:"svg-line",x1:"205",y1:"168",x2:"725",y2:"168"},tag:"line"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 205 168 V 210"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 725 168 V 210"},tag:"path"},{attributes:{class:"svg-blue",x:"86",y:"214",width:"238",height:"64",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"205",y:"239","text-anchor":"middle"},children:[{text:"One selected branch"}],tag:"text"},{attributes:{class:"svg-small",x:"205",y:"261","text-anchor":"middle"},children:[{text:"mint only there"}],tag:"text"},{attributes:{class:"svg-teal",x:"606",y:"214",width:"238",height:"64",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"725",y:"239","text-anchor":"middle"},children:[{text:"Multiple branches"}],tag:"text"},{attributes:{class:"svg-small",x:"725",y:"261","text-anchor":"middle"},children:[{text:"reproduce same claim"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 205 280 V 340"},tag:"path"},{attributes:{class:"svg-box",x:"88",y:"346",width:"234",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"205",y:"380","text-anchor":"middle"},children:[{text:"Selected child REP"}],tag:"text"},{attributes:{class:"svg-line",d:"M 725 280 V 330"},tag:"path"},{attributes:{class:"svg-line",x1:"610",y1:"330",x2:"840",y2:"330"},tag:"line"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 610 330 V 372"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 725 330 V 372"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 840 330 V 372"},tag:"path"},{attributes:{class:"svg-box",x:"520",y:"378",width:"180",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-box",x:"635",y:"444",width:"180",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-box",x:"750",y:"378",width:"180",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"610",y:"412","text-anchor":"middle"},children:[{text:"Invalid REP"}],tag:"text"},{attributes:{class:"svg-label",x:"725",y:"478","text-anchor":"middle"},children:[{text:"Outcome A REP"}],tag:"text"},{attributes:{class:"svg-label",x:"840",y:"412","text-anchor":"middle"},children:[{text:"Outcome B REP"}],tag:"text"}],width:930},"fig-zoltar-packed-scalar-answer":{ariaDescription:"Packed Scalar Answer. A scalar answer is easier to read as reserved bits, a namespace flag, and two payout fields: bits 254...240 must be zero, 0 in bit 255 is the invalid namespace, and 1 means the payout fields must sum to numTicks.",ariaLabel:"A uint256 scalar answer uses the highest bit as a namespace flag, then packs first and second 120-bit payout numerators.",height:520,nodes:[{children:[{attributes:{id:"arrow-packed",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-small",x:"70",y:"46"},children:[{text:"most significant"}],tag:"text"},{attributes:{class:"svg-small",x:"850",y:"46","text-anchor":"end"},children:[{text:"least significant"}],tag:"text"},{attributes:{class:"svg-box",x:"70",y:"66",width:"780",height:"118",rx:"14"},tag:"rect"},{attributes:{class:"svg-teal",x:"92",y:"92",width:"92",height:"66",rx:"10"},tag:"rect"},{attributes:{class:"svg-gold",x:"210",y:"92",width:"280",height:"66",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"516",y:"92",width:"312",height:"66",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"138",y:"119","text-anchor":"middle"},children:[{text:"bit 255"}],tag:"text"},{attributes:{class:"svg-small",x:"138",y:"142","text-anchor":"middle"},children:[{text:"flag"}],tag:"text"},{attributes:{class:"svg-label",x:"350",y:"119","text-anchor":"middle"},children:[{text:"bits 239...120"}],tag:"text"},{attributes:{class:"svg-small",x:"350",y:"142","text-anchor":"middle"},children:[{text:"first payout numerator"}],tag:"text"},{attributes:{class:"svg-label",x:"672",y:"119","text-anchor":"middle"},children:[{text:"bits 119...0"}],tag:"text"},{attributes:{class:"svg-small",x:"672",y:"142","text-anchor":"middle"},children:[{text:"second payout numerator"}],tag:"text"},{attributes:{class:"svg-small",x:"92",y:"202"},children:[{text:"Bits 254...240 are reserved and must be zero."}],tag:"text"},{attributes:{class:"svg-small",x:"92",y:"224"},children:[{text:"Nonzero reserved bits are malformed."}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 138 184 V 246"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 350 184 V 246"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 672 184 V 246"},tag:"path"},{attributes:{class:"svg-teal",x:"52",y:"256",width:"172",height:"92",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"138",y:"292","text-anchor":"middle"},children:[{text:"Namespace"}],tag:"text"},{attributes:{class:"svg-small",x:"138",y:"318","text-anchor":"middle"},children:[{text:"0 = Invalid"}],tag:"text"},{attributes:{class:"svg-small",x:"138",y:"340","text-anchor":"middle"},children:[{text:"1 = scalar value"}],tag:"text"},{attributes:{class:"svg-gold",x:"258",y:"256",width:"184",height:"92",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"350",y:"292","text-anchor":"middle"},children:[{text:"Left Payout"}],tag:"text"},{attributes:{class:"svg-small",x:"350",y:"318","text-anchor":"middle"},children:[{text:"numTicks - tickIndex"}],tag:"text"},{attributes:{class:"svg-blue",x:"580",y:"256",width:"184",height:"92",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"672",y:"292","text-anchor":"middle"},children:[{text:"Right Payout"}],tag:"text"},{attributes:{class:"svg-small",x:"672",y:"318","text-anchor":"middle"},children:[{text:"tickIndex"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 442 302 H 570"},tag:"path"},{attributes:{class:"svg-small",x:"506",y:"286","text-anchor":"middle"},children:[{text:"combined rule"}],tag:"text"},{attributes:{class:"svg-box",x:"176",y:"390",width:"568",height:"82",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"460",y:"424","text-anchor":"middle"},children:[{text:"Scalar validity check"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"444","text-anchor":"middle"},children:[{text:"first payout numerator"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"464","text-anchor":"middle"},children:[{text:"+ second payout numerator = numTicks"}],tag:"text"}],width:920},"fig-contract-interaction-map":{ariaDescription:"Three panels separate construction-time deployment, recurring market and oracle operations, and fork migration and backing repair. Repeated contracts preserve local reading order, short edge labels name each action, and the detailed table below gives the exact boundary.",ariaLabel:"Zoltar and Statoblast contract interactions grouped into deployment, runtime, and fork phases",height:880,nodes:[],width:1120},"fig-liquidation-health-curve":{ariaDescription:"Required REP backing rises linearly with the REP per ETH price, while unlocked REP stays fixed. Crossing the available-REP line makes the selected vault liquidatable.",ariaLabel:"Vault backing requirement and liquidation threshold across REP per ETH prices",height:430,nodes:[],width:900},"fig-statoblast-retention-utilization":{ariaDescription:"The annualized open-interest fee rises from about ten percent at zero utilization to about fifty percent at the eighty-percent utilization dip, then remains at that level as the per-second retention rate stays at its minimum.",ariaLabel:"Annualized open-interest fee across fee-eligible allowance utilization",height:420,nodes:[],width:900},"fig-zoltar-fork-threshold-decay":{ariaDescription:"With the default threshold and burn divisors, each fork haircut leaves approximately ninety-nine percent of the previous generation's theoretical REP supply. The next fork threshold remains five percent of that declining supply.",ariaLabel:"Theoretical REP supply and fork threshold across repeated forks",height:420,nodes:[],width:900}}});function Qt(t,r){return t==null||r==null?NaN:tr?1:t>=r?0:NaN}function Ur(t,r){return t==null||r==null?NaN:rt?1:r>=t?0:NaN}function G0(t){let r,f,u;if(t.length!==2)r=Qt,f=(b,c)=>Qt(t(b),c),u=(b,c)=>t(b)-c;else r=t===Qt||t===Ur?t:KM,f=t,u=t;function h(b,c,l=0,d=b.length){if(l>>1;if(f(b[_],c)<0)l=_+1;else d=_}while(l>>1;if(f(b[_],c)<=0)l=_+1;else d=_}while(ll&&u(b[_-1],c)>-u(b[_],c)?_-1:_}return{left:h,center:x,right:g}}function KM(){return 0}function W1(t){return t===null?NaN:+t}function*vb(t,r){if(r===void 0){for(let f of t)if(f!=null&&(f=+f)>=f)yield f}else{let f=-1;for(let u of t)if((u=r(u,++f,t))!=null&&(u=+u)>=u)yield u}}var Xb=G0(Qt),Yb=Xb.right,VM=Xb.left,WM=G0(W1).center,R0=Yb;function Bf(t,r){let f=0;if(r===void 0){for(let u of t)if(u!=null&&(u=+u)>=u)++f}else{let u=-1;for(let h of t)if((h=r(h,++u,t))!=null&&(h=+h)>=h)++f}return f}function oM(t){return t.length|0}function ZM(t){return!(t>0)}function TM(t){return typeof t!=="object"||"length"in t?t:Array.from(t)}function FM(t){return(r)=>t(...r)}function Z8(...t){let r=typeof t[t.length-1]==="function"&&FM(t.pop());t=t.map(TM);let f=t.map(oM),u=t.length-1,h=Array(u+1).fill(0),g=[];if(u<0||f.some(ZM))return g;while(!0){g.push(h.map((b,c)=>t[c][b]));let x=u;while(++h[x]===f[x]){if(x===0)return r?g.map(r):g;h[x--]=0}}}function T8(t,r){var f=0,u=0;return Float64Array.from(t,r===void 0?(h)=>f+=+h||0:(h)=>f+=+r(h,u++,t)||0)}function su(t,r){let f=0,u,h=0,g=0;if(r===void 0){for(let x of t)if(x!=null&&(x=+x)>=x)u=x-h,h+=u/++f,g+=u*(x-h)}else{let x=-1;for(let b of t)if((b=r(b,++x,t))!=null&&(b=+b)>=b)u=b-h,h+=u/++f,g+=u*(b-h)}if(f>1)return g/(f-1)}function Pu(t,r){let f=su(t,r);return f?Math.sqrt(f):f}function Rt(t,r){let f,u;if(r===void 0){for(let h of t)if(h!=null)if(f===void 0){if(h>=h)f=u=h}else{if(f>h)f=h;if(u=g)f=u=g}else{if(f>g)f=g;if(u0){g=t[--r];while(r>0)if(f=g,u=t[--r],g=f+u,h=u-(g-f),h)break;if(r>0&&(h<0&&t[r-1]<0||h>0&&t[r-1]>0)){if(u=h*2,f=g+u,u==f-g)g=f}}return g}}class Mr extends Map{constructor(t,r=mb){super();if(Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[f,u]of t)this.set(f,u)}get(t){return super.get(C4(this,t))}has(t){return super.has(C4(this,t))}set(t,r){return super.set(Sb(this,t),r)}delete(t){return super.delete(ab(this,t))}}class h0 extends Set{constructor(t,r=mb){super();if(Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let f of t)this.add(f)}has(t){return super.has(C4(this,t))}add(t){return super.add(Sb(this,t))}delete(t){return super.delete(ab(this,t))}}function C4({_intern:t,_key:r},f){let u=r(f);return t.has(u)?t.get(u):f}function Sb({_intern:t,_key:r},f){let u=r(f);if(t.has(u))return t.get(u);return t.set(u,f),f}function ab({_intern:t,_key:r},f){let u=r(f);if(t.has(u))f=t.get(u),t.delete(u);return f}function mb(t){return t!==null&&typeof t==="object"?t.valueOf():t}function o1(t){return t}function g0(t,...r){return V4(t,o1,o1,r)}function Or(t,r,...f){return V4(t,o1,r,f)}function K4(t,r,...f){return V4(t,Array.from,r,f)}function V4(t,r,f,u){return function h(g,x){if(x>=u.length)return f(g);let b=new Mr,c=u[x++],l=-1;for(let d of g){let _=c(d,++l,g),w=b.get(_);if(w)w.push(d);else b.set(_,[d])}for(let[d,_]of b)b.set(d,h(_,x));return r(b)}(t,0)}function W4(t,r){return Array.from(r,(f)=>t[f])}function z0(t,...r){if(typeof t[Symbol.iterator]!=="function")throw TypeError("values is not iterable");t=Array.from(t);let[f]=r;if(f&&f.length!==2||r.length>1){let u=Uint32Array.from(t,(h,g)=>g);if(r.length>1)r=r.map((h)=>t.map(h)),u.sort((h,g)=>{for(let x of r){let b=Z1(x[h],x[g]);if(b)return b}});else f=t.map(f),u.sort((h,g)=>Z1(f[h],f[g]));return W4(t,u)}return t.sort(o4(f))}function o4(t=Qt){if(t===Qt)return Z1;if(typeof t!=="function")throw TypeError("compare is not a function");return(r,f)=>{let u=t(r,f);if(u||u===0)return u;return(t(f,f)===0)-(t(r,r)===0)}}function Z1(t,r){return(t==null||!(t>=t))-(r==null||!(r>=r))||(tr?1:0)}function nu(t,r,f){return(r.length!==2?z0(Or(t,r,f),([u,h],[g,x])=>Qt(h,x)||Qt(u,g)):z0(g0(t,f),([u,h],[g,x])=>r(h,x)||Qt(u,g))).map(([u])=>u)}var BM=Math.sqrt(50),LM=Math.sqrt(10),GM=Math.sqrt(2);function F8(t,r,f){let u=(r-t)/Math.max(0,f),h=Math.floor(Math.log10(u)),g=u/Math.pow(10,h),x=g>=BM?10:g>=LM?5:g>=GM?2:1,b,c,l;if(h<0){if(l=Math.pow(10,-h)/x,b=Math.round(t*l),c=Math.round(r*l),b/lr)--c;l=-l}else{if(l=Math.pow(10,h)*x,b=Math.round(t/l),c=Math.round(r/l),b*lr)--c}if(c0))return[];if(t===r)return[t];let u=r=h))return[];let b=g-h+1,c=Array(b);if(u)if(x<0)for(let l=0;l=u))f=u}else{let u=-1;for(let h of t)if((h=r(h,++u,t))!=null&&(f=h))f=h}return f}function L8(t,r){let f,u=-1,h=-1;if(r===void 0){for(let g of t)if(++h,g!=null&&(f=g))f=g,u=h}else for(let g of t)if((g=r(g,++h,t))!=null&&(f=g))f=g,u=h;return u}function br(t,r){let f;if(r===void 0){for(let u of t)if(u!=null&&(f>u||f===void 0&&u>=u))f=u}else{let u=-1;for(let h of t)if((h=r(h,++u,t))!=null&&(f>h||f===void 0&&h>=h))f=h}return f}function G8(t,r){let f,u=-1,h=-1;if(r===void 0){for(let g of t)if(++h,g!=null&&(f>g||f===void 0&&g>=g))f=g,u=h}else for(let g of t)if((g=r(g,++h,t))!=null&&(f>g||f===void 0&&g>=g))f=g,u=h;return u}function R8(t,r,f=0,u=1/0,h){if(r=Math.floor(r),f=Math.floor(Math.max(0,f)),u=Math.floor(Math.min(t.length-1,u)),!(f<=r&&r<=u))return t;h=h===void 0?Z1:o4(h);while(u>f){if(u-f>600){let c=u-f+1,l=r-f+1,d=Math.log(c),_=0.5*Math.exp(2*d/3),w=0.5*Math.sqrt(d*_*(c-_)/c)*(l-c/2<0?-1:1),M=Math.max(f,Math.floor(r-l*_/c+w)),i=Math.min(u,Math.floor(r+(c-l)*_/c+w));R8(t,r,M,i,h)}let g=t[r],x=f,b=u;if(T1(t,f,r),h(t[u],g)>0)T1(t,f,u);while(x0)--b}if(h(t[f],g)===0)T1(t,f,b);else++b,T1(t,b,u);if(b<=r)f=b+1;if(r<=b)u=b-1}return t}function T1(t,r,f){let u=t[r];t[r]=t[f],t[f]=u}function F1(t,r=Qt){let f,u=!1;if(r.length===1){let h;for(let g of t){let x=r(g);if(u?Qt(x,h)>0:Qt(x,x)===0)f=g,h=x,u=!0}}else for(let h of t)if(u?r(h,f)>0:r(h,h)===0)f=h,u=!0;return f}function Cr(t,r,f){if(t=Float64Array.from(vb(t,f)),!(u=t.length)||isNaN(r=+r))return;if(r<=0||u<2)return br(t);if(r>=1)return Ot(t);var u,h=(u-1)*r,g=Math.floor(h),x=Ot(R8(t,g).subarray(0,g+1)),b=br(t.subarray(g+1));return x+(b-x)*(h-g)}function Z4(t,r,f=W1){if(!(u=t.length)||isNaN(r=+r))return;if(r<=0||u<2)return+f(t[0],0,t);if(r>=1)return+f(t[u-1],u-1,t);var u,h=(u-1)*r,g=Math.floor(h),x=+f(t[g],g,t),b=+f(t[g+1],g+1,t);return x+(b-x)*(h-g)}function z8(t,r,f){let u=Bf(t),h=Cr(t,0.75)-Cr(t,0.25);return u&&h?Math.ceil((f-r)/(2*h*Math.pow(u,-0.3333333333333333))):1}function B1(t,r,f){let u=Bf(t),h=Pu(t);return u&&h?Math.ceil((f-r)*Math.cbrt(u)/(3.49*h)):1}function A8(t,r){let f=0,u=0;if(r===void 0){for(let h of t)if(h!=null&&(h=+h)>=h)++f,u+=h}else{let h=-1;for(let g of t)if((g=r(g,++h,t))!=null&&(g=+g)>=g)++f,u+=g}if(f)return u/f}function Gf(t,r){return Cr(t,0.5,r)}function*zM(t){for(let r of t)yield*r}function Ju(t){return Array.from(zM(t))}function D8(t,r){let f=new Mr;if(r===void 0){for(let g of t)if(g!=null&&g>=g)f.set(g,(f.get(g)||0)+1)}else{let g=-1;for(let x of t)if((x=r(x,++g,t))!=null&&x>=x)f.set(x,(f.get(x)||0)+1)}let u,h=0;for(let[g,x]of f)if(x>h)h=x,u=g;return u}function O8(t,r=AM){let f=[],u,h=!1;for(let g of t){if(h)f.push(r(u,g));u=g,h=!0}return f}function AM(t,r){return[t,r]}function Rf(t,r,f){t=+t,r=+r,f=(h=arguments.length)<2?(r=t,t=0,1):h<3?1:+f;var u=-1,h=Math.max(0,Math.ceil((r-t)/f))|0,g=Array(h);while(++u+t(r)}function vM(t,r){if(r=Math.max(0,t.bandwidth()-r*2)/2,t.round())r=Math.round(r);return(f)=>+t(f)+r}function XM(){return!this.__axis}function YM(t,r){var f=[],u=null,h=null,g=6,x=6,b=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:0.5,l=t===F4||t===I8?-1:1,d=t===I8||t===B4?"x":"y",_=t===F4||t===L4?DM:OM;function w(M){var i=u==null?r.ticks?r.ticks.apply(r,f):r.domain():u,H=h==null?r.tickFormat?r.tickFormat.apply(r,f):T4:h,q=Math.max(g,0)+b,s=r.range(),E=+s[0]+c,P=+s[s.length-1]+c,n=(r.bandwidth?vM:IM)(r.copy(),c),$=M.selection?M.selection():M,J=$.selectAll(".domain").data([null]),Q=$.selectAll(".tick").data(i,r).order(),U=Q.exit(),e=Q.enter().append("g").attr("class","tick"),o=Q.select("line"),K=Q.select("text");if(J=J.merge(J.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),Q=Q.merge(e),o=o.merge(e.append("line").attr("stroke","currentColor").attr(d+"2",l*g)),K=K.merge(e.append("text").attr("fill","currentColor").attr(d,l*q).attr("dy",t===F4?"0em":t===L4?"0.71em":"0.32em")),M!==$)J=J.transition(M),Q=Q.transition(M),o=o.transition(M),K=K.transition(M),U=U.transition(M).attr("opacity",jb).attr("transform",function(V){return isFinite(V=n(V))?_(V+c):this.getAttribute("transform")}),e.attr("opacity",jb).attr("transform",function(V){var G=this.parentNode.__axis;return _((G&&isFinite(G=G(V))?G:n(V))+c)});U.remove(),J.attr("d",t===I8||t===B4?x?"M"+l*x+","+E+"H"+c+"V"+P+"H"+l*x:"M"+c+","+E+"V"+P:x?"M"+E+","+l*x+"V"+c+"H"+P+"V"+l*x:"M"+E+","+c+"H"+P),Q.attr("opacity",1).attr("transform",function(V){return _(n(V)+c)}),o.attr(d+"2",l*g),K.attr(d,l*q).text(H),$.filter(XM).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===B4?"start":t===I8?"end":"middle"),$.each(function(){this.__axis=n})}return w.scale=function(M){return arguments.length?(r=M,w):r},w.ticks=function(){return f=Array.from(arguments),w},w.tickArguments=function(M){return arguments.length?(f=M==null?[]:Array.from(M),w):f.slice()},w.tickValues=function(M){return arguments.length?(u=M==null?null:Array.from(M),w):u&&u.slice()},w.tickFormat=function(M){return arguments.length?(h=M,w):h},w.tickSize=function(M){return arguments.length?(g=x=+M,w):g},w.tickSizeInner=function(M){return arguments.length?(g=+M,w):g},w.tickSizeOuter=function(M){return arguments.length?(x=+M,w):x},w.tickPadding=function(M){return arguments.length?(b=+M,w):b},w.offset=function(M){return arguments.length?(c=+M,w):c},w}function G4(t){return YM(L4,t)}var SM={value:()=>{}};function kb(){for(var t=0,r=arguments.length,f={},u;t=0)u=f.slice(h+1),f=f.slice(0,h);if(f&&!r.hasOwnProperty(f))throw Error("unknown type: "+f);return{type:f,name:u}})}v8.prototype=kb.prototype={constructor:v8,on:function(t,r){var f=this._,u=aM(t+"",f),h,g=-1,x=u.length;if(arguments.length<2){while(++g0)for(var f=Array(h),u=0,h,g;u=0&&(r=t.slice(0,f))!=="xmlns")t=t.slice(f+1);return x0.hasOwnProperty(r)?{space:x0[r],local:t}:t}function jM(t){return function(){var r=this.ownerDocument,f=this.namespaceURI;return f===X8&&r.documentElement.namespaceURI===X8?r.createElement(t):r.createElementNS(f,t)}}function yM(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function c0(t){var r=b0(t);return(r.local?yM:jM)(r)}function kM(){}function lf(t){return t==null?kM:function(){return this.querySelector(t)}}function z4(t){if(typeof t!=="function")t=lf(t);for(var r=this._groups,f=r.length,u=Array(f),h=0;h=P)P=E+1;while(!($=q[P])&&++P=0;)if(x=u[h]){if(g&&x.compareDocumentPosition(g)^4)g.parentNode.insertBefore(x,g);g=x}return this}function k4(t){if(!t)t=_i;function r(_,w){return _&&w?t(_.__data__,w.__data__):!_-!w}for(var f=this._groups,u=f.length,h=Array(u),g=0;gr?1:t>=r?0:NaN}function p4(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function t9(){return Array.from(this)}function r9(){for(var t=this._groups,r=0,f=t.length;r1?this.each((r==null?si:typeof r==="function"?ni:Pi)(t,r,f==null?"":f)):_f(this.node(),t)}function _f(t,r){return t.style.getPropertyValue(r)||R1(t).getComputedStyle(t,null).getPropertyValue(r)}function $i(t){return function(){delete this[t]}}function Ji(t,r){return function(){this[t]=r}}function Qi(t,r){return function(){var f=r.apply(this,arguments);if(f==null)delete this[t];else this[t]=f}}function b9(t,r){return arguments.length>1?this.each((r==null?$i:typeof r==="function"?Qi:Ji)(t,r)):this.node()[t]}function pb(t){return t.trim().split(/^|\s+/)}function c9(t){return t.classList||new tc(t)}function tc(t){this._node=t,this._names=pb(t.getAttribute("class")||"")}tc.prototype={add:function(t){var r=this._names.indexOf(t);if(r<0)this._names.push(t),this._node.setAttribute("class",this._names.join(" "))},remove:function(t){var r=this._names.indexOf(t);if(r>=0)this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(t){return this._names.indexOf(t)>=0}};function rc(t,r){var f=c9(t),u=-1,h=r.length;while(++u=0)f=r.slice(u+1),r=r.slice(0,u);return{type:r,name:f}})}function Di(t){return function(){var r=this.__on;if(!r)return;for(var f=0,u=-1,h=r.length,g;f>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):f===8?a8(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):f===4?a8(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=Si.exec(t))?new Lt(r[1],r[2],r[3],1):(r=ai.exec(t))?new Lt(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=mi.exec(t))?a8(r[1],r[2],r[3],r[4]):(r=ji.exec(t))?a8(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=yi.exec(t))?_c(r[1],r[2]/100,r[3]/100,1):(r=ki.exec(t))?_c(r[1],r[2]/100,r[3]/100,r[4]):gc.hasOwnProperty(t)?cc(gc[t]):t==="transparent"?new Lt(NaN,NaN,NaN,0):null}function cc(t){return new Lt(t>>16&255,t>>8&255,t&255,1)}function a8(t,r,f,u){if(u<=0)t=r=f=NaN;return new Lt(t,r,f,u)}function A1(t){if(!(t instanceof _0))t=Xr(t);if(!t)return new Lt;return t=t.rgb(),new Lt(t.r,t.g,t.b,t.opacity)}function Kr(t,r,f,u){return arguments.length===1?A1(t):new Lt(t,r,f,u==null?1:u)}function Lt(t,r,f,u){this.r=+t,this.g=+r,this.b=+f,this.opacity=+u}d0(Lt,Kr,wf(_0,{brighter(t){return t=t==null?Df:Math.pow(Df,t),new Lt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Mf:Math.pow(Mf,t),new Lt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Lt(Af(this.r),Af(this.g),Af(this.b),j8(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:dc,formatHex:dc,formatHex8:rH,formatRgb:lc,toString:lc}));function dc(){return`#${zf(this.r)}${zf(this.g)}${zf(this.b)}`}function rH(){return`#${zf(this.r)}${zf(this.g)}${zf(this.b)}${zf((isNaN(this.opacity)?1:this.opacity)*255)}`}function lc(){let t=j8(this.opacity);return`${t===1?"rgb(":"rgba("}${Af(this.r)}, ${Af(this.g)}, ${Af(this.b)}${t===1?")":`, ${t})`}`}function j8(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Af(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function zf(t){return t=Af(t),(t<16?"0":"")+t.toString(16)}function _c(t,r,f,u){if(u<=0)t=r=f=NaN;else if(f<=0||f>=1)t=r=NaN;else if(r<=0)t=NaN;return new vr(t,r,f,u)}function Mc(t){if(t instanceof vr)return new vr(t.h,t.s,t.l,t.opacity);if(!(t instanceof _0))t=Xr(t);if(!t)return new vr;if(t instanceof vr)return t;t=t.rgb();var r=t.r/255,f=t.g/255,u=t.b/255,h=Math.min(r,f,u),g=Math.max(r,f,u),x=NaN,b=g-h,c=(g+h)/2;if(b){if(r===g)x=(f-u)/b+(f0&&c<1?0:x;return new vr(x,b,c,t.opacity)}function D1(t,r,f,u){return arguments.length===1?Mc(t):new vr(t,r,f,u==null?1:u)}function vr(t,r,f,u){this.h=+t,this.s=+r,this.l=+f,this.opacity=+u}d0(vr,D1,wf(_0,{brighter(t){return t=t==null?Df:Math.pow(Df,t),new vr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Mf:Math.pow(Mf,t),new vr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,r=isNaN(t)||isNaN(this.s)?0:this.s,f=this.l,u=f+(f<0.5?f:1-f)*r,h=2*f-u;return new Lt(N9(t>=240?t-240:t+120,h,u),N9(t,h,u),N9(t<120?t+240:t-120,h,u),this.opacity)},clamp(){return new vr(wc(this.h),m8(this.s),m8(this.l),j8(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){let t=j8(this.opacity);return`${t===1?"hsl(":"hsla("}${wc(this.h)}, ${m8(this.s)*100}%, ${m8(this.l)*100}%${t===1?")":`, ${t})`}`}}));function wc(t){return t=(t||0)%360,t<0?t+360:t}function m8(t){return Math.max(0,Math.min(1,t||0))}function N9(t,r,f){return(t<60?r+(f-r)*t/60:t<180?f:t<240?r+(f-r)*(240-t)/60:r)*255}var y8=Math.PI/180,k8=180/Math.PI;var p8=18,ic=0.96422,Hc=1,qc=0.82521,Ec=0.13793103448275862,eu=0.20689655172413793,sc=3*eu*eu,fH=eu*eu*eu;function Pc(t){if(t instanceof w0)return new w0(t.l,t.a,t.b,t.opacity);if(t instanceof D0)return nc(t);if(!(t instanceof Lt))t=A1(t);var r=K9(t.r),f=K9(t.g),u=K9(t.b),h=U9((0.2225045*r+0.7168786*f+0.0606169*u)/Hc),g,x;if(r===f&&f===u)g=x=h;else g=U9((0.4360747*r+0.3850649*f+0.1430804*u)/ic),x=U9((0.0139322*r+0.0971045*f+0.7141733*u)/qc);return new w0(116*h-16,500*(g-h),200*(h-x),t.opacity)}function Cu(t,r,f,u){return arguments.length===1?Pc(t):new w0(t,r,f,u==null?1:u)}function w0(t,r,f,u){this.l=+t,this.a=+r,this.b=+f,this.opacity=+u}d0(w0,Cu,wf(_0,{brighter(t){return new w0(this.l+p8*(t==null?1:t),this.a,this.b,this.opacity)},darker(t){return new w0(this.l-p8*(t==null?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,r=isNaN(this.a)?t:t+this.a/500,f=isNaN(this.b)?t:t-this.b/200;return r=ic*e9(r),t=Hc*e9(t),f=qc*e9(f),new Lt(C9(3.1338561*r-1.6168667*t-0.4906146*f),C9(-0.9787684*r+1.9161415*t+0.033454*f),C9(0.0719453*r-0.2289914*t+1.4052427*f),this.opacity)}}));function U9(t){return t>fH?Math.pow(t,0.3333333333333333):t/sc+Ec}function e9(t){return t>eu?t*t*t:sc*(t-Ec)}function C9(t){return 255*(t<=0.0031308?12.92*t:1.055*Math.pow(t,0.4166666666666667)-0.055)}function K9(t){return(t/=255)<=0.04045?t/12.92:Math.pow((t+0.055)/1.055,2.4)}function uH(t){if(t instanceof D0)return new D0(t.h,t.c,t.l,t.opacity);if(!(t instanceof w0))t=Pc(t);if(t.a===0&&t.b===0)return new D0(NaN,0=1?(f=1,r-1):Math.floor(f*r),h=t[u],g=t[u+1],x=u>0?t[u-1]:2*h-g,b=u()=>t;function Uc(t,r){return function(f){return t+f*r}}function gH(t,r,f){return t=Math.pow(t,f),r=Math.pow(r,f)-t,f=1/f,function(u){return Math.pow(t+u*r,f)}}function Vu(t,r){var f=r-t;return f?Uc(t,f>180||f<-180?f-360*Math.round(f/360):f):Ku(isNaN(t)?r:t)}function ec(t){return(t=+t)===1?$t:function(r,f){return f-r?gH(r,f,t):Ku(isNaN(r)?f:r)}}function $t(t,r){var f=r-t;return f?Uc(t,f):Ku(isNaN(t)?r:t)}var Vr=function t(r){var f=ec(r);function u(h,g){var x=f((h=Kr(h)).r,(g=Kr(g)).r),b=f(h.g,g.g),c=f(h.b,g.b),l=$t(h.opacity,g.opacity);return function(d){return h.r=x(d),h.g=b(d),h.b=c(d),h.opacity=l(d),h+""}}return u.gamma=t,u}(1);function Cc(t){return function(r){var f=r.length,u=Array(f),h=Array(f),g=Array(f),x,b;for(x=0;xf)if(g=r.slice(f,g),b[x])b[x]+=g;else b[++x]=g;if((u=u[0])===(h=h[0]))if(b[x])b[x]+=h;else b[++x]=h;else b[++x]=null,c.push({i:x,x:st(u,h)});f=R9.lastIndex}if(f180)d+=360;else if(d-l>180)l+=360;w.push({i:_.push(h(_)+"rotate(",null,u)-2,x:st(l,d)})}else if(d)_.push(h(_)+"rotate("+d+u)}function b(l,d,_,w){if(l!==d)w.push({i:_.push(h(_)+"skewX(",null,u)-2,x:st(l,d)});else if(d)_.push(h(_)+"skewX("+d+u)}function c(l,d,_,w,M,i){if(l!==_||d!==w){var H=M.push(h(M)+"scale(",null,",",null,")");i.push({i:H-4,x:st(l,_)},{i:H-2,x:st(d,w)})}else if(_!==1||w!==1)M.push(h(M)+"scale("+_+","+w+")")}return function(l,d){var _=[],w=[];return l=t(l),d=t(d),g(l.translateX,l.translateY,d.translateX,d.translateY,_,w),x(l.rotate,d.rotate,_,w),b(l.skewX,d.skewX,_,w),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,_,w),l=d=null,function(M){var i=-1,H=w.length,q;while(++i=0)t._call.call(void 0,r);t=t._next}--Zu}function Gc(){If=(x6=S1.now())+b6,Zu=X1=0;try{Ac()}finally{Zu=0,iH(),If=0}}function MH(){var t=S1.now(),r=t-x6;if(r>Rc)b6-=r,x6=t}function iH(){var t,r=g6,f,u=1/0;while(r)if(r._call){if(u>r._time)u=r._time;t=r,r=r._next}else f=r._next,r._next=null,r=t?t._next=f:g6=f;Y1=t,v9(u)}function v9(t){if(Zu)return;if(X1)X1=clearTimeout(X1);var r=t-If;if(r>24){if(t<1/0)X1=setTimeout(Gc,t-S1.now()-b6);if(v1)v1=clearInterval(v1)}else{if(!v1)x6=S1.now(),v1=setInterval(MH,Rc);Zu=1,zc(Gc)}}function j1(t,r,f){var u=new a1;return r=r==null?0:+r,u.restart((h)=>{u.stop(),t(h+r)},r,f),u}var HH=R4("start","end","cancel","interrupt"),qH=[],Ic=0,Dc=1,l6=2,d6=3,Oc=4,_6=5,y1=6;function O0(t,r,f,u,h,g){var x=t.__transition;if(!x)t.__transition={};else if(f in x)return;EH(t,f,{name:r,index:u,group:h,on:HH,tween:qH,time:g.time,delay:g.delay,duration:g.duration,ease:g.ease,timer:null,state:Ic})}function k1(t,r){var f=zt(t,r);if(f.state>Ic)throw Error("too late; already scheduled");return f}function yt(t,r){var f=zt(t,r);if(f.state>d6)throw Error("too late; already running");return f}function zt(t,r){var f=t.__transition;if(!f||!(f=f[r]))throw Error("transition not found");return f}function EH(t,r,f){var u=t.__transition,h;u[r]=f,f.timer=c6(g,0,f.time);function g(l){if(f.state=Dc,f.timer.restart(x,f.delay,f.time),f.delay<=l)x(l-f.delay)}function x(l){var d,_,w,M;if(f.state!==Dc)return c();for(d in u){if(M=u[d],M.name!==f.name)continue;if(M.state===d6)return j1(x);if(M.state===Oc)M.state=y1,M.timer.stop(),M.on.call("interrupt",t,t.__data__,M.index,M.group),delete u[d];else if(+dl6&&u.state<_6,u.state=y1,u.timer.stop(),u.on.call(h?"interrupt":"cancel",t,t.__data__,u.index,u.group),delete f[x]}if(g)delete t.__transition}function X9(t){return this.each(function(){p1(this,t)})}function sH(t,r){var f,u;return function(){var h=yt(this,t),g=h.tween;if(g!==f){u=f=g;for(var x=0,b=u.length;x=0)r=r.slice(0,f);return!r||r==="start"})}function GH(t,r,f){var u,h,g=LH(r)?k1:yt;return function(){var x=g(this,t),b=x.on;if(b!==u)(h=(u=b).copy()).on(r,f);x.on=h}}function r2(t,r){var f=this._id;return arguments.length<2?zt(this.node(),f).on.on(t):this.each(GH(f,t,r))}function RH(t){return function(){var r=this.parentNode;for(var f in this.__transition)if(+f!==t)return;if(r)r.removeChild(this)}}function f2(){return this.on("end.remove",RH(this._id))}function u2(t){var r=this._name,f=this._id;if(typeof t!=="function")t=lf(t);for(var u=this._groups,h=u.length,g=Array(h),x=0;x=0))throw Error(`invalid digits: ${t}`);if(r>15)return Sc;let f=10**r;return function(u){this._+=u[0];for(let h=1,g=u.length;h0.000001));else if(!(Math.abs(d*b-c*l)>0.000001)||!h)this._append`L${this._x1=t},${this._y1=r}`;else{let w=f-g,M=u-x,i=b*b+c*c,H=w*w+M*M,q=Math.sqrt(i),s=Math.sqrt(_),E=h*Math.tan((i2-Math.acos((i+_-H)/(2*q*s)))/2),P=E/s,n=E/q;if(Math.abs(P-1)>0.000001)this._append`L${t+P*l},${r+P*d}`;this._append`A${h},${h},0,0,${+(d*w>l*M)},${this._x1=t+n*b},${this._y1=r+n*c}`}}arc(t,r,f,u,h,g){if(t=+t,r=+r,f=+f,g=!!g,f<0)throw Error(`negative radius: ${f}`);let x=f*Math.cos(u),b=f*Math.sin(u),c=t+x,l=r+b,d=1^g,_=g?u-h:h-u;if(this._x1===null)this._append`M${c},${l}`;else if(Math.abs(this._x1-c)>0.000001||Math.abs(this._y1-l)>0.000001)this._append`L${c},${l}`;if(!f)return;if(_<0)_=_%H2+H2;if(_>tq)this._append`A${f},${f},0,1,${d},${t-x},${r-b}A${f},${f},0,1,${d},${this._x1=c},${this._y1=l}`;else if(_>0.000001)this._append`A${f},${f},0,${+(_>=i2)},${d},${this._x1=t+f*Math.cos(h)},${this._y1=r+f*Math.sin(h)}`}rect(t,r,f,u){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${f=+f}v${+u}h${-f}Z`}toString(){return this._}}function ac(){return new vf}ac.prototype=vf.prototype;function Yr(t=3){return new vf(+t)}function q2(t){return Math.abs(t=Math.round(t))>=1000000000000000000000?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Xf(t,r){if(!isFinite(t)||t===0)return null;var f=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"),u=t.slice(0,f);return[u.length>1?u[0]+u.slice(2):u,+t.slice(f+1)]}function Sr(t){return t=Xf(Math.abs(t)),t?t[1]:NaN}function E2(t,r){return function(f,u){var h=f.length,g=[],x=0,b=t[0],c=0;while(h>0&&b>0){if(c+b+1>u)b=Math.max(1,u-c);if(g.push(f.substring(h-=b,h+b)),(c+=b+1)>u)break;b=t[x=(x+1)%t.length]}return g.reverse().join(r)}}function s2(t){return function(r){return r.replace(/[0-9]/g,function(f){return t[+f]})}}var fq=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function i0(t){if(!(r=fq.exec(t)))throw Error("invalid format: "+t);var r;return new i6({fill:r[1],align:r[2],sign:r[3],symbol:r[4],zero:r[5],width:r[6],comma:r[7],precision:r[8]&&r[8].slice(1),trim:r[9],type:r[10]})}i0.prototype=i6.prototype;function i6(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}i6.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function P2(t){t:for(var r=t.length,f=1,u=-1,h;f0)u=0;break}return u>0?t.slice(0,u)+t.slice(h+1):t}var rh;function n2(t,r){var f=Xf(t,r);if(!f)return rh=void 0,t.toPrecision(r);var u=f[0],h=f[1],g=h-(rh=Math.max(-8,Math.min(8,Math.floor(h/3)))*3)+1,x=u.length;return g===x?u:g>x?u+Array(g-x+1).join("0"):g>0?u.slice(0,g)+"."+u.slice(g):"0."+Array(1-g).join("0")+Xf(t,Math.max(0,r+g-1))[0]}function H6(t,r){var f=Xf(t,r);if(!f)return t+"";var u=f[0],h=f[1];return h<0?"0."+Array(-h).join("0")+u:u.length>h+1?u.slice(0,h+1)+"."+u.slice(h+1):u+Array(h-u.length+2).join("0")}var $2={"%":(t,r)=>(t*100).toFixed(r),b:(t)=>Math.round(t).toString(2),c:(t)=>t+"",d:q2,e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:(t)=>Math.round(t).toString(8),p:(t,r)=>H6(t*100,r),r:H6,s:n2,X:(t)=>Math.round(t).toString(16).toUpperCase(),x:(t)=>Math.round(t).toString(16)};function q6(t){return t}var mc=Array.prototype.map,jc=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function J2(t){var r=t.grouping===void 0||t.thousands===void 0?q6:E2(mc.call(t.grouping,Number),t.thousands+""),f=t.currency===void 0?"":t.currency[0]+"",u=t.currency===void 0?"":t.currency[1]+"",h=t.decimal===void 0?".":t.decimal+"",g=t.numerals===void 0?q6:s2(mc.call(t.numerals,String)),x=t.percent===void 0?"%":t.percent+"",b=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function l(_,w){_=i0(_);var{fill:M,align:i,sign:H,symbol:q,zero:s,width:E,comma:P,precision:n,trim:$,type:J}=_;if(J==="n")P=!0,J="g";else if(!$2[J])n===void 0&&(n=12),$=!0,J="g";if(s||M==="0"&&i==="=")s=!0,M="0",i="=";var Q=(w&&w.prefix!==void 0?w.prefix:"")+(q==="$"?f:q==="#"&&/[boxX]/.test(J)?"0"+J.toLowerCase():""),U=(q==="$"?u:/[%p]/.test(J)?x:"")+(w&&w.suffix!==void 0?w.suffix:""),e=$2[J],o=/[defgprs%]/.test(J);n=n===void 0?6:/[gprs]/.test(J)?Math.max(1,Math.min(21,n)):Math.max(0,Math.min(20,n));function K(V){var G=Q,B=U,N,W,p;if(J==="c")B=e(V)+B,V="";else{V=+V;var a=V<0||1/V<0;if(V=isNaN(V)?c:e(Math.abs(V),n),$)V=P2(V);if(a&&+V===0&&H!=="+")a=!1;if(G=(a?H==="("?H:b:H==="-"||H==="("?"":H)+G,B=(J==="s"&&!isNaN(V)&&rh!==void 0?jc[8+rh/3]:"")+B+(a&&H==="("?")":""),o){N=-1,W=V.length;while(++Np||p>57){B=(p===46?h+V.slice(N+1):V.slice(N))+B,V=V.slice(0,N);break}}}if(P&&!s)V=r(V,1/0);var T=G.length+V.length+B.length,L=T>1)+G+V+B+L.slice(T);break;default:V=L+G+V+B;break}return g(V)}return K.toString=function(){return _+""},K}function d(_,w){var M=Math.max(-8,Math.min(8,Math.floor(Sr(w)/3)))*3,i=Math.pow(10,-M),H=l((_=i0(_),_.type="f",_),{suffix:jc[8+M/3]});return function(q){return H(i*q)}}return{format:l,formatPrefix:d}}var E6,or,s6;Q2({thousands:",",grouping:[3],currency:["$",""]});function Q2(t){return E6=J2(t),or=E6.format,s6=E6.formatPrefix,E6}function P6(t){return Math.max(0,-Sr(Math.abs(t)))}function n6(t,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Sr(r)/3)))*3-Sr(Math.abs(t)))}function $6(t,r){return t=Math.abs(t),r=Math.abs(r)-t,Math.max(0,Sr(r)-Sr(t))+1}var I=0.000001,J6=0.000000000001,k=Math.PI,dt=k/2,N2=k/4,It=k*2,At=180/k,lt=k/180,ft=Math.abs,Zr=Math.atan,kt=Math.atan2,O=Math.cos;var Q6=Math.exp;var{log:Yf,pow:N6,sin:D}=Math,fr=Math.sign||function(t){return t>0?1:t<0?-1:0},Pt=Math.sqrt,Fu=Math.tan;function U6(t){return t>1?0:t<-1?k:Math.acos(t)}function et(t){return t>1?dt:t<-1?-dt:Math.asin(t)}function vt(){}function e6(t,r){if(t&&kc.hasOwnProperty(t.type))kc[t.type](t,r)}var yc={Feature:function(t,r){e6(t.geometry,r)},FeatureCollection:function(t,r){var f=t.features,u=-1,h=f.length;while(++uk)t-=Math.round(t/It)*It;return[t,r]}e2.invert=e2;function C2(t,r,f){return(t%=It)?r||f?Lu(r3(t),f3(r,f)):r3(t):r||f?f3(r,f):e2}function t3(t){return function(r,f){if(r+=t,ft(r)>k)r-=Math.round(r/It)*It;return[r,f]}}function r3(t){var r=t3(t);return r.invert=t3(-t),r}function f3(t,r){var f=O(t),u=D(t),h=O(r),g=D(r);function x(b,c){var l=O(c),d=O(b)*l,_=D(b)*l,w=D(c),M=w*f+d*u;return[kt(_*h-M*g,d*f-w*u),et(M*h+_*g)]}return x.invert=function(b,c){var l=O(c),d=O(b)*l,_=D(b)*l,w=D(c),M=w*h-_*g;return[kt(_*h+w*g,d*f+M*u),et(M*f-d*u)]},x}function K2(t){t=C2(t[0]*lt,t[1]*lt,t.length>2?t[2]*lt:0);function r(f){return f=t(f[0]*lt,f[1]*lt),f[0]*=At,f[1]*=At,f}return r.invert=function(f){return f=t.invert(f[0]*lt,f[1]*lt),f[0]*=At,f[1]*=At,f},r}function h3(t,r,f,u,h,g){if(!f)return;var x=O(r),b=D(r),c=u*f;if(h==null)h=r+u*It,g=r-c/2;else if(h=u3(x,h),g=u3(x,g),u>0?hg)h+=u*It;for(var l,d=h;u>0?d>g:d1)t.push(t.pop().concat(t.shift()))},result:function(){var f=t;return t=[],r=null,f}}}function Sf(t,r){return ft(t[0]-r[0])=0;--b)h.point((_=d[b])[0],_[1])}else u(w.x,w.p.x,-1,h);w=w.p}w=w.o,d=w.z,M=!M}while(!w.v);h.lineEnd()}}function g3(t){if(!(r=t.length))return;var r,f=0,u=t[0],h;while(++f=0?1:-1,o=e*U,K=o>k,V=q*J;if(c.add(kt(V*e*D(o),s*Q+V*O(o))),x+=K?U+e*It:U,K^i>=f^n>=f){var G=Bu(H0(M),H0(P));gh(G);var B=Bu(g,G);gh(B);var N=(K^U>=0?-1:1)*et(B[2]);if(u>N||u===N&&(G[0]||G[1]))b+=K^U>=0?1:-1}}}return(x<-I||x0){if(!c)h.polygonStart(),c=!0;h.lineStart();for(J=0;J1&&n&2)$.push($.pop().concat($.shift()));d.push($.filter(uq))}return w}}function uq(t){return t.length>1}function hq(t,r){return((t=t.x)[0]<0?t[1]-dt-I:dt-t[1])-((r=r.x)[0]<0?r[1]-dt-I:dt-r[1])}var o2=ch(function(){return!0},gq,bq,[-k,-dt]);function gq(t){var r=NaN,f=NaN,u=NaN,h;return{lineStart:function(){t.lineStart(),h=1},point:function(g,x){var b=g>0?k:-k,c=ft(g-r);if(ft(c-k)0?dt:-dt),t.point(u,f),t.lineEnd(),t.lineStart(),t.point(b,f),t.point(g,f),h=0;else if(u!==b&&c>=k){if(ft(r-u)I?Zr((D(r)*(g=O(u))*D(f)-D(u)*(h=O(r))*D(t))/(h*g*x)):(r+u)/2}function bq(t,r,f,u){var h;if(t==null)h=f*dt,u.point(-k,h),u.point(0,h),u.point(k,h),u.point(k,0),u.point(k,-h),u.point(0,-h),u.point(-k,-h),u.point(-k,0),u.point(-k,h);else if(ft(t[0]-r[0])>I){var g=t[0]0,h=ft(r)>I;function g(d,_,w,M){h3(M,t,f,w,d,_)}function x(d,_){return O(d)*O(_)>r}function b(d){var _,w,M,i,H;return{lineStart:function(){i=M=!1,H=1},point:function(q,s){var E=[q,s],P,n=x(q,s),$=u?n?0:l(q,s):n?l(q+(q<0?k:-k),s):0;if(!_&&(i=M=n))d.lineStart();if(n!==M){if(P=c(_,E),!P||Sf(_,P)||Sf(E,P))E[2]=1}if(n!==M){if(H=0,n)d.lineStart(),P=c(E,_),d.point(P[0],P[1]);else P=c(_,E),d.point(P[0],P[1],2),d.lineEnd();_=P}else if(h&&_&&u^n){var J;if(!($&w)&&(J=c(E,_,!0)))if(H=0,u)d.lineStart(),d.point(J[0][0],J[0][1]),d.point(J[1][0],J[1][1]),d.lineEnd();else d.point(J[1][0],J[1][1]),d.lineEnd(),d.lineStart(),d.point(J[0][0],J[0][1],3)}if(n&&(!_||!Sf(_,E)))d.point(E[0],E[1]);_=E,M=n,w=$},lineEnd:function(){if(M)d.lineEnd();_=null},clean:function(){return H|(i&&M)<<1}}}function c(d,_,w){var M=H0(d),i=H0(_),H=[1,0,0],q=Bu(M,i),s=uh(q,q),E=q[0],P=s-E*E;if(!P)return!w&&d;var n=r*s/P,$=-r*E/P,J=Bu(H,q),Q=hh(H,n),U=hh(q,$);C6(Q,U);var e=J,o=uh(Q,e),K=uh(e,e),V=o*o-K*(uh(Q,Q)-1);if(V<0)return;var G=Pt(V),B=hh(e,(-o-G)/K);if(C6(B,Q),B=fh(B),!w)return B;var N=d[0],W=_[0],p=d[1],a=_[1],T;if(W0^B[1]<(ft(B[0]-N)k^(N<=B[0]&&B[0]<=W)){var z=hh(e,(-o+G)/K);return C6(z,Q),[B,fh(z)]}}function l(d,_){var w=u?t:k-t,M=0;if(d<-w)M|=1;else if(d>w)M|=2;if(_<-w)M|=4;else if(_>w)M|=8;return M}return ch(x,b,g,u?[0,-t]:[-k,t-k])}function T2(t,r,f,u,h,g){var x=t[0],b=t[1],c=r[0],l=r[1],d=0,_=1,w=c-x,M=l-b,i;if(i=f-x,!w&&i>0)return;if(i/=w,w<0){if(i0){if(i>_)return;if(i>d)d=i}if(i=h-x,!w&&i<0)return;if(i/=w,w<0){if(i>_)return;if(i>d)d=i}else if(w>0){if(i0)return;if(i/=M,M<0){if(i0){if(i>_)return;if(i>d)d=i}if(i=g-b,!M&&i<0)return;if(i/=M,M<0){if(i>_)return;if(i>d)d=i}else if(M>0){if(i0)t[0]=x+d*w,t[1]=b+d*M;if(_<1)r[0]=x+_*w,r[1]=b+_*M;return!0}var dh=1e9,V6=-dh;function Gu(t,r,f,u){function h(l,d){return t<=l&&l<=f&&r<=d&&d<=u}function g(l,d,_,w){var M=0,i=0;if(l==null||(M=x(l,_))!==(i=x(d,_))||c(l,d)<0^_>0)do w.point(M===0||M===3?t:f,M>1?u:r);while((M=(M+_+4)%4)!==i);else w.point(d[0],d[1])}function x(l,d){return ft(l[0]-t)0?0:3:ft(l[0]-f)0?2:1:ft(l[1]-r)0?1:0:d>0?3:2}function b(l,d){return c(l.x,d.x)}function c(l,d){var _=x(l,1),w=x(d,1);return _!==w?_-w:_===0?d[1]-l[1]:_===1?l[0]-d[0]:_===2?l[1]-d[1]:d[0]-l[0]}return function(l){var d=l,_=xh(),w,M,i,H,q,s,E,P,n,$,J,Q={point:U,lineStart:V,lineEnd:G,polygonStart:o,polygonEnd:K};function U(N,W){if(h(N,W))d.point(N,W)}function e(){var N=0;for(var W=0,p=M.length;Wu&&(rt-X)*(u-z)>(m-z)*(t-X))++N}else if(m<=u&&(rt-X)*(u-z)<(m-z)*(t-X))--N;return N}function o(){d=_,w=[],M=[],J=!0}function K(){var N=e(),W=J&&N,p=(w=Ju(w)).length;if(W||p){if(l.polygonStart(),W)l.lineStart(),g(null,null,1,l),l.lineEnd();if(p)bh(w,b,N,g,l);l.polygonEnd()}d=l,w=M=i=null}function V(){if(Q.point=B,M)M.push(i=[]);$=!0,n=!1,E=P=NaN}function G(){if(w){if(B(H,q),s&&n)_.rejoin();w.push(_.result())}if(Q.point=U,n)d.lineEnd()}function B(N,W){var p=h(N,W);if(M)i.push([N,W]);if($){if(H=N,q=W,s=p,$=!1,p)d.lineStart(),d.point(N,W)}else if(p&&n)d.point(N,W);else{var a=[E=Math.max(V6,Math.min(dh,E)),P=Math.max(V6,Math.min(dh,P))],T=[N=Math.max(V6,Math.min(dh,N)),W=Math.max(V6,Math.min(dh,W))];if(T2(a,T,t,r,f,u)){if(!n)d.lineStart(),d.point(a[0],a[1]);if(d.point(T[0],T[1]),!p)d.lineEnd();J=!1}else if(p)d.lineStart(),d.point(N,W),J=!1}E=N,P=W,n=p}return Q}}var lh=(t)=>t;var F2=new er,B2=new er,x3,b3,L2,G2,qf={point:vt,lineStart:vt,lineEnd:vt,polygonStart:function(){qf.lineStart=cq,qf.lineEnd=lq},polygonEnd:function(){qf.lineStart=qf.lineEnd=qf.point=vt,F2.add(ft(B2)),B2=new er},result:function(){var t=F2/2;return F2=new er,t}};function cq(){qf.point=dq}function dq(t,r){qf.point=c3,x3=L2=t,b3=G2=r}function c3(t,r){B2.add(G2*t-L2*r),L2=t,G2=r}function lq(){c3(x3,b3)}var R2=qf;var Ru=1/0,W6=Ru,_h=-Ru,o6=_h,_q={point:wq,lineStart:vt,lineEnd:vt,polygonStart:vt,polygonEnd:vt,result:function(){var t=[[Ru,W6],[_h,o6]];return _h=o6=-(W6=Ru=1/0),t}};function wq(t,r){if(t_h)_h=t;if(ro6)o6=r}var zu=_q;var z2=0,A2=0,wh=0,Z6=0,T6=0,Au=0,D2=0,O2=0,Mh=0,_3,w3,q0,E0,ar={point:af,lineStart:d3,lineEnd:l3,polygonStart:function(){ar.lineStart=Hq,ar.lineEnd=qq},polygonEnd:function(){ar.point=af,ar.lineStart=d3,ar.lineEnd=l3},result:function(){var t=Mh?[D2/Mh,O2/Mh]:Au?[Z6/Au,T6/Au]:wh?[z2/wh,A2/wh]:[NaN,NaN];return z2=A2=wh=Z6=T6=Au=D2=O2=Mh=0,t}};function af(t,r){z2+=t,A2+=r,++wh}function d3(){ar.point=Mq}function Mq(t,r){ar.point=iq,af(q0=t,E0=r)}function iq(t,r){var f=t-q0,u=r-E0,h=Pt(f*f+u*u);Z6+=h*(q0+t)/2,T6+=h*(E0+r)/2,Au+=h,af(q0=t,E0=r)}function l3(){ar.point=af}function Hq(){ar.point=Eq}function qq(){M3(_3,w3)}function Eq(t,r){ar.point=M3,af(_3=q0=t,w3=E0=r)}function M3(t,r){var f=t-q0,u=r-E0,h=Pt(f*f+u*u);Z6+=h*(q0+t)/2,T6+=h*(E0+r)/2,Au+=h,h=E0*t-q0*r,D2+=h*(q0+t),O2+=h*(E0+r),Mh+=h*3,af(q0=t,E0=r)}var I2=ar;function F6(t){this._context=t}F6.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){if(this._line===0)this._context.closePath();this._point=NaN},point:function(t,r){switch(this._point){case 0:{this._context.moveTo(t,r),this._point=1;break}case 1:{this._context.lineTo(t,r);break}default:{this._context.moveTo(t+this._radius,r),this._context.arc(t,r,this._radius,0,It);break}}},result:vt};var X2=new er,v2,i3,H3,ih,Hh,B6={point:vt,lineStart:function(){B6.point=sq},lineEnd:function(){if(v2)q3(i3,H3);B6.point=vt},polygonStart:function(){v2=!0},polygonEnd:function(){v2=null},result:function(){var t=+X2;return X2=new er,t}};function sq(t,r){B6.point=q3,i3=ih=t,H3=Hh=r}function q3(t,r){ih-=t,Hh-=r,X2.add(Pt(ih*ih+Hh*Hh)),ih=t,Hh=r}var Y2=B6;var E3,L6,s3,P3;class qh{constructor(t){this._append=t==null?n3:Pq(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){if(this._line===0)this._+="Z";this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==s3||this._append!==L6){let f=this._radius,u=this._;this._="",this._append`m0,${f}a${f},${f} 0 1,1 0,${-2*f}a${f},${f} 0 1,1 0,${2*f}z`,s3=f,L6=this._append,P3=this._,this._=u}this._+=P3;break}}}result(){let t=this._;return this._="",t.length?t:null}}function n3(t){let r=1;this._+=t[0];for(let f=t.length;r=0))throw RangeError(`invalid digits: ${t}`);if(r>15)return n3;if(r!==E3){let f=10**r;E3=r,L6=function(h){let g=1;this._+=h[0];for(let x=h.length;g=0))throw RangeError(`invalid digits: ${b}`);f=c}if(r===null)g=new qh(f);return x},x.projection(t).digits(f).context(r)}function jf(t){return{stream:Du(t)}}function Du(t){return function(r){var f=new S2;for(var u in t)f[u]=t[u];return f.stream=r,f}}function S2(){}S2.prototype={constructor:S2,point:function(t,r){this.stream.point(t,r)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function a2(t,r,f){var u=t.clipExtent&&t.clipExtent();if(t.scale(150).translate([0,0]),u!=null)t.clipExtent(null);if(Tr(f,t.stream(zu)),r(zu.result()),u!=null)t.clipExtent(u);return t}function Eh(t,r,f){return a2(t,function(u){var h=r[1][0]-r[0][0],g=r[1][1]-r[0][1],x=Math.min(h/(u[1][0]-u[0][0]),g/(u[1][1]-u[0][1])),b=+r[0][0]+(h-x*(u[1][0]+u[0][0]))/2,c=+r[0][1]+(g-x*(u[1][1]+u[0][1]))/2;t.scale(150*x).translate([b,c])},f)}function G6(t,r,f){return Eh(t,[[0,0],r],f)}function R6(t,r,f){return a2(t,function(u){var h=+r,g=h/(u[1][0]-u[0][0]),x=(h-g*(u[1][0]+u[0][0]))/2,b=-g*u[0][1];t.scale(150*g).translate([x,b])},f)}function z6(t,r,f){return a2(t,function(u){var h=+r,g=h/(u[1][1]-u[0][1]),x=-g*u[0][0],b=(h-g*(u[1][1]+u[0][1]))/2;t.scale(150*g).translate([x,b])},f)}var $3=16,nq=O(30*lt);function A6(t,r){return+r?Jq(t,r):$q(t)}function $q(t){return Du({point:function(r,f){r=t(r,f),this.stream.point(r[0],r[1])}})}function Jq(t,r){function f(u,h,g,x,b,c,l,d,_,w,M,i,H,q){var s=l-u,E=d-h,P=s*s+E*E;if(P>4*r&&H--){var n=x+w,$=b+M,J=c+i,Q=Pt(n*n+$*$+J*J),U=et(J/=Q),e=ft(ft(J)-1)r||ft((s*G+E*B)/P-0.5)>0.3||x*w+b*M+c*i2?N[2]%360*lt:0,G()):[b*At,c*At,l*At]},K.angle=function(N){return arguments.length?(_=N%360*lt,G()):_*At},K.reflectX=function(N){return arguments.length?(w=N?-1:1,G()):w<0},K.reflectY=function(N){return arguments.length?(M=N?-1:1,G()):M<0},K.precision=function(N){return arguments.length?(J=A6(Q,$=N*N),B()):Pt($)},K.fitExtent=function(N,W){return Eh(K,N,W)},K.fitSize=function(N,W){return G6(K,N,W)},K.fitWidth=function(N,W){return R6(K,N,W)},K.fitHeight=function(N,W){return z6(K,N,W)};function G(){var N=J3(f,0,0,w,M,_).apply(null,r(g,x)),W=J3(f,u-N[0],h-N[1],w,M,_);return d=C2(b,c,l),Q=Lu(r,W),U=Lu(d,Q),J=A6(Q,$),B()}function B(){return e=o=null,K}return function(){return r=t.apply(this,arguments),K.invert=r.invert&&V,G()}}function Ou(t){var r=0,f=k/3,u=m2(t),h=u(r,f);return h.parallels=function(g){return arguments.length?u(r=g[0]*lt,f=g[1]*lt):[r*At,f*At]},h}function Q3(t){var r=O(t);function f(u,h){return[u*r,D(h)/r]}return f.invert=function(u,h){return[u/r,et(h*r)]},f}function N3(t,r){var f=D(t),u=(f+D(r))/2;if(ft(u)=0.12&&q<0.234&&H>=-0.425&&H<-0.214?h:q>=0.166&&q<0.234&&H>=-0.214&&H<-0.115?x:f).invert(w)},d.stream=function(w){return t&&r===w?t:t=eq([f.stream(r=w),h.stream(w),x.stream(w)])},d.precision=function(w){if(!arguments.length)return f.precision();return f.precision(w),h.precision(w),x.precision(w),_()},d.scale=function(w){if(!arguments.length)return f.scale();return f.scale(w),h.scale(w*0.35),x.scale(w),d.translate(f.translate())},d.translate=function(w){if(!arguments.length)return f.translate();var M=f.scale(),i=+w[0],H=+w[1];return u=f.translate(w).clipExtent([[i-0.455*M,H-0.238*M],[i+0.455*M,H+0.238*M]]).stream(l),g=h.translate([i-0.307*M,H+0.201*M]).clipExtent([[i-0.425*M+I,H+0.12*M+I],[i-0.214*M-I,H+0.234*M-I]]).stream(l),b=x.translate([i-0.205*M,H+0.212*M]).clipExtent([[i-0.214*M+I,H+0.166*M+I],[i-0.115*M-I,H+0.234*M-I]]).stream(l),_()},d.fitExtent=function(w,M){return Eh(d,w,M)},d.fitSize=function(w,M){return G6(d,w,M)},d.fitWidth=function(w,M){return R6(d,w,M)},d.fitHeight=function(w,M){return z6(d,w,M)};function _(){return t=r=null,d}return d.scale(1070)}function O6(t){return function(r,f){var u=O(r),h=O(f),g=t(u*h);if(g===1/0)return[2,0];return[g*h*D(r),g*D(f)]}}function s0(t){return function(r,f){var u=Pt(r*r+f*f),h=t(u),g=D(h),x=O(h);return[kt(r*g,u*x),et(u&&f*g/u)]}}var j2=O6(function(t){return Pt(2/(1+t))});j2.invert=s0(function(t){return 2*et(t/2)});function I6(){return pt(j2).scale(124.75).clipAngle(179.999)}var y2=O6(function(t){return(t=U6(t))&&t/D(t)});y2.invert=s0(function(t){return t});function v6(){return pt(y2).scale(79.4188).clipAngle(179.999)}function vu(t,r){return[t,Yf(Fu((dt+r)/2))]}vu.invert=function(t,r){return[t,2*Zr(Q6(r))-dt]};function X6(){return k2(vu).scale(961/It)}function k2(t){var r=pt(t),f=r.center,u=r.scale,h=r.translate,g=r.clipExtent,x=null,b,c,l;r.scale=function(_){return arguments.length?(u(_),d()):u()},r.translate=function(_){return arguments.length?(h(_),d()):h()},r.center=function(_){return arguments.length?(f(_),d()):f()},r.clipExtent=function(_){return arguments.length?(_==null?x=b=c=l=null:(x=+_[0][0],b=+_[0][1],c=+_[1][0],l=+_[1][1]),d()):x==null?null:[[x,b],[c,l]]};function d(){var _=k*u(),w=r(K2(r.rotate()).invert([0,0]));return g(x==null?[[w[0]-_,w[1]-_],[w[0]+_,w[1]+_]]:t===vu?[[Math.max(w[0]-_,x),b],[Math.min(w[0]+_,c),l]]:[[x,Math.max(w[1]-_,b)],[c,Math.min(w[1]+_,l)]])}return d()}function Y6(t){return Fu((dt+t)/2)}function U3(t,r){var f=O(t),u=t===r?D(t):Yf(f/O(r))/Yf(Y6(r)/Y6(t)),h=f*N6(Y6(t),u)/u;if(!u)return vu;function g(x,b){if(h>0){if(b<-dt+I)b=-dt+I}else if(b>dt-I)b=dt-I;var c=h/N6(Y6(b),u);return[c*D(u*x),h-c*O(u*x)]}return g.invert=function(x,b){var c=h-b,l=fr(u)*Pt(x*x+c*c),d=kt(x,ft(c))*fr(c);if(c*u<0)d-=k*fr(x)*fr(c);return[d/u,2*Zr(N6(h/l,1/u))-dt]},g}function S6(){return Ou(U3).scale(109.5).parallels([30,30])}function Xu(t,r){return[t,r]}Xu.invert=Xu;function a6(){return pt(Xu).scale(152.63)}function e3(t,r){var f=O(t),u=t===r?D(t):(f-O(r))/(r-t),h=f/u+t;if(ft(u)2?u[2]+90:90]):(u=f(),[u[0],u[1],u[2]-90])},f([0,0,90]).scale(159.155)}function Gt(t,r){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(r).domain(t);break}return this}function Jh(t,r){switch(arguments.length){case 0:break;case 1:{if(typeof t==="function")this.interpolator(t);else this.range(t);break}default:{if(this.domain(t),typeof r==="function")this.interpolator(r);else this.range(r);break}}return this}var Qh=Symbol("implicit");function yf(){var t=new Mr,r=[],f=[],u=Qh;function h(g){let x=t.get(g);if(x===void 0){if(u!==Qh)return u;t.set(g,x=r.push(g)-1)}return f[x%f.length]}return h.domain=function(g){if(!arguments.length)return r.slice();r=[],t=new Mr;for(let x of g){if(t.has(x))continue;t.set(x,r.push(x)-1)}return h},h.range=function(g){return arguments.length?(f=Array.from(g),h):f.slice()},h.unknown=function(g){return arguments.length?(u=g,h):u},h.copy=function(){return yf(r,f).unknown(u)},Gt.apply(h,arguments),h}function Ef(){var t=yf().unknown(void 0),r=t.domain,f=t.range,u=0,h=1,g,x,b=!1,c=0,l=0,d=0.5;delete t.unknown;function _(){var w=r().length,M=hr)f=t,t=r,r=f;return function(u){return Math.max(t,Math.min(r,u))}}function Vq(t,r,f){var u=t[0],h=t[1],g=r[0],x=r[1];if(h2?Wq:Vq,c=l=null,_}function _(w){return w==null||isNaN(w=+w)?g:(c||(c=b(t.map(u),r,f)))(u(x(w)))}return _.invert=function(w){return x(h((l||(l=b(r,t.map(u),st)))(w)))},_.domain=function(w){return arguments.length?(t=Array.from(w,Yu),d()):t.slice()},_.range=function(w){return arguments.length?(r=Array.from(w),d()):r.slice()},_.rangeRound=function(w){return r=Array.from(w),f=Hf,d()},_.clamp=function(w){return arguments.length?(x=w?!0:ir,d()):x!==ir},_.interpolate=function(w){return arguments.length?(f=w,d()):f},_.unknown=function(w){return arguments.length?(g=w,_):g},function(w,M){return u=w,h=M,d()}}function Nh(){return kf()(ir,ir)}function bg(t,r,f,u){var h=$u(t,r,f),g;switch(u=i0(u==null?",f":u),u.type){case"s":{var x=Math.max(Math.abs(t),Math.abs(r));if(u.precision==null&&!isNaN(g=n6(h,x)))u.precision=g;return s6(u,x)}case"":case"e":case"g":case"p":case"r":{if(u.precision==null&&!isNaN(g=$6(h,Math.max(Math.abs(t),Math.abs(r)))))u.precision=g-(u.type==="e");break}case"f":case"%":{if(u.precision==null&&!isNaN(g=P6(h)))u.precision=g-(u.type==="%")*2;break}}return or(u)}function X0(t){var r=t.domain;return t.ticks=function(f){var u=r();return Ir(u[0],u[u.length-1],f==null?10:f)},t.tickFormat=function(f,u){var h=r();return bg(h[0],h[h.length-1],f==null?10:f,u)},t.nice=function(f){if(f==null)f=10;var u=r(),h=0,g=u.length-1,x=u[h],b=u[g],c,l,d=10;if(b0){if(l=Lf(x,b,f),l===c)return u[h]=x,u[g]=b,r(u);else if(l>0)x=Math.floor(x/l)*l,b=Math.ceil(b/l)*l;else if(l<0)x=Math.ceil(x*l)/l,b=Math.floor(b*l)/l;else break;c=l}return t},t}function pf(){var t=Nh();return t.copy=function(){return P0(t,pf())},Gt.apply(t,arguments),X0(t)}function Uh(t){var r;function f(u){return u==null||isNaN(u=+u)?r:u}return f.invert=f,f.domain=f.range=function(u){return arguments.length?(t=Array.from(u,Yu),f):t.slice()},f.unknown=function(u){return arguments.length?(r=u,f):r},f.copy=function(){return Uh(t).unknown(r)},t=arguments.length?Array.from(t,Yu):[0,1],X0(f)}function eh(t,r){t=t.slice();var f=0,u=t.length-1,h=t[f],g=t[u],x;if(gMath.pow(t,r)}function Bq(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),(r)=>Math.log(r)/t)}function o3(t){return(r,f)=>-t(-r,f)}function cg(t){let r=t(V3,W3),f=r.domain,u=10,h,g;function x(){if(h=Bq(u),g=Fq(u),f()[0]<0)h=o3(h),g=o3(g),t(oq,Zq);else t(V3,W3);return r}return r.base=function(b){return arguments.length?(u=+b,x()):u},r.domain=function(b){return arguments.length?(f(b),x()):f()},r.ticks=(b)=>{let c=f(),l=c[0],d=c[c.length-1],_=d0)for(;w<=M;++w)for(i=1;id)break;s.push(H)}else for(;w<=M;++w)for(i=u-1;i>=1;--i){if(H=w>0?i/g(-w):i*g(w),Hd)break;s.push(H)}if(s.length*2{if(b==null)b=10;if(c==null)c=u===10?"s":",";if(typeof c!=="function"){if(!(u%1)&&(c=i0(c)).precision==null)c.trim=!0;c=or(c)}if(b===1/0)return c;let l=Math.max(1,u*b/r.ticks().length);return(d)=>{let _=d/g(Math.round(h(d)));if(_*u{return f(eh(f(),{floor:(b)=>g(Math.floor(h(b))),ceil:(b)=>g(Math.ceil(h(b)))}))},r}function Ch(){let t=cg(kf()).domain([1,10]);return t.copy=()=>P0(t,Ch()).base(t.base()),Gt.apply(t,arguments),t}function Z3(t){return function(r){return Math.sign(r)*Math.log1p(Math.abs(r/t))}}function T3(t){return function(r){return Math.sign(r)*Math.expm1(Math.abs(r))*t}}function dg(t){var r=1,f=t(Z3(r),T3(r));return f.constant=function(u){return arguments.length?t(Z3(r=+u),T3(r)):r},X0(f)}function Kh(){var t=dg(kf());return t.copy=function(){return P0(t,Kh()).constant(t.constant())},Gt.apply(t,arguments)}function F3(t){return function(r){return r<0?-Math.pow(-r,t):Math.pow(r,t)}}function Lq(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Gq(t){return t<0?-t*t:t*t}function lg(t){var r=t(ir,ir),f=1;function u(){return f===1?t(ir,ir):f===0.5?t(Lq,Gq):t(F3(f),F3(1/f))}return r.exponent=function(h){return arguments.length?(f=+h,u()):f},X0(r)}function Vh(){var t=lg(kf());return t.copy=function(){return P0(t,Vh()).exponent(t.exponent())},Gt.apply(t,arguments),t}function Wh(){var t=[],r=[],f=[],u;function h(){var x=0,b=Math.max(1,r.length);f=Array(b-1);while(++x0?f[b-1]:t[0],b{return t(g=new Date(+g)),g},h.ceil=(g)=>{return t(g=new Date(g-1)),r(g,1),t(g),g},h.round=(g)=>{let x=h(g),b=h.ceil(g);return g-x{return r(g=new Date(+g),x==null?1:Math.floor(x)),g},h.range=(g,x,b)=>{let c=[];if(g=h.ceil(g),b=b==null?1:Math.floor(b),!(g0))return c;let l;do c.push(l=new Date(+g)),r(g,b),t(g);while(l{return qt((x)=>{if(x>=x)while(t(x),!g(x))x.setTime(x-1)},(x,b)=>{if(x>=x)if(b<0)while(++b<=0)while(r(x,-1),!g(x));else while(--b>=0)while(r(x,1),!g(x));})},f)h.count=(g,x)=>{return _g.setTime(+g),wg.setTime(+x),t(_g),t(wg),Math.floor(f(_g,wg))},h.every=(g)=>{return g=Math.floor(g),!isFinite(g)||!(g>0)?null:!(g>1)?h:h.filter(u?(x)=>u(x)%g===0:(x)=>h.count(0,x)%g===0)};return h}var Zh=qt(()=>{},(t,r)=>{t.setTime(+t+r)},(t,r)=>{return r-t});Zh.every=(t)=>{if(t=Math.floor(t),!isFinite(t)||!(t>0))return null;if(!(t>1))return Zh;return qt((r)=>{r.setTime(Math.floor(r/t)*t)},(r,f)=>{r.setTime(+r+f*t)},(r,f)=>{return(f-r)/t})};var hB=Zh.range;var Fr=1000,ur=60000,n0=3600000,sf=86400000,Th=604800000,Mg=2592000000,f5=31536000000;var Xt=qt((t)=>{t.setTime(t-t.getMilliseconds())},(t,r)=>{t.setTime(+t+r*Fr)},(t,r)=>{return(r-t)/Fr},(t)=>{return t.getUTCSeconds()}),B3=Xt.range;var Y0=qt((t)=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Fr)},(t,r)=>{t.setTime(+t+r*ur)},(t,r)=>{return(r-t)/ur},(t)=>{return t.getMinutes()}),Rq=Y0.range,S0=qt((t)=>{t.setUTCSeconds(0,0)},(t,r)=>{t.setTime(+t+r*ur)},(t,r)=>{return(r-t)/ur},(t)=>{return t.getUTCMinutes()}),zq=S0.range;var a0=qt((t)=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Fr-t.getMinutes()*ur)},(t,r)=>{t.setTime(+t+r*n0)},(t,r)=>{return(r-t)/n0},(t)=>{return t.getHours()}),Aq=a0.range,m0=qt((t)=>{t.setUTCMinutes(0,0,0)},(t,r)=>{t.setTime(+t+r*n0)},(t,r)=>{return(r-t)/n0},(t)=>{return t.getUTCHours()}),Dq=m0.range;var Br=qt((t)=>t.setHours(0,0,0,0),(t,r)=>t.setDate(t.getDate()+r),(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*ur)/sf,(t)=>t.getDate()-1),Oq=Br.range,tu=qt((t)=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>{return(r-t)/sf},(t)=>{return t.getUTCDate()-1}),Iq=tu.range,ru=qt((t)=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>{return(r-t)/sf},(t)=>{return Math.floor(t/sf)}),vq=ru.range;function fu(t){return qt((r)=>{r.setDate(r.getDate()-(r.getDay()+7-t)%7),r.setHours(0,0,0,0)},(r,f)=>{r.setDate(r.getDate()+f*7)},(r,f)=>{return(f-r-(f.getTimezoneOffset()-r.getTimezoneOffset())*ur)/Th})}var nr=fu(0),Pf=fu(1),u5=fu(2),h5=fu(3),$0=fu(4),g5=fu(5),x5=fu(6),L3=nr.range,Xq=Pf.range,Yq=u5.range,Sq=h5.range,aq=$0.range,mq=g5.range,jq=x5.range;function uu(t){return qt((r)=>{r.setUTCDate(r.getUTCDate()-(r.getUTCDay()+7-t)%7),r.setUTCHours(0,0,0,0)},(r,f)=>{r.setUTCDate(r.getUTCDate()+f*7)},(r,f)=>{return(f-r)/Th})}var $r=uu(0),nf=uu(1),b5=uu(2),c5=uu(3),J0=uu(4),d5=uu(5),l5=uu(6),G3=$r.range,yq=nf.range,kq=b5.range,pq=c5.range,tE=J0.range,rE=d5.range,fE=l5.range;var j0=qt((t)=>{t.setDate(1),t.setHours(0,0,0,0)},(t,r)=>{t.setMonth(t.getMonth()+r)},(t,r)=>{return r.getMonth()-t.getMonth()+(r.getFullYear()-t.getFullYear())*12},(t)=>{return t.getMonth()}),uE=j0.range,y0=qt((t)=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCMonth(t.getUTCMonth()+r)},(t,r)=>{return r.getUTCMonth()-t.getUTCMonth()+(r.getUTCFullYear()-t.getUTCFullYear())*12},(t)=>{return t.getUTCMonth()}),hE=y0.range;var hr=qt((t)=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r)},(t,r)=>{return r.getFullYear()-t.getFullYear()},(t)=>{return t.getFullYear()});hr.every=(t)=>{return!isFinite(t=Math.floor(t))||!(t>0)?null:qt((r)=>{r.setFullYear(Math.floor(r.getFullYear()/t)*t),r.setMonth(0,1),r.setHours(0,0,0,0)},(r,f)=>{r.setFullYear(r.getFullYear()+f*t)})};var gE=hr.range,gr=qt((t)=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r)},(t,r)=>{return r.getUTCFullYear()-t.getUTCFullYear()},(t)=>{return t.getUTCFullYear()});gr.every=(t)=>{return!isFinite(t=Math.floor(t))||!(t>0)?null:qt((r)=>{r.setUTCFullYear(Math.floor(r.getUTCFullYear()/t)*t),r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,f)=>{r.setUTCFullYear(r.getUTCFullYear()+f*t)})};var xE=gr.range;function R3(t,r,f,u,h,g){let x=[[Xt,1,Fr],[Xt,5,5*Fr],[Xt,15,15*Fr],[Xt,30,30*Fr],[g,1,ur],[g,5,5*ur],[g,15,15*ur],[g,30,30*ur],[h,1,n0],[h,3,3*n0],[h,6,6*n0],[h,12,12*n0],[u,1,sf],[u,2,2*sf],[f,1,Th],[r,1,Mg],[r,3,3*Mg],[t,1,f5]];function b(l,d,_){let w=dq).right(x,w);if(M===x.length)return t.every($u(l/f5,d/f5,_));if(M===0)return Zh.every(Math.max($u(l,d,_),1));let[i,H]=x[w/x[M-1][2]53)return null;if(!("w"in C))C.w=1;if("Z"in C)tt=sg(Bh(C.y,0,1)),ct=tt.getUTCDay(),tt=ct>4||ct===0?nf.ceil(tt):nf(tt),tt=tu.offset(tt,(C.V-1)*7),C.y=tt.getUTCFullYear(),C.m=tt.getUTCMonth(),C.d=tt.getUTCDate()+(C.w+6)%7;else tt=Eg(Bh(C.y,0,1)),ct=tt.getDay(),tt=ct>4||ct===0?Pf.ceil(tt):Pf(tt),tt=Br.offset(tt,(C.V-1)*7),C.y=tt.getFullYear(),C.m=tt.getMonth(),C.d=tt.getDate()+(C.w+6)%7}else if("W"in C||"U"in C){if(!("w"in C))C.w="u"in C?C.u%7:("W"in C)?1:0;ct="Z"in C?sg(Bh(C.y,0,1)).getUTCDay():Eg(Bh(C.y,0,1)).getDay(),C.m=0,C.d="W"in C?(C.w+6)%7+C.W*7-(ct+5)%7:C.w+C.U*7-(ct+6)%7}if("Z"in C)return C.H+=C.Z/100|0,C.M+=C.Z%100,sg(C);return Eg(C)}}function U(Z,R,S,C){var ut=0,tt=R.length,ct=S.length,Jt,mt;while(ut=ct)return-1;if(Jt=R.charCodeAt(ut++),Jt===37){if(Jt=R.charAt(ut++),mt=$[Jt in z3?R.charAt(ut++):Jt],!mt||(C=mt(Z,S,C))<0)return-1}else if(Jt!=S.charCodeAt(C++))return-1}return C}function e(Z,R,S){var C=l.exec(R.slice(S));return C?(Z.p=d.get(C[0].toLowerCase()),S+C[0].length):-1}function o(Z,R,S){var C=M.exec(R.slice(S));return C?(Z.w=i.get(C[0].toLowerCase()),S+C[0].length):-1}function K(Z,R,S){var C=_.exec(R.slice(S));return C?(Z.w=w.get(C[0].toLowerCase()),S+C[0].length):-1}function V(Z,R,S){var C=s.exec(R.slice(S));return C?(Z.m=E.get(C[0].toLowerCase()),S+C[0].length):-1}function G(Z,R,S){var C=H.exec(R.slice(S));return C?(Z.m=q.get(C[0].toLowerCase()),S+C[0].length):-1}function B(Z,R,S){return U(Z,r,R,S)}function N(Z,R,S){return U(Z,f,R,S)}function W(Z,R,S){return U(Z,u,R,S)}function p(Z){return x[Z.getDay()]}function a(Z){return g[Z.getDay()]}function T(Z){return c[Z.getMonth()]}function L(Z){return b[Z.getMonth()]}function A(Z){return h[+(Z.getHours()>=12)]}function X(Z){return 1+~~(Z.getMonth()/3)}function z(Z){return x[Z.getUTCDay()]}function rt(Z){return g[Z.getUTCDay()]}function m(Z){return c[Z.getUTCMonth()]}function ht(Z){return b[Z.getUTCMonth()]}function Y(Z){return h[+(Z.getUTCHours()>=12)]}function j(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var R=J(Z+="",P);return R.toString=function(){return Z},R},parse:function(Z){var R=Q(Z+="",!1);return R.toString=function(){return Z},R},utcFormat:function(Z){var R=J(Z+="",n);return R.toString=function(){return Z},R},utcParse:function(Z){var R=Q(Z+="",!0);return R.toString=function(){return Z},R}}}var z3={"-":"",_:" ","0":"0"},Yt=/^\s*\d+/,bE=/^%/,cE=/[\\^$*+?|[\]().{}]/g;function xt(t,r,f){var u=t<0?"-":"",h=(u?-t:t)+"",g=h.length;return u+(g[r.toLowerCase(),f]))}function lE(t,r,f){var u=Yt.exec(r.slice(f,f+1));return u?(t.w=+u[0],f+u[0].length):-1}function _E(t,r,f){var u=Yt.exec(r.slice(f,f+1));return u?(t.u=+u[0],f+u[0].length):-1}function wE(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.U=+u[0],f+u[0].length):-1}function ME(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.V=+u[0],f+u[0].length):-1}function iE(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.W=+u[0],f+u[0].length):-1}function A3(t,r,f){var u=Yt.exec(r.slice(f,f+4));return u?(t.y=+u[0],f+u[0].length):-1}function D3(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.y=+u[0]+(+u[0]>68?1900:2000),f+u[0].length):-1}function HE(t,r,f){var u=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(r.slice(f,f+6));return u?(t.Z=u[1]?0:-(u[2]+(u[3]||"00")),f+u[0].length):-1}function qE(t,r,f){var u=Yt.exec(r.slice(f,f+1));return u?(t.q=u[0]*3-3,f+u[0].length):-1}function EE(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.m=u[0]-1,f+u[0].length):-1}function O3(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.d=+u[0],f+u[0].length):-1}function sE(t,r,f){var u=Yt.exec(r.slice(f,f+3));return u?(t.m=0,t.d=+u[0],f+u[0].length):-1}function I3(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.H=+u[0],f+u[0].length):-1}function PE(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.M=+u[0],f+u[0].length):-1}function nE(t,r,f){var u=Yt.exec(r.slice(f,f+2));return u?(t.S=+u[0],f+u[0].length):-1}function $E(t,r,f){var u=Yt.exec(r.slice(f,f+3));return u?(t.L=+u[0],f+u[0].length):-1}function JE(t,r,f){var u=Yt.exec(r.slice(f,f+6));return u?(t.L=Math.floor(u[0]/1000),f+u[0].length):-1}function QE(t,r,f){var u=bE.exec(r.slice(f,f+1));return u?f+u[0].length:-1}function NE(t,r,f){var u=Yt.exec(r.slice(f));return u?(t.Q=+u[0],f+u[0].length):-1}function UE(t,r,f){var u=Yt.exec(r.slice(f));return u?(t.s=+u[0],f+u[0].length):-1}function v3(t,r){return xt(t.getDate(),r,2)}function eE(t,r){return xt(t.getHours(),r,2)}function CE(t,r){return xt(t.getHours()%12||12,r,2)}function KE(t,r){return xt(1+Br.count(hr(t),t),r,3)}function m3(t,r){return xt(t.getMilliseconds(),r,3)}function VE(t,r){return m3(t,r)+"000"}function WE(t,r){return xt(t.getMonth()+1,r,2)}function oE(t,r){return xt(t.getMinutes(),r,2)}function ZE(t,r){return xt(t.getSeconds(),r,2)}function TE(t){var r=t.getDay();return r===0?7:r}function FE(t,r){return xt(nr.count(hr(t)-1,t),r,2)}function j3(t){var r=t.getDay();return r>=4||r===0?$0(t):$0.ceil(t)}function BE(t,r){return t=j3(t),xt($0.count(hr(t),t)+(hr(t).getDay()===4),r,2)}function LE(t){return t.getDay()}function GE(t,r){return xt(Pf.count(hr(t)-1,t),r,2)}function RE(t,r){return xt(t.getFullYear()%100,r,2)}function zE(t,r){return t=j3(t),xt(t.getFullYear()%100,r,2)}function AE(t,r){return xt(t.getFullYear()%1e4,r,4)}function DE(t,r){var f=t.getDay();return t=f>=4||f===0?$0(t):$0.ceil(t),xt(t.getFullYear()%1e4,r,4)}function OE(t){var r=t.getTimezoneOffset();return(r>0?"-":(r*=-1,"+"))+xt(r/60|0,"0",2)+xt(r%60,"0",2)}function X3(t,r){return xt(t.getUTCDate(),r,2)}function IE(t,r){return xt(t.getUTCHours(),r,2)}function vE(t,r){return xt(t.getUTCHours()%12||12,r,2)}function XE(t,r){return xt(1+tu.count(gr(t),t),r,3)}function y3(t,r){return xt(t.getUTCMilliseconds(),r,3)}function YE(t,r){return y3(t,r)+"000"}function SE(t,r){return xt(t.getUTCMonth()+1,r,2)}function aE(t,r){return xt(t.getUTCMinutes(),r,2)}function mE(t,r){return xt(t.getUTCSeconds(),r,2)}function jE(t){var r=t.getUTCDay();return r===0?7:r}function yE(t,r){return xt($r.count(gr(t)-1,t),r,2)}function k3(t){var r=t.getUTCDay();return r>=4||r===0?J0(t):J0.ceil(t)}function kE(t,r){return t=k3(t),xt(J0.count(gr(t),t)+(gr(t).getUTCDay()===4),r,2)}function pE(t){return t.getUTCDay()}function ts(t,r){return xt(nf.count(gr(t)-1,t),r,2)}function rs(t,r){return xt(t.getUTCFullYear()%100,r,2)}function fs(t,r){return t=k3(t),xt(t.getUTCFullYear()%100,r,2)}function us(t,r){return xt(t.getUTCFullYear()%1e4,r,4)}function hs(t,r){var f=t.getUTCDay();return t=f>=4||f===0?J0(t):J0.ceil(t),xt(t.getUTCFullYear()%1e4,r,4)}function gs(){return"+0000"}function Y3(){return"%"}function S3(t){return+t}function a3(t){return Math.floor(+t/1000)}var Su,au,p3,Q0,td;ng({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function ng(t){return Su=Pg(t),au=Su.format,p3=Su.parse,Q0=Su.utcFormat,td=Su.utcParse,Su}function xs(t){return new Date(t)}function bs(t){return t instanceof Date?+t:+new Date(+t)}function _5(t,r,f,u,h,g,x,b,c,l){var d=Nh(),_=d.invert,w=d.domain,M=l(".%L"),i=l(":%S"),H=l("%I:%M"),q=l("%I %p"),s=l("%a %d"),E=l("%b %d"),P=l("%B"),n=l("%Y");function $(J){return(c(J)F9(t[t.length-1]);var s5=[,,,].concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(F),P5=v(s5);var n5=[,,,].concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(F),$5=v(n5);var J5=[,,,].concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(F),Q5=v(J5);var N5=[,,,].concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(F),U5=v(N5);var Ah=[,,,].concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(F),mu=v(Ah);var e5=[,,,].concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(F),C5=v(e5);var Dh=[,,,].concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(F),ju=v(Dh);var K5=[,,,].concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(F),V5=v(K5);var W5=[,,,].concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(F),o5=v(W5);var Z5=[,,,].concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(F),T5=v(Z5);var F5=[,,,].concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(F),B5=v(F5);var L5=[,,,].concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(F),G5=v(L5);var R5=[,,,].concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(F),z5=v(R5);var A5=[,,,].concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(F),D5=v(A5);var O5=[,,,].concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(F),I5=v(O5);var v5=[,,,].concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(F),X5=v(v5);var Y5=[,,,].concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(F),S5=v(Y5);var a5=[,,,].concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(F),m5=v(a5);var j5=[,,,].concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(F),y5=v(j5);var k5=[,,,].concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(F),p5=v(k5);var t7=[,,,].concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(F),r7=v(t7);var f7=[,,,].concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(F),u7=v(f7);var h7=[,,,].concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(F),g7=v(h7);var x7=[,,,].concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(F),b7=v(x7);var c7=[,,,].concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(F),d7=v(c7);var l7=[,,,].concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(F),_7=v(l7);var w7=[,,,].concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(F),M7=v(w7);function Oh(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}var i7=ou(cr(300,0.5,0),cr(-240,0.5,1));var q7=ou(cr(-100,0.75,0.35),cr(80,1.5,0.8)),E7=ou(cr(260,0.75,0.35),cr(80,1.5,0.8)),H7=cr();function Ih(t){if(t<0||t>1)t-=Math.floor(t);var r=Math.abs(t-0.5);return H7.h=360*t-100,H7.s=1.5-1.5*r,H7.l=0.8-0.9*r,H7+""}var s7=Kr(),cs=Math.PI/3,ds=Math.PI*2/3;function vh(t){var r;return t=(0.5-t)*Math.PI,s7.r=255*(r=Math.sin(t))*r,s7.g=255*(r=Math.sin(t+cs))*r,s7.b=255*(r=Math.sin(t+ds))*r,s7+""}function Xh(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function P7(t){var r=t.length;return function(f){return t[Math.max(0,Math.min(r-1,Math.floor(f*r)))]}}var n7=P7(F("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),$7=P7(F("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),J7=P7(F("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Q7=P7(F("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Wt(t){return function(){return t}}var Zg=Math.cos;var{min:yu,sin:Yh,sqrt:bt}=Math,Tg=0.000000000001,hu=Math.PI,Lz=hu/2,ku=2*hu;function N7(t){let r=3;return t.digits=function(f){if(!arguments.length)return r;if(f==null)r=null;else{let u=Math.floor(f);if(!(u>=0))throw RangeError(`invalid digits: ${f}`);r=u}return t},()=>new vf(r)}var Az=Array.prototype.slice;function Sh(t){return typeof t==="object"&&"length"in t?t:Array.from(t)}function rd(t){this._context=t}rd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._context.lineTo(t,r);break}}};function N0(t){return new rd(t)}function U7(t){return t[0]}function e7(t){return t[1]}function pu(t,r){var f=Wt(!0),u=null,h=N0,g=null,x=N7(b);t=typeof t==="function"?t:t===void 0?U7:Wt(t),r=typeof r==="function"?r:r===void 0?e7:Wt(r);function b(c){var l,d=(c=Sh(c)).length,_,w=!1,M;if(u==null)g=h(M=x());for(l=0;l<=d;++l){if(!(l=M;--i)b.point(P[i],n[i]);b.lineEnd(),b.areaEnd()}if(s)P[w]=+t(q,w,_),n[w]=+r(q,w,_),b.point(u?+u(q,w,_):P[w],f?+f(q,w,_):n[w])}if(E)return b=null,E+""||null}function d(){return pu().defined(h).curve(x).context(g)}return l.x=function(_){return arguments.length?(t=typeof _==="function"?_:Wt(+_),u=null,l):t},l.x0=function(_){return arguments.length?(t=typeof _==="function"?_:Wt(+_),l):t},l.x1=function(_){return arguments.length?(u=_==null?null:typeof _==="function"?_:Wt(+_),l):u},l.y=function(_){return arguments.length?(r=typeof _==="function"?_:Wt(+_),f=null,l):r},l.y0=function(_){return arguments.length?(r=typeof _==="function"?_:Wt(+_),l):r},l.y1=function(_){return arguments.length?(f=_==null?null:typeof _==="function"?_:Wt(+_),l):f},l.lineX0=l.lineY0=function(){return d().x(t).y(r)},l.lineY1=function(){return d().x(t).y(f)},l.lineX1=function(){return d().x(u).y(r)},l.defined=function(_){return arguments.length?(h=typeof _==="function"?_:Wt(!!_),l):h},l.curve=function(_){return arguments.length?(x=_,g!=null&&(b=x(g)),l):x},l.context=function(_){return arguments.length?(_==null?g=b=null:b=x(g=_),l):g},l}class Fg{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{if(this._point=1,this._line)this._context.lineTo(t,r);else this._context.moveTo(t,r);break}case 1:this._point=2;default:{if(this._x)this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r);else this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Bg(t){return new Fg(t,!0)}function Lg(t){return new Fg(t,!1)}var ls=bt(3),ah={draw(t,r){let f=bt(r+yu(r/28,0.75))*0.59436,u=f/2,h=u*ls;t.moveTo(0,f),t.lineTo(0,-f),t.moveTo(-h,-u),t.lineTo(h,u),t.moveTo(-h,u),t.lineTo(h,-u)}};var k0={draw(t,r){let f=bt(r/hu);t.moveTo(f,0),t.arc(0,0,f,0,ku)}};var mh={draw(t,r){let f=bt(r/5)/2;t.moveTo(-3*f,-f),t.lineTo(-f,-f),t.lineTo(-f,-3*f),t.lineTo(f,-3*f),t.lineTo(f,-f),t.lineTo(3*f,-f),t.lineTo(3*f,f),t.lineTo(f,f),t.lineTo(f,3*f),t.lineTo(-f,3*f),t.lineTo(-f,f),t.lineTo(-3*f,f),t.closePath()}};var fd=bt(0.3333333333333333),_s=fd*2,jh={draw(t,r){let f=bt(r/_s),u=f*fd;t.moveTo(0,-f),t.lineTo(u,0),t.lineTo(0,f),t.lineTo(-u,0),t.closePath()}};var yh={draw(t,r){let f=bt(r)*0.62625;t.moveTo(0,-f),t.lineTo(f,0),t.lineTo(0,f),t.lineTo(-f,0),t.closePath()}};var kh={draw(t,r){let f=bt(r-yu(r/7,2))*0.87559;t.moveTo(-f,0),t.lineTo(f,0),t.moveTo(0,f),t.lineTo(0,-f)}};var ph={draw(t,r){let f=bt(r),u=-f/2;t.rect(u,u,f,f)}};var t8={draw(t,r){let f=bt(r)*0.4431;t.moveTo(f,f),t.lineTo(f,-f),t.lineTo(-f,-f),t.lineTo(-f,f),t.closePath()}};var ws=0.8908130915292852,ud=Yh(hu/10)/Yh(7*hu/10),Ms=Yh(ku/10)*ud,is=-Zg(ku/10)*ud,r8={draw(t,r){let f=bt(r*ws),u=Ms*f,h=is*f;t.moveTo(0,-f),t.lineTo(u,h);for(let g=1;g<5;++g){let x=ku*g/5,b=Zg(x),c=Yh(x);t.lineTo(c*f,-b*f),t.lineTo(b*u-c*h,c*u+b*h)}t.closePath()}};var Gg=bt(3),f8={draw(t,r){let f=-bt(r/(Gg*3));t.moveTo(0,f*2),t.lineTo(-Gg*f,-f),t.lineTo(Gg*f,-f),t.closePath()}};var Hs=bt(3),u8={draw(t,r){let f=bt(r)*0.6824,u=f/2,h=f*Hs/2;t.moveTo(0,-f),t.lineTo(h,u),t.lineTo(-h,u),t.closePath()}};var Lr=-0.5,Gr=bt(3)/2,Rg=1/bt(12),qs=(Rg/2+1)*3,h8={draw(t,r){let f=bt(r/qs),u=f/2,h=f*Rg,g=u,x=f*Rg+f,b=-g,c=x;t.moveTo(u,h),t.lineTo(g,x),t.lineTo(b,c),t.lineTo(Lr*u-Gr*h,Gr*u+Lr*h),t.lineTo(Lr*g-Gr*x,Gr*g+Lr*x),t.lineTo(Lr*b-Gr*c,Gr*b+Lr*c),t.lineTo(Lr*u+Gr*h,Lr*h-Gr*u),t.lineTo(Lr*g+Gr*x,Lr*x-Gr*g),t.lineTo(Lr*b+Gr*c,Lr*c-Gr*b),t.closePath()}};var t1={draw(t,r){let f=bt(r-yu(r/6,1.7))*0.6189;t.moveTo(-f,-f),t.lineTo(f,f),t.moveTo(-f,f),t.lineTo(f,-f)}};var K7=[k0,mh,jh,ph,r8,f8,h8],zg=[k0,kh,t1,u8,ah,t8,yh];function Jr(){}function r1(t,r,f){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+r)/6,(t._y0+4*t._y1+f)/6)}function g8(t){this._context=t}g8.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:r1(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:r1(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function V7(t){return new g8(t)}function hd(t){this._context=t}hd.prototype={areaStart:Jr,areaEnd:Jr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._x2=t,this._y2=r;break;case 1:this._point=2,this._x3=t,this._y3=r;break;case 2:this._point=3,this._x4=t,this._y4=r,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+r)/6);break;default:r1(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function W7(t){return new hd(t)}function gd(t){this._context=t}gd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var f=(this._x0+4*this._x1+t)/6,u=(this._y0+4*this._y1+r)/6;this._line?this._context.lineTo(f,u):this._context.moveTo(f,u);break;case 3:this._point=4;default:r1(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function o7(t){return new gd(t)}function xd(t,r){this._basis=new g8(t),this._beta=r}xd.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,r=this._y,f=t.length-1;if(f>0){var u=t[0],h=r[0],g=t[f]-u,x=r[f]-h,b=-1,c;while(++b<=f)c=b/f,this._basis.point(this._beta*t[b]+(1-this._beta)*(u+c*g),this._beta*r[b]+(1-this._beta)*(h+c*x))}this._x=this._y=null,this._basis.lineEnd()},point:function(t,r){this._x.push(+t),this._y.push(+r)}};var Ag=function t(r){function f(u){return r===1?new g8(u):new xd(u,r)}return f.beta=function(u){return t(+u)},f}(0.85);function f1(t,r,f){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-r),t._y2+t._k*(t._y1-f),t._x2,t._y2)}function Z7(t,r){this._context=t,this._k=(1-r)/6}Z7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:f1(this,this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2,this._x1=t,this._y1=r;break;case 2:this._point=3;default:f1(this,t,r);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var Dg=function t(r){function f(u){return new Z7(u,r)}return f.tension=function(u){return t(+u)},f}(0);function T7(t,r){this._context=t,this._k=(1-r)/6}T7.prototype={areaStart:Jr,areaEnd:Jr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:f1(this,t,r);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var Og=function t(r){function f(u){return new T7(u,r)}return f.tension=function(u){return t(+u)},f}(0);function F7(t,r){this._context=t,this._k=(1-r)/6}F7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:f1(this,t,r);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var Ig=function t(r){function f(u){return new F7(u,r)}return f.tension=function(u){return t(+u)},f}(0);function x8(t,r,f){var{_x1:u,_y1:h,_x2:g,_y2:x}=t;if(t._l01_a>Tg){var b=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);u=(u*b-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,h=(h*b-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>Tg){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,d=3*t._l23_a*(t._l23_a+t._l12_a);g=(g*l+t._x1*t._l23_2a-r*t._l12_2a)/d,x=(x*l+t._y1*t._l23_2a-f*t._l12_2a)/d}t._context.bezierCurveTo(u,h,g,x,t._x2,t._y2)}function bd(t,r){this._context=t,this._alpha=r}bd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){if(t=+t,r=+r,this._point){var f=this._x2-t,u=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(f*f+u*u,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3;default:x8(this,t,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var vg=function t(r){function f(u){return r?new bd(u,r):new Z7(u,0)}return f.alpha=function(u){return t(+u)},f}(0.5);function cd(t,r){this._context=t,this._alpha=r}cd.prototype={areaStart:Jr,areaEnd:Jr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,r){if(t=+t,r=+r,this._point){var f=this._x2-t,u=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(f*f+u*u,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:x8(this,t,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var Xg=function t(r){function f(u){return r?new cd(u,r):new T7(u,0)}return f.alpha=function(u){return t(+u)},f}(0.5);function dd(t,r){this._context=t,this._alpha=r}dd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(t,r){if(t=+t,r=+r,this._point){var f=this._x2-t,u=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(f*f+u*u,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:x8(this,t,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var Yg=function t(r){function f(u){return r?new dd(u,r):new F7(u,0)}return f.alpha=function(u){return t(+u)},f}(0.5);function ld(t){this._context=t}ld.prototype={areaStart:Jr,areaEnd:Jr,lineStart:function(){this._point=0},lineEnd:function(){if(this._point)this._context.closePath()},point:function(t,r){if(t=+t,r=+r,this._point)this._context.lineTo(t,r);else this._point=1,this._context.moveTo(t,r)}};function B7(t){return new ld(t)}function _d(t){return t<0?-1:1}function wd(t,r,f){var u=t._x1-t._x0,h=r-t._x1,g=(t._y1-t._y0)/(u||h<0&&-0),x=(f-t._y1)/(h||u<0&&-0),b=(g*h+x*u)/(u+h);return(_d(g)+_d(x))*Math.min(Math.abs(g),Math.abs(x),0.5*Math.abs(b))||0}function Md(t,r){var f=t._x1-t._x0;return f?(3*(t._y1-t._y0)/f-r)/2:r}function Sg(t,r,f){var{_x0:u,_y0:h,_x1:g,_y1:x}=t,b=(g-u)/3;t._context.bezierCurveTo(u+b,h+b*r,g-b,x-b*f,g,x)}function L7(t){this._context=t}L7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Sg(this,this._t0,Md(this,this._t0));break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){var f=NaN;if(t=+t,r=+r,t===this._x1&&r===this._y1)return;switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,Sg(this,Md(this,f=wd(this,t,r)),f);break;default:Sg(this,this._t0,f=wd(this,t,r));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r,this._t0=f}};function id(t){this._context=new Hd(t)}(id.prototype=Object.create(L7.prototype)).point=function(t,r){L7.prototype.point.call(this,r,t)};function Hd(t){this._context=t}Hd.prototype={moveTo:function(t,r){this._context.moveTo(r,t)},closePath:function(){this._context.closePath()},lineTo:function(t,r){this._context.lineTo(r,t)},bezierCurveTo:function(t,r,f,u,h,g){this._context.bezierCurveTo(r,t,u,f,g,h)}};function ag(t){return new L7(t)}function mg(t){return new id(t)}function Ed(t){this._context=t}Ed.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,r=this._y,f=t.length;if(f)if(this._line?this._context.lineTo(t[0],r[0]):this._context.moveTo(t[0],r[0]),f===2)this._context.lineTo(t[1],r[1]);else{var u=qd(t),h=qd(r);for(var g=0,x=1;x=0;--r)h[r]=(x[r]-h[r+1])/g[r];g[f-1]=(t[f]+h[f-1])/2;for(r=0;r=0)this._t=1-this._t,this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,r),this._context.lineTo(t,r);else{var f=this._x*(1-this._t)+t*this._t;this._context.lineTo(f,this._y),this._context.lineTo(f,r)}break}}this._x=t,this._y=r}};function z7(t){return new R7(t,0.5)}function jg(t){return new R7(t,0)}function yg(t){return new R7(t,1)}function $f(t,r,f){this.k=t,this.x=r,this.y=f}$f.prototype={constructor:$f,scale:function(t){return t===1?this:new $f(this.k*t,this.x,this.y)},translate:function(t,r){return t===0&r===0?this:new $f(this.k,this.x+this.k*t,this.y+this.k*r)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var kg=new $f(1,0,0);pg.prototype=$f.prototype;function pg(t){while(!t.__zoom)if(!(t=t.parentNode))return kg;return t.__zoom}function Rr(t){return t!=null&&!Number.isNaN(t)}function xr(t,r){return+Rr(r)-+Rr(t)||Qt(t,r)}function gu(t,r){return+Rr(r)-+Rr(t)||Ur(t,r)}function b8(t){return t!=null&&`${t}`!==""}function tx(t){return isFinite(t)?t:NaN}function xu(t){return t>0&&isFinite(t)?t:NaN}function u1(t){return t<0&&isFinite(t)?t:NaN}function A7(t,r){if(!(t instanceof Date))t=new Date(+t);if(isNaN(t))return typeof r==="function"?r(t):r;let f=t.getUTCHours(),u=t.getUTCMinutes(),h=t.getUTCSeconds(),g=t.getUTCMilliseconds();return`${Es(t.getUTCFullYear(),4)}-${p0(t.getUTCMonth()+1,2)}-${p0(t.getUTCDate(),2)}${f||u||h||g?`T${p0(f,2)}:${p0(u,2)}${h||g?`:${p0(h,2)}${g?`.${p0(g,3)}`:""}`:""}Z`:""}`}function Es(t){return t<0?`-${p0(-t,6)}`:t>9999?`+${p0(t,6)}`:p0(t,4)}function p0(t,r){return`${t}`.padStart(r,"0")}var ss=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function c8(t,r){if(!ss.test(t+=""))return typeof r==="function"?r(t):r;return new Date(t)}function tf(t){if(t==null)return;let r=t[0],f=t[t.length-1];return Ur(r,f)}var g1=1000,Qf=g1*60,Nf=Qf*60,e0=Nf*24,U0=e0*7,bu=e0*30,Jf=e0*365,rx=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",g1],["5 seconds",5*g1],["15 seconds",15*g1],["30 seconds",30*g1],["minute",Qf],["5 minutes",5*Qf],["15 minutes",15*Qf],["30 minutes",30*Qf],["hour",Nf],["3 hours",3*Nf],["6 hours",6*Nf],["12 hours",12*Nf],["day",e0],["2 days",2*e0],["week",U0],["2 weeks",2*U0],["month",bu],["3 months",3*bu],["6 months",6*bu],["year",Jf],["2 years",2*Jf],["5 years",5*Jf],["10 years",10*Jf],["20 years",20*Jf],["50 years",50*Jf],["100 years",100*Jf]],fx=new Map([["second",g1],["minute",Qf],["hour",Nf],["day",e0],["monday",U0],["tuesday",U0],["wednesday",U0],["thursday",U0],["friday",U0],["saturday",U0],["sunday",U0],["week",U0],["month",bu],["year",Jf]]),Pd=new Map([["second",Xt],["minute",Y0],["hour",a0],["day",Br],["monday",Pf],["tuesday",u5],["wednesday",h5],["thursday",$0],["friday",g5],["saturday",x5],["sunday",nr],["week",nr],["month",j0],["year",hr]]),ux=new Map([["second",Xt],["minute",S0],["hour",m0],["day",ru],["monday",nf],["tuesday",b5],["wednesday",c5],["thursday",J0],["friday",d5],["saturday",l5],["sunday",$r],["week",$r],["month",y0],["year",gr]]),x1=Symbol("intervalDuration"),O7=Symbol("intervalType");for(let[t,r]of Pd)r[x1]=fx.get(t),r[O7]="time";for(let[t,r]of ux)r[x1]=fx.get(t),r[O7]="utc";var d8=[["year",gr,"utc"],["month",y0,"utc"],["day",ru,"utc",6*bu],["hour",m0,"utc",3*e0],["minute",S0,"utc",6*Nf],["second",Xt,"utc",30*Qf]],D7=[["year",hr,"time"],["month",j0,"time"],["day",Br,"time",6*bu],["hour",a0,"time",3*e0],["minute",Y0,"time",6*Nf],["second",Xt,"time",30*Qf]],Ps=[d8[0],D7[0],d8[1],D7[1],d8[2],D7[2],...d8.slice(3)];function nd(t){let r=`${t}`.toLowerCase();if(r.endsWith("s"))r=r.slice(0,-1);let f=1,u=/^(?:(\d+)\s+)/.exec(r);if(u)r=r.slice(u[0].length),f=+u[1];switch(r){case"quarter":r="month",f*=3;break;case"half":r="month",f*=6;break}let h=ux.get(r);if(!h)throw Error(`unknown interval: ${t}`);if(f>1&&!h.every)throw Error(`non-periodic interval: ${r}`);return[r,f]}function hx(t){return $d(nd(t),"time")}function l8(t){return $d(nd(t),"utc")}function $d([t,r],f){let u=(f==="time"?Pd:ux).get(t);if(r>1)u=u.every(r),u[x1]=fx.get(t)*r,u[O7]=f;return u}function gx(t,r){if(!(r>1))return;let f=t[x1];if(!rx.some(([,h])=>h===f))return;if(f%e0===0&&e0Math.log(h)).center(rx,Math.log(f*r))];return(t[O7]==="time"?hx:l8)(u)}function sd(t,r,f){let u=r==="time"?au:Q0;if(f==null)return u(t==="year"?"%Y":t==="month"?"%Y-%m":t==="day"?"%Y-%m-%d":t==="hour"||t==="minute"?"%Y-%m-%dT%H:%M":t==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let h=ns(f);switch(t){case"millisecond":return h1(u(".%L"),u(":%M:%S"),h);case"second":return h1(u(":%S"),u("%-I:%M"),h);case"minute":return h1(u("%-I:%M"),u("%p"),h);case"hour":return h1(u("%-I %p"),u("%b %-d"),h);case"day":return h1(u("%-d"),u("%b"),h);case"month":return h1(u("%b"),u("%Y"),h);case"year":return u("%Y")}throw Error("unable to format time ticks")}function ns(t){return t==="left"||t==="right"?(r,f)=>` + rejects contribution-only ETH, so bidder settlement never depends on a donor.`,ariaLabel:"Migration closes, child pool shortfall is detected, auction starts, ETH bids are submitted, auction finalizes, and results settle into vault accounting.",height:180,nodes:[{children:[{attributes:{id:"auction-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-red",x:"20",y:"50",width:"150",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"95",y:"80","text-anchor":"middle"},children:[{text:"Shortfall"}],tag:"text"},{attributes:{class:"svg-small",x:"95",y:"103","text-anchor":"middle"},children:[{text:"child pool lacks ETH"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-arrow)",d:"M 170 85 H 230"},tag:"path"},{attributes:{class:"svg-blue",x:"230",y:"50",width:"150",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"305",y:"80","text-anchor":"middle"},children:[{text:"Start Auction"}],tag:"text"},{attributes:{class:"svg-small",x:"305",y:"103","text-anchor":"middle"},children:[{text:"repair target set"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-arrow)",d:"M 380 85 H 440"},tag:"path"},{attributes:{class:"svg-gold",x:"440",y:"50",width:"150",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"515",y:"80","text-anchor":"middle"},children:[{text:"Bid"}],tag:"text"},{attributes:{class:"svg-small",x:"515",y:"103","text-anchor":"middle"},children:[{text:"ETH supplied"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-arrow)",d:"M 590 85 H 650"},tag:"path"},{attributes:{class:"svg-green",x:"650",y:"50",width:"190",height:"70",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"745",y:"80","text-anchor":"middle"},children:[{text:"Settle"}],tag:"text"},{attributes:{class:"svg-small",x:"745",y:"103","text-anchor":"middle"},children:[{text:"bids settle → operational"}],tag:"text"}],width:880},"fig-auction-clearing-ladder":{ariaDescription:"High-price bids are considered first. If cumulative demand reaches the ETH raise cap or REP sale cap, the first binding tick sets normal uniform clearing. If neither cap is reached, finalization selects bids at or above the cap-implied qualification tick and allocates the complete REP sale cap among them at one effective price. With no qualifying bids, every bid refunds.",ariaLabel:"Auction demand is evaluated from high ticks to low ticks before uniform or underfunded clearing",height:360,nodes:[{children:[{attributes:{id:"auction-clearing-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"currentColor"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-small",x:"40",y:"34"},children:[{text:"higher ETH/REP limit"}],tag:"text"},{attributes:{class:"svg-green",x:"40",y:"52",width:"230",height:"64",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"155",y:"80","text-anchor":"middle"},children:[{text:"High tick bids"}],tag:"text"},{attributes:{class:"svg-small",x:"155",y:"101","text-anchor":"middle"},children:[{text:"evaluated first"}],tag:"text"},{attributes:{class:"svg-gold",x:"40",y:"142",width:"230",height:"64",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"155",y:"170","text-anchor":"middle"},children:[{text:"Binding tick"}],tag:"text"},{attributes:{class:"svg-small",x:"155",y:"191","text-anchor":"middle"},children:[{text:"marginal fill boundary"}],tag:"text"},{attributes:{class:"svg-red",x:"40",y:"232",width:"230",height:"64",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"155",y:"260","text-anchor":"middle"},children:[{text:"Lower tick bids"}],tag:"text"},{attributes:{class:"svg-small",x:"155",y:"281","text-anchor":"middle"},children:[{text:"refunded below boundary"}],tag:"text"},{attributes:{class:"svg-small",x:"40",y:"326"},children:[{text:"lower ETH/REP limit"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 270 84 C 330 84 330 120 390 120"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 270 174 H 390"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 270 264 C 330 264 330 228 390 228"},tag:"path"},{attributes:{class:"svg-blue",x:"390",y:"110",width:"220",height:"128",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"500",y:"150","text-anchor":"middle"},children:[{text:"Descending demand"}],tag:"text"},{attributes:{class:"svg-small",x:"500",y:"177","text-anchor":"middle"},children:[{text:"accumulate ETH and REP"}],tag:"text"},{attributes:{class:"svg-small",x:"500",y:"201","text-anchor":"middle"},children:[{text:"until a cap binds"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 610 146 H 700"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#auction-clearing-arrow)",d:"M 610 214 H 700"},tag:"path"},{attributes:{class:"svg-green",x:"700",y:"64",width:"240",height:"94",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"820",y:"98","text-anchor":"middle"},children:[{text:"Uniform clearing"}],tag:"text"},{attributes:{class:"svg-small",x:"820",y:"124","text-anchor":"middle"},children:[{text:"first ETH or REP cap reached"}],tag:"text"},{attributes:{class:"svg-gold",x:"700",y:"198",width:"240",height:"108",rx:"8"},tag:"rect"},{attributes:{class:"svg-label",x:"820",y:"232","text-anchor":"middle"},children:[{text:"Underfunded clearing"}],tag:"text"},{attributes:{class:"svg-small",x:"820",y:"258","text-anchor":"middle"},children:[{text:"cap-implied qualification tick"}],tag:"text"},{attributes:{class:"svg-small",x:"820",y:"280","text-anchor":"middle"},children:[{text:"complete REP cap shared pro rata"}],tag:"text"}],width:980},"fig-zoltar-fork-branch-set":{ariaDescription:"Universe tree. A fork creates the full valid branch set; no branch is privileged by the contract.",ariaLabel:"A parent universe forks into children for Invalid and each valid outcome.",height:430,nodes:[{children:[{attributes:{id:"arrow-universe",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-box",x:"330",y:"28",width:"260",height:"76",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"460",y:"61","text-anchor":"middle"},children:[{text:"Parent universe"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"84","text-anchor":"middle"},children:[{text:"fork on disputed question"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 460 106 V 160"},tag:"path"},{attributes:{class:"svg-gold",x:"324",y:"164",width:"272",height:"82",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"460",y:"198","text-anchor":"middle"},children:[{text:"parentUniverseId"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"222","text-anchor":"middle"},children:[{text:"deterministic child ids"}],tag:"text"},{attributes:{class:"svg-line",d:"M 460 248 V 286"},tag:"path"},{attributes:{class:"svg-line",d:"M 170 286 H 750"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 170 286 V 326"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 360 286 V 326"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 560 286 V 326"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-universe)",d:"M 750 286 V 326"},tag:"path"},{attributes:{class:"svg-teal",x:"76",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"266",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"466",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"656",y:"330",width:"188",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"170",y:"365","text-anchor":"middle"},children:[{text:"Invalid"}],tag:"text"},{attributes:{class:"svg-label",x:"360",y:"365","text-anchor":"middle"},children:[{text:"Outcome 1"}],tag:"text"},{attributes:{class:"svg-label",x:"560",y:"365","text-anchor":"middle"},children:[{text:"Outcome 2"}],tag:"text"},{attributes:{class:"svg-label",x:"750",y:"365","text-anchor":"middle"},children:[{text:"Outcome N"}],tag:"text"}],width:920},"fig-zoltar-threshold-deposit":{ariaDescription:"Threshold Deposit Split. The full parent-REP threshold leaves parent supply. Most is re-expressed as migratable child-REP credit; the haircut is not credited.",ariaLabel:"Fork threshold deposit leaves the parent universe. After flooring the approximately 20 percent uncredited haircut, the remainder is an approximately 80 percent migration balance.",height:360,nodes:[{children:[{attributes:{id:"arrow-deposit",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-label",x:"430",y:"42","text-anchor":"middle"},children:[{text:"Fork initiator deposits forkThreshold REP"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deposit)",d:"M 430 58 V 94"},tag:"path"},{attributes:{class:"svg-gold",x:"286",y:"98",width:"288",height:"76",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"430",y:"130","text-anchor":"middle"},children:[{text:"Threshold deposit"}],tag:"text"},{attributes:{class:"svg-small",x:"430",y:"153","text-anchor":"middle"},children:[{text:"≈5% of theoretical REP supply"}],tag:"text"},{attributes:{class:"svg-line",d:"M 430 176 V 222"},tag:"path"},{attributes:{class:"svg-line",d:"M 250 222 H 610"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deposit)",d:"M 250 222 V 260"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-deposit)",d:"M 610 222 V 260"},tag:"path"},{attributes:{class:"svg-red",x:"134",y:"264",width:"232",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-teal",x:"494",y:"264",width:"232",height:"58",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"250",y:"286","text-anchor":"middle","aria-label":"approximately 20 percent uncredited haircut"},children:[{attributes:{x:"250"},children:[{text:"≈20% uncredited"}],tag:"tspan"},{attributes:{class:"svg-small",x:"250",dy:"20"},children:[{text:"haircut"}],tag:"tspan"}],tag:"text"},{attributes:{class:"svg-label",x:"610",y:"286","text-anchor":"middle","aria-label":"approximately 80 percent migration balance"},children:[{attributes:{x:"610"},children:[{text:"≈80% migration"}],tag:"tspan"},{attributes:{class:"svg-small",x:"610",dy:"20"},children:[{text:"balance"}],tag:"tspan"}],tag:"text"}],width:860},"fig-zoltar-migration-reproduction":{ariaDescription:"Migration Balance Reproduction. Selecting multiple branches mints child REP in each selected child universe from the same migration balance.",ariaLabel:"A migration balance can mint REP into one selected child or be reproduced across multiple selected children.",height:520,nodes:[{children:[{attributes:{id:"arrow-split",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-gold",x:"315",y:"28",width:"300",height:"70",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"465",y:"59","text-anchor":"middle"},children:[{text:"Post-fork migration balance"}],tag:"text"},{attributes:{class:"svg-small",x:"465",y:"81","text-anchor":"middle"},children:[{text:"splitMigrationRep(selected outcomes)"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 465 100 V 136"},tag:"path"},{attributes:{class:"svg-line",x1:"465",y1:"136",x2:"465",y2:"168"},tag:"line"},{attributes:{class:"svg-line",x1:"205",y1:"168",x2:"725",y2:"168"},tag:"line"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 205 168 V 210"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 725 168 V 210"},tag:"path"},{attributes:{class:"svg-blue",x:"86",y:"214",width:"238",height:"64",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"205",y:"239","text-anchor":"middle"},children:[{text:"One selected branch"}],tag:"text"},{attributes:{class:"svg-small",x:"205",y:"261","text-anchor":"middle"},children:[{text:"mint only there"}],tag:"text"},{attributes:{class:"svg-teal",x:"606",y:"214",width:"238",height:"64",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"725",y:"239","text-anchor":"middle"},children:[{text:"Multiple branches"}],tag:"text"},{attributes:{class:"svg-small",x:"725",y:"261","text-anchor":"middle"},children:[{text:"reproduce same claim"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 205 280 V 340"},tag:"path"},{attributes:{class:"svg-box",x:"88",y:"346",width:"234",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"205",y:"380","text-anchor":"middle"},children:[{text:"Selected child REP"}],tag:"text"},{attributes:{class:"svg-line",d:"M 725 280 V 330"},tag:"path"},{attributes:{class:"svg-line",x1:"610",y1:"330",x2:"840",y2:"330"},tag:"line"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 610 330 V 372"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 725 330 V 372"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-split)",d:"M 840 330 V 372"},tag:"path"},{attributes:{class:"svg-box",x:"520",y:"378",width:"180",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-box",x:"635",y:"444",width:"180",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-box",x:"750",y:"378",width:"180",height:"56",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"610",y:"412","text-anchor":"middle"},children:[{text:"Invalid REP"}],tag:"text"},{attributes:{class:"svg-label",x:"725",y:"478","text-anchor":"middle"},children:[{text:"Outcome A REP"}],tag:"text"},{attributes:{class:"svg-label",x:"840",y:"412","text-anchor":"middle"},children:[{text:"Outcome B REP"}],tag:"text"}],width:930},"fig-zoltar-packed-scalar-answer":{ariaDescription:"Packed Scalar Answer. A scalar answer is easier to read as reserved bits, a namespace flag, and two payout fields: bits 254...240 must be zero, 0 in bit 255 is the invalid namespace, and 1 means the payout fields must sum to numTicks.",ariaLabel:"A uint256 scalar answer uses the highest bit as a namespace flag, then packs first and second 120-bit payout numerators.",height:520,nodes:[{children:[{attributes:{id:"arrow-packed",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse"},children:[{attributes:{d:"M 0 0 L 10 5 L 0 10 z",fill:"#615642"},tag:"path"}],tag:"marker"}],tag:"defs"},{attributes:{class:"svg-small",x:"70",y:"46"},children:[{text:"most significant"}],tag:"text"},{attributes:{class:"svg-small",x:"850",y:"46","text-anchor":"end"},children:[{text:"least significant"}],tag:"text"},{attributes:{class:"svg-box",x:"70",y:"66",width:"780",height:"118",rx:"14"},tag:"rect"},{attributes:{class:"svg-teal",x:"92",y:"92",width:"92",height:"66",rx:"10"},tag:"rect"},{attributes:{class:"svg-gold",x:"210",y:"92",width:"280",height:"66",rx:"10"},tag:"rect"},{attributes:{class:"svg-blue",x:"516",y:"92",width:"312",height:"66",rx:"10"},tag:"rect"},{attributes:{class:"svg-label",x:"138",y:"119","text-anchor":"middle"},children:[{text:"bit 255"}],tag:"text"},{attributes:{class:"svg-small",x:"138",y:"142","text-anchor":"middle"},children:[{text:"flag"}],tag:"text"},{attributes:{class:"svg-label",x:"350",y:"119","text-anchor":"middle"},children:[{text:"bits 239...120"}],tag:"text"},{attributes:{class:"svg-small",x:"350",y:"142","text-anchor":"middle"},children:[{text:"first payout numerator"}],tag:"text"},{attributes:{class:"svg-label",x:"672",y:"119","text-anchor":"middle"},children:[{text:"bits 119...0"}],tag:"text"},{attributes:{class:"svg-small",x:"672",y:"142","text-anchor":"middle"},children:[{text:"second payout numerator"}],tag:"text"},{attributes:{class:"svg-small",x:"92",y:"202"},children:[{text:"Bits 254...240 are reserved and must be zero."}],tag:"text"},{attributes:{class:"svg-small",x:"92",y:"224"},children:[{text:"Nonzero reserved bits are malformed."}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 138 184 V 246"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 350 184 V 246"},tag:"path"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 672 184 V 246"},tag:"path"},{attributes:{class:"svg-teal",x:"52",y:"256",width:"172",height:"92",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"138",y:"292","text-anchor":"middle"},children:[{text:"Namespace"}],tag:"text"},{attributes:{class:"svg-small",x:"138",y:"318","text-anchor":"middle"},children:[{text:"0 = Invalid"}],tag:"text"},{attributes:{class:"svg-small",x:"138",y:"340","text-anchor":"middle"},children:[{text:"1 = scalar value"}],tag:"text"},{attributes:{class:"svg-gold",x:"258",y:"256",width:"184",height:"92",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"350",y:"292","text-anchor":"middle"},children:[{text:"Left Payout"}],tag:"text"},{attributes:{class:"svg-small",x:"350",y:"318","text-anchor":"middle"},children:[{text:"numTicks - tickIndex"}],tag:"text"},{attributes:{class:"svg-blue",x:"580",y:"256",width:"184",height:"92",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"672",y:"292","text-anchor":"middle"},children:[{text:"Right Payout"}],tag:"text"},{attributes:{class:"svg-small",x:"672",y:"318","text-anchor":"middle"},children:[{text:"tickIndex"}],tag:"text"},{attributes:{class:"svg-line","marker-end":"url(#arrow-packed)",d:"M 442 302 H 570"},tag:"path"},{attributes:{class:"svg-small",x:"506",y:"286","text-anchor":"middle"},children:[{text:"combined rule"}],tag:"text"},{attributes:{class:"svg-box",x:"176",y:"390",width:"568",height:"82",rx:"12"},tag:"rect"},{attributes:{class:"svg-label",x:"460",y:"424","text-anchor":"middle"},children:[{text:"Scalar validity check"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"444","text-anchor":"middle"},children:[{text:"first payout numerator"}],tag:"text"},{attributes:{class:"svg-small",x:"460",y:"464","text-anchor":"middle"},children:[{text:"+ second payout numerator = numTicks"}],tag:"text"}],width:920},"fig-contract-interaction-map":{ariaDescription:"Three panels separate construction-time deployment, recurring market and oracle operations, and fork migration and backing repair. Repeated contracts preserve local reading order, short edge labels name each action, and the detailed table below gives the exact boundary.",ariaLabel:"Zoltar and Statoblast contract interactions grouped into deployment, runtime, and fork phases",height:880,nodes:[],width:1120},"fig-complete-contract-atlas":{ariaDescription:"Six separated regions inventory Zoltar, Statoblast deployment, Statoblast runtime, Statoblast implementation boundaries, infrastructure and imported OpenOracle code, and test-only Solidity declarations. Every Solidity contract, abstract contract, interface, and library in the repository appears once in its owning region; two type-only modules also appear. The register contains 394 relationships grouped into 376 ordered source-target routes. The chart defaults to a clearer 96-route protocol-flow layer; controls reveal type structure, source references, test exercise, or all routes without moving or removing components. Eighteen routes combine two relationship types; their tooltips list both types and meanings. Solid, long-dash, dot–dash, and short-dash arrows respectively show runtime calls, asset-bearing calls, deployments, and delegatecalls. Dashed or dotted arrows show inheritance, interface implementation, structural compatibility, library or type use, direct source references, and test-only exercise. A dark patterned arrow marks multiple relationship types. Production target groups are repeated inside the test region to prevent test edges from crossing the full chart.",ariaLabel:"Complete Zoltar and Statoblast Solidity contract and relationship atlas",height:2480,nodes:[],width:1800},"fig-liquidation-health-curve":{ariaDescription:"Required REP backing rises linearly with the REP per ETH price, while unlocked REP stays fixed. Crossing the available-REP line makes the selected vault liquidatable.",ariaLabel:"Vault backing requirement and liquidation threshold across REP per ETH prices",height:430,nodes:[],width:900},"fig-statoblast-retention-utilization":{ariaDescription:"The annualized open-interest fee rises from about ten percent at zero utilization to about fifty percent at the eighty-percent utilization dip, then remains at that level as the per-second retention rate stays at its minimum.",ariaLabel:"Annualized open-interest fee across fee-eligible allowance utilization",height:420,nodes:[],width:900},"fig-zoltar-fork-threshold-decay":{ariaDescription:"With the default threshold and burn divisors, each fork haircut leaves approximately ninety-nine percent of the previous generation's theoretical REP supply. The next fork threshold remains five percent of that declining supply.",ariaLabel:"Theoretical REP supply and fork threshold across repeated forks",height:420,nodes:[],width:900}}});function Nt(t,r){return t==null||r==null?NaN:tr?1:t>=r?0:NaN}function Fr(t,r){return t==null||r==null?NaN:rt?1:r>=t?0:NaN}function I0(t){let r,f,u;if(t.length!==2)r=Nt,f=(g,c)=>Nt(t(g),c),u=(g,c)=>t(g)-c;else r=t===Nt||t===Fr?t:uH,f=t,u=t;function h(g,c,_=0,l=g.length){if(_>>1;if(f(g[d],c)<0)_=d+1;else l=d}while(_>>1;if(f(g[d],c)<=0)_=d+1;else l=d}while(__&&u(g[d-1],c)>-u(g[d],c)?d-1:d}return{left:h,center:b,right:x}}function uH(){return 0}function s1(t){return t===null?NaN:+t}function*_c(t,r){if(r===void 0){for(let f of t)if(f!=null&&(f=+f)>=f)yield f}else{let f=-1;for(let u of t)if((u=r(u,++f,t))!=null&&(u=+u)>=u)yield u}}var lc=I0(Nt),dc=lc.right,hH=lc.left,xH=I0(s1).center,n0=dc;function nf(t,r){let f=0;if(r===void 0){for(let u of t)if(u!=null&&(u=+u)>=u)++f}else{let u=-1;for(let h of t)if((h=r(h,++u,t))!=null&&(h=+h)>=h)++f}return f}function bH(t){return t.length|0}function gH(t){return!(t>0)}function cH(t){return typeof t!=="object"||"length"in t?t:Array.from(t)}function _H(t){return(r)=>t(...r)}function n8(...t){let r=typeof t[t.length-1]==="function"&&_H(t.pop());t=t.map(cH);let f=t.map(bH),u=t.length-1,h=Array(u+1).fill(0),x=[];if(u<0||f.some(gH))return x;while(!0){x.push(h.map((g,c)=>t[c][g]));let b=u;while(++h[b]===f[b]){if(b===0)return r?x.map(r):x;h[b--]=0}}}function X8(t,r){var f=0,u=0;return Float64Array.from(t,r===void 0?(h)=>f+=+h||0:(h)=>f+=+r(h,u++,t)||0)}function Vu(t,r){let f=0,u,h=0,x=0;if(r===void 0){for(let b of t)if(b!=null&&(b=+b)>=b)u=b-h,h+=u/++f,x+=u*(b-h)}else{let b=-1;for(let g of t)if((g=r(g,++b,t))!=null&&(g=+g)>=g)u=g-h,h+=u/++f,x+=u*(g-h)}if(f>1)return x/(f-1)}function Nu(t,r){let f=Vu(t,r);return f?Math.sqrt(f):f}function nt(t,r){let f,u;if(r===void 0){for(let h of t)if(h!=null)if(f===void 0){if(h>=h)f=u=h}else{if(f>h)f=h;if(u=x)f=u=x}else{if(f>x)f=x;if(u0){x=t[--r];while(r>0)if(f=x,u=t[--r],x=f+u,h=u-(x-f),h)break;if(r>0&&(h<0&&t[r-1]<0||h>0&&t[r-1]>0)){if(u=h*2,f=x+u,u==f-x)x=f}}return x}}class Pr extends Map{constructor(t,r=Hc){super();if(Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[f,u]of t)this.set(f,u)}get(t){return super.get(I4(this,t))}has(t){return super.has(I4(this,t))}set(t,r){return super.set(wc(this,t),r)}delete(t){return super.delete(Mc(this,t))}}class c0 extends Set{constructor(t,r=Hc){super();if(Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let f of t)this.add(f)}has(t){return super.has(I4(this,t))}add(t){return super.add(wc(this,t))}delete(t){return super.delete(Mc(this,t))}}function I4({_intern:t,_key:r},f){let u=r(f);return t.has(u)?t.get(u):f}function wc({_intern:t,_key:r},f){let u=r(f);if(t.has(u))return t.get(u);return t.set(u,f),f}function Mc({_intern:t,_key:r},f){let u=r(f);if(t.has(u))f=t.get(u),t.delete(u);return f}function Hc(t){return t!==null&&typeof t==="object"?t.valueOf():t}function I1(t){return t}function _0(t,...r){return X4(t,I1,I1,r)}function mr(t,r,...f){return X4(t,I1,r,f)}function n4(t,r,...f){return X4(t,Array.from,r,f)}function X4(t,r,f,u){return function h(x,b){if(b>=u.length)return f(x);let g=new Pr,c=u[b++],_=-1;for(let l of x){let d=c(l,++_,x),w=g.get(d);if(w)w.push(l);else g.set(d,[l])}for(let[l,d]of g)g.set(l,h(d,b));return r(g)}(t,0)}function v4(t,r){return Array.from(r,(f)=>t[f])}function X0(t,...r){if(typeof t[Symbol.iterator]!=="function")throw TypeError("values is not iterable");t=Array.from(t);let[f]=r;if(f&&f.length!==2||r.length>1){let u=Uint32Array.from(t,(h,x)=>x);if(r.length>1)r=r.map((h)=>t.map(h)),u.sort((h,x)=>{for(let b of r){let g=n1(b[h],b[x]);if(g)return g}});else f=t.map(f),u.sort((h,x)=>n1(f[h],f[x]));return v4(t,u)}return t.sort(Y4(f))}function Y4(t=Nt){if(t===Nt)return n1;if(typeof t!=="function")throw TypeError("compare is not a function");return(r,f)=>{let u=t(r,f);if(u||u===0)return u;return(t(f,f)===0)-(t(r,r)===0)}}function n1(t,r){return(t==null||!(t>=t))-(r==null||!(r>=r))||(tr?1:0)}function Tu(t,r,f){return(r.length!==2?X0(mr(t,r,f),([u,h],[x,b])=>Nt(h,b)||Nt(u,x)):X0(_0(t,f),([u,h],[x,b])=>r(h,b)||Nt(u,x))).map(([u])=>u)}var lH=Math.sqrt(50),dH=Math.sqrt(10),wH=Math.sqrt(2);function v8(t,r,f){let u=(r-t)/Math.max(0,f),h=Math.floor(Math.log10(u)),x=u/Math.pow(10,h),b=x>=lH?10:x>=dH?5:x>=wH?2:1,g,c,_;if(h<0){if(_=Math.pow(10,-h)/b,g=Math.round(t*_),c=Math.round(r*_),g/_r)--c;_=-_}else{if(_=Math.pow(10,h)*b,g=Math.round(t/_),c=Math.round(r/_),g*_r)--c}if(c0))return[];if(t===r)return[t];let u=r=h))return[];let g=x-h+1,c=Array(g);if(u)if(b<0)for(let _=0;_=u))f=u}else{let u=-1;for(let h of t)if((h=r(h,++u,t))!=null&&(f=h))f=h}return f}function S8(t,r){let f,u=-1,h=-1;if(r===void 0){for(let x of t)if(++h,x!=null&&(f=x))f=x,u=h}else for(let x of t)if((x=r(x,++h,t))!=null&&(f=x))f=x,u=h;return u}function dr(t,r){let f;if(r===void 0){for(let u of t)if(u!=null&&(f>u||f===void 0&&u>=u))f=u}else{let u=-1;for(let h of t)if((h=r(h,++u,t))!=null&&(f>h||f===void 0&&h>=h))f=h}return f}function o8(t,r){let f,u=-1,h=-1;if(r===void 0){for(let x of t)if(++h,x!=null&&(f>x||f===void 0&&x>=x))f=x,u=h}else for(let x of t)if((x=r(x,++h,t))!=null&&(f>x||f===void 0&&x>=x))f=x,u=h;return u}function m8(t,r,f=0,u=1/0,h){if(r=Math.floor(r),f=Math.floor(Math.max(0,f)),u=Math.floor(Math.min(t.length-1,u)),!(f<=r&&r<=u))return t;h=h===void 0?n1:Y4(h);while(u>f){if(u-f>600){let c=u-f+1,_=r-f+1,l=Math.log(c),d=0.5*Math.exp(2*l/3),w=0.5*Math.sqrt(l*d*(c-d)/c)*(_-c/2<0?-1:1),M=Math.max(f,Math.floor(r-_*d/c+w)),H=Math.min(u,Math.floor(r+(c-_)*d/c+w));m8(t,r,M,H,h)}let x=t[r],b=f,g=u;if(X1(t,f,r),h(t[u],x)>0)X1(t,f,u);while(b0)--g}if(h(t[f],x)===0)X1(t,f,g);else++g,X1(t,g,u);if(g<=r)f=g+1;if(r<=g)u=g-1}return t}function X1(t,r,f){let u=t[r];t[r]=t[f],t[f]=u}function v1(t,r=Nt){let f,u=!1;if(r.length===1){let h;for(let x of t){let b=r(x);if(u?Nt(b,h)>0:Nt(b,b)===0)f=x,h=b,u=!0}}else for(let h of t)if(u?r(h,f)>0:r(h,h)===0)f=h,u=!0;return f}function Gr(t,r,f){if(t=Float64Array.from(_c(t,f)),!(u=t.length)||isNaN(r=+r))return;if(r<=0||u<2)return dr(t);if(r>=1)return ot(t);var u,h=(u-1)*r,x=Math.floor(h),b=ot(m8(t,x).subarray(0,x+1)),g=dr(t.subarray(x+1));return b+(g-b)*(h-x)}function S4(t,r,f=s1){if(!(u=t.length)||isNaN(r=+r))return;if(r<=0||u<2)return+f(t[0],0,t);if(r>=1)return+f(t[u-1],u-1,t);var u,h=(u-1)*r,x=Math.floor(h),b=+f(t[x],x,t),g=+f(t[x+1],x+1,t);return b+(g-b)*(h-x)}function j8(t,r,f){let u=nf(t),h=Gr(t,0.75)-Gr(t,0.25);return u&&h?Math.ceil((f-r)/(2*h*Math.pow(u,-0.3333333333333333))):1}function Y1(t,r,f){let u=nf(t),h=Nu(t);return u&&h?Math.ceil((f-r)*Math.cbrt(u)/(3.49*h)):1}function e8(t,r){let f=0,u=0;if(r===void 0){for(let h of t)if(h!=null&&(h=+h)>=h)++f,u+=h}else{let h=-1;for(let x of t)if((x=r(x,++h,t))!=null&&(x=+x)>=x)++f,u+=x}if(f)return u/f}function vf(t,r){return Gr(t,0.5,r)}function*HH(t){for(let r of t)yield*r}function Lu(t){return Array.from(HH(t))}function a8(t,r){let f=new Pr;if(r===void 0){for(let x of t)if(x!=null&&x>=x)f.set(x,(f.get(x)||0)+1)}else{let x=-1;for(let b of t)if((b=r(b,++x,t))!=null&&b>=b)f.set(b,(f.get(b)||0)+1)}let u,h=0;for(let[x,b]of f)if(b>h)h=b,u=x;return u}function y8(t,r=qH){let f=[],u,h=!1;for(let x of t){if(h)f.push(r(u,x));u=x,h=!0}return f}function qH(t,r){return[t,r]}function Yf(t,r,f){t=+t,r=+r,f=(h=arguments.length)<2?(r=t,t=0,1):h<3?1:+f;var u=-1,h=Math.max(0,Math.ceil((r-t)/f))|0,x=Array(h);while(++u+t(r)}function JH(t,r){if(r=Math.max(0,t.bandwidth()-r*2)/2,t.round())r=Math.round(r);return(f)=>+t(f)+r}function QH(){return!this.__axis}function UH(t,r){var f=[],u=null,h=null,x=6,b=6,g=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:0.5,_=t===m4||t===k8?-1:1,l=t===k8||t===j4?"x":"y",d=t===m4||t===e4?$H:PH;function w(M){var H=u==null?r.ticks?r.ticks.apply(r,f):r.domain():u,q=h==null?r.tickFormat?r.tickFormat.apply(r,f):o4:h,$=Math.max(x,0)+g,E=r.range(),P=+E[0]+c,J=+E[E.length-1]+c,Q=(r.bandwidth?JH:EH)(r.copy(),c),U=M.selection?M.selection():M,C=U.selectAll(".domain").data([null]),W=U.selectAll(".tick").data(H,r).order(),i=W.exit(),Z=W.enter().append("g").attr("class","tick"),R=W.select("line"),z=W.select("text");if(C=C.merge(C.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),W=W.merge(Z),R=R.merge(Z.append("line").attr("stroke","currentColor").attr(l+"2",_*x)),z=z.merge(Z.append("text").attr("fill","currentColor").attr(l,_*$).attr("dy",t===m4?"0em":t===e4?"0.71em":"0.32em")),M!==U)C=C.transition(M),W=W.transition(M),R=R.transition(M),z=z.transition(M),i=i.transition(M).attr("opacity",qc).attr("transform",function(G){return isFinite(G=Q(G))?d(G+c):this.getAttribute("transform")}),Z.attr("opacity",qc).attr("transform",function(G){var N=this.parentNode.__axis;return d((N&&isFinite(N=N(G))?N:Q(G))+c)});i.remove(),C.attr("d",t===k8||t===j4?b?"M"+_*b+","+P+"H"+c+"V"+J+"H"+_*b:"M"+c+","+P+"V"+J:b?"M"+P+","+_*b+"V"+c+"H"+J+"V"+_*b:"M"+P+","+c+"H"+J),W.attr("opacity",1).attr("transform",function(G){return d(Q(G)+c)}),R.attr(l+"2",_*x),z.attr(l,_*$).text(q),U.filter(QH).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===j4?"start":t===k8?"end":"middle"),U.each(function(){this.__axis=Q})}return w.scale=function(M){return arguments.length?(r=M,w):r},w.ticks=function(){return f=Array.from(arguments),w},w.tickArguments=function(M){return arguments.length?(f=M==null?[]:Array.from(M),w):f.slice()},w.tickValues=function(M){return arguments.length?(u=M==null?null:Array.from(M),w):u&&u.slice()},w.tickFormat=function(M){return arguments.length?(h=M,w):h},w.tickSize=function(M){return arguments.length?(x=b=+M,w):x},w.tickSizeInner=function(M){return arguments.length?(x=+M,w):x},w.tickSizeOuter=function(M){return arguments.length?(b=+M,w):b},w.tickPadding=function(M){return arguments.length?(g=+M,w):g},w.offset=function(M){return arguments.length?(c=+M,w):c},w}function a4(t){return UH(e4,t)}var CH={value:()=>{}};function Pc(){for(var t=0,r=arguments.length,f={},u;t=0)u=f.slice(h+1),f=f.slice(0,h);if(f&&!r.hasOwnProperty(f))throw Error("unknown type: "+f);return{type:f,name:u}})}p8.prototype=Pc.prototype={constructor:p8,on:function(t,r){var f=this._,u=KH(t+"",f),h,x=-1,b=u.length;if(arguments.length<2){while(++x0)for(var f=Array(h),u=0,h,x;u=0&&(r=t.slice(0,f))!=="xmlns")t=t.slice(f+1);return l0.hasOwnProperty(r)?{space:l0[r],local:t}:t}function iH(t){return function(){var r=this.ownerDocument,f=this.namespaceURI;return f===t6&&r.documentElement.namespaceURI===t6?r.createElement(t):r.createElementNS(f,t)}}function ZH(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function w0(t){var r=d0(t);return(r.local?ZH:iH)(r)}function VH(){}function Mf(t){return t==null?VH:function(){return this.querySelector(t)}}function k4(t){if(typeof t!=="function")t=Mf(t);for(var r=this._groups,f=r.length,u=Array(f),h=0;h=J)J=P+1;while(!(U=$[J])&&++J=0;)if(b=u[h]){if(x&&b.compareDocumentPosition(x)^4)x.parentNode.insertBefore(b,x);x=b}return this}function d9(t){if(!t)t=IH;function r(d,w){return d&&w?t(d.__data__,w.__data__):!d-!w}for(var f=this._groups,u=f.length,h=Array(u),x=0;xr?1:t>=r?0:NaN}function w9(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function M9(){return Array.from(this)}function H9(){for(var t=this._groups,r=0,f=t.length;r1?this.each((r==null?mH:typeof r==="function"?eH:jH)(t,r,f==null?"":f)):Hf(this.node(),t)}function Hf(t,r){return t.style.getPropertyValue(r)||m1(t).getComputedStyle(t,null).getPropertyValue(r)}function aH(t){return function(){delete this[t]}}function yH(t,r){return function(){this[t]=r}}function kH(t,r){return function(){var f=r.apply(this,arguments);if(f==null)delete this[t];else this[t]=f}}function Q9(t,r){return arguments.length>1?this.each((r==null?aH:typeof r==="function"?kH:yH)(t,r)):this.node()[t]}function Ec(t){return t.trim().split(/^|\s+/)}function U9(t){return t.classList||new Jc(t)}function Jc(t){this._node=t,this._names=Ec(t.getAttribute("class")||"")}Jc.prototype={add:function(t){var r=this._names.indexOf(t);if(r<0)this._names.push(t),this._node.setAttribute("class",this._names.join(" "))},remove:function(t){var r=this._names.indexOf(t);if(r>=0)this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(t){return this._names.indexOf(t)>=0}};function Qc(t,r){var f=U9(t),u=-1,h=r.length;while(++u=0)f=r.slice(u+1),r=r.slice(0,u);return{type:r,name:f}})}function $q(t){return function(){var r=this.__on;if(!r)return;for(var f=0,u=-1,h=r.length,x;f>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):f===8?u6(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):f===4?u6(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=Cq.exec(t))?new st(r[1],r[2],r[3],1):(r=Kq.exec(t))?new st(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=Wq.exec(t))?u6(r[1],r[2],r[3],r[4]):(r=iq.exec(t))?u6(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=Zq.exec(t))?Fc(r[1],r[2]/100,r[3]/100,1):(r=Vq.exec(t))?Fc(r[1],r[2]/100,r[3]/100,r[4]):Wc.hasOwnProperty(t)?Vc(Wc[t]):t==="transparent"?new st(NaN,NaN,NaN,0):null}function Vc(t){return new st(t>>16&255,t>>8&255,t&255,1)}function u6(t,r,f,u){if(u<=0)t=r=f=NaN;return new st(t,r,f,u)}function e1(t){if(!(t instanceof q0))t=ar(t);if(!t)return new st;return t=t.rgb(),new st(t.r,t.g,t.b,t.opacity)}function Br(t,r,f,u){return arguments.length===1?e1(t):new st(t,r,f,u==null?1:u)}function st(t,r,f,u){this.r=+t,this.g=+r,this.b=+f,this.opacity=+u}M0(st,Br,qf(q0,{brighter(t){return t=t==null?mf:Math.pow(mf,t),new st(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?$f:Math.pow($f,t),new st(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new st(of(this.r),of(this.g),of(this.b),x6(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:Nc,formatHex:Nc,formatHex8:Fq,formatRgb:Tc,toString:Tc}));function Nc(){return`#${Sf(this.r)}${Sf(this.g)}${Sf(this.b)}`}function Fq(){return`#${Sf(this.r)}${Sf(this.g)}${Sf(this.b)}${Sf((isNaN(this.opacity)?1:this.opacity)*255)}`}function Tc(){let t=x6(this.opacity);return`${t===1?"rgb(":"rgba("}${of(this.r)}, ${of(this.g)}, ${of(this.b)}${t===1?")":`, ${t})`}`}function x6(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function of(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Sf(t){return t=of(t),(t<16?"0":"")+t.toString(16)}function Fc(t,r,f,u){if(u<=0)t=r=f=NaN;else if(f<=0||f>=1)t=r=NaN;else if(r<=0)t=NaN;return new er(t,r,f,u)}function Gc(t){if(t instanceof er)return new er(t.h,t.s,t.l,t.opacity);if(!(t instanceof q0))t=ar(t);if(!t)return new er;if(t instanceof er)return t;t=t.rgb();var r=t.r/255,f=t.g/255,u=t.b/255,h=Math.min(r,f,u),x=Math.max(r,f,u),b=NaN,g=x-h,c=(x+h)/2;if(g){if(r===x)b=(f-u)/g+(f0&&c<1?0:b;return new er(b,g,c,t.opacity)}function a1(t,r,f,u){return arguments.length===1?Gc(t):new er(t,r,f,u==null?1:u)}function er(t,r,f,u){this.h=+t,this.s=+r,this.l=+f,this.opacity=+u}M0(er,a1,qf(q0,{brighter(t){return t=t==null?mf:Math.pow(mf,t),new er(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?$f:Math.pow($f,t),new er(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,r=isNaN(t)||isNaN(this.s)?0:this.s,f=this.l,u=f+(f<0.5?f:1-f)*r,h=2*f-u;return new st(A9(t>=240?t-240:t+120,h,u),A9(t,h,u),A9(t<120?t+240:t-120,h,u),this.opacity)},clamp(){return new er(Lc(this.h),h6(this.s),h6(this.l),x6(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){let t=x6(this.opacity);return`${t===1?"hsl(":"hsla("}${Lc(this.h)}, ${h6(this.s)*100}%, ${h6(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Lc(t){return t=(t||0)%360,t<0?t+360:t}function h6(t){return Math.max(0,Math.min(1,t||0))}function A9(t,r,f){return(t<60?r+(f-r)*t/60:t<180?f:t<240?r+(f-r)*(240-t)/60:r)*255}var b6=Math.PI/180,g6=180/Math.PI;var c6=18,Bc=0.96422,zc=1,Rc=0.82521,Dc=0.13793103448275862,Ru=0.20689655172413793,Ac=3*Ru*Ru,Lq=Ru*Ru*Ru;function Oc(t){if(t instanceof $0)return new $0(t.l,t.a,t.b,t.opacity);if(t instanceof Y0)return sc(t);if(!(t instanceof st))t=e1(t);var r=n9(t.r),f=n9(t.g),u=n9(t.b),h=O9((0.2225045*r+0.7168786*f+0.0606169*u)/zc),x,b;if(r===f&&f===u)x=b=h;else x=O9((0.4360747*r+0.3850649*f+0.1430804*u)/Bc),b=O9((0.0139322*r+0.0971045*f+0.7141733*u)/Rc);return new $0(116*h-16,500*(x-h),200*(h-b),t.opacity)}function Du(t,r,f,u){return arguments.length===1?Oc(t):new $0(t,r,f,u==null?1:u)}function $0(t,r,f,u){this.l=+t,this.a=+r,this.b=+f,this.opacity=+u}M0($0,Du,qf(q0,{brighter(t){return new $0(this.l+c6*(t==null?1:t),this.a,this.b,this.opacity)},darker(t){return new $0(this.l-c6*(t==null?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,r=isNaN(this.a)?t:t+this.a/500,f=isNaN(this.b)?t:t-this.b/200;return r=Bc*s9(r),t=zc*s9(t),f=Rc*s9(f),new st(I9(3.1338561*r-1.6168667*t-0.4906146*f),I9(-0.9787684*r+1.9161415*t+0.033454*f),I9(0.0719453*r-0.2289914*t+1.4052427*f),this.opacity)}}));function O9(t){return t>Lq?Math.pow(t,0.3333333333333333):t/Ac+Dc}function s9(t){return t>Ru?t*t*t:Ac*(t-Dc)}function I9(t){return 255*(t<=0.0031308?12.92*t:1.055*Math.pow(t,0.4166666666666667)-0.055)}function n9(t){return(t/=255)<=0.04045?t/12.92:Math.pow((t+0.055)/1.055,2.4)}function Gq(t){if(t instanceof Y0)return new Y0(t.h,t.c,t.l,t.opacity);if(!(t instanceof $0))t=Oc(t);if(t.a===0&&t.b===0)return new Y0(NaN,0=1?(f=1,r-1):Math.floor(f*r),h=t[u],x=t[u+1],b=u>0?t[u-1]:2*h-x,g=u()=>t;function Yc(t,r){return function(f){return t+f*r}}function zq(t,r,f){return t=Math.pow(t,f),r=Math.pow(r,f)-t,f=1/f,function(u){return Math.pow(t+u*r,f)}}function Ou(t,r){var f=r-t;return f?Yc(t,f>180||f<-180?f-360*Math.round(f/360):f):Au(isNaN(t)?r:t)}function Sc(t){return(t=+t)===1?Zt:function(r,f){return f-r?zq(r,f,t):Au(isNaN(r)?f:r)}}function Zt(t,r){var f=r-t;return f?Yc(t,f):Au(isNaN(t)?r:t)}var zr=function t(r){var f=Sc(r);function u(h,x){var b=f((h=Br(h)).r,(x=Br(x)).r),g=f(h.g,x.g),c=f(h.b,x.b),_=Zt(h.opacity,x.opacity);return function(l){return h.r=b(l),h.g=g(l),h.b=c(l),h.opacity=_(l),h+""}}return u.gamma=t,u}(1);function oc(t){return function(r){var f=r.length,u=Array(f),h=Array(f),x=Array(f),b,g;for(b=0;bf)if(x=r.slice(f,x),g[b])g[b]+=x;else g[++b]=x;if((u=u[0])===(h=h[0]))if(g[b])g[b]+=h;else g[++b]=h;else g[++b]=null,c.push({i:b,x:Qt(u,h)});f=y9.lastIndex}if(f180)l+=360;else if(l-_>180)_+=360;w.push({i:d.push(h(d)+"rotate(",null,u)-2,x:Qt(_,l)})}else if(l)d.push(h(d)+"rotate("+l+u)}function g(_,l,d,w){if(_!==l)w.push({i:d.push(h(d)+"skewX(",null,u)-2,x:Qt(_,l)});else if(l)d.push(h(d)+"skewX("+l+u)}function c(_,l,d,w,M,H){if(_!==d||l!==w){var q=M.push(h(M)+"scale(",null,",",null,")");H.push({i:q-4,x:Qt(_,d)},{i:q-2,x:Qt(l,w)})}else if(d!==1||w!==1)M.push(h(M)+"scale("+d+","+w+")")}return function(_,l){var d=[],w=[];return _=t(_),l=t(l),x(_.translateX,_.translateY,l.translateX,l.translateY,d,w),b(_.rotate,l.rotate,d,w),g(_.skewX,l.skewX,d,w),c(_.scaleX,_.scaleY,l.scaleX,l.scaleY,d,w),_=l=null,function(M){var H=-1,q=w.length,$;while(++H=0)t._call.call(void 0,r);t=t._next}--nu}function f3(){ef=(q6=fh.now())+$6,nu=th=0;try{x3()}finally{nu=0,vq(),ef=0}}function Xq(){var t=fh.now(),r=t-q6;if(r>u3)$6-=r,q6=t}function vq(){var t,r=H6,f,u=1/0;while(r)if(r._call){if(u>r._time)u=r._time;t=r,r=r._next}else f=r._next,r._next=null,r=t?t._next=f:H6=f;rh=t,u2(u)}function u2(t){if(nu)return;if(th)th=clearTimeout(th);var r=t-ef;if(r>24){if(t<1/0)th=setTimeout(f3,t-fh.now()-$6);if(p1)p1=clearInterval(p1)}else{if(!p1)q6=fh.now(),p1=setInterval(Xq,u3);nu=1,h3(f3)}}function xh(t,r,f){var u=new uh;return r=r==null?0:+r,u.restart((h)=>{u.stop(),t(h+r)},r,f),u}var Yq=y4("start","end","cancel","interrupt"),Sq=[],c3=0,b3=1,J6=2,E6=3,g3=4,Q6=5,bh=6;function S0(t,r,f,u,h,x){var b=t.__transition;if(!b)t.__transition={};else if(f in b)return;oq(t,f,{name:r,index:u,group:h,on:Yq,tween:Sq,time:x.time,delay:x.delay,duration:x.duration,ease:x.ease,timer:null,state:c3})}function gh(t,r){var f=Xt(t,r);if(f.state>c3)throw Error("too late; already scheduled");return f}function rr(t,r){var f=Xt(t,r);if(f.state>E6)throw Error("too late; already running");return f}function Xt(t,r){var f=t.__transition;if(!f||!(f=f[r]))throw Error("transition not found");return f}function oq(t,r,f){var u=t.__transition,h;u[r]=f,f.timer=P6(x,0,f.time);function x(_){if(f.state=b3,f.timer.restart(b,f.delay,f.time),f.delay<=_)b(_-f.delay)}function b(_){var l,d,w,M;if(f.state!==b3)return c();for(l in u){if(M=u[l],M.name!==f.name)continue;if(M.state===E6)return xh(b);if(M.state===g3)M.state=bh,M.timer.stop(),M.on.call("interrupt",t,t.__data__,M.index,M.group),delete u[l];else if(+lJ6&&u.state=0)r=r.slice(0,f);return!r||r==="start"})}function w$(t,r,f){var u,h,x=d$(r)?gh:rr;return function(){var b=x(this,t),g=b.on;if(g!==u)(h=(u=g).copy()).on(r,f);b.on=h}}function H2(t,r){var f=this._id;return arguments.length<2?Xt(this.node(),f).on.on(t):this.each(w$(f,t,r))}function M$(t){return function(){var r=this.parentNode;for(var f in this.__transition)if(+f!==t)return;if(r)r.removeChild(this)}}function q2(){return this.on("end.remove",M$(this._id))}function $2(t){var r=this._name,f=this._id;if(typeof t!=="function")t=Mf(t);for(var u=this._groups,h=u.length,x=Array(h),b=0;b=0))throw Error(`invalid digits: ${t}`);if(r>15)return w3;let f=10**r;return function(u){this._+=u[0];for(let h=1,x=u.length;h0.000001));else if(!(Math.abs(l*g-c*_)>0.000001)||!h)this._append`L${this._x1=t},${this._y1=r}`;else{let w=f-x,M=u-b,H=g*g+c*c,q=w*w+M*M,$=Math.sqrt(H),E=Math.sqrt(d),P=h*Math.tan((V2-Math.acos((H+d-q)/(2*$*E)))/2),J=P/E,Q=P/$;if(Math.abs(J-1)>0.000001)this._append`L${t+J*_},${r+J*l}`;this._append`A${h},${h},0,0,${+(l*w>_*M)},${this._x1=t+Q*g},${this._y1=r+Q*c}`}}arc(t,r,f,u,h,x){if(t=+t,r=+r,f=+f,x=!!x,f<0)throw Error(`negative radius: ${f}`);let b=f*Math.cos(u),g=f*Math.sin(u),c=t+b,_=r+g,l=1^x,d=x?u-h:h-u;if(this._x1===null)this._append`M${c},${_}`;else if(Math.abs(this._x1-c)>0.000001||Math.abs(this._y1-_)>0.000001)this._append`L${c},${_}`;if(!f)return;if(d<0)d=d%N2+N2;if(d>T$)this._append`A${f},${f},0,1,${l},${t-b},${r-g}A${f},${f},0,1,${l},${this._x1=c},${this._y1=_}`;else if(d>0.000001)this._append`A${f},${f},0,${+(d>=V2)},${l},${this._x1=t+f*Math.cos(h)},${this._y1=r+f*Math.sin(h)}`}rect(t,r,f,u){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${f=+f}v${+u}h${-f}Z`}toString(){return this._}}function M3(){return new af}M3.prototype=af.prototype;function Wr(t=3){return new af(+t)}function T2(t){return Math.abs(t=Math.round(t))>=1000000000000000000000?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function yf(t,r){if(!isFinite(t)||t===0)return null;var f=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"),u=t.slice(0,f);return[u.length>1?u[0]+u.slice(2):u,+t.slice(f+1)]}function yr(t){return t=yf(Math.abs(t)),t?t[1]:NaN}function F2(t,r){return function(f,u){var h=f.length,x=[],b=0,g=t[0],c=0;while(h>0&&g>0){if(c+g+1>u)g=Math.max(1,u-c);if(x.push(f.substring(h-=g,h+g)),(c+=g+1)>u)break;g=t[b=(b+1)%t.length]}return x.reverse().join(r)}}function L2(t){return function(r){return r.replace(/[0-9]/g,function(f){return t[+f]})}}var L$=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function E0(t){if(!(r=L$.exec(t)))throw Error("invalid format: "+t);var r;return new K6({fill:r[1],align:r[2],sign:r[3],symbol:r[4],zero:r[5],width:r[6],comma:r[7],precision:r[8]&&r[8].slice(1),trim:r[9],type:r[10]})}E0.prototype=K6.prototype;function K6(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}K6.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function G2(t){t:for(var r=t.length,f=1,u=-1,h;f0)u=0;break}return u>0?t.slice(0,u)+t.slice(h+1):t}var lh;function B2(t,r){var f=yf(t,r);if(!f)return lh=void 0,t.toPrecision(r);var u=f[0],h=f[1],x=h-(lh=Math.max(-8,Math.min(8,Math.floor(h/3)))*3)+1,b=u.length;return x===b?u:x>b?u+Array(x-b+1).join("0"):x>0?u.slice(0,x)+"."+u.slice(x):"0."+Array(1-x).join("0")+yf(t,Math.max(0,r+x-1))[0]}function W6(t,r){var f=yf(t,r);if(!f)return t+"";var u=f[0],h=f[1];return h<0?"0."+Array(-h).join("0")+u:u.length>h+1?u.slice(0,h+1)+"."+u.slice(h+1):u+Array(h-u.length+2).join("0")}var z2={"%":(t,r)=>(t*100).toFixed(r),b:(t)=>Math.round(t).toString(2),c:(t)=>t+"",d:T2,e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:(t)=>Math.round(t).toString(8),p:(t,r)=>W6(t*100,r),r:W6,s:B2,X:(t)=>Math.round(t).toString(16).toUpperCase(),x:(t)=>Math.round(t).toString(16)};function i6(t){return t}var H3=Array.prototype.map,q3=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function R2(t){var r=t.grouping===void 0||t.thousands===void 0?i6:F2(H3.call(t.grouping,Number),t.thousands+""),f=t.currency===void 0?"":t.currency[0]+"",u=t.currency===void 0?"":t.currency[1]+"",h=t.decimal===void 0?".":t.decimal+"",x=t.numerals===void 0?i6:L2(H3.call(t.numerals,String)),b=t.percent===void 0?"%":t.percent+"",g=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function _(d,w){d=E0(d);var{fill:M,align:H,sign:q,symbol:$,zero:E,width:P,comma:J,precision:Q,trim:U,type:C}=d;if(C==="n")J=!0,C="g";else if(!z2[C])Q===void 0&&(Q=12),U=!0,C="g";if(E||M==="0"&&H==="=")E=!0,M="0",H="=";var W=(w&&w.prefix!==void 0?w.prefix:"")+($==="$"?f:$==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():""),i=($==="$"?u:/[%p]/.test(C)?b:"")+(w&&w.suffix!==void 0?w.suffix:""),Z=z2[C],R=/[defgprs%]/.test(C);Q=Q===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,Q)):Math.max(0,Math.min(20,Q));function z(G){var N=W,L=i,K,V,y;if(C==="c")L=Z(G)+L,G="";else{G=+G;var I=G<0||1/G<0;if(G=isNaN(G)?c:Z(Math.abs(G),Q),U)G=G2(G);if(I&&+G===0&&q!=="+")I=!1;if(N=(I?q==="("?q:g:q==="-"||q==="("?"":q)+N,L=(C==="s"&&!isNaN(G)&&lh!==void 0?q3[8+lh/3]:"")+L+(I&&q==="("?")":""),R){K=-1,V=G.length;while(++Ky||y>57){L=(y===46?h+G.slice(K+1):G.slice(K))+L,G=G.slice(0,K);break}}}if(J&&!E)G=r(G,1/0);var A=N.length+G.length+L.length,s=A>1)+N+G+L+s.slice(A);break;default:G=s+N+G+L;break}return x(G)}return z.toString=function(){return d+""},z}function l(d,w){var M=Math.max(-8,Math.min(8,Math.floor(yr(w)/3)))*3,H=Math.pow(10,-M),q=_((d=E0(d),d.type="f",d),{suffix:q3[8+M/3]});return function($){return q(H*$)}}return{format:_,formatPrefix:l}}var Z6,Dr,V6;D2({thousands:",",grouping:[3],currency:["$",""]});function D2(t){return Z6=R2(t),Dr=Z6.format,V6=Z6.formatPrefix,Z6}function N6(t){return Math.max(0,-yr(Math.abs(t)))}function T6(t,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(yr(r)/3)))*3-yr(Math.abs(t)))}function F6(t,r){return t=Math.abs(t),r=Math.abs(r)-t,Math.max(0,yr(r)-yr(t))+1}var j=0.000001,L6=0.000000000001,ft=Math.PI,Mt=ft/2,A2=ft/4,mt=ft*2,vt=180/ft,Ht=ft/180,xt=Math.abs,Ar=Math.atan,fr=Math.atan2,o=Math.cos;var G6=Math.exp;var{log:kf,pow:B6,sin:S}=Math,xr=Math.sign||function(t){return t>0?1:t<0?-1:0},Ut=Math.sqrt,vu=Math.tan;function z6(t){return t>1?0:t<-1?ft:Math.acos(t)}function Gt(t){return t>1?Mt:t<-1?-Mt:Math.asin(t)}function jt(){}function R6(t,r){if(t&&P3.hasOwnProperty(t.type))P3[t.type](t,r)}var $3={Feature:function(t,r){R6(t.geometry,r)},FeatureCollection:function(t,r){var f=t.features,u=-1,h=f.length;while(++uft)t-=Math.round(t/mt)*mt;return[t,r]}s2.invert=s2;function I2(t,r,f){return(t%=mt)?r||f?Su(Q3(t),U3(r,f)):Q3(t):r||f?U3(r,f):s2}function J3(t){return function(r,f){if(r+=t,xt(r)>ft)r-=Math.round(r/mt)*mt;return[r,f]}}function Q3(t){var r=J3(t);return r.invert=J3(-t),r}function U3(t,r){var f=o(t),u=S(t),h=o(r),x=S(r);function b(g,c){var _=o(c),l=o(g)*_,d=S(g)*_,w=S(c),M=w*f+l*u;return[fr(d*h-M*x,l*f-w*u),Gt(M*h+d*x)]}return b.invert=function(g,c){var _=o(c),l=o(g)*_,d=S(g)*_,w=S(c),M=w*h-d*x;return[fr(d*h+w*x,l*f+M*u),Gt(M*f-l*u)]},b}function n2(t){t=I2(t[0]*Ht,t[1]*Ht,t.length>2?t[2]*Ht:0);function r(f){return f=t(f[0]*Ht,f[1]*Ht),f[0]*=vt,f[1]*=vt,f}return r.invert=function(f){return f=t.invert(f[0]*Ht,f[1]*Ht),f[0]*=vt,f[1]*=vt,f},r}function K3(t,r,f,u,h,x){if(!f)return;var b=o(r),g=S(r),c=u*f;if(h==null)h=r+u*mt,x=r-c/2;else if(h=C3(b,h),x=C3(b,x),u>0?hx)h+=u*mt;for(var _,l=h;u>0?l>x:l1)t.push(t.pop().concat(t.shift()))},result:function(){var f=t;return t=[],r=null,f}}}function pf(t,r){return xt(t[0]-r[0])=0;--g)h.point((d=l[g])[0],d[1])}else u(w.x,w.p.x,-1,h);w=w.p}w=w.o,l=w.z,M=!M}while(!w.v);h.lineEnd()}}function W3(t){if(!(r=t.length))return;var r,f=0,u=t[0],h;while(++f=0?1:-1,R=Z*i,z=R>ft,G=$*C;if(c.add(fr(G*Z*S(R),E*W+G*o(R))),b+=z?i+Z*mt:i,z^H>=f^Q>=f){var N=Yu(J0(M),J0(J));Hh(N);var L=Yu(x,N);Hh(L);var K=(z^i>=0?-1:1)*Gt(L[2]);if(u>K||u===K&&(N[0]||N[1]))g+=z^i>=0?1:-1}}}return(b<-j||b0){if(!c)h.polygonStart(),c=!0;h.lineStart();for(C=0;C1&&Q&2)U.push(U.pop().concat(U.shift()));l.push(U.filter(G$))}return w}}function G$(t){return t.length>1}function B$(t,r){return((t=t.x)[0]<0?t[1]-Mt-j:Mt-t[1])-((r=r.x)[0]<0?r[1]-Mt-j:Mt-r[1])}var Y2=Ph(function(){return!0},z$,D$,[-ft,-Mt]);function z$(t){var r=NaN,f=NaN,u=NaN,h;return{lineStart:function(){t.lineStart(),h=1},point:function(x,b){var g=x>0?ft:-ft,c=xt(x-r);if(xt(c-ft)0?Mt:-Mt),t.point(u,f),t.lineEnd(),t.lineStart(),t.point(g,f),t.point(x,f),h=0;else if(u!==g&&c>=ft){if(xt(r-u)j?Ar((S(r)*(x=o(u))*S(f)-S(u)*(h=o(r))*S(t))/(h*x*b)):(r+u)/2}function D$(t,r,f,u){var h;if(t==null)h=f*Mt,u.point(-ft,h),u.point(0,h),u.point(ft,h),u.point(ft,0),u.point(ft,-h),u.point(0,-h),u.point(-ft,-h),u.point(-ft,0),u.point(-ft,h);else if(xt(t[0]-r[0])>j){var x=t[0]0,h=xt(r)>j;function x(l,d,w,M){K3(M,t,f,w,l,d)}function b(l,d){return o(l)*o(d)>r}function g(l){var d,w,M,H,q;return{lineStart:function(){H=M=!1,q=1},point:function($,E){var P=[$,E],J,Q=b($,E),U=u?Q?0:_($,E):Q?_($+($<0?ft:-ft),E):0;if(!d&&(H=M=Q))l.lineStart();if(Q!==M){if(J=c(d,P),!J||pf(d,J)||pf(P,J))P[2]=1}if(Q!==M){if(q=0,Q)l.lineStart(),J=c(P,d),l.point(J[0],J[1]);else J=c(d,P),l.point(J[0],J[1],2),l.lineEnd();d=J}else if(h&&d&&u^Q){var C;if(!(U&w)&&(C=c(P,d,!0)))if(q=0,u)l.lineStart(),l.point(C[0][0],C[0][1]),l.point(C[1][0],C[1][1]),l.lineEnd();else l.point(C[1][0],C[1][1]),l.lineEnd(),l.lineStart(),l.point(C[0][0],C[0][1],3)}if(Q&&(!d||!pf(d,P)))l.point(P[0],P[1]);d=P,M=Q,w=U},lineEnd:function(){if(M)l.lineEnd();d=null},clean:function(){return q|(H&&M)<<1}}}function c(l,d,w){var M=J0(l),H=J0(d),q=[1,0,0],$=Yu(M,H),E=wh($,$),P=$[0],J=E-P*P;if(!J)return!w&&l;var Q=r*E/J,U=-r*P/J,C=Yu(q,$),W=Mh(q,Q),i=Mh($,U);D6(W,i);var Z=C,R=wh(W,Z),z=wh(Z,Z),G=R*R-z*(wh(W,W)-1);if(G<0)return;var N=Ut(G),L=Mh(Z,(-R-N)/z);if(D6(L,W),L=dh(L),!w)return L;var K=l[0],V=d[0],y=l[1],I=d[1],A;if(V0^L[1]<(xt(L[0]-K)ft^(K<=L[0]&&L[0]<=V)){var X=Mh(Z,(-R+N)/z);return D6(X,W),[L,dh(X)]}}function _(l,d){var w=u?t:ft-t,M=0;if(l<-w)M|=1;else if(l>w)M|=2;if(d<-w)M|=4;else if(d>w)M|=8;return M}return Ph(b,g,x,u?[0,-t]:[-ft,t-ft])}function o2(t,r,f,u,h,x){var b=t[0],g=t[1],c=r[0],_=r[1],l=0,d=1,w=c-b,M=_-g,H;if(H=f-b,!w&&H>0)return;if(H/=w,w<0){if(H0){if(H>d)return;if(H>l)l=H}if(H=h-b,!w&&H<0)return;if(H/=w,w<0){if(H>d)return;if(H>l)l=H}else if(w>0){if(H0)return;if(H/=M,M<0){if(H0){if(H>d)return;if(H>l)l=H}if(H=x-g,!M&&H<0)return;if(H/=M,M<0){if(H>d)return;if(H>l)l=H}else if(M>0){if(H0)t[0]=b+l*w,t[1]=g+l*M;if(d<1)r[0]=b+d*w,r[1]=g+d*M;return!0}var Eh=1e9,O6=-Eh;function ou(t,r,f,u){function h(_,l){return t<=_&&_<=f&&r<=l&&l<=u}function x(_,l,d,w){var M=0,H=0;if(_==null||(M=b(_,d))!==(H=b(l,d))||c(_,l)<0^d>0)do w.point(M===0||M===3?t:f,M>1?u:r);while((M=(M+d+4)%4)!==H);else w.point(l[0],l[1])}function b(_,l){return xt(_[0]-t)0?0:3:xt(_[0]-f)0?2:1:xt(_[1]-r)0?1:0:l>0?3:2}function g(_,l){return c(_.x,l.x)}function c(_,l){var d=b(_,1),w=b(l,1);return d!==w?d-w:d===0?l[1]-_[1]:d===1?_[0]-l[0]:d===2?_[1]-l[1]:l[0]-_[0]}return function(_){var l=_,d=qh(),w,M,H,q,$,E,P,J,Q,U,C,W={point:i,lineStart:G,lineEnd:N,polygonStart:R,polygonEnd:z};function i(K,V){if(h(K,V))l.point(K,V)}function Z(){var K=0;for(var V=0,y=M.length;Vu&&(ht-m)*(u-X)>(p-X)*(t-m))++K}else if(p<=u&&(ht-m)*(u-X)<(p-X)*(t-m))--K;return K}function R(){l=d,w=[],M=[],C=!0}function z(){var K=Z(),V=C&&K,y=(w=Lu(w)).length;if(V||y){if(_.polygonStart(),V)_.lineStart(),x(null,null,1,_),_.lineEnd();if(y)$h(w,g,K,x,_);_.polygonEnd()}l=_,w=M=H=null}function G(){if(W.point=L,M)M.push(H=[]);U=!0,Q=!1,P=J=NaN}function N(){if(w){if(L(q,$),E&&Q)d.rejoin();w.push(d.result())}if(W.point=i,Q)l.lineEnd()}function L(K,V){var y=h(K,V);if(M)H.push([K,V]);if(U){if(q=K,$=V,E=y,U=!1,y)l.lineStart(),l.point(K,V)}else if(y&&Q)l.point(K,V);else{var I=[P=Math.max(O6,Math.min(Eh,P)),J=Math.max(O6,Math.min(Eh,J))],A=[K=Math.max(O6,Math.min(Eh,K)),V=Math.max(O6,Math.min(Eh,V))];if(o2(I,A,t,r,f,u)){if(!Q)l.lineStart(),l.point(I[0],I[1]);if(l.point(A[0],A[1]),!y)l.lineEnd();C=!1}else if(y)l.lineStart(),l.point(K,V),C=!1}P=K,J=V,Q=y}return W}}var Jh=(t)=>t;var m2=new Lr,j2=new Lr,i3,Z3,e2,a2,Ef={point:jt,lineStart:jt,lineEnd:jt,polygonStart:function(){Ef.lineStart=A$,Ef.lineEnd=s$},polygonEnd:function(){Ef.lineStart=Ef.lineEnd=Ef.point=jt,m2.add(xt(j2)),j2=new Lr},result:function(){var t=m2/2;return m2=new Lr,t}};function A$(){Ef.point=O$}function O$(t,r){Ef.point=V3,i3=e2=t,Z3=a2=r}function V3(t,r){j2.add(a2*t-e2*r),e2=t,a2=r}function s$(){V3(i3,Z3)}var y2=Ef;var mu=1/0,s6=mu,Qh=-mu,I6=Qh,I$={point:n$,lineStart:jt,lineEnd:jt,polygonStart:jt,polygonEnd:jt,result:function(){var t=[[mu,s6],[Qh,I6]];return Qh=I6=-(s6=mu=1/0),t}};function n$(t,r){if(tQh)Qh=t;if(rI6)I6=r}var ju=I$;var k2=0,p2=0,Uh=0,n6=0,X6=0,eu=0,tx=0,rx=0,Ch=0,F3,L3,Q0,U0,kr={point:tu,lineStart:N3,lineEnd:T3,polygonStart:function(){kr.lineStart=Y$,kr.lineEnd=S$},polygonEnd:function(){kr.point=tu,kr.lineStart=N3,kr.lineEnd=T3},result:function(){var t=Ch?[tx/Ch,rx/Ch]:eu?[n6/eu,X6/eu]:Uh?[k2/Uh,p2/Uh]:[NaN,NaN];return k2=p2=Uh=n6=X6=eu=tx=rx=Ch=0,t}};function tu(t,r){k2+=t,p2+=r,++Uh}function N3(){kr.point=X$}function X$(t,r){kr.point=v$,tu(Q0=t,U0=r)}function v$(t,r){var f=t-Q0,u=r-U0,h=Ut(f*f+u*u);n6+=h*(Q0+t)/2,X6+=h*(U0+r)/2,eu+=h,tu(Q0=t,U0=r)}function T3(){kr.point=tu}function Y$(){kr.point=o$}function S$(){G3(F3,L3)}function o$(t,r){kr.point=G3,tu(F3=Q0=t,L3=U0=r)}function G3(t,r){var f=t-Q0,u=r-U0,h=Ut(f*f+u*u);n6+=h*(Q0+t)/2,X6+=h*(U0+r)/2,eu+=h,h=U0*t-Q0*r,tx+=h*(Q0+t),rx+=h*(U0+r),Ch+=h*3,tu(Q0=t,U0=r)}var fx=kr;function v6(t){this._context=t}v6.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){if(this._line===0)this._context.closePath();this._point=NaN},point:function(t,r){switch(this._point){case 0:{this._context.moveTo(t,r),this._point=1;break}case 1:{this._context.lineTo(t,r);break}default:{this._context.moveTo(t+this._radius,r),this._context.arc(t,r,this._radius,0,mt);break}}},result:jt};var hx=new Lr,ux,B3,z3,Kh,Wh,Y6={point:jt,lineStart:function(){Y6.point=m$},lineEnd:function(){if(ux)R3(B3,z3);Y6.point=jt},polygonStart:function(){ux=!0},polygonEnd:function(){ux=null},result:function(){var t=+hx;return hx=new Lr,t}};function m$(t,r){Y6.point=R3,B3=Kh=t,z3=Wh=r}function R3(t,r){Kh-=t,Wh-=r,hx.add(Ut(Kh*Kh+Wh*Wh)),Kh=t,Wh=r}var xx=Y6;var D3,S6,A3,O3;class ih{constructor(t){this._append=t==null?s3:j$(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){if(this._line===0)this._+="Z";this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==A3||this._append!==S6){let f=this._radius,u=this._;this._="",this._append`m0,${f}a${f},${f} 0 1,1 0,${-2*f}a${f},${f} 0 1,1 0,${2*f}z`,A3=f,S6=this._append,O3=this._,this._=u}this._+=O3;break}}}result(){let t=this._;return this._="",t.length?t:null}}function s3(t){let r=1;this._+=t[0];for(let f=t.length;r=0))throw RangeError(`invalid digits: ${t}`);if(r>15)return s3;if(r!==D3){let f=10**r;D3=r,S6=function(h){let x=1;this._+=h[0];for(let b=h.length;x=0))throw RangeError(`invalid digits: ${g}`);f=c}if(r===null)x=new ih(f);return b},b.projection(t).digits(f).context(r)}function fu(t){return{stream:au(t)}}function au(t){return function(r){var f=new bx;for(var u in t)f[u]=t[u];return f.stream=r,f}}function bx(){}bx.prototype={constructor:bx,point:function(t,r){this.stream.point(t,r)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function gx(t,r,f){var u=t.clipExtent&&t.clipExtent();if(t.scale(150).translate([0,0]),u!=null)t.clipExtent(null);if(Or(f,t.stream(ju)),r(ju.result()),u!=null)t.clipExtent(u);return t}function Zh(t,r,f){return gx(t,function(u){var h=r[1][0]-r[0][0],x=r[1][1]-r[0][1],b=Math.min(h/(u[1][0]-u[0][0]),x/(u[1][1]-u[0][1])),g=+r[0][0]+(h-b*(u[1][0]+u[0][0]))/2,c=+r[0][1]+(x-b*(u[1][1]+u[0][1]))/2;t.scale(150*b).translate([g,c])},f)}function o6(t,r,f){return Zh(t,[[0,0],r],f)}function m6(t,r,f){return gx(t,function(u){var h=+r,x=h/(u[1][0]-u[0][0]),b=(h-x*(u[1][0]+u[0][0]))/2,g=-x*u[0][1];t.scale(150*x).translate([b,g])},f)}function j6(t,r,f){return gx(t,function(u){var h=+r,x=h/(u[1][1]-u[0][1]),b=-x*u[0][0],g=(h-x*(u[1][1]+u[0][1]))/2;t.scale(150*x).translate([b,g])},f)}var I3=16,e$=o(30*Ht);function e6(t,r){return+r?y$(t,r):a$(t)}function a$(t){return au({point:function(r,f){r=t(r,f),this.stream.point(r[0],r[1])}})}function y$(t,r){function f(u,h,x,b,g,c,_,l,d,w,M,H,q,$){var E=_-u,P=l-h,J=E*E+P*P;if(J>4*r&&q--){var Q=b+w,U=g+M,C=c+H,W=Ut(Q*Q+U*U+C*C),i=Gt(C/=W),Z=xt(xt(C)-1)r||xt((E*N+P*L)/J-0.5)>0.3||b*w+g*M+c*H2?K[2]%360*Ht:0,N()):[g*vt,c*vt,_*vt]},z.angle=function(K){return arguments.length?(d=K%360*Ht,N()):d*vt},z.reflectX=function(K){return arguments.length?(w=K?-1:1,N()):w<0},z.reflectY=function(K){return arguments.length?(M=K?-1:1,N()):M<0},z.precision=function(K){return arguments.length?(C=e6(W,U=K*K),L()):Ut(U)},z.fitExtent=function(K,V){return Zh(z,K,V)},z.fitSize=function(K,V){return o6(z,K,V)},z.fitWidth=function(K,V){return m6(z,K,V)},z.fitHeight=function(K,V){return j6(z,K,V)};function N(){var K=n3(f,0,0,w,M,d).apply(null,r(x,b)),V=n3(f,u-K[0],h-K[1],w,M,d);return l=I2(g,c,_),W=Su(r,V),i=Su(l,W),C=e6(W,U),L()}function L(){return Z=R=null,z}return function(){return r=t.apply(this,arguments),z.invert=r.invert&&G,N()}}function yu(t){var r=0,f=ft/3,u=cx(t),h=u(r,f);return h.parallels=function(x){return arguments.length?u(r=x[0]*Ht,f=x[1]*Ht):[r*vt,f*vt]},h}function X3(t){var r=o(t);function f(u,h){return[u*r,S(h)/r]}return f.invert=function(u,h){return[u/r,Gt(h*r)]},f}function v3(t,r){var f=S(t),u=(f+S(r))/2;if(xt(u)=0.12&&$<0.234&&q>=-0.425&&q<-0.214?h:$>=0.166&&$<0.234&&q>=-0.214&&q<-0.115?b:f).invert(w)},l.stream=function(w){return t&&r===w?t:t=rP([f.stream(r=w),h.stream(w),b.stream(w)])},l.precision=function(w){if(!arguments.length)return f.precision();return f.precision(w),h.precision(w),b.precision(w),d()},l.scale=function(w){if(!arguments.length)return f.scale();return f.scale(w),h.scale(w*0.35),b.scale(w),l.translate(f.translate())},l.translate=function(w){if(!arguments.length)return f.translate();var M=f.scale(),H=+w[0],q=+w[1];return u=f.translate(w).clipExtent([[H-0.455*M,q-0.238*M],[H+0.455*M,q+0.238*M]]).stream(_),x=h.translate([H-0.307*M,q+0.201*M]).clipExtent([[H-0.425*M+j,q+0.12*M+j],[H-0.214*M-j,q+0.234*M-j]]).stream(_),g=b.translate([H-0.205*M,q+0.212*M]).clipExtent([[H-0.214*M+j,q+0.166*M+j],[H-0.115*M-j,q+0.234*M-j]]).stream(_),d()},l.fitExtent=function(w,M){return Zh(l,w,M)},l.fitSize=function(w,M){return o6(l,w,M)},l.fitWidth=function(w,M){return m6(l,w,M)},l.fitHeight=function(w,M){return j6(l,w,M)};function d(){return t=r=null,l}return l.scale(1070)}function y6(t){return function(r,f){var u=o(r),h=o(f),x=t(u*h);if(x===1/0)return[2,0];return[x*h*S(r),x*S(f)]}}function C0(t){return function(r,f){var u=Ut(r*r+f*f),h=t(u),x=S(h),b=o(h);return[fr(r*x,u*b),Gt(u&&f*x/u)]}}var _x=y6(function(t){return Ut(2/(1+t))});_x.invert=C0(function(t){return 2*Gt(t/2)});function k6(){return ur(_x).scale(124.75).clipAngle(179.999)}var lx=y6(function(t){return(t=z6(t))&&t/S(t)});lx.invert=C0(function(t){return t});function p6(){return ur(lx).scale(79.4188).clipAngle(179.999)}function pu(t,r){return[t,kf(vu((Mt+r)/2))]}pu.invert=function(t,r){return[t,2*Ar(G6(r))-Mt]};function t5(){return dx(pu).scale(961/mt)}function dx(t){var r=ur(t),f=r.center,u=r.scale,h=r.translate,x=r.clipExtent,b=null,g,c,_;r.scale=function(d){return arguments.length?(u(d),l()):u()},r.translate=function(d){return arguments.length?(h(d),l()):h()},r.center=function(d){return arguments.length?(f(d),l()):f()},r.clipExtent=function(d){return arguments.length?(d==null?b=g=c=_=null:(b=+d[0][0],g=+d[0][1],c=+d[1][0],_=+d[1][1]),l()):b==null?null:[[b,g],[c,_]]};function l(){var d=ft*u(),w=r(n2(r.rotate()).invert([0,0]));return x(b==null?[[w[0]-d,w[1]-d],[w[0]+d,w[1]+d]]:t===pu?[[Math.max(w[0]-d,b),g],[Math.min(w[0]+d,c),_]]:[[b,Math.max(w[1]-d,g)],[c,Math.min(w[1]+d,_)]])}return l()}function r5(t){return vu((Mt+t)/2)}function Y3(t,r){var f=o(t),u=t===r?S(t):kf(f/o(r))/kf(r5(r)/r5(t)),h=f*B6(r5(t),u)/u;if(!u)return pu;function x(b,g){if(h>0){if(g<-Mt+j)g=-Mt+j}else if(g>Mt-j)g=Mt-j;var c=h/B6(r5(g),u);return[c*S(u*b),h-c*o(u*b)]}return x.invert=function(b,g){var c=h-g,_=xr(u)*Ut(b*b+c*c),l=fr(b,xt(c))*xr(c);if(c*u<0)l-=ft*xr(b)*xr(c);return[l/u,2*Ar(B6(h/_,1/u))-Mt]},x}function f5(){return yu(Y3).scale(109.5).parallels([30,30])}function t1(t,r){return[t,r]}t1.invert=t1;function u5(){return ur(t1).scale(152.63)}function S3(t,r){var f=o(t),u=t===r?S(t):(f-o(r))/(r-t),h=f/u+t;if(xt(u)2?u[2]+90:90]):(u=f(),[u[0],u[1],u[2]-90])},f([0,0,90]).scale(159.155)}function It(t,r){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(r).domain(t);break}return this}function Lh(t,r){switch(arguments.length){case 0:break;case 1:{if(typeof t==="function")this.interpolator(t);else this.range(t);break}default:{if(this.domain(t),typeof r==="function")this.interpolator(r);else this.range(r);break}}return this}var Gh=Symbol("implicit");function uu(){var t=new Pr,r=[],f=[],u=Gh;function h(x){let b=t.get(x);if(b===void 0){if(u!==Gh)return u;t.set(x,b=r.push(x)-1)}return f[b%f.length]}return h.domain=function(x){if(!arguments.length)return r.slice();r=[],t=new Pr;for(let b of x){if(t.has(b))continue;t.set(b,r.push(b)-1)}return h},h.range=function(x){return arguments.length?(f=Array.from(x),h):f.slice()},h.unknown=function(x){return arguments.length?(u=x,h):u},h.copy=function(){return uu(r,f).unknown(u)},It.apply(h,arguments),h}function Jf(){var t=uu().unknown(void 0),r=t.domain,f=t.range,u=0,h=1,x,b,g=!1,c=0,_=0,l=0.5;delete t.unknown;function d(){var w=r().length,M=hr)f=t,t=r,r=f;return function(u){return Math.max(t,Math.min(r,u))}}function hP(t,r,f){var u=t[0],h=t[1],x=r[0],b=r[1];if(h2?xP:hP,c=_=null,d}function d(w){return w==null||isNaN(w=+w)?x:(c||(c=g(t.map(u),r,f)))(u(b(w)))}return d.invert=function(w){return b(h((_||(_=g(r,t.map(u),Qt)))(w)))},d.domain=function(w){return arguments.length?(t=Array.from(w,r1),l()):t.slice()},d.range=function(w){return arguments.length?(r=Array.from(w),l()):r.slice()},d.rangeRound=function(w){return r=Array.from(w),f=Pf,l()},d.clamp=function(w){return arguments.length?(b=w?!0:Er,l()):b!==Er},d.interpolate=function(w){return arguments.length?(f=w,l()):f},d.unknown=function(w){return arguments.length?(x=w,d):x},function(w,M){return u=w,h=M,l()}}function Bh(){return hu()(Er,Er)}function Qx(t,r,f,u){var h=Fu(t,r,f),x;switch(u=E0(u==null?",f":u),u.type){case"s":{var b=Math.max(Math.abs(t),Math.abs(r));if(u.precision==null&&!isNaN(x=T6(h,b)))u.precision=x;return V6(u,b)}case"":case"e":case"g":case"p":case"r":{if(u.precision==null&&!isNaN(x=F6(h,Math.max(Math.abs(t),Math.abs(r)))))u.precision=x-(u.type==="e");break}case"f":case"%":{if(u.precision==null&&!isNaN(x=N6(h)))u.precision=x-(u.type==="%")*2;break}}return Dr(u)}function j0(t){var r=t.domain;return t.ticks=function(f){var u=r();return jr(u[0],u[u.length-1],f==null?10:f)},t.tickFormat=function(f,u){var h=r();return Qx(h[0],h[h.length-1],f==null?10:f,u)},t.nice=function(f){if(f==null)f=10;var u=r(),h=0,x=u.length-1,b=u[h],g=u[x],c,_,l=10;if(g0){if(_=Xf(b,g,f),_===c)return u[h]=b,u[x]=g,r(u);else if(_>0)b=Math.floor(b/_)*_,g=Math.ceil(g/_)*_;else if(_<0)b=Math.ceil(b*_)/_,g=Math.floor(g*_)/_;else break;c=_}return t},t}function xu(){var t=Bh();return t.copy=function(){return K0(t,xu())},It.apply(t,arguments),j0(t)}function zh(t){var r;function f(u){return u==null||isNaN(u=+u)?r:u}return f.invert=f,f.domain=f.range=function(u){return arguments.length?(t=Array.from(u,r1),f):t.slice()},f.unknown=function(u){return arguments.length?(r=u,f):r},f.copy=function(){return zh(t).unknown(r)},t=arguments.length?Array.from(t,r1):[0,1],j0(f)}function Rh(t,r){t=t.slice();var f=0,u=t.length-1,h=t[f],x=t[u],b;if(xMath.pow(t,r)}function lP(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),(r)=>Math.log(r)/t)}function a3(t){return(r,f)=>-t(-r,f)}function Ux(t){let r=t(j3,e3),f=r.domain,u=10,h,x;function b(){if(h=lP(u),x=_P(u),f()[0]<0)h=a3(h),x=a3(x),t(bP,gP);else t(j3,e3);return r}return r.base=function(g){return arguments.length?(u=+g,b()):u},r.domain=function(g){return arguments.length?(f(g),b()):f()},r.ticks=(g)=>{let c=f(),_=c[0],l=c[c.length-1],d=l<_;if(d)[_,l]=[l,_];let w=h(_),M=h(l),H,q,$=g==null?10:+g,E=[];if(!(u%1)&&M-w<$){if(w=Math.floor(w),M=Math.ceil(M),_>0)for(;w<=M;++w)for(H=1;Hl)break;E.push(q)}else for(;w<=M;++w)for(H=u-1;H>=1;--H){if(q=w>0?H/x(-w):H*x(w),q<_)continue;if(q>l)break;E.push(q)}if(E.length*2<$)E=jr(_,l,$)}else E=jr(w,M,Math.min(M-w,$)).map(x);return d?E.reverse():E},r.tickFormat=(g,c)=>{if(g==null)g=10;if(c==null)c=u===10?"s":",";if(typeof c!=="function"){if(!(u%1)&&(c=E0(c)).precision==null)c.trim=!0;c=Dr(c)}if(g===1/0)return c;let _=Math.max(1,u*g/r.ticks().length);return(l)=>{let d=l/x(Math.round(h(l)));if(d*u{return f(Rh(f(),{floor:(g)=>x(Math.floor(h(g))),ceil:(g)=>x(Math.ceil(h(g)))}))},r}function Dh(){let t=Ux(hu()).domain([1,10]);return t.copy=()=>K0(t,Dh()).base(t.base()),It.apply(t,arguments),t}function y3(t){return function(r){return Math.sign(r)*Math.log1p(Math.abs(r/t))}}function k3(t){return function(r){return Math.sign(r)*Math.expm1(Math.abs(r))*t}}function Cx(t){var r=1,f=t(y3(r),k3(r));return f.constant=function(u){return arguments.length?t(y3(r=+u),k3(r)):r},j0(f)}function Ah(){var t=Cx(hu());return t.copy=function(){return K0(t,Ah()).constant(t.constant())},It.apply(t,arguments)}function p3(t){return function(r){return r<0?-Math.pow(-r,t):Math.pow(r,t)}}function dP(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function wP(t){return t<0?-t*t:t*t}function Kx(t){var r=t(Er,Er),f=1;function u(){return f===1?t(Er,Er):f===0.5?t(dP,wP):t(p3(f),p3(1/f))}return r.exponent=function(h){return arguments.length?(f=+h,u()):f},j0(r)}function Oh(){var t=Kx(hu());return t.copy=function(){return K0(t,Oh()).exponent(t.exponent())},It.apply(t,arguments),t}function sh(){var t=[],r=[],f=[],u;function h(){var b=0,g=Math.max(1,r.length);f=Array(g-1);while(++b0?f[g-1]:t[0],g{return t(x=new Date(+x)),x},h.ceil=(x)=>{return t(x=new Date(x-1)),r(x,1),t(x),x},h.round=(x)=>{let b=h(x),g=h.ceil(x);return x-b{return r(x=new Date(+x),b==null?1:Math.floor(b)),x},h.range=(x,b,g)=>{let c=[];if(x=h.ceil(x),g=g==null?1:Math.floor(g),!(x0))return c;let _;do c.push(_=new Date(+x)),r(x,g),t(x);while(_{return Jt((b)=>{if(b>=b)while(t(b),!x(b))b.setTime(b-1)},(b,g)=>{if(b>=b)if(g<0)while(++g<=0)while(r(b,-1),!x(b));else while(--g>=0)while(r(b,1),!x(b));})},f)h.count=(x,b)=>{return Wx.setTime(+x),ix.setTime(+b),t(Wx),t(ix),Math.floor(f(Wx,ix))},h.every=(x)=>{return x=Math.floor(x),!isFinite(x)||!(x>0)?null:!(x>1)?h:h.filter(u?(b)=>u(b)%x===0:(b)=>h.count(0,b)%x===0)};return h}var nh=Jt(()=>{},(t,r)=>{t.setTime(+t+r)},(t,r)=>{return r-t});nh.every=(t)=>{if(t=Math.floor(t),!isFinite(t)||!(t>0))return null;if(!(t>1))return nh;return Jt((r)=>{r.setTime(Math.floor(r/t)*t)},(r,f)=>{r.setTime(+r+f*t)},(r,f)=>{return(f-r)/t})};var mR=nh.range;var sr=1000,br=60000,W0=3600000,Qf=86400000,Xh=604800000,Zx=2592000000,d5=31536000000;var et=Jt((t)=>{t.setTime(t-t.getMilliseconds())},(t,r)=>{t.setTime(+t+r*sr)},(t,r)=>{return(r-t)/sr},(t)=>{return t.getUTCSeconds()}),t_=et.range;var e0=Jt((t)=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*sr)},(t,r)=>{t.setTime(+t+r*br)},(t,r)=>{return(r-t)/br},(t)=>{return t.getMinutes()}),MP=e0.range,a0=Jt((t)=>{t.setUTCSeconds(0,0)},(t,r)=>{t.setTime(+t+r*br)},(t,r)=>{return(r-t)/br},(t)=>{return t.getUTCMinutes()}),HP=a0.range;var y0=Jt((t)=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*sr-t.getMinutes()*br)},(t,r)=>{t.setTime(+t+r*W0)},(t,r)=>{return(r-t)/W0},(t)=>{return t.getHours()}),qP=y0.range,k0=Jt((t)=>{t.setUTCMinutes(0,0,0)},(t,r)=>{t.setTime(+t+r*W0)},(t,r)=>{return(r-t)/W0},(t)=>{return t.getUTCHours()}),$P=k0.range;var Ir=Jt((t)=>t.setHours(0,0,0,0),(t,r)=>t.setDate(t.getDate()+r),(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*br)/Qf,(t)=>t.getDate()-1),PP=Ir.range,bu=Jt((t)=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>{return(r-t)/Qf},(t)=>{return t.getUTCDate()-1}),EP=bu.range,gu=Jt((t)=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>{return(r-t)/Qf},(t)=>{return Math.floor(t/Qf)}),JP=gu.range;function cu(t){return Jt((r)=>{r.setDate(r.getDate()-(r.getDay()+7-t)%7),r.setHours(0,0,0,0)},(r,f)=>{r.setDate(r.getDate()+f*7)},(r,f)=>{return(f-r-(f.getTimezoneOffset()-r.getTimezoneOffset())*br)/Xh})}var ir=cu(0),Uf=cu(1),w5=cu(2),M5=cu(3),i0=cu(4),H5=cu(5),q5=cu(6),r_=ir.range,QP=Uf.range,UP=w5.range,CP=M5.range,KP=i0.range,WP=H5.range,iP=q5.range;function _u(t){return Jt((r)=>{r.setUTCDate(r.getUTCDate()-(r.getUTCDay()+7-t)%7),r.setUTCHours(0,0,0,0)},(r,f)=>{r.setUTCDate(r.getUTCDate()+f*7)},(r,f)=>{return(f-r)/Xh})}var Zr=_u(0),Cf=_u(1),$5=_u(2),P5=_u(3),Z0=_u(4),E5=_u(5),J5=_u(6),f_=Zr.range,ZP=Cf.range,VP=$5.range,NP=P5.range,TP=Z0.range,FP=E5.range,LP=J5.range;var p0=Jt((t)=>{t.setDate(1),t.setHours(0,0,0,0)},(t,r)=>{t.setMonth(t.getMonth()+r)},(t,r)=>{return r.getMonth()-t.getMonth()+(r.getFullYear()-t.getFullYear())*12},(t)=>{return t.getMonth()}),GP=p0.range,tf=Jt((t)=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCMonth(t.getUTCMonth()+r)},(t,r)=>{return r.getUTCMonth()-t.getUTCMonth()+(r.getUTCFullYear()-t.getUTCFullYear())*12},(t)=>{return t.getUTCMonth()}),BP=tf.range;var gr=Jt((t)=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r)},(t,r)=>{return r.getFullYear()-t.getFullYear()},(t)=>{return t.getFullYear()});gr.every=(t)=>{return!isFinite(t=Math.floor(t))||!(t>0)?null:Jt((r)=>{r.setFullYear(Math.floor(r.getFullYear()/t)*t),r.setMonth(0,1),r.setHours(0,0,0,0)},(r,f)=>{r.setFullYear(r.getFullYear()+f*t)})};var zP=gr.range,cr=Jt((t)=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r)},(t,r)=>{return r.getUTCFullYear()-t.getUTCFullYear()},(t)=>{return t.getUTCFullYear()});cr.every=(t)=>{return!isFinite(t=Math.floor(t))||!(t>0)?null:Jt((r)=>{r.setUTCFullYear(Math.floor(r.getUTCFullYear()/t)*t),r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,f)=>{r.setUTCFullYear(r.getUTCFullYear()+f*t)})};var RP=cr.range;function u_(t,r,f,u,h,x){let b=[[et,1,sr],[et,5,5*sr],[et,15,15*sr],[et,30,30*sr],[x,1,br],[x,5,5*br],[x,15,15*br],[x,30,30*br],[h,1,W0],[h,3,3*W0],[h,6,6*W0],[h,12,12*W0],[u,1,Qf],[u,2,2*Qf],[f,1,Xh],[r,1,Zx],[r,3,3*Zx],[t,1,d5]];function g(_,l,d){let w=l<_;if(w)[_,l]=[l,_];let M=d&&typeof d.range==="function"?d:c(_,l,d),H=M?M.range(_,+l+1):[];return w?H.reverse():H}function c(_,l,d){let w=Math.abs(l-_)/d,M=I0(([,,$])=>$).right(b,w);if(M===b.length)return t.every(Fu(_/d5,l/d5,d));if(M===0)return nh.every(Math.max(Fu(_,l,d),1));let[H,q]=b[w/b[M-1][2]53)return null;if(!("w"in B))B.w=1;if("Z"in B)ut=Lx(Yh(B.y,0,1)),dt=ut.getUTCDay(),ut=dt>4||dt===0?Cf.ceil(ut):Cf(ut),ut=bu.offset(ut,(B.V-1)*7),B.y=ut.getUTCFullYear(),B.m=ut.getUTCMonth(),B.d=ut.getUTCDate()+(B.w+6)%7;else ut=Fx(Yh(B.y,0,1)),dt=ut.getDay(),ut=dt>4||dt===0?Uf.ceil(ut):Uf(ut),ut=Ir.offset(ut,(B.V-1)*7),B.y=ut.getFullYear(),B.m=ut.getMonth(),B.d=ut.getDate()+(B.w+6)%7}else if("W"in B||"U"in B){if(!("w"in B))B.w="u"in B?B.u%7:("W"in B)?1:0;dt="Z"in B?Lx(Yh(B.y,0,1)).getUTCDay():Fx(Yh(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(dt+5)%7:B.w+B.U*7-(dt+6)%7}if("Z"in B)return B.H+=B.Z/100|0,B.M+=B.Z%100,Lx(B);return Fx(B)}}function i(D,v,k,B){var bt=0,ut=v.length,dt=k.length,Vt,pt;while(bt=dt)return-1;if(Vt=v.charCodeAt(bt++),Vt===37){if(Vt=v.charAt(bt++),pt=U[Vt in h_?v.charAt(bt++):Vt],!pt||(B=pt(D,k,B))<0)return-1}else if(Vt!=k.charCodeAt(B++))return-1}return B}function Z(D,v,k){var B=_.exec(v.slice(k));return B?(D.p=l.get(B[0].toLowerCase()),k+B[0].length):-1}function R(D,v,k){var B=M.exec(v.slice(k));return B?(D.w=H.get(B[0].toLowerCase()),k+B[0].length):-1}function z(D,v,k){var B=d.exec(v.slice(k));return B?(D.w=w.get(B[0].toLowerCase()),k+B[0].length):-1}function G(D,v,k){var B=E.exec(v.slice(k));return B?(D.m=P.get(B[0].toLowerCase()),k+B[0].length):-1}function N(D,v,k){var B=q.exec(v.slice(k));return B?(D.m=$.get(B[0].toLowerCase()),k+B[0].length):-1}function L(D,v,k){return i(D,r,v,k)}function K(D,v,k){return i(D,f,v,k)}function V(D,v,k){return i(D,u,v,k)}function y(D){return b[D.getDay()]}function I(D){return x[D.getDay()]}function A(D){return c[D.getMonth()]}function s(D){return g[D.getMonth()]}function Y(D){return h[+(D.getHours()>=12)]}function m(D){return 1+~~(D.getMonth()/3)}function X(D){return b[D.getUTCDay()]}function ht(D){return x[D.getUTCDay()]}function p(D){return c[D.getUTCMonth()]}function ct(D){return g[D.getUTCMonth()]}function a(D){return h[+(D.getUTCHours()>=12)]}function tt(D){return 1+~~(D.getUTCMonth()/3)}return{format:function(D){var v=C(D+="",J);return v.toString=function(){return D},v},parse:function(D){var v=W(D+="",!1);return v.toString=function(){return D},v},utcFormat:function(D){var v=C(D+="",Q);return v.toString=function(){return D},v},utcParse:function(D){var v=W(D+="",!0);return v.toString=function(){return D},v}}}var h_={"-":"",_:" ","0":"0"},at=/^\s*\d+/,DP=/^%/,AP=/[\\^$*+?|[\]().{}]/g;function _t(t,r,f){var u=t<0?"-":"",h=(u?-t:t)+"",x=h.length;return u+(x[r.toLowerCase(),f]))}function sP(t,r,f){var u=at.exec(r.slice(f,f+1));return u?(t.w=+u[0],f+u[0].length):-1}function IP(t,r,f){var u=at.exec(r.slice(f,f+1));return u?(t.u=+u[0],f+u[0].length):-1}function nP(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.U=+u[0],f+u[0].length):-1}function XP(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.V=+u[0],f+u[0].length):-1}function vP(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.W=+u[0],f+u[0].length):-1}function x_(t,r,f){var u=at.exec(r.slice(f,f+4));return u?(t.y=+u[0],f+u[0].length):-1}function b_(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.y=+u[0]+(+u[0]>68?1900:2000),f+u[0].length):-1}function YP(t,r,f){var u=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(r.slice(f,f+6));return u?(t.Z=u[1]?0:-(u[2]+(u[3]||"00")),f+u[0].length):-1}function SP(t,r,f){var u=at.exec(r.slice(f,f+1));return u?(t.q=u[0]*3-3,f+u[0].length):-1}function oP(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.m=u[0]-1,f+u[0].length):-1}function g_(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.d=+u[0],f+u[0].length):-1}function mP(t,r,f){var u=at.exec(r.slice(f,f+3));return u?(t.m=0,t.d=+u[0],f+u[0].length):-1}function c_(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.H=+u[0],f+u[0].length):-1}function jP(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.M=+u[0],f+u[0].length):-1}function eP(t,r,f){var u=at.exec(r.slice(f,f+2));return u?(t.S=+u[0],f+u[0].length):-1}function aP(t,r,f){var u=at.exec(r.slice(f,f+3));return u?(t.L=+u[0],f+u[0].length):-1}function yP(t,r,f){var u=at.exec(r.slice(f,f+6));return u?(t.L=Math.floor(u[0]/1000),f+u[0].length):-1}function kP(t,r,f){var u=DP.exec(r.slice(f,f+1));return u?f+u[0].length:-1}function pP(t,r,f){var u=at.exec(r.slice(f));return u?(t.Q=+u[0],f+u[0].length):-1}function tE(t,r,f){var u=at.exec(r.slice(f));return u?(t.s=+u[0],f+u[0].length):-1}function __(t,r){return _t(t.getDate(),r,2)}function rE(t,r){return _t(t.getHours(),r,2)}function fE(t,r){return _t(t.getHours()%12||12,r,2)}function uE(t,r){return _t(1+Ir.count(gr(t),t),r,3)}function H_(t,r){return _t(t.getMilliseconds(),r,3)}function hE(t,r){return H_(t,r)+"000"}function xE(t,r){return _t(t.getMonth()+1,r,2)}function bE(t,r){return _t(t.getMinutes(),r,2)}function gE(t,r){return _t(t.getSeconds(),r,2)}function cE(t){var r=t.getDay();return r===0?7:r}function _E(t,r){return _t(ir.count(gr(t)-1,t),r,2)}function q_(t){var r=t.getDay();return r>=4||r===0?i0(t):i0.ceil(t)}function lE(t,r){return t=q_(t),_t(i0.count(gr(t),t)+(gr(t).getDay()===4),r,2)}function dE(t){return t.getDay()}function wE(t,r){return _t(Uf.count(gr(t)-1,t),r,2)}function ME(t,r){return _t(t.getFullYear()%100,r,2)}function HE(t,r){return t=q_(t),_t(t.getFullYear()%100,r,2)}function qE(t,r){return _t(t.getFullYear()%1e4,r,4)}function $E(t,r){var f=t.getDay();return t=f>=4||f===0?i0(t):i0.ceil(t),_t(t.getFullYear()%1e4,r,4)}function PE(t){var r=t.getTimezoneOffset();return(r>0?"-":(r*=-1,"+"))+_t(r/60|0,"0",2)+_t(r%60,"0",2)}function l_(t,r){return _t(t.getUTCDate(),r,2)}function EE(t,r){return _t(t.getUTCHours(),r,2)}function JE(t,r){return _t(t.getUTCHours()%12||12,r,2)}function QE(t,r){return _t(1+bu.count(cr(t),t),r,3)}function $_(t,r){return _t(t.getUTCMilliseconds(),r,3)}function UE(t,r){return $_(t,r)+"000"}function CE(t,r){return _t(t.getUTCMonth()+1,r,2)}function KE(t,r){return _t(t.getUTCMinutes(),r,2)}function WE(t,r){return _t(t.getUTCSeconds(),r,2)}function iE(t){var r=t.getUTCDay();return r===0?7:r}function ZE(t,r){return _t(Zr.count(cr(t)-1,t),r,2)}function P_(t){var r=t.getUTCDay();return r>=4||r===0?Z0(t):Z0.ceil(t)}function VE(t,r){return t=P_(t),_t(Z0.count(cr(t),t)+(cr(t).getUTCDay()===4),r,2)}function NE(t){return t.getUTCDay()}function TE(t,r){return _t(Cf.count(cr(t)-1,t),r,2)}function FE(t,r){return _t(t.getUTCFullYear()%100,r,2)}function LE(t,r){return t=P_(t),_t(t.getUTCFullYear()%100,r,2)}function GE(t,r){return _t(t.getUTCFullYear()%1e4,r,4)}function BE(t,r){var f=t.getUTCDay();return t=f>=4||f===0?Z0(t):Z0.ceil(t),_t(t.getUTCFullYear()%1e4,r,4)}function zE(){return"+0000"}function d_(){return"%"}function w_(t){return+t}function M_(t){return Math.floor(+t/1000)}var f1,u1,E_,V0,J_;Bx({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Bx(t){return f1=Gx(t),u1=f1.format,E_=f1.parse,V0=f1.utcFormat,J_=f1.utcParse,f1}function RE(t){return new Date(t)}function DE(t){return t instanceof Date?+t:+new Date(+t)}function Q5(t,r,f,u,h,x,b,g,c,_){var l=Bh(),d=l.invert,w=l.domain,M=_(".%L"),H=_(":%S"),q=_("%I:%M"),$=_("%I %p"),E=_("%a %d"),P=_("%b %d"),J=_("%B"),Q=_("%Y");function U(C){return(c(C)m9(t[t.length-1]);var V5=[,,,].concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(O),N5=e(V5);var T5=[,,,].concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(O),F5=e(T5);var L5=[,,,].concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(O),G5=e(L5);var B5=[,,,].concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(O),z5=e(B5);var eh=[,,,].concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(O),h1=e(eh);var R5=[,,,].concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(O),D5=e(R5);var ah=[,,,].concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(O),x1=e(ah);var A5=[,,,].concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(O),O5=e(A5);var s5=[,,,].concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(O),I5=e(s5);var n5=[,,,].concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(O),X5=e(n5);var v5=[,,,].concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(O),Y5=e(v5);var S5=[,,,].concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(O),o5=e(S5);var m5=[,,,].concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(O),j5=e(m5);var e5=[,,,].concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(O),a5=e(e5);var y5=[,,,].concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(O),k5=e(y5);var p5=[,,,].concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(O),t7=e(p5);var r7=[,,,].concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(O),f7=e(r7);var u7=[,,,].concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(O),h7=e(u7);var x7=[,,,].concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(O),b7=e(x7);var g7=[,,,].concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(O),c7=e(g7);var _7=[,,,].concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(O),l7=e(_7);var d7=[,,,].concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(O),w7=e(d7);var M7=[,,,].concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(O),H7=e(M7);var q7=[,,,].concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(O),$7=e(q7);var P7=[,,,].concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(O),E7=e(P7);var J7=[,,,].concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(O),Q7=e(J7);var U7=[,,,].concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(O),C7=e(U7);function yh(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}var K7=Iu(wr(300,0.5,0),wr(-240,0.5,1));var i7=Iu(wr(-100,0.75,0.35),wr(80,1.5,0.8)),Z7=Iu(wr(260,0.75,0.35),wr(80,1.5,0.8)),W7=wr();function kh(t){if(t<0||t>1)t-=Math.floor(t);var r=Math.abs(t-0.5);return W7.h=360*t-100,W7.s=1.5-1.5*r,W7.l=0.8-0.9*r,W7+""}var V7=Br(),AE=Math.PI/3,OE=Math.PI*2/3;function ph(t){var r;return t=(0.5-t)*Math.PI,V7.r=255*(r=Math.sin(t))*r,V7.g=255*(r=Math.sin(t+AE))*r,V7.b=255*(r=Math.sin(t+OE))*r,V7+""}function t8(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function N7(t){var r=t.length;return function(f){return t[Math.max(0,Math.min(r-1,Math.floor(f*r)))]}}var T7=N7(O("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),F7=N7(O("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),L7=N7(O("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),G7=N7(O("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Rt(t){return function(){return t}}var Sx=Math.cos;var{min:b1,sin:r8,sqrt:lt}=Math,ox=0.000000000001,lu=Math.PI,iI=lu/2,g1=2*lu;function B7(t){let r=3;return t.digits=function(f){if(!arguments.length)return r;if(f==null)r=null;else{let u=Math.floor(f);if(!(u>=0))throw RangeError(`invalid digits: ${f}`);r=u}return t},()=>new af(r)}var TI=Array.prototype.slice;function f8(t){return typeof t==="object"&&"length"in t?t:Array.from(t)}function Q_(t){this._context=t}Q_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._context.lineTo(t,r);break}}};function N0(t){return new Q_(t)}function z7(t){return t[0]}function R7(t){return t[1]}function c1(t,r){var f=Rt(!0),u=null,h=N0,x=null,b=B7(g);t=typeof t==="function"?t:t===void 0?z7:Rt(t),r=typeof r==="function"?r:r===void 0?R7:Rt(r);function g(c){var _,l=(c=f8(c)).length,d,w=!1,M;if(u==null)x=h(M=b());for(_=0;_<=l;++_){if(!(_=M;--H)g.point(J[H],Q[H]);g.lineEnd(),g.areaEnd()}if(E)J[w]=+t($,w,d),Q[w]=+r($,w,d),g.point(u?+u($,w,d):J[w],f?+f($,w,d):Q[w])}if(P)return g=null,P+""||null}function l(){return c1().defined(h).curve(b).context(x)}return _.x=function(d){return arguments.length?(t=typeof d==="function"?d:Rt(+d),u=null,_):t},_.x0=function(d){return arguments.length?(t=typeof d==="function"?d:Rt(+d),_):t},_.x1=function(d){return arguments.length?(u=d==null?null:typeof d==="function"?d:Rt(+d),_):u},_.y=function(d){return arguments.length?(r=typeof d==="function"?d:Rt(+d),f=null,_):r},_.y0=function(d){return arguments.length?(r=typeof d==="function"?d:Rt(+d),_):r},_.y1=function(d){return arguments.length?(f=d==null?null:typeof d==="function"?d:Rt(+d),_):f},_.lineX0=_.lineY0=function(){return l().x(t).y(r)},_.lineY1=function(){return l().x(t).y(f)},_.lineX1=function(){return l().x(u).y(r)},_.defined=function(d){return arguments.length?(h=typeof d==="function"?d:Rt(!!d),_):h},_.curve=function(d){return arguments.length?(b=d,x!=null&&(g=b(x)),_):b},_.context=function(d){return arguments.length?(d==null?x=g=null:g=b(x=d),_):x},_}class mx{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{if(this._point=1,this._line)this._context.lineTo(t,r);else this._context.moveTo(t,r);break}case 1:this._point=2;default:{if(this._x)this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r);else this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function jx(t){return new mx(t,!0)}function ex(t){return new mx(t,!1)}var sE=lt(3),u8={draw(t,r){let f=lt(r+b1(r/28,0.75))*0.59436,u=f/2,h=u*sE;t.moveTo(0,f),t.lineTo(0,-f),t.moveTo(-h,-u),t.lineTo(h,u),t.moveTo(-h,u),t.lineTo(h,-u)}};var rf={draw(t,r){let f=lt(r/lu);t.moveTo(f,0),t.arc(0,0,f,0,g1)}};var h8={draw(t,r){let f=lt(r/5)/2;t.moveTo(-3*f,-f),t.lineTo(-f,-f),t.lineTo(-f,-3*f),t.lineTo(f,-3*f),t.lineTo(f,-f),t.lineTo(3*f,-f),t.lineTo(3*f,f),t.lineTo(f,f),t.lineTo(f,3*f),t.lineTo(-f,3*f),t.lineTo(-f,f),t.lineTo(-3*f,f),t.closePath()}};var U_=lt(0.3333333333333333),IE=U_*2,x8={draw(t,r){let f=lt(r/IE),u=f*U_;t.moveTo(0,-f),t.lineTo(u,0),t.lineTo(0,f),t.lineTo(-u,0),t.closePath()}};var b8={draw(t,r){let f=lt(r)*0.62625;t.moveTo(0,-f),t.lineTo(f,0),t.lineTo(0,f),t.lineTo(-f,0),t.closePath()}};var g8={draw(t,r){let f=lt(r-b1(r/7,2))*0.87559;t.moveTo(-f,0),t.lineTo(f,0),t.moveTo(0,f),t.lineTo(0,-f)}};var c8={draw(t,r){let f=lt(r),u=-f/2;t.rect(u,u,f,f)}};var _8={draw(t,r){let f=lt(r)*0.4431;t.moveTo(f,f),t.lineTo(f,-f),t.lineTo(-f,-f),t.lineTo(-f,f),t.closePath()}};var nE=0.8908130915292852,C_=r8(lu/10)/r8(7*lu/10),XE=r8(g1/10)*C_,vE=-Sx(g1/10)*C_,l8={draw(t,r){let f=lt(r*nE),u=XE*f,h=vE*f;t.moveTo(0,-f),t.lineTo(u,h);for(let x=1;x<5;++x){let b=g1*x/5,g=Sx(b),c=r8(b);t.lineTo(c*f,-g*f),t.lineTo(g*u-c*h,c*u+g*h)}t.closePath()}};var ax=lt(3),d8={draw(t,r){let f=-lt(r/(ax*3));t.moveTo(0,f*2),t.lineTo(-ax*f,-f),t.lineTo(ax*f,-f),t.closePath()}};var YE=lt(3),w8={draw(t,r){let f=lt(r)*0.6824,u=f/2,h=f*YE/2;t.moveTo(0,-f),t.lineTo(h,u),t.lineTo(-h,u),t.closePath()}};var nr=-0.5,Xr=lt(3)/2,yx=1/lt(12),SE=(yx/2+1)*3,M8={draw(t,r){let f=lt(r/SE),u=f/2,h=f*yx,x=u,b=f*yx+f,g=-x,c=b;t.moveTo(u,h),t.lineTo(x,b),t.lineTo(g,c),t.lineTo(nr*u-Xr*h,Xr*u+nr*h),t.lineTo(nr*x-Xr*b,Xr*x+nr*b),t.lineTo(nr*g-Xr*c,Xr*g+nr*c),t.lineTo(nr*u+Xr*h,nr*h-Xr*u),t.lineTo(nr*x+Xr*b,nr*b-Xr*x),t.lineTo(nr*g+Xr*c,nr*c-Xr*g),t.closePath()}};var _1={draw(t,r){let f=lt(r-b1(r/6,1.7))*0.6189;t.moveTo(-f,-f),t.lineTo(f,f),t.moveTo(-f,f),t.lineTo(f,-f)}};var A7=[rf,h8,x8,c8,l8,d8,M8],kx=[rf,g8,_1,w8,u8,_8,b8];function Vr(){}function l1(t,r,f){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+r)/6,(t._y0+4*t._y1+f)/6)}function H8(t){this._context=t}H8.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:l1(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:l1(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function O7(t){return new H8(t)}function K_(t){this._context=t}K_.prototype={areaStart:Vr,areaEnd:Vr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._x2=t,this._y2=r;break;case 1:this._point=2,this._x3=t,this._y3=r;break;case 2:this._point=3,this._x4=t,this._y4=r,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+r)/6);break;default:l1(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function s7(t){return new K_(t)}function W_(t){this._context=t}W_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var f=(this._x0+4*this._x1+t)/6,u=(this._y0+4*this._y1+r)/6;this._line?this._context.lineTo(f,u):this._context.moveTo(f,u);break;case 3:this._point=4;default:l1(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function I7(t){return new W_(t)}function i_(t,r){this._basis=new H8(t),this._beta=r}i_.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,r=this._y,f=t.length-1;if(f>0){var u=t[0],h=r[0],x=t[f]-u,b=r[f]-h,g=-1,c;while(++g<=f)c=g/f,this._basis.point(this._beta*t[g]+(1-this._beta)*(u+c*x),this._beta*r[g]+(1-this._beta)*(h+c*b))}this._x=this._y=null,this._basis.lineEnd()},point:function(t,r){this._x.push(+t),this._y.push(+r)}};var px=function t(r){function f(u){return r===1?new H8(u):new i_(u,r)}return f.beta=function(u){return t(+u)},f}(0.85);function d1(t,r,f){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-r),t._y2+t._k*(t._y1-f),t._x2,t._y2)}function n7(t,r){this._context=t,this._k=(1-r)/6}n7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:d1(this,this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2,this._x1=t,this._y1=r;break;case 2:this._point=3;default:d1(this,t,r);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var tb=function t(r){function f(u){return new n7(u,r)}return f.tension=function(u){return t(+u)},f}(0);function X7(t,r){this._context=t,this._k=(1-r)/6}X7.prototype={areaStart:Vr,areaEnd:Vr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:d1(this,t,r);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var rb=function t(r){function f(u){return new X7(u,r)}return f.tension=function(u){return t(+u)},f}(0);function v7(t,r){this._context=t,this._k=(1-r)/6}v7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:d1(this,t,r);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var fb=function t(r){function f(u){return new v7(u,r)}return f.tension=function(u){return t(+u)},f}(0);function q8(t,r,f){var{_x1:u,_y1:h,_x2:x,_y2:b}=t;if(t._l01_a>ox){var g=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);u=(u*g-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,h=(h*g-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>ox){var _=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);x=(x*_+t._x1*t._l23_2a-r*t._l12_2a)/l,b=(b*_+t._y1*t._l23_2a-f*t._l12_2a)/l}t._context.bezierCurveTo(u,h,x,b,t._x2,t._y2)}function Z_(t,r){this._context=t,this._alpha=r}Z_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){if(t=+t,r=+r,this._point){var f=this._x2-t,u=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(f*f+u*u,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3;default:q8(this,t,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ub=function t(r){function f(u){return r?new Z_(u,r):new n7(u,0)}return f.alpha=function(u){return t(+u)},f}(0.5);function V_(t,r){this._context=t,this._alpha=r}V_.prototype={areaStart:Vr,areaEnd:Vr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,r){if(t=+t,r=+r,this._point){var f=this._x2-t,u=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(f*f+u*u,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:q8(this,t,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var hb=function t(r){function f(u){return r?new V_(u,r):new X7(u,0)}return f.alpha=function(u){return t(+u)},f}(0.5);function N_(t,r){this._context=t,this._alpha=r}N_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(t,r){if(t=+t,r=+r,this._point){var f=this._x2-t,u=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(f*f+u*u,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:q8(this,t,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var xb=function t(r){function f(u){return r?new N_(u,r):new v7(u,0)}return f.alpha=function(u){return t(+u)},f}(0.5);function T_(t){this._context=t}T_.prototype={areaStart:Vr,areaEnd:Vr,lineStart:function(){this._point=0},lineEnd:function(){if(this._point)this._context.closePath()},point:function(t,r){if(t=+t,r=+r,this._point)this._context.lineTo(t,r);else this._point=1,this._context.moveTo(t,r)}};function Y7(t){return new T_(t)}function F_(t){return t<0?-1:1}function L_(t,r,f){var u=t._x1-t._x0,h=r-t._x1,x=(t._y1-t._y0)/(u||h<0&&-0),b=(f-t._y1)/(h||u<0&&-0),g=(x*h+b*u)/(u+h);return(F_(x)+F_(b))*Math.min(Math.abs(x),Math.abs(b),0.5*Math.abs(g))||0}function G_(t,r){var f=t._x1-t._x0;return f?(3*(t._y1-t._y0)/f-r)/2:r}function bb(t,r,f){var{_x0:u,_y0:h,_x1:x,_y1:b}=t,g=(x-u)/3;t._context.bezierCurveTo(u+g,h+g*r,x-g,b-g*f,x,b)}function S7(t){this._context=t}S7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:bb(this,this._t0,G_(this,this._t0));break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(t,r){var f=NaN;if(t=+t,r=+r,t===this._x1&&r===this._y1)return;switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,bb(this,G_(this,f=L_(this,t,r)),f);break;default:bb(this,this._t0,f=L_(this,t,r));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r,this._t0=f}};function B_(t){this._context=new z_(t)}(B_.prototype=Object.create(S7.prototype)).point=function(t,r){S7.prototype.point.call(this,r,t)};function z_(t){this._context=t}z_.prototype={moveTo:function(t,r){this._context.moveTo(r,t)},closePath:function(){this._context.closePath()},lineTo:function(t,r){this._context.lineTo(r,t)},bezierCurveTo:function(t,r,f,u,h,x){this._context.bezierCurveTo(r,t,u,f,x,h)}};function gb(t){return new S7(t)}function cb(t){return new B_(t)}function D_(t){this._context=t}D_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,r=this._y,f=t.length;if(f)if(this._line?this._context.lineTo(t[0],r[0]):this._context.moveTo(t[0],r[0]),f===2)this._context.lineTo(t[1],r[1]);else{var u=R_(t),h=R_(r);for(var x=0,b=1;b=0;--r)h[r]=(b[r]-h[r+1])/x[r];x[f-1]=(t[f]+h[f-1])/2;for(r=0;r=0)this._t=1-this._t,this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,r),this._context.lineTo(t,r);else{var f=this._x*(1-this._t)+t*this._t;this._context.lineTo(f,this._y),this._context.lineTo(f,r)}break}}this._x=t,this._y=r}};function j7(t){return new m7(t,0.5)}function _b(t){return new m7(t,0)}function lb(t){return new m7(t,1)}function Kf(t,r,f){this.k=t,this.x=r,this.y=f}Kf.prototype={constructor:Kf,scale:function(t){return t===1?this:new Kf(this.k*t,this.x,this.y)},translate:function(t,r){return t===0&r===0?this:new Kf(this.k,this.x+this.k*t,this.y+this.k*r)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var db=new Kf(1,0,0);wb.prototype=Kf.prototype;function wb(t){while(!t.__zoom)if(!(t=t.parentNode))return db;return t.__zoom}function vr(t){return t!=null&&!Number.isNaN(t)}function _r(t,r){return+vr(r)-+vr(t)||Nt(t,r)}function du(t,r){return+vr(r)-+vr(t)||Fr(t,r)}function $8(t){return t!=null&&`${t}`!==""}function Mb(t){return isFinite(t)?t:NaN}function wu(t){return t>0&&isFinite(t)?t:NaN}function w1(t){return t<0&&isFinite(t)?t:NaN}function e7(t,r){if(!(t instanceof Date))t=new Date(+t);if(isNaN(t))return typeof r==="function"?r(t):r;let f=t.getUTCHours(),u=t.getUTCMinutes(),h=t.getUTCSeconds(),x=t.getUTCMilliseconds();return`${oE(t.getUTCFullYear(),4)}-${ff(t.getUTCMonth()+1,2)}-${ff(t.getUTCDate(),2)}${f||u||h||x?`T${ff(f,2)}:${ff(u,2)}${h||x?`:${ff(h,2)}${x?`.${ff(x,3)}`:""}`:""}Z`:""}`}function oE(t){return t<0?`-${ff(-t,6)}`:t>9999?`+${ff(t,6)}`:ff(t,4)}function ff(t,r){return`${t}`.padStart(r,"0")}var mE=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function P8(t,r){if(!mE.test(t+=""))return typeof r==="function"?r(t):r;return new Date(t)}function uf(t){if(t==null)return;let r=t[0],f=t[t.length-1];return Fr(r,f)}var H1=1000,Zf=H1*60,Vf=Zf*60,F0=Vf*24,T0=F0*7,Mu=F0*30,Wf=F0*365,Hb=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",H1],["5 seconds",5*H1],["15 seconds",15*H1],["30 seconds",30*H1],["minute",Zf],["5 minutes",5*Zf],["15 minutes",15*Zf],["30 minutes",30*Zf],["hour",Vf],["3 hours",3*Vf],["6 hours",6*Vf],["12 hours",12*Vf],["day",F0],["2 days",2*F0],["week",T0],["2 weeks",2*T0],["month",Mu],["3 months",3*Mu],["6 months",6*Mu],["year",Wf],["2 years",2*Wf],["5 years",5*Wf],["10 years",10*Wf],["20 years",20*Wf],["50 years",50*Wf],["100 years",100*Wf]],qb=new Map([["second",H1],["minute",Zf],["hour",Vf],["day",F0],["monday",T0],["tuesday",T0],["wednesday",T0],["thursday",T0],["friday",T0],["saturday",T0],["sunday",T0],["week",T0],["month",Mu],["year",Wf]]),O_=new Map([["second",et],["minute",e0],["hour",y0],["day",Ir],["monday",Uf],["tuesday",w5],["wednesday",M5],["thursday",i0],["friday",H5],["saturday",q5],["sunday",ir],["week",ir],["month",p0],["year",gr]]),$b=new Map([["second",et],["minute",a0],["hour",k0],["day",gu],["monday",Cf],["tuesday",$5],["wednesday",P5],["thursday",Z0],["friday",E5],["saturday",J5],["sunday",Zr],["week",Zr],["month",tf],["year",cr]]),q1=Symbol("intervalDuration"),y7=Symbol("intervalType");for(let[t,r]of O_)r[q1]=qb.get(t),r[y7]="time";for(let[t,r]of $b)r[q1]=qb.get(t),r[y7]="utc";var E8=[["year",cr,"utc"],["month",tf,"utc"],["day",gu,"utc",6*Mu],["hour",k0,"utc",3*F0],["minute",a0,"utc",6*Vf],["second",et,"utc",30*Zf]],a7=[["year",gr,"time"],["month",p0,"time"],["day",Ir,"time",6*Mu],["hour",y0,"time",3*F0],["minute",e0,"time",6*Vf],["second",et,"time",30*Zf]],jE=[E8[0],a7[0],E8[1],a7[1],E8[2],a7[2],...E8.slice(3)];function s_(t){let r=`${t}`.toLowerCase();if(r.endsWith("s"))r=r.slice(0,-1);let f=1,u=/^(?:(\d+)\s+)/.exec(r);if(u)r=r.slice(u[0].length),f=+u[1];switch(r){case"quarter":r="month",f*=3;break;case"half":r="month",f*=6;break}let h=$b.get(r);if(!h)throw Error(`unknown interval: ${t}`);if(f>1&&!h.every)throw Error(`non-periodic interval: ${r}`);return[r,f]}function Pb(t){return I_(s_(t),"time")}function J8(t){return I_(s_(t),"utc")}function I_([t,r],f){let u=(f==="time"?O_:$b).get(t);if(r>1)u=u.every(r),u[q1]=qb.get(t)*r,u[y7]=f;return u}function Eb(t,r){if(!(r>1))return;let f=t[q1];if(!Hb.some(([,h])=>h===f))return;if(f%F0===0&&F0Math.log(h)).center(Hb,Math.log(f*r))];return(t[y7]==="time"?Pb:J8)(u)}function A_(t,r,f){let u=r==="time"?u1:V0;if(f==null)return u(t==="year"?"%Y":t==="month"?"%Y-%m":t==="day"?"%Y-%m-%d":t==="hour"||t==="minute"?"%Y-%m-%dT%H:%M":t==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let h=eE(f);switch(t){case"millisecond":return M1(u(".%L"),u(":%M:%S"),h);case"second":return M1(u(":%S"),u("%-I:%M"),h);case"minute":return M1(u("%-I:%M"),u("%p"),h);case"hour":return M1(u("%-I %p"),u("%b %-d"),h);case"day":return M1(u("%-d"),u("%b"),h);case"month":return M1(u("%b"),u("%Y"),h);case"year":return u("%Y")}throw Error("unable to format time ticks")}function eE(t){return t==="left"||t==="right"?(r,f)=>` ${r} ${f}`:t==="top"?(r,f)=>`${f} ${r}`:(r,f)=>`${r} -${f}`}function $s(t){return t==="time"?D7:t==="utc"?d8:Ps}function Jd(t,r,f){let u=Ot(O8(r,(h,g)=>Math.abs(g-h)));if(u<1000)return sd("millisecond","utc",f);for(let[h,g,x,b]of $s(t)){if(u>b)break;if(h==="hour"&&!u)break;if(r.every((c)=>g.floor(c)>=c))return sd(h,x,f)}}function h1(t,r,f){return(u,h,g)=>{let x=t(u,h),b=r(u,h),c=h-tf(g);return h!==c&&g[c]!==void 0&&b===r(g[c],c)?x:f(x,b)}}var bx=Object.getPrototypeOf(Uint8Array),Js=Object.prototype.toString;function mr(t){return t instanceof Array||t instanceof bx}function Ud(t){return t instanceof bx&&!Qs(t)}function ed(t){return t?.prototype instanceof bx&&!Ns(t)}function Qs(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function Ns(t){return t===BigInt64Array||t===BigUint64Array}var cx=Symbol("reindex");function nt(t,r,f){let u=typeof r;return u==="string"?Od(t)?dx(t.getChild(r),f):Qd(t,lx(r),f):u==="function"?Qd(t,r,f):u==="number"||r instanceof Date||u==="boolean"?_t(t,Qr(r),f):typeof r?.transform==="function"?xx(r.transform(t),f):Us(xx(r,f),t?.[cx])}function Us(t,r){return t!=null&&r?v7(t,r):t}function Qd(t,r,f){return _t(t,ed(f)?(u,h)=>_x(r(u,h)):r,f)}function xx(t,r){return r===void 0?V0(t):Id(t)?dx(t,r):t instanceof r?t:r.from(t,ed(r)&&!Ud(t)?_x:void 0)}function dx(t,r){return t==null?t:(r===void 0||r===Array)&&Vs(t.type)?wx(Nd(t)):xx(Nd(t),r)}function Nd(t){return t.nullCount?t.toJSON():t.toArray()}var b1=[null],lx=(t)=>(r)=>{let f=r[t];return f===void 0&&r.type==="Feature"?r.properties?.[t]:f},C0={transform:_r},wt={transform:(t)=>t};var Cd=()=>1,Kd=()=>!0,Zt=(t)=>t==null?t:`${t}`,Tt=(t)=>t==null?t:+t;var I7=(t)=>t?t[0]:void 0,_8=(t)=>t?t[1]:void 0;var Qr=(t)=>()=>t;function Vd(t){let r=+`${t}`.slice(1)/100;return(f,u)=>Cr(f,r,u)}function K0(t){return Ud(t)?t:_t(t,_x,Float64Array)}function _x(t){return t==null?NaN:Number(t)}function wx(t){return _t(t,Mx)}function Mx(t){return t instanceof Date&&!isNaN(t)?t:typeof t==="string"?c8(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function Hr(t,r){if(t===void 0)t=r;return t===null?[void 0,"none"]:M1(t)?[void 0,t]:[t,void 0]}function Ct(t,r){if(t===void 0)t=r;return t===null||typeof t==="number"?[void 0,t]:[t,void 0]}function ix(t,r,f){if(t!=null)return lr(t,r,f)}function lr(t,r,f){let u=`${t}`.toLowerCase();if(!f.includes(u))throw Error(`invalid ${r}: ${t}`);return u}function rf(t){return Od(t)?t:V0(t)}function V0(t){if(t==null||mr(t))return t;if(Id(t))return dx(t);if(Wd(t))switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;default:return[t]}return Array.from(t)}function Wd(t){switch(t?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function _t(t,r,f=Array){return t==null?t:t instanceof f?t.map(r):f.from(t,r)}function Uf(t,r=Array){return t instanceof r?t.slice():r.from(t)}function Hx({x:t,x1:r,x2:f}){return t!==void 0||r!==void 0||f!==void 0}function qx({y:t,y1:r,y2:f}){return t!==void 0||r!==void 0||f!==void 0}function Ex(t){return Hx(t)||qx(t)||t.interval!==void 0}function jr(t){return t?.toString===Js}function c1(t){return jr(t)&&(t.type!==void 0||t.domain!==void 0)}function d1(t){return jr(t)&&typeof t.transform!=="function"}function ef(t){return d1(t)&&t.value===void 0&&t.channel===void 0}function sx(t,r,f,u=wt){if(r===void 0&&f===void 0)r=0,f=t===void 0?u:t;else if(r===void 0)r=t===void 0?0:t;else if(f===void 0)f=t===void 0?0:t;return[r,f]}function yr(t,r){return t===void 0&&r===void 0?[I7,_8]:[t,r]}function l1({z:t,fill:r,stroke:f}={}){if(t===void 0)[t]=Hr(r);if(t===void 0)[t]=Hr(f);return t}function Cf(t){return mr(t)?t.length:t?.numRows}function _r(t){let r=Cf(t),f=new Uint32Array(r);for(let u=0;ut[f],t.constructor):_t(r,(f)=>t.at(f))}function od(t,r,f){return t.subarray?t.subarray(r,f):t.slice(r,f)}function zr(t){return t!==null&&typeof t==="object"?t.valueOf():t}function Zd(t,r){if(r[t]!==void 0)return r[t];switch(t){case"x1":case"x2":t="x";break;case"y1":case"y2":t="y";break}return r[t]}function _1(t){let r;return[{transform:()=>r,label:kr(t)},(f)=>r=f]}function Ar(t){return t==null?[t]:_1(t)}function kr(t,r){return typeof t==="string"?t:t&&t.label!==void 0?t.label:r}function w1(t,r){return{transform(f){let u=t.transform(f),h=r.transform(f);return ot(u)||ot(h)?_t(u,(g,x)=>new Date((+u[x]+ +h[x])/2)):_t(u,(g,x)=>(+u[x]+ +h[x])/2,Float64Array)},label:t.label}}function w8(t,r){let f=Px(r?.interval,r?.type);return f?_t(t,f):t}function Px(t,r){let f=X7(t,r);return f&&((u)=>Rr(u)?f.floor(u):u)}function X7(t,r){if(t==null)return;if(typeof t==="number")return es(t);if(typeof t==="string")return(r==="time"?hx:l8)(t);if(typeof t.floor!=="function")throw Error("invalid interval; missing floor method");if(typeof t.offset!=="function")throw Error("invalid interval; missing offset method");return t}function es(t){if(t=+t,0Math.floor(f*r)/r,offset:(f,u=1)=>(f*r+Math.floor(u))/r,range:(f,u)=>Rf(Math.ceil(f*r),u*r).map((h)=>h/r)}:{floor:(f)=>Math.floor(f/r)*r,offset:(f,u=1)=>f+r*Math.floor(u),range:(f,u)=>Rf(Math.ceil(f/r),u/r).map((h)=>h*r)}}function W0(t,r){if(t=X7(t,r),t&&typeof t.range!=="function")throw Error("invalid interval: missing range method");return t}function Td(t,r){if(t=W0(t,r),t&&typeof t.ceil!=="function")throw Error("invalid interval: missing ceil method");return t}function Fd(t){return Kf(t)&&typeof t?.floor==="function"&&t.floor()instanceof Date}function Kf(t){return typeof t?.range==="function"}function o0(t){return t===void 0||d1(t)?t:{value:t}}function Bd(t){return t==null?null:{transform:(r)=>nt(r,t,Float64Array),label:kr(t)}}function qr(t){return t&&typeof t[Symbol.iterator]==="function"}function Y7(t){for(let r of t){if(r==null)continue;return typeof r!=="object"||r instanceof Date}}function nx(t){for(let r of t){if(r==null)continue;let f=typeof r;return f==="string"||f==="boolean"}}function ot(t){for(let r of t){if(r==null)continue;return r instanceof Date}}function Ld(t){for(let r of t){if(r==null)continue;return typeof r==="string"&&isNaN(r)&&c8(r)}}function Gd(t){for(let r of t){if(r==null)continue;if(typeof r!=="string")return!1;if(!r.trim())continue;return!isNaN(r)}}function Rd(t){for(let r of t){if(r==null)continue;return typeof r==="number"}}function S7(t,r){let f;for(let u of t){if(u==null)continue;if(!r(u))return!1;f=!0}return f}var Cs=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function M1(t){if(typeof t!=="string")return!1;return t=t.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(t)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(t)||Cs.has(t)}function zd(t){return typeof t==="number"&&(0<=t&&t<=1||isNaN(t))}function St(t){return t==null||cu(t)}function cu(t){return/^\s*none\s*$/i.test(t)}function Ad(t){return/^\s*round\s*$/i.test(t)}function a7(t,r){return ix(t,r,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Vf(t="middle"){return a7(t,"frameAnchor")}function Dd(t={},...r){let f=t;for(let u of r)for(let h in u)if(f[h]===void 0){let g=u[h];if(f===t)f={...f,[h]:g};else f[h]=g}return f}function Ks(t){console.warn("named iterables are deprecated; please use an object instead");let r=new Set;return Object.fromEntries(Array.from(t,(f)=>{let{name:u}=f;if(u==null)throw Error("missing name");let h=`${u}`;if(h==="__proto__")throw Error(`illegal name: ${h}`);if(r.has(h))throw Error(`duplicate name: ${h}`);return r.add(h),[u,f]}))}function $x(t){return qr(t)?Ks(t):t}function m7(t){if(t===!0)t="frame";else if(t===!1)t=null;else if(!Wd(t)&&t!=null){if(t=lr(t,"clip",["frame","sphere"]),t==="sphere")t={type:"Sphere"}}return t}function Od(t){return t&&typeof t.getChild==="function"&&typeof t.toArray==="function"&&t.schema&&Array.isArray(t.schema.fields)}function Id(t){return t&&typeof t.toArray==="function"&&t.type}function Vs(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}var Dr=Symbol("position"),Nr=Symbol("color"),du=Symbol("radius"),lu=Symbol("length"),_u=Symbol("opacity"),i1=Symbol("symbol"),vd=Symbol("projection"),Mt=new Map([["x",Dr],["y",Dr],["fx",Dr],["fy",Dr],["r",du],["color",Nr],["opacity",_u],["symbol",i1],["length",lu],["projection",vd]]);function Xd(t){return t===Dr||t===vd}function Yd(t){return t===Dr||t===du||t===lu||t===_u}var Ws=Math.sqrt(3),os=2/Ws,Zs={draw(t,r){let f=Math.sqrt(r/Math.PI),u=f*os,h=u/2;t.moveTo(0,u),t.lineTo(f,h),t.lineTo(f,-h),t.lineTo(0,-u),t.lineTo(-f,-h),t.lineTo(-f,h),t.closePath()}},Jx=new Map([["asterisk",ah],["circle",k0],["cross",mh],["diamond",jh],["diamond2",yh],["hexagon",Zs],["plus",kh],["square",ph],["square2",t8],["star",r8],["times",t1],["triangle",f8],["triangle2",u8],["wye",h8]]);function Qx(t){return t&&typeof t.draw==="function"}function Sd(t){if(Qx(t))return!0;if(typeof t!=="string")return!1;return Jx.has(t.toLowerCase())}function H1(t){if(t==null||Qx(t))return t;let r=Jx.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid symbol: ${t}`)}function ad(t){if(t==null||Qx(t))return[void 0,t];if(typeof t==="string"){let r=Jx.get(`${t}`.toLowerCase());if(r)return[void 0,r]}return[t,void 0]}function wu({filter:t,sort:r,reverse:f,transform:u,initializer:h,...g}={},x){if(u===void 0){if(t!=null)u=md(t);if(r!=null&&!ef(r))u=Nx(u,ex(r));if(f)u=Nx(u,jd)}if(x!=null&&h!=null)throw Error("transforms cannot be applied after initializers");return{...g,...(r===null||ef(r))&&{sort:r},transform:Nx(u,x)}}function ff({filter:t,sort:r,reverse:f,initializer:u,...h}={},g){if(u===void 0){if(t!=null)u=md(t);if(r!=null&&!ef(r))u=Ux(u,ex(r));if(f)u=Ux(u,jd)}return{...h,...(r===null||ef(r))&&{sort:r},initializer:Ux(u,g)}}function Nx(t,r){if(t==null)return r===null?void 0:r;if(r==null)return t===null?void 0:t;return function(f,u,h){return{data:f,facets:u}=t.call(this,f,u,h),r.call(this,rf(f),u,h)}}function Ux(t,r){if(t==null)return r===null?void 0:r;if(r==null)return t===null?void 0:t;return function(f,u,h,...g){let x,b,c,l,d,_;return{data:b=f,facets:c=u,channels:x}=t.call(this,f,u,h,...g),{data:d=b,facets:_=c,channels:l}=r.call(this,b,c,{...h,...x},...g),{data:d,facets:_,channels:{...x,...l}}}}function Ts(t,r){return(t.initializer!=null?ff:wu)(t,r)}function md(t){return(r,f)=>{let u=nt(r,t);return{data:r,facets:f.map((h)=>h.filter((g)=>u[g]))}}}function jd(t,r){return{data:t,facets:r.map((f)=>f.slice().reverse())}}function yd(t,{sort:r,...f}={}){return{...(d1(t)&&t.channel!==void 0?ff:Ts)(f,ex(t)),sort:ef(r)?r:null}}function ex(t){return(typeof t==="function"&&t.length!==1?Fs:Bs)(t)}function Fs(t){return(r,f)=>{let u=mr(r)?(h,g)=>t(r[h],r[g]):(h,g)=>t(r.get(h),r.get(g));return{data:r,facets:f.map((h)=>h.slice().sort(u))}}}function Bs(t){let r,f;({channel:r,value:t,order:f}={...o0(t)});let u=r?.startsWith("-");if(u)r=r.slice(1);if(f===void 0)f=u?gu:xr;if(typeof f!=="function")switch(`${f}`.toLowerCase()){case"ascending":f=xr;break;case"descending":f=gu;break;default:throw Error(`invalid order: ${f}`)}return(h,g,x)=>{let b;if(r===void 0)b=nt(h,t);else{if(x===void 0)throw Error("channel sort requires an initializer");if(b=x[r],!b)return{};b=b.value}let c=(l,d)=>f(b[l],b[d]);return{data:h,facets:g.map((l)=>l.slice().sort(c))}}}function i8(t,...r){for(let{name:f}of t)if(r.includes(f))return!0;return!1}function tl(t,r,f=Cx){let u=Object.entries(t);if(r.title!=null&&t.title===void 0)u.push(["title",As]);if(r.href!=null&&t.href===void 0)u.push(["href",j7]);return u.filter(([,h])=>h!==void 0).map(([h,g])=>g===null?Ls(h):f(h,g,r))}function Cx(t,r,f,u=Kx){let h;if(jr(r)&&"reduce"in r)h=r.scale,r=r.reduce;let g=u(t,r,f),[x,b]=_1(g.label),c;return{name:t,output:h===void 0?x:{value:x,scale:h},initialize(l){g.initialize(l),c=b([])},scope(l,d){g.scope(l,d)},reduce(l,d){c.push(g.reduce(l,d))}}}function Ls(t){return{name:t,initialize(){},scope(){},reduce(){}}}function Kx(t,r,f,u=H8){let h=Zd(t,f),g=u(r,h),x,b;return{label:kr(g===M8?null:h,g.label),initialize(c){if(x=h===void 0?c:nt(c,h),g.scope==="data")b=g.reduceIndex(_r(c),x)},scope(c,l){if(g.scope===c)b=g.reduceIndex(l,x)},reduce(c,l){return g.scope==null?g.reduceIndex(c,x,l):g.reduceIndex(c,x,b,l)}}}function Vx(t,r){return r?g0(t,(f)=>r[f]):[[,t]]}function H8(t,r,f=Gs){if(t==null)return f(t);if(typeof t.reduceIndex==="function")return t;if(typeof t.reduce==="function"&&jr(t))return Rs(t);if(typeof t==="function")return zs(t);if(/^p\d{2}$/i.test(t))return uf(Vd(t));switch(`${t}`.toLowerCase()){case"first":return j7;case"last":return Ds;case"identity":return Wx;case"count":return M8;case"distinct":return Os;case"sum":return r==null?M8:Is;case"proportion":return pd(r,"data");case"proportion-facet":return pd(r,"facet");case"deviation":return uf(Pu);case"min":return uf(br);case"min-index":return uf(G8);case"max":return uf(Ot);case"max-index":return uf(L8);case"mean":return kd(A8);case"median":return kd(Gf);case"variance":return uf(su);case"mode":return uf(D8)}return f(t)}function Gs(t){throw Error(`invalid reduce: ${t}`)}function rl(t,r){for(let f in r){let u=r[f];if(u!==void 0&&!t.some((h)=>h.name===f))return u}}function fl(t,r,f){if(r){let u=r.output.transform(),h=(g,x)=>xr(u[g],u[x]);t.forEach((g)=>g.sort(h))}if(f)t.forEach((u)=>u.reverse())}function Rs(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function zs(t){return{reduceIndex(r,f,u){return t(v7(f,r),u)}}}function uf(t){return{reduceIndex(r,f){return t(r,(u)=>f[u])}}}function kd(t){return{reduceIndex(r,f){let u=t(r,(h)=>f[h]);return ot(f)?new Date(u):u}}}var Wx={reduceIndex(t,r){return v7(r,t)}},j7={reduceIndex(t,r){return r[t[0]]}},As={reduceIndex(t,r){let u=z0(Or(t,(g)=>g.length,(g)=>r[g]),_8),h=u.slice(-5).reverse();if(h.length`${g} (${x.toLocaleString("en-US")})`).join(` -`)}},Ds={reduceIndex(t,r){return r[t[t.length-1]]}},M8={label:"Frequency",reduceIndex(t){return t.length}},Os={label:"Distinct",reduceIndex(t,r){let f=new h0;for(let u of t)f.add(r[u]);return f.size}},Is=uf(sr);function pd(t,r){return t==null?{scope:r,label:"Frequency",reduceIndex:(f,u,h=1)=>f.length/h}:{scope:r,reduceIndex:(f,u,h=1)=>sr(f,(g)=>u[g])/h}}var ul={reduceIndex(t,r,{z:f}){return f}};function q1(t,{scale:r,type:f,value:u,filter:h,hint:g,label:x=kr(u)},b){if(g===void 0&&typeof u?.transform==="function")g=u.hint;return Zx(b,{scale:r,type:f,value:nt(t,u),label:x,filter:h,hint:g})}function gl(t,r){return Object.fromEntries(Object.entries(t).map(([f,u])=>[f,q1(r,u,f)]))}function xl(t,r){let f=Object.fromEntries(Object.entries(t).map(([u,{scale:h,value:g}])=>{let x=h==null?null:r[h];return[u,x==null?g:_t(g,x)]}));return f.channels=t,f}function Zx(t,r){let{scale:f,value:u}=r;if(f===!0||f==="auto")switch(t){case"fill":case"stroke":case"color":r.scale=f!==!0&&S7(u,M1)?null:"color",r.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":r.scale=f!==!0&&S7(u,zd)?null:"opacity",r.defaultScale="opacity";break;case"symbol":if(f!==!0&&S7(u,Sd))r.scale=null,r.value=_t(u,H1);else r.scale="symbol";r.defaultScale="symbol";break;default:r.scale=Mt.has(t)?t:null;break}else if(f===!1)r.scale=null;else if(f!=null&&!Mt.has(f))throw Error(`unknown scale: ${f}`);return r}function bl(t,r,f,u,h){let{order:g,reverse:x,reduce:b=!0,limit:c}=h;for(let l in h){if(!Mt.has(l))continue;let{value:d,order:_=g,reverse:w=x,reduce:M=b,limit:i=c}=o0(h[l]),H=d?.startsWith("-");if(H)d=d.slice(1);if(_=_===void 0?H!==(d==="width"||d==="height")?dl:cl:Ys(_),M==null||M===!1)continue;let q=l==="fx"||l==="fy"?Xs(r,u[l]):vs(f,l);if(!q)throw Error(`missing channel for scale: ${l}`);let s=q.value,[E=0,P=1/0]=qr(i)?i:i<0?[i]:[0,i];if(d==null)q.domain=()=>{let n=Array.from(new h0(s));if(w)n=n.reverse();if(E!==0||P!==1/0)n=n.slice(E,P);return n};else{let n=d==="data"?t:d==="height"?hl(f,"y1","y2"):d==="width"?hl(f,"x1","x2"):ox(f,d,d==="y"?"y2":d==="x"?"x2":void 0),$=H8(M===!0?"max":M,n);q.domain=()=>{let J=K4(_r(s),(Q)=>$.reduceIndex(Q,n),(Q)=>s[Q]);if(_)J.sort(_);if(w)J.reverse();if(E!==0||P!==1/0)J=J.slice(E,P);return J.map(I7)}}}}function vs(t,r){for(let f in t){let u=t[f];if(u.scale===r)return u}}function Xs(t,r){let f=t.original;if(f===t)return r;let u=r.value,h=r.value=[];for(let g=0;gMath.abs(g-u[x]),Float64Array)}function ox(t,r,f){let u=t[r];if(!u&&f!==void 0)u=t[f];if(u)return u.value;throw Error(`missing channel: ${r}`)}function Ys(t){if(t==null||typeof t==="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return cl;case"descending":return dl}throw Error(`invalid order: ${t}`)}function cl([t,r],[f,u]){return xr(r,u)||xr(t,f)}function dl([t,r],[f,u]){return gu(r,u)||xr(t,f)}function Tx(t,r){let f=t[r];if(!f)return;while(f.source)f=f.source;return f.source===null?null:f}var il=new Map([["accent",Jg],["category10",$g],["dark2",Qg],["observable10",Ng],["paired",Ug],["pastel1",eg],["pastel2",Cg],["set1",Kg],["set2",Vg],["set3",Wg],["tableau10",og]]);function Hl(t){return t!=null&&il.has(`${t}`.toLowerCase())}var ll=new Map([...il,["brbg",hf(s5,P5)],["prgn",hf(n5,$5)],["piyg",hf(J5,Q5)],["puor",hf(N5,U5)],["rdbu",hf(Ah,mu)],["rdgy",hf(e5,C5)],["rdylbu",hf(Dh,ju)],["rdylgn",hf(K5,V5)],["spectral",hf(W5,o5)],["burd",_l(Ah,mu)],["buylrd",_l(Dh,ju)],["blues",at(f7,u7)],["greens",at(h7,g7)],["greys",at(x7,b7)],["oranges",at(w7,M7)],["purples",at(c7,d7)],["reds",at(l7,_7)],["turbo",gf(Xh)],["viridis",gf(n7)],["magma",gf($7)],["inferno",gf(J7)],["plasma",gf(Q7)],["cividis",gf(Oh)],["cubehelix",gf(i7)],["warm",gf(q7)],["cool",gf(E7)],["bugn",at(Z5,T5)],["bupu",at(F5,B5)],["gnbu",at(L5,G5)],["orrd",at(R5,z5)],["pubu",at(O5,I5)],["pubugn",at(A5,D5)],["purd",at(v5,X5)],["rdpu",at(Y5,S5)],["ylgn",at(j5,y5)],["ylgnbu",at(a5,m5)],["ylorbr",at(k5,p5)],["ylorrd",at(t7,r7)],["rainbow",wl(Ih)],["sinebow",wl(vh)]]);function at(t,r){return({length:f})=>{if(f===1)return[t[3][1]];if(f===2)return[t[3][1],t[3][2]];return f=Math.max(3,Math.floor(f)),f>9?jt(r,f):t[f]}}function hf(t,r){return({length:f})=>{if(f===2)return[t[3][0],t[3][2]];return f=Math.max(3,Math.floor(f)),f>11?jt(r,f):t[f]}}function _l(t,r){return({length:f})=>{if(f===2)return[t[3][2],t[3][0]];return f=Math.max(3,Math.floor(f)),f>11?jt((u)=>r(1-u),f):t[f].slice().reverse()}}function gf(t){return({length:r})=>jt(t,Math.max(2,Math.floor(r)))}function wl(t){return({length:r})=>jt(t,Math.floor(r)+1).slice(0,-1)}function Fx(t){let r=`${t}`.toLowerCase();if(!ll.has(r))throw Error(`unknown ordinal scheme: ${r}`);return ll.get(r)}function q8(t,r){let f=Fx(t),u=typeof f==="function"?f({length:r}):f;return u.length!==r?u.slice(0,r):u}function ql(t,r="greys"){let f=new Set,[u,h]=q8(r,2);for(let g of t){if(g==null)continue;if(g===!0)f.add(h);else if(g===!1)f.add(u);else return}return[...f]}var Ml=new Map([["brbg",P5],["prgn",$5],["piyg",Q5],["puor",U5],["rdbu",mu],["rdgy",C5],["rdylbu",ju],["rdylgn",V5],["spectral",o5],["burd",(t)=>mu(1-t)],["buylrd",(t)=>ju(1-t)],["blues",u7],["greens",g7],["greys",b7],["purples",d7],["reds",_7],["oranges",M7],["turbo",Xh],["viridis",n7],["magma",$7],["inferno",J7],["plasma",Q7],["cividis",Oh],["cubehelix",i7],["warm",q7],["cool",E7],["bugn",T5],["bupu",B5],["gnbu",G5],["orrd",z5],["pubugn",D5],["pubu",I5],["purd",X5],["rdpu",S5],["ylgnbu",m5],["ylgn",y5],["ylorbr",p5],["ylorrd",r7],["rainbow",Ih],["sinebow",vh]]);function E1(t){let r=`${t}`.toLowerCase();if(!Ml.has(r))throw Error(`unknown quantitative scheme: ${r}`);return Ml.get(r)}var Ss=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function El(t){return t!=null&&Ss.has(`${t}`.toLowerCase())}var Lx=(t)=>(r)=>t(1-r),Bx=[0,1],sl=new Map([["number",st],["rgb",Vr],["hsl",O9],["hcl",I9],["lab",h6]]);function Gx(t){let r=`${t}`.toLowerCase();if(!sl.has(r))throw Error(`unknown interpolator: ${r}`);return sl.get(r)}function P1(t,r,f,{type:u,nice:h,clamp:g,zero:x,domain:b=Cl(t,f),unknown:c,round:l,scheme:d,interval:_,range:w=Mt.get(t)===du?ys(f,b):Mt.get(t)===lu?ks(f,b):Mt.get(t)===_u?Bx:void 0,interpolate:M=Mt.get(t)===Nr?d==null&&w!==void 0?Vr:E1(d!==void 0?d:u==="cyclical"?"rainbow":"turbo"):l?Hf:st,reverse:i}){if(b=Pl(b),_=W0(_,u),u==="cyclical"||u==="sequential")u="linear";if(typeof M!=="function")M=Gx(M);if(i=!!i,w!==void 0){let H=b.length,q=(w=Pl(w)).length;if(H!==q){if(M.length===1)throw Error("invalid piecewise interpolator");M=M0(M,w),w=void 0}}if(M.length===1){if(i)M=Lx(M),i=!1;if(w===void 0){if(w=Float64Array.from(b,(H,q)=>q/(b.length-1)),w.length===2)w=Bx}r.interpolate((w===Bx?Qr:E8)(M))}else r.interpolate(M);if(x){let[H,q]=Rt(b);if(H>0||q<0)if(b=Uf(b),(tf(b)||1)===Math.sign(H))b[0]=0;else b[b.length-1]=0}if(i)b=df(b);if(r.domain(b).unknown(c),h)r.nice(as(h,u)),b=r.domain();if(w!==void 0)r.range(w);if(g)r.clamp(g);return{type:u,domain:b,range:w,scale:r,interpolate:M,interval:_}}function Pl(t){return t=V0(t),t.length>=2?t:[t[0],t[0]]}function as(t,r){return t===!0?void 0:typeof t==="number"?t:Td(t,r)}function nl(t,r,f){return P1(t,pf(),r,f)}function $l(t,r,f){return Rx(t,r,{...f,exponent:0.5})}function Rx(t,r,{exponent:f=1,...u}){return P1(t,Vh().exponent(f),r,{...u,type:"pow"})}function Jl(t,r,{base:f=10,domain:u=ps(r),...h}){return P1(t,Ch().base(f),r,{...h,domain:u})}function Ql(t,r,{constant:f=1,...u}){return P1(t,Kh().constant(f),r,u)}function Nl(t,r,{range:f,quantiles:u=f===void 0?5:(f=[...f]).length,n:h=u,scheme:g="rdylbu",domain:x=tP(r),unknown:b,interpolate:c,reverse:l}){if(f===void 0)f=c!==void 0?jt(c,h):Mt.get(t)===Nr?q8(g,h):void 0;if(x.length>0)x=Wh(x,f===void 0?{length:h}:f).quantiles();return y7(t,r,{domain:x,range:f,reverse:l,unknown:b})}function Ul(t,r,{range:f,n:u=f===void 0?5:(f=[...f]).length,scheme:h="rdylbu",domain:g=Cl(t,r),unknown:x,interpolate:b,reverse:c}){let[l,d]=Rt(g),_;if(f===void 0){if(_=Ir(l,d,u),_[0]<=l)_.splice(0,1);if(_[_.length-1]>=d)_.pop();u=_.length+1,f=b!==void 0?jt(b,u):Mt.get(t)===Nr?q8(h,u):void 0}else if(_=jt(st(l,d),u+1).slice(1,-1),l instanceof Date)_=_.map((w)=>new Date(w));if(tf(V0(g))<0)_.reverse();return y7(t,r,{domain:_,range:f,reverse:c,unknown:x})}function y7(t,r,{domain:f=[0],unknown:u,scheme:h="rdylbu",interpolate:g,range:x=g!==void 0?jt(g,f.length+1):Mt.get(t)===Nr?q8(h,f.length+1):void 0,reverse:b}){f=V0(f);let c=tf(f);if(!isNaN(c)&&!ms(f,c))throw Error(`the ${t} scale has a non-monotonic domain`);if(b)x=df(x);return{type:"threshold",scale:oh(c<0?df(f):f,x===void 0?[]:x).unknown(u),domain:f,range:x}}function ms(t,r){for(let f=1,u=t.length,h=t[0];fr}}function s1(t,r=tx){return t.length?[br(t,({value:f})=>f===void 0?f:br(f,r)),Ot(t,({value:f})=>f===void 0?f:Ot(f,r))]:[0,1]}function Cl(t,r){let f=Mt.get(t);return(f===du||f===_u||f===lu?js:s1)(r)}function js(t){return[0,t.length?Ot(t,({value:r})=>r===void 0?r:Ot(r,tx)):1]}function ys(t,r){let f=t.find(({radius:x})=>x!==void 0);if(f!==void 0)return[0,f.radius];let u=Cr(t,0.5,({value:x})=>x===void 0?NaN:Cr(x,0.25,xu)),h=r.map((x)=>3*Math.sqrt(x/u)),g=30/Ot(h);return g<1?h.map((x)=>x*g):h}function ks(t,r){let f=Gf(t,({value:g})=>g===void 0?NaN:Gf(g,Math.abs)),u=r.map((g)=>12*g/f),h=60/Ot(u);return h<1?u.map((g)=>g*h):u}function ps(t){for(let{value:r}of t)if(r!==void 0)for(let f of r){if(f>0)return s1(t,xu);if(f<0)return s1(t,u1)}return[1,10]}function tP(t){let r=[];for(let{value:f}of t){if(f===void 0)continue;for(let u of f)r.push(u)}return r}function E8(t){return(r,f)=>(u)=>t(r+u*(f-r))}var zx=0,Ax;function Kl(){let t=zx;return zx=0,Ax=void 0,t}function Er(t){if(t===Ax)return;Ax=t,console.warn(t),++zx}function k7(t,r,f,u,{type:h,nice:g,clamp:x,domain:b=s1(u),unknown:c,pivot:l=0,scheme:d,range:_,symmetric:w=!0,interpolate:M=Mt.get(t)===Nr?d==null&&_!==void 0?Vr:E1(d!==void 0?d:"rdbu"):st,reverse:i}){l=+l,b=V0(b);let[H,q]=b;if(b.length>2)Er(`Warning: the diverging ${t} scale domain contains extra elements.`);if(Ur(H,q)<0)[H,q]=[q,H],i=!i;if(H=Math.min(H,l),q=Math.max(q,l),typeof M!=="function")M=Gx(M);if(_!==void 0)M=M.length===1?E8(M)(..._):M0(M,_);if(i)M=Lx(M);if(w){let s=f.apply(l),E=s-f.apply(H),P=f.apply(q)-s;if(EP)q=f.invert(s+E)}if(r.domain([H,l,q]).unknown(c).interpolator(M),x)r.clamp(x);if(g)r.nice(g);return{type:h,domain:[H,q],pivot:l,interpolate:M,scale:r}}function Vl(t,r,f){return k7(t,zh(),rP,r,f)}function Wl(t,r,f){return Dx(t,r,{...f,exponent:0.5})}function Dx(t,r,{exponent:f=1,...u}){return k7(t,E5().exponent(f=+f),hP(f),r,{...u,type:"diverging-pow"})}function ol(t,r,{base:f=10,pivot:u=1,domain:h=s1(r,u<0?u1:xu),...g}){return k7(t,H5().base(f=+f),fP,r,{domain:h,pivot:u,...g})}function Zl(t,r,{constant:f=1,...u}){return k7(t,q5().constant(f=+f),gP(f),r,u)}var rP={apply(t){return t},invert(t){return t}},fP={apply:Math.log,invert:Math.exp},uP={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function hP(t){return t===0.5?uP:{apply(r){return Math.sign(r)*Math.pow(Math.abs(r),t)},invert(r){return Math.sign(r)*Math.pow(Math.abs(r),1/t)}}}function gP(t){return{apply(r){return Math.sign(r)*Math.log1p(Math.abs(r/t))},invert(r){return Math.sign(r)*Math.expm1(Math.abs(r))*t}}}function Tl(t,r,f,u){return P1(t,r,f,u)}function Fl(t,r,f){return Tl(t,w5(),r,f)}function Bl(t,r,f){return Tl(t,M5(),r,f)}var n1=Symbol("ordinal");function Gl(t,r,f,{type:u,interval:h,domain:g,range:x,reverse:b,hint:c}){if(h=W0(h,u),g===void 0)g=Ol(f,h,t);if(u==="categorical"||u===n1)u="ordinal";if(b)g=df(g);if(g=r.domain(g).domain(),x!==void 0){if(typeof x==="function")x=x(g);r.range(x)}return{type:u,domain:g,range:x,scale:r,hint:c,interval:h}}function Rl(t,r,{type:f,interval:u,domain:h,range:g,scheme:x,unknown:b,...c}){if(u=W0(u,f),h===void 0)h=Ol(r,u,t);let l;if(Mt.get(t)===i1)l=xP(r),g=g===void 0?bP(l):_t(g,H1);else if(Mt.get(t)===Nr){if(g===void 0&&(f==="ordinal"||f===n1)){if(g=ql(h,x),g!==void 0)x=void 0}if(x===void 0&&g===void 0)x=f==="ordinal"?"turbo":"observable10";if(x!==void 0)if(g!==void 0){let d=E1(x),_=g[0],w=g[1]-g[0];g=({length:M})=>jt((i)=>d(_+w*i),M)}else g=Fx(x)}if(b===Qh)throw Error(`implicit unknown on ${t} scale is not supported`);return Gl(t,yf().unknown(b),r,{...c,type:f,domain:h,range:g,hint:l})}function zl(t,r,{align:f=0.5,padding:u=0.5,...h}){return Dl(hg().align(f).padding(u),r,h,t)}function Al(t,r,{align:f=0.5,padding:u=0.1,paddingInner:h=u,paddingOuter:g=t==="fx"||t==="fy"?0:u,...x}){return Dl(Ef().align(f).paddingInner(h).paddingOuter(g),r,x,t)}function Dl(t,r,f,u){let{round:h}=f;if(h!==void 0)t.round(h=!!h);return t=Gl(u,t,r,f),t.round=h,t}function Ol(t,r,f){let u=new h0;for(let{value:h,domain:g}of t){if(g!==void 0)return g();if(h===void 0)continue;for(let x of h)u.add(x)}if(r!==void 0){let[h,g]=Rt(u).map(r.floor,r);return r.range(h,r.offset(g))}if(u.size>1e4&&Mt.get(f)===Dr)throw Error(`implicit ordinal domain of ${f} scale has more than 10,000 values`);return z0(u,xr)}function Ll(t,r){let f;for(let{hint:u}of t){let h=u?.[r];if(h===void 0)continue;if(f===void 0)f=h;else if(f!==h)return}return f}function xP(t){return{fill:Ll(t,"fill"),stroke:Ll(t,"stroke")}}function bP(t){return St(t.fill)?zg:K7}function s8(t,{label:r,inset:f=0,insetTop:u=f,insetRight:h=f,insetBottom:g=f,insetLeft:x=f,round:b,nice:c,clamp:l,zero:d,align:_,padding:w,projection:M,facet:{label:i=r}={},...H}={}){let q={};for(let[s,E]of t){let P=H[s],n=lP(s,E,{round:Mt.get(s)===Dr?b:void 0,nice:c,clamp:l,zero:d,align:_,padding:w,projection:M,...P});if(n){let{label:$=s==="fx"||s==="fy"?i:r,percent:J,transform:Q,inset:U,insetTop:e=U!==void 0?U:s==="y"?u:0,insetRight:o=U!==void 0?U:s==="x"?h:0,insetBottom:K=U!==void 0?U:s==="y"?g:0,insetLeft:V=U!==void 0?U:s==="x"?x:0}=P||{};if(Q==null)Q=void 0;else if(typeof Q!=="function")throw Error("invalid scale transform; not a function");if(n.percent=!!J,n.label=$===void 0?cP(E,n):$,n.transform=Q,s==="x"||s==="fx")n.insetLeft=+V,n.insetRight=+o;else if(s==="y"||s==="fy")n.insetTop=+e,n.insetBottom=+K;q[s]=n}}return q}function Ix(t){let r={},f={scales:r};for(let[u,h]of Object.entries(t)){let{scale:g,type:x,interval:b,label:c}=h;if(r[u]=iP(h),f[u]=g,g.type=x,b!=null)g.interval=b;if(c!=null)g.label=c}return f}function Sl(t,r){let{x:f,y:u,fx:h,fy:g}=t,x=h||g?t4(r):r;if(h)Il(h,x);if(g)vl(g,x);let b=h||g?vx(t,r):r;if(f)Il(f,b);if(u)vl(u,b)}function cP(t=[],r){let f;for(let{label:u}of t){if(u===void 0)continue;if(f===void 0)f=u;else if(f!==u)return}if(f===void 0)return;if(!Z0(r)&&r.percent)f=`${f} (%)`;return{inferred:!0,toString:()=>f}}function al(t){return Math.sign(tf(t.domain()))*Math.sign(tf(t.range()))}function t4(t){let{marginTop:r,marginRight:f,marginBottom:u,marginLeft:h,width:g,height:x,facet:{marginTop:b,marginRight:c,marginBottom:l,marginLeft:d}}=t;return{marginTop:Math.max(r,b),marginRight:Math.max(f,c),marginBottom:Math.max(u,l),marginLeft:Math.max(h,d),width:g,height:x}}function vx({fx:t,fy:r},f){let{marginTop:u,marginRight:h,marginBottom:g,marginLeft:x,width:b,height:c}=t4(f);return{marginTop:u,marginRight:h,marginBottom:g,marginLeft:x,width:t?t.scale.bandwidth()+x+h:b,height:r?r.scale.bandwidth()+u+g:c,facet:{width:b,height:c}}}function Il(t,r){if(t.range===void 0){let{insetLeft:f,insetRight:u}=t,{width:h,marginLeft:g=0,marginRight:x=0}=r,b=g+f,c=h-x-u;if(t.range=[b,Math.max(b,c)],!Z0(t))t.range=jl(t);t.scale.range(t.range)}ml(t)}function vl(t,r){if(t.range===void 0){let{insetTop:f,insetBottom:u}=t,{height:h,marginTop:g=0,marginBottom:x=0}=r,b=g+f,c=h-x-u;if(t.range=[Math.max(b,c),b],!Z0(t))t.range=jl(t);else t.range.reverse();t.scale.range(t.range)}ml(t)}function ml(t){if(t.round===void 0&&wP(t)&&dP(t)<=30)t.scale.round(!0)}function dP({scale:t}){let r=t.domain().length,[f,u]=t.range(),h=t.paddingInner?t.paddingInner():1,g=t.paddingOuter?t.paddingOuter():t.padding(),x=r-h,b=Math.abs(u-f)/Math.max(1,x+g*2);return(b-Math.floor(b))*x}function jl(t){let r=t.scale.domain().length+Xx(t);if(!(r>2))return t.range;let[f,u]=t.range;return Array.from({length:r},(h,g)=>f+g/(r-1)*(u-f))}function lP(t,r=[],f={}){let u=_P(t,r,f);if(f.type===void 0&&f.domain===void 0&&f.range===void 0&&f.interval==null&&t!=="fx"&&t!=="fy"&&Z0({type:u})){let h=r.map(({value:g})=>g).filter((g)=>g!==void 0);if(h.some(ot))Er(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${$1(u)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${t} scale to "${$1(u)}".`);else if(h.some(Ld))Er(`Warning: some data associated with the ${t} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${$1(u)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${t} scale to "${$1(u)}".`);else if(h.some(Gd))Er(`Warning: some data associated with the ${t} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${$1(u)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${t} scale to "${$1(u)}".`)}switch(f.type=u,u){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":f=p7(r,f,K0);break;case"identity":switch(Mt.get(t)){case Dr:f=p7(r,f,K0);break;case i1:f=p7(r,f,MP);break}break;case"utc":case"time":f=p7(r,f,wx);break}switch(u){case"diverging":return Vl(t,r,f);case"diverging-sqrt":return Wl(t,r,f);case"diverging-pow":return Dx(t,r,f);case"diverging-log":return ol(t,r,f);case"diverging-symlog":return Zl(t,r,f);case"categorical":case"ordinal":case n1:return Rl(t,r,f);case"cyclical":case"sequential":case"linear":return nl(t,r,f);case"sqrt":return $l(t,r,f);case"threshold":return y7(t,r,f);case"quantile":return Nl(t,r,f);case"quantize":return Ul(t,r,f);case"pow":return Rx(t,r,f);case"log":return Jl(t,r,f);case"symlog":return Ql(t,r,f);case"utc":return Bl(t,r,f);case"time":return Fl(t,r,f);case"point":return zl(t,r,f);case"band":return Al(t,r,f);case"identity":return el(t);case void 0:return;default:throw Error(`unknown scale type: ${u}`)}}function $1(t){return typeof t==="symbol"?t.description:t}function Xl(t){return typeof t==="string"?`${t}`.toLowerCase():t}var Yl={toString:()=>"projection"};function _P(t,r,{type:f,domain:u,range:h,scheme:g,pivot:x,projection:b}){if(f=Xl(f),t==="fx"||t==="fy")return"band";if((t==="x"||t==="y")&&b!=null)f=Yl;for(let d of r){let _=Xl(d.type);if(_===void 0)continue;else if(f===void 0)f=_;else if(f!==_)throw Error(`scale incompatible with channel: ${f} !== ${_}`)}if(f===Yl)return;if(f!==void 0)return f;if(u===void 0&&!r.some(({value:d})=>d!==void 0))return;let c=Mt.get(t);if(c===du)return"sqrt";if(c===_u||c===lu)return"linear";if(c===i1)return"ordinal";let l=(u??h)?.length;if(l<2||l>2)return Ox(c);if(u!==void 0){if(nx(u))return Ox(c);if(ot(u))return"utc"}else{let d=r.map(({value:_})=>_).filter((_)=>_!==void 0);if(d.some(nx))return Ox(c);if(d.some(ot))return"utc"}if(c===Nr){if(x!=null||El(g))return"diverging";if(Hl(g))return"categorical"}return"linear"}function Ox(t){switch(t){case Dr:return"point";case Nr:return n1;default:return"ordinal"}}function Z0({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===n1}function Xx({type:t}){return t==="threshold"}function wP({type:t}){return t==="point"||t==="band"}function pr(t){if(t===void 0)return!0;let r=t.domain(),f=t(r[0]);for(let u=1,h=r.length;u{if(!Mt.has(r=`${r}`))throw Error(`unknown scale: ${r}`);return t[r]}}function iP({scale:t,type:r,domain:f,range:u,interpolate:h,interval:g,transform:x,percent:b,pivot:c}){if(r==="identity")return{type:"identity",apply:(d)=>d,invert:(d)=>d};let l=t.unknown?t.unknown():void 0;return{type:r,domain:Uf(f),...u!==void 0&&{range:Uf(u)},...x!==void 0&&{transform:x},...b&&{percent:b},...l!==void 0&&{unknown:l},...g!==void 0&&{interval:g},...h!==void 0&&{interpolate:h},...t.clamp&&{clamp:t.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...t.base&&{base:t.base()},...t.exponent&&{exponent:t.exponent()},...t.constant&&{constant:t.constant()},...t.align&&{align:t.align(),round:t.round()},...t.padding&&(t.paddingInner?{paddingInner:t.paddingInner(),paddingOuter:t.paddingOuter()}:{padding:t.padding()}),...t.bandwidth&&{bandwidth:t.bandwidth(),step:t.step()},apply:(d)=>t(d),...t.invert&&{invert:(d)=>t.invert(d)}}}function pl(t,r){let{fx:f,fy:u}=s8(t,r),h=f?.scale.domain(),g=u?.scale.domain();return h&&g?Z8(h,g).map(([x,b],c)=>({x,y:b,i:c})):h?h.map((x,b)=>({x,i:b})):g?g.map((x,b)=>({y:x,i:b})):void 0}function t_(t,{x:r,y:f}){return r&&=jx(r),f&&=jx(f),t.filter(r&&f?(u)=>r.has(u.x)&&f.has(u.y):r?(u)=>r.has(u.x):(u)=>f.has(u.y)).sort(r&&f?(u,h)=>r.get(u.x)-r.get(h.x)||f.get(u.y)-f.get(h.y):r?(u,h)=>r.get(u.x)-r.get(h.x):(u,h)=>f.get(u.y)-f.get(h.y))}function f4(t,{fx:r,fy:f}){let u=_r(t),h=r?.value,g=f?.value;return r&&f?Or(u,(x)=>(x.fx=h[x[0]],x.fy=g[x[0]],x),(x)=>h[x],(x)=>g[x]):r?Or(u,(x)=>(x.fx=h[x[0]],x),(x)=>h[x]):Or(u,(x)=>(x.fy=g[x[0]],x),(x)=>g[x])}function r_(t,r,{marginTop:f,marginLeft:u}){let h=t?({x})=>t(x)-u:()=>0,g=r?({y:x})=>r(x)-f:()=>0;return function(x){if(this.tagName==="svg")this.setAttribute("x",h(x)),this.setAttribute("y",g(x));else this.setAttribute("transform",`translate(${h(x)},${g(x)})`)}}function f_(t){let r=[],f=new Uint32Array(sr(t,(u)=>u.length));for(let u of t){let h=0;for(let g of t){if(u===g)continue;f.set(g,h),h+=g.length}r.push(f.slice(0,h))}return r}var HP=new Map([["top",Yx],["right",mx],["bottom",Sx],["left",ax],["top-left",r4(Yx,ax)],["top-right",r4(Yx,mx)],["bottom-left",r4(Sx,ax)],["bottom-right",r4(Sx,mx)],["top-empty",EP],["right-empty",nP],["bottom-empty",sP],["left-empty",PP],["empty",$P]]);function u_(t){if(t==null)return null;let r=HP.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid facet anchor: ${t}`)}var kl=new WeakMap;function jx(t){let r=kl.get(t);if(!r)kl.set(t,r=new Mr(_t(t,(f,u)=>[f,u])));return r}function Wf(t,r){return jx(t).get(r)}function qP(t,r,f){return r=zr(r),f=zr(f),t.find((u)=>Object.is(zr(u.x),r)&&Object.is(zr(u.y),f))}function u4(t,r,f){return qP(t,r,f)?.empty}function Yx(t,{y:r},{y:f}){return r?Wf(r,f)===0:!0}function Sx(t,{y:r},{y:f}){return r?Wf(r,f)===r.length-1:!0}function ax(t,{x:r},{x:f}){return r?Wf(r,f)===0:!0}function mx(t,{x:r},{x:f}){return r?Wf(r,f)===r.length-1:!0}function EP(t,{y:r},{x:f,y:u,empty:h}){if(h)return!1;if(!r)return;let g=Wf(r,u);if(g>0)return u4(t,f,r[g-1])}function sP(t,{y:r},{x:f,y:u,empty:h}){if(h)return!1;if(!r)return;let g=Wf(r,u);if(g0)return u4(t,r[g-1],u)}function nP(t,{x:r},{x:f,y:u,empty:h}){if(h)return!1;if(!r)return;let g=Wf(r,f);if(gu.get(h)?.get(g)??[]):r?t.map(({x:h})=>u.get(h)??[]):t.map(({y:h})=>u.get(h)??[])}var h_=Math.PI,xf=2*h_,yx=0.618;function g_({projection:t,inset:r=0,insetTop:f=r,insetRight:u=r,insetBottom:h=r,insetLeft:g=r}={},x){if(t==null)return;if(typeof t.stream==="function")return t;let b,c,l="frame";if(jr(t)){let $;if({type:t,domain:c,inset:$,insetTop:f=$!==void 0?$:f,insetRight:u=$!==void 0?$:u,insetBottom:h=$!==void 0?$:h,insetLeft:g=$!==void 0?$:g,clip:l=l,...b}=t,t==null)return}if(typeof t!=="function")({type:t}=kx(t));let{width:d,height:_,marginLeft:w,marginRight:M,marginTop:i,marginBottom:H}=x,q=d-w-M-g-u,s=_-i-H-f-h;if(t=t?.({width:q,height:s,clip:l,...b}),t==null)return;l=JP(l,w,i,d-M,_-H);let E=w+g,P=i+f,n;if(c!=null){let[[$,J],[Q,U]]=mf(t).bounds(c),e=Math.min(q/(Q-$),s/(U-J));if(e>0)E-=(e*($+Q)-q)/2,P-=(e*(J+U)-s)/2,n=jf({point(o,K){this.stream.point(o*e+E,K*e+P)}});else Er("Warning: the projection could not be fit to the specified domain; using the default scale.")}return n??=E===0&&P===0?x_():jf({point($,J){this.stream.point($+E,J+P)}}),{stream:($)=>t.stream(n.stream(l($)))}}function kx(t){switch(`${t}`.toLowerCase()){case"albers-usa":return t0(D6,0.7463,0.4673);case"albers":return g4(Iu,0.7463,0.4673);case"azimuthal-equal-area":return t0(I6,4,4);case"azimuthal-equidistant":return t0(v6,xf,xf);case"conic-conformal":return g4(S6,xf,xf);case"conic-equal-area":return g4(v0,6.1702,2.9781);case"conic-equidistant":return g4(m6,7.312,3.6282);case"equal-earth":return t0(y6,5.4133,2.6347);case"equirectangular":return t0(a6,xf,h_);case"gnomonic":return t0(k6,3.4641,3.4641);case"identity":return{type:x_};case"reflect-y":return{type:QP};case"mercator":return t0(X6,xf,xf);case"orthographic":return t0(p6,2,2);case"stereographic":return t0(t5,2,2);case"transverse-mercator":return t0(r5,xf,xf);default:throw Error(`unknown projection type: ${t}`)}}function JP(t,r,f,u,h){if(t===!1||t==null||typeof t==="number")return(g)=>g;if(t===!0)t="frame";switch(`${t}`.toLowerCase()){case"frame":return Gu(r,f,u,h);default:throw Error(`unknown projection clip type: ${t}`)}}function t0(t,r,f){return{type:({width:u,height:h,rotate:g,precision:x=0.15,clip:b})=>{let c=t();if(x!=null)c.precision?.(x);if(g!=null)c.rotate?.(g);if(typeof b==="number")c.clipAngle?.(b);if(u!=null)c.scale(Math.min(u/r,h/f)),c.translate([u/2,h/2]);return c},aspectRatio:f/r}}function g4(t,r,f){let{type:u,aspectRatio:h}=t0(t,r,f);return{type:(g)=>{let{parallels:x,domain:b,width:c,height:l}=g,d=u(g);if(x!=null){if(d.parallels(x),b===void 0&&c!=null)d.fitSize([c,l],{type:"Sphere"})}return d},aspectRatio:h}}var x_=Qr({stream:(t)=>t}),QP=Qr(jf({point(t,r){this.stream.point(t,-r)}}));function b_(t,r,f,u){let h=f[t],g=f[r],x=h.length,b=f[t]=new Float64Array(x).fill(NaN),c=f[r]=new Float64Array(x).fill(NaN),l,d=u.stream({point(_,w){b[l]=_,c[l]=w}});for(l=0;l5?5:c:yx}}if(t==null)return;if(typeof t!=="function"){let{aspectRatio:r}=kx(t);if(r)return r}return yx}function l_(t){let r=[],f=[],u={scale:"x",value:r},h={scale:"y",value:f},g={point(x,b){r.push(x),f.push(b)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let x of t.value)Tr(x,g);return[u,h]}function __({x:t,y:r}){if(t||r)return t??=(f)=>f,r??=(f)=>f,jf({point(f,u){this.stream.point(t(f),r(u))}})}function J1(t={}){let{document:r=typeof window<"u"?window.document:void 0,clip:f}=t;return{document:r,clip:m7(f)}}function gt(t,{document:r}){return Pr(c0(t).call(r.documentElement))}var x4=Symbol("unset");function b4(t){return(t.length===1?NP:UP)(t)}function NP(t){let r,f=x4;return(u)=>{if(!Object.is(f,u))f=u,r=t(u);return r}}function UP(t){let r,f;return(...u)=>{if(f?.length!==u.length||f.some((h,g)=>!Object.is(h,u[g])))f=u,r=t(...u);return r}}var eP=b4((t)=>{return new Intl.NumberFormat(t)}),Dv=b4((t,r)=>{return new Intl.DateTimeFormat(t,{timeZone:"UTC",...r&&{month:r}})}),Ov=b4((t,r)=>{return new Intl.DateTimeFormat(t,{timeZone:"UTC",...r&&{weekday:r}})});function CP(t="en-US"){let r=eP(t);return(f)=>f!=null&&!isNaN(f)?r.format(f):void 0}function KP(t){return A7(t,"Invalid Date")}function VP(t="en-US"){let r=CP(t);return(f)=>(f instanceof Date?KP:typeof f==="number"?r:Zt)(f)}var T0=VP();var tr=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:0.5,WP=0;function M_(){return`plot-clip-${++WP}`}function i_(t,{title:r,href:f,ariaLabel:u,ariaDescription:h,ariaHidden:g,target:x,fill:b,fillOpacity:c,stroke:l,strokeWidth:d,strokeOpacity:_,strokeLinejoin:w,strokeLinecap:M,strokeMiterlimit:i,strokeDasharray:H,strokeDashoffset:q,opacity:s,mixBlendMode:E,imageFilter:P,paintOrder:n,pointerEvents:$,shapeRendering:J,channels:Q},{ariaLabel:U,fill:e="currentColor",fillOpacity:o,stroke:K="none",strokeOpacity:V,strokeWidth:G,strokeLinecap:B,strokeLinejoin:N,strokeMiterlimit:W,paintOrder:p}){if(e===null)b=null,c=null;if(K===null)l=null,_=null;if(St(e)){if(!St(K)&&(!St(b)||Q?.fill))K="none"}else if(St(K)&&(!St(l)||Q?.stroke))e="none";let[a,T]=Hr(b,e),[L,A]=Ct(c,o),[X,z]=Hr(l,K),[rt,m]=Ct(_,V),[ht,Y]=Ct(s);if(!cu(z)){if(d===void 0)d=G;if(M===void 0)M=B;if(w===void 0)w=N;if(i===void 0&&!Ad(w))i=W;if(!cu(T)&&n===void 0)n=p}let[j,Z]=Ct(d);if(e!==null)t.fill=Kt(T,"currentColor"),t.fillOpacity=P8(A,1);if(K!==null)t.stroke=Kt(z,"none"),t.strokeWidth=P8(Z,1),t.strokeOpacity=P8(m,1),t.strokeLinejoin=Kt(w,"miter"),t.strokeLinecap=Kt(M,"butt"),t.strokeMiterlimit=P8(i,4),t.strokeDasharray=Kt(H,"none"),t.strokeDashoffset=Kt(q,"0");return t.target=Zt(x),t.ariaLabel=Zt(U),t.ariaDescription=Zt(h),t.ariaHidden=Zt(g),t.opacity=P8(Y,1),t.mixBlendMode=Kt(E,"normal"),t.imageFilter=Kt(P,"none"),t.paintOrder=Kt(n,"normal"),t.pointerEvents=Kt($,"auto"),t.shapeRendering=Kt(J,"auto"),{title:{value:r,optional:!0,filter:null},href:{value:f,optional:!0,filter:null},ariaLabel:{value:u,optional:!0,filter:null},fill:{value:a,scale:"auto",optional:!0},fillOpacity:{value:L,scale:"auto",optional:!0},stroke:{value:X,scale:"auto",optional:!0},strokeOpacity:{value:rt,scale:"auto",optional:!0},strokeWidth:{value:j,optional:!0},opacity:{value:ht,scale:"auto",optional:!0}}}function oP(t,r){if(r)t.filter((f)=>b8(r[f])).append("title").call(TP,r)}function ZP(t,r){if(r)t.filter(([f])=>b8(r[f])).append("title").call(FP,r)}function TP(t,r){if(r)t.text((f)=>T0(r[f]))}function FP(t,r){if(r)t.text(([f])=>T0(r[f]))}function rr(t,{target:r,tip:f},{ariaLabel:u,title:h,fill:g,fillOpacity:x,stroke:b,strokeOpacity:c,strokeWidth:l,opacity:d,href:_}){if(u)y(t,"aria-label",(w)=>u[w]);if(g)y(t,"fill",(w)=>g[w]);if(x)y(t,"fill-opacity",(w)=>x[w]);if(b)y(t,"stroke",(w)=>b[w]);if(c)y(t,"stroke-opacity",(w)=>c[w]);if(l)y(t,"stroke-width",(w)=>l[w]);if(d)y(t,"opacity",(w)=>d[w]);if(_)H_(t,(w)=>_[w],r);if(!f)oP(t,h)}function c4(t,{target:r,tip:f},{ariaLabel:u,title:h,fill:g,fillOpacity:x,stroke:b,strokeOpacity:c,strokeWidth:l,opacity:d,href:_}){if(u)y(t,"aria-label",([w])=>u[w]);if(g)y(t,"fill",([w])=>g[w]);if(x)y(t,"fill-opacity",([w])=>x[w]);if(b)y(t,"stroke",([w])=>b[w]);if(c)y(t,"stroke-opacity",([w])=>c[w]);if(l)y(t,"stroke-width",([w])=>l[w]);if(d)y(t,"opacity",([w])=>d[w]);if(_)H_(t,([w])=>_[w],r);if(!f)ZP(t,h)}function BP({ariaLabel:t,title:r,fill:f,fillOpacity:u,stroke:h,strokeOpacity:g,strokeWidth:x,opacity:b,href:c},{tip:l}){return[t,l?void 0:r,f,u,h,g,x,b,c].filter((d)=>d!==void 0)}function LP(t,r,f){let u=g0(t,(h)=>r[h]);if(f===void 0&&u.size>1+t.length>>1)Er("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null.");return u.values()}function*d4(t,r,f,u){let{z:h}=f,{z:g}=u,x=BP(u,f),b=[...r,...x];for(let c of g?LP(t,g,h):[t]){let l,d;t:for(let _ of c){for(let w of b)if(!Rr(w[_])){if(d)d.push(-1);continue t}if(l===void 0){if(d)yield d;l=x.map((w)=>zr(w[_])),d=[_];continue}d.push(_);for(let w=0;wzr(i[_])),d=[_];continue t}}if(d)yield d}}function GP(t,r,f,u){let h,{clip:g=u.clip}=r;if(g==="frame")t=gt("svg:g",u).each(function(){this.appendChild(t.node()),t.node=()=>this}),h=zP(u,f);else if(g)h=DP(g,u);y(t,"aria-label",r.ariaLabel),y(t,"aria-description",r.ariaDescription),y(t,"aria-hidden",r.ariaHidden),y(t,"clip-path",h)}function RP(t){let r=new WeakMap;return(f,u)=>{let h=r.get(f);if(!h){let g=M_();Pr(f.ownerSVGElement).append("clipPath").attr("id",g).call(t,f,u),r.set(f,h=`url(#${g})`)}return h}}var zP=RP((t,r,f)=>{let{width:u,height:h,marginLeft:g,marginRight:x,marginTop:b,marginBottom:c}=f;t.append("rect").attr("x",g).attr("y",b).attr("width",u-x-g).attr("height",h-b-c)}),w_=new WeakMap,AP={type:"Sphere"};function DP(t,r){let f,u;if(!(f=w_.get(r)))w_.set(r,f=new WeakMap);if(t.type==="Sphere")t=AP;if(!(u=f.get(t))){let h=M_();Pr(r.ownerSVGElement).append("clipPath").attr("id",h).append("path").attr("d",r.path()(t)),f.set(t,u=`url(#${h})`)}return u}function Ft(t,r,f,u){GP(t,r,f,u),y(t,"class",r.className),y(t,"fill",r.fill),y(t,"fill-opacity",r.fillOpacity),y(t,"stroke",r.stroke),y(t,"stroke-width",r.strokeWidth),y(t,"stroke-opacity",r.strokeOpacity),y(t,"stroke-linejoin",r.strokeLinejoin),y(t,"stroke-linecap",r.strokeLinecap),y(t,"stroke-miterlimit",r.strokeMiterlimit),y(t,"stroke-dasharray",r.strokeDasharray),y(t,"stroke-dashoffset",r.strokeDashoffset),y(t,"shape-rendering",r.shapeRendering),y(t,"filter",r.imageFilter),y(t,"paint-order",r.paintOrder);let{pointerEvents:h=u.pointerSticky===!1?"none":void 0}=r;y(t,"pointer-events",h)}function Nt(t,r){OP(t,"mix-blend-mode",r.mixBlendMode),y(t,"opacity",r.opacity)}function H_(t,r,f){t.each(function(u){let h=r(u);if(h!=null){let g=this.ownerDocument.createElementNS(x0.svg,"a");if(g.setAttribute("fill","inherit"),g.setAttributeNS(x0.xlink,"href",h),f!=null)g.setAttribute("target",f);this.parentNode.insertBefore(g,this).appendChild(this)}})}function y(t,r,f){if(f!=null)t.attr(r,f)}function OP(t,r,f){if(f!=null)t.style(r,f)}function Bt(t,r,{x:f,y:u},h=tr,g=tr){if(h+=r.dx,g+=r.dy,f?.bandwidth)h+=f.bandwidth()/2;if(u?.bandwidth)g+=u.bandwidth()/2;if(h||g)t.attr("transform",`translate(${h},${g})`)}function Kt(t,r){if((t=Zt(t))!==r)return t}function P8(t,r){if((t=Tt(t))!==r)return t}var IP=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Q1(t){if(t===void 0)return"plot-d6a7b5";if(t=`${t}`,!IP.test(t))throw Error(`invalid class name: ${t}`);return t}function N1(t,r){if(typeof r==="string")t.property("style",r);else if(r!=null)for(let f of t)Object.assign(f.style,r)}function F0({frameAnchor:t},{width:r,height:f,marginTop:u,marginRight:h,marginBottom:g,marginLeft:x}){return[/left$/.test(t)?x:/right$/.test(t)?r-h:(x+r-h)/2,/^top/.test(t)?u:/^bottom/.test(t)?f-g:(u+f-g)/2]}class Et{constructor(t,r={},f={},u){let{facet:h="auto",facetAnchor:g,fx:x,fy:b,sort:c,dx:l=0,dy:d=0,margin:_=0,marginTop:w=_,marginRight:M=_,marginBottom:i=_,marginLeft:H=_,className:q,clip:s=u?.clip,channels:E,tip:P,render:n}=f;if(this.data=t,this.sort=ef(c)?c:null,this.initializer=ff(f).initializer,this.transform=this.initializer?f.transform:wu(f).transform,h===null||h===!1)this.facet=null;else this.facet=lr(h===!0?"include":h,"facet",["auto","include","exclude","super"]),this.fx=t===b1&&typeof x==="string"?[x]:x,this.fy=t===b1&&typeof b==="string"?[b]:b;if(this.facetAnchor=u_(g),r=$x(r),E!==void 0)r={...vP(E),...r};if(u!==void 0)r={...i_(this,f,u),...r};if(this.channels=Object.fromEntries(Object.entries(r).map(([$,J])=>{if(d1(J.value)){let{value:Q,label:U=J.label,scale:e=J.scale}=J.value;J={...J,label:U,scale:e,value:Q}}if(t===b1&&typeof J.value==="string"){let{value:Q}=J;J={...J,value:[Q]}}return[$,J]}).filter(([$,{value:J,optional:Q}])=>{if(J!=null)return!0;if(Q)return!1;throw Error(`missing channel value: ${$}`)})),this.dx=+l,this.dy=+d,this.marginTop=+w,this.marginRight=+M,this.marginBottom=+i,this.marginLeft=+H,this.clip=m7(s),this.tip=XP(P),this.className=Zt(q),this.facet==="super"){if(x||b)throw Error("super-faceting cannot use fx or fy");for(let $ in this.channels){let{scale:J}=r[$];if(J!=="x"&&J!=="y")continue;throw Error("super-faceting cannot use x or y")}}if(n!=null)this.render=tb(n,this.render)}initialize(t,r,f){let u=rf(this.data);if(t===void 0&&u!=null)t=[_r(u)];let h=t;if(this.transform!=null)({facets:t,data:u}=this.transform(u,t,f)),u=rf(u);if(t!==void 0)t.original=h;let g=gl(this.channels,u);if(this.sort!=null)bl(u,t,g,r,this.sort);return{data:u,facets:t,channels:g}}filter(t,r,f){for(let u in r){let{filter:h=Rr}=r[u];if(h!==null){let g=f[u];t=t.filter((x)=>h(g[x]))}}return t}project(t,r,f){for(let u in t)if(t[u].scale==="x"&&/^x|x$/.test(u)){let h=u.replace(/^x|x$/,"y");if(h in t&&t[h].scale==="y")b_(u,h,r,f.projection)}}scale(t,r,f){let u=xl(t,r);if(f.projection)this.project(t,u,f);return u}}function px(...t){return t.plot=Et.prototype.plot,t}function tb(t,r){if(t==null)return r===null?void 0:r;if(r==null)return t===null?void 0:t;if(typeof t!=="function")throw TypeError(`invalid render transform: ${t}`);if(typeof r!=="function")throw TypeError(`invalid render transform: ${r}`);return function(f,u,h,g,x,b){return t.call(this,f,u,h,g,x,(c,l,d,_,w)=>{return r.call(this,c,l,d,_,w,b)})}}function vP(t){return Object.fromEntries(Object.entries($x(t)).map(([r,f])=>{if(f=typeof f==="string"?{value:f,label:r}:o0(f),f.filter===void 0&&f.scale==null)f={...f,filter:null};return[r,f]}))}function XP(t){return t===!0?"xy":t===!1||t==null?null:typeof t==="string"?lr(t,"tip",["x","y","xy"]):t}function of(t,r){return t?.tip===!0?{...t,tip:r}:jr(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:r}}:t}function E_(t,r,f={}){let u=0.5-tr,h=0.5+tr,g=0.5+tr,x=0.5-tr;for(let{marginTop:H,marginRight:q,marginBottom:s,marginLeft:E}of r){if(H>u)u=H;if(q>h)h=q;if(s>g)g=s;if(E>x)x=E}let{margin:b,marginTop:c=b!==void 0?b:u,marginRight:l=b!==void 0?b:h,marginBottom:d=b!==void 0?b:g,marginLeft:_=b!==void 0?b:x}=f;c=+c,l=+l,d=+d,_=+_;let{width:w=640,height:M=YP(t,f,{width:w,marginTopDefault:u,marginRightDefault:h,marginBottomDefault:g,marginLeftDefault:x})+Math.max(0,c-u+d-g)}=f;w=+w,M=+M;let i={width:w,height:M,marginTop:c,marginRight:l,marginBottom:d,marginLeft:_};if(t.fx||t.fy){let{margin:H,marginTop:q=H!==void 0?H:c,marginRight:s=H!==void 0?H:l,marginBottom:E=H!==void 0?H:d,marginLeft:P=H!==void 0?H:_}=f.facet??{};q=+q,s=+s,E=+E,P=+P,i.facet={marginTop:q,marginRight:s,marginBottom:E,marginLeft:P}}return i}function YP({x:t,y:r,fy:f,fx:u},{projection:h,aspectRatio:g},{width:x,marginTopDefault:b,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:d}){let _=f?f.scale.domain().length||1:1,w=d_(h);if(w){let i=u?u.scale.domain().length:1,H=(1.1*_-0.1)/(1.1*i-0.1)*w,q=Math.max(0.1,Math.min(10,H));return Math.round((x-d-c)*q+b+l)}let M=r?Z0(r)?r.scale.domain().length||1:Math.max(7,17/_):1;if(g!=null){if(g=+g,!(isFinite(g)&&g>0))throw Error(`invalid aspectRatio: ${g}`);let i=q_("y",r)/(q_("x",t)*g),H=u?u.scale.bandwidth():1,q=f?f.scale.bandwidth():1,s=H*(x-d-c)-t.insetLeft-t.insetRight;return(i*s+r.insetTop+r.insetBottom)/q+b+l}return!!(r||f)*Math.max(1,Math.min(60,M*_))*20+!!u*30+60}function q_(t,r){if(!r)throw Error(`aspectRatio requires ${t} scale`);let{type:f,domain:u}=r,h;switch(f){case"linear":case"utc":case"time":h=Number;break;case"pow":{let b=r.scale.exponent();h=(c)=>Math.pow(c,b);break}case"log":h=Math.log;break;case"point":case"band":return u.length;default:throw Error(`unsupported ${t} scale for aspectRatio: ${f}`)}let[g,x]=Rt(u);return Math.abs(h(x)-h(g))}var s_=new WeakMap;function rb(t,r,{x:f,y:u,px:h,py:g,maxRadius:x=40,channels:b,render:c,...l}={}){if(x=+x,h!=null)f??=null,b={...b,px:{value:h,scale:"x"}};if(g!=null)u??=null,b={...b,py:{value:g,scale:"y"}};return{x:f,y:u,channels:b,...l,render:tb(function(d,_,w,M,i,H){i={...i,pointerSticky:!1};let q=i.ownerSVGElement,{data:s}=i.getMarkState(this),E=s_.get(q);if(!E)s_.set(q,E={sticky:!1,roots:[],renders:[]});let P=E.renders.push(z)-1,{x:n,y:$,fx:J,fy:Q}=_,U=J?J(d.fx)-M.marginLeft:0,e=Q?Q(d.fy)-M.marginTop:0;if(n?.bandwidth)U+=n.bandwidth()/2;if($?.bandwidth)e+=$.bandwidth()/2;let o=d.fi!=null,K;if(o){let Y=E.facetStates;if(!Y)E.facetStates=Y=new Map;if(K=Y.get(this),!K)Y.set(this,K=new Map)}let[V,G]=F0(this,M),{px:B,py:N}=w,W=B?(Y)=>B[Y]:ub(w,V),p=N?(Y)=>N[Y]:hb(w,G),a,T,L,A;function X(Y,j){if(o){if(A)A=cancelAnimationFrame(A);if(Y==null)K.delete(d.fi);else{K.set(d.fi,j),A=requestAnimationFrame(()=>{A=null;for(let[Z,R]of K)if(R1)){let R=a==null?null:mr(s)?s[a]:s.get(a);i.dispatchValue(R)}return Z}function rt(Y){if(E.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[j,Z]=S8(Y);j-=U,Z-=e;let R=jM.width-M.marginRight?1:t,S=ZM.height-M.marginBottom?1:r,C=null,ut=x*x;for(let tt of d){let ct=R*(W(tt)-j),Jt=S*(p(tt)-Z),mt=ct*ct+Jt*Jt;if(mt<=ut)C=tt,ut=mt}if(C!=null&&(t!==1||r!==1)){let tt=W(C)-j,ct=p(C)-Z;ut=tt*tt+ct*ct}X(C,ut)}function m(Y){if(Y.pointerType!=="mouse")return;if(a==null)return;if(E.sticky&&E.roots.some((j)=>j?.contains(Y.target)))return;if(E.sticky)E.sticky=!1,E.renders.forEach((j)=>j(null));else E.sticky=!0,z(a);Y.stopImmediatePropagation()}function ht(Y){if(Y.pointerType!=="mouse")return;if(!E.sticky)X(null)}return q.addEventListener("pointerenter",rt),q.addEventListener("pointermove",rt),q.addEventListener("pointerdown",m),q.addEventListener("pointerleave",ht),z(null)},c)}}function P_(t){return rb(1,1,t)}function n_(t){return rb(1,0.01,t)}function fb(t){return rb(0.01,1,t)}function ub({x1:t,x2:r,x:f=t},u){return t&&r?(h)=>(t[h]+r[h])/2:f?(h)=>f[h]:()=>u}function hb({y1:t,y2:r,y:f=t},u){return t&&r?(h)=>(t[h]+r[h])/2:f?(h)=>f[h]:()=>u}function l4(t){return Z0(t)&&t.interval===void 0?void 0:"tabular-nums"}function $_(t,r){let{label:f=t.label,tickSize:u=6,width:h=240,height:g=44+u,marginTop:x=18,marginRight:b=0,marginBottom:c=16+u,marginLeft:l=0,style:d,ticks:_=(h-l-b)/64,tickFormat:w,fontVariant:M=l4(t),round:i=!0,opacity:H,className:q}=r,s=J1(r);if(q=Q1(q),H=Ct(H)[1],w===null)w=()=>null;let E=gt("svg",s).attr("class",`${q}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",h).attr("height",g).attr("viewBox",`0 0 ${h} ${g}`).call((V)=>V.append("style").text(`:where(.${q}-ramp) { +${f}`}function aE(t){return t==="time"?a7:t==="utc"?E8:jE}function n_(t,r,f){let u=ot(y8(r,(h,x)=>Math.abs(x-h)));if(u<1000)return A_("millisecond","utc",f);for(let[h,x,b,g]of aE(t)){if(u>g)break;if(h==="hour"&&!u)break;if(r.every((c)=>x.floor(c)>=c))return A_(h,b,f)}}function M1(t,r,f){return(u,h,x)=>{let b=t(u,h),g=r(u,h),c=h-uf(x);return h!==c&&x[c]!==void 0&&g===r(x[c],c)?b:f(b,g)}}var Qb=Object.getPrototypeOf(Uint8Array),yE=Object.prototype.toString;function pr(t){return t instanceof Array||t instanceof Qb}function Y_(t){return t instanceof Qb&&!kE(t)}function S_(t){return t?.prototype instanceof Qb&&!pE(t)}function kE(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}function pE(t){return t===BigInt64Array||t===BigUint64Array}var Ub=Symbol("reindex");function Ct(t,r,f){let u=typeof r;return u==="string"?gl(t)?Cb(t.getChild(r),f):X_(t,Kb(r),f):u==="function"?X_(t,r,f):u==="number"||r instanceof Date||u==="boolean"?qt(t,Nr(r),f):typeof r?.transform==="function"?Jb(r.transform(t),f):tJ(Jb(r,f),t?.[Ub])}function tJ(t,r){return t!=null&&r?p7(t,r):t}function X_(t,r,f){return qt(t,S_(f)?(u,h)=>Wb(r(u,h)):r,f)}function Jb(t,r){return r===void 0?G0(t):cl(t)?Cb(t,r):t instanceof r?t:r.from(t,S_(r)&&!Y_(t)?Wb:void 0)}function Cb(t,r){return t==null?t:(r===void 0||r===Array)&&hJ(t.type)?ib(v_(t)):Jb(v_(t),r)}function v_(t){return t.nullCount?t.toJSON():t.toArray()}var $1=[null],Kb=(t)=>(r)=>{let f=r[t];return f===void 0&&r.type==="Feature"?r.properties?.[t]:f},L0={transform:$r},$t={transform:(t)=>t};var o_=()=>1,m_=()=>!0,At=(t)=>t==null?t:`${t}`,Ot=(t)=>t==null?t:+t;var k7=(t)=>t?t[0]:void 0,Q8=(t)=>t?t[1]:void 0;var Nr=(t)=>()=>t;function j_(t){let r=+`${t}`.slice(1)/100;return(f,u)=>Gr(f,r,u)}function Hr(t){return Y_(t)?t:qt(t,Wb,Float64Array)}function Wb(t){return t==null?NaN:Number(t)}function ib(t){return qt(t,Zb)}function Zb(t){return t instanceof Date&&!isNaN(t)?t:typeof t==="string"?P8(t):t==null||isNaN(t=Number(t))?void 0:new Date(t)}function Jr(t,r){if(t===void 0)t=r;return t===null?[void 0,"none"]:C1(t)?[void 0,t]:[t,void 0]}function Bt(t,r){if(t===void 0)t=r;return t===null||typeof t==="number"?[void 0,t]:[t,void 0]}function Vb(t,r,f){if(t!=null)return qr(t,r,f)}function qr(t,r,f){let u=`${t}`.toLowerCase();if(!f.includes(u))throw Error(`invalid ${r}: ${t}`);return u}function hf(t){return gl(t)?t:G0(t)}function G0(t){if(t==null||pr(t))return t;if(cl(t))return Cb(t);if(e_(t))switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;default:return[t]}return Array.from(t)}function e_(t){switch(t?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function qt(t,r,f=Array){return t==null?t:t instanceof f?t.map(r):f.from(t,r)}function Nf(t,r=Array){return t instanceof r?t.slice():r.from(t)}function Nb({x:t,x1:r,x2:f}){return t!==void 0||r!==void 0||f!==void 0}function Tb({y:t,y1:r,y2:f}){return t!==void 0||r!==void 0||f!==void 0}function Fb(t){return Nb(t)||Tb(t)||t.interval!==void 0}function t0(t){return t?.toString===yE}function P1(t){return t0(t)&&(t.type!==void 0||t.domain!==void 0)}function E1(t){return t0(t)&&typeof t.transform!=="function"}function Tf(t){return E1(t)&&t.value===void 0&&t.channel===void 0}function Lb(t,r,f,u=$t){if(r===void 0&&f===void 0)r=0,f=t===void 0?u:t;else if(r===void 0)r=t===void 0?0:t;else if(f===void 0)f=t===void 0?0:t;return[r,f]}function r0(t,r){return t===void 0&&r===void 0?[k7,Q8]:[t,r]}function J1({z:t,fill:r,stroke:f}={}){if(t===void 0)[t]=Jr(r);if(t===void 0)[t]=Jr(f);return t}function Ff(t){return pr(t)?t.length:t?.numRows}function $r(t){let r=Ff(t),f=new Uint32Array(r);for(let u=0;ut[f],t.constructor):qt(r,(f)=>t.at(f))}function a_(t,r,f){return t.subarray?t.subarray(r,f):t.slice(r,f)}function Yr(t){return t!==null&&typeof t==="object"?t.valueOf():t}function y_(t,r){if(r[t]!==void 0)return r[t];switch(t){case"x1":case"x2":t="x";break;case"y1":case"y2":t="y";break}return r[t]}function Q1(t){let r;return[{transform:()=>r,label:f0(t)},(f)=>r=f]}function Sr(t){return t==null?[t]:Q1(t)}function f0(t,r){return typeof t==="string"?t:t&&t.label!==void 0?t.label:r}function U1(t,r){return{transform(f){let u=t.transform(f),h=r.transform(f);return Dt(u)||Dt(h)?qt(u,(x,b)=>new Date((+u[b]+ +h[b])/2)):qt(u,(x,b)=>(+u[b]+ +h[b])/2,Float64Array)},label:t.label}}function U8(t,r){let f=Gb(r?.interval,r?.type);return f?qt(t,f):t}function Gb(t,r){let f=t4(t,r);return f&&((u)=>vr(u)?f.floor(u):u)}function t4(t,r){if(t==null)return;if(typeof t==="number")return rJ(t);if(typeof t==="string")return(r==="time"?Pb:J8)(t);if(typeof t.floor!=="function")throw Error("invalid interval; missing floor method");if(typeof t.offset!=="function")throw Error("invalid interval; missing offset method");return t}function rJ(t){if(t=+t,0Math.floor(f*r)/r,offset:(f,u=1)=>(f*r+Math.floor(u))/r,range:(f,u)=>Yf(Math.ceil(f*r),u*r).map((h)=>h/r)}:{floor:(f)=>Math.floor(f/r)*r,offset:(f,u=1)=>f+r*Math.floor(u),range:(f,u)=>Yf(Math.ceil(f/r),u/r).map((h)=>h*r)}}function B0(t,r){if(t=t4(t,r),t&&typeof t.range!=="function")throw Error("invalid interval: missing range method");return t}function k_(t,r){if(t=B0(t,r),t&&typeof t.ceil!=="function")throw Error("invalid interval: missing ceil method");return t}function p_(t){return Lf(t)&&typeof t?.floor==="function"&&t.floor()instanceof Date}function Lf(t){return typeof t?.range==="function"}function z0(t){return t===void 0||E1(t)?t:{value:t}}function tl(t){return t==null?null:{transform:(r)=>Ct(r,t,Float64Array),label:f0(t)}}function Qr(t){return t&&typeof t[Symbol.iterator]==="function"}function r4(t){for(let r of t){if(r==null)continue;return typeof r!=="object"||r instanceof Date}}function Bb(t){for(let r of t){if(r==null)continue;let f=typeof r;return f==="string"||f==="boolean"}}function Dt(t){for(let r of t){if(r==null)continue;return r instanceof Date}}function rl(t){for(let r of t){if(r==null)continue;return typeof r==="string"&&isNaN(r)&&P8(r)}}function fl(t){for(let r of t){if(r==null)continue;if(typeof r!=="string")return!1;if(!r.trim())continue;return!isNaN(r)}}function ul(t){for(let r of t){if(r==null)continue;return typeof r==="number"}}function f4(t,r){let f;for(let u of t){if(u==null)continue;if(!r(u))return!1;f=!0}return f}var fJ=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function C1(t){if(typeof t!=="string")return!1;return t=t.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(t)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(t)||fJ.has(t)}function hl(t){return typeof t==="number"&&(0<=t&&t<=1||isNaN(t))}function yt(t){return t==null||Hu(t)}function Hu(t){return/^\s*none\s*$/i.test(t)}function xl(t){return/^\s*round\s*$/i.test(t)}function u4(t,r){return Vb(t,r,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Gf(t="middle"){return u4(t,"frameAnchor")}function bl(t={},...r){let f=t;for(let u of r)for(let h in u)if(f[h]===void 0){let x=u[h];if(f===t)f={...f,[h]:x};else f[h]=x}return f}function uJ(t){console.warn("named iterables are deprecated; please use an object instead");let r=new Set;return Object.fromEntries(Array.from(t,(f)=>{let{name:u}=f;if(u==null)throw Error("missing name");let h=`${u}`;if(h==="__proto__")throw Error(`illegal name: ${h}`);if(r.has(h))throw Error(`duplicate name: ${h}`);return r.add(h),[u,f]}))}function zb(t){return Qr(t)?uJ(t):t}function h4(t){if(t===!0)t="frame";else if(t===!1)t=null;else if(!e_(t)&&t!=null){if(t=qr(t,"clip",["frame","sphere"]),t==="sphere")t={type:"Sphere"}}return t}function gl(t){return t&&typeof t.getChild==="function"&&typeof t.toArray==="function"&&t.schema&&Array.isArray(t.schema.fields)}function cl(t){return t&&typeof t.toArray==="function"&&t.type}function hJ(t){return t&&(t.typeId===8||t.typeId===10)&&t.unit===1}var or=Symbol("position"),Tr=Symbol("color"),qu=Symbol("radius"),$u=Symbol("length"),Pu=Symbol("opacity"),K1=Symbol("symbol"),_l=Symbol("projection"),Pt=new Map([["x",or],["y",or],["fx",or],["fy",or],["r",qu],["color",Tr],["opacity",Pu],["symbol",K1],["length",$u],["projection",_l]]);function ll(t){return t===or||t===_l}function dl(t){return t===or||t===qu||t===$u||t===Pu}var xJ=Math.sqrt(3),bJ=2/xJ,gJ={draw(t,r){let f=Math.sqrt(r/Math.PI),u=f*bJ,h=u/2;t.moveTo(0,u),t.lineTo(f,h),t.lineTo(f,-h),t.lineTo(0,-u),t.lineTo(-f,-h),t.lineTo(-f,h),t.closePath()}},Rb=new Map([["asterisk",u8],["circle",rf],["cross",h8],["diamond",x8],["diamond2",b8],["hexagon",gJ],["plus",g8],["square",c8],["square2",_8],["star",l8],["times",_1],["triangle",d8],["triangle2",w8],["wye",M8]]);function Db(t){return t&&typeof t.draw==="function"}function wl(t){if(Db(t))return!0;if(typeof t!=="string")return!1;return Rb.has(t.toLowerCase())}function W1(t){if(t==null||Db(t))return t;let r=Rb.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid symbol: ${t}`)}function Ml(t){if(t==null||Db(t))return[void 0,t];if(typeof t==="string"){let r=Rb.get(`${t}`.toLowerCase());if(r)return[void 0,r]}return[t,void 0]}function Eu({filter:t,sort:r,reverse:f,transform:u,initializer:h,...x}={},b){if(u===void 0){if(t!=null)u=Hl(t);if(r!=null&&!Tf(r))u=Ab(u,sb(r));if(f)u=Ab(u,ql)}if(b!=null&&h!=null)throw Error("transforms cannot be applied after initializers");return{...x,...(r===null||Tf(r))&&{sort:r},transform:Ab(u,b)}}function xf({filter:t,sort:r,reverse:f,initializer:u,...h}={},x){if(u===void 0){if(t!=null)u=Hl(t);if(r!=null&&!Tf(r))u=Ob(u,sb(r));if(f)u=Ob(u,ql)}return{...h,...(r===null||Tf(r))&&{sort:r},initializer:Ob(u,x)}}function Ab(t,r){if(t==null)return r===null?void 0:r;if(r==null)return t===null?void 0:t;return function(f,u,h){return{data:f,facets:u}=t.call(this,f,u,h),r.call(this,hf(f),u,h)}}function Ob(t,r){if(t==null)return r===null?void 0:r;if(r==null)return t===null?void 0:t;return function(f,u,h,...x){let b,g,c,_,l,d;return{data:g=f,facets:c=u,channels:b}=t.call(this,f,u,h,...x),{data:l=g,facets:d=c,channels:_}=r.call(this,g,c,{...h,...b},...x),{data:l,facets:d,channels:{...b,..._}}}}function cJ(t,r){return(t.initializer!=null?xf:Eu)(t,r)}function Hl(t){return(r,f)=>{let u=Ct(r,t);return{data:r,facets:f.map((h)=>h.filter((x)=>u[x]))}}}function ql(t,r){return{data:t,facets:r.map((f)=>f.slice().reverse())}}function $l(t,{sort:r,...f}={}){return{...(E1(t)&&t.channel!==void 0?xf:cJ)(f,sb(t)),sort:Tf(r)?r:null}}function sb(t){return(typeof t==="function"&&t.length!==1?_J:lJ)(t)}function _J(t){return(r,f)=>{let u=pr(r)?(h,x)=>t(r[h],r[x]):(h,x)=>t(r.get(h),r.get(x));return{data:r,facets:f.map((h)=>h.slice().sort(u))}}}function lJ(t){let r,f;({channel:r,value:t,order:f}={...z0(t)});let u=r?.startsWith("-");if(u)r=r.slice(1);if(f===void 0)f=u?du:_r;if(typeof f!=="function")switch(`${f}`.toLowerCase()){case"ascending":f=_r;break;case"descending":f=du;break;default:throw Error(`invalid order: ${f}`)}return(h,x,b)=>{let g;if(r===void 0)g=Ct(h,t);else{if(b===void 0)throw Error("channel sort requires an initializer");if(g=b[r],!g)return{};g=g.value}let c=(_,l)=>f(g[_],g[l]);return{data:h,facets:x.map((_)=>_.slice().sort(c))}}}function K8(t,...r){for(let{name:f}of t)if(r.includes(f))return!0;return!1}function Jl(t,r,f=Ib){let u=Object.entries(t);if(r.title!=null&&t.title===void 0)u.push(["title",qJ]);if(r.href!=null&&t.href===void 0)u.push(["href",x4]);return u.filter(([,h])=>h!==void 0).map(([h,x])=>x===null?dJ(h):f(h,x,r))}function Ib(t,r,f,u=nb){let h;if(t0(r)&&"reduce"in r)h=r.scale,r=r.reduce;let x=u(t,r,f),[b,g]=Q1(x.label),c;return{name:t,output:h===void 0?b:{value:b,scale:h},initialize(_){x.initialize(_),c=g([])},scope(_,l){x.scope(_,l)},reduce(_,l){c.push(x.reduce(_,l))}}}function dJ(t){return{name:t,initialize(){},scope(){},reduce(){}}}function nb(t,r,f,u=W8){let h=y_(t,f),x=u(r,h),b,g;return{label:f0(x===C8?null:h,x.label),initialize(c){if(b=h===void 0?c:Ct(c,h),x.scope==="data")g=x.reduceIndex($r(c),b)},scope(c,_){if(x.scope===c)g=x.reduceIndex(_,b)},reduce(c,_){return x.scope==null?x.reduceIndex(c,b,_):x.reduceIndex(c,b,g,_)}}}function Xb(t,r){return r?_0(t,(f)=>r[f]):[[,t]]}function W8(t,r,f=wJ){if(t==null)return f(t);if(typeof t.reduceIndex==="function")return t;if(typeof t.reduce==="function"&&t0(t))return MJ(t);if(typeof t==="function")return HJ(t);if(/^p\d{2}$/i.test(t))return bf(j_(t));switch(`${t}`.toLowerCase()){case"first":return x4;case"last":return $J;case"identity":return vb;case"count":return C8;case"distinct":return PJ;case"sum":return r==null?C8:EJ;case"proportion":return El(r,"data");case"proportion-facet":return El(r,"facet");case"deviation":return bf(Nu);case"min":return bf(dr);case"min-index":return bf(o8);case"max":return bf(ot);case"max-index":return bf(S8);case"mean":return Pl(e8);case"median":return Pl(vf);case"variance":return bf(Vu);case"mode":return bf(a8)}return f(t)}function wJ(t){throw Error(`invalid reduce: ${t}`)}function Ql(t,r){for(let f in r){let u=r[f];if(u!==void 0&&!t.some((h)=>h.name===f))return u}}function Ul(t,r,f){if(r){let u=r.output.transform(),h=(x,b)=>_r(u[x],u[b]);t.forEach((x)=>x.sort(h))}if(f)t.forEach((u)=>u.reverse())}function MJ(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}function HJ(t){return{reduceIndex(r,f,u){return t(p7(f,r),u)}}}function bf(t){return{reduceIndex(r,f){return t(r,(u)=>f[u])}}}function Pl(t){return{reduceIndex(r,f){let u=t(r,(h)=>f[h]);return Dt(f)?new Date(u):u}}}var vb={reduceIndex(t,r){return p7(r,t)}},x4={reduceIndex(t,r){return r[t[0]]}},qJ={reduceIndex(t,r){let u=X0(mr(t,(x)=>x.length,(x)=>r[x]),Q8),h=u.slice(-5).reverse();if(h.length`${x} (${b.toLocaleString("en-US")})`).join(` +`)}},$J={reduceIndex(t,r){return r[t[t.length-1]]}},C8={label:"Frequency",reduceIndex(t){return t.length}},PJ={label:"Distinct",reduceIndex(t,r){let f=new c0;for(let u of t)f.add(r[u]);return f.size}},EJ=bf(Cr);function El(t,r){return t==null?{scope:r,label:"Frequency",reduceIndex:(f,u,h=1)=>f.length/h}:{scope:r,reduceIndex:(f,u,h=1)=>Cr(f,(x)=>u[x])/h}}var Cl={reduceIndex(t,r,{z:f}){return f}};function i1(t,{scale:r,type:f,value:u,filter:h,hint:x,label:b=f0(u)},g){if(x===void 0&&typeof u?.transform==="function")x=u.hint;return Sb(g,{scale:r,type:f,value:Ct(t,u),label:b,filter:h,hint:x})}function Wl(t,r){return Object.fromEntries(Object.entries(t).map(([f,u])=>[f,i1(r,u,f)]))}function il(t,r){let f=Object.fromEntries(Object.entries(t).map(([u,{scale:h,value:x}])=>{let b=h==null?null:r[h];return[u,b==null?x:qt(x,b)]}));return f.channels=t,f}function Sb(t,r){let{scale:f,value:u}=r;if(f===!0||f==="auto")switch(t){case"fill":case"stroke":case"color":r.scale=f!==!0&&f4(u,C1)?null:"color",r.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":r.scale=f!==!0&&f4(u,hl)?null:"opacity",r.defaultScale="opacity";break;case"symbol":if(f!==!0&&f4(u,wl))r.scale=null,r.value=qt(u,W1);else r.scale="symbol";r.defaultScale="symbol";break;default:r.scale=Pt.has(t)?t:null;break}else if(f===!1)r.scale=null;else if(f!=null&&!Pt.has(f))throw Error(`unknown scale: ${f}`);return r}function Zl(t,r,f,u,h){let{order:x,reverse:b,reduce:g=!0,limit:c}=h;for(let _ in h){if(!Pt.has(_))continue;let{value:l,order:d=x,reverse:w=b,reduce:M=g,limit:H=c}=z0(h[_]),q=l?.startsWith("-");if(q)l=l.slice(1);if(d=d===void 0?q!==(l==="width"||l==="height")?Nl:Vl:UJ(d),M==null||M===!1)continue;let $=_==="fx"||_==="fy"?QJ(r,u[_]):JJ(f,_);if(!$)throw Error(`missing channel for scale: ${_}`);let E=$.value,[P=0,J=1/0]=Qr(H)?H:H<0?[H]:[0,H];if(l==null)$.domain=()=>{let Q=Array.from(new c0(E));if(w)Q=Q.reverse();if(P!==0||J!==1/0)Q=Q.slice(P,J);return Q};else{let Q=l==="data"?t:l==="height"?Kl(f,"y1","y2"):l==="width"?Kl(f,"x1","x2"):Yb(f,l,l==="y"?"y2":l==="x"?"x2":void 0),U=W8(M===!0?"max":M,Q);$.domain=()=>{let C=n4($r(E),(W)=>U.reduceIndex(W,Q),(W)=>E[W]);if(d)C.sort(d);if(w)C.reverse();if(P!==0||J!==1/0)C=C.slice(P,J);return C.map(k7)}}}}function JJ(t,r){for(let f in t){let u=t[f];if(u.scale===r)return u}}function QJ(t,r){let f=t.original;if(f===t)return r;let u=r.value,h=r.value=[];for(let x=0;xMath.abs(x-u[b]),Float64Array)}function Yb(t,r,f){let u=t[r];if(!u&&f!==void 0)u=t[f];if(u)return u.value;throw Error(`missing channel: ${r}`)}function UJ(t){if(t==null||typeof t==="function")return t;switch(`${t}`.toLowerCase()){case"ascending":return Vl;case"descending":return Nl}throw Error(`invalid order: ${t}`)}function Vl([t,r],[f,u]){return _r(r,u)||_r(t,f)}function Nl([t,r],[f,u]){return du(r,u)||_r(t,f)}function ob(t,r){let f=t[r];if(!f)return;while(f.source)f=f.source;return f.source===null?null:f}var Bl=new Map([["accent",Rx],["category10",zx],["dark2",Dx],["observable10",Ax],["paired",Ox],["pastel1",sx],["pastel2",Ix],["set1",nx],["set2",Xx],["set3",vx],["tableau10",Yx]]);function zl(t){return t!=null&&Bl.has(`${t}`.toLowerCase())}var Tl=new Map([...Bl,["brbg",gf(V5,N5)],["prgn",gf(T5,F5)],["piyg",gf(L5,G5)],["puor",gf(B5,z5)],["rdbu",gf(eh,h1)],["rdgy",gf(R5,D5)],["rdylbu",gf(ah,x1)],["rdylgn",gf(A5,O5)],["spectral",gf(s5,I5)],["burd",Fl(eh,h1)],["buylrd",Fl(ah,x1)],["blues",kt(d7,w7)],["greens",kt(M7,H7)],["greys",kt(q7,$7)],["oranges",kt(U7,C7)],["purples",kt(P7,E7)],["reds",kt(J7,Q7)],["turbo",cf(t8)],["viridis",cf(T7)],["magma",cf(F7)],["inferno",cf(L7)],["plasma",cf(G7)],["cividis",cf(yh)],["cubehelix",cf(K7)],["warm",cf(i7)],["cool",cf(Z7)],["bugn",kt(n5,X5)],["bupu",kt(v5,Y5)],["gnbu",kt(S5,o5)],["orrd",kt(m5,j5)],["pubu",kt(y5,k5)],["pubugn",kt(e5,a5)],["purd",kt(p5,t7)],["rdpu",kt(r7,f7)],["ylgn",kt(x7,b7)],["ylgnbu",kt(u7,h7)],["ylorbr",kt(g7,c7)],["ylorrd",kt(_7,l7)],["rainbow",Ll(kh)],["sinebow",Ll(ph)]]);function kt(t,r){return({length:f})=>{if(f===1)return[t[3][1]];if(f===2)return[t[3][1],t[3][2]];return f=Math.max(3,Math.floor(f)),f>9?tr(r,f):t[f]}}function gf(t,r){return({length:f})=>{if(f===2)return[t[3][0],t[3][2]];return f=Math.max(3,Math.floor(f)),f>11?tr(r,f):t[f]}}function Fl(t,r){return({length:f})=>{if(f===2)return[t[3][2],t[3][0]];return f=Math.max(3,Math.floor(f)),f>11?tr((u)=>r(1-u),f):t[f].slice().reverse()}}function cf(t){return({length:r})=>tr(t,Math.max(2,Math.floor(r)))}function Ll(t){return({length:r})=>tr(t,Math.floor(r)+1).slice(0,-1)}function mb(t){let r=`${t}`.toLowerCase();if(!Tl.has(r))throw Error(`unknown ordinal scheme: ${r}`);return Tl.get(r)}function i8(t,r){let f=mb(t),u=typeof f==="function"?f({length:r}):f;return u.length!==r?u.slice(0,r):u}function Rl(t,r="greys"){let f=new Set,[u,h]=i8(r,2);for(let x of t){if(x==null)continue;if(x===!0)f.add(h);else if(x===!1)f.add(u);else return}return[...f]}var Gl=new Map([["brbg",N5],["prgn",F5],["piyg",G5],["puor",z5],["rdbu",h1],["rdgy",D5],["rdylbu",x1],["rdylgn",O5],["spectral",I5],["burd",(t)=>h1(1-t)],["buylrd",(t)=>x1(1-t)],["blues",w7],["greens",H7],["greys",$7],["purples",E7],["reds",Q7],["oranges",C7],["turbo",t8],["viridis",T7],["magma",F7],["inferno",L7],["plasma",G7],["cividis",yh],["cubehelix",K7],["warm",i7],["cool",Z7],["bugn",X5],["bupu",Y5],["gnbu",o5],["orrd",j5],["pubugn",a5],["pubu",k5],["purd",t7],["rdpu",f7],["ylgnbu",h7],["ylgn",b7],["ylorbr",c7],["ylorrd",l7],["rainbow",kh],["sinebow",ph]]);function Z1(t){let r=`${t}`.toLowerCase();if(!Gl.has(r))throw Error(`unknown quantitative scheme: ${r}`);return Gl.get(r)}var CJ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function Dl(t){return t!=null&&CJ.has(`${t}`.toLowerCase())}var eb=(t)=>(r)=>t(1-r),jb=[0,1],Al=new Map([["number",Qt],["rgb",zr],["hsl",r2],["hcl",f2],["lab",M6]]);function ab(t){let r=`${t}`.toLowerCase();if(!Al.has(r))throw Error(`unknown interpolator: ${r}`);return Al.get(r)}function N1(t,r,f,{type:u,nice:h,clamp:x,zero:b,domain:g=ol(t,f),unknown:c,round:_,scheme:l,interval:d,range:w=Pt.get(t)===qu?ZJ(f,g):Pt.get(t)===$u?VJ(f,g):Pt.get(t)===Pu?jb:void 0,interpolate:M=Pt.get(t)===Tr?l==null&&w!==void 0?zr:Z1(l!==void 0?l:u==="cyclical"?"rainbow":"turbo"):_?Pf:Qt,reverse:H}){if(g=Ol(g),d=B0(d,u),u==="cyclical"||u==="sequential")u="linear";if(typeof M!=="function")M=ab(M);if(H=!!H,w!==void 0){let q=g.length,$=(w=Ol(w)).length;if(q!==$){if(M.length===1)throw Error("invalid piecewise interpolator");M=P0(M,w),w=void 0}}if(M.length===1){if(H)M=eb(M),H=!1;if(w===void 0){if(w=Float64Array.from(g,(q,$)=>$/(g.length-1)),w.length===2)w=jb}r.interpolate((w===jb?Nr:Z8)(M))}else r.interpolate(M);if(b){let[q,$]=nt(g);if(q>0||$<0)if(g=Nf(g),(uf(g)||1)===Math.sign(q))g[0]=0;else g[g.length-1]=0}if(H)g=wf(g);if(r.domain(g).unknown(c),h)r.nice(KJ(h,u)),g=r.domain();if(w!==void 0)r.range(w);if(x)r.clamp(x);return{type:u,domain:g,range:w,scale:r,interpolate:M,interval:d}}function Ol(t){return t=G0(t),t.length>=2?t:[t[0],t[0]]}function KJ(t,r){return t===!0?void 0:typeof t==="number"?t:k_(t,r)}function sl(t,r,f){return N1(t,xu(),r,f)}function Il(t,r,f){return yb(t,r,{...f,exponent:0.5})}function yb(t,r,{exponent:f=1,...u}){return N1(t,Oh().exponent(f),r,{...u,type:"pow"})}function nl(t,r,{base:f=10,domain:u=NJ(r),...h}){return N1(t,Dh().base(f),r,{...h,domain:u})}function Xl(t,r,{constant:f=1,...u}){return N1(t,Ah().constant(f),r,u)}function vl(t,r,{range:f,quantiles:u=f===void 0?5:(f=[...f]).length,n:h=u,scheme:x="rdylbu",domain:b=TJ(r),unknown:g,interpolate:c,reverse:_}){if(f===void 0)f=c!==void 0?tr(c,h):Pt.get(t)===Tr?i8(x,h):void 0;if(b.length>0)b=sh(b,f===void 0?{length:h}:f).quantiles();return b4(t,r,{domain:b,range:f,reverse:_,unknown:g})}function Yl(t,r,{range:f,n:u=f===void 0?5:(f=[...f]).length,scheme:h="rdylbu",domain:x=ol(t,r),unknown:b,interpolate:g,reverse:c}){let[_,l]=nt(x),d;if(f===void 0){if(d=jr(_,l,u),d[0]<=_)d.splice(0,1);if(d[d.length-1]>=l)d.pop();u=d.length+1,f=g!==void 0?tr(g,u):Pt.get(t)===Tr?i8(h,u):void 0}else if(d=tr(Qt(_,l),u+1).slice(1,-1),_ instanceof Date)d=d.map((w)=>new Date(w));if(uf(G0(x))<0)d.reverse();return b4(t,r,{domain:d,range:f,reverse:c,unknown:b})}function b4(t,r,{domain:f=[0],unknown:u,scheme:h="rdylbu",interpolate:x,range:b=x!==void 0?tr(x,f.length+1):Pt.get(t)===Tr?i8(h,f.length+1):void 0,reverse:g}){f=G0(f);let c=uf(f);if(!isNaN(c)&&!WJ(f,c))throw Error(`the ${t} scale has a non-monotonic domain`);if(g)b=wf(b);return{type:"threshold",scale:Ih(c<0?wf(f):f,b===void 0?[]:b).unknown(u),domain:f,range:b}}function WJ(t,r){for(let f=1,u=t.length,h=t[0];fr}}function V1(t,r=Mb){return t.length?[dr(t,({value:f})=>f===void 0?f:dr(f,r)),ot(t,({value:f})=>f===void 0?f:ot(f,r))]:[0,1]}function ol(t,r){let f=Pt.get(t);return(f===qu||f===Pu||f===$u?iJ:V1)(r)}function iJ(t){return[0,t.length?ot(t,({value:r})=>r===void 0?r:ot(r,Mb)):1]}function ZJ(t,r){let f=t.find(({radius:b})=>b!==void 0);if(f!==void 0)return[0,f.radius];let u=Gr(t,0.5,({value:b})=>b===void 0?NaN:Gr(b,0.25,wu)),h=r.map((b)=>3*Math.sqrt(b/u)),x=30/ot(h);return x<1?h.map((b)=>b*x):h}function VJ(t,r){let f=vf(t,({value:x})=>x===void 0?NaN:vf(x,Math.abs)),u=r.map((x)=>12*x/f),h=60/ot(u);return h<1?u.map((x)=>x*h):u}function NJ(t){for(let{value:r}of t)if(r!==void 0)for(let f of r){if(f>0)return V1(t,wu);if(f<0)return V1(t,w1)}return[1,10]}function TJ(t){let r=[];for(let{value:f}of t){if(f===void 0)continue;for(let u of f)r.push(u)}return r}function Z8(t){return(r,f)=>(u)=>t(r+u*(f-r))}var kb=0,pb;function ml(){let t=kb;return kb=0,pb=void 0,t}function Ur(t){if(t===pb)return;pb=t,console.warn(t),++kb}function g4(t,r,f,u,{type:h,nice:x,clamp:b,domain:g=V1(u),unknown:c,pivot:_=0,scheme:l,range:d,symmetric:w=!0,interpolate:M=Pt.get(t)===Tr?l==null&&d!==void 0?zr:Z1(l!==void 0?l:"rdbu"):Qt,reverse:H}){_=+_,g=G0(g);let[q,$]=g;if(g.length>2)Ur(`Warning: the diverging ${t} scale domain contains extra elements.`);if(Fr(q,$)<0)[q,$]=[$,q],H=!H;if(q=Math.min(q,_),$=Math.max($,_),typeof M!=="function")M=ab(M);if(d!==void 0)M=M.length===1?Z8(M)(...d):P0(M,d);if(H)M=eb(M);if(w){let E=f.apply(_),P=E-f.apply(q),J=f.apply($)-E;if(PJ)$=f.invert(E+P)}if(r.domain([q,_,$]).unknown(c).interpolator(M),b)r.clamp(b);if(x)r.nice(x);return{type:h,domain:[q,$],pivot:_,interpolate:M,scale:r}}function jl(t,r,f){return g4(t,jh(),FJ,r,f)}function el(t,r,f){return tg(t,r,{...f,exponent:0.5})}function tg(t,r,{exponent:f=1,...u}){return g4(t,Z5().exponent(f=+f),BJ(f),r,{...u,type:"diverging-pow"})}function al(t,r,{base:f=10,pivot:u=1,domain:h=V1(r,u<0?w1:wu),...x}){return g4(t,W5().base(f=+f),LJ,r,{domain:h,pivot:u,...x})}function yl(t,r,{constant:f=1,...u}){return g4(t,i5().constant(f=+f),zJ(f),r,u)}var FJ={apply(t){return t},invert(t){return t}},LJ={apply:Math.log,invert:Math.exp},GJ={apply(t){return Math.sign(t)*Math.sqrt(Math.abs(t))},invert(t){return Math.sign(t)*(t*t)}};function BJ(t){return t===0.5?GJ:{apply(r){return Math.sign(r)*Math.pow(Math.abs(r),t)},invert(r){return Math.sign(r)*Math.pow(Math.abs(r),1/t)}}}function zJ(t){return{apply(r){return Math.sign(r)*Math.log1p(Math.abs(r/t))},invert(r){return Math.sign(r)*Math.expm1(Math.abs(r))*t}}}function kl(t,r,f,u){return N1(t,r,f,u)}function pl(t,r,f){return kl(t,U5(),r,f)}function td(t,r,f){return kl(t,C5(),r,f)}var T1=Symbol("ordinal");function fd(t,r,f,{type:u,interval:h,domain:x,range:b,reverse:g,hint:c}){if(h=B0(h,u),x===void 0)x=gd(f,h,t);if(u==="categorical"||u===T1)u="ordinal";if(g)x=wf(x);if(x=r.domain(x).domain(),b!==void 0){if(typeof b==="function")b=b(x);r.range(b)}return{type:u,domain:x,range:b,scale:r,hint:c,interval:h}}function ud(t,r,{type:f,interval:u,domain:h,range:x,scheme:b,unknown:g,...c}){if(u=B0(u,f),h===void 0)h=gd(r,u,t);let _;if(Pt.get(t)===K1)_=RJ(r),x=x===void 0?DJ(_):qt(x,W1);else if(Pt.get(t)===Tr){if(x===void 0&&(f==="ordinal"||f===T1)){if(x=Rl(h,b),x!==void 0)b=void 0}if(b===void 0&&x===void 0)b=f==="ordinal"?"turbo":"observable10";if(b!==void 0)if(x!==void 0){let l=Z1(b),d=x[0],w=x[1]-x[0];x=({length:M})=>tr((H)=>l(d+w*H),M)}else x=mb(b)}if(g===Gh)throw Error(`implicit unknown on ${t} scale is not supported`);return fd(t,uu().unknown(g),r,{...c,type:f,domain:h,range:x,hint:_})}function hd(t,r,{align:f=0.5,padding:u=0.5,...h}){return bd(Px().align(f).padding(u),r,h,t)}function xd(t,r,{align:f=0.5,padding:u=0.1,paddingInner:h=u,paddingOuter:x=t==="fx"||t==="fy"?0:u,...b}){return bd(Jf().align(f).paddingInner(h).paddingOuter(x),r,b,t)}function bd(t,r,f,u){let{round:h}=f;if(h!==void 0)t.round(h=!!h);return t=fd(u,t,r,f),t.round=h,t}function gd(t,r,f){let u=new c0;for(let{value:h,domain:x}of t){if(x!==void 0)return x();if(h===void 0)continue;for(let b of h)u.add(b)}if(r!==void 0){let[h,x]=nt(u).map(r.floor,r);return r.range(h,r.offset(x))}if(u.size>1e4&&Pt.get(f)===or)throw Error(`implicit ordinal domain of ${f} scale has more than 10,000 values`);return X0(u,_r)}function rd(t,r){let f;for(let{hint:u}of t){let h=u?.[r];if(h===void 0)continue;if(f===void 0)f=h;else if(f!==h)return}return f}function RJ(t){return{fill:rd(t,"fill"),stroke:rd(t,"stroke")}}function DJ(t){return yt(t.fill)?kx:A7}function V8(t,{label:r,inset:f=0,insetTop:u=f,insetRight:h=f,insetBottom:x=f,insetLeft:b=f,round:g,nice:c,clamp:_,zero:l,align:d,padding:w,projection:M,facet:{label:H=r}={},...q}={}){let $={};for(let[E,P]of t){let J=q[E],Q=sJ(E,P,{round:Pt.get(E)===or?g:void 0,nice:c,clamp:_,zero:l,align:d,padding:w,projection:M,...J});if(Q){let{label:U=E==="fx"||E==="fy"?H:r,percent:C,transform:W,inset:i,insetTop:Z=i!==void 0?i:E==="y"?u:0,insetRight:R=i!==void 0?i:E==="x"?h:0,insetBottom:z=i!==void 0?i:E==="y"?x:0,insetLeft:G=i!==void 0?i:E==="x"?b:0}=J||{};if(W==null)W=void 0;else if(typeof W!=="function")throw Error("invalid scale transform; not a function");if(Q.percent=!!C,Q.label=U===void 0?AJ(P,Q):U,Q.transform=W,E==="x"||E==="fx")Q.insetLeft=+G,Q.insetRight=+R;else if(E==="y"||E==="fy")Q.insetTop=+Z,Q.insetBottom=+z;$[E]=Q}}return $}function fg(t){let r={},f={scales:r};for(let[u,h]of Object.entries(t)){let{scale:x,type:b,interval:g,label:c}=h;if(r[u]=vJ(h),f[u]=x,x.type=b,g!=null)x.interval=g;if(c!=null)x.label=c}return f}function wd(t,r){let{x:f,y:u,fx:h,fy:x}=t,b=h||x?_4(r):r;if(h)cd(h,b);if(x)_d(x,b);let g=h||x?ug(t,r):r;if(f)cd(f,g);if(u)_d(u,g)}function AJ(t=[],r){let f;for(let{label:u}of t){if(u===void 0)continue;if(f===void 0)f=u;else if(f!==u)return}if(f===void 0)return;if(!R0(r)&&r.percent)f=`${f} (%)`;return{inferred:!0,toString:()=>f}}function Md(t){return Math.sign(uf(t.domain()))*Math.sign(uf(t.range()))}function _4(t){let{marginTop:r,marginRight:f,marginBottom:u,marginLeft:h,width:x,height:b,facet:{marginTop:g,marginRight:c,marginBottom:_,marginLeft:l}}=t;return{marginTop:Math.max(r,g),marginRight:Math.max(f,c),marginBottom:Math.max(u,_),marginLeft:Math.max(h,l),width:x,height:b}}function ug({fx:t,fy:r},f){let{marginTop:u,marginRight:h,marginBottom:x,marginLeft:b,width:g,height:c}=_4(f);return{marginTop:u,marginRight:h,marginBottom:x,marginLeft:b,width:t?t.scale.bandwidth()+b+h:g,height:r?r.scale.bandwidth()+u+x:c,facet:{width:g,height:c}}}function cd(t,r){if(t.range===void 0){let{insetLeft:f,insetRight:u}=t,{width:h,marginLeft:x=0,marginRight:b=0}=r,g=x+f,c=h-b-u;if(t.range=[g,Math.max(g,c)],!R0(t))t.range=qd(t);t.scale.range(t.range)}Hd(t)}function _d(t,r){if(t.range===void 0){let{insetTop:f,insetBottom:u}=t,{height:h,marginTop:x=0,marginBottom:b=0}=r,g=x+f,c=h-b-u;if(t.range=[Math.max(g,c),g],!R0(t))t.range=qd(t);else t.range.reverse();t.scale.range(t.range)}Hd(t)}function Hd(t){if(t.round===void 0&&nJ(t)&&OJ(t)<=30)t.scale.round(!0)}function OJ({scale:t}){let r=t.domain().length,[f,u]=t.range(),h=t.paddingInner?t.paddingInner():1,x=t.paddingOuter?t.paddingOuter():t.padding(),b=r-h,g=Math.abs(u-f)/Math.max(1,b+x*2);return(g-Math.floor(g))*b}function qd(t){let r=t.scale.domain().length+hg(t);if(!(r>2))return t.range;let[f,u]=t.range;return Array.from({length:r},(h,x)=>f+x/(r-1)*(u-f))}function sJ(t,r=[],f={}){let u=IJ(t,r,f);if(f.type===void 0&&f.domain===void 0&&f.range===void 0&&f.interval==null&&t!=="fx"&&t!=="fy"&&R0({type:u})){let h=r.map(({value:x})=>x).filter((x)=>x!==void 0);if(h.some(Dt))Ur(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${F1(u)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${t} scale to "${F1(u)}".`);else if(h.some(rl))Ur(`Warning: some data associated with the ${t} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${F1(u)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${t} scale to "${F1(u)}".`);else if(h.some(fl))Ur(`Warning: some data associated with the ${t} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${F1(u)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${t} scale to "${F1(u)}".`)}switch(f.type=u,u){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":f=c4(r,f,Hr);break;case"identity":switch(Pt.get(t)){case or:f=c4(r,f,Hr);break;case K1:f=c4(r,f,XJ);break}break;case"utc":case"time":f=c4(r,f,ib);break}switch(u){case"diverging":return jl(t,r,f);case"diverging-sqrt":return el(t,r,f);case"diverging-pow":return tg(t,r,f);case"diverging-log":return al(t,r,f);case"diverging-symlog":return yl(t,r,f);case"categorical":case"ordinal":case T1:return ud(t,r,f);case"cyclical":case"sequential":case"linear":return sl(t,r,f);case"sqrt":return Il(t,r,f);case"threshold":return b4(t,r,f);case"quantile":return vl(t,r,f);case"quantize":return Yl(t,r,f);case"pow":return yb(t,r,f);case"log":return nl(t,r,f);case"symlog":return Xl(t,r,f);case"utc":return td(t,r,f);case"time":return pl(t,r,f);case"point":return hd(t,r,f);case"band":return xd(t,r,f);case"identity":return Sl(t);case void 0:return;default:throw Error(`unknown scale type: ${u}`)}}function F1(t){return typeof t==="symbol"?t.description:t}function ld(t){return typeof t==="string"?`${t}`.toLowerCase():t}var dd={toString:()=>"projection"};function IJ(t,r,{type:f,domain:u,range:h,scheme:x,pivot:b,projection:g}){if(f=ld(f),t==="fx"||t==="fy")return"band";if((t==="x"||t==="y")&&g!=null)f=dd;for(let l of r){let d=ld(l.type);if(d===void 0)continue;else if(f===void 0)f=d;else if(f!==d)throw Error(`scale incompatible with channel: ${f} !== ${d}`)}if(f===dd)return;if(f!==void 0)return f;if(u===void 0&&!r.some(({value:l})=>l!==void 0))return;let c=Pt.get(t);if(c===qu)return"sqrt";if(c===Pu||c===$u)return"linear";if(c===K1)return"ordinal";let _=(u??h)?.length;if(_<2||_>2)return rg(c);if(u!==void 0){if(Bb(u))return rg(c);if(Dt(u))return"utc"}else{let l=r.map(({value:d})=>d).filter((d)=>d!==void 0);if(l.some(Bb))return rg(c);if(l.some(Dt))return"utc"}if(c===Tr){if(b!=null||Dl(x))return"diverging";if(zl(x))return"categorical"}return"linear"}function rg(t){switch(t){case or:return"point";case Tr:return T1;default:return"ordinal"}}function R0({type:t}){return t==="ordinal"||t==="point"||t==="band"||t===T1}function hg({type:t}){return t==="threshold"}function nJ({type:t}){return t==="point"||t==="band"}function u0(t){if(t===void 0)return!0;let r=t.domain(),f=t(r[0]);for(let u=1,h=r.length;u{if(!Pt.has(r=`${r}`))throw Error(`unknown scale: ${r}`);return t[r]}}function vJ({scale:t,type:r,domain:f,range:u,interpolate:h,interval:x,transform:b,percent:g,pivot:c}){if(r==="identity")return{type:"identity",apply:(l)=>l,invert:(l)=>l};let _=t.unknown?t.unknown():void 0;return{type:r,domain:Nf(f),...u!==void 0&&{range:Nf(u)},...b!==void 0&&{transform:b},...g&&{percent:g},..._!==void 0&&{unknown:_},...x!==void 0&&{interval:x},...h!==void 0&&{interpolate:h},...t.clamp&&{clamp:t.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...t.base&&{base:t.base()},...t.exponent&&{exponent:t.exponent()},...t.constant&&{constant:t.constant()},...t.align&&{align:t.align(),round:t.round()},...t.padding&&(t.paddingInner?{paddingInner:t.paddingInner(),paddingOuter:t.paddingOuter()}:{padding:t.padding()}),...t.bandwidth&&{bandwidth:t.bandwidth(),step:t.step()},apply:(l)=>t(l),...t.invert&&{invert:(l)=>t.invert(l)}}}function Ed(t,r){let{fx:f,fy:u}=V8(t,r),h=f?.scale.domain(),x=u?.scale.domain();return h&&x?n8(h,x).map(([b,g],c)=>({x:b,y:g,i:c})):h?h.map((b,g)=>({x:b,i:g})):x?x.map((b,g)=>({y:b,i:g})):void 0}function Jd(t,{x:r,y:f}){return r&&=_g(r),f&&=_g(f),t.filter(r&&f?(u)=>r.has(u.x)&&f.has(u.y):r?(u)=>r.has(u.x):(u)=>f.has(u.y)).sort(r&&f?(u,h)=>r.get(u.x)-r.get(h.x)||f.get(u.y)-f.get(h.y):r?(u,h)=>r.get(u.x)-r.get(h.x):(u,h)=>f.get(u.y)-f.get(h.y))}function d4(t,{fx:r,fy:f}){let u=$r(t),h=r?.value,x=f?.value;return r&&f?mr(u,(b)=>(b.fx=h[b[0]],b.fy=x[b[0]],b),(b)=>h[b],(b)=>x[b]):r?mr(u,(b)=>(b.fx=h[b[0]],b),(b)=>h[b]):mr(u,(b)=>(b.fy=x[b[0]],b),(b)=>x[b])}function Qd(t,r,{marginTop:f,marginLeft:u}){let h=t?({x:b})=>t(b)-u:()=>0,x=r?({y:b})=>r(b)-f:()=>0;return function(b){if(this.tagName==="svg")this.setAttribute("x",h(b)),this.setAttribute("y",x(b));else this.setAttribute("transform",`translate(${h(b)},${x(b)})`)}}function Ud(t){let r=[],f=new Uint32Array(Cr(t,(u)=>u.length));for(let u of t){let h=0;for(let x of t){if(u===x)continue;f.set(x,h),h+=x.length}r.push(f.slice(0,h))}return r}var YJ=new Map([["top",xg],["right",cg],["bottom",bg],["left",gg],["top-left",l4(xg,gg)],["top-right",l4(xg,cg)],["bottom-left",l4(bg,gg)],["bottom-right",l4(bg,cg)],["top-empty",oJ],["right-empty",eJ],["bottom-empty",mJ],["left-empty",jJ],["empty",aJ]]);function Cd(t){if(t==null)return null;let r=YJ.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid facet anchor: ${t}`)}var Pd=new WeakMap;function _g(t){let r=Pd.get(t);if(!r)Pd.set(t,r=new Pr(qt(t,(f,u)=>[f,u])));return r}function Bf(t,r){return _g(t).get(r)}function SJ(t,r,f){return r=Yr(r),f=Yr(f),t.find((u)=>Object.is(Yr(u.x),r)&&Object.is(Yr(u.y),f))}function w4(t,r,f){return SJ(t,r,f)?.empty}function xg(t,{y:r},{y:f}){return r?Bf(r,f)===0:!0}function bg(t,{y:r},{y:f}){return r?Bf(r,f)===r.length-1:!0}function gg(t,{x:r},{x:f}){return r?Bf(r,f)===0:!0}function cg(t,{x:r},{x:f}){return r?Bf(r,f)===r.length-1:!0}function oJ(t,{y:r},{x:f,y:u,empty:h}){if(h)return!1;if(!r)return;let x=Bf(r,u);if(x>0)return w4(t,f,r[x-1])}function mJ(t,{y:r},{x:f,y:u,empty:h}){if(h)return!1;if(!r)return;let x=Bf(r,u);if(x0)return w4(t,r[x-1],u)}function eJ(t,{x:r},{x:f,y:u,empty:h}){if(h)return!1;if(!r)return;let x=Bf(r,f);if(xu.get(h)?.get(x)??[]):r?t.map(({x:h})=>u.get(h)??[]):t.map(({y:h})=>u.get(h)??[])}var Kd=Math.PI,_f=2*Kd,lg=0.618;function Wd({projection:t,inset:r=0,insetTop:f=r,insetRight:u=r,insetBottom:h=r,insetLeft:x=r}={},b){if(t==null)return;if(typeof t.stream==="function")return t;let g,c,_="frame";if(t0(t)){let U;if({type:t,domain:c,inset:U,insetTop:f=U!==void 0?U:f,insetRight:u=U!==void 0?U:u,insetBottom:h=U!==void 0?U:h,insetLeft:x=U!==void 0?U:x,clip:_=_,...g}=t,t==null)return}if(typeof t!=="function")({type:t}=dg(t));let{width:l,height:d,marginLeft:w,marginRight:M,marginTop:H,marginBottom:q}=b,$=l-w-M-x-u,E=d-H-q-f-h;if(t=t?.({width:$,height:E,clip:_,...g}),t==null)return;_=yJ(_,w,H,l-M,d-q);let P=w+x,J=H+f,Q;if(c!=null){let[[U,C],[W,i]]=ru(t).bounds(c),Z=Math.min($/(W-U),E/(i-C));if(Z>0)P-=(Z*(U+W)-$)/2,J-=(Z*(C+i)-E)/2,Q=fu({point(R,z){this.stream.point(R*Z+P,z*Z+J)}});else Ur("Warning: the projection could not be fit to the specified domain; using the default scale.")}return Q??=P===0&&J===0?id():fu({point(U,C){this.stream.point(U+P,C+J)}}),{stream:(U)=>t.stream(Q.stream(_(U)))}}function dg(t){switch(`${t}`.toLowerCase()){case"albers-usa":return h0(a6,0.7463,0.4673);case"albers":return H4(ku,0.7463,0.4673);case"azimuthal-equal-area":return h0(k6,4,4);case"azimuthal-equidistant":return h0(p6,_f,_f);case"conic-conformal":return H4(f5,_f,_f);case"conic-equal-area":return H4(m0,6.1702,2.9781);case"conic-equidistant":return H4(h5,7.312,3.6282);case"equal-earth":return h0(b5,5.4133,2.6347);case"equirectangular":return h0(u5,_f,Kd);case"gnomonic":return h0(g5,3.4641,3.4641);case"identity":return{type:id};case"reflect-y":return{type:kJ};case"mercator":return h0(t5,_f,_f);case"orthographic":return h0(c5,2,2);case"stereographic":return h0(_5,2,2);case"transverse-mercator":return h0(l5,_f,_f);default:throw Error(`unknown projection type: ${t}`)}}function yJ(t,r,f,u,h){if(t===!1||t==null||typeof t==="number")return(x)=>x;if(t===!0)t="frame";switch(`${t}`.toLowerCase()){case"frame":return ou(r,f,u,h);default:throw Error(`unknown projection clip type: ${t}`)}}function h0(t,r,f){return{type:({width:u,height:h,rotate:x,precision:b=0.15,clip:g})=>{let c=t();if(b!=null)c.precision?.(b);if(x!=null)c.rotate?.(x);if(typeof g==="number")c.clipAngle?.(g);if(u!=null)c.scale(Math.min(u/r,h/f)),c.translate([u/2,h/2]);return c},aspectRatio:f/r}}function H4(t,r,f){let{type:u,aspectRatio:h}=h0(t,r,f);return{type:(x)=>{let{parallels:b,domain:g,width:c,height:_}=x,l=u(x);if(b!=null){if(l.parallels(b),g===void 0&&c!=null)l.fitSize([c,_],{type:"Sphere"})}return l},aspectRatio:h}}var id=Nr({stream:(t)=>t}),kJ=Nr(fu({point(t,r){this.stream.point(t,-r)}}));function Zd(t,r,f,u){let h=f[t],x=f[r],b=h.length,g=f[t]=new Float64Array(b).fill(NaN),c=f[r]=new Float64Array(b).fill(NaN),_,l=u.stream({point(d,w){g[_]=d,c[_]=w}});for(_=0;_5?5:c:lg}}if(t==null)return;if(typeof t!=="function"){let{aspectRatio:r}=dg(t);if(r)return r}return lg}function Td(t){let r=[],f=[],u={scale:"x",value:r},h={scale:"y",value:f},x={point(b,g){r.push(b),f.push(g)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let b of t.value)Or(b,x);return[u,h]}function Fd({x:t,y:r}){if(t||r)return t??=(f)=>f,r??=(f)=>f,fu({point(f,u){this.stream.point(t(f),r(u))}})}function L1(t={}){let{document:r=typeof window<"u"?window.document:void 0,clip:f}=t;return{document:r,clip:h4(f)}}function gt(t,{document:r}){return Kr(w0(t).call(r.documentElement))}var q4=Symbol("unset");function $4(t){return(t.length===1?pJ:tQ)(t)}function pJ(t){let r,f=q4;return(u)=>{if(!Object.is(f,u))f=u,r=t(u);return r}}function tQ(t){let r,f;return(...u)=>{if(f?.length!==u.length||f.some((h,x)=>!Object.is(h,u[x])))f=u,r=t(...u);return r}}var rQ=$4((t)=>{return new Intl.NumberFormat(t)}),LS=$4((t,r)=>{return new Intl.DateTimeFormat(t,{timeZone:"UTC",...r&&{month:r}})}),GS=$4((t,r)=>{return new Intl.DateTimeFormat(t,{timeZone:"UTC",...r&&{weekday:r}})});function fQ(t="en-US"){let r=rQ(t);return(f)=>f!=null&&!isNaN(f)?r.format(f):void 0}function uQ(t){return e7(t,"Invalid Date")}function hQ(t="en-US"){let r=fQ(t);return(f)=>(f instanceof Date?uQ:typeof f==="number"?r:At)(f)}var D0=hQ();var hr=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:0.5,xQ=0;function Gd(){return`plot-clip-${++xQ}`}function Bd(t,{title:r,href:f,ariaLabel:u,ariaDescription:h,ariaHidden:x,target:b,fill:g,fillOpacity:c,stroke:_,strokeWidth:l,strokeOpacity:d,strokeLinejoin:w,strokeLinecap:M,strokeMiterlimit:H,strokeDasharray:q,strokeDashoffset:$,opacity:E,mixBlendMode:P,imageFilter:J,paintOrder:Q,pointerEvents:U,shapeRendering:C,channels:W},{ariaLabel:i,fill:Z="currentColor",fillOpacity:R,stroke:z="none",strokeOpacity:G,strokeWidth:N,strokeLinecap:L,strokeLinejoin:K,strokeMiterlimit:V,paintOrder:y}){if(Z===null)g=null,c=null;if(z===null)_=null,d=null;if(yt(Z)){if(!yt(z)&&(!yt(g)||W?.fill))z="none"}else if(yt(z)&&(!yt(_)||W?.stroke))Z="none";let[I,A]=Jr(g,Z),[s,Y]=Bt(c,R),[m,X]=Jr(_,z),[ht,p]=Bt(d,G),[ct,a]=Bt(E);if(!Hu(X)){if(l===void 0)l=N;if(M===void 0)M=L;if(w===void 0)w=K;if(H===void 0&&!xl(w))H=V;if(!Hu(A)&&Q===void 0)Q=y}let[tt,D]=Bt(l);if(Z!==null)t.fill=zt(A,"currentColor"),t.fillOpacity=N8(Y,1);if(z!==null)t.stroke=zt(X,"none"),t.strokeWidth=N8(D,1),t.strokeOpacity=N8(p,1),t.strokeLinejoin=zt(w,"miter"),t.strokeLinecap=zt(M,"butt"),t.strokeMiterlimit=N8(H,4),t.strokeDasharray=zt(q,"none"),t.strokeDashoffset=zt($,"0");return t.target=At(b),t.ariaLabel=At(i),t.ariaDescription=At(h),t.ariaHidden=At(x),t.opacity=N8(a,1),t.mixBlendMode=zt(P,"normal"),t.imageFilter=zt(J,"none"),t.paintOrder=zt(Q,"normal"),t.pointerEvents=zt(U,"auto"),t.shapeRendering=zt(C,"auto"),{title:{value:r,optional:!0,filter:null},href:{value:f,optional:!0,filter:null},ariaLabel:{value:u,optional:!0,filter:null},fill:{value:I,scale:"auto",optional:!0},fillOpacity:{value:s,scale:"auto",optional:!0},stroke:{value:m,scale:"auto",optional:!0},strokeOpacity:{value:ht,scale:"auto",optional:!0},strokeWidth:{value:tt,optional:!0},opacity:{value:ct,scale:"auto",optional:!0}}}function bQ(t,r){if(r)t.filter((f)=>$8(r[f])).append("title").call(cQ,r)}function gQ(t,r){if(r)t.filter(([f])=>$8(r[f])).append("title").call(_Q,r)}function cQ(t,r){if(r)t.text((f)=>D0(r[f]))}function _Q(t,r){if(r)t.text(([f])=>D0(r[f]))}function Yt(t,{target:r,tip:f},{ariaLabel:u,title:h,fill:x,fillOpacity:b,stroke:g,strokeOpacity:c,strokeWidth:_,opacity:l,href:d}){if(u)rt(t,"aria-label",(w)=>u[w]);if(x)rt(t,"fill",(w)=>x[w]);if(b)rt(t,"fill-opacity",(w)=>b[w]);if(g)rt(t,"stroke",(w)=>g[w]);if(c)rt(t,"stroke-opacity",(w)=>c[w]);if(_)rt(t,"stroke-width",(w)=>_[w]);if(l)rt(t,"opacity",(w)=>l[w]);if(d)zd(t,(w)=>d[w],r);if(!f)bQ(t,h)}function P4(t,{target:r,tip:f},{ariaLabel:u,title:h,fill:x,fillOpacity:b,stroke:g,strokeOpacity:c,strokeWidth:_,opacity:l,href:d}){if(u)rt(t,"aria-label",([w])=>u[w]);if(x)rt(t,"fill",([w])=>x[w]);if(b)rt(t,"fill-opacity",([w])=>b[w]);if(g)rt(t,"stroke",([w])=>g[w]);if(c)rt(t,"stroke-opacity",([w])=>c[w]);if(_)rt(t,"stroke-width",([w])=>_[w]);if(l)rt(t,"opacity",([w])=>l[w]);if(d)zd(t,([w])=>d[w],r);if(!f)gQ(t,h)}function lQ({ariaLabel:t,title:r,fill:f,fillOpacity:u,stroke:h,strokeOpacity:x,strokeWidth:b,opacity:g,href:c},{tip:_}){return[t,_?void 0:r,f,u,h,x,b,g,c].filter((l)=>l!==void 0)}function dQ(t,r,f){let u=_0(t,(h)=>r[h]);if(f===void 0&&u.size>1+t.length>>1)Ur("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null.");return u.values()}function*E4(t,r,f,u){let{z:h}=f,{z:x}=u,b=lQ(u,f),g=[...r,...b];for(let c of x?dQ(t,x,h):[t]){let _,l;t:for(let d of c){for(let w of g)if(!vr(w[d])){if(l)l.push(-1);continue t}if(_===void 0){if(l)yield l;_=b.map((w)=>Yr(w[d])),l=[d];continue}l.push(d);for(let w=0;wYr(H[d])),l=[d];continue t}}if(l)yield l}}function wQ(t,r,f,u){let h,{clip:x=u.clip}=r;if(x==="frame")t=gt("svg:g",u).each(function(){this.appendChild(t.node()),t.node=()=>this}),h=HQ(u,f);else if(x)h=$Q(x,u);rt(t,"aria-label",r.ariaLabel),rt(t,"aria-description",r.ariaDescription),rt(t,"aria-hidden",r.ariaHidden),rt(t,"clip-path",h)}function MQ(t){let r=new WeakMap;return(f,u)=>{let h=r.get(f);if(!h){let x=Gd();Kr(f.ownerSVGElement).append("clipPath").attr("id",x).call(t,f,u),r.set(f,h=`url(#${x})`)}return h}}var HQ=MQ((t,r,f)=>{let{width:u,height:h,marginLeft:x,marginRight:b,marginTop:g,marginBottom:c}=f;t.append("rect").attr("x",x).attr("y",g).attr("width",u-b-x).attr("height",h-g-c)}),Ld=new WeakMap,qQ={type:"Sphere"};function $Q(t,r){let f,u;if(!(f=Ld.get(r)))Ld.set(r,f=new WeakMap);if(t.type==="Sphere")t=qQ;if(!(u=f.get(t))){let h=Gd();Kr(r.ownerSVGElement).append("clipPath").attr("id",h).append("path").attr("d",r.path()(t)),f.set(t,u=`url(#${h})`)}return u}function Tt(t,r,f,u){wQ(t,r,f,u),rt(t,"class",r.className),rt(t,"fill",r.fill),rt(t,"fill-opacity",r.fillOpacity),rt(t,"stroke",r.stroke),rt(t,"stroke-width",r.strokeWidth),rt(t,"stroke-opacity",r.strokeOpacity),rt(t,"stroke-linejoin",r.strokeLinejoin),rt(t,"stroke-linecap",r.strokeLinecap),rt(t,"stroke-miterlimit",r.strokeMiterlimit),rt(t,"stroke-dasharray",r.strokeDasharray),rt(t,"stroke-dashoffset",r.strokeDashoffset),rt(t,"shape-rendering",r.shapeRendering),rt(t,"filter",r.imageFilter),rt(t,"paint-order",r.paintOrder);let{pointerEvents:h=u.pointerSticky===!1?"none":void 0}=r;rt(t,"pointer-events",h)}function Kt(t,r){PQ(t,"mix-blend-mode",r.mixBlendMode),rt(t,"opacity",r.opacity)}function zd(t,r,f){t.each(function(u){let h=r(u);if(h!=null){let x=this.ownerDocument.createElementNS(l0.svg,"a");if(x.setAttribute("fill","inherit"),x.setAttributeNS(l0.xlink,"href",h),f!=null)x.setAttribute("target",f);this.parentNode.insertBefore(x,this).appendChild(this)}})}function rt(t,r,f){if(f!=null)t.attr(r,f)}function PQ(t,r,f){if(f!=null)t.style(r,f)}function Ft(t,r,{x:f,y:u},h=hr,x=hr){if(h+=r.dx,x+=r.dy,f?.bandwidth)h+=f.bandwidth()/2;if(u?.bandwidth)x+=u.bandwidth()/2;if(h||x)t.attr("transform",`translate(${h},${x})`)}function zt(t,r){if((t=At(t))!==r)return t}function N8(t,r){if((t=Ot(t))!==r)return t}var EQ=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function G1(t){if(t===void 0)return"plot-d6a7b5";if(t=`${t}`,!EQ.test(t))throw Error(`invalid class name: ${t}`);return t}function B1(t,r){if(typeof r==="string")t.property("style",r);else if(r!=null)for(let f of t)Object.assign(f.style,r)}function A0({frameAnchor:t},{width:r,height:f,marginTop:u,marginRight:h,marginBottom:x,marginLeft:b}){return[/left$/.test(t)?b:/right$/.test(t)?r-h:(b+r-h)/2,/^top/.test(t)?u:/^bottom/.test(t)?f-x:(u+f-x)/2]}class wt{constructor(t,r={},f={},u){let{facet:h="auto",facetAnchor:x,fx:b,fy:g,sort:c,dx:_=0,dy:l=0,margin:d=0,marginTop:w=d,marginRight:M=d,marginBottom:H=d,marginLeft:q=d,className:$,clip:E=u?.clip,channels:P,tip:J,render:Q}=f;if(this.data=t,this.sort=Tf(c)?c:null,this.initializer=xf(f).initializer,this.transform=this.initializer?f.transform:Eu(f).transform,h===null||h===!1)this.facet=null;else this.facet=qr(h===!0?"include":h,"facet",["auto","include","exclude","super"]),this.fx=t===$1&&typeof b==="string"?[b]:b,this.fy=t===$1&&typeof g==="string"?[g]:g;if(this.facetAnchor=Cd(x),r=zb(r),P!==void 0)r={...JQ(P),...r};if(u!==void 0)r={...Bd(this,f,u),...r};if(this.channels=Object.fromEntries(Object.entries(r).map(([U,C])=>{if(E1(C.value)){let{value:W,label:i=C.label,scale:Z=C.scale}=C.value;C={...C,label:i,scale:Z,value:W}}if(t===$1&&typeof C.value==="string"){let{value:W}=C;C={...C,value:[W]}}return[U,C]}).filter(([U,{value:C,optional:W}])=>{if(C!=null)return!0;if(W)return!1;throw Error(`missing channel value: ${U}`)})),this.dx=+_,this.dy=+l,this.marginTop=+w,this.marginRight=+M,this.marginBottom=+H,this.marginLeft=+q,this.clip=h4(E),this.tip=QQ(J),this.className=At($),this.facet==="super"){if(b||g)throw Error("super-faceting cannot use fx or fy");for(let U in this.channels){let{scale:C}=r[U];if(C!=="x"&&C!=="y")continue;throw Error("super-faceting cannot use x or y")}}if(Q!=null)this.render=Mg(Q,this.render)}initialize(t,r,f){let u=hf(this.data);if(t===void 0&&u!=null)t=[$r(u)];let h=t;if(this.transform!=null)({facets:t,data:u}=this.transform(u,t,f)),u=hf(u);if(t!==void 0)t.original=h;let x=Wl(this.channels,u);if(this.sort!=null)Zl(u,t,x,r,this.sort);return{data:u,facets:t,channels:x}}filter(t,r,f){for(let u in r){let{filter:h=vr}=r[u];if(h!==null){let x=f[u];t=t.filter((b)=>h(x[b]))}}return t}project(t,r,f){for(let u in t)if(t[u].scale==="x"&&/^x|x$/.test(u)){let h=u.replace(/^x|x$/,"y");if(h in t&&t[h].scale==="y")Zd(u,h,r,f.projection)}}scale(t,r,f){let u=il(t,r);if(f.projection)this.project(t,u,f);return u}}function wg(...t){return t.plot=wt.prototype.plot,t}function Mg(t,r){if(t==null)return r===null?void 0:r;if(r==null)return t===null?void 0:t;if(typeof t!=="function")throw TypeError(`invalid render transform: ${t}`);if(typeof r!=="function")throw TypeError(`invalid render transform: ${r}`);return function(f,u,h,x,b,g){return t.call(this,f,u,h,x,b,(c,_,l,d,w)=>{return r.call(this,c,_,l,d,w,g)})}}function JQ(t){return Object.fromEntries(Object.entries(zb(t)).map(([r,f])=>{if(f=typeof f==="string"?{value:f,label:r}:z0(f),f.filter===void 0&&f.scale==null)f={...f,filter:null};return[r,f]}))}function QQ(t){return t===!0?"xy":t===!1||t==null?null:typeof t==="string"?qr(t,"tip",["x","y","xy"]):t}function zf(t,r){return t?.tip===!0?{...t,tip:r}:t0(t?.tip)&&t.tip.pointer===void 0?{...t,tip:{...t.tip,pointer:r}}:t}function Dd(t,r,f={}){let u=0.5-hr,h=0.5+hr,x=0.5+hr,b=0.5-hr;for(let{marginTop:q,marginRight:$,marginBottom:E,marginLeft:P}of r){if(q>u)u=q;if($>h)h=$;if(E>x)x=E;if(P>b)b=P}let{margin:g,marginTop:c=g!==void 0?g:u,marginRight:_=g!==void 0?g:h,marginBottom:l=g!==void 0?g:x,marginLeft:d=g!==void 0?g:b}=f;c=+c,_=+_,l=+l,d=+d;let{width:w=640,height:M=UQ(t,f,{width:w,marginTopDefault:u,marginRightDefault:h,marginBottomDefault:x,marginLeftDefault:b})+Math.max(0,c-u+l-x)}=f;w=+w,M=+M;let H={width:w,height:M,marginTop:c,marginRight:_,marginBottom:l,marginLeft:d};if(t.fx||t.fy){let{margin:q,marginTop:$=q!==void 0?q:c,marginRight:E=q!==void 0?q:_,marginBottom:P=q!==void 0?q:l,marginLeft:J=q!==void 0?q:d}=f.facet??{};$=+$,E=+E,P=+P,J=+J,H.facet={marginTop:$,marginRight:E,marginBottom:P,marginLeft:J}}return H}function UQ({x:t,y:r,fy:f,fx:u},{projection:h,aspectRatio:x},{width:b,marginTopDefault:g,marginRightDefault:c,marginBottomDefault:_,marginLeftDefault:l}){let d=f?f.scale.domain().length||1:1,w=Nd(h);if(w){let H=u?u.scale.domain().length:1,q=(1.1*d-0.1)/(1.1*H-0.1)*w,$=Math.max(0.1,Math.min(10,q));return Math.round((b-l-c)*$+g+_)}let M=r?R0(r)?r.scale.domain().length||1:Math.max(7,17/d):1;if(x!=null){if(x=+x,!(isFinite(x)&&x>0))throw Error(`invalid aspectRatio: ${x}`);let H=Rd("y",r)/(Rd("x",t)*x),q=u?u.scale.bandwidth():1,$=f?f.scale.bandwidth():1,E=q*(b-l-c)-t.insetLeft-t.insetRight;return(H*E+r.insetTop+r.insetBottom)/$+g+_}return!!(r||f)*Math.max(1,Math.min(60,M*d))*20+!!u*30+60}function Rd(t,r){if(!r)throw Error(`aspectRatio requires ${t} scale`);let{type:f,domain:u}=r,h;switch(f){case"linear":case"utc":case"time":h=Number;break;case"pow":{let g=r.scale.exponent();h=(c)=>Math.pow(c,g);break}case"log":h=Math.log;break;case"point":case"band":return u.length;default:throw Error(`unsupported ${t} scale for aspectRatio: ${f}`)}let[x,b]=nt(u);return Math.abs(h(b)-h(x))}var Ad=new WeakMap;function Hg(t,r,{x:f,y:u,px:h,py:x,maxRadius:b=40,channels:g,render:c,..._}={}){if(b=+b,h!=null)f??=null,g={...g,px:{value:h,scale:"x"}};if(x!=null)u??=null,g={...g,py:{value:x,scale:"y"}};return{x:f,y:u,channels:g,..._,render:Mg(function(l,d,w,M,H,q){H={...H,pointerSticky:!1};let $=H.ownerSVGElement,{data:E}=H.getMarkState(this),P=Ad.get($);if(!P)Ad.set($,P={sticky:!1,roots:[],renders:[]});let J=P.renders.push(X)-1,{x:Q,y:U,fx:C,fy:W}=d,i=C?C(l.fx)-M.marginLeft:0,Z=W?W(l.fy)-M.marginTop:0;if(Q?.bandwidth)i+=Q.bandwidth()/2;if(U?.bandwidth)Z+=U.bandwidth()/2;let R=l.fi!=null,z;if(R){let a=P.facetStates;if(!a)P.facetStates=a=new Map;if(z=a.get(this),!z)a.set(this,z=new Map)}let[G,N]=A0(this,M),{px:L,py:K}=w,V=L?(a)=>L[a]:$g(w,G),y=K?(a)=>K[a]:Pg(w,N),I,A,s,Y;function m(a,tt){if(R){if(Y)Y=cancelAnimationFrame(Y);if(a==null)z.delete(l.fi);else{z.set(l.fi,tt),Y=requestAnimationFrame(()=>{Y=null;for(let[D,v]of z)if(v1)){let v=I==null?null:pr(E)?E[I]:E.get(I);H.dispatchValue(v)}return D}function ht(a){if(P.sticky||a.pointerType==="mouse"&&a.buttons===1)return;let[tt,D]=f6(a);tt-=i,D-=Z;let v=ttM.width-M.marginRight?1:t,k=DM.height-M.marginBottom?1:r,B=null,bt=b*b;for(let ut of l){let dt=v*(V(ut)-tt),Vt=k*(y(ut)-D),pt=dt*dt+Vt*Vt;if(pt<=bt)B=ut,bt=pt}if(B!=null&&(t!==1||r!==1)){let ut=V(B)-tt,dt=y(B)-D;bt=ut*ut+dt*dt}m(B,bt)}function p(a){if(a.pointerType!=="mouse")return;if(I==null)return;if(P.sticky&&P.roots.some((tt)=>tt?.contains(a.target)))return;if(P.sticky)P.sticky=!1,P.renders.forEach((tt)=>tt(null));else P.sticky=!0,X(I);a.stopImmediatePropagation()}function ct(a){if(a.pointerType!=="mouse")return;if(!P.sticky)m(null)}return $.addEventListener("pointerenter",ht),$.addEventListener("pointermove",ht),$.addEventListener("pointerdown",p),$.addEventListener("pointerleave",ct),X(null)},c)}}function Od(t){return Hg(1,1,t)}function sd(t){return Hg(1,0.01,t)}function qg(t){return Hg(0.01,1,t)}function $g({x1:t,x2:r,x:f=t},u){return t&&r?(h)=>(t[h]+r[h])/2:f?(h)=>f[h]:()=>u}function Pg({y1:t,y2:r,y:f=t},u){return t&&r?(h)=>(t[h]+r[h])/2:f?(h)=>f[h]:()=>u}function J4(t){return R0(t)&&t.interval===void 0?void 0:"tabular-nums"}function Id(t,r){let{label:f=t.label,tickSize:u=6,width:h=240,height:x=44+u,marginTop:b=18,marginRight:g=0,marginBottom:c=16+u,marginLeft:_=0,style:l,ticks:d=(h-_-g)/64,tickFormat:w,fontVariant:M=J4(t),round:H=!0,opacity:q,className:$}=r,E=L1(r);if($=G1($),q=Bt(q)[1],w===null)w=()=>null;let P=gt("svg",E).attr("class",`${$}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",h).attr("height",x).attr("viewBox",`0 0 ${h} ${x}`).call((G)=>G.append("style").text(`:where(.${$}-ramp) { display: block; height: auto; height: intrinsic; max-width: 100%; overflow: visible; } -:where(.${q}-ramp text) { +:where(.${$}-ramp text) { white-space: pre; -}`)).call(N1,d),P=(V)=>V.selectAll(".tick line").attr("y1",x+c-g),n,$=i?(V,G)=>V.rangeRound(G):(V,G)=>V.range(G),{type:J,domain:Q,range:U,interpolate:e,scale:o,pivot:K}=t;if(e){let V=U===void 0?e:M0(e.length===1?E8(e):e,U);n=$(o.copy(),jt(st(l,h-b),Math.min(Q.length+(K!==void 0),U===void 0?1/0:U.length)));let G=256,B=s.document.createElement("canvas");B.width=G,B.height=1;let N=B.getContext("2d");for(let W=0,p=G-1;WB:typeof w==="string"?or(w):w;n=$(pf().domain([-1,U.length-1]),[l,h-b]),E.append("g").attr("fill-opacity",H).selectAll().data(U).enter().append("rect").attr("x",(B,N)=>n(N-1)).attr("y",x).attr("width",(B,N)=>n(N)-n(N-1)).attr("height",g-x-c).attr("fill",(B)=>B),_=_t(V,(B,N)=>N),w=(B)=>G(V[B],B)}else n=$(Ef().domain(Q),[l,h-b]),E.append("g").attr("fill-opacity",H).selectAll().data(Q).enter().append("rect").attr("x",n).attr("y",x).attr("width",Math.max(0,n.bandwidth()-1)).attr("height",g-x-c).attr("fill",o),P=()=>{};if(E.append("g").attr("transform",`translate(0,${g-c})`).call(G4(n).ticks(Array.isArray(_)?null:_,typeof w==="string"?w:void 0).tickFormat(typeof w==="function"?w:void 0).tickSize(u).tickValues(Array.isArray(_)?_:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Kt(M,"normal")).call(P).call((V)=>V.select(".domain").remove()),f!==void 0)E.append("text").attr("x",l).attr("y",x-6).attr("fill","currentColor").attr("font-weight","bold").text(f);return E.node()}var gb=Math.PI/180;function n8(t,{marker:r,markerStart:f=r,markerMid:u=r,markerEnd:h=r}={}){t.markerStart=xb(f),t.markerMid=xb(u),t.markerEnd=xb(h)}function xb(t){if(t==null||t===!1)return null;if(t===!0)return Q_;if(typeof t==="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return J_("auto");case"arrow-reverse":return J_("auto-start-reverse");case"dot":return SP;case"circle":case"circle-fill":return Q_;case"circle-stroke":return aP;case"tick":return bb("auto");case"tick-x":return bb(90);case"tick-y":return bb(0)}throw Error(`invalid marker: ${t}`)}function J_(t){return(r,f)=>gt("svg:marker",f).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",t).attr("fill","none").attr("stroke",r).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call((u)=>u.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function SP(t,r){return gt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","none").call((f)=>f.append("circle").attr("r",2.5)).node()}function Q_(t,r){return gt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call((f)=>f.append("circle").attr("r",3)).node()}function aP(t,r){return gt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",t).attr("stroke-width",1.5).call((f)=>f.append("circle").attr("r",3)).node()}function bb(t){return(r,f)=>gt("svg:marker",f).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",t).attr("stroke",r).call((u)=>u.append("path").attr("d","M0,-3v6")).node()}var mP=0;function db(t,r,{stroke:f},u){return e_(t,r,f&&((h)=>f[h]),null,u)}function N_(t,r,{stroke:f,z:u},h){return e_(t,r,f&&(([g])=>f[g]),u,h)}var cb=1,U_=2;function jP(t,r){let f=new Uint8Array(r.length),u=t.data().filter((g)=>g.length>1),h=u.length;for(let g=0,x=x4;g1){let c=b[0];if(x!==(x=zr(r[c])))f[c]|=cb}}for(let g=h-1,x=x4;g>=0;--g){let b=u[g];if(b.length>1){let c=b[0];if(x!==(x=zr(r[c])))f[c]|=U_}}return([g])=>f[g]}function e_(t,{markerStart:r,markerMid:f,markerEnd:u,stroke:h},g=()=>h,x,b){if(!r&&!f&&!u)return;let c=new Map,l=x&&jP(t,x);function d(_,w,M){return function(i){if(M&&!M(i))return;let H=g(i),q=c.get(w);if(!q)c.set(w,q=new Map);let s=q.get(H);if(!s){let E=this.parentNode.insertBefore(w(H,b),this),P=`plot-marker-${++mP}`;E.setAttribute("id",P),q.set(H,s=`url(#${P})`)}this.setAttribute(_,s)}}if(r)t.each(d("marker-start",r,l&&((_)=>l(_)&cb)));if(f&&l)t.each(d("marker-start",f,(_)=>!(l(_)&cb)));if(f)t.each(d("marker-mid",f));if(u)t.each(d("marker-end",u,l&&((_)=>l(_)&U_)))}function U1({inset:t,insetLeft:r,insetRight:f,...u}={}){return[r,f]=C_(t,r,f),{inset:t,insetLeft:r,insetRight:f,...u}}function $8({inset:t,insetTop:r,insetBottom:f,...u}={}){return[r,f]=C_(t,r,f),{inset:t,insetTop:r,insetBottom:f,...u}}function C_(t,r,f){return t===void 0&&r===void 0&&f===void 0?tr?[1,0]:[0.5,0.5]:[r,f]}function K_(t,{interval:r}){return t={...o0(t)},t.interval=X7(t.interval===void 0?r:t.interval),t}function _4(t,r,f,u){let{[t]:h,[`${t}1`]:g,[`${t}2`]:x}=f,{value:b,interval:c}=K_(h,f);if(b==null||c==null&&!u)return f;let l=kr(h);if(c==null){let M,i={transform:(H)=>M||(M=nt(H,b)),label:l};return{...f,[t]:void 0,[`${t}1`]:g===void 0?i:g,[`${t}2`]:x===void 0&&!(g===x&&u)?i:x}}let d,_;function w(M){if(_!==void 0&&M===d)return _;return _=_t(nt(d=M,b),(i)=>c.floor(i))}return r({...f,[t]:void 0,[`${t}1`]:g===void 0?{transform:w,label:l}:g,[`${t}2`]:x===void 0?{transform:(M)=>w(M).map((i)=>c.offset(i)),label:l}:x})}function V_(t,r,f){let{[t]:u}=f,{value:h,interval:g}=K_(u,f);if(h==null||g==null)return f;return r({...f,[t]:{label:kr(u),transform:(x)=>{let b=_t(nt(x,h),(l)=>g.floor(l)),c=b.map((l)=>g.offset(l));return b.map(ot(b)?(l,d)=>l==null||isNaN(l=+l)||(d=c[d],d==null)||isNaN(d=+d)?void 0:new Date((l+d)/2):(l,d)=>l==null||(d=c[d],d==null)?NaN:(+l+ +d)/2)}}})}function W_(t={}){return _4("x",U1,t,!0)}function o_(t={}){return _4("y",$8,t,!0)}function w4(t={}){return _4("x",U1,t)}function lb(t={}){return _4("y",$8,t)}function Z_(t={}){return V_("x",U1,t)}function T_(t={}){return V_("y",$8,t)}var F_={ariaLabel:"rule",fill:null,stroke:"currentColor"};class _b extends Et{constructor(t,r={}){let{x:f,y1:u,y2:h,inset:g=0,insetTop:x=g,insetBottom:b=g}=r;super(t,{x:{value:f,scale:"x",optional:!0},y1:{value:u,scale:"y",optional:!0},y2:{value:h,scale:"y",optional:!0}},of(r,"x"),F_);this.insetTop=Tt(x),this.insetBottom=Tt(b),n8(this,r)}render(t,r,f,u,h){let{x:g,y:x}=r,{x:b,y1:c,y2:l}=f,{width:d,height:_,marginTop:w,marginRight:M,marginLeft:i,marginBottom:H}=u,{insetTop:q,insetBottom:s}=this;return gt("svg:g",h).call(Ft,this,u,h).call(Bt,this,{x:b&&g},tr,0).call((E)=>E.selectAll().data(t).enter().append("line").call(Nt,this).attr("x1",b?(P)=>b[P]:(i+d-M)/2).attr("x2",b?(P)=>b[P]:(i+d-M)/2).attr("y1",c&&!pr(x)?(P)=>c[P]+q:w+q).attr("y2",l&&!pr(x)?x.bandwidth?(P)=>l[P]+x.bandwidth()-s:(P)=>l[P]-s:_-H-s).call(rr,this,f).call(db,this,f,h)).node()}}class wb extends Et{constructor(t,r={}){let{x1:f,x2:u,y:h,inset:g=0,insetRight:x=g,insetLeft:b=g}=r;super(t,{y:{value:h,scale:"y",optional:!0},x1:{value:f,scale:"x",optional:!0},x2:{value:u,scale:"x",optional:!0}},of(r,"y"),F_);this.insetRight=Tt(x),this.insetLeft=Tt(b),n8(this,r)}render(t,r,f,u,h){let{x:g,y:x}=r,{y:b,x1:c,x2:l}=f,{width:d,height:_,marginTop:w,marginRight:M,marginLeft:i,marginBottom:H}=u,{insetLeft:q,insetRight:s}=this;return gt("svg:g",h).call(Ft,this,u,h).call(Bt,this,{y:b&&x},0,tr).call((E)=>E.selectAll().data(t).enter().append("line").call(Nt,this).attr("x1",c&&!pr(g)?(P)=>c[P]+q:i+q).attr("x2",l&&!pr(g)?g.bandwidth?(P)=>l[P]+g.bandwidth()-s:(P)=>l[P]-s:d-M-s).attr("y1",b?(P)=>b[P]:(w+_-H)/2).attr("y2",b?(P)=>b[P]:(w+_-H)/2).call(rr,this,f).call(db,this,f,h)).node()}}function r0(t,r){let{x:f=wt,y:u,y1:h,y2:g,...x}=lb(r);return[h,g]=B_(u,h,g),new _b(t,{...x,x:f,y1:h,y2:g})}function bf(t,r){let{y:f=wt,x:u,x1:h,x2:g,...x}=w4(r);return[h,g]=B_(u,h,g),new wb(t,{...x,y:f,x1:h,x2:g})}function B_(t,r,f){if(t==null){if(r===void 0){if(f!==void 0)return[0,f]}else if(f===void 0)return[0,r]}else if(r===void 0)return f===void 0?[0,t]:[t,f];else if(f===void 0)return[t,r];return[r,f]}function e1(t,...r){let f=r.length;for(let u=0,h=!0;u{let h=t[0];for(let g=0;g=0))throw Error(`invalid lineWidth: ${l}`);this.splitLines=sb(this),this.clipLine=Pb(this)}render(t,r,f,u,h){let{x:g,y:x}=r,{x:b,y:c,rotate:l,text:d,title:_,fontSize:w}=f,{rotate:M}=this,[i,H]=F0(this,u);return gt("svg:g",h).call(Ft,this,u,h).call(Eb,this,d,u).call(Bt,this,{x:b&&g,y:c&&x}).call((q)=>q.selectAll().data(t).enter().append("text").call(Nt,this).call(kP,this,d,_).attr("transform",e1`translate(${b?(s)=>b[s]:i},${c?(s)=>c[s]:H})${l?(s)=>` rotate(${l[s]})`:M?` rotate(${M})`:""}`).call(y,"font-size",w&&((s)=>w[s])).call(rr,this,f)).node()}}function ib(t){return t==null?null:lr(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function kP(t,r,f,u){if(!f)return;let{lineAnchor:h,lineHeight:g,textOverflow:x,splitLines:b,clipLine:c}=r;t.each(function(l){let d=b(T0(f[l])??"").map(c),_=d.length,w=h==="top"?0.71:h==="bottom"?1-_:(164-_*100)/200;if(_>1){let M=0;for(let i=0;i<_;++i){if(++M,!d[i])continue;let H=this.ownerDocument.createElementNS(x0.svg,"tspan");if(H.setAttribute("x",0),i===M-1)H.setAttribute("y",`${(w+i)*g}em`);else H.setAttribute("dy",`${M*g}em`);H.textContent=d[i],this.appendChild(H),M=0}}else{if(w)this.setAttribute("y",`${w*g}em`);this.textContent=d[0]}if(x&&!u&&d[0]!==f[l]){let M=this.ownerDocument.createElementNS(x0.svg,"title");M.textContent=f[l],this.appendChild(M)}})}function Vt(t,{x:r,y:f,...u}={}){if(u.frameAnchor===void 0)[r,f]=yr(r,f);return new J8(t,{...u,x:r,y:f})}function Hb(t,{x:r=wt,...f}={}){return new J8(t,T_({...f,x:r}))}function qb(t,{y:r=wt,...f}={}){return new J8(t,Z_({...f,y:r}))}function Eb(t,r,f){y(t,"text-anchor",r.textAnchor),y(t,"font-family",r.fontFamily),y(t,"font-size",r.fontSize),y(t,"font-style",r.fontStyle),y(t,"font-variant",r.fontVariant===void 0?pP(f):r.fontVariant),y(t,"font-weight",r.fontWeight)}function pP(t){return t&&(Rd(t)||ot(t))?"tabular-nums":void 0}var tn=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function rn(t){if(t==null||typeof t==="number")return[void 0,t];if(typeof t!=="string")return[t,void 0];return t=t.trim().toLowerCase(),tn.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0]}function fn(t,r,f){let u=[],h,g=0;for(let[x,b,c]of un(t)){if(h===void 0)h=x;if(g>h&&f(t,h,b)>r)u.push(t.slice(h,g)+(t[g-1]===A_?"-":"")),h=x;if(c){u.push(t.slice(h,b)),h=void 0;continue}g=b}return u}function*un(t){let r=0,f=0,u=t.length;while(fG.selectAll(".tick line").attr("y1",b+c-x),Q,U=H?(G,N)=>G.rangeRound(N):(G,N)=>G.range(N),{type:C,domain:W,range:i,interpolate:Z,scale:R,pivot:z}=t;if(Z){let G=i===void 0?Z:P0(Z.length===1?Z8(Z):Z,i);Q=U(R.copy(),tr(Qt(_,h-g),Math.min(W.length+(z!==void 0),i===void 0?1/0:i.length)));let N=256,L=E.document.createElement("canvas");L.width=N,L.height=1;let K=L.getContext("2d");for(let V=0,y=N-1;VL:typeof w==="string"?Dr(w):w;Q=U(xu().domain([-1,i.length-1]),[_,h-g]),P.append("g").attr("fill-opacity",q).selectAll().data(i).enter().append("rect").attr("x",(L,K)=>Q(K-1)).attr("y",b).attr("width",(L,K)=>Q(K)-Q(K-1)).attr("height",x-b-c).attr("fill",(L)=>L),d=qt(G,(L,K)=>K),w=(L)=>N(G[L],L)}else Q=U(Jf().domain(W),[_,h-g]),P.append("g").attr("fill-opacity",q).selectAll().data(W).enter().append("rect").attr("x",Q).attr("y",b).attr("width",Math.max(0,Q.bandwidth()-1)).attr("height",x-b-c).attr("fill",R),J=()=>{};if(P.append("g").attr("transform",`translate(0,${x-c})`).call(a4(Q).ticks(Array.isArray(d)?null:d,typeof w==="string"?w:void 0).tickFormat(typeof w==="function"?w:void 0).tickSize(u).tickValues(Array.isArray(d)?d:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",zt(M,"normal")).call(J).call((G)=>G.select(".domain").remove()),f!==void 0)P.append("text").attr("x",_).attr("y",b-6).attr("fill","currentColor").attr("font-weight","bold").text(f);return P.node()}var Eg=Math.PI/180;function Ju(t,{marker:r,markerStart:f=r,markerMid:u=r,markerEnd:h=r}={}){t.markerStart=Jg(f),t.markerMid=Jg(u),t.markerEnd=Jg(h)}function Jg(t){if(t==null||t===!1)return null;if(t===!0)return Xd;if(typeof t==="function")return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return nd("auto");case"arrow-reverse":return nd("auto-start-reverse");case"dot":return CQ;case"circle":case"circle-fill":return Xd;case"circle-stroke":return KQ;case"tick":return Qg("auto");case"tick-x":return Qg(90);case"tick-y":return Qg(0)}throw Error(`invalid marker: ${t}`)}function nd(t){return(r,f)=>gt("svg:marker",f).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",t).attr("fill","none").attr("stroke",r).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call((u)=>u.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function CQ(t,r){return gt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","none").call((f)=>f.append("circle").attr("r",2.5)).node()}function Xd(t,r){return gt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call((f)=>f.append("circle").attr("r",3)).node()}function KQ(t,r){return gt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",t).attr("stroke-width",1.5).call((f)=>f.append("circle").attr("r",3)).node()}function Qg(t){return(r,f)=>gt("svg:marker",f).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",t).attr("stroke",r).call((u)=>u.append("path").attr("d","M0,-3v6")).node()}var WQ=0;function T8(t,r,{stroke:f},u){return Sd(t,r,f&&((h)=>f[h]),null,u)}function vd(t,r,{stroke:f,z:u},h){return Sd(t,r,f&&(([x])=>f[x]),u,h)}var Ug=1,Yd=2;function iQ(t,r){let f=new Uint8Array(r.length),u=t.data().filter((x)=>x.length>1),h=u.length;for(let x=0,b=q4;x1){let c=g[0];if(b!==(b=Yr(r[c])))f[c]|=Ug}}for(let x=h-1,b=q4;x>=0;--x){let g=u[x];if(g.length>1){let c=g[0];if(b!==(b=Yr(r[c])))f[c]|=Yd}}return([x])=>f[x]}function Sd(t,{markerStart:r,markerMid:f,markerEnd:u,stroke:h},x=()=>h,b,g){if(!r&&!f&&!u)return;let c=new Map,_=b&&iQ(t,b);function l(d,w,M){return function(H){if(M&&!M(H))return;let q=x(H),$=c.get(w);if(!$)c.set(w,$=new Map);let E=$.get(q);if(!E){let P=this.parentNode.insertBefore(w(q,g),this),J=`plot-marker-${++WQ}`;P.setAttribute("id",J),$.set(q,E=`url(#${J})`)}this.setAttribute(d,E)}}if(r)t.each(l("marker-start",r,_&&((d)=>_(d)&Ug)));if(f&&_)t.each(l("marker-start",f,(d)=>!(_(d)&Ug)));if(f)t.each(l("marker-mid",f));if(u)t.each(l("marker-end",u,_&&((d)=>_(d)&Yd)))}function z1({inset:t,insetLeft:r,insetRight:f,...u}={}){return[r,f]=od(t,r,f),{inset:t,insetLeft:r,insetRight:f,...u}}function F8({inset:t,insetTop:r,insetBottom:f,...u}={}){return[r,f]=od(t,r,f),{inset:t,insetTop:r,insetBottom:f,...u}}function od(t,r,f){return t===void 0&&r===void 0&&f===void 0?hr?[1,0]:[0.5,0.5]:[r,f]}function md(t,{interval:r}){return t={...z0(t)},t.interval=t4(t.interval===void 0?r:t.interval),t}function Q4(t,r,f,u){let{[t]:h,[`${t}1`]:x,[`${t}2`]:b}=f,{value:g,interval:c}=md(h,f);if(g==null||c==null&&!u)return f;let _=f0(h);if(c==null){let M,H={transform:(q)=>M||(M=Ct(q,g)),label:_};return{...f,[t]:void 0,[`${t}1`]:x===void 0?H:x,[`${t}2`]:b===void 0&&!(x===b&&u)?H:b}}let l,d;function w(M){if(d!==void 0&&M===l)return d;return d=qt(Ct(l=M,g),(H)=>c.floor(H))}return r({...f,[t]:void 0,[`${t}1`]:x===void 0?{transform:w,label:_}:x,[`${t}2`]:b===void 0?{transform:(M)=>w(M).map((H)=>c.offset(H)),label:_}:b})}function jd(t,r,f){let{[t]:u}=f,{value:h,interval:x}=md(u,f);if(h==null||x==null)return f;return r({...f,[t]:{label:f0(u),transform:(b)=>{let g=qt(Ct(b,h),(_)=>x.floor(_)),c=g.map((_)=>x.offset(_));return g.map(Dt(g)?(_,l)=>_==null||isNaN(_=+_)||(l=c[l],l==null)||isNaN(l=+l)?void 0:new Date((_+l)/2):(_,l)=>_==null||(l=c[l],l==null)?NaN:(+_+ +l)/2)}}})}function ed(t={}){return Q4("x",z1,t,!0)}function ad(t={}){return Q4("y",F8,t,!0)}function U4(t={}){return Q4("x",z1,t)}function Cg(t={}){return Q4("y",F8,t)}function yd(t={}){return jd("x",z1,t)}function kd(t={}){return jd("y",F8,t)}var pd={ariaLabel:"rule",fill:null,stroke:"currentColor"};class Kg extends wt{constructor(t,r={}){let{x:f,y1:u,y2:h,inset:x=0,insetTop:b=x,insetBottom:g=x}=r;super(t,{x:{value:f,scale:"x",optional:!0},y1:{value:u,scale:"y",optional:!0},y2:{value:h,scale:"y",optional:!0}},zf(r,"x"),pd);this.insetTop=Ot(b),this.insetBottom=Ot(g),Ju(this,r)}render(t,r,f,u,h){let{x,y:b}=r,{x:g,y1:c,y2:_}=f,{width:l,height:d,marginTop:w,marginRight:M,marginLeft:H,marginBottom:q}=u,{insetTop:$,insetBottom:E}=this;return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,{x:g&&x},hr,0).call((P)=>P.selectAll().data(t).enter().append("line").call(Kt,this).attr("x1",g?(J)=>g[J]:(H+l-M)/2).attr("x2",g?(J)=>g[J]:(H+l-M)/2).attr("y1",c&&!u0(b)?(J)=>c[J]+$:w+$).attr("y2",_&&!u0(b)?b.bandwidth?(J)=>_[J]+b.bandwidth()-E:(J)=>_[J]-E:d-q-E).call(Yt,this,f).call(T8,this,f,h)).node()}}class Wg extends wt{constructor(t,r={}){let{x1:f,x2:u,y:h,inset:x=0,insetRight:b=x,insetLeft:g=x}=r;super(t,{y:{value:h,scale:"y",optional:!0},x1:{value:f,scale:"x",optional:!0},x2:{value:u,scale:"x",optional:!0}},zf(r,"y"),pd);this.insetRight=Ot(b),this.insetLeft=Ot(g),Ju(this,r)}render(t,r,f,u,h){let{x,y:b}=r,{y:g,x1:c,x2:_}=f,{width:l,height:d,marginTop:w,marginRight:M,marginLeft:H,marginBottom:q}=u,{insetLeft:$,insetRight:E}=this;return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,{y:g&&b},0,hr).call((P)=>P.selectAll().data(t).enter().append("line").call(Kt,this).attr("x1",c&&!u0(x)?(J)=>c[J]+$:H+$).attr("x2",_&&!u0(x)?x.bandwidth?(J)=>_[J]+x.bandwidth()-E:(J)=>_[J]-E:l-M-E).attr("y1",g?(J)=>g[J]:(w+d-q)/2).attr("y2",g?(J)=>g[J]:(w+d-q)/2).call(Yt,this,f).call(T8,this,f,h)).node()}}function x0(t,r){let{x:f=$t,y:u,y1:h,y2:x,...b}=Cg(r);return[h,x]=tw(u,h,x),new Kg(t,{...b,x:f,y1:h,y2:x})}function lf(t,r){let{y:f=$t,x:u,x1:h,x2:x,...b}=U4(r);return[h,x]=tw(u,h,x),new Wg(t,{...b,y:f,x1:h,x2:x})}function tw(t,r,f){if(t==null){if(r===void 0){if(f!==void 0)return[0,f]}else if(f===void 0)return[0,r]}else if(r===void 0)return f===void 0?[0,t]:[t,f];else if(f===void 0)return[t,r];return[r,f]}function R1(t,...r){let f=r.length;for(let u=0,h=!0;u{let h=t[0];for(let x=0;x=0))throw Error(`invalid lineWidth: ${_}`);this.splitLines=Fg(this),this.clipLine=Lg(this)}render(t,r,f,u,h){let{x,y:b}=r,{x:g,y:c,rotate:_,text:l,title:d,fontSize:w}=f,{rotate:M}=this,[H,q]=A0(this,u);return gt("svg:g",h).call(Tt,this,u,h).call(Tg,this,l,u).call(Ft,this,{x:g&&x,y:c&&b}).call(($)=>$.selectAll().data(t).enter().append("text").call(Kt,this).call(VQ,this,l,d).attr("transform",R1`translate(${g?(E)=>g[E]:H},${c?(E)=>c[E]:q})${_?(E)=>` rotate(${_[E]})`:M?` rotate(${M})`:""}`).call(rt,"font-size",w&&((E)=>w[E])).call(Yt,this,f)).node()}}function Zg(t){return t==null?null:qr(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function VQ(t,r,f,u){if(!f)return;let{lineAnchor:h,lineHeight:x,textOverflow:b,splitLines:g,clipLine:c}=r;t.each(function(_){let l=g(D0(f[_])??"").map(c),d=l.length,w=h==="top"?0.71:h==="bottom"?1-d:(164-d*100)/200;if(d>1){let M=0;for(let H=0;Hh&&f(t,h,g)>r)u.push(t.slice(h,x)+(t[x-1]===xw?"-":"")),h=b;if(c){u.push(t.slice(h,g)),h=void 0;continue}x=g}return u}function*GQ(t){let r=0,f=0,u=t.length;while(fg.split(/\r\n?|\n/g);let u=t?i4:M4,h=r*100;return(g)=>fn(g,h,u)}function Pb({monospace:t,lineWidth:r,textOverflow:f}){if(f==null||r==1/0)return(g)=>g;let u=t?i4:M4,h=r*100;switch(f){case"clip-start":return(g)=>R_(g,h,u,"");case"clip-end":return(g)=>G_(g,h,u,"");case"ellipsis-start":return(g)=>R_(g,h,u,Mu);case"ellipsis-middle":return(g)=>hn(g,h,u,Mu);case"ellipsis-end":return(g)=>G_(g,h,u,Mu)}}var Mu="…";function iu(t,r,f,u){let h=[],g=0;for(let x=0,b=0,c=t.length;xr){g+=u;while(g>r&&x>0)b=x,x=h.pop(),g-=f(t,x,b);return[x,r-g]}g+=l,h.push(x)}return[-1,0]}function G_(t,r,f,u){t=t.trim();let h=f(u),[g]=iu(t,r,f,h);return g<0?t:t.slice(0,g).trimEnd()+u}function hn(t,r,f,u){t=t.trim();let h=f(t);if(h<=r)return t;let g=f(u)/2,[x,b]=iu(t,r/2,f,g),[c]=iu(t,h-r/2-b+g,f,-g);return c<0?u:t.slice(0,x).trimEnd()+u+t.slice(C1(t,c)).trimStart()}function R_(t,r,f,u){t=t.trim();let h=f(t);if(h<=r)return t;let g=f(u),[x]=iu(t,h-r+g,f,-g);return x<0?u:u+t.slice(C1(t,x)).trimStart()}var Mb=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,z_=/\p{Extended_Pictographic}/uy;function C1(t,r){if(r+=gn(t,r)?2:1,bn(t,r))r=Mb.lastIndex;if(xn(t,r))return C1(t,r+1);return r}function D_(t,r){return t.charCodeAt(r)<128}function gn(t,r){let f=t.charCodeAt(r);if(f>=55296&&f<56320){let u=t.charCodeAt(r+1);return u>=56320&&u<57344}return!1}function xn(t,r){return t.charCodeAt(r)===8205}function bn(t,r){return D_(t,r)?!1:(Mb.lastIndex=r,Mb.test(t))}function O_(t,r){return D_(t,r)?!1:(z_.lastIndex=r,z_.test(t))}var cn={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},I_=3.5,dn=I_*5,v_={draw(t,r,f){let u=r*f/dn;t.moveTo(0,0),t.lineTo(0,-r),t.moveTo(-u,u-r),t.lineTo(0,-r),t.lineTo(u,u-r)}},ln={draw(t,r,f){t.moveTo(-f,0),t.lineTo(0,-r),t.lineTo(f,0)}},_n=new Map([["arrow",v_],["spike",ln]]);function wn(t){return t&&typeof t.draw==="function"}function Mn(t){if(wn(t))return t;let r=_n.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid shape: ${t}`)}class nb extends Et{constructor(t,r={}){let{x:f,y:u,r:h=I_,length:g,rotate:x,shape:b=v_,anchor:c="middle",frameAnchor:l}=r,[d,_]=Ct(g,12),[w,M]=Ct(x,0);super(t,{x:{value:f,scale:"x",optional:!0},y:{value:u,scale:"y",optional:!0},length:{value:d,scale:"length",optional:!0},rotate:{value:w,optional:!0}},r,cn);this.r=+h,this.length=_,this.rotate=M,this.shape=Mn(b),this.anchor=lr(c,"anchor",["start","middle","end"]),this.frameAnchor=Vf(l)}render(t,r,f,u,h){let{x:g,y:x}=r,{x:b,y:c,length:l,rotate:d}=f,{length:_,rotate:w,anchor:M,shape:i,r:H}=this,[q,s]=F0(this,u);return gt("svg:g",h).call(Ft,this,u,h).call(Bt,this,{x:b&&g,y:c&&x}).call((E)=>E.selectAll().data(t).enter().append("path").call(Nt,this).attr("transform",e1`translate(${b?(P)=>b[P]:q},${c?(P)=>c[P]:s})${d?(P)=>` rotate(${d[P]})`:w?` rotate(${w})`:""}${M==="start"?"":M==="end"?l?(P)=>` translate(0,${l[P]})`:` translate(0,${_})`:l?(P)=>` translate(0,${l[P]/2})`:` translate(0,${_/2})`}`).attr("d",l?(P)=>{let n=Yr();return i.draw(n,l[P],H),n}:(()=>{let P=Yr();return i.draw(P,_,H),P})()).call(rr,this,f)).node()}}function X_(t,r={}){let{x:f=wt,...u}=r;return new nb(t,{...u,x:f})}function Y_(t,r={}){let{y:f=wt,...u}=r;return new nb(t,{...u,y:f})}function Zf(t,r){if(arguments.length<2&&!qr(t))r=t,t=null;if(r===void 0)r={};return[t,r]}function H4({anchor:t}={},r){return t===void 0?r[0]:lr(t,"anchor",r)}function S_(t){return H4(t,["left","right"])}function a_(t){return H4(t,["right","left"])}function m_(t){return H4(t,["bottom","top"])}function j_(t){return H4(t,["top","bottom"])}function Jb(){let[t,r]=Zf(...arguments);return p_("y",S_(r),t,r)}function y_(){let[t,r]=Zf(...arguments);return p_("fy",a_(r),t,r)}function Qb(){let[t,r]=Zf(...arguments);return tw("x",m_(r),t,r)}function k_(){let[t,r]=Zf(...arguments);return tw("fx",j_(r),t,r)}function p_(t,r,f,{color:u="currentColor",opacity:h=1,stroke:g=u,strokeOpacity:x=h,strokeWidth:b=1,fill:c=u,fillOpacity:l=h,textAnchor:d,textStroke:_,textStrokeOpacity:w,textStrokeWidth:M,tickSize:i=t==="y"?6:0,tickPadding:H,tickRotate:q,x:s,margin:E,marginTop:P=E===void 0?20:E,marginRight:n=E===void 0?r==="right"?40:0:E,marginBottom:$=E===void 0?20:E,marginLeft:J=E===void 0?r==="left"?40:0:E,label:Q,labelAnchor:U,labelArrow:e,labelOffset:o,ariaLabel:K=`${t}-axis`,...V}){if(i=Tt(i),H=Tt(H),q=Tt(q),U!==void 0)U=lr(U,"labelAnchor",["center","top","bottom"]);return e=ww(e),px(i&&!St(g)?Hn(t,r,f,{stroke:g,strokeOpacity:x,strokeWidth:b,tickSize:i,tickPadding:H,tickRotate:q,x:s,ariaLabel:K,...V}):null,!St(c)?En(t,r,f,{fill:c,fillOpacity:l,stroke:_,strokeOpacity:w,strokeWidth:M,textAnchor:d,tickSize:i,tickPadding:H,tickRotate:q,x:s,marginTop:P,marginRight:n,marginBottom:$,marginLeft:J,ariaLabel:K,...V}):null,!St(c)&&Q!==null?Vt([],cw({fill:c,fillOpacity:l,...V},function(G,B,N,W,p){let a=W[t],{marginTop:T,marginRight:L,marginBottom:A,marginLeft:X}=t==="y"&&p.inset||p,z=U??(a.bandwidth?"center":"top"),rt=o??(r==="right"?L:X)-3;if(z==="center")this.textAnchor=void 0,this.lineAnchor=r==="right"?"bottom":"top",this.frameAnchor=r,this.rotate=-90;else this.textAnchor=r==="right"?"end":"start",this.lineAnchor=z,this.frameAnchor=`${z}-${r}`,this.rotate=0;return this.dy=z==="top"?3-T:z==="bottom"?A-3:0,this.dx=r==="right"?rt:-rt,this.ariaLabel=`${K} label`,{facets:[[0]],channels:{text:{value:[_w(t,a,{anchor:r,label:Q,labelAnchor:z,labelArrow:e})]}}}})):null)}function tw(t,r,f,{color:u="currentColor",opacity:h=1,stroke:g=u,strokeOpacity:x=h,strokeWidth:b=1,fill:c=u,fillOpacity:l=h,textAnchor:d,textStroke:_,textStrokeOpacity:w,textStrokeWidth:M,tickSize:i=t==="x"?6:0,tickPadding:H,tickRotate:q,y:s,margin:E,marginTop:P=E===void 0?r==="top"?30:0:E,marginRight:n=E===void 0?20:E,marginBottom:$=E===void 0?r==="bottom"?30:0:E,marginLeft:J=E===void 0?20:E,label:Q,labelAnchor:U,labelArrow:e,labelOffset:o,ariaLabel:K=`${t}-axis`,...V}){if(i=Tt(i),H=Tt(H),q=Tt(q),U!==void 0)U=lr(U,"labelAnchor",["center","left","right"]);return e=ww(e),px(i&&!St(g)?qn(t,r,f,{stroke:g,strokeOpacity:x,strokeWidth:b,tickSize:i,tickPadding:H,tickRotate:q,y:s,ariaLabel:K,...V}):null,!St(c)?sn(t,r,f,{fill:c,fillOpacity:l,stroke:_,strokeOpacity:w,strokeWidth:M,textAnchor:d,tickSize:i,tickPadding:H,tickRotate:q,y:s,marginTop:P,marginRight:n,marginBottom:$,marginLeft:J,ariaLabel:K,...V}):null,!St(c)&&Q!==null?Vt([],cw({fill:c,fillOpacity:l,...V},function(G,B,N,W,p){let a=W[t],{marginTop:T,marginRight:L,marginBottom:A,marginLeft:X}=t==="x"&&p.inset||p,z=U??(a.bandwidth?"center":"right"),rt=o??(r==="top"?T:A)-3;if(z==="center")this.frameAnchor=r,this.textAnchor=void 0;else this.frameAnchor=`${r}-${z}`,this.textAnchor=z==="right"?"end":"start";return this.lineAnchor=r,this.dy=r==="top"?-rt:rt,this.dx=z==="right"?L-3:z==="left"?3-X:0,this.ariaLabel=`${K} label`,{facets:[[0]],channels:{text:{value:[_w(t,a,{anchor:r,label:Q,labelAnchor:z,labelArrow:e})]}}}})):null)}function Hn(t,r,f,{strokeWidth:u=1,strokeLinecap:h=null,strokeLinejoin:g=null,facetAnchor:x=r+(t==="y"?"-empty":""),frameAnchor:b=r,tickSize:c,inset:l=0,insetLeft:d=l,insetRight:_=l,dx:w=0,y:M=t==="y"?void 0:null,ariaLabel:i,...H}){return K1(Y_,t,f,{ariaLabel:`${i} tick`,ariaHidden:!0},{strokeWidth:u,strokeLinecap:h,strokeLinejoin:g,facetAnchor:x,frameAnchor:b,y:M,...H,dx:r==="left"?+w-tr+ +d:+w+tr-_,anchor:"start",length:c,shape:r==="left"?Jn:Qn})}function qn(t,r,f,{strokeWidth:u=1,strokeLinecap:h=null,strokeLinejoin:g=null,facetAnchor:x=r+(t==="x"?"-empty":""),frameAnchor:b=r,tickSize:c,inset:l=0,insetTop:d=l,insetBottom:_=l,dy:w=0,x:M=t==="x"?void 0:null,ariaLabel:i,...H}){return K1(X_,t,f,{ariaLabel:`${i} tick`,ariaHidden:!0},{strokeWidth:u,strokeLinejoin:g,strokeLinecap:h,facetAnchor:x,frameAnchor:b,x:M,...H,dy:r==="bottom"?+w-tr-_:+w+tr+ +d,anchor:"start",length:c,shape:r==="bottom"?nn:$n})}function En(t,r,f,{facetAnchor:u=r+(t==="y"?"-empty":""),frameAnchor:h=r,tickSize:g,tickRotate:x=0,tickPadding:b=Math.max(3,9-g)+(Math.abs(x)>60?4*Math.cos(x*gb):0),text:c,textAnchor:l=Math.abs(x)>60?"middle":r==="left"?"end":"start",lineAnchor:d=x>60?"top":x<-60?"bottom":"middle",fontVariant:_,inset:w=0,insetLeft:M=w,insetRight:i=w,dx:H=0,ariaLabel:q,y:s=t==="y"?void 0:null,...E}){return K1(qb,t,f,{ariaLabel:`${q} tick label`},{facetAnchor:u,frameAnchor:h,text:c,textAnchor:l,lineAnchor:d,fontVariant:_,rotate:x,y:s,...E,dx:r==="left"?+H-g-b+ +M:+H+ +g+ +b-i},function(P,n,$,J,Q){if(_===void 0)this.fontVariant=lw(P);if(c===void 0)Q.text=dw(P,n,$,J,r)})}function sn(t,r,f,{facetAnchor:u=r+(t==="x"?"-empty":""),frameAnchor:h=r,tickSize:g,tickRotate:x=0,tickPadding:b=Math.max(3,9-g)+(Math.abs(x)>=10?4*Math.cos(x*gb):0),text:c,textAnchor:l=Math.abs(x)>=10?x<0^r==="bottom"?"start":"end":"middle",lineAnchor:d=Math.abs(x)>=10?"middle":r==="bottom"?"top":"bottom",fontVariant:_,inset:w=0,insetTop:M=w,insetBottom:i=w,dy:H=0,x:q=t==="x"?void 0:null,ariaLabel:s,...E}){return K1(Hb,t,f,{ariaLabel:`${s} tick label`},{facetAnchor:u,frameAnchor:h,text:c===void 0?null:c,textAnchor:l,lineAnchor:d,fontVariant:_,rotate:x,x:q,...E,dy:r==="bottom"?+H+ +g+ +b-i:+H-g-b+ +M},function(P,n,$,J,Q){if(_===void 0)this.fontVariant=lw(P);if(c===void 0)Q.text=dw(P,n,$,J,r)})}function rw(){let[t,r]=Zf(...arguments);return gw("y",S_(r),t,r)}function fw(){let[t,r]=Zf(...arguments);return gw("fy",a_(r),t,r)}function uw(){let[t,r]=Zf(...arguments);return xw("x",m_(r),t,r)}function hw(){let[t,r]=Zf(...arguments);return xw("fx",j_(r),t,r)}function gw(t,r,f,{y:u=t==="y"?void 0:null,x:h=null,x1:g=r==="left"?h:null,x2:x=r==="right"?h:null,ariaLabel:b=`${t}-grid`,ariaHidden:c=!0,...l}){return K1(bf,t,f,{ariaLabel:b,ariaHidden:c},{y:u,x1:g,x2:x,...bw(l)})}function xw(t,r,f,{x:u=t==="x"?void 0:null,y:h=null,y1:g=r==="top"?h:null,y2:x=r==="bottom"?h:null,ariaLabel:b=`${t}-grid`,ariaHidden:c=!0,...l}){return K1(r0,t,f,{ariaLabel:b,ariaHidden:c},{x:u,y1:g,y2:x,...bw(l)})}function bw({color:t="currentColor",opacity:r=0.1,stroke:f=t,strokeOpacity:u=r,strokeWidth:h=1,...g}){return{stroke:f,strokeOpacity:u,strokeWidth:h,...g}}function cw({fill:t,fillOpacity:r,fontFamily:f,fontSize:u,fontStyle:h,fontVariant:g,fontWeight:x,monospace:b,pointerEvents:c,shapeRendering:l,clip:d=!1},_){return[,t]=Hr(t),[,r]=Ct(r),{facet:"super",x:null,y:null,fill:t,fillOpacity:r,fontFamily:f,fontSize:u,fontStyle:h,fontVariant:g,fontWeight:x,monospace:b,pointerEvents:c,shapeRendering:l,clip:d,initializer:_}}function K1(t,r,f,u,h,g){let x;function b(d,_,w,M,i,H){let q=d==null&&(r==="fx"||r==="fy"),{[r]:s}=M;if(!s)throw Error(`missing scale: ${r}`);let E=s.domain(),{interval:P,ticks:n,tickFormat:$,tickSpacing:J=r==="x"?80:35}=h;if(typeof n==="string"&&Mw(s))P=n,n=void 0;if(n===void 0)n=W0(P,s.type)??Pn(s,J);if(d==null){if(qr(n))d=V0(n);else if(Kf(n))d=$b(n,...Rt(E));else if(s.interval){let U=s.interval;if(s.ticks){let[e,o]=Rt(E),K=(o-e)/U[x1];U=gx(U,K/n)??U,d=$b(U,e,o)}else{d=E;let e=d.length;if(U=gx(U,e/n)??U,U!==s.interval)d=$b(U,...Rt(d))}if(U===s.interval){let e=Math.round(d.length/n);if(e>1)d=d.filter((o,K)=>K%e===0)}}else if(s.ticks)d=s.ticks(n);else d=E;if(!s.ticks&&d.length&&d!==E){let U=new h0(E);if(d=d.filter((e)=>U.has(e)),!d.length)Er(`Warning: the ${r}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}if(r==="y"||r==="x")_=[_r(d)];else x[r]={scale:r,value:wt}}g?.call(this,s,d,n,$,x);let Q=Object.fromEntries(Object.entries(x).map(([U,e])=>{return[U,{...e,value:nt(d,e.value)}]}));if(q)_=H.filterFacets(d,Q);return{data:d,facets:_,channels:Q}}let c=ff(h).initializer,l=t(f,ff({...h,initializer:b},c));if(f==null)x=l.channels,l.channels={};else x={};if(u!==void 0)Object.assign(l,u);if(l.clip===void 0)l.clip=!1;return l}function Pn(t,r){let[f,u]=Rt(t.range());return(u-f)/r}function dw(t,r,f,u,h){return{value:Q8(t,r,f,u,h)}}function Q8(t,r,f,u,h){return typeof u==="function"&&!(t.type==="log"&&t.tickFormat)?u:u===void 0&&r&&ot(r)?Jd(t.type,r,h)??T0:t.tickFormat?t.tickFormat(typeof f==="number"?f:null,u):typeof u==="string"&&t.domain().length>0?(ot(t.domain())?Q0:or)(u):u===void 0?T0:Qr(u)}function $b(t,r,f){return t.range(r,t.offset(t.floor(f)))}var nn={draw(t,r){t.moveTo(0,0),t.lineTo(0,r)}},$n={draw(t,r){t.moveTo(0,0),t.lineTo(0,-r)}},Jn={draw(t,r){t.moveTo(0,0),t.lineTo(-r,0)}},Qn={draw(t,r){t.moveTo(0,0),t.lineTo(r,0)}};function lw(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function _w(t,r,{anchor:f,label:u=r.label,labelAnchor:h,labelArrow:g}={}){if(u==null||u.inferred&&Mw(r)&&/^(date|time|year)$/i.test(u))return;if(u=String(u),g==="auto")g=(!r.bandwidth||r.interval)&&!/[↑↓→←]/.test(u);if(!g)return u;if(g===!0){let x=al(r);if(x)g=/x$/.test(t)||h==="center"?/x$/.test(t)===x<0?"left":"right":x<0?"up":"down"}switch(g){case"left":return`← ${u}`;case"right":return`${u} →`;case"up":return f==="right"?`${u} ↑`:`↑ ${u}`;case"down":return f==="right"?`${u} ↓`:`↓ ${u}`}return u}function ww(t="auto"){return St(t)?!1:typeof t==="boolean"?t:lr(t,"labelArrow",["auto","up","right","down","left"])}function Mw(t){return ot(t.domain())}function iw(t,r){if(r==null)return r;let f=t(r);if(!f)throw Error(`scale not found: ${r}`);return f}function Hw(t,{opacity:r,...f}={}){if(!Z0(t)&&!Xx(t))throw Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return Ew(t,f,(u,h,g,x)=>u.append("svg").attr("width",g).attr("height",x).attr("fill",h.scale).attr("fill-opacity",Ct(r)[1]).append("rect").attr("width","100%").attr("height","100%"))}function qw(t,{fill:r=t.hint?.fill!==void 0?t.hint.fill:"none",fillOpacity:f=1,stroke:u=t.hint?.stroke!==void 0?t.hint.stroke:St(r)?"currentColor":"none",strokeOpacity:h=1,strokeWidth:g=1.5,r:x=4.5,...b}={},c){let[l,d]=Hr(r),[_,w]=Hr(u),M=iw(c,l),i=iw(c,_),H=x*x*Math.PI;return f=Ct(f)[1],h=Ct(h)[1],g=Ct(g)[1],Ew(t,b,(q,s,E,P)=>q.append("svg").attr("viewBox","-8 -8 16 16").attr("width",E).attr("height",P).attr("fill",l==="color"?(n)=>M.scale(n):d).attr("fill-opacity",f).attr("stroke",_==="color"?(n)=>i.scale(n):w).attr("stroke-opacity",h).attr("stroke-width",g).append("path").attr("d",(n)=>{let $=Yr();return t.scale(n).draw($,H),$}))}function Ew(t,r={},f){let{columns:u,tickFormat:h,fontVariant:g=l4(t),swatchSize:x=15,swatchWidth:b=x,swatchHeight:c=x,marginLeft:l=0,className:d,style:_,width:w}=r,M=J1(r);d=Q1(d),h=Q8(t.scale,t.domain,void 0,h);let i=gt("div",M).attr("class",`${d}-swatches ${d}-swatches-${u!=null?"columns":"wrap"}`),H;if(u!=null)H=`:where(.${d}-swatches-columns .${d}-swatch) { +`:yield[r,f,!0],f+=h,r=f;break;default:++f;break}}yield[r,f,!0]}var rw={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"‘":31,"’":31,"“":47,"”":47,"…":82};function C4(t,r=0,f=t.length){let u=0;for(let h=r;hx.split(/\r\n?|\n/g);let u=t?K4:C4,h=r*100;return(x)=>LQ(x,h,u)}function Lg({monospace:t,lineWidth:r,textOverflow:f}){if(f==null||r==1/0)return(x)=>x;let u=t?K4:C4,h=r*100;switch(f){case"clip-start":return(x)=>uw(x,h,u,"");case"clip-end":return(x)=>fw(x,h,u,"");case"ellipsis-start":return(x)=>uw(x,h,u,Qu);case"ellipsis-middle":return(x)=>BQ(x,h,u,Qu);case"ellipsis-end":return(x)=>fw(x,h,u,Qu)}}var Qu="…";function Uu(t,r,f,u){let h=[],x=0;for(let b=0,g=0,c=t.length;br){x+=u;while(x>r&&b>0)g=b,b=h.pop(),x-=f(t,b,g);return[b,r-x]}x+=_,h.push(b)}return[-1,0]}function fw(t,r,f,u){t=t.trim();let h=f(u),[x]=Uu(t,r,f,h);return x<0?t:t.slice(0,x).trimEnd()+u}function BQ(t,r,f,u){t=t.trim();let h=f(t);if(h<=r)return t;let x=f(u)/2,[b,g]=Uu(t,r/2,f,x),[c]=Uu(t,h-r/2-g+x,f,-x);return c<0?u:t.slice(0,b).trimEnd()+u+t.slice(D1(t,c)).trimStart()}function uw(t,r,f,u){t=t.trim();let h=f(t);if(h<=r)return t;let x=f(u),[b]=Uu(t,h-r+x,f,-x);return b<0?u:u+t.slice(D1(t,b)).trimStart()}var ig=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,hw=/\p{Extended_Pictographic}/uy;function D1(t,r){if(r+=zQ(t,r)?2:1,DQ(t,r))r=ig.lastIndex;if(RQ(t,r))return D1(t,r+1);return r}function bw(t,r){return t.charCodeAt(r)<128}function zQ(t,r){let f=t.charCodeAt(r);if(f>=55296&&f<56320){let u=t.charCodeAt(r+1);return u>=56320&&u<57344}return!1}function RQ(t,r){return t.charCodeAt(r)===8205}function DQ(t,r){return bw(t,r)?!1:(ig.lastIndex=r,ig.test(t))}function gw(t,r){return bw(t,r)?!1:(hw.lastIndex=r,hw.test(t))}var AQ={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},cw=3.5,OQ=cw*5,_w={draw(t,r,f){let u=r*f/OQ;t.moveTo(0,0),t.lineTo(0,-r),t.moveTo(-u,u-r),t.lineTo(0,-r),t.lineTo(u,u-r)}},sQ={draw(t,r,f){t.moveTo(-f,0),t.lineTo(0,-r),t.lineTo(f,0)}},IQ=new Map([["arrow",_w],["spike",sQ]]);function nQ(t){return t&&typeof t.draw==="function"}function XQ(t){if(nQ(t))return t;let r=IQ.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid shape: ${t}`)}class Gg extends wt{constructor(t,r={}){let{x:f,y:u,r:h=cw,length:x,rotate:b,shape:g=_w,anchor:c="middle",frameAnchor:_}=r,[l,d]=Bt(x,12),[w,M]=Bt(b,0);super(t,{x:{value:f,scale:"x",optional:!0},y:{value:u,scale:"y",optional:!0},length:{value:l,scale:"length",optional:!0},rotate:{value:w,optional:!0}},r,AQ);this.r=+h,this.length=d,this.rotate=M,this.shape=XQ(g),this.anchor=qr(c,"anchor",["start","middle","end"]),this.frameAnchor=Gf(_)}render(t,r,f,u,h){let{x,y:b}=r,{x:g,y:c,length:_,rotate:l}=f,{length:d,rotate:w,anchor:M,shape:H,r:q}=this,[$,E]=A0(this,u);return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,{x:g&&x,y:c&&b}).call((P)=>P.selectAll().data(t).enter().append("path").call(Kt,this).attr("transform",R1`translate(${g?(J)=>g[J]:$},${c?(J)=>c[J]:E})${l?(J)=>` rotate(${l[J]})`:w?` rotate(${w})`:""}${M==="start"?"":M==="end"?_?(J)=>` translate(0,${_[J]})`:` translate(0,${d})`:_?(J)=>` translate(0,${_[J]/2})`:` translate(0,${d/2})`}`).attr("d",_?(J)=>{let Q=Wr();return H.draw(Q,_[J],q),Q}:(()=>{let J=Wr();return H.draw(J,d,q),J})()).call(Yt,this,f)).node()}}function lw(t,r={}){let{x:f=$t,...u}=r;return new Gg(t,{...u,x:f})}function dw(t,r={}){let{y:f=$t,...u}=r;return new Gg(t,{...u,y:f})}function Rf(t,r){if(arguments.length<2&&!Qr(t))r=t,t=null;if(r===void 0)r={};return[t,r]}function W4({anchor:t}={},r){return t===void 0?r[0]:qr(t,"anchor",r)}function ww(t){return W4(t,["left","right"])}function Mw(t){return W4(t,["right","left"])}function Hw(t){return W4(t,["bottom","top"])}function qw(t){return W4(t,["top","bottom"])}function zg(){let[t,r]=Rf(...arguments);return Ew("y",ww(r),t,r)}function $w(){let[t,r]=Rf(...arguments);return Ew("fy",Mw(r),t,r)}function Rg(){let[t,r]=Rf(...arguments);return Jw("x",Hw(r),t,r)}function Pw(){let[t,r]=Rf(...arguments);return Jw("fx",qw(r),t,r)}function Ew(t,r,f,{color:u="currentColor",opacity:h=1,stroke:x=u,strokeOpacity:b=h,strokeWidth:g=1,fill:c=u,fillOpacity:_=h,textAnchor:l,textStroke:d,textStrokeOpacity:w,textStrokeWidth:M,tickSize:H=t==="y"?6:0,tickPadding:q,tickRotate:$,x:E,margin:P,marginTop:J=P===void 0?20:P,marginRight:Q=P===void 0?r==="right"?40:0:P,marginBottom:U=P===void 0?20:P,marginLeft:C=P===void 0?r==="left"?40:0:P,label:W,labelAnchor:i,labelArrow:Z,labelOffset:R,ariaLabel:z=`${t}-axis`,...G}){if(H=Ot(H),q=Ot(q),$=Ot($),i!==void 0)i=qr(i,"labelAnchor",["center","top","bottom"]);return Z=Lw(Z),wg(H&&!yt(x)?vQ(t,r,f,{stroke:x,strokeOpacity:b,strokeWidth:g,tickSize:H,tickPadding:q,tickRotate:$,x:E,ariaLabel:z,...G}):null,!yt(c)?SQ(t,r,f,{fill:c,fillOpacity:_,stroke:d,strokeOpacity:w,strokeWidth:M,textAnchor:l,tickSize:H,tickPadding:q,tickRotate:$,x:E,marginTop:J,marginRight:Q,marginBottom:U,marginLeft:C,ariaLabel:z,...G}):null,!yt(c)&&W!==null?Wt([],Vw({fill:c,fillOpacity:_,...G},function(N,L,K,V,y){let I=V[t],{marginTop:A,marginRight:s,marginBottom:Y,marginLeft:m}=t==="y"&&y.inset||y,X=i??(I.bandwidth?"center":"top"),ht=R??(r==="right"?s:m)-3;if(X==="center")this.textAnchor=void 0,this.lineAnchor=r==="right"?"bottom":"top",this.frameAnchor=r,this.rotate=-90;else this.textAnchor=r==="right"?"end":"start",this.lineAnchor=X,this.frameAnchor=`${X}-${r}`,this.rotate=0;return this.dy=X==="top"?3-A:X==="bottom"?Y-3:0,this.dx=r==="right"?ht:-ht,this.ariaLabel=`${z} label`,{facets:[[0]],channels:{text:{value:[Fw(t,I,{anchor:r,label:W,labelAnchor:X,labelArrow:Z})]}}}})):null)}function Jw(t,r,f,{color:u="currentColor",opacity:h=1,stroke:x=u,strokeOpacity:b=h,strokeWidth:g=1,fill:c=u,fillOpacity:_=h,textAnchor:l,textStroke:d,textStrokeOpacity:w,textStrokeWidth:M,tickSize:H=t==="x"?6:0,tickPadding:q,tickRotate:$,y:E,margin:P,marginTop:J=P===void 0?r==="top"?30:0:P,marginRight:Q=P===void 0?20:P,marginBottom:U=P===void 0?r==="bottom"?30:0:P,marginLeft:C=P===void 0?20:P,label:W,labelAnchor:i,labelArrow:Z,labelOffset:R,ariaLabel:z=`${t}-axis`,...G}){if(H=Ot(H),q=Ot(q),$=Ot($),i!==void 0)i=qr(i,"labelAnchor",["center","left","right"]);return Z=Lw(Z),wg(H&&!yt(x)?YQ(t,r,f,{stroke:x,strokeOpacity:b,strokeWidth:g,tickSize:H,tickPadding:q,tickRotate:$,y:E,ariaLabel:z,...G}):null,!yt(c)?oQ(t,r,f,{fill:c,fillOpacity:_,stroke:d,strokeOpacity:w,strokeWidth:M,textAnchor:l,tickSize:H,tickPadding:q,tickRotate:$,y:E,marginTop:J,marginRight:Q,marginBottom:U,marginLeft:C,ariaLabel:z,...G}):null,!yt(c)&&W!==null?Wt([],Vw({fill:c,fillOpacity:_,...G},function(N,L,K,V,y){let I=V[t],{marginTop:A,marginRight:s,marginBottom:Y,marginLeft:m}=t==="x"&&y.inset||y,X=i??(I.bandwidth?"center":"right"),ht=R??(r==="top"?A:Y)-3;if(X==="center")this.frameAnchor=r,this.textAnchor=void 0;else this.frameAnchor=`${r}-${X}`,this.textAnchor=X==="right"?"end":"start";return this.lineAnchor=r,this.dy=r==="top"?-ht:ht,this.dx=X==="right"?s-3:X==="left"?3-m:0,this.ariaLabel=`${z} label`,{facets:[[0]],channels:{text:{value:[Fw(t,I,{anchor:r,label:W,labelAnchor:X,labelArrow:Z})]}}}})):null)}function vQ(t,r,f,{strokeWidth:u=1,strokeLinecap:h=null,strokeLinejoin:x=null,facetAnchor:b=r+(t==="y"?"-empty":""),frameAnchor:g=r,tickSize:c,inset:_=0,insetLeft:l=_,insetRight:d=_,dx:w=0,y:M=t==="y"?void 0:null,ariaLabel:H,...q}){return A1(dw,t,f,{ariaLabel:`${H} tick`,ariaHidden:!0},{strokeWidth:u,strokeLinecap:h,strokeLinejoin:x,facetAnchor:b,frameAnchor:g,y:M,...q,dx:r==="left"?+w-hr+ +l:+w+hr-d,anchor:"start",length:c,shape:r==="left"?aQ:yQ})}function YQ(t,r,f,{strokeWidth:u=1,strokeLinecap:h=null,strokeLinejoin:x=null,facetAnchor:b=r+(t==="x"?"-empty":""),frameAnchor:g=r,tickSize:c,inset:_=0,insetTop:l=_,insetBottom:d=_,dy:w=0,x:M=t==="x"?void 0:null,ariaLabel:H,...q}){return A1(lw,t,f,{ariaLabel:`${H} tick`,ariaHidden:!0},{strokeWidth:u,strokeLinejoin:x,strokeLinecap:h,facetAnchor:b,frameAnchor:g,x:M,...q,dy:r==="bottom"?+w-hr-d:+w+hr+ +l,anchor:"start",length:c,shape:r==="bottom"?jQ:eQ})}function SQ(t,r,f,{facetAnchor:u=r+(t==="y"?"-empty":""),frameAnchor:h=r,tickSize:x,tickRotate:b=0,tickPadding:g=Math.max(3,9-x)+(Math.abs(b)>60?4*Math.cos(b*Eg):0),text:c,textAnchor:_=Math.abs(b)>60?"middle":r==="left"?"end":"start",lineAnchor:l=b>60?"top":b<-60?"bottom":"middle",fontVariant:d,inset:w=0,insetLeft:M=w,insetRight:H=w,dx:q=0,ariaLabel:$,y:E=t==="y"?void 0:null,...P}){return A1(Ng,t,f,{ariaLabel:`${$} tick label`},{facetAnchor:u,frameAnchor:h,text:c,textAnchor:_,lineAnchor:l,fontVariant:d,rotate:b,y:E,...P,dx:r==="left"?+q-x-g+ +M:+q+ +x+ +g-H},function(J,Q,U,C,W){if(d===void 0)this.fontVariant=Tw(J);if(c===void 0)W.text=Nw(J,Q,U,C,r)})}function oQ(t,r,f,{facetAnchor:u=r+(t==="x"?"-empty":""),frameAnchor:h=r,tickSize:x,tickRotate:b=0,tickPadding:g=Math.max(3,9-x)+(Math.abs(b)>=10?4*Math.cos(b*Eg):0),text:c,textAnchor:_=Math.abs(b)>=10?b<0^r==="bottom"?"start":"end":"middle",lineAnchor:l=Math.abs(b)>=10?"middle":r==="bottom"?"top":"bottom",fontVariant:d,inset:w=0,insetTop:M=w,insetBottom:H=w,dy:q=0,x:$=t==="x"?void 0:null,ariaLabel:E,...P}){return A1(Vg,t,f,{ariaLabel:`${E} tick label`},{facetAnchor:u,frameAnchor:h,text:c===void 0?null:c,textAnchor:_,lineAnchor:l,fontVariant:d,rotate:b,x:$,...P,dy:r==="bottom"?+q+ +x+ +g-H:+q-x-g+ +M},function(J,Q,U,C,W){if(d===void 0)this.fontVariant=Tw(J);if(c===void 0)W.text=Nw(J,Q,U,C,r)})}function Qw(){let[t,r]=Rf(...arguments);return Ww("y",ww(r),t,r)}function Uw(){let[t,r]=Rf(...arguments);return Ww("fy",Mw(r),t,r)}function Cw(){let[t,r]=Rf(...arguments);return iw("x",Hw(r),t,r)}function Kw(){let[t,r]=Rf(...arguments);return iw("fx",qw(r),t,r)}function Ww(t,r,f,{y:u=t==="y"?void 0:null,x:h=null,x1:x=r==="left"?h:null,x2:b=r==="right"?h:null,ariaLabel:g=`${t}-grid`,ariaHidden:c=!0,..._}){return A1(lf,t,f,{ariaLabel:g,ariaHidden:c},{y:u,x1:x,x2:b,...Zw(_)})}function iw(t,r,f,{x:u=t==="x"?void 0:null,y:h=null,y1:x=r==="top"?h:null,y2:b=r==="bottom"?h:null,ariaLabel:g=`${t}-grid`,ariaHidden:c=!0,..._}){return A1(x0,t,f,{ariaLabel:g,ariaHidden:c},{x:u,y1:x,y2:b,...Zw(_)})}function Zw({color:t="currentColor",opacity:r=0.1,stroke:f=t,strokeOpacity:u=r,strokeWidth:h=1,...x}){return{stroke:f,strokeOpacity:u,strokeWidth:h,...x}}function Vw({fill:t,fillOpacity:r,fontFamily:f,fontSize:u,fontStyle:h,fontVariant:x,fontWeight:b,monospace:g,pointerEvents:c,shapeRendering:_,clip:l=!1},d){return[,t]=Jr(t),[,r]=Bt(r),{facet:"super",x:null,y:null,fill:t,fillOpacity:r,fontFamily:f,fontSize:u,fontStyle:h,fontVariant:x,fontWeight:b,monospace:g,pointerEvents:c,shapeRendering:_,clip:l,initializer:d}}function A1(t,r,f,u,h,x){let b;function g(l,d,w,M,H,q){let $=l==null&&(r==="fx"||r==="fy"),{[r]:E}=M;if(!E)throw Error(`missing scale: ${r}`);let P=E.domain(),{interval:J,ticks:Q,tickFormat:U,tickSpacing:C=r==="x"?80:35}=h;if(typeof Q==="string"&&Gw(E))J=Q,Q=void 0;if(Q===void 0)Q=B0(J,E.type)??mQ(E,C);if(l==null){if(Qr(Q))l=G0(Q);else if(Lf(Q))l=Bg(Q,...nt(P));else if(E.interval){let i=E.interval;if(E.ticks){let[Z,R]=nt(P),z=(R-Z)/i[q1];i=Eb(i,z/Q)??i,l=Bg(i,Z,R)}else{l=P;let Z=l.length;if(i=Eb(i,Z/Q)??i,i!==E.interval)l=Bg(i,...nt(l))}if(i===E.interval){let Z=Math.round(l.length/Q);if(Z>1)l=l.filter((R,z)=>z%Z===0)}}else if(E.ticks)l=E.ticks(Q);else l=P;if(!E.ticks&&l.length&&l!==P){let i=new c0(P);if(l=l.filter((Z)=>i.has(Z)),!l.length)Ur(`Warning: the ${r}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}if(r==="y"||r==="x")d=[$r(l)];else b[r]={scale:r,value:$t}}x?.call(this,E,l,Q,U,b);let W=Object.fromEntries(Object.entries(b).map(([i,Z])=>{return[i,{...Z,value:Ct(l,Z.value)}]}));if($)d=q.filterFacets(l,W);return{data:l,facets:d,channels:W}}let c=xf(h).initializer,_=t(f,xf({...h,initializer:g},c));if(f==null)b=_.channels,_.channels={};else b={};if(u!==void 0)Object.assign(_,u);if(_.clip===void 0)_.clip=!1;return _}function mQ(t,r){let[f,u]=nt(t.range());return(u-f)/r}function Nw(t,r,f,u,h){return{value:G8(t,r,f,u,h)}}function G8(t,r,f,u,h){return typeof u==="function"&&!(t.type==="log"&&t.tickFormat)?u:u===void 0&&r&&Dt(r)?n_(t.type,r,h)??D0:t.tickFormat?t.tickFormat(typeof f==="number"?f:null,u):typeof u==="string"&&t.domain().length>0?(Dt(t.domain())?V0:Dr)(u):u===void 0?D0:Nr(u)}function Bg(t,r,f){return t.range(r,t.offset(t.floor(f)))}var jQ={draw(t,r){t.moveTo(0,0),t.lineTo(0,r)}},eQ={draw(t,r){t.moveTo(0,0),t.lineTo(0,-r)}},aQ={draw(t,r){t.moveTo(0,0),t.lineTo(-r,0)}},yQ={draw(t,r){t.moveTo(0,0),t.lineTo(r,0)}};function Tw(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function Fw(t,r,{anchor:f,label:u=r.label,labelAnchor:h,labelArrow:x}={}){if(u==null||u.inferred&&Gw(r)&&/^(date|time|year)$/i.test(u))return;if(u=String(u),x==="auto")x=(!r.bandwidth||r.interval)&&!/[↑↓→←]/.test(u);if(!x)return u;if(x===!0){let b=Md(r);if(b)x=/x$/.test(t)||h==="center"?/x$/.test(t)===b<0?"left":"right":b<0?"up":"down"}switch(x){case"left":return`← ${u}`;case"right":return`${u} →`;case"up":return f==="right"?`${u} ↑`:`↑ ${u}`;case"down":return f==="right"?`${u} ↓`:`↓ ${u}`}return u}function Lw(t="auto"){return yt(t)?!1:typeof t==="boolean"?t:qr(t,"labelArrow",["auto","up","right","down","left"])}function Gw(t){return Dt(t.domain())}function Bw(t,r){if(r==null)return r;let f=t(r);if(!f)throw Error(`scale not found: ${r}`);return f}function zw(t,{opacity:r,...f}={}){if(!R0(t)&&!hg(t))throw Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return Dw(t,f,(u,h,x,b)=>u.append("svg").attr("width",x).attr("height",b).attr("fill",h.scale).attr("fill-opacity",Bt(r)[1]).append("rect").attr("width","100%").attr("height","100%"))}function Rw(t,{fill:r=t.hint?.fill!==void 0?t.hint.fill:"none",fillOpacity:f=1,stroke:u=t.hint?.stroke!==void 0?t.hint.stroke:yt(r)?"currentColor":"none",strokeOpacity:h=1,strokeWidth:x=1.5,r:b=4.5,...g}={},c){let[_,l]=Jr(r),[d,w]=Jr(u),M=Bw(c,_),H=Bw(c,d),q=b*b*Math.PI;return f=Bt(f)[1],h=Bt(h)[1],x=Bt(x)[1],Dw(t,g,($,E,P,J)=>$.append("svg").attr("viewBox","-8 -8 16 16").attr("width",P).attr("height",J).attr("fill",_==="color"?(Q)=>M.scale(Q):l).attr("fill-opacity",f).attr("stroke",d==="color"?(Q)=>H.scale(Q):w).attr("stroke-opacity",h).attr("stroke-width",x).append("path").attr("d",(Q)=>{let U=Wr();return t.scale(Q).draw(U,q),U}))}function Dw(t,r={},f){let{columns:u,tickFormat:h,fontVariant:x=J4(t),swatchSize:b=15,swatchWidth:g=b,swatchHeight:c=b,marginLeft:_=0,className:l,style:d,width:w}=r,M=L1(r);l=G1(l),h=G8(t.scale,t.domain,void 0,h);let H=gt("div",M).attr("class",`${l}-swatches ${l}-swatches-${u!=null?"columns":"wrap"}`),q;if(u!=null)q=`:where(.${l}-swatches-columns .${l}-swatch) { display: flex; align-items: center; break-inside: avoid; padding-bottom: 1px; } -:where(.${d}-swatches-columns .${d}-swatch::before) { +:where(.${l}-swatches-columns .${l}-swatch::before) { flex-shrink: 0; } -:where(.${d}-swatches-columns .${d}-swatch-label) { +:where(.${l}-swatches-columns .${l}-swatch-label) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -}`,i.style("columns",u).selectAll().data(t.domain).enter().append("div").attr("class",`${d}-swatch`).call(f,t,b,c).call((q)=>q.append("div").attr("class",`${d}-swatch-label`).attr("title",h).text(h));else H=`:where(.${d}-swatches-wrap) { +}`,H.style("columns",u).selectAll().data(t.domain).enter().append("div").attr("class",`${l}-swatch`).call(f,t,g,c).call(($)=>$.append("div").attr("class",`${l}-swatch-label`).attr("title",h).text(h));else q=`:where(.${l}-swatches-wrap) { display: flex; align-items: center; min-height: 33px; flex-wrap: wrap; } -:where(.${d}-swatches-wrap .${d}-swatch) { +:where(.${l}-swatches-wrap .${l}-swatch) { display: inline-flex; align-items: center; margin-right: 1em; -}`,i.selectAll().data(t.domain).enter().append("span").attr("class",`${d}-swatch`).call(f,t,b,c).append(function(){return this.ownerDocument.createTextNode(h.apply(this,arguments))});return i.call((q)=>q.insert("style","*").text(`:where(.${d}-swatches) { +}`,H.selectAll().data(t.domain).enter().append("span").attr("class",`${l}-swatch`).call(f,t,g,c).append(function(){return this.ownerDocument.createTextNode(h.apply(this,arguments))});return H.call(($)=>$.insert("style","*").text(`:where(.${l}-swatches) { font-family: system-ui, sans-serif; font-size: 10px; margin-bottom: 0.5em; } -:where(.${d}-swatch > svg) { +:where(.${l}-swatch > svg) { margin-right: 0.5em; overflow: visible; } -${H}`)).style("margin-left",l?`${+l}px`:null).style("width",w===void 0?null:`${+w}px`).style("font-variant",Kt(g,"normal")).call(N1,_).node()}var Nb=new Map([["symbol",qw],["color",nw],["opacity",Nn]]);function sw(t,r,f={}){return(u,h)=>{if(!Nb.has(u))throw Error(`unknown legend type: ${u}`);if(!(u in t))return;return Nb.get(u)(t[u],Pw(r,f[u],h),(g)=>t[g])}}function Pw({className:t,...r},{label:f,ticks:u,tickFormat:h}={},g){return Dd(g,{className:t,...r},{label:f,ticks:u,tickFormat:h})}function nw(t,{legend:r=!0,...f}){if(r===!0)r=t.type==="ordinal"?"swatches":"ramp";if(t.domain===void 0)return;switch(`${r}`.toLowerCase()){case"swatches":return Hw(t,f);case"ramp":return $_(t,f);default:throw Error(`unknown legend type: ${r}`)}}function Nn({type:t,interpolate:r,...f},{legend:u=!0,color:h=Kr(0,0,0),...g}){if(!r)throw Error(`${t} opacity scales are not supported`);if(u===!0)u="ramp";if(`${u}`.toLowerCase()!=="ramp")throw Error(`${u} opacity legends are not supported`);return nw({type:t,...f,interpolate:Un(h)},{legend:u,...g})}function Un(t){let{r,g:f,b:u}=Kr(t)||Kr(0,0,0);return(h)=>`rgba(${r},${f},${u},${h})`}function $w(t,r,f){let u=[];for(let[h,g]of Nb){let x=f[h];if(x?.legend&&h in t){let b=g(t[h],Pw(r,t[h],x),(c)=>t[c]);if(b!=null)u.push(b)}}return u}function Ub(t={},r="x"){return Hx(t)?t:{...t,[r]:wt}}function eb(t={},r="y"){return qx(t)?t:{...t,[r]:wt}}function Jw(t,r){if(r.length===1)return{data:t,facets:r};let f=Cf(t),u=new Uint8Array(f),h=0;for(let b of r)for(let c of b){if(u[c])++h;u[c]=1}if(h===0)return{data:t,facets:r};t=Uf(t);let g=t[cx]=new Uint32Array(f+h);r=r.map((b)=>Uf(b,Uint32Array));let x=f;u.fill(0);for(let b of r)for(let c=0,l=b.length;c{({data:H,facets:q}=Jw(H,q));let E=t==null?void 0:d(w8(nt(H,t),s?.[f])),P=nt(H,r,Float64Array),n=nt(H,c),$=g&&g(H,E,P,n),J=Cf(H),Q=w(new Float64Array(J)),U=i(new Float64Array(J)),e=[];for(let o of q){let K=E?Array.from(g0(o,(V)=>E[V]).values()):[o];if($)for(let V of K)V.sort($);for(let V of K){let G=0,B=0;if(x)V.reverse();for(let N of V){let W=P[N];if(W<0)G=U[N]=(Q[N]=G)+W;else if(W>0)B=U[N]=(Q[N]=B)+W;else U[N]=Q[N]=B}}e.push(K)}if(h)h(e,Q,U,n);return{data:H,facets:q}}),l,_,M]}function Vn(t){if(t==null)return;if(typeof t==="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return Wn;case"center":case"silhouette":return on;case"wiggle":return Kw}throw Error(`unknown offset: ${t}`)}function Cw(t,r){let f=0,u=0;for(let h of t){let g=r[h];if(gu)u=g}return[f,u]}function Wn(t,r,f){for(let u of t)for(let h of u){let[g,x]=Cw(h,f);for(let b of h){let c=1/(x-g||1);r[b]=c*(r[b]-g),f[b]=c*(f[b]-g)}}}function on(t,r,f){for(let u of t){for(let h of u){let[g,x]=Cw(h,f);for(let b of h){let c=(x+g)/2;r[b]-=c,f[b]-=c}}Vw(u,r,f)}Ww(t,r,f)}function Kw(t,r,f,u){for(let h of t){let g=new Mr,x=0;for(let b of h){let c=-1,l=b.map((M)=>Math.abs(f[M]-r[M])),d=b.map((M)=>{c=u?u[M]:++c;let i=f[M]-r[M],H=g.has(c)?i-g.get(c):0;return g.set(c,i),H}),_=[0,...T8(d)];for(let M of b)r[M]+=x,f[M]+=x;let w=sr(l);if(w)x-=sr(l,(M,i)=>(d[i]/2+_[i])*M)/w}Vw(h,r,f)}Ww(t,r,f)}function Vw(t,r,f){let u=br(t,(h)=>br(h,(g)=>r[g]));for(let h of t)for(let g of h)r[g]-=u,f[g]-=u}function Ww(t,r,f){let u=t.length;if(u===1)return;let h=t.map((b)=>b.flat()),g=h.map((b)=>(br(b,(c)=>r[c])+Ot(b,(c)=>f[c]))/2),x=br(g);for(let b=0;b(h,g)=>t(u[h],u[g])}function Fn(t){return(r,f,u,h)=>(g,x)=>t(h[g],h[x])}function Bn(t){return q4(t,(r,f,u,h)=>nu(_r(r),(g)=>sr(g,(x)=>u[x]),(g)=>h[g]))}function Ln(t){return q4(t,(r,f,u,h)=>nu(_r(r),(g)=>f[F1(g,(x)=>u[x])],(g)=>h[g]))}function Qw(t){return q4(t,(r,f,u,h)=>{let g=_r(r),x=nu(g,(_)=>f[F1(_,(w)=>u[w])],(_)=>h[_]),b=Or(g,(_)=>sr(_,(w)=>u[w]),(_)=>h[_]),c=[],l=[],d=0;for(let _ of x)if(d<0)d+=b.get(_),c.push(_);else d-=b.get(_),l.push(_);return l.reverse().concat(c)})}function Nw(t){return(r)=>{let f=nt(r,t);return(u,h)=>xr(f[u],f[h])}}function Gn(t){return(r)=>{return mr(r)?(f,u)=>t(r[f],r[u]):(f,u)=>t(r.get(f),r.get(u))}}function Rn(t){return q4(xr,()=>t)}function q4(t,r){return(f,u,h,g)=>{if(!g)throw Error("missing channel: z");let x=new Mr(r(f,u,h,g).map((b,c)=>[b,c]));return(b,c)=>t(x.get(g[b]),x.get(g[c]))}}var zn={ariaLabel:"rect"};class Vb extends Et{constructor(t,r={}){let{x1:f,y1:u,x2:h,y2:g}=r;super(t,{x1:{value:f,scale:"x",type:f!=null&&h==null?"band":void 0,optional:!0},y1:{value:u,scale:"y",type:u!=null&&g==null?"band":void 0,optional:!0},x2:{value:h,scale:"x",optional:!0},y2:{value:g,scale:"y",optional:!0}},r,zn);N8(this,r),U8(this,r)}render(t,r,f,u,h){let{x:g,y:x}=r,{x1:b,y1:c,x2:l,y2:d}=f,{marginTop:_,marginRight:w,marginBottom:M,marginLeft:i,width:H,height:q}=u,{projection:s}=h,{insetTop:E,insetRight:P,insetBottom:n,insetLeft:$}=this,{rx:J,ry:Q,rx1y1:U,rx1y2:e,rx2y1:o,rx2y2:K}=this;if((b||l)&&!s&&pr(g))b=l=null;if((c||d)&&!s&&pr(x))c=d=null;let V=g?.bandwidth?g.bandwidth():0,G=x?.bandwidth?x.bandwidth():0;return gt("svg:g",h).call(Ft,this,u,h).call(Bt,this,{},0,0).call((B)=>B.selectAll().data(t).enter().call(U||e||o||K?(N)=>N.append("path").call(Nt,this).call(e8,b&&l?(W)=>b[W]+(l[W]b[W]+$:i+$,c&&d?(W)=>c[W]+(d[W]c[W]+E:_+E,b&&l?(W)=>l[W]-(l[W]b[W]+V-P:H-w-P,c&&d?(W)=>d[W]-(d[W]c[W]+G-n:q-M-n,this).call(rr,this,f):(N)=>N.append("rect").call(Nt,this).attr("x",b?l?(W)=>Math.min(b[W],l[W])+$:(W)=>b[W]+$:i+$).attr("y",c?d?(W)=>Math.min(c[W],d[W])+E:(W)=>c[W]+E:_+E).attr("width",b?l?(W)=>Math.max(0,Math.abs(l[W]-b[W])+V-$-P):V-$-P:H-w-i-P-$).attr("height",c?d?(W)=>Math.max(0,Math.abs(c[W]-d[W])+G-E-n):G-E-n:q-_-M-E-n).call(y,"rx",J).call(y,"ry",Q).call(rr,this,f))).node()}}function N8(t,{inset:r=0,insetTop:f=r,insetRight:u=r,insetBottom:h=r,insetLeft:g=r}={}){t.insetTop=Tt(f),t.insetRight=Tt(u),t.insetBottom=Tt(h),t.insetLeft=Tt(g)}function U8(t,{r,rx:f,ry:u,rx1:h=r,ry1:g=r,rx2:x=r,ry2:b=r,rx1y1:c=h!==void 0?+h:g!==void 0?+g:0,rx1y2:l=h!==void 0?+h:b!==void 0?+b:0,rx2y1:d=x!==void 0?+x:g!==void 0?+g:0,rx2y2:_=x!==void 0?+x:b!==void 0?+b:0}={}){if(c||l||d||_)t.rx1y1=c,t.rx1y2=l,t.rx2y1=d,t.rx2y2=_;else t.rx=Kt(f,"auto"),t.ry=Kt(u,"auto")}function e8(t,r,f,u,h,g){let{rx1y1:x,rx1y2:b,rx2y1:c,rx2y2:l}=g;if(typeof r!=="function")r=Qr(r);if(typeof f!=="function")f=Qr(f);if(typeof u!=="function")u=Qr(u);if(typeof h!=="function")h=Qr(h);let d=Math.max(Math.abs(x+c),Math.abs(b+l)),_=Math.max(Math.abs(x+b),Math.abs(c+l));t.attr("d",(w)=>{let M=r(w),i=f(w),H=u(w),q=h(w),s=M>H,E=i>q,P=s?H:M,n=s?M:H,$=E?q:i,J=E?i:q,Q=Math.min(1,(n-P)/d,(J-$)/_),U=Q*(s?E?l:c:E?b:x),e=Q*(s?E?b:x:E?l:c),o=Q*(s?E?x:b:E?c:l),K=Q*(s?E?c:l:E?x:b);return`M${P},${$+s4(U,K)}A${U},${U} 0 0 ${U<0?0:1} ${P+E4(U,K)},${$}H${n-E4(e,o)}A${e},${e} 0 0 ${e<0?0:1} ${n},${$+s4(e,o)}V${J-s4(o,e)}A${o},${o} 0 0 ${o<0?0:1} ${n-E4(o,e)},${J}H${P+E4(K,U)}A${K},${K} 0 0 ${K<0?0:1} ${P},${J-s4(K,U)}Z`})}function E4(t,r){return r<0?t:Math.abs(t)}function s4(t,r){return r<0?Math.abs(t):t}function C8(t,r){return new Vb(t,W_(o_(r)))}var An={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Dn={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1};class ow extends Et{constructor(t={}){let{anchor:r=null}=t;super(b1,void 0,t,r==null?An:Dn);if(this.anchor=ix(r,"anchor",["top","right","bottom","left"]),N8(this,t),!r)U8(this,t)}render(t,r,f,u,h){let{marginTop:g,marginRight:x,marginBottom:b,marginLeft:c,width:l,height:d}=u,{anchor:_,insetTop:w,insetRight:M,insetBottom:i,insetLeft:H}=this,{rx:q,ry:s,rx1y1:E,rx1y2:P,rx2y1:n,rx2y2:$}=this,J=c+H,Q=l-x-M,U=g+w,e=d-b-i;return gt(_?"svg:line":E||P||n||$?"svg:path":"svg:rect",h).datum(0).call(Ft,this,u,h).call(Nt,this).call(rr,this,f).call(Bt,this,{}).call(_==="left"?(o)=>o.attr("x1",J).attr("x2",J).attr("y1",U).attr("y2",e):_==="right"?(o)=>o.attr("x1",Q).attr("x2",Q).attr("y1",U).attr("y2",e):_==="top"?(o)=>o.attr("x1",J).attr("x2",Q).attr("y1",U).attr("y2",U):_==="bottom"?(o)=>o.attr("x1",J).attr("x2",Q).attr("y1",e).attr("y2",e):E||P||n||$?(o)=>o.call(e8,J,U,Q,e,this):(o)=>o.attr("x",J).attr("y",U).attr("width",Q-J).attr("height",e-U).attr("rx",q).attr("ry",s)).node()}}function Zw(t){return new ow(t)}var Wb={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},On=new Set(["geometry","href","src","ariaLabel","scales"]);class Gw extends Et{constructor(t,r={}){if(r.tip)r={...r,tip:!1};if(r.title===void 0&&qr(t)&&Y7(t))r={...r,title:wt};let{x:f,y:u,x1:h,x2:g,y1:x,y2:b,anchor:c,preferredAnchor:l="bottom",monospace:d,fontFamily:_=d?"ui-monospace, monospace":void 0,fontSize:w,fontStyle:M,fontVariant:i,fontWeight:H,lineHeight:q=1,lineWidth:s=20,frameAnchor:E,format:P,textAnchor:n="start",textOverflow:$,textPadding:J=8,title:Q,pointerSize:U=12,pathFilter:e="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:h!=null&&g!=null?null:f,scale:"x",optional:!0},y:{value:x!=null&&b!=null?null:u,scale:"y",optional:!0},x1:{value:h,scale:"x",optional:g==null},y1:{value:x,scale:"y",optional:b==null},x2:{value:g,scale:"x",optional:h==null},y2:{value:b,scale:"y",optional:x==null},title:{value:Q,optional:!0}},r,Wb);this.anchor=a7(c,"anchor"),this.preferredAnchor=a7(l,"preferredAnchor"),this.frameAnchor=Vf(E),this.textAnchor=Kt(n,"middle"),this.textPadding=+J,this.pointerSize=+U,this.pathFilter=Zt(e),this.lineHeight=+q,this.lineWidth=+s,this.textOverflow=ib($),this.monospace=!!d,this.fontFamily=Zt(_),this.fontSize=Tt(w),this.fontStyle=Zt(M),this.fontVariant=Zt(i),this.fontWeight=Zt(H);for(let o in Wb)if(o in this.channels)this[o]=Wb[o];this.splitLines=sb(this),this.clipLine=Pb(this),this.format=typeof P==="string"||typeof P==="function"?{title:P}:{...P}}render(t,r,f,u,h){let g=this,{x,y:b,fx:c,fy:l}=r,{ownerSVGElement:d,document:_}=h,{anchor:w,monospace:M,lineHeight:i,lineWidth:H}=this,{textPadding:q,pointerSize:s,pathFilter:E}=this,{marginTop:P,marginLeft:n}=u,{x1:$,y1:J,x2:Q,y2:U,x:e=$??Q,y:o=J??U}=f,K=c?c(t.fx)-n:0,V=l?l(t.fy)-P:0,[G,B]=F0(this,u),N=ub(f,G),W=hb(f,B),p=M?i4:M4,a=p(Mu),T,L;if("title"in f)T=Tw.call(this,{title:f.channels.title},r),L=Yn;else T=Tw.call(this,f.channels,r),L=Sn;let A=gt("svg:g",h).call(Ft,this,u,h).call(Eb,this).call(Bt,this,{x:e&&x,y:o&&b}).call((rt)=>rt.selectAll().data(t).enter().append("g").attr("transform",(m)=>`translate(${Math.round(N(m))},${Math.round(W(m))})`).call(Nt,this).call((m)=>m.append("path").attr("filter",E)).call((m)=>m.append("text").each(function(ht){let Y=Pr(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let j=L.call(g,ht,t,T,r,f);if(typeof j==="string")for(let Z of g.splitLines(j))X(Y,{value:g.clipLine(Z)});else{let Z=new Set;for(let R of j){let{label:S=""}=R;if(S&&Z.has(S))continue;else Z.add(S);X(Y,R)}}})));function X(rt,{label:m,value:ht,color:Y,opacity:j}){m??="",ht??="";let Z=Y!=null||j!=null,R,S=H*100,[C]=iu(m,S,p,a);if(C>=0)m=m.slice(0,C).trimEnd()+Mu,R=ht.trim(),ht="";else{if(m||!ht&&!Z)ht=" "+ht;let[tt]=iu(ht,S-p(m),p,a);if(tt>=0)R=ht.trim(),ht=ht.slice(0,tt).trimEnd()+Mu}let ut=rt.append("tspan").attr("x",0).attr("dy",`${i}em`).text("​");if(m)ut.append("tspan").attr("font-weight","bold").text(m);if(ht)ut.append(()=>_.createTextNode(ht));if(Z)ut.append("tspan").text(" ■").attr("fill",Y).attr("fill-opacity",j).style("user-select","none");if(R)ut.append("title").text(R)}function z(){let{width:rt,height:m}=u.facet??u;A.selectChildren().each(function(ht){let{x:Y,width:j,height:Z}=this.getBBox();j=Math.round(j),Z=Math.round(Z);let R=w;if(R===void 0){let ut=N(ht)+K,tt=W(ht)+V,ct=ut+j+s+q*20,mt=tt+Z+s+q*20;R=ct&&Jt?mt&&f0?g.preferredAnchor:f0?"bottom":"top":mt&&f0?ct?"left":"right":(ct||Jt)&&(mt||f0)?`${f0?"bottom":"top"}-${ct?"left":"right"}`:g.preferredAnchor}let S=this.firstChild,C=this.lastChild;if(S.setAttribute("d",Xn(R,s,q,j,Z)),Y)for(let ut of C.childNodes)ut.setAttribute("x",-Y);C.setAttribute("y",`${+In(R,C.childNodes.length,i).toFixed(6)}em`),C.setAttribute("transform",`translate(${vn(R,s,q,j,Z)})`)}),A.attr("visibility",null)}if(t.length){if(A.attr("visibility","hidden"),d.isConnected)Promise.resolve().then(z);else if(typeof requestAnimationFrame<"u")requestAnimationFrame(z)}return A.node()}}function Rw(t,{x:r,y:f,...u}={}){if(u.frameAnchor===void 0)[r,f]=yr(r,f);return new Gw(t,{...u,x:r,y:f})}function In(t,r,f){return/^top(?:-|$)/.test(t)?0.94-f:-0.29-r*f}function vn(t,r,f,u,h){switch(t){case"middle":return[-u/2,h/2];case"top-left":return[f,r+f];case"top":return[-u/2,r/2+f];case"top-right":return[-u-f,r+f];case"right":return[-r/2-u-f,h/2];case"bottom-left":return[f,-r-f];case"bottom":return[-u/2,-r/2-f];case"bottom-right":return[-u-f,-r-f];case"left":return[f+r/2,h/2]}}function Xn(t,r,f,u,h){let g=u+f*2,x=h+f*2;switch(t){case"middle":return`M${-g/2},${-x/2}h${g}v${x}h${-g}z`;case"top-left":return`M0,0l${r},${r}h${g-r}v${x}h${-g}z`;case"top":return`M0,0l${r/2},${r/2}h${(g-r)/2}v${x}h${-g}v${-x}h${(g-r)/2}z`;case"top-right":return`M0,0l${-r},${r}h${r-g}v${x}h${g}z`;case"right":return`M0,0l${-r/2},${-r/2}v${r/2-x/2}h${-g}v${x}h${g}v${r/2-x/2}z`;case"bottom-left":return`M0,0l${r},${-r}h${g-r}v${-x}h${-g}z`;case"bottom":return`M0,0l${r/2},${-r/2}h${(g-r)/2}v${-x}h${-g}v${x}h${(g-r)/2}z`;case"bottom-right":return`M0,0l${-r},${-r}h${r-g}v${-x}h${g}z`;case"left":return`M0,0l${r/2},${-r/2}v${r/2-x/2}h${g}v${x}h${-g}v${r/2-x/2}z`}}function Tw(t,r){let f={},u=this.format;u=Fw(u,t,"x"),u=Fw(u,t,"y"),this.format=u;for(let h in u){let g=u[h];if(g===null||g===!1)continue;else if(h==="fx"||h==="fy")f[h]=!0;else{let x=Tx(t,h);if(x)f[h]=x}}for(let h in t){if(h in f||h in u||On.has(h))continue;if((h==="x"||h==="y")&&t.geometry)continue;let g=Tx(t,h);if(g){if(g.scale==null&&g.defaultScale==="color")continue;f[h]=g}}if(this.facet){if(r.fx&&!("fx"in u))f.fx=!0;if(r.fy&&!("fy"in u))f.fy=!0}for(let h in f){let g=this.format[h];if(typeof g==="string"){let x=f[h]?.value??r[h]?.domain()??[];this.format[h]=(ot(x)?Q0:or)(g)}else if(g===void 0||g===!0){let x=r[h];this.format[h]=x?.bandwidth?Q8(x,x.domain()):T0}}return f}function Fw(t,r,f){if(!(f in t))return t;let u=`${f}1`,h=`${f}2`;if(((u in t)||!(u in r))&&((h in t)||!(h in r)))return t;let g=Object.entries(t),x=t[f];return g.splice(g.findIndex(([b])=>b===f)+1,0,[u,x],[h,x]),Object.fromEntries(g)}function Yn(t,r,{title:f}){return this.format.title(f.value[t],t)}function*Sn(t,r,f,u,h){for(let g in f){if(g==="fx"||g==="fy"){yield{label:P4(u,f,g),value:this.format[g](r[g],t)};continue}if(g==="x1"&&"x2"in f)continue;if(g==="y1"&&"y2"in f)continue;let x=f[g];if(g==="x2"&&"x1"in f)yield{label:Lw(u,f,"x"),value:Bw(this.format.x2,f.x1,x,t)};else if(g==="y2"&&"y1"in f)yield{label:Lw(u,f,"y"),value:Bw(this.format.y2,f.y1,x,t)};else{let b=x.value[t],c=x.scale;if(!Rr(b)&&c==null)continue;yield{label:P4(u,f,g),value:this.format[g](b,t),color:c==="color"?h[g][t]:null,opacity:c==="opacity"?h[g][t]:null}}}}function Bw(t,r,f,u){return f.hint?.length?`${t(f.value[u]-r.value[u],u)}`:`${t(r.value[u],u)}–${t(f.value[u],u)}`}function Lw(t,r,f){let u=P4(t,r,`${f}1`,f),h=P4(t,r,`${f}2`,f);return u===h?u:`${u}–${h}`}function P4(t,r,f,u=f){let h=r[f],g=t[h?.scale??f];return String(g?.label??h?.label??u)}function wr(t={}){let{facet:r,style:f,title:u,subtitle:h,caption:g,ariaLabel:x,ariaDescription:b}=t,c=Q1(t.className),l=t.marks===void 0?[]:Aw(t.marks);l.push(...pn(l));let d=yn(r,t),_=new Map;for(let T of l){let L=Dw(T,d,t);if(L)_.set(T,L)}let w=new Map;if(d)K8(w,[d],t);K8(w,_,t);let M=Aw(t$(l,w,t));for(let T of M){let L=Dw(T,d,t);if(L)_.set(T,L)}l.unshift(...M);let i=pl(w,t);if(i!==void 0){let T=d?h4(i,d):void 0;for(let A of l){if(A.facet===null||A.facet==="super")continue;let X=_.get(A);if(X===void 0)continue;X.facetsIndex=A.fx!=null||A.fy!=null?h4(i,X):T}let L=new Set;for(let{facetsIndex:A}of _.values())A?.forEach((X,z)=>{if(X?.length>0)L.add(z)});i.forEach(0A.empty=!L.has(X):(A)=>A.empty=!1);for(let A of l)if(A.facet==="exclude"){let X=_.get(A);if(X!==void 0)X.facetsIndex=f_(X.facetsIndex)}}for(let T of Mt.keys())if(c1(t[T])&&T!=="fx"&&T!=="fy")w.set(T,[]);let H=new Map;for(let T of l){if(H.has(T))throw Error("duplicate mark; each mark must be unique");let{facetsIndex:L,channels:A}=_.get(T)??{},{data:X,facets:z,channels:rt}=T.initialize(L,A,t);Zb(rt,t),H.set(T,{data:X,facets:z,channels:rt})}let q=s8(K8(w,H,t),t),s=E_(q,l,t);Sl(q,s);let E=Ix(q),{fx:P,fy:n}=E,$=P||n?vx(q,s):s,J=P||n?b$(E,s):s,Q=J1(t),U=Q.document,e=c0("svg").call(U.documentElement),o=e;Q.ownerSVGElement=e,Q.className=c,Q.projection=g_(t,$),Q.path=function(){return mf(this.projection??__(E))},Q.filterFacets=(T,L)=>{return h4(i,{channels:L,groups:f4(T,L)})},Q.getMarkState=(T)=>{let L=H.get(T),A=_.get(T);return{...L,channels:{...L.channels,...A?.channels}}},Q.dispatchValue=(T)=>{if(o.value===T)return;o.value=T,o.dispatchEvent(new Q.document.defaultView.Event("input",{bubbles:!0}))};let K=new Set;for(let[T,L]of H)if(T.initializer!=null){let A=T.facet==="super"?J:$,X=T.initializer(L.data,L.facets,L.channels,E,A,Q);if(X.data!==void 0)L.data=X.data;if(X.facets!==void 0)L.facets=X.facets;if(X.channels!==void 0){let{fx:z,fy:rt,...m}=X.channels;jn(m),Object.assign(L.channels,m);for(let ht of Object.values(m)){let{scale:Y}=ht;if(Y!=null&&!Xd(Mt.get(Y)))Xw(ht,t),K.add(Y)}if(z!=null||rt!=null)_.set(T,!0)}}if(K.size){let T=new Map;K8(T,H,t,(z)=>K.has(z)),K8(w,H,t,(z)=>K.has(z));let L=x$(s8(T,t),q),{scales:A,...X}=Ix(L);Object.assign(q,L),Object.assign(E,X),Object.assign(E.scales,A)}let V,G;if(i!==void 0)V={x:P?.domain(),y:n?.domain()},i=t_(i,V),G=r_(P,n,s);for(let[T,L]of H)L.values=T.scale(L.channels,E,Q);let{width:B,height:N}=s;Pr(e).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",B).attr("height",N).attr("viewBox",`0 0 ${B} ${N}`).attr("aria-label",x).attr("aria-description",b).call((T)=>T.append("style").text(`:where(.${c}) { +${q}`)).style("margin-left",_?`${+_}px`:null).style("width",w===void 0?null:`${+w}px`).style("font-variant",zt(x,"normal")).call(B1,d).node()}var Dg=new Map([["symbol",Rw],["color",sw],["opacity",kQ]]);function Aw(t,r,f={}){return(u,h)=>{if(!Dg.has(u))throw Error(`unknown legend type: ${u}`);if(!(u in t))return;return Dg.get(u)(t[u],Ow(r,f[u],h),(x)=>t[x])}}function Ow({className:t,...r},{label:f,ticks:u,tickFormat:h}={},x){return bl(x,{className:t,...r},{label:f,ticks:u,tickFormat:h})}function sw(t,{legend:r=!0,...f}){if(r===!0)r=t.type==="ordinal"?"swatches":"ramp";if(t.domain===void 0)return;switch(`${r}`.toLowerCase()){case"swatches":return zw(t,f);case"ramp":return Id(t,f);default:throw Error(`unknown legend type: ${r}`)}}function kQ({type:t,interpolate:r,...f},{legend:u=!0,color:h=Br(0,0,0),...x}){if(!r)throw Error(`${t} opacity scales are not supported`);if(u===!0)u="ramp";if(`${u}`.toLowerCase()!=="ramp")throw Error(`${u} opacity legends are not supported`);return sw({type:t,...f,interpolate:pQ(h)},{legend:u,...x})}function pQ(t){let{r,g:f,b:u}=Br(t)||Br(0,0,0);return(h)=>`rgba(${r},${f},${u},${h})`}function Iw(t,r,f){let u=[];for(let[h,x]of Dg){let b=f[h];if(b?.legend&&h in t){let g=x(t[h],Ow(r,t[h],b),(c)=>t[c]);if(g!=null)u.push(g)}}return u}function Ag(t={},r="x"){return Nb(t)?t:{...t,[r]:$t}}function Og(t={},r="y"){return Tb(t)?t:{...t,[r]:$t}}function nw(t,r){if(r.length===1)return{data:t,facets:r};let f=Ff(t),u=new Uint8Array(f),h=0;for(let g of r)for(let c of g){if(u[c])++h;u[c]=1}if(h===0)return{data:t,facets:r};t=Nf(t);let x=t[Ub]=new Uint32Array(f+h);r=r.map((g)=>Nf(g,Uint32Array));let b=f;u.fill(0);for(let g of r)for(let c=0,_=g.length;c<_;++c){let l=g[c];if(u[l])g[c]=b,t[b]=t[l],x[b]=l,++b;else x[l]=l;u[l]=1}return{data:t,facets:r}}function tU(t={},r={}){if(arguments.length===1)[t,r]=Yw(t);let{y1:f,y:u=f,x:h,...x}=r,[b,g,c,_]=Sw(u,h,"y","x",t,x);return{...b,y1:f,y:g,x1:c,x2:_,x:U1(c,_)}}function rU(t={},r={}){if(arguments.length===1)[t,r]=Yw(t);let{x1:f,x:u=f,y:h,...x}=r,[b,g,c,_]=Sw(u,h,"x","y",t,x);return{...b,x1:f,x:g,y1:c,y2:_,y:U1(c,_)}}function sg({x:t,x1:r,x2:f,...u}={}){if(u=zf(u,"y"),r===void 0&&f===void 0)return tU({x:t,...u});return[r,f]=Lb(t,r,f),{...u,x1:r,x2:f}}function Ig({y:t,y1:r,y2:f,...u}={}){if(u=zf(u,"x"),r===void 0&&f===void 0)return rU({y:t,...u});return[r,f]=Lb(t,r,f),{...u,y1:r,y2:f}}function Yw(t){let{offset:r,order:f,reverse:u,...h}=t;return[{offset:r,order:f,reverse:u},h]}var fU={length:!0};function Sw(t,r=o_,f,u,{offset:h,order:x,reverse:b},g){if(r===null)throw Error(`stack requires ${u}`);let c=J1(g),[_,l]=Sr(t),[d,w]=Q1(r),[M,H]=Q1(r);return d.hint=M.hint=fU,h=uU(h),x=bU(x,h,u),[Eu(g,(q,$,E)=>{({data:q,facets:$}=nw(q,$));let P=t==null?void 0:l(U8(Ct(q,t),E?.[f])),J=Ct(q,r,Float64Array),Q=Ct(q,c),U=x&&x(q,P,J,Q),C=Ff(q),W=w(new Float64Array(C)),i=H(new Float64Array(C)),Z=[];for(let R of $){let z=P?Array.from(_0(R,(G)=>P[G]).values()):[R];if(U)for(let G of z)G.sort(U);for(let G of z){let N=0,L=0;if(b)G.reverse();for(let K of G){let V=J[K];if(V<0)N=i[K]=(W[K]=N)+V;else if(V>0)L=i[K]=(W[K]=L)+V;else i[K]=W[K]=L}}Z.push(z)}if(h)h(Z,W,i,Q);return{data:q,facets:$}}),_,d,M]}function uU(t){if(t==null)return;if(typeof t==="function")return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return hU;case"center":case"silhouette":return xU;case"wiggle":return mw}throw Error(`unknown offset: ${t}`)}function ow(t,r){let f=0,u=0;for(let h of t){let x=r[h];if(xu)u=x}return[f,u]}function hU(t,r,f){for(let u of t)for(let h of u){let[x,b]=ow(h,f);for(let g of h){let c=1/(b-x||1);r[g]=c*(r[g]-x),f[g]=c*(f[g]-x)}}}function xU(t,r,f){for(let u of t){for(let h of u){let[x,b]=ow(h,f);for(let g of h){let c=(b+x)/2;r[g]-=c,f[g]-=c}}jw(u,r,f)}ew(t,r,f)}function mw(t,r,f,u){for(let h of t){let x=new Pr,b=0;for(let g of h){let c=-1,_=g.map((M)=>Math.abs(f[M]-r[M])),l=g.map((M)=>{c=u?u[M]:++c;let H=f[M]-r[M],q=x.has(c)?H-x.get(c):0;return x.set(c,H),q}),d=[0,...X8(l)];for(let M of g)r[M]+=b,f[M]+=b;let w=Cr(_);if(w)b-=Cr(_,(M,H)=>(l[H]/2+d[H])*M)/w}jw(h,r,f)}ew(t,r,f)}function jw(t,r,f){let u=dr(t,(h)=>dr(h,(x)=>r[x]));for(let h of t)for(let x of h)r[x]-=u,f[x]-=u}function ew(t,r,f){let u=t.length;if(u===1)return;let h=t.map((g)=>g.flat()),x=h.map((g)=>(dr(g,(c)=>r[c])+ot(g,(c)=>f[c]))/2),b=dr(x);for(let g=0;g(h,x)=>t(u[h],u[x])}function cU(t){return(r,f,u,h)=>(x,b)=>t(h[x],h[b])}function _U(t){return i4(t,(r,f,u,h)=>Tu($r(r),(x)=>Cr(x,(b)=>u[b]),(x)=>h[x]))}function lU(t){return i4(t,(r,f,u,h)=>Tu($r(r),(x)=>f[v1(x,(b)=>u[b])],(x)=>h[x]))}function Xw(t){return i4(t,(r,f,u,h)=>{let x=$r(r),b=Tu(x,(d)=>f[v1(d,(w)=>u[w])],(d)=>h[d]),g=mr(x,(d)=>Cr(d,(w)=>u[w]),(d)=>h[d]),c=[],_=[],l=0;for(let d of b)if(l<0)l+=g.get(d),c.push(d);else l-=g.get(d),_.push(d);return _.reverse().concat(c)})}function vw(t){return(r)=>{let f=Ct(r,t);return(u,h)=>_r(f[u],f[h])}}function dU(t){return(r)=>{return pr(r)?(f,u)=>t(r[f],r[u]):(f,u)=>t(r.get(f),r.get(u))}}function wU(t){return i4(_r,()=>t)}function i4(t,r){return(f,u,h,x)=>{if(!x)throw Error("missing channel: z");let b=new Pr(r(f,u,h,x).map((g,c)=>[g,c]));return(g,c)=>t(b.get(x[g]),b.get(x[c]))}}var MU={ariaLabel:"rect"};class ng extends wt{constructor(t,r={}){let{x1:f,y1:u,x2:h,y2:x}=r;super(t,{x1:{value:f,scale:"x",type:f!=null&&h==null?"band":void 0,optional:!0},y1:{value:u,scale:"y",type:u!=null&&x==null?"band":void 0,optional:!0},x2:{value:h,scale:"x",optional:!0},y2:{value:x,scale:"y",optional:!0}},r,MU);B8(this,r),z8(this,r)}render(t,r,f,u,h){let{x,y:b}=r,{x1:g,y1:c,x2:_,y2:l}=f,{marginTop:d,marginRight:w,marginBottom:M,marginLeft:H,width:q,height:$}=u,{projection:E}=h,{insetTop:P,insetRight:J,insetBottom:Q,insetLeft:U}=this,{rx:C,ry:W,rx1y1:i,rx1y2:Z,rx2y1:R,rx2y2:z}=this;if((g||_)&&!E&&u0(x))g=_=null;if((c||l)&&!E&&u0(b))c=l=null;let G=x?.bandwidth?x.bandwidth():0,N=b?.bandwidth?b.bandwidth():0;return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,{},0,0).call((L)=>L.selectAll().data(t).enter().call(i||Z||R||z?(K)=>K.append("path").call(Kt,this).call(R8,g&&_?(V)=>g[V]+(_[V]g[V]+U:H+U,c&&l?(V)=>c[V]+(l[V]c[V]+P:d+P,g&&_?(V)=>_[V]-(_[V]g[V]+G-J:q-w-J,c&&l?(V)=>l[V]-(l[V]c[V]+N-Q:$-M-Q,this).call(Yt,this,f):(K)=>K.append("rect").call(Kt,this).attr("x",g?_?(V)=>Math.min(g[V],_[V])+U:(V)=>g[V]+U:H+U).attr("y",c?l?(V)=>Math.min(c[V],l[V])+P:(V)=>c[V]+P:d+P).attr("width",g?_?(V)=>Math.max(0,Math.abs(_[V]-g[V])+G-U-J):G-U-J:q-w-H-J-U).attr("height",c?l?(V)=>Math.max(0,Math.abs(c[V]-l[V])+N-P-Q):N-P-Q:$-d-M-P-Q).call(rt,"rx",C).call(rt,"ry",W).call(Yt,this,f))).node()}}function B8(t,{inset:r=0,insetTop:f=r,insetRight:u=r,insetBottom:h=r,insetLeft:x=r}={}){t.insetTop=Ot(f),t.insetRight=Ot(u),t.insetBottom=Ot(h),t.insetLeft=Ot(x)}function z8(t,{r,rx:f,ry:u,rx1:h=r,ry1:x=r,rx2:b=r,ry2:g=r,rx1y1:c=h!==void 0?+h:x!==void 0?+x:0,rx1y2:_=h!==void 0?+h:g!==void 0?+g:0,rx2y1:l=b!==void 0?+b:x!==void 0?+x:0,rx2y2:d=b!==void 0?+b:g!==void 0?+g:0}={}){if(c||_||l||d)t.rx1y1=c,t.rx1y2=_,t.rx2y1=l,t.rx2y2=d;else t.rx=zt(f,"auto"),t.ry=zt(u,"auto")}function R8(t,r,f,u,h,x){let{rx1y1:b,rx1y2:g,rx2y1:c,rx2y2:_}=x;if(typeof r!=="function")r=Nr(r);if(typeof f!=="function")f=Nr(f);if(typeof u!=="function")u=Nr(u);if(typeof h!=="function")h=Nr(h);let l=Math.max(Math.abs(b+c),Math.abs(g+_)),d=Math.max(Math.abs(b+g),Math.abs(c+_));t.attr("d",(w)=>{let M=r(w),H=f(w),q=u(w),$=h(w),E=M>q,P=H>$,J=E?q:M,Q=E?M:q,U=P?$:H,C=P?H:$,W=Math.min(1,(Q-J)/l,(C-U)/d),i=W*(E?P?_:c:P?g:b),Z=W*(E?P?g:b:P?_:c),R=W*(E?P?b:g:P?c:_),z=W*(E?P?c:_:P?b:g);return`M${J},${U+V4(i,z)}A${i},${i} 0 0 ${i<0?0:1} ${J+Z4(i,z)},${U}H${Q-Z4(Z,R)}A${Z},${Z} 0 0 ${Z<0?0:1} ${Q},${U+V4(Z,R)}V${C-V4(R,Z)}A${R},${R} 0 0 ${R<0?0:1} ${Q-Z4(R,Z)},${C}H${J+Z4(z,i)}A${z},${z} 0 0 ${z<0?0:1} ${J},${C-V4(z,i)}Z`})}function Z4(t,r){return r<0?t:Math.abs(t)}function V4(t,r){return r<0?Math.abs(t):t}function Cu(t,r){return new ng(t,ed(ad(r)))}var HU={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},qU={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1};class aw extends wt{constructor(t={}){let{anchor:r=null}=t;super($1,void 0,t,r==null?HU:qU);if(this.anchor=Vb(r,"anchor",["top","right","bottom","left"]),B8(this,t),!r)z8(this,t)}render(t,r,f,u,h){let{marginTop:x,marginRight:b,marginBottom:g,marginLeft:c,width:_,height:l}=u,{anchor:d,insetTop:w,insetRight:M,insetBottom:H,insetLeft:q}=this,{rx:$,ry:E,rx1y1:P,rx1y2:J,rx2y1:Q,rx2y2:U}=this,C=c+q,W=_-b-M,i=x+w,Z=l-g-H;return gt(d?"svg:line":P||J||Q||U?"svg:path":"svg:rect",h).datum(0).call(Tt,this,u,h).call(Kt,this).call(Yt,this,f).call(Ft,this,{}).call(d==="left"?(R)=>R.attr("x1",C).attr("x2",C).attr("y1",i).attr("y2",Z):d==="right"?(R)=>R.attr("x1",W).attr("x2",W).attr("y1",i).attr("y2",Z):d==="top"?(R)=>R.attr("x1",C).attr("x2",W).attr("y1",i).attr("y2",i):d==="bottom"?(R)=>R.attr("x1",C).attr("x2",W).attr("y1",Z).attr("y2",Z):P||J||Q||U?(R)=>R.call(R8,C,i,W,Z,this):(R)=>R.attr("x",C).attr("y",i).attr("width",W-C).attr("height",Z-i).attr("rx",$).attr("ry",E)).node()}}function yw(t){return new aw(t)}var Xg={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},$U=new Set(["geometry","href","src","ariaLabel","scales"]);class fM extends wt{constructor(t,r={}){if(r.tip)r={...r,tip:!1};if(r.title===void 0&&Qr(t)&&r4(t))r={...r,title:$t};let{x:f,y:u,x1:h,x2:x,y1:b,y2:g,anchor:c,preferredAnchor:_="bottom",monospace:l,fontFamily:d=l?"ui-monospace, monospace":void 0,fontSize:w,fontStyle:M,fontVariant:H,fontWeight:q,lineHeight:$=1,lineWidth:E=20,frameAnchor:P,format:J,textAnchor:Q="start",textOverflow:U,textPadding:C=8,title:W,pointerSize:i=12,pathFilter:Z="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:h!=null&&x!=null?null:f,scale:"x",optional:!0},y:{value:b!=null&&g!=null?null:u,scale:"y",optional:!0},x1:{value:h,scale:"x",optional:x==null},y1:{value:b,scale:"y",optional:g==null},x2:{value:x,scale:"x",optional:h==null},y2:{value:g,scale:"y",optional:b==null},title:{value:W,optional:!0}},r,Xg);this.anchor=u4(c,"anchor"),this.preferredAnchor=u4(_,"preferredAnchor"),this.frameAnchor=Gf(P),this.textAnchor=zt(Q,"middle"),this.textPadding=+C,this.pointerSize=+i,this.pathFilter=At(Z),this.lineHeight=+$,this.lineWidth=+E,this.textOverflow=Zg(U),this.monospace=!!l,this.fontFamily=At(d),this.fontSize=Ot(w),this.fontStyle=At(M),this.fontVariant=At(H),this.fontWeight=At(q);for(let R in Xg)if(R in this.channels)this[R]=Xg[R];this.splitLines=Fg(this),this.clipLine=Lg(this),this.format=typeof J==="string"||typeof J==="function"?{title:J}:{...J}}render(t,r,f,u,h){let x=this,{x:b,y:g,fx:c,fy:_}=r,{ownerSVGElement:l,document:d}=h,{anchor:w,monospace:M,lineHeight:H,lineWidth:q}=this,{textPadding:$,pointerSize:E,pathFilter:P}=this,{marginTop:J,marginLeft:Q}=u,{x1:U,y1:C,x2:W,y2:i,x:Z=U??W,y:R=C??i}=f,z=c?c(t.fx)-Q:0,G=_?_(t.fy)-J:0,[N,L]=A0(this,u),K=$g(f,N),V=Pg(f,L),y=M?K4:C4,I=y(Qu),A,s;if("title"in f)A=kw.call(this,{title:f.channels.title},r),s=QU;else A=kw.call(this,f.channels,r),s=UU;let Y=gt("svg:g",h).call(Tt,this,u,h).call(Tg,this).call(Ft,this,{x:Z&&b,y:R&&g}).call((ht)=>ht.selectAll().data(t).enter().append("g").attr("transform",(p)=>`translate(${Math.round(K(p))},${Math.round(V(p))})`).call(Kt,this).call((p)=>p.append("path").attr("filter",P)).call((p)=>p.append("text").each(function(ct){let a=Kr(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let tt=s.call(x,ct,t,A,r,f);if(typeof tt==="string")for(let D of x.splitLines(tt))m(a,{value:x.clipLine(D)});else{let D=new Set;for(let v of tt){let{label:k=""}=v;if(k&&D.has(k))continue;else D.add(k);m(a,v)}}})));function m(ht,{label:p,value:ct,color:a,opacity:tt}){p??="",ct??="";let D=a!=null||tt!=null,v,k=q*100,[B]=Uu(p,k,y,I);if(B>=0)p=p.slice(0,B).trimEnd()+Qu,v=ct.trim(),ct="";else{if(p||!ct&&!D)ct=" "+ct;let[ut]=Uu(ct,k-y(p),y,I);if(ut>=0)v=ct.trim(),ct=ct.slice(0,ut).trimEnd()+Qu}let bt=ht.append("tspan").attr("x",0).attr("dy",`${H}em`).text("​");if(p)bt.append("tspan").attr("font-weight","bold").text(p);if(ct)bt.append(()=>d.createTextNode(ct));if(D)bt.append("tspan").text(" ■").attr("fill",a).attr("fill-opacity",tt).style("user-select","none");if(v)bt.append("title").text(v)}function X(){let{width:ht,height:p}=u.facet??u;Y.selectChildren().each(function(ct){let{x:a,width:tt,height:D}=this.getBBox();tt=Math.round(tt),D=Math.round(D);let v=w;if(v===void 0){let bt=K(ct)+z,ut=V(ct)+G,dt=bt+tt+E+$*20,pt=ut+D+E+$*20;v=dt&&Vt?pt&&b0?x.preferredAnchor:b0?"bottom":"top":pt&&b0?dt?"left":"right":(dt||Vt)&&(pt||b0)?`${b0?"bottom":"top"}-${dt?"left":"right"}`:x.preferredAnchor}let k=this.firstChild,B=this.lastChild;if(k.setAttribute("d",JU(v,E,$,tt,D)),a)for(let bt of B.childNodes)bt.setAttribute("x",-a);B.setAttribute("y",`${+PU(v,B.childNodes.length,H).toFixed(6)}em`),B.setAttribute("transform",`translate(${EU(v,E,$,tt,D)})`)}),Y.attr("visibility",null)}if(t.length){if(Y.attr("visibility","hidden"),l.isConnected)Promise.resolve().then(X);else if(typeof requestAnimationFrame<"u")requestAnimationFrame(X)}return Y.node()}}function uM(t,{x:r,y:f,...u}={}){if(u.frameAnchor===void 0)[r,f]=r0(r,f);return new fM(t,{...u,x:r,y:f})}function PU(t,r,f){return/^top(?:-|$)/.test(t)?0.94-f:-0.29-r*f}function EU(t,r,f,u,h){switch(t){case"middle":return[-u/2,h/2];case"top-left":return[f,r+f];case"top":return[-u/2,r/2+f];case"top-right":return[-u-f,r+f];case"right":return[-r/2-u-f,h/2];case"bottom-left":return[f,-r-f];case"bottom":return[-u/2,-r/2-f];case"bottom-right":return[-u-f,-r-f];case"left":return[f+r/2,h/2]}}function JU(t,r,f,u,h){let x=u+f*2,b=h+f*2;switch(t){case"middle":return`M${-x/2},${-b/2}h${x}v${b}h${-x}z`;case"top-left":return`M0,0l${r},${r}h${x-r}v${b}h${-x}z`;case"top":return`M0,0l${r/2},${r/2}h${(x-r)/2}v${b}h${-x}v${-b}h${(x-r)/2}z`;case"top-right":return`M0,0l${-r},${r}h${r-x}v${b}h${x}z`;case"right":return`M0,0l${-r/2},${-r/2}v${r/2-b/2}h${-x}v${b}h${x}v${r/2-b/2}z`;case"bottom-left":return`M0,0l${r},${-r}h${x-r}v${-b}h${-x}z`;case"bottom":return`M0,0l${r/2},${-r/2}h${(x-r)/2}v${-b}h${-x}v${b}h${(x-r)/2}z`;case"bottom-right":return`M0,0l${-r},${-r}h${r-x}v${-b}h${x}z`;case"left":return`M0,0l${r/2},${-r/2}v${r/2-b/2}h${x}v${b}h${-x}v${r/2-b/2}z`}}function kw(t,r){let f={},u=this.format;u=pw(u,t,"x"),u=pw(u,t,"y"),this.format=u;for(let h in u){let x=u[h];if(x===null||x===!1)continue;else if(h==="fx"||h==="fy")f[h]=!0;else{let b=ob(t,h);if(b)f[h]=b}}for(let h in t){if(h in f||h in u||$U.has(h))continue;if((h==="x"||h==="y")&&t.geometry)continue;let x=ob(t,h);if(x){if(x.scale==null&&x.defaultScale==="color")continue;f[h]=x}}if(this.facet){if(r.fx&&!("fx"in u))f.fx=!0;if(r.fy&&!("fy"in u))f.fy=!0}for(let h in f){let x=this.format[h];if(typeof x==="string"){let b=f[h]?.value??r[h]?.domain()??[];this.format[h]=(Dt(b)?V0:Dr)(x)}else if(x===void 0||x===!0){let b=r[h];this.format[h]=b?.bandwidth?G8(b,b.domain()):D0}}return f}function pw(t,r,f){if(!(f in t))return t;let u=`${f}1`,h=`${f}2`;if(((u in t)||!(u in r))&&((h in t)||!(h in r)))return t;let x=Object.entries(t),b=t[f];return x.splice(x.findIndex(([g])=>g===f)+1,0,[u,b],[h,b]),Object.fromEntries(x)}function QU(t,r,{title:f}){return this.format.title(f.value[t],t)}function*UU(t,r,f,u,h){for(let x in f){if(x==="fx"||x==="fy"){yield{label:N4(u,f,x),value:this.format[x](r[x],t)};continue}if(x==="x1"&&"x2"in f)continue;if(x==="y1"&&"y2"in f)continue;let b=f[x];if(x==="x2"&&"x1"in f)yield{label:rM(u,f,"x"),value:tM(this.format.x2,f.x1,b,t)};else if(x==="y2"&&"y1"in f)yield{label:rM(u,f,"y"),value:tM(this.format.y2,f.y1,b,t)};else{let g=b.value[t],c=b.scale;if(!vr(g)&&c==null)continue;yield{label:N4(u,f,x),value:this.format[x](g,t),color:c==="color"?h[x][t]:null,opacity:c==="opacity"?h[x][t]:null}}}}function tM(t,r,f,u){return f.hint?.length?`${t(f.value[u]-r.value[u],u)}`:`${t(r.value[u],u)}–${t(f.value[u],u)}`}function rM(t,r,f){let u=N4(t,r,`${f}1`,f),h=N4(t,r,`${f}2`,f);return u===h?u:`${u}–${h}`}function N4(t,r,f,u=f){let h=r[f],x=t[h?.scale??f];return String(x?.label??h?.label??u)}function lr(t={}){let{facet:r,style:f,title:u,subtitle:h,caption:x,ariaLabel:b,ariaDescription:g}=t,c=G1(t.className),_=t.marks===void 0?[]:xM(t.marks);_.push(...VU(_));let l=iU(r,t),d=new Map;for(let A of _){let s=bM(A,l,t);if(s)d.set(A,s)}let w=new Map;if(l)D8(w,[l],t);D8(w,d,t);let M=xM(NU(_,w,t));for(let A of M){let s=bM(A,l,t);if(s)d.set(A,s)}_.unshift(...M);let H=Ed(w,t);if(H!==void 0){let A=l?M4(H,l):void 0;for(let Y of _){if(Y.facet===null||Y.facet==="super")continue;let m=d.get(Y);if(m===void 0)continue;m.facetsIndex=Y.fx!=null||Y.fy!=null?M4(H,m):A}let s=new Set;for(let{facetsIndex:Y}of d.values())Y?.forEach((m,X)=>{if(m?.length>0)s.add(X)});H.forEach(0Y.empty=!s.has(m):(Y)=>Y.empty=!1);for(let Y of _)if(Y.facet==="exclude"){let m=d.get(Y);if(m!==void 0)m.facetsIndex=Ud(m.facetsIndex)}}for(let A of Pt.keys())if(P1(t[A])&&A!=="fx"&&A!=="fy")w.set(A,[]);let q=new Map;for(let A of _){if(q.has(A))throw Error("duplicate mark; each mark must be unique");let{facetsIndex:s,channels:Y}=d.get(A)??{},{data:m,facets:X,channels:ht}=A.initialize(s,Y,t);Yg(ht,t),q.set(A,{data:m,facets:X,channels:ht})}let $=V8(D8(w,q,t),t),E=Dd($,_,t);wd($,E);let P=fg($),{fx:J,fy:Q}=P,U=J||Q?ug($,E):E,C=J||Q?RU(P,E):E,W=L1(t),i=W.document,Z=w0("svg").call(i.documentElement),R=Z;W.ownerSVGElement=Z,W.className=c,W.projection=Wd(t,U),W.path=function(){return ru(this.projection??Fd(P))},W.filterFacets=(A,s)=>{return M4(H,{channels:s,groups:d4(A,s)})},W.getMarkState=(A)=>{let s=q.get(A),Y=d.get(A);return{...s,channels:{...s.channels,...Y?.channels}}},W.dispatchValue=(A)=>{if(R.value===A)return;R.value=A,R.dispatchEvent(new W.document.defaultView.Event("input",{bubbles:!0}))};let z=new Set;for(let[A,s]of q)if(A.initializer!=null){let Y=A.facet==="super"?C:U,m=A.initializer(s.data,s.facets,s.channels,P,Y,W);if(m.data!==void 0)s.data=m.data;if(m.facets!==void 0)s.facets=m.facets;if(m.channels!==void 0){let{fx:X,fy:ht,...p}=m.channels;WU(p),Object.assign(s.channels,p);for(let ct of Object.values(p)){let{scale:a}=ct;if(a!=null&&!ll(Pt.get(a)))lM(ct,t),z.add(a)}if(X!=null||ht!=null)d.set(A,!0)}}if(z.size){let A=new Map;D8(A,q,t,(X)=>z.has(X)),D8(w,q,t,(X)=>z.has(X));let s=zU(V8(A,t),$),{scales:Y,...m}=fg(s);Object.assign($,s),Object.assign(P,m),Object.assign(P.scales,Y)}let G,N;if(H!==void 0)G={x:J?.domain(),y:Q?.domain()},H=Jd(H,G),N=Qd(J,Q,E);for(let[A,s]of q)s.values=A.scale(s.channels,P,W);let{width:L,height:K}=E;Kr(Z).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",L).attr("height",K).attr("viewBox",`0 0 ${L} ${K}`).attr("aria-label",b).attr("aria-description",g).call((A)=>A.append("style").text(`:where(.${c}) { --plot-background: white; display: block; height: auto; @@ -655,4 +655,21 @@ ${H}`)).style("margin-left",l?`${+l}px`:null).style("width",w===void 0?null:`${+ :where(.${c} text), :where(.${c} tspan) { white-space: pre; -}`)).call(N1,f);for(let T of l){let{channels:L,values:A,facets:X}=H.get(T);if(i===void 0||T.facet==="super"){let z=null;if(X){if(z=X[0],z=T.filter(z,L,A),z.length===0)continue}let rt=T.render(z,E,A,J,Q);if(rt==null)continue;e.appendChild(rt)}else{let z;for(let rt of i){if(!(T.facetAnchor?.(i,V,rt)??!rt.empty))continue;let m=null;if(X){let Y=_.has(T);if(m=X[Y?rt.i:0],m=T.filter(m,L,A),m.length===0)continue;if(!Y&&m===X[0])m=od(m);m.fx=rt.x,m.fy=rt.y,m.fi=rt.i}let ht=T.render(m,E,A,$,Q);if(ht==null)continue;(z??=Pr(e).append("g")).append(()=>ht).datum(rt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])if(ht.hasAttribute(Y))z.attr(Y,ht.getAttribute(Y)),ht.removeAttribute(Y)}z?.selectChildren().each(G)}}let W=$w(q,Q,t),{figure:p=u!=null||h!=null||g!=null||W.length>0}=t;if(p){if(o=U.createElement("figure"),o.className=`${c}-figure`,o.style.maxWidth="initial",u!=null)o.append(zw(U,u,"h2"));if(h!=null)o.append(zw(U,h,"h3"));if(o.append(...W,e),g!=null)o.append(an(U,g));if("value"in e)o.value=e.value,delete e.value}o.scale=yl(E.scales),o.legend=sw(q,Q,t);let a=Kl();if(a>0)Pr(e).append("text").attr("x",B).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("⚠️").append("title").text(`${a.toLocaleString("en-US")} warning${a===1?"":"s"}. Please check the console.`);return o}function zw(t,r,f){if(r.ownerDocument)return r;let u=t.createElement(f);return u.append(r),u}function an(t,r){let f=t.createElement("figcaption");return f.append(r),f}function Aw(t){return t.flat(1/0).filter((r)=>r!=null).map(mn)}function mn(t){return typeof t.render==="function"?t:new vw(t)}class vw extends Et{constructor(t){if(typeof t!=="function")throw TypeError("invalid mark; missing render function");super();this.render=t}render(){}}function Zb(t,r){for(let f in t)Xw(t[f],r);return t}function Xw(t,r){let{scale:f,transform:u=!0}=t;if(f==null||!u)return;let{type:h,percent:g,interval:x,transform:b=g?(c)=>c==null?NaN:c*100:Px(x,h)}=r[f]??{};if(b==null)return;t.value=_t(t.value,b),t.transform=!1}function jn(t){for(let r in t)Zx(r,t[r])}function K8(t,r,f,u=Kd){for(let{channels:h}of r.values())for(let g in h){let x=h[g],{scale:b}=x;if(b!=null&&u(b))if(b==="projection"){if(!c_(f)){let c=f.x?.domain===void 0,l=f.y?.domain===void 0;if(c||l){let[d,_]=l_(x);if(c)ob(t,"x",d);if(l)ob(t,"y",_)}}}else ob(t,b,x)}return t}function ob(t,r,f){let u=t.get(r);if(u!==void 0)u.push(f);else t.set(r,[f])}function yn(t,r){if(t==null)return;let{x:f,y:u}=t;if(f==null&&u==null)return;let h=rf(t.data);if(h==null)throw Error("missing facet data");let g={};if(f!=null)g.fx=q1(h,{value:f,scale:"fx"});if(u!=null)g.fy=q1(h,{value:u,scale:"fy"});Zb(g,r);let x=f4(h,g);return{channels:g,groups:x,data:t.data}}function Dw(t,r,f){if(t.facet===null||t.facet==="super")return;let{fx:u,fy:h}=t;if(u!=null||h!=null){let c=rf(t.data??u??h);if(c===void 0)throw Error(`missing facet data in ${t.ariaLabel}`);if(c===null)return;let l={};if(u!=null)l.fx=q1(c,{value:u,scale:"fx"});if(h!=null)l.fy=q1(c,{value:h,scale:"fy"});return Zb(l,f),{channels:l,groups:f4(c,l)}}if(r===void 0)return;let{channels:g,groups:x,data:b}=r;if(t.facet!=="auto"||t.data===b)return{channels:g,groups:x};if(b.length>0&&(x.size>1||x.size===1&&g.fx&&g.fy&&[...x][0][1].size>1)&&Cf(rf(t.data))===Cf(b))Er(`Warning: the ${t.ariaLabel} mark appears to use faceted data, but isn’t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function kn(t,r={}){return ff({...r,x:null,y:null},(f,u,h,g,x,b)=>{return b.getMarkState(t)})}function pn(t){let r=[];for(let f of t){let u=f.tip;if(u){if(u===!0)u={};else if(typeof u==="string")u={pointer:u};let{pointer:h,preferredAnchor:g}=u;if(h=/^x$/i.test(h)?n_:/^y$/i.test(h)?fb:P_,u=h(kn(f,u)),u.title=null,g===void 0)u.preferredAnchor=h===fb?"left":"bottom";let x=Rw(f.data,u);x.facet=f.facet,x.facetAnchor=f.facetAnchor,r.push(x)}}return r}function t$(t,r,f){let{projection:u,x:h={},y:g={},fx:x={},fy:b={},axis:c,grid:l,facet:d={},facet:{axis:_=c,grid:w}=d,x:{axis:M=c,grid:i=M===null?null:l}=h,y:{axis:H=c,grid:q=H===null?null:l}=g,fx:{axis:s=_,grid:E=s===null?null:w}=x,fy:{axis:P=_,grid:n=P===null?null:w}=b}=f;if(u||!c1(h)&&!Ow("x",t))M=i=null;if(u||!c1(g)&&!Ow("y",t))H=q=null;if(!r.has("fx"))s=E=null;if(!r.has("fy"))P=n=null;if(M===void 0)M=!J4(t,"x");if(H===void 0)H=!J4(t,"y");if(s===void 0)s=!J4(t,"fx");if(P===void 0)P=!J4(t,"fy");if(M===!0)M="bottom";if(H===!0)H="left";if(s===!0)s=M==="top"||M===null?"bottom":"top";if(P===!0)P=H==="right"||H===null?"left":"right";let $=[];return $4($,n,fw,b),n4($,P,y_,"right","left",d,b),$4($,E,hw,x),n4($,s,k_,"top","bottom",d,x),$4($,q,rw,g),n4($,H,Jb,"left","right",f,g),$4($,i,uw,h),n4($,M,Qb,"bottom","top",f,h),$}function n4(t,r,f,u,h,g,x){if(!r)return;let b=r$(r);x=f$(b?u:r,g,x);let{line:c}=x;if((f===Jb||f===Qb)&&c&&!cu(c))t.push(Zw(u$(x)));if(t.push(f(x)),b)t.push(f({...x,anchor:h,label:null}))}function $4(t,r,f,u){if(!r||cu(r))return;t.push(f(h$(r,u)))}function r$(t){return/^\s*both\s*$/i.test(t)}function f$(t,r,{line:f=r.line,ticks:u,tickSize:h,tickSpacing:g,tickPadding:x,tickFormat:b,tickRotate:c,fontVariant:l,ariaLabel:d,ariaDescription:_,label:w=r.label,labelAnchor:M,labelArrow:i=r.labelArrow,labelOffset:H}){return{anchor:t,line:f,ticks:u,tickSize:h,tickSpacing:g,tickPadding:x,tickFormat:b,tickRotate:c,fontVariant:l,ariaLabel:d,ariaDescription:_,label:w,labelAnchor:M,labelArrow:i,labelOffset:H}}function u$(t){let{anchor:r,line:f}=t;return{anchor:r,facetAnchor:r+"-empty",stroke:f===!0?void 0:f}}function h$(t,{stroke:r=M1(t)?t:void 0,ticks:f=g$(t)?t:void 0,tickSpacing:u,ariaLabel:h,ariaDescription:g}){return{stroke:r,ticks:f,tickSpacing:u,ariaLabel:h,ariaDescription:g}}function g$(t){switch(typeof t){case"number":return!0;case"string":return!M1(t)}return qr(t)||typeof t?.range==="function"}function J4(t,r){let f=`${r}-axis `;return t.some((u)=>u.ariaLabel?.startsWith(f))}function Ow(t,r){for(let f of r)for(let u in f.channels){let{scale:h}=f.channels[u];if(h===t||h==="projection")return!0}return!1}function x$(t,r){for(let f in t){let u=t[f],h=r[f];if(u.label===void 0&&h)u.label=h.label}return t}function b$({fx:t,fy:r},f){let{marginTop:u,marginRight:h,marginBottom:g,marginLeft:x,width:b,height:c}=t4(f),l=t&&Iw(t),d=r&&Iw(r);return{marginTop:r?d[0]:u,marginRight:t?b-l[1]:h,marginBottom:r?c-d[1]:g,marginLeft:t?l[0]:x,inset:{marginTop:f.marginTop,marginRight:f.marginRight,marginBottom:f.marginBottom,marginLeft:f.marginLeft},width:b,height:c}}function Iw(t){let r=t.domain();if(r.length===0)return[0,t.bandwidth()];let f=t(r[0]),u=t(r[r.length-1]);if(u{let S=w8(nt(j,E),R?.[P]),C=nt(j,U),ut=nt(j,X),tt=nt(j,z),ct=rl(c,{z:C,fill:ut,stroke:tt}),Jt=[],mt=[],f0=S&&$([]),EM=C&&A([]),sM=ut&&m([]),PM=tt&&Y([]),Db=t&&_([]),nM=t&&M([]),Ob=r&&H([]),$M=r&&s([]),JM=s$(t,r,j),QM=0;for(let qu of c)qu.initialize(j);if(x)x.initialize(j);if(g)g.initialize(j);for(let qu of Z){let Ib=[];for(let Eu of c)Eu.scope("facet",qu);if(x)x.scope("facet",qu);if(g)g.scope("facet",qu);for(let[Eu,NM]of Vx(qu,ct))for(let[UM,o8]of Vx(NM,S))for(let[u0,L0]of JM(o8)){if(ct)L0.z=Eu;if(g&&!g.reduce(u0,L0))continue;if(Ib.push(QM++),mt.push(h.reduceIndex(u0,j,L0)),S)f0.push(UM);if(C)EM.push(ct===C?Eu:C[(u0.length>0?u0:o8)[0]]);if(ut)sM.push(ct===ut?Eu:ut[(u0.length>0?u0:o8)[0]]);if(tt)PM.push(ct===tt?Eu:tt[(u0.length>0?u0:o8)[0]]);if(Db)Db.push(L0.x1),nM.push(L0.x2);if(Ob)Ob.push(L0.y1),$M.push(L0.y2);for(let eM of c)eM.reduce(u0,L0);if(x)x.reduce(u0,L0)}Jt.push(Ib)}return fl(Jt,x,b),{data:mt,facets:Jt}}),...!i8(c,"x")&&(d?{x1:d,x2:w,x:w1(d,w)}:{x:J,x1:K,x2:V}),...!i8(c,"y")&&(i?{y1:i,y2:q,y:w1(i,q)}:{y:Q,y1:G,y2:B}),...n&&{[P]:n},...Object.fromEntries(c.map(({name:j,output:Z})=>[j,Z]))}}function w$({cumulative:t,domain:r,thresholds:f,interval:u,...h},g){return[h,{cumulative:t,domain:r,thresholds:f,interval:u,...g}]}function M$(t,{cumulative:r,domain:f,thresholds:u,interval:h},g){if(t={...o0(t)},t.domain===void 0)t.domain=f;if(t.cumulative===void 0)t.cumulative=r;if(t.thresholds===void 0)t.thresholds=u;if(t.interval===void 0)t.interval=h;if(t.value===void 0)t.value=g;return t.thresholds=i$(t.thresholds,t.interval),t}function Sw(t){if(t==null)return;let{value:r,cumulative:f,domain:u=Rt,thresholds:h}=t,g=(x)=>{let b=nt(x,r),c;if(ot(b)||E$(h)){b=_t(b,Mx,Float64Array);let[d,_]=typeof u==="function"?u(b):u,w=typeof h==="function"&&!Kf(h)?h(b,d,_):h;if(typeof w==="number")w=Fh(d,_,w);if(Kf(w)){if(u===Rt)d=w.floor(d),_=w.offset(w.floor(_));w=w.range(d,w.offset(_))}c=w}else{b=K0(b);let[d,_]=typeof u==="function"?u(b):u,w=typeof h==="function"&&!Kf(h)?h(b,d,_):h;if(typeof w==="number")if(u===Rt){let M=Lf(d,_,w);if(isFinite(M))if(M>0){let i=Math.round(d/M),H=Math.round(_/M);if(!(i*M<=d))--i;if(!(H*M>_))++H;let q=H-i+1;w=new Float64Array(q);for(let s=0;s_))++H;let q=H-i+1;w=new Float64Array(q);for(let s=0;s0?P$:Fb)(l,c,b),l};return g.label=kr(r),g}function i$(t,r,f=aw){if(t===void 0)return r===void 0?f:W0(r);if(typeof t==="string"){switch(t.toLowerCase()){case"freedman-diaconis":return z8;case"scott":return B1;case"sturges":return B8;case"auto":return aw}return l8(t)}return t}function H$(t,r){return tl(t,r,mw)}function mw(t,r,f){return Cx(t,r,f,jw)}function jw(t,r,f){return Kx(t,r,f,yw)}function yw(t,r){return H8(t,r,q$)}function q$(t){switch(`${t}`.toLowerCase()){case"x":return $$;case"x1":return Q$;case"x2":return N$;case"y":return J$;case"y1":return U$;case"y2":return e$;case"z":return ul}throw Error(`invalid bin reduce: ${t}`)}function aw(t,r,f){return Math.min(200,B1(t,r,f))}function E$(t){return Fd(t)||qr(t)&&ot(t)}function s$(t,r,f){let u=t?.(f),h=r?.(f);return u&&h?function*(g){let x=u.bin(g);for(let[b,[c,l]]of u.entries()){let d=h.bin(x[b]);for(let[_,[w,M]]of h.entries())yield[d[_],{data:f,x1:c,y1:w,x2:l,y2:M}]}}:u?function*(g){let x=u.bin(g);for(let[b,[c,l]]of u.entries())yield[x[b],{data:f,x1:c,x2:l}]}:function*(g){let x=h.bin(g);for(let[b,[c,l]]of h.entries())yield[x[b],{data:f,y1:c,y2:l}]}}function Fb(t,r,f){return r=K0(r),(u)=>{let h=t.map(()=>[]);for(let g of u)h[R0(r,f[g])-1]?.push(g);return h}}function P$(t,r,f){let u=Fb(t,r,f);return(h)=>{let g=u(h);for(let x=1,b=g.length;x{let g=u(h);for(let x=g.length-2;x>=0;--x){let b=g[x+1],c=g[x];for(let l of b)c.push(l)}return g}}function kw(t,r){let f=(+t+ +r)/2;return t instanceof Date?new Date(f):f}var $$={reduceIndex(t,r,{x1:f,x2:u}){return kw(f,u)}},J$={reduceIndex(t,r,{y1:f,y2:u}){return kw(f,u)}},Q$={reduceIndex(t,r,{x1:f}){return f}},N$={reduceIndex(t,r,{x2:f}){return f}},U$={reduceIndex(t,r,{y1:f}){return f}},e$={reduceIndex(t,r,{y2:f}){return f}};var K$={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Bb extends Et{constructor(t,r={}){let{x1:f,y1:u,x2:h,y2:g,z:x,curve:b,tension:c}=r;super(t,{x1:{value:f,scale:"x"},y1:{value:u,scale:"y"},x2:{value:h,scale:"x",optional:!0},y2:{value:g,scale:"y",optional:!0},z:{value:l1(r),optional:!0}},r,K$);this.z=x,this.curve=Tb(b,c)}filter(t){return t}render(t,r,f,u,h){let{x1:g,y1:x,x2:b=g,y2:c=x}=f;return gt("svg:g",h).call(Ft,this,u,h).call(Bt,this,r,0,0).call((l)=>l.selectAll().data(d4(t,[g,x,b,c],this,f)).enter().append("path").call(Nt,this).call(c4,this,f).attr("d",C7().curve(this.curve).defined((d)=>d>=0).x0((d)=>g[d]).y0((d)=>x[d]).x1((d)=>b[d]).y1((d)=>c[d]))).node()}}function Tf(t,r){let{x:f=C0,...u}=Q4(r);return new Bb(t,Kb(eb({...u,x1:f,x2:void 0},f===C0?"y2":"y")))}var V$={ariaLabel:"bar"};class tM extends Et{constructor(t,r,f={},u=V$){super(t,r,f,u);N8(this,f),U8(this,f)}render(t,r,f,u,h){let{rx:g,ry:x,rx1y1:b,rx1y2:c,rx2y1:l,rx2y2:d}=this,_=this._x(r,f,u),w=this._y(r,f,u),M=this._width(r,f,u),i=this._height(r,f,u);return gt("svg:g",h).call(Ft,this,u,h).call(this._transform,this,r).call((H)=>H.selectAll().data(t).enter().call(b||c||l||d?(q)=>q.append("path").call(Nt,this).call(e8,_,w,pw(_,M),pw(w,i),this).call(rr,this,f):(q)=>q.append("rect").call(Nt,this).attr("x",_).attr("width",M).attr("y",w).attr("height",i).call(y,"rx",g).call(y,"ry",x).call(rr,this,f))).node()}_x(t,{x:r},{marginLeft:f}){let{insetLeft:u}=this;return r?(h)=>r[h]+u:f+u}_y(t,{y:r},{marginTop:f}){let{insetTop:u}=this;return r?(h)=>r[h]+u:f+u}_width({x:t},{x:r},{marginRight:f,marginLeft:u,width:h}){let{insetLeft:g,insetRight:x}=this,b=r&&t?t.bandwidth():h-f-u;return Math.max(0,b-g-x)}_height({y:t},{y:r},{marginTop:f,marginBottom:u,height:h}){let{insetTop:g,insetBottom:x}=this,b=r&&t?t.bandwidth():h-f-u;return Math.max(0,b-g-x)}}function pw(t,r){return typeof t==="function"&&typeof r==="function"?(f)=>t(f)+r(f):typeof t==="function"?(f)=>t(f)+r:typeof r==="function"?(f)=>t+r(f):t+r}class Lb extends tM{constructor(t,r={},f){let{x1:u,x2:h,y:g}=r;super(t,{x1:{value:u,scale:"x"},x2:{value:h,scale:"x"},y:{value:g,scale:"y",type:"band",optional:!0}},r,f)}_transform(t,r,{x:f}){t.call(Bt,r,{x:f},0,0)}_x({x:t},{x1:r,x2:f},{marginLeft:u}){let{insetLeft:h}=this;return pr(t)?u+h:(g)=>Math.min(r[g],f[g])+h}_width({x:t},{x1:r,x2:f},{marginRight:u,marginLeft:h,width:g}){let{insetLeft:x,insetRight:b}=this;return pr(t)?g-u-h-x-b:(c)=>Math.max(0,Math.abs(f[c]-r[c])-x-b)}}function W8(t,r={}){if(!Ex(r))r={...r,y:C0,x2:wt};return new Lb(t,Cb(w4(Ub(r))))}var W$={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function o$(t){return t.sort===void 0&&t.reverse===void 0?yd({channel:"-r"},t):t}class Gb extends Et{constructor(t,r={}){let{x:f,y:u,r:h,rotate:g,symbol:x=k0,frameAnchor:b}=r,[c,l]=Ct(g,0),[d,_]=ad(x),[w,M]=Ct(h,d==null?3:4.5);super(t,{x:{value:f,scale:"x",optional:!0},y:{value:u,scale:"y",optional:!0},r:{value:w,scale:"r",filter:xu,optional:!0},rotate:{value:c,optional:!0},symbol:{value:d,scale:"auto",optional:!0}},o$(r),W$);this.r=M,this.rotate=l,this.symbol=_,this.frameAnchor=Vf(b);let{channels:i}=this,{symbol:H}=i;if(H){let{fill:q,stroke:s}=i;H.hint={fill:q?q.value===H.value?"color":"currentColor":this.fill??"currentColor",stroke:s?s.value===H.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,f,u,h){let{x:g,y:x}=r,{x:b,y:c,r:l,rotate:d,symbol:_}=f,{r:w,rotate:M,symbol:i}=this,[H,q]=F0(this,u),s=i===k0,E=l?void 0:w*w*Math.PI;if(u1(w))t=[];return gt("svg:g",h).call(Ft,this,u,h).call(Bt,this,{x:b&&g,y:c&&x}).call((P)=>P.selectAll().data(t).enter().append(s?"circle":"path").call(Nt,this).call(s?(n)=>{n.attr("cx",b?($)=>b[$]:H).attr("cy",c?($)=>c[$]:q).attr("r",l?($)=>l[$]:w)}:(n)=>{n.attr("transform",e1`translate(${b?($)=>b[$]:H},${c?($)=>c[$]:q})${d?($)=>` rotate(${d[$]})`:M?` rotate(${M})`:""}`).attr("d",l&&_?($)=>{let J=Yr();return _[$].draw(J,l[$]*l[$]*Math.PI),J}:l?($)=>{let J=Yr();return i.draw(J,l[$]*l[$]*Math.PI),J}:_?($)=>{let J=Yr();return _[$].draw(J,E),J}:(()=>{let $=Yr();return i.draw($,E),$})())}).call(rr,this,f)).node()}}function Hu(t,{x:r,y:f,...u}={}){if(u.frameAnchor===void 0)[r,f]=yr(r,f);return new Gb(t,{...u,x:r,y:f})}var Z$={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class N4 extends Et{constructor(t,r={}){let{x:f,y:u,z:h,curve:g,tension:x}=r;super(t,{x:{value:f,scale:"x"},y:{value:u,scale:"y"},z:{value:l1(r),optional:!0}},r,Z$);this.z=h,this.curve=Yw(g,x),n8(this,r)}filter(t){return t}project(t,r,f){if(this.curve!==V8)super.project(t,r,f)}render(t,r,f,u,h){let{x:g,y:x}=f,{curve:b}=this;return gt("svg:g",h).call(Ft,this,u,h).call(Bt,this,r).call((c)=>c.selectAll().data(d4(t,[g,x],this,f)).enter().append("path").call(Nt,this).call(c4,this,f).call(N_,this,f,h).attr("d",b===V8&&h.projection?T$(h.path(),g,x):pu().curve(b).defined((l)=>l>=0).x((l)=>g[l]).y((l)=>x[l]))).node()}}function T$(t,r,f){return r=K0(r),f=K0(f),(u)=>{let h=[],g=[h];for(let x of u)if(x===-1)h=[],g.push(h);else h.push([r[x],f[x]]);return t({type:"MultiLineString",coordinates:g})}}function U4(t,{x:r,y:f,...u}={}){return[r,f]=yr(r,f),new N4(t,{...u,x:r,y:f})}function cf(t,{x:r=C0,y:f=wt,...u}={}){return new N4(t,Q4({...u,x:r,y:f}))}Et.prototype.plot=function({marks:t=[],...r}={}){return wr({...r,marks:[...t,this]})};var B0={"fig-auction-clearing-ladder":{x:"Cumulative REP demand (REP)",y:"Bid limit (ETH/REP)"},"fig-liquidation-health-curve":{x:"REP price (REP/ETH)",y:"Required backing (REP)"},"fig-statoblast-escalation-cost-curve":{x:"Elapsed escalation interval (% of interval)",y:"Required bond (% of non-decision threshold)"},"fig-statoblast-retention-utilization":{x:"Fee-eligible allowance utilization (%)",y:"Annualized open-interest fee (%)"},"fig-zoltar-fork-threshold-decay":{x:"Fork generation (count)",y:"Theoretical genesis supply (%)"},"plot-open-oracle-integration-2":{x:"Censorship duration (steps)",y:"Cost or payoff (ETH)"},"plot-statoblast-whitepaper-7":{x:"Escrowed balance (REP)",y:"Outcome (category)"},"plot-statoblast-whitepaper-8":{x:"Escrowed balance (REP)",y:"Outcome (category)"},"plot-statoblast-whitepaper-19":{x:"Child-universe collateral (ETH)",y:"Collateral destination (category)"}};function rM(t,r,f){let u=t/r,g=f.filter((E)=>E.eth>0).filter((E)=>E.price>=u).sort((E,P)=>P.price-E.price),x=Array.from(new Set(g.map((E)=>E.price))).map((E)=>({bids:g.filter((P)=>P.price===E),price:E,totalEth:g.filter((P)=>P.price===E).reduce((P,n)=>P+n.eth,0)})),b=0,c=0,l=0,d=!1,_=0,w=0,M=[],i=new Map;for(let E of x){if(b>0&&b/E.price>r){d=!0,c=_,l=w;break}let P=Math.min(E.totalEth,Math.max(0,t-b)),n=b+P,$=n/E.price;M.push({cumulativeRep:$,price:E.price});for(let J of E.bids)i.set(J.key,$);if($>=r){d=!0,c=E.price,l=Math.max(0,Math.min(P,r*E.price-b)),b+=l;break}if(n>=t){d=!0,c=E.price,l=P,b=n;break}b=n,_=E.price,w=P}let H=new Map,q=c;if(d&&c>0){let E=l;for(let P of g)if(P.price>c)H.set(P.key,P.eth/c);else if(P.price===c){let n=Math.min(P.eth,E);E-=n,H.set(P.key,n/c)}}else{let E=g.reduce((P,n)=>P+n.eth,0);if(b=E,E>0)for(let P of g)H.set(P.key,P.eth*r/E);c=u,q=E>0?E/r:0}return{bids:f.map((E)=>{let P=H.get(E.key)??0,n="Rejected";if(P>0){let $=E.eth/q;n=d&&P+0.000000001<$?"Partially filled":"Accepted"}return{...E,chartRep:i.get(E.key)??E.eth/Math.max(E.price,Number.EPSILON),rep:P,status:n}}),clearingPrice:c,demandPoints:M,effectivePrice:q,ethRaised:b,mode:d?"uniform":"underfunded",qualificationPrice:u}}function fM(t,r,f){let u=Math.min(Math.max(r,0),Math.max(t,0)),h=Math.max(0,t-u),g=Math.min(Math.max(f,0),h);return{initialShortfall:h,received:u,remainingShortfall:h-g,repairEth:g}}function uM(t){let r=Math.min(Math.max(t.minLiquidationPriceDistanceBps,0),1e4)/1e4,f=t.honestPrice*(1-r),u=f===0?Number.POSITIVE_INFINITY:Math.max(0,t.liquidationThresholdPrice/f-1),h=Math.max(0,(t.manipulatedPrice-t.honestPrice)/t.honestPrice),g=t.manipulatedPrice>t.liquidationThresholdPrice&&h>=u,x=g?t.externalPayoff:0,b=Math.max(0,h-t.honestDisputeBarrierFraction),c=t.censorshipDuration*b*t.oracleReportLiquidity,l=t.oracleReportLiquidity/t.externalPayoff,d=b===0?Number.POSITIVE_INFINITY:(t.targetGriefRatio+1)/(b*l);return{attackerProfit:x,censorshipCost:c,censorshipRate:b,executionErrorThreshold:u,griefTarget:g?(t.targetGriefRatio+1)*t.externalPayoff:0,liquidationExecutable:g,manipulatedPriceError:h,safeCensorshipDuration:d}}var Ff=1000000000000000000n;function hM(t){let r=Math.max(t.nonDecisionThreshold,1),f=BigInt(Math.round(r*Number(Ff))),u=BigInt(Math.round(t.startBond*Number(Ff))),h=!t.repeatDeposit&&u>=f?f-1n:u,g=t.repeatDeposit&&(u<=0n||u>=f),x=[t.invalidBalance,t.yesBalance,t.noBalance].filter((E)=>BigInt(Math.round(E*Number(Ff)))>=f).length>=2,b=Math.max(0,r-t.noBalance),c=Math.min(t.proposedDeposit,b),l=Math.max(t.invalidBalance,t.yesBalance,t.noBalance),d=t.noBalance+c===l&&t.noBalance+c0n?_-1n:_,M=BigInt(Math.round(t.noBalance*Number(Ff)))+w,i=g||x||t.noBalance>=r||BigInt(Math.round(t.proposedDeposit*Number(Ff)))x>=t.runningCost).length,u=r.every((x)=>x===0),h=Math.max(...r),g=r.filter((x)=>x===h).length;if(f>=2||h>0&&g>=2)return{atCost:f,result:"None"};if(u)return{atCost:f,result:"Invalid"};if(t.invalidBalance>t.yesBalance&&t.invalidBalance>t.noBalance)return{atCost:f,result:"Invalid"};if(t.yesBalance>t.invalidBalance&&t.yesBalance>t.noBalance)return{atCost:f,result:"Yes"};if(t.noBalance>t.invalidBalance&&t.noBalance>t.yesBalance)return{atCost:f,result:"No"};return{atCost:f,result:"None"}}function xM(t){return Math.exp(2.4*(t-1))}function bM(t){return(1-(0.999999996848-0.000000018968000059516044*Math.min(Math.max(t,0)/80,1))**31536000)*100}function cM(t,r=100){return Array.from({length:Math.max(0,t)},(f,u)=>{let h=r*0.99**u;return{forkThreshold:h/20,generation:u,theoreticalSupply:h}})}var Rb=[{action:"validate question",id:"factory-question-validation",phase:"Deployment",receiver:"Question Data",source:"Pool Factory"},{action:"look up universe",id:"factory-universe-lookup",phase:"Deployment",receiver:"Zoltar",source:"Pool Factory"},{action:"deploy pool",id:"factory-pool-deployment",phase:"Deployment",receiver:"Security Pool",source:"Pool Factory"},{action:"deploy shares",id:"factory-share-token-deployment",phase:"Deployment",receiver:"Share Token",source:"Pool Factory"},{action:"deploy & wire",id:"factory-price-coordinator-deployment",phase:"Deployment",receiver:"Price Coordinator",source:"Pool Factory"},{action:"manage REP lifecycle",id:"zoltar-reputation-token-lifecycle",phase:"Universe lifecycle",receiver:"Reputation Token",source:"Zoltar"},{action:"mint / burn claims",id:"pool-share-token-claims",phase:"Market runtime",receiver:"Share Token",source:"Security Pool"},{action:"escrow REP",id:"pool-escalation-game-resolution",phase:"Resolution",receiver:"Escalation Game",source:"Security Pool"},{action:"read cached price",id:"pool-price-read",phase:"Risk operations",receiver:"Price Coordinator",source:"Security Pool"},{action:"fund report",id:"coordinator-oracle-report",phase:"Price discovery",receiver:"OpenOracle",source:"Price Coordinator"},{action:"settled callback",id:"oracle-coordinator-callback",phase:"Price settlement",receiver:"Price Coordinator",source:"OpenOracle"},{action:"execute guarded op",id:"coordinator-pool-execute",phase:"Risk execution",receiver:"Security Pool",source:"Price Coordinator"},{action:"request child",id:"share-token-forker-migration",phase:"Share migration",receiver:"Pool Forker",source:"Share Token"},{action:"snapshot game",id:"forker-escalation-snapshot",phase:"Fork snapshot",receiver:"Escalation Game",source:"Pool Forker"},{action:"migrate REP",id:"forker-migration-proxy",phase:"Fork migration",receiver:"Migration Proxy",source:"Pool Forker"},{action:"lock & split REP",id:"migration-proxy-zoltar",phase:"Fork migration",receiver:"Zoltar",source:"Migration Proxy"},{action:"deploy child",id:"forker-child-deployment",phase:"Fork migration",receiver:"Pool Factory",source:"Pool Forker"},{action:"migrate state",id:"forker-pool-migration",phase:"Fork migration",receiver:"Security Pool",source:"Pool Forker"},{action:"repair backing",id:"forker-truth-auction",phase:"Backing repair",receiver:"Truth Auction",source:"Pool Forker"}],V1=10000n;function dM(t){let r=/^([0-9]+)(?:\.([0-9]{1,4}))?$/.exec(t.trim());if(r===null)return;let f=r[1],u=r[2]??"";if(f===void 0)return;return BigInt(f)*V1+BigInt(u.padEnd(4,"0"))}function F$(t){let r=t/V1,f=(t%V1).toString().padStart(4,"0").replace(/0+$/,"");return f===""?r.toString():`${r}.${f}`}function lM(t,r,f,u){let h=r*f*u,g=Number(h)/Number(V1),x=r>0n&&f>0n?Number(t*V1)/Number(r*f):Number.POSITIVE_INFINITY;return{currentRequiredRep:g,currentRequiredRepDisplay:F$(h),state:h>t*V1?"liquidatable":"safe",thresholdPrice:x}}function _M(t,r,f){return`${t} At the selected values, required backing is ${f.currentRequiredRepDisplay} REP against ${r.toString()} unlocked REP, so the vault is ${f.state}.`}var MM=wM();function e4(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function iM(t){if(!e4(t))throw Error("Plot diagram node must be an object");let r=t.text;if(typeof r==="string")return{text:r};let f=t.tag;if(typeof f!=="string"||f.length===0)throw Error("Plot diagram node is missing a tag");let u=t.attributes,h={};if(u!==void 0){if(!e4(u))throw Error(`Plot diagram ${f} attributes must be an object`);for(let[b,c]of Object.entries(u)){if(typeof c!=="string")throw Error(`Plot diagram ${f} attribute ${b} must be a string`);h[b]=c}}let g=t.children,x=[];if(g!==void 0){if(!Array.isArray(g))throw Error(`Plot diagram ${f} children must be an array`);x=g.map(iM)}return{...Object.keys(h).length===0?{}:{attributes:h},...x.length===0?{}:{children:x},tag:f}}function L$(t,r){if(!e4(t))throw Error(`Plot chart ${r} specification must be an object`);let{ariaDescription:f,ariaLabel:u,height:h,nodes:g,width:x}=t;if(typeof f!=="string"||typeof u!=="string")throw Error(`Plot chart ${r} needs accessible text`);if(typeof x!=="number"||typeof h!=="number"||x<=0||h<=0)throw Error(`Plot chart ${r} needs positive dimensions`);if(!Array.isArray(g))throw Error(`Plot chart ${r} nodes must be an array`);return{ariaDescription:f,ariaLabel:u,height:h,nodes:g.map(iM),width:x}}if(!e4(MM))throw Error("Plot diagram specifications must be an object");var G$=Object.fromEntries(Object.entries(MM).map(([t,r])=>[t,L$(r,t)]));function Dt(t,r,f=0){let u=Number(t[r]);return Number.isFinite(u)?u:f}function HM(t){if(t.text!==void 0)return t.text;return(t.children??[]).map(HM).join("")}function R$(t){if(t==="svg-label")return{fontSize:17,fontWeight:800};if(t==="svg-micro")return{fontSize:11,fontWeight:650};return{fontSize:13,fontWeight:t==="svg-small"?650:500}}function z$(t){if(t["text-anchor"]==="end")return"end";if(t["text-anchor"]==="middle")return"middle";return"start"}function A$(t){let r=t.match(/[MLHVCZz]|-?(?:\d+\.?\d*|\.\d+)/g)??[],f=[],u="",h=0,g=0,x=0;while(hi.tag==="tspan"),M=w.length>0?w:[x];for(let i of M){let H=i===x?c:{...c,...i.attributes??{}};_+=Dt(i.attributes??{},"dy");let q=R$(H.class);f.push({attributes:H,className:H.class,fontSize:q.fontSize,fontWeight:q.fontWeight,text:HM(i).trim(),textAnchor:z$(H),x:Dt(H,"x",d),y:_-q.fontSize*0.34})}}else if(x.tag==="path")u.push({attributes:c,className:l,hasArrow:c["marker-end"]!==void 0,points:A$(c.d??""),stroke:c.stroke??"currentColor",strokeDasharray:c["stroke-dasharray"],strokeWidth:Dt(c,"stroke-width",2.35)});else if(x.tag==="line")u.push({attributes:c,className:l,hasArrow:c["marker-end"]!==void 0,points:[{x:Dt(c,"x1"),y:Dt(c,"y1")},{x:Dt(c,"x2"),y:Dt(c,"y2")}],stroke:c.stroke??"currentColor",strokeDasharray:c["stroke-dasharray"],strokeWidth:Dt(c,"stroke-width",2.35)});else if(x.tag==="polyline")u.push({attributes:c,className:l,hasArrow:c["marker-end"]!==void 0,points:D$(c.points??""),stroke:c.stroke??"currentColor",strokeDasharray:c["stroke-dasharray"],strokeWidth:Dt(c,"stroke-width",2.35)});else if(x.tag==="circle")h.push({className:l,fill:c.fill??"currentColor",r:Dt(c,"r",4),x:Dt(c,"cx"),y:Dt(c,"cy")});for(let d of x.children??[])g(d,b)}for(let x of t.nodes)g(x);return{dots:h,lines:u,rectangles:r,texts:f}}function zb(t,r){if(t===void 0)return;for(let[f,u]of Object.entries(r))if(f.startsWith("data-"))t.setAttribute(f,u)}function I$(t){let r=O$(t),f=r.lines.map((d)=>U4(d.points,{...d.className===void 0?{}:{className:d.className},curve:"linear",...d.hasArrow?{markerEnd:"arrow"}:{},stroke:d.stroke,...d.strokeDasharray===void 0?{}:{strokeDasharray:d.strokeDasharray},strokeWidth:d.strokeWidth,x:"x",y:"y"})),u=r.rectangles.map((d)=>C8([d],{...d.className===void 0?{}:{className:d.className},rx:d.rx,x1:"x",x2:(_)=>_.x+_.width,y1:"y",y2:(_)=>_.y+_.height})),h=r.dots.map((d)=>Hu([d],{...d.className===void 0?{}:{className:d.className},fill:d.fill,r:d.r,x:"x",y:"y"})),g=r.texts.map((d)=>Vt([d],{...d.className===void 0?{}:{className:d.className},fontSize:d.fontSize,fontWeight:d.fontWeight,text:"text",textAnchor:d.textAnchor,x:"x",y:"y"})),x=wr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,margin:0,marks:[...f,...u,...h,...g],style:{background:"transparent",color:"currentColor",overflow:"visible"},width:t.width,x:{axis:null,domain:[0,t.width]},y:{axis:null,domain:[t.height,0]}}),b=Array.from(x.querySelectorAll('g[aria-label="rect"] > rect')),c=Array.from(x.querySelectorAll('g[aria-label="line"] > path')),l=Array.from(x.querySelectorAll('g[aria-label="text"] > text'));return r.rectangles.forEach((d,_)=>zb(b[_],d.attributes)),r.lines.forEach((d,_)=>zb(c[_],d.attributes)),r.texts.forEach((d,_)=>zb(l[_],d.attributes)),x}function Ht(t,r,f=0){let u=t?.querySelector(`[data-example-input="${r}"]`),h=Number(u?.value);return Number.isFinite(h)?h:f}function Ab(t){let r=1000000000000000000n,f=t/r,u=(t%r).toString().padStart(18,"0");return`${f}.${u}`}function v$(t){let r=B0["fig-statoblast-escalation-cost-curve"],f=Array.from({length:61},(g,x)=>{let b=x/60;return{elapsed:b,requiredRep:xM(b)}}),u=f[0],h=f[f.length-1];if(u===void 0||h===void 0)throw Error("Escalation cost curve must include both endpoints");return wr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,marginBottom:46,marginLeft:66,marginRight:34,marginTop:20,marks:[Tf(f,{fill:"var(--gold-soft, #f3e4c6)",x:"elapsed",y:"requiredRep"}),cf(f,{stroke:"var(--gold, #8a5d18)",strokeWidth:3,x:"elapsed",y:"requiredRep"}),bf([u.requiredRep],{stroke:"var(--green, #1d735d)",strokeDasharray:"5,4",strokeWidth:2}),bf([h.requiredRep],{stroke:"var(--red, #99453f)",strokeDasharray:"5,4",strokeWidth:2}),Hu([u,h],{fill:(g,x)=>x===0?"var(--green, #1d735d)":"var(--red, #99453f)",r:6,x:"elapsed",y:"requiredRep"}),Vt([{elapsed:u.elapsed,label:`start bond ${(u.requiredRep*100).toFixed(1)}%`,requiredRep:u.requiredRep}],{dx:9,dy:-10,fill:"var(--green, #1d735d)",fontWeight:700,text:"label",textAnchor:"start",x:"elapsed",y:"requiredRep"}),Vt([{elapsed:h.elapsed,label:"non-decision threshold 100%",requiredRep:h.requiredRep}],{dx:-9,dy:14,fill:"var(--red, #99453f)",fontWeight:700,text:"label",textAnchor:"end",x:"elapsed",y:"requiredRep"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,1],grid:!0,label:r.x,tickFormat:(g)=>`${Math.round(g*100)}%`},y:{domain:[0,1.06],grid:!0,label:r.y,tickFormat:(g)=>`${Math.round(g*100)}%`}})}function X$(t){let r=B0["fig-zoltar-fork-threshold-decay"],f=cM(21);return wr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,marginBottom:46,marginLeft:62,marginRight:24,marginTop:22,marks:[Tf(f,{fill:"var(--blue-soft, #dceaf8)",x:"generation",y:"theoreticalSupply"}),cf(f,{stroke:"var(--blue, #245f9f)",strokeWidth:3,x:"generation",y:"theoreticalSupply"}),cf(f,{stroke:"var(--gold, #8a5d18)",strokeDasharray:"6,4",strokeWidth:2,x:"generation",y:"forkThreshold"}),Vt([{generation:15,label:"theoretical supply",value:f[15]?.theoreticalSupply??0},{generation:15,label:"next fork threshold",value:f[15]?.forkThreshold??0}],{dy:-8,fill:(u)=>u.label==="theoretical supply"?"var(--blue, #245f9f)":"var(--gold, #8a5d18)",fontWeight:650,text:"label",x:"generation",y:"value"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{grid:!0,label:r.x,ticks:10},y:{domain:[0,100],grid:!0,label:r.y}})}function Y$(t){let r=B0["fig-statoblast-retention-utilization"],f=Array.from({length:101},(u,h)=>{return{annualFeePercent:bM(h),utilizationPercent:h}});return wr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,marginBottom:46,marginLeft:60,marginRight:28,marginTop:22,marks:[Tf(f,{fill:"var(--gold-soft, #f3e4c6)",x:"utilizationPercent",y:"annualFeePercent"}),cf(f,{stroke:"var(--gold, #8a5d18)",strokeWidth:3,x:"utilizationPercent",y:"annualFeePercent"}),r0([80],{stroke:"var(--red, #99453f)",strokeDasharray:"5,4",strokeWidth:2}),Vt([{annualFeePercent:f[80]?.annualFeePercent??50,label:"80% utilization dip",utilizationPercent:80}],{dx:-8,dy:-10,fill:"var(--red, #99453f)",fontWeight:700,text:"label",textAnchor:"end",x:"utilizationPercent",y:"annualFeePercent"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,100],grid:!0,label:r.x},y:{domain:[0,55],grid:!0,label:r.y}})}function S$(t,r){let f=B0["fig-liquidation-health-curve"],u=r.closest(".interactive-example"),h=u?.querySelector('[data-liquidation-input="rep"]')?.value??"1000",g=u?.querySelector('[data-liquidation-input="debt"]')?.value??"75",x=u?.querySelector('[data-liquidation-input="multiplier"]')?.value??"2",b=u?.querySelector('[data-liquidation-input="price"]')?.value??"10",c=BigInt(h),l=BigInt(g),d=dM(x)??20000n,_=BigInt(b),w=Number(c),M=Number(l),i=Number(d)/1e4,H=Number(_),q=Math.max(20,H),s=Array.from({length:81},(Q,U)=>{let e=q*U/80;return{price:e,requiredRep:M*i*e}}),E=lM(c,l,d,_),{currentRequiredRep:P,state:n,thresholdPrice:$}=E,J=wr({ariaDescription:_M(t.ariaDescription,c,E),ariaLabel:t.ariaLabel,height:t.height,marginBottom:48,marginLeft:92,marginRight:28,marginTop:24,marks:[Tf(s,{fill:"var(--red-soft, #f2d9d6)",x:"price",y:"requiredRep"}),cf(s,{stroke:"var(--red, #99453f)",strokeWidth:3,x:"price",y:"requiredRep"}),bf([w],{stroke:"var(--green, #1d735d)",strokeDasharray:"7,4",strokeWidth:3}),...Number.isFinite($)&&$<=q?[r0([$],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"4,4",strokeWidth:2})]:[],Hu([{price:H,requiredRep:P}],{fill:n==="safe"?"var(--green, #1d735d)":"var(--red, #99453f)",r:7,stroke:"var(--paper, #fff)",strokeWidth:2,x:"price",y:"requiredRep"}),Vt([{label:`${w.toFixed(0)} REP available`,price:q*0.72,requiredRep:w}],{dy:-9,fill:"var(--green, #1d735d)",fontWeight:650,text:"label",x:"price",y:"requiredRep"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,q],grid:!0,label:f.x},y:{domain:[0,Math.max(w,M*i*q)*1.06],grid:!0,label:f.y,labelAnchor:"center"}});return J.dataset.chartState=n,J}function a$(t){let r=[{id:"deploy",subtitle:"Construction-time validation and deployment",title:"1. Deploy & wire",x1:0.1,x2:11.9,y1:0.1,y2:3.2},{id:"runtime",subtitle:"Claims, dispute escrow, and guarded price execution",title:"2. Operate & resolve",x1:0.1,x2:11.9,y1:3.45,y2:6.55},{id:"fork",subtitle:"Child creation, REP migration, state migration, and backing repair",title:"3. Fork & repair",x1:0.1,x2:11.9,y1:6.8,y2:11.15}],f=[{fill:"registry",id:"deploy-question",label:"Question Data",x1:0.4,x2:2.2,y1:0.65,y2:1.25},{fill:"registry",id:"deploy-zoltar",label:"Zoltar",x1:0.4,x2:2.2,y1:1.5,y2:2.1},{fill:"registry",id:"deploy-rep",label:"Reputation Token",x1:0.4,x2:2.2,y1:2.35,y2:2.95},{fill:"factory",id:"deploy-factory",label:"Pool Factory",x1:4,x2:6.1,y1:1.5,y2:2.1},{fill:"market",id:"deploy-pool",label:"Security Pool",x1:7.4,x2:9.3,y1:0.65,y2:1.25},{fill:"market",id:"deploy-share",label:"Share Token",x1:9.7,x2:11.5,y1:1.5,y2:2.1},{fill:"oracle",id:"deploy-coordinator",label:"Price Coordinator",x1:7.4,x2:9.3,y1:2.35,y2:2.95},{fill:"market",id:"runtime-pool",label:"Security Pool",x1:0.4,x2:2.3,y1:4.75,y2:5.35},{fill:"market",id:"runtime-share",label:"Share Token",x1:3,x2:4.9,y1:3.95,y2:4.55},{fill:"resolution",id:"runtime-escalation",label:"Escalation Game",x1:3,x2:4.9,y1:5.55,y2:6.15},{fill:"oracle",id:"runtime-coordinator",label:"Price Coordinator",x1:5.3,x2:7.5,y1:4.75,y2:5.35},{fill:"oracle",id:"runtime-oracle",label:"OpenOracle",x1:9.1,x2:11.2,y1:4.75,y2:5.35},{fill:"market",id:"fork-share",label:"Share Token",x1:0.4,x2:2.3,y1:7.35,y2:7.95},{fill:"resolution",id:"fork-escalation",label:"Escalation Game",x1:0.4,x2:2.3,y1:8.3,y2:8.9},{fill:"fork",id:"fork-proxy",label:"Migration Proxy",x1:0.4,x2:2.3,y1:9.25,y2:9.85},{fill:"registry",id:"fork-zoltar",label:"Zoltar",x1:0.4,x2:2.3,y1:10.2,y2:10.8},{fill:"fork",id:"fork-forker",label:"Pool Forker",x1:4.5,x2:6.7,y1:8.65,y2:9.35},{fill:"factory",id:"fork-factory",label:"Pool Factory",x1:9.1,x2:11.2,y1:7.35,y2:7.95},{fill:"market",id:"fork-pool",label:"Security Pool",x1:9.1,x2:11.2,y1:8.3,y2:8.9},{fill:"fork",id:"fork-auction",label:"Truth Auction",x1:9.1,x2:11.2,y1:9.25,y2:9.85}],u=new Set(Rb.map((i)=>i.id)),h=[{id:"factory-question-validation",labelX:3.05,labelY:1.28,receiverNodeId:"deploy-question",sourceNodeId:"deploy-factory",points:[{x:4,y:1.63},{x:3.1,y:1.63},{x:3.1,y:0.95},{x:2.2,y:0.95}]},{id:"factory-universe-lookup",labelX:3.1,labelY:1.68,receiverNodeId:"deploy-zoltar",sourceNodeId:"deploy-factory",points:[{x:4,y:1.8},{x:2.2,y:1.8}]},{id:"factory-pool-deployment",labelX:6.78,labelY:1.28,receiverNodeId:"deploy-pool",sourceNodeId:"deploy-factory",points:[{x:6.1,y:1.63},{x:6.75,y:1.63},{x:6.75,y:0.95},{x:7.4,y:0.95}]},{id:"factory-share-token-deployment",labelX:7.9,labelY:1.68,receiverNodeId:"deploy-share",sourceNodeId:"deploy-factory",points:[{x:6.1,y:1.8},{x:9.7,y:1.8}]},{id:"factory-price-coordinator-deployment",labelX:6.78,labelY:2.32,receiverNodeId:"deploy-coordinator",sourceNodeId:"deploy-factory",points:[{x:6.1,y:1.97},{x:6.75,y:1.97},{x:6.75,y:2.65},{x:7.4,y:2.65}]},{id:"zoltar-reputation-token-lifecycle",labelX:2.28,labelY:2.23,receiverNodeId:"deploy-rep",sourceNodeId:"deploy-zoltar",points:[{x:1.3,y:2.1},{x:1.3,y:2.35}]},{id:"pool-share-token-claims",labelX:3.08,labelY:4.62,receiverNodeId:"runtime-share",sourceNodeId:"runtime-pool",points:[{x:2.3,y:4.92},{x:2.65,y:4.92},{x:2.65,y:4.25},{x:3,y:4.25}]},{id:"pool-escalation-game-resolution",labelX:2.3,labelY:5.73,receiverNodeId:"runtime-escalation",sourceNodeId:"runtime-pool",points:[{x:1.35,y:5.35},{x:1.35,y:5.85},{x:3,y:5.85}]},{id:"pool-price-read",labelX:3.8,labelY:4.88,receiverNodeId:"runtime-coordinator",sourceNodeId:"runtime-pool",points:[{x:2.3,y:4.95},{x:5.3,y:4.95}]},{id:"coordinator-pool-execute",labelX:3.8,labelY:5.28,receiverNodeId:"runtime-pool",sourceNodeId:"runtime-coordinator",points:[{x:5.3,y:5.2},{x:2.3,y:5.2}]},{id:"coordinator-oracle-report",labelX:8.3,labelY:4.88,receiverNodeId:"runtime-oracle",sourceNodeId:"runtime-coordinator",points:[{x:7.5,y:4.95},{x:9.1,y:4.95}]},{id:"oracle-coordinator-callback",labelX:8.3,labelY:5.28,receiverNodeId:"runtime-coordinator",sourceNodeId:"runtime-oracle",points:[{x:9.1,y:5.2},{x:7.5,y:5.2}]},{id:"share-token-forker-migration",labelX:3.9,labelY:8.2,receiverNodeId:"fork-forker",sourceNodeId:"fork-share",points:[{x:2.3,y:7.65},{x:3.9,y:7.65},{x:3.9,y:8.75},{x:4.5,y:8.75}]},{id:"forker-escalation-snapshot",labelX:3.43,labelY:8.75,receiverNodeId:"fork-escalation",sourceNodeId:"fork-forker",points:[{x:4.5,y:8.83},{x:3.45,y:8.83},{x:3.45,y:8.6},{x:2.3,y:8.6}]},{id:"forker-migration-proxy",labelX:3.4,labelY:9.5,receiverNodeId:"fork-proxy",sourceNodeId:"fork-forker",points:[{x:4.5,y:9.17},{x:3.45,y:9.17},{x:3.45,y:9.55},{x:2.3,y:9.55}]},{id:"migration-proxy-zoltar",labelX:2.3,labelY:10.02,receiverNodeId:"fork-zoltar",sourceNodeId:"fork-proxy",points:[{x:1.35,y:9.85},{x:1.35,y:10.2}]},{id:"forker-child-deployment",labelX:7.95,labelY:7.78,receiverNodeId:"fork-factory",sourceNodeId:"fork-forker",points:[{x:6.7,y:8.78},{x:6.95,y:8.78},{x:6.95,y:7.65},{x:9.1,y:7.65}]},{id:"forker-pool-migration",labelX:7.92,labelY:8.68,receiverNodeId:"fork-pool",sourceNodeId:"fork-forker",points:[{x:6.7,y:9},{x:9.1,y:8.6}]},{id:"forker-truth-auction",labelX:8.02,labelY:9.48,receiverNodeId:"fork-auction",sourceNodeId:"fork-forker",points:[{x:6.7,y:9.17},{x:8,y:9.17},{x:8,y:9.55},{x:9.1,y:9.55}]}],g=new Map(Rb.map((i)=>[i.id,i])),x=new Map(f.map((i)=>[i.id,i])),b=new Map(r.map((i)=>[i.id,i])),c=new Set(h.map((i)=>i.id));if(c.size!==u.size||[...u].some((i)=>!c.has(i)))throw Error("Contract interaction chart routed edges do not match the shared interaction registry");function l(i){switch(i){case"Deployment":case"Universe lifecycle":return"deploy";case"Market runtime":case"Price discovery":case"Price settlement":case"Resolution":case"Risk execution":case"Risk operations":return"runtime";case"Backing repair":case"Fork migration":case"Fork snapshot":case"Share migration":return"fork";default:throw Error(`Contract interaction chart has no panel for phase ${i}`)}}function d(i,H){let s=i.x>=H.x1-0.000001&&i.x<=H.x2+0.000001,E=i.y>=H.y1-0.000001&&i.y<=H.y2+0.000001,P=Math.abs(i.y-H.y1)<=0.000001||Math.abs(i.y-H.y2)<=0.000001,n=Math.abs(i.x-H.x1)<=0.000001||Math.abs(i.x-H.x2)<=0.000001;return s&&P||E&&n}for(let i of h){let H=g.get(i.id),q=x.get(i.sourceNodeId),s=x.get(i.receiverNodeId),E=i.points[0],P=i.points[i.points.length-1];if(H===void 0||q===void 0||s===void 0||E===void 0||P===void 0)throw Error(`Contract interaction chart route ${i.id} is incomplete`);let n=l(H.phase),$=b.get(n);if(q.label!==H.source||s.label!==H.receiver)throw Error(`Contract interaction chart route ${i.id} does not match registry direction ${H.source} to ${H.receiver}`);if($===void 0||!q.id.startsWith(`${n}-`)||!s.id.startsWith(`${n}-`))throw Error(`Contract interaction chart route ${i.id} is not in its ${n} phase panel`);let J=q.x1>=$.x1&&q.x2<=$.x2&&q.y1>=$.y1&&q.y2<=$.y2,Q=s.x1>=$.x1&&s.x2<=$.x2&&s.y1>=$.y1&&s.y2<=$.y2,U=i.points.every((e)=>e.x>=$.x1&&e.x<=$.x2&&e.y>=$.y1&&e.y<=$.y2);if(!J||!Q||!U)throw Error(`Contract interaction chart route ${i.id} leaves its ${n} phase panel bounds`);if(!d(E,q)||!d(P,s))throw Error(`Contract interaction chart route ${i.id} does not touch its source and receiver boundaries`)}let _=r.map((i)=>({label:i.title,x:i.x1+0.22,y:i.y1+0.27})),w=r.map((i)=>({label:i.subtitle,x:i.x1+2.2,y:i.y1+0.27})),M=h.map((i)=>{let H=g.get(i.id);if(H===void 0)throw Error(`Contract interaction chart route ${i.id} has no registry edge`);return{label:H.action,x:i.labelX,y:i.labelY}});return wr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,color:{domain:["registry","factory","market","resolution","oracle","fork"],range:["var(--blue-soft, #dceaf8)","var(--gold-soft, #f3e4c6)","var(--green-soft, #dcefe8)","var(--red-soft, #f2d9d6)","var(--blue-soft, #dceaf8)","var(--gold-soft, #f3e4c6)"]},height:t.height,margin:18,marks:[C8(r,{fill:"var(--paper, #fff)",rx:14,stroke:"var(--line, #d8e0e4)",strokeWidth:1.4,x1:"x1",x2:"x2",y1:"y1",y2:"y2"}),Vt(_,{fill:"var(--ink, #1f2529)",fontSize:15,fontWeight:750,text:"label",textAnchor:"start",x:"x",y:"y"}),Vt(w,{fill:"var(--muted, #465760)",fontSize:11,text:"label",textAnchor:"start",x:"x",y:"y"}),...h.map((i)=>U4(i.points,{markerEnd:"arrow",stroke:"var(--muted, #465760)",strokeWidth:2.2,x:"x",y:"y"})),Vt(M,{fill:"var(--muted, #465760)",fontSize:10,fontWeight:650,stroke:"var(--paper, #fff)",strokeWidth:4,text:"label",x:"x",y:"y"}),C8(f,{fill:"fill",rx:10,stroke:"var(--ink, #1f2529)",strokeWidth:1.5,x1:"x1",x2:"x2",y1:"y1",y2:"y2"}),Vt(f,{fill:"var(--ink, #1f2529)",fontSize:12,fontWeight:700,text:"label",x:(i)=>(i.x1+i.x2)/2,y:(i)=>(i.y1+i.y2)/2})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{axis:null,domain:[0,12]},y:{axis:null,domain:[11.3,0]}})}function m$(t,r){let f=B0["fig-auction-clearing-ladder"],u=document.querySelector("#simple-auction-example"),h=Math.max(Ht(u,"repInventory",4),1),g=Math.max(Ht(u,"ethRaiseCap",10),0),x=rM(g,h,[{eth:Ht(u,"aliceEth",5),key:"alice",name:"Alice",price:5},{eth:Ht(u,"bobEth",4),key:"bob",name:"Bob",price:4},{eth:Ht(u,"carolEth",5),key:"carol",name:"Carol",price:3}]),b=x.bids.filter((q)=>q.eth>0),c=b.map((q)=>({...q,cumulativeRep:q.chartRep})),l=x.demandPoints[0],d=l===void 0?[]:[{cumulativeRep:0,price:l.price},...x.demandPoints],_=x.clearingPrice,w=Math.max(h,...c.map((q)=>q.cumulativeRep),...x.demandPoints.map((q)=>q.cumulativeRep),1),M=Math.max(5.8,_*1.16,...b.map((q)=>q.price*1.16)),i=x.mode==="uniform"?`uniform clearing at ${_.toFixed(2)} ETH per REP`:`underfunded allocation at an effective ${x.effectivePrice.toFixed(2)} ETH per REP, with a ${x.qualificationPrice.toFixed(2)} ETH per REP qualification boundary`,H=wr({ariaDescription:`${t.ariaDescription} The current result is ${i}, with ${x.ethRaised.toFixed(2)} ETH retained for ${h.toFixed(2)} REP of inventory.`,ariaLabel:"Interactive truth-auction aggregate demand curve",color:{domain:["Accepted","Partially filled","Rejected"],range:["var(--green, #1d735d)","var(--gold, #8a5d18)","var(--red, #99453f)"],type:"ordinal"},height:t.height,marginBottom:50,marginLeft:66,marginRight:28,marginTop:24,marks:[Tf(d,{curve:"step-after",fill:"var(--blue-soft, #dceaf8)",x:"cumulativeRep",y:"price",y1:0}),cf(d,{curve:"step-after",stroke:"var(--blue, #245f9f)",strokeWidth:3,x:"cumulativeRep",y:"price"}),r0([h],{stroke:"var(--red, #99453f)",strokeDasharray:"5,4",strokeWidth:2}),bf([_],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2}),Hu(c,{fill:"status",r:6,tip:!0,title:(q)=>`${q.name}: ${q.eth.toFixed(2)} ETH at ${q.price.toFixed(2)} ETH/REP`,x:"cumulativeRep",y:"price"}),Vt([{label:`REP inventory ${h.toFixed(2)}`,x:h,y:M*0.72}],{dx:-6,dy:-7,fill:"var(--ink, currentColor)",fontSize:12,text:"label",textAnchor:"end",x:"x",y:"y"}),Vt([{label:`${x.mode==="uniform"?"clearing":"qualification"} ${_.toFixed(2)} ETH/REP`,x:w*0.72,y:_}],{dx:6,dy:-7,fill:"var(--ink, currentColor)",fontSize:12,text:"label",textAnchor:"start",x:"x",y:"y"}),Vt([{label:"● accepted",status:"Accepted",x:w*0.12},{label:"● partially filled",status:"Partially filled",x:w*0.42},{label:"● rejected",status:"Rejected",x:w*0.74}],{fill:"status",fontSize:12,text:"label",x:"x",y:M*0.97})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,w*1.08],grid:!0,label:f.x},y:{domain:[0,M],grid:!0,label:f.y}});return H.dataset.chartState=x.mode,r.dataset.chartState=H.dataset.chartState,H}function j$(t,r){let f=B0["plot-statoblast-whitepaper-19"],u=r.closest("#collateral-repair-example"),h=Math.max(Ht(u,"parentCollateral",50),0),g=fM(h,Ht(u,"forkCollateralReceived",47.5),Ht(u,"auctionRaised",2.5)),x=[{kind:"Migration-routed",x1:0,x2:g.received},{kind:"Auction repair",x1:g.received,x2:g.received+g.repairEth}],b=wr({ariaDescription:`${t.ariaDescription}. Migration routed ${g.received.toFixed(2)} ETH and the auction repairs ${g.repairEth.toFixed(2)} ETH toward the ${h.toFixed(2)} ETH target, leaving ${g.remainingShortfall.toFixed(2)} ETH unfilled.`,ariaLabel:t.ariaLabel,color:{domain:["Migration-routed","Auction repair"],range:["var(--blue, #245f9f)","var(--green, #1d735d)"]},height:t.height,marginBottom:44,marginLeft:124,marginRight:28,marginTop:52,marks:[W8(x,{fill:"kind",inset:2,x1:"x1",x2:"x2",y:()=>"Child collateral"}),r0([h],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2}),Vt([{kind:"Migration-routed",label:"■ Migration-routed",value:h*0.24},{kind:"Auction repair",label:"■ Auction repair",value:h*0.68}],{dy:-55,fill:"kind",fontSize:12,text:"label",x:"value",y:()=>"Child collateral"}),Vt([{label:`target ${h.toFixed(2)} ETH`,value:h}],{dx:-6,dy:-55,fontSize:12,text:"label",textAnchor:"end",x:"value",y:()=>"Child collateral"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,Math.max(h,g.received+g.repairEth,1)],grid:!0,label:f.x},y:{label:f.y}});return b.dataset.chartState=g.remainingShortfall===0?"repaired":"partial",r.dataset.chartState=b.dataset.chartState,b}function y$(t,r){let f=B0["plot-open-oracle-integration-2"],u=r.closest("#binary-censorship-example"),h=Math.max(Ht(u,"honestPrice",900),0.0001),g=Math.max(Ht(u,"manipulatedPrice",1017),0.0001),x=Math.max(Ht(u,"liquidationThresholdPrice",101),0.0001),b=Math.max(Ht(u,"minLiquidationPriceDistanceBps",1000),0),c=Math.max(Ht(u,"externalPayoff",1000),0),l=Math.max(Ht(u,"oracleReportLiquidity",4000),0),d=Math.max(Ht(u,"honestDisputeBarrierFraction",0.01),0),_=Math.max(Ht(u,"censorshipDuration",24),0),w=Math.max(Ht(u,"targetGriefRatio",1),0),M=uM({censorshipDuration:_,externalPayoff:c,honestDisputeBarrierFraction:d,honestPrice:h,liquidationThresholdPrice:x,manipulatedPrice:g,minLiquidationPriceDistanceBps:b,oracleReportLiquidity:l,targetGriefRatio:w}),i=M.censorshipRate*l,H=Math.max(168,_),q=Array.from({length:H+1},(P,n)=>({cost:n*i,duration:n})),s=M.censorshipCost,E=[{label:"Conditional attacker payoff",value:M.attackerProfit},{label:"Target payoff + grief cost",value:M.griefTarget}];return wr({ariaDescription:`${t.ariaDescription}. Liquidation is ${M.liquidationExecutable?"executable":"not executable"}, so attacker payoff is ${M.attackerProfit.toFixed(2)} ETH. At ${_.toFixed(0)} steps, censorship costs ${s.toFixed(2)} ETH; the payoff-plus-grief target is ${M.griefTarget.toFixed(2)} ETH.`,ariaLabel:"Interactive censorship cost and attacker payoff",height:t.height,marginBottom:48,marginLeft:72,marginRight:24,marginTop:18,marks:[Tf(q,{fill:"var(--gold-soft, #f3e4c6)",x:"duration",y:"cost"}),cf(q,{stroke:"var(--gold, #8a5d18)",strokeWidth:3,x:"duration",y:"cost"}),bf(E,{stroke:(P,n)=>n===0?"var(--red, #99453f)":"var(--green, #1d735d)",strokeDasharray:"5,4",strokeWidth:2,y:"value"}),r0([_],{stroke:"var(--blue, #245f9f)",strokeDasharray:"5,4"}),Vt([{label:"attacker payoff",value:M.attackerProfit}],{dy:-6,fill:"var(--red, #99453f)",fontSize:11,text:"label",textAnchor:"start",x:H*0.63,y:"value"}),Vt([{label:"payoff + grief target",value:M.griefTarget}],{dy:-20,fill:"var(--green, #1d735d)",fontSize:11,text:"label",textAnchor:"start",x:H*0.63,y:"value"}),Hu([{cost:s,duration:_}],{fill:s>=M.griefTarget?"var(--green, #1d735d)":"var(--red, #99453f)",r:6,tip:!0,title:`Selected: ${_.toFixed(0)} steps, ${s.toFixed(2)} ETH`,x:"duration",y:"cost"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,H],grid:!0,label:f.x},y:{grid:!0,label:f.y}})}function k$(t,r){let f=B0["plot-statoblast-whitepaper-7"],u=r.closest("#escalation-deposit-example"),h=Ht(u,"depositLifecycle",0)===1,g=h?Ht(u,"invalidBalance",1):0,x=h?Ht(u,"yesBalance",9):0,b=h?Ht(u,"noBalance",7):0,c=hM({invalidBalance:g,noBalance:b,nonDecisionThreshold:Ht(u,"nonDecisionThreshold",10),proposedDeposit:Ht(u,"proposedDeposit",5),repeatDeposit:h,startBond:Ht(u,"startBond",2),yesBalance:x}),l=[{balance:g,phase:"Before",side:"Invalid"},{balance:x,phase:"Before",side:"Yes"},{balance:b,phase:"Before",side:"No"},{balance:g,phase:"After",side:"Invalid"},{balance:x,phase:"After",side:"Yes"},{balance:c.noAfter,phase:"After",side:"No"}],d=c.tieAdjusted?Ab(c.acceptedAtomic):c.accepted.toFixed(6),_=c.tieAdjusted?Ab(c.noAfterAtomic):c.noAfter.toFixed(6),w=wr({ariaDescription:`${t.ariaDescription}. This is a ${h?"repeat deposit into an existing game":"first deposit that creates the game"} with an effective start bond of ${Ab(c.effectiveStartBondAtomic)} REP. The proposed No deposit ${c.previewReverts?"reverts":`accepts ${d} REP`}; No ends at ${_} REP against a ${c.threshold.toFixed(2)} REP threshold.`,ariaLabel:t.ariaLabel,color:{domain:["Invalid","Yes","No"],range:["var(--red, #99453f)","var(--green, #1d735d)","var(--blue, #245f9f)"]},fx:{domain:["Before","After"],label:null},height:t.height,marginBottom:42,marginLeft:58,marginRight:24,marginTop:28,marks:[W8(l,{fill:"side",fx:"phase",inset:2,x:"balance",y:"side"}),r0([c.threshold],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,Math.max(c.threshold,...l.map((M)=>M.balance),1)],grid:!0,label:f.x},y:{domain:["Invalid","Yes","No"],label:f.y}});return w.dataset.chartState=c.previewReverts?"reverts":"accepted",w}function p$(t,r){let f=B0["plot-statoblast-whitepaper-8"],u=r.closest("#resolution-edge-example"),h=Ht(u,"invalidBalance",4),g=Ht(u,"yesBalance",6),x=Ht(u,"noBalance",7),b=Ht(u,"runningCost",5),c=gM({invalidBalance:h,noBalance:x,runningCost:b,yesBalance:g}),l=[{balance:h,side:"Invalid"},{balance:g,side:"Yes"},{balance:x,side:"No"}],d=wr({ariaDescription:`${t.ariaDescription}. ${c.atCost} outcomes meet the ${b.toFixed(2)} REP running cost, so the helper returns ${c.result}.`,ariaLabel:t.ariaLabel,color:{domain:["Invalid","Yes","No"],range:["var(--red, #99453f)","var(--green, #1d735d)","var(--blue, #245f9f)"]},height:t.height,marginBottom:42,marginLeft:58,marginRight:24,marginTop:22,marks:[W8(l,{fill:"side",inset:3,x:"balance",y:"side"}),r0([b],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,Math.max(b,...l.map((_)=>_.balance),1)],grid:!0,label:f.x},y:{domain:["Invalid","Yes","No"],label:f.y}});return d.dataset.chartState=c.result.toLowerCase(),d}function tJ(t,r,f){if(t==="fig-statoblast-escalation-cost-curve")return v$(r);if(t==="fig-zoltar-fork-threshold-decay")return X$(r);if(t==="fig-statoblast-retention-utilization")return Y$(r);if(t==="fig-liquidation-health-curve")return S$(r,f);if(t==="fig-contract-interaction-map")return a$(r);if(t==="fig-auction-clearing-ladder")return m$(r,f);if(t==="plot-open-oracle-integration-2")return y$(r,f);if(t==="plot-statoblast-whitepaper-7")return k$(r,f);if(t==="plot-statoblast-whitepaper-8")return p$(r,f);if(t==="plot-statoblast-whitepaper-19")return j$(r,f);return I$(r)}function qM(t){let r=t.dataset.plotChart;if(r===void 0)throw Error("Plot mount is missing data-plot-chart");let f=G$[r];if(f===void 0)throw Error(`Plot chart specification is missing for ${r}`);let u=tJ(r,f,t);if(!(u instanceof SVGSVGElement))throw Error(`Plot chart ${r} did not produce an SVG root`);if(u.dataset.plotGenerated="true",u.setAttribute("role","img"),!u.hasAttribute("viewBox"))u.setAttribute("viewBox",`0 0 ${f.width} ${f.height}`);let h=t.closest("figure.diagram, .example-visual");if(h===null)throw Error(`Plot chart ${r} is missing a scrollable figure or example envelope`);h.tabIndex=0,h.setAttribute("aria-label",`Scrollable figure: ${f.ariaLabel}`),t.removeAttribute("aria-label"),t.removeAttribute("role"),t.replaceChildren(u),t.classList.add("plot-chart-ready")}var rJ=Array.from(document.querySelectorAll("[data-plot-chart]"));for(let t of rJ)qM(t);for(let t of["fig-auction-clearing-ladder","fig-liquidation-health-curve","plot-open-oracle-integration-2","plot-statoblast-whitepaper-7","plot-statoblast-whitepaper-8","plot-statoblast-whitepaper-19"]){let r=document.querySelector(`[data-plot-chart="${t}"]`),f=t==="fig-auction-clearing-ladder"?document.querySelector("#simple-auction-example"):r?.closest(".interactive-example"),u=t==="fig-liquidation-health-curve"?"[data-liquidation-input]":"[data-example-input]";for(let h of Array.from(f?.querySelectorAll(u)??[]))h.addEventListener("input",()=>{if(r!==null&&r!==void 0)qM(r)})} +}`)).call(B1,f);for(let A of _){let{channels:s,values:Y,facets:m}=q.get(A);if(H===void 0||A.facet==="super"){let X=null;if(m){if(X=m[0],X=A.filter(X,s,Y),X.length===0)continue}let ht=A.render(X,P,Y,C,W);if(ht==null)continue;Z.appendChild(ht)}else{let X;for(let ht of H){if(!(A.facetAnchor?.(H,G,ht)??!ht.empty))continue;let p=null;if(m){let a=d.has(A);if(p=m[a?ht.i:0],p=A.filter(p,s,Y),p.length===0)continue;if(!a&&p===m[0])p=a_(p);p.fx=ht.x,p.fy=ht.y,p.fi=ht.i}let ct=A.render(p,P,Y,U,W);if(ct==null)continue;(X??=Kr(Z).append("g")).append(()=>ct).datum(ht);for(let a of["aria-label","aria-description","aria-hidden","transform"])if(ct.hasAttribute(a))X.attr(a,ct.getAttribute(a)),ct.removeAttribute(a)}X?.selectChildren().each(N)}}let V=Iw($,W,t),{figure:y=u!=null||h!=null||x!=null||V.length>0}=t;if(y){if(R=i.createElement("figure"),R.className=`${c}-figure`,R.style.maxWidth="initial",u!=null)R.append(hM(i,u,"h2"));if(h!=null)R.append(hM(i,h,"h3"));if(R.append(...V,Z),x!=null)R.append(CU(i,x));if("value"in Z)R.value=Z.value,delete Z.value}R.scale=$d(P.scales),R.legend=Aw($,W,t);let I=ml();if(I>0)Kr(Z).append("text").attr("x",L).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("⚠️").append("title").text(`${I.toLocaleString("en-US")} warning${I===1?"":"s"}. Please check the console.`);return R}function hM(t,r,f){if(r.ownerDocument)return r;let u=t.createElement(f);return u.append(r),u}function CU(t,r){let f=t.createElement("figcaption");return f.append(r),f}function xM(t){return t.flat(1/0).filter((r)=>r!=null).map(KU)}function KU(t){return typeof t.render==="function"?t:new _M(t)}class _M extends wt{constructor(t){if(typeof t!=="function")throw TypeError("invalid mark; missing render function");super();this.render=t}render(){}}function Yg(t,r){for(let f in t)lM(t[f],r);return t}function lM(t,r){let{scale:f,transform:u=!0}=t;if(f==null||!u)return;let{type:h,percent:x,interval:b,transform:g=x?(c)=>c==null?NaN:c*100:Gb(b,h)}=r[f]??{};if(g==null)return;t.value=qt(t.value,g),t.transform=!1}function WU(t){for(let r in t)Sb(r,t[r])}function D8(t,r,f,u=m_){for(let{channels:h}of r.values())for(let x in h){let b=h[x],{scale:g}=b;if(g!=null&&u(g))if(g==="projection"){if(!Vd(f)){let c=f.x?.domain===void 0,_=f.y?.domain===void 0;if(c||_){let[l,d]=Td(b);if(c)vg(t,"x",l);if(_)vg(t,"y",d)}}}else vg(t,g,b)}return t}function vg(t,r,f){let u=t.get(r);if(u!==void 0)u.push(f);else t.set(r,[f])}function iU(t,r){if(t==null)return;let{x:f,y:u}=t;if(f==null&&u==null)return;let h=hf(t.data);if(h==null)throw Error("missing facet data");let x={};if(f!=null)x.fx=i1(h,{value:f,scale:"fx"});if(u!=null)x.fy=i1(h,{value:u,scale:"fy"});Yg(x,r);let b=d4(h,x);return{channels:x,groups:b,data:t.data}}function bM(t,r,f){if(t.facet===null||t.facet==="super")return;let{fx:u,fy:h}=t;if(u!=null||h!=null){let c=hf(t.data??u??h);if(c===void 0)throw Error(`missing facet data in ${t.ariaLabel}`);if(c===null)return;let _={};if(u!=null)_.fx=i1(c,{value:u,scale:"fx"});if(h!=null)_.fy=i1(c,{value:h,scale:"fy"});return Yg(_,f),{channels:_,groups:d4(c,_)}}if(r===void 0)return;let{channels:x,groups:b,data:g}=r;if(t.facet!=="auto"||t.data===g)return{channels:x,groups:b};if(g.length>0&&(b.size>1||b.size===1&&x.fx&&x.fy&&[...b][0][1].size>1)&&Ff(hf(t.data))===Ff(g))Ur(`Warning: the ${t.ariaLabel} mark appears to use faceted data, but isn’t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function ZU(t,r={}){return xf({...r,x:null,y:null},(f,u,h,x,b,g)=>{return g.getMarkState(t)})}function VU(t){let r=[];for(let f of t){let u=f.tip;if(u){if(u===!0)u={};else if(typeof u==="string")u={pointer:u};let{pointer:h,preferredAnchor:x}=u;if(h=/^x$/i.test(h)?sd:/^y$/i.test(h)?qg:Od,u=h(ZU(f,u)),u.title=null,x===void 0)u.preferredAnchor=h===qg?"left":"bottom";let b=uM(f.data,u);b.facet=f.facet,b.facetAnchor=f.facetAnchor,r.push(b)}}return r}function NU(t,r,f){let{projection:u,x:h={},y:x={},fx:b={},fy:g={},axis:c,grid:_,facet:l={},facet:{axis:d=c,grid:w}=l,x:{axis:M=c,grid:H=M===null?null:_}=h,y:{axis:q=c,grid:$=q===null?null:_}=x,fx:{axis:E=d,grid:P=E===null?null:w}=b,fy:{axis:J=d,grid:Q=J===null?null:w}=g}=f;if(u||!P1(h)&&!gM("x",t))M=H=null;if(u||!P1(x)&&!gM("y",t))q=$=null;if(!r.has("fx"))E=P=null;if(!r.has("fy"))J=Q=null;if(M===void 0)M=!L4(t,"x");if(q===void 0)q=!L4(t,"y");if(E===void 0)E=!L4(t,"fx");if(J===void 0)J=!L4(t,"fy");if(M===!0)M="bottom";if(q===!0)q="left";if(E===!0)E=M==="top"||M===null?"bottom":"top";if(J===!0)J=q==="right"||q===null?"left":"right";let U=[];return F4(U,Q,Uw,g),T4(U,J,$w,"right","left",l,g),F4(U,P,Kw,b),T4(U,E,Pw,"top","bottom",l,b),F4(U,$,Qw,x),T4(U,q,zg,"left","right",f,x),F4(U,H,Cw,h),T4(U,M,Rg,"bottom","top",f,h),U}function T4(t,r,f,u,h,x,b){if(!r)return;let g=TU(r);b=FU(g?u:r,x,b);let{line:c}=b;if((f===zg||f===Rg)&&c&&!Hu(c))t.push(yw(LU(b)));if(t.push(f(b)),g)t.push(f({...b,anchor:h,label:null}))}function F4(t,r,f,u){if(!r||Hu(r))return;t.push(f(GU(r,u)))}function TU(t){return/^\s*both\s*$/i.test(t)}function FU(t,r,{line:f=r.line,ticks:u,tickSize:h,tickSpacing:x,tickPadding:b,tickFormat:g,tickRotate:c,fontVariant:_,ariaLabel:l,ariaDescription:d,label:w=r.label,labelAnchor:M,labelArrow:H=r.labelArrow,labelOffset:q}){return{anchor:t,line:f,ticks:u,tickSize:h,tickSpacing:x,tickPadding:b,tickFormat:g,tickRotate:c,fontVariant:_,ariaLabel:l,ariaDescription:d,label:w,labelAnchor:M,labelArrow:H,labelOffset:q}}function LU(t){let{anchor:r,line:f}=t;return{anchor:r,facetAnchor:r+"-empty",stroke:f===!0?void 0:f}}function GU(t,{stroke:r=C1(t)?t:void 0,ticks:f=BU(t)?t:void 0,tickSpacing:u,ariaLabel:h,ariaDescription:x}){return{stroke:r,ticks:f,tickSpacing:u,ariaLabel:h,ariaDescription:x}}function BU(t){switch(typeof t){case"number":return!0;case"string":return!C1(t)}return Qr(t)||typeof t?.range==="function"}function L4(t,r){let f=`${r}-axis `;return t.some((u)=>u.ariaLabel?.startsWith(f))}function gM(t,r){for(let f of r)for(let u in f.channels){let{scale:h}=f.channels[u];if(h===t||h==="projection")return!0}return!1}function zU(t,r){for(let f in t){let u=t[f],h=r[f];if(u.label===void 0&&h)u.label=h.label}return t}function RU({fx:t,fy:r},f){let{marginTop:u,marginRight:h,marginBottom:x,marginLeft:b,width:g,height:c}=_4(f),_=t&&cM(t),l=r&&cM(r);return{marginTop:r?l[0]:u,marginRight:t?g-_[1]:h,marginBottom:r?c-l[1]:x,marginLeft:t?_[0]:b,inset:{marginTop:f.marginTop,marginRight:f.marginRight,marginBottom:f.marginBottom,marginLeft:f.marginLeft},width:g,height:c}}function cM(t){let r=t.domain();if(r.length===0)return[0,t.bandwidth()];let f=t(r[0]),u=t(r[r.length-1]);if(u{let k=U8(Ct(tt,P),v?.[J]),B=Ct(tt,i),bt=Ct(tt,m),ut=Ct(tt,X),dt=Ql(c,{z:B,fill:bt,stroke:ut}),Vt=[],pt=[],b0=k&&U([]),oM=B&&Y([]),mM=bt&&p([]),jM=ut&&a([]),bc=t&&d([]),eM=t&&M([]),gc=r&&q([]),aM=r&&E([]),yM=oU(t,r,tt),kM=0;for(let iu of c)iu.initialize(tt);if(b)b.initialize(tt);if(x)x.initialize(tt);for(let iu of D){let cc=[];for(let Zu of c)Zu.scope("facet",iu);if(b)b.scope("facet",iu);if(x)x.scope("facet",iu);for(let[Zu,pM]of Xb(iu,dt))for(let[tH,I8]of Xb(pM,k))for(let[g0,s0]of yM(I8)){if(dt)s0.z=Zu;if(x&&!x.reduce(g0,s0))continue;if(cc.push(kM++),pt.push(h.reduceIndex(g0,tt,s0)),k)b0.push(tH);if(B)oM.push(dt===B?Zu:B[(g0.length>0?g0:I8)[0]]);if(bt)mM.push(dt===bt?Zu:bt[(g0.length>0?g0:I8)[0]]);if(ut)jM.push(dt===ut?Zu:ut[(g0.length>0?g0:I8)[0]]);if(bc)bc.push(s0.x1),eM.push(s0.x2);if(gc)gc.push(s0.y1),aM.push(s0.y2);for(let rH of c)rH.reduce(g0,s0);if(b)b.reduce(g0,s0)}Vt.push(cc)}return Ul(Vt,b,g),{data:pt,facets:Vt}}),...!K8(c,"x")&&(l?{x1:l,x2:w,x:U1(l,w)}:{x:C,x1:z,x2:G}),...!K8(c,"y")&&(H?{y1:H,y2:$,y:U1(H,$)}:{y:W,y1:N,y2:L}),...Q&&{[J]:Q},...Object.fromEntries(c.map(({name:tt,output:D})=>[tt,D]))}}function IU({cumulative:t,domain:r,thresholds:f,interval:u,...h},x){return[h,{cumulative:t,domain:r,thresholds:f,interval:u,...x}]}function nU(t,{cumulative:r,domain:f,thresholds:u,interval:h},x){if(t={...z0(t)},t.domain===void 0)t.domain=f;if(t.cumulative===void 0)t.cumulative=r;if(t.thresholds===void 0)t.thresholds=u;if(t.interval===void 0)t.interval=h;if(t.value===void 0)t.value=x;return t.thresholds=XU(t.thresholds,t.interval),t}function dM(t){if(t==null)return;let{value:r,cumulative:f,domain:u=nt,thresholds:h}=t,x=(b)=>{let g=Ct(b,r),c;if(Dt(g)||SU(h)){g=qt(g,Zb,Float64Array);let[l,d]=typeof u==="function"?u(g):u,w=typeof h==="function"&&!Lf(h)?h(g,l,d):h;if(typeof w==="number")w=vh(l,d,w);if(Lf(w)){if(u===nt)l=w.floor(l),d=w.offset(w.floor(d));w=w.range(l,w.offset(d))}c=w}else{g=Hr(g);let[l,d]=typeof u==="function"?u(g):u,w=typeof h==="function"&&!Lf(h)?h(g,l,d):h;if(typeof w==="number")if(u===nt){let M=Xf(l,d,w);if(isFinite(M))if(M>0){let H=Math.round(l/M),q=Math.round(d/M);if(!(H*M<=l))--H;if(!(q*M>d))++q;let $=q-H+1;w=new Float64Array($);for(let E=0;E<$;++E)w[E]=(H+E)*M}else if(M<0){M=-M;let H=Math.round(l*M),q=Math.round(d*M);if(!(H/M<=l))--H;if(!(q/M>d))++q;let $=q-H+1;w=new Float64Array($);for(let E=0;E<$;++E)w[E]=(H+E)/M}else w=[l];else w=[l]}else w=jr(l,d,w);else if(Lf(w)){if(u===nt)l=w.floor(l),d=w.offset(w.floor(d));w=w.range(l,w.offset(d))}c=w}let _=[];if(c.length===1)_.push([c[0],c[0]]);else for(let l=1;l0?mU:og)(_,c,g),_};return x.label=f0(r),x}function XU(t,r,f=wM){if(t===void 0)return r===void 0?f:B0(r);if(typeof t==="string"){switch(t.toLowerCase()){case"freedman-diaconis":return j8;case"scott":return Y1;case"sturges":return Y8;case"auto":return wM}return J8(t)}return t}function vU(t,r){return Jl(t,r,MM)}function MM(t,r,f){return Ib(t,r,f,HM)}function HM(t,r,f){return nb(t,r,f,qM)}function qM(t,r){return W8(t,r,YU)}function YU(t){switch(`${t}`.toLowerCase()){case"x":return eU;case"x1":return yU;case"x2":return kU;case"y":return aU;case"y1":return pU;case"y2":return tC;case"z":return Cl}throw Error(`invalid bin reduce: ${t}`)}function wM(t,r,f){return Math.min(200,Y1(t,r,f))}function SU(t){return p_(t)||Qr(t)&&Dt(t)}function oU(t,r,f){let u=t?.(f),h=r?.(f);return u&&h?function*(x){let b=u.bin(x);for(let[g,[c,_]]of u.entries()){let l=h.bin(b[g]);for(let[d,[w,M]]of h.entries())yield[l[d],{data:f,x1:c,y1:w,x2:_,y2:M}]}}:u?function*(x){let b=u.bin(x);for(let[g,[c,_]]of u.entries())yield[b[g],{data:f,x1:c,x2:_}]}:function*(x){let b=h.bin(x);for(let[g,[c,_]]of h.entries())yield[b[g],{data:f,y1:c,y2:_}]}}function og(t,r,f){return r=Hr(r),(u)=>{let h=t.map(()=>[]);for(let x of u)h[n0(r,f[x])-1]?.push(x);return h}}function mU(t,r,f){let u=og(t,r,f);return(h)=>{let x=u(h);for(let b=1,g=x.length;b{let x=u(h);for(let b=x.length-2;b>=0;--b){let g=x[b+1],c=x[b];for(let _ of g)c.push(_)}return x}}function $M(t,r){let f=(+t+ +r)/2;return t instanceof Date?new Date(f):f}var eU={reduceIndex(t,r,{x1:f,x2:u}){return $M(f,u)}},aU={reduceIndex(t,r,{y1:f,y2:u}){return $M(f,u)}},yU={reduceIndex(t,r,{x1:f}){return f}},kU={reduceIndex(t,r,{x2:f}){return f}},pU={reduceIndex(t,r,{y1:f}){return f}},tC={reduceIndex(t,r,{y2:f}){return f}};var fC={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class mg extends wt{constructor(t,r={}){let{x1:f,y1:u,x2:h,y2:x,z:b,curve:g,tension:c}=r;super(t,{x1:{value:f,scale:"x"},y1:{value:u,scale:"y"},x2:{value:h,scale:"x",optional:!0},y2:{value:x,scale:"y",optional:!0},z:{value:J1(r),optional:!0}},r,fC);this.z=b,this.curve=Sg(g,c)}filter(t){return t}render(t,r,f,u,h){let{x1:x,y1:b,x2:g=x,y2:c=b}=f;return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,r,0,0).call((_)=>_.selectAll().data(E4(t,[x,b,g,c],this,f)).enter().append("path").call(Kt,this).call(P4,this,f).attr("d",D7().curve(this.curve).defined((l)=>l>=0).x0((l)=>x[l]).y0((l)=>b[l]).x1((l)=>g[l]).y1((l)=>c[l]))).node()}}function Af(t,r){let{x:f=L0,...u}=B4(r);return new mg(t,Ig(Og({...u,x1:f,x2:void 0},f===L0?"y2":"y")))}var uC={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class jg extends wt{constructor(t,r={}){let{x1:f,y1:u,x2:h,y2:x,curve:b,tension:g}=r;super(t,{x1:{value:f,scale:"x"},y1:{value:u,scale:"y"},x2:{value:h,scale:"x",optional:!0},y2:{value:x,scale:"y",optional:!0}},r,uC);this.curve=G4(b,g),Ju(this,r)}project(t,r,f){if(this.curve!==Df)super.project(t,r,f)}render(t,r,f,u,h){let{x1:x,y1:b,x2:g=x,y2:c=b}=f,{curve:_}=this;return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,r).call((l)=>l.selectAll().data(t).enter().append("path").call(Kt,this).attr("d",_===Df&&h.projection?hC(h.path(),x,b,g,c):(d)=>{let w=Wr(),M=_(w);return M.lineStart(),M.point(x[d],b[d]),M.point(g[d],c[d]),M.lineEnd(),w}).call(Yt,this,f).call(T8,this,f,h)).node()}}function hC(t,r,f,u,h){return r=Hr(r),f=Hr(f),u=Hr(u),h=Hr(h),(x)=>t({type:"LineString",coordinates:[[r[x],f[x]],[u[x],h[x]]]})}function eg(t,{x:r,x1:f,x2:u,y:h,y1:x,y2:b,...g}={}){return[f,u]=PM(r,f,u),[x,b]=PM(h,x,b),new jg(t,{...g,x1:f,x2:u,y1:x,y2:b})}function PM(t,r,f){if(t===void 0){if(r===void 0){if(f!==void 0)return[f]}else if(f===void 0)return[r]}else if(r===void 0)return f===void 0?[t]:[t,f];else if(f===void 0)return[t,r];return[r,f]}var xC={ariaLabel:"bar"};class JM extends wt{constructor(t,r,f={},u=xC){super(t,r,f,u);B8(this,f),z8(this,f)}render(t,r,f,u,h){let{rx:x,ry:b,rx1y1:g,rx1y2:c,rx2y1:_,rx2y2:l}=this,d=this._x(r,f,u),w=this._y(r,f,u),M=this._width(r,f,u),H=this._height(r,f,u);return gt("svg:g",h).call(Tt,this,u,h).call(this._transform,this,r).call((q)=>q.selectAll().data(t).enter().call(g||c||_||l?($)=>$.append("path").call(Kt,this).call(R8,d,w,EM(d,M),EM(w,H),this).call(Yt,this,f):($)=>$.append("rect").call(Kt,this).attr("x",d).attr("width",M).attr("y",w).attr("height",H).call(rt,"rx",x).call(rt,"ry",b).call(Yt,this,f))).node()}_x(t,{x:r},{marginLeft:f}){let{insetLeft:u}=this;return r?(h)=>r[h]+u:f+u}_y(t,{y:r},{marginTop:f}){let{insetTop:u}=this;return r?(h)=>r[h]+u:f+u}_width({x:t},{x:r},{marginRight:f,marginLeft:u,width:h}){let{insetLeft:x,insetRight:b}=this,g=r&&t?t.bandwidth():h-f-u;return Math.max(0,g-x-b)}_height({y:t},{y:r},{marginTop:f,marginBottom:u,height:h}){let{insetTop:x,insetBottom:b}=this,g=r&&t?t.bandwidth():h-f-u;return Math.max(0,g-x-b)}}function EM(t,r){return typeof t==="function"&&typeof r==="function"?(f)=>t(f)+r(f):typeof t==="function"?(f)=>t(f)+r:typeof r==="function"?(f)=>t+r(f):t+r}class ag extends JM{constructor(t,r={},f){let{x1:u,x2:h,y:x}=r;super(t,{x1:{value:u,scale:"x"},x2:{value:h,scale:"x"},y:{value:x,scale:"y",type:"band",optional:!0}},r,f)}_transform(t,r,{x:f}){t.call(Ft,r,{x:f},0,0)}_x({x:t},{x1:r,x2:f},{marginLeft:u}){let{insetLeft:h}=this;return u0(t)?u+h:(x)=>Math.min(r[x],f[x])+h}_width({x:t},{x1:r,x2:f},{marginRight:u,marginLeft:h,width:x}){let{insetLeft:b,insetRight:g}=this;return u0(t)?x-u-h-b-g:(c)=>Math.max(0,Math.abs(f[c]-r[c])-b-g)}}function A8(t,r={}){if(!Fb(r))r={...r,y:L0,x2:$t};return new ag(t,sg(U4(Ag(r))))}var bC={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function gC(t){return t.sort===void 0&&t.reverse===void 0?$l({channel:"-r"},t):t}class yg extends wt{constructor(t,r={}){let{x:f,y:u,r:h,rotate:x,symbol:b=rf,frameAnchor:g}=r,[c,_]=Bt(x,0),[l,d]=Ml(b),[w,M]=Bt(h,l==null?3:4.5);super(t,{x:{value:f,scale:"x",optional:!0},y:{value:u,scale:"y",optional:!0},r:{value:w,scale:"r",filter:wu,optional:!0},rotate:{value:c,optional:!0},symbol:{value:l,scale:"auto",optional:!0}},gC(r),bC);this.r=M,this.rotate=_,this.symbol=d,this.frameAnchor=Gf(g);let{channels:H}=this,{symbol:q}=H;if(q){let{fill:$,stroke:E}=H;q.hint={fill:$?$.value===q.value?"color":"currentColor":this.fill??"currentColor",stroke:E?E.value===q.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,f,u,h){let{x,y:b}=r,{x:g,y:c,r:_,rotate:l,symbol:d}=f,{r:w,rotate:M,symbol:H}=this,[q,$]=A0(this,u),E=H===rf,P=_?void 0:w*w*Math.PI;if(w1(w))t=[];return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,{x:g&&x,y:c&&b}).call((J)=>J.selectAll().data(t).enter().append(E?"circle":"path").call(Kt,this).call(E?(Q)=>{Q.attr("cx",g?(U)=>g[U]:q).attr("cy",c?(U)=>c[U]:$).attr("r",_?(U)=>_[U]:w)}:(Q)=>{Q.attr("transform",R1`translate(${g?(U)=>g[U]:q},${c?(U)=>c[U]:$})${l?(U)=>` rotate(${l[U]})`:M?` rotate(${M})`:""}`).attr("d",_&&d?(U)=>{let C=Wr();return d[U].draw(C,_[U]*_[U]*Math.PI),C}:_?(U)=>{let C=Wr();return H.draw(C,_[U]*_[U]*Math.PI),C}:d?(U)=>{let C=Wr();return d[U].draw(C,P),C}:(()=>{let U=Wr();return H.draw(U,P),U})())}).call(Yt,this,f)).node()}}function Ku(t,{x:r,y:f,...u}={}){if(u.frameAnchor===void 0)[r,f]=r0(r,f);return new yg(t,{...u,x:r,y:f})}var cC={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class z4 extends wt{constructor(t,r={}){let{x:f,y:u,z:h,curve:x,tension:b}=r;super(t,{x:{value:f,scale:"x"},y:{value:u,scale:"y"},z:{value:J1(r),optional:!0}},r,cC);this.z=h,this.curve=G4(x,b),Ju(this,r)}filter(t){return t}project(t,r,f){if(this.curve!==Df)super.project(t,r,f)}render(t,r,f,u,h){let{x,y:b}=f,{curve:g}=this;return gt("svg:g",h).call(Tt,this,u,h).call(Ft,this,r).call((c)=>c.selectAll().data(E4(t,[x,b],this,f)).enter().append("path").call(Kt,this).call(P4,this,f).call(vd,this,f,h).attr("d",g===Df&&h.projection?_C(h.path(),x,b):c1().curve(g).defined((_)=>_>=0).x((_)=>x[_]).y((_)=>b[_]))).node()}}function _C(t,r,f){return r=Hr(r),f=Hr(f),(u)=>{let h=[],x=[h];for(let b of u)if(b===-1)h=[],x.push(h);else h.push([r[b],f[b]]);return t({type:"MultiLineString",coordinates:x})}}function R4(t,{x:r,y:f,...u}={}){return[r,f]=r0(r,f),new z4(t,{...u,x:r,y:f})}function df(t,{x:r=L0,y:f=$t,...u}={}){return new z4(t,B4({...u,x:r,y:f}))}wt.prototype.plot=function({marks:t=[],...r}={}){return lr({...r,marks:[...t,this]})};var O0={"fig-auction-clearing-ladder":{x:"Cumulative REP demand (REP)",y:"Bid limit (ETH/REP)"},"fig-liquidation-health-curve":{x:"REP price (REP/ETH)",y:"Required backing (REP)"},"fig-statoblast-escalation-cost-curve":{x:"Elapsed escalation interval (% of interval)",y:"Required bond (% of non-decision threshold)"},"fig-statoblast-retention-utilization":{x:"Fee-eligible allowance utilization (%)",y:"Annualized open-interest fee (%)"},"fig-zoltar-fork-threshold-decay":{x:"Fork generation (count)",y:"Theoretical genesis supply (%)"},"plot-open-oracle-integration-2":{x:"Censorship duration (steps)",y:"Cost or payoff (ETH)"},"plot-statoblast-whitepaper-7":{x:"Escrowed balance (REP)",y:"Outcome (category)"},"plot-statoblast-whitepaper-8":{x:"Escrowed balance (REP)",y:"Outcome (category)"},"plot-statoblast-whitepaper-19":{x:"Child-universe collateral (ETH)",y:"Collateral destination (category)"}};function QM(t,r,f){let u=t/r,x=f.filter((P)=>P.eth>0).filter((P)=>P.price>=u).sort((P,J)=>J.price-P.price),b=Array.from(new Set(x.map((P)=>P.price))).map((P)=>({bids:x.filter((J)=>J.price===P),price:P,totalEth:x.filter((J)=>J.price===P).reduce((J,Q)=>J+Q.eth,0)})),g=0,c=0,_=0,l=!1,d=0,w=0,M=[],H=new Map;for(let P of b){if(g>0&&g/P.price>r){l=!0,c=d,_=w;break}let J=Math.min(P.totalEth,Math.max(0,t-g)),Q=g+J,U=Q/P.price;M.push({cumulativeRep:U,price:P.price});for(let C of P.bids)H.set(C.key,U);if(U>=r){l=!0,c=P.price,_=Math.max(0,Math.min(J,r*P.price-g)),g+=_;break}if(Q>=t){l=!0,c=P.price,_=J,g=Q;break}g=Q,d=P.price,w=J}let q=new Map,$=c;if(l&&c>0){let P=_;for(let J of x)if(J.price>c)q.set(J.key,J.eth/c);else if(J.price===c){let Q=Math.min(J.eth,P);P-=Q,q.set(J.key,Q/c)}}else{let P=x.reduce((J,Q)=>J+Q.eth,0);if(g=P,P>0)for(let J of x)q.set(J.key,J.eth*r/P);c=u,$=P>0?P/r:0}return{bids:f.map((P)=>{let J=q.get(P.key)??0,Q="Rejected";if(J>0){let U=P.eth/$;Q=l&&J+0.000000001t.liquidationThresholdPrice&&h>=u,b=x?t.externalPayoff:0,g=Math.max(0,h-t.honestDisputeBarrierFraction),c=t.censorshipDuration*g*t.oracleReportLiquidity,_=t.oracleReportLiquidity/t.externalPayoff,l=g===0?Number.POSITIVE_INFINITY:(t.targetGriefRatio+1)/(g*_);return{attackerProfit:b,censorshipCost:c,censorshipRate:g,executionErrorThreshold:u,griefTarget:x?(t.targetGriefRatio+1)*t.externalPayoff:0,liquidationExecutable:x,manipulatedPriceError:h,safeCensorshipDuration:l}}var Of=1000000000000000000n;function KM(t){let r=Math.max(t.nonDecisionThreshold,1),f=BigInt(Math.round(r*Number(Of))),u=BigInt(Math.round(t.startBond*Number(Of))),h=!t.repeatDeposit&&u>=f?f-1n:u,x=t.repeatDeposit&&(u<=0n||u>=f),b=[t.invalidBalance,t.yesBalance,t.noBalance].filter((P)=>BigInt(Math.round(P*Number(Of)))>=f).length>=2,g=Math.max(0,r-t.noBalance),c=Math.min(t.proposedDeposit,g),_=Math.max(t.invalidBalance,t.yesBalance,t.noBalance),l=t.noBalance+c===_&&t.noBalance+c0n?d-1n:d,M=BigInt(Math.round(t.noBalance*Number(Of)))+w,H=x||b||t.noBalance>=r||BigInt(Math.round(t.proposedDeposit*Number(Of)))b>=t.runningCost).length,u=r.every((b)=>b===0),h=Math.max(...r),x=r.filter((b)=>b===h).length;if(f>=2||h>0&&x>=2)return{atCost:f,result:"None"};if(u)return{atCost:f,result:"Invalid"};if(t.invalidBalance>t.yesBalance&&t.invalidBalance>t.noBalance)return{atCost:f,result:"Invalid"};if(t.yesBalance>t.invalidBalance&&t.yesBalance>t.noBalance)return{atCost:f,result:"Yes"};if(t.noBalance>t.invalidBalance&&t.noBalance>t.yesBalance)return{atCost:f,result:"No"};return{atCost:f,result:"None"}}function iM(t){return Math.exp(2.4*(t-1))}function ZM(t){return(1-(0.999999996848-0.000000018968000059516044*Math.min(Math.max(t,0)/80,1))**31536000)*100}function VM(t,r=100){return Array.from({length:Math.max(0,t)},(f,u)=>{let h=r*0.99**u;return{forkThreshold:h/20,generation:u,theoreticalSupply:h}})}var kg=[{action:"validate question",id:"factory-question-validation",phase:"Deployment",receiver:"Question Data",source:"Pool Factory"},{action:"look up universe",id:"factory-universe-lookup",phase:"Deployment",receiver:"Zoltar",source:"Pool Factory"},{action:"deploy pool",id:"factory-pool-deployment",phase:"Deployment",receiver:"Security Pool",source:"Pool Factory"},{action:"deploy shares",id:"factory-share-token-deployment",phase:"Deployment",receiver:"Share Token",source:"Pool Factory"},{action:"deploy & wire",id:"factory-price-coordinator-deployment",phase:"Deployment",receiver:"Price Coordinator",source:"Pool Factory"},{action:"manage REP lifecycle",id:"zoltar-reputation-token-lifecycle",phase:"Universe lifecycle",receiver:"Reputation Token",source:"Zoltar"},{action:"mint / burn claims",id:"pool-share-token-claims",phase:"Market runtime",receiver:"Share Token",source:"Security Pool"},{action:"escrow REP",id:"pool-escalation-game-resolution",phase:"Resolution",receiver:"Escalation Game",source:"Security Pool"},{action:"read cached price",id:"pool-price-read",phase:"Risk operations",receiver:"Price Coordinator",source:"Security Pool"},{action:"fund report",id:"coordinator-oracle-report",phase:"Price discovery",receiver:"OpenOracle",source:"Price Coordinator"},{action:"settled callback",id:"oracle-coordinator-callback",phase:"Price settlement",receiver:"Price Coordinator",source:"OpenOracle"},{action:"execute guarded op",id:"coordinator-pool-execute",phase:"Risk execution",receiver:"Security Pool",source:"Price Coordinator"},{action:"request child",id:"share-token-forker-migration",phase:"Share migration",receiver:"Pool Forker",source:"Share Token"},{action:"snapshot game",id:"forker-escalation-snapshot",phase:"Fork snapshot",receiver:"Escalation Game",source:"Pool Forker"},{action:"migrate REP",id:"forker-migration-proxy",phase:"Fork migration",receiver:"Migration Proxy",source:"Pool Forker"},{action:"lock & split REP",id:"migration-proxy-zoltar",phase:"Fork migration",receiver:"Zoltar",source:"Migration Proxy"},{action:"deploy child",id:"forker-child-deployment",phase:"Fork migration",receiver:"Pool Factory",source:"Pool Forker"},{action:"migrate state",id:"forker-pool-migration",phase:"Fork migration",receiver:"Security Pool",source:"Pool Forker"},{action:"repair backing",id:"forker-truth-auction",phase:"Backing repair",receiver:"Truth Auction",source:"Pool Forker"}],O1=10000n;function NM(t){let r=/^([0-9]+)(?:\.([0-9]{1,4}))?$/.exec(t.trim());if(r===null)return;let f=r[1],u=r[2]??"";if(f===void 0)return;return BigInt(f)*O1+BigInt(u.padEnd(4,"0"))}function lC(t){let r=t/O1,f=(t%O1).toString().padStart(4,"0").replace(/0+$/,"");return f===""?r.toString():`${r}.${f}`}function TM(t,r,f,u){let h=r*f*u,x=Number(h)/Number(O1),b=r>0n&&f>0n?Number(t*O1)/Number(r*f):Number.POSITIVE_INFINITY;return{currentRequiredRep:x,currentRequiredRepDisplay:lC(h),state:h>t*O1?"liquidatable":"safe",thresholdPrice:b}}function FM(t,r,f){return`${t} At the selected values, required backing is ${f.currentRequiredRepDisplay} REP against ${r.toString()} unlocked REP, so the vault is ${f.state}.`}function LM(t,r){return t==="calls"?r==="calls"||r==="assets":t===r}var dC=[["openoracle-core","openoracle-ierc20","calls","transfer"],["openoracle-safe-erc20","openoracle-ierc1363","calls","approveAndCall","transferAndCall","transferFromAndCall"],["openoracle-safe-erc20","openoracle-ierc20","calls","allowance","approve","transfer","transferFrom"],["statoblast-auction-settlement-base","statoblast-security-pool-interface","calls","addFeeEligibleSecurityBondAllowance","configureVault","poolOwnershipDenominator","securityVaults","updateVaultFees"],["statoblast-escalation-carry","statoblast-binary-outcomes","uses","None"],["statoblast-escalation-carry","statoblast-forker-interface","calls","getDirectlyClaimedEscalationPrincipal"],["statoblast-escalation-carry","statoblast-merkle-mountain-range","uses","hashLeaf","hashParent"],["statoblast-escalation-carry","zoltar-constants","uses","MINIMUM_FORK_BURN_DIVISOR"],["statoblast-escalation-deposit-delegate","statoblast-binary-outcomes","uses","None"],["statoblast-escalation-escrow","statoblast-binary-outcomes","uses","None"],["statoblast-escalation-game","statoblast-binary-outcomes","uses","None"],["statoblast-escalation-game","statoblast-escalation-proof-verifier","calls","computeLnRatioScaled"],["statoblast-escalation-game-factory","statoblast-escalation-game","calls","start","startFromFork"],["statoblast-escalation-game-forker","statoblast-security-pool-interface","calls","configureVault","escalationGame","securityVaults","systemState"],["statoblast-escalation-game-forker","statoblast-security-pool-utils","uses","MIGRATION_TIME"],["statoblast-escalation-proof-verifier","statoblast-binary-outcomes","uses","Invalid","No","None","Yes"],["statoblast-escalation-settlement","statoblast-binary-outcomes","uses","None"],["statoblast-escalation-state","statoblast-security-pool-interface","calls","securityPoolForker"],["statoblast-escalation-state","zoltar-safe-erc20-ops","uses","safeTransfer","using for IERC20"],["statoblast-forker-base","statoblast-escalation-game","calls","forkCarrySnapshotInitialized"],["statoblast-forker-base","statoblast-security-pool-factory-interface","calls","getSecurityPoolOriginId"],["statoblast-forker-base","statoblast-security-pool-interface","calls","awaitingForkContinuation","escalationGame","initializeForkCarrySnapshotWithResolutionBalances","poolOwnershipDenominator","repToken","resumeForkedEscalationGame","securityPoolFactory","setAwaitingForkContinuation","systemState"],["statoblast-forker-base","statoblast-security-pool-utils","uses","PRICE_PRECISION"],["statoblast-migration-proxy","zoltar-safe-erc20-ops","uses","safeApprove","safeTransfer","using for IERC20"],["statoblast-pool-forker","statoblast-security-pool-interface","calls","activateForkMode","completeSetCollateralAmount","escalationGame","initializeForkedEscalationGame","parent","poolOwnershipDenominator","questionId","repToken","setOwnershipDenominator","setSystemState","setTotalShares","shareToken","shareTokenSupply","systemState","universeId","updateCollateralAmount","updateRetentionRate"],["statoblast-pool-forker","zoltar-safe-erc20-ops","uses","safeTransfer","using for IERC20"],["statoblast-price-coordinator","statoblast-security-pool-interface","calls","completeSetCollateralAmount","getTotalRepBalance","isEscalationResolved","performLiquidation","performSetSecurityBondsAllowance","performWithdrawRep","poolOwnershipDenominator","poolOwnershipToRep","repToPoolOwnership","securityVaults","statoblastSecurityMultiplierBps"],["statoblast-price-coordinator","statoblast-stored-open-oracle-game","calls","storedGame"],["statoblast-security-pool","statoblast-forker-interface","calls","getQuestionOutcome"],["statoblast-security-pool","statoblast-security-pool-factory-interface","calls","getSecurityPoolHasInheritedForkOutcome"],["statoblast-security-pool","statoblast-security-pool-interface","calls","priceOracleManagerAndOperatorQueuer","universeId"],["statoblast-security-pool","statoblast-share-token-interface","calls","authorize","burnCompleteSets","burnTokenIdAndGetRemainingSupply","getTokenId","mintCompleteSets"],["statoblast-security-pool","zoltar-safe-erc20-ops","uses","safeApprove","safeTransfer","safeTransferFrom","using for IERC20"],["statoblast-security-pool-deployer","statoblast-security-pool-worker","calls","deploy"],["statoblast-security-pool-factory","statoblast-security-pool-interface","calls","priceOracleManagerAndOperatorQueuer","setStartingParams","shareToken","universeId"],["statoblast-security-pool-factory","statoblast-security-pool-utils","uses","BPS_DENOMINATOR","calculateRetentionRate"],["statoblast-security-pool-factory","statoblast-share-token-interface","calls","authorize"],["statoblast-share-token","statoblast-erc1155","calls","_internalBatchTransferFrom","_internalTransferFrom"],["statoblast-share-token","statoblast-forker-interface","calls","createChildUniverse","initiateSecurityPoolFork"],["statoblast-share-token","zoltar-constants","uses","NUM_OUTCOMES"],["statoblast-vault-migration-base","openoracle-math","uses","ceilDiv"],["statoblast-vault-migration-base","statoblast-security-pool-interface","calls","authorizeChildPool","completeSetCollateralAmount","configureVault","escalationGame","feeIndex","parent","poolOwnershipDenominator","questionId","repToken","securityPoolFactory","securityPoolForker","securityVaults","setAwaitingForkContinuation","setOwnershipDenominator","shareToken","statoblastSecurityMultiplierBps","systemState","totalSecurityBondAllowance","transferEth","truthAuction","universeId","updateCollateralAmount","updateVaultFees"],["statoblast-vault-migration-base","statoblast-security-pool-utils","uses","MIGRATION_TIME","PRICE_PRECISION","calculateRetentionRate"],["statoblast-vault-migration-delegate","statoblast-child-game-initializer","calls","initializeChildForkedEscalationGameIfNeeded"],["statoblast-vault-migration-delegate","statoblast-security-pool-interface","calls","parent","setPoolFinancials","setSystemState","totalSecurityBondAllowance"],["statoblast-vault-migration-delegate","statoblast-security-pool-utils","uses","MIGRATION_TIME"],["test-complete-set-reentrant-receiver","statoblast-security-pool-interface","tests","createCompleteSet"],["test-coverage-helpers-harness","statoblast-merkle-mountain-range","uses","bagPeaks","hashLeaf","hashParent"],["test-coverage-helpers-harness","statoblast-escalation-proof-verifier","tests","bagCarryPeaks","computeEmptyNullifierRoot","computeMerkleMountainRangeRootFromProof","computeNullifierRoot","getCurrentCarryPeakForLeaf"],["test-coverage-helpers-harness","statoblast-token-id","uses","getTokenId","getTokenIds","unpackTokenId"],["test-coverage-helpers-harness","zoltar-safe-erc20-ops","uses","safeApprove","safeTransfer","safeTransferFrom","using for IERC20"],["test-coverage-helpers-harness","zoltar-scalar-outcomes","uses","absoluteInt256","addInt256Uint256","getScalarOutcomeName","intToDecimalString","mulDiv","uintToString","zeroPadLeft"],["test-escalation-factory-coverage-pool","statoblast-binary-outcomes","uses","None"],["test-escalation-forker-harness","statoblast-escalation-game","tests","exportForkedEscrowByOutcomeWithoutTransfer","exportVaultUnresolvedTotalsWithoutTransfer","recordForkedEscrowForOutcome"],["test-escalation-proof-pool","statoblast-escalation-game","tests","claimDepositForWinning","drainAllRep","exportForkedEscrowByOutcome","exportForkedEscrowByOutcomeWithoutTransfer","exportUnresolvedDeposit","exportVaultUnresolvedTotals","getFinalQuestionResolution","initializeForkCarrySnapshotWithResolutionBalances","previewDepositOnOutcome","recordDepositFromSecurityPool","recordForkedEscrowForOutcome","sweepResidualRepToSecurityPool","withdrawDeposit"],["test-escalation-proof-pool","zoltar-core","tests","burnRep","getRepToken"],["test-escalation-proof-pool","zoltar-reputation-token","tests","approve","transferFrom"],["test-forker-escrow-game","statoblast-binary-outcomes","uses","None"],["test-forker-escrow-game","zoltar-reputation-token","tests","balanceOf","transfer"],["test-forker-escrow-parent","test-forker-escrow-game","tests","drainToForker"],["test-forker-escrow-parent","zoltar-reputation-token","tests","balanceOf","transfer"],["test-forker-malicious-emitter","statoblast-security-pool-interface","tests","completeSetCollateralAmount","transferEth"],["test-incompatible-proof-verifier","statoblast-merkle-mountain-range","uses","hashParent"],["test-openoracle-rejecting-receiver","test-openoracle-adversarial-target","tests","getETHProtocolFees"],["test-safe-erc20-ops-harness","zoltar-safe-erc20-ops","uses","safeApprove","safeTransfer","safeTransferFrom","using for IERC20"],["test-share-token-authorization-pool","statoblast-share-token-interface","tests","authorize"],["test-truth-auction-alias-parent","zoltar-reputation-token","tests","balanceOf","transfer"],["zoltar-core","zoltar-reputation-token","calls","burn","getTotalTheoreticalSupply","mint","setMaxTheoreticalSupply"],["zoltar-safe-erc20-ops","zoltar-ierc20","calls","approve","transfer","transferFrom"],["openoracle-core","openoracle-safe-erc20","uses","safeTransfer","safeTransferFrom","using for IERC20"],["openoracle-core","openoracle-signature-transfer","calls","permitWitnessTransferFrom"],["openoracle-math","openoracle-panic","uses","DIVISION_BY_ZERO","UNDER_OVERFLOW","panic"],["openoracle-math","openoracle-safe-cast","uses","toUint"],["statoblast-erc1155","statoblast-ierc1155-receiver","calls","onERC1155BatchReceived","onERC1155Received"],["statoblast-escalation-calculations","statoblast-binary-outcomes","uses","None"],["statoblast-escalation-deposit-delegate","statoblast-escalation-deposit-context","calls","getQuestionResolution","hasReachedNonDecision"],["statoblast-escalation-deposit-delegate","statoblast-merkle-mountain-range","uses","hashLeaf","hashParent"],["statoblast-escalation-game-factory","statoblast-forker-interface","calls","getOwnForkRepBuckets","isEscalationWinnerHaircutPaidByFork"],["statoblast-escalation-game-factory","statoblast-security-pool-interface","calls","parent","repToken","securityPoolForker"],["statoblast-escalation-game-forker","statoblast-child-game-initializer","calls","initializeChildForkedEscalationGameIfNeeded"],["statoblast-escalation-game-forker","statoblast-escalation-game","calls","canTriggerOwnFork","claimDepositForWinningWithoutTransfer","exportForkedEscrowByOutcome","exportForkedEscrowByOutcomeWithoutTransfer","exportVaultUnresolvedTotalsWithoutTransfer","recordForkedEscrowForOutcome"],["statoblast-escalation-proof-verifier","statoblast-merkle-mountain-range","uses","bagPeaks","hashParent"],["statoblast-escalation-settlement","statoblast-forker-interface","calls","getQuestionOutcome","isEscalationDepositClaimedDirectly"],["statoblast-escalation-state","statoblast-escalation-proof-verifier","calls","computeEmptyNullifierRoot"],["statoblast-migration-proxy","zoltar-core","calls","addRepToMigrationBalance","forkUniverse","splitMigrationRep"],["statoblast-pool-forker","statoblast-binary-outcomes","uses","None"],["statoblast-pool-forker","statoblast-escalation-game","calls","canTriggerOwnFork","getEscalationGameEndDate","getFinalQuestionResolution","getForkCarryRoots","getForkCarrySnapshot","getOutcomeBalances","getQuestionResolution"],["statoblast-pool-forker","statoblast-migration-proxy","calls","forkUniverse","lockRep"],["statoblast-pool-forker","statoblast-security-pool-utils","uses","AUCTION_TIME","MAX_AUCTION_VAULT_HAIRCUT_DIVISOR","MIGRATION_TIME","PRICE_PRECISION"],["statoblast-pool-forker","statoblast-truth-auction","calls","finalize","refundLosingBidsFor","startAuction","withdrawBids"],["statoblast-pool-forker","zoltar-core","calls","forkQuestionMatches","getForkThreshold","getForkTime","getMigrationRepBalance"],["statoblast-pool-forker","zoltar-reputation-token","calls","balanceOf"],["statoblast-price-coordinator","openoracle-core","calls","report","withdrawTo"],["statoblast-price-coordinator","openoracle-math","uses","Ceil","ceilDiv","mulDiv"],["statoblast-price-coordinator","statoblast-iweth9","calls","approve","transferFrom"],["statoblast-price-coordinator","statoblast-security-pool-utils","uses","BPS_DENOMINATOR","MIN_REP_DEPOSIT"],["statoblast-price-coordinator","zoltar-reputation-token","calls","approve","transferFrom"],["statoblast-security-pool","statoblast-binary-outcomes","uses","None"],["statoblast-security-pool","statoblast-deployment-worker-config","calls","eventEmitter","factory"],["statoblast-security-pool","statoblast-escalation-game","calls","getEscalationGameEndDate","hasReachedNonDecision","initializeForkCarrySnapshotWithResolutionBalances","previewDepositOnOutcome","recordDepositFromSecurityPool","resumeFromFork","withdrawDeposit"],["statoblast-security-pool","statoblast-escalation-game-factory","calls","deployEscalationGame","deployEscalationGameFromFork"],["statoblast-security-pool","statoblast-price-coordinator","calls","isPriceValid","setRepEthPrice"],["statoblast-security-pool","statoblast-security-pool-utils","uses","BPS_DENOMINATOR","MIN_REP_DEPOSIT","MIN_SECURITY_BOND_DEBT","PRICE_PRECISION","calculateFeeAccrual","calculateLiquidationTransfer","calculateRetentionRate","calculateVaultFee"],["statoblast-security-pool","zoltar-core","calls","burnRep","forkQuestionMatches","getForkTime","getNonDecisionThreshold","getRepToken"],["statoblast-security-pool","zoltar-question-data","calls","getQuestionEndDate"],["statoblast-security-pool","zoltar-reputation-token","calls","balanceOf"],["statoblast-security-pool-factory","statoblast-auction-factory","calls","deployUniformPriceDualCapBatchAuction"],["statoblast-security-pool-factory","statoblast-price-coordinator","calls","setSecurityPool"],["statoblast-security-pool-factory","statoblast-price-coordinator-factory","calls","deployPriceOracleManagerAndOperatorQueuer"],["statoblast-security-pool-factory","statoblast-security-pool-deployer","calls","deploy"],["statoblast-security-pool-factory","statoblast-share-token-factory","calls","deployShareToken"],["statoblast-security-pool-factory","zoltar-core","calls","forkQuestionMatches","getForkTime","getNonDecisionThreshold","getRepToken"],["statoblast-security-pool-factory","zoltar-question-data","calls","getOutcomeLabels"],["statoblast-share-token","statoblast-binary-outcomes","uses","Invalid","No","Yes"],["statoblast-share-token","statoblast-security-pool-interface","calls","parent","securityPoolForker","shareToken","systemState","universeId"],["statoblast-share-token","statoblast-token-id","uses","getTokenId","getTokenIds","unpackTokenId"],["statoblast-share-token","zoltar-core","calls","getForkTime"],["statoblast-truth-auction","openoracle-math","uses","Ceil","mulDiv"],["statoblast-vault-migration-base","statoblast-migration-proxy","calls","splitToChild","sweepChildRep"],["test-escalation-factory-coverage-pool","statoblast-escalation-game-factory","tests","deployEscalationGame","deployEscalationGameFromFork"],["zoltar-core","zoltar-constants","uses","BURN_ADDRESS","GENESIS_REPUTATION_TOKEN","MINIMUM_FORK_BURN_DIVISOR"],["zoltar-core","zoltar-question-data","calls","getQuestionEndDate","isMalformedAnswerOption"],["zoltar-core","zoltar-safe-erc20-ops","uses","safeTransfer","safeTransferFrom","using for IERC20"],["zoltar-question-data","zoltar-scalar-outcomes","uses","getScalarOutcomeName"]],GM=dC.map(([t,r,f,...u])=>({members:u,relation:f,source:t,target:r}));var wC=[["openoracle-core","openoracle-errors","Errors"],["openoracle-core","openoracle-ierc20","IERC20"],["openoracle-core","openoracle-safe-erc20","SafeERC20"],["openoracle-core","openoracle-signature-transfer","ISignatureTransfer"],["openoracle-ierc1363","openoracle-ierc165","IERC165"],["openoracle-ierc1363","openoracle-ierc20","IERC20"],["openoracle-math","openoracle-panic","Panic"],["openoracle-math","openoracle-safe-cast","SafeCast"],["openoracle-safe-erc20","openoracle-ierc1363","IERC1363"],["openoracle-safe-erc20","openoracle-ierc20","IERC20"],["statoblast-auction-factory","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["statoblast-auction-interface","statoblast-auction-events","IUniformPriceDualCapBatchAuctionEvents"],["statoblast-auction-settlement-base","statoblast-forker-base","SecurityPoolForkerBase"],["statoblast-auction-settlement-base","statoblast-forker-types","SecurityPoolForkerForkData"],["statoblast-auction-settlement-base","statoblast-security-pool-interface","ISecurityPool"],["statoblast-auction-settlement-base","zoltar-core","Zoltar"],["statoblast-child-game-initializer","statoblast-escalation-game","EscalationGame"],["statoblast-child-game-initializer","statoblast-security-pool-interface","ISecurityPool"],["statoblast-deployment-worker-config","statoblast-event-emitter","SecurityPoolEventEmitter"],["statoblast-deployment-worker-config","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["statoblast-erc1155","statoblast-ierc1155","IERC1155"],["statoblast-erc1155","statoblast-ierc1155-receiver","IERC1155Receiver"],["statoblast-escalation-calculations","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-calculations","statoblast-escalation-state","EscalationGameState"],["statoblast-escalation-calculations","statoblast-escalation-types","ESCALATION_TIME_LENGTH","NonDecisionState"],["statoblast-escalation-carry","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-carry","statoblast-escalation-calculations","EscalationGameCalculations"],["statoblast-escalation-carry","statoblast-escalation-events","CarryConsumptionReason"],["statoblast-escalation-carry","statoblast-escalation-types","CarriedDepositProof","CarryLeafView","Deposit","MERKLE_MOUNTAIN_RANGE_MAX_PEAKS","NULLIFIER_DEPTH","Node","NonDecisionState","OutcomeState","OutcomeStateView"],["statoblast-escalation-carry","statoblast-forker-interface","ISecurityPoolForker"],["statoblast-escalation-carry","statoblast-merkle-mountain-range","MerkleMountainRange"],["statoblast-escalation-carry","zoltar-constants","Constants"],["statoblast-escalation-deposit-context","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-deposit-delegate","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-deposit-delegate","statoblast-escalation-deposit-context","IEscalationGameDepositContext"],["statoblast-escalation-deposit-delegate","statoblast-escalation-events","IEscalationGameEvents"],["statoblast-escalation-deposit-delegate","statoblast-escalation-storage","EscalationGameStorage"],["statoblast-escalation-deposit-delegate","statoblast-escalation-types","Deposit","MERKLE_MOUNTAIN_RANGE_MAX_PEAKS","Node","NonDecisionState","OutcomeState"],["statoblast-escalation-deposit-delegate","statoblast-merkle-mountain-range","MerkleMountainRange"],["statoblast-escalation-escrow","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-escrow","statoblast-escalation-carry","EscalationGameCarry"],["statoblast-escalation-escrow","statoblast-escalation-types","ForkedEscrowState","OutcomeState"],["statoblast-escalation-events","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-game","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-game","statoblast-escalation-deposit-delegate","EscalationGameDepositDelegate"],["statoblast-escalation-game","statoblast-escalation-proof-verifier","EscalationGameProofVerifier"],["statoblast-escalation-game","statoblast-escalation-settlement","EscalationGameSettlement"],["statoblast-escalation-game","statoblast-escalation-state","EscalationGameState"],["statoblast-escalation-game","statoblast-escalation-types","ESCALATION_TIME_LENGTH","NonDecisionState"],["statoblast-escalation-game","statoblast-security-pool-interface","ISecurityPool"],["statoblast-escalation-game","zoltar-reputation-token","ReputationToken"],["statoblast-escalation-game-factory","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-game-factory","statoblast-escalation-game","EscalationGame"],["statoblast-escalation-game-factory","statoblast-escalation-proof-verifier","EscalationGameProofVerifier"],["statoblast-escalation-game-factory","statoblast-forker-interface","ISecurityPoolForker"],["statoblast-escalation-game-factory","statoblast-security-pool-interface","ISecurityPool"],["statoblast-escalation-game-forker","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-game-forker","statoblast-child-game-initializer","ISecurityPoolForkerChildEscalationGameInitializer"],["statoblast-escalation-game-forker","statoblast-escalation-game","EscalationGame"],["statoblast-escalation-game-forker","statoblast-forker-base","SecurityPoolForkerBase"],["statoblast-escalation-game-forker","statoblast-forker-types","EscalationMigrationEntitlement","SecurityPoolForkerForkData"],["statoblast-escalation-game-forker","statoblast-security-pool-interface","ISecurityPool","SystemState"],["statoblast-escalation-game-forker","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-escalation-game-forker","statoblast-vault-migration-base","SecurityPoolForkerVaultMigrationBase"],["statoblast-escalation-game-forker","zoltar-core","Zoltar"],["statoblast-escalation-proof-verifier","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-proof-verifier","statoblast-escalation-types","EXCESS_REWARD_WINDOW_DIVISOR","LN2_SCALED","MAX_ATANH_ITERATIONS","MAX_EXP_ITERATIONS","MERKLE_MOUNTAIN_RANGE_MAX_PEAKS","NULLIFIER_DEPTH","SCALE"],["statoblast-escalation-proof-verifier","statoblast-merkle-mountain-range","MerkleMountainRange"],["statoblast-escalation-settlement","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-settlement","statoblast-escalation-escrow","EscalationGameEscrow"],["statoblast-escalation-settlement","statoblast-escalation-events","CarryConsumptionReason"],["statoblast-escalation-settlement","statoblast-escalation-types","CarriedDepositProof","Deposit","NonDecisionState"],["statoblast-escalation-settlement","statoblast-forker-interface","ISecurityPoolForker"],["statoblast-escalation-state","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-state","statoblast-escalation-events","IEscalationGameEvents"],["statoblast-escalation-state","statoblast-escalation-proof-verifier","EscalationGameProofVerifier"],["statoblast-escalation-state","statoblast-escalation-storage","EscalationGameStorage"],["statoblast-escalation-state","statoblast-security-pool-interface","ISecurityPool"],["statoblast-escalation-state","zoltar-ierc20","IERC20"],["statoblast-escalation-state","zoltar-reputation-token","ReputationToken"],["statoblast-escalation-state","zoltar-safe-erc20-ops","SafeERC20Ops"],["statoblast-escalation-storage","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-escalation-storage","statoblast-escalation-types","ForkedEscrowState","Node","NonDecisionState","OutcomeState"],["statoblast-escalation-types","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-event-emitter","statoblast-forker-events","ISecurityPoolForkerEvents"],["statoblast-event-emitter","statoblast-forker-storage","SecurityPoolForkerStorage"],["statoblast-event-emitter","statoblast-forker-types","SecurityPoolForkerForkData"],["statoblast-event-emitter","statoblast-security-pool-interface","AccountingReason","ISecurityPool","PoolAccountingSnapshot"],["statoblast-forker-base","statoblast-escalation-game","EscalationGame"],["statoblast-forker-base","statoblast-forker-events","ISecurityPoolForkerEvents"],["statoblast-forker-base","statoblast-forker-storage","SecurityPoolForkerStorage"],["statoblast-forker-base","statoblast-forker-types","EscalationForkSnapshot","SecurityPoolForkerForkData"],["statoblast-forker-base","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["statoblast-forker-base","statoblast-security-pool-interface","ISecurityPool","SystemState"],["statoblast-forker-base","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-forker-base","zoltar-core","Zoltar"],["statoblast-forker-events","statoblast-security-pool-interface","ISecurityPool"],["statoblast-forker-interface","statoblast-auction-interface","IUniformPriceDualCapBatchAuction"],["statoblast-forker-interface","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-forker-interface","statoblast-forker-events","ISecurityPoolForkerEvents"],["statoblast-forker-interface","statoblast-security-pool-interface","ISecurityPool"],["statoblast-forker-storage","statoblast-forker-types","EscalationForkSnapshot","EscalationMigrationEntitlement","OwnForkChildRepAllocation","SecurityPoolForkerForkData"],["statoblast-forker-storage","statoblast-migration-proxy","SecurityPoolMigrationProxy"],["statoblast-forker-storage","statoblast-security-pool-interface","ISecurityPool"],["statoblast-forker-types","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["statoblast-ierc1155","statoblast-ierc165","IERC165"],["statoblast-ierc1155-receiver","statoblast-ierc165","IERC165"],["statoblast-merkle-mountain-range","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-migration-proxy","zoltar-core","Zoltar"],["statoblast-migration-proxy","zoltar-ierc20","IERC20"],["statoblast-migration-proxy","zoltar-reputation-token","ReputationToken"],["statoblast-migration-proxy","zoltar-safe-erc20-ops","SafeERC20Ops"],["statoblast-pool-forker","statoblast-auction-interface","IUniformPriceDualCapBatchAuction"],["statoblast-pool-forker","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-pool-forker","statoblast-escalation-game","EscalationGame"],["statoblast-pool-forker","statoblast-escalation-game-forker","EscalationGameForker"],["statoblast-pool-forker","statoblast-escalation-types","ESCALATION_TIME_LENGTH"],["statoblast-pool-forker","statoblast-event-emitter","SecurityPoolEventEmitter"],["statoblast-pool-forker","statoblast-auction-settlement-base","SecurityPoolForkerAuctionSettlementBase"],["statoblast-pool-forker","statoblast-forker-types","EscalationForkSnapshot","EscalationMigrationEntitlement","SecurityPoolForkerForkData"],["statoblast-pool-forker","statoblast-migration-proxy","SecurityPoolMigrationProxy"],["statoblast-pool-forker","statoblast-security-pool-interface","ISecurityPool","SystemState"],["statoblast-pool-forker","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-pool-forker","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["statoblast-pool-forker","statoblast-vault-migration-delegate","SecurityPoolForkerVaultMigrationDelegate"],["statoblast-pool-forker","zoltar-core","Zoltar"],["statoblast-pool-forker","zoltar-ierc20","IERC20"],["statoblast-pool-forker","zoltar-reputation-token","ReputationToken"],["statoblast-pool-forker","zoltar-safe-erc20-ops","SafeERC20Ops"],["statoblast-price-coordinator","openoracle-core","OpenOracle"],["statoblast-price-coordinator","openoracle-math","Math"],["statoblast-price-coordinator","statoblast-iweth9","IWeth9"],["statoblast-price-coordinator","statoblast-security-pool-interface","ISecurityPool"],["statoblast-price-coordinator","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-price-coordinator","statoblast-stored-open-oracle-game","IStoredOpenOracleGame"],["statoblast-price-coordinator","zoltar-reputation-token","ReputationToken"],["statoblast-price-coordinator-factory","openoracle-core","OpenOracle"],["statoblast-price-coordinator-factory","statoblast-iweth9","IWeth9"],["statoblast-price-coordinator-factory","statoblast-price-coordinator","OpenOraclePriceCoordinator"],["statoblast-price-coordinator-factory","zoltar-reputation-token","ReputationToken"],["statoblast-security-pool","openoracle-core","OpenOracle"],["statoblast-security-pool","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-security-pool","statoblast-deployment-worker-config","ISecurityPoolDeploymentWorkerConfiguration"],["statoblast-security-pool","statoblast-escalation-game","EscalationGame"],["statoblast-security-pool","statoblast-escalation-game-factory","EscalationGameFactory"],["statoblast-security-pool","statoblast-escalation-types","CarriedDepositProof"],["statoblast-security-pool","statoblast-event-emitter","SecurityPoolEventEmitter"],["statoblast-security-pool","statoblast-forker-interface","ISecurityPoolForker"],["statoblast-security-pool","statoblast-price-coordinator","OpenOraclePriceCoordinator"],["statoblast-security-pool","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["statoblast-security-pool","statoblast-security-pool-interface","AccountingReason","ISecurityPool","PoolAccountingSnapshot","QuestionOutcome","SecurityVault","SystemState"],["statoblast-security-pool","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-security-pool","statoblast-share-token-interface","IShareToken"],["statoblast-security-pool","zoltar-core","Zoltar"],["statoblast-security-pool","zoltar-ierc20","IERC20"],["statoblast-security-pool","zoltar-question-data","ZoltarQuestionData"],["statoblast-security-pool","zoltar-reputation-token","ReputationToken"],["statoblast-security-pool","zoltar-safe-erc20-ops","SafeERC20Ops"],["statoblast-security-pool-deployer","openoracle-core","OpenOracle"],["statoblast-security-pool-deployer","statoblast-escalation-game-factory","EscalationGameFactory"],["statoblast-security-pool-deployer","statoblast-event-emitter","SecurityPoolEventEmitter"],["statoblast-security-pool-deployer","statoblast-price-coordinator","OpenOraclePriceCoordinator"],["statoblast-security-pool-deployer","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["statoblast-security-pool-deployer","statoblast-security-pool-interface","ISecurityPool"],["statoblast-security-pool-deployer","statoblast-security-pool-worker","SecurityPoolDeploymentWorker"],["statoblast-security-pool-deployer","statoblast-share-token-interface","IShareToken"],["statoblast-security-pool-deployer","zoltar-core","Zoltar"],["statoblast-security-pool-deployer","zoltar-question-data","ZoltarQuestionData"],["statoblast-security-pool-factory","openoracle-core","OpenOracle"],["statoblast-security-pool-factory","statoblast-auction-factory","UniformPriceDualCapBatchAuctionFactory"],["statoblast-security-pool-factory","statoblast-escalation-game-factory","EscalationGameFactory"],["statoblast-security-pool-factory","statoblast-forker-interface","ISecurityPoolForker"],["statoblast-security-pool-factory","statoblast-price-coordinator","OpenOraclePriceCoordinator"],["statoblast-security-pool-factory","statoblast-price-coordinator-factory","PriceOracleManagerAndOperatorQueuerFactory"],["statoblast-security-pool-factory","statoblast-security-pool-deployer","SecurityPoolDeployer"],["statoblast-security-pool-factory","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["statoblast-security-pool-factory","statoblast-security-pool-interface","ISecurityPool"],["statoblast-security-pool-factory","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-security-pool-factory","statoblast-share-token-factory","ShareTokenFactory"],["statoblast-security-pool-factory","statoblast-share-token-interface","IShareToken"],["statoblast-security-pool-factory","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["statoblast-security-pool-factory","zoltar-core","Zoltar"],["statoblast-security-pool-factory","zoltar-question-data","ZoltarQuestionData"],["statoblast-security-pool-factory","zoltar-reputation-token","ReputationToken"],["statoblast-security-pool-factory-interface","statoblast-price-coordinator","OpenOraclePriceCoordinator"],["statoblast-security-pool-factory-interface","statoblast-security-pool-interface","ISecurityPool"],["statoblast-security-pool-factory-interface","statoblast-share-token-interface","IShareToken"],["statoblast-security-pool-factory-interface","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["statoblast-security-pool-interface","openoracle-core","OpenOracle"],["statoblast-security-pool-interface","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-security-pool-interface","statoblast-escalation-game","EscalationGame"],["statoblast-security-pool-interface","statoblast-escalation-types","CarriedDepositProof"],["statoblast-security-pool-interface","statoblast-price-coordinator","OpenOraclePriceCoordinator"],["statoblast-security-pool-interface","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["statoblast-security-pool-interface","statoblast-share-token-interface","IShareToken"],["statoblast-security-pool-interface","zoltar-core","Zoltar"],["statoblast-security-pool-interface","zoltar-question-data","ZoltarQuestionData"],["statoblast-security-pool-interface","zoltar-reputation-token","ReputationToken"],["statoblast-security-pool-worker","openoracle-core","OpenOracle"],["statoblast-security-pool-worker","statoblast-escalation-game-factory","EscalationGameFactory"],["statoblast-security-pool-worker","statoblast-event-emitter","SecurityPoolEventEmitter"],["statoblast-security-pool-worker","statoblast-price-coordinator","OpenOraclePriceCoordinator"],["statoblast-security-pool-worker","statoblast-security-pool","SecurityPool"],["statoblast-security-pool-worker","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["statoblast-security-pool-worker","statoblast-security-pool-interface","ISecurityPool"],["statoblast-security-pool-worker","statoblast-share-token-interface","IShareToken"],["statoblast-security-pool-worker","zoltar-core","Zoltar"],["statoblast-security-pool-worker","zoltar-question-data","ZoltarQuestionData"],["statoblast-share-token","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-share-token","statoblast-erc1155","ERC1155"],["statoblast-share-token","statoblast-forker-interface","ISecurityPoolForker"],["statoblast-share-token","statoblast-security-pool-interface","ISecurityPool","SystemState"],["statoblast-share-token","statoblast-share-token-interface","IShareToken"],["statoblast-share-token","statoblast-token-id","TokenId"],["statoblast-share-token","zoltar-constants","Constants"],["statoblast-share-token","zoltar-core","Zoltar"],["statoblast-share-token-factory","statoblast-share-token","ShareToken"],["statoblast-share-token-factory","zoltar-core","Zoltar"],["statoblast-share-token-interface","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-share-token-interface","statoblast-security-pool-interface","ISecurityPool"],["statoblast-token-id","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-truth-auction","openoracle-math","Math"],["statoblast-truth-auction","statoblast-auction-events","IUniformPriceDualCapBatchAuctionEvents"],["statoblast-truth-auction","statoblast-auction-interface","IUniformPriceDualCapBatchAuction"],["statoblast-vault-migration-base","openoracle-math","Math"],["statoblast-vault-migration-base","statoblast-binary-outcomes","BinaryOutcomes"],["statoblast-vault-migration-base","statoblast-escalation-game","EscalationGame"],["statoblast-vault-migration-base","statoblast-forker-base","SecurityPoolForkerBase"],["statoblast-vault-migration-base","statoblast-forker-types","OwnForkChildRepAllocation","SecurityPoolForkerForkData"],["statoblast-vault-migration-base","statoblast-migration-proxy","SecurityPoolMigrationProxy"],["statoblast-vault-migration-base","statoblast-security-pool-interface","ISecurityPool","SystemState"],["statoblast-vault-migration-base","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-vault-migration-base","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["statoblast-vault-migration-delegate","statoblast-child-game-initializer","ISecurityPoolForkerChildEscalationGameInitializer"],["statoblast-vault-migration-delegate","statoblast-escalation-game","EscalationGame"],["statoblast-vault-migration-delegate","statoblast-forker-base","SecurityPoolForkerBase"],["statoblast-vault-migration-delegate","statoblast-forker-types","SecurityPoolForkerForkData"],["statoblast-vault-migration-delegate","statoblast-security-pool-interface","ISecurityPool","SystemState"],["statoblast-vault-migration-delegate","statoblast-security-pool-utils","SecurityPoolUtils"],["statoblast-vault-migration-delegate","statoblast-vault-migration-base","SecurityPoolForkerVaultMigrationBase"],["statoblast-vault-migration-delegate","zoltar-core","Zoltar"],["test-complete-set-reentrant-receiver","statoblast-ierc1155-receiver","IERC1155Receiver"],["test-complete-set-reentrant-receiver","statoblast-security-pool-interface","ISecurityPool"],["test-constructor-failure-zoltar","zoltar-reputation-token","ReputationToken"],["test-coverage-helpers-harness","infra-deployment-status-oracle","DeploymentStatusOracle"],["test-coverage-helpers-harness","statoblast-binary-outcomes","BinaryOutcomes"],["test-coverage-helpers-harness","statoblast-escalation-proof-verifier","EscalationGameProofVerifier"],["test-coverage-helpers-harness","statoblast-escalation-types","MERKLE_MOUNTAIN_RANGE_MAX_PEAKS"],["test-coverage-helpers-harness","statoblast-merkle-mountain-range","MerkleMountainRange"],["test-coverage-helpers-harness","statoblast-token-id","TokenId"],["test-coverage-helpers-harness","zoltar-ierc20","IERC20"],["test-coverage-helpers-harness","zoltar-safe-erc20-ops","SafeERC20Ops"],["test-coverage-helpers-harness","zoltar-scalar-outcomes","ScalarOutcomes"],["test-erc1155-coverage-harness","statoblast-erc1155","ERC1155"],["test-erc1155-receiver-mock","statoblast-ierc1155-receiver","IERC1155Receiver"],["test-escalation-factory-coverage-pool","statoblast-binary-outcomes","BinaryOutcomes"],["test-escalation-factory-coverage-pool","statoblast-escalation-game","EscalationGame"],["test-escalation-factory-coverage-pool","statoblast-escalation-game-factory","EscalationGameFactory"],["test-escalation-factory-coverage-pool","zoltar-reputation-token","ReputationToken"],["test-escalation-forker-harness","statoblast-binary-outcomes","BinaryOutcomes"],["test-escalation-forker-harness","statoblast-escalation-game","EscalationGame"],["test-escalation-proof-pool","statoblast-binary-outcomes","BinaryOutcomes"],["test-escalation-proof-pool","statoblast-escalation-game","EscalationGame"],["test-escalation-proof-pool","statoblast-escalation-types","CarriedDepositProof"],["test-escalation-proof-pool","zoltar-core","Zoltar"],["test-escalation-proof-pool","zoltar-reputation-token","ReputationToken"],["test-false-returning-erc20","zoltar-ierc20","IERC20"],["test-fork-boundary-pool","zoltar-core","Zoltar"],["test-fork-threshold-harness","statoblast-escalation-calculations","EscalationGameCalculations"],["test-fork-threshold-harness","statoblast-escalation-proof-verifier","EscalationGameProofVerifier"],["test-fork-threshold-harness","statoblast-escalation-state","EscalationGameState"],["test-fork-threshold-harness","statoblast-security-pool-interface","ISecurityPool"],["test-fork-threshold-harness","zoltar-reputation-token","ReputationToken"],["test-forker-alternating-game","statoblast-security-pool-interface","ISecurityPool"],["test-forker-attack-factory","statoblast-security-pool-interface","ISecurityPool"],["test-forker-attack-factory","statoblast-share-token-interface","IShareToken"],["test-forker-attack-factory","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["test-forker-attack-parent","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["test-forker-attack-parent","statoblast-security-pool-interface","ISecurityPool","SystemState"],["test-forker-attack-parent","statoblast-share-token-interface","IShareToken"],["test-forker-auction-settlement","statoblast-forker-types","SecurityPoolForkerForkData"],["test-forker-auction-settlement","statoblast-auction-settlement-base","SecurityPoolForkerAuctionSettlementBase"],["test-forker-auction-settlement","statoblast-security-pool-interface","ISecurityPool"],["test-forker-auction-settlement","zoltar-core","Zoltar"],["test-forker-child-validation-harness","statoblast-forker-base","SecurityPoolForkerBase"],["test-forker-child-validation-harness","statoblast-security-pool-interface","ISecurityPool"],["test-forker-child-validation-harness","zoltar-core","Zoltar"],["test-forker-escrow-child","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["test-forker-escrow-child","statoblast-security-pool-interface","ISecurityPool","SystemState"],["test-forker-escrow-child","zoltar-reputation-token","ReputationToken"],["test-forker-escrow-factory","statoblast-security-pool-interface","ISecurityPool"],["test-forker-escrow-factory","statoblast-share-token-interface","IShareToken"],["test-forker-escrow-factory","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["test-forker-escrow-game","statoblast-binary-outcomes","BinaryOutcomes"],["test-forker-escrow-game","statoblast-security-pool-interface","ISecurityPool"],["test-forker-escrow-game","zoltar-reputation-token","ReputationToken"],["test-forker-escrow-parent","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["test-forker-escrow-parent","statoblast-security-pool-interface","ISecurityPool","SystemState"],["test-forker-escrow-parent","statoblast-share-token-interface","IShareToken"],["test-forker-escrow-parent","test-forker-escrow-game","SecurityPoolForkerEscrowAttackGameMock"],["test-forker-escrow-parent","zoltar-reputation-token","ReputationToken"],["test-forker-fake-pool","statoblast-security-pool-interface","SystemState"],["test-forker-fake-pool","zoltar-reputation-token","ReputationToken"],["test-forker-malicious-emitter","statoblast-security-pool-interface","ISecurityPool"],["test-incompatible-proof-verifier","statoblast-escalation-types","NULLIFIER_DEPTH"],["test-incompatible-proof-verifier","statoblast-merkle-mountain-range","MerkleMountainRange"],["test-openoracle-rejecting-receiver","statoblast-ierc1155-receiver","IERC1155Receiver"],["test-openoracle-rejecting-receiver","test-openoracle-adversarial-target","IOpenOracleAdversarialTarget"],["test-openoracle-token","zoltar-ierc20","IERC20"],["test-safe-erc20-ops-harness","zoltar-ierc20","IERC20"],["test-safe-erc20-ops-harness","zoltar-safe-erc20-ops","SafeERC20Ops"],["test-share-token-authorization-pool","statoblast-security-pool-interface","ISecurityPool","SystemState"],["test-share-token-authorization-pool","statoblast-share-token-interface","IShareToken"],["test-truth-auction-alias-child","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["test-truth-auction-alias-child","statoblast-security-pool-interface","ISecurityPool","SystemState"],["test-truth-auction-alias-child","zoltar-reputation-token","ReputationToken"],["test-truth-auction-alias-factory","statoblast-security-pool-interface","ISecurityPool"],["test-truth-auction-alias-factory","statoblast-share-token-interface","IShareToken"],["test-truth-auction-alias-factory","statoblast-truth-auction","UniformPriceDualCapBatchAuction"],["test-truth-auction-alias-parent","statoblast-security-pool-factory-interface","ISecurityPoolFactory"],["test-truth-auction-alias-parent","statoblast-security-pool-interface","ISecurityPool","SystemState"],["test-truth-auction-alias-parent","statoblast-share-token-interface","IShareToken"],["test-truth-auction-alias-parent","zoltar-reputation-token","ReputationToken"],["zoltar-core","zoltar-constants","Constants"],["zoltar-core","zoltar-ierc20","IERC20"],["zoltar-core","zoltar-question-data","ZoltarQuestionData"],["zoltar-core","zoltar-reputation-token","ReputationToken"],["zoltar-core","zoltar-safe-erc20-ops","SafeERC20Ops"],["zoltar-erc20","zoltar-context","Context"],["zoltar-erc20","zoltar-ierc20","IERC20"],["zoltar-erc20","zoltar-ierc20-metadata","IERC20Metadata"],["zoltar-ierc20-metadata","zoltar-ierc20","IERC20"],["zoltar-question-data","zoltar-scalar-outcomes","ScalarOutcomes"],["zoltar-reputation-token","zoltar-erc20","ERC20"],["zoltar-safe-erc20-ops","zoltar-ierc20","IERC20"]],BM=wC.map(([t,r,...f])=>({source:t,symbols:f,target:r}));function T(t,r,f,u,h,x,b,g=r){return{column:h,...f==="module"?{}:{declaration:g},id:t,kind:f,label:r,order:x,panel:u,source:b}}function F(t,r,f,u,h){return{description:h,id:t,relation:u,source:r,target:f}}var MC={delegatecall:"Delegatecalls",deploys:"Deploys",implements:"Implements",inherits:"Directly inherits"};function n(t,r,f,u){let h=Wu.find((b)=>b.id===f);if(h===void 0)throw Error(`Source-derived contract atlas edge ${t} has missing target ${f}`);let x=`${MC[u]} ${h.label}.`;return F(t,r,f,u,x)}var tc={assets:"asset-bearing call",calls:"runtime call",compatible:"structural compatibility",delegatecall:"delegatecall",deploys:"deployment",implements:"implements",inherits:"inherits",references:"direct source reference",tests:"test-only exercise",uses:"library or type use"},sf={infrastructure:"Infrastructure & external boundary","statoblast-deployment":"Statoblast — deployment","statoblast-implementation":"Statoblast — implementation boundaries","statoblast-runtime":"Statoblast — deployed runtime",tests:"Test-only contracts",zoltar:"Zoltar"},zM=[{id:"test-gateway-zoltar",label:`Production target: +Zoltar & token helpers`,order:0},{id:"test-gateway-token",label:`Production target: +Tokens, shares & outcomes`,order:1},{id:"test-gateway-escalation",label:`Production target: +Escalation & proofs`,order:2},{id:"test-gateway-forker",label:`Production target: +Fork & migration`,order:3},{id:"test-gateway-pool",label:`Production target: +Pool, factory & auction`,order:4},{id:"test-gateway-openoracle",label:`Production target: +OpenOracle`,order:5},{id:"test-gateway-infra",label:`Production target: +Deployment infrastructure`,order:6}],RM=new Map([["infra-deployment-status-oracle","test-gateway-infra"],["openoracle-core","test-gateway-openoracle"],["statoblast-binary-outcomes","test-gateway-token"],["statoblast-auction-settlement-base","test-gateway-forker"],["statoblast-erc1155","test-gateway-token"],["statoblast-escalation-calculations","test-gateway-escalation"],["statoblast-escalation-game","test-gateway-escalation"],["statoblast-escalation-game-factory","test-gateway-escalation"],["statoblast-escalation-game-forker","test-gateway-escalation"],["statoblast-escalation-proof-verifier","test-gateway-escalation"],["statoblast-escalation-state","test-gateway-escalation"],["statoblast-escalation-types","test-gateway-escalation"],["statoblast-event-emitter","test-gateway-forker"],["statoblast-forker-base","test-gateway-forker"],["statoblast-forker-types","test-gateway-forker"],["statoblast-ierc1155-receiver","test-gateway-token"],["statoblast-merkle-mountain-range","test-gateway-escalation"],["statoblast-pool-forker","test-gateway-forker"],["statoblast-security-pool","test-gateway-pool"],["statoblast-security-pool-factory-interface","test-gateway-pool"],["statoblast-security-pool-interface","test-gateway-pool"],["statoblast-share-token","test-gateway-token"],["statoblast-share-token-interface","test-gateway-token"],["statoblast-token-id","test-gateway-token"],["statoblast-truth-auction","test-gateway-pool"],["zoltar-core","test-gateway-zoltar"],["zoltar-ierc20","test-gateway-zoltar"],["zoltar-reputation-token","test-gateway-zoltar"],["zoltar-safe-erc20-ops","test-gateway-zoltar"],["zoltar-scalar-outcomes","test-gateway-zoltar"]]),Wu=[T("zoltar-constants","Constants","library","zoltar",0,0,"solidity/contracts/Constants.sol"),T("zoltar-context","Context","abstract","zoltar",0,1,"solidity/contracts/Context.sol"),T("zoltar-ierc20","IERC20","interface","zoltar",0,2,"solidity/contracts/IERC20.sol"),T("zoltar-ierc20-metadata","IERC20Metadata","interface","zoltar",0,3,"solidity/contracts/IERC20Metadata.sol"),T("zoltar-safe-erc20-ops","SafeERC20Ops","library","zoltar",0,4,"solidity/contracts/SafeERC20Ops.sol"),T("zoltar-scalar-outcomes","ScalarOutcomes","library","zoltar",0,5,"solidity/contracts/ScalarOutcomes.sol"),T("zoltar-erc20","ERC20","abstract","zoltar",1,1,"solidity/contracts/ERC20.sol"),T("zoltar-question-data","ZoltarQuestionData","contract","zoltar",1,4,"solidity/contracts/ZoltarQuestionData.sol"),T("zoltar-reputation-token","ReputationToken","contract","zoltar",2,1,"solidity/contracts/ReputationToken.sol"),T("zoltar-core","Zoltar","contract","zoltar",2,4,"solidity/contracts/Zoltar.sol"),T("statoblast-security-pool-factory","SecurityPoolFactory","contract","statoblast-deployment",0,2,"solidity/contracts/peripherals/factories/SecurityPoolFactory.sol"),T("statoblast-share-token-factory","ShareTokenFactory","contract","statoblast-deployment",1,0,"solidity/contracts/peripherals/factories/ShareTokenFactory.sol"),T("statoblast-price-coordinator-factory","PriceOracleManagerAndOperatorQueuerFactory","contract","statoblast-deployment",1,1,"solidity/contracts/peripherals/factories/PriceOracleManagerAndOperatorQueuerFactory.sol"),T("statoblast-escalation-game-factory","EscalationGameFactory","contract","statoblast-deployment",1,2,"solidity/contracts/peripherals/factories/EscalationGameFactory.sol"),T("statoblast-auction-factory","UniformPriceDualCapBatchAuctionFactory","contract","statoblast-deployment",1,3,"solidity/contracts/peripherals/factories/UniformPriceDualCapBatchAuctionFactory.sol"),T("statoblast-security-pool-deployer","SecurityPoolDeployer","contract","statoblast-deployment",2,1,"solidity/contracts/peripherals/factories/SecurityPoolDeployer.sol"),T("statoblast-security-pool-worker","SecurityPoolDeploymentWorker","contract","statoblast-deployment",3,1,"solidity/contracts/peripherals/factories/SecurityPoolDeployer.sol"),T("statoblast-security-pool","SecurityPool","contract","statoblast-runtime",0,0,"solidity/contracts/peripherals/SecurityPool.sol"),T("statoblast-share-token","ShareToken","contract","statoblast-runtime",0,1,"solidity/contracts/peripherals/tokens/ShareToken.sol"),T("statoblast-price-coordinator","OpenOraclePriceCoordinator","contract","statoblast-runtime",0,2,"solidity/contracts/peripherals/OpenOraclePriceCoordinator.sol"),T("statoblast-escalation-game","EscalationGame","contract","statoblast-runtime",0,3,"solidity/contracts/peripherals/EscalationGame.sol"),T("statoblast-pool-forker","SecurityPoolForker","contract","statoblast-runtime",0,4,"solidity/contracts/peripherals/SecurityPoolForker.sol"),T("statoblast-truth-auction","UniformPriceDualCapBatchAuction","contract","statoblast-runtime",0,5,"solidity/contracts/peripherals/UniformPriceDualCapBatchAuction.sol"),T("statoblast-erc1155","ERC1155","contract","statoblast-runtime",1,0,"solidity/contracts/peripherals/tokens/ERC1155.sol"),T("statoblast-escalation-deposit-delegate","EscalationGameDepositDelegate","contract","statoblast-runtime",1,1,"solidity/contracts/peripherals/EscalationGameDepositDelegate.sol"),T("statoblast-escalation-proof-verifier","EscalationGameProofVerifier","contract","statoblast-runtime",1,2,"solidity/contracts/peripherals/EscalationGameProofVerifier.sol"),T("statoblast-vault-migration-delegate","SecurityPoolForkerVaultMigrationDelegate","contract","statoblast-runtime",1,3,"solidity/contracts/peripherals/SecurityPoolForkerVaultMigrationDelegate.sol"),T("statoblast-escalation-game-forker","EscalationGameForker","contract","statoblast-runtime",1,4,"solidity/contracts/peripherals/EscalationGameForker.sol"),T("statoblast-event-emitter","SecurityPoolEventEmitter","contract","statoblast-runtime",2,1,"solidity/contracts/peripherals/SecurityPoolEventEmitter.sol"),T("statoblast-migration-proxy","SecurityPoolMigrationProxy","contract","statoblast-runtime",2,3,"solidity/contracts/peripherals/SecurityPoolMigrationProxy.sol"),T("statoblast-binary-outcomes","BinaryOutcomes","library","statoblast-runtime",3,0,"solidity/contracts/peripherals/BinaryOutcomes.sol"),T("statoblast-merkle-mountain-range","MerkleMountainRange","library","statoblast-runtime",3,1,"solidity/contracts/peripherals/MerkleMountainRange.sol"),T("statoblast-security-pool-utils","SecurityPoolUtils","library","statoblast-runtime",3,2,"solidity/contracts/peripherals/SecurityPoolUtils.sol"),T("statoblast-token-id","TokenId","library","statoblast-runtime",3,3,"solidity/contracts/peripherals/tokens/TokenId.sol"),T("statoblast-escalation-storage","EscalationGameStorage","abstract","statoblast-implementation",0,0,"solidity/contracts/peripherals/EscalationGameStorage.sol"),T("statoblast-escalation-state","EscalationGameState","abstract","statoblast-implementation",0,1,"solidity/contracts/peripherals/EscalationGameState.sol"),T("statoblast-escalation-calculations","EscalationGameCalculations","abstract","statoblast-implementation",0,2,"solidity/contracts/peripherals/EscalationGameCalculations.sol"),T("statoblast-escalation-carry","EscalationGameCarry","abstract","statoblast-implementation",0,3,"solidity/contracts/peripherals/EscalationGameCarry.sol"),T("statoblast-escalation-escrow","EscalationGameEscrow","abstract","statoblast-implementation",0,4,"solidity/contracts/peripherals/EscalationGameEscrow.sol"),T("statoblast-escalation-settlement","EscalationGameSettlement","abstract","statoblast-implementation",0,5,"solidity/contracts/peripherals/EscalationGameSettlement.sol"),T("statoblast-escalation-types","EscalationGameTypes","module","statoblast-implementation",0,6,"solidity/contracts/peripherals/EscalationGameTypes.sol"),T("statoblast-forker-storage","SecurityPoolForkerStorage","abstract","statoblast-implementation",1,0,"solidity/contracts/peripherals/SecurityPoolForkerStorage.sol"),T("statoblast-forker-base","SecurityPoolForkerBase","abstract","statoblast-implementation",1,1,"solidity/contracts/peripherals/SecurityPoolForkerBase.sol"),T("statoblast-auction-settlement-base","SecurityPoolForkerAuctionSettlementBase","abstract","statoblast-implementation",1,2,"solidity/contracts/peripherals/SecurityPoolForkerAuctionSettlementBase.sol"),T("statoblast-vault-migration-base","SecurityPoolForkerVaultMigrationBase","abstract","statoblast-implementation",1,3,"solidity/contracts/peripherals/SecurityPoolForkerVaultMigrationBase.sol"),T("statoblast-forker-types","SecurityPoolForkerTypes","module","statoblast-implementation",1,4,"solidity/contracts/peripherals/SecurityPoolForkerTypes.sol"),T("statoblast-escalation-deposit-context","IEscalationGameDepositContext","interface","statoblast-implementation",2,0,"solidity/contracts/peripherals/EscalationGameDepositDelegate.sol"),T("statoblast-stored-open-oracle-game","IStoredOpenOracleGame","interface","statoblast-implementation",2,1,"solidity/contracts/peripherals/OpenOraclePriceCoordinator.sol"),T("statoblast-deployment-worker-config","ISecurityPoolDeploymentWorkerConfiguration","interface","statoblast-implementation",2,2,"solidity/contracts/peripherals/SecurityPool.sol"),T("statoblast-iaugur","IAugur","interface","statoblast-implementation",2,3,"solidity/contracts/peripherals/interfaces/IAugur.sol"),T("statoblast-ierc165","IERC165","interface","statoblast-implementation",2,4,"solidity/contracts/peripherals/interfaces/IERC165.sol"),T("statoblast-ierc1155","IERC1155","interface","statoblast-implementation",2,5,"solidity/contracts/peripherals/interfaces/IERC1155.sol"),T("statoblast-ierc1155-receiver","IERC1155Receiver","interface","statoblast-implementation",2,6,"solidity/contracts/peripherals/interfaces/IERC1155Receiver.sol"),T("statoblast-escalation-events","IEscalationGameEvents","interface","statoblast-implementation",3,0,"solidity/contracts/peripherals/interfaces/IEscalationGame.sol"),T("statoblast-security-pool-interface","ISecurityPool","interface","statoblast-implementation",3,1,"solidity/contracts/peripherals/interfaces/ISecurityPool.sol"),T("statoblast-security-pool-factory-interface","ISecurityPoolFactory","interface","statoblast-implementation",3,2,"solidity/contracts/peripherals/interfaces/ISecurityPool.sol"),T("statoblast-forker-events","ISecurityPoolForkerEvents","interface","statoblast-implementation",3,3,"solidity/contracts/peripherals/interfaces/ISecurityPoolForker.sol"),T("statoblast-forker-interface","ISecurityPoolForker","interface","statoblast-implementation",3,4,"solidity/contracts/peripherals/interfaces/ISecurityPoolForker.sol"),T("statoblast-child-game-initializer","ISecurityPoolForkerChildEscalationGameInitializer","interface","statoblast-implementation",3,5,"solidity/contracts/peripherals/interfaces/ISecurityPoolForkerChildEscalationGameInitializer.sol"),T("statoblast-share-token-interface","IShareToken","interface","statoblast-implementation",4,0,"solidity/contracts/peripherals/interfaces/IShareToken.sol"),T("statoblast-auction-events","IUniformPriceDualCapBatchAuctionEvents","interface","statoblast-implementation",4,1,"solidity/contracts/peripherals/interfaces/IUniformPriceDualCapBatchAuction.sol"),T("statoblast-auction-interface","IUniformPriceDualCapBatchAuction","interface","statoblast-implementation",4,2,"solidity/contracts/peripherals/interfaces/IUniformPriceDualCapBatchAuction.sol"),T("statoblast-iweth9","IWeth9","interface","statoblast-implementation",4,3,"solidity/contracts/peripherals/interfaces/IWeth9.sol"),T("infra-deployment-status-oracle","DeploymentStatusOracle","contract","infrastructure",0,0,"solidity/contracts/DeploymentStatusOracle.sol"),T("infra-multicall3","Multicall3","contract","infrastructure",0,1,"solidity/contracts/peripherals/Multicall3.sol"),T("infra-weth9","WETH9","contract","infrastructure",0,2,"solidity/contracts/peripherals/WETH9.sol"),T("openoracle-core","OpenOracle","contract","infrastructure",1,1,"solidity/contracts/peripherals/openOracle/OpenOracle.sol"),T("openoracle-signature-transfer","ISignatureTransfer","interface","infrastructure",2,0,"solidity/contracts/peripherals/openOracle/interfaces/ISignatureTransfer.sol"),T("openoracle-errors","Errors","library","infrastructure",2,1,"solidity/contracts/peripherals/openOracle/libraries/Errors.sol"),T("openoracle-ierc20","OpenZeppelin IERC20","interface","infrastructure",2,2,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/token/ERC20/IERC20.sol","IERC20"),T("openoracle-safe-erc20","SafeERC20","library","infrastructure",2,3,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"),T("openoracle-ierc1363","IERC1363","interface","infrastructure",3,0,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/interfaces/IERC1363.sol"),T("openoracle-ierc165","OpenZeppelin IERC165","interface","infrastructure",3,1,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/introspection/IERC165.sol","IERC165"),T("openoracle-math","Math","library","infrastructure",3,2,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/math/Math.sol"),T("openoracle-safe-cast","SafeCast","library","infrastructure",3,3,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/math/SafeCast.sol"),T("openoracle-panic","Panic","library","infrastructure",4,0,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/Panic.sol"),T("openoracle-reentrancy-guard","ReentrancyGuard","abstract","infrastructure",4,1,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/ReentrancyGuard.sol"),T("openoracle-storage-slot","StorageSlot","library","infrastructure",4,2,"solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/StorageSlot.sol"),T("test-complete-set-reentrant-receiver","CompleteSetReentrantReceiver","contract","tests",0,0,"solidity/contracts/test/peripherals/CompleteSetReentrantReceiver.sol"),T("test-erc1155-coverage-harness","ERC1155CoverageHarness","contract","tests",0,1,"solidity/contracts/test/peripherals/CoverageHelpersHarness.sol"),T("test-coverage-attribution-executed","CoverageAttributionExecuted","contract","tests",0,2,"solidity/contracts/test/peripherals/CoverageHelpersHarness.sol"),T("test-coverage-attribution-decoy","CoverageAttributionDecoy","contract","tests",0,3,"solidity/contracts/test/peripherals/CoverageHelpersHarness.sol"),T("test-escalation-factory-coverage-pool","EscalationGameFactoryCoverageSecurityPool","contract","tests",0,4,"solidity/contracts/test/peripherals/CoverageHelpersHarness.sol"),T("test-coverage-helpers-harness","CoverageHelpersHarness","contract","tests",0,5,"solidity/contracts/test/peripherals/CoverageHelpersHarness.sol"),T("test-erc1155-receiver-mock","ERC1155ReceiverMock","contract","tests",1,0,"solidity/contracts/test/peripherals/ERC1155ReceiverMock.sol"),T("test-erc1155-non-receiver","ERC1155NonReceiver","contract","tests",1,1,"solidity/contracts/test/peripherals/ERC1155ReceiverMock.sol"),T("test-share-token-authorization-pool","ShareTokenAuthorizationPoolMock","contract","tests",1,2,"solidity/contracts/test/peripherals/ERC1155ReceiverMock.sol"),T("test-fork-boundary-zoltar","EscalationGameForkBoundaryZoltar","contract","tests",1,3,"solidity/contracts/test/peripherals/EscalationGameForkThresholdHarness.sol"),T("test-fork-boundary-pool","EscalationGameForkBoundarySecurityPool","contract","tests",1,4,"solidity/contracts/test/peripherals/EscalationGameForkThresholdHarness.sol"),T("test-fork-threshold-harness","EscalationGameForkThresholdHarness","contract","tests",1,5,"solidity/contracts/test/peripherals/EscalationGameForkThresholdHarness.sol"),T("test-escalation-forker-harness","EscalationGameForkerHarness","contract","tests",1,6,"solidity/contracts/test/peripherals/EscalationGameForkerHarness.sol"),T("test-escalation-proof-pool","EscalationGameProofTestSecurityPool","contract","tests",2,0,"solidity/contracts/test/peripherals/EscalationGameProofTestSecurityPool.sol"),T("test-false-returning-erc20","FalseReturningERC20","contract","tests",2,1,"solidity/contracts/test/peripherals/FalseReturningERC20.sol"),T("test-incompatible-proof-verifier","IncompatibleEscalationGameProofVerifier","contract","tests",2,2,"solidity/contracts/test/peripherals/IncompatibleEscalationGameProofVerifier.sol"),T("test-openoracle-adversarial-target","IOpenOracleAdversarialTarget","interface","tests",2,3,"solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol"),T("test-openoracle-token","OpenOracleTestToken","contract","tests",2,4,"solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol"),T("test-openoracle-no-return-token","OpenOracleNoReturnToken","contract","tests",2,5,"solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol"),T("test-openoracle-rejecting-receiver","OpenOracleRejectingETHReceiver","contract","tests",2,6,"solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol"),T("test-openoracle-reentrant-callback","OpenOracleReentrantCallback","contract","tests",2,7,"solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol"),T("test-own-fork-claim-harness","OwnForkEscalationClaimHarness","contract","tests",3,0,"solidity/contracts/test/peripherals/OwnForkEscalationClaimHarness.sol"),T("test-safe-erc20-ops-harness","SafeERC20OpsHarness","contract","tests",3,1,"solidity/contracts/test/peripherals/SafeERC20OpsHarness.sol"),T("test-security-pool-ancestor","SecurityPoolAncestorTestNode","contract","tests",3,2,"solidity/contracts/test/peripherals/SecurityPoolAncestorTestNode.sol"),T("test-constructor-failure-zoltar","SecurityPoolConstructorFailureZoltar","contract","tests",3,3,"solidity/contracts/test/peripherals/SecurityPoolConstructorFailureZoltar.sol"),T("test-forker-child-validation-harness","SecurityPoolForkerChildGameValidationHarness","contract","tests",3,4,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-malicious-emitter","SecurityPoolForkerMaliciousEventEmitter","contract","tests",3,5,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-fake-pool","SecurityPoolForkerFakePoolMock","contract","tests",3,6,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-attack-factory","SecurityPoolForkerAttackFactoryMock","contract","tests",3,7,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-attack-parent","SecurityPoolForkerAttackParentMock","contract","tests",4,0,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-escrow-factory","SecurityPoolForkerEscrowAttackFactoryMock","contract","tests",4,1,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-escrow-game","SecurityPoolForkerEscrowAttackGameMock","contract","tests",4,2,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-escrow-parent","SecurityPoolForkerEscrowAttackParentMock","contract","tests",4,3,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-alternating-game","SecurityPoolForkerAlternatingChildGameMock","contract","tests",4,4,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-forker-escrow-child","SecurityPoolForkerEscrowAttackChildMock","contract","tests",4,5,"solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol"),T("test-auction-settlement-pool","AuctionSettlementPoolHarness","contract","tests",4,6,"solidity/contracts/test/peripherals/SecurityPoolForkerAuctionSettlementHarness.sol"),T("test-forker-auction-settlement","SecurityPoolForkerAuctionSettlementHarness","contract","tests",4,7,"solidity/contracts/test/peripherals/SecurityPoolForkerAuctionSettlementHarness.sol"),T("test-truth-auction-alias-share-token","TruthAuctionAliasAttackShareTokenMock","contract","tests",0,6,"solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol"),T("test-truth-auction-alias-factory","TruthAuctionAliasAttackFactoryMock","contract","tests",1,7,"solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol"),T("test-truth-auction-alias-parent","TruthAuctionAliasAttackParentMock","contract","tests",2,8,"solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol"),T("test-truth-auction-alias-child","TruthAuctionAliasAttackChildMock","contract","tests",3,8,"solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol")],DM=Wu.map((t)=>({node:t,panelLabel:sf[t.panel]})),rc=[F("zoltar-question-scalar","zoltar-question-data","zoltar-scalar-outcomes","uses","Decodes and names scalar outcomes with the shared scalar library."),F("zoltar-core-constants","zoltar-core","zoltar-constants","uses","Reads protocol addresses and fork limits."),F("zoltar-core-safe-erc20","zoltar-core","zoltar-safe-erc20-ops","uses","Moves genesis REP through checked ERC-20 calls."),F("zoltar-core-ierc20","zoltar-core","zoltar-ierc20","uses","Treats genesis REP as the repository ERC-20 interface."),F("zoltar-core-question-data","zoltar-core","zoltar-question-data","calls","Validates fork questions, end times, and child outcomes."),n("zoltar-core-reputation-token","zoltar-core","zoltar-reputation-token","deploys"),n("zoltar-reputation-erc20","zoltar-reputation-token","zoltar-erc20","inherits"),n("zoltar-erc20-context","zoltar-erc20","zoltar-context","inherits"),n("zoltar-erc20-interface","zoltar-erc20","zoltar-ierc20","implements"),n("zoltar-erc20-metadata","zoltar-erc20","zoltar-ierc20-metadata","implements"),n("zoltar-metadata-erc20","zoltar-ierc20-metadata","zoltar-ierc20","inherits"),F("zoltar-safe-ops-interface","zoltar-safe-erc20-ops","zoltar-ierc20","uses","Wraps repository ERC-20 calls with return-data checks."),n("factory-interface","statoblast-security-pool-factory","statoblast-security-pool-factory-interface","implements"),F("factory-question-data","statoblast-security-pool-factory","zoltar-question-data","calls","Validates that origin markets use an existing Yes/No question."),F("factory-zoltar","statoblast-security-pool-factory","zoltar-core","calls","Reads universe, REP, fork, and non-decision-threshold state."),F("factory-share-factory","statoblast-security-pool-factory","statoblast-share-token-factory","calls","Requests the origin lineage share token."),F("factory-share-token","statoblast-security-pool-factory","statoblast-share-token","calls","Authorizes the newly deployed origin pool on its lineage share token."),n("share-factory-share","statoblast-share-token-factory","statoblast-share-token","deploys"),F("share-factory-zoltar","statoblast-share-token-factory","zoltar-core","uses","Wires the shared Zoltar registry into every deployed share token."),F("factory-price-factory","statoblast-security-pool-factory","statoblast-price-coordinator-factory","calls","Requests one REP/WETH price coordinator per pool."),n("price-factory-coordinator","statoblast-price-coordinator-factory","statoblast-price-coordinator","deploys"),F("price-factory-weth","statoblast-price-coordinator-factory","statoblast-iweth9","uses","Wires its immutable WETH contract into each coordinator."),F("factory-price-coordinator","statoblast-security-pool-factory","statoblast-price-coordinator","calls","Permanently binds the newly deployed coordinator to its canonical pool."),F("factory-auction-factory","statoblast-security-pool-factory","statoblast-auction-factory","calls","Requests a truth auction for each child pool."),n("auction-factory-auction","statoblast-auction-factory","statoblast-truth-auction","deploys"),n("factory-pool-deployer","statoblast-security-pool-factory","statoblast-security-pool-deployer","deploys"),F("factory-pool-deployer-call","statoblast-security-pool-factory","statoblast-security-pool-deployer","calls","Calls the private deployer for every origin or child pool after assembling its dependencies."),n("pool-deployer-emitter","statoblast-security-pool-deployer","statoblast-event-emitter","deploys"),n("pool-deployer-worker","statoblast-security-pool-deployer","statoblast-security-pool-worker","deploys"),F("worker-config-interface","statoblast-security-pool-worker","statoblast-deployment-worker-config","compatible","Structurally provides the factory and event-emitter getters read through the pool constructor interface."),n("worker-security-pool","statoblast-security-pool-worker","statoblast-security-pool","deploys"),n("escalation-factory-verifier","statoblast-escalation-game-factory","statoblast-escalation-proof-verifier","deploys"),n("escalation-factory-game","statoblast-escalation-game-factory","statoblast-escalation-game","deploys"),F("escalation-factory-pool","statoblast-escalation-game-factory","statoblast-security-pool-interface","calls","Reads the calling pool, parent, REP token, and shared forker configuration."),F("escalation-factory-forker","statoblast-escalation-game-factory","statoblast-forker-interface","calls","Reads own-fork haircut and REP-bucket state for child continuations."),n("pool-interface","statoblast-security-pool","statoblast-security-pool-interface","implements"),F("pool-worker-config","statoblast-security-pool","statoblast-deployment-worker-config","calls","Reads its factory and event-emitter wiring from the deployment worker."),F("pool-reputation-token","statoblast-security-pool","zoltar-reputation-token","assets","Uses REP token calls to move REP vault or reporter → pool, pool → escalation game or forker, and pool → redemption recipient."),F("pool-share-token","statoblast-security-pool","statoblast-share-token","calls","Mints and burns complete sets, redeems winning shares, and authorizes child pools."),F("pool-escalation-factory","statoblast-security-pool","statoblast-escalation-game-factory","calls","Lazily deploys a local game on the first deposit, or deploys a fork-continuation game when the forker initializes inherited state."),F("pool-escalation-game","statoblast-security-pool","statoblast-escalation-game","assets","Reads resolution state while reporting REP moves pool → game escrow and settled REP moves game → pool or claimant."),F("pool-price-coordinator","statoblast-security-pool","statoblast-price-coordinator","calls","Reads cached REP/ETH prices."),F("price-coordinator-pool","statoblast-price-coordinator","statoblast-security-pool","calls","Executes staged liquidation, withdrawal, and allowance operations through coordinator-only pool entrypoints after validation."),F("price-coordinator-openoracle","statoblast-price-coordinator","openoracle-core","assets","Funds reports with WETH and REP coordinator → OpenOracle, then requests settled balances OpenOracle → sponsor."),F("openoracle-price-callback","openoracle-core","statoblast-price-coordinator","calls","Calls openOracleCallback on the configured coordinator after report settlement."),F("price-coordinator-weth","statoblast-price-coordinator","statoblast-iweth9","assets","Calls WETH to move sponsor → coordinator, grants coordinator → OpenOracle allowance, and requests settled WETH OpenOracle → sponsor."),F("price-coordinator-rep","statoblast-price-coordinator","zoltar-reputation-token","assets","Calls REP to move sponsor → coordinator, grants coordinator → OpenOracle allowance, and requests settled REP OpenOracle → sponsor."),F("price-coordinator-pool-utils","statoblast-price-coordinator","statoblast-security-pool-utils","uses","Uses shared BPS and minimum-REP constants."),F("price-coordinator-math","statoblast-price-coordinator","openoracle-math","uses","Uses checked rounding for report funding and risk thresholds."),F("price-coordinator-stored-game","statoblast-price-coordinator","statoblast-stored-open-oracle-game","uses","Uses a narrow compatibility view of OpenOracle stored-game data."),n("share-token-erc1155","statoblast-share-token","statoblast-erc1155","inherits"),n("share-token-interface","statoblast-share-token","statoblast-share-token-interface","implements"),F("share-token-token-id","statoblast-share-token","statoblast-token-id","uses","Packs and unpacks universe and outcome identifiers."),F("share-token-binary-outcomes","statoblast-share-token","statoblast-binary-outcomes","uses","Maps each universe to Invalid, Yes, and No token IDs."),F("share-token-zoltar","statoblast-share-token","zoltar-core","calls","Derives child universes and inspects fork state."),F("share-token-pool","statoblast-share-token","statoblast-security-pool-interface","calls","Validates source and candidate canonical pools during migration and authorization."),F("share-token-forker","statoblast-share-token","statoblast-pool-forker","calls","Activates the source fork and lazily creates child pools during share migration."),n("erc1155-interface","statoblast-erc1155","statoblast-ierc1155","implements"),F("erc1155-receiver","statoblast-erc1155","statoblast-ierc1155-receiver","calls","Performs safe single and batch receiver callbacks."),n("ierc1155-erc165","statoblast-ierc1155","statoblast-ierc165","inherits"),n("receiver-erc165","statoblast-ierc1155-receiver","statoblast-ierc165","inherits"),n("pool-event-emitter","statoblast-security-pool","statoblast-event-emitter","delegatecall"),F("pool-forker-runtime","statoblast-security-pool","statoblast-pool-forker","calls","Reads resolved question outcomes from the shared forker."),F("pool-zoltar-runtime","statoblast-security-pool","zoltar-core","calls","Reads universe fork timing and burns resolution haircuts through Zoltar."),F("pool-question-runtime","statoblast-security-pool","zoltar-question-data","calls","Reads the market question end date."),F("pool-utils-runtime","statoblast-security-pool","statoblast-security-pool-utils","uses","Uses shared fee, precision, and minimum-REP constants."),F("pool-binary-outcomes","statoblast-security-pool","statoblast-binary-outcomes","uses","Uses the canonical Invalid/Yes/No outcome enum."),n("game-settlement-base","statoblast-escalation-game","statoblast-escalation-settlement","inherits"),n("settlement-escrow-base","statoblast-escalation-settlement","statoblast-escalation-escrow","inherits"),n("escrow-carry-base","statoblast-escalation-escrow","statoblast-escalation-carry","inherits"),n("carry-calculation-base","statoblast-escalation-carry","statoblast-escalation-calculations","inherits"),n("calculation-state-base","statoblast-escalation-calculations","statoblast-escalation-state","inherits"),n("state-storage-base","statoblast-escalation-state","statoblast-escalation-storage","inherits"),n("state-events-interface","statoblast-escalation-state","statoblast-escalation-events","implements"),n("game-deposit-delegate-deploy","statoblast-escalation-game","statoblast-escalation-deposit-delegate","deploys"),n("game-deposit-delegate-call","statoblast-escalation-game","statoblast-escalation-deposit-delegate","delegatecall"),n("deposit-delegate-storage","statoblast-escalation-deposit-delegate","statoblast-escalation-storage","inherits"),n("deposit-delegate-events","statoblast-escalation-deposit-delegate","statoblast-escalation-events","implements"),F("deposit-delegate-context","statoblast-escalation-deposit-delegate","statoblast-escalation-deposit-context","calls","Calls back into the active game context for view calculations."),F("deposit-delegate-mmr","statoblast-escalation-deposit-delegate","statoblast-merkle-mountain-range","uses","Appends canonical carry leaves."),F("state-proof-verifier","statoblast-escalation-state","statoblast-escalation-proof-verifier","calls","Pins and reads the storage-free proof verifier."),F("state-reputation-token","statoblast-escalation-state","zoltar-reputation-token","assets","Uses REP token calls to move game escrow → claimant, pool, or fork export recipient."),F("carry-proof-verifier","statoblast-escalation-carry","statoblast-escalation-proof-verifier","calls","Verifies Merkle Mountain Range and nullifier proofs."),F("proof-verifier-mmr","statoblast-escalation-proof-verifier","statoblast-merkle-mountain-range","uses","Computes carry roots and proof paths."),F("escalation-types-storage","statoblast-escalation-storage","statoblast-escalation-types","uses","Stores the shared outcome, deposit, node, and fork-escrow structures."),F("escalation-types-carry","statoblast-escalation-carry","statoblast-escalation-types","uses","Consumes the shared carry and proof structures."),F("escalation-binary-calculations","statoblast-escalation-calculations","statoblast-binary-outcomes","uses","Types question-resolution results and unresolved sentinels with the shared binary-outcome enum."),F("escalation-settlement-pool","statoblast-escalation-settlement","statoblast-security-pool","calls","Returns residual REP and asks the pool to burn winner haircuts."),F("escalation-settlement-forker","statoblast-escalation-settlement","statoblast-forker-interface","calls","Checks direct own-fork claim lineage and question outcomes."),n("forker-auction-settlement-base-inheritance","statoblast-pool-forker","statoblast-auction-settlement-base","inherits"),n("auction-settlement-base-forker-base","statoblast-auction-settlement-base","statoblast-forker-base","inherits"),n("forker-base-storage","statoblast-forker-base","statoblast-forker-storage","inherits"),n("forker-base-events","statoblast-forker-base","statoblast-forker-events","implements"),n("vault-base-forker-base","statoblast-vault-migration-base","statoblast-forker-base","inherits"),n("vault-delegate-base","statoblast-vault-migration-delegate","statoblast-vault-migration-base","inherits"),n("escalation-forker-base","statoblast-escalation-game-forker","statoblast-vault-migration-base","inherits"),n("event-emitter-storage","statoblast-event-emitter","statoblast-forker-storage","inherits"),n("event-emitter-events","statoblast-event-emitter","statoblast-forker-events","implements"),n("forker-interface-events","statoblast-forker-interface","statoblast-forker-events","inherits"),n("auction-interface-events","statoblast-auction-interface","statoblast-auction-events","inherits"),n("auction-events-implementation","statoblast-truth-auction","statoblast-auction-events","implements"),F("auction-math","statoblast-truth-auction","openoracle-math","uses","Uses full-precision arithmetic for clearing and pro-rata settlement."),F("auction-settlement-base-pool","statoblast-auction-settlement-base","statoblast-security-pool","calls","Credits purchased REP ownership and auctioned allowance into bidder vault accounting."),F("auction-settlement-base-types","statoblast-auction-settlement-base","statoblast-forker-types","uses","Updates typed auction claim totals in per-pool fork records."),n("forker-deploy-vault-delegate","statoblast-pool-forker","statoblast-vault-migration-delegate","deploys"),n("forker-deploy-escalation-delegate","statoblast-pool-forker","statoblast-escalation-game-forker","deploys"),n("forker-deploy-event-emitter","statoblast-pool-forker","statoblast-event-emitter","deploys"),n("forker-delegate-vault","statoblast-pool-forker","statoblast-vault-migration-delegate","delegatecall"),n("forker-delegate-escalation","statoblast-pool-forker","statoblast-escalation-game-forker","delegatecall"),n("forker-delegate-events","statoblast-pool-forker","statoblast-event-emitter","delegatecall"),n("forker-deploy-proxy","statoblast-pool-forker","statoblast-migration-proxy","deploys"),F("forker-proxy-assets","statoblast-pool-forker","statoblast-migration-proxy","assets","Transfers parent REP forker → migration proxy, then instructs the proxy to lock, fork, split, and sweep child REP."),F("forker-reputation-token","statoblast-pool-forker","zoltar-reputation-token","assets","Calls the parent REP token to transfer REP forker → stable migration proxy."),F("proxy-zoltar","statoblast-migration-proxy","zoltar-core","calls","Owns the literal Zoltar migration ledger balance for one parent pool."),F("proxy-reputation-token","statoblast-migration-proxy","zoltar-reputation-token","assets","Calls REP to grant proxy → Zoltar allowance and transfer minted child REP proxy → configured receiver."),F("forker-zoltar","statoblast-pool-forker","zoltar-core","calls","Reads fork thresholds and migration balances around proxy operations."),F("forker-pool","statoblast-pool-forker","statoblast-security-pool","calls","Freezes parents, migrates children, and updates collateral and ownership accounting through forker-only pool entrypoints."),F("forker-game","statoblast-pool-forker","statoblast-escalation-game","calls","Snapshots escalation state and resolves inherited question outcomes."),F("forker-auction","statoblast-pool-forker","statoblast-truth-auction","assets","Coordinates ETH bidder → auction → forker → child pool or, for refunds, auction → bidder; purchased REP is credited as pool ownership rather than transferred."),F("vault-base-zoltar","statoblast-vault-migration-base","zoltar-core","calls","Deploys missing child universes and reads child REP."),F("vault-base-factory","statoblast-vault-migration-base","statoblast-security-pool-factory","calls","Requests canonical child-pool deployment."),F("vault-base-pool","statoblast-vault-migration-base","statoblast-security-pool","calls","Copies vault, collateral, and ownership state into child pools."),F("vault-base-proxy","statoblast-vault-migration-base","statoblast-migration-proxy","assets","Calls the proxy so split child REP moves migration proxy → child pools and escalation games."),F("vault-base-types","statoblast-vault-migration-base","statoblast-forker-types","uses","Stores and mutates typed fork and child-REP allocation records."),F("forker-storage-types","statoblast-forker-storage","statoblast-forker-types","uses","Owns the typed per-pool fork and migration mappings."),F("escalation-forker-child-interface","statoblast-escalation-game-forker","statoblast-child-game-initializer","calls","Initializes child escalation carry snapshots through the narrow child API."),F("escalation-forker-game","statoblast-escalation-game-forker","statoblast-escalation-game","calls","Exports, materializes, resumes, and settles forked escalation state."),F("escalation-forker-pool","statoblast-escalation-game-forker","statoblast-security-pool","calls","Updates child pool escalation accounting."),F("escalation-forker-zoltar","statoblast-escalation-game-forker","zoltar-core","calls","Reads universe and REP relationships during escalation migration."),F("forker-utils","statoblast-pool-forker","statoblast-security-pool-utils","uses","Uses shared auction timing and fixed-point precision."),F("forker-binary","statoblast-pool-forker","statoblast-binary-outcomes","uses","Tracks fixed and unresolved binary outcomes."),F("weth-interface","infra-weth9","statoblast-iweth9","compatible","Structurally provides the WETH surface consumed through the coordinator interface."),F("openoracle-errors-edge","openoracle-core","openoracle-errors","uses","Uses the imported custom-error catalog."),F("openoracle-permit2","openoracle-core","openoracle-signature-transfer","calls","Pulls permit-authorized tokens through the canonical Permit2 singleton."),F("openoracle-erc20-edge","openoracle-core","openoracle-ierc20","uses","Models report tokens through the imported ERC-20 interface."),F("openoracle-safe-erc20-edge","openoracle-core","openoracle-safe-erc20","uses","Moves report tokens through OpenZeppelin safe wrappers."),F("safe-erc20-interface","openoracle-safe-erc20","openoracle-ierc20","uses","Wraps imported ERC-20 transfers and approvals."),F("safe-erc20-1363","openoracle-safe-erc20","openoracle-ierc1363","uses","Supports relaxed ERC-1363 transfer-and-call helpers."),n("ierc1363-erc20","openoracle-ierc1363","openoracle-ierc20","inherits"),n("ierc1363-erc165","openoracle-ierc1363","openoracle-ierc165","inherits"),F("math-panic","openoracle-math","openoracle-panic","uses","Reports arithmetic division and overflow panics."),F("math-safe-cast","openoracle-math","openoracle-safe-cast","uses","Converts comparison results for branchless arithmetic."),F("test-complete-set-reentrancy","test-complete-set-reentrant-receiver","statoblast-security-pool","tests","Exercises complete-set receiver reentrancy."),n("test-complete-set-receiver-interface","test-complete-set-reentrant-receiver","statoblast-ierc1155-receiver","implements"),n("test-erc1155-coverage","test-erc1155-coverage-harness","statoblast-erc1155","inherits"),n("test-coverage-deployment-status-oracle","test-coverage-helpers-harness","infra-deployment-status-oracle","deploys"),F("test-escalation-factory-pool","test-escalation-factory-coverage-pool","statoblast-escalation-game-factory","tests","Acts as a minimal pool caller for factory coverage."),n("test-coverage-helpers","test-coverage-helpers-harness","statoblast-escalation-proof-verifier","deploys"),n("test-receiver-mock","test-erc1155-receiver-mock","statoblast-ierc1155-receiver","implements"),F("test-non-receiver","test-erc1155-non-receiver","statoblast-erc1155","tests","Exercises transfers to a contract without receiver support."),F("test-share-authorization","test-share-token-authorization-pool","statoblast-share-token","calls","Models an authorized pool adding a canonical child."),F("test-threshold-zoltar","test-fork-boundary-zoltar","zoltar-core","tests","Supplies controlled fork thresholds for boundary tests."),F("test-threshold-pool","test-fork-boundary-pool","statoblast-escalation-calculations","tests","Supplies controlled pool state to fork-threshold calculation tests."),n("test-threshold-harness-edge","test-fork-threshold-harness","statoblast-escalation-calculations","inherits"),F("test-escalation-forker-edge","test-escalation-forker-harness","statoblast-escalation-game-forker","tests","Relays escalation-forker calls for authorization tests."),F("test-proof-pool-edge","test-escalation-proof-pool","statoblast-escalation-proof-verifier","tests","Provides pool-shaped proof and carry test state."),n("test-false-erc20-edge","test-false-returning-erc20","zoltar-ierc20","implements"),F("test-incompatible-verifier-edge","test-incompatible-proof-verifier","statoblast-escalation-state","tests","Exercises the game-state constructor proof-verifier code-hash rejection."),n("test-openoracle-token-edge","test-openoracle-token","zoltar-ierc20","implements"),F("test-openoracle-receiver-edge","test-openoracle-rejecting-receiver","openoracle-core","tests","Exercises rejected, gas-consuming, and reentrant ETH delivery."),n("test-openoracle-receiver-interface","test-openoracle-rejecting-receiver","statoblast-ierc1155-receiver","implements"),F("test-own-fork-claim-edge","test-own-fork-claim-harness","statoblast-escalation-game-forker","tests","Relays direct own-fork escalation claims."),F("test-safe-ops-edge","test-safe-erc20-ops-harness","zoltar-safe-erc20-ops","tests","Exposes checked transfer and transferFrom wrappers."),F("test-ancestor-edge","test-security-pool-ancestor","statoblast-pool-forker","tests","Builds controlled pool ancestry graphs for direct-claim replay checks."),F("test-constructor-zoltar-edge","test-constructor-failure-zoltar","statoblast-security-pool","tests","Returns malformed Zoltar constructor dependencies."),n("test-child-validation-edge","test-forker-child-validation-harness","statoblast-forker-base","inherits"),F("test-malicious-emitter-edge","test-forker-malicious-emitter","statoblast-event-emitter","tests","Models a layout-incompatible or reverting event delegate."),F("test-fake-pool-edge","test-forker-fake-pool","statoblast-security-pool-interface","tests","Models forged child pool configuration."),F("test-attack-factory-edge","test-forker-attack-factory","statoblast-security-pool-factory-interface","tests","Returns malicious child deployments."),F("test-attack-parent-edge","test-forker-attack-parent","statoblast-pool-forker","tests","Models a parent pool that redirects child deployment."),F("test-escrow-factory-edge","test-forker-escrow-factory","statoblast-security-pool-factory-interface","tests","Builds escrow-accounting attack children."),F("test-escrow-game-edge","test-forker-escrow-game","statoblast-escalation-game","tests","Models inconsistent escalation escrow state."),F("test-escrow-parent-edge","test-forker-escrow-parent","statoblast-pool-forker","tests","Models malicious parent escalation migration state."),F("test-alternating-game-edge","test-forker-alternating-game","statoblast-escalation-game","tests","Alternates child game answers across validation reads."),F("test-escrow-child-edge","test-forker-escrow-child","statoblast-security-pool","tests","Models a malicious child pool during escrow migration."),F("test-auction-pool-edge","test-auction-settlement-pool","statoblast-security-pool","tests","Provides controlled auction settlement accounting."),n("test-auction-settlement-base-edge","test-forker-auction-settlement","statoblast-auction-settlement-base","inherits"),F("test-truth-auction-alias-share-token-edge","test-truth-auction-alias-share-token","statoblast-pool-forker","tests","Supplies an always-authorized share-token surface to fake-lineage rejection tests."),F("test-truth-auction-alias-factory-edge","test-truth-auction-alias-factory","statoblast-pool-forker","tests","Returns attacker-selected child and truth-auction addresses to fake-lineage rejection tests."),F("test-truth-auction-alias-parent-edge","test-truth-auction-alias-parent","statoblast-pool-forker","tests","Models a fake parent attempting to attach an undeployed or canonical truth auction."),F("test-truth-auction-alias-child-edge","test-truth-auction-alias-child","statoblast-pool-forker","tests","Records and forwards any ETH misrouted through a rejected fake child.")],D4=new Map(Wu.map((t)=>[t.id,t])),HC=new Set(rc.map((t)=>`${t.source}->${t.target}`)),qC={calls:"Calls",tests:"Test helper invokes",uses:"Uses"},AM=GM.flatMap((t)=>{if(rc.some((u)=>u.source===t.source&&u.target===t.target&&LM(t.relation,u.relation)))return[];let r=D4.get(t.target);if(r===void 0)throw Error(`Contract atlas behavioral reference targets missing node ${t.target}`);let f=t.members.length===1?"member":"members";return[F(`source-behavior-${t.source}--${t.target}`,t.source,t.target,t.relation,`${qC[t.relation]} ${r.label} ${f} ${t.members.join(", ")}.`)]}),$C=new Set([...HC,...AM.map((t)=>`${t.source}->${t.target}`)]),PC=BM.flatMap((t)=>{if($C.has(`${t.source}->${t.target}`))return[];let r=D4.get(t.target);if(r===void 0)throw Error(`Contract atlas source reference targets missing node ${t.target}`);return[F(`source-reference-${t.source}--${t.target}`,t.source,t.target,"references",`Directly references ${t.symbols.join(", ")} from the ${r.label} source unit.`)]}),A4=[...rc,...AM,...PC],pg=new Map;for(let t of A4){let r=`${t.source}->${t.target}`,f=pg.get(r);if(f===void 0)pg.set(r,{edges:[t],id:`plot-route-${t.source}--${t.target}`,source:t.source,target:t.target});else f.edges.push(t)}var O8=[...pg.values()],EC="protocol",fc=[{description:"Runtime calls, asset movement, deployments, and delegatecalls.",id:"protocol",label:"Protocol flow",relations:["calls","assets","deploys","delegatecall"]},{description:"Inheritance, implementations, compatibility, and library or type use.",id:"structure",label:"Type structure",relations:["inherits","implements","compatible","uses"]},{description:"Direct source references not replaced by a more specific relationship.",id:"references",label:"Source references",relations:["references"]},{description:"Test-only behavior routed to repeated production gateways.",id:"tests",label:"Test exercise",relations:["tests"]},{description:"Every relationship layer at once. This completeness view is intentionally dense.",id:"all",label:"All routes",relations:["calls","assets","deploys","delegatecall","inherits","implements","compatible","uses","references","tests"]}];function s8(t){let r=t??EC,f=fc.find((u)=>u.id===r);if(f===void 0)throw Error(`Unknown contract atlas view ${r}`);return f}function O4(t){let r=new Set(t.relations);return O8.filter((f)=>f.edges.some((u)=>r.has(u.relation)))}function OM(t){return t.edges.map((r)=>`${tc[r.relation]}: ${r.description}`).join(` +`)}var sM=A4.map((t)=>{let r=D4.get(t.source),f=D4.get(t.target);if(r===void 0||f===void 0)throw Error(`Contract atlas relationship ${t.id} has a missing source or target`);return{edge:t,source:r,target:f}});var vM=IM();function s4(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function YM(t){if(!s4(t))throw Error("Plot diagram node must be an object");let r=t.text;if(typeof r==="string")return{text:r};let f=t.tag;if(typeof f!=="string"||f.length===0)throw Error("Plot diagram node is missing a tag");let u=t.attributes,h={};if(u!==void 0){if(!s4(u))throw Error(`Plot diagram ${f} attributes must be an object`);for(let[g,c]of Object.entries(u)){if(typeof c!=="string")throw Error(`Plot diagram ${f} attribute ${g} must be a string`);h[g]=c}}let x=t.children,b=[];if(x!==void 0){if(!Array.isArray(x))throw Error(`Plot diagram ${f} children must be an array`);b=x.map(YM)}return{...Object.keys(h).length===0?{}:{attributes:h},...b.length===0?{}:{children:b},tag:f}}function QC(t,r){if(!s4(t))throw Error(`Plot chart ${r} specification must be an object`);let{ariaDescription:f,ariaLabel:u,height:h,nodes:x,width:b}=t;if(typeof f!=="string"||typeof u!=="string")throw Error(`Plot chart ${r} needs accessible text`);if(typeof b!=="number"||typeof h!=="number"||b<=0||h<=0)throw Error(`Plot chart ${r} needs positive dimensions`);if(!Array.isArray(x))throw Error(`Plot chart ${r} nodes must be an array`);return{ariaDescription:f,ariaLabel:u,height:h,nodes:x.map(YM),width:b}}if(!s4(vM))throw Error("Plot diagram specifications must be an object");var UC=Object.fromEntries(Object.entries(vM).map(([t,r])=>[t,QC(r,t)]));function St(t,r,f=0){let u=Number(t[r]);return Number.isFinite(u)?u:f}function SM(t){if(t.text!==void 0)return t.text;return(t.children??[]).map(SM).join("")}function CC(t){if(t==="svg-label")return{fontSize:17,fontWeight:800};if(t==="svg-micro")return{fontSize:11,fontWeight:650};return{fontSize:13,fontWeight:t==="svg-small"?650:500}}function KC(t){if(t["text-anchor"]==="end")return"end";if(t["text-anchor"]==="middle")return"middle";return"start"}function WC(t){let r=t.match(/[MLHVCZz]|-?(?:\d+\.?\d*|\.\d+)/g)??[],f=[],u="",h=0,x=0,b=0;while(hH.tag==="tspan"),M=w.length>0?w:[b];for(let H of M){let q=H===b?c:{...c,...H.attributes??{}};d+=St(H.attributes??{},"dy");let $=CC(q.class);f.push({attributes:q,className:q.class,fontSize:$.fontSize,fontWeight:$.fontWeight,text:SM(H).trim(),textAnchor:KC(q),x:St(q,"x",l),y:d-$.fontSize*0.34})}}else if(b.tag==="path")u.push({attributes:c,className:_,hasArrow:c["marker-end"]!==void 0,points:WC(c.d??""),stroke:c.stroke??"currentColor",strokeDasharray:c["stroke-dasharray"],strokeWidth:St(c,"stroke-width",2.35)});else if(b.tag==="line")u.push({attributes:c,className:_,hasArrow:c["marker-end"]!==void 0,points:[{x:St(c,"x1"),y:St(c,"y1")},{x:St(c,"x2"),y:St(c,"y2")}],stroke:c.stroke??"currentColor",strokeDasharray:c["stroke-dasharray"],strokeWidth:St(c,"stroke-width",2.35)});else if(b.tag==="polyline")u.push({attributes:c,className:_,hasArrow:c["marker-end"]!==void 0,points:iC(c.points??""),stroke:c.stroke??"currentColor",strokeDasharray:c["stroke-dasharray"],strokeWidth:St(c,"stroke-width",2.35)});else if(b.tag==="circle")h.push({className:_,fill:c.fill??"currentColor",r:St(c,"r",4),x:St(c,"cx"),y:St(c,"cy")});for(let l of b.children??[])x(l,g)}for(let b of t.nodes)x(b);return{dots:h,lines:u,rectangles:r,texts:f}}function uc(t,r){if(t===void 0)return;for(let[f,u]of Object.entries(r))if(f.startsWith("data-"))t.setAttribute(f,u)}function VC(t){let r=ZC(t),f=r.lines.map((l)=>R4(l.points,{...l.className===void 0?{}:{className:l.className},curve:"linear",...l.hasArrow?{markerEnd:"arrow"}:{},stroke:l.stroke,...l.strokeDasharray===void 0?{}:{strokeDasharray:l.strokeDasharray},strokeWidth:l.strokeWidth,x:"x",y:"y"})),u=r.rectangles.map((l)=>Cu([l],{...l.className===void 0?{}:{className:l.className},rx:l.rx,x1:"x",x2:(d)=>d.x+d.width,y1:"y",y2:(d)=>d.y+d.height})),h=r.dots.map((l)=>Ku([l],{...l.className===void 0?{}:{className:l.className},fill:l.fill,r:l.r,x:"x",y:"y"})),x=r.texts.map((l)=>Wt([l],{...l.className===void 0?{}:{className:l.className},fontSize:l.fontSize,fontWeight:l.fontWeight,text:"text",textAnchor:l.textAnchor,x:"x",y:"y"})),b=lr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,margin:0,marks:[...f,...u,...h,...x],style:{background:"transparent",color:"currentColor",overflow:"visible"},width:t.width,x:{axis:null,domain:[0,t.width]},y:{axis:null,domain:[t.height,0]}}),g=Array.from(b.querySelectorAll('g[aria-label="rect"] > rect')),c=Array.from(b.querySelectorAll('g[aria-label="line"] > path')),_=Array.from(b.querySelectorAll('g[aria-label="text"] > text'));return r.rectangles.forEach((l,d)=>uc(g[d],l.attributes)),r.lines.forEach((l,d)=>uc(c[d],l.attributes)),r.texts.forEach((l,d)=>uc(_[d],l.attributes)),b}function Et(t,r,f=0){let u=t?.querySelector(`[data-example-input="${r}"]`),h=Number(u?.value);return Number.isFinite(h)?h:f}function hc(t){let r=1000000000000000000n,f=t/r,u=(t%r).toString().padStart(18,"0");return`${f}.${u}`}function NC(t){let r=O0["fig-statoblast-escalation-cost-curve"],f=Array.from({length:61},(x,b)=>{let g=b/60;return{elapsed:g,requiredRep:iM(g)}}),u=f[0],h=f[f.length-1];if(u===void 0||h===void 0)throw Error("Escalation cost curve must include both endpoints");return lr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,marginBottom:46,marginLeft:66,marginRight:34,marginTop:20,marks:[Af(f,{fill:"var(--gold-soft, #f3e4c6)",x:"elapsed",y:"requiredRep"}),df(f,{stroke:"var(--gold, #8a5d18)",strokeWidth:3,x:"elapsed",y:"requiredRep"}),lf([u.requiredRep],{stroke:"var(--green, #1d735d)",strokeDasharray:"5,4",strokeWidth:2}),lf([h.requiredRep],{stroke:"var(--red, #99453f)",strokeDasharray:"5,4",strokeWidth:2}),Ku([u,h],{fill:(x,b)=>b===0?"var(--green, #1d735d)":"var(--red, #99453f)",r:6,x:"elapsed",y:"requiredRep"}),Wt([{elapsed:u.elapsed,label:`start bond ${(u.requiredRep*100).toFixed(1)}%`,requiredRep:u.requiredRep}],{dx:9,dy:-10,fill:"var(--green, #1d735d)",fontWeight:700,text:"label",textAnchor:"start",x:"elapsed",y:"requiredRep"}),Wt([{elapsed:h.elapsed,label:"non-decision threshold 100%",requiredRep:h.requiredRep}],{dx:-9,dy:14,fill:"var(--red, #99453f)",fontWeight:700,text:"label",textAnchor:"end",x:"elapsed",y:"requiredRep"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,1],grid:!0,label:r.x,tickFormat:(x)=>`${Math.round(x*100)}%`},y:{domain:[0,1.06],grid:!0,label:r.y,tickFormat:(x)=>`${Math.round(x*100)}%`}})}function TC(t){let r=O0["fig-zoltar-fork-threshold-decay"],f=VM(21);return lr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,marginBottom:46,marginLeft:62,marginRight:24,marginTop:22,marks:[Af(f,{fill:"var(--blue-soft, #dceaf8)",x:"generation",y:"theoreticalSupply"}),df(f,{stroke:"var(--blue, #245f9f)",strokeWidth:3,x:"generation",y:"theoreticalSupply"}),df(f,{stroke:"var(--gold, #8a5d18)",strokeDasharray:"6,4",strokeWidth:2,x:"generation",y:"forkThreshold"}),Wt([{generation:15,label:"theoretical supply",value:f[15]?.theoreticalSupply??0},{generation:15,label:"next fork threshold",value:f[15]?.forkThreshold??0}],{dy:-8,fill:(u)=>u.label==="theoretical supply"?"var(--blue, #245f9f)":"var(--gold, #8a5d18)",fontWeight:650,text:"label",x:"generation",y:"value"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{grid:!0,label:r.x,ticks:10},y:{domain:[0,100],grid:!0,label:r.y}})}function FC(t){let r=O0["fig-statoblast-retention-utilization"],f=Array.from({length:101},(u,h)=>{return{annualFeePercent:ZM(h),utilizationPercent:h}});return lr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,height:t.height,marginBottom:46,marginLeft:60,marginRight:28,marginTop:22,marks:[Af(f,{fill:"var(--gold-soft, #f3e4c6)",x:"utilizationPercent",y:"annualFeePercent"}),df(f,{stroke:"var(--gold, #8a5d18)",strokeWidth:3,x:"utilizationPercent",y:"annualFeePercent"}),x0([80],{stroke:"var(--red, #99453f)",strokeDasharray:"5,4",strokeWidth:2}),Wt([{annualFeePercent:f[80]?.annualFeePercent??50,label:"80% utilization dip",utilizationPercent:80}],{dx:-8,dy:-10,fill:"var(--red, #99453f)",fontWeight:700,text:"label",textAnchor:"end",x:"utilizationPercent",y:"annualFeePercent"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,100],grid:!0,label:r.x},y:{domain:[0,55],grid:!0,label:r.y}})}function LC(t,r){let f=O0["fig-liquidation-health-curve"],u=r.closest(".interactive-example"),h=u?.querySelector('[data-liquidation-input="rep"]')?.value??"1000",x=u?.querySelector('[data-liquidation-input="debt"]')?.value??"75",b=u?.querySelector('[data-liquidation-input="multiplier"]')?.value??"2",g=u?.querySelector('[data-liquidation-input="price"]')?.value??"10",c=BigInt(h),_=BigInt(x),l=NM(b)??20000n,d=BigInt(g),w=Number(c),M=Number(_),H=Number(l)/1e4,q=Number(d),$=Math.max(20,q),E=Array.from({length:81},(W,i)=>{let Z=$*i/80;return{price:Z,requiredRep:M*H*Z}}),P=TM(c,_,l,d),{currentRequiredRep:J,state:Q,thresholdPrice:U}=P,C=lr({ariaDescription:FM(t.ariaDescription,c,P),ariaLabel:t.ariaLabel,height:t.height,marginBottom:48,marginLeft:92,marginRight:28,marginTop:24,marks:[Af(E,{fill:"var(--red-soft, #f2d9d6)",x:"price",y:"requiredRep"}),df(E,{stroke:"var(--red, #99453f)",strokeWidth:3,x:"price",y:"requiredRep"}),lf([w],{stroke:"var(--green, #1d735d)",strokeDasharray:"7,4",strokeWidth:3}),...Number.isFinite(U)&&U<=$?[x0([U],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"4,4",strokeWidth:2})]:[],Ku([{price:q,requiredRep:J}],{fill:Q==="safe"?"var(--green, #1d735d)":"var(--red, #99453f)",r:7,stroke:"var(--paper, #fff)",strokeWidth:2,x:"price",y:"requiredRep"}),Wt([{label:`${w.toFixed(0)} REP available`,price:$*0.72,requiredRep:w}],{dy:-9,fill:"var(--green, #1d735d)",fontWeight:650,text:"label",x:"price",y:"requiredRep"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,$],grid:!0,label:f.x},y:{domain:[0,Math.max(w,M*H*$)*1.06],grid:!0,label:f.y,labelAnchor:"center"}});return C.dataset.chartState=Q,C}function GC(t){let r=[{id:"deploy",subtitle:"Construction-time validation and deployment",title:"1. Deploy & wire",x1:0.1,x2:11.9,y1:0.1,y2:3.2},{id:"runtime",subtitle:"Claims, dispute escrow, and guarded price execution",title:"2. Operate & resolve",x1:0.1,x2:11.9,y1:3.45,y2:6.55},{id:"fork",subtitle:"Child creation, REP migration, state migration, and backing repair",title:"3. Fork & repair",x1:0.1,x2:11.9,y1:6.8,y2:11.15}],f=[{fill:"registry",id:"deploy-question",label:"Question Data",x1:0.4,x2:2.2,y1:0.65,y2:1.25},{fill:"registry",id:"deploy-zoltar",label:"Zoltar",x1:0.4,x2:2.2,y1:1.5,y2:2.1},{fill:"registry",id:"deploy-rep",label:"Reputation Token",x1:0.4,x2:2.2,y1:2.35,y2:2.95},{fill:"factory",id:"deploy-factory",label:"Pool Factory",x1:4,x2:6.1,y1:1.5,y2:2.1},{fill:"market",id:"deploy-pool",label:"Security Pool",x1:7.4,x2:9.3,y1:0.65,y2:1.25},{fill:"market",id:"deploy-share",label:"Share Token",x1:9.7,x2:11.5,y1:1.5,y2:2.1},{fill:"oracle",id:"deploy-coordinator",label:"Price Coordinator",x1:7.4,x2:9.3,y1:2.35,y2:2.95},{fill:"market",id:"runtime-pool",label:"Security Pool",x1:0.4,x2:2.3,y1:4.75,y2:5.35},{fill:"market",id:"runtime-share",label:"Share Token",x1:3,x2:4.9,y1:3.95,y2:4.55},{fill:"resolution",id:"runtime-escalation",label:"Escalation Game",x1:3,x2:4.9,y1:5.55,y2:6.15},{fill:"oracle",id:"runtime-coordinator",label:"Price Coordinator",x1:5.3,x2:7.5,y1:4.75,y2:5.35},{fill:"oracle",id:"runtime-oracle",label:"OpenOracle",x1:9.1,x2:11.2,y1:4.75,y2:5.35},{fill:"market",id:"fork-share",label:"Share Token",x1:0.4,x2:2.3,y1:7.35,y2:7.95},{fill:"resolution",id:"fork-escalation",label:"Escalation Game",x1:0.4,x2:2.3,y1:8.3,y2:8.9},{fill:"fork",id:"fork-proxy",label:"Migration Proxy",x1:0.4,x2:2.3,y1:9.25,y2:9.85},{fill:"registry",id:"fork-zoltar",label:"Zoltar",x1:0.4,x2:2.3,y1:10.2,y2:10.8},{fill:"fork",id:"fork-forker",label:"Pool Forker",x1:4.5,x2:6.7,y1:8.65,y2:9.35},{fill:"factory",id:"fork-factory",label:"Pool Factory",x1:9.1,x2:11.2,y1:7.35,y2:7.95},{fill:"market",id:"fork-pool",label:"Security Pool",x1:9.1,x2:11.2,y1:8.3,y2:8.9},{fill:"fork",id:"fork-auction",label:"Truth Auction",x1:9.1,x2:11.2,y1:9.25,y2:9.85}],u=new Set(kg.map((H)=>H.id)),h=[{id:"factory-question-validation",labelX:3.05,labelY:1.28,receiverNodeId:"deploy-question",sourceNodeId:"deploy-factory",points:[{x:4,y:1.63},{x:3.1,y:1.63},{x:3.1,y:0.95},{x:2.2,y:0.95}]},{id:"factory-universe-lookup",labelX:3.1,labelY:1.68,receiverNodeId:"deploy-zoltar",sourceNodeId:"deploy-factory",points:[{x:4,y:1.8},{x:2.2,y:1.8}]},{id:"factory-pool-deployment",labelX:6.78,labelY:1.28,receiverNodeId:"deploy-pool",sourceNodeId:"deploy-factory",points:[{x:6.1,y:1.63},{x:6.75,y:1.63},{x:6.75,y:0.95},{x:7.4,y:0.95}]},{id:"factory-share-token-deployment",labelX:7.9,labelY:1.68,receiverNodeId:"deploy-share",sourceNodeId:"deploy-factory",points:[{x:6.1,y:1.8},{x:9.7,y:1.8}]},{id:"factory-price-coordinator-deployment",labelX:6.78,labelY:2.32,receiverNodeId:"deploy-coordinator",sourceNodeId:"deploy-factory",points:[{x:6.1,y:1.97},{x:6.75,y:1.97},{x:6.75,y:2.65},{x:7.4,y:2.65}]},{id:"zoltar-reputation-token-lifecycle",labelX:2.28,labelY:2.23,receiverNodeId:"deploy-rep",sourceNodeId:"deploy-zoltar",points:[{x:1.3,y:2.1},{x:1.3,y:2.35}]},{id:"pool-share-token-claims",labelX:3.08,labelY:4.62,receiverNodeId:"runtime-share",sourceNodeId:"runtime-pool",points:[{x:2.3,y:4.92},{x:2.65,y:4.92},{x:2.65,y:4.25},{x:3,y:4.25}]},{id:"pool-escalation-game-resolution",labelX:2.3,labelY:5.73,receiverNodeId:"runtime-escalation",sourceNodeId:"runtime-pool",points:[{x:1.35,y:5.35},{x:1.35,y:5.85},{x:3,y:5.85}]},{id:"pool-price-read",labelX:3.8,labelY:4.88,receiverNodeId:"runtime-coordinator",sourceNodeId:"runtime-pool",points:[{x:2.3,y:4.95},{x:5.3,y:4.95}]},{id:"coordinator-pool-execute",labelX:3.8,labelY:5.28,receiverNodeId:"runtime-pool",sourceNodeId:"runtime-coordinator",points:[{x:5.3,y:5.2},{x:2.3,y:5.2}]},{id:"coordinator-oracle-report",labelX:8.3,labelY:4.88,receiverNodeId:"runtime-oracle",sourceNodeId:"runtime-coordinator",points:[{x:7.5,y:4.95},{x:9.1,y:4.95}]},{id:"oracle-coordinator-callback",labelX:8.3,labelY:5.28,receiverNodeId:"runtime-coordinator",sourceNodeId:"runtime-oracle",points:[{x:9.1,y:5.2},{x:7.5,y:5.2}]},{id:"share-token-forker-migration",labelX:3.9,labelY:8.2,receiverNodeId:"fork-forker",sourceNodeId:"fork-share",points:[{x:2.3,y:7.65},{x:3.9,y:7.65},{x:3.9,y:8.75},{x:4.5,y:8.75}]},{id:"forker-escalation-snapshot",labelX:3.43,labelY:8.75,receiverNodeId:"fork-escalation",sourceNodeId:"fork-forker",points:[{x:4.5,y:8.83},{x:3.45,y:8.83},{x:3.45,y:8.6},{x:2.3,y:8.6}]},{id:"forker-migration-proxy",labelX:3.4,labelY:9.5,receiverNodeId:"fork-proxy",sourceNodeId:"fork-forker",points:[{x:4.5,y:9.17},{x:3.45,y:9.17},{x:3.45,y:9.55},{x:2.3,y:9.55}]},{id:"migration-proxy-zoltar",labelX:2.3,labelY:10.02,receiverNodeId:"fork-zoltar",sourceNodeId:"fork-proxy",points:[{x:1.35,y:9.85},{x:1.35,y:10.2}]},{id:"forker-child-deployment",labelX:7.95,labelY:7.78,receiverNodeId:"fork-factory",sourceNodeId:"fork-forker",points:[{x:6.7,y:8.78},{x:6.95,y:8.78},{x:6.95,y:7.65},{x:9.1,y:7.65}]},{id:"forker-pool-migration",labelX:7.92,labelY:8.68,receiverNodeId:"fork-pool",sourceNodeId:"fork-forker",points:[{x:6.7,y:9},{x:9.1,y:8.6}]},{id:"forker-truth-auction",labelX:8.02,labelY:9.48,receiverNodeId:"fork-auction",sourceNodeId:"fork-forker",points:[{x:6.7,y:9.17},{x:8,y:9.17},{x:8,y:9.55},{x:9.1,y:9.55}]}],x=new Map(kg.map((H)=>[H.id,H])),b=new Map(f.map((H)=>[H.id,H])),g=new Map(r.map((H)=>[H.id,H])),c=new Set(h.map((H)=>H.id));if(c.size!==u.size||[...u].some((H)=>!c.has(H)))throw Error("Contract interaction chart routed edges do not match the shared interaction registry");function _(H){switch(H){case"Deployment":case"Universe lifecycle":return"deploy";case"Market runtime":case"Price discovery":case"Price settlement":case"Resolution":case"Risk execution":case"Risk operations":return"runtime";case"Backing repair":case"Fork migration":case"Fork snapshot":case"Share migration":return"fork";default:throw Error(`Contract interaction chart has no panel for phase ${H}`)}}function l(H,q){let E=H.x>=q.x1-0.000001&&H.x<=q.x2+0.000001,P=H.y>=q.y1-0.000001&&H.y<=q.y2+0.000001,J=Math.abs(H.y-q.y1)<=0.000001||Math.abs(H.y-q.y2)<=0.000001,Q=Math.abs(H.x-q.x1)<=0.000001||Math.abs(H.x-q.x2)<=0.000001;return E&&J||P&&Q}for(let H of h){let q=x.get(H.id),$=b.get(H.sourceNodeId),E=b.get(H.receiverNodeId),P=H.points[0],J=H.points[H.points.length-1];if(q===void 0||$===void 0||E===void 0||P===void 0||J===void 0)throw Error(`Contract interaction chart route ${H.id} is incomplete`);let Q=_(q.phase),U=g.get(Q);if($.label!==q.source||E.label!==q.receiver)throw Error(`Contract interaction chart route ${H.id} does not match registry direction ${q.source} to ${q.receiver}`);if(U===void 0||!$.id.startsWith(`${Q}-`)||!E.id.startsWith(`${Q}-`))throw Error(`Contract interaction chart route ${H.id} is not in its ${Q} phase panel`);let C=$.x1>=U.x1&&$.x2<=U.x2&&$.y1>=U.y1&&$.y2<=U.y2,W=E.x1>=U.x1&&E.x2<=U.x2&&E.y1>=U.y1&&E.y2<=U.y2,i=H.points.every((Z)=>Z.x>=U.x1&&Z.x<=U.x2&&Z.y>=U.y1&&Z.y<=U.y2);if(!C||!W||!i)throw Error(`Contract interaction chart route ${H.id} leaves its ${Q} phase panel bounds`);if(!l(P,$)||!l(J,E))throw Error(`Contract interaction chart route ${H.id} does not touch its source and receiver boundaries`)}let d=r.map((H)=>({label:H.title,x:H.x1+0.22,y:H.y1+0.27})),w=r.map((H)=>({label:H.subtitle,x:H.x1+2.2,y:H.y1+0.27})),M=h.map((H)=>{let q=x.get(H.id);if(q===void 0)throw Error(`Contract interaction chart route ${H.id} has no registry edge`);return{label:q.action,x:H.labelX,y:H.labelY}});return lr({ariaDescription:t.ariaDescription,ariaLabel:t.ariaLabel,color:{domain:["registry","factory","market","resolution","oracle","fork"],range:["var(--blue-soft, #dceaf8)","var(--gold-soft, #f3e4c6)","var(--green-soft, #dcefe8)","var(--red-soft, #f2d9d6)","var(--blue-soft, #dceaf8)","var(--gold-soft, #f3e4c6)"]},height:t.height,margin:18,marks:[Cu(r,{fill:"var(--paper, #fff)",rx:14,stroke:"var(--line, #d8e0e4)",strokeWidth:1.4,x1:"x1",x2:"x2",y1:"y1",y2:"y2"}),Wt(d,{fill:"var(--ink, #1f2529)",fontSize:15,fontWeight:750,text:"label",textAnchor:"start",x:"x",y:"y"}),Wt(w,{fill:"var(--muted, #465760)",fontSize:11,text:"label",textAnchor:"start",x:"x",y:"y"}),...h.map((H)=>R4(H.points,{markerEnd:"arrow",stroke:"var(--muted, #465760)",strokeWidth:2.2,x:"x",y:"y"})),Wt(M,{fill:"var(--muted, #465760)",fontSize:10,fontWeight:650,stroke:"var(--paper, #fff)",strokeWidth:4,text:"label",x:"x",y:"y"}),Cu(f,{fill:"fill",rx:10,stroke:"var(--ink, #1f2529)",strokeWidth:1.5,x1:"x1",x2:"x2",y1:"y1",y2:"y2"}),Wt(f,{fill:"var(--ink, #1f2529)",fontSize:12,fontWeight:700,text:"label",x:(H)=>(H.x1+H.x2)/2,y:(H)=>(H.y1+H.y2)/2})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{axis:null,domain:[0,12]},y:{axis:null,domain:[11.3,0]}})}function BC(t){if(t.includes(` +`)||t.length<=24)return t;let r=t.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").split(" "),f=[];for(let u of r){let h=f[f.length-1];if(h===void 0||h.length+u.length+1>22)f.push(u);else f[f.length-1]=`${h} ${u}`}return f.join(` +`)}function nM(t){if(t.axis==="x1")return t.edge.x2;if(t.axis==="x2")return t.edge.x1;if(t.axis==="y1")return t.edge.y2;return t.edge.y1}function zC(t,r){let f=new Map;function u(h,x){let b=f.get(h);if(b===void 0)f.set(h,[x]);else b.push(x)}for(let h of t){let x=r.get(h.sourceNodeId),b=r.get(h.targetNodeId);if(x===void 0||b===void 0)throw Error(`Contract atlas route ${h.id} cannot spread ports for a missing node`);if(h.orientation==="horizontal"){let g=h.x1===x.x1?"left":"right",c=h.x2===b.x1?"left":"right";u(`${x.id}:horizontal:${g}`,{axis:"y1",edge:h,node:x}),u(`${b.id}:horizontal:${c}`,{axis:"y2",edge:h,node:b})}else{let g=h.y1===x.y1?"top":"bottom",c=h.y2===b.y1?"top":"bottom";u(`${x.id}:vertical:${g}`,{axis:"x1",edge:h,node:x}),u(`${b.id}:vertical:${c}`,{axis:"x2",edge:h,node:b})}}for(let h of f.values()){if(h.length<2)continue;h.sort((w,M)=>nM(w)-nM(M)||w.edge.id.localeCompare(M.edge.id));let x=h[0];if(x===void 0)continue;let b=x.axis==="y1"||x.axis==="y2",g=b?x.node.y1:x.node.x1,c=b?x.node.y2:x.node.x2,_=(c-g)*0.16,l=g+_,d=(c-g-_*2)/(h.length-1);for(let[w,M]of h.entries())M.edge[M.axis]=l+w*d}}function RC(t,r){let f=[{fill:"var(--blue-soft, #dceaf8)",id:"zoltar",subtitle:"Questions, universes, REP, and their token foundations",title:sf.zoltar},{fill:"var(--gold-soft, #f3e4c6)",id:"statoblast-deployment",subtitle:"Factory, CREATE2 deployer, worker, and component factories",title:sf["statoblast-deployment"]},{fill:"var(--green-soft, #dcefe8)",id:"statoblast-runtime",subtitle:"Pools, claims, resolution, oracle pricing, forks, and backing repair",title:sf["statoblast-runtime"]},{fill:"var(--paper, #fff)",id:"statoblast-implementation",subtitle:"Inheritance stacks, delegate-compatible storage, interfaces, and type modules",title:sf["statoblast-implementation"]},{fill:"var(--soft, #edf3f5)",id:"infrastructure",subtitle:"Deployment helpers, compatibility contracts, imported OpenOracle, and vendored dependencies",title:sf.infrastructure},{fill:"var(--red-soft, #f2d9d6)",id:"tests",subtitle:"Every test-only Solidity declaration; production targets are repeated as gateway groups",title:sf.tests}],u=0.45,h=1.12,x=0.82,b=0.62,g=2.62,c=3,_=0.1,l=18.35,d=0.1,w=f.map((N)=>{let L=Wu.filter((s)=>s.panel===N.id),K=Math.max(...L.map((s)=>s.order+1),1),V=L.filter((s)=>s.declaration!==void 0).length,y=L.length-V,I=d,A=I+1.12+K*0.82+0.48;return d=A+0.45,{...N,countLabel:`${V} declaration${V===1?"":"s"}${y===0?"":` + ${y} type module${y===1?"":"s"}`}`,x1:0.1,x2:18.35,y1:I,y2:A}}),M=new Map(w.map((N)=>[N.id,N])),H=Wu.map((N)=>{let L=M.get(N.panel);if(L===void 0)throw Error(`Contract atlas node ${N.id} has no panel`);let K=0.48+N.column*3,V=L.y1+1.12+N.order*0.82;return{...N,isGateway:!1,x1:K,x2:K+2.62,y1:V,y2:V+0.62}}),q=M.get("tests");if(q===void 0)throw Error("Contract atlas is missing its test-only panel");let $=zM.map((N)=>{let K=q.y1+1.12+N.order*0.82;return{...N,column:5,isGateway:!0,kind:"gateway",panel:"tests",source:"Repeated production boundary",x1:15.48,x2:18.1,y1:K,y2:K+0.62}});H.push(...$);let E=new Map(H.map((N)=>[N.id,N]));function P(N){let L=RM.get(N);if(L===void 0)throw Error(`Contract atlas test target ${N} has no explicit gateway classification`);return L}let J=O4(r).map((N)=>{let L=E.get(N.source),K=E.get(N.target);if(L===void 0||K===void 0)throw Error(`Contract atlas plot route ${N.id} has a missing source or target`);let V=N.edges.length===1?N.edges[0]:void 0;if(N.edges.length===0)throw Error(`Contract atlas plot route ${N.id} has no relationships`);let y=L.panel==="tests"&&K.panel!=="tests"?P(K.id):K.id,I=E.get(y);if(I===void 0)throw Error(`Contract atlas plot route ${N.id} has no routed target`);let A=V?.relation??"multiple",s={id:N.id,meaning:OM(N),relationStyle:A,sourceNodeId:L.id,sourceLabel:L.label.replaceAll(` +`," "),targetNodeId:I.id,targetLabel:K.label.replaceAll(` +`," ")},Y=L.panel===I.panel,m=L.x2["horizontal","vertical"].map((L)=>{let K=U[N];return eg(J.filter((V)=>V.relationStyle===N&&V.orientation===L),{curve:L==="horizontal"?"bump-x":"bump-y",markerEnd:"arrow",stroke:K.stroke,...K.dash===void 0?{}:{strokeDasharray:K.dash},strokeOpacity:K.opacity,strokeWidth:K.width,title:(V)=>`${V.sourceLabel} → ${V.targetLabel} +${V.meaning}`,x1:"x1",x2:"x2",y1:"y1",y2:"y2"})})),i={abstract:{dash:"6,3",fill:"var(--soft, #edf3f5)",stroke:"var(--muted, #5f6d75)"},contract:{fill:"var(--paper, #fff)",stroke:"var(--ink, #1f2529)"},gateway:{dash:"3,3",fill:"var(--paper, #fff)",stroke:"var(--red, #99453f)"},interface:{dash:"3,3",fill:"var(--blue-soft, #dceaf8)",stroke:"var(--blue, #245f9f)"},library:{fill:"var(--gold-soft, #f3e4c6)",stroke:"var(--gold, #8a5d18)"},module:{dash:"2,3",fill:"var(--green-soft, #dcefe8)",stroke:"var(--green, #1d735d)"}},Z=Object.keys(i).map((N)=>{let L=i[N];return Cu(H.filter((K)=>K.kind===N),{fill:L.fill,rx:7,stroke:L.stroke,...L.dash===void 0?{}:{strokeDasharray:L.dash},strokeWidth:1.35,title:(K)=>`${K.label.replaceAll(` +`," ")} +${K.isGateway?"repeated target group":K.kind} +${K.source}`,x1:"x1",x2:"x2",y1:"y1",y2:"y2"})}),R=w.map((N)=>({label:`${N.title} · ${N.countLabel}`,x:N.x1+0.3,y:N.y1+0.34})),z=w.map((N)=>({label:N.subtitle,x:N.x1+0.3,y:N.y1+0.7})),G=lr({ariaDescription:`${t.ariaDescription} The current ${r.label} layer shows ${J.length} of ${O8.length} routes. ${r.description}`,ariaLabel:`${t.ariaLabel}: ${r.label}`,height:t.height,margin:18,marks:[Cu(w,{fill:"fill",fillOpacity:0.28,rx:14,stroke:"var(--line, #d8e0e4)",strokeWidth:1.5,x1:"x1",x2:"x2",y1:"y1",y2:"y2"}),Wt(R,{fill:"var(--ink, #1f2529)",fontSize:15,fontWeight:780,text:"label",textAnchor:"start",x:"x",y:"y"}),Wt(z,{fill:"var(--muted, #5f6d75)",fontSize:10.5,text:"label",textAnchor:"start",x:"x",y:"y"}),...W,...Z,Wt(H,{fill:"var(--ink, #1f2529)",fontSize:9.6,fontWeight:700,lineHeight:1.05,lineWidth:25,text:(N)=>BC(N.label),x:(N)=>(N.x1+N.x2)/2,y:(N)=>(N.y1+N.y2)/2})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{axis:null,domain:[0,18.45]},y:{axis:null,domain:[d-0.45+0.1,0]}});return G.dataset.atlasView=r.id,G.dataset.chartState=`${Wu.length}-components-${A4.length}-relationships`,G.dataset.plotRouteCount=String(O8.length),G.dataset.visibleRouteCount=String(J.length),G}function If(t,r,f=!1){let u=document.createElement("td");if(f){let h=document.createElement("code");h.textContent=r,u.append(h)}else u.textContent=r;t.append(u)}function DC(){let t=document.querySelector("[data-contract-atlas-node-table]");if(t===null)return;let r={abstract:"abstract contract",contract:"contract",interface:"interface",library:"library",module:"type module"},f=DM.map(({node:u,panelLabel:h})=>{let x=document.createElement("tr");return x.dataset.componentId=u.id,If(x,u.label.replaceAll(` +`," "),!0),If(x,r[u.kind]),If(x,h),If(x,u.source,!0),x});t.replaceChildren(...f),t.dataset.componentCount=String(f.length)}function AC(){let t=document.querySelector("[data-contract-atlas-table]");if(t===null)return;let r=sM.map(({edge:f,source:u,target:h})=>{let x=document.createElement("tr");return x.dataset.relationshipId=f.id,If(x,u.label,!0),If(x,h.label,!0),If(x,tc[f.relation]),If(x,f.description),x});t.replaceChildren(...r),t.dataset.relationshipCount=String(r.length)}function OC(t,r){let f=O0["fig-auction-clearing-ladder"],u=document.querySelector("#simple-auction-example"),h=Math.max(Et(u,"repInventory",4),1),x=Math.max(Et(u,"ethRaiseCap",10),0),b=QM(x,h,[{eth:Et(u,"aliceEth",5),key:"alice",name:"Alice",price:5},{eth:Et(u,"bobEth",4),key:"bob",name:"Bob",price:4},{eth:Et(u,"carolEth",5),key:"carol",name:"Carol",price:3}]),g=b.bids.filter(($)=>$.eth>0),c=g.map(($)=>({...$,cumulativeRep:$.chartRep})),_=b.demandPoints[0],l=_===void 0?[]:[{cumulativeRep:0,price:_.price},...b.demandPoints],d=b.clearingPrice,w=Math.max(h,...c.map(($)=>$.cumulativeRep),...b.demandPoints.map(($)=>$.cumulativeRep),1),M=Math.max(5.8,d*1.16,...g.map(($)=>$.price*1.16)),H=b.mode==="uniform"?`uniform clearing at ${d.toFixed(2)} ETH per REP`:`underfunded allocation at an effective ${b.effectivePrice.toFixed(2)} ETH per REP, with a ${b.qualificationPrice.toFixed(2)} ETH per REP qualification boundary`,q=lr({ariaDescription:`${t.ariaDescription} The current result is ${H}, with ${b.ethRaised.toFixed(2)} ETH retained for ${h.toFixed(2)} REP of inventory.`,ariaLabel:"Interactive truth-auction aggregate demand curve",color:{domain:["Accepted","Partially filled","Rejected"],range:["var(--green, #1d735d)","var(--gold, #8a5d18)","var(--red, #99453f)"],type:"ordinal"},height:t.height,marginBottom:50,marginLeft:66,marginRight:28,marginTop:24,marks:[Af(l,{curve:"step-after",fill:"var(--blue-soft, #dceaf8)",x:"cumulativeRep",y:"price",y1:0}),df(l,{curve:"step-after",stroke:"var(--blue, #245f9f)",strokeWidth:3,x:"cumulativeRep",y:"price"}),x0([h],{stroke:"var(--red, #99453f)",strokeDasharray:"5,4",strokeWidth:2}),lf([d],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2}),Ku(c,{fill:"status",r:6,tip:!0,title:($)=>`${$.name}: ${$.eth.toFixed(2)} ETH at ${$.price.toFixed(2)} ETH/REP`,x:"cumulativeRep",y:"price"}),Wt([{label:`REP inventory ${h.toFixed(2)}`,x:h,y:M*0.72}],{dx:-6,dy:-7,fill:"var(--ink, currentColor)",fontSize:12,text:"label",textAnchor:"end",x:"x",y:"y"}),Wt([{label:`${b.mode==="uniform"?"clearing":"qualification"} ${d.toFixed(2)} ETH/REP`,x:w*0.72,y:d}],{dx:6,dy:-7,fill:"var(--ink, currentColor)",fontSize:12,text:"label",textAnchor:"start",x:"x",y:"y"}),Wt([{label:"● accepted",status:"Accepted",x:w*0.12},{label:"● partially filled",status:"Partially filled",x:w*0.42},{label:"● rejected",status:"Rejected",x:w*0.74}],{fill:"status",fontSize:12,text:"label",x:"x",y:M*0.97})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,w*1.08],grid:!0,label:f.x},y:{domain:[0,M],grid:!0,label:f.y}});return q.dataset.chartState=b.mode,r.dataset.chartState=q.dataset.chartState,q}function sC(t,r){let f=O0["plot-statoblast-whitepaper-19"],u=r.closest("#collateral-repair-example"),h=Math.max(Et(u,"parentCollateral",50),0),x=UM(h,Et(u,"forkCollateralReceived",47.5),Et(u,"auctionRaised",2.5)),b=[{kind:"Migration-routed",x1:0,x2:x.received},{kind:"Auction repair",x1:x.received,x2:x.received+x.repairEth}],g=lr({ariaDescription:`${t.ariaDescription}. Migration routed ${x.received.toFixed(2)} ETH and the auction repairs ${x.repairEth.toFixed(2)} ETH toward the ${h.toFixed(2)} ETH target, leaving ${x.remainingShortfall.toFixed(2)} ETH unfilled.`,ariaLabel:t.ariaLabel,color:{domain:["Migration-routed","Auction repair"],range:["var(--blue, #245f9f)","var(--green, #1d735d)"]},height:t.height,marginBottom:44,marginLeft:124,marginRight:28,marginTop:52,marks:[A8(b,{fill:"kind",inset:2,x1:"x1",x2:"x2",y:()=>"Child collateral"}),x0([h],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2}),Wt([{kind:"Migration-routed",label:"■ Migration-routed",value:h*0.24},{kind:"Auction repair",label:"■ Auction repair",value:h*0.68}],{dy:-55,fill:"kind",fontSize:12,text:"label",x:"value",y:()=>"Child collateral"}),Wt([{label:`target ${h.toFixed(2)} ETH`,value:h}],{dx:-6,dy:-55,fontSize:12,text:"label",textAnchor:"end",x:"value",y:()=>"Child collateral"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,Math.max(h,x.received+x.repairEth,1)],grid:!0,label:f.x},y:{label:f.y}});return g.dataset.chartState=x.remainingShortfall===0?"repaired":"partial",r.dataset.chartState=g.dataset.chartState,g}function IC(t,r){let f=O0["plot-open-oracle-integration-2"],u=r.closest("#binary-censorship-example"),h=Math.max(Et(u,"honestPrice",900),0.0001),x=Math.max(Et(u,"manipulatedPrice",1017),0.0001),b=Math.max(Et(u,"liquidationThresholdPrice",101),0.0001),g=Math.max(Et(u,"minLiquidationPriceDistanceBps",1000),0),c=Math.max(Et(u,"externalPayoff",1000),0),_=Math.max(Et(u,"oracleReportLiquidity",4000),0),l=Math.max(Et(u,"honestDisputeBarrierFraction",0.01),0),d=Math.max(Et(u,"censorshipDuration",24),0),w=Math.max(Et(u,"targetGriefRatio",1),0),M=CM({censorshipDuration:d,externalPayoff:c,honestDisputeBarrierFraction:l,honestPrice:h,liquidationThresholdPrice:b,manipulatedPrice:x,minLiquidationPriceDistanceBps:g,oracleReportLiquidity:_,targetGriefRatio:w}),H=M.censorshipRate*_,q=Math.max(168,d),$=Array.from({length:q+1},(J,Q)=>({cost:Q*H,duration:Q})),E=M.censorshipCost,P=[{label:"Conditional attacker payoff",value:M.attackerProfit},{label:"Target payoff + grief cost",value:M.griefTarget}];return lr({ariaDescription:`${t.ariaDescription}. Liquidation is ${M.liquidationExecutable?"executable":"not executable"}, so attacker payoff is ${M.attackerProfit.toFixed(2)} ETH. At ${d.toFixed(0)} steps, censorship costs ${E.toFixed(2)} ETH; the payoff-plus-grief target is ${M.griefTarget.toFixed(2)} ETH.`,ariaLabel:"Interactive censorship cost and attacker payoff",height:t.height,marginBottom:48,marginLeft:72,marginRight:24,marginTop:18,marks:[Af($,{fill:"var(--gold-soft, #f3e4c6)",x:"duration",y:"cost"}),df($,{stroke:"var(--gold, #8a5d18)",strokeWidth:3,x:"duration",y:"cost"}),lf(P,{stroke:(J,Q)=>Q===0?"var(--red, #99453f)":"var(--green, #1d735d)",strokeDasharray:"5,4",strokeWidth:2,y:"value"}),x0([d],{stroke:"var(--blue, #245f9f)",strokeDasharray:"5,4"}),Wt([{label:"attacker payoff",value:M.attackerProfit}],{dy:-6,fill:"var(--red, #99453f)",fontSize:11,text:"label",textAnchor:"start",x:q*0.63,y:"value"}),Wt([{label:"payoff + grief target",value:M.griefTarget}],{dy:-20,fill:"var(--green, #1d735d)",fontSize:11,text:"label",textAnchor:"start",x:q*0.63,y:"value"}),Ku([{cost:E,duration:d}],{fill:E>=M.griefTarget?"var(--green, #1d735d)":"var(--red, #99453f)",r:6,tip:!0,title:`Selected: ${d.toFixed(0)} steps, ${E.toFixed(2)} ETH`,x:"duration",y:"cost"})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,q],grid:!0,label:f.x},y:{grid:!0,label:f.y}})}function nC(t,r){let f=O0["plot-statoblast-whitepaper-7"],u=r.closest("#escalation-deposit-example"),h=Et(u,"depositLifecycle",0)===1,x=h?Et(u,"invalidBalance",1):0,b=h?Et(u,"yesBalance",9):0,g=h?Et(u,"noBalance",7):0,c=KM({invalidBalance:x,noBalance:g,nonDecisionThreshold:Et(u,"nonDecisionThreshold",10),proposedDeposit:Et(u,"proposedDeposit",5),repeatDeposit:h,startBond:Et(u,"startBond",2),yesBalance:b}),_=[{balance:x,phase:"Before",side:"Invalid"},{balance:b,phase:"Before",side:"Yes"},{balance:g,phase:"Before",side:"No"},{balance:x,phase:"After",side:"Invalid"},{balance:b,phase:"After",side:"Yes"},{balance:c.noAfter,phase:"After",side:"No"}],l=c.tieAdjusted?hc(c.acceptedAtomic):c.accepted.toFixed(6),d=c.tieAdjusted?hc(c.noAfterAtomic):c.noAfter.toFixed(6),w=lr({ariaDescription:`${t.ariaDescription}. This is a ${h?"repeat deposit into an existing game":"first deposit that creates the game"} with an effective start bond of ${hc(c.effectiveStartBondAtomic)} REP. The proposed No deposit ${c.previewReverts?"reverts":`accepts ${l} REP`}; No ends at ${d} REP against a ${c.threshold.toFixed(2)} REP threshold.`,ariaLabel:t.ariaLabel,color:{domain:["Invalid","Yes","No"],range:["var(--red, #99453f)","var(--green, #1d735d)","var(--blue, #245f9f)"]},fx:{domain:["Before","After"],label:null},height:t.height,marginBottom:42,marginLeft:58,marginRight:24,marginTop:28,marks:[A8(_,{fill:"side",fx:"phase",inset:2,x:"balance",y:"side"}),x0([c.threshold],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,Math.max(c.threshold,..._.map((M)=>M.balance),1)],grid:!0,label:f.x},y:{domain:["Invalid","Yes","No"],label:f.y}});return w.dataset.chartState=c.previewReverts?"reverts":"accepted",w}function XC(t,r){let f=O0["plot-statoblast-whitepaper-8"],u=r.closest("#resolution-edge-example"),h=Et(u,"invalidBalance",4),x=Et(u,"yesBalance",6),b=Et(u,"noBalance",7),g=Et(u,"runningCost",5),c=WM({invalidBalance:h,noBalance:b,runningCost:g,yesBalance:x}),_=[{balance:h,side:"Invalid"},{balance:x,side:"Yes"},{balance:b,side:"No"}],l=lr({ariaDescription:`${t.ariaDescription}. ${c.atCost} outcomes meet the ${g.toFixed(2)} REP running cost, so the helper returns ${c.result}.`,ariaLabel:t.ariaLabel,color:{domain:["Invalid","Yes","No"],range:["var(--red, #99453f)","var(--green, #1d735d)","var(--blue, #245f9f)"]},height:t.height,marginBottom:42,marginLeft:58,marginRight:24,marginTop:22,marks:[A8(_,{fill:"side",inset:3,x:"balance",y:"side"}),x0([g],{stroke:"var(--gold, #8a5d18)",strokeDasharray:"5,4",strokeWidth:2})],style:{background:"transparent",color:"var(--ink, currentColor)"},width:t.width,x:{domain:[0,Math.max(g,..._.map((d)=>d.balance),1)],grid:!0,label:f.x},y:{domain:["Invalid","Yes","No"],label:f.y}});return l.dataset.chartState=c.result.toLowerCase(),l}function vC(t,r,f){if(t==="fig-statoblast-escalation-cost-curve")return NC(r);if(t==="fig-zoltar-fork-threshold-decay")return TC(r);if(t==="fig-statoblast-retention-utilization")return FC(r);if(t==="fig-liquidation-health-curve")return LC(r,f);if(t==="fig-contract-interaction-map")return GC(r);if(t==="fig-complete-contract-atlas")return RC(r,s8(f.dataset.contractAtlasView));if(t==="fig-auction-clearing-ladder")return OC(r,f);if(t==="plot-open-oracle-integration-2")return IC(r,f);if(t==="plot-statoblast-whitepaper-7")return nC(r,f);if(t==="plot-statoblast-whitepaper-8")return XC(r,f);if(t==="plot-statoblast-whitepaper-19")return sC(r,f);return VC(r)}function xc(t){let r=t.dataset.plotChart;if(r===void 0)throw Error("Plot mount is missing data-plot-chart");let f=UC[r];if(f===void 0)throw Error(`Plot chart specification is missing for ${r}`);let u=vC(r,f,t);if(!(u instanceof SVGSVGElement))throw Error(`Plot chart ${r} did not produce an SVG root`);if(u.dataset.plotGenerated="true",u.setAttribute("role","img"),!u.hasAttribute("viewBox"))u.setAttribute("viewBox",`0 0 ${f.width} ${f.height}`);let h=t.closest(".diagram-scroll, figure.diagram, .example-visual");if(h===null)throw Error(`Plot chart ${r} is missing a scrollable figure or example envelope`);h.tabIndex=0,h.setAttribute("aria-label",`Scrollable figure: ${f.ariaLabel}`),t.removeAttribute("aria-label"),t.removeAttribute("role"),t.replaceChildren(u),t.classList.add("plot-chart-ready")}function XM(t,r){for(let h of Array.from(t.querySelectorAll("[data-contract-atlas-view]"))){let x=s8(h.dataset.contractAtlasView);h.setAttribute("aria-pressed",String(x.id===r.id))}let f=t.querySelector("[data-contract-atlas-status]");if(f===null)throw Error("Contract atlas controls are missing their live status");let u=O4(r).length;f.textContent=`${r.label}: ${u} of ${O8.length} routes. ${r.description}`}function YC(){let t=document.querySelector("[data-contract-atlas-controls]"),r=document.querySelector('[data-plot-chart="fig-complete-contract-atlas"]');if(t===null||r===null)return;let f=s8(r.dataset.contractAtlasView);r.dataset.contractAtlasView=f.id;for(let u of fc){let h=t.querySelector(`[data-contract-atlas-view-count="${u.id}"]`);if(h===null)throw Error(`Contract atlas controls are missing the ${u.id} route count`);h.textContent=`${O4(u).length} routes`}for(let u of Array.from(t.querySelectorAll("[data-contract-atlas-view]"))){let h=s8(u.dataset.contractAtlasView);u.addEventListener("click",()=>{r.dataset.contractAtlasView=h.id,xc(r),XM(t,h)})}XM(t,f),t.hidden=!1}var SC=Array.from(document.querySelectorAll("[data-plot-chart]"));for(let t of SC)xc(t);YC();DC();AC();for(let t of["fig-auction-clearing-ladder","fig-liquidation-health-curve","plot-open-oracle-integration-2","plot-statoblast-whitepaper-7","plot-statoblast-whitepaper-8","plot-statoblast-whitepaper-19"]){let r=document.querySelector(`[data-plot-chart="${t}"]`),f=t==="fig-auction-clearing-ladder"?document.querySelector("#simple-auction-example"):r?.closest(".interactive-example"),u=t==="fig-liquidation-health-curve"?"[data-liquidation-input]":"[data-example-input]";for(let h of Array.from(f?.querySelectorAll(u)??[]))h.addEventListener("input",()=>{if(r!==null&&r!==void 0)xc(r)})} diff --git a/docs/charts/chartRuntime.ts b/docs/charts/chartRuntime.ts index 199783bd5..42c810509 100644 --- a/docs/charts/chartRuntime.ts +++ b/docs/charts/chartRuntime.ts @@ -1,4 +1,4 @@ -import { areaY, barX, dot, line, lineY, plot, rect, ruleX, ruleY, text } from '@observablehq/plot' +import { areaY, barX, dot, line, lineY, link, plot, rect, ruleX, ruleY, text } from '@observablehq/plot' import { calculateAnnualizedRetentionFeePercent, calculateAuctionModel, @@ -14,6 +14,25 @@ import { parseLiquidationMultiplierBps, quantitativeChartAxisLabels, } from './chartModels' +import { + contractAtlasEdges, + contractAtlasInventoryRows, + contractAtlasNodes, + contractAtlasPanelLabels, + contractAtlasPlotRouteMeaning, + contractAtlasPlotRoutes, + contractAtlasPlotRoutesForView, + contractAtlasRelationLabels, + contractAtlasRelationshipRows, + contractAtlasTestGatewayByTargetId, + contractAtlasTestGatewayDefinitions, + contractAtlasViewDefinition, + contractAtlasViewDefinitions, + type ContractAtlasKind, + type ContractAtlasPanel, + type ContractAtlasRelation, + type ContractAtlasViewDefinition, +} from './contractAtlas' declare function require(path: './diagramSpecs.json'): unknown @@ -956,6 +975,410 @@ function contractInteractionChart(spec: ChartSpec): SVGSVGElement { }) as SVGSVGElement } +type ContractAtlasChartNode = { + column: number + id: string + isGateway: boolean + kind: ContractAtlasKind | 'gateway' + label: string + order: number + panel: ContractAtlasPanel + source: string + x1: number + x2: number + y1: number + y2: number +} + +type ContractAtlasChartEdge = { + id: string + meaning: string + orientation: 'horizontal' | 'vertical' + relationStyle: ContractAtlasRelation | 'multiple' + sourceNodeId: string + sourceLabel: string + targetNodeId: string + targetLabel: string + x1: number + x2: number + y1: number + y2: number +} + +function contractAtlasDisplayLabel(label: string): string { + if (label.includes('\n') || label.length <= 24) return label + const words = label.replaceAll(/([a-z0-9])([A-Z])/g, '$1 $2').split(' ') + const lines: string[] = [] + for (const word of words) { + const currentLine = lines[lines.length - 1] + if (currentLine === undefined || currentLine.length + word.length + 1 > 22) { + lines.push(word) + } else { + lines[lines.length - 1] = `${currentLine} ${word}` + } + } + return lines.join('\n') +} + +type ContractAtlasPortAssignment = { + axis: 'x1' | 'x2' | 'y1' | 'y2' + edge: ContractAtlasChartEdge + node: ContractAtlasChartNode +} + +function contractAtlasOtherPortCoordinate(assignment: ContractAtlasPortAssignment): number { + if (assignment.axis === 'x1') return assignment.edge.x2 + if (assignment.axis === 'x2') return assignment.edge.x1 + if (assignment.axis === 'y1') return assignment.edge.y2 + return assignment.edge.y1 +} + +function spreadContractAtlasPorts(edges: ContractAtlasChartEdge[], nodeById: Map): void { + const assignmentsBySide = new Map() + function addAssignment(key: string, assignment: ContractAtlasPortAssignment): void { + const assignments = assignmentsBySide.get(key) + if (assignments === undefined) { + assignmentsBySide.set(key, [assignment]) + } else { + assignments.push(assignment) + } + } + for (const edge of edges) { + const sourceNode = nodeById.get(edge.sourceNodeId) + const targetNode = nodeById.get(edge.targetNodeId) + if (sourceNode === undefined || targetNode === undefined) { + throw new Error(`Contract atlas route ${edge.id} cannot spread ports for a missing node`) + } + if (edge.orientation === 'horizontal') { + const sourceSide = edge.x1 === sourceNode.x1 ? 'left' : 'right' + const targetSide = edge.x2 === targetNode.x1 ? 'left' : 'right' + addAssignment(`${sourceNode.id}:horizontal:${sourceSide}`, { axis: 'y1', edge, node: sourceNode }) + addAssignment(`${targetNode.id}:horizontal:${targetSide}`, { axis: 'y2', edge, node: targetNode }) + } else { + const sourceSide = edge.y1 === sourceNode.y1 ? 'top' : 'bottom' + const targetSide = edge.y2 === targetNode.y1 ? 'top' : 'bottom' + addAssignment(`${sourceNode.id}:vertical:${sourceSide}`, { axis: 'x1', edge, node: sourceNode }) + addAssignment(`${targetNode.id}:vertical:${targetSide}`, { axis: 'x2', edge, node: targetNode }) + } + } + for (const assignments of assignmentsBySide.values()) { + if (assignments.length < 2) continue + assignments.sort((left, right) => contractAtlasOtherPortCoordinate(left) - contractAtlasOtherPortCoordinate(right) || left.edge.id.localeCompare(right.edge.id)) + const firstAssignment = assignments[0] + if (firstAssignment === undefined) continue + const horizontalSide = firstAssignment.axis === 'y1' || firstAssignment.axis === 'y2' + const sideStart = horizontalSide ? firstAssignment.node.y1 : firstAssignment.node.x1 + const sideEnd = horizontalSide ? firstAssignment.node.y2 : firstAssignment.node.x2 + const inset = (sideEnd - sideStart) * 0.16 + const usableStart = sideStart + inset + const step = (sideEnd - sideStart - inset * 2) / (assignments.length - 1) + for (const [index, assignment] of assignments.entries()) { + assignment.edge[assignment.axis] = usableStart + index * step + } + } +} + +function contractAtlasChart(spec: ChartSpec, view: ContractAtlasViewDefinition): SVGSVGElement { + const panelDefinitions: { fill: string; id: ContractAtlasPanel; subtitle: string; title: string }[] = [ + { + fill: 'var(--blue-soft, #dceaf8)', + id: 'zoltar', + subtitle: 'Questions, universes, REP, and their token foundations', + title: contractAtlasPanelLabels.zoltar, + }, + { + fill: 'var(--gold-soft, #f3e4c6)', + id: 'statoblast-deployment', + subtitle: 'Factory, CREATE2 deployer, worker, and component factories', + title: contractAtlasPanelLabels['statoblast-deployment'], + }, + { + fill: 'var(--green-soft, #dcefe8)', + id: 'statoblast-runtime', + subtitle: 'Pools, claims, resolution, oracle pricing, forks, and backing repair', + title: contractAtlasPanelLabels['statoblast-runtime'], + }, + { + fill: 'var(--paper, #fff)', + id: 'statoblast-implementation', + subtitle: 'Inheritance stacks, delegate-compatible storage, interfaces, and type modules', + title: contractAtlasPanelLabels['statoblast-implementation'], + }, + { + fill: 'var(--soft, #edf3f5)', + id: 'infrastructure', + subtitle: 'Deployment helpers, compatibility contracts, imported OpenOracle, and vendored dependencies', + title: contractAtlasPanelLabels.infrastructure, + }, + { + fill: 'var(--red-soft, #f2d9d6)', + id: 'tests', + subtitle: 'Every test-only Solidity declaration; production targets are repeated as gateway groups', + title: contractAtlasPanelLabels.tests, + }, + ] + const panelGap = 0.45 + const panelHeaderHeight = 1.12 + const rowStep = 0.82 + const nodeHeight = 0.62 + const nodeWidth = 2.62 + const columnStep = 3 + const panelX1 = 0.1 + const panelX2 = 18.35 + let nextPanelY = 0.1 + const panels = panelDefinitions.map(definition => { + const panelNodes = contractAtlasNodes.filter(node => node.panel === definition.id) + const rowCount = Math.max(...panelNodes.map(node => node.order + 1), 1) + const declarationCount = panelNodes.filter(node => node.declaration !== undefined).length + const moduleCount = panelNodes.length - declarationCount + const y1 = nextPanelY + const y2 = y1 + panelHeaderHeight + rowCount * rowStep + 0.48 + nextPanelY = y2 + panelGap + return { + ...definition, + countLabel: `${declarationCount} declaration${declarationCount === 1 ? '' : 's'}${moduleCount === 0 ? '' : ` + ${moduleCount} type module${moduleCount === 1 ? '' : 's'}`}`, + x1: panelX1, + x2: panelX2, + y1, + y2, + } + }) + const panelById = new Map(panels.map(panel => [panel.id, panel])) + const positionedNodes: ContractAtlasChartNode[] = contractAtlasNodes.map(node => { + const panel = panelById.get(node.panel) + if (panel === undefined) throw new Error(`Contract atlas node ${node.id} has no panel`) + const x1 = 0.48 + node.column * columnStep + const y1 = panel.y1 + panelHeaderHeight + node.order * rowStep + return { + ...node, + isGateway: false, + x1, + x2: x1 + nodeWidth, + y1, + y2: y1 + nodeHeight, + } + }) + const testPanel = panelById.get('tests') + if (testPanel === undefined) throw new Error('Contract atlas is missing its test-only panel') + const testGatewayNodes: ContractAtlasChartNode[] = contractAtlasTestGatewayDefinitions.map(node => { + const x1 = 0.48 + 5 * columnStep + const y1 = testPanel.y1 + panelHeaderHeight + node.order * rowStep + return { + ...node, + column: 5, + isGateway: true, + kind: 'gateway', + panel: 'tests', + source: 'Repeated production boundary', + x1, + x2: x1 + nodeWidth, + y1, + y2: y1 + nodeHeight, + } + }) + positionedNodes.push(...testGatewayNodes) + const positionedNodeById = new Map(positionedNodes.map(node => [node.id, node])) + + function testGatewayForTarget(targetId: string): string { + const gatewayId = contractAtlasTestGatewayByTargetId.get(targetId) + if (gatewayId === undefined) throw new Error(`Contract atlas test target ${targetId} has no explicit gateway classification`) + return gatewayId + } + + const positionedEdges: ContractAtlasChartEdge[] = contractAtlasPlotRoutesForView(view).map(route => { + const sourceNode = positionedNodeById.get(route.source) + const registryTargetNode = positionedNodeById.get(route.target) + if (sourceNode === undefined || registryTargetNode === undefined) { + throw new Error(`Contract atlas plot route ${route.id} has a missing source or target`) + } + const onlyEdge = route.edges.length === 1 ? route.edges[0] : undefined + if (route.edges.length === 0) throw new Error(`Contract atlas plot route ${route.id} has no relationships`) + const routedTargetId = sourceNode.panel === 'tests' && registryTargetNode.panel !== 'tests' ? testGatewayForTarget(registryTargetNode.id) : registryTargetNode.id + const targetNode = positionedNodeById.get(routedTargetId) + if (targetNode === undefined) throw new Error(`Contract atlas plot route ${route.id} has no routed target`) + const relationStyle: ContractAtlasRelation | 'multiple' = onlyEdge?.relation ?? 'multiple' + const routeFields = { + id: route.id, + meaning: contractAtlasPlotRouteMeaning(route), + relationStyle, + sourceNodeId: sourceNode.id, + sourceLabel: sourceNode.label.replaceAll('\n', ' '), + targetNodeId: targetNode.id, + targetLabel: registryTargetNode.label.replaceAll('\n', ' '), + } + const samePanel = sourceNode.panel === targetNode.panel + const horizontallySeparated = sourceNode.x2 < targetNode.x1 || targetNode.x2 < sourceNode.x1 + if (samePanel && horizontallySeparated) { + const pointsRight = sourceNode.x1 < targetNode.x1 + return { + ...routeFields, + orientation: 'horizontal', + x1: pointsRight ? sourceNode.x2 : sourceNode.x1, + x2: pointsRight ? targetNode.x1 : targetNode.x2, + y1: (sourceNode.y1 + sourceNode.y2) / 2, + y2: (targetNode.y1 + targetNode.y2) / 2, + } + } + const pointsDown = sourceNode.y1 < targetNode.y1 + return { + ...routeFields, + orientation: 'vertical', + x1: (sourceNode.x1 + sourceNode.x2) / 2, + x2: (targetNode.x1 + targetNode.x2) / 2, + y1: pointsDown ? sourceNode.y2 : sourceNode.y1, + y2: pointsDown ? targetNode.y1 : targetNode.y2, + } + }) + spreadContractAtlasPorts(positionedEdges, positionedNodeById) + const denseView = view.id === 'all' + const relationStyles: Record = { + assets: { dash: '14,4', opacity: denseView ? 0.48 : 0.76, stroke: 'var(--green, #1d735d)', width: 2.2 }, + calls: { opacity: denseView ? 0.4 : 0.62, stroke: 'var(--blue, #245f9f)', width: 1.8 }, + compatible: { dash: '3,3', opacity: denseView ? 0.22 : 0.56, stroke: 'var(--blue, #245f9f)', width: 1.5 }, + delegatecall: { dash: '4,3', opacity: denseView ? 0.56 : 0.8, stroke: 'var(--red, #99453f)', width: 2.2 }, + deploys: { dash: '2,3,10,3', opacity: denseView ? 0.5 : 0.74, stroke: 'var(--gold, #8a5d18)', width: 2.1 }, + implements: { dash: '3,3', opacity: denseView ? 0.22 : 0.56, stroke: 'var(--blue, #245f9f)', width: 1.5 }, + inherits: { dash: '7,3', opacity: denseView ? 0.24 : 0.62, stroke: 'var(--muted, #5f6d75)', width: 1.6 }, + multiple: { dash: '9,3,2,3', opacity: 0.78, stroke: 'var(--ink, #1f2529)', width: 2.5 }, + references: { dash: '2,5', opacity: denseView ? 0.12 : 0.34, stroke: 'var(--muted, #5f6d75)', width: 1.1 }, + tests: { dash: '2,4', opacity: denseView ? 0.24 : 0.56, stroke: 'var(--red, #99453f)', width: 1.4 }, + uses: { dash: '5,4', opacity: denseView ? 0.2 : 0.5, stroke: 'var(--muted, #5f6d75)', width: 1.3 }, + } + const relationOrder: (ContractAtlasRelation | 'multiple')[] = ['references', 'uses', 'inherits', 'implements', 'compatible', 'tests', 'calls', 'deploys', 'assets', 'delegatecall', 'multiple'] + const edgeMarks = relationOrder.flatMap(relation => + (['horizontal', 'vertical'] as const).map(orientation => { + const style = relationStyles[relation] + return link( + positionedEdges.filter(edge => edge.relationStyle === relation && edge.orientation === orientation), + { + curve: orientation === 'horizontal' ? 'bump-x' : 'bump-y', + markerEnd: 'arrow', + stroke: style.stroke, + ...(style.dash === undefined ? {} : { strokeDasharray: style.dash }), + strokeOpacity: style.opacity, + strokeWidth: style.width, + title: (edge: ContractAtlasChartEdge) => `${edge.sourceLabel} → ${edge.targetLabel}\n${edge.meaning}`, + x1: 'x1', + x2: 'x2', + y1: 'y1', + y2: 'y2', + }, + ) + }), + ) + const nodeStyles: Record = { + abstract: { dash: '6,3', fill: 'var(--soft, #edf3f5)', stroke: 'var(--muted, #5f6d75)' }, + contract: { fill: 'var(--paper, #fff)', stroke: 'var(--ink, #1f2529)' }, + gateway: { dash: '3,3', fill: 'var(--paper, #fff)', stroke: 'var(--red, #99453f)' }, + interface: { dash: '3,3', fill: 'var(--blue-soft, #dceaf8)', stroke: 'var(--blue, #245f9f)' }, + library: { fill: 'var(--gold-soft, #f3e4c6)', stroke: 'var(--gold, #8a5d18)' }, + module: { dash: '2,3', fill: 'var(--green-soft, #dcefe8)', stroke: 'var(--green, #1d735d)' }, + } + const nodeMarks = (Object.keys(nodeStyles) as ContractAtlasChartNode['kind'][]).map(kind => { + const style = nodeStyles[kind] + return rect( + positionedNodes.filter(node => node.kind === kind), + { + fill: style.fill, + rx: 7, + stroke: style.stroke, + ...(style.dash === undefined ? {} : { strokeDasharray: style.dash }), + strokeWidth: 1.35, + title: node => `${node.label.replaceAll('\n', ' ')}\n${node.isGateway ? 'repeated target group' : node.kind}\n${node.source}`, + x1: 'x1', + x2: 'x2', + y1: 'y1', + y2: 'y2', + }, + ) + }) + const panelTitles = panels.map(panel => ({ label: `${panel.title} · ${panel.countLabel}`, x: panel.x1 + 0.3, y: panel.y1 + 0.34 })) + const panelSubtitles = panels.map(panel => ({ label: panel.subtitle, x: panel.x1 + 0.3, y: panel.y1 + 0.7 })) + const chart = plot({ + ariaDescription: `${spec.ariaDescription} The current ${view.label} layer shows ${positionedEdges.length} of ${contractAtlasPlotRoutes.length} routes. ${view.description}`, + ariaLabel: `${spec.ariaLabel}: ${view.label}`, + height: spec.height, + margin: 18, + marks: [ + rect(panels, { fill: 'fill', fillOpacity: 0.28, rx: 14, stroke: 'var(--line, #d8e0e4)', strokeWidth: 1.5, x1: 'x1', x2: 'x2', y1: 'y1', y2: 'y2' }), + text(panelTitles, { fill: 'var(--ink, #1f2529)', fontSize: 15, fontWeight: 780, text: 'label', textAnchor: 'start', x: 'x', y: 'y' }), + text(panelSubtitles, { fill: 'var(--muted, #5f6d75)', fontSize: 10.5, text: 'label', textAnchor: 'start', x: 'x', y: 'y' }), + ...edgeMarks, + ...nodeMarks, + text(positionedNodes, { + fill: 'var(--ink, #1f2529)', + fontSize: 9.6, + fontWeight: 700, + lineHeight: 1.05, + lineWidth: 25, + text: node => contractAtlasDisplayLabel(node.label), + x: node => (node.x1 + node.x2) / 2, + y: node => (node.y1 + node.y2) / 2, + }), + ], + style: { background: 'transparent', color: 'var(--ink, currentColor)' }, + width: spec.width, + x: { axis: null, domain: [0, 18.45] }, + y: { axis: null, domain: [nextPanelY - panelGap + 0.1, 0] }, + }) as SVGSVGElement + chart.dataset['atlasView'] = view.id + chart.dataset['chartState'] = `${contractAtlasNodes.length}-components-${contractAtlasEdges.length}-relationships` + chart.dataset['plotRouteCount'] = String(contractAtlasPlotRoutes.length) + chart.dataset['visibleRouteCount'] = String(positionedEdges.length) + return chart +} + +function appendContractAtlasCell(row: HTMLTableRowElement, value: string, code = false): void { + const cell = document.createElement('td') + if (code) { + const codeElement = document.createElement('code') + codeElement.textContent = value + cell.append(codeElement) + } else { + cell.textContent = value + } + row.append(cell) +} + +function renderContractAtlasInventoryTable(): void { + const tableBody = document.querySelector('[data-contract-atlas-node-table]') + if (tableBody === null) return + const kindLabels: Record = { + abstract: 'abstract contract', + contract: 'contract', + interface: 'interface', + library: 'library', + module: 'type module', + } + const rows = contractAtlasInventoryRows.map(({ node, panelLabel }) => { + const row = document.createElement('tr') + row.dataset['componentId'] = node.id + appendContractAtlasCell(row, node.label.replaceAll('\n', ' '), true) + appendContractAtlasCell(row, kindLabels[node.kind]) + appendContractAtlasCell(row, panelLabel) + appendContractAtlasCell(row, node.source, true) + return row + }) + tableBody.replaceChildren(...rows) + tableBody.dataset['componentCount'] = String(rows.length) +} + +function renderContractAtlasTable(): void { + const tableBody = document.querySelector('[data-contract-atlas-table]') + if (tableBody === null) return + const rows = contractAtlasRelationshipRows.map(({ edge, source, target }) => { + const row = document.createElement('tr') + row.dataset['relationshipId'] = edge.id + appendContractAtlasCell(row, source.label, true) + appendContractAtlasCell(row, target.label, true) + appendContractAtlasCell(row, contractAtlasRelationLabels[edge.relation]) + appendContractAtlasCell(row, edge.description) + return row + }) + tableBody.replaceChildren(...rows) + tableBody.dataset['relationshipCount'] = String(rows.length) +} + function auctionDemandChart(spec: ChartSpec, mount: HTMLElement): SVGSVGElement { const axes = quantitativeChartAxisLabels['fig-auction-clearing-ladder'] const example = document.querySelector('#simple-auction-example') @@ -1332,6 +1755,9 @@ function createChart(chartId: string, spec: ChartSpec, mount: HTMLElement): SVGS if (chartId === 'fig-contract-interaction-map') { return contractInteractionChart(spec) } + if (chartId === 'fig-complete-contract-atlas') { + return contractAtlasChart(spec, contractAtlasViewDefinition(mount.dataset['contractAtlasView'])) + } if (chartId === 'fig-auction-clearing-ladder') { return auctionDemandChart(spec, mount) } @@ -1368,7 +1794,7 @@ function renderMount(mount: HTMLElement): void { if (!chart.hasAttribute('viewBox')) { chart.setAttribute('viewBox', `0 0 ${spec.width} ${spec.height}`) } - const overflowEnvelope = mount.closest('figure.diagram, .example-visual') + const overflowEnvelope = mount.closest('.diagram-scroll, figure.diagram, .example-visual') if (overflowEnvelope === null) { throw new Error(`Plot chart ${chartId} is missing a scrollable figure or example envelope`) } @@ -1380,10 +1806,47 @@ function renderMount(mount: HTMLElement): void { mount.classList.add('plot-chart-ready') } +function updateContractAtlasControls(controls: HTMLElement, view: ContractAtlasViewDefinition): void { + for (const button of Array.from(controls.querySelectorAll('[data-contract-atlas-view]'))) { + const buttonView = contractAtlasViewDefinition(button.dataset['contractAtlasView']) + button.setAttribute('aria-pressed', String(buttonView.id === view.id)) + } + const status = controls.querySelector('[data-contract-atlas-status]') + if (status === null) throw new Error('Contract atlas controls are missing their live status') + const visibleRouteCount = contractAtlasPlotRoutesForView(view).length + status.textContent = `${view.label}: ${visibleRouteCount} of ${contractAtlasPlotRoutes.length} routes. ${view.description}` +} + +function setupContractAtlasControls(): void { + const controls = document.querySelector('[data-contract-atlas-controls]') + const mount = document.querySelector('[data-plot-chart="fig-complete-contract-atlas"]') + if (controls === null || mount === null) return + const initialView = contractAtlasViewDefinition(mount.dataset['contractAtlasView']) + mount.dataset['contractAtlasView'] = initialView.id + for (const definition of contractAtlasViewDefinitions) { + const count = controls.querySelector(`[data-contract-atlas-view-count="${definition.id}"]`) + if (count === null) throw new Error(`Contract atlas controls are missing the ${definition.id} route count`) + count.textContent = `${contractAtlasPlotRoutesForView(definition).length} routes` + } + for (const button of Array.from(controls.querySelectorAll('[data-contract-atlas-view]'))) { + const buttonView = contractAtlasViewDefinition(button.dataset['contractAtlasView']) + button.addEventListener('click', () => { + mount.dataset['contractAtlasView'] = buttonView.id + renderMount(mount) + updateContractAtlasControls(controls, buttonView) + }) + } + updateContractAtlasControls(controls, initialView) + controls.hidden = false +} + const mounts = Array.from(document.querySelectorAll('[data-plot-chart]')) for (const mount of mounts) { renderMount(mount) } +setupContractAtlasControls() +renderContractAtlasInventoryTable() +renderContractAtlasTable() for (const chartId of ['fig-auction-clearing-ladder', 'fig-liquidation-health-curve', 'plot-open-oracle-integration-2', 'plot-statoblast-whitepaper-7', 'plot-statoblast-whitepaper-8', 'plot-statoblast-whitepaper-19']) { const mount = document.querySelector(`[data-plot-chart="${chartId}"]`) diff --git a/docs/charts/contractAtlas.ts b/docs/charts/contractAtlas.ts new file mode 100644 index 000000000..2f64eeda2 --- /dev/null +++ b/docs/charts/contractAtlas.ts @@ -0,0 +1,586 @@ +import { contractAtlasBehavioralReferences, contractAtlasBehavioralRelationIsCovered } from './contractAtlasBehavioralReferences' +import { contractAtlasSourceReferences } from './contractAtlasSourceReferences' + +export type ContractAtlasKind = 'abstract' | 'contract' | 'interface' | 'library' | 'module' + +export type ContractAtlasPanel = 'infrastructure' | 'statoblast-deployment' | 'statoblast-implementation' | 'statoblast-runtime' | 'tests' | 'zoltar' + +export type ContractAtlasRelation = 'assets' | 'calls' | 'compatible' | 'delegatecall' | 'deploys' | 'implements' | 'inherits' | 'references' | 'tests' | 'uses' + +export type ContractAtlasView = 'all' | 'protocol' | 'references' | 'structure' | 'tests' + +export type ContractAtlasNode = { + column: number + declaration?: string + id: string + kind: ContractAtlasKind + label: string + order: number + panel: ContractAtlasPanel + source: string +} + +export type ContractAtlasEdge = { + description: string + id: string + relation: ContractAtlasRelation + source: string + target: string +} + +export type ContractAtlasPlotRoute = { + edges: ContractAtlasEdge[] + id: string + source: string + target: string +} + +export type ContractAtlasViewDefinition = { + description: string + id: ContractAtlasView + label: string + relations: ContractAtlasRelation[] +} + +export type ContractAtlasTestGatewayId = 'test-gateway-escalation' | 'test-gateway-forker' | 'test-gateway-infra' | 'test-gateway-openoracle' | 'test-gateway-pool' | 'test-gateway-token' | 'test-gateway-zoltar' + +export type ContractAtlasTestGatewayDefinition = { + id: ContractAtlasTestGatewayId + label: string + order: number +} + +function node(id: string, label: string, kind: ContractAtlasKind, panel: ContractAtlasPanel, column: number, order: number, source: string, declaration = label): ContractAtlasNode { + return { + column, + ...(kind === 'module' ? {} : { declaration }), + id, + kind, + label, + order, + panel, + source, + } +} + +function edge(id: string, source: string, target: string, relation: ContractAtlasRelation, description: string): ContractAtlasEdge { + return { description, id, relation, source, target } +} + +type ContractAtlasSourceDerivedRelation = Extract + +const sourceDerivedRelationVerbs: Record = { + delegatecall: 'Delegatecalls', + deploys: 'Deploys', + implements: 'Implements', + inherits: 'Directly inherits', +} + +function sourceDerivedEdge(id: string, source: string, target: string, relation: ContractAtlasSourceDerivedRelation): ContractAtlasEdge { + const targetNode = contractAtlasNodes.find(atlasNode => atlasNode.id === target) + if (targetNode === undefined) throw new Error(`Source-derived contract atlas edge ${id} has missing target ${target}`) + const description = `${sourceDerivedRelationVerbs[relation]} ${targetNode.label}.` + return edge(id, source, target, relation, description) +} + +export const contractAtlasRelationLabels: Record = { + assets: 'asset-bearing call', + calls: 'runtime call', + compatible: 'structural compatibility', + delegatecall: 'delegatecall', + deploys: 'deployment', + implements: 'implements', + inherits: 'inherits', + references: 'direct source reference', + tests: 'test-only exercise', + uses: 'library or type use', +} + +export const contractAtlasPanelLabels: Record = { + infrastructure: 'Infrastructure & external boundary', + 'statoblast-deployment': 'Statoblast — deployment', + 'statoblast-implementation': 'Statoblast — implementation boundaries', + 'statoblast-runtime': 'Statoblast — deployed runtime', + tests: 'Test-only contracts', + zoltar: 'Zoltar', +} + +export const contractAtlasTestGatewayDefinitions: ContractAtlasTestGatewayDefinition[] = [ + { id: 'test-gateway-zoltar', label: 'Production target:\nZoltar & token helpers', order: 0 }, + { id: 'test-gateway-token', label: 'Production target:\nTokens, shares & outcomes', order: 1 }, + { id: 'test-gateway-escalation', label: 'Production target:\nEscalation & proofs', order: 2 }, + { id: 'test-gateway-forker', label: 'Production target:\nFork & migration', order: 3 }, + { id: 'test-gateway-pool', label: 'Production target:\nPool, factory & auction', order: 4 }, + { id: 'test-gateway-openoracle', label: 'Production target:\nOpenOracle', order: 5 }, + { id: 'test-gateway-infra', label: 'Production target:\nDeployment infrastructure', order: 6 }, +] + +export const contractAtlasTestGatewayByTargetId = new Map([ + ['infra-deployment-status-oracle', 'test-gateway-infra'], + ['openoracle-core', 'test-gateway-openoracle'], + ['statoblast-binary-outcomes', 'test-gateway-token'], + ['statoblast-auction-settlement-base', 'test-gateway-forker'], + ['statoblast-erc1155', 'test-gateway-token'], + ['statoblast-escalation-calculations', 'test-gateway-escalation'], + ['statoblast-escalation-game', 'test-gateway-escalation'], + ['statoblast-escalation-game-factory', 'test-gateway-escalation'], + ['statoblast-escalation-game-forker', 'test-gateway-escalation'], + ['statoblast-escalation-proof-verifier', 'test-gateway-escalation'], + ['statoblast-escalation-state', 'test-gateway-escalation'], + ['statoblast-escalation-types', 'test-gateway-escalation'], + ['statoblast-event-emitter', 'test-gateway-forker'], + ['statoblast-forker-base', 'test-gateway-forker'], + ['statoblast-forker-types', 'test-gateway-forker'], + ['statoblast-ierc1155-receiver', 'test-gateway-token'], + ['statoblast-merkle-mountain-range', 'test-gateway-escalation'], + ['statoblast-pool-forker', 'test-gateway-forker'], + ['statoblast-security-pool', 'test-gateway-pool'], + ['statoblast-security-pool-factory-interface', 'test-gateway-pool'], + ['statoblast-security-pool-interface', 'test-gateway-pool'], + ['statoblast-share-token', 'test-gateway-token'], + ['statoblast-share-token-interface', 'test-gateway-token'], + ['statoblast-token-id', 'test-gateway-token'], + ['statoblast-truth-auction', 'test-gateway-pool'], + ['zoltar-core', 'test-gateway-zoltar'], + ['zoltar-ierc20', 'test-gateway-zoltar'], + ['zoltar-reputation-token', 'test-gateway-zoltar'], + ['zoltar-safe-erc20-ops', 'test-gateway-zoltar'], + ['zoltar-scalar-outcomes', 'test-gateway-zoltar'], +]) + +export const contractAtlasNodes: ContractAtlasNode[] = [ + // Zoltar is intentionally its own region: it owns questions, universes, and REP. + node('zoltar-constants', 'Constants', 'library', 'zoltar', 0, 0, 'solidity/contracts/Constants.sol'), + node('zoltar-context', 'Context', 'abstract', 'zoltar', 0, 1, 'solidity/contracts/Context.sol'), + node('zoltar-ierc20', 'IERC20', 'interface', 'zoltar', 0, 2, 'solidity/contracts/IERC20.sol'), + node('zoltar-ierc20-metadata', 'IERC20Metadata', 'interface', 'zoltar', 0, 3, 'solidity/contracts/IERC20Metadata.sol'), + node('zoltar-safe-erc20-ops', 'SafeERC20Ops', 'library', 'zoltar', 0, 4, 'solidity/contracts/SafeERC20Ops.sol'), + node('zoltar-scalar-outcomes', 'ScalarOutcomes', 'library', 'zoltar', 0, 5, 'solidity/contracts/ScalarOutcomes.sol'), + node('zoltar-erc20', 'ERC20', 'abstract', 'zoltar', 1, 1, 'solidity/contracts/ERC20.sol'), + node('zoltar-question-data', 'ZoltarQuestionData', 'contract', 'zoltar', 1, 4, 'solidity/contracts/ZoltarQuestionData.sol'), + node('zoltar-reputation-token', 'ReputationToken', 'contract', 'zoltar', 2, 1, 'solidity/contracts/ReputationToken.sol'), + node('zoltar-core', 'Zoltar', 'contract', 'zoltar', 2, 4, 'solidity/contracts/Zoltar.sol'), + + // Statoblast deployment and construction helpers. + node('statoblast-security-pool-factory', 'SecurityPoolFactory', 'contract', 'statoblast-deployment', 0, 2, 'solidity/contracts/peripherals/factories/SecurityPoolFactory.sol'), + node('statoblast-share-token-factory', 'ShareTokenFactory', 'contract', 'statoblast-deployment', 1, 0, 'solidity/contracts/peripherals/factories/ShareTokenFactory.sol'), + node('statoblast-price-coordinator-factory', 'PriceOracleManagerAndOperatorQueuerFactory', 'contract', 'statoblast-deployment', 1, 1, 'solidity/contracts/peripherals/factories/PriceOracleManagerAndOperatorQueuerFactory.sol'), + node('statoblast-escalation-game-factory', 'EscalationGameFactory', 'contract', 'statoblast-deployment', 1, 2, 'solidity/contracts/peripherals/factories/EscalationGameFactory.sol'), + node('statoblast-auction-factory', 'UniformPriceDualCapBatchAuctionFactory', 'contract', 'statoblast-deployment', 1, 3, 'solidity/contracts/peripherals/factories/UniformPriceDualCapBatchAuctionFactory.sol'), + node('statoblast-security-pool-deployer', 'SecurityPoolDeployer', 'contract', 'statoblast-deployment', 2, 1, 'solidity/contracts/peripherals/factories/SecurityPoolDeployer.sol'), + node('statoblast-security-pool-worker', 'SecurityPoolDeploymentWorker', 'contract', 'statoblast-deployment', 3, 1, 'solidity/contracts/peripherals/factories/SecurityPoolDeployer.sol'), + + // Statoblast deployed runtime, fork, delegate, and token contracts. + node('statoblast-security-pool', 'SecurityPool', 'contract', 'statoblast-runtime', 0, 0, 'solidity/contracts/peripherals/SecurityPool.sol'), + node('statoblast-share-token', 'ShareToken', 'contract', 'statoblast-runtime', 0, 1, 'solidity/contracts/peripherals/tokens/ShareToken.sol'), + node('statoblast-price-coordinator', 'OpenOraclePriceCoordinator', 'contract', 'statoblast-runtime', 0, 2, 'solidity/contracts/peripherals/OpenOraclePriceCoordinator.sol'), + node('statoblast-escalation-game', 'EscalationGame', 'contract', 'statoblast-runtime', 0, 3, 'solidity/contracts/peripherals/EscalationGame.sol'), + node('statoblast-pool-forker', 'SecurityPoolForker', 'contract', 'statoblast-runtime', 0, 4, 'solidity/contracts/peripherals/SecurityPoolForker.sol'), + node('statoblast-truth-auction', 'UniformPriceDualCapBatchAuction', 'contract', 'statoblast-runtime', 0, 5, 'solidity/contracts/peripherals/UniformPriceDualCapBatchAuction.sol'), + node('statoblast-erc1155', 'ERC1155', 'contract', 'statoblast-runtime', 1, 0, 'solidity/contracts/peripherals/tokens/ERC1155.sol'), + node('statoblast-escalation-deposit-delegate', 'EscalationGameDepositDelegate', 'contract', 'statoblast-runtime', 1, 1, 'solidity/contracts/peripherals/EscalationGameDepositDelegate.sol'), + node('statoblast-escalation-proof-verifier', 'EscalationGameProofVerifier', 'contract', 'statoblast-runtime', 1, 2, 'solidity/contracts/peripherals/EscalationGameProofVerifier.sol'), + node('statoblast-vault-migration-delegate', 'SecurityPoolForkerVaultMigrationDelegate', 'contract', 'statoblast-runtime', 1, 3, 'solidity/contracts/peripherals/SecurityPoolForkerVaultMigrationDelegate.sol'), + node('statoblast-escalation-game-forker', 'EscalationGameForker', 'contract', 'statoblast-runtime', 1, 4, 'solidity/contracts/peripherals/EscalationGameForker.sol'), + node('statoblast-event-emitter', 'SecurityPoolEventEmitter', 'contract', 'statoblast-runtime', 2, 1, 'solidity/contracts/peripherals/SecurityPoolEventEmitter.sol'), + node('statoblast-migration-proxy', 'SecurityPoolMigrationProxy', 'contract', 'statoblast-runtime', 2, 3, 'solidity/contracts/peripherals/SecurityPoolMigrationProxy.sol'), + node('statoblast-binary-outcomes', 'BinaryOutcomes', 'library', 'statoblast-runtime', 3, 0, 'solidity/contracts/peripherals/BinaryOutcomes.sol'), + node('statoblast-merkle-mountain-range', 'MerkleMountainRange', 'library', 'statoblast-runtime', 3, 1, 'solidity/contracts/peripherals/MerkleMountainRange.sol'), + node('statoblast-security-pool-utils', 'SecurityPoolUtils', 'library', 'statoblast-runtime', 3, 2, 'solidity/contracts/peripherals/SecurityPoolUtils.sol'), + node('statoblast-token-id', 'TokenId', 'library', 'statoblast-runtime', 3, 3, 'solidity/contracts/peripherals/tokens/TokenId.sol'), + + // Statoblast inheritance stacks, type modules, and contract-facing interfaces. + node('statoblast-escalation-storage', 'EscalationGameStorage', 'abstract', 'statoblast-implementation', 0, 0, 'solidity/contracts/peripherals/EscalationGameStorage.sol'), + node('statoblast-escalation-state', 'EscalationGameState', 'abstract', 'statoblast-implementation', 0, 1, 'solidity/contracts/peripherals/EscalationGameState.sol'), + node('statoblast-escalation-calculations', 'EscalationGameCalculations', 'abstract', 'statoblast-implementation', 0, 2, 'solidity/contracts/peripherals/EscalationGameCalculations.sol'), + node('statoblast-escalation-carry', 'EscalationGameCarry', 'abstract', 'statoblast-implementation', 0, 3, 'solidity/contracts/peripherals/EscalationGameCarry.sol'), + node('statoblast-escalation-escrow', 'EscalationGameEscrow', 'abstract', 'statoblast-implementation', 0, 4, 'solidity/contracts/peripherals/EscalationGameEscrow.sol'), + node('statoblast-escalation-settlement', 'EscalationGameSettlement', 'abstract', 'statoblast-implementation', 0, 5, 'solidity/contracts/peripherals/EscalationGameSettlement.sol'), + node('statoblast-escalation-types', 'EscalationGameTypes', 'module', 'statoblast-implementation', 0, 6, 'solidity/contracts/peripherals/EscalationGameTypes.sol'), + node('statoblast-forker-storage', 'SecurityPoolForkerStorage', 'abstract', 'statoblast-implementation', 1, 0, 'solidity/contracts/peripherals/SecurityPoolForkerStorage.sol'), + node('statoblast-forker-base', 'SecurityPoolForkerBase', 'abstract', 'statoblast-implementation', 1, 1, 'solidity/contracts/peripherals/SecurityPoolForkerBase.sol'), + node('statoblast-auction-settlement-base', 'SecurityPoolForkerAuctionSettlementBase', 'abstract', 'statoblast-implementation', 1, 2, 'solidity/contracts/peripherals/SecurityPoolForkerAuctionSettlementBase.sol'), + node('statoblast-vault-migration-base', 'SecurityPoolForkerVaultMigrationBase', 'abstract', 'statoblast-implementation', 1, 3, 'solidity/contracts/peripherals/SecurityPoolForkerVaultMigrationBase.sol'), + node('statoblast-forker-types', 'SecurityPoolForkerTypes', 'module', 'statoblast-implementation', 1, 4, 'solidity/contracts/peripherals/SecurityPoolForkerTypes.sol'), + node('statoblast-escalation-deposit-context', 'IEscalationGameDepositContext', 'interface', 'statoblast-implementation', 2, 0, 'solidity/contracts/peripherals/EscalationGameDepositDelegate.sol'), + node('statoblast-stored-open-oracle-game', 'IStoredOpenOracleGame', 'interface', 'statoblast-implementation', 2, 1, 'solidity/contracts/peripherals/OpenOraclePriceCoordinator.sol'), + node('statoblast-deployment-worker-config', 'ISecurityPoolDeploymentWorkerConfiguration', 'interface', 'statoblast-implementation', 2, 2, 'solidity/contracts/peripherals/SecurityPool.sol'), + node('statoblast-iaugur', 'IAugur', 'interface', 'statoblast-implementation', 2, 3, 'solidity/contracts/peripherals/interfaces/IAugur.sol'), + node('statoblast-ierc165', 'IERC165', 'interface', 'statoblast-implementation', 2, 4, 'solidity/contracts/peripherals/interfaces/IERC165.sol'), + node('statoblast-ierc1155', 'IERC1155', 'interface', 'statoblast-implementation', 2, 5, 'solidity/contracts/peripherals/interfaces/IERC1155.sol'), + node('statoblast-ierc1155-receiver', 'IERC1155Receiver', 'interface', 'statoblast-implementation', 2, 6, 'solidity/contracts/peripherals/interfaces/IERC1155Receiver.sol'), + node('statoblast-escalation-events', 'IEscalationGameEvents', 'interface', 'statoblast-implementation', 3, 0, 'solidity/contracts/peripherals/interfaces/IEscalationGame.sol'), + node('statoblast-security-pool-interface', 'ISecurityPool', 'interface', 'statoblast-implementation', 3, 1, 'solidity/contracts/peripherals/interfaces/ISecurityPool.sol'), + node('statoblast-security-pool-factory-interface', 'ISecurityPoolFactory', 'interface', 'statoblast-implementation', 3, 2, 'solidity/contracts/peripherals/interfaces/ISecurityPool.sol'), + node('statoblast-forker-events', 'ISecurityPoolForkerEvents', 'interface', 'statoblast-implementation', 3, 3, 'solidity/contracts/peripherals/interfaces/ISecurityPoolForker.sol'), + node('statoblast-forker-interface', 'ISecurityPoolForker', 'interface', 'statoblast-implementation', 3, 4, 'solidity/contracts/peripherals/interfaces/ISecurityPoolForker.sol'), + node('statoblast-child-game-initializer', 'ISecurityPoolForkerChildEscalationGameInitializer', 'interface', 'statoblast-implementation', 3, 5, 'solidity/contracts/peripherals/interfaces/ISecurityPoolForkerChildEscalationGameInitializer.sol'), + node('statoblast-share-token-interface', 'IShareToken', 'interface', 'statoblast-implementation', 4, 0, 'solidity/contracts/peripherals/interfaces/IShareToken.sol'), + node('statoblast-auction-events', 'IUniformPriceDualCapBatchAuctionEvents', 'interface', 'statoblast-implementation', 4, 1, 'solidity/contracts/peripherals/interfaces/IUniformPriceDualCapBatchAuction.sol'), + node('statoblast-auction-interface', 'IUniformPriceDualCapBatchAuction', 'interface', 'statoblast-implementation', 4, 2, 'solidity/contracts/peripherals/interfaces/IUniformPriceDualCapBatchAuction.sol'), + node('statoblast-iweth9', 'IWeth9', 'interface', 'statoblast-implementation', 4, 3, 'solidity/contracts/peripherals/interfaces/IWeth9.sol'), + + // Deployment infrastructure, compatibility contracts, and the imported OpenOracle boundary. + node('infra-deployment-status-oracle', 'DeploymentStatusOracle', 'contract', 'infrastructure', 0, 0, 'solidity/contracts/DeploymentStatusOracle.sol'), + node('infra-multicall3', 'Multicall3', 'contract', 'infrastructure', 0, 1, 'solidity/contracts/peripherals/Multicall3.sol'), + node('infra-weth9', 'WETH9', 'contract', 'infrastructure', 0, 2, 'solidity/contracts/peripherals/WETH9.sol'), + node('openoracle-core', 'OpenOracle', 'contract', 'infrastructure', 1, 1, 'solidity/contracts/peripherals/openOracle/OpenOracle.sol'), + node('openoracle-signature-transfer', 'ISignatureTransfer', 'interface', 'infrastructure', 2, 0, 'solidity/contracts/peripherals/openOracle/interfaces/ISignatureTransfer.sol'), + node('openoracle-errors', 'Errors', 'library', 'infrastructure', 2, 1, 'solidity/contracts/peripherals/openOracle/libraries/Errors.sol'), + node('openoracle-ierc20', 'OpenZeppelin IERC20', 'interface', 'infrastructure', 2, 2, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/token/ERC20/IERC20.sol', 'IERC20'), + node('openoracle-safe-erc20', 'SafeERC20', 'library', 'infrastructure', 2, 3, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'), + node('openoracle-ierc1363', 'IERC1363', 'interface', 'infrastructure', 3, 0, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/interfaces/IERC1363.sol'), + node('openoracle-ierc165', 'OpenZeppelin IERC165', 'interface', 'infrastructure', 3, 1, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/introspection/IERC165.sol', 'IERC165'), + node('openoracle-math', 'Math', 'library', 'infrastructure', 3, 2, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/math/Math.sol'), + node('openoracle-safe-cast', 'SafeCast', 'library', 'infrastructure', 3, 3, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/math/SafeCast.sol'), + node('openoracle-panic', 'Panic', 'library', 'infrastructure', 4, 0, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/Panic.sol'), + node('openoracle-reentrancy-guard', 'ReentrancyGuard', 'abstract', 'infrastructure', 4, 1, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/ReentrancyGuard.sol'), + node('openoracle-storage-slot', 'StorageSlot', 'library', 'infrastructure', 4, 2, 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/utils/StorageSlot.sol'), + + // Every Solidity declaration under contracts/test is retained in a separate test-only region. + node('test-complete-set-reentrant-receiver', 'CompleteSetReentrantReceiver', 'contract', 'tests', 0, 0, 'solidity/contracts/test/peripherals/CompleteSetReentrantReceiver.sol'), + node('test-erc1155-coverage-harness', 'ERC1155CoverageHarness', 'contract', 'tests', 0, 1, 'solidity/contracts/test/peripherals/CoverageHelpersHarness.sol'), + node('test-coverage-attribution-executed', 'CoverageAttributionExecuted', 'contract', 'tests', 0, 2, 'solidity/contracts/test/peripherals/CoverageHelpersHarness.sol'), + node('test-coverage-attribution-decoy', 'CoverageAttributionDecoy', 'contract', 'tests', 0, 3, 'solidity/contracts/test/peripherals/CoverageHelpersHarness.sol'), + node('test-escalation-factory-coverage-pool', 'EscalationGameFactoryCoverageSecurityPool', 'contract', 'tests', 0, 4, 'solidity/contracts/test/peripherals/CoverageHelpersHarness.sol'), + node('test-coverage-helpers-harness', 'CoverageHelpersHarness', 'contract', 'tests', 0, 5, 'solidity/contracts/test/peripherals/CoverageHelpersHarness.sol'), + node('test-erc1155-receiver-mock', 'ERC1155ReceiverMock', 'contract', 'tests', 1, 0, 'solidity/contracts/test/peripherals/ERC1155ReceiverMock.sol'), + node('test-erc1155-non-receiver', 'ERC1155NonReceiver', 'contract', 'tests', 1, 1, 'solidity/contracts/test/peripherals/ERC1155ReceiverMock.sol'), + node('test-share-token-authorization-pool', 'ShareTokenAuthorizationPoolMock', 'contract', 'tests', 1, 2, 'solidity/contracts/test/peripherals/ERC1155ReceiverMock.sol'), + node('test-fork-boundary-zoltar', 'EscalationGameForkBoundaryZoltar', 'contract', 'tests', 1, 3, 'solidity/contracts/test/peripherals/EscalationGameForkThresholdHarness.sol'), + node('test-fork-boundary-pool', 'EscalationGameForkBoundarySecurityPool', 'contract', 'tests', 1, 4, 'solidity/contracts/test/peripherals/EscalationGameForkThresholdHarness.sol'), + node('test-fork-threshold-harness', 'EscalationGameForkThresholdHarness', 'contract', 'tests', 1, 5, 'solidity/contracts/test/peripherals/EscalationGameForkThresholdHarness.sol'), + node('test-escalation-forker-harness', 'EscalationGameForkerHarness', 'contract', 'tests', 1, 6, 'solidity/contracts/test/peripherals/EscalationGameForkerHarness.sol'), + node('test-escalation-proof-pool', 'EscalationGameProofTestSecurityPool', 'contract', 'tests', 2, 0, 'solidity/contracts/test/peripherals/EscalationGameProofTestSecurityPool.sol'), + node('test-false-returning-erc20', 'FalseReturningERC20', 'contract', 'tests', 2, 1, 'solidity/contracts/test/peripherals/FalseReturningERC20.sol'), + node('test-incompatible-proof-verifier', 'IncompatibleEscalationGameProofVerifier', 'contract', 'tests', 2, 2, 'solidity/contracts/test/peripherals/IncompatibleEscalationGameProofVerifier.sol'), + node('test-openoracle-adversarial-target', 'IOpenOracleAdversarialTarget', 'interface', 'tests', 2, 3, 'solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol'), + node('test-openoracle-token', 'OpenOracleTestToken', 'contract', 'tests', 2, 4, 'solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol'), + node('test-openoracle-no-return-token', 'OpenOracleNoReturnToken', 'contract', 'tests', 2, 5, 'solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol'), + node('test-openoracle-rejecting-receiver', 'OpenOracleRejectingETHReceiver', 'contract', 'tests', 2, 6, 'solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol'), + node('test-openoracle-reentrant-callback', 'OpenOracleReentrantCallback', 'contract', 'tests', 2, 7, 'solidity/contracts/test/peripherals/OpenOracleAdversarialHarnesses.sol'), + node('test-own-fork-claim-harness', 'OwnForkEscalationClaimHarness', 'contract', 'tests', 3, 0, 'solidity/contracts/test/peripherals/OwnForkEscalationClaimHarness.sol'), + node('test-safe-erc20-ops-harness', 'SafeERC20OpsHarness', 'contract', 'tests', 3, 1, 'solidity/contracts/test/peripherals/SafeERC20OpsHarness.sol'), + node('test-security-pool-ancestor', 'SecurityPoolAncestorTestNode', 'contract', 'tests', 3, 2, 'solidity/contracts/test/peripherals/SecurityPoolAncestorTestNode.sol'), + node('test-constructor-failure-zoltar', 'SecurityPoolConstructorFailureZoltar', 'contract', 'tests', 3, 3, 'solidity/contracts/test/peripherals/SecurityPoolConstructorFailureZoltar.sol'), + node('test-forker-child-validation-harness', 'SecurityPoolForkerChildGameValidationHarness', 'contract', 'tests', 3, 4, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-malicious-emitter', 'SecurityPoolForkerMaliciousEventEmitter', 'contract', 'tests', 3, 5, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-fake-pool', 'SecurityPoolForkerFakePoolMock', 'contract', 'tests', 3, 6, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-attack-factory', 'SecurityPoolForkerAttackFactoryMock', 'contract', 'tests', 3, 7, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-attack-parent', 'SecurityPoolForkerAttackParentMock', 'contract', 'tests', 4, 0, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-escrow-factory', 'SecurityPoolForkerEscrowAttackFactoryMock', 'contract', 'tests', 4, 1, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-escrow-game', 'SecurityPoolForkerEscrowAttackGameMock', 'contract', 'tests', 4, 2, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-escrow-parent', 'SecurityPoolForkerEscrowAttackParentMock', 'contract', 'tests', 4, 3, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-alternating-game', 'SecurityPoolForkerAlternatingChildGameMock', 'contract', 'tests', 4, 4, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-forker-escrow-child', 'SecurityPoolForkerEscrowAttackChildMock', 'contract', 'tests', 4, 5, 'solidity/contracts/test/peripherals/SecurityPoolForkerAttackMocks.sol'), + node('test-auction-settlement-pool', 'AuctionSettlementPoolHarness', 'contract', 'tests', 4, 6, 'solidity/contracts/test/peripherals/SecurityPoolForkerAuctionSettlementHarness.sol'), + node('test-forker-auction-settlement', 'SecurityPoolForkerAuctionSettlementHarness', 'contract', 'tests', 4, 7, 'solidity/contracts/test/peripherals/SecurityPoolForkerAuctionSettlementHarness.sol'), + node('test-truth-auction-alias-share-token', 'TruthAuctionAliasAttackShareTokenMock', 'contract', 'tests', 0, 6, 'solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol'), + node('test-truth-auction-alias-factory', 'TruthAuctionAliasAttackFactoryMock', 'contract', 'tests', 1, 7, 'solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol'), + node('test-truth-auction-alias-parent', 'TruthAuctionAliasAttackParentMock', 'contract', 'tests', 2, 8, 'solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol'), + node('test-truth-auction-alias-child', 'TruthAuctionAliasAttackChildMock', 'contract', 'tests', 3, 8, 'solidity/contracts/test/peripherals/TruthAuctionAliasAttackMocks.sol'), +] + +export const contractAtlasInventoryRows = contractAtlasNodes.map(atlasNode => ({ + node: atlasNode, + panelLabel: contractAtlasPanelLabels[atlasNode.panel], +})) + +const contractAtlasSemanticEdges: ContractAtlasEdge[] = [ + // Zoltar implementation and runtime. + edge('zoltar-question-scalar', 'zoltar-question-data', 'zoltar-scalar-outcomes', 'uses', 'Decodes and names scalar outcomes with the shared scalar library.'), + edge('zoltar-core-constants', 'zoltar-core', 'zoltar-constants', 'uses', 'Reads protocol addresses and fork limits.'), + edge('zoltar-core-safe-erc20', 'zoltar-core', 'zoltar-safe-erc20-ops', 'uses', 'Moves genesis REP through checked ERC-20 calls.'), + edge('zoltar-core-ierc20', 'zoltar-core', 'zoltar-ierc20', 'uses', 'Treats genesis REP as the repository ERC-20 interface.'), + edge('zoltar-core-question-data', 'zoltar-core', 'zoltar-question-data', 'calls', 'Validates fork questions, end times, and child outcomes.'), + sourceDerivedEdge('zoltar-core-reputation-token', 'zoltar-core', 'zoltar-reputation-token', 'deploys'), + sourceDerivedEdge('zoltar-reputation-erc20', 'zoltar-reputation-token', 'zoltar-erc20', 'inherits'), + sourceDerivedEdge('zoltar-erc20-context', 'zoltar-erc20', 'zoltar-context', 'inherits'), + sourceDerivedEdge('zoltar-erc20-interface', 'zoltar-erc20', 'zoltar-ierc20', 'implements'), + sourceDerivedEdge('zoltar-erc20-metadata', 'zoltar-erc20', 'zoltar-ierc20-metadata', 'implements'), + sourceDerivedEdge('zoltar-metadata-erc20', 'zoltar-ierc20-metadata', 'zoltar-ierc20', 'inherits'), + edge('zoltar-safe-ops-interface', 'zoltar-safe-erc20-ops', 'zoltar-ierc20', 'uses', 'Wraps repository ERC-20 calls with return-data checks.'), + + // Statoblast construction. + sourceDerivedEdge('factory-interface', 'statoblast-security-pool-factory', 'statoblast-security-pool-factory-interface', 'implements'), + edge('factory-question-data', 'statoblast-security-pool-factory', 'zoltar-question-data', 'calls', 'Validates that origin markets use an existing Yes/No question.'), + edge('factory-zoltar', 'statoblast-security-pool-factory', 'zoltar-core', 'calls', 'Reads universe, REP, fork, and non-decision-threshold state.'), + edge('factory-share-factory', 'statoblast-security-pool-factory', 'statoblast-share-token-factory', 'calls', 'Requests the origin lineage share token.'), + edge('factory-share-token', 'statoblast-security-pool-factory', 'statoblast-share-token', 'calls', 'Authorizes the newly deployed origin pool on its lineage share token.'), + sourceDerivedEdge('share-factory-share', 'statoblast-share-token-factory', 'statoblast-share-token', 'deploys'), + edge('share-factory-zoltar', 'statoblast-share-token-factory', 'zoltar-core', 'uses', 'Wires the shared Zoltar registry into every deployed share token.'), + edge('factory-price-factory', 'statoblast-security-pool-factory', 'statoblast-price-coordinator-factory', 'calls', 'Requests one REP/WETH price coordinator per pool.'), + sourceDerivedEdge('price-factory-coordinator', 'statoblast-price-coordinator-factory', 'statoblast-price-coordinator', 'deploys'), + edge('price-factory-weth', 'statoblast-price-coordinator-factory', 'statoblast-iweth9', 'uses', 'Wires its immutable WETH contract into each coordinator.'), + edge('factory-price-coordinator', 'statoblast-security-pool-factory', 'statoblast-price-coordinator', 'calls', 'Permanently binds the newly deployed coordinator to its canonical pool.'), + edge('factory-auction-factory', 'statoblast-security-pool-factory', 'statoblast-auction-factory', 'calls', 'Requests a truth auction for each child pool.'), + sourceDerivedEdge('auction-factory-auction', 'statoblast-auction-factory', 'statoblast-truth-auction', 'deploys'), + sourceDerivedEdge('factory-pool-deployer', 'statoblast-security-pool-factory', 'statoblast-security-pool-deployer', 'deploys'), + edge('factory-pool-deployer-call', 'statoblast-security-pool-factory', 'statoblast-security-pool-deployer', 'calls', 'Calls the private deployer for every origin or child pool after assembling its dependencies.'), + sourceDerivedEdge('pool-deployer-emitter', 'statoblast-security-pool-deployer', 'statoblast-event-emitter', 'deploys'), + sourceDerivedEdge('pool-deployer-worker', 'statoblast-security-pool-deployer', 'statoblast-security-pool-worker', 'deploys'), + edge('worker-config-interface', 'statoblast-security-pool-worker', 'statoblast-deployment-worker-config', 'compatible', 'Structurally provides the factory and event-emitter getters read through the pool constructor interface.'), + sourceDerivedEdge('worker-security-pool', 'statoblast-security-pool-worker', 'statoblast-security-pool', 'deploys'), + sourceDerivedEdge('escalation-factory-verifier', 'statoblast-escalation-game-factory', 'statoblast-escalation-proof-verifier', 'deploys'), + sourceDerivedEdge('escalation-factory-game', 'statoblast-escalation-game-factory', 'statoblast-escalation-game', 'deploys'), + edge('escalation-factory-pool', 'statoblast-escalation-game-factory', 'statoblast-security-pool-interface', 'calls', 'Reads the calling pool, parent, REP token, and shared forker configuration.'), + edge('escalation-factory-forker', 'statoblast-escalation-game-factory', 'statoblast-forker-interface', 'calls', 'Reads own-fork haircut and REP-bucket state for child continuations.'), + + // Statoblast market and oracle runtime. + sourceDerivedEdge('pool-interface', 'statoblast-security-pool', 'statoblast-security-pool-interface', 'implements'), + edge('pool-worker-config', 'statoblast-security-pool', 'statoblast-deployment-worker-config', 'calls', 'Reads its factory and event-emitter wiring from the deployment worker.'), + edge('pool-reputation-token', 'statoblast-security-pool', 'zoltar-reputation-token', 'assets', 'Uses REP token calls to move REP vault or reporter → pool, pool → escalation game or forker, and pool → redemption recipient.'), + edge('pool-share-token', 'statoblast-security-pool', 'statoblast-share-token', 'calls', 'Mints and burns complete sets, redeems winning shares, and authorizes child pools.'), + edge('pool-escalation-factory', 'statoblast-security-pool', 'statoblast-escalation-game-factory', 'calls', 'Lazily deploys a local game on the first deposit, or deploys a fork-continuation game when the forker initializes inherited state.'), + edge('pool-escalation-game', 'statoblast-security-pool', 'statoblast-escalation-game', 'assets', 'Reads resolution state while reporting REP moves pool → game escrow and settled REP moves game → pool or claimant.'), + edge('pool-price-coordinator', 'statoblast-security-pool', 'statoblast-price-coordinator', 'calls', 'Reads cached REP/ETH prices.'), + edge('price-coordinator-pool', 'statoblast-price-coordinator', 'statoblast-security-pool', 'calls', 'Executes staged liquidation, withdrawal, and allowance operations through coordinator-only pool entrypoints after validation.'), + edge('price-coordinator-openoracle', 'statoblast-price-coordinator', 'openoracle-core', 'assets', 'Funds reports with WETH and REP coordinator → OpenOracle, then requests settled balances OpenOracle → sponsor.'), + edge('openoracle-price-callback', 'openoracle-core', 'statoblast-price-coordinator', 'calls', 'Calls openOracleCallback on the configured coordinator after report settlement.'), + edge('price-coordinator-weth', 'statoblast-price-coordinator', 'statoblast-iweth9', 'assets', 'Calls WETH to move sponsor → coordinator, grants coordinator → OpenOracle allowance, and requests settled WETH OpenOracle → sponsor.'), + edge('price-coordinator-rep', 'statoblast-price-coordinator', 'zoltar-reputation-token', 'assets', 'Calls REP to move sponsor → coordinator, grants coordinator → OpenOracle allowance, and requests settled REP OpenOracle → sponsor.'), + edge('price-coordinator-pool-utils', 'statoblast-price-coordinator', 'statoblast-security-pool-utils', 'uses', 'Uses shared BPS and minimum-REP constants.'), + edge('price-coordinator-math', 'statoblast-price-coordinator', 'openoracle-math', 'uses', 'Uses checked rounding for report funding and risk thresholds.'), + edge('price-coordinator-stored-game', 'statoblast-price-coordinator', 'statoblast-stored-open-oracle-game', 'uses', 'Uses a narrow compatibility view of OpenOracle stored-game data.'), + sourceDerivedEdge('share-token-erc1155', 'statoblast-share-token', 'statoblast-erc1155', 'inherits'), + sourceDerivedEdge('share-token-interface', 'statoblast-share-token', 'statoblast-share-token-interface', 'implements'), + edge('share-token-token-id', 'statoblast-share-token', 'statoblast-token-id', 'uses', 'Packs and unpacks universe and outcome identifiers.'), + edge('share-token-binary-outcomes', 'statoblast-share-token', 'statoblast-binary-outcomes', 'uses', 'Maps each universe to Invalid, Yes, and No token IDs.'), + edge('share-token-zoltar', 'statoblast-share-token', 'zoltar-core', 'calls', 'Derives child universes and inspects fork state.'), + edge('share-token-pool', 'statoblast-share-token', 'statoblast-security-pool-interface', 'calls', 'Validates source and candidate canonical pools during migration and authorization.'), + edge('share-token-forker', 'statoblast-share-token', 'statoblast-pool-forker', 'calls', 'Activates the source fork and lazily creates child pools during share migration.'), + sourceDerivedEdge('erc1155-interface', 'statoblast-erc1155', 'statoblast-ierc1155', 'implements'), + edge('erc1155-receiver', 'statoblast-erc1155', 'statoblast-ierc1155-receiver', 'calls', 'Performs safe single and batch receiver callbacks.'), + sourceDerivedEdge('ierc1155-erc165', 'statoblast-ierc1155', 'statoblast-ierc165', 'inherits'), + sourceDerivedEdge('receiver-erc165', 'statoblast-ierc1155-receiver', 'statoblast-ierc165', 'inherits'), + sourceDerivedEdge('pool-event-emitter', 'statoblast-security-pool', 'statoblast-event-emitter', 'delegatecall'), + edge('pool-forker-runtime', 'statoblast-security-pool', 'statoblast-pool-forker', 'calls', 'Reads resolved question outcomes from the shared forker.'), + edge('pool-zoltar-runtime', 'statoblast-security-pool', 'zoltar-core', 'calls', 'Reads universe fork timing and burns resolution haircuts through Zoltar.'), + edge('pool-question-runtime', 'statoblast-security-pool', 'zoltar-question-data', 'calls', 'Reads the market question end date.'), + edge('pool-utils-runtime', 'statoblast-security-pool', 'statoblast-security-pool-utils', 'uses', 'Uses shared fee, precision, and minimum-REP constants.'), + edge('pool-binary-outcomes', 'statoblast-security-pool', 'statoblast-binary-outcomes', 'uses', 'Uses the canonical Invalid/Yes/No outcome enum.'), + + // Escalation inheritance, delegate, proof, and settlement relationships. + sourceDerivedEdge('game-settlement-base', 'statoblast-escalation-game', 'statoblast-escalation-settlement', 'inherits'), + sourceDerivedEdge('settlement-escrow-base', 'statoblast-escalation-settlement', 'statoblast-escalation-escrow', 'inherits'), + sourceDerivedEdge('escrow-carry-base', 'statoblast-escalation-escrow', 'statoblast-escalation-carry', 'inherits'), + sourceDerivedEdge('carry-calculation-base', 'statoblast-escalation-carry', 'statoblast-escalation-calculations', 'inherits'), + sourceDerivedEdge('calculation-state-base', 'statoblast-escalation-calculations', 'statoblast-escalation-state', 'inherits'), + sourceDerivedEdge('state-storage-base', 'statoblast-escalation-state', 'statoblast-escalation-storage', 'inherits'), + sourceDerivedEdge('state-events-interface', 'statoblast-escalation-state', 'statoblast-escalation-events', 'implements'), + sourceDerivedEdge('game-deposit-delegate-deploy', 'statoblast-escalation-game', 'statoblast-escalation-deposit-delegate', 'deploys'), + sourceDerivedEdge('game-deposit-delegate-call', 'statoblast-escalation-game', 'statoblast-escalation-deposit-delegate', 'delegatecall'), + sourceDerivedEdge('deposit-delegate-storage', 'statoblast-escalation-deposit-delegate', 'statoblast-escalation-storage', 'inherits'), + sourceDerivedEdge('deposit-delegate-events', 'statoblast-escalation-deposit-delegate', 'statoblast-escalation-events', 'implements'), + edge('deposit-delegate-context', 'statoblast-escalation-deposit-delegate', 'statoblast-escalation-deposit-context', 'calls', 'Calls back into the active game context for view calculations.'), + edge('deposit-delegate-mmr', 'statoblast-escalation-deposit-delegate', 'statoblast-merkle-mountain-range', 'uses', 'Appends canonical carry leaves.'), + edge('state-proof-verifier', 'statoblast-escalation-state', 'statoblast-escalation-proof-verifier', 'calls', 'Pins and reads the storage-free proof verifier.'), + edge('state-reputation-token', 'statoblast-escalation-state', 'zoltar-reputation-token', 'assets', 'Uses REP token calls to move game escrow → claimant, pool, or fork export recipient.'), + edge('carry-proof-verifier', 'statoblast-escalation-carry', 'statoblast-escalation-proof-verifier', 'calls', 'Verifies Merkle Mountain Range and nullifier proofs.'), + edge('proof-verifier-mmr', 'statoblast-escalation-proof-verifier', 'statoblast-merkle-mountain-range', 'uses', 'Computes carry roots and proof paths.'), + edge('escalation-types-storage', 'statoblast-escalation-storage', 'statoblast-escalation-types', 'uses', 'Stores the shared outcome, deposit, node, and fork-escrow structures.'), + edge('escalation-types-carry', 'statoblast-escalation-carry', 'statoblast-escalation-types', 'uses', 'Consumes the shared carry and proof structures.'), + edge('escalation-binary-calculations', 'statoblast-escalation-calculations', 'statoblast-binary-outcomes', 'uses', 'Types question-resolution results and unresolved sentinels with the shared binary-outcome enum.'), + edge('escalation-settlement-pool', 'statoblast-escalation-settlement', 'statoblast-security-pool', 'calls', 'Returns residual REP and asks the pool to burn winner haircuts.'), + edge('escalation-settlement-forker', 'statoblast-escalation-settlement', 'statoblast-forker-interface', 'calls', 'Checks direct own-fork claim lineage and question outcomes.'), + + // Fork, migration, and truth-auction implementation. + sourceDerivedEdge('forker-auction-settlement-base-inheritance', 'statoblast-pool-forker', 'statoblast-auction-settlement-base', 'inherits'), + sourceDerivedEdge('auction-settlement-base-forker-base', 'statoblast-auction-settlement-base', 'statoblast-forker-base', 'inherits'), + sourceDerivedEdge('forker-base-storage', 'statoblast-forker-base', 'statoblast-forker-storage', 'inherits'), + sourceDerivedEdge('forker-base-events', 'statoblast-forker-base', 'statoblast-forker-events', 'implements'), + sourceDerivedEdge('vault-base-forker-base', 'statoblast-vault-migration-base', 'statoblast-forker-base', 'inherits'), + sourceDerivedEdge('vault-delegate-base', 'statoblast-vault-migration-delegate', 'statoblast-vault-migration-base', 'inherits'), + sourceDerivedEdge('escalation-forker-base', 'statoblast-escalation-game-forker', 'statoblast-vault-migration-base', 'inherits'), + sourceDerivedEdge('event-emitter-storage', 'statoblast-event-emitter', 'statoblast-forker-storage', 'inherits'), + sourceDerivedEdge('event-emitter-events', 'statoblast-event-emitter', 'statoblast-forker-events', 'implements'), + sourceDerivedEdge('forker-interface-events', 'statoblast-forker-interface', 'statoblast-forker-events', 'inherits'), + sourceDerivedEdge('auction-interface-events', 'statoblast-auction-interface', 'statoblast-auction-events', 'inherits'), + sourceDerivedEdge('auction-events-implementation', 'statoblast-truth-auction', 'statoblast-auction-events', 'implements'), + edge('auction-math', 'statoblast-truth-auction', 'openoracle-math', 'uses', 'Uses full-precision arithmetic for clearing and pro-rata settlement.'), + edge('auction-settlement-base-pool', 'statoblast-auction-settlement-base', 'statoblast-security-pool', 'calls', 'Credits purchased REP ownership and auctioned allowance into bidder vault accounting.'), + edge('auction-settlement-base-types', 'statoblast-auction-settlement-base', 'statoblast-forker-types', 'uses', 'Updates typed auction claim totals in per-pool fork records.'), + sourceDerivedEdge('forker-deploy-vault-delegate', 'statoblast-pool-forker', 'statoblast-vault-migration-delegate', 'deploys'), + sourceDerivedEdge('forker-deploy-escalation-delegate', 'statoblast-pool-forker', 'statoblast-escalation-game-forker', 'deploys'), + sourceDerivedEdge('forker-deploy-event-emitter', 'statoblast-pool-forker', 'statoblast-event-emitter', 'deploys'), + sourceDerivedEdge('forker-delegate-vault', 'statoblast-pool-forker', 'statoblast-vault-migration-delegate', 'delegatecall'), + sourceDerivedEdge('forker-delegate-escalation', 'statoblast-pool-forker', 'statoblast-escalation-game-forker', 'delegatecall'), + sourceDerivedEdge('forker-delegate-events', 'statoblast-pool-forker', 'statoblast-event-emitter', 'delegatecall'), + sourceDerivedEdge('forker-deploy-proxy', 'statoblast-pool-forker', 'statoblast-migration-proxy', 'deploys'), + edge('forker-proxy-assets', 'statoblast-pool-forker', 'statoblast-migration-proxy', 'assets', 'Transfers parent REP forker → migration proxy, then instructs the proxy to lock, fork, split, and sweep child REP.'), + edge('forker-reputation-token', 'statoblast-pool-forker', 'zoltar-reputation-token', 'assets', 'Calls the parent REP token to transfer REP forker → stable migration proxy.'), + edge('proxy-zoltar', 'statoblast-migration-proxy', 'zoltar-core', 'calls', 'Owns the literal Zoltar migration ledger balance for one parent pool.'), + edge('proxy-reputation-token', 'statoblast-migration-proxy', 'zoltar-reputation-token', 'assets', 'Calls REP to grant proxy → Zoltar allowance and transfer minted child REP proxy → configured receiver.'), + edge('forker-zoltar', 'statoblast-pool-forker', 'zoltar-core', 'calls', 'Reads fork thresholds and migration balances around proxy operations.'), + edge('forker-pool', 'statoblast-pool-forker', 'statoblast-security-pool', 'calls', 'Freezes parents, migrates children, and updates collateral and ownership accounting through forker-only pool entrypoints.'), + edge('forker-game', 'statoblast-pool-forker', 'statoblast-escalation-game', 'calls', 'Snapshots escalation state and resolves inherited question outcomes.'), + edge('forker-auction', 'statoblast-pool-forker', 'statoblast-truth-auction', 'assets', 'Coordinates ETH bidder → auction → forker → child pool or, for refunds, auction → bidder; purchased REP is credited as pool ownership rather than transferred.'), + edge('vault-base-zoltar', 'statoblast-vault-migration-base', 'zoltar-core', 'calls', 'Deploys missing child universes and reads child REP.'), + edge('vault-base-factory', 'statoblast-vault-migration-base', 'statoblast-security-pool-factory', 'calls', 'Requests canonical child-pool deployment.'), + edge('vault-base-pool', 'statoblast-vault-migration-base', 'statoblast-security-pool', 'calls', 'Copies vault, collateral, and ownership state into child pools.'), + edge('vault-base-proxy', 'statoblast-vault-migration-base', 'statoblast-migration-proxy', 'assets', 'Calls the proxy so split child REP moves migration proxy → child pools and escalation games.'), + edge('vault-base-types', 'statoblast-vault-migration-base', 'statoblast-forker-types', 'uses', 'Stores and mutates typed fork and child-REP allocation records.'), + edge('forker-storage-types', 'statoblast-forker-storage', 'statoblast-forker-types', 'uses', 'Owns the typed per-pool fork and migration mappings.'), + edge('escalation-forker-child-interface', 'statoblast-escalation-game-forker', 'statoblast-child-game-initializer', 'calls', 'Initializes child escalation carry snapshots through the narrow child API.'), + edge('escalation-forker-game', 'statoblast-escalation-game-forker', 'statoblast-escalation-game', 'calls', 'Exports, materializes, resumes, and settles forked escalation state.'), + edge('escalation-forker-pool', 'statoblast-escalation-game-forker', 'statoblast-security-pool', 'calls', 'Updates child pool escalation accounting.'), + edge('escalation-forker-zoltar', 'statoblast-escalation-game-forker', 'zoltar-core', 'calls', 'Reads universe and REP relationships during escalation migration.'), + edge('forker-utils', 'statoblast-pool-forker', 'statoblast-security-pool-utils', 'uses', 'Uses shared auction timing and fixed-point precision.'), + edge('forker-binary', 'statoblast-pool-forker', 'statoblast-binary-outcomes', 'uses', 'Tracks fixed and unresolved binary outcomes.'), + + // Compatibility and imported OpenOracle internals. + edge('weth-interface', 'infra-weth9', 'statoblast-iweth9', 'compatible', 'Structurally provides the WETH surface consumed through the coordinator interface.'), + edge('openoracle-errors-edge', 'openoracle-core', 'openoracle-errors', 'uses', 'Uses the imported custom-error catalog.'), + edge('openoracle-permit2', 'openoracle-core', 'openoracle-signature-transfer', 'calls', 'Pulls permit-authorized tokens through the canonical Permit2 singleton.'), + edge('openoracle-erc20-edge', 'openoracle-core', 'openoracle-ierc20', 'uses', 'Models report tokens through the imported ERC-20 interface.'), + edge('openoracle-safe-erc20-edge', 'openoracle-core', 'openoracle-safe-erc20', 'uses', 'Moves report tokens through OpenZeppelin safe wrappers.'), + edge('safe-erc20-interface', 'openoracle-safe-erc20', 'openoracle-ierc20', 'uses', 'Wraps imported ERC-20 transfers and approvals.'), + edge('safe-erc20-1363', 'openoracle-safe-erc20', 'openoracle-ierc1363', 'uses', 'Supports relaxed ERC-1363 transfer-and-call helpers.'), + sourceDerivedEdge('ierc1363-erc20', 'openoracle-ierc1363', 'openoracle-ierc20', 'inherits'), + sourceDerivedEdge('ierc1363-erc165', 'openoracle-ierc1363', 'openoracle-ierc165', 'inherits'), + edge('math-panic', 'openoracle-math', 'openoracle-panic', 'uses', 'Reports arithmetic division and overflow panics.'), + edge('math-safe-cast', 'openoracle-math', 'openoracle-safe-cast', 'uses', 'Converts comparison results for branchless arithmetic.'), + + // Test-only declarations and the production boundary each one exercises. + edge('test-complete-set-reentrancy', 'test-complete-set-reentrant-receiver', 'statoblast-security-pool', 'tests', 'Exercises complete-set receiver reentrancy.'), + sourceDerivedEdge('test-complete-set-receiver-interface', 'test-complete-set-reentrant-receiver', 'statoblast-ierc1155-receiver', 'implements'), + sourceDerivedEdge('test-erc1155-coverage', 'test-erc1155-coverage-harness', 'statoblast-erc1155', 'inherits'), + sourceDerivedEdge('test-coverage-deployment-status-oracle', 'test-coverage-helpers-harness', 'infra-deployment-status-oracle', 'deploys'), + edge('test-escalation-factory-pool', 'test-escalation-factory-coverage-pool', 'statoblast-escalation-game-factory', 'tests', 'Acts as a minimal pool caller for factory coverage.'), + sourceDerivedEdge('test-coverage-helpers', 'test-coverage-helpers-harness', 'statoblast-escalation-proof-verifier', 'deploys'), + sourceDerivedEdge('test-receiver-mock', 'test-erc1155-receiver-mock', 'statoblast-ierc1155-receiver', 'implements'), + edge('test-non-receiver', 'test-erc1155-non-receiver', 'statoblast-erc1155', 'tests', 'Exercises transfers to a contract without receiver support.'), + edge('test-share-authorization', 'test-share-token-authorization-pool', 'statoblast-share-token', 'calls', 'Models an authorized pool adding a canonical child.'), + edge('test-threshold-zoltar', 'test-fork-boundary-zoltar', 'zoltar-core', 'tests', 'Supplies controlled fork thresholds for boundary tests.'), + edge('test-threshold-pool', 'test-fork-boundary-pool', 'statoblast-escalation-calculations', 'tests', 'Supplies controlled pool state to fork-threshold calculation tests.'), + sourceDerivedEdge('test-threshold-harness-edge', 'test-fork-threshold-harness', 'statoblast-escalation-calculations', 'inherits'), + edge('test-escalation-forker-edge', 'test-escalation-forker-harness', 'statoblast-escalation-game-forker', 'tests', 'Relays escalation-forker calls for authorization tests.'), + edge('test-proof-pool-edge', 'test-escalation-proof-pool', 'statoblast-escalation-proof-verifier', 'tests', 'Provides pool-shaped proof and carry test state.'), + sourceDerivedEdge('test-false-erc20-edge', 'test-false-returning-erc20', 'zoltar-ierc20', 'implements'), + edge('test-incompatible-verifier-edge', 'test-incompatible-proof-verifier', 'statoblast-escalation-state', 'tests', 'Exercises the game-state constructor proof-verifier code-hash rejection.'), + sourceDerivedEdge('test-openoracle-token-edge', 'test-openoracle-token', 'zoltar-ierc20', 'implements'), + edge('test-openoracle-receiver-edge', 'test-openoracle-rejecting-receiver', 'openoracle-core', 'tests', 'Exercises rejected, gas-consuming, and reentrant ETH delivery.'), + sourceDerivedEdge('test-openoracle-receiver-interface', 'test-openoracle-rejecting-receiver', 'statoblast-ierc1155-receiver', 'implements'), + edge('test-own-fork-claim-edge', 'test-own-fork-claim-harness', 'statoblast-escalation-game-forker', 'tests', 'Relays direct own-fork escalation claims.'), + edge('test-safe-ops-edge', 'test-safe-erc20-ops-harness', 'zoltar-safe-erc20-ops', 'tests', 'Exposes checked transfer and transferFrom wrappers.'), + edge('test-ancestor-edge', 'test-security-pool-ancestor', 'statoblast-pool-forker', 'tests', 'Builds controlled pool ancestry graphs for direct-claim replay checks.'), + edge('test-constructor-zoltar-edge', 'test-constructor-failure-zoltar', 'statoblast-security-pool', 'tests', 'Returns malformed Zoltar constructor dependencies.'), + sourceDerivedEdge('test-child-validation-edge', 'test-forker-child-validation-harness', 'statoblast-forker-base', 'inherits'), + edge('test-malicious-emitter-edge', 'test-forker-malicious-emitter', 'statoblast-event-emitter', 'tests', 'Models a layout-incompatible or reverting event delegate.'), + edge('test-fake-pool-edge', 'test-forker-fake-pool', 'statoblast-security-pool-interface', 'tests', 'Models forged child pool configuration.'), + edge('test-attack-factory-edge', 'test-forker-attack-factory', 'statoblast-security-pool-factory-interface', 'tests', 'Returns malicious child deployments.'), + edge('test-attack-parent-edge', 'test-forker-attack-parent', 'statoblast-pool-forker', 'tests', 'Models a parent pool that redirects child deployment.'), + edge('test-escrow-factory-edge', 'test-forker-escrow-factory', 'statoblast-security-pool-factory-interface', 'tests', 'Builds escrow-accounting attack children.'), + edge('test-escrow-game-edge', 'test-forker-escrow-game', 'statoblast-escalation-game', 'tests', 'Models inconsistent escalation escrow state.'), + edge('test-escrow-parent-edge', 'test-forker-escrow-parent', 'statoblast-pool-forker', 'tests', 'Models malicious parent escalation migration state.'), + edge('test-alternating-game-edge', 'test-forker-alternating-game', 'statoblast-escalation-game', 'tests', 'Alternates child game answers across validation reads.'), + edge('test-escrow-child-edge', 'test-forker-escrow-child', 'statoblast-security-pool', 'tests', 'Models a malicious child pool during escrow migration.'), + edge('test-auction-pool-edge', 'test-auction-settlement-pool', 'statoblast-security-pool', 'tests', 'Provides controlled auction settlement accounting.'), + sourceDerivedEdge('test-auction-settlement-base-edge', 'test-forker-auction-settlement', 'statoblast-auction-settlement-base', 'inherits'), + edge('test-truth-auction-alias-share-token-edge', 'test-truth-auction-alias-share-token', 'statoblast-pool-forker', 'tests', 'Supplies an always-authorized share-token surface to fake-lineage rejection tests.'), + edge('test-truth-auction-alias-factory-edge', 'test-truth-auction-alias-factory', 'statoblast-pool-forker', 'tests', 'Returns attacker-selected child and truth-auction addresses to fake-lineage rejection tests.'), + edge('test-truth-auction-alias-parent-edge', 'test-truth-auction-alias-parent', 'statoblast-pool-forker', 'tests', 'Models a fake parent attempting to attach an undeployed or canonical truth auction.'), + edge('test-truth-auction-alias-child-edge', 'test-truth-auction-alias-child', 'statoblast-pool-forker', 'tests', 'Records and forwards any ETH misrouted through a rejected fake child.'), +] + +const contractAtlasNodeById = new Map(contractAtlasNodes.map(atlasNode => [atlasNode.id, atlasNode])) +const semanticPairIds = new Set(contractAtlasSemanticEdges.map(atlasEdge => `${atlasEdge.source}->${atlasEdge.target}`)) +const behavioralReferenceVerbs: Record<(typeof contractAtlasBehavioralReferences)[number]['relation'], string> = { + calls: 'Calls', + tests: 'Test helper invokes', + uses: 'Uses', +} +const contractAtlasBehavioralEdges = contractAtlasBehavioralReferences.flatMap(reference => { + if (contractAtlasSemanticEdges.some(atlasEdge => atlasEdge.source === reference.source && atlasEdge.target === reference.target && contractAtlasBehavioralRelationIsCovered(reference.relation, atlasEdge.relation))) return [] + const targetNode = contractAtlasNodeById.get(reference.target) + if (targetNode === undefined) throw new Error(`Contract atlas behavioral reference targets missing node ${reference.target}`) + const memberLabel = reference.members.length === 1 ? 'member' : 'members' + return [edge(`source-behavior-${reference.source}--${reference.target}`, reference.source, reference.target, reference.relation, `${behavioralReferenceVerbs[reference.relation]} ${targetNode.label} ${memberLabel} ${reference.members.join(', ')}.`)] +}) +const specificPairIds = new Set([...semanticPairIds, ...contractAtlasBehavioralEdges.map(atlasEdge => `${atlasEdge.source}->${atlasEdge.target}`)]) +const contractAtlasSourceReferenceEdges = contractAtlasSourceReferences.flatMap(reference => { + if (specificPairIds.has(`${reference.source}->${reference.target}`)) return [] + const targetNode = contractAtlasNodeById.get(reference.target) + if (targetNode === undefined) throw new Error(`Contract atlas source reference targets missing node ${reference.target}`) + return [edge(`source-reference-${reference.source}--${reference.target}`, reference.source, reference.target, 'references', `Directly references ${reference.symbols.join(', ')} from the ${targetNode.label} source unit.`)] +}) + +export const contractAtlasEdges: ContractAtlasEdge[] = [...contractAtlasSemanticEdges, ...contractAtlasBehavioralEdges, ...contractAtlasSourceReferenceEdges] + +const contractAtlasPlotRouteByPair = new Map() +for (const atlasEdge of contractAtlasEdges) { + const pair = `${atlasEdge.source}->${atlasEdge.target}` + const route = contractAtlasPlotRouteByPair.get(pair) + if (route === undefined) { + contractAtlasPlotRouteByPair.set(pair, { + edges: [atlasEdge], + id: `plot-route-${atlasEdge.source}--${atlasEdge.target}`, + source: atlasEdge.source, + target: atlasEdge.target, + }) + } else { + route.edges.push(atlasEdge) + } +} + +export const contractAtlasPlotRoutes = [...contractAtlasPlotRouteByPair.values()] + +export const contractAtlasDefaultView: ContractAtlasView = 'protocol' + +export const contractAtlasViewDefinitions: ContractAtlasViewDefinition[] = [ + { + description: 'Runtime calls, asset movement, deployments, and delegatecalls.', + id: 'protocol', + label: 'Protocol flow', + relations: ['calls', 'assets', 'deploys', 'delegatecall'], + }, + { + description: 'Inheritance, implementations, compatibility, and library or type use.', + id: 'structure', + label: 'Type structure', + relations: ['inherits', 'implements', 'compatible', 'uses'], + }, + { + description: 'Direct source references not replaced by a more specific relationship.', + id: 'references', + label: 'Source references', + relations: ['references'], + }, + { + description: 'Test-only behavior routed to repeated production gateways.', + id: 'tests', + label: 'Test exercise', + relations: ['tests'], + }, + { + description: 'Every relationship layer at once. This completeness view is intentionally dense.', + id: 'all', + label: 'All routes', + relations: ['calls', 'assets', 'deploys', 'delegatecall', 'inherits', 'implements', 'compatible', 'uses', 'references', 'tests'], + }, +] + +export function contractAtlasViewDefinition(viewId: string | undefined): ContractAtlasViewDefinition { + const resolvedViewId = viewId ?? contractAtlasDefaultView + const definition = contractAtlasViewDefinitions.find(candidate => candidate.id === resolvedViewId) + if (definition === undefined) throw new Error(`Unknown contract atlas view ${resolvedViewId}`) + return definition +} + +export function contractAtlasPlotRoutesForView(view: ContractAtlasViewDefinition): ContractAtlasPlotRoute[] { + const relations = new Set(view.relations) + return contractAtlasPlotRoutes.filter(route => route.edges.some(atlasEdge => relations.has(atlasEdge.relation))) +} + +export function contractAtlasPlotRouteMeaning(route: ContractAtlasPlotRoute): string { + return route.edges.map(atlasEdge => `${contractAtlasRelationLabels[atlasEdge.relation]}: ${atlasEdge.description}`).join('\n') +} + +export const contractAtlasRelationshipRows = contractAtlasEdges.map(atlasEdge => { + const source = contractAtlasNodeById.get(atlasEdge.source) + const target = contractAtlasNodeById.get(atlasEdge.target) + if (source === undefined || target === undefined) { + throw new Error(`Contract atlas relationship ${atlasEdge.id} has a missing source or target`) + } + return { edge: atlasEdge, source, target } +}) diff --git a/docs/charts/contractAtlasBehavioralReferences.ts b/docs/charts/contractAtlasBehavioralReferences.ts new file mode 100644 index 000000000..9864c6eab --- /dev/null +++ b/docs/charts/contractAtlasBehavioralReferences.ts @@ -0,0 +1,226 @@ +export type ContractAtlasBehavioralReference = { + members: string[] + relation: 'calls' | 'tests' | 'uses' + source: string + target: string +} + +export function contractAtlasBehavioralRelationIsCovered(behavioralRelation: ContractAtlasBehavioralReference['relation'], atlasRelation: string): boolean { + return behavioralRelation === 'calls' ? atlasRelation === 'calls' || atlasRelation === 'assets' : behavioralRelation === atlasRelation +} + +const contractAtlasBehavioralReferenceRows: readonly (readonly [source: string, target: string, relation: ContractAtlasBehavioralReference['relation'], ...members: string[]])[] = [ + ['openoracle-core', 'openoracle-ierc20', 'calls', 'transfer'], + ['openoracle-safe-erc20', 'openoracle-ierc1363', 'calls', 'approveAndCall', 'transferAndCall', 'transferFromAndCall'], + ['openoracle-safe-erc20', 'openoracle-ierc20', 'calls', 'allowance', 'approve', 'transfer', 'transferFrom'], + ['statoblast-auction-settlement-base', 'statoblast-security-pool-interface', 'calls', 'addFeeEligibleSecurityBondAllowance', 'configureVault', 'poolOwnershipDenominator', 'securityVaults', 'updateVaultFees'], + ['statoblast-escalation-carry', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-escalation-carry', 'statoblast-forker-interface', 'calls', 'getDirectlyClaimedEscalationPrincipal'], + ['statoblast-escalation-carry', 'statoblast-merkle-mountain-range', 'uses', 'hashLeaf', 'hashParent'], + ['statoblast-escalation-carry', 'zoltar-constants', 'uses', 'MINIMUM_FORK_BURN_DIVISOR'], + ['statoblast-escalation-deposit-delegate', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-escalation-escrow', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-escalation-game', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-escalation-game', 'statoblast-escalation-proof-verifier', 'calls', 'computeLnRatioScaled'], + ['statoblast-escalation-game-factory', 'statoblast-escalation-game', 'calls', 'start', 'startFromFork'], + ['statoblast-escalation-game-forker', 'statoblast-security-pool-interface', 'calls', 'configureVault', 'escalationGame', 'securityVaults', 'systemState'], + ['statoblast-escalation-game-forker', 'statoblast-security-pool-utils', 'uses', 'MIGRATION_TIME'], + ['statoblast-escalation-proof-verifier', 'statoblast-binary-outcomes', 'uses', 'Invalid', 'No', 'None', 'Yes'], + ['statoblast-escalation-settlement', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-escalation-state', 'statoblast-security-pool-interface', 'calls', 'securityPoolForker'], + ['statoblast-escalation-state', 'zoltar-safe-erc20-ops', 'uses', 'safeTransfer', 'using for IERC20'], + ['statoblast-forker-base', 'statoblast-escalation-game', 'calls', 'forkCarrySnapshotInitialized'], + ['statoblast-forker-base', 'statoblast-security-pool-factory-interface', 'calls', 'getSecurityPoolOriginId'], + ['statoblast-forker-base', 'statoblast-security-pool-interface', 'calls', 'awaitingForkContinuation', 'escalationGame', 'initializeForkCarrySnapshotWithResolutionBalances', 'poolOwnershipDenominator', 'repToken', 'resumeForkedEscalationGame', 'securityPoolFactory', 'setAwaitingForkContinuation', 'systemState'], + ['statoblast-forker-base', 'statoblast-security-pool-utils', 'uses', 'PRICE_PRECISION'], + ['statoblast-migration-proxy', 'zoltar-safe-erc20-ops', 'uses', 'safeApprove', 'safeTransfer', 'using for IERC20'], + [ + 'statoblast-pool-forker', + 'statoblast-security-pool-interface', + 'calls', + 'activateForkMode', + 'completeSetCollateralAmount', + 'escalationGame', + 'initializeForkedEscalationGame', + 'parent', + 'poolOwnershipDenominator', + 'questionId', + 'repToken', + 'setOwnershipDenominator', + 'setSystemState', + 'setTotalShares', + 'shareToken', + 'shareTokenSupply', + 'systemState', + 'universeId', + 'updateCollateralAmount', + 'updateRetentionRate', + ], + ['statoblast-pool-forker', 'zoltar-safe-erc20-ops', 'uses', 'safeTransfer', 'using for IERC20'], + [ + 'statoblast-price-coordinator', + 'statoblast-security-pool-interface', + 'calls', + 'completeSetCollateralAmount', + 'getTotalRepBalance', + 'isEscalationResolved', + 'performLiquidation', + 'performSetSecurityBondsAllowance', + 'performWithdrawRep', + 'poolOwnershipDenominator', + 'poolOwnershipToRep', + 'repToPoolOwnership', + 'securityVaults', + 'statoblastSecurityMultiplierBps', + ], + ['statoblast-price-coordinator', 'statoblast-stored-open-oracle-game', 'calls', 'storedGame'], + ['statoblast-security-pool', 'statoblast-forker-interface', 'calls', 'getQuestionOutcome'], + ['statoblast-security-pool', 'statoblast-security-pool-factory-interface', 'calls', 'getSecurityPoolHasInheritedForkOutcome'], + ['statoblast-security-pool', 'statoblast-security-pool-interface', 'calls', 'priceOracleManagerAndOperatorQueuer', 'universeId'], + ['statoblast-security-pool', 'statoblast-share-token-interface', 'calls', 'authorize', 'burnCompleteSets', 'burnTokenIdAndGetRemainingSupply', 'getTokenId', 'mintCompleteSets'], + ['statoblast-security-pool', 'zoltar-safe-erc20-ops', 'uses', 'safeApprove', 'safeTransfer', 'safeTransferFrom', 'using for IERC20'], + ['statoblast-security-pool-deployer', 'statoblast-security-pool-worker', 'calls', 'deploy'], + ['statoblast-security-pool-factory', 'statoblast-security-pool-interface', 'calls', 'priceOracleManagerAndOperatorQueuer', 'setStartingParams', 'shareToken', 'universeId'], + ['statoblast-security-pool-factory', 'statoblast-security-pool-utils', 'uses', 'BPS_DENOMINATOR', 'calculateRetentionRate'], + ['statoblast-security-pool-factory', 'statoblast-share-token-interface', 'calls', 'authorize'], + ['statoblast-share-token', 'statoblast-erc1155', 'calls', '_internalBatchTransferFrom', '_internalTransferFrom'], + ['statoblast-share-token', 'statoblast-forker-interface', 'calls', 'createChildUniverse', 'initiateSecurityPoolFork'], + ['statoblast-share-token', 'zoltar-constants', 'uses', 'NUM_OUTCOMES'], + ['statoblast-vault-migration-base', 'openoracle-math', 'uses', 'ceilDiv'], + [ + 'statoblast-vault-migration-base', + 'statoblast-security-pool-interface', + 'calls', + 'authorizeChildPool', + 'completeSetCollateralAmount', + 'configureVault', + 'escalationGame', + 'feeIndex', + 'parent', + 'poolOwnershipDenominator', + 'questionId', + 'repToken', + 'securityPoolFactory', + 'securityPoolForker', + 'securityVaults', + 'setAwaitingForkContinuation', + 'setOwnershipDenominator', + 'shareToken', + 'statoblastSecurityMultiplierBps', + 'systemState', + 'totalSecurityBondAllowance', + 'transferEth', + 'truthAuction', + 'universeId', + 'updateCollateralAmount', + 'updateVaultFees', + ], + ['statoblast-vault-migration-base', 'statoblast-security-pool-utils', 'uses', 'MIGRATION_TIME', 'PRICE_PRECISION', 'calculateRetentionRate'], + ['statoblast-vault-migration-delegate', 'statoblast-child-game-initializer', 'calls', 'initializeChildForkedEscalationGameIfNeeded'], + ['statoblast-vault-migration-delegate', 'statoblast-security-pool-interface', 'calls', 'parent', 'setPoolFinancials', 'setSystemState', 'totalSecurityBondAllowance'], + ['statoblast-vault-migration-delegate', 'statoblast-security-pool-utils', 'uses', 'MIGRATION_TIME'], + ['test-complete-set-reentrant-receiver', 'statoblast-security-pool-interface', 'tests', 'createCompleteSet'], + ['test-coverage-helpers-harness', 'statoblast-merkle-mountain-range', 'uses', 'bagPeaks', 'hashLeaf', 'hashParent'], + ['test-coverage-helpers-harness', 'statoblast-escalation-proof-verifier', 'tests', 'bagCarryPeaks', 'computeEmptyNullifierRoot', 'computeMerkleMountainRangeRootFromProof', 'computeNullifierRoot', 'getCurrentCarryPeakForLeaf'], + ['test-coverage-helpers-harness', 'statoblast-token-id', 'uses', 'getTokenId', 'getTokenIds', 'unpackTokenId'], + ['test-coverage-helpers-harness', 'zoltar-safe-erc20-ops', 'uses', 'safeApprove', 'safeTransfer', 'safeTransferFrom', 'using for IERC20'], + ['test-coverage-helpers-harness', 'zoltar-scalar-outcomes', 'uses', 'absoluteInt256', 'addInt256Uint256', 'getScalarOutcomeName', 'intToDecimalString', 'mulDiv', 'uintToString', 'zeroPadLeft'], + ['test-escalation-factory-coverage-pool', 'statoblast-binary-outcomes', 'uses', 'None'], + ['test-escalation-forker-harness', 'statoblast-escalation-game', 'tests', 'exportForkedEscrowByOutcomeWithoutTransfer', 'exportVaultUnresolvedTotalsWithoutTransfer', 'recordForkedEscrowForOutcome'], + [ + 'test-escalation-proof-pool', + 'statoblast-escalation-game', + 'tests', + 'claimDepositForWinning', + 'drainAllRep', + 'exportForkedEscrowByOutcome', + 'exportForkedEscrowByOutcomeWithoutTransfer', + 'exportUnresolvedDeposit', + 'exportVaultUnresolvedTotals', + 'getFinalQuestionResolution', + 'initializeForkCarrySnapshotWithResolutionBalances', + 'previewDepositOnOutcome', + 'recordDepositFromSecurityPool', + 'recordForkedEscrowForOutcome', + 'sweepResidualRepToSecurityPool', + 'withdrawDeposit', + ], + ['test-escalation-proof-pool', 'zoltar-core', 'tests', 'burnRep', 'getRepToken'], + ['test-escalation-proof-pool', 'zoltar-reputation-token', 'tests', 'approve', 'transferFrom'], + ['test-forker-escrow-game', 'statoblast-binary-outcomes', 'uses', 'None'], + ['test-forker-escrow-game', 'zoltar-reputation-token', 'tests', 'balanceOf', 'transfer'], + ['test-forker-escrow-parent', 'test-forker-escrow-game', 'tests', 'drainToForker'], + ['test-forker-escrow-parent', 'zoltar-reputation-token', 'tests', 'balanceOf', 'transfer'], + ['test-forker-malicious-emitter', 'statoblast-security-pool-interface', 'tests', 'completeSetCollateralAmount', 'transferEth'], + ['test-incompatible-proof-verifier', 'statoblast-merkle-mountain-range', 'uses', 'hashParent'], + ['test-openoracle-rejecting-receiver', 'test-openoracle-adversarial-target', 'tests', 'getETHProtocolFees'], + ['test-safe-erc20-ops-harness', 'zoltar-safe-erc20-ops', 'uses', 'safeApprove', 'safeTransfer', 'safeTransferFrom', 'using for IERC20'], + ['test-share-token-authorization-pool', 'statoblast-share-token-interface', 'tests', 'authorize'], + ['test-truth-auction-alias-parent', 'zoltar-reputation-token', 'tests', 'balanceOf', 'transfer'], + ['zoltar-core', 'zoltar-reputation-token', 'calls', 'burn', 'getTotalTheoreticalSupply', 'mint', 'setMaxTheoreticalSupply'], + ['zoltar-safe-erc20-ops', 'zoltar-ierc20', 'calls', 'approve', 'transfer', 'transferFrom'], + + // Candidates whose pair and relation are already covered by a manually evidenced edge. + ['openoracle-core', 'openoracle-safe-erc20', 'uses', 'safeTransfer', 'safeTransferFrom', 'using for IERC20'], + ['openoracle-core', 'openoracle-signature-transfer', 'calls', 'permitWitnessTransferFrom'], + ['openoracle-math', 'openoracle-panic', 'uses', 'DIVISION_BY_ZERO', 'UNDER_OVERFLOW', 'panic'], + ['openoracle-math', 'openoracle-safe-cast', 'uses', 'toUint'], + ['statoblast-erc1155', 'statoblast-ierc1155-receiver', 'calls', 'onERC1155BatchReceived', 'onERC1155Received'], + ['statoblast-escalation-calculations', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-escalation-deposit-delegate', 'statoblast-escalation-deposit-context', 'calls', 'getQuestionResolution', 'hasReachedNonDecision'], + ['statoblast-escalation-deposit-delegate', 'statoblast-merkle-mountain-range', 'uses', 'hashLeaf', 'hashParent'], + ['statoblast-escalation-game-factory', 'statoblast-forker-interface', 'calls', 'getOwnForkRepBuckets', 'isEscalationWinnerHaircutPaidByFork'], + ['statoblast-escalation-game-factory', 'statoblast-security-pool-interface', 'calls', 'parent', 'repToken', 'securityPoolForker'], + ['statoblast-escalation-game-forker', 'statoblast-child-game-initializer', 'calls', 'initializeChildForkedEscalationGameIfNeeded'], + ['statoblast-escalation-game-forker', 'statoblast-escalation-game', 'calls', 'canTriggerOwnFork', 'claimDepositForWinningWithoutTransfer', 'exportForkedEscrowByOutcome', 'exportForkedEscrowByOutcomeWithoutTransfer', 'exportVaultUnresolvedTotalsWithoutTransfer', 'recordForkedEscrowForOutcome'], + ['statoblast-escalation-proof-verifier', 'statoblast-merkle-mountain-range', 'uses', 'bagPeaks', 'hashParent'], + ['statoblast-escalation-settlement', 'statoblast-forker-interface', 'calls', 'getQuestionOutcome', 'isEscalationDepositClaimedDirectly'], + ['statoblast-escalation-state', 'statoblast-escalation-proof-verifier', 'calls', 'computeEmptyNullifierRoot'], + ['statoblast-migration-proxy', 'zoltar-core', 'calls', 'addRepToMigrationBalance', 'forkUniverse', 'splitMigrationRep'], + ['statoblast-pool-forker', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-pool-forker', 'statoblast-escalation-game', 'calls', 'canTriggerOwnFork', 'getEscalationGameEndDate', 'getFinalQuestionResolution', 'getForkCarryRoots', 'getForkCarrySnapshot', 'getOutcomeBalances', 'getQuestionResolution'], + ['statoblast-pool-forker', 'statoblast-migration-proxy', 'calls', 'forkUniverse', 'lockRep'], + ['statoblast-pool-forker', 'statoblast-security-pool-utils', 'uses', 'AUCTION_TIME', 'MAX_AUCTION_VAULT_HAIRCUT_DIVISOR', 'MIGRATION_TIME', 'PRICE_PRECISION'], + ['statoblast-pool-forker', 'statoblast-truth-auction', 'calls', 'finalize', 'refundLosingBidsFor', 'startAuction', 'withdrawBids'], + ['statoblast-pool-forker', 'zoltar-core', 'calls', 'forkQuestionMatches', 'getForkThreshold', 'getForkTime', 'getMigrationRepBalance'], + ['statoblast-pool-forker', 'zoltar-reputation-token', 'calls', 'balanceOf'], + ['statoblast-price-coordinator', 'openoracle-core', 'calls', 'report', 'withdrawTo'], + ['statoblast-price-coordinator', 'openoracle-math', 'uses', 'Ceil', 'ceilDiv', 'mulDiv'], + ['statoblast-price-coordinator', 'statoblast-iweth9', 'calls', 'approve', 'transferFrom'], + ['statoblast-price-coordinator', 'statoblast-security-pool-utils', 'uses', 'BPS_DENOMINATOR', 'MIN_REP_DEPOSIT'], + ['statoblast-price-coordinator', 'zoltar-reputation-token', 'calls', 'approve', 'transferFrom'], + ['statoblast-security-pool', 'statoblast-binary-outcomes', 'uses', 'None'], + ['statoblast-security-pool', 'statoblast-deployment-worker-config', 'calls', 'eventEmitter', 'factory'], + ['statoblast-security-pool', 'statoblast-escalation-game', 'calls', 'getEscalationGameEndDate', 'hasReachedNonDecision', 'initializeForkCarrySnapshotWithResolutionBalances', 'previewDepositOnOutcome', 'recordDepositFromSecurityPool', 'resumeFromFork', 'withdrawDeposit'], + ['statoblast-security-pool', 'statoblast-escalation-game-factory', 'calls', 'deployEscalationGame', 'deployEscalationGameFromFork'], + ['statoblast-security-pool', 'statoblast-price-coordinator', 'calls', 'isPriceValid', 'setRepEthPrice'], + ['statoblast-security-pool', 'statoblast-security-pool-utils', 'uses', 'BPS_DENOMINATOR', 'MIN_REP_DEPOSIT', 'MIN_SECURITY_BOND_DEBT', 'PRICE_PRECISION', 'calculateFeeAccrual', 'calculateLiquidationTransfer', 'calculateRetentionRate', 'calculateVaultFee'], + ['statoblast-security-pool', 'zoltar-core', 'calls', 'burnRep', 'forkQuestionMatches', 'getForkTime', 'getNonDecisionThreshold', 'getRepToken'], + ['statoblast-security-pool', 'zoltar-question-data', 'calls', 'getQuestionEndDate'], + ['statoblast-security-pool', 'zoltar-reputation-token', 'calls', 'balanceOf'], + ['statoblast-security-pool-factory', 'statoblast-auction-factory', 'calls', 'deployUniformPriceDualCapBatchAuction'], + ['statoblast-security-pool-factory', 'statoblast-price-coordinator', 'calls', 'setSecurityPool'], + ['statoblast-security-pool-factory', 'statoblast-price-coordinator-factory', 'calls', 'deployPriceOracleManagerAndOperatorQueuer'], + ['statoblast-security-pool-factory', 'statoblast-security-pool-deployer', 'calls', 'deploy'], + ['statoblast-security-pool-factory', 'statoblast-share-token-factory', 'calls', 'deployShareToken'], + ['statoblast-security-pool-factory', 'zoltar-core', 'calls', 'forkQuestionMatches', 'getForkTime', 'getNonDecisionThreshold', 'getRepToken'], + ['statoblast-security-pool-factory', 'zoltar-question-data', 'calls', 'getOutcomeLabels'], + ['statoblast-share-token', 'statoblast-binary-outcomes', 'uses', 'Invalid', 'No', 'Yes'], + ['statoblast-share-token', 'statoblast-security-pool-interface', 'calls', 'parent', 'securityPoolForker', 'shareToken', 'systemState', 'universeId'], + ['statoblast-share-token', 'statoblast-token-id', 'uses', 'getTokenId', 'getTokenIds', 'unpackTokenId'], + ['statoblast-share-token', 'zoltar-core', 'calls', 'getForkTime'], + ['statoblast-truth-auction', 'openoracle-math', 'uses', 'Ceil', 'mulDiv'], + ['statoblast-vault-migration-base', 'statoblast-migration-proxy', 'calls', 'splitToChild', 'sweepChildRep'], + ['test-escalation-factory-coverage-pool', 'statoblast-escalation-game-factory', 'tests', 'deployEscalationGame', 'deployEscalationGameFromFork'], + ['zoltar-core', 'zoltar-constants', 'uses', 'BURN_ADDRESS', 'GENESIS_REPUTATION_TOKEN', 'MINIMUM_FORK_BURN_DIVISOR'], + ['zoltar-core', 'zoltar-question-data', 'calls', 'getQuestionEndDate', 'isMalformedAnswerOption'], + ['zoltar-core', 'zoltar-safe-erc20-ops', 'uses', 'safeTransfer', 'safeTransferFrom', 'using for IERC20'], + ['zoltar-question-data', 'zoltar-scalar-outcomes', 'uses', 'getScalarOutcomeName'], +] + +export const contractAtlasBehavioralReferences: ContractAtlasBehavioralReference[] = contractAtlasBehavioralReferenceRows.map(([source, target, relation, ...members]) => ({ + members, + relation, + source, + target, +})) diff --git a/docs/charts/contractAtlasSemanticEvidence.ts b/docs/charts/contractAtlasSemanticEvidence.ts new file mode 100644 index 000000000..fce25f090 --- /dev/null +++ b/docs/charts/contractAtlasSemanticEvidence.ts @@ -0,0 +1,779 @@ +import type { ContractAtlasRelation } from './contractAtlas' + +type ContractAtlasCheckedRelation = Extract + +type ContractAtlasEvidenceLocation = { + nodeId: string + selectors: string[] +} + +export type ContractAtlasSemanticClaimEvidence = { + callSide?: 'inherited-source' | 'receiver' + locations: ContractAtlasEvidenceLocation[] + phrase: string +} + +type ContractAtlasAssetFlowEvidence = { + locations: ContractAtlasEvidenceLocation[] + recipient: string + sender: string +} + +export type ContractAtlasCompatibilityEvidence = { + members: { + name: string + sourceSelector: string + targetSelector: string + }[] + source: string + target: string +} + +export type ContractAtlasTestExecutionEvidence = { + file: string + scope?: { + selectors: string[] + testName: string + } + sourceSelectors: string[] + target: string + targetLocations: ContractAtlasEvidenceLocation[] + targetSelectors: string[] +} + +export type ContractAtlasSemanticEvidence = { + assetFlows?: ContractAtlasAssetFlowEvidence[] + edgeId: string + locations: ContractAtlasEvidenceLocation[] + relation: ContractAtlasCheckedRelation + source: string + target: string +} + +function location(nodeId: string, ...selectors: string[]): ContractAtlasEvidenceLocation { + return { nodeId, selectors } +} + +function evidence(edgeId: string, source: string, target: string, relation: Exclude, locations: ContractAtlasEvidenceLocation[]): ContractAtlasSemanticEvidence { + return { edgeId, locations, relation, source, target } +} + +function flow(sender: string, recipient: string, ...locations: ContractAtlasEvidenceLocation[]): ContractAtlasAssetFlowEvidence { + return { locations, recipient, sender } +} + +function assetEvidence(edgeId: string, source: string, target: string, ...assetFlows: ContractAtlasAssetFlowEvidence[]): ContractAtlasSemanticEvidence { + return { assetFlows, edgeId, locations: [], relation: 'assets', source, target } +} + +function claim(phrase: string, ...locations: ContractAtlasEvidenceLocation[]): ContractAtlasSemanticClaimEvidence { + return { locations, phrase } +} + +function inheritedCallClaim(phrase: string, ...locations: ContractAtlasEvidenceLocation[]): ContractAtlasSemanticClaimEvidence { + return { callSide: 'inherited-source', locations, phrase } +} + +function receiverClaim(phrase: string, ...locations: ContractAtlasEvidenceLocation[]): ContractAtlasSemanticClaimEvidence { + return { callSide: 'receiver', locations, phrase } +} + +export const contractAtlasCompatibilityEvidence: Record = { + 'worker-config-interface': { + members: [ + { + name: 'factory', + sourceSelector: 'ISecurityPoolFactory public immutable factory', + targetSelector: 'function factory() external view returns (ISecurityPoolFactory)', + }, + { + name: 'eventEmitter', + sourceSelector: 'SecurityPoolEventEmitter public immutable eventEmitter', + targetSelector: 'function eventEmitter() external view returns (SecurityPoolEventEmitter)', + }, + ], + source: 'statoblast-security-pool-worker', + target: 'statoblast-deployment-worker-config', + }, + 'weth-interface': { + members: [ + { name: 'name', sourceSelector: 'string public name', targetSelector: 'function name() external view returns (string memory)' }, + { name: 'symbol', sourceSelector: 'string public symbol', targetSelector: 'function symbol() external view returns (string memory)' }, + { name: 'decimals', sourceSelector: 'uint8 public decimals', targetSelector: 'function decimals() external view returns (uint8)' }, + { name: 'balanceOf', sourceSelector: 'mapping(address => uint) public balanceOf', targetSelector: 'function balanceOf(address account) external view returns (uint)' }, + { name: 'allowance', sourceSelector: 'mapping(address => mapping(address => uint)) public allowance', targetSelector: 'function allowance(address owner, address spender) external view returns (uint)' }, + { name: 'deposit', sourceSelector: 'function deposit() public payable', targetSelector: 'function deposit() external payable' }, + { name: 'withdraw', sourceSelector: 'function withdraw(uint wad) external', targetSelector: 'function withdraw(uint wad) external' }, + { name: 'totalSupply', sourceSelector: 'function totalSupply() external view returns (uint)', targetSelector: 'function totalSupply() external view returns (uint)' }, + { name: 'approve', sourceSelector: 'function approve(address guy, uint wad) external returns (bool)', targetSelector: 'function approve(address guy, uint wad) external returns (bool)' }, + { name: 'transfer', sourceSelector: 'function transfer(address dst, uint wad) external returns (bool)', targetSelector: 'function transfer(address dst, uint wad) external returns (bool)' }, + { name: 'transferFrom', sourceSelector: 'function transferFrom(address src, address dst, uint wad) public returns (bool)', targetSelector: 'function transferFrom(address src, address dst, uint wad) external returns (bool)' }, + ], + source: 'infra-weth9', + target: 'statoblast-iweth9', + }, +} + +export const contractAtlasTestExecutionEvidence: Record = { + 'test-complete-set-reentrancy': { + file: 'solidity/ts/tests/securityRegression.test.ts', + sourceSelectors: ['test_peripherals_CompleteSetReentrantReceiver_CompleteSetReentrantReceiver.abi'], + target: 'statoblast-security-pool', + targetLocations: [location('statoblast-security-pool', 'function createCompleteSet() external payable')], + targetSelectors: ['peripherals_SecurityPool_SecurityPool.abi'], + }, + 'test-escalation-factory-pool': { + file: 'solidity/ts/tests/coverageHelpers.test.ts', + sourceSelectors: ['test_peripherals_CoverageHelpersHarness_EscalationGameFactoryCoverageSecurityPool.abi'], + target: 'statoblast-escalation-game-factory', + targetLocations: [location('statoblast-escalation-game-factory', 'function deployEscalationGame(')], + targetSelectors: ['peripherals_factories_EscalationGameFactory_EscalationGameFactory.abi'], + }, + 'test-non-receiver': { + file: 'solidity/ts/tests/erc1155.test.ts', + sourceSelectors: ['test_peripherals_ERC1155ReceiverMock_ERC1155NonReceiver.abi'], + target: 'statoblast-erc1155', + targetLocations: [location('statoblast-erc1155', 'function safeTransferFrom(')], + targetSelectors: ['peripherals_tokens_ShareToken_ShareToken.abi'], + }, + 'test-threshold-zoltar': { + file: 'solidity/ts/tests/escalationGameForkThreshold.test.ts', + sourceSelectors: ['test_peripherals_EscalationGameForkThresholdHarness_EscalationGameForkBoundaryZoltar.abi'], + target: 'zoltar-core', + targetLocations: [location('zoltar-core', 'function getForkThreshold(')], + targetSelectors: ['Zoltar_Zoltar.abi'], + }, + 'test-threshold-pool': { + file: 'solidity/ts/tests/escalationGameForkThreshold.test.ts', + scope: { + selectors: ['test_peripherals_EscalationGameForkThresholdHarness_EscalationGameForkBoundarySecurityPool.abi', 'args: [zoltar]', 'test_peripherals_EscalationGameForkThresholdHarness_EscalationGameForkThresholdHarness.abi', 'args: [securityPool, proofVerifier]', "functionName: 'computeWinningWithdrawal'"], + testName: 'reduced-threshold scaling remains active immediately before and exactly at game end, but not one second after', + }, + sourceSelectors: ['test_peripherals_EscalationGameForkThresholdHarness_EscalationGameForkBoundarySecurityPool.abi'], + target: 'statoblast-escalation-calculations', + targetLocations: [location('statoblast-escalation-calculations', 'function _computeWinningWithdrawal(')], + targetSelectors: ["functionName: 'computeWinningWithdrawal'"], + }, + 'test-escalation-forker-edge': { + file: 'solidity/ts/tests/escalationGame.test.ts', + sourceSelectors: ['escalationGameForkerHarnessArtifact.abi'], + target: 'statoblast-escalation-game-forker', + targetLocations: [location('statoblast-escalation-game-forker', 'function claimForkedEscalationDeposits(')], + targetSelectors: ['peripherals_SecurityPoolForker_SecurityPoolForker.abi'], + }, + 'test-proof-pool-edge': { + file: 'solidity/ts/tests/escalationGame.test.ts', + sourceSelectors: ['escalationGameProofTestPoolArtifact.abi'], + target: 'statoblast-escalation-proof-verifier', + targetLocations: [location('statoblast-escalation-proof-verifier', 'function computeEmptyNullifierRoot(')], + targetSelectors: ['peripherals_EscalationGameProofVerifier_EscalationGameProofVerifier.abi'], + }, + 'test-incompatible-verifier-edge': { + file: 'solidity/ts/tests/escalationGame.test.ts', + sourceSelectors: ['incompatibleProofVerifierArtifact.abi'], + target: 'statoblast-escalation-state', + targetLocations: [location('statoblast-escalation-state', 'function _readEmptyNullifierRoot(', 'codehash == keccak256(type(EscalationGameProofVerifier).runtimeCode)')], + targetSelectors: ['peripherals_EscalationGame_EscalationGame.abi'], + }, + 'test-openoracle-receiver-edge': { + file: 'solidity/ts/tests/openOracleDispute.test.ts', + sourceSelectors: ['rejectingEthReceiverArtifact.abi'], + target: 'openoracle-core', + targetLocations: [location('openoracle-core', 'function _withdraw(', '(to).call{ value: amount }(')], + targetSelectors: ['peripherals_openOracle_OpenOracle_OpenOracle.abi'], + }, + 'test-own-fork-claim-edge': { + file: 'solidity/ts/tests/peripherals/deploymentAndOwnForkEscalation.test.ts', + sourceSelectors: ['test_peripherals_OwnForkEscalationClaimHarness_OwnForkEscalationClaimHarness.abi'], + target: 'statoblast-escalation-game-forker', + targetLocations: [location('statoblast-escalation-game-forker', 'function claimForkedEscalationDeposits(')], + targetSelectors: ['peripherals_SecurityPoolForker_SecurityPoolForker.abi'], + }, + 'test-safe-ops-edge': { + file: 'solidity/ts/tests/safeErc20.test.ts', + sourceSelectors: ['test_peripherals_SafeERC20OpsHarness_SafeERC20OpsHarness.abi'], + target: 'zoltar-safe-erc20-ops', + targetLocations: [location('zoltar-safe-erc20-ops', 'function safeTransferFrom(')], + targetSelectors: ["functionName: 'safeTransferFromToken'"], + }, + 'test-ancestor-edge': { + file: 'solidity/ts/tests/escalationGame.test.ts', + sourceSelectors: ['securityPoolAncestorTestNodeArtifact.abi'], + target: 'statoblast-pool-forker', + targetLocations: [location('statoblast-pool-forker', 'function isEscalationDepositClaimedDirectly(')], + targetSelectors: ['peripherals_SecurityPoolForker_SecurityPoolForker.abi'], + }, + 'test-constructor-zoltar-edge': { + file: 'solidity/ts/tests/safeErc20.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolConstructorFailureZoltar_SecurityPoolConstructorFailureZoltar.abi'], + target: 'statoblast-security-pool', + targetLocations: [location('statoblast-security-pool', 'constructor(')], + targetSelectors: ['peripherals_factories_SecurityPoolDeployer_SecurityPoolDeploymentWorker.abi'], + }, + 'test-malicious-emitter-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerMaliciousEventEmitter.abi'], + target: 'statoblast-event-emitter', + targetLocations: [location('statoblast-event-emitter', 'function emitForkSnapshotEvents(')], + targetSelectors: ['peripherals_SecurityPoolForker_SecurityPoolForker.abi', 'initiateSecurityPoolFork('], + }, + 'test-fake-pool-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerFakePoolMock.abi'], + target: 'statoblast-security-pool-interface', + targetLocations: [location('statoblast-security-pool-interface', 'function securityPoolEventEmitter(')], + targetSelectors: ['peripherals_SecurityPoolForker_SecurityPoolForker.abi', 'initiateSecurityPoolFork('], + }, + 'test-attack-factory-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerAttackFactoryMock.abi'], + target: 'statoblast-security-pool-factory-interface', + targetLocations: [location('statoblast-security-pool-factory-interface', 'function deployChildSecurityPool(')], + targetSelectors: ['peripherals_factories_SecurityPoolFactory_SecurityPoolFactory.abi', 'createChildUniverse('], + }, + 'test-attack-parent-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerAttackParentMock.abi'], + target: 'statoblast-pool-forker', + targetLocations: [location('statoblast-pool-forker', 'function createChildUniverse(')], + targetSelectors: ['peripherals_SecurityPoolForker_SecurityPoolForker.abi', 'createChildUniverse('], + }, + 'test-escrow-factory-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerEscrowAttackFactoryMock.abi'], + target: 'statoblast-security-pool-factory-interface', + targetLocations: [location('statoblast-security-pool-factory-interface', 'function deployChildSecurityPool(')], + targetSelectors: ['peripherals_factories_SecurityPoolFactory_SecurityPoolFactory.abi', 'claimForkedEscalationDeposits('], + }, + 'test-escrow-game-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerEscrowAttackGameMock.abi'], + target: 'statoblast-escalation-game', + targetLocations: [location('statoblast-escalation-carry', 'function getForkCarrySnapshot(')], + targetSelectors: ['peripherals_EscalationGame_EscalationGame.abi', 'claimForkedEscalationDeposits('], + }, + 'test-escrow-parent-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerEscrowAttackParentMock.abi'], + target: 'statoblast-pool-forker', + targetLocations: [location('statoblast-pool-forker', 'function claimForkedEscalationDeposits(')], + targetSelectors: ['peripherals_SecurityPoolForker_SecurityPoolForker.abi', 'claimForkedEscalationDeposits('], + }, + 'test-alternating-game-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerAlternatingChildGameMock.abi'], + target: 'statoblast-escalation-game', + targetLocations: [location('statoblast-escalation-carry', 'function getForkCarrySnapshot(')], + targetSelectors: ['peripherals_EscalationGame_EscalationGame.abi', 'finalizeEscalationStateAfterAuction'], + }, + 'test-escrow-child-edge': { + file: 'solidity/ts/tests/peripherals/forkMigration.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAttackMocks_SecurityPoolForkerEscrowAttackChildMock.abi'], + target: 'statoblast-security-pool', + targetLocations: [location('statoblast-security-pool', 'function initializeForkedEscalationGame(')], + targetSelectors: ['peripherals_SecurityPool_SecurityPool.abi', 'migrateVaultWithUnresolvedEscalation('], + }, + 'test-auction-pool-edge': { + file: 'solidity/ts/tests/peripherals/truthAuction.test.ts', + sourceSelectors: ['test_peripherals_SecurityPoolForkerAuctionSettlementHarness_AuctionSettlementPoolHarness.evm.bytecode.object'], + target: 'statoblast-security-pool', + targetLocations: [location('statoblast-security-pool', 'function configureVault(')], + targetSelectors: ['peripherals_SecurityPool_SecurityPool.abi'], + }, + 'test-truth-auction-alias-share-token-edge': { + file: 'solidity/ts/tests/peripherals/truthAuctionAlias.audit.test.ts', + scope: { + selectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackShareTokenMock.abi', 'createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + testName: 'a fake lineage cannot alias or finalize a canonical truth auction', + }, + sourceSelectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackShareTokenMock.abi'], + target: 'statoblast-pool-forker', + targetLocations: [location('statoblast-pool-forker', 'function createChildUniverse(')], + targetSelectors: ['createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + }, + 'test-truth-auction-alias-factory-edge': { + file: 'solidity/ts/tests/peripherals/truthAuctionAlias.audit.test.ts', + scope: { + selectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackFactoryMock.abi', 'createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + testName: 'a fake lineage cannot alias or finalize a canonical truth auction', + }, + sourceSelectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackFactoryMock.abi'], + target: 'statoblast-pool-forker', + targetLocations: [location('statoblast-pool-forker', 'function createChildUniverse(')], + targetSelectors: ['createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + }, + 'test-truth-auction-alias-parent-edge': { + file: 'solidity/ts/tests/peripherals/truthAuctionAlias.audit.test.ts', + scope: { + selectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackParentMock.abi', 'createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + testName: 'a fake lineage cannot alias or finalize a canonical truth auction', + }, + sourceSelectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackParentMock.abi'], + target: 'statoblast-pool-forker', + targetLocations: [location('statoblast-pool-forker', 'function createChildUniverse(')], + targetSelectors: ['createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + }, + 'test-truth-auction-alias-child-edge': { + file: 'solidity/ts/tests/peripherals/truthAuctionAlias.audit.test.ts', + scope: { + selectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackChildMock.abi', 'createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + testName: 'a fake lineage cannot alias or finalize a canonical truth auction', + }, + sourceSelectors: ['test_peripherals_TruthAuctionAliasAttackMocks_TruthAuctionAliasAttackChildMock.abi'], + target: 'statoblast-pool-forker', + targetLocations: [location('statoblast-pool-forker', 'function createChildUniverse(')], + targetSelectors: ['createChildUniverse(client, attackParent, QuestionOutcome.Yes)'], + }, +} + +// Every direct-call meaning is decomposed into source-linked claims. A claim's +// phrase must occur verbatim in the rendered meaning, while its selectors pin +// that phrase to the implementation operations that make it true. +export const contractAtlasCallClaimEvidence: Record = { + 'zoltar-core-question-data': [claim('fork questions', location('zoltar-core', 'zoltarQuestionData.questionCreatedTimestamp(')), claim('end times', location('zoltar-core', 'zoltarQuestionData.getQuestionEndDate(')), claim('child outcomes', location('zoltar-core', 'zoltarQuestionData.isMalformedAnswerOption('))], + 'factory-question-data': [claim('existing Yes/No question', location('statoblast-security-pool-factory', 'questionData.questionCreatedTimestamp(', 'questionData.getOutcomeLabels('))], + 'factory-zoltar': [ + claim('universe', location('statoblast-security-pool-factory', 'zoltar.forkQuestionMatches(')), + claim('REP', location('statoblast-security-pool-factory', 'zoltar.getRepToken(')), + claim('fork', location('statoblast-security-pool-factory', 'zoltar.getForkTime(')), + claim('non-decision-threshold', location('statoblast-security-pool-factory', 'zoltar.getNonDecisionThreshold(')), + ], + 'factory-share-factory': [claim('origin lineage share token', location('statoblast-security-pool-factory', 'shareTokenFactory.deployShareToken('))], + 'factory-share-token': [claim('Authorizes', location('statoblast-security-pool-factory', 'shareToken.authorize('))], + 'factory-price-factory': [claim('REP/WETH price coordinator', location('statoblast-security-pool-factory', '.deployPriceOracleManagerAndOperatorQueuer('))], + 'factory-price-coordinator': [claim('Permanently binds', location('statoblast-security-pool-factory', 'priceOracleManagerAndOperatorQueuer.setSecurityPool('))], + 'factory-auction-factory': [claim('truth auction', location('statoblast-security-pool-factory', 'uniformPriceDualCapBatchAuctionFactory.deployUniformPriceDualCapBatchAuction('))], + 'factory-pool-deployer-call': [claim('private deployer', location('statoblast-security-pool-factory', 'securityPoolDeployer.deploy('))], + 'escalation-factory-pool': [ + claim('calling pool', location('statoblast-escalation-game-factory', 'ISecurityPool securityPool = ISecurityPool(payable(msg.sender))')), + claim('parent', location('statoblast-escalation-game-factory', 'ISecurityPool parent = child.parent()')), + claim('REP token', location('statoblast-escalation-game-factory', 'securityPool.repToken(')), + claim('shared forker configuration', location('statoblast-escalation-game-factory', 'child.securityPoolForker(')), + ], + 'escalation-factory-forker': [claim('own-fork haircut', location('statoblast-escalation-game-factory', 'isEscalationWinnerHaircutPaidByFork(')), claim('REP-bucket state', location('statoblast-escalation-game-factory', 'getOwnForkRepBuckets('))], + 'pool-worker-config': [claim('factory', location('statoblast-security-pool', 'worker.factory(')), claim('event-emitter', location('statoblast-security-pool', 'worker.eventEmitter('))], + 'pool-share-token': [ + claim('Mints', location('statoblast-security-pool', 'shareToken.mintCompleteSets(')), + claim('burns complete sets', location('statoblast-security-pool', 'shareToken.burnCompleteSets(')), + claim('redeems winning shares', location('statoblast-security-pool', 'shareToken.burnTokenIdAndGetRemainingSupply(')), + claim('authorizes child pools', location('statoblast-security-pool', 'shareToken.authorize(')), + ], + 'pool-escalation-factory': [ + claim('Lazily deploys a local game on the first deposit', location('statoblast-security-pool', 'if (address(escalationGame) == address(0x0))', 'escalationGameFactory.deployEscalationGame(')), + claim('deploys a fork-continuation game when the forker initializes inherited state', location('statoblast-security-pool', 'function initializeForkedEscalationGame(', 'external onlyForker', 'escalationGameFactory.deployEscalationGameFromFork(')), + ], + 'pool-price-coordinator': [claim('cached REP/ETH prices', location('statoblast-security-pool', 'priceOracleManagerAndOperatorQueuer.isPriceValid(', 'priceOracleManagerAndOperatorQueuer.lastPrice('))], + 'price-coordinator-pool': [ + claim('liquidation', location('statoblast-price-coordinator', 'securityPool.performLiquidation(')), + claim('withdrawal', location('statoblast-price-coordinator', 'securityPool.performWithdrawRep(')), + claim('allowance operations', location('statoblast-price-coordinator', 'securityPool.performSetSecurityBondsAllowance(')), + receiverClaim('coordinator-only pool entrypoints', location('statoblast-security-pool', 'modifier onlyValidOracle()', 'msg.sender == address(priceOracleManagerAndOperatorQueuer)')), + ], + 'openoracle-price-callback': [ + claim('Calls openOracleCallback', location('openoracle-core', 'bytes4 internal constant CALLBACK_SELECTOR = bytes4(', 'callbackContract.call{ gas: callbackGasLimit }(')), + receiverClaim('configured coordinator', location('statoblast-price-coordinator', 'callbackContract: address(this)')), + ], + 'share-token-zoltar': [claim('Derives child universes', location('statoblast-share-token', 'uint248 targetUniverseId = getChildUniverseId(')), claim('inspects fork state', location('statoblast-share-token', 'zoltar.getForkTime(', 'zoltar.universes('))], + 'share-token-pool': [claim('source', location('statoblast-share-token', 'sourcePool.systemState(')), claim('candidate canonical pools', location('statoblast-share-token', 'targetPool.parent('))], + 'share-token-forker': [claim('Activates the source fork', location('statoblast-share-token', 'forker.initiateSecurityPoolFork(')), claim('lazily creates child pools', location('statoblast-share-token', 'forker.createChildUniverse('))], + 'erc1155-receiver': [claim('single', location('statoblast-erc1155', 'IERC1155Receiver(to).onERC1155Received(')), claim('batch receiver callbacks', location('statoblast-erc1155', 'IERC1155Receiver(to).onERC1155BatchReceived('))], + 'pool-forker-runtime': [claim('resolved question outcomes', location('statoblast-security-pool', 'ISecurityPoolForker(securityPoolForker).getQuestionOutcome('))], + 'pool-zoltar-runtime': [claim('fork timing', location('statoblast-security-pool', 'zoltar.getForkTime(')), claim('burns resolution haircuts', location('statoblast-security-pool', 'zoltar.burnRep('))], + 'pool-question-runtime': [claim('market question end date', location('statoblast-security-pool', 'questionData.getQuestionEndDate('))], + 'deposit-delegate-context': [claim('active game context', location('statoblast-escalation-deposit-delegate', 'IEscalationGameDepositContext(address(this)).hasReachedNonDecision('))], + 'state-proof-verifier': [claim('Pins', location('statoblast-escalation-state', 'proofVerifier = _proofVerifier', 'codehash == keccak256(type(EscalationGameProofVerifier).runtimeCode)')), claim('reads', location('statoblast-escalation-state', '_proofVerifier.computeEmptyNullifierRoot('))], + 'carry-proof-verifier': [claim('Merkle Mountain Range', location('statoblast-escalation-carry', 'proofVerifier.computeMerkleMountainRangeRootFromProof(', 'proofVerifier.bagCarryPeaks(')), claim('nullifier proofs', location('statoblast-escalation-carry', 'proofVerifier.computeNullifierRoot('))], + 'escalation-settlement-pool': [claim('Returns residual REP', location('statoblast-escalation-settlement', '_safeTransferRep(address(securityPool), amount)')), claim('asks the pool to burn winner haircuts', location('statoblast-escalation-settlement', 'securityPool.burnEscalationWinnerHaircut('))], + 'escalation-settlement-forker': [ + claim('direct own-fork claim lineage', location('statoblast-escalation-settlement', 'ISecurityPoolForker(securityPool.securityPoolForker()).isEscalationDepositClaimedDirectly(')), + claim('question outcomes', location('statoblast-escalation-settlement', 'ISecurityPoolForker(securityPool.securityPoolForker()).getQuestionOutcome(')), + ], + 'auction-settlement-base-pool': [ + claim('purchased REP ownership', location('statoblast-auction-settlement-base', 'uint256 poolOwnershipAmount = amount * auctionPoolOwnershipPerRep', 'poolOwnership + poolOwnershipAmount')), + claim('auctioned allowance', location('statoblast-auction-settlement-base', 'currentSecurityBondAllowance + newSecurityBondAllowance', 'securityPool.addFeeEligibleSecurityBondAllowance(')), + claim('bidder vault accounting', location('statoblast-auction-settlement-base', 'securityPool.updateVaultFees(vault)', 'securityPool.securityVaults(vault)', 'securityPool.configureVault(')), + ], + 'proxy-zoltar': [claim('literal Zoltar migration ledger balance', location('statoblast-migration-proxy', 'zoltar.addRepToMigrationBalance(', 'zoltar.forkUniverse(', 'zoltar.splitMigrationRep('))], + 'forker-zoltar': [claim('fork thresholds', location('statoblast-pool-forker', 'zoltar.getForkThreshold(')), claim('migration balances', location('statoblast-pool-forker', 'zoltar.getMigrationRepBalance('))], + 'forker-pool': [ + claim('Freezes parents', location('statoblast-pool-forker', 'securityPool.activateForkMode(')), + claim('migrates children', location('statoblast-pool-forker', 'securityPool.setSystemState(SystemState.ForkTruthAuction)', 'securityPool.updateCollateralAmount(')), + claim('updates collateral', location('statoblast-pool-forker', 'securityPool.updateCollateralAmount(')), + claim('ownership accounting', location('statoblast-pool-forker', 'securityPool.setOwnershipDenominator(')), + receiverClaim('forker-only pool entrypoints', location('statoblast-security-pool', 'modifier onlyForker()', 'require(msg.sender == securityPoolForker,')), + ], + 'forker-game': [ + claim('Snapshots escalation state', location('statoblast-pool-forker', 'escalationGame.getForkCarrySnapshot(', 'escalationGame.getForkCarryRoots(')), + claim('resolves inherited question outcomes', location('statoblast-pool-forker', 'escalationGame.getOutcomeBalances(', 'escalationGame.getFinalQuestionResolution(')), + ], + 'vault-base-zoltar': [claim('Deploys missing child universes', location('statoblast-vault-migration-base', 'zoltar.deployChild(')), claim('reads child REP', location('statoblast-vault-migration-base', 'zoltar.getRepToken('))], + 'vault-base-factory': [claim('canonical child-pool deployment', location('statoblast-vault-migration-base', 'parent.securityPoolFactory().deployChildSecurityPool('))], + 'vault-base-pool': [claim('Copies vault, collateral, and ownership state', location('statoblast-vault-migration-base', 'child.configureVault(', 'parent.configureVault(', 'child.setOwnershipDenominator(', 'parent.transferEth('))], + 'escalation-forker-child-interface': [claim('Initializes child escalation carry snapshots', location('statoblast-escalation-game-forker', 'ISecurityPoolForkerChildEscalationGameInitializer(address(this)).initializeChildForkedEscalationGameIfNeeded('))], + 'escalation-forker-game': [ + claim('Exports', location('statoblast-escalation-game-forker', 'parentEscalationGame.exportForkedEscrowByOutcomeWithoutTransfer(', 'parentEscalationGame.exportVaultUnresolvedTotalsWithoutTransfer(')), + claim('materializes', location('statoblast-escalation-game-forker', 'childEscalationGame.recordForkedEscrowForOutcome(')), + claim('resumes', location('statoblast-escalation-game-forker', '_finalizeAwaitingForkContinuationIfReady(')), + claim('settles forked escalation state', location('statoblast-escalation-game-forker', 'escalationGame.claimDepositForWinningWithoutTransfer(')), + ], + 'escalation-forker-pool': [claim('Updates child pool escalation accounting', location('statoblast-escalation-game-forker', 'parent.configureVault(', 'child.systemState('))], + 'escalation-forker-zoltar': [inheritedCallClaim('universe', location('statoblast-vault-migration-base', 'zoltar.deployChild(')), inheritedCallClaim('REP relationships', location('statoblast-vault-migration-base', 'zoltar.getRepToken('))], + 'openoracle-permit2': [claim('Permit2 singleton', location('openoracle-core', 'ISignatureTransfer(PERMIT2).permitWitnessTransferFrom('))], + 'test-share-authorization': [claim('adding a canonical child', location('test-share-token-authorization-pool', 'shareToken.authorize('))], +} + +export const contractAtlasUseClaimEvidence: Record = { + 'zoltar-question-scalar': [claim('Decodes and names scalar outcomes', location('zoltar-question-data', 'ScalarOutcomes.getScalarOutcomeName('))], + 'zoltar-core-constants': [claim('protocol addresses', location('zoltar-core', 'Constants.GENESIS_REPUTATION_TOKEN')), claim('fork limits', location('zoltar-core', 'Constants.MINIMUM_FORK_BURN_DIVISOR'))], + 'zoltar-core-safe-erc20': [claim('checked ERC-20 calls', location('zoltar-core', 'using SafeERC20Ops for IERC20'))], + 'zoltar-core-ierc20': [claim('repository ERC-20 interface', location('zoltar-core', 'IERC20(address(reputationToken)).safeTransfer('))], + 'zoltar-safe-ops-interface': [claim('return-data checks', location('zoltar-safe-erc20-ops', 'abi.encodeCall(IERC20.transfer,', 'abi.encodeCall(IERC20.transferFrom,', 'abi.encodeCall(IERC20.approve,'))], + 'share-factory-zoltar': [claim('shared Zoltar registry', location('statoblast-share-token-factory', 'Zoltar immutable zoltar'))], + 'price-factory-weth': [claim('immutable WETH contract', location('statoblast-price-coordinator-factory', 'IWeth9 public immutable weth'))], + 'price-coordinator-pool-utils': [claim('BPS', location('statoblast-price-coordinator', 'SecurityPoolUtils.BPS_DENOMINATOR')), claim('minimum-REP constants', location('statoblast-price-coordinator', 'SecurityPoolUtils.MIN_REP_DEPOSIT'))], + 'price-coordinator-math': [claim('report funding', location('statoblast-price-coordinator', 'Math.mulDiv(initialWethReport,')), claim('risk thresholds', location('statoblast-price-coordinator', 'Math.ceilDiv(securityPool.completeSetCollateralAmount('))], + 'price-coordinator-stored-game': [claim('OpenOracle stored-game data', location('statoblast-price-coordinator', 'IStoredOpenOracleGame(address(openOracle)).storedGame('))], + 'share-token-token-id': [claim('Packs', location('statoblast-share-token', 'TokenId.getTokenId(')), claim('unpacks universe and outcome identifiers', location('statoblast-share-token', 'TokenId.unpackTokenId('))], + 'share-token-binary-outcomes': [claim('Invalid', location('statoblast-share-token', 'BinaryOutcomes.BinaryOutcome.Invalid')), claim('Yes', location('statoblast-share-token', 'BinaryOutcomes.BinaryOutcome.Yes')), claim('No token IDs', location('statoblast-share-token', 'BinaryOutcomes.BinaryOutcome.No'))], + 'pool-utils-runtime': [ + claim('fee', location('statoblast-security-pool', 'SecurityPoolUtils.calculateRetentionRate(', 'SecurityPoolUtils.calculateVaultFee(')), + claim('precision', location('statoblast-security-pool', 'SecurityPoolUtils.PRICE_PRECISION')), + claim('minimum-REP constants', location('statoblast-security-pool', 'SecurityPoolUtils.MIN_REP_DEPOSIT')), + ], + 'pool-binary-outcomes': [claim('canonical Invalid/Yes/No outcome enum', location('statoblast-security-pool', 'BinaryOutcomes.BinaryOutcome.None'))], + 'deposit-delegate-mmr': [claim('Appends canonical carry leaves', location('statoblast-escalation-deposit-delegate', 'MerkleMountainRange.hashLeaf(', 'MerkleMountainRange.hashParent('))], + 'proof-verifier-mmr': [claim('carry roots', location('statoblast-escalation-proof-verifier', 'MerkleMountainRange.bagPeaks(')), claim('proof paths', location('statoblast-escalation-proof-verifier', 'MerkleMountainRange.hashParent('))], + 'escalation-types-storage': [ + claim( + 'outcome, deposit, node, and fork-escrow structures', + location('statoblast-escalation-storage', 'OutcomeState[3] internal outcomeState', 'mapping(uint256 => Node) public nodes', 'mapping(address => mapping(uint8 => ForkedEscrowState)) internal forkedEscrowByVaultAndOutcome'), + location('statoblast-escalation-types', 'Deposit[] deposits'), + ), + ], + 'escalation-types-carry': [claim('carry', location('statoblast-escalation-carry', 'CarryLeafView[] memory carryLeaves')), claim('proof structures', location('statoblast-escalation-carry', 'CarriedDepositProof calldata proof'))], + 'escalation-binary-calculations': [claim('question-resolution results', location('statoblast-escalation-calculations', 'returns (BinaryOutcomes.BinaryOutcome outcome)')), claim('unresolved sentinels', location('statoblast-escalation-calculations', 'BinaryOutcomes.BinaryOutcome.None'))], + 'auction-math': [claim('clearing', location('statoblast-truth-auction', 'underfundedThreshold = Math.mulDiv(')), claim('pro-rata settlement', location('statoblast-truth-auction', 'uint256 cumulativeAllocationBefore = Math.mulDiv('))], + 'auction-settlement-base-types': [ + claim('typed auction claim totals', location('statoblast-auction-settlement-base', 'data.claimedAuctionRepPurchased += amount', 'data.claimedAuctionedSecurityBondAllowance = nextClaimedAuctionedSecurityBondAllowance')), + claim('per-pool fork records', location('statoblast-auction-settlement-base', 'SecurityPoolForkerForkData storage data')), + ], + 'vault-base-types': [claim('fork', location('statoblast-vault-migration-base', 'SecurityPoolForkerForkData storage childData')), claim('child-REP allocation records', location('statoblast-vault-migration-base', 'OwnForkChildRepAllocation storage allocated'))], + 'forker-storage-types': [claim('typed per-pool fork and migration mappings', location('statoblast-forker-storage', 'mapping(ISecurityPool => SecurityPoolForkerForkData) internal forkDataByPool'))], + 'forker-utils': [claim('auction timing', location('statoblast-pool-forker', 'SecurityPoolUtils.MIGRATION_TIME', 'SecurityPoolUtils.AUCTION_TIME')), claim('fixed-point precision', location('statoblast-pool-forker', 'SecurityPoolUtils.PRICE_PRECISION'))], + 'forker-binary': [claim('fixed', location('statoblast-pool-forker', 'BinaryOutcomes.BinaryOutcome(data.fixedQuestionOutcomePlusOne - 1)')), claim('unresolved binary outcomes', location('statoblast-pool-forker', 'BinaryOutcomes.BinaryOutcome.None'))], + 'openoracle-errors-edge': [claim('custom-error catalog', location('openoracle-core', 'Errors.InvalidMode('))], + 'openoracle-erc20-edge': [claim('imported ERC-20 interface', location('openoracle-core', 'IERC20(token).safeTransferFrom('))], + 'openoracle-safe-erc20-edge': [claim('OpenZeppelin safe wrappers', location('openoracle-core', 'using SafeERC20 for IERC20'))], + 'safe-erc20-interface': [claim('transfers', location('openoracle-safe-erc20', 'function safeTransfer(IERC20 token,', 'function safeTransferFrom(IERC20 token,')), claim('approvals', location('openoracle-safe-erc20', 'function safeIncreaseAllowance(IERC20 token,'))], + 'safe-erc20-1363': [claim('relaxed ERC-1363 transfer-and-call helpers', location('openoracle-safe-erc20', 'function transferAndCallRelaxed(IERC1363 token,'))], + 'math-panic': [claim('division and overflow panics', location('openoracle-math', 'Panic.panic('))], + 'math-safe-cast': [claim('comparison results', location('openoracle-math', 'SafeCast.toUint('))], +} + +export const contractAtlasSemanticMeanings: Record = { + 'zoltar-question-scalar': 'Decodes and names scalar outcomes with the shared scalar library.', + 'zoltar-core-constants': 'Reads protocol addresses and fork limits.', + 'zoltar-core-safe-erc20': 'Moves genesis REP through checked ERC-20 calls.', + 'zoltar-core-ierc20': 'Treats genesis REP as the repository ERC-20 interface.', + 'zoltar-core-question-data': 'Validates fork questions, end times, and child outcomes.', + 'zoltar-safe-ops-interface': 'Wraps repository ERC-20 calls with return-data checks.', + 'factory-question-data': 'Validates that origin markets use an existing Yes/No question.', + 'factory-zoltar': 'Reads universe, REP, fork, and non-decision-threshold state.', + 'factory-share-factory': 'Requests the origin lineage share token.', + 'factory-share-token': 'Authorizes the newly deployed origin pool on its lineage share token.', + 'share-factory-zoltar': 'Wires the shared Zoltar registry into every deployed share token.', + 'factory-price-factory': 'Requests one REP/WETH price coordinator per pool.', + 'price-factory-weth': 'Wires its immutable WETH contract into each coordinator.', + 'factory-price-coordinator': 'Permanently binds the newly deployed coordinator to its canonical pool.', + 'factory-auction-factory': 'Requests a truth auction for each child pool.', + 'factory-pool-deployer-call': 'Calls the private deployer for every origin or child pool after assembling its dependencies.', + 'worker-config-interface': 'Structurally provides the factory and event-emitter getters read through the pool constructor interface.', + 'escalation-factory-pool': 'Reads the calling pool, parent, REP token, and shared forker configuration.', + 'escalation-factory-forker': 'Reads own-fork haircut and REP-bucket state for child continuations.', + 'pool-worker-config': 'Reads its factory and event-emitter wiring from the deployment worker.', + 'pool-reputation-token': 'Uses REP token calls to move REP vault or reporter → pool, pool → escalation game or forker, and pool → redemption recipient.', + 'pool-share-token': 'Mints and burns complete sets, redeems winning shares, and authorizes child pools.', + 'pool-escalation-factory': 'Lazily deploys a local game on the first deposit, or deploys a fork-continuation game when the forker initializes inherited state.', + 'pool-escalation-game': 'Reads resolution state while reporting REP moves pool → game escrow and settled REP moves game → pool or claimant.', + 'pool-price-coordinator': 'Reads cached REP/ETH prices.', + 'price-coordinator-pool': 'Executes staged liquidation, withdrawal, and allowance operations through coordinator-only pool entrypoints after validation.', + 'price-coordinator-openoracle': 'Funds reports with WETH and REP coordinator → OpenOracle, then requests settled balances OpenOracle → sponsor.', + 'openoracle-price-callback': 'Calls openOracleCallback on the configured coordinator after report settlement.', + 'price-coordinator-weth': 'Calls WETH to move sponsor → coordinator, grants coordinator → OpenOracle allowance, and requests settled WETH OpenOracle → sponsor.', + 'price-coordinator-rep': 'Calls REP to move sponsor → coordinator, grants coordinator → OpenOracle allowance, and requests settled REP OpenOracle → sponsor.', + 'price-coordinator-pool-utils': 'Uses shared BPS and minimum-REP constants.', + 'price-coordinator-math': 'Uses checked rounding for report funding and risk thresholds.', + 'price-coordinator-stored-game': 'Uses a narrow compatibility view of OpenOracle stored-game data.', + 'share-token-token-id': 'Packs and unpacks universe and outcome identifiers.', + 'share-token-binary-outcomes': 'Maps each universe to Invalid, Yes, and No token IDs.', + 'share-token-zoltar': 'Derives child universes and inspects fork state.', + 'share-token-pool': 'Validates source and candidate canonical pools during migration and authorization.', + 'share-token-forker': 'Activates the source fork and lazily creates child pools during share migration.', + 'erc1155-receiver': 'Performs safe single and batch receiver callbacks.', + 'pool-forker-runtime': 'Reads resolved question outcomes from the shared forker.', + 'pool-zoltar-runtime': 'Reads universe fork timing and burns resolution haircuts through Zoltar.', + 'pool-question-runtime': 'Reads the market question end date.', + 'pool-utils-runtime': 'Uses shared fee, precision, and minimum-REP constants.', + 'pool-binary-outcomes': 'Uses the canonical Invalid/Yes/No outcome enum.', + 'deposit-delegate-context': 'Calls back into the active game context for view calculations.', + 'deposit-delegate-mmr': 'Appends canonical carry leaves.', + 'state-proof-verifier': 'Pins and reads the storage-free proof verifier.', + 'state-reputation-token': 'Uses REP token calls to move game escrow → claimant, pool, or fork export recipient.', + 'carry-proof-verifier': 'Verifies Merkle Mountain Range and nullifier proofs.', + 'proof-verifier-mmr': 'Computes carry roots and proof paths.', + 'escalation-types-storage': 'Stores the shared outcome, deposit, node, and fork-escrow structures.', + 'escalation-types-carry': 'Consumes the shared carry and proof structures.', + 'escalation-binary-calculations': 'Types question-resolution results and unresolved sentinels with the shared binary-outcome enum.', + 'escalation-settlement-pool': 'Returns residual REP and asks the pool to burn winner haircuts.', + 'escalation-settlement-forker': 'Checks direct own-fork claim lineage and question outcomes.', + 'auction-math': 'Uses full-precision arithmetic for clearing and pro-rata settlement.', + 'auction-settlement-base-pool': 'Credits purchased REP ownership and auctioned allowance into bidder vault accounting.', + 'auction-settlement-base-types': 'Updates typed auction claim totals in per-pool fork records.', + 'forker-proxy-assets': 'Transfers parent REP forker → migration proxy, then instructs the proxy to lock, fork, split, and sweep child REP.', + 'forker-reputation-token': 'Calls the parent REP token to transfer REP forker → stable migration proxy.', + 'proxy-zoltar': 'Owns the literal Zoltar migration ledger balance for one parent pool.', + 'proxy-reputation-token': 'Calls REP to grant proxy → Zoltar allowance and transfer minted child REP proxy → configured receiver.', + 'forker-zoltar': 'Reads fork thresholds and migration balances around proxy operations.', + 'forker-pool': 'Freezes parents, migrates children, and updates collateral and ownership accounting through forker-only pool entrypoints.', + 'forker-game': 'Snapshots escalation state and resolves inherited question outcomes.', + 'forker-auction': 'Coordinates ETH bidder → auction → forker → child pool or, for refunds, auction → bidder; purchased REP is credited as pool ownership rather than transferred.', + 'vault-base-zoltar': 'Deploys missing child universes and reads child REP.', + 'vault-base-factory': 'Requests canonical child-pool deployment.', + 'vault-base-pool': 'Copies vault, collateral, and ownership state into child pools.', + 'vault-base-proxy': 'Calls the proxy so split child REP moves migration proxy → child pools and escalation games.', + 'vault-base-types': 'Stores and mutates typed fork and child-REP allocation records.', + 'forker-storage-types': 'Owns the typed per-pool fork and migration mappings.', + 'escalation-forker-child-interface': 'Initializes child escalation carry snapshots through the narrow child API.', + 'escalation-forker-game': 'Exports, materializes, resumes, and settles forked escalation state.', + 'escalation-forker-pool': 'Updates child pool escalation accounting.', + 'escalation-forker-zoltar': 'Reads universe and REP relationships during escalation migration.', + 'forker-utils': 'Uses shared auction timing and fixed-point precision.', + 'forker-binary': 'Tracks fixed and unresolved binary outcomes.', + 'weth-interface': 'Structurally provides the WETH surface consumed through the coordinator interface.', + 'openoracle-errors-edge': 'Uses the imported custom-error catalog.', + 'openoracle-permit2': 'Pulls permit-authorized tokens through the canonical Permit2 singleton.', + 'openoracle-erc20-edge': 'Models report tokens through the imported ERC-20 interface.', + 'openoracle-safe-erc20-edge': 'Moves report tokens through OpenZeppelin safe wrappers.', + 'safe-erc20-interface': 'Wraps imported ERC-20 transfers and approvals.', + 'safe-erc20-1363': 'Supports relaxed ERC-1363 transfer-and-call helpers.', + 'math-panic': 'Reports arithmetic division and overflow panics.', + 'math-safe-cast': 'Converts comparison results for branchless arithmetic.', + 'test-complete-set-reentrancy': 'Exercises complete-set receiver reentrancy.', + 'test-escalation-factory-pool': 'Acts as a minimal pool caller for factory coverage.', + 'test-non-receiver': 'Exercises transfers to a contract without receiver support.', + 'test-share-authorization': 'Models an authorized pool adding a canonical child.', + 'test-threshold-zoltar': 'Supplies controlled fork thresholds for boundary tests.', + 'test-threshold-pool': 'Supplies controlled pool state to fork-threshold calculation tests.', + 'test-escalation-forker-edge': 'Relays escalation-forker calls for authorization tests.', + 'test-proof-pool-edge': 'Provides pool-shaped proof and carry test state.', + 'test-incompatible-verifier-edge': 'Exercises the game-state constructor proof-verifier code-hash rejection.', + 'test-openoracle-receiver-edge': 'Exercises rejected, gas-consuming, and reentrant ETH delivery.', + 'test-own-fork-claim-edge': 'Relays direct own-fork escalation claims.', + 'test-safe-ops-edge': 'Exposes checked transfer and transferFrom wrappers.', + 'test-ancestor-edge': 'Builds controlled pool ancestry graphs for direct-claim replay checks.', + 'test-constructor-zoltar-edge': 'Returns malformed Zoltar constructor dependencies.', + 'test-malicious-emitter-edge': 'Models a layout-incompatible or reverting event delegate.', + 'test-fake-pool-edge': 'Models forged child pool configuration.', + 'test-attack-factory-edge': 'Returns malicious child deployments.', + 'test-attack-parent-edge': 'Models a parent pool that redirects child deployment.', + 'test-escrow-factory-edge': 'Builds escrow-accounting attack children.', + 'test-escrow-game-edge': 'Models inconsistent escalation escrow state.', + 'test-escrow-parent-edge': 'Models malicious parent escalation migration state.', + 'test-alternating-game-edge': 'Alternates child game answers across validation reads.', + 'test-escrow-child-edge': 'Models a malicious child pool during escrow migration.', + 'test-auction-pool-edge': 'Provides controlled auction settlement accounting.', + 'test-truth-auction-alias-share-token-edge': 'Supplies an always-authorized share-token surface to fake-lineage rejection tests.', + 'test-truth-auction-alias-factory-edge': 'Returns attacker-selected child and truth-auction addresses to fake-lineage rejection tests.', + 'test-truth-auction-alias-parent-edge': 'Models a fake parent attempting to attach an undeployed or canonical truth auction.', + 'test-truth-auction-alias-child-edge': 'Records and forwards any ETH misrouted through a rejected fake child.', +} + +export const contractAtlasSemanticEvidence: ContractAtlasSemanticEvidence[] = [ + // Runtime calls. Selectors are checked inside the named declaration rather than + // merely accepting that both endpoint nodes exist. + evidence('zoltar-core-question-data', 'zoltar-core', 'zoltar-question-data', 'calls', [location('zoltar-core', 'zoltarQuestionData.getQuestionEndDate(')]), + evidence('factory-question-data', 'statoblast-security-pool-factory', 'zoltar-question-data', 'calls', [location('statoblast-security-pool-factory', 'questionData.getOutcomeLabels(')]), + evidence('factory-zoltar', 'statoblast-security-pool-factory', 'zoltar-core', 'calls', [location('statoblast-security-pool-factory', 'zoltar.getNonDecisionThreshold(')]), + evidence('factory-share-factory', 'statoblast-security-pool-factory', 'statoblast-share-token-factory', 'calls', [location('statoblast-security-pool-factory', 'shareTokenFactory.deployShareToken(')]), + evidence('factory-share-token', 'statoblast-security-pool-factory', 'statoblast-share-token', 'calls', [location('statoblast-security-pool-factory', 'shareToken.authorize(')]), + evidence('factory-price-factory', 'statoblast-security-pool-factory', 'statoblast-price-coordinator-factory', 'calls', [location('statoblast-security-pool-factory', '.deployPriceOracleManagerAndOperatorQueuer(')]), + evidence('factory-price-coordinator', 'statoblast-security-pool-factory', 'statoblast-price-coordinator', 'calls', [location('statoblast-security-pool-factory', 'priceOracleManagerAndOperatorQueuer.setSecurityPool(')]), + evidence('factory-auction-factory', 'statoblast-security-pool-factory', 'statoblast-auction-factory', 'calls', [location('statoblast-security-pool-factory', 'uniformPriceDualCapBatchAuctionFactory.deployUniformPriceDualCapBatchAuction(')]), + evidence('factory-pool-deployer-call', 'statoblast-security-pool-factory', 'statoblast-security-pool-deployer', 'calls', [location('statoblast-security-pool-factory', 'securityPoolDeployer.deploy(')]), + evidence('escalation-factory-pool', 'statoblast-escalation-game-factory', 'statoblast-security-pool-interface', 'calls', [location('statoblast-escalation-game-factory', 'securityPool.repToken(')]), + evidence('escalation-factory-forker', 'statoblast-escalation-game-factory', 'statoblast-forker-interface', 'calls', [location('statoblast-escalation-game-factory', 'ISecurityPoolForker(child.securityPoolForker()).getOwnForkRepBuckets(')]), + evidence('pool-worker-config', 'statoblast-security-pool', 'statoblast-deployment-worker-config', 'calls', [location('statoblast-security-pool', 'worker.factory(', 'worker.eventEmitter(')]), + evidence('pool-share-token', 'statoblast-security-pool', 'statoblast-share-token', 'calls', [location('statoblast-security-pool', 'shareToken.mintCompleteSets(', 'shareToken.burnCompleteSets(', 'shareToken.authorize(')]), + evidence('pool-escalation-factory', 'statoblast-security-pool', 'statoblast-escalation-game-factory', 'calls', [ + location('statoblast-security-pool', 'if (address(escalationGame) == address(0x0))', 'function initializeForkedEscalationGame(', 'external onlyForker', 'escalationGameFactory.deployEscalationGame(', 'escalationGameFactory.deployEscalationGameFromFork('), + ]), + evidence('pool-price-coordinator', 'statoblast-security-pool', 'statoblast-price-coordinator', 'calls', [location('statoblast-security-pool', 'priceOracleManagerAndOperatorQueuer.isPriceValid(', 'priceOracleManagerAndOperatorQueuer.lastPrice(')]), + evidence('price-coordinator-pool', 'statoblast-price-coordinator', 'statoblast-security-pool', 'calls', [location('statoblast-price-coordinator', 'securityPool.performLiquidation(', 'securityPool.performWithdrawRep(', 'securityPool.performSetSecurityBondsAllowance(')]), + evidence('openoracle-price-callback', 'openoracle-core', 'statoblast-price-coordinator', 'calls', [location('openoracle-core', 'callbackContract.call{ gas: callbackGasLimit }(')]), + evidence('share-token-zoltar', 'statoblast-share-token', 'zoltar-core', 'calls', [location('statoblast-share-token', 'zoltar.getForkTime(')]), + evidence('share-token-pool', 'statoblast-share-token', 'statoblast-security-pool-interface', 'calls', [location('statoblast-share-token', 'sourcePool.systemState(', 'targetPool.parent(')]), + evidence('share-token-forker', 'statoblast-share-token', 'statoblast-pool-forker', 'calls', [location('statoblast-share-token', 'forker.initiateSecurityPoolFork(', 'forker.createChildUniverse(')]), + evidence('erc1155-receiver', 'statoblast-erc1155', 'statoblast-ierc1155-receiver', 'calls', [location('statoblast-erc1155', 'IERC1155Receiver(to).onERC1155Received(', 'IERC1155Receiver(to).onERC1155BatchReceived(')]), + evidence('pool-forker-runtime', 'statoblast-security-pool', 'statoblast-pool-forker', 'calls', [location('statoblast-security-pool', 'ISecurityPoolForker(securityPoolForker).getQuestionOutcome(')]), + evidence('pool-zoltar-runtime', 'statoblast-security-pool', 'zoltar-core', 'calls', [location('statoblast-security-pool', 'zoltar.burnRep(')]), + evidence('pool-question-runtime', 'statoblast-security-pool', 'zoltar-question-data', 'calls', [location('statoblast-security-pool', 'questionData.getQuestionEndDate(')]), + evidence('deposit-delegate-context', 'statoblast-escalation-deposit-delegate', 'statoblast-escalation-deposit-context', 'calls', [location('statoblast-escalation-deposit-delegate', 'IEscalationGameDepositContext(address(this)).hasReachedNonDecision(')]), + evidence('state-proof-verifier', 'statoblast-escalation-state', 'statoblast-escalation-proof-verifier', 'calls', [location('statoblast-escalation-state', '_proofVerifier.computeEmptyNullifierRoot(')]), + evidence('carry-proof-verifier', 'statoblast-escalation-carry', 'statoblast-escalation-proof-verifier', 'calls', [location('statoblast-escalation-carry', 'proofVerifier.computeMerkleMountainRangeRootFromProof(')]), + evidence('escalation-settlement-pool', 'statoblast-escalation-settlement', 'statoblast-security-pool', 'calls', [location('statoblast-escalation-settlement', 'securityPool.burnEscalationWinnerHaircut(')]), + evidence('escalation-settlement-forker', 'statoblast-escalation-settlement', 'statoblast-forker-interface', 'calls', [location('statoblast-escalation-settlement', 'ISecurityPoolForker(securityPool.securityPoolForker()).isEscalationDepositClaimedDirectly(')]), + evidence('auction-settlement-base-pool', 'statoblast-auction-settlement-base', 'statoblast-security-pool', 'calls', [ + location('statoblast-auction-settlement-base', 'securityPool.updateVaultFees(vault)', 'securityPool.securityVaults(vault)', 'securityPool.configureVault(', 'securityPool.addFeeEligibleSecurityBondAllowance('), + ]), + evidence('proxy-zoltar', 'statoblast-migration-proxy', 'zoltar-core', 'calls', [location('statoblast-migration-proxy', 'zoltar.addRepToMigrationBalance(', 'zoltar.forkUniverse(', 'zoltar.splitMigrationRep(')]), + evidence('forker-zoltar', 'statoblast-pool-forker', 'zoltar-core', 'calls', [location('statoblast-pool-forker', 'zoltar.getForkThreshold(', 'zoltar.getMigrationRepBalance(')]), + evidence('forker-pool', 'statoblast-pool-forker', 'statoblast-security-pool', 'calls', [location('statoblast-pool-forker', 'securityPool.activateForkMode(', 'securityPool.updateCollateralAmount(')]), + evidence('forker-game', 'statoblast-pool-forker', 'statoblast-escalation-game', 'calls', [location('statoblast-pool-forker', 'escalationGame.getForkCarrySnapshot(', 'escalationGame.getOutcomeBalances(')]), + evidence('vault-base-zoltar', 'statoblast-vault-migration-base', 'zoltar-core', 'calls', [location('statoblast-vault-migration-base', 'zoltar.getRepToken(', 'zoltar.deployChild(')]), + evidence('vault-base-factory', 'statoblast-vault-migration-base', 'statoblast-security-pool-factory', 'calls', [location('statoblast-vault-migration-base', 'parent.securityPoolFactory().deployChildSecurityPool(')]), + evidence('vault-base-pool', 'statoblast-vault-migration-base', 'statoblast-security-pool', 'calls', [location('statoblast-vault-migration-base', 'child.configureVault(', 'parent.configureVault(')]), + evidence('escalation-forker-child-interface', 'statoblast-escalation-game-forker', 'statoblast-child-game-initializer', 'calls', [location('statoblast-escalation-game-forker', 'ISecurityPoolForkerChildEscalationGameInitializer(address(this)).initializeChildForkedEscalationGameIfNeeded(')]), + evidence('escalation-forker-game', 'statoblast-escalation-game-forker', 'statoblast-escalation-game', 'calls', [location('statoblast-escalation-game-forker', 'escalationGame.claimDepositForWinningWithoutTransfer(', 'parentEscalationGame.exportForkedEscrowByOutcomeWithoutTransfer(')]), + evidence('escalation-forker-pool', 'statoblast-escalation-game-forker', 'statoblast-security-pool', 'calls', [location('statoblast-escalation-game-forker', 'parent.configureVault(', 'child.systemState(')]), + evidence('escalation-forker-zoltar', 'statoblast-escalation-game-forker', 'zoltar-core', 'calls', [location('statoblast-vault-migration-base', 'zoltar.getRepToken(', 'zoltar.deployChild(')]), + evidence('openoracle-permit2', 'openoracle-core', 'openoracle-signature-transfer', 'calls', [location('openoracle-core', 'ISignatureTransfer(PERMIT2).permitWitnessTransferFrom(')]), + evidence('test-share-authorization', 'test-share-token-authorization-pool', 'statoblast-share-token', 'calls', [location('test-share-token-authorization-pool', 'shareToken.authorize(')]), + + // Library, module, interface, and type use. + evidence('zoltar-question-scalar', 'zoltar-question-data', 'zoltar-scalar-outcomes', 'uses', [location('zoltar-question-data', 'ScalarOutcomes.getScalarOutcomeName(')]), + evidence('zoltar-core-constants', 'zoltar-core', 'zoltar-constants', 'uses', [location('zoltar-core', 'Constants.MINIMUM_FORK_BURN_DIVISOR')]), + evidence('zoltar-core-safe-erc20', 'zoltar-core', 'zoltar-safe-erc20-ops', 'uses', [location('zoltar-core', 'using SafeERC20Ops for IERC20')]), + evidence('zoltar-core-ierc20', 'zoltar-core', 'zoltar-ierc20', 'uses', [location('zoltar-core', 'IERC20(address(reputationToken)).safeTransfer(')]), + evidence('zoltar-safe-ops-interface', 'zoltar-safe-erc20-ops', 'zoltar-ierc20', 'uses', [location('zoltar-safe-erc20-ops', 'abi.encodeCall(IERC20.transfer,')]), + evidence('share-factory-zoltar', 'statoblast-share-token-factory', 'zoltar-core', 'uses', [location('statoblast-share-token-factory', 'Zoltar immutable zoltar')]), + evidence('price-factory-weth', 'statoblast-price-coordinator-factory', 'statoblast-iweth9', 'uses', [location('statoblast-price-coordinator-factory', 'IWeth9 public immutable weth')]), + evidence('price-coordinator-pool-utils', 'statoblast-price-coordinator', 'statoblast-security-pool-utils', 'uses', [location('statoblast-price-coordinator', 'SecurityPoolUtils.MIN_REP_DEPOSIT')]), + evidence('price-coordinator-math', 'statoblast-price-coordinator', 'openoracle-math', 'uses', [location('statoblast-price-coordinator', 'Math.mulDiv(')]), + evidence('price-coordinator-stored-game', 'statoblast-price-coordinator', 'statoblast-stored-open-oracle-game', 'uses', [location('statoblast-price-coordinator', 'IStoredOpenOracleGame(address(openOracle)).storedGame(')]), + evidence('share-token-token-id', 'statoblast-share-token', 'statoblast-token-id', 'uses', [location('statoblast-share-token', 'TokenId.getTokenId(')]), + evidence('share-token-binary-outcomes', 'statoblast-share-token', 'statoblast-binary-outcomes', 'uses', [location('statoblast-share-token', 'BinaryOutcomes.BinaryOutcome.Invalid')]), + evidence('pool-utils-runtime', 'statoblast-security-pool', 'statoblast-security-pool-utils', 'uses', [location('statoblast-security-pool', 'SecurityPoolUtils.calculateRetentionRate(')]), + evidence('pool-binary-outcomes', 'statoblast-security-pool', 'statoblast-binary-outcomes', 'uses', [location('statoblast-security-pool', 'BinaryOutcomes.BinaryOutcome.None')]), + evidence('deposit-delegate-mmr', 'statoblast-escalation-deposit-delegate', 'statoblast-merkle-mountain-range', 'uses', [location('statoblast-escalation-deposit-delegate', 'MerkleMountainRange.hashLeaf(')]), + evidence('proof-verifier-mmr', 'statoblast-escalation-proof-verifier', 'statoblast-merkle-mountain-range', 'uses', [location('statoblast-escalation-proof-verifier', 'MerkleMountainRange.bagPeaks(')]), + evidence('escalation-types-storage', 'statoblast-escalation-storage', 'statoblast-escalation-types', 'uses', [location('statoblast-escalation-storage', 'OutcomeState[3] internal outcomeState')]), + evidence('escalation-types-carry', 'statoblast-escalation-carry', 'statoblast-escalation-types', 'uses', [location('statoblast-escalation-carry', 'CarryLeafView[] memory carryLeaves')]), + evidence('escalation-binary-calculations', 'statoblast-escalation-calculations', 'statoblast-binary-outcomes', 'uses', [location('statoblast-escalation-calculations', 'BinaryOutcomes.BinaryOutcome.None')]), + evidence('auction-math', 'statoblast-truth-auction', 'openoracle-math', 'uses', [location('statoblast-truth-auction', 'Math.mulDiv(')]), + evidence('auction-settlement-base-types', 'statoblast-auction-settlement-base', 'statoblast-forker-types', 'uses', [location('statoblast-auction-settlement-base', 'SecurityPoolForkerForkData storage data')]), + evidence('vault-base-types', 'statoblast-vault-migration-base', 'statoblast-forker-types', 'uses', [location('statoblast-vault-migration-base', 'SecurityPoolForkerForkData storage childData')]), + evidence('forker-storage-types', 'statoblast-forker-storage', 'statoblast-forker-types', 'uses', [location('statoblast-forker-storage', 'mapping(ISecurityPool => SecurityPoolForkerForkData) internal forkDataByPool')]), + evidence('forker-utils', 'statoblast-pool-forker', 'statoblast-security-pool-utils', 'uses', [location('statoblast-pool-forker', 'SecurityPoolUtils.MIGRATION_TIME')]), + evidence('forker-binary', 'statoblast-pool-forker', 'statoblast-binary-outcomes', 'uses', [location('statoblast-pool-forker', 'BinaryOutcomes.BinaryOutcome.None')]), + evidence('openoracle-errors-edge', 'openoracle-core', 'openoracle-errors', 'uses', [location('openoracle-core', 'Errors.InvalidMode(')]), + evidence('openoracle-erc20-edge', 'openoracle-core', 'openoracle-ierc20', 'uses', [location('openoracle-core', 'IERC20(token).safeTransferFrom(')]), + evidence('openoracle-safe-erc20-edge', 'openoracle-core', 'openoracle-safe-erc20', 'uses', [location('openoracle-core', 'using SafeERC20 for IERC20')]), + evidence('safe-erc20-interface', 'openoracle-safe-erc20', 'openoracle-ierc20', 'uses', [location('openoracle-safe-erc20', 'function safeTransfer(IERC20 token,')]), + evidence('safe-erc20-1363', 'openoracle-safe-erc20', 'openoracle-ierc1363', 'uses', [location('openoracle-safe-erc20', 'function transferAndCallRelaxed(IERC1363 token,')]), + evidence('math-panic', 'openoracle-math', 'openoracle-panic', 'uses', [location('openoracle-math', 'Panic.panic(')]), + evidence('math-safe-cast', 'openoracle-math', 'openoracle-safe-cast', 'uses', [location('openoracle-math', 'SafeCast.toUint(')]), + + // Structural compatibility is intentional without declared inheritance. + evidence('worker-config-interface', 'statoblast-security-pool-worker', 'statoblast-deployment-worker-config', 'compatible', [location('statoblast-security-pool-worker', 'ISecurityPoolFactory public immutable factory', 'SecurityPoolEventEmitter public immutable eventEmitter')]), + evidence('weth-interface', 'infra-weth9', 'statoblast-iweth9', 'compatible', [location('infra-weth9', 'function deposit() public payable', 'function withdraw(uint wad) external', 'function transferFrom(address src, address dst, uint wad) public returns (bool)')]), + + // Test-only behavior is tied to code inside the exact test declaration. + evidence('test-complete-set-reentrancy', 'test-complete-set-reentrant-receiver', 'statoblast-security-pool', 'tests', [location('test-complete-set-reentrant-receiver', 'securityPool.createCompleteSet{ value: reentrantValue }(')]), + evidence('test-escalation-factory-pool', 'test-escalation-factory-coverage-pool', 'statoblast-escalation-game-factory', 'tests', [location('test-escalation-factory-coverage-pool', 'factory.deployEscalationGame(', 'factory.deployEscalationGameFromFork(')]), + evidence('test-non-receiver', 'test-erc1155-non-receiver', 'statoblast-erc1155', 'tests', [location('test-erc1155-non-receiver', 'contract ERC1155NonReceiver {}')]), + evidence('test-threshold-zoltar', 'test-fork-boundary-zoltar', 'zoltar-core', 'tests', [location('test-fork-boundary-zoltar', 'function getForkThreshold(uint248)')]), + evidence('test-threshold-pool', 'test-fork-boundary-pool', 'statoblast-escalation-calculations', 'tests', [location('test-fork-boundary-pool', 'Zoltar public immutable zoltar')]), + evidence('test-escalation-forker-edge', 'test-escalation-forker-harness', 'statoblast-escalation-game-forker', 'tests', [location('test-escalation-forker-harness', 'parentEscalationGame.exportForkedEscrowByOutcomeWithoutTransfer(')]), + evidence('test-proof-pool-edge', 'test-escalation-proof-pool', 'statoblast-escalation-proof-verifier', 'tests', [location('test-escalation-proof-pool', 'function initializeForkCarrySnapshotWithResolutionBalances(')]), + evidence('test-incompatible-verifier-edge', 'test-incompatible-proof-verifier', 'statoblast-escalation-state', 'tests', [location('test-incompatible-proof-verifier', 'function computeEmptyNullifierRoot(')]), + evidence('test-openoracle-receiver-edge', 'test-openoracle-rejecting-receiver', 'openoracle-core', 'tests', [location('test-openoracle-rejecting-receiver', 'receive() external payable', 'require(!rejectETH,')]), + evidence('test-own-fork-claim-edge', 'test-own-fork-claim-harness', 'statoblast-escalation-game-forker', 'tests', [location('test-own-fork-claim-harness', 'function previewOwnForkEscalationOwnershipToCredit(')]), + evidence('test-safe-ops-edge', 'test-safe-erc20-ops-harness', 'zoltar-safe-erc20-ops', 'tests', [location('test-safe-erc20-ops-harness', 'token.safeTransferFrom(')]), + evidence('test-ancestor-edge', 'test-security-pool-ancestor', 'statoblast-pool-forker', 'tests', [location('test-security-pool-ancestor', 'address public immutable parent')]), + evidence('test-constructor-zoltar-edge', 'test-constructor-failure-zoltar', 'statoblast-security-pool', 'tests', [location('test-constructor-failure-zoltar', 'return ReputationToken(address(0x1234))')]), + evidence('test-malicious-emitter-edge', 'test-forker-malicious-emitter', 'statoblast-event-emitter', 'tests', [location('test-forker-malicious-emitter', 'targetPool.transferEth(receiver, targetPool.completeSetCollateralAmount())')]), + evidence('test-fake-pool-edge', 'test-forker-fake-pool', 'statoblast-security-pool-interface', 'tests', [location('test-forker-fake-pool', 'return configuredEventEmitter')]), + evidence('test-attack-factory-edge', 'test-forker-attack-factory', 'statoblast-security-pool-factory-interface', 'tests', [location('test-forker-attack-factory', 'return (childPool, childTruthAuction)')]), + evidence('test-attack-parent-edge', 'test-forker-attack-parent', 'statoblast-pool-forker', 'tests', [location('test-forker-attack-parent', 'return configuredSecurityPoolFactory')]), + evidence('test-escrow-factory-edge', 'test-forker-escrow-factory', 'statoblast-security-pool-factory-interface', 'tests', [location('test-forker-escrow-factory', 'return (childPool, childTruthAuction)')]), + evidence('test-escrow-game-edge', 'test-forker-escrow-game', 'statoblast-escalation-game', 'tests', [location('test-forker-escrow-game', 'return (configuredDepositor, configuredClaimAmount, configuredClaimAmount)')]), + evidence('test-escrow-parent-edge', 'test-forker-escrow-parent', 'statoblast-pool-forker', 'tests', [location('test-forker-escrow-parent', 'configuredEscalationGame.drainToForker(')]), + evidence('test-alternating-game-edge', 'test-forker-alternating-game', 'statoblast-escalation-game', 'tests', [location('test-forker-alternating-game', 'return configuredForkResumedAt')]), + evidence('test-escrow-child-edge', 'test-forker-escrow-child', 'statoblast-security-pool', 'tests', [location('test-forker-escrow-child', 'if (operationalMode) useSecondOperationalEscalationGame = true')]), + evidence('test-auction-pool-edge', 'test-auction-settlement-pool', 'statoblast-security-pool', 'tests', [location('test-auction-settlement-pool', 'feeEligibleSecurityBondAllowance += amount')]), + evidence('test-truth-auction-alias-share-token-edge', 'test-truth-auction-alias-share-token', 'statoblast-pool-forker', 'tests', [location('test-truth-auction-alias-share-token', 'function isAuthorized(address)')]), + evidence('test-truth-auction-alias-factory-edge', 'test-truth-auction-alias-factory', 'statoblast-pool-forker', 'tests', [location('test-truth-auction-alias-factory', 'return (childPool, childTruthAuction)')]), + evidence('test-truth-auction-alias-parent-edge', 'test-truth-auction-alias-parent', 'statoblast-pool-forker', 'tests', [location('test-truth-auction-alias-parent', 'return configuredFactory', 'function activateForkMode() external')]), + evidence('test-truth-auction-alias-child-edge', 'test-truth-auction-alias-child', 'statoblast-pool-forker', 'tests', [location('test-truth-auction-alias-child', 'receive() external payable', 'stolenEth += msg.value')]), + + // Asset paths name the same sender and recipient wording rendered in the + // relationship register and link each direction to concrete transfer code. + assetEvidence( + 'pool-reputation-token', + 'statoblast-security-pool', + 'zoltar-reputation-token', + flow('REP vault or reporter', 'pool', location('statoblast-security-pool', 'safeTransferFrom(msg.sender, address(this), repAmount)')), + flow('pool', 'escalation game or forker', location('statoblast-security-pool', 'safeTransfer(address(escalationGame), depositedAmount)', 'safeTransfer(msg.sender, repTransferred)')), + flow('pool', 'redemption recipient', location('statoblast-security-pool', 'safeTransfer(vault, repAmount)')), + ), + assetEvidence( + 'pool-escalation-game', + 'statoblast-security-pool', + 'statoblast-escalation-game', + flow('pool', 'game escrow', location('statoblast-security-pool', 'safeTransfer(address(escalationGame), depositedAmount)')), + flow('game', 'pool or claimant', location('statoblast-escalation-settlement', '_safeTransferRep(address(securityPool), amount)', '_safeTransferRep(depositor, amountToWithdraw)')), + ), + assetEvidence( + 'price-coordinator-openoracle', + 'statoblast-price-coordinator', + 'openoracle-core', + flow('coordinator', 'OpenOracle', location('statoblast-price-coordinator', 'openOracle.report{ value: ethCost }(')), + flow('OpenOracle', 'sponsor', location('statoblast-price-coordinator', 'openOracle.withdrawTo(address(weth), type(uint256).max, sponsor)')), + ), + assetEvidence( + 'price-coordinator-weth', + 'statoblast-price-coordinator', + 'statoblast-iweth9', + flow('sponsor', 'coordinator', location('statoblast-price-coordinator', 'weth.transferFrom(sponsor, address(this), initialWethReport)')), + flow('coordinator', 'OpenOracle', location('statoblast-price-coordinator', 'weth.approve(address(openOracle), initialWethReport)')), + flow('OpenOracle', 'sponsor', location('statoblast-price-coordinator', 'openOracle.withdrawTo(address(weth), type(uint256).max, sponsor)')), + ), + assetEvidence( + 'price-coordinator-rep', + 'statoblast-price-coordinator', + 'zoltar-reputation-token', + flow('sponsor', 'coordinator', location('statoblast-price-coordinator', 'reputationToken.transferFrom(sponsor, address(this), amount2)')), + flow('coordinator', 'OpenOracle', location('statoblast-price-coordinator', 'reputationToken.approve(address(openOracle), amount2)')), + flow('OpenOracle', 'sponsor', location('statoblast-price-coordinator', 'openOracle.withdrawTo(address(reputationToken), type(uint256).max, sponsor)')), + ), + assetEvidence( + 'state-reputation-token', + 'statoblast-escalation-state', + 'zoltar-reputation-token', + flow('game escrow', 'claimant, pool, or fork export recipient', location('statoblast-escalation-state', 'IERC20(address(repToken)).safeTransfer(receiver, amount)'), location('statoblast-escalation-settlement', '_safeTransferRep(address(securityPool), amount)', '_safeTransferRep(depositor, amountToWithdraw)')), + ), + assetEvidence('forker-proxy-assets', 'statoblast-pool-forker', 'statoblast-migration-proxy', flow('forker', 'migration proxy', location('statoblast-pool-forker', 'safeTransfer(address(migrationProxy), repToLock)', 'migrationProxy.lockRep(repToLock)'))), + assetEvidence('forker-reputation-token', 'statoblast-pool-forker', 'zoltar-reputation-token', flow('forker', 'stable migration proxy', location('statoblast-pool-forker', 'safeTransfer(address(migrationProxy), repToFork)'))), + assetEvidence( + 'proxy-reputation-token', + 'statoblast-migration-proxy', + 'zoltar-reputation-token', + flow('proxy', 'Zoltar', location('statoblast-migration-proxy', 'safeApprove(address(_zoltar), type(uint256).max)')), + flow('proxy', 'configured receiver', location('statoblast-migration-proxy', 'safeTransfer(receiver, amount)')), + ), + assetEvidence( + 'forker-auction', + 'statoblast-pool-forker', + 'statoblast-truth-auction', + flow('bidder', 'auction', location('statoblast-truth-auction', '_appendBid(tick, msg.sender, msg.value)')), + flow('auction', 'forker', location('statoblast-truth-auction', 'payable(owner).call{ value: ethToSend }(')), + flow('forker', 'child pool', location('statoblast-pool-forker', 'payable(address(securityPool)).call{ value: ethReceived }(')), + flow('auction', 'bidder', location('statoblast-truth-auction', 'payable(bidder).call{ value: amount, gas: REFUND_PUSH_GAS_LIMIT }(')), + ), + assetEvidence( + 'vault-base-proxy', + 'statoblast-vault-migration-base', + 'statoblast-migration-proxy', + flow('migration proxy', 'child pools and escalation games', location('statoblast-vault-migration-base', 'migrationProxy.sweepChildRep(address(childEscalationGame), child.repToken(), childRepAmount)', 'migrationProxy.sweepChildRep(address(child), child.repToken(), pendingChildRep)')), + ), +] diff --git a/docs/charts/contractAtlasSourceReferences.ts b/docs/charts/contractAtlasSourceReferences.ts new file mode 100644 index 000000000..32ec0d31a --- /dev/null +++ b/docs/charts/contractAtlasSourceReferences.ts @@ -0,0 +1,350 @@ +export type ContractAtlasSourceReference = { + source: string + symbols: string[] + target: string +} + +export const contractAtlasSourceOwnerOverrides: Readonly> = { + 'solidity/contracts/peripherals/OpenOraclePriceCoordinator.sol': 'statoblast-price-coordinator', + 'solidity/contracts/peripherals/interfaces/ISecurityPool.sol': 'statoblast-security-pool-interface', +} + +const contractAtlasSourceReferenceRows: readonly (readonly [source: string, target: string, ...symbols: string[]])[] = [ + ['openoracle-core', 'openoracle-errors', 'Errors'], + ['openoracle-core', 'openoracle-ierc20', 'IERC20'], + ['openoracle-core', 'openoracle-safe-erc20', 'SafeERC20'], + ['openoracle-core', 'openoracle-signature-transfer', 'ISignatureTransfer'], + ['openoracle-ierc1363', 'openoracle-ierc165', 'IERC165'], + ['openoracle-ierc1363', 'openoracle-ierc20', 'IERC20'], + ['openoracle-math', 'openoracle-panic', 'Panic'], + ['openoracle-math', 'openoracle-safe-cast', 'SafeCast'], + ['openoracle-safe-erc20', 'openoracle-ierc1363', 'IERC1363'], + ['openoracle-safe-erc20', 'openoracle-ierc20', 'IERC20'], + ['statoblast-auction-factory', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['statoblast-auction-interface', 'statoblast-auction-events', 'IUniformPriceDualCapBatchAuctionEvents'], + ['statoblast-auction-settlement-base', 'statoblast-forker-base', 'SecurityPoolForkerBase'], + ['statoblast-auction-settlement-base', 'statoblast-forker-types', 'SecurityPoolForkerForkData'], + ['statoblast-auction-settlement-base', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-auction-settlement-base', 'zoltar-core', 'Zoltar'], + ['statoblast-child-game-initializer', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-child-game-initializer', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-deployment-worker-config', 'statoblast-event-emitter', 'SecurityPoolEventEmitter'], + ['statoblast-deployment-worker-config', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['statoblast-erc1155', 'statoblast-ierc1155', 'IERC1155'], + ['statoblast-erc1155', 'statoblast-ierc1155-receiver', 'IERC1155Receiver'], + ['statoblast-escalation-calculations', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-calculations', 'statoblast-escalation-state', 'EscalationGameState'], + ['statoblast-escalation-calculations', 'statoblast-escalation-types', 'ESCALATION_TIME_LENGTH', 'NonDecisionState'], + ['statoblast-escalation-carry', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-carry', 'statoblast-escalation-calculations', 'EscalationGameCalculations'], + ['statoblast-escalation-carry', 'statoblast-escalation-events', 'CarryConsumptionReason'], + ['statoblast-escalation-carry', 'statoblast-escalation-types', 'CarriedDepositProof', 'CarryLeafView', 'Deposit', 'MERKLE_MOUNTAIN_RANGE_MAX_PEAKS', 'NULLIFIER_DEPTH', 'Node', 'NonDecisionState', 'OutcomeState', 'OutcomeStateView'], + ['statoblast-escalation-carry', 'statoblast-forker-interface', 'ISecurityPoolForker'], + ['statoblast-escalation-carry', 'statoblast-merkle-mountain-range', 'MerkleMountainRange'], + ['statoblast-escalation-carry', 'zoltar-constants', 'Constants'], + ['statoblast-escalation-deposit-context', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-deposit-delegate', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-deposit-delegate', 'statoblast-escalation-deposit-context', 'IEscalationGameDepositContext'], + ['statoblast-escalation-deposit-delegate', 'statoblast-escalation-events', 'IEscalationGameEvents'], + ['statoblast-escalation-deposit-delegate', 'statoblast-escalation-storage', 'EscalationGameStorage'], + ['statoblast-escalation-deposit-delegate', 'statoblast-escalation-types', 'Deposit', 'MERKLE_MOUNTAIN_RANGE_MAX_PEAKS', 'Node', 'NonDecisionState', 'OutcomeState'], + ['statoblast-escalation-deposit-delegate', 'statoblast-merkle-mountain-range', 'MerkleMountainRange'], + ['statoblast-escalation-escrow', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-escrow', 'statoblast-escalation-carry', 'EscalationGameCarry'], + ['statoblast-escalation-escrow', 'statoblast-escalation-types', 'ForkedEscrowState', 'OutcomeState'], + ['statoblast-escalation-events', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-game', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-game', 'statoblast-escalation-deposit-delegate', 'EscalationGameDepositDelegate'], + ['statoblast-escalation-game', 'statoblast-escalation-proof-verifier', 'EscalationGameProofVerifier'], + ['statoblast-escalation-game', 'statoblast-escalation-settlement', 'EscalationGameSettlement'], + ['statoblast-escalation-game', 'statoblast-escalation-state', 'EscalationGameState'], + ['statoblast-escalation-game', 'statoblast-escalation-types', 'ESCALATION_TIME_LENGTH', 'NonDecisionState'], + ['statoblast-escalation-game', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-escalation-game', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-escalation-game-factory', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-game-factory', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-escalation-game-factory', 'statoblast-escalation-proof-verifier', 'EscalationGameProofVerifier'], + ['statoblast-escalation-game-factory', 'statoblast-forker-interface', 'ISecurityPoolForker'], + ['statoblast-escalation-game-factory', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-escalation-game-forker', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-game-forker', 'statoblast-child-game-initializer', 'ISecurityPoolForkerChildEscalationGameInitializer'], + ['statoblast-escalation-game-forker', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-escalation-game-forker', 'statoblast-forker-base', 'SecurityPoolForkerBase'], + ['statoblast-escalation-game-forker', 'statoblast-forker-types', 'EscalationMigrationEntitlement', 'SecurityPoolForkerForkData'], + ['statoblast-escalation-game-forker', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['statoblast-escalation-game-forker', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-escalation-game-forker', 'statoblast-vault-migration-base', 'SecurityPoolForkerVaultMigrationBase'], + ['statoblast-escalation-game-forker', 'zoltar-core', 'Zoltar'], + ['statoblast-escalation-proof-verifier', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-proof-verifier', 'statoblast-escalation-types', 'EXCESS_REWARD_WINDOW_DIVISOR', 'LN2_SCALED', 'MAX_ATANH_ITERATIONS', 'MAX_EXP_ITERATIONS', 'MERKLE_MOUNTAIN_RANGE_MAX_PEAKS', 'NULLIFIER_DEPTH', 'SCALE'], + ['statoblast-escalation-proof-verifier', 'statoblast-merkle-mountain-range', 'MerkleMountainRange'], + ['statoblast-escalation-settlement', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-settlement', 'statoblast-escalation-escrow', 'EscalationGameEscrow'], + ['statoblast-escalation-settlement', 'statoblast-escalation-events', 'CarryConsumptionReason'], + ['statoblast-escalation-settlement', 'statoblast-escalation-types', 'CarriedDepositProof', 'Deposit', 'NonDecisionState'], + ['statoblast-escalation-settlement', 'statoblast-forker-interface', 'ISecurityPoolForker'], + ['statoblast-escalation-state', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-state', 'statoblast-escalation-events', 'IEscalationGameEvents'], + ['statoblast-escalation-state', 'statoblast-escalation-proof-verifier', 'EscalationGameProofVerifier'], + ['statoblast-escalation-state', 'statoblast-escalation-storage', 'EscalationGameStorage'], + ['statoblast-escalation-state', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-escalation-state', 'zoltar-ierc20', 'IERC20'], + ['statoblast-escalation-state', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-escalation-state', 'zoltar-safe-erc20-ops', 'SafeERC20Ops'], + ['statoblast-escalation-storage', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-escalation-storage', 'statoblast-escalation-types', 'ForkedEscrowState', 'Node', 'NonDecisionState', 'OutcomeState'], + ['statoblast-escalation-types', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-event-emitter', 'statoblast-forker-events', 'ISecurityPoolForkerEvents'], + ['statoblast-event-emitter', 'statoblast-forker-storage', 'SecurityPoolForkerStorage'], + ['statoblast-event-emitter', 'statoblast-forker-types', 'SecurityPoolForkerForkData'], + ['statoblast-event-emitter', 'statoblast-security-pool-interface', 'AccountingReason', 'ISecurityPool', 'PoolAccountingSnapshot'], + ['statoblast-forker-base', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-forker-base', 'statoblast-forker-events', 'ISecurityPoolForkerEvents'], + ['statoblast-forker-base', 'statoblast-forker-storage', 'SecurityPoolForkerStorage'], + ['statoblast-forker-base', 'statoblast-forker-types', 'EscalationForkSnapshot', 'SecurityPoolForkerForkData'], + ['statoblast-forker-base', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['statoblast-forker-base', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['statoblast-forker-base', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-forker-base', 'zoltar-core', 'Zoltar'], + ['statoblast-forker-events', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-forker-interface', 'statoblast-auction-interface', 'IUniformPriceDualCapBatchAuction'], + ['statoblast-forker-interface', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-forker-interface', 'statoblast-forker-events', 'ISecurityPoolForkerEvents'], + ['statoblast-forker-interface', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-forker-storage', 'statoblast-forker-types', 'EscalationForkSnapshot', 'EscalationMigrationEntitlement', 'OwnForkChildRepAllocation', 'SecurityPoolForkerForkData'], + ['statoblast-forker-storage', 'statoblast-migration-proxy', 'SecurityPoolMigrationProxy'], + ['statoblast-forker-storage', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-forker-types', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['statoblast-ierc1155', 'statoblast-ierc165', 'IERC165'], + ['statoblast-ierc1155-receiver', 'statoblast-ierc165', 'IERC165'], + ['statoblast-merkle-mountain-range', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-migration-proxy', 'zoltar-core', 'Zoltar'], + ['statoblast-migration-proxy', 'zoltar-ierc20', 'IERC20'], + ['statoblast-migration-proxy', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-migration-proxy', 'zoltar-safe-erc20-ops', 'SafeERC20Ops'], + ['statoblast-pool-forker', 'statoblast-auction-interface', 'IUniformPriceDualCapBatchAuction'], + ['statoblast-pool-forker', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-pool-forker', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-pool-forker', 'statoblast-escalation-game-forker', 'EscalationGameForker'], + ['statoblast-pool-forker', 'statoblast-escalation-types', 'ESCALATION_TIME_LENGTH'], + ['statoblast-pool-forker', 'statoblast-event-emitter', 'SecurityPoolEventEmitter'], + ['statoblast-pool-forker', 'statoblast-auction-settlement-base', 'SecurityPoolForkerAuctionSettlementBase'], + ['statoblast-pool-forker', 'statoblast-forker-types', 'EscalationForkSnapshot', 'EscalationMigrationEntitlement', 'SecurityPoolForkerForkData'], + ['statoblast-pool-forker', 'statoblast-migration-proxy', 'SecurityPoolMigrationProxy'], + ['statoblast-pool-forker', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['statoblast-pool-forker', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-pool-forker', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['statoblast-pool-forker', 'statoblast-vault-migration-delegate', 'SecurityPoolForkerVaultMigrationDelegate'], + ['statoblast-pool-forker', 'zoltar-core', 'Zoltar'], + ['statoblast-pool-forker', 'zoltar-ierc20', 'IERC20'], + ['statoblast-pool-forker', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-pool-forker', 'zoltar-safe-erc20-ops', 'SafeERC20Ops'], + ['statoblast-price-coordinator', 'openoracle-core', 'OpenOracle'], + ['statoblast-price-coordinator', 'openoracle-math', 'Math'], + ['statoblast-price-coordinator', 'statoblast-iweth9', 'IWeth9'], + ['statoblast-price-coordinator', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-price-coordinator', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-price-coordinator', 'statoblast-stored-open-oracle-game', 'IStoredOpenOracleGame'], + ['statoblast-price-coordinator', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-price-coordinator-factory', 'openoracle-core', 'OpenOracle'], + ['statoblast-price-coordinator-factory', 'statoblast-iweth9', 'IWeth9'], + ['statoblast-price-coordinator-factory', 'statoblast-price-coordinator', 'OpenOraclePriceCoordinator'], + ['statoblast-price-coordinator-factory', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-security-pool', 'openoracle-core', 'OpenOracle'], + ['statoblast-security-pool', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-security-pool', 'statoblast-deployment-worker-config', 'ISecurityPoolDeploymentWorkerConfiguration'], + ['statoblast-security-pool', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-security-pool', 'statoblast-escalation-game-factory', 'EscalationGameFactory'], + ['statoblast-security-pool', 'statoblast-escalation-types', 'CarriedDepositProof'], + ['statoblast-security-pool', 'statoblast-event-emitter', 'SecurityPoolEventEmitter'], + ['statoblast-security-pool', 'statoblast-forker-interface', 'ISecurityPoolForker'], + ['statoblast-security-pool', 'statoblast-price-coordinator', 'OpenOraclePriceCoordinator'], + ['statoblast-security-pool', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['statoblast-security-pool', 'statoblast-security-pool-interface', 'AccountingReason', 'ISecurityPool', 'PoolAccountingSnapshot', 'QuestionOutcome', 'SecurityVault', 'SystemState'], + ['statoblast-security-pool', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-security-pool', 'statoblast-share-token-interface', 'IShareToken'], + ['statoblast-security-pool', 'zoltar-core', 'Zoltar'], + ['statoblast-security-pool', 'zoltar-ierc20', 'IERC20'], + ['statoblast-security-pool', 'zoltar-question-data', 'ZoltarQuestionData'], + ['statoblast-security-pool', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-security-pool', 'zoltar-safe-erc20-ops', 'SafeERC20Ops'], + ['statoblast-security-pool-deployer', 'openoracle-core', 'OpenOracle'], + ['statoblast-security-pool-deployer', 'statoblast-escalation-game-factory', 'EscalationGameFactory'], + ['statoblast-security-pool-deployer', 'statoblast-event-emitter', 'SecurityPoolEventEmitter'], + ['statoblast-security-pool-deployer', 'statoblast-price-coordinator', 'OpenOraclePriceCoordinator'], + ['statoblast-security-pool-deployer', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['statoblast-security-pool-deployer', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-security-pool-deployer', 'statoblast-security-pool-worker', 'SecurityPoolDeploymentWorker'], + ['statoblast-security-pool-deployer', 'statoblast-share-token-interface', 'IShareToken'], + ['statoblast-security-pool-deployer', 'zoltar-core', 'Zoltar'], + ['statoblast-security-pool-deployer', 'zoltar-question-data', 'ZoltarQuestionData'], + ['statoblast-security-pool-factory', 'openoracle-core', 'OpenOracle'], + ['statoblast-security-pool-factory', 'statoblast-auction-factory', 'UniformPriceDualCapBatchAuctionFactory'], + ['statoblast-security-pool-factory', 'statoblast-escalation-game-factory', 'EscalationGameFactory'], + ['statoblast-security-pool-factory', 'statoblast-forker-interface', 'ISecurityPoolForker'], + ['statoblast-security-pool-factory', 'statoblast-price-coordinator', 'OpenOraclePriceCoordinator'], + ['statoblast-security-pool-factory', 'statoblast-price-coordinator-factory', 'PriceOracleManagerAndOperatorQueuerFactory'], + ['statoblast-security-pool-factory', 'statoblast-security-pool-deployer', 'SecurityPoolDeployer'], + ['statoblast-security-pool-factory', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['statoblast-security-pool-factory', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-security-pool-factory', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-security-pool-factory', 'statoblast-share-token-factory', 'ShareTokenFactory'], + ['statoblast-security-pool-factory', 'statoblast-share-token-interface', 'IShareToken'], + ['statoblast-security-pool-factory', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['statoblast-security-pool-factory', 'zoltar-core', 'Zoltar'], + ['statoblast-security-pool-factory', 'zoltar-question-data', 'ZoltarQuestionData'], + ['statoblast-security-pool-factory', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-security-pool-factory-interface', 'statoblast-price-coordinator', 'OpenOraclePriceCoordinator'], + ['statoblast-security-pool-factory-interface', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-security-pool-factory-interface', 'statoblast-share-token-interface', 'IShareToken'], + ['statoblast-security-pool-factory-interface', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['statoblast-security-pool-interface', 'openoracle-core', 'OpenOracle'], + ['statoblast-security-pool-interface', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-security-pool-interface', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-security-pool-interface', 'statoblast-escalation-types', 'CarriedDepositProof'], + ['statoblast-security-pool-interface', 'statoblast-price-coordinator', 'OpenOraclePriceCoordinator'], + ['statoblast-security-pool-interface', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['statoblast-security-pool-interface', 'statoblast-share-token-interface', 'IShareToken'], + ['statoblast-security-pool-interface', 'zoltar-core', 'Zoltar'], + ['statoblast-security-pool-interface', 'zoltar-question-data', 'ZoltarQuestionData'], + ['statoblast-security-pool-interface', 'zoltar-reputation-token', 'ReputationToken'], + ['statoblast-security-pool-worker', 'openoracle-core', 'OpenOracle'], + ['statoblast-security-pool-worker', 'statoblast-escalation-game-factory', 'EscalationGameFactory'], + ['statoblast-security-pool-worker', 'statoblast-event-emitter', 'SecurityPoolEventEmitter'], + ['statoblast-security-pool-worker', 'statoblast-price-coordinator', 'OpenOraclePriceCoordinator'], + ['statoblast-security-pool-worker', 'statoblast-security-pool', 'SecurityPool'], + ['statoblast-security-pool-worker', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['statoblast-security-pool-worker', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-security-pool-worker', 'statoblast-share-token-interface', 'IShareToken'], + ['statoblast-security-pool-worker', 'zoltar-core', 'Zoltar'], + ['statoblast-security-pool-worker', 'zoltar-question-data', 'ZoltarQuestionData'], + ['statoblast-share-token', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-share-token', 'statoblast-erc1155', 'ERC1155'], + ['statoblast-share-token', 'statoblast-forker-interface', 'ISecurityPoolForker'], + ['statoblast-share-token', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['statoblast-share-token', 'statoblast-share-token-interface', 'IShareToken'], + ['statoblast-share-token', 'statoblast-token-id', 'TokenId'], + ['statoblast-share-token', 'zoltar-constants', 'Constants'], + ['statoblast-share-token', 'zoltar-core', 'Zoltar'], + ['statoblast-share-token-factory', 'statoblast-share-token', 'ShareToken'], + ['statoblast-share-token-factory', 'zoltar-core', 'Zoltar'], + ['statoblast-share-token-interface', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-share-token-interface', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['statoblast-token-id', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-truth-auction', 'openoracle-math', 'Math'], + ['statoblast-truth-auction', 'statoblast-auction-events', 'IUniformPriceDualCapBatchAuctionEvents'], + ['statoblast-truth-auction', 'statoblast-auction-interface', 'IUniformPriceDualCapBatchAuction'], + ['statoblast-vault-migration-base', 'openoracle-math', 'Math'], + ['statoblast-vault-migration-base', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['statoblast-vault-migration-base', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-vault-migration-base', 'statoblast-forker-base', 'SecurityPoolForkerBase'], + ['statoblast-vault-migration-base', 'statoblast-forker-types', 'OwnForkChildRepAllocation', 'SecurityPoolForkerForkData'], + ['statoblast-vault-migration-base', 'statoblast-migration-proxy', 'SecurityPoolMigrationProxy'], + ['statoblast-vault-migration-base', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['statoblast-vault-migration-base', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-vault-migration-base', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['statoblast-vault-migration-delegate', 'statoblast-child-game-initializer', 'ISecurityPoolForkerChildEscalationGameInitializer'], + ['statoblast-vault-migration-delegate', 'statoblast-escalation-game', 'EscalationGame'], + ['statoblast-vault-migration-delegate', 'statoblast-forker-base', 'SecurityPoolForkerBase'], + ['statoblast-vault-migration-delegate', 'statoblast-forker-types', 'SecurityPoolForkerForkData'], + ['statoblast-vault-migration-delegate', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['statoblast-vault-migration-delegate', 'statoblast-security-pool-utils', 'SecurityPoolUtils'], + ['statoblast-vault-migration-delegate', 'statoblast-vault-migration-base', 'SecurityPoolForkerVaultMigrationBase'], + ['statoblast-vault-migration-delegate', 'zoltar-core', 'Zoltar'], + ['test-complete-set-reentrant-receiver', 'statoblast-ierc1155-receiver', 'IERC1155Receiver'], + ['test-complete-set-reentrant-receiver', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-constructor-failure-zoltar', 'zoltar-reputation-token', 'ReputationToken'], + ['test-coverage-helpers-harness', 'infra-deployment-status-oracle', 'DeploymentStatusOracle'], + ['test-coverage-helpers-harness', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['test-coverage-helpers-harness', 'statoblast-escalation-proof-verifier', 'EscalationGameProofVerifier'], + ['test-coverage-helpers-harness', 'statoblast-escalation-types', 'MERKLE_MOUNTAIN_RANGE_MAX_PEAKS'], + ['test-coverage-helpers-harness', 'statoblast-merkle-mountain-range', 'MerkleMountainRange'], + ['test-coverage-helpers-harness', 'statoblast-token-id', 'TokenId'], + ['test-coverage-helpers-harness', 'zoltar-ierc20', 'IERC20'], + ['test-coverage-helpers-harness', 'zoltar-safe-erc20-ops', 'SafeERC20Ops'], + ['test-coverage-helpers-harness', 'zoltar-scalar-outcomes', 'ScalarOutcomes'], + ['test-erc1155-coverage-harness', 'statoblast-erc1155', 'ERC1155'], + ['test-erc1155-receiver-mock', 'statoblast-ierc1155-receiver', 'IERC1155Receiver'], + ['test-escalation-factory-coverage-pool', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['test-escalation-factory-coverage-pool', 'statoblast-escalation-game', 'EscalationGame'], + ['test-escalation-factory-coverage-pool', 'statoblast-escalation-game-factory', 'EscalationGameFactory'], + ['test-escalation-factory-coverage-pool', 'zoltar-reputation-token', 'ReputationToken'], + ['test-escalation-forker-harness', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['test-escalation-forker-harness', 'statoblast-escalation-game', 'EscalationGame'], + ['test-escalation-proof-pool', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['test-escalation-proof-pool', 'statoblast-escalation-game', 'EscalationGame'], + ['test-escalation-proof-pool', 'statoblast-escalation-types', 'CarriedDepositProof'], + ['test-escalation-proof-pool', 'zoltar-core', 'Zoltar'], + ['test-escalation-proof-pool', 'zoltar-reputation-token', 'ReputationToken'], + ['test-false-returning-erc20', 'zoltar-ierc20', 'IERC20'], + ['test-fork-boundary-pool', 'zoltar-core', 'Zoltar'], + ['test-fork-threshold-harness', 'statoblast-escalation-calculations', 'EscalationGameCalculations'], + ['test-fork-threshold-harness', 'statoblast-escalation-proof-verifier', 'EscalationGameProofVerifier'], + ['test-fork-threshold-harness', 'statoblast-escalation-state', 'EscalationGameState'], + ['test-fork-threshold-harness', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-fork-threshold-harness', 'zoltar-reputation-token', 'ReputationToken'], + ['test-forker-alternating-game', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-forker-attack-factory', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-forker-attack-factory', 'statoblast-share-token-interface', 'IShareToken'], + ['test-forker-attack-factory', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['test-forker-attack-parent', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['test-forker-attack-parent', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['test-forker-attack-parent', 'statoblast-share-token-interface', 'IShareToken'], + ['test-forker-auction-settlement', 'statoblast-forker-types', 'SecurityPoolForkerForkData'], + ['test-forker-auction-settlement', 'statoblast-auction-settlement-base', 'SecurityPoolForkerAuctionSettlementBase'], + ['test-forker-auction-settlement', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-forker-auction-settlement', 'zoltar-core', 'Zoltar'], + ['test-forker-child-validation-harness', 'statoblast-forker-base', 'SecurityPoolForkerBase'], + ['test-forker-child-validation-harness', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-forker-child-validation-harness', 'zoltar-core', 'Zoltar'], + ['test-forker-escrow-child', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['test-forker-escrow-child', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['test-forker-escrow-child', 'zoltar-reputation-token', 'ReputationToken'], + ['test-forker-escrow-factory', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-forker-escrow-factory', 'statoblast-share-token-interface', 'IShareToken'], + ['test-forker-escrow-factory', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['test-forker-escrow-game', 'statoblast-binary-outcomes', 'BinaryOutcomes'], + ['test-forker-escrow-game', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-forker-escrow-game', 'zoltar-reputation-token', 'ReputationToken'], + ['test-forker-escrow-parent', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['test-forker-escrow-parent', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['test-forker-escrow-parent', 'statoblast-share-token-interface', 'IShareToken'], + ['test-forker-escrow-parent', 'test-forker-escrow-game', 'SecurityPoolForkerEscrowAttackGameMock'], + ['test-forker-escrow-parent', 'zoltar-reputation-token', 'ReputationToken'], + ['test-forker-fake-pool', 'statoblast-security-pool-interface', 'SystemState'], + ['test-forker-fake-pool', 'zoltar-reputation-token', 'ReputationToken'], + ['test-forker-malicious-emitter', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-incompatible-proof-verifier', 'statoblast-escalation-types', 'NULLIFIER_DEPTH'], + ['test-incompatible-proof-verifier', 'statoblast-merkle-mountain-range', 'MerkleMountainRange'], + ['test-openoracle-rejecting-receiver', 'statoblast-ierc1155-receiver', 'IERC1155Receiver'], + ['test-openoracle-rejecting-receiver', 'test-openoracle-adversarial-target', 'IOpenOracleAdversarialTarget'], + ['test-openoracle-token', 'zoltar-ierc20', 'IERC20'], + ['test-safe-erc20-ops-harness', 'zoltar-ierc20', 'IERC20'], + ['test-safe-erc20-ops-harness', 'zoltar-safe-erc20-ops', 'SafeERC20Ops'], + ['test-share-token-authorization-pool', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['test-share-token-authorization-pool', 'statoblast-share-token-interface', 'IShareToken'], + ['test-truth-auction-alias-child', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['test-truth-auction-alias-child', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['test-truth-auction-alias-child', 'zoltar-reputation-token', 'ReputationToken'], + ['test-truth-auction-alias-factory', 'statoblast-security-pool-interface', 'ISecurityPool'], + ['test-truth-auction-alias-factory', 'statoblast-share-token-interface', 'IShareToken'], + ['test-truth-auction-alias-factory', 'statoblast-truth-auction', 'UniformPriceDualCapBatchAuction'], + ['test-truth-auction-alias-parent', 'statoblast-security-pool-factory-interface', 'ISecurityPoolFactory'], + ['test-truth-auction-alias-parent', 'statoblast-security-pool-interface', 'ISecurityPool', 'SystemState'], + ['test-truth-auction-alias-parent', 'statoblast-share-token-interface', 'IShareToken'], + ['test-truth-auction-alias-parent', 'zoltar-reputation-token', 'ReputationToken'], + ['zoltar-core', 'zoltar-constants', 'Constants'], + ['zoltar-core', 'zoltar-ierc20', 'IERC20'], + ['zoltar-core', 'zoltar-question-data', 'ZoltarQuestionData'], + ['zoltar-core', 'zoltar-reputation-token', 'ReputationToken'], + ['zoltar-core', 'zoltar-safe-erc20-ops', 'SafeERC20Ops'], + ['zoltar-erc20', 'zoltar-context', 'Context'], + ['zoltar-erc20', 'zoltar-ierc20', 'IERC20'], + ['zoltar-erc20', 'zoltar-ierc20-metadata', 'IERC20Metadata'], + ['zoltar-ierc20-metadata', 'zoltar-ierc20', 'IERC20'], + ['zoltar-question-data', 'zoltar-scalar-outcomes', 'ScalarOutcomes'], + ['zoltar-reputation-token', 'zoltar-erc20', 'ERC20'], + ['zoltar-safe-erc20-ops', 'zoltar-ierc20', 'IERC20'], +] + +export const contractAtlasSourceReferences: ContractAtlasSourceReference[] = contractAtlasSourceReferenceRows.map(([source, target, ...symbols]) => ({ source, symbols, target })) diff --git a/docs/charts/diagramSpecs.json b/docs/charts/diagramSpecs.json index b27b942d2..21d0e2101 100644 --- a/docs/charts/diagramSpecs.json +++ b/docs/charts/diagramSpecs.json @@ -10851,6 +10851,13 @@ "nodes": [], "width": 1120 }, + "fig-complete-contract-atlas": { + "ariaDescription": "Six separated regions inventory Zoltar, Statoblast deployment, Statoblast runtime, Statoblast implementation boundaries, infrastructure and imported OpenOracle code, and test-only Solidity declarations. Every Solidity contract, abstract contract, interface, and library in the repository appears once in its owning region; two type-only modules also appear. The register contains 394 relationships grouped into 376 ordered source-target routes. The chart defaults to a clearer 96-route protocol-flow layer; controls reveal type structure, source references, test exercise, or all routes without moving or removing components. Eighteen routes combine two relationship types; their tooltips list both types and meanings. Solid, long-dash, dot–dash, and short-dash arrows respectively show runtime calls, asset-bearing calls, deployments, and delegatecalls. Dashed or dotted arrows show inheritance, interface implementation, structural compatibility, library or type use, direct source references, and test-only exercise. A dark patterned arrow marks multiple relationship types. Production target groups are repeated inside the test region to prevent test edges from crossing the full chart.", + "ariaLabel": "Complete Zoltar and Statoblast Solidity contract and relationship atlas", + "height": 2480, + "nodes": [], + "width": 1800 + }, "fig-liquidation-health-curve": { "ariaDescription": "Required REP backing rises linearly with the REP per ETH price, while unlocked REP stays fixed. Crossing the available-REP line makes the selected vault liquidatable.", "ariaLabel": "Vault backing requirement and liquidation threshold across REP per ETH prices", diff --git a/docs/contract-interactions.html b/docs/contract-interactions.html index 726c76f63..2297300c7 100644 --- a/docs/contract-interactions.html +++ b/docs/contract-interactions.html @@ -14,9 +14,12 @@

Contract Interaction Map

This map connects the primary deployed Zoltar registry and Statoblast market contracts. It emphasizes contract-to-contract calls and asset - movement, not every public user entrypoint. Factory-only deployment - workers, delegate modules, event emitters, and compatibility contracts - are summarized separately so the runtime path stays legible. + movement, not every public user entrypoint. The first chart keeps that + primary runtime path legible. The separate + complete contract atlas + then expands every Solidity declaration, including factories, delegates, + bases, interfaces, libraries, infrastructure, imported compatibility + code, and test-only contracts.

Related reading: @@ -39,6 +42,10 @@

Primary Interaction Flow

enter through several of these contracts, but are omitted so the plot can focus on contract-to-contract boundaries.

+

+ This intentionally compact view contains exactly 12 unique components + and 19 interactions; it is not exhaustive. +

@@ -48,13 +55,20 @@

Primary Interaction Flow

Blue nodes are registries or oracle infrastructure, green nodes hold market state and claims, red marks local resolution, and gold marks deployment or fork coordination. Short edge labels state the action; - the table below supplies its exact contract-level meaning. + the primary interaction table supplies its exact + contract-level meaning.

-

What Each Arrow Means

+

What Each Primary-Flow Arrow Means

+

+ These 19 rows explain the arrows in the + Primary Interaction Flow. The exhaustive atlas + below has its own + complete relationship register. +

@@ -218,10 +232,11 @@

Four Useful Reading Paths

-

Supporting Contracts Not Expanded in the Plot

+

How the Primary Flow Compresses the Atlas

- The diagram groups construction helpers and delegate modules behind the - deployed component whose behavior they implement: + The primary interaction flow groups construction helpers and delegate + modules behind the deployed component whose behavior they implement. + The complete atlas below expands every item in these groups:

  • @@ -251,8 +266,190 @@

    Supporting Contracts Not Expanded in the Plot

+
+

Complete Solidity Contract Atlas

+

+ This chart exhaustively inventories Solidity declarations and their + direct relationships. Zoltar has its own region because it owns + questions, universes, and REP; Statoblast deployment, runtime, and + implementation components occupy three separate regions. Infrastructure + and imported OpenOracle code form another boundary, and test-only + contracts stay in a final region so they cannot be mistaken for deployed + protocol components. +

+

+ The checked inventory contains 119 nodes and 394 relationships. Its + nodes cover all 117 Solidity declarations currently under + solidity/contracts: 76 production declarations and 41 + test-only declarations, plus the two type-only modules + EscalationGameTypes and + SecurityPoolForkerTypes. Files that only re-export an + import do not create another declaration node. +

+

+ Coverage is pair-based: every declaration that names an imported or + same-file contract, interface, library, or type module is linked. A + specific call, deployment, delegatecall, asset-bearing call, + inheritance, implementation, library/type use, or test edge replaces the + generic source reference. The register keeps all 394 relationship rows + separate. The plot groups them into 376 ordered source-target routes: + 18 routes carry two relationship types, so their combined style and + tooltip list both meanings. Repeated uses of the same type and pair + aggregate; distinct types and explicit low-level boundaries remain + separate register rows. A compiler-AST check promotes actual contract + and interface member invocations, library calls and constants, using + directives, and test-helper invocations out of the generic layer. A + deployment, inheritance, implementation, or type-use relationship on + the same pair does not stand in for a runtime call; the register and + tooltip retain both meanings. Invocation analysis follows direct calls + and typed members encoded for ordinary low-level calls; it excludes + selector-only references and members encoded for separately classified + delegatecalls. The generic layer therefore contains only reference-only + pairs. The chart keeps all 119 components fixed while one relationship + layer is selected; choose All routes for the complete + overlay. +

+ +
    +
  • Runtime call — solid
  • +
  • Asset-bearing call — long dash
  • +
  • Deployment — dot–dash
  • +
  • Delegatecall — short dash
  • +
  • Inheritance, interface, compatibility, or library/type use
  • +
  • Direct source reference
  • +
  • Test-only exercise
  • +
  • Multiple relationship types
  • +
+
+
+ +
+

+ Complete Contract AtlasEvery + contract, abstract contract, interface, and library declaration has + one inventory node. Test edges terminate at repeated production + gateway groups inside the test region to avoid crossing the entire + plot; the relationship register preserves each exact production + target. The default protocol-flow layer shows 96 routes; the layer + controls expose every one of the 376 routes while keeping all 119 + components fixed. Mechanical reconciliation against the Solidity + tree covers every direct source edge, and all 394 meanings remain in + the route tooltips and register. The component inventory provides an + exact textual entry for every node, including isolated declarations + that have no active in-repository relationship under the rule above. +

+
+
+ Complete 119-component inventory +

+ This inventory preserves each component’s declaration kind, owning + region, and Solidity source path independently of chart hover or + relationship coverage. +

+
+
+ + + + + + + + + + + + + +
ComponentKindRegionSource
The generated component inventory requires JavaScript; the figure fallback summarizes its regions and component kinds.
+
+ +
+ Complete relationship register +

+ Arrows point from the initiator, child, implementation, or test + double to the receiver, parent, dependency, or production target. + For an asset-bearing call, this is code/dependency direction rather + than a claim that the edge target receives the asset; its meaning + states the actual sender → recipient path. +

+
+ + + + + + + + + + + + + + +
SourceTargetRelationshipMeaning
The generated relationship register requires JavaScript; the figure fallback summarizes its edge types.
+
+
+
+
-

Source Contracts

+

Primary Flow Source Contracts

+

+ These are the entry sources for the compact primary flow. Each atlas + node records its exact source path, and the atlas inventory is checked + directly against every Solidity declaration in the source tree. +

  • ZoltarQuestionData.sol
  • Zoltar.sol and ReputationToken.sol
  • diff --git a/docs/docsReader.js b/docs/docsReader.js index 533326086..abf5905f8 100644 --- a/docs/docsReader.js +++ b/docs/docsReader.js @@ -70,7 +70,7 @@ const documentGroups = [ { path: 'contract-interactions.html', title: 'Contract interaction map', - description: 'How deployed contracts call, deploy, and move assets between one another.', + description: 'Primary runtime flow and exhaustive Solidity declaration and checked relationship atlas.', }, { path: 'escalation-game-architecture.html', diff --git a/docs/shared-docs.css b/docs/shared-docs.css index 5a3f6cbf3..8059174e8 100644 --- a/docs/shared-docs.css +++ b/docs/shared-docs.css @@ -405,6 +405,7 @@ body.doc-openoracle .table-scroll { scrollbar-width: thin; } body.doc-openoracle .table-scroll:focus-visible, +body.doc-openoracle .diagram-scroll:focus-visible, body.doc-openoracle .diagram:focus-visible, body.doc-openoracle .example-visual:focus-visible, body.doc-openoracle .equation:focus-visible { @@ -438,10 +439,213 @@ body.doc-openoracle .diagram { overscroll-behavior-x: contain; scrollbar-width: thin; } +body.doc-openoracle .diagram-atlas { + overflow-x: visible; +} +body.doc-openoracle .diagram-scroll { + overflow-x: auto; + overscroll-behavior-x: contain; + scrollbar-width: thin; +} body.doc-openoracle .diagram-wide > svg, body.doc-openoracle .diagram-wide > .plot-chart { min-width: 60rem; } +body.doc-openoracle .diagram-atlas > .diagram-scroll > .plot-chart.plot-chart-ready { + min-width: 108rem; +} +body.doc-openoracle .contract-atlas-controls[hidden] { + display: none; +} +body.doc-openoracle .contract-atlas-controls { + margin: 1rem 0; + padding: 0.85rem; + border: 1px solid var(--line); + border-radius: var(--radius); + background: var(--soft); +} +body.doc-openoracle .contract-atlas-controls legend { + padding: 0 0.35rem; + color: var(--ink); + font-weight: 780; +} +body.doc-openoracle .contract-atlas-controls > p { + margin: 0 0 0.75rem; + color: var(--muted); + font-size: 0.9rem; +} +body.doc-openoracle .contract-atlas-view-options { + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); + gap: 0.55rem; +} +body.doc-openoracle .contract-atlas-view-options button { + min-width: 0; + padding: 0.65rem 0.7rem; + border: 1px solid var(--line); + border-radius: 0.45rem; + background: var(--paper); + color: var(--ink); + font: inherit; + line-height: 1.25; + text-align: left; + cursor: pointer; +} +body.doc-openoracle .contract-atlas-view-options button:hover { + border-color: var(--blue); +} +body.doc-openoracle .contract-atlas-view-options button[aria-pressed="true"] { + border-color: var(--blue); + background: color-mix(in srgb, var(--blue-soft) 72%, var(--paper)); + box-shadow: inset 0 0 0 1px var(--blue); +} +body.doc-openoracle .contract-atlas-view-options button:focus-visible { + outline: 2px solid var(--blue); + outline-offset: 0.15rem; +} +body.doc-openoracle .contract-atlas-view-options strong, +body.doc-openoracle .contract-atlas-view-options span { + display: block; +} +body.doc-openoracle .contract-atlas-view-options span { + margin-top: 0.22rem; + color: var(--muted); + font-size: 0.78rem; +} +body.doc-openoracle .contract-atlas-controls > .contract-atlas-view-status { + min-height: 1.4em; + margin: 0.75rem 0 0; + color: var(--ink); +} +body.doc-openoracle .contract-atlas-legend { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 0.5rem 0.8rem; + margin: 1rem 0; + padding: 0; + list-style: none; +} +body.doc-openoracle .contract-atlas-legend li { + display: flex; + align-items: center; + gap: 0.55rem; + min-width: 0; + padding: 0.5rem 0.65rem; + border: 1px solid var(--line); + border-radius: 0.45rem; + background: var(--paper); + font-size: 0.86rem; +} +body.doc-openoracle .atlas-line { + flex: 0 0 2.6rem; + height: 0; + border-top: 0.16rem solid var(--blue); +} +body.doc-openoracle .atlas-line-assets { + height: 0.2rem; + border: 0; + background: repeating-linear-gradient(to right, var(--green) 0 0.9rem, transparent 0.9rem 1.16rem); +} +body.doc-openoracle .atlas-line-deploy { + height: 0.2rem; + border: 0; + background: repeating-linear-gradient(to right, var(--gold) 0 0.13rem, transparent 0.13rem 0.33rem, var(--gold) 0.33rem 0.98rem, transparent 0.98rem 1.18rem); +} +body.doc-openoracle .atlas-line-delegate { + height: 0.2rem; + border: 0; + background: repeating-linear-gradient(to right, var(--red) 0 0.42rem, transparent 0.42rem 0.74rem); +} +body.doc-openoracle .atlas-line-source { + border-color: var(--muted); + border-top-style: dashed; +} +body.doc-openoracle .atlas-line-reference { + border-color: var(--muted); + border-top-style: dotted; + opacity: 0.65; +} +body.doc-openoracle .atlas-line-test { + border-color: var(--red); + border-top-style: dotted; +} +body.doc-openoracle .atlas-line-multiple { + height: 0.16rem; + border: 0; + background: repeating-linear-gradient(to right, var(--ink) 0 0.9rem, transparent 0.9rem 1.2rem, var(--ink) 1.2rem 1.4rem, transparent 1.4rem 1.7rem); +} +@media (forced-colors: active) { + body.doc-openoracle .atlas-line-assets, + body.doc-openoracle .atlas-line-deploy, + body.doc-openoracle .atlas-line-delegate, + body.doc-openoracle .atlas-line-multiple { + forced-color-adjust: none; + } + body.doc-openoracle .atlas-line-assets { + background: repeating-linear-gradient(to right, CanvasText 0 0.9rem, transparent 0.9rem 1.16rem); + } + body.doc-openoracle .atlas-line-deploy { + background: repeating-linear-gradient(to right, CanvasText 0 0.13rem, transparent 0.13rem 0.33rem, CanvasText 0.33rem 0.98rem, transparent 0.98rem 1.18rem); + } + body.doc-openoracle .atlas-line-delegate { + background: repeating-linear-gradient(to right, CanvasText 0 0.42rem, transparent 0.42rem 0.74rem); + } + body.doc-openoracle .atlas-line-multiple { + background: repeating-linear-gradient(to right, CanvasText 0 0.9rem, transparent 0.9rem 1.2rem, CanvasText 1.2rem 1.4rem, transparent 1.4rem 1.7rem); + } +} +body.doc-openoracle .contract-atlas-register { + margin: 1rem 0 1.5rem; + padding: 0.75rem 0.85rem; + border: 1px solid var(--line); + border-radius: var(--radius); + background: var(--soft); +} +body.doc-openoracle .contract-atlas-register summary { + cursor: pointer; + color: var(--ink); + font-weight: 750; +} +body.doc-openoracle .contract-atlas-register > p { + margin: 0.75rem 0 0; +} +body.doc-openoracle .contract-atlas-register table { + table-layout: fixed; +} +body.doc-openoracle .contract-atlas-register th:nth-child(1), +body.doc-openoracle .contract-atlas-register th:nth-child(2), +body.doc-openoracle .contract-atlas-register td:nth-child(1), +body.doc-openoracle .contract-atlas-register td:nth-child(2) { + width: 21%; +} +body.doc-openoracle .contract-atlas-register th:nth-child(3), +body.doc-openoracle .contract-atlas-register td:nth-child(3) { + width: 18%; +} +body.doc-openoracle .contract-atlas-register th:nth-child(4), +body.doc-openoracle .contract-atlas-register td:nth-child(4) { + width: 40%; +} +body.doc-openoracle .contract-atlas-node-register th:nth-child(1), +body.doc-openoracle .contract-atlas-node-register td:nth-child(1) { + width: 24%; +} +body.doc-openoracle .contract-atlas-node-register th:nth-child(2), +body.doc-openoracle .contract-atlas-node-register td:nth-child(2) { + width: 16%; +} +body.doc-openoracle .contract-atlas-node-register th:nth-child(3), +body.doc-openoracle .contract-atlas-node-register td:nth-child(3) { + width: 25%; +} +body.doc-openoracle .contract-atlas-node-register th:nth-child(4), +body.doc-openoracle .contract-atlas-node-register td:nth-child(4) { + width: 35%; +} +body.doc-openoracle .contract-atlas-register td > code:only-child { + white-space: normal; + overflow-wrap: anywhere; +} body.doc-openoracle .equation { overflow-x: auto; overscroll-behavior-x: contain; @@ -675,11 +879,23 @@ body.doc-openoracle td math { body.doc-openoracle section { padding: 1rem; } + body.doc-openoracle .contract-atlas-legend { + grid-template-columns: 1fr; + } + body.doc-openoracle .contract-atlas-view-options { + grid-template-columns: 1fr; + } body.doc-openoracle table { display: block; overflow-x: auto; white-space: nowrap; } + body.doc-openoracle .contract-atlas-register table { + display: table; + min-width: 47rem; + overflow-x: visible; + white-space: normal; + } body.doc-openoracle.invariants-catalog table { display: table; overflow-x: visible; diff --git a/scripts/check-doc-charts.mts b/scripts/check-doc-charts.mts index b9b91ee9e..58c525a43 100644 --- a/scripts/check-doc-charts.mts +++ b/scripts/check-doc-charts.mts @@ -5,17 +5,77 @@ import { Window } from 'happy-dom' import ts from 'typescript' import { contractInteractionEdges, quantitativeChartAxisLabels, quantitativeChartIds } from '../docs/charts/chartModels' +import { contractAtlasBehavioralReferences, contractAtlasBehavioralRelationIsCovered, type ContractAtlasBehavioralReference } from '../docs/charts/contractAtlasBehavioralReferences' +import { + contractAtlasDefaultView, + contractAtlasEdges, + contractAtlasInventoryRows, + contractAtlasNodes, + contractAtlasPlotRouteMeaning, + contractAtlasPlotRoutes, + contractAtlasPlotRoutesForView, + contractAtlasRelationLabels, + contractAtlasRelationshipRows, + contractAtlasTestGatewayByTargetId, + contractAtlasTestGatewayDefinitions, + contractAtlasViewDefinitions, + type ContractAtlasView, +} from '../docs/charts/contractAtlas' +import { + contractAtlasCallClaimEvidence, + contractAtlasCompatibilityEvidence, + contractAtlasSemanticEvidence, + contractAtlasSemanticMeanings, + contractAtlasTestExecutionEvidence, + contractAtlasUseClaimEvidence, + type ContractAtlasCompatibilityEvidence, + type ContractAtlasSemanticClaimEvidence, + type ContractAtlasSemanticEvidence, + type ContractAtlasTestExecutionEvidence, +} from '../docs/charts/contractAtlasSemanticEvidence' +import { contractAtlasSourceOwnerOverrides, contractAtlasSourceReferences } from '../docs/charts/contractAtlasSourceReferences' +import { analyzeContractAtlasBehavioralReferences, contractAtlasBehavioralReferenceIssue } from './contract-atlas-behavioral-references.mts' +import { analyzeContractAtlasSource, contractAtlasSourceReferenceIssue } from './contract-atlas-source-references.mts' const repositoryRoot = path.resolve(import.meta.dir, '..') const docsDirectory = path.join(repositoryRoot, 'docs') const entrypoint = path.join(repositoryRoot, 'docs/charts/chartRuntime.ts') const generatedPath = path.join(repositoryRoot, 'docs/chartRuntime.js') const specsPath = path.join(repositoryRoot, 'docs/charts/diagramSpecs.json') -const expectedChartCount = 40 +const expectedChartCount = 41 +const expectedContractAtlasNodeCount = 119 +const expectedContractAtlasRelationshipCount = 394 +const expectedContractAtlasPlotRouteCount = 376 +const expectedContractAtlasMultiRelationRouteCount = 18 +const expectedContractAtlasSourceReferenceCount = 335 +const expectedContractAtlasExplicitDeploymentCount = 17 +const expectedContractAtlasDirectBaseCount = 44 +const expectedContractAtlasDelegatecallCount = 5 +const expectedContractAtlasBehavioralCandidateCount = 124 +const expectedContractAtlasBehavioralReferenceCount = 69 +const expectedContractAtlasSemanticEvidenceCount = 115 +const expectedContractAtlasCallClaimCount = 43 +const expectedContractAtlasUseClaimCount = 32 +const expectedPrimaryContractInteractionCount = 19 +const expectedPrimaryContractComponentCount = 12 +const expectedContractAtlasViewRouteCounts: Record = { + all: 376, + protocol: 96, + references: 144, + structure: 105, + tests: 40, +} +const expectedContractAtlasTypeModuleSources = new Set(['solidity/contracts/peripherals/EscalationGameTypes.sol', 'solidity/contracts/peripherals/SecurityPoolForkerTypes.sol']) const supportedDiagramTags = new Set(['circle', 'defs', 'line', 'marker', 'path', 'polyline', 'rect', 'text', 'tspan']) -const axisFreeNativeChartIds = new Set(['fig-contract-interaction-map']) +const axisFreeNativeChartIds = new Set(['fig-complete-contract-atlas', 'fig-contract-interaction-map']) const quantitativeChartIdSet = new Set(quantitativeChartIds) const chartAxes: ('x' | 'y')[] = ['x', 'y'] +const contractAtlasSourceDerivedRelationVerbs: Record<'delegatecall' | 'deploys' | 'implements' | 'inherits', string> = { + delegatecall: 'Delegatecalls', + deploys: 'Deploys', + implements: 'Implements', + inherits: 'Directly inherits', +} function isRecord(value: unknown): value is Record { return typeof value === 'object' && value !== null && !Array.isArray(value) @@ -160,6 +220,908 @@ function assertNativeRegistryCoverage(nativeChartIds: Set): void { if (issue !== undefined) throw new Error(issue) } +function stringSetIssue(label: string, expectedValues: readonly string[], registeredValues: readonly string[]): string | undefined { + const expected = new Set(expectedValues) + const registered = new Set(registeredValues) + const missing = [...expected].filter(value => !registered.has(value)) + const extra = [...registered].filter(value => !expected.has(value)) + if (missing.length === 0 && extra.length === 0) return undefined + return `${label}; missing: ${missing.join(', ') || 'none'}; extra: ${extra.join(', ') || 'none'}` +} + +function exactRelationshipSetIssue(label: string, expectedValues: readonly string[], registeredValues: readonly string[]): string | undefined { + if (new Set(expectedValues).size !== expectedValues.length) { + return `${label} source analysis contains duplicate relationships` + } + if (new Set(registeredValues).size !== registeredValues.length) { + return `${label} registry contains duplicate relationships` + } + return stringSetIssue(label, expectedValues, registeredValues) +} + +function primaryContractInteractionBoundaryIssue(edges: readonly (typeof contractInteractionEdges)[number][]): string | undefined { + if (edges.length !== expectedPrimaryContractInteractionCount) { + return `Primary contract interaction map expected ${expectedPrimaryContractInteractionCount} interactions, found ${edges.length}` + } + const components = new Set(edges.flatMap(edge => [edge.source, edge.receiver])) + if (components.size !== expectedPrimaryContractComponentCount) { + return `Primary contract interaction map expected ${expectedPrimaryContractComponentCount} components, found ${components.size}` + } + return undefined +} + +function contractAtlasRelationshipIssue(edges: readonly (typeof contractAtlasEdges)[number][], nodeIds: ReadonlySet): string | undefined { + if (edges.length !== expectedContractAtlasRelationshipCount) { + return `Complete contract atlas expected ${expectedContractAtlasRelationshipCount} relationships, found ${edges.length}` + } + const edgeIds = edges.map(edge => edge.id) + if (new Set(edgeIds).size !== edgeIds.length) { + return 'Complete contract atlas relationship IDs must be unique' + } + const sourceReferencePairs = new Set(contractAtlasSourceReferences.map(reference => `${reference.source}->${reference.target}`)) + const relationshipPairs = new Set() + for (const edge of edges) { + if (!nodeIds.has(edge.source) || !nodeIds.has(edge.target)) { + return `Complete contract atlas relationship ${edge.id} has a missing source or target` + } + if (edge.description.trim().length === 0) { + return `Complete contract atlas relationship ${edge.id} is missing its meaning` + } + const pair = `${edge.source}->${edge.target}` + relationshipPairs.add(pair) + if (edge.relation === 'references' && !sourceReferencePairs.has(pair)) { + return `Complete contract atlas relationship ${edge.id} claims a direct source reference absent from Solidity` + } + if (edge.relation === 'assets' && !edge.description.includes('→')) { + return `Complete contract atlas asset-bearing relationship ${edge.id} must name an actual sender → recipient path` + } + } + const missingSourcePair = contractAtlasSourceReferences.find(reference => !relationshipPairs.has(`${reference.source}->${reference.target}`)) + if (missingSourcePair !== undefined) { + return `Complete contract atlas is missing direct source relationship ${missingSourcePair.source}->${missingSourcePair.target}` + } + return undefined +} + +function contractAtlasSourceDerivedMeaningIssue(edges: readonly (typeof contractAtlasEdges)[number][], nodeById: ReadonlyMap): string | undefined { + for (const edge of edges) { + if (edge.relation !== 'delegatecall' && edge.relation !== 'deploys' && edge.relation !== 'implements' && edge.relation !== 'inherits') continue + const target = nodeById.get(edge.target) + if (target === undefined) return `Complete contract atlas source-derived meaning ${edge.id} has missing target ${edge.target}` + const expectedDescription = `${contractAtlasSourceDerivedRelationVerbs[edge.relation]} ${target.label}.` + if (edge.description !== expectedDescription) { + return `Complete contract atlas source-derived relationship ${edge.id} meaning must be mechanical: ${expectedDescription}` + } + } + return undefined +} + +function contractAtlasBehavioralMeaning(reference: ContractAtlasBehavioralReference, targetLabel: string): string { + const verbs: Record = { + calls: 'Calls', + tests: 'Test helper invokes', + uses: 'Uses', + } + const memberLabel = reference.members.length === 1 ? 'member' : 'members' + return `${verbs[reference.relation]} ${targetLabel} ${memberLabel} ${reference.members.join(', ')}.` +} + +function contractAtlasBehavioralEdgeIssue(edges: readonly (typeof contractAtlasEdges)[number][], references: readonly ContractAtlasBehavioralReference[], nodeById: ReadonlyMap): string | undefined { + const behaviorEdges = edges.filter(edge => edge.id.startsWith('source-behavior-')) + const expectedKeys = references.map(reference => `source-behavior-${reference.source}--${reference.target}:${reference.source}->${reference.target}:${reference.relation}`) + const registeredKeys = behaviorEdges.map(edge => `${edge.id}:${edge.source}->${edge.target}:${edge.relation}`) + const classificationIssue = exactRelationshipSetIssue('Complete contract atlas behavioral edge classification mismatch', expectedKeys, registeredKeys) + if (classificationIssue !== undefined) return classificationIssue + for (const reference of references) { + const edge = behaviorEdges.find(candidate => candidate.source === reference.source && candidate.target === reference.target) + const target = nodeById.get(reference.target) + if (edge === undefined || target === undefined) return `Complete contract atlas behavioral edge ${reference.source}->${reference.target} has a missing endpoint` + const expectedDescription = contractAtlasBehavioralMeaning(reference, target.label) + if (edge.description !== expectedDescription) { + return `Complete contract atlas behavioral edge ${edge.id} meaning must be mechanical: ${expectedDescription}` + } + } + return undefined +} + +function contractAtlasBehavioralCoverageIssue(edges: readonly (typeof contractAtlasEdges)[number][], candidates: readonly ContractAtlasBehavioralReference[], evidenceEntries: readonly ContractAtlasSemanticEvidence[]): string | undefined { + const evidencedEdgeIds = new Set(evidenceEntries.map(evidence => evidence.edgeId)) + for (const candidate of candidates) { + const compatibleEdges = edges.filter(edge => edge.source === candidate.source && edge.target === candidate.target && contractAtlasBehavioralRelationIsCovered(candidate.relation, edge.relation)) + if (compatibleEdges.length === 0) { + return `Complete contract atlas behavioral source pair ${candidate.source}->${candidate.target} has no ${candidate.relation} relationship for members ${candidate.members.join(', ')}` + } + if (!compatibleEdges.some(edge => edge.id.startsWith('source-behavior-') || evidencedEdgeIds.has(edge.id))) { + return `Complete contract atlas behavioral source pair ${candidate.source}->${candidate.target} has no generated member meaning or checked semantic evidence` + } + } + return undefined +} + +function compactSolidity(source: string): string { + return source.replace(/\s+/g, '') +} + +function contractAtlasSemanticEvidenceIssue( + edges: readonly (typeof contractAtlasEdges)[number][], + evidenceEntries: readonly ContractAtlasSemanticEvidence[], + semanticMeanings: Readonly>, + callClaimEvidence: Readonly>, + useClaimEvidence: Readonly>, + compatibilityEvidence: Readonly>, + testExecutionEvidence: Readonly>, + sourceUnits: readonly { nodeId: string; source: string }[], + testSources: ReadonlyMap, +): string | undefined { + const checkedRelations = new Set(['assets', 'calls', 'compatible', 'tests', 'uses']) + const checkedEdges = edges.filter(edge => checkedRelations.has(edge.relation) && !edge.id.startsWith('source-behavior-')) + if (checkedEdges.length !== expectedContractAtlasSemanticEvidenceCount) { + return `Complete contract atlas expected ${expectedContractAtlasSemanticEvidenceCount} manually classified relationships, found ${checkedEdges.length}` + } + if (evidenceEntries.length !== expectedContractAtlasSemanticEvidenceCount) { + return `Complete contract atlas expected ${expectedContractAtlasSemanticEvidenceCount} semantic evidence entries, found ${evidenceEntries.length}` + } + const expectedKeys = checkedEdges.map(edge => `${edge.id}:${edge.source}->${edge.target}:${edge.relation}`) + const evidenceKeys = evidenceEntries.map(evidence => `${evidence.edgeId}:${evidence.source}->${evidence.target}:${evidence.relation}`) + const classificationIssue = exactRelationshipSetIssue('Complete contract atlas semantic evidence classification mismatch', expectedKeys, evidenceKeys) + if (classificationIssue !== undefined) return classificationIssue + const meaningIssue = exactRelationshipSetIssue( + 'Complete contract atlas semantic meaning mismatch', + evidenceEntries.map(evidence => evidence.edgeId), + Object.keys(semanticMeanings), + ) + if (meaningIssue !== undefined) return meaningIssue + + const edgeById = new Map(checkedEdges.map(edge => [edge.id, edge])) + const sourceByNodeId = new Map(sourceUnits.map(sourceUnit => [sourceUnit.nodeId, compactSolidity(sourceUnit.source)])) + function locationIssue(edgeId: string, locations: readonly { nodeId: string; selectors: string[] }[]): string | undefined { + if (locations.length === 0) return `Complete contract atlas semantic evidence ${edgeId} has no source location` + for (const location of locations) { + const source = sourceByNodeId.get(location.nodeId) + if (source === undefined) return `Complete contract atlas semantic evidence ${edgeId} references missing source unit ${location.nodeId}` + if (location.selectors.length === 0) return `Complete contract atlas semantic evidence ${edgeId} has no selectors for ${location.nodeId}` + for (const selector of location.selectors) { + const compactSelector = compactSolidity(selector) + if (compactSelector.length === 0) return `Complete contract atlas semantic evidence ${edgeId} contains an empty selector` + if (!source.includes(compactSelector)) { + return `Complete contract atlas semantic evidence ${edgeId} selector is absent from ${location.nodeId}: ${selector}` + } + } + } + return undefined + } + + const callEvidenceEntries = evidenceEntries.filter(evidence => evidence.relation === 'calls') + if (callEvidenceEntries.length !== expectedContractAtlasCallClaimCount) { + return `Complete contract atlas expected ${expectedContractAtlasCallClaimCount} direct-call claim sets, found ${callEvidenceEntries.length}` + } + const callClaimIssue = exactRelationshipSetIssue( + 'Complete contract atlas direct-call claim evidence mismatch', + callEvidenceEntries.map(evidence => evidence.edgeId), + Object.keys(callClaimEvidence), + ) + if (callClaimIssue !== undefined) return callClaimIssue + for (const evidence of callEvidenceEntries) { + const meaning = semanticMeanings[evidence.edgeId] + const claims = callClaimEvidence[evidence.edgeId] + if (meaning === undefined || claims === undefined || claims.length === 0) { + return `Complete contract atlas direct-call evidence ${evidence.edgeId} has no source-linked meaning claims` + } + const claimPhrases = claims.map(claim => claim.phrase) + if (new Set(claimPhrases).size !== claimPhrases.length) { + return `Complete contract atlas direct-call evidence ${evidence.edgeId} repeats a meaning claim` + } + const claimSelectors: { nodeId: string; selector: string }[] = [] + for (const semanticClaim of claims) { + if (semanticClaim.phrase.trim().length === 0 || !meaning.includes(semanticClaim.phrase)) { + return `Complete contract atlas direct-call evidence ${evidence.edgeId} claim is absent from its rendered meaning: ${semanticClaim.phrase}` + } + const callSide = semanticClaim.callSide ?? 'source' + for (const location of semanticClaim.locations) { + if (callSide === 'source' && location.nodeId !== evidence.source) { + return `Complete contract atlas direct-call evidence ${evidence.edgeId} assigns a source-side claim to ${location.nodeId}` + } + if (callSide === 'receiver' && location.nodeId !== evidence.target) { + return `Complete contract atlas direct-call evidence ${evidence.edgeId} assigns a receiver-side claim to ${location.nodeId}` + } + if (callSide === 'inherited-source' && !edges.some(edge => edge.relation === 'inherits' && edge.source === evidence.source && edge.target === location.nodeId)) { + return `Complete contract atlas direct-call evidence ${evidence.edgeId} assigns an inherited source claim to unrelated ${location.nodeId}` + } + } + const claimLocationIssue = locationIssue(evidence.edgeId, semanticClaim.locations) + if (claimLocationIssue !== undefined) return claimLocationIssue + for (const location of semanticClaim.locations) { + for (const selector of location.selectors) claimSelectors.push({ nodeId: location.nodeId, selector: compactSolidity(selector) }) + } + } + for (const location of evidence.locations) { + for (const selector of location.selectors) { + const compactSelector = compactSolidity(selector) + if (!claimSelectors.some(claimSelector => claimSelector.nodeId === location.nodeId && (claimSelector.selector.includes(compactSelector) || compactSelector.includes(claimSelector.selector)))) { + return `Complete contract atlas direct-call evidence ${evidence.edgeId} selector is not assigned to a rendered meaning claim: ${selector}` + } + } + } + } + const useEvidenceEntries = evidenceEntries.filter(evidence => evidence.relation === 'uses') + if (useEvidenceEntries.length !== expectedContractAtlasUseClaimCount) { + return `Complete contract atlas expected ${expectedContractAtlasUseClaimCount} implementation-use claim sets, found ${useEvidenceEntries.length}` + } + const useClaimIssue = exactRelationshipSetIssue( + 'Complete contract atlas implementation-use claim evidence mismatch', + useEvidenceEntries.map(evidence => evidence.edgeId), + Object.keys(useClaimEvidence), + ) + if (useClaimIssue !== undefined) return useClaimIssue + for (const evidence of useEvidenceEntries) { + const meaning = semanticMeanings[evidence.edgeId] + const claims = useClaimEvidence[evidence.edgeId] + if (meaning === undefined || claims === undefined || claims.length === 0) { + return `Complete contract atlas implementation-use evidence ${evidence.edgeId} has no source-linked meaning claims` + } + const claimPhrases = claims.map(claim => claim.phrase) + if (new Set(claimPhrases).size !== claimPhrases.length) { + return `Complete contract atlas implementation-use evidence ${evidence.edgeId} repeats a meaning claim` + } + const claimSelectors: { nodeId: string; selector: string }[] = [] + for (const semanticClaim of claims) { + if (semanticClaim.phrase.trim().length === 0 || !meaning.includes(semanticClaim.phrase)) { + return `Complete contract atlas implementation-use evidence ${evidence.edgeId} claim is absent from its rendered meaning: ${semanticClaim.phrase}` + } + if (/\bBPS\b/.test(semanticClaim.phrase) && !semanticClaim.locations.some(location => location.selectors.some(selector => /\b(?:BPS_DENOMINATOR|[A-Z][A-Z0-9_]*_BPS)\b/.test(selector)))) { + return `Complete contract atlas implementation-use evidence ${evidence.edgeId} BPS claim does not cite a BPS denominator or _BPS symbol` + } + if (semanticClaim.callSide !== undefined) { + return `Complete contract atlas implementation-use evidence ${evidence.edgeId} incorrectly declares call-side evidence` + } + const claimLocationIssue = locationIssue(evidence.edgeId, semanticClaim.locations) + if (claimLocationIssue !== undefined) return claimLocationIssue + for (const location of semanticClaim.locations) { + for (const selector of location.selectors) claimSelectors.push({ nodeId: location.nodeId, selector: compactSolidity(selector) }) + } + } + if (/\bBPS\b/.test(meaning) && !claims.some(claim => /\bBPS\b/.test(claim.phrase))) { + return `Complete contract atlas implementation-use evidence ${evidence.edgeId} meaning contains an unclaimed BPS assertion` + } + for (const location of evidence.locations) { + for (const selector of location.selectors) { + const compactSelector = compactSolidity(selector) + if (!claimSelectors.some(claimSelector => claimSelector.nodeId === location.nodeId && (claimSelector.selector.includes(compactSelector) || compactSelector.includes(claimSelector.selector)))) { + return `Complete contract atlas implementation-use evidence ${evidence.edgeId} selector is not assigned to a rendered meaning claim: ${selector}` + } + } + } + } + + for (const evidence of evidenceEntries) { + const edge = edgeById.get(evidence.edgeId) + if (edge === undefined) return `Complete contract atlas semantic evidence ${evidence.edgeId} has no relationship` + const checkedMeaning = semanticMeanings[evidence.edgeId] + if (checkedMeaning === undefined) return `Complete contract atlas semantic evidence ${evidence.edgeId} has no checked meaning` + if (edge.description !== checkedMeaning) { + return `Complete contract atlas semantic relationship ${evidence.edgeId} meaning differs from its source-linked evidence` + } + if (evidence.relation === 'uses' && !contractAtlasSourceReferences.some(reference => reference.source === evidence.source && reference.target === evidence.target)) { + return `Complete contract atlas use evidence ${evidence.edgeId} is not an implementation-derived source pair` + } + if (evidence.relation === 'assets') { + if (evidence.locations.length !== 0) return `Complete contract atlas asset evidence ${evidence.edgeId} must attach selectors to its directional flows` + if (evidence.assetFlows === undefined || evidence.assetFlows.length === 0) { + return `Complete contract atlas asset evidence ${evidence.edgeId} has no sender-recipient flows` + } + for (const assetFlow of evidence.assetFlows) { + if (assetFlow.sender.trim().length === 0 || assetFlow.recipient.trim().length === 0) { + return `Complete contract atlas asset evidence ${evidence.edgeId} has an empty sender or recipient` + } + const direction = `${assetFlow.sender} → ${assetFlow.recipient}` + if (!edge.description.includes(direction)) { + return `Complete contract atlas asset relationship ${evidence.edgeId} omits checked direction ${direction}` + } + const issue = locationIssue(evidence.edgeId, assetFlow.locations) + if (issue !== undefined) return issue + } + } else { + if (evidence.assetFlows !== undefined) return `Complete contract atlas non-asset evidence ${evidence.edgeId} declares asset flows` + const issue = locationIssue(evidence.edgeId, evidence.locations) + if (issue !== undefined) return issue + } + } + + const compatibleEvidenceEntries = evidenceEntries.filter(evidence => evidence.relation === 'compatible') + const compatibilityIssue = exactRelationshipSetIssue( + 'Complete contract atlas compatibility evidence mismatch', + compatibleEvidenceEntries.map(evidence => evidence.edgeId), + Object.keys(compatibilityEvidence), + ) + if (compatibilityIssue !== undefined) return compatibilityIssue + for (const evidence of compatibleEvidenceEntries) { + const compatibility = compatibilityEvidence[evidence.edgeId] + if (compatibility === undefined) return `Complete contract atlas compatibility evidence ${evidence.edgeId} is missing` + if (compatibility.source !== evidence.source || compatibility.target !== evidence.target) { + return `Complete contract atlas compatibility evidence ${evidence.edgeId} has stale endpoints` + } + const source = sourceByNodeId.get(compatibility.source) + const target = sourceByNodeId.get(compatibility.target) + if (source === undefined || target === undefined) return `Complete contract atlas compatibility evidence ${evidence.edgeId} has a missing source unit` + const targetFunctionNames = [...target.matchAll(/\bfunction([A-Za-z_]\w*)\(/g)].map(match => match[1]).filter(name => name !== undefined) + const memberNames = compatibility.members.map(member => member.name) + const surfaceIssue = exactRelationshipSetIssue(`Complete contract atlas compatibility evidence ${evidence.edgeId} callable surface mismatch`, targetFunctionNames, memberNames) + if (surfaceIssue !== undefined) return surfaceIssue + for (const member of compatibility.members) { + const compactTargetSelector = compactSolidity(member.targetSelector) + const compactSourceSelector = compactSolidity(member.sourceSelector) + if (!target.includes(compactTargetSelector)) { + return `Complete contract atlas compatibility evidence ${evidence.edgeId} target member ${member.name} is absent` + } + if (!source.includes(compactSourceSelector)) { + return `Complete contract atlas compatibility evidence ${evidence.edgeId} source member ${member.name} is absent` + } + } + } + + const testEvidenceEntries = evidenceEntries.filter(evidence => evidence.relation === 'tests') + const testExecutionIssue = exactRelationshipSetIssue( + 'Complete contract atlas TypeScript test evidence mismatch', + testEvidenceEntries.map(evidence => evidence.edgeId), + Object.keys(testExecutionEvidence), + ) + if (testExecutionIssue !== undefined) return testExecutionIssue + for (const evidence of testEvidenceEntries) { + const execution = testExecutionEvidence[evidence.edgeId] + if (execution === undefined) return `Complete contract atlas test evidence ${evidence.edgeId} is missing TypeScript execution evidence` + if (execution.target !== evidence.target) return `Complete contract atlas test evidence ${evidence.edgeId} has a stale production target` + const targetIssue = locationIssue(evidence.edgeId, execution.targetLocations) + if (targetIssue !== undefined) return targetIssue + const testSource = testSources.get(execution.file) + if (testSource === undefined) return `Complete contract atlas test evidence ${evidence.edgeId} references missing TypeScript test ${execution.file}` + if (execution.sourceSelectors.length === 0 || execution.targetSelectors.length === 0) { + return `Complete contract atlas test evidence ${evidence.edgeId} must identify both its test artifact and production artifact or call` + } + const compactTestSource = compactSolidity(testSource) + for (const selector of [...execution.sourceSelectors, ...execution.targetSelectors]) { + const compactSelector = compactSolidity(selector) + if (compactSelector.length === 0 || !compactTestSource.includes(compactSelector)) { + return `Complete contract atlas test evidence ${evidence.edgeId} selector is absent from ${execution.file}: ${selector}` + } + } + if (execution.scope !== undefined) { + const scope = execution.scope + if (scope.testName.trim().length === 0 || scope.selectors.length === 0) { + return `Complete contract atlas test evidence ${evidence.edgeId} has an empty named execution scope` + } + const testSourceFile = ts.createSourceFile(execution.file, testSource, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS) + const matchingTests: ts.CallExpression[] = [] + function visitTestScope(node: ts.Node): void { + if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'test' && node.arguments[0] !== undefined && ts.isStringLiteralLike(node.arguments[0]) && node.arguments[0].text === scope.testName) { + matchingTests.push(node) + } + ts.forEachChild(node, visitTestScope) + } + visitTestScope(testSourceFile) + const matchingTest = matchingTests[0] + if (matchingTests.length !== 1 || matchingTest === undefined) { + return `Complete contract atlas test evidence ${evidence.edgeId} expected one test named "${scope.testName}" in ${execution.file}, found ${matchingTests.length}` + } + const compactTestScope = compactSolidity(matchingTest.getText(testSourceFile)) + const scopedSelectorKeys = new Set(scope.selectors.map(selector => compactSolidity(selector))) + for (const selector of [...execution.sourceSelectors, ...execution.targetSelectors]) { + if (!scopedSelectorKeys.has(compactSolidity(selector))) { + return `Complete contract atlas test evidence ${evidence.edgeId} does not bind selector to its named execution scope: ${selector}` + } + } + for (const selector of scope.selectors) { + const compactSelector = compactSolidity(selector) + if (compactSelector.length === 0 || !compactTestScope.includes(compactSelector)) { + return `Complete contract atlas test evidence ${evidence.edgeId} scoped selector is absent from "${scope.testName}": ${selector}` + } + } + } + } + return undefined +} + +async function assertContractAtlasCoverage(): Promise { + const contractsDirectory = path.join(repositoryRoot, 'solidity/contracts') + const sourceEntries = [...new Bun.Glob('**/*.sol').scanSync({ cwd: contractsDirectory })].sort() + const declarationPattern = /^(abstract contract|contract|interface|library)\s+([A-Za-z_]\w*)\b/gm + const declarationRecords: { key: string; kind: string; source: string }[] = [] + const typeModuleSources: string[] = [] + for (const entry of sourceEntries) { + const repositoryPath = path.posix.join('solidity/contracts', entry.split(path.sep).join('/')) + const source = await readFile(path.join(contractsDirectory, entry), 'utf8') + const sourceDeclarations = [...source.matchAll(declarationPattern)] + for (const match of sourceDeclarations) { + const declarationKind = match[1] + const declaration = match[2] + if (declarationKind === undefined || declaration === undefined) { + throw new Error(`Could not read Solidity declaration in ${repositoryPath}`) + } + declarationRecords.push({ + key: `${repositoryPath}#${declaration}`, + kind: declarationKind === 'abstract contract' ? 'abstract' : declarationKind, + source: repositoryPath, + }) + } + if (sourceDeclarations.length === 0 && /^(struct|enum)\s+[A-Za-z_]\w*\b/m.test(source)) { + typeModuleSources.push(repositoryPath) + } + } + const declarationKeys = declarationRecords.map(record => record.key) + const registeredDeclarationKeys = contractAtlasNodes.flatMap(node => (node.declaration === undefined ? [] : [`${node.source}#${node.declaration}`])) + const declarationKeySet = new Set(declarationKeys) + const registeredDeclarationKeySet = new Set(registeredDeclarationKeys) + if (declarationKeySet.size !== declarationKeys.length) { + throw new Error('Solidity source inventory contains duplicate declaration keys') + } + if (registeredDeclarationKeySet.size !== registeredDeclarationKeys.length) { + throw new Error('Complete contract atlas contains duplicate declaration keys') + } + const declarationIssue = stringSetIssue('Complete contract atlas declaration mismatch', declarationKeys, registeredDeclarationKeys) + if (declarationIssue !== undefined) throw new Error(declarationIssue) + const registeredTypeModuleSources = contractAtlasNodes.filter(node => node.kind === 'module' && node.declaration === undefined).map(node => node.source) + const sourceTypeModuleIssue = stringSetIssue('Complete contract atlas type-module source mismatch', typeModuleSources, registeredTypeModuleSources) + if (sourceTypeModuleIssue !== undefined) throw new Error(sourceTypeModuleIssue) + const expectedTypeModuleIssue = stringSetIssue('Complete contract atlas must register the two named type modules', [...expectedContractAtlasTypeModuleSources], registeredTypeModuleSources) + if (expectedTypeModuleIssue !== undefined) throw new Error(expectedTypeModuleIssue) + const unregisteredModuleProbe = stringSetIssue('Complete contract atlas type-module negative probe', [...typeModuleSources, 'solidity/contracts/peripherals/UnregisteredTypes.sol'], registeredTypeModuleSources) + if (unregisteredModuleProbe === undefined) { + throw new Error('Complete contract atlas type-module coverage did not reject an unregistered type module') + } + if (contractAtlasNodes.length !== expectedContractAtlasNodeCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasNodeCount} nodes, found ${contractAtlasNodes.length}`) + } + const nodeIds = contractAtlasNodes.map(node => node.id) + const nodeIdSet = new Set(nodeIds) + const nodeById = new Map(contractAtlasNodes.map(node => [node.id, node])) + if (nodeIdSet.size !== nodeIds.length) { + throw new Error('Complete contract atlas node IDs must be unique') + } + if (contractAtlasInventoryRows.length !== expectedContractAtlasNodeCount) { + throw new Error(`Complete contract atlas component inventory expected ${expectedContractAtlasNodeCount} rows, found ${contractAtlasInventoryRows.length}`) + } + const inventoryNodeIssue = exactRelationshipSetIssue( + 'Complete contract atlas component inventory mismatch', + nodeIds, + contractAtlasInventoryRows.map(row => row.node.id), + ) + if (inventoryNodeIssue !== undefined) throw new Error(inventoryNodeIssue) + if (contractAtlasInventoryRows.some(row => row.panelLabel.trim().length === 0)) { + throw new Error('Complete contract atlas component inventory contains an empty region label') + } + const sourcePathSet = new Set(sourceEntries.map(entry => path.posix.join('solidity/contracts', entry.split(path.sep).join('/')))) + for (const node of contractAtlasNodes) { + if (!sourcePathSet.has(node.source)) { + throw new Error(`Complete contract atlas node ${node.id} references missing source ${node.source}`) + } + const isTestDeclaration = node.source.startsWith('solidity/contracts/test/') + if ((node.panel === 'tests') !== isTestDeclaration) { + throw new Error(`Complete contract atlas node ${node.id} is assigned to the wrong production or test panel`) + } + if (node.declaration !== undefined) { + const record = declarationRecords.find(candidate => candidate.key === `${node.source}#${node.declaration}`) + if (record === undefined || record.kind !== node.kind) { + throw new Error(`Complete contract atlas node ${node.id} has the wrong Solidity declaration kind`) + } + } + } + if (contractAtlasSourceReferences.length !== expectedContractAtlasSourceReferenceCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasSourceReferenceCount} direct source references, found ${contractAtlasSourceReferences.length}`) + } + const sourceAnalysis = await analyzeContractAtlasSource(contractsDirectory, contractAtlasNodes, contractAtlasSourceOwnerOverrides) + const derivedSourceReferences = sourceAnalysis.references + const sourceReferenceIssue = contractAtlasSourceReferenceIssue(derivedSourceReferences, contractAtlasSourceReferences) + if (sourceReferenceIssue !== undefined) throw new Error(sourceReferenceIssue) + if (contractAtlasSourceReferenceIssue(derivedSourceReferences, contractAtlasSourceReferences.slice(1)) === undefined) { + throw new Error('Complete contract atlas source-reference coverage did not reject a removed relationship') + } + const delegatecallPairs = new Set(sourceAnalysis.delegatecalls.map(relationship => `${relationship.source}->${relationship.target}`)) + const behavioralCandidates = await analyzeContractAtlasBehavioralReferences(contractsDirectory, contractAtlasNodes, contractAtlasSourceOwnerOverrides, contractAtlasSourceReferences, delegatecallPairs) + if (behavioralCandidates.length !== expectedContractAtlasBehavioralCandidateCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasBehavioralCandidateCount} compiler-derived behavioral candidates, found ${behavioralCandidates.length}`) + } + if (behavioralCandidates.some(candidate => candidate.source === 'test-openoracle-rejecting-receiver' && candidate.target === 'statoblast-ierc1155-receiver')) { + throw new Error('Complete contract atlas behavioral analysis misclassified an interface selector as a test-helper invocation') + } + if (behavioralCandidates.some(candidate => candidate.source === 'statoblast-escalation-game' && candidate.target === 'statoblast-escalation-deposit-delegate')) { + throw new Error('Complete contract atlas behavioral analysis misclassified an encoded delegatecall member as a direct invocation') + } + for (const [source, target, expectedMembers] of [ + ['openoracle-core', 'openoracle-ierc20', ['transfer']], + ['openoracle-safe-erc20', 'openoracle-ierc20', ['allowance', 'approve', 'transfer', 'transferFrom']], + ['zoltar-safe-erc20-ops', 'zoltar-ierc20', ['approve', 'transfer', 'transferFrom']], + ] as const) { + const candidate = behavioralCandidates.find(reference => reference.source === source && reference.target === target) + if (candidate === undefined || candidate.relation !== 'calls' || candidate.members.join(',') !== expectedMembers.join(',')) { + throw new Error(`Complete contract atlas behavioral analysis did not preserve normal low-level calls for ${source}->${target}`) + } + } + function replaceBehavioralMutation(source: string, search: string, replacement: string, label: string): string { + const firstMatch = source.indexOf(search) + if (firstMatch < 0 || source.indexOf(search, firstMatch + search.length) >= 0) { + throw new Error(`Complete contract atlas behavioral ${label} mutation expected exactly one source match`) + } + return `${source.slice(0, firstMatch)}${replacement}${source.slice(firstMatch + search.length)}` + } + const safeErc20OpsPath = 'solidity/contracts/SafeERC20Ops.sol' + const safeErc20OpsSource = await readFile(path.join(repositoryRoot, safeErc20OpsPath), 'utf8') + const safeErc20OpsMutation = replaceBehavioralMutation(safeErc20OpsSource, '\t\t(bool success, bytes memory returnData) = address(token).call(callData);', '\t\tbool success = true;\n\t\tbytes memory returnData = new bytes(0);', 'SafeERC20Ops low-level call') + const safeErc20OpsMutationCandidates = await analyzeContractAtlasBehavioralReferences(contractsDirectory, contractAtlasNodes, contractAtlasSourceOwnerOverrides, contractAtlasSourceReferences, delegatecallPairs, new Map([[safeErc20OpsPath, safeErc20OpsMutation]])) + if (safeErc20OpsMutationCandidates.some(candidate => candidate.source === 'zoltar-safe-erc20-ops' && candidate.target === 'zoltar-ierc20' && candidate.relation === 'calls')) { + throw new Error('Complete contract atlas behavioral analysis accepted encoded ERC-20 members after the SafeERC20Ops low-level call was removed') + } + const openOraclePath = 'solidity/contracts/peripherals/openOracle/OpenOracle.sol' + const openOracleSource = await readFile(path.join(repositoryRoot, openOraclePath), 'utf8') + const openOracleMutation = replaceBehavioralMutation( + openOracleSource, + '\t\t\t(bool success, bytes memory returndata) = token.call(\n\t\t\t\tabi.encodeWithSelector(IERC20.transfer.selector, to, amount)\n\t\t\t);', + '\t\t\t(bool success, bytes memory returndata) = (\n\t\t\t\ttrue,\n\t\t\t\tabi.encodeWithSelector(IERC20.transfer.selector, to, amount)\n\t\t\t);', + 'OpenOracle low-level call', + ) + const openOracleMutationCandidates = await analyzeContractAtlasBehavioralReferences(contractsDirectory, contractAtlasNodes, contractAtlasSourceOwnerOverrides, contractAtlasSourceReferences, delegatecallPairs, new Map([[openOraclePath, openOracleMutation]])) + if (openOracleMutationCandidates.some(candidate => candidate.source === 'openoracle-core' && candidate.target === 'openoracle-ierc20' && candidate.relation === 'calls')) { + throw new Error('Complete contract atlas behavioral analysis accepted an encoded IERC20 transfer after the OpenOracle low-level call was removed') + } + const openZeppelinSafeErc20Path = 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol' + const openZeppelinSafeErc20Source = await readFile(path.join(repositoryRoot, openZeppelinSafeErc20Path), 'utf8') + const openZeppelinSafeErc20Mutation = replaceBehavioralMutation( + replaceBehavioralMutation(openZeppelinSafeErc20Source, ' let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)', ' let success := 1', 'OpenZeppelin SafeERC20 reverting assembly call'), + ' success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)', + ' success := 1', + 'OpenZeppelin SafeERC20 boolean assembly call', + ) + const openZeppelinSafeErc20MutationCandidates = await analyzeContractAtlasBehavioralReferences(contractsDirectory, contractAtlasNodes, contractAtlasSourceOwnerOverrides, contractAtlasSourceReferences, delegatecallPairs, new Map([[openZeppelinSafeErc20Path, openZeppelinSafeErc20Mutation]])) + const mutatedOpenZeppelinSafeErc20Candidate = openZeppelinSafeErc20MutationCandidates.find(candidate => candidate.source === 'openoracle-safe-erc20' && candidate.target === 'openoracle-ierc20') + if (mutatedOpenZeppelinSafeErc20Candidate === undefined || mutatedOpenZeppelinSafeErc20Candidate.members.join(',') !== 'allowance') { + throw new Error('Complete contract atlas behavioral analysis retained encoded OpenZeppelin ERC-20 members after its assembly calls were removed') + } + const manuallyCoversBehavior = (reference: ContractAtlasBehavioralReference, edge: (typeof contractAtlasEdges)[number]) => !edge.id.startsWith('source-behavior-') && edge.source === reference.source && edge.target === reference.target && contractAtlasBehavioralRelationIsCovered(reference.relation, edge.relation) + const behavioralCandidateIssue = contractAtlasBehavioralReferenceIssue(behavioralCandidates, contractAtlasBehavioralReferences) + if (behavioralCandidateIssue !== undefined) throw new Error(behavioralCandidateIssue) + if (contractAtlasBehavioralReferenceIssue(behavioralCandidates, contractAtlasBehavioralReferences.slice(1)) === undefined) { + throw new Error('Complete contract atlas behavioral-candidate coverage did not reject a removed relationship') + } + const expectedBehavioralReferences = behavioralCandidates.filter(reference => !contractAtlasEdges.some(edge => manuallyCoversBehavior(reference, edge))) + if (expectedBehavioralReferences.length !== expectedContractAtlasBehavioralReferenceCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasBehavioralReferenceCount} source-derived behavioral references, found ${expectedBehavioralReferences.length}`) + } + const behavioralCoverageIssueFor = (edges: readonly (typeof contractAtlasEdges)[number][] = contractAtlasEdges, evidenceEntries: readonly ContractAtlasSemanticEvidence[] = contractAtlasSemanticEvidence) => contractAtlasBehavioralCoverageIssue(edges, behavioralCandidates, evidenceEntries) + const behavioralCoverageIssue = behavioralCoverageIssueFor() + if (behavioralCoverageIssue !== undefined) throw new Error(behavioralCoverageIssue) + const behavioralEdgeIssueFor = (edges: readonly (typeof contractAtlasEdges)[number][] = contractAtlasEdges) => contractAtlasBehavioralEdgeIssue(edges, expectedBehavioralReferences, nodeById) + const behavioralEdgeIssue = behavioralEdgeIssueFor() + if (behavioralEdgeIssue !== undefined) throw new Error(behavioralEdgeIssue) + const behavioralCallEdge = contractAtlasEdges.find(edge => edge.id.startsWith('source-behavior-') && edge.relation === 'calls') + if (behavioralCallEdge === undefined) throw new Error('Complete contract atlas has no source-derived call for behavioral mutation probes') + const reclassifiedBehavioralCallEdges = contractAtlasEdges.map(edge => (edge.id === behavioralCallEdge.id ? { ...edge, relation: 'references' as const } : edge)) + if (behavioralEdgeIssueFor(reclassifiedBehavioralCallEdges) === undefined) { + throw new Error('Complete contract atlas behavioral coverage did not reject a direct call reclassified as a generic reference') + } + const behavioralUseEdge = contractAtlasEdges.find(edge => edge.id.startsWith('source-behavior-') && edge.relation === 'uses') + if (behavioralUseEdge === undefined) throw new Error('Complete contract atlas has no source-derived library use for behavioral mutation probes') + const reclassifiedBehavioralUseEdges = contractAtlasEdges.map(edge => (edge.id === behavioralUseEdge.id ? { ...edge, relation: 'references' as const } : edge)) + if (behavioralEdgeIssueFor(reclassifiedBehavioralUseEdges) === undefined) { + throw new Error('Complete contract atlas behavioral coverage did not reject a library use reclassified as a generic reference') + } + const manualBehaviorCandidate = behavioralCandidates.find(candidate => candidate.source === 'openoracle-core' && candidate.target === 'openoracle-signature-transfer') + const manualBehaviorEdge = contractAtlasEdges.find(edge => edge.id === 'openoracle-permit2') + if (manualBehaviorCandidate === undefined || manualBehaviorEdge === undefined || !manuallyCoversBehavior(manualBehaviorCandidate, manualBehaviorEdge)) { + throw new Error('Complete contract atlas has no manually evidenced behavioral relationship for mutation probes') + } + const reclassifiedManualBehaviorEdges = contractAtlasEdges.map(edge => (edge.id === manualBehaviorEdge.id ? { ...edge, relation: 'deploys' as const } : edge)) + if (behavioralCoverageIssueFor(reclassifiedManualBehaviorEdges) === undefined) { + throw new Error('Complete contract atlas behavioral coverage accepted an unrelated deployment in place of a direct call') + } + if ( + behavioralCoverageIssueFor( + contractAtlasEdges, + contractAtlasSemanticEvidence.filter(evidence => evidence.edgeId !== manualBehaviorEdge.id), + ) === undefined + ) { + throw new Error('Complete contract atlas behavioral coverage accepted a manual call without checked semantic evidence') + } + for (const [edgeId, member] of [ + ['source-behavior-statoblast-escalation-game-factory--statoblast-escalation-game', 'startFromFork'], + ['source-behavior-zoltar-core--zoltar-reputation-token', 'mint'], + ] as const) { + const memberEdge = contractAtlasEdges.find(edge => edge.id === edgeId) + if (memberEdge === undefined || !memberEdge.description.includes(member)) { + throw new Error(`Complete contract atlas has no ${member} behavioral meaning for mutation probes`) + } + const omittedMemberEdges = contractAtlasEdges.map(edge => (edge.id === edgeId ? { ...edge, description: edge.description.replace(`${member}, `, '').replace(`, ${member}`, '').replace(` ${member}.`, '.') } : edge)) + if (behavioralEdgeIssueFor(omittedMemberEdges) === undefined) { + throw new Error(`Complete contract atlas behavioral coverage accepted a generated meaning with ${member} omitted`) + } + } + const testSources = new Map() + const testDirectory = path.join(repositoryRoot, 'solidity/ts/tests') + for (const execution of Object.values(contractAtlasTestExecutionEvidence)) { + const testPath = path.resolve(repositoryRoot, execution.file) + if (!execution.file.startsWith('solidity/ts/tests/') || (testPath !== testDirectory && !testPath.startsWith(`${testDirectory}${path.sep}`))) { + throw new Error(`Complete contract atlas test evidence references a path outside Solidity TypeScript tests: ${execution.file}`) + } + if (!testSources.has(execution.file)) testSources.set(execution.file, await readFile(testPath, 'utf8')) + } + const semanticEvidenceIssueFor = ( + edges: readonly (typeof contractAtlasEdges)[number][] = contractAtlasEdges, + evidenceEntries: readonly ContractAtlasSemanticEvidence[] = contractAtlasSemanticEvidence, + semanticMeanings: Readonly> = contractAtlasSemanticMeanings, + callClaimEvidence: Readonly> = contractAtlasCallClaimEvidence, + useClaimEvidence: Readonly> = contractAtlasUseClaimEvidence, + compatibilityEvidence: Readonly> = contractAtlasCompatibilityEvidence, + testExecutionEvidence: Readonly> = contractAtlasTestExecutionEvidence, + sourceUnits: readonly { nodeId: string; source: string }[] = sourceAnalysis.sourceUnits, + checkedTestSources: ReadonlyMap = testSources, + ) => contractAtlasSemanticEvidenceIssue(edges, evidenceEntries, semanticMeanings, callClaimEvidence, useClaimEvidence, compatibilityEvidence, testExecutionEvidence, sourceUnits, checkedTestSources) + const semanticEvidenceIssue = semanticEvidenceIssueFor() + if (semanticEvidenceIssue !== undefined) throw new Error(semanticEvidenceIssue) + const firstSemanticEdge = contractAtlasEdges.find(edge => edge.relation === 'calls') + if (firstSemanticEdge === undefined) throw new Error('Complete contract atlas has no runtime call for semantic evidence probes') + const targetMutation = contractAtlasEdges.map(edge => (edge.id === firstSemanticEdge.id ? { ...edge, target: 'zoltar-core' } : edge)) + if (semanticEvidenceIssueFor(targetMutation) === undefined) { + throw new Error('Complete contract atlas semantic evidence did not reject a changed target') + } + const relationMutation = contractAtlasEdges.map(edge => (edge.id === firstSemanticEdge.id ? { ...edge, relation: 'uses' as const } : edge)) + if (semanticEvidenceIssueFor(relationMutation) === undefined) { + throw new Error('Complete contract atlas semantic evidence did not reject a reclassified relationship') + } + const meaningMutation = contractAtlasEdges.map(edge => (edge.id === firstSemanticEdge.id ? { ...edge, description: `${edge.description} On every deposit.` } : edge)) + if (semanticEvidenceIssueFor(meaningMutation) === undefined) { + throw new Error('Complete contract atlas semantic evidence did not reject a changed non-asset meaning') + } + const firstAssetEvidence = contractAtlasSemanticEvidence.find(evidence => evidence.relation === 'assets') + const firstAssetFlow = firstAssetEvidence?.assetFlows?.[0] + if (firstAssetEvidence === undefined || firstAssetFlow === undefined) throw new Error('Complete contract atlas has no asset flow for direction evidence probes') + const assetDirection = `${firstAssetFlow.sender} → ${firstAssetFlow.recipient}` + const reversedAssetDirection = `${firstAssetFlow.recipient} → ${firstAssetFlow.sender}` + const reversedAssetEdges = contractAtlasEdges.map(edge => (edge.id === firstAssetEvidence.edgeId ? { ...edge, description: edge.description.replace(assetDirection, reversedAssetDirection) } : edge)) + if (semanticEvidenceIssueFor(reversedAssetEdges) === undefined) { + throw new Error('Complete contract atlas semantic evidence did not reject a reversed asset direction') + } + const firstSelectorEvidence = contractAtlasSemanticEvidence.find(evidence => evidence.locations[0]?.selectors[0] !== undefined) + const firstSelectorLocation = firstSelectorEvidence?.locations[0] + const firstSelector = firstSelectorLocation?.selectors[0] + if (firstSelectorEvidence === undefined || firstSelectorLocation === undefined || firstSelector === undefined) { + throw new Error('Complete contract atlas has no selector for semantic evidence probes') + } + const changedSelectorEvidence = contractAtlasSemanticEvidence.map(evidence => + evidence.edgeId === firstSelectorEvidence.edgeId + ? { + ...evidence, + locations: [ + { + ...firstSelectorLocation, + selectors: [`${firstSelector}semanticEvidenceProbe`, ...firstSelectorLocation.selectors.slice(1)], + }, + ...evidence.locations.slice(1), + ], + } + : evidence, + ) + if (semanticEvidenceIssueFor(contractAtlasEdges, changedSelectorEvidence) === undefined) { + throw new Error('Complete contract atlas semantic evidence did not reject a stale source selector') + } + const precisionClaims = contractAtlasUseClaimEvidence['pool-utils-runtime'] + const precisionClaimIndex = precisionClaims?.findIndex(claim => claim.phrase === 'precision') ?? -1 + const precisionClaim = precisionClaims?.[precisionClaimIndex] + const precisionMeaning = contractAtlasSemanticMeanings['pool-utils-runtime'] + if (precisionClaims === undefined || precisionClaim === undefined || precisionMeaning === undefined) { + throw new Error('Complete contract atlas has no fixed-point precision claim for BPS unit probes') + } + const unsupportedBpsMeaning = precisionMeaning.replace('precision', 'BPS') + const unsupportedBpsEdges = contractAtlasEdges.map(edge => (edge.id === 'pool-utils-runtime' ? { ...edge, description: unsupportedBpsMeaning } : edge)) + const unsupportedBpsMeanings = { ...contractAtlasSemanticMeanings, 'pool-utils-runtime': unsupportedBpsMeaning } + const unsupportedBpsClaims = { + ...contractAtlasUseClaimEvidence, + 'pool-utils-runtime': precisionClaims.map((claim, index) => (index === precisionClaimIndex ? { ...claim, phrase: 'BPS' } : claim)), + } + if (semanticEvidenceIssueFor(unsupportedBpsEdges, contractAtlasSemanticEvidence, unsupportedBpsMeanings, contractAtlasCallClaimEvidence, unsupportedBpsClaims) === undefined) { + throw new Error('Complete contract atlas semantic claims did not reject a BPS meaning backed only by fixed-point precision') + } + const factorySourceUnit = sourceAnalysis.sourceUnits.find(sourceUnit => sourceUnit.nodeId === 'statoblast-security-pool-factory') + if (factorySourceUnit === undefined) throw new Error('Complete contract atlas has no pool factory source unit for semantic claim probes') + const changedFactorySource = factorySourceUnit.source.replace('zoltar.forkQuestionMatches(', 'zoltar.semanticEvidenceForkQuestionMatchesProbe(') + if (changedFactorySource === factorySourceUnit.source) throw new Error('Complete contract atlas could not mutate a factory-to-Zoltar call claim') + const changedFactorySourceUnits = sourceAnalysis.sourceUnits.map(sourceUnit => (sourceUnit.nodeId === factorySourceUnit.nodeId ? { ...sourceUnit, source: changedFactorySource } : sourceUnit)) + if (semanticEvidenceIssueFor(contractAtlasEdges, contractAtlasSemanticEvidence, contractAtlasSemanticMeanings, contractAtlasCallClaimEvidence, contractAtlasUseClaimEvidence, contractAtlasCompatibilityEvidence, contractAtlasTestExecutionEvidence, changedFactorySourceUnits) === undefined) { + throw new Error('Complete contract atlas semantic claims did not reject a removed factory-to-Zoltar operation') + } + const securityPoolSourceUnit = sourceAnalysis.sourceUnits.find(sourceUnit => sourceUnit.nodeId === 'statoblast-security-pool') + if (securityPoolSourceUnit === undefined) throw new Error('Complete contract atlas has no security pool source unit for semantic claim probes') + const changedSecurityPoolSource = securityPoolSourceUnit.source.replace('shareToken.burnTokenIdAndGetRemainingSupply(', 'shareToken.semanticEvidenceBurnWinningSharesProbe(') + if (changedSecurityPoolSource === securityPoolSourceUnit.source) throw new Error('Complete contract atlas could not mutate the winning-share redemption claim') + const changedSecurityPoolSourceUnits = sourceAnalysis.sourceUnits.map(sourceUnit => (sourceUnit.nodeId === securityPoolSourceUnit.nodeId ? { ...sourceUnit, source: changedSecurityPoolSource } : sourceUnit)) + if (semanticEvidenceIssueFor(contractAtlasEdges, contractAtlasSemanticEvidence, contractAtlasSemanticMeanings, contractAtlasCallClaimEvidence, contractAtlasUseClaimEvidence, contractAtlasCompatibilityEvidence, contractAtlasTestExecutionEvidence, changedSecurityPoolSourceUnits) === undefined) { + throw new Error('Complete contract atlas semantic claims did not reject a removed winning-share redemption operation') + } + const priceReadClaims = contractAtlasCallClaimEvidence['pool-price-coordinator'] + const priceReadClaim = priceReadClaims?.[0] + if (priceReadClaims === undefined || priceReadClaim === undefined) throw new Error('Complete contract atlas has no pool-to-coordinator direction claim') + const reversedPriceReadClaim: ContractAtlasSemanticClaimEvidence = { ...priceReadClaim, callSide: 'receiver' } + const reversedPriceReadClaims: Record = { + ...contractAtlasCallClaimEvidence, + 'pool-price-coordinator': [reversedPriceReadClaim, ...priceReadClaims.slice(1)], + } + if (semanticEvidenceIssueFor(contractAtlasEdges, contractAtlasSemanticEvidence, contractAtlasSemanticMeanings, reversedPriceReadClaims) === undefined) { + throw new Error('Complete contract atlas semantic claims did not reject a source operation classified as receiver authorization') + } + const priceCoordinatorSourceUnit = sourceAnalysis.sourceUnits.find(sourceUnit => sourceUnit.nodeId === 'statoblast-price-coordinator') + if (priceCoordinatorSourceUnit === undefined) throw new Error('Complete contract atlas has no price coordinator source unit for callback-target probes') + const changedPriceCoordinatorSource = priceCoordinatorSourceUnit.source.replace('callbackContract: address(this)', 'callbackContract: address(0)') + if (changedPriceCoordinatorSource === priceCoordinatorSourceUnit.source) throw new Error('Complete contract atlas could not disconnect the configured OpenOracle callback target') + const changedPriceCoordinatorSourceUnits = sourceAnalysis.sourceUnits.map(sourceUnit => (sourceUnit.nodeId === priceCoordinatorSourceUnit.nodeId ? { ...sourceUnit, source: changedPriceCoordinatorSource } : sourceUnit)) + if (semanticEvidenceIssueFor(contractAtlasEdges, contractAtlasSemanticEvidence, contractAtlasSemanticMeanings, contractAtlasCallClaimEvidence, contractAtlasUseClaimEvidence, contractAtlasCompatibilityEvidence, contractAtlasTestExecutionEvidence, changedPriceCoordinatorSourceUnits) === undefined) { + throw new Error('Complete contract atlas semantic claims did not reject a disconnected OpenOracle callback target') + } + const wethSourceUnit = sourceAnalysis.sourceUnits.find(sourceUnit => sourceUnit.nodeId === 'infra-weth9') + if (wethSourceUnit === undefined) throw new Error('Complete contract atlas has no WETH source unit for compatibility probes') + const changedWethSource = wethSourceUnit.source.replace('function approve(address guy, uint wad)', 'function semanticEvidenceApproveProbe(address guy, uint wad)') + if (changedWethSource === wethSourceUnit.source) throw new Error('Complete contract atlas could not mutate an IWeth9 compatibility member') + const changedWethSourceUnits = sourceAnalysis.sourceUnits.map(sourceUnit => (sourceUnit.nodeId === wethSourceUnit.nodeId ? { ...sourceUnit, source: changedWethSource } : sourceUnit)) + if (semanticEvidenceIssueFor(contractAtlasEdges, contractAtlasSemanticEvidence, contractAtlasSemanticMeanings, contractAtlasCallClaimEvidence, contractAtlasUseClaimEvidence, contractAtlasCompatibilityEvidence, contractAtlasTestExecutionEvidence, changedWethSourceUnits) === undefined) { + throw new Error('Complete contract atlas compatibility evidence did not reject a removed IWeth9 member') + } + const firstTestEvidence = contractAtlasSemanticEvidence.find(evidence => evidence.relation === 'tests') + if (firstTestEvidence === undefined) throw new Error('Complete contract atlas has no test relationship for semantic evidence probes') + const changedTestTarget = firstTestEvidence.target === 'zoltar-core' ? 'statoblast-security-pool' : 'zoltar-core' + const changedTestEdges = contractAtlasEdges.map(edge => (edge.id === firstTestEvidence.edgeId ? { ...edge, target: changedTestTarget } : edge)) + const changedTestEvidence = contractAtlasSemanticEvidence.map(evidence => (evidence.edgeId === firstTestEvidence.edgeId ? { ...evidence, target: changedTestTarget } : evidence)) + if (semanticEvidenceIssueFor(changedTestEdges, changedTestEvidence) === undefined) { + throw new Error('Complete contract atlas test evidence did not reject a coordinated relationship and evidence target mutation') + } + const thresholdExecution = contractAtlasTestExecutionEvidence['test-threshold-pool'] + if (thresholdExecution === undefined) throw new Error('Complete contract atlas has no fork-threshold execution evidence') + const thresholdTestSource = testSources.get(thresholdExecution.file) + if (thresholdTestSource === undefined) throw new Error('Complete contract atlas has no fork-threshold TypeScript test source') + const changedThresholdTestSource = thresholdTestSource.replace("functionName: 'computeWinningWithdrawal'", "functionName: 'semanticEvidenceWinningWithdrawalProbe'") + if (changedThresholdTestSource === thresholdTestSource) throw new Error('Complete contract atlas could not disconnect the fork-threshold helper invocation') + const changedThresholdTestSources = new Map(testSources) + changedThresholdTestSources.set(thresholdExecution.file, changedThresholdTestSource) + if ( + semanticEvidenceIssueFor(contractAtlasEdges, contractAtlasSemanticEvidence, contractAtlasSemanticMeanings, contractAtlasCallClaimEvidence, contractAtlasUseClaimEvidence, contractAtlasCompatibilityEvidence, contractAtlasTestExecutionEvidence, sourceAnalysis.sourceUnits, changedThresholdTestSources) === undefined + ) { + throw new Error('Complete contract atlas test evidence did not reject a disconnected fork-threshold helper invocation') + } + if (sourceAnalysis.explicitDeployments.length !== expectedContractAtlasExplicitDeploymentCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasExplicitDeploymentCount} source-derived new or CREATE2 deployments, found ${sourceAnalysis.explicitDeployments.length}`) + } + const derivedDeploymentPairs = sourceAnalysis.explicitDeployments.map(deployment => `${deployment.source}->${deployment.target}`) + const registeredDeploymentPairs = contractAtlasEdges.filter(edge => edge.relation === 'deploys').map(edge => `${edge.source}->${edge.target}`) + const deploymentIssue = exactRelationshipSetIssue('Complete contract atlas deployment relationship mismatch', derivedDeploymentPairs, registeredDeploymentPairs) + if (deploymentIssue !== undefined) throw new Error(deploymentIssue) + if (exactRelationshipSetIssue('Complete contract atlas deployment removal probe', derivedDeploymentPairs, registeredDeploymentPairs.slice(1)) === undefined) { + throw new Error('Complete contract atlas deployment coverage did not reject a removed deployment') + } + if (exactRelationshipSetIssue('Complete contract atlas deployment addition probe', derivedDeploymentPairs, [...registeredDeploymentPairs, 'probe-source->probe-target']) === undefined) { + throw new Error('Complete contract atlas deployment coverage did not reject an extra deployment') + } + if (sourceAnalysis.directBases.length !== expectedContractAtlasDirectBaseCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasDirectBaseCount} direct inheritance and implementation relationships, found ${sourceAnalysis.directBases.length}`) + } + const derivedDirectBaseKeys = sourceAnalysis.directBases.map(relationship => `${relationship.source}->${relationship.target}:${relationship.relation}`) + const registeredDirectBaseKeys = contractAtlasEdges.filter(edge => edge.relation === 'implements' || edge.relation === 'inherits').map(edge => `${edge.source}->${edge.target}:${edge.relation}`) + const directBaseIssue = exactRelationshipSetIssue('Complete contract atlas direct inheritance and implementation mismatch', derivedDirectBaseKeys, registeredDirectBaseKeys) + if (directBaseIssue !== undefined) throw new Error(directBaseIssue) + const firstDirectBaseKey = derivedDirectBaseKeys[0] + const firstDirectBasePair = firstDirectBaseKey === undefined ? 'probe-source->probe-target' : firstDirectBaseKey.slice(0, firstDirectBaseKey.lastIndexOf(':')) + const reclassifiedDirectBaseProbe = [`${firstDirectBasePair}:calls`, ...derivedDirectBaseKeys.slice(1)] + if (exactRelationshipSetIssue('Complete contract atlas direct-base reclassification probe', derivedDirectBaseKeys, reclassifiedDirectBaseProbe) === undefined) { + throw new Error('Complete contract atlas direct-base coverage did not reject a reclassified relationship') + } + if (sourceAnalysis.delegatecalls.length !== expectedContractAtlasDelegatecallCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasDelegatecallCount} directly resolved delegatecall relationships, found ${sourceAnalysis.delegatecalls.length}`) + } + const derivedDelegatecallPairs = sourceAnalysis.delegatecalls.map(relationship => `${relationship.source}->${relationship.target}`) + const registeredDelegatecallPairs = contractAtlasEdges.filter(edge => edge.relation === 'delegatecall').map(edge => `${edge.source}->${edge.target}`) + const delegatecallIssue = exactRelationshipSetIssue('Complete contract atlas delegatecall relationship mismatch', derivedDelegatecallPairs, registeredDelegatecallPairs) + if (delegatecallIssue !== undefined) throw new Error(delegatecallIssue) + if (exactRelationshipSetIssue('Complete contract atlas delegatecall target probe', derivedDelegatecallPairs, ['probe-source->probe-target', ...derivedDelegatecallPairs.slice(1)]) === undefined) { + throw new Error('Complete contract atlas delegatecall coverage did not reject a changed target') + } + const sourceDerivedMeaningIssue = contractAtlasSourceDerivedMeaningIssue(contractAtlasEdges, nodeById) + if (sourceDerivedMeaningIssue !== undefined) throw new Error(sourceDerivedMeaningIssue) + const firstSourceDerivedEdge = contractAtlasEdges.find(edge => edge.relation === 'delegatecall' || edge.relation === 'deploys' || edge.relation === 'implements' || edge.relation === 'inherits') + if (firstSourceDerivedEdge === undefined) throw new Error('Complete contract atlas has no source-derived relationship meaning for mutation probes') + const changedSourceDerivedMeaning = contractAtlasEdges.map(edge => (edge.id === firstSourceDerivedEdge.id ? { ...edge, description: `${edge.description} Unchecked extra claim.` } : edge)) + if (contractAtlasSourceDerivedMeaningIssue(changedSourceDerivedMeaning, nodeById) === undefined) { + throw new Error('Complete contract atlas source-derived meaning validation did not reject an extra unverified clause') + } + const relationshipIssue = contractAtlasRelationshipIssue(contractAtlasEdges, nodeIdSet) + if (relationshipIssue !== undefined) throw new Error(relationshipIssue) + if (contractAtlasRelationshipIssue(contractAtlasEdges.slice(1), nodeIdSet) === undefined) { + throw new Error('Complete contract atlas relationship coverage did not reject a removed relationship') + } + if (contractAtlasRelationshipRows.length !== expectedContractAtlasRelationshipCount) { + throw new Error(`Complete contract atlas generated ${contractAtlasRelationshipRows.length} register rows for ${expectedContractAtlasRelationshipCount} relationships`) + } + const rowEdgeIssue = stringSetIssue( + 'Complete contract atlas generated relationship rows mismatch', + contractAtlasEdges.map(edge => edge.id), + contractAtlasRelationshipRows.map(row => row.edge.id), + ) + if (rowEdgeIssue !== undefined) throw new Error(rowEdgeIssue) + if (contractAtlasPlotRoutes.length !== expectedContractAtlasPlotRouteCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasPlotRouteCount} ordered plot routes, found ${contractAtlasPlotRoutes.length}`) + } + const routePairs = contractAtlasPlotRoutes.map(route => `${route.source}->${route.target}`) + if (new Set(routePairs).size !== routePairs.length) { + throw new Error('Complete contract atlas plot routes must contain one route per ordered source-target pair') + } + const multiRelationRoutes = contractAtlasPlotRoutes.filter(route => route.edges.length > 1) + if (multiRelationRoutes.length !== expectedContractAtlasMultiRelationRouteCount) { + throw new Error(`Complete contract atlas expected ${expectedContractAtlasMultiRelationRouteCount} multi-relation plot routes, found ${multiRelationRoutes.length}`) + } + for (const route of contractAtlasPlotRoutes) { + if (route.edges.length === 0 || route.edges.some(edge => edge.source !== route.source || edge.target !== route.target)) { + throw new Error(`Complete contract atlas plot route ${route.id} contains a relationship for another ordered pair`) + } + const meaning = contractAtlasPlotRouteMeaning(route) + for (const edge of route.edges) { + if (!meaning.includes(`${contractAtlasRelationLabels[edge.relation]}: ${edge.description}`)) { + throw new Error(`Complete contract atlas plot route ${route.id} omits relationship ${edge.id} from its tooltip meaning`) + } + } + } + const testProductionTargetIds = [ + ...new Set( + contractAtlasPlotRoutes.flatMap(route => { + const source = nodeById.get(route.source) + const target = nodeById.get(route.target) + if (source === undefined || target === undefined) throw new Error(`Complete contract atlas plot route ${route.id} has an unknown endpoint`) + return source.panel === 'tests' && target.panel !== 'tests' ? [target.id] : [] + }), + ), + ] + const gatewayTargetIssue = stringSetIssue('Complete contract atlas test-gateway target classification mismatch', testProductionTargetIds, [...contractAtlasTestGatewayByTargetId.keys()]) + if (gatewayTargetIssue !== undefined) throw new Error(gatewayTargetIssue) + const gatewayIds = contractAtlasTestGatewayDefinitions.map(definition => definition.id) + if (new Set(gatewayIds).size !== gatewayIds.length) { + throw new Error('Complete contract atlas test-gateway definition IDs must be unique') + } + const usedGatewayIds = [...new Set(contractAtlasTestGatewayByTargetId.values())] + const gatewayUsageIssue = stringSetIssue('Complete contract atlas test-gateway definition usage mismatch', gatewayIds, usedGatewayIds) + if (gatewayUsageIssue !== undefined) throw new Error(gatewayUsageIssue) + const firstGatewayTarget = testProductionTargetIds[0] + if (firstGatewayTarget !== undefined) { + const removedGatewayTargets = [...contractAtlasTestGatewayByTargetId.keys()].filter(targetId => targetId !== firstGatewayTarget) + if (stringSetIssue('Complete contract atlas test-gateway removal probe', testProductionTargetIds, removedGatewayTargets) === undefined) { + throw new Error('Complete contract atlas test-gateway coverage did not reject an unclassified production target') + } + } + const routeEdgeIssue = stringSetIssue( + 'Complete contract atlas plot-route relationship mismatch', + contractAtlasEdges.map(edge => edge.id), + contractAtlasPlotRoutes.flatMap(route => route.edges.map(edge => edge.id)), + ) + if (routeEdgeIssue !== undefined) throw new Error(routeEdgeIssue) + const expectedViewIds = Object.keys(expectedContractAtlasViewRouteCounts) + const registeredViewIds = contractAtlasViewDefinitions.map(view => view.id) + const viewIdIssue = exactRelationshipSetIssue('Complete contract atlas relationship-layer definitions', expectedViewIds, registeredViewIds) + if (viewIdIssue !== undefined) throw new Error(viewIdIssue) + if (contractAtlasDefaultView !== 'protocol') { + throw new Error('Complete contract atlas must default to the reduced-overlap protocol-flow layer') + } + for (const view of contractAtlasViewDefinitions) { + const viewRoutes = contractAtlasPlotRoutesForView(view) + if (viewRoutes.length !== expectedContractAtlasViewRouteCounts[view.id]) { + throw new Error(`Complete contract atlas ${view.id} layer expected ${expectedContractAtlasViewRouteCounts[view.id]} routes, found ${viewRoutes.length}`) + } + } + const nonAllViews = contractAtlasViewDefinitions.filter(view => view.id !== 'all') + const partitionedRelations = nonAllViews.flatMap(view => view.relations) + const relationPartitionIssue = exactRelationshipSetIssue('Complete contract atlas relationship layers must partition every relation', Object.keys(contractAtlasRelationLabels), partitionedRelations) + if (relationPartitionIssue !== undefined) throw new Error(relationPartitionIssue) + const layeredEdgeIds = nonAllViews.flatMap(view => { + const viewRelations = new Set(view.relations) + return contractAtlasPlotRoutesForView(view).flatMap(route => route.edges.filter(edge => viewRelations.has(edge.relation)).map(edge => edge.id)) + }) + const layerCoverageIssue = exactRelationshipSetIssue( + 'Complete contract atlas reduced-overlap layers must preserve every relationship', + contractAtlasEdges.map(edge => edge.id), + layeredEdgeIds, + ) + if (layerCoverageIssue !== undefined) throw new Error(layerCoverageIssue) +} + function assertChartNode(value: unknown, chartId: string): void { if (!isRecord(value)) { throw new Error(`Chart ${chartId} contains a non-object node`) @@ -261,6 +1223,7 @@ for (const chartId of nativeChartIds) { } } assertNativeRegistryCoverage(nativeChartIds) +await assertContractAtlasCoverage() for (const chartId of quantitativeChartIds) { const axes = quantitativeChartAxisLabels[chartId] for (const axis of chartAxes) { @@ -302,9 +1265,12 @@ if (axisUsesRegisteredLabel(detachedLabelOptions, 'y', detachedLabelSource)) { if (!runtimeSource.includes('return markDrivenDiagramChart(spec)') || /createElementNS|RenderFunction|narrativeMark/.test(runtimeSource)) { throw new Error('Documentation flowcharts must use native Observable Plot marks without raw SVG DOM reconstruction') } -if (!runtimeSource.includes("mount.closest('figure.diagram, .example-visual')") || !runtimeSource.includes('overflowEnvelope.tabIndex = 0') || !runtimeSource.includes('Scrollable figure: ${spec.ariaLabel}')) { +if (!runtimeSource.includes("mount.closest('.diagram-scroll, figure.diagram, .example-visual')") || !runtimeSource.includes('overflowEnvelope.tabIndex = 0') || !runtimeSource.includes('Scrollable figure: ${spec.ariaLabel}')) { throw new Error('Documentation figure overflow wrappers must be keyboard-focusable and accessibly named') } +if (!runtimeSource.includes("assets: { dash: '14,4'") || !runtimeSource.includes("deploys: { dash: '2,3,10,3'") || !runtimeSource.includes("delegatecall: { dash: '4,3'")) { + throw new Error('Complete contract atlas asset, deployment, and delegatecall routes must have distinct non-color stroke patterns') +} if ( !/new Set\(contractInteractionEdges\.map/.test(runtimeSource) || !/does not match registry direction/.test(runtimeSource) || @@ -380,6 +1346,17 @@ function segmentsIntersect(firstStart: { x: number; y: number }, firstEnd: { x: Math.abs(cross(start, end, point)) <= tolerance && point.x >= Math.min(start.x, end.x) - tolerance && point.x <= Math.max(start.x, end.x) + tolerance && point.y >= Math.min(start.y, end.y) - tolerance && point.y <= Math.max(start.y, end.y) + tolerance return properIntersection || liesOnSegment(secondStart, firstStart, firstEnd) || liesOnSegment(secondEnd, firstStart, firstEnd) || liesOnSegment(firstStart, secondStart, secondEnd) || liesOnSegment(firstEnd, secondStart, secondEnd) } +const primaryBoundaryIssue = primaryContractInteractionBoundaryIssue(contractInteractionEdges) +if (primaryBoundaryIssue !== undefined) throw new Error(primaryBoundaryIssue) +const firstPrimaryInteraction = contractInteractionEdges[0] +if (firstPrimaryInteraction === undefined) throw new Error('Primary contract interaction map has no interaction for boundary probes') +if (primaryContractInteractionBoundaryIssue([...contractInteractionEdges, { ...firstPrimaryInteraction, id: `${firstPrimaryInteraction.id}-interaction-probe` }]) === undefined) { + throw new Error('Primary contract interaction boundary did not reject a twentieth interaction') +} +const thirteenthComponentProbe = contractInteractionEdges.map((edge, index) => (index === 0 ? { ...edge, source: 'Primary boundary probe component' } : edge)) +if (primaryContractInteractionBoundaryIssue(thirteenthComponentProbe) === undefined) { + throw new Error('Primary contract interaction boundary did not reject a thirteenth component') +} const routeById = new Map(layoutRoutes.map(route => [route.id, route])) if (routeById.size !== contractInteractionEdges.length || layoutRoutes.length !== contractInteractionEdges.length) { throw new Error(`Contract interaction layout has ${layoutRoutes.length} routes for ${contractInteractionEdges.length} registry edges`) @@ -434,14 +1411,92 @@ for (let firstRouteIndex = 0; firstRouteIndex < layoutRoutes.length; firstRouteI } } const contractInteractionHtml = await readFile(path.join(docsDirectory, 'contract-interactions.html'), 'utf8') +const contractInteractionWindow = new Window() +contractInteractionWindow.document.write(contractInteractionHtml) +contractInteractionWindow.document.close() +const contractAtlasCaption = contractInteractionWindow.document.querySelector('#fig-complete-contract-atlas .diagram-caption')?.textContent.replace(/\s+/g, ' ').trim() +const contractAtlasScrollRegion = contractInteractionWindow.document.querySelector('#fig-complete-contract-atlas > .diagram-scroll') +const contractAtlasScrollRegionLabel = contractAtlasScrollRegion?.getAttribute('aria-label') +const contractAtlasCaptionInsideScrollRegion = contractAtlasScrollRegion?.querySelector('.diagram-caption') !== null +const contractAtlasInventorySummary = contractInteractionWindow.document.querySelector('.contract-atlas-node-register > summary')?.textContent.trim() +const contractAtlasRelationshipSummary = contractInteractionWindow.document.querySelector('#atlas-relationships > summary')?.textContent.trim() +const primaryFlowScope = contractInteractionWindow.document.querySelector('#overview > p[data-primary-flow-boundary]')?.textContent.replace(/\s+/g, ' ').trim() +const primaryFlowTableBoundary = contractInteractionWindow.document.querySelector('#edges > p')?.textContent.replace(/\s+/g, ' ').trim() +const contractInteractionSectionIds = [...contractInteractionWindow.document.querySelectorAll('main > section')].map(section => section.id) +contractInteractionWindow.close() +const productionDeclarationCount = contractAtlasNodes.filter(node => node.declaration !== undefined && node.panel !== 'tests').length +const testDeclarationCount = contractAtlasNodes.filter(node => node.declaration !== undefined && node.panel === 'tests').length +const contractAtlasSpec = parsedSpecs['fig-complete-contract-atlas'] +const contractAtlasAriaDescription = isRecord(contractAtlasSpec) ? contractAtlasSpec['ariaDescription'] : undefined +if ( + contractAtlasCaption === undefined || + !contractAtlasCaption.includes(`default protocol-flow layer shows ${expectedContractAtlasViewRouteCounts.protocol} routes`) || + !contractAtlasCaption.includes(`layer controls expose every one of the ${expectedContractAtlasPlotRouteCount} routes while keeping all ${expectedContractAtlasNodeCount} components fixed`) || + !contractAtlasCaption.includes(`all ${expectedContractAtlasRelationshipCount} meanings remain`) +) { + throw new Error('Complete contract atlas caption must state its exact default-layer, plot-route, component, and relationship counts') +} +if ( + contractAtlasScrollRegion === null || + contractAtlasScrollRegion?.getAttribute('tabindex') !== '0' || + contractAtlasScrollRegion?.getAttribute('role') !== 'region' || + contractAtlasScrollRegionLabel !== 'Scrollable figure: Complete Zoltar and Statoblast Solidity contract and relationship atlas' || + contractAtlasCaptionInsideScrollRegion || + contractAtlasInventorySummary !== `Complete ${expectedContractAtlasNodeCount}-component inventory` || + contractAtlasRelationshipSummary !== 'Complete relationship register' +) { + throw new Error('Complete contract atlas must keep its caption outside a named, keyboard-focusable plot scroller and use state-neutral register summaries') +} +if (primaryFlowScope === undefined || !primaryFlowScope.includes(`exactly ${expectedPrimaryContractComponentCount} unique components and ${expectedPrimaryContractInteractionCount} interactions`) || !primaryFlowScope.includes('it is not exhaustive')) { + throw new Error('Primary interaction flow scope must state its exact unique-component and interaction counts and its non-exhaustive boundary') +} +if (primaryFlowTableBoundary === undefined || !primaryFlowTableBoundary.includes(`These ${expectedPrimaryContractInteractionCount} rows explain the arrows in the Primary Interaction Flow`)) { + throw new Error('Primary interaction flow boundary must state its exact registered interaction count') +} +const expectedContractInteractionSectionIds = ['overview', 'edges', 'paths', 'supporting-contracts', 'complete-atlas', 'sources'] +if (contractInteractionSectionIds.join(',') !== expectedContractInteractionSectionIds.join(',')) { + throw new Error(`Contract interaction reader journey must move from the primary flow explanation to the complete atlas; found ${contractInteractionSectionIds.join(', ')}`) +} +if ( + !contractInteractionHtml.includes(`all ${productionDeclarationCount + testDeclarationCount} Solidity declarations`) || + !contractInteractionHtml.includes(`${productionDeclarationCount} production declarations and ${testDeclarationCount}`) || + !contractInteractionHtml.includes(`${expectedContractAtlasNodeCount} nodes and ${expectedContractAtlasRelationshipCount} relationships`) || + !contractInteractionHtml.includes(`${expectedContractAtlasPlotRouteCount} ordered source-target routes`) || + !contractInteractionHtml.includes(`protocol-flow layer shows ${expectedContractAtlasViewRouteCounts.protocol} routes`) || + !contractInteractionHtml.includes('data-contract-atlas-controls') || + !contractInteractionHtml.includes('data-contract-atlas-view="protocol"') || + !contractInteractionHtml.includes('data-contract-atlas-view="all"') || + !contractInteractionHtml.includes(`Complete ${expectedContractAtlasNodeCount}-component inventory`) || + !contractInteractionHtml.includes('data-contract-atlas-node-table') || + !contractInteractionHtml.includes('data-contract-atlas-table') || + !runtimeSource.includes('renderContractAtlasInventoryTable()') || + !runtimeSource.includes('contractAtlasInventoryRows.map') || + !runtimeSource.includes('renderContractAtlasTable()') || + !runtimeSource.includes('contractAtlasRelationshipRows.map') || + !runtimeSource.includes('contractAtlasPlotRoutesForView(view).map') || + !runtimeSource.includes('contractAtlasPlotRouteMeaning(route)') || + !runtimeSource.includes('spreadContractAtlasPorts(positionedEdges') || + !runtimeSource.includes("chart.dataset['plotRouteCount']") || + !runtimeSource.includes("chart.dataset['visibleRouteCount']") || + typeof contractAtlasAriaDescription !== 'string' || + !contractAtlasAriaDescription.includes(`${expectedContractAtlasRelationshipCount} relationships grouped into ${expectedContractAtlasPlotRouteCount} ordered source-target routes`) || + !contractAtlasAriaDescription.includes(`${expectedContractAtlasViewRouteCounts.protocol}-route protocol-flow layer`) +) { + throw new Error('Complete contract atlas page must state its checked inventory and layered plot-route counts, expose reduced-overlap controls, and mount the generated component and relationship registers') +} +for (const view of contractAtlasViewDefinitions) { + if (!contractInteractionHtml.includes(`data-contract-atlas-view="${view.id}"`) || !contractInteractionHtml.includes(`data-contract-atlas-view-count="${view.id}"`)) { + throw new Error(`Complete contract atlas page is missing its ${view.id} relationship-layer control`) + } +} const documentedEdges = [...contractInteractionHtml.matchAll(//g)].map(match => ({ id: match[1], phase: match[4], receiver: match[3], source: match[2], })) -if (documentedEdges.length !== contractInteractionEdges.length) { - throw new Error(`Contract interaction table has ${documentedEdges.length} checked edges but the shared registry has ${contractInteractionEdges.length}`) +if (documentedEdges.length !== expectedPrimaryContractInteractionCount) { + throw new Error(`Contract interaction table has ${documentedEdges.length} checked edges but the primary boundary requires ${expectedPrimaryContractInteractionCount}`) } for (const expectedEdge of contractInteractionEdges) { const tableEdge = documentedEdges.find(edge => edge.id === expectedEdge.id) diff --git a/scripts/contract-atlas-behavioral-references.mts b/scripts/contract-atlas-behavioral-references.mts new file mode 100644 index 000000000..86fffbcc1 --- /dev/null +++ b/scripts/contract-atlas-behavioral-references.mts @@ -0,0 +1,373 @@ +import path from 'node:path' +import solc from 'solc' +import type { ContractAtlasBehavioralReference } from '../docs/charts/contractAtlasBehavioralReferences' +import type { ContractAtlasSourceReference, ContractAtlasSourceNode } from './contract-atlas-source-references.mts' + +type AstRecord = Record + +type IndexedAstNode = { + node: AstRecord + owner?: AstRecord + source: string +} + +type BehavioralReferenceAccumulator = { + members: Set + relation: ContractAtlasBehavioralReference['relation'] + source: string + target: string +} + +const openOraclePragma = 'pragma solidity 0.8.28;' +const mainCompilerPragma = 'pragma solidity 0.8.35;' +const openZeppelinLocalPrefix = 'solidity/contracts/peripherals/openOracle/openzeppelin/contracts/' +const openZeppelinImportPrefix = '@openzeppelin/contracts/' + +function isObjectRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null +} + +function isAstRecord(value: unknown): value is AstRecord { + return isObjectRecord(value) && typeof value['nodeType'] === 'string' +} + +function astChildren(node: AstRecord): AstRecord[] { + const children: AstRecord[] = [] + for (const value of Object.values(node)) { + if (Array.isArray(value)) { + for (const child of value) { + if (isAstRecord(child)) children.push(child) + } + } else if (isAstRecord(value)) { + children.push(value) + } + } + return children +} + +function repositorySourcePath(compilerPath: string): string { + if (compilerPath.startsWith(openZeppelinImportPrefix)) { + return `${openZeppelinLocalPrefix}${compilerPath.slice(openZeppelinImportPrefix.length)}` + } + return compilerPath +} + +function compileAst(sources: ReadonlyMap): Map { + const compilerSources: Record = {} + for (const [sourcePath, originalContent] of sources) { + const content = originalContent.replaceAll(openOraclePragma, mainCompilerPragma) + compilerSources[sourcePath] = { content } + if (sourcePath.startsWith(openZeppelinLocalPrefix)) { + compilerSources[`${openZeppelinImportPrefix}${sourcePath.slice(openZeppelinLocalPrefix.length)}`] = { content } + } + } + const outputText = solc.compile( + JSON.stringify({ + language: 'Solidity', + settings: { + outputSelection: { + '*': { + '': ['ast'], + }, + }, + }, + sources: compilerSources, + }), + ) + const output: unknown = JSON.parse(outputText) + if (!isObjectRecord(output)) throw new Error('Contract atlas behavioral analysis received an invalid Solidity compiler result') + const diagnostics = output['errors'] + if (Array.isArray(diagnostics)) { + const errors = diagnostics.flatMap(diagnostic => { + if (!isObjectRecord(diagnostic) || diagnostic['severity'] !== 'error') return [] + const formattedMessage = diagnostic['formattedMessage'] + return [typeof formattedMessage === 'string' ? formattedMessage : 'Unknown Solidity compiler error'] + }) + if (errors.length > 0) throw new Error(`Contract atlas behavioral analysis could not compile Solidity ASTs:\n${errors.join('\n')}`) + } + const compiledSources = output['sources'] + if (!isObjectRecord(compiledSources)) throw new Error('Contract atlas behavioral analysis received no Solidity compiler sources') + const astBySource = new Map() + for (const [sourcePath, sourceOutput] of Object.entries(compiledSources)) { + if (!isObjectRecord(sourceOutput)) continue + const ast = sourceOutput['ast'] + if (!isAstRecord(ast)) continue + astBySource.set(sourcePath, ast) + } + return astBySource +} + +function indexAst(astBySource: ReadonlyMap): Map { + const nodeById = new Map() + function visit(node: AstRecord, source: string, owner?: AstRecord): void { + const nextOwner = node['nodeType'] === 'ContractDefinition' ? node : owner + const id = node['id'] + if (typeof id === 'number') { + nodeById.set(id, nextOwner === undefined ? { node, source } : { node, owner: nextOwner, source }) + } + for (const child of astChildren(node)) visit(child, source, nextOwner) + } + for (const [source, ast] of astBySource) visit(ast, source) + return nodeById +} + +function referencedNode(node: AstRecord, nodeById: ReadonlyMap): IndexedAstNode | undefined { + const referencedDeclaration = node['referencedDeclaration'] + return typeof referencedDeclaration === 'number' ? nodeById.get(referencedDeclaration) : undefined +} + +function contractDefinitionFromType(node: AstRecord, nodeById: ReadonlyMap): IndexedAstNode | undefined { + const typeDescriptions = node['typeDescriptions'] + if (!isObjectRecord(typeDescriptions)) return undefined + const typeIdentifier = typeDescriptions['typeIdentifier'] + if (typeof typeIdentifier !== 'string') return undefined + const contractIdText = typeIdentifier.match(/t_contract\$_[^$]*_\$(\d+)/)?.[1] + return contractIdText === undefined ? undefined : nodeById.get(Number(contractIdText)) +} + +function atlasNodeForDefinition( + definition: IndexedAstNode, + nodesBySourceAndDeclaration: ReadonlyMap, + nodesBySource: ReadonlyMap, + sourceOwnerOverrides: Readonly>, + nodesById: ReadonlyMap, +): ContractAtlasSourceNode | undefined { + const source = repositorySourcePath(definition.source) + const declaration = definition.owner?.['name'] + if (typeof declaration === 'string') { + const directNode = nodesBySourceAndDeclaration.get(`${source}#${declaration}`) + if (directNode !== undefined) return directNode + } + const override = sourceOwnerOverrides[source] + if (override !== undefined) return nodesById.get(override) + const sourceNodes = nodesBySource.get(source) ?? [] + return sourceNodes.length === 1 ? sourceNodes[0] : undefined +} + +function usingForMember(node: AstRecord): { libraryNode: AstRecord; member: string } | undefined { + const libraryName = node['libraryName'] + if (!isAstRecord(libraryName)) return undefined + const typeName = node['typeName'] + let typeLabel = 'type' + if (isAstRecord(typeName)) { + const pathNode = typeName['pathNode'] + if (isAstRecord(pathNode) && typeof pathNode['name'] === 'string') typeLabel = pathNode['name'] + } + return { libraryNode: libraryName, member: `using for ${typeLabel}` } +} + +function isInvokedMember(node: AstRecord, parent?: AstRecord): boolean { + if (parent === undefined || (parent['nodeType'] !== 'FunctionCall' && parent['nodeType'] !== 'FunctionCallOptions')) return false + return parent['expression'] === node +} + +function isEncodedFunctionMember(ancestors: readonly AstRecord[]): boolean { + for (let index = ancestors.length - 1; index >= 0; index -= 1) { + const ancestor = ancestors[index] + if (ancestor?.['nodeType'] !== 'FunctionCall') continue + const expression = ancestor['expression'] + if (!isAstRecord(expression) || expression['nodeType'] !== 'MemberAccess') continue + const receiver = expression['expression'] + const memberName = expression['memberName'] + if (isAstRecord(receiver) && receiver['nodeType'] === 'Identifier' && receiver['name'] === 'abi' && (memberName === 'encodeCall' || memberName === 'encodeWithSelector')) return true + } + return false +} + +function isInsideNormalLowLevelCall(ancestors: readonly AstRecord[]): boolean { + for (let index = ancestors.length - 1; index >= 0; index -= 1) { + const ancestor = ancestors[index] + if (ancestor?.['nodeType'] !== 'FunctionCall') continue + const expression = ancestor['expression'] + if (!isAstRecord(expression) || expression['nodeType'] !== 'MemberAccess') continue + if (expression['memberName'] === 'call') return true + } + return false +} + +function lowLevelReceiverTarget(receiver: AstRecord, nodeById: ReadonlyMap): IndexedAstNode | undefined { + const directTarget = contractDefinitionFromType(receiver, nodeById) + if (directTarget !== undefined) return directTarget + if (receiver['nodeType'] !== 'FunctionCall') return undefined + const argumentsValue = receiver['arguments'] + if (!Array.isArray(argumentsValue)) return undefined + for (const argument of argumentsValue) { + if (!isAstRecord(argument)) continue + const target = contractDefinitionFromType(argument, nodeById) + if (target !== undefined) return target + } + return undefined +} + +function assemblyCallTarget(node: AstRecord, nodeById: ReadonlyMap): IndexedAstNode | undefined { + const assemblyAst = node['AST'] + const externalReferences = node['externalReferences'] + if (!isAstRecord(assemblyAst) || !Array.isArray(externalReferences)) return undefined + const checkedExternalReferences: unknown[] = externalReferences + let target: IndexedAstNode | undefined + function visitAssembly(assemblyNode: AstRecord): void { + if (target !== undefined) return + if (assemblyNode['nodeType'] === 'YulFunctionCall') { + const functionName = assemblyNode['functionName'] + const argumentsValue = assemblyNode['arguments'] + if (isObjectRecord(functionName) && functionName['name'] === 'call' && Array.isArray(argumentsValue)) { + const receiver = argumentsValue[1] + const receiverSource = isObjectRecord(receiver) ? receiver['src'] : undefined + if (typeof receiverSource === 'string') { + const reference = checkedExternalReferences.find(candidate => isObjectRecord(candidate) && candidate['src'] === receiverSource) + const declaration = isObjectRecord(reference) ? reference['declaration'] : undefined + const declarationNode = typeof declaration === 'number' ? nodeById.get(declaration) : undefined + if (declarationNode !== undefined) target = contractDefinitionFromType(declarationNode.node, nodeById) + } + } + } + for (const child of astChildren(assemblyNode)) visitAssembly(child) + } + visitAssembly(assemblyAst) + return target +} + +export async function analyzeContractAtlasBehavioralReferences( + contractsDirectory: string, + nodes: readonly ContractAtlasSourceNode[], + sourceOwnerOverrides: Readonly>, + sourceReferences: readonly ContractAtlasSourceReference[], + delegatecallPairs: ReadonlySet, + sourceContentOverrides: ReadonlyMap = new Map(), +): Promise { + const sources = new Map() + for (const entry of [...new Bun.Glob('**/*.sol').scanSync({ cwd: contractsDirectory })].sort()) { + const sourcePath = path.posix.join('solidity/contracts', entry.split(path.sep).join('/')) + sources.set(sourcePath, sourceContentOverrides.get(sourcePath) ?? (await Bun.file(path.join(contractsDirectory, entry)).text())) + } + const astBySource = compileAst(sources) + const nodeById = indexAst(astBySource) + const nodesById = new Map(nodes.map(node => [node.id, node])) + const nodesBySourceAndDeclaration = new Map() + for (const node of nodes) { + if (node.declaration !== undefined) nodesBySourceAndDeclaration.set(`${node.source}#${node.declaration}`, node) + } + const nodesBySource = new Map() + for (const node of nodes) { + const sourceNodes = nodesBySource.get(node.source) ?? [] + sourceNodes.push(node) + nodesBySource.set(node.source, sourceNodes) + } + const sourceReferencePairs = new Set(sourceReferences.map(reference => `${reference.source}->${reference.target}`)) + const candidatesByPair = new Map() + const normalLowLevelCallPairs = new Set() + + function addNormalLowLevelCallPair(sourcePath: string, owner: AstRecord, targetDefinition: IndexedAstNode | undefined): void { + if (targetDefinition === undefined) return + const sourceNode = atlasNodeForDefinition({ node: owner, owner, source: sourcePath }, nodesBySourceAndDeclaration, nodesBySource, sourceOwnerOverrides, nodesById) + const targetNode = atlasNodeForDefinition(targetDefinition, nodesBySourceAndDeclaration, nodesBySource, sourceOwnerOverrides, nodesById) + if (sourceNode !== undefined && targetNode !== undefined) normalLowLevelCallPairs.add(`${sourceNode.id}->${targetNode.id}`) + } + + function collectNormalLowLevelCalls(node: AstRecord, sourcePath: string, owner?: AstRecord, parent?: AstRecord): void { + const nextOwner = node['nodeType'] === 'ContractDefinition' ? node : owner + if (nextOwner !== undefined && node['nodeType'] === 'MemberAccess' && node['memberName'] === 'call' && isInvokedMember(node, parent)) { + const receiver = node['expression'] + if (isAstRecord(receiver)) addNormalLowLevelCallPair(sourcePath, nextOwner, lowLevelReceiverTarget(receiver, nodeById)) + } + if (nextOwner !== undefined && node['nodeType'] === 'InlineAssembly') { + addNormalLowLevelCallPair(sourcePath, nextOwner, assemblyCallTarget(node, nodeById)) + } + for (const child of astChildren(node)) collectNormalLowLevelCalls(child, sourcePath, nextOwner, node) + } + + for (const [compilerPath, ast] of astBySource) { + if (compilerPath.startsWith(openZeppelinImportPrefix)) continue + collectNormalLowLevelCalls(ast, compilerPath) + } + + function addCandidate(source: ContractAtlasSourceNode, target: ContractAtlasSourceNode, relation: 'calls' | 'uses', member: string): void { + if (source.id === target.id || !sourceReferencePairs.has(`${source.id}->${target.id}`)) return + const resolvedRelation: ContractAtlasBehavioralReference['relation'] = source.panel === 'tests' && relation === 'calls' ? 'tests' : relation + const pair = `${source.id}->${target.id}` + const existing = candidatesByPair.get(pair) + if (existing === undefined) { + candidatesByPair.set(pair, { + members: new Set([member]), + relation: resolvedRelation, + source: source.id, + target: target.id, + }) + return + } + existing.members.add(member) + if (existing.relation === 'uses' && resolvedRelation !== 'uses') existing.relation = resolvedRelation + } + + function visit(node: AstRecord, sourcePath: string, owner?: AstRecord, ancestors: readonly AstRecord[] = []): void { + const nextOwner = node['nodeType'] === 'ContractDefinition' ? node : owner + if (nextOwner !== undefined && node['nodeType'] === 'MemberAccess') { + const referenced = referencedNode(node, nodeById) + const expression = node['expression'] + const referencedNodeType = referenced?.node['nodeType'] + const referencedOwnerKind = referenced?.owner?.['contractKind'] + const parent = ancestors[ancestors.length - 1] + const isDirectFunctionInvocation = referencedNodeType === 'FunctionDefinition' && isInvokedMember(node, parent) + const isEncodedFunctionInvocation = referencedNodeType === 'FunctionDefinition' && !isDirectFunctionInvocation && isEncodedFunctionMember(ancestors) + const isFunction = isDirectFunctionInvocation || isEncodedFunctionInvocation + const isLibraryMember = referencedOwnerKind === 'library' && (isFunction || referencedNodeType === 'VariableDeclaration' || referencedNodeType === 'EnumValue') + let targetDefinition: IndexedAstNode | undefined + if (isLibraryMember) { + targetDefinition = referenced + } else if (isFunction && isAstRecord(expression)) { + targetDefinition = contractDefinitionFromType(expression, nodeById) ?? referenced + } + const sourceNode = atlasNodeForDefinition({ node: nextOwner, owner: nextOwner, source: sourcePath }, nodesBySourceAndDeclaration, nodesBySource, sourceOwnerOverrides, nodesById) + const targetNode = targetDefinition === undefined ? undefined : atlasNodeForDefinition(targetDefinition, nodesBySourceAndDeclaration, nodesBySource, sourceOwnerOverrides, nodesById) + const memberName = typeof node['memberName'] === 'string' ? node['memberName'] : referenced?.node['name'] + if (sourceNode !== undefined && targetNode !== undefined && typeof memberName === 'string') { + const pair = `${sourceNode.id}->${targetNode.id}` + const isNormalEncodedInvocation = isEncodedFunctionInvocation && (isInsideNormalLowLevelCall(ancestors) || normalLowLevelCallPairs.has(pair)) + if (!isEncodedFunctionInvocation || (isNormalEncodedInvocation && !delegatecallPairs.has(pair))) { + addCandidate(sourceNode, targetNode, isLibraryMember ? 'uses' : 'calls', memberName) + } + } + } + if (nextOwner !== undefined && node['nodeType'] === 'UsingForDirective') { + const usingMember = usingForMember(node) + const libraryDefinition = usingMember === undefined ? undefined : referencedNode(usingMember.libraryNode, nodeById) + const sourceNode = atlasNodeForDefinition({ node: nextOwner, owner: nextOwner, source: sourcePath }, nodesBySourceAndDeclaration, nodesBySource, sourceOwnerOverrides, nodesById) + const targetNode = libraryDefinition === undefined ? undefined : atlasNodeForDefinition(libraryDefinition, nodesBySourceAndDeclaration, nodesBySource, sourceOwnerOverrides, nodesById) + if (sourceNode !== undefined && targetNode !== undefined && usingMember !== undefined) { + addCandidate(sourceNode, targetNode, 'uses', usingMember.member) + } + } + for (const child of astChildren(node)) visit(child, sourcePath, nextOwner, [...ancestors, node]) + } + + for (const [compilerPath, ast] of astBySource) { + if (compilerPath.startsWith(openZeppelinImportPrefix)) continue + visit(ast, compilerPath) + } + return [...candidatesByPair.values()] + .map(candidate => ({ + members: [...candidate.members].sort(), + relation: candidate.relation, + source: candidate.source, + target: candidate.target, + })) + .sort((first, second) => `${first.source}->${first.target}`.localeCompare(`${second.source}->${second.target}`)) +} + +function behavioralReferenceKeys(references: readonly ContractAtlasBehavioralReference[]): string[] { + return references.map(reference => `${reference.source}->${reference.target}:${reference.relation}:${[...reference.members].sort().join(',')}`) +} + +export function contractAtlasBehavioralReferenceIssue(expectedReferences: readonly ContractAtlasBehavioralReference[], registeredReferences: readonly ContractAtlasBehavioralReference[]): string | undefined { + const expectedKeys = behavioralReferenceKeys(expectedReferences) + const registeredKeys = behavioralReferenceKeys(registeredReferences) + if (new Set(registeredKeys).size !== registeredKeys.length) { + return 'Complete contract atlas behavioral references contain duplicate ordered pairs' + } + const expectedKeySet = new Set(expectedKeys) + const registeredKeySet = new Set(registeredKeys) + const missing = expectedKeys.filter(key => !registeredKeySet.has(key)) + const extra = registeredKeys.filter(key => !expectedKeySet.has(key)) + if (missing.length === 0 && extra.length === 0) return undefined + return `Complete contract atlas behavioral-reference mismatch; missing: ${missing.join(', ') || 'none'}; extra: ${extra.join(', ') || 'none'}` +} diff --git a/scripts/contract-atlas-source-references.mts b/scripts/contract-atlas-source-references.mts new file mode 100644 index 000000000..8e1e1138a --- /dev/null +++ b/scripts/contract-atlas-source-references.mts @@ -0,0 +1,445 @@ +import path from 'node:path' + +export type ContractAtlasSourceNode = { + declaration?: string + id: string + kind: string + panel?: string + source: string +} + +export type ContractAtlasSourceReference = { + source: string + symbols: string[] + target: string +} + +export type ContractAtlasSourceSemanticRelationship = ContractAtlasSourceReference & { + relation: 'delegatecall' | 'implements' | 'inherits' +} + +export type ContractAtlasSourceUnit = { + nodeId: string + source: string +} + +export type ContractAtlasSourceAnalysis = { + delegatecalls: ContractAtlasSourceSemanticRelationship[] + directBases: ContractAtlasSourceSemanticRelationship[] + explicitDeployments: ContractAtlasSourceReference[] + references: ContractAtlasSourceReference[] + sourceUnits: ContractAtlasSourceUnit[] +} + +type ImportName = { + local: string + original: string +} + +type SourceImport = { + names: ImportName[] + target: string +} + +type DeclarationSpan = { + end: number + node: ContractAtlasSourceNode + start: number + text: string +} + +function maskCommentsAndStrings(source: string): string { + const characters = [...source] + let state: 'block-comment' | 'code' | 'double-quoted' | 'line-comment' | 'single-quoted' = 'code' + let escaped = false + for (let index = 0; index < characters.length; index += 1) { + const character = characters[index] + const nextCharacter = characters[index + 1] + if (character === undefined) continue + if (state === 'code') { + if (character === '/' && nextCharacter === '/') { + characters[index] = ' ' + characters[index + 1] = ' ' + state = 'line-comment' + index += 1 + } else if (character === '/' && nextCharacter === '*') { + characters[index] = ' ' + characters[index + 1] = ' ' + state = 'block-comment' + index += 1 + } else if (character === "'") { + characters[index] = ' ' + state = 'single-quoted' + } else if (character === '"') { + characters[index] = ' ' + state = 'double-quoted' + } + continue + } + if (state === 'line-comment') { + if (character === '\n') { + state = 'code' + } else { + characters[index] = ' ' + } + continue + } + if (state === 'block-comment') { + if (character === '*' && nextCharacter === '/') { + characters[index] = ' ' + characters[index + 1] = ' ' + state = 'code' + index += 1 + } else if (character !== '\n') { + characters[index] = ' ' + } + continue + } + if (escaped) { + if (character !== '\n') characters[index] = ' ' + escaped = false + continue + } + if (character === '\\') { + characters[index] = ' ' + escaped = true + continue + } + const closingQuote = state === 'single-quoted' ? "'" : '"' + if (character === closingQuote) { + characters[index] = ' ' + state = 'code' + } else if (character !== '\n') { + characters[index] = ' ' + } + } + return characters.join('') +} + +function matchingBrace(source: string, openingIndex: number): number { + let depth = 0 + for (let index = openingIndex; index < source.length; index += 1) { + const character = source[index] + if (character === '{') depth += 1 + if (character !== '}') continue + depth -= 1 + if (depth === 0) return index + 1 + } + throw new Error(`Solidity declaration at offset ${openingIndex} has no closing brace`) +} + +function declarationSpans(sourcePath: string, source: string, nodes: readonly ContractAtlasSourceNode[]): DeclarationSpan[] { + const maskedSource = maskCommentsAndStrings(source) + const declarationPattern = /^(abstract contract|contract|interface|library)\s+([A-Za-z_]\w*)\b/gm + const spans: DeclarationSpan[] = [] + for (const match of maskedSource.matchAll(declarationPattern)) { + const declaration = match[2] + const start = match.index + if (declaration === undefined || start === undefined) { + throw new Error(`Could not parse a Solidity declaration in ${sourcePath}`) + } + const openingIndex = maskedSource.indexOf('{', start) + if (openingIndex < 0) throw new Error(`Solidity declaration ${sourcePath}#${declaration} has no body`) + const node = nodes.find(candidate => candidate.declaration === declaration) + if (node === undefined) throw new Error(`Contract atlas has no node for ${sourcePath}#${declaration}`) + const end = matchingBrace(maskedSource, openingIndex) + spans.push({ end, node, start, text: maskedSource.slice(start, end) }) + } + return spans +} + +function resolveImportPath(sourcePath: string, specifier: string): string { + if (specifier.startsWith('@openzeppelin/contracts/')) { + return `solidity/contracts/peripherals/openOracle/openzeppelin/contracts/${specifier.slice('@openzeppelin/contracts/'.length)}` + } + return path.posix.normalize(path.posix.join(path.posix.dirname(sourcePath), specifier)) +} + +function parseImports(sourcePath: string, source: string): SourceImport[] { + const imports: SourceImport[] = [] + const importPattern = /import\s+(?:(\{[\s\S]*?\}|\*\s+as\s+[A-Za-z_]\w*)\s+from\s+)?['"]([^'"]+)['"]\s*;/g + for (const match of source.matchAll(importPattern)) { + const clause = match[1] + const specifier = match[2] + if (specifier === undefined) throw new Error(`Could not parse an import in ${sourcePath}`) + let names: ImportName[] = [] + if (clause?.startsWith('{')) { + names = clause + .slice(1, -1) + .split(',') + .map(name => name.trim()) + .filter(name => name.length > 0) + .map(name => { + const [original, alias] = name.split(/\s+as\s+/) + if (original === undefined) throw new Error(`Could not parse imported name ${name} in ${sourcePath}`) + return { local: (alias ?? original).trim(), original: original.trim() } + }) + } else if (clause?.startsWith('*')) { + const namespace = clause.split(/\s+as\s+/)[1] + if (namespace === undefined) throw new Error(`Could not parse namespace import ${clause} in ${sourcePath}`) + names = [{ local: namespace.trim(), original: '*' }] + } + imports.push({ names, target: resolveImportPath(sourcePath, specifier) }) + } + return imports +} + +function escapedIdentifier(identifier: string): string { + return identifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') +} + +function directlyDelegatesToType(source: string, typeName: string): boolean { + const escapedType = escapedIdentifier(typeName) + const variableNames = new Set() + const typedVariablePattern = new RegExp(`\\b${escapedType}\\s+(?:(?:constant|immutable|internal|private|public)\\s+)*([A-Za-z_]\\w*)\\b`, 'g') + for (const match of source.matchAll(typedVariablePattern)) { + const variableName = match[1] + if (variableName !== undefined) variableNames.add(variableName) + } + const deployedVariablePattern = new RegExp(`\\b([A-Za-z_]\\w*)\\s*=\\s*(?:address\\s*\\(\\s*)?new\\s+${escapedType}\\b`, 'g') + for (const match of source.matchAll(deployedVariablePattern)) { + const variableName = match[1] + if (variableName !== undefined) variableNames.add(variableName) + } + const addressAliases = [...source.matchAll(/\baddress\s+([A-Za-z_]\w*)\s*=\s*([^;]+);/g)] + const delegateForwarders = [...source.matchAll(/\bfunction\s+([A-Za-z_]\w*)\s*\(\s*address\s+([A-Za-z_]\w*)[\s\S]*?\)\s*[^{;]*\{/g)] + function isDelegateTarget(variableName: string): boolean { + const escapedVariable = escapedIdentifier(variableName) + const memberDelegatecall = new RegExp(`(?:\\baddress\\s*\\(\\s*)?\\b${escapedVariable}\\b(?:\\s*\\))?\\s*\\.\\s*delegatecall\\s*\\(`) + const assemblyDelegatecall = new RegExp(`\\bdelegatecall\\s*\\([^,]*,\\s*${escapedVariable}\\s*,`) + return memberDelegatecall.test(source) || assemblyDelegatecall.test(source) + } + for (const variableName of variableNames) { + if (isDelegateTarget(variableName)) return true + for (const alias of addressAliases) { + const aliasName = alias[1] + const assignment = alias[2] + if (aliasName !== undefined && assignment !== undefined && new RegExp(`\\b${escapedIdentifier(variableName)}\\b`).test(assignment) && isDelegateTarget(aliasName)) { + return true + } + } + for (const forwarder of delegateForwarders) { + const functionName = forwarder[1] + const delegateParameter = forwarder[2] + if (functionName !== undefined && delegateParameter !== undefined && isDelegateTarget(delegateParameter) && new RegExp(`\\b${escapedIdentifier(functionName)}\\s*\\(\\s*${escapedIdentifier(variableName)}\\b`).test(source)) { + return true + } + } + } + return false +} + +export async function analyzeContractAtlasSource(contractsDirectory: string, nodes: readonly ContractAtlasSourceNode[], sourceOwnerOverrides: Readonly>): Promise { + const sourceEntries = [...new Bun.Glob('**/*.sol').scanSync({ cwd: contractsDirectory })].sort() + const sources = new Map() + for (const entry of sourceEntries) { + const repositoryPath = path.posix.join('solidity/contracts', entry.split(path.sep).join('/')) + sources.set(repositoryPath, await Bun.file(path.join(contractsDirectory, entry)).text()) + } + const nodesBySource = new Map() + for (const node of nodes) { + const sourceNodes = nodesBySource.get(node.source) ?? [] + sourceNodes.push(node) + nodesBySource.set(node.source, sourceNodes) + } + const spansBySource = new Map() + const importsBySource = new Map() + const topLevelSymbolsBySource = new Map() + for (const [sourcePath, source] of sources) { + const spans = declarationSpans(sourcePath, source, nodesBySource.get(sourcePath) ?? []) + spansBySource.set(sourcePath, spans) + importsBySource.set(sourcePath, parseImports(sourcePath, source)) + const maskedSource = [...maskCommentsAndStrings(source)] + for (const span of spans) { + for (let index = span.start; index < span.end; index += 1) { + if (maskedSource[index] !== '\n') maskedSource[index] = ' ' + } + } + const topLevelSymbols: string[] = [] + for (const match of maskedSource.join('').matchAll(/^(struct|enum)\s+([A-Za-z_]\w*)\b/gm)) { + const symbol = match[2] + if (symbol !== undefined) topLevelSymbols.push(symbol) + } + topLevelSymbolsBySource.set(sourcePath, topLevelSymbols) + } + + function exportedNames(sourcePath: string, visited = new Set()): ImportName[] { + if (visited.has(sourcePath)) return [] + visited.add(sourcePath) + const names = (nodesBySource.get(sourcePath) ?? []).flatMap(node => (node.declaration === undefined ? [] : [{ local: node.declaration, original: node.declaration }])) + names.push(...(topLevelSymbolsBySource.get(sourcePath) ?? []).map(symbol => ({ local: symbol, original: symbol }))) + for (const imported of importsBySource.get(sourcePath) ?? []) { + if (imported.names.length === 0) { + names.push(...exportedNames(imported.target, visited)) + } else { + names.push(...imported.names.map(name => ({ local: name.local, original: name.local }))) + } + } + return names + } + + function tryResolveImportedNode(target: string, original: string, visited = new Set()): ContractAtlasSourceNode | undefined { + const visitKey = `${target}#${original}` + if (visited.has(visitKey)) return undefined + visited.add(visitKey) + const targetNodes = nodesBySource.get(target) ?? [] + const directNode = targetNodes.find(node => node.declaration === original) + if (directNode !== undefined) return directNode + const moduleNode = targetNodes.find(node => node.kind === 'module') + if (moduleNode !== undefined) return moduleNode + for (const imported of importsBySource.get(target) ?? []) { + const importedName = imported.names.find(name => name.local === original) + if (importedName !== undefined) { + const resolvedNode = tryResolveImportedNode(imported.target, importedName.original, new Set(visited)) + if (resolvedNode !== undefined) return resolvedNode + } + if (imported.names.length === 0) { + const resolvedNode = tryResolveImportedNode(imported.target, original, new Set(visited)) + if (resolvedNode !== undefined) return resolvedNode + } + } + if ((topLevelSymbolsBySource.get(target) ?? []).includes(original) && targetNodes.length === 1) { + const onlyNode = targetNodes[0] + if (onlyNode === undefined) return undefined + return onlyNode + } + if ((topLevelSymbolsBySource.get(target) ?? []).includes(original)) { + const ownerId = sourceOwnerOverrides[target] + const ownerNode = ownerId === undefined ? undefined : targetNodes.find(node => node.id === ownerId) + if (ownerNode !== undefined) return ownerNode + } + return undefined + } + + function resolveImportedNode(target: string, original: string): ContractAtlasSourceNode { + const resolvedNode = tryResolveImportedNode(target, original) + if (resolvedNode !== undefined) return resolvedNode + throw new Error(`Contract atlas could not resolve the source owner for ${target}#${original}`) + } + + const symbolsByPair = new Map; target: string }>() + const explicitDeploymentsByPair = new Map; target: string }>() + const directBasesByKey = new Map; target: string }>() + const delegatecallsByPair = new Map; target: string }>() + const sourceUnitsByNodeId = new Map() + for (const [sourcePath, source] of sources) { + const spans = spansBySource.get(sourcePath) ?? [] + const moduleUnits = spans.length === 0 ? (nodesBySource.get(sourcePath) ?? []).filter(node => node.kind === 'module').map(node => ({ end: source.length, node, start: 0, text: maskCommentsAndStrings(source) })) : [] + const sourceUnits = [...spans, ...moduleUnits] + const candidates: { local: string; target: ContractAtlasSourceNode }[] = [] + for (const imported of importsBySource.get(sourcePath) ?? []) { + const importedNames = imported.names.length === 0 ? exportedNames(imported.target) : imported.names + for (const importedName of importedNames) { + if (importedName.original === '*') { + throw new Error(`Namespace imports need an explicit atlas mapping in ${sourcePath}`) + } + candidates.push({ + local: importedName.local, + target: resolveImportedNode(imported.target, importedName.original), + }) + } + } + for (const localNode of nodesBySource.get(sourcePath) ?? []) { + if (localNode.declaration !== undefined) { + candidates.push({ local: localNode.declaration, target: localNode }) + } + } + for (const sourceUnit of sourceUnits) { + sourceUnitsByNodeId.set(sourceUnit.node.id, sourceUnit.text) + const openingBraceIndex = sourceUnit.text.indexOf('{') + const declarationHeader = openingBraceIndex < 0 ? '' : sourceUnit.text.slice(0, openingBraceIndex) + const directBaseClause = declarationHeader.match(/\bis\b([\s\S]+)$/)?.[1] ?? '' + for (const candidate of candidates) { + if (candidate.target.id === sourceUnit.node.id) continue + if (!new RegExp(`\\b${escapedIdentifier(candidate.local)}\\b`).test(sourceUnit.text)) continue + const pairKey = `${sourceUnit.node.id}->${candidate.target.id}` + const pair = symbolsByPair.get(pairKey) ?? { + source: sourceUnit.node.id, + symbols: new Set(), + target: candidate.target.id, + } + pair.symbols.add(candidate.local) + symbolsByPair.set(pairKey, pair) + const isNewDeployment = new RegExp(`\\bnew\\s+${escapedIdentifier(candidate.local)}\\s*(?:\\{|\\()`).test(sourceUnit.text) + const isCreate2Deployment = /\bcreate2\s*\(/.test(sourceUnit.text) && new RegExp(`\\btype\\s*\\(\\s*${escapedIdentifier(candidate.local)}\\s*\\)\\s*\\.\\s*creationCode\\b`).test(sourceUnit.text) + if (isNewDeployment || isCreate2Deployment) { + const deployment = explicitDeploymentsByPair.get(pairKey) ?? { + source: sourceUnit.node.id, + symbols: new Set(), + target: candidate.target.id, + } + deployment.symbols.add(candidate.local) + explicitDeploymentsByPair.set(pairKey, deployment) + } + if (new RegExp(`\\b${escapedIdentifier(candidate.local)}\\b`).test(directBaseClause)) { + let relation: 'implements' | 'inherits' = 'inherits' + if (sourceUnit.node.kind !== 'interface' && candidate.target.kind === 'interface') { + relation = 'implements' + } + const directBaseKey = `${pairKey}:${relation}` + const directBase = directBasesByKey.get(directBaseKey) ?? { + relation, + source: sourceUnit.node.id, + symbols: new Set(), + target: candidate.target.id, + } + directBase.symbols.add(candidate.local) + directBasesByKey.set(directBaseKey, directBase) + } + if (directlyDelegatesToType(sourceUnit.text, candidate.local)) { + const delegatecall: { relation: 'delegatecall'; source: string; symbols: Set; target: string } = delegatecallsByPair.get(pairKey) ?? { + relation: 'delegatecall', + source: sourceUnit.node.id, + symbols: new Set(), + target: candidate.target.id, + } + delegatecall.symbols.add(candidate.local) + delegatecallsByPair.set(pairKey, delegatecall) + } + } + } + } + function sortedReferences(referencesByPair: ReadonlyMap; target: string }>): ContractAtlasSourceReference[] { + return [...referencesByPair.values()] + .map(reference => ({ + source: reference.source, + symbols: [...reference.symbols].sort(), + target: reference.target, + })) + .sort((first, second) => `${first.source}->${first.target}`.localeCompare(`${second.source}->${second.target}`)) + } + function sortedSemanticRelationships(relationshipsByKey: ReadonlyMap; target: string }>): ContractAtlasSourceSemanticRelationship[] { + return [...relationshipsByKey.values()] + .map(relationship => ({ + relation: relationship.relation, + source: relationship.source, + symbols: [...relationship.symbols].sort(), + target: relationship.target, + })) + .sort((first, second) => `${first.source}->${first.target}:${first.relation}`.localeCompare(`${second.source}->${second.target}:${second.relation}`)) + } + return { + delegatecalls: sortedSemanticRelationships(delegatecallsByPair), + directBases: sortedSemanticRelationships(directBasesByKey), + explicitDeployments: sortedReferences(explicitDeploymentsByPair), + references: sortedReferences(symbolsByPair), + sourceUnits: [...sourceUnitsByNodeId].map(([nodeId, source]) => ({ nodeId, source })).sort((first, second) => first.nodeId.localeCompare(second.nodeId)), + } +} + +export function contractAtlasSourceReferenceIssue(expectedReferences: readonly ContractAtlasSourceReference[], registeredReferences: readonly ContractAtlasSourceReference[]): string | undefined { + function referenceKeys(references: readonly ContractAtlasSourceReference[]): string[] { + return references.map(reference => `${reference.source}->${reference.target}:${[...reference.symbols].sort().join(',')}`) + } + const expectedKeys = referenceKeys(expectedReferences) + const registeredKeys = referenceKeys(registeredReferences) + if (new Set(registeredKeys).size !== registeredKeys.length) { + return 'Complete contract atlas source references contain duplicate ordered pairs' + } + const expectedKeySet = new Set(expectedKeys) + const registeredKeySet = new Set(registeredKeys) + const missing = expectedKeys.filter(key => !registeredKeySet.has(key)) + const extra = registeredKeys.filter(key => !expectedKeySet.has(key)) + if (missing.length === 0 && extra.length === 0) return undefined + return `Complete contract atlas source-reference mismatch; missing: ${missing.join(', ') || 'none'}; extra: ${extra.join(', ') || 'none'}` +}