@fnndsc/argus 0.25.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/assets/{Settings-jvbwEHC5.js → Settings-Dw-WBiXT.js} +1 -1
  2. package/dist/assets/{Texture-D3QUbu8S.js → Texture-REEh-S1D.js} +1 -1
  3. package/dist/assets/{addVolumesToViewports-BH_Y4e4-.js → addVolumesToViewports-DDEwdBIy.js} +1 -1
  4. package/dist/assets/{cornerstoneEngine--e1lt542.js → cornerstoneEngine-CW5LOM9l.js} +2 -2
  5. package/dist/assets/{field-ftyy4A7M.js → field-W6IcgahR.js} +3 -3
  6. package/dist/assets/{index-GPuI2R2X.js → index--rpHzp07.js} +1 -1
  7. package/dist/assets/{index-B9U37Mrt.js → index-7sItcPJh.js} +1 -1
  8. package/dist/assets/{index-DQqF6M0z.js → index-B0k4uDn_.js} +1 -1
  9. package/dist/assets/{index-aDZ0oyWS.js → index-BNg_D64Z.js} +1 -1
  10. package/dist/assets/{index-C8WOH9di.js → index-BPa5mE6G.js} +1 -1
  11. package/dist/assets/{index-g_p9AtRA.js → index-BVBe08QC.js} +1 -1
  12. package/dist/assets/{index-h4ibTvRU.js → index-BdKHAoCI.js} +6 -6
  13. package/dist/assets/{index-BywHhPYi.js → index-Bpji1D6t.js} +1 -1
  14. package/dist/assets/{index-7hQj6IVW.js → index-BxVi2IlO.js} +1 -1
  15. package/dist/assets/{index-Bos2BFES.js → index-CAwLiQnw.js} +1 -1
  16. package/dist/assets/{index-B4gVgqug.js → index-Cwija5mk.js} +1 -1
  17. package/dist/assets/{index-CUmyLgWT.js → index-l6tpDzde.js} +1 -1
  18. package/dist/assets/{index-xRAv6Z1I.js → index-nXodExzA.js} +1 -1
  19. package/dist/assets/{index-BaUlf-5O.js → index-yEWzGFu8.js} +1 -1
  20. package/dist/assets/{niivueEngine-CH7T6paV.js → niivueEngine-DzKAhyNX.js} +2 -2
  21. package/dist/assets/{slabScene-C_zrAzVJ.js → slabScene-BULnHnxB.js} +1 -1
  22. package/dist/build.json +1 -1
  23. package/dist/index.html +1 -1
  24. package/dist/notes.json +1 -1
  25. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine--e1lt542.js","./refusal-DOpm8I8L.js","./_commonjsHelpers-CE1G-McA.js","./niivueEngine-CH7T6paV.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-CW5LOM9l.js","./refusal-DOpm8I8L.js","./_commonjsHelpers-CE1G-McA.js","./niivueEngine-DzKAhyNX.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 i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();const qM=450,sh=12;function Vi(n,e,t=Date.now()){const s=Number(n.dataset.edgeAt??0);return n.dataset.edge===e&&t-s<qM?!1:(delete n.dataset.edge,n.offsetWidth,n.dataset.edge=e,n.dataset.edgeAt=String(t),!0)}function XM(n,e){return e?"▲ TOP":`▼ ${n} MORE`}function KM(n,e){const t=n.getBoundingClientRect().bottom;let s=0;for(const i of n.querySelectorAll(e)){const r=i.getBoundingClientRect();r.height>0&&r.top>=t-2&&(s+=1)}return s}function YM(n){const e=parseFloat(getComputedStyle(n).lineHeight)||16;return Math.max(0,Math.ceil((n.scrollHeight-n.scrollTop-n.clientHeight)/e))}function Vs(n,e={}){n.dataset.more="wired",n.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 s=e.label??XM,i=()=>n.scrollTop+n.clientHeight>=n.scrollHeight-2;t.addEventListener("click",l=>{if(l.stopPropagation(),e.press!==void 0){e.press();return}n.scrollBy({top:i()?-n.scrollHeight:Math.max(1,n.clientHeight-t.offsetHeight),behavior:"smooth"})});const r=e.mount??n;r.appendChild(t);let a=!1;const o=()=>{if(!a){a=!0;try{r===n&&n.lastElementChild!==t&&n.appendChild(t);const l=(e.scrolls?.()??!0)&&n.scrollHeight>n.clientHeight+2;if(t.hidden!==!l&&(t.hidden=!l),!l)return;const c=e.rows!==void 0?KM(n,e.rows):YM(n),d=s(c,i());t.textContent!==d&&(t.textContent=d)}finally{a=!1}}};return n.addEventListener("scroll",o,{passive:!0}),ZM(n,i),typeof ResizeObserver<"u"&&new ResizeObserver(o).observe(n),new MutationObserver(o).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","style"]}),o(),t}function ZM(n,e){const t=()=>n.scrollHeight>n.clientHeight+2,s=()=>n.scrollTop<=0;let i=n.scrollTop;n.addEventListener("scrollend",()=>{const a=n.scrollTop!==i;i=n.scrollTop,!(!a||!t())&&(s()?Vi(n,"top"):e()&&Vi(n,"bottom"))}),n.addEventListener("wheel",a=>{!t()||a.deltaY===0||(a.deltaY<0&&s()?Vi(n,"top"):a.deltaY>0&&e()&&Vi(n,"bottom"))},{passive:!0});let r=null;n.addEventListener("touchstart",a=>{r=a.touches[0]?.clientY??null},{passive:!0}),n.addEventListener("touchmove",a=>{const o=a.touches[0]?.clientY;r===null||o===void 0||!t()||(o-r>sh&&s()?(Vi(n,"top"),r=null):r-o>sh&&e()&&(Vi(n,"bottom"),r=null))},{passive:!0}),n.addEventListener("animationend",a=>{a.target===n&&a.animationName.startsWith("edge-flare")&&delete n.dataset.edge})}const QM=["cold","cached","failed"];function JM(n){return n.state??(n.restored===!0?"cached":"cold")}const eb=["upload","download","pull","workflow","pipeline","group","task"],tb=["transfer","retrieve","workflow","inspection"],sb=["scanning","transferring","watching","retrying","reading","working","complete","failed"],nb=["files","bytes","series","jobs","nodes"],ib=["running","done","unconfirmed","stalled","timeout","error","unknown"],Lc=1,rb=new Set([".dcm",".png",".jpg",".jpeg",".gif",".bmp",".webp",".ico",".pdf",".zip",".tar",".gz",".bz2",".xz",".7z",".exe",".dll",".so",".bin",".mp3",".mp4",".avi",".wav",".nii",".mgz"]),ab=1024*1024;function gm(n){const e=n.split("/").pop()??n,t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function ob(n){return!rb.has(gm(n))}var _t;(function(n){n.assertEqual=i=>{};function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{const r={};for(const a of i)r[a]=a;return r},n.getValidEnumValues=i=>{const r=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of r)a[o]=i[o];return n.objectValues(a)},n.objectValues=i=>n.objectKeys(i).map(function(r){return i[r]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const r=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&r.push(a);return r},n.find=(i,r)=>{for(const a of i)if(r(a))return a},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,r=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}n.joinValues=s,n.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(_t||(_t={}));var nh;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(nh||(nh={}));const Ie=_t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jn=n=>{switch(typeof n){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return Number.isNaN(n)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(n)?Ie.array:n===null?Ie.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ie.promise:typeof Map<"u"&&n instanceof Map?Ie.map:typeof Set<"u"&&n instanceof Set?Ie.set:typeof Date<"u"&&n instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},me=_t.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Sn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(r){return r.message},s={_errors:[]},i=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return i(this),s}static assert(e){if(!(e instanceof Sn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_t.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const i of this.issues)if(i.path.length>0){const r=i.path[0];t[r]=t[r]||[],t[r].push(e(i))}else s.push(e(i));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Sn.create=n=>new Sn(n);const Wc=(n,e)=>{let t;switch(n.code){case me.invalid_type:n.received===Ie.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case me.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,_t.jsonStringifyReplacer)}`;break;case me.unrecognized_keys:t=`Unrecognized key(s) in object: ${_t.joinValues(n.keys,", ")}`;break;case me.invalid_union:t="Invalid input";break;case me.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_t.joinValues(n.options)}`;break;case me.invalid_enum_value:t=`Invalid enum value. Expected ${_t.joinValues(n.options)}, received '${n.received}'`;break;case me.invalid_arguments:t="Invalid function arguments";break;case me.invalid_return_type:t="Invalid function return type";break;case me.invalid_date:t="Invalid date";break;case me.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:_t.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case me.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case me.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case me.custom:t="Invalid input";break;case me.invalid_intersection_types:t="Intersection results could not be merged";break;case me.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case me.not_finite:t="Number must be finite";break;default:t=e.defaultError,_t.assertNever(n)}return{message:t}};let lb=Wc;function cb(){return lb}const db=n=>{const{data:e,path:t,errorMaps:s,issueData:i}=n,r=[...t,...i.path||[]],a={...i,path:r};if(i.message!==void 0)return{...i,path:r,message:i.message};let o="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)o=c(a,{data:e,defaultError:o}).message;return{...i,path:r,message:o}};function Ae(n,e){const t=cb(),s=db({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Wc?void 0:Wc].filter(i=>!!i)});n.common.issues.push(s)}class fs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const i of t){if(i.status==="aborted")return Ze;i.status==="dirty"&&e.dirty(),s.push(i.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const i of t){const r=await i.key,a=await i.value;s.push({key:r,value:a})}return fs.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const i of t){const{key:r,value:a}=i;if(r.status==="aborted"||a.status==="aborted")return Ze;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(s[r.value]=a.value)}return{status:e.value,value:s}}}const Ze=Object.freeze({status:"aborted"}),da=n=>({status:"dirty",value:n}),Cs=n=>({status:"valid",value:n}),ih=n=>n.status==="aborted",rh=n=>n.status==="dirty",Sr=n=>n.status==="valid",Bo=n=>typeof Promise<"u"&&n instanceof Promise;var Le;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Le||(Le={}));class nn{constructor(e,t,s,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ah=(n,e)=>{if(Sr(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Sn(n.common.issues);return this._error=t,this._error}}};function rt(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:i}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{const{message:l}=n;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:i}}class ct{get description(){return this._def.description}_getType(e){return jn(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:jn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new fs,ctx:{common:e.parent.common,data:e.data,parsedType:jn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Bo(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jn(e)},i=this._parseSync({data:e,path:s.path,parent:s});return ah(s,i)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jn(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Sr(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Sr(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jn(e)},i=this._parse({data:e,path:s.path,parent:s}),r=await(Bo(i)?i:Promise.resolve(i));return ah(s,r)}refine(e,t){const s=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,r)=>{const a=e(i),o=()=>r.addIssue({code:me.custom,...s(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,i)=>e(s)?!0:(i.addIssue(typeof t=="function"?t(s,i):t),!1))}_refinement(e){return new Ii({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return yn.create(this,this._def)}nullable(){return Gi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return en.create(this)}promise(){return Fo.create(this,this._def)}or(e){return Po.create([this,e],this._def)}and(e){return Lo.create(this,e,this._def)}transform(e){return new Ii({...rt(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new jo({...rt(this._def),innerType:this,defaultValue:t,typeName:Qe.ZodDefault})}brand(){return new zm({typeName:Qe.ZodBranded,type:this,...rt(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new $o({...rt(this._def),innerType:this,catchValue:t,typeName:Qe.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ru.create(this,e)}readonly(){return Vo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ub=/^c[^\s-]{8,}$/i,hb=/^[0-9a-z]+$/,fb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mb=/^[a-z0-9_-]{21}$/i,gb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Mb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[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]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Sb=new RegExp(`^${Mm}$`);function bm(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Eb(n){return new RegExp(`^${bm(n)}$`)}function Ab(n){let e=`${Mm}T${bm(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Db(n,e){return!!((e==="v4"||!e)&&zb.test(n)||(e==="v6"||!e)&&yb.test(n))}function Tb(n,e){if(!gb.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Ib(n,e){return!!((e==="v4"||!e)&&wb.test(n)||(e==="v6"||!e)&&vb.test(n))}class zn extends ct{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ie.string){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.string,received:r.parsedType}),Ze}const s=new fs;let i;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),s.dirty());else if(r.kind==="max")e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),s.dirty());else if(r.kind==="length"){const a=e.data.length>r.value,o=e.data.length<r.value;(a||o)&&(i=this._getOrReturnCtx(e,i),a?Ae(i,{code:me.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&Ae(i,{code:me.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),s.dirty())}else if(r.kind==="email")bb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"email",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="emoji")Tl||(Tl=new RegExp(_b,"u")),Tl.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"emoji",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="uuid")pb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"uuid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="nanoid")mb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"nanoid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid")ub.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cuid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid2")hb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cuid2",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="ulid")fb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"ulid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ae(i,{validation:"url",code:me.invalid_string,message:r.message}),s.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"regex",code:me.invalid_string,message:r.message}),s.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),s.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:{startsWith:r.value},message:r.message}),s.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:{endsWith:r.value},message:r.message}),s.dirty()):r.kind==="datetime"?Ab(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"datetime",message:r.message}),s.dirty()):r.kind==="date"?Sb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"date",message:r.message}),s.dirty()):r.kind==="time"?Eb(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"time",message:r.message}),s.dirty()):r.kind==="duration"?Mb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"duration",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="ip"?Db(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"ip",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="jwt"?Tb(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"jwt",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="cidr"?Ib(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cidr",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="base64"?Ob.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"base64",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="base64url"?xb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"base64url",code:me.invalid_string,message:r.message}),s.dirty()):_t.assertNever(r);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(i=>e.test(i),{validation:t,code:me.invalid_string,...Le.errToObj(s)})}_addCheck(e){return new zn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Le.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Le.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Le.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Le.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Le.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Le.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Le.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Le.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Le.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Le.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Le.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Le.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Le.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Le.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Le.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Le.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Le.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Le.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Le.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Le.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Le.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Le.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Le.errToObj(t)})}nonempty(e){return this.min(1,Le.errToObj(e))}trim(){return new zn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}zn.create=n=>new zn({checks:[],typeName:Qe.ZodString,coerce:n?.coerce??!1,...rt(n)});function Gb(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=t>s?t:s,r=Number.parseInt(n.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return r%a/10**i}class Er extends ct{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ie.number){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.number,received:r.parsedType}),Ze}let s;const i=new fs;for(const r of this._def.checks)r.kind==="int"?_t.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?Gb(e.data,r.value)!==0&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.not_finite,message:r.message}),i.dirty()):_t.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Le.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Le.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Le.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Le.toString(t))}setLimit(e,t,s,i){return new Er({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Le.toString(i)}]})}_addCheck(e){return new Er({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Le.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Le.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Le.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Le.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Le.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Le.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_t.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Er.create=n=>new Er({checks:[],typeName:Qe.ZodNumber,coerce:n?.coerce||!1,...rt(n)});class za extends ct{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ie.bigint)return this._getInvalidInput(e);let s;const i=new fs;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):_t.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:me.invalid_type,expected:Ie.bigint,received:t.parsedType}),Ze}gte(e,t){return this.setLimit("min",e,!0,Le.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Le.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Le.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Le.toString(t))}setLimit(e,t,s,i){return new za({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Le.toString(i)}]})}_addCheck(e){return new za({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Le.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}za.create=n=>new za({checks:[],typeName:Qe.ZodBigInt,coerce:n?.coerce??!1,...rt(n)});class kc extends ct{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ie.boolean){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.boolean,received:s.parsedType}),Ze}return Cs(e.data)}}kc.create=n=>new kc({typeName:Qe.ZodBoolean,coerce:n?.coerce||!1,...rt(n)});class Co extends ct{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ie.date){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.date,received:r.parsedType}),Ze}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_date}),Ze}const s=new fs;let i;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),s.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),s.dirty()):_t.assertNever(r);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Co({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Le.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Le.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Co.create=n=>new Co({checks:[],coerce:n?.coerce||!1,typeName:Qe.ZodDate,...rt(n)});class oh extends ct{_parse(e){if(this._getType(e)!==Ie.symbol){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.symbol,received:s.parsedType}),Ze}return Cs(e.data)}}oh.create=n=>new oh({typeName:Qe.ZodSymbol,...rt(n)});class Uc extends ct{_parse(e){if(this._getType(e)!==Ie.undefined){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.undefined,received:s.parsedType}),Ze}return Cs(e.data)}}Uc.create=n=>new Uc({typeName:Qe.ZodUndefined,...rt(n)});class Fc extends ct{_parse(e){if(this._getType(e)!==Ie.null){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.null,received:s.parsedType}),Ze}return Cs(e.data)}}Fc.create=n=>new Fc({typeName:Qe.ZodNull,...rt(n)});class lh extends ct{constructor(){super(...arguments),this._any=!0}_parse(e){return Cs(e.data)}}lh.create=n=>new lh({typeName:Qe.ZodAny,...rt(n)});class jc extends ct{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Cs(e.data)}}jc.create=n=>new jc({typeName:Qe.ZodUnknown,...rt(n)});class ti extends ct{_parse(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:me.invalid_type,expected:Ie.never,received:t.parsedType}),Ze}}ti.create=n=>new ti({typeName:Qe.ZodNever,...rt(n)});class ch extends ct{_parse(e){if(this._getType(e)!==Ie.undefined){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.void,received:s.parsedType}),Ze}return Cs(e.data)}}ch.create=n=>new ch({typeName:Qe.ZodVoid,...rt(n)});class en extends ct{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ie.array)return Ae(t,{code:me.invalid_type,expected:Ie.array,received:t.parsedType}),Ze;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(Ae(t,{code:a?me.too_big:me.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),s.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(Ae(t,{code:me.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),s.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Ae(t,{code:me.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>i.type._parseAsync(new nn(t,a,t.path,o)))).then(a=>fs.mergeArray(s,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new nn(t,a,t.path,o)));return fs.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new en({...this._def,minLength:{value:e,message:Le.toString(t)}})}max(e,t){return new en({...this._def,maxLength:{value:e,message:Le.toString(t)}})}length(e,t){return new en({...this._def,exactLength:{value:e,message:Le.toString(t)}})}nonempty(e){return this.min(1,e)}}en.create=(n,e)=>new en({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...rt(e)});function Mr(n){if(n instanceof Vt){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=yn.create(Mr(s))}return new Vt({...n._def,shape:()=>e})}else return n instanceof en?new en({...n._def,type:Mr(n.element)}):n instanceof yn?yn.create(Mr(n.unwrap())):n instanceof Gi?Gi.create(Mr(n.unwrap())):n instanceof Di?Di.create(n.items.map(e=>Mr(e))):n}class Vt extends ct{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=_t.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ie.object){const c=this._getOrReturnCtx(e);return Ae(c,{code:me.invalid_type,expected:Ie.object,received:c.parsedType}),Ze}const{status:s,ctx:i}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof ti&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||o.push(c);const l=[];for(const c of a){const d=r[c],u=i.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new nn(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof ti){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(c==="strict")o.length>0&&(Ae(i,{code:me.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const u=i.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new nn(i,u,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const u=await d.key,h=await d.value;c.push({key:u,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>fs.mergeObjectSync(s,c)):fs.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return Le.errToObj,new Vt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const i=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:Le.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new Vt({...this._def,unknownKeys:"strip"})}passthrough(){return new Vt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Vt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Vt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Vt({...this._def,catchall:e})}pick(e){const t={};for(const s of _t.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new Vt({...this._def,shape:()=>t})}omit(e){const t={};for(const s of _t.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new Vt({...this._def,shape:()=>t})}deepPartial(){return Mr(this)}partial(e){const t={};for(const s of _t.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?t[s]=i:t[s]=i.optional()}return new Vt({...this._def,shape:()=>t})}required(e){const t={};for(const s of _t.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let r=this.shape[s];for(;r instanceof yn;)r=r._def.innerType;t[s]=r}return new Vt({...this._def,shape:()=>t})}keyof(){return _m(_t.objectKeys(this.shape))}}Vt.create=(n,e)=>new Vt({shape:()=>n,unknownKeys:"strip",catchall:ti.create(),typeName:Qe.ZodObject,...rt(e)});Vt.strictCreate=(n,e)=>new Vt({shape:()=>n,unknownKeys:"strict",catchall:ti.create(),typeName:Qe.ZodObject,...rt(e)});Vt.lazycreate=(n,e)=>new Vt({shape:n,unknownKeys:"strip",catchall:ti.create(),typeName:Qe.ZodObject,...rt(e)});class Po extends ct{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function i(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=r.map(o=>new Sn(o.ctx.common.issues));return Ae(t,{code:me.invalid_union,unionErrors:a}),Ze}if(t.common.async)return Promise.all(s.map(async r=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let r;const a=[];for(const l of s){const c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!r&&(r={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(l=>new Sn(l));return Ae(t,{code:me.invalid_union,unionErrors:o}),Ze}}get options(){return this._def.options}}Po.create=(n,e)=>new Po({options:n,typeName:Qe.ZodUnion,...rt(e)});const pn=n=>n instanceof ko?pn(n.schema):n instanceof Ii?pn(n.innerType()):n instanceof Uo?[n.value]:n instanceof Ti?n.options:n instanceof Vc?_t.objectValues(n.enum):n instanceof jo?pn(n._def.innerType):n instanceof Uc?[void 0]:n instanceof Fc?[null]:n instanceof yn?[void 0,...pn(n.unwrap())]:n instanceof Gi?[null,...pn(n.unwrap())]:n instanceof zm||n instanceof Vo?pn(n.unwrap()):n instanceof $o?pn(n._def.innerType):[];class iu extends ct{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.object)return Ae(t,{code:me.invalid_type,expected:Ie.object,received:t.parsedType}),Ze;const s=this.discriminator,i=t.data[s],r=this.optionsMap.get(i);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Ae(t,{code:me.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Ze)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const i=new Map;for(const r of t){const a=pn(r.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,r)}}return new iu({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...rt(s)})}}function $c(n,e){const t=jn(n),s=jn(e);if(n===e)return{valid:!0,data:n};if(t===Ie.object&&s===Ie.object){const i=_t.objectKeys(e),r=_t.objectKeys(n).filter(o=>i.indexOf(o)!==-1),a={...n,...e};for(const o of r){const l=$c(n[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===Ie.array&&s===Ie.array){if(n.length!==e.length)return{valid:!1};const i=[];for(let r=0;r<n.length;r++){const a=n[r],o=e[r],l=$c(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===Ie.date&&s===Ie.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Lo extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=(r,a)=>{if(ih(r)||ih(a))return Ze;const o=$c(r.value,a.value);return o.valid?((rh(r)||rh(a))&&t.dirty(),{status:t.value,value:o.data}):(Ae(s,{code:me.invalid_intersection_types}),Ze)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([r,a])=>i(r,a)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Lo.create=(n,e,t)=>new Lo({left:n,right:e,typeName:Qe.ZodIntersection,...rt(t)});class Di extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.array)return Ae(s,{code:me.invalid_type,expected:Ie.array,received:s.parsedType}),Ze;if(s.data.length<this._def.items.length)return Ae(s,{code:me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ze;!this._def.rest&&s.data.length>this._def.items.length&&(Ae(s,{code:me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...s.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new nn(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(r).then(a=>fs.mergeArray(t,a)):fs.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Di({...this._def,rest:e})}}Di.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Di({items:n,typeName:Qe.ZodTuple,rest:null,...rt(e)})};class Wo extends ct{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.object)return Ae(s,{code:me.invalid_type,expected:Ie.object,received:s.parsedType}),Ze;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in s.data)i.push({key:r._parse(new nn(s,o,s.path,o)),value:a._parse(new nn(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?fs.mergeObjectAsync(t,i):fs.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof ct?new Wo({keyType:e,valueType:t,typeName:Qe.ZodRecord,...rt(s)}):new Wo({keyType:zn.create(),valueType:e,typeName:Qe.ZodRecord,...rt(t)})}}class dh extends ct{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.map)return Ae(s,{code:me.invalid_type,expected:Ie.map,received:s.parsedType}),Ze;const i=this._def.keyType,r=this._def.valueType,a=[...s.data.entries()].map(([o,l],c)=>({key:i._parse(new nn(s,o,s.path,[c,"key"])),value:r._parse(new nn(s,l,s.path,[c,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return Ze;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return Ze;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}}}}dh.create=(n,e,t)=>new dh({valueType:e,keyType:n,typeName:Qe.ZodMap,...rt(t)});class wa extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.set)return Ae(s,{code:me.invalid_type,expected:Ie.set,received:s.parsedType}),Ze;const i=this._def;i.minSize!==null&&s.data.size<i.minSize.value&&(Ae(s,{code:me.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&s.data.size>i.maxSize.value&&(Ae(s,{code:me.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const r=this._def.valueType;function a(l){const c=new Set;for(const d of l){if(d.status==="aborted")return Ze;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}const o=[...s.data.values()].map((l,c)=>r._parse(new nn(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new wa({...this._def,minSize:{value:e,message:Le.toString(t)}})}max(e,t){return new wa({...this._def,maxSize:{value:e,message:Le.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}wa.create=(n,e)=>new wa({valueType:n,minSize:null,maxSize:null,typeName:Qe.ZodSet,...rt(e)});class ko extends ct{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ko.create=(n,e)=>new ko({getter:n,typeName:Qe.ZodLazy,...rt(e)});class Uo extends ct{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ae(t,{received:t.data,code:me.invalid_literal,expected:this._def.value}),Ze}return{status:"valid",value:e.data}}get value(){return this._def.value}}Uo.create=(n,e)=>new Uo({value:n,typeName:Qe.ZodLiteral,...rt(e)});function _m(n,e){return new Ti({values:n,typeName:Qe.ZodEnum,...rt(e)})}class Ti extends ct{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return Ae(t,{expected:_t.joinValues(s),received:t.parsedType,code:me.invalid_type}),Ze}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return Ae(t,{received:t.data,code:me.invalid_enum_value,options:s}),Ze}return Cs(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ti.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ti.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Ti.create=_m;class Vc extends ct{_parse(e){const t=_t.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Ie.string&&s.parsedType!==Ie.number){const i=_t.objectValues(t);return Ae(s,{expected:_t.joinValues(i),received:s.parsedType,code:me.invalid_type}),Ze}if(this._cache||(this._cache=new Set(_t.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=_t.objectValues(t);return Ae(s,{received:s.data,code:me.invalid_enum_value,options:i}),Ze}return Cs(e.data)}get enum(){return this._def.values}}Vc.create=(n,e)=>new Vc({values:n,typeName:Qe.ZodNativeEnum,...rt(e)});class Fo extends ct{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.promise&&t.common.async===!1)return Ae(t,{code:me.invalid_type,expected:Ie.promise,received:t.parsedType}),Ze;const s=t.parsedType===Ie.promise?t.data:Promise.resolve(t.data);return Cs(s.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Fo.create=(n,e)=>new Fo({type:n,typeName:Qe.ZodPromise,...rt(e)});class Ii extends ct{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:a=>{Ae(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){const a=i.transform(s.data,r);if(s.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return Ze;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?Ze:l.status==="dirty"||t.value==="dirty"?da(l.value):l});{if(t.value==="aborted")return Ze;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?Ze:o.status==="dirty"||t.value==="dirty"?da(o.value):o}}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,r);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Ze:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?Ze:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Sr(a))return Ze;const o=i.transform(a.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>Sr(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):Ze);_t.assertNever(i)}}Ii.create=(n,e,t)=>new Ii({schema:n,typeName:Qe.ZodEffects,effect:e,...rt(t)});Ii.createWithPreprocess=(n,e,t)=>new Ii({schema:e,effect:{type:"preprocess",transform:n},typeName:Qe.ZodEffects,...rt(t)});class yn extends ct{_parse(e){return this._getType(e)===Ie.undefined?Cs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yn.create=(n,e)=>new yn({innerType:n,typeName:Qe.ZodOptional,...rt(e)});class Gi extends ct{_parse(e){return this._getType(e)===Ie.null?Cs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gi.create=(n,e)=>new Gi({innerType:n,typeName:Qe.ZodNullable,...rt(e)});class jo extends ct{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===Ie.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}jo.create=(n,e)=>new jo({innerType:n,typeName:Qe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...rt(e)});class $o extends ct{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Bo(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Sn(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Sn(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}$o.create=(n,e)=>new $o({innerType:n,typeName:Qe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...rt(e)});class uh extends ct{_parse(e){if(this._getType(e)!==Ie.nan){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.nan,received:s.parsedType}),Ze}return{status:"valid",value:e.data}}}uh.create=n=>new uh({typeName:Qe.ZodNaN,...rt(n)});class zm extends ct{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ru extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?Ze:r.status==="dirty"?(t.dirty(),da(r.value)):this._def.out._parseAsync({data:r.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Ze:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(e,t){return new ru({in:e,out:t,typeName:Qe.ZodPipeline})}}class Vo extends ct{_parse(e){const t=this._def.innerType._parse(e),s=i=>(Sr(i)&&(i.value=Object.freeze(i.value)),i);return Bo(t)?t.then(i=>s(i)):s(t)}unwrap(){return this._def.innerType}}Vo.create=(n,e)=>new Vo({innerType:n,typeName:Qe.ZodReadonly,...rt(e)});var Qe;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Qe||(Qe={}));const k=zn.create,le=Er.create,Rt=kc.create,au=jc.create;ti.create;const it=en.create,fe=Vt.create;Po.create;const wm=iu.create;Lo.create;const ym=Di.create,vm=Wo.create,Rb=ko.create,dt=Uo.create,Ut=Ti.create;Fo.create;yn.create;Gi.create;const Nb=Ut(["ok","error"]),Bb=fe({type:Ut(["error","warning"]),message:k()}),Cb=fe({kind:k(),data:au()}),Pb=fe({input:k(),proposed:k(),validated:Rt(),executed:k().optional()}),Om=fe({status:Nb,rendered:k(),renderedErr:k().optional(),model:Cb.optional(),errors:it(Bb).optional(),trace:Pb.optional()}),Lb=Ut(["data","err","status"]),Wb=fe({shellCommands:Rt(),hiddenInput:Rt().optional(),color:Rt().optional(),fileDelivery:Rt().optional(),localFilesystem:Rt().optional()}),kb=fe({type:dt("attach"),protocolVersion:le().int(),token:k(),session:k().optional(),capabilities:Wb.optional()}),Ub=fe({type:dt("execute"),id:k(),line:k(),instrument:Rt().optional()}),Fb=fe({type:dt("cancel"),id:k()}),jb=fe({type:dt("complete"),id:k(),prefix:k()}),$b=fe({type:dt("promptAnswer"),promptId:k(),answer:k()}),Vb=fe({type:dt("promptError"),promptId:k(),reason:k()}),Hb=fe({type:dt("pipeResult"),pipeId:k(),output:k()}),qb=fe({type:dt("pipeError"),pipeId:k(),reason:k()}),Xb=fe({type:dt("shellResult"),shellId:k(),exitCode:le().int()}),Kb=fe({type:dt("shellError"),shellId:k(),reason:k()}),Yb=fe({type:dt("editResult"),editId:k(),content:k(),changed:Rt(),opened:Rt().optional()}),Zb=fe({type:dt("editError"),editId:k(),reason:k()}),Qb=fe({type:dt("deliverResult"),deliverId:k(),location:k(),bytes:le().nonnegative()}),Jb=fe({type:dt("deliverError"),deliverId:k(),reason:k()}),e_=fe({address:k(),modelKind:k().optional(),groupId:k(),paneId:k()}),xm=fe({type:dt("regard"),regard:e_}),t_=fe({type:dt("watch"),subject:k()}),s_=fe({type:dt("unwatch"),subject:k()}),n_=["live","settled","stale"],i_=Ut(n_),r_=fe({type:dt("stale"),stale:Rt()}),a_=["restart","end","stop"],o_=fe({type:dt("closing"),cause:Ut(a_)}),l_=fe({type:dt("watched"),subject:k(),state:i_}),c_=fe({type:dt("numbered"),id:le(),source:k(),rows:le(),handles:it(fe({kind:k(),ordinal:le(),address:k()}))});wm("type",[kb,Ub,Fb,jb,$b,Vb,Hb,qb,Xb,Kb,Yb,Zb,Qb,Jb,xm,t_,s_]);const d_=fe({type:dt("attached"),session:k(),surface:k().optional(),protocolVersion:le().int(),stack:fe({chell:k(),calypso:k(),build:k(),surface:fe({git:k(),built:k()}).optional(),brasa:k().optional(),chili:k().optional(),salsa:k().optional(),cumin:k().optional()}).optional(),hostControl:it(k()).optional(),stale:Rt().optional()}),u_=fe({type:dt("result"),id:k(),envelopes:it(Om)}),h_=fe({type:dt("complete"),id:k(),prefix:k(),candidates:it(k())}),f_=fe({type:dt("output"),id:k(),channel:Lb,chunk:k()}),p_=Ut(eb).catch("task"),m_=Ut(tb).catch(void 0),g_=Ut(sb).catch("working"),M_=Ut(nb).catch(void 0),b_=Ut(ib).catch("unknown"),__=fe({type:dt("progress"),id:k(),operation:p_,kind:m_.optional(),phase:g_,label:k().optional(),itemId:k().optional(),current:le().nonnegative().optional(),total:le().nonnegative().optional(),percent:le().min(0).max(100).optional(),unit:M_.optional(),status:b_.optional(),path:k().optional(),reason:k().optional()}),z_=fe({type:dt("session"),surface:k(),envelope:Om}),w_=fe({type:dt("error"),id:k().optional(),reason:k()}),y_=["text","secret","confirm","path"],v_=Ut(y_).catch("text"),O_=fe({anchor:k().optional(),wantsDirectory:Rt(),suggest:k().optional()}),x_=fe({type:dt("prompt"),promptId:k(),message:k(),hidden:Rt(),wants:v_.optional(),path:O_.optional(),commit:k().optional()});function S_(n){return n.wants!==void 0?n.wants:n.hidden===!0?"secret":"text"}const E_=fe({user:k(),uri:k(),cwd:k(),pacsserver:k().nullable(),physicalMode:Rt(),lastExitCode:le(),lastCommandDurationMs:le(),procWarmup:fe({loaded:le(),total:le().optional(),restored:Rt().optional(),state:Ut(QM).optional(),sweeping:Rt().optional(),feed:fe({id:le(),loaded:le(),total:le(),failed:k().optional()}).optional(),feeds:it(fe({id:le(),loaded:le(),total:le(),failed:k().optional()})).optional(),arrived:it(le()).optional(),landed:it(fe({id:le(),title:k().default(""),jobs:le(),status:k(),chain:it(k()),groups:it(fe({plugin:k(),count:le(),errored:le().default(0),status:k(),parent:le().nullable()})).default([])})).optional(),roster:Ut(["delta","full"]).optional()}).optional(),procIndex:fe({jobs:le(),feeds:le()}).optional(),warmupFailures:it(fe({label:k(),message:k()})).optional()}),A_=fe({type:dt("promptline"),context:E_}),D_=fe({type:dt("pipe"),pipeId:k(),command:k(),input:k()}),T_=fe({type:dt("shell"),shellId:k(),command:k()}),I_=fe({type:dt("edit"),editId:k(),content:k(),extension:k().optional(),path:k().optional()}),G_=fe({type:dt("deliver"),deliverId:k(),path:k(),filename:k(),destination:k().optional(),size:le().nonnegative().optional(),contentType:k().optional()}),R_=fe({type:dt("telemetry"),index:fe({jobs:le(),feeds:le()}),lane:fe({running:fe({line:k(),sinceMs:le(),surface:k()}).nullable(),waiting:le()}).optional(),surfaces:it(fe({id:k(),kind:Ut(["chell","browser"])})).optional(),cube:fe({msPerPage:le(),samples:le()}).optional(),state:fe({running:le(),runningFeeds:le(),scheduled:le(),errored:le(),erroredFeeds:le()}).optional()}),Sm=wm("type",[d_,u_,h_,f_,__,z_,w_,x_,A_,R_,D_,T_,I_,G_,xm,l_,r_,o_,c_]);new Set(Sm.options.map(n=>n.shape.type.value));function N_(n){return n.issues.map(e=>{const t=e.path.join(".");return t?`${t}: ${e.message}`:e.message}).join("; ")}function B_(n,e){const t=n.safeParse(e);return t.success?{ok:!0,value:t.data}:{ok:!1,error:N_(t.error)}}function C_(n){return B_(Sm,n)}const Em=fe({id:k(),label:k(),parentIds:it(k()),joinParentIds:it(k())}),P_=fe({name:k(),value:au()}),L_=Em.extend({pluginName:k(),pluginVersion:k().optional(),arguments:it(P_).optional()}),ou=fe({name:k(),pipelineId:le().optional(),nodes:it(L_)}),W_=["created","waiting","scheduled","started","registeringFiles","finishedSuccessfully","finishedWithError","cancelled","unknown"],Am=Ut(W_).catch("unknown"),k_=fe({count:le(),done:le(),error:le(),running:le(),other:le(),anomalies:it(fe({id:k(),status:Am})).optional()}),U_=fe({computeSeconds:le().optional(),dataBytes:le().optional()}),F_=Em.extend({instanceId:le(),pluginName:k(),pluginVersion:k().optional(),status:Am,vfsPath:k(),metrics:U_.optional(),tally:k_.optional(),computeResource:k().optional()}),Hc=fe({feedId:le(),feedName:k(),nodes:it(F_)}),j_=fe({feedId:le(),loaded:le(),total:le(),failed:k().optional()}),Xn={pipelineDiagram:"pipeline.diagram",feedDag:"feed.dag",feedIndexing:"feed.indexing"},$_=fe({id:le(),title:k(),owner:k(),status:k(),createdAt:k(),sizeBytes:le().optional(),wallSeconds:le().optional(),jobsDone:le().optional(),jobsTotal:le().optional(),jobsErrored:le().optional(),tags:it(k()).optional()}),Dm=fe({feeds:it($_)}),Tm="feed.list",V_=fe({plugin:k(),count:le(),errored:le().default(0),status:k(),parent:le().nullable()}),H_=fe({format:Ut(["dicom","nifti","mgz","jpeg","png","other","unknown"]),modality:k().optional(),seriesDescription:k().optional(),reason:k().optional(),sourceFeed:le().optional()}),q_=fe({id:le(),title:k().default(""),jobs:le(),status:k(),chain:it(k()),groups:it(V_).default([]),createdAt:k().default(""),data:H_.optional()}),Im=fe({feeds:it(q_),whole:Rt()}),Gm="proc.universe",X_=fe({name:k(),positions:vm(k(),ym([le(),le(),le()])).nullable(),writtenAt:k().nullable(),laying:fe({nodes:le(),fraction:le()}).nullable().optional()}),K_="proc.layout",Y_=fe({name:k(),type:k(),optional:Rt(),default:au().optional(),help:k().optional(),flag:k()}),Z_=fe({id:le().optional(),name:k(),version:k(),type:k(),title:k().optional(),description:k().optional(),authors:k().optional(),documentation:k().optional(),category:k().optional(),parameters:it(Y_),command:k().optional()}),Q_="plugin.info",J_=fe({seriesUID:k(),description:k(),modality:k(),fileCount:le().optional(),vfsPath:k().optional(),pulled:Rt().optional(),pulledFiles:le().optional(),folderPath:k().optional()}),e0=fe({studyUID:k().optional(),server:k().optional(),vfsPath:k().optional(),description:k(),patientName:k(),patientId:k(),date:k(),modalities:k(),accession:k(),series:it(J_)}),Rm=fe({replayed:Rt(),answeredAt:k()}),t0=["found","none","unasked"],s0=Ut(t0).catch("unasked"),n0=fe({patientId:k(),server:k().optional(),patientName:k().optional(),status:s0,studyCount:le(),seriesCount:le(),queryId:le().optional(),provenance:Rm.optional(),error:k().optional()}),i0=fe({queryId:le(),vfsPath:k(),pacsName:k(),expression:k(),studies:it(e0),provenance:Rm.optional(),patients:it(n0).optional()}),r0=fe({id:le(),identifier:k(),active:Rt()}),a0=fe({servers:it(r0)}),o0="pacs.servers",l0="pacs.query";function c0(n){return`pacs:patient:${n.server??"-"}:${n.patientId}`}const d0=["patient","study","series","image","equipment","meta","private","other"],Nm=Ut(d0).catch("other"),Bm=Rb(()=>fe({tag:k(),name:k(),vr:k(),value:k(),group:Nm,phi:Rt(),decoded:k().optional(),items:it(it(Bm)).optional()})),u0=fe({tag:k(),name:k(),vr:k(),group:Nm,phi:Rt(),distinct:le(),first:k(),last:k(),values:it(fe({path:k(),value:k().nullable()}))}),hh=fe({path:k(),subject:Ut(["file","folder"]),read:le(),of:le(),refused:it(k()),constant:it(Bm),varying:it(u0)}),h0=fe({rows:le(),columns:le(),pixelSpacing:ym([le(),le()]).optional(),sliceThickness:le().optional(),spacingBetweenSlices:le().optional()}),fh=fe({path:k(),seriesInstanceUID:k().optional(),studyInstanceUID:k().optional(),modality:k(),seriesDescription:k(),seriesNumber:le().optional(),instances:le(),frames:le(),order:Ut(["filename","unknown"]),geometry:h0.optional(),transferSyntax:fe({uid:k(),name:k().optional()}).optional(),bytes:le(),header:k(),files:it(k()),annotations:it(k())}),Ia={tags:"dicom.tags",series:"dicom.series"},f0=fe({path:k(),target:Ut(["series","volume"]),force:Rt().optional(),startAt:le().int().positive().optional()}),p0={view:"image.view"},m0=fe({state:Ut(["cold","warming","current"]),loaded:le(),total:le()});fe({user:k(),surface:k(),feeds:fe({total:le(),own:le(),shared:le(),public:le()}),jobs:fe({total:le(),finished:le(),errored:le(),cancelled:le(),running:le(),scheduled:le()}),failureRate:le().nullable(),index:m0,fortune:k()});const g0="session.notes",M0=fe({package:k(),headline:k(),body:k(),internal:Rt()}),b0=fe({package:k(),version:k(),bump:Ut(["major","minor","patch"]),changes:it(M0)}),_0=fe({date:k().nullable(),merge:k().nullable(),entries:it(b0)}),z0=fe({source:dt("daemon"),installed:vm(k(),k()),releases:it(_0),total:le(),all:Rt()});function as(n){return n.groups.map(e=>`${e.parent??"r"}:${e.plugin}`).join(">")}function Kn(n,e){return`feed:${n}:${e}`}function Cm(n){return`shape:${n}`}function Ar(n){return Math.log2(Math.max(1,n)+1)}function lu(n){if(!(n.errored<=0||n.count<=0))return Math.min(1,n.errored/n.count)}function Aa(n,e="jobs"){const t=[],s=new Set,i=[...n].sort((a,o)=>a.id-o.id),r=new Map;for(const a of i){if(a.groups.length===0)continue;const o=as(a);r.set(o,(r.get(o)??0)+1)}for(const a of i){if(a.groups.length===0)continue;const o=as(a),l=Cm(o);s.has(o)||(s.add(o),t.push({id:l,label:hl(o),parentIds:[],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:r.get(o)??1})),a.groups.forEach((c,d)=>{const u=lu(c);t.push({id:Kn(a.id,d),label:c.plugin,parentIds:[c.parent===null?l:Kn(a.id,c.parent)],joinParentIds:[],status:c.status,metric:e==="jobs"?Ar(c.count):1,...c.count>1?{count:c.count}:{},...u!==void 0?{share:u}:{}})})}return{nodes:t}}const qc="plugin:";function w0(n){return`${qc}${n}`}function Xc(n){return n.startsWith(qc)?n.slice(qc.length):null}function cu(n,e="jobs"){const t=[],s=new Map,i=[...n].sort((r,a)=>r.id-a.id);for(const r of i)if(r.groups.length!==0){for(const a of new Set(r.groups.map(o=>o.plugin)))s.set(a,(s.get(a)??0)+1);r.groups.forEach((a,o)=>{const l=lu(a);t.push({id:Kn(r.id,o),label:a.plugin,parentIds:a.parent===null?[]:[Kn(r.id,a.parent)],joinParentIds:[],status:a.status,metric:e==="jobs"?Ar(a.count):1,attrs:{plugin:a.plugin},...a.count>1?{count:a.count}:{},...l!==void 0?{share:l}:{}})})}for(const[r,a]of[...s].sort((o,l)=>o[0]<l[0]?-1:1))t.push({id:w0(r),label:r,parentIds:[],joinParentIds:[],metric:1+Math.log(a),hue:"#e8f4ff",ring:!0,attrs:{kind:"star",plugin:r}});return{nodes:t}}function ph(n,e="jobs"){const t=new Map;for(const i of n){const r=i.createdAt===void 0?Number.NaN:Date.parse(i.createdAt);Number.isFinite(r)&&t.set(i.id,r)}return{nodes:cu(n,e).nodes.filter(i=>i.attrs?.kind!=="star").map(i=>{const r=t.get(Number(i.id.split(":")[1]));return r===void 0?i:{...i,attrs:{...i.attrs,createdAt:r}}})}}function hl(n){const e=[];for(const t of n.split(">")){const s=t.slice(t.indexOf(":")+1);s.length>0&&!e.includes(s)&&e.push(s)}return e.join(" > ")}const y0=.5,v0=5,O0=.02,Kc="data:",x0={dicom:"DICOM",nifti:"NIfTI",mgz:"MGZ",jpeg:"JPEG",png:"PNG",other:"OTHER",unknown:"UNREADABLE",unread:"NOT YET READ"};function S0(n){const e=n.toUpperCase().replace(/[_\-.,/\\()[\]:;+]+/g," ").split(/\s+/).filter(t=>t.length>0).filter(t=>!/^\d+$/.test(t)).filter(t=>!/^\d+X\d+$/.test(t)).filter(t=>!/^FOV\d*$/.test(t)).filter(t=>!/^\d+(\.\d+)?(MM|CM)$/.test(t));return[...new Set(e)]}function E0(n,e){if(n.length===0||e.length===0)return 0;const t=new Set(n);return e.filter(i=>t.has(i)).length/Math.min(n.length,e.length)}function Pm(n){const e=new Map;for(const r of n)e.set(r,(e.get(r)??0)+1);const t=[...e.keys()].sort((r,a)=>(e.get(a)??0)-(e.get(r)??0)||(r<a?-1:1)),s=[],i=new Map;for(const r of t){const a=S0(r),o=a.length===0?void 0:s.find(l=>E0(l.words,a)>=y0);if(o!==void 0){i.set(r,o.name);continue}s.push({name:r,words:a}),i.set(r,r)}return i}function Lm(n,e){const t=n.data?.format??"unread",s=[{key:t,label:x0[t]??t.toUpperCase()}];if(t!=="dicom")return s;const i=n.data?.modality??"NO MODALITY";s.push({key:`${t}/${i}`,label:i});const r=n.data?.seriesDescription,a=r===void 0?"NO DESCRIPTION":e.get(r)??r;return s.push({key:`${t}/${i}/${a}`,label:a}),s}function Il(n){return`${Kc}${n}`}function Yc(n){return n.startsWith(Kc)?n.slice(Kc.length):null}function mh(n,e="jobs"){const t=[...n].filter(d=>d.groups.length>0).sort((d,u)=>d.id-u.id),s=Pm(t.map(d=>d.data?.seriesDescription).filter(d=>d!==void 0)),i=new Map,r=[];for(const d of t){const u=Lm(d,s);let h=null;for(const f of u){const b=i.get(f.key);b===void 0?i.set(f.key,{label:f.label,feeds:1,parent:h}):b.feeds+=1,h=f.key}const p=Il(h);d.groups.forEach((f,b)=>{const g=lu(f);r.push({id:Kn(d.id,b),label:f.plugin,parentIds:[f.parent===null?p:Kn(d.id,f.parent)],joinParentIds:[],status:f.status,metric:e==="jobs"?Ar(f.count):1,...f.count>1?{count:f.count}:{},...g!==void 0?{share:g}:{}})})}const a=new Map;for(const d of t){const u=d.groups.findIndex(h=>h.parent===null);u>=0&&a.set(d.id,Kn(d.id,u))}const o=new Map(r.map(d=>[d.id,d]));for(const d of t){const u=d.data?.sourceFeed,h=u===void 0||u===d.id?void 0:a.get(u),p=a.get(d.id);if(h===void 0||p===void 0)continue;const f=o.get(p);f!==void 0&&(f.joinParentIds=[...f.joinParentIds,h],f.joinFaint=!0)}const l=(d,u)=>d.split("/").length<3||u>=Math.max(v0,O0*t.length);return{graph:{nodes:[...[...i].map(([d,u])=>({id:Il(d),label:u.label,parentIds:u.parent===null?[]:[Il(u.parent)],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:u.feeds,...l(d,u.feeds)?{caption:`${u.label} · ${u.feeds.toLocaleString("en-US")}`}:{}})),...r]},hubs:new Map([...i].map(([d,u])=>[d,{label:u.label,feeds:u.feeds}]))}}function A0(n,e){const t=Yc(n);if(t===null)return null;const s=t.split("/"),i=s.map((a,o)=>e.get(s.slice(0,o+1).join("/"))?.label??s[o]??""),r=e.get(t)?.feeds??0;return`${i.join(" · ")} · ${r.toLocaleString("en-US")} feed${r===1?"":"s"}`}const Zc=12,D0=240;function T0(n){return n<=D0?Zc:void 0}function Qc(n,e){return`fold:${n}:${e}`}function Wm(n){const e=n.match(/^fold:(.+):\d+$/);return e===null?null:e[1]}function I0(n){const e=n.match(/^feed:(\d+):/);if(e!==null)return`feed:${e[1]}`;const t=Wm(n);return t===null?null:`fold:${t}`}const G0=fe({at:le(),method:k(),family:k(),path:k(),status:le(),ms:le()}),R0=fe({family:k(),count:le(),ms:le()});fe({since:k(),total:le(),ms:le(),families:it(R0),last:it(G0)});const km=24,Jc="argus.dormant";class N0{constructor(e=km,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(Jc,JSON.stringify([...this.groups.values()]))}catch{}}rehydrate(){if(this.store!==void 0)try{const e=this.store.getItem(Jc);if(e===null)return;const t=JSON.parse(e);if(!Array.isArray(t))return;for(const s of t)s!==null&&typeof s=="object"&&typeof s.id=="string"&&this.groups.set(s.id,s)}catch{}}}function gh(){try{const n=globalThis.localStorage;return n===void 0?void 0:(n.getItem(Jc),n)}catch{return}}class B0{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 s=document.createElement("span");if(s.className="panes-card-figure",e.thumbnail!==void 0){const o=document.createElement("img");o.src=e.thumbnail,o.alt="",s.appendChild(o)}else s.classList.add("panes-card-glyph"),s.textContent=e.members.includes("files")&&!e.members.includes("viewer")?"▤":"▣";t.appendChild(s);const i=document.createElement("span");i.className="panes-card-label",i.textContent=e.label,t.appendChild(i);const r=document.createElement("span");r.className="panes-card-badges";for(const o of C0(e.members)){const l=document.createElement("span");l.className="panes-card-badge",l.textContent=o.toUpperCase(),r.appendChild(l)}t.appendChild(r);const a=document.createElement("button");return a.className="panes-card-dismiss",a.dataset.dismiss=e.id,a.title=`forget ${e.label}`,a.textContent="DISMISS",t.appendChild(a),t}click_handle=e=>{const t=e.target,s=t.closest("[data-dismiss]");if(s!==null){e.stopPropagation();const r=s.dataset.dismiss??"";this.host.dismiss(r),this.render();return}const i=t.closest("[data-restore]");i!==null&&this.host.restore(i.dataset.restore??"")}}function C0(n){return[...new Set(n)]}const P0="G1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7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1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsybSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzk7MTc7MjRtIBtbMG0bWzM4OzI7MjM7NDU7NjJtLhtbMG0bWzM4OzI7NDE7Nzk7MTA5bTobWzBtG1szODsyOzU5OzExMzsxNTVtPRtbMG0bWzM4OzI7NzU7MTQ0OzE5NW0rG1swbRtbMzg7Mjs3NjsxNDQ7MTkzbSsbWzBtG1szODsyOzE0OzI3OzM3bSAbWzBtG1szODsyOzc1OzE0MjsxODltKxtbMG0bWzM4OzI7Nzc7MTQ1OzE5Mm0rG1swbRtbMzg7Mjs2NzsxMjY7MTY1bT0bWzBtG1szODsyOzU1OzEwMjsxMzRtLRtbMG0bWzM4OzI7NDE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sxODE7MjI0bSobWzBtG1szODsyOzEwMTsxODM7MjI0bSobWzBtG1szODsyOzkzOzE2ODsyMDVtKxtbMG0bWzM4OzI7ODE7MTQ4OzE3OW0rG1swbRtbMzg7Mjs2ODsxMjM7MTQ4bT0bWzBtG1szODsyOzUxOzkzOzExMm0tG1swbRtbMzg7MjszNDs2MTs3M206G1swbRtbMzg7MjsyMjs0MDs0N20uG1swbRtbMzg7Mjs5OzE2OzE5bSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7Mjsw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tbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjsybSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swb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swOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtCg==",L0=/\x1b\[[0-9;]*m/g,Mh="\x1B[0m",bh="\x1B[7m",Um=atob(P0).trimEnd().split(`
3
3
  `);Um.map(n=>n.replace(L0,""));function W0(n){const e=n.replace(/\x1b\[0m/g,`${Mh}${bh}`);return`${bh}${e}${Mh}`}function k0(n,e=!1){const t=Um;return e?t.map(W0):t}function Fm(n){const e=n.lastIndexOf("/");return e<=0?"/":n.slice(0,e+1)}function U0(n){const e=new URLSearchParams(n.search).get("ws");return e!==null&&e.length>0?e:`${n.protocol==="https:"?"wss":"ws"}://${n.host}${Fm(n.pathname)}`}function SR(n,e){return new URL(n,e).href}function du(n,e){const t=`path=${encodeURIComponent(n)}`;return e.length>0?`vfs?${t}&token=${encodeURIComponent(e)}`:`vfs?${t}`}function F0(n,e){return`${du(n,e)}&download=1`}function fl(n){return new URLSearchParams(n).has("door")}function Ho(n,e){const s=Fm(n).split("/").filter(i=>i.length>0).slice(0,-2);return`/${s.length>0?`${s.join("/")}/`:""}${e}`}const j0="daemon";class uu{socket;handlers;token;pending=new Map;pendingCompletions=new Map;silentIds=new Set;nextId=0;constructor(e,t,s){this.socket=e,this.handlers=t,this.token=s,this.socket.onmessage=i=>this.message_handle(String(i.data)),this.socket.onclose=()=>this.handlers.close_handle?.()}static session_attach(e,t,s){return new Promise((i,r)=>{const a=new WebSocket(e);a.onerror=()=>r(new Error(`cannot reach the daemon at ${e}`)),a.onopen=()=>{a.send(JSON.stringify({type:"attach",protocolVersion:Lc,token:t,capabilities:{shellCommands:!1,color:!0,hiddenInput:!0,fileDelivery:!0,localFilesystem:!1}}))},a.onmessage=o=>{const l=_h(String(o.data));if(!l){r(new Error("invalid attach response")),a.close();return}if(l.type==="error"){r(new Error(l.reason)),a.close();return}if(l.type!=="attached"){r(new Error(`unexpected attach response: ${l.type}`)),a.close();return}const c=new uu(a,s,t);i({client:c,attach:{session:l.session,protocolVersion:l.protocolVersion,...l.stack!==void 0?{stack:l.stack}:{},...l.hostControl!==void 0?{hostControl:l.hostControl}:{},...l.stale!==void 0?{stale:l.stale}:{},...l.surface!==void 0?{surface:l.surface}:{}}})}})}line_execute(e,t){const s=`argus-${this.nextId++}`;return t?.silent===!0&&this.silentIds.add(s),new Promise((i,r)=>{this.pending.set(s,{resolve:i,reject:r,liveChannels:new Set,observed:t?.observe!==!1}),this.socket.send(JSON.stringify({type:"execute",id:s,line:e,...t?.silent===!0&&t.operator!==!0?{instrument:!0}:{}}))})}line_complete(e){const t=`argus-c-${this.nextId++}`;return new Promise((s,i)=>{this.pendingCompletions.set(t,{resolve:s,reject:i}),this.socket.send(JSON.stringify({type:"complete",id:t,prefix:e}))})}regard_send(e){this.socket.send(JSON.stringify({type:"regard",regard:e}))}watch_send(e){this.socket.send(JSON.stringify({type:"watch",subject:e}))}unwatch_send(e){this.socket.send(JSON.stringify({type:"unwatch",subject:e}))}connection_close(){this.socket.close()}message_handle(e){const t=_h(e);if(t)switch(t.type){case"result":{this.silentIds.delete(t.id);const s=this.pending.get(t.id);if(s&&(this.pending.delete(t.id),s.resolve({envelopes:t.envelopes,liveChannels:s.liveChannels})),s===void 0||s.observed)for(const i of t.envelopes)this.handlers.envelope_observe?.(i);break}case"complete":{const s=this.pendingCompletions.get(t.id);s&&(this.pendingCompletions.delete(t.id),s.resolve({candidates:t.candidates,prefix:t.prefix}));break}case"output":{(t.channel==="data"||t.channel==="err")&&this.pending.get(t.id)?.liveChannels.add(t.channel),this.silentIds.has(t.id)||this.handlers.output_receive?.(t.channel,t.chunk);break}case"progress":{this.handlers.progress_receive?.(t);break}case"session":{if(t.surface===j0){this.handlers.ambient_receive?.(t.envelope);break}this.handlers.session_receive?.(t.surface,t.envelope),this.handlers.envelope_observe?.(t.envelope);break}case"watched":{this.handlers.watched_receive?.(t.subject,t.state);break}case"stale":this.handlers.stale_receive?.(t.stale);break;case"closing":this.handlers.closing_receive?.(t.cause);break;case"numbered":{this.handlers.numbered_receive?.({id:t.id,source:t.source,rows:t.rows,handles:t.handles});break}case"promptline":{this.handlers.promptline_receive?.(t.context);break}case"telemetry":{this.handlers.telemetry_receive?.(t.index,{lane:t.lane,cube:t.cube,state:t.state,surfaces:t.surfaces});break}case"regard":{this.handlers.regard_receive?.(t.regard);break}case"error":{if(t.id!==void 0){const s=this.pending.get(t.id);s&&(this.pending.delete(t.id),s.reject(new Error(t.reason)));const i=this.pendingCompletions.get(t.id);i&&(this.pendingCompletions.delete(t.id),i.reject(new Error(t.reason)))}break}case"prompt":{const s=this.handlers.ask_receive;if(s===void 0){this.reply_send({type:"promptError",promptId:t.promptId,reason:"this surface has no way to ask"});break}const i=t.promptId;s({message:t.message,kind:S_(t),...t.path?.suggest===void 0?{}:{suggest:t.path.suggest},...t.path===void 0?{}:{path:t.path},...t.commit===void 0?{}:{commit:t.commit}}).then(r=>{if(r===null){this.reply_send({type:"promptError",promptId:i,reason:"the operator abandoned the question"});return}this.reply_send({type:"promptAnswer",promptId:i,answer:r})}).catch(r=>{const a=r instanceof Error?r.message:"the question could not be answered";this.reply_send({type:"promptError",promptId:i,reason:a})});break}case"pipe":{this.reply_send({type:"pipeError",pipeId:t.pipeId,reason:"the argus surface cannot run pipeline segments"});break}case"shell":{this.reply_send({type:"shellError",shellId:t.shellId,reason:"the argus surface cannot run shell commands"});break}case"edit":{this.edit_run(t);break}case"deliver":{this.deliver_run(t);break}}}edit_run(e){const t=this.handlers.edit_receive;let s=!1,i="the argus surface cannot open an editor";if(t!==void 0)try{s=t({content:e.content,...e.path===void 0?{}:{path:e.path},...e.extension===void 0?{}:{extension:e.extension}}),i="the editor pane did not open"}catch(r){i=r instanceof Error?r.message:String(r)}if(s){this.reply_send({type:"editResult",editId:e.editId,content:e.content,changed:!1,opened:!0});return}this.reply_send({type:"editError",editId:e.editId,reason:i})}async deliver_run(e){try{const t=du(e.path,this.token),s=await fetch(t);if(!s.ok)throw new Error(`calypso refused to serve this file (HTTP ${s.status})`);const i=await s.blob(),r=URL.createObjectURL(i),a=document.createElement("a");a.href=r,a.download=e.filename,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(r),0),this.reply_send({type:"deliverResult",deliverId:e.deliverId,location:e.filename,bytes:i.size})}catch(t){const s=t instanceof Error?t.message:String(t);this.reply_send({type:"deliverError",deliverId:e.deliverId,reason:s})}}reply_send(e){this.socket.send(JSON.stringify(e))}}function _h(n){try{const e=C_(JSON.parse(n));return e.ok&&e.value!==void 0?e.value:null}catch{return null}}const Zs=["#000000","#f24444","#33cc66","#ffaa44","#5599ff","#cc88ff","#44cccc","#ffeecc","#777777","#ff6666","#66ee99","#ffcc66","#77bbff","#dd99ff","#66dddd","#ffffff"],$0={yellow:Zs[3],white:Zs[7],cyan:Zs[6],green:Zs[2],magenta:Zs[5]};function jm(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,inverse:!1,underline:!1}}function V0(n){if(n<16)return Zs[n]??"#ffeecc";if(n<232){const t=n-16,s=[0,95,135,175,215,255],i=s[Math.floor(t/36)%6]??0,r=s[Math.floor(t/6)%6]??0,a=s[t%6]??0;return`#${(i<<16|r<<8|a).toString(16).padStart(6,"0")}`}const e=8+(n-232)*10;return`#${(e<<16|e<<8|e).toString(16).padStart(6,"0")}`}function H0(n,e){for(let t=0;t<e.length;t++){const s=e[t]??0;if(s===0)Object.assign(n,jm());else if(s===1)n.bold=!0;else if(s===2)n.dim=!0;else if(s===3)n.italic=!0;else if(s===4)n.underline=!0;else if(s===7)n.inverse=!0;else if(s===27)n.inverse=!1;else if(s===22)n.bold=!1,n.dim=!1;else if(s===23)n.italic=!1;else if(s===24)n.underline=!1;else if(s>=30&&s<=37)n.fg=Zs[s-30]??null;else if(s>=90&&s<=97)n.fg=Zs[s-90+8]??null;else if(s===39)n.fg=null;else if(s>=40&&s<=47)n.bg=Zs[s-40]??null;else if(s>=100&&s<=107)n.bg=Zs[s-100+8]??null;else if(s===49)n.bg=null;else if(s===38||s===48){const i=e[t+1]??0;let r=null;if(i===5)r=V0(e[t+2]??0),t+=2;else if(i===2){const a=e[t+2]??0,o=e[t+3]??0,l=e[t+4]??0;r=`#${(a<<16|o<<8|l).toString(16).padStart(6,"0")}`,t+=4}s===38?n.fg=r:n.bg=r}}}function q0(n){const e=[],t=n.inverse?n.bg??"#000":n.fg,s=n.inverse?n.fg??"var(--daybreak)":n.bg;return t!==null&&e.push(`color:${t}`),s!==null&&e.push(`background-color:${s}`),n.bold&&e.push("font-weight:bold"),n.dim&&e.push("opacity:0.55"),n.italic&&e.push("font-style:italic"),n.underline&&e.push("text-decoration:underline"),e.join(";")}function xs(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Gl=/\x1b(?:\[([0-?]*)[ -/]*([@-~])|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_])/g;function mn(n){const e=jm();let t="",s=0;const i=a=>{if(a.length===0)return;const o=q0(e),l=xs(a.replace(/\r/g,""));t+=o.length>0?`<span style="${o}">${l}</span>`:l};Gl.lastIndex=0;let r=Gl.exec(n);for(;r!==null;){if(i(n.slice(s,r.index)),s=r.index+r[0].length,r[2]==="m"){const a=(r[1]??"").split(/[;:]/).map(o=>o.length>0?Number(o):0);H0(e,a)}r=Gl.exec(n)}return i(n.slice(s)),t}function X0(n){for(const[e,t]of Object.entries($0))n.style.setProperty(`--console-${e}`,t)}const ci={pacs:{bg:"#875FFF",fg:"#FFFFFF"},host:{bg:"#00AFFF",fg:"#001018"},user:{bg:"#00D787",fg:"#00140C"},dir:{bg:"#FFD75F",fg:"#201800"},physical:{bg:"#FF5F5F",fg:"#1B0000"},duration:{bg:"#FF8700",fg:"#201000"},status:{bg:"#FF005F",fg:"#FFFFFF"}},K0={cold:{icon:"",label:"proc cold",color:{bg:"#FF8700",fg:"#201000"}},cached:{icon:"",label:"proc cached, refreshing",color:{bg:"#5F5F87",fg:"#FFFFFF"}},failed:{icon:"",label:"proc failed",color:{bg:"#FF005F",fg:"#FFFFFF"}}},on={powerline:"",cube:"",database:"",user:"",folder:"",microscope:"",bolt:"",error:""},Y0=3e3,Z0=200;class Q0{output;splashGreeting=null;progressRegion;promptBar;inputGlyph;input;submit;complete;promptContext=null;busy=!0;pendingAsk=null;queuedLines=[];questionOpen=!1;history=[];historyIndex=0;streamBlock=null;streamPendingElement=null;streamPendingText="";streamPendingChannel="data";constructor(e,t,s){this.submit=t,this.complete=s,e.innerHTML=`
4
4
  <div class="argus-screen">
@@ -4233,24 +4233,24 @@ void main() {
4233
4233
  if (head > -0.1 && head < 1.2) pulse = smoothstep(0.14, 0.0, abs(vAlong - head));
4234
4234
  }
4235
4235
  gl_FragColor = vec4(base + vec3(1.0, 0.95, 0.8) * pulse * 1.3, opacity);
4236
- }`;let vc=null;function Jd(){return vc===null&&(vc=new Fu(1,1,1,10,1,!0)),vc}function kA(n,e){const t=performance.now(),s=new qt({uniforms:{time:{value:t},opacity:{value:1},born:{value:t},cycle:{value:e}},vertexShader:cM,fragmentShader:dM,transparent:!0}),i=Jd().clone(),r=new Float32Array(n.length*3),a=new Float32Array(n.length),o=new Float32Array(n.length),l=new Wu(i,s,n.length),c=new W(0,1,0),d=new kt;return n.forEach((u,h)=>{const p=u.to.clone().sub(u.from),f=p.length();d.position.copy(u.from).addScaledVector(p,.5),d.quaternion.setFromUnitVectors(c,f>0?p.divideScalar(f):c),d.scale.set(u.width,f,u.width),d.updateMatrix(),l.setMatrixAt(h,d.matrix),r.set([u.color.r,u.color.g,u.color.b],h*3),a[h]=u.mode,o[h]=u.start}),i.setAttribute("aColor",new ei(r,3)),i.setAttribute("aMode",new ei(a,1)),i.setAttribute("aStart",new ei(o,1)),l.instanceMatrix.needsUpdate=!0,l.frustumCulled=!1,l}function uM(n){return n==="live"?1:n==="done"||n==="failed"?2:0}class UA{host;sets=[];materials=[];glows=new Map;stale=!1;census=0;constructor(e){this.host=e}materialCount(){return this.materials.length}censusCount(){return this.census}holds(e){return this.sets.some(t=>t.members.has(e))}stale_mark(){this.stale=!0}build(e,t,s){const i=e.mix,r=this.host.palette(),a=[];for(const O of t){const S=this.host.node(O);if(S!==void 0){for(const M of S.parents){const y=this.host.node(M);y!==void 0&&s.has(M)&&a.push({fromId:M,from:y,toId:O,to:S,join:!1})}for(const M of S.joins){const y=this.host.node(M);y!==void 0&&s.has(M)&&a.push({fromId:M,from:y,toId:O,to:S,join:!0})}}}if(a.length===0)return;const o=new Map,l=(O,S=new Set)=>{const M=o.get(O);if(M!==void 0)return M;if(S.has(O))return 0;S.add(O);const y=this.host.node(O),E=y===void 0?[]:[...y.parents,...y.joins].filter(I=>s.has(I)),A=E.length===0?0:1+Math.max(...E.map(I=>l(I,S)));return o.set(O,A),A},c=performance.now(),d=new Float32Array(a.length*3),u=new Float32Array(a.length),h=new Float32Array(a.length),p=r.edge.clone().lerp(new ke("#ffffff"),.45),f=new Wu(Jd(),new qt({uniforms:{time:{value:c},opacity:{value:i},born:{value:c},cycle:{value:1}},vertexShader:cM,fragmentShader:dM,transparent:!0}),a.length),b=new W(0,1,0),g=new kt;let m=0;const z=[],w=new Map,_=new Set;a.forEach(({fromId:O,from:S,toId:M,to:y,join:E},A)=>{const I=y.position.clone().sub(S.position),G=I.length(),C=Math.max(.06,Math.min(S.radius,y.radius)*.34);g.position.copy(S.position).addScaledVector(I,.5),g.quaternion.setFromUnitVectors(b,G>0?I.clone().divideScalar(G):b),g.scale.set(C,G,C),g.updateMatrix(),f.setMatrixAt(A,g.matrix),z.push({from:O,to:M,width:C});const B=y.state==="failed"?r.error:E?r.join:p;d.set([B.r,B.g,B.b],A*3),u[A]=uM(y.state);const P=l(O);if(m=Math.max(m,P),h[A]=P*vr,u[A]===1&&_.add(M),u[A]===2){const L=h[A]+Mn/2;w.set(M,Math.min(w.get(M)??1/0,L)),P===0&&w.set(O,0)}}),f.instanceMatrix.needsUpdate=!0;const v=Jd().clone();if(v.setAttribute("aColor",new ei(d,3)),v.setAttribute("aMode",new ei(u,1)),v.setAttribute("aStart",new ei(h,1)),f.geometry=v,f.frustumCulled=!1,this.host.parent.add(f),e.tubes=f,f.material instanceof qt){this.materials.push(f.material);const O=f.material.uniforms.cycle;O!==void 0&&(O.value=(m+1)*vr+Mn/2+_p)}this.sets.push({mesh:f,edges:z,lamps:w,blinks:_,owner:e,entries:t,members:s})}census_build(e,t){if(e.length===0)return;const s=kA(e,(t+1)*vr+Mn/2+_p);this.host.parent.add(s),s.material instanceof qt&&this.materials.push(s.material),this.census=e.length}frame(e){if(this.materials.length!==0){for(const t of this.materials){const s=t.uniforms.time;s!==void 0&&(s.value=e)}this.stale&&this.restatus(),this.lamps_animate(e)}}follow(){const e=new W(0,1,0),t=new kt;for(const{mesh:s,edges:i}of this.sets)i.forEach(({from:r,to:a,width:o},l)=>{const c=this.host.sphere(r),d=this.host.sphere(a);if(c===void 0||d===void 0)return;const u=d.position.clone().sub(c.position),h=u.length();t.position.copy(c.position).addScaledVector(u,.5),t.quaternion.setFromUnitVectors(e,h>0?u.clone().divideScalar(h):e),t.scale.set(o,h,o),t.updateMatrix(),s.setMatrixAt(l,t.matrix)}),s.instanceMatrix.needsUpdate=!0}release(e){if(this.host.parent.remove(e),this.sets=this.sets.filter(t=>t.mesh!==e),e.geometry.dispose(),e.material instanceof qt){const t=e.material;this.materials=this.materials.filter(s=>s!==t),t.dispose()}}clear(){this.materials=[],this.census=0,this.sets=[];for(const e of this.glows.values())e.material.dispose();this.glows=new Map}restatus(){this.stale=!1;const e=this.sets;this.sets=[];for(const t of e){if(this.host.parent.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material instanceof qt){const s=t.mesh.material;this.materials=this.materials.filter(i=>i!==s),s.dispose()}t.owner.tubes=null,this.build(t.owner,t.entries,t.members)}this.follow()}lamps_animate(e){const t=new Set;for(const{mesh:s,lamps:i,blinks:r}of this.sets){if(i.size===0&&r.size===0||!(s.material instanceof qt))continue;const a=Number(s.material.uniforms.born?.value??e),o=Number(s.material.uniforms.cycle?.value??1),l=((e-a)%o+o)%o,c=Math.min(1,Math.max(0,(o-l)/SA));for(const[u,h]of i){const p=l-h;this.lamp_paint(u,p<0?0:c,p>=0&&p<mo?p/mo:-1,t)}const d=(e%Mn+Mn)%Mn;for(const u of r){if(i.has(u))continue;const h=Math.max(0,1-d/(Mn*.8));this.lamp_paint(u,h*h,d<mo?d/mo:-1,t)}}for(const[s,i]of this.glows)t.has(s)||(i.visible=!1,this.host.sphere(s)===void 0&&(this.host.parent.remove(i),i.material.dispose(),this.glows.delete(s)))}lamp_paint(e,t,s,i){const r=this.host.sphere(e);if(r===void 0||!(r.material instanceof Ei))return;let a=r.userData.lampBase;a instanceof ke||(a=r.material.color.clone(),r.userData.lampBase=a);const o=s<0?0:(1-s)**2;if(r.material.color.copy(a).multiplyScalar(zp+(1-zp)*Math.max(t,o)).lerp(wp,Math.min(1,.22*t+.7*o)),s<0)return;let l=this.glows.get(e);l===void 0&&(l=new Pu(new _l({map:lM(),color:a.clone().lerp(wp,.35),transparent:!0,blending:Ci,depthWrite:!1})),this.glows.set(e,l),this.host.parent.add(l));const c=r.geometry.parameters?.radius??.55,d=1-(1-s)**3;l.position.copy(r.position),l.scale.setScalar(c*(2+xA*d)*r.scale.x),l.material.opacity=.9*(1-s)**1.5,l.visible=!0,i.add(e)}}class FA{host;groups=new Map;lastAt=0;constructor(e){this.host=e}size(){return this.groups.size}solidCount(){let e=0;for(const t of this.groups.values())t.mix>0&&(e+=1);return e}gather(e,t){for(const s of e){if(s.dim)continue;const i=t(s.id);if(i===null)continue;let r=this.groups.get(i);r===void 0&&(r={entries:[],center:new W,maxRadius:0,mix:0,target:0,meshes:[],tubes:null,threadSegments:[]},this.groups.set(i,r)),r.entries.push(s),r.maxRadius=Math.max(r.maxRadius,s.radius)}for(const s of this.groups.values()){for(const i of s.entries)s.center.add(i.position);s.center.divideScalar(Math.max(1,s.entries.length))}}thread_note(e,t){this.groups.get(e)?.threadSegments.push(t)}step(e,t,s){if(this.groups.size===0)return;const i=this.lastAt===0?0:Math.min(100,s-this.lastAt);this.lastAt=s;const r=e.elements;for(const a of this.groups.values()){let o=1/0;for(const d of a.entries){const u=d.position,h=-(r[2]*u.x+r[6]*u.y+r[10]*u.z+r[14]);h>0&&h<o&&(o=h)}const l=o===1/0?0:2*a.maxRadius*t/o;if(a.target===0&&l>yA?a.target=1:a.target===1&&l<vA&&(a.target=0),a.mix===a.target)continue;const c=i===0?1:i/OA;a.mix=a.target>a.mix?Math.min(1,a.mix+c):Math.max(0,a.mix-c),a.mix>0&&a.meshes.length===0&&this.solid_build(a);for(const d of a.meshes)d.material instanceof Ei&&(d.material.opacity=a.mix);if(a.tubes!==null&&a.tubes.material instanceof qt){const d=a.tubes.material.uniforms.opacity;d!==void 0&&(d.value=a.mix)}this.host.stars.stars_fade(a.entries,1-a.mix),this.host.stars.threads_fade(a.threadSegments,1-a.mix),a.mix===0&&this.solid_release(a)}this.host.stars.flush()}clear(){this.groups=new Map}solid_build(e){const t=new Set(e.entries.map(s=>s.id));for(const s of e.entries){const i=this.host.look(s.id);i!==void 0&&e.meshes.push(this.host.spheres.sphere_add(s.id,i.position,i.radius,{color:i.color,fade:e.mix}))}this.host.tubes.build(e,e.entries.map(s=>s.id),t)}solid_release(e){for(const t of e.meshes)this.host.spheres.remove(t);e.tubes!==null&&(this.host.tubes.release(e.tubes),e.tubes=null),e.meshes=[]}}class jA{host;mesh=null;base=null;memberIds=[];memberPositions=[];constructor(e){this.host=e}drawn(){return this.mesh!==null}ids(){return this.memberIds}positions(){return this.memberPositions}build(e,t,s){let i=0;for(const z of e)z.ghost!==!0&&(i+=Math.max(1,z.count));const r=new $u(1,1),a=new Ei({color:"#ffffff",roughness:.5,metalness:.1}),o=[],l=new Wu(r,a,t?1:i),c=new ke,d=new kt,u=new Map,h=new Map;let p=0,f=1;const b=new W;for(const z of e)b.add(z.position);b.divideScalar(Math.max(1,e.length));for(const z of e){if(z.ghost===!0)continue;const w=Math.max(1,z.count),_=w===1?0:z.radius*(1.6+.55*Math.cbrt(w)),v=w===1?z.radius:Math.max(.06,Math.min(z.radius*.5,2.2*_/Math.sqrt(w))),O=[];for(let S=0;S<w;S++){const M=w===1?z.position.clone():EA(S,w,_).add(z.position);O.push(M),c.set(z.color),t?o.push({id:z.id,position:M,radius:v,color:c.clone(),dim:z.dim,ember:z.ember}):(d.position.copy(M),d.scale.setScalar(v),d.updateMatrix(),l.setMatrixAt(p,d.matrix),l.setColorAt(p,c)),this.memberIds.push(z.id),this.memberPositions.push(M),p+=1,f=Math.max(f,b.distanceTo(M)+v)}u.set(z.id,O),h.set(z.id,v)}if(t){const z=this.host.starsView();this.host.stars.draw(o,z.pixelRatio,z.heightPx,z.fovDeg)}else l.instanceColor&&(l.instanceColor.needsUpdate=!0),this.host.parent.add(l),this.mesh=l,this.base=l.instanceColor?Float32Array.from(l.instanceColor.array):null;const g=[];for(const z of e){const w=u.get(z.id)??[];for(const _ of z.parents){const v=u.get(_);if(!(!v||v.length===0))for(let O=0;O<w.length;O++){const S=w[O],M=v.length===w.length?v[O]:v[O%v.length];S===void 0||M===void 0||g.push(S.x,S.y,S.z,M.x,M.y,M.z)}}}const m=g.length/6;if(!t&&m>0&&m<=WA)this.tubes_build(e,u,h,s);else if(g.length>0){const z=new Ht;z.setAttribute("position",new Nt(g,3)),this.host.parent.add(new Vg(z,t?new Nr({color:s.edge,transparent:!0,opacity:aM,blending:Ci,depthWrite:!1}):new Nr({color:s.edge,transparent:!0,opacity:.35})))}return{center:b,radius:f}}flare(e,t,s,i){let r=0;if(this.mesh===null||this.base===null||!this.mesh.instanceColor)return r;const a=this.mesh.instanceColor.array,o=this.base;for(let l=0;l<this.memberIds.length;l++){const c=e(this.memberIds[l]??"");if(c===void 0)continue;r=Math.max(r,c);const d=t-c,u=d>=0&&d<=i?Math.sin(d/i*Math.PI):0,h=l*3;a[h]=o[h]+(s.r-o[h])*u,a[h+1]=o[h+1]+(s.g-o[h+1])*u,a[h+2]=o[h+2]+(s.b-o[h+2])*u}return this.mesh.instanceColor.needsUpdate=!0,r}pick(e){if(this.mesh===null)return null;const t=e.intersectObject(this.mesh)[0];return t===void 0||t.instanceId===void 0?null:(this.mesh.setColorAt(t.instanceId,new ke("#ffffff")),this.mesh.instanceColor&&(this.mesh.instanceColor.needsUpdate=!0),this.memberIds[t.instanceId]??null)}clear(){this.mesh=null,this.base=null,this.memberIds=[],this.memberPositions=[]}tubes_build(e,t,s,i){const r=new Map(e.map(u=>[u.id,u])),a=new Map,o=(u,h=new Set)=>{const p=a.get(u);if(p!==void 0)return p;if(h.has(u))return 0;h.add(u);const f=(r.get(u)?.parents??[]).filter(g=>r.has(g)),b=f.length===0?0:1+Math.max(...f.map(g=>o(g,h)));return a.set(u,b),b},l=i.edge.clone().lerp(new ke("#ffffff"),.45),c=[];let d=0;for(const u of e){const h=t.get(u.id)??[];for(const p of u.parents){const f=t.get(p);if(!f||f.length===0)continue;const b=Math.max(.02,Math.min(s.get(u.id)??.1,s.get(p)??.1)*.34),g=o(p)*vr;d=Math.max(d,o(p));for(let m=0;m<h.length;m++){const z=h[m],w=f.length===h.length?f[m]:f[m%f.length];w===void 0||z===void 0||c.push({from:w,to:z,width:b,color:u.state==="failed"?i.error:l,mode:uM(u.state),start:g})}}}this.host.tubes.census_build(c,d)}}const vp=.028,$A=.25,VA="rgba(0, 0, 0, 0.7)",aa=48;class HA{parent;captions=new Map;shown=!0;constructor(e){this.parent=e}count(){return this.captions.size}caption_add(e,t,s,i,r,a,o=0){const l=document.createElement("canvas"),c=l.getContext("2d"),d=`600 ${aa}px sans-serif`;let u=t.length*aa*.6;if(c!==null&&(c.font=d,u=Math.ceil(c.measureText(t).width)),l.width=Math.max(1,u+aa),l.height=Math.round(aa*1.5),c!==null){c.font=d,c.textBaseline="middle";const b=l.height/4;c.fillStyle=VA,c.beginPath(),c.roundRect(0,0,l.width,l.height,b),c.fill(),c.fillStyle=`#${r.getHexString()}`,c.fillText(t,aa/2,l.height/2)}const h=new qg(l),p=new _l({map:h,transparent:!0,depthWrite:!1,depthTest:!1,sizeAttenuation:!1,opacity:a?$A:.9}),f=new Pu(p);f.scale.set(vp*(l.width/l.height),vp,1),f.center.set(.5,0),f.position.set(s.x,s.y+i,s.z),f.renderOrder=4,f.visible=this.shown,this.parent.add(f),this.captions.get(e)?.texture.dispose(),this.captions.set(e,{sprite:f,texture:h,rank:o})}declutter(e){if(!this.shown)return 0;const t=[...this.captions.values()].sort((o,l)=>l.rank-o.rank),s=[],i=new W,r=e.projectionMatrix.elements[0]??1,a=e.projectionMatrix.elements[5]??1;for(const o of t){if(o.sprite.getWorldPosition(i).project(e),i.z>1){o.sprite.visible=!1;continue}const l=o.sprite.scale.x*r/2,c={left:i.x-l,right:i.x+l,bottom:i.y,top:i.y+o.sprite.scale.y*a},d=s.some(u=>c.left<u.right&&u.left<c.right&&c.bottom<u.top&&u.bottom<c.top);o.sprite.visible=!d,d||s.push(c)}return s.length}shown_set(e){if(this.shown=e,!e)for(const t of this.captions.values())t.sprite.visible=!1}shown_get(){return this.shown}clear(){for(const e of this.captions.values())e.texture.dispose();this.captions=new Map}}const qA=.0022,XA=.006,KA=.0035,YA=1e4,Op=700,xp=new W(0,1,0),ZA={minDistance:8,margin:1.15,stance:"axis",farFloor:200,farScale:2};function QA(n){return n*n*(3-2*n)}class JA{camera;world;clock;focus=new W;flight=null;home=null;holding=!1;touched=!1;spinIdleUntil=0;tumbleAxis=new W(0,1,0);tumblePhase;constructor(e,t,s=Date.now,i=Math.random()*Math.PI*2){this.camera=e,this.world=t,this.clock=s,this.tumblePhase=i}flying(){return this.flight!==null}holding_get(){return this.holding}touched_get(){return this.touched}touch_note(){this.touched=!0}spin_pause(){this.spinIdleUntil=this.clock()+YA}eyeDistance(){return this.camera.position.distanceTo(this.focus)}turn_about(e,t){const s=new Ui().setFromAxisAngle(e,t);this.world.position.sub(this.focus).applyQuaternion(s).add(this.focus),this.world.quaternion.premultiply(s)}orbit(e,t){this.turn_about(xp,e*.005),this.turn_about(new W().setFromMatrixColumn(this.camera.matrixWorld,0).normalize(),t*.005)}dolly(e,t=!1){if(this.spin_pause(),this.touched=!0,t){const a=this.camera.getWorldDirection(new W),o=Math.max(4,this.camera.position.length())*.0012;this.camera.position.addScaledVector(a,-e*o);return}const s=this.camera.position.clone().sub(this.focus),i=s.length(),r=Math.min(Math.max(i*Math.exp(e*.001),1.5),Math.max(40,this.camera.far*.45));this.camera.position.copy(this.focus).addScaledVector(s,r/Math.max(1e-4,i))}pan(e,t){const s=this.camera.position.distanceTo(this.focus)*.0016,i=new W().setFromMatrixColumn(this.camera.matrixWorld,0).multiplyScalar(-e*s).add(new W().setFromMatrixColumn(this.camera.matrixWorld,1).multiplyScalar(t*s));this.camera.position.add(i),this.focus.add(i)}frame(e,t,s={}){const i={...ZA,...s},r=Math.max(i.minDistance,this.fitDistance(t)*i.margin);this.world.position.copy(e).applyQuaternion(this.world.quaternion).negate(),this.focus.set(0,0,0),i.stance==="threeQuarter"?this.camera.position.set(r*.5,r*.4,r*.85):this.camera.position.set(0,0,r),this.camera.far=Math.max(i.farFloor,(r+t)*i.farScale),this.camera.updateProjectionMatrix(),this.camera.lookAt(0,0,0)}touch_clear(){this.touched=!1}flyToFit(e,t,s,i=1,r=1.15){if(e.length===0){s();return}let a=0;const o=new W;for(const h of e)o.add(h.position),a=Math.max(a,h.radius);o.divideScalar(e.length);const l=e.map(h=>o.distanceTo(h.position)).sort((h,p)=>h-p),c=Math.max(1,Math.min(l.length,Math.ceil(l.length*Math.min(1,Math.max(.1,i))))),d=Math.max(1,(l[c-1]??1)+a),u=Math.max(3,this.fitDistance(d)*r);this.camera.far=Math.max(this.camera.far,(u+d)*2),this.camera.updateProjectionMatrix(),this.flyAlongLine(o,u,t,s)}flyToward(e,t,s,i){this.flyAlongLine(e.position,Math.max(t,e.radius*4),s,i)}flyInto(e,t){if(this.flight!==null||this.holding)return!1;this.holding=!0,this.home={position:this.camera.position.clone(),quaternion:this.camera.quaternion.clone()};const s=e.clone().add(this.camera.position.clone().sub(e).normalize().multiplyScalar(.4));return this.flight_begin(s,this.aim_from(this.camera.position,e),Op,t),!0}flyBack(e){const t=this.home;if(t===null){this.holding=!1,e();return}this.flight_begin(t.position.clone(),t.quaternion.clone(),Op,()=>{this.home=null,this.holding=!1,this.spin_pause(),e()})}flight_step(){const e=this.flight;if(e===null)return;const t=Math.min(1,(this.clock()-e.startedAt)/e.durationMs),s=QA(t);this.camera.position.lerpVectors(e.fromPos,e.toPos,s),this.camera.quaternion.slerpQuaternions(e.fromQuat,e.toQuat,s),t>=1&&(this.flight=null,e.onDone())}spin_step(e){!e||this.holding||this.flight!==null||this.clock()<this.spinIdleUntil||this.turn_about(xp,qA)}tumble_step(){this.tumblePhase+=KA,this.tumbleAxis.set(Math.sin(this.tumblePhase*.7),Math.cos(this.tumblePhase*.4)+.6,Math.sin(this.tumblePhase*.3)*.8).normalize(),this.world.rotateOnWorldAxis(this.tumbleAxis,XA)}fitDistance(e){const t=this.camera.fov*Math.PI/180,s=e/Math.tan(t/2),i=e/(Math.tan(t/2)*Math.max(.1,this.camera.aspect));return Math.max(s,i)}aim_from(e,t){const s=this.camera.clone();return s.position.copy(e),s.lookAt(t),s.quaternion.clone()}flyAlongLine(e,t,s,i){const r=this.camera.position.clone().sub(e);r.lengthSq()<1e-4&&r.set(0,0,1),r.normalize();const a=e.clone().add(r.multiplyScalar(t));this.focus.copy(e),this.flight_begin(a,this.aim_from(a,e),s,i)}flight_begin(e,t,s,i){this.flight={fromPos:this.camera.position.clone(),toPos:e,fromQuat:this.camera.quaternion.clone(),toQuat:t,startedAt:this.clock(),durationMs:s,onDone:i}}}const hM=4,eD=350,tD=30,sD=600,nD=400;class iD{element;rig;target;mode;clock;touches=new Map;pinch=null;gestureHeld=!1;lastTap=null;kind="mouse";tapActivatedAt=0;suppressClick=!1;viewDrag=null;grabbing=!1;over=!1;detachers=[];constructor(e,t,s,i,r=Date.now){this.element=e,this.rig=t,this.target=s,this.mode=i,this.clock=r,e.style.touchAction="none",this.listen("click",a=>this.click_handle(a)),this.listen("dblclick",a=>{this.clock()-this.tapActivatedAt<sD||this.target.tap(a,"activate")}),this.listen("pointerdown",a=>this.down_handle(a)),this.listen("pointerup",a=>this.up_handle(a)),this.listen("pointercancel",a=>this.up_handle(a)),this.listen("pointermove",a=>this.move_handle(a)),this.listen("pointerleave",a=>{this.over=!1,this.target.leave(a)}),this.listen("wheel",a=>{a.preventDefault(),this.rig.dolly(a.deltaY,this.mode.untethered())},{passive:!1}),this.listen("contextmenu",a=>a.preventDefault())}pointerOver(){return this.over}pressKind(){return this.kind}fingersDown(){return this.touches.size}detach(){for(const e of this.detachers.splice(0))e()}listen(e,t,s){this.element.addEventListener(e,t,s),this.detachers.push(()=>this.element.removeEventListener(e,t,s))}click_handle(e){if(this.suppressClick){this.suppressClick=!1;return}if(this.kind==="touch"){const t=this.clock(),s=this.lastTap;if(s!==null&&t-s.at<=eD&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=tD){this.lastTap=null,this.tapActivatedAt=t,this.target.tap(e,"activate");return}this.lastTap={at:t,x:e.clientX,y:e.clientY}}this.target.tap(e,"select")}down_handle(e){if(this.kind=e.pointerType,e.pointerType==="touch"){if(e.isPrimary&&(this.touches.clear(),this.pinch=null,this.gestureHeld=!1),this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.touches.size===2){this.gesture_begin();return}if(this.touches.size>2||this.gestureHeld)return;this.press(e),this.hover(e);return}this.press(e)}up_handle(e){if(e.pointerType==="touch"&&(this.touches.delete(e.pointerId),this.touches.size<2&&(this.pinch=null),this.touches.size===0&&this.gestureHeld)){this.gestureHeld=!1,this.suppressClick=!0,setTimeout(()=>{this.suppressClick=!1},nD),this.release(),this.target.gesture_end?.();return}this.release()}move_handle(e){if(e.pointerType==="touch"&&this.touches.has(e.pointerId)){if(this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.pinch!==null){this.gesture_move();return}if(this.gestureHeld)return}this.grabbing?this.target.grab_move(e):this.viewDrag!==null?this.view_move(e):this.hover(e)}hover(e){this.over=!0,this.target.hover(e)}press(e){if(!(this.rig.holding_get()||this.rig.flying())){this.rig.spin_pause(),this.target.grab_begin(e)?this.grabbing=!0:this.viewDrag={lastX:e.clientX,lastY:e.clientY,startX:e.clientX,startY:e.clientY,pan:e.shiftKey||e.button===2||e.button===1,moved:!1};try{this.element.setPointerCapture(e.pointerId)}catch{}this.target.tip_hide()}}release(){this.viewDrag!==null&&(this.viewDrag.moved&&(this.suppressClick=!0),this.viewDrag=null,this.rig.spin_pause()),this.grabbing&&(this.grabbing=!1,this.rig.spin_pause(),this.target.grab_end()&&(this.suppressClick=!0))}view_move(e){const t=this.viewDrag;if(t===null)return;this.rig.spin_pause();const s=e.clientX-t.lastX,i=e.clientY-t.lastY;t.lastX=e.clientX,t.lastY=e.clientY,!t.moved&&Math.abs(e.clientX-t.startX)+Math.abs(e.clientY-t.startY)>hM&&(t.moved=!0,this.rig.touch_note()),t.moved&&(t.pan||this.mode.flat()?this.rig.pan(s,i):this.rig.orbit(s,i))}fingers_read(){const[e,t]=[...this.touches.values()];return e===void 0||t===void 0?null:{spread:Math.hypot(e.x-t.x,e.y-t.y),midX:(e.x+t.x)/2,midY:(e.y+t.y)/2}}gesture_begin(){this.release(),this.gestureHeld=!0,this.pinch=this.fingers_read(),this.rig.spin_pause(),this.target.tip_hide()}gesture_move(){const e=this.fingers_read();e===null||this.pinch===null||(e.spread>0&&this.pinch.spread>0&&this.rig.dolly(Math.log(this.pinch.spread/e.spread)/.001,this.mode.untethered()),(this.mode.flat()||!this.mode.untethered())&&this.rig.pan(e.midX-this.pinch.midX,e.midY-this.pinch.midY),this.pinch=e)}}const rD=14,aD=4;class oD{camera;world;element;sources;starGlow;raycaster=new xO;constructor(e,t,s,i,r){this.camera=e,this.world=t,this.element=s,this.sources=i,this.starGlow=r}ray_aim(e){const t=this.element.getBoundingClientRect(),s=new Je((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1);return this.world.updateMatrixWorld(!0),this.raycaster.setFromCamera(s,this.camera),this.raycaster}mesh_under(e){const t=this.ray_aim(e).intersectObjects([...this.sources.meshes()]).filter(r=>r.object.userData.dim!==!0),i=(t.find(r=>r.object.userData.halo!==!0)??t[0])?.object;return i instanceof Ms?i:null}meshNode_under(e){const t=this.mesh_under(e)?.userData.nodeId;return typeof t=="string"?t:null}node_under(e,t){const s=this.meshNode_under(e);if(s!==null)return s;const i=this.sources.census();return i!==null?i.pick(this.ray_aim(e)):this.star_under(e,t)}star_under(e,t){const s=this.sources.stars(),i=this.sources.nebulae(),r=this.element.getBoundingClientRect(),a=e.clientX-r.left,o=e.clientY-r.top;this.world.updateMatrixWorld(!0),this.camera.updateMatrixWorld();const l=r.height/(2*Math.tan(this.camera.fov*Math.PI/360)),c=new wt().multiplyMatrices(this.camera.matrixWorldInverse,this.world.matrixWorld),u=new wt().multiplyMatrices(this.camera.projectionMatrix,c).elements,h=c.elements,p=m=>{const z=-(h[2]*m.x+h[6]*m.y+h[10]*m.z+h[14]);if(z<=0)return null;const w=u[3]*m.x+u[7]*m.y+u[11]*m.z+u[15],_=(u[0]*m.x+u[4]*m.y+u[8]*m.z+u[12])/w,v=(u[1]*m.x+u[5]*m.y+u[9]*m.z+u[13])/w;return{x:(_+1)/2*r.width,y:(1-v)/2*r.height,depth:z}},f=t?rD:aD;let b=null,g=1/0;for(const m of s){if(m.dim)continue;const z=p(m.position);if(z===null)continue;const w=Math.max(f,this.starGlow*m.radius*l/z.depth),_=Math.hypot(z.x-a,z.y-o);if(_>w)continue;const v=_/w;v<g&&(g=v,b=m.id)}if(b!==null)return b;for(const m of i){const z=p(m.position);if(z!==null&&Math.hypot(z.x-a,z.y-o)<=m.radius*l/z.depth)return m.id}return null}}const lD=3e4,cD=900;class dD{clock;order;first;last;shown=0;moment;speed=1;running=!1;lastWall;flashes=new Map;constructor(e,t=Date.now){this.clock=t,this.order=[...e].map(([s,i])=>({id:s,at:i})).sort((s,i)=>s.at-i.at||(s.id<i.id?-1:1)),this.first=this.order[0]?.at??0,this.last=this.order[this.order.length-1]?.at??0,this.moment=this.first,this.lastWall=t()}span(){return[this.first,this.last]}ids(){return this.order.map(e=>e.id)}playing(){return this.running}at(){return this.moment}play(e=this.speed){this.speed=Math.max(.05,e),this.moment>=this.last&&this.shown>=this.order.length&&this.seek(this.first),this.running=!0,this.lastWall=this.clock()}pause(){this.running=!1}seek(e){this.moment=Math.max(this.first,Math.min(this.last,e));const t=[],s=[];for(;this.shown<this.order.length&&this.order[this.shown].at<=this.moment;)t.push(this.order[this.shown].id),this.shown+=1;for(;this.shown>0&&this.order[this.shown-1].at>this.moment;){this.shown-=1;const i=this.order[this.shown].id;s.push(i),this.flashes.delete(i)}return{at:this.moment,arrived:t,departed:s,done:this.moment>=this.last}}step(){const e=this.clock(),t=e-this.lastWall;if(this.lastWall=e,!this.running)return{at:this.moment,arrived:[],departed:[],done:this.moment>=this.last};const s=(this.last-this.first)/lD*this.speed,i=this.seek(s>0?this.moment+t*s:this.last);for(const r of i.arrived)this.flashes.set(r,e);return i.done&&(this.running=!1),i}flashing(){const e=this.clock(),t=new Map;for(const[s,i]of this.flashes){const r=(e-i)/cD;r>=1?(this.flashes.delete(s),t.set(s,0)):t.set(s,1-r)}return t}}const uD=90*400,hD=12;function fM(n){const e={id:n.id,parents:[...n.parentIds,...n.joinParentIds]};return n.metric!==void 0&&(e.metric=n.metric),e}function fD(n){const e=dg(n.map(t=>{const s={id:t.id,parentIds:t.parentIds};return t.metric!==void 0&&(s.metric=t.metric),s}));return n.map((t,s)=>{const i=e[s];return{node:t,position:new W(...i?.position??[0,0,0]),radius:i?.radius??Dt}})}function pM(n){return ig(n.map(fM))}function mM(n,e=3,t=new Map,s=ni,i=new Set){const r=new Map([...t].map(([o,l])=>[o,[l.x,l.y,l.z]])),a=rg(n.map(fM),e,r,s,i);return{total:a.total,moving:a.moving,step:a.step,place:()=>a.place().map((o,l)=>({node:n[l],position:new W(...o.position),radius:o.radius}))}}function pD(n,e=3,t=new Map,s=ni,i=new Set){const r=mM(n,e,t,s,i);return r.step(r.total),r.place()}function mD(n,e,t){const s=new Map(n.map(o=>[o.node.id,o])),i=new Map;for(const o of n)for(const l of o.node.parentIds)i.set(l,[...i.get(l)??[],o]);const r=o=>{const l=i.get(o)??[];if(l.length===0)return null;const c=new W;for(const d of l)c.add(d.position);return c.divideScalar(l.length)},a=[];for(const{node:o,position:l,radius:c}of n){if(o.caption!==void 0){const d=o.ghost===!0?r(o.id):null,u=d!==null?0:o.halo===!0?yc(o.count??1):c;t.labels.caption_add(o.id,o.caption,d??l,u,e.done,o.dim===!0,o.count??1)}if(!(o.ghost===!0&&o.halo!==!0)){if(t.starring&&o.solid!==!0){if(o.halo===!0){t.stars.nebula_add(o.id,l,yc(o.count??1),e.edge,o.dim===!0);continue}a.push({id:o.id,position:l.clone(),radius:c,color:Pr(o.look.paint,e).clone(),dim:o.dim===!0,ember:o.look.ember,...o.ring===!0?{ring:!0}:{}});continue}if(o.halo===!0){t.spheres.halo_add(o.id,l,yc(o.count??1),e.edge,o.dim===!0);continue}t.spheres.sphere_add(o.id,l,c,{color:Pr(o.look.paint,e),dim:o.dim===!0,selected:o.id===t.selected,flat:t.flat})}}return{starred:a,byId:s}}function gD(n,e,t,s){const i=[],r=[],a=c=>!s.starring||c.node.solid===!0,o=[],l=(c,d,u,h,p,f)=>{const b=h?.35:1,g=i.length/6;i.push(c.x,c.y,c.z,d.x,d.y,d.z),o.push(f,p.id),r.push(u.r*b,u.g*b,u.b*b,u.r*b,u.g*b,u.b*b);const m=h||s.handoffKey===void 0?null:s.handoffKey(p);m!==null&&s.handoff.thread_note(m,g)};for(const c of n){const{node:d,position:u}=c;if(d.ghost!==!0){for(const h of d.parentIds){const p=e.get(h);if(!p||p.node.ghost===!0)continue;const f=d.dim===!0||p.node.dim===!0;a(c)&&a(p)?!s.starring&&f&&s.spheres.edge_add(h,d.id,p.position,u,t.edge,!1,f):l(p.position,u,t.edge,f,d,h)}for(const h of d.joinParentIds){const p=e.get(h);if(!p)continue;if(d.joinFaint===!0){l(p.position,u,t.join,!0,d,h);continue}const f=d.dim===!0||p.node.dim===!0;a(c)&&a(p)?!s.starring&&f&&s.spheres.edge_add(h,d.id,p.position,u,t.join,!0,f):l(p.position,u,t.join,f,d,h)}}}s.stars.threads_draw(i,r,o)}function MD(n,e,t,s,i){const r=n.filter(_=>e.has(_.id)),a=new Map;if(r.length===0)return a;const o=new W;for(const _ of r)o.add(e.get(_.id));o.divideScalar(r.length);const l=t.clone().normalize(),c=new W().crossVectors(s,l);c.lengthSq()<1e-9&&c.set(1,0,0).cross(l),c.normalize();const d=new W().crossVectors(l,c).normalize(),u=new Map;for(const _ of r){const v=e.get(_.id).clone().sub(o);u.set(_.id,new W(v.dot(c),v.dot(d),0))}const h=new Set(r.map(_=>_.id)),p=r.map(_=>({..._,parentIds:_.parentIds.filter(v=>h.has(v)),joinParentIds:_.joinParentIds.filter(v=>h.has(v))})),f=pD(p,2,u,{...i,gravity:!1}),b=new W;for(const _ of f)b.add(_.position);b.divideScalar(f.length);const g=_=>Math.sqrt(_.reduce((v,O)=>v+O*O,0)/Math.max(1,_.length)),m=g(r.map(_=>e.get(_.id).distanceTo(o))),z=g(f.map(_=>Math.hypot(_.position.x-b.x,_.position.y-b.y))),w=z>1e-9&&m>1e-9?m/z:1;for(const _ of f){const v=(_.position.x-b.x)*w,O=(_.position.y-b.y)*w;a.set(_.node.id,o.clone().addScaledVector(c,v).addScaledVector(d,O))}return a}class bD{restore=null;active(){return this.restore!==null}clear(){this.restore=null}set(e,t,s,i,r){if(e===null||e.length===0){if(this.restore===null)return!1;for(const[u,h]of this.restore)s.set(u,h);return this.restore=null,!0}if(this.restore!==null)return!1;const a=new Set(e),o=i.world.quaternion.clone().invert(),l=i.camera.position.clone().sub(i.focus).normalize().applyQuaternion(o),c=new W(0,1,0).applyQuaternion(i.camera.quaternion).applyQuaternion(o),d=MD(t.filter(u=>a.has(u.id)),s,l,c,r);if(d.size===0)return!1;this.restore=new Map([...d.keys()].map(u=>[u,s.get(u).clone()]));for(const[u,h]of d)s.set(u,h);return!0}}class _D{ports;constructor(e){this.ports=e}ids(){return[...this.ports.meshes().keys(),...this.ports.stars.ids()]}world_of(e){const t=this.ports.meshes().get(e);if(t!==void 0){const i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),{position:t.getWorldPosition(new W),radius:i.boundingSphere?.radius??Dt}}const s=this.ports.stars.entry(e);return s!==void 0?{position:this.ports.group.localToWorld(s.position.clone()),radius:s.radius}:null}diveTarget_of(e){const t=this.ports.meshes().get(e),s=t===void 0?this.ports.census.ids().indexOf(e):-1;return t===void 0&&s<0?null:(this.ports.group.updateMatrixWorld(!0),t!==void 0?t.getWorldPosition(new W):this.ports.group.localToWorld((this.ports.census.positions()[s]??new W).clone()))}reaches_of(e){const t=new Set(e),s=[];this.ports.group.updateMatrixWorld(!0);for(const i of this.ids()){if(t.size>0&&!t.has(i))continue;const r=this.world_of(i);r!==null&&s.push(r)}return s}}function zD(n,e){return n.map(t=>{const s=t.node;return{id:s.id,position:t.position,radius:t.radius,count:Math.max(1,s.count??1),color:Pr(s.look.paint,e),dim:s.dim===!0,ember:s.look.ember,state:s.look.state,parents:s.parentIds,ghost:s.ghost===!0}})}function wD(n,e){return{position:n.position,radius:n.radius,color:Pr(n.node.look.paint,e)}}function yD(n){return{position:n.position,radius:n.radius,parents:n.node.parentIds,joins:n.node.joinFaint===!0?[]:n.node.joinParentIds,state:n.node.look.state}}function vD(n,e){return e.updateMatrixWorld(!0),n.updateMatrixWorld(),new wt().multiplyMatrices(n.matrixWorldInverse,e.matrixWorld)}function OD(n,e){return n/(2*Math.tan(e*Math.PI/360))}const Oc=.5;class xD{ports;busy=!1;constructor(e){this.ports=e}moving(){return this.busy}frame(e,t,s,i,r){this.busy=!0,this.ports.flyToFit(e,t,()=>{this.busy=!1,s()},i,r)}relight(e,t,s,i,r){this.busy=!0,this.ports.graph_set(e,{wave:!1,fit:!1,frozen:e.nodes.map(a=>a.id)}),r?.(),this.ports.flyToFit(t,s,()=>{this.busy=!1,i()})}unfold(e,t){this.busy=!0;const s=this.ports.positions_get(),i=SD(s,e.from),r=this.ports.random??(()=>Math.random()-.5);for(const l of e.unfolding)s[l]=[i[0]+r()*Oc,i[1]+r()*Oc,i[2]+r()*Oc];this.ports.positions_seed(s);const a=new Set(e.unfolding),o=e.graph.nodes.filter(l=>!a.has(l.id)).map(l=>l.id);this.ports.graph_set(e.graph,{wave:!1,fit:!1,frozen:o,...e.physics!==void 0?{physics:e.physics}:{}}),e.drawn?.(),this.ports.flyToFit(e.frame,e.durationMs,()=>{this.busy=!1,t()},e.bulk,e.margin)}descent(e,t,s,i){this.busy=!0;const r=()=>{t().then(a=>{if(this.ports.alive()){if(a===null){this.busy=!1,i();return}this.unfold(a,s)}})};"toward"in e?this.ports.flyToward(e.toward,e.distance,e.durationMs,r):this.ports.flyToFit(e.fit,e.durationMs,r)}}function SD(n,e){for(const t of e){const s=[0,0,0];let i=0;for(const r of t){const a=n[r];a!==void 0&&(s[0]+=a[0],s[1]+=a[1],s[2]+=a[2],i+=1)}if(i>0)return[s[0]/i,s[1]/i,s[2]/i]}return[0,0,0]}const ED=1e3;class AD{workerOf;generation;worker=null;disposed=!1;constructor(e,t){this.workerOf=e,this.generation=t}dispose(){this.disposed=!0,this.worker?.terminate(),this.worker=null}run(e){const t=pM(e.nodes),s=new Map([...e.seeds].map(([d,u])=>[d,[u.x,u.y,u.z]])),i=Uw(e.nodes,e.keyOf,s,e.frozen),r=ED,a=i.length;e.progress(0,r,a);const o=d=>{e.placed(e.nodes.map(u=>{const h=d[u.id]??[0,0,0];return{node:u,position:new W(h[0],h[1],h[2]),radius:t.get(u.id)??Dt}})),e.progress(r,r,a)},l=d=>e.progress(Math.min(r-1,Math.floor(d*r)),r,a);if(this.worker===null){if(this.workerOf===void 0){const d=py(e.arrangement);if(d===void 0){console.error(`layout: no engine named ${e.arrangement}`),e.progress(r,r,a);return}o(d.run({nodes:i,physics:e.physics},l).positions);return}this.worker=this.workerOf()}const c=this.worker;c.onmessage=d=>{const u=d.data;if(!(u.generation!==this.generation()||this.disposed)){if(u.type==="progress"){l(u.fraction??0);return}if(u.type==="failed"){console.error(`layout: ${u.reason??"the engine failed"}`),e.progress(r,r,a);return}o(u.positions??{})}},c.postMessage({generation:e.generation,nodes:i,physics:e.physics,arrangement:e.arrangement})}}const oa=700,DD=2500;function TD(n){const e=new Map,t=new Set(n.map(r=>r.id)),s=r=>r.look.waved;let i=!1;for(;!i;){i=!0;for(const r of n){if(e.has(r.id)||!s(r))continue;const a=[...r.parentIds,...r.joinParentIds].filter(l=>t.has(l));if(!a.every(l=>e.has(l)))continue;const o=a.reduce((l,c)=>Math.max(l,e.get(c)??0),-vr);e.set(r.id,o+vr),i=!1}}return e}class ID{ports;color=new ke("#48d8f0");times=new Map;startAt=null;looping=!1;constructor(e){this.ports=e}start(){this.times=TD(this.ports.nodes()),this.startAt=this.times.size>0?this.now():null}loop_set(e){this.looping=e,e&&this.start()}loop_get(){return this.looping}animate(){if(this.startAt===null)return;const e=this.now()-this.startAt;let t=0;const s=this.ports.census();if(s!==null){t=s.flare(r=>this.times.get(r),e,this.color,oa),e>t+oa&&(this.startAt=this.renewal());return}const i=this.ports.selected();for(const[r,a]of this.times){t=Math.max(t,a);const o=this.ports.mesh(r);if(o===void 0||!(o.material instanceof Ei))continue;const l=e-a,c=l>=0&&l<=oa?Math.sin(l/oa*Math.PI):0;o.scale.setScalar(1+c*.45),c>0?(o.material.emissive.copy(this.color),o.material.emissiveIntensity=c*1.2):(o.material.emissive.setScalar(r===i?1:0),o.material.emissiveIntensity=r===i?.35:0)}e>t+oa&&(this.startAt=this.renewal())}now(){return(this.ports.now??Date.now)()}renewal(){return this.ports.ambient||this.looping?this.now()+DD:null}}class GD{ports;running=null;constructor(e){this.ports=e}active(){return this.running!==null}begin(e,t=1){const s=new dD(e,this.ports.now??Date.now);this.running={clock:s,arrivals:e,shown:new Set},this.ports.redraw(),this.paintAll(),s.play(t)}play(e){this.running?.clock.play(e)}pause(){this.running?.clock.pause()}seek(e){this.running!==null&&this.apply(this.running.clock.seek(e))}stop(){this.running!==null&&(this.running=null,this.ports.redraw())}state(){return this.running===null?null:{playing:this.running.clock.playing(),at:this.running.clock.at(),span:this.running.clock.span()}}step(){const e=this.running;if(e===null)return;const t=e.clock.playing(),s=e.clock.step();this.apply(s);for(const[i,r]of e.clock.flashing())this.ports.stars.flash_set(i,r);this.ports.stars.flush(),(t||s.arrived.length>0)&&this.ports.moved?.(s.at,e.clock.playing())}paintAll(){const e=this.running;if(e===null)return;const t=[...e.arrivals.keys()].filter(s=>!e.shown.has(s));this.ports.stars.presence_set(t,0),this.ports.stars.presence_set(e.shown,1),this.ports.stars.threads_present(s=>e.shown.has(s)||!e.arrivals.has(s)),this.ports.stars.flush()}apply(e){const t=this.running;if(!(t===null||e.arrived.length===0&&e.departed.length===0)){for(const s of e.arrived)t.shown.add(s);for(const s of e.departed)t.shown.delete(s),this.ports.stars.flash_set(s,0);this.ports.stars.presence_set(e.arrived,1),this.ports.stars.presence_set(e.departed,0),this.ports.stars.threads_present(s=>t.shown.has(s)||!t.arrivals.has(s)),this.ports.stars.flush()}}}class RD{ports;drag=null;pull=null;returns=[];constructor(e){this.ports=e}dragging(){return this.drag!==null}clear(){this.drag=null,this.pull=null}positions(){return this.pull?.positions()??[]}begin(e){const t=this.ports.picker.mesh_under(e),s=t?.userData.nodeId;if(t===null||typeof s!="string")return!1;const i=this.ports.camera.getWorldDirection(new W).negate();this.ports.group.updateMatrixWorld(!0);const r=new $n().setFromNormalAndCoplanarPoint(i,t.getWorldPosition(new W));return this.drag={nodeId:s,plane:r,startX:e.clientX,startY:e.clientY,moved:!1,solo:this.ports.solo(),home:t.position.clone()},!0}move(e){if(this.drag===null||(this.ports.spin_pause(),!this.drag.moved&&Math.abs(e.clientX-this.drag.startX)+Math.abs(e.clientY-this.drag.startY)>hM&&(this.drag.moved=!0,this.drag.solo||this.simulation_begin(this.drag.nodeId)),!this.drag.moved))return!1;const t=new W;if(this.ports.picker.ray_aim(e).ray.intersectPlane(this.drag.plane,t)===null)return!1;if(this.ports.group.worldToLocal(t),this.drag.solo){const s=this.ports.meshes().get(this.drag.nodeId);return s===void 0?!1:(s.position.copy(t),!0)}return this.pull?.pin([t.x,t.y,t.z]),!1}end(){if(this.drag===null)return!1;const e=this.drag.moved;if(this.drag.solo&&this.drag.moved){const t=this.ports.meshes().get(this.drag.nodeId);t!==void 0&&this.returns.push({mesh:t,from:t.position.clone(),to:this.drag.home.clone(),startedAt:this.now()})}return this.pull?.release(),this.drag=null,e}step(){const e=this.now();let t=!1;return this.pull!==null&&(this.pull.step(this.drag!==null)?t=!0:this.pull=null),this.returns.length>0&&(this.returns=this.returns.filter(s=>{const i=Math.min(1,(e-s.startedAt)/300),r=i*i*(3-2*i);return s.mesh.position.lerpVectors(s.from,s.to,r),i<1}),t=!0),t}now(){return(this.ports.now??Date.now)()}simulation_begin(e){const t=this.ports.nodes(),s=pM(t),i=[...this.ports.meshes()].map(([a,o])=>({id:a,position:[o.position.x,o.position.y,o.position.z],radius:s.get(a)??Dt,dim:o.userData.dim===!0,halo:o.userData.halo===!0})),r=[];for(const a of t)for(const o of[...a.parentIds,...a.joinParentIds])r.push({from:o,to:a.id});this.pull=new iy({grabbed:e,nodes:i,edges:r,dimensions:this.ports.dimensions(),baseRadius:Dt})}}const ND=1500;class BD{ports;tip;hovered=null;tapTimer=null;constructor(e,t){this.ports=t,this.tip=document.createElement("div"),this.tip.className="dag-node-tip",this.tip.hidden=!0,e.appendChild(this.tip)}hide(){this.tip.hidden=!0}leave(e){if(this.hovered=null,e.pointerType==="touch"&&!this.tip.hidden){this.tapTimer!==null&&window.clearTimeout(this.tapTimer),this.tapTimer=window.setTimeout(()=>{this.tapTimer=null,this.ports.fingersDown()===0&&(this.tip.hidden=!0)},ND);return}this.tip.hidden=!0}hover(e){const t=this.ports.picker.node_under(e,this.ports.pressKind()==="touch"),s=t===null?void 0:this.ports.nodes().find(r=>r.id===t);if(s===void 0){this.tip.hidden=!0,this.ports.canvas.style.cursor="",this.hovered=null;return}this.hovered={id:s.id,x:e.clientX,y:e.clientY};const i=this.ports.canvas.getBoundingClientRect();this.tip.textContent=this.ports.words(s)??s.label,this.tip.style.left=`${e.clientX-i.left+14}px`,this.tip.style.top=`${e.clientY-i.top+10}px`,this.tip.hidden=!1,this.ports.canvas.style.cursor="pointer"}pick(e,t){const s=this.hovered,i=s!==null&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=6?s.id:this.ports.picker.node_under(e,this.ports.pressKind()==="touch");if(i===null){t==="select"&&this.ports.selected_get()!==null&&(this.ports.selected_set(null),this.ports.selection_paint(),this.ports.deselect?.());return}const r=this.ports.nodes().find(a=>a.id===i);r&&(t==="select"?(this.ports.selected_set(i),this.ports.census()||this.ports.selection_paint(),this.ports.select?.(r)):this.ports.activate?.(r))}}function CD(){return{running:new ke("#ff7700"),done:new ke("#ffeecc"),error:new ke("#ff2222"),template:new ke("#ffaa44"),unknown:new ke("#555555"),edge:new ke("#cc5500"),join:new ke("#ffcc99"),root:new ke("#6fbfae"),pulse:new ke("#48d8f0")}}class PD{container;handlers;paletteOf;ambient;renderer;scene;camera;group=new pa;picker;spheres=new LA(this.group);get meshes(){return this.spheres.map}starField=new PA(this.group);labels=new HA(this.group);tubes=new UA({parent:this.group,node:e=>this.tubeNode_of(e),sphere:e=>this.meshes.get(e),palette:()=>this.palette_read()});handoffField=new FA({spheres:this.spheres,stars:this.starField,tubes:this.tubes,look:e=>this.handoffLook_of(e)});censusField=new jA({parent:this.group,stars:this.starField,tubes:this.tubes,starsView:()=>({pixelRatio:window.devicePixelRatio,heightPx:this.renderer.domElement.height,fovDeg:this.camera.fov})});drawn=new _D({meshes:()=>this.meshes,stars:this.starField,census:this.censusField,group:this.group});flights=new xD({positions_get:()=>this.positions_get(),positions_seed:e=>this.positions_seed(e),graph_set:(e,t)=>this.graph_set(e,t),flyToFit:(e,t,s,i,r)=>this.camera_flyToFit(e,t,s,i,r),flyToward:(e,t,s,i)=>this.camera_flyToward(e,t,s,i),alive:()=>!this.disposed});hierarchy;wave;replay;grab;hover=null;rig;gestures=null;lastPositions=new Map;frozen=new Set;physicsOnce=void 0;census=!1;physics={...ni};graph={nodes:[]};drawMode="spheres";placedById=new Map;fits=0;strategy="ranked";selectedId=null;frameHandle=null;disposed=!1;projection="3d";flat=new bD;rebuildGen=0;slicing=!1;arrangement="galaxy";arrangementMemory=new Map;constructor(e,t={},s={}){this.container=e,this.handlers=t,this.paletteOf=s.palette??CD,this.hierarchy=new AD(s.layoutWorker,()=>this.rebuildGen),this.ambient=s.ambient===!0,this.renderer=new wA({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.domElement.classList.add("dag-scene-canvas"),this.scene=new Zv,this.camera=new Rs(50,1,.1,200),this.camera.position.set(0,0,14),this.rig=new JA(this.camera,this.group),this.picker=new oD(this.camera,this.group,this.renderer.domElement,{meshes:()=>this.meshes.values(),stars:()=>this.starField.list(),nebulae:()=>this.starField.nebulae(),census:()=>this.census&&this.censusField.drawn()?this.censusField:null},oM),this.wave=new ID({nodes:()=>this.graph.nodes,mesh:r=>this.meshes.get(r),census:()=>this.census&&this.censusField.drawn()?this.censusField:null,selected:()=>this.selectedId,ambient:this.ambient}),this.replay=new GD({stars:this.starField,redraw:()=>this.rebuild(!1,"hold"),...t.replay!==void 0?{moved:t.replay}:{}}),this.grab=new RD({picker:this.picker,camera:this.camera,group:this.group,meshes:()=>this.meshes,nodes:()=>this.graph.nodes,solo:()=>this.strategy==="ranked",dimensions:()=>this.projection==="2d"?2:3,spin_pause:()=>this.rig.spin_pause()}),this.scene.add(new yO(16777215,.9));const i=new wO(16777215,1.2);i.position.set(4,6,8),this.scene.add(i),this.scene.add(this.group),e.appendChild(this.renderer.domElement),this.size_fit(),this.ambient||(this.hover=this.pointer_wire(e)),new ResizeObserver(()=>this.size_fit()).observe(e),this.tick()}pointer_wire(e){const t=new BD(e,{picker:this.picker,canvas:this.renderer.domElement,nodes:()=>this.graph.nodes,pressKind:()=>this.gestures?.pressKind(),fingersDown:()=>this.gestures?.fingersDown()??0,words:s=>this.handlers.tip?.(s)??null,census:()=>this.census,selected_get:()=>this.selectedId,selected_set:s=>{this.selectedId=s},selection_paint:()=>this.selection_paint(),...this.handlers.select!==void 0?{select:this.handlers.select}:{},...this.handlers.activate!==void 0?{activate:this.handlers.activate}:{},...this.handlers.deselect!==void 0?{deselect:this.handlers.deselect}:{}});return this.gestures=new iD(this.renderer.domElement,this.rig,{grab_begin:s=>this.grab.begin(s),grab_move:s=>{this.grab.move(s)&&this.positions_sync()},grab_end:()=>this.grab.end(),hover:s=>t.hover(s),leave:s=>t.leave(s),tap:(s,i)=>t.pick(s,i),tip_hide:()=>t.hide(),gesture_end:()=>this.handlers.gesture_end?.()},{flat:()=>this.projection==="2d",untethered:()=>this.census}),t}tick(){this.disposed||(this.ambient?(this.rig.tumble_step(),this.wave.animate()):(this.rig.spin_step(!(this.gestures?.pointerOver()??!1)&&this.projection==="3d"&&!this.flat.active()),this.grab.step()&&this.positions_sync(),this.wave.animate(),this.rig.flight_step()),this.starField.scale_update(this.renderer.domElement.height,this.camera.fov),this.handoff_step(),this.replay.step(),this.tubes.frame(performance.now()),this.labels.declutter(this.camera),this.renderer.render(this.scene,this.camera),this.frameHandle=window.requestAnimationFrame(()=>this.tick()))}physics_set(e,t=!0){this.physics={...this.physics,...e},t&&this.rebuild()}physics_get(){return{...this.physics}}census_set(e){this.census!==e&&(this.census=e,this.rebuild(!0,"hold"))}census_get(){return this.census}graph_set(e,t={}){this.graph=e,this.flat.clear(),this.frozen=new Set(t.frozen??[]),this.physicsOnce=t.physics,this.rebuild(t.fit!==!1,t.settle??"full"),t.wave!==!1&&this.wave.start()}waveLoop_set(e){this.wave.loop_set(e)}waveLoop_get(){return this.wave.loop_get()}wave_start(){this.wave.start()}positions_get(){const e={};for(const[t,s]of this.lastPositions)e[t]=[Math.round(s.x*100)/100,Math.round(s.y*100)/100,Math.round(s.z*100)/100];return e}positions_seed(e){this.lastPositions=new Map(Object.entries(e).map(([t,[s,i,r]])=>[t,new W(s,i,r)]))}flight_into(e,t){if(this.rig.flying()||this.rig.holding_get())return;const s=this.drawn.diveTarget_of(e);s!==null&&this.rig.flyInto(s,t)}camera_flyToFit(e,t,s,i=1,r=1.15){this.rig.flyToFit(this.drawn.reaches_of(e),t,s,i,r)}camera_distance(){return this.rig.eyeDistance()}camera_touched(){return this.rig.touched_get()}moving(){return this.flights.moving()}frame(e,t,s=()=>{},i,r){this.flights.frame(e,t,s,i,r)}relight(e,t,s,i=()=>{},r){this.flights.relight(e,t,s,i,r)}unfold(e,t=()=>{}){this.flights.unfold(e,t)}descent(e,t,s=()=>{},i=()=>{}){this.flights.descent(e,t,s,i)}draw_set(e){e!==this.drawMode&&(this.drawMode=e,this.rebuild(!1,"hold"))}captions_set(e){this.labels.shown_set(e)}draw_get(){return this.drawMode}state_get(){const e=this.graph.nodes.filter(s=>s.solid===!0).map(s=>s.id),t=e.filter(s=>this.meshes.has(s)).length;return{draw:this.drawMode,arrangement:this.arrangement,captions:this.labels.shown_get()?this.labels.count():"off",known:this.lastPositions.size,census:this.census,nodes:this.graph.nodes.length,meshes:this.meshes.size,stars:this.starField.count(),solidMarked:e.length,solidDrawn:t,tubes:this.tubes.materialCount(),censusTubes:this.tubes.censusCount(),handoffGroups:this.handoffField.size(),handoffSolid:this.handoffField.solidCount(),camera:this.rig.eyeDistance().toFixed(1),settling:this.slicing}}camera_flyToward(e,t,s,i){const r=this.drawn.world_of(e);if(r===null){i();return}this.rig.flyToward(r,t,s,i)}holding_get(){return this.rig.holding_get()}flight_back(e){this.rig.flyBack(e)}strategy_set(e){this.strategy=e,this.rebuild()}selection_clear(){this.selectedId=null,this.selection_paint()}selection_paint(){this.spheres.select(this.selectedId)}strategy_get(){return this.strategy}projection_set(e){this.projection=e,e==="2d"&&this.group.quaternion.identity(),this.rebuild()}projection_get(){return this.projection}flat_set(e){this.flat.set(e,this.graph.nodes,this.lastPositions,{camera:this.camera,focus:this.rig.focus,world:this.group},this.physics)&&this.rebuild(!1,"hold")}flat_get(){return this.flat.active()}look_update(e,t){const s=this.graph.nodes.find(i=>i.id===e);s&&(s.look=t,this.spheres.recolor(e,Pr(t.paint,this.palette_read())),this.tubes.holds(e)&&this.tubes.stale_mark())}palette_read(){return this.paletteOf()}palette_refresh(){this.rebuild(!0,"hold")}size_fit(){const e=Math.max(1,this.container.clientWidth),t=Math.max(1,this.container.clientHeight);this.renderer.setSize(e,t,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}dispose(){this.disposed=!0,this.hierarchy.dispose(),this.frameHandle!==null&&window.cancelAnimationFrame(this.frameHandle),this.gestures?.detach(),this.renderer.dispose(),this.renderer.domElement.remove(),this.spheres.dispose()}arrangement_set(e,t,s=!0){if(e===this.arrangement)return;this.arrangementMemory.set(this.arrangement,new Map(this.lastPositions)),this.arrangement=e;let i=this.arrangementMemory.get(e);i===void 0&&t!==void 0&&Object.keys(t).length>0&&(i=new Map(Object.entries(t).map(([r,[a,o,l]])=>[r,new W(a,o,l)]))),this.lastPositions=i??new Map,s&&this.rebuild(!0,i===void 0?"full":"hold")}arrangement_get(){return this.arrangement}replay_begin(e,t=1){this.replay.begin(e,t)}replay_play(e){this.replay.play(e)}replay_pause(){this.replay.pause()}replay_seek(e){this.replay.seek(e)}replay_stop(){this.replay.stop()}replay_state(){return this.replay.state()}censusBuild(e,t,s=!0){const i=zD(e,t),r=this.censusField.build(i,this.drawMode==="stars",t),a=r.center,o=r.radius;!this.ambient&&s&&this.rig.frame(a,o,{stance:"threeQuarter",farScale:2.5})}camera_fit(e){if(e.length===0)return;this.rig.touch_clear(),this.fits+=1,this.renderer.domElement.dataset.fits=String(this.fits);const t=new W;for(const a of e)t.add(a.position);t.divideScalar(e.length);const s=e.map(a=>t.distanceTo(a.position)+a.radius).sort((a,o)=>a-o),i=this.handlers.handoffKey!==void 0?.95:1,r=Math.max(1,s[Math.max(0,Math.ceil(s.length*i)-1)]??1);this.rig.frame(t,r)}rebuild(e=!0,t="full"){const s=++this.rebuildGen;if(this.slicing&&(this.slicing=!1,this.handlers.progress?.(1,1,0)),this.strategy!=="molecule"){this.draw(fD(this.graph.nodes),e);return}let i=this.frozen;if(t!=="full"&&i.size===0){const l=this.graph.nodes.map(c=>c.id).filter(c=>this.lastPositions.has(c));l.length>0&&(i=new Set(l))}const r=mM(this.graph.nodes,this.projection==="2d"?2:3,this.lastPositions,this.physics_current(),i);if(r.moving===0){this.draw(r.place(),e);return}const a=this.handlers.progress,o=r.total*r.moving<uD;if((!o||this.arrangement!=="galaxy")&&a!==void 0&&this.handlers.handoffKey!==void 0&&this.frozen.size===0){this.hierarchy_run(s,e,i,a);return}if(a===void 0||o){r.step(r.total),this.draw(r.place(),e);return}this.settle_slice(r,s,e,a)}physics_current(){return this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics}settle_slice(e,t,s,i){const r=this.graph.nodes.length;let a=0;this.slicing=!0,i(0,e.total,r);const o=()=>{if(t!==this.rebuildGen||this.disposed)return;const l=performance.now();for(;a<e.total&&performance.now()-l<hD;)e.step(1),a+=1;if(a<e.total){i(a,e.total,r),window.requestAnimationFrame(o);return}this.slicing=!1,this.draw(e.place(),s),i(e.total,e.total,r)};window.requestAnimationFrame(o)}hierarchy_run(e,t,s,i){const r=this.handlers.handoffKey;r!==void 0&&(this.slicing=!0,this.hierarchy.run({generation:e,nodes:this.graph.nodes,keyOf:r,seeds:this.lastPositions,frozen:s,physics:this.physics_current(),arrangement:this.arrangement,progress:(a,o,l)=>{a===o&&(this.slicing=!1),i(a,o,l)},placed:a=>{this.slicing=!1,this.draw(a,t)}}))}draw(e,t){const s=this.drawn_clear(e);if(this.census){const c=e.filter(d=>d.node.solid===!0&&d.node.ghost!==!0);this.censusBuild(e.filter(d=>d.node.solid!==!0),s,t),c.length>0&&this.solid_draw(c,s);return}!this.ambient&&t&&this.camera_fit(e);const i=this.drawMode==="stars",r=i&&!this.replay.active()?this.handlers.handoffKey:void 0,a={spheres:this.spheres,labels:this.labels,stars:this.starField,handoff:this.handoffField,selected:this.selectedId,flat:this.projection==="2d",starring:i,handoffKey:r},o=mD(e,s,a);o.starred.length>0&&this.starField.draw(o.starred,window.devicePixelRatio,this.renderer.domElement.height,this.camera.fov);for(const c of e)this.placedById.set(c.node.id,c);if(r!==void 0){const c=new Map(this.graph.nodes.map(d=>[d.id,d]));this.handoffField.gather(o.starred,d=>{const u=c.get(d);return u===void 0?null:r(u)})}gD(e,o.byId,s,a);const l=e.filter(c=>c.node.ghost!==!0&&c.node.halo!==!0&&(i?c.node.solid===!0:c.node.dim!==!0)).map(c=>c.node.id);if(l.length>0){const c={tubes:null,mix:1};this.tubes.build(c,l,new Set(l))}this.replay.active()&&this.replay.paintAll()}drawn_clear(e){this.group.clear(),this.spheres.clear(),this.censusField.clear(),this.grab.clear(),this.starField.clear(),this.labels.clear(),this.handoffField.clear(),this.placedById=new Map,this.tubes.clear();const t=this.palette_read();if(this.wave.color=t.pulse,this.lastPositions=new Map(e.map(s=>[s.node.id,s.position.clone()])),this.projection==="2d")for(const s of e)s.position.z=0;return t}handoff_step(){if(this.handoffField.size()===0)return;const e=this.renderer.domElement.clientHeight||1;this.handoffField.step(vD(this.camera,this.group),OD(e,this.camera.fov),performance.now())}handoffLook_of(e){const t=this.placedById.get(e);return t===void 0?void 0:wD(t,this.palette_read())}tubeNode_of(e){const t=this.placedById.get(e);return t===void 0?void 0:yD(t)}positions_sync(){for(const{id:e,position:t}of this.grab.positions())this.meshes.get(e)?.position.set(...t),this.lastPositions.set(e,new W(...t));this.tubes.follow(),this.spheres.edges_follow()}solid_draw(e,t){for(const r of e)this.placedById.set(r.node.id,r),this.spheres.sphere_add(r.node.id,r.position,r.radius,{color:Pr(r.node.look.paint,t)});const s=e.map(r=>r.node.id),i={tubes:null,mix:1};this.tubes.build(i,s,new Set(s))}}const gM=new Set(["created","waiting","scheduled","started","registeringFiles"]);function LD(n){return n.status!==void 0&&gM.has(n.status)?"live":n.status==="finishedWithError"||n.share!==void 0&&n.share>=1?"failed":n.status==="finishedSuccessfully"||n.share!==void 0&&n.status!==void 0?"done":"rest"}function WD(n){return n.share!==void 0&&n.status!=="cancelled"?n.share>=1?{token:"error"}:{blend:["done","error"],share:Math.sqrt(Math.max(0,n.share))}:n.status==="finishedWithError"||n.status==="cancelled"?{token:"error"}:n.hue!==void 0?{hue:n.hue}:n.parentIds.length===0&&n.joinParentIds.length===0?{token:"root"}:n.status===void 0?{token:"template"}:n.status==="finishedSuccessfully"?{token:"done"}:gM.has(n.status)?{token:"running"}:{token:"unknown"}}function Sp(n){return{state:LD(n),paint:WD(n),ember:n.share!==void 0&&n.share>0||n.status==="finishedWithError",waved:n.status===void 0||n.status==="finishedSuccessfully"||n.status==="finishedWithError"}}function kD(){const n=getComputedStyle(document.documentElement),e=(t,s)=>new ke(n.getPropertyValue(t).trim()||s);return{running:e("--orange","#f70"),done:e("--butter","#fec"),error:new ke("#f22"),template:e("--harvestgold","#fa4"),unknown:new ke("#555"),edge:e("--pumpkin-pie","#c50"),join:e("--honey","#fc9"),root:e("--dag-root","#6fbfae"),pulse:e("--dag-pulse","#48d8f0")}}class xl extends PD{byId=new Map;constructor(e,t={},s={}){const i={palette:kD,layoutWorker:()=>new Worker(new URL(""+new URL("layoutWorker-CfJVM55D.js",import.meta.url).href,import.meta.url),{type:"module"})};s.ambient!==void 0&&(i.ambient=s.ambient),super(e,t,i)}graph_set(e,t={}){const s=e.nodes.map(i=>Object.assign(i,{look:Sp(i)}));this.byId=new Map(s.map(i=>[i.id,i])),super.graph_set({nodes:s},t)}relight(e,t,s,i,r){super.relight(e,t,s,i,r)}unfold(e,t){super.unfold(e,t)}descent(e,t,s,i){super.descent(e,t,s,i)}status_update(e,t){const s=this.byId.get(e);s===void 0||s.status===t||(s.status=t,this.look_update(e,Sp(s)))}}function Ep(n){if(n.jobsTotal===void 0||n.jobsDone===void 0)return null;const e=n.status==="finishedWithError"||n.status==="cancelled",t=n.jobsErrored===void 0?void 0:n.jobsDone-n.jobsErrored;return{done:n.jobsDone,total:n.jobsTotal,...e?{failed:!0}:{},...t!==void 0?{succeeded:t}:{}}}function UD(n){const e=n.title||"(untitled)",t=n.tags??[];if(t.length===0)return e;const s=document.createElement("span");s.className="feedlist-title feedlist-titled";const i=document.createElement("span");i.className="feedlist-title-text",i.textContent=e,s.append(i);for(const r of t){const a=document.createElement("span");a.className="feedlist-tag",a.dataset.tag=r,a.title=`tag:${r} — press to filter the roster by it`,a.textContent=`#${r}`;const o=document.createElement("span");o.className="feedlist-tag-x",o.title=`take ${r} off this feed (setfattr -x)`,o.textContent="×",a.append(o),s.append(a)}return s}const FD=[{key:"control",label:"",className:"feedlist-control",capped:!1,width:"5.2em",cell:()=>{const n=document.createElement("span");return n.className="feedlist-control listing-capsule",n.textContent="OPEN",n}},{key:"id",label:"ID",className:"feedlist-id",width:"4em",cell:n=>String(n.id),compare:n=>n.id},{key:"title",label:"TITLE",className:"feedlist-title",width:"24em",cell:n=>UD(n),compare:n=>n.title},{key:"progress",label:"PROGRESS",className:"feedlist-progress",width:"1fr",cell:n=>qo(Ep(n)),compare:n=>{const e=Ep(n);return e===null||e.total===0?-1:e.done/e.total}},{key:"status",label:"STATUS",className:"feedlist-status",width:"8em",cell:n=>n.status.toUpperCase(),compare:n=>n.status},{key:"nodes",label:"NODES",className:"feedlist-nodes",width:"4em",cell:n=>n.jobsTotal===void 0?"—":String(n.jobsTotal),compare:n=>n.jobsTotal??-1},{key:"sizeBytes",label:"SIZE",className:"feedlist-size",width:"5.5em",cell:n=>n.sizeBytes===void 0?"—":bM(n.sizeBytes),compare:n=>n.sizeBytes??-1},{key:"wallSeconds",label:"TIME",className:"feedlist-time",width:"6em",cell:n=>n.wallSeconds===void 0?"—":MM(n.wallSeconds),compare:n=>n.wallSeconds??-1},{key:"owner",label:"OWNER",className:"feedlist-owner",width:"7em",cell:n=>n.owner},{key:"createdAt",label:"CREATED",className:"feedlist-created",width:"7em",cell:n=>n.createdAt.slice(0,10),compare:n=>n.createdAt}];function MM(n){const e=Math.round(n);return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${String(e%60).padStart(2,"0")}s`:`${Math.floor(e/3600)}h ${String(Math.floor(e%3600/60)).padStart(2,"0")}m`}function bM(n){if(n<1024)return`${n}B`;const e=["K","M","G","T"];let t=n,s=-1;for(;t>=1024&&s<e.length-1;)t=t/1024,s=s+1;return`${t<10?t.toFixed(1):Math.round(t)}${e[s]}`}class jD{notePill;tagPill;renamePill;marks;handlers;readFeedId=null;tags=[];constructor(e,t){this.handlers=t,this.notePill=e?.querySelector(".dag-note")??null,this.tagPill=e?.querySelector(".dag-tag")??null,this.renamePill=e?.querySelector(".dag-rename")??null,this.marks=e?.querySelector(".dag-marks")??null;const s=(i,r)=>{i?.addEventListener("click",()=>{const a=t.shown();a!==null&&r(a)})};s(this.notePill,i=>t.feed_note?.(i)),s(this.tagPill,i=>t.feed_tag?.(i,this.tags)),s(this.renamePill,i=>t.feed_rename?.(i,t.name()))}shown_set(e){for(const t of[this.notePill,this.tagPill,this.renamePill,this.marks])t!==null&&(t.hidden=!e);e||(this.readFeedId=null)}arrived(e){this.readFeedId!==e&&this.refresh()}refresh(){const e=this.handlers.shown();e!==null&&(this.readFeedId=e,this.handlers.feed_entered?.(e))}show(e,t){if(e!==this.handlers.shown()||this.marks===null)return;t.title!==void 0&&t.title!==""&&this.handlers.renamed(e,t.title),this.tags=[...t.tags];const s=(t.note??"").trim();this.notePill!==null&&(this.notePill.textContent=t.note===null?"NOTE":s===""?"ADD NOTE":"EDIT NOTE"),this.marks.replaceChildren();for(const i of t.tags){const r=document.createElement("span");r.className="feedlist-tag dag-mark",r.dataset.tag=i,r.textContent=`#${i}`;const a=document.createElement("span");a.className="feedlist-tag-x",a.title=`take ${i} off this feed (setfattr -x)`,a.textContent="×",a.addEventListener("click",()=>this.handlers.feed_untag?.(e,i)),r.append(a),this.marks.append(r)}if(s!==""){const i=document.createElement("span");i.className="dag-note-line",i.textContent=s.split(`
4236
+ }`;let vc=null;function Jd(){return vc===null&&(vc=new Fu(1,1,1,10,1,!0)),vc}function kA(n,e){const t=performance.now(),s=new qt({uniforms:{time:{value:t},opacity:{value:1},born:{value:t},cycle:{value:e}},vertexShader:cM,fragmentShader:dM,transparent:!0}),i=Jd().clone(),r=new Float32Array(n.length*3),a=new Float32Array(n.length),o=new Float32Array(n.length),l=new Wu(i,s,n.length),c=new W(0,1,0),d=new kt;return n.forEach((u,h)=>{const p=u.to.clone().sub(u.from),f=p.length();d.position.copy(u.from).addScaledVector(p,.5),d.quaternion.setFromUnitVectors(c,f>0?p.divideScalar(f):c),d.scale.set(u.width,f,u.width),d.updateMatrix(),l.setMatrixAt(h,d.matrix),r.set([u.color.r,u.color.g,u.color.b],h*3),a[h]=u.mode,o[h]=u.start}),i.setAttribute("aColor",new ei(r,3)),i.setAttribute("aMode",new ei(a,1)),i.setAttribute("aStart",new ei(o,1)),l.instanceMatrix.needsUpdate=!0,l.frustumCulled=!1,l}function uM(n){return n==="live"?1:n==="done"||n==="failed"?2:0}class UA{host;sets=[];materials=[];glows=new Map;stale=!1;census=0;constructor(e){this.host=e}materialCount(){return this.materials.length}censusCount(){return this.census}holds(e){return this.sets.some(t=>t.members.has(e))}stale_mark(){this.stale=!0}build(e,t,s){const i=e.mix,r=this.host.palette(),a=[];for(const O of t){const S=this.host.node(O);if(S!==void 0){for(const M of S.parents){const y=this.host.node(M);y!==void 0&&s.has(M)&&a.push({fromId:M,from:y,toId:O,to:S,join:!1})}for(const M of S.joins){const y=this.host.node(M);y!==void 0&&s.has(M)&&a.push({fromId:M,from:y,toId:O,to:S,join:!0})}}}if(a.length===0)return;const o=new Map,l=(O,S=new Set)=>{const M=o.get(O);if(M!==void 0)return M;if(S.has(O))return 0;S.add(O);const y=this.host.node(O),E=y===void 0?[]:[...y.parents,...y.joins].filter(I=>s.has(I)),A=E.length===0?0:1+Math.max(...E.map(I=>l(I,S)));return o.set(O,A),A},c=performance.now(),d=new Float32Array(a.length*3),u=new Float32Array(a.length),h=new Float32Array(a.length),p=r.edge.clone().lerp(new ke("#ffffff"),.45),f=new Wu(Jd(),new qt({uniforms:{time:{value:c},opacity:{value:i},born:{value:c},cycle:{value:1}},vertexShader:cM,fragmentShader:dM,transparent:!0}),a.length),b=new W(0,1,0),g=new kt;let m=0;const z=[],w=new Map,_=new Set;a.forEach(({fromId:O,from:S,toId:M,to:y,join:E},A)=>{const I=y.position.clone().sub(S.position),G=I.length(),C=Math.max(.06,Math.min(S.radius,y.radius)*.34);g.position.copy(S.position).addScaledVector(I,.5),g.quaternion.setFromUnitVectors(b,G>0?I.clone().divideScalar(G):b),g.scale.set(C,G,C),g.updateMatrix(),f.setMatrixAt(A,g.matrix),z.push({from:O,to:M,width:C});const B=y.state==="failed"?r.error:E?r.join:p;d.set([B.r,B.g,B.b],A*3),u[A]=uM(y.state);const P=l(O);if(m=Math.max(m,P),h[A]=P*vr,u[A]===1&&_.add(M),u[A]===2){const L=h[A]+Mn/2;w.set(M,Math.min(w.get(M)??1/0,L)),P===0&&w.set(O,0)}}),f.instanceMatrix.needsUpdate=!0;const v=Jd().clone();if(v.setAttribute("aColor",new ei(d,3)),v.setAttribute("aMode",new ei(u,1)),v.setAttribute("aStart",new ei(h,1)),f.geometry=v,f.frustumCulled=!1,this.host.parent.add(f),e.tubes=f,f.material instanceof qt){this.materials.push(f.material);const O=f.material.uniforms.cycle;O!==void 0&&(O.value=(m+1)*vr+Mn/2+_p)}this.sets.push({mesh:f,edges:z,lamps:w,blinks:_,owner:e,entries:t,members:s})}census_build(e,t){if(e.length===0)return;const s=kA(e,(t+1)*vr+Mn/2+_p);this.host.parent.add(s),s.material instanceof qt&&this.materials.push(s.material),this.census=e.length}frame(e){if(this.materials.length!==0){for(const t of this.materials){const s=t.uniforms.time;s!==void 0&&(s.value=e)}this.stale&&this.restatus(),this.lamps_animate(e)}}follow(){const e=new W(0,1,0),t=new kt;for(const{mesh:s,edges:i}of this.sets)i.forEach(({from:r,to:a,width:o},l)=>{const c=this.host.sphere(r),d=this.host.sphere(a);if(c===void 0||d===void 0)return;const u=d.position.clone().sub(c.position),h=u.length();t.position.copy(c.position).addScaledVector(u,.5),t.quaternion.setFromUnitVectors(e,h>0?u.clone().divideScalar(h):e),t.scale.set(o,h,o),t.updateMatrix(),s.setMatrixAt(l,t.matrix)}),s.instanceMatrix.needsUpdate=!0}release(e){if(this.host.parent.remove(e),this.sets=this.sets.filter(t=>t.mesh!==e),e.geometry.dispose(),e.material instanceof qt){const t=e.material;this.materials=this.materials.filter(s=>s!==t),t.dispose()}}clear(){this.materials=[],this.census=0,this.sets=[];for(const e of this.glows.values())e.material.dispose();this.glows=new Map}restatus(){this.stale=!1;const e=this.sets;this.sets=[];for(const t of e){if(this.host.parent.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material instanceof qt){const s=t.mesh.material;this.materials=this.materials.filter(i=>i!==s),s.dispose()}t.owner.tubes=null,this.build(t.owner,t.entries,t.members)}this.follow()}lamps_animate(e){const t=new Set;for(const{mesh:s,lamps:i,blinks:r}of this.sets){if(i.size===0&&r.size===0||!(s.material instanceof qt))continue;const a=Number(s.material.uniforms.born?.value??e),o=Number(s.material.uniforms.cycle?.value??1),l=((e-a)%o+o)%o,c=Math.min(1,Math.max(0,(o-l)/SA));for(const[u,h]of i){const p=l-h;this.lamp_paint(u,p<0?0:c,p>=0&&p<mo?p/mo:-1,t)}const d=(e%Mn+Mn)%Mn;for(const u of r){if(i.has(u))continue;const h=Math.max(0,1-d/(Mn*.8));this.lamp_paint(u,h*h,d<mo?d/mo:-1,t)}}for(const[s,i]of this.glows)t.has(s)||(i.visible=!1,this.host.sphere(s)===void 0&&(this.host.parent.remove(i),i.material.dispose(),this.glows.delete(s)))}lamp_paint(e,t,s,i){const r=this.host.sphere(e);if(r===void 0||!(r.material instanceof Ei))return;let a=r.userData.lampBase;a instanceof ke||(a=r.material.color.clone(),r.userData.lampBase=a);const o=s<0?0:(1-s)**2;if(r.material.color.copy(a).multiplyScalar(zp+(1-zp)*Math.max(t,o)).lerp(wp,Math.min(1,.22*t+.7*o)),s<0)return;let l=this.glows.get(e);l===void 0&&(l=new Pu(new _l({map:lM(),color:a.clone().lerp(wp,.35),transparent:!0,blending:Ci,depthWrite:!1})),this.glows.set(e,l),this.host.parent.add(l));const c=r.geometry.parameters?.radius??.55,d=1-(1-s)**3;l.position.copy(r.position),l.scale.setScalar(c*(2+xA*d)*r.scale.x),l.material.opacity=.9*(1-s)**1.5,l.visible=!0,i.add(e)}}class FA{host;groups=new Map;lastAt=0;constructor(e){this.host=e}size(){return this.groups.size}solidCount(){let e=0;for(const t of this.groups.values())t.mix>0&&(e+=1);return e}gather(e,t){for(const s of e){if(s.dim)continue;const i=t(s.id);if(i===null)continue;let r=this.groups.get(i);r===void 0&&(r={entries:[],center:new W,maxRadius:0,mix:0,target:0,meshes:[],tubes:null,threadSegments:[]},this.groups.set(i,r)),r.entries.push(s),r.maxRadius=Math.max(r.maxRadius,s.radius)}for(const s of this.groups.values()){for(const i of s.entries)s.center.add(i.position);s.center.divideScalar(Math.max(1,s.entries.length))}}thread_note(e,t){this.groups.get(e)?.threadSegments.push(t)}step(e,t,s){if(this.groups.size===0)return;const i=this.lastAt===0?0:Math.min(100,s-this.lastAt);this.lastAt=s;const r=e.elements;for(const a of this.groups.values()){let o=1/0;for(const d of a.entries){const u=d.position,h=-(r[2]*u.x+r[6]*u.y+r[10]*u.z+r[14]);h>0&&h<o&&(o=h)}const l=o===1/0?0:2*a.maxRadius*t/o;if(a.target===0&&l>yA?a.target=1:a.target===1&&l<vA&&(a.target=0),a.mix===a.target)continue;const c=i===0?1:i/OA;a.mix=a.target>a.mix?Math.min(1,a.mix+c):Math.max(0,a.mix-c),a.mix>0&&a.meshes.length===0&&this.solid_build(a);for(const d of a.meshes)d.material instanceof Ei&&(d.material.opacity=a.mix);if(a.tubes!==null&&a.tubes.material instanceof qt){const d=a.tubes.material.uniforms.opacity;d!==void 0&&(d.value=a.mix)}this.host.stars.stars_fade(a.entries,1-a.mix),this.host.stars.threads_fade(a.threadSegments,1-a.mix),a.mix===0&&this.solid_release(a)}this.host.stars.flush()}clear(){this.groups=new Map}solid_build(e){const t=new Set(e.entries.map(s=>s.id));for(const s of e.entries){const i=this.host.look(s.id);i!==void 0&&e.meshes.push(this.host.spheres.sphere_add(s.id,i.position,i.radius,{color:i.color,fade:e.mix}))}this.host.tubes.build(e,e.entries.map(s=>s.id),t)}solid_release(e){for(const t of e.meshes)this.host.spheres.remove(t);e.tubes!==null&&(this.host.tubes.release(e.tubes),e.tubes=null),e.meshes=[]}}class jA{host;mesh=null;base=null;memberIds=[];memberPositions=[];constructor(e){this.host=e}drawn(){return this.mesh!==null}ids(){return this.memberIds}positions(){return this.memberPositions}build(e,t,s){let i=0;for(const z of e)z.ghost!==!0&&(i+=Math.max(1,z.count));const r=new $u(1,1),a=new Ei({color:"#ffffff",roughness:.5,metalness:.1}),o=[],l=new Wu(r,a,t?1:i),c=new ke,d=new kt,u=new Map,h=new Map;let p=0,f=1;const b=new W;for(const z of e)b.add(z.position);b.divideScalar(Math.max(1,e.length));for(const z of e){if(z.ghost===!0)continue;const w=Math.max(1,z.count),_=w===1?0:z.radius*(1.6+.55*Math.cbrt(w)),v=w===1?z.radius:Math.max(.06,Math.min(z.radius*.5,2.2*_/Math.sqrt(w))),O=[];for(let S=0;S<w;S++){const M=w===1?z.position.clone():EA(S,w,_).add(z.position);O.push(M),c.set(z.color),t?o.push({id:z.id,position:M,radius:v,color:c.clone(),dim:z.dim,ember:z.ember}):(d.position.copy(M),d.scale.setScalar(v),d.updateMatrix(),l.setMatrixAt(p,d.matrix),l.setColorAt(p,c)),this.memberIds.push(z.id),this.memberPositions.push(M),p+=1,f=Math.max(f,b.distanceTo(M)+v)}u.set(z.id,O),h.set(z.id,v)}if(t){const z=this.host.starsView();this.host.stars.draw(o,z.pixelRatio,z.heightPx,z.fovDeg)}else l.instanceColor&&(l.instanceColor.needsUpdate=!0),this.host.parent.add(l),this.mesh=l,this.base=l.instanceColor?Float32Array.from(l.instanceColor.array):null;const g=[];for(const z of e){const w=u.get(z.id)??[];for(const _ of z.parents){const v=u.get(_);if(!(!v||v.length===0))for(let O=0;O<w.length;O++){const S=w[O],M=v.length===w.length?v[O]:v[O%v.length];S===void 0||M===void 0||g.push(S.x,S.y,S.z,M.x,M.y,M.z)}}}const m=g.length/6;if(!t&&m>0&&m<=WA)this.tubes_build(e,u,h,s);else if(g.length>0){const z=new Ht;z.setAttribute("position",new Nt(g,3)),this.host.parent.add(new Vg(z,t?new Nr({color:s.edge,transparent:!0,opacity:aM,blending:Ci,depthWrite:!1}):new Nr({color:s.edge,transparent:!0,opacity:.35})))}return{center:b,radius:f}}flare(e,t,s,i){let r=0;if(this.mesh===null||this.base===null||!this.mesh.instanceColor)return r;const a=this.mesh.instanceColor.array,o=this.base;for(let l=0;l<this.memberIds.length;l++){const c=e(this.memberIds[l]??"");if(c===void 0)continue;r=Math.max(r,c);const d=t-c,u=d>=0&&d<=i?Math.sin(d/i*Math.PI):0,h=l*3;a[h]=o[h]+(s.r-o[h])*u,a[h+1]=o[h+1]+(s.g-o[h+1])*u,a[h+2]=o[h+2]+(s.b-o[h+2])*u}return this.mesh.instanceColor.needsUpdate=!0,r}pick(e){if(this.mesh===null)return null;const t=e.intersectObject(this.mesh)[0];return t===void 0||t.instanceId===void 0?null:(this.mesh.setColorAt(t.instanceId,new ke("#ffffff")),this.mesh.instanceColor&&(this.mesh.instanceColor.needsUpdate=!0),this.memberIds[t.instanceId]??null)}clear(){this.mesh=null,this.base=null,this.memberIds=[],this.memberPositions=[]}tubes_build(e,t,s,i){const r=new Map(e.map(u=>[u.id,u])),a=new Map,o=(u,h=new Set)=>{const p=a.get(u);if(p!==void 0)return p;if(h.has(u))return 0;h.add(u);const f=(r.get(u)?.parents??[]).filter(g=>r.has(g)),b=f.length===0?0:1+Math.max(...f.map(g=>o(g,h)));return a.set(u,b),b},l=i.edge.clone().lerp(new ke("#ffffff"),.45),c=[];let d=0;for(const u of e){const h=t.get(u.id)??[];for(const p of u.parents){const f=t.get(p);if(!f||f.length===0)continue;const b=Math.max(.02,Math.min(s.get(u.id)??.1,s.get(p)??.1)*.34),g=o(p)*vr;d=Math.max(d,o(p));for(let m=0;m<h.length;m++){const z=h[m],w=f.length===h.length?f[m]:f[m%f.length];w===void 0||z===void 0||c.push({from:w,to:z,width:b,color:u.state==="failed"?i.error:l,mode:uM(u.state),start:g})}}}this.host.tubes.census_build(c,d)}}const vp=.028,$A=.25,VA="rgba(0, 0, 0, 0.7)",aa=48;class HA{parent;captions=new Map;shown=!0;constructor(e){this.parent=e}count(){return this.captions.size}caption_add(e,t,s,i,r,a,o=0){const l=document.createElement("canvas"),c=l.getContext("2d"),d=`600 ${aa}px sans-serif`;let u=t.length*aa*.6;if(c!==null&&(c.font=d,u=Math.ceil(c.measureText(t).width)),l.width=Math.max(1,u+aa),l.height=Math.round(aa*1.5),c!==null){c.font=d,c.textBaseline="middle";const b=l.height/4;c.fillStyle=VA,c.beginPath(),c.roundRect(0,0,l.width,l.height,b),c.fill(),c.fillStyle=`#${r.getHexString()}`,c.fillText(t,aa/2,l.height/2)}const h=new qg(l),p=new _l({map:h,transparent:!0,depthWrite:!1,depthTest:!1,sizeAttenuation:!1,opacity:a?$A:.9}),f=new Pu(p);f.scale.set(vp*(l.width/l.height),vp,1),f.center.set(.5,0),f.position.set(s.x,s.y+i,s.z),f.renderOrder=4,f.visible=this.shown,this.parent.add(f),this.captions.get(e)?.texture.dispose(),this.captions.set(e,{sprite:f,texture:h,rank:o})}declutter(e){if(!this.shown)return 0;const t=[...this.captions.values()].sort((o,l)=>l.rank-o.rank),s=[],i=new W,r=e.projectionMatrix.elements[0]??1,a=e.projectionMatrix.elements[5]??1;for(const o of t){if(o.sprite.getWorldPosition(i).project(e),i.z>1){o.sprite.visible=!1;continue}const l=o.sprite.scale.x*r/2,c={left:i.x-l,right:i.x+l,bottom:i.y,top:i.y+o.sprite.scale.y*a},d=s.some(u=>c.left<u.right&&u.left<c.right&&c.bottom<u.top&&u.bottom<c.top);o.sprite.visible=!d,d||s.push(c)}return s.length}shown_set(e){if(this.shown=e,!e)for(const t of this.captions.values())t.sprite.visible=!1}shown_get(){return this.shown}clear(){for(const e of this.captions.values())e.texture.dispose();this.captions=new Map}}const qA=.0022,XA=.006,KA=.0035,YA=1e4,Op=700,xp=new W(0,1,0),ZA={minDistance:8,margin:1.15,stance:"axis",farFloor:200,farScale:2};function QA(n){return n*n*(3-2*n)}class JA{camera;world;clock;focus=new W;flight=null;home=null;holding=!1;touched=!1;spinIdleUntil=0;tumbleAxis=new W(0,1,0);tumblePhase;constructor(e,t,s=Date.now,i=Math.random()*Math.PI*2){this.camera=e,this.world=t,this.clock=s,this.tumblePhase=i}flying(){return this.flight!==null}holding_get(){return this.holding}touched_get(){return this.touched}touch_note(){this.touched=!0}spin_pause(){this.spinIdleUntil=this.clock()+YA}eyeDistance(){return this.camera.position.distanceTo(this.focus)}turn_about(e,t){const s=new Ui().setFromAxisAngle(e,t);this.world.position.sub(this.focus).applyQuaternion(s).add(this.focus),this.world.quaternion.premultiply(s)}orbit(e,t){this.turn_about(xp,e*.005),this.turn_about(new W().setFromMatrixColumn(this.camera.matrixWorld,0).normalize(),t*.005)}dolly(e,t=!1){if(this.spin_pause(),this.touched=!0,t){const a=this.camera.getWorldDirection(new W),o=Math.max(4,this.camera.position.length())*.0012;this.camera.position.addScaledVector(a,-e*o);return}const s=this.camera.position.clone().sub(this.focus),i=s.length(),r=Math.min(Math.max(i*Math.exp(e*.001),1.5),Math.max(40,this.camera.far*.45));this.camera.position.copy(this.focus).addScaledVector(s,r/Math.max(1e-4,i))}pan(e,t){const s=this.camera.position.distanceTo(this.focus)*.0016,i=new W().setFromMatrixColumn(this.camera.matrixWorld,0).multiplyScalar(-e*s).add(new W().setFromMatrixColumn(this.camera.matrixWorld,1).multiplyScalar(t*s));this.camera.position.add(i),this.focus.add(i)}frame(e,t,s={}){const i={...ZA,...s},r=Math.max(i.minDistance,this.fitDistance(t)*i.margin);this.world.position.copy(e).applyQuaternion(this.world.quaternion).negate(),this.focus.set(0,0,0),i.stance==="threeQuarter"?this.camera.position.set(r*.5,r*.4,r*.85):this.camera.position.set(0,0,r),this.camera.far=Math.max(i.farFloor,(r+t)*i.farScale),this.camera.updateProjectionMatrix(),this.camera.lookAt(0,0,0)}touch_clear(){this.touched=!1}flyToFit(e,t,s,i=1,r=1.15){if(e.length===0){s();return}let a=0;const o=new W;for(const h of e)o.add(h.position),a=Math.max(a,h.radius);o.divideScalar(e.length);const l=e.map(h=>o.distanceTo(h.position)).sort((h,p)=>h-p),c=Math.max(1,Math.min(l.length,Math.ceil(l.length*Math.min(1,Math.max(.1,i))))),d=Math.max(1,(l[c-1]??1)+a),u=Math.max(3,this.fitDistance(d)*r);this.camera.far=Math.max(this.camera.far,(u+d)*2),this.camera.updateProjectionMatrix(),this.flyAlongLine(o,u,t,s)}flyToward(e,t,s,i){this.flyAlongLine(e.position,Math.max(t,e.radius*4),s,i)}flyInto(e,t){if(this.flight!==null||this.holding)return!1;this.holding=!0,this.home={position:this.camera.position.clone(),quaternion:this.camera.quaternion.clone()};const s=e.clone().add(this.camera.position.clone().sub(e).normalize().multiplyScalar(.4));return this.flight_begin(s,this.aim_from(this.camera.position,e),Op,t),!0}flyBack(e){const t=this.home;if(t===null){this.holding=!1,e();return}this.flight_begin(t.position.clone(),t.quaternion.clone(),Op,()=>{this.home=null,this.holding=!1,this.spin_pause(),e()})}flight_step(){const e=this.flight;if(e===null)return;const t=Math.min(1,(this.clock()-e.startedAt)/e.durationMs),s=QA(t);this.camera.position.lerpVectors(e.fromPos,e.toPos,s),this.camera.quaternion.slerpQuaternions(e.fromQuat,e.toQuat,s),t>=1&&(this.flight=null,e.onDone())}spin_step(e){!e||this.holding||this.flight!==null||this.clock()<this.spinIdleUntil||this.turn_about(xp,qA)}tumble_step(){this.tumblePhase+=KA,this.tumbleAxis.set(Math.sin(this.tumblePhase*.7),Math.cos(this.tumblePhase*.4)+.6,Math.sin(this.tumblePhase*.3)*.8).normalize(),this.world.rotateOnWorldAxis(this.tumbleAxis,XA)}fitDistance(e){const t=this.camera.fov*Math.PI/180,s=e/Math.tan(t/2),i=e/(Math.tan(t/2)*Math.max(.1,this.camera.aspect));return Math.max(s,i)}aim_from(e,t){const s=this.camera.clone();return s.position.copy(e),s.lookAt(t),s.quaternion.clone()}flyAlongLine(e,t,s,i){const r=this.camera.position.clone().sub(e);r.lengthSq()<1e-4&&r.set(0,0,1),r.normalize();const a=e.clone().add(r.multiplyScalar(t));this.focus.copy(e),this.flight_begin(a,this.aim_from(a,e),s,i)}flight_begin(e,t,s,i){this.flight={fromPos:this.camera.position.clone(),toPos:e,fromQuat:this.camera.quaternion.clone(),toQuat:t,startedAt:this.clock(),durationMs:s,onDone:i}}}const hM=4,eD=350,tD=30,sD=600,nD=400;class iD{element;rig;target;mode;clock;touches=new Map;pinch=null;gestureHeld=!1;lastTap=null;kind="mouse";tapActivatedAt=0;suppressClick=!1;viewDrag=null;grabbing=!1;over=!1;detachers=[];constructor(e,t,s,i,r=Date.now){this.element=e,this.rig=t,this.target=s,this.mode=i,this.clock=r,e.style.touchAction="none",this.listen("click",a=>this.click_handle(a)),this.listen("dblclick",a=>{this.clock()-this.tapActivatedAt<sD||this.target.tap(a,"activate")}),this.listen("pointerdown",a=>this.down_handle(a)),this.listen("pointerup",a=>this.up_handle(a)),this.listen("pointercancel",a=>this.up_handle(a)),this.listen("pointermove",a=>this.move_handle(a)),this.listen("pointerleave",a=>{this.over=!1,this.target.leave(a)}),this.listen("wheel",a=>{a.preventDefault(),this.rig.dolly(a.deltaY,this.mode.untethered())},{passive:!1}),this.listen("contextmenu",a=>a.preventDefault())}pointerOver(){return this.over}pressKind(){return this.kind}fingersDown(){return this.touches.size}detach(){for(const e of this.detachers.splice(0))e()}listen(e,t,s){this.element.addEventListener(e,t,s),this.detachers.push(()=>this.element.removeEventListener(e,t,s))}click_handle(e){if(this.suppressClick){this.suppressClick=!1;return}if(this.kind==="touch"){const t=this.clock(),s=this.lastTap;if(s!==null&&t-s.at<=eD&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=tD){this.lastTap=null,this.tapActivatedAt=t,this.target.tap(e,"activate");return}this.lastTap={at:t,x:e.clientX,y:e.clientY}}this.target.tap(e,"select")}down_handle(e){if(this.kind=e.pointerType,e.pointerType==="touch"){if(e.isPrimary&&(this.touches.clear(),this.pinch=null,this.gestureHeld=!1),this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.touches.size===2){this.gesture_begin();return}if(this.touches.size>2||this.gestureHeld)return;this.press(e),this.hover(e);return}this.press(e)}up_handle(e){if(e.pointerType==="touch"&&(this.touches.delete(e.pointerId),this.touches.size<2&&(this.pinch=null),this.touches.size===0&&this.gestureHeld)){this.gestureHeld=!1,this.suppressClick=!0,setTimeout(()=>{this.suppressClick=!1},nD),this.release(),this.target.gesture_end?.();return}this.release()}move_handle(e){if(e.pointerType==="touch"&&this.touches.has(e.pointerId)){if(this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.pinch!==null){this.gesture_move();return}if(this.gestureHeld)return}this.grabbing?this.target.grab_move(e):this.viewDrag!==null?this.view_move(e):this.hover(e)}hover(e){this.over=!0,this.target.hover(e)}press(e){if(!(this.rig.holding_get()||this.rig.flying())){this.rig.spin_pause(),this.target.grab_begin(e)?this.grabbing=!0:this.viewDrag={lastX:e.clientX,lastY:e.clientY,startX:e.clientX,startY:e.clientY,pan:e.shiftKey||e.button===2||e.button===1,moved:!1};try{this.element.setPointerCapture(e.pointerId)}catch{}this.target.tip_hide()}}release(){this.viewDrag!==null&&(this.viewDrag.moved&&(this.suppressClick=!0),this.viewDrag=null,this.rig.spin_pause()),this.grabbing&&(this.grabbing=!1,this.rig.spin_pause(),this.target.grab_end()&&(this.suppressClick=!0))}view_move(e){const t=this.viewDrag;if(t===null)return;this.rig.spin_pause();const s=e.clientX-t.lastX,i=e.clientY-t.lastY;t.lastX=e.clientX,t.lastY=e.clientY,!t.moved&&Math.abs(e.clientX-t.startX)+Math.abs(e.clientY-t.startY)>hM&&(t.moved=!0,this.rig.touch_note()),t.moved&&(t.pan||this.mode.flat()?this.rig.pan(s,i):this.rig.orbit(s,i))}fingers_read(){const[e,t]=[...this.touches.values()];return e===void 0||t===void 0?null:{spread:Math.hypot(e.x-t.x,e.y-t.y),midX:(e.x+t.x)/2,midY:(e.y+t.y)/2}}gesture_begin(){this.release(),this.gestureHeld=!0,this.pinch=this.fingers_read(),this.rig.spin_pause(),this.target.tip_hide()}gesture_move(){const e=this.fingers_read();e===null||this.pinch===null||(e.spread>0&&this.pinch.spread>0&&this.rig.dolly(Math.log(this.pinch.spread/e.spread)/.001,this.mode.untethered()),(this.mode.flat()||!this.mode.untethered())&&this.rig.pan(e.midX-this.pinch.midX,e.midY-this.pinch.midY),this.pinch=e)}}const rD=14,aD=4;class oD{camera;world;element;sources;starGlow;raycaster=new xO;constructor(e,t,s,i,r){this.camera=e,this.world=t,this.element=s,this.sources=i,this.starGlow=r}ray_aim(e){const t=this.element.getBoundingClientRect(),s=new Je((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1);return this.world.updateMatrixWorld(!0),this.raycaster.setFromCamera(s,this.camera),this.raycaster}mesh_under(e){const t=this.ray_aim(e).intersectObjects([...this.sources.meshes()]).filter(r=>r.object.userData.dim!==!0),i=(t.find(r=>r.object.userData.halo!==!0)??t[0])?.object;return i instanceof Ms?i:null}meshNode_under(e){const t=this.mesh_under(e)?.userData.nodeId;return typeof t=="string"?t:null}node_under(e,t){const s=this.meshNode_under(e);if(s!==null)return s;const i=this.sources.census();return i!==null?i.pick(this.ray_aim(e)):this.star_under(e,t)}star_under(e,t){const s=this.sources.stars(),i=this.sources.nebulae(),r=this.element.getBoundingClientRect(),a=e.clientX-r.left,o=e.clientY-r.top;this.world.updateMatrixWorld(!0),this.camera.updateMatrixWorld();const l=r.height/(2*Math.tan(this.camera.fov*Math.PI/360)),c=new wt().multiplyMatrices(this.camera.matrixWorldInverse,this.world.matrixWorld),u=new wt().multiplyMatrices(this.camera.projectionMatrix,c).elements,h=c.elements,p=m=>{const z=-(h[2]*m.x+h[6]*m.y+h[10]*m.z+h[14]);if(z<=0)return null;const w=u[3]*m.x+u[7]*m.y+u[11]*m.z+u[15],_=(u[0]*m.x+u[4]*m.y+u[8]*m.z+u[12])/w,v=(u[1]*m.x+u[5]*m.y+u[9]*m.z+u[13])/w;return{x:(_+1)/2*r.width,y:(1-v)/2*r.height,depth:z}},f=t?rD:aD;let b=null,g=1/0;for(const m of s){if(m.dim)continue;const z=p(m.position);if(z===null)continue;const w=Math.max(f,this.starGlow*m.radius*l/z.depth),_=Math.hypot(z.x-a,z.y-o);if(_>w)continue;const v=_/w;v<g&&(g=v,b=m.id)}if(b!==null)return b;for(const m of i){const z=p(m.position);if(z!==null&&Math.hypot(z.x-a,z.y-o)<=m.radius*l/z.depth)return m.id}return null}}const lD=3e4,cD=900;class dD{clock;order;first;last;shown=0;moment;speed=1;running=!1;lastWall;flashes=new Map;constructor(e,t=Date.now){this.clock=t,this.order=[...e].map(([s,i])=>({id:s,at:i})).sort((s,i)=>s.at-i.at||(s.id<i.id?-1:1)),this.first=this.order[0]?.at??0,this.last=this.order[this.order.length-1]?.at??0,this.moment=this.first,this.lastWall=t()}span(){return[this.first,this.last]}ids(){return this.order.map(e=>e.id)}playing(){return this.running}at(){return this.moment}play(e=this.speed){this.speed=Math.max(.05,e),this.moment>=this.last&&this.shown>=this.order.length&&this.seek(this.first),this.running=!0,this.lastWall=this.clock()}pause(){this.running=!1}seek(e){this.moment=Math.max(this.first,Math.min(this.last,e));const t=[],s=[];for(;this.shown<this.order.length&&this.order[this.shown].at<=this.moment;)t.push(this.order[this.shown].id),this.shown+=1;for(;this.shown>0&&this.order[this.shown-1].at>this.moment;){this.shown-=1;const i=this.order[this.shown].id;s.push(i),this.flashes.delete(i)}return{at:this.moment,arrived:t,departed:s,done:this.moment>=this.last}}step(){const e=this.clock(),t=e-this.lastWall;if(this.lastWall=e,!this.running)return{at:this.moment,arrived:[],departed:[],done:this.moment>=this.last};const s=(this.last-this.first)/lD*this.speed,i=this.seek(s>0?this.moment+t*s:this.last);for(const r of i.arrived)this.flashes.set(r,e);return i.done&&(this.running=!1),i}flashing(){const e=this.clock(),t=new Map;for(const[s,i]of this.flashes){const r=(e-i)/cD;r>=1?(this.flashes.delete(s),t.set(s,0)):t.set(s,1-r)}return t}}const uD=90*400,hD=12;function fM(n){const e={id:n.id,parents:[...n.parentIds,...n.joinParentIds]};return n.metric!==void 0&&(e.metric=n.metric),e}function fD(n){const e=dg(n.map(t=>{const s={id:t.id,parentIds:t.parentIds};return t.metric!==void 0&&(s.metric=t.metric),s}));return n.map((t,s)=>{const i=e[s];return{node:t,position:new W(...i?.position??[0,0,0]),radius:i?.radius??Dt}})}function pM(n){return ig(n.map(fM))}function mM(n,e=3,t=new Map,s=ni,i=new Set){const r=new Map([...t].map(([o,l])=>[o,[l.x,l.y,l.z]])),a=rg(n.map(fM),e,r,s,i);return{total:a.total,moving:a.moving,step:a.step,place:()=>a.place().map((o,l)=>({node:n[l],position:new W(...o.position),radius:o.radius}))}}function pD(n,e=3,t=new Map,s=ni,i=new Set){const r=mM(n,e,t,s,i);return r.step(r.total),r.place()}function mD(n,e,t){const s=new Map(n.map(o=>[o.node.id,o])),i=new Map;for(const o of n)for(const l of o.node.parentIds)i.set(l,[...i.get(l)??[],o]);const r=o=>{const l=i.get(o)??[];if(l.length===0)return null;const c=new W;for(const d of l)c.add(d.position);return c.divideScalar(l.length)},a=[];for(const{node:o,position:l,radius:c}of n){if(o.caption!==void 0){const d=o.ghost===!0?r(o.id):null,u=d!==null?0:o.halo===!0?yc(o.count??1):c;t.labels.caption_add(o.id,o.caption,d??l,u,e.done,o.dim===!0,o.count??1)}if(!(o.ghost===!0&&o.halo!==!0)){if(t.starring&&o.solid!==!0){if(o.halo===!0){t.stars.nebula_add(o.id,l,yc(o.count??1),e.edge,o.dim===!0);continue}a.push({id:o.id,position:l.clone(),radius:c,color:Pr(o.look.paint,e).clone(),dim:o.dim===!0,ember:o.look.ember,...o.ring===!0?{ring:!0}:{}});continue}if(o.halo===!0){t.spheres.halo_add(o.id,l,yc(o.count??1),e.edge,o.dim===!0);continue}t.spheres.sphere_add(o.id,l,c,{color:Pr(o.look.paint,e),dim:o.dim===!0,selected:o.id===t.selected,flat:t.flat})}}return{starred:a,byId:s}}function gD(n,e,t,s){const i=[],r=[],a=c=>!s.starring||c.node.solid===!0,o=[],l=(c,d,u,h,p,f)=>{const b=h?.35:1,g=i.length/6;i.push(c.x,c.y,c.z,d.x,d.y,d.z),o.push(f,p.id),r.push(u.r*b,u.g*b,u.b*b,u.r*b,u.g*b,u.b*b);const m=h||s.handoffKey===void 0?null:s.handoffKey(p);m!==null&&s.handoff.thread_note(m,g)};for(const c of n){const{node:d,position:u}=c;if(d.ghost!==!0){for(const h of d.parentIds){const p=e.get(h);if(!p||p.node.ghost===!0)continue;const f=d.dim===!0||p.node.dim===!0;a(c)&&a(p)?!s.starring&&f&&s.spheres.edge_add(h,d.id,p.position,u,t.edge,!1,f):l(p.position,u,t.edge,f,d,h)}for(const h of d.joinParentIds){const p=e.get(h);if(!p)continue;if(d.joinFaint===!0){l(p.position,u,t.join,!0,d,h);continue}const f=d.dim===!0||p.node.dim===!0;a(c)&&a(p)?!s.starring&&f&&s.spheres.edge_add(h,d.id,p.position,u,t.join,!0,f):l(p.position,u,t.join,f,d,h)}}}s.stars.threads_draw(i,r,o)}function MD(n,e,t,s,i){const r=n.filter(_=>e.has(_.id)),a=new Map;if(r.length===0)return a;const o=new W;for(const _ of r)o.add(e.get(_.id));o.divideScalar(r.length);const l=t.clone().normalize(),c=new W().crossVectors(s,l);c.lengthSq()<1e-9&&c.set(1,0,0).cross(l),c.normalize();const d=new W().crossVectors(l,c).normalize(),u=new Map;for(const _ of r){const v=e.get(_.id).clone().sub(o);u.set(_.id,new W(v.dot(c),v.dot(d),0))}const h=new Set(r.map(_=>_.id)),p=r.map(_=>({..._,parentIds:_.parentIds.filter(v=>h.has(v)),joinParentIds:_.joinParentIds.filter(v=>h.has(v))})),f=pD(p,2,u,{...i,gravity:!1}),b=new W;for(const _ of f)b.add(_.position);b.divideScalar(f.length);const g=_=>Math.sqrt(_.reduce((v,O)=>v+O*O,0)/Math.max(1,_.length)),m=g(r.map(_=>e.get(_.id).distanceTo(o))),z=g(f.map(_=>Math.hypot(_.position.x-b.x,_.position.y-b.y))),w=z>1e-9&&m>1e-9?m/z:1;for(const _ of f){const v=(_.position.x-b.x)*w,O=(_.position.y-b.y)*w;a.set(_.node.id,o.clone().addScaledVector(c,v).addScaledVector(d,O))}return a}class bD{restore=null;active(){return this.restore!==null}clear(){this.restore=null}set(e,t,s,i,r){if(e===null||e.length===0){if(this.restore===null)return!1;for(const[u,h]of this.restore)s.set(u,h);return this.restore=null,!0}if(this.restore!==null)return!1;const a=new Set(e),o=i.world.quaternion.clone().invert(),l=i.camera.position.clone().sub(i.focus).normalize().applyQuaternion(o),c=new W(0,1,0).applyQuaternion(i.camera.quaternion).applyQuaternion(o),d=MD(t.filter(u=>a.has(u.id)),s,l,c,r);if(d.size===0)return!1;this.restore=new Map([...d.keys()].map(u=>[u,s.get(u).clone()]));for(const[u,h]of d)s.set(u,h);return!0}}class _D{ports;constructor(e){this.ports=e}ids(){return[...this.ports.meshes().keys(),...this.ports.stars.ids()]}world_of(e){const t=this.ports.meshes().get(e);if(t!==void 0){const i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),{position:t.getWorldPosition(new W),radius:i.boundingSphere?.radius??Dt}}const s=this.ports.stars.entry(e);return s!==void 0?{position:this.ports.group.localToWorld(s.position.clone()),radius:s.radius}:null}diveTarget_of(e){const t=this.ports.meshes().get(e),s=t===void 0?this.ports.census.ids().indexOf(e):-1;return t===void 0&&s<0?null:(this.ports.group.updateMatrixWorld(!0),t!==void 0?t.getWorldPosition(new W):this.ports.group.localToWorld((this.ports.census.positions()[s]??new W).clone()))}reaches_of(e){const t=new Set(e),s=[];this.ports.group.updateMatrixWorld(!0);for(const i of this.ids()){if(t.size>0&&!t.has(i))continue;const r=this.world_of(i);r!==null&&s.push(r)}return s}}function zD(n,e){return n.map(t=>{const s=t.node;return{id:s.id,position:t.position,radius:t.radius,count:Math.max(1,s.count??1),color:Pr(s.look.paint,e),dim:s.dim===!0,ember:s.look.ember,state:s.look.state,parents:s.parentIds,ghost:s.ghost===!0}})}function wD(n,e){return{position:n.position,radius:n.radius,color:Pr(n.node.look.paint,e)}}function yD(n){return{position:n.position,radius:n.radius,parents:n.node.parentIds,joins:n.node.joinFaint===!0?[]:n.node.joinParentIds,state:n.node.look.state}}function vD(n,e){return e.updateMatrixWorld(!0),n.updateMatrixWorld(),new wt().multiplyMatrices(n.matrixWorldInverse,e.matrixWorld)}function OD(n,e){return n/(2*Math.tan(e*Math.PI/360))}const Oc=.5;class xD{ports;busy=!1;constructor(e){this.ports=e}moving(){return this.busy}frame(e,t,s,i,r){this.busy=!0,this.ports.flyToFit(e,t,()=>{this.busy=!1,s()},i,r)}relight(e,t,s,i,r){this.busy=!0,this.ports.graph_set(e,{wave:!1,fit:!1,frozen:e.nodes.map(a=>a.id)}),r?.(),this.ports.flyToFit(t,s,()=>{this.busy=!1,i()})}unfold(e,t){this.busy=!0;const s=this.ports.positions_get(),i=SD(s,e.from),r=this.ports.random??(()=>Math.random()-.5);for(const l of e.unfolding)s[l]=[i[0]+r()*Oc,i[1]+r()*Oc,i[2]+r()*Oc];this.ports.positions_seed(s);const a=new Set(e.unfolding),o=e.graph.nodes.filter(l=>!a.has(l.id)).map(l=>l.id);this.ports.graph_set(e.graph,{wave:!1,fit:!1,frozen:o,...e.physics!==void 0?{physics:e.physics}:{}}),e.drawn?.(),this.ports.flyToFit(e.frame,e.durationMs,()=>{this.busy=!1,t()},e.bulk,e.margin)}descent(e,t,s,i){this.busy=!0;const r=()=>{t().then(a=>{if(this.ports.alive()){if(a===null){this.busy=!1,i();return}this.unfold(a,s)}})};"toward"in e?this.ports.flyToward(e.toward,e.distance,e.durationMs,r):this.ports.flyToFit(e.fit,e.durationMs,r)}}function SD(n,e){for(const t of e){const s=[0,0,0];let i=0;for(const r of t){const a=n[r];a!==void 0&&(s[0]+=a[0],s[1]+=a[1],s[2]+=a[2],i+=1)}if(i>0)return[s[0]/i,s[1]/i,s[2]/i]}return[0,0,0]}const ED=1e3;class AD{workerOf;generation;worker=null;disposed=!1;constructor(e,t){this.workerOf=e,this.generation=t}dispose(){this.disposed=!0,this.worker?.terminate(),this.worker=null}run(e){const t=pM(e.nodes),s=new Map([...e.seeds].map(([d,u])=>[d,[u.x,u.y,u.z]])),i=Uw(e.nodes,e.keyOf,s,e.frozen),r=ED,a=i.length;e.progress(0,r,a);const o=d=>{e.placed(e.nodes.map(u=>{const h=d[u.id]??[0,0,0];return{node:u,position:new W(h[0],h[1],h[2]),radius:t.get(u.id)??Dt}})),e.progress(r,r,a)},l=d=>e.progress(Math.min(r-1,Math.floor(d*r)),r,a);if(this.worker===null){if(this.workerOf===void 0){const d=py(e.arrangement);if(d===void 0){console.error(`layout: no engine named ${e.arrangement}`),e.progress(r,r,a);return}o(d.run({nodes:i,physics:e.physics},l).positions);return}this.worker=this.workerOf()}const c=this.worker;c.onmessage=d=>{const u=d.data;if(!(u.generation!==this.generation()||this.disposed)){if(u.type==="progress"){l(u.fraction??0);return}if(u.type==="failed"){console.error(`layout: ${u.reason??"the engine failed"}`),e.progress(r,r,a);return}o(u.positions??{})}},c.postMessage({generation:e.generation,nodes:i,physics:e.physics,arrangement:e.arrangement})}}const oa=700,DD=2500;function TD(n){const e=new Map,t=new Set(n.map(r=>r.id)),s=r=>r.look.waved;let i=!1;for(;!i;){i=!0;for(const r of n){if(e.has(r.id)||!s(r))continue;const a=[...r.parentIds,...r.joinParentIds].filter(l=>t.has(l));if(!a.every(l=>e.has(l)))continue;const o=a.reduce((l,c)=>Math.max(l,e.get(c)??0),-vr);e.set(r.id,o+vr),i=!1}}return e}class ID{ports;color=new ke("#48d8f0");times=new Map;startAt=null;looping=!1;constructor(e){this.ports=e}start(){this.times=TD(this.ports.nodes()),this.startAt=this.times.size>0?this.now():null}loop_set(e){this.looping=e,e&&this.start()}loop_get(){return this.looping}animate(){if(this.startAt===null)return;const e=this.now()-this.startAt;let t=0;const s=this.ports.census();if(s!==null){t=s.flare(r=>this.times.get(r),e,this.color,oa),e>t+oa&&(this.startAt=this.renewal());return}const i=this.ports.selected();for(const[r,a]of this.times){t=Math.max(t,a);const o=this.ports.mesh(r);if(o===void 0||!(o.material instanceof Ei))continue;const l=e-a,c=l>=0&&l<=oa?Math.sin(l/oa*Math.PI):0;o.scale.setScalar(1+c*.45),c>0?(o.material.emissive.copy(this.color),o.material.emissiveIntensity=c*1.2):(o.material.emissive.setScalar(r===i?1:0),o.material.emissiveIntensity=r===i?.35:0)}e>t+oa&&(this.startAt=this.renewal())}now(){return(this.ports.now??Date.now)()}renewal(){return this.ports.ambient||this.looping?this.now()+DD:null}}class GD{ports;running=null;constructor(e){this.ports=e}active(){return this.running!==null}begin(e,t=1){const s=new dD(e,this.ports.now??Date.now);this.running={clock:s,arrivals:e,shown:new Set},this.ports.redraw(),this.paintAll(),s.play(t)}play(e){this.running?.clock.play(e)}pause(){this.running?.clock.pause()}seek(e){this.running!==null&&this.apply(this.running.clock.seek(e))}stop(){this.running!==null&&(this.running=null,this.ports.redraw())}state(){return this.running===null?null:{playing:this.running.clock.playing(),at:this.running.clock.at(),span:this.running.clock.span()}}step(){const e=this.running;if(e===null)return;const t=e.clock.playing(),s=e.clock.step();this.apply(s);for(const[i,r]of e.clock.flashing())this.ports.stars.flash_set(i,r);this.ports.stars.flush(),(t||s.arrived.length>0)&&this.ports.moved?.(s.at,e.clock.playing())}paintAll(){const e=this.running;if(e===null)return;const t=[...e.arrivals.keys()].filter(s=>!e.shown.has(s));this.ports.stars.presence_set(t,0),this.ports.stars.presence_set(e.shown,1),this.ports.stars.threads_present(s=>e.shown.has(s)||!e.arrivals.has(s)),this.ports.stars.flush()}apply(e){const t=this.running;if(!(t===null||e.arrived.length===0&&e.departed.length===0)){for(const s of e.arrived)t.shown.add(s);for(const s of e.departed)t.shown.delete(s),this.ports.stars.flash_set(s,0);this.ports.stars.presence_set(e.arrived,1),this.ports.stars.presence_set(e.departed,0),this.ports.stars.threads_present(s=>t.shown.has(s)||!t.arrivals.has(s)),this.ports.stars.flush()}}}class RD{ports;drag=null;pull=null;returns=[];constructor(e){this.ports=e}dragging(){return this.drag!==null}clear(){this.drag=null,this.pull=null}positions(){return this.pull?.positions()??[]}begin(e){const t=this.ports.picker.mesh_under(e),s=t?.userData.nodeId;if(t===null||typeof s!="string")return!1;const i=this.ports.camera.getWorldDirection(new W).negate();this.ports.group.updateMatrixWorld(!0);const r=new $n().setFromNormalAndCoplanarPoint(i,t.getWorldPosition(new W));return this.drag={nodeId:s,plane:r,startX:e.clientX,startY:e.clientY,moved:!1,solo:this.ports.solo(),home:t.position.clone()},!0}move(e){if(this.drag===null||(this.ports.spin_pause(),!this.drag.moved&&Math.abs(e.clientX-this.drag.startX)+Math.abs(e.clientY-this.drag.startY)>hM&&(this.drag.moved=!0,this.drag.solo||this.simulation_begin(this.drag.nodeId)),!this.drag.moved))return!1;const t=new W;if(this.ports.picker.ray_aim(e).ray.intersectPlane(this.drag.plane,t)===null)return!1;if(this.ports.group.worldToLocal(t),this.drag.solo){const s=this.ports.meshes().get(this.drag.nodeId);return s===void 0?!1:(s.position.copy(t),!0)}return this.pull?.pin([t.x,t.y,t.z]),!1}end(){if(this.drag===null)return!1;const e=this.drag.moved;if(this.drag.solo&&this.drag.moved){const t=this.ports.meshes().get(this.drag.nodeId);t!==void 0&&this.returns.push({mesh:t,from:t.position.clone(),to:this.drag.home.clone(),startedAt:this.now()})}return this.pull?.release(),this.drag=null,e}step(){const e=this.now();let t=!1;return this.pull!==null&&(this.pull.step(this.drag!==null)?t=!0:this.pull=null),this.returns.length>0&&(this.returns=this.returns.filter(s=>{const i=Math.min(1,(e-s.startedAt)/300),r=i*i*(3-2*i);return s.mesh.position.lerpVectors(s.from,s.to,r),i<1}),t=!0),t}now(){return(this.ports.now??Date.now)()}simulation_begin(e){const t=this.ports.nodes(),s=pM(t),i=[...this.ports.meshes()].map(([a,o])=>({id:a,position:[o.position.x,o.position.y,o.position.z],radius:s.get(a)??Dt,dim:o.userData.dim===!0,halo:o.userData.halo===!0})),r=[];for(const a of t)for(const o of[...a.parentIds,...a.joinParentIds])r.push({from:o,to:a.id});this.pull=new iy({grabbed:e,nodes:i,edges:r,dimensions:this.ports.dimensions(),baseRadius:Dt})}}const ND=1500;class BD{ports;tip;hovered=null;tapTimer=null;constructor(e,t){this.ports=t,this.tip=document.createElement("div"),this.tip.className="dag-node-tip",this.tip.hidden=!0,e.appendChild(this.tip)}hide(){this.tip.hidden=!0}leave(e){if(this.hovered=null,e.pointerType==="touch"&&!this.tip.hidden){this.tapTimer!==null&&window.clearTimeout(this.tapTimer),this.tapTimer=window.setTimeout(()=>{this.tapTimer=null,this.ports.fingersDown()===0&&(this.tip.hidden=!0)},ND);return}this.tip.hidden=!0}hover(e){const t=this.ports.picker.node_under(e,this.ports.pressKind()==="touch"),s=t===null?void 0:this.ports.nodes().find(r=>r.id===t);if(s===void 0){this.tip.hidden=!0,this.ports.canvas.style.cursor="",this.hovered=null;return}this.hovered={id:s.id,x:e.clientX,y:e.clientY};const i=this.ports.canvas.getBoundingClientRect();this.tip.textContent=this.ports.words(s)??s.label,this.tip.style.left=`${e.clientX-i.left+14}px`,this.tip.style.top=`${e.clientY-i.top+10}px`,this.tip.hidden=!1,this.ports.canvas.style.cursor="pointer"}pick(e,t){const s=this.hovered,i=s!==null&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=6?s.id:this.ports.picker.node_under(e,this.ports.pressKind()==="touch");if(i===null){t==="select"&&this.ports.selected_get()!==null&&(this.ports.selected_set(null),this.ports.selection_paint(),this.ports.deselect?.());return}const r=this.ports.nodes().find(a=>a.id===i);r&&(t==="select"?(this.ports.selected_set(i),this.ports.census()||this.ports.selection_paint(),this.ports.select?.(r)):this.ports.activate?.(r))}}function CD(){return{running:new ke("#ff7700"),done:new ke("#ffeecc"),error:new ke("#ff2222"),template:new ke("#ffaa44"),unknown:new ke("#555555"),edge:new ke("#cc5500"),join:new ke("#ffcc99"),root:new ke("#6fbfae"),pulse:new ke("#48d8f0")}}class PD{container;handlers;paletteOf;ambient;renderer;scene;camera;group=new pa;picker;spheres=new LA(this.group);get meshes(){return this.spheres.map}starField=new PA(this.group);labels=new HA(this.group);tubes=new UA({parent:this.group,node:e=>this.tubeNode_of(e),sphere:e=>this.meshes.get(e),palette:()=>this.palette_read()});handoffField=new FA({spheres:this.spheres,stars:this.starField,tubes:this.tubes,look:e=>this.handoffLook_of(e)});censusField=new jA({parent:this.group,stars:this.starField,tubes:this.tubes,starsView:()=>({pixelRatio:window.devicePixelRatio,heightPx:this.renderer.domElement.height,fovDeg:this.camera.fov})});drawn=new _D({meshes:()=>this.meshes,stars:this.starField,census:this.censusField,group:this.group});flights=new xD({positions_get:()=>this.positions_get(),positions_seed:e=>this.positions_seed(e),graph_set:(e,t)=>this.graph_set(e,t),flyToFit:(e,t,s,i,r)=>this.camera_flyToFit(e,t,s,i,r),flyToward:(e,t,s,i)=>this.camera_flyToward(e,t,s,i),alive:()=>!this.disposed});hierarchy;wave;replay;grab;hover=null;rig;gestures=null;lastPositions=new Map;frozen=new Set;physicsOnce=void 0;census=!1;physics={...ni};graph={nodes:[]};drawMode="spheres";placedById=new Map;fits=0;strategy="ranked";selectedId=null;frameHandle=null;disposed=!1;projection="3d";flat=new bD;rebuildGen=0;slicing=!1;arrangement="galaxy";arrangementMemory=new Map;constructor(e,t={},s={}){this.container=e,this.handlers=t,this.paletteOf=s.palette??CD,this.hierarchy=new AD(s.layoutWorker,()=>this.rebuildGen),this.ambient=s.ambient===!0,this.renderer=new wA({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.domElement.classList.add("dag-scene-canvas"),this.scene=new Zv,this.camera=new Rs(50,1,.1,200),this.camera.position.set(0,0,14),this.rig=new JA(this.camera,this.group),this.picker=new oD(this.camera,this.group,this.renderer.domElement,{meshes:()=>this.meshes.values(),stars:()=>this.starField.list(),nebulae:()=>this.starField.nebulae(),census:()=>this.census&&this.censusField.drawn()?this.censusField:null},oM),this.wave=new ID({nodes:()=>this.graph.nodes,mesh:r=>this.meshes.get(r),census:()=>this.census&&this.censusField.drawn()?this.censusField:null,selected:()=>this.selectedId,ambient:this.ambient}),this.replay=new GD({stars:this.starField,redraw:()=>this.rebuild(!1,"hold"),...t.replay!==void 0?{moved:t.replay}:{}}),this.grab=new RD({picker:this.picker,camera:this.camera,group:this.group,meshes:()=>this.meshes,nodes:()=>this.graph.nodes,solo:()=>this.strategy==="ranked",dimensions:()=>this.projection==="2d"?2:3,spin_pause:()=>this.rig.spin_pause()}),this.scene.add(new yO(16777215,.9));const i=new wO(16777215,1.2);i.position.set(4,6,8),this.scene.add(i),this.scene.add(this.group),e.appendChild(this.renderer.domElement),this.size_fit(),this.ambient||(this.hover=this.pointer_wire(e)),new ResizeObserver(()=>this.size_fit()).observe(e),this.tick()}pointer_wire(e){const t=new BD(e,{picker:this.picker,canvas:this.renderer.domElement,nodes:()=>this.graph.nodes,pressKind:()=>this.gestures?.pressKind(),fingersDown:()=>this.gestures?.fingersDown()??0,words:s=>this.handlers.tip?.(s)??null,census:()=>this.census,selected_get:()=>this.selectedId,selected_set:s=>{this.selectedId=s},selection_paint:()=>this.selection_paint(),...this.handlers.select!==void 0?{select:this.handlers.select}:{},...this.handlers.activate!==void 0?{activate:this.handlers.activate}:{},...this.handlers.deselect!==void 0?{deselect:this.handlers.deselect}:{}});return this.gestures=new iD(this.renderer.domElement,this.rig,{grab_begin:s=>this.grab.begin(s),grab_move:s=>{this.grab.move(s)&&this.positions_sync()},grab_end:()=>this.grab.end(),hover:s=>t.hover(s),leave:s=>t.leave(s),tap:(s,i)=>t.pick(s,i),tip_hide:()=>t.hide(),gesture_end:()=>this.handlers.gesture_end?.()},{flat:()=>this.projection==="2d",untethered:()=>this.census}),t}tick(){this.disposed||(this.ambient?(this.rig.tumble_step(),this.wave.animate()):(this.rig.spin_step(!(this.gestures?.pointerOver()??!1)&&this.projection==="3d"&&!this.flat.active()),this.grab.step()&&this.positions_sync(),this.wave.animate(),this.rig.flight_step()),this.starField.scale_update(this.renderer.domElement.height,this.camera.fov),this.handoff_step(),this.replay.step(),this.tubes.frame(performance.now()),this.labels.declutter(this.camera),this.renderer.render(this.scene,this.camera),this.frameHandle=window.requestAnimationFrame(()=>this.tick()))}physics_set(e,t=!0){this.physics={...this.physics,...e},t&&this.rebuild()}physics_get(){return{...this.physics}}census_set(e){this.census!==e&&(this.census=e,this.rebuild(!0,"hold"))}census_get(){return this.census}graph_set(e,t={}){this.graph=e,this.flat.clear(),this.frozen=new Set(t.frozen??[]),this.physicsOnce=t.physics,this.rebuild(t.fit!==!1,t.settle??"full"),t.wave!==!1&&this.wave.start()}waveLoop_set(e){this.wave.loop_set(e)}waveLoop_get(){return this.wave.loop_get()}wave_start(){this.wave.start()}positions_get(){const e={};for(const[t,s]of this.lastPositions)e[t]=[Math.round(s.x*100)/100,Math.round(s.y*100)/100,Math.round(s.z*100)/100];return e}positions_seed(e){this.lastPositions=new Map(Object.entries(e).map(([t,[s,i,r]])=>[t,new W(s,i,r)]))}flight_into(e,t){if(this.rig.flying()||this.rig.holding_get())return;const s=this.drawn.diveTarget_of(e);s!==null&&this.rig.flyInto(s,t)}camera_flyToFit(e,t,s,i=1,r=1.15){this.rig.flyToFit(this.drawn.reaches_of(e),t,s,i,r)}camera_distance(){return this.rig.eyeDistance()}camera_touched(){return this.rig.touched_get()}moving(){return this.flights.moving()}frame(e,t,s=()=>{},i,r){this.flights.frame(e,t,s,i,r)}relight(e,t,s,i=()=>{},r){this.flights.relight(e,t,s,i,r)}unfold(e,t=()=>{}){this.flights.unfold(e,t)}descent(e,t,s=()=>{},i=()=>{}){this.flights.descent(e,t,s,i)}draw_set(e){e!==this.drawMode&&(this.drawMode=e,this.rebuild(!1,"hold"))}captions_set(e){this.labels.shown_set(e)}draw_get(){return this.drawMode}state_get(){const e=this.graph.nodes.filter(s=>s.solid===!0).map(s=>s.id),t=e.filter(s=>this.meshes.has(s)).length;return{draw:this.drawMode,arrangement:this.arrangement,captions:this.labels.shown_get()?this.labels.count():"off",known:this.lastPositions.size,census:this.census,nodes:this.graph.nodes.length,meshes:this.meshes.size,stars:this.starField.count(),solidMarked:e.length,solidDrawn:t,tubes:this.tubes.materialCount(),censusTubes:this.tubes.censusCount(),handoffGroups:this.handoffField.size(),handoffSolid:this.handoffField.solidCount(),camera:this.rig.eyeDistance().toFixed(1),settling:this.slicing}}camera_flyToward(e,t,s,i){const r=this.drawn.world_of(e);if(r===null){i();return}this.rig.flyToward(r,t,s,i)}holding_get(){return this.rig.holding_get()}flight_back(e){this.rig.flyBack(e)}strategy_set(e){this.strategy=e,this.rebuild()}selection_clear(){this.selectedId=null,this.selection_paint()}selection_paint(){this.spheres.select(this.selectedId)}strategy_get(){return this.strategy}projection_set(e){this.projection=e,e==="2d"&&this.group.quaternion.identity(),this.rebuild()}projection_get(){return this.projection}flat_set(e){this.flat.set(e,this.graph.nodes,this.lastPositions,{camera:this.camera,focus:this.rig.focus,world:this.group},this.physics)&&this.rebuild(!1,"hold")}flat_get(){return this.flat.active()}look_update(e,t){const s=this.graph.nodes.find(i=>i.id===e);s&&(s.look=t,this.spheres.recolor(e,Pr(t.paint,this.palette_read())),this.tubes.holds(e)&&this.tubes.stale_mark())}palette_read(){return this.paletteOf()}palette_refresh(){this.rebuild(!0,"hold")}size_fit(){const e=Math.max(1,this.container.clientWidth),t=Math.max(1,this.container.clientHeight);this.renderer.setSize(e,t,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}dispose(){this.disposed=!0,this.hierarchy.dispose(),this.frameHandle!==null&&window.cancelAnimationFrame(this.frameHandle),this.gestures?.detach(),this.renderer.dispose(),this.renderer.domElement.remove(),this.spheres.dispose()}arrangement_set(e,t,s=!0){if(e===this.arrangement)return;this.arrangementMemory.set(this.arrangement,new Map(this.lastPositions)),this.arrangement=e;let i=this.arrangementMemory.get(e);i===void 0&&t!==void 0&&Object.keys(t).length>0&&(i=new Map(Object.entries(t).map(([r,[a,o,l]])=>[r,new W(a,o,l)]))),this.lastPositions=i??new Map,s&&this.rebuild(!0,i===void 0?"full":"hold")}arrangement_get(){return this.arrangement}replay_begin(e,t=1){this.replay.begin(e,t)}replay_play(e){this.replay.play(e)}replay_pause(){this.replay.pause()}replay_seek(e){this.replay.seek(e)}replay_stop(){this.replay.stop()}replay_state(){return this.replay.state()}censusBuild(e,t,s=!0){const i=zD(e,t),r=this.censusField.build(i,this.drawMode==="stars",t),a=r.center,o=r.radius;!this.ambient&&s&&this.rig.frame(a,o,{stance:"threeQuarter",farScale:2.5})}camera_fit(e){if(e.length===0)return;this.rig.touch_clear(),this.fits+=1,this.renderer.domElement.dataset.fits=String(this.fits);const t=new W;for(const a of e)t.add(a.position);t.divideScalar(e.length);const s=e.map(a=>t.distanceTo(a.position)+a.radius).sort((a,o)=>a-o),i=this.handlers.handoffKey!==void 0?.95:1,r=Math.max(1,s[Math.max(0,Math.ceil(s.length*i)-1)]??1);this.rig.frame(t,r)}rebuild(e=!0,t="full"){const s=++this.rebuildGen;if(this.slicing&&(this.slicing=!1,this.handlers.progress?.(1,1,0)),this.strategy!=="molecule"){this.draw(fD(this.graph.nodes),e);return}let i=this.frozen;if(t!=="full"&&i.size===0){const l=this.graph.nodes.map(c=>c.id).filter(c=>this.lastPositions.has(c));l.length>0&&(i=new Set(l))}const r=mM(this.graph.nodes,this.projection==="2d"?2:3,this.lastPositions,this.physics_current(),i);if(r.moving===0){this.draw(r.place(),e);return}const a=this.handlers.progress,o=r.total*r.moving<uD;if((!o||this.arrangement!=="galaxy")&&a!==void 0&&this.handlers.handoffKey!==void 0&&this.frozen.size===0){this.hierarchy_run(s,e,i,a);return}if(a===void 0||o){r.step(r.total),this.draw(r.place(),e);return}this.settle_slice(r,s,e,a)}physics_current(){return this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics}settle_slice(e,t,s,i){const r=this.graph.nodes.length;let a=0;this.slicing=!0,i(0,e.total,r);const o=()=>{if(t!==this.rebuildGen||this.disposed)return;const l=performance.now();for(;a<e.total&&performance.now()-l<hD;)e.step(1),a+=1;if(a<e.total){i(a,e.total,r),window.requestAnimationFrame(o);return}this.slicing=!1,this.draw(e.place(),s),i(e.total,e.total,r)};window.requestAnimationFrame(o)}hierarchy_run(e,t,s,i){const r=this.handlers.handoffKey;r!==void 0&&(this.slicing=!0,this.hierarchy.run({generation:e,nodes:this.graph.nodes,keyOf:r,seeds:this.lastPositions,frozen:s,physics:this.physics_current(),arrangement:this.arrangement,progress:(a,o,l)=>{a===o&&(this.slicing=!1),i(a,o,l)},placed:a=>{this.slicing=!1,this.draw(a,t)}}))}draw(e,t){const s=this.drawn_clear(e);if(this.census){const c=e.filter(d=>d.node.solid===!0&&d.node.ghost!==!0);this.censusBuild(e.filter(d=>d.node.solid!==!0),s,t),c.length>0&&this.solid_draw(c,s);return}!this.ambient&&t&&this.camera_fit(e);const i=this.drawMode==="stars",r=i&&!this.replay.active()?this.handlers.handoffKey:void 0,a={spheres:this.spheres,labels:this.labels,stars:this.starField,handoff:this.handoffField,selected:this.selectedId,flat:this.projection==="2d",starring:i,handoffKey:r},o=mD(e,s,a);o.starred.length>0&&this.starField.draw(o.starred,window.devicePixelRatio,this.renderer.domElement.height,this.camera.fov);for(const c of e)this.placedById.set(c.node.id,c);if(r!==void 0){const c=new Map(this.graph.nodes.map(d=>[d.id,d]));this.handoffField.gather(o.starred,d=>{const u=c.get(d);return u===void 0?null:r(u)})}gD(e,o.byId,s,a);const l=e.filter(c=>c.node.ghost!==!0&&c.node.halo!==!0&&(i?c.node.solid===!0:c.node.dim!==!0)).map(c=>c.node.id);if(l.length>0){const c={tubes:null,mix:1};this.tubes.build(c,l,new Set(l))}this.replay.active()&&this.replay.paintAll()}drawn_clear(e){this.group.clear(),this.spheres.clear(),this.censusField.clear(),this.grab.clear(),this.starField.clear(),this.labels.clear(),this.handoffField.clear(),this.placedById=new Map,this.tubes.clear();const t=this.palette_read();if(this.wave.color=t.pulse,this.lastPositions=new Map(e.map(s=>[s.node.id,s.position.clone()])),this.projection==="2d")for(const s of e)s.position.z=0;return t}handoff_step(){if(this.handoffField.size()===0)return;const e=this.renderer.domElement.clientHeight||1;this.handoffField.step(vD(this.camera,this.group),OD(e,this.camera.fov),performance.now())}handoffLook_of(e){const t=this.placedById.get(e);return t===void 0?void 0:wD(t,this.palette_read())}tubeNode_of(e){const t=this.placedById.get(e);return t===void 0?void 0:yD(t)}positions_sync(){for(const{id:e,position:t}of this.grab.positions())this.meshes.get(e)?.position.set(...t),this.lastPositions.set(e,new W(...t));this.tubes.follow(),this.spheres.edges_follow()}solid_draw(e,t){for(const r of e)this.placedById.set(r.node.id,r),this.spheres.sphere_add(r.node.id,r.position,r.radius,{color:Pr(r.node.look.paint,t)});const s=e.map(r=>r.node.id),i={tubes:null,mix:1};this.tubes.build(i,s,new Set(s))}}const gM=new Set(["created","waiting","scheduled","started","registeringFiles"]);function LD(n){return n.status!==void 0&&gM.has(n.status)?"live":n.status==="finishedWithError"||n.share!==void 0&&n.share>=1?"failed":n.status==="finishedSuccessfully"||n.share!==void 0&&n.status!==void 0?"done":"rest"}function WD(n){return n.share!==void 0&&n.status!=="cancelled"?n.share>=1?{token:"error"}:{blend:["done","error"],share:Math.sqrt(Math.max(0,n.share))}:n.status==="finishedWithError"||n.status==="cancelled"?{token:"error"}:n.hue!==void 0?{hue:n.hue}:n.parentIds.length===0&&n.joinParentIds.length===0?{token:"root"}:n.status===void 0?{token:"template"}:n.status==="finishedSuccessfully"?{token:"done"}:gM.has(n.status)?{token:"running"}:{token:"unknown"}}function Sp(n){return{state:LD(n),paint:WD(n),ember:n.share!==void 0&&n.share>0||n.status==="finishedWithError",waved:n.status===void 0||n.status==="finishedSuccessfully"||n.status==="finishedWithError"}}function kD(){const n=getComputedStyle(document.documentElement),e=(t,s)=>new ke(n.getPropertyValue(t).trim()||s);return{running:e("--orange","#f70"),done:e("--butter","#fec"),error:new ke("#f22"),template:e("--harvestgold","#fa4"),unknown:new ke("#555"),edge:e("--pumpkin-pie","#c50"),join:e("--honey","#fc9"),root:e("--dag-root","#6fbfae"),pulse:e("--dag-pulse","#48d8f0")}}class xl extends PD{byId=new Map;constructor(e,t={},s={}){const i={palette:kD,layoutWorker:()=>new Worker(new URL(""+new URL("layoutWorker-CfJVM55D.js",import.meta.url).href,import.meta.url),{type:"module"})};s.ambient!==void 0&&(i.ambient=s.ambient),super(e,t,i)}graph_set(e,t={}){const s=e.nodes.map(i=>Object.assign(i,{look:Sp(i)}));this.byId=new Map(s.map(i=>[i.id,i])),super.graph_set({nodes:s},t)}relight(e,t,s,i,r){super.relight(e,t,s,i,r)}unfold(e,t){super.unfold(e,t)}descent(e,t,s,i){super.descent(e,t,s,i)}status_update(e,t){const s=this.byId.get(e);s===void 0||s.status===t||(s.status=t,this.look_update(e,Sp(s)))}}function Ep(n){if(n.jobsTotal===void 0||n.jobsDone===void 0)return null;const e=n.status==="finishedWithError"||n.status==="cancelled",t=n.jobsErrored===void 0?void 0:n.jobsDone-n.jobsErrored;return{done:n.jobsDone,total:n.jobsTotal,...e?{failed:!0}:{},...t!==void 0?{succeeded:t}:{}}}function UD(n){const e=n.title||"(untitled)",t=n.tags??[];if(t.length===0)return e;const s=document.createElement("span");s.className="feedlist-title feedlist-titled";const i=document.createElement("span");i.className="feedlist-title-text",i.textContent=e,s.append(i);for(const r of t){const a=document.createElement("span");a.className="feedlist-tag",a.dataset.tag=r,a.title=`tag:${r} — press to filter the roster by it`,a.textContent=`#${r}`;const o=document.createElement("span");o.className="feedlist-tag-x",o.title=`take ${r} off this feed (setfattr -x)`,o.textContent="×",a.append(o),s.append(a)}return s}const FD=[{key:"control",label:"",className:"feedlist-control",capped:!1,width:"5.2em",cell:()=>{const n=document.createElement("span");return n.className="feedlist-control listing-capsule",n.textContent="OPEN",n}},{key:"id",label:"ID",className:"feedlist-id",width:"4em",cell:n=>String(n.id),compare:n=>n.id},{key:"title",label:"TITLE",className:"feedlist-title",width:"minmax(12em, 24em)",cell:n=>UD(n),compare:n=>n.title},{key:"progress",label:"PROGRESS",className:"feedlist-progress",width:"minmax(8em, 1fr)",cell:n=>qo(Ep(n)),compare:n=>{const e=Ep(n);return e===null||e.total===0?-1:e.done/e.total}},{key:"status",label:"STATUS",className:"feedlist-status",width:"8em",cell:n=>n.status.toUpperCase(),compare:n=>n.status},{key:"nodes",label:"NODES",className:"feedlist-nodes",width:"4em",cell:n=>n.jobsTotal===void 0?"—":String(n.jobsTotal),compare:n=>n.jobsTotal??-1},{key:"sizeBytes",label:"SIZE",className:"feedlist-size",width:"5.5em",cell:n=>n.sizeBytes===void 0?"—":bM(n.sizeBytes),compare:n=>n.sizeBytes??-1},{key:"wallSeconds",label:"TIME",className:"feedlist-time",width:"6em",cell:n=>n.wallSeconds===void 0?"—":MM(n.wallSeconds),compare:n=>n.wallSeconds??-1},{key:"owner",label:"OWNER",className:"feedlist-owner",width:"7em",cell:n=>n.owner},{key:"createdAt",label:"CREATED",className:"feedlist-created",width:"7em",cell:n=>n.createdAt.slice(0,10),compare:n=>n.createdAt}];function MM(n){const e=Math.round(n);return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${String(e%60).padStart(2,"0")}s`:`${Math.floor(e/3600)}h ${String(Math.floor(e%3600/60)).padStart(2,"0")}m`}function bM(n){if(n<1024)return`${n}B`;const e=["K","M","G","T"];let t=n,s=-1;for(;t>=1024&&s<e.length-1;)t=t/1024,s=s+1;return`${t<10?t.toFixed(1):Math.round(t)}${e[s]}`}class jD{notePill;tagPill;renamePill;marks;handlers;readFeedId=null;tags=[];constructor(e,t){this.handlers=t,this.notePill=e?.querySelector(".dag-note")??null,this.tagPill=e?.querySelector(".dag-tag")??null,this.renamePill=e?.querySelector(".dag-rename")??null,this.marks=e?.querySelector(".dag-marks")??null;const s=(i,r)=>{i?.addEventListener("click",()=>{const a=t.shown();a!==null&&r(a)})};s(this.notePill,i=>t.feed_note?.(i)),s(this.tagPill,i=>t.feed_tag?.(i,this.tags)),s(this.renamePill,i=>t.feed_rename?.(i,t.name()))}shown_set(e){for(const t of[this.notePill,this.tagPill,this.renamePill,this.marks])t!==null&&(t.hidden=!e);e||(this.readFeedId=null)}arrived(e){this.readFeedId!==e&&this.refresh()}refresh(){const e=this.handlers.shown();e!==null&&(this.readFeedId=e,this.handlers.feed_entered?.(e))}show(e,t){if(e!==this.handlers.shown()||this.marks===null)return;t.title!==void 0&&t.title!==""&&this.handlers.renamed(e,t.title),this.tags=[...t.tags];const s=(t.note??"").trim();this.notePill!==null&&(this.notePill.textContent=t.note===null?"NOTE":s===""?"ADD NOTE":"EDIT NOTE"),this.marks.replaceChildren();for(const i of t.tags){const r=document.createElement("span");r.className="feedlist-tag dag-mark",r.dataset.tag=i,r.textContent=`#${i}`;const a=document.createElement("span");a.className="feedlist-tag-x",a.title=`take ${i} off this feed (setfattr -x)`,a.textContent="×",a.addEventListener("click",()=>this.handlers.feed_untag?.(e,i)),r.append(a),this.marks.append(r)}if(s!==""){const i=document.createElement("span");i.className="dag-note-line",i.textContent=s.split(`
4237
4237
  `)[0]??"",i.title=s,this.marks.append(i)}}}class $D{abandoned=null;pick(e,t){this.abandoned=e!==null&&e!==t?e:null}drops(e,t){return this.abandoned!==e||t===null||t===e?!1:(this.abandoned=null,!0)}}function VD(n){return(n.replace(/\[[0-9;]*m/g,"").split(`
4238
4238
  `).find(s=>s.trim().length>0)?.trim()??"").replace(/\s*\((?:[\d,]+\/[\d,]+(?:,\s*\d+%)?|initializing)\)(?=\.?$)/,"")}const Ap="#555";function _M(n,e){return e==="time"?n.metrics?.computeSeconds:n.metrics?.dataBytes}function HD(n,e){const t=new Map;for(const s of n.nodes){const i=s.computeResource;i===void 0||i==="mixed"||t.has(i)||t.set(i,e[t.size%Math.max(1,e.length)]??"#888")}return t}function qD(n,e,t,s){const i=r=>{if(t==="compute")return r.computeResource===void 0?Ap:s.get(r.computeResource)??Ap};return{nodes:n.nodes.map(r=>{const a=i(r);return{id:r.id,label:r.label,parentIds:r.parentIds,joinParentIds:r.joinParentIds,status:r.status,metric:_M(r,e),count:r.tally?.count,...a!==void 0?{hue:a}:{}}})}}function xc(n,e){const t=Xc(n);if(t===null)return null;let s=0,i=0,r=0;for(const o of e.all()){const l=o.groups.filter(c=>c.plugin===t);if(l.length!==0){s+=1;for(const c of l)i+=c.count,r+=c.errored}}const a=i===0?0:Math.round(r/i*100);return`${t} · ${s.toLocaleString("en-US")} feed${s===1?"":"s"} · ${a}% errored`}class zM{byId=new Map;take(e){let t=!1;for(const s of e){const i=this.byId.get(s.id);i!==void 0&&i.status===s.status&&i.jobs===s.jobs&&JSON.stringify(i.groups)===JSON.stringify(s.groups)||(this.byId.set(s.id,{...s,chain:[...s.chain],groups:s.groups.map(r=>({...r}))}),t=!0)}return t}size(){return this.byId.size}shapes(){return new Set([...this.byId.values()].map(as)).size}all(){return[...this.byId.values()]}get(e){return this.byId.get(e)}clear(){this.byId.clear()}}function wM(n,e){const t=n.match(/^feed:(\d+):(\d+)$/);if(t===null)return null;const s=e.get(Number(t[1])),i=s?.groups[Number(t[2])];if(s===void 0||i===void 0)return null;const r=i.count>1?` ×${i.count.toLocaleString("en-US")}`:"",a=s.title.length>0?` · ${s.title}`:"",o=i.errored>0&&i.count>1?`${i.errored.toLocaleString("en-US")} errored`:i.status;return`${i.plugin}${r} · ${o} · feed ${s.id}${a}`}function XD(n,e){return`argus.universe.${n}@${e}`}const Vn={draw:"stars",view:"feeds",scale:"jobs",density:"shape",arrangement:"galaxy",captions:!0};function KD(n,e,t,s,i=Vn.arrangement,r=Vn.captions){return{draw:n,view:e,scale:t,density:s,arrangement:i,captions:r}}function YD(n){let e={};try{const s=n===null?null:JSON.parse(n);s!==null&&typeof s=="object"&&!Array.isArray(s)&&(e=s)}catch{}const t=(s,i,r)=>typeof s=="string"&&i.includes(s)?s:r;return{draw:t(e.draw,["stars","spheres"],Vn.draw),view:t(e.view,["feeds","shapes"],Vn.view),scale:t(e.scale,["jobs","feeds"],Vn.scale),density:t(e.density,["shape","census"],Vn.density),arrangement:t(e.arrangement,["galaxy","spokes","clumps","constellations","data","accretion"],Vn.arrangement),captions:typeof e.captions=="boolean"?e.captions:Vn.captions}}function Dp(n){if(n===null||n.length===0)return{};try{const e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[s,i]of Object.entries(e))Array.isArray(i)&&i.length===3&&i.every(r=>typeof r=="number"&&Number.isFinite(r))&&(t[s]=[i[0],i[1],i[2]]);return t}catch{return{}}}function Sc(n,e){return`inst:${n}:${e}`}function ZD(n){const e=new Set(n.nodes.map(i=>i.id)),t=[],s=new Map;for(const i of n.nodes){const r=Sc(n.feedId,i.id),a=i.parentIds.filter(d=>e.has(d)).map(d=>Sc(n.feedId,d)),o=i.tally?.count??1,l=i.tally?.error??(i.status==="finishedWithError"?1:0),c=l>0&&o>0?Math.min(1,l/o):void 0;t.push({id:r,label:i.pluginName,parentIds:a,joinParentIds:i.joinParentIds.filter(d=>e.has(d)).map(d=>Sc(n.feedId,d)),status:i.status,metric:Ar(o),...o>1?{count:o}:{},...c!==void 0?{share:c}:{}}),s.set(r,i)}return{nodes:t,payloads:s}}function QD(n,e,t,s="jobs",i=!1,r){const a=r??(i?cu(n,s):Aa(n,s)),o=`feed:${e}:`;return{nodes:[...a.nodes.filter(c=>!c.id.startsWith(o)).map(c=>({...c,dim:!0})),...t.nodes]}}function yM(n,e){return e.groups.map((t,s)=>Kn(n,s))}function vM(n,e=3){const t=hl(n).split(" > ");return t.length<=e?t.join(" > "):`${t.slice(0,e).join(" > ")} … +${t.length-e}`}function JD(n,e){if(!n.startsWith("shape:"))return null;const t=n.slice(6),s=e.all().filter(i=>as(i)===t).length;return`${hl(t)} · ${s} feed${s===1?"":"s"}`}function eT(n,e){const t=[];for(const s of e.all())as(s)===n&&t.push(...yM(s.id,s));return t}function tT(n,e,t="jobs"){const s=Aa(n,t),i=new Set(n.filter(a=>as(a)===e).map(a=>a.id));return{nodes:s.nodes.map(a=>{if(a.ghost===!0)return a.id===Cm(e)?a:{...a,dim:!0};const o=a.id.match(/^feed:(\d+):/);return o!==null&&i.has(Number(o[1]))?a:{...a,dim:!0}})}}function OM(n,e="jobs"){const t=new Map;for(const i of[...n].sort((r,a)=>r.id-a.id)){if(i.groups.length===0)continue;const r=as(i),a=t.get(r)??[];a.push(i),t.set(r,a)}const s=[];for(const[i,r]of t)r[0].groups.forEach((o,l)=>{let c=0,d=0;for(const h of r){const p=h.groups[l];p!==void 0&&(c+=p.count,p.errored>0&&(d+=1))}const u=d>0?Math.min(1,d/r.length):void 0;s.push({id:Qc(i,l),label:o.plugin,parentIds:o.parent===null?[]:[Qc(i,o.parent)],joinParentIds:[],status:d===r.length?"finishedWithError":"finishedSuccessfully",metric:Ar(e==="feeds"?r.length:c),...r.length>1?{count:r.length}:{},...u!==void 0?{share:u}:{}})});return{nodes:s}}function sT(n,e){const t=n.match(/^fold:(.+):(\d+)$/);if(t===null)return null;const s=t[1],i=Number(t[2]),r=e.all().filter(d=>as(d)===s),a=r[0]?.groups[i]?.plugin;if(a===void 0)return null;const o=r.filter(d=>(d.groups[i]?.errored??0)>0).length,l=`${r.length.toLocaleString("en-US")} feed${r.length===1?"":"s"}`,c=o>0?` · ${o.toLocaleString("en-US")} with errors`:"";return`${a} · ${l}${c} · ${vM(s)}`}function Tp(n,e){const t=e.all().find(s=>as(s)===n);return t===void 0?[]:t.groups.map((s,i)=>Qc(n,i))}function Ip(n,e,t="jobs"){const s=n.filter(l=>as(l)===e),i=n.filter(l=>as(l)!==e),r=OM(i,t),a=Aa(s,t),o=a.nodes.filter(l=>l.ghost!==!0).map(l=>l.id);return{graph:{nodes:[...r.nodes.map(l=>({...l,dim:!0})),...a.nodes]},memberIds:o}}const nT=6e4,Gp=1e4,iT=new Set(["running","scheduled","created","started"]),rT=[/\/proc\/jobs\/feed_(\d+)(?:\/|$)/,/\/feeds?\/feed_(\d+)(?:\/|$)/];function aT(n){const e=[];return n.layout==="molecule"&&e.push("dag layout molecule"),n.projection==="2d"&&e.push("dag projection 2d"),n.scale==="size"&&e.push("dag scale size"),n.hue==="compute"&&e.push("dag hue compute"),n.census==="census"&&e.push("dag census"),e}const oT={running:"started",done:"finishedSuccessfully",error:"finishedWithError"};function Rp(n,e){return n.nodes.length===e.nodes.length&&e.nodes.every((t,s)=>{const i=n.nodes[s];return i!==void 0&&i.id===t.id&&(i.tally?.count??1)===(t.tally?.count??1)&&i.parentIds.length===t.parentIds.length&&i.joinParentIds.length===t.joinParentIds.length})}class lT{scene;canvas;title;facts;empty;strategyPill;backPill=null;feedFrame;feedList;handlers;rosterTimer=null;shownFeedId=null;pinnedFeedId=null;requestedFeedId=null;follow=new $D;defaultTitle;metricMode="time";lastModel=null;lastRoster=[];arrivals=new Set;arrivalsKey="";listing;stateSpan;watchedFeedId=null;liveState=null;pendingFeedId=null;lastCwd=null;constructor(e,t,s,i,r,a,o){this.feedList=a,this.canvas=e,e.style.display="none",this.title=t,this.defaultTitle=t.textContent??"",this.facts=s,this.empty=i,this.strategyPill=r,this.handlers=o;const l=r.closest(".pane-dag");this.stateSpan=l?.querySelector(".pane-state")??null,this.modeSpan=l?.querySelector(".pane-mode")??null;const c=o.feed_verbs;this.listing=new si({mount:this.feedList,traits:FD,key:m=>String(m.id),chrome:l===null?void 0:{root:l,prefix:"runs"},actions:c===void 0?void 0:{of:m=>c(m)},control:"control",terms:[{key:"tag",value:m=>(m.tags??[]).join(" ")}],activate:m=>this.feed_activate(m),indicated:m=>this.handlers.feed_indicated?.(m),row:{className:m=>`feedlist-row feedlist-${m.status}${this.arrivals.has(m.id)?" feedlist-arrived":""}`,decorate:(m,z)=>{m.dataset.feed=String(z.id),m.title=c===void 0?"enter the feed (Esc returns to this list)":"click to indicate, double-click to enter (Esc returns to this list)"}},state:m=>this.canvas.style.display==="block"?null:m.filter,defaultSort:{key:"createdAt",dir:"desc"}}),this.feedList.addEventListener("click",m=>this.tagMark_press(m),{capture:!0}),this.feedList.addEventListener("dblclick",m=>{m.target instanceof Element&&m.target.closest(".feedlist-tag")!==null&&m.stopPropagation()},{capture:!0}),this.rosterTimer=setInterval(()=>{if(!this.feedList.isConnected||!this.rosterShown||this.rosterPending||document.visibilityState!=="visible")return;const z=this.lastRoster.some(w=>iT.has(w.status))?Gp:nT;Date.now()-this.rosterAskedAt<z||(this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds"))},Gp),this.scene=new xl(e,{select:m=>this.facts_show(m),activate:m=>this.node_activate(m),deselect:()=>this.facts.replaceChildren(),tip:m=>this.universeShown?wM(m.id,this.landed):null}),r.addEventListener("click",()=>{const m=this.scene.strategy_get()==="ranked"?"molecule":"ranked";this.scene.strategy_set(m),r.textContent=m.toUpperCase(),this.modes_render()}),this.backPill=r.parentElement?.querySelector(".dag-back")??null,this.feedFrame=new jD(r.parentElement,{...o,shown:()=>this.shownFeedId,name:()=>this.lastModel?.feedName??"",renamed:(m,z)=>{this.lastModel!==null&&(this.lastModel={...this.lastModel,feedName:z}),this.title.textContent=`DAG · FEED ${m} — ${z}`.toUpperCase()}}),this.backPill?.addEventListener("click",()=>{this.nav_pop()||this.feedsChooser_request()}),this.facts.addEventListener("click",m=>{m.target instanceof Element&&m.target.closest("button, a, input")===null&&(this.facts.classList.contains("dag-facts-immersed")||(this.scene.selection_clear(),this.factsShown=null,this.facts.replaceChildren()))});const d=r.parentElement?.querySelector(".dag-projection")??null;d?.addEventListener("click",()=>{const m=this.scene.projection_get()==="3d"?"2d":"3d";this.scene.projection_set(m),d.textContent=m.toUpperCase(),this.modes_render()});const u=r.parentElement?.querySelector(".dag-pulse")??null;u?.classList.add("rail-off"),u?.addEventListener("click",()=>{const m=!this.scene.waveLoop_get();this.scene.waveLoop_set(m),u.textContent=m?"PULSE ON":"PULSE OFF",u.classList.toggle("rail-off",!m),this.modes_render()});const h=r.parentElement?.querySelector(".dag-scale")??null;h?.addEventListener("click",()=>{this.metricMode=this.metricMode==="time"?"size":"time",h.textContent=this.metricMode==="time"?"TIME":"SIZE",this.lastModel!==null&&this.graph_show(this.lastModel,!1),this.modes_render()}),this.scalePill=h;const p=r.parentElement?.querySelector(".dag-census")??null;p?.addEventListener("click",()=>{const m=!this.scene.census_get();this.scene.census_set(m),p.textContent=m?"CENSUS":"SHAPE",this.modes_render()});const f=r.parentElement?.querySelector(".dag-gravity")??null;f?.classList.add("rail-off"),f?.addEventListener("click",()=>{const m=!this.scene.physics_get().gravity;this.scene.physics_set({gravity:m}),f.textContent=m?"GRAVITY ON":"GRAVITY OFF",f.classList.toggle("rail-off",!m),this.modes_render()});const b=r.parentElement?.querySelector(".dag-hue")??null;b?.addEventListener("click",()=>{this.hueMode=this.hueMode==="status"?"compute":"status",b.textContent=this.hueMode.toUpperCase(),this.lastModel!==null&&this.graph_show(this.lastModel,!1),this.hueMode==="compute"&&!this.computeKnown&&this.shownFeedId!==null&&this.canvas.style.display!=="none"&&(this.computeRereading=!0,this.handlers.command_run(`proc refresh ${this.shownFeedId}`),this.refresh()),this.modes_render()}),this.huePill=b,r.closest(".pane-dag")?.addEventListener("argus:dag-physics",m=>{const z=m.detail;if(z==="reset"){this.scene.physics_set({charge:!0,link:!0,collide:!0});return}if(z.term==="gravity"){this.scene.physics_get().gravity!==z.on&&f?.click();return}this.scene.physics_set({[z.term]:z.on})}),new MutationObserver(()=>this.scene.palette_refresh()).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("resize",()=>this.scene.size_fit()),new MutationObserver(()=>{window.setTimeout(()=>this.scene.size_fit(),600)}).observe(document.body,{attributes:!0,attributeFilter:["data-zoom"]})}envelope_observe(e){if(e.model?.kind===Gm){const t=Im.safeParse(e.model.data);t.success&&this.universe_show(t.data);return}if(e.model?.kind===Tm){const t=this.rosterPending||this.rosterShown;this.rosterPending=!1;const s=Dm.safeParse(e.model.data);s.success&&(t||this.canvas.style.display==="none")&&(this.universe_end(!0),this.chooser_show(s.data.feeds));return}if(this.pendingFeedId!==null&&e.status==="error"&&e.model===void 0){this.feedRequest_refuse(e.renderedErr??e.rendered??"");return}if(this.rosterPending&&e.status==="error"){this.rosterPending=!1,this.rosterRefusal_show(e),this.universe_request();return}if(e.model?.kind===Xn.feedIndexing){this.feedIndexing_take(e.model.data);return}e.model?.kind===Xn.feedDag&&this.feedDag_take(e.model.data)}feedIndexing_take(e){const t=j_.safeParse(e);!t.success||this.follow.drops(t.data.feedId,this.pinnedFeedId)||(this.requestedFeedId===t.data.feedId?this.requestedFeedId=null:this.pendingFeedId!==t.data.feedId&&(this.pinnedFeedId=t.data.feedId,this.pendingFeedId=t.data.feedId),this.feedIndexing_show(t.data))}feedDag_take(e){const t=Hc.safeParse(e);if(!t.success)return;const s=t.data;if(this.follow.drops(s.feedId,this.pinnedFeedId))return;this.requestedFeedId===s.feedId?this.requestedFeedId=null:this.pinnedFeedId=s.feedId,this.universe_end(!1),this.shownFeedId=s.feedId,this.pendingFeedId=null,this.listing.activation_settle(),_r(this.stateSpan,"wait"),this.title.textContent=`DAG · FEED ${s.feedId} — ${s.feedName}`.toUpperCase(),this.empty.style.display="none",this.roster_show(!1),this.canvas.style.display="block",this.lastModel!==null&&this.lastModel.feedId!==s.feedId&&(this.facts.replaceChildren(),this.scene.selection_clear());const i=this.lastModel;this.lastModel=s,i!==null&&i.feedId===s.feedId&&Rp(i,s)?this.statuses_patch(s):this.graph_show(s),this.watch_open(s.feedId),this.feedFrame.arrived(s.feedId),this.handlers.feed_shown?.()}marks_refresh(){this.feedFrame.refresh()}feedMarks_show(e,t){this.feedFrame.show(e,t)}watch_open(e){this.watchedFeedId!==e&&(this.watch_release(),this.watchedFeedId=e,this.liveState_show(null),this.handlers.watch_set?.(`/proc/jobs/feed_${e}`,!0))}watch_release(){this.watchedFeedId!==null&&(this.handlers.watch_set?.(`/proc/jobs/feed_${this.watchedFeedId}`,!1),this.watchedFeedId=null,this.liveState_show(null))}modeSpan=null;hueMode="status";huePill=null;hueLegend=new Map;computeKnown=!1;computeRereading=!1;hueLegend_build(e){const t=getComputedStyle(document.documentElement),s=["--harvestgold","--daybreak","--orange","--honey","--butter","--october-sunset"].map(i=>t.getPropertyValue(i).trim()).filter(i=>i!=="");return HD(e,s)}modes_render(){if(this.modeSpan===null)return;const e=[];if(this.scene.strategy_get()!=="ranked"&&e.push("MOLECULE"),this.scene.projection_get()!=="3d"&&e.push("2D"),this.metricMode!=="time"&&e.push("SIZE"),this.scene.census_get()&&e.push("CENSUS"),this.scene.waveLoop_get()&&e.push("PULSE"),this.scene.physics_get().gravity&&e.push("GRAVITY"),this.modeSpan.replaceChildren(document.createTextNode(e.join(" · "))),this.hueMode==="compute"){const t=document.createElement("span");t.className="pane-legend",t.append(document.createTextNode(e.length>0?" · COMPUTE":"COMPUTE"));for(const[s,i]of this.hueLegend){const r=document.createElement("span");r.className="legend-swatch",r.style.backgroundColor=i;const a=document.createElement("span");a.textContent=s,t.append(document.createTextNode(" "),r,a)}this.hueLegend.size===0&&t.append(document.createTextNode(this.computeRereading?" (re-reading the feed…)":" (none reported)")),this.modeSpan.appendChild(t)}}liveState_show(e){if(this.liveState=e,this.stateSpan!==null){if(e===null){Jt(this.stateSpan,null,this.canvas.style.display!=="none"?"":void 0);return}Jt(this.stateSpan,e,e.toUpperCase())}}liveState_get(){return this.liveState}feed_get(){return this.pendingFeedId??this.shownFeedId}graph_isShown(){return this.canvas.style.display==="block"}feedTitle_get(){return(this.title.textContent??"").replace(/^DAG\s*·\s*/i,"").trim()}view_lines(){const e=this.strategyPill.parentElement,t=s=>e?.querySelector(s)?.textContent?.trim().toLowerCase()??"";return aT({layout:t(".dag-strategy"),projection:t(".dag-projection"),scale:t(".dag-scale"),hue:t(".dag-hue"),census:t(".dag-census")})}watched_observe(e,t){const s=/feed_(\d+)$/.exec(e);!s||Number(s[1])!==this.watchedFeedId||this.liveState_show(t)}model_refresh(e){if(this.pendingFeedId===e.feedId&&this.canvas.style.display==="none"){this.envelope_observe({status:"ok",rendered:"",model:{kind:Xn.feedDag,data:e}});return}if(this.shownFeedId!==e.feedId||this.canvas.style.display==="none")return;const t=this.lastModel;if(this.lastModel=e,t!==null&&Rp(t,e)){this.statuses_patch(e);return}this.graph_show(e,!1)}statuses_patch(e){for(const t of e.nodes)this.scene.status_update(t.id,t.status),this.factsPayloads.set(t.id,t);this.factsShown!==null&&this.facts_show(this.factsShown)}refresh(){this.shownFeedId===null||this.canvas.style.display==="none"||(this.requestedFeedId=this.shownFeedId,this.handlers.command_run(`feed diagram feed_${this.shownFeedId}`))}scalePill=null;graph_show(e,t=!0){const s=e.nodes.some(r=>_M(r,this.metricMode)!==void 0);this.scalePill?.classList.toggle("rail-na",!s),this.scalePill!==null&&(this.scalePill.title=s?"molecule node size: wall time or output bytes":`no ${this.metricMode==="time"?"wall-time":"output-size"} data in this feed's cache yet`),this.hueLegend=this.hueLegend_build(e);const i=e.nodes.some(r=>r.computeResource!==void 0);this.computeKnown=i,i&&(this.computeRereading=!1),this.huePill?.classList.toggle("rail-na",!i),this.huePill!==null&&(this.huePill.title=i?"what colors a node: its status, or the compute resource it ran on":"no compute resource reported for this feed's nodes yet"),this.scene.graph_set(qD(e,this.metricMode,this.hueMode,this.hueLegend),{wave:t}),this.scene.size_fit(),this.hueMode==="compute"&&this.modes_render(),this.factsPayloads.clear();for(const r of e.nodes)this.factsPayloads.set(r.id,r);this.factsShown!==null&&(this.factsPayloads.has(this.factsShown.id)?this.facts_show(this.factsShown):this.factsShown=null)}factsPayloads=new Map;factsShown=null;promptContext_observe(e){const t=e.procWarmup?.landed??[];if(t.length>0&&this.universeLandings_take(t),this.universeShown&&this.universeLive){const o=e.procWarmup;if(o?.total!==void 0&&o.total>0&&o.sweeping!==!1){const l=Math.floor(o.loaded/o.total*100),c=`INDEX WARMING ${o.loaded.toLocaleString()}/${o.total.toLocaleString()} (${l}%)`;c!==this.universeWarming&&(this.universeWarming=c,this.universeTitle_paint())}else(o===void 0||o.sweeping===!1||o.state==="cached")&&(this.universeLive=!1,this.universeWarming="",this.universe_request())}if(this.rosterProgress!==null&&this.rosterProgress.isConnected){const o=e.procWarmup;if(o?.total!==void 0&&o.total>0&&o.sweeping!==!1){const l=Math.floor(o.loaded/o.total*100);this.rosterProgress.textContent=`INDEX WARMING — ${o.loaded}/${o.total} (${l}%). The roster opens when the index is whole.`}(o===void 0||o.sweeping===!1||o.state==="cached")&&(this.rosterProgress=null,this.feedsChooser_request())}this.arrivals_observe(e.procWarmup?.arrived??[]);const i=(e.procWarmup?.feeds??(e.procWarmup?.feed!==void 0?[e.procWarmup.feed]:[])).find(o=>o.id===this.pendingFeedId);i!==void 0&&this.feedIndexing_show({feedId:i.id,loaded:i.loaded,total:i.total,...i.failed!==void 0?{failed:i.failed}:{}});const r=this.lastCwd!==null&&e.cwd!==this.lastCwd;if(this.lastCwd=e.cwd,!this.canvas.isConnected||this.rosterShown||this.pendingFeedId!==null||!r)return;const a=dT(e.cwd);a!==null&&a!==this.shownFeedId&&(this.pinnedFeedId!==null&&a===this.pinnedFeedId||(this.pinnedFeedId=null,this.requestedFeedId=a,this.handlers.command_run(`feed diagram feed_${a}`)))}progress_observe(e){if(e.itemId===void 0)return;const t=e.status!==void 0?oT[e.status]:void 0;t!==void 0&&this.scene.status_update(String(e.itemId),t)}size_fit(){this.scene.size_fit()}dispose(){this.watch_release(),this.rosterTimer!==null&&clearInterval(this.rosterTimer),this.scene.dispose()}feed_enter(e){this.follow.pick(this.requestedFeedId,e),this.pinnedFeedId=e,this.requestedFeedId=null,this.feedRequest_show(e),this.handlers.command_run(`feed diagram feed_${e}`)}feedRequest_show(e){this.pendingFeedId=e,this.roster_show(!1),this.canvas.style.display="none",this.facts.replaceChildren(),this.title.textContent=`DAG · FEED ${e}`,this.empty.textContent=`RETRIEVING FEED ${e}…`,this.empty.style.display="block",Jt(this.stateSpan,"wait","LOADING")}feedIndexing_show(e){this.pendingFeedId===null&&(this.pendingFeedId=e.feedId),this.roster_show(!1),this.canvas.style.display="none",this.title.textContent=`DAG · FEED ${e.feedId}`;const t=e.total>0?`${e.loaded.toLocaleString()} / ${e.total.toLocaleString()}`:`${e.loaded.toLocaleString()} / ?`;this.empty.textContent=e.failed!==void 0?`INDEXING FEED ${e.feedId} FAILED AT ${t} — ${e.failed.toUpperCase()} — REFRESH RETRIES`:`INDEXING FEED ${e.feedId} — ${t}`,this.empty.style.display="block",Jt(this.stateSpan,"wait",e.failed!==void 0?"FAILED":"LOADING"),e.failed===void 0&&this.watch_open(e.feedId)}feedRequest_refuse(e){const t=this.pendingFeedId;this.pendingFeedId=null,this.listing.activation_settle(),this.empty.textContent=`FEED ${t??"?"}: ${e.trim()||"not available"}`.toUpperCase(),this.empty.style.display="block",this.roster_show(!0),this.title.textContent=this.defaultTitle,_r(this.stateSpan,"wait"),this.listing.state_refresh()}feedsChooser_request(){const e=document.createElement("div");e.className="feedlist-loading",e.textContent="RETRIEVING FEED ROSTER…",this.feedList.replaceChildren(e),this.canvas.style.display!=="none"&&this.graph_leave(),this.roster_show(!0),this.rosterPending=!0,this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds")}rosterPending=!1;rosterShown=!1;rosterAskedAt=0;rosterProgress=null;landed=new zM;universeShown=!1;universeLive=!1;universeRepaint=null;universeStrategyWas=null;universeWarming="";universe_request(){this.handlers.command_run("proc universe")}universe_show(e){this.landed.clear(),this.landed.take(e.feeds),this.universeLive=!e.whole,this.universeShown||(this.universeShown=!0,this.universeStrategyWas=this.scene.strategy_get(),this.scene.strategy_set("molecule"),this.scene.physics_set({gravity:!0})),this.roster_show(!1),this.pendingFeedId=null,this.pinnedFeedId=null,this.empty.style.display="none",this.canvas.style.display="block",this.universe_paint()}universe_paint(){this.lastModel=null,this.scene.graph_set(Aa(this.landed.all()),{wave:!1}),this.universeTitle_paint()}universeTitle_paint(){const e=`${this.landed.size()} FEEDS · ${this.landed.shapes()} SHAPES`;this.title.textContent=this.universeLive?`UNIVERSE — ${e}${this.universeWarming.length>0?` · ${this.universeWarming}`:" · INDEX WARMING"}`:`UNIVERSE — ${e}`,Jt(this.stateSpan,this.universeLive?"wait":"settled",this.universeLive?"LANDING":"WHOLE")}universeLandings_take(e){!this.universeShown||!this.universeLive||!this.landed.take(e)||this.universeRepaint!==null||(this.universeRepaint=window.setTimeout(()=>{this.universeRepaint=null,this.universeShown&&this.universe_paint()},1e3))}universe_end(e){this.universeShown&&(this.universeShown=!1,this.universeLive=!1,this.universeWarming="",this.universeRepaint!==null&&(window.clearTimeout(this.universeRepaint),this.universeRepaint=null),this.landed.clear(),this.universeStrategyWas!==null&&(this.scene.strategy_set(this.universeStrategyWas),this.universeStrategyWas=null),this.scene.selection_clear(),e&&(this.canvas.style.display="none"))}rosterRefusal_show(e){const t=VD(e.renderedErr||e.rendered||""),s=t.length>0?t:"the roster request was refused",i=document.createElement("div");i.className="feedlist-refusal",i.textContent=s;const r=document.createElement("div");r.className="feedlist-warming",r.textContent="INDEX WARMING… the roster opens when the index is whole.",this.feedList.replaceChildren(i,r),this.roster_show(!0),this.rosterProgress=r}list_reset(){this.pendingFeedId=null,_r(this.stateSpan,"wait"),this.watch_release(),this.facts.replaceChildren(),this.scene.selection_clear(),this.canvas.style.display="none",this.pinnedFeedId=null,this.requestedFeedId=null,this.title.textContent=this.defaultTitle,this.empty.style.display="none"}nav_pop(){return this.pendingFeedId!==null&&this.feedList.childElementCount>0?(this.pendingFeedId=null,this.pinnedFeedId=null,this.requestedFeedId=null,this.listing.activation_settle(),this.empty.style.display="none",this.roster_show(!0),this.title.textContent=this.defaultTitle,_r(this.stateSpan,"wait"),this.listing.state_refresh(),!0):this.canvas.style.display==="none"||this.feedList.childElementCount===0?!1:(this.graph_leave(),this.roster_show(!0),this.listing.state_refresh(),!0)}graph_leave(){this.watch_release(),this.canvas.style.display="none",this.pinnedFeedId=null,this.requestedFeedId=null,this.title.textContent=this.defaultTitle,this.facts.replaceChildren(),this.scene.selection_clear()}arrivals_observe(e){const t=e.join(",");if(t===this.arrivalsKey)return;this.arrivalsKey=t,this.arrivals=new Set(e);for(const r of this.lastRoster)this.listing.row_element(String(r.id))?.classList.toggle("feedlist-arrived",this.arrivals.has(r.id));const s=new Set(this.lastRoster.map(r=>r.id));e.some(r=>!s.has(r))&&this.rosterShown&&this.feedsChooser_request()}chooser_show(e){this.lastRoster=e,this.empty.style.display="none",this.roster_show(!0),this.listing.rows_set([{key:"roster",rows:e}],{field:"roster"}),this.rosterFrame_track()}feed_activate(e){this.follow.pick(this.requestedFeedId,e.id),this.pinnedFeedId=e.id,this.requestedFeedId=null,this.handlers.feed_regard?.(`/proc/jobs/feed_${e.id}`),this.feedRequest_show(e.id),this.handlers.command_run(`feed diagram feed_${e.id}`)}row_indicate(e){this.listing.row_indicate(e===null?null:String(e.id))}indicated_refresh(){const e=this.listing.indicated_get(),t=e===null?void 0:this.lastRoster.find(s=>String(s.id)===e);t!==void 0&&this.handlers.feed_indicated?.(t)}roster_ask(){this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds")}tagMark_press(e){const t=e.target instanceof Element?e.target:null,s=t?.closest(".feedlist-tag")??null;if(s===null)return;e.stopPropagation(),e.preventDefault();const i=s.dataset.tag??"",r=Number(s.closest("[data-feed]")?.dataset.feed);if(t?.closest(".feedlist-tag-x")!==null&&Number.isFinite(r)){this.handlers.feed_untag?.(r,i);return}this.roster_filter(`tag:${i}`)}rowReadout_show(e,t){this.listing.readout_show(String(e),t)}filter_toggle(e){this.listing.filter_toggle(e)}roster_filter(e){this.listing.filter_toggle(e!==""),this.listing.filter_set(e)}rosterFrameObserver=null;rosterFrame_track(){const e=this.feedList.parentElement,t=this.feedList.querySelector(".roster-order");if(this.rosterFrameObserver?.disconnect(),this.rosterFrameObserver=null,e===null)return;if(t===null){e.style.removeProperty("--mode-frame-top");return}const s=()=>{e.style.setProperty("--mode-frame-top",`${Math.ceil(t.getBoundingClientRect().bottom-e.getBoundingClientRect().top)}px`)};s(),this.rosterFrameObserver=new ResizeObserver(s),this.rosterFrameObserver.observe(t)}roster_show(e){this.rosterShown=e,this.backPill!==null&&(this.backPill.hidden=e),this.feedFrame.shown_set(!e),this.feedList.style.display=e?"flex":"none",this.feedList.parentElement?.classList.toggle("roster-shown",e)}facts_show(e){this.factsShown=e;const t=this.factsPayloads.get(e.id);if(!t){this.facts.textContent=e.label;return}this.handlers.node_regard?.(t.vfsPath),this.facts.replaceChildren();const i=t.status==="finishedSuccessfully"||t.status==="finishedWithError"||t.status==="cancelled"?"awaiting warmup":"in flight",r=t.tally,a=[["PLUGIN",t.pluginName],[r?"REP. INSTANCE":"INSTANCE",String(t.instanceId)],["STATUS",t.status],...r?[["COUNT",`×${r.count} — ${r.done} done, ${r.error} err, ${r.running} live, ${r.other} other`]]:[],...r?.anomalies!==void 0&&r.anomalies.length>0?[["FAULTS",r.anomalies.map(o=>o.id).join(" ")+(r.count>r.done+r.anomalies.length?" …":"")]]:[],["WALL",t.metrics?.computeSeconds!==void 0?MM(t.metrics.computeSeconds):i],["SIZE",t.metrics?.dataBytes!==void 0?bM(t.metrics.dataBytes):i],["DATA",t.vfsPath]];for(const[o,l]of a){const c=document.createElement("div");c.className="telemetry-row";const d=document.createElement("span");d.className="telemetry-label",d.textContent=o;const u=document.createElement("span");u.className="telemetry-value",u.textContent=l,c.append(d,u),this.facts.appendChild(c)}if(this.facts.appendChild(cT(t.status)),this.handlers.node_process!==void 0){const o=this.handlers.node_process,l=document.createElement("button");l.className="pacs-capsule dag-process",r!==void 0?(l.textContent="PROCESS",l.disabled=!0,l.title=`${r.count} instances stand here: open one to process it`,l.classList.add("pacs-capsule-off")):(l.textContent="PROCESS",l.title=`open /bin bound to ${t.label} — a run appends to this node`,l.addEventListener("click",()=>o({vfsPath:t.vfsPath,instanceId:t.instanceId,label:t.label}))),this.facts.appendChild(l)}}node_activate(e){const t=this.factsPayloads.get(e.id);if(t)if(this.handlers.node_dive!==void 0){const s=this.handlers.node_dive;this.scene.flight_into(e.id,()=>s(t.vfsPath))}else this.handlers.node_enter(t.vfsPath)}detail_clear(){this.scene.selection_clear(),this.facts.replaceChildren()}wave_start(){this.scene.wave_start()}inside_isHeld(){return this.scene.holding_get()}flight_back(e){this.scene.flight_back(e)}node_flyTo(e){for(const[t,s]of this.factsPayloads){if(s.instanceId!==e)continue;if(this.handlers.node_dive===void 0)return!1;const i=this.handlers.node_dive;return this.facts_show({id:t,label:s.label,parentIds:[],joinParentIds:[]}),this.scene.flight_into(t,()=>i(s.vfsPath)),!0}return!1}}const Ec=[{key:"created",label:"CREATED"},{key:"waiting",label:"WAITING"},{key:"scheduled",label:"SCHEDULED"},{key:"started",label:"STARTED"},{key:"registeringFiles",label:"REGISTERING"}];function cT(n){const e=document.createElement("div");e.className="dag-subway";const t=n==="finishedSuccessfully",s=n==="finishedWithError"||n==="cancelled",i=Ec.findIndex(l=>l.key===n),r=t||s?Ec.length:i;!t&&!s&&e.classList.add("dag-subway-live");const a=(l,c,d)=>{const u=document.createElement("span");u.className=`subway-step${d?" subway-step-here":""}`;const h=document.createElement("span");h.className=c;const p=document.createElement("span");return p.className="subway-label",p.textContent=l,u.append(h,p),u};Ec.forEach((l,c)=>{if(c>0){const u=document.createElement("span");u.className="subway-link"+(c<=r?" subway-passed":""),e.appendChild(u)}const d=c===i&&!t&&!s;e.appendChild(a(l.label,"subway-stop"+(c<r?" subway-passed":"")+(d?" subway-here":""),d))});const o=document.createElement("span");return o.className="subway-link"+(t||s?" subway-passed":""),e.appendChild(o),e.appendChild(a(t?"FINISHED":s?n==="cancelled"?"CANCELLED":"ERROR":"FINISHED","subway-stop subway-terminal"+(t?" subway-done":"")+(s?" subway-failed":""),!1)),e}function dT(n){for(const e of rT){const t=n.match(e);if(t?.[1]!==void 0)return parseInt(t[1],10)}return null}class uT{root;label;fill;constructor(e){this.root=document.createElement("div"),this.root.className="wait-progress",this.root.hidden=!0,this.root.setAttribute("role","progressbar"),this.root.setAttribute("aria-valuemin","0"),this.root.setAttribute("aria-valuemax","100"),this.label=document.createElement("span"),this.label.className="wait-progress-label";const t=document.createElement("span");t.className="wait-progress-track",this.fill=document.createElement("span"),this.fill.className="wait-progress-fill",t.appendChild(this.fill),this.root.append(this.label,t),e.appendChild(this.root)}show(e,t){this.root.hidden=!1,this.label.textContent=t===null?e:`${e} · ${Math.floor(t*100)}%`,this.root.classList.toggle("wait-progress-indeterminate",t===null),this.fill.style.width=t===null?"":`${Math.max(0,Math.min(1,t))*100}%`,t===null?this.root.removeAttribute("aria-valuenow"):this.root.setAttribute("aria-valuenow",String(Math.floor(t*100)))}hide(){this.root.hidden=!0}shown(){return!this.root.hidden}}const hT=600;function fT(n,e){if(e===null)return n.projection_set(n.projection_get()==="3d"?"2d":"3d"),null;if(n.projection_get()==="2d")return"universe: the whole space is 2D; BACK and press 2D to stand it up";const t=[...e];return n.flat_set(n.flat_get()?null:t),n.camera_flyToFit(t,hT,()=>{},1,.95),null}function pT(n,e){return n.projection_get()==="2d"||e&&n.flat_get()?"2D":"3D"}function eu(n,e,t){const s=n?.querySelector(".universe-projection");s!=null&&(s.textContent=pT(e,t))}function mT(n,e,t,s){const i=fT(e,t);i!==null&&s(i),eu(n,e,t!==null)}const gT=4e3;function MT(n){const e={...ni,gravity:!0};return n.charge===e.charge&&n.link===e.link&&n.collide===e.collide&&n.gravity===e.gravity}function Np(n){let e=0;for(const t of Object.values(n))e+=t[0]*1.3+t[1]*1.7+t[2]*1.9;return`${Object.keys(n).length}:${e.toFixed(2)}`}function Ac(n){return n==="constellations"||n==="data"||n==="accretion"}const bT=18e4,_T=1500,zT=1e3,wT=5e3,yT=3e3,fr=650,vT=650,OT=1.5;class xT{scene;wait;asking=!1;spaceKey="";landed=new zM;canvas;title;state;noteTimer=null;empty;handlers;store;whole=!1;shown=!1;warming="";repaintTimer=null;lastReask=0;rememberTimer=null;putSignatures=new Map;sessionPlaces=new Map;sessionWait=null;storeKey=null;arrivalsKey="";feedsCount=null;disposed=!1;scale="jobs";view="feeds";inside=null;cluster=null;framedAt=null;entering=null;facts;viewPill=null;gravityPill=null;densityPill=null;density="shape";drawMode="stars";drawPill=null;captionsPill=null;captions=!0;arrangement="galaxy";arrangementPill=null;scalePill=null;physics={...ni,gravity:!0};backPill;openPill;pane;escape_listen;lit=null;dataHubs=new Map;litHub=null;replayPill=null;replayDay="";reach=null;constructor(e,t,s){this.canvas=e.canvas,this.title=e.title,this.state=e.state,this.empty=e.empty,this.handlers=t,this.store=s,this.facts=e.facts,this.backPill=e.backPill,this.openPill=e.openPill,this.pane=e.canvas.closest(".workspace-pane"),this.wait=new uT(e.canvas),this.scene=new xl(e.canvas,{progress:(i,r,a)=>this.settle_progress(i,r,a),handoffKey:i=>I0(i.id),tip:i=>this.inside===null?A0(i.id,this.dataHubs)??xc(i.id,this.landed)??sT(i.id,this.landed)??wM(i.id,this.landed)??JD(i.id,this.landed):null,select:i=>this.node_select(i),activate:i=>{const r=this.inside===null?Xc(i.id):null;r!==null?this.plugin_frame(r):this.node_dive(i)},deselect:()=>{this.facts_clear(),this.lit!==null&&this.plugin_light(null)},replay:()=>this.replay_paint(),gesture_end:()=>this.pinch_leave()}),this.scene.strategy_set("molecule"),this.scene.physics_set(this.physics),this.frame_wire(e),this.escape_listen=this.escape_wire(),this.scene.draw_set(this.drawMode),this.canvas.style.display="none",this.title_paint()}frame_wire(e){e.backPill?.addEventListener("click",()=>this.ascend()),e.openPill?.addEventListener("click",()=>{this.inside!==null&&this.handlers.feed_open?.(this.inside.feedId)}),e.projectionPill?.addEventListener("click",()=>mT(this.pane,this.scene,this.inside?.ids??null,t=>this.bar_note(t))),e.refreshPill?.addEventListener("click",()=>this.request()),this.replayPill=e.replayPill??null,e.replayPill?.addEventListener("click",()=>{const t=this.scene.replay_state();t===null?this.bar_note(this.replay_start(1)):t.playing?this.scene.replay_pause():this.scene.replay_play(),this.replay_paint()}),e.scalePill?.addEventListener("click",()=>{this.scale=this.scale==="jobs"?"feeds":"jobs",e.scalePill!==null&&(e.scalePill.textContent=this.scale==="jobs"?"JOBS":"ALIKE"),this.shown&&this.paint(!0,"full"),this.settings_save()}),e.viewPill?.addEventListener("click",()=>this.view_set(this.view==="feeds"?"shapes":"feeds")),this.viewPill=e.viewPill,this.gravityPill=e.gravityPill,e.gravityPill?.addEventListener("click",()=>{this.physics_set("gravity",!this.physics.gravity)}),this.densityPill=e.densityPill,e.densityPill?.addEventListener("click",()=>{this.density_set(this.density==="shape"?"census":"shape")}),this.drawPill=e.drawPill??null,this.scalePill=e.scalePill,e.drawPill?.addEventListener("click",()=>{this.draw_set(this.drawMode==="stars"?"spheres":"stars")}),this.captionsPill=e.captionsPill??null,e.captionsPill?.addEventListener("click",()=>{this.bar_note(this.captions_set(!this.captions))}),this.arrangementPill=e.arrangementPill??null,e.arrangementPill?.addEventListener("click",()=>{const t=["galaxy","spokes","clumps","constellations","data","accretion"];this.bar_note(this.arrangement_set(t[(t.indexOf(this.arrangement)+1)%t.length]))})}escape_wire(){const e=t=>{if(t.key==="Escape"&&this.scene.replay_state()!==null&&(this.pane===null||this.pane.offsetParent!==null)){this.replay_end();return}t.key!=="Escape"||this.inside===null&&this.cluster===null||this.scene.moving()||this.scene.holding_get()||this.pane!==null&&this.pane.offsetParent===null||this.ascend()};return window.addEventListener("keydown",e),e}request(){this.asking=!0,this.shown||this.wait.show("ASKING THE SESSION FOR THE SPACE",null),this.title_paint(),this.shown||this.handlers.command_run(`proc layout ${this.sessionLayoutName_of(this.arrangement)}`),this.handlers.command_run("proc universe")}settle_progress(e,t,s){if(e>=t){this.wait.hide(),this.remember_later();return}this.wait.show(`SETTLING ${s.toLocaleString("en-US")} SPHERES`,t===0?1:e/t)}envelope_observe(e){if(e.model?.kind===K_){const s=X_.safeParse(e.model.data);s.success&&this.sessionLayout_take(s.data.name,s.data.positions,s.data.laying??null);return}if(e.model?.kind!==Gm)return;const t=Im.safeParse(e.model.data);t.success&&this.space_show(t.data)}promptContext_observe(e){if(this.disposed)return;this.identity_note(e.user,e.uri);const t=e.procWarmup?.landed??[];t.length>0&&this.shown&&this.landings_take(t);const s=e.procWarmup;if(s?.total!==void 0&&s.total>0&&s.sweeping!==!1&&!this.whole){const i=Math.floor(s.loaded/s.total*100),r=`INDEX WARMING ${s.loaded.toLocaleString()}/${s.total.toLocaleString()} (${i}%)`;r!==this.warming&&(this.warming=r,this.title_paint())}else this.shown&&!this.whole&&(s===void 0||s.sweeping===!1||s.state==="cached")&&(this.warming="",this.request());if(this.shown&&this.whole){const i=(s?.arrived??[]).join(","),r=e.procIndex?.feeds??null,a=i.length>0&&i!==this.arrivalsKey||r!==null&&this.feedsCount!==null&&r!==this.feedsCount;this.arrivalsKey=i,r!==null&&(this.feedsCount=r),a&&Date.now()-this.lastReask>wT&&(this.lastReask=Date.now(),this.request())}}size_fit(){this.scene.size_fit()}verbs_get(){return{enter:e=>this.verb_enter(e),node:e=>this.verb_node(e),state:()=>this.verb_state(),plugin:e=>this.verb_plugin(e),replay:e=>this.verb_replay(e),layout:e=>this.verb_layout(e),draw:e=>this.verb_draw(e),regrow:()=>this.verb_regrow(),captions:e=>this.verb_captions(e),density:e=>this.verb_density(e),physics:e=>this.verb_physics(e),view:e=>this.verb_view(e),cluster:e=>this.verb_cluster(e),back:()=>this.verb_back(),open:()=>this.verb_open()}}control(e,t){if(this.scene.moving()&&(e==="cluster"||e==="back"))return"universe: still moving; ask again";const s=this.verbs_get()[e];return s===void 0?"universe enter <feed>|node <instance>|cluster <feed>|view feeds|shapes|density shape|census|draw stars|spheres|captions on|off|layout galaxy|spokes|clumps|constellations|data|accretion|regrow|plugin <name>|off|replay [speed]|pause|stop|at <date>|state|physics <term> on|off|reset|back|open":s(t)}verb_enter(e){const t=parseInt(e[0]??"",10);return Number.isFinite(t)?this.landed.get(t)===void 0?`universe enter: feed ${t} has not landed here`:this.inside!==null?`universe enter: already inside feed ${this.inside.feedId}; universe back first`:(this.descend(t),`entering feed ${t}`):"universe enter <feed id>"}verb_node(e){const t=parseInt(e[0]??"",10);return Number.isFinite(t)?this.inside===null?"universe node: not inside a feed (universe enter <feed> first)":this.node_flyTo(t)?`flying into instance ${t}`:`universe node: no node of feed ${this.inside.feedId} hosts instance ${t}`:"universe node <instance id>: fly into the entered feed's node that hosts it"}verb_state(){const e=this.scene.state_get(),t=(()=>{const s=this.settingsKey_get();try{return s===null||this.store===void 0?null:this.store.getItem(s)}catch{return null}})();return[`universe: ${this.inside!==null?`inside feed ${this.inside.feedId}`:this.cluster!==null?"in a cluster":"the whole space"}; view ${this.view}, scale ${this.scale}, density ${this.density}`,`scene: ${Object.entries(e).map(([s,i])=>`${s}=${String(i)}`).join(" ")}`,`kept settings: ${t??"(none)"}`,`lit: ${this.lit??"none"}`,`captions: ${this.captions?"on":"off"}`,`session layout: ${(()=>{const s=this.sessionPlaces.get(this.sessionLayoutName_of(this.arrangement));return s===void 0?"not asked":s===null?"none kept":`${s} places kept`})()}`,`replay: ${(()=>{const s=this.scene.replay_state();return s===null?"none":`${s.playing?"playing":"paused"} at ${new Date(s.at).toISOString().slice(0,10)} of ${new Date(s.span[0]).toISOString().slice(0,10)}..${new Date(s.span[1]).toISOString().slice(0,10)}`})()}`].join(`
4239
4239
  `)}verb_plugin(e){const t=e[0]??"";return t===""?"universe plugin <name> | off":this.arrangement!=="constellations"||this.inside!==null||this.cluster!==null?"universe plugin: the CONSTELLATIONS layout only (universe layout constellations)":t.toLowerCase()==="off"?(this.plugin_light(null),"no plugin lit"):this.landed.all().some(s=>s.groups.some(i=>i.plugin===t))?(this.plugin_light(t),xc(`plugin:${t}`,this.landed)??t):`universe plugin: no feed here ran ${t}`}verb_replay(e){const t=(e[0]??"").toLowerCase();if(t==="stop")return this.scene.replay_state()===null?"universe replay: none is running":(this.replay_end(),"replay stopped; the space is whole");if(t==="pause")return this.scene.replay_state()===null?"universe replay: none is running":(this.scene.replay_pause(),this.replay_paint(),"replay paused");if(t==="at"){if(this.scene.replay_state()===null)return"universe replay: none is running (universe replay first)";const i=Date.parse(e[1]??"");return Number.isFinite(i)?(this.scene.replay_pause(),this.scene.replay_seek(i),this.replay_paint(),`replay at ${new Date(this.scene.replay_state()?.at??i).toISOString().slice(0,10)}`):"universe replay at <YYYY-MM-DD>"}const s=t===""?1:Number(t);return!Number.isFinite(s)||s<=0?"universe replay [speed] | pause | stop | at <YYYY-MM-DD>":this.scene.replay_state()!==null?(this.scene.replay_play(s),this.replay_paint(),`replaying at ×${s}`):this.replay_start(s)}verb_layout(e){const t=(e[0]??"").toLowerCase();return t!=="galaxy"&&t!=="spokes"&&t!=="clumps"&&t!=="constellations"&&t!=="data"&&t!=="accretion"?"universe layout galaxy|spokes|clumps|constellations|data|accretion":this.arrangement_set(t)}verb_draw(e){const t=(e[0]??"").toLowerCase();return t!=="stars"&&t!=="spheres"?"universe draw stars|spheres":this.draw_set(t)}verb_regrow(){if(this.arrangement!=="accretion"||this.inside!==null||this.cluster!==null)return"universe regrow: the ACCRETION layout only (universe layout accretion)";this.replay_end();const e=this.positionsKey_of("accretion");try{e!==null&&this.store?.setItem(e,"{}")}catch{}return this.paint(!0,"full"),"the space regrown from its first feed"}verb_captions(e){const t=(e[0]??"").toLowerCase();return t!=="on"&&t!=="off"?"universe captions on|off":this.captions_set(t==="on")}verb_density(e){const t=(e[0]??"").toLowerCase();return t!=="shape"&&t!=="census"?"universe density shape|census":this.density_set(t)}verb_physics(e){const t=(e[0]??"").toLowerCase();if(t==="reset")return this.physics_reset();if(!["charge","link","collide","gravity"].includes(t))return"universe physics charge|link|collide|gravity [on|off] | reset";const s=(e[1]??"on").toLowerCase()!=="off";return this.physics_set(t,s)}verb_view(e){const t=(e[0]??"").toLowerCase();return t!=="feeds"&&t!=="shapes"?"universe view feeds|shapes":this.inside!==null||this.cluster!==null?"universe view: climb out first (universe back)":(this.view_set(t),t==="feeds"?"every feed its own molecule":"the shapes folded, one molecule each")}verb_cluster(e){const t=parseInt(e[0]??"",10),s=Number.isFinite(t)?this.landed.get(t):void 0;return s===void 0?"universe cluster <feed id>: the cluster of a feed that landed here":this.inside!==null?`universe cluster: inside feed ${this.inside.feedId}; universe back first`:(this.cluster_enter(as(s)),`viewing the cluster of feed ${t}: ${hl(as(s))}`)}verb_back(){return this.inside===null&&this.cluster===null?"universe back: not inside a feed or a cluster":(this.ascend(),"climbing out")}verb_open(){return this.inside===null?"universe open: not inside a feed":(this.handlers.feed_open?.(this.inside.feedId),`opening feed ${this.inside.feedId}`)}physics_set(e,t){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":e==="reach"?"universe physics: reach is the pane's own":(this.physics={...this.physics,[e]:t},this.physics_apply(),`physics ${e} ${t?"on":"off"}`)}draw_set(e){return this.replay_end(),this.drawMode=e,this.drawPill!==null&&(this.drawPill.textContent=e.toUpperCase()),this.scene.draw_set(e),this.settings_save(),e==="stars"?"every sphere a point of light":"every sphere lit and solid"}captions_set(e){return this.captions=e,this.captionsPill!==null&&(this.captionsPill.textContent=e?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(e),this.settings_save(),e?"captions on: each hub names itself and its count":"captions off: a hub names itself on hover"}arrangement_set(e){if(Ac(e)&&this.view!=="feeds")return`universe layout ${e}: the FEEDS view only (universe view feeds)`;this.replay_end();const t=i=>Ac(i)?i:"hubs",s=t(e)!==t(this.arrangement);return this.litHub=null,this.remember_now(),this.arrangement=e,this.arrangementPill!==null&&(this.arrangementPill.textContent=e.toUpperCase()),this.positions_recalled(e)===void 0&&this.handlers.command_run(`proc layout ${this.sessionLayoutName_of(e)}`),this.inside===null&&this.cluster===null&&(this.scene.arrangement_set(e==="data"?"hubs":e,this.positions_recalled(e),!s),s&&this.paint(!0,this.positions_recalled(e)===void 0?"full":"hold")),this.settings_save(),e==="galaxy"?"the space finds its own shape: every sphere pushing, every edge holding":e==="spokes"?"each molecule a spoke round its hub":e==="clumps"?"molecules packed round their hub":e==="constellations"?"every plugin a star, placed by what runs with what; every feed pulled to the stars it ran":e==="data"?"every feed hung from what it began from: its format, its modality, its series":"the space grown in the order it was made: each feed wandering until it sticks, to its kin more readily than to strangers"}settingsKey_get(){return this.storeKey===null?null:this.storeKey.replace(/^argus\.universe\./,"argus.universe.settings.")}settings_save(){const e=this.settingsKey_get();if(!(this.store===void 0||e===null))try{this.store.setItem(e,JSON.stringify(KD(this.drawMode,this.view,this.scale,this.density,this.arrangement,this.captions)))}catch{}}settings_recall(){const e=this.settingsKey_get();if(this.store===void 0||e===null)return!1;let t=null;try{t=this.store.getItem(e)}catch{return!1}const s=YD(t),i=s.view!==this.view||s.scale!==this.scale;return this.drawMode=s.draw,this.view=s.view,this.scale=s.scale,this.density=s.density,this.arrangement=s.arrangement,this.arrangementPill!==null&&(this.arrangementPill.textContent=s.arrangement.toUpperCase()),this.scene.arrangement_set(s.arrangement==="data"?"hubs":s.arrangement,this.positions_recalled(s.arrangement)),this.drawPill!==null&&(this.drawPill.textContent=s.draw.toUpperCase()),this.viewPill!==null&&(this.viewPill.textContent=s.view.toUpperCase()),this.scalePill!==null&&(this.scalePill.textContent=s.scale==="jobs"?"JOBS":"ALIKE"),this.densityPill!==null&&(this.densityPill.textContent=s.density.toUpperCase()),this.scene.draw_set(s.draw),this.scene.census_set(s.density==="census"),this.captions=s.captions,this.captionsPill!==null&&(this.captionsPill.textContent=s.captions?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(s.captions),i}density_set(e){return this.replay_end(),this.density=e,this.densityPill!==null&&(this.densityPill.textContent=e.toUpperCase()),this.scene.census_set(e==="census"),this.settings_save(),e==="census"?"every job its own point":"a stage one sphere, with its count"}physics_reset(){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":(this.physics={...ni,gravity:!0},this.physics_apply(),"physics reset")}physics_apply(){this.gravityPill!==null&&(this.gravityPill.textContent=this.physics.gravity?"GRAVITY ON":"GRAVITY OFF"),this.scene.physics_set({...this.physics,reach:this.reach??void 0}),this.title_paint()}view_set(e){if(this.replay_end(),e==="shapes"&&Ac(this.arrangement)&&(this.arrangement="galaxy",this.arrangementPill!==null&&(this.arrangementPill.textContent="GALAXY"),this.scene.arrangement_set("galaxy",this.positions_recalled("galaxy"),!1)),this.remember_now(),this.view=e,this.viewPill!==null&&(this.viewPill.textContent=e.toUpperCase()),this.shown&&this.inside===null&&this.cluster===null){const t=this.positions_recalled(this.arrangement);t!==void 0?(this.scene.positions_seed(t),this.paint(!0,"new")):this.paint(!0,"full")}this.settings_save()}inside_get(){return this.inside?.feedId??null}shown_get(){return this.shown}dispose(){this.disposed=!0,window.removeEventListener("keydown",this.escape_listen),this.repaintTimer!==null&&window.clearTimeout(this.repaintTimer),this.rememberTimer!==null&&window.clearTimeout(this.rememberTimer),this.remember_now(),this.scene.dispose()}space_show(e){this.asking=!1;const t=`${e.whole?"W":"L"}|${e.feeds.map(s=>`${s.id}:${s.jobs}:${s.status}`).join(",")}`;if(this.shown&&t===this.spaceKey){this.title_paint();return}this.spaceKey=t,this.wait.hide(),this.whole=e.whole,this.shown||(this.shown=!0,this.seed_recall()),this.landed.clear(),this.landed.take(e.feeds),this.whole&&(this.warming=""),this.empty.style.display="none",this.canvas.style.display="block",this.inside===null&&this.cluster===null&&this.entering===null&&!this.scene.moving()?this.paint(!this.scene.camera_touched()):this.title_paint()}landings_take(e){!this.landed.take(e)||this.repaintTimer!==null||this.inside!==null||this.cluster!==null||this.entering!==null||(this.repaintTimer=window.setTimeout(()=>{this.repaintTimer=null,!(this.disposed||this.entering!==null||this.inside!==null||this.cluster!==null||this.scene.moving())&&this.paint(!this.scene.camera_touched())},zT))}paint(e=!0,t="new"){if(this.sessionWait_holds()){this.title_paint();return}const s=this.view==="shapes"?OM(this.landed.all(),this.scale):this.arrangement==="constellations"?cu(this.landed.all(),this.scale):this.arrangement==="data"?this.dataGraph_paint():this.arrangement==="accretion"?ph(this.landed.all(),this.scale):Aa(this.landed.all(),this.scale),i=this.arrangement==="constellations"?this.lit:null,r=i===null?s:{nodes:s.nodes.map(o=>o.attrs?.kind==="star"||o.attrs?.plugin===i?o:{...o,dim:!0})},a=T0(r.nodes.length);a!==this.reach&&(this.reach=a,this.scene.physics_set({reach:a},!1)),this.scene.graph_set(r,{wave:!1,fit:e,settle:t}),this.title_paint(),this.remember_later()}descend(e,t){this.replay_end();const s=this.landed.get(e),i=this.handlers.feed_dag;if(s===void 0||i===void 0||this.scene.moving()||this.inside!==null)return;this.facts_clear();const r=yM(e,s);this.entering=e,this.title_paint();const a=Date.now(),o=t!==void 0?{toward:t,distance:14,durationMs:fr}:{fit:r,durationMs:fr};this.scene.descent(o,async()=>{const l=await i(e);if(this.disposed)return null;if(this.entering=null,l===null)return this.title_paint(),this.handlers.note?.(`universe: feed ${e}: the session gave no graph for it (feed diagram feed_${e} refused or answered nothing after ${Math.round((Date.now()-a)/1e3)}s)`),null;const c=ZD(l);for(const p of c.nodes)p.solid=!0;const d=`feed:${e}:`,u=this.view==="feeds"?QD(this.landed.all(),e,c,this.scale,this.arrangement==="constellations",this.arrangement==="data"?mh(this.landed.all(),this.scale).graph:this.arrangement==="accretion"?ph(this.landed.all(),this.scale):void 0):{nodes:[...Ip(this.landed.all(),as(s),this.scale).graph.nodes.filter(p=>!p.id.startsWith(d)).map(p=>({...p,dim:!0})),...c.nodes]},h=new Set(c.nodes.map(p=>p.id));return{graph:u,unfolding:[...h],from:[r,Tp(as(s),this.landed)],physics:{reach:Zc,gravity:!1},frame:[...h],durationMs:fr,bulk:1,margin:.95,drawn:()=>{this.inside={feedId:e,title:l.feedName,entered:c,ids:h},this.pane?.classList.add("universe-inside"),eu(this.pane,this.scene,this.inside!==null),this.title_paint()}}},()=>this.landed_note())}ascend(){if(!this.scene.moving()){if(this.framedAt=null,this.inside!==null){if(this.inside=null,this.facts_clear(),this.pane?.classList.remove("universe-inside"),eu(this.pane,this.scene,this.inside!==null),this.cluster!==null){this.cluster_show(this.cluster.shape);return}}else{if(this.cluster===null)return;this.cluster=null,this.pane?.classList.remove("universe-cluster")}this.paint(!1),this.scene.frame([],vT)}}cluster_enter(e){this.replay_end(),!(this.scene.moving()||this.inside!==null)&&this.cluster_show(e)}cluster_show(e){if(this.view==="feeds"){const r=eT(e,this.landed);if(r.length===0)return;this.cluster={shape:e,ids:r},this.pane?.classList.add("universe-cluster"),this.scene.relight(tT(this.landed.all(),e,this.scale),r,fr,()=>this.landed_note(),()=>this.title_paint());return}const{graph:t,memberIds:s}=Ip(this.landed.all(),e,this.scale);if(s.length===0)return;this.cluster={shape:e,ids:s},this.pane?.classList.add("universe-cluster");const i=new Set(s);this.scene.unfold({graph:t,unfolding:t.nodes.filter(r=>i.has(r.id)||r.ghost===!0).map(r=>r.id),from:[Tp(e,this.landed)],physics:{reach:Zc,gravity:!1},frame:s,durationMs:fr,drawn:()=>this.title_paint()},()=>this.landed_note())}landed_note(){this.framedAt=this.scene.camera_distance()}pinch_leave(){this.inside===null&&this.cluster===null||this.scene.moving()||this.scene.holding_get()||this.framedAt===null||this.scene.camera_distance()<=this.framedAt*OT||this.ascend()}node_dive(e){const t=this.inside?.entered.payloads.get(e.id),s=this.handlers.node_dive;t===void 0||s===void 0||this.scene.moving()||this.scene.flight_into(e.id,()=>s(t.vfsPath))}flight_back(e){this.scene.flight_back(e)}node_flyTo(e){if(this.inside===null)return!1;for(const[t,s]of this.inside.entered.payloads){if(s.instanceId!==e)continue;const i=this.handlers.node_dive;return i===void 0?!1:(this.scene.flight_into(t,()=>i(s.vfsPath)),!0)}return!1}node_select(e){if(this.scene.moving())return;if(this.inside===null){const s=Xc(e.id);if(s!==null){this.plugin_light(this.lit===s?null:s);return}const i=Yc(e.id);if(i!==null){this.litHub=this.litHub===i?null:i,this.paint(!1,"hold");return}const r=e.id.match(/^feed:(\d+):\d+$/),a=Wm(e.id);r!==null?this.descend(Number(r[1]),e.id):a!==null?this.cluster_enter(a):e.id.startsWith("shape:")&&this.cluster_enter(e.id.slice(6));return}const t=this.inside.entered.payloads.get(e.id);t!==void 0&&this.facts_show(e,t)}facts_show(e,t){if(this.facts===null)return;this.facts.replaceChildren();const s=t.tally,i=[["PLUGIN",t.pluginName],[s?"REP. INSTANCE":"INSTANCE",String(t.instanceId)],["STATUS",t.status],...s?[["COUNT",`×${s.count} — ${s.done} done, ${s.error} err, ${s.running} live`]]:[],["DATA",t.vfsPath]];for(const[l,c]of i){const d=document.createElement("div");d.className="telemetry-row";const u=document.createElement("span");u.className="telemetry-label",u.textContent=l;const h=document.createElement("span");h.className="telemetry-value",h.textContent=c,d.append(u,h),this.facts.append(d)}const r=document.createElement("div");r.className="universe-node-verbs";const a=document.createElement("button");a.className="pacs-capsule universe-node-enter",a.textContent="ENTER NODE",a.title="fly into the node: its data, browsable inside (Esc flies out)",a.addEventListener("click",()=>{this.handlers.node_dive!==void 0?this.node_dive(e):this.handlers.node_enter?.(t.vfsPath)});const o=document.createElement("button");o.className="pacs-capsule universe-node-process",o.textContent="PROCESS",o.title="a catalogue bound to this node's data",o.addEventListener("click",()=>this.handlers.node_process?.({vfsPath:t.vfsPath,instanceId:t.instanceId,label:e.label})),r.append(a,o),this.facts.append(r),this.facts.hidden=!1}facts_clear(){this.facts!==null&&(this.facts.replaceChildren(),this.facts.hidden=!0)}state_stand(e,t){this.state!==null&&this.noteTimer===null&&Jt(this.state,e,t)}bar_note(e){this.state!==null&&(this.noteTimer!==null&&clearTimeout(this.noteTimer),this.noteTimer=null,Jt(this.state,"note",e),this.noteTimer=setTimeout(()=>{this.noteTimer=null,_r(this.state,"note"),this.title_paint()},gT))}title_paint(){if(this.entering!==null&&this.inside===null){const t=this.landed.get(this.entering);this.title.textContent=`UNIVERSE — ENTERING FEED ${this.entering}${t!==void 0&&t.title.length>0?` · ${t.title}`:""} …`,this.state_stand("wait","ASKING");return}if(this.inside!==null){const t=this.inside.entered.nodes.reduce((s,i)=>s+(i.count??1),0);this.title.textContent=`UNIVERSE — INSIDE FEED ${this.inside.feedId} · ${this.inside.title} · ${t.toLocaleString("en-US")} JOBS`,this.state_stand("live","INSIDE");return}if(this.cluster!==null){const t=this.landed.all().filter(s=>as(s)===this.cluster?.shape).length;this.title.textContent=`UNIVERSE — SHAPE ${vM(this.cluster.shape)} · ${t} FEED${t===1?"":"S"}`,this.state_stand("live","CLUSTER");return}if(this.asking&&!this.shown){this.title.textContent="UNIVERSE — ASKING THE SESSION …",this.state_stand("wait","ASKING");return}const e=`${this.landed.size()} FEEDS · ${this.landed.shapes()} SHAPES`;this.title.textContent=this.whole?`UNIVERSE — ${e}`:`UNIVERSE — ${e}${this.warming.length>0?` · ${this.warming}`:" · INDEX WARMING"}`,this.state_stand(this.whole?"settled":"wait",this.whole?"WHOLE":"LANDING"),this.scene.replay_state()!==null&&this.replay_paint()}replay_start(e){if(this.inside!==null||this.cluster!==null)return"universe replay: climb out first (universe back)";if(this.view!=="feeds")return"universe replay: the FEEDS view only (universe view feeds)";if(this.density!=="shape")return"universe replay: SHAPE density only (universe density shape)";if(this.drawMode!=="stars")return"universe replay: it draws stars (universe draw stars)";const t=new Map;for(const o of this.landed.all()){const l=Date.parse(o.createdAt??"");Number.isFinite(l)&&t.set(o.id,l)}if(t.size===0)return"universe replay: the session does not say when its feeds were made (a daemon from before the replay: restart it)";const s=new Map;for(const o of Object.keys(this.scene.positions_get())){const l=o.match(/^feed:(\d+):/),c=l===null?void 0:t.get(Number(l[1]));c!==void 0&&s.set(o,c)}this.facts_clear(),this.replayDay="",this.scene.replay_begin(s,e),this.replay_paint();const i=this.scene.replay_state(),r=new Date(i?.span[0]??0).toISOString().slice(0,10),a=new Date(i?.span[1]??0).toISOString().slice(0,10);return`replaying ${t.size} feeds, ${r} to ${a}, at ×${e} (universe replay pause | stop | at <date>; Esc stops)`}plugin_light(e){this.lit=e,e===null?this.facts_clear():this.pluginFacts_show(e),this.shown&&this.inside===null&&this.cluster===null&&this.paint(!1,"hold")}plugin_frame(e){this.lit!==e&&this.plugin_light(e);const t=[];for(const s of this.landed.all())s.groups.forEach((i,r)=>{i.plugin===e&&t.push(`feed:${s.id}:${r}`)});t.length===0||this.scene.moving()||this.scene.frame(t,fr,void 0,.9)}pluginFacts_show(e){if(this.facts===null)return;this.facts.replaceChildren();const t=xc(`plugin:${e}`,this.landed)??e,[,s="",i=""]=t.split(" · ");for(const[o,l]of[["PLUGIN",e],["FEEDS",s.replace(/ feeds?$/,"")],["ERRORED",i.replace(/ errored$/,"")]]){const c=document.createElement("div");c.className="telemetry-row";const d=document.createElement("span");d.className="telemetry-label",d.textContent=o;const u=document.createElement("span");u.className="telemetry-value",u.textContent=l,c.append(d,u),this.facts.append(c)}const r=document.createElement("div");r.className="universe-node-verbs";const a=document.createElement("button");a.className="pacs-capsule universe-plugin-open",a.textContent="OPEN IN /BIN",a.title="the plugin in the files browser: its one-node graph, its parameters",a.addEventListener("click",()=>this.handlers.plugin_open?.(e)),r.append(a),this.facts.append(r),this.facts.hidden=!1}dataGraph_paint(){const{graph:e,hubs:t}=mh(this.landed.all(),this.scale);this.dataHubs=t;const s=this.litHub;if(s===null)return e;const i=Pm(this.landed.all().map(a=>a.data?.seriesDescription).filter(a=>a!==void 0)),r=new Set(this.landed.all().filter(a=>Lm(a,i).some(o=>o.key===s)).map(a=>a.id));return{nodes:e.nodes.map(a=>{if(Yc(a.id)!==null)return a;const o=a.id.match(/^feed:(\d+):/);return o!==null&&r.has(Number(o[1]))?a:{...a,dim:!0}})}}replay_end(){this.scene.replay_state()!==null&&(this.scene.replay_stop(),this.replayDay="",this.title_paint(),this.replay_paint())}replay_paint(){const e=this.scene.replay_state();if(this.replayPill!==null){const s=e!==null&&!e.playing&&e.at>=e.span[1];this.replayPill.textContent=e===null?"REPLAY":e.playing?"PLAYING":s?"REPLAYED":"PAUSED",this.replayPill.classList.toggle("rail-off",e===null)}if(e===null||this.state===null)return;const t=`${e.playing?"REPLAY":"PAUSED"} ${new Date(e.at).toISOString().slice(0,10)}`;t!==this.replayDay&&(this.replayDay=t,this.state_stand("live",t))}identity_note(e,t){const s=XD(e,t);if(s===this.storeKey)return;this.storeKey=s;const i=this.settings_recall();if(this.shown){const r=this.seed_recall();(i||r)&&this.inside===null&&this.cluster===null&&this.paint(!1)}}positionsKey_of(e){if(this.storeKey===null)return null;const t=e==="galaxy"?this.storeKey:`${this.storeKey}.${e}`;return this.view==="shapes"?`${t}.shapes`:t}positions_recalled(e){const t=this.positionsKey_of(e);if(!(this.store===void 0||t===null))try{const s=Dp(this.store.getItem(t));return Object.keys(s).length>0?s:void 0}catch{return}}seed_recall(){const e=this.positionsKey_of(this.arrangement);if(this.store===void 0||e===null)return!1;const t=Dp(this.store.getItem(e));return Object.keys(t).length===0?!1:(this.scene.positions_seed(t),!0)}remember_later(){this.rememberTimer===null&&(this.rememberTimer=window.setTimeout(()=>{this.rememberTimer=null,this.remember_now()},yT))}remember_now(){if(!(this.store===void 0||this.storeKey===null||!this.shown)&&this.positions_matchView(this.scene.positions_get())){try{const e=this.positionsKey_of(this.arrangement);e!==null&&this.store.setItem(e,JSON.stringify(this.scene.positions_get()))}catch{}this.sessionLayout_put()}}positions_matchView(e){const t=Object.keys(e),s=t.some(r=>r.startsWith("fold:")),i=t.some(r=>r.startsWith("feed:"));return this.view==="shapes"?s&&!i:!s}sessionLayoutName_of(e){return`${e}${this.view==="shapes"?"-shapes":""}${this.scale==="feeds"?"-alike":""}`}sessionLayout_take(e,t,s=null){if((t!==null||!this.sessionPlaces.has(e))&&this.sessionPlaces.set(e,t===null?null:Object.keys(t).length),t===null&&s!==null){this.sessionWait_hold(e,s);return}const i=this.sessionWait?.name===e;if(i&&this.sessionWait_end(),t===null||this.store===void 0){i&&this.shown&&this.paint(!0,"full");return}const r=["galaxy","spokes","clumps","constellations","data","accretion"].find(o=>this.sessionLayoutName_of(o)===e);if(r===void 0||this.positions_recalled(r)!==void 0)return;const a=this.positionsKey_of(r);if(a!==null){try{this.store.setItem(a,JSON.stringify(t))}catch{return}this.putSignatures.set(e,Np(t)),r===this.arrangement&&this.shown&&this.inside===null&&this.cluster===null&&this.entering===null&&(this.scene.positions_seed(t),this.paint(i,"new"))}}sessionWait_hold(e,t){if(e!==this.sessionLayoutName_of(this.arrangement)||this.positions_recalled(this.arrangement)!==void 0)return;const s=this.sessionWait?.name===e?this.sessionWait.until:Date.now()+bT;if(this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),Date.now()>=s){this.sessionWait_end(),this.shown&&this.paint(!0,"full");return}this.wait.show(`LAYING OUT ${t.nodes.toLocaleString("en-US")} SPHERES · THE SESSION`,t.fraction);const i=window.setTimeout(()=>{this.handlers.command_run(`proc layout ${e}`)},_T);this.sessionWait={name:e,until:s,timer:i}}sessionWait_end(){this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),this.sessionWait=null,this.wait.hide()}sessionWait_holds(){return this.sessionWait!==null&&this.sessionWait.name===this.sessionLayoutName_of(this.arrangement)&&Date.now()<this.sessionWait.until&&this.inside===null&&this.cluster===null}sessionLayout_put(){if(this.inside!==null||this.cluster!==null||this.scene.replay_state()!==null||!this.whole||!MT(this.physics))return;const e={};for(const[i,r]of Object.entries(this.scene.positions_get()))r.every(a=>Number.isFinite(a))&&(e[i]=[Math.round(r[0]*100)/100,Math.round(r[1]*100)/100,Math.round(r[2]*100)/100]);if(Object.keys(e).length===0)return;const t=this.sessionLayoutName_of(this.arrangement),s=Np(e);this.putSignatures.get(t)!==s&&(this.putSignatures.set(t,s),this.sessionPlaces.set(t,Object.keys(e).length),this.handlers.command_run(`proc layout put ${t} '${JSON.stringify(e).replace(/'/g,"'\\''")}'`))}}const xM={listing:"files.row",rules:[{name:"image",label:()=>"IMAGE",offered:n=>n.kind==="seriesFolder"},{name:"gather",label:()=>"GATHER",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"process",label:()=>"PROCESS",offered:n=>(n.kind==="directory"||n.kind==="seriesFolder")&&(n.feed===null||(n.node??null)!==null)},{name:"run",label:()=>"RUN",offered:n=>n.kind==="catalogue"&&n.bound===!0},{name:"edit",label:()=>"EDIT",offered:n=>n.kind==="file"&&n.editable===!0},{name:"download",label:()=>"DOWNLOAD",offered:n=>n.kind==="file"},{name:"move",label:()=>"MOVE",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"copy",label:()=>"COPY",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"delete",label:()=>"DELETE",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"share",label:n=>`SHARE FEED ${n.feed??""}`,offered:n=>n.kind!=="catalogue"&&n.feed!==null&&n.projection!==!0}],states:[{name:"a plain file outside a feed",facts:{kind:"file",feed:null}},{name:"a file inside a feed",facts:{kind:"file",feed:12}},{name:"a directory",facts:{kind:"directory",feed:null}},{name:"a directory inside a feed that is not a node",facts:{kind:"directory",feed:12,node:null}},{name:"a node's data inside a feed",facts:{kind:"directory",feed:12,node:456}},{name:"a DICOM series folder",facts:{kind:"seriesFolder",feed:null}},{name:"a catalogue entry",facts:{kind:"catalogue",feed:null}},{name:"a catalogue entry in a bound catalogue",facts:{kind:"catalogue",feed:null,bound:!0}},{name:"a node's data seen through /proc",facts:{kind:"directory",feed:12,node:456,projection:!0}},{name:"a file seen through /proc",facts:{kind:"file",feed:12,projection:!0}},{name:"a text file",facts:{kind:"file",feed:null,editable:!0}},{name:"a feed's note seen through /proc",facts:{kind:"file",feed:12,projection:!0,editable:!0}}]},SM={listing:"files.selection",rules:[{name:"delete",label:n=>`DELETE ${n.count}`,offered:()=>!0},{name:"move",label:n=>`MOVE ${n.count}`,offered:()=>!0},{name:"copy",label:n=>`COPY ${n.count}`,offered:()=>!0},{name:"share",label:n=>n.feeds.length===1?`SHARE FEED ${n.feeds[0]}`:`SHARE ${n.feeds.length} FEEDS`,offered:n=>n.feeds.length>0}],states:[{name:"a selection outside any feed",facts:{count:3,feeds:[]}},{name:"a selection in one feed",facts:{count:2,feeds:[12]}},{name:"a selection spanning feeds",facts:{count:5,feeds:[12,13]}}]},EM={listing:"runs.row",rules:[{name:"note",label:()=>"NOTE",offered:()=>!0},{name:"tag",label:()=>"TAG",offered:()=>!0},{name:"rename",label:()=>"RENAME",offered:()=>!0},{name:"share",label:()=>"SHARE",offered:()=>!0},{name:"delete",label:()=>"DELETE",offered:()=>!0}],states:[{name:"any feed",facts:{feedId:12}}]},ga={listing:"pacs.study",rules:[{name:"pullStudy",label:()=>"PULL STUDY",offered:n=>n.addressable},{name:"gather",label:()=>"GATHER",offered:n=>n.addressable},{name:"process",label:()=>"PROCESS",offered:n=>n.allInCube}],states:[{name:"a study with a path",facts:{addressable:!0,allInCube:!1}},{name:"a study with none",facts:{addressable:!1,allInCube:!1}},{name:"a study wholly home",facts:{addressable:!0,allInCube:!0,anyInCube:!0}},{name:"a study partly home",facts:{addressable:!0,allInCube:!1,anyInCube:!0}}]},zi={listing:"pacs.series",rules:[{name:"gather",label:()=>"GATHER",offered:n=>n.addressable||n.inCube},{name:"image",label:()=>"IMAGE",offered:n=>n.inCube&&n.folderKnown},{name:"dir",label:()=>"DIR",offered:n=>n.inCube&&n.folderKnown},{name:"process",label:()=>"PROCESS",offered:n=>n.inCube&&n.folderKnown},{name:"pull",label:()=>"PULL",offered:n=>!n.inCube}],states:[{name:"not yet retrieved",facts:{inCube:!1,folderKnown:!1,addressable:!0}},{name:"not retrieved and unaddressable",facts:{inCube:!1,folderKnown:!1,addressable:!1}},{name:"home, folder not yet named",facts:{inCube:!0,folderKnown:!1,addressable:!0}},{name:"home, folder named",facts:{inCube:!0,folderKnown:!0,addressable:!0}}]},AM={listing:"gather.series",rules:[{name:"remove",label:()=>"REMOVE",offered:()=>!0},{name:"pull",label:()=>"PULL",offered:n=>n.pullable===!0},{name:"image",label:()=>"IMAGE",offered:n=>n.folderKnown&&n.imagery!==!1},{name:"process",label:()=>"PROCESS",offered:()=>!0}],states:[{name:"folder named",facts:{folderKnown:!0}},{name:"a place that is not imagery",facts:{folderKnown:!0,imagery:!1}},{name:"folder not yet named",facts:{folderKnown:!1}},{name:"not retrieved yet",facts:{folderKnown:!1,pullable:!0}}]},DM={listing:"gather.cohort",rules:[{name:"save",label:()=>"SAVE",offered:n=>n.count>0},{name:"export",label:()=>"EXPORT CSV",offered:n=>n.count>0},{name:"feed",label:()=>"CREATE FEED",offered:n=>n.count>0&&n.feed===null},{name:"process",label:()=>"PROCESS",offered:n=>n.count>0},{name:"dismiss",label:()=>"DISMISS",offered:()=>!0}],states:[{name:"holding series",facts:{count:2,feed:null}},{name:"holding series, rooted in a feed",facts:{count:2,feed:4501}},{name:"emptied",facts:{count:0,feed:null}}]};function pi(n){return{listing:n.listing,visit(e){return e(n)}}}pi(xM),pi(SM),pi(EM),pi(ga),pi(zi),pi(DM),pi(AM);function Ks(n,e){const t=n.rules.find(s=>s.name===e);if(t===void 0)throw new Error(`${n.listing} declares no verb '${e}'`);return t}const pr={fold:"5.2em",patient:"13em",mrn:"7.5em"};function ST(n){return{inCube:n.pulled===!0,folderKnown:n.folderPath!==void 0,addressable:n.vfsPath!==void 0}}function Bp(n){if(n.series.length===0)return null;const e=[];for(const s of n.series){if(s.pulled!==!0||s.folderPath===void 0)return null;e.push(s.folderPath.replace(/\/[^/]+\/?$/,""))}const t=e[0]??"";return e.every(s=>s===t)&&t!==""?t:null}function fn(n){const e=ST(n),t=s=>Ks(zi,s).offered(e);return{gather:t("gather"),image:t("image"),dir:t("dir"),pull:t("pull")}}function ET(n,e,t,s){let i=!1;for(const r of n.studies)for(const a of r.series)a.seriesUID===e&&(s!==void 0&&a.folderPath!==s&&(a.folderPath=s,i=!0),a.pulled!==!0&&(a.pulled=!0,t!==void 0&&t>0&&(a.pulledFiles=t),i=!0));return i}const Cp=[{id:"pacs-f-name",term:"PatientName"},{id:"pacs-f-mrn",term:"PatientID"},{id:"pacs-f-date",term:"StudyDate"},{id:"pacs-f-accession",term:"AccessionNumber"},{id:"pacs-f-modality",term:"Modality"}],Mo={running:"RETRIEVING",done:"✓ PULLED",error:"✗ ERROR",unconfirmed:"? UNCONFIRMED",stalled:"STALLED",queued:"QUEUED",idle:"NOT RETRIEVED"},AT="--fresh",Pp="--anon",DT=/\s*--anon\b/,TT=["pacs-f-name","pacs-f-mrn","pacs-f-accession","pacs-f-date"],Lp=/\s*--fresh\b/;function Wp(n){const e=Date.parse(n);if(Number.isNaN(e))return null;const t=Math.max(0,Math.round((Date.now()-e)/1e3)),s=[{limit:60,size:1,name:"SECOND"},{limit:3600,size:60,name:"MINUTE"},{limit:86400,size:3600,name:"HOUR"},{limit:2592e3,size:86400,name:"DAY"},{limit:31536e3,size:2592e3,name:"MONTH"},{limit:1/0,size:31536e3,name:"YEAR"}];for(const i of s){if(t>=i.limit)continue;const r=Math.max(1,Math.floor(t/i.size));return`${r} ${i.name}${r===1?"":"S"} AGO`}return null}const al=new Map;function TM(n,e){const t=al.get(n)??new Set;t.add(e),al.set(n,t)}const IM=new Map;function GM(n,e){n.replaceChildren(),n.dataset.state=e.status,e.reason!==void 0?n.title=e.reason:n.removeAttribute("title");const t=document.createElement("span");if(t.className="pacs-badge-note",e.status==="idle"){t.textContent=Mo.idle,n.append(qo({done:0,total:0}),t);return}if(e.status==="done"){const o=document.createElement("span");o.className="pacs-bar-full",t.textContent=e.total!==void 0&&e.total>0?`✓ ${e.total} IN CUBE`:"✓ IN CUBE",n.append(o,t);return}if(e.status!=="running"&&e.status!=="queued"){n.textContent=Mo[e.status]??e.status.toUpperCase();return}const s=e.total!==void 0?` ${e.current??0}/${e.total}`:"",i=IT(e),r=document.createElement("span");r.className=i===null?"pacs-bar pacs-bar-pacing":"pacs-bar";const a=document.createElement("span");a.className="pacs-bar-fill",i!==null&&(a.style.width=`${Math.round(i*100)}%`),r.appendChild(a),t.textContent=e.status==="queued"?Mo.queued:`${Mo.running}${s}`,n.append(r,t)}function IT(n){return n.status==="queued"||n.total===void 0||n.total===0||(n.current??0)===0?null:Math.min(1,(n.current??0)/n.total)}function GT(n,e){return n.pulled===!0&&e.status!=="done"&&e.status!=="running"&&e.status!=="queued"}function RT(n,e){const t=al.get(n);if(t!==void 0){for(const s of[...t]){if(!s.isConnected){t.delete(s);continue}e(s)}t.size===0&&al.delete(n)}}function NT(n){const e=document.createElement("span");if(e.className="pacs-badge",n.pulled===!0){const r=document.createElement("span");r.className="pacs-bar-full";const a=document.createElement("span");return a.className="pacs-badge-note",a.textContent=n.pulledFiles!==void 0?`✓ ${n.pulledFiles} IN CUBE`:"✓ IN CUBE",e.append(r,a),e.dataset.state="done",e}const t=document.createElement("span");t.className="pacs-bar";const s=document.createElement("span");s.className="pacs-badge-note",s.textContent="NOT RETRIEVED",e.append(t,s),e.dataset.state="idle",TM(n.seriesUID,e);const i=IM.get(n.seriesUID);return i!==void 0&&GM(e,i),e}function RM(n,e){return[{key:"series",label:"SERIES",className:"pacs-series-desc",width:"35.5em",cell:t=>n(t).description??""},{key:"state",label:"STATE",className:"pacs-badge",width:"1fr",cell:t=>e(n(t)),compare:t=>n(t).pulled===!0?"done":"idle"},{key:"modality",label:"MODALITY",className:"pacs-series-modality",width:"4em",cell:t=>n(t).modality},{key:"files",label:"FILES",className:"pacs-series-files",width:"6em",cell:t=>{const s=n(t).fileCount;return s!==void 0?`${s} FILES`:""},compare:t=>n(t).fileCount??-1}]}class BT{root;command;results;handlers;litFolders=new Map;badgeStates=new Map;seriesProgress=new Map;studyTracks=new Map;traits;actions;studyTraits;studyActions;patientTraits;listing;patientTracks=new Map;provenance;run;model=null;anon=!1;revealed=!1;anonPill;revealPill;replayed=!1;serverCell;serverStrip;servers=[];chosen=new Set;constructor(e,t){this.root=e,this.handlers=t,this.command=bo(e,"#pacs-command"),this.results=Fs(e,"#pacs-results"),this.traits=this.traits_declare(),this.actions=this.actions_declare(),this.studyTraits=this.studyTraits_declare(),this.studyActions=this.studyActions_declare(),this.patientTraits=this.patientTraits_declare(),this.listing=new si({mount:this.results,traits:this.patientTraits,key:s=>s.key,chrome:{root:e,prefix:"pacs"},activatable:s=>s.studies.length>0,address:s=>s.studies.length>0?c0(s.patient):void 0,control:"fold",row:{className:()=>"pacs-patient-row",groupClassName:s=>s.patient.status==="unasked"?"pacs-patient pacs-patient-unasked":"pacs-patient",decorate:(s,i)=>{i.studies.length>0&&(s.title="unfold this patient's studies (the patient keeps its place)")}},child:zr(s=>s.studies.map((i,r)=>({study:i,key:kp(i,r)})),{traits:this.studyTraits,key:s=>s.key,address:s=>s.study.vfsPath,control:"fold",actions:{of:()=>this.studyActions},row:{className:()=>"pacs-study-row",groupClassName:()=>"pacs-study",decorate:s=>{s.title="unfold this study's series (the study keeps its place)"}},child:zr(s=>s.study.series.map(i=>({study:s.study,studyKey:s.key,series:i})),{traits:this.traits,key:s=>s.series.seriesUID,address:s=>s.series.vfsPath,actions:{of:()=>this.actions},row:{className:()=>"pacs-series",decorate:(s,i)=>{s.dataset.seriesuid=i.series.seriesUID}}})}),state:s=>this.stateLine_compose(s),empty:()=>Fp("NO STUDIES FOUND")}),e.style.setProperty("--roster-cols",this.listing.template_get(1)),this.listing.rows_set([],{field:"pacs"});for(const{id:s}of Cp){const i=bo(e,`#${s}`);i.addEventListener("input",()=>this.command_regenerate()),i.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),this.query_run())})}this.serverCell=Fs(e,"#pacs-f-server"),this.serverStrip=Fs(e,"#pacs-server-strip"),this.serverCell.addEventListener("click",()=>this.serverStrip_toggle()),this.serverCell_sync(),this.provenance=Fs(e,"#pacs-provenance"),this.anonPill=Fs(e,"#pacs-anon"),this.revealPill=Fs(e,"#pacs-reveal"),this.anonPill.addEventListener("click",()=>this.anon_set(!this.anon)),this.revealPill.addEventListener("click",()=>this.reveal_set(!this.revealed)),this.run=Fs(e,"#pacs-run"),this.run.addEventListener("click",()=>this.query_run(this.replayed)),this.command.addEventListener("keydown",s=>{s.key==="Enter"&&this.query_run()}),Fs(e,"#pacs-export").addEventListener("click",()=>this.answer_export()),Fs(e,"#pacs-gather-shown").addEventListener("click",()=>this.shown_gather()),Fs(e,"#pacs-pull-shown").addEventListener("click",()=>this.shown_pull())}patientTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:pr.fold,cell:e=>{const t=document.createElement("span");return t.className=e.studies.length===0?"pacs-fold pacs-fold-none":"pacs-fold",t}},{key:"patient",label:"PATIENT",className:"pacs-patient-name",width:pr.patient,cell:e=>e.patient.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-patient-mrn",width:pr.mrn,cell:e=>e.patient.patientId||"—"},{key:"answered",label:"ANSWERED",className:"pacs-patient-answered",width:"12em",cell:e=>{const t=document.createElement("span");if(t.className=e.patient.status==="unasked"?"pacs-patient-answered pacs-unasked":"pacs-patient-answered",e.patient.status==="unasked")return t.textContent="UNASKED",e.patient.error!==void 0&&(t.title=e.patient.error),t;const s=e.patient.provenance?.answeredAt;return t.textContent=s===void 0?"—":Wp(s)??"—",s!==void 0&&(t.title=s),t},compare:e=>{const t=e.patient.provenance?.answeredAt;if(t===void 0)return Number.MAX_SAFE_INTEGER;const s=Date.parse(t);return Number.isNaN(s)?Number.MAX_SAFE_INTEGER:s}},{key:"progress",label:"PROGRESS",className:"pacs-patient-progress",width:"1fr",cell:e=>{const t=document.createElement("span");return t.className="pacs-patient-progress",this.patientTracks.set(e.key,{mount:t,uids:e.studies.flatMap(s=>s.series.map(i=>i.seriesUID))}),this.patientTrack_paint(e.key),t},compare:e=>{const t=this.patientProgress_of(e);return t.total===0?-1:t.done/t.total}},{key:"studies",label:"STUDIES",className:"pacs-patient-count",width:"6em",cell:e=>e.patient.status==="unasked"?"—":String(e.patient.studyCount),compare:e=>e.patient.status==="unasked"?-1:e.patient.studyCount},{key:"series",label:"SERIES",className:"pacs-patient-count",width:"5em",cell:e=>e.patient.status==="unasked"?"—":String(e.patient.seriesCount),compare:e=>e.patient.status==="unasked"?-1:e.patient.seriesCount},{key:"server",label:"SERVER",className:"pacs-patient-server",width:"9em",cell:e=>e.patient.server??this.model?.pacsName??"—"}]}patientProgress_of(e){return Ga(e.studies.flatMap(t=>t.series.map(s=>this.seriesProgress.get(s.seriesUID)??{done:0,total:0})))}patientTrack_paint(e){const t=this.patientTracks.get(e);if(t===void 0)return;const s=t.uids.map(i=>this.seriesProgress.get(i)??{done:0,total:0});t.mount.replaceChildren(qo(Ga(s)))}patientRows_build(e){const t=(r,a)=>e.studies.filter(o=>o.patientId===r&&(a===void 0||o.server===void 0||o.server===a));if(e.patients!==void 0&&e.patients.length>0)return e.patients.map((r,a)=>({patient:r,key:`${r.patientId}::${r.server??""}::${a}`,studies:t(r.patientId,r.server)}));const s=[],i=new Map;for(const r of e.studies){const a=r.patientId;i.has(a)||(i.set(a,[]),s.push(a)),i.get(a).push(r)}return s.map((r,a)=>{const o=i.get(r)??[];return{key:`${r}::${a}`,studies:o,patient:{patientId:r,...o[0]?.patientName?{patientName:o[0].patientName}:{},status:"found",studyCount:o.length,seriesCount:o.reduce((l,c)=>l+c.series.length,0),...e.provenance===void 0?{}:{provenance:e.provenance}}}})}studyTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:pr.fold,cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"patient",label:"PATIENT",className:"pacs-study-patient",width:pr.patient,cell:e=>e.study.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-study-mrn",width:pr.mrn,cell:e=>e.study.patientId||"—"},{key:"study",label:"STUDY",className:"pacs-study-desc",width:"12em",cell:e=>e.study.description||"(no description)"},{key:"progress",label:"PROGRESS",className:"pacs-study-progress",width:"1fr",cell:e=>{const t=document.createElement("span");return t.className="pacs-study-progress",this.studyTracks.set(e.key,{mount:t,uids:e.study.series.map(s=>s.seriesUID)}),this.studyTrack_paint(e.key),t},compare:e=>{const t=this.studyProgress_of(e);return t.total===0?-1:t.done/t.total}},{key:"date",label:"DATE",className:"pacs-study-date",width:"7.5em",cell:e=>e.study.date},{key:"accession",label:"ACCESSION",className:"pacs-study-accession",width:"9em",cell:e=>e.study.accession||"—"},{key:"modality",label:"MODALITY",className:"pacs-study-modalities",width:"6.5em",cell:e=>e.study.modalities},{key:"server",label:"SERVER",className:"pacs-study-server",width:"9em",cell:e=>e.study.server??this.model?.pacsName??"—"},{key:"series",label:"SERIES",className:"pacs-study-count",width:"6.5em",cell:e=>String(e.study.series.length),compare:e=>e.study.series.length}]}studyActions_declare(){return[{label:Ks(ga,"pullStudy").label({addressable:!0,allInCube:!1}),offered:e=>Ks(ga,"pullStudy").offered({addressable:e.study.vfsPath!==void 0,allInCube:!1}),run:e=>{const t=e.study.vfsPath;if(t!==void 0){this.handlers.command_run(`pull ${t}`);for(const s of e.study.series)s.vfsPath!==void 0&&s.pulled!==!0&&this.badgeState_set(s.seriesUID,{status:"queued"})}}},{label:Ks(ga,"gather").label({addressable:!0,allInCube:!1,anyInCube:!0}),offered:e=>e.study.series.some(t=>fn(t).gather),run:e=>{const t=e.study.series.filter(i=>fn(i).gather);for(const i of t)this.gather_note(e.study,i);const s=e.study.series.length-t.length;this.handlers.note(`gather: ${t.length} series gathered${s>0?`, ${s} not in CUBE (pull them first)`:""}`)}},{label:Ks(ga,"process").label({addressable:!0,allInCube:!0}),offered:e=>Bp(e.study)!==null,run:e=>{const t=Bp(e.study);t!==null&&this.handlers.process_open(t)}}]}studyProgress_of(e){return Ga(e.study.series.map(t=>this.seriesProgress.get(t.seriesUID)??{done:0,total:0}))}traits_declare(){return RM(e=>e.series,e=>this.badge_build(e))}actions_declare(){return[{label:Ks(zi,"gather").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>fn(e.series).gather,selected:e=>this.handlers.gathered_is(e.series.seriesUID),run:e=>this.gather_note(e.study,e.series)},{label:Ks(zi,"image").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>fn(e.series).image,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(Up(e.series.folderPath))?.viewer??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.image_open(e.series.folderPath)}},{label:Ks(zi,"dir").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>fn(e.series).dir,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(Up(e.series.folderPath))?.browser??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.dir_open(e.series.folderPath)}},{label:Ks(zi,"process").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>fn(e.series).image,run:e=>{e.series.folderPath!==void 0&&this.handlers.process_open(e.series.folderPath)}},{label:Ks(zi,"pull").label({inCube:!1,folderKnown:!1,addressable:!0}),offered:e=>fn(e.series).pull,disabled:e=>e.series.vfsPath===void 0,run:e=>{const t=e.series.vfsPath;t!==void 0&&(this.handlers.command_run(`pull ${t}`),this.badgeState_set(e.series.seriesUID,{status:"queued"}))}}]}state_name(e){return e.pulled===!0?"pulled":this.badgeStates.get(e.seriesUID)?.status??"idle"}command_regenerate(){const e=[];for(const{id:i,term:r}of Cp){const a=bo(this.root,`#${i}`).value.trim();a.length>0&&e.push(`${r}:${a}`)}const t=this.chosen.size>1?` --pacsserver ${[...this.chosen].join(",")}`:"",s=this.anon?` ${Pp}`:"";this.command.value=e.length>0||t!==""?`pacs query ${e.join(",")}${t}${s}`:""}anon_set(e){e!==this.anon&&(this.anon=e,this.revealed=!1,this.anonPill.textContent=e?"ANON ON":"ANON OFF",this.anonPill.classList.toggle("pacs-capsule-off",!e),this.revealPill.hidden=!e,this.model=null,this.listing.rows_set([],{field:"pending"}),this.provenance_show(void 0),this.command.value=e?`${this.command.value.trim()} ${Pp}`.trim():this.command.value.replace(DT,"").trimEnd(),this.masking_apply())}reveal_set(e){this.revealed=e,this.revealPill.textContent=e?"HIDE":"REVEAL",this.revealPill.classList.toggle("pacs-capsule-off",!e),this.masking_apply()}masking_apply(){const e=this.anon&&!this.revealed;for(const t of TT)bo(this.root,`#${t}`).type=e?"password":"text";this.command.type=e?"password":"text"}serverStrip_toggle(e){const t=e??this.serverStrip.hidden;this.serverStrip.hidden=!t,this.serverCell.classList.toggle("pacs-server-open",t),t&&this.servers.length===0&&this.servers_ask(),t&&this.serverStrip_paint()}query_get(){return this.model===null?null:`pacs query ${this.model.expression}`}serverStrip_isOpen(){return!this.serverStrip.hidden}serverStrip_close(){this.serverStrip_toggle(!1)}servers_ask(){this.handlers.command_run("pacs list")}servers_take(e){this.servers=e,this.serverStrip_paint(),this.serverCell_sync()}serverStrip_paint(){if(this.serverStrip.replaceChildren(),this.servers.length===0){this.serverStrip.appendChild(Fp("ASKING THE SESSION FOR REGISTERED SERVERS"));return}for(const e of this.servers){const t=document.createElement("button");t.className=this.chosen.has(e.identifier)?"pacs-server-segment pacs-server-chosen":"pacs-server-segment",t.dataset.server=e.identifier,t.textContent=e.identifier,e.active&&(t.title="the session is connected to this server"),t.addEventListener("click",()=>this.server_choose(e.identifier)),this.serverStrip.appendChild(t)}}server_choose(e){if(this.chosen.has(e)?this.chosen.delete(e):this.chosen.add(e),this.chosen.size===1){const t=[...this.chosen][0];this.handlers.command_show(`pacs connect ${t}`)}this.serverStrip_paint(),this.serverCell_sync(),this.command_regenerate()}serverCell_sync(){const e=[...this.chosen];if(e.length===0){const t=this.servers.find(s=>s.active);this.serverCell.textContent=t?.identifier??"—",this.serverCell.classList.remove("pacs-server-many");return}this.serverCell.textContent=e.length===1?e[0]:`${e[0]} +${e.length-1}`,this.serverCell.classList.toggle("pacs-server-many",e.length>1)}wrote_show(e){const t=this.root.querySelector("#pacs-wrote");t!==null&&(t.textContent=`WROTE ${e}`,t.title="open the folder this landed in",t.classList.add("pacs-wrote-opens"),t.onclick=()=>{const s=e.lastIndexOf("/");this.handlers.dir_open(s<=0?e:e.slice(0,s))},t.hidden=!1)}answer_export(){if(this.model===null)return;const e=this.command.value.trim(),t=e===""?`pacs query ${this.model.expression}`:e;this.handlers.command_show(`${t} --csv-to`)}query_run(e=!1){e&&!Lp.test(this.command.value)&&(this.command.value=`${this.command.value.trim()} ${AT}`);const t=this.command.value.trim();t.length!==0&&(this.model=null,this.listing.rows_set([],{field:"pending"}),this.listing.field_get()?.appendChild(this.waiting_build()),this.handlers.command_run(t))}provenance_show(e){if(this.replayed=e?.replayed===!0,this.run.textContent=this.replayed?"RE-QUERY":"QUERY",this.run.classList.toggle("pacs-capsule-requery",this.replayed),this.provenance.hidden=!this.replayed,!this.replayed){this.provenance.textContent="",this.command.value=this.command.value.replace(Lp,"").trimEnd();return}const t=e?.answeredAt??"",s=Wp(t),i=t.slice(0,10);this.provenance.textContent=s===null?`RESULTS ${i}`:`RESULTS ${i} · ${s}`,this.provenance.title=t}waiting_build(){const e=document.createElement("div");e.className="pacs-waiting";const t=document.createElement("span");t.className="pacs-bar pacs-bar-pacing";const s=document.createElement("span");s.className="pacs-bar-fill",t.appendChild(s);const i=document.createElement("span");return i.className="pacs-waiting-note",i.textContent="QUERYING THE PACS…",e.append(t,i),e}envelope_observe(e){const t=/✓ wrote (\S+)/.exec((e.rendered??"").replace(/\x1b\[[0-9;]*m/g,""));if(t!==null&&this.wrote_show(t[1]),e.model?.kind===o0){const i=a0.safeParse(e.model.data);i.success&&this.servers_take(i.data.servers);return}if(e.model?.kind!==l0)return;const s=i0.safeParse(e.model.data);s.success&&this.results_render(s.data)}progress_observe(e){if(e.operation!=="pull"||e.itemId===void 0)return;const t=e.status??"running",s={status:t};e.current!==void 0&&(s.current=e.current),e.total!==void 0&&(s.total=e.total),e.reason!==void 0&&(s.reason=e.reason),this.badgeState_set(e.itemId,s),t==="done"&&this.model!==null&&ET(this.model,e.itemId,e.current??e.total,e.path)&&this.results_repaint()}badgeState_set(e,t){this.badgeStates.set(e,t),IM.set(e,t),this.seriesProgress.set(e,PT(t,this.seriesProgress.get(e))),RT(e,s=>this.badge_paint(s,t));for(const[s,i]of this.studyTracks)i.uids.includes(e)&&this.studyTrack_paint(s);for(const[s,i]of this.patientTracks)i.uids.includes(e)&&this.patientTrack_paint(s)}badge_build(e){const t=document.createElement("span");if(t.className="pacs-badge",e.pulled===!0){const s=document.createElement("span");s.className="pacs-bar-full";const i=document.createElement("span");return i.className="pacs-badge-note",i.textContent=e.pulledFiles!==void 0?`✓ ${e.pulledFiles} IN CUBE`:"✓ IN CUBE",t.append(s,i),t.dataset.state="done",t}return TM(e.seriesUID,t),this.badge_paint(t,this.badgeStates.get(e.seriesUID)??{status:"idle"}),t}badge_paint(e,t){GM(e,t)}results_render(e){const t=this.model!==null&&this.model.queryId===e.queryId;if(this.model=e,this.provenance_show(e.provenance),!t){this.listing.open_clear(),this.badgeStates.clear();const s=this.patientRows_build(e),i=s.length===1?s[0]:void 0;i!==void 0&&i.studies.length>0&&this.listing.open_set(0,[i.key]),e.studies.length===1&&this.listing.open_set(1,[kp(e.studies[0],0)])}for(const s of e.studies)for(const i of s.series){const r=this.badgeStates.get(i.seriesUID);if(r!==void 0&&GT(i,r)){this.badgeState_set(i.seriesUID,{status:"done",...i.pulledFiles!==void 0?{total:i.pulledFiles}:{}});continue}t&&r!==void 0||this.seriesProgress.set(i.seriesUID,CT(i))}this.results_repaint()}results_repaint(){const e=this.model;if(this.studyTracks.clear(),this.patientTracks.clear(),e===null){this.listing.rows_set([],{field:"pacs"});return}this.listing.rows_set([{key:String(e.queryId),rows:this.patientRows_build(e)}],{field:String(e.queryId)})}studyTrack_paint(e){const t=this.studyTracks.get(e);if(t===void 0)return;const s=t.uids.map(i=>this.seriesProgress.get(i)??{done:0,total:0});t.mount.replaceChildren(qo(Ga(s)))}stateLine_compose(e){queueMicrotask(()=>{this.shownGather_render(),this.shownPull_render()});const t=[],s=this.model?.patients??[];if(s.length>0){const i=r=>s.filter(a=>a.status===r).length;t.push(`FOUND ${i("found")} · NONE ${i("none")} · UNASKED ${i("unasked")}`)}return e.filter!==""&&t.push(e.filter),t.join(" · ")}filter_toggle(e){this.listing.filter_toggle(e)}shown_candidates(){const e=[];if(!this.filtering()){for(const t of this.model?.studies??[])for(const s of t.series)e.push({study:t,series:s});return e}for(const t of this.root.querySelectorAll("#pacs-results .pacs-series")){const s=t.dataset.seriesuid;if(s!==void 0)for(const i of this.model?.studies??[]){const r=i.series.find(a=>a.seriesUID===s);r!==void 0&&e.push({study:i,series:r})}}return e}filtering(){return this.listing.filterText_get()!==""}shown_gatherable(){return this.shown_candidates().filter(({series:e})=>fn(e).gather&&!this.handlers.gathered_is(e.seriesUID))}shownGather_render(){const e=this.root.querySelector("#pacs-gather-shown");if(e===null)return;const t=this.shown_gatherable().length;e.hidden=t===0,e.textContent=this.filtering()?`GATHER ${t} SHOWN`:`GATHER ${t}`}shown_pullable(){return this.shown_candidates().map(({series:e})=>e).filter(e=>fn(e).pull&&e.vfsPath!==void 0)}shownPull_render(){const e=this.root.querySelector("#pacs-pull-shown");if(e===null)return;const t=this.shown_pullable().length;e.hidden=t===0,e.textContent=this.filtering()?`PULL ${t} SHOWN`:`PULL ${t}`}shown_pull(){const e=this.shown_pullable();if(e.length===0)return;const t=e.map(s=>`"${s.vfsPath}"`).join(" ");this.handlers.command_show(`pull ${t}`);for(const s of e)this.badgeState_set(s.seriesUID,{status:"queued"});this.handlers.note(`pull: ${e.length} series asked for`),this.shownPull_render()}shown_gather(){const e=this.shown_gatherable();if(e.length!==0){for(const{study:t,series:s}of e)this.gather_note(t,s);this.handlers.note(this.filtering()?`gather: ${e.length} series gathered from what the filter left showing`:`gather: ${e.length} series gathered from the whole answer`),this.shownGather_render()}}gather_note(e,t){t.vfsPath!==void 0&&(this.handlers.gather_add({seriesUID:t.seriesUID,description:t.description,modality:t.modality,series:t,patient:e.patientId||e.patientName,...e.description===void 0||e.description===""?{}:{study:e.description},vfsPath:t.vfsPath,...t.folderPath!==void 0?{folderPath:t.folderPath}:{},...t.fileCount!==void 0?{files:t.fileCount}:{}}),this.selected_refresh())}stage_lit(e){this.litFolders=e,this.selected_refresh()}selected_refresh(){this.listing.indication_refresh()}}function kp(n,e){return n.studyUID??`study-${e}`}function Up(n){return n.replace(/\/$/,"")}function CT(n){const e=n.pulledFiles??0,t=Math.max(n.fileCount??0,e);return n.pulled===!0?{done:t,total:t}:{done:e,total:t}}function PT(n,e){const t=n.total??e?.total??0;return n.status==="error"?{done:n.current??e?.done??0,total:t,failed:!0}:n.status==="done"?{done:t,total:t}:{done:n.current??e?.done??0,total:t}}function Fs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`PACS workspace is missing '${e}'`);return t}function bo(n,e){const t=Fs(n,e);if(!(t instanceof HTMLInputElement))throw new Error(`'${e}' is not an input`);return t}function Fp(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}const LT={"fs.listing":"files","feed.dag":"dag","feed.list":"dag","pacs.query":"pacs","dicom.series":"image","dicom.tags":"tags"};class WT{result;handlers;constructor(e,t){this.handlers=t,this.result=la(e,".empty-result"),Vs(this.result);const s=la(e,".empty-prompt");s.addEventListener("keydown",i=>{i.key==="Enter"&&s.value.trim().length>0&&(this.line_run(s.value.trim()),s.value="")}),la(e,".empty-go-files").addEventListener("click",()=>{this.line_run("ls .")}),la(e,".empty-go-dag").addEventListener("click",()=>{this.line_run("proc feeds")}),la(e,".empty-go-pacs").addEventListener("click",()=>{this.handlers.claim("pacs",[])}),window.setTimeout(()=>s.focus(),0)}async line_run(e){this.result.textContent="…";let t;try{t=await this.handlers.execute(e)}catch(i){this.result.textContent=i instanceof Error?i.message:String(i);return}for(const i of t.envelopes){const r=i.model?.kind!==void 0?LT[i.model.kind]:void 0;if(r!==void 0){this.handlers.claim(r,t.envelopes);return}}const s=t.envelopes.map(i=>i.rendered).join(`
4240
- `);this.result.textContent=kT(s)||"(no output)"}}function la(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`empty pane template is missing ${e}`);return t}function kT(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}class UT{container;title;handlers;currentAddress=null;constructor(e,t,s){this.container=e,this.title=t,this.handlers=s,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 i=document.createElement("p");i.className="files-empty",i.textContent=`NO PREVIEW — ${e.address.toUpperCase()}`,this.container.appendChild(i);return}const s=document.createElement("pre");s.className="files-content",s.textContent=t,this.container.appendChild(s)})}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)}}const FT="modulepreload",jT=function(n,e){return new URL(n,e).href},jp={},tu=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let c=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const a=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");i=c(t.map(d=>{if(d=jT(d,s),d in jp)return;jp[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(s)for(let f=a.length-1;f>=0;f--){const b=a[f];if(b.href===d&&(!u||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":FT,u||(p.as="script"),p.crossOrigin="",p.href=d,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,b)=>{p.addEventListener("load",f),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},$T=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function Hu(n){const e=n instanceof Error?n.message:String(n??"");return $T.test(e)}const Or={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},VT=`${Or.before}${Or.refresh}${Or.after}`,ol="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function HT(n,e=document.body){let t=!1;const s=()=>{if(t)return;t=!0,n(`argus: ${VT} (what failed to load was part of the old build)`);const i=document.createElement("div");i.className="stale-page",i.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const a=document.createElement("button");a.type="button",a.className="stale-page-reload",a.textContent=Or.refresh,a.title="load the argus the server has now",a.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(Or.before),a,document.createTextNode(Or.after)),i.append(r),e.appendChild(i)};window.addEventListener("vite:preloadError",()=>{s()}),window.addEventListener("unhandledrejection",i=>{Hu(i.reason)&&s()})}const qT=[{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"}],XT=256*1024*1024;function _o(n){const e=["B","KB","MB","GB","TB"];let t=n,s=0;for(;t>=1024&&s<e.length-1;)t/=1024,s++;return s===0?`${n} B`:`${t.toFixed(1)} ${e[s]}`}function KT(n){const e=n.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class YT{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=XT;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=vs(e,".image-field"),this.title=vs(e,".pane-title"),this.modeSpan=vs(e,".pane-mode"),this.stateSpan=vs(e,".pane-state");for(const s of e.querySelectorAll(".image-layout")){const i=s.dataset.layout??"single";this.layoutPills.set(i,s),s.addEventListener("click",()=>{this.layout_set(i)})}this.overlayPill=vs(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=vs(e,".image-colormap"),this.savePill=vs(e,".image-save"),this.loadPill=vs(e,".image-load"),this.retryPill=vs(e,".image-retry"),this.presetPill=vs(e,".image-preset"),this.focusMark=vs(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()),vs(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const s of Oh){const i=vs(e,`.image-tool[data-tool="${s}"]`);this.toolPills.set(s,i),i.addEventListener("click",()=>{this.tool_set(s)})}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",s=>{(!(s.relatedTarget instanceof Node)||!this.field.contains(s.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",s=>{if(s.key==="Escape"){this.field_release(),s.stopPropagation();return}s.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=KT(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const a=this.siblings.findIndex(o=>o.path===e.path)+1;this.handlers.note(`image: series ${a} of ${this.siblings.length} in this study; image series <n> switches`)}const s=await this.chunk_import(()=>tu(()=>import("./cornerstoneEngine--e1lt542.js").then(a=>a.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(s===null)return;const{CornerstoneEngine:i}=s,r=new i(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 ${_o(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${_o(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 s=0;for(const i of t.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=i.split("/").pop()??i;try{const a=await fetch(this.handlers.source.url_of(i));if(!a.ok){this.handlers.note(`image: ${r}: HTTP ${a.status}`);continue}const o=await e.annotations_import(await a.arrayBuffer());s+=o,this.handlers.note(o>0?`image: ${o} measurement${o===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(a){this.handlers.note(`image: ${r}: ${a instanceof Error?a.message:String(a)}`)}}this.pane.dataset.annotations=String(s)}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(()=>tu(()=>import("./niivueEngine-CH7T6paV.js"),__vite__mapDeps([3,1]),import.meta.url));if(t===null)return;const{NiivueEngine:s}=t;await this.engine_open(new s(this.engineHost_get(),e))}async chunk_import(e){try{const t=await e();if(t!==void 0)return t}catch(t){if(!Hu(t))throw t}return Jt(this.stateSpan,"stale",ol),this.handlers.note(`image: ${ol.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 s=this.progressNote;s!==null&&(s.classList.add("image-working-failed"),s.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 ${_o(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${_o(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,s]of this.layoutPills)s.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 Hm.filter(s=>s.modalities.length===0||s.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 s=this.engine.wl_set(e,t);return s||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),s}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",s=zz(e,t);return s===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${t}`),!1):this.wl_set(s.lower,s.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 s=await this.engine.annotations_export();if(s===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const i=`${t}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(i,s);return this.handlers.note(r===200?`✓ ${i}`:`image: save: ${i}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=Oo[(Oo.indexOf(this.colormap)+1)%Oo.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(s){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${s instanceof Error?s.message:String(s)}`);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 a=document.createElement("div");a.className="image-working",a.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(a),this.progressNote=a}const t=this.progressNote;t.classList.remove("image-working-failed");const s=e.total>0,i=s?Math.min(1,e.done/e.total):0;t.querySelector(".image-working-label").textContent=e.label,t.querySelector(".image-working-count").textContent=s?`${e.done} / ${e.total} · ${Math.round(i*100)}%`:"";const r=t.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!s),r.style.width=s?`${Math.round(i*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=qT.flatMap(s=>{const r=(t.constant.find(a=>a.name===s.tag)?.value??"").trim();return r===""?[]:[s.label===""?r:`${s.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 s of this.overlayLines){const i=document.createElement("span");i.textContent=s,e.appendChild(i)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??Oh),t=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[s,i]of this.toolPills){const r=e.has(s);i.classList.toggle("rail-na",!r),i.classList.toggle("rail-off",r&&s!==t),i.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function vs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const NM=["patient","study","series","image","equipment","meta","private","other","varying"],ZT=new Set(["meta","private"]),$p="••••";class QT{pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,t){this.handlers=t,this.pane=e,this.title=zo(e,".pane-title"),this.modeSpan=zo(e,".pane-mode"),this.redactBlock=zo(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const s=zo(e,".tags-panel");this.listing=new si({mount:s,traits:this.groupTraits_declare(),key:i=>i.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:i=>`tags-group tags-group-${i.group}`,decorate:i=>{i.title="fold this group open or shut (it keeps its place)"}},child:zr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:i=>i.items.length>0,row:{className:i=>`tags-row${i.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(i,r)=>{i.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:zr(i=>i.items,{traits:this.itemTraits_declare(),key:i=>i.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:zr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:()=>!1,row:{className:i=>`tags-row tags-row-deep${i.phi?" tags-phi":""}`}})})}),state:i=>this.stateLine_compose(i),empty:()=>sI("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${eI(e)}`,this.pane.dataset.modality=tI(e),this.groups=JT(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=>!ZT.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((i,r)=>i+r.rows.length,0),s=[];return this.model!==null&&this.model.subject==="folder"&&(s.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&s.push(`REFUSED ${this.model.refused.length}`)),s.push(e.filter!==""?e.filter:`${t} TAGS`),this.redact&&s.push("REDACTED"),s.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=$p,t.title="identifying value, redacted; the REDACT block on the frame reveals it",t;if(t.textContent=e.value,e.decoded!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` ${e.decoded}`,t.appendChild(s)}if(e.distinct!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` (${e.distinct} distinct)`,t.appendChild(s)}return t}groupTraits_declare(){return[Dc(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>NM.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[Dc(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?$p:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Dc(()=>!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 Dc(n){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const t=document.createElement("span");return t.className=n(e)?"tags-fold":"tags-fold tags-fold-none",t}}}function JT(n){const e=new Map;for(const t of n.constant){const s=t.group;e.has(s)||e.set(s,[]),e.get(s)?.push(BM(t,`${s}/${t.tag}`))}return n.varying.length>0&&e.set("varying",n.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}`}))),NM.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function BM(n,e){return{tag:n.tag,name:n.name,vr:n.vr,value:n.value,...n.decoded!==void 0?{decoded:n.decoded}:{},phi:n.phi,items:(n.items??[]).map((t,s)=>({index:s+1,key:`${e}/${s+1}`,rows:t.map(i=>BM(i,`${e}/${s+1}/${i.tag}`))})),key:e}}function eI(n){const e=n.path.replace(/\/$/,"").split("/").pop()??n.path;if(n.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 tI(n){const e=(n.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function sI(n){const e=document.createElement("div");return e.className="tags-note",e.textContent=n,e}function zo(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`tags pane: missing ${e}`);return t}class nI{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 s=this.groups.get(t);if(s!==void 0){s.subscribers.delete(e),s.viewers.delete(e);for(const i of this.membership.values())if(i===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 s=this.group_of(e),i=this.groups.get(s),r={...t,paneId:e};i.value=r;for(const a of i.subscribers.values())a(r);this.writeObserver?.(r,s)}regard_subscribe(e,t){const s=this.groups.get(this.group_of(e));s.subscribers.set(e,t),s.value!==null&&t(s.value)}regard_get(e){return this.groups.get(this.group_of(e))?.value??null}}const Tc=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],iI=new Set(["done","error","unconfirmed","stalled","timeout"]);function rI(n,e){const t=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const s=`${e.operation}:`;for(const i of[...n])(i===t||i.startsWith(s))&&n.delete(i);return}if(e.itemId!==void 0&&e.status!==void 0&&iI.has(e.status)){n.delete(t);return}n.add(t)}const aI=100;class oI{fields;buildShown=!1;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:mi(e,"status-identity"),jobs:mi(e,"status-jobs"),activity:mi(e,"status-activity"),latency:mi(e,"status-latency"),mismatch:mi(e,"status-mismatch"),lamp:mi(e,"status-lamp"),host:mi(e,"status-host")}}attach_show(e){if(e.protocolVersion!==Lc){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${Lc}`,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.":""}promptContext_show(e){const t=e.uri.replace(/^https?:\/\//,"");this.fields.identity.textContent=`${e.user}@${t}`.toUpperCase();const s=e.procWarmup,i=[];if(s!==void 0&&s.sweeping!==!1){const o=s.total!==void 0?`/${s.total}`:"",l=s.state!==void 0?` ${s.state.toUpperCase()}`:"";i.push(`JOBS ${s.loaded}${o}${l}`)}const r=s?.feeds??(s?.feed!==void 0?[s.feed]:[]);for(const o of r){const l=o.total>0?`/${o.total}`:"";i.push(o.failed!==void 0?`FEED ${o.id} FAILED ${o.loaded}${l}`:`FEED ${o.id} ${o.loaded}${l}`)}s?.roster!==void 0&&i.push(s.roster==="full"?"ROSTER WALK":"ROSTER DELTA"),s?.arrived!==void 0&&s.arrived.length>0&&i.push(s.arrived.length<=2?`+FEED ${s.arrived.join(" ")}`:`+${s.arrived.length} FEEDS`);const a=e.warmupFailures??[];a.length>0&&i.push(`WARM-UP FAILED: ${a.map(o=>o.label.toUpperCase()).join(" ")}`),this.fields.jobs.textContent=i.join(" · "),this.fields.jobs.classList.toggle("status-degraded",a.length>0),this.fields.jobs.title=a.length>0?a.map(o=>`${o.label}: ${o.message}`).join(`
4240
+ `);this.result.textContent=kT(s)||"(no output)"}}function la(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`empty pane template is missing ${e}`);return t}function kT(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}class UT{container;title;handlers;currentAddress=null;constructor(e,t,s){this.container=e,this.title=t,this.handlers=s,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 i=document.createElement("p");i.className="files-empty",i.textContent=`NO PREVIEW — ${e.address.toUpperCase()}`,this.container.appendChild(i);return}const s=document.createElement("pre");s.className="files-content",s.textContent=t,this.container.appendChild(s)})}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)}}const FT="modulepreload",jT=function(n,e){return new URL(n,e).href},jp={},tu=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let c=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const a=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");i=c(t.map(d=>{if(d=jT(d,s),d in jp)return;jp[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(s)for(let f=a.length-1;f>=0;f--){const b=a[f];if(b.href===d&&(!u||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":FT,u||(p.as="script"),p.crossOrigin="",p.href=d,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,b)=>{p.addEventListener("load",f),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},$T=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function Hu(n){const e=n instanceof Error?n.message:String(n??"");return $T.test(e)}const Or={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},VT=`${Or.before}${Or.refresh}${Or.after}`,ol="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function HT(n,e=document.body){let t=!1;const s=()=>{if(t)return;t=!0,n(`argus: ${VT} (what failed to load was part of the old build)`);const i=document.createElement("div");i.className="stale-page",i.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const a=document.createElement("button");a.type="button",a.className="stale-page-reload",a.textContent=Or.refresh,a.title="load the argus the server has now",a.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(Or.before),a,document.createTextNode(Or.after)),i.append(r),e.appendChild(i)};window.addEventListener("vite:preloadError",()=>{s()}),window.addEventListener("unhandledrejection",i=>{Hu(i.reason)&&s()})}const qT=[{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"}],XT=256*1024*1024;function _o(n){const e=["B","KB","MB","GB","TB"];let t=n,s=0;for(;t>=1024&&s<e.length-1;)t/=1024,s++;return s===0?`${n} B`:`${t.toFixed(1)} ${e[s]}`}function KT(n){const e=n.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class YT{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=XT;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=vs(e,".image-field"),this.title=vs(e,".pane-title"),this.modeSpan=vs(e,".pane-mode"),this.stateSpan=vs(e,".pane-state");for(const s of e.querySelectorAll(".image-layout")){const i=s.dataset.layout??"single";this.layoutPills.set(i,s),s.addEventListener("click",()=>{this.layout_set(i)})}this.overlayPill=vs(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=vs(e,".image-colormap"),this.savePill=vs(e,".image-save"),this.loadPill=vs(e,".image-load"),this.retryPill=vs(e,".image-retry"),this.presetPill=vs(e,".image-preset"),this.focusMark=vs(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()),vs(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const s of Oh){const i=vs(e,`.image-tool[data-tool="${s}"]`);this.toolPills.set(s,i),i.addEventListener("click",()=>{this.tool_set(s)})}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",s=>{(!(s.relatedTarget instanceof Node)||!this.field.contains(s.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",s=>{if(s.key==="Escape"){this.field_release(),s.stopPropagation();return}s.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=KT(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const a=this.siblings.findIndex(o=>o.path===e.path)+1;this.handlers.note(`image: series ${a} of ${this.siblings.length} in this study; image series <n> switches`)}const s=await this.chunk_import(()=>tu(()=>import("./cornerstoneEngine-CW5LOM9l.js").then(a=>a.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(s===null)return;const{CornerstoneEngine:i}=s,r=new i(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 ${_o(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${_o(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 s=0;for(const i of t.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=i.split("/").pop()??i;try{const a=await fetch(this.handlers.source.url_of(i));if(!a.ok){this.handlers.note(`image: ${r}: HTTP ${a.status}`);continue}const o=await e.annotations_import(await a.arrayBuffer());s+=o,this.handlers.note(o>0?`image: ${o} measurement${o===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(a){this.handlers.note(`image: ${r}: ${a instanceof Error?a.message:String(a)}`)}}this.pane.dataset.annotations=String(s)}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(()=>tu(()=>import("./niivueEngine-DzKAhyNX.js"),__vite__mapDeps([3,1]),import.meta.url));if(t===null)return;const{NiivueEngine:s}=t;await this.engine_open(new s(this.engineHost_get(),e))}async chunk_import(e){try{const t=await e();if(t!==void 0)return t}catch(t){if(!Hu(t))throw t}return Jt(this.stateSpan,"stale",ol),this.handlers.note(`image: ${ol.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 s=this.progressNote;s!==null&&(s.classList.add("image-working-failed"),s.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 ${_o(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${_o(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,s]of this.layoutPills)s.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 Hm.filter(s=>s.modalities.length===0||s.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 s=this.engine.wl_set(e,t);return s||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),s}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",s=zz(e,t);return s===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${t}`),!1):this.wl_set(s.lower,s.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 s=await this.engine.annotations_export();if(s===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const i=`${t}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(i,s);return this.handlers.note(r===200?`✓ ${i}`:`image: save: ${i}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=Oo[(Oo.indexOf(this.colormap)+1)%Oo.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(s){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${s instanceof Error?s.message:String(s)}`);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 a=document.createElement("div");a.className="image-working",a.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(a),this.progressNote=a}const t=this.progressNote;t.classList.remove("image-working-failed");const s=e.total>0,i=s?Math.min(1,e.done/e.total):0;t.querySelector(".image-working-label").textContent=e.label,t.querySelector(".image-working-count").textContent=s?`${e.done} / ${e.total} · ${Math.round(i*100)}%`:"";const r=t.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!s),r.style.width=s?`${Math.round(i*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=qT.flatMap(s=>{const r=(t.constant.find(a=>a.name===s.tag)?.value??"").trim();return r===""?[]:[s.label===""?r:`${s.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 s of this.overlayLines){const i=document.createElement("span");i.textContent=s,e.appendChild(i)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??Oh),t=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[s,i]of this.toolPills){const r=e.has(s);i.classList.toggle("rail-na",!r),i.classList.toggle("rail-off",r&&s!==t),i.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function vs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const NM=["patient","study","series","image","equipment","meta","private","other","varying"],ZT=new Set(["meta","private"]),$p="••••";class QT{pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,t){this.handlers=t,this.pane=e,this.title=zo(e,".pane-title"),this.modeSpan=zo(e,".pane-mode"),this.redactBlock=zo(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const s=zo(e,".tags-panel");this.listing=new si({mount:s,traits:this.groupTraits_declare(),key:i=>i.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:i=>`tags-group tags-group-${i.group}`,decorate:i=>{i.title="fold this group open or shut (it keeps its place)"}},child:zr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:i=>i.items.length>0,row:{className:i=>`tags-row${i.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(i,r)=>{i.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:zr(i=>i.items,{traits:this.itemTraits_declare(),key:i=>i.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:zr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:()=>!1,row:{className:i=>`tags-row tags-row-deep${i.phi?" tags-phi":""}`}})})}),state:i=>this.stateLine_compose(i),empty:()=>sI("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${eI(e)}`,this.pane.dataset.modality=tI(e),this.groups=JT(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=>!ZT.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((i,r)=>i+r.rows.length,0),s=[];return this.model!==null&&this.model.subject==="folder"&&(s.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&s.push(`REFUSED ${this.model.refused.length}`)),s.push(e.filter!==""?e.filter:`${t} TAGS`),this.redact&&s.push("REDACTED"),s.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=$p,t.title="identifying value, redacted; the REDACT block on the frame reveals it",t;if(t.textContent=e.value,e.decoded!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` ${e.decoded}`,t.appendChild(s)}if(e.distinct!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` (${e.distinct} distinct)`,t.appendChild(s)}return t}groupTraits_declare(){return[Dc(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>NM.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[Dc(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?$p:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Dc(()=>!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 Dc(n){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const t=document.createElement("span");return t.className=n(e)?"tags-fold":"tags-fold tags-fold-none",t}}}function JT(n){const e=new Map;for(const t of n.constant){const s=t.group;e.has(s)||e.set(s,[]),e.get(s)?.push(BM(t,`${s}/${t.tag}`))}return n.varying.length>0&&e.set("varying",n.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}`}))),NM.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function BM(n,e){return{tag:n.tag,name:n.name,vr:n.vr,value:n.value,...n.decoded!==void 0?{decoded:n.decoded}:{},phi:n.phi,items:(n.items??[]).map((t,s)=>({index:s+1,key:`${e}/${s+1}`,rows:t.map(i=>BM(i,`${e}/${s+1}/${i.tag}`))})),key:e}}function eI(n){const e=n.path.replace(/\/$/,"").split("/").pop()??n.path;if(n.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 tI(n){const e=(n.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function sI(n){const e=document.createElement("div");return e.className="tags-note",e.textContent=n,e}function zo(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`tags pane: missing ${e}`);return t}class nI{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 s=this.groups.get(t);if(s!==void 0){s.subscribers.delete(e),s.viewers.delete(e);for(const i of this.membership.values())if(i===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 s=this.group_of(e),i=this.groups.get(s),r={...t,paneId:e};i.value=r;for(const a of i.subscribers.values())a(r);this.writeObserver?.(r,s)}regard_subscribe(e,t){const s=this.groups.get(this.group_of(e));s.subscribers.set(e,t),s.value!==null&&t(s.value)}regard_get(e){return this.groups.get(this.group_of(e))?.value??null}}const Tc=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],iI=new Set(["done","error","unconfirmed","stalled","timeout"]);function rI(n,e){const t=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const s=`${e.operation}:`;for(const i of[...n])(i===t||i.startsWith(s))&&n.delete(i);return}if(e.itemId!==void 0&&e.status!==void 0&&iI.has(e.status)){n.delete(t);return}n.add(t)}const aI=100;class oI{fields;buildShown=!1;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:mi(e,"status-identity"),jobs:mi(e,"status-jobs"),activity:mi(e,"status-activity"),latency:mi(e,"status-latency"),mismatch:mi(e,"status-mismatch"),lamp:mi(e,"status-lamp"),host:mi(e,"status-host")}}attach_show(e){if(e.protocolVersion!==Lc){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${Lc}`,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.":""}promptContext_show(e){const t=e.uri.replace(/^https?:\/\//,"");this.fields.identity.textContent=`${e.user}@${t}`.toUpperCase();const s=e.procWarmup,i=[];if(s!==void 0&&s.sweeping!==!1){const o=s.total!==void 0?`/${s.total}`:"",l=s.state!==void 0?` ${s.state.toUpperCase()}`:"";i.push(`JOBS ${s.loaded}${o}${l}`)}const r=s?.feeds??(s?.feed!==void 0?[s.feed]:[]);for(const o of r){const l=o.total>0?`/${o.total}`:"";i.push(o.failed!==void 0?`FEED ${o.id} FAILED ${o.loaded}${l}`:`FEED ${o.id} ${o.loaded}${l}`)}s?.roster!==void 0&&i.push(s.roster==="full"?"ROSTER WALK":"ROSTER DELTA"),s?.arrived!==void 0&&s.arrived.length>0&&i.push(s.arrived.length<=2?`+FEED ${s.arrived.join(" ")}`:`+${s.arrived.length} FEEDS`);const a=e.warmupFailures??[];a.length>0&&i.push(`WARM-UP FAILED: ${a.map(o=>o.label.toUpperCase()).join(" ")}`),this.fields.jobs.textContent=i.join(" · "),this.fields.jobs.classList.toggle("status-degraded",a.length>0),this.fields.jobs.title=a.length>0?a.map(o=>`${o.label}: ${o.message}`).join(`
4241
4241
  `):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){rI(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=Tc[this.activityFrame]??Tc[0];this.fields.activity.textContent=`${t} ${this.running.size} RUNNING`};e(),this.activityTimer===null&&(this.activityTimer=window.setInterval(()=>{this.activityFrame=(this.activityFrame+1)%Tc.length,e()},aI))}}function mi(n,e){const t=n.getElementById(e);if(t===null)throw new Error(`status bar: no element with id '${e}'`);return t}function lI(n){return n>=6e4?`${Math.max(1,Math.round(n/6e4))} MIN`:`${Math.max(1,Math.round(n/1e3))} S`}function Ds(n){return n.toLocaleString("en-US")}class cI{mount;counts=null;context=null;msPerPage=null;walkSamples=new Map;clock;acts;state=void 0;constructor(e,t=()=>Date.now(),s={}){this.mount=e,this.clock=t,this.acts=s,this.render()}state_show(e){this.state=e,this.render()}pace_show(e){this.msPerPage=e,this.render()}eta_of(e,t,s){const i=this.clock(),r=this.walkSamples.get(e);let a=r?.rowsPerMs??null;r!==void 0&&t>r.loaded&&i>r.at&&(a=(t-r.loaded)/(i-r.at)),(r===void 0||t!==r.loaded)&&this.walkSamples.set(e,{loaded:t,at:i,rowsPerMs:a});const o=Math.max(0,s-t);return s<=0?null:a!==null&&a>0?o/a:this.msPerPage!==null&&this.msPerPage>0?Math.ceil(o/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,s=this.context?.warmupFailures??[],i=t!==void 0&&t.sweeping!==!1,r=this.counts!==null?`${Ds(this.counts.jobs)} JOBS · ${Ds(this.counts.feeds)} FEEDS`:"";if(s.length>0)e.push({label:"INDEX",bar:null,value:`${r}${r?" · ":""}FAILED: ${s.map(l=>l.label.toUpperCase()).join(" ")}`,title:s.map(l=>`${l.label}: ${l.message}`).join(`
4242
4242
  `),degraded:!0});else if(i&&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 ${Ds(t.loaded)} / ${t.total!==void 0?Ds(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:`${Ds(l.running)} IN ${Ds(l.runningFeeds)} FEEDS · SCHEDULED ${Ds(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 ${Ds(l.errored)} IN ${Ds(l.erroredFeeds)} FEEDS`,title:"Open the runs roster filtered to the feeds with errored jobs.",act:this.acts.errored_open}:null})}const a=t?.feeds??(t?.feed!==void 0?[t.feed]:[]);for(const l of Array.from(this.walkSamples.keys()))a.some(c=>c.id===l)||this.walkSamples.delete(l);for(const l of a){const c=l.total>0?Ds(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 ${Ds(l.loaded)} / ${c} · ${l.failed.toUpperCase()}`,title:"The walk stopped; the next visit to the feed starts it again.",degraded:!0});else{const d=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 ${Ds(l.loaded)} / ${c}${d!==null?` · ETA ${lI(d)}`:""}`,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 o=t?.arrived??[];return o.length>0&&e.push({label:"ARRIVED",bar:null,value:o.length<=3?o.map(l=>`FEED ${l}`).join(" · "):`${o.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 s=document.createElement("div");s.className="index-row telemetry-row",s.classList.toggle("status-degraded",t.degraded),s.title=t.title;const i=document.createElement("span");if(i.className="telemetry-label",i.textContent=t.label,s.appendChild(i),t.bar!==null){const a=document.createElement("span");a.className=`index-bar listing-progress listing-progress-${t.bar.state}`;const o=document.createElement("span");o.className="listing-progress-fill";const l=t.bar.total>0?Math.min(100,Math.round(t.bar.loaded/t.bar.total*100)):0;o.style.width=`${l}%`,a.appendChild(o),s.appendChild(a)}const r=document.createElement("span");if(r.className="telemetry-value",r.textContent=t.value,s.appendChild(r),t.verb!==void 0&&t.verb!==null){const a=document.createElement("button");a.type="button",a.className="index-verb pacs-capsule",a.textContent=t.verb.label,a.title=t.verb.title,a.addEventListener("click",t.verb.act),s.appendChild(a)}this.mount.appendChild(s)}}}const dI=3e3;class uI{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 i=(t.running.sinceMs/1e3).toFixed(1);e.push({label:"LANE",value:`${t.running.line} · ${i} 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})}if(this.beatAt===null)e.push({label:"BEAT",value:"NONE YET",title:"No telemetry heartbeat has landed.",degraded:!1});else{const i=Math.max(0,this.clock()-this.beatAt);e.push({label:"BEAT",value:`${(i/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:i>=dI})}const s=this.cube;if(s===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 i=s.msPerPage>0?Math.round(6e4/s.msPerPage):0;e.push({label:"CUBE",value:`${(s.msPerPage/1e3).toFixed(1)} S/PAGE · ${i} PAGES/MIN`,title:`The median of the last ${s.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 s=document.createElement("div");s.className="lane-row telemetry-row",s.classList.toggle("status-degraded",t.degraded),s.title=t.title;const i=document.createElement("span");i.className="telemetry-label",i.textContent=t.label;const r=document.createElement("span");r.className="telemetry-value",r.textContent=t.value,s.append(i,r),this.mount.appendChild(s)}}}const hI=[2,3,3,2,2,11,2,2],fI=4,Vp=300,pI=2600,mI=650;class gI{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(),Vp);return}const t=this.narrowSources_list(),s=this.wideSources_list();let i=0,r=0;for(const a of hI){const o=document.createElement("div");o.className="data-column";for(let l=1;l<=fI;l++){const c=document.createElement("div");c.className=`dc-row-${l}`;let d;a>=6?(d=s[r%s.length],r++):(d=t[i%t.length],i++);const u={element:c,width:a,source:d??(()=>0)};c.textContent=Hp(u.source(),a),o.appendChild(c),this.cells.push(u)}e.appendChild(o)}window.setInterval(()=>this.beat_paint(),Vp),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 s=e.procIndex;s!==void 0&&(t===void 0&&(this.telemetry.jobsLoaded=s.jobs,this.telemetry.jobsTotal=s.jobs),this.telemetry.feeds=s.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 s=`${e.operation}:`;for(const i of[...this.activeOperations])(i===t||i.startsWith(s))&&this.activeOperations.delete(i);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,s=[["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[i,r]of s){const a=document.createElement("div");a.className="telemetry-row";const o=document.createElement("span");o.className="telemetry-label",o.textContent=i;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r(),a.append(o,l),e.appendChild(a),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,()=>MI()]}uptimeSeconds_get(){return Math.floor((Date.now()-this.bootedAt)/1e3)}beat_paint(){for(const e of this.cells){const t=Hp(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"),mI))},pI)}}function Hp(n,e){const t=String(Math.max(0,Math.floor(n)));return t.length>e?t.slice(t.length-e):t.padStart(e,"0")}function MI(){const n=new Date;return n.getHours()*1e4+n.getMinutes()*100+n.getSeconds()}const bI=2e4;class _I{scene;nameplate;command_run;names=[];cursor=0;timer=null;seen=new Map;constructor(e,t,s){this.nameplate=t,this.command_run=s,this.scene=new xl(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(),bI)))}envelope_observe(e){if(e.model?.kind!==Xn.pipelineDiagram)return;const t=ou.safeParse(e.model.data);if(!t.success)return;const s=t.data;this.seen.set(s.name,s),this.model_stage(s)}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 zI(n,e){n.line_execute("ls /bin",{silent:!0,observe:!1}).then(t=>{const r=(t.envelopes.find(a=>a.model?.kind==="fs.listing")?.model?.data??[]).flatMap(a=>a.items).filter(a=>a.type==="pipeline").map(a=>a.name);e.names_set(r)})}const wI=new Set(["files","dag","pacs"]);function qp(n){return wI.has(n)}const CM=new Map,Lr=new Map;let yI=0;function Os(n,e){CM.set(n,e)}function vI(n){const e=CM.get(n);if(e===void 0)throw new Error(`no pane factory registered for kind '${n}'`);const t=e(`${n}-${yI++}`);return Lr.set(t.id,t),t}function mr(n){Lr.set(n.id,n)}function Ro(n){return Lr.get(n)}function No(){return[...Lr.values()]}function es(n){const e=Lr.get(n);e!==void 0&&(Lr.delete(n),e.dispose?.(),e.mount.remove())}class OI{byId=new Map;set(e,t,s){this.byId.set(t,{kind:e,panel:s})}get(e,t){const s=this.byId.get(t);return s!==void 0&&s.kind===e?s.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[s,i]of this.byId)i.kind===e&&t.push([s,i.panel]);return t}values(e){return this.entries(e).map(([,t])=>t)}idOf(e,t){for(const[s,i]of this.byId)if(i.kind===e&&i.panel===t)return s;return null}}function Sa(n,e){if("pane"in n)return n.pane===e?[]:null;const t=Sa(n.first,e);if(t!==null)return[{node:n,side:"first"},...t];const s=Sa(n.second,e);return s!==null?[{node:n,side:"second"},...s]:null}function Ea(n,e,t){if(n===e)return t;if("pane"in n)return null;const s=Ea(n.first,e,t);if(s!==null)return{...n,first:s};const i=Ea(n.second,e,t);return i!==null?{...n,second:i}:null}function Xp(n,e,t){const s=Sa(n,e);if(s===null||s.length===0)return"lone";const i=ms[t].axis,r=ms[t].place==="after"?"first":"second",a=s[s.length-1];let o=null;for(let u=s.length-1;u>=0;u-=1){const h=s[u];if(h.node.dir===i&&h.side===r){o=h.side==="first"?h.node.second:h.node.first;break}}if(o===null){if(a.node.dir===i)return"edge";o=a.side==="first"?a.node.second:a.node.first}const l=cl(n,e);if(l===null)return"lone";const c={pane:e};return Ea(l,o,r==="first"?{dir:i,ratio:.5,first:o,second:c}:{dir:i,ratio:.5,first:c,second:o})??"edge"}const Kp="argus-layout";class xI{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 s=window.localStorage.getItem(Kp);this.prefs=s!==null?JSON.parse(s):{}}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,s,i=!1){if(this.tree===null)return!1;const r=ll(this.tree,e,{dir:t,ratio:.5,first:i?{pane:s}:{pane:e},second:i?{pane:e}:{pane:s}});return r===null?!1:(this.tree=r,this.focusedPane=s,this.render(),!0)}leaf_move(e,t){if(this.tree===null)return"lone";const s=Xp(this.tree,e,t);return typeof s=="string"?s:(this.tree=s,this.focusedPane=e,this.render(),!0)}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=Sa(this.tree,e);if(t===null||t.length===0)return!1;const s=t[t.length-1],i={...s.node,dir:s.node.dir==="col"?"row":"col"},r=Ea(this.tree,s.node,i);return r===null?!1:(this.tree=r,this.render(),!0)}leaf_resize(e,t,s=.05){if(this.tree===null)return!1;const i=Sa(this.tree,e);if(i===null||i.length===0)return!1;const r=ms[t].axis;for(let a=i.length-1;a>=0;a-=1){const o=i[a];if(o.node.dir!==r)continue;const l=ms[t].place==="after",c=Math.min(.85,Math.max(.15,o.node.ratio+(l?s:-s))),d={...o.node,ratio:c},u=Ea(this.tree,o.node,d);return u===null?!1:(this.tree=u,this.ratio_remember(i.slice(0,a).map(h=>h.side==="first"?"0":"1").join(""),c),this.render(),!0)}return!1}move_possible(e,t){return this.tree!==null&&typeof Xp(this.tree,e,t)!="string"}leaf_replace(e,t){if(this.tree===null)return!1;const s=ll(this.tree,e,{pane:t});return s===null?!1:(this.tree=s,this.focusedPane===e&&(this.focusedPane=t),this.render(),!0)}leaf_close(e){if(this.tree===null||"pane"in this.tree)return!1;const t=cl(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_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=s=>{if(s!==null){if("pane"in s){e.push(s.pane);return}t(s.first),t(s.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 s=this.focusedPane;this.focusedPane=null,this.focus_set(t),s!==null&&(this.previousFocus=s)}node_render(e,t){if("pane"in e){const o=document.createElement("div");o.className="layout-leaf",o.dataset.leaf=e.pane;const l=this.mounts.get(e.pane);return l!==void 0&&(o.appendChild(l),l.style.display="",o.addEventListener("mousedown",()=>this.focus_set(e.pane),{capture:!0}),e.pane===this.focusedPane&&o.classList.add("pane-focused")),o}const s=document.createElement("div");s.className=`layout-split layout-${e.dir}`;const i=this.node_render(e.first,`${t}0`),r=this.node_render(e.second,`${t}1`);i.style.flex=`${e.ratio} 1 0`,r.style.flex=`${1-e.ratio} 1 0`;const a=document.createElement("div");return a.className="layout-divider",this.divider_wire(a,s,e,i,r,t),s.append(i,a,r),s}divider_wire(e,t,s,i,r,a){let o=!1;e.addEventListener("mousedown",l=>{o=!0,l.preventDefault()}),window.addEventListener("mousemove",l=>{if(!o)return;const c=t.getBoundingClientRect(),d=s.dir==="col"?(l.clientX-c.left)/c.width:(l.clientY-c.top)/c.height;s.ratio=Math.min(.85,Math.max(.15,d)),i.style.flex=`${s.ratio} 1 0`,r.style.flex=`${1-s.ratio} 1 0`}),window.addEventListener("mouseup",()=>{o&&(o=!1,this.ratio_remember(a,s.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 s of this.root.querySelectorAll(".layout-leaf"))s.classList.remove("pane-focused");this.mounts.get(e)?.parentElement?.classList.add("pane-focused")}ratios_restore(e,t,s){if("pane"in e)return e;const i=this.prefs.ratios?.[`${t}:${s}`];return{...e,ratio:i??e.ratio,first:this.ratios_restore(e.first,t,`${s}0`),second:this.ratios_restore(e.second,t,`${s}1`)}}ratio_remember(e,t){this.prefs.ratios={...this.prefs.ratios??{},[`${this.activePreset}:${e}`]:t},this.prefs_save()}prefs_save(){try{window.localStorage.setItem(Kp,JSON.stringify(this.prefs))}catch{}}}function ll(n,e,t){if("pane"in n)return n.pane===e?t:null;const s=ll(n.first,e,t);if(s!==null)return{...n,first:s};const i=ll(n.second,e,t);return i!==null?{...n,second:i}:null}function cl(n,e){if("pane"in n)return null;if("pane"in n.first&&n.first.pane===e)return n.second;if("pane"in n.second&&n.second.pane===e)return n.first;const t=cl(n.first,e);if(t!==null)return{...n,first:t};const s=cl(n.second,e);return s!==null?{...n,second:s}:null}const SI=4e3;function EI(n){const e=new WeakMap,t=(o,l)=>{const c=n.paneInstance_get(o)?.mount.querySelector(".pane-state")??null;if(c===null)return;const d=e.get(c);d!==void 0&&clearTimeout(d);const u={text:c.textContent??"",className:c.className};Jt(c,"note",l),e.set(c,setTimeout(()=>{e.delete(c),c.textContent===l&&(c.className=u.className,c.textContent=u.text)},SI))};return{bar_note:t,move:(o,l)=>{const c=n.layout.leaf_move(o,l);return c==="lone"?"pane move: the only pane on stage":c==="edge"?`pane move ${l}: already ${ms[l].edge}`:(t(o,`MOVED ${l.toUpperCase()}`),n.sound("audio3"),`moved ${l}`)},flip:o=>n.layout.leaf_flip(o)?(t(o,"FLIPPED"),n.sound("audio3"),"flipped"):"pane flip: the only pane on stage",resize:(o,l,c)=>n.layout.leaf_resize(o,l,c)?`resized ${ms[l].focusWord}`:`pane resize ${ms[l].focusWord}: no boundary that way`,chordKeys_of:(o,l)=>{const c=Bi.filter(d=>d.selector===o&&d.move===!0===l).map(d=>d.key);return c.length===0?"":` [keys ${c.join(" ")}]`}}}const AI={image:"viewer",view:"viewer",dir:"files",fs:"files",tags:"tags",empty:"pane",domain:"dag",catalogue:"catalogue",graph:"dag",gather:"gather",edit:"editor"},Ic=240;function DI(n,e){const{layout:t,panels:s,paneInstance_get:i,dormant:r}=n,a=new Map;let o=!1,l=null;const c=w=>i(w)?.kind??null,d=(w,_,v,O,S)=>{a.set(w,{parent:_,dir:v,before:O,...S!==void 0?{binding:S}:{}})},u=w=>{if(w==="pacs")return"⊞";if(w==="dag")return"⋔";const _=c(w);return _==="image"?"▣":_==="tags"?"≣":_==="edit"?"✎":"▤"},h=w=>{if(w.length===0)return;const _=[];for(const A of w){const I=i(A)?.mount;if(I===void 0)continue;const G=I.getBoundingClientRect();G.width>0&&G.height>0&&_.push({id:A,left:G.left,top:G.top,width:G.width,height:G.height})}if(_.length===0)return;const v=Math.min(..._.map(A=>A.left)),O=Math.min(..._.map(A=>A.top)),S=Math.max(..._.map(A=>A.left+A.width))-v,M=Math.max(..._.map(A=>A.top+A.height))-O;if(S<=0||M<=0)return;const y=Ic/S,E=Math.max(40,Math.min(260,Math.round(M*y)));try{const A=document.createElement("canvas");A.width=Ic,A.height=E;const I=A.getContext("2d");if(I===null)return;const C=getComputedStyle(document.documentElement).getPropertyValue("--harvestgold").trim()||"#c9a15a";I.fillStyle="#05070a",I.fillRect(0,0,Ic,E);for(const B of _){const P=Math.round((B.left-v)*y),L=Math.round((B.top-O)*y),H=Math.max(6,Math.round(B.width*y)),X=Math.max(6,Math.round(B.height*y)),oe=i(B.id)?.mount.querySelector("canvas");if(oe!=null&&oe.width>0){const J=Math.min(H/oe.width,X/oe.height),ce=Math.round(oe.width*J),We=Math.round(oe.height*J);I.fillStyle="#000",I.fillRect(P,L,H,X),I.drawImage(oe,P+Math.round((H-ce)/2),L+Math.round((X-We)/2),ce,We)}else I.fillStyle="rgba(255,255,255,0.05)",I.fillRect(P,L,H,X),I.fillStyle=C,I.font=`${Math.max(9,Math.min(28,Math.round(Math.min(H,X)*.5)))}px serif`,I.textAlign="center",I.textBaseline="middle",I.fillText(u(B.id),P+H/2,L+X/2+1);I.strokeStyle="rgba(255,255,255,0.22)",I.lineWidth=1,I.strokeRect(P+.5,L+.5,H-1,X-1)}return A.toDataURL("image/png")}catch{return}},p=(w,_,v)=>{const O=c(w),S=a.get(w),M={dir:S?.dir??"col",side:Wy(S?.before??!1)};if(qp(w)){const E=_==="dag"?"runs":_,A=_==="pacs"?e.pacsQuery_get():null,I=_==="dag"?s.get("dag","dag"):void 0,G=I!==void 0&&I.graph_isShown()?I.feed_get():null,C=G!==null&&I!==void 0?I.view_lines():[],B=G!==null?I?.feedTitle_get():void 0;return{action:{op:"domain",domain:E,...A!==null?{query:A}:{},...G!==null?{feed:G}:{},...C.length>0?{view:C}:{}},...B!==void 0?{label:B}:{}}}if(S?.binding==="fs"||S?.binding==="view"||S?.binding==="empty")return{action:{op:S.binding,target:v,...M}};if(O==="image"){const E=s.get("image",w),A=E?.state_get()??null;if(E===void 0||A===null||A.path===null)return null;const I=[];A.layout!=="single"&&I.push(`image layout ${A.layout}`),A.colormap!==void 0&&A.colormap!=="gray"&&I.push(`image colormap ${A.colormap}`),A.voi!==void 0&&A.voi!==null&&I.push(`image wl ${A.voi.lower} ${A.voi.upper}`),A.slice>1&&I.push(`image slice ${A.slice}`),A.ghost!==void 0&&A.ghost!==null&&A.layout==="slab"&&I.push(`image ghost ${A.ghost}`);const G=E.series_get(),C=[G?.seriesDescription??"",G?.modality??""].filter(B=>B!=="");return{action:{op:"image",path:A.path,target:v,...M,...I.length>0?{view:I}:{}},anchor:A.path,...C.length>0?{label:C.join(" · ")}:{}}}const y=e.catalogue_of(w);if(y!==void 0){const E=s.get("files",w)?.commandLine_get()??"";return{action:{op:"catalogue",input:y.input,target:v,...M,...y.feed!==null?{feed:y.feed}:{},...y.node!==null?{node:y.node}:{},...E!==""?{line:E}:{}},label:`PROCESS ${y.input.split("/").filter(Boolean).pop()??y.input}`}}if(O==="files"){const E=s.get("files",w)?.path_current()??null;return typeof E!="string"||E.length===0?null:{action:{op:"dir",path:E,target:v,...M}}}if(O==="gather"){const E=s.get("gather",w);if(E===void 0)return null;const A=[...E.entries_get()],I=E.name_get(),G=E.feed_get();return{action:{op:"gather",series:A,target:v,...M,...I!==null?{name:I}:{},...G!==null?{feed:G.feedId,root:{instance:G.rootInstanceId,path:G.path}}:{}},label:I??`GATHER · ${A.length} series`}}if(O==="dag"){const E=s.get("dag",w)?.feed_get()??null;return E===null?null:{action:{op:"graph",feed:E,target:v,...M}}}if(O==="tags")return{action:{op:"tags",target:v,...M}};if(O==="edit"){const E=s.get("edit",w)?.path_get()??null;return E===null?null:{action:{op:"edit",path:E,target:v,...M},label:`EDIT ${E.split("/").pop()??E}`}}return null},f=()=>{if(o)return;const w=new Set(t.panes_shown()),_=t.activePreset_get();if(_==="panes"||_==="launcher")return;const v=No().map(X=>X.id).filter(X=>w.has(X)),O=new Map;let S,M;const y=[];for(const X of v){const oe=O.get(a.get(X)?.parent??"")??0,J=p(X,_,oe);J!==null&&(O.set(X,y.length),y.push(J.action),J.anchor!==void 0?S===void 0&&(S=J.anchor,J.label!==void 0&&(M=J.label)):J.label!==void 0&&M===void 0&&(M=J.label))}const E=y.filter(X=>X.op!=="domain"||X.feed!==void 0);if(E.length===0)return;const A=h(v),I=X=>{if("pane"in X){const ce=O.get(X.pane);return ce===void 0?null:{leaf:ce}}const oe=I(X.first),J=I(X.second);return oe===null?J:J===null?oe:{dir:X.dir,ratio:X.ratio,first:oe,second:J}},G=t.tree_get(),C=G===null?null:I(G),B=[...new Set(E.map(X=>AI[X.op]??"pane"))];let P,L,H;if(S!==void 0)P=S,L=M??S.split("/").pop()??S,H={address:S,modelKind:"dicom.series"};else{const X=E.map(ce=>ce.path).find(ce=>ce!==void 0),oe=E.map(ce=>ce.path??(ce.input!==void 0?`catalogue:${ce.input}`:ce.series!==void 0?`gather:${ce.series.map(We=>We.seriesUID).join(",")}`:ce.feed!==void 0?`feed:${ce.feed}`:ce.op)).sort().join("|"),J=_==="dag"?"RUNS":_.toUpperCase();P=`${_}:${oe}`,L=M!==void 0&&M!==""?M:X!==void 0?X.split("/").pop()??X:`${J} · ${E.length+1} panes`,H={address:P,modelKind:"argus.desktop"}}r.add({id:P,label:L,regard:H,members:B,actions:y,...C===null?{}:{shape:C},...A===void 0?{}:{thumbnail:A},lastTouched:Date.now()})},b=()=>{const w=new Set(t.panes_shown());for(const _ of No())w.has(_.id)||qp(_.id)||_.id==="panes"||_.id==="launcher"||_.id==="universe"||(es(_.id),t.mount_remove(_.id));e.stage_relight()},g=w=>{f(),t.preset_apply(w),b()},m=(w,_)=>{const v=y=>No().filter(E=>t.panes_shown().includes(E.id)&&c(E.id)===y).map(E=>E.id),O={dir:w.dir??"col",before:w.side==="before"},S=y=>{l=O;try{return y()}finally{l=null}},M=(y,E)=>v(y).find(A=>!E.has(A))??null;if(w.op==="domain"){const y=w.domain==="runs"?"dag":w.domain==="pacs"?"pacs":"files";if(g(y),w.query!==void 0&&n.terminal.line_run(w.query),w.feed!==void 0){const E=w.feed,A=w.view??[],I=s.get("dag","dag");if(I?.feed_enter(E),A.length>0&&I!==void 0){const G=C=>{if(I.graph_isShown()&&I.feed_get()===E){for(const B of A)n.terminal.line_run(B);return}C>0&&window.setTimeout(()=>G(C-1),250)};G(240)}}return y}if(_!==null&&t.focus_set(_),w.op==="image"&&w.path!==void 0){let y=null;const E=w.path,A=S(()=>e.image_open(null,E,{},C=>{y=C})),I=w.view,G=y;return I!==void 0&&I.length>0&&G!==null&&A.then(()=>{for(const C of I)t.focus_set(G),n.terminal.line_run(C)}).catch(()=>{}),y}if(w.op==="dir"&&w.path!==void 0){const y=new Set(v("files")),E=w.path;return S(()=>e.dir_open(E)),M("files",y)}if(w.op==="tags"){const y=new Set(v("tags"));return S(()=>n.terminal.line_run("image tags")),M("tags",y)}if(w.op==="catalogue"&&w.input!==void 0){const y=()=>e.catalogueIds().filter(G=>t.panes_shown().includes(G)),E=new Set(y()),A=w.input;S(()=>e.process_open(_??"files",{input:A,feed:w.feed??null,node:w.node??null}));const I=y().find(G=>!E.has(G))??null;return I!==null&&w.line!==void 0&&s.get("files",I)?.commandLine_set(w.line),I}if(w.op==="gather"&&w.series!==void 0){const y=[...w.series],E=S(()=>e.gather_open(y,_??"pacs"));return E!==null&&w.name!==void 0&&s.get("gather",E)?.name_set(w.name),E!==null&&w.feed!==void 0&&w.root!==void 0&&s.get("gather",E)?.feed_set({feedId:w.feed,rootInstanceId:w.root.instance,path:w.root.path}),E}if(w.op==="graph"&&w.feed!==void 0){const y=new Set(v("dag")),E=w.feed;return S(()=>e.feed_open(_??"files",E)),M("dag",y)}if(w.op==="edit"&&w.path!==void 0){const y=w.path;return S(()=>e.edit_open(y))}return w.op==="fs"||w.op==="view"||w.op==="empty"?_===null?null:e.pillPane_spawn(_,w.op,O.dir,O.before):null};return{birth_record:d,replayPlace_get:()=>l,replaying:()=>o,strip_capture:h,capture:f,orphans_dispose:b,domain_enter:g,restore:async w=>{const _=r.get(w);if(!(_===void 0||_.actions===void 0)){r.dismiss(w),o=!0;try{const v=[];for(const O of _.actions){const S=v[O.target??0]??null;v.push(m(O,S))}if(_.shape!==void 0){const O=M=>{if("leaf"in M){const A=v[M.leaf]??null;return A===null?null:{pane:A}}const y=O(M.first),E=O(M.second);return y===null?E:E===null?y:{dir:M.dir,ratio:M.ratio,first:y,second:E}},S=O(_.shape);S!==null&&!("pane"in S)&&t.tree_set(S)}}finally{o=!1,e.stage_relight()}}}}}const TI=2200;function II(n){return/\x1b\[/.test(n)?mn(n):xs(n).replace(/(&quot;[^&]*&quot;)/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 GI(n,e,t,s){if(n===void 0)return[];const i=n.arguments??[],r=[{label:"NODE",value:`${n.label} · @${n.id}`},{label:"PLUGIN",value:n.pluginName},...n.pluginVersion!==void 0?[{label:"VERSION",value:n.pluginVersion}]:[]];if(e){const a=ev(n.label,n.id,s);r.push(...i.length===0?[{label:"ARGUMENTS",value:"none — this node runs on the plugin's defaults"}]:i.map(o=>({label:o.name,value:String(o.value??""),...t?{edit:{flag:`--${a}.${o.name}`,type:typeof o.value=="boolean"?"boolean":"string",placeholder:String(o.value??"")}}:{}})))}else r.push({label:"ARGUMENTS",value:i.length===0?"none":`${i.length} — open the node to read them`});return r}function RI(n,e,t){const s=[{label:"PLUGIN",value:n.name},{label:"VERSION",value:n.version},{label:"TYPE",value:n.type.toUpperCase()}],i=n.parameters;if(!e)return s.push({label:"PARAMETERS",value:i.length===0?"none":`${i.length} — open the node to read them`}),s;if(i.length===0)return s.push({label:"PARAMETERS",value:"none — this plugin takes no arguments"}),s;for(const r of i){const a=[r.type];r.optional||a.push("required");const o=r.default===void 0||r.default===null?"":String(r.default);o!==""&&a.push(`default ${o}`);const l=a.join(" · ");s.push({label:r.flag,value:r.help===void 0?l:`${l} — ${r.help}`,...t?{edit:{flag:r.flag,type:r.type,placeholder:o}}:{}})}return s}function Yp(n,e,t,s){n.replaceChildren(),n.classList.toggle("dag-facts-immersed",t);for(const{label:i,value:r,edit:a}of e){const o=document.createElement("div");o.className="telemetry-row";const l=document.createElement("span");if(l.className="telemetry-label",l.textContent=i,o.appendChild(l),a===void 0||s===null){const c=document.createElement("span");c.className="telemetry-value",c.textContent=r,o.appendChild(c)}else{const c=Zy(s.line_get(),a.flag),d=document.createElement("input");d.className="telemetry-input",d.spellcheck=!1,d.autocomplete="off",d.title=`${a.flag} — ${r}`,a.type==="boolean"?(d.type="checkbox",d.checked=c===!0,d.addEventListener("change",()=>{s.line_set(lf(s.line_get(),a.flag,d.checked?!0:null))})):(d.type="text",d.placeholder=a.placeholder,d.value=c===null||c===!0?"":c,d.addEventListener("input",()=>{s.line_set(lf(s.line_get(),a.flag,d.value))}));const u=document.createElement("span");u.className="telemetry-hint",u.textContent=r,o.append(d,u)}n.appendChild(o)}}function NI(n,e,t,s){const i=n.closest(".files-body"),r=i?.querySelector(".diagram-strategy")??null,a=i?.querySelector(".diagram-projection")??null,o=i?.querySelector(".diagram-pulse")??null,l=s===void 0?null:i?.querySelector(".diagram-run")??null,c=()=>s?.(),d=()=>{const f=[];e.strategy_get()!=="ranked"&&f.push("MOLECULE"),e.projection_get()!=="3d"&&f.push("2D"),t.mode_annunciate(f.join(" · "))},u=()=>{e.strategy_set(e.strategy_get()==="ranked"?"molecule":"ranked"),r!==null&&(r.textContent=e.strategy_get().toUpperCase()),d()},h=()=>{e.projection_set(e.projection_get()==="3d"?"2d":"3d"),a!==null&&(a.textContent=e.projection_get().toUpperCase()),d()},p=()=>{e.wave_start(),o?.classList.add("pulse-running"),window.setTimeout(()=>o?.classList.remove("pulse-running"),TI)};return r!==null&&(r.textContent=e.strategy_get().toUpperCase()),a!==null&&(a.textContent=e.projection_get().toUpperCase()),r?.addEventListener("click",u),a?.addEventListener("click",h),o?.addEventListener("click",p),l?.addEventListener("click",c),d(),()=>{r?.removeEventListener("click",u),a?.removeEventListener("click",h),o?.removeEventListener("click",p),l?.removeEventListener("click",c),o?.classList.remove("pulse-running")}}function BI(n,e){let t=null;const s=(c,d,u,h)=>{let p=null,f=null;const b=c.contentHtml_show(d,"",{diagram:!0,release:()=>{t=null,f?.(),f=null,c.mode_annunciate(""),p?.dispose(),p=null}});b!==null&&u().then(g=>{if(!b.isConnected)return;if(g===null||g.nodes.length===0){b.textContent="NOTHING TO DRAW FOR THIS ENTRY",b.classList.add("files-diagram-empty");return}g.text!==""&&c.contentText_set(g.text);const m=document.createElement("div");m.className="dag-facts",Vs(m),b.appendChild(m);const z=new xl(b,{select:v=>g.facts_show(m,v.id,!1,h),activate:v=>w(v),deselect:()=>m.replaceChildren()},{}),w=v=>{z.flight_into(v.id,()=>{t={scene:z,facts:m},g.facts_show(m,v.id,!0,h)})};p=z,z.graph_set({nodes:g.nodes},{wave:!1}),z.size_fit(),f=NI(b,z,c,h===null?void 0:h.run);const _=g.nodes.length===1?g.nodes[0]:void 0;_!==void 0&&w(_)})},i=async c=>{const d=/_id(\d+)$/.exec(c)?.[1]??c.replace(/^.*\//,""),[u,h]=await Promise.all([n.client.line_execute(`cat "${c}"`,{silent:!0,observe:!1}),n.client.line_execute(`pipeline diagram ${d}`,{silent:!0,observe:!1})]),p=u.envelopes.map(f=>f.rendered).join(`
4243
4243
  `);for(const f of h.envelopes){if(f.model?.kind!==Xn.pipelineDiagram)continue;const b=ou.safeParse(f.model.data);if(!b.success)continue;const g=new Map(b.data.nodes.map(m=>[m.id,m]));return{text:II(p),nodes:b.data.nodes.map(m=>({id:m.id,label:m.label,parentIds:m.parentIds,joinParentIds:m.joinParentIds})),facts_show:(m,z,w,_)=>{const v=b.data.nodes.map(O=>O.label);Yp(m,GI(g.get(z),w,_!==null,v),w,_)}}}return null},r=async c=>{const d=c.replace(/^.*\//,""),u=await n.client.line_execute(`plugin info "${d}"`,{silent:!0,observe:!1});for(const h of u.envelopes){if(h.model?.kind!==Q_)continue;const p=Z_.safeParse(h.model.data);if(!p.success)continue;const f=p.data;return{text:"",nodes:[{id:d,label:f.name,parentIds:[],joinParentIds:[]}],facts_show:(b,g,m,z)=>{Yp(b,RI(f,m,z!==null),m,z)}}}return null},a=(c,d,u,h)=>{const p=e.catalogue_of(c);if(p===void 0)return null;const f=u.replace(/^.*\//,"");return yg(d.commandLine_get())!==f&&d.commandLine_set(_g(p.input,f)),{line_get:()=>d.commandLine_get(),line_set:b=>d.commandLine_set(b),run:()=>e.run_press(c,f,h)}};return{entry_show:(c,d,u,h)=>{s(d,u,()=>h==="plugin"?r(u):i(u),a(c,d,u,h))},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 CI(n,e){const{panels:t,paneInstance_get:s,subjects:i}=n,r=new Map,a=p=>t.get("dag",p)??t.get("universe",p),o=(p,f)=>{const b=r.get(p);if(b===void 0){f?.();return}r.delete(p),b.element.classList.remove("node-overlay-open");const g=()=>{b.element.remove(),f?.()},m=a(p);m!==void 0?m.flight_back(g):g()},l=(p,f,b,g,m)=>{if(m.kind==="dir"){const z=f.replace(/\/+$/,"");if(m.path!==z&&!m.path.startsWith(`${z}/`)){o(p),n.sound("audio3");return}const w=m.path.startsWith("/proc/jobs/")?(m.path.split("/").pop()??"").match(/_(\d+)$/):null;if(w!==null){const v=parseInt(w[1]??"",10);o(p,()=>{a(p)?.node_flyTo(v)!==!0&&c(p,m.path)});return}const _=b.path_current();_!==null&&g.push(_),e.rootedListing_show(p,b,m.path);return}if(i.regard_write(p,{address:m.path,modelKind:"fs.file"}),!i.groupHasViewer(p)){if(e.imagery_is(m.path)){e.image_open(p,m.path).then(z=>n.terminal.line_note(z));return}if(gl(m.path)){b.contentImage_show(m.path,e.vfsUrl_build(m.path));return}e.fileText_fetch(m.path).then(z=>{if(!z.ok){b.contentRefused_show(m.path,z.text);return}e.tableFile_is(m.path)?b.contentTable_show(m.path,z.text):b.content_show(m.path,z.text)})}},c=(p,f)=>{const g=s(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)){n.terminal.line_note(`dag: ${f}: ${g===null?"this pane has no scene to fly in":"a node is already open here"} — flew back out`),a(p)?.flight_back(()=>{});return}const z=document.createElement("div");z.className="node-overlay",z.setAttribute("aria-label",`inside ${f}`);const w=e.filesBody_stamp();w.classList.add("node-overlay-body");const _=document.createElement("button");_.type="button",_.className="strategy-pill node-overlay-exit",_.title="leave the node (Esc)",_.textContent="EXIT NODE",w.querySelector(".mode-frame")?.prepend(_),z.append(w);const v=w.querySelector(".files-panel");if(v===null)throw new Error("pane template is missing .files-panel");const O=[],S=new pg(v,M=>l(p,f,S,O,M),e.previewProvider);S.rowVerbs_declare((M,y)=>e.rowVerbs_of(p,M,y),(M,y)=>{i.regard_write(p,{address:y,modelKind:"fs.file"})}),r.set(p,{element:z,panel:S,history:O}),S.ceiling_set(f,"EXIT NODE"),_.addEventListener("click",()=>{o(p),n.sound("audio3")}),g.appendChild(z),window.requestAnimationFrame(()=>z.classList.add("node-overlay-open")),e.rootedListing_show(p,S,f)};return{open:c,close:o,back:p=>{const f=r.get(p),b=f?.history.pop();f!==void 0&&b!==void 0&&e.rootedListing_show(p,f.panel,b)},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():o(p),!0},dispose:p=>{r.get(p)?.element.remove(),r.delete(p)}}}const ba=[];function PM(){const n=ba[ba.length-1];return n===void 0?!1:(n(),!0)}function PI(n){const e=n.querySelector(":scope > .pane-drawer");if(e!==null)return e.nextElementSibling;const t=n.querySelector(":scope > .lcars-terminal-header-bar");return t===null?n.firstElementChild:t.nextElementSibling}function Zp(n,e){if(n.querySelector(":scope > .ask-bar")!==null)return Promise.resolve(null);const t=document.createElement("div");t.className=e.kind==="choose"?"ask-bar ask-bar-choose":"ask-bar";const s=document.createElement("span");s.className="ask-bar-glyph",s.textContent="?";const i=document.createElement("span");i.className="ask-bar-caption",i.textContent=e.message.trim(),t.append(s,i);const r=document.createElement("input"),a=document.createElement("button"),o=document.createElement("button"),l=document.createElement("button"),c=document.createElement("button");if(c.className="pacs-capsule ask-bar-abandon",c.textContent=e.close??"ABANDON",c.title="abandon the question (Esc)",e.kind==="confirm")a.className="pacs-capsule ask-bar-yes",a.textContent="YES",o.className="pacs-capsule ask-bar-no",o.textContent="NO",t.append(a,o,c);else{for(const u of e.choices??[]){const h=document.createElement("button");h.className=`pacs-capsule ask-bar-choice${u.held===!0?" ask-bar-held":""}`,h.textContent=u.label??u.value,h.dataset.value=u.value,h.disabled=u.held===!0,t.append(h)}r.className="ask-bar-field",r.spellcheck=!1,e.kind==="secret"?r.type="password":e.suggest!==void 0&&(r.value=e.suggest),l.className="pacs-capsule ask-bar-commit",l.textContent=e.commit??"ANSWER",t.append(r,l,c)}const d=PI(n);return d===null?n.appendChild(t):n.insertBefore(t,d),window.requestAnimationFrame(()=>t.classList.add("ask-bar-shown")),new Promise(u=>{let h=!1;const p=g=>{if(h)return;h=!0;const m=ba.indexOf(f);m>=0&&ba.splice(m,1),t.remove(),u(g)},f=()=>p(null);ba.push(f);const b=()=>{const g=r.value.trim();p(g===""?null:g)};l.addEventListener("click",b);for(const g of t.querySelectorAll(".ask-bar-choice"))g.addEventListener("click",()=>p(g.dataset.value??null));a.addEventListener("click",()=>p("y")),o.addEventListener("click",()=>p("n")),c.addEventListener("click",f),t.addEventListener("keydown",g=>{if(g.key==="Escape"){g.stopPropagation(),f();return}if(e.kind==="confirm"){g.key==="y"||g.key==="Y"?(g.stopPropagation(),p("y")):g.key==="n"||g.key==="N"||g.key==="Enter"&&g.target===o?(g.stopPropagation(),p("n")):g.key==="Enter"&&(g.stopPropagation(),p("y"));return}g.key==="Enter"&&(g.stopPropagation(),b())}),e.kind==="confirm"?a.focus():(r.focus(),r.select())})}async function LM(n,e,t){if(n.ask_isOpen()){const a=n.ask_note(t.message),o=await Zp(e,t);return a(t.kind==="secret"&&o!==null?"••••••":o),o}const s=Zp(e,t).then(a=>({from:"pane",answer:a})),i=n.ask_open({message:t.message,kind:t.kind==="choose"?"text":t.kind,focus:!1,...t.suggest===void 0?{}:{suggest:t.suggest}}).then(a=>({from:"console",answer:a})),r=await Promise.race([s,i]);return r.from==="console"?PM():n.ask_settle(r.answer),r.answer}function LI(n,e){const{panels:t,paneInstance_get:s}=n;let i=null,r=null;const a=()=>{const{layout:h}=n,p=h.tree_get();if(p===null)return null;const f=[],b=m=>{if("pane"in m){f.push(m.pane);return}b(m.first),b(m.second)};b(p);const g=h.focused_get();return g!==null&&f.includes(g)?g:f[0]??null};return{errandHost_find:a,errand_open:async h=>{const{layout:p,terminal:f}=n,b=a();if(b===null)return null;const g=e.instance_spawn("files"),m=e.replayPlace_get();if(!p.leaf_split(b,m?.dir??"col",g.id,m?.before??!1))return es(g.id),p.mount_remove(g.id),null;e.birth_record(g.id,b,m?.dir??"col",m?.before??!1);const z=t.get("files",g.id),w=h.path?.anchor??"~";z!==void 0&&e.rootedListing_show(g.id,z,w);const _=g.mount.querySelector(".files-body");if(_===null)return es(g.id),p.mount_remove(g.id),null;const v=document.createElement("div");v.className="errand-bar",_.insertBefore(v,_.firstChild);const O=document.createElement("span");O.className="errand-caption",O.textContent=h.message.trim();const S=document.createElement("input");S.className="errand-path",S.spellcheck=!1;const M=document.createElement("button");M.className="pacs-capsule errand-commit",M.textContent=h.commit??"USE THIS",v.append(O,S,M);const y=()=>{const I=z?.path_current()??w,G=h.path?.suggest;S.value=h.path?.wantsDirectory===!0||G===void 0?I:`${I.replace(/\/$/,"")}/${G}`};y();let E=!1;S.addEventListener("input",()=>{E=!0});const A=()=>{E||y()};return g.mount.addEventListener("click",A),f.question_set(!0),new Promise(I=>{const G=C=>{g.mount.removeEventListener("click",A),f.question_set(!1),i=null,p.leaf_close(g.id),es(g.id),p.mount_remove(g.id),I(C)};i=()=>G(null),M.addEventListener("click",()=>G(S.value.trim()===""?null:S.value.trim())),S.addEventListener("keydown",C=>{C.key==="Enter"&&G(S.value.trim()===""?null:S.value.trim())})})},errand_abandon:()=>i===null?!1:(i(),!0),verbLine_run:(h,p)=>{r=h,n.terminal.line_run(p)},askingPane_take:()=>{const h=r;return r=null,h},ask_onPane:async(h,p)=>{const{terminal:f}=n,b=s(h)?.mount;return b===void 0?(e.console_expose(),f.ask_open({message:p.message,kind:p.kind==="choose"?"text":p.kind,...p.suggest===void 0?{}:{suggest:p.suggest}})):LM(f,b,p)}}}class WI{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 Qp(n){return(n.kind??"series")==="series"?void 0:n.vfsPath}const Gc="cohort";function kI(n){return/[",\n\r]/.test(n)?`"${n.split('"').join('""')}"`:n}function UI(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}class Jp{handlers;title;cohort;greeted=!1;listing;cohortActions;seriesActions;constructor(e,t,s,i){this.handlers=s,this.cohort=i,i.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 si({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:zr(()=>[...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,a)=>{r.dataset.seriesuid=a.entry.seriesUID}}}),state:r=>this.stateLine_compose(r),empty:()=>UI("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(s=>`"${s.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:Gc}]}],{field:"gather"}),this.cohort.size()>0&&this.listing.open_set(0,[Gc]),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(Gc))}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",s=>{s.stopPropagation(),this.handlers.feed_open(t)}),e},compare:()=>this.cohort.feed_get()?.feedId??-1}]}seriesTraits_declare(){const e=RM(i=>i.entry.series??{seriesUID:i.entry.seriesUID,description:i.entry.description??i.entry.vfsPath??"",modality:i.entry.modality,...i.entry.files===void 0?{}:{fileCount:i.entry.files},...i.entry.folderPath===void 0?{}:{pulled:!0,folderPath:i.entry.folderPath}},NT),t={key:"patient",label:"MRN",className:"gather-series-patient",width:"8em",cell:i=>i.entry.patient||"—"},s={key:"study",label:"STUDY",className:"gather-series-study",width:"14em",cell:i=>i.entry.study??"—"};return[...e.slice(0,1),s,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 DM.rules.map(s=>({label:s.label(e()),offered:()=>s.offered(e()),run:()=>t[s.name]?.()}))}seriesActions_declare(){const e=s=>({folderKnown:(s.entry.kind??"series")!=="series"||s.entry.folderPath!==void 0,imagery:(s.entry.kind??"series")==="series"||s.entry.imagery===!0,pullable:(s.entry.kind??"series")==="series"&&s.entry.folderPath===void 0&&s.entry.series?.pulled!==!0&&s.entry.vfsPath!==""}),t={remove:s=>this.series_remove(s.entry.seriesUID),pull:s=>this.handlers.command_show(`pull "${s.entry.vfsPath}"`),image:s=>{const i=s.entry.folderPath??Qp(s.entry);i!==void 0&&this.handlers.image_open(i)},process:s=>{const i=s.entry.folderPath??Qp(s.entry);if(i!==void 0){this.handlers.process_open(i);return}this.handlers.note(`gather: ${s.entry.description||s.entry.seriesUID} is not in CUBE yet — PULL it first, then PROCESS it.`)}};return AM.rules.map(s=>({label:s.label({folderKnown:!0,pullable:!0}),offered:i=>s.offered(e(i)),run:i=>t[s.name]?.(i)}))}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(),s=t.filter(o=>(o.kind??"series")!=="series").length,i=t.length-s,r=[];(i>0||s===0)&&r.push(`${i} SERIES`),s>0&&r.push(`${s} ${s===1?"PLACE":"PLACES"}`),s===0&&r.push(`${this.patients_count()} PATIENTS`);const a=[r.join(" · ")];return e.filter!==""&&a.push(e.filter),a.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(s=>({seriesUID:s.seriesUID,description:s.description,modality:s.modality,patient:s.patient,vfsPath:s.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(s=>[s.patient,s.description,s.modality,s.seriesUID,s.vfsPath].map(kI).join(","))];this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t.join(`
4244
4244
  `)}' ~/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(a=>(a.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 s=await this.name_ensure();if(s===null)return null;const i=[...this.cohort.members_get()].map(a=>a.vfsPath).join(" "),r=await this.handlers.feed_create(`pull --new-feed "${s}" ${i}`);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 em="~/gather/current.json",FI=1200;function jI(n,e){const{panels:t,subjects:s}=n,i=new WI;let r=null,a=!1,o=null;const l=async z=>{const{terminal:w,client:_}=n;w.line_echo(z);let v;try{v=await _.line_execute(z,{silent:!0})}catch(O){return w.output_write("err",`\x1B[31m${O instanceof Error?O.message:String(O)}\x1B[0m
4245
4245
  `),null}w.outcome_write(v);for(const O of v.envelopes){if(O.model?.kind!=="feed.created")continue;const S=O.model.data;if(typeof S.feedId=="number"&&typeof S.rootInstanceId=="number"&&typeof S.path=="string")return{feedId:S.feedId,rootInstanceId:S.rootInstanceId,path:S.path}}return null},c=(z,w,_)=>({command_run:v=>{n.client.line_execute(v,{silent:!0})},command_show:v=>n.terminal.line_run(v),note:v=>n.terminal.line_note(v),image_open:v=>{e.image_open(z(),v).then(O=>n.terminal.line_note(O))},process_open:v=>e.process_open(z(),{input:v,feed:null,node:null}),...w,..._,feed_create:l,cohort_process:v=>e.process_open(z(),v),feed_open:v=>e.feed_open(z(),v)}),d=()=>{o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>{o=null;const z=r?.entries_get()??[],w=JSON.stringify({version:1,name:r?.name_get()??null,feed:r?.feed_get()??null,series:z});n.client.line_execute("mkdir -p ~/gather",{silent:!0,observe:!1}),n.client.line_execute(`touch --withContents '${w.replace(/'/g,"'\\''")}' ${em}`,{silent:!0,observe:!1})},FI)},u=()=>{const z=document.querySelector("#header-gather-pill");z!==null&&z.classList.toggle("panel-gather-empty",(r?.entries_get().length??0)===0)},h=()=>{const z=e.element_require("header-gather"),w=()=>e.errandHost_find()??"pacs",_=v=>LM(n.terminal,e.element_require("header-gather"),v);return new Jp(z,e.pane_find(z,".gather-rows"),c(w,{name_ask:v=>_({message:"Cohort name: ",kind:"text",suggest:v,commit:"NAME IT"}),confirm_ask:async v=>{const O=await _({message:v,kind:"confirm"});return O==="y"||O==="n"?O:null}},{changed:()=>{e.stage_relight(),u(),d()},dismiss:()=>{document.body.dataset.header="away",a=!0,u()}}),i)};return{cohort:i,instance_build:z=>{const w=e.template_stamp("tpl-pane-gather"),_=new Jp(w,e.pane_find(w,".gather-rows"),c(()=>z,{name_ask:v=>e.ask_onPane(z,{message:"Cohort name: ",kind:"text",suggest:v,commit:"NAME IT"}),confirm_ask:async v=>{const O=await e.ask_onPane(z,{message:v,kind:"confirm"});return O==="y"||O==="n"?O:null}},{changed:()=>e.stage_relight(),dismiss:()=>{n.layout.leaf_close(z)||e.home_apply(),e.orphans_dispose(),e.stage_relight()}}),i);return t.set("gather",z,_),{id:z,kind:"gather",mount:w,dispose:()=>{t.delete(z),s.pane_leave(z)}}},has:z=>r?.has(z)===!0,gather:z=>{r===null&&(r=h());for(const _ of z)r.series_add(_);const w=document.body.dataset.header==="away";(!a||!w)&&(document.body.dataset.header="gather",a=!1),u(),d()},open:(z,w="pacs")=>{const{layout:_}=n,v=new Set(_.panes_shown());let O=t.ids("gather").find(M=>v.has(M))??null;if(O===null){const M=v.has(w)?w:e.errandHost_find()??w,y=e.instance_spawn("gather","pacs"),E=e.replayPlace_get();if(!_.leaf_split(M,E?.dir??"row",y.id,E?.before??!1))return es(y.id),_.mount_remove(y.id),null;e.birth_record(y.id,M,E?.dir??"row",E?.before??!1),O=y.id}const S=t.get("gather",O);if(S===void 0)return null;for(const M of z)S.series_add(M);return O},stage:()=>{const{layout:z}=n,w=new Set(z.panes_shown()),_=t.ids("gather").find(v=>w.has(v))??null;if(_!==null)z.focus_set(_);else{const v=e.errandHost_find()??"pacs",O=e.instance_spawn("gather","pacs");if(!z.leaf_split(v,"col",O.id,!1)){es(O.id),z.mount_remove(O.id);return}e.birth_record(O.id,v,"col",!1),t.get("gather",O.id)?.render_now()}document.body.dataset.header="away",a=!0},annunciate:u,restore:async()=>{const z=await e.fileText_fetch(em);if(z.ok)try{const w=JSON.parse(z.text);if(!Array.isArray(w.series)||w.series.length===0)return;r===null&&(r=h());for(const _ of w.series)r.series_add(_);u(),e.stage_relight()}catch{}}}}async function xr(n,e){const{terminal:t,client:s}=n;t.line_echo(e);let i;try{i=await s.line_execute(e)}catch(r){return t.output_write("err",`\x1B[31m${r instanceof Error?r.message:String(r)}\x1B[0m
4246
- `),!1}return t.outcome_write(i),i.envelopes.length>0&&i.envelopes.every(r=>r.status==="ok")}class $I{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",s=>{(s.ctrlKey||s.metaKey)&&!s.altKey&&s.key.toLowerCase()==="s"&&(s.preventDefault(),s.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",s=>{(!(s.relatedTarget instanceof Node)||!this.fieldSection.contains(s.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),Jt(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 tu(()=>import("./field-ftyy4A7M.js").then(s=>s.Q),[],import.meta.url)}catch(s){if(!Hu(s))throw s;return Jt(this.stateSpan,"stale",ol),this.handlers.note(`edit: ${ol.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){Jt(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||Jt(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?Jt(this.stateSpan,"wait","SAVING"):e?Jt(this.stateSpan,"note","DIRTY"):Jt(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 Wi(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function WM(n,e){return`touch --withContents=${Wi(e)} ${Wi(n)}`}function kM(n){return`edit ${Wi(n)}`}function VI(n,e,t){return e<t?null:`edit: ${n} is ${(e/(1024*1024)).toFixed(1)} MB; open it in the editor? `}function HI(n,e){const{layout:t,panels:s,subjects:i}=n,r=async(u,h)=>{const p=await xr(n,WM(u,h));return p&&e.saved?.(u),p},a=u=>{const h=e.template_stamp("tpl-pane-edit"),p=new $I(h,{save:r,note:f=>n.terminal.line_note(f)});return s.set("edit",u,p),{id:u,kind:"edit",mount:h,dispose:()=>{p.dispose(),s.delete(u),i.pane_leave(u)}}},o=u=>{const h=new Set(t.panes_shown());for(const[p,f]of s.entries("edit"))if(h.has(p)&&f.path_get()===u)return p;return null},l=()=>{e.launcher_yield();const u=new Set(t.panes_shown()),h=t.focused_get(),p=h!==null&&u.has(h)?h:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),b=e.replayPlace_get();return t.leaf_split(p,b?.dir??"col",f.id,b?.before??!1)?(e.birth_record(f.id,p,b?.dir??"col",b?.before??!1),f.id):(es(f.id),t.mount_remove(f.id),null)};return{instance_build:a,edit_receive:u=>{const h=u.path??"";if(h==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=o(h)??l();if(p===null)return!1;const f=s.get("edit",p);return f===void 0?!1:(t.focus_set(p),f.dirty_is()?(n.terminal.line_note(`edit: ${h}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:h,content:u.content,extension:u.extension??gm(h)}),!0))},edit_open:(u,h={})=>{const p=o(u)??l();if(p===null)return null;const f=s.get("edit",p);if(f===void 0)return null;t.focus_set(p),f.dirty_is()||f.opening_show(u);const b=kM(u);return h.visible===!0?(n.terminal.line_run(b),p):(n.client.line_execute(b,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(z=>z.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)}}}function qI(n){for(const e of n.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 XI(n,e){return n.split(`
4246
+ `),!1}return t.outcome_write(i),i.envelopes.length>0&&i.envelopes.every(r=>r.status==="ok")}class $I{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",s=>{(s.ctrlKey||s.metaKey)&&!s.altKey&&s.key.toLowerCase()==="s"&&(s.preventDefault(),s.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",s=>{(!(s.relatedTarget instanceof Node)||!this.fieldSection.contains(s.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),Jt(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 tu(()=>import("./field-W6IcgahR.js").then(s=>s.Q),[],import.meta.url)}catch(s){if(!Hu(s))throw s;return Jt(this.stateSpan,"stale",ol),this.handlers.note(`edit: ${ol.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){Jt(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||Jt(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?Jt(this.stateSpan,"wait","SAVING"):e?Jt(this.stateSpan,"note","DIRTY"):Jt(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 Wi(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function WM(n,e){return`touch --withContents=${Wi(e)} ${Wi(n)}`}function kM(n){return`edit ${Wi(n)}`}function VI(n,e,t){return e<t?null:`edit: ${n} is ${(e/(1024*1024)).toFixed(1)} MB; open it in the editor? `}function HI(n,e){const{layout:t,panels:s,subjects:i}=n,r=async(u,h)=>{const p=await xr(n,WM(u,h));return p&&e.saved?.(u),p},a=u=>{const h=e.template_stamp("tpl-pane-edit"),p=new $I(h,{save:r,note:f=>n.terminal.line_note(f)});return s.set("edit",u,p),{id:u,kind:"edit",mount:h,dispose:()=>{p.dispose(),s.delete(u),i.pane_leave(u)}}},o=u=>{const h=new Set(t.panes_shown());for(const[p,f]of s.entries("edit"))if(h.has(p)&&f.path_get()===u)return p;return null},l=()=>{e.launcher_yield();const u=new Set(t.panes_shown()),h=t.focused_get(),p=h!==null&&u.has(h)?h:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),b=e.replayPlace_get();return t.leaf_split(p,b?.dir??"col",f.id,b?.before??!1)?(e.birth_record(f.id,p,b?.dir??"col",b?.before??!1),f.id):(es(f.id),t.mount_remove(f.id),null)};return{instance_build:a,edit_receive:u=>{const h=u.path??"";if(h==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=o(h)??l();if(p===null)return!1;const f=s.get("edit",p);return f===void 0?!1:(t.focus_set(p),f.dirty_is()?(n.terminal.line_note(`edit: ${h}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:h,content:u.content,extension:u.extension??gm(h)}),!0))},edit_open:(u,h={})=>{const p=o(u)??l();if(p===null)return null;const f=s.get("edit",p);if(f===void 0)return null;t.focus_set(p),f.dirty_is()||f.opening_show(u);const b=kM(u);return h.visible===!0?(n.terminal.line_run(b),p):(n.client.line_execute(b,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(z=>z.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)}}}function qI(n){for(const e of n.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 XI(n,e){return n.split(`
4247
4247
  `).map(t=>t.trim().split(":")).filter(t=>t.length>=4&&(t[3]??"").split(",").includes(e)).map(t=>t[0]??"").filter(t=>t!=="")}function KI(n){return/^(u|user|g|group|o|other):/.test(n)?n:`u:${n}:r`}function YI(n,e){return e.kind==="public"?`setfacl -m o::- feed_${n}`:`setfacl -x ${e.kind==="user"?"u":"g"}:${Wi(e.name)} feed_${n}`}function wo(n){return n.kind==="public"?"PUBLIC":n.kind==="group"?`group ${n.name}`:n.name}function ZI(n,e){const t={silent:!0,observe:!1},s=async c=>{try{return qI(await n.client.line_execute(`getfacl feed_${c}`,t))}catch{return null}},i=async()=>{const c=e.promptUser();if(c===null)return[];try{const d=await n.client.line_execute("cat /etc/group",t);return XI(d.envelopes.map(u=>u.rendered).join(""),c)}catch{return[]}},r=async(c,d,u)=>{await e.ask_onPane(c,{kind:"confirm",message:`Stop sharing feed_${d} with ${wo(u)}? `})==="y"&&await xr(n,YI(d,u))&&e.changed(d)};return{holders_read:s,holders_build:(c,d,u)=>{const h=document.createElement("span");h.className="holder-marks";const p=[...u.users.map(f=>({kind:"user",name:f})),...u.groups.map(f=>({kind:"group",name:f})),...u.public?[{kind:"public"}]:[]];if(p.length===0)return h.textContent="SHARED WITH NOBODY",h;h.append("SHARED WITH ");for(const f of p){const b=document.createElement("span");b.className=`holder-mark holder-${f.kind}`,b.title=wo(f);const g=document.createElement("span");g.className="holder-mark-name",g.textContent=wo(f),b.append(g);const m=document.createElement("span");m.className="holder-mark-x",m.title=`stop sharing with ${wo(f)} (asks first)`,m.textContent="×",m.addEventListener("click",z=>{z.stopPropagation(),r(c,d,f)}),b.append(m),h.append(b)}return h},share_choose:async(c,d)=>{for(;;){const[u,h]=await Promise.all([s(d),i()]),p=u??{groups:[],public:!1},f=[{value:"o::r",label:"EVERYONE",held:p.public},...h.map(g=>({value:`g:${g}:r`,label:g,held:p.groups.includes(g)}))],b=(await e.ask_onPane(c,{kind:"choose",message:`Share feed_${d} with a group, everyone, or a user: `,choices:f,commit:"SHARE",close:"DONE"})??"").trim();if(b===""||!await xr(n,`setfacl -m ${KI(b)} feed_${d}`))return;e.changed(d)}},rename:async(c,d,u)=>{const h=(await e.ask_onPane(c,{kind:"text",message:`Rename feed_${d} to: `,suggest:u,commit:"RENAME"})??"").trim();h===""||h===u||await xr(n,WM(`/proc/jobs/feed_${d}/title`,h))&&e.changed(d)}}}function QI(n){for(const e of n.envelopes){if(e.model?.kind!=="fs.listing")continue;return(e.model.data[0]?.items??[]).map(s=>String(s.name??"")).filter(s=>s!=="")}return[]}function JI(n,e,t){const s=`setfattr -n tag -v ${Wi(e)} feed_${n}`;return t.includes(e)?[s]:[`mkdir ${Wi(`/proc/tags/${e}`)}`,s]}function eG(n,e){const t=async()=>{try{return QI(await n.client.line_execute("ls /proc/tags",{silent:!0,observe:!1}))}catch{return[]}};return{tag_choose:async(r,a,o)=>{const l=new Set(o);for(;;){const c=await t(),d=c.map(b=>({value:b,held:l.has(b)})),u=c.filter(b=>!l.has(b)).join(", "),p=(await e.ask_onPane(r,{kind:"choose",message:`Tag feed_${a}${u===""?"":` (${u})`}, or a new tag: `,choices:d,commit:"TAG",close:"DONE"})??"").trim();if(p===""||p.includes("/"))return;if(l.has(p))continue;let f=!0;for(const b of JI(a,p,c))if(f=await xr(n,b),!f)break;if(!f)return;l.add(p),e.tags_changed(a)}},tag_remove:async(r,a)=>{const o=await xr(n,`setfattr -x tag -v ${Wi(a)} feed_${r}`);return o&&e.tags_changed(r),o}}}function tG(n,e){return{tags:eG(n,{ask_onPane:e.ask_onPane,tags_changed:e.changed}),access:ZI(n,e)}}function sG(n){for(const e of n.envelopes){if(e.model?.kind!=="fs.xattr")continue;return e.model.data[0]?.tags??[]}return[]}function nG(n,e,t){const{panels:s,subjects:i}=n,{tags:r,access:a}=t;return{feed_verbs:o=>{const l={feedId:o.id},c={note:()=>n.terminal.line_run(`edit /proc/jobs/feed_${o.id}/note`),tag:()=>{r.tag_choose(e,o.id,o.tags??[])},rename:()=>{a.rename(e,o.id,o.title)},share:()=>{a.share_choose(e,o.id)},delete:()=>n.terminal.line_run(`feed rm feed_${o.id}`)};return EM.rules.filter(d=>d.offered(l)).map(d=>({label:d.label(l),run:()=>c[d.name]?.()}))},feed_indicated:o=>{i.regard_write(e,{address:`/proc/jobs/feed_${o.id}`,modelKind:"feed"}),a.holders_read(o.id).then(l=>{s.get("dag",e)?.rowReadout_show(o.id,l===null?"ACCESS UNREAD":a.holders_build(e,o.id,l))})},feed_untag:(o,l)=>{r.tag_remove(o,l)},feed_entered:o=>{const l={silent:!0,observe:!1},c=d=>d!==null&&d.envelopes.every(u=>u.status==="ok")?d.envelopes.map(u=>u.rendered).join("").replace(/\x1b\[[0-9;]*m/g,""):null;Promise.all([n.client.line_execute(`cat /proc/jobs/feed_${o}/note`,l).catch(()=>null),n.client.line_execute(`getfattr feed_${o}`,l).catch(()=>null),n.client.line_execute(`cat /proc/jobs/feed_${o}/title`,l).catch(()=>null)]).then(([d,u,h])=>{s.get("dag",e)?.feedMarks_show(o,{note:c(d),tags:u===null?[]:sG(u),title:(c(h)??"").trim()})})},feed_note:o=>n.terminal.line_run(`edit /proc/jobs/feed_${o}/note`),feed_tag:(o,l)=>{r.tag_choose(e,o,l)},feed_rename:(o,l)=>{a.rename(e,o,l)}}}class iG{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 si({mount:t,traits:this.traits_declare(),key:s=>s.key,chrome:{root:e,prefix:"help"},caps:"root",activatable:()=>!1,row:{className:s=>`help-row help-${s.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=a=>{const o=document.createElement("header");return o.className="files-path help-block-head",o.textContent=a,o},t=Bi.map(a=>({key:`k:${a.key}`,name:a.key,does:a.does,topic:a.topic})),s=Ou.map((a,o)=>{const l=a.indexOf(" ");return{key:`v:${o}`,name:l<0?a:a.slice(0,l),does:l<0?"":a.slice(l+1).trim(),topic:"verb"}}),i=[{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:s},{key:"games",header:e("GAMES — the small pleasures, kept apart from the tools as BSD kept them"),rows:i},{key:"notes",header:e("NOTES — what changed, release by release"),rows:r}],{field:"help"})}}function rG(n,e){const{layout:t,panels:s,subjects:i}=n;return{instance_build:o=>{const l=e.template_stamp("tpl-pane-help");return s.set("help",o,new iG(l)),{id:o,kind:"help",mount:l,dispose:()=>{s.delete(o),i.pane_leave(o)}}},open:()=>{const o=s.ids("help").find(u=>t.panes_shown().includes(u));if(o!==void 0)return t.focus_set(o),"help: on stage";const l=e.launcher_active();e.launcher_yield();const c=t.focused_get()??"files",d=e.instance_spawn("help");return l&&t.leaf_replace("files",d.id)?(t.focus_set(d.id),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):t.leaf_split(c,"col",d.id,!1)?(e.birth_record(d.id,c,"col",!1),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):(es(d.id),t.mount_remove(d.id),"help: could not open a pane")}}}const Rc=["___________________ _-_ ","\\__(==========/_=_/ ____.---'---`---.____"," \\_ \\ \\----._________.----/"," \\ \\ / / `-_-' "," __,--`.`-'..'-_ "," /____ || "," `--.____,-' "];function aG(){const n=Rc[0].length;let e=Number.NaN,t=0;return{title:"SL",tick:60,step:s=>{Number.isNaN(e)&&(e=-n),e+=1,t+=1,e>s.cols+6&&(e=-n)},draw:(s,i)=>{const r=Math.max(0,Math.floor((s.rows-Rc.length)/2));Rc.forEach((o,l)=>s.text(Math.round(e),r+l,o,i.lit));const a=t%2===0?"-~=":"-=~";s.text(Math.round(e)-a.length,r+1,a,i.cool)}}}const tm="ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ0123456789Z:・.=*+-<>¦|";function oG(){const n=new Map;let e=0;return{title:"CMATRIX",tick:50,step:(t,s)=>{e+=1;for(let i=0;i<t.cols;i++){const r=n.get(i);if(r===void 0){s()<.02&&n.set(i,{row:-1,speed:1+Math.floor(s()*2),length:4+Math.floor(s()*12),glyphs:[]});continue}e%r.speed===0&&(r.row+=1,r.glyphs.unshift(tm[Math.floor(s()*tm.length)]),r.glyphs.length>r.length&&r.glyphs.pop(),r.row-r.length>t.rows&&n.delete(i))}},draw:(t,s)=>{for(const[i,r]of n)r.glyphs.forEach((a,o)=>{const l=o===0?"#ffffff":o<r.length/2?s.lit:s.dim;t.put(i,r.row-o,a,l)})}}}function lG(){const n=[];return{title:"RAIN",tick:70,step:(e,t)=>{t()<.9&&n.push({col:Math.floor(t()*e.cols),row:0,splash:0});for(const s of n)s.row<e.rows-1?s.row+=1:s.splash+=1;for(let s=n.length-1;s>=0;s--)n[s].splash>3&&n.splice(s,1)},draw:(e,t)=>{for(const s of n){if(s.splash===0){e.put(s.col,s.row,"|",t.cool);continue}const i=["o","O","( )"][s.splash-1];e.text(s.col-(i.length>>1),e.rows-1,i,t.dim)}}}}function cG(){const n=[],e=[];let t=0;return{title:"ASCIIQUARIUM",tick:90,step:(s,i)=>{if(t+=1,n.length<Math.max(3,s.cols/12)&&i()<.08){const r=i()<.5;n.push({col:r?-4:s.cols+1,row:2+Math.floor(i()*Math.max(1,s.rows-5)),right:r,speed:1+Math.floor(i()*2),hue:Math.floor(i()*3)})}for(const r of n)t%r.speed===0&&(r.col+=r.right?1:-1);for(let r=n.length-1;r>=0;r--){const a=n[r];(a.col<-5||a.col>s.cols+2)&&n.splice(r,1)}if(i()<.3){const r=n[Math.floor(i()*n.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:(s,i)=>{const r=(t%4<2?"~^":"^~").repeat(s.cols>>1);s.text(0,0,r,i.cool);const a=[i.lit,i.cool,i.warn];for(const o of n)s.text(o.col,o.row,o.right?"><>":"<><",a[o.hue]);for(const o of e)s.put(o.col,o.row,o.row%2===0?"o":".",i.dim);for(let o=2;o<s.cols;o+=7){const l=(t>>2)%2===0?0:1;for(let c=0;c<3;c++)s.put(o+(c+l)%2,s.rows-2-c,c%2===0?"(":")",i.dim)}s.text(0,s.rows-1,"^".repeat(s.cols),i.dim)}}}const sm=[[[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]]],vi=10,Ai=20;function dG(){return{well:Array.from({length:Ai},()=>Array(vi).fill(0)),piece:null,score:0,lines:0,over:!1}}function qu(n,e){return e.cells.every(([t,s])=>{const i=e.x+t,r=e.y+s;return i>=0&&i<vi&&r<Ai&&(r<0||n[r][i]===0)})}function Nc(n){const e=Math.max(...n.cells.flat())+1;return{...n,cells:n.cells.map(([t,s])=>[e-1-s,t])}}function uG(n,e){const t=Math.floor(e()*sm.length),s={cells:sm[t].map(i=>[i[0],i[1]]),x:3,y:0,kind:t+1};if(!qu(n.well,s)){n.over=!0;return}n.piece=s}function hG(n){const e=n.piece;if(e===null)return;e.cells.some(([,i])=>e.y+i<0)&&(n.over=!0);for(const[i,r]of e.cells){const a=e.y+r;a>=0&&(n.well[a][e.x+i]=e.kind)}const t=n.well.filter(i=>i.some(r=>r===0)),s=Ai-t.length;for(;t.length<Ai;)t.unshift(Array(vi).fill(0));n.well=t,n.lines+=s,n.score+=[0,100,300,500,800][s]??800,n.piece=null}function su(n,e){if(n.over)return;if(n.piece===null){uG(n,e);return}const t={...n.piece,y:n.piece.y+1};qu(n.well,t)?n.piece=t:hG(n)}function fG(n,e,t){if(n.over||n.piece===null)return!1;const s=n.piece,i=r=>qu(n.well,r)?(n.piece=r,!0):!1;switch(e){case"ArrowLeft":case"h":case"a":return i({...s,x:s.x-1}),!0;case"ArrowRight":case"l":case"d":return i({...s,x:s.x+1}),!0;case"ArrowUp":case"k":case"w":return i(Nc(s))||i({...Nc(s),x:s.x-1})||i({...Nc(s),x:s.x+1}),!0;case"ArrowDown":case"j":case"s":return su(n,t),!0;case" ":{for(;n.piece!==null;)su(n,t);return!0}default:return!1}}function pG(){const n=dG();let e=Math.random;return{title:"TETRIS",tick:500,step:(t,s)=>{e=s,su(n,s)},draw:(t,s)=>{const i=Math.max(0,Math.floor((t.cols-(vi*2+2))/2)),r=Math.max(0,Math.floor((t.rows-Ai-1)/2)),a=["",s.cool,s.lit,s.warn,s.dim,s.lit,s.cool,s.warn];for(let o=0;o<Ai;o++){t.put(i,r+o,"|",s.dim),t.put(i+vi*2+1,r+o,"|",s.dim);for(let l=0;l<vi;l++){const c=n.well[o][l];c!==0&&t.text(i+1+l*2,r+o,"[]",a[c])}}if(t.text(i,r+Ai,"+"+"-".repeat(vi*2)+"+",s.dim),n.piece!==null)for(const[o,l]of n.piece.cells){const c=n.piece.y+l;c>=0&&t.text(i+1+(n.piece.x+o)*2,r+c,"[]",a[n.piece.kind])}n.over&&t.text(i+2,r+9," GAME OVER ",s.warn)},key:t=>fG(n,t,e),status:()=>`${n.score} · ${n.lines} lines${n.over?" · OVER":""}`,over:()=>n.over}}function mG(n,e,t){const s=n>>1,i=e>>1,r={body:[[s,i],[s-1,i],[s-2,i]],food:[0,0],heading:"right",next:"right",score:0,over:!1,cols:n,rows:e};return UM(r,t),r}function UM(n,e){for(let t=0;t<1e3;t++){const s=[Math.floor(e()*n.cols),Math.floor(e()*n.rows)];if(!n.body.some(([i,r])=>i===s[0]&&r===s[1])){n.food=s;return}}}const gG={up:"down",down:"up",left:"right",right:"left"};function MG(n,e){gG[e]!==n.heading&&(n.next=e)}function bG(n,e){if(n.over)return;n.heading=n.next;const[t,s]=n.body[0],i=n.heading==="up"?[t,s-1]:n.heading==="down"?[t,s+1]:n.heading==="left"?[t-1,s]:[t+1,s],r=i[0]<0||i[1]<0||i[0]>=n.cols||i[1]>=n.rows,a=n.body.some(([o,l])=>o===i[0]&&l===i[1]);if(r||a){n.over=!0;return}n.body.unshift(i),i[0]===n.food[0]&&i[1]===n.food[1]?(n.score+=10,UM(n,e)):n.body.pop()}const _G={...Object.fromEntries(vu.map(n=>[ms[n].arrow,ms[n].focusWord])),k:"up",w:"up",j:"down",s:"down",h:"left",a:"left",l:"right",d:"right"};function zG(){let n=null;return{title:"SNAKE",tick:140,step:(e,t)=>{n===null&&(n=mG(Math.max(8,e.cols>>1),Math.max(6,e.rows-1),t)),bG(n,t)},draw:(e,t)=>{n!==null&&(e.text(0,n.rows,"-".repeat(n.cols*2),t.dim),e.text(n.food[0]*2,n.food[1],"**",t.warn),n.body.forEach(([s,i],r)=>e.text(s*2,i,r===0?"@@":"oo",r===0?t.lit:t.cool)),n.over&&e.text(Math.max(0,n.cols-6),n.rows>>1," GAME OVER ",t.warn))},key:e=>{const t=_G[e];return t===void 0||n===null?!1:(MG(n,t),!0)},status:()=>n===null?"":`${n.score}${n.over?" · OVER":""}`,over:()=>n?.over??!1}}const FM={sl:aG,cmatrix:oG,rain:lG,aquarium:cG,tetris:pG,snake:zG};function wG(n){return n in FM}const yG=8,vG=26,Bc=1.8,OG=100,nm=24;function im(n,e){let t=Math.floor(n/OG);return e/(t*Bc)<nm&&(t=Math.floor(e/nm/Bc)),t=Math.max(yG,Math.min(vG,t)),{w:t,h:Math.round(t*Bc)}}class xG{pane;field;canvas;state;focusMark;pausePill;program=null;name=null;paused=!1;timer=null;frame=null;observer;constructor(e){this.pane=e,this.field=ca(e,".games-field"),this.canvas=ca(e,".games-canvas"),this.state=e.querySelector(".pane-state"),this.focusMark=ca(e,".games-focus"),this.pausePill=ca(e,".games-pause"),this.field.tabIndex=0,this.pausePill.addEventListener("click",()=>this.pause_toggle()),ca(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=FM[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=im(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=(s,i)=>e.getPropertyValue(s).trim()||i;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 s=this.field.getBoundingClientRect(),i=window.devicePixelRatio||1;(this.canvas.width!==Math.floor(s.width*i)||this.canvas.height!==Math.floor(s.height*i))&&(this.canvas.width=Math.floor(s.width*i),this.canvas.height=Math.floor(s.height*i)),t.setTransform(i,0,0,i,0,0),t.clearRect(0,0,s.width,s.height);const r=im(s.width,s.height);t.font=`${r.h-2}px 'Share Tech Mono', monospace`,t.textBaseline="top";const a=this.size_of(),o=(c,d,u,h)=>{c<0||d<0||c>=a.cols||d>=a.rows||(t.fillStyle=h,t.fillText(u,c*r.w,d*r.h))},l={cols:a.cols,rows:a.rows,put:o,text:(c,d,u,h)=>{[...u].forEach((p,f)=>{p!==" "&&o(c+f,d,p,h)})}};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 ca(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`games pane: missing ${e}`);return t}function SG(n,e){const{layout:t,panels:s,subjects:i}=n;return{instance_build:o=>{const l=e.template_stamp("tpl-pane-games"),c=new xG(l);return s.set("games",o,c),{id:o,kind:"games",mount:l,dispose:()=>{c.dispose(),s.delete(o),i.pane_leave(o)}}},show:o=>{const l=typeof o=="object"&&o!==null?o.program:void 0;if(typeof l!="string"||!wG(l))return`games: no program named ${String(l)}`;const c=s.ids("games").find(f=>t.panes_shown().includes(f));if(c!==void 0)return t.focus_set(c),s.get("games",c)?.program_run(l),`games: ${l} on the GAMES pane`;const d=e.launcher_active();e.launcher_yield();const u=t.focused_get()??"files",h=e.instance_spawn("games");return(d?t.leaf_replace("files",h.id):t.leaf_split(u,"col",h.id,!1))?(d?t.focus_set(h.id):e.birth_record(h.id,u,"col",!1),s.get("games",h.id)?.program_run(l),`games: ${l} in a GAMES pane (Esc gives the keyboard back; its PAUSE and RESTART pills on the frame)`):(es(h.id),t.mount_remove(h.id),"games: could not open a pane")}}}function EG(n){return`${n.date??"undated"} · ${n.entries.map(e=>`${e.package} ${e.version}`).join(" · ")}`}function AG(n,e){return n.releases.map(t=>{const s=t.merge??t.date??"undated",i=[];for(const r of t.entries)r.changes.forEach((a,o)=>{const l=`${s}:${r.package}:${o}`,c=a.body!=="";i.push({key:l,tag:r.package,text:a.headline,body:!1,more:c,internal:a.internal,of:l}),c&&e.has(l)&&i.push({key:`${l}:body`,tag:"",text:a.body,body:!0,more:!1,internal:a.internal,of:l})});return{key:s,title:EG(t),rows:i}})}class DG{constructor(e,t){this.hooks=t;const s=e.querySelector(".notes-panel");if(s===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 si({mount:s,traits:this.traits_declare(),key:i=>i.key,chrome:{root:e,prefix:"notes"},caps:"root",activatable:i=>i.more,activate:i=>this.unfold_toggle(i.of),row:{className:i=>`notes-row${i.body?" notes-row-body":""}${i.internal?" notes-row-internal":""}${i.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),s=await this.hooks.ask(`notes --since ${t}${e.all?" --all":""}`);s!==null&&(this.ask=e,this.model_show(s))}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=i=>{const r=document.createElement("header");return r.className="files-path notes-block-head",r.textContent=i,r},s=AG(e,this.unfolded).map(i=>({key:i.key,header:t(i.title),rows:i.rows}));if(this.listing.rows_set(s,{field:"notes"}),this.state!==null){const i=Object.entries(e.installed).map(([r,a])=>`${r} ${a}`).join(" · ");this.state.textContent=`${e.source.toUpperCase()} · ${i}`}this.pills_paint()}}function TG(n){for(const e of n.envelopes){if(e.model?.kind!==g0)continue;const t=z0.safeParse(e.model.data);if(t.success)return t.data}return null}function IG(n,e){const{layout:t,panels:s,subjects:i}=n,r=async c=>TG(await e.ask(c)),a=c=>{const d=e.template_stamp("tpl-pane-notes");return s.set("notes",c,new DG(d,{ask:r})),{id:c,kind:"notes",mount:d,dispose:()=>{s.delete(c),i.pane_leave(c)}}},o=c=>{r("notes").then(d=>{d!==null&&s.get("notes",c)?.model_show(d)})};return{instance_build:a,open:()=>{const c=s.ids("notes").find(f=>t.panes_shown().includes(f));if(c!==void 0)return t.focus_set(c),o(c),"notes: on stage";const d=e.launcher_active();e.launcher_yield();const u=t.focused_get()??"files",h=e.instance_spawn("notes");return(d?t.leaf_replace("files",h.id):t.leaf_split(u,"col",h.id,!1))?(d?t.focus_set(h.id):e.birth_record(h.id,u,"col",!1),o(h.id),"notes: what the installed releases changed, as a pane (notes in the console prints it)"):(es(h.id),t.mount_remove(h.id),"notes: could not open a pane")},latest:()=>r("notes")}}function GG(n,e){const{layout:t,panels:s,paneInstance_get:i}=n,r=[()=>e.palette_isOpen()?(e.palette_close(),"claimed"):"passed",()=>n.terminal.ask_abandon()?"claimed":"passed",()=>PM()?"claimed":"passed",()=>e.errand_abandon()?"claimed":"passed",()=>s.values("image").some(d=>d.field_release())?"claimed":"passed",()=>s.values("edit").some(d=>d.field_release())?"claimed":"passed",()=>s.values("games").some(d=>d.field_release())?"claimed":"passed",()=>{if(n.terminal.ask_isOpen())return"passed";let d=!1;for(const u of s.values("files"))u.select_isOn()&&(u.select_toggle(!1),d=!0);return d?"claimed":"passed"},()=>{const d=e.drawers_close(),u=e.modeFrames_close();return d||u?"claimed":"passed"},()=>document.body.dataset.zoom!==void 0?"yielded":"passed",()=>e.dive_leave()?"claimed":"passed",()=>e.overlay_escape()?"claimed":"passed",()=>{const d=s.entries("dag").find(([,u])=>u.inside_isHeld());return d===void 0?"passed":(d[1].flight_back(()=>{}),"claimed")},()=>{const d=t.focused_get(),u=s.entries("files").filter(([,h])=>h.content_isShown()).sort(([h],[p])=>h===d?-1:p===d?1:0)[0];return u===void 0?"passed":(u[1].listing_restore(),"claimed")},()=>s.values("dag").some(d=>d.nav_pop())?"claimed":"passed"],a=d=>{if(document.body.dataset.zoom!=="launcher")for(const u of r){const h=u();if(h==="yielded")return;if(h==="claimed"){d.stopImmediatePropagation(),u!==r[0]&&n.sound("audio3");return}}},o=(d,u)=>{const h=()=>{d.preventDefault(),d.stopImmediatePropagation()},p=Ly(d.key);if(d.ctrlKey&&!d.metaKey&&!d.altKey&&p!==null){const m=t.focused_get();return m!==null&&e.verbs.resize(m,p,.05),h(),!0}if(d.ctrlKey||d.metaKey||d.altKey)return!1;const f=m=>(e.drawers_close(),m(),h(),!0);if(p!==null)return f(()=>{gg(e.host(),ms[p].focusWord)!==null&&n.sound("audio3")});switch(d.key){case"o":case"O":{const m=t.panes_shown(),z=m.indexOf(t.focused_get()??""),w=m[(z+(d.key==="o"?1:m.length-1))%m.length];return f(()=>{w!==void 0&&(t.focus_set(w),n.sound("audio3"))})}case"?":return f(()=>n.terminal.line_run("argus keys"));case";":return f(()=>{t.focus_last()!==null&&n.sound("audio3")});case"q":return f(()=>{for(const m of t.panes_shown())e.verbs.bar_note(m,`@${m}`)});case" ":{const m=t.focused_get();return f(()=>{m!==null&&e.verbs.flip(m)})}case"!":{const m=t.focused_get();return f(()=>{m!==null&&t.panes_shown().length>1&&(e.stage_alone(m),e.verbs.bar_note(m,"ALONE ON STAGE"),n.sound("audio3"))})}case"w":return f(()=>e.element_require("gutter-panes").click());case"[":return f(()=>{const m=document.querySelector(".argus-output");m!==null&&(m.tabIndex=-1,m.focus())})}const b=Bi.find(m=>m.key===d.key&&m.selector!==null);if(b===void 0||b.selector===null)return!1;b.move===!0&&u.querySelector('.drawer-mode[data-mode="move"]')?.click();const g=u.querySelector(b.selector);return g===null||g.disabled?b.move===!0&&u.querySelector('.drawer-mode[data-mode="split"]')?.click():g.click(),h(),!0},l=d=>{const u=document.querySelector(".pane-drawer:not([hidden])")!==null;if(d.key===":"&&u){e.drawers_close(),e.palette_open(),d.preventDefault(),d.stopImmediatePropagation();return}if(!(d.key==="b"&&d.ctrlKey&&!d.altKey&&!d.metaKey))return;if(d.preventDefault(),u){e.drawers_close(),e.palette_open();return}const h=document.body.dataset.zoom,p=h==="console"||h===void 0&&e.consoleFocused(),f=h!==void 0&&h!=="console"?h:t.focused_get()??"files",b=p?e.element_require("console-drawer"):i(f)?.mount?.querySelector(".pane-drawer")??null;b!==null&&(b.hidden=!b.hidden,b.hidden||b.querySelector("button")?.focus(),n.sound("audio3"))},c=d=>{if(d.key==="Escape"){a(d);return}const u=document.querySelector(".pane-drawer:not([hidden])"),h=d.target instanceof HTMLInputElement||d.target instanceof HTMLTextAreaElement||d.target instanceof HTMLElement&&d.target.isContentEditable;u!==null&&!h&&o(d,u)||l(d)};return window.addEventListener("keydown",c,{capture:!0}),()=>window.removeEventListener("keydown",c,{capture:!0})}const RG=256*1024*1024;function NG(n,e){const t=e.split("/").filter(a=>a.length>0).pop()??"download";if(n===null)return t;const s=/filename\*\s*=\s*UTF-8''([^;]+)/i.exec(n);if(s!==null)try{const a=decodeURIComponent((s[1]??"").trim());if(a.length>0)return a}catch{}const r=/filename\s*=\s*"([^"]*)"/i.exec(n)?.[1]??"";return r.length>0?r:t}function BG(n){return n.redirected?"the session asked to log in again — nothing was saved":n.ok?n.headers.get("content-disposition")===null?"the session answered with something other than the file — nothing was saved":null:n.status===404?"the session could not read that file — nothing was saved":`the session refused the file (HTTP ${n.status}) — nothing was saved`}function rm(n,e){const t=document.createElement("a");t.href=n,t.download=e,t.rel="noopener",document.body.append(t),t.click(),t.remove()}async function CG(n,e,t=fetch){const s=new AbortController;let i;try{i=await t(n,{credentials:"same-origin",signal:s.signal})}catch(d){return{ok:!1,reason:`the session did not answer (${d instanceof Error?d.message:String(d)}) — nothing was saved`}}const r=BG(i);if(r!==null)return s.abort(),{ok:!1,reason:r};const a=NG(i.headers.get("content-disposition"),e),o=Number(i.headers.get("content-length")??NaN);if(Number.isFinite(o)&&o>RG)return s.abort(),rm(n,a),{ok:!0,name:a,bytes:o,streamed:!0};const l=await i.blob(),c=URL.createObjectURL(l);return rm(c,a),setTimeout(()=>URL.revokeObjectURL(c),6e4),{ok:!0,name:a,bytes:l.size,streamed:!1}}const jM=/\.(csv|tsv)$/i;function am(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}function $M(n){return ed.test(n)||Xo.test(n)}function nu(n){const e=/_(\d+)\/data\/?$/.exec(n);return e===null?null:parseInt(e[1]??"",10)}function _a(n){const e=n.match(/\/(?:feeds|jobs)\/feed_(\d+)(?:\/|$)/);return e===null?null:Number(e[1])}function PG(n){return/^\/(proc|net|etc|usr)(\/|$)/.test(n)}function LG(n){for(const e of n.envelopes){const t=e.model;if(typeof t!="object"||t===null)continue;const s=t.data;if(t.kind!=="fs.acl"||!Array.isArray(s))continue;const i=[];for(const r of s)Array.isArray(r.usernames)&&i.push(...r.usernames.map(String)),Array.isArray(r.groups)&&i.push(...r.groups.map(a=>`group ${String(a)}`)),r.public===!0&&i.push("PUBLIC");return i.length===0?"SHARED WITH NOBODY":`SHARED WITH ${i.join(", ")}`}return"ACCESS UNREAD"}function WG(n,e){const{panels:t,subjects:s}=n,i=new Map,r=new Map,a=new Map,o=y=>{CG(e.downloadUrl_build(y),y).then(E=>{n.terminal.line_note(E.ok?`download: ${E.name}${E.streamed?" — large; the browser fetches it itself":""}`:`download: ${y}: ${E.reason}`)})},l=y=>n.client.line_execute(`cat "${y}"`,{silent:!0,observe:!1}).then(E=>{if(!E.envelopes.some(G=>G.status==="error"))return{ok:!0,text:am(E.envelopes.map(G=>G.rendered).join(`
4248
4248
  `))};const I=E.envelopes.flatMap(G=>(G.errors??[]).map(C=>C.message)).concat(E.envelopes.map(G=>G.renderedErr??"")).map(G=>am(G).trim()).filter(G=>G!=="").join(`
4249
4249
  `);return{ok:!1,text:I===""?"the session refused this read and said nothing further":I}}),c=async(y,E)=>{const A=await fetch(e.vfsUrl_build(y));if(!A.ok||A.body===null)return(await l(y)).text.slice(0,E);const I=A.body.getReader(),G=new TextDecoder;let C="";for(;C.length<E;){const{done:B,value:P}=await I.read();if(B)break;C+=G.decode(P,{stream:!0})}return I.cancel().catch(()=>{}),C.slice(0,E)},d=async y=>{const E=/_id(\d+)$/.exec(y)?.[1]??y.replace(/^.*\//,""),A=await n.client.line_execute(`pipeline diagram ${E}`,{silent:!0,observe:!1});for(const I of A.envelopes){if(I.model?.kind!==Xn.pipelineDiagram)continue;const G=ou.safeParse(I.model.data);if(G.success)return G.data.nodes.map(C=>({id:C.id,parentIds:[...C.parentIds,...C.joinParentIds??[]]}))}return null},u={imageUrl:e.vfsUrl_build,download:o,textHead:c,pipelineGlimpse:d},h=(y,E,A)=>{const I=A==="~"?"ls ~":`ls "${A}"`;n.client.line_execute(I,{silent:!0,observe:!1}).then(G=>{for(const C of G.envelopes)E.envelope_observe(C)})},p=(y,E,A)=>{const I=E.path_current();I!==null&&i.get(y)?.push(I),h(y,E,A)},f=(y,E)=>{const A=i.get(y)?.pop();A!==void 0&&h(y,E,A)},b=y=>{a.get(y)?.()},g=(y,E)=>{r.set(y,E),b(y);const A=t.get("files",y);A?.follow_set(E),E&&A!==void 0&&n.client.line_execute("ls",{silent:!0,observe:!1}).then(I=>{for(const G of I.envelopes)A.envelope_observe(G)})},m=(y,E)=>{const A=t.get("files",y);A!==void 0&&(r.get(y)===!0?n.terminal.line_run("ls"):h(y,A,E))},z=(y,E)=>{e.ask_onPane(y,{message:`New directory in ${E}: `,kind:"text",commit:"MAKE IT"}).then(A=>{const I=(A??"").trim();I!==""&&(n.terminal.line_run(`mkdir "${E}/${I}"`),m(y,E))})},w=async(y,E,A)=>{for(const I of A){const G=`${E}/${I.name}`;n.terminal.line_note(`putting ${I.name} in ${E}…`);try{const C=await fetch(e.vfsUrl_build(G),{method:"POST",body:I});if(!C.ok){n.terminal.line_note(`upload: ${I.name}: ${(await C.text()).trim()||C.statusText}`);continue}n.terminal.line_note(`✓ ${G}`)}catch(C){n.terminal.line_note(`upload: ${I.name}: ${C instanceof Error?C.message:String(C)}`)}}m(y,E)},_=(y,E,A)=>{if(A.kind==="dir"){r.get(y)===!0?n.terminal.line_run(`cd "${A.path}"`):p(y,E,A.path);return}if(A.kind==="plugin"||A.kind==="pipeline"){e.binEntry_show(y,E,A.path,A.kind);return}if($M(A.path)){e.image_open(y,A.path).then(I=>n.terminal.line_note(I));return}if(s.regard_write(y,{address:A.path,modelKind:"fs.file"}),!s.groupHasViewer(y)){if(gl(A.path)){E.contentImage_show(A.path,e.vfsUrl_build(A.path));return}l(A.path).then(I=>{if(!I.ok){E.contentRefused_show(A.path,I.text);return}jM.test(A.path)?E.contentTable_show(A.path,I.text):E.content_show(A.path,I.text)})}},v=()=>{const y=e.template_stamp("tpl-pane-files").querySelector(".files-body");if(y===null)throw new Error("tpl-pane-files has no files-body");return y},O=(y,E,A)=>{const I=`"${A}"`,G=E.type==="dir"||E.type==="vfs"||E.type==="job",C=_a(A),B={kind:E.type==="plugin"||E.type==="pipeline"?"catalogue":G&&Rl(A,E.name)?"seriesFolder":E.type==="file"?"file":"directory",feed:C,node:C===null?null:nu(A),bound:e.catalogue_of(y)!==void 0,projection:PG(A),editable:E.type==="file"&&ob(A)},P={image:()=>{e.image_open(y,A).then(L=>n.terminal.line_note(L))},download:()=>o(A),process:()=>e.process_open(y,{input:A,feed:C,node:C===null?null:nu(A)}),gather:()=>e.cohort_gather([{kind:G?"dir":"file",seriesUID:A,description:E.name,imagery:Rl(A,E.name),modality:Rl(A,E.name)?"MR":"—",patient:e.promptUser()??"",vfsPath:A,folderPath:A}]),run:()=>e.run_press(y,E.name,E.type==="pipeline"?"pipeline":"plugin"),edit:()=>{const L=kM(A),H=VI(E.name,E.size,ab);if(H===null){e.verbLine_run(y,L);return}e.ask_onPane(y,{kind:"confirm",message:H}).then(X=>{X==="y"&&e.verbLine_run(y,L)})},move:()=>e.verbLine_run(y,`mv ${I}`),copy:()=>e.verbLine_run(y,`cp ${I}`),delete:()=>e.verbLine_run(y,`rm ${G?"-ri":"-i"} ${I}`),share:()=>e.verbLine_run(y,`setfacl ${I}`)};return xM.rules.filter(L=>L.offered(B)).map(L=>({label:L.label(B),run:()=>P[L.name]?.()}))},S=(y,E)=>{const A=E.map(([P])=>P),I=A.map(P=>`"${P}"`).join(" "),G=[];for(const P of A){const L=_a(P);L!==null&&!G.includes(L)&&G.push(L)}const C={count:A.length,feeds:G},B={delete:()=>e.verbLine_run(y,`rm -rI ${I}`),move:()=>n.terminal.line_run(`mv -t ${I}`),copy:()=>n.terminal.line_run(`cp -t ${I}`),share:()=>n.terminal.line_run(`setfacl ${G.map(P=>`feed_${P}`).join(" ")}`)};return SM.rules.filter(P=>P.offered(C)).map(P=>({label:P.label(C),run:()=>B[P.name]?.()}))};return{previewProvider:u,fileText_fetch:l,file_save:o,rootedListing_show:h,listing_refresh:m,directory_make:z,files_deliver:w,follows:y=>r.get(y)===!0,follow_set:g,cwdBind_sync_register:(y,E)=>{a.set(y,E)},cwdBind_sync:b,rooted_walk:p,rooted_back:f,filesBody_stamp:v,rowVerbs_of:O,instance_build:(y,E,A=!1)=>{const I=e.template_stamp("tpl-pane-files"),G=new pg(e.pane_find(I,".files-panel"),B=>_(y,G,B),u,{catalogue:A});G.selectionVerbs_declare(B=>S(y,B)),G.rowVerbs_declare((B,P)=>O(y,B,P),(B,P)=>{s.regard_write(y,{address:P,modelKind:"fs.file"}),_a(P)!==null&&n.client.line_execute(`getfacl "${P}"`,{silent:!0,observe:!1}).then(L=>{G.rowReadout_show(P,LG(L))}).catch(()=>{G.rowReadout_show(P,"ACCESS UNREAD")})}),t.set("files",y,G);const C=e.promptUser();return C!==null&&C!==""&&G.home_set(`/home/${C}`),i.set(y,[]),r.set(y,E),b(y),G.follow_set(E),{id:y,kind:"files",mount:I,dispose:()=>{t.delete(y),i.delete(y),s.pane_leave(y)}}}}}function kG(n,e){const{layout:t,panels:s,subjects:i}=n,r=(l,c,d)=>{d.addEventListener("click",b=>{b.target instanceof Element&&b.target.closest("button")!==null||(c.hidden=!c.hidden,c.hidden||c.querySelector("button")?.focus(),n.sound("audio3"))});const u=c.querySelector(".drawer-zoom");u!==null&&(u.dataset.pane=l),d.addEventListener("dblclick",b=>{b.target instanceof Element&&b.target.closest("button")!==null||(window.getSelection()?.removeAllRanges(),u?.click())});for(const b of c.querySelectorAll(".drawer-bind"))b.addEventListener("click",()=>{for(const g of c.querySelectorAll(".drawer-bind"))g.classList.remove("drawer-bind-selected");b.classList.add("drawer-bind-selected"),n.sound("audio3")});const h=[...c.querySelectorAll("[data-split]")],p=b=>Cy(b.dataset.split,b.dataset.place)??"right",f=b=>{c.dataset.mode=b;for(const g of c.querySelectorAll(".drawer-mode"))g.classList.toggle("drawer-mode-selected",g.dataset.mode===b);for(const g of h){const m=p(g);g.disabled=b==="move"&&!t.move_possible(l,m);const z=Ts(m);g.title=b==="move"?`this pane moves ${m}${e.verbs.chordKeys_of(z,!0)}`:`new pane opens ${m}${e.verbs.chordKeys_of(z,!1)}`}};for(const b of c.querySelectorAll(".drawer-mode"))b.addEventListener("click",()=>{const g=b.dataset.mode==="move"?"move":"split";f(g==="move"&&c.dataset.mode==="move"?"split":g),n.sound("audio3")});for(const b of h)b.addEventListener("click",()=>{if(c.dataset.mode==="move"){e.verbs.move(l,p(b)),f("split"),c.hidden=!0;return}const g=b.dataset.split==="row"?"row":"col",m=b.dataset.place==="before",z=c.querySelector(".drawer-bind-selected")?.dataset.bind??"unlinked",w=z==="viewer"?"view":z==="fs"?"fs":"empty";e.pillPane_spawn(l,w,g,m)!==null&&(c.hidden=!0,n.sound("audio3"))});for(const b of new Set(Bi.filter(g=>g.selector!==null&&g.move!==!0).map(g=>g.selector??""))){const g=c.querySelector(b);g!==null&&!g.title.includes("[keys ")&&(g.title=`${g.title}${e.verbs.chordKeys_of(b,!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(),n.sound("audio3")})},a=(l,c,d)=>{const{browser:u}=e,h=c.querySelector(".drawer-binding");if(h!==null){const g=document.createElement("span");g.className="drawer-label drawer-label-cwd",g.textContent="CWD",h.appendChild(g);const m=(z,w,_)=>{const v=document.createElement("button");v.className="pacs-capsule drawer-cwdbind",v.dataset.follow=w?"on":"off",v.textContent=z,v.title=_,v.addEventListener("click",()=>{u.follows(l)!==w&&u.follow_set(l,w),n.sound("audio3")}),h.appendChild(v)};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"),u.cwdBind_sync_register(l,()=>{const z=u.follows(l);for(const w of h.querySelectorAll(".drawer-cwdbind"))w.classList.toggle("drawer-bind-selected",w.dataset.follow==="on"===z)}),u.cwdBind_sync(l)}const p=()=>s.get("files",l);d.querySelector(".files-home")?.addEventListener("click",()=>{if(u.follows(l)){n.terminal.line_run("cd ~");return}const g=p();g!==void 0&&u.rooted_walk(l,g,"~")}),d.querySelector(".files-back")?.addEventListener("click",()=>{if(u.follows(l)){n.terminal.line_run("cd -");return}const g=p();g!==void 0&&u.rooted_back(l,g)});const f=()=>p()?.path_current()??null;d.querySelector(".files-mkdir")?.addEventListener("click",()=>{const g=f();g!==null&&u.directory_make(l,g)}),d.querySelector(".files-refresh")?.addEventListener("click",()=>{const g=f();g!==null&&u.listing_refresh(l,g)});const b=d.querySelector(".files-upload-input");d.querySelector(".files-upload")?.addEventListener("click",()=>{f()!==null&&b?.click()}),b?.addEventListener("change",()=>{const g=f(),m=b.files;g===null||m===null||m.length===0||(u.files_deliver(l,g,Array.from(m)),b.value="")})},o=(l,c)=>{const d=u=>u.modelKind==="fs.file"?u.address.replace(/\/[^/]*$/,"")||"/":u.address;c("ENTER NODE","move the session into the indicated node (its data directory)",()=>{const u=i.regard_get(l),h=s.get("dag",l)?.feed_get()??null,p=u===null?h===null?null:`/proc/jobs/feed_${h}`:d(u);p!==null&&n.terminal.line_run(`cd "${p}"`)}),c("PROCESS NODE","run an executable on the indicated node's output (a catalogue opens beside)",()=>{const u=i.regard_get(l),h=s.get("dag",l)?.feed_get()??null;if(u===null||h===null)return;const p=d(u),f=nu(p)??(/_(\d+)\/?$/.exec(p)===null?null:parseInt(/_(\d+)\/?$/.exec(p)?.[1]??"",10));f!==null&&e.process_open(l,{input:p.replace(/\/data\/?$/,"")+"/data",feed:h,node:f})}),c("ENTER FEED","move the session into the feed on stage (or the one picked in the roster)",()=>{const u=s.get("dag",l)?.feed_get()??null;u!==null&&n.terminal.line_run(`cd "/proc/jobs/feed_${u}"`)}),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)",()=>{s.get("dag",l)?.detail_clear()}),c("REFRESH","revisit the feed now (a watch keeps sampling it while it runs)",()=>{s.get("dag",l)?.refresh()})};return(l,c,d)=>{const u=d.querySelector(".pane-drawer"),h=d.querySelector(".pane-handle");if(u===null||h===null)return;r(l,u,h);const p=u.querySelector(".drawer-children");if(p===null)return;const f=(b,g,m)=>{const z=document.createElement("button");z.className="pacs-capsule drawer-child",z.textContent=b,z.title=g,z.addEventListener("click",()=>{m(),u.hidden=!0,n.sound("audio3")}),p.appendChild(z)};(c==="files"||c==="catalogue")&&a(l,u,d),c==="dag"&&o(l,f)}}function UG(n,e){const{layout:t,panels:s,paneInstance_get:i,subjects:r}=n,a=u=>i(u)?.kind??null,o=(u,h)=>{const p=new Set(t.panes_shown()),f=r.group_of(h),b=s.entries(u).filter(([g])=>p.has(g));return s.get(u,h)??b.find(([g])=>r.group_of(g)===f)?.[1]??(b.length===1?b[0]?.[1]:void 0)},l=async(u,h,p)=>{if(h==="state"){const f=u.state_get();if(f===null)return"image state: no image on the field";const b=(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}
4250
4250
  viewports: ${b||"(none)"}`}if(h==="layout"){const f=p[0]??"";return bz.includes(f)?await u.layout_set(f)?`image layout ${f}`:u.state_get()?.waiting===f?`image layout ${f}: waiting for LOAD`:`image layout ${f}: not offered`:"image layout single|mpr|3d|slab"}if(h==="slice"){const f=Number(p[0]);return!Number.isInteger(f)||f<1?"image slice <n>":u.slice_set(f)?`image slice ${f}`:`image slice ${f}: not offered`}if(h==="series"){const f=Number(p[0]),b=u.siblings_get();if(b.length===0)return"image series: this pane holds one series, not a study";const g=b[f-1];if(g===void 0)return`image series <1..${b.length}>: ${b.map((z,w)=>`${w+1} ${z.label}`).join(" · ")}`;const m=await e.series_ask(g.path);return m===null?`image series ${f}: ${g.path}: not a readable DICOM series`:(u.series_show(m,{siblings:[...b]}),`image series ${f} ${g.label}`)}if(h==="wl"){if((p[0]??"").toLowerCase()==="preset"){const g=p[1]??"";return g===""?"image wl preset <brain|bone|lung|soft|liver>":u.wlPreset_set(g)?`image wl preset ${g}`:`image wl preset ${g}: none for this modality`}const f=Number(p[0]),b=Number(p[1]);return!Number.isFinite(f)||!Number.isFinite(b)||f>=b?"image wl <lower> <upper> | image wl preset <name>":u.wl_set(f,b)?`image wl ${f} ${b}`:"image wl: not offered"}if(h==="colormap"){const f=(p[0]??"").toLowerCase();return Oo.includes(f)?u.colormap_set(f)?`image colormap ${f}`:`image colormap ${f}: not offered`:"image colormap gray|hot|jet|cool"}if(h==="save")return await u.annotations_save()?"image save":"image save: nothing saved (the console says why)";if(h==="load")return await u.load_press()?"image load":"image load: nothing was waiting";if(h==="guard"){if((p[0]??"").toLowerCase()==="off")return u.guard_set(null),"image guard off";const b=Number(p[0]);return!Number.isFinite(b)||b<0?`image guard <bytes>|off (now ${u.guard_get()===null?"off":u.guard_get()})`:(u.guard_set(b),`image guard ${b}`)}if(h==="ghost"){const b=(p[0]??"").toLowerCase()==="off"?null:Number(p[0]);return b!==null&&(!Number.isFinite(b)||b<0||b>1)?"image ghost <0..1>|off (SLAB layout)":u.ghost_set(b)?`image ghost ${b===null?"off":b}`:"image ghost: SLAB layout only"}if(h==="tags"){const f=s.idOf("image",u);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=(u,h,p)=>{if(h==="redact"){const f=(p[0]??"").toLowerCase();return f!=="on"&&f!=="off"?"tags redact on|off":(u.redact_set(f==="on"),`tags redact ${f}`)}if(h==="filter"){const f=p.join(" ");return f===""||f.toLowerCase()==="off"?(u.filter_set(null),"tags filter off"):(u.filter_set(f),`tags filter ${f}`)}return"tags redact on|off · filter <text>|off"},d=()=>{const u=t.tree_get();if(u===null)return"# empty desktop";const h=[],p=v=>"pane"in v?v.pane:p(v.first),f=p(u),b=a(f);h.push(`view ${b==="dag"?"runs":b==="pacs"?"pacs":"files"}`);let g=1;const m=(v,O)=>{const S=a(v);if(S==="dag"&&v!==f&&h.push(`pane %${O} claim runs`),S==="files"&&v!==f&&r.group_of(v)===v&&h.push(`pane %${O} claim files`),S==="dag"){const M=i(v)?.mount,y=M?.querySelector(".dag-strategy")?.textContent?.toLowerCase()??"ranked",E=M?.querySelector(".dag-projection")?.textContent?.toLowerCase()??"3d",A=M?.querySelector(".dag-hue")?.textContent?.toLowerCase()??"status";y!=="ranked"&&h.push(`dag %${O} layout ${y}`),E!=="3d"&&h.push(`dag %${O} projection ${E}`),A!=="status"&&h.push(`dag %${O} hue ${A}`)}},z=(v,O)=>{if("pane"in v){m(v.pane,O);return}const S=p(v.second),M=a(S),y=M==="view"?"viewer":M==="files"&&r.group_of(S)!==S?"fs":"unlinked";h.push(`pane %${O} bind ${y}`),h.push(`pane %${O} split ${v.dir==="col"?"right":"below"}`);const E=++g;z(v.first,O),z(v.second,E)};z(u,g);const w=document.body.dataset.header;return w!==void 0&&h.push(`header ${w}`),document.getElementById("drawer")?.classList.contains("drawer-closed")&&h.push("console close"),h.join(`
4251
4251
  `)};return{focused_get:()=>{const u=document.body.dataset.zoom;return u!==void 0&&u!=="console"?u:t.focused_get()??t.panes_shown()[0]??null},focus_set:u=>i(u)===void 0?!1:(t.focus_set(u),!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 u=t.focus_last();return u!==null&&n.sound("audio3"),u===null?null:`focused ${u}`},paneRect_get:u=>document.querySelector(`.layout-leaf[data-leaf="${u}"]`)?.getBoundingClientRect()??null,paneMount_get:u=>i(u)?.mount??null,paneKind_get:a,paneLinked_get:u=>r.group_of(u)!==u,feed_enter:e.feed_enter,consoleZoom_toggle:e.consoleZoom_toggle,launcher_enter:e.launcher_enter,identity_get:e.identity_get,node_immerse:u=>{const p=r.regard_get(u)?.address.match(/_(\d+)(?:\/data)?\/?$/)??null;return p===null?!1:s.get("dag",u)?.node_flyTo(parseInt(p[1]??"",10))??!1},file_download:u=>{const h=r.regard_get(u);return h===null||h.modelKind!=="fs.file"?!1:(e.file_save(h.address),!0)},image_open:(u,h,p)=>e.image_open(u,h,p??{}),image_control:async(u,h,p)=>{const f=o("image",u);return f===void 0?`image ${h}: no image pane on stage for '${u}'`:l(f,h,p)},universe_control:(u,h,p)=>{const f=new Set(t.panes_shown()),b=(u!==null?s.get("universe",u):void 0)??s.entries("universe").find(([g])=>f.has(g))?.[1];return b===void 0?"universe: no universe pane on stage (press the dashboard tile)":b.control(h,p)},tags_control:(u,h,p)=>{const f=o("tags",u);return f===void 0?`tags ${h}: no tags pane on stage for '${u}'`:c(f,h,p)},file_delete:u=>{const h=r.regard_get(u);return h===null||h.modelKind!=="fs.file"?!1:(n.terminal.line_run(`rm "${h.address}"`),!0)},session_run:async u=>{try{return(await n.client.line_execute(u,{silent:!0,observe:!1})).envelopes.map(p=>p.renderedErr??p.rendered).join(`
4252
- `)}catch(h){return h instanceof Error?h.message:String(h)}},desktop_serialize:d}}function FG(n,e,t){if(t===!0)return"daemon-older";if(e===void 0)return null;const s=e.surface;return t===!1?s!==void 0&&n.built<s.built?"argus-older":null:s===void 0?"daemon-older":s.git===n.git&&s.built===n.built?null:n.built>=s.built?"daemon-older":"argus-older"}const Xu={"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 VM(n){const e=Xu[n];return`${e.before}${e.cure}${e.after}`}async function jG(n){try{const e=n??(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 s=await t.json(),r=s.releases?.[0]?.changes?.find(a=>a.internal!==!0)?.headline;return typeof r!="string"||typeof s.version!="string"?null:{version:s.version,headline:r}}catch{return null}}const om=96;function $G(n){const e=n.headline.length>om?`${n.headline.slice(0,om-1).trimEnd()}…`:n.headline;return`argus ${n.version} · ${e} — WHAT'S NEW after restart`}function VG(n,e,t,s,i=document.body,r){i.querySelector(".build-mismatch")?.remove();const a=t.surface!==void 0?`ARGUS ${t.surface.git} built ${t.surface.built}Z`:"an ARGUS too old to say its build";s(`argus: ${VM(n)}`);const o=t.surface!==void 0&&t.surface.git===e.git&&t.surface.built===e.built;s(o?`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 ${a}`);const l=Xu[n],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=n,c.setAttribute("role","alert");const d=document.createElement("span");d.className="stale-page-words";let u=document.createTextNode(l.cure);if(n==="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()}),u=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),u=p}d.append(document.createTextNode(l.before),u,document.createTextNode(l.after));const h=document.createElement("button");h.type="button",h.className="build-mismatch-dismiss",h.textContent="×",h.title="dismiss (the status strip keeps saying it)",h.addEventListener("click",()=>{c.remove()}),c.append(d,h),i.appendChild(c),n==="daemon-older"&&jG().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=$G(p),d.appendChild(f)})}function HG(n,e,t,s=document.body){const i={git:"ecfe0e09",built:"2026-10-05 16:17"};let r=[],a,o=null;const l=d=>{r!==null?r.push(d):e(d)},c=d=>{if(a===void 0)return;const u=FG(i,a,d);if(u!==o){if(o=u,u===null){n.build_show(null),s.querySelector(".build-mismatch")?.remove();return}n.build_show(Xu[u].readout,VM(u)),VG(u,i,a,l,s,fl(window.location.search)?t:void 0)}};return{attach_take:d=>{a=d.stack,c(d.stale)},stale_take:d=>c(d),release:()=>{const d=r??[];r=null;for(const u of d)e(u)}}}function qG(n=document.getElementById("door-pill")){n===null||!fl(window.location.search)||(n.hidden=!1,n.addEventListener("click",()=>{const e=Ho(window.location.pathname,"logout"),t=Ho(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(t)})}))}const XG="Restart the calypso daemon? You'll stay logged in; the page reloads when the new daemon is up.";function KG(n){const e=[];n.running!==null&&e.push(`the running command: ${n.running}`);for(const r of n.unsaved)e.push(`an unsaved edit in ${r}`);const t=n.others.filter(r=>r.kind==="browser").length,s=n.others.length-t,i=[];return t>0&&i.push(t===1?"1 other browser":`${t} other browsers`),s>0&&i.push(s===1?"1 chell":`${s} chells`),i.length>0&&e.push(`${i.join(" and ")}, which will be disconnected`),e}function YG(n){return n==="restart"?"The calypso daemon is restarting (asked from another browser or surface). Following it…":n==="end"?"The calypso daemon was ended by an administrator.":"The calypso daemon stopped."}function ZG(n,e){const t=document.createElement("div");t.className="stale-page restart-question",t.setAttribute("role","alertdialog");const s=document.createElement("div");s.className="stale-page-words";const i=document.createElement("div");if(i.textContent=XG,s.append(i),n.length>0){const d=document.createElement("ul");d.className="restart-cuts";const u=document.createElement("li");u.className="restart-cuts-lead",u.textContent="This will cut off:",d.append(u);for(const h of n){const p=document.createElement("li");p.textContent=h,d.append(p)}s.append(d)}const r=document.createElement("button");r.type="button",r.className="restart-yes",r.textContent="YES";const a=document.createElement("button");a.type="button",a.className="restart-no",a.textContent="NO";let o=!1;const l=d=>{o||(o=!0,t.remove(),e(d))};r.addEventListener("click",()=>l(!0)),a.addEventListener("click",()=>l(!1)),t.addEventListener("keydown",d=>{d.key!=="Enter"&&d.key!=="Escape"||(d.preventDefault(),d.stopPropagation(),l(d.key==="Enter"))});const c=document.createElement("div");return c.className="restart-answers",c.append(r,a),t.append(s,c),t}function QG(n,e=document.body){const t=fl(window.location.search);let s=null,i=null,r=[],a=!1;const o=h=>{e.querySelector(".restart-said")?.remove();const p=document.createElement("div");p.className="stale-page restart-said",p.setAttribute("role","alert"),p.textContent=h,e.appendChild(p)},l=h=>{window.location.assign(`${Ho(window.location.pathname,"greet")}/${encodeURIComponent(h)}`)},c=async()=>{a=!0,o("Restarting the calypso daemon…");try{const h=await fetch(Ho(window.location.pathname,"restart"),{method:"POST",headers:{accept:"application/json"}}),p=await h.json();if(!h.ok||p.key===void 0)throw new Error(p.error??`the door answered ${h.status}`);l(p.key)}catch(h){a=!1,o(`The calypso daemon could not be restarted: ${h instanceof Error?h.message:String(h)}`)}},d=()=>{if(!t||e.querySelector(".restart-question")!==null)return;const h={running:i,unsaved:n.unsaved(),others:r.filter(f=>f.id!==s)},p=ZG(KG(h),f=>{f&&c()});e.querySelector(".build-mismatch")?.remove(),e.appendChild(p),p.querySelector(".restart-yes")?.focus()},u=document.getElementById("restart-pill");return u!==null&&t&&(u.hidden=!1,u.addEventListener("click",d)),{ask:d,attach_take:h=>{s=h.surface??null},telemetry_take:h=>{h?.lane!==void 0&&(i=h.lane.running?.line??null),h?.surfaces!==void 0&&(r=h.surfaces)},closing_take:h=>{if(a||(o(YG(h)),h!=="restart"||!t))return;const p=window.location.pathname.split("/").filter(f=>f.length>0).at(-1);p!==void 0&&setTimeout(()=>l(p),1200)}}}function JG(n,e,t,s){n.line_execute(`motd ${t}`,{silent:!0,observe:!1}).then(i=>{const r=i.envelopes.filter(a=>a.status==="ok").map(a=>a.rendered).join("").trimEnd();r.length>0&&e.greeting_write(r.split(`
4253
- `))}).catch(()=>{}).finally(s)}let gi=()=>{};function lm(){gi(document.body.dataset.zoom==="console"?null:"console")}const eR=k0(),tR="ARGUS",cm="argus-audio",sR=.4;let Mi=!1;function Ns(n){if(Mi)return;const e=document.getElementById(n);e instanceof HTMLAudioElement&&(e.currentTime=0,e.volume=sR,e.play().catch(()=>{}))}function nR(){const n=Ke("head-menu-pill"),e=t=>{t?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,n.setAttribute("aria-expanded",String(t))};n.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 iR(){const n=Ke("audio-pill");try{Mi=window.localStorage.getItem(cm)==="off"}catch{Mi=!1}const e=()=>{n.classList.toggle("audio-off",Mi)};e(),n.addEventListener("click",()=>{Mi=!Mi;try{window.localStorage.setItem(cm,Mi?"off":"on")}catch{}e(),Ns("audio2")})}function Ke(n){const e=document.getElementById(n);if(e===null)throw new Error(`required element #${n} is missing`);return e}function ks(n){const e=Ke(n);if(!(e instanceof HTMLTemplateElement))throw new Error(`#${n} is not a template`);const t=e.content.firstElementChild;if(!(t instanceof HTMLElement))throw new Error(`template #${n} is empty`);return t.cloneNode(!0)}function ds(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`pane template is missing ${e}`);return t}function rR(){return U0(window.location)}let Cc=null,dl=0;function Ku(n,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(dl=Math.ceil(n.offsetTop+n.offsetHeight),e.style.setProperty("--zoom-header-height",`${dl}px`))};t(),Cc===null&&(Cc=new ResizeObserver(t),Cc.observe(n))}const dm=120,aR=96;function oR(n,e,t,s){let i="";const r=d=>{d?(i=n.style.height,n.style.height=""):i!==""&&(n.style.height=i),n.classList.toggle("drawer-closed",d),Ns("audio3"),d||(s.size_fit(),s.focus_take())};t.addEventListener("click",()=>r(!n.classList.contains("drawer-closed")));let a=0,o=0,l=!1;e.addEventListener("pointerdown",d=>{l=!0,a=d.clientY,o=n.getBoundingClientRect().height,n.classList.add("drawer-dragging"),e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{if(!l)return;const u=Math.max(dm,window.innerHeight-aR),h=o+(d.clientY-a),p=Math.min(Math.max(dm,h),u);n.style.height=`${p}px`,s.size_fit()});const c=()=>{l=!1,n.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function lR(n){const e=document.body,t=document.querySelector(".wrap:not(#gap)");let s;const i=r=>{for(const a of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))a.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,s!==void 0&&(e.dataset.header=s,s=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(s="away",delete e.dataset.header,dl>0&&e.style.setProperty("--zoom-header-height",`${dl}px`)):t!==null&&Ku(t,e),e.dataset.zoom=r;const o=Ro(r)?.mount?.parentElement??null;o?.classList.add("pane-zoomed");let l=o?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const a of document.querySelectorAll(".drawer-zoom"))a.textContent=r!==null&&a.dataset.pane===r?"RESTORE":"ZOOM";Ns("audio3")};return Ke("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&i(null)}),document.addEventListener("click",r=>{const a=r.target;if(!(a instanceof Element))return;const o=a.closest("[data-pane]");if(o===null)return;const l=o.dataset.pane??"";l!==""&&i(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(i(null),r.stopImmediatePropagation())}),Ke("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&n.size_fit()}),i}function cR(){const n=new gI(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&n.telemetryPanel_bind(e),n}const Pc=96,dR=220,um="argus.headerBand.height",uR=52;function hR(){const n=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const s=d=>{const u=Math.max(Pc,window.innerHeight-dR),h=Math.min(Math.max(Pc,d),u);n.style.setProperty("--header-band-h",`${h}px`);try{window.localStorage.setItem(um,String(h))}catch{}},i=(()=>{try{return window.localStorage.getItem(um)}catch{return null}})();i!==null&&Number.isFinite(Number(i))&&s(Number(i));const r=()=>{const d=t.getBoundingClientRect();e.style.top=`${Math.max(0,d.bottom-uR)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let a=!1,o=0,l=0;e.addEventListener("pointerdown",d=>{const u=document.querySelector(".header-face");a=!0,o=d.clientY,l=u===null?Pc:u.getBoundingClientRect().height,e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{a&&(s(l+(d.clientY-o)),r())});const c=()=>{a=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let Yu=null;function fR(n){const e=n.querySelector(".gather-rows");if(e===null)return;const t=Vs(e,{rows:".listing-row",label:s=>`+${s} MORE · ON STAGE`,press:()=>{Yu?.()},className:"strategy-pill gather-more",mount:n});t.title="the whole cohort as a pane on the main panel"}function hm(n){Vs(n,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function pR(){const n=e=>{for(const t of e.querySelectorAll(".mode-frame:not([data-more])"))hm(t)};new MutationObserver(e=>{for(const t of e)for(const s of t.addedNodes)s instanceof HTMLElement&&(s.matches(".mode-frame")&&s.dataset.more===void 0&&hm(s),n(s))}).observe(document.body,{childList:!0,subtree:!0}),n(document)}function fm(n){const e=n?.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 mR(){const n=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{n.dataset.header===r?(e!==null&&Ku(e,n),n.dataset.header="away"):n.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 s=document.querySelector(".header-gather-field");s?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),Yu?.()}),s!==null&&fR(s),pR();const i=()=>{n.dataset.zoom===void 0&&(delete n.dataset.header,Ns("audio3"))};Ke("header-restore").addEventListener("click",i),window.addEventListener("keydown",r=>{r.key==="Escape"&&n.dataset.header==="away"&&n.dataset.zoom===void 0&&n.dataset.gutter!=="away"&&i()})}const gr=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],HM="argus-landing",gR=15e3;function pm(){try{return(window.localStorage.getItem(HM)??"launcher")==="launcher"}catch{return!0}}function MR(n){try{window.localStorage.setItem(HM,n?"launcher":"last")}catch{}}const mm="argus-theme",bR="argus-lcars",_R="medical",zR={sickbay:"medical"};function wR(){const n=Ke("theme-pill"),e=Math.max(gr.findIndex(r=>r.key===_R),0);let t=e;try{const r=window.localStorage.getItem(mm)??window.localStorage.getItem(bR),a=r===null?null:zR[r]??r,o=gr.findIndex(l=>l.key===a);t=o>=0?o:e}catch{t=e}const s=document.documentElement,i=()=>{const r=gr[t]??gr[0];r.key==="lower-decks"?delete s.dataset.theme:s.dataset.theme=r.key,n.textContent=r.label};i(),n.addEventListener("click",()=>{t=(t+1)%gr.length,i();try{window.localStorage.setItem(mm,gr[t]?.key??"lower-decks")}catch{}Ns("audio2")})}function yR(n){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const t={cumin:n.stack?.cumin,salsa:n.stack?.salsa,chili:n.stack?.chili,brasa:n.stack?.brasa,calypso:n.stack?.calypso,chell:n.stack?.chell},s=[];for(const[i,r]of Object.entries(t))r!==void 0&&s.push([i.toUpperCase(),r]);s.push(["MENU","0.19.0"],["ARGUS","ecfe0e09 · 2026-10-05 16:17Z"],["WIRE",`V${n.protocolVersion}`]),n.stack?.build!==void 0&&s.push(["BUILD",n.stack.build]);for(const[i,r]of s){const a=document.createElement("div");a.className="telemetry-row";const o=document.createElement("span");o.className="telemetry-label",o.textContent=i;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r,l.title=r,a.append(o,l),e.appendChild(a)}}function vR(){for(const n of document.querySelectorAll(".left-frame button, .left-frame-top button"))n.addEventListener("click",()=>Ns("audio2"))}let br=null;async function OR(n){const e=new oI(document),t=new cI(Ke("index-instrument"),()=>Date.now(),{errored_open:()=>li("status:error")}),s=new uI(Ke("lane-instrument"));window.setInterval(()=>s.tick(),500);const i=new OI,r=new nI;r.writeObserver_set((D,R)=>{Xe.regard_send({address:D.address,...D.modelKind!==void 0?{modelKind:D.modelKind}:{},groupId:R,paneId:D.paneId}),Z()});const a={get layout(){return $},panels:i,paneInstance_get:Ro,subjects:r,get dormant(){return ne},sound:Ns,get terminal(){return ge},get client(){return Xe}},o=BI(a,{catalogue_of:D=>S.get(D),run_press:(D,R,ee)=>{We(D,R,ee)}}),l=o.entry_show,c=D=>du(D,n),d=WG(a,{vfsUrl_build:c,downloadUrl_build:D=>F0(D,n),image_open:(D,R)=>L(D,R),process_open:(D,R)=>H(D,R),run_press:(D,R,ee)=>{We(D,R,ee)},cohort_gather:D=>ae(D),verbLine_run:(D,R)=>N(D,R),ask_onPane:(D,R)=>x(D,R),binEntry_show:l,catalogue_of:D=>S.get(D),promptUser:()=>v,template_stamp:ks,pane_find:ds}),{previewProvider:u,fileText_fetch:h,file_save:p,rootedListing_show:f,listing_refresh:b,directory_make:g,files_deliver:m,filesBody_stamp:z,rowVerbs_of:w}=d,_=d.instance_build;let v=null,O=null;const S=new Map,M=D=>{const R=ks("tpl-pane-universe"),ee=new xT({canvas:ds(R,".universe-canvas"),title:ds(R,".universe-title"),state:R.querySelector(".pane-state"),empty:ds(R,".universe-empty"),projectionPill:R.querySelector(".universe-projection"),refreshPill:R.querySelector(".universe-refresh"),replayPill:R.querySelector(".universe-replay"),scalePill:R.querySelector(".universe-scale"),viewPill:R.querySelector(".universe-view"),gravityPill:R.querySelector(".universe-gravity"),densityPill:R.querySelector(".universe-density"),drawPill:R.querySelector(".universe-draw"),captionsPill:R.querySelector(".universe-captions"),arrangementPill:R.querySelector(".universe-arrangement"),facts:R.querySelector(".universe-facts"),backPill:R.querySelector(".universe-back"),openPill:R.querySelector(".universe-open")},{command_run:q=>{Xe.line_execute(q,{silent:!0,observe:!1}).then(ie=>{for(const we of ie.envelopes)ee.envelope_observe(we)})},feed_dag:async q=>{const ie=await Xe.line_execute(`feed diagram feed_${q}`,{silent:!0,observe:!1});for(const we of ie.envelopes){if(we.model?.kind!==Xn.feedDag)continue;const xe=Hc.safeParse(we.model.data);if(xe.success)return xe.data}return null},node_enter:q=>{ge.line_run(`cd "${q}"`)},node_dive:q=>{Fe(D,q.replace(/\/data$/,""))},node_process:q=>{const ie=_a(q.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)[1])),we=v===null?q.vfsPath:q.vfsPath.replace(/^\/proc\/jobs\//,`/home/${v}/feeds/`);H(D,{input:we,feed:ie,node:q.instanceId})},feed_open:q=>{li(),xt.feed_enter(q)},plugin_open:q=>{(async()=>{const ie=await Xe.line_execute("ls /bin",{silent:!0,observe:!1}),we=[];for(const et of ie.envelopes){if(et.model?.kind!=="fs.listing")continue;const tt=et.model.data,ft=Array.isArray(tt)?tt:[tt];for(const Zt of ft)for(const bt of Zt.items??[])we.push(bt.name)}const xe=we.filter(et=>et.startsWith(`${q}-v`)).sort((et,tt)=>et.localeCompare(tt,void 0,{numeric:!0})).pop();if(xe===void 0){ge.line_note(`universe: ${q} is not in /bin`);return}Ke("gutter-files").click(),l("files",i.get("files","files"),`/bin/${xe}`,"plugin")})().catch(ie=>{ge.line_note(`universe: could not open ${q} in /bin: ${ie instanceof Error?ie.message:String(ie)}`)})},note:q=>ge.line_note(q)},gh());return i.set("universe",D,ee),{id:D,kind:"universe",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D),ee.dispose()}}},y=D=>{const R=ks("tpl-pane-image"),ee=new YT(R,{source:{url_of:c},note:q=>ge.line_note(q),regard:q=>r.regard_write(D,{address:q,modelKind:"dicom.instance"}),file_put:async(q,ie)=>{try{return(await fetch(c(q),{method:"POST",body:ie})).status}catch{return 0}},tags_read:q=>A(q),tags_open:()=>{ge.line_note(G(D))}});return i.set("image",D,ee),{id:D,kind:"image",mount:R,dispose:()=>{ee.dispose(),i.delete(D),r.pane_leave(D)}}},E=D=>{const R=ks("tpl-pane-tags"),ee=new QT(R,{note:q=>ge.line_note(q)});return i.set("tags",D,ee),{id:D,kind:"tags",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D)}}},A=async D=>{try{const R=await Xe.line_execute(`dcm tags "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Ia.tags)continue;const q=hh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},I=(D,R)=>{const ee=i.get("tags",D);ee===void 0||ee.path_get()===R||A(R).then(q=>{if(q===null){ge.line_note(`tags: ${R}: not a readable DICOM file`);return}i.get("tags",D)?.model_show(q)})},G=D=>{const R=new Set($.panes_shown()),ee=r.group_of(D);for(const ie of i.ids("tags"))if(R.has(ie)&&r.group_of(ie)===ee)return $.focus_set(ie),"image tags";if(!R.has(D))return"image tags: the image pane is not on stage";const q=ht("tags",D);return $.leaf_split(D,he.replayPlace_get()?.dir??"col",q.id,he.replayPlace_get()?.before??!1)?(Te(q.id,D,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),"image tags"):(es(q.id),$.mount_remove(q.id),"image tags: could not open beside the image pane")},C=async D=>{try{const R=await Xe.line_execute(`dcm series "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Ia.series)continue;const q=fh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},B=async D=>{try{const R=await Xe.line_execute(`ls "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!=="fs.listing")continue;const q=ee.model.data,ie=(Array.isArray(q)?q[0]:q)??{},we=(ie.path??D).replace(/\/$/,"");return(ie.items??[]).filter(xe=>xe.type==="dir").map(xe=>`${we}/${xe.name}`)}}catch{}return[]},P=(D,R)=>{const ee=et=>{R!==void 0&&r.regard_write(et,R)};if(D!==null&&i.has("image",D))return ee(D),i.get("image",D)??null;const q=new Set($.panes_shown());if(R!==void 0){for(const[et,tt]of i.entries("image"))if(q.has(et)&&r.regard_get(et)?.address===R.address)return ee(et),tt}const ie=D!==null?r.group_of(D):null;for(const[et,tt]of i.entries("image"))if(q.has(et)&&ie!==null&&r.group_of(et)===ie)return tt;const we=D!==null&&q.has(D)?D:Ft();if(we===null)return null;const xe=ht("image",D??void 0);return $.leaf_split(we,he.replayPlace_get()?.dir??"col",xe.id,he.replayPlace_get()?.before??!1)?(Te(xe.id,we,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),ee(xe.id),i.get("image",xe.id)??null):(es(xe.id),$.mount_remove(xe.id),null)},L=async(D,R,ee={},q)=>{re();const ie=D!==null?void 0:ed.test(R)?{address:R,modelKind:"image.volume"}:{address:Xo.test(R)?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,""),modelKind:"dicom.series"},we=P(D,ie);if(we===null)return"image: no pane to open beside";const xe=i.idOf("image",we);if(xe!==null&&q?.(xe),ed.test(R))return we.opening_show(R),we.volume_show(R),`image ${R}`;const et=Xo.test(R),tt=et?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,"");we.opening_show(tt);let ft=await C(tt),Zt=[];if(ft===null&&!et){const Gt=(await B(tt)).slice(0,32);for(const Es of Gt){const Bn=await C(Es);if(Bn!==null){Zt=Gt.map(Dl=>({path:Dl,label:Dl.split("/").pop()??Dl})),ft=Bn;break}}}if(ft===null)return we.opening_fail(R,"NOT A READABLE SERIES"),`image: ${R}: not a readable DICOM series, study, or volume`;const bt=et?Math.max(1,ft.files.indexOf(R)+1):1;return we.series_show(ft,{siblings:Zt,startAt:bt,...ee.force===!0?{force:!0}:{}}),`image ${ft.path}${Zt.length>1?` (1 of ${Zt.length} series)`:""}`},H=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[xe,et]of S)if(ee.has(xe)&&et.input===R.input){$.focus_set(xe);return}const q=ee.has(D)?D:Ft()??D,ie=ht("catalogue",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",ie.id,he.replayPlace_get()?.before??!1)){es(ie.id),$.mount_remove(ie.id);return}Te(ie.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),S.set(ie.id,R);const we=i.get("files",ie.id);we!==void 0&&(we.binding_set({input:R.input,place:R.feed===null?"new feed":`feed ${R.feed}${R.node===null?"":` · node ${R.node}`}`}),we.feedOpen_declare(xe=>ce(ie.id,xe)),f(ie.id,we,"/bin"),J(we),$.focus_set(ie.id))},X=5,oe=40,J=D=>{Xe.line_execute(`plugininstance list --limit ${oe} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(ee=>{const q=[];for(const ie of ee.envelopes)if(!(ie.model?.kind!=="plugininstance.list"||!Array.isArray(ie.model.data)))for(const we of ie.model.data){if(typeof we.pluginName!="string"||typeof we.pluginVersion!="string"||v!==null&&typeof we.owner=="string"&&we.owner!==v||we.pluginName==="pl-dircopy")continue;const xe=`${we.pluginName}-v${we.pluginVersion}`;if(q.includes(xe)||q.push(xe),q.length>=X)break}D.recent_set(q.length===0?null:q)}).catch(()=>{})},ce=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[we,xe]of i.entries("dag"))if(we!=="dag"&&ee.has(we)&&xe.feed_get()===R){$.focus_set(we);return}const q=ee.has(D)?D:Ft()??D,ie=ht("dag",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",ie.id,he.replayPlace_get()?.before??!1)){es(ie.id),$.mount_remove(ie.id);return}Te(ie.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),i.get("dag",ie.id)?.feed_enter(R)},We=async(D,R,ee)=>{const q=S.get(D),ie=i.get("files",D);if(q===void 0||ie===void 0)return;const we=Gt=>{ge.output_write("err",`\x1B[31m${Gt}\x1B[0m
4252
+ `)}catch(h){return h instanceof Error?h.message:String(h)}},desktop_serialize:d}}function FG(n,e,t){if(t===!0)return"daemon-older";if(e===void 0)return null;const s=e.surface;return t===!1?s!==void 0&&n.built<s.built?"argus-older":null:s===void 0?"daemon-older":s.git===n.git&&s.built===n.built?null:n.built>=s.built?"daemon-older":"argus-older"}const Xu={"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 VM(n){const e=Xu[n];return`${e.before}${e.cure}${e.after}`}async function jG(n){try{const e=n??(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 s=await t.json(),r=s.releases?.[0]?.changes?.find(a=>a.internal!==!0)?.headline;return typeof r!="string"||typeof s.version!="string"?null:{version:s.version,headline:r}}catch{return null}}const om=96;function $G(n){const e=n.headline.length>om?`${n.headline.slice(0,om-1).trimEnd()}…`:n.headline;return`argus ${n.version} · ${e} — WHAT'S NEW after restart`}function VG(n,e,t,s,i=document.body,r){i.querySelector(".build-mismatch")?.remove();const a=t.surface!==void 0?`ARGUS ${t.surface.git} built ${t.surface.built}Z`:"an ARGUS too old to say its build";s(`argus: ${VM(n)}`);const o=t.surface!==void 0&&t.surface.git===e.git&&t.surface.built===e.built;s(o?`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 ${a}`);const l=Xu[n],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=n,c.setAttribute("role","alert");const d=document.createElement("span");d.className="stale-page-words";let u=document.createTextNode(l.cure);if(n==="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()}),u=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),u=p}d.append(document.createTextNode(l.before),u,document.createTextNode(l.after));const h=document.createElement("button");h.type="button",h.className="build-mismatch-dismiss",h.textContent="×",h.title="dismiss (the status strip keeps saying it)",h.addEventListener("click",()=>{c.remove()}),c.append(d,h),i.appendChild(c),n==="daemon-older"&&jG().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=$G(p),d.appendChild(f)})}function HG(n,e,t,s=document.body){const i={git:"7bfca227",built:"2026-10-05 17:51"};let r=[],a,o=null;const l=d=>{r!==null?r.push(d):e(d)},c=d=>{if(a===void 0)return;const u=FG(i,a,d);if(u!==o){if(o=u,u===null){n.build_show(null),s.querySelector(".build-mismatch")?.remove();return}n.build_show(Xu[u].readout,VM(u)),VG(u,i,a,l,s,fl(window.location.search)?t:void 0)}};return{attach_take:d=>{a=d.stack,c(d.stale)},stale_take:d=>c(d),release:()=>{const d=r??[];r=null;for(const u of d)e(u)}}}function qG(n=document.getElementById("door-pill")){n===null||!fl(window.location.search)||(n.hidden=!1,n.addEventListener("click",()=>{const e=Ho(window.location.pathname,"logout"),t=Ho(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(t)})}))}const XG="Restart the calypso daemon? You'll stay logged in; the page reloads when the new daemon is up.";function KG(n){const e=[];n.running!==null&&e.push(`the running command: ${n.running}`);for(const r of n.unsaved)e.push(`an unsaved edit in ${r}`);const t=n.others.filter(r=>r.kind==="browser").length,s=n.others.length-t,i=[];return t>0&&i.push(t===1?"1 other browser":`${t} other browsers`),s>0&&i.push(s===1?"1 chell":`${s} chells`),i.length>0&&e.push(`${i.join(" and ")}, which will be disconnected`),e}function YG(n){return n==="restart"?"The calypso daemon is restarting (asked from another browser or surface). Following it…":n==="end"?"The calypso daemon was ended by an administrator.":"The calypso daemon stopped."}function ZG(n,e){const t=document.createElement("div");t.className="stale-page restart-question",t.setAttribute("role","alertdialog");const s=document.createElement("div");s.className="stale-page-words";const i=document.createElement("div");if(i.textContent=XG,s.append(i),n.length>0){const d=document.createElement("ul");d.className="restart-cuts";const u=document.createElement("li");u.className="restart-cuts-lead",u.textContent="This will cut off:",d.append(u);for(const h of n){const p=document.createElement("li");p.textContent=h,d.append(p)}s.append(d)}const r=document.createElement("button");r.type="button",r.className="restart-yes",r.textContent="YES";const a=document.createElement("button");a.type="button",a.className="restart-no",a.textContent="NO";let o=!1;const l=d=>{o||(o=!0,t.remove(),e(d))};r.addEventListener("click",()=>l(!0)),a.addEventListener("click",()=>l(!1)),t.addEventListener("keydown",d=>{d.key!=="Enter"&&d.key!=="Escape"||(d.preventDefault(),d.stopPropagation(),l(d.key==="Enter"))});const c=document.createElement("div");return c.className="restart-answers",c.append(r,a),t.append(s,c),t}function QG(n,e=document.body){const t=fl(window.location.search);let s=null,i=null,r=[],a=!1;const o=h=>{e.querySelector(".restart-said")?.remove();const p=document.createElement("div");p.className="stale-page restart-said",p.setAttribute("role","alert"),p.textContent=h,e.appendChild(p)},l=h=>{window.location.assign(`${Ho(window.location.pathname,"greet")}/${encodeURIComponent(h)}`)},c=async()=>{a=!0,o("Restarting the calypso daemon…");try{const h=await fetch(Ho(window.location.pathname,"restart"),{method:"POST",headers:{accept:"application/json"}}),p=await h.json();if(!h.ok||p.key===void 0)throw new Error(p.error??`the door answered ${h.status}`);l(p.key)}catch(h){a=!1,o(`The calypso daemon could not be restarted: ${h instanceof Error?h.message:String(h)}`)}},d=()=>{if(!t||e.querySelector(".restart-question")!==null)return;const h={running:i,unsaved:n.unsaved(),others:r.filter(f=>f.id!==s)},p=ZG(KG(h),f=>{f&&c()});e.querySelector(".build-mismatch")?.remove(),e.appendChild(p),p.querySelector(".restart-yes")?.focus()},u=document.getElementById("restart-pill");return u!==null&&t&&(u.hidden=!1,u.addEventListener("click",d)),{ask:d,attach_take:h=>{s=h.surface??null},telemetry_take:h=>{h?.lane!==void 0&&(i=h.lane.running?.line??null),h?.surfaces!==void 0&&(r=h.surfaces)},closing_take:h=>{if(a||(o(YG(h)),h!=="restart"||!t))return;const p=window.location.pathname.split("/").filter(f=>f.length>0).at(-1);p!==void 0&&setTimeout(()=>l(p),1200)}}}function JG(n,e,t,s){n.line_execute(`motd ${t}`,{silent:!0,observe:!1}).then(i=>{const r=i.envelopes.filter(a=>a.status==="ok").map(a=>a.rendered).join("").trimEnd();r.length>0&&e.greeting_write(r.split(`
4253
+ `))}).catch(()=>{}).finally(s)}let gi=()=>{};function lm(){gi(document.body.dataset.zoom==="console"?null:"console")}const eR=k0(),tR="ARGUS",cm="argus-audio",sR=.4;let Mi=!1;function Ns(n){if(Mi)return;const e=document.getElementById(n);e instanceof HTMLAudioElement&&(e.currentTime=0,e.volume=sR,e.play().catch(()=>{}))}function nR(){const n=Ke("head-menu-pill"),e=t=>{t?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,n.setAttribute("aria-expanded",String(t))};n.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 iR(){const n=Ke("audio-pill");try{Mi=window.localStorage.getItem(cm)==="off"}catch{Mi=!1}const e=()=>{n.classList.toggle("audio-off",Mi)};e(),n.addEventListener("click",()=>{Mi=!Mi;try{window.localStorage.setItem(cm,Mi?"off":"on")}catch{}e(),Ns("audio2")})}function Ke(n){const e=document.getElementById(n);if(e===null)throw new Error(`required element #${n} is missing`);return e}function ks(n){const e=Ke(n);if(!(e instanceof HTMLTemplateElement))throw new Error(`#${n} is not a template`);const t=e.content.firstElementChild;if(!(t instanceof HTMLElement))throw new Error(`template #${n} is empty`);return t.cloneNode(!0)}function ds(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`pane template is missing ${e}`);return t}function rR(){return U0(window.location)}let Cc=null,dl=0;function Ku(n,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(dl=Math.ceil(n.offsetTop+n.offsetHeight),e.style.setProperty("--zoom-header-height",`${dl}px`))};t(),Cc===null&&(Cc=new ResizeObserver(t),Cc.observe(n))}const dm=120,aR=96;function oR(n,e,t,s){let i="";const r=d=>{d?(i=n.style.height,n.style.height=""):i!==""&&(n.style.height=i),n.classList.toggle("drawer-closed",d),Ns("audio3"),d||(s.size_fit(),s.focus_take())};t.addEventListener("click",()=>r(!n.classList.contains("drawer-closed")));let a=0,o=0,l=!1;e.addEventListener("pointerdown",d=>{l=!0,a=d.clientY,o=n.getBoundingClientRect().height,n.classList.add("drawer-dragging"),e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{if(!l)return;const u=Math.max(dm,window.innerHeight-aR),h=o+(d.clientY-a),p=Math.min(Math.max(dm,h),u);n.style.height=`${p}px`,s.size_fit()});const c=()=>{l=!1,n.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function lR(n){const e=document.body,t=document.querySelector(".wrap:not(#gap)");let s;const i=r=>{for(const a of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))a.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,s!==void 0&&(e.dataset.header=s,s=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(s="away",delete e.dataset.header,dl>0&&e.style.setProperty("--zoom-header-height",`${dl}px`)):t!==null&&Ku(t,e),e.dataset.zoom=r;const o=Ro(r)?.mount?.parentElement??null;o?.classList.add("pane-zoomed");let l=o?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const a of document.querySelectorAll(".drawer-zoom"))a.textContent=r!==null&&a.dataset.pane===r?"RESTORE":"ZOOM";Ns("audio3")};return Ke("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&i(null)}),document.addEventListener("click",r=>{const a=r.target;if(!(a instanceof Element))return;const o=a.closest("[data-pane]");if(o===null)return;const l=o.dataset.pane??"";l!==""&&i(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(i(null),r.stopImmediatePropagation())}),Ke("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&n.size_fit()}),i}function cR(){const n=new gI(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&n.telemetryPanel_bind(e),n}const Pc=96,dR=220,um="argus.headerBand.height",uR=52;function hR(){const n=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const s=d=>{const u=Math.max(Pc,window.innerHeight-dR),h=Math.min(Math.max(Pc,d),u);n.style.setProperty("--header-band-h",`${h}px`);try{window.localStorage.setItem(um,String(h))}catch{}},i=(()=>{try{return window.localStorage.getItem(um)}catch{return null}})();i!==null&&Number.isFinite(Number(i))&&s(Number(i));const r=()=>{const d=t.getBoundingClientRect();e.style.top=`${Math.max(0,d.bottom-uR)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let a=!1,o=0,l=0;e.addEventListener("pointerdown",d=>{const u=document.querySelector(".header-face");a=!0,o=d.clientY,l=u===null?Pc:u.getBoundingClientRect().height,e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{a&&(s(l+(d.clientY-o)),r())});const c=()=>{a=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let Yu=null;function fR(n){const e=n.querySelector(".gather-rows");if(e===null)return;const t=Vs(e,{rows:".listing-row",label:s=>`+${s} MORE · ON STAGE`,press:()=>{Yu?.()},className:"strategy-pill gather-more",mount:n});t.title="the whole cohort as a pane on the main panel"}function hm(n){Vs(n,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function pR(){const n=e=>{for(const t of e.querySelectorAll(".mode-frame:not([data-more])"))hm(t)};new MutationObserver(e=>{for(const t of e)for(const s of t.addedNodes)s instanceof HTMLElement&&(s.matches(".mode-frame")&&s.dataset.more===void 0&&hm(s),n(s))}).observe(document.body,{childList:!0,subtree:!0}),n(document)}function fm(n){const e=n?.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 mR(){const n=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{n.dataset.header===r?(e!==null&&Ku(e,n),n.dataset.header="away"):n.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 s=document.querySelector(".header-gather-field");s?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),Yu?.()}),s!==null&&fR(s),pR();const i=()=>{n.dataset.zoom===void 0&&(delete n.dataset.header,Ns("audio3"))};Ke("header-restore").addEventListener("click",i),window.addEventListener("keydown",r=>{r.key==="Escape"&&n.dataset.header==="away"&&n.dataset.zoom===void 0&&n.dataset.gutter!=="away"&&i()})}const gr=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],HM="argus-landing",gR=15e3;function pm(){try{return(window.localStorage.getItem(HM)??"launcher")==="launcher"}catch{return!0}}function MR(n){try{window.localStorage.setItem(HM,n?"launcher":"last")}catch{}}const mm="argus-theme",bR="argus-lcars",_R="medical",zR={sickbay:"medical"};function wR(){const n=Ke("theme-pill"),e=Math.max(gr.findIndex(r=>r.key===_R),0);let t=e;try{const r=window.localStorage.getItem(mm)??window.localStorage.getItem(bR),a=r===null?null:zR[r]??r,o=gr.findIndex(l=>l.key===a);t=o>=0?o:e}catch{t=e}const s=document.documentElement,i=()=>{const r=gr[t]??gr[0];r.key==="lower-decks"?delete s.dataset.theme:s.dataset.theme=r.key,n.textContent=r.label};i(),n.addEventListener("click",()=>{t=(t+1)%gr.length,i();try{window.localStorage.setItem(mm,gr[t]?.key??"lower-decks")}catch{}Ns("audio2")})}function yR(n){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const t={cumin:n.stack?.cumin,salsa:n.stack?.salsa,chili:n.stack?.chili,brasa:n.stack?.brasa,calypso:n.stack?.calypso,chell:n.stack?.chell},s=[];for(const[i,r]of Object.entries(t))r!==void 0&&s.push([i.toUpperCase(),r]);s.push(["MENU","0.19.0"],["ARGUS","7bfca227 · 2026-10-05 17:51Z"],["WIRE",`V${n.protocolVersion}`]),n.stack?.build!==void 0&&s.push(["BUILD",n.stack.build]);for(const[i,r]of s){const a=document.createElement("div");a.className="telemetry-row";const o=document.createElement("span");o.className="telemetry-label",o.textContent=i;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r,l.title=r,a.append(o,l),e.appendChild(a)}}function vR(){for(const n of document.querySelectorAll(".left-frame button, .left-frame-top button"))n.addEventListener("click",()=>Ns("audio2"))}let br=null;async function OR(n){const e=new oI(document),t=new cI(Ke("index-instrument"),()=>Date.now(),{errored_open:()=>li("status:error")}),s=new uI(Ke("lane-instrument"));window.setInterval(()=>s.tick(),500);const i=new OI,r=new nI;r.writeObserver_set((D,R)=>{Xe.regard_send({address:D.address,...D.modelKind!==void 0?{modelKind:D.modelKind}:{},groupId:R,paneId:D.paneId}),Z()});const a={get layout(){return $},panels:i,paneInstance_get:Ro,subjects:r,get dormant(){return ne},sound:Ns,get terminal(){return ge},get client(){return Xe}},o=BI(a,{catalogue_of:D=>S.get(D),run_press:(D,R,ee)=>{We(D,R,ee)}}),l=o.entry_show,c=D=>du(D,n),d=WG(a,{vfsUrl_build:c,downloadUrl_build:D=>F0(D,n),image_open:(D,R)=>L(D,R),process_open:(D,R)=>H(D,R),run_press:(D,R,ee)=>{We(D,R,ee)},cohort_gather:D=>ae(D),verbLine_run:(D,R)=>N(D,R),ask_onPane:(D,R)=>x(D,R),binEntry_show:l,catalogue_of:D=>S.get(D),promptUser:()=>v,template_stamp:ks,pane_find:ds}),{previewProvider:u,fileText_fetch:h,file_save:p,rootedListing_show:f,listing_refresh:b,directory_make:g,files_deliver:m,filesBody_stamp:z,rowVerbs_of:w}=d,_=d.instance_build;let v=null,O=null;const S=new Map,M=D=>{const R=ks("tpl-pane-universe"),ee=new xT({canvas:ds(R,".universe-canvas"),title:ds(R,".universe-title"),state:R.querySelector(".pane-state"),empty:ds(R,".universe-empty"),projectionPill:R.querySelector(".universe-projection"),refreshPill:R.querySelector(".universe-refresh"),replayPill:R.querySelector(".universe-replay"),scalePill:R.querySelector(".universe-scale"),viewPill:R.querySelector(".universe-view"),gravityPill:R.querySelector(".universe-gravity"),densityPill:R.querySelector(".universe-density"),drawPill:R.querySelector(".universe-draw"),captionsPill:R.querySelector(".universe-captions"),arrangementPill:R.querySelector(".universe-arrangement"),facts:R.querySelector(".universe-facts"),backPill:R.querySelector(".universe-back"),openPill:R.querySelector(".universe-open")},{command_run:q=>{Xe.line_execute(q,{silent:!0,observe:!1}).then(ie=>{for(const we of ie.envelopes)ee.envelope_observe(we)})},feed_dag:async q=>{const ie=await Xe.line_execute(`feed diagram feed_${q}`,{silent:!0,observe:!1});for(const we of ie.envelopes){if(we.model?.kind!==Xn.feedDag)continue;const xe=Hc.safeParse(we.model.data);if(xe.success)return xe.data}return null},node_enter:q=>{ge.line_run(`cd "${q}"`)},node_dive:q=>{Fe(D,q.replace(/\/data$/,""))},node_process:q=>{const ie=_a(q.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)[1])),we=v===null?q.vfsPath:q.vfsPath.replace(/^\/proc\/jobs\//,`/home/${v}/feeds/`);H(D,{input:we,feed:ie,node:q.instanceId})},feed_open:q=>{li(),xt.feed_enter(q)},plugin_open:q=>{(async()=>{const ie=await Xe.line_execute("ls /bin",{silent:!0,observe:!1}),we=[];for(const et of ie.envelopes){if(et.model?.kind!=="fs.listing")continue;const tt=et.model.data,ft=Array.isArray(tt)?tt:[tt];for(const Zt of ft)for(const bt of Zt.items??[])we.push(bt.name)}const xe=we.filter(et=>et.startsWith(`${q}-v`)).sort((et,tt)=>et.localeCompare(tt,void 0,{numeric:!0})).pop();if(xe===void 0){ge.line_note(`universe: ${q} is not in /bin`);return}Ke("gutter-files").click(),l("files",i.get("files","files"),`/bin/${xe}`,"plugin")})().catch(ie=>{ge.line_note(`universe: could not open ${q} in /bin: ${ie instanceof Error?ie.message:String(ie)}`)})},note:q=>ge.line_note(q)},gh());return i.set("universe",D,ee),{id:D,kind:"universe",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D),ee.dispose()}}},y=D=>{const R=ks("tpl-pane-image"),ee=new YT(R,{source:{url_of:c},note:q=>ge.line_note(q),regard:q=>r.regard_write(D,{address:q,modelKind:"dicom.instance"}),file_put:async(q,ie)=>{try{return(await fetch(c(q),{method:"POST",body:ie})).status}catch{return 0}},tags_read:q=>A(q),tags_open:()=>{ge.line_note(G(D))}});return i.set("image",D,ee),{id:D,kind:"image",mount:R,dispose:()=>{ee.dispose(),i.delete(D),r.pane_leave(D)}}},E=D=>{const R=ks("tpl-pane-tags"),ee=new QT(R,{note:q=>ge.line_note(q)});return i.set("tags",D,ee),{id:D,kind:"tags",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D)}}},A=async D=>{try{const R=await Xe.line_execute(`dcm tags "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Ia.tags)continue;const q=hh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},I=(D,R)=>{const ee=i.get("tags",D);ee===void 0||ee.path_get()===R||A(R).then(q=>{if(q===null){ge.line_note(`tags: ${R}: not a readable DICOM file`);return}i.get("tags",D)?.model_show(q)})},G=D=>{const R=new Set($.panes_shown()),ee=r.group_of(D);for(const ie of i.ids("tags"))if(R.has(ie)&&r.group_of(ie)===ee)return $.focus_set(ie),"image tags";if(!R.has(D))return"image tags: the image pane is not on stage";const q=ht("tags",D);return $.leaf_split(D,he.replayPlace_get()?.dir??"col",q.id,he.replayPlace_get()?.before??!1)?(Te(q.id,D,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),"image tags"):(es(q.id),$.mount_remove(q.id),"image tags: could not open beside the image pane")},C=async D=>{try{const R=await Xe.line_execute(`dcm series "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Ia.series)continue;const q=fh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},B=async D=>{try{const R=await Xe.line_execute(`ls "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!=="fs.listing")continue;const q=ee.model.data,ie=(Array.isArray(q)?q[0]:q)??{},we=(ie.path??D).replace(/\/$/,"");return(ie.items??[]).filter(xe=>xe.type==="dir").map(xe=>`${we}/${xe.name}`)}}catch{}return[]},P=(D,R)=>{const ee=et=>{R!==void 0&&r.regard_write(et,R)};if(D!==null&&i.has("image",D))return ee(D),i.get("image",D)??null;const q=new Set($.panes_shown());if(R!==void 0){for(const[et,tt]of i.entries("image"))if(q.has(et)&&r.regard_get(et)?.address===R.address)return ee(et),tt}const ie=D!==null?r.group_of(D):null;for(const[et,tt]of i.entries("image"))if(q.has(et)&&ie!==null&&r.group_of(et)===ie)return tt;const we=D!==null&&q.has(D)?D:Ft();if(we===null)return null;const xe=ht("image",D??void 0);return $.leaf_split(we,he.replayPlace_get()?.dir??"col",xe.id,he.replayPlace_get()?.before??!1)?(Te(xe.id,we,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),ee(xe.id),i.get("image",xe.id)??null):(es(xe.id),$.mount_remove(xe.id),null)},L=async(D,R,ee={},q)=>{re();const ie=D!==null?void 0:ed.test(R)?{address:R,modelKind:"image.volume"}:{address:Xo.test(R)?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,""),modelKind:"dicom.series"},we=P(D,ie);if(we===null)return"image: no pane to open beside";const xe=i.idOf("image",we);if(xe!==null&&q?.(xe),ed.test(R))return we.opening_show(R),we.volume_show(R),`image ${R}`;const et=Xo.test(R),tt=et?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,"");we.opening_show(tt);let ft=await C(tt),Zt=[];if(ft===null&&!et){const Gt=(await B(tt)).slice(0,32);for(const Es of Gt){const Bn=await C(Es);if(Bn!==null){Zt=Gt.map(Dl=>({path:Dl,label:Dl.split("/").pop()??Dl})),ft=Bn;break}}}if(ft===null)return we.opening_fail(R,"NOT A READABLE SERIES"),`image: ${R}: not a readable DICOM series, study, or volume`;const bt=et?Math.max(1,ft.files.indexOf(R)+1):1;return we.series_show(ft,{siblings:Zt,startAt:bt,...ee.force===!0?{force:!0}:{}}),`image ${ft.path}${Zt.length>1?` (1 of ${Zt.length} series)`:""}`},H=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[xe,et]of S)if(ee.has(xe)&&et.input===R.input){$.focus_set(xe);return}const q=ee.has(D)?D:Ft()??D,ie=ht("catalogue",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",ie.id,he.replayPlace_get()?.before??!1)){es(ie.id),$.mount_remove(ie.id);return}Te(ie.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),S.set(ie.id,R);const we=i.get("files",ie.id);we!==void 0&&(we.binding_set({input:R.input,place:R.feed===null?"new feed":`feed ${R.feed}${R.node===null?"":` · node ${R.node}`}`}),we.feedOpen_declare(xe=>ce(ie.id,xe)),f(ie.id,we,"/bin"),J(we),$.focus_set(ie.id))},X=5,oe=40,J=D=>{Xe.line_execute(`plugininstance list --limit ${oe} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(ee=>{const q=[];for(const ie of ee.envelopes)if(!(ie.model?.kind!=="plugininstance.list"||!Array.isArray(ie.model.data)))for(const we of ie.model.data){if(typeof we.pluginName!="string"||typeof we.pluginVersion!="string"||v!==null&&typeof we.owner=="string"&&we.owner!==v||we.pluginName==="pl-dircopy")continue;const xe=`${we.pluginName}-v${we.pluginVersion}`;if(q.includes(xe)||q.push(xe),q.length>=X)break}D.recent_set(q.length===0?null:q)}).catch(()=>{})},ce=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[we,xe]of i.entries("dag"))if(we!=="dag"&&ee.has(we)&&xe.feed_get()===R){$.focus_set(we);return}const q=ee.has(D)?D:Ft()??D,ie=ht("dag",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",ie.id,he.replayPlace_get()?.before??!1)){es(ie.id),$.mount_remove(ie.id);return}Te(ie.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),i.get("dag",ie.id)?.feed_enter(R)},We=async(D,R,ee)=>{const q=S.get(D),ie=i.get("files",D);if(q===void 0||ie===void 0)return;const we=Gt=>{ge.output_write("err",`\x1B[31m${Gt}\x1B[0m
4254
4254
  `);const Es=ie.indicated_get();Es!==null&&ie.rowReadout_show(Es,Gt.toUpperCase().slice(0,80))};if(ee==="pipeline"&&q.node===null){we(`${R}: a pipeline runs on a node — PROCESS a node of a feed`);return}let xe=ie.commandLine_get();if((xe===""||yg(xe)!==R)&&(xe=_g(q.input,R)),q.feed===null&&!Qy(xe)){const Gt=q.input.split("/").filter(Boolean).pop()??"feed",Bn=(await x(D,{message:"Feed title: ",kind:"text",suggest:Gt,commit:"RUN"})??"").trim();if(Bn==="")return;xe=Jy(xe,Bn)}ie.commandLine_set(xe),ge.line_echo(xe);let et;try{et=await Xe.line_execute(xe,{silent:!0})}catch(Gt){we(Gt instanceof Error?Gt.message:String(Gt));return}ge.outcome_write(et),et.envelopes.some(Gt=>Gt.model?.kind==="fs.cwd")&&Xe.line_execute("ls",{silent:!0});const ft=et.envelopes.find(Gt=>Gt.model?.kind==="run.scheduled")?.model?.data;if(typeof ft?.feedId=="number"){ie.run_show(ft.feedId);return}const Zt=et.envelopes.map(Gt=>Gt.renderedErr??"").join(" ").replace(/\x1b\[[0-9;]*m/g,"").trim().split(`
4255
4255
  `)[0]??"",bt=ie.indicated_get();bt!==null&&ie.rowReadout_show(bt,Zt===""?"NOT SCHEDULED":Zt.toUpperCase().slice(0,80))},He=D=>{re();const R=new Set($.panes_shown());for(const[xe]of i.entries("files"))if(R.has(xe)&&r.regard_get(xe)?.address===D){$.focus_set(xe);return}let ee;for(const[xe,et]of i.entries("image"))if(R.has(xe)&&(r.regard_get(xe)?.address===D||et.state_get()?.path===D)){ee=xe;break}const q=Ft();if(q===null)return;const ie=ht("files",ee);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",ie.id,he.replayPlace_get()?.before??!1)){es(ie.id),$.mount_remove(ie.id);return}Te(ie.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),ee===void 0&&r.regard_write(ie.id,{address:D,modelKind:"dicom.series"});const we=i.get("files",ie.id);we!==void 0&&f(ie.id,we,D)},Pe=jI(a,{image_open:(D,R)=>L(D,R),process_open:(D,R)=>H(D,R),feed_open:(D,R)=>ce(D,R),ask_onPane:(D,R)=>x(D,R),errandHost_find:()=>Ft(),instance_spawn:(D,R)=>ht(D,R),birth_record:(D,R,ee,q)=>Te(D,R,ee,q),replayPlace_get:()=>he.replayPlace_get(),stage_relight:()=>Z(),home_apply:()=>$e(),orphans_dispose:()=>be(),fileText_fetch:h,template_stamp:ks,pane_find:ds,element_require:Ke}),se=Pe.instance_build,ae=Pe.gather,ue=Pe.open,qe=D=>{const R=ks("tpl-pane-view");Vs(ds(R,".view-body"));const ee=new UT(ds(R,".view-body"),ds(R,".view-title"),{content_fetch:async q=>(await h(q)).text,imageUrl_build:c,path_isImage:gl});return i.set("view",D,ee),{id:D,kind:"view",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D)}}},Ye=CI(a,{filesBody_stamp:z,rootedListing_show:f,rowVerbs_of:w,image_open:(D,R)=>L(D,R),imagery_is:$M,tableFile_is:D=>jM.test(D),vfsUrl_build:c,fileText_fetch:h,previewProvider:u}),Fe=Ye.open,Lt=(D,R)=>{const ee=ks("tpl-pane-dag"),q=new lT(ds(ee,".dag-canvas"),ds(ee,".dag-title"),ds(ee,".dag-facts"),ds(ee,".dag-empty"),ds(ee,".dag-strategy"),ds(ee,".dag-feedlist"),{command_run:ie=>{Xe.line_execute(ie,{silent:!0,observe:!1}).then(we=>{for(const xe of we.envelopes)q.envelope_observe(xe)})},watch_set:(ie,we)=>{we?Xe.watch_send(ie):Xe.unwatch_send(ie)},node_enter:ie=>{ge.line_run(`cd "${ie}"`)},node_dive:ie=>{Fe(D,ie.replace(/\/data$/,""))},node_regard:ie=>{r.regard_write(D,{address:ie,modelKind:"feed.node"})},node_process:ie=>{const we=_a(ie.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(ie.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(ie.vfsPath)[1])),xe=v===null?ie.vfsPath:ie.vfsPath.replace(/^\/proc\/jobs\//,`/home/${v}/feeds/`);H(D,{input:xe,feed:we,node:ie.instanceId})},feed_regard:ie=>{r.regard_write(D,{address:ie,modelKind:"feed"})},...nG(a,D,ot),...R?{feed_shown:()=>Ge()}:{}});return i.set("dag",D,q),{id:D,kind:"dag",mount:ee,dispose:()=>{Ye.dispose(D),i.delete(D),r.pane_leave(D),q.dispose()}}},ot=tG(a,{ask_onPane:(D,R)=>x(D,R),promptUser:()=>v,changed:()=>{for(const D of i.values("dag"))D.roster_ask(),D.marks_refresh(),D.indicated_refresh()}}),yt=_("files",!0);mr(yt);const ut=Lt("dag",!0);mr(ut);const lt=M("universe");mr(lt);const It=ks("tpl-pane-launcher");mr({id:"launcher",kind:"launcher",mount:It});const Bt=ks("tpl-pane-panes");mr({id:"panes",kind:"panes",mount:Bt});const jt=i.get("files","files"),xt=i.get("dag","dag"),Ct=new _I(Ke("pipeline-cycler"),Ke("pipeline-cycler-name"),D=>{Xe.line_execute(D,{silent:!0})});let Pt=null;const j=LI(a,{instance_spawn:(D,R)=>ht(D,R),birth_record:(D,R,ee,q)=>Te(D,R,ee,q),replayPlace_get:()=>he.replayPlace_get(),rootedListing_show:f,console_expose:()=>Pt?.(!1)}),{errandHost_find:Ft,errand_open:vt,verbLine_run:N,ask_onPane:x}=j;Vs(Ke("pacs-workspace"),{rows:".listing-row"});const V=new BT(Ke("pacs-workspace"),{command_run:D=>{const R=/^(pacs query|pull )/.test(D);R&&ge.line_echo(D),Xe.line_execute(D,{silent:!0,operator:R}).then(ee=>{for(const q of ee.envelopes)V.envelope_observe(q)})},command_show:D=>{ge.line_run(D)},note:D=>ge.line_note(D),image_open:D=>{L(null,D).then(R=>ge.line_note(R))},dir_open:D=>He(D),process_open:D=>H("pacs",{input:D,feed:null,node:null}),gather_add:D=>ae([D]),gathered_is:D=>Pe.has(D),workspace_close:()=>$e()});mr({id:"pacs",kind:"pacs",mount:Ke("pacs-workspace")});const Z=()=>{const D=new Set($.panes_shown()),R=new Map;for(const ee of No()){if(!D.has(ee.id))continue;const q=r.regard_get(ee.id)?.address;if(q===void 0)continue;const ie=Al(ee.id);if(ie!=="image"&&ie!=="files")continue;const we=q.replace(/\/$/,""),xe=R.get(we)??{viewer:!1,browser:!1};ie==="image"?xe.viewer=!0:xe.browser=!0,R.set(we,xe)}V.stage_lit(R)},$=new xI(Ke("layout-root"),new Map([["dag",ut.mount],["universe",lt.mount],["files",yt.mount],["pacs",Ke("pacs-workspace")],["launcher",It],["panes",Bt]]));let pe=!1;const ye=()=>pe?{dir:"col",ratio:.45,first:{pane:"files"},second:{pane:"dag"}}:{pane:"files"};$.preset_register("files",ye),$.preset_register("pacs",()=>({pane:"pacs"})),$.preset_register("dag",()=>({pane:"dag"})),$.preset_register("universe",()=>({pane:"universe"})),$.preset_register("panes",()=>({pane:"panes"})),$.preset_register("launcher",()=>({pane:"launcher"})),$.renderObserver_set(()=>{document.body.dataset.zoom==="launcher"&&!$.panes_shown().includes("launcher")&&gi(null),window.requestAnimationFrame(()=>{for(const D of i.values("dag"))D.size_fit()})});const te=(D,R,ee,q)=>{const ie=R==="view"?ht("view",D):R==="fs"?ht("files",D):ht("empty");if(!$.leaf_split(D,ee,ie.id,q))return es(ie.id),$.mount_remove(ie.id),null;if(Te(ie.id,D,ee,q,R),R==="fs"){const we=et=>{const tt=i.get("files",ie.id);if(tt===void 0)return;const ft=et.modelKind==="fs.file"?et.address.replace(/\/[^/]*$/,"")||"/":et.address;f(ie.id,tt,ft)};r.regard_subscribe(ie.id,we);const xe=r.regard_get(D);xe!==null&&we(xe)}return ie.id},ne=new N0(km,gh());Object.assign(globalThis,{__argusDormant:{list:()=>ne.list(),get:D=>ne.get(D),dismiss:D=>ne.dismiss(D)}});const he=DI(a,{image_open:L,dir_open:He,process_open:H,gather_open:ue,feed_open:ce,edit_open:D=>Rn.edit_open(D),pillPane_spawn:te,pacsQuery_get:()=>V.query_get(),catalogue_of:D=>S.get(D),catalogueIds:()=>[...S.keys()],stage_relight:()=>Z()}),{birth_record:Te,domain_enter:Me,orphans_dispose:be}=he,Ue=he.capture,je=he.restore,$e=()=>{Me("files"),xt.size_fit()},U=()=>{Me("launcher"),de.render(),$.focus_set("launcher"),gi("launcher")},_e=(D=!1)=>{if(document.body.dataset.zoom!=="launcher"||(gi(null),!D))return;const R=document.querySelector(".wrap:not(#gap)");R!==null&&Ku(R,document.body),document.body.dataset.header="away",Pt?.(!0)},re=()=>{_e(),$.activePreset_get()==="launcher"&&(pe=!1,$e())};let ze=!1;const Ee=Xy({ask:D=>Xe.line_execute(D,{silent:!0,observe:!1}),universe_show:()=>El(),runs_show:D=>li(D),feed_enter:D=>{li(),i.get("dag","dag")?.feed_enter(D)},home_open:()=>{pe=!1,$e(),$.focus_set("files")},home_cd:D=>{pe=!1,$e(),ge.line_run(`cd "${D}"`)},line_offer:D=>ge.line_offer(D),pacs_query:()=>V.query_get()??"",pacs_open:()=>{Me("pacs"),$.focus_set("pacs")},desktops:()=>ne.list(),desktop_restore:D=>{je(D)},panes_open:()=>{Me("panes"),Be.render(),$.focus_set("panes")},keys_open:()=>{jr()},notes_open:()=>{oi.open()},notes_latest:()=>oi.latest(),daemon_stale:()=>ze,console_open:()=>Ke("gutter-console").click()}),de=new Ry(It,{tiles:Ee,leave:()=>_e(!0),startHere_get:pm,startHere_set:MR});setInterval(()=>{$.activePreset_get()==="launcher"&&(!It.isConnected||document.visibilityState!=="visible"||de.render())},gR),Vs(ds(Bt,".panes-body"),{rows:".panes-card"});const Be=new B0(Bt,{list:()=>ne.list(),restore:D=>{je(D)},dismiss:D=>{ne.dismiss(D)}}),Ge=()=>{const D=$.activePreset_get();if(D==="pacs"||D==="dag"||D==="launcher"){pe=!0;return}pe&&D==="files"||(pe=!0,$e())},ht=(D,R)=>{const ee=vI(D);return r.pane_join(ee.id,R!==void 0?r.group_of(R):ee.id),D==="tags"&&r.regard_subscribe(ee.id,q=>{q.modelKind==="dicom.instance"&&I(ee.id,q.address)}),D==="view"&&(r.viewer_mark(ee.id),r.regard_subscribe(ee.id,q=>{q.modelKind!=="dicom.instance"&&i.get("view",ee.id)?.regard_show(q)})),$.mount_register(ee.id,ee.mount),Hs(ee.id,D,ee.mount),ee},{bar_note:St,move:_s,flip:zs,resize:Ta,chordKeys_of:Sl}=EI(a),Hs=kG(a,{verbs:{move:_s,chordKeys_of:Sl},browser:d,pillPane_spawn:te,process_open:(D,R)=>H(D,R),overlay_back:D=>Ye.back(D),home_apply:()=>$e(),orphans_dispose:()=>be(),dag_dismiss:()=>{pe=!1}});Hs("files","files",yt.mount),Hs("dag","dag",ut.mount),Hs("universe","universe",lt.mount),Hs("pacs","pacs",Ke("pacs-workspace")),Hs("launcher","launcher",It),Hs("panes","panes",Bt);let Tn=!1;const In=D=>{Tn=D};for(const D of["click","focusin"])document.addEventListener(D,R=>{R.target instanceof Element&&(R.target.closest("#drawer")!==null?Tn=!0:R.target.closest("#layout-root")!==null&&(Tn=!1))});const kr=()=>{let D=!1;for(const R of document.querySelectorAll(".pane-drawer:not([hidden])"))R.hidden=!0,D=!0;return D},Ur=()=>{let D=!1;for(const R of document.querySelectorAll('.workspace-pane[data-modes="open"], [data-frame-host][data-modes="open"]'))delete R.dataset.modes,D=!0;return V.serverStrip_isOpen()&&(V.serverStrip_close(),D=!0),D};document.addEventListener("click",D=>{if(!(D.target instanceof Element)||D.target.closest(".mode-frame")!==null&&D.target.closest(".mode-fill")===null||D.target.closest("#pacs-server-strip")!==null||D.target.closest("#pacs-f-server")!==null||D.target.closest(".listing-framed .listing-row, .ask-bar")!==null)return;const R=D.target.closest(".mode-strip"),ee=R?.closest(".workspace-pane, [data-frame-host]")??null,q=ee?.dataset.modes==="open",ie=Ur();if(R!==null&&ee!==null&&!q){ee.dataset.modes="open",Ns("audio3");return}ie&&Ns("audio3")}),GG(a,{palette_isOpen:()=>!T.hidden,palette_open:()=>Y(),palette_close:()=>ve(),errand_abandon:()=>j.errand_abandon(),dive_leave:()=>o.dive_leave(),overlay_escape:()=>Ye.escape(),drawers_close:kr,modeFrames_close:Ur,consoleFocused:()=>Tn,verbs:{bar_note:St,flip:zs,resize:Ta},host:()=>$r,stage_alone:D=>{Ue(),$.tree_set({pane:D}),be()},element_require:Ke});const an=(D,R,ee)=>{if(R==="pacs"){$.preset_apply("pacs"),be();for(const we of ee)V.envelope_observe(we);return}const q=ht(R);if($.leaf_replace(D,q.id),es(D),$.mount_remove(D),R==="tags"){const we=i.get("tags",q.id);for(const xe of ee){if(xe.model?.kind!==Ia.tags)continue;const et=hh.safeParse(xe.model.data);et.success&&we?.model_show(et.data)}return}if(R==="image"){const we=i.get("image",q.id);for(const xe of ee){if(xe.model?.kind!==Ia.series)continue;const et=fh.safeParse(xe.model.data);et.success&&we?.series_show(et.data)}return}const ie=R==="files"?i.get("files",q.id):i.get("dag",q.id);for(const we of ee)ie?.envelope_observe(we)},Gn={instance_spawn:ht,birth_record:Te,launcher_yield:re,launcher_active:()=>$.activePreset_get()==="launcher",template_stamp:ks},Fr=rG(a,Gn),jr=Fr.open,ai=SG(a,Gn),oi=IG(a,{...Gn,ask:D=>Xe.line_execute(D,{silent:!0})}),Rn=HI(a,{...Gn,replayPlace_get:he.replayPlace_get,errandHost_find:Ft,saved:()=>{for(const D of i.values("dag"))D.marks_refresh()}});Os("files",D=>_(D,!1)),Os("catalogue",D=>_(D,!1,!0)),Os("dag",D=>Lt(D,!1)),Os("universe",M),Os("view",qe),Os("image",y),Os("tags",E),Os("help",Fr.instance_build),Os("games",ai.instance_build),Os("notes",oi.instance_build),Os("edit",Rn.instance_build),Os("gather",se),Os("empty",D=>{const R=ks("tpl-pane-empty");return new WT(R,{execute:ee=>Xe.line_execute(ee,{silent:!0,observe:!1}),claim:(ee,q)=>an(D,ee,q)}),{id:D,kind:"empty",mount:R}});const $i=D=>{D?document.body.dataset.gutter="away":delete document.body.dataset.gutter,Ns("audio3")},Nn=(D,R)=>{if($.activePreset_get()===D&&$.panes_shown().includes(D)){$i(!0);return}document.body.dataset.gutter==="away"&&delete document.body.dataset.gutter,R()};Ke("gutter-restore").addEventListener("click",()=>$i(!1)),window.addEventListener("keydown",D=>{D.key==="Escape"&&document.body.dataset.gutter==="away"&&document.body.dataset.zoom===void 0&&$i(!1)}),Ke("gutter-files").addEventListener("click",()=>{Nn("files",()=>{pe=!1,$e(),$.focus_set("files"),In(!1)})});const li=(D="")=>{Me("dag"),xt.list_reset(),xt.roster_filter(D),xt.feedsChooser_request(),$.focus_set("dag"),In(!1)},El=()=>{Me("universe");const D=i.get("universe","universe");D!==void 0&&!D.shown_get()&&D.request(),$.focus_set("universe"),In(!1)};Ke("gutter-runs").addEventListener("click",()=>Nn("dag",()=>li())),Ke("gutter-console").addEventListener("click",()=>{Ke("drawer").classList.contains("drawer-closed")&&Ke("drawer-toggle").click(),ge.focus_take(),In(!0)}),Ke("gutter-tools").addEventListener("click",()=>{Nn("pacs",()=>{Me("pacs"),$.focus_set("pacs"),In(!1)})}),Ke("gutter-dashboard").addEventListener("click",()=>{Nn("launcher",U)}),Ke("gutter-panes").addEventListener("click",()=>{Nn("panes",()=>{Me("panes"),Be.render(),$.focus_set("panes"),In(!1)})});const Al=D=>Ro(D)?.kind??null,$r=UG(a,{verbs:{move:_s,flip:zs,resize:Ta},help_open:jr,notes_open:oi.open,launcher_enter:U,identity_get:()=>O,consoleZoom_toggle:lm,feed_enter:D=>xt.feed_enter(D),file_save:p,image_open:(D,R,ee)=>L(D,R,ee),series_ask:C,tagsPane_open:G}),T=Ke("lang-palette"),F=Ke("lang-input"),Q=Ke("lang-result"),K=Ke("lang-pill"),Y=()=>{kr(),T.hidden=!1,K.classList.add("lang-live"),Q.textContent="",F.value="",F.focus(),Ns("audio3")},ve=()=>{T.hidden=!0,K.classList.remove("lang-live"),Q.textContent=""};K.addEventListener("click",()=>{T.hidden?Y():ve()});const De=["pane","view","runs","node","dag","file","pacs","header","console","back","desktop","argus","help","notes"],Oe={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","pulse","census","physics","refresh"],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"],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"]};F.addEventListener("keydown",D=>{if(D.key==="Escape"){D.stopPropagation(),ve();return}if(D.key==="Tab"){D.preventDefault();const R=F.value.split(/\s+/),ee=R[R.length-1]??"",q=R.length<=1?"":R[R.length-2]??"",we=(R.length<=1?De:Oe[q]??Oe[R[0]??""]??[]).find(xe=>xe.startsWith(ee.toLowerCase()));we!==void 0&&(R[R.length-1]=we,F.value=`${R.join(" ")} `);return}if(D.key==="Enter"){const R=F.value.trim();if(R.length===0){ve();return}nd($r,R).then(ee=>{ee!==null?(Q.textContent=ee,ge.output_write("data",`: ${R}
4256
4256
  ${ee}