@deslop/auth 0.0.0-stage → 0.1.1222
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/README.md +27 -2
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/assets/(home)-NHb_Ahgp.js +20 -0
- package/dist/client/assets/client-c9qebYWa.js +19 -0
- package/dist/client/assets/components-CRByL0Z7.js +1 -0
- package/dist/client/assets/firefox-5m8yovBp.svg +1 -0
- package/dist/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/client/assets/icon-Dd-FeRxo.svg +1 -0
- package/dist/client/assets/icon-dark-zztc3HXC.svg +1 -0
- package/dist/client/assets/index-C0ARHuy4.css +2 -0
- package/dist/client/assets/index-JMt3-1H2.js +10 -0
- package/dist/client/assets/people-CgLToDcz.js +1 -0
- package/dist/client/assets/rolldown-runtime-WkwZ5CU-.js +1 -0
- package/dist/client/assets/route-B8jHT5cF.js +1 -0
- package/dist/client/assets/safari-DgmPRf57.svg +1 -0
- package/dist/client/index.html +26 -0
- package/dist/server.js +99068 -0
- package/package.json +35 -5
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Deslop Auth
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The shared sign-in server: an OAuth 2.1 authorization server for every Deslop app and MCP server, with GitHub and code sign-ins.
|
|
4
|
+
|
|
5
|
+
## Sign-ins
|
|
6
|
+
|
|
7
|
+
Every sign-in is one waiting code, approved from a signed-in browser, a phone or an agent's `answer_request`, and delivered once at `/auth/continue` to the browser or command holding its cookie.
|
|
8
|
+
|
|
9
|
+
| Signs in | Gets | Approved by |
|
|
10
|
+
| ------------------------------- | -------------------------------- | ---------------------------------- |
|
|
11
|
+
| App or harness | OAuth code at its callback | Browser, phone or `answer_request` |
|
|
12
|
+
| **Sign in with a code** browser | 30-day session, back to its page | A signed-in browser only |
|
|
13
|
+
| GitHub | One-year session | GitHub |
|
|
14
|
+
|
|
15
|
+
- **Waiting page** shows a QR code and the code; leave it open in the client's browser, which completes the localhost callback, never on the phone.
|
|
16
|
+
- **Lifetime**: 10 minutes, in memory; a restart ends the waiting ones. Workers' harness steps: environment skill, Maintenance.
|
|
17
|
+
- **Clients**: the id is the encoded registration, so registering stores nothing. The signed-in list shows `Client · Device`: a known worker, the User-Agent's platform, or the address.
|
|
18
|
+
- **Without `--auth`**, as in a preview, **Sign in with GitHub** returns at once as `dev` (`github:0`), an admin unless `--admins` says otherwise; the session stays on the preview's host. Every other app without `--auth` needs no sign-in.
|
|
19
|
+
- **Sign out** from any app's account menu arrives at `/?sign-out`, which ends the shared session and returns to that app.
|
|
20
|
+
- **Settings**: `--admins` and `--github-client-id` flags; `GITHUB_CLIENT_SECRET` in `~/.deslop/auth.env`.
|
|
21
|
+
- **Storage**: signed-in apps and browsers in its data directory; authorization codes in memory.
|
|
22
|
+
- **Rate limit**: registration, authorization, token, revocation, GitHub and code sign-in requests have a per-minute budget per address (IPv6 /64), 429 past it.
|
|
23
|
+
|
|
24
|
+
## MCP
|
|
25
|
+
|
|
26
|
+
- **Discovery**: each Deslop MCP server's `/.well-known/oauth-protected-resource/mcp` names Auth; no credentials → 401 challenge; rejected bearer → `error="invalid_token"`; Auth down → 503 with `Retry-After`.
|
|
27
|
+
- **Stored credentials prove nothing**: check the client's MCP status and tool discovery. `OAuth authorization required` at startup, or after an auth-store reset: sign the client in to the gateway again.
|
|
28
|
+
- **`answer_request`**: `https://auth.mp281x.xyz/mcp`'s one tool, reached through the [gateway](../gateway/README.md) as `auth__answer_request`.
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{Ct as t,Ea as n,Eo as r,G as i,Ha as a,K as o,Ko as s,Tt as c,U as l,Va as u,eo as d,io as f,lo as p,oo as m,pa as h,so as g,tt as _,wt as v}from"./client-c9qebYWa.js";import{C as y,Cn as b,In as x,Ln as S,Mn as C,Nn as w,Pn as T,Vn as E,c as D,f as O,i as k,n as A,u as j,xn as M,y as N,zn as P}from"./components-CRByL0Z7.js";var F={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};F.node;var I=i(F),L={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};L.node;var R=i(L),z=e(s(),1),B=e=>{let n=H(z.useMemo(()=>V(e.machine,e.path),[e.machine,e.path]));if(t(n))throw h(n.cause);return v(n)?e.pending??null:f(n.value)?e.children(n.value.value):e.inactive??null},V=(e,t)=>C(e)?w(e,t):T(e,t),H=e=>ee(z.useContext(P),e),ee=(e,t)=>{let n=z.useMemo(()=>{let n,r,i=e=>c(e)?(n=e,e):v(e)&&n!==void 0?n:e;return{subscribe:n=>e.subscribe(t,n),snapshot:()=>i(e.get(t)),serverSnapshot:()=>r??=i(_(t,e))}},[e,t]);return z.useSyncExternalStore(n.subscribe,n.snapshot,n.serverSnapshot)},U=B,W=o(),G=Object.defineProperty,K=Object.defineProperties,te=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,J=(e,t,n)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ie=(e,t)=>{for(var n in t||={})ne.call(t,n)&&J(e,n,t[n]);if(q)for(var n of q(t))re.call(t,n)&&J(e,n,t[n]);return e},ae=(e,t)=>K(e,te(t)),oe=(e,t)=>{var n={};for(var r in e)ne.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&q)for(var r of q(e))t.indexOf(r)<0&&re.call(e,r)&&(n[r]=e[r]);return n};function se(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}function ce(e){let t=z.useRef();return z.useEffect(()=>{t.current=e}),t.current}var le=18,Y=40,ue=`${Y}px`;function X(e){let t=e.getBoundingClientRect().right,n=e;for(;n;){if(getComputedStyle(n).overflowX!==`visible`)return n.getBoundingClientRect().left+n.clientLeft+n.clientWidth-t;n=n.parentElement}return document.documentElement.clientWidth-t}var de=`[data-lastpass-icon-root],com-1password-button,[data-dashlanecreated],[style$="2147483647 !important;"]`;function fe({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[i,a]=z.useState(!1),[o,s]=z.useState(!1),[c,l]=z.useState(!1),u=z.useMemo(()=>n!==`none`&&(n===`increase-width`||n===`experimental-no-flickering`)&&i&&o,[i,o,n]),d=z.useCallback(()=>{let r=e.current,i=t.current;if(!r||!i||c||n===`none`)return;let o=r,u=o.getBoundingClientRect().left+o.offsetWidth,d=o.getBoundingClientRect().top+o.offsetHeight/2,f=u-le,p=d;document.querySelectorAll(de).length===0&&document.elementFromPoint(f,p)===r||(s(X(r)>=Y),a(!0),l(!0))},[e,t,c,n]);return z.useEffect(()=>{let t=e.current;if(!t||n===`none`)return;function r(){s(X(t)>=Y)}r();let i=setInterval(r,1e3);return()=>{clearInterval(i)}},[e,n]),z.useEffect(()=>{let e=r||document.activeElement===t.current;if(n===`none`||!e)return;let i=setTimeout(d,0),a=setTimeout(d,2e3),o=setTimeout(d,5e3),s=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(i),clearTimeout(a),clearTimeout(o),clearTimeout(s)}},[t,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:ue}}var pe=z.createContext({}),me=z.forwardRef((e,t)=>{var n=e,{value:r,onChange:i,maxLength:a,textAlign:o=`left`,pattern:s,placeholder:c,inputMode:l=`numeric`,onComplete:u,pushPasswordManagerStrategy:d=`increase-width`,pasteTransformer:f,containerClassName:p,noScriptCSSFallback:m=he,nonce:h,render:g,children:_}=n,v=oe(n,[`value`,`onChange`,`maxLength`,`textAlign`,`pattern`,`placeholder`,`inputMode`,`onComplete`,`pushPasswordManagerStrategy`,`pasteTransformer`,`containerClassName`,`noScriptCSSFallback`,`nonce`,`render`,`children`]),y;let[b,x]=z.useState(typeof v.defaultValue==`string`?v.defaultValue:``),S=r??b,C=ce(S),w=z.useCallback(e=>{i?.(e),x(e)},[i]),T=z.useMemo(()=>s?typeof s==`string`?new RegExp(s):s:null,[s]),E=z.useRef(null),D=z.useRef(null),O=z.useRef({value:S,onChange:w,isIOS:typeof window<`u`&&((y=window==null?void 0:window.CSS)?.supports)?.call(y,`-webkit-touch-callout`,`none`)}),k=z.useRef({prev:[E.current?.selectionStart,E.current?.selectionEnd,E.current?.selectionDirection]});z.useImperativeHandle(t,()=>E.current,[]),z.useEffect(()=>{let e=E.current,t=D.current;if(!e||!t)return;O.current.value!==e.value&&O.current.onChange(e.value),k.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection];function n(){if(document.activeElement!==e){F(null),L(null);return}let t=e.selectionStart,n=e.selectionEnd,r=e.selectionDirection,i=e.maxLength,a=e.value,o=k.current.prev,s=-1,c=-1,l;if(a.length!==0&&t!==null&&n!==null){let r=t===n,u=t===a.length&&a.length<i;if(r&&!u){let e=t;if(e===0)s=0,c=1,l=`forward`;else if(e===i)s=e-1,c=e,l=`backward`;else if(i>1&&a.length>1){let t=0;if(o[0]!==null&&o[1]!==null){l=e<o[1]?`backward`:`forward`;let n=o[0]===o[1]&&o[0]<i;l===`backward`&&!n&&(t=-1)}s=t+e,c=t+e+1}}s!==-1&&c!==-1&&s!==c&&e.setSelectionRange(s,c,l)}let u=s===-1?t:s,d=c===-1?n:c,f=l??r;F(u),L(d),k.current.prev=[u,d,f]}if(document.addEventListener(`selectionchange`,n,{capture:!0}),n(),document.activeElement===e&&N(!0),!document.getElementById(`input-otp-style`)){let e=document.createElement(`style`);if(e.id=`input-otp-style`,h&&e.setAttribute(`nonce`,h),document.head.appendChild(e),e.sheet){let t=`background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;`;Z(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),Z(e.sheet,`[data-input-otp]:autofill { ${t} }`),Z(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),Z(e.sheet,`@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }`),Z(e.sheet,`[data-input-otp] + * { pointer-events: all !important; }`)}}let r=()=>{t&&t.style.setProperty(`--root-height`,`${e.clientHeight}px`)};r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(e),()=>{document.removeEventListener(`selectionchange`,n,{capture:!0}),i?.disconnect()}},[]);let[A,j]=z.useState(!1),[M,N]=z.useState(!1),[P,F]=z.useState(null),[I,L]=z.useState(null);z.useEffect(()=>{let e=se(()=>{var e;(e=E.current)==null||e.dispatchEvent(new Event(`input`));let t=E.current?.selectionStart,n=E.current?.selectionEnd,r=E.current?.selectionDirection;t!==null&&n!==null&&(F(t),L(n),k.current.prev=[t,n,r])});return()=>{e.forEach(e=>clearTimeout(e))}},[S,M]),z.useEffect(()=>{C!==void 0&&S!==C&&C.length<a&&S.length===a&&u?.(S)},[a,u,C,S]);let R=fe({containerRef:D,inputRef:E,pushPasswordManagerStrategy:d,isFocused:M}),B=z.useCallback(e=>{let t=e.currentTarget.value.slice(0,a);t.length>0&&T&&!T.test(t)?e.preventDefault():(typeof C==`string`&&t.length<C.length&&document.dispatchEvent(new Event(`selectionchange`)),w(t))},[a,w,C,T]),V=z.useCallback(()=>{var e;if(E.current){let t=Math.min(E.current.value.length,a-1),n=E.current.value.length;(e=E.current)==null||e.setSelectionRange(t,n),F(t),L(n)}N(!0)},[a]),H=z.useCallback(e=>{let t=E.current;if(!f&&(!O.current.isIOS||!e.clipboardData||!t))return;let n=e.clipboardData.getData(`text/plain`),r=f?f(n):n;e.preventDefault();let i=E.current?.selectionStart,o=E.current?.selectionEnd,s=(i===o?S.slice(0,i)+r+S.slice(i):S.slice(0,i)+r+S.slice(o)).slice(0,a);if(s.length>0&&T&&!T.test(s))return;t.value=s,w(s);let c=Math.min(s.length,a-1),l=s.length;t.setSelectionRange(c,l),F(c),L(l)},[a,w,f,T,S]),ee=z.useMemo(()=>({position:`relative`,cursor:v.disabled?`default`:`text`,userSelect:`none`,WebkitUserSelect:`none`,pointerEvents:`none`}),[v.disabled]),U=z.useMemo(()=>({position:`absolute`,inset:0,width:R.willPushPWMBadge?`calc(100% + ${R.PWM_BADGE_SPACE_WIDTH})`:`100%`,clipPath:R.willPushPWMBadge?`inset(0 ${R.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:`100%`,display:`flex`,textAlign:o,opacity:`1`,color:`transparent`,pointerEvents:`all`,background:`transparent`,caretColor:`transparent`,border:`0 solid transparent`,outline:`0 solid transparent`,boxShadow:`none`,lineHeight:`1`,letterSpacing:`-.5em`,fontSize:`var(--root-height, 16px)`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`}),[R.PWM_BADGE_SPACE_WIDTH,R.willPushPWMBadge,o]),W=z.useMemo(()=>z.createElement(`input`,ae(ie({autoComplete:v.autoComplete||`one-time-code`},v),{"data-input-otp":!0,"data-input-otp-placeholder-shown":S.length===0||void 0,"data-input-otp-mss":P,"data-input-otp-mse":I,inputMode:l,pattern:T?.source,"aria-placeholder":c,style:U,maxLength:a,value:S,ref:E,spellCheck:v.spellCheck??!1,onPaste:e=>{var t;H(e),(t=v.onPaste)==null||t.call(v,e)},onChange:B,onMouseOver:e=>{var t;j(!0),(t=v.onMouseOver)==null||t.call(v,e)},onMouseLeave:e=>{var t;j(!1),(t=v.onMouseLeave)==null||t.call(v,e)},onFocus:e=>{var t;V(),(t=v.onFocus)==null||t.call(v,e)},onBlur:e=>{var t;N(!1),(t=v.onBlur)==null||t.call(v,e)}})),[B,V,H,l,U,a,I,P,c,v,T?.source,S]),G=z.useMemo(()=>({slots:Array.from({length:a}).map((e,t)=>{let n=M&&P!==null&&I!==null&&(P===I&&t===P||t>=P&&t<I),r=S[t]===void 0?null:S[t];return{char:r,placeholderChar:S[0]===void 0?c?.[t]??null:null,isActive:n,hasFakeCaret:n&&r===null}}),isFocused:M,isHovering:!v.disabled&&A}),[M,A,a,I,P,c,v.disabled,S]),K=z.useMemo(()=>g?g(G):z.createElement(pe.Provider,{value:G},_),[_,G,g]);return z.createElement(z.Fragment,null,m!==null&&z.createElement(`noscript`,null,z.createElement(`style`,null,m)),z.createElement(`div`,{ref:D,"data-input-otp-container":!0,translate:`no`,style:ee,className:p},K,z.createElement(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`}},W)))});me.displayName=`Input`;function Z(e,t){try{e.insertRule(t)}catch{console.warn(`input-otp could not insert CSS rule:`,t)}}var he=`
|
|
2
|
+
[data-input-otp] {
|
|
3
|
+
--nojs-bg: white !important;
|
|
4
|
+
--nojs-fg: black !important;
|
|
5
|
+
|
|
6
|
+
background-color: var(--nojs-bg) !important;
|
|
7
|
+
color: var(--nojs-fg) !important;
|
|
8
|
+
caret-color: var(--nojs-fg) !important;
|
|
9
|
+
letter-spacing: .25em !important;
|
|
10
|
+
text-align: center !important;
|
|
11
|
+
border: 1px solid var(--nojs-fg) !important;
|
|
12
|
+
border-radius: 4px !important;
|
|
13
|
+
width: 100% !important;
|
|
14
|
+
}
|
|
15
|
+
@media (prefers-color-scheme: dark) {
|
|
16
|
+
[data-input-otp] {
|
|
17
|
+
--nojs-bg: black !important;
|
|
18
|
+
--nojs-fg: white !important;
|
|
19
|
+
}
|
|
20
|
+
}`,Q=r();function ge(e){let t=(0,W.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=l(`cn-input-otp flex items-center has-disabled:opacity-50`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=l(`disabled:cursor-not-allowed`,n),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Q.jsx)(me,{"data-slot":`input-otp`,containerClassName:a,spellCheck:!1,className:o,...i}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function _e(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`flex items-center rounded-md has-aria-invalid:border-destructive has-aria-invalid:ring-2 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`input-otp-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ve(e){let t=(0,W.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({index:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=z.useContext(pe),o;t[4]!==r||t[5]!==a?.slots?(o=a?.slots[r]??{},t[4]=r,t[5]=a?.slots,t[6]=o):o=t[6];let{char:s,hasFakeCaret:c,isActive:u}=o,d;t[7]===n?d=t[8]:(d=l(`relative flex size-7 items-center justify-center border-y border-r border-input bg-input/20 text-xs/relaxed transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-2 data-[active=true]:ring-ring/30 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40`,n),t[7]=n,t[8]=d);let f;t[9]===c?f=t[10]:(f=c&&(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`h-4 w-px animate-caret-blink bg-foreground duration-1000`})}),t[9]=c,t[10]=f);let p;return t[11]!==s||t[12]!==u||t[13]!==i||t[14]!==d||t[15]!==f?(p=(0,Q.jsxs)(`div`,{"data-slot":`input-otp-slot`,"data-active":u,className:d,...i,children:[s,f]}),t[11]=s,t[12]=u,t[13]=i,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function ye(e){let t=(0,W.c)(5),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(R,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Q.jsx)(`div`,{"data-slot":`input-otp-separator`,className:`flex items-center [&_svg:not([class*='size-'])]:size-4`,role:`separator`,...n,children:r}),t[3]=n,t[4]=i),i}function be(e){let t=(0,W.c)(30),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:(0,Q.jsx)(`label`,{htmlFor:`code`,children:`Approve a sign-in`})}),t[0]=n):n=t[0];let r=e.typed,i;t[1]===e?i=t[2]:(i=t=>{e.onType(y(t))},t[1]=e,t[2]=i);let o=e.state===`Checking`,s=e.state===`Missing`,c=e.state===`Missing`&&`refuse`,d;t[3]===c?d=t[4]:(d=l(`gap-2`,c),t[3]=c,t[4]=d);let f;t[5]===e.state?f=t[6]:(f=u(a(0,3),t=>(0,Q.jsx)(ve,{index:t,"aria-invalid":e.state===`Missing`,className:`h-11 flex-1 font-mono text-lg`},t)),t[5]=e.state,t[6]=f);let p;t[7]===f?p=t[8]:(p=(0,Q.jsx)(_e,{className:`flex-1`,children:f}),t[7]=f,t[8]=p);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ye,{}),t[9]=h):h=t[9];let g;t[10]===e.state?g=t[11]:(g=u(a(4,7),t=>(0,Q.jsx)(ve,{index:t,"aria-invalid":e.state===`Missing`,className:`h-11 flex-1 font-mono text-lg`},t)),t[10]=e.state,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,Q.jsx)(_e,{className:`flex-1`,children:g}),t[12]=g,t[13]=_);let v;t[14]!==e.typed||t[15]!==_||t[16]!==i||t[17]!==o||t[18]!==s||t[19]!==d||t[20]!==p?(v=(0,Q.jsxs)(ge,{id:`code`,maxLength:8,value:r,onChange:i,pasteTransformer:y,pattern:`^[A-Za-z]+$`,inputMode:`text`,autoFocus:!0,autoComplete:`off`,autoCapitalize:`characters`,disabled:o,"aria-invalid":s,"aria-describedby":`code-error`,containerClassName:d,children:[p,h,_]}),t[14]=e.typed,t[15]=_,t[16]=i,t[17]=o,t[18]=s,t[19]=d,t[20]=p,t[21]=v):v=t[21];let b;t[22]===e.state?b=t[23]:(b=e.state===`Missing`&&(0,Q.jsx)(M,{id:`code-error`,children:`No waiting sign-in has this code.`}),t[22]=e.state,t[23]=b);let x;t[24]===e.answered?x=t[25]:(x=m(e.answered,{onNone:Se,onSome:xe}),t[24]=e.answered,t[25]=x);let S;return t[26]!==v||t[27]!==b||t[28]!==x?(S=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[n,v,b,x]}),t[26]=v,t[27]=b,t[28]=x,t[29]=S):S=t[29],S}function xe(e){return(0,Q.jsx)(`p`,{className:`text-muted-foreground settle-in flex items-center gap-1.5 text-xs`,role:`status`,children:n(e.accept,{onFalse:()=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(E,{className:`size-3.5`}),N(e.request.clientName,e.request.device),` denied`]}),onTrue:()=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(I,{className:`text-primary size-3.5`}),N(e.request.clientName,e.request.device),` approved`]})})})}function Se(){return null}function $(e){let t=(0,W.c)(11),n;t[0]!==e.answered||t[1]!==e.onType||t[2]!==e.state||t[3]!==e.typed?(n=(0,Q.jsx)(be,{answered:e.answered,onType:e.onType,state:e.state,typed:e.typed}),t[0]=e.answered,t[1]=e.onType,t[2]=e.state,t[3]=e.typed,t[4]=n):n=t[4];let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(b,{label:`Apps`,media:!0,rows:k.length}),t[5]=r):r=t[5];let i;t[6]===e.pending?i=t[7]:(i=(0,Q.jsx)(z.Suspense,{fallback:r,children:(0,Q.jsx)(A,{pending:e.pending})}),t[6]=e.pending,t[7]=i);let a;return t[8]!==n||t[9]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[n,i]}),t[8]=n,t[9]=i,t[10]=a):a=t[10],a}function Ce(){let e=(0,W.c)(9);x(O),x(j);let t=S(D.send),n;e[0]===t?n=e[1]:(n=function(e){t({_tag:`Typed`,typed:e})},e[0]=t,e[1]=n);let r=n,i;e[2]===r?i=e[3]:(i=(0,Q.jsx)(U,{machine:D,path:`Typing`,children:e=>(0,Q.jsx)($,{answered:d(e.value.answered),onType:r,pending:g(),state:`Typing`,typed:e.value.typed})}),e[2]=r,e[3]=i);let a;e[4]===r?a=e[5]:(a=(0,Q.jsx)(U,{machine:D,path:`Code`,children:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{machine:D,path:`Code.Looking`,children:()=>(0,Q.jsx)($,{answered:g(),onType:r,pending:g(),state:`Checking`,typed:e.value.code})}),(0,Q.jsx)(U,{machine:D,path:`Code.Found`,children:t=>(0,Q.jsx)($,{answered:g(),onType:r,pending:p(t.value.request),state:`Found`,typed:e.value.code})}),(0,Q.jsx)(U,{machine:D,path:`Code.Missing`,children:()=>(0,Q.jsx)($,{answered:g(),onType:r,pending:g(),state:`Missing`,typed:e.value.code})})]})}),e[4]=r,e[5]=a);let o;return e[6]!==i||e[7]!==a?(o=(0,Q.jsxs)(Q.Fragment,{children:[i,a]}),e[6]=i,e[7]=a,e[8]=o):o=e[8],o}export{Ce as component};
|