dsh-ccx 0.8.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +23 -23
  3. package/README.md +151 -143
  4. package/assets/icon.svg +27 -27
  5. package/cordis.patch.yml +16 -16
  6. package/lib/client.js +1481 -2244
  7. package/lib/index.js +716 -449
  8. package/lib/vendor/code-codex/ascii-tiles.js +145 -0
  9. package/lib/vendor/code-codex/aurora-ionosphere.js +7 -6
  10. package/lib/vendor/code-codex/black-hole.js +10 -7
  11. package/lib/vendor/code-codex/blinking-squares.js +6 -13
  12. package/lib/vendor/code-codex/cloud-train.js +9 -8
  13. package/lib/vendor/code-codex/galleries.json +100 -100
  14. package/lib/vendor/code-codex/glow-horizon.js +1 -1
  15. package/lib/vendor/code-codex/heavenly-cloud.js +5 -4
  16. package/lib/vendor/code-codex/milky-way.js +3 -2
  17. package/lib/vendor/code-codex/mountain.js +5 -4
  18. package/lib/vendor/code-codex/particle-image.js +435 -14
  19. package/lib/vendor/code-codex/pixel-sculpt.js +85 -5
  20. package/lib/vendor/code-codex/scene-defaults.json +94 -1
  21. package/lib/vendor/code-codex/scene-schemas.json +1008 -0
  22. package/lib/vendor/code-codex/shallow-ocean-thumbnails.json +12 -0
  23. package/lib/vendor/code-codex/shallow-ocean.js +5094 -0
  24. package/lib/vendor/code-codex/spectral-drape.js +172 -0
  25. package/package.json +70 -59
  26. package/src/client/api.ts +90 -0
  27. package/src/client/background/layer.ts +187 -0
  28. package/src/client/background/pixel-sculpt.ts +167 -0
  29. package/src/client/background/scene-runner.ts +317 -0
  30. package/src/client/background/shallow-ocean.ts +344 -0
  31. package/src/client/background/vendor-loader.ts +297 -0
  32. package/src/client/background/wallpaper.ts +87 -0
  33. package/src/client/index.ts +247 -0
  34. package/src/client/surfaces/corner-patch.ts +100 -0
  35. package/src/client/surfaces/surface-css.ts +155 -0
  36. package/src/client/ui/draft.ts +105 -0
  37. package/src/client/ui/icons.ts +47 -0
  38. package/src/client/ui/panel.ts +1524 -0
  39. package/src/client/ui/shallow-ocean-panel.ts +376 -0
  40. package/src/client/ui/styles.ts +1471 -0
  41. package/src/host/fence.ts +78 -0
  42. package/src/host/index.ts +26 -0
  43. package/src/host/routes.ts +367 -0
  44. package/src/host/storage.ts +109 -0
  45. package/src/host/window-chrome.ts +53 -0
  46. package/src/shared/constants.ts +239 -0
  47. package/src/shared/sanitize.ts +110 -0
  48. package/src/shared/types.ts +145 -0
  49. package/tsconfig.json +16 -0
@@ -0,0 +1,145 @@
1
+ (()=>{var b=class{constructor(e){this.report=e;this.signal=this.#e.signal}#s=!1;#a=new Set;signal;#e=new AbortController;get disposed(){return this.#s}own(e){let i=!0,n=()=>{i&&(i=!1,this.#a.delete(n),e())};return this.#s?n():this.#a.add(n),n}listen(e,i,n,t){return this.#s?()=>{}:(e.addEventListener(i,n,t),this.own(()=>e.removeEventListener(i,n,t)))}dispose(){if(!this.#s){this.#s=!0,this.#e.abort();for(let e of[...this.#a].reverse())try{e()}catch(i){try{this.report(i)}catch{}}}}};function D(r){let e=0,i=0,n=0,t=(o,l)=>{if(++i>8192||l>10)throw Error("BG_ASSET_SHAPE: Visual asset structure exceeds its budget.");if(ArrayBuffer.isView(o)){if((o instanceof Float32Array||o instanceof Float64Array)&&!o.every(Number.isFinite))throw Error("BG_ASSET_NUMBER: Prepared visual numbers must be finite.");if(e+=o.byteLength,e>32*1024*1024)throw Error("BG_ASSET_SIZE: Prepared visual assets exceed 32 MiB.");return o}if(Array.isArray(o))return o.map(d=>t(d,l+1));if(o&&typeof o=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(o))){let d={};for(let[p,E]of Object.entries(o)){if(y({[p]:null}),n+=new TextEncoder().encode(p).length+4,n>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");d[p]=t(E,l+1)}return d}let c=y(o);if(n+=new TextEncoder().encode(JSON.stringify(c)).length,n>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");return c};return t(r,0)}function y(r){let e=0,i=(t,o)=>{if(++e>4096||o>8)throw Error("BG_STATE_LIMIT: Visual state exceeds the bounded schema.");if(t===null||typeof t=="boolean")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw Error("BG_STATE_NUMBER: Visual numbers must be finite.");return t}if(typeof t=="string"){if(t.length>1024)throw Error("BG_STATE_STRING: Visual strings must be bounded.");return t}if(Array.isArray(t))return t.map(l=>i(l,o+1));if(t&&typeof t=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(t))){let l={};for(let[c,d]of Object.entries(t)){if(/^(?:__proto__|constructor|prototype|token|accessToken|refreshToken|authorization|cookie|bridge|conversation|history|source|url|path)$/i.test(c))throw Error("BG_STATE_FIELD: Visual state contains an unsupported field.");d!==void 0&&(l[c]=i(d,o+1))}return l}throw Error("BG_STATE_TYPE: Visual state must contain serializable visual values.")},n=i(r,0);if(new TextEncoder().encode(JSON.stringify(n)).length>65536)throw Error("BG_STATE_SIZE: Visual state exceeds the message budget.");return n}function _(r,e){if(![r.width,r.height,r.left,r.top,e].every(Number.isFinite)||r.width<0||r.height<0)throw Error("BG_VIEWPORT_INVALID: Invalid visual dimensions.");let i=Math.max(1,Math.min(8192,r.width)),n=Math.max(1,Math.min(8192,r.height)),t=Math.min(3,Math.max(.5,e),Math.sqrt(16777216/(i*n)));return{width:i,height:n,left:r.left,top:r.top,dpr:t}}var z=/(token|cookie|password|secret|credential|authorization|apikey)/i,X=/^(content|text|body|prompt|messages|title|filename|name|raw|data|database64|commandline|sessionid|accountid|threadid|projectid)$|(?:path|url|uri)$/i;function f(r){return r.slice(0,8e3).replace(/\b[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s"'<>]+/g,i=>{try{let n=new URL(i);if(["127.0.0.1","localhost","[::1]"].includes(n.hostname)&&!n.username&&!n.password&&["/json/version","/json/list","/"].includes(n.pathname))return`${n.origin}${n.pathname}`}catch{}return"[url]"}).replace(/(?:\b[A-Za-z]:[\\/]|\\\\|\/(?:Users|home|tmp|var|etc|opt|mnt)\/|~\/)[^\r\n"'<>]*/g,"[path]").replace(/\b(?:Bearer\s+\S+|(?:authorization|password|secret|(?:access[_-]?|refresh[_-]?)?token|api[_-]?key|cookie)\s*[:=]\s*[^,;\r\n]+)/gi,"[credential]").replace(/\bsk-[A-Za-z0-9_-]{8,}|\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,"[credential]").replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,"[email]").slice(0,4e3)+(r.length>8e3?" [truncated]":"")}function G(r){let e=256,i=new WeakSet,n=(t,o)=>{if(--e<0||o>6)return"[truncated]";if(typeof t=="string")return f(t);if(t===null||typeof t=="boolean"||typeof t=="number")return t;if(typeof t!="object")return"[unsupported]";if(i.has(t))return"[circular]";if(i.add(t),t instanceof Error)return{name:f(t.name),message:f(t.message)};if(Array.isArray(t))return t.slice(0,128).map(c=>n(c,o+1));let l=Object.create(null);for(let[c,d]of Object.entries(t).slice(0,128)){let p=c.replace(/[^a-z0-9]/gi,"");l[f(c).slice(0,160)]=z.test(p)||X.test(p)?"[redacted]":n(d,o+1)}return l};try{return n(r,0)}catch{return{redactionFailed:!0}}}var q=Symbol.for("code-codex:runtime-events:v1"),j=window,T=j[q]??={events:[],dropped:0};function h(r,e,i,n={}){let t={source:f(r).slice(0,160),action:f(e).slice(0,160),outcome:f(i).slice(0,160),details:{...G(n),observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}},o=new TextEncoder().encode(JSON.stringify(t)).length;o>7e3&&(t.details={truncated:!0,originalBytes:o,observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}),T.events.push(t),T.events.length>1e3&&(T.events.splice(0,200),T.dropped+=200)}var V=Symbol.for("code-codex:background-startup-hold:v1");function K(){let r=window;return r[V]??={active:!1,layers:new Set,next:-1,pending:new Map,painted:new WeakSet,openings:new WeakMap}}function Y(r){return r.closest("[data-code-codex-particle-layer]")}function A(r){return!!Y(r)&&K().active}var I=()=>{let r=window;return r[Symbol.for("code-codex:background-isolation:v1")]??=new Map},x=class{constructor(e,i,n,t,o,l=()=>{},c={}){this.host=n;this.onError=l;if(typeof Worker!="function"||typeof t.transferControlToOffscreen!="function")throw Error("BG_BACKEND_UNAVAILABLE: Independent background rendering is unavailable.");let d=y(o),p=_(n.getBoundingClientRect(),devicePixelRatio||1);this.#t={id:e,mode:"worker",phase:"preparing",frames:0,pending:0},I().set(this,this.#t),this.#e=new b(s=>h("background","resource release","failed",{id:e,error:String(s)})),this.ready=this.firstFrame=new Promise((s,a)=>{this.#s=s,this.#a=a}),this.ready.catch(()=>{}),this.#p=p;let E=URL.createObjectURL(new Blob([i],{type:"text/javascript"}));this.#e.own(()=>URL.revokeObjectURL(E));try{this.#m=new Worker(E,{name:"code-codex-background-"+e})}catch(s){throw this.#e.dispose(),I().delete(this),s}let w=this.#m,B=setTimeout(()=>this.#o("BG_FIRST_FRAME_TIMEOUT: The background did not produce a first frame within 15 seconds."),15e3);this.#e.own(()=>clearTimeout(B)),this.#e.listen(t,"webglcontextlost",s=>{s.preventDefault(),this.#o("BG_WORKER_CONTEXT_LOST: The transferred background graphics context was lost. Enable the background again to retry.")}),this.#e.listen(w,"error",s=>this.#o("BG_WORKER_ERROR: "+s.message)),this.#e.listen(w,"messageerror",()=>this.#o("BG_WORKER_PROTOCOL: The background response could not be decoded.")),this.#e.listen(w,"message",s=>{let a=s.data;if(!(this.#i||a?.v!==1||a.session!==this.#u)){if(a.type==="failed"){this.#o("BG_WORKER_RENDER_FAILED: "+String(a.message).slice(0,1500));return}if(a.type==="first-frame"&&!this.#d&&(this.#d=!0,this.#t.frames=a.frames??1,clearTimeout(B),this.#t.phase="running",this.#s(),this.#v(),h("background","isolated first frame","ready",{id:e,backend:"worker"})),a.type==="sample"&&Number.isSafeInteger(a.frames)&&(this.#t.frames=a.frames),a.type==="event"&&typeof a.event=="string"&&this.kernelEvent(a.event,a.value),a.type==="result"&&Number.isSafeInteger(a.callId)){let u=this.#c.get(a.callId);u&&(clearTimeout(u.timer),this.#c.delete(a.callId),a.error?u.reject(Error("BG_KERNEL_FAILED: "+String(a.error))):u.resolve(a.value))}a.type==="ack"&&a.seq===this.#l&&(clearTimeout(this.#g),this.#g=void 0,this.#l=0,this.#t.pending=0,this.#f())}});let L=new ResizeObserver(()=>{let s=_(this.host.getBoundingClientRect(),devicePixelRatio||1);JSON.stringify(s)!==JSON.stringify(this.#p)&&(this.#p=s,this.#h({viewport:s}))});L.observe(n),this.#e.own(()=>L.disconnect());let P=new IntersectionObserver(s=>{this.#E=s[0]?.isIntersecting??!0,this.#v()});P.observe(n),this.#e.own(()=>P.disconnect());let k=matchMedia("(prefers-reduced-motion: reduce)");this.#e.listen(k,"change",()=>this.#h({reduced:k.matches})),this.#e.listen(document,"visibilitychange",()=>this.#v()),this.#e.listen(window,"code-codex:background-hold-changed",()=>this.#v()),this.#e.listen(window,"pagehide",()=>this.dispose());let W=s=>{if(!this.#d||this.#i||c.interactive===!1||!["pointerup","pointercancel"].includes(s.type)&&s.composedPath().some(v=>v instanceof Element&&v.matches('button,a,input,textarea,select,[contenteditable],dialog,[role="menu"],[role="menubar"],[popover]')))return;let a=s,u=this.#p;if(s instanceof PointerEvent&&!["pointermove","pointerleave","pointerup","pointercancel"].includes(s.type)&&(a.clientX<u.left||a.clientX>u.left+u.width||a.clientY<u.top||a.clientY>u.top+u.height))return;let g={type:s.type};if(s instanceof PointerEvent)Object.assign(g,{clientX:a.clientX,clientY:a.clientY,pointerId:a.pointerId,button:a.button,buttons:a.buttons,isPrimary:a.isPrimary,pointerType:a.pointerType});else if(s instanceof WheelEvent){let v=this.#r.find(m=>m.type==="state"&&m.input?.type==="wheel");if(v){let m=v.input;m.deltaX=Math.max(-1e4,Math.min(1e4,m.deltaX+s.deltaX)),m.deltaY=Math.max(-1e4,Math.min(1e4,m.deltaY+s.deltaY));return}Object.assign(g,{deltaX:s.deltaX,deltaY:s.deltaY,deltaMode:s.deltaMode,clientX:s.clientX,clientY:s.clientY})}else s instanceof KeyboardEvent&&Object.assign(g,{repeat:s.repeat,isComposing:s.isComposing,altKey:s.altKey,ctrlKey:s.ctrlKey,metaKey:s.metaKey,shiftKey:s.shiftKey,key:"",code:""});s.type==="pointermove"?((a.clientX<u.left||a.clientX>u.left+u.width||a.clientY<u.top||a.clientY>u.top+u.height)&&(g.type="pointerleave"),this.#h({input:g})):this.#r.length<8?(this.#r.push({type:"state",input:g}),this.#f()):this.#o("BG_INPUT_QUEUE_FULL: Background input exceeded the bounded discrete-event queue.")};for(let s of["pointermove","pointerleave","pointerdown","pointerup","pointercancel","wheel","keydown"])this.#e.listen(window,s,W,{passive:!0});try{let s=t.transferControlToOffscreen();w.postMessage({v:1,session:this.#u,type:"init",canvas:s,settings:d,viewport:this.#p,reduced:k.matches,held:A(n)},[s])}catch(s){this.#o("BG_CANVAS_TRANSFER: "+String(s))}}ready;firstFrame;#s;#a;#e;#m;#u=crypto.randomUUID();#y=0;#l=0;#n;#r=[];#c=new Map;#w=0;#d=!1;#i=!1;#E=!0;#p;#g;#t;get diagnostics(){return{...this.#t}}setSettings(e){this.#h({settings:y(e)})}updateSettings(e){this.setSettings(e)}replay(){if(!this.#i){if(this.#r.length>=8)throw Error("BG_COMMAND_QUEUE_FULL: Wait for the pending visual command.");this.#r.push({type:"replay"}),this.#f()}}kernelEvent(e,i){}activityChanged(e){}call(e,i=[],n=3e4){if(this.#i)return Promise.reject(Error("BG_KERNEL_DISPOSED: The visual worker has been retired."));if(this.#c.size>=8||this.#r.length>=8)return Promise.reject(Error("BG_COMMAND_QUEUE_FULL: Wait for the pending visual command."));let t=D(i),o=++this.#w,l=new Promise((c,d)=>{let p=setTimeout(()=>{this.#c.delete(o),d(Error("BG_KERNEL_TIMEOUT: The visual command did not confirm completion. It was not replayed."))},n);this.#c.set(o,{resolve:c,reject:d,timer:p})});return this.#r.push({type:"call",method:e,args:t,callId:o}),this.#f(),l}resumeOpening(){this.replay()}#v=()=>{let e=!document.hidden&&this.#E&&(!this.#d||!A(this.host));this.#h({visible:e}),this.activityChanged(e)};#h(e){this.#i||(this.#n={...this.#n,...e},this.#f())}#f(){if(this.#i||this.#l)return;let e;if(this.#n&&["settings","viewport","visible","reduced"].some(i=>i in this.#n)){let{input:i,...n}=this.#n;e={type:"state",...n},this.#n=i?{input:i}:void 0}else if(this.#r.length)e=this.#r.shift();else if(this.#n)e={type:"state",...this.#n},this.#n=void 0;else return;this.#l=++this.#y,this.#t.pending=1;try{this.#m.postMessage({v:1,session:this.#u,seq:this.#l,...e})}catch(i){this.#o("BG_WORKER_SEND_FAILED: "+String(i));return}this.#g=setTimeout(()=>this.#o("BG_WORKER_ACK_TIMEOUT: The visual worker stopped acknowledging bounded updates."),5e3)}#o(e){if(!this.#i){this.#t.phase="failed",this.#t.error=e,this.#a(Error(e)),h("background","visual worker","failed",{id:this.#t.id,session:this.#u,sequence:this.#y,pending:this.#l,message:e});try{this.onError(e)}finally{this.dispose()}}}dispose(){if(this.#i)return;this.#i=!0,this.#e.dispose(),clearTimeout(this.#g),this.#n=void 0,this.#r=[],this.#d||this.#a(new DOMException("Background preparation was cancelled.","AbortError"));for(let c of this.#c.values())clearTimeout(c.timer),c.reject(new DOMException("Background command was cancelled.","AbortError"));this.#c.clear();let e=this.#m,i=this.#u,n=++this.#y;this.#t.phase="disposing";let t=!1,o=()=>{t||(t=!0,clearTimeout(l),e.terminate(),I().delete(this))},l=setTimeout(()=>{h("background","worker disposal","unconfirmed",{id:this.#t.id,timeoutMs:1500}),o()},1500);e.addEventListener("message",c=>{c.data?.session===i&&c.data?.type==="disposed"&&o()});try{e.postMessage({v:1,session:i,seq:n,type:"dispose"})}catch{o()}}};var O=Object.freeze({speed:.87,glyphSize:9,tileDensity:6.7,tileShear:-.31,tileGap:18.5,outlineWidth:1.25,outlineStrength:.6,bevelWidth:.13,bevelSoftness:.1,refractionStrength:46,chromaticSpread:.66,specularExponent:256,specularStrength:1,patternFreqX:9.4,patternFreqY:4,patternFreqXY:10,glyphColor:"#ffffff",recessColor:"#000000",backgroundColor:"#000000",opacity:.6,dpr:1.5,cursorInteraction:!0,cursorRadius:110,cursorIntensity:1,cursorRecovery:.95,waveSpeed:5.5,waveHeight:36,clickStrength:1.5}),M=Object.freeze({speed:[0,3,.01],glyphSize:[4,24,1],tileDensity:[1,12,.1],tileShear:[-.5,.5,.01],bevelWidth:[0,.5,.005],tileGap:[0,40,.5],outlineWidth:[0,6,.25],outlineStrength:[0,1,.01],bevelSoftness:[.01,.4,.005],refractionStrength:[0,120,1],chromaticSpread:[0,1,.01],specularExponent:[1,256,1],specularStrength:[0,3,.01],patternFreqX:[0,20,.1],patternFreqY:[0,20,.1],patternFreqXY:[0,20,.1],opacity:[0,1,.01],dpr:[1,3,.1],cursorRadius:[20,400,1],cursorIntensity:[0,3,.01],cursorRecovery:[.4,4,.05],waveSpeed:[1,12,.1],waveHeight:[0,80,1],clickStrength:[0,3,.01]});function C(r={}){let e={...O};for(let i of Object.keys(M)){let[n,t]=M[i],o=r[i];typeof o=="number"&&Number.isFinite(o)&&(e[i]=Math.min(t,Math.max(n,o)))}for(let i of["glyphColor","recessColor","backgroundColor"])typeof r[i]=="string"&&/^#[\da-f]{6}$/i.test(r[i])&&(e[i]=r[i]);return typeof r.cursorInteraction=="boolean"&&(e.cursorInteraction=r.cursorInteraction),e}function H(r){try{let e=[],i=new Set,n=r;for(;n!=null&&e.length<8&&!i.has(n);)if(i.add(n),n instanceof Error)e.push(`${n.name}: ${n.message}`),n=n.cause;else{e.push(typeof n=="string"?n:"Non-Error rejection");break}let t=r&&typeof r=="object"&&"code"in r?r.code:void 0,o={errorChain:e,...typeof t=="string"||typeof t=="number"?{errorCode:typeof t=="string"?t.slice(0,160):t}:{},...r instanceof Error&&r.stack?{exceptionStack:r.stack.slice(0,3e3)}:{},chainTruncated:n!=null&&e.length>=8},l=new TextEncoder().encode(JSON.stringify(o)).length;return l>5800&&(o.errorChain=e.map(c=>c.slice(0,80)),typeof o.exceptionStack=="string"&&(o.exceptionStack=o.exceptionStack.slice(0,200)),o.detailsTruncated=!0,o.originalDetailBytes=l),o}catch{return{errorChain:["Exception details could not be inspected safely."]}}}var R=new Map;function F(r,e){try{let i=performance.now(),n=R.has(r)||R.size<256?r:"other handlers",t=R.get(n);if(t||(t={start:i,count:0,suppressed:0},R.set(n,t)),i-t.start>1e4&&(t.suppressed&&h("handled-exception",n,"throttled",{suppressedCount:t.suppressed}),t.start=i,t.count=0,t.suppressed=0),++t.count>3){t.suppressed++;return}let o=H(e),l=(e instanceof Error||e instanceof DOMException)&&e.name==="AbortError";h("handled-exception",n,l?"cancelled":"failed",{...o,recovery:"Existing handler continues; recording does not retry, reset settings or prove recovery succeeded."})}catch{}}var Z="code-codex:ascii-tiles-background:v1",$={...O,paused:!1};function J(r){let e=r&&typeof r=="object"?r:{};return{...C(e),paused:e.paused===!0}}function U(){try{return J(JSON.parse(localStorage.getItem(Z)??"{}"))}catch(r){return F("ASCII settings read",r),{...$}}}var N=class extends x{constructor(r,e,i,n){super("ascii-tiles",`"use strict";(()=>{globalThis.window=globalThis;function We(e,n,o){let r=globalThis,i=n,a=!0,p=!1,d=new Set,f=new Set,v=new EventTarget,g=Object.assign(new EventTarget,{matches:!1,media:"(prefers-reduced-motion: reduce)"}),E=()=>({...i,x:i.left,y:i.top,right:i.left+i.width,bottom:i.top+i.height,toJSON(){return this}}),t=Object.assign(new EventTarget,{getBoundingClientRect:E,closest:()=>null,style:{setProperty(){},removeProperty(){}},dataset:{},contains:()=>!1}),l=new Map,y={},b=new Proxy(e,{get(h,m){if(m==="getBoundingClientRect")return E;if(m==="clientWidth"||m==="offsetWidth")return i.width;if(m==="clientHeight"||m==="offsetHeight")return i.height;if(m==="closest")return()=>null;if(m==="parentElement")return t;if(m==="setPointerCapture"||m==="releasePointerCapture"||m==="replaceWith")return()=>{};if(m==="style")return t.style;if(m==="dataset")return y;if(m==="getContext")return(W,P)=>{if(l.has(W))return l.get(W);let O=h.getContext(W,P);if(!O)return null;let T=null,H=new Map,k=new Proxy(O,{get(F,S){let U=Reflect.get(F,S,F);return typeof U!="function"?U:(H.has(S)||H.set(S,(...s)=>{let c=Reflect.apply(U,F,s);return S==="bindFramebuffer"&&(s[0]===F.FRAMEBUFFER||s[0]===F.DRAW_FRAMEBUFFER)&&(T=s[1]),(S==="drawArrays"||S==="drawElements"||S==="drawArraysInstanced"||S==="drawElementsInstanced")&&T===null&&o(),c}),H.get(S))}});return l.set(W,k),k};let I=Reflect.get(h,m,h);return typeof I=="function"?I.bind(h):I},set(h,m,I){return Reflect.set(h,m,I,h)}});Object.defineProperties(t,{clientWidth:{get:()=>i.width},clientHeight:{get:()=>i.height}});let A=Object.assign(v,{get hidden(){return!a},get visibilityState(){return a?"visible":"hidden"}});Object.defineProperties(A,{hidden:{get:()=>!a},visibilityState:{get:()=>a?"visible":"hidden"}}),r.window=r,r.document=A,r.matchMedia=()=>g,r.Element=class extends EventTarget{},Object.defineProperties(r,{innerWidth:{configurable:!0,get:()=>i.width},innerHeight:{configurable:!0,get:()=>i.height},devicePixelRatio:{configurable:!0,get:()=>i.dpr}}),r.ResizeObserver=class{constructor(h){this.callback=h;d.add(this)}observe(){this.callback([{target:t,contentRect:E()}])}disconnect(){d.delete(this)}},r.IntersectionObserver=class{constructor(h){this.callback=h;f.add(this)}observe(){this.callback([{target:t,isIntersecting:a,intersectionRatio:a?1:0}])}disconnect(){f.delete(this)}};let M=(h,m)=>{let I=new Event(h);for(let[W,P]of Object.entries(m))Object.defineProperty(I,W,{value:P});return I};return{host:t,canvas:b,viewport(h){i=h;for(let m of d)m.callback([{target:t,contentRect:E()}]);r.dispatchEvent(new Event("resize"))},visibility(h){if(a!==h){a=h,v.dispatchEvent(new Event("visibilitychange"));for(let m of f)m.callback([{target:t,isIntersecting:h,intersectionRatio:h?1:0}])}},motion(h){p!==h&&(p=h,g.matches=h,g.dispatchEvent(new Event("change")))},input(h,m){r.dispatchEvent(M(h,m)),t.dispatchEvent(M(h,m)),e.dispatchEvent(M(h,m))},dispose(){d.clear(),f.clear();for(let h of l.values())try{h.getExtension("WEBGL_lose_context")?.loseContext()}catch{}l.clear()}}}function ne(e){let n=0,o=0,r=0,i=(a,p)=>{if(++o>8192||p>10)throw Error("BG_ASSET_SHAPE: Visual asset structure exceeds its budget.");if(ArrayBuffer.isView(a)){if((a instanceof Float32Array||a instanceof Float64Array)&&!a.every(Number.isFinite))throw Error("BG_ASSET_NUMBER: Prepared visual numbers must be finite.");if(n+=a.byteLength,n>32*1024*1024)throw Error("BG_ASSET_SIZE: Prepared visual assets exceed 32 MiB.");return a}if(Array.isArray(a))return a.map(f=>i(f,p+1));if(a&&typeof a=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(a))){let f={};for(let[v,g]of Object.entries(a)){if(K({[v]:null}),r+=new TextEncoder().encode(v).length+4,r>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");f[v]=i(g,p+1)}return f}let d=K(a);if(r+=new TextEncoder().encode(JSON.stringify(d)).length,r>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");return d};return i(e,0)}function K(e){let n=0,o=(i,a)=>{if(++n>4096||a>8)throw Error("BG_STATE_LIMIT: Visual state exceeds the bounded schema.");if(i===null||typeof i=="boolean")return i;if(typeof i=="number"){if(!Number.isFinite(i))throw Error("BG_STATE_NUMBER: Visual numbers must be finite.");return i}if(typeof i=="string"){if(i.length>1024)throw Error("BG_STATE_STRING: Visual strings must be bounded.");return i}if(Array.isArray(i))return i.map(p=>o(p,a+1));if(i&&typeof i=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(i))){let p={};for(let[d,f]of Object.entries(i)){if(/^(?:__proto__|constructor|prototype|token|accessToken|refreshToken|authorization|cookie|bridge|conversation|history|source|url|path)$/i.test(d))throw Error("BG_STATE_FIELD: Visual state contains an unsupported field.");f!==void 0&&(p[d]=o(f,a+1))}return p}throw Error("BG_STATE_TYPE: Visual state must contain serializable visual values.")},r=o(e,0);if(new TextEncoder().encode(JSON.stringify(r)).length>65536)throw Error("BG_STATE_SIZE: Visual state exceeds the message budget.");return r}function he(e,n){if(![e.width,e.height,e.left,e.top,n].every(Number.isFinite)||e.width<0||e.height<0)throw Error("BG_VIEWPORT_INVALID: Invalid visual dimensions.");let o=Math.max(1,Math.min(8192,e.width)),r=Math.max(1,Math.min(8192,e.height)),i=Math.min(3,Math.max(.5,n),Math.sqrt(16777216/(o*r)));return{width:o,height:r,left:e.left,top:e.top,dpr:i}}var ot=()=>{};function Fe(e){ot=e}var ge=\`#version 300 es
2
+ precision highp float;
3
+ uniform vec2 uResolution;
4
+ uniform float uTime;
5
+ uniform sampler2D uAtlas;
6
+ uniform sampler2D uWaveGrid;
7
+ uniform ivec2 uWaveOrigin;
8
+ uniform float uWaveHeight;
9
+ uniform vec3 uGlyphColor, uRecessColor, uBackgroundColor;
10
+ uniform float uGlyphSize, uTileDensity, uTileShear, uBevelWidth, uBevelSoftness;
11
+ uniform float uTileGap, uOutlineWidth, uOutlineStrength;
12
+ uniform float uRefraction, uChromatic, uSpecularExp, uSpecularStrength;
13
+ uniform vec3 uFrequency;
14
+ uniform vec2 uPointer;
15
+ uniform float uReducedHover, uRadius, uIntensity, uOpacity;
16
+ uniform float uIntroProgress, uIntroStrength;
17
+ in vec2 vUV;
18
+ out vec4 outColor;
19
+
20
+ // An independently constructed interference field, not the Pro source shader.
21
+ float field(vec2 pixel) {
22
+ vec2 p = (pixel - uResolution * 0.5) / max(uResolution.x, uResolution.y);
23
+ float t = uTime * 0.34;
24
+ float wave = sin(p.x * uFrequency.x * 3.14159 + t)
25
+ + sin(p.y * uFrequency.y * 3.14159 - t * 1.25)
26
+ + sin(p.x * p.y * uFrequency.z * 12.0 + t * 0.7);
27
+ return clamp(0.48 + wave * 0.24, 0.0, 1.0);
28
+ }
29
+
30
+ float ascii(vec2 pixel) {
31
+ vec2 cell = floor(pixel / uGlyphSize);
32
+ float density = field((cell + 0.5) * uGlyphSize);
33
+ float glyph = floor(clamp(density, 0.0, 0.9999) * 10.0);
34
+ vec2 local = fract(pixel / uGlyphSize);
35
+ // Ten equally spaced slots in a one-row monospace atlas; no font work per frame.
36
+ vec2 atlasUV = vec2((glyph + local.x) / 10.0, local.y);
37
+ return texture(uAtlas, atlasUV).r * mix(0.3, 1.0, density);
38
+ }
39
+
40
+ vec4 brickWave(ivec2 id) {
41
+ ivec2 cell = id - uWaveOrigin;
42
+ if (any(lessThan(cell, ivec2(0))) || any(greaterThanEqual(cell, textureSize(uWaveGrid, 0)))) return vec4(0);
43
+ return texelFetch(uWaveGrid, cell, 0);
44
+ }
45
+
46
+ void main() {
47
+ // All dimensions are CSS pixels, independent of device pixel ratio.
48
+ vec2 pixel = vUV * uResolution;
49
+ float edge = max(uResolution.x, uResolution.y);
50
+ vec2 p = (pixel - uResolution * 0.5) / edge;
51
+ mat2 lattice = mat2(1.0, uTileShear, -uTileShear, 1.0);
52
+ vec2 latticePoint = lattice * p * uTileDensity + vec2(0.42, 0.35);
53
+ ivec2 brickID = ivec2(floor(latticePoint));
54
+ vec4 wave = brickWave(brickID);
55
+ // Subpixel spring tails must not shimmer the distant character grid. Keep
56
+ // the physical spring state continuous; fade only its rendered displacement.
57
+ wave *= smoothstep(0.04, 0.12, abs(wave.x));
58
+ vec2 restQ = fract(latticePoint);
59
+ vec2 restDistances = 0.5 - abs(restQ - 0.5);
60
+ float restNearest = min(restDistances.x, restDistances.y);
61
+ // Keep gaps and outlines in CSS pixels, even when density, shear or DPR changes.
62
+ float pixelToTile = uTileDensity * sqrt(1.0 + uTileShear * uTileShear) / edge;
63
+ // Very dense grids must still leave some visible glass instead of overlapping.
64
+ float seam = min(uTileGap * 0.5 * pixelToTile, 0.44);
65
+ float aa = max(fwidth(restNearest) * 0.5, 0.00001);
66
+ float rim = max(min(uBevelWidth + uBevelSoftness * 0.25, 0.48 - seam), 0.001);
67
+ // The frame has ONE stationary bevel/outline, not a second shifted wire grid.
68
+ // The face inside it retains the original spring-driven press and rebound.
69
+ float tile = uTileGap > 0.0 ? smoothstep(seam - aa, seam + aa, restNearest) : 1.0;
70
+ vec2 q = restQ;
71
+ vec2 signedEdge = q - 0.5;
72
+ vec2 distances = 0.5 - abs(signedEdge);
73
+ float nearest = min(distances.x, distances.y);
74
+ float slope = 1.0 - smoothstep(seam, seam + rim, nearest);
75
+ vec2 gradient = distances.x < distances.y ? vec2(sign(signedEdge.x), 0.0) : vec2(0.0, sign(signedEdge.y));
76
+ gradient = transpose(lattice) * gradient;
77
+ vec2 offset = gradient * slope * uRefraction;
78
+ float pitch = 1.0 / pixelToTile;
79
+ vec2 centerGrid = (vec2(brickID) + 0.5 - vec2(0.42, 0.35)) / uTileDensity;
80
+ vec2 centerPixel = uResolution * 0.5 + inverse(lattice) * centerGrid * edge;
81
+ float entrance = 1.0;
82
+ float entranceLift = 0.0;
83
+ float entranceLight = 0.0;
84
+ if (uIntroProgress < 1.0) {
85
+ // Tile-sized phases: a diagonal cascade with small, stable timing offsets.
86
+ float seed = fract(sin(dot(vec2(brickID), vec2(127.1, 311.7))) * 43758.5453);
87
+ float order = dot(clamp(centerPixel / uResolution, 0.0, 1.0), vec2(0.48, 0.52));
88
+ float delay = order * 0.46 + seed * 0.12;
89
+ float local = clamp((uIntroProgress - delay) / 0.42, 0.0, 1.0);
90
+ entrance = smoothstep(0.0, 0.36, local);
91
+ float settle = (1.0 - local) * (1.0 - local);
92
+ entranceLift = cos(local * 8.0) * settle * min(pitch * 0.22, 80.0) * uIntroStrength;
93
+ entranceLight = sin(local * 3.14159265) * settle * uIntroStrength;
94
+ }
95
+ float lift = clamp(wave.x, -1.5, 1.5) * min(uWaveHeight, pitch * 0.12);
96
+ lift += entranceLift;
97
+ float faceBlend = smoothstep(seam, seam + rim * 0.8, restNearest);
98
+ vec2 faceShift = vec2(0.22, 0.7) * lift;
99
+ float faceScale = clamp(1.0 + lift / pitch * 0.65, 0.85, 1.15);
100
+ vec2 refracted = centerPixel + (pixel - centerPixel - faceShift * faceBlend)
101
+ / mix(1.0, faceScale, faceBlend) + offset;
102
+ float r = ascii(refracted + offset * uChromatic);
103
+ float g = ascii(refracted);
104
+ float b = ascii(refracted - offset * uChromatic);
105
+ vec2 coupledTilt = transpose(lattice) * wave.yz * min(uWaveHeight / pitch, 0.12) * 2.8;
106
+ vec3 normal = normalize(vec3(-gradient * slope * 2.4 - coupledTilt, 1.0));
107
+ vec3 light = normalize(vec3(-0.6, 0.8, 0.65));
108
+ float highlight = pow(max(dot(normal, normalize(light + vec3(0, 0, 1))), 0.0), uSpecularExp);
109
+ float bevelLight = 0.45 + max(dot(normal, light), 0.0) * 0.65;
110
+ float rimFacing = max(dot(normal.xy, normalize(light.xy)), 0.0);
111
+ float rimReflection = slope * pow(rimFacing, mix(1.2, 3.5, uSpecularExp / 256.0));
112
+ vec3 glyphs = vec3(r, g, b) * uGlyphColor * mix(0.9, bevelLight, slope);
113
+ // Glass catches white light on the upper bevel while glyphs retain dispersion.
114
+ glyphs += vec3(highlight * uSpecularStrength) * (0.08 + vec3(r,g,b) * 0.92);
115
+ glyphs += vec3(r,g,b) * rimReflection * uSpecularStrength * 4.5;
116
+ float energy = clamp((abs(wave.x) + abs(wave.w) * 0.02) * uWaveHeight / 36.0, 0.0, 0.35);
117
+ // Reduced motion retains a static material cue instead of a moving wave.
118
+ energy += uReducedHover * uIntensity * 0.18 * (1.0 - smoothstep(0.0, uRadius, length(pixel - uPointer)));
119
+ // Geometric pressing supplies interaction; never add a dark cursor veil.
120
+ glyphs *= 1.0 + energy * slope * 0.12;
121
+ glyphs *= 1.0 + entranceLight * (0.4 + slope * 0.8);
122
+ vec3 color = mix(uRecessColor, mix(uBackgroundColor, glyphs, clamp(max(max(r,g),b) * 3.0,0.0,1.0)), tile);
123
+ if (uOutlineWidth > 0.0 && uOutlineStrength > 0.0) {
124
+ // Material transition at the INSIDE of the bevel, not a painted line.
125
+ // Modulate existing glyph light so empty/dark areas never grow a wireframe.
126
+ float faceEdge = seam + rim;
127
+ float halfWidth = uOutlineWidth * pixelToTile * 0.5;
128
+ float transitionWidth = max(halfWidth + aa, aa * 2.0);
129
+ float lip = exp(-2.0 * pow((nearest - faceEdge) / transitionWidth, 2.0));
130
+ float shadow = exp(-2.0 * pow((nearest - (faceEdge - halfWidth * 1.5)) / transitionWidth, 2.0));
131
+ float facing = max(dot(normalize(gradient), normalize(light.xy)), 0.0);
132
+ color *= 1.0 - shadow * uOutlineStrength * tile * 0.22;
133
+ color *= 1.0 + lip * uOutlineStrength * tile * (facing * 0.28 - 0.08);
134
+ }
135
+ color = mix(uBackgroundColor, color, entrance);
136
+ outColor = vec4(clamp(color, 0.0, 1.0), uOpacity);
137
+ }
138
+ \`;var at=Object.freeze({speed:.87,glyphSize:9,tileDensity:6.7,tileShear:-.31,tileGap:18.5,outlineWidth:1.25,outlineStrength:.6,bevelWidth:.13,bevelSoftness:.1,refractionStrength:46,chromaticSpread:.66,specularExponent:256,specularStrength:1,patternFreqX:9.4,patternFreqY:4,patternFreqXY:10,glyphColor:"#ffffff",recessColor:"#000000",backgroundColor:"#000000",opacity:.6,dpr:1.5,cursorInteraction:!0,cursorRadius:110,cursorIntensity:1,cursorRecovery:.95,waveSpeed:5.5,waveHeight:36,clickStrength:1.5}),Ge=Object.freeze({speed:[0,3,.01],glyphSize:[4,24,1],tileDensity:[1,12,.1],tileShear:[-.5,.5,.01],bevelWidth:[0,.5,.005],tileGap:[0,40,.5],outlineWidth:[0,6,.25],outlineStrength:[0,1,.01],bevelSoftness:[.01,.4,.005],refractionStrength:[0,120,1],chromaticSpread:[0,1,.01],specularExponent:[1,256,1],specularStrength:[0,3,.01],patternFreqX:[0,20,.1],patternFreqY:[0,20,.1],patternFreqXY:[0,20,.1],opacity:[0,1,.01],dpr:[1,3,.1],cursorRadius:[20,400,1],cursorIntensity:[0,3,.01],cursorRecovery:[.4,4,.05],waveSpeed:[1,12,.1],waveHeight:[0,80,1],clickStrength:[0,3,.01]});function ve(e={}){let n={...at};for(let o of Object.keys(Ge)){let[r,i]=Ge[o],a=e[o];typeof a=="number"&&Number.isFinite(a)&&(n[o]=Math.min(i,Math.max(r,a)))}for(let o of["glyphColor","recessColor","backgroundColor"])typeof e[o]=="string"&&/^#[\\da-f]{6}$/i.test(e[o])&&(n[o]=e[o]);return typeof e.cursorInteraction=="boolean"&&(n.cursorInteraction=e.cursorInteraction),n}function Ce(e){return[1,3,5].map(n=>parseInt(e.slice(n,n+2),16)/255)}function Ue(e,n,o,r,i,a){let p=Math.max(e,n,1),d=(i-e*.5)/p,f=(n*.5-a)/p;return[(d-r*f)*o+.42,(r*d+f)*o+.35]}function Ee(e,n,o,r){let i=[[0,0],[e,0],[0,n],[e,n]].map(([g,E])=>Ue(e,n,o,r,g,E)),a=Math.floor(Math.min(...i.map(g=>g[0])))-2,p=Math.floor(Math.min(...i.map(g=>g[1])))-2,d=Math.floor(Math.max(...i.map(g=>g[0])))+3-a,f=Math.floor(Math.max(...i.map(g=>g[1])))+3-p,v=d*f;return{width:e,height:n,density:o,shear:r,columns:d,rows:f,originX:a,originY:p,layoutKey:\`\${e}:\${n}:\${o}:\${r}\`,heights:new Float32Array(v),velocities:new Float32Array(v),accelerations:new Float32Array(v),data:new Float32Array(v*4),active:!1,dirty:!0,quietFor:0}}function Y(e){e.heights.fill(0),e.velocities.fill(0),e.data.fill(0),e.active=!1,e.dirty=!0,e.quietFor=0}function we(e,n,o,r,i){if(!Number.isFinite(r)||r===0)return;let[a,p]=Ue(e.width,e.height,e.density,e.shear,n,o),d=Math.max(e.width,e.height)/(e.density*Math.sqrt(1+e.shear*e.shear)),f=Math.max(1e-4,i/(3*d));for(let v=0;v<e.rows;v++)for(let g=0;g<e.columns;g++){let E=Math.max(Math.abs(e.originX+g+.5-a)-.5,0),t=Math.max(Math.abs(e.originY+v+.5-p)-.5,0),l=E*E+t*t;if(l>f*f*9)continue;let y=Math.exp(-l/(2*f*f)),b=v*e.columns+g;e.velocities[b]=Math.max(-36,Math.min(36,e.velocities[b]+r*y))}e.active=!0,e.quietFor=0}function ze(e,n,o,r,i,a,p,d){let f=Math.hypot(r-n,i-o);if(f<.5||d<=0)return;let v=f/Math.max(a,.004),g=.7+Math.min(2,v/1e3),E=Math.max(e.width,e.height)/e.density,t=Math.min(64,Math.max(1,Math.ceil(f/Math.min(24,E*.22)))),l=-Math.min(f,120)*.08*d*g/t;for(let y=1;y<=t;y++){let b=y/t;we(e,n+(r-n)*b,o+(i-o)*b,l,p)}}function q(e,n,o){return n<0||n>=e.columns||o<0||o>=e.rows?0:e.heights[o*e.columns+n]}function ye(e){for(let n=0;n<e.rows;n++)for(let o=0;o<e.columns;o++){let r=n*e.columns+o;e.data[r*4]=e.heights[r],e.data[r*4+1]=(q(e,o+1,n)-q(e,o-1,n))*.5,e.data[r*4+2]=(q(e,o,n+1)-q(e,o,n-1))*.5,e.data[r*4+3]=e.velocities[r]}e.dirty=!0}function Ne(e,n,o,r){if(!e.active||n<=0)return;if(e.quietFor+=n,e.quietFor>=r){Y(e);return}let i=Math.min(n,.05),a=Math.ceil(i*120),p=i/a,d=o*o,f=12/Math.max(r,.4);for(let E=0;E<a;E++){for(let t=0;t<e.rows;t++)for(let l=0;l<e.columns;l++){let y=t*e.columns+l,b=e.heights[y],A=q(e,l-1,t)+q(e,l+1,t)+q(e,l,t-1)+q(e,l,t+1)-b*4,M=l<2||t<2||l>=e.columns-2||t>=e.rows-2?1.6:1;e.accelerations[y]=d*A-36*b-f*M*e.velocities[y]}for(let t=0;t<e.heights.length;t++)e.velocities[t]+=e.accelerations[t]*p,e.heights[t]+=e.velocities[t]*p}let v=0,g=0;for(let E=0;E<e.heights.length;E++)v=Math.max(v,Math.abs(e.heights[E])),g=Math.max(g,Math.abs(e.velocities[E]));v<2e-4&&g<.002?Y(e):ye(e)}var st=/(token|cookie|password|secret|credential|authorization|apikey)/i,ct=/^(content|text|body|prompt|messages|title|filename|name|raw|data|database64|commandline|sessionid|accountid|threadid|projectid)$|(?:path|url|uri)$/i;function X(e){return e.slice(0,8e3).replace(/\\b[A-Za-z][A-Za-z0-9+.-]*:\\/\\/[^\\s"'<>]+/g,o=>{try{let r=new URL(o);if(["127.0.0.1","localhost","[::1]"].includes(r.hostname)&&!r.username&&!r.password&&["/json/version","/json/list","/"].includes(r.pathname))return\`\${r.origin}\${r.pathname}\`}catch{}return"[url]"}).replace(/(?:\\b[A-Za-z]:[\\\\/]|\\\\\\\\|\\/(?:Users|home|tmp|var|etc|opt|mnt)\\/|~\\/)[^\\r\\n"'<>]*/g,"[path]").replace(/\\b(?:Bearer\\s+\\S+|(?:authorization|password|secret|(?:access[_-]?|refresh[_-]?)?token|api[_-]?key|cookie)\\s*[:=]\\s*[^,;\\r\\n]+)/gi,"[credential]").replace(/\\bsk-[A-Za-z0-9_-]{8,}|\\beyJ[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+/g,"[credential]").replace(/\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b/g,"[email]").slice(0,4e3)+(e.length>8e3?" [truncated]":"")}function qe(e){let n=256,o=new WeakSet,r=(i,a)=>{if(--n<0||a>6)return"[truncated]";if(typeof i=="string")return X(i);if(i===null||typeof i=="boolean"||typeof i=="number")return i;if(typeof i!="object")return"[unsupported]";if(o.has(i))return"[circular]";if(o.add(i),i instanceof Error)return{name:X(i.name),message:X(i.message)};if(Array.isArray(i))return i.slice(0,128).map(d=>r(d,a+1));let p=Object.create(null);for(let[d,f]of Object.entries(i).slice(0,128)){let v=d.replace(/[^a-z0-9]/gi,"");p[X(d).slice(0,160)]=st.test(v)||ct.test(v)?"[redacted]":r(f,a+1)}return p};try{return r(e,0)}catch{return{redactionFailed:!0}}}var lt=Symbol.for("code-codex:runtime-events:v1"),ut=window,re=ut[lt]??={events:[],dropped:0};function Xe(e,n,o,r={}){let i={source:X(e).slice(0,160),action:X(n).slice(0,160),outcome:X(o).slice(0,160),details:{...qe(r),observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}},a=new TextEncoder().encode(JSON.stringify(i)).length;a>7e3&&(i.details={truncated:!0,originalBytes:a,observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}),re.events.push(i),re.events.length>1e3&&(re.events.splice(0,200),re.dropped+=200)}var dt=Symbol.for("code-codex:background-startup-hold:v1");function be(){let e=window;return e[dt]??={active:!1,layers:new Set,next:-1,pending:new Map,painted:new WeakSet,openings:new WeakMap}}function ft(e){return e.closest("[data-code-codex-particle-layer]")}function pt(e,n){n.native=requestAnimationFrame(o=>{let r=be();n.native=void 0,r.pending.has(e)&&(r.active&&r.painted.has(n.layer)||(r.pending.delete(e),r.active&&(r.painted.add(n.layer),r.layers.add(n.layer),Xe("background-opening","initial frame","prepared")),n.callback(o)))})}function Ve(e,n){let o=ft(e);if(!o)return requestAnimationFrame(n);let r=be(),i=r.next--,a={layer:o,callback:n};return r.pending.set(i,a),pt(i,a),i}function je(e){if(e>=0){cancelAnimationFrame(e);return}let n=be(),o=n.pending.get(e);o?.native!==void 0&&cancelAnimationFrame(o.native),n.pending.delete(e)}var mt=\`#version 300 es
139
+ out vec2 vUV;
140
+ void main() {
141
+ vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
142
+ vUV = p;
143
+ gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
144
+ }\`;function ht(){let e=typeof document.createElement=="function"?document.createElement("canvas"):new OffscreenCanvas(480,48);e.width=480,e.height=48;let n=e.getContext("2d");if(!n)throw new Error("Cannot create the ASCII glyph atlas.");return n.fillStyle="black",n.fillRect(0,0,e.width,e.height),n.fillStyle="white",[[0,0,0,0,0],[0,0,0,0,4],[0,4,0,4,0],[0,0,14,0,0],[0,14,0,14,0],[4,4,31,4,4],[21,14,31,14,21],[10,31,10,31,10],[25,26,4,11,19],[31,17,29,21,31]].forEach((r,i)=>r.forEach((a,p)=>{for(let d=0;d<5;d++)a&1<<4-d&&n.fillRect(i*48+4+d*8,4+p*8,8,8)})),e}function He(e,n,o){let r=e.createShader(n);if(!r)throw new Error("Cannot create shader.");if(e.shaderSource(r,o),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){let i=e.getShaderInfoLog(r);throw e.deleteShader(r),new Error(i||"Shader compilation failed.")}return r}var oe=class{constructor(n,o,r,i=()=>{}){let a={current:r},p={current:null},d={current:null},f=null,v=!0,g=E=>{E&&v&&(f=E),v||i(E??void 0)};this.dispose=(()=>{let E=o.getContext("webgl2",{alpha:!0,antialias:!1,premultipliedAlpha:!1,depth:!1,stencil:!1});if(!E)throw new Error("ASCII_WEBGL_UNAVAILABLE: WebGL 2 is required. Enable hardware acceleration and retry.");let t=E,l=null,y=null,b=null,A=null,M=0,h=!1,m=!1,I=!document.hidden,W=!0,P=1,O=1,T=n.getBoundingClientRect(),H=0,k=0,F=-1e3,S=-1e3,U=!1,s=ve(a.current),c=Ee(1,1,s.tileDensity,s.tileShear),L=null,se=0,R={},B=window.matchMedia("(prefers-reduced-motion: reduce)"),z=B.matches?1:0,tt=2.4,nt=u=>{let w=u instanceof Error?u.message:String(u);g(w),a.current.onError?.(w)},ce=()=>{l&&t.deleteProgram(l),y&&t.deleteTexture(y),b&&t.deleteTexture(b),A&&t.deleteVertexArray(A),l=null,y=null,b=null,A=null};function D(){!M&&!h&&!m&&I&&W&&l&&(M=Ve(n,rt))}let Te=()=>{if(s=ve(a.current),(!s.cursorInteraction||B.matches)&&c.active&&Y(c),!l||m)return;t.useProgram(l);let u={uGlyphSize:s.glyphSize,uTileDensity:s.tileDensity,uTileShear:s.tileShear,uBevelWidth:s.bevelWidth,uTileGap:s.tileGap,uOutlineWidth:s.outlineWidth,uOutlineStrength:s.outlineStrength,uBevelSoftness:s.bevelSoftness,uRefraction:s.refractionStrength,uChromatic:s.chromaticSpread,uSpecularExp:s.specularExponent,uSpecularStrength:s.specularStrength,uRadius:s.cursorRadius,uIntensity:s.cursorIntensity,uOpacity:s.opacity,uWaveHeight:s.waveHeight,uIntroStrength:1};for(let[w,x]of Object.entries(u))t.uniform1f(R[w],x);t.uniform3f(R.uFrequency,s.patternFreqX,s.patternFreqY,s.patternFreqXY);for(let[w,x]of[["uGlyphColor",s.glyphColor],["uRecessColor",s.recessColor],["uBackgroundColor",s.backgroundColor]]){let[N,V,_]=Ce(x);t.uniform3f(R[w],N,V,_)}Q(),k=0,D()};function Q(){T=n.getBoundingClientRect(),P=Math.max(1,T.width),O=Math.max(1,T.height);let u=t.getParameter(t.MAX_RENDERBUFFER_SIZE),w=Math.min(window.devicePixelRatio||1,s.dpr,u/P,u/O),x=Math.max(1,Math.round(P*w)),N=Math.max(1,Math.round(O*w));if((o.width!==x||o.height!==N)&&(o.width=x,o.height=N),t.viewport(0,0,x,N),l){t.useProgram(l),t.uniform2f(R.uResolution,P,O);let V=\`\${P}:\${O}:\${s.tileDensity}:\${s.tileShear}\`;if(c.layoutKey!==V){let _=c;if(c=Ee(P,O,s.tileDensity,s.tileShear),_.active&&_.density===c.density&&_.shear===c.shear){for(let ee=0;ee<c.rows;ee++)for(let te=0;te<c.columns;te++){let pe=te+c.originX-_.originX,me=ee+c.originY-_.originY;if(pe>=0&&me>=0&&pe<_.columns&&me<_.rows){let Be=ee*c.columns+te,De=me*_.columns+pe;c.heights[Be]=_.heights[De],c.velocities[Be]=_.velocities[De]}}c.active=!0,c.quietFor=_.quietFor,ye(c)}t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,b),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,c.columns,c.rows,0,t.RGBA,t.FLOAT,c.data),c.dirty=!1}t.uniform2i(R.uWaveOrigin,c.originX,c.originY)}D()}function rt(u){if(M=0,h||m||!I||!W||!l)return;let w=!a.current.paused&&s.speed>0&&!B.matches,x=k?Math.min((u-k)/1e3,.05):1/60;z<1&&(z=Math.min(1,z+x/tt)),s.cursorInteraction&&!B.matches&&Ne(c,x,s.waveSpeed,s.cursorRecovery),w&&k&&(H+=Math.min((u-k)/1e3,.05)*s.speed),k=u,t.useProgram(l),t.bindVertexArray(A),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,y),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,b),c.dirty&&(t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.texSubImage2D(t.TEXTURE_2D,0,0,0,c.columns,c.rows,t.RGBA,t.FLOAT,c.data),c.dirty=!1),t.uniform1f(R.uTime,H),t.uniform1f(R.uIntroProgress,z),(z<1||o.dataset.introProgress!=="1.0000")&&(o.dataset.introProgress=z.toFixed(4)),t.uniform2f(R.uPointer,F,S),t.uniform1f(R.uReducedHover,B.matches&&U&&s.cursorInteraction?1:0),t.drawArrays(t.TRIANGLES,0,3),(w||c.active||z<1)&&D()}let Se=()=>{let u=null,w=null;try{if(u=He(t,t.VERTEX_SHADER,mt),w=He(t,t.FRAGMENT_SHADER,ge),l=t.createProgram(),!l)throw new Error("Cannot create shader program.");if(t.attachShader(l,u),t.attachShader(l,w),t.linkProgram(l),!t.getProgramParameter(l,t.LINK_STATUS))throw new Error(t.getProgramInfoLog(l)||"Shader linking failed.");R={};for(let x of ge.matchAll(/\\bu[A-Z]\\w*/g))R[x[0]]=t.getUniformLocation(l,x[0]);if(A=t.createVertexArray(),t.activeTexture(t.TEXTURE0),y=t.createTexture(),b=t.createTexture(),!y||!b||!A)throw new Error("Cannot allocate WebGL resources.");t.bindTexture(t.TEXTURE_2D,y),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,ht()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.useProgram(l),t.uniform1i(R.uAtlas,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,b),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,c.columns,c.rows,0,t.RGBA,t.FLOAT,c.data),t.uniform1i(R.uWaveGrid,1),g(null),Te()}catch(x){ce(),nt(x)}finally{u&&t.deleteShader(u),w&&t.deleteShader(w)}},$=()=>{je(M),M=0,k=0},le=()=>{L=null,c.active&&performance.now()/1e3-se>=s.cursorRecovery&&Y(c)},Re=()=>{I=!document.hidden,le(),$(),D()},ke=()=>{T=n.getBoundingClientRect()},_e=u=>{F=u.clientX-T.left,S=O-(u.clientY-T.top),U=F>=0&&F<=P&&S>=0&&S<=O},ue=u=>{_e(u),L={x:u.clientX-T.left,y:u.clientY-T.top,time:performance.now()/1e3},s.cursorInteraction&&D()},Ae=u=>{if(u.composedPath().some(V=>V instanceof Element&&V.matches("button,input,select,a,textarea,[contenteditable=true],[role=dialog],[role=menu],[role=slider]"))){L=null,U=!1;return}_e(u);let w=performance.now()/1e3,x=u.clientX-T.left,N=u.clientY-T.top;s.cursorInteraction&&!B.matches&&U&&L&&Math.hypot(x-L.x,N-L.y)>=.5&&s.cursorIntensity>0&&(c.active||(k=0),ze(c,L.x,L.y,x,N,w-L.time,s.cursorRadius,s.cursorIntensity),se=w),L={x,y:N,time:w},s.cursorInteraction&&D()},Z=()=>{U=!1,L=null,D()},Ie=u=>{u.button!==0||u.composedPath().some(w=>w instanceof Element&&w.matches("button,input,select,a,textarea,[contenteditable=true],[role=dialog]"))||(ue(u),s.cursorInteraction&&!B.matches&&s.clickStrength>0&&(c.active||(k=0),we(c,u.clientX-T.left,u.clientY-T.top,-14*s.clickStrength,s.cursorRadius),se=performance.now()/1e3,D()))},Me=u=>{u.pointerType==="touch"&&Z()},Pe=u=>{u.preventDefault(),m=!0,$(),l=null,y=null,b=null,A=null,R={},g("ASCII_CONTEXT_LOST: Waiting for graphics context restoration.")},Oe=()=>{m=!1,le(),Se()},Le=()=>{B.matches&&(Y(c),z=1),$(),D()},de=new ResizeObserver(()=>{m||Q()}),fe=new IntersectionObserver(([u])=>{W=u.isIntersecting,le(),$(),D()});if(Se(),f)throw de.disconnect(),fe.disconnect(),ce(),new Error(f);return de.observe(n),fe.observe(n),p.current=Te,d.current=()=>{z=B.matches?1:0,k=0,D()},window.addEventListener("pointermove",Ae),window.addEventListener("pointerenter",ue),window.addEventListener("pointerdown",Ie),window.addEventListener("pointerleave",Z),window.addEventListener("pointercancel",Z),window.addEventListener("pointerup",Me),document.addEventListener("visibilitychange",Re),window.addEventListener("scroll",ke,{passive:!0,capture:!0}),window.addEventListener("resize",Q),B.addEventListener("change",Le),o.addEventListener("webglcontextlost",Pe),o.addEventListener("webglcontextrestored",Oe),()=>{h=!0,$(),p.current=null,d.current=null,de.disconnect(),fe.disconnect(),window.removeEventListener("pointermove",Ae),window.removeEventListener("pointerenter",ue),window.removeEventListener("pointerdown",Ie),window.removeEventListener("pointerleave",Z),window.removeEventListener("pointercancel",Z),window.removeEventListener("pointerup",Me),document.removeEventListener("visibilitychange",Re),window.removeEventListener("scroll",ke,!0),window.removeEventListener("resize",Q),B.removeEventListener("change",Le),o.removeEventListener("webglcontextlost",Pe),o.removeEventListener("webglcontextrestored",Oe),ce()}})(),v=!1,this.setSettings=E=>{a.current=E,p.current?.()},this.replay=()=>d.current?.(),this.ready=Promise.resolve()}};var Ke=[];function Ye(e,n,o,r){return new oe(e,n,o,r)}var J=globalThis,ie="",$e=0,Ze=!1,j,G,xe=0,Je=!1,Qe=0,C=(e,n={})=>J.postMessage({v:1,session:ie,type:e,...n}),ae=e=>C("failed",{code:"BG_WORKER_RENDER_FAILED",message:String(e instanceof Error?e.message:e).slice(0,1500)});J.addEventListener("error",e=>ae(e.error??e.message));J.addEventListener("unhandledrejection",e=>ae(e.reason));J.addEventListener("message",e=>{let n=e.data;if(!(Ze||!n||n.v!==1||typeof n.session!="string"))try{if(n.type==="init"){if(ie||!(n.canvas instanceof OffscreenCanvas)||n.session.length>100)throw Error("BG_INIT_INVALID: Invalid or duplicate background initialization.");ie=n.session,Fe((r,i)=>C("event",{event:r,value:ne(i)}));let o=he(n.viewport,n.viewport.dpr);G=We(n.canvas,o,()=>{xe++,Je||(Je=!0,C("first-frame",{frames:xe}),n.held===!0&&queueMicrotask(()=>G?.visibility(!1)));let r=performance.now();r-Qe>=1e3&&(Qe=r,C("sample",{frames:xe,at:r}))}),G.motion(n.reduced===!0),j=Ye(G.host,G.canvas,K(n.settings),r=>{r&&ae(r)});return}if(n.session!==ie||!Number.isSafeInteger(n.seq)||n.seq<=$e)return;if($e=n.seq,n.type==="state"){if(n.settings!==void 0){let o=K(n.settings);j.setSettings?j.setSettings(o):j.updateSettings?.(o)}if(n.viewport&&G?.viewport(he(n.viewport,n.viewport.dpr)),typeof n.reduced=="boolean"&&G?.motion(n.reduced),typeof n.visible=="boolean"&&G?.visibility(n.visible),n.input){let{type:o,...r}=n.input;if(!["pointermove","pointerdown","pointerup","pointercancel","pointerleave","wheel","keydown"].includes(o))throw Error("BG_INPUT_METHOD: Unsupported background input.");G?.input(o,K(r))}C("ack",{seq:n.seq});return}if(n.type==="replay"){j.replay?.(),C("ack",{seq:n.seq});return}if(n.type==="call"){if(typeof n.method!="string"||!Ke.includes(n.method)||!Array.isArray(n.args)||n.args.length>8||!Number.isSafeInteger(n.callId))throw Error("BG_KERNEL_COMMAND: The visual kernel command is not supported.");let o=ne(n.args);C("ack",{seq:n.seq}),Promise.resolve().then(()=>j[n.method](...o)).then(r=>C("result",{callId:n.callId,value:ne(r??null)}),r=>C("result",{callId:n.callId,error:String(r).slice(0,1500)}));return}if(n.type==="dispose"){Ze=!0;try{j?.dispose()}finally{G?.dispose(),C("disposed"),setTimeout(()=>J.close(),0)}return}throw Error("BG_WORKER_METHOD: Unsupported background command.")}catch(o){ae(o)}});})();
145
+ `,r,e,i,n)}},Q=Symbol.for("code-codex:background-modules:v1");(window[Q]??=new Map).set("ascii-tiles",{id:"ascii-tiles",api:1,version:"1.0.8",exports:{AsciiTilesRenderer:N},startup(r,e){let i=document.createElement("canvas");return i.style.cssText="width:100%;height:100%;display:block",r.append(i),new N(r,i,U(),e)}});})();
@@ -257,10 +257,10 @@ Nothing in this notice limits rights granted directly by an applicable license,
257
257
 
258
258
 
259
259
  */
260
- (()=>{var W=/(token|cookie|password|secret|credential|authorization|apikey)/i,X=/^(content|text|body|prompt|messages|title|filename|name|raw|data|database64|commandline|sessionid|accountid|threadid|projectid)$|(?:path|url|uri)$/i;function m(i){return i.slice(0,8e3).replace(/\b[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s"'<>]+/g,e=>{try{let n=new URL(e);if(["127.0.0.1","localhost","[::1]"].includes(n.hostname)&&!n.username&&!n.password&&["/json/version","/json/list","/"].includes(n.pathname))return`${n.origin}${n.pathname}`}catch{}return"[url]"}).replace(/(?:\b[A-Za-z]:[\\/]|\\\\|\/(?:Users|home|tmp|var|etc|opt|mnt)\/|~\/)[^\r\n"'<>]*/g,"[path]").replace(/\b(?:Bearer\s+\S+|(?:authorization|password|secret|(?:access[_-]?|refresh[_-]?)?token|api[_-]?key|cookie)\s*[:=]\s*[^,;\r\n]+)/gi,"[credential]").replace(/\bsk-[A-Za-z0-9_-]{8,}|\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,"[credential]").replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,"[email]").slice(0,4e3)+(i.length>8e3?" [truncated]":"")}function k(i){let t=256,e=new WeakSet,n=(o,a)=>{if(--t<0||a>6)return"[truncated]";if(typeof o=="string")return m(o);if(o===null||typeof o=="boolean"||typeof o=="number")return o;if(typeof o!="object")return"[unsupported]";if(e.has(o))return"[circular]";if(e.add(o),o instanceof Error)return{name:m(o.name),message:m(o.message)};if(Array.isArray(o))return o.slice(0,128).map(r=>n(r,a+1));let c=Object.create(null);for(let[r,l]of Object.entries(o).slice(0,128)){let u=r.replace(/[^a-z0-9]/gi,"");c[m(r).slice(0,160)]=W.test(u)||X.test(u)?"[redacted]":n(l,a+1)}return c};try{return n(i,0)}catch{return{redactionFailed:!0}}}var q=Symbol.for("code-codex:runtime-events:v1"),V=window,g=V[q]??={events:[],dropped:0};function D(i,t,e,n={}){let o={source:m(i).slice(0,160),action:m(t).slice(0,160),outcome:m(e).slice(0,160),details:{...k(n),observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}},a=new TextEncoder().encode(JSON.stringify(o)).length;a>7e3&&(o.details={truncated:!0,originalBytes:a,observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}),g.events.push(o),g.events.length>1e3&&(g.events.splice(0,200),g.dropped+=200)}var Y=Symbol.for("code-codex:background-startup-hold:v1");function x(){let i=window;return i[Y]??={active:!1,layers:new Set,next:-1,pending:new Map,painted:new WeakSet,openings:new WeakMap}}function K(i){return i.closest("[data-code-codex-particle-layer]")}function Z(i,t){t.native=requestAnimationFrame(e=>{let n=x();t.native=void 0,n.pending.has(i)&&(n.active&&n.painted.has(t.layer)||(n.pending.delete(i),n.active&&(n.painted.add(t.layer),n.layers.add(t.layer),D("background-opening","initial frame","prepared")),t.callback(e)))})}function _(i,t){let e=K(i);if(!e)return requestAnimationFrame(t);let n=x(),o=n.next--,a={layer:e,callback:t};return n.pending.set(o,a),Z(o,a),o}function M(i){if(i>=0){cancelAnimationFrame(i);return}let t=x(),e=t.pending.get(i);e?.native!==void 0&&cancelAnimationFrame(e.native),t.pending.delete(i)}var $="code-codex:aurora-ionosphere-background:v1";var fe=Object.freeze({distance:24,elevation:-5.5,azimuth:0,orbitSpeed:0,roll:-20,fov:42,diskInner:3,diskOuter:15,diskThickness:.26,diskDensity:1,brightness:1,spinSpeed:.06,grain:.48,doppler:.35,hotColor:"#FFF3DE",midColor:"#FF9838",coolColor:"#8E3A0B",starBrightness:0,glow:1,exposure:.9,vignette:.28,steps:200,resolution:.4,maxDpr:1,paused:!1}),me=Object.freeze({variant:"bottom",inertialWheel:!0,openingDuration:2,wheelSensitivity:1,wheelDownIntensity:.4,wheelUpIntensity:.8,wheelTravelScale:1,wheelDownDistance:100,wheelUpDistance:20,wheelUpTrailDistance:18,wheelUpTrailStrength:1.15,wheelUpStiffness:180,wheelUpDamping:48,wheelReleaseDelay:70,wheelUpReleaseDelay:80,maxReleaseVelocity:2.4,returnStiffness:180,returnDamping:14,initialStretch:1.8,initialBlur:0,rimColor:"#FFFFFF",violetColor:"#A558FB",blueColor:"#4922E5",shadowColor:"#000000"}),he=Object.freeze({low:Object.freeze({steps:56,resolutionScale:.56,maxDpr:1}),medium:Object.freeze({steps:76,resolutionScale:.72,maxDpr:1.25}),high:Object.freeze({steps:100,resolutionScale:.86,maxDpr:1.5})}),pe=Object.freeze({quality:"high",speed:.72,intensity:1.15,turbulence:1,radius:3,colorShift:0,pointerInfluence:.45,introDuration:2.2,introFeather:.22,paused:!1}),v=Object.freeze({low:Object.freeze({steps:32,rayScale:.72,maxDpr:1.1,minAdaptiveScale:.92,noiseAtlasSize:512}),medium:Object.freeze({steps:50,rayScale:.76,maxDpr:1.25,minAdaptiveScale:.9,noiseAtlasSize:768}),high:Object.freeze({steps:72,rayScale:.82,maxDpr:1.4,minAdaptiveScale:.9,noiseAtlasSize:1024})}),F=Object.freeze({hue:0,saturation:1,quality:"medium",speed:1,intensity:1,curtainScale:.5,turbulence:.58,glow:.72,starDensity:.56,introDuration:2.4,introFeather:.16,introStart:-.22,introEnd:1.32,introSkyEnd:.48,introStarStart:.34,paused:!1});function f(i,t,e,n){let o=typeof i=="number"?i:Number(i);return Number.isFinite(o)?Math.min(e,Math.max(t,o)):n}function E(i){let t=j(i)?i:{},e=F,n=t.quality==="low"||t.quality==="medium"||t.quality==="high"?t.quality:e.quality;return{hue:f(t.hue,-180,180,e.hue),saturation:f(t.saturation,0,2,e.saturation),quality:n,speed:f(t.speed,0,3,e.speed),intensity:f(t.intensity,0,3,e.intensity),curtainScale:f(t.curtainScale,.05,2,e.curtainScale),turbulence:f(t.turbulence,0,1.8,e.turbulence),glow:f(t.glow,0,2.4,e.glow),starDensity:f(t.starDensity,0,1.5,e.starDensity),introDuration:f(t.introDuration,.6,6,e.introDuration),introFeather:f(t.introFeather,.03,.4,e.introFeather),introStart:f(t.introStart,-.5,.25,e.introStart),introEnd:f(t.introEnd,.8,1.8,e.introEnd),introSkyEnd:f(t.introSkyEnd,.1,.9,e.introSkyEnd),introStarStart:f(t.introStarStart,0,.8,e.introStarStart),paused:typeof t.paused=="boolean"?t.paused:e.paused}}function C(){try{return E(JSON.parse(localStorage.getItem($)||"{}"))}catch{return{...F}}}function j(i){return i!==null&&typeof i=="object"}var ge=Object.freeze({top:{axis:"y",enter:-100,rest:-50},bottom:{axis:"y",enter:100,rest:50},left:{axis:"x",enter:100,rest:50},right:{axis:"x",enter:-100,rest:-50}});var Q=`
260
+ (()=>{var S=class{constructor(e){this.report=e;this.signal=this.#e.signal}#s=!1;#a=new Set;signal;#e=new AbortController;get disposed(){return this.#s}own(e){let t=!0,r=()=>{t&&(t=!1,this.#a.delete(r),e())};return this.#s?r():this.#a.add(r),r}listen(e,t,r,n){return this.#s?()=>{}:(e.addEventListener(t,r,n),this.own(()=>e.removeEventListener(t,r,n)))}dispose(){if(!this.#s){this.#s=!0,this.#e.abort();for(let e of[...this.#a].reverse())try{e()}catch(t){try{this.report(t)}catch{}}}}};function F(o){let e=0,t=0,r=0,n=(a,c)=>{if(++t>8192||c>10)throw Error("BG_ASSET_SHAPE: Visual asset structure exceeds its budget.");if(ArrayBuffer.isView(a)){if((a instanceof Float32Array||a instanceof Float64Array)&&!a.every(Number.isFinite))throw Error("BG_ASSET_NUMBER: Prepared visual numbers must be finite.");if(e+=a.byteLength,e>32*1024*1024)throw Error("BG_ASSET_SIZE: Prepared visual assets exceed 32 MiB.");return a}if(Array.isArray(a))return a.map(d=>n(d,c+1));if(a&&typeof a=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(a))){let d={};for(let[f,x]of Object.entries(a)){if(b({[f]:null}),r+=new TextEncoder().encode(f).length+4,r>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");d[f]=n(x,c+1)}return d}let l=b(a);if(r+=new TextEncoder().encode(JSON.stringify(l)).length,r>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");return l};return n(o,0)}function b(o){let e=0,t=(n,a)=>{if(++e>4096||a>8)throw Error("BG_STATE_LIMIT: Visual state exceeds the bounded schema.");if(n===null||typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n))throw Error("BG_STATE_NUMBER: Visual numbers must be finite.");return n}if(typeof n=="string"){if(n.length>1024)throw Error("BG_STATE_STRING: Visual strings must be bounded.");return n}if(Array.isArray(n))return n.map(c=>t(c,a+1));if(n&&typeof n=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(n))){let c={};for(let[l,d]of Object.entries(n)){if(/^(?:__proto__|constructor|prototype|token|accessToken|refreshToken|authorization|cookie|bridge|conversation|history|source|url|path)$/i.test(l))throw Error("BG_STATE_FIELD: Visual state contains an unsupported field.");d!==void 0&&(c[l]=t(d,a+1))}return c}throw Error("BG_STATE_TYPE: Visual state must contain serializable visual values.")},r=t(o,0);if(new TextEncoder().encode(JSON.stringify(r)).length>65536)throw Error("BG_STATE_SIZE: Visual state exceeds the message budget.");return r}function _(o,e){if(![o.width,o.height,o.left,o.top,e].every(Number.isFinite)||o.width<0||o.height<0)throw Error("BG_VIEWPORT_INVALID: Invalid visual dimensions.");let t=Math.max(1,Math.min(8192,o.width)),r=Math.max(1,Math.min(8192,o.height)),n=Math.min(3,Math.max(.5,e),Math.sqrt(16777216/(t*r)));return{width:t,height:r,left:o.left,top:o.top,dpr:n}}var H=/(token|cookie|password|secret|credential|authorization|apikey)/i,G=/^(content|text|body|prompt|messages|title|filename|name|raw|data|database64|commandline|sessionid|accountid|threadid|projectid)$|(?:path|url|uri)$/i;function m(o){return o.slice(0,8e3).replace(/\b[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s"'<>]+/g,t=>{try{let r=new URL(t);if(["127.0.0.1","localhost","[::1]"].includes(r.hostname)&&!r.username&&!r.password&&["/json/version","/json/list","/"].includes(r.pathname))return`${r.origin}${r.pathname}`}catch{}return"[url]"}).replace(/(?:\b[A-Za-z]:[\\/]|\\\\|\/(?:Users|home|tmp|var|etc|opt|mnt)\/|~\/)[^\r\n"'<>]*/g,"[path]").replace(/\b(?:Bearer\s+\S+|(?:authorization|password|secret|(?:access[_-]?|refresh[_-]?)?token|api[_-]?key|cookie)\s*[:=]\s*[^,;\r\n]+)/gi,"[credential]").replace(/\bsk-[A-Za-z0-9_-]{8,}|\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,"[credential]").replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,"[email]").slice(0,4e3)+(o.length>8e3?" [truncated]":"")}function P(o){let e=256,t=new WeakSet,r=(n,a)=>{if(--e<0||a>6)return"[truncated]";if(typeof n=="string")return m(n);if(n===null||typeof n=="boolean"||typeof n=="number")return n;if(typeof n!="object")return"[unsupported]";if(t.has(n))return"[circular]";if(t.add(n),n instanceof Error)return{name:m(n.name),message:m(n.message)};if(Array.isArray(n))return n.slice(0,128).map(l=>r(l,a+1));let c=Object.create(null);for(let[l,d]of Object.entries(n).slice(0,128)){let f=l.replace(/[^a-z0-9]/gi,"");c[m(l).slice(0,160)]=H.test(f)||G.test(f)?"[redacted]":r(d,a+1)}return c};try{return r(o,0)}catch{return{redactionFailed:!0}}}var W=Symbol.for("code-codex:runtime-events:v1"),X=window,T=X[W]??={events:[],dropped:0};function v(o,e,t,r={}){let n={source:m(o).slice(0,160),action:m(e).slice(0,160),outcome:m(t).slice(0,160),details:{...P(r),observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}},a=new TextEncoder().encode(JSON.stringify(n)).length;a>7e3&&(n.details={truncated:!0,originalBytes:a,observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}),T.events.push(n),T.events.length>1e3&&(T.events.splice(0,200),T.dropped+=200)}var q=Symbol.for("code-codex:background-startup-hold:v1");function V(){let o=window;return o[q]??={active:!1,layers:new Set,next:-1,pending:new Map,painted:new WeakSet,openings:new WeakMap}}function Y(o){return o.closest("[data-code-codex-particle-layer]")}function w(o){return!!Y(o)&&V().active}var M=()=>{let o=window;return o[Symbol.for("code-codex:background-isolation:v1")]??=new Map},A=class{constructor(e,t,r,n,a,c=()=>{},l={}){this.host=r;this.onError=c;if(typeof Worker!="function"||typeof n.transferControlToOffscreen!="function")throw Error("BG_BACKEND_UNAVAILABLE: Independent background rendering is unavailable.");let d=b(a),f=_(r.getBoundingClientRect(),devicePixelRatio||1);this.#t={id:e,mode:"worker",phase:"preparing",frames:0,pending:0},M().set(this,this.#t),this.#e=new S(i=>v("background","resource release","failed",{id:e,error:String(i)})),this.ready=this.firstFrame=new Promise((i,s)=>{this.#s=i,this.#a=s}),this.ready.catch(()=>{}),this.#h=f;let x=URL.createObjectURL(new Blob([t],{type:"text/javascript"}));this.#e.own(()=>URL.revokeObjectURL(x));try{this.#p=new Worker(x,{name:"code-codex-background-"+e})}catch(i){throw this.#e.dispose(),M().delete(this),i}let E=this.#p,D=setTimeout(()=>this.#o("BG_FIRST_FRAME_TIMEOUT: The background did not produce a first frame within 15 seconds."),15e3);this.#e.own(()=>clearTimeout(D)),this.#e.listen(n,"webglcontextlost",i=>{i.preventDefault(),this.#o("BG_WORKER_CONTEXT_LOST: The transferred background graphics context was lost. Enable the background again to retry.")}),this.#e.listen(E,"error",i=>this.#o("BG_WORKER_ERROR: "+i.message)),this.#e.listen(E,"messageerror",()=>this.#o("BG_WORKER_PROTOCOL: The background response could not be decoded.")),this.#e.listen(E,"message",i=>{let s=i.data;if(!(this.#i||s?.v!==1||s.session!==this.#c)){if(s.type==="failed"){this.#o("BG_WORKER_RENDER_FAILED: "+String(s.message).slice(0,1500));return}if(s.type==="first-frame"&&!this.#d&&(this.#d=!0,this.#t.frames=s.frames??1,clearTimeout(D),this.#t.phase="running",this.#s(),this.#v(),v("background","isolated first frame","ready",{id:e,backend:"worker"})),s.type==="sample"&&Number.isSafeInteger(s.frames)&&(this.#t.frames=s.frames),s.type==="event"&&typeof s.event=="string"&&this.kernelEvent(s.event,s.value),s.type==="result"&&Number.isSafeInteger(s.callId)){let u=this.#l.get(s.callId);u&&(clearTimeout(u.timer),this.#l.delete(s.callId),s.error?u.reject(Error("BG_KERNEL_FAILED: "+String(s.error))):u.resolve(s.value))}s.type==="ack"&&s.seq===this.#u&&(clearTimeout(this.#g),this.#g=void 0,this.#u=0,this.#t.pending=0,this.#m())}});let I=new ResizeObserver(()=>{let i=_(this.host.getBoundingClientRect(),devicePixelRatio||1);JSON.stringify(i)!==JSON.stringify(this.#h)&&(this.#h=i,this.#f({viewport:i}))});I.observe(r),this.#e.own(()=>I.disconnect());let L=new IntersectionObserver(i=>{this.#b=i[0]?.isIntersecting??!0,this.#v()});L.observe(r),this.#e.own(()=>L.disconnect());let k=matchMedia("(prefers-reduced-motion: reduce)");this.#e.listen(k,"change",()=>this.#f({reduced:k.matches})),this.#e.listen(document,"visibilitychange",()=>this.#v()),this.#e.listen(window,"code-codex:background-hold-changed",()=>this.#v()),this.#e.listen(window,"pagehide",()=>this.dispose());let N=i=>{if(!this.#d||this.#i||l.interactive===!1||!["pointerup","pointercancel"].includes(i.type)&&i.composedPath().some(y=>y instanceof Element&&y.matches('button,a,input,textarea,select,[contenteditable],dialog,[role="menu"],[role="menubar"],[popover]')))return;let s=i,u=this.#h;if(i instanceof PointerEvent&&!["pointermove","pointerleave","pointerup","pointercancel"].includes(i.type)&&(s.clientX<u.left||s.clientX>u.left+u.width||s.clientY<u.top||s.clientY>u.top+u.height))return;let g={type:i.type};if(i instanceof PointerEvent)Object.assign(g,{clientX:s.clientX,clientY:s.clientY,pointerId:s.pointerId,button:s.button,buttons:s.buttons,isPrimary:s.isPrimary,pointerType:s.pointerType});else if(i instanceof WheelEvent){let y=this.#r.find(p=>p.type==="state"&&p.input?.type==="wheel");if(y){let p=y.input;p.deltaX=Math.max(-1e4,Math.min(1e4,p.deltaX+i.deltaX)),p.deltaY=Math.max(-1e4,Math.min(1e4,p.deltaY+i.deltaY));return}Object.assign(g,{deltaX:i.deltaX,deltaY:i.deltaY,deltaMode:i.deltaMode,clientX:i.clientX,clientY:i.clientY})}else i instanceof KeyboardEvent&&Object.assign(g,{repeat:i.repeat,isComposing:i.isComposing,altKey:i.altKey,ctrlKey:i.ctrlKey,metaKey:i.metaKey,shiftKey:i.shiftKey,key:"",code:""});i.type==="pointermove"?((s.clientX<u.left||s.clientX>u.left+u.width||s.clientY<u.top||s.clientY>u.top+u.height)&&(g.type="pointerleave"),this.#f({input:g})):this.#r.length<8?(this.#r.push({type:"state",input:g}),this.#m()):this.#o("BG_INPUT_QUEUE_FULL: Background input exceeded the bounded discrete-event queue.")};for(let i of["pointermove","pointerleave","pointerdown","pointerup","pointercancel","wheel","keydown"])this.#e.listen(window,i,N,{passive:!0});try{let i=n.transferControlToOffscreen();E.postMessage({v:1,session:this.#c,type:"init",canvas:i,settings:d,viewport:this.#h,reduced:k.matches,held:w(r)},[i])}catch(i){this.#o("BG_CANVAS_TRANSFER: "+String(i))}}ready;firstFrame;#s;#a;#e;#p;#c=crypto.randomUUID();#y=0;#u=0;#n;#r=[];#l=new Map;#x=0;#d=!1;#i=!1;#b=!0;#h;#g;#t;get diagnostics(){return{...this.#t}}setSettings(e){this.#f({settings:b(e)})}updateSettings(e){this.setSettings(e)}replay(){if(!this.#i){if(this.#r.length>=8)throw Error("BG_COMMAND_QUEUE_FULL: Wait for the pending visual command.");this.#r.push({type:"replay"}),this.#m()}}kernelEvent(e,t){}activityChanged(e){}call(e,t=[],r=3e4){if(this.#i)return Promise.reject(Error("BG_KERNEL_DISPOSED: The visual worker has been retired."));if(this.#l.size>=8||this.#r.length>=8)return Promise.reject(Error("BG_COMMAND_QUEUE_FULL: Wait for the pending visual command."));let n=F(t),a=++this.#x,c=new Promise((l,d)=>{let f=setTimeout(()=>{this.#l.delete(a),d(Error("BG_KERNEL_TIMEOUT: The visual command did not confirm completion. It was not replayed."))},r);this.#l.set(a,{resolve:l,reject:d,timer:f})});return this.#r.push({type:"call",method:e,args:n,callId:a}),this.#m(),c}resumeOpening(){this.replay()}#v=()=>{let e=!document.hidden&&this.#b&&(!this.#d||!w(this.host));this.#f({visible:e}),this.activityChanged(e)};#f(e){this.#i||(this.#n={...this.#n,...e},this.#m())}#m(){if(this.#i||this.#u)return;let e;if(this.#n&&["settings","viewport","visible","reduced"].some(t=>t in this.#n)){let{input:t,...r}=this.#n;e={type:"state",...r},this.#n=t?{input:t}:void 0}else if(this.#r.length)e=this.#r.shift();else if(this.#n)e={type:"state",...this.#n},this.#n=void 0;else return;this.#u=++this.#y,this.#t.pending=1;try{this.#p.postMessage({v:1,session:this.#c,seq:this.#u,...e})}catch(t){this.#o("BG_WORKER_SEND_FAILED: "+String(t));return}this.#g=setTimeout(()=>this.#o("BG_WORKER_ACK_TIMEOUT: The visual worker stopped acknowledging bounded updates."),5e3)}#o(e){if(!this.#i){this.#t.phase="failed",this.#t.error=e,this.#a(Error(e)),v("background","visual worker","failed",{id:this.#t.id,session:this.#c,sequence:this.#y,pending:this.#u,message:e});try{this.onError(e)}finally{this.dispose()}}}dispose(){if(this.#i)return;this.#i=!0,this.#e.dispose(),clearTimeout(this.#g),this.#n=void 0,this.#r=[],this.#d||this.#a(new DOMException("Background preparation was cancelled.","AbortError"));for(let l of this.#l.values())clearTimeout(l.timer),l.reject(new DOMException("Background command was cancelled.","AbortError"));this.#l.clear();let e=this.#p,t=this.#c,r=++this.#y;this.#t.phase="disposing";let n=!1,a=()=>{n||(n=!0,clearTimeout(c),e.terminate(),M().delete(this))},c=setTimeout(()=>{v("background","worker disposal","unconfirmed",{id:this.#t.id,timeoutMs:1500}),a()},1500);e.addEventListener("message",l=>{l.data?.session===t&&l.data?.type==="disposed"&&a()});try{e.postMessage({v:1,session:t,seq:r,type:"dispose"})}catch{a()}}};var j="code-codex:aurora-ionosphere-background:v1";var be=Object.freeze({distance:24,elevation:-5.5,azimuth:0,orbitSpeed:0,roll:-20,fov:42,diskInner:3,diskOuter:15,diskThickness:.26,diskDensity:1,brightness:1,spinSpeed:.06,grain:.48,doppler:.35,hotColor:"#FFF3DE",midColor:"#FF9838",coolColor:"#8E3A0B",starBrightness:0,glow:1,exposure:.9,vignette:.28,steps:200,resolution:.4,maxDpr:1,paused:!1}),xe=Object.freeze({variant:"bottom",inertialWheel:!0,openingDuration:2,wheelSensitivity:1,wheelDownIntensity:.4,wheelUpIntensity:.8,wheelTravelScale:1,wheelDownDistance:100,wheelUpDistance:20,wheelUpTrailDistance:18,wheelUpTrailStrength:1.15,wheelUpStiffness:180,wheelUpDamping:48,wheelReleaseDelay:70,wheelUpReleaseDelay:80,maxReleaseVelocity:2.4,returnStiffness:180,returnDamping:14,initialStretch:1.8,initialBlur:0,rimColor:"#FFFFFF",violetColor:"#A558FB",blueColor:"#4922E5",shadowColor:"#000000"}),Ee=Object.freeze({low:Object.freeze({steps:56,resolutionScale:.56,maxDpr:1}),medium:Object.freeze({steps:76,resolutionScale:.72,maxDpr:1.25}),high:Object.freeze({steps:100,resolutionScale:.86,maxDpr:1.5})}),Se=Object.freeze({quality:"high",speed:.72,intensity:1.15,turbulence:1,radius:3,colorShift:0,pointerInfluence:.45,introDuration:2.2,introFeather:.22,paused:!1}),Te=Object.freeze({low:Object.freeze({steps:32,rayScale:.72,maxDpr:1.1,minAdaptiveScale:.92,noiseAtlasSize:512}),medium:Object.freeze({steps:50,rayScale:.76,maxDpr:1.25,minAdaptiveScale:.9,noiseAtlasSize:768}),high:Object.freeze({steps:72,rayScale:.82,maxDpr:1.4,minAdaptiveScale:.9,noiseAtlasSize:1024})}),U=Object.freeze({hue:0,saturation:1,quality:"medium",speed:1,intensity:1,curtainScale:.5,turbulence:.58,glow:.72,starDensity:.56,introDuration:2.4,introFeather:.16,introStart:-.22,introEnd:1.32,introSkyEnd:.48,introStarStart:.34,paused:!1});function h(o,e,t,r){let n=typeof o=="number"?o:Number(o);return Number.isFinite(n)?Math.min(t,Math.max(e,n)):r}function K(o){let e=Z(o)?o:{},t=U,r=e.quality==="low"||e.quality==="medium"||e.quality==="high"?e.quality:t.quality;return{hue:h(e.hue,-180,180,t.hue),saturation:h(e.saturation,0,2,t.saturation),quality:r,speed:h(e.speed,0,3,t.speed),intensity:h(e.intensity,0,3,t.intensity),curtainScale:h(e.curtainScale,.05,2,t.curtainScale),turbulence:h(e.turbulence,0,1.8,t.turbulence),glow:h(e.glow,0,2.4,t.glow),starDensity:h(e.starDensity,0,1.5,t.starDensity),introDuration:h(e.introDuration,.6,6,t.introDuration),introFeather:h(e.introFeather,.03,.4,t.introFeather),introStart:h(e.introStart,-.5,.25,t.introStart),introEnd:h(e.introEnd,.8,1.8,t.introEnd),introSkyEnd:h(e.introSkyEnd,.1,.9,t.introSkyEnd),introStarStart:h(e.introStarStart,0,.8,t.introStarStart),paused:typeof e.paused=="boolean"?e.paused:t.paused}}function B(){try{return K(JSON.parse(localStorage.getItem(j)||"{}"))}catch{return{...U}}}function Z(o){return o!==null&&typeof o=="object"}var we=Object.freeze({top:{axis:"y",enter:-100,rest:-50},bottom:{axis:"y",enter:100,rest:50},left:{axis:"x",enter:100,rest:50},right:{axis:"x",enter:-100,rest:-50}});var Re=Object.freeze({quality:"medium",speed:.35,amplitude:1,frequency:1,zoom:1,rotation:0,exposure:1,timeOffset:5.07,introDuration:2.8,introFeather:.18,introAngle:32,introZoom:.16,introEnabled:!0,paused:!1,colors:Object.freeze(["#d81159","#8f2d56","#218380","#fbb13c","#73d2de"])});var Ae=Object.freeze([.72,.46]),ke=Math.PI/180;var C=class extends A{constructor(o,e,t,r){super("aurora-ionosphere",`"use strict";(()=>{globalThis.window=globalThis;function K(i,e,t){let n=globalThis,r=e,a=!0,d=!1,o=new Set,s=new Set,f=new EventTarget,u=Object.assign(new EventTarget,{matches:!1,media:"(prefers-reduced-motion: reduce)"}),h=()=>({...r,x:r.left,y:r.top,right:r.left+r.width,bottom:r.top+r.height,toJSON(){return this}}),m=Object.assign(new EventTarget,{getBoundingClientRect:h,closest:()=>null,style:{setProperty(){},removeProperty(){}},dataset:{},contains:()=>!1}),b=new Map,I={},A=new Proxy(i,{get(l,c){if(c==="getBoundingClientRect")return h;if(c==="clientWidth"||c==="offsetWidth")return r.width;if(c==="clientHeight"||c==="offsetHeight")return r.height;if(c==="closest")return()=>null;if(c==="parentElement")return m;if(c==="setPointerCapture"||c==="releasePointerCapture"||c==="replaceWith")return()=>{};if(c==="style")return m.style;if(c==="dataset")return I;if(c==="getContext")return(E,w)=>{if(b.has(E))return b.get(E);let _=l.getContext(E,w);if(!_)return null;let M=null,N=new Map,Y=new Proxy(_,{get(D,x){let G=Reflect.get(D,x,D);return typeof G!="function"?G:(N.has(x)||N.set(x,(...P)=>{let ce=Reflect.apply(G,D,P);return x==="bindFramebuffer"&&(P[0]===D.FRAMEBUFFER||P[0]===D.DRAW_FRAMEBUFFER)&&(M=P[1]),(x==="drawArrays"||x==="drawElements"||x==="drawArraysInstanced"||x==="drawElementsInstanced")&&M===null&&t(),ce}),N.get(x))}});return b.set(E,Y),Y};let g=Reflect.get(l,c,l);return typeof g=="function"?g.bind(l):g},set(l,c,g){return Reflect.set(l,c,g,l)}});Object.defineProperties(m,{clientWidth:{get:()=>r.width},clientHeight:{get:()=>r.height}});let F=Object.assign(f,{get hidden(){return!a},get visibilityState(){return a?"visible":"hidden"}});Object.defineProperties(F,{hidden:{get:()=>!a},visibilityState:{get:()=>a?"visible":"hidden"}}),n.window=n,n.document=F,n.matchMedia=()=>u,n.Element=class extends EventTarget{},Object.defineProperties(n,{innerWidth:{configurable:!0,get:()=>r.width},innerHeight:{configurable:!0,get:()=>r.height},devicePixelRatio:{configurable:!0,get:()=>r.dpr}}),n.ResizeObserver=class{constructor(l){this.callback=l;o.add(this)}observe(){this.callback([{target:m,contentRect:h()}])}disconnect(){o.delete(this)}},n.IntersectionObserver=class{constructor(l){this.callback=l;s.add(this)}observe(){this.callback([{target:m,isIntersecting:a,intersectionRatio:a?1:0}])}disconnect(){s.delete(this)}};let k=(l,c)=>{let g=new Event(l);for(let[E,w]of Object.entries(c))Object.defineProperty(g,E,{value:w});return g};return{host:m,canvas:A,viewport(l){r=l;for(let c of o)c.callback([{target:m,contentRect:h()}]);n.dispatchEvent(new Event("resize"))},visibility(l){if(a!==l){a=l,f.dispatchEvent(new Event("visibilitychange"));for(let c of s)c.callback([{target:m,isIntersecting:l,intersectionRatio:l?1:0}])}},motion(l){d!==l&&(d=l,u.matches=l,u.dispatchEvent(new Event("change")))},input(l,c){n.dispatchEvent(k(l,c)),m.dispatchEvent(k(l,c)),i.dispatchEvent(k(l,c))},dispose(){o.clear(),s.clear();for(let l of b.values())try{l.getExtension("WEBGL_lose_context")?.loseContext()}catch{}b.clear()}}}function C(i){let e=0,t=0,n=0,r=(a,d)=>{if(++t>8192||d>10)throw Error("BG_ASSET_SHAPE: Visual asset structure exceeds its budget.");if(ArrayBuffer.isView(a)){if((a instanceof Float32Array||a instanceof Float64Array)&&!a.every(Number.isFinite))throw Error("BG_ASSET_NUMBER: Prepared visual numbers must be finite.");if(e+=a.byteLength,e>32*1024*1024)throw Error("BG_ASSET_SIZE: Prepared visual assets exceed 32 MiB.");return a}if(Array.isArray(a))return a.map(s=>r(s,d+1));if(a&&typeof a=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(a))){let s={};for(let[f,u]of Object.entries(a)){if(R({[f]:null}),n+=new TextEncoder().encode(f).length+4,n>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");s[f]=r(u,d+1)}return s}let o=R(a);if(n+=new TextEncoder().encode(JSON.stringify(o)).length,n>65536)throw Error("BG_ASSET_METADATA: Visual asset metadata exceeds 64 KiB.");return o};return r(i,0)}function R(i){let e=0,t=(r,a)=>{if(++e>4096||a>8)throw Error("BG_STATE_LIMIT: Visual state exceeds the bounded schema.");if(r===null||typeof r=="boolean")return r;if(typeof r=="number"){if(!Number.isFinite(r))throw Error("BG_STATE_NUMBER: Visual numbers must be finite.");return r}if(typeof r=="string"){if(r.length>1024)throw Error("BG_STATE_STRING: Visual strings must be bounded.");return r}if(Array.isArray(r))return r.map(d=>t(d,a+1));if(r&&typeof r=="object"&&[Object.prototype,null].includes(Object.getPrototypeOf(r))){let d={};for(let[o,s]of Object.entries(r)){if(/^(?:__proto__|constructor|prototype|token|accessToken|refreshToken|authorization|cookie|bridge|conversation|history|source|url|path)$/i.test(o))throw Error("BG_STATE_FIELD: Visual state contains an unsupported field.");s!==void 0&&(d[o]=t(s,a+1))}return d}throw Error("BG_STATE_TYPE: Visual state must contain serializable visual values.")},n=t(i,0);if(new TextEncoder().encode(JSON.stringify(n)).length>65536)throw Error("BG_STATE_SIZE: Visual state exceeds the message budget.");return n}function W(i,e){if(![i.width,i.height,i.left,i.top,e].every(Number.isFinite)||i.width<0||i.height<0)throw Error("BG_VIEWPORT_INVALID: Invalid visual dimensions.");let t=Math.max(1,Math.min(8192,i.width)),n=Math.max(1,Math.min(8192,i.height)),r=Math.min(3,Math.max(.5,e),Math.sqrt(16777216/(t*n)));return{width:t,height:n,left:i.left,top:i.top,dpr:r}}var de=()=>{};function j(i){de=i}var fe=/(token|cookie|password|secret|credential|authorization|apikey)/i,he=/^(content|text|body|prompt|messages|title|filename|name|raw|data|database64|commandline|sessionid|accountid|threadid|projectid)$|(?:path|url|uri)$/i;function S(i){return i.slice(0,8e3).replace(/\\b[A-Za-z][A-Za-z0-9+.-]*:\\/\\/[^\\s"'<>]+/g,t=>{try{let n=new URL(t);if(["127.0.0.1","localhost","[::1]"].includes(n.hostname)&&!n.username&&!n.password&&["/json/version","/json/list","/"].includes(n.pathname))return\`\${n.origin}\${n.pathname}\`}catch{}return"[url]"}).replace(/(?:\\b[A-Za-z]:[\\\\/]|\\\\\\\\|\\/(?:Users|home|tmp|var|etc|opt|mnt)\\/|~\\/)[^\\r\\n"'<>]*/g,"[path]").replace(/\\b(?:Bearer\\s+\\S+|(?:authorization|password|secret|(?:access[_-]?|refresh[_-]?)?token|api[_-]?key|cookie)\\s*[:=]\\s*[^,;\\r\\n]+)/gi,"[credential]").replace(/\\bsk-[A-Za-z0-9_-]{8,}|\\beyJ[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+/g,"[credential]").replace(/\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b/g,"[email]").slice(0,4e3)+(i.length>8e3?" [truncated]":"")}function Z(i){let e=256,t=new WeakSet,n=(r,a)=>{if(--e<0||a>6)return"[truncated]";if(typeof r=="string")return S(r);if(r===null||typeof r=="boolean"||typeof r=="number")return r;if(typeof r!="object")return"[unsupported]";if(t.has(r))return"[circular]";if(t.add(r),r instanceof Error)return{name:S(r.name),message:S(r.message)};if(Array.isArray(r))return r.slice(0,128).map(o=>n(o,a+1));let d=Object.create(null);for(let[o,s]of Object.entries(r).slice(0,128)){let f=o.replace(/[^a-z0-9]/gi,"");d[S(o).slice(0,160)]=fe.test(f)||he.test(f)?"[redacted]":n(s,a+1)}return d};try{return n(i,0)}catch{return{redactionFailed:!0}}}var me=Symbol.for("code-codex:runtime-events:v1"),pe=window,B=pe[me]??={events:[],dropped:0};function $(i,e,t,n={}){let r={source:S(i).slice(0,160),action:S(e).slice(0,160),outcome:S(t).slice(0,160),details:{...Z(n),observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}},a=new TextEncoder().encode(JSON.stringify(r)).length;a>7e3&&(r.details={truncated:!0,originalBytes:a,observedAt:Date.now(),documentElapsedMs:Math.round(performance.now())}),B.events.push(r),B.events.length>1e3&&(B.events.splice(0,200),B.dropped+=200)}var ge=Symbol.for("code-codex:background-startup-hold:v1");function X(){let i=window;return i[ge]??={active:!1,layers:new Set,next:-1,pending:new Map,painted:new WeakSet,openings:new WeakMap}}function ve(i){return i.closest("[data-code-codex-particle-layer]")}function ye(i,e){e.native=requestAnimationFrame(t=>{let n=X();e.native=void 0,n.pending.has(i)&&(n.active&&n.painted.has(e.layer)||(n.pending.delete(i),n.active&&(n.painted.add(e.layer),n.layers.add(e.layer),$("background-opening","initial frame","prepared")),e.callback(t)))})}function J(i,e){let t=ve(i);if(!t)return requestAnimationFrame(e);let n=X(),r=n.next--,a={layer:t,callback:e};return n.pending.set(r,a),ye(r,a),r}function Q(i){if(i>=0){cancelAnimationFrame(i);return}let e=X(),t=e.pending.get(i);t?.native!==void 0&&cancelAnimationFrame(t.native),e.pending.delete(i)}var Xe=Object.freeze({distance:24,elevation:-5.5,azimuth:0,orbitSpeed:0,roll:-20,fov:42,diskInner:3,diskOuter:15,diskThickness:.26,diskDensity:1,brightness:1,spinSpeed:.06,grain:.48,doppler:.35,hotColor:"#FFF3DE",midColor:"#FF9838",coolColor:"#8E3A0B",starBrightness:0,glow:1,exposure:.9,vignette:.28,steps:200,resolution:.4,maxDpr:1,paused:!1}),qe=Object.freeze({variant:"bottom",inertialWheel:!0,openingDuration:2,wheelSensitivity:1,wheelDownIntensity:.4,wheelUpIntensity:.8,wheelTravelScale:1,wheelDownDistance:100,wheelUpDistance:20,wheelUpTrailDistance:18,wheelUpTrailStrength:1.15,wheelUpStiffness:180,wheelUpDamping:48,wheelReleaseDelay:70,wheelUpReleaseDelay:80,maxReleaseVelocity:2.4,returnStiffness:180,returnDamping:14,initialStretch:1.8,initialBlur:0,rimColor:"#FFFFFF",violetColor:"#A558FB",blueColor:"#4922E5",shadowColor:"#000000"}),Ve=Object.freeze({low:Object.freeze({steps:56,resolutionScale:.56,maxDpr:1}),medium:Object.freeze({steps:76,resolutionScale:.72,maxDpr:1.25}),high:Object.freeze({steps:100,resolutionScale:.86,maxDpr:1.5})}),Ye=Object.freeze({quality:"high",speed:.72,intensity:1.15,turbulence:1,radius:3,colorShift:0,pointerInfluence:.45,introDuration:2.2,introFeather:.22,paused:!1}),U=Object.freeze({low:Object.freeze({steps:32,rayScale:.72,maxDpr:1.1,minAdaptiveScale:.92,noiseAtlasSize:512}),medium:Object.freeze({steps:50,rayScale:.76,maxDpr:1.25,minAdaptiveScale:.9,noiseAtlasSize:768}),high:Object.freeze({steps:72,rayScale:.82,maxDpr:1.4,minAdaptiveScale:.9,noiseAtlasSize:1024})}),be=Object.freeze({hue:0,saturation:1,quality:"medium",speed:1,intensity:1,curtainScale:.5,turbulence:.58,glow:.72,starDensity:.56,introDuration:2.4,introFeather:.16,introStart:-.22,introEnd:1.32,introSkyEnd:.48,introStarStart:.34,paused:!1});function p(i,e,t,n){let r=typeof i=="number"?i:Number(i);return Number.isFinite(r)?Math.min(t,Math.max(e,r)):n}function ee(i){let e=xe(i)?i:{},t=be,n=e.quality==="low"||e.quality==="medium"||e.quality==="high"?e.quality:t.quality;return{hue:p(e.hue,-180,180,t.hue),saturation:p(e.saturation,0,2,t.saturation),quality:n,speed:p(e.speed,0,3,t.speed),intensity:p(e.intensity,0,3,t.intensity),curtainScale:p(e.curtainScale,.05,2,t.curtainScale),turbulence:p(e.turbulence,0,1.8,t.turbulence),glow:p(e.glow,0,2.4,t.glow),starDensity:p(e.starDensity,0,1.5,t.starDensity),introDuration:p(e.introDuration,.6,6,t.introDuration),introFeather:p(e.introFeather,.03,.4,t.introFeather),introStart:p(e.introStart,-.5,.25,t.introStart),introEnd:p(e.introEnd,.8,1.8,t.introEnd),introSkyEnd:p(e.introSkyEnd,.1,.9,t.introSkyEnd),introStarStart:p(e.introStarStart,0,.8,t.introStarStart),paused:typeof e.paused=="boolean"?e.paused:t.paused}}function xe(i){return i!==null&&typeof i=="object"}var Ke=Object.freeze({top:{axis:"y",enter:-100,rest:-50},bottom:{axis:"y",enter:100,rest:50},left:{axis:"x",enter:100,rest:50},right:{axis:"x",enter:-100,rest:-50}});var Ee=\`
261
261
  attribute vec2 aPosition;
262
262
  void main() { gl_Position = vec4(aPosition, 0.0, 1.0); }
263
- `,J=`
263
+ \`,Se=\`
264
264
  precision highp float;
265
265
  uniform vec2 uResolution;
266
266
  uniform vec2 uNoiseDomainMin;
@@ -315,9 +315,9 @@ void main() {
315
315
  float density = triNoise2d(worldPosition, flowRotation);
316
316
  gl_FragColor = vec4(density, density, density, 1.0);
317
317
  }
318
- `;function ee(i){return`
318
+ \`;function Te(i){return\`
319
319
  precision highp float;
320
- #define AURORA_STEPS ${i}
320
+ #define AURORA_STEPS \${i}
321
321
  uniform vec2 uResolution;
322
322
  uniform float uIntensity;
323
323
  uniform float uGlow;
@@ -380,7 +380,7 @@ void main() {
380
380
  * horizonFade * curtainReveal * curtainIgnition;
381
381
  gl_FragColor = field;
382
382
  }
383
- `}var te=`
383
+ \`}var we=\`
384
384
  precision highp float;
385
385
  #define STAR_LAYERS 4
386
386
  uniform vec2 uResolution;
@@ -438,4 +438,5 @@ void main() {
438
438
  color = color * (1.0 - field.a) + max(vec3(0.0), uAuroraColor * field.rgb);
439
439
  gl_FragColor = vec4(color, 1.0);
440
440
  }
441
- `;function S(i,t,e){let n=Math.min(1,Math.max(0,(e-i)/Math.max(1e-6,t-i)));return n*n*(3-2*n)}function L(i,t,e,n){let o=Math.round(Math.min(1,Math.max(0,n))*65535);i[t]=o>>8,i[e]=o&255}function I(i,t,e){let n=i/Math.max(1,t),o=[.8,.8+Math.pow(e-1,1.4)*.002],a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let d=0;d<=16;d+=1){let p=d/16*.55+.015;for(let y=0;y<=16;y+=1){let T=(y/16-.5)*n,b=Math.hypot(T,p,1.3),B=T/b,H=p/b,z=1.3/b,O=1/(H*2+.4);for(let N of o)for(let G of[0,.006]){let R=N*O-G,w=R*B,A=-6.7+R*z;a=Math.min(a,A),c=Math.max(c,A),r=Math.min(r,w),l=Math.max(l,w)}}}let u=Math.max(.08,(c-a)*.035),s=Math.max(.08,(l-r)*.035);return{minX:a-u,minY:r-s,sizeX:c-a+u*2,sizeY:l-r+s*2}}var h=class{#c;#e;#V;#a;#w;#s;#n;#r;#A;#k;#p;#g;#D;#_;#m;#i;#l;#v=0;#M=!0;#S=!0;#L=!document.hidden;#y=!0;#h=!0;#H=0;#E=0;#d=0;#I;#b=1;#x=1;#F=1;#C=1;#T=1;#R=1;#Y=1;#o;#u=1;#z=0;#P=0;#U={x:0,y:0};#B={x:.5,y:.5};#O=window.matchMedia("(prefers-reduced-motion: reduce)");#N;constructor(t,e,n,o){this.#V=t,this.#a=e,this.#c=E(n),this.#w=o,this.#I=t.getBoundingClientRect(),this.#o=I(1,1,v[this.#c.quality].steps);let a=e.getContext("webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1});if(!a)throw new Error("WebGL is unavailable for Aurora Ionosphere Background");this.#e=a,this.#X(),this.#N=new ResizeObserver(()=>{this.#I=this.#V.getBoundingClientRect(),this.#y=!0,this.#f()}),this.#N.observe(t),document.addEventListener("visibilitychange",this.#j),e.addEventListener("webglcontextlost",this.#Q),e.addEventListener("webglcontextrestored",this.#J),this.#O.addEventListener("change",this.#ee),this.#f()}setSettings(t){let e=E(t);e.quality!==this.#c.quality?(this.#c=e,this.#X(),this.#u=1,this.#y=!0):(this.#c=e,this.#h=!0),this.#f()}replay(){this.#E=0,this.#H=0,this.#d=0,this.#f()}dispose(){this.#M&&(this.#M=!1,this.#q(),this.#N.disconnect(),document.removeEventListener("visibilitychange",this.#j),this.#a.removeEventListener("webglcontextlost",this.#Q),this.#a.removeEventListener("webglcontextrestored",this.#J),this.#O.removeEventListener("change",this.#ee),this.#$())}#K(t,e){let n=this.#e.createShader(t);if(!n)throw new Error("The Aurora Ionosphere shader could not be allocated");if(this.#e.shaderSource(n,e),this.#e.compileShader(n),!this.#e.getShaderParameter(n,this.#e.COMPILE_STATUS)){let o=this.#e.getShaderInfoLog(n)||"Aurora Ionosphere shader compilation failed";throw this.#e.deleteShader(n),new Error(o)}return n}#G(t){let e=this.#K(this.#e.VERTEX_SHADER,Q),n=this.#K(this.#e.FRAGMENT_SHADER,t),o=this.#e.createProgram();if(!o)throw new Error("The Aurora Ionosphere shader program could not be allocated");if(this.#e.attachShader(o,e),this.#e.attachShader(o,n),this.#e.linkProgram(o),this.#e.deleteShader(e),this.#e.deleteShader(n),!this.#e.getProgramParameter(o,this.#e.LINK_STATUS)){let a=this.#e.getProgramInfoLog(o)||"Aurora Ionosphere shader linking failed";throw this.#e.deleteProgram(o),new Error(a)}return o}#t(t,e){let n=this.#e.getUniformLocation(t,e);if(n===null)throw new Error(`Missing Aurora Ionosphere shader uniform: ${e}`);return n}#W(t,e){let n=this.#e.createTexture();if(!n)throw new Error("The Aurora Ionosphere texture could not be allocated");return this.#e.activeTexture(this.#e.TEXTURE0+t),this.#e.bindTexture(this.#e.TEXTURE_2D,n),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_MIN_FILTER,e),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_MAG_FILTER,e),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_WRAP_S,this.#e.CLAMP_TO_EDGE),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_WRAP_T,this.#e.CLAMP_TO_EDGE),this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,1,1,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,null),n}#Z(t){let e=this.#e.createFramebuffer();if(!e)throw new Error("The Aurora Ionosphere framebuffer could not be allocated");return this.#e.bindFramebuffer(this.#e.FRAMEBUFFER,e),this.#e.framebufferTexture2D(this.#e.FRAMEBUFFER,this.#e.COLOR_ATTACHMENT0,this.#e.TEXTURE_2D,t,0),e}#te(t){let e=new Uint8Array(t*2*4);for(let o=0;o<t;o+=1){let a=o*.043,c=.8+Math.pow(o,1.4)*.002,r=S(0,15,o),l=[-1.15,1.5,-.2].map(p=>Math.sin(p+a)*.5+.5),u=Math.pow(2,-o*.065-2.5)*S(0,5,o),s=o*4,d=(t+o)*4;e[s]=Math.round((l[0]??0)*255),e[s+1]=Math.round((l[1]??0)*255),e[s+2]=Math.round((l[2]??0)*255),L(e,d,d+1,c/1.6),e[d+2]=Math.round(r*255),L(e,s+3,d+3,u/.15)}let n=this.#W(0,this.#e.NEAREST);return this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,t,2,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,e),n}#$(){this.#A&&this.#e.deleteBuffer(this.#A),this.#s&&this.#e.deleteProgram(this.#s),this.#n&&this.#e.deleteProgram(this.#n),this.#r&&this.#e.deleteProgram(this.#r),this.#k&&this.#e.deleteTexture(this.#k),this.#p&&this.#e.deleteTexture(this.#p),this.#g&&this.#e.deleteTexture(this.#g),this.#D&&this.#e.deleteFramebuffer(this.#D),this.#_&&this.#e.deleteFramebuffer(this.#_)}#X(){this.#$();let t=v[this.#c.quality];this.#s=this.#G(J),this.#n=this.#G(ee(t.steps)),this.#r=this.#G(te),this.#A=this.#e.createBuffer()??(()=>{throw new Error("The Aurora Ionosphere geometry buffer could not be allocated")})(),this.#e.bindBuffer(this.#e.ARRAY_BUFFER,this.#A),this.#e.bufferData(this.#e.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),this.#e.STATIC_DRAW);for(let e of[this.#s,this.#n,this.#r]){this.#e.useProgram(e);let n=this.#e.getAttribLocation(e,"aPosition");if(n<0)throw new Error("The Aurora Ionosphere position attribute is unavailable");this.#e.enableVertexAttribArray(n),this.#e.vertexAttribPointer(n,2,this.#e.FLOAT,!1,0,0)}this.#k=this.#te(t.steps),this.#p=this.#W(2,this.#e.LINEAR),this.#D=this.#Z(this.#p),this.#g=this.#W(1,this.#e.LINEAR),this.#_=this.#Z(this.#g),this.#e.bindFramebuffer(this.#e.FRAMEBUFFER,null),this.#m={resolution:this.#t(this.#s,"uResolution"),domainMin:this.#t(this.#s,"uNoiseDomainMin"),domainSize:this.#t(this.#s,"uNoiseDomainSize"),flowRotation:this.#t(this.#s,"uFlowRotation"),scale:this.#t(this.#s,"uNoiseScale"),turbulence:this.#t(this.#s,"uNoiseTurbulence")},this.#i={resolution:this.#t(this.#n,"uResolution"),intensity:this.#t(this.#n,"uIntensity"),glow:this.#t(this.#n,"uGlow"),intro:this.#t(this.#n,"uIntro"),introFeather:this.#t(this.#n,"uIntroFeather"),introStart:this.#t(this.#n,"uIntroStart"),introEnd:this.#t(this.#n,"uIntroEnd"),layerLut:this.#t(this.#n,"uLayerLut"),layerLutStep:this.#t(this.#n,"uLayerLutStep"),noiseAtlas:this.#t(this.#n,"uNoiseAtlas"),domainMin:this.#t(this.#n,"uNoiseDomainMin"),inverseDomainSize:this.#t(this.#n,"uNoiseDomainInverseSize")},this.#l={resolution:this.#t(this.#r,"uResolution"),starResolution:this.#t(this.#r,"uStarResolution"),starDensity:this.#t(this.#r,"uStarDensity"),intro:this.#t(this.#r,"uIntro"),introSkyEnd:this.#t(this.#r,"uIntroSkyEnd"),introStarStart:this.#t(this.#r,"uIntroStarStart"),fieldTexture:this.#t(this.#r,"uAuroraTexture"),color:this.#t(this.#r,"uAuroraColor"),uvScale:this.#t(this.#r,"uAuroraUvScale"),uvOffset:this.#t(this.#r,"uAuroraUvOffset")},this.#e.useProgram(this.#n),this.#e.uniform1i(this.#i.layerLut,0),this.#e.uniform1i(this.#i.noiseAtlas,2),this.#e.uniform1f(this.#i.layerLutStep,1/t.steps),this.#e.useProgram(this.#r),this.#e.uniform1i(this.#l.fieldTexture,1),this.#h=!0,this.#y=!0,this.#w(void 0)}#ne(){this.#y=!1;let t=v[this.#c.quality],e=Math.min(window.devicePixelRatio||1,t.maxDpr),n=Math.max(1,Math.floor(this.#I.width*e)),o=Math.max(1,Math.floor(this.#I.height*e));(this.#a.width!==n||this.#a.height!==o)&&(this.#a.width=n,this.#a.height=o),this.#Y=Math.max(1,n);let a=Math.max(1,Math.floor(n*t.rayScale)),c=Math.max(1,Math.floor(o*t.rayScale));(a!==this.#b||c!==this.#x)&&(this.#b=a,this.#x=c,this.#e.activeTexture(this.#e.TEXTURE1),this.#e.bindTexture(this.#e.TEXTURE_2D,this.#g),this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,this.#b,this.#x,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,null)),this.#o=I(n,o,t.steps);let r=Math.max(this.#o.sizeX,this.#o.sizeY),l=Math.min(t.noiseAtlasSize,this.#e.getParameter(this.#e.MAX_TEXTURE_SIZE)),u=Math.max(256,Math.round(l*this.#o.sizeX/r)),s=Math.max(256,Math.round(l*this.#o.sizeY/r));(u!==this.#T||s!==this.#R)&&(this.#T=u,this.#R=s,this.#e.activeTexture(this.#e.TEXTURE2),this.#e.bindTexture(this.#e.TEXTURE_2D,this.#p),this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,this.#T,this.#R,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,null)),this.#F=Math.max(1,Math.floor(this.#b*this.#u)),this.#C=Math.max(1,Math.floor(this.#x*this.#u)),this.#U.x=Math.max(0,this.#F-1)/this.#b,this.#U.y=Math.max(0,this.#C-1)/this.#x,this.#B.x=.5/this.#b,this.#B.y=.5/this.#x}#q(){this.#v&&M(this.#v),this.#v=0}#f(){!this.#v&&this.#M&&this.#S&&this.#L&&(this.#v=_(this.#a,this.#re))}#re=t=>{if(this.#v=0,!this.#M||!this.#S||!this.#L)return;this.#y&&this.#ne();let e=this.#c,n=this.#O.matches,o=this.#d?Math.min((t-this.#d)/1e3,.05):0;if(this.#d=t,e.paused||(this.#H+=o*(n?.16:1)),this.#E=n?1:Math.min(1,this.#E+o/Math.max(.1,e.introDuration)),!e.paused&&!n&&(this.#z+=o,this.#P+=1,this.#P>=30)){let l=v[e.quality],u=this.#z/this.#P,s=this.#u;u>1/52?this.#u=Math.max(l.minAdaptiveScale,this.#u-.04):u<1/58&&(this.#u=Math.min(1,this.#u+.02)),this.#z=0,this.#P=0,this.#u!==s&&(this.#y=!0)}let a=S(0,1,this.#E),c=this.#H*.06*e.speed,r=this.#e;if(r.bindFramebuffer(r.FRAMEBUFFER,this.#D),r.viewport(0,0,this.#T,this.#R),r.useProgram(this.#s),r.uniform2f(this.#m.resolution,this.#T,this.#R),r.uniform2f(this.#m.domainMin,this.#o.minX,this.#o.minY),r.uniform2f(this.#m.domainSize,this.#o.sizeX,this.#o.sizeY),r.uniform2f(this.#m.flowRotation,Math.cos(c),Math.sin(c)),this.#h&&(r.uniform1f(this.#m.scale,.6+.8*e.curtainScale),r.uniform1f(this.#m.turbulence,.3+1.2*e.turbulence)),r.drawArrays(r.TRIANGLES,0,3),r.bindFramebuffer(r.FRAMEBUFFER,this.#_),r.viewport(0,0,this.#F,this.#C),r.useProgram(this.#n),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.#k),r.activeTexture(r.TEXTURE2),r.bindTexture(r.TEXTURE_2D,this.#p),r.uniform2f(this.#i.resolution,this.#F,this.#C),r.uniform2f(this.#i.domainMin,this.#o.minX,this.#o.minY),r.uniform2f(this.#i.inverseDomainSize,1/this.#o.sizeX,1/this.#o.sizeY),r.uniform1f(this.#i.intro,a),this.#h&&(r.uniform1f(this.#i.intensity,e.intensity),r.uniform1f(this.#i.glow,e.glow),r.uniform1f(this.#i.introFeather,e.introFeather),r.uniform1f(this.#i.introStart,e.introStart),r.uniform1f(this.#i.introEnd,e.introEnd)),r.drawArrays(r.TRIANGLES,0,3),r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,this.#a.width,this.#a.height),r.useProgram(this.#r),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,this.#g),r.uniform2f(this.#l.resolution,this.#a.width,this.#a.height),r.uniform1f(this.#l.starResolution,this.#Y),r.uniform1f(this.#l.intro,a),r.uniform2f(this.#l.uvScale,this.#U.x,this.#U.y),r.uniform2f(this.#l.uvOffset,this.#B.x,this.#B.y),this.#h){r.uniform1f(this.#l.starDensity,e.starDensity);let l=e.hue*Math.PI/180,u=Math.cos(l)*e.saturation,s=(1-u)/3,d=Math.sin(l)*e.saturation/Math.sqrt(3);r.uniformMatrix3fv(this.#l.color,!1,new Float32Array([u+s,s+d,s-d,s-d,u+s,s+d,s+d,s-d,u+s])),r.uniform1f(this.#l.introSkyEnd,e.introSkyEnd),r.uniform1f(this.#l.introStarStart,e.introStarStart),this.#h=!1}r.drawArrays(r.TRIANGLES,0,3),!e.paused||this.#E<1?this.#f():this.#d=0};#j=()=>{this.#L=!document.hidden,this.#d=0,this.#L?this.#f():this.#q()};#Q=t=>{t.preventDefault(),this.#S=!1,this.#q(),this.#w("The Aurora Ionosphere graphics context was lost; waiting for recovery.")};#J=()=>{try{this.#S=!0,this.#X(),this.#u=1,this.#d=0,this.#f()}catch(t){this.#S=!1,this.#w(t instanceof Error?t.message:"The Aurora Ionosphere graphics context could not be restored")}};#ee=()=>{this.#h=!0,this.#d=0,this.#f()}},ve=Object.freeze({quality:"medium",speed:.35,amplitude:1,frequency:1,zoom:1,rotation:0,exposure:1,timeOffset:5.07,introDuration:2.8,introFeather:.18,introAngle:32,introZoom:.16,introEnabled:!0,paused:!1,colors:Object.freeze(["#d81159","#8f2d56","#218380","#fbb13c","#73d2de"])});var ye=Object.freeze([.72,.46]),be=Math.PI/180;var P=window,U=Symbol.for("code-codex:background-modules:v1"),ne=P[U]??(P[U]=new Map);ne.set("aurora-ionosphere",{id:"aurora-ionosphere",api:1,version:"1.0.0",exports:{AuroraIonosphereRenderer:h},startup(i,t){let e=document.createElement("canvas");return e.style.cssText="width:100%;height:100%;display:block",i.append(e),new h(i,e,{...C(),paused:!1},t)}});})();
441
+ \`;function q(i,e,t){let n=Math.min(1,Math.max(0,(t-i)/Math.max(1e-6,e-i)));return n*n*(3-2*n)}function te(i,e,t,n){let r=Math.round(Math.min(1,Math.max(0,n))*65535);i[e]=r>>8,i[t]=r&255}function ne(i,e,t){let n=i/Math.max(1,e),r=[.8,.8+Math.pow(t-1,1.4)*.002],a=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(let h=0;h<=16;h+=1){let m=h/16*.55+.015;for(let b=0;b<=16;b+=1){let I=(b/16-.5)*n,A=Math.hypot(I,m,1.3),F=I/A,k=m/A,l=1.3/A,c=1/(k*2+.4);for(let g of r)for(let E of[0,.006]){let w=g*c-E,_=w*F,M=-6.7+w*l;a=Math.min(a,M),d=Math.max(d,M),o=Math.min(o,_),s=Math.max(s,_)}}}let f=Math.max(.08,(d-a)*.035),u=Math.max(.08,(s-o)*.035);return{minX:a-f,minY:o-u,sizeX:d-a+f*2,sizeY:s-o+u*2}}var H=class{#c;#e;#V;#a;#R;#s;#n;#r;#A;#k;#p;#g;#_;#M;#h;#i;#l;#v=0;#D=!0;#E=!0;#L=!document.hidden;#y=!0;#m=!0;#H=0;#S=0;#d=0;#I;#b=1;#x=1;#F=1;#P=1;#T=1;#w=1;#Y=1;#o;#u=1;#O=0;#C=0;#B={x:0,y:0};#U={x:.5,y:.5};#z=window.matchMedia("(prefers-reduced-motion: reduce)");#N;constructor(e,t,n,r){this.#V=e,this.#a=t,this.#c=ee(n),this.#R=r,this.#I=e.getBoundingClientRect(),this.#o=ne(1,1,U[this.#c.quality].steps);let a=t.getContext("webgl",{alpha:!1,antialias:!1,depth:!1,stencil:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1});if(!a)throw new Error("WebGL is unavailable for Aurora Ionosphere Background");this.#e=a,this.#X(),this.#N=new ResizeObserver(()=>{this.#I=this.#V.getBoundingClientRect(),this.#y=!0,this.#f()}),this.#N.observe(e),document.addEventListener("visibilitychange",this.#$),t.addEventListener("webglcontextlost",this.#J),t.addEventListener("webglcontextrestored",this.#Q),this.#z.addEventListener("change",this.#ee),this.#f()}setSettings(e){let t=ee(e);t.quality!==this.#c.quality?(this.#c=t,this.#X(),this.#u=1,this.#y=!0):(this.#c=t,this.#m=!0),this.#f()}replay(){this.#S=0,this.#H=0,this.#d=0,this.#f()}dispose(){this.#D&&(this.#D=!1,this.#q(),this.#N.disconnect(),document.removeEventListener("visibilitychange",this.#$),this.#a.removeEventListener("webglcontextlost",this.#J),this.#a.removeEventListener("webglcontextrestored",this.#Q),this.#z.removeEventListener("change",this.#ee),this.#Z())}#K(e,t){let n=this.#e.createShader(e);if(!n)throw new Error("The Aurora Ionosphere shader could not be allocated");if(this.#e.shaderSource(n,t),this.#e.compileShader(n),!this.#e.getShaderParameter(n,this.#e.COMPILE_STATUS)){let r=this.#e.getShaderInfoLog(n)||"Aurora Ionosphere shader compilation failed";throw this.#e.deleteShader(n),new Error(r)}return n}#G(e){let t=this.#K(this.#e.VERTEX_SHADER,Ee),n=this.#K(this.#e.FRAGMENT_SHADER,e),r=this.#e.createProgram();if(!r)throw new Error("The Aurora Ionosphere shader program could not be allocated");if(this.#e.attachShader(r,t),this.#e.attachShader(r,n),this.#e.linkProgram(r),this.#e.deleteShader(t),this.#e.deleteShader(n),!this.#e.getProgramParameter(r,this.#e.LINK_STATUS)){let a=this.#e.getProgramInfoLog(r)||"Aurora Ionosphere shader linking failed";throw this.#e.deleteProgram(r),new Error(a)}return r}#t(e,t){let n=this.#e.getUniformLocation(e,t);if(n===null)throw new Error(\`Missing Aurora Ionosphere shader uniform: \${t}\`);return n}#W(e,t){let n=this.#e.createTexture();if(!n)throw new Error("The Aurora Ionosphere texture could not be allocated");return this.#e.activeTexture(this.#e.TEXTURE0+e),this.#e.bindTexture(this.#e.TEXTURE_2D,n),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_MIN_FILTER,t),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_MAG_FILTER,t),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_WRAP_S,this.#e.CLAMP_TO_EDGE),this.#e.texParameteri(this.#e.TEXTURE_2D,this.#e.TEXTURE_WRAP_T,this.#e.CLAMP_TO_EDGE),this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,1,1,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,null),n}#j(e){let t=this.#e.createFramebuffer();if(!t)throw new Error("The Aurora Ionosphere framebuffer could not be allocated");return this.#e.bindFramebuffer(this.#e.FRAMEBUFFER,t),this.#e.framebufferTexture2D(this.#e.FRAMEBUFFER,this.#e.COLOR_ATTACHMENT0,this.#e.TEXTURE_2D,e,0),t}#te(e){let t=new Uint8Array(e*2*4);for(let r=0;r<e;r+=1){let a=r*.043,d=.8+Math.pow(r,1.4)*.002,o=q(0,15,r),s=[-1.15,1.5,-.2].map(m=>Math.sin(m+a)*.5+.5),f=Math.pow(2,-r*.065-2.5)*q(0,5,r),u=r*4,h=(e+r)*4;t[u]=Math.round((s[0]??0)*255),t[u+1]=Math.round((s[1]??0)*255),t[u+2]=Math.round((s[2]??0)*255),te(t,h,h+1,d/1.6),t[h+2]=Math.round(o*255),te(t,u+3,h+3,f/.15)}let n=this.#W(0,this.#e.NEAREST);return this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,e,2,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,t),n}#Z(){this.#A&&this.#e.deleteBuffer(this.#A),this.#s&&this.#e.deleteProgram(this.#s),this.#n&&this.#e.deleteProgram(this.#n),this.#r&&this.#e.deleteProgram(this.#r),this.#k&&this.#e.deleteTexture(this.#k),this.#p&&this.#e.deleteTexture(this.#p),this.#g&&this.#e.deleteTexture(this.#g),this.#_&&this.#e.deleteFramebuffer(this.#_),this.#M&&this.#e.deleteFramebuffer(this.#M)}#X(){this.#Z();let e=U[this.#c.quality];this.#s=this.#G(Se),this.#n=this.#G(Te(e.steps)),this.#r=this.#G(we),this.#A=this.#e.createBuffer()??(()=>{throw new Error("The Aurora Ionosphere geometry buffer could not be allocated")})(),this.#e.bindBuffer(this.#e.ARRAY_BUFFER,this.#A),this.#e.bufferData(this.#e.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),this.#e.STATIC_DRAW);for(let t of[this.#s,this.#n,this.#r]){this.#e.useProgram(t);let n=this.#e.getAttribLocation(t,"aPosition");if(n<0)throw new Error("The Aurora Ionosphere position attribute is unavailable");this.#e.enableVertexAttribArray(n),this.#e.vertexAttribPointer(n,2,this.#e.FLOAT,!1,0,0)}this.#k=this.#te(e.steps),this.#p=this.#W(2,this.#e.LINEAR),this.#_=this.#j(this.#p),this.#g=this.#W(1,this.#e.LINEAR),this.#M=this.#j(this.#g),this.#e.bindFramebuffer(this.#e.FRAMEBUFFER,null),this.#h={resolution:this.#t(this.#s,"uResolution"),domainMin:this.#t(this.#s,"uNoiseDomainMin"),domainSize:this.#t(this.#s,"uNoiseDomainSize"),flowRotation:this.#t(this.#s,"uFlowRotation"),scale:this.#t(this.#s,"uNoiseScale"),turbulence:this.#t(this.#s,"uNoiseTurbulence")},this.#i={resolution:this.#t(this.#n,"uResolution"),intensity:this.#t(this.#n,"uIntensity"),glow:this.#t(this.#n,"uGlow"),intro:this.#t(this.#n,"uIntro"),introFeather:this.#t(this.#n,"uIntroFeather"),introStart:this.#t(this.#n,"uIntroStart"),introEnd:this.#t(this.#n,"uIntroEnd"),layerLut:this.#t(this.#n,"uLayerLut"),layerLutStep:this.#t(this.#n,"uLayerLutStep"),noiseAtlas:this.#t(this.#n,"uNoiseAtlas"),domainMin:this.#t(this.#n,"uNoiseDomainMin"),inverseDomainSize:this.#t(this.#n,"uNoiseDomainInverseSize")},this.#l={resolution:this.#t(this.#r,"uResolution"),starResolution:this.#t(this.#r,"uStarResolution"),starDensity:this.#t(this.#r,"uStarDensity"),intro:this.#t(this.#r,"uIntro"),introSkyEnd:this.#t(this.#r,"uIntroSkyEnd"),introStarStart:this.#t(this.#r,"uIntroStarStart"),fieldTexture:this.#t(this.#r,"uAuroraTexture"),color:this.#t(this.#r,"uAuroraColor"),uvScale:this.#t(this.#r,"uAuroraUvScale"),uvOffset:this.#t(this.#r,"uAuroraUvOffset")},this.#e.useProgram(this.#n),this.#e.uniform1i(this.#i.layerLut,0),this.#e.uniform1i(this.#i.noiseAtlas,2),this.#e.uniform1f(this.#i.layerLutStep,1/e.steps),this.#e.useProgram(this.#r),this.#e.uniform1i(this.#l.fieldTexture,1),this.#m=!0,this.#y=!0,this.#R(void 0)}#ne(){this.#y=!1;let e=U[this.#c.quality],t=Math.min(window.devicePixelRatio||1,e.maxDpr),n=Math.max(1,Math.floor(this.#I.width*t)),r=Math.max(1,Math.floor(this.#I.height*t));(this.#a.width!==n||this.#a.height!==r)&&(this.#a.width=n,this.#a.height=r),this.#Y=Math.max(1,n);let a=Math.max(1,Math.floor(n*e.rayScale)),d=Math.max(1,Math.floor(r*e.rayScale));(a!==this.#b||d!==this.#x)&&(this.#b=a,this.#x=d,this.#e.activeTexture(this.#e.TEXTURE1),this.#e.bindTexture(this.#e.TEXTURE_2D,this.#g),this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,this.#b,this.#x,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,null)),this.#o=ne(n,r,e.steps);let o=Math.max(this.#o.sizeX,this.#o.sizeY),s=Math.min(e.noiseAtlasSize,this.#e.getParameter(this.#e.MAX_TEXTURE_SIZE)),f=Math.max(256,Math.round(s*this.#o.sizeX/o)),u=Math.max(256,Math.round(s*this.#o.sizeY/o));(f!==this.#T||u!==this.#w)&&(this.#T=f,this.#w=u,this.#e.activeTexture(this.#e.TEXTURE2),this.#e.bindTexture(this.#e.TEXTURE_2D,this.#p),this.#e.texImage2D(this.#e.TEXTURE_2D,0,this.#e.RGBA,this.#T,this.#w,0,this.#e.RGBA,this.#e.UNSIGNED_BYTE,null)),this.#F=Math.max(1,Math.floor(this.#b*this.#u)),this.#P=Math.max(1,Math.floor(this.#x*this.#u)),this.#B.x=Math.max(0,this.#F-1)/this.#b,this.#B.y=Math.max(0,this.#P-1)/this.#x,this.#U.x=.5/this.#b,this.#U.y=.5/this.#x}#q(){this.#v&&Q(this.#v),this.#v=0}#f(){!this.#v&&this.#D&&this.#E&&this.#L&&(this.#v=J(this.#a,this.#re))}#re=e=>{if(this.#v=0,!this.#D||!this.#E||!this.#L)return;this.#y&&this.#ne();let t=this.#c,n=this.#z.matches,r=this.#d?Math.min((e-this.#d)/1e3,.05):0;if(this.#d=e,t.paused||(this.#H+=r*(n?.16:1)),this.#S=n?1:Math.min(1,this.#S+r/Math.max(.1,t.introDuration)),!t.paused&&!n&&(this.#O+=r,this.#C+=1,this.#C>=30)){let s=U[t.quality],f=this.#O/this.#C,u=this.#u;f>1/52?this.#u=Math.max(s.minAdaptiveScale,this.#u-.04):f<1/58&&(this.#u=Math.min(1,this.#u+.02)),this.#O=0,this.#C=0,this.#u!==u&&(this.#y=!0)}let a=q(0,1,this.#S),d=this.#H*.06*t.speed,o=this.#e;if(o.bindFramebuffer(o.FRAMEBUFFER,this.#_),o.viewport(0,0,this.#T,this.#w),o.useProgram(this.#s),o.uniform2f(this.#h.resolution,this.#T,this.#w),o.uniform2f(this.#h.domainMin,this.#o.minX,this.#o.minY),o.uniform2f(this.#h.domainSize,this.#o.sizeX,this.#o.sizeY),o.uniform2f(this.#h.flowRotation,Math.cos(d),Math.sin(d)),this.#m&&(o.uniform1f(this.#h.scale,.6+.8*t.curtainScale),o.uniform1f(this.#h.turbulence,.3+1.2*t.turbulence)),o.drawArrays(o.TRIANGLES,0,3),o.bindFramebuffer(o.FRAMEBUFFER,this.#M),o.viewport(0,0,this.#F,this.#P),o.useProgram(this.#n),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this.#k),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this.#p),o.uniform2f(this.#i.resolution,this.#F,this.#P),o.uniform2f(this.#i.domainMin,this.#o.minX,this.#o.minY),o.uniform2f(this.#i.inverseDomainSize,1/this.#o.sizeX,1/this.#o.sizeY),o.uniform1f(this.#i.intro,a),this.#m&&(o.uniform1f(this.#i.intensity,t.intensity),o.uniform1f(this.#i.glow,t.glow),o.uniform1f(this.#i.introFeather,t.introFeather),o.uniform1f(this.#i.introStart,t.introStart),o.uniform1f(this.#i.introEnd,t.introEnd)),o.drawArrays(o.TRIANGLES,0,3),o.bindFramebuffer(o.FRAMEBUFFER,null),o.viewport(0,0,this.#a.width,this.#a.height),o.useProgram(this.#r),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this.#g),o.uniform2f(this.#l.resolution,this.#a.width,this.#a.height),o.uniform1f(this.#l.starResolution,this.#Y),o.uniform1f(this.#l.intro,a),o.uniform2f(this.#l.uvScale,this.#B.x,this.#B.y),o.uniform2f(this.#l.uvOffset,this.#U.x,this.#U.y),this.#m){o.uniform1f(this.#l.starDensity,t.starDensity);let s=t.hue*Math.PI/180,f=Math.cos(s)*t.saturation,u=(1-f)/3,h=Math.sin(s)*t.saturation/Math.sqrt(3);o.uniformMatrix3fv(this.#l.color,!1,new Float32Array([f+u,u+h,u-h,u-h,f+u,u+h,u+h,u-h,f+u])),o.uniform1f(this.#l.introSkyEnd,t.introSkyEnd),o.uniform1f(this.#l.introStarStart,t.introStarStart),this.#m=!1}o.drawArrays(o.TRIANGLES,0,3),!t.paused||this.#S<1?this.#f():this.#d=0};#$=()=>{this.#L=!document.hidden,this.#d=0,this.#L?this.#f():this.#q()};#J=e=>{e.preventDefault(),this.#E=!1,this.#q(),this.#R("The Aurora Ionosphere graphics context was lost; waiting for recovery.")};#Q=()=>{try{this.#E=!0,this.#X(),this.#u=1,this.#d=0,this.#f()}catch(e){this.#E=!1,this.#R(e instanceof Error?e.message:"The Aurora Ionosphere graphics context could not be restored")}};#ee=()=>{this.#m=!0,this.#d=0,this.#f()}},je=Object.freeze({quality:"medium",speed:.35,amplitude:1,frequency:1,zoom:1,rotation:0,exposure:1,timeOffset:5.07,introDuration:2.8,introFeather:.18,introAngle:32,introZoom:.16,introEnabled:!0,paused:!1,colors:Object.freeze(["#d81159","#8f2d56","#218380","#fbb13c","#73d2de"])});var Ze=Object.freeze([.72,.46]),$e=Math.PI/180;var re=[];function oe(i,e,t,n){return new H(i,e,t,n)}var L=globalThis,O="",ie=0,ae=!1,T,v,V=0,se=!1,le=0,y=(i,e={})=>L.postMessage({v:1,session:O,type:i,...e}),z=i=>y("failed",{code:"BG_WORKER_RENDER_FAILED",message:String(i instanceof Error?i.message:i).slice(0,1500)});L.addEventListener("error",i=>z(i.error??i.message));L.addEventListener("unhandledrejection",i=>z(i.reason));L.addEventListener("message",i=>{let e=i.data;if(!(ae||!e||e.v!==1||typeof e.session!="string"))try{if(e.type==="init"){if(O||!(e.canvas instanceof OffscreenCanvas)||e.session.length>100)throw Error("BG_INIT_INVALID: Invalid or duplicate background initialization.");O=e.session,j((n,r)=>y("event",{event:n,value:C(r)}));let t=W(e.viewport,e.viewport.dpr);v=K(e.canvas,t,()=>{V++,se||(se=!0,y("first-frame",{frames:V}),e.held===!0&&queueMicrotask(()=>v?.visibility(!1)));let n=performance.now();n-le>=1e3&&(le=n,y("sample",{frames:V,at:n}))}),v.motion(e.reduced===!0),T=oe(v.host,v.canvas,R(e.settings),n=>{n&&z(n)});return}if(e.session!==O||!Number.isSafeInteger(e.seq)||e.seq<=ie)return;if(ie=e.seq,e.type==="state"){if(e.settings!==void 0){let t=R(e.settings);T.setSettings?T.setSettings(t):T.updateSettings?.(t)}if(e.viewport&&v?.viewport(W(e.viewport,e.viewport.dpr)),typeof e.reduced=="boolean"&&v?.motion(e.reduced),typeof e.visible=="boolean"&&v?.visibility(e.visible),e.input){let{type:t,...n}=e.input;if(!["pointermove","pointerdown","pointerup","pointercancel","pointerleave","wheel","keydown"].includes(t))throw Error("BG_INPUT_METHOD: Unsupported background input.");v?.input(t,R(n))}y("ack",{seq:e.seq});return}if(e.type==="replay"){T.replay?.(),y("ack",{seq:e.seq});return}if(e.type==="call"){if(typeof e.method!="string"||!re.includes(e.method)||!Array.isArray(e.args)||e.args.length>8||!Number.isSafeInteger(e.callId))throw Error("BG_KERNEL_COMMAND: The visual kernel command is not supported.");let t=C(e.args);y("ack",{seq:e.seq}),Promise.resolve().then(()=>T[e.method](...t)).then(n=>y("result",{callId:e.callId,value:C(n??null)}),n=>y("result",{callId:e.callId,error:String(n).slice(0,1500)}));return}if(e.type==="dispose"){ae=!0;try{T?.dispose()}finally{v?.dispose(),y("disposed"),setTimeout(()=>L.close(),0)}return}throw Error("BG_WORKER_METHOD: Unsupported background command.")}catch(t){z(t)}});})();
442
+ `,o,e,t,r)}},z=window,O=Symbol.for("code-codex:background-modules:v1"),$=z[O]??(z[O]=new Map);$.set("aurora-ionosphere",{id:"aurora-ionosphere",api:1,version:"1.0.1",exports:{AuroraIonosphereRenderer:C},startup(o,e){let t=document.createElement("canvas");return t.style.cssText="width:100%;height:100%;display:block",o.append(t),new C(o,t,{...B(),paused:!1},e)}});})();