@fnndsc/argus 0.36.1 → 0.36.2
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/dist/assets/{Settings-A7vhfgBK.js → Settings-CjuexnjE.js} +1 -1
- package/dist/assets/{Texture-B8Mgy1jG.js → Texture-Duh0dhiO.js} +1 -1
- package/dist/assets/{addVolumesToViewports-D1bE5p72.js → addVolumesToViewports-Ag7_TU7w.js} +1 -1
- package/dist/assets/{cornerstoneEngine-DNzaUDtJ.js → cornerstoneEngine-5jvmInaS.js} +2 -2
- package/dist/assets/{field-DdpS2ZMe.js → field-Ck7DlgPH.js} +3 -3
- package/dist/assets/{index-gWWEWtwB.js → index-8M55X85c.js} +6 -6
- package/dist/assets/{index-BbGYkteM.js → index-BECytOhA.js} +1 -1
- package/dist/assets/{index-dGVJsBMY.js → index-BY_XE5Hd.js} +1 -1
- package/dist/assets/{index-DRBnUgKm.js → index-BawsmiRX.js} +1 -1
- package/dist/assets/{index-D3dCe7LD.js → index-Biz8SPO_.js} +1 -1
- package/dist/assets/{index-VBmUKyUD.js → index-CFIL-N-8.js} +1 -1
- package/dist/assets/{index-LEWZdG_U.js → index-CwMvWN2j.js} +1 -1
- package/dist/assets/{index-B7EHEh7k.css → index-D-XgI4Ms.css} +1 -1
- package/dist/assets/{index-Bsy9DxJH.js → index-DGbBo5LB.js} +1 -1
- package/dist/assets/{index-pAuMqQ01.js → index-DN8-T-rp.js} +1 -1
- package/dist/assets/{index-BI058Ouv.js → index-E2p2qvzU.js} +1 -1
- package/dist/assets/{index-Bvd09h5g.js → index-WGKyetro.js} +1 -1
- package/dist/assets/{index-Daiya7S4.js → index-p3AX9IUn.js} +1 -1
- package/dist/assets/{index-BCLsq2VQ.js → index-tPOE0rNQ.js} +1 -1
- package/dist/assets/{index-BLbB6UPM.js → index-xs7E9h9L.js} +1 -1
- package/dist/assets/{niivueEngine-B8R-ZtUa.js → niivueEngine-D4X_lKvS.js} +2 -2
- package/dist/assets/{slabScene-Cm89oPiO.js → slabScene-C46_anjU.js} +1 -1
- package/dist/build.json +1 -1
- package/dist/index.html +2 -2
- package/dist/notes.json +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-5jvmInaS.js","./refusal-DOpm8I8L.js","./_commonjsHelpers-CE1G-McA.js","./niivueEngine-D4X_lKvS.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();const bS=450,Ug=12;function vo(s,e,t=Date.now()){const i=Number(s.dataset.edgeAt??0);return s.dataset.edge===e&&t-i<bS?!1:(delete s.dataset.edge,s.offsetWidth,s.dataset.edge=e,s.dataset.edgeAt=String(t),!0)}function MS(s,e){return e?"▲ TOP":`▼ ${s} MORE`}function vS(s,e){const t=s.getBoundingClientRect().bottom;let i=0;for(const n of s.querySelectorAll(e)){const r=n.getBoundingClientRect();r.height>0&&r.top>=t-2&&(i+=1)}return i}function wS(s){const e=parseFloat(getComputedStyle(s).lineHeight)||16;return Math.max(0,Math.ceil((s.scrollHeight-s.scrollTop-s.clientHeight)/e))}function mi(s,e={}){s.dataset.more="wired",s.classList.add("holds-more");const t=document.createElement("button");t.type="button",t.className=`more-chip${e.className!==void 0?` ${e.className}`:""}`,t.hidden=!0;const i=e.label??MS,n=()=>s.scrollTop+s.clientHeight>=s.scrollHeight-2;t.addEventListener("click",l=>{if(l.stopPropagation(),e.press!==void 0){e.press();return}s.scrollBy({top:n()?-s.scrollHeight:Math.max(1,s.clientHeight-t.offsetHeight),behavior:"smooth"})});const r=e.mount??s;r.appendChild(t);let o=!1;const a=()=>{if(!o){o=!0;try{r===s&&s.lastElementChild!==t&&s.appendChild(t);const l=(e.scrolls?.()??!0)&&s.scrollHeight>s.clientHeight+2;if(t.hidden!==!l&&(t.hidden=!l),!l)return;const c=e.rows!==void 0?vS(s,e.rows):wS(s),h=i(c,n());t.textContent!==h&&(t.textContent=h)}finally{o=!1}}};return s.addEventListener("scroll",a,{passive:!0}),yS(s,n),typeof ResizeObserver<"u"&&new ResizeObserver(a).observe(s),new MutationObserver(a).observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","style"]}),a(),t}function yS(s,e){const t=()=>s.scrollHeight>s.clientHeight+2,i=()=>s.scrollTop<=0;let n=s.scrollTop;s.addEventListener("scrollend",()=>{const o=s.scrollTop!==n;n=s.scrollTop,!(!o||!t())&&(i()?vo(s,"top"):e()&&vo(s,"bottom"))}),s.addEventListener("wheel",o=>{!t()||o.deltaY===0||(o.deltaY<0&&i()?vo(s,"top"):o.deltaY>0&&e()&&vo(s,"bottom"))},{passive:!0});let r=null;s.addEventListener("touchstart",o=>{r=o.touches[0]?.clientY??null},{passive:!0}),s.addEventListener("touchmove",o=>{const a=o.touches[0]?.clientY;r===null||a===void 0||!t()||(a-r>Ug&&i()?(vo(s,"top"),r=null):r-a>Ug&&e()&&(vo(s,"bottom"),r=null))},{passive:!0}),s.addEventListener("animationend",o=>{o.target===s&&o.animationName.startsWith("edge-flare")&&delete s.dataset.edge})}function st(s){const e=document.getElementById(s);if(e===null)throw new Error(`required element #${s} is missing`);return e}function Pi(s){const e=st(s);if(!(e instanceof HTMLTemplateElement))throw new Error(`#${s} is not a template`);const t=e.content.firstElementChild;if(!(t instanceof HTMLElement))throw new Error(`template #${s} is empty`);return t.cloneNode(!0)}function Vs(s,e){const t=s.querySelector(e);if(t===null)throw new Error(`pane template is missing ${e}`);return t}const uv=24,sf="argus.dormant";class zS{constructor(e=uv,t){this.cap=e,this.store=t,this.rehydrate()}cap;store;groups=new Map;add(e){for(this.groups.delete(e.id),this.groups.set(e.id,e);this.groups.size>this.cap;){const t=this.oldest_id();if(t===void 0)break;this.groups.delete(t)}this.persist()}list(){return[...this.groups.values()].sort((e,t)=>t.lastTouched-e.lastTouched)}get(e){return this.groups.get(e)}has(e){return this.groups.has(e)}dismiss(e){const t=this.groups.delete(e);return t&&this.persist(),t}oldest_id(){let e;for(const t of this.groups.values())(e===void 0||t.lastTouched<e.lastTouched)&&(e=t);return e?.id}persist(){if(this.store!==void 0)try{this.store.setItem(sf,JSON.stringify([...this.groups.values()]))}catch{}}rehydrate(){if(this.store!==void 0)try{const e=this.store.getItem(sf);if(e===null)return;const t=JSON.parse(e);if(!Array.isArray(t))return;for(const i of t)i!==null&&typeof i=="object"&&typeof i.id=="string"&&this.groups.set(i.id,i)}catch{}}}function fv(){try{const s=globalThis.localStorage;return s===void 0?void 0:(s.getItem(sf),s)}catch{return}}function SS(s){if(!s.startsWith("#/"))return null;let e;try{e=decodeURI(s.slice(1))}catch{return null}e=e.replace(/\/+$/,"")||"/";const t=e.split("/").filter(o=>o!==""),i=t[t.length-1]??"";return!t.includes("data")&&(/^feed_\d+$/.test(i)||/^[\w.-]+_\d+$/.test(i)&&t.some(o=>/^feed_\d+$/.test(o)))?{kind:"runs",target:i}:{kind:"folder",path:/\.[A-Za-z0-9]{1,8}$/.test(i)&&!/_\d+$/.test(i)?`/${t.slice(0,-1).join("/")}`:e}}function pv(s,e){return`${s.replace(/\/+$/,"")}/#${encodeURI(e)}`}const xS=2500;function mv(s){const e=document.createElement("div");e.className="link-line";const t=document.createElement("button");t.type="button",t.className="link-pill",t.textContent="LINK";const i=document.createElement("span");i.className="link-address",e.append(t,i),wm(e,s);const n=r=>{r.stopPropagation(),gv(e)};return t.addEventListener("click",n),i.addEventListener("click",n),e}function wm(s,e){const t=pv(window.location.origin,e),i=s.querySelector(".link-address");i!==null&&i.textContent!==t&&(i.textContent=t),s.dataset.link=t,s.title=`a link that opens ARGUS at ${e} — press to copy`}async function gv(s,e=navigator.clipboard){const t=s.dataset.link??"",i=s.querySelector(".link-pill");let n=!1;try{if(e===void 0)throw new Error("no clipboard");await e.writeText(t),n=!0}catch{const o=s.querySelector(".link-address"),a=window.getSelection();if(o!==null&&a!==null){const l=document.createRange();l.selectNodeContents(o),a.removeAllRanges(),a.addRange(l)}}s.dataset.copied=n?"yes":"no",i!==null&&(i.textContent=n?"COPIED":"SELECT + COPY");const r=Date.now();return s.dataset.shown=String(r),setTimeout(()=>{s.dataset.shown===String(r)&&(delete s.dataset.copied,i!==null&&(i.textContent="LINK"))},xS),n}const OS="desktop clear";function _v(s){const e=s.split(`
|
|
3
3
|
`).map(t=>t.trim()).filter(t=>t!==""&&!t.startsWith("#"));return["# ARGUS view: run these lines in the ARGUS console to see what I see",OS,...e].join(`
|
|
4
4
|
`)}const $g=2500;function ES(s,e=navigator.clipboard){document.querySelector(".share-sheet")?.remove();const t=document.createElement("div");t.className="share-sheet",t.setAttribute("role","dialog"),t.setAttribute("aria-label","share this view");const i=document.createElement("div");i.className="share-head",i.textContent="SHARE VIEW · THESE LINES, OR THE LINK, PUT ANYONE WHERE YOU ARE";const n=document.createElement("pre");n.className="share-script",n.textContent=s;const r=document.createElement("button");r.type="button",r.className="share-copy share-lines",r.textContent="COPY";const o=document.createElement("button");o.type="button",o.className="share-copy share-link",o.textContent="COPY LINK";const a=document.createElement("button");a.type="button",a.className="share-close",a.textContent="CLOSE";const l=document.createElement("div");l.className="share-pills",l.append(o,r,a),t.append(i,n,l),document.body.appendChild(t),mi(n,{mount:t});let c=0;const h=async()=>{let d=!1;try{if(e===void 0)throw new Error("no clipboard");await e.writeText(s),d=!0}catch{const p=window.getSelection();if(p!==null){const f=document.createRange();f.selectNodeContents(n),p.removeAllRanges(),p.addRange(f)}}t.dataset.copied=d?"yes":"no",r.textContent=d?"COPIED":"SELECT + COPY";const u=++c;window.setTimeout(()=>{u===c&&(delete t.dataset.copied,r.textContent="COPY")},$g)};return r.addEventListener("click",()=>{h()}),o.addEventListener("click",()=>{const d=AS(window.location.origin,s);(e===void 0?Promise.reject(new Error("no clipboard")):e.writeText(d)).then(()=>{o.textContent="LINK COPIED"},()=>{n.textContent=d,o.textContent="LINK SHOWN: SELECT + COPY"}).finally(()=>{window.setTimeout(()=>{o.textContent="COPY LINK"},$g)})}),a.addEventListener("click",()=>t.remove()),t.addEventListener("keydown",d=>{d.key==="Escape"&&t.remove()}),h(),a.focus(),t}const nf="view=";function AS(s,e){return`${s.replace(/\/+$/,"")}/#${nf}${encodeURIComponent(e)}`}function DS(s){if(!s.startsWith(`#${nf}`))return null;try{const e=decodeURIComponent(s.slice(nf.length+1));return e.trim()===""?null:e}catch{return null}}function TS(s,e,t){document.querySelector(".share-sheet")?.remove();const i=document.createElement("div");i.className="share-sheet view-ask",i.setAttribute("role","dialog");const n=document.createElement("div");n.className="share-head",n.textContent=e.size>0?`A VIEW FROM ${t.toUpperCase()} · IT ASKS FOR MORE THAN A VIEW, SO IT WILL NOT RUN`:`A VIEW FROM ${t.toUpperCase()} · RUN THESE LINES?`;const r=document.createElement("pre");r.className="share-script",s.forEach((c,h)=>{const d=document.createElement("div");d.textContent=c;const u=e.get(h);u!==void 0&&(d.className="view-refused",d.textContent=`${c} ← ${u}`),r.appendChild(d)});const o=document.createElement("button");o.type="button",o.className="share-copy view-run",o.textContent="RUN",o.disabled=e.size>0;const a=document.createElement("button");a.type="button",a.className="share-close",a.textContent="NOT NOW";const l=document.createElement("div");return l.className="share-pills",l.append(o,a),i.append(n,r,l),document.body.appendChild(i),mi(r,{mount:i}),(e.size>0?a:o).focus(),new Promise(c=>{const h=d=>{i.remove(),c(d)};o.addEventListener("click",()=>h(!0)),a.addEventListener("click",()=>h(!1)),i.addEventListener("keydown",d=>{d.key==="Escape"&&h(!1)})})}class IS{constructor(e,t){this.host=t,this.grid=e.querySelector(".panes-grid"),this.empty=e.querySelector(".panes-empty"),this.grid.addEventListener("click",this.click_handle)}host;grid;empty;render(){const e=this.host.list();this.empty.hidden=e.length>0,this.grid.replaceChildren(...e.map(t=>this.card_build(t)))}card_build(e){const t=document.createElement("button");t.className="panes-card",t.dataset.restore=e.id,t.title=`restore ${e.label}`;const i=document.createElement("span");if(i.className="panes-card-figure",e.thumbnail!==void 0){const a=document.createElement("img");a.src=e.thumbnail,a.alt="",i.appendChild(a)}else i.classList.add("panes-card-glyph"),i.textContent=e.members.includes("files")&&!e.members.includes("viewer")?"▤":"▣";t.appendChild(i);const n=document.createElement("span");n.className="panes-card-label",n.textContent=e.label,t.appendChild(n);const r=document.createElement("span");r.className="panes-card-badges";for(const a of CS(e.members)){const l=document.createElement("span");l.className="panes-card-badge",l.textContent=a.toUpperCase(),r.appendChild(l)}t.appendChild(r);const o=document.createElement("button");return o.className="panes-card-dismiss",o.dataset.dismiss=e.id,o.title=`forget ${e.label}`,o.textContent="DISMISS",t.appendChild(o),t}click_handle=e=>{const t=e.target,i=t.closest("[data-dismiss]");if(i!==null){e.stopPropagation();const r=i.dataset.dismiss??"";this.host.dismiss(r),this.render();return}const n=t.closest("[data-restore]");n!==null&&this.host.restore(n.dataset.restore??"")}}function CS(s){return[...new Set(s)]}const RS="G1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswO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yOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsybSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzk7MTc7MjRtIBtbMG0bWzM4OzI7MjM7NDU7NjJtLhtbMG0bWzM4OzI7NDE7Nzk7MTA5bTobWzBtG1szODsyOzU5OzExMzsxNTVtPRtbMG0bWzM4OzI7NzU7MTQ0OzE5NW0rG1swbRtbMzg7Mjs3NjsxNDQ7MTkzbSsbWzBtG1szODsyOzE0OzI3OzM3bSAbWzBtG1szODsyOzc1OzE0MjsxODltKxtbMG0bWzM4OzI7Nzc7MTQ1OzE5Mm0rG1swbRtbMzg7Mjs2NzsxMjY7MTY1bT0bWzBtG1szODsyOzU1OzEwMjsxMzRtLRtbMG0bWzM4OzI7NDE7Nz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7MjI0bSobWzBtG1szODsyOzEwMTsxODM7MjI0bSobWzBtG1szODsyOzkzOzE2ODsyMDVtKxtbMG0bWzM4OzI7ODE7MTQ4OzE3OW0rG1swbRtbMzg7Mjs2ODsxMjM7MTQ4bT0bWzBtG1szODsyOzUxOzkzOzExMm0tG1swbRtbMzg7MjszNDs2MTs3M206G1swbRtbMzg7MjsyMjs0MDs0N20uG1swbRtbMzg7Mjs5OzE2OzE5bSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7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0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjsybSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbM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tIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtCg==",kS=/\x1b\[[0-9;]*m/g,jg="\x1B[0m",Hg="\x1B[7m",bv=atob(RS).trimEnd().split(`
|
|
@@ -4288,22 +4288,22 @@ void main() {
|
|
|
4288
4288
|
`),!1}return t.outcome_write(n),n.envelopes.length>0&&n.envelopes.every(r=>r.status==="ok")}function pG(s){for(const e of s.envelopes){if(e.model?.kind!=="fs.acl")continue;const t=e.model.data[0];return t===void 0?null:{users:t.usernames??[],groups:t.groups??[],public:t.public===!0}}return null}function mG(s,e){return s.split(`
|
|
4289
4289
|
`).map(t=>t.trim().split(":")).filter(t=>t.length>=4&&(t[3]??"").split(",").includes(e)).map(t=>t[0]??"").filter(t=>t!=="")}function gG(s){return/^(u|user|g|group|o|other):/.test(s)?s:`u:${s}:r`}function _G(s,e){return e.kind==="public"?`setfacl -m o::- feed_${s}`:`setfacl -x ${e.kind==="user"?"u":"g"}:${co(e.name)} feed_${s}`}function zc(s){return s.kind==="public"?"PUBLIC":s.kind==="group"?`group ${s.name}`:s.name}function bG(s,e){const t={silent:!0,observe:!1},i=async c=>{try{return pG(await s.client.line_execute(`getfacl feed_${c}`,t))}catch{return null}},n=async()=>{const c=e.promptUser();if(c===null)return[];try{const h=await s.client.line_execute("cat /etc/group",t);return mG(h.envelopes.map(d=>d.rendered).join(""),c)}catch{return[]}},r=async(c,h,d)=>{await e.ask_onPane(c,{kind:"confirm",message:`Stop sharing feed_${h} with ${zc(d)}? `})==="y"&&await ta(s,_G(h,d))&&e.changed(h)};return{holders_read:i,holders_build:(c,h,d)=>{const u=document.createElement("span");u.className="holder-marks";const p=[...d.users.map(f=>({kind:"user",name:f})),...d.groups.map(f=>({kind:"group",name:f})),...d.public?[{kind:"public"}]:[]];if(p.length===0)return u.textContent="SHARED WITH NOBODY",u;u.append("SHARED WITH ");for(const f of p){const _=document.createElement("span");_.className=`holder-mark holder-${f.kind}`,_.title=zc(f);const g=document.createElement("span");g.className="holder-mark-name",g.textContent=zc(f),_.append(g);const m=document.createElement("span");m.className="holder-mark-x",m.title=`stop sharing with ${zc(f)} (asks first)`,m.textContent="×",m.addEventListener("click",v=>{v.stopPropagation(),r(c,h,f)}),_.append(m),u.append(_)}return u},share_choose:async(c,h)=>{for(;;){const[d,u]=await Promise.all([i(h),n()]),p=d??{groups:[],public:!1},f=[{value:"o::r",label:"EVERYONE",held:p.public},...u.map(g=>({value:`g:${g}:r`,label:g,held:p.groups.includes(g)}))],_=(await e.ask_onPane(c,{kind:"choose",message:`Share feed_${h} with a group, everyone, or a user: `,choices:f,commit:"SHARE",close:"DONE"})??"").trim();if(_===""||!await ta(s,`setfacl -m ${gG(_)} feed_${h}`))return;e.changed(h)}},rename:async(c,h,d)=>{const u=(await e.ask_onPane(c,{kind:"text",message:`Rename feed_${h} to: `,suggest:d,commit:"RENAME"})??"").trim();u===""||u===d||await ta(s,Uy(`/proc/jobs/feed_${h}/title`,u))&&e.changed(h)}}}function MG(s){for(const e of s.envelopes){if(e.model?.kind!=="fs.listing")continue;return(e.model.data[0]?.items??[]).map(i=>String(i.name??"")).filter(i=>i!=="")}return[]}function vG(s,e,t){const i=`setfattr -n tag -v ${co(e)} feed_${s}`;return t.includes(e)?[i]:[`mkdir ${co(`/proc/tags/${e}`)}`,i]}function wG(s,e){const t=async()=>{try{return MG(await s.client.line_execute("ls /proc/tags",{silent:!0,observe:!1}))}catch{return[]}};return{tag_choose:async(r,o,a)=>{const l=new Set(a);for(;;){const c=await t(),h=c.map(_=>({value:_,held:l.has(_)})),d=c.filter(_=>!l.has(_)).join(", "),p=(await e.ask_onPane(r,{kind:"choose",message:`Tag feed_${o}${d===""?"":` (${d})`}, or a new tag: `,choices:h,commit:"TAG",close:"DONE"})??"").trim();if(p===""||p.includes("/"))return;if(l.has(p))continue;let f=!0;for(const _ of vG(o,p,c))if(f=await ta(s,_),!f)break;if(!f)return;l.add(p),e.tags_changed(o)}},tag_remove:async(r,o)=>{const a=await ta(s,`setfattr -x tag -v ${co(o)} feed_${r}`);return a&&e.tags_changed(r),a}}}function yG(s,e){return{tags:wG(s,{ask_onPane:e.ask_onPane,tags_changed:e.changed}),access:bG(s,e)}}function zG(s){for(const e of s.envelopes){if(e.model?.kind!=="fs.xattr")continue;return e.model.data[0]?.tags??[]}return[]}function jy(s,e,t){const{panels:i,subjects:n}=s,{tags:r,access:o}=t;return{feed_verbs:a=>{const l={feedId:a.id},c={note:()=>s.terminal.line_run(`edit /proc/jobs/feed_${a.id}/note`),tag:()=>{r.tag_choose(e,a.id,a.tags??[])},rename:()=>{o.rename(e,a.id,a.title)},share:()=>{o.share_choose(e,a.id)},delete:()=>s.terminal.line_run(`feed rm feed_${a.id}`)};return Ow.rules.filter(h=>h.offered(l)).map(h=>({label:h.label(l),run:()=>c[h.name]?.()}))},feed_indicated:a=>{n.regard_write(e,{address:`/proc/jobs/feed_${a.id}`,modelKind:"feed"}),o.holders_read(a.id).then(l=>{i.get("dag",e)?.rowReadout_show(a.id,l===null?"ACCESS UNREAD":o.holders_build(e,a.id,l))})},feed_untag:(a,l)=>{r.tag_remove(a,l)},feed_entered:a=>{const l={silent:!0,observe:!1},c=h=>h!==null&&h.envelopes.every(d=>d.status==="ok")?h.envelopes.map(d=>d.rendered).join("").replace(/\x1b\[[0-9;]*m/g,""):null;Promise.all([s.client.line_execute(`cat /proc/jobs/feed_${a}/note`,l).catch(()=>null),s.client.line_execute(`getfattr feed_${a}`,l).catch(()=>null),s.client.line_execute(`cat /proc/jobs/feed_${a}/title`,l).catch(()=>null)]).then(([h,d,u])=>{(i.get("dag",e)??i.get("universe",e))?.feedMarks_show(a,{note:c(h),tags:d===null?[]:zG(d),title:(c(u)??"").trim()})})},feed_note:a=>s.terminal.line_run(`edit /proc/jobs/feed_${a}/note`),feed_tag:(a,l)=>{r.tag_choose(e,a,l)},feed_rename:(a,l)=>{o.rename(e,a,l)}}}const SG=256*1024*1024;function xG(s,e){const t=e.split("/").filter(o=>o.length>0).pop()??"download";if(s===null)return t;const i=/filename\*\s*=\s*UTF-8''([^;]+)/i.exec(s);if(i!==null)try{const o=decodeURIComponent((i[1]??"").trim());if(o.length>0)return o}catch{}const r=/filename\s*=\s*"([^"]*)"/i.exec(s)?.[1]??"";return r.length>0?r:t}function D0(s){return s.redirected?"the session asked to log in again — nothing was saved":s.status===410?"cancelled — nothing was saved":s.ok?s.headers.get("content-disposition")===null?"the session answered with something other than the file — nothing was saved":null:s.status===404?"the session could not read that file — nothing was saved":`the session refused the file (HTTP ${s.status}) — nothing was saved`}function T0(s,e){const t=document.createElement("a");t.href=s,t.download=e,t.rel="noopener",document.body.append(t),t.click(),t.remove()}function Hy(){return`dl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}async function OG(s,e,t=fetch,i=Hy()){const n=`${s}&dl=${encodeURIComponent(i)}`;let r;try{r=await t(`${n}&probe=1`,{method:"HEAD",credentials:"same-origin"})}catch(p){return{ok:!1,reason:`the session did not answer (${p instanceof Error?p.message:String(p)}) — nothing was saved`}}const o=D0(r);if(o!==null)return{ok:!1,reason:o};const a=xG(r.headers.get("content-disposition"),e),l=Number(r.headers.get("content-length")??NaN);if(!Number.isFinite(l)||l>SG)return T0(n,a),{ok:!0,name:a,bytes:Number.isFinite(l)?l:null,streamed:!0};let c;try{c=await t(n,{credentials:"same-origin"})}catch(p){return{ok:!1,reason:`the session did not answer (${p instanceof Error?p.message:String(p)}) — nothing was saved`}}const h=D0(c);if(h!==null)return{ok:!1,reason:h};const d=await c.blob(),u=URL.createObjectURL(d);return T0(u,a),setTimeout(()=>URL.revokeObjectURL(u),6e4),{ok:!0,name:a,bytes:d.size,streamed:!1}}const EG=1e3,AG=5e3,DG=3,TG=2e4;function Ua(s){const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1e3&&i<e.length-1;)t/=1e3,i+=1;return`${i===0?t.toFixed(0):t.toFixed(1)} ${e[i]}`}function Sc(s){const e=Math.max(0,Math.round(s/1e3)),t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=String(e%60).padStart(2,"0");return t>0?`${t}:${String(i).padStart(2,"0")}:${n}`:`${i}:${n}`}function IG(s,e){switch(s.phase){case"opening":return`WAITING FOR CUBE · ${Sc(s.elapsedMs)}`;case"ready":return"CUBE ANSWERED · HANDING TO THE BROWSER";case"streaming":{if(s.bytes===0)return`WAITING FOR CUBE'S FIRST BYTE · ${Sc(s.elapsedMs)}`;const t=[s.size!==void 0?`${Ua(s.bytes)} OF ${Ua(s.size)}`:Ua(s.bytes)];return s.size!==void 0&&s.size>0&&t.push(`${Math.floor(100*s.bytes/s.size)}%`),e!==null&&e>0&&(t.push(`${Ua(e)}/S`),s.size!==void 0&&t.push(`${Sc(1e3*(s.size-s.bytes)/e)} LEFT`)),t.join(" · ")}case"done":return`DONE · ${Ua(s.bytes)} IN ${Sc(s.elapsedMs)}`;case"failed":return`FAILED · ${s.reason??"the session did not say why"}`;case"cancelled":return"CANCELLED"}}function I0(s){return s==="done"||s==="failed"||s==="cancelled"}function C0(s,e,t){const i=new URL(s,window.location.href),n=i.searchParams.get("token");return i.search="",i.searchParams.set(e,t),n!==null&&i.searchParams.set("token",n),i.toString()}function CG(){let s=document.querySelector(".transfer-stack");return s===null&&(s=document.createElement("div"),s.className="transfer-stack",s.setAttribute("role","status"),document.body.appendChild(s)),s}function RG(s,e,t,i=fetch){const n=document.createElement("div");n.className="transfer-row",n.dataset.download=t,n.dataset.phase="opening";const r=document.createElement("span");r.className="transfer-name",r.textContent=s,r.title=s;const o=document.createElement("span");o.className="transfer-bar";const a=document.createElement("span");a.className="transfer-fill",o.appendChild(a);const l=document.createElement("span");l.className="transfer-words",l.textContent="ASKING THE SESSION";const c=document.createElement("button");c.type="button",c.className="transfer-action",c.textContent="CANCEL",n.append(r,o,l,c),CG().appendChild(n);let h=null,d=null,u=!1,p=null;const f=[],_=()=>n.remove(),g=()=>{u=!0,h!==null&&clearTimeout(h),c.textContent="CLOSE",c.title="dismiss this row",d=setTimeout(_,TG)},m=O=>{const M=Date.now();for(f.push({at:M,bytes:O});f.length>1&&M-(f[0]?.at??M)>6e3;)f.shift();const S=f[0];return S===void 0||M-S.at<900?null:(O-S.bytes)*1e3/(M-S.at)};let v=!1,y=0;const b=O=>{n.dataset.phase=O.phase;const M=IG(O,O.phase==="streaming"?m(O.bytes):null);l.textContent=v&&!I0(O.phase)?`CANCELLING · ${M}`:M;const S=O.phase==="done"?1:O.size!==void 0&&O.size>0?O.bytes/O.size:0;a.style.width=`${(100*S).toFixed(1)}%`,I0(O.phase)&&g()},w=async O=>{const M=new AbortController,S=setTimeout(()=>M.abort(),AG);try{const D=await i(C0(e,O,t),{credentials:"same-origin",cache:"no-store",signal:M.signal});return D.ok?await D.json():"unknown"}catch{return null}finally{clearTimeout(S)}},z=async()=>{if(u)return;const O=await w("progress");if(!u){if(O===null)y+=1,y>=DG&&(l.textContent="LOST TOUCH WITH THE SESSION · STILL ASKING");else if(O==="unknown"){if(y=0,p??=Date.now(),Date.now()-p>5e3){n.dataset.phase="handed",l.textContent="HANDED TO THE BROWSER · SEE ITS DOWNLOADS",g();return}}else y=0,p=null,b(O);u||(h=setTimeout(()=>{z()},EG))}};return c.addEventListener("click",()=>{if(u){_();return}c.disabled=!0,v=!0,l.textContent="CANCELLING",w("cancel").then(O=>{c.disabled=!1,!u&&(O===null?(v=!1,l.textContent="THE CANCEL GOT NO ANSWER FROM THE SESSION · PRESS CANCEL AGAIN"):O==="unknown"?(v=!1,n.dataset.phase="handed",l.textContent="THE SESSION DOES NOT KNOW THIS DOWNLOAD · CANCEL IT IN THE BROWSER'S DOWNLOADS",g()):b(O))})}),z(),{element:n,show:b,fail:O=>{u||i(C0(e,"progress",t),{credentials:"same-origin",cache:"no-store"}).then(async M=>M.ok?await M.json():null).catch(()=>null).then(M=>{u||b(M!==null&&M.phase==="failed"?M:{phase:"failed",bytes:0,reason:O,elapsedMs:0})})},stop:()=>{u=!0,h!==null&&clearTimeout(h),d!==null&&clearTimeout(d)}}}const Vy=/\.(csv|tsv)$/i;function R0(s){return s.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}function qy(s){return yf.test(s)||yh.test(s)}function Ep(s){const e=/_(\d+)\/data\/?$/.exec(s);return e===null?null:parseInt(e[1]??"",10)}function ul(s){const e=s.match(/\/(?:feeds|jobs)\/feed_(\d+)(?:\/|$)/);return e===null?null:Number(e[1])}function kG(s){return/^\/(proc|net|etc|usr)(\/|$)/.test(s)}function BG(s){for(const e of s.envelopes){const t=e.model;if(typeof t!="object"||t===null)continue;const i=t.data;if(t.kind!=="fs.acl"||!Array.isArray(i))continue;const n=[];for(const r of i)Array.isArray(r.usernames)&&n.push(...r.usernames.map(String)),Array.isArray(r.groups)&&n.push(...r.groups.map(o=>`group ${String(o)}`)),r.public===!0&&n.push("PUBLIC");return n.length===0?"SHARED WITH NOBODY":`SHARED WITH ${n.join(", ")}`}return"ACCESS UNREAD"}function NG(s,e){const{panels:t,subjects:i}=s,n=new Map,r=new Map,o=new Map,a=S=>{const D=e.downloadUrl_build(S),T=Hy(),E=S.split("/").filter(C=>C.length>0).pop()??S,x=RG(E,D,T);s.terminal.line_note(`download: asking the session for ${E}`),OG(D,S,fetch,T).then(C=>{C.ok||x.fail(C.reason),s.terminal.line_note(C.ok?`download: ${C.name}${C.streamed?" — handed to the browser; its progress is on the transfer row":""}`:`download: ${S}: ${C.reason}`)})},l=S=>s.client.line_execute(`cat "${S}"`,{silent:!0,observe:!1}).then(D=>{if(!D.envelopes.some(x=>x.status==="error"))return{ok:!0,text:R0(D.envelopes.map(x=>x.rendered).join(`
|
|
4290
4290
|
`))};const E=D.envelopes.flatMap(x=>(x.errors??[]).map(C=>C.message)).concat(D.envelopes.map(x=>x.renderedErr??"")).map(x=>R0(x).trim()).filter(x=>x!=="").join(`
|
|
4291
|
-
`);return{ok:!1,text:E===""?"the session refused this read and said nothing further":E}}),c=async(S,D)=>{const T=await fetch(e.vfsUrl_build(S));if(!T.ok||T.body===null)return(await l(S)).text.slice(0,D);const E=T.body.getReader(),x=new TextDecoder;let C="";for(;C.length<D;){const{done:I,value:k}=await E.read();if(I)break;C+=x.decode(k,{stream:!0})}return E.cancel().catch(()=>{}),C.slice(0,D)},h=async S=>{const D=/_id(\d+)$/.exec(S)?.[1]??S.replace(/^.*\//,""),T=await s.client.line_execute(`pipeline diagram ${D}`,{silent:!0,observe:!1});for(const E of T.envelopes){if(E.model?.kind!==cr.pipelineDiagram)continue;const x=xm.safeParse(E.model.data);if(x.success)return x.data.nodes.map(C=>({id:C.id,parentIds:[...C.parentIds,...C.joinParentIds??[]]}))}return null},d={imageUrl:e.vfsUrl_build,download:a,textHead:c,pipelineGlimpse:h},u=(S,D,T)=>{const E=T==="~"?"ls ~":`ls "${T}"`;s.client.line_execute(E,{silent:!0,observe:!1}).then(x=>{for(const C of x.envelopes)D.envelope_observe(C);if(T!=="~"&&D.path_current()!==T.replace(/\/+$/,"")){const C=x.envelopes.find(k=>k.status==="error"),I=C!==void 0?dw(C):"the session answered no listing";D.listing_fail(I),s.terminal.line_note(`files: ${T}: ${I}`)}},x=>{const C=x instanceof Error?x.message:String(x);D.listing_fail(C),s.terminal.line_note(`files: ${T}: ${C}`)})},p=(S,D,T)=>{const E=D.path_current();E!==null&&n.get(S)?.push(E),u(S,D,T)},f=(S,D)=>{const T=n.get(S)?.pop();T!==void 0&&u(S,D,T)},_=S=>{o.get(S)?.()},g=(S,D)=>{r.set(S,D),_(S);const T=t.get("files",S);T?.follow_set(D),D&&T!==void 0&&s.client.line_execute("ls",{silent:!0,observe:!1}).then(E=>{for(const x of E.envelopes)T.envelope_observe(x)})},m=(S,D)=>{const T=t.get("files",S);T!==void 0&&(r.get(S)===!0?s.terminal.line_run("ls"):u(S,T,D))},v=(S,D)=>{e.ask_onPane(S,{message:`New directory in ${D}: `,kind:"text",commit:"MAKE IT"}).then(T=>{const E=(T??"").trim();E!==""&&(s.terminal.line_run(`mkdir "${D}/${E}"`),m(S,D))})},y=async(S,D,T)=>{for(const E of T){const x=`${D}/${E.name}`;s.terminal.line_note(`putting ${E.name} in ${D}…`);try{const C=await fetch(e.vfsUrl_build(x),{method:"POST",body:E});if(!C.ok){s.terminal.line_note(`upload: ${E.name}: ${(await C.text()).trim()||C.statusText}`);continue}s.terminal.line_note(`✓ ${x}`)}catch(C){s.terminal.line_note(`upload: ${E.name}: ${C instanceof Error?C.message:String(C)}`)}}m(S,D)},b=(S,D,T)=>{if(T.kind==="dir"){r.get(S)===!0?s.terminal.line_run(`cd "${T.path}"`):p(S,D,T.path);return}if(T.kind==="plugin"||T.kind==="pipeline"){e.binEntry_show(S,D,T.path,T.kind);return}if(qy(T.path)){e.image_open(S,T.path).then(E=>s.terminal.line_note(E));return}if(i.regard_write(S,{address:T.path,modelKind:"fs.file"}),!i.groupHasViewer(S)){if(id(T.path)){D.contentImage_show(T.path,e.vfsUrl_build(T.path));return}l(T.path).then(E=>{if(!E.ok){D.contentRefused_show(T.path,E.text);return}Vy.test(T.path)?D.contentTable_show(T.path,E.text):D.content_show(T.path,E.text)})}},w=()=>{const S=e.template_stamp("tpl-pane-files").querySelector(".files-body");if(S===null)throw new Error("tpl-pane-files has no files-body");return S},z=(S,D,T)=>{const E=`"${T}"`,x=D.type==="dir"||D.type==="vfs"||D.type==="job",C=ul(T),I={kind:D.type==="plugin"||D.type==="pipeline"?"catalogue":x&&Id(T,D.name)?"seriesFolder":D.type==="file"?"file":"directory",feed:C,node:C===null?null:Ep(T),bound:e.catalogue_of(S)!==void 0,projection:kG(T),editable:D.type==="file"&&y1(T)},k={image:()=>{e.image_open(S,T).then(N=>s.terminal.line_note(N))},download:()=>a(T),link:()=>{const N=pv(window.location.origin,T);(t.get("files",S)?.link_copy(T)??navigator.clipboard.writeText(N).then(()=>!0,()=>!1)).then(F=>s.terminal.line_note(F?`link copied: ${N}`:`link (copy it): ${N}`))},process:()=>e.process_open(S,{input:T,feed:C,node:C===null?null:Ep(T)}),gather:()=>e.cohort_gather([{kind:x?"dir":"file",seriesUID:T,description:D.name,imagery:Id(T,D.name),modality:Id(T,D.name)?"MR":"—",patient:e.promptUser()??"",vfsPath:T,folderPath:T}]),run:()=>e.run_press(S,D.name,D.type==="pipeline"?"pipeline":"plugin"),edit:()=>{const N=$y(T),P=fG(D.name,D.size,w1);if(P===null){e.verbLine_run(S,N);return}e.ask_onPane(S,{kind:"confirm",message:P}).then(F=>{F==="y"&&e.verbLine_run(S,N)})},move:()=>e.verbLine_run(S,`mv ${E}`),copy:()=>e.verbLine_run(S,`cp ${E}`),delete:()=>e.verbLine_run(S,`rm ${x?"-ri":"-i"} ${E}`),share:()=>e.verbLine_run(S,`setfacl ${E}`)};return Sw.rules.filter(N=>N.offered(I)).map(N=>({label:N.label(I),run:()=>k[N.name]?.()}))},O=(S,D)=>{const T=D.map(([k])=>k),E=T.map(k=>`"${k}"`).join(" "),x=[];for(const k of T){const N=ul(k);N!==null&&!x.includes(N)&&x.push(N)}const C={count:T.length,feeds:x},I={delete:()=>e.verbLine_run(S,`rm -rI ${E}`),move:()=>s.terminal.line_run(`mv -t ${E}`),copy:()=>s.terminal.line_run(`cp -t ${E}`),share:()=>s.terminal.line_run(`setfacl ${x.map(k=>`feed_${k}`).join(" ")}`)};return xw.rules.filter(k=>k.offered(C)).map(k=>({label:k.label(C),run:()=>I[k.name]?.()}))};return{previewProvider:d,fileText_fetch:l,file_save:a,rootedListing_show:u,listing_refresh:m,directory_make:v,files_deliver:y,follows:S=>r.get(S)===!0,follow_set:g,cwdBind_sync_register:(S,D)=>{o.set(S,D)},cwdBind_sync:_,rooted_walk:p,rooted_back:f,filesBody_stamp:w,rowVerbs_of:z,instance_build:(S,D,T=!1)=>{const E=e.template_stamp("tpl-pane-files"),x=new fw(e.pane_find(E,".files-panel"),I=>b(S,x,I),d,{catalogue:T});x.selectionVerbs_declare(I=>O(S,I)),x.rowVerbs_declare((I,k)=>z(S,I,k),(I,k)=>{i.regard_write(S,{address:k,modelKind:"fs.file"}),ul(k)!==null&&s.client.line_execute(`getfacl "${k}"`,{silent:!0,observe:!1}).then(N=>{x.rowReadout_show(k,BG(N))}).catch(()=>{x.rowReadout_show(k,"ACCESS UNREAD")})}),t.set("files",S,x);const C=e.promptUser();return C!==null&&C!==""&&x.home_set(`/home/${C}`),n.set(S,[]),r.set(S,D),_(S),x.follow_set(D),{id:S,kind:"files",mount:E,dispose:()=>{t.delete(S),n.delete(S),i.pane_leave(S)}}}}}function GG(s,e){const t=Pi("tpl-pane-universe"),i=new uG({canvas:Vs(t,".universe-canvas"),title:Vs(t,".universe-title"),state:t.querySelector(".pane-state"),empty:Vs(t,".universe-empty"),projectionPill:t.querySelector(".universe-projection"),refreshPill:t.querySelector(".universe-refresh"),replayPill:t.querySelector(".universe-replay"),scalePill:t.querySelector(".universe-scale"),viewPill:t.querySelector(".universe-view"),gravityPill:t.querySelector(".universe-gravity"),densityPill:t.querySelector(".universe-density"),drawPill:t.querySelector(".universe-draw"),captionsPill:t.querySelector(".universe-captions"),arrangementPill:t.querySelector(".universe-arrangement"),facts:t.querySelector(".universe-facts"),backPill:t.querySelector(".universe-back"),openPill:t.querySelector(".universe-open"),frame:t.querySelector(".mode-frame")},{watch_set:(n,r)=>{r?s.client().watch_send(n):s.client().unwatch_send(n)},...(({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l})=>({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l}))(jy(s.context(),e,s.feedVerbs())),command_run:n=>{s.client().line_execute(n,{silent:!0,observe:!1}).then(r=>{for(const o of r.envelopes)i.envelope_observe(o)})},feed_dag:async n=>{const r=await s.client().line_execute(`feed diagram feed_${n}`,{silent:!0,observe:!1});for(const o of r.envelopes){if(o.model?.kind!==cr.feedDag)continue;const a=Om.safeParse(o.model.data);if(a.success)return a.data}return null},node_enter:n=>{s.terminal().line_run(`cd "${n}"`)},node_dive:n=>{s.nodeOverlay_open(e,n.replace(/\/data$/,""))},node_process:n=>{const r=ul(n.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)[1])),o=s.promptUser()===null?n.vfsPath:n.vfsPath.replace(/^\/proc\/jobs\//,`/home/${s.promptUser()}/feeds/`);s.process_open(e,{input:o,feed:r,node:n.instanceId})},feed_open:n=>{s.runs_show(),s.dag_primary().feed_enter(n)},plugin_open:n=>{(async()=>{const r=await s.client().line_execute("ls /bin",{silent:!0,observe:!1}),o=[];for(const l of r.envelopes){if(l.model?.kind!=="fs.listing")continue;const c=l.model.data,h=Array.isArray(c)?c:[c];for(const d of h)for(const u of d.items??[])o.push(u.name)}const a=o.filter(l=>l.startsWith(`${n}-v`)).sort((l,c)=>l.localeCompare(c,void 0,{numeric:!0})).pop();if(a===void 0){s.terminal().line_note(`universe: ${n} is not in /bin`);return}st("gutter-files").click(),s.binEntry_show("files",s.panels().get("files","files"),`/bin/${a}`,"plugin")})().catch(r=>{s.terminal().line_note(`universe: could not open ${n} in /bin: ${r instanceof Error?r.message:String(r)}`)})},note:n=>s.terminal().line_note(n)},fv());return s.panels().set("universe",e,i),{id:e,kind:"universe",mount:t,dispose:()=>{s.panels().delete(e),s.subjects().pane_leave(e),i.dispose()}}}function PG(s,e,t){const i=Pi("tpl-pane-dag"),n=new WN(Vs(i,".dag-canvas"),Vs(i,".dag-title"),Vs(i,".dag-facts"),Vs(i,".dag-empty"),Vs(i,".dag-strategy"),Vs(i,".dag-feedlist"),{command_run:r=>{s.client().line_execute(r,{silent:!0,observe:!1}).then(o=>{for(const a of o.envelopes)n.envelope_observe(a)})},watch_set:(r,o)=>{o?s.client().watch_send(r):s.client().unwatch_send(r)},node_enter:r=>{s.terminal().line_run(`cd "${r}"`)},node_dive:r=>{s.nodeOverlay_open(e,r.replace(/\/data$/,""))},node_regard:r=>{s.subjects().regard_write(e,{address:r,modelKind:"feed.node"})},node_process:r=>{const o=ul(r.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)[1])),a=s.promptUser()===null?r.vfsPath:r.vfsPath.replace(/^\/proc\/jobs\//,`/home/${s.promptUser()}/feeds/`);s.process_open(e,{input:a,feed:o,node:r.instanceId})},feed_regard:r=>{s.subjects().regard_write(e,{address:r,modelKind:"feed"})},...jy(s.context(),e,s.feedVerbs()),...t?{feed_shown:()=>s.dag_summon()}:{}});return s.panels().set("dag",e,n),{id:e,kind:"dag",mount:i,dispose:()=>{s.nodeOverlay().dispose(e),s.panels().delete(e),s.subjects().pane_leave(e),n.dispose()}}}function LG(s){return{universe_build:e=>GG(s,e),dag_build:(e,t)=>PG(s,e,t)}}const Ky=new Set(["files"]);function WG(s){Ky.add(s)}function k0(s){return Ky.has(s)}const Yy=new Map,pa=new Map;let FG=0;function gn(s,e){Yy.set(s,e)}function UG(s){const e=Yy.get(s);if(e===void 0)throw new Error(`no pane factory registered for kind '${s}'`);const t=e(`${s}-${FG++}`);return pa.set(t.id,t),t}function xc(s){pa.set(s.id,s)}function Zc(s){return pa.get(s)}function Jc(){return[...pa.values()]}function Ds(s){const e=pa.get(s);e!==void 0&&(pa.delete(s),e.dispose?.(),e.mount.remove())}class $G{byId=new Map;set(e,t,i){this.byId.set(t,{kind:e,panel:i})}get(e,t){const i=this.byId.get(t);return i!==void 0&&i.kind===e?i.panel:void 0}has(e,t){return this.byId.get(t)?.kind===e}delete(e){return this.byId.delete(e)}ids(e){return this.entries(e).map(([t])=>t)}entries(e){const t=[];for(const[i,n]of this.byId)n.kind===e&&t.push([i,n.panel]);return t}values(e){return this.entries(e).map(([,t])=>t)}idOf(e,t){for(const[i,n]of this.byId)if(n.kind===e&&n.panel===t)return i;return null}}const jG="modulepreload",HG=function(s,e){return new URL(s,e).href},B0={},Ap=function(e,t,i){let n=Promise.resolve();if(t&&t.length>0){let c=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");n=c(t.map(h=>{if(h=HG(h,i),h in B0)return;B0[h]=!0;const d=h.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(i)for(let f=o.length-1;f>=0;f--){const _=o[f];if(_.href===h&&(!d||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":jG,d||(p.as="script"),p.crossOrigin="",p.href=h,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((f,_)=>{p.addEventListener("load",f),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})},VG=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function fg(s){const e=s instanceof Error?s.message:String(s??"");return VG.test(e)}const sa={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},qG=`${sa.before}${sa.refresh}${sa.after}`,Gh="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function KG(s,e=document.body){let t=!1;const i=()=>{if(t)return;t=!0,s(`argus: ${qG} (what failed to load was part of the old build)`);const n=document.createElement("div");n.className="stale-page",n.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const o=document.createElement("button");o.type="button",o.className="stale-page-reload",o.textContent=sa.refresh,o.title="load the argus the server has now",o.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(sa.before),o,document.createTextNode(sa.after)),n.append(r),e.appendChild(n)};window.addEventListener("vite:preloadError",()=>{i()}),window.addEventListener("unhandledrejection",n=>{fg(n.reason)&&i()})}const YG=[{label:"",tag:"PatientName"},{label:"MRN",tag:"PatientID"},{label:"ACC",tag:"AccessionNumber"},{label:"",tag:"StudyDescription"},{label:"",tag:"SeriesDescription"},{label:"",tag:"StudyDate"},{label:"",tag:"PatientAge"},{label:"",tag:"PatientSex"}],XG=256*1024*1024;function Oc(s){const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;return i===0?`${s} B`:`${t.toFixed(1)} ${e[i]}`}function ZG(s){const e=s.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class JG{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=XG;forced=!1;pendingLayout=null;progressNote=null;overlayNote=null;probeNote=null;overlay=!1;overlayLines=[];presetIndex=-1;toolPills=new Map;handlers;engine=null;series=null;siblings=[];colormap="gray";tool="wl";constructor(e,t){this.handlers=t,this.pane=e,this.field=ai(e,".image-field"),this.title=ai(e,".pane-title"),this.modeSpan=ai(e,".pane-mode"),this.stateSpan=ai(e,".pane-state");for(const i of e.querySelectorAll(".image-layout")){const n=i.dataset.layout??"single";this.layoutPills.set(n,i),i.addEventListener("click",()=>{this.layout_set(n)})}this.overlayPill=ai(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=ai(e,".image-colormap"),this.savePill=ai(e,".image-save"),this.loadPill=ai(e,".image-load"),this.retryPill=ai(e,".image-retry"),this.presetPill=ai(e,".image-preset"),this.focusMark=ai(e,".image-focus"),this.field.tabIndex=0,this.colormapPill.addEventListener("click",()=>{this.colormap_cycle()}),this.savePill.addEventListener("click",()=>{this.annotations_save()}),this.loadPill.addEventListener("click",()=>{this.load_press()}),this.retryPill.addEventListener("click",()=>{this.retry_press()}),this.presetPill.addEventListener("click",()=>this.preset_cycle()),ai(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const i of c_){const n=ai(e,`.image-tool[data-tool="${i}"]`);this.toolPills.set(i,n),n.addEventListener("click",()=>{this.tool_set(i)})}this.toolPills_paint(),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.field.contains(i.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",i=>{if(i.key==="Escape"){this.field_release(),i.stopPropagation();return}i.stopPropagation()})}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}async series_show(e,t={}){if(this.engine_dispose(),this.series=e,this.forced=t.force===!0,this.pendingLayout=null,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint(e.modality),this.siblings=t.siblings??[],this.pane.dataset.modality=ZG(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const o=this.siblings.findIndex(a=>a.path===e.path)+1;this.handlers.note(`image: series ${o} of ${this.siblings.length} in this study; image series <n> switches`)}const i=await this.chunk_import(()=>Ap(()=>import("./cornerstoneEngine-DNzaUDtJ.js").then(o=>o.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(i===null)return;const{CornerstoneEngine:n}=i,r=new n(this.engineHost_get(),e,t.startAt??1);await this.engine_open(r),this.engine===r&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Oc(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Oc(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):r.slices_fill(),await this.annotations_reload(r,e))}async annotations_reload(e,t){let i=0;for(const n of t.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=n.split("/").pop()??n;try{const o=await fetch(this.handlers.source.url_of(n));if(!o.ok){this.handlers.note(`image: ${r}: HTTP ${o.status}`);continue}const a=await e.annotations_import(await o.arrayBuffer());i+=a,this.handlers.note(a>0?`image: ${a} measurement${a===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(o){this.handlers.note(`image: ${r}: ${o instanceof Error?o.message:String(o)}`)}}this.pane.dataset.annotations=String(i)}async volume_show(e){this.engine_dispose(),this.series=null,this.siblings=[],this.pane.dataset.modality="NIFTI",this.title.textContent=`IMAGE ${e.split("/").pop()??""}`,this.title.title=e,this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint("NIFTI");const t=await this.chunk_import(()=>Ap(()=>import("./niivueEngine-B8R-ZtUa.js"),__vite__mapDeps([3,1]),import.meta.url));if(t===null)return;const{NiivueEngine:i}=t;await this.engine_open(new i(this.engineHost_get(),e))}async chunk_import(e){try{const t=await e();if(t!==void 0)return t}catch(t){if(!fg(t))throw t}return zs(this.stateSpan,"stale",Gh),this.handlers.note(`image: ${Gh.toLowerCase()} — the viewer's code is of an older build than the server has`),null}opening_show(e){const t=e.replace(/\/$/,"").split("/").pop()??e;this.stateSpan.textContent="OPENING",this.progress_show({label:`OPENING ${t}`,done:0,total:0})}opening_fail(e,t){this.stateSpan.textContent=t,this.progress_show({label:t,done:0,total:0});const i=this.progressNote;i!==null&&(i.classList.add("image-working-failed"),i.querySelector(".image-working-count").textContent=e)}siblings_get(){return this.siblings}series_get(){return this.series}state_get(){return this.engine===null?null:{...this.engine.state_get(),colormap:this.colormap,path:this.series?.path??null,guard:this.guardBytes,waiting:this.pendingLayout}}async layout_set(e){if(this.engine===null)return!1;if(e!=="single"&&this.guard_trips())return this.pendingLayout=e,this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Oc(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Oc(this.series?.bytes??0)} to fetch for ${e}; press LOAD, image load, or image --force <path>`),!1;const t=this.engine.state_get().layout;return this.layoutPills_paint(e),this.modeSpan.textContent=e==="single"?"":e.toUpperCase(),this.overlay_hide(),await this.engine.layout_set(e)?(this.progress_show(null),this.overlay_paint(),this.toolPills_paint(),!0):(this.progress_show(null),this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),this.handlers.note(`image: layout ${e}: not offered by ${this.engine.name}`),!1)}layoutPills_paint(e){for(const[t,i]of this.layoutPills)i.classList.toggle("rail-off",t!==e)}guard_trips(){return this.guardBytes!==null&&!this.forced&&this.engine?.name==="cornerstone"&&(this.series?.bytes??0)>this.guardBytes}async load_press(){this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0;const e=this.pendingLayout;return this.pendingLayout=null,e!==null?this.layout_set(e):this.engine===null||this.engine.state_get().filled?!1:this.engine.slices_fill()}guard_set(e){this.guardBytes=e}guard_get(){return this.guardBytes}preset_cycle(){const e=this.presets_for(this.series?.modality??"NIFTI");if(e.length===0)return;this.presetIndex=(this.presetIndex+1)%e.length;const t=e[this.presetIndex];t!==void 0&&this.wl_set(t.lower,t.upper)&&(this.presetPill.textContent=t.name.toUpperCase())}presets_for(e){const t=e.toUpperCase();return Hv.filter(i=>i.modalities.length===0||i.modalities.includes(t))}presets_paint(e){this.presetIndex=-1;const t=this.presets_for(e);this.presetPill.hidden=t.length===0,this.presetPill.textContent="PRESET"}slice_set(e){if(this.engine===null)return!1;const t=this.engine.slice_set(e);return t||this.handlers.note(`image: slice ${e}: not offered in ${this.engine.state_get().layout} layout by ${this.engine.name}`),t}wl_set(e,t){if(this.engine===null)return!1;const i=this.engine.wl_set(e,t);return i||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),i}ghost_set(e){if(this.engine===null)return!1;const t=this.engine.ghost_set(e);return t||this.handlers.note("image: ghost applies to the SLAB layout"),t}wlPreset_set(e){const t=this.series?.modality??"NIFTI",i=DE(e,t);return i===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${t}`),!1):this.wl_set(i.lower,i.upper)}colormap_set(e){return this.engine===null?!1:this.engine.colormap_set(e)?(this.colormap=e,this.colormapPill.textContent=e.toUpperCase(),!0):(this.handlers.note(`image: colormap ${e}: not offered by ${this.engine.name}`),!1)}tool_set(e){return this.engine===null?!1:this.engine.tool_set(e)?(this.tool=e,this.toolPills_paint(),!0):(this.handlers.note(`image: ${e}: not offered by ${this.engine.name}`),!1)}async annotations_save(){if(this.engine===null)return!1;const e=this.series?.seriesInstanceUID,t=/^(\/home\/[^/]+)\//.exec(this.series?.path??"")?.[1];if(e===void 0||t===void 0)return this.handlers.note("image: save: this series has no UID to file an annotation under"),!1;const i=await this.engine.annotations_export();if(i===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const n=`${t}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(n,i);return this.handlers.note(r===200?`✓ ${n}`:`image: save: ${n}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=Lc[(Lc.indexOf(this.colormap)+1)%Lc.length]??"gray";this.colormap_set(e)}async engine_open(e){this.engine=e,this.field.replaceChildren(),this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.layoutPills_paint("single"),this.modeSpan.textContent="",this.colormapPill.textContent=this.colormap.toUpperCase();try{await e.open(this.field)}catch(i){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${i instanceof Error?i.message:String(i)}`);return}const t=e.state_get().layout;this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),e.tool_set(this.tool),this.toolPills_paint(),this.progress_show(null),this.overlay_fill()}engine_dispose(){this.engine?.dispose(),this.engine=null,this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.field.replaceChildren(),this.stateSpan.textContent=""}retryPill_paint(){const e=this.engine===null?0:this.engine.state_get().refused,t=this.engine?.refused_retry!==void 0;this.retryPill.hidden=!t||e===0,this.retryPill.disabled||(this.retryPill.textContent=`RETRY ${e}`)}async retry_press(){if(!(this.engine?.refused_retry===void 0||this.retryPill.disabled)){this.retryPill.disabled=!0,this.retryPill.textContent="ASKING…";try{await this.engine.refused_retry()}finally{this.retryPill.disabled=!1,this.retryPill_paint()}}}engineHost_get(){return{source:this.handlers.source,readout_set:e=>{this.stateSpan.textContent=e,this.retryPill_paint()},progress_set:e=>this.progress_show(e),note:this.handlers.note,regard:e=>{this.handlers.regard(e),this.overlaySlice_paint()},probe_set:e=>this.probe_show(e)}}probe_show(e){if(e===null){this.probeNote?.remove(),this.probeNote=null;return}if(this.probeNote===null||this.probeNote.parentElement===null){const t=document.createElement("div");t.className="image-probe-note",this.field.appendChild(t),this.probeNote=t}this.probeNote.textContent=e}overlaySlice_paint(){const e=this.overlayNote?.querySelector(".image-overlay-slice")??null;if(e===null||this.engine===null)return;const t=this.engine.state_get();e.textContent=t.slices>1?`SLICE ${Math.max(1,t.slice)} OF ${t.slices}`:"",e.hidden=t.slices<=1}progress_show(e){if(e===null){this.progressNote?.remove(),this.progressNote=null;return}if(this.progressNote===null||this.progressNote.parentElement===null){const o=document.createElement("div");o.className="image-working",o.innerHTML='<span class="image-working-label"></span><span class="image-working-track"><span class="image-working-fill"></span></span><span class="image-working-count"></span>',this.field.appendChild(o),this.progressNote=o}const t=this.progressNote;t.classList.remove("image-working-failed");const i=e.total>0,n=i?Math.min(1,e.done/e.total):0;t.querySelector(".image-working-label").textContent=e.label,t.querySelector(".image-working-count").textContent=i?`${e.done} / ${e.total} · ${Math.round(n*100)}%`:"";const r=t.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!i),r.style.width=i?`${Math.round(n*100)}%`:""}async overlay_set(e){if(this.overlay=e,this.overlayPill.textContent=e?"OVERLAY ON":"OVERLAY OFF",this.overlayPill.classList.toggle("rail-off",!e),!e){this.overlay_hide();return}await this.overlay_fill()}overlay_hide(){this.overlayNote?.remove(),this.overlayNote=null}async overlay_fill(){if(!this.overlay||this.series===null)return;const e=this.series.files[0]??this.series.path,t=await this.handlers.tags_read(e);if(t===null){this.handlers.note(`image: overlay: ${e}: no header to read`);return}this.overlayLines=YG.flatMap(i=>{const r=(t.constant.find(o=>o.name===i.tag)?.value??"").trim();return r===""?[]:[i.label===""?r:`${i.label} ${r}`]}),this.overlay_paint()}overlay_paint(){if(!this.overlay||this.overlayLines.length===0)return;this.overlay_hide();const e=document.createElement("div");e.className="image-overlay-note";const t=document.createElement("span");t.className="image-overlay-slice",e.appendChild(t);for(const i of this.overlayLines){const n=document.createElement("span");n.textContent=i,e.appendChild(n)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??c_),t=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[i,n]of this.toolPills){const r=e.has(i);n.classList.toggle("rail-na",!r),n.classList.toggle("rail-off",r&&i!==t),n.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function ai(s,e){const t=s.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const Xy=["patient","study","series","image","equipment","meta","private","other","varying"],QG=new Set(["meta","private"]),N0="••••";class eP{pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,t){this.handlers=t,this.pane=e,this.title=Ec(e,".pane-title"),this.modeSpan=Ec(e,".pane-mode"),this.redactBlock=Ec(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const i=Ec(e,".tags-panel");this.listing=new Mr({mount:i,traits:this.groupTraits_declare(),key:n=>n.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:n=>`tags-group tags-group-${n.group}`,decorate:n=>{n.title="fold this group open or shut (it keeps its place)"}},child:Jo(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:n=>n.items.length>0,row:{className:n=>`tags-row${n.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(n,r)=>{n.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:Jo(n=>n.items,{traits:this.itemTraits_declare(),key:n=>n.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:Jo(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:()=>!1,row:{className:n=>`tags-row tags-row-deep${n.phi?" tags-phi":""}`}})})}),state:n=>this.stateLine_compose(n),empty:()=>nP("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${sP(e)}`,this.pane.dataset.modality=iP(e),this.groups=tP(e),this.listing.rows_set([{key:e.path,rows:this.groups}],{field:e.path}),this.listing.open_set(0,this.groups.map(t=>t.group).filter(t=>!QG.has(t))),this.modeSpan.textContent=e.subject==="folder"?"FOLDER":""}path_get(){return this.model?.path??null}redact_get(){return this.redact}redact_set(e){this.redact=e,this.redactBlock_paint(),this.model!==null&&this.listing.rows_set([{key:this.model.path,rows:this.groups}],{field:this.model.path})}filter_set(e){if(e===null){this.listing.filter_toggle(!1);return}this.listing.filter_toggle(!0),this.listing.filter_set(e)}stateLine_compose(e){const t=this.groups.reduce((n,r)=>n+r.rows.length,0),i=[];return this.model!==null&&this.model.subject==="folder"&&(i.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&i.push(`REFUSED ${this.model.refused.length}`)),i.push(e.filter!==""?e.filter:`${t} TAGS`),this.redact&&i.push("REDACTED"),i.join(" · ")}redactBlock_paint(){this.redactBlock.textContent=this.redact?"REDACT ON":"REDACT OFF",this.redactBlock.classList.toggle("rail-off",!this.redact),this.pane.classList.toggle("tags-redacted",this.redact)}value_cell(e){const t=document.createElement("span");if(t.className="tags-value",e.phi&&this.redact)return t.textContent=N0,t.title="identifying value, redacted; the REDACT block on the frame reveals it",t;if(t.textContent=e.value,e.decoded!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` ${e.decoded}`,t.appendChild(i)}if(e.distinct!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` (${e.distinct} distinct)`,t.appendChild(i)}return t}groupTraits_declare(){return[Du(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>Xy.indexOf(e.group)},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}tagTraits_declare(){return[Du(e=>e.items.length>0),{key:"tag",label:"TAG",className:"tags-tag",width:"7em",cell:e=>e.tag,compare:e=>e.tag},{key:"name",label:"NAME",className:"tags-name",width:"minmax(8em, 1.4fr)",cell:e=>e.name,compare:e=>e.name.toLowerCase()},{key:"vr",label:"VR",className:"tags-vr",width:"2.4em",cell:e=>e.vr,compare:e=>e.vr},{key:"value",label:"VALUE",className:"tags-value-cell",width:"minmax(6em, 2fr)",cell:e=>this.value_cell(e),compare:e=>(e.phi&&this.redact?N0:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Du(()=>!0),{key:"item",label:"ITEM",className:"tags-item-name",width:"minmax(12em, 1fr)",cell:e=>`ITEM ${e.index}`,compare:e=>e.index},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}}function Du(s){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const t=document.createElement("span");return t.className=s(e)?"tags-fold":"tags-fold tags-fold-none",t}}}function tP(s){const e=new Map;for(const t of s.constant){const i=t.group;e.has(i)||e.set(i,[]),e.get(i)?.push(Zy(t,`${i}/${t.tag}`))}return s.varying.length>0&&e.set("varying",s.varying.map(t=>({tag:t.tag,name:t.name,vr:t.vr,value:t.distinct===1?t.first:`${t.first} .. ${t.last}`,phi:t.phi,items:[],distinct:t.distinct,key:`varying/${t.tag}`}))),Xy.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function Zy(s,e){return{tag:s.tag,name:s.name,vr:s.vr,value:s.value,...s.decoded!==void 0?{decoded:s.decoded}:{},phi:s.phi,items:(s.items??[]).map((t,i)=>({index:i+1,key:`${e}/${i+1}`,rows:t.map(n=>Zy(n,`${e}/${i+1}/${n.tag}`))})),key:e}}function sP(s){const e=s.path.replace(/\/$/,"").split("/").pop()??s.path;if(s.subject==="folder")return e.length>24?`${e.slice(0,22)}…`:e;const t=/^(\d+)-/.exec(e)?.[1];return t!==void 0?`INSTANCE ${Number(t)}`:e.length>24?`${e.slice(0,22)}…`:e}function iP(s){const e=(s.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function nP(s){const e=document.createElement("div");return e.className="tags-note",e.textContent=s,e}function Ec(s,e){const t=s.querySelector(e);if(t===null)throw new Error(`tags pane: missing ${e}`);return t}function rP(s,e){const t=Pi("tpl-pane-image"),i=new JG(t,{source:{url_of:n=>s.vfsUrl_build(n)},note:n=>s.terminal().line_note(n),regard:n=>s.subjects().regard_write(e,{address:n,modelKind:"dicom.instance"}),file_put:async(n,r)=>{try{return(await fetch(s.vfsUrl_build(n),{method:"POST",body:r})).status}catch{return 0}},tags_read:n=>pg(s,n),tags_open:()=>{s.terminal().line_note(Jy(s,e))}});return s.panels().set("image",e,i),{id:e,kind:"image",mount:t,dispose:()=>{i.dispose(),s.panels().delete(e),s.subjects().pane_leave(e)}}}function oP(s,e){const t=Pi("tpl-pane-tags"),i=new eP(t,{note:n=>s.terminal().line_note(n)});return s.panels().set("tags",e,i),{id:e,kind:"tags",mount:t,dispose:()=>{s.panels().delete(e),s.subjects().pane_leave(e)}}}async function pg(s,e){try{const t=await s.client().line_execute(`dcm tags "${e}"`,{silent:!0,observe:!1});for(const i of t.envelopes){if(i.model?.kind!==Yo.tags)continue;const n=Nv.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}function aP(s,e,t){const i=s.panels().get("tags",e);i===void 0||i.path_get()===t||pg(s,t).then(n=>{if(n===null){s.terminal().line_note(`tags: ${t}: not a readable DICOM file`);return}s.panels().get("tags",e)?.model_show(n)})}function Jy(s,e){const t=new Set(s.layout().panes_shown()),i=s.subjects().group_of(e);for(const r of s.panels().ids("tags"))if(t.has(r)&&s.subjects().group_of(r)===i)return s.layout().focus_set(r),"image tags";if(!t.has(e))return"image tags: the image pane is not on stage";const n=s.instance_spawn("tags",e);return s.layout().leaf_split(e,s.desktop().replayPlace_get()?.dir??"col",n.id,s.desktop().replayPlace_get()?.before??!1)?(s.birth_record(n.id,e,s.desktop().replayPlace_get()?.dir??"col",s.desktop().replayPlace_get()?.before??!1),"image tags"):(Ds(n.id),s.layout().mount_remove(n.id),"image tags: could not open beside the image pane")}async function Dp(s,e){try{const t=await s.client().line_execute(`dcm series "${e}"`,{silent:!0,observe:!1});for(const i of t.envelopes){if(i.model?.kind!==Yo.series)continue;const n=Gv.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}async function Qy(s,e){try{const t=await s.client().line_execute(`ls "${e}"`,{silent:!0,observe:!1});for(const i of t.envelopes){if(i.model?.kind!=="fs.listing")continue;const n=i.model.data,r=(Array.isArray(n)?n[0]:n)??{},o=(r.path??e).replace(/\/$/,"");return(r.items??[]).filter(a=>a.type==="dir").map(a=>`${o}/${a.name}`)}}catch{}return[]}function ez(s,e,t){const i=l=>{t!==void 0&&s.subjects().regard_write(l,t)};if(e!==null&&s.panels().has("image",e))return i(e),s.panels().get("image",e)??null;const n=new Set(s.layout().panes_shown());if(t!==void 0){for(const[l,c]of s.panels().entries("image"))if(n.has(l)&&s.subjects().regard_get(l)?.address===t.address)return i(l),c}const r=e!==null?s.subjects().group_of(e):null;for(const[l,c]of s.panels().entries("image"))if(n.has(l)&&r!==null&&s.subjects().group_of(l)===r)return c;const o=e!==null&&n.has(e)?e:s.errandHost_find();if(o===null)return null;const a=s.instance_spawn("image",e??void 0);return s.layout().leaf_split(o,s.desktop().replayPlace_get()?.dir??"col",a.id,s.desktop().replayPlace_get()?.before??!1)?(s.birth_record(a.id,o,s.desktop().replayPlace_get()?.dir??"col",s.desktop().replayPlace_get()?.before??!1),i(a.id),s.panels().get("image",a.id)??null):(Ds(a.id),s.layout().mount_remove(a.id),null)}async function lP(s,e,t,i={},n){s.launcher_yield();const r=e!==null?void 0:yf.test(t)?{address:t,modelKind:"image.volume"}:{address:yh.test(t)?t.slice(0,t.lastIndexOf("/")):t.replace(/\/$/,""),modelKind:"dicom.series"},o=ez(s,e,r);if(o===null)return"image: no pane to open beside";const a=s.panels().idOf("image",o);if(a!==null&&n?.(a),yf.test(t))return o.opening_show(t),o.volume_show(t),`image ${t}`;const l=yh.test(t),c=l?t.slice(0,t.lastIndexOf("/")):t.replace(/\/$/,"");o.opening_show(c);let h=await Dp(s,c),d=[];if(h===null&&!l){const p=(await Qy(s,c)).slice(0,32);for(const f of p){const _=await Dp(s,f);if(_!==null){d=p.map(g=>({path:g,label:g.split("/").pop()??g})),h=_;break}}}if(h===null)return o.opening_fail(t,"NOT A READABLE SERIES"),`image: ${t}: not a readable DICOM series, study, or volume`;const u=l?Math.max(1,h.files.indexOf(t)+1):1;return o.series_show(h,{siblings:d,startAt:u,...i.force===!0?{force:!0}:{}}),`image ${h.path}${d.length>1?` (1 of ${d.length} series)`:""}`}function cP(s){return{imageInstance_build:e=>rP(s,e),tagsInstance_build:e=>oP(s,e),tags_ask:e=>pg(s,e),tagsPane_follow:(e,t)=>aP(s,e,t),tagsPane_open:e=>Jy(s,e),series_ask:e=>Dp(s,e),subfolders_ask:e=>Qy(s,e),imagePane_for:(e,t)=>ez(s,e,t),image_open:(e,t,i={},n)=>lP(s,e,t,i,n)}}function hP(s){return{primaries:[s.panes.dag_build("dag",!0),s.panes.universe_build("universe"),{id:"pacs",kind:"pacs",mount:s.pacsMount}],domains:["dag","pacs"],presets:[["pacs",()=>({pane:"pacs"})],["dag",()=>({pane:"dag"})],["universe",()=>({pane:"universe"})]],factories:[["dag",e=>s.panes.dag_build(e,!1)],["universe",s.panes.universe_build],["image",s.dicom.imageInstance_build],["tags",s.dicom.tagsInstance_build],["gather",s.gather_build]]}}function dP(s){return async()=>{const e=await s.ask("proc feeds");let t=[];for(const d of e.envelopes){const u=d.model;if(u===void 0||u.kind!==pf)continue;const p=ff.safeParse(u.data);p.success&&(t=p.data.feeds)}const n=t.length===0&&e.envelopes.some(d=>d.status==="error")?"INDEX WARMING":`${t.length} FEEDS`,r=t.filter(d=>/error/i.test(d.status)).length,o=t.filter(d=>/running|scheduled|created|started/i.test(d.status)).length,a={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:n}],rows:[],verb:"SEE THE SPACE",about:ir.universe,enter:()=>s.universe_show()},l={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:n},...o>0?[{text:`${o} RUNNING`}]:[],...r>0?[{text:`${r} ERRORED`,errored:!0,open:()=>s.runs_show("status:error")}]:[]],rows:t.slice(0,6).map(d=>({text:`${d.id} ${d.title}`,errored:/error/i.test(d.status),open:()=>s.feed_enter(d.id)})),verb:"OPEN THE ROSTER",about:ir.analyses,enter:()=>s.runs_show()},c=s.pacs_query(),h={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:c===""?"NO ANSWER":"ANSWERED"}],rows:c===""?[{text:"pacs query PatientID:…",open:()=>s.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>s.line_offer("pacs query AccessionNumber:")}]:[{text:c.slice(0,48)}],verb:"ASK A PACS",about:ir.pacs,enter:()=>s.pacs_open()};return{lead:{tile:l,weight:t.length},afterFiles:[h],afterPanes:[a],about:{files:{text:"Your ChRIS home: uploads, results and what others shared with you."}}}}}function uP(s){return s>=6e4?`${Math.max(1,Math.round(s/6e4))} MIN`:`${Math.max(1,Math.round(s/1e3))} S`}function _i(s){return s.toLocaleString("en-US")}class fP{mount;counts=null;context=null;msPerPage=null;walkSamples=new Map;clock;acts;state=void 0;constructor(e,t=()=>Date.now(),i={}){this.mount=e,this.clock=t,this.acts=i,this.render()}state_show(e){this.state=e,this.render()}pace_show(e){this.msPerPage=e,this.render()}eta_of(e,t,i){const n=this.clock(),r=this.walkSamples.get(e);let o=r?.rowsPerMs??null;r!==void 0&&t>r.loaded&&n>r.at&&(o=(t-r.loaded)/(n-r.at)),(r===void 0||t!==r.loaded)&&this.walkSamples.set(e,{loaded:t,at:n,rowsPerMs:o});const a=Math.max(0,i-t);return i<=0?null:o!==null&&o>0?a/o:this.msPerPage!==null&&this.msPerPage>0?Math.ceil(a/100/4)*this.msPerPage:null}counts_show(e){this.counts=e,this.render()}promptContext_show(e){this.context=e,e.procIndex!==void 0&&(this.counts={jobs:e.procIndex.jobs,feeds:e.procIndex.feeds}),this.render()}rows_compose(){const e=[],t=this.context?.procWarmup,i=this.context?.warmupFailures??[],n=t!==void 0&&t.sweeping!==!1,r=this.counts!==null?`${_i(this.counts.jobs)} JOBS · ${_i(this.counts.feeds)} FEEDS`:"";if(i.length>0)e.push({label:"INDEX",bar:null,value:`${r}${r?" · ":""}FAILED: ${i.map(l=>l.label.toUpperCase()).join(" ")}`,title:i.map(l=>`${l.label}: ${l.message}`).join(`
|
|
4291
|
+
`);return{ok:!1,text:E===""?"the session refused this read and said nothing further":E}}),c=async(S,D)=>{const T=await fetch(e.vfsUrl_build(S));if(!T.ok||T.body===null)return(await l(S)).text.slice(0,D);const E=T.body.getReader(),x=new TextDecoder;let C="";for(;C.length<D;){const{done:I,value:k}=await E.read();if(I)break;C+=x.decode(k,{stream:!0})}return E.cancel().catch(()=>{}),C.slice(0,D)},h=async S=>{const D=/_id(\d+)$/.exec(S)?.[1]??S.replace(/^.*\//,""),T=await s.client.line_execute(`pipeline diagram ${D}`,{silent:!0,observe:!1});for(const E of T.envelopes){if(E.model?.kind!==cr.pipelineDiagram)continue;const x=xm.safeParse(E.model.data);if(x.success)return x.data.nodes.map(C=>({id:C.id,parentIds:[...C.parentIds,...C.joinParentIds??[]]}))}return null},d={imageUrl:e.vfsUrl_build,download:a,textHead:c,pipelineGlimpse:h},u=(S,D,T)=>{const E=T==="~"?"ls ~":`ls "${T}"`;s.client.line_execute(E,{silent:!0,observe:!1}).then(x=>{for(const C of x.envelopes)D.envelope_observe(C);if(T!=="~"&&D.path_current()!==T.replace(/\/+$/,"")){const C=x.envelopes.find(k=>k.status==="error"),I=C!==void 0?dw(C):"the session answered no listing";D.listing_fail(I),s.terminal.line_note(`files: ${T}: ${I}`)}},x=>{const C=x instanceof Error?x.message:String(x);D.listing_fail(C),s.terminal.line_note(`files: ${T}: ${C}`)})},p=(S,D,T)=>{const E=D.path_current();E!==null&&n.get(S)?.push(E),u(S,D,T)},f=(S,D)=>{const T=n.get(S)?.pop();T!==void 0&&u(S,D,T)},_=S=>{o.get(S)?.()},g=(S,D)=>{r.set(S,D),_(S);const T=t.get("files",S);T?.follow_set(D),D&&T!==void 0&&s.client.line_execute("ls",{silent:!0,observe:!1}).then(E=>{for(const x of E.envelopes)T.envelope_observe(x)})},m=(S,D)=>{const T=t.get("files",S);T!==void 0&&(r.get(S)===!0?s.terminal.line_run("ls"):u(S,T,D))},v=(S,D)=>{e.ask_onPane(S,{message:`New directory in ${D}: `,kind:"text",commit:"MAKE IT"}).then(T=>{const E=(T??"").trim();E!==""&&(s.terminal.line_run(`mkdir "${D}/${E}"`),m(S,D))})},y=async(S,D,T)=>{for(const E of T){const x=`${D}/${E.name}`;s.terminal.line_note(`putting ${E.name} in ${D}…`);try{const C=await fetch(e.vfsUrl_build(x),{method:"POST",body:E});if(!C.ok){s.terminal.line_note(`upload: ${E.name}: ${(await C.text()).trim()||C.statusText}`);continue}s.terminal.line_note(`✓ ${x}`)}catch(C){s.terminal.line_note(`upload: ${E.name}: ${C instanceof Error?C.message:String(C)}`)}}m(S,D)},b=(S,D,T)=>{if(T.kind==="dir"){r.get(S)===!0?s.terminal.line_run(`cd "${T.path}"`):p(S,D,T.path);return}if(T.kind==="plugin"||T.kind==="pipeline"){e.binEntry_show(S,D,T.path,T.kind);return}if(qy(T.path)){e.image_open(S,T.path).then(E=>s.terminal.line_note(E));return}if(i.regard_write(S,{address:T.path,modelKind:"fs.file"}),!i.groupHasViewer(S)){if(id(T.path)){D.contentImage_show(T.path,e.vfsUrl_build(T.path));return}l(T.path).then(E=>{if(!E.ok){D.contentRefused_show(T.path,E.text);return}Vy.test(T.path)?D.contentTable_show(T.path,E.text):D.content_show(T.path,E.text)})}},w=()=>{const S=e.template_stamp("tpl-pane-files").querySelector(".files-body");if(S===null)throw new Error("tpl-pane-files has no files-body");return S},z=(S,D,T)=>{const E=`"${T}"`,x=D.type==="dir"||D.type==="vfs"||D.type==="job",C=ul(T),I={kind:D.type==="plugin"||D.type==="pipeline"?"catalogue":x&&Id(T,D.name)?"seriesFolder":D.type==="file"?"file":"directory",feed:C,node:C===null?null:Ep(T),bound:e.catalogue_of(S)!==void 0,projection:kG(T),editable:D.type==="file"&&y1(T)},k={image:()=>{e.image_open(S,T).then(N=>s.terminal.line_note(N))},download:()=>a(T),link:()=>{const N=pv(window.location.origin,T);(t.get("files",S)?.link_copy(T)??navigator.clipboard.writeText(N).then(()=>!0,()=>!1)).then(F=>s.terminal.line_note(F?`link copied: ${N}`:`link (copy it): ${N}`))},process:()=>e.process_open(S,{input:T,feed:C,node:C===null?null:Ep(T)}),gather:()=>e.cohort_gather([{kind:x?"dir":"file",seriesUID:T,description:D.name,imagery:Id(T,D.name),modality:Id(T,D.name)?"MR":"—",patient:e.promptUser()??"",vfsPath:T,folderPath:T}]),run:()=>e.run_press(S,D.name,D.type==="pipeline"?"pipeline":"plugin"),edit:()=>{const N=$y(T),P=fG(D.name,D.size,w1);if(P===null){e.verbLine_run(S,N);return}e.ask_onPane(S,{kind:"confirm",message:P}).then(F=>{F==="y"&&e.verbLine_run(S,N)})},move:()=>e.verbLine_run(S,`mv ${E}`),copy:()=>e.verbLine_run(S,`cp ${E}`),delete:()=>e.verbLine_run(S,`rm ${x?"-ri":"-i"} ${E}`),share:()=>e.verbLine_run(S,`setfacl ${E}`)};return Sw.rules.filter(N=>N.offered(I)).map(N=>({label:N.label(I),run:()=>k[N.name]?.()}))},O=(S,D)=>{const T=D.map(([k])=>k),E=T.map(k=>`"${k}"`).join(" "),x=[];for(const k of T){const N=ul(k);N!==null&&!x.includes(N)&&x.push(N)}const C={count:T.length,feeds:x},I={delete:()=>e.verbLine_run(S,`rm -rI ${E}`),move:()=>s.terminal.line_run(`mv -t ${E}`),copy:()=>s.terminal.line_run(`cp -t ${E}`),share:()=>s.terminal.line_run(`setfacl ${x.map(k=>`feed_${k}`).join(" ")}`)};return xw.rules.filter(k=>k.offered(C)).map(k=>({label:k.label(C),run:()=>I[k.name]?.()}))};return{previewProvider:d,fileText_fetch:l,file_save:a,rootedListing_show:u,listing_refresh:m,directory_make:v,files_deliver:y,follows:S=>r.get(S)===!0,follow_set:g,cwdBind_sync_register:(S,D)=>{o.set(S,D)},cwdBind_sync:_,rooted_walk:p,rooted_back:f,filesBody_stamp:w,rowVerbs_of:z,instance_build:(S,D,T=!1)=>{const E=e.template_stamp("tpl-pane-files"),x=new fw(e.pane_find(E,".files-panel"),I=>b(S,x,I),d,{catalogue:T});x.selectionVerbs_declare(I=>O(S,I)),x.rowVerbs_declare((I,k)=>z(S,I,k),(I,k)=>{i.regard_write(S,{address:k,modelKind:"fs.file"}),ul(k)!==null&&s.client.line_execute(`getfacl "${k}"`,{silent:!0,observe:!1}).then(N=>{x.rowReadout_show(k,BG(N))}).catch(()=>{x.rowReadout_show(k,"ACCESS UNREAD")})}),t.set("files",S,x);const C=e.promptUser();return C!==null&&C!==""&&x.home_set(`/home/${C}`),n.set(S,[]),r.set(S,D),_(S),x.follow_set(D),{id:S,kind:"files",mount:E,dispose:()=>{t.delete(S),n.delete(S),i.pane_leave(S)}}}}}function GG(s,e){const t=Pi("tpl-pane-universe"),i=new uG({canvas:Vs(t,".universe-canvas"),title:Vs(t,".universe-title"),state:t.querySelector(".pane-state"),empty:Vs(t,".universe-empty"),projectionPill:t.querySelector(".universe-projection"),refreshPill:t.querySelector(".universe-refresh"),replayPill:t.querySelector(".universe-replay"),scalePill:t.querySelector(".universe-scale"),viewPill:t.querySelector(".universe-view"),gravityPill:t.querySelector(".universe-gravity"),densityPill:t.querySelector(".universe-density"),drawPill:t.querySelector(".universe-draw"),captionsPill:t.querySelector(".universe-captions"),arrangementPill:t.querySelector(".universe-arrangement"),facts:t.querySelector(".universe-facts"),backPill:t.querySelector(".universe-back"),openPill:t.querySelector(".universe-open"),frame:t.querySelector(".mode-frame")},{watch_set:(n,r)=>{r?s.client().watch_send(n):s.client().unwatch_send(n)},...(({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l})=>({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l}))(jy(s.context(),e,s.feedVerbs())),command_run:n=>{s.client().line_execute(n,{silent:!0,observe:!1}).then(r=>{for(const o of r.envelopes)i.envelope_observe(o)})},feed_dag:async n=>{const r=await s.client().line_execute(`feed diagram feed_${n}`,{silent:!0,observe:!1});for(const o of r.envelopes){if(o.model?.kind!==cr.feedDag)continue;const a=Om.safeParse(o.model.data);if(a.success)return a.data}return null},node_enter:n=>{s.terminal().line_run(`cd "${n}"`)},node_dive:n=>{s.nodeOverlay_open(e,n.replace(/\/data$/,""))},node_process:n=>{const r=ul(n.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)[1])),o=s.promptUser()===null?n.vfsPath:n.vfsPath.replace(/^\/proc\/jobs\//,`/home/${s.promptUser()}/feeds/`);s.process_open(e,{input:o,feed:r,node:n.instanceId})},feed_open:n=>{s.runs_show(),s.dag_primary().feed_enter(n)},plugin_open:n=>{(async()=>{const r=await s.client().line_execute("ls /bin",{silent:!0,observe:!1}),o=[];for(const l of r.envelopes){if(l.model?.kind!=="fs.listing")continue;const c=l.model.data,h=Array.isArray(c)?c:[c];for(const d of h)for(const u of d.items??[])o.push(u.name)}const a=o.filter(l=>l.startsWith(`${n}-v`)).sort((l,c)=>l.localeCompare(c,void 0,{numeric:!0})).pop();if(a===void 0){s.terminal().line_note(`universe: ${n} is not in /bin`);return}st("gutter-files").click(),s.binEntry_show("files",s.panels().get("files","files"),`/bin/${a}`,"plugin")})().catch(r=>{s.terminal().line_note(`universe: could not open ${n} in /bin: ${r instanceof Error?r.message:String(r)}`)})},note:n=>s.terminal().line_note(n)},fv());return s.panels().set("universe",e,i),{id:e,kind:"universe",mount:t,dispose:()=>{s.panels().delete(e),s.subjects().pane_leave(e),i.dispose()}}}function PG(s,e,t){const i=Pi("tpl-pane-dag"),n=new WN(Vs(i,".dag-canvas"),Vs(i,".dag-title"),Vs(i,".dag-facts"),Vs(i,".dag-empty"),Vs(i,".dag-strategy"),Vs(i,".dag-feedlist"),{command_run:r=>{s.client().line_execute(r,{silent:!0,observe:!1}).then(o=>{for(const a of o.envelopes)n.envelope_observe(a)})},watch_set:(r,o)=>{o?s.client().watch_send(r):s.client().unwatch_send(r)},node_enter:r=>{s.terminal().line_run(`cd "${r}"`)},node_dive:r=>{s.nodeOverlay_open(e,r.replace(/\/data$/,""))},node_regard:r=>{s.subjects().regard_write(e,{address:r,modelKind:"feed.node"})},node_process:r=>{const o=ul(r.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)[1])),a=s.promptUser()===null?r.vfsPath:r.vfsPath.replace(/^\/proc\/jobs\//,`/home/${s.promptUser()}/feeds/`);s.process_open(e,{input:a,feed:o,node:r.instanceId})},feed_regard:r=>{s.subjects().regard_write(e,{address:r,modelKind:"feed"})},...jy(s.context(),e,s.feedVerbs()),...t?{feed_shown:()=>s.dag_summon()}:{}});return s.panels().set("dag",e,n),{id:e,kind:"dag",mount:i,dispose:()=>{s.nodeOverlay().dispose(e),s.panels().delete(e),s.subjects().pane_leave(e),n.dispose()}}}function LG(s){return{universe_build:e=>GG(s,e),dag_build:(e,t)=>PG(s,e,t)}}const Ky=new Set(["files"]);function WG(s){Ky.add(s)}function k0(s){return Ky.has(s)}const Yy=new Map,pa=new Map;let FG=0;function gn(s,e){Yy.set(s,e)}function UG(s){const e=Yy.get(s);if(e===void 0)throw new Error(`no pane factory registered for kind '${s}'`);const t=e(`${s}-${FG++}`);return pa.set(t.id,t),t}function xc(s){pa.set(s.id,s)}function Zc(s){return pa.get(s)}function Jc(){return[...pa.values()]}function Ds(s){const e=pa.get(s);e!==void 0&&(pa.delete(s),e.dispose?.(),e.mount.remove())}class $G{byId=new Map;set(e,t,i){this.byId.set(t,{kind:e,panel:i})}get(e,t){const i=this.byId.get(t);return i!==void 0&&i.kind===e?i.panel:void 0}has(e,t){return this.byId.get(t)?.kind===e}delete(e){return this.byId.delete(e)}ids(e){return this.entries(e).map(([t])=>t)}entries(e){const t=[];for(const[i,n]of this.byId)n.kind===e&&t.push([i,n.panel]);return t}values(e){return this.entries(e).map(([,t])=>t)}idOf(e,t){for(const[i,n]of this.byId)if(n.kind===e&&n.panel===t)return i;return null}}const jG="modulepreload",HG=function(s,e){return new URL(s,e).href},B0={},Ap=function(e,t,i){let n=Promise.resolve();if(t&&t.length>0){let c=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");n=c(t.map(h=>{if(h=HG(h,i),h in B0)return;B0[h]=!0;const d=h.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(i)for(let f=o.length-1;f>=0;f--){const _=o[f];if(_.href===h&&(!d||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":jG,d||(p.as="script"),p.crossOrigin="",p.href=h,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((f,_)=>{p.addEventListener("load",f),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})},VG=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function fg(s){const e=s instanceof Error?s.message:String(s??"");return VG.test(e)}const sa={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},qG=`${sa.before}${sa.refresh}${sa.after}`,Gh="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function KG(s,e=document.body){let t=!1;const i=()=>{if(t)return;t=!0,s(`argus: ${qG} (what failed to load was part of the old build)`);const n=document.createElement("div");n.className="stale-page",n.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const o=document.createElement("button");o.type="button",o.className="stale-page-reload",o.textContent=sa.refresh,o.title="load the argus the server has now",o.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(sa.before),o,document.createTextNode(sa.after)),n.append(r),e.appendChild(n)};window.addEventListener("vite:preloadError",()=>{i()}),window.addEventListener("unhandledrejection",n=>{fg(n.reason)&&i()})}const YG=[{label:"",tag:"PatientName"},{label:"MRN",tag:"PatientID"},{label:"ACC",tag:"AccessionNumber"},{label:"",tag:"StudyDescription"},{label:"",tag:"SeriesDescription"},{label:"",tag:"StudyDate"},{label:"",tag:"PatientAge"},{label:"",tag:"PatientSex"}],XG=256*1024*1024;function Oc(s){const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;return i===0?`${s} B`:`${t.toFixed(1)} ${e[i]}`}function ZG(s){const e=s.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class JG{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=XG;forced=!1;pendingLayout=null;progressNote=null;overlayNote=null;probeNote=null;overlay=!1;overlayLines=[];presetIndex=-1;toolPills=new Map;handlers;engine=null;series=null;siblings=[];colormap="gray";tool="wl";constructor(e,t){this.handlers=t,this.pane=e,this.field=ai(e,".image-field"),this.title=ai(e,".pane-title"),this.modeSpan=ai(e,".pane-mode"),this.stateSpan=ai(e,".pane-state");for(const i of e.querySelectorAll(".image-layout")){const n=i.dataset.layout??"single";this.layoutPills.set(n,i),i.addEventListener("click",()=>{this.layout_set(n)})}this.overlayPill=ai(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=ai(e,".image-colormap"),this.savePill=ai(e,".image-save"),this.loadPill=ai(e,".image-load"),this.retryPill=ai(e,".image-retry"),this.presetPill=ai(e,".image-preset"),this.focusMark=ai(e,".image-focus"),this.field.tabIndex=0,this.colormapPill.addEventListener("click",()=>{this.colormap_cycle()}),this.savePill.addEventListener("click",()=>{this.annotations_save()}),this.loadPill.addEventListener("click",()=>{this.load_press()}),this.retryPill.addEventListener("click",()=>{this.retry_press()}),this.presetPill.addEventListener("click",()=>this.preset_cycle()),ai(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const i of c_){const n=ai(e,`.image-tool[data-tool="${i}"]`);this.toolPills.set(i,n),n.addEventListener("click",()=>{this.tool_set(i)})}this.toolPills_paint(),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.field.contains(i.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",i=>{if(i.key==="Escape"){this.field_release(),i.stopPropagation();return}i.stopPropagation()})}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}async series_show(e,t={}){if(this.engine_dispose(),this.series=e,this.forced=t.force===!0,this.pendingLayout=null,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint(e.modality),this.siblings=t.siblings??[],this.pane.dataset.modality=ZG(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const o=this.siblings.findIndex(a=>a.path===e.path)+1;this.handlers.note(`image: series ${o} of ${this.siblings.length} in this study; image series <n> switches`)}const i=await this.chunk_import(()=>Ap(()=>import("./cornerstoneEngine-5jvmInaS.js").then(o=>o.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(i===null)return;const{CornerstoneEngine:n}=i,r=new n(this.engineHost_get(),e,t.startAt??1);await this.engine_open(r),this.engine===r&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Oc(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Oc(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):r.slices_fill(),await this.annotations_reload(r,e))}async annotations_reload(e,t){let i=0;for(const n of t.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=n.split("/").pop()??n;try{const o=await fetch(this.handlers.source.url_of(n));if(!o.ok){this.handlers.note(`image: ${r}: HTTP ${o.status}`);continue}const a=await e.annotations_import(await o.arrayBuffer());i+=a,this.handlers.note(a>0?`image: ${a} measurement${a===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(o){this.handlers.note(`image: ${r}: ${o instanceof Error?o.message:String(o)}`)}}this.pane.dataset.annotations=String(i)}async volume_show(e){this.engine_dispose(),this.series=null,this.siblings=[],this.pane.dataset.modality="NIFTI",this.title.textContent=`IMAGE ${e.split("/").pop()??""}`,this.title.title=e,this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint("NIFTI");const t=await this.chunk_import(()=>Ap(()=>import("./niivueEngine-D4X_lKvS.js"),__vite__mapDeps([3,1]),import.meta.url));if(t===null)return;const{NiivueEngine:i}=t;await this.engine_open(new i(this.engineHost_get(),e))}async chunk_import(e){try{const t=await e();if(t!==void 0)return t}catch(t){if(!fg(t))throw t}return zs(this.stateSpan,"stale",Gh),this.handlers.note(`image: ${Gh.toLowerCase()} — the viewer's code is of an older build than the server has`),null}opening_show(e){const t=e.replace(/\/$/,"").split("/").pop()??e;this.stateSpan.textContent="OPENING",this.progress_show({label:`OPENING ${t}`,done:0,total:0})}opening_fail(e,t){this.stateSpan.textContent=t,this.progress_show({label:t,done:0,total:0});const i=this.progressNote;i!==null&&(i.classList.add("image-working-failed"),i.querySelector(".image-working-count").textContent=e)}siblings_get(){return this.siblings}series_get(){return this.series}state_get(){return this.engine===null?null:{...this.engine.state_get(),colormap:this.colormap,path:this.series?.path??null,guard:this.guardBytes,waiting:this.pendingLayout}}async layout_set(e){if(this.engine===null)return!1;if(e!=="single"&&this.guard_trips())return this.pendingLayout=e,this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Oc(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Oc(this.series?.bytes??0)} to fetch for ${e}; press LOAD, image load, or image --force <path>`),!1;const t=this.engine.state_get().layout;return this.layoutPills_paint(e),this.modeSpan.textContent=e==="single"?"":e.toUpperCase(),this.overlay_hide(),await this.engine.layout_set(e)?(this.progress_show(null),this.overlay_paint(),this.toolPills_paint(),!0):(this.progress_show(null),this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),this.handlers.note(`image: layout ${e}: not offered by ${this.engine.name}`),!1)}layoutPills_paint(e){for(const[t,i]of this.layoutPills)i.classList.toggle("rail-off",t!==e)}guard_trips(){return this.guardBytes!==null&&!this.forced&&this.engine?.name==="cornerstone"&&(this.series?.bytes??0)>this.guardBytes}async load_press(){this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0;const e=this.pendingLayout;return this.pendingLayout=null,e!==null?this.layout_set(e):this.engine===null||this.engine.state_get().filled?!1:this.engine.slices_fill()}guard_set(e){this.guardBytes=e}guard_get(){return this.guardBytes}preset_cycle(){const e=this.presets_for(this.series?.modality??"NIFTI");if(e.length===0)return;this.presetIndex=(this.presetIndex+1)%e.length;const t=e[this.presetIndex];t!==void 0&&this.wl_set(t.lower,t.upper)&&(this.presetPill.textContent=t.name.toUpperCase())}presets_for(e){const t=e.toUpperCase();return Hv.filter(i=>i.modalities.length===0||i.modalities.includes(t))}presets_paint(e){this.presetIndex=-1;const t=this.presets_for(e);this.presetPill.hidden=t.length===0,this.presetPill.textContent="PRESET"}slice_set(e){if(this.engine===null)return!1;const t=this.engine.slice_set(e);return t||this.handlers.note(`image: slice ${e}: not offered in ${this.engine.state_get().layout} layout by ${this.engine.name}`),t}wl_set(e,t){if(this.engine===null)return!1;const i=this.engine.wl_set(e,t);return i||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),i}ghost_set(e){if(this.engine===null)return!1;const t=this.engine.ghost_set(e);return t||this.handlers.note("image: ghost applies to the SLAB layout"),t}wlPreset_set(e){const t=this.series?.modality??"NIFTI",i=DE(e,t);return i===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${t}`),!1):this.wl_set(i.lower,i.upper)}colormap_set(e){return this.engine===null?!1:this.engine.colormap_set(e)?(this.colormap=e,this.colormapPill.textContent=e.toUpperCase(),!0):(this.handlers.note(`image: colormap ${e}: not offered by ${this.engine.name}`),!1)}tool_set(e){return this.engine===null?!1:this.engine.tool_set(e)?(this.tool=e,this.toolPills_paint(),!0):(this.handlers.note(`image: ${e}: not offered by ${this.engine.name}`),!1)}async annotations_save(){if(this.engine===null)return!1;const e=this.series?.seriesInstanceUID,t=/^(\/home\/[^/]+)\//.exec(this.series?.path??"")?.[1];if(e===void 0||t===void 0)return this.handlers.note("image: save: this series has no UID to file an annotation under"),!1;const i=await this.engine.annotations_export();if(i===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const n=`${t}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(n,i);return this.handlers.note(r===200?`✓ ${n}`:`image: save: ${n}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=Lc[(Lc.indexOf(this.colormap)+1)%Lc.length]??"gray";this.colormap_set(e)}async engine_open(e){this.engine=e,this.field.replaceChildren(),this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.layoutPills_paint("single"),this.modeSpan.textContent="",this.colormapPill.textContent=this.colormap.toUpperCase();try{await e.open(this.field)}catch(i){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${i instanceof Error?i.message:String(i)}`);return}const t=e.state_get().layout;this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),e.tool_set(this.tool),this.toolPills_paint(),this.progress_show(null),this.overlay_fill()}engine_dispose(){this.engine?.dispose(),this.engine=null,this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.field.replaceChildren(),this.stateSpan.textContent=""}retryPill_paint(){const e=this.engine===null?0:this.engine.state_get().refused,t=this.engine?.refused_retry!==void 0;this.retryPill.hidden=!t||e===0,this.retryPill.disabled||(this.retryPill.textContent=`RETRY ${e}`)}async retry_press(){if(!(this.engine?.refused_retry===void 0||this.retryPill.disabled)){this.retryPill.disabled=!0,this.retryPill.textContent="ASKING…";try{await this.engine.refused_retry()}finally{this.retryPill.disabled=!1,this.retryPill_paint()}}}engineHost_get(){return{source:this.handlers.source,readout_set:e=>{this.stateSpan.textContent=e,this.retryPill_paint()},progress_set:e=>this.progress_show(e),note:this.handlers.note,regard:e=>{this.handlers.regard(e),this.overlaySlice_paint()},probe_set:e=>this.probe_show(e)}}probe_show(e){if(e===null){this.probeNote?.remove(),this.probeNote=null;return}if(this.probeNote===null||this.probeNote.parentElement===null){const t=document.createElement("div");t.className="image-probe-note",this.field.appendChild(t),this.probeNote=t}this.probeNote.textContent=e}overlaySlice_paint(){const e=this.overlayNote?.querySelector(".image-overlay-slice")??null;if(e===null||this.engine===null)return;const t=this.engine.state_get();e.textContent=t.slices>1?`SLICE ${Math.max(1,t.slice)} OF ${t.slices}`:"",e.hidden=t.slices<=1}progress_show(e){if(e===null){this.progressNote?.remove(),this.progressNote=null;return}if(this.progressNote===null||this.progressNote.parentElement===null){const o=document.createElement("div");o.className="image-working",o.innerHTML='<span class="image-working-label"></span><span class="image-working-track"><span class="image-working-fill"></span></span><span class="image-working-count"></span>',this.field.appendChild(o),this.progressNote=o}const t=this.progressNote;t.classList.remove("image-working-failed");const i=e.total>0,n=i?Math.min(1,e.done/e.total):0;t.querySelector(".image-working-label").textContent=e.label,t.querySelector(".image-working-count").textContent=i?`${e.done} / ${e.total} · ${Math.round(n*100)}%`:"";const r=t.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!i),r.style.width=i?`${Math.round(n*100)}%`:""}async overlay_set(e){if(this.overlay=e,this.overlayPill.textContent=e?"OVERLAY ON":"OVERLAY OFF",this.overlayPill.classList.toggle("rail-off",!e),!e){this.overlay_hide();return}await this.overlay_fill()}overlay_hide(){this.overlayNote?.remove(),this.overlayNote=null}async overlay_fill(){if(!this.overlay||this.series===null)return;const e=this.series.files[0]??this.series.path,t=await this.handlers.tags_read(e);if(t===null){this.handlers.note(`image: overlay: ${e}: no header to read`);return}this.overlayLines=YG.flatMap(i=>{const r=(t.constant.find(o=>o.name===i.tag)?.value??"").trim();return r===""?[]:[i.label===""?r:`${i.label} ${r}`]}),this.overlay_paint()}overlay_paint(){if(!this.overlay||this.overlayLines.length===0)return;this.overlay_hide();const e=document.createElement("div");e.className="image-overlay-note";const t=document.createElement("span");t.className="image-overlay-slice",e.appendChild(t);for(const i of this.overlayLines){const n=document.createElement("span");n.textContent=i,e.appendChild(n)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??c_),t=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[i,n]of this.toolPills){const r=e.has(i);n.classList.toggle("rail-na",!r),n.classList.toggle("rail-off",r&&i!==t),n.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function ai(s,e){const t=s.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const Xy=["patient","study","series","image","equipment","meta","private","other","varying"],QG=new Set(["meta","private"]),N0="••••";class eP{pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,t){this.handlers=t,this.pane=e,this.title=Ec(e,".pane-title"),this.modeSpan=Ec(e,".pane-mode"),this.redactBlock=Ec(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const i=Ec(e,".tags-panel");this.listing=new Mr({mount:i,traits:this.groupTraits_declare(),key:n=>n.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:n=>`tags-group tags-group-${n.group}`,decorate:n=>{n.title="fold this group open or shut (it keeps its place)"}},child:Jo(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:n=>n.items.length>0,row:{className:n=>`tags-row${n.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(n,r)=>{n.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:Jo(n=>n.items,{traits:this.itemTraits_declare(),key:n=>n.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:Jo(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:()=>!1,row:{className:n=>`tags-row tags-row-deep${n.phi?" tags-phi":""}`}})})}),state:n=>this.stateLine_compose(n),empty:()=>nP("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${sP(e)}`,this.pane.dataset.modality=iP(e),this.groups=tP(e),this.listing.rows_set([{key:e.path,rows:this.groups}],{field:e.path}),this.listing.open_set(0,this.groups.map(t=>t.group).filter(t=>!QG.has(t))),this.modeSpan.textContent=e.subject==="folder"?"FOLDER":""}path_get(){return this.model?.path??null}redact_get(){return this.redact}redact_set(e){this.redact=e,this.redactBlock_paint(),this.model!==null&&this.listing.rows_set([{key:this.model.path,rows:this.groups}],{field:this.model.path})}filter_set(e){if(e===null){this.listing.filter_toggle(!1);return}this.listing.filter_toggle(!0),this.listing.filter_set(e)}stateLine_compose(e){const t=this.groups.reduce((n,r)=>n+r.rows.length,0),i=[];return this.model!==null&&this.model.subject==="folder"&&(i.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&i.push(`REFUSED ${this.model.refused.length}`)),i.push(e.filter!==""?e.filter:`${t} TAGS`),this.redact&&i.push("REDACTED"),i.join(" · ")}redactBlock_paint(){this.redactBlock.textContent=this.redact?"REDACT ON":"REDACT OFF",this.redactBlock.classList.toggle("rail-off",!this.redact),this.pane.classList.toggle("tags-redacted",this.redact)}value_cell(e){const t=document.createElement("span");if(t.className="tags-value",e.phi&&this.redact)return t.textContent=N0,t.title="identifying value, redacted; the REDACT block on the frame reveals it",t;if(t.textContent=e.value,e.decoded!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` ${e.decoded}`,t.appendChild(i)}if(e.distinct!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` (${e.distinct} distinct)`,t.appendChild(i)}return t}groupTraits_declare(){return[Du(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>Xy.indexOf(e.group)},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}tagTraits_declare(){return[Du(e=>e.items.length>0),{key:"tag",label:"TAG",className:"tags-tag",width:"7em",cell:e=>e.tag,compare:e=>e.tag},{key:"name",label:"NAME",className:"tags-name",width:"minmax(8em, 1.4fr)",cell:e=>e.name,compare:e=>e.name.toLowerCase()},{key:"vr",label:"VR",className:"tags-vr",width:"2.4em",cell:e=>e.vr,compare:e=>e.vr},{key:"value",label:"VALUE",className:"tags-value-cell",width:"minmax(6em, 2fr)",cell:e=>this.value_cell(e),compare:e=>(e.phi&&this.redact?N0:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Du(()=>!0),{key:"item",label:"ITEM",className:"tags-item-name",width:"minmax(12em, 1fr)",cell:e=>`ITEM ${e.index}`,compare:e=>e.index},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}}function Du(s){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const t=document.createElement("span");return t.className=s(e)?"tags-fold":"tags-fold tags-fold-none",t}}}function tP(s){const e=new Map;for(const t of s.constant){const i=t.group;e.has(i)||e.set(i,[]),e.get(i)?.push(Zy(t,`${i}/${t.tag}`))}return s.varying.length>0&&e.set("varying",s.varying.map(t=>({tag:t.tag,name:t.name,vr:t.vr,value:t.distinct===1?t.first:`${t.first} .. ${t.last}`,phi:t.phi,items:[],distinct:t.distinct,key:`varying/${t.tag}`}))),Xy.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function Zy(s,e){return{tag:s.tag,name:s.name,vr:s.vr,value:s.value,...s.decoded!==void 0?{decoded:s.decoded}:{},phi:s.phi,items:(s.items??[]).map((t,i)=>({index:i+1,key:`${e}/${i+1}`,rows:t.map(n=>Zy(n,`${e}/${i+1}/${n.tag}`))})),key:e}}function sP(s){const e=s.path.replace(/\/$/,"").split("/").pop()??s.path;if(s.subject==="folder")return e.length>24?`${e.slice(0,22)}…`:e;const t=/^(\d+)-/.exec(e)?.[1];return t!==void 0?`INSTANCE ${Number(t)}`:e.length>24?`${e.slice(0,22)}…`:e}function iP(s){const e=(s.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function nP(s){const e=document.createElement("div");return e.className="tags-note",e.textContent=s,e}function Ec(s,e){const t=s.querySelector(e);if(t===null)throw new Error(`tags pane: missing ${e}`);return t}function rP(s,e){const t=Pi("tpl-pane-image"),i=new JG(t,{source:{url_of:n=>s.vfsUrl_build(n)},note:n=>s.terminal().line_note(n),regard:n=>s.subjects().regard_write(e,{address:n,modelKind:"dicom.instance"}),file_put:async(n,r)=>{try{return(await fetch(s.vfsUrl_build(n),{method:"POST",body:r})).status}catch{return 0}},tags_read:n=>pg(s,n),tags_open:()=>{s.terminal().line_note(Jy(s,e))}});return s.panels().set("image",e,i),{id:e,kind:"image",mount:t,dispose:()=>{i.dispose(),s.panels().delete(e),s.subjects().pane_leave(e)}}}function oP(s,e){const t=Pi("tpl-pane-tags"),i=new eP(t,{note:n=>s.terminal().line_note(n)});return s.panels().set("tags",e,i),{id:e,kind:"tags",mount:t,dispose:()=>{s.panels().delete(e),s.subjects().pane_leave(e)}}}async function pg(s,e){try{const t=await s.client().line_execute(`dcm tags "${e}"`,{silent:!0,observe:!1});for(const i of t.envelopes){if(i.model?.kind!==Yo.tags)continue;const n=Nv.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}function aP(s,e,t){const i=s.panels().get("tags",e);i===void 0||i.path_get()===t||pg(s,t).then(n=>{if(n===null){s.terminal().line_note(`tags: ${t}: not a readable DICOM file`);return}s.panels().get("tags",e)?.model_show(n)})}function Jy(s,e){const t=new Set(s.layout().panes_shown()),i=s.subjects().group_of(e);for(const r of s.panels().ids("tags"))if(t.has(r)&&s.subjects().group_of(r)===i)return s.layout().focus_set(r),"image tags";if(!t.has(e))return"image tags: the image pane is not on stage";const n=s.instance_spawn("tags",e);return s.layout().leaf_split(e,s.desktop().replayPlace_get()?.dir??"col",n.id,s.desktop().replayPlace_get()?.before??!1)?(s.birth_record(n.id,e,s.desktop().replayPlace_get()?.dir??"col",s.desktop().replayPlace_get()?.before??!1),"image tags"):(Ds(n.id),s.layout().mount_remove(n.id),"image tags: could not open beside the image pane")}async function Dp(s,e){try{const t=await s.client().line_execute(`dcm series "${e}"`,{silent:!0,observe:!1});for(const i of t.envelopes){if(i.model?.kind!==Yo.series)continue;const n=Gv.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}async function Qy(s,e){try{const t=await s.client().line_execute(`ls "${e}"`,{silent:!0,observe:!1});for(const i of t.envelopes){if(i.model?.kind!=="fs.listing")continue;const n=i.model.data,r=(Array.isArray(n)?n[0]:n)??{},o=(r.path??e).replace(/\/$/,"");return(r.items??[]).filter(a=>a.type==="dir").map(a=>`${o}/${a.name}`)}}catch{}return[]}function ez(s,e,t){const i=l=>{t!==void 0&&s.subjects().regard_write(l,t)};if(e!==null&&s.panels().has("image",e))return i(e),s.panels().get("image",e)??null;const n=new Set(s.layout().panes_shown());if(t!==void 0){for(const[l,c]of s.panels().entries("image"))if(n.has(l)&&s.subjects().regard_get(l)?.address===t.address)return i(l),c}const r=e!==null?s.subjects().group_of(e):null;for(const[l,c]of s.panels().entries("image"))if(n.has(l)&&r!==null&&s.subjects().group_of(l)===r)return c;const o=e!==null&&n.has(e)?e:s.errandHost_find();if(o===null)return null;const a=s.instance_spawn("image",e??void 0);return s.layout().leaf_split(o,s.desktop().replayPlace_get()?.dir??"col",a.id,s.desktop().replayPlace_get()?.before??!1)?(s.birth_record(a.id,o,s.desktop().replayPlace_get()?.dir??"col",s.desktop().replayPlace_get()?.before??!1),i(a.id),s.panels().get("image",a.id)??null):(Ds(a.id),s.layout().mount_remove(a.id),null)}async function lP(s,e,t,i={},n){s.launcher_yield();const r=e!==null?void 0:yf.test(t)?{address:t,modelKind:"image.volume"}:{address:yh.test(t)?t.slice(0,t.lastIndexOf("/")):t.replace(/\/$/,""),modelKind:"dicom.series"},o=ez(s,e,r);if(o===null)return"image: no pane to open beside";const a=s.panels().idOf("image",o);if(a!==null&&n?.(a),yf.test(t))return o.opening_show(t),o.volume_show(t),`image ${t}`;const l=yh.test(t),c=l?t.slice(0,t.lastIndexOf("/")):t.replace(/\/$/,"");o.opening_show(c);let h=await Dp(s,c),d=[];if(h===null&&!l){const p=(await Qy(s,c)).slice(0,32);for(const f of p){const _=await Dp(s,f);if(_!==null){d=p.map(g=>({path:g,label:g.split("/").pop()??g})),h=_;break}}}if(h===null)return o.opening_fail(t,"NOT A READABLE SERIES"),`image: ${t}: not a readable DICOM series, study, or volume`;const u=l?Math.max(1,h.files.indexOf(t)+1):1;return o.series_show(h,{siblings:d,startAt:u,...i.force===!0?{force:!0}:{}}),`image ${h.path}${d.length>1?` (1 of ${d.length} series)`:""}`}function cP(s){return{imageInstance_build:e=>rP(s,e),tagsInstance_build:e=>oP(s,e),tags_ask:e=>pg(s,e),tagsPane_follow:(e,t)=>aP(s,e,t),tagsPane_open:e=>Jy(s,e),series_ask:e=>Dp(s,e),subfolders_ask:e=>Qy(s,e),imagePane_for:(e,t)=>ez(s,e,t),image_open:(e,t,i={},n)=>lP(s,e,t,i,n)}}function hP(s){return{primaries:[s.panes.dag_build("dag",!0),s.panes.universe_build("universe"),{id:"pacs",kind:"pacs",mount:s.pacsMount}],domains:["dag","pacs"],presets:[["pacs",()=>({pane:"pacs"})],["dag",()=>({pane:"dag"})],["universe",()=>({pane:"universe"})]],factories:[["dag",e=>s.panes.dag_build(e,!1)],["universe",s.panes.universe_build],["image",s.dicom.imageInstance_build],["tags",s.dicom.tagsInstance_build],["gather",s.gather_build]]}}function dP(s){return async()=>{const e=await s.ask("proc feeds");let t=[];for(const d of e.envelopes){const u=d.model;if(u===void 0||u.kind!==pf)continue;const p=ff.safeParse(u.data);p.success&&(t=p.data.feeds)}const n=t.length===0&&e.envelopes.some(d=>d.status==="error")?"INDEX WARMING":`${t.length} FEEDS`,r=t.filter(d=>/error/i.test(d.status)).length,o=t.filter(d=>/running|scheduled|created|started/i.test(d.status)).length,a={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:n}],rows:[],verb:"SEE THE SPACE",about:ir.universe,enter:()=>s.universe_show()},l={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:n},...o>0?[{text:`${o} RUNNING`}]:[],...r>0?[{text:`${r} ERRORED`,errored:!0,open:()=>s.runs_show("status:error")}]:[]],rows:t.slice(0,6).map(d=>({text:`${d.id} ${d.title}`,errored:/error/i.test(d.status),open:()=>s.feed_enter(d.id)})),verb:"OPEN THE ROSTER",about:ir.analyses,enter:()=>s.runs_show()},c=s.pacs_query(),h={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:c===""?"NO ANSWER":"ANSWERED"}],rows:c===""?[{text:"pacs query PatientID:…",open:()=>s.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>s.line_offer("pacs query AccessionNumber:")}]:[{text:c.slice(0,48)}],verb:"ASK A PACS",about:ir.pacs,enter:()=>s.pacs_open()};return{lead:{tile:l,weight:t.length},afterFiles:[h],afterPanes:[a],about:{files:{text:"Your ChRIS home: uploads, results and what others shared with you."}}}}}function uP(s){return s>=6e4?`${Math.max(1,Math.round(s/6e4))} MIN`:`${Math.max(1,Math.round(s/1e3))} S`}function _i(s){return s.toLocaleString("en-US")}class fP{mount;counts=null;context=null;msPerPage=null;walkSamples=new Map;clock;acts;state=void 0;constructor(e,t=()=>Date.now(),i={}){this.mount=e,this.clock=t,this.acts=i,this.render()}state_show(e){this.state=e,this.render()}pace_show(e){this.msPerPage=e,this.render()}eta_of(e,t,i){const n=this.clock(),r=this.walkSamples.get(e);let o=r?.rowsPerMs??null;r!==void 0&&t>r.loaded&&n>r.at&&(o=(t-r.loaded)/(n-r.at)),(r===void 0||t!==r.loaded)&&this.walkSamples.set(e,{loaded:t,at:n,rowsPerMs:o});const a=Math.max(0,i-t);return i<=0?null:o!==null&&o>0?a/o:this.msPerPage!==null&&this.msPerPage>0?Math.ceil(a/100/4)*this.msPerPage:null}counts_show(e){this.counts=e,this.render()}promptContext_show(e){this.context=e,e.procIndex!==void 0&&(this.counts={jobs:e.procIndex.jobs,feeds:e.procIndex.feeds}),this.render()}rows_compose(){const e=[],t=this.context?.procWarmup,i=this.context?.warmupFailures??[],n=t!==void 0&&t.sweeping!==!1,r=this.counts!==null?`${_i(this.counts.jobs)} JOBS · ${_i(this.counts.feeds)} FEEDS`:"";if(i.length>0)e.push({label:"INDEX",bar:null,value:`${r}${r?" · ":""}FAILED: ${i.map(l=>l.label.toUpperCase()).join(" ")}`,title:i.map(l=>`${l.label}: ${l.message}`).join(`
|
|
4292
4292
|
`),degraded:!0});else if(n&&t!==void 0){const l=(t.state??"cold").toUpperCase();e.push({label:"INDEX",bar:{loaded:t.loaded,total:t.total??0,state:t.state==="failed"?"failed":"running"},value:`SWEEP ${_i(t.loaded)} / ${t.total!==void 0?_i(t.total):"?"} · ${l}`,title:"The global topology sweep: every plugin instance CUBE holds, walked page by page.",degraded:t.state==="failed"})}else e.push({label:"INDEX",bar:null,value:r?`${r} · CURRENT`:"CURRENT",title:"Nothing is moving: the process index is whole and current.",degraded:!1});if(this.state!==void 0){const l=this.state;e.push({label:"RUNNING",bar:null,value:`${_i(l.running)} IN ${_i(l.runningFeeds)} FEEDS · SCHEDULED ${_i(l.scheduled)}`,title:"Jobs running and waiting across every feed the index holds, from the roster's own counters.",degraded:!1,verb:this.acts.errored_open!==void 0?{label:`ERRORED ${_i(l.errored)} IN ${_i(l.erroredFeeds)} FEEDS`,title:"Open the runs roster filtered to the feeds with errored jobs.",act:this.acts.errored_open}:null})}const o=t?.feeds??(t?.feed!==void 0?[t.feed]:[]);for(const l of Array.from(this.walkSamples.keys()))o.some(c=>c.id===l)||this.walkSamples.delete(l);for(const l of o){const c=l.total>0?_i(l.total):"?";if(l.failed!==void 0)e.push({label:`FEED ${l.id}`,bar:{loaded:l.loaded,total:l.total,state:"failed"},value:`FAILED AT ${_i(l.loaded)} / ${c} · ${l.failed.toUpperCase()}`,title:"The walk stopped; the next visit to the feed starts it again.",degraded:!0});else{const h=this.eta_of(l.id,l.loaded,l.total);e.push({label:`FEED ${l.id}`,bar:{loaded:l.loaded,total:l.total,state:"running"},value:`INDEXING ${_i(l.loaded)} / ${c}${h!==null?` · ETA ${uP(h)}`:""}`,title:"A feed is being indexed on its first visit; it opens when the walk lands.",degraded:!1})}}t?.roster!==void 0&&e.push({label:"ROSTER",bar:null,value:t.roster==="full"?"FULL WALK · every feed the identity can see":"DELTA · feeds newer than the roster knows",title:"The roster is being brought up to date; the listing answered from the cache and refreshes when arrivals land.",degraded:!1});const a=t?.arrived??[];return a.length>0&&e.push({label:"ARRIVED",bar:null,value:a.length<=3?a.map(l=>`FEED ${l}`).join(" · "):`${a.length} FEEDS`,title:"Feeds the roster gained: created here, or shared with this identity.",degraded:!1}),e}render(){const e=this.rows_compose();this.mount.replaceChildren();for(const t of e){const i=document.createElement("div");i.className="index-row telemetry-row",i.classList.toggle("status-degraded",t.degraded),i.title=t.title;const n=document.createElement("span");if(n.className="telemetry-label",n.textContent=t.label,i.appendChild(n),t.bar!==null){const o=document.createElement("span");o.className=`index-bar listing-progress listing-progress-${t.bar.state}`;const a=document.createElement("span");a.className="listing-progress-fill";const l=t.bar.total>0?Math.min(100,Math.round(t.bar.loaded/t.bar.total*100)):0;a.style.width=`${l}%`,o.appendChild(a),i.appendChild(o)}const r=document.createElement("span");if(r.className="telemetry-value",r.textContent=t.value,i.appendChild(r),t.verb!==void 0&&t.verb!==null){const o=document.createElement("button");o.type="button",o.className="index-verb pacs-capsule",o.textContent=t.verb.label,o.title=t.verb.title,o.addEventListener("click",t.verb.act),i.appendChild(o)}this.mount.appendChild(i)}}}function pP(s,e){const t=new fP(s,()=>Date.now(),{errored_open:()=>e.runs_show("status:error")});return{promptContext_take:i=>{t.promptContext_show(i),e.dag_primary().promptContext_observe(i);for(const n of e.universes())n.promptContext_observe(i)},telemetry_take:(i,n)=>{t.counts_show(i),n?.state!==void 0&&t.state_show(n.state),n?.cube!==void 0&&t.pace_show(n.cube.msPerPage)},progress_take:i=>{for(const n of e.dag_instances())n.progress_observe(i);e.pacs().progress_observe(i)}}}class mP{container;title;handlers;currentAddress=null;constructor(e,t,i){this.container=e,this.title=t,this.handlers=i,this.awaiting_render()}regard_show(e){if(this.currentAddress=e.address,this.title.textContent=`VIEWER — ${e.address}`.toUpperCase(),this.handlers.path_isImage(e.address)){this.container.replaceChildren();const t=document.createElement("img");t.className="files-image",t.src=this.handlers.imageUrl_build(e.address),t.alt=e.address,this.container.appendChild(t);return}this.handlers.content_fetch(e.address).then(t=>{if(this.currentAddress!==e.address)return;if(this.container.replaceChildren(),t.trim().length===0){const n=document.createElement("p");n.className="files-empty",n.textContent=`NO PREVIEW — ${e.address.toUpperCase()}`,this.container.appendChild(n);return}const i=document.createElement("pre");i.className="files-content",i.textContent=t,this.container.appendChild(i)})}awaiting_render(){this.container.replaceChildren();const e=document.createElement("p");e.className="files-empty",e.textContent="NO REGARD — INDICATE A FILE OR NODE IN THIS PANE’S GROUP",this.container.appendChild(e)}}class gP{groups=new Map;membership=new Map;writeObserver=null;writeObserver_set(e){this.writeObserver=e}pane_join(e,t){this.pane_leave(e),this.membership.set(e,t),this.groups.has(t)||this.groups.set(t,{value:null,subscribers:new Map,viewers:new Set})}pane_leave(e){const t=this.membership.get(e);if(t===void 0)return;this.membership.delete(e);const i=this.groups.get(t);if(i!==void 0){i.subscribers.delete(e),i.viewers.delete(e);for(const n of this.membership.values())if(n===t)return;this.groups.delete(t)}}group_of(e){const t=this.membership.get(e);return t!==void 0?t:(this.pane_join(e,e),e)}viewer_mark(e){this.groups.get(this.group_of(e))?.viewers.add(e)}groupHasViewer(e){const t=this.groups.get(this.group_of(e));return t!==void 0&&t.viewers.size>0}regard_write(e,t){const i=this.group_of(e),n=this.groups.get(i),r={...t,paneId:e};n.value=r;for(const o of n.subscribers.values())o(r);this.writeObserver?.(r,i)}regard_subscribe(e,t){const i=this.groups.get(this.group_of(e));i.subscribers.set(e,t),i.value!==null&&t(i.value)}regard_get(e){return this.groups.get(this.group_of(e))?.value??null}}const Tu=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],_P=new Set(["done","error","unconfirmed","stalled","timeout"]);function bP(s,e){const t=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const i=`${e.operation}:`;for(const n of[...s])(n===t||n.startsWith(i))&&s.delete(n);return}if(e.itemId!==void 0&&e.status!==void 0&&_P.has(e.status)){s.delete(t);return}s.add(t)}const MP=100;class vP{fields;buildShown=!1;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:qn(e,"status-identity"),jobs:qn(e,"status-jobs"),activity:qn(e,"status-activity"),latency:qn(e,"status-latency"),mismatch:qn(e,"status-mismatch"),lamp:qn(e,"status-lamp"),host:qn(e,"status-host"),questions:qn(e,"status-questions")}}attach_show(e){if(e.protocolVersion!==rf){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${rf}`,this.fields.mismatch.title="This surface and the daemon speak different contract versions. Some messages may be dropped.",this.hostControl_show(e.hostControl??[]);return}this.fields.mismatch.textContent="",this.fields.mismatch.title=e.stack!==void 0?`chell ${e.stack.chell} · calypso ${e.stack.calypso} · build ${e.stack.build}`:"",this.hostControl_show(e.hostControl??[])}build_show(e,t=""){this.fields.mismatch.textContent!==""&&!this.buildShown||(this.buildShown=e!==null,this.fields.mismatch.textContent=e??"",this.fields.mismatch.title=t)}hostControl_show(e){this.fields.host.textContent=e.length>0?`HOST ${e.join(" ")}`:"",this.fields.host.title=e.length>0?"Calypso was started with --host-control: `!` and pipes run on its host, upload/download reach its disk.":""}questions_show(e){this.fields.questions.textContent=e.length>0?`? ${e.length} WAITING`:"",this.fields.questions.title=e.map(t=>`surface ${t.surface.slice(0,6)} asks "${t.message.trim()}" (${Math.round(t.sinceMs/1e3)} s); its command is paused until answered there`).join(`
|
|
4293
4293
|
`)}promptContext_show(e){const t=e.uri.replace(/^https?:\/\//,"");this.fields.identity.textContent=`${e.user}@${t}`.toUpperCase();const i=e.procWarmup,n=[];if(i!==void 0&&i.sweeping!==!1){const a=i.total!==void 0?`/${i.total}`:"",l=i.state!==void 0?` ${i.state.toUpperCase()}`:"";n.push(`JOBS ${i.loaded}${a}${l}`)}const r=i?.feeds??(i?.feed!==void 0?[i.feed]:[]);for(const a of r){const l=a.total>0?`/${a.total}`:"";n.push(a.failed!==void 0?`FEED ${a.id} FAILED ${a.loaded}${l}`:`FEED ${a.id} ${a.loaded}${l}`)}i?.roster!==void 0&&n.push(i.roster==="full"?"ROSTER WALK":"ROSTER DELTA"),i?.arrived!==void 0&&i.arrived.length>0&&n.push(i.arrived.length<=2?`+FEED ${i.arrived.join(" ")}`:`+${i.arrived.length} FEEDS`);const o=e.warmupFailures??[];o.length>0&&n.push(`WARM-UP FAILED: ${o.map(a=>a.label.toUpperCase()).join(" ")}`),this.fields.jobs.textContent=n.join(" · "),this.fields.jobs.classList.toggle("status-degraded",o.length>0),this.fields.jobs.title=o.length>0?o.map(a=>`${a.label}: ${a.message}`).join(`
|
|
4294
4294
|
`):r.length>0?"A feed is being indexed on its first visit; it opens when the walk completes.":"",this.fields.latency.textContent=e.lastCommandDurationMs>0?`${e.lastCommandDurationMs}MS`:""}progress_observe(e){bP(this.running,e),this.activity_paint()}activity_clear(){this.running.clear(),this.activity_paint()}connection_show(e){this.fields.lamp.textContent=e?"ONLINE":"OFFLINE",this.fields.lamp.classList.toggle("lamp-online",e),this.fields.lamp.classList.toggle("lamp-offline",!e),e||this.activity_clear()}activity_paint(){if(this.running.size===0){this.activityTimer!==null&&(clearInterval(this.activityTimer),this.activityTimer=null),this.fields.activity.textContent="";return}const e=()=>{const t=Tu[this.activityFrame]??Tu[0];this.fields.activity.textContent=`${t} ${this.running.size} RUNNING`};e(),this.activityTimer===null&&(this.activityTimer=window.setInterval(()=>{this.activityFrame=(this.activityFrame+1)%Tu.length,e()},MP))}}function qn(s,e){const t=s.getElementById(e);if(t===null)throw new Error(`status bar: no element with id '${e}'`);return t}const wP=3e3;class yP{mount;clock;lane=void 0;cube=void 0;beatAt=null;constructor(e,t=()=>Date.now()){this.mount=e,this.clock=t,this.render()}telemetry_show(e={}){this.beatAt=this.clock(),e.lane!==void 0&&(this.lane=e.lane),e.cube!==void 0&&(this.cube=e.cube),this.render()}tick(){this.render()}rows_compose(){const e=[],t=this.lane;if(t===void 0)e.push({label:"LANE",value:"—",title:"The daemon has not said what holds its lane (an older daemon).",degraded:!1});else if(t.running===null)e.push({label:"LANE",value:t.waiting>0?`IDLE · ${t.waiting} WAITING`:"IDLE",title:"The serialized command lane: nothing is executing.",degraded:!1});else{const r=(t.running.sinceMs/1e3).toFixed(1);e.push({label:"LANE",value:`${t.running.line} · ${r} S${t.waiting>0?` · ${t.waiting} WAITING`:""}`,title:`The command holding the lane${t.running.surface?`, from surface ${t.running.surface}`:""}; every other command waits behind it.`,degraded:t.running.sinceMs>=1e4})}const i=t?.questions??[];if(i.length>0){const r=i.reduce((o,a)=>o.sinceMs>=a.sinceMs?o:a);e.push({label:"ASKING",value:`${i.length} · ${r.message.trim()} · ${(r.sinceMs/1e3).toFixed(0)} S`,title:"Questions open in the session. A command waiting on one has stepped out of the lane; it resumes when answered on the surface that asked.",degraded:!1})}if(this.beatAt===null)e.push({label:"BEAT",value:"NONE YET",title:"No telemetry heartbeat has landed.",degraded:!1});else{const r=Math.max(0,this.clock()-this.beatAt);e.push({label:"BEAT",value:`${(r/1e3).toFixed(1)} S AGO`,title:"The age of the last telemetry heartbeat; the daemon beats once a second while a surface is attached.",degraded:r>=wP})}const n=this.cube;if(n===void 0)e.push({label:"CUBE",value:"NO PAGE TIMED",title:"CUBE's pace is known once a page of a list has been fetched.",degraded:!1});else{const r=n.msPerPage>0?Math.round(6e4/n.msPerPage):0;e.push({label:"CUBE",value:`${(n.msPerPage/1e3).toFixed(1)} S/PAGE · ${r} PAGES/MIN`,title:`The median of the last ${n.samples} page fetches (100 rows each).`,degraded:!1})}return e}render(){const e=this.rows_compose();this.mount.replaceChildren();for(const t of e){const i=document.createElement("div");i.className="lane-row telemetry-row",i.classList.toggle("status-degraded",t.degraded),i.title=t.title;const n=document.createElement("span");n.className="telemetry-label",n.textContent=t.label;const r=document.createElement("span");r.className="telemetry-value",r.textContent=t.value,i.append(n,r),this.mount.appendChild(i)}}}const zP=[2,3,3,2,2,11,2,2],SP=4,G0=300,xP=2600,OP=650;class EP{wrapper;cells=[];bootedAt=Date.now();telemetry={jobsLoaded:0,jobsTotal:0,feeds:0,lastLatencyMs:0,latencySumMs:0,lastExitCode:0,commandsRun:0,opsActive:0,opsDone:0,opsFailed:0,itemsCurrent:0,itemsTotal:0,connected:0};activeOperations=new Set;telemetryRows=[];constructor(e){if(this.wrapper=e,e===null){window.setInterval(()=>this.beat_paint(),G0);return}const t=this.narrowSources_list(),i=this.wideSources_list();let n=0,r=0;for(const o of zP){const a=document.createElement("div");a.className="data-column";for(let l=1;l<=SP;l++){const c=document.createElement("div");c.className=`dc-row-${l}`;let h;o>=6?(h=i[r%i.length],r++):(h=t[n%t.length],n++);const d={element:c,width:o,source:h??(()=>0)};c.textContent=P0(d.source(),o),a.appendChild(c),this.cells.push(d)}e.appendChild(a)}window.setInterval(()=>this.beat_paint(),G0),this.sweep_start()}promptContext_observe(e){const t=e.procWarmup;t!==void 0&&(this.telemetry.jobsLoaded=t.loaded,this.telemetry.jobsTotal=t.total??t.loaded);const i=e.procIndex;i!==void 0&&(t===void 0&&(this.telemetry.jobsLoaded=i.jobs,this.telemetry.jobsTotal=i.jobs),this.telemetry.feeds=i.feeds),e.lastCommandDurationMs>0&&(this.telemetry.lastLatencyMs=e.lastCommandDurationMs,this.telemetry.latencySumMs+=e.lastCommandDurationMs,this.telemetry.commandsRun++),this.telemetry.lastExitCode=e.lastExitCode}progress_observe(e){const t=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const i=`${e.operation}:`;for(const n of[...this.activeOperations])(n===t||n.startsWith(i))&&this.activeOperations.delete(n);e.status==="error"||e.phase==="failed"?this.telemetry.opsFailed++:this.telemetry.opsDone++}else e.itemId!==void 0&&e.status!==void 0&&["done","error","unconfirmed","stalled","timeout"].includes(e.status)?this.activeOperations.delete(t):this.activeOperations.add(t);this.telemetry.opsActive=this.activeOperations.size,e.current!==void 0&&(this.telemetry.itemsCurrent=e.current),e.total!==void 0&&(this.telemetry.itemsTotal=e.total)}index_observe(e){this.telemetry.jobsLoaded=e.jobs,this.telemetry.jobsTotal=e.jobs,this.telemetry.feeds=e.feeds}connection_show(e){this.telemetry.connected=e?1:0,this.wrapper?.classList.toggle("dc-stale",!e)}telemetryPanel_bind(e){const t=this.telemetry,i=[["LINK",()=>t.connected===1?"ONLINE":"OFFLINE"],["JOBS INDEXED",()=>`${t.jobsLoaded} / ${t.jobsTotal}`],["FEEDS VISIBLE",()=>String(t.feeds)],["OPS ACTIVE",()=>String(t.opsActive)],["OPS DONE",()=>String(t.opsDone)],["OPS FAILED",()=>String(t.opsFailed)],["ITEMS",()=>`${t.itemsCurrent} / ${t.itemsTotal}`],["LAST COMMAND",()=>`${t.lastLatencyMs} MS`],["LATENCY SUM",()=>`${t.latencySumMs} MS`],["COMMANDS RUN",()=>String(t.commandsRun)],["LAST EXIT",()=>String(t.lastExitCode)],["UPTIME",()=>`${this.uptimeSeconds_get()} S`]];for(const[n,r]of i){const o=document.createElement("div");o.className="telemetry-row";const a=document.createElement("span");a.className="telemetry-label",a.textContent=n;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r(),o.append(a,l),e.appendChild(o),this.telemetryRows.push({element:l,source:r})}}narrowSources_list(){const e=this.telemetry;return[()=>e.jobsLoaded,()=>e.feeds,()=>e.lastLatencyMs,()=>e.opsActive,()=>e.opsDone,()=>e.jobsTotal,()=>e.itemsCurrent,()=>e.itemsTotal,()=>e.opsFailed,()=>e.commandsRun,()=>e.lastExitCode,()=>new Date().getSeconds(),()=>this.uptimeSeconds_get()]}wideSources_list(){return[()=>Math.floor(Date.now()/1e3),()=>this.uptimeSeconds_get(),()=>this.telemetry.latencySumMs,()=>AP()]}uptimeSeconds_get(){return Math.floor((Date.now()-this.bootedAt)/1e3)}beat_paint(){for(const e of this.cells){const t=P0(e.source(),e.width);e.element.textContent!==t&&(e.element.textContent=t)}for(const e of this.telemetryRows){const t=e.source();e.element.textContent!==t&&(e.element.textContent=t)}}sweep_start(){if(this.wrapper===null)return;const e=Array.from(this.wrapper.querySelectorAll(".data-column"));window.setInterval(()=>{const t=e[Math.floor(Math.random()*e.length)];t!==void 0&&(t.classList.add("dc-sweep"),window.setTimeout(()=>t.classList.remove("dc-sweep"),OP))},xP)}}function P0(s,e){const t=String(Math.max(0,Math.floor(s)));return t.length>e?t.slice(t.length-e):t.padStart(e,"0")}function AP(){const s=new Date;return s.getHours()*1e4+s.getMinutes()*100+s.getSeconds()}const DP=2e4;class TP{scene;nameplate;command_run;names=[];cursor=0;timer=null;seen=new Map;constructor(e,t,i){this.nameplate=t,this.command_run=i,this.scene=new pd(e,{},{ambient:!0}),new MutationObserver(()=>this.scene.palette_refresh()).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),new MutationObserver(()=>{window.setTimeout(()=>this.scene.size_fit(),60)}).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.addEventListener("resize",()=>this.scene.size_fit())}names_set(e){this.names=e,this.cursor=0,this.timer!==null&&(window.clearInterval(this.timer),this.timer=null),e.length!==0&&(this.next_request(),e.length>1&&(this.timer=window.setInterval(()=>this.next_request(),DP)))}envelope_observe(e){if(e.model?.kind!==cr.pipelineDiagram)return;const t=xm.safeParse(e.model.data);if(!t.success)return;const i=t.data;this.seen.set(i.name,i),this.model_stage(i)}model_stage(e){this.nameplate.textContent=e.name,this.scene.graph_set({nodes:e.nodes.map(t=>({id:t.id,label:t.label,parentIds:t.parentIds,joinParentIds:t.joinParentIds}))}),this.scene.size_fit()}next_request(){const e=this.names[this.cursor%this.names.length];if(this.cursor++,e===void 0)return;const t=this.seen.get(e);if(t!==void 0){this.model_stage(t);return}this.command_run(`pipeline diagram ${e}`)}}function IP(s,e){s.line_execute("ls /bin",{silent:!0,observe:!1}).then(t=>{const r=(t.envelopes.find(o=>o.model?.kind==="fs.listing")?.model?.data??[]).flatMap(o=>o.items).filter(o=>o.type==="pipeline").map(o=>o.name);e.names_set(r)})}const L0=new Set(["layout","slice","series","wl","colormap","save","tags","load","guard","ghost","state"]);function CP(s,e,t,i,n){if(t==="layout")return Gr(s,e,".dag-strategy",i.toUpperCase())?`layout ${i}`:"dag layout ranked|molecule";if(t==="projection")return Gr(s,e,".dag-projection",i.toUpperCase())?`projection ${i}`:"dag projection 2d|3d";if(t==="scale")return Gr(s,e,".dag-scale",i.toUpperCase())?`scale ${i}`:"dag scale time|size";if(t==="hue")return Gr(s,e,".dag-hue",i.toUpperCase())?`hue ${i}`:"dag hue status|compute";const r=(o,a,l,c)=>{const h=i.toLowerCase();return h==="on"||h==="off"?Gr(s,e,o,h==="on"?l:c)?`${a} ${h}`:`dag ${a}: no mode frame`:h!==""?`dag ${a} on|off`:yn(s,e,o)?`${a} toggled`:`dag ${a}: no mode frame`};if(t==="pulse")return r(".dag-pulse","pulse","PULSE ON","PULSE OFF");if(t==="census")return r(".dag-census","census","CENSUS","SHAPE");if(t==="gravity")return r(".dag-gravity","gravity","GRAVITY ON","GRAVITY OFF");if(t==="draw")return Gr(s,e,".dag-draw",i.toUpperCase())?`draw ${i}`:"dag draw spheres|stars";if(t==="select")return i===""?"dag select <feed or job>":s.dag_jump(e,i)?`selecting ${i}`:"dag select: no RUNS pane (view runs)";if(t==="enter")return i===""?"dag enter <job>":s.dag_jump(e,i,!0)?`entering ${i}`:"dag enter: no RUNS pane (view runs)";if(t==="refresh")return Fc(s,e,"REFRESH")?"refreshing":"dag refresh: no DAG pane";if(t==="physics"){const o=i,a=s.paneMount_get(e),l=a?.querySelector(".pane-dag")??a;if(l===null)return"dag physics: no DAG pane";if(o==="reset")return l.dispatchEvent(new CustomEvent("argus:dag-physics",{detail:"reset"})),"physics reset";const c=(n[2]??"on").toLowerCase()!=="off";return["charge","link","collide","gravity"].includes(o)?(l.dispatchEvent(new CustomEvent("argus:dag-physics",{detail:{term:o,on:c}})),`physics ${o} ${c?"on":"off"}`):`dag physics: unknown term '${o}' (charge|link|collide|gravity|reset)`}return`dag: unknown verb '${t}' (layout|projection|scale|hue|draw|pulse|census|gravity|select|enter|physics|refresh)`}function RP(s,e,t){return t==="enter"?Fc(s,e,"ENTER NODE")?"entering node":"node enter: no DAG drawer":t==="back"?Fc(s,e,"BACK")?"node back":"node back: no DAG drawer":t==="immerse"?s.node_immerse(e)?"immersing":"node immerse: nothing indicated":t==="clear"?Fc(s,e,"CLEAR DETAIL")?"detail cleared":"node clear: no DAG drawer":`node: unknown verb '${t}' (enter|immerse|back|clear)`}function kP(s){return{subjects:{runs:null,node:null,dag:null,universe:null,pacs:new Set(["sort","filter"]),tags:new Set(["redact","filter"]),image:L0},views:{runs:{button:"gutter-runs",primary:"dag"},pacs:{button:"gutter-tools",primary:"pacs"}},claims:{runs:".empty-go-dag",pacs:".empty-go-pacs"},listings:{runs:{selector:".pane-dag",named:"DAG"},pacs:{selector:"#pacs-workspace",named:"PACS"}},chords:[{after:"1",key:"2",topic:"claim",selector:".empty-go-dag",does:"claim an empty pane as RUNS"},{after:"1",key:"3",topic:"claim",selector:".empty-go-pacs",does:"claim an empty pane as PACS"}],lines:[{after:"view",line:"runs enter <feedId> · sort <col> [asc|desc] · filter <text>|off"},{after:"view",line:"node enter · immerse · back · clear (the indicated node)"},{after:"view",line:"dag [@id] layout ranked|molecule · projection 2d|3d · scale time|size · hue status|compute · draw spheres|stars · pulse [on|off] · census [on|off] · gravity [on|off] · select <feed or job> · enter <job> · physics charge|link|collide|gravity on|off · physics reset · refresh"},{after:"file",line:"pacs sort <col> [asc|desc] · filter <text>|off (the results listing; every other pacs verb is the session's)"},{after:"file",line:"image [@id] [--force] <path> · layout single|mpr|3d|slab · slice <n> · series <n> · wl <lo> <hi> · wl preset <name> · colormap gray|hot|jet|cool · save · tags · load · guard <bytes>|off · ghost <0..1>|off · state"},{after:"file",line:"tags [@id] redact on|off · filter <text>|off (the pane that follows an image pane's slice)"}],run:(e,t,i)=>{const n=s(),{subject:r,words:o}=t,a=(o[0]??"").toLowerCase(),l=(o[1]??"").toLowerCase();if(r==="runs"){if(a==="enter"){const h=parseInt(l.replace(/^feed_/,""),10);return Number.isNaN(h)?"runs enter <feedId>":(n.feed_enter(h),`entering feed_${h}`)}return`runs: unknown verb '${a}' (enter)`}if(!["dag","image","tags","universe","node"].includes(r))return;const c=i();if(c===null)return`${r}: no target pane (nothing focused?)`;if(r==="dag")return CP(n,c,a,l,o);if(r==="image"){const h=o.filter(d=>d!=="--force");return L0.has((h[0]??"").toLowerCase())?n.image_control(c,a,o.slice(1)):null}return r==="tags"?n.tags_control(c,a,o.slice(1)):r==="universe"?n.universe_control(c,a,o.slice(1)):RP(n,c,a)}}}function zl(s,e){if("pane"in s)return s.pane===e?[]:null;const t=zl(s.first,e);if(t!==null)return[{node:s,side:"first"},...t];const i=zl(s.second,e);return i!==null?[{node:s,side:"second"},...i]:null}function Sl(s,e,t){if(s===e)return t;if("pane"in s)return null;const i=Sl(s.first,e,t);if(i!==null)return{...s,first:i};const n=Sl(s.second,e,t);return n!==null?{...s,second:n}:null}function W0(s,e,t){const i=zl(s,e);if(i===null||i.length===0)return"lone";const n=Ei[t].axis,r=Ei[t].place==="after"?"first":"second",o=i[i.length-1];let a=null;for(let d=i.length-1;d>=0;d-=1){const u=i[d];if(u.node.dir===n&&u.side===r){a=u.side==="first"?u.node.second:u.node.first;break}}if(a===null){if(o.node.dir===n)return"edge";a=o.side==="first"?o.node.second:o.node.first}const l=Lh(s,e);if(l===null)return"lone";const c={pane:e};return Sl(l,a,r==="first"?{dir:n,ratio:.5,first:a,second:c}:{dir:n,ratio:.5,first:c,second:a})??"edge"}const F0="argus-layout";class BP{root;mounts;presets=new Map;prefs={};activePreset="";tree=null;focusedPane=null;renderObserver=null;previousFocus=null;constructor(e,t){this.root=e,this.mounts=t;try{const i=window.localStorage.getItem(F0);this.prefs=i!==null?JSON.parse(i):{}}catch{this.prefs={}}}renderObserver_set(e){this.renderObserver=e}preset_register(e,t){this.presets.set(e,t)}mount_register(e,t){this.mounts.set(e,t)}mount_remove(e){this.mounts.delete(e),this.focusedPane===e&&(this.focusedPane=null)}leaf_split(e,t,i,n=!1){if(this.tree===null)return!1;const r=Ph(this.tree,e,{dir:t,ratio:.5,first:n?{pane:i}:{pane:e},second:n?{pane:e}:{pane:i}});return r===null?!1:(this.tree=r,this.focus_move(i),this.render(),!0)}leaf_move(e,t){if(this.tree===null)return"lone";const i=W0(this.tree,e,t);return typeof i=="string"?i:(this.tree=i,this.focus_move(e),this.render(),!0)}focus_move(e){this.focusedPane!==null&&this.focusedPane!==e&&(this.previousFocus=this.focusedPane),this.focusedPane=e}focus_last(){const e=this.previousFocus;return e===null||!this.panes_shown().includes(e)?null:(this.focus_set(e),e)}leaf_flip(e){if(this.tree===null)return!1;const t=zl(this.tree,e);if(t===null||t.length===0)return!1;const i=t[t.length-1],n={...i.node,dir:i.node.dir==="col"?"row":"col"},r=Sl(this.tree,i.node,n);return r===null?!1:(this.tree=r,this.render(),!0)}leaf_resize(e,t,i=.05){if(this.tree===null)return!1;const n=zl(this.tree,e);if(n===null||n.length===0)return!1;const r=Ei[t].axis;for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a.node.dir!==r)continue;const l=Ei[t].place==="after",c=Math.min(.85,Math.max(.15,a.node.ratio+(l?i:-i))),h={...a.node,ratio:c},d=Sl(this.tree,a.node,h);return d===null?!1:(this.tree=d,this.ratio_remember(n.slice(0,o).map(u=>u.side==="first"?"0":"1").join(""),c),this.render(),!0)}return!1}move_possible(e,t){return this.tree!==null&&typeof W0(this.tree,e,t)!="string"}leaf_replace(e,t){if(this.tree===null)return!1;const i=Ph(this.tree,e,{pane:t});return i===null?!1:(this.tree=i,this.focusedPane===e&&(this.focusedPane=t),this.render(),!0)}leaf_close(e){if(this.tree===null||"pane"in this.tree)return!1;const t=Lh(this.tree,e);return t===null?!1:(this.tree=t,this.focusedPane===e&&(this.focusedPane=null),this.render(),!0)}focused_get(){return this.focusedPane}savedPreset_get(){return this.prefs.preset!==void 0&&this.presets.has(this.prefs.preset)?this.prefs.preset:null}activePreset_get(){return this.activePreset}preset_has(e){return this.presets.has(e)}preset_apply(e){const t=this.presets.get(e);t!==void 0&&(this.activePreset=e,this.prefs.preset=e,this.prefs_save(),this.tree=this.ratios_restore(t(),e,""),this.render(),this.root.classList.remove("layout-arrive"),this.root.offsetWidth,this.root.classList.add("layout-arrive"))}tree_get(){return this.tree===null?null:JSON.parse(JSON.stringify(this.tree))}tree_set(e){this.tree=this.ratios_restore(e,this.activePreset,""),this.render()}panes_shown(){const e=[],t=i=>{if(i!==null){if("pane"in i){e.push(i.pane);return}t(i.first),t(i.second)}};return t(this.tree),e}render(){if(this.tree!==null){for(const e of this.mounts.values())e.remove();this.root.replaceChildren(this.node_render(this.tree,"")),this.focus_reconcile(),this.renderObserver?.()}}focus_reconcile(){const e=this.panes_shown();if(this.focusedPane!==null&&e.includes(this.focusedPane))return;const t=e[0];if(t===void 0)return;const i=this.focusedPane;this.focusedPane=null,this.focus_set(t),i!==null&&(this.previousFocus=i)}node_render(e,t){if("pane"in e){const a=document.createElement("div");a.className="layout-leaf",a.dataset.leaf=e.pane;const l=this.mounts.get(e.pane);return l!==void 0&&(a.appendChild(l),l.style.display="",a.addEventListener("mousedown",()=>this.focus_set(e.pane),{capture:!0}),e.pane===this.focusedPane&&a.classList.add("pane-focused")),a}const i=document.createElement("div");i.className=`layout-split layout-${e.dir}`;const n=this.node_render(e.first,`${t}0`),r=this.node_render(e.second,`${t}1`);n.style.flex=`${e.ratio} 1 0`,r.style.flex=`${1-e.ratio} 1 0`;const o=document.createElement("div");return o.className="layout-divider",this.divider_wire(o,i,e,n,r,t),i.append(n,o,r),i}divider_wire(e,t,i,n,r,o){let a=!1;e.addEventListener("mousedown",l=>{a=!0,l.preventDefault()}),window.addEventListener("mousemove",l=>{if(!a)return;const c=t.getBoundingClientRect(),h=i.dir==="col"?(l.clientX-c.left)/c.width:(l.clientY-c.top)/c.height;i.ratio=Math.min(.85,Math.max(.15,h)),n.style.flex=`${i.ratio} 1 0`,r.style.flex=`${1-i.ratio} 1 0`}),window.addEventListener("mouseup",()=>{a&&(a=!1,this.ratio_remember(o,i.ratio),this.renderObserver?.())})}focus_set(e){if(this.focusedPane===e)return;this.focusedPane!==null&&(this.previousFocus=this.focusedPane),this.focusedPane=e,document.body.dataset.focus=e;for(const i of this.root.querySelectorAll(".layout-leaf"))i.classList.remove("pane-focused");this.mounts.get(e)?.parentElement?.classList.add("pane-focused")}ratios_restore(e,t,i){if("pane"in e)return e;const n=this.prefs.ratios?.[`${t}:${i}`];return{...e,ratio:n??e.ratio,first:this.ratios_restore(e.first,t,`${i}0`),second:this.ratios_restore(e.second,t,`${i}1`)}}ratio_remember(e,t){this.prefs.ratios={...this.prefs.ratios??{},[`${this.activePreset}:${e}`]:t},this.prefs_save()}prefs_save(){try{window.localStorage.setItem(F0,JSON.stringify(this.prefs))}catch{}}}function Ph(s,e,t){if("pane"in s)return s.pane===e?t:null;const i=Ph(s.first,e,t);if(i!==null)return{...s,first:i};const n=Ph(s.second,e,t);return n!==null?{...s,second:n}:null}function Lh(s,e){if("pane"in s)return null;if("pane"in s.first&&s.first.pane===e)return s.second;if("pane"in s.second&&s.second.pane===e)return s.first;const t=Lh(s.first,e);if(t!==null)return{...s,first:t};const i=Lh(s.second,e);return i!==null?{...s,second:i}:null}const NP=4e3;function GP(s){const e=new WeakMap,t=(a,l)=>{const c=s.paneInstance_get(a)?.mount.querySelector(".pane-state")??null;if(c===null)return;const h=e.get(c);h!==void 0&&clearTimeout(h);const d={text:c.textContent??"",className:c.className};zs(c,"note",l),e.set(c,setTimeout(()=>{e.delete(c),c.textContent===l&&(c.className=d.className,c.textContent=d.text)},NP))};return{bar_note:t,move:(a,l)=>{const c=s.layout.leaf_move(a,l);return c==="lone"?"pane move: the only pane on stage":c==="edge"?`pane move ${l}: already ${Ei[l].edge}`:(t(a,`MOVED ${l.toUpperCase()}`),s.sound("audio3"),`moved ${l}`)},flip:a=>s.layout.leaf_flip(a)?(t(a,"FLIPPED"),s.sound("audio3"),"flipped"):"pane flip: the only pane on stage",resize:(a,l,c)=>s.layout.leaf_resize(a,l,c)?`resized ${Ei[l].focusWord}`:`pane resize ${Ei[l].focusWord}: no boundary that way`,chordKeys_of:(a,l)=>{const c=tn.filter(h=>h.selector===a&&h.move===!0===l).map(h=>h.key);return c.length===0?"":` [keys ${c.join(" ")}]`}}}const PP={image:"viewer",view:"viewer",dir:"files",fs:"files",tags:"tags",empty:"pane",domain:"dag",catalogue:"catalogue",graph:"dag",gather:"gather",edit:"editor"},Iu=240;function LP(s,e){const{layout:t,panels:i,paneInstance_get:n,dormant:r}=s,o=new Map;let a=!1,l=null;const c=y=>n(y)?.kind??null,h=(y,b,w,z,O)=>{o.set(y,{parent:b,dir:w,before:z,...O!==void 0?{binding:O}:{}})},d=y=>{if(y==="pacs")return"⊞";if(y==="dag")return"⋔";const b=c(y);return b==="image"?"▣":b==="tags"?"≣":b==="edit"?"✎":"▤"},u=y=>{if(y.length===0)return;const b=[];for(const T of y){const E=n(T)?.mount;if(E===void 0)continue;const x=E.getBoundingClientRect();x.width>0&&x.height>0&&b.push({id:T,left:x.left,top:x.top,width:x.width,height:x.height})}if(b.length===0)return;const w=Math.min(...b.map(T=>T.left)),z=Math.min(...b.map(T=>T.top)),O=Math.max(...b.map(T=>T.left+T.width))-w,M=Math.max(...b.map(T=>T.top+T.height))-z;if(O<=0||M<=0)return;const S=Iu/O,D=Math.max(40,Math.min(260,Math.round(M*S)));try{const T=document.createElement("canvas");T.width=Iu,T.height=D;const E=T.getContext("2d");if(E===null)return;const C=getComputedStyle(document.documentElement).getPropertyValue("--harvestgold").trim()||"#c9a15a";E.fillStyle="#05070a",E.fillRect(0,0,Iu,D);for(const I of b){const k=Math.round((I.left-w)*S),N=Math.round((I.top-z)*S),P=Math.max(6,Math.round(I.width*S)),F=Math.max(6,Math.round(I.height*S)),J=n(I.id)?.mount.querySelector("canvas");if(J!=null&&J.width>0){const Y=Math.min(P/J.width,F/J.height),le=Math.round(J.width*Y),xe=Math.round(J.height*Y);E.fillStyle="#000",E.fillRect(k,N,P,F),E.drawImage(J,k+Math.round((P-le)/2),N+Math.round((F-xe)/2),le,xe)}else E.fillStyle="rgba(255,255,255,0.05)",E.fillRect(k,N,P,F),E.fillStyle=C,E.font=`${Math.max(9,Math.min(28,Math.round(Math.min(P,F)*.5)))}px serif`,E.textAlign="center",E.textBaseline="middle",E.fillText(d(I.id),k+P/2,N+F/2+1);E.strokeStyle="rgba(255,255,255,0.22)",E.lineWidth=1,E.strokeRect(k+.5,N+.5,P-1,F-1)}return T.toDataURL("image/png")}catch{return}},p=(y,b,w)=>{const z=c(y),O=o.get(y),M={dir:O?.dir??"col",side:VD(O?.before??!1)};if(k0(y)){const D=b==="dag"?"runs":b,T=b==="pacs"?e.pacsQuery_get():null,E=b==="dag"?i.get("dag","dag"):void 0,x=E!==void 0&&E.graph_isShown()?E.feed_get():null,C=x!==null&&E!==void 0?E.view_lines():[],I=x!==null?E?.feedTitle_get():void 0;return{action:{op:"domain",domain:D,...T!==null?{query:T}:{},...x!==null?{feed:x}:{},...C.length>0?{view:C}:{}},...I!==void 0?{label:I}:{}}}if(O?.binding==="fs"||O?.binding==="view"||O?.binding==="empty")return{action:{op:O.binding,target:w,...M}};if(z==="image"){const D=i.get("image",y),T=D?.state_get()??null;if(D===void 0||T===null||T.path===null)return null;const E=[];T.layout!=="single"&&E.push(`image layout ${T.layout}`),T.colormap!==void 0&&T.colormap!=="gray"&&E.push(`image colormap ${T.colormap}`),T.voi!==void 0&&T.voi!==null&&E.push(`image wl ${T.voi.lower} ${T.voi.upper}`),T.slice>1&&E.push(`image slice ${T.slice}`),T.ghost!==void 0&&T.ghost!==null&&T.layout==="slab"&&E.push(`image ghost ${T.ghost}`);const x=D.series_get(),C=[x?.seriesDescription??"",x?.modality??""].filter(I=>I!=="");return{action:{op:"image",path:T.path,target:w,...M,...E.length>0?{view:E}:{}},anchor:T.path,...C.length>0?{label:C.join(" · ")}:{}}}const S=e.catalogue_of(y);if(S!==void 0){const D=i.get("files",y)?.commandLine_get()??"";return{action:{op:"catalogue",input:S.input,target:w,...M,...S.feed!==null?{feed:S.feed}:{},...S.node!==null?{node:S.node}:{},...D!==""?{line:D}:{}},label:`PROCESS ${S.input.split("/").filter(Boolean).pop()??S.input}`}}if(z==="files"){const D=i.get("files",y)?.path_current()??null;return typeof D!="string"||D.length===0?null:{action:{op:"dir",path:D,target:w,...M}}}if(z==="gather"){const D=i.get("gather",y);if(D===void 0)return null;const T=[...D.entries_get()],E=D.name_get(),x=D.feed_get();return{action:{op:"gather",series:T,target:w,...M,...E!==null?{name:E}:{},...x!==null?{feed:x.feedId,root:{instance:x.rootInstanceId,path:x.path}}:{}},label:E??`GATHER · ${T.length} series`}}if(z==="dag"){const D=i.get("dag",y)?.feed_get()??null;return D===null?null:{action:{op:"graph",feed:D,target:w,...M}}}if(z==="tags")return{action:{op:"tags",target:w,...M}};if(z==="edit"){const D=i.get("edit",y)?.path_get()??null;return D===null?null:{action:{op:"edit",path:D,target:w,...M},label:`EDIT ${D.split("/").pop()??D}`}}return null},f=()=>{if(a)return;const y=new Set(t.panes_shown()),b=t.activePreset_get();if(b==="panes"||b==="launcher")return;const w=Jc().map(F=>F.id).filter(F=>y.has(F)),z=new Map;let O,M;const S=[];for(const F of w){const J=z.get(o.get(F)?.parent??"")??0,Y=p(F,b,J);Y!==null&&(z.set(F,S.length),S.push(Y.action),Y.anchor!==void 0?O===void 0&&(O=Y.anchor,Y.label!==void 0&&(M=Y.label)):Y.label!==void 0&&M===void 0&&(M=Y.label))}const D=S.filter(F=>F.op!=="domain"||F.feed!==void 0);if(D.length===0)return;const T=u(w),E=F=>{if("pane"in F){const le=z.get(F.pane);return le===void 0?null:{leaf:le}}const J=E(F.first),Y=E(F.second);return J===null?Y:Y===null?J:{dir:F.dir,ratio:F.ratio,first:J,second:Y}},x=t.tree_get(),C=x===null?null:E(x),I=[...new Set(D.map(F=>PP[F.op]??"pane"))];let k,N,P;if(O!==void 0)k=O,N=M??O.split("/").pop()??O,P={address:O,modelKind:"dicom.series"};else{const F=D.map(le=>le.path).find(le=>le!==void 0),J=D.map(le=>le.path??(le.input!==void 0?`catalogue:${le.input}`:le.series!==void 0?`gather:${le.series.map(xe=>xe.seriesUID).join(",")}`:le.feed!==void 0?`feed:${le.feed}`:le.op)).sort().join("|"),Y=b==="dag"?"RUNS":b.toUpperCase();k=`${b}:${J}`,N=M!==void 0&&M!==""?M:F!==void 0?F.split("/").pop()??F:`${Y} · ${D.length+1} panes`,P={address:k,modelKind:"argus.desktop"}}r.add({id:k,label:N,regard:P,members:I,actions:S,...C===null?{}:{shape:C},...T===void 0?{}:{thumbnail:T},lastTouched:Date.now()})},_=()=>{const y=new Set(t.panes_shown());for(const b of Jc())y.has(b.id)||k0(b.id)||b.id==="panes"||b.id==="launcher"||b.id==="universe"||(Ds(b.id),t.mount_remove(b.id));e.stage_relight()},g=y=>{f(),t.preset_apply(y),_()},m=(y,b)=>{const w=S=>Jc().filter(D=>t.panes_shown().includes(D.id)&&c(D.id)===S).map(D=>D.id),z={dir:y.dir??"col",before:y.side==="before"},O=S=>{l=z;try{return S()}finally{l=null}},M=(S,D)=>w(S).find(T=>!D.has(T))??null;if(y.op==="domain"){const S=y.domain==="runs"?"dag":y.domain==="pacs"?"pacs":"files";if(g(S),y.query!==void 0&&s.terminal.line_run(y.query),y.feed!==void 0){const D=y.feed,T=y.view??[],E=i.get("dag","dag");if(E?.feed_enter(D),T.length>0&&E!==void 0){const x=C=>{if(E.graph_isShown()&&E.feed_get()===D){for(const I of T)s.terminal.line_run(I);return}C>0&&window.setTimeout(()=>x(C-1),250)};x(240)}}return S}if(b!==null&&t.focus_set(b),y.op==="image"&&y.path!==void 0){let S=null;const D=y.path,T=O(()=>e.image_open(null,D,{},C=>{S=C})),E=y.view,x=S;return E!==void 0&&E.length>0&&x!==null&&T.then(()=>{for(const C of E)t.focus_set(x),s.terminal.line_run(C)}).catch(()=>{}),S}if(y.op==="dir"&&y.path!==void 0){const S=new Set(w("files")),D=y.path;return O(()=>e.dir_open(D)),M("files",S)}if(y.op==="tags"){const S=new Set(w("tags"));return O(()=>s.terminal.line_run("image tags")),M("tags",S)}if(y.op==="catalogue"&&y.input!==void 0){const S=()=>e.catalogueIds().filter(x=>t.panes_shown().includes(x)),D=new Set(S()),T=y.input;O(()=>e.process_open(b??"files",{input:T,feed:y.feed??null,node:y.node??null}));const E=S().find(x=>!D.has(x))??null;return E!==null&&y.line!==void 0&&i.get("files",E)?.commandLine_set(y.line),E}if(y.op==="gather"&&y.series!==void 0){const S=[...y.series],D=O(()=>e.gather_open(S,b??"pacs"));return D!==null&&y.name!==void 0&&i.get("gather",D)?.name_set(y.name),D!==null&&y.feed!==void 0&&y.root!==void 0&&i.get("gather",D)?.feed_set({feedId:y.feed,rootInstanceId:y.root.instance,path:y.root.path}),D}if(y.op==="graph"&&y.feed!==void 0){const S=new Set(w("dag")),D=y.feed;return O(()=>e.feed_open(b??"files",D)),M("dag",S)}if(y.op==="edit"&&y.path!==void 0){const S=y.path;return O(()=>e.edit_open(S))}return y.op==="fs"||y.op==="view"||y.op==="empty"?b===null?null:e.pillPane_spawn(b,y.op,z.dir,z.before):null};return{birth_record:h,replayPlace_get:()=>l,replaying:()=>a,strip_capture:u,capture:f,orphans_dispose:_,domain_enter:g,restore:async y=>{const b=r.get(y);if(!(b===void 0||b.actions===void 0)){r.dismiss(y),a=!0;try{const w=[];for(const z of b.actions){const O=w[z.target??0]??null;w.push(m(z,O))}if(b.shape!==void 0){const z=M=>{if("leaf"in M){const T=w[M.leaf]??null;return T===null?null:{pane:T}}const S=z(M.first),D=z(M.second);return S===null?D:D===null?S:{dir:M.dir,ratio:M.ratio,first:S,second:D}},O=z(b.shape);O!==null&&!("pane"in O)&&t.tree_set(O)}}finally{a=!1,e.stage_relight()}}}}}const WP=2200;function FP(s){return/\x1b\[/.test(s)?vn(s):di(s).replace(/("[^&]*")/g,'<span class="man-str">$1</span>').replace(/(^|\s)(--?[a-zA-Z][\w-]*)/g,'$1<span class="man-flag">$2</span>').replace(/^(\s{0,2})([A-Za-z_ ]+):(\s)/gm,'$1<span class="man-key">$2:</span>$3').replace(/^([A-Z][A-Z ]{2,})$/gm,'<span class="man-head">$1</span>')}function UP(s,e,t,i){if(s===void 0)return[];const n=s.arguments??[],r=[{label:"NODE",value:`${s.label} · @${s.id}`},{label:"PLUGIN",value:s.pluginName},...s.pluginVersion!==void 0?[{label:"VERSION",value:s.pluginVersion}]:[]];if(e){const o=fT(s.label,s.id,i);r.push(...n.length===0?[{label:"ARGUMENTS",value:"none — this node runs on the plugin's defaults"}]:n.map(a=>({label:a.name,value:String(a.value??""),...t?{edit:{flag:`--${o}.${a.name}`,type:typeof a.value=="boolean"?"boolean":"string",placeholder:String(a.value??"")}}:{}})))}else r.push({label:"ARGUMENTS",value:n.length===0?"none":`${n.length} — open the node to read them`});return r}function $P(s,e,t){const i=[{label:"PLUGIN",value:s.name},{label:"VERSION",value:s.version},{label:"TYPE",value:s.type.toUpperCase()}],n=s.parameters;if(!e)return i.push({label:"PARAMETERS",value:n.length===0?"none":`${n.length} — open the node to read them`}),i;if(n.length===0)return i.push({label:"PARAMETERS",value:"none — this plugin takes no arguments"}),i;for(const r of n){const o=[r.type];r.optional||o.push("required");const a=r.default===void 0||r.default===null?"":String(r.default);a!==""&&o.push(`default ${a}`);const l=o.join(" · ");i.push({label:r.flag,value:r.help===void 0?l:`${l} — ${r.help}`,...t?{edit:{flag:r.flag,type:r.type,placeholder:a}}:{}})}return i}function U0(s,e,t,i){s.replaceChildren(),s.classList.toggle("dag-facts-immersed",t);for(const{label:n,value:r,edit:o}of e){const a=document.createElement("div");a.className="telemetry-row";const l=document.createElement("span");if(l.className="telemetry-label",l.textContent=n,a.appendChild(l),o===void 0||i===null){const c=document.createElement("span");c.className="telemetry-value",c.textContent=r,a.appendChild(c)}else{const c=hT(i.line_get(),o.flag),h=document.createElement("input");h.className="telemetry-input",h.spellcheck=!1,h.autocomplete="off",h.title=`${o.flag} — ${r}`,o.type==="boolean"?(h.type="checkbox",h.checked=c===!0,h.addEventListener("change",()=>{i.line_set(q_(i.line_get(),o.flag,h.checked?!0:null))})):(h.type="text",h.placeholder=o.placeholder,h.value=c===null||c===!0?"":c,h.addEventListener("input",()=>{i.line_set(q_(i.line_get(),o.flag,h.value))}));const d=document.createElement("span");d.className="telemetry-hint",d.textContent=r,a.append(h,d)}s.appendChild(a)}}function jP(s,e,t,i){const n=s.closest(".files-body"),r=n?.querySelector(".diagram-strategy")??null,o=n?.querySelector(".diagram-projection")??null,a=n?.querySelector(".diagram-pulse")??null,l=i===void 0?null:n?.querySelector(".diagram-run")??null,c=()=>i?.(),h=()=>{const f=[];e.strategy_get()!=="ranked"&&f.push("MOLECULE"),e.projection_get()!=="3d"&&f.push("2D"),t.mode_annunciate(f.join(" · "))},d=()=>{e.strategy_set(e.strategy_get()==="ranked"?"molecule":"ranked"),r!==null&&(r.textContent=e.strategy_get().toUpperCase()),h()},u=()=>{e.projection_set(e.projection_get()==="3d"?"2d":"3d"),o!==null&&(o.textContent=e.projection_get().toUpperCase()),h()},p=()=>{e.wave_start(),a?.classList.add("pulse-running"),window.setTimeout(()=>a?.classList.remove("pulse-running"),WP)};return r!==null&&(r.textContent=e.strategy_get().toUpperCase()),o!==null&&(o.textContent=e.projection_get().toUpperCase()),r?.addEventListener("click",d),o?.addEventListener("click",u),a?.addEventListener("click",p),l?.addEventListener("click",c),h(),()=>{r?.removeEventListener("click",d),o?.removeEventListener("click",u),a?.removeEventListener("click",p),l?.removeEventListener("click",c),a?.classList.remove("pulse-running")}}function HP(s,e){let t=null;const i=(c,h,d,u)=>{let p=null,f=null;const _=c.contentHtml_show(h,"",{diagram:!0,release:()=>{t=null,f?.(),f=null,c.mode_annunciate(""),p?.dispose(),p=null}});_!==null&&d().then(g=>{if(!_.isConnected)return;if(g===null||g.nodes.length===0){_.textContent="NOTHING TO DRAW FOR THIS ENTRY",_.classList.add("files-diagram-empty");return}g.text!==""&&c.contentText_set(g.text);const m=document.createElement("div");m.className="dag-facts",mi(m),_.appendChild(m);const v=new pd(_,{select:w=>g.facts_show(m,w.id,!1,u),activate:w=>y(w),deselect:()=>m.replaceChildren()},{}),y=w=>{v.flight_into(w.id,()=>{t={scene:v,facts:m},g.facts_show(m,w.id,!0,u)})};p=v,v.graph_set({nodes:g.nodes},{wave:!1}),v.size_fit(),f=jP(_,v,c,u===null?void 0:u.run);const b=g.nodes.length===1?g.nodes[0]:void 0;b!==void 0&&y(b)})},n=async c=>{const h=/_id(\d+)$/.exec(c)?.[1]??c.replace(/^.*\//,""),[d,u]=await Promise.all([s.client.line_execute(`cat "${c}"`,{silent:!0,observe:!1}),s.client.line_execute(`pipeline diagram ${h}`,{silent:!0,observe:!1})]),p=d.envelopes.map(f=>f.rendered).join(`
|
|
4295
4295
|
`);for(const f of u.envelopes){if(f.model?.kind!==cr.pipelineDiagram)continue;const _=xm.safeParse(f.model.data);if(!_.success)continue;const g=new Map(_.data.nodes.map(m=>[m.id,m]));return{text:FP(p),nodes:_.data.nodes.map(m=>({id:m.id,label:m.label,parentIds:m.parentIds,joinParentIds:m.joinParentIds})),facts_show:(m,v,y,b)=>{const w=_.data.nodes.map(z=>z.label);U0(m,UP(g.get(v),y,b!==null,w),y,b)}}}return null},r=async c=>{const h=c.replace(/^.*\//,""),d=await s.client.line_execute(`plugin info "${h}"`,{silent:!0,observe:!1});for(const u of d.envelopes){if(u.model?.kind!==oO)continue;const p=rO.safeParse(u.model.data);if(!p.success)continue;const f=p.data;return{text:"",nodes:[{id:h,label:f.name,parentIds:[],joinParentIds:[]}],facts_show:(_,g,m,v)=>{U0(_,$P(f,m,v!==null),m,v)}}}return null},o=(c,h,d,u)=>{const p=e.catalogue_of(c);if(p===void 0)return null;const f=d.replace(/^.*\//,"");return zw(h.commandLine_get())!==f&&h.commandLine_set(vw(p.input,f)),{line_get:()=>h.commandLine_get(),line_set:_=>h.commandLine_set(_),run:()=>e.run_press(c,f,u)}};return{entry_show:(c,h,d,u)=>{i(h,d,()=>u==="plugin"?r(d):n(d),o(c,h,d,u))},dive_leave:()=>{const c=t;return c===null?!1:(t=null,c.scene.flight_back(()=>{c.facts.classList.remove("dag-facts-immersed"),c.facts.replaceChildren()}),!0)}}}function VP(s,e){const{panels:t,paneInstance_get:i,subjects:n}=s,r=new Map,o=p=>t.get("dag",p)??t.get("universe",p),a=(p,f)=>{const _=r.get(p);if(_===void 0){f?.();return}r.delete(p),_.element.classList.remove("node-overlay-open");const g=()=>{_.element.remove(),f?.()},m=o(p);m!==void 0?m.flight_back(g):g()},l=(p,f,_,g,m)=>{if(m.kind==="dir"){const v=f.replace(/\/+$/,"");if(m.path!==v&&!m.path.startsWith(`${v}/`)){a(p),s.sound("audio3");return}const y=m.path.startsWith("/proc/jobs/")?(m.path.split("/").pop()??"").match(/_(\d+)$/):null;if(y!==null){const w=parseInt(y[1]??"",10);a(p,()=>{o(p)?.node_flyTo(w)!==!0&&c(p,m.path)});return}const b=_.path_current();b!==null&&g.push(b),e.rootedListing_show(p,_,m.path);return}if(n.regard_write(p,{address:m.path,modelKind:"fs.file"}),!n.groupHasViewer(p)){if(e.imagery_is(m.path)){e.image_open(p,m.path).then(v=>s.terminal.line_note(v));return}if(id(m.path)){_.contentImage_show(m.path,e.vfsUrl_build(m.path));return}e.fileText_fetch(m.path).then(v=>{if(!v.ok){_.contentRefused_show(m.path,v.text);return}e.tableFile_is(m.path)?_.contentTable_show(m.path,v.text):_.content_show(m.path,v.text)})}},c=(p,f)=>{const g=i(p)?.mount?.querySelector(".dag-canvas, .universe-canvas")??null,m=r.get(p);if(m!==void 0&&!m.element.isConnected&&r.delete(p),g===null||r.has(p)){s.terminal.line_note(`dag: ${f}: ${g===null?"this pane has no scene to fly in":"a node is already open here"} — flew back out`),o(p)?.flight_back(()=>{});return}const v=document.createElement("div");v.className="node-overlay",v.setAttribute("aria-label",`inside ${f}`);const y=e.filesBody_stamp();y.classList.add("node-overlay-body");const b=document.createElement("button");b.type="button",b.className="strategy-pill node-overlay-exit",b.title="leave the node (Esc)",b.textContent="EXIT NODE",y.querySelector(".mode-frame")?.prepend(b),v.append(y);const w=y.querySelector(".files-panel");if(w===null)throw new Error("pane template is missing .files-panel");const z=[],O=new fw(w,M=>l(p,f,O,z,M),e.previewProvider);O.rowVerbs_declare((M,S)=>e.rowVerbs_of(p,M,S),(M,S)=>{n.regard_write(p,{address:S,modelKind:"fs.file"})}),r.set(p,{element:v,panel:O,history:z}),O.ceiling_set(f,"EXIT NODE"),b.addEventListener("click",()=>{a(p),s.sound("audio3")}),g.appendChild(v),window.requestAnimationFrame(()=>v.classList.add("node-overlay-open")),e.rootedListing_show(p,O,f)};return{open:c,close:a,back:p=>{const f=r.get(p),_=f?.history.pop();f!==void 0&&_!==void 0&&e.rootedListing_show(p,f.panel,_)},escape:()=>{const p=[...r.keys()].pop();if(p===void 0)return!1;const f=r.get(p);return f!==void 0&&f.panel.content_isShown()?f.panel.listing_restore():a(p),!0},dispose:p=>{r.get(p)?.element.remove(),r.delete(p)}}}async function mg(s,e,t){if(s.ask_isOpen()){const o=s.ask_note(t.message),a=await Nh(e,t);return o(t.kind==="secret"&&a!==null?"••••••":a),a}const i=Nh(e,t).then(o=>({from:"pane",answer:o})),n=s.ask_open({message:t.message,kind:t.kind==="choose"?"text":t.kind,focus:!1,...t.suggest===void 0?{}:{suggest:t.suggest}}).then(o=>({from:"console",answer:o})),r=await Promise.race([i,n]);return r.from==="console"?Py():s.ask_settle(r.answer),r.answer}function qP(s,e){const{panels:t,paneInstance_get:i}=s;let n=null,r=null;const o=()=>{const{layout:u}=s,p=u.tree_get();if(p===null)return null;const f=[],_=m=>{if("pane"in m){f.push(m.pane);return}_(m.first),_(m.second)};_(p);const g=u.focused_get();return g!==null&&f.includes(g)?g:f[0]??null};return{errandHost_find:o,errand_open:async u=>{const{layout:p,terminal:f}=s,_=o();if(_===null)return null;const g=e.instance_spawn("files"),m=e.replayPlace_get();if(!p.leaf_split(_,m?.dir??"col",g.id,m?.before??!1))return Ds(g.id),p.mount_remove(g.id),null;e.birth_record(g.id,_,m?.dir??"col",m?.before??!1);const v=t.get("files",g.id),y=u.path?.anchor??"~";v!==void 0&&e.rootedListing_show(g.id,v,y);const b=g.mount.querySelector(".files-body");if(b===null)return Ds(g.id),p.mount_remove(g.id),null;const w=document.createElement("div");w.className="errand-bar",b.insertBefore(w,b.firstChild);const z=document.createElement("span");z.className="errand-caption",z.textContent=u.message.trim();const O=document.createElement("input");O.className="errand-path",O.spellcheck=!1;const M=document.createElement("button");M.className="pacs-capsule errand-commit",M.textContent=u.commit??"USE THIS",w.append(z,O,M);const S=()=>{const E=v?.path_current()??y,x=u.path?.suggest;O.value=u.path?.wantsDirectory===!0||x===void 0?E:`${E.replace(/\/$/,"")}/${x}`};S();let D=!1;O.addEventListener("input",()=>{D=!0});const T=()=>{D||S()};return g.mount.addEventListener("click",T),f.question_set(!0),new Promise(E=>{const x=C=>{g.mount.removeEventListener("click",T),f.question_set(!1),n=null,p.leaf_close(g.id),Ds(g.id),p.mount_remove(g.id),E(C)};n=()=>x(null),M.addEventListener("click",()=>x(O.value.trim()===""?null:O.value.trim())),O.addEventListener("keydown",C=>{C.key==="Enter"&&x(O.value.trim()===""?null:O.value.trim())})})},errand_abandon:()=>n===null?!1:(n(),!0),verbLine_run:(u,p)=>{r=u,s.terminal.line_run(p)},askingPane_take:()=>{const u=r;return r=null,u},ask_onPane:async(u,p)=>{const{terminal:f}=s,_=i(u)?.mount;if(_===void 0){const g=e.questionSheet_ask?.(p)??null;return g!==null?g:(e.console_expose(),f.ask_open({message:p.message,kind:p.kind==="choose"?"text":p.kind,...p.suggest===void 0?{}:{suggest:p.suggest}}))}return mg(f,_,p)}}}class KP{members=new Map;title=null;landed=null;watchers=new Set;watch(e){return this.watchers.add(e),()=>{this.watchers.delete(e)}}changed(){for(const e of[...this.watchers])e()}members_get(){return[...this.members.values()]}size(){return this.members.size}has(e){return this.members.has(e)}take(e){const t=this.members.get(e.seriesUID);this.members.set(e.seriesUID,t===void 0?e:{...t,...e}),this.changed()}drop(e){const t=this.members.delete(e);return t&&this.changed(),t}clear(){this.members.size!==0&&(this.members.clear(),this.changed())}name_get(){return this.title}name_set(e){this.title=e,this.changed()}feed_get(){return this.landed}feed_set(e){this.landed=e,this.changed()}}function $0(s){return(s.kind??"series")==="series"?void 0:s.vfsPath}const Cu="cohort";function YP(s){return/[",\n\r]/.test(s)?`"${s.split('"').join('""')}"`:s}function XP(s){const e=document.createElement("p");return e.className="files-empty",e.textContent=s,e}class j0{handlers;title;cohort;greeted=!1;listing;cohortActions;seriesActions;constructor(e,t,i,n){this.handlers=i,this.cohort=n,n.watch(()=>{this.unsaved=!0,this.render()}),this.title=e.querySelector(".gather-title"),this.cohortActions=this.cohortActions_declare(),this.seriesActions=this.seriesActions_declare(),this.listing=new Mr({mount:t,traits:this.cohortTraits_declare(),key:r=>r.key,chrome:{root:e,prefix:"gather"},control:"fold",actions:{of:()=>this.cohortActions},row:{className:()=>"gather-cohort-row",groupClassName:()=>"gather-cohort",decorate:r=>{r.title="the cohort: click for its verbs, the fold cell folds its series"}},child:Jo(()=>[...this.cohort.members_get()].map(r=>({entry:r})),{traits:this.seriesTraits_declare(),key:r=>r.entry.seriesUID,address:r=>r.entry.vfsPath,actions:{of:()=>this.seriesActions},row:{className:()=>"gather-series",decorate:(r,o)=>{r.dataset.seriesuid=o.entry.seriesUID}}}),state:r=>this.stateLine_compose(r),empty:()=>XP("NOTHING GATHERED")}),this.pullBlock=e.querySelector(".gather-pull"),this.pullBlock?.addEventListener("click",()=>this.cohort_pull()),this.emptyBlock=e.querySelector(".gather-remove"),this.emptyBlock?.addEventListener("click",()=>{this.cohort_clear()}),this.processBlock=e.querySelector(".gather-process"),this.processBlock?.addEventListener("click",()=>{this.cohort_process()}),this.render()}pullBlock=null;emptyBlock=null;unsaved=!1;processBlock=null;cohort_empty(){this.cohort.size()!==0&&(this.cohort.clear(),this.handlers.changed(),this.render())}async cohort_clear(){if(this.cohort.size()!==0){if(this.unsaved){const e=await this.handlers.confirm_ask(`Save the cohort first? (${this.cohort.size()} ${this.cohort.size()===1?"member":"members"}, unsaved)`);if(e===null||e==="y"&&!await this.manifest_save())return}this.handlers.command_show("gather clear"),this.cohort_empty()}}away(){return[...this.cohort.members_get()].filter(e=>e.folderPath===void 0&&e.series?.pulled!==!0)}cohort_pull(){const e=this.away();if(e.length===0)return;const t=e.map(i=>`"${i.vfsPath}"`).join(" ");this.handlers.command_show(`pull ${t}`)}render_now(){this.render()}has(e){return this.cohort.has(e)}entries_get(){return[...this.cohort.members_get()]}name_get(){return this.cohort.name_get()}feed_get(){return this.cohort.feed_get()}feed_set(e){e!==null&&this.cohort.feed_set(e),this.render()}name_set(e){e!==null&&this.cohort.name_set(e),this.render()}series_add(e){this.cohort.take(e),this.render(),this.handlers.changed()}series_remove(e){this.cohort.drop(e)&&(this.render(),this.handlers.changed())}render(){if(this.title!==null&&(this.title.textContent=this.cohort.name_get()===null?"GATHER":`GATHER · ${this.cohort.name_get()??""}`.toUpperCase()),this.listing.rows_set([{key:"gather",rows:[{key:Cu}]}],{field:"gather"}),this.cohort.size()>0&&this.listing.open_set(0,[Cu]),this.pullBlock!==null){const e=this.away().length;this.pullBlock.hidden=e===0,this.pullBlock.textContent=`PULL ${e}`}this.emptyBlock!==null&&(this.emptyBlock.hidden=this.cohort.size()===0,this.emptyBlock.textContent=`CLEAR ${this.cohort.size()}`),this.processBlock!==null&&(this.processBlock.hidden=this.cohort.size()===0),this.greeted||(this.greeted=!0,this.listing.row_indicate(Cu))}cohortTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"name",label:"COHORT",className:"gather-cohort-name",width:"1fr",cell:()=>this.cohort.name_get()??"(unnamed — SAVE names it)"},{key:"series",label:"SERIES",className:"gather-cohort-count",width:"6em",cell:()=>String(this.series_count()),compare:()=>this.series_count()},{key:"patients",label:"PATIENTS",className:"gather-cohort-patients",width:"7em",cell:()=>String(this.patients_count()),compare:()=>this.patients_count()},{key:"feed",label:"FEED",className:"gather-cohort-feed",width:"7em",cell:()=>{if(this.cohort.feed_get()===null)return"—";const e=document.createElement("button");e.className="gather-feed listing-capsule listing-action-selected",e.textContent=`FEED ${this.cohort.feed_get()?.feedId??0}`,e.title="open the feed's graph beside the cohort";const t=this.cohort.feed_get()?.feedId??0;return e.addEventListener("click",i=>{i.stopPropagation(),this.handlers.feed_open(t)}),e},compare:()=>this.cohort.feed_get()?.feedId??-1}]}seriesTraits_declare(){const e=Cw(n=>n.entry.series??{seriesUID:n.entry.seriesUID,description:n.entry.description??n.entry.vfsPath??"",modality:n.entry.modality,...n.entry.files===void 0?{}:{fileCount:n.entry.files},...n.entry.folderPath===void 0?{}:{pulled:!0,folderPath:n.entry.folderPath}},yT),t={key:"patient",label:"MRN",className:"gather-series-patient",width:"8em",cell:n=>n.entry.patient||"—"},i={key:"study",label:"STUDY",className:"gather-series-study",width:"14em",cell:n=>n.entry.study??"—"};return[...e.slice(0,1),i,t,...e.slice(1)]}cohortActions_declare(){const e=()=>({count:this.cohort.size(),feed:this.cohort.feed_get()?.feedId??null}),t={save:()=>{this.manifest_save()},export:()=>{this.cohort_export()},feed:()=>{this.feed_ensure()},process:()=>{this.cohort_process()},dismiss:()=>this.handlers.dismiss()};return Aw.rules.map(i=>({label:i.label(e()),offered:()=>i.offered(e()),run:()=>t[i.name]?.()}))}seriesActions_declare(){const e=i=>({folderKnown:(i.entry.kind??"series")!=="series"||i.entry.folderPath!==void 0,imagery:(i.entry.kind??"series")==="series"||i.entry.imagery===!0,pullable:(i.entry.kind??"series")==="series"&&i.entry.folderPath===void 0&&i.entry.series?.pulled!==!0&&i.entry.vfsPath!==""}),t={remove:i=>this.series_remove(i.entry.seriesUID),pull:i=>this.handlers.command_show(`pull "${i.entry.vfsPath}"`),image:i=>{const n=i.entry.folderPath??$0(i.entry);n!==void 0&&this.handlers.image_open(n)},process:i=>{const n=i.entry.folderPath??$0(i.entry);if(n!==void 0){this.handlers.process_open(n);return}this.handlers.note(`gather: ${i.entry.description||i.entry.seriesUID} is not in CUBE yet — PULL it first, then PROCESS it.`)}};return Ew.rules.map(i=>({label:i.label({folderKnown:!0,pullable:!0}),offered:n=>i.offered(e(n)),run:n=>t[i.name]?.(n)}))}patients_count(){return new Set(this.cohort.members_get().filter(e=>(e.kind??"series")==="series").map(e=>e.patient)).size}series_count(){return this.cohort.members_get().filter(e=>(e.kind??"series")==="series").length}stateLine_compose(e){const t=this.cohort.members_get(),i=t.filter(a=>(a.kind??"series")!=="series").length,n=t.length-i,r=[];(n>0||i===0)&&r.push(`${n} SERIES`),i>0&&r.push(`${i} ${i===1?"PLACE":"PLACES"}`),i===0&&r.push(`${this.patients_count()} PATIENTS`);const o=[r.join(" · ")];return e.filter!==""&&o.push(e.filter),o.join(" · ")}async name_ensure(){if(this.cohort.name_get()!==null)return this.cohort.name_get();const t=(await this.handlers.name_ask(`gather-${new Date().toISOString().slice(0,10)}`)??"").trim();return t===""?null:(this.cohort.name_set(t),this.render(),t)}async manifest_save(){if(this.cohort.size()===0)return!1;const e=await this.name_ensure();if(e===null)return!1;const t=JSON.stringify({name:e,gatheredAt:new Date().toISOString(),series:[...this.cohort.members_get()].map(i=>({seriesUID:i.seriesUID,description:i.description,modality:i.modality,patient:i.patient,vfsPath:i.vfsPath}))});return this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t}' ~/gather/${e}.json`),this.unsaved=!1,!0}async cohort_export(){if(this.cohort.size()===0)return;const e=await this.name_ensure();if(e===null)return;const t=[["patient","series","modality","seriesUID","path"].join(","),...[...this.cohort.members_get()].map(i=>[i.patient,i.description,i.modality,i.seriesUID,i.vfsPath].map(YP).join(","))];this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t.join(`
|
|
4296
4296
|
`)}' ~/gather/${e}.csv`)}async feed_ensure(){const e=this.cohort.feed_get();if(e!==null)return e;if(this.cohort.size()===0)return null;const t=this.cohort.members_get().filter(o=>(o.kind??"series")!=="series");if(t.length>0)return this.handlers.note(`gather: this cohort holds ${t.length} ${t.length===1?"place":"places"} as well as series, and a feed is rooted by pulling its members — a place is already in ChRIS. PROCESS one place from its own row, or remove them to make a feed of the series. (Rooting a feed on the whole cohort, places included, is coming: CUBE takes the list.)`),null;const i=await this.name_ensure();if(i===null)return null;const n=[...this.cohort.members_get()].map(o=>o.vfsPath).join(" "),r=await this.handlers.feed_create(`pull --new-feed "${i}" ${n}`);return r!==null&&this.feed_set(r),r}async cohort_process(){const e=await this.feed_ensure();e!==null&&this.handlers.cohort_process({input:e.path,feed:e.feedId,node:e.rootInstanceId})}}const H0="~/gather/current.json",ZP=1200;function JP(s,e){const{panels:t,subjects:i}=s,n=new KP;let r=null,o=!1,a=null;const l=async v=>{const{terminal:y,client:b}=s;y.line_echo(v);let w;try{w=await b.line_execute(v,{silent:!0})}catch(z){return y.output_write("err",`\x1B[31m${z instanceof Error?z.message:String(z)}\x1B[0m
|
|
4297
|
-
`),null}y.outcome_write(w);for(const z of w.envelopes){if(z.model?.kind!=="feed.created")continue;const O=z.model.data;if(typeof O.feedId=="number"&&typeof O.rootInstanceId=="number"&&typeof O.path=="string")return{feedId:O.feedId,rootInstanceId:O.rootInstanceId,path:O.path}}return null},c=(v,y,b)=>({command_run:w=>{s.client.line_execute(w,{silent:!0})},command_show:w=>s.terminal.line_run(w),note:w=>s.terminal.line_note(w),image_open:w=>{e.image_open(v(),w).then(z=>s.terminal.line_note(z))},process_open:w=>e.process_open(v(),{input:w,feed:null,node:null}),...y,...b,feed_create:l,cohort_process:w=>e.process_open(v(),w),feed_open:w=>e.feed_open(v(),w)}),h=()=>{a!==null&&window.clearTimeout(a),a=window.setTimeout(()=>{a=null;const v=r?.entries_get()??[],y=JSON.stringify({version:1,name:r?.name_get()??null,feed:r?.feed_get()??null,series:v});s.client.line_execute("mkdir -p ~/gather",{silent:!0,observe:!1}).then(()=>s.client.line_execute(`touch --withContents '${y.replace(/'/g,"'\\''")}' ${H0}`,{silent:!0,observe:!1}))},ZP)},d=()=>{const v=document.querySelector("#header-gather-pill");v!==null&&v.classList.toggle("panel-gather-empty",(r?.entries_get().length??0)===0)},u=()=>{const v=e.element_require("header-gather"),y=()=>e.errandHost_find()??"pacs",b=w=>mg(s.terminal,e.element_require("header-gather"),w);return new j0(v,e.pane_find(v,".gather-rows"),c(y,{name_ask:w=>b({message:"Cohort name: ",kind:"text",suggest:w,commit:"NAME IT"}),confirm_ask:async w=>{const z=await b({message:w,kind:"confirm"});return z==="y"||z==="n"?z:null}},{changed:()=>{e.stage_relight(),d(),h()},dismiss:()=>{document.body.dataset.header="away",o=!0,d()}}),n)};return{cohort:n,instance_build:v=>{const y=e.template_stamp("tpl-pane-gather"),b=new j0(y,e.pane_find(y,".gather-rows"),c(()=>v,{name_ask:w=>e.ask_onPane(v,{message:"Cohort name: ",kind:"text",suggest:w,commit:"NAME IT"}),confirm_ask:async w=>{const z=await e.ask_onPane(v,{message:w,kind:"confirm"});return z==="y"||z==="n"?z:null}},{changed:()=>e.stage_relight(),dismiss:()=>{s.layout.leaf_close(v)||e.home_apply(),e.orphans_dispose(),e.stage_relight()}}),n);return t.set("gather",v,b),{id:v,kind:"gather",mount:y,dispose:()=>{t.delete(v),i.pane_leave(v)}}},has:v=>r?.has(v)===!0,gather:v=>{r===null&&(r=u());for(const b of v)r.series_add(b);const y=document.body.dataset.header==="away";(!o||!y)&&(document.body.dataset.header="gather",o=!1),d(),h()},open:(v,y="pacs")=>{const{layout:b}=s,w=new Set(b.panes_shown());let z=t.ids("gather").find(M=>w.has(M))??null;if(z===null){const M=w.has(y)?y:e.errandHost_find()??y,S=e.instance_spawn("gather","pacs"),D=e.replayPlace_get();if(!b.leaf_split(M,D?.dir??"row",S.id,D?.before??!1))return Ds(S.id),b.mount_remove(S.id),null;e.birth_record(S.id,M,D?.dir??"row",D?.before??!1),z=S.id}const O=t.get("gather",z);if(O===void 0)return null;for(const M of v)O.series_add(M);return z},stage:()=>{const{layout:v}=s,y=new Set(v.panes_shown()),b=t.ids("gather").find(w=>y.has(w))??null;if(b!==null)v.focus_set(b);else{const w=e.errandHost_find()??"pacs",z=e.instance_spawn("gather","pacs");if(!v.leaf_split(w,"col",z.id,!1)){Ds(z.id),v.mount_remove(z.id);return}e.birth_record(z.id,w,"col",!1),t.get("gather",z.id)?.render_now()}document.body.dataset.header="away",o=!0},annunciate:d,restore:async()=>{const v=await e.fileText_fetch(H0);if(v.ok)try{const y=JSON.parse(v.text);if(!Array.isArray(y.series)||y.series.length===0)return;r===null&&(r=u());for(const b of y.series)r.series_add(b);d(),e.stage_relight()}catch{}}}}class QP{mount;handlers;titleSpan;stateSpan;fieldSection;savePill;revertPill;focusMark;field=null;path=null;original="";saving=!1;fieldBuild=null;constructor(e,t){this.mount=e,this.handlers=t,this.titleSpan=e.querySelector(".pane-title"),this.stateSpan=e.querySelector(".pane-state"),this.fieldSection=this.element_require(".edit-field"),this.savePill=this.element_require(".edit-save"),this.revertPill=this.element_require(".edit-revert"),this.focusMark=e.querySelector(".edit-focus"),this.savePill.addEventListener("click",()=>{this.save()}),this.revertPill.addEventListener("click",()=>this.revert()),e.addEventListener("keydown",i=>{(i.ctrlKey||i.metaKey)&&!i.altKey&&i.key.toLowerCase()==="s"&&(i.preventDefault(),i.stopPropagation(),this.save())},{capture:!0}),this.fieldSection.addEventListener("mousedown",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusin",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.fieldSection.contains(i.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),zs(this.stateSpan,"wait","OPENING")}async content_show(e){this.path=e.path,this.original=e.content,this.title_set(e.path),this.fieldBuild??=this.field_build(e);const t=await this.fieldBuild;t!==null&&(t.text_get()!==this.original&&t.text_set(this.original),this.controls_sync(),t.focus(),this.focusMark_set(!0))}async field_build(e){let t;try{t=await Ap(()=>import("./field-DdpS2ZMe.js").then(i=>i.Q),[],import.meta.url)}catch(i){if(!fg(i))throw i;return zs(this.stateSpan,"stale",Gh),this.handlers.note(`edit: ${Gh.toLowerCase()} — the editor's code is of an older build than the server has`),null}return this.field=await t.editField_create(this.fieldSection,e.content,e.extension,()=>this.controls_sync()),this.field}opening_fail(e){zs(this.stateSpan,"refused",`NOT OPENED · ${e.toUpperCase()}`)}async save(){if(this.field===null||this.path===null||this.saving)return!1;const e=this.field.text_get();if(e===this.original)return!0;this.saving=!0,this.controls_sync();let t=!1;try{t=await this.handlers.save(this.path,e)}finally{this.saving=!1}return t&&(this.original=e),this.controls_sync(),t||zs(this.stateSpan,"refused","NOT SAVED · THE CONSOLE SAYS WHY"),t}revert(){this.field===null||!this.dirty_is()||(this.field.text_set(this.original),this.controls_sync())}dirty_is(){return this.field!==null&&this.field.text_get()!==this.original}path_get(){return this.path}field_release(){return this.field===null||!this.field.hasFocus()?!1:(this.field.blur(),this.focusMark_set(!1),!0)}dispose(){this.field?.destroy(),this.field=null}controls_sync(){const e=this.dirty_is();this.savePill.disabled=!e||this.saving,this.revertPill.disabled=!e||this.saving,this.mount.dataset.dirty=e?"yes":"no",this.field!==null&&(this.saving?zs(this.stateSpan,"wait","SAVING"):e?zs(this.stateSpan,"note","DIRTY"):zs(this.stateSpan,"settled","SAVED"))}title_set(e){this.titleSpan!==null&&(this.titleSpan.textContent=`EDIT ${e.split("/").pop()??e}`.toUpperCase()),this.mount.title=e}focusMark_set(e){this.focusMark!==null&&(this.focusMark.hidden=!e)}element_require(e){const t=this.mount.querySelector(e);if(t===null)throw new Error(`edit pane: no ${e} in its template`);return t}}function eL(s,e){const{layout:t,panels:i,subjects:n}=s,r=async(d,u)=>{const p=await ta(s,Uy(d,u));return p&&e.saved?.(d),p},o=d=>{const u=e.template_stamp("tpl-pane-edit"),p=new QP(u,{save:r,note:f=>s.terminal.line_note(f)});return i.set("edit",d,p),{id:d,kind:"edit",mount:u,dispose:()=>{p.dispose(),i.delete(d),n.pane_leave(d)}}},a=d=>{const u=new Set(t.panes_shown());for(const[p,f]of i.entries("edit"))if(u.has(p)&&f.path_get()===d)return p;return null},l=()=>{e.launcher_yield();const d=new Set(t.panes_shown()),u=t.focused_get(),p=u!==null&&d.has(u)?u:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),_=e.replayPlace_get();return t.leaf_split(p,_?.dir??"col",f.id,_?.before??!1)?(e.birth_record(f.id,p,_?.dir??"col",_?.before??!1),f.id):(Ds(f.id),t.mount_remove(f.id),null)};return{instance_build:o,edit_receive:d=>{const u=d.path??"";if(u==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=a(u)??l();if(p===null)return!1;const f=i.get("edit",p);return f===void 0?!1:(t.focus_set(p),f.dirty_is()?(s.terminal.line_note(`edit: ${u}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:u,content:d.content,extension:d.extension??Ev(u)}),!0))},edit_open:(d,u={})=>{const p=a(d)??l();if(p===null)return null;const f=i.get("edit",p);if(f===void 0)return null;t.focus_set(p),f.dirty_is()||f.opening_show(d);const _=$y(d);return u.visible===!0?(s.terminal.line_run(_),p):(s.client.line_execute(_,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(v=>v.status!=="ok");m!==void 0&&f.opening_fail((m.renderedErr??"").replace(/\x1b\[[0-9;]*m/g,"").trim()||"the kernel refused")}).catch(g=>f.opening_fail(g instanceof Error?g.message:String(g))),p)}}}class tL{listing;constructor(e){const t=e.querySelector(".help-panel");if(t===null)throw new Error("help pane: no .help-panel in its template");this.listing=new Mr({mount:t,traits:this.traits_declare(),key:i=>i.key,chrome:{root:e,prefix:"help"},caps:"root",activatable:()=>!1,row:{className:i=>`help-row help-${i.topic}`}}),this.render()}traits_declare(){return[{key:"name",label:"KEY · VERB",className:"help-key",width:"minmax(9em, 12em)",cell:e=>e.name},{key:"does",label:"DOES",className:"help-does",width:"minmax(16em, 1fr)",cell:e=>e.does}]}render(){const e=o=>{const a=document.createElement("header");return a.className="files-path help-block-head",a.textContent=o,a},t=tn.map(o=>({key:`k:${o.key}`,name:o.key,does:o.does,topic:o.topic})),i=la.map((o,a)=>{const l=o.indexOf(" ");return{key:`v:${a}`,name:l<0?o:o.slice(0,l),does:l<0?"":o.slice(l+1).trim(),topic:"verb"}}),n=[{key:"g:games",name:"help games",does:"the /usr/games shelf — fortune, cal, weather and their kin, by category (type it in the console)",topic:"verb"}],r=[{key:"n:notes",name:"notes",does:"what the installed releases changed (notes pane opens it as a listing; the dashboard's WHAT'S NEW block too)",topic:"verb"}];this.listing.rows_set([{key:"keys",header:e("KEYS — Ctrl-B opens the focused pane's drawer; then one key presses one of its verbs"),rows:t},{key:"verbs",header:e("VERBS — the console language; the long form is docs/argus-lang.adoc"),rows:i},{key:"games",header:e("GAMES — the small pleasures, kept apart from the tools as BSD kept them"),rows:n},{key:"notes",header:e("NOTES — what changed, release by release"),rows:r}],{field:"help"})}}function sL(s,e){const{layout:t,panels:i,subjects:n}=s;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-help");return i.set("help",a,new tL(l)),{id:a,kind:"help",mount:l,dispose:()=>{i.delete(a),n.pane_leave(a)}}},open:()=>{const a=i.ids("help").find(d=>t.panes_shown().includes(d));if(a!==void 0)return t.focus_set(a),"help: on stage";const l=e.launcher_active();e.launcher_yield();const c=t.focused_get()??"files",h=e.instance_spawn("help");return l&&t.leaf_replace("files",h.id)?(t.focus_set(h.id),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):t.leaf_split(c,"col",h.id,!1)?(e.birth_record(h.id,c,"col",!1),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):(Ds(h.id),t.mount_remove(h.id),"help: could not open a pane")}}}const Ru=["___________________ _-_ ","\\__(==========/_=_/ ____.---'---`---.____"," \\_ \\ \\----._________.----/"," \\ \\ / / `-_-' "," __,--`.`-'..'-_ "," /____ || "," `--.____,-' "];function iL(){const s=Ru[0].length;let e=Number.NaN,t=0;return{title:"SL",tick:60,step:i=>{Number.isNaN(e)&&(e=-s),e+=1,t+=1,e>i.cols+6&&(e=-s)},draw:(i,n)=>{const r=Math.max(0,Math.floor((i.rows-Ru.length)/2));Ru.forEach((a,l)=>i.text(Math.round(e),r+l,a,n.lit));const o=t%2===0?"-~=":"-=~";i.text(Math.round(e)-o.length,r+1,o,n.cool)}}}const V0="ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ0123456789Z:・.=*+-<>¦|";function nL(){const s=new Map;let e=0;return{title:"CMATRIX",tick:50,step:(t,i)=>{e+=1;for(let n=0;n<t.cols;n++){const r=s.get(n);if(r===void 0){i()<.02&&s.set(n,{row:-1,speed:1+Math.floor(i()*2),length:4+Math.floor(i()*12),glyphs:[]});continue}e%r.speed===0&&(r.row+=1,r.glyphs.unshift(V0[Math.floor(i()*V0.length)]),r.glyphs.length>r.length&&r.glyphs.pop(),r.row-r.length>t.rows&&s.delete(n))}},draw:(t,i)=>{for(const[n,r]of s)r.glyphs.forEach((o,a)=>{const l=a===0?"#ffffff":a<r.length/2?i.lit:i.dim;t.put(n,r.row-a,o,l)})}}}function rL(){const s=[];return{title:"RAIN",tick:70,step:(e,t)=>{t()<.9&&s.push({col:Math.floor(t()*e.cols),row:0,splash:0});for(const i of s)i.row<e.rows-1?i.row+=1:i.splash+=1;for(let i=s.length-1;i>=0;i--)s[i].splash>3&&s.splice(i,1)},draw:(e,t)=>{for(const i of s){if(i.splash===0){e.put(i.col,i.row,"|",t.cool);continue}const n=["o","O","( )"][i.splash-1];e.text(i.col-(n.length>>1),e.rows-1,n,t.dim)}}}}function oL(){const s=[],e=[];let t=0;return{title:"ASCIIQUARIUM",tick:90,step:(i,n)=>{if(t+=1,s.length<Math.max(3,i.cols/12)&&n()<.08){const r=n()<.5;s.push({col:r?-4:i.cols+1,row:2+Math.floor(n()*Math.max(1,i.rows-5)),right:r,speed:1+Math.floor(n()*2),hue:Math.floor(n()*3)})}for(const r of s)t%r.speed===0&&(r.col+=r.right?1:-1);for(let r=s.length-1;r>=0;r--){const o=s[r];(o.col<-5||o.col>i.cols+2)&&s.splice(r,1)}if(n()<.3){const r=s[Math.floor(n()*s.length)];r!==void 0&&e.push({col:r.col+(r.right?4:-1),row:r.row-1})}for(const r of e)r.row-=1;for(let r=e.length-1;r>=0;r--)e[r].row<1&&e.splice(r,1)},draw:(i,n)=>{const r=(t%4<2?"~^":"^~").repeat(i.cols>>1);i.text(0,0,r,n.cool);const o=[n.lit,n.cool,n.warn];for(const a of s)i.text(a.col,a.row,a.right?"><>":"<><",o[a.hue]);for(const a of e)i.put(a.col,a.row,a.row%2===0?"o":".",n.dim);for(let a=2;a<i.cols;a+=7){const l=(t>>2)%2===0?0:1;for(let c=0;c<3;c++)i.put(a+(c+l)%2,i.rows-2-c,c%2===0?"(":")",n.dim)}i.text(0,i.rows-1,"^".repeat(i.cols),n.dim)}}}const q0=[[[0,0],[1,0],[2,0],[3,0]],[[0,0],[1,0],[0,1],[1,1]],[[1,0],[0,1],[1,1],[2,1]],[[0,0],[1,0],[1,1],[2,1]],[[1,0],[2,0],[0,1],[1,1]],[[0,0],[0,1],[1,1],[2,1]],[[2,0],[0,1],[1,1],[2,1]]],qr=10,Qr=20;function aL(){return{well:Array.from({length:Qr},()=>Array(qr).fill(0)),piece:null,score:0,lines:0,over:!1}}function gg(s,e){return e.cells.every(([t,i])=>{const n=e.x+t,r=e.y+i;return n>=0&&n<qr&&r<Qr&&(r<0||s[r][n]===0)})}function ku(s){const e=Math.max(...s.cells.flat())+1;return{...s,cells:s.cells.map(([t,i])=>[e-1-i,t])}}function lL(s,e){const t=Math.floor(e()*q0.length),i={cells:q0[t].map(n=>[n[0],n[1]]),x:3,y:0,kind:t+1};if(!gg(s.well,i)){s.over=!0;return}s.piece=i}function cL(s){const e=s.piece;if(e===null)return;e.cells.some(([,n])=>e.y+n<0)&&(s.over=!0);for(const[n,r]of e.cells){const o=e.y+r;o>=0&&(s.well[o][e.x+n]=e.kind)}const t=s.well.filter(n=>n.some(r=>r===0)),i=Qr-t.length;for(;t.length<Qr;)t.unshift(Array(qr).fill(0));s.well=t,s.lines+=i,s.score+=[0,100,300,500,800][i]??800,s.piece=null}function Tp(s,e){if(s.over)return;if(s.piece===null){lL(s,e);return}const t={...s.piece,y:s.piece.y+1};gg(s.well,t)?s.piece=t:cL(s)}function hL(s,e,t){if(s.over||s.piece===null)return!1;const i=s.piece,n=r=>gg(s.well,r)?(s.piece=r,!0):!1;switch(e){case"ArrowLeft":case"h":case"a":return n({...i,x:i.x-1}),!0;case"ArrowRight":case"l":case"d":return n({...i,x:i.x+1}),!0;case"ArrowUp":case"k":case"w":return n(ku(i))||n({...ku(i),x:i.x-1})||n({...ku(i),x:i.x+1}),!0;case"ArrowDown":case"j":case"s":return Tp(s,t),!0;case" ":{for(;s.piece!==null;)Tp(s,t);return!0}default:return!1}}function dL(){const s=aL();let e=Math.random;return{title:"TETRIS",tick:500,step:(t,i)=>{e=i,Tp(s,i)},draw:(t,i)=>{const n=Math.max(0,Math.floor((t.cols-(qr*2+2))/2)),r=Math.max(0,Math.floor((t.rows-Qr-1)/2)),o=["",i.cool,i.lit,i.warn,i.dim,i.lit,i.cool,i.warn];for(let a=0;a<Qr;a++){t.put(n,r+a,"|",i.dim),t.put(n+qr*2+1,r+a,"|",i.dim);for(let l=0;l<qr;l++){const c=s.well[a][l];c!==0&&t.text(n+1+l*2,r+a,"[]",o[c])}}if(t.text(n,r+Qr,"+"+"-".repeat(qr*2)+"+",i.dim),s.piece!==null)for(const[a,l]of s.piece.cells){const c=s.piece.y+l;c>=0&&t.text(n+1+(s.piece.x+a)*2,r+c,"[]",o[s.piece.kind])}s.over&&t.text(n+2,r+9," GAME OVER ",i.warn)},key:t=>hL(s,t,e),status:()=>`${s.score} · ${s.lines} lines${s.over?" · OVER":""}`,over:()=>s.over}}function uL(s,e,t){const i=s>>1,n=e>>1,r={body:[[i,n],[i-1,n],[i-2,n]],food:[0,0],heading:"right",next:"right",score:0,over:!1,cols:s,rows:e};return tz(r,t),r}function tz(s,e){for(let t=0;t<1e3;t++){const i=[Math.floor(e()*s.cols),Math.floor(e()*s.rows)];if(!s.body.some(([n,r])=>n===i[0]&&r===i[1])){s.food=i;return}}}const fL={up:"down",down:"up",left:"right",right:"left"};function pL(s,e){fL[e]!==s.heading&&(s.next=e)}function mL(s,e){if(s.over)return;s.heading=s.next;const[t,i]=s.body[0],n=s.heading==="up"?[t,i-1]:s.heading==="down"?[t,i+1]:s.heading==="left"?[t-1,i]:[t+1,i],r=n[0]<0||n[1]<0||n[0]>=s.cols||n[1]>=s.rows,o=s.body.some(([a,l])=>a===n[0]&&l===n[1]);if(r||o){s.over=!0;return}s.body.unshift(n),n[0]===s.food[0]&&n[1]===s.food[1]?(s.score+=10,tz(s,e)):s.body.pop()}const gL={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",k:"up",w:"up",j:"down",s:"down",h:"left",a:"left",l:"right",d:"right"};function _L(){let s=null;return{title:"SNAKE",tick:140,step:(e,t)=>{s===null&&(s=uL(Math.max(8,e.cols>>1),Math.max(6,e.rows-1),t)),mL(s,t)},draw:(e,t)=>{s!==null&&(e.text(0,s.rows,"-".repeat(s.cols*2),t.dim),e.text(s.food[0]*2,s.food[1],"**",t.warn),s.body.forEach(([i,n],r)=>e.text(i*2,n,r===0?"@@":"oo",r===0?t.lit:t.cool)),s.over&&e.text(Math.max(0,s.cols-6),s.rows>>1," GAME OVER ",t.warn))},key:e=>{const t=gL[e];return t===void 0||s===null?!1:(pL(s,t),!0)},status:()=>s===null?"":`${s.score}${s.over?" · OVER":""}`,over:()=>s?.over??!1}}const sz={sl:iL,cmatrix:nL,rain:rL,aquarium:oL,tetris:dL,snake:_L};function bL(s){return s in sz}const ML=8,vL=26,Bu=1.8,wL=100,K0=24;function Y0(s,e){let t=Math.floor(s/wL);return e/(t*Bu)<K0&&(t=Math.floor(e/K0/Bu)),t=Math.max(ML,Math.min(vL,t)),{w:t,h:Math.round(t*Bu)}}class yL{pane;field;canvas;state;focusMark;pausePill;program=null;name=null;paused=!1;timer=null;frame=null;observer;constructor(e){this.pane=e,this.field=$a(e,".games-field"),this.canvas=$a(e,".games-canvas"),this.state=e.querySelector(".pane-state"),this.focusMark=$a(e,".games-focus"),this.pausePill=$a(e,".games-pause"),this.field.tabIndex=0,this.pausePill.addEventListener("click",()=>this.pause_toggle()),$a(e,".games-restart").addEventListener("click",()=>{this.name!==null&&this.program_run(this.name)}),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",t=>{(!(t.relatedTarget instanceof Node)||!this.field.contains(t.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",t=>this.key_handle(t)),this.observer=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.draw()),this.observer?.observe(this.field)}program_run(e){this.name=e,this.program=sz[e](),this.paused=!1,this.pausePill.textContent="PAUSE",this.clock_start(),this.program.key!==void 0&&(this.field.focus(),this.focusMark_paint(!0)),this.draw()}program_name(){return this.name}paused_is(){return this.paused}pause_toggle(){this.program!==null&&(this.paused=!this.paused,this.pausePill.textContent=this.paused?"RESUME":"PAUSE",this.paused?this.clock_stop():this.clock_start(),this.state_paint())}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}dispose(){this.clock_stop(),this.observer?.disconnect()}key_handle(e){if(e.key==="Escape"){this.field_release(),e.stopPropagation();return}if(this.program!==null){if(e.key===" "&&this.program.key===void 0){this.pause_toggle(),e.preventDefault(),e.stopPropagation();return}this.program.key?.(e.key)===!0&&(e.preventDefault(),this.draw()),e.stopPropagation()}}clock_start(){this.clock_stop();const e=this.program;e!==null&&(this.timer=setInterval(()=>{this.field.offsetParent!==null&&(e.step(this.size_of(),Math.random),this.draw(),e.over?.()===!0&&this.clock_stop())},e.tick))}clock_stop(){this.timer!==null&&clearInterval(this.timer),this.timer=null}size_of(){const e=this.field.getBoundingClientRect(),t=Y0(e.width,e.height);return{cols:Math.max(10,Math.floor(e.width/t.w)),rows:Math.max(6,Math.floor(e.height/t.h))}}palette_read(){const e=getComputedStyle(this.pane),t=(i,n)=>e.getPropertyValue(i).trim()||n;return{lit:t("--harvestgold","#ffcc66"),dim:t("--butter","#ffff99"),warn:t("--tomato","#ff7766"),cool:t("--daybreak","#55aaff")}}draw(){this.frame===null&&(this.frame=requestAnimationFrame(()=>{this.frame=null,this.paint()}))}paint(){const e=this.program,t=this.canvas.getContext("2d");if(e===null||t===null)return;const i=this.field.getBoundingClientRect(),n=window.devicePixelRatio||1;(this.canvas.width!==Math.floor(i.width*n)||this.canvas.height!==Math.floor(i.height*n))&&(this.canvas.width=Math.floor(i.width*n),this.canvas.height=Math.floor(i.height*n)),t.setTransform(n,0,0,n,0,0),t.clearRect(0,0,i.width,i.height);const r=Y0(i.width,i.height);t.font=`${r.h-2}px 'Share Tech Mono', monospace`,t.textBaseline="top";const o=this.size_of(),a=(c,h,d,u)=>{c<0||h<0||c>=o.cols||h>=o.rows||(t.fillStyle=u,t.fillText(d,c*r.w,h*r.h))},l={cols:o.cols,rows:o.rows,put:a,text:(c,h,d,u)=>{[...d].forEach((p,f)=>{p!==" "&&a(c+f,h,p,u)})}};e.draw(l,this.palette_read()),this.state_paint()}state_paint(){if(this.state===null||this.program===null)return;const e=this.program.status?.()??"";this.state.textContent=[this.program.title,e,this.paused?"PAUSED":""].filter(t=>t!=="").join(" · ")}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("games-field-focused",e)}}function $a(s,e){const t=s.querySelector(e);if(t===null)throw new Error(`games pane: missing ${e}`);return t}function zL(s,e){const{layout:t,panels:i,subjects:n}=s;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-games"),c=new yL(l);return i.set("games",a,c),{id:a,kind:"games",mount:l,dispose:()=>{c.dispose(),i.delete(a),n.pane_leave(a)}}},show:a=>{const l=typeof a=="object"&&a!==null?a.program:void 0;if(typeof l!="string"||!bL(l))return`games: no program named ${String(l)}`;const c=i.ids("games").find(f=>t.panes_shown().includes(f));if(c!==void 0)return t.focus_set(c),i.get("games",c)?.program_run(l),`games: ${l} on the GAMES pane`;const h=e.launcher_active();e.launcher_yield();const d=t.focused_get()??"files",u=e.instance_spawn("games");return(h?t.leaf_replace("files",u.id):t.leaf_split(d,"col",u.id,!1))?(h?t.focus_set(u.id):e.birth_record(u.id,d,"col",!1),i.get("games",u.id)?.program_run(l),`games: ${l} in a GAMES pane (Esc gives the keyboard back; its PAUSE and RESTART pills on the frame)`):(Ds(u.id),t.mount_remove(u.id),"games: could not open a pane")}}}function at(s,e){const t=document.createElementNS("http://www.w3.org/2000/svg",s);for(const[i,n]of Object.entries(e))t.setAttribute(i,String(n));return t}const rr=["cruiser","raptor","talon","warbird"],SL={ship:'<g fill="currentColor"><ellipse cx="12" cy="6.5" rx="9" ry="4"/><rect x="9.5" y="9.5" width="5" height="6" rx="1"/><rect x="3" y="14" width="5" height="8" rx="2.2"/><rect x="16" y="14" width="5" height="8" rx="2.2"/><rect x="7" y="16" width="10" height="2.2" rx="1"/></g>',"klingon-cruiser":'<g fill="currentColor"><circle cx="12" cy="4" r="2.6"/><rect x="11" y="5.5" width="2" height="8.5"/><path d="M12 12.5 L22 20.5 L22.5 22.5 L17 19.2 L12 18 L7 19.2 L1.5 22.5 L2 20.5 Z"/><rect x="8.5" y="18.5" width="7" height="3.2" rx="1.2"/></g>',"klingon-raptor":'<path fill="currentColor" d="M12 1.5 L14 6.5 L22.5 10.5 L21.5 18 L19.5 12.5 L15 13.5 L14 20 L12 17 L10 20 L9 13.5 L4.5 12.5 L2.5 18 L1.5 10.5 L10 6.5 Z"/>',"klingon-talon":'<g fill="currentColor"><path d="M12 1.5 L13.6 11 L21.5 4.5 L19 15 L12 22 L5 15 L2.5 4.5 L10.4 11 Z"/><circle cx="12" cy="13.5" r="1.6" fill="#000"/></g>',"klingon-warbird":'<g fill="currentColor"><rect x="8.5" y="2" width="7" height="3.2" rx="1.6"/><rect x="11.1" y="4.5" width="1.8" height="7"/><path d="M1.5 13 Q12 6 22.5 13 L22 20 Q17 15.5 14 17 L12 22 L10 17 Q7 15.5 2 20 Z"/></g>',base:'<g fill="currentColor"><path d="M12 1.5 L17 12 L12 22.5 L7 12 Z"/><rect x="1.5" y="10.8" width="21" height="2.4" rx="1.2"/><circle cx="12" cy="12" r="3" fill="#000"/></g>',inhabited:'<circle cx="12" cy="12" r="7.5" fill="currentColor"/><path d="M4.5 12 Q12 15.5 19.5 12" fill="none" stroke="#000" stroke-width="1.6"/><path d="M5.5 8.5 Q12 11 18.5 8.5" fill="none" stroke="#000" stroke-width="1.2" opacity="0.6"/>',star:'<g stroke="currentColor" stroke-width="1.8" stroke-linecap="round" fill="none"><path d="M12 2 V22 M2 12 H22 M4.9 4.9 L19.1 19.1 M19.1 4.9 L4.9 19.1"/></g><circle cx="12" cy="12" r="2.6" fill="currentColor"/>',hole:'<g fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M12 12 m0 -2.5 a2.5 2.5 0 1 1 -2.5 2.5"/><path d="M12 12 m0 -6 a6 6 0 1 1 -6 6"/><path d="M12 12 m0 -9.5 a9.5 9.5 0 1 1 -9.5 9.5" opacity="0.5"/></g>',supernova:'<g fill="currentColor"><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(120 12 12)"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(240 12 12)"/><circle cx="12" cy="12" r="2.4"/></g>'},fl="tm-";function iz(s,e=null){return s==="klingon"?`${fl}klingon-${e!==null&&rr.includes(e)?e:rr[0]}`:`${fl}${s}`}function xL(){if(document.getElementById(`${fl}ship`)!==null)return null;const s=at("svg",{class:"tm-defs",width:0,height:0,"aria-hidden":"true"}),e=at("defs",{});for(const[i,n]of Object.entries(SL)){const r=at("symbol",{id:`${fl}${i}`,viewBox:"0 0 24 24"});r.innerHTML=n,e.append(r)}const t=(i,n)=>{const r=at("radialGradient",{id:`${fl}${i}`});for(const[o,a,l]of n){const c=at("stop",{offset:o});c.setAttribute("style",`stop-color: ${a}; stop-opacity: ${l}`),r.append(c)}return r};return e.append(t("halo",[[0,"var(--butter)",.9],[.35,"var(--harvestgold)",.5],[1,"var(--harvestgold)",0]]),t("halo-nova",[[0,"var(--butter)",.9],[.3,"var(--pumpkin-pie)",.6],[1,"var(--pumpkin-pie)",0]]),t("halo-mars",[[0,"var(--butter)",.8],[.3,"var(--mars)",.6],[1,"var(--mars)",0]]),t("photon-core",[[0,"#fff",1],[.35,"#ffd27a",1],[1,"#ff6a1a",1]]),t("photon-halo",[[0,"#ff6a1a",.55],[1,"#ff6a1a",0]])),s.append(e),s}function _g(s,e,t=null,i=0){const n=at("g",{class:`tm-mark tm-mark-${s}`});return n.append(at("use",{href:`#${iz(s,t)}`,x:-e.size/2,y:-e.size/2,width:e.size,height:e.size,class:"tm-symbol"})),nz(n,e.cx,e.cy,i),n}function nz(s,e,t,i=0){s.setAttribute("transform",i===0?`translate(${e} ${t})`:`translate(${e} ${t}) rotate(${i})`)}function bg(s,e=null){const t=at("svg",{viewBox:"0 0 24 24",class:`tm-icon tm-icon-${s}`,"aria-hidden":"true"});return t.append(at("use",{href:`#${iz(s,e)}`})),t}const Ac={ship:"E",klingon:"K",base:"#",inhabited:"@",star:"*",hole:" ",supernova:"///"},OL=[{kind:"ship",name:"ENTERPRISE"},{kind:"klingon",name:"KLINGON"},{kind:"base",name:"STARBASE"},{kind:"inhabited",name:"INHABITED"},{kind:"star",name:"STAR"},{kind:"hole",name:"BLACK HOLE"},{kind:"supernova",name:"SUPERNOVA"}],EL=/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,AL=/^Klingon at (\d+),(\d+) escapes to quadrant/,DL=/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/;class pl{marks=new Map;mark_of(e){return this.marks.get(pl.key_of(e))??null}line_hear(e){const t=EL.exec(e);if(t!==null){const n=`${t[1]},${t[2]}`,r=this.marks.get(n);return this.marks.delete(n),r!==void 0&&this.marks.set(`${t[3]},${t[4]}`,r),!0}const i=AL.exec(e)??DL.exec(e);return i!==null?(this.marks.delete(`${i[1]},${i[2]}`),!0):!1}reconcile(e,t={}){t.reset===!0&&this.marks.clear();const i=new Set(e.map(n=>pl.key_of(n)));for(const n of[...this.marks.keys()])i.has(n)||this.marks.delete(n);e.forEach((n,r)=>{const o=pl.key_of(n);if(t.byOrder===!0){this.marks.set(o,rr[r%rr.length]);return}this.marks.has(o)||this.marks.set(o,this.leastWorn_get())})}clear(){this.marks.clear()}leastWorn_get(){const e=new Map(rr.map(i=>[i,0]));for(const i of this.marks.values())e.set(i,(e.get(i)??0)+1);let t=rr[0];for(const i of rr)(e.get(i)??0)<(e.get(t)??0)&&(t=i);return t}static key_of(e){return`${e.x},${e.y}`}}function TL(s,e,t,i){const n=Math.max(0,Math.min(100,100*s/Math.max(1,e)));return i?{className:"tb-ring tb-ring-docked",width:.09,percent:n}:t?{className:`tb-ring ${n>60?"tb-ring-full":n>30?"tb-ring-mid":"tb-ring-low"}`,width:.025+.085*n/100,percent:n}:{className:"tb-ring tb-ring-down",width:.02,percent:n}}function V(s,e,t){const i=document.createElement(s);return i.className=e,t!==void 0&&(i.textContent=t),i}function Es(s,e,t){const i=V("button",`tb-pill ${s}`,e);return i.type="button",i.addEventListener("click",t),i}const IL=16;class rz{constructor(e,t,i){this.onCommit=i,this.size=e;const n=e/2;this.root=V("div","tb-wheel");const r=at("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,role:"img","aria-label":t});r.classList.add("tb-wheel-face"),r.append(at("circle",{cx:n,cy:n,r:n-4,class:"tb-wheel-rim"})),r.append(at("circle",{cx:n,cy:n,r:(n-4)*.66,class:"tb-wheel-ring"})),r.append(at("circle",{cx:n,cy:n,r:(n-4)*.33,class:"tb-wheel-ring"}));for(let l=0;l<36;l++){const c=l*Math.PI/18,h=l%3===0,d=n-4-(h?12:7);r.append(at("line",{x1:n+d*Math.sin(c),y1:n-d*Math.cos(c),x2:n+(n-4)*Math.sin(c),y2:n-(n-4)*Math.cos(c),class:h?"tb-wheel-tick-major":"tb-wheel-tick"}))}for(const l of[0,90,180,270]){const c=l*Math.PI/180,h=at("text",{x:n+(n-26)*Math.sin(c),y:n-(n-26)*Math.cos(c)+4,"text-anchor":"middle",class:"tb-wheel-label"});h.textContent=String(l),r.append(h)}this.wedge=at("path",{d:"",class:"tb-wheel-wedge"}),r.append(this.wedge),this.marks=at("g",{class:"tb-wheel-marks"}),r.append(this.marks),this.needle=at("line",{x1:n,y1:n,x2:n,y2:14,class:"tb-wheel-needle"}),r.append(this.needle),r.append(at("circle",{cx:n,cy:n,r:6,class:"tb-wheel-hub"})),this.root.append(r);const o=V("div","tb-wheel-row");this.readout=V("span","tb-wheel-readout","0°"),this.commit=Es("tb-commit","SET COURSE",()=>this.onCommit(Math.round(this.degrees))),o.append(this.readout,this.commit),this.root.append(o);const a=l=>{const c=r.getBoundingClientRect(),h=l.clientX-c.left-c.width/2,d=l.clientY-c.top-c.height/2;this.degrees_set((Math.atan2(h,-d)*180/Math.PI+360)%360)};r.addEventListener("pointerdown",l=>{r.setPointerCapture(l.pointerId),a(l)}),r.addEventListener("pointermove",l=>{l.buttons!==0&&a(l)})}onCommit;root;needle;marks;wedge;readout;commit;degrees=0;wedgeHalf=null;size;degrees_set(e){this.degrees=e;const t=this.size/2,i=e*Math.PI/180;this.needle.setAttribute("x2",String(t+(t-14)*Math.sin(i))),this.needle.setAttribute("y2",String(t-(t-14)*Math.cos(i))),this.readout.textContent=`${Math.round(e)}°`,this.wedge_draw()}degrees_get(){return this.degrees}wedge_set(e){this.wedgeHalf=e,this.wedge_draw()}wedge_draw(){if(this.wedgeHalf===null){this.wedge.setAttribute("d","");return}const e=this.size/2,t=e-14,i=(this.degrees-this.wedgeHalf)*Math.PI/180,n=(this.degrees+this.wedgeHalf)*Math.PI/180,r=e+t*Math.sin(i),o=e-t*Math.cos(i),a=e+t*Math.sin(n),l=e-t*Math.cos(n);this.wedge.setAttribute("d",`M ${e} ${e} L ${r} ${o} A ${t} ${t} 0 0 1 ${a} ${l} Z`)}marks_set(e){this.marks.replaceChildren();const t=this.size/2;for(const i of e){const n=i.bearing*Math.PI/180,r=(t-4)*.8,o=t+r*Math.sin(n),a=t-r*Math.cos(n),l=i.kind==="klingon"?i.bearing+180:0,c=_g(i.kind,{cx:o,cy:a,size:IL},i.variant??null,l);c.classList.add("tb-wheel-mark",`tb-wheel-mark-${i.kind}`);const h=at("title",{});h.textContent=i.label,c.append(h),this.marks.append(c)}}lit_set(e,t="SET COURSE"){this.root.classList.toggle("tb-lit",e),this.commit.disabled=!e,this.commit.textContent=t}}class gr{constructor(e,t,i,n){this.digits=i,this.onCommit=n,this.root=V("div","tb-slider");const r=V("label","tb-slider-label",t);r.htmlFor=e,this.input=document.createElement("input"),this.input.type="range",this.input.id=e,this.input.className="tb-slider-input",this.input.addEventListener("input",()=>{this.shown_refresh(),this.onInput?.(this.value_get())});const o=V("div","tb-slider-column");this.ticks=V("div","tb-slider-ticks"),this.note=V("span","tb-slider-note"),o.append(this.input,this.ticks,this.note),this.shown=V("span","tb-slider-readout","—"),this.commit=Es("tb-commit","SET",()=>this.onCommit(this.value_get())),this.root.append(r,o,this.shown,this.commit)}digits;onCommit;root;input;shown;commit;note;ticks;onInput=null;range_set(e,t,i,n=0){const r=e.min??0,o=e.max??1;this.input.min=String(r),this.input.max=String(o),this.input.step=String(e.step??1),this.input.value=String(Math.min(o,Math.max(r,t))),this.note.textContent=i,this.ticks.replaceChildren();for(let a=0;a<n;a++){const l=r+(o-r)*a/Math.max(1,n-1);this.ticks.append(V("span","tb-slider-tick",Number.isInteger(l)?String(l):l.toFixed(1)))}this.shown_refresh()}input_listen(e){this.onInput=e}note_set(e){this.note.textContent=e}value_get(){return Number(this.input.value)}value_set(e){this.input.value=String(e),this.shown_refresh()}lit_set(e,t="SET"){this.root.classList.toggle("tb-lit",e),this.input.disabled=!e,this.commit.disabled=!e,this.commit.textContent=t}lit_is(){return this.root.classList.contains("tb-lit")}shown_refresh(){this.shown.textContent=this.value_get().toFixed(this.digits)}}class Dc{root;buttons=[];note;constructor(e,t,i){this.root=V("div","tb-pillrow"),e!==""&&this.root.append(V("span","tb-slider-label",e));const n=V("div","tb-slider-column"),r=V("div","tb-pills");for(const o of t){const a=Es("tb-choice",o.label,()=>i(o.line,o.label));a.dataset.line=o.line,this.buttons.push(a),r.append(a)}this.note=V("span","tb-slider-note",""),n.append(r,this.note),this.root.append(n)}note_set(e){this.note.textContent=e}lit_set(e){this.root.classList.toggle("tb-lit",e);for(const t of this.buttons)t.disabled=!e}}const CL=[[/Klingon attack:/,"incoming"],[/^HIT: \d+ units/,"hit"],[/CRITICAL HIT/,"hit"],[/\*\*\* Klingon at \d+,\d+ destroyed \*\*\*/,"explosion"],[/\*\*\*\*\* .* destroyed \*\*\*\*\*/,"explosion"],[/Starbase at \d+,\d+ destroyed/,"explosion"],[/Inhabited starsystem .* destroyed/,"explosion"],[/^Torpedo track/,"torpedo"],[/^Phaser bank \d+ fires:/,"phaser"],[/^Phasers locked on target/,"phaser"],[/^Starbase in \d+,\d+ responds/,"hail"],[/^Password verified; self destruct sequence continues/,"destruct"]];function RL(s){const e=[];for(const[t,i]of CL)t.test(s)&&!e.includes(i)&&e.push(i);return e}function kL(s,e){const t=[];if(s!==null&&s.condition.name!==e.condition.name)switch(e.condition.name){case"RED":t.push("redalert");break;case"YELLOW":t.push("yellowalert");break;case"DOCKED":t.push("dock");break;default:t.push("green");break}return s!==null&&(s.position.quadrant.x!==e.position.quadrant.x||s.position.quadrant.y!==e.position.quadrant.y)&&t.push("sensor"),t}function BL(s){switch(s){case"abandon":return"transporter";case"destruct":return"destruct";case"computer":return"thinking";default:return null}}function NL(s,e){return s!=="distance"?null:e==="impulse"?"impulse":e==="move"||e==="ram"?"warp":null}function ar(s,e){return e==="computer"&&s==="MOVE"?"MOVE (COMPUTER)":e==="commit"?/^SET COURSE/.test(s)?"SET COURSE":"SLIDER SET":e==="choice"&&/^\d+°$/.test(s)?"BURST ANGLE":/^CANCEL/.test(s)?"CANCEL":s}const xs=10,xl=8,GL="*",PL="#",oz="E",LL="Q",WL="K",FL="@",az=" ",UL=7,$L=64,jL=63,HL=0,VL=1,qL=2,KL=3,YL=[{name:"warp drive",person:"Scotty"},{name:"S.R. scanners",person:"Scotty"},{name:"L.R. scanners",person:"Scotty"},{name:"phasers",person:"Sulu"},{name:"photon tubes",person:"Sulu"},{name:"impulse engines",person:"Scotty"},{name:"shield control",person:"Sulu"},{name:"computer",person:"Spock"},{name:"subspace radio",person:"Uhura"},{name:"life support",person:"Scotty"},{name:"navigation system",person:"Chekov"},{name:"cloaking device",person:"Scotty"},{name:"transporter",person:"Scotty"},{name:"shuttlecraft",person:"Scotty"},{name:"*ERR 14*",person:"Nobody"},{name:"*ERR 15*",person:"Nobody"}],XL=["GREEN","DOCKED","YELLOW","RED"];function Qc(s,e){return(Math.atan2(e.y-s.y,-(e.x-s.x))*180/Math.PI+360)%360}function Wh(s,e){return Math.hypot(e.x-s.x,e.y-s.y)}function ZL(s){switch(s){case oz:case LL:return"ship";case WL:return"klingon";case PL:return"base";case GL:return"star";case FL:return"inhabited";case az:return"hole";default:return"empty"}}function JL(s){const e=new Map;for(const t of s)(t.evcode&jL)!==UL||(t.evcode&$L)!==0||e.set(t.systemname,t.date);return YL.map((t,i)=>({index:i,name:t.name,person:t.person,repairAt:e.get(i)??null})).filter(t=>!t.name.startsWith("*"))}function QL(s){const e=s.Etc.nkling;switch(s.Ship.cond){case KL:return e===1?"1 Klingon in this quadrant":`${e} Klingons in this quadrant`;case qL:return s.Ship.energy<s.Param.energylow?"energy low":"Klingons near";case VL:return"docked at a starbase";case HL:default:return"all clear"}}function e3(s){const{Ship:e,Now:t,Game:i,Param:n,Etc:r,Sect:o,Quad:a}=s,l={x:e.quadx,y:e.quady},c={x:e.sectx,y:e.secty},h=[];for(let m=0;m<xs;m++){const v=[];for(let y=0;y<xs;y++){const b=o[m]?.[y]??az;v.push({x:m,y,kind:ZL(b),glyph:b})}h.push(v)}const d=r.klingon.slice(0,r.nkling).map(m=>({x:m.x,y:m.y,bearing:Qc(c,m),range:Wh(c,m),power:m.power,mark:null})).sort((m,v)=>m.range-v.range),u=t.base.slice(0,t.bases).map(m=>({x:m.x,y:m.y}));let p=null;for(const m of u){const v=Wh(l,m);(p===null||v<p.range)&&(p={at:m,range:v,here:v===0})}const f=[];for(let m=0;m<xl;m++){const v=[];for(let y=0;y<xl;y++){const w=a[m]?.[y]?.scanned??-1,z=w<0?null:w>=1e3?"///":String(w).padStart(3,"0");v.push({x:m,y,here:m===l.x&&y===l.y,code:z,supernova:w>=1e3,klingons:w<0||w>=1e3?0:Math.floor(w/100),bases:w<0||w>=1e3?0:Math.floor(w%100/10)})}f.push(v)}const _=JL(s.Event),g=_.filter(m=>m.repairAt!==null).sort((m,v)=>(m.repairAt??0)-(v.repairAt??0));return{condition:{name:XL[e.cond]??"GREEN",why:QL(s)},ship:{shipName:e.shipname,energy:e.energy,energyMax:n.energy,shield:e.shield,shieldMax:n.shield,shieldsUp:e.shldup!==0,cloaked:e.cloaked!==0,torpedoes:e.torped,torpedoesMax:n.torped,reserves:e.reserves,reservesMax:n.reserves,crew:e.crew,warp:e.warp},mission:{stardate:t.date,timeLeft:t.time,klingonsLeft:t.klings,klingonsStart:n.klings,killed:i.killk,captives:i.captives,starbases:t.bases},position:{quadrant:l,sector:c},sectors:h,klingons:d,bases:u,nearestBase:p,chart:f,devices:_,damaged:g,game:{killk:i.killk,killb:i.killb,kills:i.kills,killinhab:i.killinhab,helps:i.helps,captives:i.captives,deaths:i.deaths,killed:i.killed!==0,skill:i.skill,won:s.Move.endgame>0,abandoned:e.ship!==oz},param:{warptime:n.warptime,dockfac:n.dockfac,klingpwr:n.klingpwr,date:n.date}}}const t3=["novice","fair","good","expert","commodore","impossible"];function lz(s){const{game:e,mission:t,param:i}=s,n=[];n.push({label:`${e.killk} Klingons killed`,points:Math.trunc(i.klingpwr/4)*e.killk});const r=Math.max(1,t.stardate-i.date),o=e.killk/r;return n.push({label:`kill rate ${o.toFixed(2)} Klingons/stardate`,points:Math.trunc(400*o)}),n.push({label:`penalty for ${t.klingonsLeft} Klingons remaining`,points:Math.trunc(-400*t.klingonsLeft/(e.killk+1))}),e.won&&n.push({label:`bonus for winning a ${t3[e.skill-1]??""} game`,points:100*e.skill}),e.killed&&n.push({label:"penalty for getting killed",points:-500}),n.push({label:`${e.killb} starbases killed`,points:-100*e.killb}),n.push({label:`${e.helps} calls for help`,points:-100*e.helps}),n.push({label:`${e.kills} stars destroyed`,points:-5*e.kills}),n.push({label:`${e.killinhab} inhabited starsystems destroyed`,points:-150*e.killinhab}),e.abandoned&&n.push({label:"penalty for abandoning ship",points:-200}),n.push({label:`${e.captives} Klingons captured`,points:3*e.captives}),n.push({label:`${e.deaths} casualties`,points:-e.deaths}),{items:n,total:n.reduce((a,l)=>a+l.points,0)}}function X0(s,e){const{quadrant:t,sector:i}=s.position,n=t.x+i.x/xs-(e.quadrant.x+e.sector.x/xs),r=e.quadrant.y+e.sector.y/xs-(t.y+i.y/xs);let o=Math.atan2(r,n);return o<0&&(o+=2*Math.PI),{course:Math.trunc(o*180/Math.PI+.5)%360,distance:Math.hypot(n,r)}}function s3(s,e,t){const{quadrant:i,sector:n}=s.position,r=e*Math.PI/180,o=Math.min(xl*xs-1,Math.max(0,Math.round(i.x*xs+n.x-Math.cos(r)*t*xs))),a=Math.min(xl*xs-1,Math.max(0,Math.round(i.y*xs+n.y+Math.sin(r)*t*xs)));return{quadrant:{x:Math.trunc(o/xs),y:Math.trunc(a/xs)},sector:{x:o%xs,y:a%xs}}}function cz(s,e,t){const i=Math.trunc((s+.05)*e*e*e);return{stardates:t*s/(e*e),units:i,unitsShielded:2*i}}function i3(s){return{stardates:s/.095,units:Math.trunc(20+100*s)}}function hz(s){return Math.trunc(Math.pow(.9,s*10)*98+.5)}function Z0(s,e){if(s.repairAt===null)return null;const t=s.repairAt-e.mission.stardate,i=e.condition.name==="DOCKED",n=i?1/e.param.dockfac:1,r=i?1:e.param.dockfac;return{inFlight:t*n+.005,docked:t*r+.005}}function dz(s,e){const t=[],i=(d,u)=>`${d>0?"+":d<0?"−":""}${Math.abs(d).toFixed(u)}`,n=e.mission.stardate-s.mission.stardate;Math.abs(n)>=.005&&t.push({label:"STARDATE",change:i(n,2),bad:!1});const r=e.ship.energy-s.ship.energy;r!==0&&t.push({label:"ENERGY",change:i(r,0),bad:r<0});const o=e.ship.shield-s.ship.shield;o!==0&&t.push({label:"SHIELDS",change:i(o,0),bad:o<0});const a=e.ship.torpedoes-s.ship.torpedoes;a!==0&&t.push({label:"TORPEDOES",change:i(a,0),bad:!1});const l=e.mission.klingonsLeft-s.mission.klingonsLeft;l!==0&&t.push({label:"KLINGONS",change:`${i(l,0)} · ${e.mission.klingonsLeft} LEFT`,bad:l>0});const c=e.damaged.filter(d=>!s.damaged.some(u=>u.index===d.index));c.length>0&&t.push({label:"DAMAGE",change:c.map(d=>d.name.toUpperCase()).join(" · "),bad:!0});const h=s.damaged.filter(d=>!e.damaged.some(u=>u.index===d.index));return h.length>0&&t.push({label:"REPAIRED",change:h.map(d=>d.name.toUpperCase()).join(" · "),bad:!1}),s.condition.name!==e.condition.name&&t.push({label:"CONDITION",change:e.condition.name,bad:e.condition.name==="RED"}),t}const n3=[["return to continue","return"],["What length game","length"],["What skill game","skill"],["Enter password verification","password-verify"],["Enter a password","password"],["Enter tournament code","tournament"],["Command","command"],["Torpedo course","torpedo-course"],["Course","course"],["course","bank-course"],["Distance","distance"],["distance","computer-distance"],["Warp factor","warp-factor"],["warp factor","computer-warp"],["How long","how-long"],["Manual or automatic","manual-automatic"],["Units to fire","units"],["units","bank-units"],["spread","spread"],["Do you want a burst","burst"],["burst angle","burst-angle"],["Up or down","up-down"],["Request","request"],["Quadrant","quadrant"],["q-y","quadrant-y"],["Sector","sector"],["s-y","sector-y"],["range","range"],["direction","direction"],["status report","status-report"],["Another game","another"]];function r3(s){const e=s.replace(/[:.\s]+$/,"");if(e==="")return"return";for(const[t,i]of n3)if(e.endsWith(t))return i;return/wise$|certain that is wise$|Shall we cancel our rest period$/.test(e)?"yes-no":"unknown"}const md=[{id:"move",label:"MOVE",station:"helm",line:"m",asks:["course","distance"]},{id:"ram",label:"RAM",station:"helm",line:"ram",asks:["course","distance"]},{id:"warp",label:"WARP",station:"helm",line:"w",asks:["warp-factor"]},{id:"impulse",label:"IMPULSE",station:"helm",line:"i",asks:["course","distance"]},{id:"dock",label:"DOCK",station:"helm",line:"do",asks:[]},{id:"undock",label:"UNDOCK",station:"helm",line:"u",asks:[]},{id:"rest",label:"REST",station:"helm",line:"r",asks:["how-long"]},{id:"phasers",label:"PHASERS",station:"tactical",line:"p",asks:["manual-automatic","units"]},{id:"torpedo",label:"TORPEDO",station:"tactical",line:"t",asks:["torpedo-course","burst","burst-angle"]},{id:"shields",label:"SHIELDS",station:"tactical",line:"sh",asks:["up-down"]},{id:"cloak",label:"CLOAK",station:"tactical",line:"cl",asks:["up-down"]},{id:"capture",label:"CAPTURE",station:"tactical",line:"ca",asks:[]},{id:"visual",label:"VISUAL",station:"tactical",line:"v",asks:["direction"]},{id:"computer",label:"COMPUTER",station:"ship",line:"c",asks:["request"]},{id:"help",label:"CALL STARBASE",station:"ship",line:"help",asks:[]},{id:"dump",label:"DUMP",station:"ship",line:"dump",asks:[]},{id:"credits",label:"CREDITS",station:"ship",line:"cr",asks:[]},{id:"abandon",label:"ABANDON",station:"ship",line:"abandon",asks:[],grave:!0},{id:"destruct",label:"DESTRUCT",station:"ship",line:"destruct",asks:["password-verify"],grave:!0},{id:"terminate",label:"TERMINATE",station:"ship",line:"terminate",asks:[],grave:!0}];function Os(s,e){switch(s){case"return":return{kind:"auto"};case"length":return{kind:"pills",choices:[{label:"SHORT",line:"s"},{label:"MEDIUM",line:"m"},{label:"LONG",line:"l"},{label:"RESTART",line:"restart"}]};case"skill":return{kind:"pills",choices:[{label:"NOVICE",line:"n"},{label:"FAIR",line:"f"},{label:"GOOD",line:"g"},{label:"EXPERT",line:"e"},{label:"COMMODORE",line:"c"},{label:"IMPOSSIBLE",line:"i"}]};case"password":case"tournament":case"password-verify":return{kind:"auto"};case"course":case"torpedo-course":case"direction":case"bank-course":return{kind:"wheel",min:0,max:360,step:1,commit:"SET COURSE",cancel:"-1"};case"distance":return{kind:"slider",min:0,max:15,step:.1,commit:"ENGAGE",cancel:"-1"};case"computer-distance":case"range":return{kind:"slider",min:0,max:15,step:.1,commit:"SET"};case"warp-factor":return{kind:"slider",min:1,max:10,step:.1,commit:"SET WARP",cancel:"-1"};case"computer-warp":return{kind:"slider",min:1,max:10,step:.1,commit:"SET"};case"how-long":return{kind:"slider",min:0,max:Math.max(.1,e?.mission.timeLeft??15),step:.1,commit:"REST",cancel:"0"};case"manual-automatic":return{kind:"pills",choices:[{label:"MANUAL",line:"m"},{label:"AUTOMATIC",line:"a"}]};case"units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"FIRE",cancel:"0"};case"bank-units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"SET",cancel:"0"};case"spread":return{kind:"slider",min:0,max:1,step:.05,commit:"SET"};case"burst":case"status-report":case"another":case"yes-no":return{kind:"yesno",choices:[{label:"YES",line:"y"},{label:"NO",line:"n"}]};case"burst-angle":return{kind:"pills",choices:[1,2,3,5,8,10,12,15].map(t=>({label:`${t}°`,line:String(t)})),cancel:"0"};case"up-down":return{kind:"pills",choices:[{label:"UP",line:"u"},{label:"DOWN",line:"d"}]};case"request":return{kind:"pills",choices:[{label:"CHART",line:"ch"},{label:"TRAJECTORY",line:"t"},{label:"COURSE",line:"c"},{label:"MOVE",line:"m"},{label:"SCORE",line:"s"},{label:"PHASER EFFECT",line:"p"},{label:"WARP COST",line:"w"},{label:"IMPULSE COST",line:"i"},{label:"DISTRESS LIST",line:"d"}]};case"quadrant":case"quadrant-y":return{kind:"slider",min:0,max:xl-1,step:1,commit:"SET"};case"sector":case"sector-y":return{kind:"slider",min:0,max:xs-1,step:1,commit:"SET"};default:return{kind:"text"}}}function o3(){return`argus${Math.floor(Math.random()*9e3+1e3)}`}class a3{constructor(e){this.hooks=e}hooks;open=null;lastCommand=null;password=o3();ended=!1;ask(e){const t=r3(e);return t==="return"?Promise.resolve(""):t==="password"||t==="tournament"||t==="password-verify"?Promise.resolve(this.password):(t==="command"&&(this.lastCommand=null),new Promise(i=>{this.open={question:{prompt:e,question:t,command:this.lastCommand},answer:i},this.hooks.question_changed(this.open.question)}))}question_get(){return this.open?.question??null}answer(e){if(this.open===null)return!1;const{answer:t}=this.open;return this.open=null,this.hooks.question_changed(null),t(e),!0}command_send(e){return this.open?.question.question!=="command"?!1:(this.lastCommand=e,this.answer(e.line))}abandon(){if(this.open===null)return!1;const{answer:e}=this.open;return this.open=null,this.hooks.question_changed(null),e(null),!0}text_take(e){this.hooks.text_written(e)}event_take(e,t){e==="games.trek.state"&&typeof t=="object"&&t!==null&&this.hooks.state_shown(t)}end(e){this.ended||(this.ended=!0,this.open=null,this.hooks.ended(e))}ended_is(){return this.ended}}const Rn={torpedoPoint:140,sector:170,burst:800,beam:900,rescan:350,flare:900,tail:300},l3=[[/^Torpedo track(?:, torpedo number \d+)?:/,()=>({kind:"torpedo-head"})],[/^\s*(\d+\.\d)\s+(\d+\.\d)\s*$/,s=>({kind:"torpedo-point",at:{x:Number(s[1]),y:Number(s[2])}})],[/^Torpedo missed|^Torpedo disappears into a black hole/,()=>({kind:"torpedo-end"})],[/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/,s=>({kind:"kill",at:li(s,1)})],[/^Starbase at (\d+),(\d+) destroyed/,s=>({kind:"kill",at:li(s,1)})],[/^Inhabited starsystem .* at (\d+),(\d+) destroyed/,s=>({kind:"kill",at:li(s,1)})],[/^Unknown object . at (\d+),(\d+) destroyed/,s=>({kind:"kill",at:li(s,1)})],[/Star at (\d+),(\d+) gone nova/,s=>({kind:"nova",at:li(s,1)})],[/^Photon tubes misfire/,()=>({kind:"misfire"})],[/^(\d+) unit hit on Klingon at (\d+),(\d+)/,s=>({kind:"phaser",at:li(s,2)})],[/^HIT: (\d+) units(?: from (\d+),(\d+))?(?:, shields absorb (\d+)%)?/,s=>({kind:"incoming",hit:Number(s[1]),from:s[2]===void 0?null:li(s,2),absorb:s[4]===void 0?0:Number(s[4])})],[/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,s=>({kind:"klingon-move",from:li(s,1),to:li(s,3)})],[/^Klingon at (\d+),(\d+) escapes to quadrant (\d+),(\d+)/,s=>({kind:"klingon-escape",from:li(s,1),quadrant:li(s,3)})],[/RED ALERT: supernova occurring at (\d+),(\d+)/,s=>({kind:"supernova",at:li(s,1)})],[/^\s*in quadrant (\d+),(\d+)\.\s+Caution is advised/,s=>({kind:"supernova-report",quadrant:li(s,1)})]];function li(s,e){return{x:Number(s[e]),y:Number(s[e+1])}}function c3(s){for(const[e,t]of l3){const i=e.exec(s);if(i!==null)return t(i)}return null}class h3{constructor(e=d3){this.reduced=e}reduced;frames=[];running=!1;skipping=!1;waiting=new Set;played={};push(e){this.frames.push(e),this.pump()}skip(){if(!(this.frames.length===0&&!this.running)){this.skipping=!0;for(const e of this.waiting)e();this.waiting.clear()}}busy_is(){return this.running||this.frames.length>0}pending_count(){return this.frames.length}skipping_is(){return this.skipping}async settle(){for(;this.busy_is();)await new Promise(e=>{setTimeout(e,1)})}wait(e){return this.skipping||e<=0?Promise.resolve():new Promise(t=>{const i=setTimeout(()=>{this.waiting.delete(n),t()},e),n=()=>{clearTimeout(i),t()};this.waiting.add(n)})}async tween(e,t){const i=J0();for(;!this.skipping;){const n=Math.min(1,(J0()-i)/Math.max(1,e));if(t(n),n>=1)return;await u3(this)}t(1)}async pump(){if(!this.running){this.running=!0;try{for(;this.frames.length>0;){const e=this.frames.shift();this.played[e.kind]=(this.played[e.kind]??0)+1;const t=this.skipping||this.reduced();try{await e.run(t)}catch{}}}finally{this.running=!1,this.skipping=!1}}}}function d3(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function J0(){return typeof performance=="object"?performance.now():Date.now()}function u3(s){return typeof requestAnimationFrame=="function"?new Promise(e=>{requestAnimationFrame(()=>e())}):s.wait(16)}function ma(s){return[s.y+.5,s.x+.5]}function uz(s,e){return(Math.atan2(e.y-s.y,-(e.x-s.x))*180/Math.PI+360)%360}function f3(s,e,t=10){const i={x:s.quadrant.x*t+s.sector.x,y:s.quadrant.y*t+s.sector.y},n={x:e.quadrant.x*t+e.sector.x,y:e.quadrant.y*t+e.sector.y},r={x:n.x-i.x,y:n.y-i.y},o=(p,f,_)=>{let g=_?1/0:-1/0;for(const m of["x","y"]){if(r[m]===0)continue;const v=p[m]*t-.5,y=p[m]*t+t-.5,b=(v-f[m])/r[m],w=(y-f[m])/r[m];_?g=Math.min(g,Math.max(b,w)):g=Math.max(g,Math.min(b,w))}return Number.isFinite(g)?Math.max(0,Math.min(1,g)):_?1:0},a=o(s.quadrant,i,!0),l=o(e.quadrant,i,!1),c=.7,h={x:i.x+r.x*a-s.quadrant.x*t,y:i.y+r.y*a-s.quadrant.y*t},d={x:i.x+r.x*l-e.quadrant.x*t,y:i.y+r.y*l-e.quadrant.y*t},u=Math.hypot(r.x,r.y)||1;return{exit:{x:h.x+r.x/u*c,y:h.y+r.y/u*c},entry:{x:d.x-r.x/u*c,y:d.y-r.y/u*c}}}function gd(s,e=""){const t=at("g",{class:`tb-motion ${e}`.trim()});return s.append(t),t}const p3=.7;async function ja(s,e,t,i,n,r={},o=!1){if(o)return;const a=gd(s,"tb-motion-slide"),[l,c]=ma(i),[h,d]=ma(n),u=r.hostile===!0?" tb-hostile":"";a.append(at("line",{class:`tb-track${u}`,x1:l,y1:c,x2:h,y2:d}));const p=at("line",{class:`tb-pulse tb-pulse-wide${u}`,x1:l,y1:c,x2:l,y2:c}),f=at("line",{class:`tb-pulse tb-pulse-core${u}`,x1:l,y1:c,x2:l,y2:c}),_=r.heading??uz(i,n),g=_g(t.kind,{cx:l,cy:c,size:p3},t.variant,_);g.classList.add(`tb-sector-${t.kind}`),a.append(p,f,g);const m=Math.max(1,Math.hypot(n.x-i.x,n.y-i.y));await e.tween(m*Rn.sector,v=>{const y=l+(h-l)*v,b=c+(d-c)*v,w=Math.max(0,v-.12),z=l+(h-l)*w,O=c+(d-c)*w;for(const M of[p,f])M.setAttribute("x1",String(z)),M.setAttribute("y1",String(O)),M.setAttribute("x2",String(y)),M.setAttribute("y2",String(b));nz(g,y,b,_)}),a.remove()}async function Q0(s,e,t,i,n,r=!1){if(r)return;const o=gd(s,"tb-motion-beam"),[a,l]=ma(t),[c,h]=ma(i),d=n?" tb-hostile":"";o.append(at("line",{class:`tb-beam${d}`,x1:a,y1:l,x2:c,y2:h}),at("line",{class:`tb-beam tb-beam-core${d}`,x1:a,y1:l,x2:c,y2:h})),await e.wait(Rn.beam),o.remove()}async function Tc(s,e,t,i,n=!1){if(n)return;const r=gd(s,`tb-motion-burst tb-burst tb-burst-${i}`),[o,a]=ma(t),l=i==="misfire"?Rn.burst*.6:i==="supernova"?Rn.burst*1.6:Rn.burst;r.style.setProperty("--tb-ms",`${l}ms`),r.append(at("circle",{class:"tb-burst-halo",cx:o,cy:a,r:.1}));const c=at("g",{class:"tb-burst-spikes"}),h=i==="nova"||i==="supernova"?12:8,d=i==="misfire"?.6:i==="supernova"?1.8:i==="nova"?1.1:.95;for(let u=0;u<h;u++){const p=u/h*Math.PI*2+(h===8?Math.PI/8:0);c.append(at("line",{class:"tb-burst-spike",x1:o+Math.cos(p)*.12,y1:a+Math.sin(p)*.12,x2:o+Math.cos(p)*d,y2:a+Math.sin(p)*d}))}r.append(c,at("circle",{class:"tb-burst-core",cx:o,cy:a,r:.04})),await e.wait(l),r.remove()}async function m3(s,e,t=!1){if(t)return;const i=s.querySelector(".tb-ring");if(i===null)return;const n=at("circle",{class:"tb-motion tb-ring-flare",cx:i.getAttribute("cx")??0,cy:i.getAttribute("cy")??0,r:.46});s.append(n),await e.wait(Rn.flare),n.remove()}class g3{layer;tail;photon;points=[];constructor(e,t){this.layer=gd(e,"tb-motion-torpedo"),this.tail=at("g",{class:"tb-tail"}),this.photon=at("g",{class:"tb-photon"}),this.photon.append(at("circle",{class:"tb-photon-halo",cx:0,cy:0,r:.34}));const i=at("g",{class:"tb-photon-pulses"});for(let o=0;o<10;o++){const a=at("g",{transform:`rotate(${o*36})`});a.append(at("rect",{x:.08,y:-.016,width:.2+o%3*.05,height:.032,rx:.006})),i.append(a)}this.photon.append(i,at("circle",{class:"tb-photon-core",cx:0,cy:0,r:.12})),this.layer.append(this.tail,this.photon);const[n,r]=ma(t);this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`)}async point_reach(e,t,i=!1){const[n,r]=[t.y,t.x];this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`),this.tail.replaceChildren();const o=this.points.slice(-4);for(let a=1;a<o.length;a++){const[l,c]=o[a-1],[h,d]=o[a];this.tail.append(at("line",{class:"tb-tail-segment",x1:l,y1:c,x2:h,y2:d,"stroke-width":.03+.03*a,opacity:.25+.25*a}))}i||await e.wait(Rn.torpedoPoint)}async end(e,t=!1){this.photon.remove(),t||await e.wait(Rn.tail),this.layer.remove()}}function eM(s,e){s.classList.toggle("tb-rescan",e)}function _3(s,e){s.classList.remove("tb-bloom","tb-bloom-hostile"),s.offsetWidth,s.classList.add("tb-bloom"),e&&s.classList.add("tb-bloom-hostile"),s.addEventListener("animationend",()=>s.classList.remove("tb-bloom","tb-bloom-hostile"),{once:!0})}function fi(s,e){return s!==null&&e.includes(s.question)}function _d(s,e){const t=V("div","tb-station-head"),i=V("span","tb-station-step",""),n=Es("tb-grave tb-cancel","CANCEL",()=>{e.answer_send(n.dataset.line??"","CANCEL")});return n.hidden=!0,t.append(V("span","tb-station-name",s),i,V("span","tb-station-fill"),n),{root:t,step:i,cancel:n}}function bd(s,e,t,i){const n=t?.command??null,r=n!==null&&n.station===e&&t!==null&&t.question!=="command";s.step.textContent=r&&n!==null&&t!==null?`${n.label} · ${t.question.replace(/-/g," ").toUpperCase()}`:t?.question==="command"?"READY":"";const o=r?i?.cancel:void 0;s.cancel.hidden=o===void 0,s.cancel.dataset.line=o??"",s.cancel.textContent=n===null?"CANCEL":`CANCEL ${n.label}`}function Mg(s,e){const t=Es(`tb-command${s.grave===!0?" tb-grave":""}`,s.label,()=>{e.command_send(s)});return t.dataset.command=s.id,t}function fz(s,e){const t=V("div","tb-pills tb-command-pills"),i=new Map;for(const n of md.filter(r=>r.station===s)){const r=Mg(n,e);i.set(n.id,r),t.append(r)}return{root:t,pills:i}}function Md(s,e){for(const[t,i]of s)i.disabled=e?.question!=="command",i.classList.toggle("tb-pill-on",e?.command?.id===t)}function pz(s,e){const t=Es("tb-target","",e);return t.append(bg("klingon",s.mark),document.createTextNode(`${s.x},${s.y}`)),t.title=`Klingon at ${s.x},${s.y}`,t}function Ip(s,e){const t=V("span",s,e.supernova?"":e.code??"");return e.supernova&&t.append(bg("supernova")),t}function Cp(s){return`quadrant ${s.x},${s.y}${s.supernova?" · supernova":s.code===null?" · unscanned":""}`}function mz(s){const e=s.klingons.map(t=>({bearing:t.bearing,kind:"klingon",label:`Klingon at ${t.x},${t.y} · ${t.range.toFixed(1)} · ${Math.round(t.bearing)}°`,variant:t.mark}));for(const t of s.sectors)for(const i of t){if(i.kind!=="base")continue;const n=i.x-s.position.sector.x,r=i.y-s.position.sector.y;e.push({bearing:(Math.atan2(r,-n)*180/Math.PI+360)%360,kind:"base",label:`starbase at ${i.x},${i.y}`})}return e}class tM{root;wheel;distance;warp;rest;head;pills;readout=null;constructor(e,t,i){this.root=V("div","tb-station tb-station-helm"),this.head=_d("HELM",e);const n=fz("helm",e);this.pills=n.pills;const r=V("div","tb-controls");this.wheel=new rz(t,"course wheel",a=>e.answer_send(String(a),"SET COURSE"));const o=V("div","tb-sliders");this.distance=new gr(`${i}-distance`,"DISTANCE",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.warp=new gr(`${i}-warp`,"WARP FACTOR",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.rest=new gr(`${i}-rest`,"REST",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.distance.input_listen(()=>this.arrival_note()),o.append(this.distance.root,this.warp.root,this.rest.root),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}state_show(e){const t=this.readout===null;this.readout=e,this.wheel.marks_set(mz(e)),this.warp.range_set(Os("warp-factor",e),e.ship.warp,"THE SHIP NOW · ABOVE 6 THE ENGINES MAY BURN",10),this.distance.range_set(Os("distance",e),t?1:this.distance.value_get(),"QUADRANTS · 0.1 IS ONE SECTOR",6),this.rest.range_set(Os("how-long",e),0,`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT · REPAIRS RUN WHILE TIME PASSES`,2)}question_show(e){Md(this.pills,e);const t=e===null?null:Os(e.question,this.readout);bd(this.head,"helm",e,t),this.wheel.lit_set(fi(e,["course","direction"]),"SET COURSE"),this.distance.lit_set(fi(e,["distance"]),"ENGAGE"),this.warp.lit_set(fi(e,["warp-factor"]),"SET WARP"),this.rest.lit_set(fi(e,["how-long"]),"REST"),e?.question==="distance"&&this.arrival_note()}arrival_note(){if(this.readout===null)return;const e=this.distance.value_get(),t=s3(this.readout,this.wheel.degrees_get(),e),i=cz(e,this.readout.ship.warp,this.readout.param.warptime);this.distance.note_set(`ARRIVES ${t.quadrant.x},${t.quadrant.y} / ${t.sector.x},${t.sector.y} · ${i.stardates.toFixed(2)} STARDATES AT WARP ${this.readout.ship.warp.toFixed(1)} · ${i.units} UNITS`)}}class sM{constructor(e,t,i){this.host=e,this.root=V("div","tb-station tb-station-tactical"),this.head=_d("TACTICAL",e);const n=fz("tactical",e);this.pills=n.pills;const r=V("div","tb-controls");this.wheel=new rz(t,"firing course wheel",l=>e.answer_send(String(l),"SET COURSE"));const o=V("div","tb-sliders");this.burst=new Dc("BURST",Os("burst",null).choices??[],(l,c)=>e.answer_send(l,ar(c,"choice"))),this.burstAngle=new Dc("BURST ANGLE",Os("burst-angle",null).choices??[],(l,c)=>{this.wheel.wedge_set(Number(l)),e.answer_send(l,ar(c,"choice"))}),this.manual=new Dc("PHASERS",Os("manual-automatic",null).choices??[],(l,c)=>e.answer_send(l,ar(c,"choice"))),this.units=new gr(`${i}-units`,"UNITS",0,l=>e.answer_send(String(Math.round(l)),"SLIDER SET")),this.spread=new gr(`${i}-spread`,"SPREAD",2,l=>e.answer_send(l.toFixed(2),"SLIDER SET")),this.upDown=new Dc("SHIELDS",Os("up-down",null).choices??[],(l,c)=>e.answer_send(l,ar(c,"choice")));const a=V("div","tb-fire-row");this.fire=Es("tb-fire","FIRE",()=>e.answer_send("0",null)),this.targets=V("div","tb-targets"),a.append(this.fire,this.targets),o.append(this.burst.root,this.burstAngle.root,this.manual.root,this.units.root,this.spread.root,this.upDown.root,a),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}host;root;wheel;units;spread;head;pills;burst;burstAngle;manual;upDown;fire;targets;readout=null;state_show(e){this.readout=e,this.wheel.marks_set(mz(e)),this.wheel.wedge_set(null),e.klingons[0]!==void 0&&this.wheel.degrees_set(e.klingons[0].bearing),this.units.range_set(Os("units",e),Math.min(e.ship.energy,Math.round(e.ship.energy/100)*10),`UP TO THE ${e.ship.energy} FREE`,6),this.spread.range_set(Os("spread",e),.5,"MANUAL PHASERS ONLY",3),this.burst.note_set(`${e.ship.torpedoes} TORPEDOES · A BURST FIRES 3`),this.upDown.note_set(`${e.ship.shieldsUp?"UP":"DOWN"} · ${e.ship.shield} OF ${e.ship.shieldMax} · REFILLS AT A STARBASE`),this.targets_draw(e)}question_show(e){Md(this.pills,e);const t=e===null?null:Os(e.question,this.readout);bd(this.head,"tactical",e,t),this.wheel.lit_set(fi(e,["torpedo-course","bank-course"]),"SET COURSE"),this.burst.lit_set(fi(e,["burst"])),this.burstAngle.lit_set(fi(e,["burst-angle"])),this.manual.lit_set(fi(e,["manual-automatic"])),this.units.lit_set(fi(e,["units","bank-units"]),e?.question==="units"?"FIRE":"SET BANK"),this.spread.lit_set(fi(e,["spread"])),this.upDown.lit_set(fi(e,["up-down"])),this.fire.disabled=!fi(e,["bank-units"]),this.fire.textContent="FIRE THE BANKS SET"}targets_draw(e){if(this.targets.replaceChildren(),e.klingons.length===0){this.targets.append(V("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const t of["TARGET","RANGE","BEARING","PHASER HIT"])this.targets.append(V("span","tb-target-head",t));for(const t of e.klingons){const i=pz(t,()=>{this.host.voice.cue("scanner"),this.host.course_set(t.bearing,t.range/10)});this.targets.append(i,V("span","tb-target-cell",t.range.toFixed(1)),V("span","tb-target-cell",`${Math.round(t.bearing)}°`),V("span","tb-target-cell",`${hz(t.range/10)}%`))}}}class b3{root;rest;head;pills;damage;systems;since;inThatTime;readout=null;constructor(e){this.root=V("div","tb-view-body tb-view-engineering");const t=V("section","tb-panel tb-damage");t.append(V("span","tb-title","DAMAGE CONTROL"),V("span","tb-note","THE C'S REPORT · ALWAYS ON")),this.damage=V("div","tb-dc"),t.append(this.damage,V("span","tb-note","REPAIR TIMES IN STARDATES · REPAIRS RUN WHILE TIME PASSES · DOCKED, FASTER BY THE DOCK FACTOR"));const i=V("section","tb-panel tb-systems-section");i.append(V("span","tb-title","SHIP"),V("span","tb-note","ENERGY, SHIELDS, RESERVES")),this.systems=V("div","tb-systems"),i.append(this.systems,V("span","tb-title","SINCE THE LAST COMMAND")),this.since=V("div","tb-head-grid tb-since-grid"),i.append(this.since,V("span","tb-note","SHIELDS ARE UP OR DOWN IN TREK(6): THEIR ENERGY IS A READOUT, REFILLED AT A STARBASE"));const n=V("section","tb-panel tb-station tb-station-time");this.head=_d("REST",e);const r=V("div","tb-pills tb-command-pills");this.pills=new Map;for(const o of["rest","dock","undock"]){const a=md.find(c=>c.id===o);if(a===void 0)continue;const l=Mg(a,e);this.pills.set(o,l),r.append(l)}this.rest=new gr("tbe-rest","HOW LONG",1,o=>e.answer_send(o.toFixed(1),"SLIDER SET")),this.rest.input_listen(()=>this.inThatTime_note()),this.inThatTime=V("div","tb-in-that-time"),n.append(this.head.root,r,this.rest.root,V("span","tb-title","IN THAT TIME"),this.inThatTime),this.root.append(t,i,n)}state_show(e,t){this.readout=e,this.damage_draw(e),this.systems_draw(e),this.since.replaceChildren();const i=t===null?[]:dz(t,e);i.length===0&&this.since.append(V("span","tb-head-label","—"),V("span","tb-head-value","NOTHING MOVED"));for(const n of i)this.since.append(V("span","tb-head-label",n.label),V("span",`tb-head-value ${n.bad?"tb-bad":"tb-good"}`,n.change));this.rest.range_set(Os("how-long",e),this.rest.value_get(),`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT`,4),this.inThatTime_note()}question_show(e){Md(this.pills,e);const t=e===null?null:Os(e.question,this.readout),i=e!==null&&(e.command===null||["rest","dock","undock"].includes(e.command.id))?e:null;bd(this.head,"helm",i,t),this.rest.lit_set(fi(e,["how-long"]),"REST")}damage_draw(e){this.damage.replaceChildren();for(const i of["DEVICE","","IN FLIGHT","DOCKED",""])this.damage.append(V("span","tb-dc-head",i));const t=Math.max(1,...e.damaged.map(i=>(i.repairAt??0)-e.mission.stardate));for(const i of e.devices){const n=Z0(i,e),r=V("div","tb-bar-track"),o=V("div",`tb-bar-fill${n===null?" tb-bar-ok":" tb-bar-down"}`);o.style.width=n===null?"100%":`${Math.max(4,Math.min(100,Math.round(100*((i.repairAt??0)-e.mission.stardate)/t)))}%`,r.append(o),this.damage.append(V("span",`tb-dc-name${n===null?"":" tb-bad"}`,i.name.toUpperCase()),r,V("span","tb-dc-time",n===null?"—":n.inFlight.toFixed(2)),V("span","tb-dc-time",n===null?"—":n.docked.toFixed(2)),V("span",`tb-dc-state${n===null?" tb-good":" tb-bad"}`,n===null?"OK":"DOWN"))}}systems_draw(e){const{ship:t}=e;this.systems.replaceChildren();const i=(l,c,h,d,u)=>{const p=V("div","tb-bar-track"),f=V("div",`tb-bar-fill${u?" tb-bar-down":" tb-bar-ok"}`);f.style.width=`${Math.max(0,Math.min(100,Math.round(100*c/Math.max(1,h))))}%`,p.append(f),this.systems.append(V("span","tb-dc-name",l),p,V("span","tb-dc-time tb-sys-value",d))};i("ENERGY",t.energy,t.energyMax,`${t.energy} / ${t.energyMax}`,t.energy<t.energyMax/4),i("SHIELDS",t.shield,t.shieldMax,`${t.shieldsUp?"UP":"DOWN"} · ${t.shield} / ${t.shieldMax}`,t.shield<t.shieldMax/4),i("LIFE SUPPORT",t.reserves,t.reservesMax,`RESERVES ${t.reserves.toFixed(1)} / ${t.reservesMax.toFixed(1)}`,t.reserves<t.reservesMax/4);const n=V("div","tb-pips");for(let l=0;l<t.torpedoesMax;l++)n.append(V("span",`tb-pip${l<t.torpedoes?" tb-pip-on":""}`));this.systems.append(V("span","tb-dc-name","TORPEDOES"),n,V("span","tb-dc-time tb-sys-value",`${t.torpedoes} / ${t.torpedoesMax}`));const r=(l,c)=>{this.systems.append(V("span","tb-dc-name",l),V("span","tb-sys-text",c))};r("CREW",`${t.crew}${e.mission.captives>0?` · ${e.mission.captives} CAPTIVE`:" · BRIG EMPTY"}`);const o=e.damaged.some(l=>/warp/i.test(l.name));r("WARP",`${t.warp.toFixed(1)} · ENGINES ${o?"DOWN":"OK"}`);const a=e.damaged.some(l=>/cloak/i.test(l.name));r("CLOAK",`${t.cloaked?"ON":"OFF"} · DEVICE ${a?"DOWN":"OK"}`)}inThatTime_note(){if(this.readout===null)return;const e=this.rest.value_get();this.inThatTime.replaceChildren();const t=this.readout.damaged.filter(n=>(Z0(n,this.readout)?.inFlight??1/0)<=e).map(n=>n.name.toUpperCase());this.inThatTime.append(V("span","tb-head-value tb-good",t.length===0?e>0?"NO REPAIR COMPLETES":"—":`${t.join(" · ")} REPAIRED`));const i=this.readout.klingons.length;i>0&&this.inThatTime.append(V("span","tb-head-value tb-bad",`${i} KLINGON${i===1?"":"S"} IN THE QUADRANT WILL FIRE · SPOCK MAY ASK TO CANCEL`))}}const iM=[{label:"CHART",line:"ch",asks:[]},{label:"TRAJECTORY",line:"t",asks:[]},{label:"COURSE",line:"c",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"MOVE",line:"m",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"SCORE",line:"s",asks:[]},{label:"PHASER EFFECT",line:"p",asks:["range"]},{label:"WARP COST",line:"w",asks:["computer-distance","computer-warp"]},{label:"IMPULSE COST",line:"i",asks:["computer-distance"]},{label:"DISTRESS LIST",line:"d",asks:[]}];class M3{constructor(e){this.host=e,this.root=V("div","tb-view-body tb-view-computer");const t=V("section","tb-panel tb-chart-section");t.append(V("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN"),V("span","tb-note","PRESS A QUADRANT: THE COURSE PANEL AIMS AT IT · HUNDREDS KLINGONS, TENS BASES, ONES STARS")),this.chart=V("div","tb-chart-big"),t.append(this.chart);const i=V("section","tb-station tb-station-computer");this.head=_d("COMPUTER",e);const n=V("div","tb-pills tb-command-pills");for(const d of iM){const u=Es("tb-command tb-request",d.label,()=>this.request_send(d));u.dataset.request=d.line,this.requestPills.push(u),n.append(u)}const r=V("div","tb-computer-panels"),o=V("div","tb-panel");o.append(V("span","tb-title","COURSE AND DISTANCE")),this.courseGrid=V("div","tb-head-grid");const a=V("div","tb-pills");a.append(Es("tb-commit tb-send-helm","SEND TO HELM",()=>this.helm_send()),Es("tb-commit tb-move-now","MOVE THERE NOW",()=>this.request_send(iM[3]))),o.append(this.courseGrid,a);const l=V("div","tb-panel");l.append(V("span","tb-title","WARP COST")),this.wcDistance=new gr("tbc-distance","DISTANCE",2,()=>{}),this.wcWarp=new gr("tbc-warp","WARP FACTOR",1,()=>{}),this.wcDistance.root.classList.add("tb-local"),this.wcWarp.root.classList.add("tb-local"),this.wcDistance.input_listen(()=>this.costs_note()),this.wcWarp.input_listen(()=>{this.warpTouched=!0,this.costs_note()}),this.wcResult=V("div","tb-head-grid"),l.append(this.wcDistance.root,this.wcWarp.root,this.wcResult);const c=V("div","tb-panel");c.append(V("span","tb-title","TRAJECTORY · KLINGONS HERE")),this.trajectory=V("div","tb-targets"),c.append(this.trajectory,V("span","tb-title","SCORE SO FAR")),this.score=V("div","tb-score"),c.append(this.score);const h=V("div","tb-panel tb-answer-panel");h.append(V("span","tb-title","THE COMPUTER ANSWERS")),this.answer=V("pre","tb-computer-answer","—"),h.append(this.answer),r.append(o,l,c,h),i.append(this.head.root,n,r),this.root.append(t,i)}host;root;head;chart;requestPills=[];courseGrid;wcDistance;wcWarp;wcResult;trajectory;score;answer;readout=null;target=null;open=null;warpTouched=!1;state_show(e){this.readout=e,this.target===null&&(this.target={quadrant:{...e.position.quadrant},sector:{...e.position.sector}}),this.chart_draw(e),this.wcWarp.range_set(Os("computer-warp",e),this.warpTouched?this.wcWarp.value_get():e.ship.warp,"THE SHIP'S NOW",4),this.wcDistance.range_set(Os("computer-distance",e),this.wcDistance.value_get(),"QUADRANTS · FILLED FROM THE COURSE",4),this.wcDistance.lit_set(!0,""),this.wcWarp.lit_set(!0,""),this.course_note(),this.trajectory_draw(e),this.score_draw(e)}question_show(e){this.open=e;const t=e===null?null:Os(e.question,this.readout);bd(this.head,"ship",e,t);const i=e?.question==="command"||e?.question==="request";for(const n of this.requestPills)n.disabled=!i}answer_take(e){if(e===null){this.answer.textContent="";return}this.answer.textContent=`${this.answer.textContent??""}${e}`.replace(/^\s*\n/,"")}sector_set(e){this.readout!==null&&(this.target={quadrant:this.target?.quadrant??{...this.readout.position.quadrant},sector:{x:e.x,y:e.y}},this.course_note())}request_send(e){const t=e.asks.map(n=>[n,this.plannedAnswer_of(n)]);if(this.open?.question==="request"){this.host.plan_set(t),this.answer_take(null),this.host.answer_send(e.line,ar(e.label,"computer")),this.host.voice.cue("thinking");return}const i=md.find(n=>n.id==="computer");if(i===void 0||this.open?.question!=="command"){this.host.voice.cue("deny");return}this.host.plan_set([["request",e.line],...t]),this.answer_take(null),this.host.voice.pill(ar(e.label,"computer")),this.host.command_send(i)}plannedAnswer_of(e){const t=this.target,i=this.readout?.klingons[0];switch(e){case"quadrant":return String(t?.quadrant.x??0);case"quadrant-y":return String(t?.quadrant.y??0);case"sector":return String(t?.sector.x??0);case"sector-y":return String(t?.sector.y??0);case"range":return(i===void 0?this.wcDistance.value_get():i.range/10).toFixed(2);case"computer-distance":return this.wcDistance.value_get().toFixed(2);case"computer-warp":return this.wcWarp.value_get().toFixed(1);default:return""}}helm_send(){if(this.readout===null||this.target===null)return;const e=X0(this.readout,this.target);this.host.voice.pill("SEND TO HELM"),this.host.course_set(e.course,Math.round(e.distance*10)/10)}chart_draw(e){this.chart.replaceChildren(),this.chart.append(V("span","tb-srs-corner",""));for(let t=0;t<(e.chart[0]?.length??0);t++)this.chart.append(V("span","tb-srs-axis",String(t)));for(const t of e.chart){this.chart.append(V("span","tb-srs-axis",String(t[0]?.x??"")));for(const i of t)this.chart.append(this.quadrantButton_make(i))}}quadrantButton_make(e){const t=this.target?.quadrant.x===e.x&&this.target.quadrant.y===e.y,i=Es(`tb-cq${e.here?" tb-here":""}${e.klingons>0?" tb-hostile":""}${e.bases>0?" tb-based":""}${e.code===null?" tb-unscanned":""}${t?" tb-pressed":""}`,"",()=>{this.readout!==null&&(this.target={quadrant:{x:e.x,y:e.y},sector:this.target?.sector??{...this.readout.position.sector}},this.host.voice.cue("scanner"),this.chart_draw(this.readout),this.course_note())});return i.dataset.x=String(e.x),i.dataset.y=String(e.y),i.append(Ip("tb-cq-code",e),V("span","tb-cq-at",`${e.x},${e.y}`)),i.title=Cp(e),i}course_note(){if(this.readout===null||this.target===null)return;const{position:e}=this.readout,t=X0(this.readout,this.target);this.courseGrid.replaceChildren(V("span","tb-head-label","FROM"),V("span","tb-head-value",`QUADRANT ${e.quadrant.x},${e.quadrant.y} · SECTOR ${e.sector.x},${e.sector.y}`),V("span","tb-head-label","TO"),V("span","tb-head-value",`QUADRANT ${this.target.quadrant.x},${this.target.quadrant.y} · SECTOR ${this.target.sector.x},${this.target.sector.y}`),V("span","tb-head-label","COURSE"),V("span","tb-head-value tb-course-value",`${t.course}°`),V("span","tb-head-label","DISTANCE"),V("span","tb-head-value tb-distance-value",t.distance.toFixed(2))),this.wcDistance.value_set(Math.round(t.distance*100)/100),this.costs_note()}costs_note(){if(this.readout===null)return;const e=this.wcDistance.value_get(),t=cz(e,this.wcWarp.value_get(),this.readout.param.warptime),i=i3(e);this.wcResult.replaceChildren(V("span","tb-head-label","TIME"),V("span","tb-head-value",`${t.stardates.toFixed(2)} STARDATES`),V("span","tb-head-label","ENERGY"),V("span","tb-head-value",`${t.units} UNITS · ${t.unitsShielded} WITH SHIELDS UP`),V("span","tb-head-label","AT IMPULSE"),V("span","tb-head-value",`${i.stardates.toFixed(2)} STARDATES · ${i.units} UNITS`))}trajectory_draw(e){if(this.trajectory.replaceChildren(),e.klingons.length===0){this.trajectory.append(V("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const t of["AT","COURSE","RANGE","PHASER HIT"])this.trajectory.append(V("span","tb-target-head",t));for(const t of e.klingons)this.trajectory.append(pz(t,()=>{this.host.voice.cue("scanner"),this.host.course_set(t.bearing,t.range/10)}),V("span","tb-target-cell",`${Math.round(t.bearing)}°`),V("span","tb-target-cell",t.range.toFixed(1)),V("span","tb-target-cell",`${hz(t.range/10)}%`))}score_draw(e){const t=lz(e);this.score.replaceChildren();for(const i of t.items.filter(n=>n.points!==0||/killed|remaining/.test(n.label)))this.score.append(V("span","tb-score-label",i.label.toUpperCase()),V("span",`tb-score-points${i.points<0?" tb-bad":" tb-good"}`,`${i.points>0?"+":""}${i.points}`));this.score.append(V("span","tb-score-label tb-score-total","TOTAL"),V("span","tb-score-points tb-score-total",String(t.total)))}}const v3=["bridge","helm","tactical","engineering","computer"],w3=400,y3="-0.6 -0.6 10.6 10.6",z3=.7,S3=/^S\.R\. scanners$/i,x3=/^L\.R\. scanners$/i,O3={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]},E3=["length","skill","request","quadrant","quadrant-y","sector","sector-y","range","computer-distance","computer-warp","status-report","another","yes-no","unknown"];class A3{constructor(e,t){this.hooks=e,this.harness=new a3({question_changed:d=>{this.partial_flush(),this.question_show(d)},text_written:d=>this.text_take(d),state_shown:d=>this.state_show(d),ended:()=>{this.leaving||this.hooks.voice.cue("gameover")}}),this.root=V("section","trek-bridge"),this.root.id="trek-bridge",this.root.dataset.view="bridge",this.root.setAttribute("aria-label","trek: the bridge");const i={},n=xL();n!==null&&this.root.append(n);const r=this.gutter_build(i,t),[o,a]=this.frame_build(),l=this.header_build(i),c=this.body_build(i);this.strip_build(i);const h=this.log_build(i);this.leaveAsk_build(i),this.root.append(r,o,l,a,c,i.ask,h,i.leaveAsk),this.parts=i,this.question_show(null)}hooks;root;harness;readout=null;previous=null;view="bridge";nextDistance=null;plan=new Map;answering=!1;computerRunning=!1;leaving=!1;tracker=new pl;heading=0;pressedSector=null;scanDue=!1;fold=null;frames=new h3;shown=null;torpedo=null;trackPrinting=!1;partial="";lrsBloom=null;parts;stationHost_get(){return{answer_send:(e,t)=>this.answer_send(e,t),command_send:e=>this.command_send(e),plan_set:e=>{for(const[t,i]of e)this.plan.set(t,i)},course_set:(e,t)=>this.course_set(e,t),voice:this.hooks.voice}}gutter_build(e,t){const i=V("aside","tb-gutter"),n=V("div","tb-block");n.append(V("span","tb-block-name","TREK"),V("span","tb-block-sub","ARGUS · BSD TREK")),e.seed=V("div","tb-seed",t===null?"RANDOM GALAXY":`SEED ${t}`);const r=V("nav","tb-views");r.setAttribute("aria-label","views"),e.views=new Map;for(const c of v3){const h=Es(`tb-view tb-view-${c}`,c.toUpperCase(),()=>this.view_set(c));h.classList.remove("tb-pill"),h.dataset.view=c,e.views.set(c,h),r.append(h)}const o=Es("tb-leave","LEAVE BRIDGE",()=>this.leave_ask());o.classList.remove("tb-pill");const a=V("div","tb-gutter-top");a.append(n,e.seed,V("div","tb-gutter-fill"));const l=V("div","tb-gutter-body");return l.append(V("div","tb-gutter-cap"),r,V("div","tb-gutter-fill"),o),i.append(a,l),i}frame_build(){const e=V("div","tb-bar tb-bar-top");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c","tb-bar-d"])e.append(V("span",i));const t=V("div","tb-bar tb-bar-body");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c"])t.append(V("span",i));return[e,t]}header_build(e){const t=V("header","tb-header"),i=V("section","tb-head-condition"),n=V("div","tb-condition");n.append(V("span","tb-condition-label","CONDITION")),e.condition=V("span","tb-condition-name","—"),n.append(e.condition),e.conditionWhy=V("div","tb-condition-why",""),i.append(n,e.conditionWhy);const r=p=>{const f=V("section","tb-head-section");f.append(V("span","tb-head-title",p));const _=V("div","tb-head-grid");return f.append(_),[f,_]},[o,a]=r("SHIP"),[l,c]=r("MISSION"),[h,d]=r("POSITION"),u=V("div","tb-head-grid tb-head-since");return l.append(V("span","tb-head-title","SINCE LAST COMMAND"),u),e.ship=a,e.mission=c,e.position=d,e.since=u,t.append(i,o,l,h),t}body_build(e){const t=this.stationHost_get(),i=V("main","tb-body");i.dataset.view="bridge",e.body=i;const n=V("section","tb-scans");n.append(V("span","tb-title","LONG RANGE")),e.lrs=V("div","tb-lrs"),n.append(e.lrs,V("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN")),e.chart=V("div","tb-chart"),n.append(e.chart);const r=V("section","tb-srs-section");e.srsTitle=V("span","tb-title","SHORT RANGE"),r.append(e.srsTitle),e.scan=at("svg",{class:"tb-scan",viewBox:y3,role:"grid","aria-label":"short range scan"}),e.scan.addEventListener("keydown",l=>this.scan_key(l)),e.legend=this.legend_build(),r.append(e.scan,V("span","tb-note","PRESS A SECTOR: ITS COURSE AND DISTANCE FILL IN"),e.legend),e.shipPills=new Map;const o=V("div","tb-pills tb-ship-pills");o.append(V("span","tb-slider-label","SHIP"));for(const l of md.filter(c=>c.station==="ship")){const c=Mg(l,t);e.shipPills.set(l.id,c),o.append(c)}r.append(o);const a=V("section","tb-stations");return e.helm=new tM(t,150,"tb"),e.tactical=new sM(t,150,"tb"),a.append(e.helm.root,e.tactical.root),e.helmView=new tM(t,260,"tbh"),e.helmView.root.classList.add("tb-view-body","tb-view-helm"),e.tacticalView=new sM(t,260,"tbt"),e.tacticalView.root.classList.add("tb-view-body","tb-view-tactical"),e.engineeringView=new b3(t),e.computerView=new M3(t),i.append(n,r,a,e.helmView.root,e.tacticalView.root,e.engineeringView.root,e.computerView.root),i}legend_build(){const e=V("div","tb-legend");for(const t of OL){const i=V("span",`tb-legend-item tb-legend-${t.kind}`),n=t.kind==="klingon"?rr:[null];for(const r of n)i.append(bg(t.kind,r));i.append(V("span","tb-legend-glyph",Ac[t.kind].trim()===""?"␠":Ac[t.kind]),V("span","tb-legend-name",t.name)),e.append(i)}return e}strip_build(e){e.ask=V("div","tb-ask"),e.ask.hidden=!0,e.ask.setAttribute("role","dialog"),e.askText=V("span","tb-ask-text",""),e.askPills=V("div","tb-pills"),e.askInput=document.createElement("input"),e.askInput.type="text",e.askInput.className="tb-ask-input",e.askInput.setAttribute("aria-label","the answer");const t=e.askInput;e.askSend=Es("tb-commit","ANSWER",()=>this.answer_send(t.value,"ANSWER")),t.addEventListener("keydown",i=>{i.key==="Enter"&&this.answer_send(t.value,"ANSWER")}),e.ask.append(V("span","tb-ask-label","THE GAME ASKS"),e.askText,e.askPills,e.askInput,e.askSend)}log_build(e){const t=V("footer","tb-log-section"),i=V("div","tb-log-head");return i.append(V("span","tb-title","SHIP'S LOG"),V("span","tb-note","READ ONLY")),e.log=V("div","tb-log"),e.log.setAttribute("aria-live","polite"),t.append(i,e.log),t}leaveAsk_build(e){e.leaveAsk=V("div","tb-leave-ask"),e.leaveAsk.hidden=!0,e.leaveAsk.setAttribute("role","dialog");const t=e.leaveAsk,i=Es("tb-grave","LEAVE · THE GAME ENDS",()=>{this.leaving=!0,this.hooks.voice.cue("close"),this.hooks.leave()}),n=Es("","STAY",()=>{t.hidden=!0});e.leaveAsk.append(V("span","tb-ask-label","LEAVE THE BRIDGE?"),V("span","tb-ask-text","The game ends where it stands; dump first to keep it."),i,n)}harness_get(){return this.harness}leave_ask(){this.frames.skip(),this.parts.leaveAsk.hidden&&this.hooks.voice.pill("LEAVE BRIDGE"),this.parts.leaveAsk.hidden=!1}frames_get(){return{played:{...this.frames.played},pending:this.frames.pending_count(),busy:this.frames.busy_is()}}frames_settle(){return this.frames.settle()}leaveAsk_isOpen(){return!this.parts.leaveAsk.hidden}leaveAsk_close(){this.parts.leaveAsk.hidden=!0}view_get(){return this.view}view_set(e){this.frames.skip(),this.view=e,this.root.dataset.view=e,this.parts.body.dataset.view=e;for(const[t,i]of this.parts.views)i.classList.toggle("tb-view-on",t===e);this.hooks.voice.pill(ar(e.toUpperCase(),"view"))}readout_get(){return this.readout}command_send(e){if(this.frames.skip(),!this.harness.command_send(e))return this.hooks.voice.cue("deny"),!1;const t=BL(e.id);return t===null?this.hooks.voice.pill(ar(e.label,"command")):this.hooks.voice.cue(t),this.nextDistance=null,this.computerRunning=e.id==="computer",this.computerRunning&&this.parts.computerView.answer_take(null),this.log_write(`Command: ${e.line}
|
|
4297
|
+
`),null}y.outcome_write(w);for(const z of w.envelopes){if(z.model?.kind!=="feed.created")continue;const O=z.model.data;if(typeof O.feedId=="number"&&typeof O.rootInstanceId=="number"&&typeof O.path=="string")return{feedId:O.feedId,rootInstanceId:O.rootInstanceId,path:O.path}}return null},c=(v,y,b)=>({command_run:w=>{s.client.line_execute(w,{silent:!0})},command_show:w=>s.terminal.line_run(w),note:w=>s.terminal.line_note(w),image_open:w=>{e.image_open(v(),w).then(z=>s.terminal.line_note(z))},process_open:w=>e.process_open(v(),{input:w,feed:null,node:null}),...y,...b,feed_create:l,cohort_process:w=>e.process_open(v(),w),feed_open:w=>e.feed_open(v(),w)}),h=()=>{a!==null&&window.clearTimeout(a),a=window.setTimeout(()=>{a=null;const v=r?.entries_get()??[],y=JSON.stringify({version:1,name:r?.name_get()??null,feed:r?.feed_get()??null,series:v});s.client.line_execute("mkdir -p ~/gather",{silent:!0,observe:!1}).then(()=>s.client.line_execute(`touch --withContents '${y.replace(/'/g,"'\\''")}' ${H0}`,{silent:!0,observe:!1}))},ZP)},d=()=>{const v=document.querySelector("#header-gather-pill");v!==null&&v.classList.toggle("panel-gather-empty",(r?.entries_get().length??0)===0)},u=()=>{const v=e.element_require("header-gather"),y=()=>e.errandHost_find()??"pacs",b=w=>mg(s.terminal,e.element_require("header-gather"),w);return new j0(v,e.pane_find(v,".gather-rows"),c(y,{name_ask:w=>b({message:"Cohort name: ",kind:"text",suggest:w,commit:"NAME IT"}),confirm_ask:async w=>{const z=await b({message:w,kind:"confirm"});return z==="y"||z==="n"?z:null}},{changed:()=>{e.stage_relight(),d(),h()},dismiss:()=>{document.body.dataset.header="away",o=!0,d()}}),n)};return{cohort:n,instance_build:v=>{const y=e.template_stamp("tpl-pane-gather"),b=new j0(y,e.pane_find(y,".gather-rows"),c(()=>v,{name_ask:w=>e.ask_onPane(v,{message:"Cohort name: ",kind:"text",suggest:w,commit:"NAME IT"}),confirm_ask:async w=>{const z=await e.ask_onPane(v,{message:w,kind:"confirm"});return z==="y"||z==="n"?z:null}},{changed:()=>e.stage_relight(),dismiss:()=>{s.layout.leaf_close(v)||e.home_apply(),e.orphans_dispose(),e.stage_relight()}}),n);return t.set("gather",v,b),{id:v,kind:"gather",mount:y,dispose:()=>{t.delete(v),i.pane_leave(v)}}},has:v=>r?.has(v)===!0,gather:v=>{r===null&&(r=u());for(const b of v)r.series_add(b);const y=document.body.dataset.header==="away";(!o||!y)&&(document.body.dataset.header="gather",o=!1),d(),h()},open:(v,y="pacs")=>{const{layout:b}=s,w=new Set(b.panes_shown());let z=t.ids("gather").find(M=>w.has(M))??null;if(z===null){const M=w.has(y)?y:e.errandHost_find()??y,S=e.instance_spawn("gather","pacs"),D=e.replayPlace_get();if(!b.leaf_split(M,D?.dir??"row",S.id,D?.before??!1))return Ds(S.id),b.mount_remove(S.id),null;e.birth_record(S.id,M,D?.dir??"row",D?.before??!1),z=S.id}const O=t.get("gather",z);if(O===void 0)return null;for(const M of v)O.series_add(M);return z},stage:()=>{const{layout:v}=s,y=new Set(v.panes_shown()),b=t.ids("gather").find(w=>y.has(w))??null;if(b!==null)v.focus_set(b);else{const w=e.errandHost_find()??"pacs",z=e.instance_spawn("gather","pacs");if(!v.leaf_split(w,"col",z.id,!1)){Ds(z.id),v.mount_remove(z.id);return}e.birth_record(z.id,w,"col",!1),t.get("gather",z.id)?.render_now()}document.body.dataset.header="away",o=!0},annunciate:d,restore:async()=>{const v=await e.fileText_fetch(H0);if(v.ok)try{const y=JSON.parse(v.text);if(!Array.isArray(y.series)||y.series.length===0)return;r===null&&(r=u());for(const b of y.series)r.series_add(b);d(),e.stage_relight()}catch{}}}}class QP{mount;handlers;titleSpan;stateSpan;fieldSection;savePill;revertPill;focusMark;field=null;path=null;original="";saving=!1;fieldBuild=null;constructor(e,t){this.mount=e,this.handlers=t,this.titleSpan=e.querySelector(".pane-title"),this.stateSpan=e.querySelector(".pane-state"),this.fieldSection=this.element_require(".edit-field"),this.savePill=this.element_require(".edit-save"),this.revertPill=this.element_require(".edit-revert"),this.focusMark=e.querySelector(".edit-focus"),this.savePill.addEventListener("click",()=>{this.save()}),this.revertPill.addEventListener("click",()=>this.revert()),e.addEventListener("keydown",i=>{(i.ctrlKey||i.metaKey)&&!i.altKey&&i.key.toLowerCase()==="s"&&(i.preventDefault(),i.stopPropagation(),this.save())},{capture:!0}),this.fieldSection.addEventListener("mousedown",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusin",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.fieldSection.contains(i.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),zs(this.stateSpan,"wait","OPENING")}async content_show(e){this.path=e.path,this.original=e.content,this.title_set(e.path),this.fieldBuild??=this.field_build(e);const t=await this.fieldBuild;t!==null&&(t.text_get()!==this.original&&t.text_set(this.original),this.controls_sync(),t.focus(),this.focusMark_set(!0))}async field_build(e){let t;try{t=await Ap(()=>import("./field-Ck7DlgPH.js").then(i=>i.Q),[],import.meta.url)}catch(i){if(!fg(i))throw i;return zs(this.stateSpan,"stale",Gh),this.handlers.note(`edit: ${Gh.toLowerCase()} — the editor's code is of an older build than the server has`),null}return this.field=await t.editField_create(this.fieldSection,e.content,e.extension,()=>this.controls_sync()),this.field}opening_fail(e){zs(this.stateSpan,"refused",`NOT OPENED · ${e.toUpperCase()}`)}async save(){if(this.field===null||this.path===null||this.saving)return!1;const e=this.field.text_get();if(e===this.original)return!0;this.saving=!0,this.controls_sync();let t=!1;try{t=await this.handlers.save(this.path,e)}finally{this.saving=!1}return t&&(this.original=e),this.controls_sync(),t||zs(this.stateSpan,"refused","NOT SAVED · THE CONSOLE SAYS WHY"),t}revert(){this.field===null||!this.dirty_is()||(this.field.text_set(this.original),this.controls_sync())}dirty_is(){return this.field!==null&&this.field.text_get()!==this.original}path_get(){return this.path}field_release(){return this.field===null||!this.field.hasFocus()?!1:(this.field.blur(),this.focusMark_set(!1),!0)}dispose(){this.field?.destroy(),this.field=null}controls_sync(){const e=this.dirty_is();this.savePill.disabled=!e||this.saving,this.revertPill.disabled=!e||this.saving,this.mount.dataset.dirty=e?"yes":"no",this.field!==null&&(this.saving?zs(this.stateSpan,"wait","SAVING"):e?zs(this.stateSpan,"note","DIRTY"):zs(this.stateSpan,"settled","SAVED"))}title_set(e){this.titleSpan!==null&&(this.titleSpan.textContent=`EDIT ${e.split("/").pop()??e}`.toUpperCase()),this.mount.title=e}focusMark_set(e){this.focusMark!==null&&(this.focusMark.hidden=!e)}element_require(e){const t=this.mount.querySelector(e);if(t===null)throw new Error(`edit pane: no ${e} in its template`);return t}}function eL(s,e){const{layout:t,panels:i,subjects:n}=s,r=async(d,u)=>{const p=await ta(s,Uy(d,u));return p&&e.saved?.(d),p},o=d=>{const u=e.template_stamp("tpl-pane-edit"),p=new QP(u,{save:r,note:f=>s.terminal.line_note(f)});return i.set("edit",d,p),{id:d,kind:"edit",mount:u,dispose:()=>{p.dispose(),i.delete(d),n.pane_leave(d)}}},a=d=>{const u=new Set(t.panes_shown());for(const[p,f]of i.entries("edit"))if(u.has(p)&&f.path_get()===d)return p;return null},l=()=>{e.launcher_yield();const d=new Set(t.panes_shown()),u=t.focused_get(),p=u!==null&&d.has(u)?u:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),_=e.replayPlace_get();return t.leaf_split(p,_?.dir??"col",f.id,_?.before??!1)?(e.birth_record(f.id,p,_?.dir??"col",_?.before??!1),f.id):(Ds(f.id),t.mount_remove(f.id),null)};return{instance_build:o,edit_receive:d=>{const u=d.path??"";if(u==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=a(u)??l();if(p===null)return!1;const f=i.get("edit",p);return f===void 0?!1:(t.focus_set(p),f.dirty_is()?(s.terminal.line_note(`edit: ${u}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:u,content:d.content,extension:d.extension??Ev(u)}),!0))},edit_open:(d,u={})=>{const p=a(d)??l();if(p===null)return null;const f=i.get("edit",p);if(f===void 0)return null;t.focus_set(p),f.dirty_is()||f.opening_show(d);const _=$y(d);return u.visible===!0?(s.terminal.line_run(_),p):(s.client.line_execute(_,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(v=>v.status!=="ok");m!==void 0&&f.opening_fail((m.renderedErr??"").replace(/\x1b\[[0-9;]*m/g,"").trim()||"the kernel refused")}).catch(g=>f.opening_fail(g instanceof Error?g.message:String(g))),p)}}}class tL{listing;constructor(e){const t=e.querySelector(".help-panel");if(t===null)throw new Error("help pane: no .help-panel in its template");this.listing=new Mr({mount:t,traits:this.traits_declare(),key:i=>i.key,chrome:{root:e,prefix:"help"},caps:"root",activatable:()=>!1,row:{className:i=>`help-row help-${i.topic}`}}),this.render()}traits_declare(){return[{key:"name",label:"KEY · VERB",className:"help-key",width:"minmax(9em, 12em)",cell:e=>e.name},{key:"does",label:"DOES",className:"help-does",width:"minmax(16em, 1fr)",cell:e=>e.does}]}render(){const e=o=>{const a=document.createElement("header");return a.className="files-path help-block-head",a.textContent=o,a},t=tn.map(o=>({key:`k:${o.key}`,name:o.key,does:o.does,topic:o.topic})),i=la.map((o,a)=>{const l=o.indexOf(" ");return{key:`v:${a}`,name:l<0?o:o.slice(0,l),does:l<0?"":o.slice(l+1).trim(),topic:"verb"}}),n=[{key:"g:games",name:"help games",does:"the /usr/games shelf — fortune, cal, weather and their kin, by category (type it in the console)",topic:"verb"}],r=[{key:"n:notes",name:"notes",does:"what the installed releases changed (notes pane opens it as a listing; the dashboard's WHAT'S NEW block too)",topic:"verb"}];this.listing.rows_set([{key:"keys",header:e("KEYS — Ctrl-B opens the focused pane's drawer; then one key presses one of its verbs"),rows:t},{key:"verbs",header:e("VERBS — the console language; the long form is docs/argus-lang.adoc"),rows:i},{key:"games",header:e("GAMES — the small pleasures, kept apart from the tools as BSD kept them"),rows:n},{key:"notes",header:e("NOTES — what changed, release by release"),rows:r}],{field:"help"})}}function sL(s,e){const{layout:t,panels:i,subjects:n}=s;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-help");return i.set("help",a,new tL(l)),{id:a,kind:"help",mount:l,dispose:()=>{i.delete(a),n.pane_leave(a)}}},open:()=>{const a=i.ids("help").find(d=>t.panes_shown().includes(d));if(a!==void 0)return t.focus_set(a),"help: on stage";const l=e.launcher_active();e.launcher_yield();const c=t.focused_get()??"files",h=e.instance_spawn("help");return l&&t.leaf_replace("files",h.id)?(t.focus_set(h.id),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):t.leaf_split(c,"col",h.id,!1)?(e.birth_record(h.id,c,"col",!1),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):(Ds(h.id),t.mount_remove(h.id),"help: could not open a pane")}}}const Ru=["___________________ _-_ ","\\__(==========/_=_/ ____.---'---`---.____"," \\_ \\ \\----._________.----/"," \\ \\ / / `-_-' "," __,--`.`-'..'-_ "," /____ || "," `--.____,-' "];function iL(){const s=Ru[0].length;let e=Number.NaN,t=0;return{title:"SL",tick:60,step:i=>{Number.isNaN(e)&&(e=-s),e+=1,t+=1,e>i.cols+6&&(e=-s)},draw:(i,n)=>{const r=Math.max(0,Math.floor((i.rows-Ru.length)/2));Ru.forEach((a,l)=>i.text(Math.round(e),r+l,a,n.lit));const o=t%2===0?"-~=":"-=~";i.text(Math.round(e)-o.length,r+1,o,n.cool)}}}const V0="ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ0123456789Z:・.=*+-<>¦|";function nL(){const s=new Map;let e=0;return{title:"CMATRIX",tick:50,step:(t,i)=>{e+=1;for(let n=0;n<t.cols;n++){const r=s.get(n);if(r===void 0){i()<.02&&s.set(n,{row:-1,speed:1+Math.floor(i()*2),length:4+Math.floor(i()*12),glyphs:[]});continue}e%r.speed===0&&(r.row+=1,r.glyphs.unshift(V0[Math.floor(i()*V0.length)]),r.glyphs.length>r.length&&r.glyphs.pop(),r.row-r.length>t.rows&&s.delete(n))}},draw:(t,i)=>{for(const[n,r]of s)r.glyphs.forEach((o,a)=>{const l=a===0?"#ffffff":a<r.length/2?i.lit:i.dim;t.put(n,r.row-a,o,l)})}}}function rL(){const s=[];return{title:"RAIN",tick:70,step:(e,t)=>{t()<.9&&s.push({col:Math.floor(t()*e.cols),row:0,splash:0});for(const i of s)i.row<e.rows-1?i.row+=1:i.splash+=1;for(let i=s.length-1;i>=0;i--)s[i].splash>3&&s.splice(i,1)},draw:(e,t)=>{for(const i of s){if(i.splash===0){e.put(i.col,i.row,"|",t.cool);continue}const n=["o","O","( )"][i.splash-1];e.text(i.col-(n.length>>1),e.rows-1,n,t.dim)}}}}function oL(){const s=[],e=[];let t=0;return{title:"ASCIIQUARIUM",tick:90,step:(i,n)=>{if(t+=1,s.length<Math.max(3,i.cols/12)&&n()<.08){const r=n()<.5;s.push({col:r?-4:i.cols+1,row:2+Math.floor(n()*Math.max(1,i.rows-5)),right:r,speed:1+Math.floor(n()*2),hue:Math.floor(n()*3)})}for(const r of s)t%r.speed===0&&(r.col+=r.right?1:-1);for(let r=s.length-1;r>=0;r--){const o=s[r];(o.col<-5||o.col>i.cols+2)&&s.splice(r,1)}if(n()<.3){const r=s[Math.floor(n()*s.length)];r!==void 0&&e.push({col:r.col+(r.right?4:-1),row:r.row-1})}for(const r of e)r.row-=1;for(let r=e.length-1;r>=0;r--)e[r].row<1&&e.splice(r,1)},draw:(i,n)=>{const r=(t%4<2?"~^":"^~").repeat(i.cols>>1);i.text(0,0,r,n.cool);const o=[n.lit,n.cool,n.warn];for(const a of s)i.text(a.col,a.row,a.right?"><>":"<><",o[a.hue]);for(const a of e)i.put(a.col,a.row,a.row%2===0?"o":".",n.dim);for(let a=2;a<i.cols;a+=7){const l=(t>>2)%2===0?0:1;for(let c=0;c<3;c++)i.put(a+(c+l)%2,i.rows-2-c,c%2===0?"(":")",n.dim)}i.text(0,i.rows-1,"^".repeat(i.cols),n.dim)}}}const q0=[[[0,0],[1,0],[2,0],[3,0]],[[0,0],[1,0],[0,1],[1,1]],[[1,0],[0,1],[1,1],[2,1]],[[0,0],[1,0],[1,1],[2,1]],[[1,0],[2,0],[0,1],[1,1]],[[0,0],[0,1],[1,1],[2,1]],[[2,0],[0,1],[1,1],[2,1]]],qr=10,Qr=20;function aL(){return{well:Array.from({length:Qr},()=>Array(qr).fill(0)),piece:null,score:0,lines:0,over:!1}}function gg(s,e){return e.cells.every(([t,i])=>{const n=e.x+t,r=e.y+i;return n>=0&&n<qr&&r<Qr&&(r<0||s[r][n]===0)})}function ku(s){const e=Math.max(...s.cells.flat())+1;return{...s,cells:s.cells.map(([t,i])=>[e-1-i,t])}}function lL(s,e){const t=Math.floor(e()*q0.length),i={cells:q0[t].map(n=>[n[0],n[1]]),x:3,y:0,kind:t+1};if(!gg(s.well,i)){s.over=!0;return}s.piece=i}function cL(s){const e=s.piece;if(e===null)return;e.cells.some(([,n])=>e.y+n<0)&&(s.over=!0);for(const[n,r]of e.cells){const o=e.y+r;o>=0&&(s.well[o][e.x+n]=e.kind)}const t=s.well.filter(n=>n.some(r=>r===0)),i=Qr-t.length;for(;t.length<Qr;)t.unshift(Array(qr).fill(0));s.well=t,s.lines+=i,s.score+=[0,100,300,500,800][i]??800,s.piece=null}function Tp(s,e){if(s.over)return;if(s.piece===null){lL(s,e);return}const t={...s.piece,y:s.piece.y+1};gg(s.well,t)?s.piece=t:cL(s)}function hL(s,e,t){if(s.over||s.piece===null)return!1;const i=s.piece,n=r=>gg(s.well,r)?(s.piece=r,!0):!1;switch(e){case"ArrowLeft":case"h":case"a":return n({...i,x:i.x-1}),!0;case"ArrowRight":case"l":case"d":return n({...i,x:i.x+1}),!0;case"ArrowUp":case"k":case"w":return n(ku(i))||n({...ku(i),x:i.x-1})||n({...ku(i),x:i.x+1}),!0;case"ArrowDown":case"j":case"s":return Tp(s,t),!0;case" ":{for(;s.piece!==null;)Tp(s,t);return!0}default:return!1}}function dL(){const s=aL();let e=Math.random;return{title:"TETRIS",tick:500,step:(t,i)=>{e=i,Tp(s,i)},draw:(t,i)=>{const n=Math.max(0,Math.floor((t.cols-(qr*2+2))/2)),r=Math.max(0,Math.floor((t.rows-Qr-1)/2)),o=["",i.cool,i.lit,i.warn,i.dim,i.lit,i.cool,i.warn];for(let a=0;a<Qr;a++){t.put(n,r+a,"|",i.dim),t.put(n+qr*2+1,r+a,"|",i.dim);for(let l=0;l<qr;l++){const c=s.well[a][l];c!==0&&t.text(n+1+l*2,r+a,"[]",o[c])}}if(t.text(n,r+Qr,"+"+"-".repeat(qr*2)+"+",i.dim),s.piece!==null)for(const[a,l]of s.piece.cells){const c=s.piece.y+l;c>=0&&t.text(n+1+(s.piece.x+a)*2,r+c,"[]",o[s.piece.kind])}s.over&&t.text(n+2,r+9," GAME OVER ",i.warn)},key:t=>hL(s,t,e),status:()=>`${s.score} · ${s.lines} lines${s.over?" · OVER":""}`,over:()=>s.over}}function uL(s,e,t){const i=s>>1,n=e>>1,r={body:[[i,n],[i-1,n],[i-2,n]],food:[0,0],heading:"right",next:"right",score:0,over:!1,cols:s,rows:e};return tz(r,t),r}function tz(s,e){for(let t=0;t<1e3;t++){const i=[Math.floor(e()*s.cols),Math.floor(e()*s.rows)];if(!s.body.some(([n,r])=>n===i[0]&&r===i[1])){s.food=i;return}}}const fL={up:"down",down:"up",left:"right",right:"left"};function pL(s,e){fL[e]!==s.heading&&(s.next=e)}function mL(s,e){if(s.over)return;s.heading=s.next;const[t,i]=s.body[0],n=s.heading==="up"?[t,i-1]:s.heading==="down"?[t,i+1]:s.heading==="left"?[t-1,i]:[t+1,i],r=n[0]<0||n[1]<0||n[0]>=s.cols||n[1]>=s.rows,o=s.body.some(([a,l])=>a===n[0]&&l===n[1]);if(r||o){s.over=!0;return}s.body.unshift(n),n[0]===s.food[0]&&n[1]===s.food[1]?(s.score+=10,tz(s,e)):s.body.pop()}const gL={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",k:"up",w:"up",j:"down",s:"down",h:"left",a:"left",l:"right",d:"right"};function _L(){let s=null;return{title:"SNAKE",tick:140,step:(e,t)=>{s===null&&(s=uL(Math.max(8,e.cols>>1),Math.max(6,e.rows-1),t)),mL(s,t)},draw:(e,t)=>{s!==null&&(e.text(0,s.rows,"-".repeat(s.cols*2),t.dim),e.text(s.food[0]*2,s.food[1],"**",t.warn),s.body.forEach(([i,n],r)=>e.text(i*2,n,r===0?"@@":"oo",r===0?t.lit:t.cool)),s.over&&e.text(Math.max(0,s.cols-6),s.rows>>1," GAME OVER ",t.warn))},key:e=>{const t=gL[e];return t===void 0||s===null?!1:(pL(s,t),!0)},status:()=>s===null?"":`${s.score}${s.over?" · OVER":""}`,over:()=>s?.over??!1}}const sz={sl:iL,cmatrix:nL,rain:rL,aquarium:oL,tetris:dL,snake:_L};function bL(s){return s in sz}const ML=8,vL=26,Bu=1.8,wL=100,K0=24;function Y0(s,e){let t=Math.floor(s/wL);return e/(t*Bu)<K0&&(t=Math.floor(e/K0/Bu)),t=Math.max(ML,Math.min(vL,t)),{w:t,h:Math.round(t*Bu)}}class yL{pane;field;canvas;state;focusMark;pausePill;program=null;name=null;paused=!1;timer=null;frame=null;observer;constructor(e){this.pane=e,this.field=$a(e,".games-field"),this.canvas=$a(e,".games-canvas"),this.state=e.querySelector(".pane-state"),this.focusMark=$a(e,".games-focus"),this.pausePill=$a(e,".games-pause"),this.field.tabIndex=0,this.pausePill.addEventListener("click",()=>this.pause_toggle()),$a(e,".games-restart").addEventListener("click",()=>{this.name!==null&&this.program_run(this.name)}),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",t=>{(!(t.relatedTarget instanceof Node)||!this.field.contains(t.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",t=>this.key_handle(t)),this.observer=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.draw()),this.observer?.observe(this.field)}program_run(e){this.name=e,this.program=sz[e](),this.paused=!1,this.pausePill.textContent="PAUSE",this.clock_start(),this.program.key!==void 0&&(this.field.focus(),this.focusMark_paint(!0)),this.draw()}program_name(){return this.name}paused_is(){return this.paused}pause_toggle(){this.program!==null&&(this.paused=!this.paused,this.pausePill.textContent=this.paused?"RESUME":"PAUSE",this.paused?this.clock_stop():this.clock_start(),this.state_paint())}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}dispose(){this.clock_stop(),this.observer?.disconnect()}key_handle(e){if(e.key==="Escape"){this.field_release(),e.stopPropagation();return}if(this.program!==null){if(e.key===" "&&this.program.key===void 0){this.pause_toggle(),e.preventDefault(),e.stopPropagation();return}this.program.key?.(e.key)===!0&&(e.preventDefault(),this.draw()),e.stopPropagation()}}clock_start(){this.clock_stop();const e=this.program;e!==null&&(this.timer=setInterval(()=>{this.field.offsetParent!==null&&(e.step(this.size_of(),Math.random),this.draw(),e.over?.()===!0&&this.clock_stop())},e.tick))}clock_stop(){this.timer!==null&&clearInterval(this.timer),this.timer=null}size_of(){const e=this.field.getBoundingClientRect(),t=Y0(e.width,e.height);return{cols:Math.max(10,Math.floor(e.width/t.w)),rows:Math.max(6,Math.floor(e.height/t.h))}}palette_read(){const e=getComputedStyle(this.pane),t=(i,n)=>e.getPropertyValue(i).trim()||n;return{lit:t("--harvestgold","#ffcc66"),dim:t("--butter","#ffff99"),warn:t("--tomato","#ff7766"),cool:t("--daybreak","#55aaff")}}draw(){this.frame===null&&(this.frame=requestAnimationFrame(()=>{this.frame=null,this.paint()}))}paint(){const e=this.program,t=this.canvas.getContext("2d");if(e===null||t===null)return;const i=this.field.getBoundingClientRect(),n=window.devicePixelRatio||1;(this.canvas.width!==Math.floor(i.width*n)||this.canvas.height!==Math.floor(i.height*n))&&(this.canvas.width=Math.floor(i.width*n),this.canvas.height=Math.floor(i.height*n)),t.setTransform(n,0,0,n,0,0),t.clearRect(0,0,i.width,i.height);const r=Y0(i.width,i.height);t.font=`${r.h-2}px 'Share Tech Mono', monospace`,t.textBaseline="top";const o=this.size_of(),a=(c,h,d,u)=>{c<0||h<0||c>=o.cols||h>=o.rows||(t.fillStyle=u,t.fillText(d,c*r.w,h*r.h))},l={cols:o.cols,rows:o.rows,put:a,text:(c,h,d,u)=>{[...d].forEach((p,f)=>{p!==" "&&a(c+f,h,p,u)})}};e.draw(l,this.palette_read()),this.state_paint()}state_paint(){if(this.state===null||this.program===null)return;const e=this.program.status?.()??"";this.state.textContent=[this.program.title,e,this.paused?"PAUSED":""].filter(t=>t!=="").join(" · ")}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("games-field-focused",e)}}function $a(s,e){const t=s.querySelector(e);if(t===null)throw new Error(`games pane: missing ${e}`);return t}function zL(s,e){const{layout:t,panels:i,subjects:n}=s;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-games"),c=new yL(l);return i.set("games",a,c),{id:a,kind:"games",mount:l,dispose:()=>{c.dispose(),i.delete(a),n.pane_leave(a)}}},show:a=>{const l=typeof a=="object"&&a!==null?a.program:void 0;if(typeof l!="string"||!bL(l))return`games: no program named ${String(l)}`;const c=i.ids("games").find(f=>t.panes_shown().includes(f));if(c!==void 0)return t.focus_set(c),i.get("games",c)?.program_run(l),`games: ${l} on the GAMES pane`;const h=e.launcher_active();e.launcher_yield();const d=t.focused_get()??"files",u=e.instance_spawn("games");return(h?t.leaf_replace("files",u.id):t.leaf_split(d,"col",u.id,!1))?(h?t.focus_set(u.id):e.birth_record(u.id,d,"col",!1),i.get("games",u.id)?.program_run(l),`games: ${l} in a GAMES pane (Esc gives the keyboard back; its PAUSE and RESTART pills on the frame)`):(Ds(u.id),t.mount_remove(u.id),"games: could not open a pane")}}}function at(s,e){const t=document.createElementNS("http://www.w3.org/2000/svg",s);for(const[i,n]of Object.entries(e))t.setAttribute(i,String(n));return t}const rr=["cruiser","raptor","talon","warbird"],SL={ship:'<g fill="currentColor"><ellipse cx="12" cy="6.5" rx="9" ry="4"/><rect x="9.5" y="9.5" width="5" height="6" rx="1"/><rect x="3" y="14" width="5" height="8" rx="2.2"/><rect x="16" y="14" width="5" height="8" rx="2.2"/><rect x="7" y="16" width="10" height="2.2" rx="1"/></g>',"klingon-cruiser":'<g fill="currentColor"><circle cx="12" cy="4" r="2.6"/><rect x="11" y="5.5" width="2" height="8.5"/><path d="M12 12.5 L22 20.5 L22.5 22.5 L17 19.2 L12 18 L7 19.2 L1.5 22.5 L2 20.5 Z"/><rect x="8.5" y="18.5" width="7" height="3.2" rx="1.2"/></g>',"klingon-raptor":'<path fill="currentColor" d="M12 1.5 L14 6.5 L22.5 10.5 L21.5 18 L19.5 12.5 L15 13.5 L14 20 L12 17 L10 20 L9 13.5 L4.5 12.5 L2.5 18 L1.5 10.5 L10 6.5 Z"/>',"klingon-talon":'<g fill="currentColor"><path d="M12 1.5 L13.6 11 L21.5 4.5 L19 15 L12 22 L5 15 L2.5 4.5 L10.4 11 Z"/><circle cx="12" cy="13.5" r="1.6" fill="#000"/></g>',"klingon-warbird":'<g fill="currentColor"><rect x="8.5" y="2" width="7" height="3.2" rx="1.6"/><rect x="11.1" y="4.5" width="1.8" height="7"/><path d="M1.5 13 Q12 6 22.5 13 L22 20 Q17 15.5 14 17 L12 22 L10 17 Q7 15.5 2 20 Z"/></g>',base:'<g fill="currentColor"><path d="M12 1.5 L17 12 L12 22.5 L7 12 Z"/><rect x="1.5" y="10.8" width="21" height="2.4" rx="1.2"/><circle cx="12" cy="12" r="3" fill="#000"/></g>',inhabited:'<circle cx="12" cy="12" r="7.5" fill="currentColor"/><path d="M4.5 12 Q12 15.5 19.5 12" fill="none" stroke="#000" stroke-width="1.6"/><path d="M5.5 8.5 Q12 11 18.5 8.5" fill="none" stroke="#000" stroke-width="1.2" opacity="0.6"/>',star:'<g stroke="currentColor" stroke-width="1.8" stroke-linecap="round" fill="none"><path d="M12 2 V22 M2 12 H22 M4.9 4.9 L19.1 19.1 M19.1 4.9 L4.9 19.1"/></g><circle cx="12" cy="12" r="2.6" fill="currentColor"/>',hole:'<g fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M12 12 m0 -2.5 a2.5 2.5 0 1 1 -2.5 2.5"/><path d="M12 12 m0 -6 a6 6 0 1 1 -6 6"/><path d="M12 12 m0 -9.5 a9.5 9.5 0 1 1 -9.5 9.5" opacity="0.5"/></g>',supernova:'<g fill="currentColor"><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(120 12 12)"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(240 12 12)"/><circle cx="12" cy="12" r="2.4"/></g>'},fl="tm-";function iz(s,e=null){return s==="klingon"?`${fl}klingon-${e!==null&&rr.includes(e)?e:rr[0]}`:`${fl}${s}`}function xL(){if(document.getElementById(`${fl}ship`)!==null)return null;const s=at("svg",{class:"tm-defs",width:0,height:0,"aria-hidden":"true"}),e=at("defs",{});for(const[i,n]of Object.entries(SL)){const r=at("symbol",{id:`${fl}${i}`,viewBox:"0 0 24 24"});r.innerHTML=n,e.append(r)}const t=(i,n)=>{const r=at("radialGradient",{id:`${fl}${i}`});for(const[o,a,l]of n){const c=at("stop",{offset:o});c.setAttribute("style",`stop-color: ${a}; stop-opacity: ${l}`),r.append(c)}return r};return e.append(t("halo",[[0,"var(--butter)",.9],[.35,"var(--harvestgold)",.5],[1,"var(--harvestgold)",0]]),t("halo-nova",[[0,"var(--butter)",.9],[.3,"var(--pumpkin-pie)",.6],[1,"var(--pumpkin-pie)",0]]),t("halo-mars",[[0,"var(--butter)",.8],[.3,"var(--mars)",.6],[1,"var(--mars)",0]]),t("photon-core",[[0,"#fff",1],[.35,"#ffd27a",1],[1,"#ff6a1a",1]]),t("photon-halo",[[0,"#ff6a1a",.55],[1,"#ff6a1a",0]])),s.append(e),s}function _g(s,e,t=null,i=0){const n=at("g",{class:`tm-mark tm-mark-${s}`});return n.append(at("use",{href:`#${iz(s,t)}`,x:-e.size/2,y:-e.size/2,width:e.size,height:e.size,class:"tm-symbol"})),nz(n,e.cx,e.cy,i),n}function nz(s,e,t,i=0){s.setAttribute("transform",i===0?`translate(${e} ${t})`:`translate(${e} ${t}) rotate(${i})`)}function bg(s,e=null){const t=at("svg",{viewBox:"0 0 24 24",class:`tm-icon tm-icon-${s}`,"aria-hidden":"true"});return t.append(at("use",{href:`#${iz(s,e)}`})),t}const Ac={ship:"E",klingon:"K",base:"#",inhabited:"@",star:"*",hole:" ",supernova:"///"},OL=[{kind:"ship",name:"ENTERPRISE"},{kind:"klingon",name:"KLINGON"},{kind:"base",name:"STARBASE"},{kind:"inhabited",name:"INHABITED"},{kind:"star",name:"STAR"},{kind:"hole",name:"BLACK HOLE"},{kind:"supernova",name:"SUPERNOVA"}],EL=/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,AL=/^Klingon at (\d+),(\d+) escapes to quadrant/,DL=/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/;class pl{marks=new Map;mark_of(e){return this.marks.get(pl.key_of(e))??null}line_hear(e){const t=EL.exec(e);if(t!==null){const n=`${t[1]},${t[2]}`,r=this.marks.get(n);return this.marks.delete(n),r!==void 0&&this.marks.set(`${t[3]},${t[4]}`,r),!0}const i=AL.exec(e)??DL.exec(e);return i!==null?(this.marks.delete(`${i[1]},${i[2]}`),!0):!1}reconcile(e,t={}){t.reset===!0&&this.marks.clear();const i=new Set(e.map(n=>pl.key_of(n)));for(const n of[...this.marks.keys()])i.has(n)||this.marks.delete(n);e.forEach((n,r)=>{const o=pl.key_of(n);if(t.byOrder===!0){this.marks.set(o,rr[r%rr.length]);return}this.marks.has(o)||this.marks.set(o,this.leastWorn_get())})}clear(){this.marks.clear()}leastWorn_get(){const e=new Map(rr.map(i=>[i,0]));for(const i of this.marks.values())e.set(i,(e.get(i)??0)+1);let t=rr[0];for(const i of rr)(e.get(i)??0)<(e.get(t)??0)&&(t=i);return t}static key_of(e){return`${e.x},${e.y}`}}function TL(s,e,t,i){const n=Math.max(0,Math.min(100,100*s/Math.max(1,e)));return i?{className:"tb-ring tb-ring-docked",width:.09,percent:n}:t?{className:`tb-ring ${n>60?"tb-ring-full":n>30?"tb-ring-mid":"tb-ring-low"}`,width:.025+.085*n/100,percent:n}:{className:"tb-ring tb-ring-down",width:.02,percent:n}}function V(s,e,t){const i=document.createElement(s);return i.className=e,t!==void 0&&(i.textContent=t),i}function Es(s,e,t){const i=V("button",`tb-pill ${s}`,e);return i.type="button",i.addEventListener("click",t),i}const IL=16;class rz{constructor(e,t,i){this.onCommit=i,this.size=e;const n=e/2;this.root=V("div","tb-wheel");const r=at("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,role:"img","aria-label":t});r.classList.add("tb-wheel-face"),r.append(at("circle",{cx:n,cy:n,r:n-4,class:"tb-wheel-rim"})),r.append(at("circle",{cx:n,cy:n,r:(n-4)*.66,class:"tb-wheel-ring"})),r.append(at("circle",{cx:n,cy:n,r:(n-4)*.33,class:"tb-wheel-ring"}));for(let l=0;l<36;l++){const c=l*Math.PI/18,h=l%3===0,d=n-4-(h?12:7);r.append(at("line",{x1:n+d*Math.sin(c),y1:n-d*Math.cos(c),x2:n+(n-4)*Math.sin(c),y2:n-(n-4)*Math.cos(c),class:h?"tb-wheel-tick-major":"tb-wheel-tick"}))}for(const l of[0,90,180,270]){const c=l*Math.PI/180,h=at("text",{x:n+(n-26)*Math.sin(c),y:n-(n-26)*Math.cos(c)+4,"text-anchor":"middle",class:"tb-wheel-label"});h.textContent=String(l),r.append(h)}this.wedge=at("path",{d:"",class:"tb-wheel-wedge"}),r.append(this.wedge),this.marks=at("g",{class:"tb-wheel-marks"}),r.append(this.marks),this.needle=at("line",{x1:n,y1:n,x2:n,y2:14,class:"tb-wheel-needle"}),r.append(this.needle),r.append(at("circle",{cx:n,cy:n,r:6,class:"tb-wheel-hub"})),this.root.append(r);const o=V("div","tb-wheel-row");this.readout=V("span","tb-wheel-readout","0°"),this.commit=Es("tb-commit","SET COURSE",()=>this.onCommit(Math.round(this.degrees))),o.append(this.readout,this.commit),this.root.append(o);const a=l=>{const c=r.getBoundingClientRect(),h=l.clientX-c.left-c.width/2,d=l.clientY-c.top-c.height/2;this.degrees_set((Math.atan2(h,-d)*180/Math.PI+360)%360)};r.addEventListener("pointerdown",l=>{r.setPointerCapture(l.pointerId),a(l)}),r.addEventListener("pointermove",l=>{l.buttons!==0&&a(l)})}onCommit;root;needle;marks;wedge;readout;commit;degrees=0;wedgeHalf=null;size;degrees_set(e){this.degrees=e;const t=this.size/2,i=e*Math.PI/180;this.needle.setAttribute("x2",String(t+(t-14)*Math.sin(i))),this.needle.setAttribute("y2",String(t-(t-14)*Math.cos(i))),this.readout.textContent=`${Math.round(e)}°`,this.wedge_draw()}degrees_get(){return this.degrees}wedge_set(e){this.wedgeHalf=e,this.wedge_draw()}wedge_draw(){if(this.wedgeHalf===null){this.wedge.setAttribute("d","");return}const e=this.size/2,t=e-14,i=(this.degrees-this.wedgeHalf)*Math.PI/180,n=(this.degrees+this.wedgeHalf)*Math.PI/180,r=e+t*Math.sin(i),o=e-t*Math.cos(i),a=e+t*Math.sin(n),l=e-t*Math.cos(n);this.wedge.setAttribute("d",`M ${e} ${e} L ${r} ${o} A ${t} ${t} 0 0 1 ${a} ${l} Z`)}marks_set(e){this.marks.replaceChildren();const t=this.size/2;for(const i of e){const n=i.bearing*Math.PI/180,r=(t-4)*.8,o=t+r*Math.sin(n),a=t-r*Math.cos(n),l=i.kind==="klingon"?i.bearing+180:0,c=_g(i.kind,{cx:o,cy:a,size:IL},i.variant??null,l);c.classList.add("tb-wheel-mark",`tb-wheel-mark-${i.kind}`);const h=at("title",{});h.textContent=i.label,c.append(h),this.marks.append(c)}}lit_set(e,t="SET COURSE"){this.root.classList.toggle("tb-lit",e),this.commit.disabled=!e,this.commit.textContent=t}}class gr{constructor(e,t,i,n){this.digits=i,this.onCommit=n,this.root=V("div","tb-slider");const r=V("label","tb-slider-label",t);r.htmlFor=e,this.input=document.createElement("input"),this.input.type="range",this.input.id=e,this.input.className="tb-slider-input",this.input.addEventListener("input",()=>{this.shown_refresh(),this.onInput?.(this.value_get())});const o=V("div","tb-slider-column");this.ticks=V("div","tb-slider-ticks"),this.note=V("span","tb-slider-note"),o.append(this.input,this.ticks,this.note),this.shown=V("span","tb-slider-readout","—"),this.commit=Es("tb-commit","SET",()=>this.onCommit(this.value_get())),this.root.append(r,o,this.shown,this.commit)}digits;onCommit;root;input;shown;commit;note;ticks;onInput=null;range_set(e,t,i,n=0){const r=e.min??0,o=e.max??1;this.input.min=String(r),this.input.max=String(o),this.input.step=String(e.step??1),this.input.value=String(Math.min(o,Math.max(r,t))),this.note.textContent=i,this.ticks.replaceChildren();for(let a=0;a<n;a++){const l=r+(o-r)*a/Math.max(1,n-1);this.ticks.append(V("span","tb-slider-tick",Number.isInteger(l)?String(l):l.toFixed(1)))}this.shown_refresh()}input_listen(e){this.onInput=e}note_set(e){this.note.textContent=e}value_get(){return Number(this.input.value)}value_set(e){this.input.value=String(e),this.shown_refresh()}lit_set(e,t="SET"){this.root.classList.toggle("tb-lit",e),this.input.disabled=!e,this.commit.disabled=!e,this.commit.textContent=t}lit_is(){return this.root.classList.contains("tb-lit")}shown_refresh(){this.shown.textContent=this.value_get().toFixed(this.digits)}}class Dc{root;buttons=[];note;constructor(e,t,i){this.root=V("div","tb-pillrow"),e!==""&&this.root.append(V("span","tb-slider-label",e));const n=V("div","tb-slider-column"),r=V("div","tb-pills");for(const o of t){const a=Es("tb-choice",o.label,()=>i(o.line,o.label));a.dataset.line=o.line,this.buttons.push(a),r.append(a)}this.note=V("span","tb-slider-note",""),n.append(r,this.note),this.root.append(n)}note_set(e){this.note.textContent=e}lit_set(e){this.root.classList.toggle("tb-lit",e);for(const t of this.buttons)t.disabled=!e}}const CL=[[/Klingon attack:/,"incoming"],[/^HIT: \d+ units/,"hit"],[/CRITICAL HIT/,"hit"],[/\*\*\* Klingon at \d+,\d+ destroyed \*\*\*/,"explosion"],[/\*\*\*\*\* .* destroyed \*\*\*\*\*/,"explosion"],[/Starbase at \d+,\d+ destroyed/,"explosion"],[/Inhabited starsystem .* destroyed/,"explosion"],[/^Torpedo track/,"torpedo"],[/^Phaser bank \d+ fires:/,"phaser"],[/^Phasers locked on target/,"phaser"],[/^Starbase in \d+,\d+ responds/,"hail"],[/^Password verified; self destruct sequence continues/,"destruct"]];function RL(s){const e=[];for(const[t,i]of CL)t.test(s)&&!e.includes(i)&&e.push(i);return e}function kL(s,e){const t=[];if(s!==null&&s.condition.name!==e.condition.name)switch(e.condition.name){case"RED":t.push("redalert");break;case"YELLOW":t.push("yellowalert");break;case"DOCKED":t.push("dock");break;default:t.push("green");break}return s!==null&&(s.position.quadrant.x!==e.position.quadrant.x||s.position.quadrant.y!==e.position.quadrant.y)&&t.push("sensor"),t}function BL(s){switch(s){case"abandon":return"transporter";case"destruct":return"destruct";case"computer":return"thinking";default:return null}}function NL(s,e){return s!=="distance"?null:e==="impulse"?"impulse":e==="move"||e==="ram"?"warp":null}function ar(s,e){return e==="computer"&&s==="MOVE"?"MOVE (COMPUTER)":e==="commit"?/^SET COURSE/.test(s)?"SET COURSE":"SLIDER SET":e==="choice"&&/^\d+°$/.test(s)?"BURST ANGLE":/^CANCEL/.test(s)?"CANCEL":s}const xs=10,xl=8,GL="*",PL="#",oz="E",LL="Q",WL="K",FL="@",az=" ",UL=7,$L=64,jL=63,HL=0,VL=1,qL=2,KL=3,YL=[{name:"warp drive",person:"Scotty"},{name:"S.R. scanners",person:"Scotty"},{name:"L.R. scanners",person:"Scotty"},{name:"phasers",person:"Sulu"},{name:"photon tubes",person:"Sulu"},{name:"impulse engines",person:"Scotty"},{name:"shield control",person:"Sulu"},{name:"computer",person:"Spock"},{name:"subspace radio",person:"Uhura"},{name:"life support",person:"Scotty"},{name:"navigation system",person:"Chekov"},{name:"cloaking device",person:"Scotty"},{name:"transporter",person:"Scotty"},{name:"shuttlecraft",person:"Scotty"},{name:"*ERR 14*",person:"Nobody"},{name:"*ERR 15*",person:"Nobody"}],XL=["GREEN","DOCKED","YELLOW","RED"];function Qc(s,e){return(Math.atan2(e.y-s.y,-(e.x-s.x))*180/Math.PI+360)%360}function Wh(s,e){return Math.hypot(e.x-s.x,e.y-s.y)}function ZL(s){switch(s){case oz:case LL:return"ship";case WL:return"klingon";case PL:return"base";case GL:return"star";case FL:return"inhabited";case az:return"hole";default:return"empty"}}function JL(s){const e=new Map;for(const t of s)(t.evcode&jL)!==UL||(t.evcode&$L)!==0||e.set(t.systemname,t.date);return YL.map((t,i)=>({index:i,name:t.name,person:t.person,repairAt:e.get(i)??null})).filter(t=>!t.name.startsWith("*"))}function QL(s){const e=s.Etc.nkling;switch(s.Ship.cond){case KL:return e===1?"1 Klingon in this quadrant":`${e} Klingons in this quadrant`;case qL:return s.Ship.energy<s.Param.energylow?"energy low":"Klingons near";case VL:return"docked at a starbase";case HL:default:return"all clear"}}function e3(s){const{Ship:e,Now:t,Game:i,Param:n,Etc:r,Sect:o,Quad:a}=s,l={x:e.quadx,y:e.quady},c={x:e.sectx,y:e.secty},h=[];for(let m=0;m<xs;m++){const v=[];for(let y=0;y<xs;y++){const b=o[m]?.[y]??az;v.push({x:m,y,kind:ZL(b),glyph:b})}h.push(v)}const d=r.klingon.slice(0,r.nkling).map(m=>({x:m.x,y:m.y,bearing:Qc(c,m),range:Wh(c,m),power:m.power,mark:null})).sort((m,v)=>m.range-v.range),u=t.base.slice(0,t.bases).map(m=>({x:m.x,y:m.y}));let p=null;for(const m of u){const v=Wh(l,m);(p===null||v<p.range)&&(p={at:m,range:v,here:v===0})}const f=[];for(let m=0;m<xl;m++){const v=[];for(let y=0;y<xl;y++){const w=a[m]?.[y]?.scanned??-1,z=w<0?null:w>=1e3?"///":String(w).padStart(3,"0");v.push({x:m,y,here:m===l.x&&y===l.y,code:z,supernova:w>=1e3,klingons:w<0||w>=1e3?0:Math.floor(w/100),bases:w<0||w>=1e3?0:Math.floor(w%100/10)})}f.push(v)}const _=JL(s.Event),g=_.filter(m=>m.repairAt!==null).sort((m,v)=>(m.repairAt??0)-(v.repairAt??0));return{condition:{name:XL[e.cond]??"GREEN",why:QL(s)},ship:{shipName:e.shipname,energy:e.energy,energyMax:n.energy,shield:e.shield,shieldMax:n.shield,shieldsUp:e.shldup!==0,cloaked:e.cloaked!==0,torpedoes:e.torped,torpedoesMax:n.torped,reserves:e.reserves,reservesMax:n.reserves,crew:e.crew,warp:e.warp},mission:{stardate:t.date,timeLeft:t.time,klingonsLeft:t.klings,klingonsStart:n.klings,killed:i.killk,captives:i.captives,starbases:t.bases},position:{quadrant:l,sector:c},sectors:h,klingons:d,bases:u,nearestBase:p,chart:f,devices:_,damaged:g,game:{killk:i.killk,killb:i.killb,kills:i.kills,killinhab:i.killinhab,helps:i.helps,captives:i.captives,deaths:i.deaths,killed:i.killed!==0,skill:i.skill,won:s.Move.endgame>0,abandoned:e.ship!==oz},param:{warptime:n.warptime,dockfac:n.dockfac,klingpwr:n.klingpwr,date:n.date}}}const t3=["novice","fair","good","expert","commodore","impossible"];function lz(s){const{game:e,mission:t,param:i}=s,n=[];n.push({label:`${e.killk} Klingons killed`,points:Math.trunc(i.klingpwr/4)*e.killk});const r=Math.max(1,t.stardate-i.date),o=e.killk/r;return n.push({label:`kill rate ${o.toFixed(2)} Klingons/stardate`,points:Math.trunc(400*o)}),n.push({label:`penalty for ${t.klingonsLeft} Klingons remaining`,points:Math.trunc(-400*t.klingonsLeft/(e.killk+1))}),e.won&&n.push({label:`bonus for winning a ${t3[e.skill-1]??""} game`,points:100*e.skill}),e.killed&&n.push({label:"penalty for getting killed",points:-500}),n.push({label:`${e.killb} starbases killed`,points:-100*e.killb}),n.push({label:`${e.helps} calls for help`,points:-100*e.helps}),n.push({label:`${e.kills} stars destroyed`,points:-5*e.kills}),n.push({label:`${e.killinhab} inhabited starsystems destroyed`,points:-150*e.killinhab}),e.abandoned&&n.push({label:"penalty for abandoning ship",points:-200}),n.push({label:`${e.captives} Klingons captured`,points:3*e.captives}),n.push({label:`${e.deaths} casualties`,points:-e.deaths}),{items:n,total:n.reduce((a,l)=>a+l.points,0)}}function X0(s,e){const{quadrant:t,sector:i}=s.position,n=t.x+i.x/xs-(e.quadrant.x+e.sector.x/xs),r=e.quadrant.y+e.sector.y/xs-(t.y+i.y/xs);let o=Math.atan2(r,n);return o<0&&(o+=2*Math.PI),{course:Math.trunc(o*180/Math.PI+.5)%360,distance:Math.hypot(n,r)}}function s3(s,e,t){const{quadrant:i,sector:n}=s.position,r=e*Math.PI/180,o=Math.min(xl*xs-1,Math.max(0,Math.round(i.x*xs+n.x-Math.cos(r)*t*xs))),a=Math.min(xl*xs-1,Math.max(0,Math.round(i.y*xs+n.y+Math.sin(r)*t*xs)));return{quadrant:{x:Math.trunc(o/xs),y:Math.trunc(a/xs)},sector:{x:o%xs,y:a%xs}}}function cz(s,e,t){const i=Math.trunc((s+.05)*e*e*e);return{stardates:t*s/(e*e),units:i,unitsShielded:2*i}}function i3(s){return{stardates:s/.095,units:Math.trunc(20+100*s)}}function hz(s){return Math.trunc(Math.pow(.9,s*10)*98+.5)}function Z0(s,e){if(s.repairAt===null)return null;const t=s.repairAt-e.mission.stardate,i=e.condition.name==="DOCKED",n=i?1/e.param.dockfac:1,r=i?1:e.param.dockfac;return{inFlight:t*n+.005,docked:t*r+.005}}function dz(s,e){const t=[],i=(d,u)=>`${d>0?"+":d<0?"−":""}${Math.abs(d).toFixed(u)}`,n=e.mission.stardate-s.mission.stardate;Math.abs(n)>=.005&&t.push({label:"STARDATE",change:i(n,2),bad:!1});const r=e.ship.energy-s.ship.energy;r!==0&&t.push({label:"ENERGY",change:i(r,0),bad:r<0});const o=e.ship.shield-s.ship.shield;o!==0&&t.push({label:"SHIELDS",change:i(o,0),bad:o<0});const a=e.ship.torpedoes-s.ship.torpedoes;a!==0&&t.push({label:"TORPEDOES",change:i(a,0),bad:!1});const l=e.mission.klingonsLeft-s.mission.klingonsLeft;l!==0&&t.push({label:"KLINGONS",change:`${i(l,0)} · ${e.mission.klingonsLeft} LEFT`,bad:l>0});const c=e.damaged.filter(d=>!s.damaged.some(u=>u.index===d.index));c.length>0&&t.push({label:"DAMAGE",change:c.map(d=>d.name.toUpperCase()).join(" · "),bad:!0});const h=s.damaged.filter(d=>!e.damaged.some(u=>u.index===d.index));return h.length>0&&t.push({label:"REPAIRED",change:h.map(d=>d.name.toUpperCase()).join(" · "),bad:!1}),s.condition.name!==e.condition.name&&t.push({label:"CONDITION",change:e.condition.name,bad:e.condition.name==="RED"}),t}const n3=[["return to continue","return"],["What length game","length"],["What skill game","skill"],["Enter password verification","password-verify"],["Enter a password","password"],["Enter tournament code","tournament"],["Command","command"],["Torpedo course","torpedo-course"],["Course","course"],["course","bank-course"],["Distance","distance"],["distance","computer-distance"],["Warp factor","warp-factor"],["warp factor","computer-warp"],["How long","how-long"],["Manual or automatic","manual-automatic"],["Units to fire","units"],["units","bank-units"],["spread","spread"],["Do you want a burst","burst"],["burst angle","burst-angle"],["Up or down","up-down"],["Request","request"],["Quadrant","quadrant"],["q-y","quadrant-y"],["Sector","sector"],["s-y","sector-y"],["range","range"],["direction","direction"],["status report","status-report"],["Another game","another"]];function r3(s){const e=s.replace(/[:.\s]+$/,"");if(e==="")return"return";for(const[t,i]of n3)if(e.endsWith(t))return i;return/wise$|certain that is wise$|Shall we cancel our rest period$/.test(e)?"yes-no":"unknown"}const md=[{id:"move",label:"MOVE",station:"helm",line:"m",asks:["course","distance"]},{id:"ram",label:"RAM",station:"helm",line:"ram",asks:["course","distance"]},{id:"warp",label:"WARP",station:"helm",line:"w",asks:["warp-factor"]},{id:"impulse",label:"IMPULSE",station:"helm",line:"i",asks:["course","distance"]},{id:"dock",label:"DOCK",station:"helm",line:"do",asks:[]},{id:"undock",label:"UNDOCK",station:"helm",line:"u",asks:[]},{id:"rest",label:"REST",station:"helm",line:"r",asks:["how-long"]},{id:"phasers",label:"PHASERS",station:"tactical",line:"p",asks:["manual-automatic","units"]},{id:"torpedo",label:"TORPEDO",station:"tactical",line:"t",asks:["torpedo-course","burst","burst-angle"]},{id:"shields",label:"SHIELDS",station:"tactical",line:"sh",asks:["up-down"]},{id:"cloak",label:"CLOAK",station:"tactical",line:"cl",asks:["up-down"]},{id:"capture",label:"CAPTURE",station:"tactical",line:"ca",asks:[]},{id:"visual",label:"VISUAL",station:"tactical",line:"v",asks:["direction"]},{id:"computer",label:"COMPUTER",station:"ship",line:"c",asks:["request"]},{id:"help",label:"CALL STARBASE",station:"ship",line:"help",asks:[]},{id:"dump",label:"DUMP",station:"ship",line:"dump",asks:[]},{id:"credits",label:"CREDITS",station:"ship",line:"cr",asks:[]},{id:"abandon",label:"ABANDON",station:"ship",line:"abandon",asks:[],grave:!0},{id:"destruct",label:"DESTRUCT",station:"ship",line:"destruct",asks:["password-verify"],grave:!0},{id:"terminate",label:"TERMINATE",station:"ship",line:"terminate",asks:[],grave:!0}];function Os(s,e){switch(s){case"return":return{kind:"auto"};case"length":return{kind:"pills",choices:[{label:"SHORT",line:"s"},{label:"MEDIUM",line:"m"},{label:"LONG",line:"l"},{label:"RESTART",line:"restart"}]};case"skill":return{kind:"pills",choices:[{label:"NOVICE",line:"n"},{label:"FAIR",line:"f"},{label:"GOOD",line:"g"},{label:"EXPERT",line:"e"},{label:"COMMODORE",line:"c"},{label:"IMPOSSIBLE",line:"i"}]};case"password":case"tournament":case"password-verify":return{kind:"auto"};case"course":case"torpedo-course":case"direction":case"bank-course":return{kind:"wheel",min:0,max:360,step:1,commit:"SET COURSE",cancel:"-1"};case"distance":return{kind:"slider",min:0,max:15,step:.1,commit:"ENGAGE",cancel:"-1"};case"computer-distance":case"range":return{kind:"slider",min:0,max:15,step:.1,commit:"SET"};case"warp-factor":return{kind:"slider",min:1,max:10,step:.1,commit:"SET WARP",cancel:"-1"};case"computer-warp":return{kind:"slider",min:1,max:10,step:.1,commit:"SET"};case"how-long":return{kind:"slider",min:0,max:Math.max(.1,e?.mission.timeLeft??15),step:.1,commit:"REST",cancel:"0"};case"manual-automatic":return{kind:"pills",choices:[{label:"MANUAL",line:"m"},{label:"AUTOMATIC",line:"a"}]};case"units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"FIRE",cancel:"0"};case"bank-units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"SET",cancel:"0"};case"spread":return{kind:"slider",min:0,max:1,step:.05,commit:"SET"};case"burst":case"status-report":case"another":case"yes-no":return{kind:"yesno",choices:[{label:"YES",line:"y"},{label:"NO",line:"n"}]};case"burst-angle":return{kind:"pills",choices:[1,2,3,5,8,10,12,15].map(t=>({label:`${t}°`,line:String(t)})),cancel:"0"};case"up-down":return{kind:"pills",choices:[{label:"UP",line:"u"},{label:"DOWN",line:"d"}]};case"request":return{kind:"pills",choices:[{label:"CHART",line:"ch"},{label:"TRAJECTORY",line:"t"},{label:"COURSE",line:"c"},{label:"MOVE",line:"m"},{label:"SCORE",line:"s"},{label:"PHASER EFFECT",line:"p"},{label:"WARP COST",line:"w"},{label:"IMPULSE COST",line:"i"},{label:"DISTRESS LIST",line:"d"}]};case"quadrant":case"quadrant-y":return{kind:"slider",min:0,max:xl-1,step:1,commit:"SET"};case"sector":case"sector-y":return{kind:"slider",min:0,max:xs-1,step:1,commit:"SET"};default:return{kind:"text"}}}function o3(){return`argus${Math.floor(Math.random()*9e3+1e3)}`}class a3{constructor(e){this.hooks=e}hooks;open=null;lastCommand=null;password=o3();ended=!1;ask(e){const t=r3(e);return t==="return"?Promise.resolve(""):t==="password"||t==="tournament"||t==="password-verify"?Promise.resolve(this.password):(t==="command"&&(this.lastCommand=null),new Promise(i=>{this.open={question:{prompt:e,question:t,command:this.lastCommand},answer:i},this.hooks.question_changed(this.open.question)}))}question_get(){return this.open?.question??null}answer(e){if(this.open===null)return!1;const{answer:t}=this.open;return this.open=null,this.hooks.question_changed(null),t(e),!0}command_send(e){return this.open?.question.question!=="command"?!1:(this.lastCommand=e,this.answer(e.line))}abandon(){if(this.open===null)return!1;const{answer:e}=this.open;return this.open=null,this.hooks.question_changed(null),e(null),!0}text_take(e){this.hooks.text_written(e)}event_take(e,t){e==="games.trek.state"&&typeof t=="object"&&t!==null&&this.hooks.state_shown(t)}end(e){this.ended||(this.ended=!0,this.open=null,this.hooks.ended(e))}ended_is(){return this.ended}}const Rn={torpedoPoint:140,sector:170,burst:800,beam:900,rescan:350,flare:900,tail:300},l3=[[/^Torpedo track(?:, torpedo number \d+)?:/,()=>({kind:"torpedo-head"})],[/^\s*(\d+\.\d)\s+(\d+\.\d)\s*$/,s=>({kind:"torpedo-point",at:{x:Number(s[1]),y:Number(s[2])}})],[/^Torpedo missed|^Torpedo disappears into a black hole/,()=>({kind:"torpedo-end"})],[/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/,s=>({kind:"kill",at:li(s,1)})],[/^Starbase at (\d+),(\d+) destroyed/,s=>({kind:"kill",at:li(s,1)})],[/^Inhabited starsystem .* at (\d+),(\d+) destroyed/,s=>({kind:"kill",at:li(s,1)})],[/^Unknown object . at (\d+),(\d+) destroyed/,s=>({kind:"kill",at:li(s,1)})],[/Star at (\d+),(\d+) gone nova/,s=>({kind:"nova",at:li(s,1)})],[/^Photon tubes misfire/,()=>({kind:"misfire"})],[/^(\d+) unit hit on Klingon at (\d+),(\d+)/,s=>({kind:"phaser",at:li(s,2)})],[/^HIT: (\d+) units(?: from (\d+),(\d+))?(?:, shields absorb (\d+)%)?/,s=>({kind:"incoming",hit:Number(s[1]),from:s[2]===void 0?null:li(s,2),absorb:s[4]===void 0?0:Number(s[4])})],[/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,s=>({kind:"klingon-move",from:li(s,1),to:li(s,3)})],[/^Klingon at (\d+),(\d+) escapes to quadrant (\d+),(\d+)/,s=>({kind:"klingon-escape",from:li(s,1),quadrant:li(s,3)})],[/RED ALERT: supernova occurring at (\d+),(\d+)/,s=>({kind:"supernova",at:li(s,1)})],[/^\s*in quadrant (\d+),(\d+)\.\s+Caution is advised/,s=>({kind:"supernova-report",quadrant:li(s,1)})]];function li(s,e){return{x:Number(s[e]),y:Number(s[e+1])}}function c3(s){for(const[e,t]of l3){const i=e.exec(s);if(i!==null)return t(i)}return null}class h3{constructor(e=d3){this.reduced=e}reduced;frames=[];running=!1;skipping=!1;waiting=new Set;played={};push(e){this.frames.push(e),this.pump()}skip(){if(!(this.frames.length===0&&!this.running)){this.skipping=!0;for(const e of this.waiting)e();this.waiting.clear()}}busy_is(){return this.running||this.frames.length>0}pending_count(){return this.frames.length}skipping_is(){return this.skipping}async settle(){for(;this.busy_is();)await new Promise(e=>{setTimeout(e,1)})}wait(e){return this.skipping||e<=0?Promise.resolve():new Promise(t=>{const i=setTimeout(()=>{this.waiting.delete(n),t()},e),n=()=>{clearTimeout(i),t()};this.waiting.add(n)})}async tween(e,t){const i=J0();for(;!this.skipping;){const n=Math.min(1,(J0()-i)/Math.max(1,e));if(t(n),n>=1)return;await u3(this)}t(1)}async pump(){if(!this.running){this.running=!0;try{for(;this.frames.length>0;){const e=this.frames.shift();this.played[e.kind]=(this.played[e.kind]??0)+1;const t=this.skipping||this.reduced();try{await e.run(t)}catch{}}}finally{this.running=!1,this.skipping=!1}}}}function d3(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function J0(){return typeof performance=="object"?performance.now():Date.now()}function u3(s){return typeof requestAnimationFrame=="function"?new Promise(e=>{requestAnimationFrame(()=>e())}):s.wait(16)}function ma(s){return[s.y+.5,s.x+.5]}function uz(s,e){return(Math.atan2(e.y-s.y,-(e.x-s.x))*180/Math.PI+360)%360}function f3(s,e,t=10){const i={x:s.quadrant.x*t+s.sector.x,y:s.quadrant.y*t+s.sector.y},n={x:e.quadrant.x*t+e.sector.x,y:e.quadrant.y*t+e.sector.y},r={x:n.x-i.x,y:n.y-i.y},o=(p,f,_)=>{let g=_?1/0:-1/0;for(const m of["x","y"]){if(r[m]===0)continue;const v=p[m]*t-.5,y=p[m]*t+t-.5,b=(v-f[m])/r[m],w=(y-f[m])/r[m];_?g=Math.min(g,Math.max(b,w)):g=Math.max(g,Math.min(b,w))}return Number.isFinite(g)?Math.max(0,Math.min(1,g)):_?1:0},a=o(s.quadrant,i,!0),l=o(e.quadrant,i,!1),c=.7,h={x:i.x+r.x*a-s.quadrant.x*t,y:i.y+r.y*a-s.quadrant.y*t},d={x:i.x+r.x*l-e.quadrant.x*t,y:i.y+r.y*l-e.quadrant.y*t},u=Math.hypot(r.x,r.y)||1;return{exit:{x:h.x+r.x/u*c,y:h.y+r.y/u*c},entry:{x:d.x-r.x/u*c,y:d.y-r.y/u*c}}}function gd(s,e=""){const t=at("g",{class:`tb-motion ${e}`.trim()});return s.append(t),t}const p3=.7;async function ja(s,e,t,i,n,r={},o=!1){if(o)return;const a=gd(s,"tb-motion-slide"),[l,c]=ma(i),[h,d]=ma(n),u=r.hostile===!0?" tb-hostile":"";a.append(at("line",{class:`tb-track${u}`,x1:l,y1:c,x2:h,y2:d}));const p=at("line",{class:`tb-pulse tb-pulse-wide${u}`,x1:l,y1:c,x2:l,y2:c}),f=at("line",{class:`tb-pulse tb-pulse-core${u}`,x1:l,y1:c,x2:l,y2:c}),_=r.heading??uz(i,n),g=_g(t.kind,{cx:l,cy:c,size:p3},t.variant,_);g.classList.add(`tb-sector-${t.kind}`),a.append(p,f,g);const m=Math.max(1,Math.hypot(n.x-i.x,n.y-i.y));await e.tween(m*Rn.sector,v=>{const y=l+(h-l)*v,b=c+(d-c)*v,w=Math.max(0,v-.12),z=l+(h-l)*w,O=c+(d-c)*w;for(const M of[p,f])M.setAttribute("x1",String(z)),M.setAttribute("y1",String(O)),M.setAttribute("x2",String(y)),M.setAttribute("y2",String(b));nz(g,y,b,_)}),a.remove()}async function Q0(s,e,t,i,n,r=!1){if(r)return;const o=gd(s,"tb-motion-beam"),[a,l]=ma(t),[c,h]=ma(i),d=n?" tb-hostile":"";o.append(at("line",{class:`tb-beam${d}`,x1:a,y1:l,x2:c,y2:h}),at("line",{class:`tb-beam tb-beam-core${d}`,x1:a,y1:l,x2:c,y2:h})),await e.wait(Rn.beam),o.remove()}async function Tc(s,e,t,i,n=!1){if(n)return;const r=gd(s,`tb-motion-burst tb-burst tb-burst-${i}`),[o,a]=ma(t),l=i==="misfire"?Rn.burst*.6:i==="supernova"?Rn.burst*1.6:Rn.burst;r.style.setProperty("--tb-ms",`${l}ms`),r.append(at("circle",{class:"tb-burst-halo",cx:o,cy:a,r:.1}));const c=at("g",{class:"tb-burst-spikes"}),h=i==="nova"||i==="supernova"?12:8,d=i==="misfire"?.6:i==="supernova"?1.8:i==="nova"?1.1:.95;for(let u=0;u<h;u++){const p=u/h*Math.PI*2+(h===8?Math.PI/8:0);c.append(at("line",{class:"tb-burst-spike",x1:o+Math.cos(p)*.12,y1:a+Math.sin(p)*.12,x2:o+Math.cos(p)*d,y2:a+Math.sin(p)*d}))}r.append(c,at("circle",{class:"tb-burst-core",cx:o,cy:a,r:.04})),await e.wait(l),r.remove()}async function m3(s,e,t=!1){if(t)return;const i=s.querySelector(".tb-ring");if(i===null)return;const n=at("circle",{class:"tb-motion tb-ring-flare",cx:i.getAttribute("cx")??0,cy:i.getAttribute("cy")??0,r:.46});s.append(n),await e.wait(Rn.flare),n.remove()}class g3{layer;tail;photon;points=[];constructor(e,t){this.layer=gd(e,"tb-motion-torpedo"),this.tail=at("g",{class:"tb-tail"}),this.photon=at("g",{class:"tb-photon"}),this.photon.append(at("circle",{class:"tb-photon-halo",cx:0,cy:0,r:.34}));const i=at("g",{class:"tb-photon-pulses"});for(let o=0;o<10;o++){const a=at("g",{transform:`rotate(${o*36})`});a.append(at("rect",{x:.08,y:-.016,width:.2+o%3*.05,height:.032,rx:.006})),i.append(a)}this.photon.append(i,at("circle",{class:"tb-photon-core",cx:0,cy:0,r:.12})),this.layer.append(this.tail,this.photon);const[n,r]=ma(t);this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`)}async point_reach(e,t,i=!1){const[n,r]=[t.y,t.x];this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`),this.tail.replaceChildren();const o=this.points.slice(-4);for(let a=1;a<o.length;a++){const[l,c]=o[a-1],[h,d]=o[a];this.tail.append(at("line",{class:"tb-tail-segment",x1:l,y1:c,x2:h,y2:d,"stroke-width":.03+.03*a,opacity:.25+.25*a}))}i||await e.wait(Rn.torpedoPoint)}async end(e,t=!1){this.photon.remove(),t||await e.wait(Rn.tail),this.layer.remove()}}function eM(s,e){s.classList.toggle("tb-rescan",e)}function _3(s,e){s.classList.remove("tb-bloom","tb-bloom-hostile"),s.offsetWidth,s.classList.add("tb-bloom"),e&&s.classList.add("tb-bloom-hostile"),s.addEventListener("animationend",()=>s.classList.remove("tb-bloom","tb-bloom-hostile"),{once:!0})}function fi(s,e){return s!==null&&e.includes(s.question)}function _d(s,e){const t=V("div","tb-station-head"),i=V("span","tb-station-step",""),n=Es("tb-grave tb-cancel","CANCEL",()=>{e.answer_send(n.dataset.line??"","CANCEL")});return n.hidden=!0,t.append(V("span","tb-station-name",s),i,V("span","tb-station-fill"),n),{root:t,step:i,cancel:n}}function bd(s,e,t,i){const n=t?.command??null,r=n!==null&&n.station===e&&t!==null&&t.question!=="command";s.step.textContent=r&&n!==null&&t!==null?`${n.label} · ${t.question.replace(/-/g," ").toUpperCase()}`:t?.question==="command"?"READY":"";const o=r?i?.cancel:void 0;s.cancel.hidden=o===void 0,s.cancel.dataset.line=o??"",s.cancel.textContent=n===null?"CANCEL":`CANCEL ${n.label}`}function Mg(s,e){const t=Es(`tb-command${s.grave===!0?" tb-grave":""}`,s.label,()=>{e.command_send(s)});return t.dataset.command=s.id,t}function fz(s,e){const t=V("div","tb-pills tb-command-pills"),i=new Map;for(const n of md.filter(r=>r.station===s)){const r=Mg(n,e);i.set(n.id,r),t.append(r)}return{root:t,pills:i}}function Md(s,e){for(const[t,i]of s)i.disabled=e?.question!=="command",i.classList.toggle("tb-pill-on",e?.command?.id===t)}function pz(s,e){const t=Es("tb-target","",e);return t.append(bg("klingon",s.mark),document.createTextNode(`${s.x},${s.y}`)),t.title=`Klingon at ${s.x},${s.y}`,t}function Ip(s,e){const t=V("span",s,e.supernova?"":e.code??"");return e.supernova&&t.append(bg("supernova")),t}function Cp(s){return`quadrant ${s.x},${s.y}${s.supernova?" · supernova":s.code===null?" · unscanned":""}`}function mz(s){const e=s.klingons.map(t=>({bearing:t.bearing,kind:"klingon",label:`Klingon at ${t.x},${t.y} · ${t.range.toFixed(1)} · ${Math.round(t.bearing)}°`,variant:t.mark}));for(const t of s.sectors)for(const i of t){if(i.kind!=="base")continue;const n=i.x-s.position.sector.x,r=i.y-s.position.sector.y;e.push({bearing:(Math.atan2(r,-n)*180/Math.PI+360)%360,kind:"base",label:`starbase at ${i.x},${i.y}`})}return e}class tM{root;wheel;distance;warp;rest;head;pills;readout=null;constructor(e,t,i){this.root=V("div","tb-station tb-station-helm"),this.head=_d("HELM",e);const n=fz("helm",e);this.pills=n.pills;const r=V("div","tb-controls");this.wheel=new rz(t,"course wheel",a=>e.answer_send(String(a),"SET COURSE"));const o=V("div","tb-sliders");this.distance=new gr(`${i}-distance`,"DISTANCE",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.warp=new gr(`${i}-warp`,"WARP FACTOR",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.rest=new gr(`${i}-rest`,"REST",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.distance.input_listen(()=>this.arrival_note()),o.append(this.distance.root,this.warp.root,this.rest.root),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}state_show(e){const t=this.readout===null;this.readout=e,this.wheel.marks_set(mz(e)),this.warp.range_set(Os("warp-factor",e),e.ship.warp,"THE SHIP NOW · ABOVE 6 THE ENGINES MAY BURN",10),this.distance.range_set(Os("distance",e),t?1:this.distance.value_get(),"QUADRANTS · 0.1 IS ONE SECTOR",6),this.rest.range_set(Os("how-long",e),0,`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT · REPAIRS RUN WHILE TIME PASSES`,2)}question_show(e){Md(this.pills,e);const t=e===null?null:Os(e.question,this.readout);bd(this.head,"helm",e,t),this.wheel.lit_set(fi(e,["course","direction"]),"SET COURSE"),this.distance.lit_set(fi(e,["distance"]),"ENGAGE"),this.warp.lit_set(fi(e,["warp-factor"]),"SET WARP"),this.rest.lit_set(fi(e,["how-long"]),"REST"),e?.question==="distance"&&this.arrival_note()}arrival_note(){if(this.readout===null)return;const e=this.distance.value_get(),t=s3(this.readout,this.wheel.degrees_get(),e),i=cz(e,this.readout.ship.warp,this.readout.param.warptime);this.distance.note_set(`ARRIVES ${t.quadrant.x},${t.quadrant.y} / ${t.sector.x},${t.sector.y} · ${i.stardates.toFixed(2)} STARDATES AT WARP ${this.readout.ship.warp.toFixed(1)} · ${i.units} UNITS`)}}class sM{constructor(e,t,i){this.host=e,this.root=V("div","tb-station tb-station-tactical"),this.head=_d("TACTICAL",e);const n=fz("tactical",e);this.pills=n.pills;const r=V("div","tb-controls");this.wheel=new rz(t,"firing course wheel",l=>e.answer_send(String(l),"SET COURSE"));const o=V("div","tb-sliders");this.burst=new Dc("BURST",Os("burst",null).choices??[],(l,c)=>e.answer_send(l,ar(c,"choice"))),this.burstAngle=new Dc("BURST ANGLE",Os("burst-angle",null).choices??[],(l,c)=>{this.wheel.wedge_set(Number(l)),e.answer_send(l,ar(c,"choice"))}),this.manual=new Dc("PHASERS",Os("manual-automatic",null).choices??[],(l,c)=>e.answer_send(l,ar(c,"choice"))),this.units=new gr(`${i}-units`,"UNITS",0,l=>e.answer_send(String(Math.round(l)),"SLIDER SET")),this.spread=new gr(`${i}-spread`,"SPREAD",2,l=>e.answer_send(l.toFixed(2),"SLIDER SET")),this.upDown=new Dc("SHIELDS",Os("up-down",null).choices??[],(l,c)=>e.answer_send(l,ar(c,"choice")));const a=V("div","tb-fire-row");this.fire=Es("tb-fire","FIRE",()=>e.answer_send("0",null)),this.targets=V("div","tb-targets"),a.append(this.fire,this.targets),o.append(this.burst.root,this.burstAngle.root,this.manual.root,this.units.root,this.spread.root,this.upDown.root,a),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}host;root;wheel;units;spread;head;pills;burst;burstAngle;manual;upDown;fire;targets;readout=null;state_show(e){this.readout=e,this.wheel.marks_set(mz(e)),this.wheel.wedge_set(null),e.klingons[0]!==void 0&&this.wheel.degrees_set(e.klingons[0].bearing),this.units.range_set(Os("units",e),Math.min(e.ship.energy,Math.round(e.ship.energy/100)*10),`UP TO THE ${e.ship.energy} FREE`,6),this.spread.range_set(Os("spread",e),.5,"MANUAL PHASERS ONLY",3),this.burst.note_set(`${e.ship.torpedoes} TORPEDOES · A BURST FIRES 3`),this.upDown.note_set(`${e.ship.shieldsUp?"UP":"DOWN"} · ${e.ship.shield} OF ${e.ship.shieldMax} · REFILLS AT A STARBASE`);const t=this.pills.get("phasers");t!==void 0&&(t.classList.toggle("tb-barred",e.ship.shieldsUp),t.title=e.ship.shieldsUp?"Shields are up: phasers cannot fire through them. SHIELDS, then DOWN, first.":""),this.targets_draw(e)}question_show(e){Md(this.pills,e);const t=e===null?null:Os(e.question,this.readout);bd(this.head,"tactical",e,t),this.wheel.lit_set(fi(e,["torpedo-course","bank-course"]),"SET COURSE"),this.burst.lit_set(fi(e,["burst"])),this.burstAngle.lit_set(fi(e,["burst-angle"])),this.manual.lit_set(fi(e,["manual-automatic"])),this.units.lit_set(fi(e,["units","bank-units"]),e?.question==="units"?"FIRE":"SET BANK"),this.spread.lit_set(fi(e,["spread"])),this.upDown.lit_set(fi(e,["up-down"])),this.fire.disabled=!fi(e,["bank-units"]),this.fire.textContent="FIRE THE BANKS SET"}targets_draw(e){if(this.targets.replaceChildren(),e.klingons.length===0){this.targets.append(V("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const t of["TARGET","RANGE","BEARING","PHASER HIT"])this.targets.append(V("span","tb-target-head",t));for(const t of e.klingons){const i=pz(t,()=>{this.host.voice.cue("scanner"),this.host.course_set(t.bearing,t.range/10)});this.targets.append(i,V("span","tb-target-cell",t.range.toFixed(1)),V("span","tb-target-cell",`${Math.round(t.bearing)}°`),V("span","tb-target-cell",`${hz(t.range/10)}%`))}}}class b3{root;rest;head;pills;damage;systems;since;inThatTime;readout=null;constructor(e){this.root=V("div","tb-view-body tb-view-engineering");const t=V("section","tb-panel tb-damage");t.append(V("span","tb-title","DAMAGE CONTROL"),V("span","tb-note","THE C'S REPORT · ALWAYS ON")),this.damage=V("div","tb-dc"),t.append(this.damage,V("span","tb-note","REPAIR TIMES IN STARDATES · REPAIRS RUN WHILE TIME PASSES · DOCKED, FASTER BY THE DOCK FACTOR"));const i=V("section","tb-panel tb-systems-section");i.append(V("span","tb-title","SHIP"),V("span","tb-note","ENERGY, SHIELDS, RESERVES")),this.systems=V("div","tb-systems"),i.append(this.systems,V("span","tb-title","SINCE THE LAST COMMAND")),this.since=V("div","tb-head-grid tb-since-grid"),i.append(this.since,V("span","tb-note","SHIELDS ARE UP OR DOWN IN TREK(6): THEIR ENERGY IS A READOUT, REFILLED AT A STARBASE"));const n=V("section","tb-panel tb-station tb-station-time");this.head=_d("REST",e);const r=V("div","tb-pills tb-command-pills");this.pills=new Map;for(const o of["rest","dock","undock"]){const a=md.find(c=>c.id===o);if(a===void 0)continue;const l=Mg(a,e);this.pills.set(o,l),r.append(l)}this.rest=new gr("tbe-rest","HOW LONG",1,o=>e.answer_send(o.toFixed(1),"SLIDER SET")),this.rest.input_listen(()=>this.inThatTime_note()),this.inThatTime=V("div","tb-in-that-time"),n.append(this.head.root,r,this.rest.root,V("span","tb-title","IN THAT TIME"),this.inThatTime),this.root.append(t,i,n)}state_show(e,t){this.readout=e,this.damage_draw(e),this.systems_draw(e),this.since.replaceChildren();const i=t===null?[]:dz(t,e);i.length===0&&this.since.append(V("span","tb-head-label","—"),V("span","tb-head-value","NOTHING MOVED"));for(const n of i)this.since.append(V("span","tb-head-label",n.label),V("span",`tb-head-value ${n.bad?"tb-bad":"tb-good"}`,n.change));this.rest.range_set(Os("how-long",e),this.rest.value_get(),`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT`,4),this.inThatTime_note()}question_show(e){Md(this.pills,e);const t=e===null?null:Os(e.question,this.readout),i=e!==null&&(e.command===null||["rest","dock","undock"].includes(e.command.id))?e:null;bd(this.head,"helm",i,t),this.rest.lit_set(fi(e,["how-long"]),"REST")}damage_draw(e){this.damage.replaceChildren();for(const i of["DEVICE","","IN FLIGHT","DOCKED",""])this.damage.append(V("span","tb-dc-head",i));const t=Math.max(1,...e.damaged.map(i=>(i.repairAt??0)-e.mission.stardate));for(const i of e.devices){const n=Z0(i,e),r=V("div","tb-bar-track"),o=V("div",`tb-bar-fill${n===null?" tb-bar-ok":" tb-bar-down"}`);o.style.width=n===null?"100%":`${Math.max(4,Math.min(100,Math.round(100*((i.repairAt??0)-e.mission.stardate)/t)))}%`,r.append(o),this.damage.append(V("span",`tb-dc-name${n===null?"":" tb-bad"}`,i.name.toUpperCase()),r,V("span","tb-dc-time",n===null?"—":n.inFlight.toFixed(2)),V("span","tb-dc-time",n===null?"—":n.docked.toFixed(2)),V("span",`tb-dc-state${n===null?" tb-good":" tb-bad"}`,n===null?"OK":"DOWN"))}}systems_draw(e){const{ship:t}=e;this.systems.replaceChildren();const i=(l,c,h,d,u)=>{const p=V("div","tb-bar-track"),f=V("div",`tb-bar-fill${u?" tb-bar-down":" tb-bar-ok"}`);f.style.width=`${Math.max(0,Math.min(100,Math.round(100*c/Math.max(1,h))))}%`,p.append(f),this.systems.append(V("span","tb-dc-name",l),p,V("span","tb-dc-time tb-sys-value",d))};i("ENERGY",t.energy,t.energyMax,`${t.energy} / ${t.energyMax}`,t.energy<t.energyMax/4),i("SHIELDS",t.shield,t.shieldMax,`${t.shieldsUp?"UP":"DOWN"} · ${t.shield} / ${t.shieldMax}`,t.shield<t.shieldMax/4),i("LIFE SUPPORT",t.reserves,t.reservesMax,`RESERVES ${t.reserves.toFixed(1)} / ${t.reservesMax.toFixed(1)}`,t.reserves<t.reservesMax/4);const n=V("div","tb-pips");for(let l=0;l<t.torpedoesMax;l++)n.append(V("span",`tb-pip${l<t.torpedoes?" tb-pip-on":""}`));this.systems.append(V("span","tb-dc-name","TORPEDOES"),n,V("span","tb-dc-time tb-sys-value",`${t.torpedoes} / ${t.torpedoesMax}`));const r=(l,c)=>{this.systems.append(V("span","tb-dc-name",l),V("span","tb-sys-text",c))};r("CREW",`${t.crew}${e.mission.captives>0?` · ${e.mission.captives} CAPTIVE`:" · BRIG EMPTY"}`);const o=e.damaged.some(l=>/warp/i.test(l.name));r("WARP",`${t.warp.toFixed(1)} · ENGINES ${o?"DOWN":"OK"}`);const a=e.damaged.some(l=>/cloak/i.test(l.name));r("CLOAK",`${t.cloaked?"ON":"OFF"} · DEVICE ${a?"DOWN":"OK"}`)}inThatTime_note(){if(this.readout===null)return;const e=this.rest.value_get();this.inThatTime.replaceChildren();const t=this.readout.damaged.filter(n=>(Z0(n,this.readout)?.inFlight??1/0)<=e).map(n=>n.name.toUpperCase());this.inThatTime.append(V("span","tb-head-value tb-good",t.length===0?e>0?"NO REPAIR COMPLETES":"—":`${t.join(" · ")} REPAIRED`));const i=this.readout.klingons.length;i>0&&this.inThatTime.append(V("span","tb-head-value tb-bad",`${i} KLINGON${i===1?"":"S"} IN THE QUADRANT WILL FIRE · SPOCK MAY ASK TO CANCEL`))}}const iM=[{label:"CHART",line:"ch",asks:[]},{label:"TRAJECTORY",line:"t",asks:[]},{label:"COURSE",line:"c",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"MOVE",line:"m",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"SCORE",line:"s",asks:[]},{label:"PHASER EFFECT",line:"p",asks:["range"]},{label:"WARP COST",line:"w",asks:["computer-distance","computer-warp"]},{label:"IMPULSE COST",line:"i",asks:["computer-distance"]},{label:"DISTRESS LIST",line:"d",asks:[]}];class M3{constructor(e){this.host=e,this.root=V("div","tb-view-body tb-view-computer");const t=V("section","tb-panel tb-chart-section");t.append(V("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN"),V("span","tb-note","PRESS A QUADRANT: THE COURSE PANEL AIMS AT IT · HUNDREDS KLINGONS, TENS BASES, ONES STARS")),this.chart=V("div","tb-chart-big"),t.append(this.chart);const i=V("section","tb-station tb-station-computer");this.head=_d("COMPUTER",e);const n=V("div","tb-pills tb-command-pills");for(const d of iM){const u=Es("tb-command tb-request",d.label,()=>this.request_send(d));u.dataset.request=d.line,this.requestPills.push(u),n.append(u)}const r=V("div","tb-computer-panels"),o=V("div","tb-panel");o.append(V("span","tb-title","COURSE AND DISTANCE")),this.courseGrid=V("div","tb-head-grid");const a=V("div","tb-pills");a.append(Es("tb-commit tb-send-helm","SEND TO HELM",()=>this.helm_send()),Es("tb-commit tb-move-now","MOVE THERE NOW",()=>this.request_send(iM[3]))),o.append(this.courseGrid,a);const l=V("div","tb-panel");l.append(V("span","tb-title","WARP COST")),this.wcDistance=new gr("tbc-distance","DISTANCE",2,()=>{}),this.wcWarp=new gr("tbc-warp","WARP FACTOR",1,()=>{}),this.wcDistance.root.classList.add("tb-local"),this.wcWarp.root.classList.add("tb-local"),this.wcDistance.input_listen(()=>this.costs_note()),this.wcWarp.input_listen(()=>{this.warpTouched=!0,this.costs_note()}),this.wcResult=V("div","tb-head-grid"),l.append(this.wcDistance.root,this.wcWarp.root,this.wcResult);const c=V("div","tb-panel");c.append(V("span","tb-title","TRAJECTORY · KLINGONS HERE")),this.trajectory=V("div","tb-targets"),c.append(this.trajectory,V("span","tb-title","SCORE SO FAR")),this.score=V("div","tb-score"),c.append(this.score);const h=V("div","tb-panel tb-answer-panel");h.append(V("span","tb-title","THE COMPUTER ANSWERS")),this.answer=V("pre","tb-computer-answer","—"),h.append(this.answer),r.append(o,l,c,h),i.append(this.head.root,n,r),this.root.append(t,i)}host;root;head;chart;requestPills=[];courseGrid;wcDistance;wcWarp;wcResult;trajectory;score;answer;readout=null;target=null;open=null;warpTouched=!1;state_show(e){this.readout=e,this.target===null&&(this.target={quadrant:{...e.position.quadrant},sector:{...e.position.sector}}),this.chart_draw(e),this.wcWarp.range_set(Os("computer-warp",e),this.warpTouched?this.wcWarp.value_get():e.ship.warp,"THE SHIP'S NOW",4),this.wcDistance.range_set(Os("computer-distance",e),this.wcDistance.value_get(),"QUADRANTS · FILLED FROM THE COURSE",4),this.wcDistance.lit_set(!0,""),this.wcWarp.lit_set(!0,""),this.course_note(),this.trajectory_draw(e),this.score_draw(e)}question_show(e){this.open=e;const t=e===null?null:Os(e.question,this.readout);bd(this.head,"ship",e,t);const i=e?.question==="command"||e?.question==="request";for(const n of this.requestPills)n.disabled=!i}answer_take(e){if(e===null){this.answer.textContent="";return}this.answer.textContent=`${this.answer.textContent??""}${e}`.replace(/^\s*\n/,"")}sector_set(e){this.readout!==null&&(this.target={quadrant:this.target?.quadrant??{...this.readout.position.quadrant},sector:{x:e.x,y:e.y}},this.course_note())}request_send(e){const t=e.asks.map(n=>[n,this.plannedAnswer_of(n)]);if(this.open?.question==="request"){this.host.plan_set(t),this.answer_take(null),this.host.answer_send(e.line,ar(e.label,"computer")),this.host.voice.cue("thinking");return}const i=md.find(n=>n.id==="computer");if(i===void 0||this.open?.question!=="command"){this.host.voice.cue("deny");return}this.host.plan_set([["request",e.line],...t]),this.answer_take(null),this.host.voice.pill(ar(e.label,"computer")),this.host.command_send(i)}plannedAnswer_of(e){const t=this.target,i=this.readout?.klingons[0];switch(e){case"quadrant":return String(t?.quadrant.x??0);case"quadrant-y":return String(t?.quadrant.y??0);case"sector":return String(t?.sector.x??0);case"sector-y":return String(t?.sector.y??0);case"range":return(i===void 0?this.wcDistance.value_get():i.range/10).toFixed(2);case"computer-distance":return this.wcDistance.value_get().toFixed(2);case"computer-warp":return this.wcWarp.value_get().toFixed(1);default:return""}}helm_send(){if(this.readout===null||this.target===null)return;const e=X0(this.readout,this.target);this.host.voice.pill("SEND TO HELM"),this.host.course_set(e.course,Math.round(e.distance*10)/10)}chart_draw(e){this.chart.replaceChildren(),this.chart.append(V("span","tb-srs-corner",""));for(let t=0;t<(e.chart[0]?.length??0);t++)this.chart.append(V("span","tb-srs-axis",String(t)));for(const t of e.chart){this.chart.append(V("span","tb-srs-axis",String(t[0]?.x??"")));for(const i of t)this.chart.append(this.quadrantButton_make(i))}}quadrantButton_make(e){const t=this.target?.quadrant.x===e.x&&this.target.quadrant.y===e.y,i=Es(`tb-cq${e.here?" tb-here":""}${e.klingons>0?" tb-hostile":""}${e.bases>0?" tb-based":""}${e.code===null?" tb-unscanned":""}${t?" tb-pressed":""}`,"",()=>{this.readout!==null&&(this.target={quadrant:{x:e.x,y:e.y},sector:this.target?.sector??{...this.readout.position.sector}},this.host.voice.cue("scanner"),this.chart_draw(this.readout),this.course_note())});return i.dataset.x=String(e.x),i.dataset.y=String(e.y),i.append(Ip("tb-cq-code",e),V("span","tb-cq-at",`${e.x},${e.y}`)),i.title=Cp(e),i}course_note(){if(this.readout===null||this.target===null)return;const{position:e}=this.readout,t=X0(this.readout,this.target);this.courseGrid.replaceChildren(V("span","tb-head-label","FROM"),V("span","tb-head-value",`QUADRANT ${e.quadrant.x},${e.quadrant.y} · SECTOR ${e.sector.x},${e.sector.y}`),V("span","tb-head-label","TO"),V("span","tb-head-value",`QUADRANT ${this.target.quadrant.x},${this.target.quadrant.y} · SECTOR ${this.target.sector.x},${this.target.sector.y}`),V("span","tb-head-label","COURSE"),V("span","tb-head-value tb-course-value",`${t.course}°`),V("span","tb-head-label","DISTANCE"),V("span","tb-head-value tb-distance-value",t.distance.toFixed(2))),this.wcDistance.value_set(Math.round(t.distance*100)/100),this.costs_note()}costs_note(){if(this.readout===null)return;const e=this.wcDistance.value_get(),t=cz(e,this.wcWarp.value_get(),this.readout.param.warptime),i=i3(e);this.wcResult.replaceChildren(V("span","tb-head-label","TIME"),V("span","tb-head-value",`${t.stardates.toFixed(2)} STARDATES`),V("span","tb-head-label","ENERGY"),V("span","tb-head-value",`${t.units} UNITS · ${t.unitsShielded} WITH SHIELDS UP`),V("span","tb-head-label","AT IMPULSE"),V("span","tb-head-value",`${i.stardates.toFixed(2)} STARDATES · ${i.units} UNITS`))}trajectory_draw(e){if(this.trajectory.replaceChildren(),e.klingons.length===0){this.trajectory.append(V("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const t of["AT","COURSE","RANGE","PHASER HIT"])this.trajectory.append(V("span","tb-target-head",t));for(const t of e.klingons)this.trajectory.append(pz(t,()=>{this.host.voice.cue("scanner"),this.host.course_set(t.bearing,t.range/10)}),V("span","tb-target-cell",`${Math.round(t.bearing)}°`),V("span","tb-target-cell",t.range.toFixed(1)),V("span","tb-target-cell",`${hz(t.range/10)}%`))}score_draw(e){const t=lz(e);this.score.replaceChildren();for(const i of t.items.filter(n=>n.points!==0||/killed|remaining/.test(n.label)))this.score.append(V("span","tb-score-label",i.label.toUpperCase()),V("span",`tb-score-points${i.points<0?" tb-bad":" tb-good"}`,`${i.points>0?"+":""}${i.points}`));this.score.append(V("span","tb-score-label tb-score-total","TOTAL"),V("span","tb-score-points tb-score-total",String(t.total)))}}const v3=["bridge","helm","tactical","engineering","computer"],w3=400,y3="-0.6 -0.6 10.6 10.6",z3=.7,S3=/^S\.R\. scanners$/i,x3=/^L\.R\. scanners$/i,O3={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]},E3=["length","skill","request","quadrant","quadrant-y","sector","sector-y","range","computer-distance","computer-warp","status-report","another","yes-no","unknown"];class A3{constructor(e,t){this.hooks=e,this.harness=new a3({question_changed:d=>{this.partial_flush(),this.question_show(d)},text_written:d=>this.text_take(d),state_shown:d=>this.state_show(d),ended:()=>{this.leaving||this.hooks.voice.cue("gameover")}}),this.root=V("section","trek-bridge"),this.root.id="trek-bridge",this.root.dataset.view="bridge",this.root.setAttribute("aria-label","trek: the bridge");const i={},n=xL();n!==null&&this.root.append(n);const r=this.gutter_build(i,t),[o,a]=this.frame_build(),l=this.header_build(i),c=this.body_build(i);this.strip_build(i);const h=this.log_build(i);this.leaveAsk_build(i),this.root.append(r,o,l,a,c,i.ask,h,i.leaveAsk),this.parts=i,this.question_show(null)}hooks;root;harness;readout=null;previous=null;view="bridge";nextDistance=null;plan=new Map;answering=!1;computerRunning=!1;leaving=!1;tracker=new pl;heading=0;pressedSector=null;scanDue=!1;fold=null;frames=new h3;shown=null;torpedo=null;trackPrinting=!1;partial="";lrsBloom=null;parts;stationHost_get(){return{answer_send:(e,t)=>this.answer_send(e,t),command_send:e=>this.command_send(e),plan_set:e=>{for(const[t,i]of e)this.plan.set(t,i)},course_set:(e,t)=>this.course_set(e,t),voice:this.hooks.voice}}gutter_build(e,t){const i=V("aside","tb-gutter"),n=V("div","tb-block");n.append(V("span","tb-block-name","TREK"),V("span","tb-block-sub","ARGUS · BSD TREK")),e.seed=V("div","tb-seed",t===null?"RANDOM GALAXY":`SEED ${t}`);const r=V("nav","tb-views");r.setAttribute("aria-label","views"),e.views=new Map;for(const c of v3){const h=Es(`tb-view tb-view-${c}`,c.toUpperCase(),()=>this.view_set(c));h.classList.remove("tb-pill"),h.dataset.view=c,e.views.set(c,h),r.append(h)}const o=Es("tb-leave","LEAVE BRIDGE",()=>this.leave_ask());o.classList.remove("tb-pill");const a=V("div","tb-gutter-top");a.append(n,e.seed,V("div","tb-gutter-fill"));const l=V("div","tb-gutter-body");return l.append(V("div","tb-gutter-cap"),r,V("div","tb-gutter-fill"),o),i.append(a,l),i}frame_build(){const e=V("div","tb-bar tb-bar-top");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c","tb-bar-d"])e.append(V("span",i));const t=V("div","tb-bar tb-bar-body");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c"])t.append(V("span",i));return[e,t]}header_build(e){const t=V("header","tb-header"),i=V("section","tb-head-condition"),n=V("div","tb-condition");n.append(V("span","tb-condition-label","CONDITION")),e.condition=V("span","tb-condition-name","—"),n.append(e.condition),e.conditionWhy=V("div","tb-condition-why",""),i.append(n,e.conditionWhy);const r=p=>{const f=V("section","tb-head-section");f.append(V("span","tb-head-title",p));const _=V("div","tb-head-grid");return f.append(_),[f,_]},[o,a]=r("SHIP"),[l,c]=r("MISSION"),[h,d]=r("POSITION"),u=V("div","tb-head-grid tb-head-since");return l.append(V("span","tb-head-title","SINCE LAST COMMAND"),u),e.ship=a,e.mission=c,e.position=d,e.since=u,t.append(i,o,l,h),t}body_build(e){const t=this.stationHost_get(),i=V("main","tb-body");i.dataset.view="bridge",e.body=i;const n=V("section","tb-scans");n.append(V("span","tb-title","LONG RANGE")),e.lrs=V("div","tb-lrs"),n.append(e.lrs,V("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN")),e.chart=V("div","tb-chart"),n.append(e.chart);const r=V("section","tb-srs-section");e.srsTitle=V("span","tb-title","SHORT RANGE"),r.append(e.srsTitle),e.scan=at("svg",{class:"tb-scan",viewBox:y3,role:"grid","aria-label":"short range scan"}),e.scan.addEventListener("keydown",l=>this.scan_key(l)),e.legend=this.legend_build(),r.append(e.scan,V("span","tb-note","PRESS A SECTOR: ITS COURSE AND DISTANCE FILL IN"),e.legend),e.shipPills=new Map;const o=V("div","tb-pills tb-ship-pills");o.append(V("span","tb-slider-label","SHIP"));for(const l of md.filter(c=>c.station==="ship")){const c=Mg(l,t);e.shipPills.set(l.id,c),o.append(c)}r.append(o);const a=V("section","tb-stations");return e.helm=new tM(t,150,"tb"),e.tactical=new sM(t,150,"tb"),a.append(e.helm.root,e.tactical.root),e.helmView=new tM(t,260,"tbh"),e.helmView.root.classList.add("tb-view-body","tb-view-helm"),e.tacticalView=new sM(t,260,"tbt"),e.tacticalView.root.classList.add("tb-view-body","tb-view-tactical"),e.engineeringView=new b3(t),e.computerView=new M3(t),i.append(n,r,a,e.helmView.root,e.tacticalView.root,e.engineeringView.root,e.computerView.root),i}legend_build(){const e=V("div","tb-legend");for(const t of OL){const i=V("span",`tb-legend-item tb-legend-${t.kind}`),n=t.kind==="klingon"?rr:[null];for(const r of n)i.append(bg(t.kind,r));i.append(V("span","tb-legend-glyph",Ac[t.kind].trim()===""?"␠":Ac[t.kind]),V("span","tb-legend-name",t.name)),e.append(i)}return e}strip_build(e){e.ask=V("div","tb-ask"),e.ask.hidden=!0,e.ask.setAttribute("role","dialog"),e.askText=V("span","tb-ask-text",""),e.askPills=V("div","tb-pills"),e.askInput=document.createElement("input"),e.askInput.type="text",e.askInput.className="tb-ask-input",e.askInput.setAttribute("aria-label","the answer");const t=e.askInput;e.askSend=Es("tb-commit","ANSWER",()=>this.answer_send(t.value,"ANSWER")),t.addEventListener("keydown",i=>{i.key==="Enter"&&this.answer_send(t.value,"ANSWER")}),e.ask.append(V("span","tb-ask-label","THE GAME ASKS"),e.askText,e.askPills,e.askInput,e.askSend)}log_build(e){const t=V("footer","tb-log-section"),i=V("div","tb-log-head");return i.append(V("span","tb-title","SHIP'S LOG"),V("span","tb-note","READ ONLY")),e.log=V("div","tb-log"),e.log.setAttribute("aria-live","polite"),t.append(i,e.log),t}leaveAsk_build(e){e.leaveAsk=V("div","tb-leave-ask"),e.leaveAsk.hidden=!0,e.leaveAsk.setAttribute("role","dialog");const t=e.leaveAsk,i=Es("tb-grave","LEAVE · THE GAME ENDS",()=>{this.leaving=!0,this.hooks.voice.cue("close"),this.hooks.leave()}),n=Es("","STAY",()=>{t.hidden=!0});e.leaveAsk.append(V("span","tb-ask-label","LEAVE THE BRIDGE?"),V("span","tb-ask-text","The game ends where it stands; dump first to keep it."),i,n)}harness_get(){return this.harness}leave_ask(){this.frames.skip(),this.parts.leaveAsk.hidden&&this.hooks.voice.pill("LEAVE BRIDGE"),this.parts.leaveAsk.hidden=!1}frames_get(){return{played:{...this.frames.played},pending:this.frames.pending_count(),busy:this.frames.busy_is()}}frames_settle(){return this.frames.settle()}leaveAsk_isOpen(){return!this.parts.leaveAsk.hidden}leaveAsk_close(){this.parts.leaveAsk.hidden=!0}view_get(){return this.view}view_set(e){this.frames.skip(),this.view=e,this.root.dataset.view=e,this.parts.body.dataset.view=e;for(const[t,i]of this.parts.views)i.classList.toggle("tb-view-on",t===e);this.hooks.voice.pill(ar(e.toUpperCase(),"view"))}readout_get(){return this.readout}command_send(e){if(this.frames.skip(),!this.harness.command_send(e))return this.hooks.voice.cue("deny"),!1;const t=BL(e.id);return t===null?this.hooks.voice.pill(ar(e.label,"command")):this.hooks.voice.cue(t),this.nextDistance=null,this.computerRunning=e.id==="computer",this.computerRunning&&this.parts.computerView.answer_take(null),this.log_write(`Command: ${e.line}
|
|
4298
4298
|
`,!0),!0}answer_send(e,t){const i=this.harness.question_get();if(!this.harness.answer(e)){this.hooks.voice.cue("deny");return}const n=i===null?null:NL(i.question,i.command?.id??null);n!==null?this.hooks.voice.cue(n):t!==null&&this.hooks.voice.pill(t);const r=i===null?"":i.prompt.trim();this.log_write(`${r===""?"":`${r} `}${e}
|
|
4299
|
-
`,!0),i?.question==="course"&&Number.isFinite(Number(e))&&(this.heading=(Number(e)%360+360)%360,this.shown!==null&&this.srs_draw(this.shown))}course_set(e,t){const{parts:i}=this;for(const n of[i.helm,i.helmView,i.tactical,i.tacticalView])n.wheel.degrees_set(e);t!==null&&(i.helm.distance.value_set(t),i.helmView.distance.value_set(t),this.nextDistance=t)}state_show(e){this.previous=this.readout;const t=e3(e);this.readout=t;const{parts:i}=this,n=this.previous===null||this.previous.position.quadrant.x!==t.position.quadrant.x||this.previous.position.quadrant.y!==t.position.quadrant.y;this.tracker.reconcile(t.klingons,{reset:n,byOrder:!this.device_isOk(t,S3)});for(const r of t.klingons)r.mark=this.tracker.mark_of(r);n&&(this.pressedSector=null),n&&this.device_isOk(t,x3)&&(this.scanDue=!0),i.condition.textContent=t.condition.name,i.condition.parentElement?.setAttribute("data-condition",t.condition.name.toLowerCase()),i.conditionWhy.textContent=t.condition.why.toUpperCase(),this.header_draw(t);for(const r of[i.helm,i.helmView,i.tactical,i.tacticalView,i.computerView])r.state_show(t);i.engineeringView.state_show(t,this.previous),this.partial_flush(),this.frames.push(this.stateFrame_make(t,this.previous)),this.question_show(this.harness.question_get())}stateFrame_make(e,t){return{kind:"state",run:async i=>{const n=this.parts.scan;await this.torpedo_end(!0);const r=this.shown,o=r!==null&&(r.position.quadrant.x!==e.position.quadrant.x||r.position.quadrant.y!==e.position.quadrant.y),a=r!==null&&(o||r.position.sector.x!==e.position.sector.x||r.position.sector.y!==e.position.sector.y);if(a&&r!==null){const c={x:r.position.quadrant.x*10+r.position.sector.x,y:r.position.quadrant.y*10+r.position.sector.y},h={x:e.position.quadrant.x*10+e.position.sector.x,y:e.position.quadrant.y*10+e.position.sector.y};this.heading=Math.round(uz(c,h))}const l={kind:"ship",variant:null};if(a&&!i&&r!==null&&!o)this.srs_draw(r,!1),await ja(n,this.frames,l,r.position.sector,e.position.sector,{heading:this.heading});else if(a&&!i&&r!==null&&o){const{exit:c,entry:h}=f3(r.position,e.position);this.srs_draw(r,!1),await ja(n,this.frames,l,r.position.sector,c,{heading:this.heading}),eM(n,!0),this.shown=nM(e),this.srs_draw(this.shown,!1),this.lrs_draw(this.shown,!0),this.chart_draw(this.shown),await this.frames.wait(Rn.rescan),eM(n,!1),await ja(n,this.frames,l,h,e.position.sector,{heading:this.heading})}this.shown=nM(e),this.srs_draw(this.shown),this.lrs_draw(this.shown,o&&i),this.chart_draw(this.shown);for(const c of kL(t,e))this.hooks.voice.cue(c);this.standingOrder_try()}}}header_draw(e){const{parts:t}=this,i=(o,a)=>{o.replaceChildren();for(const[l,c,h]of a)o.append(V("span","tb-head-label",l),V("span",`tb-head-value${h===void 0?"":` ${h}`}`,c))},n=(o,a)=>`${Math.max(0,Math.min(100,Math.round(100*o/Math.max(1,a))))}`;i(t.ship,[["ENERGY",`${e.ship.energy} / ${e.ship.energyMax}`],["SHIELDS",`${e.ship.shieldsUp?"UP":"DOWN"} · ${e.ship.shield} (${n(e.ship.shield,e.ship.shieldMax)}%)`],["TORPEDOES",`${e.ship.torpedoes} / ${e.ship.torpedoesMax}`],["WARP",`${e.ship.warp.toFixed(1)}${e.ship.cloaked?" · CLOAKED":""}`]]),i(t.mission,[["STARDATE",e.mission.stardate.toFixed(2)],["TIME LEFT",e.mission.timeLeft.toFixed(2)],["KLINGONS",`${e.mission.klingonsLeft} LEFT · ${e.mission.killed} KILLED${e.mission.captives>0?` · ${e.mission.captives} CAPTIVE`:""}`],["STARBASES",e.nearestBase===null?`${e.mission.starbases}`:`${e.mission.starbases} · NEAREST ${e.nearestBase.at.x},${e.nearestBase.at.y}${e.nearestBase.here?" HERE":""}`]]),i(t.position,[["QUADRANT",`${e.position.quadrant.x},${e.position.quadrant.y}`],["SECTOR",`${e.position.sector.x},${e.position.sector.y}`],["CREW",`${e.ship.crew}`],["LIFE SUPPORT",`${e.ship.reserves.toFixed(1)} / ${e.ship.reservesMax.toFixed(1)}`],["SCORE",`${lz(e).total}`]]);const r=this.previous===null?[]:dz(this.previous,e);i(t.since,r.length===0?[["—","NOTHING MOVED"]]:r.map(o=>[o.label,o.change,o.bad?"tb-bad":"tb-good"]))}srs_draw(e,t=!0){const{parts:i}=this;i.srsTitle.textContent=`SHORT RANGE · QUADRANT ${e.position.quadrant.x},${e.position.quadrant.y}`;const n=i.scan,r=[...n.querySelectorAll(":scope > .tb-motion")];n.replaceChildren();const o=e.sectors[0]?.length??0;for(let c=0;c<o;c++)n.append(this.axis_make(String(c),c+.5,-.3));for(const c of e.sectors)n.append(this.axis_make(String(c[0]?.x??""),-.3,(c[0]?.x??0)+.5));const a=e.position.sector,l=this.pressedSector??a;for(const c of e.sectors)for(const h of c)n.append(this.sector_make(h,e,a,l,t));if(t){const c=TL(e.ship.shield,e.ship.shieldMax,e.ship.shieldsUp,e.condition.name==="DOCKED"),h=at("circle",{class:c.className,cx:a.y+.5,cy:a.x+.5,r:.46,"stroke-width":c.width});h.dataset.percent=String(Math.round(c.percent)),n.append(h)}n.append(...r)}axis_make(e,t,i){const n=at("text",{class:"tb-scan-axis",x:t,y:i});return n.textContent=e,n}sector_make(e,t,i,n,r=!0){const o=Qc(i,e),a=Wh(i,e),l=this.pressedSector?.x===e.x&&this.pressedSector.y===e.y,c=at("g",{class:`tb-sector tb-sector-${e.kind}${l?" tb-pressed":""}`,role:"button",tabindex:n.x===e.x&&n.y===e.y?0:-1});c.dataset.x=String(e.x),c.dataset.y=String(e.y);const h=at("title",{}),d=e.kind==="empty"?"·":Ac[e.kind];if(h.textContent=e.kind==="ship"?`the ship · ${e.x},${e.y}`:`${e.x},${e.y} ${d.trim()===""?"black hole":d} · course ${Math.round(o)}° · ${(a/10).toFixed(1)}`,c.append(h,at("rect",{class:"tb-cell",x:e.y+.04,y:e.x+.04,width:.92,height:.92,rx:.16})),e.kind==="empty"||e.kind==="ship"&&!r)c.append(at("circle",{class:"tb-cell-dot",cx:e.y+.5,cy:e.x+.5,r:.03}));else{const p=e.kind,f=p==="klingon"?t.klingons.find(m=>m.x===e.x&&m.y===e.y):void 0,_=p==="ship"?this.heading:p==="klingon"?Qc(e,i):0,g=_g(p,{cx:e.y+.5,cy:e.x+.5,size:z3},f?.mark??null,_);p==="star"&&g.style.setProperty("--tb-breathe",`-${(e.x*7+e.y*3)%11*.33}s`),c.append(g)}const u=()=>this.sector_press(e,o,a);return c.addEventListener("click",u),c.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())}),c}scan_key(e){const t=O3[e.key],i=e.target?.closest(".tb-sector")??null;if(t===void 0||i===null)return;const n=Number(i.dataset.x)+t[0],r=Number(i.dataset.y)+t[1],o=this.parts.scan.querySelector(`.tb-sector[data-x="${n}"][data-y="${r}"]`);o!==null&&(e.preventDefault(),i.setAttribute("tabindex","-1"),o.setAttribute("tabindex","0"),o.focus())}sector_press(e,t,i){this.hooks.voice.cue("scanner"),this.course_set(t,Math.round(i)/10),this.parts.computerView.sector_set(e),this.pressedSector={x:e.x,y:e.y};for(const n of this.parts.scan.querySelectorAll(".tb-sector")){const r=n.dataset.x===String(e.x)&&n.dataset.y===String(e.y);n.classList.toggle("tb-pressed",r),n.setAttribute("tabindex",r?"0":"-1")}}device_isOk(e,t){const i=e.devices.find(n=>t.test(n.name));return i===void 0||i.repairAt===null}lrs_draw(e,t=!1){const{parts:i}=this;i.lrs.replaceChildren();const{quadrant:n}=e.position,r=this.lrsBloom;this.lrsBloom=null;for(let o=-1;o<=1;o++)for(let a=-1;a<=1;a++){const l=e.chart[n.x+o]?.[n.y+a];if(l===void 0){const h=V("div","tb-lrs-cell tb-lrs-edge");h.append(V("span","tb-lrs-code","—"),V("span","tb-lrs-at","EDGE")),h.title="outside the galaxy",i.lrs.append(h);continue}const c=V("div",`tb-lrs-cell${l.here?" tb-here":""}${l.klingons>0?" tb-hostile":""}${l.code===null?" tb-unscanned":""}${l.supernova?" tb-supernova":""}`);c.append(Ip("tb-lrs-code",l),V("span","tb-lrs-at",`${l.x},${l.y}`)),c.title=Cp(l),c.dataset.x=String(l.x),c.dataset.y=String(l.y),i.lrs.append(c),(t&&l.here||r!==null&&r.at.x===l.x&&r.at.y===l.y)&&_3(c,r!==null&&!l.here&&r.hostile)}}chart_draw(e){const{parts:t}=this;t.chart.replaceChildren();for(const i of e.chart)for(const n of i){const r=Ip(`tb-quadrant${n.here?" tb-here":""}${n.klingons>0?" tb-hostile":""}${n.bases>0?" tb-based":""}${n.code===null?" tb-unscanned":""}${n.supernova?" tb-supernova":""}`,n);r.title=Cp(n),t.chart.append(r)}}question_show(e){const{parts:t}=this;if(e?.question==="command"&&(this.plan.clear(),this.computerRunning=!1,this.fold_close(),this.standingOrder_try()))return;const i=e===null?void 0:this.plan.get(e.question);if(i!==void 0&&e!==null&&!this.answering){this.plan.delete(e.question),this.answering=!0;try{this.answer_send(i,null)}finally{this.answering=!1}return}Md(t.shipPills,e);for(const n of[t.helm,t.helmView,t.tactical,t.tacticalView,t.engineeringView,t.computerView])n.question_show(e);e?.question==="distance"&&this.nextDistance!==null&&(t.helm.distance.value_set(this.nextDistance),t.helmView.distance.value_set(this.nextDistance)),this.strip_show(e)}strip_show(e){const{parts:t}=this,i=e?.question??null,n=i===null?null:Os(i,this.readout),r=n!==null&&i!==null&&i!=="command"&&(n.kind==="yesno"||n.kind==="text"||E3.includes(i));if(t.ask.hidden=!r,!r||n===null||e===null)return;t.askText.textContent=e.prompt.replace(/[:\s]+$/,"").trim(),t.askPills.replaceChildren();for(const a of n.choices??[])t.askPills.append(Es("tb-choice",a.label,()=>this.answer_send(a.line,a.label)));const o=n.kind==="text"||n.kind==="slider";t.askInput.hidden=!o,t.askSend.hidden=!o,o&&(t.askInput.value="",t.askInput.focus())}standingOrder_try(){if(!this.scanDue||this.answering||this.harness.question_get()?.question!=="command")return!1;this.scanDue=!1;const e=this.readout?.position.quadrant;return this.fold_open(`LONG RANGE SCAN · STANDING ORDER${e===void 0?"":` · QUADRANT ${e.x},${e.y}`}`),this.harness.answer("l")?(this.log_write(`Command: l
|
|
4299
|
+
`,!0),i?.question==="course"&&Number.isFinite(Number(e))&&(this.heading=(Number(e)%360+360)%360,this.shown!==null&&this.srs_draw(this.shown))}course_set(e,t){const{parts:i}=this;for(const n of[i.helm,i.helmView,i.tactical,i.tacticalView])n.wheel.degrees_set(e);t!==null&&(i.helm.distance.value_set(t),i.helmView.distance.value_set(t),this.nextDistance=t)}state_show(e){this.previous=this.readout;const t=e3(e);this.readout=t;const{parts:i}=this,n=this.previous===null||this.previous.position.quadrant.x!==t.position.quadrant.x||this.previous.position.quadrant.y!==t.position.quadrant.y;this.tracker.reconcile(t.klingons,{reset:n,byOrder:!this.device_isOk(t,S3)});for(const r of t.klingons)r.mark=this.tracker.mark_of(r);n&&(this.pressedSector=null),n&&this.device_isOk(t,x3)&&(this.scanDue=!0),i.condition.textContent=t.condition.name,i.condition.parentElement?.setAttribute("data-condition",t.condition.name.toLowerCase()),i.conditionWhy.textContent=t.condition.why.toUpperCase(),this.header_draw(t);for(const r of[i.helm,i.helmView,i.tactical,i.tacticalView,i.computerView])r.state_show(t);i.engineeringView.state_show(t,this.previous),this.partial_flush(),this.frames.push(this.stateFrame_make(t,this.previous)),this.question_show(this.harness.question_get())}stateFrame_make(e,t){return{kind:"state",run:async i=>{const n=this.parts.scan;await this.torpedo_end(!0);const r=this.shown,o=r!==null&&(r.position.quadrant.x!==e.position.quadrant.x||r.position.quadrant.y!==e.position.quadrant.y),a=r!==null&&(o||r.position.sector.x!==e.position.sector.x||r.position.sector.y!==e.position.sector.y);if(a&&r!==null){const c={x:r.position.quadrant.x*10+r.position.sector.x,y:r.position.quadrant.y*10+r.position.sector.y},h={x:e.position.quadrant.x*10+e.position.sector.x,y:e.position.quadrant.y*10+e.position.sector.y};this.heading=Math.round(uz(c,h))}const l={kind:"ship",variant:null};if(a&&!i&&r!==null&&!o)this.srs_draw(r,!1),await ja(n,this.frames,l,r.position.sector,e.position.sector,{heading:this.heading});else if(a&&!i&&r!==null&&o){const{exit:c,entry:h}=f3(r.position,e.position);this.srs_draw(r,!1),await ja(n,this.frames,l,r.position.sector,c,{heading:this.heading}),eM(n,!0),this.shown=nM(e),this.srs_draw(this.shown,!1),this.lrs_draw(this.shown,!0),this.chart_draw(this.shown),await this.frames.wait(Rn.rescan),eM(n,!1),await ja(n,this.frames,l,h,e.position.sector,{heading:this.heading})}this.shown=nM(e),this.srs_draw(this.shown),this.lrs_draw(this.shown,o&&i),this.chart_draw(this.shown);for(const c of kL(t,e))this.hooks.voice.cue(c);this.standingOrder_try()}}}header_draw(e){const{parts:t}=this,i=(o,a)=>{o.replaceChildren();for(const[l,c,h]of a)o.append(V("span","tb-head-label",l),V("span",`tb-head-value${h===void 0?"":` ${h}`}`,c))},n=(o,a)=>`${Math.max(0,Math.min(100,Math.round(100*o/Math.max(1,a))))}`;i(t.ship,[["ENERGY",`${e.ship.energy} / ${e.ship.energyMax}`],["SHIELDS",`${e.ship.shieldsUp?"UP":"DOWN"} · ${e.ship.shield} (${n(e.ship.shield,e.ship.shieldMax)}%)`],["TORPEDOES",`${e.ship.torpedoes} / ${e.ship.torpedoesMax}`],["WARP",`${e.ship.warp.toFixed(1)}${e.ship.cloaked?" · CLOAKED":""}`]]),i(t.mission,[["STARDATE",e.mission.stardate.toFixed(2)],["TIME LEFT",e.mission.timeLeft.toFixed(2)],["KLINGONS",`${e.mission.klingonsLeft} LEFT · ${e.mission.killed} KILLED${e.mission.captives>0?` · ${e.mission.captives} CAPTIVE`:""}`],["STARBASES",e.nearestBase===null?`${e.mission.starbases}`:`${e.mission.starbases} · NEAREST ${e.nearestBase.at.x},${e.nearestBase.at.y}${e.nearestBase.here?" HERE":""}`]]),i(t.position,[["QUADRANT",`${e.position.quadrant.x},${e.position.quadrant.y}`],["SECTOR",`${e.position.sector.x},${e.position.sector.y}`],["CREW",`${e.ship.crew}`],["LIFE SUPPORT",`${e.ship.reserves.toFixed(1)} / ${e.ship.reservesMax.toFixed(1)}`],["SCORE",`${lz(e).total}`]]);const r=this.previous===null?[]:dz(this.previous,e);i(t.since,r.length===0?[["—","NOTHING MOVED"]]:r.map(o=>[o.label,o.change,o.bad?"tb-bad":"tb-good"]))}srs_draw(e,t=!0){const{parts:i}=this;i.srsTitle.textContent=`SHORT RANGE · QUADRANT ${e.position.quadrant.x},${e.position.quadrant.y}`;const n=i.scan,r=[...n.querySelectorAll(":scope > .tb-motion")];n.replaceChildren();const o=e.sectors[0]?.length??0;for(let c=0;c<o;c++)n.append(this.axis_make(String(c),c+.5,-.3));for(const c of e.sectors)n.append(this.axis_make(String(c[0]?.x??""),-.3,(c[0]?.x??0)+.5));const a=e.position.sector,l=this.pressedSector??a;for(const c of e.sectors)for(const h of c)n.append(this.sector_make(h,e,a,l,t));if(t){const c=TL(e.ship.shield,e.ship.shieldMax,e.ship.shieldsUp,e.condition.name==="DOCKED"),h=at("circle",{class:c.className,cx:a.y+.5,cy:a.x+.5,r:.46,"stroke-width":c.width});h.dataset.percent=String(Math.round(c.percent)),n.append(h)}n.append(...r)}axis_make(e,t,i){const n=at("text",{class:"tb-scan-axis",x:t,y:i});return n.textContent=e,n}sector_make(e,t,i,n,r=!0){const o=Qc(i,e),a=Wh(i,e),l=this.pressedSector?.x===e.x&&this.pressedSector.y===e.y,c=at("g",{class:`tb-sector tb-sector-${e.kind}${l?" tb-pressed":""}`,role:"button",tabindex:n.x===e.x&&n.y===e.y?0:-1});c.dataset.x=String(e.x),c.dataset.y=String(e.y);const h=at("title",{}),d=e.kind==="empty"?"·":Ac[e.kind];if(h.textContent=e.kind==="ship"?`the ship · ${e.x},${e.y}`:`${e.x},${e.y} ${d.trim()===""?"black hole":d} · course ${Math.round(o)}° · ${(a/10).toFixed(1)}`,c.append(h,at("rect",{class:"tb-cell",x:e.y+.04,y:e.x+.04,width:.92,height:.92,rx:.16})),e.kind==="empty"||e.kind==="ship"&&!r)c.append(at("circle",{class:"tb-cell-dot",cx:e.y+.5,cy:e.x+.5,r:.03}));else{const p=e.kind,f=p==="klingon"?t.klingons.find(m=>m.x===e.x&&m.y===e.y):void 0,_=p==="ship"?this.heading:p==="klingon"?Qc(e,i):0,g=_g(p,{cx:e.y+.5,cy:e.x+.5,size:z3},f?.mark??null,_);p==="star"&&g.style.setProperty("--tb-breathe",`-${(e.x*7+e.y*3)%11*.33}s`),c.append(g)}const u=()=>this.sector_press(e,o,a);return c.addEventListener("click",u),c.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())}),c}scan_key(e){const t=O3[e.key],i=e.target?.closest(".tb-sector")??null;if(t===void 0||i===null)return;const n=Number(i.dataset.x)+t[0],r=Number(i.dataset.y)+t[1],o=this.parts.scan.querySelector(`.tb-sector[data-x="${n}"][data-y="${r}"]`);o!==null&&(e.preventDefault(),i.setAttribute("tabindex","-1"),o.setAttribute("tabindex","0"),o.focus())}sector_press(e,t,i){this.hooks.voice.cue("scanner"),this.course_set(t,Math.round(i)/10),this.parts.computerView.sector_set(e),this.pressedSector={x:e.x,y:e.y};for(const n of this.parts.scan.querySelectorAll(".tb-sector")){const r=n.dataset.x===String(e.x)&&n.dataset.y===String(e.y);n.classList.toggle("tb-pressed",r),n.setAttribute("tabindex",r?"0":"-1")}}device_isOk(e,t){const i=e.devices.find(n=>t.test(n.name));return i===void 0||i.repairAt===null}lrs_draw(e,t=!1){const{parts:i}=this;i.lrs.replaceChildren();const{quadrant:n}=e.position,r=this.lrsBloom;this.lrsBloom=null;for(let o=-1;o<=1;o++)for(let a=-1;a<=1;a++){const l=e.chart[n.x+o]?.[n.y+a];if(l===void 0){const h=V("div","tb-lrs-cell tb-lrs-edge");h.append(V("span","tb-lrs-code","—"),V("span","tb-lrs-at","EDGE")),h.title="outside the galaxy",i.lrs.append(h);continue}const c=V("div",`tb-lrs-cell${l.here?" tb-here":""}${l.klingons>0?" tb-hostile":""}${l.code===null?" tb-unscanned":""}${l.supernova?" tb-supernova":""}`);c.append(Ip("tb-lrs-code",l),V("span","tb-lrs-at",`${l.x},${l.y}`)),c.title=Cp(l),c.dataset.x=String(l.x),c.dataset.y=String(l.y),i.lrs.append(c),(t&&l.here||r!==null&&r.at.x===l.x&&r.at.y===l.y)&&_3(c,r!==null&&!l.here&&r.hostile)}}chart_draw(e){const{parts:t}=this;t.chart.replaceChildren();for(const i of e.chart)for(const n of i){const r=Ip(`tb-quadrant${n.here?" tb-here":""}${n.klingons>0?" tb-hostile":""}${n.bases>0?" tb-based":""}${n.code===null?" tb-unscanned":""}${n.supernova?" tb-supernova":""}`,n);r.title=Cp(n),t.chart.append(r)}}question_show(e){const{parts:t}=this;if(e?.question==="command"&&(this.plan.clear(),this.computerRunning=!1,this.fold_close(),this.standingOrder_try()))return;const i=e===null?void 0:this.plan.get(e.question);if(i!==void 0&&e!==null&&!this.answering){this.plan.delete(e.question),this.answering=!0;try{this.answer_send(i,null)}finally{this.answering=!1}return}Md(t.shipPills,e);for(const n of[t.helm,t.helmView,t.tactical,t.tacticalView,t.engineeringView,t.computerView])n.question_show(e);e?.question==="distance"&&this.nextDistance!==null&&(t.helm.distance.value_set(this.nextDistance),t.helmView.distance.value_set(this.nextDistance)),this.strip_show(e),this.lit_reveal()}lit_reveal(){const e=[...this.parts.body.querySelectorAll(".tb-lit")].find(t=>t.getClientRects().length>0);e!==void 0&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}strip_show(e){const{parts:t}=this,i=e?.question??null,n=i===null?null:Os(i,this.readout),r=n!==null&&i!==null&&i!=="command"&&(n.kind==="yesno"||n.kind==="text"||E3.includes(i));if(t.ask.hidden=!r,!r||n===null||e===null)return;t.askText.textContent=e.prompt.replace(/[:\s]+$/,"").trim(),t.askPills.replaceChildren();for(const a of n.choices??[])t.askPills.append(Es("tb-choice",a.label,()=>this.answer_send(a.line,a.label)));const o=n.kind==="text"||n.kind==="slider";t.askInput.hidden=!o,t.askSend.hidden=!o,o&&(t.askInput.value="",t.askInput.focus())}standingOrder_try(){if(!this.scanDue||this.answering||this.harness.question_get()?.question!=="command")return!1;this.scanDue=!1;const e=this.readout?.position.quadrant;return this.fold_open(`LONG RANGE SCAN · STANDING ORDER${e===void 0?"":` · QUADRANT ${e.x},${e.y}`}`),this.harness.answer("l")?(this.log_write(`Command: l
|
|
4300
4300
|
`,!0),!0):(this.fold_close(),!1)}fold_open(e){this.frames.push({kind:"fold",run:()=>{const t=V("details","tb-log-fold");t.append(V("summary","tb-log-fold-head",e)),this.parts.log.append(t),this.fold=t}})}fold_close(){this.frames.push({kind:"fold",run:()=>{this.fold=null}})}text_take(e){const t=e.replace(/\x1b\[[0-9;]*m/g,"").replace(/\x07/g,"");this.computerRunning&&this.parts.computerView.answer_take(t);const i=(this.partial+t).split(`
|
|
4301
4301
|
`);this.partial=i.pop()??"";for(const n of i)this.line_take(n,!1)}partial_flush(){if(this.partial==="")return;const e=this.partial;this.partial="",this.line_take(e,!1)}log_write(e,t=!0){for(const i of e.replace(/\n$/,"").split(`
|
|
4302
4302
|
`))this.line_take(i,t)}line_take(e,t){const i=t?null:c3(e),n=i?.kind==="torpedo-point";t||this.tracker.line_hear(e),i?.kind==="torpedo-head"?this.trackPrinting=!0:n||(this.trackPrinting=!1);const r=n&&!this.trackPrinting?null:i;this.frames.push({kind:r===null?"line":r.kind,run:async o=>{if(this.log_append(e,t),!t){for(const a of RL(e))this.hooks.voice.cue(a);r!==null&&await this.event_play(r,o)}}})}log_append(e,t=!1){const{parts:i}=this;for((this.fold??i.log).append(V("div",t?"tb-log-line tb-log-own":"tb-log-line",e));i.log.childElementCount>w3;)i.log.firstElementChild?.remove();i.log.scrollTop=i.log.scrollHeight}async event_play(e,t){const i=this.shown,n=this.parts.scan;if(i!==null)switch(e.kind!=="torpedo-point"&&e.kind!=="torpedo-head"&&await this.torpedo_end(t),e.kind){case"torpedo-head":await this.torpedo_end(!0),this.torpedo=new g3(n,i.position.sector);return;case"torpedo-point":this.torpedo!==null&&await this.torpedo.point_reach(this.frames,e.at,t);return;case"torpedo-end":return;case"kill":await Tc(n,this.frames,e.at,"kill",t),this.shown_clear(e.at);return;case"nova":this.hooks.voice.cue("nova"),await Tc(n,this.frames,e.at,"nova",t),this.shown_clear(e.at);return;case"misfire":this.hooks.voice.cue("deny"),await Tc(n,this.frames,i.position.sector,"misfire",t);return;case"phaser":await Q0(n,this.frames,i.position.sector,e.at,!1,t);return;case"incoming":{this.hooks.voice.cue("shield");const r=m3(n,this.frames,t);e.from!==null&&await Q0(n,this.frames,e.from,i.position.sector,!0,t);const o=Math.trunc(e.hit*e.absorb/100);i.ship.shield=Math.max(0,i.ship.shield-o),this.srs_draw(i),await r;return}case"klingon-move":{this.hooks.voice.cue("klingon-pass");const r=this.tracker.mark_of(e.to)??this.tracker.mark_of(e.from);this.shown_clear(e.from),this.srs_draw(i),await ja(n,this.frames,{kind:"klingon",variant:r},e.from,e.to,{hostile:!0},t),this.shown_put(e.to,"klingon",r);return}case"klingon-escape":{this.hooks.voice.cue("klingon-pass");const r=this.tracker.mark_of(e.from),o={x:Math.sign(e.quadrant.x-i.position.quadrant.x),y:Math.sign(e.quadrant.y-i.position.quadrant.y)},a={x:o.x>0?10.2:o.x<0?-1.2:e.from.x,y:o.y>0?10.2:o.y<0?-1.2:e.from.y};this.shown_clear(e.from),this.srs_draw(i),await ja(n,this.frames,{kind:"klingon",variant:r},e.from,a,{hostile:!0},t),this.lrsBloom={at:e.quadrant,hostile:!0};return}case"supernova":this.hooks.voice.cue("supernova"),await Tc(n,this.frames,e.at,"supernova",t);return;case"supernova-report":this.hooks.voice.cue("supernova"),this.lrsBloom={at:e.quadrant,hostile:!0};return;default:return}}async torpedo_end(e){const t=this.torpedo;t!==null&&(this.torpedo=null,await t.end(this.frames,e))}shown_clear(e){const t=this.shown;if(t===null)return;const i=t.sectors[e.x]?.[e.y];i!==void 0&&(i.kind="empty",i.glyph="."),t.klingons=t.klingons.filter(n=>n.x!==e.x||n.y!==e.y),this.srs_draw(t)}shown_put(e,t,i){const n=this.shown;if(n===null)return;const r=n.sectors[e.x]?.[e.y];r!==void 0&&(r.kind=t,r.glyph=Ac[t]);const o=n.position.sector;n.klingons.push({x:e.x,y:e.y,bearing:Qc(o,e),range:Wh(o,e),power:0,mark:i}),this.srs_draw(n)}}function nM(s){return JSON.parse(JSON.stringify(s))}const D3=24.5,T3=.6;function I3(s){const e=s.sampleRate*4,t=s.createBuffer(1,e,s.sampleRate),i=t.getChannelData(0);for(let n=0;n<e;n++)i[n]=(Math.random()*2-1)*1.732;return t}function C3(s,e,t,i,n,r={}){const o=r.rate??1,a=r.pitch??1,l=n.frame/o,c=r.start??0,h=Math.min(n.frames,r.end??n.frames),d=(r.gain??1)*T3/(n.peak||1);let u=0;for(const[g,m,v]of n.tracks){const y=g+m.length-1;if(y<=c||g>=h)continue;const b=Math.max(g,c),w=Math.min(y,h);if(w<=b)continue;const z=Float32Array.from(m.slice(b-g,w-g+1),E=>E*a),O=Float32Array.from([0,...v.slice(b-g,w-g+1).map(E=>E*d),0]),M=i+(b-c)*l,S=(w-b)*l,D=s.createOscillator();D.type="sine",D.frequency.setValueAtTime(z[0]??440,M),z.length>1&&D.frequency.setValueCurveAtTime(z,M,S);const T=s.createGain();T.gain.setValueAtTime(0,M-l),T.gain.setValueCurveAtTime(O,M-l,S+2*l),D.connect(T),T.connect(e),D.start(M-l),D.stop(M+S+l+.01),u++}const p=n.noise.frames,f=Math.max(0,c),_=Math.min(p.length,h);if(_>f+1){const g=s.createBufferSource();g.buffer=t,g.loop=!0,g.loopStart=Math.random()*2;const m=(_-f)*l;n.noise.centres.forEach((v,y)=>{const b=Float32Array.from([0,...p.slice(f,_).map(M=>(M[y]??0)*d*D3),0]);if(b.every(M=>M<1e-6))return;const w=s.createBiquadFilter();w.type="bandpass",w.frequency.setValueAtTime(v*a,i),w.Q.setValueAtTime(n.noise.q,i);const z=s.createBiquadFilter();z.type="bandpass",z.frequency.setValueAtTime(v*a,i),z.Q.setValueAtTime(n.noise.q,i);const O=s.createGain();O.gain.setValueAtTime(0,i-l),O.gain.setValueCurveAtTime(b,i-l,m+2*l),g.connect(w),w.connect(z),z.connect(O),O.connect(e)}),g.start(i-l),g.stop(i+m+l+.01)}return{voices:u,seconds:(h-c)*l}}function R3(s,e){return s.pills[e]??s.cues.press??null}class k3{constructor(e="sound/"){this.base=e}base;context=null;out=null;noise=null;muted=!1;bank=null;models=new Map;lastAt=0;tally={played:0,loaded:0,missing:0,voices:0};tally_get(){return{...this.tally}}muted_set(e){this.muted=e,this.out!==null&&this.context!==null&&this.out.gain.setTargetAtTime(e?0:1,this.context.currentTime,.01)}muted_is(){return this.muted}cue_play(e,t={}){this.muted||this.bank_load().then(i=>{const n=i?.cues[e];n!==void 0&&this.file_play(n,t)})}pill_play(e){this.muted||this.bank_load().then(t=>{const i=t===null?null:R3(t,e);i!==null&&this.file_play(i,{})})}preload(){this.bank_load().then(e=>{if(e!==null)for(const t of new Set([...Object.values(e.cues),...Object.values(e.pills)]))this.model_load(t)})}bank_load(){return this.bank===null&&(this.bank=fetch(`${this.base}bank.json`).then(e=>e.ok?e.json():Promise.reject(new Error(String(e.status)))).catch(()=>null)),this.bank}model_load(e){let t=this.models.get(e);return t===void 0&&(t=fetch(`${this.base}${e}`).then(i=>i.ok?i.json():Promise.reject(new Error(String(i.status)))).then(i=>(this.tally.loaded++,i)).catch(()=>(this.tally.missing++,null)),this.models.set(e,t)),t}context_get(){if(this.context===null){const e=window.AudioContext??window.webkitAudioContext;if(e===void 0)return null;this.context=new e,this.out=this.context.createGain(),this.out.gain.value=this.muted?0:1;const t=this.context.createDynamicsCompressor();t.threshold.value=-12,t.ratio.value=6,this.out.connect(t),t.connect(this.context.destination),this.noise=I3(this.context)}return this.context.state==="suspended"&&this.context.resume(),{context:this.context,out:this.out,noise:this.noise}}file_play(e,t){const i=this.context_get();i!==null&&this.model_load(e).then(n=>{if(n===null||this.muted)return;const r=i.context.currentTime+.02,o=Math.max(r,this.lastAt+.08);this.lastAt=o;try{const a=C3(i.context,i.out,i.noise,o,n,t);this.tally.played++,this.tally.voices+=a.voices}catch{}})}}const jr=new k3;function B3(s){const e=s.trim().split(/\s+/),t=e.indexOf("--seed");if(t<0)return null;const i=Number(e[t+1]);return Number.isFinite(i)?i:null}function N3(s){let e=null;const t={pill:a=>jr.pill_play(a),cue:a=>jr.cue_play(a)},i={events:0,states:0,lastError:null};window.__argusTrek={question:()=>e?.harness_get().question_get()?.question??null,prompt:()=>e?.harness_get().question_get()?.prompt??null,readout:()=>e?.readout_get()??null,view:()=>e?.view_get()??null,heard:()=>({...i,voice:jr.tally_get()}),frames:()=>e?.frames_get()??null};const n=()=>{e!==null&&(e.root.remove(),e=null,delete document.body.dataset.takeover)},r=()=>{e!==null&&(e.leaveAsk_close(),e.harness_get().abandon()||n())};return window.addEventListener("keydown",a=>{e===null||a.key!=="Escape"||(a.stopImmediatePropagation(),a.preventDefault(),e.leaveAsk_isOpen()?e.leaveAsk_close():e.leave_ask())},!0),{open:async a=>{if(e!==null)return;const l=new A3({voice:t,leave:r},B3(a));e=l,document.body.append(l.root),document.body.dataset.takeover="trek",jr.preload(),jr.cue_play("open");try{const h=(await s.client.line_execute(a,{operator:!0})).envelopes.find(d=>d.model?.kind==="games.trek");l.harness_get().end(typeof h?.model?.data?.exit=="number"?(h?.model?.data).exit:0)}catch{l.harness_get().end(1)}finally{e===l&&n()}},active_is:()=>e!==null,ask:a=>e===null?Promise.resolve(null):e.harness_get().ask(a.message),output_take:a=>{e?.harness_get().text_take(a)},event_take:(a,l)=>{i.events++,a==="games.trek.state"&&i.states++;try{e?.harness_get().event_take(a,l)}catch(c){i.lastError=c instanceof Error?`${c.message}
|
|
4303
4303
|
${c.stack??""}`:String(c),console.error("trek bridge: could not draw the state",c)}}}}function G3(s){return`${s.date??"undated"} · ${s.entries.map(e=>`${e.package} ${e.version}`).join(" · ")}`}function P3(s,e){return s.releases.map(t=>{const i=t.merge??t.date??"undated",n=[];for(const r of t.entries)r.changes.forEach((o,a)=>{const l=`${i}:${r.package}:${a}`,c=o.body!=="";n.push({key:l,tag:r.package,text:o.headline,body:!1,more:c,internal:o.internal,of:l}),c&&e.has(l)&&n.push({key:`${l}:body`,tag:"",text:o.body,body:!0,more:!1,internal:o.internal,of:l})});return{key:i,title:G3(t),rows:n}})}class L3{constructor(e,t){this.hooks=t;const i=e.querySelector(".notes-panel");if(i===null)throw new Error("notes pane: no .notes-panel in its template");this.state=e.querySelector(".pane-state"),this.sincePill=e.querySelector(".notes-since"),this.internalPill=e.querySelector(".notes-internal"),this.listing=new Mr({mount:i,traits:this.traits_declare(),key:n=>n.key,chrome:{root:e,prefix:"notes"},caps:"root",activatable:n=>n.more,activate:n=>this.unfold_toggle(n.of),row:{className:n=>`notes-row${n.body?" notes-row-body":""}${n.internal?" notes-row-internal":""}${n.more?" notes-row-more":""}`}}),this.sincePill?.addEventListener("click",()=>{this.since_cycle()}),this.internalPill?.addEventListener("click",()=>{this.internal_toggle()}),this.pills_paint()}hooks;listing;state;sincePill;internalPill;model=null;unfolded=new Set;ask={since:1,all:!1};traits_declare(){return[{key:"tag",label:"PACKAGE",className:"notes-tag",width:"minmax(5em, 7em)",cell:e=>e.tag},{key:"text",label:"CHANGE",className:"notes-text",width:"minmax(16em, 1fr)",cell:e=>e.more&&!e.body?`${e.text} ▸`:e.text}]}model_show(e){this.model=e,this.ask={since:e.releases.length>1?e.releases.length>=e.total?"all":e.releases.length:1,all:e.all},this.render()}releases_shown(){return this.model?.releases.length??0}unfolded_is(e){return this.unfolded.has(e)}unfold_toggle(e){this.unfolded.has(e)?this.unfolded.delete(e):this.unfolded.add(e),this.render()}async since_cycle(){const e=this.ask.since===1?5:this.ask.since===5?"all":1;await this.ask_again({...this.ask,since:e})}async internal_toggle(){await this.ask_again({...this.ask,all:!this.ask.all})}async ask_again(e){const t=e.since==="all"?"9999":String(e.since),i=await this.hooks.ask(`notes --since ${t}${e.all?" --all":""}`);i!==null&&(this.ask=e,this.model_show(i))}pills_paint(){this.sincePill!==null&&(this.sincePill.textContent=this.ask.since==="all"?"ALL RELEASES":this.ask.since===1?"LATEST RELEASE":`LAST ${this.ask.since} RELEASES`),this.internalPill!==null&&(this.internalPill.textContent=this.ask.all?"INTERNAL ON":"INTERNAL OFF",this.internalPill.classList.toggle("rail-off",!this.ask.all))}render(){const e=this.model;if(e===null)return;const t=n=>{const r=document.createElement("header");return r.className="files-path notes-block-head",r.textContent=n,r},i=P3(e,this.unfolded).map(n=>({key:n.key,header:t(n.title),rows:n.rows}));if(this.listing.rows_set(i,{field:"notes"}),this.state!==null){const n=Object.entries(e.installed).map(([r,o])=>`${r} ${o}`).join(" · ");this.state.textContent=`${e.source.toUpperCase()} · ${n}`}this.pills_paint()}}function W3(s){for(const e of s.envelopes){if(e.model?.kind!==SO)continue;const t=AO.safeParse(e.model.data);if(t.success)return t.data}return null}function F3(s,e){const{layout:t,panels:i,subjects:n}=s,r=async c=>W3(await e.ask(c)),o=c=>{const h=e.template_stamp("tpl-pane-notes");return i.set("notes",c,new L3(h,{ask:r})),{id:c,kind:"notes",mount:h,dispose:()=>{i.delete(c),n.pane_leave(c)}}},a=c=>{r("notes").then(h=>{h!==null&&i.get("notes",c)?.model_show(h)})};return{instance_build:o,open:()=>{const c=i.ids("notes").find(f=>t.panes_shown().includes(f));if(c!==void 0)return t.focus_set(c),a(c),"notes: on stage";const h=e.launcher_active();e.launcher_yield();const d=t.focused_get()??"files",u=e.instance_spawn("notes");return(h?t.leaf_replace("files",u.id):t.leaf_split(d,"col",u.id,!1))?(h?t.focus_set(u.id):e.birth_record(u.id,d,"col",!1),a(u.id),"notes: what the installed releases changed, as a pane (notes in the console prints it)"):(Ds(u.id),t.mount_remove(u.id),"notes: could not open a pane")},latest:()=>r("notes")}}function rM(s){return[...s.querySelectorAll(".mode-frame button")].filter(e=>!e.disabled&&!e.hidden&&e.offsetParent!==null)}function U3(s){return[...s.querySelectorAll(".listing-row")].filter(e=>e.offsetParent!==null)}function $3(s,e,t){if(e===0)return null;switch(t){case"ArrowDown":return s<0?0:Math.min(e-1,s+1);case"ArrowUp":return s<0?e-1:Math.max(0,s-1);case"Home":return 0;case"End":return e-1;default:return null}}function j3(s,e){const{layout:t,panels:i,paneInstance_get:n}=s,r=[()=>e.palette_isOpen()?(e.palette_close(),"claimed"):"passed",()=>s.terminal.ask_abandon()?"claimed":"passed",()=>Py()?"claimed":"passed",()=>e.errand_abandon()?"claimed":"passed",()=>{const f=document.activeElement;return!(f instanceof HTMLInputElement||f instanceof HTMLTextAreaElement)||f.closest(".workspace-pane")===null||f.closest("#terminal")!==null?"passed":(f.blur(),"claimed")},()=>i.values("image").some(f=>f.field_release())?"claimed":"passed",()=>i.values("edit").some(f=>f.field_release())?"claimed":"passed",()=>i.values("games").some(f=>f.field_release())?"claimed":"passed",()=>{if(s.terminal.ask_isOpen())return"passed";let f=!1;for(const _ of i.values("files"))_.select_isOn()&&(_.select_toggle(!1),f=!0);return f?"claimed":"passed"},()=>{const f=e.drawers_close(),_=e.modeFrames_close();return f||_?"claimed":"passed"},()=>document.body.dataset.zoom!==void 0?"yielded":"passed",()=>e.dive_leave()?"claimed":"passed",()=>e.overlay_escape()?"claimed":"passed",()=>{const f=i.entries("dag").find(([,_])=>_.inside_isHeld());return f===void 0?"passed":(f[1].flight_back(()=>{}),"claimed")},()=>{const f=t.focused_get(),_=i.entries("files").filter(([,g])=>g.content_isShown()).sort(([g],[m])=>g===f?-1:m===f?1:0)[0];return _===void 0?"passed":(_[1].listing_restore(),"claimed")},()=>i.values("dag").some(f=>f.nav_pop())?"claimed":"passed"],o=f=>{if(document.body.dataset.zoom!=="launcher")for(const _ of r){const g=_();if(g==="yielded")return;if(g==="claimed"){f.stopImmediatePropagation(),_!==r[0]&&s.sound("audio3");return}}},a=(f,_)=>{const g=()=>{f.preventDefault(),f.stopImmediatePropagation()},m=HD(f.key);if(f.ctrlKey&&!f.metaKey&&!f.altKey&&m!==null){const w=t.focused_get();return w!==null&&e.verbs.resize(w,m,.05),g(),!0}if(f.ctrlKey||f.metaKey||f.altKey)return!1;const v=w=>(e.drawers_close(),w(),g(),!0);if(m!==null)return v(()=>{l(),mw(e.host(),Ei[m].focusWord)!==null&&s.sound("audio3")});switch(f.key){case"o":case"O":{const w=t.panes_shown(),z=w.indexOf(t.focused_get()??""),O=w[(z+(f.key==="o"?1:w.length-1))%w.length];return v(()=>{l(),O!==void 0&&(t.focus_set(O),s.sound("audio3"))})}case"?":return v(()=>s.terminal.line_run("argus keys"));case";":return v(()=>{l(),t.focus_last()!==null&&s.sound("audio3")});case"q":return v(()=>{for(const w of t.panes_shown())e.verbs.bar_note(w,`@${w}`)});case" ":{const w=t.focused_get();return v(()=>{w!==null&&e.verbs.flip(w)})}case"!":{const w=t.focused_get();return v(()=>{w!==null&&t.panes_shown().length>1&&(e.stage_alone(w),e.verbs.bar_note(w,"ALONE ON STAGE"),s.sound("audio3"))})}case"w":return v(()=>e.element_require("gutter-panes").click());case"r":return v(()=>{l();const w=c();w!==null&&h(w)});case"&":return v(()=>s.terminal.line_run("pane close all"));case"[":return v(()=>{const w=document.querySelector(".argus-output");w!==null&&(w.tabIndex=-1,w.focus())})}const y=tn.find(w=>w.key===f.key&&w.selector!==null);if(y===void 0||y.selector===null)return!1;y.move===!0&&_.querySelector('.drawer-mode[data-mode="move"]')?.click();const b=_.querySelector(y.selector);return b===null||b.disabled?y.move===!0&&_.querySelector('.drawer-mode[data-mode="split"]')?.click():b.click(),g(),!0},l=()=>{const f=document.activeElement;f instanceof HTMLElement&&f.closest("#drawer")!==null&&f.blur(),e.console_release()},c=()=>{const f=document.body.dataset.zoom;if(f==="console"||f==="launcher")return null;const _=f!==void 0?f:t.focused_get();if(_===null)return null;const g=n(_)?.mount??null;return g?.closest(".workspace-pane")??g},h=f=>{f.classList.contains("workspace-pane")&&(f.dataset.modes="open");let _=0;const g=()=>{_+=1;const m=document.activeElement;!(m instanceof HTMLButtonElement&&m.closest(".mode-frame")!==null&&f.contains(m))&&(m===null||m===document.body)&&rM(f)[0]?.focus(),_<30&&window.requestAnimationFrame(g)};return g(),s.sound("audio3"),!0},d=f=>{if(f.ctrlKey||f.metaKey||f.altKey||f.shiftKey)return!1;const _=c();if(_===null)return!1;const g=()=>(f.preventDefault(),f.stopImmediatePropagation(),!0),m=document.activeElement;if(m instanceof HTMLButtonElement&&m.closest(".mode-frame")!==null&&_.contains(m)){const O=rM(_),M=O.indexOf(m);return f.key==="ArrowLeft"?(m.blur(),g()):f.key==="ArrowDown"||f.key==="ArrowUp"?(O[f.key==="ArrowDown"?Math.min(O.length-1,M+1):Math.max(0,M-1)]?.focus(),g()):!1}if(m!==null&&m!==document.body&&!m.classList.contains("listing-row"))return!1;const v=U3(_);if(v.length===0)return!1;const y=v.findIndex(O=>O.classList.contains("listing-cursor")),b=y>=0?y:v.findIndex(O=>O.classList.contains("listing-indicated"));if(f.key==="ArrowRight")return h(_)&&g();if(f.key==="Enter"){const O=v[b];if(O===void 0)return!1;if(O.classList.contains("listing-indicated")){const M=O.querySelector(".listing-control");M!==null?M.click():O.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0,cancelable:!0}))}else O.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}));return g()}const w=$3(b,v.length,f.key);if(w===null)return!1;for(const O of v)O.classList.remove("listing-cursor");const z=v[w];return z?.classList.add("listing-cursor"),z?.scrollIntoView({block:"nearest"}),g()},u=f=>{const _=document.querySelector(".pane-drawer:not([hidden])")!==null;if(f.key===":"&&_){e.drawers_close(),e.palette_open(),f.preventDefault(),f.stopImmediatePropagation();return}if(!(f.key==="b"&&f.ctrlKey&&!f.altKey&&!f.metaKey))return;if(f.preventDefault(),_){e.drawers_close(),e.palette_open();return}const g=document.body.dataset.zoom,m=g==="console"||g===void 0&&e.consoleFocused(),v=g!==void 0&&g!=="console"?g:t.focused_get()??"files",y=m?e.element_require("console-drawer"):n(v)?.mount?.querySelector(".pane-drawer")??null;y!==null&&(y.hidden=!y.hidden,y.hidden||y.querySelector("button")?.focus(),s.sound("audio3"))},p=f=>{if(f.key==="Escape"){o(f);return}const _=document.querySelector(".pane-drawer:not([hidden])"),g=f.target instanceof HTMLInputElement||f.target instanceof HTMLTextAreaElement||f.target instanceof HTMLElement&&f.target.isContentEditable;_!==null&&!g&&a(f,_)||_===null&&!g&&!e.palette_isOpen()&&d(f)||u(f)};return window.addEventListener("keydown",p,{capture:!0}),()=>window.removeEventListener("keydown",p,{capture:!0})}function H3(s,e){const{layout:t,panels:i,subjects:n}=s,r=(l,c,h)=>{h.addEventListener("click",_=>{_.target instanceof Element&&_.target.closest("button")!==null||(c.hidden=!c.hidden,c.hidden||c.querySelector("button")?.focus(),s.sound("audio3"))});const d=c.querySelector(".drawer-zoom");d!==null&&(d.dataset.pane=l),h.addEventListener("dblclick",_=>{_.target instanceof Element&&_.target.closest("button")!==null||(window.getSelection()?.removeAllRanges(),d?.click())});for(const _ of c.querySelectorAll(".drawer-bind"))_.addEventListener("click",()=>{for(const g of c.querySelectorAll(".drawer-bind"))g.classList.remove("drawer-bind-selected");_.classList.add("drawer-bind-selected"),s.sound("audio3")});const u=[...c.querySelectorAll("[data-split]")],p=_=>$D(_.dataset.split,_.dataset.place)??"right",f=_=>{c.dataset.mode=_;for(const g of c.querySelectorAll(".drawer-mode"))g.classList.toggle("drawer-mode-selected",g.dataset.mode===_);for(const g of u){const m=p(g);g.disabled=_==="move"&&!t.move_possible(l,m);const v=vi(m);g.title=_==="move"?`this pane moves ${m}${e.verbs.chordKeys_of(v,!0)}`:`new pane opens ${m}${e.verbs.chordKeys_of(v,!1)}`}};for(const _ of c.querySelectorAll(".drawer-mode"))_.addEventListener("click",()=>{const g=_.dataset.mode==="move"?"move":"split";f(g==="move"&&c.dataset.mode==="move"?"split":g),s.sound("audio3")});for(const _ of u)_.addEventListener("click",()=>{if(c.dataset.mode==="move"){e.verbs.move(l,p(_)),f("split"),c.hidden=!0;return}const g=_.dataset.split==="row"?"row":"col",m=_.dataset.place==="before",v=c.querySelector(".drawer-bind-selected")?.dataset.bind??"unlinked",y=v==="viewer"?"view":v==="fs"?"fs":"empty";e.pillPane_spawn(l,y,g,m)!==null&&(c.hidden=!0,s.sound("audio3"))});for(const _ of new Set(tn.filter(g=>g.selector!==null&&g.move!==!0).map(g=>g.selector??""))){const g=c.querySelector(_);g!==null&&!g.title.includes("[keys ")&&(g.title=`${g.title}${e.verbs.chordKeys_of(_,!1)}`)}c.querySelector(".drawer-close")?.addEventListener("click",()=>{if(l==="dag"){e.dag_dismiss(),e.home_apply();return}t.leaf_close(l)||e.home_apply(),e.orphans_dispose(),s.sound("audio3")})},o=(l,c,h)=>{const{browser:d}=e,u=c.querySelector(".drawer-binding");if(u!==null){const g=document.createElement("span");g.className="drawer-label drawer-label-cwd",g.textContent="CWD",u.appendChild(g);const m=(v,y,b)=>{const w=document.createElement("button");w.className="pacs-capsule drawer-cwdbind",w.dataset.follow=y?"on":"off",w.textContent=v,w.title=b,w.addEventListener("click",()=>{d.follows(l)!==y&&d.follow_set(l,y),s.sound("audio3")}),u.appendChild(w)};m("FOLLOW CWD",!0,"bind this browser to the session cwd (the console's browser)"),m("ROOT HERE",!1,"unbind from the cwd: this browser keeps its own place"),d.cwdBind_sync_register(l,()=>{const v=d.follows(l);for(const y of u.querySelectorAll(".drawer-cwdbind"))y.classList.toggle("drawer-bind-selected",y.dataset.follow==="on"===v)}),d.cwdBind_sync(l)}const p=()=>i.get("files",l);h.querySelector(".files-home")?.addEventListener("click",()=>{if(d.follows(l)){s.terminal.line_run("cd ~");return}const g=p();g!==void 0&&d.rooted_walk(l,g,"~")}),h.querySelector(".files-back")?.addEventListener("click",()=>{if(d.follows(l)){s.terminal.line_run("cd -");return}const g=p();g!==void 0&&d.rooted_back(l,g)});const f=()=>p()?.path_current()??null;h.querySelector(".files-mkdir")?.addEventListener("click",()=>{const g=f();g!==null&&d.directory_make(l,g)}),h.querySelector(".files-refresh")?.addEventListener("click",()=>{const g=f();g!==null&&d.listing_refresh(l,g)});const _=h.querySelector(".files-upload-input");h.querySelector(".files-upload")?.addEventListener("click",()=>{f()!==null&&_?.click()}),_?.addEventListener("change",()=>{const g=f(),m=_.files;g===null||m===null||m.length===0||(d.files_deliver(l,g,Array.from(m)),_.value="")})},a=(l,c)=>{const h=d=>d.modelKind==="fs.file"?d.address.replace(/\/[^/]*$/,"")||"/":d.address;c("ENTER NODE","move the session into the indicated node (its data directory)",()=>{const d=n.regard_get(l),u=i.get("dag",l)?.feed_get()??null,p=d===null?u===null?null:`/proc/jobs/feed_${u}`:h(d);p!==null&&s.terminal.line_run(`cd "${p}"`)}),c("PROCESS NODE","run an executable on the indicated node's output (a catalogue opens beside)",()=>{const d=n.regard_get(l),u=i.get("dag",l)?.feed_get()??null;if(d===null||u===null)return;const p=h(d),f=Ep(p)??(/_(\d+)\/?$/.exec(p)===null?null:parseInt(/_(\d+)\/?$/.exec(p)?.[1]??"",10));f!==null&&e.process_open(l,{input:p.replace(/\/data\/?$/,"")+"/data",feed:u,node:f})}),c("ENTER FEED","move the session into the feed on stage (or the one picked in the roster)",()=>{const d=i.get("dag",l)?.feed_get()??null;d!==null&&s.terminal.line_run(`cd "/proc/jobs/feed_${d}"`)}),c("BACK","return to the previous listing inside the node",()=>e.overlay_back(l)),c("CLEAR DETAIL","dismiss the node facts (a click on empty space does too)",()=>{i.get("dag",l)?.detail_clear()}),c("REFRESH","revisit the feed now (a watch keeps sampling it while it runs)",()=>{i.get("dag",l)?.refresh()})};return(l,c,h)=>{const d=h.querySelector(".pane-drawer"),u=h.querySelector(".pane-handle");if(d===null||u===null)return;r(l,d,u);const p=d.querySelector(".drawer-children");if(p===null)return;const f=(_,g,m)=>{const v=document.createElement("button");v.className="pacs-capsule drawer-child",v.textContent=_,v.title=g,v.addEventListener("click",()=>{m(),d.hidden=!0,s.sound("audio3")}),p.appendChild(v)};(c==="files"||c==="catalogue")&&o(l,d,h),c==="dag"&&a(l,f)}}function V3(s,e){const{layout:t,panels:i,paneInstance_get:n,subjects:r}=s,o=d=>n(d)?.kind??null,a=(d,u)=>{const p=new Set(t.panes_shown()),f=r.group_of(u),_=i.entries(d).filter(([g])=>p.has(g));return i.get(d,u)??_.find(([g])=>r.group_of(g)===f)?.[1]??(_.length===1?_[0]?.[1]:void 0)},l=async(d,u,p)=>{if(u==="state"){const f=d.state_get();if(f===null)return"image state: no image on the field";const _=(f.viewports??[]).map(g=>`${g.id.replace(/^.*-/,"")} scale=${g.scale.toFixed(3)} focus=${g.focus.map(m=>m.toFixed(2)).join(",")} voi=${g.voi===null?"-":`${g.voi.lower.toFixed(1)}..${g.voi.upper.toFixed(1)}`}`).join(" | ");return`image: layout=${f.layout} tool=${f.tool} primary=${f.primaryTool??"-"} slice=${f.slice}/${f.slices} refused=${f.refused} annotations=${f.annotations} filled=${f.filled}
|
|
4304
4304
|
viewports: ${_||"(none)"}`}if(u==="layout"){const f=p[0]??"";return EE.includes(f)?await d.layout_set(f)?`image layout ${f}`:d.state_get()?.waiting===f?`image layout ${f}: waiting for LOAD`:`image layout ${f}: not offered`:"image layout single|mpr|3d|slab"}if(u==="slice"){const f=Number(p[0]);return!Number.isInteger(f)||f<1?"image slice <n>":d.slice_set(f)?`image slice ${f}`:`image slice ${f}: not offered`}if(u==="series"){const f=Number(p[0]),_=d.siblings_get();if(_.length===0)return"image series: this pane holds one series, not a study";const g=_[f-1];if(g===void 0)return`image series <1..${_.length}>: ${_.map((v,y)=>`${y+1} ${v.label}`).join(" · ")}`;const m=await e.series_ask(g.path);return m===null?`image series ${f}: ${g.path}: not a readable DICOM series`:(d.series_show(m,{siblings:[..._]}),`image series ${f} ${g.label}`)}if(u==="wl"){if((p[0]??"").toLowerCase()==="preset"){const g=p[1]??"";return g===""?"image wl preset <brain|bone|lung|soft|liver>":d.wlPreset_set(g)?`image wl preset ${g}`:`image wl preset ${g}: none for this modality`}const f=Number(p[0]),_=Number(p[1]);return!Number.isFinite(f)||!Number.isFinite(_)||f>=_?"image wl <lower> <upper> | image wl preset <name>":d.wl_set(f,_)?`image wl ${f} ${_}`:"image wl: not offered"}if(u==="colormap"){const f=(p[0]??"").toLowerCase();return Lc.includes(f)?d.colormap_set(f)?`image colormap ${f}`:`image colormap ${f}: not offered`:"image colormap gray|hot|jet|cool"}if(u==="save")return await d.annotations_save()?"image save":"image save: nothing saved (the console says why)";if(u==="load")return await d.load_press()?"image load":"image load: nothing was waiting";if(u==="guard"){if((p[0]??"").toLowerCase()==="off")return d.guard_set(null),"image guard off";const _=Number(p[0]);return!Number.isFinite(_)||_<0?`image guard <bytes>|off (now ${d.guard_get()===null?"off":d.guard_get()})`:(d.guard_set(_),`image guard ${_}`)}if(u==="ghost"){const _=(p[0]??"").toLowerCase()==="off"?null:Number(p[0]);return _!==null&&(!Number.isFinite(_)||_<0||_>1)?"image ghost <0..1>|off (SLAB layout)":d.ghost_set(_)?`image ghost ${_===null?"off":_}`:"image ghost: SLAB layout only"}if(u==="tags"){const f=i.idOf("image",d);return f===null?"image tags: no image pane":e.tagsPane_open(f)}return"image <path> · layout single|mpr|3d · slice <n> · series <n> · wl <lo> <hi> | wl preset <name> · colormap <name> · save"},c=(d,u,p)=>{if(u==="redact"){const f=(p[0]??"").toLowerCase();return f!=="on"&&f!=="off"?"tags redact on|off":(d.redact_set(f==="on"),`tags redact ${f}`)}if(u==="filter"){const f=p.join(" ");return f===""||f.toLowerCase()==="off"?(d.filter_set(null),"tags filter off"):(d.filter_set(f),`tags filter ${f}`)}return"tags redact on|off · filter <text>|off"},h=()=>{const d=t.tree_get();if(d===null)return"# empty desktop";const u=[],p=w=>"pane"in w?w.pane:p(w.first),f=p(d),_=o(f);u.push(`view ${_==="dag"?"runs":_==="pacs"?"pacs":"files"}`);let g=1;const m=(w,z)=>{const O=o(w);O==="dag"&&w!==f&&u.push(`pane %${z} claim runs`),O==="files"&&w!==f&&r.group_of(w)===w&&u.push(`pane %${z} claim files`);const M=O==="files"?i.get("files",w)?.path_current()??null:null;M!==null&&u.push(`file %${z} open ${M}`);const S=O==="dag"?i.get("dag",w):void 0;if(S!==void 0&&S.graph_isShown())for(const D of S.view_lines())u.push(D.replace(/^dag /,`dag %${z} `));else if(O==="dag"){const D=n(w)?.mount,T=D?.querySelector(".dag-strategy")?.textContent?.toLowerCase()??"ranked",E=D?.querySelector(".dag-projection")?.textContent?.toLowerCase()??"3d",x=D?.querySelector(".dag-hue")?.textContent?.toLowerCase()??"status";T!=="ranked"&&u.push(`dag %${z} layout ${T}`),E!=="3d"&&u.push(`dag %${z} projection ${E}`),x!=="status"&&u.push(`dag %${z} hue ${x}`)}},v=(w,z)=>{if("pane"in w){m(w.pane,z);return}const O=p(w.second),M=o(O),S=M==="view"?"viewer":M==="files"&&r.group_of(O)!==O?"fs":"unlinked";u.push(`pane %${z} bind ${S}`),u.push(`pane %${z} split ${w.dir==="col"?"right":"below"}`);const D=++g;v(w.first,z),v(w.second,D)};v(d,g);const y=document.body.dataset.header;return y!==void 0&&u.push(`header ${y}`),document.getElementById("drawer")?.classList.contains("drawer-closed")&&u.push("console close"),u.join(`
|
|
4305
4305
|
`)};return{focused_get:()=>{const d=document.body.dataset.zoom;return d!==void 0&&d!=="console"?d:t.focused_get()??t.panes_shown()[0]??null},focus_set:d=>n(d)===void 0?!1:(t.focus_set(d),!0),panes_shown:()=>t.panes_shown(),pane_move:e.verbs.move,pane_flip:e.verbs.flip,pane_resize:e.verbs.resize,help_open:e.help_open,notes_open:e.notes_open,focus_last:()=>{const d=t.focus_last();return d!==null&&s.sound("audio3"),d===null?null:`focused ${d}`},paneRect_get:d=>document.querySelector(`.layout-leaf[data-leaf="${d}"]`)?.getBoundingClientRect()??null,paneMount_get:d=>n(d)?.mount??null,paneKind_get:o,paneLinked_get:d=>r.group_of(d)!==d,feed_enter:e.feed_enter,consoleZoom_toggle:e.consoleZoom_toggle,launcher_enter:e.launcher_enter,trek_open:e.trek_open,stage_keep:e.stage_keep,viewModes_hold:DN,identity_get:e.identity_get,dag_jump:(d,u,p=!1)=>{const f=i.get("dag",d)??i.values("dag")[0];return f===void 0?!1:(f.jump_to(u,p),!0)},node_immerse:d=>{const p=r.regard_get(d)?.address.match(/_(\d+)(?:\/data)?\/?$/)??null;return p===null?!1:i.get("dag",d)?.node_flyTo(parseInt(p[1]??"",10))??!1},files_open:e.files_open,file_download:d=>{const u=r.regard_get(d);return u===null||u.modelKind!=="fs.file"?!1:(e.file_save(u.address),!0)},image_open:(d,u,p)=>e.image_open(d,u,p??{}),image_control:async(d,u,p)=>{const f=a("image",d);return f===void 0?`image ${u}: no image pane on stage for '${d}'`:l(f,u,p)},universe_control:(d,u,p)=>{const f=new Set(t.panes_shown()),_=(d!==null?i.get("universe",d):void 0)??i.entries("universe").find(([g])=>f.has(g))?.[1];return _===void 0?"universe: no universe pane on stage (press the dashboard tile)":_.control(u,p)},tags_control:(d,u,p)=>{const f=a("tags",d);return f===void 0?`tags ${u}: no tags pane on stage for '${d}'`:c(f,u,p)},file_delete:d=>{const u=r.regard_get(d);return u===null||u.modelKind!=="fs.file"?!1:(s.terminal.line_run(`rm "${u.address}"`),!0)},session_run:async d=>{try{return(await s.client.line_execute(d,{silent:!0,observe:!1})).envelopes.map(p=>p.renderedErr??p.rendered).join(`
|
|
4306
|
-
`)}catch(u){return u instanceof Error?u.message:String(u)}},desktop_serialize:h}}function q3(s,e,t){if(t===!0)return"daemon-older";if(e===void 0)return null;const i=e.surface;return t===!1?i!==void 0&&s.built<i.built?"argus-older":null:i===void 0?"daemon-older":i.git===s.git&&i.built===s.built?null:s.built>=i.built?"daemon-older":"argus-older"}const vg={"daemon-older":{readout:"CALYPSO DAEMON OUT OF DATE",before:"The calypso daemon has been updated and should be restarted; some controls may not work until then. ",cure:"Restart the calypso daemon",after:"."},"argus-older":{readout:"ARGUS OUT OF DATE",before:"ARGUS is older than the calypso daemon. ",cure:"Refresh",after:" to load the new ARGUS."}};function gz(s){const e=vg[s];return`${e.before}${e.cure}${e.after}`}async function K3(s){try{const e=s??(typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0);if(e===void 0)return null;const t=await e("notes.json",{cache:"no-store"});if(!t.ok)return null;const i=await t.json(),r=i.releases?.[0]?.changes?.find(o=>o.internal!==!0)?.headline;return typeof r!="string"||typeof i.version!="string"?null:{version:i.version,headline:r}}catch{return null}}const oM=96;function Y3(s){const e=s.headline.length>oM?`${s.headline.slice(0,oM-1).trimEnd()}…`:s.headline;return`argus ${s.version} · ${e} — WHAT'S NEW after restart`}function X3(s,e,t,i,n=document.body,r){n.querySelector(".build-mismatch")?.remove();const o=t.surface!==void 0?`ARGUS ${t.surface.git} built ${t.surface.built}Z`:"an ARGUS too old to say its build";i(`argus: ${gz(s)}`);const a=t.surface!==void 0&&t.surface.git===e.git&&t.surface.built===e.built;i(a?`argus: the calypso daemon's own code on disk has changed since it started (ARGUS ${e.git} built ${e.built}Z)`:`argus: ARGUS ${e.git} built ${e.built}Z · calypso daemon started with ${o}`);const l=vg[s],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=s,c.setAttribute("role","alert");const h=document.createElement("span");h.className="stale-page-words";let d=document.createTextNode(l.cure);if(s==="argus-older"){const p=document.createElement("button");p.type="button",p.className="stale-page-reload",p.textContent=l.cure,p.title="reload this tab to load the new ARGUS",p.addEventListener("click",()=>{window.location.reload()}),d=p}else if(r!==void 0){const p=document.createElement("button");p.type="button",p.className="stale-page-reload build-mismatch-restart",p.textContent=l.cure,p.title="restart the calypso daemon (asks first; you stay logged in)",p.addEventListener("click",r),d=p}h.append(document.createTextNode(l.before),d,document.createTextNode(l.after));const u=document.createElement("button");u.type="button",u.className="build-mismatch-dismiss",u.textContent="×",u.title="dismiss (the status strip keeps saying it)",u.addEventListener("click",()=>{c.remove()}),c.append(h,u),n.appendChild(c),s==="daemon-older"&&K3().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=Y3(p),h.appendChild(f)})}function Z3(s,e,t,i=document.body){const n={git:"
|
|
4306
|
+
`)}catch(u){return u instanceof Error?u.message:String(u)}},desktop_serialize:h}}function q3(s,e,t){if(t===!0)return"daemon-older";if(e===void 0)return null;const i=e.surface;return t===!1?i!==void 0&&s.built<i.built?"argus-older":null:i===void 0?"daemon-older":i.git===s.git&&i.built===s.built?null:s.built>=i.built?"daemon-older":"argus-older"}const vg={"daemon-older":{readout:"CALYPSO DAEMON OUT OF DATE",before:"The calypso daemon has been updated and should be restarted; some controls may not work until then. ",cure:"Restart the calypso daemon",after:"."},"argus-older":{readout:"ARGUS OUT OF DATE",before:"ARGUS is older than the calypso daemon. ",cure:"Refresh",after:" to load the new ARGUS."}};function gz(s){const e=vg[s];return`${e.before}${e.cure}${e.after}`}async function K3(s){try{const e=s??(typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0);if(e===void 0)return null;const t=await e("notes.json",{cache:"no-store"});if(!t.ok)return null;const i=await t.json(),r=i.releases?.[0]?.changes?.find(o=>o.internal!==!0)?.headline;return typeof r!="string"||typeof i.version!="string"?null:{version:i.version,headline:r}}catch{return null}}const oM=96;function Y3(s){const e=s.headline.length>oM?`${s.headline.slice(0,oM-1).trimEnd()}…`:s.headline;return`argus ${s.version} · ${e} — WHAT'S NEW after restart`}function X3(s,e,t,i,n=document.body,r){n.querySelector(".build-mismatch")?.remove();const o=t.surface!==void 0?`ARGUS ${t.surface.git} built ${t.surface.built}Z`:"an ARGUS too old to say its build";i(`argus: ${gz(s)}`);const a=t.surface!==void 0&&t.surface.git===e.git&&t.surface.built===e.built;i(a?`argus: the calypso daemon's own code on disk has changed since it started (ARGUS ${e.git} built ${e.built}Z)`:`argus: ARGUS ${e.git} built ${e.built}Z · calypso daemon started with ${o}`);const l=vg[s],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=s,c.setAttribute("role","alert");const h=document.createElement("span");h.className="stale-page-words";let d=document.createTextNode(l.cure);if(s==="argus-older"){const p=document.createElement("button");p.type="button",p.className="stale-page-reload",p.textContent=l.cure,p.title="reload this tab to load the new ARGUS",p.addEventListener("click",()=>{window.location.reload()}),d=p}else if(r!==void 0){const p=document.createElement("button");p.type="button",p.className="stale-page-reload build-mismatch-restart",p.textContent=l.cure,p.title="restart the calypso daemon (asks first; you stay logged in)",p.addEventListener("click",r),d=p}h.append(document.createTextNode(l.before),d,document.createTextNode(l.after));const u=document.createElement("button");u.type="button",u.className="build-mismatch-dismiss",u.textContent="×",u.title="dismiss (the status strip keeps saying it)",u.addEventListener("click",()=>{c.remove()}),c.append(h,u),n.appendChild(c),s==="daemon-older"&&K3().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=Y3(p),h.appendChild(f)})}function Z3(s,e,t,i=document.body){const n={git:"570d9e7c",built:"2026-10-20 13:48"};let r=[],o,a=null;const l=h=>{r!==null?r.push(h):e(h)},c=h=>{if(o===void 0)return;const d=q3(n,o,h);if(d!==a){if(a=d,d===null){s.build_show(null),i.querySelector(".build-mismatch")?.remove();return}s.build_show(vg[d].readout,gz(d)),X3(d,n,o,l,i,Zh(window.location.search)?t:void 0)}};return{attach_take:h=>{o=h.stack,c(h.stale)},stale_take:h=>c(h),release:()=>{const h=r??[];r=null;for(const d of h)e(d)}}}function J3(s=document.getElementById("door-pill")){s===null||!Zh(window.location.search)||(s.hidden=!1,s.addEventListener("click",()=>{const e=lh(window.location.pathname,"logout"),t=lh(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(t)})}))}const Q3="Restart the calypso daemon? You'll stay logged in; the page reloads when the new daemon is up.";function e4(s){const e=[];s.running!==null&&e.push(`the running command: ${s.running}`);for(const r of s.unsaved)e.push(`an unsaved edit in ${r}`);const t=s.others.filter(r=>r.kind==="browser").length,i=s.others.length-t,n=[];return t>0&&n.push(t===1?"1 other browser":`${t} other browsers`),i>0&&n.push(i===1?"1 chell":`${i} chells`),n.length>0&&e.push(`${n.join(" and ")}, which will be disconnected`),e}function t4(s){return s==="restart"?"The calypso daemon is restarting (asked from another browser or surface). Following it…":s==="end"?"The calypso daemon was ended by an administrator.":"The calypso daemon stopped."}function s4(s,e){const t=document.createElement("div");t.className="stale-page restart-question",t.setAttribute("role","alertdialog");const i=document.createElement("div");i.className="stale-page-words";const n=document.createElement("div");if(n.textContent=Q3,i.append(n),s.length>0){const h=document.createElement("ul");h.className="restart-cuts";const d=document.createElement("li");d.className="restart-cuts-lead",d.textContent="This will cut off:",h.append(d);for(const u of s){const p=document.createElement("li");p.textContent=u,h.append(p)}i.append(h)}const r=document.createElement("button");r.type="button",r.className="restart-yes",r.textContent="YES";const o=document.createElement("button");o.type="button",o.className="restart-no",o.textContent="NO";let a=!1;const l=h=>{a||(a=!0,t.remove(),e(h))};r.addEventListener("click",()=>l(!0)),o.addEventListener("click",()=>l(!1)),t.addEventListener("keydown",h=>{h.key!=="Enter"&&h.key!=="Escape"||(h.preventDefault(),h.stopPropagation(),l(h.key==="Enter"))});const c=document.createElement("div");return c.className="restart-answers",c.append(r,o),t.append(i,c),t}function i4(s,e=document.body){const t=Zh(window.location.search);let i=null,n=null,r=[],o=!1;const a=u=>{e.querySelector(".restart-said")?.remove();const p=document.createElement("div");p.className="stale-page restart-said",p.setAttribute("role","alert"),p.textContent=u,e.appendChild(p)},l=u=>{window.location.assign(`${lh(window.location.pathname,"greet")}/${encodeURIComponent(u)}`)},c=async()=>{o=!0,a("Restarting the calypso daemon…");try{const u=await fetch(lh(window.location.pathname,"restart"),{method:"POST",headers:{accept:"application/json"}}),p=await u.json();if(!u.ok||p.key===void 0)throw new Error(p.error??`the door answered ${u.status}`);l(p.key)}catch(u){o=!1,a(`The calypso daemon could not be restarted: ${u instanceof Error?u.message:String(u)}`)}},h=()=>{if(!t||e.querySelector(".restart-question")!==null)return;const u={running:n,unsaved:s.unsaved(),others:r.filter(f=>f.id!==i)},p=s4(e4(u),f=>{f&&c()});e.querySelector(".build-mismatch")?.remove(),e.appendChild(p),p.querySelector(".restart-yes")?.focus()},d=document.getElementById("restart-pill");return d!==null&&t&&(d.hidden=!1,d.addEventListener("click",h)),{ask:h,attach_take:u=>{i=u.surface??null},telemetry_take:u=>{u?.lane!==void 0&&(n=u.lane.running?.line??null),u?.surfaces!==void 0&&(r=u.surfaces)},closing_take:u=>{if(o||(a(t4(u)),u!=="restart"||!t))return;const p=window.location.pathname.split("/").filter(f=>f.length>0).at(-1);p!==void 0&&setTimeout(()=>l(p),1200)}}}function n4(s,e,t,i){s.line_execute(`motd ${t}`,{silent:!0,observe:!1}).then(n=>{const r=n.envelopes.filter(o=>o.status==="ok").map(o=>o.rendered).join("").trimEnd();r.length>0&&e.greeting_write(r.split(`
|
|
4307
4307
|
`))}).catch(()=>{}).finally(i)}var _z=Object.defineProperty,r4=Object.getOwnPropertyDescriptor,o4=(s,e)=>{for(var t in e)_z(s,t,{get:e[t],enumerable:!0})},Qt=(s,e,t,i)=>{for(var n=i>1?void 0:i?r4(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&_z(e,t,n),n},Ce=(s,e)=>(t,i)=>e(t,i,s),aM="Terminal input",Rp={get:()=>aM,set:s=>aM=s},lM="Too much output to announce, navigate to rows manually to read",kp={get:()=>lM,set:s=>lM=s};function a4(s){return s.replace(/\r?\n/g,"\r")}function l4(s,e){return e?"\x1B[200~"+s+"\x1B[201~":s}function c4(s,e){s.clipboardData&&s.clipboardData.setData("text/plain",e.selectionText),s.preventDefault()}function h4(s,e,t,i){if(s.stopPropagation(),s.clipboardData){let n=s.clipboardData.getData("text/plain");bz(n,e,t,i)}}function bz(s,e,t,i){s=a4(s),s=l4(s,t.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),t.triggerDataEvent(s,!0),e.value=""}function Mz(s,e,t){let i=t.getBoundingClientRect(),n=s.clientX-i.left-10,r=s.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function cM(s,e,t,i,n){Mz(s,e,t),n&&i.rightClickSelect(s),e.value=i.selectionText,e.select()}function sr(s){return s>65535?(s-=65536,String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)}function vd(s,e=0,t=s.length){let i="";for(let n=e;n<t;++n){let r=s[n];r>65535?(r-=65536,i+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):i+=String.fromCharCode(r)}return i}var d4=class{constructor(){this._interim=0}clear(){this._interim=0}decode(s,e){let t=s.length;if(!t)return 0;let i=0,n=0;if(this._interim){let r=s.charCodeAt(n++);56320<=r&&r<=57343?e[i++]=(this._interim-55296)*1024+r-56320+65536:(e[i++]=this._interim,e[i++]=r),this._interim=0}for(let r=n;r<t;++r){let o=s.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=t)return this._interim=o,i;let a=s.charCodeAt(r);56320<=a&&a<=57343?e[i++]=(o-55296)*1024+a-56320+65536:(e[i++]=o,e[i++]=a);continue}o!==65279&&(e[i++]=o)}return i}},u4=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(s,e){let t=s.length;if(!t)return 0;let i=0,n,r,o,a,l=0,c=0;if(this.interim[0]){let u=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let f=0,_;for(;(_=this.interim[++f]&63)&&f<4;)p<<=6,p|=_;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=g-f;for(;c<m;){if(c>=t)return 0;if(_=s[c++],(_&192)!==128){c--,u=!0;break}else this.interim[f++]=_,p<<=6,p|=_&63}u||(g===2?p<128?c--:e[i++]=p:g===3?p<2048||p>=55296&&p<=57343||p===65279||(e[i++]=p):p<65536||p>1114111||(e[i++]=p)),this.interim.fill(0)}let h=t-4,d=c;for(;d<t;){for(;d<h&&!((n=s[d])&128)&&!((r=s[d+1])&128)&&!((o=s[d+2])&128)&&!((a=s[d+3])&128);)e[i++]=n,e[i++]=r,e[i++]=o,e[i++]=a,d+=4;if(n=s[d++],n<128)e[i++]=n;else if((n&224)===192){if(d>=t)return this.interim[0]=n,i;if(r=s[d++],(r&192)!==128){d--;continue}if(l=(n&31)<<6|r&63,l<128){d--;continue}e[i++]=l}else if((n&240)===224){if(d>=t)return this.interim[0]=n,i;if(r=s[d++],(r&192)!==128){d--;continue}if(d>=t)return this.interim[0]=n,this.interim[1]=r,i;if(o=s[d++],(o&192)!==128){d--;continue}if(l=(n&15)<<12|(r&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;e[i++]=l}else if((n&248)===240){if(d>=t)return this.interim[0]=n,i;if(r=s[d++],(r&192)!==128){d--;continue}if(d>=t)return this.interim[0]=n,this.interim[1]=r,i;if(o=s[d++],(o&192)!==128){d--;continue}if(d>=t)return this.interim[0]=n,this.interim[1]=r,this.interim[2]=o,i;if(a=s[d++],(a&192)!==128){d--;continue}if(l=(n&7)<<18|(r&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;e[i++]=l}}return i}},vz="",lr=" ",Il=class wz{constructor(){this.fg=0,this.bg=0,this.extended=new Fh}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new wz;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Fh=class yz{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new yz(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ai=class zz extends Il{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Fh,this.combinedData=""}static fromCharData(e){let t=new zz;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?sr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let n=e[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},hM="di$target",Bp="di$dependencies",Nu=new Map;function f4(s){return s[Bp]||[]}function Ss(s){if(Nu.has(s))return Nu.get(s);let e=function(t,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");p4(e,t,n)};return e._id=s,Nu.set(s,e),e}function p4(s,e,t){e[hM]===e?e[Bp].push({id:s,index:t}):(e[Bp]=[{id:s,index:t}],e[hM]=e)}var Xs=Ss("BufferService"),Sz=Ss("CoreMouseService"),_o=Ss("CoreService"),m4=Ss("CharsetService"),wg=Ss("InstantiationService"),xz=Ss("LogService"),Zs=Ss("OptionsService"),Oz=Ss("OscLinkService"),g4=Ss("UnicodeService"),Cl=Ss("DecorationService"),Np=class{constructor(s,e,t){this._bufferService=s,this._optionsService=e,this._oscLinkService=t}provideLinks(s,e){let t=this._bufferService.buffer.lines.get(s-1);if(!t){e(void 0);return}let i=[],n=this._optionsService.rawOptions.linkHandler,r=new Ai,o=t.getTrimmedLength(),a=-1,l=-1,c=!1;for(let h=0;h<o;h++)if(!(l===-1&&!t.hasContent(h))){if(t.loadCell(h,r),r.hasExtendedAttrs()&&r.extended.urlId)if(l===-1){l=h,a=r.extended.urlId;continue}else c=r.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&h===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let u={start:{x:l+1,y:s},end:{x:h+(!c&&h===o-1?1:0),y:s}},p=!1;if(!n?.allowNonHttpProtocols)try{let f=new URL(d);["http:","https:"].includes(f.protocol)||(p=!0)}catch{p=!0}p||i.push({text:d,range:u,activate:(f,_)=>n?n.activate(f,_,u):_4(f,_),hover:(f,_)=>n?.hover?.(f,_,u),leave:(f,_)=>n?.leave?.(f,_,u)})}c=!1,r.hasExtendedAttrs()&&r.extended.urlId?(l=h,a=r.extended.urlId):(l=-1,a=-1)}}e(i)}};Np=Qt([Ce(0,Xs),Ce(1,Zs),Ce(2,Oz)],Np);function _4(s,e){if(confirm(`Do you want to navigate to ${e}?
|
|
4308
4308
|
|
|
4309
4309
|
WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var wd=Ss("CharSizeService"),Pn=Ss("CoreBrowserService"),yg=Ss("MouseService"),Ln=Ss("RenderService"),b4=Ss("SelectionService"),Ez=Ss("CharacterJoinerService"),ba=Ss("ThemeService"),Az=Ss("LinkProviderService"),M4=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(s){setTimeout(()=>{throw s.stack?dM.isErrorNoTelemetry(s)?new dM(s.message+`
|
|
@@ -4327,7 +4327,7 @@ WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){t
|
|
|
4327
4327
|
`).slice(2).join(`
|
|
4328
4328
|
`))}},kU=class extends Error{constructor(s,e){super(s),this.name="ListenerLeakError",this.stack=e}},BU=class extends Error{constructor(s,e){super(s),this.name="ListenerRefusalError",this.stack=e}},NU=0,Zu=class{constructor(s){this.value=s,this.id=NU++}},GU=2,PU,Zn=class{constructor(s){this._size=0,this._options=s,this._leakageMon=this._options?.leakWarningThreshold?new CU(s?.onListenerError??Xu,this._options?.leakWarningThreshold??IU):void 0,this._perfMon=this._options?._profName?new TU(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(s,e,t)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new BU(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||Xu)(l),qh.None}if(this._disposed)return qh.None;e&&(s=s.bind(e));let i=new Zu(s),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=RU.create(),n=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Zu?(this._deliveryQueue??=new LU,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=cS(()=>{n?.(),this._removeListener(i)});return t instanceof Ig?t.add(r):Array.isArray(t)&&t.push(r),r},this._event}_removeListener(s){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,t=e.indexOf(s);if(t===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[t]=void 0;let i=this._deliveryQueue.current===this;if(this._size*GU<=e.length){let n=0;for(let r=0;r<e.length;r++)e[r]?e[n++]=e[r]:i&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=n}}_deliver(s,e){if(!s)return;let t=this._options?.onListenerError||Xu;if(!t){s.value(e);return}try{s.value(e)}catch(i){t(i)}}_deliverQueue(s){let e=s.current._listeners;for(;s.i<s.end;)this._deliver(e[s.i++],s.value);s.reset()}fire(s){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Zu)this._deliver(this._listeners,s);else{let e=this._deliveryQueue;e.enqueue(this,s,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},LU=class{constructor(){this.i=-1,this.end=0}enqueue(s,e,t){this.i=0,this.end=t,this.current=s,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Kh=class oh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Zn,this.onChange=this._onChange.event;let e=new MU;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(e&16777215)<<3|(t&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,i=0,n=e.length;for(let r=0;r<n;++r){let o=e.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=n)return t+this.wcwidth(o);let c=e.charCodeAt(r);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:t+=this.wcwidth(c)}let a=this.charProperties(o,i),l=oh.extractWidth(a);oh.extractShouldJoin(a)&&(l-=oh.extractWidth(i)),t+=l,i=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Ju=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],WU=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],Qu=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],FU=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],bn;function sv(s,e){let t=0,i=e.length-1,n;if(s<e[0][0]||s>e[i][1])return!1;for(;i>=t;)if(n=t+i>>1,s>e[n][1])t=n+1;else if(s<e[n][0])i=n-1;else return!0;return!1}var UU=class{constructor(){if(this.version="11",!bn){bn=new Uint8Array(65536),bn.fill(1),bn[0]=0,bn.fill(0,1,32),bn.fill(0,127,160);for(let s=0;s<Ju.length;++s)bn.fill(0,Ju[s][0],Ju[s][1]+1);for(let s=0;s<Qu.length;++s)bn.fill(2,Qu[s][0],Qu[s][1]+1)}}wcwidth(s){return s<32?0:s<127?1:s<65536?bn[s]:sv(s,WU)?0:sv(s,FU)?2:1}charProperties(s,e){let t=this.wcwidth(s),i=t===0&&e!==0;if(i){let n=Kh.extractWidth(e);n===0?i=!1:n>t&&(t=n)}return Kh.createPropertyValue(0,t,i)}},$U=class{activate(s){s.unicode.register(new UU)}dispose(){}};var jU=class{constructor(s,e,t,i={}){this._terminal=s,this._regex=e,this._handler=t,this._options=i}provideLinks(s,e){let t=VU.computeLink(s,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(s){return s.map(e=>(e.leave=this._options.leave,e.hover=(t,i)=>{if(this._options.hover){let{range:n}=e;this._options.hover(t,i,n)}},e))}};function HU(s){try{let e=new URL(s),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return s.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}var VU=class ah{static computeLink(e,t,i,n){let r=new RegExp(t.source,(t.flags||"")+"g"),[o,a]=ah._getWindowedLineStrings(e-1,i),l=o.join(""),c,h=[];for(;c=r.exec(l);){let d=c[0];if(!HU(d))continue;let[u,p]=ah._mapStrIdx(i,a,0,c.index),[f,_]=ah._mapStrIdx(i,u,p,d.length);if(u===-1||p===-1||f===-1||_===-1)continue;let g={start:{x:p+1,y:u+1},end:{x:_,y:f+1}};h.push({range:g,text:d,activate:n})}return h}static _getWindowedLineStrings(e,t){let i,n=e,r=e,o=0,a="",l=[];if(i=t.buffer.active.getLine(e)){let c=i.translateToString(!0);if(i.isWrapped&&c[0]!==" "){for(o=0;(i=t.buffer.active.getLine(--n))&&o<2048&&(a=i.translateToString(!0),o+=a.length,l.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););l.reverse()}for(l.push(c),o=0;(i=t.buffer.active.getLine(++r))&&i.isWrapped&&o<2048&&(a=i.translateToString(!0),o+=a.length,l.push(a),a.indexOf(" ")===-1););}return[l,n]}static _mapStrIdx(e,t,i,n){let r=e.buffer.active,o=r.getNullCell(),a=i;for(;n;){let l=r.getLine(t);if(!l)return[-1,-1];for(let c=a;c<l.length;++c){l.getCell(c,o);let h=o.getChars();if(o.getWidth()&&(n-=h.length||1,c===l.length-1&&h==="")){let d=r.getLine(t+1);d&&d.isWrapped&&(d.getCell(0,o),o.getWidth()===2&&(n+=1))}if(n<0)return[t,c]}t++,a=0}return[t,a]}},qU=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function KU(s,e){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var YU=class{constructor(s=KU,e={}){this._handler=s,this._options=e}activate(s){this._terminal=s;let e=this._options,t=e.urlRegex||qU;this._linkProvider=this._terminal.registerLinkProvider(new jU(this._terminal,t,this._handler,e))}dispose(){this._linkProvider?.dispose()}};const XU=6677;function ZU(s){const e=/^state=(idle|busy|asking|playing)$/.exec(s.trim());return e===null?null:e[1]}const vm="argus.terminalId",JU="'JetBrainsMono NF Mono', 'MesloLGS NF', monospace",QU=[{label:"ESC",data:"\x1B"},{label:"TAB",data:" "},{label:"CTRL",data:"ctrl"},{label:"←",data:"\x1B[D"},{label:"↑",data:"\x1B[A"},{label:"↓",data:"\x1B[B"},{label:"→",data:"\x1B[C"}];function e5(s){const[e,t,i,n,r,o,a,l,c,h,d,u,p,f,_,g]=VO;return{background:"#000000",foreground:s,cursor:s,cursorAccent:"#000000",selectionBackground:"#44556680",black:e,red:t,green:i,yellow:n,blue:r,magenta:o,cyan:a,white:l,brightBlack:c,brightRed:h,brightGreen:d,brightYellow:u,brightBlue:p,brightMagenta:f,brightCyan:_,brightWhite:g}}function t5(s){if(s.length!==1)return s;const e=s.toUpperCase().charCodeAt(0);return e>=64&&e<=95?String.fromCharCode(e-64):s}function s5(){try{return sessionStorage.getItem(vm)??void 0}catch{return}}function iv(s){try{s===null?sessionStorage.removeItem(vm):sessionStorage.setItem(vm,s)}catch{}}class i5{constructor(e,t,i,n=()=>{}){this.mount=e,this.wire=t,this.refused=i,this.state=n;const r=getComputedStyle(e).color||"#ffaa44";this.term=new fU({fontFamily:JU,fontSize:Math.max(10,Math.floor(parseFloat(getComputedStyle(e).fontSize)||13)),theme:e5(r),cursorBlink:!0,scrollback:5e3,allowProposedApi:!0}),this.term.loadAddon(this.fit),this.term.loadAddon(new YU),this.term.loadAddon(new $U),this.term.unicode.activeVersion="11";const o=document.createElement("div");o.className="argus-xterm",e.appendChild(o),this.term.open(o),this.keyRow_build(),this.term.onData(a=>this.keys_send(a)),this.term.onLineFeed(()=>{this.feeds++}),this.term.parser.registerOscHandler(XU,a=>{const l=ZU(a);return l!==null&&this.state(l),!0}),this.term.onResize(({cols:a,rows:l})=>{this.terminalId!==null&&this.wire.resize(this.terminalId,a,l)}),this.observer=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.size_fit()),this.observer?.observe(e),this.size_fit(),this.wire.open(this.term.cols,this.term.rows,s5())}mount;wire;refused;state;term;fit=new gU;terminalId=null;ended=!1;ctrlHeld=!1;resizeFrame=null;feeds=0;observer;size_fit(){this.resizeFrame===null&&(this.resizeFrame=requestAnimationFrame(()=>{if(this.resizeFrame=null,this.mount.offsetParent!==null)try{this.fit.fit()}catch{}}))}terminalId_get(){return this.terminalId}focus(){this.term.focus()}opened(e,t,i){if(i!==void 0){this.refused(i);return}this.terminalId=e,this.ended=!1,iv(e),t!==""&&this.term.write(t),this.wire.resize(e,this.term.cols,this.term.rows)}data(e,t){e===this.terminalId&&this.term.write(t)}exited(e,t){e===this.terminalId&&(this.ended=!0,this.terminalId=null,iv(null),this.term.write(`\r
|
|
4329
4329
|
\x1B[90m[the console's shell exited${t===0?"":` (${t})`}; press a key for a new one]\x1B[0m\r
|
|
4330
|
-
`))}offer(e){this.terminalId!==null&&this.wire.input(this.terminalId,`${e}`),this.focus()}buffer_lines(){const e=this.term.buffer.active,t=[];for(let i=0;i<e.length;i++){const n=e.getLine(i),r=n?.translateToString(!0)??"";n?.isWrapped===!0&&t.length>0?t[t.length-1]+=r:t.push(r)}for(;t.length>0&&t[t.length-1]==="";)t.pop();return t}mark(){return this.feeds}lines_since(e){const t=this.buffer_lines(),i=Math.max(0,this.feeds-e)+1;return t.slice(Math.max(0,t.length-i))}type(e){this.keys_send(e)}dispose(){this.observer?.disconnect(),this.term.dispose()}keys_send(e){if(this.ended){this.ended=!1,this.term.reset(),this.wire.open(this.term.cols,this.term.rows);return}if(this.terminalId===null)return;let t=e;this.ctrlHeld&&(t=t5(e),this.ctrlHeld=!1,this.mount.querySelector(".argus-xterm-key.held")?.classList.remove("held")),this.wire.input(this.terminalId,t)}keyRow_build(){const e=document.createElement("div");e.className="argus-xterm-keys";for(const t of QU){const i=document.createElement("button");i.type="button",i.className="argus-xterm-key",i.textContent=t.label,i.addEventListener("pointerdown",n=>{n.preventDefault(),t.data==="ctrl"?(this.ctrlHeld=!this.ctrlHeld,i.classList.toggle("held",this.ctrlHeld)):this.keys_send(t.data),this.focus()}),e.appendChild(i)}this.mount.appendChild(e)}}const n5="argus.consoleMode",r5="console: the transcript, deprecated: this host offers no pseudo-terminal (node-pty did not build). Install python, make and g++ and reinstall for the terminal console.";function o5(){try{localStorage.removeItem(n5)}catch{}}function a5(s){const{client:e,terminal:t,offered:i}=s,n=document.getElementById("terminal");let r=null,o="transcript";const a=l=>{if(n!==null)if(l==="terminal"&&i){if(n.classList.add("console-terminal"),r===null){const h=document.createElement("div");h.className="argus-terminal-mount",n.appendChild(h),r=new i5(h,{open:(d,u,p)=>e.terminal_open(d,u,p),input:(d,u)=>e.terminal_input(d,u),resize:(d,u,p)=>e.terminal_resize(d,u,p)},d=>{a("transcript"),t.line_note(`console: ${d}`)},d=>{n.dataset.terminalState=d}),n.dataset.terminalState="busy",s.screen_set(r)}const c=r;e.mirror_set(!0),t.delegate_set({note:h=>e.note_send(h),offer:h=>c.offer(h),focus:()=>c.focus(),fit:()=>c.size_fit()}),c.size_fit(),o="terminal"}else n.classList.remove("console-terminal"),e.mirror_set(!1),t.delegate_set(null),o="transcript"};return o5(),a(i?"terminal":"transcript"),i||t.line_note(r5),Object.assign(globalThis,{__argusConsole:{mode:()=>o,state:()=>n?.dataset.terminalState??"busy",type:l=>r?.type(l),lines:()=>r?.buffer_lines()??[],mark:()=>r?.mark()??0,since:l=>r?.lines_since(l)??[]}}),{terminal_is:()=>o==="terminal",question_sheet:async l=>{document.querySelector(".question-sheet")?.remove();const c=document.createElement("div");c.className="share-sheet question-sheet",c.setAttribute("role","dialog");const h=document.createElement("div");h.className="share-head",h.textContent="THE SESSION ASKS",c.appendChild(h),document.body.appendChild(c);try{return await mg(t,c,l)}finally{c.remove()}}}}const l5=new Set(["busy","asking","playing"]);function c5(s,e=()=>null){const t=document.querySelector(".console-stop"),i=document.getElementById("terminal");if(t===null||i===null)return;const n=()=>{const o=i.classList.contains("console-terminal")?l5.has(i.dataset.terminalState??""):i.dataset.busy==="true";t.hidden=!o};new MutationObserver(n).observe(i,{attributes:!0,attributeFilter:["data-busy","data-terminal-state","class"]}),n(),t.addEventListener("click",()=>{const r=i.classList.contains("console-terminal")?e():null;r!==null&&s.terminal_input(r,""),s.stop_send()})}let Wr=()=>{};function nv(){Wr(document.body.dataset.zoom==="console"?null:"console")}const h5=NS(),d5=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" fill="#000"/><rect x="6" y="14" width="52" height="36" rx="18" fill="#20bdef"/><rect x="34" y="14" width="24" height="36" fill="#20bdef"/></svg>')}`;function u5(s){for(const e of document.querySelectorAll('link[rel="icon"], link[rel="apple-touch-icon"]'))e.href=s}const f5="ARGUS",rv="argus-audio",p5=.4;let Jn=!1;const m5={audio1:{file:"press",cue:"press"},audio2:{file:"arrive",cue:"ack"},audio3:{file:"retreat",cue:"close"},audio4:{file:"refuse",cue:"deny"}},gS=new Set;function g5(){fetch("sounds/index.json").then(s=>s.ok?s.json():Promise.resolve(null)).then(s=>{const e=typeof s=="object"&&s!==null?s.files:void 0;if(Array.isArray(e))for(const t of e)typeof t=="string"&&gS.add(t.replace(/\.[a-z0-9]+$/,""))}).catch(()=>{})}function xi(s){if(Jn)return;const e=m5[s];if(e!==void 0&&!gS.has(e.file)){jr.cue_play(e.cue);return}const t=document.getElementById(s);t instanceof HTMLAudioElement&&(t.currentTime=0,t.volume=p5,t.play().catch(()=>{}))}function _5(){const s=st("head-menu-pill"),e=t=>{t?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,s.setAttribute("aria-expanded",String(t))};s.addEventListener("click",t=>{t.stopPropagation(),e(document.body.dataset.headMenu!=="open")}),document.addEventListener("click",t=>{if(document.body.dataset.headMenu!=="open")return;t.target instanceof Element&&t.target.closest("#header-dag-info")!==null||e(!1)})}function b5(){const s=st("audio-pill");try{Jn=window.localStorage.getItem(rv)==="off"}catch{Jn=!1}const e=()=>{s.classList.toggle("audio-off",Jn),jr.muted_set(Jn)};e(),g5(),s.addEventListener("click",()=>{Jn=!Jn;try{window.localStorage.setItem(rv,Jn?"off":"on")}catch{}e(),xi("audio2")})}function M5(){return GS(window.location)}let ef=null,Yh=0;function Cg(s,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(Yh=Math.ceil(s.offsetTop+s.offsetHeight),e.style.setProperty("--zoom-header-height",`${Yh}px`))};t(),ef===null&&(ef=new ResizeObserver(t),ef.observe(s))}const ov=120,v5=96;function w5(s,e,t,i){let n="";const r=h=>{h?(n=s.style.height,s.style.height=""):n!==""&&(s.style.height=n),s.classList.toggle("drawer-closed",h),xi("audio3"),h||(i.size_fit(),i.focus_take())};t.addEventListener("click",()=>r(!s.classList.contains("drawer-closed")));let o=0,a=0,l=!1;e.addEventListener("pointerdown",h=>{l=!0,o=h.clientY,a=s.getBoundingClientRect().height,s.classList.add("drawer-dragging"),e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{if(!l)return;const d=Math.max(ov,window.innerHeight-v5),u=a+(h.clientY-o),p=Math.min(Math.max(ov,u),d);s.style.height=`${p}px`,i.size_fit()});const c=()=>{l=!1,s.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function y5(s){const e=document.body,t=document.querySelector(".wrap:not(#gap)");let i;const n=r=>{for(const o of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))o.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,i!==void 0&&(e.dataset.header=i,i=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(i="away",delete e.dataset.header,Yh>0&&e.style.setProperty("--zoom-header-height",`${Yh}px`)):t!==null&&Cg(t,e),e.dataset.zoom=r;const a=Zc(r)?.mount?.parentElement??null;a?.classList.add("pane-zoomed");let l=a?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const o of document.querySelectorAll(".drawer-zoom"))o.textContent=r!==null&&o.dataset.pane===r?"RESTORE":"ZOOM";xi("audio3")};return st("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&n(null)}),document.addEventListener("click",r=>{const o=r.target;if(!(o instanceof Element))return;const a=o.closest("[data-pane]");if(a===null)return;const l=a.dataset.pane??"";l!==""&&n(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(n(null),r.stopImmediatePropagation())}),st("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&s.size_fit()}),n}function z5(){const s=new EP(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&s.telemetryPanel_bind(e),s}const tf=96,S5=220,av="argus.headerBand.height",x5=52;function O5(){const s=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const i=h=>{const d=Math.max(tf,window.innerHeight-S5),u=Math.min(Math.max(tf,h),d);s.style.setProperty("--header-band-h",`${u}px`);try{window.localStorage.setItem(av,String(u))}catch{}},n=(()=>{try{return window.localStorage.getItem(av)}catch{return null}})();n!==null&&Number.isFinite(Number(n))&&i(Number(n));const r=()=>{const h=t.getBoundingClientRect();e.style.top=`${Math.max(0,h.bottom-x5)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let o=!1,a=0,l=0;e.addEventListener("pointerdown",h=>{const d=document.querySelector(".header-face");o=!0,a=h.clientY,l=d===null?tf:d.getBoundingClientRect().height,e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{o&&(i(l+(h.clientY-a)),r())});const c=()=>{o=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let Rg=null;function E5(s){const e=s.querySelector(".gather-rows");if(e===null)return;const t=mi(e,{rows:".listing-row",label:i=>`+${i} MORE · ON STAGE`,press:()=>{Rg?.()},className:"strategy-pill gather-more",mount:s});t.title="the whole cohort as a pane on the main panel"}function lv(s){mi(s,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function A5(){const s=e=>{for(const t of e.querySelectorAll(".mode-frame:not([data-more])"))lv(t)};new MutationObserver(e=>{for(const t of e)for(const i of t.addedNodes)i instanceof HTMLElement&&(i.matches(".mode-frame")&&i.dataset.more===void 0&&lv(i),s(i))}).observe(document.body,{childList:!0,subtree:!0}),s(document)}function cv(s){const e=s?.text;if(typeof e!="string"||e.length===0||typeof window.speechSynthesis>"u")return;const t=new SpeechSynthesisUtterance(e);t.rate=1,window.speechSynthesis.speak(t)}function D5(){const s=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{s.dataset.header===r?(e!==null&&Cg(e,s),s.dataset.header="away"):s.dataset.header=r};document.querySelector(".panel-1")?.addEventListener("click",()=>t("stats")),document.querySelector(".panel-2")?.addEventListener("click",()=>t("dag")),document.querySelector(".panel-gather")?.addEventListener("click",()=>t("gather"));const i=document.querySelector(".header-gather-field");i?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),Rg?.()}),i!==null&&E5(i),A5();const n=()=>{s.dataset.zoom===void 0&&(delete s.dataset.header,xi("audio3"))};st("header-restore").addEventListener("click",n),window.addEventListener("keydown",r=>{r.key==="Escape"&&s.dataset.header==="away"&&s.dataset.zoom===void 0&&s.dataset.gutter!=="away"&&n()})}const Vo=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],_S="argus-landing",T5=15e3;function hv(){try{return(window.localStorage.getItem(_S)??"launcher")==="launcher"}catch{return!0}}function I5(s){try{window.localStorage.setItem(_S,s?"launcher":"last")}catch{}}const dv="argus-theme",C5="argus-lcars",R5="medical",k5={sickbay:"medical"};function B5(){const s=st("theme-pill"),e=Math.max(Vo.findIndex(r=>r.key===R5),0);let t=e;try{const r=window.localStorage.getItem(dv)??window.localStorage.getItem(C5),o=r===null?null:k5[r]??r,a=Vo.findIndex(l=>l.key===o);t=a>=0?a:e}catch{t=e}const i=document.documentElement,n=()=>{const r=Vo[t]??Vo[0];r.key==="lower-decks"?delete i.dataset.theme:i.dataset.theme=r.key,s.textContent=r.label};n(),s.addEventListener("click",()=>{t=(t+1)%Vo.length,n();try{window.localStorage.setItem(dv,Vo[t]?.key??"lower-decks")}catch{}xi("audio2")})}function N5(s){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const i={...$O(s)==="chris"?{cumin:s.stack?.cumin,salsa:s.stack?.salsa,chili:s.stack?.chili}:{},brasa:s.stack?.brasa,calypso:s.stack?.calypso,chell:s.stack?.chell},n=[];for(const[r,o]of Object.entries(i))o!==void 0&&n.push([r.toUpperCase(),o]);n.push(["MENU","0.27.0"],["ARGUS","6b604eef · 2026-10-20 02:03Z"],["WIRE",`V${s.protocolVersion}`]),s.stack?.build!==void 0&&n.push(["BUILD",s.stack.build]);for(const[r,o]of n){const a=document.createElement("div");a.className="telemetry-row";const l=document.createElement("span");l.className="telemetry-label",l.textContent=r;const c=document.createElement("span");c.className="telemetry-value",c.textContent=o,c.title=o,a.append(l,c),e.appendChild(a)}}function G5(){for(const s of document.querySelectorAll(".left-frame button, .left-frame-top button"))s.addEventListener("click",()=>xi("audio2"))}let Ko=null;async function P5(s){let e=null;const t=await LS(s),i=t==="chris";document.body.dataset.composition=t;const n=new vP(document),r=i?pP(st("index-instrument"),{dag_primary:()=>Tt,dag_instances:()=>a.values("dag"),universes:()=>a.values("universe"),pacs:()=>A,runs_show:R=>Wn(R)}):{promptContext_take:()=>{},telemetry_take:()=>{},progress_take:()=>{}},o=new yP(st("lane-instrument"));window.setInterval(()=>o.tick(),500);const a=new $G;i&&tT(kP(()=>q));const l=new gP;l.writeObserver_set((R,$)=>{bt.regard_send({address:R.address,...R.modelKind!==void 0?{modelKind:R.modelKind}:{},groupId:$,paneId:R.paneId}),K()});const c={get layout(){return U},panels:a,paneInstance_get:Zc,subjects:l,get dormant(){return ie},sound:xi,get terminal(){return fe},get client(){return bt}},h=HP(c,{catalogue_of:R=>D.get(R),run_press:(R,$,re)=>{le(R,$,re)}}),d=h.entry_show,u=R=>ym(R,s),p=NG(c,{vfsUrl_build:u,downloadUrl_build:R=>WS(R,s),image_open:(R,$)=>k(R,$),process_open:(R,$)=>N(R,$),run_press:(R,$,re)=>{le(R,$,re)},cohort_gather:R=>ee(R),verbLine_run:(R,$)=>At(R,$),ask_onPane:(R,$)=>G(R,$),binEntry_show:d,catalogue_of:R=>D.get(R),promptUser:()=>M,template_stamp:Pi,pane_find:Vs}),{previewProvider:f,fileText_fetch:_,file_save:g,rootedListing_show:m,listing_refresh:v,directory_make:y,files_deliver:b,filesBody_stamp:w,rowVerbs_of:z}=p,O=p.instance_build;let M=null,S=null;const D=new Map,{imageInstance_build:T,tagsInstance_build:E,tagsPane_follow:x,tagsPane_open:C,series_ask:I,image_open:k}=cP({client:()=>bt,terminal:()=>fe,panels:()=>a,subjects:()=>l,layout:()=>U,desktop:()=>se,instance_spawn:(R,$)=>Te(R,$),errandHost_find:()=>H(),launcher_yield:()=>be(),birth_record:(R,$,re,pe,Ne)=>_e(R,$,re,pe,Ne),vfsUrl_build:R=>u(R)}),N=(R,$)=>{be();const re=new Set(U.panes_shown());for(const[tt,ns]of D)if(re.has(tt)&&ns.input===$.input){U.focus_set(tt);return}const pe=re.has(R)?R:H()??R,Ne=Te("catalogue",R);if(!U.leaf_split(pe,se.replayPlace_get()?.dir??"col",Ne.id,se.replayPlace_get()?.before??!1)){Ds(Ne.id),U.mount_remove(Ne.id);return}_e(Ne.id,pe,se.replayPlace_get()?.dir??"col",se.replayPlace_get()?.before??!1),D.set(Ne.id,$);const Ue=a.get("files",Ne.id);Ue!==void 0&&(Ue.binding_set({input:$.input,place:$.feed===null?"new feed":`feed ${$.feed}${$.node===null?"":` · node ${$.node}`}`}),Ue.feedOpen_declare(tt=>Y(Ne.id,tt)),m(Ne.id,Ue,"/bin"),J(Ue),U.focus_set(Ne.id))},P=5,F=40,J=R=>{bt.line_execute(`plugininstance list --limit ${F} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(re=>{const pe=[];for(const Ne of re.envelopes)if(!(Ne.model?.kind!=="plugininstance.list"||!Array.isArray(Ne.model.data)))for(const Ue of Ne.model.data){if(typeof Ue.pluginName!="string"||typeof Ue.pluginVersion!="string"||M!==null&&typeof Ue.owner=="string"&&Ue.owner!==M||Ue.pluginName==="pl-dircopy")continue;const tt=`${Ue.pluginName}-v${Ue.pluginVersion}`;if(pe.includes(tt)||pe.push(tt),pe.length>=P)break}R.recent_set(pe.length===0?null:pe)}).catch(()=>{})},Y=(R,$)=>{be();const re=new Set(U.panes_shown());for(const[Ue,tt]of a.entries("dag"))if(Ue!=="dag"&&re.has(Ue)&&tt.feed_get()===$){U.focus_set(Ue);return}const pe=re.has(R)?R:H()??R,Ne=Te("dag",R);if(!U.leaf_split(pe,se.replayPlace_get()?.dir??"col",Ne.id,se.replayPlace_get()?.before??!1)){Ds(Ne.id),U.mount_remove(Ne.id);return}_e(Ne.id,pe,se.replayPlace_get()?.dir??"col",se.replayPlace_get()?.before??!1),a.get("dag",Ne.id)?.feed_enter($)},le=async(R,$,re)=>{const pe=D.get(R),Ne=a.get("files",R);if(pe===void 0||Ne===void 0)return;const Ue=Js=>{fe.output_write("err",`\x1B[31m${Js}\x1B[0m
|
|
4330
|
+
`))}offer(e){this.terminalId!==null&&this.wire.input(this.terminalId,`${e}`),this.focus()}buffer_lines(){const e=this.term.buffer.active,t=[];for(let i=0;i<e.length;i++){const n=e.getLine(i),r=n?.translateToString(!0)??"";n?.isWrapped===!0&&t.length>0?t[t.length-1]+=r:t.push(r)}for(;t.length>0&&t[t.length-1]==="";)t.pop();return t}mark(){return this.feeds}lines_since(e){const t=this.buffer_lines(),i=Math.max(0,this.feeds-e)+1;return t.slice(Math.max(0,t.length-i))}type(e){this.keys_send(e)}dispose(){this.observer?.disconnect(),this.term.dispose()}keys_send(e){if(this.ended){this.ended=!1,this.term.reset(),this.wire.open(this.term.cols,this.term.rows);return}if(this.terminalId===null)return;let t=e;this.ctrlHeld&&(t=t5(e),this.ctrlHeld=!1,this.mount.querySelector(".argus-xterm-key.held")?.classList.remove("held")),this.wire.input(this.terminalId,t)}keyRow_build(){const e=document.createElement("div");e.className="argus-xterm-keys";for(const t of QU){const i=document.createElement("button");i.type="button",i.className="argus-xterm-key",i.textContent=t.label,i.addEventListener("pointerdown",n=>{n.preventDefault(),t.data==="ctrl"?(this.ctrlHeld=!this.ctrlHeld,i.classList.toggle("held",this.ctrlHeld)):this.keys_send(t.data),this.focus()}),e.appendChild(i)}this.mount.appendChild(e)}}const n5="argus.consoleMode",r5="console: the transcript, deprecated: this host offers no pseudo-terminal (node-pty did not build). Install python, make and g++ and reinstall for the terminal console.";function o5(){try{localStorage.removeItem(n5)}catch{}}function a5(s){const{client:e,terminal:t,offered:i}=s,n=document.getElementById("terminal");let r=null,o="transcript";const a=l=>{if(n!==null)if(l==="terminal"&&i){if(n.classList.add("console-terminal"),r===null){const h=document.createElement("div");h.className="argus-terminal-mount",n.appendChild(h),r=new i5(h,{open:(d,u,p)=>e.terminal_open(d,u,p),input:(d,u)=>e.terminal_input(d,u),resize:(d,u,p)=>e.terminal_resize(d,u,p)},d=>{a("transcript"),t.line_note(`console: ${d}`)},d=>{n.dataset.terminalState=d}),n.dataset.terminalState="busy",s.screen_set(r)}const c=r;e.mirror_set(!0),t.delegate_set({note:h=>e.note_send(h),offer:h=>c.offer(h),focus:()=>c.focus(),fit:()=>c.size_fit()}),c.size_fit(),o="terminal"}else n.classList.remove("console-terminal"),e.mirror_set(!1),t.delegate_set(null),o="transcript"};return o5(),a(i?"terminal":"transcript"),i||t.line_note(r5),Object.assign(globalThis,{__argusConsole:{mode:()=>o,state:()=>n?.dataset.terminalState??"busy",type:l=>r?.type(l),lines:()=>r?.buffer_lines()??[],mark:()=>r?.mark()??0,since:l=>r?.lines_since(l)??[]}}),{terminal_is:()=>o==="terminal",question_sheet:async l=>{document.querySelector(".question-sheet")?.remove();const c=document.createElement("div");c.className="share-sheet question-sheet",c.setAttribute("role","dialog");const h=document.createElement("div");h.className="share-head",h.textContent="THE SESSION ASKS",c.appendChild(h),document.body.appendChild(c);try{return await mg(t,c,l)}finally{c.remove()}}}}const l5=new Set(["busy","asking","playing"]);function c5(s,e=()=>null){const t=document.querySelector(".console-stop"),i=document.getElementById("terminal");if(t===null||i===null)return;const n=()=>{const o=i.classList.contains("console-terminal")?l5.has(i.dataset.terminalState??""):i.dataset.busy==="true";t.hidden=!o};new MutationObserver(n).observe(i,{attributes:!0,attributeFilter:["data-busy","data-terminal-state","class"]}),n(),t.addEventListener("click",()=>{const r=i.classList.contains("console-terminal")?e():null;r!==null&&s.terminal_input(r,""),s.stop_send()})}let Wr=()=>{};function nv(){Wr(document.body.dataset.zoom==="console"?null:"console")}const h5=NS(),d5=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" fill="#000"/><rect x="6" y="14" width="52" height="36" rx="18" fill="#20bdef"/><rect x="34" y="14" width="24" height="36" fill="#20bdef"/></svg>')}`;function u5(s){for(const e of document.querySelectorAll('link[rel="icon"], link[rel="apple-touch-icon"]'))e.href=s}const f5="ARGUS",rv="argus-audio",p5=.4;let Jn=!1;const m5={audio1:{file:"press",cue:"press"},audio2:{file:"arrive",cue:"ack"},audio3:{file:"retreat",cue:"close"},audio4:{file:"refuse",cue:"deny"}},gS=new Set;function g5(){fetch("sounds/index.json").then(s=>s.ok?s.json():Promise.resolve(null)).then(s=>{const e=typeof s=="object"&&s!==null?s.files:void 0;if(Array.isArray(e))for(const t of e)typeof t=="string"&&gS.add(t.replace(/\.[a-z0-9]+$/,""))}).catch(()=>{})}function xi(s){if(Jn)return;const e=m5[s];if(e!==void 0&&!gS.has(e.file)){jr.cue_play(e.cue);return}const t=document.getElementById(s);t instanceof HTMLAudioElement&&(t.currentTime=0,t.volume=p5,t.play().catch(()=>{}))}function _5(){const s=st("head-menu-pill"),e=t=>{t?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,s.setAttribute("aria-expanded",String(t))};s.addEventListener("click",t=>{t.stopPropagation(),e(document.body.dataset.headMenu!=="open")}),document.addEventListener("click",t=>{if(document.body.dataset.headMenu!=="open")return;t.target instanceof Element&&t.target.closest("#header-dag-info")!==null||e(!1)})}function b5(){const s=st("audio-pill");try{Jn=window.localStorage.getItem(rv)==="off"}catch{Jn=!1}const e=()=>{s.classList.toggle("audio-off",Jn),jr.muted_set(Jn)};e(),g5(),s.addEventListener("click",()=>{Jn=!Jn;try{window.localStorage.setItem(rv,Jn?"off":"on")}catch{}e(),xi("audio2")})}function M5(){return GS(window.location)}let ef=null,Yh=0;function Cg(s,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(Yh=Math.ceil(s.offsetTop+s.offsetHeight),e.style.setProperty("--zoom-header-height",`${Yh}px`))};t(),ef===null&&(ef=new ResizeObserver(t),ef.observe(s))}const ov=120,v5=96;function w5(s,e,t,i){let n="";const r=h=>{h?(n=s.style.height,s.style.height=""):n!==""&&(s.style.height=n),s.classList.toggle("drawer-closed",h),xi("audio3"),h||(i.size_fit(),i.focus_take())};t.addEventListener("click",()=>r(!s.classList.contains("drawer-closed")));let o=0,a=0,l=!1;e.addEventListener("pointerdown",h=>{l=!0,o=h.clientY,a=s.getBoundingClientRect().height,s.classList.add("drawer-dragging"),e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{if(!l)return;const d=Math.max(ov,window.innerHeight-v5),u=a+(h.clientY-o),p=Math.min(Math.max(ov,u),d);s.style.height=`${p}px`,i.size_fit()});const c=()=>{l=!1,s.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function y5(s){const e=document.body,t=document.querySelector(".wrap:not(#gap)");let i;const n=r=>{for(const o of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))o.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,i!==void 0&&(e.dataset.header=i,i=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(i="away",delete e.dataset.header,Yh>0&&e.style.setProperty("--zoom-header-height",`${Yh}px`)):t!==null&&Cg(t,e),e.dataset.zoom=r;const a=Zc(r)?.mount?.parentElement??null;a?.classList.add("pane-zoomed");let l=a?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const o of document.querySelectorAll(".drawer-zoom"))o.textContent=r!==null&&o.dataset.pane===r?"RESTORE":"ZOOM";xi("audio3")};return st("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&n(null)}),document.addEventListener("click",r=>{const o=r.target;if(!(o instanceof Element))return;const a=o.closest("[data-pane]");if(a===null)return;const l=a.dataset.pane??"";l!==""&&n(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(n(null),r.stopImmediatePropagation())}),st("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&s.size_fit()}),n}function z5(){const s=new EP(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&s.telemetryPanel_bind(e),s}const tf=96,S5=220,av="argus.headerBand.height",x5=52;function O5(){const s=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const i=h=>{const d=Math.max(tf,window.innerHeight-S5),u=Math.min(Math.max(tf,h),d);s.style.setProperty("--header-band-h",`${u}px`);try{window.localStorage.setItem(av,String(u))}catch{}},n=(()=>{try{return window.localStorage.getItem(av)}catch{return null}})();n!==null&&Number.isFinite(Number(n))&&i(Number(n));const r=()=>{const h=t.getBoundingClientRect();e.style.top=`${Math.max(0,h.bottom-x5)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let o=!1,a=0,l=0;e.addEventListener("pointerdown",h=>{const d=document.querySelector(".header-face");o=!0,a=h.clientY,l=d===null?tf:d.getBoundingClientRect().height,e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{o&&(i(l+(h.clientY-a)),r())});const c=()=>{o=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let Rg=null;function E5(s){const e=s.querySelector(".gather-rows");if(e===null)return;const t=mi(e,{rows:".listing-row",label:i=>`+${i} MORE · ON STAGE`,press:()=>{Rg?.()},className:"strategy-pill gather-more",mount:s});t.title="the whole cohort as a pane on the main panel"}function lv(s){mi(s,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function A5(){const s=e=>{for(const t of e.querySelectorAll(".mode-frame:not([data-more])"))lv(t)};new MutationObserver(e=>{for(const t of e)for(const i of t.addedNodes)i instanceof HTMLElement&&(i.matches(".mode-frame")&&i.dataset.more===void 0&&lv(i),s(i))}).observe(document.body,{childList:!0,subtree:!0}),s(document)}function cv(s){const e=s?.text;if(typeof e!="string"||e.length===0||typeof window.speechSynthesis>"u")return;const t=new SpeechSynthesisUtterance(e);t.rate=1,window.speechSynthesis.speak(t)}function D5(){const s=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{s.dataset.header===r?(e!==null&&Cg(e,s),s.dataset.header="away"):s.dataset.header=r};document.querySelector(".panel-1")?.addEventListener("click",()=>t("stats")),document.querySelector(".panel-2")?.addEventListener("click",()=>t("dag")),document.querySelector(".panel-gather")?.addEventListener("click",()=>t("gather"));const i=document.querySelector(".header-gather-field");i?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),Rg?.()}),i!==null&&E5(i),A5();const n=()=>{s.dataset.zoom===void 0&&(delete s.dataset.header,xi("audio3"))};st("header-restore").addEventListener("click",n),window.addEventListener("keydown",r=>{r.key==="Escape"&&s.dataset.header==="away"&&s.dataset.zoom===void 0&&s.dataset.gutter!=="away"&&n()})}const Vo=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],_S="argus-landing",T5=15e3;function hv(){try{return(window.localStorage.getItem(_S)??"launcher")==="launcher"}catch{return!0}}function I5(s){try{window.localStorage.setItem(_S,s?"launcher":"last")}catch{}}const dv="argus-theme",C5="argus-lcars",R5="medical",k5={sickbay:"medical"};function B5(){const s=st("theme-pill"),e=Math.max(Vo.findIndex(r=>r.key===R5),0);let t=e;try{const r=window.localStorage.getItem(dv)??window.localStorage.getItem(C5),o=r===null?null:k5[r]??r,a=Vo.findIndex(l=>l.key===o);t=a>=0?a:e}catch{t=e}const i=document.documentElement,n=()=>{const r=Vo[t]??Vo[0];r.key==="lower-decks"?delete i.dataset.theme:i.dataset.theme=r.key,s.textContent=r.label};n(),s.addEventListener("click",()=>{t=(t+1)%Vo.length,n();try{window.localStorage.setItem(dv,Vo[t]?.key??"lower-decks")}catch{}xi("audio2")})}function N5(s){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const i={...$O(s)==="chris"?{cumin:s.stack?.cumin,salsa:s.stack?.salsa,chili:s.stack?.chili}:{},brasa:s.stack?.brasa,calypso:s.stack?.calypso,chell:s.stack?.chell},n=[];for(const[r,o]of Object.entries(i))o!==void 0&&n.push([r.toUpperCase(),o]);n.push(["MENU","0.27.0"],["ARGUS","570d9e7c · 2026-10-20 13:48Z"],["WIRE",`V${s.protocolVersion}`]),s.stack?.build!==void 0&&n.push(["BUILD",s.stack.build]);for(const[r,o]of n){const a=document.createElement("div");a.className="telemetry-row";const l=document.createElement("span");l.className="telemetry-label",l.textContent=r;const c=document.createElement("span");c.className="telemetry-value",c.textContent=o,c.title=o,a.append(l,c),e.appendChild(a)}}function G5(){for(const s of document.querySelectorAll(".left-frame button, .left-frame-top button"))s.addEventListener("click",()=>xi("audio2"))}let Ko=null;async function P5(s){let e=null;const t=await LS(s),i=t==="chris";document.body.dataset.composition=t;const n=new vP(document),r=i?pP(st("index-instrument"),{dag_primary:()=>Tt,dag_instances:()=>a.values("dag"),universes:()=>a.values("universe"),pacs:()=>A,runs_show:R=>Wn(R)}):{promptContext_take:()=>{},telemetry_take:()=>{},progress_take:()=>{}},o=new yP(st("lane-instrument"));window.setInterval(()=>o.tick(),500);const a=new $G;i&&tT(kP(()=>q));const l=new gP;l.writeObserver_set((R,$)=>{bt.regard_send({address:R.address,...R.modelKind!==void 0?{modelKind:R.modelKind}:{},groupId:$,paneId:R.paneId}),K()});const c={get layout(){return U},panels:a,paneInstance_get:Zc,subjects:l,get dormant(){return ie},sound:xi,get terminal(){return fe},get client(){return bt}},h=HP(c,{catalogue_of:R=>D.get(R),run_press:(R,$,re)=>{le(R,$,re)}}),d=h.entry_show,u=R=>ym(R,s),p=NG(c,{vfsUrl_build:u,downloadUrl_build:R=>WS(R,s),image_open:(R,$)=>k(R,$),process_open:(R,$)=>N(R,$),run_press:(R,$,re)=>{le(R,$,re)},cohort_gather:R=>ee(R),verbLine_run:(R,$)=>At(R,$),ask_onPane:(R,$)=>G(R,$),binEntry_show:d,catalogue_of:R=>D.get(R),promptUser:()=>M,template_stamp:Pi,pane_find:Vs}),{previewProvider:f,fileText_fetch:_,file_save:g,rootedListing_show:m,listing_refresh:v,directory_make:y,files_deliver:b,filesBody_stamp:w,rowVerbs_of:z}=p,O=p.instance_build;let M=null,S=null;const D=new Map,{imageInstance_build:T,tagsInstance_build:E,tagsPane_follow:x,tagsPane_open:C,series_ask:I,image_open:k}=cP({client:()=>bt,terminal:()=>fe,panels:()=>a,subjects:()=>l,layout:()=>U,desktop:()=>se,instance_spawn:(R,$)=>Te(R,$),errandHost_find:()=>H(),launcher_yield:()=>be(),birth_record:(R,$,re,pe,Ne)=>_e(R,$,re,pe,Ne),vfsUrl_build:R=>u(R)}),N=(R,$)=>{be();const re=new Set(U.panes_shown());for(const[tt,ns]of D)if(re.has(tt)&&ns.input===$.input){U.focus_set(tt);return}const pe=re.has(R)?R:H()??R,Ne=Te("catalogue",R);if(!U.leaf_split(pe,se.replayPlace_get()?.dir??"col",Ne.id,se.replayPlace_get()?.before??!1)){Ds(Ne.id),U.mount_remove(Ne.id);return}_e(Ne.id,pe,se.replayPlace_get()?.dir??"col",se.replayPlace_get()?.before??!1),D.set(Ne.id,$);const Ue=a.get("files",Ne.id);Ue!==void 0&&(Ue.binding_set({input:$.input,place:$.feed===null?"new feed":`feed ${$.feed}${$.node===null?"":` · node ${$.node}`}`}),Ue.feedOpen_declare(tt=>Y(Ne.id,tt)),m(Ne.id,Ue,"/bin"),J(Ue),U.focus_set(Ne.id))},P=5,F=40,J=R=>{bt.line_execute(`plugininstance list --limit ${F} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(re=>{const pe=[];for(const Ne of re.envelopes)if(!(Ne.model?.kind!=="plugininstance.list"||!Array.isArray(Ne.model.data)))for(const Ue of Ne.model.data){if(typeof Ue.pluginName!="string"||typeof Ue.pluginVersion!="string"||M!==null&&typeof Ue.owner=="string"&&Ue.owner!==M||Ue.pluginName==="pl-dircopy")continue;const tt=`${Ue.pluginName}-v${Ue.pluginVersion}`;if(pe.includes(tt)||pe.push(tt),pe.length>=P)break}R.recent_set(pe.length===0?null:pe)}).catch(()=>{})},Y=(R,$)=>{be();const re=new Set(U.panes_shown());for(const[Ue,tt]of a.entries("dag"))if(Ue!=="dag"&&re.has(Ue)&&tt.feed_get()===$){U.focus_set(Ue);return}const pe=re.has(R)?R:H()??R,Ne=Te("dag",R);if(!U.leaf_split(pe,se.replayPlace_get()?.dir??"col",Ne.id,se.replayPlace_get()?.before??!1)){Ds(Ne.id),U.mount_remove(Ne.id);return}_e(Ne.id,pe,se.replayPlace_get()?.dir??"col",se.replayPlace_get()?.before??!1),a.get("dag",Ne.id)?.feed_enter($)},le=async(R,$,re)=>{const pe=D.get(R),Ne=a.get("files",R);if(pe===void 0||Ne===void 0)return;const Ue=Js=>{fe.output_write("err",`\x1B[31m${Js}\x1B[0m
|
|
4331
4331
|
`);const Od=Ne.indicated_get();Od!==null&&Ne.rowReadout_show(Od,Js.toUpperCase().slice(0,80))};if(re==="pipeline"&&pe.node===null){Ue(`${$}: a pipeline runs on a node — PROCESS a node of a feed`);return}let tt=Ne.commandLine_get();if((tt===""||zw(tt)!==$)&&(tt=vw(pe.input,$)),pe.feed===null&&!dT(tt)){const Js=pe.input.split("/").filter(Boolean).pop()??"feed",Fg=(await G(R,{message:"Feed title: ",kind:"text",suggest:Js,commit:"RUN"})??"").trim();if(Fg==="")return;tt=uT(tt,Fg)}Ne.commandLine_set(tt),fe.line_echo(tt);let ns;try{ns=await bt.line_execute(tt,{silent:!0})}catch(Js){Ue(Js instanceof Error?Js.message:String(Js));return}fe.outcome_write(ns),ns.envelopes.some(Js=>Js.model?.kind==="fs.cwd")&&bt.line_execute("ls",{silent:!0});const Nl=ns.envelopes.find(Js=>Js.model?.kind==="run.scheduled")?.model?.data;if(typeof Nl?.feedId=="number"){Ne.run_show(Nl.feedId);return}const Lg=ns.envelopes.map(Js=>Js.renderedErr??"").join(" ").replace(/\x1b\[[0-9;]*m/g,"").trim().split(`
|
|
4332
4332
|
`)[0]??"",Wg=Ne.indicated_get();Wg!==null&&Ne.rowReadout_show(Wg,Lg===""?"NOT SCHEDULED":Lg.toUpperCase().slice(0,80))},xe=R=>{be();const $=new Set(U.panes_shown());for(const[tt]of a.entries("files"))if($.has(tt)&&l.regard_get(tt)?.address===R){U.focus_set(tt);return}let re;for(const[tt,ns]of a.entries("image"))if($.has(tt)&&(l.regard_get(tt)?.address===R||ns.state_get()?.path===R)){re=tt;break}const pe=H();if(pe===null)return;const Ne=Te("files",re);if(!U.leaf_split(pe,se.replayPlace_get()?.dir??"col",Ne.id,se.replayPlace_get()?.before??!1)){Ds(Ne.id),U.mount_remove(Ne.id);return}_e(Ne.id,pe,se.replayPlace_get()?.dir??"col",se.replayPlace_get()?.before??!1),re===void 0&&l.regard_write(Ne.id,{address:R,modelKind:"dicom.series"});const Ue=a.get("files",Ne.id);Ue!==void 0&&m(Ne.id,Ue,R)},Re=JP(c,{image_open:(R,$)=>k(R,$),process_open:(R,$)=>N(R,$),feed_open:(R,$)=>Y(R,$),ask_onPane:(R,$)=>G(R,$),errandHost_find:()=>H(),instance_spawn:(R,$)=>Te(R,$),birth_record:(R,$,re,pe)=>_e(R,$,re,pe),replayPlace_get:()=>se.replayPlace_get(),stage_relight:()=>K(),home_apply:()=>Ve(),orphans_dispose:()=>ye(),fileText_fetch:_,template_stamp:Pi,pane_find:Vs,element_require:st}),ke=Re.instance_build,ee=Re.gather,ne=Re.open,de=R=>{const $=Pi("tpl-pane-view");mi(Vs($,".view-body"));const re=new mP(Vs($,".view-body"),Vs($,".view-title"),{content_fetch:async pe=>(await _(pe)).text,imageUrl_build:u,path_isImage:id});return a.set("view",R,re),{id:R,kind:"view",mount:$,dispose:()=>{a.delete(R),l.pane_leave(R)}}},Fe=VP(c,{filesBody_stamp:w,rootedListing_show:m,rowVerbs_of:z,image_open:(R,$)=>k(R,$),imagery_is:qy,tableFile_is:R=>Vy.test(R),vfsUrl_build:u,fileText_fetch:_,previewProvider:f}),Ze=Fe.open;Fe.close;const qe=yG(c,{ask_onPane:(R,$)=>G(R,$),promptUser:()=>M,changed:()=>{for(const R of a.values("dag"))R.roster_ask(),R.marks_refresh(),R.indicated_refresh()}}),Ot=LG({client:()=>bt,terminal:()=>fe,panels:()=>a,subjects:()=>l,context:()=>c,feedVerbs:()=>qe,nodeOverlay:()=>Fe,nodeOverlay_open:(R,$)=>Ze(R,$),process_open:(R,$)=>N(R,$),promptUser:()=>M,runs_show:()=>Wn(),dag_primary:()=>Tt,binEntry_show:(R,$,re,pe)=>d(R,$,re,pe),dag_summon:()=>$e()}),Be=O("files",!0);xc(Be);const St=hP({panes:Ot,dicom:{imageInstance_build:T,tagsInstance_build:E},gather_build:ke,pacsMount:st("pacs-workspace")}),_t=i?St:{primaries:[],domains:[],presets:[],factories:[]};for(const R of _t.primaries)xc(R);for(const R of _t.domains)WG(R);const pt=Pi("tpl-pane-launcher");xc({id:"launcher",kind:"launcher",mount:pt});const Wt=Pi("tpl-pane-panes");xc({id:"panes",kind:"panes",mount:Wt});const es=a.get("files","files"),Tt=a.get("dag","dag"),is=new TP(st("pipeline-cycler"),st("pipeline-cycler-name"),R=>{bt.line_execute(R,{silent:!0})});let Gt=null;const Ht=qP(c,{instance_spawn:(R,$)=>Te(R,$),birth_record:(R,$,re,pe)=>_e(R,$,re,pe),replayPlace_get:()=>se.replayPlace_get(),rootedListing_show:m,console_expose:()=>Gt?.(!1),questionSheet_ask:R=>e!==null&&e.terminal_is()?e.question_sheet(R):null}),{errandHost_find:H,errand_open:Rs,verbLine_run:At,ask_onPane:G}=Ht;mi(st("pacs-workspace"),{rows:".listing-row"});const A=new zT(st("pacs-workspace"),{command_run:R=>{const $=/^(pacs query|pull )/.test(R);$&&fe.line_echo(R),bt.line_execute(R,{silent:!0,operator:$}).then(re=>{for(const pe of re.envelopes)A.envelope_observe(pe)})},command_show:R=>{fe.line_run(R)},note:R=>fe.line_note(R),image_open:R=>{k(null,R).then($=>fe.line_note($))},dir_open:R=>xe(R),process_open:R=>N("pacs",{input:R,feed:null,node:null}),gather_add:R=>ee([R]),gathered_is:R=>Re.has(R),workspace_close:()=>Ve()}),K=()=>{const R=new Set(U.panes_shown()),$=new Map;for(const re of Jc()){if(!R.has(re.id))continue;const pe=l.regard_get(re.id)?.address;if(pe===void 0)continue;const Ne=B(re.id);if(Ne!=="image"&&Ne!=="files")continue;const Ue=pe.replace(/\/$/,""),tt=$.get(Ue)??{viewer:!1,browser:!1};Ne==="image"?tt.viewer=!0:tt.browser=!0,$.set(Ue,tt)}A.stage_lit($)},U=new BP(st("layout-root"),new Map([..._t.primaries.map(R=>[R.id,R.mount]),["files",Be.mount],["launcher",pt],["panes",Wt]]));let te=!1;const ge=()=>te?{dir:"col",ratio:.45,first:{pane:"files"},second:{pane:"dag"}}:{pane:"files"};U.preset_register("files",ge);for(const[R,$]of _t.presets)U.preset_register(R,$);U.preset_register("panes",()=>({pane:"panes"})),U.preset_register("launcher",()=>({pane:"launcher"})),U.renderObserver_set(()=>{document.body.dataset.zoom==="launcher"&&!U.panes_shown().includes("launcher")&&Wr(null),window.requestAnimationFrame(()=>{for(const R of a.values("dag"))R.size_fit()})});const ve=(R,$,re,pe)=>{const Ne=$==="view"?Te("view",R):$==="fs"?Te("files",R):Te("empty");if(!U.leaf_split(R,re,Ne.id,pe))return Ds(Ne.id),U.mount_remove(Ne.id),null;if(_e(Ne.id,R,re,pe,$),$==="fs"){const Ue=ns=>{const Mo=a.get("files",Ne.id);if(Mo===void 0)return;const Nl=ns.modelKind==="fs.file"?ns.address.replace(/\/[^/]*$/,"")||"/":ns.address;m(Ne.id,Mo,Nl)};l.regard_subscribe(Ne.id,Ue);const tt=l.regard_get(R);tt!==null&&Ue(tt)}return Ne.id},ie=new zS(uv,fv());Object.assign(globalThis,{__argusDormant:{list:()=>ie.list(),get:R=>ie.get(R),dismiss:R=>ie.dismiss(R)}});const se=LP(c,{image_open:k,dir_open:xe,process_open:N,gather_open:ne,feed_open:Y,edit_open:R=>bo.edit_open(R),pillPane_spawn:ve,pacsQuery_get:()=>A.query_get(),catalogue_of:R=>D.get(R),catalogueIds:()=>[...D.keys()],stage_relight:()=>K()}),{birth_record:_e,domain_enter:Pe,orphans_dispose:ye}=se,ze=se.capture,Ye=se.restore,Ve=()=>{Pe("files"),Tt.size_fit()},lt=()=>{Pe("launcher"),Oe.render(),U.focus_set("launcher"),Wr("launcher")},j=(R=!1)=>{if(document.body.dataset.zoom!=="launcher"||(Wr(null),!R))return;const $=document.querySelector(".wrap:not(#gap)");$!==null&&Cg($,document.body),document.body.dataset.header="away",Gt?.(!0)},be=()=>{j(),U.activePreset_get()==="launcher"&&(te=!1,Ve())};let ce=!1;const Se=aT({ask:R=>bt.line_execute(R,{silent:!0,observe:!1}),home_open:()=>{te=!1,Ve(),U.focus_set("files")},home_cd:R=>{te=!1,Ve(),fe.line_run(`cd "${R}"`)},desktops:()=>ie.list(),desktop_restore:R=>{Ye(R)},panes_open:()=>{Pe("panes"),ue.render(),U.focus_set("panes")},keys_open:()=>{Er()},notes_open:()=>{Ar.open()},notes_latest:()=>Ar.latest(),daemon_stale:()=>ce,console_open:()=>st("gutter-console").click(),...i?{contribution:dP({ask:R=>bt.line_execute(R,{silent:!0,observe:!1}),universe_show:()=>xd(),runs_show:R=>Wn(R),feed_enter:R=>{Wn(),a.get("dag","dag")?.feed_enter(R)},line_offer:R=>fe.line_offer(R),pacs_query:()=>A.query_get()??"",pacs_open:()=>{Pe("pacs"),U.focus_set("pacs")}})}:{}}),Oe=new WD(pt,{tiles:Se,leave:()=>j(!0),startHere_get:hv,startHere_set:I5});setInterval(()=>{U.activePreset_get()==="launcher"&&(!pt.isConnected||document.visibilityState!=="visible"||Oe.render())},T5),mi(Vs(Wt,".panes-body"),{rows:".panes-card"});const ue=new IS(Wt,{list:()=>ie.list(),restore:R=>{Ye(R)},dismiss:R=>{ie.dismiss(R)}}),$e=()=>{const R=U.activePreset_get();if(R==="pacs"||R==="dag"||R==="launcher"){te=!0;return}te&&R==="files"||(te=!0,Ve())},Te=(R,$)=>{const re=UG(R);return l.pane_join(re.id,$!==void 0?l.group_of($):re.id),R==="tags"&&l.regard_subscribe(re.id,pe=>{pe.modelKind==="dicom.instance"&&x(re.id,pe.address)}),R==="view"&&(l.viewer_mark(re.id),l.regard_subscribe(re.id,pe=>{pe.modelKind!=="dicom.instance"&&a.get("view",re.id)?.regard_show(pe)})),U.mount_register(re.id,re.mount),Sr(re.id,R,re.mount),re},{bar_note:Vt,move:Ct,flip:ii,resize:ni,chordKeys_of:Sd}=GP(c),Sr=H3(c,{verbs:{move:Ct,chordKeys_of:Sd},browser:p,pillPane_spawn:ve,process_open:(R,$)=>N(R,$),overlay_back:R=>Fe.back(R),home_apply:()=>Ve(),orphans_dispose:()=>ye(),dag_dismiss:()=>{te=!1}});Sr("files","files",Be.mount);for(const R of _t.primaries)Sr(R.id,R.kind,R.mount);Sr("launcher","launcher",pt),Sr("panes","panes",Wt);let xr=!1;const Ti=R=>{xr=R};for(const R of["click","focusin"])document.addEventListener(R,$=>{$.target instanceof Element&&($.target.closest("#drawer")!==null?xr=!0:$.target.closest("#layout-root")!==null&&(xr=!1))});const Bl=()=>{let R=!1;for(const $ of document.querySelectorAll(".pane-drawer:not([hidden])"))$.hidden=!0,R=!0;return R},va=()=>{let R=!1;for(const $ of document.querySelectorAll('.workspace-pane[data-modes="open"], [data-frame-host][data-modes="open"]'))delete $.dataset.modes,R=!0;return A.serverStrip_isOpen()&&(A.serverStrip_close(),R=!0),R};document.addEventListener("click",R=>{if(!(R.target instanceof Element)||R.target.closest(".mode-frame")!==null&&R.target.closest(".mode-fill")===null||R.target.closest("#pacs-server-strip")!==null||R.target.closest("#pacs-f-server")!==null||R.target.closest(".listing-framed .listing-row, .ask-bar")!==null)return;const $=R.target.closest(".mode-strip"),re=$?.closest(".workspace-pane, [data-frame-host]")??null,pe=re?.dataset.modes==="open",Ne=va();if($!==null&&re!==null&&!pe){re.dataset.modes="open",xi("audio3");return}Ne&&xi("audio3")}),j3(c,{palette_isOpen:()=>!Q.hidden,palette_open:()=>Ge(),palette_close:()=>we(),errand_abandon:()=>Ht.errand_abandon(),dive_leave:()=>h.dive_leave(),overlay_escape:()=>Fe.escape(),drawers_close:Bl,modeFrames_close:va,consoleFocused:()=>xr,console_release:()=>Ti(!1),verbs:{bar_note:Vt,flip:ii,resize:ni},host:()=>q,stage_alone:R=>{ze(),U.tree_set({pane:R}),ye()},element_require:st});const Ii=new AT,Ui=(R,$)=>{const re=Te($);return U.leaf_replace(R,re.id),Ds(R),U.mount_remove(R),re};Ii.claim_add("fs.listing","files"),i&&DT(Ii,{dag_target:()=>{const R=U.focused_get();return R!==null&&a.has("dag",R)?a.get("dag",R):Tt},dags:()=>[Tt,...a.values("dag")],universes:()=>a.values("universe"),pacs:()=>A,pacs_present:()=>{U.preset_apply("pacs"),ye()},image_open:(R,$)=>{k(U.focused_get(),R,$?{force:!0}:{}).then(re=>fe.line_note(re))},pane_replace:(R,$)=>Ui(R,$).id,dag_get:R=>a.get("dag",R),image_get:R=>a.get("image",R),tags_get:R=>a.get("tags",R)});const wa=(R,$,re)=>{const pe=Ii.claimer_get($);if(pe!==void 0){pe(R,re);return}const Ne=Ui(R,$),Ue=a.get("files",Ne.id);for(const tt of re)Ue?.envelope_observe(tt)},Or={instance_spawn:Te,birth_record:_e,launcher_yield:be,launcher_active:()=>U.activePreset_get()==="launcher",template_stamp:Pi},ya=sL(c,Or),Er=ya.open,za=zL(c,Or),Fs=N3(c),Ar=F3(c,{...Or,ask:R=>bt.line_execute(R,{silent:!0})}),bo=eL(c,{...Or,replayPlace_get:se.replayPlace_get,errandHost_find:H,saved:()=>{for(const R of a.values("dag"))R.marks_refresh()}});gn("files",R=>O(R,!1)),gn("catalogue",R=>O(R,!1,!0)),gn("view",de),gn("help",ya.instance_build),gn("games",za.instance_build),gn("notes",Ar.instance_build),gn("edit",bo.instance_build);for(const[R,$]of _t.factories)gn(R,$);gn("empty",R=>{const $=Pi("tpl-pane-empty");return new OT($,{execute:re=>bt.line_execute(re,{silent:!0,observe:!1}),claim:(re,pe)=>wa(R,re,pe),claimKind_of:re=>Ii.claimKind_of(re)}),{id:R,kind:"empty",mount:$}});const Sa=R=>{R?document.body.dataset.gutter="away":delete document.body.dataset.gutter,xi("audio3")},Dr=(R,$)=>{if(U.activePreset_get()===R&&U.panes_shown().includes(R)){Sa(!0);return}document.body.dataset.gutter==="away"&&delete document.body.dataset.gutter,$()};st("gutter-restore").addEventListener("click",()=>Sa(!1)),window.addEventListener("keydown",R=>{R.key==="Escape"&&document.body.dataset.gutter==="away"&&document.body.dataset.zoom===void 0&&Sa(!1)}),st("gutter-files").addEventListener("click",()=>{Dr("files",()=>{te=!1,Ve(),U.focus_set("files"),Ti(!1)})});const Wn=(R="")=>{Pe("dag"),Tt.stage_returned(),Tt.list_reset(),Tt.roster_filter(R),Tt.feedsChooser_request(),U.focus_set("dag"),Ti(!1)},xd=()=>{Pe("universe");const R=a.get("universe","universe");R!==void 0&&!R.shown_get()&&R.request(),R?.stage_returned(),U.focus_set("universe"),Ti(!1)};st("gutter-runs").addEventListener("click",()=>Dr("dag",()=>Wn())),st("gutter-console").addEventListener("click",()=>{st("drawer").classList.contains("drawer-closed")&&st("drawer-toggle").click(),fe.focus_take(),Ti(!0)}),st("gutter-tools").addEventListener("click",()=>{Dr("pacs",()=>{Pe("pacs"),U.focus_set("pacs"),Ti(!1)})}),st("gutter-dashboard").addEventListener("click",()=>{Dr("launcher",lt)}),st("gutter-panes").addEventListener("click",()=>{Dr("panes",()=>{Pe("panes"),ue.render(),U.focus_set("panes"),Ti(!1)})});const B=R=>Zc(R)?.kind??null,q=V3(c,{verbs:{move:Ct,flip:ii,resize:ni},help_open:Er,notes_open:Ar.open,launcher_enter:lt,trek_open:R=>Fs.active_is()?"trek: the bridge is already up":(Fs.open(R),"trek: the bridge takes the screen (Esc or LEAVE BRIDGE gives it back)"),identity_get:()=>S,consoleZoom_toggle:nv,feed_enter:R=>Tt.feed_enter(R),file_save:g,stage_keep:()=>ze(),files_open:(R,$)=>{const re=a.get("files",R);return re===void 0?!1:(p.follow_set(R,!1),m(R,re,$),!0)},image_open:(R,$,re)=>k(R,$,re),series_ask:I,tagsPane_open:C}),Q=st("lang-palette"),X=st("lang-input"),Z=st("lang-result"),Ee=st("lang-pill"),Ge=()=>{Bl(),Q.hidden=!1,Ee.classList.add("lang-live"),Z.textContent="",X.value="",X.focus(),xi("audio3")},we=()=>{Q.hidden=!0,Ee.classList.remove("lang-live"),Z.textContent=""};Ee.addEventListener("click",()=>{Q.hidden?Ge():we()});const We=["pane","view","runs","node","dag","file","pacs","header","console","back","desktop","argus","help","notes"],je={pane:["split","zoom","close","bind","claim","focus","flip","resize"],resize:["left","right","up","down"],help:["keys","verbs"],notes:["pane"],focus:["left","right","up","down","last"],view:["files","runs","pacs"],runs:["enter","sort","filter"],node:["enter","immerse","back","clear"],dag:["layout","projection","scale","hue","draw","pulse","census","gravity","select","enter","physics","refresh"],draw:["spheres","stars"],pulse:["on","off"],census:["on","off"],gravity:["on","off"],physics:["charge","link","collide","gravity","reset"],file:["home","back","download","delete","sort","filter","follow","root","list","cards","preview"],pacs:["sort","filter","connect","disconnect","list","query","pull","status"],header:["stats","dag","away","restore"],console:["open","close","toggle","zoom","height"],desktop:["save","load","show","list","delete","clear","share"],split:["left","right","above","below"],bind:["unlinked","fs","viewer"],claim:["files","runs","pacs"],layout:["ranked","molecule"],projection:["2d","3d"],scale:["time","size"],hue:["status","compute"],argus:["verbs"]};if(X.addEventListener("keydown",R=>{if(R.key==="Escape"){R.stopPropagation(),we();return}if(R.key==="Tab"){R.preventDefault();const $=X.value.split(/\s+/),re=$[$.length-1]??"",pe=$.length<=1?"":$[$.length-2]??"",Ue=($.length<=1?We:je[pe]??je[$[0]??""]??[]).find(tt=>tt.startsWith(re.toLowerCase()));Ue!==void 0&&($[$.length-1]=Ue,X.value=`${$.join(" ")} `);return}if(R.key==="Enter"){const $=X.value.trim();if($.length===0){we();return}Uc(q,$).then(re=>{re!==null&&Fs.active_is()?(fe.output_write("data",`: ${$}
|
|
4333
4333
|
${re}
|