@deslop/auth 0.1.1318 → 0.1.1326
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/dist/client/assets/(home)-BMhbe3jF.js +1 -0
- package/dist/client/assets/{app-bar-CsRvhWoW.js → app-bar-C0o_mXaC.js} +2 -2
- package/dist/client/assets/auth-DWmRO2OT.js +1 -0
- package/dist/client/assets/{dropdown-menu-DXiy0xTi.js → dropdown-menu-DX7qfr2q.js} +1 -1
- package/dist/client/assets/effect-Dpfcu2L1.js +17 -0
- package/dist/client/assets/format-DrYreL0n.js +1 -0
- package/dist/client/assets/{index-CTEcmZg8.js → index-DQZwYD6-.js} +3 -3
- package/dist/client/assets/index-G_aS5CLA.css +2 -0
- package/dist/client/assets/marks-NfvBg9BQ.js +2 -0
- package/dist/client/assets/people-B95xCCTs.js +1 -0
- package/dist/client/assets/route-cuEr0UZk.js +1 -0
- package/dist/client/index.html +4 -4
- package/dist/server.js +57 -5
- package/package.json +2 -2
- package/dist/client/assets/(home)-CFRztTHJ.js +0 -1
- package/dist/client/assets/auth-DYVxakC6.js +0 -1
- package/dist/client/assets/effect-BF_9aM8O.js +0 -17
- package/dist/client/assets/format-DT-swR6D.js +0 -1
- package/dist/client/assets/index-D1jPQ-ZJ.css +0 -2
- package/dist/client/assets/people-QfsKwQlr.js +0 -1
- package/dist/client/assets/route-tUksNfhB.js +0 -2
package/dist/server.js
CHANGED
|
@@ -103823,7 +103823,7 @@ var AiGateway = class AiGateway extends Service$1()("@deslop/runtime/server/ai/A
|
|
|
103823
103823
|
});
|
|
103824
103824
|
const gateway = yield* AiGateway;
|
|
103825
103825
|
const client = yield* make$7({
|
|
103826
|
-
apiUrl: `${yield* gateway.apiUrl}/
|
|
103826
|
+
apiUrl: `${yield* gateway.apiUrl}/anthropic`,
|
|
103827
103827
|
transformClient: yield* gateway.authorize(userId)
|
|
103828
103828
|
});
|
|
103829
103829
|
return yield* provideService$2(make$6({
|
|
@@ -103853,6 +103853,13 @@ var AiGateway = class AiGateway extends Service$1()("@deslop/runtime/server/ai/A
|
|
|
103853
103853
|
}));
|
|
103854
103854
|
};
|
|
103855
103855
|
// ../../packages/runtime/src/server/mcp.ts
|
|
103856
|
+
const McpStream = middleware()((app) => gen(function* () {
|
|
103857
|
+
if ((yield* HttpServerRequest).method === "POST") {
|
|
103858
|
+
const subscription = yield* option$1(schemaBodyJson(Struct$2({ method: Literal("subscriptions/listen") })));
|
|
103859
|
+
if (isSome(subscription)) yield* annotateCurrentSpan("rpc.stream", true);
|
|
103860
|
+
}
|
|
103861
|
+
return yield* app;
|
|
103862
|
+
}));
|
|
103856
103863
|
const layerStructuredTools = effect(McpServer, gen(function* () {
|
|
103857
103864
|
const registry = yield* McpServer;
|
|
103858
103865
|
return McpServer.of({
|
|
@@ -104730,7 +104737,7 @@ function layerMcp(options) {
|
|
|
104730
104737
|
],
|
|
104731
104738
|
registrations: provide$2(options.registrations, layerStructuredTools),
|
|
104732
104739
|
version: metadata.version
|
|
104733
|
-
}), HttpAuth.layer);
|
|
104740
|
+
}), merge$3(HttpAuth.layer, McpStream.layer));
|
|
104734
104741
|
}));
|
|
104735
104742
|
}
|
|
104736
104743
|
const layerNodeHttpServer = layerConfig(createServer, {
|
|
@@ -105468,6 +105475,14 @@ const extract$1 = /*#__PURE__*/ dual((args) => isStruct(args[0]), (self, variant
|
|
|
105468
105475
|
return schema;
|
|
105469
105476
|
});
|
|
105470
105477
|
/**
|
|
105478
|
+
* Returns the original field definitions stored on a variant schema struct.
|
|
105479
|
+
*
|
|
105480
|
+
* @stability unstable
|
|
105481
|
+
* @category accessors
|
|
105482
|
+
* @since 4.0.0
|
|
105483
|
+
*/
|
|
105484
|
+
const fields$1 = (self) => self[TypeId];
|
|
105485
|
+
/**
|
|
105471
105486
|
* Creates a variant schema toolkit for a fixed set of variant names and a default
|
|
105472
105487
|
* variant.
|
|
105473
105488
|
*
|
|
@@ -105573,6 +105588,14 @@ const { Class, Field, FieldExcept, FieldOnly, Struct, Union, extract, fieldEvolv
|
|
|
105573
105588
|
defaultVariant: "select"
|
|
105574
105589
|
});
|
|
105575
105590
|
/**
|
|
105591
|
+
* Returns the variant field definitions stored on a model or variant struct.
|
|
105592
|
+
*
|
|
105593
|
+
* @stability unstable
|
|
105594
|
+
* @category getters
|
|
105595
|
+
* @since 4.0.0
|
|
105596
|
+
*/
|
|
105597
|
+
const fields = fields$1;
|
|
105598
|
+
/**
|
|
105576
105599
|
* Creates a schema for optional keys that decodes missing or null encoded values
|
|
105577
105600
|
* through `Option` and encodes `Option` values back to optional nullable keys.
|
|
105578
105601
|
*
|
|
@@ -105604,7 +105627,14 @@ const FieldOption = /*#__PURE__*/ fieldEvolve({
|
|
|
105604
105627
|
jsonCreate: /*#__PURE__*/ map$2(optionalOption),
|
|
105605
105628
|
jsonUpdate: /*#__PURE__*/ map$2(optionalOption)
|
|
105606
105629
|
});
|
|
105607
|
-
|
|
105630
|
+
Literals([
|
|
105631
|
+
"iPhone",
|
|
105632
|
+
"iPad",
|
|
105633
|
+
"Android",
|
|
105634
|
+
"Mac",
|
|
105635
|
+
"Windows",
|
|
105636
|
+
"Linux"
|
|
105637
|
+
]);
|
|
105608
105638
|
var CookieSession = class extends Class("CookieSession")({
|
|
105609
105639
|
address: FieldOption(String$6),
|
|
105610
105640
|
browser: String$6,
|
|
@@ -105615,6 +105645,15 @@ var CookieSession = class extends Class("CookieSession")({
|
|
|
105615
105645
|
}) {
|
|
105616
105646
|
static table = "cookie_sessions";
|
|
105617
105647
|
};
|
|
105648
|
+
var ListedSession = class extends Class("ListedSession")({
|
|
105649
|
+
...pick(fields(CookieSession), [
|
|
105650
|
+
"address",
|
|
105651
|
+
"browser",
|
|
105652
|
+
"id",
|
|
105653
|
+
"lastSeenAt"
|
|
105654
|
+
]),
|
|
105655
|
+
current: Boolean$5
|
|
105656
|
+
}) {};
|
|
105618
105657
|
// src/services/github/lib/utils.ts
|
|
105619
105658
|
function randomTokenOf(random) {
|
|
105620
105659
|
return (bytes) => map$7(random.randomBytes(bytes), encode);
|
|
@@ -106289,7 +106328,7 @@ var RpcContracts = class extends make$35(make$39("people.watch", {
|
|
|
106289
106328
|
}), make$39("sessions.watch", {
|
|
106290
106329
|
error: AuthError,
|
|
106291
106330
|
stream: true,
|
|
106292
|
-
success: ArraySchema(
|
|
106331
|
+
success: ArraySchema(ListedSession)
|
|
106293
106332
|
})).middleware(RpcAuth).merge(make$35(make$39("people.account", {
|
|
106294
106333
|
error: AuthError,
|
|
106295
106334
|
stream: true,
|
|
@@ -106307,7 +106346,20 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
|
106307
106346
|
return yield* people.admit(input, yield* CurrentUser);
|
|
106308
106347
|
}),
|
|
106309
106348
|
"people.watch": () => unwrap$4(map$7(CurrentUser, (user) => sql.reactive(["people"], people.list(user)))),
|
|
106310
|
-
"sessions.watch": () => unwrap$4(
|
|
106349
|
+
"sessions.watch": (_, options) => unwrap$4(gen(function* () {
|
|
106350
|
+
const user = yield* CurrentUser;
|
|
106351
|
+
const own = yield* match$8(identifyRequestOf(options.headers).session, {
|
|
106352
|
+
onNone: () => succeedNone,
|
|
106353
|
+
onSome: sessions.current
|
|
106354
|
+
});
|
|
106355
|
+
return sql.reactive(["cookieSessions"], map$7(sessions.list(user.id), map$10((row) => ListedSession.make({
|
|
106356
|
+
address: row.address,
|
|
106357
|
+
browser: row.browser,
|
|
106358
|
+
current: exists(own, (found) => found.id === row.id),
|
|
106359
|
+
id: row.id,
|
|
106360
|
+
lastSeenAt: row.lastSeenAt
|
|
106361
|
+
}))));
|
|
106362
|
+
}))
|
|
106311
106363
|
});
|
|
106312
106364
|
}));
|
|
106313
106365
|
// src/tools/contracts.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deslop/auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1326",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/MP281X/deslop.git",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=26"
|
|
35
35
|
},
|
|
36
|
-
"fingerprint": "
|
|
36
|
+
"fingerprint": "392147b7384741df0ef3f0f1173a0dbf73201015b7bce95e9c2ba7b244ed408d"
|
|
37
37
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t}from"./react-BPjvcVqE.js";import{Kn as n,Lt as r,Sr as i,ar as a,qn as o}from"./effect-BF_9aM8O.js";import{t as s}from"./index-CTEcmZg8.js";import{a as c,i as l,o as u,r as d,t as f}from"./format-DT-swR6D.js";import{a as p}from"./auth-DYVxakC6.js";var m=t(),h=e();function g(){let e=(0,m.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,h.jsx)(s,{atom:p,children:_}),e[0]=t):t=e[0],t}function _(e){return o(e,{onEmpty:b,onNonEmpty:v})}function v(e){return(0,h.jsx)(d,{"aria-label":`Browser sessions`,children:(0,h.jsx)(l,{children:n(e,y)})})}function y(e){return(0,h.jsxs)(u,{children:[(0,h.jsx)(c,{children:(0,h.jsx)(`span`,{className:`block max-w-80 truncate`,children:e.browser})}),(0,h.jsx)(c,{children:a(e.address,i(``))}),(0,h.jsx)(c,{className:`text-right`,children:(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:f(e.lastSeenAt,r())})})]},e.id)}function b(){return(0,h.jsx)(`p`,{className:`text-muted-foreground`,children:`No browser sessions`})}var x=g;export{x as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{a as t,n,o as r,t as i}from"./react-BPjvcVqE.js";import{$ as a,$n as o,$t as s,A as c,An as l,At as u,B as ee,Bn as te,Bt as ne,C as re,Cn as d,Cr as ie,D as ae,Dn as oe,Dt as f,E as se,En as ce,Et as p,F as le,G as ue,H as de,I as m,In as fe,It as pe,J as me,Jt as h,K as he,Ln as ge,M as _e,Mn as ve,Nn as g,O as _,On as ye,Ot as be,P as xe,Pn as Se,Q as Ce,Qn as v,Qt as we,Rt as Te,S as Ee,Sn as De,Sr as Oe,T as ke,Tn as Ae,Tt as je,U as Me,Un as Ne,Ut as Pe,V as Fe,Vn as Ie,Vt as Le,W as Re,Wn as ze,Wt as Be,X as Ve,Xt as He,Y as Ue,Yn as We,Yt as Ge,Z as Ke,Zt as qe,_ as Je,_t as y,a as Ye,an as Xe,at as Ze,b as Qe,bn as $e,bt as et,c as tt,cn as nt,cr as rt,ct as it,d as at,dn as ot,dr as b,dt as x,er as S,et as st,f as ct,fr as C,ft as w,g as T,h as lt,hn as ut,hr as dt,ht as ft,i as pt,in as E,it as mt,j as ht,jn as gt,jt as _t,kn as vt,kt as D,l as yt,ln as bt,lr as xt,lt as O,m as St,mr as k,mt as A,n as j,nn as Ct,nr as wt,nt as Tt,o as Et,on as Dt,or as Ot,ot as M,p as kt,pr as At,pt as jt,q as Mt,qt as N,r as Nt,rr as Pt,rt as Ft,s as It,sn as Lt,sr as Rt,st as P,t as zt,tn as Bt,tr as Vt,tt as F,u as I,un as Ht,ur as Ut,ut as Wt,v as Gt,vn as Kt,vt as qt,w as L,wn as Jt,wr as R,x as Yt,xn as z,xt as Xt,y as Zt,yn as Qt,yr as $t,yt as B,zn as en,zt as tn}from"./effect-BF_9aM8O.js";import{l as nn,r as rn,t as an}from"./dist-CoswJ3T9.js";var V=e(r(),1),on=t(),H=class extends jt()(`AuthError`,{cause:et(Tt()),error:Xt(M([`access_denied`,`temporarily_unavailable`])),message:x}){get name(){return this.error===`temporarily_unavailable`?`AuthUnavailable`:`AuthError`}},U=R(P,A(`UserId`)),sn=R(Ze,A(`GitHubId`));R(mt,ft(sn));var W=w({admin:a,id:U,name:P});w({address:O(P),onBehalfOf:O(U),session:O(P)}),U.make(`github:0`);function cn(e){return`${new URL(e).origin}/auth/sign-in?${new URLSearchParams({next:e})}`}function ln(e){return y(H)(e)&&e.error===void 0}function G(e){return y(H)(e)&&e.error!==`temporarily_unavailable`}fe()(`@deslop/runtime/shared/auth/CurrentUser`);var un=class extends Nt()(`@deslop/runtime/shared/auth/RpcAuth`,{error:H}){},dn=x.check(B(e=>S(v(L(e)),e=>en([`http:`,`https:`],e.protocol)&&e.username===``&&e.password===``&&e.hash===``),{expected:`an HTTP(S) URL without credentials or a fragment`})).check(B(e=>S(v(L(e)),e=>e.pathname===`/`&&e.search===``),{expected:`an HTTP(S) origin without a path or query`}));dn.check(B(e=>S(v(L(e)),e=>e.protocol===`https:`||en([`localhost`,`127.0.0.1`,`[::1]`],e.hostname)),{expected:`HTTPS outside loopback`})),x.check(qt(/^\d{1,5}$/u),B(e=>S(Kt(e),e=>e>=1&&e<=65535),{expected:`a port between 1 and 65535`}));var fn=x.check(qt(/^0\.1\.\d+$/u)),pn=`/api/runtime`,mn=w({auth:O(dn),name:x,traces:x,version:fn}),hn=`/api/rpc`,gn=w({...W.fields,signOut:a});w({config:w({port:Ze}),name:x,version:fn}),M([`web`,`mobile`,`server`]);function _n(e,t,n,r){return Qt(oe(h(function*(){let i=`${yield*vt}`,a=yield*p,o={attributes:{"scope.run.started_unix_nano":i,"scope.runtime":n,"service.instance.id":i},serviceName:e,serviceVersion:Ot(xt(r,e=>e!==`0.1.0`))};return d(De(Et({resource:o,url:new URL(`/v1/traces`,t).href}),It({resource:o,url:new URL(`/v1/logs`,t).href}),Ae(p,[...a,`code`,`state`,`request`,`access_token`,`refresh_token`,`id_token`,`client_secret`,`client_assertion`,`code_verifier`,`session`,`token`])),[tt,I])})),e=>ve(e)?$e(Ge):$e(qe(`Telemetry is unavailable`)))}function vn(e){return oe(h(function*(){let t=yield*R((yield*Qe).get(pn),N(Ee),N(re(mn)),Dt(`3 seconds`),Xe(e=>qe(`Telemetry is off: the runtime config did not load`,e)),s);return b(t,{onNone:()=>z,onSome:t=>t.traces===``?z:_n(`${e}-client`,t.traces,`web`,t.version)})}))}var K=class extends Nt()(`@deslop/runtime/shared/rpc/RpcStream`){};Ae(K,K.of((e,t)=>Je(t.rpc.successSchema)?ne(Le(`rpc.stream`,!0),e):e));var yn=pt(K,e=>h(function*(){return Je(e.rpc.successSchema)&&(yield*Le(`rpc.stream`,!0)),yield*e.next(e.request)}));function bn(e,t=Zt){return R(ct({pingTimeout:`15 seconds`,retryTransientErrors:!0}),d(d(Gt(e),t)),Jt(kt()),Jt(yn))}var q=D(C());M([`route`,`caught`,`uncaught`]);var xn=se(e=>{let t=He(`Web error`,l(e.error),...dt(Pt(e.stack)));return b(f(q),{onNone:()=>t,onSome:n=>Bt(R(t,ne(Pe(e.error)),nt(`Web.error`,{attributes:{"web.error.source":e.source,"web.route.id":e.route},root:!0}),Be),n)})}),Sn=c(I).atom(R(Yt(`/api/account`),N(Ee),N(re(gn)))),Cn=bn(E(()=>`${location.origin}${hn}`));function wn(e){c.addGlobalLayer(R(vn(e),d(I),ce(e=>Rt(ge(e,yt))?Lt:tn(E(()=>u(q,k(e))),()=>E(()=>_t(q,Vt(t=>t!==e)))))))}var Tn=e(i(),1);function En(e){let t=Tn.unstable_scheduleCallback(4,e);return()=>Tn.unstable_cancelCallback(t)}var J=V.createContext(_e({scheduleTask:En,defaultIdleTTL:400})),Dn=new WeakMap,Y=0,X=new Set;function On(e){Y++;try{return e()}finally{Y--}}function kn(e){if(Y===0)return e();X.size===0&&queueMicrotask(Z),X.add(e)}function Z(){for(let e of X)X.delete(e),e()}function An(e,t){let n=Dn.get(e);n===void 0&&(n=new WeakMap,Dn.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i=0,a,o={subscribe(n){i++;let r=e.subscribe(t,()=>kn(n));return()=>{i--,X.delete(n),r()}},snapshot(){return On(()=>e.get(t))},getServerSnapshot(){return(i===0||a===void 0)&&(a={value:On(()=>ae(t,e))}),a.value}};return n.set(t,o),o}function Q(e,t){let n=An(e,t);return V.useEffect(Z),V.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}function jn(e,t,n){let r=An(e,t),i=V.useMemo(()=>{let e;return t=>(e!==void 0&&Object.is(e.source,t)||(e={source:t,value:n(t)}),e.value)},[n]);return V.useEffect(Z),V.useSyncExternalStore(r.subscribe,()=>i(r.snapshot()),()=>i(r.getServerSnapshot()))}var Mn=(e,t)=>{let n=V.useContext(J);return t?jn(n,e,t):Q(n,e)};function Nn(e,t){V.useEffect(()=>e.mount(t),[t,e])}function Pn(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?V.useCallback(r=>{e.set(t,r);let i=Ct(ht(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(Fn):i},[e,t,n.mode]):V.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var Fn=e=>{if(ye(e))return e.value;throw Se(e.cause)},In=e=>{Nn(V.useContext(J),e)},Ln=e=>{let t=V.useContext(J);return Nn(t,e),V.useCallback(()=>{t.refresh(e)},[t,e])},Rn=(e,t)=>{let n=V.useContext(J);return[Q(n,e),Pn(n,e,t)]},zn={suspendOnWaiting:new WeakMap,default:new WeakMap};function Bn(e,t,n){let r=n?zn.suspendOnWaiting:zn.default,i=r.get(e);i===void 0&&(i=new WeakMap,r.set(e,i));let a=i.get(t);return a===void 0&&(a=new Promise(r=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),r(),i.delete(t))})}),i.set(t,a)),a}function Vn(e,t,n){let r=Q(e,t);if(r._tag===`Initial`||n&&r.waiting)throw Bn(e,t,n);return r}var Hn=(e,t)=>{let n=Vn(V.useContext(J),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw Se(n.cause);return n},Un=n();function Wn(e){return We(e.reasons,e=>g(e)&&G(e.error))}function Gn(e){return!m(e)||!Wn(e.cause)&&rt(e.previousSuccess)?C():k(e.cause)}function Kn(e,t,n=ie){function r(e){let t=Ie(e.reasons,e=>g(e)&&G(e.error));return Ne(t)?C():k(gt(t))}let i=D(R(e.self(),Vt(m),wt(e=>r(e.cause))));function a(e){return b(f(i),{onNone:()=>e,onSome:t=>gt([...t.reasons,...Ie(e.reasons,e=>!g(e)||!G(e.error))])})}let o=D(0),s=Ve(t,t=>E(()=>{_t(i,e=>At(r(t),()=>e));let n=a(t);rt(f(i))?e.setSelf(xe(n)):be(o)<2||e.setSelf(le(n,{previous:e.self()}))}));return R(n(s),Ue(()=>E(()=>{u(i,C()),u(o,0)})),ee(e=>Re(a(e))),de(me(()=>b(f(i),{onNone:()=>Me,onSome:Re}))))}function qn(e){return Mt(e,e=>Ht(e(bt(`1 second`)),e=>y(H)(e.input)?e.input.error===`temporarily_unavailable`:y(lt)(e.input)&&!y(St)(e.input.reason)))}function Jn(e,t,n){return Ke(we(e,e=>e(t,n)))}function Yn(e,t,n){return e.runtime.atom(r=>Kn(r,Ke(we(e,e=>e(t,n))),qn))}var Xn=V.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=nn({disabled:i,focusableWhenDisabled:a,native:o});return rn(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function Zn(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Zn(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Qn(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Zn(e))&&(r&&(r+=` `),r+=t);return r}var $n=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,er=Qn,tr=(e,t)=>n=>{if(t?.variants==null)return er(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=$n(t)||$n(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return er(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},nr=tr(`group/button inline-flex shrink-0 items-center justify-center rounded-none border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-none px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-none [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-none`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function rr(e){let t=(0,Un.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]!==n||t[6]!==s||t[7]!==o?(c=an(nr({variant:o,size:s,className:n})),t[5]=n,t[6]=s,t[7]=o,t[8]=c):c=t[8];let l;return t[9]!==r||t[10]!==c?(l=(0,on.jsx)(Xn,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var ir=class extends zt(`CookieSession`)({address:j(x),browser:x,createdAt:F,id:x,lastSeenAt:F,userId:U}){static table=`cookie_sessions`},ar=M([`Admin`,`Member`,`Waiting`]),or=w({...W.fields,fullName:O(x),role:ar}),sr=w({...or.fields,signOut:a}),cr=w({...or.fields,since:R(Ft,ft(it(st),{decode:je(e=>R(e,xt(e=>e!==0),Ut(pe))),encode:je(e=>b(e,{onNone:Oe(0),onSome:Te}))}))}),lr=M([`Waiting`,`Allowed`]);zt(`Member`)({fullName:j(x),id:W.fields.id,name:W.fields.name,since:F,status:lr}),w({id:sn,login:P,name:Wt(x)});var ur=w({allow:a,id:U}),dr=class extends Ye(T(`people.watch`,{error:H,stream:!0,success:Ce(cr)}),T(`people.admit`,{error:H,payload:ur,success:cr}),T(`sessions.watch`,{error:H,stream:!0,success:Ce(ir)})).middleware(un).merge(Ye(T(`people.account`,{error:H,stream:!0,success:sr}))){};function fr(e){return R(new URL(e).hostname,ut(`.`),te(1),ze(`.`))}function pr(e,t,n){return o(L(e),{onFailure:$t,onSuccess:e=>e.username!==``||e.password!==``?!1:n?e.origin===new URL(t).origin:e.protocol===`https:`&&(e.hostname===fr(t)||ot(`.${fr(t)}`)(e.hostname))})}var mr=w({error:O(x),next:O(x)});wn(`@deslop/auth`);var $=class extends at()(`@deslop/auth/lib/auth/RpcClient`,{group:dr.middleware(K),protocol:Cn}){},hr=_($.runtime.atom(R(Jn($,`people.account`),qn,Ue(e=>E(()=>{let t=new URL(location.href).searchParams.get(`next`);e.role!==`Waiting`&&t!==null&&pr(t,location.origin,location.protocol===`http:`)&&location.assign(t)})),he(k),Fe(`AuthError`,()=>ue(C()))))),gr=_(Yn($,`people.watch`)),_r=_(Yn($,`sessions.watch`)),vr=ke(e=>$.runtime.fn(t=>N($,n=>n(`people.admit`,{allow:t,id:e}))));export{G as _,_r as a,Gn as c,Ln as d,Hn as f,gn as g,xn as h,gr as i,Rn as l,Sn as m,hr as n,rr as o,Mn as p,vr as r,tr as s,mr as t,In as u,ln as v,cn as y};
|