overmux 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/auth/.vite/manifest.json +2 -2
- package/dist/auth/assets/{index-Bx8JhwVi.css → index-BM9gETvx.css} +1 -1
- package/dist/auth/assets/{index-CHIE7qYj.js → index-DabAfcs1.js} +1 -1
- package/dist/auth/index.html +2 -2
- package/dist/bin.js +430 -18
- package/dist/bin.js.map +1 -1
- package/dist/docs/200-getting-started/100-install-and-run-overmux.md +1 -2
- package/dist/docs/300-fundamentals/100-project-structure.md +20 -0
- package/dist/docs/300-fundamentals/300-theming.md +51 -0
- package/dist/docs/400-reference/100-configuration.md +20 -0
- package/dist/docs/400-reference/200-server-api.md +18 -0
- package/dist/docs/400-reference/300-client-api.md +36 -0
- package/dist/docs/400-reference/400-cli/050-init.md +17 -0
- package/dist/docs/400-reference/400-cli/350-instance.md +24 -0
- package/dist/exports/client.d.ts +33 -3
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +123 -14
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/{index-D3_Dpy_T.d.ts → index-DS70rKzo.d.ts} +14 -2
- package/dist/exports/index-DS70rKzo.d.ts.map +1 -0
- package/dist/exports/index.d.ts +2 -2
- package/dist/exports/index.js +1 -1
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/{notifications-kDp16bU_.js → notifications-av0FK0yZ.js} +7 -2
- package/dist/exports/{notifications-kDp16bU_.js.map → notifications-av0FK0yZ.js.map} +1 -1
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +52 -10
- package/dist/exports/server.js.map +1 -1
- package/dist/internal/server/coordinator/server-child.js +110 -46
- package/dist/internal/server/coordinator/server-child.js.map +1 -1
- package/docs/200-getting-started/100-install-and-run-overmux.md +1 -2
- package/docs/300-fundamentals/100-project-structure.md +20 -0
- package/docs/300-fundamentals/300-theming.md +51 -0
- package/docs/400-reference/100-configuration.md +20 -0
- package/docs/400-reference/200-server-api.md +18 -0
- package/docs/400-reference/300-client-api.md +36 -0
- package/docs/400-reference/400-cli/050-init.md +17 -0
- package/docs/400-reference/400-cli/350-instance.md +24 -0
- package/package.json +2 -2
- package/src/internal/cli/app.ts +7 -1
- package/src/internal/cli/commands/init-template.ts +146 -0
- package/src/internal/cli/commands/init.ts +267 -0
- package/src/internal/cli/commands/instance.ts +58 -0
- package/src/internal/cli/commands/integration.ts +15 -0
- package/src/internal/cli/commands/zellij-install.ts +96 -0
- package/src/internal/cli/parse-port.ts +2 -1
- package/src/internal/client/auth/auth-shell.css +17 -1
- package/src/internal/client/auth/auth-shell.tsx +2 -11
- package/src/internal/client/auth/login-code-input.tsx +140 -0
- package/src/internal/client/browser-api.ts +17 -3
- package/src/internal/client/clipboard.ts +22 -0
- package/src/internal/client/host/desktop-host.ts +15 -0
- package/src/internal/client/host/environment.ts +67 -0
- package/src/internal/client/host/instance-forwarding.ts +21 -0
- package/src/internal/client/host/notification-forwarding.ts +1 -10
- package/src/internal/client/host/overmux-host.tsx +8 -0
- package/src/internal/client/overmux-react.ts +24 -2
- package/src/internal/client/websocket.ts +48 -20
- package/src/internal/server/auth/instance-control.ts +24 -3
- package/src/internal/server/runtime/create-runtime.ts +12 -1
- package/src/internal/server/runtime/runtime-instance.ts +46 -0
- package/src/internal/server/runtime/runtime-resources.ts +3 -0
- package/src/internal/server/server-startup-options.ts +9 -4
- package/src/internal/server/start-application-server.ts +20 -12
- package/src/internal/server/websocket-server.ts +7 -0
- package/src/internal/shared/index.ts +2 -0
- package/src/internal/shared/protocol.ts +10 -1
- package/src/public/client.ts +5 -0
- package/src/public/config.ts +7 -0
- package/src/public/index.ts +2 -0
- package/dist/exports/index-D3_Dpy_T.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# overmux
|
|
2
2
|
|
|
3
|
+
## 0.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#121](https://github.com/richardgill/overmux/pull/121) [`c46e1ad`](https://github.com/richardgill/overmux/commit/c46e1ad74998fa132640138ea8c9c1c70ccda42d) Thanks [@richardgill](https://github.com/richardgill)! - Add startup-resolved instance identity, authenticated discovery, scoped server/browser helpers, reactive useInstance, and the overmux instance CLI command.
|
|
8
|
+
|
|
9
|
+
- [#119](https://github.com/richardgill/overmux/pull/119) [`e50c79f`](https://github.com/richardgill/overmux/commit/e50c79fd906d41c3ba8445da655a1075db5b6a93) Thanks [@richardgill](https://github.com/richardgill)! - Add public CSS host and platform selectors to the hosted application document, with native desktop metadata and live installed-app display-mode detection.
|
|
10
|
+
|
|
11
|
+
- [#125](https://github.com/richardgill/overmux/pull/125) [`d95b408`](https://github.com/richardgill/overmux/commit/d95b40895565a602e49f56fe755747c68f09b18a) Thanks [@richardgill](https://github.com/richardgill)! - Make login codes easier to enter with automatic uppercase grouping, optional-dash paste support, surrounding-whitespace trimming, and local validation.
|
|
12
|
+
|
|
13
|
+
## 0.0.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#118](https://github.com/richardgill/overmux/pull/118) [`78a3b8f`](https://github.com/richardgill/overmux/commit/78a3b8f9b143b8408989309bfaa399208daaa133) Thanks [@richardgill](https://github.com/richardgill)! - Catch up the initial patch release with init scaffolding, resilient terminal connections and tmux navigation, plus improved xterm links, clipboard support, and Unicode rendering. The Zellij integration remains an independent minor release and now requires the current Overmux peer version.
|
|
18
|
+
|
|
19
|
+
- [#117](https://github.com/richardgill/overmux/pull/117) [`d000b17`](https://github.com/richardgill/overmux/commit/d000b170d085f087e364672b3139b01e8fea1902) Thanks [@richardgill](https://github.com/richardgill)! - Scaffold AI agent guidance files when initializing an Overmux project.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`78a3b8f`](https://github.com/richardgill/overmux/commit/78a3b8f9b143b8408989309bfaa399208daaa133)]:
|
|
22
|
+
- @overmux/keybindings@0.0.3
|
|
23
|
+
|
|
3
24
|
## 0.0.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{color:#eee;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:#111;font:16px/1.5 system-ui,sans-serif}body{place-items:center;min-height:100vh;margin:0;display:grid}[data-om-auth-shell]{box-sizing:border-box;background:#191919;border:1px solid #444;border-radius:1rem;width:min(26rem,100vw - 3rem);padding:2rem}[data-om-auth-shell] h1{margin-top:0}[data-om-auth-shell] label{margin-bottom:.5rem;font-weight:600;display:block}[data-om-auth-shell] input,[data-om-auth-shell] button{box-sizing:border-box;width:100%;font:inherit;border-radius:.5rem;padding:.75rem}[data-om-auth-shell] input{color:inherit;letter-spacing:.
|
|
1
|
+
:root{color:#eee;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:#111;font:16px/1.5 system-ui,sans-serif}body{place-items:center;min-height:100vh;margin:0;display:grid}[data-om-auth-shell]{box-sizing:border-box;background:#191919;border:1px solid #444;border-radius:1rem;width:min(26rem,100vw - 3rem);padding:2rem}[data-om-auth-shell] h1{margin-top:0}[data-om-auth-shell] label{margin-bottom:.5rem;font-weight:600;display:block}[data-om-auth-shell] input,[data-om-auth-shell] button{box-sizing:border-box;width:100%;font:inherit;border-radius:.5rem;padding:.75rem}[data-om-auth-shell] input{color:inherit;letter-spacing:.12em;text-transform:uppercase;background:#111;border:1px solid #666;font-family:ui-monospace,monospace;font-size:1.25rem}[data-om-auth-shell] input[aria-invalid=true]{border-color:#ff9b9b}#auth-code-error{color:#ff9b9b;margin:0;font-size:.875rem}#auth-code-error:not(:empty){margin-top:.5rem}[data-om-auth-shell] button{color:#fff;cursor:pointer;background:#6d5dfc;border:0;margin-top:1rem;font-weight:700}[data-om-auth-shell] button:disabled{opacity:.6;cursor:wait}[data-om-auth-status]{min-height:1.5rem;margin-bottom:1rem}[data-om-auth-status=error]{color:#ff9b9b}
|
|
@@ -69,4 +69,4 @@ Error generating stack: `+e.message+`
|
|
|
69
69
|
|
|
70
70
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ne,s=!p.jitless,c=s&&re.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?$e([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function nt(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!O(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ge(e,r,m())))}),t)}var rt=u(`$ZodUnion`,(e,t)=>{A.init(e,t),x(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),x(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),x(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),x(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>y(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>nt(t,r,e,i)):nt(o,r,e,i)}}),it=u(`$ZodIntersection`,(e,t)=>{A.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ot(e,t,n)):ot(e,i,a)}});function at(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(w(e)&&w(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=at(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=at(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ot(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),O(e))return e;let o=at(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var st=u(`$ZodEnum`,(e,t)=>{A.init(e,t);let n=h(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ae.has(typeof e)).map(e=>typeof e==`string`?oe(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),ct=u(`$ZodTransform`,(e,t)=>{A.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new d;return n.value=i,n.fallback=!0,n}});function lt(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var ut=u(`$ZodOptional`,(e,t)=>{A.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,x(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),x(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>lt(e,r)):lt(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),dt=u(`$ZodExactOptional`,(e,t)=>{ut.init(e,t),x(e._zod,`values`,()=>t.innerType._zod.values),x(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ft=u(`$ZodNullable`,(e,t)=>{A.init(e,t),x(e._zod,`optin`,()=>t.innerType._zod.optin),x(e._zod,`optout`,()=>t.innerType._zod.optout),x(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)}|null)$`):void 0}),x(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),pt=u(`$ZodDefault`,(e,t)=>{A.init(e,t),e._zod.optin=`optional`,x(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>mt(e,t)):mt(r,t)}});function mt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ht=u(`$ZodPrefault`,(e,t)=>{A.init(e,t),e._zod.optin=`optional`,x(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),gt=u(`$ZodNonOptional`,(e,t)=>{A.init(e,t),x(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>_t(t,e)):_t(i,e)}});function _t(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var vt=u(`$ZodCatch`,(e,t)=>{A.init(e,t),e._zod.optin=`optional`,x(e._zod,`optout`,()=>t.innerType._zod.optout),x(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ge(e,n,m()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ge(e,n,m()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),yt=u(`$ZodPipe`,(e,t)=>{A.init(e,t),x(e._zod,`values`,()=>t.in._zod.values),x(e._zod,`optin`,()=>t.in._zod.optin),x(e._zod,`optout`,()=>t.out._zod.optout),x(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>bt(e,t.in,n)):bt(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>bt(e,t.out,n)):bt(r,t.out,n)}});function bt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var xt=u(`$ZodReadonly`,(e,t)=>{A.init(e,t),x(e._zod,`propValues`,()=>t.innerType._zod.propValues),x(e._zod,`values`,()=>t.innerType._zod.values),x(e._zod,`optin`,()=>t.innerType?._zod?.optin),x(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(St):St(r)}});function St(e){return e.value=Object.freeze(e.value),e}var Ct=u(`$ZodCustom`,(e,t)=>{ze.init(e,t),A.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>wt(t,n,r,e));wt(i,n,r,e)}});function wt(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ve(e))}}var Tt,Et=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Dt(){return new Et}(Tt=globalThis).__zod_globalRegistry??(Tt.__zod_globalRegistry=Dt());var Ot=globalThis.__zod_globalRegistry;function kt(e,t){return new e({type:`boolean`,...T(t)})}function At(e){return new e({type:`unknown`})}function jt(e,t){return new e({type:`never`,...T(t)})}function Mt(e,t){return new Be({check:`max_length`,...T(t),maximum:e})}function Nt(e,t){return new Ve({check:`min_length`,...T(t),minimum:e})}function Pt(e,t){return new He({check:`length_equals`,...T(t),length:e})}function Ft(e){return new Ue({check:`overwrite`,tx:e})}function It(e,t,n){return new e({type:`array`,element:t,...T(n)})}function Lt(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...T(n)})}function Rt(e,t){let n=zt(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ve(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ve(r))}},e(t.value,t)),t);return n}function zt(e,t){let n=new ze({check:`custom`,...T(t)});return n._zod.check=e,n}function Bt(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ot,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Vt(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Vt(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Wt(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ht(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
71
71
|
|
|
72
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ut(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Kt(t,`input`,e.processors),output:Kt(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Wt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Wt(r.element,n);if(r.type===`set`)return Wt(r.valueType,n);if(r.type===`lazy`)return Wt(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Wt(r.innerType,n);if(r.type===`intersection`)return Wt(r.left,n)||Wt(r.right,n);if(r.type===`record`||r.type===`map`)return Wt(r.keyType,n)||Wt(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Wt(r.in,n)||Wt(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Wt(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Wt(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Wt(e,n))return!0;return!!(r.rest&&Wt(r.rest,n))}return!1}var Gt=(e,t={})=>n=>{let r=Bt({...n,processors:t});return Vt(e,r),Ht(r,e),Ut(r,e)},Kt=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Bt({...i??{},target:a,io:t,processors:n});return Vt(e,o),Ht(o,e),Ut(o,e)},qt=(e,t,n,r)=>{n.type=`boolean`},Jt=(e,t,n,r)=>{n.not={}},Yt=(e,t,n,r)=>{let i=e._zod.def,a=h(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Xt=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Zt=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Qt=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Vt(a.element,t,{...r,path:[...r.path,`items`]})},$t=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Vt(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Vt(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},en=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Vt(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},tn=(e,t,n,r)=>{let i=e._zod.def,a=Vt(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Vt(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},nn=(e,t,n,r)=>{let i=e._zod.def,a=Vt(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},rn=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},an=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},on=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},sn=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},cn=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Vt(o,t,r);let s=t.seen.get(e);s.ref=o},ln=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},un=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},dn=u(`ZodError`,(e,t)=>{be.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ce(e,t)},flatten:{value:t=>Se(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,g,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,g,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),fn=we(dn),pn=Te(dn),mn=Ee(dn),hn=Oe(dn),gn=Ae(dn),_n=je(dn),vn=Me(dn),yn=Ne(dn),bn=Pe(dn),xn=Fe(dn),Sn=Ie(dn),Cn=Le(dn),wn=new WeakMap;function Tn(e,t,n){let r=Object.getPrototypeOf(e),i=wn.get(r);if(i||(i=new Set,wn.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var j=u(`ZodType`,(e,t)=>(A.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Kt(e,`input`),output:Kt(e,`output`)}}),e.toJSONSchema=Gt(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>fn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>mn(e,t,n),e.parseAsync=async(t,n)=>pn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>hn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>gn(e,t,n),e.decode=(t,n)=>_n(e,t,n),e.encodeAsync=async(t,n)=>vn(e,t,n),e.decodeAsync=async(t,n)=>yn(e,t,n),e.safeEncode=(t,n)=>bn(e,t,n),e.safeDecode=(t,n)=>xn(e,t,n),e.safeEncodeAsync=async(t,n)=>Sn(e,t,n),e.safeDecodeAsync=async(t,n)=>Cn(e,t,n),Tn(e,`ZodType`,{check(...e){let t=this.def;return this.clone(S(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return se(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lr(e,t))},superRefine(e,t){return this.check(ur(e,t))},overwrite(e){return this.check(Ft(e))},optional(){return Gn(this)},exactOptional(){return qn(this)},nullable(){return Yn(this)},nullish(){return Gn(Yn(this))},nonoptional(e){return tr(this,e)},array(){return Nn(this)},or(e){return Ln([this,e])},and(e){return zn(this,e)},transform(e){return ar(this,Un(e))},default(e){return Zn(this,e)},prefault(e){return $n(this,e)},catch(e){return rr(this,e)},pipe(e){return ar(this,e)},readonly(){return sr(this)},describe(e){let t=this.clone();return Ot.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ot.get(this);let t=this.clone();return Ot.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Ot.get(e)?.description},configurable:!0}),e)),En=u(`ZodBoolean`,(e,t)=>{Ke.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qt(e,t,n,r)});function Dn(e){return kt(En,e)}var On=u(`ZodUnknown`,(e,t)=>{qe.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function kn(){return At(On)}var An=u(`ZodNever`,(e,t)=>{Je.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jt(e,t,n,r)});function jn(e){return jt(An,e)}var Mn=u(`ZodArray`,(e,t)=>{Xe.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qt(e,t,n,r),e.element=t.element,Tn(e,`ZodArray`,{min(e,t){return this.check(Nt(e,t))},nonempty(e){return this.check(Nt(1,e))},max(e,t){return this.check(Mt(e,t))},length(e,t){return this.check(Pt(e,t))},unwrap(){return this.element}})});function Nn(e,t){return It(Mn,e,t)}var Pn=u(`ZodObject`,(e,t)=>{tt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$t(e,t,n,r),x(e,`shape`,()=>t.shape),Tn(e,`ZodObject`,{keyof(){return Vn(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:kn()})},loose(){return this.clone({...this._zod.def,catchall:kn()})},strict(){return this.clone({...this._zod.def,catchall:jn()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return D(this,e)},safeExtend(e){return ue(this,e)},merge(e){return de(this,e)},pick(e){return le(this,e)},omit(e){return E(this,e)},partial(...e){return fe(Wn,this,e[0])},required(...e){return pe(er,this,e[0])}})});function Fn(e,t){return new Pn({type:`object`,shape:e??{},...T(t)})}var In=u(`ZodUnion`,(e,t)=>{rt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>en(e,t,n,r),e.options=t.options});function Ln(e,t){return new In({type:`union`,options:e,...T(t)})}var Rn=u(`ZodIntersection`,(e,t)=>{it.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tn(e,t,n,r)});function zn(e,t){return new Rn({type:`intersection`,left:e,right:t})}var Bn=u(`ZodEnum`,(e,t)=>{st.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yt(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Bn({...t,checks:[],...T(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Bn({...t,checks:[],...T(r),entries:i})}});function Vn(e,t){return new Bn({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...T(t)})}var Hn=u(`ZodTransform`,(e,t)=>{ct.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zt(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ve(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ve(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Un(e){return new Hn({type:`transform`,transform:e})}var Wn=u(`ZodOptional`,(e,t)=>{ut.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>un(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gn(e){return new Wn({type:`optional`,innerType:e})}var Kn=u(`ZodExactOptional`,(e,t)=>{dt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>un(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qn(e){return new Kn({type:`optional`,innerType:e})}var Jn=u(`ZodNullable`,(e,t)=>{ft.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yn(e){return new Jn({type:`nullable`,innerType:e})}var Xn=u(`ZodDefault`,(e,t)=>{pt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>an(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Zn(e,t){return new Xn({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var Qn=u(`ZodPrefault`,(e,t)=>{ht.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>on(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $n(e,t){return new Qn({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var er=u(`ZodNonOptional`,(e,t)=>{gt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tr(e,t){return new er({type:`nonoptional`,innerType:e,...T(t)})}var nr=u(`ZodCatch`,(e,t)=>{vt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rr(e,t){return new nr({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var ir=u(`ZodPipe`,(e,t)=>{yt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cn(e,t,n,r),e.in=t.in,e.out=t.out});function ar(e,t){return new ir({type:`pipe`,in:e,out:t})}var or=u(`ZodReadonly`,(e,t)=>{xt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ln(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sr(e){return new or({type:`readonly`,innerType:e})}var cr=u(`ZodCustom`,(e,t)=>{Ct.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xt(e,t,n,r)});function lr(e,t={}){return Lt(cr,e,t)}function ur(e,t){return Rt(e,t)}var dr=i(),fr=c(),pr=Fn({authenticated:Dn()}),mr=Fn({status:Vn([`expired`,`invalid`,`rate-limited`])}),hr=async e=>{try{return await e.json()}catch{return}},gr=async e=>{let t=await fetch(`/api/auth/state`,{cache:`no-store`,signal:e}),n=pr.safeParse(await hr(t));if(!t.ok||!n.success)throw Error(`Authentication state request failed`);return n.data},_r=async(e,t)=>{let n=await fetch(`/api/auth/login`,{body:JSON.stringify(e),credentials:`same-origin`,headers:{"content-type":`application/json`},method:`POST`,signal:t});if(n.ok)return{status:`authenticated`};let r=mr.safeParse(await hr(n));return r.success?r.data:{status:`unknown`}},vr=e((e=>{var t=Symbol.for(`react.transitional.element`);function n(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.jsx=n,e.jsxs=n})),yr=e(((e,t)=>{t.exports=vr()}))(),br={expired:`That login grant has expired. Generate a new one.`,invalid:`That login code or link is invalid.`,pending:`Signing in…`,"rate-limited":`Too many attempts. Wait a moment and try again.`,"server-unavailable":`The server is unavailable.`,"session-expired":`Your session expired or was revoked. Sign in again.`},xr=()=>new URLSearchParams(window.location.search).get(`reason`)===`session-expired`?`session-expired`:`idle`,Sr=e=>{e.current?.abort();let t=new AbortController;return e.current=t,t},Cr=async({input:e,setStatus:t,signal:n})=>{t(`pending`);try{let r=await _r(e,n);if(n.aborted)return;if(r.status===`authenticated`){window.location.replace(`/`);return}t(r.status===`unknown`?`server-unavailable`:r.status)}catch{n.aborted||t(`server-unavailable`)}},wr=e=>e!==`idle`&&e!==`pending`,Tr=e=>{let[t,n]=(0,dr.useState)(xr),r=(0,dr.useRef)(void 0),i=(0,dr.useCallback)(e=>{let t=Sr(r);Cr({input:e,setStatus:n,signal:t.signal})},[]);return(0,dr.useEffect)(()=>{if(e)return i({ticket:e}),()=>r.current?.abort();let t=Sr(r);return gr(t.signal).then(e=>{!t.signal.aborted&&e.authenticated&&window.location.replace(`/`)},()=>{t.signal.aborted||n(`server-unavailable`)}),()=>r.current?.abort()},[i,e]),{authenticate:i,status:t}},Er=({ticket:e})=>{let{authenticate:t,status:n}=Tr(e),r=e=>{e.preventDefault();let n=new FormData(e.currentTarget).get(`code`);typeof n==`string`&&t({code:n})},i=n===`idle`?void 0:br[n],a=n===`pending`;return(0,yr.jsxs)(`main`,{"aria-labelledby":`auth-title`,"data-om-auth-shell":``,children:[(0,yr.jsx)(`h1`,{id:`auth-title`,children:`Overmux is locked`}),(0,yr.jsxs)(`p`,{children:[`Generate a login code on the server with `,(0,yr.jsx)(`code`,{children:`overmux auth login`}),`.`]}),(0,yr.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,"data-om-auth-status":wr(n)?`error`:``,id:`auth-status`,role:`status`,children:i}),(0,yr.jsxs)(`form`,{"aria-busy":a,onSubmit:r,children:[(0,yr.jsx)(`label`,{htmlFor:`auth-code`,children:`Login code`}),(0,yr.jsx)(`input`,{"aria-describedby":`auth-status`,autoCapitalize:`characters`,autoComplete:`one-time-code`,disabled:a,id:`auth-code`,name:`code`,pattern:`[A-Za-z0-9]{4}-[A-Za-z0-9]{4}`,required:!0,spellCheck:!1}),(0,yr.jsx)(`button`,{disabled:a,type:`submit`,children:`Unlock Overmux`})]})]})},Dr=()=>{let e=new URLSearchParams(window.location.hash.slice(1)).get(`ticket`);return e&&window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}`),e??void 0},Or=document.querySelector(`#root`);if(!Or)throw Error(`The Overmux authentication shell requires a #root element`);(0,fr.createRoot)(Or).render((0,yr.jsx)(Er,{ticket:Dr()}));
|
|
72
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ut(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Kt(t,`input`,e.processors),output:Kt(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Wt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Wt(r.element,n);if(r.type===`set`)return Wt(r.valueType,n);if(r.type===`lazy`)return Wt(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Wt(r.innerType,n);if(r.type===`intersection`)return Wt(r.left,n)||Wt(r.right,n);if(r.type===`record`||r.type===`map`)return Wt(r.keyType,n)||Wt(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Wt(r.in,n)||Wt(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Wt(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Wt(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Wt(e,n))return!0;return!!(r.rest&&Wt(r.rest,n))}return!1}var Gt=(e,t={})=>n=>{let r=Bt({...n,processors:t});return Vt(e,r),Ht(r,e),Ut(r,e)},Kt=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Bt({...i??{},target:a,io:t,processors:n});return Vt(e,o),Ht(o,e),Ut(o,e)},qt=(e,t,n,r)=>{n.type=`boolean`},Jt=(e,t,n,r)=>{n.not={}},Yt=(e,t,n,r)=>{let i=e._zod.def,a=h(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Xt=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Zt=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Qt=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Vt(a.element,t,{...r,path:[...r.path,`items`]})},$t=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Vt(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Vt(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},en=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Vt(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},tn=(e,t,n,r)=>{let i=e._zod.def,a=Vt(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Vt(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},nn=(e,t,n,r)=>{let i=e._zod.def,a=Vt(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},rn=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},an=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},on=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},sn=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},cn=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Vt(o,t,r);let s=t.seen.get(e);s.ref=o},ln=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},un=(e,t,n,r)=>{let i=e._zod.def;Vt(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},dn=u(`ZodError`,(e,t)=>{be.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ce(e,t)},flatten:{value:t=>Se(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,g,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,g,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),fn=we(dn),pn=Te(dn),mn=Ee(dn),hn=Oe(dn),gn=Ae(dn),_n=je(dn),vn=Me(dn),yn=Ne(dn),bn=Pe(dn),xn=Fe(dn),Sn=Ie(dn),Cn=Le(dn),wn=new WeakMap;function Tn(e,t,n){let r=Object.getPrototypeOf(e),i=wn.get(r);if(i||(i=new Set,wn.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var j=u(`ZodType`,(e,t)=>(A.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Kt(e,`input`),output:Kt(e,`output`)}}),e.toJSONSchema=Gt(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>fn(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>mn(e,t,n),e.parseAsync=async(t,n)=>pn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>hn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>gn(e,t,n),e.decode=(t,n)=>_n(e,t,n),e.encodeAsync=async(t,n)=>vn(e,t,n),e.decodeAsync=async(t,n)=>yn(e,t,n),e.safeEncode=(t,n)=>bn(e,t,n),e.safeDecode=(t,n)=>xn(e,t,n),e.safeEncodeAsync=async(t,n)=>Sn(e,t,n),e.safeDecodeAsync=async(t,n)=>Cn(e,t,n),Tn(e,`ZodType`,{check(...e){let t=this.def;return this.clone(S(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return se(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lr(e,t))},superRefine(e,t){return this.check(ur(e,t))},overwrite(e){return this.check(Ft(e))},optional(){return Gn(this)},exactOptional(){return qn(this)},nullable(){return Yn(this)},nullish(){return Gn(Yn(this))},nonoptional(e){return tr(this,e)},array(){return Nn(this)},or(e){return Ln([this,e])},and(e){return zn(this,e)},transform(e){return ar(this,Un(e))},default(e){return Zn(this,e)},prefault(e){return $n(this,e)},catch(e){return rr(this,e)},pipe(e){return ar(this,e)},readonly(){return sr(this)},describe(e){let t=this.clone();return Ot.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ot.get(this);let t=this.clone();return Ot.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Ot.get(e)?.description},configurable:!0}),e)),En=u(`ZodBoolean`,(e,t)=>{Ke.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qt(e,t,n,r)});function Dn(e){return kt(En,e)}var On=u(`ZodUnknown`,(e,t)=>{qe.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function kn(){return At(On)}var An=u(`ZodNever`,(e,t)=>{Je.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jt(e,t,n,r)});function jn(e){return jt(An,e)}var Mn=u(`ZodArray`,(e,t)=>{Xe.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qt(e,t,n,r),e.element=t.element,Tn(e,`ZodArray`,{min(e,t){return this.check(Nt(e,t))},nonempty(e){return this.check(Nt(1,e))},max(e,t){return this.check(Mt(e,t))},length(e,t){return this.check(Pt(e,t))},unwrap(){return this.element}})});function Nn(e,t){return It(Mn,e,t)}var Pn=u(`ZodObject`,(e,t)=>{tt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$t(e,t,n,r),x(e,`shape`,()=>t.shape),Tn(e,`ZodObject`,{keyof(){return Vn(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:kn()})},loose(){return this.clone({...this._zod.def,catchall:kn()})},strict(){return this.clone({...this._zod.def,catchall:jn()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return D(this,e)},safeExtend(e){return ue(this,e)},merge(e){return de(this,e)},pick(e){return le(this,e)},omit(e){return E(this,e)},partial(...e){return fe(Wn,this,e[0])},required(...e){return pe(er,this,e[0])}})});function Fn(e,t){return new Pn({type:`object`,shape:e??{},...T(t)})}var In=u(`ZodUnion`,(e,t)=>{rt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>en(e,t,n,r),e.options=t.options});function Ln(e,t){return new In({type:`union`,options:e,...T(t)})}var Rn=u(`ZodIntersection`,(e,t)=>{it.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tn(e,t,n,r)});function zn(e,t){return new Rn({type:`intersection`,left:e,right:t})}var Bn=u(`ZodEnum`,(e,t)=>{st.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yt(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Bn({...t,checks:[],...T(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Bn({...t,checks:[],...T(r),entries:i})}});function Vn(e,t){return new Bn({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...T(t)})}var Hn=u(`ZodTransform`,(e,t)=>{ct.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zt(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ve(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ve(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Un(e){return new Hn({type:`transform`,transform:e})}var Wn=u(`ZodOptional`,(e,t)=>{ut.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>un(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gn(e){return new Wn({type:`optional`,innerType:e})}var Kn=u(`ZodExactOptional`,(e,t)=>{dt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>un(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qn(e){return new Kn({type:`optional`,innerType:e})}var Jn=u(`ZodNullable`,(e,t)=>{ft.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yn(e){return new Jn({type:`nullable`,innerType:e})}var Xn=u(`ZodDefault`,(e,t)=>{pt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>an(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Zn(e,t){return new Xn({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var Qn=u(`ZodPrefault`,(e,t)=>{ht.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>on(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $n(e,t){return new Qn({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var er=u(`ZodNonOptional`,(e,t)=>{gt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tr(e,t){return new er({type:`nonoptional`,innerType:e,...T(t)})}var nr=u(`ZodCatch`,(e,t)=>{vt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sn(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rr(e,t){return new nr({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var ir=u(`ZodPipe`,(e,t)=>{yt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cn(e,t,n,r),e.in=t.in,e.out=t.out});function ar(e,t){return new ir({type:`pipe`,in:e,out:t})}var or=u(`ZodReadonly`,(e,t)=>{xt.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ln(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sr(e){return new or({type:`readonly`,innerType:e})}var cr=u(`ZodCustom`,(e,t)=>{Ct.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xt(e,t,n,r)});function lr(e,t={}){return Lt(cr,e,t)}function ur(e,t){return Rt(e,t)}var dr=i(),fr=c(),pr=Fn({authenticated:Dn()}),mr=Fn({status:Vn([`expired`,`invalid`,`rate-limited`])}),hr=async e=>{try{return await e.json()}catch{return}},gr=async e=>{let t=await fetch(`/api/auth/state`,{cache:`no-store`,signal:e}),n=pr.safeParse(await hr(t));if(!t.ok||!n.success)throw Error(`Authentication state request failed`);return n.data},_r=async(e,t)=>{let n=await fetch(`/api/auth/login`,{body:JSON.stringify(e),credentials:`same-origin`,headers:{"content-type":`application/json`},method:`POST`,signal:t});if(n.ok)return{status:`authenticated`};let r=mr.safeParse(await hr(n));return r.success?r.data:{status:`unknown`}},vr=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),yr=e(((e,t)=>{t.exports=vr()}))(),br=8,xr=`Enter 8 letters or numbers, with no spaces inside the code.`,Sr=e=>{let t=e.trim(),n=t.replace(`-`,``);if(!/^[A-Za-z0-9]*$/.test(n))return t;let r=n.slice(0,br).toUpperCase();return r.length<4?r:`${r.slice(0,4)}-${r.slice(4)}`},Cr=e=>{let{value:t,selectionStart:n,selectionEnd:r,selectionDirection:i}=e,a=Sr(t);if(a===t)return;let o=Sr(t.slice(0,n??t.length)).length,s=Sr(t.slice(0,r??t.length)).length;e.value=a,e.setSelectionRange(o,s,i??void 0)},wr=e=>{e.preventDefault();let t=e.currentTarget,n=e.clipboardData.getData(`text/plain`).trim().replace(/[\r\n]/g,` `),r=n.length>=br,i=r?0:t.selectionStart??0,a=r?t.value.length:t.selectionEnd??0;return(t.value.slice(0,i)+n+t.value.slice(a)).trim().replace(`-`,``).length>br?(t.setCustomValidity(xr),!1):(t.setCustomValidity(``),t.setRangeText(n,i,a,`end`),Cr(t),!0)},Tr=e=>{let t=e.currentTarget,n=t.selectionStart;e.ctrlKey||e.metaKey||e.altKey||n!==t.selectionEnd||t.value[4]!==`-`||(e.key===`-`&&(n===4||n===5)&&(e.preventDefault(),t.setSelectionRange(5,5)),e.key===`Backspace`&&n===5&&(e.preventDefault(),t.setRangeText(``,3,5,`end`),Cr(t)),e.key===`Delete`&&n===4&&(e.preventDefault(),t.setRangeText(``,4,Math.min(6,t.value.length),`end`),Cr(t)))},Er=({disabled:e})=>{let[t,n]=(0,dr.useState)(!1);return(0,yr.jsxs)(yr.Fragment,{children:[(0,yr.jsx)(`input`,{"aria-describedby":`auth-code-error auth-status`,"aria-invalid":t||void 0,autoCapitalize:`characters`,autoComplete:`one-time-code`,disabled:e,id:`auth-code`,maxLength:9,name:`code`,onBlur:e=>Cr(e.currentTarget),onInput:e=>{e.currentTarget.setCustomValidity(``),/\s$/.test(e.currentTarget.value)||Cr(e.currentTarget),n(!1)},onInvalid:()=>n(!0),onKeyDown:e=>{e.key===`Enter`&&Cr(e.currentTarget),Tr(e),e.defaultPrevented&&(e.currentTarget.setCustomValidity(``),n(!1))},onPaste:e=>n(!wr(e)),pattern:`[A-Za-z0-9]{4}-[A-Za-z0-9]{4}`,placeholder:`XXXX-XXXX`,required:!0,spellCheck:!1,type:`text`}),(0,yr.jsx)(`p`,{"aria-live":`polite`,id:`auth-code-error`,children:t?xr:void 0})]})},Dr={expired:`That login grant has expired. Generate a new one.`,invalid:`That login code or link is invalid.`,pending:`Signing in…`,"rate-limited":`Too many attempts. Wait a moment and try again.`,"server-unavailable":`The server is unavailable.`,"session-expired":`Your session expired or was revoked. Sign in again.`},Or=()=>new URLSearchParams(window.location.search).get(`reason`)===`session-expired`?`session-expired`:`idle`,kr=e=>{e.current?.abort();let t=new AbortController;return e.current=t,t},Ar=async({input:e,setStatus:t,signal:n})=>{t(`pending`);try{let r=await _r(e,n);if(n.aborted)return;if(r.status===`authenticated`){window.location.replace(`/`);return}t(r.status===`unknown`?`server-unavailable`:r.status)}catch{n.aborted||t(`server-unavailable`)}},jr=e=>e!==`idle`&&e!==`pending`,Mr=e=>{let[t,n]=(0,dr.useState)(Or),r=(0,dr.useRef)(void 0),i=(0,dr.useCallback)(e=>{let t=kr(r);Ar({input:e,setStatus:n,signal:t.signal})},[]);return(0,dr.useEffect)(()=>{if(e)return i({ticket:e}),()=>r.current?.abort();let t=kr(r);return gr(t.signal).then(e=>{!t.signal.aborted&&e.authenticated&&window.location.replace(`/`)},()=>{t.signal.aborted||n(`server-unavailable`)}),()=>r.current?.abort()},[i,e]),{authenticate:i,status:t}},Nr=({ticket:e})=>{let{authenticate:t,status:n}=Mr(e),r=e=>{e.preventDefault();let n=new FormData(e.currentTarget).get(`code`);typeof n==`string`&&t({code:n})},i=n===`idle`?void 0:Dr[n],a=n===`pending`;return(0,yr.jsxs)(`main`,{"aria-labelledby":`auth-title`,"data-om-auth-shell":``,children:[(0,yr.jsx)(`h1`,{id:`auth-title`,children:`Overmux is locked`}),(0,yr.jsxs)(`p`,{children:[`Generate a login code on the server with `,(0,yr.jsx)(`code`,{children:`overmux auth login`}),`.`]}),(0,yr.jsx)(`p`,{"aria-atomic":`true`,"aria-live":`polite`,"data-om-auth-status":jr(n)?`error`:``,id:`auth-status`,role:`status`,children:i}),(0,yr.jsxs)(`form`,{"aria-busy":a,onSubmit:r,children:[(0,yr.jsx)(`label`,{htmlFor:`auth-code`,children:`Login code`}),(0,yr.jsx)(Er,{disabled:a}),(0,yr.jsx)(`button`,{disabled:a,type:`submit`,children:`Unlock Overmux`})]})]})},Pr=()=>{let e=new URLSearchParams(window.location.hash.slice(1)).get(`ticket`);return e&&window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}`),e??void 0},Fr=document.querySelector(`#root`);if(!Fr)throw Error(`The Overmux authentication shell requires a #root element`);(0,fr.createRoot)(Fr).render((0,yr.jsx)(Nr,{ticket:Pr()}));
|
package/dist/auth/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="color-scheme" content="dark light" />
|
|
7
7
|
<title>Overmux authentication</title>
|
|
8
|
-
<script type="module" crossorigin src="/_overmux/auth-shell/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/_overmux/auth-shell/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/_overmux/auth-shell/assets/index-DabAfcs1.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/_overmux/auth-shell/assets/index-BM9gETvx.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|