@pritzlaff/nano-app 0.0.0-stage → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/AGENTS.md +66 -0
  2. package/LICENSE +21 -0
  3. package/README.md +6 -2
  4. package/app/app.css +160 -0
  5. package/app/bundle/nano-ui.js +2554 -0
  6. package/app/examples/auth/example.auth.js +6 -0
  7. package/app/examples/auth/nano.json +46 -0
  8. package/app/examples/chat/example.chat.js +6 -0
  9. package/app/examples/chat/example.messaging.js +3 -0
  10. package/app/examples/chat/nano.json +115 -0
  11. package/app/examples/drift/example.drift.js +3 -0
  12. package/app/examples/drift/nano.json +31 -0
  13. package/app/examples/kv/example.kv.js +3 -0
  14. package/app/examples/nano.json +356 -0
  15. package/app/examples/originkey/_nano/bundle/nano-ui.js +212 -0
  16. package/app/examples/originkey/_nano/sandbox/boot.js +1 -0
  17. package/app/examples/originkey/_nano/shared/chunks/nano-core-2gg2vg5g.js +2 -0
  18. package/app/examples/originkey/_nano/shared/chunks/nano-core-5h5dssvv.js +3 -0
  19. package/app/examples/originkey/_nano/shared/chunks/nano-core-72b5e6vd.js +17 -0
  20. package/app/examples/originkey/_nano/shared/chunks/nano-core-87v2yejk.js +2 -0
  21. package/app/examples/originkey/_nano/shared/chunks/nano-core-hm29e227.js +7 -0
  22. package/app/examples/originkey/_nano/shared/chunks/nano-core-jtgk4ch8.js +2 -0
  23. package/app/examples/originkey/_nano/shared/chunks/nano-core-mqaje7vc.js +2 -0
  24. package/app/examples/originkey/_nano/shared/chunks/nano-core-mxgap7rs.js +2 -0
  25. package/app/examples/originkey/_nano/shared/chunks/nano-core-qy0mwf7y.js +1 -0
  26. package/app/examples/originkey/_nano/shared/chunks/nano-core-wanb7xw1.js +1 -0
  27. package/app/examples/originkey/_nano/shared/lit-class-map.js +1 -0
  28. package/app/examples/originkey/_nano/shared/lit-decorators.js +1 -0
  29. package/app/examples/originkey/_nano/shared/lit-directive.js +1 -0
  30. package/app/examples/originkey/_nano/shared/lit-if-defined.js +1 -0
  31. package/app/examples/originkey/_nano/shared/lit-ref.js +1 -0
  32. package/app/examples/originkey/_nano/shared/lit-repeat.js +1 -0
  33. package/app/examples/originkey/_nano/shared/lit-style-map.js +1 -0
  34. package/app/examples/originkey/_nano/shared/lit.js +1 -0
  35. package/app/examples/originkey/_nano/shared/nano-core.js +1 -0
  36. package/app/examples/originkey/_nano/shared/nano-elements.js +280 -0
  37. package/app/examples/originkey/_nano/shared/typebox-value.js +1 -0
  38. package/app/examples/originkey/_nano/shared/typebox.js +1 -0
  39. package/app/examples/originkey/example.originkey.js +6 -0
  40. package/app/examples/originkey/frame.html +1 -0
  41. package/app/examples/originkey/nano.json +50 -0
  42. package/app/examples/raft/example.raft.js +30 -0
  43. package/app/examples/raft/nano.json +74 -0
  44. package/app/examples/slice/nano.json +63 -0
  45. package/app/examples/slice/shout.js +14 -0
  46. package/app/examples/template/acme.template.js +20 -0
  47. package/app/examples/template/index.js +241 -0
  48. package/app/examples/template/nano.json +35 -0
  49. package/app/examples/todo/example.todo.js +8 -0
  50. package/app/examples/todo/nano.json +77 -0
  51. package/app/examples/typing/nano.json +33 -0
  52. package/app/favicon.svg +1 -0
  53. package/app/index.html +152 -0
  54. package/app/main.js +15908 -0
  55. package/app/react/index.html +50 -0
  56. package/app/react/main.js +9 -0
  57. package/app/sandbox/boot.js +980 -0
  58. package/app/shared/chunks/nano-core-296y9rgd.js +4321 -0
  59. package/app/shared/chunks/nano-core-2zz7d74m.js +16 -0
  60. package/app/shared/chunks/nano-core-35ryhkm1.js +33 -0
  61. package/app/shared/chunks/nano-core-5a3r312d.js +866 -0
  62. package/app/shared/chunks/nano-core-89mtxedm.js +186 -0
  63. package/app/shared/chunks/nano-core-bf13r20v.js +77 -0
  64. package/app/shared/chunks/nano-core-g3414rnc.js +248 -0
  65. package/app/shared/chunks/nano-core-hyg0qdwg.js +547 -0
  66. package/app/shared/chunks/nano-core-sxgrxy03.js +53 -0
  67. package/app/shared/chunks/nano-core-wg5c961d.js +4564 -0
  68. package/app/shared/lit-class-map.js +60 -0
  69. package/app/shared/lit-decorators.js +228 -0
  70. package/app/shared/lit-directive.js +11 -0
  71. package/app/shared/lit-if-defined.js +10 -0
  72. package/app/shared/lit-ref.js +12 -0
  73. package/app/shared/lit-repeat.js +141 -0
  74. package/app/shared/lit-style-map.js +67 -0
  75. package/app/shared/lit.js +47 -0
  76. package/app/shared/nano-core.js +2516 -0
  77. package/app/shared/nano-elements.js +1178 -0
  78. package/app/shared/typebox-value.js +78 -0
  79. package/app/shared/typebox.js +580 -0
  80. package/app/shared/versions.json +6 -0
  81. package/bin/nano-app.ts +34 -0
  82. package/package.json +22 -4
  83. package/src/events.ts +11 -0
  84. package/src/serve.ts +68 -0
  85. package/src/watch.ts +27 -0
@@ -0,0 +1 @@
1
+ import{xf as Y,yf as Z}from"./chunks/nano-core-mxgap7rs.js";import"./chunks/nano-core-jtgk4ch8.js";var q=(z)=>(f,A)=>{if(A!==void 0)A.addInitializer(()=>{customElements.define(z,f)});else customElements.define(z,f)};var $=!0,Q;if($)globalThis.litIssuedWarnings??=new Set,Q=(z,f)=>{if(f+=` See https://lit.dev/msg/${z} for more information.`,!globalThis.litIssuedWarnings.has(f)&&!globalThis.litIssuedWarnings.has(z))console.warn(f),globalThis.litIssuedWarnings.add(f)};var P=(z,f,A)=>{let B=f.hasOwnProperty(A);return f.constructor.createProperty(A,z),B?Object.getOwnPropertyDescriptor(f,A):void 0},W={attribute:!0,type:String,converter:Y,reflect:!1,hasChanged:Z},k=(z=W,f,A)=>{let{kind:B,metadata:J}=A;if($&&J==null)Q("missing-class-metadata",`The class ${f} is missing decorator metadata. This could mean that you're using a compiler that supports decorators but doesn't support decorator metadata, such as TypeScript 5.1. Please update your compiler.`);let K=globalThis.litPropertyMetadata.get(J);if(K===void 0)globalThis.litPropertyMetadata.set(J,K=new Map);if(B==="setter")z=Object.create(z),z.wrapped=!0;if(K.set(A.name,z),B==="accessor"){let{name:H}=A;return{set(F){let G=f.get.call(this);f.set.call(this,F),this.requestUpdate(H,G,z,!0,F)},init(F){if(F!==void 0)this._$changeProperty(H,void 0,z,F);return F}}}else if(B==="setter"){let{name:H}=A;return function(F){let G=this[H];f.call(this,F),this.requestUpdate(H,G,z,!0,F)}}throw Error(`Unsupported decorator location: ${B}`)};function S(z){return(f,A)=>{return typeof A==="object"?k(z,f,A):P(z,f,A)}}function E(z){return S({...z,state:!0,attribute:!1})}function V(z){return(f,A)=>{let B=typeof f==="function"?f:f[A];Object.assign(B,z)}}var I=(z,f,A)=>{if(A.configurable=!0,A.enumerable=!0,Reflect.decorate&&typeof f!=="object")Object.defineProperty(z,f,A);return A};var X=!0,h;if(X)globalThis.litIssuedWarnings??=new Set,h=(z,f)=>{if(f+=z?` See https://lit.dev/msg/${z} for more information.`:"",!globalThis.litIssuedWarnings.has(f)&&!globalThis.litIssuedWarnings.has(z))console.warn(f),globalThis.litIssuedWarnings.add(f)};function y(z,f){return(A,B,J)=>{let K=(H)=>{let F=H.renderRoot?.querySelector(z)??null;if(X&&F===null&&f&&!H.hasUpdated){let G=typeof B==="object"?B.name:B;h("",`@query'd field ${JSON.stringify(String(G))} with the 'cache' flag set for selector '${z}' has been accessed before the first update and returned null. This is expected if the renderRoot tree has not been provided beforehand (e.g. via Declarative Shadow DOM). Therefore the value hasn't been cached.`)}return F};if(f){let{get:H,set:F}=typeof B==="object"?A:J??(()=>{let G=X?Symbol(`${String(B)} (@query() cache)`):Symbol();return{get(){return this[G]},set(N){this[G]=N}}})();return I(A,B,{get(){let G=H.call(this);if(G===void 0){if(G=K(this),G!==null||this.hasUpdated)F.call(this,G)}return G}})}else return I(A,B,{get(){return K(this)}})}}var _;function j(z){return(f,A)=>{return I(f,A,{get(){return(this.renderRoot??(_??=document.createDocumentFragment())).querySelectorAll(z)}})}}function O(z){return(f,A)=>{return I(f,A,{async get(){return await this.updateComplete,this.renderRoot?.querySelector(z)??null}})}}function g(z){return(f,A)=>{let{slot:B,selector:J}=z??{},K=`slot${B?`[name=${B}]`:":not([name])"}`;return I(f,A,{get(){let F=this.renderRoot?.querySelector(K)?.assignedElements(z)??[];return J===void 0?F:F.filter((G)=>G.matches(J))}})}}function i(z){return(f,A)=>{let{slot:B}=z??{},J=`slot${B?`[name=${B}]`:":not([name])"}`;return I(f,A,{get(){return this.renderRoot?.querySelector(J)?.assignedNodes(z)??[]}})}}export{E as state,k as standardProperty,O as queryAsync,i as queryAssignedNodes,g as queryAssignedElements,j as queryAll,y as query,S as property,V as eventOptions,q as customElement};
@@ -0,0 +1 @@
1
+ import{Nf as r,Of as t,Pf as h}from"./chunks/nano-core-2gg2vg5g.js";import"./chunks/nano-core-jtgk4ch8.js";export{t as directive,r as PartType,h as Directive};
@@ -0,0 +1 @@
1
+ import{Kf as s}from"./chunks/nano-core-72b5e6vd.js";import"./chunks/nano-core-jtgk4ch8.js";var e=(r)=>r??s;export{e as ifDefined};
@@ -0,0 +1 @@
1
+ import{mf as r,nf as s}from"./chunks/nano-core-wanb7xw1.js";import"./chunks/nano-core-mqaje7vc.js";import"./chunks/nano-core-72b5e6vd.js";import"./chunks/nano-core-2gg2vg5g.js";import"./chunks/nano-core-jtgk4ch8.js";export{s as ref,r as createRef};
@@ -0,0 +1 @@
1
+ import{Bf as _,Cf as Z,Df as j,Ef as h,Ff as f}from"./chunks/nano-core-mqaje7vc.js";import{Jf as g}from"./chunks/nano-core-72b5e6vd.js";import{Nf as C,Of as M,Pf as O}from"./chunks/nano-core-2gg2vg5g.js";import"./chunks/nano-core-jtgk4ch8.js";var R=(A,S,W)=>{let Y=new Map;for(let b=S;b<=W;b++)Y.set(A[b],b);return Y};class v extends O{constructor(A){super(A);if(A.type!==C.CHILD)throw Error("repeat() can only be used in text expressions")}_getValuesAndKeys(A,S,W){let Y;if(W===void 0)W=S;else if(S!==void 0)Y=S;let b=[],J=[],B=0;for(let N of A)b[B]=Y?Y(N,B):B,J[B]=W(N,B),B++;return{values:J,keys:b}}render(A,S,W){return this._getValuesAndKeys(A,S,W).values}update(A,[S,W,Y]){let b=h(A),{values:J,keys:B}=this._getValuesAndKeys(S,W,Y);if(!Array.isArray(b))return this._itemKeys=B,J;let N=this._itemKeys??=[],Q=[],$,U,q=0,E=b.length-1,z=0,G=J.length-1;while(q<=E&&z<=G)if(b[q]===null)q++;else if(b[E]===null)E--;else if(N[q]===B[z])Q[z]=Z(b[q],J[z]),q++,z++;else if(N[E]===B[G])Q[G]=Z(b[E],J[G]),E--,G--;else if(N[q]===B[G])Q[G]=Z(b[q],J[G]),_(A,Q[G+1],b[q]),q++,G--;else if(N[E]===B[z])Q[z]=Z(b[E],J[z]),_(A,b[q],b[E]),E--,z++;else{if($===void 0)$=R(B,z,G),U=R(N,q,E);if(!$.has(N[q]))f(b[q]),q++;else if(!$.has(N[E]))f(b[E]),E--;else{let X=U.get(B[z]),L=X!==void 0?b[X]:null;if(L===null){let D=_(A,b[q]);Z(D,J[z]),Q[z]=D}else Q[z]=Z(L,J[z]),_(A,b[q],L),b[X]=null;z++}}while(z<=G){let X=_(A,Q[G+1]);Z(X,J[z]),Q[z++]=X}while(q<=E){let X=b[q++];if(X!==null)f(X)}return this._itemKeys=B,j(A,Q),g}}var x=M(v);export{x as repeat};
@@ -0,0 +1 @@
1
+ import{Jf as A}from"./chunks/nano-core-72b5e6vd.js";import{Nf as B,Of as E,Pf as G}from"./chunks/nano-core-2gg2vg5g.js";import"./chunks/nano-core-jtgk4ch8.js";var H="important",J=" !"+H,N=0-J.length;class K extends G{constructor(b){super(b);if(b.type!==B.ATTRIBUTE||b.name!=="style"||b.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(b){return Object.keys(b).reduce((q,x)=>{let k=b[x];if(k==null)return q;return x=x.includes("-")?x:x.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase(),q+`${x}:${k};`},"")}update(b,[q]){let{style:x}=b.element;if(this._previousStyleProperties===void 0)return this._previousStyleProperties=new Set(Object.keys(q)),this.render(q);for(let k of this._previousStyleProperties)if(q[k]==null)if(this._previousStyleProperties.delete(k),k.includes("-"))x.removeProperty(k);else x[k]=null;for(let k in q){let w=q[k];if(w!=null){this._previousStyleProperties.add(k);let z=typeof w==="string"&&w.endsWith(J);if(k.includes("-")||z)x.setProperty(k,z?w.slice(0,N):w,z?H:"");else x[k]=w}}return A}}var V=E(K);export{V as styleMap};
@@ -0,0 +1 @@
1
+ import{of as d,pf as j,qf as n}from"./chunks/nano-core-qy0mwf7y.js";import{rf as t,sf as i,tf as o,uf as r,vf as p,wf as f,xf as a,yf as c,zf as h}from"./chunks/nano-core-mxgap7rs.js";import{Gf as m,Hf as g,If as k,Jf as l,Kf as x,Lf as T,Mf as b}from"./chunks/nano-core-72b5e6vd.js";import"./chunks/nano-core-jtgk4ch8.js";export{o as unsafeCSS,g as svg,t as supportsAdoptingStyleSheets,b as render,x as nothing,c as notEqual,l as noChange,k as mathml,n as isServer,m as html,f as getCompatibleStyle,a as defaultConverter,r as css,p as adoptStyles,T as _$LH,j as _$LE,h as ReactiveElement,d as LitElement,i as CSSResult};
@@ -0,0 +1 @@
1
+ import{a as M}from"./chunks/nano-core-87v2yejk.js";import{C as b0,D as f0,N as t,d as h$,e as I0,f as j0,h as x0,m as _0,o as L0,p as k0,t as w0,w as g0,x as y0,z as B0}from"./chunks/nano-core-5h5dssvv.js";import{P as f$,V as T0}from"./chunks/nano-core-hm29e227.js";import"./chunks/nano-core-jtgk4ch8.js";/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function bQ($){return $ instanceof Uint8Array||ArrayBuffer.isView($)&&$.constructor.name==="Uint8Array"}function Z$($){if(!Number.isSafeInteger($)||$<0)throw Error("positive integer expected, got "+$)}function u($,...Q){if(!bQ($))throw Error("Uint8Array expected");if(Q.length>0&&!Q.includes($.length))throw Error("Uint8Array expected of length "+Q+", got length="+$.length)}function J$($,Q=!0){if($.destroyed)throw Error("Hash instance has been destroyed");if(Q&&$.finished)throw Error("Hash#digest() has already been called")}function H$($,Q){u($);let W=Q.outputLen;if($.length<W)throw Error("digestInto() expects output buffer of length at least "+W)}function P0($){return new Uint8Array($.buffer,$.byteOffset,$.byteLength)}function p($){return new Uint32Array($.buffer,$.byteOffset,Math.floor($.byteLength/4))}function n(...$){for(let Q=0;Q<$.length;Q++)$[Q].fill(0)}function N$($,Q){return $<<32-Q|$>>>Q}var M0=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function G0($){return $<<24&4278190080|$<<8&16711680|$>>>8&65280|$>>>24&255}var O0=M0?($)=>$:($)=>G0($);function fQ($){for(let Q=0;Q<$.length;Q++)$[Q]=G0($[Q]);return $}var x=M0?($)=>$:fQ,hQ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),uQ=Array.from({length:256},($,Q)=>Q.toString(16).padStart(2,"0"));function D0($){if(u($),hQ)return $.toHex();let Q="";for(let W=0;W<$.length;W++)Q+=uQ[$[W]];return Q}function k$($){if(typeof $!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode($))}function l($){if(typeof $==="string")$=k$($);return u($),$}class w${}function V0($){let Q=(Z,Y)=>$(Y).update(l(Z)).digest(),W=$({});return Q.outputLen=W.outputLen,Q.blockLen=W.blockLen,Q.create=(Z)=>$(Z),Q}var S0=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var P$=BigInt(4294967295),A0=BigInt(32);function g$($,Q=!1){if(Q)return{h:Number($&P$),l:Number($>>A0&P$)};return{h:Number($>>A0&P$)|0,l:Number($&P$)|0}}function g($,Q,W,Z,Y){return $=$+Q+Y|0,Z=N$(Z^$,16),W=W+Z|0,Q=N$(Q^W,12),{a:$,b:Q,c:W,d:Z}}function y($,Q,W,Z,Y){return $=$+Q+Y|0,Z=N$(Z^$,8),W=W+Z|0,Q=N$(Q^W,7),{a:$,b:Q,c:W,d:Z}}class y$ extends w${constructor($,Q){super();this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Z$($),Z$(Q),this.blockLen=$,this.outputLen=Q,this.buffer=new Uint8Array($),this.buffer32=p(this.buffer)}update($){J$(this),$=l($),u($);let{blockLen:Q,buffer:W,buffer32:Z}=this,Y=$.length,J=$.byteOffset,X=$.buffer;for(let N=0;N<Y;){if(this.pos===Q)x(Z),this.compress(Z,0,!1),x(Z),this.pos=0;let R=Math.min(Q-this.pos,Y-N),q=J+N;if(R===Q&&!(q%4)&&N+R<Y){let z=new Uint32Array(X,q,Math.floor((Y-N)/4));x(z);for(let K=0;N+Q<Y;K+=Z.length,N+=Q)this.length+=Q,this.compress(z,K,!1);x(z);continue}W.set($.subarray(N,N+R),this.pos),this.pos+=R,this.length+=R,N+=R}return this}digestInto($){J$(this),H$($,this);let{pos:Q,buffer32:W}=this;this.finished=!0,n(this.buffer.subarray(Q)),x(W),this.compress(W,0,!0),x(W);let Z=p($);this.get().forEach((Y,J)=>Z[J]=O0(Y))}digest(){let{buffer:$,outputLen:Q}=this;this.digestInto($);let W=$.slice(0,Q);return this.destroy(),W}_cloneInto($){let{buffer:Q,length:W,finished:Z,destroyed:Y,outputLen:J,pos:X}=this;return $||($=new this.constructor({dkLen:J})),$.set(...this.get()),$.buffer.set(Q),$.destroyed=Y,$.finished=Z,$.length=W,$.pos=X,$.outputLen=J,$}clone(){return this._cloneInto()}}function B$($,Q,W,Z,Y,J,X,N,R,q,z,K,H,P,G,D,S,V,A,U){let F=0;for(let T=0;T<Z;T++)({a:Y,b:R,c:H,d:S}=g(Y,R,H,S,W[Q+$[F++]])),{a:Y,b:R,c:H,d:S}=y(Y,R,H,S,W[Q+$[F++]]),{a:J,b:q,c:P,d:V}=g(J,q,P,V,W[Q+$[F++]]),{a:J,b:q,c:P,d:V}=y(J,q,P,V,W[Q+$[F++]]),{a:X,b:z,c:G,d:A}=g(X,z,G,A,W[Q+$[F++]]),{a:X,b:z,c:G,d:A}=y(X,z,G,A,W[Q+$[F++]]),{a:N,b:K,c:D,d:U}=g(N,K,D,U,W[Q+$[F++]]),{a:N,b:K,c:D,d:U}=y(N,K,D,U,W[Q+$[F++]]),{a:Y,b:q,c:G,d:U}=g(Y,q,G,U,W[Q+$[F++]]),{a:Y,b:q,c:G,d:U}=y(Y,q,G,U,W[Q+$[F++]]),{a:J,b:z,c:D,d:S}=g(J,z,D,S,W[Q+$[F++]]),{a:J,b:z,c:D,d:S}=y(J,z,D,S,W[Q+$[F++]]),{a:X,b:K,c:H,d:V}=g(X,K,H,V,W[Q+$[F++]]),{a:X,b:K,c:H,d:V}=y(X,K,H,V,W[Q+$[F++]]),{a:N,b:R,c:P,d:A}=g(N,R,P,A,W[Q+$[F++]]),{a:N,b:R,c:P,d:A}=y(N,R,P,A,W[Q+$[F++]]);return{v0:Y,v1:J,v2:X,v3:N,v4:R,v5:q,v6:z,v7:K,v8:H,v9:P,v10:G,v11:D,v12:S,v13:V,v14:A,v15:U}}var k={CHUNK_START:1,CHUNK_END:2,PARENT:4,ROOT:8,KEYED_HASH:16,DERIVE_KEY_CONTEXT:32,DERIVE_KEY_MATERIAL:64},B=S0.slice(),E0=(()=>{let $=Array.from({length:16},(Z,Y)=>Y),Q=(Z)=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map((Y)=>Z[Y]),W=[];for(let Z=0,Y=$;Z<7;Z++,Y=Q(Y))W.push(...Y);return Uint8Array.from(W)})();class b$ extends y${constructor($={},Q=0){super(64,$.dkLen===void 0?32:$.dkLen);this.chunkPos=0,this.chunksDone=0,this.flags=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0;let{key:W,context:Z}=$,Y=Z!==void 0;if(W!==void 0){if(Y)throw Error('Only "key" or "context" can be specified at same time');let J=l(W).slice();u(J,32),this.IV=p(J),x(this.IV),this.flags=Q|k.KEYED_HASH}else if(Y){let J=l(Z),X=new b$({dkLen:32},k.DERIVE_KEY_CONTEXT).update(J).digest();this.IV=p(X),x(this.IV),this.flags=Q|k.DERIVE_KEY_MATERIAL}else this.IV=B.slice(),this.flags=Q;this.state=this.IV.slice(),this.bufferOut=P0(this.bufferOut32)}get(){return[]}set(){}b2Compress($,Q,W,Z=0){let{state:Y,pos:J}=this,{h:X,l:N}=g$(BigInt($),!0),{v0:R,v1:q,v2:z,v3:K,v4:H,v5:P,v6:G,v7:D,v8:S,v9:V,v10:A,v11:U,v12:F,v13:T,v14:f,v15:C}=B$(E0,Z,W,7,Y[0],Y[1],Y[2],Y[3],Y[4],Y[5],Y[6],Y[7],B[0],B[1],B[2],B[3],X,N,J,Q);Y[0]=R^S,Y[1]=q^V,Y[2]=z^A,Y[3]=K^U,Y[4]=H^F,Y[5]=P^T,Y[6]=G^f,Y[7]=D^C}compress($,Q=0,W=!1){let Z=this.flags;if(!this.chunkPos)Z|=k.CHUNK_START;if(this.chunkPos===15||W)Z|=k.CHUNK_END;if(!W)this.pos=this.blockLen;if(this.b2Compress(this.chunksDone,Z,$,Q),this.chunkPos+=1,this.chunkPos===16||W){let Y=this.state;this.state=this.IV.slice();for(let J,X=this.chunksDone+1;W||!(X&1);X>>=1){if(!(J=this.stack.pop()))break;this.buffer32.set(J,0),this.buffer32.set(Y,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|k.PARENT,this.buffer32,0),Y=this.state,this.state=this.IV.slice()}this.chunksDone++,this.chunkPos=0,this.stack.push(Y)}this.pos=0}_cloneInto($){$=super._cloneInto($);let{IV:Q,flags:W,state:Z,chunkPos:Y,posOut:J,chunkOut:X,stack:N,chunksDone:R}=this;return $.state.set(Z.slice()),$.stack=N.map((q)=>Uint32Array.from(q)),$.IV.set(Q),$.flags=W,$.chunkPos=Y,$.chunksDone=R,$.posOut=J,$.chunkOut=X,$.enableXOF=this.enableXOF,$.bufferOut32.set(this.bufferOut32),$}destroy(){this.destroyed=!0,n(this.state,this.buffer32,this.IV,this.bufferOut32),n(...this.stack)}b2CompressOut(){let{state:$,pos:Q,flags:W,buffer32:Z,bufferOut32:Y}=this,{h:J,l:X}=g$(BigInt(this.chunkOut++));x(Z);let{v0:N,v1:R,v2:q,v3:z,v4:K,v5:H,v6:P,v7:G,v8:D,v9:S,v10:V,v11:A,v12:U,v13:F,v14:T,v15:f}=B$(E0,0,Z,7,$[0],$[1],$[2],$[3],$[4],$[5],$[6],$[7],B[0],B[1],B[2],B[3],X,J,Q,W);Y[0]=N^D,Y[1]=R^S,Y[2]=q^V,Y[3]=z^A,Y[4]=K^U,Y[5]=H^F,Y[6]=P^T,Y[7]=G^f,Y[8]=$[0]^D,Y[9]=$[1]^S,Y[10]=$[2]^V,Y[11]=$[3]^A,Y[12]=$[4]^U,Y[13]=$[5]^F,Y[14]=$[6]^T,Y[15]=$[7]^f,x(Z),x(Y),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,n(this.buffer.subarray(this.pos));let $=this.flags|k.ROOT;if(this.stack.length)$|=k.PARENT,x(this.buffer32),this.compress(this.buffer32,0,!0),x(this.buffer32),this.chunksDone=0,this.pos=this.blockLen;else $|=(!this.chunkPos?k.CHUNK_START:0)|k.CHUNK_END;this.flags=$,this.b2CompressOut()}writeInto($){J$(this,!1),u($),this.finish();let{blockLen:Q,bufferOut:W}=this;for(let Z=0,Y=$.length;Z<Y;){if(this.posOut>=Q)this.b2CompressOut();let J=Math.min(Q-this.posOut,Y-Z);$.set(W.subarray(this.posOut,this.posOut+J),Z),this.posOut+=J,Z+=J}return $}xofInto($){if(!this.enableXOF)throw Error("XOF is not possible after digest call");return this.writeInto($)}xof($){return Z$($),this.xofInto(new Uint8Array($))}digestInto($){if(H$($,this),this.finished)throw Error("digest() was already called");return this.enableXOF=!1,this.writeInto($),this.destroy(),$}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}var U0=V0(($)=>new b$($));function F0($,Q){var W="",Z=Q&&Q.include,Y=Q&&Q.exclude;if(Y){if(typeof Y==="string")Y=[Y]}if(Z)Z.sort();var J=new WeakMap,X=Q&&Q.allowCircular,N=Q&&Q.filterUndefined,R=Q&&Q.undefinedInArrayToNull;return q($,""),W;function q(z,K){if(z===null||typeof z!=="object"||z.toJSON!=null)W+=JSON.stringify(z);else if(Array.isArray(z)){var H=J.get(z);if(H!==void 0){if(K.startsWith(H)){if(!X)throw Error("Circular reference detected");W+='"[Circular]"';return}}J.set(z,K),W+="[";var P=!1;z.forEach(function(V,A){if(P)W+=",";if(P=!0,R&&V===void 0)V=null;q(V,K+"["+A+"]")}),W+="]"}else{var H=J.get(z);if(H!==void 0){if(K.startsWith(H)){if(!X)throw Error("Circular reference detected");W+='"[Circular]"';return}}J.set(z,K),W+="{";var G=!1,D=function(A){if(Y&&Y.includes(A))return;if(G)W+=",";G=!0,W+=JSON.stringify(A),W+=":",q(z[A],K+"."+A)};if(K===""&&Z)Z.forEach(function(A){if(z.hasOwnProperty(A))D(A)});else{var S=Object.keys(z);if(N)S=S.filter(function(A){return z[A]!==void 0});S.sort(),S.forEach(function(A){D(A)})}W+="}"}}}function C0($,Q){return F0($,{allowCircular:Q,filterUndefined:!0,undefinedInArrayToNull:!0})}class M${constructor($,Q){this.hasCodec=y0($,Q),this.buildResult=h$($,Q),this.evaluateResult=this.buildResult.Evaluate()}IsAccelerated(){return this.evaluateResult.IsAccelerated()}Context(){return this.buildResult.Context()}Type(){return this.buildResult.Schema()}Code(){return this.evaluateResult.Code()}Check($){return this.evaluateResult.Check($)}Parse($){if(this.Check($))return $;if(T0.Get().correctiveParse)return f0(this.Context(),this.Type(),$);I0();let W=this.Errors($);throw j0(),new b0($,W)}Errors($){if(this.IsAccelerated()&&this.Check($))return[];return x0(this.Context(),this.Type(),$)}Clean($){return _0(this.Context(),this.Type(),$)}Convert($){return L0(this.Context(),this.Type(),$)}Create(){return B0(this.Context(),this.Type())}Default($){return k0(this.Context(),this.Type(),$)}Decode($){return this.hasCodec?w0(this.Context(),this.Type(),$):this.Parse($)}Encode($){return this.hasCodec?g0(this.Context(),this.Type(),$):this.Parse($)}}function u$(...$){let[Q,W]=f$.Match($,{2:(Z,Y)=>[Z,Y],1:(Z)=>[{},Z]});return new M$(Q,W)}var m$=($)=>C0($),d$=($)=>D0(U0(k$($))),mQ=new Set(["description","title","examples","$comment"]),dQ=new Set(["const","enum","default"]),cQ=new Set(["properties","patternProperties","$defs"]);function G$($,Q=!1){if(Array.isArray($))return $.map((Z)=>G$(Z));if($===null||typeof $!=="object")return $;let W={};for(let[Z,Y]of Object.entries($)){if(!Q&&mQ.has(Z))continue;W[Z]=Q?G$(Y):dQ.has(Z)?Y:Z==="required"&&Array.isArray(Y)?[...Y].sort():G$(Y,cQ.has(Z))}return W}function vQ($,Q=new Set){if($===null||typeof $==="string"||typeof $==="boolean")return!0;if(typeof $==="number")return Number.isFinite($);if(typeof $!=="object"||Q.has($))return!1;let W=Object.getPrototypeOf($);if(!Array.isArray($)&&W!==Object.prototype&&W!==null)return!1;Q.add($);let Z=Object.values($).every((Y)=>vQ(Y,Q));return Q.delete($),Z}var c$=($)=>m$(G$($)),h0=new WeakSet;function u0($,Q=new Set){if(typeof $==="function")return!0;if($===null||typeof $!=="object"||Q.has($)||h0.has($))return!1;return Q.add($),Reflect.ownKeys($).some((W)=>u0($[W],Q))}function rQ($,Q){if(u0($))throw Error(`${Q??"schema"}: schema is not JSON`);let W,Z=(X)=>(W??=u$($)).Check(X),Y={...Q!==void 0&&{label:Q},schema:$,hash:d$(c$($)),check:Z,encode:(X)=>JSON.stringify(X),decode(X){try{let N=JSON.parse(X);return Z(N)?N:void 0}catch{return}}},J=Object.defineProperties({},Object.getOwnPropertyDescriptors($));for(let[X,N]of Object.entries(Y))Object.defineProperty(J,X,{value:N});return h0.add(J),J}var O$={define:rQ};var m0=($)=>("hash"in $)&&("check"in $)?$:O$.define($);function d0($,Q,W,Z){let Y=Q&&m0(Q);return{kind:$,...Y&&{input:Y},output:m0(W),...Z?.description!==void 0&&{description:Z.description}}}var v$={action:($,Q,W)=>d0("action",$,Q,W),event:($,Q)=>d0("event",void 0,$,Q)};function c0($,Q){if(!$.output||!Q.input)return!1;return $.output.hash===Q.input.hash||c$(Q.input.schema)==="{}"}var pQ=/^[a-zA-Z][a-zA-Z0-9-]*([./][a-zA-Z0-9-]+)*$/,p$=/^[a-zA-Z0-9-]+$/,nQ=/^[^/@\s#\x00-\x1f\x7f]{1,64}$/,lQ=/^[^/@.\s#\x00-\x1f\x7f]{1,64}$/,i=($,Q,W)=>{if(!$)throw Error(`bad ${Q} ${JSON.stringify(W)}`)},o=($,Q)=>Object.freeze(Object.assign($,{toString:()=>Q,toJSON:()=>Q}));function D$($){i(pQ.test($),"namespace",$);let Q=o({kind:"namespace",name:$,interfaceId:(W)=>{return i(p$.test(W),"name",W),o({kind:"interface",ns:Q,name:W},`${$}.${W}`)},implementationId:(W)=>{return i(p$.test(W),"name",W),o({kind:"implementation",ns:Q,name:W},`${$}/${W}`)}},$);return Q}function v0($,Q){return i(p$.test(Q),"op name",Q),o({kind:"port",interface:$,op:Q},`${$}/${Q}`)}function n$($){return i(nQ.test($),"runtime",$),o({kind:"runtime",id:$},$)}function r0($,Q,W){return i(lQ.test(W),"pod",W),o({kind:"pod",implementation:$,runtime:Q,pod:W},`${$}@${Q}/${W}`)}var r$=($,Q)=>{let W=$.lastIndexOf(Q);return W>0?[$.slice(0,W),$.slice(W+1)]:void 0};function l$($,Q){let W=()=>{throw Error(`bad ${$} coordinate ${JSON.stringify(Q)}`)},Z=(Y)=>{try{return Y()}catch{return W()}};switch($){case"namespace":return Z(()=>D$(Q));case"interface":{let[Y,J]=r$(Q,".")??W();return Z(()=>D$(Y).interfaceId(J))}case"implementation":{let[Y,J]=r$(Q,"/")??W();return Z(()=>D$(Y).implementationId(J))}case"port":{let[Y,J]=r$(Q,"/")??W();return Z(()=>v0(l$("interface",Y),J))}case"runtime":return Z(()=>n$(Q));default:{let Y=Q.indexOf("@"),J=Q.indexOf("/",Y);if(Y<0||J<0)W();return Z(()=>r0(l$("implementation",Q.slice(0,Y)),n$(Q.slice(Y+1,J)),Q.slice(J+1)))}}}var m={namespace:D$,port:v0,runtime:n$,pod:r0,parse:l$};var E=($)=>({ok:!0,value:$}),O=($,Q,W)=>({ok:!1,fail:W===void 0?{type:$,reason:Q}:{type:$,reason:Q,coord:W}});function p0($){if($===null||typeof $!=="object")return!1;let Q=$;if(Q.ok===!0)return"value"in Q;return Q.ok===!1&&typeof Q.fail?.type==="string"&&typeof Q.fail.reason==="string"}function iQ($,Q){let W=Q,Z={};for(let Y of Object.values($.ops)){if(Y.kind!=="action"||typeof W[Y.name]!=="function")continue;Z[Y.name]=async(J,X)=>{try{return E(await W[Y.name].call(Q,J,X)??null)}catch(N){let R=N?.fail;return R?{ok:!1,fail:R}:O("threw",N instanceof Error?N.message:String(N))}}}return Z}var _=($)=>Object.assign(Error(`${$.type}: ${$.reason}`),{fail:$});function V$($,Q){return new Proxy({},{get:(W,Z)=>{if(typeof Z!=="string"||Z==="then")return;let Y=$?.ops[Z]?.kind==="event"?$.ops[Z]:void 0;if(Y)return()=>{let J=Q();if(!J.ok)throw _(J.fail);let X=J.value.on(Y);return{async*[Symbol.asyncIterator](){for await(let N of X)yield N.output}}};return async(J)=>{let X=Q();if(!X.ok)throw _(X.fail);let N=await X.value.call[Z](J??null);if(N.ok)return N.value;throw _(N.fail)}}})}function S$($,Q){let W=Q,Z=new Map;for(let Y of Object.values($.ops)){let J=W[Y.name];if(Y.kind==="event"&&typeof J==="function")Z.set(I($,Y),{op:Y,run:()=>J.call(Q)})}return{...n0($,iQ($,Q)),sources:Z}}var oQ=($)=>("byCoord"in $);function X$($){if(!oQ($))return $;let{tags:Q,implementation:W,provider:Z,runtime:Y}=$;return{implements:m.parse("interface",$.coord),...Q&&{tags:Q},...W!==void 0&&{implementation:W},...Z!==void 0&&{provider:Z},...Y!==void 0&&{runtime:Y}}}var tQ=($,Q={})=>({...$,...Q,implements:m.parse("interface",$.coord)}),l0=($,Q)=>($.implements===void 0||Q.provides.has(String($.implements)))&&($.tags??[]).every((W)=>Q.tags.has(W))&&($.implementation===void 0||String($.implementation)===Q.implementation)&&($.provider===void 0||String($.provider)===Q.provider)&&($.runtime===void 0||String($.runtime)===Q.runtime),UY={of:tQ};var i0=($)=>("ops"in $)?$:void 0;function n0($,Q){let W=Q,Z=new Map;for(let Y of Object.values($.ops)){let J=Y.kind==="event"?void 0:W[Y.name];if(J)Z.set(I($,Y),J)}return{iface:$,handlers:Z}}function aQ($,Q){let W=String($),Z=W.lastIndexOf("/");if(!t0.test(W)||Z<0)throw Error(`bad implementation coordinate ${W}`);let Y={};for(let[J,X]of Object.entries(Q.calls??{})){if(!Q.provides.some((N)=>(J in N.ops)))throw Error(`${W}: ${J} is not an op this implementation provides`);Y[J]=Object.entries(X).flatMap(([N,R])=>{let q=Q.dependencies?.[N];if(!q)throw Error(`${W}: ${N} is not a dependency`);let z=i0(q);return R.map((K)=>{if(z&&!z.byCoord.has(K.coord))throw Error(`${W}: ${z.coord} has no op ${K.name}`);return`${N}.${K.name}`})})}return{coord:W,calls:Y,provider:W.slice(0,Z),provides:Q.provides,dependencies:Object.fromEntries(Object.entries(Q.dependencies??{}).map(([J,X])=>[J,X$(X)])),...Q.config&&{config:Q.config},...Q.description!==void 0&&{description:Q.description},async make(J,X){let N=(D)=>Object.assign(Object.create(D),{deps:Object.fromEntries(Object.keys(Q.dependencies??{}).map((S)=>[S,V$(i0(Q.dependencies[S]),()=>D.one(X$(Q.dependencies[S])))]))}),R=N(J),q=await Q.make(R,X);if(!Array.isArray(q)&&Q.provides.length!==1)throw Error(`${W}: a plain object provides exactly one interface`);let z=Array.isArray(q)?q:[S$(Q.provides[0],q)],K=new Set(Q.provides.map((D)=>D.coord)),H=new Set,P=new Map,G=new Map;for(let D of z){let S=D.iface.coord;if(!K.has(S))throw Error(`${W}: ${S} is not provided`);if(H.has(S))throw Error(`${W}: ${S} is provided twice`);H.add(S);for(let[V,A]of D.handlers)P.set(V,(U,F)=>A(U,N(F)));for(let[V,A]of D.sources??[])G.set(V,A)}for(let D of Q.provides)for(let S of Object.values(D.ops))if(S.kind!=="event"&&!P.has(I(D,S)))throw Error(`${W}: missing ${I(D,S)}`);return{handlers:P,sources:G}}}}var o0={define:aQ};var a0=($)=>("hash"in $)&&("check"in $)?$:O$.define($);function q$($,Q,W={deps:{}}){let{deps:Z,config:Y,description:J}=W,X=(N)=>Object.assign(o0.define(Q,{provides:N.map(([R])=>R),dependencies:Z,...Y&&{config:Y},...J!==void 0&&{description:J},async make(R,q){let z=Object.assign(Object.create(R),{config:q}),K=[];for(let[H,P]of N)K.push(S$(H,await P(z)));return K}}),{satisfies:(R,q)=>X([...N,[R,q]])});return{needs:(N)=>q$($,Q,{...W,deps:N}),config:(N)=>q$($,Q,{...W,config:a0(N)}),description:(N)=>q$($,Q,{...W,description:N}),make:(N)=>X([[$,N]]),create:(N)=>q$($,Q,{deps:N.needs??{},...N.config&&{config:a0(N.config)},...N.description!==void 0&&{description:N.description}}).make(N.make)}}var t0=/^[a-zA-Z][a-zA-Z0-9-]*([./][a-zA-Z0-9-]+)+$/,I=($,Q)=>`${$.coord}/${Q.name}`;function sQ($,Q){let W=String($);try{m.parse("interface",W)}catch{throw Error(`bad interface coordinate ${W}`)}let Z=Object.fromEntries(Object.entries(Q).map(([J,X])=>[J,{...X,name:J,coord:d$(m$({name:J,input:X.input?.hash??null,output:X.output.hash}))}])),Y={coord:W,ops:Z,byCoord:new Map(Object.values(Z).map((J)=>[J.coord,J])),impl:(J)=>q$(Y,J)};return Y}var A$={define:sQ};function s0($,Q,W={}){let Z=String($),Y=new Map;for(let J of Q){if(J.provider!==Z)throw Error(`${J.coord} is not under ${Z}`);if(Y.has(J.coord))throw Error(`${J.coord} is listed twice`);Y.set(J.coord,J)}return{coord:Z,implementations:Y,meta:W}}var E$={define:s0};function eQ($){let Q=m.namespace($),W=Object.freeze({...Q,interfaceId:(Z)=>Object.freeze({...Q.interfaceId(Z),ns:W}),implementationId:(Z)=>Object.freeze({...Q.implementationId(Z),ns:W}),interface:(Z,Y)=>A$.define(W.interfaceId(Z),Y),provider:(Z,Y)=>s0(W,Z,Y)});return W}var BY={...m,namespace:eQ};var e0=($)=>[...$.byCoord.keys()].sort().join(),i$=($,Q)=>$.coord<Q.coord?-1:$.coord>Q.coord?1:0;function $Q(){let $=new Map,Q=new Map,W=new Map,Z=new Map,Y=new Map;return{add(J){if($.has(J.coord))return O("invalid-input",`provider ${J.coord} is already registered`);let X=new Map;for(let N of J.implementations.values())for(let R of N.provides){let q=W.get(R.coord)??X.get(R.coord);if(q&&e0(q)!==e0(R))return O("invalid-input",`interface ${R.coord} differs`);X.set(R.coord,q??R)}$.set(J.coord,J);for(let N of J.implementations.values()){Q.set(N.coord,N);for(let R of N.provides){if(!W.has(R.coord))W.set(R.coord,R);for(let q of R.byCoord.values())if(!Z.has(q.coord))Z.set(q.coord,q);Y.set(R.coord,[...Y.get(R.coord)??[],N])}}return E(void 0)},manifest:()=>({providers:[...$.values()].sort(i$).map((J)=>({coord:J.coord,implementations:[...J.implementations.keys()].sort()})),implementations:[...Q.values()].sort(i$).map((J)=>({coord:J.coord,provides:J.provides.map((X)=>X.coord).sort(),dependencies:JSON.parse(JSON.stringify(J.dependencies))})),interfaces:[...W.values()].sort(i$).map((J)=>({coord:J.coord,ops:Object.values(J.ops).map((X)=>({name:X.name,kind:X.kind,coord:X.coord,...X.input&&{input:X.input.hash},...X.output&&{output:X.output.hash}}))}))}),provider:(J)=>$.get(J),implementation:(J)=>Q.get(J),implementationsOf:(J)=>Y.get(J)??[],interface:(J)=>W.get(J),op:(J)=>Z.get(J)}}async function $W($,Q){let W=$Q(),Z={};for(let[Y,J]of Object.entries($)){let X;try{X=await import(new URL(J,Q).href)}catch(z){return O("not-found",`${Y} (${J}): ${z instanceof Error?z.message:String(z)}`)}let R=X.default,q=R&&typeof R.coord==="string"&&R.implementations instanceof Map?W.add(R):O("invalid-input",`${J} has no default Provider`);if(!q.ok)return q;Z[Y]=X}return E({registry:W,exports:Z})}var c={create:$Q,load:$W};var QW=Object.freeze({isAllowed:()=>({approved:!0})}),t$={allowAll:()=>QW},QQ=M.Union([M.Literal("call"),M.Literal("pipe"),M.Literal("on"),M.Literal("subscribe"),M.Literal("unsubscribe"),M.Literal("lifecycle"),M.Literal("start"),M.Literal("*")]),WQ=M.Union([QQ,M.Array(QQ)]),YQ={from:M.Optional(M.String()),toPod:M.Optional(M.String()),toInterface:M.Optional(M.String()),toPort:M.Optional(M.String()),outside:M.Optional(M.Boolean())},ZQ=M.Union([M.Object({allow:WQ,...YQ},{additionalProperties:!1}),M.Object({deny:WQ,...YQ},{additionalProperties:!1})]),o$=($,Q)=>$===void 0||$==="*"||$===Q,WW=($,Q,W)=>($.kinds.has("*")||$.kinds.has(Q.kind))&&o$($.r.toPod,Q.to)&&o$($.r.toInterface,W)&&o$($.r.toPort,Q.port)&&($.r.outside===void 0||$.r.outside===Q.outside);function JQ($){let Q=new Map,W=[];return $.forEach((Z,Y)=>{let J={i:Y,allow:"allow"in Z,kinds:new Set(["allow"in Z?Z.allow:Z.deny].flat()),r:Z};if(Z.from===void 0||Z.from==="*")W.push(J);else{let X=Q.get(Z.from);if(X)X.push(J);else Q.set(Z.from,[J])}}),{isAllowed:(Z)=>{let Y=Z.port?.slice(0,Z.port.lastIndexOf("/")),J=Q.get(Z.from)??[],X=0,N=0,R;while(!R&&(X<J.length||N<W.length)){let q=N>=W.length||X<J.length&&J[X].i<W[N].i?J[X++]:W[N++];if(WW(q,Z,Y))R=q}if(!R)return{approved:!1,reason:"no rule allows it"};return R.allow?{approved:!0}:{approved:!1,reason:`rules[${R.i}]`}}}}var YW=Object.freeze({isAllowed:()=>({approved:!0})}),NQ={allowAll:()=>YW};var XQ=($)=>(Q,W={})=>({implementation:Q.coord,...W.config!==void 0&&{config:W.config},eager:$,...W.isolation!==void 0&&W.isolation!=="host"&&{isolation:W.isolation}}),qQ={lazy:XQ(!1),eager:XQ(!0)};var v=M.String({pattern:/^[^/\s#\x00-\x1f\x7f]{1,64}$/.source}),ZW=M.String({pattern:/^[^/.\s#\x00-\x1f\x7f]{1,64}$/.source}),a$={additionalProperties:!1},JW=M.Record(ZW,M.Object({implementation:M.String(),config:M.Optional(M.Unknown()),eager:M.Boolean(),isolation:M.Optional(M.Union([M.Literal("host"),M.Literal("sandbox"),M.Literal("isolated-sandbox"),M.Literal("home-origin")]))},a$),{...a$,maxProperties:5000}),NW=M.Record(v,M.Array(M.String()),a$);function d($,Q,W){let Z=t.Errors($,Q)[0];if(!Z)return;let Y=Z.message==="schema is false"?"not allowed here (an unknown key, or a name breaking the id rule)":Z.message;return`${W} ${Z.instancePath||"/"}: ${Y}`}var RQ=new WeakMap,R$=($)=>RQ.get($);function zQ($,Q,W,Z){let Y=Object.freeze({names:()=>[...$.keys()],get:(J)=>structuredClone($.get(J)),select(J){if(!Array.isArray(J)||J.some((z)=>typeof z!=="string"))return O("invalid-input","select takes pod names");let X=new Set,N=J.find((z)=>X.size===X.add(z).size),R=J.find((z)=>!$.has(z));if(N!==void 0)return O("invalid-input",`pod ${N} is selected twice`);if(R!==void 0)return O("not-found",`no pod ${R}`);let q=Z&&Object.fromEntries(J.filter((z)=>Object.hasOwn(Z,z)).map((z)=>[z,Z[z]]));return E(zQ(new Map(J.map((z)=>[z,$.get(z)])),Q,W??Y,q))},deployment:()=>structuredClone(Object.fromEntries($))});return RQ.set(Y,Object.freeze({registry:Q,root:W??Y,...Z&&{tags:Z},pods:$})),Y}function XW($,Q){try{let W=structuredClone($),Z=structuredClone(Q.tags),Y=d(JW,W,"pods")??(Z===void 0?void 0:d(NW,Z,"tags"));if(Y)return O("invalid-input",Y);let J=Object.keys(Z??{}).find((X)=>!Object.hasOwn(W,X));if(J!==void 0)return O("invalid-input",`tags: no pod ${J}`);for(let[X,N]of Object.entries(W)){if(X==="host")return O("invalid-input","pod name 'host' is reserved for the host");let R=Q.registry.implementation(N.implementation);if(!R)return O("not-found",`pod ${X}: no implementation ${N.implementation}`);if(R.config&&!R.config.check(N.config))return O("invalid-input",`pod ${X}: config does not fit ${R.config.label??"its schema"}`)}return E(zQ(new Map(Object.entries(W)),Q.registry,void 0,Z))}catch(W){return O("invalid-input",`unreadable pods: ${W instanceof Error?W.message:String(W)}`)}}var s$={create:XW};var a={additionalProperties:!1},qW=M.Object({pods:M.Array(M.String()),subscriptions:M.Array(M.Union([M.Object({kind:M.Literal("call"),from:M.String(),to:M.String(),ops:M.Optional(M.Array(M.Object({source:M.String(),target:M.String()},a),{maxItems:2000}))},a),M.Object({kind:M.Literal("pipe"),from:M.String(),source:M.String(),to:M.String(),target:M.String()},a)]),{maxItems:2000}),policy:M.Optional(M.Union([M.Object({kind:M.Literal("allow-all")},a),M.Object({kind:M.Literal("rules"),rules:M.Array(ZQ,{maxItems:2000})},a)]))},a),U$=($)=>$.kind==="call"?`${$.from}->${$.to}`:`${$.from}->${$.to} (${$.source} to ${$.target})`,KQ=new WeakMap,s=($,Q)=>{let W=KQ.get($);if(!W){W=new Map;for(let Z of $.provides)for(let Y of Object.values(Z.ops))if(!W.has(I(Z,Y)))W.set(I(Z,Y),Y);KQ.set($,W)}return W.get(Q)};function RW($,Q,W){if($.kind==="call"){let J=Object.values(Q.dependencies).flatMap((N)=>N.implements===void 0?[]:[String(N.implements)]);if(J.length&&!W.provides.some((N)=>J.includes(N.coord)))return`${$.to} provides none of ${$.from}'s dependencies`;let X=new Set;for(let N of $.ops??[]){if(!s(Q,N.source))return`${N.source} is not an op of ${$.from}`;if(s(W,N.target)?.kind!=="action")return`${N.target} is not an action of ${$.to}`;if(X.size===X.add(JSON.stringify([N.source,N.target])).size)return`${N.source} to ${N.target} is there twice`}return}let Z=s(Q,$.source),Y=s(W,$.target);if(!Z)return`${$.source} is not an event or action of ${$.from}`;if(Y?.kind!=="action")return`${$.target} is not an action of ${$.to}`;return c0(Z,Y)?void 0:`${$.source} does not fit ${$.target}`}function zW($,Q,W){let Z=R$(W);if(!Z)return`runtime ${$}: its pods do not come from Pods.create`;let Y=new Set,J=new Set;for(let X of Q.pods){if(!Z.pods.has(X))return`runtime ${$}: no pod ${X}`;if(Y.size===Y.add(X).size)return`runtime ${$}: ${X} is placed twice`}for(let X of Q.subscriptions){if(!Z.pods.has(X.from))return`runtime ${$}: ${U$(X)}: no pod ${X.from}`;let N=(X.kind==="call"?[X.to]:[X.from,X.to]).find((K)=>!Y.has(K));if(N!==void 0)return`runtime ${$}: ${U$(X)}: ${N} is not placed here`;let R=JSON.stringify(X.kind==="call"?[X.from,X.to]:[X.from,X.to,X.source,X.target]);if(J.has(R))return`runtime ${$}: ${U$(X)} is there twice`;J.add(R);let q=(K)=>Z.registry.implementation(Z.pods.get(K).implementation),z=RW(X,q(X.from),q(X.to));if(z)return`runtime ${$}: ${U$(X)}: ${z}`}}var HQ=new WeakSet,PQ=($)=>HQ.has($);function KW($,Q,W){try{let Z=structuredClone(Q),Y=d(qW,Z,`runtime ${$}`)??zW($,Z,W);if(Y)return O("invalid-input",Y);let J=Object.freeze({id:$,pods:W,deployment:()=>structuredClone(Z)});return HQ.add(J),E(J)}catch(Z){return O("invalid-input",`unreadable runtime ${$}: ${Z instanceof Error?Z.message:String(Z)}`)}}var e$={create:KW};function MQ($,Q){let W=structuredClone($),Z=(K)=>W.runtimes[K]??={pods:[],subscriptions:[]},Y=(K,H)=>{throw _({type:K,reason:H})};function J(K,H){if(Object.hasOwn(W.pods,H.pod))Y("invalid-input",`pod ${H.pod} is already in the deployment`);W.pods[H.pod]={implementation:K.coord,eager:H.eager??!1},Z(H.in).pods.push(H.pod)}function X(K,H,P){return{runtime:K,pod:H,implementation:W.pods[H].implementation,create(G,D){J(G,D);let S=Z(K);if(S.subscriptions.push({kind:"call",from:D.pod,to:H}),S.policy?.kind==="rules")S.policy.rules.unshift({allow:["call","subscribe"],from:D.pod,outside:!S.pods.includes(D.pod),toInterface:P.coord});let V=G.provides[0];return V?X(D.in,D.pod,V):Y("invalid-input",`${G.coord} provides no interface`)}}}function N(K,H){let P=(W.runtimes[K]?.pods??[]).filter((G)=>Q.implementation(W.pods[G]?.implementation??"")?.provides.some((D)=>D.coord===H.coord));if(P.length===0)return Y("not-found",`no pod provides ${H.coord} in ${K}`);if(P.length>1)return Y("not-unique",`${P.length} pods provide ${H.coord} in ${K}`);return X(K,P[0],H)}let R=(K,H)=>H.kind==="pipe"&&H.from===K.from&&H.source===K.source&&H.to===K.to&&H.target===K.target;function q(K,H){let P=W.runtimes[K];if(!P)return Y("not-found",`no runtime ${K}`);for(let G of[H.from,H.to])if(!P.pods.includes(G))Y("not-found",`${G} is not placed in ${K}`);if(P.subscriptions.some((G)=>R(H,G)))Y("invalid-input",`${H.from} ${H.source} is already piped to ${H.to} ${H.target} in ${K}`);P.subscriptions.push({kind:"pipe",...H})}function z(K,H){let P=W.runtimes[K],G=P?P.subscriptions.findIndex((D)=>R(H,D)):-1;if(!P||G<0)return Y("not-found",`no such pipe in ${K}`);P.subscriptions.splice(G,1)}return{place:J,resolve:N,pipe:q,unpipe:z,deployment:()=>structuredClone(W)}}var e={additionalProperties:!1},$0=M.Record(v,M.Unknown(),{...e,maxProperties:50}),HW=M.Object({pods:M.Unknown(),runtimes:$0,tags:M.Optional(M.Record(v,M.Array(M.String()),e)),modules:M.Optional(M.Record(v,M.String({minLength:1}),e)),views:M.Optional(M.Record(v,M.String({minLength:1}),e)),frames:M.Optional(M.Record(v,M.String({minLength:1}),e)),layout:M.Optional(M.Record(M.String(),M.Unknown()))},e);function PW($,Q){try{let W=structuredClone($),Z=d(HW,W,"deployment");if(Z)return O("invalid-input",Z);let{pods:Y,runtimes:J,tags:X}=W,N=s$.create(Y,{registry:Q,tags:X});if(!N.ok)return N;let R=Object.create(null);for(let[q,z]of Object.entries(J)){let K=Array.isArray(z?.subscriptions)?z.subscriptions.flatMap((G)=>G?.kind==="call"&&N.value.names().includes(G.from)?[G.from]:[]):[],H=N.value.select(Array.isArray(z?.pods)?[...new Set([...z.pods.filter((G)=>typeof G==="string"),...K])]:[]);if(!H.ok)return O("invalid-input",`runtime ${q}: ${H.fail.reason}`);let P=e$.create(q,z,H.value);if(!P.ok)return P;R[q]=P.value}return E(R)}catch(W){return O("invalid-input",`unreadable deployment: ${W instanceof Error?W.message:String(W)}`)}}var w={assemble:PW,edit:MQ};function GQ($,Q){let W=(Y,J)=>Object.keys(Y).filter((X)=>!(X in J)),Z=[...new Set([...Object.keys($.runtimes),...Object.keys(Q.runtimes)])];return{added:W(Q.pods,$.pods),removed:W($.pods,Q.pods),changed:Object.keys(Q.pods).filter((Y)=>(Y in $.pods)&&!t.Equal($.pods[Y],Q.pods[Y])),rewired:Z.filter((Y)=>!t.Equal($.runtimes[Y]?.pods,Q.runtimes[Y]?.pods)||!t.Equal($.runtimes[Y]?.subscriptions,Q.runtimes[Y]?.subscriptions))}}var MW=($)=>$ instanceof Error?$.message:String($);async function OQ($){let Q;try{let z=await fetch($);if(!z.ok)return O("not-found",`${$}: ${z.status} ${z.statusText}`);Q=await z.json()}catch(z){return O("invalid-input",`${$}: ${MW(z)}`)}let W=Q;if(!W||typeof W.pods!=="object"||!W.pods||typeof W.runtimes!=="object"||!W.runtimes)return O("invalid-input",`${$}: a deployment has pods and runtimes`);let{pods:Z,runtimes:Y,tags:J,...X}=W,N=w.assemble({...X,pods:{},runtimes:{}},c.create());if(!N.ok)return O("invalid-input",`${$}: ${N.fail.reason}`);let R=await c.load(Q.modules??{},$);if(!R.ok)return R;let{registry:q}=R.value;return E({deployment:Q,registry:q})}function Q0($,Q={}){try{let W=d($0,$,"runtimes");if(W)return O("invalid-input",W);let Z=Object.create(null),Y=new Map,J=Object.create(null),X;for(let[q,z]of Object.entries($)){if(!PQ(z))return O("invalid-input",`runtime ${q}: not made by Runtime.create`);if(z.id!==q)return O("invalid-input",`runtime ${q}: its id is ${z.id}`);let K=R$(z.pods);if((X??=K.root)!==K.root)return O("invalid-input",`runtime ${q}: its pods come from another Pods`);if(Z[q]=z.deployment(),Z[q].policy&&Object.hasOwn(Q,q))return O("invalid-input",`runtime ${q}: has a policy in code and in its deployment`);for(let H of Z[q].pods)if(K.tags&&Object.hasOwn(K.tags,H))J[H]=structuredClone(K.tags[H]);for(let H of Z[q].pods)Y.set(H,K.pods.get(H))}for(let[q,z]of Object.entries(Z))for(let K of z.subscriptions)if(!Y.has(K.from))return O("invalid-input",`runtime ${q}: ${K.from}->${K.to}: ${K.from} is placed in no runtime`);let N=Object.create(null);for(let q of X?.names()??[])if(Y.has(q))N[q]=structuredClone(Y.get(q));let R=X&&R$(X);return E({deployment:{pods:N,runtimes:Z,...R?.tags&&{tags:J}},registry:R?.registry})}catch(W){return O("invalid-input",`unreadable runtimes: ${W instanceof Error?W.message:String(W)}`)}}var DQ=new WeakMap,W0=($,Q,W)=>{let Z=$.get(Q);if(Z)Z.push(W);else $.set(Q,[W])};function j($){let Q=DQ.get($);if(Q)return Q;let W=new Map,Z=new Map,Y=new Map,J=new Set,X=new Map,N=new Map;for(let[q,z]of Object.entries($.runtimes)){W.set(q,new Set(z.pods));for(let K of z.pods)W0(Z,K,q);for(let K of z.subscriptions)if(K.kind==="call")J.add(`${q} ${K.from} ${K.to}`),W0(Y,K.from,{runtime:q,to:K.to});else W0(X,`${K.from} ${K.source}`,{runtime:q,to:K.to,target:K.target});N.set(q,z.policy?.kind==="rules"?JQ(z.policy.rules):t$.allowAll())}let R={placed:W,placedIn:Z,callsFrom:Y,calls:J,pipes:X,policy:(q)=>N.get(q)??t$.allowAll()};return DQ.set($,R),R}var Y0=($)=>$ instanceof Error?$.message:String($),VQ=Symbol("timeout");async function F$($,Q,W){let Z,Y=new Promise((J,X)=>{Z=setTimeout(()=>X(VQ),Q)});try{return E(await Promise.race([Promise.resolve().then($),Y]))}catch(J){return J===VQ?O("timeout",`${W} took over ${Q}ms`):O("threw",`${W}: ${Y0(J)}`)}finally{clearTimeout(Z)}}async function r($,Q,W,Z){let Y=await F$(Z,$.timeoutMs,W);if(!Y.ok)$.trace.emit({type:"failure",pod:Q,reason:Y.fail.reason});return Y}var b=($,Q)=>$.registry.implementation($.now().pods[Q]?.implementation??""),AQ=($,Q)=>{let W=$.now();return(j(W).placedIn.get(Q)??[]).map((Z)=>[Z,W.runtimes[Z]])},SQ=($,Q)=>{let W=$&&s($,Q);return W?.kind==="action"?W:void 0};function L($,Q,W=$.now()){let Z=j(W),Y=Object.hasOwn($.policies,Q.runtime)?$.policies[Q.runtime]:Z.policy(Q.runtime);try{let J=Q.from==="host"||!Z.placed.get(Q.runtime)?.has(Q.from),X=Y.isAllowed({...Q,outside:J});if(typeof X?.then==="function")return Promise.resolve(X).catch(()=>{}),"policy gave no verdict";if(X?.approved===!0)return;return X?.approved===!1&&typeof X.reason==="string"?X.reason:"policy gave no verdict"}catch(J){return`policy threw: ${Y0(J)}`}}async function GW($,Q,W,Z,Y){let J=SQ(b($,Q),W);if(!J)return O("unknown-op",`${Q} has no action ${W}`);if(J.input&&!J.input.check(Z))return O("invalid-input",`${W}: input does not fit ${J.input.label??"its schema"}`);let X=await $.instance(Q);if(!X.ok)return X;let N=SQ(X.value.implementation,W),R=X.value.handlers.get(W);if(!N||!R)return O("unknown-op",`${Q} has no action ${W}`);if(N.input&&!N.input.check(Z))return O("invalid-input",`${W}: input does not fit ${N.input.label??"its schema"}`);let q=await r($,Q,`${Q} ${W}`,()=>R(Z,C$($,Q,X.value.onClose,{...Y,port:W})));if(!q.ok)return q;let z=q.value;if(!p0(z))return O("invalid-output",`${W}: returned something other than a NanoResult`);if(z.ok&&N.output&&!N.output.check(z.value))return O("invalid-output",`${W}: output does not fit ${N.output.label??"its schema"}`);return z}async function Z0($,Q,W,Z,Y,J,X={kind:"call"}){let{trace:N}=$,{kind:R,id:q=N.id(),cause:z,work:K}=X,H=X.correlation??q;N.emit({type:"sent",id:q,runtime:Q,kind:R,from:W,to:Z,port:Y,correlation:H,...z!==void 0&&{cause:z},...J!==void 0&&{input:J}});let P=L($,{runtime:Q,kind:R,from:W,to:Z,port:Y,data:J});if(P!==void 0)return N.emit({type:"denied",id:q,reason:P}),O("denied",P);let G=performance.now(),D=await(K?K():GW($,Z,Y,J,{id:q,correlation:H})).catch((S)=>O("invalid-input",`${Y}: unreadable input: ${Y0(S)}`));return N.emit({type:"delivered",id:q,result:D,ms:performance.now()-G}),D}var EQ=($,Q)=>{let W=()=>{$.flying.delete(Q)};return $.flying.add(Q),Q.then(W,W),Q};async function UQ($,Q,W,Z,Y,J,X,N={}){let R=N.id??$.trace.id(),q=N.correlation??R,z=await Z0($,Q,W,Z,Y,J,{...N,kind:X,id:R,correlation:q});if(z.ok)J0($,Z,Y,{input:J,output:z.value},{correlation:q,cause:R},Q);return z}function J0($,Q,W,Z,Y,J){if($.closed())return Promise.resolve();let X,N=()=>Y??(X?{correlation:X}:{id:X=$.trace.id(),correlation:X}),R=(j($.now()).pipes.get(`${Q} ${W}`)??[]).map((q)=>EQ($,UQ($,q.runtime,Q,q.to,q.target,Z.output,"pipe",N())));for(let q of[...$.listeners.heard.get(`${Q} ${W}`)??[]]){if(q.from!==Q||q.port!==W||J!==void 0&&q.runtime!==J)continue;let z=async()=>{let K=await r($,q.to,`${q.to} hearing ${W}`,()=>q.fn(Z));return K.ok?E(void 0):K};EQ($,Z0($,q.runtime,Q,q.to,W,Z.output,{kind:"on",...N(),work:z}))}return Promise.all(R)}function T$($,Q,W,Z,Y,J){let X=async(N,R)=>{let q=Y();if(q)return q;let K=(b($,Z)?.provides??[]).filter((H)=>Object.values(H.ops).some((P)=>P.kind==="action"&&P.name===N)).map((H)=>I(H,H.ops[N]));if(K.length===0)return O("unknown-op",`${Z} has no action ${N}`);if(K.length>1)return O("not-unique",`${Z}: ${N} is an action of more than one interface`);return UQ($,Q,W,Z,K[0],R,"call",J)};return new Proxy({},{get:(N,R)=>typeof R==="string"&&R!=="then"?(q)=>X(R,q):void 0})}function I$($,Q,W=()=>{}){let{trace:Z}=$,Y=Z.id(),J=(K,H)=>Z.emit({type:"sent",id:H,runtime:Q.runtime,kind:K,from:Q.to,to:Q.from,port:Q.port,correlation:Y,...H!==Y&&{cause:Y}});J("subscribe",Y);let X=L($,{runtime:Q.runtime,kind:"subscribe",from:Q.to,to:Q.from,port:Q.port});if(X!==void 0)return Z.emit({type:"denied",id:Y,reason:X}),O("denied",X);Z.emit({type:"delivered",id:Y,result:E(void 0),ms:0});let N=!0,R=`${Q.from} ${Q.port}`,q={...Q,end(K){if(!N)return;N=!1,$.listeners.ons.delete(q);let H=$.listeners.heard.get(R);if(H?.delete(q)&&H.size===0)$.listeners.heard.delete(R);let P=Z.id();J("unsubscribe",P),Z.emit({type:"delivered",id:P,result:K?{ok:!1,fail:K}:E(void 0),ms:0}),W(K)}};$.listeners.ons.add(q);let z=$.listeners.heard.get(R);if(z)z.add(q);else $.listeners.heard.set(R,new Set([q]));return E(q)}function j$($,Q){let W=[],Z=!1,Y,J,X=!1,N=(q)=>{if(!Z)Y=q;Z=!0,J?.()};Q(N);let R=$((q)=>{W.push(q),J?.()});return{[Symbol.asyncIterator](){if(X)throw Error("iterable: iterate once; subscribe again for another");return X=!0,{async next(){while(!W.length&&!Z)await new Promise((q)=>{J=q});if(W.length)return{done:!1,value:W.shift()};if(Y)throw _(Y);return{done:!0,value:void 0}},async return(){return R(),N(),{done:!0,value:void 0}}}}}}var FQ=($,Q,W)=>{let Z=b($,Q)?.provides.find((Y)=>Y.byCoord.has(W?.coord));return Z&&I(Z,W)},CQ=($)=>typeof $==="object"&&$?X$($):void 0,OW=($,Q)=>{try{return!$.output||$.output.check(Q)}catch{return!1}},TQ=new WeakMap;function DW($,Q){let W=TQ.get(Q);if(W)return W;let Z={mine:new Set,heard:new Set};return TQ.set(Q,Z),Q(()=>{for(let Y of[...Z.mine])Y.end();Z.mine=void 0;for(let Y of Z.heard)$.listeners.podChanges.delete(Y)}),Z}function C$($,Q,W,Z){let Y=DW($,W),J=Z&&{correlation:Z.correlation,cause:Z.id},X=(q,z)=>{let K=()=>j($.now()).calls.has(`${q} ${Q} ${z}`)?void 0:O("not-found",`${Q}->${z} is no longer in ${q}`);return{pod:z,runtime:q,call:T$($,q,Q,z,K,J),on(H,P){let G,D=(S)=>{let V=FQ($,z,H);if(!V)throw _({type:"unknown-op",reason:`${Q}: ${H?.name} is not an op of ${z}`});let A=!Y.mine?O("not-found",`${Q}: this build is closed`):K();if(A&&!A.ok)throw _(A.fail);let U=I$($,{runtime:q,from:z,port:V,to:Q,gone:K,fn:S},(T)=>G?.(T));if(!U.ok)throw _(U.fail);let F=U.value;return Y.mine.add(F),()=>{Y.mine?.delete(F),F.end()}};return P?D(P):j$(D,(S)=>{G=S})}}},N=(q)=>{let z=CQ(q),K=$.now();if(!z)return[];return(j(K).callsFrom.get(Q)??[]).flatMap(({runtime:H,to:P})=>{let G={to:P},D=b($,G.to),S={name:G.to,runtime:H,implementation:D.coord,provider:D.provider,provides:new Set(D.provides.map((V)=>V.coord)),tags:new Set(K.tags?.[G.to]??[])};return l0(z,S)?[X(H,G.to)]:[]})};return{self:Q,...Z&&{callingOp:Z.port},get runtimes(){return AQ($,Q).map(([q])=>q)},one(q){let z=N(q),K=JSON.stringify(CQ(q));if(z.length===0)return O("not-found",`${Q}: nothing wired matches ${K}`);if(z.length>1)return O("not-unique",`${Q}: ${z.length} wired match ${K}`);return E(z[0])},all:N,async publish(q,z){let K=FQ($,Q,q);if(!K||q.kind!=="event")return $.trace.emit({type:"warning",reason:`${Q}: ${q?.name} is not one of its events`});if(!OW(q,z))return $.trace.emit({type:"failure",pod:Q,reason:`${Q}: ${q.name} data does not fit ${q.output?.label??"its schema"}`});await J0($,Q,K,{output:z},J)},addOnPodChangeListener(q){if(!Y.mine)return;let z={pod:Q,fn:q};Y.heard.add(z),$.listeners.podChanges.add(z)},addOnCloseListener:W}}function IQ($,Q,W,Z,Y){for(let{op:J,run:X}of Z.values()){let N=X()[Symbol.asyncIterator]();Y(()=>{N.return?.()}),(async()=>{try{for(let R=await N.next();!R.done;R=await N.next())await W.publish(J,R.value)}catch(R){$.trace.emit({type:"failure",pod:Q,reason:`${J.name} threw ${R instanceof Error?R.message:String(R)}`})}})()}}function VW($,Q){let W=[],Z,Y,J=(X)=>r($,Q,`closing ${Q}`,()=>X({reason:Z}));return{add(X){if(Z)J(X);else W.push(X)},began:()=>Z!==void 0,close:(X)=>Y??=(async()=>{Z=X;for(let N of W)await J(N);$.trace.emit({type:"closed",pod:Q,reason:X})})()}}async function SW($,Q,W){if((W.isolation??"host")==="host"){let J=$.registry.implementation(W.implementation);return J&&E(J)}let{isolate:Z}=$;if(!Z)return O("invalid-input",`no host for isolation ${W.isolation}`);let Y=await F$(()=>Z(Q,structuredClone(W)),$.timeoutMs,`isolating ${Q}`);if(!Y.ok||Y.value.coord===W.implementation)return Y;return O("invalid-input",`isolate gave ${Y.value.coord} for ${W.implementation}`)}function jQ($){let Q=new Map,W=new Map,Z=new Map,Y=!1;async function J(N,R){if(await W.get(N),R.began())return O("not-found",`${N} was closed before it was built`);let q=$.now().pods[N],z=q&&await SW($,N,q);if(!q||!z)return O("not-found",`no pod ${N}`);if(!z.ok)return $.trace.emit({type:"failure",pod:N,reason:z.fail.reason}),await R.close("closed"),z;let K=z.value,H=C$($,N,R.add),P=await F$(()=>K.make(H,q.config),$.timeoutMs,`building ${N}`);if(Y)return O("not-found","application is closed");if($.trace.emit(P.ok?{type:"built",pod:N}:{type:"failure",pod:N,reason:P.fail.reason}),!P.ok)await R.close("closed");if(!P.ok)return P;return IQ($,N,H,P.value.sources,R.add),E({implementation:K,handlers:P.value.handlers,onClose:R.add})}async function X(N,R){let q=Q.get(N);if(Z.delete(N),!q)return;Q.delete(N);let z=Promise.all([W.get(N),q.close(R)]).then(()=>{});if(W.set(N,z),await z,W.get(N)===z)W.delete(N)}return{get(N){if(Y)return Promise.resolve(O("not-found","application is closed"));let R=Q.get(N);if(!R){let q=VW($,N),z={build:J(N,q),close:q.close};Q.set(N,R=z),z.build.then((K)=>{if(Q.get(N)!==z)return;if(Z.set(N,K.ok?"running":"failed"),!K.ok)Q.delete(N)})}return R.build},forget:X,status:(N)=>Y?"stopped":Z.get(N)??"not started",async close(){Y=!0;let N=[...Q.values()].map((R)=>R.build);await Promise.all([...[...Q.keys()].map((R)=>X(R,"closed")),...N])}}}async function xQ($,Q){let W=$.now(),Z=new Set;for(let Y of new Set([...Object.keys(Q.runtimes),...Object.keys(W.runtimes)])){let J=Q.runtimes[Y]?.pods??[],X=W.runtimes[Y]?.pods??[],N=[...X.filter((R)=>!J.includes(R)).map((R)=>({type:"added",p:R,d:W})),...J.filter((R)=>!X.includes(R)).map((R)=>({type:"removed",p:R,d:Q}))];for(let R of[...$.listeners.podChanges]){if(!X.includes(R.pod))continue;for(let q of N){if(q.p===R.pod)continue;let z=L($,{runtime:Y,kind:"lifecycle",from:R.pod,to:q.p});if(z!==void 0){if(!Z.has(R))Z.add(R),$.trace.emit({type:"denied",id:$.trace.id(),reason:z});continue}let K=$.registry.implementation(q.d.pods[q.p]?.implementation??"")?.coord??"",H=r($,R.pod,`${R.pod} hearing ${q.type} ${q.p}`,()=>R.fn({type:q.type,runtime:Y,pod:q.p,implementation:K})),P=()=>{$.flying.delete(H)};$.flying.add(H),H.then(P,P)}}}}function _Q($,Q,W){let Z=new Set,Y=new Set,J=()=>{for(let X of $.now().runtimes[Q]?.pods??[])Y.add(X)};return J(),$.trace.listen((X)=>{if(J(),X.type==="sent"){if(X.runtime===Q)Z.add(X.id),W(X)}else if(X.type==="delivered"||X.type==="denied"){if(Z.delete(X.id))W(X)}else if(X.type==="applied"){let N=(z)=>z.filter((K)=>Y.has(K)),R={added:N(X.added),removed:N(X.removed),changed:N(X.changed),rewired:N(X.rewired)};if(Object.values(R).some((z)=>z.length))W({type:"applied",caller:X.caller,...R});let q=$.now().runtimes[Q]?.pods??[];for(let z of Y)if(!q.includes(z))Y.delete(z)}else if(X.type!=="warning"&&X.pod!==void 0&&Y.has(X.pod))W(X)})}var LQ=new WeakMap;function kQ($,Q,W,Z){let Y=LQ.get($)??new Map;LQ.set($,Y);async function J(N,R){let q=$.trace.id();$.trace.emit({type:"sent",id:q,runtime:N,kind:"start",from:"host",to:R,correlation:q});let z=L($,{runtime:N,kind:"start",from:"host",to:R});if(z!==void 0)return $.trace.emit({type:"denied",id:q,reason:z}),O("denied",z);let K=performance.now(),H=await $.instance(R),P=H.ok?E(void 0):H;return $.trace.emit({type:"delivered",id:q,result:P,ms:performance.now()-K}),P}async function X(N){let R=Q();if(!R.ok)return R;if($.closed())return O("not-found","application is closed");if(!j($.now()).placed.get(R.value)?.has(N))return O("not-found",`${N} is not placed in ${R.value}`);let q=`${R.value}|${N}`,z=Y.get(q);if(z){let H=await z;return H.ok?E({started:!1}):H}if(W(N)==="running")return E({started:!1});let K=J(R.value,N);Y.set(q,K);try{let H=await K;return H.ok?E({started:!0}):H}finally{if(Y.get(q)===K)Y.delete(q)}}return{async start(N){let R=await X(N);return!R.ok?R:R.value.started?E(void 0):O("invalid-input",`${N} is already running`)},async getOrCreate(N){let R=await X(N);return R.ok?E({started:R.value.started,pod:Z(N)}):R}}}var $$=($,Q)=>({ok:!1,fail:{type:$,reason:Q}});function wQ($,Q,W,Z){let Y=[],J=Z.pod!==void 0&&j($.now()).placed.get(Q)?.has(Z.pod)?[Z.pod]:void 0;for(let N of J??(Z.pod!==void 0?[]:$.now().runtimes[Q]?.pods??[])){let R=b($,N);if((Z.pod??N)===N&&R?.provides.some((q)=>q.coord===W.coord))Y.push({pod:N,runtime:Q,implementation:R.coord})}let X=`${W.coord} in ${Q}${Z.pod?` at ${Z.pod}`:""}`;if(!Y.length)return $$("not-found",`no pod provides ${X}`);return Y.length===1?{ok:!0,value:Y[0]}:$$("not-unique",`${Y.length} pods provide ${X}`)}var z$=($)=>()=>{throw _($)};function N0($,Q,W){let Z=()=>W===void 0?EW($):AW($,W),Y=(K)=>{let H=Z(),P=H.ok?H.value:"";return T$($,P,"host",K,()=>{let G=Z();return!G.ok?G:G.value!==P?O("not-found",`runtime ${G.value} is not the one this client was made for`):$.closed()?O("not-found","application is closed"):j($.now()).placed.get(P)?.has(K)?void 0:O("not-found",`${K} is not placed in ${P}`)})},J=(K,H)=>{let P=Z();if(!P.ok)return P;let G=wQ($,P.value,K,H);if(!G.ok)return G;return Object.values(K.ops).some((S)=>L($,{runtime:P.value,kind:S.kind==="event"?"subscribe":"call",from:"host",to:G.value.pod,port:I(K,S)})===void 0)?G:$$("denied",`${P.value}'s policy lets the host reach no op of ${K.coord}`)},X=(K,H={})=>{let P=J(K,H);if(!P.ok)return{ok:!1,reason:P.fail.type,fail:P.fail,getOrThrow:z$(P.fail)};let G=V$(K,()=>{let D=J(K,H);return D.ok?E({call:Y(D.value.pod),on:(S)=>N(S,void 0,{pod:D.value.pod})}):D});return{ok:!0,...P.value,value:G,getOrThrow:()=>G}},N=(K,H,P)=>{let G,D=(S)=>{let V=Z();if(!V.ok)return z$(V.fail)();let A=V.value,U=($.now().runtimes[A]?.pods??[]).flatMap((h)=>b($,h)?.provides??[]).find((h)=>h.byCoord.has(K.coord));if(!U)return z$($$("not-found",`no pod provides ${K.coord} in ${A}`).fail)();let F=wQ($,A,U,P);if(!F.ok)return z$(F.fail)();let T=F.value.pod,f=()=>!j($.now()).placed.get(A)?.has(T),C=I$($,{runtime:A,from:T,port:I(U,K),to:"host",gone:f,fn:S},(h)=>G?.(h));if(!C.ok)throw _(C.fail);return()=>C.value.end()};return H?D(H):j$(D,(S)=>{G=S})};return{resolve:X,get:(K,H)=>X(K,H).getOrThrow(),call:Y,subscribe:(K,H)=>N(K,H,{}),listen:(K)=>{let H=Z();return H.ok?_Q($,H.value,K):z$(H.fail)()},status:(K)=>{let H=Z();return!H.ok?H:j($.now()).placed.get(H.value)?.has(K)?E(Q(K)):O("not-found",`${K} is not placed in ${H.value}`)},...kQ($,Z,Q,Y)}}var AW=($,Q)=>Object.hasOwn($.now().runtimes,Q)?{ok:!0,value:Q}:$$("not-found",`no runtime ${Q}`),EW=($)=>{let Q=Object.keys($.now().runtimes);return Q.length===1?{ok:!0,value:Q[0]}:$$(Q.length?"not-unique":"not-found",`${Q.length} runtimes: name a runtime`)};function gQ(){let $=new Set,Q=0;return{emit(W){for(let Z of[...$])try{Z(W)}catch{}},listen(W){return $.add(W),()=>{$.delete(W)}},id:()=>`m${++Q}`}}async function yQ($,Q={}){let W=Q0($,Q.policies);if(!W.ok)return W;let Z=W.value.registry??c.create(),Y=W.value.deployment,J=Promise.resolve(),X,N=gQ(),R={now:()=>Y,registry:Z,policies:Q.policies??{},timeoutMs:Q.timeoutMs??30000,trace:N,instance:(V)=>q.get(V),listeners:{ons:new Set,heard:new Map,podChanges:new Set},flying:new Set,closed:()=>X!==void 0,isolate:Q.isolate},q=jQ(R),z=(V)=>Promise.all(V.filter((A)=>Y.pods[A].eager).map((A)=>q.get(A)));await z(Object.keys(Y.pods));function K(V){let A=w.assemble(V,Z);if(!A.ok)return A;let U=Q0(A.value,R.policies);return U.ok?E(U.value.deployment):U}let H=()=>O("invalid-input","application is closed");function P(V){let A=J.then(V);return J=A.catch(()=>{return}),A}async function G(V,A){let U=K(V);if(!U.ok)return U;let F=await Promise.resolve().then(()=>(Q.deploymentPolicy??NQ.allowAll()).isAllowed({caller:A,deployment:V})).catch((C)=>({approved:!1,reason:`policy threw: ${C instanceof Error?C.message:String(C)}`}));if(F?.approved!==!0)return O("denied",F?.approved===!1&&typeof F.reason==="string"?F.reason:"policy gave no verdict");let T=GQ(Y,U.value),f=Y;Y=U.value;for(let C of[...R.listeners.ons]){if(C.gone()){C.end();continue}let h=L(R,{runtime:C.runtime,kind:"subscribe",from:C.to,to:C.from,port:C.port});if(h!==void 0)C.end({type:"denied",reason:h})}return await Promise.all([...T.removed.map((C)=>q.forget(C,"removed")),...T.changed.map((C)=>q.forget(C,"changed"))]),await z([...T.added,...T.changed]),await xQ(R,f),N.emit({type:"applied",caller:A,...T}),E(void 0)}let D=N0(R,q.status),S={runtime:(V)=>N0(R,q.status,V),resolve:(V,A)=>D.resolve(V,A),get:(V,A)=>D.get(V,A),subscribe:D.subscribe,call:(...V)=>V.length===1?D.call(V[0]):S.runtime(V[0]).call(V[1]),apply:(V,A)=>X?Promise.resolve(H()):P(()=>G(V,A?.caller??"host")),restart:(V)=>X?Promise.resolve(H()):P(async()=>{if(!Y.pods[V])return O("not-found",`no pod ${V}`);if(await q.forget(V,"restarted"),N.emit({type:"restarted",pod:V}),Y.pods[V].eager)await q.get(V);return E(void 0)}),deployment:()=>structuredClone(Y),listen:N.listen,close:()=>X??=P(async()=>{await Promise.all([q.close(),...R.flying]);for(let V of[...R.listeners.ons])V.end();return R.listeners.podChanges.clear(),E(void 0)})};return E(S)}async function UW($,Q={}){let W=await OQ($),Z=W.ok?w.assemble(W.value.deployment,W.value.registry):W,Y=Z.ok?await yQ(Z.value,Q):Z;if(!Y.ok)throw Object.assign(Error(`${Y.fail.type}: ${Y.fail.reason}`),{fail:Y.fail});return Y.value}var x$={create:yQ,load:UW};var W$=($)=>{let Q=$.slice($.lastIndexOf(".")+1);return Q[0].toLowerCase()+Q.slice(1)},K$=($)=>$.slice(0,$.lastIndexOf(".")),Q$=($)=>{if(!$.ok)throw Error(`${$.fail.type}: ${$.fail.reason}`);return $.value};function X0($){let Q=new Map,W=new Map,Z=(J,X)=>{let N=W.get(J);if(N&&N!==X)throw Error(`two chains named ${J}`);if(Q.has(X))return!1;return Q.set(X,J),W.set(J,X),!0},Y=(J)=>{for(let[X,N]of J.uses)if(Z(X,N))Y(N)};for(let[J,X]of Object.entries($))Z(J,X);for(let J of Object.values($))Y(J);return Q}var q0=($)=>({pods:Object.fromEntries([...$].map(([Q,W])=>[W,qQ.lazy(Q.implementation,Q.cfg&&{config:Q.cfg.value})])),runtimes:{main:{pods:[...$.values()],subscriptions:[...$].flatMap(([Q,W])=>Q.uses.map(([,Z])=>({kind:"call",from:W,to:$.get(Z)})))}}});function R0($){let Q=c.create();for(let[W,Z]of Map.groupBy($,(Y)=>K$(Y.coord)))Q$(Q.add(E$.define(W,Z.map((Y)=>Y.implementation))));return Q}async function BQ($){let Q=X0({[W$($.coord)]:$}),W=Q$(await x$.create(Q$(w.assemble(q0(Q),R0([...Q.keys()])))));return Object.assign(Object.create(W.runtime("main").get($.interface)),{app:W})}var K0=($)=>({kind:typeof $.at(-1)==="function"?"pending":"flow",steps:$,andThen:(Q)=>K0([...$,Q])}),_$=($)=>$[0].toUpperCase()+$.slice(1),z0=($)=>$.chain.coord;function FW($,Q,W){let Z=X0(Object.fromEntries(Q)),Y=[],J=(R)=>Z.get(R.chain)??(()=>{throw Error(`${z0(R)} is not in the app`)})(),X=(R,q)=>Y.push({kind:"pipe",from:J(R),source:I(R.chain.interface,R.op),to:J(q),target:I(q.chain.interface,q.op)});for(let{steps:R}of W){let q=R[0],z=[];for(let K of R.slice(1)){if(typeof K==="function"){z.push(K);continue}if(z.length){let H=`${W$(z0(q))}${_$(q.op.name)}To${_$(W$(z0(K)))}${_$(K.op.name)}`,P=z,G=H0.create(`${$}.${_$(H)}`).action("map",q.op.output,K.op.input,async(D)=>{for(let S of P)D=await S(D);return D});if([...Z.values()].includes(H))throw Error(`two mappers named ${H}`);Z.set(G,H),X(q,G.actions.map),q=G.actions.map,z=[]}X(q,K),q=K}}let N=q0(Z);return N.runtimes.main.subscriptions=[...N.runtimes.main.subscriptions,...Y],{names:Z,deployment:N}}function L$($,Q=[],W=[]){let Z,Y=()=>Z??=FW($,Q,W);return{use:(J)=>L$($,[...Q,...Object.entries(J)],W),subscribe:(...J)=>L$($,Q,[...W,...J]),get deployment(){return Y().deployment},get provider(){let J=[...Y().names.keys()],X=J.filter((N)=>K$(N.coord)!==$).map((N)=>N.coord);if(X.length)throw Error(`not in ${$}: ${X.join(", ")}`);return E$.define($,J.map((N)=>N.implementation))},async deploy(){let{names:J,deployment:X}=Y(),N=Q$(await x$.create(Q$(w.assemble(X,R0([...J.keys()]))))),R=Q.map(([q,z])=>[q,N.runtime("main").get(z.interface,{pod:J.get(z)})]);return{...Object.fromEntries(R),app:N}}}}var CW=async function*(){};function Y$($){let{coord:Q,ops:W,uses:Z,init:Y,cfg:J}=$,X,N,R=()=>X??=A$.define(Q,Object.fromEntries(Object.entries(W).map(([P,G])=>[P,G.op]))),q=()=>R().impl(`${K$(Q)}/${W$(Q)}`).needs(Object.fromEntries(Z.map(([P,G])=>[P,G.interface]))),z=()=>N??=(J?q().config(J.schema):q()).make((P)=>{let{config:G}=P,D=Y?.(),S=(V)=>Object.assign(Object.create(V),{state:D,config:G,publish:(A,U)=>V.publish(typeof A==="string"?R().ops[A]:A,U)});return Object.fromEntries(Object.entries(W).map(([V,{op:A,fn:U}])=>[V,A.kind==="event"?()=>U(void 0,S(P)):(F,T)=>U(F,S(T??P))]))}),K=(P)=>()=>Object.fromEntries(Object.values(R().ops).filter((G)=>G.kind===P).map((G)=>{let D={chain:H,op:G,andThen:(S)=>K0([D,S])};return[G.name,D]})),H={coord:Q,uses:Z,cfg:J,get interface(){return R()},get implementation(){return z()},get actions(){return K("action")()},get events(){return K("event")()},state:(P)=>Y$({...$,init:P}),config:(P,G)=>Y$({...$,cfg:{schema:P,value:G}}),use:(P)=>Y$({...$,uses:[...Z,...Object.entries(P)]}),action:(P,G,D,S)=>Y$({...$,ops:{...W,[P]:{op:v$.action(G,D),fn:S}}}),emit:(P,G,D)=>Y$({...$,ops:{...W,[P]:{op:v$.event(G),fn:(S,V)=>(D??CW)(V)}}}),deploy:()=>BQ(H)};return H}var H0={create:($)=>Y$({coord:$,ops:{},uses:[]}),app:($)=>L$($)};export{E as success,X$ as selectorData,n0 as provide,I as port,l0 as matches,j as lookup,p0 as isNanoResult,vQ as isJson,d$ as hashOf,c0 as fits,O as failure,c$ as canonicalSchema,m$ as canonical,UY as Selector,O$ as Schema,e$ as Runtime,ZQ as Rule,c as Registry,E$ as Provider,JQ as PolicyRules,t$ as Policies,s$ as Pods,qQ as Pod,v$ as Op,H0 as Nano,A$ as Interface,o0 as Implementation,NQ as DeploymentPolicies,BY as Coord,t0 as COORD,x$ as Application,w as AppDeployment};
@@ -0,0 +1,280 @@
1
+ import{nf as O}from"./chunks/nano-core-wanb7xw1.js";import{of as M}from"./chunks/nano-core-qy0mwf7y.js";import{tf as e,uf as B}from"./chunks/nano-core-mxgap7rs.js";import"./chunks/nano-core-mqaje7vc.js";import{Gf as R,Kf as X}from"./chunks/nano-core-72b5e6vd.js";import"./chunks/nano-core-2gg2vg5g.js";import"./chunks/nano-core-jtgk4ch8.js";var S={bg:"#0D0F13",surface:"#14171D","surface-2":"#212632",border:"#2A303C","border-strong":"#3A4150",fg:"#E7E9EE","fg-2":"#C9CED6",muted:"#A3AAB8","on-accent":"#0D0F13",accent:"#6FA8FF","accent-soft":"#1C2A44",focus:"#6FA8FF",good:"#7EE787","good-bg":"#12301C",bad:"#FFB4A8","bad-bg":"#3A1D1D",warn:"#F2CC60","warn-bg":"#3A3016",font:"Inter, system-ui, sans-serif","font-display":"Inter, system-ui, sans-serif","font-mono":"'JetBrains Mono', ui-monospace, monospace",radius:"8px","radius-s":"6px",s1:"#7EE787",s2:"#F5A524",s3:"#4CC2FF",s4:"#FF7AB6",s5:"#D2A8FF",s6:"#FFA657",s7:"#79C0FF",s8:"#F2CC60"},z=($)=>e(`var(--nano-${$}, ${S[$]})`),L=($)=>`var(--nano-${$}, ${S[$]})`;var _=B`
2
+ :host { display: block; font-family: ${z("font")}; font-size: 13px; color: ${z("fg")} }
3
+ :focus-visible { outline: 2px solid ${z("focus")}; outline-offset: 1px }
4
+
5
+ /* buttons */
6
+ button, .btn { font: inherit; font-size: 12px; color: ${z("fg")}; background: transparent; border: 1px solid ${z("border-strong")};
7
+ border-radius: ${z("radius-s")}; padding: 5px 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px }
8
+ button:hover, .btn:hover { background: ${z("surface-2")} }
9
+ button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed }
10
+ button.primary, .btn.primary { color: ${z("on-accent")}; background: ${z("accent")}; border-color: ${z("accent")}; font-weight: 600 }
11
+ button.danger, .btn.danger { color: ${z("bad")}; border-color: ${z("bad")} }
12
+ button.dashed, .btn.dashed { border-style: dashed; font-weight: 600 }
13
+ .btn.small { font-size: 11px; padding: 2px 7px }
14
+ .icon-btn { border: 0; background: transparent; padding: 4px; border-radius: ${z("radius-s")}; color: ${z("muted")} }
15
+ .icon-btn:hover { color: ${z("fg")}; background: ${z("surface-2")} }
16
+ button[aria-pressed='true'], .btn[aria-pressed='true'] { background: ${z("surface-2")}; border-color: ${z("accent")} }
17
+
18
+ /* labels */
19
+ .badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: ${z("surface-2")}; color: ${z("fg-2")} }
20
+ .badge.good { background: ${z("good-bg")}; color: ${z("good")} } .badge.bad { background: ${z("bad-bg")}; color: ${z("bad")} }
21
+ .badge.warn { background: ${z("warn-bg")}; color: ${z("warn")} } .badge.accent { background: ${z("accent-soft")}; color: ${z("accent")} }
22
+ .chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid ${z("border")}; border-radius: ${z("radius-s")}; font-size: 12px }
23
+ .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: ${z("surface-2")}; font-size: 12px }
24
+ .pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor }
25
+
26
+ /* containers and states */
27
+ .card { background: ${z("surface")}; border: 1px solid ${z("border")}; border-radius: ${z("radius")}; padding: 12px }
28
+ .alert { padding: 8px 12px; border-radius: ${z("radius-s")}; border: 1px solid ${z("border")}; background: ${z("surface-2")} }
29
+ .alert.good { background: ${z("good-bg")}; color: ${z("good")}; border-color: transparent }
30
+ .alert.bad, .problem { color: ${z("bad")} } .alert.bad { background: ${z("bad-bg")}; border-color: transparent }
31
+ .problem { font-size: 12px }
32
+
33
+ /* forms */
34
+ input, select, textarea, .input { font: inherit; font-size: 12px; color: ${z("fg")}; background: ${z("bg")}; border: 1px solid ${z("border-strong")};
35
+ border-radius: ${z("radius-s")}; padding: 4px 6px }
36
+ input[type='range'], input[type='checkbox'] { accent-color: ${z("accent")}; padding: 0 }
37
+ .field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: ${z("muted")} }
38
+ /* where the browser allows it, a bare select's open list takes the theme too */
39
+ @supports (appearance: base-select) {
40
+ select, ::picker(select) { appearance: base-select }
41
+ ::picker(select) { background: ${z("surface")}; color: ${z("fg")}; border: 1px solid ${z("border")}; border-radius: ${z("radius-s")};
42
+ padding: 4px; margin-top: 4px; box-shadow: 0 4px 16px color-mix(in srgb, ${z("bg")} 40%, transparent) }
43
+ select::picker-icon { color: ${z("muted")} }
44
+ option { padding: 5px 8px; border-radius: ${z("radius-s")} }
45
+ option:is(:hover, :focus-visible) { background: ${z("surface-2")}; outline: 0 }
46
+ option:checked { font-weight: 600 }
47
+ }
48
+ .meter { height: 6px; border-radius: 3px; background: ${z("surface-2")}; overflow: hidden }
49
+ .meter > span { display: block; height: 100%; background: ${z("accent")} }
50
+
51
+ /* data */
52
+ .table { width: 100%; border-collapse: collapse } .table th, .table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid ${z("border")} }
53
+ .table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: ${z("muted")} }
54
+ .tabs { display: flex; gap: 2px; border-bottom: 1px solid ${z("border")} }
55
+ .tabs > button { border: 0; border-radius: 0; border-bottom: 2px solid transparent; background: none; color: ${z("muted")} }
56
+ .tabs > button:is([aria-selected='true'], [aria-pressed='true']) { color: ${z("fg")}; border-bottom-color: ${z("accent")} }
57
+ .list-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid ${z("border")} }
58
+
59
+ /* type */
60
+ .kicker { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: ${z("muted")} }
61
+ .display-s, .display-m, .display-l { font-family: ${z("font-display")}; font-weight: 600; letter-spacing: -.01em; margin: 0 }
62
+ .display-s { font-size: 18px } .display-m { font-size: 24px } .display-l { font-size: 34px }
63
+ .muted { color: ${z("muted")} }
64
+ .mono { font-family: ${z("font-mono")}; font-size: 11px }
65
+
66
+ /* layout */
67
+ .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap }
68
+ .col { display: flex; flex-direction: column; gap: 8px }
69
+ .grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px }
70
+ `;var N=B`0 8px 24px color-mix(in srgb, black 18%, transparent), 0 1px 3px color-mix(in srgb, black 10%, transparent)`,G=B`
71
+ /* people and messages */
72
+ .avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none;
73
+ background: ${z("surface-2")}; color: ${z("fg-2")}; font-size: 12px; font-weight: 600 }
74
+ .avatar > img { width: 100%; height: 100%; object-fit: cover }
75
+ .avatar.small { width: 24px; height: 24px; font-size: 10px } .avatar.large { width: 40px; height: 40px; font-size: 14px }
76
+ .avatar-stack { display: inline-flex } .avatar-stack > .avatar { box-shadow: 0 0 0 2px ${z("bg")} } .avatar-stack > .avatar + .avatar { margin-left: -8px }
77
+ .bubble { max-width: 75%; width: fit-content; padding: 8px 12px; border-radius: ${z("radius")}; background: ${z("surface-2")}; color: ${z("fg")}; line-height: 1.45 }
78
+ .bubble.mine { margin-left: auto; background: ${z("accent")}; color: ${z("on-accent")} }
79
+ .kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px;
80
+ border: 1px solid ${z("border")}; background: ${z("surface-2")}; color: ${z("muted")}; font: 500 11px ${z("font-mono")} }
81
+ .code { font: 12px/1.55 ${z("font-mono")}; background: ${z("surface-2")}; border: 1px solid ${z("border")}; border-radius: ${z("radius-s")};
82
+ padding: 10px 12px; margin: 0; overflow: auto; white-space: pre; color: ${z("fg")} }
83
+
84
+ /* inputs */
85
+ .input-group { display: flex; align-items: center; border: 1px solid ${z("border-strong")}; border-radius: ${z("radius-s")}; background: ${z("bg")} }
86
+ .input-group:focus-within { outline: 2px solid ${z("focus")}; outline-offset: 1px }
87
+ .input-group > input, .input-group > .input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0 }
88
+ .input-group > .addon { padding: 0 8px; color: ${z("muted")}; font-size: 12px; white-space: nowrap }
89
+ .input-group > button { border: 0; border-radius: 0; align-self: stretch }
90
+ .toggle { border-color: transparent } .toggle:hover { color: ${z("fg")} }
91
+ .toggle[aria-pressed='true'] { background: ${z("surface-2")}; border-color: transparent; color: ${z("fg")} }
92
+ .toggle-group { display: inline-flex; border: 1px solid ${z("border")}; border-radius: ${z("radius-s")}; overflow: hidden }
93
+ .toggle-group > button { border: 0; border-radius: 0 } .toggle-group > button + button { border-left: 1px solid ${z("border")} }
94
+ input[type='checkbox'].switch { appearance: none; width: 32px; height: 18px; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
95
+ background: radial-gradient(circle at 9px 50%, ${z("bg")} 6px, transparent 7px), ${z("border-strong")}; transition: background-position .15s }
96
+ input[type='checkbox'].switch:checked { background: radial-gradient(circle at calc(100% - 9px) 50%, ${z("on-accent")} 6px, transparent 7px), ${z("accent")} }
97
+
98
+ /* overlays: native <dialog> (showModal()) and [popover] surfaces */
99
+ dialog.dialog, dialog.drawer { box-sizing: border-box; color: ${z("fg")}; background: ${z("surface")}; border: 1px solid ${z("border")}; box-shadow: ${N}; padding: 20px }
100
+ dialog.dialog { border-radius: ${z("radius")}; width: min(480px, calc(100vw - 32px)) }
101
+ dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: none; width: min(380px, 90vw); border-width: 0 0 0 1px; animation: nano-in-right .2s ease-out }
102
+ dialog.drawer.bottom { margin: auto 0 0; width: 100%; max-width: none; height: auto; max-height: 80dvh; border-width: 1px 0 0;
103
+ border-radius: ${z("radius")} ${z("radius")} 0 0; animation-name: nano-in-up }
104
+ dialog::backdrop { background: color-mix(in srgb, black 50%, transparent) }
105
+ dialog > header { margin-bottom: 12px } dialog > header > h2 { margin: 0 0 4px; font: 600 16px ${z("font-display")} }
106
+ dialog > header > p { margin: 0; color: ${z("muted")} }
107
+ dialog > footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px }
108
+ @keyframes nano-in-right { from { transform: translateX(100%) } }
109
+ @keyframes nano-in-up { from { transform: translateY(100%) } }
110
+ .pop { position: fixed; inset: auto; margin: 0; min-width: 8rem; padding: 4px; color: ${z("fg")}; background: ${z("surface")};
111
+ border: 1px solid ${z("border")}; border-radius: ${z("radius-s")}; box-shadow: ${N}; font-family: ${z("font")}; font-size: 13px }
112
+ .menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: ${z("radius-s")};
113
+ background: none; color: inherit; font: inherit; text-align: left; cursor: default; justify-content: flex-start }
114
+ .menu-item:is(:hover, .active) { background: ${z("surface-2")} }
115
+ .menu-item.danger { color: ${z("bad")} } .menu-item[aria-disabled='true'] { opacity: .5 }
116
+ .menu-sep { height: 1px; margin: 4px -4px; background: ${z("border")} }
117
+ .menu-label { padding: 6px 8px 2px; font-size: 11px; font-weight: 600; color: ${z("muted")} }
118
+ .shortcut { margin-left: auto; font-size: 11px; letter-spacing: .08em; color: ${z("muted")} }
119
+
120
+ /* toast */
121
+ .toast { display: flex; gap: 10px; align-items: flex-start; width: min(356px, calc(100vw - 32px)); padding: 12px 14px; color: ${z("fg")};
122
+ background: ${z("surface")}; border: 1px solid ${z("border")}; border-radius: ${z("radius")}; box-shadow: ${N}; animation: nano-in-up .2s ease-out }
123
+ .toast > .body { flex: 1 } .toast .title { font-weight: 600 } .toast .desc { color: ${z("muted")}; margin-top: 2px }
124
+ .toast.good { border-left: 3px solid ${z("good")} } .toast.bad { border-left: 3px solid ${z("bad")} } .toast.warn { border-left: 3px solid ${z("warn")} }
125
+ `;function j($,F,J){try{$.showPopover?.()}catch{}let Q=J?{left:J.x,top:J.y,bottom:J.y,width:0}:F.getBoundingClientRect(),U=$.offsetWidth,Y=$.offsetHeight;$.style.minWidth=Q.width?`${Q.width}px`:"",$.style.left=`${Math.max(4,Math.min(Q.left,innerWidth-U-4))}px`,$.style.top=`${Q.bottom+4+Y>innerHeight&&Q.top-Y-4>0?Q.top-Y-4:Q.bottom+4}px`}var D=($)=>{try{$.hidePopover?.()}catch{}};var y=($)=>$.label??$.value,X$=R`<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M3 8.5l3 3 7-7" fill="none" stroke="currentColor" stroke-width="2"/></svg>`,Y$=0;class q extends M{static shadowRootOptions={...M.shadowRootOptions,delegatesFocus:!0};static properties={items:{attribute:!1},selected:{attribute:!1},placeholder:{},q:{state:!0},active:{state:!0}};static styles=[_,G,B`
126
+ :host { display: block; min-width: 220px }
127
+ .search { display: flex; align-items: center; gap: 6px; padding: 0 8px; border-bottom: 1px solid ${z("border")}; color: ${z("muted")} }
128
+ .search input { flex: 1; border: 0; background: none; outline: 0; padding: 9px 0; font-size: 13px }
129
+ [role='listbox'] { max-height: 260px; overflow: auto; padding: 4px }
130
+ .menu-item .check { width: 14px; display: inline-flex }
131
+ .menu-item[aria-disabled='true'] { pointer-events: none }
132
+ .empty { padding: 18px 8px; text-align: center; color: ${z("muted")} }`];uid=`c${++Y$}`;constructor(){super();this.items=[],this.selected=[],this.placeholder="Search…",this.q="",this.active=0}get shown(){let $=this.q.toLowerCase();return this.items.filter((F)=>y(F).toLowerCase().includes($))}reset(){this.q="",this.active=0}pick($){if($&&!$.disabled)this.dispatchEvent(new CustomEvent("pick",{detail:$,bubbles:!0,composed:!0}))}onKey($){let F=this.shown.length;if($.key==="ArrowDown"||$.key==="ArrowUp"){if($.preventDefault(),F)this.active=(this.active+($.key==="ArrowDown"?1:-1)+F)%F}else if($.key==="Enter")$.preventDefault(),this.pick(this.shown[this.active])}updated(){this.renderRoot.querySelector(".active")?.scrollIntoView?.({block:"nearest"})}render(){let $=this.shown,F;return R`<div class="search"><svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><circle cx="7" cy="7" r="4.5" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M10.5 10.5L14 14" stroke="currentColor" stroke-width="1.5"/></svg>
133
+ <input role="combobox" aria-expanded="true" aria-controls=${`${this.uid}-list`} aria-autocomplete="list" placeholder=${this.placeholder} .value=${this.q}
134
+ aria-activedescendant=${$.length?`${this.uid}-${this.active}`:X}
135
+ @input=${(J)=>{this.q=J.target.value,this.active=0}} @keydown=${this.onKey}></div>
136
+ <div role="listbox" id=${`${this.uid}-list`} aria-multiselectable=${this.selected.length>1?"true":X}>
137
+ ${$.length?$.map((J,Q)=>{let U=J.group&&J.group!==F?R`<div class="menu-label" role="presentation">${J.group}</div>`:X;return F=J.group,R`${U}<div role="option" id=${`${this.uid}-${Q}`} data-value=${J.value} class="menu-item ${Q===this.active?"active":""}"
138
+ aria-selected=${String(this.selected.includes(J.value))} aria-disabled=${J.disabled?"true":X}
139
+ @pointermove=${()=>{this.active=Q}} @click=${()=>this.pick(J)}>
140
+ <span class="check">${this.selected.includes(J.value)?X$:X}</span>${y(J)}${J.shortcut?R`<span class="shortcut">${J.shortcut}</span>`:X}</div>`}):R`<div class="empty">No results.</div>`}</div>`}}class E extends M{static properties={options:{attribute:!1},value:{attribute:!1},multiple:{type:Boolean},placeholder:{},label:{},open:{state:!0}};static styles=[_,G,B`
141
+ :host { display: inline-block; min-width: 180px }
142
+ [role='combobox'] { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-height: 30px; padding: 3px 8px; cursor: pointer;
143
+ border: 1px solid ${z("border-strong")}; border-radius: ${z("radius-s")}; background: ${z("bg")}; font-size: 12px }
144
+ .placeholder { color: ${z("muted")} } .chev { margin-left: auto; color: ${z("muted")} }
145
+ .chip { padding: 0 2px 0 6px; background: ${z("surface-2")}; border-color: transparent }
146
+ .chip button { border: 0; padding: 0 4px; background: none; color: ${z("muted")} }
147
+ .pop { padding: 0 }`];constructor(){super();this.options=[],this.value="",this.multiple=!1,this.placeholder="Select…",this.label="",this.open=!1}get items(){return this.options.map(($)=>typeof $==="string"?{value:$}:$)}get chosen(){return Array.isArray(this.value)?this.value:this.value?[this.value]:[]}labelFor=($)=>y(this.items.find((F)=>F.value===$)??{value:$});get pop(){return this.renderRoot.querySelector(".pop")}get trigger(){return this.renderRoot.querySelector('[role="combobox"]')}set($){this.value=$,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}show($){if($===this.open)return;this.open=$;let F=this.renderRoot.querySelector("nano-command");if($)F.reset(),j(this.pop,this.trigger),F.focus();else D(this.pop),this.trigger.focus()}onPick($){let F=$.detail.value;if(!this.multiple){this.set(F),this.show(!1);return}this.set(this.chosen.includes(F)?this.chosen.filter((J)=>J!==F):[...this.chosen,F])}onKey($){if($.key==="Escape")$.preventDefault(),this.show(!1);else if($.target===this.trigger&&["ArrowDown","Enter"," "].includes($.key))$.preventDefault(),this.show(!0);else if($.target===this.trigger&&$.key==="Backspace"&&this.multiple&&this.chosen.length)this.set(this.chosen.slice(0,-1))}render(){let $=this.chosen,F=!$.length?R`<span class="placeholder">${this.placeholder}</span>`:this.multiple?$.map((J)=>R`<span class="chip">${this.labelFor(J)}<button tabindex="-1" aria-label=${`Remove ${this.labelFor(J)}`}
148
+ @click=${(Q)=>{Q.stopPropagation(),this.set($.filter((U)=>U!==J))}}>×</button></span>`):this.labelFor($[0]);return R`<div role="combobox" tabindex="0" aria-label=${this.label||X} aria-haspopup="listbox" aria-expanded=${String(this.open)} @click=${()=>this.show(!this.open)} @keydown=${this.onKey}>
149
+ ${F}<svg class="chev" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5"/></svg></div>
150
+ <div class="pop" popover="auto" @toggle=${(J)=>{if(J.newState==="closed")this.open=!1}} @keydown=${this.onKey}>
151
+ <nano-command .items=${this.items} .selected=${$} @pick=${this.onPick}></nano-command></div>`}}for(let[$,F]of[["nano-command",q],["nano-select",E]])if(globalThis.customElements&&!customElements.get($))customElements.define($,F);var v=($)=>String($).padStart(2,"0"),I=($)=>`${$.getFullYear()}-${v($.getMonth()+1)}-${v($.getDate())}`,u=($)=>{let[F,J,Q]=$.split("-").map(Number);return F&&J&&Q?new Date(F,J-1,Q):void 0},Z$=($,F)=>{let J=u($);return J.setDate(J.getDate()+F),I(J)},x$=["Su","Mo","Tu","We","Th","Fr","Sa"],t=($)=>R`<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d=${$} fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`;class b extends M{static properties={value:{},view:{state:!0},focusDate:{state:!0}};static styles=[_,G,B`
152
+ :host { display: inline-block; padding: 8px }
153
+ .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px }
154
+ .caption { font-weight: 600 } .head .icon-btn { width: 28px; height: 28px; border: 1px solid ${z("border")} }
155
+ table { border-collapse: collapse } th { width: 32px; font-size: 11px; font-weight: 400; color: ${z("muted")}; padding-bottom: 4px }
156
+ td { padding: 1px } td button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: ${z("radius-s")}; font-size: 12px }
157
+ button.outside { color: ${z("muted")}; opacity: .6 } button.today { background: ${z("surface-2")} }
158
+ button[aria-selected='true'] { background: ${z("accent")}; color: ${z("on-accent")}; opacity: 1 }`];constructor(){super();this.value="";let $=new Date;this.view={y:$.getFullYear(),m:$.getMonth()},this.focusDate=""}willUpdate($){let F=u(this.value);if($.has("value")&&F)this.view={y:F.getFullYear(),m:F.getMonth()},this.focusDate=this.value}shift($){let F=new Date(this.view.y,this.view.m+$,1);this.view={y:F.getFullYear(),m:F.getMonth()},this.focusDate=I(F)}focus(){this.renderRoot.querySelector('[tabindex="0"]')?.focus()}pick($){this.value=$,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}onKey($){let F={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[$.key],J=this.focusDate||I(new Date(this.view.y,this.view.m,1));if(F){$.preventDefault(),this.focusDate=Z$(J,F);let Q=u(this.focusDate);this.view={y:Q.getFullYear(),m:Q.getMonth()},this.updateComplete.then(()=>this.renderRoot.querySelector('[tabindex="0"]')?.focus())}else if($.key==="Enter"||$.key===" ")$.preventDefault(),this.pick(J)}render(){let{y:$,m:F}=this.view,J=new Date($,F,1),Q=Array.from({length:42},(Z,V)=>new Date($,F,1-J.getDay()+V)),U=I(new Date),Y=this.focusDate.startsWith(`${$}-${v(F+1)}-`)?this.focusDate:I(J);return R`<div class="head">
159
+ <button class="icon-btn" aria-label="Previous month" @click=${()=>this.shift(-1)}>${t("M10 4L6 8l4 4")}</button>
160
+ <span class="caption" aria-live="polite">${J.toLocaleString("en",{month:"long"})} ${$}</span>
161
+ <button class="icon-btn" aria-label="Next month" @click=${()=>this.shift(1)}>${t("M6 4l4 4-4 4")}</button></div>
162
+ <table role="grid" @keydown=${this.onKey}><thead><tr>${x$.map((Z)=>R`<th scope="col">${Z}</th>`)}</tr></thead><tbody>
163
+ ${[0,1,2,3,4,5].map((Z)=>R`<tr>${Q.slice(Z*7,Z*7+7).map((V)=>{let W=I(V);return R`<td role="gridcell"><button data-date=${W} tabindex=${W===Y?"0":"-1"} aria-selected=${W===this.value?"true":X}
164
+ class="${V.getMonth()!==F?"outside":""} ${W===U?"today":""}" @click=${()=>{this.focusDate=W,this.pick(W)}}>${V.getDate()}</button></td>`})}</tr>`)}</tbody></table>`}}class g extends M{static properties={value:{},placeholder:{},open:{state:!0}};static styles=[_,G,B`
165
+ :host { display: inline-block } .trigger { min-width: 200px; justify-content: flex-start; background: ${z("bg")} }
166
+ .trigger .muted { font-weight: 400 } .pop { padding: 0 }`];constructor(){super();this.value="",this.placeholder="Pick a date",this.open=!1}get pop(){return this.renderRoot.querySelector(".pop")}get trigger(){return this.renderRoot.querySelector(".trigger")}show($){if(this.open=$,$)j(this.pop,this.trigger),this.renderRoot.querySelector("nano-calendar").focus();else D(this.pop)}onChange($){$.stopPropagation(),this.value=$.target.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.show(!1),this.trigger.focus()}render(){let $=u(this.value);return R`<button class="trigger" aria-haspopup="dialog" aria-expanded=${String(this.open)} @click=${()=>this.show(!this.open)}>
167
+ <svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><rect x="2" y="3" width="12" height="11" rx="2" fill="none" stroke="currentColor" stroke-width="1.3"/><path d="M2 6.5h12M5 1.5v3M11 1.5v3" stroke="currentColor" stroke-width="1.3"/></svg>
168
+ ${$?$.toLocaleDateString("en",{month:"short",day:"numeric",year:"numeric"}):R`<span class="muted">${this.placeholder}</span>`}</button>
169
+ <div class="pop" popover="auto" role="dialog" aria-label="Choose a date" @toggle=${(F)=>{if(F.newState==="closed")this.open=!1}}
170
+ @keydown=${(F)=>{if(F.key==="Escape")F.preventDefault(),this.show(!1)}}>
171
+ <nano-calendar .value=${this.value} @change=${this.onChange}></nano-calendar></div>`}}for(let[$,F]of[["nano-calendar",b],["nano-date-picker",g]])if(globalThis.customElements&&!customElements.get($))customElements.define($,F);var k=($)=>("label"in $)&&!$.disabled,B$=0,T=($,F)=>{if(globalThis.customElements&&!customElements.get($))customElements.define($,F)};class w extends M{static properties={items:{attribute:!1},open:{type:Boolean,reflect:!0},active:{state:!0}};static styles=[_,G,B`:host { display: contents } [role='menu'] { outline: 0; min-width: 12rem }`];constructor(){super();this.items=[],this.open=!1,this.active=-1,this.addEventListener("contextmenu",($)=>{$.preventDefault(),this.show({x:$.clientX,y:$.clientY})})}uid=`m${++B$}`;get menu(){return this.renderRoot.querySelector('[role="menu"]')}async show($){this.open=!0,this.active=this.items.findIndex(k),await this.updateComplete,j(this.menu,this,$),this.menu.focus()}close(){this.open=!1,D(this.menu)}pick($){if(!$||!k($))return;this.dispatchEvent(new CustomEvent("pick",{detail:$,bubbles:!0,composed:!0})),this.close()}onKey($){let F=$.key==="ArrowDown"?1:$.key==="ArrowUp"?-1:0;if(F){$.preventDefault();for(let J=1,Q=this.items.length;J<=Q;J++){let U=(this.active+F*J+Q)%Q;if(k(this.items[U])){this.active=U;break}}}else if($.key==="Enter"||$.key===" ")$.preventDefault(),this.pick(this.items[this.active]);else if($.key==="Escape")$.preventDefault(),this.close()}render(){return R`<slot></slot><div class="pop" popover="auto" role="menu" tabindex="-1" aria-activedescendant=${this.active>=0?`${this.uid}-${this.active}`:X} @keydown=${this.onKey}
172
+ @toggle=${($)=>{if($.newState==="closed")this.open=!1}}>
173
+ ${this.items.map(($,F)=>("separator"in $)?R`<div class="menu-sep" role="separator"></div>`:("heading"in $)?R`<div class="menu-label">${$.heading}</div>`:R`<div role="menuitem" id=${`${this.uid}-${F}`} class="menu-item ${$.danger?"danger":""} ${F===this.active?"active":""}" aria-disabled=${$.disabled?"true":X}
174
+ @pointermove=${()=>{if(!$.disabled)this.active=F}} @click=${()=>this.pick($)}>${$.label}${$.shortcut?R`<span class="shortcut">${$.shortcut}</span>`:X}</div>`)}</div>`}}class m extends M{static properties={open:{type:Boolean,reflect:!0},openDelay:{type:Number,attribute:"open-delay"},closeDelay:{type:Number,attribute:"close-delay"}};static styles=[_,G,B`:host { display: inline-block } .pop { width: 280px; padding: 14px }`];timer;constructor(){super();this.open=!1,this.openDelay=500,this.closeDelay=200}later($){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.open=$},$?this.openDelay:this.closeDelay)}updated($){if(!$.has("open"))return;let F=this.renderRoot.querySelector(".pop");if(this.open)j(F,this.renderRoot.querySelector(".trigger"));else D(F);F.style.minWidth=""}render(){let $=()=>this.later(!0),F=()=>this.later(!1);return R`<span class="trigger" @pointerenter=${$} @pointerleave=${F} @focusin=${$} @focusout=${F}><slot></slot></span>
175
+ <div class="pop" popover="manual" @pointerenter=${$} @pointerleave=${F}><slot name="card"></slot></div>`}}var V$=0;class p extends M{static properties={toasts:{state:!0}};static styles=[_,G,B`:host { position: fixed; right: 16px; bottom: 16px; z-index: 1000 } ol { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none }`];constructor(){super();this.toasts=[]}add($){if(this.toasts=[...this.toasts,$],$.duration!==0)setTimeout(()=>this.dismiss($.id),$.duration??4000)}dismiss($){this.toasts=this.toasts.filter((F)=>F.id!==$)}render(){return R`<ol aria-live="polite">${this.toasts.map(($)=>R`<li class="toast ${$.variant??""}" role="status">
176
+ <div class="body"><div class="title">${$.title}</div>${$.description?R`<div class="desc">${$.description}</div>`:X}</div>
177
+ <button class="icon-btn" aria-label="Close" @click=${()=>this.dismiss($.id)}>✕</button></li>`)}</ol>`}}function _$($,F={}){let J=document.querySelector("nano-toaster")??document.body.appendChild(document.createElement("nano-toaster")),Q=++V$;return J.add({id:Q,title:$,...F}),Q}class r extends M{static properties={code:{},language:{},copied:{state:!0}};static styles=[_,G,B`
178
+ .frame { position: relative } .bar { position: absolute; top: 4px; right: 4px; display: flex; align-items: center; gap: 6px }
179
+ .lang { font-size: 11px; color: ${z("muted")} } pre.code { padding-right: 90px }`];constructor(){super();this.code="",this.language="",this.copied=!1}async copy(){await navigator.clipboard?.writeText(this.code),this.copied=!0,setTimeout(()=>{this.copied=!1},1500)}render(){return R`<div class="frame"><pre class="code">${this.code}</pre><div class="bar"><span class="lang">${this.language}</span>
180
+ <button class="icon-btn" aria-label="Copy" @click=${this.copy}>${this.copied?"✓ Copied":"Copy"}</button></div></div>`}}T("nano-menu",w);T("nano-hover-card",m);T("nano-toaster",p);T("nano-code-block",r);var $$=new WeakMap;function A($,F={}){if(!$)return;let J=Object.fromEntries(Object.entries(F).filter(([Q])=>/^[a-z][a-z0-9-]*$/.test(Q)));for(let Q of $$.get($)??[])if(!(Q in J))$.removeAttribute(Q);for(let[Q,U]of Object.entries(J))U===void 0?$.removeAttribute(Q):$.setAttribute(Q,U);$$.set($,Object.keys(J))}var z$=10,F$=($,F)=>String($[F]??""),G$=($,F)=>typeof $==="number"&&typeof F==="number"?$-F:String($??"").localeCompare(String(F??""),void 0,{numeric:!0});class c extends M{static properties={columns:{attribute:!1},rowAttrs:{attribute:!1},rows:{attribute:!1},filter:{type:Boolean},selectable:{type:Boolean},pageSize:{type:Number,attribute:"page-size"},widths:{state:!0},q:{state:!0},sort:{state:!0},page:{state:!0},picked:{state:!0}};static styles=[_,G,B`
181
+ .frame { border: 1px solid ${z("border")}; border-radius: ${z("radius")}; overflow: auto }
182
+ .table { margin: 0 } .table tr:last-child td { border-bottom: 0 } .table tbody tr:hover { background: ${z("surface-2")} }
183
+ .table tr[data-mark] { background: ${z("warn-bg")}; box-shadow: inset 3px 0 ${z("warn")} } .table tr[aria-selected='true'] { background: ${z("surface-2")} } .table .right { text-align: right } .table .tick { width: 28px }
184
+ th button { border: 0; padding: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit }
185
+ .filter { width: min(280px, 100%); margin-bottom: 10px } .empty { text-align: center; padding: 24px; color: ${z("muted")} }
186
+ th { position: relative } .fixed { table-layout: fixed } .fixed td, .fixed th { overflow: hidden; text-overflow: ellipsis }
187
+ .resize { position: absolute; top: 0; right: 0; bottom: 0; width: 6px; cursor: col-resize; touch-action: none }
188
+ .resize:hover, .resize:focus-visible { background: ${z("border")}; outline: none }
189
+ .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; color: ${z("muted")}; font-size: 12px }`];constructor(){super();this.columns=[],this.rows=[],this.filter=!1,this.selectable=!1,this.pageSize=0,this.widths={},this.q="",this.page=0,this.picked=new Set}get shown(){let $=this.q.toLowerCase(),F=$?this.rows.filter((Q)=>this.columns.some((U)=>F$(Q,U.key).toLowerCase().includes($))):[...this.rows],J=this.sort;return J?F.sort((Q,U)=>G$(Q[J.key],U[J.key])*J.dir):F}measured={};updated(){if(this.isFixed())return;let $=!1;for(let F of this.columns){let J=this.renderRoot.querySelector(`th[data-key="${F.key}"]`)?.offsetWidth||120;if(this.measured[F.key]!==J)this.measured[F.key]=J,$=!0}if($)this.requestUpdate()}isFixed(){return this.columns.some(($)=>(this.widths[$.key]??$.width)!==void 0)}widthOf($){return this.widths[$.key]??$.width??this.measured[$.key]??120}resize($,F){let J=this.isFixed()?this.widths:Object.fromEntries(this.columns.map((Q)=>[Q.key,this.widthOf(Q)]));this.widths={...J,[$.key]:Math.max($.minWidth??60,Math.round(F))}}drag($,F){F.preventDefault(),F.stopPropagation();let J=F.clientX,Q=this.widthOf($),U=(Z)=>this.resize($,Q+Z.clientX-J),Y=()=>{removeEventListener("pointermove",U),removeEventListener("pointerup",Y)};addEventListener("pointermove",U),addEventListener("pointerup",Y)}nudge($,F){let J=F.key==="ArrowRight"?z$:F.key==="ArrowLeft"?-z$:0;if(J)F.preventDefault(),this.resize($,this.widthOf($)+J)}sortBy($){this.sort=this.sort?.key===$&&this.sort.dir===1?{key:$,dir:-1}:{key:$,dir:1}}pick($,F){let J=new Set(this.picked);for(let Q of $)F?J.add(Q):J.delete(Q);this.picked=J,this.dispatchEvent(new CustomEvent("selection",{detail:this.rows.filter((Q)=>J.has(Q)),bubbles:!0,composed:!0}))}render(){let $=this.shown,F=this.pageSize||$.length||1,J=Math.max(1,Math.ceil($.length/F)),Q=Math.min(this.page,J-1),U=$.slice(Q*F,Q*F+F),Y=this.isFixed(),Z=this.columns.reduce((x,H)=>x+this.widthOf(H),this.selectable?28:0),V=U.length>0&&U.every((x)=>this.picked.has(x)),W=(x)=>{let H=this.sort?.key===x.key?this.sort.dir===1?"ascending":"descending":void 0;return R`<th data-key=${x.key} class=${x.align??""} aria-sort=${x.sortable?H??"none":X}>${x.sortable?R`<button @click=${()=>this.sortBy(x.key)}>${x.label} ${H==="ascending"?"↑":H==="descending"?"↓":"↕"}</button>`:x.label}<span
190
+ class="resize" role="separator" aria-orientation="vertical" tabindex="0" aria-label="Resize ${x.label}" aria-valuemin=${x.minWidth??60}
191
+ aria-valuenow=${this.widthOf(x)} @pointerdown=${(K)=>this.drag(x,K)} @keydown=${(K)=>this.nudge(x,K)}
192
+ @click=${(K)=>K.stopPropagation()}></span></th>`};return R`${this.filter?R`<input class="input filter" placeholder="Filter…" aria-label="Filter rows" .value=${this.q}
193
+ @input=${(x)=>{this.q=x.target.value,this.page=0}}>`:X}
194
+ <div class="frame"><table class="table ${Y?"fixed":""}" style=${Y?`width: ${Z}px`:""}>${Y?R`<colgroup>${this.selectable?R`<col style="width: 28px">`:X}
195
+ ${this.columns.map((x)=>R`<col style="width: ${this.widthOf(x)}px">`)}</colgroup>`:X}<thead><tr>
196
+ ${this.selectable?R`<th class="tick"><input type="checkbox" aria-label="Select all" .checked=${V} @click=${()=>this.pick(U,!V)}></th>`:X}
197
+ ${this.columns.map(W)}</tr></thead><tbody>
198
+ ${U.length?U.map((x)=>R`<tr aria-selected=${this.selectable?String(this.picked.has(x)):X} ${O((H)=>A(H,this.rowAttrs?.(x)))}>
199
+ ${this.selectable?R`<td class="tick"><input type="checkbox" aria-label="Select row" .checked=${this.picked.has(x)} @click=${()=>this.pick([x],!this.picked.has(x))}></td>`:X}
200
+ ${this.columns.map((H)=>R`<td data-key=${H.key} class=${H.align??""}>${H.render?H.render(x):F$(x,H.key)}</td>`)}</tr>`):R`<tr><td class="empty" colspan=${this.columns.length+(this.selectable?1:0)}>No results.</td></tr>`}</tbody></table></div>
201
+ ${this.selectable||this.pageSize?R`<div class="foot"><span>${this.selectable?`${this.picked.size} of ${this.rows.length} row(s) selected.`:""}</span>
202
+ ${this.pageSize?R`<span class="pages row">Page ${Q+1} of ${J}
203
+ <button class="btn small" aria-label="Previous page" ?disabled=${Q===0} @click=${()=>{this.page=Q-1}}>‹</button>
204
+ <button class="btn small" aria-label="Next page" ?disabled=${Q>=J-1} @click=${()=>{this.page=Q+1}}>›</button></span>`:X}</div>`:X}`}}if(globalThis.customElements&&!customElements.get("nano-data-table"))customElements.define("nano-data-table",c);var J$=($)=>typeof $==="string"?$:JSON.stringify($,null,2),M$={"input-streaming":["Pending",""],"input-available":["Running","accent"],"output-available":["Completed","good"],"output-error":["Error","bad"]},W$={running:["Running","accent"],completed:["Completed","good"],error:["Error","bad"]},H$={completed:"✓",in_progress:"◐",pending:"○"},f=($,F)=>{if(globalThis.customElements&&!customElements.get($))customElements.define($,F)},P=B`
205
+ details.card { padding: 0 } details.card > summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; list-style: none }
206
+ details.card > summary::-webkit-details-marker { display: none }
207
+ details.card > summary::after { content: '▾'; margin-left: 8px; color: ${z("muted")}; transition: transform .15s } details.card:not([open]) > summary::after { transform: rotate(-90deg) }
208
+ details.card > summary .badge { margin-left: auto } .body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px }
209
+ .name { font-weight: 600 } .kicker { margin-bottom: 4px } .code { max-height: 220px }`;class d extends M{static properties={tool:{attribute:!1}};static styles=[_,G,P];render(){let $=this.tool;if(!$)return X;let[F,J]=M$[$.state];return R`<details class="card" ?open=${$.state==="output-error"}><summary>
210
+ <svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M10.5 2.5a3 3 0 0 0-3.9 3.9L2.5 10.5l3 3 4.1-4.1a3 3 0 0 0 3.9-3.9l-2 2-2-2z" fill="none" stroke="currentColor" stroke-width="1.3"/></svg>
211
+ <span class="name">${$.toolName??$.type.replace(/^tool-/,"")}</span><span class="badge ${J}">${F}</span></summary>
212
+ <div class="body">
213
+ <div data-part="input"><div class="kicker">Parameters</div><pre class="code">${J$($.input??{})}</pre></div>
214
+ ${$.state==="output-available"?R`<div data-part="output"><div class="kicker">Result</div><pre class="code">${J$($.output)}</pre></div>`:X}
215
+ ${$.state==="output-error"?R`<div class="alert bad">${$.errorText??"The tool failed."}</div>`:X}</div></details>`}}class l extends M{static properties={task:{attribute:!1}};static styles=[_,G,P,B`
216
+ ul { list-style: none; margin: 0; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px }
217
+ li { display: flex; gap: 8px; align-items: baseline } .icon { width: 14px; color: ${z("muted")} }
218
+ li[data-status='completed'] { color: ${z("muted")} } li[data-status='completed'] .icon { color: ${z("good")} } li[data-status='in_progress'] .icon { color: ${z("accent")} }
219
+ .file { margin-left: 4px } .count { color: ${z("muted")}; font-size: 12px; margin-left: auto } .count + .badge { margin-left: 0 }`];render(){let $=this.task;if(!$)return X;let F=$.items.filter((J)=>J.status==="completed").length;return R`<details class="card" open><summary><span class="title name">${$.title}</span><span class="count">${F}/${$.items.length}</span></summary>
220
+ <ul>${$.items.map((J)=>R`<li data-status=${J.status??"pending"}><span class="icon" aria-hidden="true">${H$[J.status??"pending"]}</span>
221
+ <span>${J.text}${J.file?R`<span class="chip mono file">${J.file.name}</span>`:X}</span></li>`)}</ul></details>`}}class a extends M{static properties={agent:{attribute:!1}};static styles=[_,G,P,B`.desc { color: ${z("muted")}; font-size: 12px } .body { border-left: 2px solid ${z("border")}; margin-left: 18px; padding-left: 12px }`];render(){let $=this.agent;if(!$)return X;let[F,J]=W$[$.status];return R`<details class="card" open><summary><span class="avatar small" aria-hidden="true">${$.name.slice(0,2).toUpperCase()}</span>
222
+ <span class="col" style="gap:0"><span class="name">${$.name}</span>${$.description?R`<span class="desc">${$.description}</span>`:X}</span>
223
+ <span class="badge ${J}">${F}</span></summary>
224
+ <div class="body">${$.parts.map((Q)=>R`<nano-tool .tool=${Q}></nano-tool>`)}${$.result?R`<div class="bubble">${$.result}</div>`:X}</div></details>`}}class h extends M{static properties={runs:{attribute:!1}};static styles=[_,G,B`
225
+ .term { font: 12px/1.6 ${z("font-mono")}; background: ${z("surface-2")}; border: 1px solid ${z("border")}; border-radius: ${z("radius")}; padding: 10px 12px; overflow: auto }
226
+ .run + .run { margin-top: 10px } .line { display: flex; gap: 8px; align-items: center } .prompt { color: ${z("accent")} } .cmd { font-weight: 600 }
227
+ .cwd { color: ${z("muted")} } .exit { margin-left: auto } pre { margin: 2px 0 0; white-space: pre-wrap; color: ${z("fg-2")} }`];constructor(){super();this.runs=[]}render(){return R`<div class="term">${this.runs.map(($)=>R`<div class="run"><div class="line">${$.cwd?R`<span class="cwd">${$.cwd}</span>`:X}
228
+ <span class="prompt">$</span><span class="cmd">${$.command}</span>
229
+ <span class="exit badge ${$.running?"accent":$.exitCode===0?"good":$.exitCode===void 0?"":"bad"}">${$.running?"running…":$.exitCode===void 0?"":`exit ${$.exitCode}`}</span></div>
230
+ ${$.output?R`<pre>${$.output}</pre>`:X}</div>`)}</div>`}}f("nano-tool",d);f("nano-task",l);f("nano-subagent",a);f("nano-cli",h);var C=($)=>$<1000?`${Math.round($)}ms`:`${($/1000).toFixed(2)}s`,o=($)=>`${+$.toFixed(2)}%`,K$=($)=>{let F=new Set($.map((U)=>U.spanId)),J=[],Q=(U,Y)=>$.filter((Z)=>U===void 0?!Z.parentSpanId||!F.has(Z.parentSpanId):Z.parentSpanId===U).sort((Z,V)=>Z.startTime-V.startTime).forEach((Z)=>{J.push({span:Z,depth:Y}),Q(Z.spanId,Y+1)});return Q(void 0,0),J};class n extends M{static properties={spans:{attribute:!1}};static styles=[_,G,B`
231
+ .frame { border: 1px solid ${z("border")}; border-radius: ${z("radius")}; padding: 8px 0 }
232
+ .head, .span { display: grid; grid-template-columns: minmax(120px, 30%) 1fr 64px; align-items: center; gap: 8px; padding: 3px 12px }
233
+ .head { color: ${z("muted")}; font-size: 11px; border-bottom: 1px solid ${z("border")}; padding-bottom: 6px; margin-bottom: 4px }
234
+ .span:hover { background: ${z("surface-2")} } .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
235
+ .track { position: relative; height: 14px } .bar { position: absolute; top: 2px; bottom: 2px; min-width: 2px; border-radius: 3px }
236
+ .bar.bad { background: ${z("bad")} !important } .dur, .total { text-align: right; color: ${z("muted")}; font: 11px ${z("font-mono")} }`];constructor(){super();this.spans=[]}render(){if(!this.spans.length)return X;let $=Math.min(...this.spans.map((J)=>J.startTime)),F=Math.max(...this.spans.map((J)=>J.endTime))-$||1;return R`<div class="frame"><div class="head"><span>Span</span><span>Timeline</span><span class="total">${C(F)}</span></div>
237
+ ${K$(this.spans).map(({span:J,depth:Q})=>R`<div class="span" data-depth=${Q} title=${`${J.name}: ${C(J.endTime-J.startTime)}`}>
238
+ <span class="label" style=${`padding-left:${Q*14}px`}>${J.name}</span>
239
+ <span class="track"><span class="bar ${J.status==="error"?"bad":""}" style=${`left:${o((J.startTime-$)/F*100)};width:${o((J.endTime-J.startTime)/F*100)};background:${L(`s${Q%8+1}`)}`}></span></span>
240
+ <span class="dur">${C(J.endTime-J.startTime)}</span></div>`)}</div>`}}var j$={passed:"✓",failed:"✕",skipped:"–"};class i extends M{static properties={results:{attribute:!1}};static styles=[_,G,P,B`
241
+ .summary { display: flex; align-items: center; gap: 8px; margin-bottom: 8px } .dur { margin-left: auto; color: ${z("muted")}; font: 11px ${z("font-mono")} }
242
+ .bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: ${z("surface-2")}; margin-bottom: 12px }
243
+ .seg.passed { background: ${z("good")} } .seg.failed { background: ${z("bad")} } .seg.skipped { background: ${z("muted")} }
244
+ .suites { display: flex; flex-direction: column; gap: 8px } .tests { list-style: none; margin: 0; padding: 0 12px 10px }
245
+ .test { display: grid; grid-template-columns: 16px 1fr auto; gap: 6px; padding: 3px 0 } .test .alert { grid-column: 2 / -1; font: 11px ${z("font-mono")}; white-space: pre-wrap }
246
+ .test.passed .mark { color: ${z("good")} } .test.failed .mark { color: ${z("bad")} } .test.skipped { color: ${z("muted")} }
247
+ .test .ms { color: ${z("muted")}; font: 11px ${z("font-mono")} } summary .muted { font-size: 12px }`];render(){let $=this.results;if(!$)return X;let{summary:F}=$,J={passed:"good",failed:"bad",skipped:""};return R`<div class="summary">${["passed","failed","skipped"].map((Q)=>R`<span class="badge ${J[Q]}" data-count=${Q}>${F[Q]} ${Q}</span>`)}
248
+ ${F.duration!==void 0?R`<span class="dur">${C(F.duration)}</span>`:X}</div>
249
+ <div class="bar" role="img" aria-label=${`${F.passed} passed, ${F.failed} failed, ${F.skipped} skipped of ${F.total}`}>
250
+ ${["passed","failed","skipped"].map((Q)=>R`<span class="seg ${Q}" style=${`width:${o(F[Q]/(F.total||1)*100)}`}></span>`)}</div>
251
+ <div class="suites">${$.suites.map((Q)=>{let U=Q.tests.filter((Y)=>Y.status==="failed").length;return R`<details class="card suite" ?open=${U>0}><summary><span class="name">${Q.name}</span>
252
+ <span class="muted">${Q.tests.length-U}/${Q.tests.length}</span>${U?R`<span class="badge bad">${U} failed</span>`:X}</summary>
253
+ <ul class="tests">${Q.tests.map((Y)=>R`<li class="test ${Y.status}"><span class="mark" aria-label=${Y.status}>${j$[Y.status]}</span><span>${Y.name}</span>
254
+ <span class="ms">${Y.duration!==void 0?C(Y.duration):""}</span>${Y.error?R`<div class="alert bad">${Y.error.message}</div>`:X}</li>`)}</ul></details>`})}</div>`}}for(let[$,F]of[["nano-trace",n],["nano-test-results",i]])if(globalThis.customElements&&!customElements.get($))customElements.define($,F);var Q$=B`
255
+ :host { display: block } ul { list-style: none; margin: 0; padding: 0 }
256
+ ul.group { margin-left: 15px; padding-left: 8px; border-left: 1px solid ${z("border")} }
257
+ li[role='treeitem'] { outline: 0 } li[role='treeitem']:focus-visible > .line { outline: 2px solid ${z("focus")}; outline-offset: -2px }
258
+ .line { display: flex; align-items: center; gap: 6px; padding: 5px 8px; margin: 1px 0; border-radius: ${z("radius-s")}; cursor: pointer; min-width: 0 }
259
+ .line:hover { background: ${z("surface-2")} } li[aria-selected='true'] > .line { background: ${z("accent-soft")} }
260
+ .chev { flex: none; width: 16px; cursor: pointer; text-align: center; color: ${z("muted")}; transition: transform .15s; user-select: none }
261
+ li[data-mark] > .line { background: ${z("warn-bg")}; box-shadow: inset 3px 0 ${z("warn")} } li[data-mark][aria-selected='true'] > .line { background: ${z("accent-soft")} }
262
+ li[aria-expanded='true'] > .line .chev { transform: rotate(90deg) }
263
+ .label { overflow-wrap: anywhere } .kind { color: ${z("muted")}; font-size: 11px; letter-spacing: .06em; text-transform: uppercase }
264
+ .count { color: ${z("muted")}; font-size: 11px; font-variant-numeric: tabular-nums }
265
+ .tag { font-size: 11px; padding: 2px 7px; border-radius: ${z("radius-s")}; background: ${z("accent-soft")}; white-space: nowrap }
266
+ .icon { flex: none; display: inline-flex; align-items: center; gap: 4px } .end { margin-left: auto; display: inline-flex; align-items: center; gap: 4px }
267
+ .body { padding: 2px 8px 6px 30px; color: ${z("muted")}; font-size: 12px }
268
+ mark { background: ${z("warn-bg")}; color: inherit; border-radius: 2px } .empty { color: ${z("muted")}; padding: 12px }
269
+ @media (pointer: coarse) { .line { min-height: 44px } }`;var D$=($,F)=>[$.label,...$.terms??[]].some((J)=>J.toLowerCase().includes(F)),R$=($,F,J)=>$.flatMap((Q)=>{let U=J||D$(Q,F),Y=R$(Q.children??[],F,U);return U||Y.length?[{node:Q,kids:Y}]:[]}),U$=($,F)=>{for(let J of $){if(J.id===F)return[F];let Q=U$(J.children??[],F);if(Q.length)return[J.id,...Q]}return[]};class s extends M{static properties={nodes:{attribute:!1},query:{},selected:{},openDepth:{type:Number,attribute:"open-depth"},icon:{attribute:!1},flipped:{state:!0},focused:{state:!0}};static styles=[_,G,Q$];#J=[];constructor(){super();this.nodes=[],this.query="",this.selected=null,this.openDepth=0,this.flipped=new Set,this.focused=null}get#$(){return this.query.trim().toLowerCase()}#Q($,F){return this.#$!==""||F<this.openDepth!==this.flipped.has($)}#R($){let F=new Set(this.flipped);F.has($)?F.delete($):F.add($),this.flipped=F}#z($,F){if($.can&&$.open!==F&&!this.#$)this.#R($.id)}reveal($,{focus:F=!0}={}){let J=U$(this.nodes,$);if(J.slice(0,-1).forEach((Q,U)=>{if(!this.#Q(Q,U))this.#R(Q)}),J.length)this.#F($,F)}async#F($,F=!0){this.focused=$,await this.updateComplete;let J=this.renderRoot.querySelector(`[role='treeitem'][data-id="${CSS.escape($)}"]`);if(F)J?.focus();J?.querySelector(".line")?.scrollIntoView?.({block:"nearest"})}#U($){if(this.dispatchEvent(new CustomEvent("select",{detail:{id:$},cancelable:!0,bubbles:!0,composed:!0})))this.selected=$}#Y($,F){let J=$.target;if(J.closest(".chev")){this.#z(F,!F.open);return}if(J.closest("button, a, input, select, textarea, label"))return;this.#U(F.id),this.#F(F.id)}#Z($){let F=$.target;if(F.getAttribute("role")!=="treeitem"||$.altKey||$.ctrlKey||$.metaKey)return;let J=this.#J,Q=J.findIndex((V)=>V.id===F.dataset.id),U=J[Q];if(!U)return;let Y=(V)=>{if(V)this.#F(V.id)},Z=$.key;if(Z==="ArrowDown")Y(J[Q+1]);else if(Z==="ArrowUp")Y(J[Q-1]);else if(Z==="Home")Y(J[0]);else if(Z==="End")Y(J.at(-1));else if(Z==="ArrowRight")U.can&&!U.open?this.#z(U,!0):J[Q+1]?.parent===U.id&&Y(J[Q+1]);else if(Z==="ArrowLeft")U.can&&U.open&&!this.#$?this.#z(U,!1):Y(J.find((V)=>V.id===U.parent));else if(Z==="Enter"||Z===" ")this.#U(U.id);else if(Z.length===1&&Z.trim()){let V=Z.toLowerCase();Y([...J.slice(Q+1),...J.slice(0,Q)].find((W)=>W.label.toLowerCase().startsWith(V)))}else return;$.preventDefault()}#x($){let F=this.#$,J=F?$.toLowerCase().indexOf(F):-1;return J<0?$:R`${$.slice(0,J)}<mark>${$.slice(J,J+F.length)}</mark>${$.slice(J+F.length)}`}#X($,F,J,Q){let U=$.node,Y=this.icon?.(U),Z=J.get(U.id),{can:V,open:W}=Z;return R`<li role="treeitem" data-id=${U.id} aria-level=${F+1} aria-expanded=${V?String(W):X}
270
+ aria-selected=${this.selected===U.id?"true":X} tabindex=${U.id===Q?0:-1}
271
+ ${O((x)=>A(x,U.data&&Object.fromEntries(Object.entries(U.data).map(([H,K])=>[`data-${H}`,K]))))}>
272
+ <div class="line" @click=${(x)=>this.#Y(x,Z)}>
273
+ <span class="chev" data-toggle=${U.id} aria-hidden="true">${V?"▸":""}</span>
274
+ ${Y?R`<span class="icon" title=${U.kind??X}>${Y}</span>`:X}<span class="label">${this.#x(U.label)}</span>
275
+ ${U.kind&&!Y?R`<span class="kind">${U.kind}</span>`:X}${U.count!==void 0?R`<span class="count">${U.count}</span>`:X}
276
+ ${U.badge?R`<span class="tag">${U.badge}</span>`:X}${U.end!==void 0?R`<span class="end">${U.end}</span>`:X}
277
+ </div>
278
+ ${W?R`${U.body!==void 0?R`<div class="body">${U.body}</div>`:X}
279
+ ${$.kids.length?R`<ul class="group" role="group">${$.kids.map((x)=>this.#X(x,F+1,J,Q))}</ul>`:X}`:X}
280
+ </li>`}render(){let $=R$(this.nodes,this.#$,this.#$===""),F=[],J=(Y,Z,V)=>Y.forEach((W)=>{let x=W.kids.length>0||W.node.body!==void 0,H=x&&this.#Q(W.node.id,Z);if(F.push({id:W.node.id,label:W.node.label,parent:V,can:x,open:H}),H)J(W.kids,Z+1,W.node.id)});if(J($,0),this.#J=F,!F.length)return R`<div class="empty">${this.#$?`Nothing matches “${this.query.trim()}”.`:"Nothing here."}</div>`;let Q=new Set(F.map((Y)=>Y.id)),U=[this.focused,this.selected].find((Y)=>Y&&Q.has(Y))??F[0].id;return R`<ul role="tree" @keydown=${(Y)=>this.#Z(Y)}>${$.map((Y)=>this.#X(Y,0,new Map(F.map((Z)=>[Z.id,Z])),U))}</ul>`}}if(globalThis.customElements&&!customElements.get("nano-tree"))customElements.define("nano-tree",s);export{L as tv,_$ as toast,z as t,G as kit,_ as base,s as NanoTree,n as NanoTrace,d as NanoTool,p as NanoToaster,i as NanoTestResults,l as NanoTask,a as NanoSubagent,E as NanoSelect,w as NanoMenu,m as NanoHoverCard,g as NanoDatePicker,c as NanoDataTable,q as NanoCommand,r as NanoCodeBlock,h as NanoCli,b as NanoCalendar,S as NANO_TOKENS};
@@ -0,0 +1 @@
1
+ import{A as P,B as Q,C as R,D as S,E as T,F as U,G as V,H as W,I as X,J as Y,K as Z,L as _,M as $,N as d,O as c,c as k,g as m,h as n,i as q,j as w,k as z,l as A,m as B,n as C,o as D,p as E,q as F,r as G,s as H,t as I,u as J,v as K,w as L,x as M,y as N,z as O}from"./chunks/nano-core-5h5dssvv.js";import"./chunks/nano-core-hm29e227.js";import"./chunks/nano-core-jtgk4ch8.js";export{c as default,d as Value,W as Update,_ as UnionScoreSelect,A as UnionPrioritySort,$ as Repair,k as Pointer,F as Pipeline,Z as Patch,S as Parser,R as ParseError,T as Parse,C as IsOptionalUndefined,V as Insert,Q as Hash,M as HasCodec,n as Errors,P as Equal,K as EncodeUnsafe,J as EncodeError,L as Encode,Y as Edit,U as Diff,X as Delete,E as Default,H as DecodeUnsafe,G as DecodeError,I as Decode,N as CreateError,O as Create,D as Convert,z as Clone,B as Clean,m as Check,q as AssertError,w as Assert};
@@ -0,0 +1 @@
1
+ import{a as Hk,b as c}from"./chunks/nano-core-87v2yejk.js";import{$ as k,$a as kc,$b as kg,$c as ki,$d as kj,$e as kk,Aa as V,Ab as Vc,Ac as Vg,Ad as Vi,Ae as Vj,Ba as W,Bb as Wc,Bc as Wg,Bd as Wi,Be as Wj,Ca as X,Cb as Xc,Cc as Xg,Cd as Xi,Ce as Xj,Da as Y,Db as Yc,Dc as Yg,Dd as Yi,De as Yj,Ea as Z,Eb as Zc,Ec as Zg,Ed as Zi,Ee as Zj,Fa as _,Fb as _c,Fc as _g,Fd as _i,Fe as _j,Ga as $,Gb as $c,Gc as $g,Gd as $i,Ge as $j,Ha as d,Hb as dc,Hc as dg,Hd as di,He as dj,Ia as f,Ib as fc,Ic as fg,Id as fi,Ie as fj,Ja as h,Jb as hc,Jc as hg,Jd as hi,Je as hj,Ka as r,Kb as rc,Kc as rg,Kd as ri,Ke as rj,La as s,Lb as sc,Lc as sg,Ld as si,Le as sj,Ma as v,Mb as vc,Mc as vg,Md as vi,Me as vj,Na as a,Nb as ac,Nc as ag,Nd as ai,Ne as aj,Oa as b,Ob as bc,Oc as bg,Od as bi,Oe as bj,Pa as l,Pb as lc,Pc as lg,Pd as li,Pe as lj,Qa as u,Qb as uc,Qc as ug,Qd as ui,Qe as uj,Ra as y,Rb as yc,Rc as yg,Rd as yi,Re as yj,Sa as p,Sb as pc,Sc as pg,Sd as pi,Se as pj,Ta as x,Tb as xc,Tc as xg,Td as xi,Te as xj,Ua as o,Ub as oc,Uc as og,Ud as oi,Ue as oj,Va as t,Vb as tc,Vc as tg,Vd as ti,Ve as tj,Wa as e,Wb as ec,Wc as eg,Wd as ei,We as ej,Xa as cc,Xb as cg,Xc as ci,Xd as cj,Xe as ck,Ya as gc,Yb as gg,Yc as gi,Yd as gj,Ye as gk,Za as ic,Zb as ig,Zc as ii,Zd as ij,Ze as ik,_a as jc,_b as jg,_c as ji,_d as jj,_e as jk,aa as m,ab as mc,ac as mg,ad as mi,ae as mj,af as mk,ba as n,bb as nc,bc as ng,bd as ni,be as nj,bf as nk,ca as q,cb as qc,cc as qg,cd as qi,ce as qj,cf as qk,da as w,db as wc,dc as wg,dd as wi,de as wj,df as wk,ea as z,eb as zc,ec as zg,ed as zi,ee as zj,ef as zk,fa as A,fb as Ac,fc as Ag,fd as Ai,fe as Aj,ff as Ak,ga as B,gb as Bc,gc as Bg,gd as Bi,ge as Bj,gf as Bk,ha as C,hb as Cc,hc as Cg,hd as Ci,he as Cj,hf as Ck,ia as D,ib as Dc,ic as Dg,id as Di,ie as Dj,if as Dk,ja as E,jb as Ec,jc as Eg,jd as Ei,je as Ej,jf as Ek,ka as F,kb as Fc,kc as Fg,kd as Fi,ke as Fj,kf as Fk,la as G,lb as Gc,lc as Gg,ld as Gi,le as Gj,lf as Gk,ma as H,mb as Hc,mc as Hg,md as Hi,me as Hj,na as I,nb as Ic,nc as Ig,nd as Ii,ne as Ij,oa as J,ob as Jc,oc as Jg,od as Ji,oe as Jj,pa as K,pb as Kc,pc as Kg,pd as Ki,pe as Kj,qa as L,qb as Lc,qc as Lg,qd as Li,qe as Lj,ra as M,rb as Mc,rc as Mg,rd as Mi,re as Mj,sa as N,sb as Nc,sc as Ng,sd as Ni,se as Nj,ta as O,tb as Oc,tc as Og,td as Oi,te as Oj,ua as P,ub as Pc,uc as Pg,ud as Pi,ue as Pj,va as Q,vb as Qc,vc as Qg,vd as Qi,ve as Qj,wa as R,wb as Rc,wc as Rg,wd as Ri,we as Rj,xa as S,xb as Sc,xc as Sg,xd as Si,xe as Sj,ya as T,yb as Tc,yc as Tg,yd as Ti,ye as Tj,za as U,zb as Uc,zc as Ug,zd as Ui,ze as Uj}from"./chunks/nano-core-hm29e227.js";import"./chunks/nano-core-jtgk4ch8.js";export{c as default,X as _Object_,E as _Function_,w as _Array_,ik as WithInstantiate,ej as WithDeferred,gk as WithAction,ck as With,fg as Void,Yi as UppercaseInstantiate,Pi as UppercaseDeferred,Ui as UppercaseAction,Qi as Uppercase,r as Unsafe,_ as Unknown,oc as UnionOptions,pc as Union,$g as Undefined,Xi as UncapitalizeInstantiate,Ni as UncapitalizeDeferred,Ti as UncapitalizeAction,Oi as Uncapitalize,p as TypeScriptEnumToEnumValues,Hk as Type,mg as TupleOptions,jg as Tuple,Zg as This,bg as TemplateLiteralFromTypes,lg as TemplateLiteralFromString,sg as TemplateLiteralEncode,vg as TemplateLiteralDeferred,gg as TemplateLiteralDecodeUnsafe,ig as TemplateLiteralDecode,cg as TemplateLiteralCreate,ug as TemplateLiteral,sc as Symbol,lc as StringPattern,Ng as StringKey,uc as String,Gk as Script,tj as ReturnTypeInstantiate,pj as ReturnTypeDeferred,oj as ReturnTypeAction,xj as ReturnType,Xg as Rest,yj as RequiredInstantiate,bj as RequiredDeferred,U as RequiredArray,uj as RequiredAction,lj as Required,wk as RemoveReadonlyDeferred,zk as RemoveReadonly,vj as RemoveOptionalDeferred,aj as RemoveOptional,nk as RemoveImmutableDeferred,qk as RemoveImmutable,Ec as RefineAdd,Fc as Refine,sj as RefInstantiate,H as Ref,Ug as RecordValue,Rg as RecordPatternToType,Sg as RecordPattern,Wg as RecordOptions,Tg as RecordKey,Kg as RecordInstantiate,Qg as RecordFromPattern,Og as RecordDeferred,Jg as RecordAction,Pg as Record,fj as ReadonlyType,rj as ReadonlyObjectInstantiate,$j as ReadonlyObjectDeferred,hj as ReadonlyObjectAction,dj as ReadonlyObject,Cc as Readonly,W as PropertyValues,V as PropertyKeys,Ek as Priority,_j as PickInstantiate,Xj as PickDeferred,Zj as PickAction,Yj as Pick,Wj as PartialInstantiate,Tj as PartialDeferred,Vj as PartialAction,Uj as Partial,rg as ParseTemplateIntoTypes,tc as ParsePatternIntoTypes,Sj as ParametersInstantiate,Pj as ParametersDeferred,Rj as ParametersAction,Qj as Parameters,ac as Parameter,S as Optional,Oj as OmitInstantiate,Lj as OmitDeferred,Nj as OmitAction,Mj as Omit,Z as ObjectOptions,X as Object,fc as NumberPattern,Mg as NumberKey,hc as Number,$c as Null,Kj as NonNullableInstantiate,Hj as NonNullableDeferred,Jj as NonNullableAction,Ij as NonNullable,N as NeverPattern,O as Never,zg as Narrow,Gj as ModuleInstantiate,Ck as ModuleDeferred,Dk as Module,Fj as MappedInstantiate,Cj as MappedDeferred,Ej as MappedAction,Dj as Mapped,Wi as LowercaseInstantiate,Li as LowercaseDeferred,Si as LowercaseAction,Mi as Lowercase,Tc as LiteralTypeName,Uc as Literal,oi as KeysToIndexer,Bj as KeyOfInstantiate,wj as KeyOfDeferred,Aj as KeyOfAction,zj as KeyOf,hg as IsVoid,s as IsUnsafe,$ as IsUnknown,xc as IsUnion,dg as IsUndefined,y as IsTypeScriptEnumLike,kg as IsTuple,_g as IsThis,Fk as IsTemplateLiteralPattern,ec as IsTemplateLiteralFinite,ag as IsTemplateLiteralDeferred,yg as IsTemplateLiteral,vc as IsSymbol,yc as IsString,m as IsSchema,Yg as IsRest,Gc as IsRefinement,Hc as IsRefine,I as IsRef,Vg as IsRecord,Dc as IsReadonly,bc as IsParameter,T as IsOptional,Y as IsObject,rc as IsNumber,dc as IsNull,P as IsNever,Vc as IsLiteralValue,Zc as IsLiteralString,Yc as IsLiteralNumber,Xc as IsLiteralBoolean,Wc as IsLiteralBigInt,_c as IsLiteral,k as IsKind,cc as IsIntersect,eg as IsInterfaceDeferred,Rc as IsInteger,a as IsInfer,zc as IsImmutable,Oc as IsIdentifier,K as IsGeneric,F as IsFunction,x as IsEnumValue,t as IsEnum,l as IsDependent,q as IsDeferred,f as IsCyclic,C as IsConstructor,qc as IsCodec,Ii as IsCall,Mc as IsBoolean,Kc as IsBigInt,z as IsArray,M as IsAny,Sc as InvalidLiteralValue,gc as IntersectOptions,e as Intersect,og as InterfaceInstantiate,tg as InterfaceDeferred,xg as InterfaceAction,ci as Interface,Pc as IntegerPattern,Lg as IntegerKey,Qc as Integer,mi as InstantiateCyclic,jk as Instantiate,qj as InstanceTypeInstantiate,kj as InstanceTypeDeferred,nj as InstanceTypeAction,mj as InstanceType,v as Infer,jj as IndexInstantiate,ti as IndexDeferred,ij as IndexAction,ei as Index,wc as Immutable,Nc as Identifier,J as Generic,G as FunctionOptions,E as Function,Ig as Flatten,xi as ExtractInstantiate,ui as ExtractDeferred,pi as ExtractAction,yi as Extract,pg as ExtendsResult,qi as Extends,li as ExcludeInstantiate,vi as ExcludeDeferred,bi as ExcludeAction,ai as Exclude,Hg as EvaluateUnionFast,Fg as EvaluateUnion,Gg as EvaluateType,Eg as EvaluateTemplateLiteral,qg as EvaluatePropertyUnion,ng as EvaluatePropertyIntersect,Dg as EvaluateIntersect,Fi as EvaluateInstantiate,Cg as EvaluateEnum,Bg as EvaluateDependent,Ak as EvaluateDeferred,Ei as EvaluateAction,Bk as Evaluate,o as Enum,ic as EncodeBuilder,nc as Encode,Ag as Distribute,u as DependentOptions,b as Dependent,n as Deferred,jc as DecodeBuilder,mc as Decode,ni as CyclicTarget,h as CyclicOptions,ki as CyclicExtends,ji as CyclicDependencies,gi as CyclicCheck,ii as CyclicCandidates,d as Cyclic,gj as ConvertToIntegerKey,si as ConstructorParametersInstantiate,fi as ConstructorParametersDeferred,ri as ConstructorParametersAction,hi as ConstructorParameters,D as ConstructorOptions,B as Constructor,di as ConditionalInstantiate,Zi as ConditionalDeferred,$i as ConditionalAction,_i as Conditional,wg as Composite,Bi as CompareResultRightInside,Ai as CompareResultLeftInside,wi as CompareResultEqual,zi as CompareResultDisjoint,Ci as Compare,cj as CollapseToObject,kc as Codec,Vi as CapitalizeInstantiate,Ji as CapitalizeDeferred,Ri as CapitalizeAction,Ki as Capitalize,Gi as CallConstruct,Hi as Call,Di as Broaden,Lc as Boolean,Ic as BigIntPattern,Jc as BigInt,A as ArrayOptions,w as Array,L as Any,Ac as AddReadonlyDeferred,Bc as AddReadonly,Q as AddOptionalDeferred,R as AddOptional,kk as AddImmutableDeferred,mk as AddImmutable};
@@ -0,0 +1,6 @@
1
+ import{Coord as q}from"@pritzlaff/nano-core";import{Type as f}from"typebox";import{Coord as X,Op as _,Schema as z}from"@pritzlaff/nano-core";var G;((B)=>(B.ns=X.namespace("example.auth"),B.Result=z.define(f.Object({ok:f.Boolean(),purpose:f.String(),at:f.String(),credentialId:f.Optional(f.String()),reason:f.Optional(f.String())},{additionalProperties:!1})),B.api=B.ns.interface("Auth",{authenticate:_.action(f.String(),B.Result),authenticated:_.event(B.Result)})))(G||={});function K(S,R){let I=document.createElement("dialog"),j=document.createElement("p");j.textContent=`${R} wants to ${S} — Authenticate with passkey?`;let F=(P,O)=>{let M=document.createElement("button");return M.textContent=P,M.onclick=()=>{I.close(),T(O)},M},T,C=new Promise((P)=>{T=P});return I.append(j,F("Approve",!0),F("Cancel",!1)),I.oncancel=()=>T(!1),document.body.append(I),I.showModal(),C.finally(()=>I.remove())}function c(S){try{return S.location?.origin==="null"||S.top!==S.self||!S.navigator?.credentials}catch{return!0}}var H={get sandboxed(){return c(globalThis)},get credentials(){return globalThis.navigator?.credentials},confirm:K};var A=(S)=>btoa(String.fromCharCode(...new Uint8Array(S))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Q=()=>crypto.getRandomValues(new Uint8Array(32)),V="passkeys are not available in a sandbox";async function U(S,R,I=H.sandboxed){let j=()=>new Date().toISOString();if(I||!H.credentials)return{ok:!1,purpose:S,at:j(),reason:V};try{let F=await R(H.credentials);return F?{ok:!0,purpose:S,at:j(),credentialId:A(F.rawId)}:{ok:!1,purpose:S,at:j(),reason:"no credential"}}catch(F){return{ok:!1,purpose:S,at:j(),reason:F?.name??"Error"}}}var J=(S="nano examples",R=()=>H.sandboxed)=>U("register",(I)=>I.create({publicKey:{challenge:Q(),rp:{name:S},user:{id:Q(),name:"nano",displayName:"nano"},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"required",userVerification:"preferred"}}}),R()),W=(S,R,I=()=>H.sandboxed)=>G.api.impl(S).description(R).make(()=>{let j=new Set,F=!1;return{async authenticate(T){if(F)return{ok:!1,purpose:T,at:new Date().toISOString(),reason:"busy"};if(I())return U(T,async()=>null,!0);F=!0;try{let C;try{C=await H.confirm(T,"A pod")}catch(O){return{ok:!1,purpose:T,at:new Date().toISOString(),reason:O?.name??"Error"}}if(!C)return{ok:!1,purpose:T,at:new Date().toISOString(),reason:"cancelled"};let P=await U(T,(O)=>O.get({publicKey:{challenge:Q(),userVerification:"preferred"}}),I());if(P.ok)for(let O of j)O(P);return P}finally{F=!1}},async*authenticated(){let T=[],C,P=(O)=>{T.push(O),C?.()};j.add(P);try{for(;;){while(T.length)yield T.shift();await new Promise((O)=>{C=O})}}finally{j.delete(P)}}}}),t=W(G.ns.implementationId("passkey"),"Asks the user, in a modal, for a passkey; refuses in a sandbox."),a=G.ns.provider([t]);import{LitElement as x,html as Y}from"lit";import{base as N,kit as m}from"@pritzlaff/nano-elements";class Z extends x{static properties={target:{attribute:!1},last:{state:!0},error:{state:!0}};static styles=[N,m];watching;iter;connectedCallback(){super.connectedCallback(),this.watch()}disconnectedCallback(){super.disconnectedCallback(),this.stop()}willUpdate(S){if(S.has("target"))this.watch()}stop(){this.iter?.return?.(),this.iter=this.watching=void 0}pod(S){return S.app.runtime(S.runtime).get(G.api,{pod:S.pod})}async watch(){let S=this.target;if(!S||!this.isConnected||this.watching===S)return;this.stop(),this.watching=S,this.error=this.last=void 0;let R=this.iter=this.pod(S).authenticated()[Symbol.asyncIterator]();try{for(let I=await R.next();!I.done&&this.iter===R;I=await R.next())this.last=I.value}catch(I){if(this.iter===R)this.error=String(I)}}register(){return J()}run(S){S.then((R)=>{this.last=R},(R)=>{this.error=String(R)})}render(){let S=this.target;if(!S)return Y``;let R=this.last;return Y`<div class="col">${this.error?Y`<p class="alert bad" role="alert">${this.error}</p>`:""}
2
+ <div class="row"><button class="btn" @click=${()=>this.run(this.pod(S).authenticate("sign in"))}>Passkey</button>
3
+ <button class="btn" @click=${()=>this.run(this.register())}>Register</button></div>
4
+ <p class="muted" role="status">${!R?"Not yet authenticated.":R.ok?`${R.purpose}: ok (${R.credentialId}) at ${R.at}`:`${R.purpose}: ${R.reason} at ${R.at}`}</p></div>`}}var $=(S=globalThis)=>{try{return S.location?.origin==="null"||!S.navigator?.credentials}catch{return!0}},E=q.namespace("example.originkey"),y=W(E.implementationId("passkey"),"A passkey for the origin this bundle is served from (run it home-origin).",()=>$());class L extends Z{register(){return J("nano origin-key",()=>$())}}var r={"example.originkey/passkey":"origin-key"};if(!customElements.get("origin-key"))customElements.define("origin-key",L);var s=E.provider([y]);export{r as views,$ as homeSandboxed,s as default,L as OriginKeyView};
5
+
6
+ export const built = {"@pritzlaff/nano-core":"0.5.1"}
@@ -0,0 +1 @@
1
+ <!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0}body{background:var(--bg);color:var(--fg);font-family:var(--font)}</style><script type="importmap">{"imports":{"@pritzlaff/nano-core":"./_nano/shared/nano-core.js","@pritzlaff/nano-elements":"./_nano/shared/nano-elements.js","lit":"./_nano/shared/lit.js","lit/decorators.js":"./_nano/shared/lit-decorators.js","lit/directive.js":"./_nano/shared/lit-directive.js","lit/directives/class-map.js":"./_nano/shared/lit-class-map.js","lit/directives/style-map.js":"./_nano/shared/lit-style-map.js","lit/directives/repeat.js":"./_nano/shared/lit-repeat.js","lit/directives/ref.js":"./_nano/shared/lit-ref.js","lit/directives/if-defined.js":"./_nano/shared/lit-if-defined.js","typebox":"./_nano/shared/typebox.js","typebox/value":"./_nano/shared/typebox-value.js","@pritzlaff/nano-ui":"./_nano/bundle/nano-ui.js"}}</script><script type="module" src="./_nano/sandbox/boot.js"></script></head><body></body></html>