@continuous-excellence/ze-great-dashboard-aws 0.14.7 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,15 @@ bootstrap initialization; routine packaging and diagnostics then select the matc
10
10
  An explicit mode fails if it disagrees with persisted configuration, so changing mode requires
11
11
  regenerating the reviewed bootstrap and parameter artifacts.
12
12
 
13
+ `dashboard-bootstrap.json` is checked-in desired state, not a capture of AWS. If an intentionally
14
+ upgraded package changes a bootstrap template contract or revision, run `bootstrap upgrade
15
+ --config dashboard-bootstrap.json`, review and commit only that metadata change, then have the
16
+ consumer's approved deployment automation preview and execute CloudFormation UPDATE change sets.
17
+ Package upgrades that do not change bootstrap template identity do not require a manifest update or
18
+ bootstrap redeploy. Captures and generated parameter files are disposable deployment artifacts;
19
+ the package owns template contents and the manifest records the intended package/template identity.
20
+ No credentials belong in the manifest.
21
+
13
22
  Consumer ECS deployments use the long-lived service template and provide their own subnets and
14
23
  security groups.
15
24
 
@@ -1,5 +1,12 @@
1
1
  {
2
2
  "mode": "lambda",
3
+ "desiredState": {
4
+ "packageVersion": "0.0.0-dev",
5
+ "templates": {
6
+ "core": { "contractVersion": "1", "templateRevision": "1.3" },
7
+ "githubOidc": { "contractVersion": "2", "templateRevision": "2.3" }
8
+ }
9
+ },
3
10
  "region": "us-east-1",
4
11
  "core": {
5
12
  "stackName": "team-dashboard-bootstrap",
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "index.html": {
3
- "file": "assets/index-rQD3y-xI.js",
3
+ "file": "assets/index-BbX6XSjb.js",
4
4
  "name": "index",
5
5
  "src": "index.html",
6
6
  "isEntry": true,
7
7
  "css": [
8
- "assets/index-BRONWQIP.css"
8
+ "assets/index-CcwHduD1.css"
9
9
  ]
10
10
  }
11
11
  }
@@ -0,0 +1,3 @@
1
+ import{z as e}from"zod";import{StrictMode as t,useEffect as n,useMemo as r,useRef as i,useState as a,useSyncExternalStore as o}from"react";import{createRoot as s}from"react-dom/client";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var d=/^(\d+)(ms|s|m|h)$/,f={ms:1,s:1e3,m:6e4,h:36e5};function p(e){let t=d.exec(e);if(!t)return null;let[,n,r]=t;if(n===void 0||r===void 0)return null;let i=Number(n);return i<=0?null:i*f[r]}var m=e.string().refine(e=>p(e)!==null,{message:`must be a positive duration like "30s", "5m", or "1h"`}).brand(),h=e.union([e.object({x:e.number().int().min(0),y:e.number().int().min(0),w:e.number().int().min(1).max(12),h:e.number().int().min(1)}),e.object({x:e.literal(0),y:e.literal(0),w:e.literal(0),h:e.literal(0)})]),ee=e.string().min(1),g=[`radial`,`runway`,`orbit`,`signal-field`,`telemetry-bloom`,`release-transit`,`status-weather`,`falling-shapes`],_=e.enum([...g,`off`]),te=e.looseObject({label:e.string().min(1).optional(),id:e.string().min(1),type:e.string().min(1),source:e.string().min(1).optional(),pipeline:e.union([e.string(),e.number()]).optional(),branch:e.string().min(1).optional(),display:ee.optional(),position:h.optional(),refresh:m.optional(),running_refresh:m.optional(),running_completion_refresh:m.optional(),running_completion_window:m.optional(),running_animation:_.optional(),demo_run_duration:m.optional(),demo_review_duration:m.optional(),link:e.url().optional(),url:e.url().optional(),json_path:e.string().regex(/^\$(?:\.[A-Za-z_][A-Za-z0-9_]*|\[\d+\])*$/,`must be a simple JSON path`).optional()}),v=e.looseObject({type:e.string().min(1),token_env:e.string().min(1).optional()}),y=e.object({refresh:m.optional(),running_refresh:m.optional(),running_completion_refresh:m.optional(),running_completion_window:m.optional(),panels:e.array(te).min(1).superRefine((e,t)=>{let n=new Map;e.forEach((e,r)=>{let i=n.get(e.id);if(i===void 0){n.set(e.id,r);return}t.addIssue({code:`custom`,path:[r,`id`],message:`duplicate panel id "${e.id}" (already used by panel at index ${i})`})})})}),b=e.object({issuer:e.url(),client_id:e.string().min(1).optional(),allow:e.object({groups:e.array(e.string().min(1)).optional(),subjects:e.array(e.string().min(1)).optional()}).optional()});e.object({sources:e.record(e.string().min(1),v).default({}),boards:e.record(e.string().min(1),y),auth:b.optional()});var x=e.object({assetPath:e.string().min(1),proxyPath:e.string().min(1),board:e.string().min(1),clientVersion:e.string().min(1),auth:e.object({issuer:e.string().min(1),clientId:e.string().min(1).optional()}).optional()}),S=x.pick({assetPath:!0,clientVersion:!0});function C(t=globalThis.window?.env){let n=x.safeParse(t);if(!n.success)throw Error(`window.env is missing or invalid \u2014 the server did not inject usable configuration.
2
+ ${e.prettifyError(n.error)}`);return n.data}var w=e.enum([`unreachable`,`unauthorized`,`not-found`,`no-runs`,`upstream-error`]),T=e.object({kind:w,message:e.string()}),ne=e.discriminatedUnion(`state`,[e.object({panelId:e.string().min(1),state:e.literal(`ok`),observedAt:e.iso.datetime(),link:e.url().nullable(),signal:e.unknown()}),e.object({panelId:e.string().min(1),state:e.literal(`error`),observedAt:e.iso.datetime(),link:e.url().nullable(),error:T})]),re=e.object({kind:e.enum([`job`,`stage`,`step`]),name:e.string().min(1),parent:e.string().min(1).optional()}),E=e.object({type:e.literal(`pipeline-status`),status:e.enum([`passed`,`failed`,`running`,`cancelled`,`unknown`]),rawStatus:e.string(),name:e.string().min(1),branch:e.string().min(1).optional(),durationMs:e.number().int().nonnegative().optional(),runStartedAt:e.iso.datetime().optional(),sourceRunId:e.string().min(1).optional(),activity:re.optional(),estimatedDurationMs:e.number().int().positive().optional(),sourceUpdatedAt:e.iso.datetime().optional()}),ie=e.object({label:e.string().min(1),status:E.shape.status,detail:e.string().min(1),link:e.url().nullable()}),ae=e.object({type:e.literal(`pull-request-health`),status:E.shape.status,summary:e.string().min(1),workflows:e.array(ie),pullRequests:e.array(ie)}),oe=e.object({type:e.literal(`http-value`),value:e.union([e.string(),e.number(),e.boolean()])}),se=12,ce=12;function le(e){let t=e.flatMap(e=>!e.position||D(e.position)||ue(e.position)?[]:[{panelId:e.id,kind:`out-of-bounds`,position:e.position,conflictsWith:[]}]),n=new Map;for(let r=0;r<e.length;r++){let i=e[r];if(!(!i?.position||D(i.position)))for(let a=r+1;a<e.length;a++){let r=e[a];if(!r?.position||D(r.position)||!de(i.position,r.position))continue;let o=`${r.id}\0overlap`,s=n.get(o);if(s)s.conflictsWith.push(i.id);else{let e={panelId:r.id,kind:`overlap`,position:r.position,conflictsWith:[i.id]};n.set(o,e),t.push(e)}}}return{issues:t}}function D(e){return e?.x===0&&e.y===0&&e.w===0&&e.h===0}function ue(e){return!D(e)&&e.x+e.w<=se&&e.y+e.h<=ce}function de(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}var O={refreshMillis:6e4,runningRefreshMillis:15e3,runningCompletionRefreshMillis:5e3,runningCompletionWindowMillis:12e4};function fe(e,t){let n=(e,t)=>p(e??``)??t,r=(r,i,a)=>n(t[r],n(e[i],a));return{refreshMillis:r(`refresh`,`refresh`,O.refreshMillis),runningRefreshMillis:r(`running_refresh`,`running_refresh`,O.runningRefreshMillis),runningCompletionRefreshMillis:r(`running_completion_refresh`,`running_completion_refresh`,O.runningCompletionRefreshMillis),runningCompletionWindowMillis:r(`running_completion_window`,`running_completion_window`,O.runningCompletionWindowMillis)}}var k={board:`_board_91ffc_1`,header:`_header_91ffc_11`,title:`_title_91ffc_18`,grid:`_grid_91ffc_24`,footerTools:`_footerTools_91ffc_34`,layoutWarning:`_layoutWarning_91ffc_39`,layoutWarningButton:`_layoutWarningButton_91ffc_42`,layoutWarningDialog:`_layoutWarningDialog_91ffc_60`,layoutWarningHeading:`_layoutWarningHeading_91ffc_73`,layoutWarningClose:`_layoutWarningClose_91ffc_91`,layoutWarningDownloads:`_layoutWarningDownloads_91ffc_99`,layoutWarningNote:`_layoutWarningNote_91ffc_118`,footer:`_footer_91ffc_34`},A={diagnostics:`_diagnostics_lseur_1`,button:`_button_lseur_5`,area:`_area_lseur_14`,warning:`_warning_lseur_31`,panels:`_panels_lseur_35`,actions:`_actions_lseur_43`};function pe({log:e}){let[t,n]=a(!1);o(e.subscribe,e.snapshot,e.snapshot);let r=e.count(),i=e.githubConsistencyIncidentCount(),s=e.summary();return u(`section`,{className:A.diagnostics,children:[u(`button`,{className:A.button,type:`button`,"aria-expanded":t,onClick:()=>n(!t),children:[`Diagnostics (`,r,`)`,i>0&&` · GitHub consistency ${i}`]}),t&&u(`div`,{className:A.area,children:[u(`p`,{children:[`Client `,e.clientVersion(),` · assets `,e.assetPath()]}),u(`p`,{children:[s.retained.eventCount,` retained browser-local events across`,` `,s.retained.sessionCount,` session`,s.retained.sessionCount===1?``:`s`,s.retained.firstEventAt&&s.retained.lastEventAt?` (${me(s.retained.firstEventAt,s.retained.lastEventAt)})`:``,`. They are never uploaded.`]}),s.retained.evidenceMayBeIncomplete&&u(`p`,{className:A.warning,role:`alert`,children:[`Earlier evidence was pruned: `,s.retained.retention.eventsPrunedByCount,` at the 2,000-event cap and `,s.retained.retention.eventsPrunedByAge,` by the 7-day age limit. “No failures” applies only to the retained window.`]}),u(`p`,{children:[`Update failures: `,s.failures.clientUpdate,`; board fetch failures:`,` `,s.failures.boardFetch,`.`]}),e.githubConsistencyIncidentCount()>0&&u(`p`,{className:A.warning,role:`alert`,children:[`GitHub API consistency incidents: `,e.githubConsistencyIncidentCount(),`. A response older than the last accepted run was rejected; download diagnostics to report it.`]}),s.panels.length>0&&l(`div`,{className:A.panels,children:s.panels.map(e=>u(`p`,{children:[l(`strong`,{children:e.panelId}),` — `,e.requests,` requests`,Object.keys(e.httpStatuses).length?`; HTTP ${Object.entries(e.httpStatuses).map(([e,t])=>`${e}×${t}`).join(`, `)}`:``,`; parse/network failures `,e.parseFailures,`/`,e.networkFailures,`; visible changes `,e.visibleStateChanges,`; latest`,` `,e.latestRendered?`${e.latestRendered.state}${e.latestRendered.status?`/${e.latestRendered.status}`:``}`:`not rendered`,`.`]},e.panelId))}),u(`div`,{className:A.actions,children:[l(`button`,{className:A.button,type:`button`,onClick:()=>{let t=new Blob([JSON.stringify(e.export(),null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`dashboard-diagnostics-${new Date().toISOString().replaceAll(`:`,`-`)}.json`,r.click(),URL.revokeObjectURL(n)},children:`Download`}),l(`button`,{className:A.button,type:`button`,onClick:()=>{window.confirm(`Clear this browser’s retained dashboard diagnostics?`)&&e.clear()},children:`Clear`})]})]})]})}function me(e,t){return e===t?e:`${e} to ${t}`}function he(){try{return window.localStorage}catch{return}}function ge(e,t){try{let n=e?.getItem(t);return n?JSON.parse(n):void 0}catch{return}}function _e(e,t,n){try{e?.setItem(t,JSON.stringify(n))}catch{}}function ve(e,t){try{e?.removeItem(t)}catch{}}function ye(e,t,n=0){let r=new Map,i=new Set,a=0,o=0;for(let t of e){if(i.add(t.sessionId),t.kind===`client-update-failure`&&a++,(t.kind===`board-fetch-failure`||t.kind===`board-fetch-parse-failure`)&&o++,!(`panelId`in t))continue;let e=r.get(t.panelId)??{panelId:t.panelId,requests:0,httpStatuses:{},parseFailures:0,networkFailures:0,visibleStateChanges:0};if(t.kind===`panel-fetch-start`&&e.requests++,t.kind===`panel-fetch-response`&&t.status!==void 0){let n=String(t.status);e.httpStatuses[n]=(e.httpStatuses[n]??0)+1}t.kind===`panel-fetch-parse-failure`&&e.parseFailures++,t.kind===`panel-fetch-failure`&&e.networkFailures++,t.kind===`panel-rendered`&&(e.visibleStateChanges++,e.latestRendered=t.rendered),r.set(t.panelId,e)}let s=e.map(e=>e.at).sort(),c=t.eventsPrunedByAge+t.eventsPrunedByCount;return{githubConsistencyIncidents:n,retained:{eventCount:e.length,firstEventAt:s[0],lastEventAt:s.at(-1),sessionCount:i.size,retention:t,evidenceMayBeIncomplete:c>0},failures:{clientUpdate:a,boardFetch:o},panels:[...r.values()].sort((e,t)=>e.panelId.localeCompare(t.panelId))}}var j=`ze-great-dashboard.diagnostics.v1`,be=2e3,xe=6048e5,Se=[`session-start`,`client-update-check`,`client-update-failure`,`client-update-detected`,`board-fetch-start`,`board-fetch-response`,`board-fetch-parse-failure`,`board-fetch-failure`,`layout-analyzed`,`panel-fetch-start`,`panel-fetch-response`,`panel-fetch-parse-failure`,`panel-fetch-failure`,`panel-rendered`],Ce=class{env;storage;now;events=[];retention=M();revision=0;incidents=[];listeners=new Set;sessionId=crypto.randomUUID?.()??`${Date.now()}-${Math.random()}`;constructor(e,t=he(),n=()=>new Date){this.env=e,this.storage=t,this.now=n,this.events=this.read(),this.record({kind:`session-start`})}recordGithubConsistencyIncident(e){this.incidents.push({...e,at:this.now().toISOString(),board:this.env.board}),this.persist(),this.revision++,this.notify()}githubConsistencyIncidentCount=()=>this.incidents.length;record(e){let t=De([...this.events,{...e,schemaVersion:1,at:this.now().toISOString(),sessionId:this.sessionId,board:this.env.board}],this.now(),this.retention);this.events=t.events,this.retention=t.retention,this.persist(),this.revision++,this.notify()}count=()=>this.events.length;clientVersion=()=>this.env.clientVersion;assetPath=()=>this.env.assetPath;snapshot=()=>this.revision;summary=()=>ye(this.events,this.retention,this.incidents.length);clear(){this.events=[],this.incidents=[],this.retention=M(),ve(this.storage,j),this.revision++,this.notify()}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});export=()=>({schemaVersion:1,exportedAt:this.now().toISOString(),client:{version:this.env.clientVersion,assetPath:this.env.assetPath,board:this.env.board,sessionId:this.sessionId},events:this.events,githubConsistencyIncidents:this.incidents,summary:this.summary()});read(){let e=ge(this.storage,j);if(!e||e.schemaVersion!==1||!Array.isArray(e.events)||!e.events.every(Oe))return ve(this.storage,j),[];let t=De(e.events.map(e=>({...e,schemaVersion:1})),this.now(),Ee(e.retention));return this.retention=t.retention,this.incidents=we(e.githubConsistencyIncidents),t.events}persist(){_e(this.storage,j,{schemaVersion:1,events:this.events,retention:this.retention,githubConsistencyIncidents:this.incidents})}notify(){for(let e of this.listeners)e()}};function we(e){return Array.isArray(e)?e.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.at==`string`&&typeof t.board==`string`&&typeof t.panelId==`string`&&typeof t.endpoint==`string`&&!!t.accepted&&!!t.regressed&&!!t.response}):[]}function Te(e){let t=Object.fromEntries([[`cacheControl`,`cache-control`],[`etag`,`etag`],[`lastModified`,`last-modified`],[`date`,`date`],[`age`,`age`]].flatMap(([t,n])=>{let r=e.get(n);return r?[[t,r]]:[]}));return Object.keys(t).length?t:void 0}function M(){return{eventsPrunedByAge:0,eventsPrunedByCount:0}}function Ee(e){if(!e||typeof e!=`object`)return M();let t=e;return{eventsPrunedByAge:typeof t.eventsPrunedByAge==`number`&&t.eventsPrunedByAge>=0?t.eventsPrunedByAge:0,eventsPrunedByCount:typeof t.eventsPrunedByCount==`number`&&t.eventsPrunedByCount>=0?t.eventsPrunedByCount:0}}function De(e,t,n){let r=t.valueOf()-xe,i=e.filter(e=>Number.isFinite(new Date(e.at).valueOf())&&new Date(e.at).valueOf()>=r),a=e.length-i.length,o=Math.max(0,i.length-be);return{events:i.slice(-2e3),retention:{eventsPrunedByAge:n.eventsPrunedByAge+a,eventsPrunedByCount:n.eventsPrunedByCount+o}}}function Oe(e){if(!e||typeof e!=`object`)return!1;let t=e;return(t.schemaVersion===void 0||t.schemaVersion===1)&&typeof t.at==`string`&&Number.isFinite(new Date(t.at).valueOf())&&typeof t.sessionId==`string`&&typeof t.board==`string`&&Se.includes(t.kind)}var N={panel:`_panel_1vwpp_1`,content:`_content_1vwpp_21`,details:`_details_1vwpp_33`,error:`_error_1vwpp_41`,wide:`_wide_1vwpp_44`,primary:`_primary_1vwpp_47`,compact:`_compact_1vwpp_54`,label:`_label_1vwpp_64`,hint:`_hint_1vwpp_75`,branch:`_branch_1vwpp_81`,observed:`_observed_1vwpp_85`,stale:`_stale_1vwpp_91`,status:`_status_1vwpp_94`,passed:`_passed_1vwpp_102`,failed:`_failed_1vwpp_105`,running:`_running_1vwpp_108`,cancelled:`_cancelled_1vwpp_111`,unknown:`_unknown_1vwpp_112`,sourceAction:`_sourceAction_1vwpp_115`,shallow:`_shallow_1vwpp_145`};function ke({label:e,hint:t,wide:n=!1}){return u(`section`,{className:`${N.panel} ${n?N.wide:``}`,"data-panel":!0,"data-panel-id":`placeholder`,children:[l(`h2`,{className:N.label,children:e}),l(`p`,{className:N.hint,children:t})]})}var Ae={fact:`_fact_17pw7_1`};function je(e){let t=e.position;if(t)return{"--panel-column":`${t.x+1} / span ${t.w}`,"--panel-row":`${t.y+1} / span ${t.h}`}}function P({children:e}){return l(`p`,{className:N.hint,children:e})}function F({children:e,status:t}){return l(`p`,{className:`${N.status} ${t?N[t]:``}`,children:e})}function Me({children:e,title:t}){return l(`span`,{className:N.branch,title:t,children:e})}function Ne({children:e,stale:t=!1}){return l(`p`,{className:`${N.hint} ${N.observed} ${t?N.stale:``}`,children:e})}function I({panel:e,envelope:t,error:n=!1,field:r,children:i}){let a=e.display===`primary`||e.display===`compact`?e.display:`supporting`,o=e.position,s=o!==void 0&&o.h<=2,c=o!==void 0&&o.h<=3;return u(`section`,{className:`${N.panel} ${N[a]} ${s?N.shallow:``} ${c?N.short:``} ${n?N.error:``}`,style:je(e),"aria-busy":!t||void 0,"data-panel":!0,"data-panel-id":e.id,"data-panel-position":o?`${o.x},${o.y},${o.w},${o.h}`:void 0,"data-display":a,"data-shallow":s,"data-short":c,"data-error":n||void 0,children:[r,l(Pe,{panelId:e.id,link:t?.link}),u(`div`,{className:N.content,"data-panel-content":!0,children:[l(`h2`,{className:N.label,children:e.label??e.id}),i]})]})}function Pe({panelId:e,link:t}){return t?u(`a`,{className:N.sourceAction,href:t,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`View source for ${e} (opens in a new tab)`,title:`View source for ${e} (opens in a new tab)`,"data-panel-action":`source`,"data-panel-link":!0,children:[l(`span`,{"aria-hidden":`true`,children:`↗`}),l(`span`,{className:`screen-reader-only`,children:`View source`})]}):null}function L({value:e,label:t=`As of`}){return l(R,{value:e,label:t,stale:!0,variant:`clock`})}function Fe({value:e}){return l(R,{value:e,stale:!0,label:`Checked`,variant:`age`})}function Ie({value:e,running:t}){return l(R,{value:e,label:t?`Started`:`Run updated`,variant:`age`})}function R({value:e,label:t,stale:n=!1,variant:r}){let i=new Date(e),a=i.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),o=Date.now()-i.getTime(),s=r===`clock`?`${t} ${a} · ${Le(o)}`:`${t} ${Le(o)}`;return u(Ne,{stale:n,children:[l(`span`,{"aria-hidden":`true`,children:`◷`}),` `,l(`span`,{title:`${t} at ${a}`,children:s}),r===`age`&&u(`span`,{className:`screen-reader-only`,children:[` (`,a,`)`]})]})}function Le(e){if(e<6e4)return`just now`;let t=Math.floor(e/6e4);return t<60?`${t}m ago`:`${Math.floor(t/60)}h ${t%60}m ago`}function Re({panel:e,envelope:t}){if(!t)return l(I,{panel:e,children:l(P,{children:`Loading…`})});if(t.state===`error`)return u(I,{panel:e,envelope:t,error:!0,children:[l(F,{children:`⚠ Unable to read`}),l(P,{children:t.error.message}),l(L,{value:t.observedAt})]});let n=oe.safeParse(t.signal);return n.success?l(I,{panel:e,envelope:t,children:u(`div`,{className:Ae.fact,children:[l(F,{children:String(n.data.value)}),l(L,{value:t.observedAt})]})}):u(I,{panel:e,envelope:t,error:!0,children:[l(F,{children:`⚠ Invalid value`}),l(L,{value:t.observedAt})]})}var ze=.85,Be=[[{x:0,y:0},{x:1,y:0}],[{x:0,y:0},{x:0,y:1}],[{x:0,y:0},{x:1,y:0},{x:0,y:1}],[{x:0,y:0},{x:1,y:0},{x:2,y:0}],[{x:0,y:0},{x:0,y:1},{x:1,y:1}]];function Ve(e,t){return e>t?`horizontal`:`vertical`}function He(e,t=e===`horizontal`?12:3,n=e===`horizontal`?3:12){let r=Math.max(1,t*.8),i=Math.max(1,n*.8),a=Math.max(24,Math.min(42,Math.min(r,i)/4)),o=Math.max(3,Math.min(24,Math.round(r/a))),s=Math.max(3,Math.min(16,Math.round(i/a)));return e===`horizontal`?{columns:Math.max(o,s),rows:s}:{columns:o,rows:Math.max(s,o)}}function Ue(e){return Array.from(e).reduce((e,t)=>e*31+t.charCodeAt(0)>>>0,7)}function We(e,t,n){let r=Math.max(...e.map(e=>e.x)),i=Math.max(...e.map(e=>e.y));return r<t&&i<n}function z(e,t){return e.cells.some(n=>t.cells.some(r=>e.x+n.x===t.x+r.x&&e.y+n.y===t.y+r.y))}function Ge(e,t,n){let r=Be.filter(e=>We(e,t,n));return r[B(e,r.length)]??[{x:0,y:0}]}function Ke(e,t,n,r,i,a=0,o=!1){let s=Math.max(...e.map(e=>e.x))+1,c=Math.max(...e.map(e=>e.y))+1,l=[];for(let a=0;a<=r-c;a++)for(let c=0;c<=n-s;c++){let s={id:-1,bornAt:0,cells:e,x:c,y:a,phase:`settled`};if(i.some(e=>z(s,e))||!$e(e,t,n,r,s,i))continue;let u=t===`vertical`?e.filter(e=>a+e.y===r-1||i.some(t=>t.cells.some(n=>t.x+n.x===c+e.x&&t.y+n.y===a+e.y+1))).length:e.filter(e=>c+e.x===0||i.some(t=>t.cells.some(n=>t.x+n.x===c+e.x-1&&t.y+n.y===a+e.y))).length;o&&u<Qe(e,t)||l.push({x:c,y:a,support:u})}l.sort((e,n)=>n.support-e.support||(t===`vertical`?n.y-e.y||e.x-n.x:e.x-n.x||e.y-n.y));let u=l[0]?.support,d=l.filter(e=>e.support===u),f=d[B(a,d.length)];return f?{x:f.x,y:f.y}:void 0}function qe(e,t,n,r,i,a){let o=Be.flatMap((o,s)=>{if(!We(o,t,n))return[];let c=Ke(o,e,t,n,r,i+s*31,a);return c?[{shape:o,destination:c}]:[]});if(o.length!==0)return o[B(i,o.length)]}function Je(e,t,n){return Math.ceil(e*t*ze*Math.min(1,Math.max(0,n)))}function Ye(e){return e.reduce((e,t)=>e+t.cells.length,0)}function Xe(e,t,n,r,i){let a=e===`vertical`?n-1:0,o=new Set(r.flatMap(t=>t.cells.filter(n=>e===`vertical`?t.y+n.y===a:t.x+n.x===a).map(n=>e===`vertical`?t.x+n.x:t.y+n.y))),s=e===`vertical`?t:n,c=o.size===s;if(!c&&!i||o.size===0)return;let l=[];return{shapes:r.flatMap(t=>{let n=t.cells.filter(n=>{let r=e===`vertical`?t.y+n.y===a:t.x+n.x===a;return r&&l.push({x:t.x+n.x,y:t.y+n.y}),!r});return n.length===0?[]:[{...t,cells:n,y:e===`vertical`?t.y+1:t.y,x:e===`horizontal`?t.x-1:t.x}]}),cleared:l,complete:c}}function Ze(e,t,n,r,i){let a=[];for(let o=0;o<i;o+=1){let i=r+o*17,s=Ge(i,t,n),c=Ke(s,e,t,n,a,i+1);if(!c)break;a.push({id:o,bornAt:0,cells:s,x:c.x,y:c.y,phase:`settled`})}return a}function Qe(e,t){return t===`vertical`?new Set(e.map(e=>e.x)).size:new Set(e.map(e=>e.y)).size}function $e(e,t,n,r,i,a){let o=Math.max(...e.map(e=>e.x))+1,s=Math.max(...e.map(e=>e.y))+1;if(t===`vertical`){for(let e=0;e<=i.y;e+=1)if(a.some(t=>z({...i,y:e},t)))return!1;return i.y+s<=r}for(let e=n-o;e>=i.x;--e)if(a.some(t=>z({...i,x:e},t)))return!1;return i.x+o<=n}function B(e,t){if(t<=1)return 0;let n=Math.sin(e*12.9898+78.233)*43758.5453;return Math.floor((n-Math.floor(n))*t)}var et={variant:`_variant_1lsfm_1`},V={field:`_field_1x3vm_1`,grid:`_grid_1x3vm_10`,piece:`_piece_1x3vm_14`,cell:`_cell_1x3vm_34`,clearingCell:`_clearingCell_1x3vm_38`,"clear-cell":`_clear-cell_1x3vm_1`},tt=50,H=1250,nt=250,rt=850,it=500;function at({progress:e,estimatedDurationMs:t,overdue:r,seed:o=0}){let s=i(null),[c,d]=a({...He(`vertical`),direction:`vertical`}),[f,p]=a([]),[m,h]=a(!1),[ee,g]=a([]),[_,te]=a(!1),v=i(c),y=i(c),b=i(e),x=i(o),S=i(void 0),C=i([]),w=i(!1),T=i({startedAt:Date.now(),nextPieceAt:H,recycleUntil:0,id:0,settled:[]});return n(()=>{b.current=e},[e]),n(()=>{x.current=o},[o]),n(()=>{let e=s.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();t.width!==0&&t.height!==0&&d(e=>{let n=S.current??Ve(t.width,t.height);S.current=n;let r={...He(n,t.width,t.height),direction:n};return v.current=r,r})};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),n(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>te(e.matches);return t(),e.addEventListener?.(`change`,t),()=>e.removeEventListener?.(`change`,t)},[]),n(()=>{let e=y.current,t=e.direction!==c.direction||e.columns!==c.columns||e.rows!==c.rows;y.current=c,!(!t||_)&&(T.current={startedAt:Date.now(),nextPieceAt:H,id:0,recycleUntil:0,settled:[]},C.current=[],p([]),h(!1),g([]),w.current=!1)},[c,_]),n(()=>{if(!_)return;let e=Ze(c.direction,c.columns,c.rows,x.current,Math.max(1,Math.floor(b.current*6)));C.current=e,T.current.settled=e,p(e)},[c,_]),n(()=>{if(_)return;let e=window.setInterval(()=>{let e=T.current,n=Date.now()-e.startedAt,i=v.current,a=b.current,o=Je(i.columns,i.rows,a),s=[...e.settled],c=C.current.filter(e=>e.phase!==`settled`);if(n<e.recycleUntil)return;if(w.current&&(w.current=!1,h(!1),g([])),n>=e.nextPieceAt&&c.length===0){if(a<1&&Ye(s)>=o)return;let l=e.id,u=x.current+l*17,d=qe(i.direction,i.columns,i.rows,s,u+1,!r);if(!d&&(a>=1||t===void 0)){let t=Xe(i.direction,i.columns,i.rows,s,!0);if(t){s=t.shapes,e.settled=s,e.recycleUntil=n+it,e.nextPieceAt=e.recycleUntil,C.current=s,w.current=!0,g(t.cleared),p(s),h(!0);return}}if(d){e.id+=1;let{shape:t,destination:r}=d,a=Math.max(...t.map(e=>e.y))+1;c=[...c,{id:l,bornAt:n,cells:t,x:i.direction===`horizontal`?i.columns-Math.max(...t.map(e=>e.x))-.5:r.x,y:i.direction===`vertical`?-a+.5:r.y,targetX:r.x,targetY:r.y,phase:`entry`}]}e.nextPieceAt+=ot(t,i)}c=c.map(e=>{let t=n-e.bornAt,r=e.targetX===void 0||e.targetY===void 0?void 0:{x:e.targetX,y:e.targetY};if(!r)return e;let a=Math.min(1,Math.max(0,(t-nt)/rt));if(a>=1)return s=[...s,{...e,x:r.x,y:r.y,phase:`settled`}],{...e,x:r.x,y:r.y,phase:`settled`};let o=i.direction===`horizontal`?i.columns-Math.max(...e.cells.map(e=>e.x))-1:r.x,c=i.direction===`vertical`?0:r.y,l=Math.min(1,Math.max(0,t/1100));return{...e,x:i.direction===`horizontal`?o+(r.x-o)*a:o,y:i.direction===`vertical`?c+(r.y-c)*a:c,phase:t<nt?`entry`:l<.35?`align`:`travel`}}),e.settled=s;let l=[...s,...c.filter(e=>e.phase!==`settled`)];C.current=l,p(l)},tt);return()=>window.clearInterval(e)},[t,r,_]),l(`div`,{ref:s,className:V.field,"data-running-part":`falling-shapes-field`,"data-overdue":r||void 0,"data-direction":c.direction,"data-recycling":m||void 0,style:{"--shape-columns":c.columns,"--shape-rows":c.rows},children:u(`div`,{className:V.grid,children:[ee.map(e=>l(`span`,{className:V.clearingCell,style:{"--clear-x":e.x,"--clear-y":e.y}},`${e.x}-${e.y}`)),f.map(e=>l(`div`,{className:V.piece,"data-piece":e.id,"data-piece-phase":e.phase,style:{"--piece-x":e.x,"--piece-y":e.y,"--piece-width":Math.max(...e.cells.map(e=>e.x))+1,"--piece-height":Math.max(...e.cells.map(e=>e.y))+1},children:e.cells.map(e=>l(`span`,{className:V.cell,style:{"--cell-x":e.x,"--cell-y":e.y}},`${e.x}-${e.y}`))},e.id))]})})}function ot(e,t){let n=Math.ceil(t.columns*t.rows*.85);return e===void 0||n<=0?H:Math.max(400,e/Math.max(1,Math.ceil(n/3)))}var U={frontier:`_frontier_rnw91_1`,now:`_now_rnw91_12`,routes:`_routes_rnw91_20`,route:`_route_rnw91_20`,trail:`_trail_rnw91_41`,packet:`_packet_rnw91_42`,"packet-stall":`_packet-stall_rnw91_1`,"trail-backup":`_trail-backup_rnw91_1`};function st(){return u(c,{children:[l(`span`,{className:U.frontier,"data-running-part":`frontier`}),l(`span`,{className:U.now,"data-running-part":`transit-now`}),l(`span`,{className:U.routes,"data-running-part":`transit-routes`,children:[0,1,2].map(e=>l(`span`,{className:U.route},e))}),l(`span`,{className:U.trail,"data-running-part":`transit-trail`}),l(`span`,{className:U.packet,"data-running-part":`transit-packet`})]})}var W={field:`_field_1i9kx_1`,overdue:`_overdue_1i9kx_11`,timing:`_timing_1i9kx_14`,timingOverdue:`_timingOverdue_1i9kx_28`},G={haze:`_haze_3npie_1`,pressure:`_pressure_3npie_17`,band:`_band_3npie_20`,bandOne:`_bandOne_3npie_33`,bandTwo:`_bandTwo_3npie_36`,bandThree:`_bandThree_3npie_40`,drift:`_drift_3npie_45`,driftOne:`_driftOne_3npie_54`,driftTwo:`_driftTwo_3npie_58`,driftThree:`_driftThree_3npie_67`,driftFour:`_driftFour_3npie_76`,driftFive:`_driftFive_3npie_85`,"storm-band":`_storm-band_3npie_1`};function ct(){return u(c,{children:[l(`span`,{className:G.haze,"data-running-part":`weather-haze`}),l(`span`,{className:G.pressure,"data-running-part":`weather-pressure`}),l(`span`,{className:`${G.band} ${G.bandOne}`}),l(`span`,{className:`${G.band} ${G.bandTwo}`}),l(`span`,{className:`${G.band} ${G.bandThree}`}),l(`span`,{className:`${G.drift} ${G.driftOne}`}),l(`span`,{className:`${G.drift} ${G.driftTwo}`}),l(`span`,{className:`${G.drift} ${G.driftThree}`}),l(`span`,{className:`${G.drift} ${G.driftFour}`}),l(`span`,{className:`${G.drift} ${G.driftFive}`})]})}var lt={anchor:`_anchor_1bd86_1`,body:`_body_1bd86_6`,"phased-marker":`_phased-marker_1bd86_1`};function ut({anchorClassName:e,bodyClassName:t,delay:n,anchorPart:r,bodyPart:i}){let a=n?{"--phased-marker-delay":n}:void 0;return l(`span`,{className:`${lt.anchor} ${e??``}`,"data-running-part":r,children:l(`span`,{className:`${lt.body} ${t??``}`,"data-running-part":i,style:a})})}var K={frontier:`_frontier_2wwhn_1`,flare:`_flare_2wwhn_12`,lanes:`_lanes_2wwhn_15`,lane:`_lane_2wwhn_15`,markerAnchor:`_markerAnchor_2wwhn_31`,markerBody:`_markerBody_2wwhn_35`,"bloom-flare":`_bloom-flare_2wwhn_1`};function dt(){return u(c,{children:[l(`span`,{className:K.frontier,"data-running-part":`frontier`}),l(`span`,{className:K.flare,"data-running-part":`bloom-flare`}),l(`span`,{className:K.lanes,"data-running-part":`bloom-lanes`,children:[0,1,2,3].map(e=>l(`span`,{className:K.lane,"data-running-part":`bloom-lane`,children:l(ut,{anchorClassName:K.markerAnchor,bodyClassName:K.markerBody,delay:[void 0,`-0.8s`,`-1.7s`,`-2.4s`][e],anchorPart:`bloom-marker-anchor`,bodyPart:`bloom-marker`})},e))})]})}function ft(e){return[`telemetry-bloom`,`release-transit`,`status-weather`,`falling-shapes`].includes(e)}function q({animation:e,progress:t,estimatedDurationMs:n,overdue:r,indeterminate:i,seed:a}){let o={"--running-progress":`${t*100}%`};return u(`div`,{className:`${W.field} ${r?W.overdue:``}`,"data-animation":e,"data-running-field":!0,"data-overdue":r||void 0,"data-indeterminate":i||void 0,"aria-hidden":`true`,style:o,children:[e===`telemetry-bloom`&&l(dt,{}),e===`release-transit`&&l(st,{}),e===`status-weather`&&l(ct,{}),e===`falling-shapes`&&l(at,{progress:t,estimatedDurationMs:n,overdue:r,seed:a})]})}var pt=20;function mt(e,t){let n=ht(!!e),r=e?new Date(e).valueOf():NaN,i=Number.isFinite(r)?Math.max(0,n-r):void 0,a=i!==void 0&&t!==void 0;return{elapsedMs:i,estimatedDurationMs:t,hasEstimate:a,overdue:a&&i>t,progress:a?Math.min(i/t,1):0}}function ht(e){let[t,r]=a(()=>Date.now());return n(()=>{if(!e)return;r(Date.now());let t=window.setInterval(()=>r(Date.now()),pt);return()=>window.clearInterval(t)},[e]),t}function gt(e,t,n){return`${e===void 0?`Run in progress`:`Elapsed ${vt(e)}`} · ${t===void 0?`Expected duration unavailable`:`Expected ≈ ${vt(t)}`}${n?` · Over estimate`:``}`}function _t(e,t,n){let r=e===void 0?`—`:yt(e),i=t===void 0?`?`:`~${yt(t)}`;return`${n?`⚠`:`\xA0`}${r}/${i}`}function vt(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function yt(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=`${r}:${String(i).padStart(2,`0`)}`;return n>0?`${n}:${a.padStart(5,`0`)}`:a}function bt({elapsedMs:e,estimatedDurationMs:t,overdue:n}){return u(`p`,{className:`${W.timing} ${n?W.timingOverdue:``}`,children:[l(`span`,{className:`screen-reader-only`,children:gt(e,t,n)}),l(`span`,{"aria-hidden":`true`,children:_t(e,t,n)})]})}var J={progress:`_progress_1x79l_1`,visual:`_visual_1x79l_8`,timing:`_timing_1x79l_12`,overdue:`_overdue_1x79l_17`,readout:`_readout_1x79l_23`,radial:`_radial_1x79l_31`,sweep:`_sweep_1x79l_1`,"alarm-ring":`_alarm-ring_1x79l_1`,radialCore:`_radialCore_1x79l_58`,"reactor-breathe":`_reactor-breathe_1x79l_1`,runway:`_runway_1x79l_70`,"barrier-pulse":`_barrier-pulse_1x79l_1`,spark:`_spark_1x79l_114`,sparkTwo:`_sparkTwo_1x79l_128`,orbit:`_orbit_1x79l_135`,orbitCore:`_orbitCore_1x79l_151`,particle:`_particle_1x79l_163`,particleTwo:`_particleTwo_1x79l_174`,"gravity-well":`_gravity-well_1x79l_1`,indeterminate:`_indeterminate_1x79l_191`,shift:`_shift_1x79l_1`,signalField:`_signalField_1x79l_199`,rail:`_rail_1x79l_217`,lead:`_lead_1x79l_223`,pulse:`_pulse_1x79l_233`,pulseTwo:`_pulseTwo_1x79l_244`,tracks:`_tracks_1x79l_247`,sparkWide:`_sparkWide_1x79l_1`,track:`_track_1x79l_247`,markerAnchor:`_markerAnchor_1x79l_371`,markerBody:`_markerBody_1x79l_375`,"endpoint-pulse":`_endpoint-pulse_1x79l_1`,short:`_short_1x79l_413`};function xt({animation:e,timing:t}){let{elapsedMs:n,estimatedDurationMs:r,hasEstimate:i,overdue:a,progress:o}=t,s=e===`runway`||e===`signal-field`,d=gt(n,r,a),f={"--running-progress":`${o*100}%`,"--running-degrees":`${o*360}deg`},p=e===`signal-field`?J.signalField:J[e];return u(`div`,{className:`${J.progress} ${p} ${a?J.overdue:``} ${i?``:J.indeterminate}`,style:f,"data-running-progress":e,"data-overdue":a||void 0,"data-indeterminate":!i||void 0,children:[u(`div`,{className:J.visual,"aria-hidden":`true`,"data-running-visual":!0,children:[e===`radial`&&l(`span`,{className:J.radialCore}),e===`runway`&&u(c,{children:[l(`span`,{className:J.spark,"data-running-part":`runway-spark`}),l(`span`,{className:`${J.spark} ${J.sparkTwo}`,"data-running-part":`runway-spark-two`})]}),e===`orbit`&&u(c,{children:[l(`span`,{className:J.orbitCore}),l(`span`,{className:J.particle}),l(`span`,{className:`${J.particle} ${J.particleTwo}`})]}),e===`signal-field`&&u(c,{children:[l(`span`,{className:J.rail}),l(`span`,{className:J.lead}),l(`span`,{className:J.pulse}),l(`span`,{className:`${J.pulse} ${J.pulseTwo}`}),l(`span`,{className:J.tracks,"data-running-part":`signal-tracks`,children:[0,1,2,3,4].map(e=>l(`span`,{className:J.track,"data-running-part":`signal-track`,children:l(ut,{anchorClassName:J.markerAnchor,bodyClassName:J.markerBody,delay:[void 0,`-0.8s`,`-1.7s`,`-2.4s`,`-0.35s`][e],anchorPart:`signal-marker-anchor`,bodyPart:`signal-marker`})},e))})]})]}),l(`p`,{className:`${J.timing} ${s?J.readout:``}`,children:s?u(c,{children:[l(`span`,{className:`screen-reader-only`,children:d}),l(`span`,{"aria-hidden":`true`,children:_t(n,r,a)})]}):d})]})}function St(e){return[`radial`,`runway`,`orbit`,`signal-field`].includes(e)}var Ct=2e4,wt=15e3,Tt=3e5,Et=1.25,Dt=[`radial`,`runway`,`orbit`,`signal-field`,`telemetry-bloom`,`release-transit`,`status-weather`,`falling-shapes`];function Ot({panel:e}){let t=jt(),n=e.running_animation===void 0||e.running_animation===`off`?void 0:e.running_animation,r=kt(e.demo_run_duration,Ct),i=kt(e.demo_review_duration,Tt),a=n?Math.ceil(i*Et):r,o=Math.floor(t/a),s=n??Dt[o%Dt.length]??`radial`,c=o*a;return l(At,{panel:e,animation:s,runStartedAt:c,estimatedDurationMs:n?i:wt})}function kt(e,t){return e?p(e)??t:t}function At({panel:e,animation:t,runStartedAt:n,estimatedDurationMs:r}){let i=mt(new Date(n).toISOString(),r),a=ft(t);return u(I,{panel:e,field:a?l(q,{animation:t,progress:i.progress,estimatedDurationMs:i.estimatedDurationMs,overdue:i.overdue,indeterminate:!i.hasEstimate,seed:Ue(e.id)},`${t}-${n}`):void 0,children:[l(F,{status:`running`,children:`↻ Running`}),u(`p`,{className:et.variant,children:[`Demo treatment · `,t]}),a?l(bt,{elapsedMs:i.elapsedMs,estimatedDurationMs:r,overdue:i.overdue}):l(xt,{animation:t,timing:i})]})}function jt(){let[e,t]=a(()=>Date.now());return n(()=>{let e=window.setInterval(()=>t(Date.now()),1e3);return()=>window.clearInterval(e)},[]),e}var Mt={details:`_details_1ib76_1`};function Nt(e){return e?e.parent?`${e.parent} › ${e.name}`:e.name:`Activity unavailable`}function Pt({panel:e,envelope:t}){if(!t)return l(I,{panel:e,children:l(P,{children:`Loading…`})});if(t.state===`error`)return u(I,{panel:e,envelope:t,error:!0,children:[u(F,{children:[`⚠ `,t.error.kind===`no-runs`?`No workflow runs`:`Unable to read`]}),l(P,{children:t.error.message}),l(L,{value:t.observedAt})]});let n=E.safeParse(t.signal);return n.success?l(Ft,{panel:e,envelope:t,signal:n.data}):u(I,{panel:e,envelope:t,error:!0,children:[l(F,{children:`⚠ Invalid signal`}),l(L,{value:t.observedAt})]})}function Ft({panel:e,envelope:t,signal:n}){let r=Rt(n.status),[o,s]=a(()=>n.status===`running`?It():void 0),c=i(n.status);if(n.status!==c.current){let t=c.current===`running`;c.current=n.status,e.running_animation===void 0&&!t&&n.status===`running`&&s(e=>It(e))}let d=e.running_animation??o??`off`,f=n.status===`running`&&d!==`off`,p=mt(n.runStartedAt,n.estimatedDurationMs),m=f&&ft(d),h=f&&St(d);return l(I,{panel:e,envelope:t,field:m?l(q,{animation:d,progress:p.progress,estimatedDurationMs:p.estimatedDurationMs,overdue:p.overdue,indeterminate:!p.hasEstimate,seed:Ue(e.id)}):void 0,children:u(`div`,{className:Mt.details,children:[u(F,{status:n.status,children:[r.glyph,` `,r.label]}),n.status===`running`&&l(P,{children:Nt(n.activity)}),n.branch&&l(P,{children:u(Me,{title:`Branch: ${n.branch}`,children:[l(`span`,{"aria-hidden":`true`,children:`⎇ `}),l(`span`,{className:`screen-reader-only`,children:`Branch: `}),n.branch]})}),m&&l(bt,{elapsedMs:p.elapsedMs,estimatedDurationMs:n.estimatedDurationMs,overdue:p.overdue}),h&&l(xt,{animation:d,timing:p}),n.status!==`running`&&n.durationMs!==void 0&&u(P,{children:[`Took `,Lt(n.durationMs)]}),(n.status===`running`&&n.runStartedAt||n.sourceUpdatedAt)&&l(Ie,{value:n.status===`running`&&n.runStartedAt?n.runStartedAt:n.sourceUpdatedAt??t.observedAt,running:n.status===`running`}),l(Fe,{value:t.observedAt})]})})}function It(e){let t=g.filter(t=>t!==e);return t[Math.floor(Math.random()*t.length)]??`telemetry-bloom`}function Lt(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function Rt(e){switch(e){case`passed`:return{glyph:`✓`,label:`Passed`};case`failed`:return{glyph:`✕`,label:`Failed`};case`running`:return{glyph:`↻`,label:`Running`};case`cancelled`:return{glyph:`⊘`,label:`Cancelled`};case`unknown`:return{glyph:`?`,label:`Unknown`}}}function zt({panel:e,envelope:t}){if(!t)return l(I,{panel:e,children:l(P,{children:`Loading…`})});if(t.state===`error`)return u(I,{panel:e,envelope:t,error:!0,children:[l(F,{children:`⚠ Unable to read`}),l(P,{children:t.error.message}),l(L,{value:t.observedAt})]});let n=ae.safeParse(t.signal);if(!n.success)return l(I,{panel:e,envelope:t,error:!0,children:l(F,{children:`⚠ Invalid signal`})});let r=Bt(n.data.status);return u(I,{panel:e,envelope:t,children:[u(F,{status:n.data.status,children:[r.glyph,` `,r.label]}),l(P,{children:n.data.summary}),l(L,{value:t.observedAt})]})}function Bt(e){switch(e){case`passed`:return{glyph:`✓`,label:`Healthy`};case`failed`:return{glyph:`✕`,label:`Failed`};case`running`:return{glyph:`↻`,label:`Running`};case`cancelled`:return{glyph:`⊘`,label:`Cancelled`};case`unknown`:return{glyph:`?`,label:`Unknown`}}}var Vt={"pipeline-status":Pt,"pull-request-health":zt,"http-value":Re,"pipeline-animation-demo":Ot};function Ht({panel:e,envelope:t}){let n=Vt[e.type];return n?l(n,{panel:e,envelope:t}):l(ke,{label:e.type,hint:`Not wired yet`,wide:!0})}var Ut=6e4,Wt=1e4,Gt=()=>globalThis.window.location.reload();function Kt({env:e,diagnostics:t,fetcher:r,reload:i=Gt}){n(()=>{let n=!1,a=!1,o,s=`${e.proxyPath}/client`,c=async()=>{if(n||a)return;a=!0;let l=new AbortController;o=l;let u=globalThis.setTimeout(()=>l.abort(),Wt);t.record({kind:`client-update-check`,path:s});try{let a=await(r??globalThis.fetch)(s,{cache:`no-store`,signal:l.signal});if(!a.ok)throw Error(`Client identity returned ${a.status}`);let o=S.safeParse(await a.json());if(!o.success)throw Error(`Client identity response was invalid`);if(n)return;o.data.assetPath!==e.assetPath&&(t.record({kind:`client-update-detected`,path:s,current:{assetPath:e.assetPath,clientVersion:e.clientVersion},next:o.data}),i())}catch(e){!n&&!(e instanceof DOMException&&e.name===`AbortError`)&&t.record({kind:`client-update-failure`,path:s,message:e instanceof Error?e.message:String(e)})}finally{globalThis.clearTimeout(u),a=!1,o===l&&(o=void 0),n||globalThis.setTimeout(()=>void c(),Ut)}};return c(),()=>{n=!0,o?.abort()}},[t,e.assetPath,e.clientVersion,e.proxyPath,r,i])}function Y(e,t){if(t.state===`error`)return{state:t.state,link:t.link};if(e.type===`pipeline-status`){let e=E.safeParse(t.signal);return{state:t.state,status:e.success?e.data.status:void 0,link:t.link}}if(e.type===`pull-request-health`){let e=ae.safeParse(t.signal);return{state:t.state,status:e.success?e.data.status:void 0,link:t.link}}return{state:t.state,link:t.link}}function qt(e,t,n){if(!e)return!0;let r=Y(t,e),i=Y(t,n);return r.state!==i.state||r.status!==i.status||r.link!==i.link}var Jt=`ze-great-dashboard.panel-memory.v1`,Yt=1,Xt=12096e5,Zt=class{now;histories;storage;constructor(e=he(),t=()=>new Date){this.now=t,this.storage=e,this.histories=this.read(),this.pruneAll()}latest(e){return this.history(e).latest}rememberLatest(e,t){this.history(e).latest=t,this.persist()}recordRun(e,t,n=!1){let r=this.history(e);n&&(r.durations[Qt(t)]=t);let i=r.latestCompleted;(!i||$t(t.sourceUpdatedAt,i.sourceUpdatedAt))&&(r.latestCompleted=t),this.pruneHistory(r),this.persist()}recordSuccessfulRun(e,t){this.recordRun(e,t,!0)}recordCompletedRun(e,t){this.recordRun(e,t)}medianDuration(e){let t=this.history(e);this.pruneHistory(t);let n=Object.values(t.durations).map(({durationMs:e})=>e).sort((e,t)=>e-t);if(n.length===0)return;let r=Math.floor(n.length/2);if(n.length%2==1)return n[r];let i=n[r-1],a=n[r];return i===void 0||a===void 0?void 0:Math.floor((i+a)/2)}resolveEstimatedDuration(e){let t=this.medianDuration(e);if(t!==void 0)return t;let n=this.history(e);return this.pruneHistory(n),n.latestCompleted?.durationMs}history(e){let t=tn(e),n=this.histories[t];if(n)return n;let r={durations:{}};return this.histories[t]=r,r}pruneAll(){for(let e of Object.values(this.histories))this.pruneHistory(e);this.persist()}pruneHistory(e){let t=this.now().valueOf()-Xt;for(let[n,r]of Object.entries(e.durations)){let i=X(r.sourceUpdatedAt);(i===void 0||i<t)&&delete e.durations[n]}let n=e.latestCompleted?X(e.latestCompleted.sourceUpdatedAt):void 0;e.latestCompleted&&(n===void 0||n<t)&&delete e.latestCompleted}read(){let e=ge(this.storage,Jt);return e?.schemaVersion!==Yt||!e.histories?{}:nn(e.histories)?e.histories:{}}persist(){_e(this.storage,Jt,{schemaVersion:Yt,histories:this.histories})}};function Qt(e){return e.sourceRunId??e.link??e.sourceUpdatedAt}function $t(e,t){let n=X(e),r=X(t);return n!==void 0&&(r===void 0||n>=r)}function X(e){let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function en(e,t){return{board:e,panelId:t.id,source:t.source??``,workflow:typeof t.pipeline==`string`||typeof t.pipeline==`number`?String(t.pipeline):``,branch:t.branch??``}}function tn(e){return JSON.stringify([e.board,e.panelId,e.source,e.workflow,e.branch])}function nn(e){return Z(e)?Object.values(e).every(rn):!1}function rn(e){return!Z(e)||!Z(e.durations)||!Object.values(e.durations).every(an)?!1:e.latestCompleted===void 0||an(e.latestCompleted)}function an(e){return Z(e)?(typeof e.link==`string`||e.link===null)&&(e.sourceRunId===void 0||typeof e.sourceRunId==`string`)&&typeof e.durationMs==`number`&&Number.isInteger(e.durationMs)&&e.durationMs>=0&&typeof e.sourceUpdatedAt==`string`&&X(e.sourceUpdatedAt)!==void 0:!1}function Z(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function on(e){let t=sn(e.envelope);if(!t)return{kind:`not-pipeline`,envelope:e.envelope};if(e.accepted&&t.sourceUpdatedAt&&Date.parse(t.sourceUpdatedAt)<Date.parse(e.accepted.sourceUpdatedAt))return e.envelope.state!==`ok`||!t.sourceUpdatedAt?{kind:`not-pipeline`,envelope:e.envelope}:{kind:`rejected`,envelope:e.envelope,signal:{...t,sourceUpdatedAt:t.sourceUpdatedAt}};let n=t.sourceUpdatedAt?{sourceUpdatedAt:t.sourceUpdatedAt,status:t.status,link:e.envelope.link}:void 0,r=t.status!==`running`&&t.durationMs!==void 0&&t.sourceUpdatedAt&&Number.isFinite(Date.parse(t.sourceUpdatedAt))?{link:e.envelope.link,...t.sourceRunId?{sourceRunId:t.sourceRunId}:{},durationMs:t.durationMs,sourceUpdatedAt:t.sourceUpdatedAt}:void 0;return{kind:`accepted`,envelope:t.status===`running`&&e.estimatedDurationMs!==void 0&&e.envelope.state===`ok`?{...e.envelope,signal:{...t,estimatedDurationMs:e.estimatedDurationMs}}:e.envelope,signal:t,accepted:n,durationSample:r}}function sn(e){if(e.state!==`ok`)return;let t=E.safeParse(e.signal);return t.success?t.data:void 0}function cn(e,t,n){let r=ln(e);if(!r)return n.refreshMillis;let i=un(r);return i===void 0?n.runningRefreshMillis:t<i?Math.min(n.runningRefreshMillis,i-t):t<i+n.runningCompletionWindowMillis?n.runningCompletionRefreshMillis:n.runningRefreshMillis}function ln(e){if(e?.state!==`ok`)return;let t=E.safeParse(e.signal);return t.success&&t.data.status===`running`?t.data:void 0}function un(e){if(!e.runStartedAt||e.estimatedDurationMs===void 0)return;let t=Date.parse(e.runStartedAt);return Number.isFinite(t)?t+e.estimatedDurationMs:void 0}function dn({board:e,env:t,diagnostics:r,memory:o}){let[s,c]=a({}),l=i({}),u=i(null);return u.current||=o??new Zt,n(()=>{if(l.current={},c({}),!e)return;let n=!1,i=new Set;for(let a of e.panels){if(D(a.position)||a.type!==`pipeline-status`&&a.type!==`pull-request-health`&&a.type!==`http-value`)continue;let o=!1,s=u.current;if(!s)return;let d=fe(e,a),f=`${t.proxyPath}/panel/${encodeURIComponent(t.board)}/${encodeURIComponent(a.id)}`,p,m=()=>{n||o||(o=!0,r.record({kind:`panel-fetch-start`,panelId:a.id,path:f}),fetch(f).then(async e=>{let t={kind:`panel-fetch-response`,panelId:a.id,path:f,status:e.status,cache:Te(e.headers)};if(e.status===304){r.record(t);return}try{let n=pn(await e.json());if(!n){r.record(t),r.record({kind:`panel-fetch-parse-failure`,panelId:a.id,path:f,message:`Response was not a valid signal envelope.`});return}return r.record({...t,envelope:n}),{envelope:n,cache:t.cache,status:e.status}}catch(e){throw r.record(t),r.record({kind:`panel-fetch-parse-failure`,panelId:a.id,path:f,message:Q(e)}),new fn(e)}}).then(e=>{if(!e)return;let i=e.envelope;if(a.type===`pipeline-status`){let n=en(t.board,a),o=s.latest(n),c=on({envelope:i,accepted:o,estimatedDurationMs:s.resolveEstimatedDuration(n)});if(c.kind===`rejected`&&o){let t=c.signal;r.recordGithubConsistencyIncident({panelId:a.id,endpoint:f,identity:{source:n.source,workflow:n.workflow,branch:n.branch},accepted:o,regressed:{sourceUpdatedAt:t.sourceUpdatedAt,status:t.status,link:i.link},response:{httpStatus:e.status,date:e.cache?.date,etag:e.cache?.etag,cacheControl:e.cache?.cacheControl}});return}if(c.kind===`accepted`&&(i=c.envelope,c.accepted&&s.rememberLatest(n,c.accepted),c.durationSample)){let e={link:c.durationSample.link,...c.durationSample.sourceRunId?{sourceRunId:c.durationSample.sourceRunId}:{},durationMs:c.durationSample.durationMs,sourceUpdatedAt:c.durationSample.sourceUpdatedAt};s.recordRun(n,e,c.signal.status===`passed`)}}if(p=i,!n){let e=l.current[a.id];qt(e,a,i)&&r.record({kind:`panel-rendered`,panelId:a.id,path:f,rendered:Y(a,i)}),l.current={...l.current,[a.id]:i},c(l.current)}}).catch(e=>{e instanceof fn||r.record({kind:`panel-fetch-failure`,panelId:a.id,path:f,message:Q(e)})}).finally(()=>{if(o=!1,!n){let e=window.setTimeout(()=>{i.delete(e),m()},cn(p,Date.now(),d));i.add(e)}}))};m()}return()=>{n=!0;for(let e of i)window.clearTimeout(e)}},[e,r,t.board,t.proxyPath]),s}function Q(e){return e instanceof Error?e.message:String(e)}var fn=class extends Error{constructor(e){super(Q(e))}};function pn(e){let t=ne.safeParse(e);return t.success?t.data:void 0}function mn({env:e}){let[t,o]=a(),[s,c]=a(),d=i(null);d.current||=new Ce(e);let f=d.current;Kt({env:e,diagnostics:f});let p=dn({board:s===e.board?t:void 0,env:e,diagnostics:f}),m=r(()=>t?le(t.panels):void 0,[t]);return n(()=>{!m||m.issues.length===0||f.record({kind:`layout-analyzed`,issueCount:m.issues.length,affectedPanelIds:m.issues.map(e=>e.panelId)})},[f,m]),n(()=>{let t=!1;o(void 0),c(void 0);let n=`${e.proxyPath}/boards/${encodeURIComponent(e.board)}`;return f.record({kind:`board-fetch-start`,path:n}),fetch(n).then(async e=>{if(f.record({kind:`board-fetch-response`,path:n,status:e.status,cache:Te(e.headers)}),!e.ok)throw Error(`Board configuration returned ${e.status}`);try{return await e.json()}catch(e){throw f.record({kind:`board-fetch-parse-failure`,path:n,message:$(e)}),new gn(e)}}).then(r=>{if(!t){o(r),c(e.board);let t=Array.isArray(r.panels)?r.panels:[];f.record({kind:`board-fetch-response`,path:n,boardSummary:{panelCount:t.length,panelIds:t.flatMap(e=>typeof e.id==`string`?[e.id]:[])}})}}).catch(r=>{r instanceof gn||f.record({kind:`board-fetch-failure`,path:n,message:$(r)}),t||(o({panels:[]}),c(e.board))}),()=>{t=!0}},[f,e.board,e.proxyPath]),u(`div`,{className:k.board,children:[l(`header`,{className:k.header,children:l(`h1`,{className:k.title,children:e.board})}),u(`main`,{className:k.grid,children:[!t&&l(ke,{label:`board`,hint:`Loading configuration…`,wide:!0}),t?.panels.filter(e=>!D(e.position)).map(e=>l(Ht,{panel:e,envelope:p[e.id]},e.id))]}),u(`footer`,{className:k.footer,"data-board-footer":!0,children:[l(`span`,{children:`Signals are read live from their configured authorities.`}),u(`div`,{className:k.footerTools,children:[m&&m.issues.length>0&&l(hn,{board:e.board,layout:m,proxyPath:e.proxyPath}),l(pe,{log:f})]})]})]})}function hn({board:e,layout:t,proxyPath:r}){let[i,o]=a(!1),s=`layout-warning-${e}`;n(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&o(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]);let c=`${r}/boards/${encodeURIComponent(e)}`;return u(`div`,{className:k.layoutWarning,"data-layout-warning":!0,children:[u(`button`,{className:k.layoutWarningButton,type:`button`,"aria-label":`Layout warnings (${t.issues.length})`,"aria-expanded":i,"aria-controls":s,onClick:()=>o(!i),children:[l(`span`,{"aria-hidden":`true`,children:`⚠`}),l(`span`,{children:t.issues.length})]}),i&&u(`aside`,{className:k.layoutWarningDialog,id:s,role:`dialog`,"aria-labelledby":`${s}-title`,"aria-modal":`false`,children:[u(`div`,{className:k.layoutWarningHeading,children:[l(`strong`,{id:`${s}-title`,children:`Layout warnings`}),l(`button`,{className:k.layoutWarningClose,type:`button`,"aria-label":`Close layout warnings`,onClick:()=>o(!1),children:`×`})]}),u(`p`,{children:[t.issues.length,` layout issue`,t.issues.length===1?``:`s`,` detected against the intended 12×12 space. The live board is unchanged: explicit overlaps remain overlapped and overflow continues in implicit rows.`]}),l(`ul`,{children:t.issues.map(e=>u(`li`,{children:[l(`strong`,{children:e.panelId}),`: `,e.kind,` at (`,e.position.x,`,`,` `,e.position.y,`), `,e.position.w,`×`,e.position.h,e.conflictsWith.length?`; overlaps ${e.conflictsWith.join(`, `)}`:``]},`${e.panelId}-${e.kind}`))}),u(`div`,{className:k.layoutWarningDownloads,children:[l(`a`,{href:`${c}/rendered`,download:`${e}-layout-rendered.yaml`,children:`Download legal rendered layout`}),l(`a`,{href:`${c}/authored`,download:`${e}-layout-authored.yaml`,children:`Download authored layout`})]}),l(`p`,{className:k.layoutWarningNote,children:`The legal rendered layout normalizes the currently visible explicit area into 12×12 and makes the smallest deterministic adjustments needed to avoid collisions. The authored layout preserves the original coordinates exactly.`})]})]})}function $(e){return e instanceof Error?e.message:String(e)}var gn=class extends Error{constructor(e){super($(e))}},_n={error:`_error_yx1g9_1`};function vn({message:e}){return u(`div`,{className:_n.error,role:`alert`,children:[l(`h1`,{children:`⚠️ Dashboard misconfigured`}),l(`p`,{children:`The page loaded, but the server did not hand it usable configuration.`}),l(`pre`,{children:e})]})}var yn=document.getElementById(`root`);if(!yn)throw Error(`No #root element in the document — the template is not the one we expect.`);var bn=s(yn);try{bn.render(l(t,{children:l(mn,{env:C()})}))}catch(e){bn.render(l(vn,{message:e instanceof Error?e.message:String(e)}))}
3
+ //# sourceMappingURL=index-BbX6XSjb.js.map