@plurnk/plurnk-xr 0.0.0-stage → 1.0.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.
- package/.env.defaults +9 -0
- package/ARCHITECTURE.md +112 -0
- package/LICENSE +21 -0
- package/README.md +34 -2
- package/SPEC.md +172 -0
- package/dist/assets/app.JAIWKC23.js +102 -0
- package/dist/assets/app.JAIWKC23.js.br +0 -0
- package/dist/assets/app.JAIWKC23.js.gz +0 -0
- package/dist/assets/index.571e167f.css +16 -0
- package/dist/assets/index.571e167f.css.br +0 -0
- package/dist/assets/index.571e167f.css.gz +0 -0
- package/dist/assets.json +62 -0
- package/dist/icons/APACHE-2.0.txt +202 -0
- package/dist/icons/APACHE-2.0.txt.br +0 -0
- package/dist/icons/APACHE-2.0.txt.gz +0 -0
- package/dist/icons/NOTO-NOTICE.txt +9 -0
- package/dist/icons/NOTO-NOTICE.txt.br +0 -0
- package/dist/icons/NOTO-NOTICE.txt.gz +0 -0
- package/dist/icons/plurnk-3d.svg +64 -0
- package/dist/icons/plurnk-3d.svg.br +0 -0
- package/dist/icons/plurnk-3d.svg.gz +0 -0
- package/dist/index.html +24 -0
- package/dist/vendor/OTM-LICENSE.txt +21 -0
- package/dist/vendor/OTM-LICENSE.txt.br +0 -0
- package/dist/vendor/OTM-LICENSE.txt.gz +0 -0
- package/package.json +81 -5
- package/src/documents.js +132 -0
- package/src/http.js +264 -0
- package/src/index-document.js +10 -0
- package/src/module.js +236 -0
- package/src/static-assets.js +171 -0
- package/types/module.d.ts +22 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var J=class e{static#e=new WeakMap;static on(t,o,n,r){if(typeof n!="string"||!n.trim()||typeof r!="function")throw new TypeError("on(): expected (parent, event, selector, handler)");let l=typeof t=="string"?document.querySelector(t):t||document.body;if(!l)throw new Error(`on(): parent selector matched nothing: ${t}`);let s=e.#e.get(l);s||(s=new Map,e.#e.set(l,s));let d=s.get(o);if(!d){let a=new Set,c=i=>{let f=i.target,y=f&&typeof f.closest=="function"?f:f?.parentElement||null;if(y)for(let I of[...a]){if(!a.has(I))continue;let b=y.closest(I.selector);b&&l.contains(b)&&I.fn.call(b,i,b)}};d={dispatch:c,entries:a},s.set(o,d),l.addEventListener(o,c)}let p={selector:n,fn:r};return d.entries.add(p),()=>{d.entries.delete(p),d.entries.size===0&&s.get(o)===d&&(l.removeEventListener(o,d.dispatch),s.delete(o),s.size===0&&e.#e.delete(l))}}static target(t,o,n,r={}){if(!t||typeof t.addEventListener!="function"||typeof Element<"u"&&t instanceof Element)throw new TypeError("on.target(): expected a non-Element EventTarget; use delegated on(parent, event, selector, handler) for DOM elements");if(typeof o!="string"||!o.trim()||typeof n!="function"||r===null||typeof r!="object")throw new TypeError("on.target(): expected (target, event, handler, options?)");let{signal:l,...s}=r;if(l?.aborted)return()=>{};let d=Object.keys(s).length>0,p=s.capture?{capture:!0}:void 0,a,c=s.once&&l?i=>{l.removeEventListener("abort",a),n.call(t,i)}:n;return a=()=>{t.removeEventListener(o,c,p),l?.removeEventListener("abort",a)},d?t.addEventListener(o,c,s):t.addEventListener(o,c),l?.addEventListener("abort",a,{once:!0}),a}static emit(t,o,n){let r=typeof t=="string"?document.querySelector(t):t,l=new CustomEvent(o,{bubbles:!0,cancelable:!0,detail:n});r.dispatchEvent(l)}};var ue=class{static validate(t){let o=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);if(!o(t))throw new TypeError("i18n dictionary must be an object");for(let[n,r]of Object.entries(t))if(typeof r!="string"&&!(o(r)&&Object.hasOwn(r,"other")&&Object.keys(r).every(l=>["zero","one","two","few","many","other"].includes(l))&&Object.values(r).every(l=>typeof l=="string")))throw new TypeError(`i18n dictionary entry ${JSON.stringify(n)} must be a string or plural-form object of strings with an other form`);return t}};var st=(e,t,o)=>{let n=t.endsWith("[]"),r=t.split(/[[\]]/).filter(Boolean),l=r.find(d=>["__proto__","prototype","constructor"].includes(d));if(l)throw new TypeError(`the.form: unsafe field name ${JSON.stringify(t)} contains forbidden path segment ${JSON.stringify(l)}`);let s=e;for(let d=0;d<r.length;d++){let p=r[d];d===r.length-1?n?(s[p]||=[],s[p].push(o)):s[p]!==void 0?(Array.isArray(s[p])||(s[p]=[s[p]]),s[p].push(o)):s[p]=o:(s[p]=s[p]||{},s=s[p])}};function rt(e,t="-"){if(e===null||typeof e!="object")throw new TypeError("the.flat: input must be an object");let o={},n=(r,l)=>{if(r===null||typeof r!="object"){o[l]=r;return}for(let[s,d]of Object.entries(r))n(d,l?`${l}${t}${s}`:s)};return n(e,""),o}function it(e){let t={},o=e.querySelectorAll("input, select, textarea");for(let n of o){let r=n.name;if(!r||n.disabled)continue;let l=(n.type||"text").toLowerCase();if(l==="submit"||l==="button"||l==="reset"||l==="file"||(l==="checkbox"||l==="radio")&&!(n.checked??n.hasAttribute("checked")))continue;if(n.tagName==="SELECT"&&n.hasAttribute("multiple")){let d="selectedOptions"in n?n.selectedOptions:n.querySelectorAll("option[selected]");for(let p of d)st(t,r,p.value);continue}let s=n.value??n.getAttribute("value")??"";st(t,r,s)}return t}var oe=class e{static compatible(t,o){let n=new Intl.Locale(t).maximize(),r=new Intl.Locale(o).maximize();return n.language===r.language&&n.script===r.script}static chain(t){let o=new Intl.Locale(t).baseName,n=[],r=o;for(;r;){e.compatible(o,r)&&n.push(r);let l=r.lastIndexOf("-");r=l<0?"":r.slice(0,l)}return n}};var Ee=null;function at(e,t){let o=t??(typeof window<"u"&&window.location?window.location.pathname:""),n=[],l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(p,a)=>(n.push(a),"([^/]+)")),s=o.match(new RegExp(`^${l}$`));if(!s)return null;let d={};return n.forEach((p,a)=>{d[p]=decodeURIComponent(s[a+1])}),d}function ct(e,{match:t,initial:o=!0}={}){if(typeof window>"u")return;if(Ee)throw new Error("route(): a router is already active \u2014 call its unsubscribe first");let n=window.location.href,r=()=>{n=window.location.href,e(window.location.pathname,window.location.search,window.location.hash)},l=()=>{window.location.href!==n&&r()};Ee=r;let s=d=>{if(d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||d.button>0)return;let p=d.target.closest("a");if(!p?.getAttribute("href")||p.hasAttribute("data-external")||p.hasAttribute("download")||p.target==="_blank"||t&&!p.matches(t))return;let a=new URL(p.getAttribute("href"),window.location.href);a.origin===window.location.origin&&(a.pathname===window.location.pathname&&a.search===window.location.search&&a.hash||(d.preventDefault(),a.href!==window.location.href&&(window.history.pushState({},"",a.href),r())))};return window.addEventListener("popstate",r),window.addEventListener("hashchange",l),document.addEventListener("click",s),o&&r(),()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",l),document.removeEventListener("click",s),Ee=null}}function lt(e,{replace:t=!1}={}){if(typeof window>"u")return;if(!Ee)throw new Error("route.go(): no active router \u2014 call route() first");let o=new URL(e,window.location.href);o.href!==window.location.href&&(t?window.history.replaceState({},"",o.href):window.history.pushState({},"",o.href),Ee())}var V=class e{static#e=[{dictionary:{},locale:null}];static#t=new WeakMap;static locale=typeof navigator<"u"?navigator.language:"en";static prefix="otm:";static persistKeys=new Set;static get dictionary(){return e.#e[0].dictionary}static set dictionary(t){e.#e=[{dictionary:ue.validate(t),locale:null}]}static#c=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;static#r(t){if(typeof t!="string"||!e.#c.test(t))throw new TypeError(`the(${JSON.stringify(t)}): state keys must be canonical kebab-case (e.g. "model-offline")`);return t}static the(...t){if(t.length===0)throw new TypeError("the(): missing args");return t[0]instanceof Element?e.#l(t[0],t.slice(1)):e.#l(document.body,t)}static#l(t,o){let[n,r]=o,l=t===document.body;if(o.length===1&&typeof n=="string")return e.#p(t,e.#r(n));if(o.length===2&&typeof n=="string"){if(typeof r>"u")throw new TypeError(`the(${JSON.stringify(n)}, undefined): val is required for set`);return e.#u(t,l,n,r),t}if(o.length===1&&n?.constructor===Object){for(let[s,d]of Object.entries(n))e.#u(t,l,s,d);return t}throw new TypeError(`the(): unrecognized call shape (${o.map(s=>typeof s).join(", ")})`)}static match=at;static flat=rt;static form=it;static route=ct;static go=lt;static _t(t,o={}){return(typeof Node<"u"?t instanceof Node:t?.nodeType)?(e.#n(t),t):t?e.#i(t,o)?.text??t:(e.#n(document.documentElement),"")}static#n(t,o=!1){let n=t.querySelectorAll?[t,...t.querySelectorAll("[data-i18n]")]:[t];for(let r of n)if(r.hasAttribute?.("data-i18n")){let l=r.getAttribute("data-i18n"),s={};for(let c of r.attributes)if(c.name.startsWith("data-i18n-")&&c.name!=="data-i18n-type"){let i=c.name.replace("data-i18n-","");s[i]=c.value}let d=r.getAttribute("data-i18n-type"),p=o?null:e.#i(l,{...s,type:d}),a=e.#t.get(r);p!==null?(a||e.#t.set(r,{text:r.textContent,lang:r.getAttribute("lang")}),e.#a(r,p.text),e.#d(r,"lang",p.locale)):a&&(e.#a(r,a.text),e.#d(r,"lang",a.lang))}}static#o(t){if(!t.currency)throw new TypeError('_t: type "currency" requires an explicit currency (options.currency or data-i18n-currency)');return t.currency}static#i(t,o){let n=e.#e.find(({dictionary:p})=>Object.hasOwn(p,t)),r=n?.dictionary[t],l=n?.locale??e.locale,s=oe.compatible(e.locale,l)?e.locale:l;if(r===void 0){if(o.val!==void 0&&(o.type==="currency"||o.type==="date")){let p=o.type==="currency"?new Intl.NumberFormat(e.locale,{style:"currency",currency:e.#o(o)}):new Intl.DateTimeFormat(e.locale);return{text:o.type==="date"?p.format(new Date(o.val)):p.format(Number(o.val)),locale:e.locale}}return null}if(typeof r=="object"){let p=o.qty!==void 0?Number(o.qty):0,a=new Intl.PluralRules(l).select(p);r=r[a]??r.other??t}if(typeof r!="string")throw new TypeError(`Invalid i18n dictionary entry ${JSON.stringify(t)}`);let d=r;for(let[p,a]of Object.entries(o)){let c=a;if(p==="val"&&o.type){let i=Number(a),f=o.type==="currency"?new Intl.NumberFormat(s,{style:"currency",currency:e.#o(o)}):o.type==="date"?new Intl.DateTimeFormat(s):new Intl.NumberFormat(s);c=o.type==="date"?f.format(new Date(a)):f.format(i)}d=d.replaceAll(`{${p}}`,()=>c)}return{text:d,locale:l}}static#f={expanded:"aria-expanded",selected:"aria-selected",checked:"aria-checked",disabled:"aria-disabled"};static#s(t,o){return t===document.body?`data-${o}`:e.#f[o]||`data-${o}`}static#u(t,o,n,r){let l=e.#r(n);if(r===null){e.#w(t,l),o&&e.persistKeys.has(l)&&localStorage.removeItem(`${e.prefix}${l}`);return}let s=e.#m(l,r);e.#h(t,l,s),o&&e.persistKeys.has(l)&&localStorage.setItem(`${e.prefix}${l}`,s)}static#m(t,o){if(typeof o=="string")return o;if(typeof o=="boolean")return o?"true":"false";if(typeof o=="number"&&Number.isFinite(o))return String(o);throw new TypeError(`the(${JSON.stringify(t)}, ...): state value must be a string, finite number, boolean, or null`)}static#p(t,o){return t.getAttribute(e.#s(t,o))}static#a(t,o){t.textContent!==o&&(t.textContent=o)}static#d(t,o,n){t.getAttribute(o)!==n&&(n===null?t.removeAttribute(o):t.setAttribute(o,n))}static#h(t,o,n){e.#d(t,e.#s(t,o),n),e.#g(t,o,n,!1)}static#w(t,o){e.#d(t,e.#s(t,o),null),e.#g(t,o,"",!0)}static#g(t,o,n,r){let l=t===document.body,s=l&&typeof document<"u"?document.documentElement||document:t;if(s.querySelectorAll)for(let d of s.querySelectorAll(`[data-text="${o}"],[data-bind*="${o}"]`)){if(!l){let p=d.closest?.("[data-otm-scope]");if(p&&p!==t&&t.contains(p))continue}d.getAttribute("data-text")===o&&e.#a(d,n),e.#y(d,o,n,r)}t.getAttribute?.("data-text")===o&&e.#a(t,n),e.#y(t,o,n,r)}static#y(t,o,n,r){let l=t.getAttribute?.("data-bind");if(l)for(let s of l.split(/\s+/)){let d=s.indexOf(":");if(d<1||s.slice(d+1)!==o)continue;let p=s.slice(0,d);e.#d(t,p,r?null:n)}}static async boot({signal:t,locales:o,dictionary:n,namespace:r,locale:l,defaultLocale:s,persistKeys:d}={}){r&&(e.prefix=`${r}:`),d&&(e.persistKeys=new Set(d.map(w=>e.#r(w))));let p=typeof window<"u"&&window.location?window.location.search:"",a=new URLSearchParams(p),c=document.documentElement.lang||(typeof navigator<"u"?navigator.language:null)||"en",i=new Intl.Locale(l||a.get("lang")||e.persistKeys.has("lang")&&localStorage.getItem(`${e.prefix}lang`)||c).toString(),f=s||document.documentElement.lang,y=f?new Intl.Locale(f).baseName:null;s&&e.#d(document.documentElement,"lang",new Intl.Locale(s).toString());let I=[];if(n!==void 0)I.push({dictionary:ue.validate(n),locale:i});else{let w=document.querySelector('meta[name="i18n"]'),m=o||w?.getAttribute("content");if(m){let S=w?.getAttribute("data-fallback")||y||"en",A=new Map((w?.getAttribute("data-available")||"").split(",").map(g=>g.trim()).filter(Boolean).map(g=>[new Intl.Locale(g).baseName,g])),E=oe.chain(i);y&&oe.compatible(i,y)&&E.push(y);let h=new Set([...E,...oe.chain(S),...y?[y]:[]]);for(let g of h){if(g===y&&!A.has(g))break;let x=A.get(g)??(A.size===0&&g===new Intl.Locale(S).baseName?S:null);if(x){try{let v=await fetch(`${m}/${x}.json`,{signal:t});if(!v.ok)throw new Error(`HTTP ${v.status} for ${x}.json`);I.push({dictionary:ue.validate(await v.json()),locale:g})}catch(v){if(t?.aborted)throw v;console.warn(`otm: i18n fetch failed for "${g}"`,v)}if(g===y)break}}}}let b=I[0]?.locale??y??i;e.locale=oe.compatible(i,b)?i:b,e.#e=I.length?I:[{dictionary:{},locale:null}];for(let w of e.persistKeys){if(w==="lang")continue;let m=localStorage.getItem(`${e.prefix}${w}`);m!==null&&e.#h(document.body,w,m)}e.#n(document.documentElement,y!==null&&I.length===0)}};var Jt=/^data-[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,se=class e{static $(t,o){let n=t,r=o;return typeof n=="string"&&(r=n,n=document),n.querySelector(r)}static $$(t,o){let n=t,r=o;return typeof n=="string"&&(r=n,n=document),Array.from(n.querySelectorAll(r))}static clone(t,o,{position:n="beforeend"}={}){let r=typeof t=="string"?document.querySelector(t):t,l=document.querySelector(o);if(!r)throw new Error(`Parent not found: ${t}`);if(!l)throw new Error(`Template not found: ${o}`);let s=l.content.cloneNode(!0).firstElementChild;V._t(s),r.insertAdjacentElement(n,s);let d=new CustomEvent("mounted",{bubbles:!0,detail:{parent:r}});return s.dispatchEvent(d),s}static cloneEach(t,o,n,r){let l=typeof t=="string"?document.querySelector(t):t;if(!l)throw new Error(`Parent not found: ${t}`);l.replaceChildren();let s=[],d=0;for(let p of n){let a=e.clone(l,o);r?.(a,p,d++),s.push(a)}return s}static reconcile(t,o,n,{key:r,fill:l,attr:s="data-otm-key"}={}){let d=typeof t=="string"?document.querySelector(t):t;if(!d)throw new Error(`Parent not found: ${t}`);if(typeof r!="function")throw new TypeError("$.reconcile(): options.key must be a function");if(typeof s!="string"||!Jt.test(s))throw new TypeError(`$.reconcile(): options.attr must be a canonical data-* attribute, got ${JSON.stringify(s)}`);let p=[],a=new Set,c=0;for(let S of n){let A=r(S,c);if(A==null||String(A)==="")throw new TypeError("$.reconcile(): key() must return a non-empty key");let E=String(A);if(a.has(E))throw new RangeError(`$.reconcile(): duplicate key ${JSON.stringify(E)}`);a.add(E),p.push({key:E,item:S,index:c++})}let i=new Map;for(let S of Array.from(d.children)){let A=S.getAttribute(s);A!==null&&!i.has(A)&&i.set(A,S)}let f=[],y=new Set;for(let S of p){let A=i.get(S.key);A||(A=e.clone(d,o),A.setAttribute(s,S.key)),y.add(A),f.push({...S,el:A})}let I=typeof document<"u"?document.activeElement:null,b=I&&d.contains(I)&&typeof I.focus=="function"?I:null;for(let S of Array.from(d.children))y.has(S)||S.remove();let w=typeof d.moveBefore=="function"?(S,A)=>d.moveBefore(S,A):(S,A)=>d.insertBefore(S,A);for(let S=0;S<f.length;S++){let{el:A}=f[S],E=d.children[S]??null;E!==A&&w(A,E)}b&&d.contains(b)&&document.activeElement!==b&&b.focus({preventScroll:!0});let m=[];for(let{el:S,item:A,index:E}of f)l?.(S,A,E),m.push(S);return m}};var Z=J.on;Z.emit=J.emit;Z.target=J.target;var H=V.the,Zt=V._t,ut=V.route;ut.go=V.go;H.t=Zt;H.route=ut;H.form=V.form;H.flat=V.flat;H.match=V.match;H.boot=V.boot;Object.defineProperty(H,"dictionary",{get:()=>V.dictionary,set:e=>{V.dictionary=e}});Object.defineProperty(H,"locale",{get:()=>V.locale,set:e=>{V.locale=e}});var ae=se.$;ae.clone=se.clone;ae.cloneEach=se.cloneEach;ae.reconcile=se.reconcile;var po=se.$$;var de="plurnk_oidc_grant",ft="plurnk_oidc_pkce",Qt="plurnk:oauth:refresh:",pt=1e3,en="plurnk-web",tn=Object.freeze(["openid","profile","email"]),Be=new Set,Pe=new Map,Re=null,dt=!1,re=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function he(e){try{return typeof window<"u"?window[e]??null:null}catch{return null}}function mt(){if(Re!==null)return Re;if(typeof window>"u"||typeof BroadcastChannel!="function")return null;try{let e=new BroadcastChannel(de);"unref"in e&&typeof e.unref=="function"&&e.unref(),Z.target(e,"message",()=>{ze(!1)}),Re=e}catch{Re=null}return Re}function nn(){dt||typeof window>"u"||typeof window.addEventListener!="function"||(dt=!0,Z.target(window,"storage",e=>{let t=e.key;(t==null||t===de)&&ze(!1)}))}function ze(e){if(e){let t=mt();try{t?.postMessage("grant-changed")}catch{}}for(let t of Be)t()}function on(){try{let e=typeof navigator<"u"?navigator.locks:void 0;return re(e)&&typeof e.request=="function"?e:null}catch{return null}}function sn(e){let t=typeof e.access_token=="string"&&e.access_token.trim()!==""?e.access_token.trim():null,o=typeof e.id_token=="string"&&e.id_token.trim()!==""?e.id_token.trim():null;return t!==null&&(t.split(".").length===3||o===null)?t:o}function rn(e){let t=e.split(".");if(t.length!==3||t[1]==="")return null;try{let o=t[1].replaceAll("-","+").replaceAll("_","/"),n=o+"=".repeat((4-o.length%4)%4),r=atob(n),l=new Uint8Array(r.length);for(let d=0;d<r.length;d+=1)l[d]=r.charCodeAt(d);let s=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(l));return!re(s)||typeof s.exp!="number"||!Number.isFinite(s.exp)||s.exp<=0?null:Math.floor(s.exp*1e3)}catch{return null}}function an(e,t){let o=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""?Number(e):Number.NaN;if(Number.isFinite(o)&&o>0)return Date.now()+Math.floor(o*1e3);let n=rn(t);return n!==null?n:void 0}function De(e){let t=he("localStorage")?.getItem(de)??null;if(t===null)return null;try{let o=JSON.parse(t);return!re(o)||typeof o.acpOrigin!="string"||typeof o.accessToken!="string"||o.acpOrigin!==e||o.accessToken.trim()===""?null:{acpOrigin:o.acpOrigin,accessToken:o.accessToken,...typeof o.issuer=="string"?{issuer:o.issuer}:{},...typeof o.clientId=="string"?{clientId:o.clientId}:{},...typeof o.tokenEndpoint=="string"?{tokenEndpoint:o.tokenEndpoint}:{},...typeof o.refreshToken=="string"?{refreshToken:o.refreshToken}:{},...typeof o.expiresAt=="number"&&Number.isFinite(o.expiresAt)?{expiresAt:o.expiresAt}:{}}}catch{return null}}function ht(){let e=he("localStorage"),t=e?.getItem(de)!==null;try{e?.removeItem(de),he("sessionStorage")?.removeItem(ft)}catch{}t&&ze(!0)}function cn(e){try{he("localStorage")?.setItem(de,JSON.stringify(e))}catch{}ze(!0)}async function gt(e,t){if(!e.refreshToken||!e.tokenEndpoint||!e.clientId)return null;let o=e.refreshToken,n=e.accessToken,r=e.acpOrigin,l=`${r}:${o}`,s=Pe.get(l);if(s)return await s;let d=async()=>{let a=De(r);if(a!==null){let i=a.accessToken!==n||a.refreshToken!==o,f=a.expiresAt===void 0||Date.now()+pt<a.expiresAt;if(i&&f)return a}if(a===null&&(he("localStorage")?.getItem(de)??null)===null)return null;let c=a??e;if(!c.refreshToken||!c.tokenEndpoint||!c.clientId)return null;try{let i=new URLSearchParams({grant_type:"refresh_token",refresh_token:c.refreshToken,client_id:c.clientId}),f=await fetch(c.tokenEndpoint,{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:i,cache:"no-store",signal:t});if(!f.ok)return(f.status===400||f.status===401)&&ht(),null;let y=await f.json();if(!re(y))return null;let I=sn(y);if(I===null)return null;let b=an(y.expires_in,I),w=typeof y.refresh_token=="string"&&y.refresh_token.trim()!==""?y.refresh_token.trim():c.refreshToken,m={...c,accessToken:I,...w?{refreshToken:w}:{},...b!==void 0?{expiresAt:b}:{}};return cn(m),m}catch{return null}},p=(async()=>{try{let a=on();return a!==null?await a.request(`${Qt}${r}`,d):await d()}finally{Pe.delete(l)}})();return Pe.set(l,p),await p}function qe(e){let t=typeof window<"u"?window.location.origin:"http://127.0.0.1:1066";return new URL(e,t).origin}async function yt(e,t){t?.throwIfAborted();let o=qe(e),n=De(o);if(!n)return{};if(!(typeof n.expiresAt=="number"&&Date.now()+pt>=n.expiresAt))return{Authorization:`Bearer ${n.accessToken}`};if(!n.refreshToken)return ht(),{};let l=await gt(n,t);return t?.throwIfAborted(),l?{Authorization:`Bearer ${l.accessToken}`}:{}}async function wt(e){let t=qe(e),o=De(t);return o?await gt(o)!==null:!1}function Fe(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function $e(e){try{let t=new URL(e);return t.username!==""||t.password!==""?!1:t.protocol==="https:"?!0:t.protocol==="http:"&&(t.hostname==="127.0.0.1"||t.hostname==="localhost"||t.hostname==="::1"||t.hostname==="[::1]")}catch{return!1}}async function bt(e,t={}){let{returnTo:o="/xr/",fetchImpl:n=globalThis.fetch,navigate:r=d=>{typeof window<"u"&&window.location.assign(d)}}=t,l=qe(e),s=typeof window<"u"?window.location.origin:l;try{let d=await n(`${l}/.well-known/oauth-protected-resource`,{headers:{accept:"application/json"},cache:"no-store"});if(d.ok){let p=await d.json(),c=(re(p)&&Array.isArray(p.authorization_servers)?p.authorization_servers.filter(i=>typeof i=="string"&&$e(i)):[])[0];if(typeof c=="string"){let i=new URL(c),f=i.pathname.replace(/\/+$/u,""),y=f===""?[`${i.origin}/.well-known/oauth-authorization-server`,`${i.origin}/.well-known/openid-configuration`]:[`${i.origin}/.well-known/oauth-authorization-server${f}`,`${i.origin}${f}/.well-known/openid-configuration`];for(let I of y){let b=await n(I,{headers:{accept:"application/json"},cache:"no-store"});if(!b.ok)continue;let w=await b.json();if(!re(w)||typeof w.issuer!="string"||w.issuer.replace(/\/+$/u,"")!==c.replace(/\/+$/u,"")||typeof w.authorization_endpoint!="string"||typeof w.token_endpoint!="string"||!$e(w.authorization_endpoint)||!$e(w.token_endpoint))continue;let m=new Uint8Array(32);globalThis.crypto.getRandomValues(m);let S=Fe(m),A=new Uint8Array(24);globalThis.crypto.getRandomValues(A);let E=Fe(A),h=await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(S)),g=Fe(new Uint8Array(h)),x=re(p)&&typeof p.client_id=="string"&&p.client_id!==""?p.client_id:en,v=re(p)&&typeof p.redirect_uri=="string"&&p.redirect_uri!==""?p.redirect_uri:new URL("/auth/callback",s).href,z=re(p)&&Array.isArray(p.scopes_supported)&&p.scopes_supported.length>0?p.scopes_supported.filter(u=>typeof u=="string"&&u!==""):tn;he("sessionStorage")?.setItem(ft,JSON.stringify({state:E,verifier:S,returnTo:o,acpOrigin:l,issuer:c,clientId:x,tokenEndpoint:w.token_endpoint,redirectUri:v,createdAt:Date.now()}));let k=new URL(w.authorization_endpoint);return k.searchParams.set("response_type","code"),k.searchParams.set("client_id",x),k.searchParams.set("redirect_uri",v),k.searchParams.set("code_challenge",g),k.searchParams.set("code_challenge_method","S256"),k.searchParams.set("state",E),k.searchParams.set("scope",z.join(" ")),r(k.href),k.href}}}}catch{}return r("/"),"/"}function vt(e){return nn(),mt(),Be.add(e),()=>{Be.delete(e)}}var ln=Math.PI/180,un=e=>e<=0?0:e>=1?1:e;function Ge(e){let t=un(e);return t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055}function dn(e,t,o){let n=o*ln,r=t*Math.cos(n),l=t*Math.sin(n),s=e+.3963377774*r+.2158037573*l,d=e-.1055613458*r-.0638541728*l,p=e-.0894841775*r-1.291485548*l,a=s**3,c=d**3,i=p**3,f=4.0767416621*a-3.3077115913*c+.2309699292*i,y=-1.2684380046*a+2.6097574011*c-.3413193965*i,I=-.0041960863*a-.7034186147*c+1.707614701*i;return Object.freeze([Math.round(Ge(f)*1e4)/1e4,Math.round(Ge(y)*1e4)/1e4,Math.round(Ge(I)*1e4)/1e4])}function Q(e,t,o,n,r){return Object.freeze({slot:e,name:t,hueDeg:r,lightness:o,chroma:n,css:`oklch(${o} ${n} ${r})`,rgb:dn(o,n,r)})}var ce=.74,le=.155,kt=Object.freeze([Q(0,"teal",ce,le,185),Q(1,"azure",ce,le,245),Q(2,"emerald",ce,le,150),Q(3,"violet",ce,le,295),Q(4,"cyan",ce,le,212),Q(5,"magenta",ce,le,332),Q(6,"mint",ce,le,168),Q(7,"indigo",ce,le,268)]),ie=Object.freeze({gate:Q(-1,"amber",.79,.165,75),failed:Q(-2,"crimson",.65,.2,25)});function Le(e){let t=Number.isFinite(e)&&e>=1?Math.trunc(e)-1:Math.abs(Math.trunc(e||0));return kt[t%kt.length]}var fn=Object.freeze({x:0,y:1.35,z:-1.85}),pn=Object.freeze({position:Object.freeze({x:0,y:1.35,z:0}),forward:Object.freeze({x:0,y:0,z:-1}),up:Object.freeze({x:0,y:1,z:0})}),Et=Object.freeze([Object.freeze({slot:0,note:"D3",baseHz:146.83,wave:"sine"}),Object.freeze({slot:1,note:"F#3",baseHz:185,wave:"triangle"}),Object.freeze({slot:2,note:"A3",baseHz:220,wave:"sine"}),Object.freeze({slot:3,note:"B3",baseHz:246.94,wave:"triangle"}),Object.freeze({slot:4,note:"D4",baseHz:293.66,wave:"sine"}),Object.freeze({slot:5,note:"E4",baseHz:329.63,wave:"triangle"}),Object.freeze({slot:6,note:"F#4",baseHz:369.99,wave:"sine"}),Object.freeze({slot:7,note:"A4",baseHz:440,wave:"triangle"})]);function It(e){let t=Le(e);return Et[t.slot]}var xt=e=>Number.isFinite(e)?e<=0?0:e>=1?1:e:0;function mn(){return typeof window<"u"&&typeof window.AudioContext=="function"?new window.AudioContext({latencyHint:"interactive"}):null}function B(e,t,o,n){n&&typeof e.setTargetAtTime=="function"?e.setTargetAtTime(t,o,.03):e.setValueAtTime(t,o),e.value=t}function Rt(e,t,o,n){e.positionX&&e.positionY&&e.positionZ?(B(e.positionX,t.x,o,n),B(e.positionY,t.y,o,n),B(e.positionZ,t.z,o,n)):e.setPosition?.(t.x,t.y,t.z)}function At(e,t,o){let{position:n,forward:r,up:l}=t;e.positionX&&e.positionY&&e.positionZ?(B(e.positionX,n.x,o,!1),B(e.positionY,n.y,o,!1),B(e.positionZ,n.z,o,!1)):e.setPosition?.(n.x,n.y,n.z),e.forwardX&&e.forwardY&&e.forwardZ&&e.upX&&e.upY&&e.upZ?(B(e.forwardX,r.x,o,!1),B(e.forwardY,r.y,o,!1),B(e.forwardZ,r.z,o,!1),B(e.upX,l.x,o,!1),B(e.upY,l.y,o,!1),B(e.upZ,l.z,o,!1)):e.setOrientation?.(r.x,r.y,r.z,l.x,l.y,l.z)}function St(e,t){let o=e.createPanner();return o.panningModel="HRTF",o.distanceModel="inverse",o.refDistance=1.2,o.maxDistance=12,o.rolloffFactor=1,o.coneInnerAngle=360,o.coneOuterAngle=360,o.coneOuterGain=1,Rt(o,t,e.currentTime,!1),o}function hn(e){let t=[],o=new Set;for(let n of e.nodes)n.kind!=="workspace"&&n.gates>0&&(t.push(n),o.add(n.workspaceId));for(let n of e.nodes)n.kind==="workspace"&&n.gates>0&&!o.has(n.workspaceId)&&t.push(n);return t}function gn(e,t,o){if(t!==null){if(o!==null){let n=e.nodes.find(r=>r.workspaceId===t&&r.sessionId===o);if(n)return n}return e.nodes.find(n=>n.kind==="workspace"&&n.workspaceId===t)}}function Mt({createAudioContext:e=mn,initialGain:t=.35,initialMuted:o=!1,activityCooldownMs:n=1600,maxTransientVoices:r=6}={}){let l=xt(t),s=!!o,d=!1,p=pn,a=null,c=null,i=null,f=new Map,y=new Set,I=new Map;function b(){if(!c||!i)return;let x=s?0:l;B(i.gain,x,c.currentTime,!0)}function w(){if(d)return null;if(c!==null)return c;let x=e();if(!x)return null;c=x,i=x.createGain();let v=s?0:l;return B(i.gain,v,x.currentTime,!1),i.connect(x.destination),At(x.listener,p,x.currentTime),x}function m(x){for(let v of y)v.endsAtSec<=x&&(v.cleanup(),y.delete(v))}function S(x){for(let v of I.values())v.stop(x);I.clear()}function A(){for(let x of y)x.cleanup();y.clear()}function E(x,v){if(!c||!i||d||s||c.state!=="running"){S(!1);return}let z=c,k=i,u=z.currentTime,O=hn(x),M=new Set(O.map(R=>R.id));for(let[R,_]of I)M.has(R)||(_.stop(!1),I.delete(R));for(let R of O){let _=I.get(R.id);if(_){Rt(_.panner,R.position,u,!0);continue}let j=It(R.workspaceId),P=St(z,R.position),C=z.createBiquadFilter();C.type="lowpass",B(C.frequency,720,u,!1),B(C.Q,.7,u,!1);let N=z.createGain(),U=R.sessionId!==null&&v.has(`${R.workspaceId}:${R.sessionId}`);B(N.gain,1e-4,u,!1),U?(N.gain.linearRampToValueAtTime(.11,u+.03),N.gain.exponentialRampToValueAtTime(.042,u+.32)):N.gain.linearRampToValueAtTime(.042,u+.35);let W=z.createOscillator();W.type="sine",B(W.frequency,j.baseHz,u,!1);let $=z.createOscillator();$.type="sine",B($.frequency,Math.round(j.baseHz*(4/3)*100)/100,u,!1);let T=z.createOscillator();T.type="sine",B(T.frequency,.25,u,!1);let Y=z.createGain();B(Y.gain,.016,u,!1),W.connect(C),$.connect(C),C.connect(N),T.connect(Y),Y.connect(N.gain),N.connect(P),P.connect(k),W.start(u),$.start(u),T.start(u);let te=!1,L=q=>{if(te)return;te=!0;let G=z.currentTime,K=()=>{try{W.disconnect(),$.disconnect(),T.disconnect(),Y.disconnect(),C.disconnect(),N.disconnect(),P.disconnect()}catch{}};if(q){try{W.stop(G),$.stop(G),T.stop(G)}catch{}K();return}N.gain.cancelScheduledValues?.(G),N.gain.setValueAtTime(Math.max(1e-4,N.gain.value),G),N.gain.exponentialRampToValueAtTime(1e-4,G+.08);let ne=G+.09;W.onended=K;try{W.stop(ne),$.stop(ne),T.stop(ne)}catch{K()}};I.set(R.id,{nodeId:R.id,panner:P,voiceGain:N,stop:L})}}function h({position:x,wave:v,startHz:z,secondHz:k,stepAtSec:u=.1,peakGain:O,durationSec:M,cutoffHz:R}){if(!c||!i||d||s||c.state!=="running")return;let _=c,j=_.currentTime,P=St(_,x),C=_.createBiquadFilter();C.type="lowpass",B(C.frequency,R,j,!1),B(C.Q,.7,j,!1);let N=_.createGain();B(N.gain,1e-4,j,!1),N.gain.linearRampToValueAtTime(O,j+.012),N.gain.exponentialRampToValueAtTime(1e-4,j+M);let U=_.createOscillator();U.type=v,B(U.frequency,z,j,!1),k!==void 0&&U.frequency.setValueAtTime(k,j+u),U.connect(C),C.connect(N),N.connect(P),P.connect(i);let W=!1,$=()=>{if(!W){W=!0;try{U.disconnect(),C.disconnect(),N.disconnect(),P.disconnect()}catch{}}},T=j+M+.02,Y={endsAtSec:T,cleanup:$};y.add(Y),U.onended=()=>{$(),y.delete(Y)},U.start(j),U.stop(T)}function g(x,v=[],z=Date.now()){if(a=x,!c||d)return;m(c.currentTime);let k=new Set;for(let u of v)u.kind==="gate-opened"&&k.add(`${u.workspaceId}:${u.sessionId}`);if(E(x,k),!(s||c.state!=="running"))for(let u of v){let O=gn(x,u.workspaceId,u.sessionId),M=O?.position??fn,R=u.workspaceId!==null?It(u.workspaceId):Et[0];switch(u.kind){case"activity":{let _=`${u.workspaceId}:${u.sessionId}`,j=f.get(_);if(j!==void 0&&z-j<n||y.size>=r)break;f.set(_,z);let P=O?.kind==="satellite";h({position:M,wave:R.wave,startHz:P?R.baseHz*2:R.baseHz,peakGain:P?.065:.105,durationSec:P?.14:.18,cutoffHz:820});break}case"gate-settled":{let _=u.resolution==="accept"||u.resolution==="submitted"||u.resolution==="settled";h(_?{position:M,wave:"sine",startHz:Math.round(R.baseHz*(4/3)*100)/100,secondHz:Math.round(R.baseHz*1.5*100)/100,stepAtSec:.09,peakGain:.13,durationSec:.28,cutoffHz:1100}:{position:M,wave:"sine",startHz:R.baseHz,secondHz:Math.round(R.baseHz*(8/9)*100)/100,stepAtSec:.08,peakGain:.075,durationSec:.2,cutoffHz:520});break}case"terminated":{u.status===200?h({position:M,wave:R.wave,startHz:R.baseHz,secondHz:Math.round(R.baseHz*1.5*100)/100,stepAtSec:.11,peakGain:.13,durationSec:.32,cutoffHz:1050}):u.status===202?h({position:M,wave:"sine",startHz:Math.round(R.baseHz*1.25*100)/100,secondHz:R.baseHz,stepAtSec:.09,peakGain:.07,durationSec:.22,cutoffHz:680}):u.status===499?h({position:M,wave:"sine",startHz:Math.round(R.baseHz*.75*100)/100,peakGain:.06,durationSec:.15,cutoffHz:420}):u.status>=400&&h({position:M,wave:"triangle",startHz:196,secondHz:130.81,stepAtSec:.12,peakGain:.16,durationSec:.38,cutoffHz:210});break}case"notice":{(u.level==="warning"||u.level==="error")&&h({position:M,wave:"triangle",startHz:220,secondHz:196,stepAtSec:.1,peakGain:.11,durationSec:.26,cutoffHz:540});break}default:break}}}return{get gain(){return l},get muted(){return s},get unlocked(){return c!==null&&c.state==="running"},get activeGateCount(){return I.size},get activeTransientCount(){return c&&m(c.currentTime),y.size},async unlock(){let x=w();return x?(x.state!=="running"&&await x.resume().catch(()=>{}),b(),a&&x.state==="running"&&E(a,new Set),x.state==="running"):!1},setGain(x){l=xt(x),b()},setMuted(x){let v=!!x;return s===v||(s=v,b(),s?(S(!1),A()):a&&c&&c.state==="running"&&E(a,new Set)),s},toggleMuted(){return this.setMuted(!s)},setListenerPose(x){p=x,c&&!d&&At(c.listener,x,c.currentTime)},syncFrame:g,async dispose(){if(d)return;d=!0,S(!0),A();let x=c;c=null,i=null,x&&await x.close().catch(()=>{})}}}async function Tt({isSecureContext:e,xr:t=null}){if(!e)return Object.freeze({posture:"2d-insecure",vrSupported:!1,arSupported:!1});if(t!==null&&typeof t=="object"&&typeof t.isSessionSupported=="function"){let[o,n]=await Promise.all([Promise.resolve(t.isSessionSupported("immersive-ar")).then(Boolean,()=>!1),Promise.resolve(t.isSessionSupported("immersive-vr")).then(Boolean,()=>!1)]);return Object.freeze({posture:o?"immersive-ar":n?"immersive-vr":"2d",vrSupported:n,arSupported:o})}return Object.freeze({posture:"2d",vrSupported:!1,arSupported:!1})}var Ot=Object.freeze(["notifications/snapshot","notifications/resync","workspace/created","workspace/renamed","workspace/archived","config/changed","functionality/changed","session/created","session/archived","session/deleted","session/titled","session/policy","session/replied","loop/started","loop/parked","loop/proposal","loop/interaction","loop/gate-settled","loop/terminated","stream/concluded","notice/event"]),yn=96,D=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ue=e=>e==="root"||e==="work"||e==="fork"?e:null,_t=e=>e==="model"||e==="_plurnk"?e:null,F=(e,t)=>`${e}:${t}`,Me=(e,t,o)=>`${e}:${t}:${o}`,X=(e,t)=>`${e}#${t}`,ye=e=>e==="running"||e==="queued"||e==="parked";function wn(e){return e===100?"queued":e===102?"running":e===202?"parked":e===499?"cancelled":e>=400?"failed":"completed"}function ee(e,t=yn){let o=e.replaceAll(/\s+/gu," ").trim(),n=[...o];return n.length<=t?o:`${n.slice(0,Math.max(1,t-1)).join("")}\u2026`}function zt(e){let t=typeof e.op=="string"&&e.op.trim()!==""?e.op.trim():"proposal";if(D(e.subject)){if(e.subject.type==="command"&&typeof e.subject.command=="string"){let o=ee(e.subject.command);if(o!=="")return`${t}: ${o}`}if(e.subject.type==="tool_call"&&typeof e.subject.title=="string"){let o=ee(e.subject.title);if(o!=="")return o}}if(D(e.target)){let o=typeof e.target.scheme=="string"?e.target.scheme:"",n=typeof e.target.authority=="string"?e.target.authority:"",r=typeof e.target.pathname=="string"?e.target.pathname:"",l=ee(`${o?`${o}://`:""}${n}${r}`);if(l!=="")return`${t} ${l}`}return t}function Lt(e){if(D(e.request)){let t=typeof e.request.toolName=="string"?e.request.toolName.trim():"",o=typeof e.request.message=="string"?ee(e.request.message):"";if(t&&o)return`${t}: ${o}`;if(o)return o;if(t)return t}return"awaiting input"}function We(e){if(!D(e)||typeof e.id!="number")return null;let t=e.completion===200||e.completion===499?e.completion:void 0,o=typeof e.excerpt=="string"?ee(e.excerpt,140):"",n=o!==""&&e.continued===!0&&!o.endsWith("\u2026")?`${o}\u2026`:o;return{id:e.id,...typeof e.coordinate=="string"?{coordinate:e.coordinate}:{},...t!==void 0?{completion:t}:{},...typeof e.at=="number"?{at:e.at}:{},...n!==""?{excerpt:n}:{},...typeof e.continued=="boolean"?{continued:e.continued}:{}}}function ge(e,t,o){let n=0;for(let r of o.values())r.workspaceId===e&&r.sessionId===t&&(n+=1);return n}function He(e,t,o){let n=!1,r=new Map(o);for(let[l,s]of o)s.workspaceId===e&&t.has(s.sessionId)&&(r.delete(l),n=!0);return{nextGates:r,removedAny:n}}function Ne(){return{epoch:null,lastEventId:0,hydrated:!1,omitted:0,nextWorkspaceOrder:0,workspaces:new Map,sessions:new Map,gates:new Map}}function bn(e,t=null){let o=new Map,n=0,r=Array.isArray(e.workspaces)?e.workspaces:[];for(let i of r){if(!D(i)||typeof i.id!="number"||typeof i.name!="string")continue;let f=typeof i.projectRoot=="string"?i.projectRoot:null,y=typeof i.projectLabel=="string"?i.projectLabel:f;o.set(i.id,{id:i.id,name:i.name,projectRoot:f,projectLabel:y,archived:!1,order:n++})}let l=new Map,s=Array.isArray(e.sessions)?e.sessions:[];for(let i of s)D(i)&&typeof i.id=="number"&&typeof i.workspaceId=="number"&&typeof i.name=="string"&&l.set(i.id,{workspaceId:i.workspaceId,name:i.name});let d=new Map,p=Array.isArray(e.proposals)?e.proposals:[];for(let i of p){if(!D(i)||typeof i.logEntryId!="number"||typeof i.sessionId!="number"||D(i.disposition)&&i.disposition.decision!=="review")continue;let f=l.get(i.sessionId),y=f?.workspaceId??t;if(y===null)continue;let I=o.get(y)?.name??String(y),b=typeof i.session=="string"&&i.session!==""?i.session:f?.name??`session-${i.sessionId}`,w=Me("proposal",y,i.logEntryId);d.set(w,{key:w,kind:"proposal",workspaceId:y,sessionId:i.sessionId,itemId:i.logEntryId,address:X(I,b),summary:zt(i),...typeof i.op=="string"?{op:i.op}:{},...typeof i.expiresAt=="string"?{expiresAt:i.expiresAt}:{}})}let a=Array.isArray(e.interactions)?e.interactions:[];for(let i of a){if(!D(i)||typeof i.interactionId!="number"||typeof i.sessionId!="number")continue;let f=l.get(i.sessionId),y=f?.workspaceId??t;if(y===null)continue;let I=o.get(y)?.name??String(y),b=f?.name??`session-${i.sessionId}`,w=Me("interaction",y,i.interactionId);d.set(w,{key:w,kind:"interaction",workspaceId:y,sessionId:i.sessionId,itemId:i.interactionId,address:X(I,b),summary:Lt(i)})}let c=new Map;for(let i of s){if(!D(i)||typeof i.id!="number"||typeof i.workspaceId!="number"||typeof i.name!="string")continue;let f=o.get(i.workspaceId),y=typeof i.workspaceName=="string"?i.workspaceName:f?.name??String(i.workspaceId),I=f?.projectRoot??(typeof i.projectRoot=="string"?i.projectRoot:null),b=f?.projectLabel??(typeof i.projectLabel=="string"?i.projectLabel:I),w=typeof i.parentSessionId=="number"?i.parentSessionId:null,m=w===null?null:typeof i.parentName=="string"?i.parentName:"_plurnk",S=w===null?null:_t(i.parentOrigin)??"_plurnk",A=ge(i.workspaceId,i.id,d),E=typeof i.gates=="number"?i.gates:0,h=typeof i.title=="string"&&i.title.trim()!==""?i.title.trim():void 0,g=typeof i.opening=="string"&&i.opening.trim()!==""?ee(i.opening,140):void 0,x=typeof i.persona=="string"?i.persona:void 0;c.set(F(i.workspaceId,i.id),{workspaceId:i.workspaceId,workspaceName:y,projectRoot:I,projectLabel:b,id:i.id,name:i.name,parentSessionId:w,parentName:m,parentOrigin:S,kind:Ue(i.kind)??(w===null?"root":"work"),lifecycle:typeof i.lifecycle=="string"?i.lifecycle:"idle",gates:Math.max(E,A),archived:!1,...g!==void 0?{opening:g}:{},...h!==void 0?{title:h}:{},...x!==void 0?{persona:x}:{},reply:We(i.reply)})}return{epoch:typeof e.epoch=="string"?e.epoch:null,lastEventId:typeof e.latestId=="number"?e.latestId:0,hydrated:!0,omitted:typeof e.omitted=="number"?e.omitted:0,nextWorkspaceOrder:n,workspaces:o,sessions:c,gates:d}}function Nt(e,t){if(!D(t)||typeof t.event!="string"||!D(t.data))return{state:e,changed:!1,resyncRequired:!1,cues:[]};let{event:o,data:n}=t,r=typeof t.id=="number"?t.id:e.lastEventId,l=typeof t.timestamp=="number"?t.timestamp:0,s=typeof t.workspaceId=="number"?t.workspaceId:null;if(o==="notifications/snapshot")return{state:bn(n,s),changed:!0,resyncRequired:!1,cues:[]};if(o==="notifications/resync")return{state:{...e,epoch:typeof n.epoch=="string"?n.epoch:e.epoch,lastEventId:typeof n.latestId=="number"?n.latestId:r},changed:!1,resyncRequired:!0,cues:[]};let d=Math.max(e.lastEventId,r),p=(a=!1)=>({state:{...e,lastEventId:d},changed:!1,resyncRequired:a,cues:[]});switch(o){case"workspace/created":{let a=typeof n.id=="number"?n.id:s,c=typeof n.name=="string"?n.name:null;if(a===null||c===null)return p();let i=e.workspaces.get(a),f=typeof n.projectRoot=="string"?n.projectRoot:null,y=typeof n.projectLabel=="string"?n.projectLabel:f,I=new Map(e.workspaces);return I.set(a,{id:a,name:c,projectRoot:f,projectLabel:y,archived:!1,order:i?.order??e.nextWorkspaceOrder}),{state:{...e,lastEventId:d,nextWorkspaceOrder:i?e.nextWorkspaceOrder:e.nextWorkspaceOrder+1,workspaces:I},changed:!0,resyncRequired:!1,cues:[]}}case"workspace/renamed":{let a=typeof n.id=="number"?n.id:s,c=typeof n.name=="string"?n.name:null;if(a===null||c===null)return p();let i=e.workspaces.get(a),f=new Map(e.workspaces);f.set(a,{id:a,name:c,projectRoot:i?.projectRoot??null,projectLabel:i?.projectLabel??null,archived:i?.archived??!1,order:i?.order??e.nextWorkspaceOrder});let y=new Map(e.sessions),I=new Map;for(let[w,m]of y)m.workspaceId===a&&(I.set(m.id,m.name),m.workspaceName!==c&&y.set(w,{...m,workspaceName:c}));let b=new Map(e.gates);for(let[w,m]of b)if(m.workspaceId===a){let S=I.get(m.sessionId)??m.address.slice(m.address.indexOf("#")+1);b.set(w,{...m,address:X(c,S)})}return{state:{...e,lastEventId:d,nextWorkspaceOrder:i?e.nextWorkspaceOrder:e.nextWorkspaceOrder+1,workspaces:f,sessions:y,gates:b},changed:!0,resyncRequired:!1,cues:[]}}case"workspace/archived":{let a=typeof n.id=="number"?n.id:s;if(a===null)return p();let c=n.archivedAt!==null&&n.archivedAt!==void 0,i=e.workspaces.get(a),f=new Map(e.workspaces);i&&f.set(a,{...i,archived:c});let y=e.sessions,I=e.gates;if(c){let b=new Map(e.sessions),w=new Set;for(let[m,S]of e.sessions)S.workspaceId===a&&(b.delete(m),w.add(S.id));y=b,w.size>0&&(I=He(a,w,I).nextGates)}return{state:{...e,lastEventId:d,workspaces:f,sessions:y,gates:I},changed:!!i||y!==e.sessions,resyncRequired:!1,cues:[]}}case"session/created":{let a=typeof n.workspaceId=="number"?n.workspaceId:s,c=typeof n.id=="number"?n.id:typeof t.sessionId=="number"?t.sessionId:null,i=typeof n.name=="string"?n.name:null;if(a===null||c===null||i===null)return{state:{...e,lastEventId:d},changed:!1,resyncRequired:!1,cues:[]};let f=e.workspaces.get(a),y=typeof n.workspaceName=="string"?n.workspaceName:f?.name??String(a),I=typeof n.projectRoot=="string"?n.projectRoot:n.projectRoot===null?null:f?.projectRoot??null,b=typeof n.projectLabel=="string"?n.projectLabel:n.projectLabel===null?null:f?.projectLabel??I,w=new Map(e.workspaces);w.set(a,{id:a,name:y,projectRoot:I,projectLabel:b,archived:!1,order:f?.order??e.nextWorkspaceOrder});let m=f?e.nextWorkspaceOrder:e.nextWorkspaceOrder+1;if(n.origin!=="model")return{state:{...e,lastEventId:d,nextWorkspaceOrder:m,workspaces:w},changed:!f,resyncRequired:!1,cues:[]};let S=F(a,c),A=e.sessions.get(S),E=typeof n.parentSessionId=="number"?n.parentSessionId:null,h=E!==null?e.sessions.get(F(a,E)):void 0,g=E===null?null:h?.name??A?.parentName??"_plurnk",x=E===null?null:h!==void 0?"model":A?.parentOrigin??"_plurnk",v=Ue(n.kind)??(E===null?"root":"work"),z=ge(a,c,e.gates),k=A?.opening??(v==="fork"?h?.opening:void 0),u=typeof n.persona=="string"?n.persona:A?.persona,O=new Map(e.sessions);O.set(S,{workspaceId:a,workspaceName:y,projectRoot:I,projectLabel:b,id:c,name:i,parentSessionId:E,parentName:g,parentOrigin:x,kind:v,lifecycle:A?.lifecycle&&A.lifecycle!=="idle"?A.lifecycle:typeof n.lifecycle=="string"?n.lifecycle:"idle",gates:z,archived:!1,...k!==void 0?{opening:k}:{},...A?.title!==void 0?{title:A.title}:{},...u!==void 0?{persona:u}:{},reply:A?.reply??null});for(let[M,R]of O)R.workspaceId===a&&R.parentSessionId===c&&(R.parentName!==i||R.parentOrigin!=="model")&&O.set(M,{...R,parentName:i,parentOrigin:"model"});return{state:{...e,lastEventId:d,nextWorkspaceOrder:m,workspaces:w,sessions:O},changed:!0,resyncRequired:!1,cues:[]}}case"session/archived":case"session/deleted":{if(s===null||o==="session/archived"&&(n.archivedAt===null||n.archivedAt===void 0))return p();let a=Array.isArray(n.sessionIds)?n.sessionIds:[],c=new Set;for(let I of a)typeof I=="number"&&c.add(I);let i=new Map(e.sessions),f=!1;for(let I of c)i.delete(F(s,I))&&(f=!0);let y=He(s,c,e.gates);return{state:{...e,lastEventId:d,sessions:i,gates:y.nextGates},changed:f||y.removedAny,resyncRequired:!1,cues:[]}}case"session/titled":{if(s===null||typeof n.id!="number"||typeof n.title!="string")return p();let a=F(s,n.id),c=e.sessions.get(a);if(!c)return p(e.omitted>0);let i=n.title.trim();if((c.title??"")===i)return p();let f=new Map(e.sessions);return f.set(a,{...c,title:i}),{state:{...e,lastEventId:d,sessions:f},changed:!0,resyncRequired:!1,cues:[]}}case"session/policy":{if(s===null||typeof n.sessionId!="number"||!("persona"in n))return p();let a=F(s,n.sessionId),c=e.sessions.get(a);if(!c)return p(e.omitted>0);let i=typeof n.persona=="string"?n.persona:void 0;if((c.persona??void 0)===i)return p();let f=new Map(e.sessions),{persona:y,...I}=c;return f.set(a,i!==void 0?{...I,persona:i}:I),{state:{...e,lastEventId:d,sessions:f},changed:!0,resyncRequired:!1,cues:[]}}case"session/replied":{if(s===null||typeof n.sessionId!="number")return p();let a=We(n.reply);if(a===null)return p();let c=F(s,n.sessionId),i=e.sessions.get(c);if(!i)return p(e.omitted>0);if(i.reply!==null&&i.reply.id>=a.id)return p();let f=new Map(e.sessions);f.set(c,{...i,reply:a});let y=X(i.workspaceName,i.name),I=a.excerpt?[{kind:"replied",timestamp:l,workspaceId:s,sessionId:i.id,address:y,completion:a.completion??200,excerpt:a.excerpt}]:[];return{state:{...e,lastEventId:d,sessions:f},changed:!0,resyncRequired:!1,cues:I}}case"loop/started":case"loop/parked":{if(s===null||typeof n.sessionId!="number")return p();let a=F(s,n.sessionId),c=e.sessions.get(a),i=o==="loop/started"&&typeof n.opening=="string"&&n.opening.trim()!==""?ee(n.opening,140):void 0,f=o==="loop/started"&&D(n.session)?n.session:null;if(f!==null&&typeof f.id=="number"&&typeof f.name=="string"){let A=f.id,E=f.name,h=e.workspaces.get(s),g=h?.name??c?.workspaceName??String(s),x=h?.projectRoot??c?.projectRoot??null,v=h?.projectLabel??c?.projectLabel??x,z=typeof f.parentSessionId=="number"?f.parentSessionId:null,k=z===null?null:typeof f.parentName=="string"?f.parentName:"_plurnk",u=z===null?null:_t(f.parentOrigin)??"_plurnk",O=typeof f.gates=="number"?f.gates:0,M=Math.max(O,ge(s,A,e.gates)),R=typeof f.opening=="string"&&f.opening.trim()!==""?ee(f.opening,140):void 0,_=c?.opening??R??i,j=We(f.reply),P=c?.reply!==null&&c?.reply!==void 0&&(j===null||c.reply.id>j.id)?c.reply:j,C=typeof f.title=="string"&&f.title.trim()!==""?f.title.trim():c?.title,N=typeof f.persona=="string"&&f.persona!==""?f.persona:f.persona===null?void 0:c?.persona,U=new Map(e.sessions);U.set(a,{workspaceId:s,workspaceName:g,projectRoot:x,projectLabel:v,id:A,name:E,parentSessionId:z,parentName:k,parentOrigin:u,kind:Ue(f.kind)??(z===null?"root":"work"),lifecycle:"running",gates:M,archived:!1,..._!==void 0?{opening:_}:{},...C!==void 0?{title:C}:{},...N!==void 0?{persona:N}:{},reply:P});let W=!c&&e.omitted>0?e.omitted-1:e.omitted,$=X(g,E);return{state:{...e,lastEventId:d,omitted:W,sessions:U},changed:!0,resyncRequired:!1,cues:[{kind:"activity",timestamp:l,workspaceId:s,sessionId:A,address:$,source:"loop/started",...i!==void 0?{detail:i}:{}}]}}if(!c)return p(e.omitted>0);let y=o==="loop/parked"?"parked":"running",I=c.opening??i,b=new Map(e.sessions),w=c.lifecycle!==y||c.opening!==I;w&&b.set(a,{...c,lifecycle:y,...I!==void 0?{opening:I}:{}});let m=X(c.workspaceName,c.name),S=o==="loop/started"?[{kind:"activity",timestamp:l,workspaceId:s,sessionId:c.id,address:m,source:"loop/started",...i!==void 0?{detail:i}:{}}]:[{kind:"terminated",timestamp:l,workspaceId:s,sessionId:c.id,address:m,status:202,lifecycle:"parked"}];return{state:{...e,lastEventId:d,...w?{sessions:b}:{}},changed:w,resyncRequired:!1,cues:S}}case"loop/proposal":{if(s===null||typeof n.sessionId!="number"||typeof n.logEntryId!="number"||!D(n.disposition)||n.disposition.decision!=="review")return p();let a=F(s,n.sessionId),c=e.sessions.get(a);if(!c&&e.omitted>0)return p(!0);let i=c?.workspaceName??e.workspaces.get(s)?.name??String(s),f=typeof n.session=="string"&&n.session!==""?n.session:c?.name??`session-${n.sessionId}`,y=X(i,f),I=zt(n),b=Me("proposal",s,n.logEntryId),w=e.gates.has(b),m=new Map(e.gates);m.set(b,{key:b,kind:"proposal",workspaceId:s,sessionId:n.sessionId,itemId:n.logEntryId,address:y,summary:I,...typeof n.op=="string"?{op:n.op}:{},...typeof n.expiresAt=="string"?{expiresAt:n.expiresAt}:{}});let S=new Map(e.sessions);c&&S.set(a,{...c,lifecycle:"running",gates:ge(s,c.id,m)});let A=w?[]:[{kind:"gate-opened",timestamp:l,workspaceId:s,sessionId:n.sessionId,address:y,gateKey:b,gateKind:"proposal",summary:I}];return{state:{...e,lastEventId:d,gates:m,sessions:S},changed:!0,resyncRequired:!1,cues:A}}case"loop/interaction":{if(s===null||typeof n.sessionId!="number"||typeof n.interactionId!="number")return p();let a=F(s,n.sessionId),c=e.sessions.get(a);if(!c&&e.omitted>0)return p(!0);let i=c?.workspaceName??e.workspaces.get(s)?.name??String(s),f=c?.name??`session-${n.sessionId}`,y=X(i,f),I=Lt(n),b=Me("interaction",s,n.interactionId),w=e.gates.has(b),m=new Map(e.gates);m.set(b,{key:b,kind:"interaction",workspaceId:s,sessionId:n.sessionId,itemId:n.interactionId,address:y,summary:I});let S=new Map(e.sessions);c&&S.set(a,{...c,lifecycle:"running",gates:ge(s,c.id,m)});let A=w?[]:[{kind:"gate-opened",timestamp:l,workspaceId:s,sessionId:n.sessionId,address:y,gateKey:b,gateKind:"interaction",summary:I}];return{state:{...e,lastEventId:d,gates:m,sessions:S},changed:!0,resyncRequired:!1,cues:A}}case"loop/gate-settled":{if(s===null||typeof n.sessionId!="number")return p();let a=n.kind==="proposal"?"proposal":n.kind==="interaction"?"interaction":null,c=a==="proposal"?typeof n.logEntryId=="number"?n.logEntryId:null:a==="interaction"&&typeof n.interactionId=="number"?n.interactionId:null;if(a===null||c===null)return p();let i=Me(a,s,c),f=e.gates.get(i);if(!f)return p();let y=new Map(e.gates);y.delete(i);let I=F(s,n.sessionId),b=e.sessions.get(I),w=e.sessions;if(b){let S=ge(s,b.id,y);if(b.gates!==S){let A=new Map(e.sessions);A.set(I,{...b,gates:S}),w=A}}let m=a==="proposal"?typeof n.decision=="string"?n.decision:"settled":typeof n.action=="string"?n.action:"settled";return{state:{...e,lastEventId:d,gates:y,sessions:w},changed:!0,resyncRequired:!1,cues:[{kind:"gate-settled",timestamp:l,workspaceId:s,sessionId:n.sessionId,address:f.address,gateKey:i,gateKind:a,resolution:m}]}}case"loop/terminated":{if(s===null||typeof n.sessionId!="number")return p();let a=F(s,n.sessionId),c=e.sessions.get(a);if(!c)return p(e.omitted>0);let i=D(n.result)&&typeof n.result.status=="number"?n.result.status:200,f=wn(i),y=He(s,new Set([c.id]),e.gates),I=e.sessions,b=y.removedAny;if(c.lifecycle!==f||c.gates!==0){let m=new Map(e.sessions);m.set(a,{...c,lifecycle:f,gates:0}),I=m,b=!0}let w=X(c.workspaceName,c.name);return{state:{...e,lastEventId:d,gates:y.nextGates,sessions:I},changed:b,resyncRequired:!1,cues:[{kind:"terminated",timestamp:l,workspaceId:s,sessionId:c.id,address:w,status:i,lifecycle:f}]}}case"stream/concluded":{if(s===null||typeof n.sessionId!="number")return p();let a=e.sessions.get(F(s,n.sessionId));if(!a)return p();let c=typeof n.summary=="string"&&n.summary.trim()!==""?ee(n.summary):void 0;return{state:{...e,lastEventId:d},changed:!1,resyncRequired:!1,cues:[{kind:"activity",timestamp:l,workspaceId:s,sessionId:a.id,address:X(a.workspaceName,a.name),source:"stream/concluded",...c!==void 0?{detail:c}:{}}]}}case"notice/event":{let a=D(n.notice)?n.notice:null,c=a&&typeof a.message=="string"?ee(a.message):"";if(c==="")return p();let i=a&&typeof a.level=="string"?a.level:"info",f=typeof n.sessionId=="number"?n.sessionId:null,y=s!==null&&f!==null?e.sessions.get(F(s,f)):void 0,I=s!==null?e.workspaces.get(s):void 0,b=y?X(y.workspaceName,y.name):I?I.name:null;return{state:{...e,lastEventId:d},changed:!1,resyncRequired:!1,cues:[{kind:"notice",timestamp:l,workspaceId:s,sessionId:f,address:b,level:i,message:c}]}}default:return p()}}var Je=Math.PI/180,Ve=1.35,Ke=1.85,Xe=.28,vn=4,Ye=Object.freeze([-38,38,-58,58,-78,78,-98,98,-116,116,-134,134]),we=e=>Math.round(e*1e4)/1e4;function Te(e,t,o){return Object.freeze({x:we(o*Math.sin(e)),y:we(t),z:we(-o*Math.cos(e))})}function kn(e,t){return e.parentSessionId===null&&e.kind==="root"&&e.lifecycle==="idle"&&e.reply===null&&e.opening===void 0&&e.title===void 0&&e.gates===0&&!t}function In(e){let t=Math.floor(e/2)+1;return{dAzimuthRad:(e%2===0?1:-1)*t*5.5*Je,dElevationM:e%3===0?.14:e%3===1?-.13:.22,dRadiusM:-.06}}function xn(e){let t=e*2.399963229728653;return{dAzimuthRad:Math.cos(t)*3.2*Je,dElevationM:Math.sin(t)*.11,dRadiusM:-.05}}function jt({calloutMs:e=8e3,activityHoldMs:t=4e3,initialVisibility:o="on"}={}){let n=o,r=new Map,l=0,s=new Map,d=new Map,p=new Map,a=[],c=1;function i(b){let w=r.get(b);w===void 0&&(w=l++,r.set(b,w));let m=Ye[w%Ye.length],S=Math.floor(w/Ye.length);return{azimuthRad:m*Je,elevationM:Ve+S*.28,radiusM:Ke}}function f(b,w){for(let m of b)m.workspaceId!==null&&m.sessionId!==null&&p.set(F(m.workspaceId,m.sessionId),w),m.kind==="replied"?y({tone:"reply",workspaceId:m.workspaceId,sessionKey:F(m.workspaceId,m.sessionId),address:m.address,text:m.excerpt,nowMs:w}):m.kind==="terminated"&&m.status!==202&&m.status!==499?y({tone:m.status>=400?"failed":"completed",workspaceId:m.workspaceId,sessionKey:F(m.workspaceId,m.sessionId),address:m.address,text:m.status>=400?`failed (${m.status})`:"completed",nowMs:w}):m.kind==="notice"&&(m.level==="warning"||m.level==="error")&&y({tone:"notice",workspaceId:m.workspaceId,sessionKey:m.workspaceId!==null&&m.sessionId!==null?F(m.workspaceId,m.sessionId):null,address:m.address??"plurnk",text:m.message,nowMs:w})}function y({tone:b,workspaceId:w,sessionKey:m,address:S,text:A,nowMs:E}){for(;a.length>=vn;)a.shift();a.push({id:`transient:${c++}`,tone:b,workspaceId:w,sessionKey:m,address:S,text:A,expiresAtMs:E+e})}function I(b,w){for(let u=a.length-1;u>=0;u-=1)a[u].expiresAtMs<=w&&a.splice(u,1);let m=[...b.workspaces.values()].filter(u=>!u.archived).toSorted((u,O)=>u.order-O.order||u.id-O.id),S=new Set(m.map(u=>u.id)),A=new Set;for(let u of b.sessions.values())!u.archived&&S.has(u.workspaceId)&&u.parentSessionId!==null&&A.add(F(u.workspaceId,u.parentSessionId));let E=new Map,h=0;for(let u of b.sessions.values()){if(u.archived||!S.has(u.workspaceId))continue;let O=F(u.workspaceId,u.id);if(kn(u,A.has(O)))continue;(ye(u.lifecycle)||u.gates>0)&&(h+=1);let M=E.get(u.workspaceId)??[];M.push(u),E.set(u.workspaceId,M)}let g=[],x=new Map,v=new Map;for(let u of m){let O=Le(u.id),M=s.get(u.name)??i(u.name),R=`workspace:${u.id}`,_=(E.get(u.id)??[]).toSorted((L,q)=>L.id-q.id),j=0,P=!1,C=0;for(let L of _){j+=L.gates,ye(L.lifecycle)&&(P=!0);let q=p.get(F(u.id,L.id));q!==void 0&&w-q<t&&(C=Math.max(C,1-(w-q)/t))}let N=j>0||P||C>0,U=n==="off"?0:n==="passive"?N?1:0:N?1:Xe,W=Object.freeze({id:R,kind:"workspace",workspaceId:u.id,workspaceName:u.name,sessionId:null,address:u.name,label:u.name,tetherTo:null,swatch:O,lifecycle:P?"running":"idle",gates:j,azimuthRad:M.azimuthRad,elevationM:M.elevationM,radiusM:M.radiusM,position:Te(M.azimuthRad,M.elevationM,M.radiusM),targetOpacity:U,pulseStrength:we(C)});g.push(W),v.set(u.id,W);let $=_.filter(L=>L.parentSessionId===null||!_.some(q=>q.id===L.parentSessionId)),T=_.filter(L=>L.parentSessionId!==null&&_.some(q=>q.id===L.parentSessionId)),Y=new Set;for(let L of T){let q=F(u.id,L.id),G=p.get(q);(L.gates>0||ye(L.lifecycle)||G!==void 0&&w-G<t)&&L.parentSessionId!==null&&Y.add(L.parentSessionId)}$.forEach((L,q)=>{let G=X(u.name,L.name),K=d.get(G)??In(q),ne=M.azimuthRad+K.dAzimuthRad,fe=M.elevationM+K.dElevationM,Ie=Math.max(.5,M.radiusM+K.dRadiusM),xe=F(u.id,L.id),pe=p.get(xe),Ae=pe!==void 0&&w-pe<t?1-(w-pe)/t:0,me=L.gates>0||ye(L.lifecycle)||Ae>0||Y.has(L.id),_e=n==="off"?0:n==="passive"?me?1:0:me?1:Xe,Se=Object.freeze({id:`session:${u.id}:${L.id}`,kind:"session",workspaceId:u.id,workspaceName:u.name,sessionId:L.id,address:G,label:L.title??L.name,tetherTo:R,swatch:O,lifecycle:L.lifecycle,gates:L.gates,azimuthRad:ne,elevationM:fe,radiusM:Ie,position:Te(ne,fe,Ie),targetOpacity:_e,pulseStrength:we(Ae)});g.push(Se),x.set(xe,Se)});let te=new Map;for(let L of T){let q=L.parentSessionId,G=x.get(F(u.id,q))??W,K=te.get(q)??0;te.set(q,K+1);let ne=X(u.name,L.name),fe=d.get(ne)??xn(K),Ie=G.azimuthRad+fe.dAzimuthRad,xe=G.elevationM+fe.dElevationM,pe=Math.max(.5,G.radiusM+fe.dRadiusM),Ae=F(u.id,L.id),me=p.get(Ae),_e=me!==void 0&&w-me<t?1-(w-me)/t:0,Se=L.gates>0||ye(L.lifecycle)||_e>0,Yt=n==="off"?0:n==="passive"?Se?1:0:Se?1:Xe,ot=Object.freeze({id:`session:${u.id}:${L.id}`,kind:"satellite",workspaceId:u.id,workspaceName:u.name,sessionId:L.id,address:ne,label:L.title??L.name,tetherTo:G.id,swatch:O,lifecycle:L.lifecycle,gates:L.gates,azimuthRad:Ie,elevationM:xe,radiusM:pe,position:Te(Ie,xe,pe),targetOpacity:Yt,pulseStrength:we(_e)});g.push(ot),x.set(Ae,ot)}}let z=[...b.gates.values()].filter(u=>S.has(u.workspaceId)),k=[];if(n!=="off"){for(let u of z){let O=x.get(F(u.workspaceId,u.sessionId))??v.get(u.workspaceId),M=Te(0,Ve,Ke);k.push(Object.freeze({id:`gate:${u.key}`,pinned:!0,tone:"gate",address:u.address,text:u.summary,swatch:ie.gate,position:O?.position??M,expiresAtMs:null}))}for(let u of a){let O=(u.sessionKey?x.get(u.sessionKey):void 0)??(u.workspaceId!==null?v.get(u.workspaceId):void 0),M=u.tone==="failed"?ie.failed:O?.swatch??ie.gate,R=Te(0,Ve,Ke);k.push(Object.freeze({id:u.id,pinned:!1,tone:u.tone,address:u.address,text:u.text,swatch:M,position:O?.position??R,expiresAtMs:u.expiresAtMs}))}}return Object.freeze({visibilityMode:n,nodes:Object.freeze(g),callouts:Object.freeze(k),counts:Object.freeze({workspaces:m.length,activeSessions:h,openGates:z.length})})}return{get visibilityMode(){return n},setVisibilityMode(b){(b==="on"||b==="passive"||b==="off")&&(n=b)},cycleVisibilityMode(){return n=n==="on"?"passive":n==="passive"?"off":"on",n},setWorkspaceAnchor(b,w){s.set(b,{azimuthRad:w.azimuthRad,elevationM:w.elevationM,radiusM:Math.max(.5,w.radiusM)})},setSessionOffset(b,w){d.set(b,{dAzimuthRad:w.dAzimuthRad,dElevationM:w.dElevationM,dRadiusM:w.dRadiusM})},resetLayout(){s.clear(),d.clear()},exportLayout(){return{workspaces:Object.fromEntries(s),sessions:Object.fromEntries(d)}},importLayout(b){if(D(b)){if(D(b.workspaces))for(let[w,m]of Object.entries(b.workspaces))D(m)&&typeof m.azimuthRad=="number"&&typeof m.elevationM=="number"&&typeof m.radiusM=="number"&&s.set(w,{azimuthRad:m.azimuthRad,elevationM:m.elevationM,radiusM:Math.max(.5,m.radiusM)});if(D(b.sessions))for(let[w,m]of Object.entries(b.sessions))D(m)&&typeof m.dAzimuthRad=="number"&&typeof m.dElevationM=="number"&&typeof m.dRadiusM=="number"&&d.set(w,{dAzimuthRad:m.dAzimuthRad,dElevationM:m.dElevationM,dRadiusM:m.dRadiusM})}},ingestCues:f,project:I}}var be=11,ve=7,Ze=Object.freeze({workspace:.085,session:.052,satellite:.032}),An=1.16,Sn=.18,En=1.4,Ct=.018,Rn=.65;function Qe(e){return e==="workspace"?Ze.workspace:e==="session"?Ze.session:Ze.satellite}function Pt(e,t,o){let n=t[0],r=t[1],l=t[2],s=t[3],d=t[4],p=t[5],a=t[6],c=t[7],i=t[8],f=t[9],y=t[10],I=t[11],b=t[12],w=t[13],m=t[14],S=t[15];for(let A=0;A<4;A+=1){let E=A*4,h=o[E],g=o[E+1],x=o[E+2],v=o[E+3];e[E]=n*h+d*g+i*x+b*v,e[E+1]=r*h+p*g+f*x+w*v,e[E+2]=l*h+a*g+y*x+m*v,e[E+3]=s*h+c*g+I*x+S*v}return e}function ke(e,t,o,n){let r=Math.hypot(e,t,o);return r<1e-6?n:{x:e/r||0,y:t/r||0,z:o/r||0}}function Ft(e){return{right:ke(e[0],e[1],e[2],{x:1,y:0,z:0}),up:ke(e[4],e[5],e[6],{x:0,y:1,z:0})}}function $t(e){return{position:{x:e[12],y:e[13],z:e[14]},forward:ke(-e[8],-e[9],-e[10],{x:0,y:0,z:-1}),up:ke(e[4],e[5],e[6],{x:0,y:1,z:0})}}function Bt(){let e=new Map,t=32,o=new Float32Array(t*be),n=64,r=new Float32Array(n*ve);function l(a){if(!(a<=t)){for(;t<a;)t*=2;o=new Float32Array(t*be)}}function s(a){if(!(a<=n)){for(;n<a;)n*=2;r=new Float32Array(n*ve)}}function d({frame:a,cues:c=[],dtSec:i,timeSec:f,hoveredNodeId:y=null,grabbedNodeId:I=null,pointerRay:b=null}){let w=Number.isFinite(i)?Math.min(.25,Math.max(0,i)):.016,m=w===0?1:1-Math.exp(-w/Sn),S=w===0?1:Math.exp(-w/En),A=new Set;for(let k of a.nodes){A.add(k.id);let u=k.gates>0?1:0,O=k.position.x,M=k.position.y,R=k.position.z;if(k.kind==="satellite"&&k.lifecycle==="running"&&I!==k.id){let j=f*Rn+(k.sessionId??0)*1.7,P=Math.cos(k.azimuthRad),C=Math.sin(k.azimuthRad),N=Math.cos(j)*Ct,U=Math.sin(j)*Ct;O+=P*N,M+=U,R+=C*N}let _=e.get(k.id);if(!_)e.set(k.id,{kind:k.kind,workspaceId:k.workspaceId,sessionId:k.sessionId,tetherTo:k.tetherTo,lifecycle:k.lifecycle,x:O,y:M,z:R,rgb:k.swatch.rgb,opacity:w===0?k.targetOpacity:k.targetOpacity*m,pulseStrength:k.pulseStrength,gateFactor:w===0?u:u*m,failFactor:0});else{let j=I===k.id?Math.max(m,.65):m;_.kind=k.kind,_.workspaceId=k.workspaceId,_.sessionId=k.sessionId,_.tetherTo=k.tetherTo,_.lifecycle=k.lifecycle,_.rgb=k.swatch.rgb,_.x+=(O-_.x)*j,_.y+=(M-_.y)*j,_.z+=(R-_.z)*j,_.opacity+=(k.targetOpacity-_.opacity)*m,_.pulseStrength=k.pulseStrength,_.gateFactor+=(u-_.gateFactor)*m,_.failFactor*=S}}for(let k of c)if(k.kind==="terminated"&&k.status>=400&&k.status!==499){let u=e.get(`session:${k.workspaceId}:${k.sessionId}`);u&&(u.failFactor=1);let O=e.get(`workspace:${k.workspaceId}`);O&&(O.failFactor=Math.max(O.failFactor,.6))}for(let[k,u]of e)A.has(k)||(u.opacity+=(0-u.opacity)*m,u.gateFactor*=1-m,u.failFactor*=S,u.opacity<.004&&e.delete(k));let E=[];for(let[k,u]of e)u.opacity>.004&&E.push([k,u]);l(E.length);let h=0;for(let[k,u]of E){let O=k===y||k===I,M=Qe(u.kind)*(O?An:1);o[h]=u.x,o[h+1]=u.y,o[h+2]=u.z,o[h+3]=M,o[h+4]=u.rgb[0],o[h+5]=u.rgb[1],o[h+6]=u.rgb[2],o[h+7]=Math.min(1,O?Math.max(u.opacity,.92):u.opacity),o[h+8]=O?Math.max(u.pulseStrength,.35):u.pulseStrength,o[h+9]=u.gateFactor,o[h+10]=u.failFactor,h+=be}let g=E.length+(b?1:0);s(g*2);let x=0,v=0,z=ie.gate.rgb;for(let[,k]of E){if(k.tetherTo===null)continue;let u=e.get(k.tetherTo);if(!u||u.opacity<=.004)continue;let O=Math.min(u.opacity,k.opacity)*.36,M=Math.min(u.opacity,k.opacity)*.58,R=k.rgb[0]+(z[0]-k.rgb[0])*k.gateFactor*.65,_=k.rgb[1]+(z[1]-k.rgb[1])*k.gateFactor*.65,j=k.rgb[2]+(z[2]-k.rgb[2])*k.gateFactor*.65;r[v]=u.x,r[v+1]=u.y,r[v+2]=u.z,r[v+3]=u.rgb[0],r[v+4]=u.rgb[1],r[v+5]=u.rgb[2],r[v+6]=O,r[v+7]=k.x,r[v+8]=k.y,r[v+9]=k.z,r[v+10]=R,r[v+11]=_,r[v+12]=j,r[v+13]=M,v+=ve*2,x+=2}if(b){let{origin:k,direction:u,lengthM:O,hovered:M}=b,R=k.x+u.x*O,_=k.y+u.y*O,j=k.z+u.z*O,P=M?.45:.65,C=M?.95:.82,N=M?.55:.78;r[v]=k.x,r[v+1]=k.y,r[v+2]=k.z,r[v+3]=P,r[v+4]=C,r[v+5]=N,r[v+6]=M?.42:.22,r[v+7]=R,r[v+8]=_,r[v+9]=j,r[v+10]=P,r[v+11]=C,r[v+12]=N,r[v+13]=M?.78:0,x+=2}return{orbCount:E.length,orbData:o.subarray(0,E.length*be),lineVertexCount:x,lineData:r.subarray(0,x*ve)}}function p(){e.clear()}return{step:d,reset:p}}var et=.9,tt=3.2,Mn=.35,Tn=2.65,On=1.65,_n=.055,zn=.18,Ln=1.35,Nn=1.85,Ce=(e,t,o)=>e<t?t:e>o?o:e;function jn(e){let t=e%(Math.PI*2);return t>Math.PI&&(t-=Math.PI*2),t<-Math.PI&&(t+=Math.PI*2),t}function Cn(e){let t=Math.hypot(e.x,e.z),o=Ce(t,et,tt),n=t<1e-5?0:Math.atan2(e.x,-e.z),r=Ce(e.y,Mn,Tn);return{azimuthRad:n,elevationM:r,radiusM:o}}function Pn(e){return{origin:{x:e[12],y:e[13],z:e[14]},direction:ke(-e[8],-e[9],-e[10],{x:0,y:0,z:-1})}}function Fn(e){return e==="satellite"?0:e==="session"?1:2}function $n(e,t){let{origin:o,direction:n}=e,r=null;for(let l of t){if(l.targetOpacity<=.01)continue;let s=Math.max(_n,Qe(l.kind)*On),d=o.x-l.position.x,p=o.y-l.position.y,a=o.z-l.position.z,c=d*n.x+p*n.y+a*n.z,i=d*d+p*p+a*a-s*s,f=c*c-i;if(f<0)continue;let y=Math.sqrt(f),I=-c-y,b=-c+y,w=I>=.05?I:b>=.05?b:-1;if(w<.05||w>5)continue;let m=Math.max(.05,-c),S=Fn(l.kind);(r===null||S<r.tier||S===r.tier&&m<r.distanceM)&&(r={node:l,distanceM:m,tier:S})}return r?{node:r.node,distanceM:r.distanceM}:null}function je(e,t,o){try{let n=e.gamepad?.hapticActuators?.[0]?.pulse?.(t,o);n&&typeof n.catch=="function"&&n.catch(()=>{})}catch{}}function Dt({topology:e,audio:t,onVisibilityChange:o,onMuteChange:n,onLayoutCommit:r}){let l=new WeakMap,s=null,d=null;function p(){s!==null&&(s=null,r?.()),d=null}function a({session:c,frame:i,refSpace:f,worldFrame:y,dtSec:I}){if(c.visibilityState!=="visible")return p(),{layoutMutated:!1,visibilityMutated:!1,hoveredNodeId:null,grabbedNodeId:null,pointerRay:null};let b=Number.isFinite(I)?Math.min(.1,Math.max(0,I)):.016,w=!1,m=!1,S=[];for(let g of c.inputSources??[]){if(g.targetRayMode!=="tracked-pointer"||g.hand)continue;let x=l.get(g)??{trigger:!1,primaryFace:!1,secondaryFace:!1},v=g.gamepad?.buttons??[],z=!!v[0]?.pressed,k=!!v[4]?.pressed,u=!!v[5]?.pressed;if(k&&!x.primaryFace){let M=e.cycleVisibilityMode();m=!0,je(g,.2,12),o?.(M)}if(u&&!x.secondaryFace){let M=t.toggleMuted();je(g,.2,12),n?.(M)}let O=g.targetRaySpace?i.getPose(g.targetRaySpace,f):null;O?.transform?.matrix&&S.push({source:g,ray:Pn(O.transform.matrix)}),s&&s.source===g&&!z&&(s=null,r?.()),l.set(g,{trigger:z,primaryFace:k,secondaryFace:u})}if(s&&!S.some(g=>g.source===s?.source)&&(s=null,r?.()),s){let g=S.find(x=>x.source===s?.source);if(g){let x=g.source.gamepad?.axes?.[3]??0;Math.abs(x)>zn&&(s.grabDistanceM=Ce(s.grabDistanceM-x*Ln*b,et,tt));let v={x:g.ray.origin.x+g.ray.direction.x*s.grabDistanceM,y:g.ray.origin.y+g.ray.direction.y*s.grabDistanceM,z:g.ray.origin.z+g.ray.direction.z*s.grabDistanceM},z=Cn(v);if(s.kind==="workspace")e.setWorkspaceAnchor(s.workspaceName,z),w=!0;else{let k=s.tetherTo?y.nodes.find(u=>u.id===s?.tetherTo):void 0;k&&(e.setSessionOffset(s.address,{dAzimuthRad:jn(z.azimuthRad-k.azimuthRad),dElevationM:z.elevationM-k.elevationM,dRadiusM:z.radiusM-k.radiusM}),w=!0)}return d=s.nodeId,{layoutMutated:w,visibilityMutated:m,hoveredNodeId:d,grabbedNodeId:s.nodeId,pointerRay:{origin:g.ray.origin,direction:g.ray.direction,lengthM:s.grabDistanceM,hovered:!0}}}}let A=null;for(let g of S){let x=$n(g.ray,y.nodes);(A===null||x!==null&&A.hit===null||x!==null&&A.hit!==null&&x.distanceM<A.hit.distanceM)&&(A={source:g.source,ray:g.ray,hit:x})}if(!A)return d=null,{layoutMutated:w,visibilityMutated:m,hoveredNodeId:null,grabbedNodeId:null,pointerRay:null};let E=A.hit?.node.id??null;if(E!==null&&E!==d&&je(A.source,.16,10),d=E,!!A.source.gamepad?.buttons?.[0]?.pressed&&A.hit!==null){let g=A.hit.node;s={source:A.source,nodeId:g.id,kind:g.kind,workspaceName:g.workspaceName,address:g.address,tetherTo:g.tetherTo,grabDistanceM:Ce(A.hit.distanceM,et,tt)},je(A.source,.28,16)}return{layoutMutated:w,visibilityMutated:m,hoveredNodeId:d,grabbedNodeId:s?.nodeId??null,pointerRay:{origin:A.ray.origin,direction:A.ray.direction,lengthM:A.hit?.distanceM??Nn,hovered:A.hit!==null}}}return{update:a,reset:p}}var Bn=`#version 300 es
|
|
2
|
+
precision highp float;
|
|
3
|
+
|
|
4
|
+
layout(location = 0) in vec2 a_quad;
|
|
5
|
+
layout(location = 1) in vec4 i_sphere;
|
|
6
|
+
layout(location = 2) in vec4 i_color;
|
|
7
|
+
layout(location = 3) in vec3 i_salience;
|
|
8
|
+
|
|
9
|
+
uniform mat4 u_viewProj;
|
|
10
|
+
uniform vec3 u_camRight;
|
|
11
|
+
uniform vec3 u_camUp;
|
|
12
|
+
|
|
13
|
+
out vec2 v_uv;
|
|
14
|
+
out vec4 v_color;
|
|
15
|
+
out vec3 v_salience;
|
|
16
|
+
|
|
17
|
+
void main() {
|
|
18
|
+
v_uv = a_quad;
|
|
19
|
+
v_color = i_color;
|
|
20
|
+
v_salience = i_salience;
|
|
21
|
+
vec3 worldPos = i_sphere.xyz + (u_camRight * a_quad.x + u_camUp * a_quad.y) * i_sphere.w;
|
|
22
|
+
gl_Position = u_viewProj * vec4(worldPos, 1.0);
|
|
23
|
+
}
|
|
24
|
+
`,Dn=`#version 300 es
|
|
25
|
+
precision highp float;
|
|
26
|
+
|
|
27
|
+
in vec2 v_uv;
|
|
28
|
+
in vec4 v_color;
|
|
29
|
+
in vec3 v_salience;
|
|
30
|
+
|
|
31
|
+
uniform float u_timeSec;
|
|
32
|
+
uniform vec3 u_gateRgb;
|
|
33
|
+
uniform vec3 u_failRgb;
|
|
34
|
+
|
|
35
|
+
out vec4 fragColor;
|
|
36
|
+
|
|
37
|
+
void main() {
|
|
38
|
+
float d = length(v_uv);
|
|
39
|
+
if (d > 1.35) discard;
|
|
40
|
+
|
|
41
|
+
float pulse = v_salience.x;
|
|
42
|
+
float gate = v_salience.y;
|
|
43
|
+
float fail = v_salience.z;
|
|
44
|
+
|
|
45
|
+
vec3 baseCol = mix(v_color.rgb, u_gateRgb, gate * 0.65);
|
|
46
|
+
baseCol = mix(baseCol, u_failRgb, fail * 0.85);
|
|
47
|
+
|
|
48
|
+
float alpha = 0.0;
|
|
49
|
+
vec3 rgb = baseCol;
|
|
50
|
+
|
|
51
|
+
if (d <= 1.0) {
|
|
52
|
+
float z = sqrt(max(0.0, 1.0 - d * d));
|
|
53
|
+
float fresnel = pow(1.0 - z, 2.3);
|
|
54
|
+
vec3 normal = normalize(vec3(v_uv * 0.92, z));
|
|
55
|
+
float keyLight = max(0.0, dot(normal, normalize(vec3(-0.32, 0.58, 0.75))));
|
|
56
|
+
float spec = pow(keyLight, 14.0) * 0.38;
|
|
57
|
+
rgb = baseCol * (0.42 + 0.52 * keyLight) + baseCol * fresnel * 0.75 + vec3(spec);
|
|
58
|
+
alpha = (0.34 + 0.62 * fresnel + 0.14 * z) * v_color.a;
|
|
59
|
+
} else {
|
|
60
|
+
float haloFalloff = exp(-(d - 1.0) * 8.5);
|
|
61
|
+
float gateBreath = 0.55 + 0.45 * sin(u_timeSec * 3.14159);
|
|
62
|
+
float haloBoost = 0.22 + gate * 0.62 * gateBreath + pulse * 0.35 + fail * 0.45;
|
|
63
|
+
rgb = mix(baseCol, u_gateRgb, gate * 0.8);
|
|
64
|
+
alpha = haloFalloff * haloBoost * v_color.a;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (pulse > 0.01) {
|
|
68
|
+
float ringRadius = mix(0.24, 1.26, 1.0 - pulse);
|
|
69
|
+
float ring = exp(-abs(d - ringRadius) * 18.0) * pulse;
|
|
70
|
+
rgb += baseCol * ring * 0.85;
|
|
71
|
+
alpha = min(1.0, alpha + ring * 0.55 * v_color.a);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
alpha = clamp(alpha, 0.0, 1.0);
|
|
75
|
+
fragColor = vec4(rgb * alpha, alpha);
|
|
76
|
+
}
|
|
77
|
+
`,qn=`#version 300 es
|
|
78
|
+
precision highp float;
|
|
79
|
+
|
|
80
|
+
layout(location = 0) in vec3 a_pos;
|
|
81
|
+
layout(location = 1) in vec4 a_color;
|
|
82
|
+
|
|
83
|
+
uniform mat4 u_viewProj;
|
|
84
|
+
|
|
85
|
+
out vec4 v_color;
|
|
86
|
+
|
|
87
|
+
void main() {
|
|
88
|
+
v_color = a_color;
|
|
89
|
+
gl_Position = u_viewProj * vec4(a_pos, 1.0);
|
|
90
|
+
}
|
|
91
|
+
`,Gn=`#version 300 es
|
|
92
|
+
precision highp float;
|
|
93
|
+
|
|
94
|
+
in vec4 v_color;
|
|
95
|
+
out vec4 fragColor;
|
|
96
|
+
|
|
97
|
+
void main() {
|
|
98
|
+
float a = clamp(v_color.a, 0.0, 1.0);
|
|
99
|
+
fragColor = vec4(v_color.rgb * a, a);
|
|
100
|
+
}
|
|
101
|
+
`;function qt(e,t,o){let n=e.createShader(t);if(!n)throw new Error("Failed to allocate WebGL2 shader.");if(e.shaderSource(n,o),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){let r=e.getShaderInfoLog(n)??"unknown shader compile error";throw e.deleteShader(n),new Error(`XR shader compilation failed: ${r}`)}return n}function Gt(e,t,o){let n=qt(e,e.VERTEX_SHADER,t),r=qt(e,e.FRAGMENT_SHADER,o),l=e.createProgram();if(!l)throw e.deleteShader(n),e.deleteShader(r),new Error("Failed to allocate WebGL2 program.");if(e.attachShader(l,n),e.attachShader(l,r),e.linkProgram(l),e.deleteShader(n),e.deleteShader(r),!e.getProgramParameter(l,e.LINK_STATUS)){let s=e.getProgramInfoLog(l)??"unknown program link error";throw e.deleteProgram(l),new Error(`XR program link failed: ${s}`)}return l}function Hn(){return typeof OffscreenCanvas=="function"?new OffscreenCanvas(2,2).getContext("webgl2",{alpha:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,powerPreference:"low-power",xrCompatible:!0}):null}function Un(e,t){let o=globalThis;if(typeof o.XRWebGLLayer!="function")throw new Error("XRWebGLLayer is unavailable in this runtime.");return new o.XRWebGLLayer(e,t,{alpha:!0})}function Ht({xr:e=null,audio:t,controllerInput:o,getWorldFrame:n,createGlContext:r=Hn,createXrLayer:l=Un,onSessionModeChange:s}){let d=Bt(),p=new Float32Array(16),a=[],c=null,i=null,f=0,y=!1,I=!1,b=null;function w(){if(b!==null)return b;let h=r();if(!h)return null;let g=Gt(h,Bn,Dn),x=Gt(h,qn,Gn),v=new Float32Array([-1.35,-1.35,1.35,-1.35,-1.35,1.35,1.35,1.35]),z=h.createVertexArray(),k=h.createBuffer(),u=h.createBuffer();h.bindVertexArray(z),h.bindBuffer(h.ARRAY_BUFFER,k),h.bufferData(h.ARRAY_BUFFER,v,h.STATIC_DRAW),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,8,0);let O=be*4;h.bindBuffer(h.ARRAY_BUFFER,u),h.bufferData(h.ARRAY_BUFFER,O*32,h.DYNAMIC_DRAW),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,4,h.FLOAT,!1,O,0),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,O,16),h.vertexAttribDivisor(2,1),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,3,h.FLOAT,!1,O,32),h.vertexAttribDivisor(3,1);let M=h.createVertexArray(),R=h.createBuffer(),_=ve*4;return h.bindVertexArray(M),h.bindBuffer(h.ARRAY_BUFFER,R),h.bufferData(h.ARRAY_BUFFER,_*64,h.DYNAMIC_DRAW),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,3,h.FLOAT,!1,_,0),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,4,h.FLOAT,!1,_,12),h.bindVertexArray(null),b={gl:h,orbProgram:g,orbVao:z,orbInstanceBuf:u,orbUniforms:{viewProj:h.getUniformLocation(g,"u_viewProj"),camRight:h.getUniformLocation(g,"u_camRight"),camUp:h.getUniformLocation(g,"u_camUp"),timeSec:h.getUniformLocation(g,"u_timeSec"),gateRgb:h.getUniformLocation(g,"u_gateRgb"),failRgb:h.getUniformLocation(g,"u_failRgb")},lineProgram:x,lineVao:M,lineBuf:R,lineViewProj:h.getUniformLocation(x,"u_viewProj")},b}function m(h){if(!(!c||h.length===0))for(let g of h)a.push(g)}async function S(h){if(I||y||!e||typeof e.requestSession!="function")return!1;if(c){if(i===h)return!0;await A()}let g=w();if(!g)return!1;y=!0;try{let x=g.gl;typeof x.makeXRCompatible=="function"&&await x.makeXRCompatible();let v=await e.requestSession(h,{optionalFeatures:["local-floor","bounded-floor"]}),z=l(v,g.gl);v.updateRenderState({baseLayer:z});let k=await v.requestReferenceSpace("local-floor").catch(()=>v.requestReferenceSpace("local"));c=v,i=h,a=[],d.reset(),o.reset(),s?.(h);let u=-1,O=()=>{c===v&&(c=null,i=null,f=0,a=[],o.reset(),s?.(null))};v.onend=O;let M=(R,_)=>{if(c!==v||I)return;f=v.requestAnimationFrame(M);let j=u<0?0:Math.min(.25,Math.max(0,(R-u)/1e3));u=R;let P=Date.now(),C=n(P),N=o.update({session:v,frame:_,refSpace:k,worldFrame:C,dtSec:j});(N.layoutMutated||N.visibilityMutated)&&(C=n(P),t.syncFrame(C,[],P));let U=_.getViewerPose(k);if(!U)return;t.setListenerPose($t(U.transform.matrix));let W=a;a=[];let $=d.step({frame:C,cues:W,dtSec:j,timeSec:R/1e3,hoveredNodeId:N.hoveredNodeId,grabbedNodeId:N.grabbedNodeId,pointerRay:N.pointerRay}),{gl:T}=g,Y=v.renderState?.baseLayer??z;if(T.bindFramebuffer(T.FRAMEBUFFER,Y.framebuffer),h==="immersive-ar"?T.clearColor(0,0,0,0):T.clearColor(.02,.031,.027,1),T.clear(T.COLOR_BUFFER_BIT|T.DEPTH_BUFFER_BIT),$.orbCount===0&&$.lineVertexCount===0)return;T.enable(T.BLEND),T.blendFunc(T.ONE,T.ONE_MINUS_SRC_ALPHA),T.enable(T.DEPTH_TEST),T.depthMask(!1),$.lineVertexCount>0&&(T.bindBuffer(T.ARRAY_BUFFER,g.lineBuf),T.bufferData(T.ARRAY_BUFFER,$.lineData,T.DYNAMIC_DRAW)),$.orbCount>0&&(T.bindBuffer(T.ARRAY_BUFFER,g.orbInstanceBuf),T.bufferData(T.ARRAY_BUFFER,$.orbData,T.DYNAMIC_DRAW));let te=ie.gate.rgb,L=ie.failed.rgb;for(let q of U.views){let G=Y.getViewport(q);if(G&&(T.viewport(G.x,G.y,G.width,G.height),Pt(p,q.projectionMatrix,q.transform.inverse.matrix),$.lineVertexCount>0&&(T.useProgram(g.lineProgram),T.uniformMatrix4fv(g.lineViewProj,!1,p),T.bindVertexArray(g.lineVao),T.drawArrays(T.LINES,0,$.lineVertexCount)),$.orbCount>0)){let K=Ft(q.transform.matrix);T.useProgram(g.orbProgram),T.uniformMatrix4fv(g.orbUniforms.viewProj,!1,p),T.uniform3f(g.orbUniforms.camRight,K.right.x,K.right.y,K.right.z),T.uniform3f(g.orbUniforms.camUp,K.up.x,K.up.y,K.up.z),T.uniform1f(g.orbUniforms.timeSec,R/1e3),T.uniform3f(g.orbUniforms.gateRgb,te[0],te[1],te[2]),T.uniform3f(g.orbUniforms.failRgb,L[0],L[1],L[2]),T.bindVertexArray(g.orbVao),T.drawArraysInstanced(T.TRIANGLE_STRIP,0,4,$.orbCount)}}T.bindVertexArray(null),T.depthMask(!0)};return f=v.requestAnimationFrame(M),!0}catch{return!1}finally{y=!1}}async function A(){let h=c;h&&(f&&(h.cancelAnimationFrame?.(f),f=0),c=null,i=null,o.reset(),s?.(null),await h.end().catch(()=>{}))}async function E(){I=!0,await A()}return{get activeMode(){return i},notifyCues:m,enterSession:S,exitSession:A,dispose:E}}var Wn=3e4;var nt=(e,t=Math.random)=>{let o=Math.min(Wn,1e3*2**e);return o/2+t()*(o/2)};var Vn=1e4,Oe=class e{#e=null;#t=!1;#c="";#r=null;#l=0;#n=null;#o=null;#i=null;#f=null;#s=[];constructor(t,{types:o=[],headers:n,onMessage:r,onError:l,onDown:s,onUp:d,signal:p}={}){if(p?.aborted){this.#t=!0;return}if(p&&(this.#f=J.target(p,"abort",()=>this.close(),{once:!0})),n===void 0){this.#e=new EventSource(t),this.#e.onopen=()=>d?.(),this.#e.onerror=f=>{l?.(f),s?.(f)};let i=f=>r?.(f.type,e.#a(f.data),f.lastEventId);this.#e.onmessage=i;for(let f of o)this.#e.addEventListener(f,i);return}let a=new Set(o),c=()=>{this.#t||this.#o===null||(clearTimeout(this.#o),this.#o=null,this.#u(t,{typeSet:a,headers:n,onMessage:r,onError:l,onDown:s,onUp:d}))};typeof window<"u"&&window?.addEventListener&&this.#s.push(J.target(window,"online",c)),typeof document<"u"&&document?.addEventListener&&this.#s.push(J.target(document,"visibilitychange",()=>{document.visibilityState==="visible"&&c()})),this.#u(t,{typeSet:a,headers:n,onMessage:r,onError:l,onDown:s,onUp:d})}close(){if(!this.#t){this.#t=!0,clearTimeout(this.#n),this.#n=null,clearTimeout(this.#o),this.#o=null,this.#f?.(),this.#f=null;for(let t of this.#s)t();this.#s=[],this.#i?.abort(),this.#i=null,this.#e?.close(),this.#e=null}}#u(t,o){if(this.#t)return;this.#i?.abort();let n=new AbortController;this.#i=n,this.#m(t,o,n.signal)}async#m(t,{typeSet:o,headers:n,onMessage:r,onError:l,onDown:s,onUp:d},p){let a=null;try{let c=typeof n=="function"?await n(p):n;if(this.#t||p.aborted)return;let i=new Headers(c??void 0);i.has("accept")||i.set("accept","text/event-stream"),this.#c&&!i.has("last-event-id")&&i.set("last-event-id",this.#c);let f=await fetch(t,{headers:i,cache:"no-store",signal:p});if(this.#t||p.aborted)return;if(f.status===204){this.close(),s?.();return}if(f.status!==200){let h=f.status===408||f.status===429||f.status>=500,g=Object.assign(new Error(`otm sse: HTTP ${f.status}${f.statusText?` ${f.statusText}`:""}`),{status:f.status,response:f});h||this.close(),l?.(g),s?.(g),h&&this.#p(t,{typeSet:o,headers:n,onMessage:r,onError:l,onDown:s,onUp:d});return}let y=f.headers.get("content-type")?.split(";")[0].trim().toLowerCase();if(y!=="text/event-stream"||!f.body){let h=Object.assign(new Error(`otm sse: expected text/event-stream, got ${y||"none"}`),{status:f.status,response:f,protocolFailure:!0});this.close(),l?.(h),s?.(h);return}this.#n=setTimeout(()=>{this.#l=0},Vn),d?.(),a=f.body.getReader();let I=new TextDecoder("utf-8"),b="",w=!0,m="message",S=[],A=!1,E=h=>{if(h===""){if(A){let z=S.join(`
|
|
102
|
+
`),k=m||"message";S=[],A=!1,m="message",(k==="message"||o.has(k))&&r?.(k,e.#a(z),this.#c)}else m="message";return}if(h.startsWith(":"))return;let g=h.indexOf(":"),x=h,v="";g!==-1&&(x=h.slice(0,g),v=h.slice(g+1),v.startsWith(" ")&&(v=v.slice(1))),x==="event"?m=v:x==="data"?(S.push(v),A=!0):x==="id"?v.includes("\0")||(this.#c=v):x==="retry"&&/^\d+$/.test(v)&&(this.#r=Number(v))};for(;;){let{value:h,done:g}=await a.read();if(g)break;let x=I.decode(h,{stream:!0});w&&(w=!1,x.startsWith("\uFEFF")&&(x=x.slice(1))),b+=x;let v=b.split(/\r\n|\r|\n/);b=v.pop()??"";for(let z of v)if(E(z),this.#t||p.aborted)return}if(b+=I.decode(),this.#t||p.aborted)return;clearTimeout(this.#n),this.#n=null,s?.(),this.#p(t,{typeSet:o,headers:n,onMessage:r,onError:l,onDown:s,onUp:d})}catch(c){if(clearTimeout(this.#n),this.#n=null,this.#t||p.aborted)return;l?.(c),s?.(c),this.#p(t,{typeSet:o,headers:n,onMessage:r,onError:l,onDown:s,onUp:d})}finally{await a?.cancel().catch(()=>{})}}#p(t,o){if(this.#t)return;this.#l+=1;let n=this.#r!==null?this.#r:nt(this.#l);clearTimeout(this.#o),this.#o=setTimeout(()=>{this.#o=null,this.#u(t,o)},n)}static#a(t){try{return JSON.parse(t)}catch{return t}}};var Ut=(e,t)=>new Oe(e,t);function Wt({notificationsUrl:e,onConnectionChange:t,onUpdate:o}){let n=Ne(),r="connecting",l=null,s=!1,d=!1,p=y=>{s||r===y||(r=y,t?.(y))},a=()=>{if(l?.close(),l=null,s)return;p("connecting");let y=Ut(e,{types:[...Ot],headers:I=>yt(e,I),onUp:()=>{s||l!==y||(d=!1,p("connected"))},onMessage:(I,b)=>{if(s||l!==y)return;if(!D(b)||typeof b.event!="string"||!D(b.data)){y.close(),p("disconnected");return}let w=Nt(n,b);if(n=w.state,w.resyncRequired){a();return}o?.(w)},onError:I=>{if(s||l!==y)return;let b=Reflect.get(Object(I),"status");if(b===401||b===403){if(y.close(),b===401&&!d){d=!0,wt(e).then(w=>{s||l!==y||(w?a():p("signed-out"))});return}p("signed-out");return}p("disconnected")},onDown:I=>{if(s||l!==y)return;let b=Reflect.get(Object(I),"status");p(r==="signed-out"||b===401||b===403?"signed-out":"disconnected")}});l=y},c=vt(()=>{s||(d=!1,a())}),i=typeof window<"u"&&typeof window.addEventListener=="function"?Z.target(window,"pagehide",()=>{s||(l?.close(),l=null)}):()=>{},f=typeof window<"u"&&typeof window.addEventListener=="function"?Z.target(window,"pageshow",y=>{s||y.persisted&&a()}):()=>{};return t?.(r),a(),{get state(){return n},get connection(){return r},dispose(){s||(s=!0,c(),i(),f(),l?.close(),l=null)}}}var Xt="plurnk-xr:layout";function Vt(e){return e==="passive"||e==="off"?e:"on"}function Kn(e){let t=Number(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t/100)):.35}function Xn(){try{let e=typeof window<"u"?window.localStorage?.getItem(Xt):null;return e?JSON.parse(e):null}catch{return null}}function Kt(e){try{typeof window<"u"&&window.localStorage?.setItem(Xt,JSON.stringify(e))}catch{}}async function Yn(e){let t=ae("html"),o=Vt(H("visibility")),n=Kn(H("gain")??"35");await H.boot({namespace:"plurnk-xr",persistKeys:["audio-muted","visibility"]}),H("audio-muted")===null&&H("audio-muted","false");let r=H("audio-muted")==="true",l=Mt({...e.createAudioContext?{createAudioContext:e.createAudioContext}:{},initialGain:n,initialMuted:r}),s=Vt(H("visibility")??o);H("visibility",s);let d=Number(t?.getAttribute("data-callout-ms")??""),p=e.calloutMs??(Number.isFinite(d)&&d>=1e3?d:8e3),a=jt({calloutMs:p,initialVisibility:s}),c=Xn();c!==null&&a.importLayout(c);let i=Ne(),f=Dt({topology:a,audio:l,onVisibilityChange:g=>{H("visibility",g)},onMuteChange:g=>{H("audio-muted",g?"true":"false")},onLayoutCommit:()=>{Kt(a.exportLayout())}}),y=Ht({xr:e.xr??null,audio:l,controllerInput:f,getWorldFrame:g=>a.project(i,g),...e.createGlContext?{createGlContext:e.createGlContext}:{},...e.createXrLayer?{createXrLayer:e.createXrLayer}:{},onSessionModeChange:g=>{H("xr-session",g?"active":"idle")}}),I=(g=[])=>{let x=Date.now();g.length>0&&(a.ingestCues(g,x),y.notifyCues(g));let v=a.project(i,x);return l.syncFrame(v,g,x),e.onWorldFrame?.(v,g),v};I();let b=ae('[data-xr-mode="immersive-vr"]'),w=ae('[data-xr-mode="immersive-ar"]'),m=e.notificationsUrl??t?.getAttribute("data-notifications-url")??"/notifications",S=Z("main","click",'[data-action="enter-xr"]',(g,x)=>{let v=x.getAttribute("data-xr-mode");(v==="immersive-vr"||v==="immersive-ar")&&(l.unlock(),e.onEnterXr?.(v),y.enterSession(v))}),A=Z("main","click",'[data-action="sign-in"]',g=>{g.preventDefault(),bt(m,{returnTo:"/xr/"})}),E=e.connectWatch===!1?null:Wt({notificationsUrl:m,onConnectionChange:g=>{H("connection",g)},onUpdate:g=>{i=g.state,I(g.cues)}}),h=await Tt(e);return H("xr-posture",h.posture),b&&(b.disabled=!h.vrSupported),w&&(w.disabled=!h.arSupported),{posture:h.posture,capabilities:h,topology:a,audio:l,controllerInput:f,renderer:y,saveLayout(){Kt(a.exportLayout())},applyEnvelope(g){return i=g.state,I(g.cues)},dispose(){E?.dispose(),y.dispose(),l.dispose(),S(),A()}}}if(typeof window<"u"&&ae("#xr-airlock")!==null){let e=window.navigator;Yn({isSecureContext:window.isSecureContext,xr:e.xr??null})}export{Yn as bootLaunchShell};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@layer schema,scheme,structure,style,state;@layer schema,scheme,structure,style,state;@layer schema{:root{color-scheme:light dark;interpolate-size:allow-keywords;--otm-font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--otm-font-family-monospace: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;--otm-font-size: 100%;--otm-line-height: 1.5;--otm-font-weight: 400;--otm-spacing: 1rem;--otm-border-radius: .375rem;--otm-border-width: .0625rem;--otm-outline-width: .125rem;--otm-transition: .18s ease;--otm-container-max-width: 68rem;--otm-form-element-spacing-block: .625rem;--otm-form-element-spacing-inline: .875rem;--otm-primary: light-dark(#0172ad, #01aaff);--otm-primary-background: light-dark(#0172ad, #0172ad);--otm-primary-inverse: light-dark(#fff, #fff);--otm-primary-hover: color-mix( in oklch, var(--otm-primary) 82%, CanvasText );--otm-primary-hover-background: color-mix( in oklch, var(--otm-primary-background) 85%, CanvasText );--otm-primary-underline: color-mix( in oklch, var(--otm-primary) 50%, transparent );--otm-primary-focus: color-mix( in oklch, var(--otm-primary) 35%, transparent );--otm-text-selection-color: color-mix( in oklch, var(--otm-primary) 24%, transparent );--otm-background-color: light-dark(#fff, #13171f);--otm-color: light-dark(#373c44, #c2c7d0);--otm-heading-color: light-dark(#23272f, #eef0f4);--otm-muted-color: light-dark(#646b79, #8891a4);--otm-muted-border-color: light-dark(#e7eaf0, #232a36);--otm-card-background-color: light-dark(#fff, #181c25);--otm-card-sectioning-background-color: light-dark(#fbfcfc, #1c212c);--otm-card-box-shadow: 0 1px 2px color-mix(in oklch, CanvasText 6%, transparent), 0 8px 24px color-mix(in oklch, CanvasText 8%, transparent);--otm-code-background-color: light-dark(#f3f5f7, #1c212c);--otm-table-row-stripped-background-color: color-mix( in oklch, var(--otm-muted-color) 6%, transparent );--otm-mark-background-color: light-dark(#fde7c0, #014063);--otm-mark-color: light-dark(#0f1114, #fff);--otm-ins-color: light-dark(#1d6a54, #62af9a);--otm-del-color: light-dark(#b4342d, #e07a74);--otm-invalid-color: light-dark(#c53030, #e07070);--otm-valid-color: light-dark(#248265, #38b28b);--otm-modal-overlay-background-color: color-mix( in oklch, var(--otm-background-color) 72%, transparent );--otm-form-element-background-color: light-dark(#fbfcfc, #1c212c);--otm-form-element-active-background-color: light-dark(#fff, #181c25);--otm-form-element-border-color: light-dark(#cfd5e2, #2d3545);--otm-form-element-color: light-dark(#23262c, #e6e9ef);--otm-switch-background-color: light-dark(#bfc7d9, #333c4e)}[data-theme=dark],:root:has(>body[data-theme=dark]){color-scheme:dark}[data-theme=light],:root:has(>body[data-theme=light]){color-scheme:light}[data-theme=dark],[data-theme=light]{background-color:var(--otm-background-color);color:var(--otm-color)}*,*:before,*:after{box-sizing:border-box;background-repeat:no-repeat}::selection{background-color:var(--otm-text-selection-color)}html{font-size:var(--otm-font-size);line-height:var(--otm-line-height);font-family:var(--otm-font-family);font-weight:var(--otm-font-weight);text-size-adjust:100%;background-color:var(--otm-background-color);color:var(--otm-color)}body{inline-size:100%;margin:0;background-color:var(--otm-background-color);color:var(--otm-color)}body>header,body>main,body>footer{inline-size:100%;max-inline-size:var(--otm-container-max-width);margin-inline:auto;padding-block:var(--otm-spacing);padding-inline:var(--otm-spacing)}section,search{display:block;margin-block-end:calc(var(--otm-spacing) * 2)}article{margin-block-end:var(--otm-spacing);padding-block:var(--otm-spacing);padding-inline:var(--otm-spacing);border:var(--otm-border-width) solid var(--otm-muted-border-color);border-radius:var(--otm-border-radius);background-color:var(--otm-card-background-color);box-shadow:var(--otm-card-box-shadow);>header,>footer{margin-inline:calc(var(--otm-spacing) * -1);padding-block:calc(var(--otm-spacing) * .66);padding-inline:var(--otm-spacing);background-color:var(--otm-card-sectioning-background-color)}>header{margin-block-start:calc(var(--otm-spacing) * -1);margin-block-end:var(--otm-spacing);border-block-end:var(--otm-border-width) solid var(--otm-muted-border-color);border-start-start-radius:var(--otm-border-radius);border-start-end-radius:var(--otm-border-radius)}>footer{margin-block-start:var(--otm-spacing);margin-block-end:calc(var(--otm-spacing) * -1);border-block-start:var(--otm-border-width) solid var(--otm-muted-border-color);border-end-start-radius:var(--otm-border-radius);border-end-end-radius:var(--otm-border-radius)}}h1,h2,h3,h4,h5,h6{margin-block-start:0;margin-block-end:var(--otm-spacing);color:var(--otm-heading-color);font-weight:700;line-height:1.2;text-wrap:balance;overflow-wrap:break-word}h1{font-size:2rem}h2{font-size:1.625rem}h3{font-size:1.375rem}h4{font-size:1.1875rem}h5{font-size:1.0625rem}h6{font-size:1rem;color:var(--otm-muted-color)}hgroup{margin-block-end:var(--otm-spacing);>*{margin-block:0}>:not(:first-child):last-child{color:var(--otm-muted-color);font-weight:400}}p,ul,ol,menu,dl,table,blockquote,pre,figure{margin-block-start:0;margin-block-end:var(--otm-spacing)}p{text-wrap:pretty;overflow-wrap:break-word}dt{font-weight:600;color:var(--otm-heading-color)}dd{margin-inline-start:0;margin-block-end:calc(var(--otm-spacing) * .5)}a{color:var(--otm-primary);text-decoration:underline;text-decoration-color:var(--otm-primary-underline);text-underline-offset:.125em;transition:color var(--otm-transition),text-decoration-color var(--otm-transition);&:hover,&:active,&:focus-visible{color:var(--otm-primary-hover);text-decoration-color:var(--otm-primary-hover)}&:focus-visible{outline:var(--otm-outline-width) solid var(--otm-primary-focus);outline-offset:.125rem;border-radius:var(--otm-border-radius)}}nav{display:flex;justify-content:space-between;align-items:center;gap:var(--otm-spacing);:where(ol,ul,menu){display:flex;align-items:center;margin:0;padding:0;list-style:none;gap:var(--otm-spacing)}& li{margin:0;padding:0}& a{text-decoration:none;&[aria-current=page],&[aria-current=true]{font-weight:700;text-decoration:underline}}}aside nav{display:block;:where(ol,ul,menu){flex-direction:column;align-items:stretch;gap:calc(var(--otm-spacing) * .5)}}small{font-size:.875em}mark{padding-block:.125rem;padding-inline:.25rem;background-color:var(--otm-mark-background-color);color:var(--otm-mark-color);border-radius:var(--otm-border-radius)}ins{color:var(--otm-ins-color);text-decoration:none}del{color:var(--otm-del-color)}abbr[title]{border-block-end:1px dotted;text-decoration:none;cursor:help}blockquote{margin-inline:0;padding:var(--otm-spacing);border-inline-start:.25rem solid var(--otm-muted-border-color);& footer{margin-block-start:calc(var(--otm-spacing) * .5);color:var(--otm-muted-color)}}hr{block-size:0;margin-block:var(--otm-spacing);border:0;border-block-start:var(--otm-border-width) solid var(--otm-muted-border-color)}img,svg,video,canvas,audio,iframe{max-inline-size:100%;block-size:auto}figure{margin-inline:0;& figcaption{padding-block-start:calc(var(--otm-spacing) * .5);color:var(--otm-muted-color);font-size:.875rem}}code,kbd,pre,samp{font-family:var(--otm-font-family-monospace);font-size:.875em}code,kbd{padding-block:.125rem;padding-inline:.375rem;border-radius:var(--otm-border-radius);background-color:var(--otm-code-background-color);color:var(--otm-muted-color)}kbd{display:inline-block;background-color:var(--otm-color);color:var(--otm-background-color);font-weight:700}pre{overflow-x:auto;padding:var(--otm-spacing);border-radius:var(--otm-border-radius);background-color:var(--otm-code-background-color);>code{display:block;padding:0;background:none;color:inherit}}table{inline-size:100%;border-collapse:collapse;border-spacing:0;text-indent:0}th,td{padding-block:calc(var(--otm-spacing) * .75);padding-inline:var(--otm-spacing);border-block-end:var(--otm-border-width) solid var(--otm-muted-border-color);text-align:start;vertical-align:middle}thead th{border-block-end-width:calc(var(--otm-border-width) * 2);font-weight:700}tbody tr:nth-child(odd){background-color:var(--otm-table-row-stripped-background-color)}button,input:where([type=submit],[type=button],[type=reset]),[role=button]{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;padding-block:var(--otm-form-element-spacing-block);padding-inline:var(--otm-form-element-spacing-inline);border:var(--otm-border-width) solid var(--otm-primary-background);border-radius:var(--otm-border-radius);background-color:var(--otm-primary-background);color:var(--otm-primary-inverse);font-family:inherit;font-size:1rem;font-weight:500;line-height:var(--otm-line-height);text-decoration:none;cursor:pointer;transition:background-color var(--otm-transition),border-color var(--otm-transition),color var(--otm-transition),box-shadow var(--otm-transition);&:hover,&:active{background-color:var(--otm-primary-hover-background);border-color:var(--otm-primary-hover-background);color:var(--otm-primary-inverse)}&:focus-visible{outline:none;box-shadow:0 0 0 var(--otm-outline-width) var(--otm-primary-focus)}}input[type=reset]{background-color:transparent;border-color:var(--otm-form-element-border-color);color:var(--otm-color);&:hover,&:active{background-color:var(--otm-code-background-color);border-color:var(--otm-muted-color);color:var(--otm-color)}}fieldset{margin-block:0 var(--otm-spacing);margin-inline:0;padding:0;border:0}legend{margin-block-end:calc(var(--otm-spacing) * .5);font-weight:600}label{display:block;margin-block-end:calc(var(--otm-spacing) * .375);font-weight:500}input:where(:not([type=checkbox],[type=radio],[type=range],[type=submit],[type=button],[type=reset],[type=file],[type=color])),select,textarea{display:block;inline-size:100%;margin-block-end:var(--otm-spacing);padding-block:var(--otm-form-element-spacing-block);padding-inline:var(--otm-form-element-spacing-inline);border:var(--otm-border-width) solid var(--otm-form-element-border-color);border-radius:var(--otm-border-radius);background-color:var(--otm-form-element-background-color);color:var(--otm-form-element-color);font-family:inherit;font-size:1rem;line-height:var(--otm-line-height);transition:background-color var(--otm-transition),border-color var(--otm-transition),box-shadow var(--otm-transition);&::placeholder{color:var(--otm-muted-color)}&:focus{outline:none;background-color:var(--otm-form-element-active-background-color);border-color:var(--otm-primary-background);box-shadow:0 0 0 var(--otm-outline-width) var(--otm-primary-focus)}}textarea{resize:vertical;min-block-size:5rem}input:where([type=checkbox],[type=radio]){inline-size:1.125rem;block-size:1.125rem;margin-inline-end:.375rem;vertical-align:middle;accent-color:var(--otm-primary-background);cursor:pointer}input[type=checkbox][role=switch]{appearance:none;inline-size:2.25rem;block-size:1.25rem;border-radius:1.25rem;background-color:var(--otm-switch-background-color);position:relative;transition:background-color var(--otm-transition);&:before{content:"";position:absolute;inset-block-start:.125rem;inset-inline-start:.125rem;inline-size:1rem;block-size:1rem;border-radius:50%;background-color:#fff;transition:translate var(--otm-transition)}&:checked{background-color:var(--otm-primary-background);&:before{translate:1rem 0}}}input[type=range]{inline-size:100%;accent-color:var(--otm-primary-background);cursor:pointer}progress,meter{display:block;inline-size:100%;block-size:.5rem;margin-block-end:var(--otm-spacing);border:0;border-radius:var(--otm-border-radius);accent-color:var(--otm-primary-background)}output{display:inline-block;font-variant-numeric:tabular-nums}details{display:block;margin-block-end:var(--otm-spacing);padding-block-end:calc(var(--otm-spacing) * .5);border-block-end:var(--otm-border-width) solid var(--otm-muted-border-color);& summary{font-weight:600;cursor:pointer;list-style-position:inside}&[open]>summary{margin-block-end:calc(var(--otm-spacing) * .5)}}dialog,[popover]{max-inline-size:min(36rem,calc(100vi - 2rem));inline-size:100%;padding:var(--otm-spacing);border:var(--otm-border-width) solid var(--otm-muted-border-color);border-radius:var(--otm-border-radius);background-color:var(--otm-card-background-color);color:var(--otm-color);box-shadow:var(--otm-card-box-shadow);opacity:0;transition:opacity var(--otm-transition),overlay var(--otm-transition) allow-discrete,display var(--otm-transition) allow-discrete;&::backdrop{background-color:var(--otm-modal-overlay-background-color);backdrop-filter:blur(.25rem)}&:popover-open,&[open]{opacity:1;@starting-style{opacity:0}}}dialog:has(>article){padding:0;>article{margin:0;border:0;box-shadow:none}}[aria-invalid=true],:user-invalid{border-color:var(--otm-invalid-color);&:focus{border-color:var(--otm-invalid-color);box-shadow:0 0 0 var(--otm-outline-width) color-mix(in oklch,var(--otm-invalid-color) 30%,transparent)}}[aria-invalid=false]{border-color:var(--otm-valid-color);&:focus{border-color:var(--otm-valid-color);box-shadow:0 0 0 var(--otm-outline-width) color-mix(in oklch,var(--otm-valid-color) 30%,transparent)}}[disabled],[aria-disabled=true]{opacity:.5;cursor:not-allowed;pointer-events:none}[aria-busy=true]{cursor:progress;&:before{content:"";display:inline-block;inline-size:1em;block-size:1em;margin-inline-end:.5em;border:.15em solid currentcolor;border-inline-end-color:transparent;border-radius:50%;vertical-align:-.125em;animation:otm-spin .75s linear infinite}}[hidden]{display:none}@keyframes otm-spin{to{rotate:1turn}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms;animation-iteration-count:1;transition-duration:.01ms;scroll-behavior:auto}}}@layer schema,scheme,structure,style,state;@layer scheme{:root{--otm-primary: light-dark(#2e7d32, #55b85a);--otm-primary-background: light-dark(#2e7d32, #2e7d32);--otm-primary-inverse: light-dark(#fff, #fff)}}@layer structure{body{margin:0}body>main{max-inline-size:36rem;margin-inline:auto;padding:3rem 1.5rem}#xr-airlock{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.5rem;max-inline-size:none;min-block-size:100dvh;padding:2rem 1.25rem;box-sizing:border-box;text-align:center}#xr-mascot{display:block;inline-size:10.5rem;block-size:10.5rem;user-select:none}#xr-entry-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.85rem}#xr-entry-actions>button{inline-size:auto;min-inline-size:8.25rem;margin-block-end:0}#xr-airlock-note{min-block-size:1.4rem;margin-block:0}}@layer style{:root{--otm-font-family: var(--otm-font-family-monospace);--otm-primary: light-dark(#148800, #4eb31b);--otm-primary-hover: light-dark(#106d00, #72cc46);--otm-primary-underline: light-dark(rgb(20 136 0 / 50%), rgb(78 179 27 / 50%));--otm-primary-background: #148800;--otm-primary-hover-background: #106d00;--otm-primary-focus: rgb(20 136 0 / 50%);--otm-primary-inverse: #fff}#xr-mascot{filter:drop-shadow(0 .5rem 1.25rem rgb(0 0 0 / 22%));transition:transform .18s ease,opacity .18s ease}#xr-airlock-note{color:var(--otm-muted-color);font-size:.82rem}}@layer state{[data-posture-key],[data-connection-key],[data-session-key]{display:none}body[data-xr-posture="2d-insecure"] [data-posture-key="2d-insecure"],body[data-xr-posture="2d"] [data-posture-key="2d"],body[data-connection=signed-out] [data-connection-key=signed-out],body[data-xr-session=active] [data-session-key=active]{display:inline}body[data-xr-session=active] [data-posture-key],body[data-xr-session=active] [data-connection-key]{display:none}body[data-xr-session=active] #xr-mascot{transform:scale(1.05)}body[data-visibility=off] #xr-mascot{opacity:.72}body[data-audio-muted=true] #xr-airlock{opacity:.94}}
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
on_the_money/src/css/schema.css:
|
|
5
|
+
(*!
|
|
6
|
+
* on_the_money.js — schema.css (modern classless semantic HTML foundation)
|
|
7
|
+
* Distilled from Pico CSS Classless (MIT License, https://picocss.com).
|
|
8
|
+
* Evergreen browsers only. Zero classes. Zero !important. Logical properties.
|
|
9
|
+
*)
|
|
10
|
+
|
|
11
|
+
on_the_money/src/css/schemes/green.css:
|
|
12
|
+
(*!
|
|
13
|
+
* on_the_money.js — scheme: green
|
|
14
|
+
* Distilled from Pico CSS (MIT License, https://picocss.com).
|
|
15
|
+
*)
|
|
16
|
+
*/
|
|
Binary file
|
|
Binary file
|
package/dist/assets.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
[
|
|
3
|
+
"/xr/assets/app.JAIWKC23.js",
|
|
4
|
+
"assets/app.JAIWKC23.js",
|
|
5
|
+
"text/javascript",
|
|
6
|
+
{
|
|
7
|
+
"br": "assets/app.JAIWKC23.js.br",
|
|
8
|
+
"gzip": "assets/app.JAIWKC23.js.gz"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
[
|
|
12
|
+
"/xr/assets/index.571e167f.css",
|
|
13
|
+
"assets/index.571e167f.css",
|
|
14
|
+
"text/css",
|
|
15
|
+
{
|
|
16
|
+
"br": "assets/index.571e167f.css.br",
|
|
17
|
+
"gzip": "assets/index.571e167f.css.gz"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"/xr/icons/APACHE-2.0.txt",
|
|
22
|
+
"icons/APACHE-2.0.txt",
|
|
23
|
+
"text/plain",
|
|
24
|
+
{
|
|
25
|
+
"br": "icons/APACHE-2.0.txt.br",
|
|
26
|
+
"gzip": "icons/APACHE-2.0.txt.gz"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"/xr/icons/NOTO-NOTICE.txt",
|
|
31
|
+
"icons/NOTO-NOTICE.txt",
|
|
32
|
+
"text/plain",
|
|
33
|
+
{
|
|
34
|
+
"br": "icons/NOTO-NOTICE.txt.br",
|
|
35
|
+
"gzip": "icons/NOTO-NOTICE.txt.gz"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"/xr/icons/plurnk-3d.svg",
|
|
40
|
+
"icons/plurnk-3d.svg",
|
|
41
|
+
"image/svg+xml",
|
|
42
|
+
{
|
|
43
|
+
"br": "icons/plurnk-3d.svg.br",
|
|
44
|
+
"gzip": "icons/plurnk-3d.svg.gz"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"/xr/index.html",
|
|
49
|
+
"index.html",
|
|
50
|
+
"text/html",
|
|
51
|
+
{}
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"/xr/vendor/OTM-LICENSE.txt",
|
|
55
|
+
"vendor/OTM-LICENSE.txt",
|
|
56
|
+
"text/plain",
|
|
57
|
+
{
|
|
58
|
+
"br": "vendor/OTM-LICENSE.txt.br",
|
|
59
|
+
"gzip": "vendor/OTM-LICENSE.txt.gz"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
]
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
Binary file
|
|
Binary file
|