@shumai-one/shumai 0.6.3 → 0.6.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/bin/{chunk-y3haqtr8.js → chunk-01vx2chc.js} +2 -2
- package/bin/chunk-0epkrexd.js +2 -0
- package/bin/chunk-0h5239kt.js +2 -0
- package/bin/{chunk-tfrevef9.js → chunk-0jnstdgf.js} +1 -1
- package/bin/{chunk-w6g84d59.js → chunk-0njsjy6x.js} +4 -4
- package/bin/{chunk-f8hgy69t.js → chunk-13rq2gtr.js} +2 -2
- package/bin/chunk-1aqs9sdh.js +3 -0
- package/bin/{chunk-09mj32d7.js → chunk-22jbsrka.js} +1 -1
- package/bin/chunk-2qknebmd.js +1 -0
- package/bin/{chunk-bd3v8mp1.js → chunk-2qzmh3ae.js} +4 -4
- package/bin/{chunk-p2vsdnd1.js → chunk-2tt0b8ym.js} +2 -2
- package/bin/{chunk-3s2ga6mt.js → chunk-2zm7czk6.js} +1 -1
- package/bin/{chunk-vmwys2ch.js → chunk-396tfwdx.js} +1 -1
- package/bin/chunk-3mx4trvh.js +10 -0
- package/bin/{chunk-j2txsbxz.js → chunk-45pb3kzz.js} +2 -2
- package/bin/{chunk-dkhdn92k.js → chunk-47fmhzwv.js} +2 -2
- package/bin/chunk-4awk4xhq.js +2 -0
- package/bin/{chunk-5ddg5ezb.js → chunk-4b2x2qba.js} +21 -21
- package/bin/{chunk-9x42vgeq.js → chunk-4rjy7ybr.js} +8 -8
- package/bin/{chunk-enax4303.js → chunk-598x693h.js} +2 -2
- package/bin/chunk-5c7ztqs7.js +1 -0
- package/bin/{chunk-4p31kxjh.js → chunk-65dh7x4c.js} +2 -2
- package/bin/{chunk-s74g9vsk.js → chunk-66e2vrky.js} +1 -1
- package/bin/{chunk-q8xr1a8j.js → chunk-6j3beg6n.js} +2 -2
- package/bin/{chunk-95b4mwyq.js → chunk-6ke13k69.js} +1 -1
- package/bin/{chunk-a859y4e1.js → chunk-6rqakmg0.js} +2 -2
- package/bin/{chunk-yb4mzqrd.js → chunk-6ty4tfmf.js} +3 -3
- package/bin/chunk-7e9ws6dh.js +129 -0
- package/bin/chunk-7mdddkfc.js +1 -0
- package/bin/{chunk-qvp24w0q.js → chunk-7q4mgd5x.js} +2 -2
- package/bin/chunk-7yv7shad.js +1 -0
- package/bin/{chunk-25npafhz.js → chunk-81b8rfv7.js} +2 -2
- package/bin/{chunk-etrm28sy.js → chunk-8a7ymmd4.js} +2 -2
- package/bin/chunk-8ac9at5y.js +2 -0
- package/bin/{chunk-sz19nn1x.js → chunk-8zcfgz9c.js} +1 -1
- package/bin/{chunk-te484xtb.js → chunk-955kf5kc.js} +3 -3
- package/bin/{chunk-h2bphev9.js → chunk-978rm9a9.js} +2 -2
- package/bin/{chunk-jt02kpfc.js → chunk-9qzbrp4d.js} +2 -2
- package/bin/{chunk-20bamhwa.js → chunk-a283dh05.js} +2 -2
- package/bin/chunk-aa2a06cc.js +1 -0
- package/bin/{chunk-esj0kwe5.js → chunk-ajr1w3vq.js} +6 -6
- package/bin/chunk-akafypge.js +218 -0
- package/bin/chunk-amk373q2.js +2 -0
- package/bin/{chunk-mn71dffh.js → chunk-apq2gvvp.js} +2 -2
- package/bin/chunk-av2w1sez.js +2 -0
- package/bin/{chunk-atpt99h4.js → chunk-b6kmj34z.js} +12 -12
- package/bin/chunk-bkzaw9p8.js +1 -0
- package/bin/{chunk-pq6kdp83.js → chunk-bssb9tar.js} +3 -3
- package/bin/chunk-bwvj1aqc.js +1 -0
- package/bin/chunk-by9esjn7.js +3 -0
- package/bin/chunk-bywk8mbc.js +2 -0
- package/bin/{chunk-r6t0j0jx.js → chunk-c61g9hfa.js} +4 -4
- package/bin/{chunk-mn0kt3p6.js → chunk-cdcgjh8k.js} +1 -1
- package/bin/{chunk-atdfqdkj.js → chunk-d277evce.js} +4 -4
- package/bin/{chunk-9405hzv2.js → chunk-d3brvxh7.js} +2 -2
- package/bin/{chunk-4vjgdj0h.js → chunk-dcb1nzf1.js} +1 -1
- package/bin/{chunk-q5x0yywj.js → chunk-dfbzatq9.js} +2 -2
- package/bin/chunk-e0bckx12.js +2 -0
- package/bin/{chunk-wgvgtttc.js → chunk-e2p4s2pj.js} +3 -3
- package/bin/chunk-e8zzg57c.js +2 -0
- package/bin/{chunk-npeapp7e.js → chunk-edfaqwaq.js} +2 -2
- package/bin/{chunk-6nqqe7w9.js → chunk-ehgrp0f9.js} +1 -1
- package/bin/chunk-evs2aaav.js +12 -0
- package/bin/{chunk-cp96e9pq.js → chunk-f5bhcjhw.js} +1 -1
- package/bin/{chunk-34f64q0q.js → chunk-fb9dedm2.js} +2 -2
- package/bin/{chunk-zx1c4vm5.js → chunk-ff0mh9p3.js} +31 -31
- package/bin/chunk-fpfby5tz.js +1 -0
- package/bin/{chunk-eyjfhdp9.js → chunk-gd3b5akr.js} +2 -2
- package/bin/{chunk-3hgrw1m0.js → chunk-gm1fy3hm.js} +5 -5
- package/bin/{chunk-ezjxx44x.js → chunk-gqkjx7rz.js} +3 -3
- package/bin/{chunk-1y6h4vge.js → chunk-h7f5370s.js} +1 -1
- package/bin/chunk-hcyhsn8e.js +2 -0
- package/bin/{chunk-erfkd3z9.js → chunk-jxm0gzmf.js} +2 -2
- package/bin/{chunk-09mpcg9x.js → chunk-k3ggy3xk.js} +2 -2
- package/bin/{chunk-0a298n62.js → chunk-k9vjs21p.js} +2 -2
- package/bin/chunk-ka40gv72.js +1 -0
- package/bin/chunk-km70p970.js +2 -0
- package/bin/{chunk-vnmggrd6.js → chunk-m6v8rb39.js} +8 -8
- package/bin/{chunk-bbxwyhz3.js → chunk-m8spagwp.js} +3 -3
- package/bin/{chunk-addssm8d.js → chunk-mfh7mg5b.js} +1 -1
- package/bin/chunk-n0cn0218.js +2 -0
- package/bin/chunk-n54ftsdx.js +2 -0
- package/bin/{chunk-v0yevesp.js → chunk-n7cvj15k.js} +5 -5
- package/bin/chunk-na5fh7er.js +2 -0
- package/bin/chunk-neazdbxy.js +1 -0
- package/bin/chunk-nk24qw3m.js +1 -0
- package/bin/{chunk-7mawxsk3.js → chunk-nsbbseff.js} +2 -2
- package/bin/chunk-nseef85h.js +1 -0
- package/bin/chunk-p35ztj2z.js +3 -0
- package/bin/chunk-pcjc9ygv.js +2 -0
- package/bin/{chunk-brgns7hv.js → chunk-pemmtd8q.js} +1 -1
- package/bin/{chunk-7jz3cmq6.js → chunk-pzrqnnpg.js} +1 -1
- package/bin/{chunk-a74g6h8a.js → chunk-q43m934j.js} +2 -2
- package/bin/{chunk-6f3zhq64.js → chunk-q57m34h0.js} +3 -3
- package/bin/chunk-q5k72jz9.js +3 -0
- package/bin/chunk-q9fsxakd.js +2 -0
- package/bin/chunk-qadpe0ct.js +2 -0
- package/bin/chunk-qeypjv4f.css +1 -0
- package/bin/chunk-qw92z3wf.js +2 -0
- package/bin/chunk-r0byfq1t.js +1 -0
- package/bin/chunk-r0q88qw3.js +2 -0
- package/bin/chunk-rjhczkh3.js +2 -0
- package/bin/{chunk-19zbh4fr.js → chunk-s0wxbybf.js} +1 -1
- package/bin/{chunk-d55138xx.js → chunk-s4hkcw24.js} +2 -2
- package/bin/chunk-szta50g1.js +1 -0
- package/bin/chunk-t6cb99gp.js +2 -0
- package/bin/chunk-tcr080b9.js +1 -0
- package/bin/{chunk-s6pk2zyg.js → chunk-v4nqx084.js} +5 -5
- package/bin/{chunk-gyv3yrhj.js → chunk-v7jzc3ye.js} +1 -1
- package/bin/{chunk-hsyfrzdd.js → chunk-vbe8wred.js} +1 -1
- package/bin/{chunk-sz5zawfw.js → chunk-vf9s8b5t.js} +2 -2
- package/bin/{chunk-e55sgg8t.js → chunk-vk3eqr65.js} +1 -1
- package/bin/{chunk-vv0m0m2f.js → chunk-vm9bbk97.js} +4 -4
- package/bin/{chunk-1e1q1hyg.js → chunk-w4gqg27w.js} +2 -2
- package/bin/{chunk-z0de127n.js → chunk-w6ym7tsd.js} +4 -4
- package/bin/{chunk-3vpz5nat.js → chunk-ways29d1.js} +1 -1
- package/bin/chunk-wesg7tg9.js +1 -0
- package/bin/chunk-wmrrapwv.js +2 -0
- package/bin/chunk-wnwsjgj8.js +2 -0
- package/bin/{chunk-zkvezz89.js → chunk-wrb4xq9v.js} +1 -1
- package/bin/{chunk-7kah3zb5.js → chunk-wzrzc07t.js} +2 -2
- package/bin/chunk-xd1axsdv.js +2 -0
- package/bin/{chunk-k7vbk8v4.js → chunk-xk0jmx4s.js} +2 -2
- package/bin/{chunk-jc7dycy6.js → chunk-y545vfn0.js} +1 -1
- package/bin/{chunk-1ja2zw4w.js → chunk-y6h885fs.js} +1 -1
- package/bin/{chunk-0rgbxp24.js → chunk-yncmfr39.js} +2 -2
- package/bin/{chunk-7546ptwg.js → chunk-yxnz4ypt.js} +8 -8
- package/bin/chunk-zc1asygg.js +2 -0
- package/bin/{chunk-hg3rkp41.js → chunk-zc7wzcvh.js} +7 -7
- package/bin/chunk-zdvhh8mk.js +2 -0
- package/bin/{chunk-femnbfkj.js → chunk-zg0b902x.js} +2 -2
- package/bin/{chunk-ddmf9gqv.js → chunk-zhq7a7hs.js} +2 -2
- package/bin/{chunk-dygj751y.js → chunk-zmnvskn7.js} +11 -11
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +470 -389
- package/package.json +7 -7
- package/prisma/migrations/20261102032402_add_archive_storage/migration.sql +25 -0
- package/prisma/schema.prisma +12 -6
- package/bin/chunk-02b5bcmc.js +0 -1
- package/bin/chunk-1tar0x8s.js +0 -7
- package/bin/chunk-20w1w9x7.js +0 -2
- package/bin/chunk-2qgagdb7.js +0 -1
- package/bin/chunk-2t6g3pny.js +0 -3
- package/bin/chunk-50pfmxt1.js +0 -2
- package/bin/chunk-5ngftxjb.js +0 -218
- package/bin/chunk-6t525bmg.js +0 -1
- package/bin/chunk-88jg9dq5.js +0 -2
- package/bin/chunk-8qdtvfx3.css +0 -1
- package/bin/chunk-8ww98y1m.js +0 -2
- package/bin/chunk-9vxmgvc8.js +0 -2
- package/bin/chunk-ajq9sxg0.js +0 -129
- package/bin/chunk-amp9h878.js +0 -2
- package/bin/chunk-awshe30f.js +0 -1
- package/bin/chunk-b3t7gbhm.js +0 -2
- package/bin/chunk-c02727j9.js +0 -2
- package/bin/chunk-c1wvs81k.js +0 -2
- package/bin/chunk-c8frmqsk.js +0 -2
- package/bin/chunk-cagzye3j.js +0 -2
- package/bin/chunk-djb65frk.js +0 -1
- package/bin/chunk-dx9f5wab.js +0 -1
- package/bin/chunk-ex3174e3.js +0 -2
- package/bin/chunk-f4xnx4n6.js +0 -1
- package/bin/chunk-fakph5jp.js +0 -1
- package/bin/chunk-ffjdkdcv.js +0 -2
- package/bin/chunk-gd016e9p.js +0 -2
- package/bin/chunk-h3atwgx2.js +0 -1
- package/bin/chunk-h7xny3de.js +0 -2
- package/bin/chunk-hpzk9k55.js +0 -1
- package/bin/chunk-hvyy8vct.js +0 -3
- package/bin/chunk-j2s311yc.js +0 -3
- package/bin/chunk-j6x53e33.js +0 -1
- package/bin/chunk-jacanzp7.js +0 -1
- package/bin/chunk-pdw77q09.js +0 -2
- package/bin/chunk-ptcz4ed3.js +0 -2
- package/bin/chunk-q1fzgqsv.js +0 -2
- package/bin/chunk-q4ny4hpt.js +0 -2
- package/bin/chunk-q8ysc5ex.js +0 -1
- package/bin/chunk-qm50g4n5.js +0 -10
- package/bin/chunk-s1j4v33x.js +0 -2
- package/bin/chunk-t68y25gf.js +0 -1
- package/bin/chunk-thpw6tcj.js +0 -2
- package/bin/chunk-vj4gamdn.js +0 -2
- package/bin/chunk-xy9qpn6b.js +0 -1
- package/bin/chunk-y5dv67mg.js +0 -2
- package/bin/chunk-z8t6e0ee.js +0 -1
- package/bin/chunk-zfg4yy3c.js +0 -2
- package/bin/chunk-zrrnvdxq.js +0 -3
- package/bin/chunk-zzqse5qc.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S,M,w,L,W,a,g,ae,ql,ee,X,We,Yn,Je,R,V,xr,U,N,va,Md,Od,Ge,Dt,Zd,Bd,uC,Np,Yl,hS,ay,bs,XR,Ea,qd,$d,mo,ct,ut,dt,ft,pt,mt,ht,gt,Se,xe,ke,ot,Ce,re,Ft,Vt,B,Io,ws,Un,yn,cr,kr,Br,Es,Te,Tm}from"./chunk-akafypge.js";import"./chunk-fb9dedm2.js";import"./chunk-7q4mgd5x.js";import{dn}from"./chunk-d3brvxh7.js";import"./chunk-3mx4trvh.js";import{Ra}from"./chunk-wmrrapwv.js";import{Us,Ou,js,mi}from"./chunk-7e9ws6dh.js";import{ku,Ru}from"./chunk-q9fsxakd.js";import"./chunk-bssb9tar.js";import{Pa}from"./chunk-q57m34h0.js";import{en}from"./chunk-s4hkcw24.js";import"./chunk-vf9s8b5t.js";import"./chunk-km70p970.js";import"./chunk-8a7ymmd4.js";import"./chunk-na5fh7er.js";import"./chunk-qw92z3wf.js";import"./chunk-81b8rfv7.js";import"./chunk-wzrzc07t.js";L();var Mt=({item:o})=>{if(o.preview?.thumbnailUrl)return a("img",{src:o.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(o.preview?.proxyType==="audio"||o.proxyType==="audio")return a("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a(Us,{className:"w-5 h-5 text-muted-foreground"})});return a("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a(xr,{className:"w-5 h-5 text-muted-foreground"})})},Ve=({projectId:o,currentAssetId:n,parentFolderId:F,initialFiles:f,initialNextCursor:k,isLoading:r=!1})=>{let{ref:_,inView:C}=Vt({threshold:0,rootMargin:"200px"}),D=M(null),l=M(!0),[d,O]=w(f),[i,H]=w(k),[z,Z]=w(!!k),[E,h]=w(!1);return S(()=>{O(f),H(k),Z(!!k),l.current=!0},[f,k]),S(()=>{(async()=>{if(!i||E||!C||!z)return;h(!0);try{let m=await R.api.folders[":folderId"].search.$post({param:{folderId:F},json:{assetType:"file",after:i,first:200,recursively:!1,conditions:[]}});if(!m.ok)throw Error("Failed to fetch next page");let q=await m.json(),G=q.data||[];O((J)=>[...J,...G]),H(q.pageInfo?.cursor||void 0),Z(!!q.pageInfo?.cursor&&G.length>0)}catch(m){console.error("Error fetching next page:",m)}finally{h(!1)}})()},[C,i,z,E,F]),S(()=>{if(d.some((m)=>m?.id===n)&&D.current)if(l.current)D.current.scrollIntoView({block:"center",inline:"center",behavior:"auto"}),l.current=!1;else D.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[d,n]),a("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:g("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[r&&d.length===0?Array.from({length:6}).map((u,m)=>a(Te,{className:"w-[52px] h-[52px] rounded-lg shrink-0","data-testid":"carousel-skeleton-item"},m)):d.map((u)=>{if(!u)return null;let m=u.id===n;return a("div",{ref:u.id===n?D:null,className:"flex-shrink-0",children:g(Yn,{to:"/projects/$projectId/files/$fileId",params:{projectId:o,fileId:u.id},search:{version:void 0},className:U("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block relative",m?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:[a(Mt,{item:u}),u.agent&&a("span",{className:"absolute top-1 right-1 z-10 pointer-events-none select-none rounded bg-black/60 px-1 py-0.5 text-[10px] font-medium leading-none text-white",title:u.agent.name,"data-testid":"carousel-agent-badge",children:"AI"})]})},u.id)}),!r&&z&&a("div",{ref:_,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:E&&a(V,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};L();function Nt(){let{projectId:o,fileId:n}=Ke.useParams(),F=Ke.useSearch(),{version:f,start:k}=F,r=f||n,{cmpLeft:_,cmpRight:C}=F,D=F.cmpActive??"left",l=!!F.compare&&!!_&&!!C,d=M(null),{archiveStorageEnabled:O}=Io(),{teamId:i,ensureTeamIdForProject:H}=Ft(),[z,Z]=w(360),[E,h]=w([]),{fileViewRightSidebarCollapsed:u}=cr(),{isChatbotOpen:m}=kr(),q=Br((e)=>Boolean(e.metadata["appearance.hideAgent"])),[G,J]=w(0),[ge,T]=w(null),[ve,Qe]=w(null),[Oe,Ie]=w(void 0),[Y,ye]=w({show:!0,files:[],nextCursor:void 0,folderId:void 0}),[He,se]=w(!0),Be=R.api.files[":fileId"].metadata.$patch,{mutate:Ue}=X({mutationFn:async(e)=>{let t=await Be(e);if(!t.ok)throw Error("Failed to patch metadata");return await t.json()}}),p=ae(),{members:ze,fetchProjectMembers:we}=yn(),Xe=Es();S(()=>{H(o)},[o,H]),S(()=>{if(o)we(o,!0)},[o,we]),S(()=>{if(o&&n)R.api.projects[":projectId"].recents.view.$post({param:{projectId:o},json:{assetId:n}}).catch(()=>{})},[o,n]);let{data:Fe,isLoading:Ye,isError:Ze,isFetching:et}=ee({queryKey:["files",n],queryFn:async()=>{let e=await R.api.files[":fileId"].$get({param:{fileId:n}});if(!e.ok)throw Error("Failed to fetch stack");return await e.json()},enabled:!!i,placeholderData:ql,refetchInterval:(e)=>{let t=e.state.data?.status;return t==="archiving"||t==="restoring"?15000:!1}}),{data:tt,isLoading:rt,isError:nt,isFetching:st}=ee({queryKey:["files",f],queryFn:async()=>{let e=await R.api.files[":fileId"].$get({param:{fileId:f}});if(!e.ok)throw Error("Failed to fetch version");return await e.json()},enabled:!!i&&!!f,placeholderData:ql,refetchInterval:(e)=>{let t=e.state.data?.status;return t==="archiving"||t==="restoring"?15000:!1}}),{data:it}=ee({queryKey:["version_stacks",n,"versions"],queryFn:async()=>{let e=await R.api.version_stacks[":stackId"].versions.$get({param:{stackId:n}});if(!e.ok)throw Error("Failed to fetch versions");return await e.json()},enabled:!!o&&!!n&&(!!f||l)}),{data:b}=ee({queryKey:["projects",o],queryFn:async()=>{let e=await R.api.projects[":projectId"].$get({param:{projectId:o}});if(!e.ok)throw Error("Failed to fetch project");return await e.json()}}),v=We(),{setProjectState:Ae,clearProjectState:be}=Un(),at=Ye||!!f&&rt,lt=Ze||!!f&&nt,vt=et||!!f&&st,s=tt||Fe,A=f?it:Fe?.versionStack?.versions,c=s?.ancestorFolders?.[0]?.id??b?.rootFolder??"",[ie,te]=w(!1),[oe,je]=w(""),le=M(null),ce=M(!1),[It,de]=w(!1),[P,x]=w({open:!1,mode:"archive"}),{mutate:De,isPending:Re}=X({mutationFn:async(e)=>{let t=await R.api.files.archive.$post({json:{ids:[e]}});if(!t.ok)throw Error(va());return await t.json()},onSuccess:(e)=>{if(e.archivedAssetIds.length>0)B.success(Od({count:e.archivedAssetIds.length}));else B.info(Md());p.invalidateQueries({queryKey:["files"]}),p.removeQueries({queryKey:["file",i]}),p.invalidateQueries({queryKey:["version_stacks"]}),p.invalidateQueries({queryKey:["search",i]}),x((t)=>({...t,open:!1}))},onError:()=>{B.error(va())}}),{mutate:_e,isPending:$e}=X({mutationFn:async(e)=>{let t=await R.api.files["restore-archive"].$post({json:{ids:[e]}});if(!t.ok)throw Error(Ea());return await t.json()},onSuccess:(e)=>{if(e.restoredAssetIds.length>0)B.success($d({count:e.restoredAssetIds.length}));else B.info(qd());p.invalidateQueries({queryKey:["files"]}),p.removeQueries({queryKey:["file",i]}),p.invalidateQueries({queryKey:["version_stacks"]}),p.invalidateQueries({queryKey:["search",i]}),x((t)=>({...t,open:!1}))},onError:()=>{B.error(Ea())}}),yt=R.api.files[":fileId"].$put,{mutate:wt,mutateAsync:At,isPending:Ee}=X({mutationFn:async(e)=>{let t=await yt(e);if(!t.ok)throw Error("Failed to rename file");return await t.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["files"]}),p.invalidateQueries({queryKey:["version_stacks"]}),B.success(XR?.()||"Renamed successfully"),te(!1)},onError:()=>{B.error(hS?.()||"Failed to rename")}}),kt=R.api.files.$delete,{mutate:bt,mutateAsync:xt,isPending:Me}=X({mutationFn:async(e)=>{if(!(await kt(e)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(p.invalidateQueries({queryKey:["files"]}),p.invalidateQueries({queryKey:["version_stacks"]}),B.success(uC?.()||"Deleted"),de(!1),c&&c!==b?.rootFolder)v({to:"/projects/$projectId/folders/$folderId",params:{projectId:o,folderId:c}});else v({to:"/projects/$projectId",params:{projectId:o}})},onError:()=>{B.error(Yl?.()||"Failed to delete")}}),jt=(e)=>{if(e?.preventDefault(),!oe.trim()||!r)return;wt({param:{fileId:r},json:{name:oe.trim()}})},Ct=()=>{if(!r)return;bt({json:{ids:[r]}})};S(()=>{if(s&&b&&i)Ae({teamId:i,projectId:o,projectName:b.name??"",ancestorFolders:s.ancestorFolders??[],currentAsset:{id:r||n,name:s.name,type:"file",status:s.status,version:A?A.find((e)=>e.id===r)?.version??A.length:void 0,proxyType:s.proxyType},isRootFolder:!1,fileId:n,downloadInfo:{originalKey:s.media?.original?.key,videoTranscodes:s.media?.videoTranscodes?.map((e)=>({key:e.key,width:e.width,height:e.height,resolution:e.resolution,hdr:e.hdr}))},versions:A,compareMode:l,canCompareVersions:(A?.length??0)>=2,onCompareVersions:()=>{let e=Ou(A);if(!e)return;v({to:"/projects/$projectId/files/$fileId",params:{projectId:o,fileId:n},search:(t)=>({...t,version:void 0,compare:!0,cmpLeft:e.left.id,cmpRight:e.right.id,cmpActive:"left"})})},onFolderClick:(e)=>{v({to:"/projects/$projectId/folders/$folderId",params:{projectId:o,folderId:e}})},onRename:()=>{ce.current=!1,je(s?.name??""),te(!0)},onDelete:()=>{de(!0)},onArchive:()=>{x({open:!0,mode:"archive"})},onRestoreArchive:()=>{x({open:!0,mode:"restore"})}});return()=>be()},[i,o,b,s,A,r,n,l,Ae,be,v]),S(()=>{if(!ie)return;let e=setTimeout(()=>{ce.current=!0},1000);return()=>clearTimeout(e)},[ie]);let St=()=>{if(ce.current)return;setTimeout(()=>{if(le.current)mi(le.current)},0)};if(S(()=>{if(!c||!r)return;if(Y.folderId===c){se(!1);return}se(!0);let e=!0;return(async()=>{try{let I="",y=!1,j=[],ue=void 0;for(let me=0;me<5;me++){let pe=await R.api.folders[":folderId"].search.$post({param:{folderId:c},json:{assetType:"file",after:I,first:200,recursively:!1,conditions:[]}});if(!pe.ok)throw Error("Failed to search parent folder for carousel");let Q=await pe.json(),he=Q.data||[];if(j.push(...he),he.some((ne)=>ne.id===r)){if(y=!0,ue=Q.pageInfo?.cursor||void 0,Q.pageInfo?.cursor)try{let ne=await R.api.folders[":folderId"].search.$post({param:{folderId:c},json:{assetType:"file",after:Q.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(ne.ok){let Pe=await ne.json(),Et=Pe.data||[];j.push(...Et),ue=Pe.pageInfo?.cursor||void 0}}catch{}break}if(!Q.pageInfo?.cursor||he.length<200)break;I=Q.pageInfo.cursor}if(e)ye({show:!0,files:y?j:s?[s]:[],nextCursor:y?ue:void 0,folderId:c})}catch(I){if(console.error(I),e)ye({show:!0,files:s?[s]:[],nextCursor:void 0,folderId:c})}finally{if(e)se(!1)}})(),()=>{e=!1}},[c,r,Y.folderId,s]),S(()=>{J(0),T(null),h([])},[s?.id]),S(()=>{T(null),h([])},[ve?.id]),S(()=>{dn.getState().reset(),dn.getState().setIsDrawing(!1),h([]),T(null)},[r]),at&&!s)return a(Tm,{});if(lt||!s||!b||!i)return a("div",{children:ay()});let K=l?ve:s,Ne=K?.id??r,Le=(e,t)=>{if(!i)return;Ue({param:{fileId:Ne},json:[{key:e,value:t}]},{onSuccess:()=>{p.invalidateQueries({queryKey:["files",Ne]})}})},fe=(e)=>{v({to:"/projects/$projectId/files/$fileId",params:{projectId:o,fileId:n},search:(t)=>({...t,...e})})},Rt=()=>{fe({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:D==="left"?_:C})},Tt=(e)=>{T(e.id||null);let t=e.annotations;if(t&&t.length>0)h(t);else h([]);if(l){if(e.second!==null&&e.second!==void 0)Ie({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)d.current?.seekTo(e.second),d.current?.pause();else if(t&&t.length>0)d.current?.pause()},_t=(e)=>{T(e.id||null);let I=e.details,y=I?.annotations;if(y&&y.length>0)h(y);else h([]);let j=I?.position?.type==="time"?I.position.seconds:I?.position?.type==="page"?I.position.page:void 0;if(l){if(j!==void 0)Ie({second:j,nonce:Date.now()});return}if(j!==void 0)d.current?.seekTo(j),d.current?.pause();else if(y&&y.length>0)d.current?.pause()},qe=()=>{h([]),T(null)},$t=()=>{h([]),T(null)};if(Xe&&!l)return g(W,{children:[a(ku,{projectId:o,teamId:i,fileId:n,file:s,projectInfo:b,ancestorFolders:s.ancestorFolders??[],parentFolderId:c,versions:A,activeFileId:r,startTime:k,siblingFiles:Y.files,onNavigateToFile:(e)=>{v({to:"/projects/$projectId/files/$fileId",params:{projectId:o,fileId:e}})},onNavigateBack:()=>{if(c&&c!==b?.rootFolder)v({to:"/projects/$projectId/folders/$folderId",params:{projectId:o,folderId:c}});else v({to:"/projects/$projectId",params:{projectId:o}})},onSelectVersion:(e)=>{v({to:"/projects/$projectId/files/$fileId",params:{projectId:o,fileId:n},search:(t)=>({...t,version:e})})},onRenameFile:async(e)=>{await At({param:{fileId:r},json:{name:e}})},onDeleteFile:async()=>{await xt({json:{ids:[r]}})},onArchiveFile:O?()=>x({open:!0,mode:"archive"}):void 0,onRestoreArchiveFile:O?()=>x({open:!0,mode:"restore"}):void 0,onSaveField:Le}),a(ws,{open:P.open,onOpenChange:(e)=>x((t)=>({...t,open:e})),mode:P.mode,onConfirm:()=>{if(!r)return;if(P.mode==="archive")De(r);else _e(r)},isPending:Re||$e})]});return g("div",{className:"h-full flex flex-1 flex-col bg-background",children:[g("div",{className:"h-full flex flex-1 overflow-hidden",children:[g("div",{className:"flex-1 relative",children:[vt&&!l&&a("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:a(V,{className:"h-8 w-8 animate-spin text-foreground"})}),l&&_&&C?a(Ru,{versions:A??[],leftId:_,rightId:C,activeSide:D,annotations:E,seekRequest:Oe,onActiveSideChange:(e)=>fe({cmpActive:e}),onSwitchVersion:(e,t)=>fe(e==="left"?{cmpLeft:t}:{cmpRight:t}),onExit:Rt,onActiveAssetChange:Qe,onPlay:qe,onTimeUpdate:J}):a(js,{file:s,mediaControllerRef:d,onPlay:qe,onTimeUpdate:J,onSeek:$t,annotations:E,startTime:k,children:a(Ve,{projectId:o,currentAssetId:r,parentFolderId:c,initialFiles:Y.files,initialNextCursor:Y.nextCursor,isLoading:He})})]}),(!u||m&&!q)&&g(W,{children:[a(en,{onResize:(e)=>{Z((t)=>Math.max(300,Math.min(600,t-e)))},className:"hidden md:block"}),a("div",{style:{width:z},className:"flex-shrink-0 bg-background flex flex-col",children:m&&!q?a(Ra,{projectId:o,contextAssetId:r,file:K,currentTime:G,frameRate:K?.media?.metadata?.frameRate||30,startTimecode:K?.media?.metadata?.startTimecode,onTyping:()=>{if(l)return;d.current?.pause()},onSelectMessage:_t,selectedMessageId:ge}):a(Pa,{teamId:i,projectId:o,file:K,onSaveField:Le,members:ze,onCommentSelect:Tt,currentTime:G,onTyping:()=>{if(l)return;d.current?.pause()},selectedCommentId:ge,hideAnnotationControl:K?.proxyType==="audio"})})]})]}),a(Se,{open:ie,onOpenChange:te,children:a(xe,{children:g("form",{onSubmit:jt,children:[a(ke,{children:a(Ce,{children:bs()})}),a("div",{className:"py-4",children:a(re,{ref:le,value:oe,onChange:(e)=>je(e.target.value),placeholder:Np?.()||"Enter new name",onFocus:St,autoFocus:!0})}),g(ot,{children:[a(N,{type:"button",variant:"outline",onClick:()=>te(!1),children:Ge()}),g(N,{type:"submit",disabled:Ee||!oe.trim(),children:[Ee&&a(V,{className:"mr-2 h-4 w-4 animate-spin"}),mo()]})]})]})})}),a(ct,{open:It,onOpenChange:de,children:g(ut,{children:[g(dt,{children:[a(pt,{children:Bd?.()||"Delete Asset?"}),a(mt,{children:Zd?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),g(ft,{children:[a(gt,{children:Ge()}),g(ht,{onClick:Ct,disabled:Me,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[Me&&a(V,{className:"mr-2 h-4 w-4 animate-spin"}),Dt()]})]})]})}),a(ws,{open:P.open,onOpenChange:(e)=>x((t)=>({...t,open:e})),mode:P.mode,onConfirm:()=>{if(!r)return;if(P.mode==="archive")De(r);else _e(r)},isPending:Re||$e})]})}var Ke=Je("/projects/$projectId/files/$fileId")({component:Nt});export{Ke as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Pt,Y,G,Ut,Q,M,L,a,U,si,zt,me,tr,we,Co,Aa,Yc,Xc}from"./chunk-akafypge.js";L();var w=Object.defineProperty,S=(s,e)=>w(s,"name",{value:e,configurable:!0}),z="Toggle",P=Y(S(function(e,o){let{pressed:t,defaultPressed:n,onPressedChange:r,...g}=e,[l,i]=tr({prop:t,onChange:r,defaultProp:n??!1,caller:z});return a(we.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...g,ref:o,onClick:me(e.onClick,()=>{if(!e.disabled)i(!l)})})},"Toggle"));L();var k=Object.defineProperty,p=(s,e)=>k(s,"name",{value:e,configurable:!0}),m="ToggleGroup",[R,ne]=zt(m,[Aa]),h=Aa(),F=Y(p(function(e,o){let{type:t,...n}=e;if(t==="single")return a(A,{role:"radiogroup",...n,ref:o});if(t==="multiple")return a(E,{role:"toolbar",...n,ref:o});throw Error(`Missing prop \`type\` expected on \`${m}\``)},"ToggleGroup")),[C,x]=R(m),A=Y(p(function(e,o){let{value:t,defaultValue:n,onValueChange:r=p(()=>{},"onValueChange"),...g}=e,[l,i]=tr({prop:t,defaultProp:n??"",onChange:r,caller:m});return a(C,{scope:e.__scopeToggleGroup,type:"single",value:Q(()=>l?[l]:[],[l]),onItemActivate:i,onItemDeactivate:G(()=>i(""),[i]),children:a(I,{...g,ref:o})})},"ToggleGroupImplSingle")),E=Y(p(function(e,o){let{value:t,defaultValue:n,onValueChange:r=p(()=>{},"onValueChange"),...g}=e,[l,i]=tr({prop:t,defaultProp:n??[],onChange:r,caller:m}),u=G((c)=>i((d=[])=>[...d,c]),[i]),f=G((c)=>i((d=[])=>d.filter((y)=>y!==c)),[i]);return a(C,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:f,children:a(I,{...g,ref:o})})},"ToggleGroupImplMultiple")),[N,D]=R(m),I=Y(p(function(e,o){let{__scopeToggleGroup:t,disabled:n=!1,rovingFocus:r=!0,orientation:g,dir:l,loop:i=!0,...u}=e,f=h(t),c=Co(l),d={dir:c,...u};return a(N,{scope:t,rovingFocus:r,disabled:n,children:r?a(Yc,{asChild:!0,...f,orientation:g,dir:c,loop:i,children:a(we.div,{...d,ref:o})}):a(we.div,{...d,ref:o})})},"ToggleGroupImpl")),v="ToggleGroupItem",O=Y(p(function(e,o){let t=x(v,e.__scopeToggleGroup),n=D(v,e.__scopeToggleGroup),r=h(e.__scopeToggleGroup),g=t.value.includes(e.value),l=n.disabled||e.disabled,i={...e,pressed:g,disabled:l},u=M(null);return n.rovingFocus?a(Xc,{asChild:!0,...r,focusable:!l,active:g,ref:u,children:a(b,{...i,ref:o})}):a(b,{...i,ref:o})},"ToggleGroupItem")),b=Y(p(function(e,o){let{__scopeToggleGroup:t,value:n,...r}=e,g=x(v,t),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=g.type==="single"?l:void 0;return a(P,{...i,...r,ref:o,onPressedChange:(u)=>{if(u)g.onItemActivate(n);else g.onItemDeactivate(n)}})},"ToggleGroupItemImpl"));L();var _=si("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});var V=Pt({size:"default",variant:"default",spacing:0});function ds({className:s,variant:e,size:o,spacing:t=0,children:n,...r}){return a(F,{"data-slot":"toggle-group","data-variant":e,"data-size":o,"data-spacing":t,style:{"--gap":t},className:U("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",s),...r,children:a(V.Provider,{value:{variant:e,size:o,spacing:t},children:n})})}function Ur({className:s,children:e,variant:o,size:t,...n}){let r=Ut(V);return a(O,{"data-slot":"toggle-group-item","data-variant":r.variant||o,"data-size":r.size||t,"data-spacing":r.spacing,className:U(_({variant:r.variant||o,size:r.size||t}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",s),...n,children:e})}
|
|
2
|
+
export{ds,Ur};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S,M,w,L,W,a,g,ae,ql,ee,X,We,Je,R,j,vr,V,qe,Re,Ke,U,N,$e,He,Qe,De,Ne,Fe,se,Sv,Iv,kw,Ge,BE,wx,Sx,wh,Dt,rC,nC,dC,JC,ES,xS,wa,cT,W1,Qk,Wk,Jp,Xk,eR,tR,rR,r0,nR,VR,zi,Hd,pu,SO,mu,Qd,Gd,TO,Vd,RO,dP,eD,nD,iD,aD,zg,gu,ct,ut,dt,ft,pt,mt,ht,gt,Se,xe,ke,ot,Ce,Nt,re,er,B,gv,fe,Ve,Br}from"./chunk-akafypge.js";import{Fu}from"./chunk-xd1axsdv.js";import{Tu}from"./chunk-4awk4xhq.js";import{bl}from"./chunk-rjhczkh3.js";import{Ho}from"./chunk-zg0b902x.js";import{Hn}from"./chunk-81b8rfv7.js";import"./chunk-wzrzc07t.js";var Ie=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],Z=j("arrow-down-wide-narrow",Ie);var _e=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],te=j("sliders-vertical",_e);L();function ne({open:o,onOpenChange:l,mode:c,teamId:f,project:i}){let p=ae(),m=We(),[s,h]=w(""),[k,b]=w(!0),[F,y]=w(void 0),[C,v]=w(void 0),[u,_]=w(!1),x=M(null);S(()=>{if(o)if(c==="edit"&&i)h(i.name||""),y(i.coverImageKey),v(i.coverImage),b(i.enableNotification!==!1);else h(""),y(void 0),v(void 0),b(!0)},[o,c,i]);let P=R.api.teams[":teamId"].projects.$post,{mutate:O}=X({mutationFn:async(n)=>{let r=await P({param:{teamId:f},json:n});if(!r.ok)throw Error(JC());return await r.json()},onSuccess:(n)=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1);let r=n;if(r&&typeof r.id==="string")m({to:"/projects/$projectId",params:{projectId:r.id}})}}),A=R.api.projects[":projectId"].$put,{mutate:z}=X({mutationFn:async(n)=>{let r=await A({param:{projectId:i.id},json:n});if(!r.ok)throw Error(ES());return await r.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1)}}),Q=R.api.teams[":teamId"].files.$post,{mutate:E}=X({mutationFn:async({file:n})=>{let r=await Q({param:{teamId:f},form:{file:n}});if(!r.ok)throw Error(wa());return await r.json()},onSuccess:(n)=>{let r=n;if(r&&typeof r.key==="string")y(r.key);_(!1)},onError:()=>{_(!1)}}),d=(n)=>{let r=n.target.files?.[0];if(r){_(!0);let H=URL.createObjectURL(r);v(H),E({file:r})}},D=()=>{x.current?.click()},T=(n)=>{n.stopPropagation(),y(void 0),v(void 0)},I=()=>{if(!s.trim())return;if(c==="create")O({name:s.trim(),coverImageKey:F,enableNotification:k});else if(c==="edit"&&i?.id)z({name:s.trim(),coverImageKey:F,enableNotification:k})};return a(Se,{open:o,onOpenChange:l,children:g(xe,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[g(ke,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[a("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),a("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),a("div",{className:"flex items-center gap-3",children:g("div",{children:[a(Ce,{className:"text-xl font-semibold tracking-tight text-foreground",children:c==="create"?Sx():r0()}),a(Nt,{className:"text-xs text-muted-foreground/80 mt-1",children:c==="create"?BE():cT()})]})})]}),g("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[g("div",{className:"space-y-2",children:[a(fe,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:Jp()}),g("div",{className:"relative",children:[a(re,{id:"name",value:s,onChange:(n)=>h(n.target.value),placeholder:eR(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),s.trim()&&a("div",{className:"absolute inset-y-0 right-3 flex items-center",children:a(qe,{className:"w-4 h-4 text-primary"})})]}),a("p",{className:"text-[11px] text-muted-foreground",children:Xk()})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g("div",{className:"flex items-center justify-between",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a(Hn,{className:"w-4 h-4 text-primary"}),Wk()]}),C&&g("button",{type:"button",onClick:T,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[a(Ke,{className:"w-3.5 h-3.5"}),VR()]})]}),g("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:D,children:[a("input",{type:"file",ref:x,className:"hidden",accept:"image/*",onChange:d}),u&&a("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:g("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[a(V,{className:"w-4 h-4 animate-spin text-primary"}),a("span",{className:"text-xs font-semibold text-foreground",children:gu()})]})}),C?g(W,{children:[a("img",{src:C,alt:wx(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),g("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[a(Ho,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),a("span",{className:"text-xs font-semibold",children:zg()})]})]}):g("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[a("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:a(Ho,{className:"w-4 h-4 text-muted-foreground"})}),g("div",{children:[a("p",{className:"text-xs font-medium text-foreground",children:iD()}),a("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:aD()})]})]})]})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a(te,{className:"w-4 h-4 text-primary"}),rR()]}),g("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[g("div",{className:"space-y-1 pr-4",children:[g("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[a(bl,{className:"w-4 h-4 text-primary"}),Sv()]}),a("p",{className:"text-xs text-muted-foreground leading-normal",children:Iv()})]}),a(Ve,{checked:k,onCheckedChange:b,disabled:u,className:"mt-0.5"})]})]})]}),g(ot,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[a(N,{type:"button",variant:"ghost",onClick:()=>l(!1),disabled:u,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:Ge()}),a(N,{type:"submit",onClick:I,disabled:!s.trim()||u,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:u?g(W,{children:[a(V,{className:"w-4 h-4 animate-spin"}),Qk()]}):c==="create"?wh():zi()})]})]})})}function ie({sortBy:o,sortDirection:l,onSortChange:c}){let f=(s)=>{c(s,l)},i=()=>{c(o,l==="asc"?"desc":"asc")},p=(s)=>{switch(s){case"name":return mu();case"created_at":return SO();case"updated_at":return TO();default:return s}},m=l==="asc";return g(De,{children:[a(Ne,{asChild:!0,children:g(N,{variant:"outline",className:"gap-2 bg-muted/50",children:[a("span",{className:"text-muted-foreground",children:RO()}),a("span",{className:"font-medium text-foreground",children:p(o)})]})}),g(Fe,{align:"end",className:"w-56 p-2",children:[a("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:pu()}),g(De,{children:[a(Ne,{asChild:!0,children:g(N,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[a("span",{children:p(o)}),a(Z,{className:"h-4 w-4 opacity-50"})]})}),a(Fe,{className:"w-52",children:["name","created_at","updated_at"].map((s)=>g(se,{onClick:()=>f(s),className:"justify-between",children:[p(s),o===s&&a(qe,{className:"h-4 w-4"})]},s))})]}),g(N,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:i,children:[a("span",{className:"text-muted-foreground",children:o==="name"?m?a(W,{children:Hd()}):a(W,{children:Vd()}):m?a(W,{children:Gd()}):a(W,{children:Qd()})}),m?a(Tu,{className:"h-4 w-4 opacity-50"}):a(Z,{className:"h-4 w-4 opacity-50"})]})]})]})}L();function Me(){let{teamId:o}=Pe.useParams(),{canEdit:l,canAdmin:c}=er(),f=We(),i=ae(),[p,m]=w(null),[s,h]=w(!1),[k,b]=w("create"),[F,y]=w(void 0),[C,v]=w(!1),[u,_]=w(void 0),[x,P]=w(""),[O,A]=w(!1),{metadata:z,setMetadata:Q}=Br(),E=`team:${o}:projects:sort`,d=z[E],[D,T]=w(()=>d?.sortBy||"name"),[I,n]=w(()=>d?.sortDirection||"asc");S(()=>{if(d?.sortBy&&d.sortBy!==D)T(d.sortBy);if(d?.sortDirection&&d.sortDirection!==I)n(d.sortDirection)},[d]);let r=R.api.teams[":teamId"].projects.$get,{data:H}=ee({queryKey:["teams",o,"projects",D,I],queryFn:async()=>{let e=await r({param:{teamId:o},query:{sortBy:D,sortDirection:I}});if(!e.ok)throw Error("Failed to fetch projects");return await e.json()},placeholderData:ql}),{data:Y}=ee({queryKey:["teams",o,"members"],queryFn:async()=>{let e=await R.api.teams[":teamId"].members.$get({param:{teamId:o},query:{}});if(!e.ok)throw Error("Failed to fetch members");return await e.json()}}),{data:G}=ee({queryKey:["teams",o,"me"],queryFn:async()=>{let e=await R.api.teams[":teamId"].me.$get({param:{teamId:o}});if(!e.ok)throw Error("Failed to fetch me");return await e.json()}}),le=R.api.teams[":teamId"].invite.$post,ce=X({mutationFn:async(e)=>{let t=await le(e);if(!t.ok)throw Error("Failed to invite");return await t.json()}}),q=X({mutationFn:async(e)=>{if(!(await R.api.projects[":projectId"].$delete({param:{projectId:e}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]})}}),de=X({mutationFn:async(e)=>{let t=await R.api.projects[":projectId"].$put({param:{projectId:e.id},json:{enableNotification:!e.enableNotification}});if(!t.ok)throw Error("Failed to update project notification settings");return await t.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]}),B.success(tR())},onError:(e)=>{B.error(e instanceof Error?e.message:xS())}}),J=()=>{b("create"),y(void 0),h(!0)},me=()=>{m("create"),setTimeout(()=>{m(null)},100),setTimeout(()=>{J()},200)},pe=(e)=>{b("edit"),y(e),h(!0)},ue=(e)=>{_(e),P(""),v(!0)},ge=async()=>{if(u&&x==="delete")try{await q.mutateAsync(u.id),v(!1)}catch(e){console.error(e)}},ve=(e,t)=>{if(t.detail>1)return;m(e),setTimeout(()=>{m(null)},100),setTimeout(()=>{f({to:"/projects/$projectId",params:{projectId:e}})},200)},he=async(e)=>(await ce.mutateAsync({param:{teamId:o},json:{role:e}})).code,ye=X({mutationFn:async({userId:e,role:t})=>{if(!(await R.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:o,userId:e},json:{role:t}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),be=X({mutationFn:async(e)=>{if(!(await R.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:o,userId:e}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),we=(e)=>{if(!e)return"??";return e.split(" ").map((t)=>t[0]).slice(0,2).join("").toUpperCase()},je=(e,t)=>{T(e),n(t),Q(o,E,{sortBy:e,sortDirection:t})},K=Array.isArray(Y)?Y:[];return g("div",{className:"flex-1 overflow-y-auto p-4",children:[g("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[a("h1",{className:"text-2xl font-bold",children:nR()}),g("div",{className:"flex flex-wrap items-center gap-4",children:[g("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>A(!0),"data-testid":"team-members-trigger",children:[K.slice(0,3).map((e)=>g($e,{className:"border-2 border-background w-8 h-8",children:[e.image&&a(He,{src:e.image,alt:e.name,className:"object-cover"}),a(Qe,{className:"text-[10px]",children:we(e.name)})]},e.id)),K.length>3&&g("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",K.length-3]})]}),a(ie,{sortBy:D,sortDirection:I,onSortChange:je}),l&&g(N,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:J,children:[a(Re,{className:"w-4 h-4"}),wh()]})]})]}),g("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[H?.data?.map((e)=>a("div",{className:U("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",p===e.id?"scale-95":"scale-100"),onClick:(t)=>ve(e.id,t),children:g("div",{className:"flex flex-col",children:[g("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[e.coverImage?a("img",{src:e.coverImage,alt:e.name,className:"w-full h-full object-cover rounded"}):g("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[a("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),a("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),a("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),a("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),a("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),a("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),a("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),a("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),a("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),a("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),a("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),a("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),a("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),a("p",{className:"absolute left-1 bottom-2 text-white",children:e.name})]}),g("div",{className:"px-2 h-10 flex justify-between items-center",children:[g("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[nD()," ",gv(e.updatedAt??"")]}),a("div",{onClick:(t)=>t.stopPropagation(),children:g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a("button",{className:"hover:bg-muted outline-none flex px-1",children:a(vr,{className:"w-5 h-5 text-muted-foreground"})})}),g(Fe,{align:"end",children:[l&&a(se,{onClick:(t)=>{t.stopPropagation(),pe(e)},children:r0()}),g(se,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(t)=>{t.preventDefault(),de.mutate(e)},children:[a("span",{children:W1()}),a(Ve,{checked:e.enableNotification??!0,className:"pointer-events-none"})]}),c&&a(se,{className:"text-destructive focus:text-destructive",onClick:()=>ue(e),children:Dt()})]})]})})]})]})},e.id)),l&&a("div",{className:U("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",p==="create"?"scale-95":"scale-100"),onClick:me,children:g("div",{className:"flex flex-col",children:[a("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:a(Re,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),a("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:a("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:wh()})})]})})]}),a(ne,{open:s,onOpenChange:h,mode:k,teamId:o,project:F}),a(ct,{open:C,onOpenChange:v,children:g(ut,{children:[g(dt,{children:[a(pt,{children:kw()}),g(mt,{children:[nC({name:u?.name??""}),g("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[a("span",{className:"text-sm font-medium",children:eD()}),a(re,{value:x,onChange:(e)=>P(e.target.value),placeholder:rC(),className:"h-9",autoFocus:!0})]})]})]}),g(ft,{children:[a(gt,{disabled:q.isPending,children:Ge()}),a(ht,{onClick:(e)=>{e.preventDefault(),ge()},disabled:x!=="delete"||q.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q.isPending?dC():Dt()})]})]})}),a(Fu,{open:O,onOpenChange:A,title:dP(),type:"team",members:K,isOwner:G?.role==="owner",onInvite:he,onUpdateRole:async(e,t)=>{await ye.mutateAsync({userId:e,role:t})},onRemoveMember:async(e)=>{await be.mutateAsync(e)},currentUserId:G?.id})]})}var Pe=Je("/teams/$teamId/")({component:Me});export{Pe as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{j}from"./chunk-akafypge.js";var a=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Hn=j("sparkles",a);
|
|
2
|
+
export{Hn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{j}from"./chunk-akafypge.js";var e=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],$o=j("users",e);
|
|
2
|
+
export{$o};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
async function ko(o){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText==="function")try{return await navigator.clipboard.writeText(o),!0}catch{}try{let e=document.createElement("textarea");e.value=o,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="2em",e.style.height="2em",e.style.padding="0",e.style.border="none",e.style.outline="none",e.style.boxShadow="none",e.style.background="transparent",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select();let t=document.execCommand("copy");return document.body.removeChild(e),t}catch(e){return console.error("Failed to copy text to clipboard:",e),!1}}async function km(o){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.write==="function"&&typeof ClipboardItem<"u")try{let e=o.then((t)=>{if(!t)throw Error("EMPTY_TEXT");return new Blob([t],{type:"text/plain"})});return e.catch(()=>{}),await navigator.clipboard.write([new ClipboardItem({"text/plain":e})]),await o,!0}catch{}try{let e=await o;if(!e)return!1;return await ko(e)}catch(e){return console.error("Failed to copy deferred text to clipboard:",e),!1}}async function Lu(o){if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.write!=="function"||typeof ClipboardItem>"u")return!1;let e=async()=>{let t=await o,d=await(await fetch(t)).blob(),r=new Image;r.crossOrigin="anonymous";let c=URL.createObjectURL(d);r.src=c;try{await new Promise((n,p)=>{r.onload=n,r.onerror=(b)=>p(Error("Failed to load image: "+String(b)))});let a=document.createElement("canvas");a.width=r.width,a.height=r.height;let l=a.getContext("2d");if(!l)throw Error("Could not get canvas context");l.drawImage(r,0,0);let s=await new Promise((n)=>{a.toBlob(n,"image/png")});if(!s)throw Error("Failed to convert image to PNG");return s}finally{URL.revokeObjectURL(c)}};try{let t=e();try{return await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),!0}catch{let i=await t;return await navigator.clipboard.write([new ClipboardItem({"image/png":i})]),!0}}catch(t){return console.error("Failed to copy image to clipboard:",t),!1}}
|
|
2
|
+
export{ko,km,Lu};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ye}from"./chunk-4p31kxjh.js";var eA={};Ye(eA,{JOSEAlgNotAllowed:()=>X,JOSEError:()=>dn,JOSENotSupported:()=>m,JWEDecryptionFailed:()=>we,JWEInvalid:()=>u,JWKInvalid:()=>ge,JWKSInvalid:()=>_l,JWKSMultipleMatchingKeys:()=>vc,JWKSNoMatchingKey:()=>yl,JWKSTimeout:()=>vl,JWSInvalid:()=>zr,JWSSignatureVerificationFailed:()=>Qu,JWTClaimValidationFailed:()=>P,JWTExpired:()=>yi,JWTInvalid:()=>jr});var Im={};Ye(Im,{decode:()=>I,encode:()=>mr});var ye=new TextEncoder,F=new TextDecoder,te=new TextDecoder("utf-8",{fatal:!0});function b(...e){let t=e.reduce((o,{length:i})=>o+i,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function et(e,t,r){if(t<0||t>=4294967296)throw RangeError(`value must be >= 0 and <= 4294967295. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],r)}function tt(e){let t=Math.floor(e/4294967296),r=e%4294967296,n=new Uint8Array(8);return et(n,t,0),et(n,r,4),n}function Te(e){let t=new Uint8Array(4);return et(t,e),t}function g(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}var Ie=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function rt(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function Oe(e,t){let{modulusLength:r}=t.algorithm;if(typeof r!=="number"||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function N(e,t,r){let n=e.algorithm;if(n.name!==t.name)throw Ie(t.name);if(t.hash&&n.hash?.name!==t.hash)throw Ie(t.hash,"algorithm.hash");if(t.namedCurve&&n.namedCurve!==t.namedCurve)throw Ie(t.namedCurve,"algorithm.namedCurve");if(t.length!==void 0&&n.length!==t.length)throw Ie(t.length,"algorithm.length");rt(e,r)}function vt(e,t,...r){if(r.length>2){let n=r.pop();e+=`one of type ${r.join(", ")}, or ${n}.`}else if(r.length===2)e+=`one of type ${r[0]} or ${r[1]}.`;else e+=`of type ${r[0]}.`;if(t==null)e+=` Received ${t}`;else if(typeof t==="function"&&t.name)e+=` Received function ${t.name}`;else if(typeof t==="object"&&t!=null){if(t.constructor?.name)e+=` Received an instance of ${t.constructor.name}`}return e}var R=(e,...t)=>vt("Key must be ",e,...t),he=(e,t,...r)=>vt(`Key for the ${e} algorithm must be `,t,...r);class dn extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t);this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class P extends dn{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}}class yi extends dn{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}}class X extends dn{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class m extends dn{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class we extends dn{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}}class u extends dn{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class zr extends dn{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class jr extends dn{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class ge extends dn{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class _l extends dn{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class yl extends dn{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t)}}class vc extends dn{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}class vl extends dn{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",t){super(e,t)}}class Qu extends dn{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}function _e(e){if(!H(e))throw Error("CryptoKey instance expected")}var H=(e)=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},nt=(e)=>e?.[Symbol.toStringTag]==="KeyObject",De=(e)=>H(e)||nt(e);var k=(e)=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3));function Ct(e,t){let r=e.byteLength<<3;if(r!==t)throw new u(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)}var wr=(e)=>crypto.getRandomValues(new Uint8Array(e.ivBits>>3));function Wt(e,t){if(t.length<<3!==e.ivBits)throw new u("Invalid Initialization Vector length")}async function Pt(e,t,r){if(!(t instanceof Uint8Array))throw TypeError(R(t,"Uint8Array"));let n=e.cekBits>>1,o=await crypto.subtle.importKey("raw",t.subarray(n>>3),"AES-CBC",!1,[r]),i=await crypto.subtle.importKey("raw",t.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]);return[o,i,n]}async function Tt(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function gr(e,t,r,n,o){let[i,a,s]=await Pt(e,r,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},i,t)),p=b(o,n,c,tt(o.length*8)),d=await Tt(a,p,s);return{ciphertext:c,tag:d,iv:n}}async function Er(e,t){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),o=await crypto.subtle.sign(r,n,e);return crypto.subtle.verify(r,n,o,t)}async function br(e,t,r,n,o,i){let[a,s,c]=await Pt(e,t,"decrypt"),p=b(i,n,r,tt(i.length*8)),d=await Tt(s,p,c);try{if(await Er(o,d))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},a,r))}catch{}throw new we}async function Sr(e,t,r,n,o){let i=r instanceof Uint8Array?await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(N(r,e.subtle,"encrypt"),r),a=new Uint8Array(await crypto.subtle.encrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},i,t)),s=a.slice(-16);return{ciphertext:a.slice(0,-16),tag:s,iv:n}}async function xr(e,t,r,n,o,i){let a=t instanceof Uint8Array?await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(N(t,e.subtle,"decrypt"),t);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},a,b(r,o)))}catch{throw new we}}async function Ue(e,t,r,n,o){if(!H(r)&&!(r instanceof Uint8Array))throw TypeError(R(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n)Wt(e,n);else n=wr(e);if(r instanceof Uint8Array)Ct(r,e.cekBits);return e.cbc?gr(e,t,r,n,o):Sr(e,t,r,n,o)}async function Ne(e,t,r,n,o,i){if(!H(t)&&!(t instanceof Uint8Array))throw TypeError(R(t,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new u("JWE Initialization Vector missing");if(!o)throw new u("JWE Authentication Tag missing");if(!e.cbc&&o.length!==16)throw new u("Invalid Authentication Tag length");if(Wt(e,n),t instanceof Uint8Array)Ct(t,e.cekBits);return e.cbc?br(e,t,r,n,o,i):xr(e,t,r,n,o,i)}function ot(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=32768,r=[];for(let n=0;n<e.length;n+=t)r.push(String.fromCharCode.apply(null,e.subarray(n,n+t)));return btoa(r.join(""))}function Re(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}var it="The input to be decoded is not correctly encoded.";function I(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64(typeof e==="string"?e:F.decode(e),{alphabet:"base64url"})}catch(r){throw TypeError(it,{cause:r})}let t=e;if(t instanceof Uint8Array)t=F.decode(t);if(t.includes("+")||t.includes("/"))throw TypeError(it);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return Re(t)}catch{throw TypeError(it)}}function mr(e){let t=e;if(typeof t==="string")t=ye.encode(t);if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:"base64url",omitPadding:!0});return ot(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Y(e,t){if(!(e instanceof Uint8Array))throw TypeError(`${t} must be an instance of Uint8Array`)}function E(e){if(typeof e!=="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function He(e){return E(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(E)}function It(...e){let t=new Set;for(let r of e){if(!r)continue;for(let n of Object.keys(r)){if(t.has(n))return!1;t.add(n)}}return!0}var Ot=Symbol();function q(e,t){if(e!==void 0)throw TypeError(`${t} can only be called once`)}function A(e,t,r){try{return I(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}function at(e,t,r){try{return g(e)}catch{throw new r(`The ${t} is not a valid base64url string`)}}async function ke(e,t){let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,t))}function V(e,t,r){let n;try{n=JSON.parse(te.decode(I(e)))}catch{throw new t(r)}if(!E(n))throw new t(r);return n}async function B(e,t){if(t.kty==="RSA"&&"oth"in t&&t.oth!==void 0)throw new m('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,n=!!(t.d||t.priv),o={...t};if(o.kty!=="AKP")delete o.alg;return delete o.use,crypto.subtle.importKey("jwk",o,r,t.ext??!n,t.key_ops??e.usages[n?1:0])}function re(e){return{__proto__:null,...e}}function Be(e){let t=re(e);if(t.ext!==void 0&&typeof t.ext!=="boolean")throw TypeError('"ext" (Extractable) Parameter must be a boolean');if(t.key_ops!==void 0){let r=t.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some((o)=>typeof o!=="string")||new Set(n).size!==n.length)throw TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}var st=(e)=>e[Symbol.toStringTag],Ar=(e,t,r)=>{let{alg:n}=e;if(t.use!==void 0){let o=r==="sign"||r==="verify"?"sig":"enc";if(t.use!==o)throw TypeError(`Invalid key for this operation, its "use" must be "${o}" when present`)}if(t.alg!==void 0&&t.alg!==n)throw TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(t.key_ops)){let o=r==="encrypt"||r==="decrypt"?e.ops?.[r==="encrypt"?0:1]:r;if(o&&!t.key_ops.includes(o))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${o}" when present`)}};function Kr(e,t,r){let{alg:n,secret:o}=e,i=r==="decrypt"||r==="sign";if(o&&t instanceof Uint8Array)return[Dt,t];if(E(t)){let a=Be(t);if(typeof a.kty!=="string")throw TypeError(o?he(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):he(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(o?a.kty==="oct"&&typeof a.k==="string":a.kty!=="oct"&&(i?a.kty==="AKP"&&typeof a.priv==="string"||typeof a.d==="string":a.d===void 0&&a.priv===void 0)))throw TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);return Ar(e,a,r),[Rt,t,a]}if(!De(t))throw TypeError(o?he(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):he(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(o){if(t.type!=="secret")throw TypeError(`${st(t)} instances for symmetric algorithms must be of type "secret"`)}else{if(t.type==="secret")throw TypeError(`${st(t)} instances for asymmetric algorithms must not be of type "secret"`);let a=i?"private":"public";if((t.type==="public"||t.type==="private")&&t.type!==a){let s=r==="sign"?"signing":r==="verify"?"verifying":`${r.slice(0,-1)}tion`;throw TypeError(`${st(t)} instances for asymmetric algorithm ${s} must be of type "${a}"`)}}return H(t)?[Ut,t]:[Nt,t]}var Dt=0,Ut=1,Nt=2,Rt=3,ct,Jr={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function Me(e,t,r){ct||=new WeakMap;let n=ct.get(e);if(r)if(n)n[t]=r;else ct.set(e,{[t]:r});return r??n?.[t]}var _t=async(e,t,r)=>Me(e,r.alg)??Me(e,r.alg,await B(r,{...t,alg:r.alg})),vr=(e,t)=>{let r=Me(e,t.alg);if(r)return r;let n=e.type==="public",o=t.usages[n?0:1],{asymmetricKeyType:i}=e,a=Jr[e.asymmetricKeyDetails?.namedCurve],s=t.resolve?.({crv:a,asymmetricKeyType:i})??t.subtle;return Me(e,t.alg,e.toCryptoKey(s,n,o))};async function O(e,t,r){let n=Kr(e,t,r);switch(n[0]){case Dt:case Ut:return n[1];case Rt:{let o=n[1],i=n[2];if(i.kty==="oct")return I(i.k);if(!Object.isFrozen(o)){let{key_ops:a}=o;if(Array.isArray(a))Object.freeze(a);Object.freeze(o)}return _t(o,i,e)}case Nt:{let o=n[1];if(o.type==="secret")return o.export();if("toCryptoKey"in o&&typeof o.toCryptoKey==="function")return vr(o,e);return _t(o,o.export({format:"jwk"}),e)}}}function Ee(e){let t={__proto__:null};for(let r in e)t[r]={...e[r],alg:r};return t}var Cr=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],Wr=[[],["deriveBits"]],je=[[],[]];function Le(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:`SHA-${e}`},usages:Cr,ops:["wrapKey","unwrapKey"]}}function $e(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:({kty:e,crv:t,asymmetricKeyType:r})=>{if(t==="X25519"||r==="x25519")return{name:"X25519"};if(e==="OKP")throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:t}},usages:Wr,ops:[void 0,"deriveBits"]}}function ne(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:je,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function pt(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:je,ops:["deriveBits","deriveBits"]}}var dt=Ee({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:je,ops:["encrypt","decrypt"]},"RSA-OAEP":Le(1),"RSA-OAEP-256":Le(256),"RSA-OAEP-384":Le(384),"RSA-OAEP-512":Le(512),"ECDH-ES":$e(),"ECDH-ES+A128KW":$e(),"ECDH-ES+A192KW":$e(),"ECDH-ES+A256KW":$e(),A128KW:ne(128),A192KW:ne(192),A256KW:ne(256),A128GCMKW:ne(128,!0),A192GCMKW:ne(192,!0),A256GCMKW:ne(256,!0),"PBES2-HS256+A128KW":pt(),"PBES2-HS384+A192KW":pt(),"PBES2-HS512+A256KW":pt()}),Pr=["encrypt","decrypt"];function oe(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:je,ops:Pr,cekBits:e,ivBits:t?128:96,cbc:t}}var Tr=Ee({A128GCM:oe(128),A192GCM:oe(192),A256GCM:oe(256),"A128CBC-HS256":oe(256,!0),"A192CBC-HS384":oe(384,!0),"A256CBC-HS512":oe(512,!0)});function Ht(e,t){throw new m(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function _(e){return(typeof e==="string"?dt[e]:void 0)??Ht("alg","Algorithm")}function Z(e){return(typeof e==="string"?Tr[e]:void 0)??Ht("enc","Encryption Algorithm")}function kt(e,t){if(e.algorithm.name!=="ECDH"&&e.algorithm.name!=="X25519")throw TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");rt(e,t)}async function Mt(e,t,r){let n=_(t).subtle,o=e instanceof Uint8Array?await crypto.subtle.importKey("raw",e,"AES-KW",!0,[r]):e;return N(o,n,r),o}async function ut(e,t,r){let n=await Mt(t,e,"wrapKey"),o=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",o,n,"AES-KW"))}async function ft(e,t,r){let n=await Mt(t,e,"unwrapKey"),o=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",o))}function Lt(e,t,r){N(t,_(e).subtle,r),Oe(e,t)}function Ir(e,t){if(e instanceof Uint8Array)return crypto.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);return N(e,_(t).subtle,"deriveBits"),e}async function $t(e,t,r,n){if(!(e instanceof Uint8Array)||e.length<8)throw new u("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new u("PBES2 Count Input must be a positive integer");let o=b(g(t),Uint8Array.of(0),e),i=parseInt(t.slice(13,16),10),a={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:o},s=await Ir(n,t);return new Uint8Array(await crypto.subtle.deriveBits(a,s,i))}function lt(e){return b(Te(e.length),e)}async function Or(e,t,r){let n=t>>3,o=32,i=Math.ceil(n/32),a=new Uint8Array(i*32);for(let s=1;s<=i;s++){let c=await ke("sha256",b(Te(s),e,r));a.set(c,(s-1)*32)}return a.slice(0,n)}async function jt(e,t,r,n,o=new Uint8Array,i=new Uint8Array){kt(e),kt(t,"deriveBits");let a=b(lt(g(r)),lt(o),lt(i),Te(n)),s=new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,e.algorithm.name==="X25519"?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3));return Or(s,n,a)}function Vt(e){_e(e);let t=e.algorithm.namedCurve;if(t!=="P-256"&&t!=="P-384"&&t!=="P-521"&&e.algorithm.name!=="X25519")throw new m("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function be(e){if(e===void 0)throw new u("JWE Encrypted Key missing")}function Bt(e){if(e!==void 0)throw new u("Encountered unexpected JWE Encrypted Key")}async function zt(e,t,r,n,o,i){let a=_(e);if(e==="dir")return Bt(n),r;switch(a.subtle.name){case"ECDH":{if(e==="ECDH-ES")Bt(n);if(!E(o.epk))throw new u('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');Vt(r);let s=await B(a,o.epk),c,p;if(o.apu!==void 0){if(typeof o.apu!=="string")throw new u('JOSE Header "apu" (Agreement PartyUInfo) invalid');c=A(o.apu,"apu",u)}if(o.apv!==void 0){if(typeof o.apv!=="string")throw new u('JOSE Header "apv" (Agreement PartyVInfo) invalid');p=A(o.apv,"apv",u)}let d=await jt(s,r,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),c,p);if(e==="ECDH-ES")return d;return be(n),ft(e.slice(-6),d,n)}case"RSA-OAEP":return be(n),_e(r),Lt(e,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(be(n),typeof o.p2c!=="number")throw new u('JOSE Header "p2c" (PBES2 Count) missing or invalid');let s=i||1e4;if(o.p2c>s)throw new u('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof o.p2s!=="string")throw new u('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let c=A(o.p2s,"p2s",u),p=await $t(c,e,o.p2c,r);return ft(e.slice(-6),p,n)}case"AES-KW":return be(n),ft(e,r,n);case"AES-GCM":{if(be(n),typeof o.iv!=="string")throw new u('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof o.tag!=="string")throw new u('JOSE Header "tag" (Authentication Tag) missing or invalid');let s;s=A(o.iv,"iv",u);let c;return c=A(o.tag,"tag",u),Ne(Z(e.slice(0,-2)),r,n,s,c,new Uint8Array)}}}async function Gt(e,t,r,n,o={}){let i,a,s,c=_(e);if(e==="dir")return[r,void 0,void 0];switch(c.subtle.name){case"ECDH":{Vt(r);let{apu:p,apv:d}=o;if(p!==void 0)Y(p,'"apu"');if(d!==void 0)Y(d,'"apv"');let f;if(o.epk!==void 0)f=await O(c,o.epk,"decrypt");else f=(await crypto.subtle.generateKey(r.algorithm,!0,["deriveBits"])).privateKey;let l=crypto.subtle,S=f;if(!S.extractable){if(typeof l.getPublicKey!=="function")throw TypeError('CryptoKey for "epk" must be extractable');S=await l.getPublicKey(f,[])}let{x:v,y:w,crv:h,kty:J}=await l.exportKey("jwk",S),y=await jt(r,f,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),p,d);if(a={epk:{x:v,crv:h,kty:J}},J==="EC")a.epk.y=w;if(p)a.apu=mr(p);if(d)a.apv=mr(d);if(e==="ECDH-ES"){s=y;break}s=n||k(t);let x=e.slice(-6);i=await ut(x,y,s);break}case"RSA-OAEP":{s=n||k(t),_e(r),Lt(e,r,"encrypt"),i=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",r,s));break}case"PBKDF2":{s=n||k(t);let{p2c:p=2048,p2s:d=crypto.getRandomValues(new Uint8Array(16))}=o,f=await $t(d,e,p,r);i=await ut(e.slice(-6),f,s),a={p2c:p,p2s:mr(d)};break}case"AES-KW":{s=n||k(t),i=await ut(e,r,s);break}case"AES-GCM":{s=n||k(t);let{iv:p}=o,d=await Ue(Z(e.slice(0,-2)),s,r,p,new Uint8Array);i=d.ciphertext,a={iv:mr(d.iv),tag:mr(d.tag)};break}}return[s,i,a]}var ie={__proto__:null,b64:!0},Ve={__proto__:null};function Se(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some((r)=>typeof r!=="string")))throw TypeError(`"${e}" option must be an array of strings`);if(!t)return;return new Set(t)}function ze(e,t){let{crit:r}=t??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function D(e,t,r,n,o){if(o.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some((a)=>typeof a!=="string"||a.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?t:{__proto__:null,...r,...t};for(let a of n.crit){if(!(a in i))throw new m(`Extension Header Parameter "${a}" is not recognized`);if(!Object.hasOwn(o,a)||o[a]===void 0)throw new e(`Extension Header Parameter "${a}" is missing`);if(i[a]&&(!Object.hasOwn(n,a)||n[a]===void 0))throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`)}return n.crit}function ae(e,t){if(t.includes("b64")){let r=e.b64;if(typeof r!=="boolean")throw new zr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function se(e,t){let r,n;try{r=JSON.stringify(t),n=JSON.parse(r)}catch(o){throw new e("JOSE Header is not valid JSON",{cause:o})}if(!E(n))throw new e("JOSE Header is not a JSON object");return[n,r]}function Ge(e,t){if(e.zip!==void 0&&e.zip!=="DEF")throw new m('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(e.zip!==void 0&&!t?.zip)throw new u('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function Ft(e){if(typeof globalThis[e]>"u")throw new m(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function Xt(e){Ft("CompressionStream");let t=new CompressionStream("deflate-raw"),r=t.writable.getWriter();r.write(e).catch(()=>{}),r.close().catch(()=>{});let n=[],o=t.readable.getReader();for(;;){let{value:i,done:a}=await o.read();if(a)break;n.push(i)}return b(...n)}async function Yt(e,t){Ft("DecompressionStream");let r=new DecompressionStream("deflate-raw"),n=r.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let o=[],i=0,a=r.readable.getReader();for(;;){let{value:s,done:c}=await a.read();if(c)break;if(o.push(s),i+=s.byteLength,t!==1/0&&i>t)throw new u("Decompressed plaintext exceeded the configured limit")}return b(...o)}function qt(e){return[e&&Se("keyManagementAlgorithms",e.keyManagementAlgorithms),e&&Se("contentEncryptionAlgorithms",e.contentEncryptionAlgorithms),e?.crit,e?.maxPBES2Count,e?.maxDecompressedLength]}async function _r(e,t,r,n,o){let[i,a,s,c,p]=r,[d,f,l,S,v]=t,{encrypted_key:w}=e;D(u,Ve,s,d,o),Ge(o,d);let{alg:h,enc:J}=o;if(typeof h!=="string"||!h)throw new u("missing JWE Algorithm (alg) in JWE Header");if(typeof J!=="string"||!J)throw new u("missing JWE Encryption Algorithm (enc) in JWE Header");if(i&&!i.has(h)||!i&&h.startsWith("PBES2"))throw new X('"alg" (Algorithm) Header Parameter value not allowed');if(a&&!a.has(J))throw new X('"enc" (Encryption Algorithm) Header Parameter value not allowed');let y=Z(J),x;if(w!==void 0)x=A(w,"encrypted_key",u);let C=!1;if(typeof n==="function")n=await n(d,e),C=!0;let U=_(h),T=await O(h==="dir"?y:U,n,"decrypt"),W;try{if(W=await zt(h,y,T,x,o,c),w!==void 0&&W instanceof Uint8Array&&W.byteLength<<3!==y.cekBits)W=k(y)}catch(K){if(K instanceof TypeError||K instanceof u||K instanceof m)throw K;W=k(y)}let z=await Ne(y,W,f,l,S,v);if(o.zip==="DEF"){let K=p??250000;if(K===0)throw new m('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(K!==1/0&&(!Number.isSafeInteger(K)||K<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");z=await Yt(z,K).catch((G)=>{if(G instanceof u)throw G;throw new u("Failed to decompress plaintext",{cause:G})})}return[z,d,T,C]}async function Zt(e,t,r){if(e instanceof Uint8Array)e=F.decode(e);if(typeof e!=="string")throw new u("Compact JWE must be a string or Uint8Array");let{0:n,1:o,2:i,3:a,4:s,length:c}=e.split(".");if(c!==5)throw new u("Invalid Compact JWE");let p={ciphertext:a,iv:i||void 0,protected:n,tag:s||void 0,encrypted_key:o||void 0},d=V(n,u,"JWE Protected Header is invalid"),f=g(n),l=[d,A(a,"ciphertext",u),i?A(i,"iv",u):void 0,s?A(s,"tag",u):void 0,f];return _r(p,l,t,r,d)}function Qt(e,t,r){if(!It(e,t,r))throw new u("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function Dr(e){let[,t,r,n,o,i,a,s,c]=e;if(o!==void 0)Y(o,"JWE Additional Authenticated Data");if(i!==void 0)Y(i,"JWE Content Encryption Key");if(a!==void 0)Y(a,"JWE Initialization Vector");if(t!==void 0)t=se(u,t)[0],e[1]=t;if(r!==void 0)r=se(u,r)[0],e[2]=r;if(n!==void 0)n=se(u,n)[0],e[3]=n;if(s!==void 0&&!E(s))throw TypeError("JWE Key Management Parameters must be an object");Qt(t,r,n);let p={...t,...r,...n};ze(u,t),D(u,Ve,c,t,p),Ge(p,t);let{alg:d,enc:f}=p;if(typeof d!=="string"||!d)throw new u('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof f!=="string"||!f)throw new u('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[p,d,f,Z(f)]}async function Ur(e,t,r){let[n,o,,i]=t,[a,s,c,p,d,f,l,S,,v]=e,w=s,h=c;if(f&&(o==="dir"||o==="ECDH-ES"))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${o}`);let J=_(o),y=await O(o==="dir"?i:J,r,"encrypt"),[x,C,U]=await Gt(o,i,y,f,S);if(U){if(v)h=h?{...h,...U}:U;else w=w?{...w,...U}:U;Qt(w,h,p)}let T,W;if(w)T=mr(JSON.stringify(w)),W=g(T);else T="",W=new Uint8Array;let z,K;if(d?.byteLength)K=mr(d),z=b(W,g("."),g(K));else z=W;let G=a;if(n.zip==="DEF")G=await Xt(G).catch((hr)=>{throw new u("Failed to compress plaintext",{cause:hr})});let{ciphertext:yr,tag:Kt,iv:Jt}=await Ue(i,G,x,l,z),j={ciphertext:mr(yr)};if(Jt)j.iv=mr(Jt);if(Kt)j.tag=mr(Kt);if(C)j.encrypted_key=mr(C);if(K)j.aad=K;if(w)j.protected=T;if(p)j.unprotected=p;if(h)j.header=h;return j}async function er(e,t,r){if(!e[1]&&!e[2]&&!e[3])throw new u("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(r!==void 0)e[8]=r?.crit,e[9]=r?Ot in r:!1;return Ur(e,Dr(e),t)}async function tr(e,t,r){if(t instanceof Uint8Array)return crypto.subtle.importKey("raw",t,e.subtle,!1,[r]);if(N(t,e.subtle,r),e.minRsaBits)Oe(e.alg,t);return t}async function rr(e,t,r){let n=await tr(e,t,"sign"),o=await crypto.subtle.sign(e.signing,n,r);return new Uint8Array(o)}async function nr(e,t,r,n){let o=await tr(e,t,"verify");try{return await crypto.subtle.verify(e.signing,o,r,n)}catch{return!1}}var xe=[["verify"],["sign"]];function mt(e){let t={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:xe}}function ce(e,t){let n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:n,signing:t?{...n,saltLength:t}:n,usages:xe,minRsaBits:2048}}function yt(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:xe}}function or(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:xe}}function ht(e){let r={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:r,signing:r,usages:xe}}var Ae=Ee({HS256:mt(256),HS384:mt(384),HS512:mt(512),RS256:ce(256),RS384:ce(384),RS512:ce(512),PS256:ce(256,32),PS384:ce(384,48),PS512:ce(512,64),ES256:yt("P-256",256),ES384:yt("P-384",384),ES512:yt("P-521",512),EdDSA:or(),Ed25519:or(),"ML-DSA-44":ht(44),"ML-DSA-65":ht(65),"ML-DSA-87":ht(87)});function Fe(e){let t=typeof e==="string"?Ae[e]:void 0;if(!t)throw new m(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}function Xe(e){return[e&&Se("algorithms",e.algorithms),e?.crit]}function Nr(e,t=e===void 0?{}:V(e,zr,"JWS Protected Header is invalid")){return t}function Rr(e,t,r){let n=ae(e,D(zr,ie,r[1],e,t)),o=t.alg;if(typeof o!=="string"||!o)throw new zr('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(r[0]&&!r[0].has(o))throw new X('"alg" (Algorithm) Header Parameter value not allowed');return[n,o]}function Hr(e){try{return g(e)}catch{throw new zr("JWS Compact Serialization payload must use only ASCII characters")}}async function kr(e,t,r,n,o,i,a){let s=!1;if(typeof r==="function")r=await r(o,e),s=!0;let c=typeof a==="string",p=Fe(i),d=b(n!==void 0?g(n):new Uint8Array,g("."),c?t[2]??=at(a,"payload",zr):a),f=A(e.signature,"signature",zr),l=await O(p,r,"verify");if(!await nr(p,l,f,d))throw new Qu;return[c?A(a,"payload",zr):a,o,c,l,s]}async function qe(e,t,r){if(e instanceof Uint8Array)e=F.decode(e);if(typeof e!=="string")throw new zr("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:i,length:a}=e.split(".");if(a!==3)throw new zr("Invalid Compact JWS");let s={payload:o,protected:n,signature:i},c=Nr(n),[p,d]=Rr(c,c,t),f=p?o:Hr(o);return kr(s,t,r,n,c,d,f)}async function Gu(e,t,r){let n=await qe(e,Xe(r),t),o={payload:n[0],protectedHeader:n[1]};if(typeof t==="function")return{...o,key:n[3]};return o}var Ke=(e)=>Math.floor(e.getTime()/1000),Br={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Mr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,pe="check_failed";function wt(){throw TypeError("Invalid time period format")}function Ze(e){if(typeof e!=="string")wt();let t=Mr.exec(e);if(!t||t[4]&&t[1])wt();let r=parseFloat(t[2]),n=Math.round(r*Br[t[3][0].toLowerCase()]);if(!Number.isFinite(n))wt();if(t[1]==="-"||t[4]==="ago")return-n;return n}function de(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}function gt(e,t){if(typeof t!=="string")throw TypeError(`"${e}" claim must be a string`)}function Lr(e){if(typeof e!=="string"&&(!Array.isArray(e)||Array.from(e).some((t)=>typeof t!=="string")))throw TypeError('"aud" claim must be a string or an array of strings')}function Et(e,t){if(typeof e==="number")return de(t,e);if(e instanceof Date)return de(t,Ke(e));return Ke(new Date)+Ze(e)}var ir=(e)=>{let t=e.toLowerCase();return e.includes("/")?t:`application/${t}`},$r=(e,t)=>{if(typeof e==="string")return t.includes(e);if(Array.isArray(e))return t.some((r)=>e.includes(r));return!1};function bt(e,t,r=!1){let n=e[t];if(n===void 0&&!r)return;if(typeof n!=="number")throw new P(`"${t}" claim must be a number`,e,t,"invalid");return n}function St(e,t){throw new P(`unexpected "${t}" claim value`,e,t,pe)}function ue(e,t,r={}){let n;try{n=JSON.parse(te.decode(t))}catch{}if(!E(n))throw new jr("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o!==void 0&&(typeof e.typ!=="string"||ir(e.typ)!==ir(o)))throw new P('unexpected "typ" JWT header value',n,"typ",pe);let{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:p}=r,d=[...i];if(p!==void 0)d.push("iat");if(c!==void 0)d.push("aud");if(s!==void 0)d.push("sub");if(a!==void 0)d.push("iss");for(let y of new Set(d.reverse()))if(!Object.hasOwn(n,y))throw new P(`missing required "${y}" claim`,n,y,"missing");if(a!==void 0&&!(Array.isArray(a)?a:[a]).includes(n.iss))St(n,"iss");if(s!==void 0&&n.sub!==s)St(n,"sub");if(c!==void 0&&!$r(n.aud,typeof c==="string"?[c]:c))St(n,"aud");let{clockTolerance:f}=r,l=0;if(typeof f==="string")l=Ze(f);else if(f!==void 0){if(typeof f!=="number")throw TypeError("Invalid clockTolerance option type");l=f}de("clockTolerance option",l);let{currentDate:S}=r,v=de("currentDate option",Ke(S===void 0?new Date:S)),w=bt(n,"iat",p!==void 0),h=bt(n,"nbf");if(h!==void 0){if(h>v+l)throw new P('"nbf" claim timestamp check failed',n,"nbf",pe)}let J=bt(n,"exp");if(J!==void 0){if(J<=v-l)throw new yi('"exp" claim timestamp check failed',n,"exp",pe)}if(p!==void 0){let y=v-w,x=de("maxTokenAge option",typeof p==="number"?p:Ze(p));if(y-l>x)throw new yi('"iat" claim timestamp check failed (too far in the past)',n,"iat",pe);if(y<-l)throw new P('"iat" claim timestamp check failed (it should be in the past)',n,"iat",pe)}return n}var ar;function M(e){return ar.get(e)}function fe(e){let t=M(e);for(let r of["iat","nbf","exp"]){let n=t[r];if(typeof n==="number"&&!Number.isFinite(n))throw TypeError(`"${r}" claim must be a finite number`)}return ye.encode(JSON.stringify(t))}function Qe(e,t){return M(e)[t]}class Q{constructor(e={}){if(!E(e))throw TypeError("JWT Claims Set MUST be an object");(ar||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return gt("iss",e),M(this).iss=e,this}setSubject(e){return gt("sub",e),M(this).sub=e,this}setAudience(e){return Lr(e),M(this).aud=e,this}setJti(e){return gt("jti",e),M(this).jti=e,this}setNotBefore(e){return M(this).nbf=Et(e,"setNotBefore"),this}setExpirationTime(e){return M(this).exp=Et(e,"setExpirationTime"),this}setIssuedAt(e){let t=M(this);if(e===void 0)t.iat=Ke(new Date);else if(typeof e==="string")t.iat=de("setIssuedAt",Ke(new Date)+Ze(e));else t.iat=Et(e,"setIssuedAt");return this}}async function Qr(e,t,r){let n=await qe(e,Xe(r),t);if(!n[2])throw new jr("JWTs MUST NOT use unencoded payload");let i={payload:ue(n[1],n[0],r),protectedHeader:n[1]};if(typeof t==="function")return{...i,key:n[3]};return i}async function Vu(e,t,r){let n=await Zt(e,qt(r),t),o=n[1],i=ue(o,n[0],r);for(let s of["iss","sub","aud"])if(o[s]!==void 0&&(s==="aud"?JSON.stringify(o.aud)!==JSON.stringify(i.aud):o[s]!==i[s]))throw new P(`replicated "${s}" claim header parameter mismatch`,i,s,"mismatch");let a={payload:i,protectedHeader:o};if(typeof t==="function")return{...a,key:n[2]};return a}function Vr(e){if(e===void 0)return[void 0,""];let t=se(zr,e);return[t[0],mr(t[1])]}function Gr(e,t,r){return ze(zr,e),ae(e,D(zr,ie,r,e,t))}function Fr(e){let t=e.alg;if(typeof t!=="string"||!t)throw new zr('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Fe(t)}async function Xr(e,t,r,n){let o=b(g(e),g("."),t),i=await O(r,n,"sign");return mr(await rr(r,i,o))}async function sr(e,t,r,n,o){let[i,a]=Vr(t);if(!i)throw new zr("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Gr(i,i,r))o();let c=Fr(i),p=mr(e),d=await Xr(a,g(p),c,n);return`${a}.${p}.${d}`}var Yr=Q;class bs extends Yr{#e;setProtectedHeader(e){return q(this.#e,"setProtectedHeader"),this.#e=e,this}async sign(e,t){return sr(fe(this),this.#e,t?.crit,e,()=>{throw new jr("JWTs MUST NOT use unencoded payload")})}}var qr=Q;class Ku extends qr{#e;#r;#n;#t;#o;#i;#a;setProtectedHeader(e){return q(this.#t,"setProtectedHeader"),this.#t=e,this}setKeyManagementParameters(e){return q(this.#n,"setKeyManagementParameters"),this.#n=e,this}setContentEncryptionKey(e){return q(this.#e,"setContentEncryptionKey"),this.#e=e,this}setInitializationVector(e){return q(this.#r,"setInitializationVector"),this.#r=e,this}replicateIssuerAsHeader(){return this.#o=!0,this}replicateSubjectAsHeader(){return this.#i=!0,this}replicateAudienceAsHeader(){return this.#a=!0,this}async encrypt(e,t){let r=fe(this);if(this.#t&&(this.#o||this.#i||this.#a))this.#t={...this.#t,iss:this.#o?Qe(this,"iss"):void 0,sub:this.#i?Qe(this,"sub"):void 0,aud:this.#a?Qe(this,"aud"):void 0};let n=await er([r,this.#t,void 0,void 0,void 0,this.#e,this.#r,this.#n,void 0,!1],e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(".")}}var le='"alg" (Algorithm)';function Je(e='JWK "alg" (Algorithm) Parameter'){throw new m(`Invalid or unsupported ${e} value`)}function ee(e,t){return(typeof e==="string"?Ae[e]??dt[e]:void 0)??Je(t)}function me(e){if(e!==void 0&&typeof e!=="boolean")throw TypeError('"extractable" option must be a boolean');return e}var ve=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},Zr=(e)=>({data:e,pos:0}),xt=(e)=>{let t=e.data[e.pos++];if(t===void 0)throw Error("Unexpected end of ASN.1 input");return t},Ce=(e)=>{let t=xt(e);if(t&128){let r=t&127,n=0;for(let o=0;o<r;o++)n=n<<8|xt(e);return n}return t};var We=(e,t,r)=>{if(xt(e)!==t)throw Error(r)},cr=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw Error("Unexpected end of ASN.1 input");let r=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,r},tn=(e)=>{We(e,6,"Expected algorithm OID");let t=Ce(e);return cr(e,t)};function rn(e,t){if(We(e,48,`Invalid ${t==="spki"?"SPKI":"PKCS#8"} structure`),Ce(e),t==="pkcs8"){We(e,2,"Expected version field");let r=Ce(e);e.pos+=r}We(e,48,"Expected algorithm identifier"),Ce(e)}var nn=(e)=>{let t=tn(e);if(ve(t,[43,101,110]))return"X25519";if(!ve(t,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");We(e,6,"Expected curve OID");let r=Ce(e),n=cr(e,r);if(ve(n,[42,134,72,206,61,3,1,7]))return"P-256";if(ve(n,[43,129,4,0,34]))return"P-384";if(ve(n,[43,129,4,0,35]))return"P-521";throw Error("Unsupported named curve")},on=async(e,t,r,n)=>{let o=me(n?.extractable),i=ee(r,le);if(i.secret)Je(le);let a=e==="spki",s;if(i.resolve)try{let c=Zr(t);rn(c,e),s=i.resolve({crv:nn(c)})}catch{throw new m("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(e,t,s,o??a,i.usages[a?0:1])},an=(e,t)=>Re(e.replace(t,"")),pr=(e,t,r)=>{let n=an(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);return on("pkcs8",n,t,r)};function sn(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}async function cn(e){if(nt(e))if(e.type==="secret")e=e.export();else return e.export({format:"jwk"});if(e instanceof Uint8Array)return{kty:"oct",k:mr(e)};if(!H(e))throw TypeError(R(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:o,...i}=sn(await crypto.subtle.exportKey("jwk",e));if(i.kty==="AKP")i.alg=n;return i}function bl(e){return cn(e)}var L=(e,t)=>{if(typeof e!=="string"||!e)throw new ge(`${t} missing or invalid`)};async function wl(e,t){let r;if(E(e)){if(r=re(e),typeof r.kty!=="string")throw TypeError(R(e,"CryptoKey","KeyObject","JSON Web Key"))}else if(De(e))r=re(await bl(e));else throw TypeError(R(e,"CryptoKey","KeyObject","JSON Web Key"));if(t??="sha256",t!=="sha256"&&t!=="sha384"&&t!=="sha512")throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let n;switch(r.kty){case"AKP":L(r.alg,'"alg" (Algorithm) Parameter'),L(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":L(r.crv,'"crv" (Curve) Parameter'),L(r.x,'"x" (X Coordinate) Parameter'),L(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":L(r.crv,'"crv" (Subtype of Key Pair) Parameter'),L(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":L(r.e,'"e" (Exponent) Parameter'),L(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!=="string")throw new ge('"k" (Key Value) Parameter missing or invalid');n={k:r.k,kty:r.kty};break;default:throw new m('"kty" (Key Type) Parameter missing or unsupported')}let o=g(JSON.stringify(n));return mr(await ke(t,o))}function pn(e,t,r,n){let{kty:o,key_ops:i,ext:a,kid:s,alg:c,use:p,crv:d}=re(e),f=Array.isArray(i)?[...i]:i;return(a===void 0||typeof a==="boolean")&&(f===void 0||Array.isArray(f)&&f.every((l,S)=>typeof l==="string"&&f.indexOf(l)===S)&&f.includes("verify"))&&t.kty.includes(o)&&(n===void 0||typeof n==="string"&&n===s)&&(c===void 0?o!=="AKP":r===c)&&(p===void 0||p==="sig")&&(!t.crv||d===t.crv)}async function dr(e,t,r){let n=e.get(t)||e.set(t,{}).get(t),{alg:o}=r;if(n[o]===void 0){let i=await B(r,{...t,alg:o,ext:!0});if(i.type!=="public")throw new _l("JSON Web Key Set members must be public keys");n[o]=i}return n[o]}function Qo(e){let t;try{t=structuredClone(e)}catch{}if(!He(t))throw new _l("JSON Web Key Set malformed");let r=new WeakMap;return Object.defineProperty(async(o,i)=>{let{alg:a,kid:s}={...o,...i?.header},c=typeof a==="string"?Ae[a]:void 0;if(!c||c.secret)throw new m('Unsupported "alg" value for a JSON Web Key Set');let p=t.keys.filter((l)=>pn(l,c,a,s)),{0:d,length:f}=p;if(!f)throw new yl;if(f!==1){let l=new vc;throw l[Symbol.asyncIterator]=async function*(){for(let S of p)try{yield await dr(r,S,c)}catch{}},l}return dr(r,d,c)},"jwks",{value:()=>structuredClone(t)})}function un(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var At;if(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))At="jose/v6.2.10";var fr=Symbol();async function fn(e,t,r,n=fetch){let o=await n(e,{method:"GET",signal:r,redirect:"manual",headers:t}).catch((i)=>{if(i.name==="TimeoutError")throw new vl;throw i});if(o.status!==200)throw new dn("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch{throw new dn("Failed to parse the JSON Web Key Set HTTP response as JSON")}}var lr=Symbol();function Pe(e,t){return Number.isFinite(e)&&Date.now()<e+t}function ur(e,t,r){if(Number.isNaN(e))throw TypeError(`"${r}" option must not be NaN`);return typeof e==="number"?e:t}function Af(e,t){if(!(e instanceof URL))throw TypeError("url must be an instance of URL");let r=new URL(e.href).href,n=t??{},o=n.timeoutDuration;if(typeof o==="number"&&(!Number.isInteger(o)||o<0))throw TypeError('"timeoutDuration" option must be a non-negative integer');let i=typeof o==="number"?o:5000,a=ur(n.cooldownDuration,30000,"cooldownDuration"),s=ur(n.cacheMaxAge,600000,"cacheMaxAge"),c=new Headers(n.headers);if(At&&!c.has("User-Agent"))c.set("User-Agent",At);if(!c.has("accept"))c.set("accept","application/json, application/jwk-set+json");let p=n[fr],d=n[lr],f,l,S=0,v=0,w;if(d&&typeof d==="object"){let{uat:y,jwks:x}=d;if(Pe(y,s)&&He(x))f=y,w=Qo(x)}let h=async()=>{if(l&&un())l=void 0;if(!l){let y=++S,x=l=fn(r,c,AbortSignal.timeout(i),p).then((C)=>{let U=Qo(C);if(y<=v)return;w=U;let T=Date.now();if(d)d.uat=T,d.jwks=C;f=T,v=y}).finally(()=>{if(l===x)l=void 0})}await l};return Object.defineProperties(async(y,x)=>{if(!w||!Pe(f,s))await h();try{return await w(y,x)}catch(C){if(C instanceof yl&&!Pe(f,a))return await h(),w(y,x);throw C}},{coolingDown:{get:()=>Pe(f,a),enumerable:!0},fresh:{get:()=>Pe(f,s),enumerable:!0},reload:{value:h,enumerable:!0},reloading:{get:()=>!!l,enumerable:!0},jwks:{value:()=>w?.jwks(),enumerable:!0}})}var ln=Q;class bc extends ln{encode(){let e=mr(JSON.stringify({alg:"none"})),t=mr(fe(this));return`${e}.${t}.`}static decode(e,t){if(typeof e!=="string")throw new jr("Unsecured JWT must be a string");let{0:r,1:n,2:o,length:i}=e.split(".");if(i!==3||o!=="")throw new jr("Invalid Unsecured JWT");let a,s;try{a=V(r,zr,"JWS Protected Header is invalid");let p=D(zr,ie,void 0,a,a);s=ae(a,p)}catch(p){if(!(p instanceof zr))throw p;throw new jr("Invalid Unsecured JWT",{cause:p})}if(a.alg!=="none")throw new jr("Invalid Unsecured JWT");if(!s)throw new jr("JWTs MUST NOT use unencoded payload");return{payload:ue(a,A(n,"payload",jr),t),header:a}}}async function Ky(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw TypeError('"pkcs8" must be PKCS#8 formatted string');return pr(e,t,r)}async function In(e,t,r){if(!E(e))throw TypeError("JWK must be an object");let n=Be(e),o=me(r?.extractable),{alg:i}=n;t??=i;let a=o??n.ext;if(n.kty!=="oct"&&!t)throw TypeError('"alg" argument is required when "jwk.alg" is not present');switch(n.kty){case"oct":if(typeof n.k!=="string")throw TypeError('missing "k" (Key Value) Parameter value');return I(n.k);case"AKP":{if(typeof i!=="string"||!i)throw TypeError('missing "alg" (Algorithm) Parameter value');if(t!==i)throw TypeError("JWK alg and alg option value mismatch");return B(ee(t),{...n,ext:a})}case"RSA":case"EC":case"OKP":return B(ee(t),{...n,alg:t,ext:a});default:throw new m('Unsupported "kty" (Key Type) Parameter value')}}function so(e){let t;if(typeof e==="string"){let n=e.split(".");if(n.length===3||n.length===5)[t]=n}else if(typeof e==="object"&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof t!=="string"||!t)throw TypeError(r);return V(t,TypeError,r)}function en(e){if(typeof e!=="string")throw new jr("JWTs must use Compact JWS serialization, JWT must be a string");let{1:t,length:r}=e.split(".");if(r===5)throw new jr("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new jr("Invalid JWT");if(!t)throw new jr("JWTs must contain a payload");let n;try{n=I(t)}catch{throw new jr("Failed to base64url decode the payload")}let o;try{o=JSON.parse(te.decode(n))}catch{throw new jr("Failed to parse the decoded payload as JSON")}if(!E(o))throw new jr("Invalid JWT Claims Set");return o}function mn(e){let t=e?.modulusLength??2048;if(typeof t!=="number"||!Number.isInteger(t)||t<2048)throw new m("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return t}async function _f(e,t){let r=me(t?.extractable),n=ee(e,le);if(n.secret)Je(le);let o;if(n.resolve){let i=t?.crv??"P-256";switch(i){case"P-256":case"P-384":case"P-521":o={name:"ECDH",namedCurve:i};break;case"X25519":o={name:"X25519"};break;default:throw new m("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519")}}else{if(n.crv!==void 0&&t?.crv!==void 0&&t.crv!==n.crv)throw new m(`Invalid or unsupported crv option provided, the only supported value for ${e} is ${n.crv}`);o=n.kty[0]==="RSA"?{...n.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:mn(t)}:n.subtle}return crypto.subtle.generateKey(o,r??!1,[...n.usages[1],...n.usages[0]])}export{dn,yi,zr,jr,_l,yl,vc,vl,Qu,eA,mr,Im,Gu,Qr,Vu,bs,Ku,bl,wl,Qo,Af,bc,Ky,In,so,en,_f};
|
|
2
|
+
import{rt}from"./chunk-65dh7x4c.js";var EA={};rt(EA,{JOSEAlgNotAllowed:()=>X,JOSEError:()=>fn,JOSENotSupported:()=>m,JWEDecryptionFailed:()=>we,JWEInvalid:()=>u,JWKInvalid:()=>ge,JWKSInvalid:()=>Ml,JWKSMultipleMatchingKeys:()=>Dc,JWKSNoMatchingKey:()=>Ol,JWKSTimeout:()=>Pl,JWSInvalid:()=>qr,JWSSignatureVerificationFailed:()=>ad,JWTClaimValidationFailed:()=>P,JWTExpired:()=>xi,JWTInvalid:()=>$r});var Jm={};rt(Jm,{decode:()=>I,encode:()=>mr});var ye=new TextEncoder,F=new TextDecoder,te=new TextDecoder("utf-8",{fatal:!0});function b(...e){let t=e.reduce((o,{length:i})=>o+i,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function Qe(e,t,r){if(t<0||t>=4294967296)throw RangeError(`value must be >= 0 and <= 4294967295. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],r)}function et(e){let t=Math.floor(e/4294967296),r=e%4294967296,n=new Uint8Array(8);return Qe(n,t,0),Qe(n,r,4),n}function Te(e){let t=new Uint8Array(4);return Qe(t,e),t}function g(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}var Ie=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function tt(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function Oe(e,t){let{modulusLength:r}=t.algorithm;if(typeof r!=="number"||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function N(e,t,r){let n=e.algorithm;if(n.name!==t.name)throw Ie(t.name);if(t.hash&&n.hash?.name!==t.hash)throw Ie(t.hash,"algorithm.hash");if(t.namedCurve&&n.namedCurve!==t.namedCurve)throw Ie(t.namedCurve,"algorithm.namedCurve");if(t.length!==void 0&&n.length!==t.length)throw Ie(t.length,"algorithm.length");tt(e,r)}function vt(e,t,...r){if(r.length>2){let n=r.pop();e+=`one of type ${r.join(", ")}, or ${n}.`}else if(r.length===2)e+=`one of type ${r[0]} or ${r[1]}.`;else e+=`of type ${r[0]}.`;if(t==null)e+=` Received ${t}`;else if(typeof t==="function"&&t.name)e+=` Received function ${t.name}`;else if(typeof t==="object"&&t!=null){if(t.constructor?.name)e+=` Received an instance of ${t.constructor.name}`}return e}var R=(e,...t)=>vt("Key must be ",e,...t),he=(e,t,...r)=>vt(`Key for the ${e} algorithm must be `,t,...r);class fn extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t);this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class P extends fn{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}}class xi extends fn{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}});this.claim=r,this.reason=n,this.payload=t}}class X extends fn{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class m extends fn{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class we extends fn{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}}class u extends fn{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class qr extends fn{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class $r extends fn{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class ge extends fn{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class Ml extends fn{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class Ol extends fn{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t)}}class Dc extends fn{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}class Pl extends fn{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",t){super(e,t)}}class ad extends fn{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}function _e(e){if(!H(e))throw Error("CryptoKey instance expected")}var H=(e)=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},nt=(e)=>e?.[Symbol.toStringTag]==="KeyObject",De=(e)=>H(e)||nt(e);var k=(e)=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3));function Ct(e,t){let r=e.byteLength<<3;if(r!==t)throw new u(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)}var wr=(e)=>crypto.getRandomValues(new Uint8Array(e.ivBits>>3));function Wt(e,t){if(t.length<<3!==e.ivBits)throw new u("Invalid Initialization Vector length")}async function Pt(e,t,r){if(!(t instanceof Uint8Array))throw TypeError(R(t,"Uint8Array"));let n=e.cekBits>>1,o=await crypto.subtle.importKey("raw",t.subarray(n>>3),"AES-CBC",!1,[r]),i=await crypto.subtle.importKey("raw",t.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]);return[o,i,n]}async function Tt(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function gr(e,t,r,n,o){let[i,a,s]=await Pt(e,r,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},i,t)),p=b(o,n,c,et(o.length*8)),d=await Tt(a,p,s);return{ciphertext:c,tag:d,iv:n}}async function Er(e,t){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),o=await crypto.subtle.sign(r,n,e);return crypto.subtle.verify(r,n,o,t)}async function br(e,t,r,n,o,i){let[a,s,c]=await Pt(e,t,"decrypt"),p=b(i,n,r,et(i.length*8)),d=await Tt(s,p,c);try{if(await Er(o,d))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},a,r))}catch{}throw new we}async function Sr(e,t,r,n,o){let i=r instanceof Uint8Array?await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(N(r,e.subtle,"encrypt"),r),a=new Uint8Array(await crypto.subtle.encrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},i,t)),s=a.slice(-16);return{ciphertext:a.slice(0,-16),tag:s,iv:n}}async function xr(e,t,r,n,o,i){let a=t instanceof Uint8Array?await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(N(t,e.subtle,"decrypt"),t);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},a,b(r,o)))}catch{throw new we}}async function Ue(e,t,r,n,o){if(!H(r)&&!(r instanceof Uint8Array))throw TypeError(R(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n)Wt(e,n);else n=wr(e);if(r instanceof Uint8Array)Ct(r,e.cekBits);return e.cbc?gr(e,t,r,n,o):Sr(e,t,r,n,o)}async function Ne(e,t,r,n,o,i){if(!H(t)&&!(t instanceof Uint8Array))throw TypeError(R(t,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new u("JWE Initialization Vector missing");if(!o)throw new u("JWE Authentication Tag missing");if(!e.cbc&&o.length!==16)throw new u("Invalid Authentication Tag length");if(Wt(e,n),t instanceof Uint8Array)Ct(t,e.cekBits);return e.cbc?br(e,t,r,n,o,i):xr(e,t,r,n,o,i)}function ot(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=32768,r=[];for(let n=0;n<e.length;n+=t)r.push(String.fromCharCode.apply(null,e.subarray(n,n+t)));return btoa(r.join(""))}function Re(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}var it="The input to be decoded is not correctly encoded.";function I(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64(typeof e==="string"?e:F.decode(e),{alphabet:"base64url"})}catch(r){throw TypeError(it,{cause:r})}let t=e;if(t instanceof Uint8Array)t=F.decode(t);if(t.includes("+")||t.includes("/"))throw TypeError(it);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return Re(t)}catch{throw TypeError(it)}}function mr(e){let t=e;if(typeof t==="string")t=ye.encode(t);if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:"base64url",omitPadding:!0});return ot(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Y(e,t){if(!(e instanceof Uint8Array))throw TypeError(`${t} must be an instance of Uint8Array`)}function E(e){if(typeof e!=="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function He(e){return E(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(E)}function It(...e){let t=new Set;for(let r of e){if(!r)continue;for(let n of Object.keys(r)){if(t.has(n))return!1;t.add(n)}}return!0}var Ot=Symbol();function q(e,t){if(e!==void 0)throw TypeError(`${t} can only be called once`)}function A(e,t,r){try{return I(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}function at(e,t,r){try{return g(e)}catch{throw new r(`The ${t} is not a valid base64url string`)}}async function ke(e,t){let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,t))}function V(e,t,r){let n;try{n=JSON.parse(te.decode(I(e)))}catch{throw new t(r)}if(!E(n))throw new t(r);return n}async function B(e,t){if(t.kty==="RSA"&&"oth"in t&&t.oth!==void 0)throw new m('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,n=!!(t.d||t.priv),o={...t};if(o.kty!=="AKP")delete o.alg;return delete o.use,crypto.subtle.importKey("jwk",o,r,t.ext??!n,t.key_ops??e.usages[n?1:0])}function re(e){return{__proto__:null,...e}}function Be(e){let t=re(e);if(t.ext!==void 0&&typeof t.ext!=="boolean")throw TypeError('"ext" (Extractable) Parameter must be a boolean');if(t.key_ops!==void 0){let r=t.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some((o)=>typeof o!=="string")||new Set(n).size!==n.length)throw TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}var st=(e)=>e[Symbol.toStringTag],Ar=(e,t,r)=>{let{alg:n}=e;if(t.use!==void 0){let o=r==="sign"||r==="verify"?"sig":"enc";if(t.use!==o)throw TypeError(`Invalid key for this operation, its "use" must be "${o}" when present`)}if(t.alg!==void 0&&t.alg!==n)throw TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(t.key_ops)){let o=r==="encrypt"||r==="decrypt"?e.ops?.[r==="encrypt"?0:1]:r;if(o&&!t.key_ops.includes(o))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${o}" when present`)}};function Kr(e,t,r){let{alg:n,secret:o}=e,i=r==="decrypt"||r==="sign";if(o&&t instanceof Uint8Array)return[Dt,t];if(E(t)){let a=Be(t);if(typeof a.kty!=="string")throw TypeError(o?he(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):he(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(o?a.kty==="oct"&&typeof a.k==="string":a.kty!=="oct"&&(i?a.kty==="AKP"&&typeof a.priv==="string"||typeof a.d==="string":a.d===void 0&&a.priv===void 0)))throw TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);return Ar(e,a,r),[Rt,t,a]}if(!De(t))throw TypeError(o?he(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):he(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(o){if(t.type!=="secret")throw TypeError(`${st(t)} instances for symmetric algorithms must be of type "secret"`)}else{if(t.type==="secret")throw TypeError(`${st(t)} instances for asymmetric algorithms must not be of type "secret"`);let a=i?"private":"public";if((t.type==="public"||t.type==="private")&&t.type!==a){let s=r==="sign"?"signing":r==="verify"?"verifying":`${r.slice(0,-1)}tion`;throw TypeError(`${st(t)} instances for asymmetric algorithm ${s} must be of type "${a}"`)}}return H(t)?[Ut,t]:[Nt,t]}var Dt=0,Ut=1,Nt=2,Rt=3,ct,Jr={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function Me(e,t,r){ct||=new WeakMap;let n=ct.get(e);if(r)if(n)n[t]=r;else ct.set(e,{[t]:r});return r??n?.[t]}var _t=async(e,t,r)=>Me(e,r.alg)??Me(e,r.alg,await B(r,{...t,alg:r.alg})),vr=(e,t)=>{let r=Me(e,t.alg);if(r)return r;let n=e.type==="public",o=t.usages[n?0:1],{asymmetricKeyType:i}=e,a=Jr[e.asymmetricKeyDetails?.namedCurve],s=t.resolve?.({crv:a,asymmetricKeyType:i})??t.subtle;return Me(e,t.alg,e.toCryptoKey(s,n,o))};async function O(e,t,r){let n=Kr(e,t,r);switch(n[0]){case Dt:case Ut:return n[1];case Rt:{let o=n[1],i=n[2];if(i.kty==="oct")return I(i.k);if(!Object.isFrozen(o)){let{key_ops:a}=o;if(Array.isArray(a))Object.freeze(a);Object.freeze(o)}return _t(o,i,e)}case Nt:{let o=n[1];if(o.type==="secret")return o.export();if("toCryptoKey"in o&&typeof o.toCryptoKey==="function")return vr(o,e);return _t(o,o.export({format:"jwk"}),e)}}}function Ee(e){let t={__proto__:null};for(let r in e)t[r]={...e[r],alg:r};return t}var Cr=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],Wr=[[],["deriveBits"]],je=[[],[]];function Le(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:`SHA-${e}`},usages:Cr,ops:["wrapKey","unwrapKey"]}}function $e(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:({kty:e,crv:t,asymmetricKeyType:r})=>{if(t==="X25519"||r==="x25519")return{name:"X25519"};if(e==="OKP")throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:t}},usages:Wr,ops:[void 0,"deriveBits"]}}function ne(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:je,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function pt(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:je,ops:["deriveBits","deriveBits"]}}var dt=Ee({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:je,ops:["encrypt","decrypt"]},"RSA-OAEP":Le(1),"RSA-OAEP-256":Le(256),"RSA-OAEP-384":Le(384),"RSA-OAEP-512":Le(512),"ECDH-ES":$e(),"ECDH-ES+A128KW":$e(),"ECDH-ES+A192KW":$e(),"ECDH-ES+A256KW":$e(),A128KW:ne(128),A192KW:ne(192),A256KW:ne(256),A128GCMKW:ne(128,!0),A192GCMKW:ne(192,!0),A256GCMKW:ne(256,!0),"PBES2-HS256+A128KW":pt(),"PBES2-HS384+A192KW":pt(),"PBES2-HS512+A256KW":pt()}),Pr=["encrypt","decrypt"];function oe(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:je,ops:Pr,cekBits:e,ivBits:t?128:96,cbc:t}}var Tr=Ee({A128GCM:oe(128),A192GCM:oe(192),A256GCM:oe(256),"A128CBC-HS256":oe(256,!0),"A192CBC-HS384":oe(384,!0),"A256CBC-HS512":oe(512,!0)});function Ht(e,t){throw new m(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function _(e){return(typeof e==="string"?dt[e]:void 0)??Ht("alg","Algorithm")}function Z(e){return(typeof e==="string"?Tr[e]:void 0)??Ht("enc","Encryption Algorithm")}function kt(e,t){if(e.algorithm.name!=="ECDH"&&e.algorithm.name!=="X25519")throw TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");tt(e,t)}async function Mt(e,t,r){let n=_(t).subtle,o=e instanceof Uint8Array?await crypto.subtle.importKey("raw",e,"AES-KW",!0,[r]):e;return N(o,n,r),o}async function ut(e,t,r){let n=await Mt(t,e,"wrapKey"),o=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",o,n,"AES-KW"))}async function ft(e,t,r){let n=await Mt(t,e,"unwrapKey"),o=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",o))}function Lt(e,t,r){N(t,_(e).subtle,r),Oe(e,t)}function Ir(e,t){if(e instanceof Uint8Array)return crypto.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);return N(e,_(t).subtle,"deriveBits"),e}async function $t(e,t,r,n){if(!(e instanceof Uint8Array)||e.length<8)throw new u("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new u("PBES2 Count Input must be a positive integer");let o=b(g(t),Uint8Array.of(0),e),i=parseInt(t.slice(13,16),10),a={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:o},s=await Ir(n,t);return new Uint8Array(await crypto.subtle.deriveBits(a,s,i))}function lt(e){return b(Te(e.length),e)}async function Or(e,t,r){let n=t>>3,o=32,i=Math.ceil(n/32),a=new Uint8Array(i*32);for(let s=1;s<=i;s++){let c=await ke("sha256",b(Te(s),e,r));a.set(c,(s-1)*32)}return a.slice(0,n)}async function jt(e,t,r,n,o=new Uint8Array,i=new Uint8Array){kt(e),kt(t,"deriveBits");let a=b(lt(g(r)),lt(o),lt(i),Te(n)),s=new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,e.algorithm.name==="X25519"?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3));return Or(s,n,a)}function Vt(e){_e(e);let t=e.algorithm.namedCurve;if(t!=="P-256"&&t!=="P-384"&&t!=="P-521"&&e.algorithm.name!=="X25519")throw new m("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function be(e){if(e===void 0)throw new u("JWE Encrypted Key missing")}function Bt(e){if(e!==void 0)throw new u("Encountered unexpected JWE Encrypted Key")}async function zt(e,t,r,n,o,i){let a=_(e);if(e==="dir")return Bt(n),r;switch(a.subtle.name){case"ECDH":{if(e==="ECDH-ES")Bt(n);if(!E(o.epk))throw new u('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');Vt(r);let s=await B(a,o.epk),c,p;if(o.apu!==void 0){if(typeof o.apu!=="string")throw new u('JOSE Header "apu" (Agreement PartyUInfo) invalid');c=A(o.apu,"apu",u)}if(o.apv!==void 0){if(typeof o.apv!=="string")throw new u('JOSE Header "apv" (Agreement PartyVInfo) invalid');p=A(o.apv,"apv",u)}let d=await jt(s,r,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),c,p);if(e==="ECDH-ES")return d;return be(n),ft(e.slice(-6),d,n)}case"RSA-OAEP":return be(n),_e(r),Lt(e,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(be(n),typeof o.p2c!=="number")throw new u('JOSE Header "p2c" (PBES2 Count) missing or invalid');let s=i||1e4;if(o.p2c>s)throw new u('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof o.p2s!=="string")throw new u('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let c=A(o.p2s,"p2s",u),p=await $t(c,e,o.p2c,r);return ft(e.slice(-6),p,n)}case"AES-KW":return be(n),ft(e,r,n);case"AES-GCM":{if(be(n),typeof o.iv!=="string")throw new u('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof o.tag!=="string")throw new u('JOSE Header "tag" (Authentication Tag) missing or invalid');let s;s=A(o.iv,"iv",u);let c;return c=A(o.tag,"tag",u),Ne(Z(e.slice(0,-2)),r,n,s,c,new Uint8Array)}}}async function Gt(e,t,r,n,o={}){let i,a,s,c=_(e);if(e==="dir")return[r,void 0,void 0];switch(c.subtle.name){case"ECDH":{Vt(r);let{apu:p,apv:d}=o;if(p!==void 0)Y(p,'"apu"');if(d!==void 0)Y(d,'"apv"');let f;if(o.epk!==void 0)f=await O(c,o.epk,"decrypt");else f=(await crypto.subtle.generateKey(r.algorithm,!0,["deriveBits"])).privateKey;let l=crypto.subtle,S=f;if(!S.extractable){if(typeof l.getPublicKey!=="function")throw TypeError('CryptoKey for "epk" must be extractable');S=await l.getPublicKey(f,[])}let{x:v,y:w,crv:h,kty:J}=await l.exportKey("jwk",S),y=await jt(r,f,e==="ECDH-ES"?t.alg:e,e==="ECDH-ES"?t.cekBits:parseInt(e.slice(-5,-2),10),p,d);if(a={epk:{x:v,crv:h,kty:J}},J==="EC")a.epk.y=w;if(p)a.apu=mr(p);if(d)a.apv=mr(d);if(e==="ECDH-ES"){s=y;break}s=n||k(t);let x=e.slice(-6);i=await ut(x,y,s);break}case"RSA-OAEP":{s=n||k(t),_e(r),Lt(e,r,"encrypt"),i=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",r,s));break}case"PBKDF2":{s=n||k(t);let{p2c:p=2048,p2s:d=crypto.getRandomValues(new Uint8Array(16))}=o,f=await $t(d,e,p,r);i=await ut(e.slice(-6),f,s),a={p2c:p,p2s:mr(d)};break}case"AES-KW":{s=n||k(t),i=await ut(e,r,s);break}case"AES-GCM":{s=n||k(t);let{iv:p}=o,d=await Ue(Z(e.slice(0,-2)),s,r,p,new Uint8Array);i=d.ciphertext,a={iv:mr(d.iv),tag:mr(d.tag)};break}}return[s,i,a]}var ie={__proto__:null,b64:!0},Ve={__proto__:null};function Se(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some((r)=>typeof r!=="string")))throw TypeError(`"${e}" option must be an array of strings`);if(!t)return;return new Set(t)}function ze(e,t){let{crit:r}=t??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function D(e,t,r,n,o){if(o.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some((a)=>typeof a!=="string"||a.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?t:{__proto__:null,...r,...t};for(let a of n.crit){if(!(a in i))throw new m(`Extension Header Parameter "${a}" is not recognized`);if(!Object.hasOwn(o,a)||o[a]===void 0)throw new e(`Extension Header Parameter "${a}" is missing`);if(i[a]&&(!Object.hasOwn(n,a)||n[a]===void 0))throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`)}return n.crit}function ae(e,t){if(t.includes("b64")){let r=e.b64;if(typeof r!=="boolean")throw new qr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function se(e,t){let r,n;try{r=JSON.stringify(t),n=JSON.parse(r)}catch(o){throw new e("JOSE Header is not valid JSON",{cause:o})}if(!E(n))throw new e("JOSE Header is not a JSON object");return[n,r]}function Ge(e,t){if(e.zip!==void 0&&e.zip!=="DEF")throw new m('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(e.zip!==void 0&&!t?.zip)throw new u('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function Ft(e){if(typeof globalThis[e]>"u")throw new m(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function Xt(e){Ft("CompressionStream");let t=new CompressionStream("deflate-raw"),r=t.writable.getWriter();r.write(e).catch(()=>{}),r.close().catch(()=>{});let n=[],o=t.readable.getReader();for(;;){let{value:i,done:a}=await o.read();if(a)break;n.push(i)}return b(...n)}async function Yt(e,t){Ft("DecompressionStream");let r=new DecompressionStream("deflate-raw"),n=r.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let o=[],i=0,a=r.readable.getReader();for(;;){let{value:s,done:c}=await a.read();if(c)break;if(o.push(s),i+=s.byteLength,t!==1/0&&i>t)throw new u("Decompressed plaintext exceeded the configured limit")}return b(...o)}function qt(e){return[e&&Se("keyManagementAlgorithms",e.keyManagementAlgorithms),e&&Se("contentEncryptionAlgorithms",e.contentEncryptionAlgorithms),e?.crit,e?.maxPBES2Count,e?.maxDecompressedLength]}async function _r(e,t,r,n,o){let[i,a,s,c,p]=r,[d,f,l,S,v]=t,{encrypted_key:w}=e;D(u,Ve,s,d,o),Ge(o,d);let{alg:h,enc:J}=o;if(typeof h!=="string"||!h)throw new u("missing JWE Algorithm (alg) in JWE Header");if(typeof J!=="string"||!J)throw new u("missing JWE Encryption Algorithm (enc) in JWE Header");if(i&&!i.has(h)||!i&&h.startsWith("PBES2"))throw new X('"alg" (Algorithm) Header Parameter value not allowed');if(a&&!a.has(J))throw new X('"enc" (Encryption Algorithm) Header Parameter value not allowed');let y=Z(J),x;if(w!==void 0)x=A(w,"encrypted_key",u);let C=!1;if(typeof n==="function")n=await n(d,e),C=!0;let U=_(h),T=await O(h==="dir"?y:U,n,"decrypt"),W;try{if(W=await zt(h,y,T,x,o,c),w!==void 0&&W instanceof Uint8Array&&W.byteLength<<3!==y.cekBits)W=k(y)}catch(K){if(K instanceof TypeError||K instanceof u||K instanceof m)throw K;W=k(y)}let z=await Ne(y,W,f,l,S,v);if(o.zip==="DEF"){let K=p??250000;if(K===0)throw new m('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(K!==1/0&&(!Number.isSafeInteger(K)||K<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");z=await Yt(z,K).catch((G)=>{if(G instanceof u)throw G;throw new u("Failed to decompress plaintext",{cause:G})})}return[z,d,T,C]}async function Zt(e,t,r){if(e instanceof Uint8Array)e=F.decode(e);if(typeof e!=="string")throw new u("Compact JWE must be a string or Uint8Array");let{0:n,1:o,2:i,3:a,4:s,length:c}=e.split(".");if(c!==5)throw new u("Invalid Compact JWE");let p={ciphertext:a,iv:i||void 0,protected:n,tag:s||void 0,encrypted_key:o||void 0},d=V(n,u,"JWE Protected Header is invalid"),f=g(n),l=[d,A(a,"ciphertext",u),i?A(i,"iv",u):void 0,s?A(s,"tag",u):void 0,f];return _r(p,l,t,r,d)}function Qt(e,t,r){if(!It(e,t,r))throw new u("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function Dr(e){let[,t,r,n,o,i,a,s,c]=e;if(o!==void 0)Y(o,"JWE Additional Authenticated Data");if(i!==void 0)Y(i,"JWE Content Encryption Key");if(a!==void 0)Y(a,"JWE Initialization Vector");if(t!==void 0)t=se(u,t)[0],e[1]=t;if(r!==void 0)r=se(u,r)[0],e[2]=r;if(n!==void 0)n=se(u,n)[0],e[3]=n;if(s!==void 0&&!E(s))throw TypeError("JWE Key Management Parameters must be an object");Qt(t,r,n);let p={...t,...r,...n};ze(u,t),D(u,Ve,c,t,p),Ge(p,t);let{alg:d,enc:f}=p;if(typeof d!=="string"||!d)throw new u('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof f!=="string"||!f)throw new u('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[p,d,f,Z(f)]}async function Ur(e,t,r){let[n,o,,i]=t,[a,s,c,p,d,f,l,S,,v]=e,w=s,h=c;if(f&&(o==="dir"||o==="ECDH-ES"))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${o}`);let J=_(o),y=await O(o==="dir"?i:J,r,"encrypt"),[x,C,U]=await Gt(o,i,y,f,S);if(U){if(v)h=h?{...h,...U}:U;else w=w?{...w,...U}:U;Qt(w,h,p)}let T,W;if(w)T=mr(JSON.stringify(w)),W=g(T);else T="",W=new Uint8Array;let z,K;if(d?.byteLength)K=mr(d),z=b(W,g("."),g(K));else z=W;let G=a;if(n.zip==="DEF")G=await Xt(G).catch((hr)=>{throw new u("Failed to compress plaintext",{cause:hr})});let{ciphertext:yr,tag:Kt,iv:Jt}=await Ue(i,G,x,l,z),j={ciphertext:mr(yr)};if(Jt)j.iv=mr(Jt);if(Kt)j.tag=mr(Kt);if(C)j.encrypted_key=mr(C);if(K)j.aad=K;if(w)j.protected=T;if(p)j.unprotected=p;if(h)j.header=h;return j}async function er(e,t,r){if(!e[1]&&!e[2]&&!e[3])throw new u("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(r!==void 0)e[8]=r?.crit,e[9]=r?Ot in r:!1;return Ur(e,Dr(e),t)}async function tr(e,t,r){if(t instanceof Uint8Array)return crypto.subtle.importKey("raw",t,e.subtle,!1,[r]);if(N(t,e.subtle,r),e.minRsaBits)Oe(e.alg,t);return t}async function rr(e,t,r){let n=await tr(e,t,"sign"),o=await crypto.subtle.sign(e.signing,n,r);return new Uint8Array(o)}async function nr(e,t,r,n){let o=await tr(e,t,"verify");try{return await crypto.subtle.verify(e.signing,o,r,n)}catch{return!1}}var xe=[["verify"],["sign"]];function mt(e){let t={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:xe}}function ce(e,t){let n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:n,signing:t?{...n,saltLength:t}:n,usages:xe,minRsaBits:2048}}function yt(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:xe}}function or(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:xe}}function ht(e){let r={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:r,signing:r,usages:xe}}var Ae=Ee({HS256:mt(256),HS384:mt(384),HS512:mt(512),RS256:ce(256),RS384:ce(384),RS512:ce(512),PS256:ce(256,32),PS384:ce(384,48),PS512:ce(512,64),ES256:yt("P-256",256),ES384:yt("P-384",384),ES512:yt("P-521",512),EdDSA:or(),Ed25519:or(),"ML-DSA-44":ht(44),"ML-DSA-65":ht(65),"ML-DSA-87":ht(87)});function Fe(e){let t=typeof e==="string"?Ae[e]:void 0;if(!t)throw new m(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}function Xe(e){return[e&&Se("algorithms",e.algorithms),e?.crit]}function Nr(e,t=e===void 0?{}:V(e,qr,"JWS Protected Header is invalid")){return t}function Rr(e,t,r){let n=ae(e,D(qr,ie,r[1],e,t)),o=t.alg;if(typeof o!=="string"||!o)throw new qr('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(r[0]&&!r[0].has(o))throw new X('"alg" (Algorithm) Header Parameter value not allowed');return[n,o]}function Hr(e){try{return g(e)}catch{throw new qr("JWS Compact Serialization payload must use only ASCII characters")}}async function kr(e,t,r,n,o,i,a){let s=!1;if(typeof r==="function")r=await r(o,e),s=!0;let c=typeof a==="string",p=Fe(i),d=b(n!==void 0?g(n):new Uint8Array,g("."),c?t[2]??=at(a,"payload",qr):a),f=A(e.signature,"signature",qr),l=await O(p,r,"verify");if(!await nr(p,l,f,d))throw new ad;return[c?A(a,"payload",qr):a,o,c,l,s]}async function Ye(e,t,r){if(e instanceof Uint8Array)e=F.decode(e);if(typeof e!=="string")throw new qr("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:i,length:a}=e.split(".");if(a!==3)throw new qr("Invalid Compact JWS");let s={payload:o,protected:n,signature:i},c=Nr(n),[p,d]=Rr(c,c,t),f=p?o:Hr(o);return kr(s,t,r,n,c,d,f)}async function ld(e,t,r){let n=await Ye(e,Xe(r),t),o={payload:n[0],protectedHeader:n[1]};if(typeof t==="function")return{...o,key:n[3]};return o}var Ke=(e)=>Math.floor(e.getTime()/1000),Br={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Mr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,pe="check_failed";function wt(){throw TypeError("Invalid time period format")}function qe(e){if(typeof e!=="string")wt();let t=Mr.exec(e);if(!t||t[4]&&t[1])wt();let r=parseFloat(t[2]),n=Math.round(r*Br[t[3][0].toLowerCase()]);if(!Number.isFinite(n))wt();if(t[1]==="-"||t[4]==="ago")return-n;return n}function de(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}function gt(e,t){if(typeof t!=="string")throw TypeError(`"${e}" claim must be a string`)}function Lr(e){if(typeof e!=="string"&&(!Array.isArray(e)||Array.from(e).some((t)=>typeof t!=="string")))throw TypeError('"aud" claim must be a string or an array of strings')}function Et(e,t){if(typeof e==="number")return de(t,e);if(e instanceof Date)return de(t,Ke(e));return Ke(new Date)+qe(e)}var ir=(e)=>{let t=e.toLowerCase();return e.includes("/")?t:`application/${t}`},jr=(e,t)=>{if(typeof e==="string")return t.includes(e);if(Array.isArray(e))return t.some((r)=>e.includes(r));return!1};function bt(e,t,r=!1){let n=e[t];if(n===void 0&&!r)return;if(typeof n!=="number")throw new P(`"${t}" claim must be a number`,e,t,"invalid");return n}function St(e,t){throw new P(`unexpected "${t}" claim value`,e,t,pe)}function ue(e,t,r={}){let n;try{n=JSON.parse(te.decode(t))}catch{}if(!E(n))throw new $r("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o!==void 0&&(typeof e.typ!=="string"||ir(e.typ)!==ir(o)))throw new P('unexpected "typ" JWT header value',n,"typ",pe);let{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:p}=r,d=[...i];if(p!==void 0)d.push("iat");if(c!==void 0)d.push("aud");if(s!==void 0)d.push("sub");if(a!==void 0)d.push("iss");for(let y of new Set(d.reverse()))if(!Object.hasOwn(n,y))throw new P(`missing required "${y}" claim`,n,y,"missing");if(a!==void 0&&!(Array.isArray(a)?a:[a]).includes(n.iss))St(n,"iss");if(s!==void 0&&n.sub!==s)St(n,"sub");if(c!==void 0&&!jr(n.aud,typeof c==="string"?[c]:c))St(n,"aud");let{clockTolerance:f}=r,l=0;if(typeof f==="string")l=qe(f);else if(f!==void 0){if(typeof f!=="number")throw TypeError("Invalid clockTolerance option type");l=f}de("clockTolerance option",l);let{currentDate:S}=r,v=de("currentDate option",Ke(S===void 0?new Date:S)),w=bt(n,"iat",p!==void 0),h=bt(n,"nbf");if(h!==void 0){if(h>v+l)throw new P('"nbf" claim timestamp check failed',n,"nbf",pe)}let J=bt(n,"exp");if(J!==void 0){if(J<=v-l)throw new xi('"exp" claim timestamp check failed',n,"exp",pe)}if(p!==void 0){let y=v-w,x=de("maxTokenAge option",typeof p==="number"?p:qe(p));if(y-l>x)throw new xi('"iat" claim timestamp check failed (too far in the past)',n,"iat",pe);if(y<-l)throw new P('"iat" claim timestamp check failed (it should be in the past)',n,"iat",pe)}return n}var ar;function M(e){return ar.get(e)}function fe(e){let t=M(e);for(let r of["iat","nbf","exp"]){let n=t[r];if(typeof n==="number"&&!Number.isFinite(n))throw TypeError(`"${r}" claim must be a finite number`)}return ye.encode(JSON.stringify(t))}function Ze(e,t){return M(e)[t]}class Q{constructor(e={}){if(!E(e))throw TypeError("JWT Claims Set MUST be an object");(ar||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return gt("iss",e),M(this).iss=e,this}setSubject(e){return gt("sub",e),M(this).sub=e,this}setAudience(e){return Lr(e),M(this).aud=e,this}setJti(e){return gt("jti",e),M(this).jti=e,this}setNotBefore(e){return M(this).nbf=Et(e,"setNotBefore"),this}setExpirationTime(e){return M(this).exp=Et(e,"setExpirationTime"),this}setIssuedAt(e){let t=M(this);if(e===void 0)t.iat=Ke(new Date);else if(typeof e==="string")t.iat=de("setIssuedAt",Ke(new Date)+qe(e));else t.iat=Et(e,"setIssuedAt");return this}}async function Vr(e,t,r){let n=await Ye(e,Xe(r),t);if(!n[2])throw new $r("JWTs MUST NOT use unencoded payload");let i={payload:ue(n[1],n[0],r),protectedHeader:n[1]};if(typeof t==="function")return{...i,key:n[3]};return i}async function cd(e,t,r){let n=await Zt(e,qt(r),t),o=n[1],i=ue(o,n[0],r);for(let s of["iss","sub","aud"])if(o[s]!==void 0&&(s==="aud"?JSON.stringify(o.aud)!==JSON.stringify(i.aud):o[s]!==i[s]))throw new P(`replicated "${s}" claim header parameter mismatch`,i,s,"mismatch");let a={payload:i,protectedHeader:o};if(typeof t==="function")return{...a,key:n[2]};return a}function zr(e){if(e===void 0)return[void 0,""];let t=se(qr,e);return[t[0],mr(t[1])]}function Gr(e,t,r){return ze(qr,e),ae(e,D(qr,ie,r,e,t))}function Fr(e){let t=e.alg;if(typeof t!=="string"||!t)throw new qr('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Fe(t)}async function Xr(e,t,r,n){let o=b(g(e),g("."),t),i=await O(r,n,"sign");return mr(await rr(r,i,o))}async function sr(e,t,r,n,o){let[i,a]=zr(t);if(!i)throw new qr("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Gr(i,i,r))o();let c=Fr(i),p=mr(e),d=await Xr(a,g(p),c,n);return`${a}.${p}.${d}`}var Yr=Q;class ks extends Yr{#e;setProtectedHeader(e){return q(this.#e,"setProtectedHeader"),this.#e=e,this}async sign(e,t){return sr(fe(this),this.#e,t?.crit,e,()=>{throw new $r("JWTs MUST NOT use unencoded payload")})}}var Zr=Q;class ud extends Zr{#e;#r;#n;#t;#o;#i;#a;setProtectedHeader(e){return q(this.#t,"setProtectedHeader"),this.#t=e,this}setKeyManagementParameters(e){return q(this.#n,"setKeyManagementParameters"),this.#n=e,this}setContentEncryptionKey(e){return q(this.#e,"setContentEncryptionKey"),this.#e=e,this}setInitializationVector(e){return q(this.#r,"setInitializationVector"),this.#r=e,this}replicateIssuerAsHeader(){return this.#o=!0,this}replicateSubjectAsHeader(){return this.#i=!0,this}replicateAudienceAsHeader(){return this.#a=!0,this}async encrypt(e,t){let r=fe(this);if(this.#t&&(this.#o||this.#i||this.#a))this.#t={...this.#t,iss:this.#o?Ze(this,"iss"):void 0,sub:this.#i?Ze(this,"sub"):void 0,aud:this.#a?Ze(this,"aud"):void 0};let n=await er([r,this.#t,void 0,void 0,void 0,this.#e,this.#r,this.#n,void 0,!1],e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(".")}}var le='"alg" (Algorithm)';function Je(e='JWK "alg" (Algorithm) Parameter'){throw new m(`Invalid or unsupported ${e} value`)}function ee(e,t){return(typeof e==="string"?Ae[e]??dt[e]:void 0)??Je(t)}function me(e){if(e!==void 0&&typeof e!=="boolean")throw TypeError('"extractable" option must be a boolean');return e}var ve=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},Qr=(e)=>({data:e,pos:0}),xt=(e)=>{let t=e.data[e.pos++];if(t===void 0)throw Error("Unexpected end of ASN.1 input");return t},Ce=(e)=>{let t=xt(e);if(t&128){let r=t&127,n=0;for(let o=0;o<r;o++)n=n<<8|xt(e);return n}return t};var We=(e,t,r)=>{if(xt(e)!==t)throw Error(r)},cr=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw Error("Unexpected end of ASN.1 input");let r=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,r},en=(e)=>{We(e,6,"Expected algorithm OID");let t=Ce(e);return cr(e,t)};function tn(e,t){if(We(e,48,`Invalid ${t==="spki"?"SPKI":"PKCS#8"} structure`),Ce(e),t==="pkcs8"){We(e,2,"Expected version field");let r=Ce(e);e.pos+=r}We(e,48,"Expected algorithm identifier"),Ce(e)}var nn=(e)=>{let t=en(e);if(ve(t,[43,101,110]))return"X25519";if(!ve(t,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");We(e,6,"Expected curve OID");let r=Ce(e),n=cr(e,r);if(ve(n,[42,134,72,206,61,3,1,7]))return"P-256";if(ve(n,[43,129,4,0,34]))return"P-384";if(ve(n,[43,129,4,0,35]))return"P-521";throw Error("Unsupported named curve")},on=async(e,t,r,n)=>{let o=me(n?.extractable),i=ee(r,le);if(i.secret)Je(le);let a=e==="spki",s;if(i.resolve)try{let c=Qr(t);tn(c,e),s=i.resolve({crv:nn(c)})}catch{throw new m("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(e,t,s,o??a,i.usages[a?0:1])},an=(e,t)=>Re(e.replace(t,"")),pr=(e,t,r)=>{let n=an(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);return on("pkcs8",n,t,r)};function sn(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}async function cn(e){if(nt(e))if(e.type==="secret")e=e.export();else return e.export({format:"jwk"});if(e instanceof Uint8Array)return{kty:"oct",k:mr(e)};if(!H(e))throw TypeError(R(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:o,...i}=sn(await crypto.subtle.exportKey("jwk",e));if(i.kty==="AKP")i.alg=n;return i}function Dl(e){return cn(e)}var L=(e,t)=>{if(typeof e!=="string"||!e)throw new ge(`${t} missing or invalid`)};async function Nl(e,t){let r;if(E(e)){if(r=re(e),typeof r.kty!=="string")throw TypeError(R(e,"CryptoKey","KeyObject","JSON Web Key"))}else if(De(e))r=re(await Dl(e));else throw TypeError(R(e,"CryptoKey","KeyObject","JSON Web Key"));if(t??="sha256",t!=="sha256"&&t!=="sha384"&&t!=="sha512")throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let n;switch(r.kty){case"AKP":L(r.alg,'"alg" (Algorithm) Parameter'),L(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":L(r.crv,'"crv" (Curve) Parameter'),L(r.x,'"x" (X Coordinate) Parameter'),L(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":L(r.crv,'"crv" (Subtype of Key Pair) Parameter'),L(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":L(r.e,'"e" (Exponent) Parameter'),L(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!=="string")throw new ge('"k" (Key Value) Parameter missing or invalid');n={k:r.k,kty:r.kty};break;default:throw new m('"kty" (Key Type) Parameter missing or unsupported')}let o=g(JSON.stringify(n));return mr(await ke(t,o))}function pn(e,t,r,n){let{kty:o,key_ops:i,ext:a,kid:s,alg:c,use:p,crv:d}=re(e),f=Array.isArray(i)?[...i]:i;return(a===void 0||typeof a==="boolean")&&(f===void 0||Array.isArray(f)&&f.every((l,S)=>typeof l==="string"&&f.indexOf(l)===S)&&f.includes("verify"))&&t.kty.includes(o)&&(n===void 0||typeof n==="string"&&n===s)&&(c===void 0?o!=="AKP":r===c)&&(p===void 0||p==="sig")&&(!t.crv||d===t.crv)}async function dr(e,t,r){let n=e.get(t)||e.set(t,{}).get(t),{alg:o}=r;if(n[o]===void 0){let i=await B(r,{...t,alg:o,ext:!0});if(i.type!=="public")throw new Ml("JSON Web Key Set members must be public keys");n[o]=i}return n[o]}function Ko(e){let t;try{t=structuredClone(e)}catch{}if(!He(t))throw new Ml("JSON Web Key Set malformed");let r=new WeakMap;return Object.defineProperty(async(o,i)=>{let{alg:a,kid:s}={...o,...i?.header},c=typeof a==="string"?Ae[a]:void 0;if(!c||c.secret)throw new m('Unsupported "alg" value for a JSON Web Key Set');let p=t.keys.filter((l)=>pn(l,c,a,s)),{0:d,length:f}=p;if(!f)throw new Ol;if(f!==1){let l=new Dc;throw l[Symbol.asyncIterator]=async function*(){for(let S of p)try{yield await dr(r,S,c)}catch{}},l}return dr(r,d,c)},"jwks",{value:()=>structuredClone(t)})}function dn(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var At;if(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))At="jose/v6.2.10";var fr=Symbol();async function un(e,t,r,n=fetch){let o=await n(e,{method:"GET",signal:r,redirect:"manual",headers:t}).catch((i)=>{if(i.name==="TimeoutError")throw new Pl;throw i});if(o.status!==200)throw new fn("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch{throw new fn("Failed to parse the JSON Web Key Set HTTP response as JSON")}}var lr=Symbol();function Pe(e,t){return Number.isFinite(e)&&Date.now()<e+t}function ur(e,t,r){if(Number.isNaN(e))throw TypeError(`"${r}" option must not be NaN`);return typeof e==="number"?e:t}function Lf(e,t){if(!(e instanceof URL))throw TypeError("url must be an instance of URL");let r=new URL(e.href).href,n=t??{},o=n.timeoutDuration;if(typeof o==="number"&&(!Number.isInteger(o)||o<0))throw TypeError('"timeoutDuration" option must be a non-negative integer');let i=typeof o==="number"?o:5000,a=ur(n.cooldownDuration,30000,"cooldownDuration"),s=ur(n.cacheMaxAge,600000,"cacheMaxAge"),c=new Headers(n.headers);if(At&&!c.has("User-Agent"))c.set("User-Agent",At);if(!c.has("accept"))c.set("accept","application/json, application/jwk-set+json");let p=n[fr],d=n[lr],f,l,S=0,v=0,w;if(d&&typeof d==="object"){let{uat:y,jwks:x}=d;if(Pe(y,s)&&He(x))f=y,w=Ko(x)}let h=async()=>{if(l&&dn())l=void 0;if(!l){let y=++S,x=l=un(r,c,AbortSignal.timeout(i),p).then((C)=>{let U=Ko(C);if(y<=v)return;w=U;let T=Date.now();if(d)d.uat=T,d.jwks=C;f=T,v=y}).finally(()=>{if(l===x)l=void 0})}await l};return Object.defineProperties(async(y,x)=>{if(!w||!Pe(f,s))await h();try{return await w(y,x)}catch(C){if(C instanceof Ol&&!Pe(f,a))return await h(),w(y,x);throw C}},{coolingDown:{get:()=>Pe(f,a),enumerable:!0},fresh:{get:()=>Pe(f,s),enumerable:!0},reload:{value:h,enumerable:!0},reloading:{get:()=>!!l,enumerable:!0},jwks:{value:()=>w?.jwks(),enumerable:!0}})}var ln=Q;class Nc extends ln{encode(){let e=mr(JSON.stringify({alg:"none"})),t=mr(fe(this));return`${e}.${t}.`}static decode(e,t){if(typeof e!=="string")throw new $r("Unsecured JWT must be a string");let{0:r,1:n,2:o,length:i}=e.split(".");if(i!==3||o!=="")throw new $r("Invalid Unsecured JWT");let a,s;try{a=V(r,qr,"JWS Protected Header is invalid");let p=D(qr,ie,void 0,a,a);s=ae(a,p)}catch(p){if(!(p instanceof qr))throw p;throw new $r("Invalid Unsecured JWT",{cause:p})}if(a.alg!=="none")throw new $r("Invalid Unsecured JWT");if(!s)throw new $r("JWTs MUST NOT use unencoded payload");return{payload:ue(a,A(n,"payload",$r),t),header:a}}}async function bv(e,t,r){if(typeof e!=="string"||e.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw TypeError('"pkcs8" must be PKCS#8 formatted string');return pr(e,t,r)}async function kn(e,t,r){if(!E(e))throw TypeError("JWK must be an object");let n=Be(e),o=me(r?.extractable),{alg:i}=n;t??=i;let a=o??n.ext;if(n.kty!=="oct"&&!t)throw TypeError('"alg" argument is required when "jwk.alg" is not present');switch(n.kty){case"oct":if(typeof n.k!=="string")throw TypeError('missing "k" (Key Value) Parameter value');return I(n.k);case"AKP":{if(typeof i!=="string"||!i)throw TypeError('missing "alg" (Algorithm) Parameter value');if(t!==i)throw TypeError("JWK alg and alg option value mismatch");return B(ee(t),{...n,ext:a})}case"RSA":case"EC":case"OKP":return B(ee(t),{...n,alg:t,ext:a});default:throw new m('Unsupported "kty" (Key Type) Parameter value')}}function lo(e){let t;if(typeof e==="string"){let n=e.split(".");if(n.length===3||n.length===5)[t]=n}else if(typeof e==="object"&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof t!=="string"||!t)throw TypeError(r);return V(t,TypeError,r)}function rn(e){if(typeof e!=="string")throw new $r("JWTs must use Compact JWS serialization, JWT must be a string");let{1:t,length:r}=e.split(".");if(r===5)throw new $r("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new $r("Invalid JWT");if(!t)throw new $r("JWTs must contain a payload");let n;try{n=I(t)}catch{throw new $r("Failed to base64url decode the payload")}let o;try{o=JSON.parse(te.decode(n))}catch{throw new $r("Failed to parse the decoded payload as JSON")}if(!E(o))throw new $r("Invalid JWT Claims Set");return o}function mn(e){let t=e?.modulusLength??2048;if(typeof t!=="number"||!Number.isInteger(t)||t<2048)throw new m("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return t}async function Zf(e,t){let r=me(t?.extractable),n=ee(e,le);if(n.secret)Je(le);let o;if(n.resolve){let i=t?.crv??"P-256";switch(i){case"P-256":case"P-384":case"P-521":o={name:"ECDH",namedCurve:i};break;case"X25519":o={name:"X25519"};break;default:throw new m("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519")}}else{if(n.crv!==void 0&&t?.crv!==void 0&&t.crv!==n.crv)throw new m(`Invalid or unsupported crv option provided, the only supported value for ${e} is ${n.crv}`);o=n.kty[0]==="RSA"?{...n.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:mn(t)}:n.subtle}return crypto.subtle.generateKey(o,r??!1,[...n.usages[1],...n.usages[0]])}export{fn,xi,qr,$r,Ml,Ol,Dc,Pl,ad,EA,mr,Jm,ld,Vr,cd,ks,ud,Dl,Nl,Ko,Lf,Nc,bv,kn,lo,rn,Zf};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Z,
|
|
2
|
+
import{Z,le}from"./chunk-65dh7x4c.js";var X=Z(function(wt,V){var A=1000,E=A*60,I=E*60,S=I*24,Oe=S*7,Se=S*365.25;V.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return Pe(e);else if(t==="number"&&isFinite(e))return r.long?Ae(e):je(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Pe(e){if(e=String(e),e.length>100)return;var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!r)return;var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*Se;case"weeks":case"week":case"w":return t*Oe;case"days":case"day":case"d":return t*S;case"hours":case"hour":case"hrs":case"hr":case"h":return t*I;case"minutes":case"minute":case"mins":case"min":case"m":return t*E;case"seconds":case"second":case"secs":case"sec":case"s":return t*A;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}function je(e){var r=Math.abs(e);if(r>=S)return Math.round(e/S)+"d";if(r>=I)return Math.round(e/I)+"h";if(r>=E)return Math.round(e/E)+"m";if(r>=A)return Math.round(e/A)+"s";return e+"ms"}function Ae(e){var r=Math.abs(e);if(r>=S)return k(e,r,S,"day");if(r>=I)return k(e,r,I,"hour");if(r>=E)return k(e,r,E,"minute");if(r>=A)return k(e,r,A,"second");return e+" ms"}function k(e,r,t,n){var s=r>=t*1.5;return Math.round(e/t)+" "+n+(s?"s":"")}});var U=Z(function(Ft,Y){function Ee(e){t.debug=t,t.default=t,t.coerce=_,t.disable=l,t.enable=s,t.enabled=v,t.humanize=X(),t.destroy=N,Object.keys(e).forEach((o)=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={};function r(o){let i=0;for(let c=0;c<o.length;c++)i=(i<<5)-i+o.charCodeAt(c),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(o){let i,c=null,a,y;function f(...d){if(!f.enabled)return;let m=f,g=Number(new Date),x=g-(i||g);if(m.diff=x,m.prev=i,m.curr=g,i=g,d[0]=t.coerce(d[0]),typeof d[0]!=="string")d.unshift("%O");let w=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(O,j)=>{if(O==="%%")return"%";w++;let Q=t.formatters[j];if(typeof Q==="function"){let xe=d[w];O=Q.call(m,xe),d.splice(w,1),w--}return O}),t.formatArgs.call(m,d),(m.log||t.log).apply(m,d)}if(f.namespace=o,f.useColors=t.useColors(),f.color=t.selectColor(o),f.extend=n,f.destroy=t.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(c!==null)return c;if(a!==t.namespaces)a=t.namespaces,y=t.enabled(o);return y},set:(d)=>{c=d}}),typeof t.init==="function")t.init(f);return f}function n(o,i){let c=t(this.namespace+(typeof i>"u"?":":i)+o);return c.log=this.log,c}function s(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let i=(typeof o==="string"?o:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let c of i)if(c[0]==="-")t.skips.push(c.slice(1));else t.names.push(c)}function u(o,i){let c=0,a=0,y=-1,f=0;while(c<o.length)if(a<i.length&&(i[a]===o[c]||i[a]==="*"))if(i[a]==="*")y=a,f=c,a++;else c++,a++;else if(y!==-1)a=y+1,f++,c=f;else return!1;while(a<i.length&&i[a]==="*")a++;return a===i.length}function l(){let o=[...t.names,...t.skips.map((i)=>"-"+i)].join(",");return t.enable(""),o}function v(o){for(let i of t.skips)if(u(o,i))return!1;for(let i of t.names)if(u(o,i))return!0;return!1}function _(o){if(o instanceof Error)return o.stack||o.message;return o}function N(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Y.exports=Ee});var ee=Z(function(z,L){z.formatArgs=Me;z.save=Ne;z.load=qe;z.useColors=Ie;z.storage=Be();z.destroy=(()=>{let e=!1;return()=>{if(!e)e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();z.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ie(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Me(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+L.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(s)=>{if(s==="%%")return;if(t++,s==="%c")n=t}),e.splice(n,0,r)}z.log=console.debug||console.log||(()=>{});function Ne(e){try{if(e)z.storage.setItem("debug",e);else z.storage.removeItem("debug")}catch(r){}}function qe(){let e;try{e=z.storage.getItem("debug")||z.storage.getItem("DEBUG")}catch(r){}if(!e&&typeof process<"u"&&"env"in process)e=process.env.DEBUG;return e}function Be(){try{return localStorage}catch(e){}}L.exports=U()(z);var{formatters:De}=L.exports;De.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var se=Z(function(G,T){var te=le("tty"),F=le("util");G.init=Qe;G.log=We;G.formatArgs=Ge;G.save=Ze;G.load=Ke;G.useColors=ze;G.destroy=F.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");G.colors=[6,2,3,4,5,1];try{let e=(()=>{throw new Error("Cannot require module "+"supports-color");})();if(e&&(e.stderr||e).level>=2)G.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(e){}G.inspectOpts=Object.keys(process.env).filter((e)=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(s,u)=>u.toUpperCase()),n=process.env[r];if(/^(yes|on|true|enabled)$/i.test(n))n=!0;else if(/^(no|off|false|disabled)$/i.test(n))n=!1;else if(n==="null")n=null;else n=Number(n);return e[t]=n,e},{});function ze(){return"colors"in G.inspectOpts?Boolean(G.inspectOpts.colors):te.isatty(process.stderr.fd)}function Ge(e){let{namespace:r,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${s};1m${r} \x1B[0m`;e[0]=u+e[0].split(`
|
|
3
3
|
`).join(`
|
|
4
4
|
`+u),e.push(s+"m+"+T.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Je()+r+" "+e[0]}function Je(){if(G.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function We(...e){return process.stderr.write(F.formatWithOptions(G.inspectOpts,...e)+`
|
|
5
5
|
`)}function Ze(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function Ke(){return process.env.DEBUG}function Qe(e){e.inspectOpts={};let r=Object.keys(G.inspectOpts);for(let t=0;t<r.length;t++)e.inspectOpts[r[t]]=G.inspectOpts[r[t]]}T.exports=U()(G);var{formatters:re}=T.exports;re.o=function(e){return this.inspectOpts.colors=this.useColors,F.inspect(e,this.inspectOpts).split(`
|
|
6
|
-
`).map((r)=>r.trim()).join(" ")};re.O=function(e){return this.inspectOpts.colors=this.useColors,F.inspect(e,this.inspectOpts)}});var W=Z(function(St,J){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)J.exports=ee();else J.exports=se()});var ce=Z(function(p){var st=p&&p.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),ot=p&&p.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),oe=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))st(r,e,t)}return ot(r,e),r};Object.defineProperty(p,"__esModule",{value:!0});p.req=p.json=p.toBuffer=void 0;var it=oe(
|
|
6
|
+
`).map((r)=>r.trim()).join(" ")};re.O=function(e){return this.inspectOpts.colors=this.useColors,F.inspect(e,this.inspectOpts)}});var W=Z(function(St,J){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)J.exports=ee();else J.exports=se()});var ce=Z(function(p){var st=p&&p.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),ot=p&&p.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),oe=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))st(r,e,t)}return ot(r,e),r};Object.defineProperty(p,"__esModule",{value:!0});p.req=p.json=p.toBuffer=void 0;var it=oe(le("http")),ct=oe(le("https"));async function ie(e){let r=0,t=[];for await(let n of e)r+=n.length,t.push(n);return Buffer.concat(t,r)}p.toBuffer=ie;async function ut(e){let t=(await ie(e)).toString("utf8");try{return JSON.parse(t)}catch(n){let s=n;throw s.message+=` (input: ${t})`,s}}p.json=ut;function at(e,r={}){let n=((typeof e==="string"?e:e.href).startsWith("https:")?ct:it).request(e,r),s=new Promise((u,l)=>{n.once("response",u).once("error",l).end()});return n.then=s.then.bind(s),n}p.req=at});var he=Z(function(h){var ae=h&&h.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),ft=h&&h.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),fe=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))ae(r,e,t)}return ft(r,e),r},lt=h&&h.__exportStar||function(e,r){for(var t in e)if(t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t))ae(r,e,t)};Object.defineProperty(h,"__esModule",{value:!0});h.Agent=void 0;var dt=fe(le("net")),ue=fe(le("http")),de=le("https");lt(ce(),h);var b=Symbol("AgentBaseInternalState");class pe extends ue.Agent{constructor(e){super(e);this[b]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==="boolean")return e.secureEndpoint;if(typeof e.protocol==="string")return e.protocol==="https:"}let{stack:r}=Error();if(typeof r!=="string")return!1;return r.split(`
|
|
7
7
|
`).some((t)=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[e])this.sockets[e]=[];let r=new dt.Socket({writable:!1});return this.sockets[e].push(r),this.totalSocketCount++,r}decrementSockets(e,r){if(!this.sockets[e]||r===null)return;let t=this.sockets[e],n=t.indexOf(r);if(n!==-1){if(t.splice(n,1),this.totalSocketCount--,t.length===0)delete this.sockets[e]}}getName(e){if(this.isSecureEndpoint(e))return de.Agent.prototype.getName.call(this,e);return super.getName(e)}createSocket(e,r,t){let n={...r,secureEndpoint:this.isSecureEndpoint(r)},s=this.getName(n),u=this.incrementSockets(s);Promise.resolve().then(()=>this.connect(e,n)).then((l)=>{if(this.decrementSockets(s,u),l instanceof ue.Agent)try{return l.addRequest(e,n)}catch(v){return t(v)}this[b].currentSocket=l,super.createSocket(e,r,t)},(l)=>{this.decrementSockets(s,u),t(l)})}createConnection(){let e=this[b].currentSocket;if(this[b].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[b].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){if(this[b])this[b].defaultPort=e}get protocol(){return this[b].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){if(this[b])this[b].protocol=e}}h.Agent=pe});var Ce=Z(function(M){var pt=M&&M.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(M,"__esModule",{value:!0});M.parseProxyResponse=void 0;var ht=pt(W()),H=(0,ht.default)("https-proxy-agent:parse-proxy-response");function Ct(e){return new Promise((r,t)=>{let n=0,s=[];function u(){let o=e.read();if(o)N(o);else e.once("readable",u)}function l(){e.removeListener("end",v),e.removeListener("error",_),e.removeListener("readable",u)}function v(){l(),H("onend"),t(Error("Proxy connection ended before receiving CONNECT response"))}function _(o){l(),H("onerror %o",o),t(o)}function N(o){s.push(o),n+=o.length;let i=Buffer.concat(s,n),c=i.indexOf(`\r
|
|
8
8
|
\r
|
|
9
9
|
`);if(c===-1){H("have not received end of HTTP headers yet..."),u();return}let a=i.slice(0,c).toString("ascii").split(`\r
|
|
10
|
-
`),y=a.shift();if(!y)return e.destroy(),t(Error("No header received from proxy CONNECT response"));let f=y.split(" "),d=+f[1],m=f.slice(2).join(" "),g={};for(let x of a){if(!x)continue;let w=x.indexOf(":");if(w===-1)return e.destroy(),t(Error(`Invalid header from proxy CONNECT response: "${x}"`));let D=x.slice(0,w).toLowerCase(),O=x.slice(w+1).trimStart(),j=g[D];if(typeof j==="string")g[D]=[j,O];else if(Array.isArray(j))j.push(O);else g[D]=O}H("got proxy server response: %o %o",y,g),l(),r({connect:{statusCode:d,statusText:m,headers:g},buffered:i})}e.on("error",_),e.on("end",v),u()})}M.parseProxyResponse=Ct});var _t=Z(function(C){var yt=C&&C.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),gt=C&&C.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),me=C&&C.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))yt(r,e,t)}return gt(r,e),r},ve=C&&C.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0});C.HttpsProxyAgent=void 0;var R=me(
|
|
10
|
+
`),y=a.shift();if(!y)return e.destroy(),t(Error("No header received from proxy CONNECT response"));let f=y.split(" "),d=+f[1],m=f.slice(2).join(" "),g={};for(let x of a){if(!x)continue;let w=x.indexOf(":");if(w===-1)return e.destroy(),t(Error(`Invalid header from proxy CONNECT response: "${x}"`));let D=x.slice(0,w).toLowerCase(),O=x.slice(w+1).trimStart(),j=g[D];if(typeof j==="string")g[D]=[j,O];else if(Array.isArray(j))j.push(O);else g[D]=O}H("got proxy server response: %o %o",y,g),l(),r({connect:{statusCode:d,statusText:m,headers:g},buffered:i})}e.on("error",_),e.on("end",v),u()})}M.parseProxyResponse=Ct});var _t=Z(function(C){var yt=C&&C.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),gt=C&&C.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),me=C&&C.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))yt(r,e,t)}return gt(r,e),r},ve=C&&C.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0});C.HttpsProxyAgent=void 0;var R=me(le("net")),ye=me(le("tls")),bt=ve(le("assert")),mt=ve(W()),_e=he(),we=le("url"),Fe=Ce(),B=(0,mt.default)("https-proxy-agent"),ge=(e)=>{if(e.servername===void 0&&e.host&&!R.isIP(e.host))return{...e,servername:e.host};return e};class K extends _e.Agent{constructor(e,r){super(r);this.options={path:void 0},this.proxy=typeof e==="string"?new we.URL(e):e,this.proxyHeaders=r?.headers??{},B("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let t=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?be(r,"headers"):null,host:t,port:n}}async connect(e,r){let{proxy:t}=this;if(!r.host)throw TypeError('No "host" provided');let n;if(t.protocol==="https:")B("Creating `tls.Socket`: %o",this.connectOpts),n=ye.connect(ge(this.connectOpts));else B("Creating `net.Socket`: %o",this.connectOpts),n=R.connect(this.connectOpts);let s=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},u=R.isIPv6(r.host)?`[${r.host}]`:r.host,l=`CONNECT ${u}:${r.port} HTTP/1.1\r
|
|
11
11
|
`;if(t.username||t.password){let i=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(i).toString("base64")}`}if(s.Host=`${u}:${r.port}`,!s["Proxy-Connection"])s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let i of Object.keys(s))l+=`${i}: ${s[i]}\r
|
|
12
12
|
`;let v=Fe.parseProxyResponse(n);n.write(`${l}\r
|
|
13
13
|
`);let{connect:_,buffered:N}=await v;if(e.emit("proxyConnect",_),this.emit("proxyConnect",_,e),_.statusCode===200){if(e.once("socket",vt),r.secureEndpoint)return B("Upgrading socket connection to TLS"),ye.connect({...be(ge(r),"host","path","port"),socket:n});return n}n.destroy();let o=new R.Socket({writable:!1});return o.readable=!0,e.once("socket",(i)=>{B("Replaying proxy buffer for failed request"),(0,bt.default)(i.listenerCount("data")>0),i.push(N),i.push(null)}),o}}K.protocols=["http","https"];C.HttpsProxyAgent=K;function vt(e){e.resume()}function be(e,...r){let t={},n;for(n in e)if(!r.includes(n))t[n]=e[n];return t}});export default _t();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qa,hr}from"./chunk-1e1q1hyg.js";var C=function(e,t){if(typeof e==="string"&&/^\.\.?\//.test(e))return e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,a,s,i){return n?t?".jsx":".js":a&&(!s||!i)?r:a+s+"."+i.toLowerCase()+"js"});return e},x=(e)=>import(C(e));function P(){return globalThis.process?.env}function A(){return{async env(e){let t=P()?.[e];return typeof t==="string"&&t.trim().length>0?t:void 0},async fileExists(e){try{let t=await x("node:fs/promises"),r=e;if(r.startsWith("~"))r=(await x("node:os")).homedir()+r.slice(1);return await t.access(r),!0}catch{return!1}}}}class Yu{credentials=new Map;chains=new Map;enqueue(e,t){let r=this.chains.get(e)??Promise.resolve(),n=(async()=>(await r.catch(()=>{}),t()))();return this.chains.set(e,n.catch(()=>{})),n}async read(e){return this.credentials.get(e)}async list(){return[...this.credentials].map(([e,t])=>({providerId:e,type:t.type}))}modify(e,t){return this.enqueue(e,async()=>{let r=this.credentials.get(e),n=await t(r);if(n!==void 0)this.credentials.set(e,n);return n??r})}delete(e){return this.enqueue(e,async()=>{this.credentials.delete(e)})}}class u extends Error{code;constructor(e,t,r){super(S(t,r?.cause),r);this.name="ModelsError",this.code=e}}function S(e,t){if(t===void 0||t===null)return e;let r=qa(t).trim();if(!r||e.includes(r))return e;return`${e}: ${r}`}async function v(e,t,r,n){let a=n?.env?K(r,n.env):r;if(n?.apiKey!==void 0&&e.auth.apiKey)return m(a,e.auth.apiKey,e.id,{type:"api_key",key:n.apiKey,env:n.env});let s=await q(t,e.id);if(s){if(s.type==="oauth"&&e.auth.oauth)return b(t,e.id,e.auth.oauth,s);if(s.type==="api_key"&&e.auth.apiKey){let i=n?.env?{...s,env:{...s.env,...n.env}}:s;return m(a,e.auth.apiKey,e.id,i)}return}return e.auth.apiKey?m(a,e.auth.apiKey,e.id,void 0):void 0}function K(e,t){return{env:async(r)=>t[r]||await e.env(r),fileExists:(r)=>e.fileExists(r)}}async function b(e,t,r,n){let a=n;if(Date.now()>=a.expires){let s;try{s=await e.modify(t,async(i)=>{if(i?.type!=="oauth")return;if(Date.now()<i.expires)return;try{return await r.refresh(i)}catch(c){throw new u("oauth",`OAuth refresh failed for ${t}`,{cause:c})}})}catch(i){if(i instanceof u)throw i;throw new u("auth",`Credential store modify failed for ${t}`,{cause:i})}if(s?.type!=="oauth")return;a=s}try{return{auth:await r.toAuth(a),source:"OAuth"}}catch(s){throw new u("oauth",`OAuth auth derivation failed for ${t}`,{cause:s})}}async function m(e,t,r,n){try{return await t.resolve({ctx:e,credential:n})}catch(a){throw new u("auth",`API key auth failed for provider ${r}`,{cause:a})}}async function q(e,t){try{return await e.read(t)}catch(r){throw new u("auth",`Credential store read failed for ${t}`,{cause:r})}}function E(e,t){return{role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function R(e){return typeof e.result==="function"}async function _(e,t){for await(let r of t)e.push(r);e.end(R(t)?await t.result():void 0)}function y(e,t){let r=new hr;return t().then((n)=>_(r,n)).catch((n)=>{let a=E(e,n);r.push({type:"error",reason:"error",error:a}),r.end(a)}),r}function vn(e){return{stream:(t,r,n)=>y(t,async()=>(await e()).stream(t,r,n)),streamSimple:(t,r,n)=>y(t,async()=>(await e()).streamSimple(t,r,n))}}class g{entries=new Map;async read(e){let t=this.entries.get(e);return t?structuredClone(t):void 0}async write(e,t){this.entries.set(e,structuredClone(t))}async delete(e){this.entries.delete(e)}}function k(e,t){if(!e&&!t)return;let r={...e};for(let[n,a]of Object.entries(t??{})){let s=n.toLowerCase();for(let i of Object.keys(r))if(i.toLowerCase()===s)delete r[i];r[n]=a}return r}class M{providers=new Map;credentials;modelsStore;authContext;constructor(e){this.credentials=e?.credentials??new Yu,this.modelsStore=e?.modelsStore??new g,this.authContext=e?.authContext??A()}setProvider(e){this.providers.set(e.id,e)}deleteProvider(e){this.providers.delete(e)}clearProviders(){this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(e){return this.providers.get(e)}getModels(e){if(e!==void 0){let r=this.providers.get(e);if(!r)return[];try{return r.getModels()}catch{return[]}}let t=[];for(let r of this.providers.values())try{t.push(...r.getModels())}catch{}return t}getModel(e,t){return this.getModels(e).find((r)=>r.id===t)}async refresh(e={}){let t=e.allowNetwork??!0,r=new Map,n=Array.from(this.providers.values()).filter((a)=>a.refreshModels!==void 0);return await Promise.all(n.map(async(a)=>{if(e.signal?.aborted)return;let s={read:()=>this.modelsStore.read(a.id),write:(c)=>this.modelsStore.write(a.id,c),delete:()=>this.modelsStore.delete(a.id)},i;try{i=await this.readCredential(a.id);let c=await this.resolveRefreshCredential(a,i,t,e.signal);if(!c)return;await a.refreshModels({credential:c,store:s,allowNetwork:t,force:e.force,signal:e.signal})}catch(c){if(!e.signal?.aborted)r.set(a.id,c instanceof Error?c:new u("model_source",`Model refresh failed for ${a.id}`,{cause:c}));try{await a.refreshModels({credential:i,store:s,allowNetwork:!1,signal:e.signal})}catch{}}})),{aborted:e.signal?.aborted??!1,errors:r}}async resolveRefreshCredential(e,t,r,n){if(t?.type==="oauth"){let c=e.auth.oauth;if(!c)return;if(!r||Date.now()<t.expires)return t;if(n?.aborted)return;let p=await this.credentials.modify(e.id,async(l)=>{if(l?.type!=="oauth"||Date.now()<l.expires)return;return c.refresh(l,n)});return p?.type==="oauth"?p:void 0}let a=e.auth.apiKey;if(!a)return;let s=t?.type==="api_key"?t:void 0,i=await a.resolve({ctx:this.authContext,credential:s});if(!i)return;return{type:"api_key",key:i.auth.apiKey,env:i.env}}async readCredential(e){try{return await this.credentials.read(e)}catch(t){throw new u("auth",`Credential store read failed for ${e}`,{cause:t})}}async checkProviderAuth(e,t){if(t?.type==="oauth")return e.auth.oauth?{source:"OAuth",type:"oauth"}:void 0;let r=e.auth.apiKey;if(!r)return;if(r.check)try{return await r.check({ctx:this.authContext,credential:t?.type==="api_key"?t:void 0})}catch(a){throw new u("auth",`API key auth check failed for provider ${e.id}`,{cause:a})}let n=await v(e,this.credentials,this.authContext);return n?{source:n.source,type:"api_key"}:void 0}async checkAuth(e){let t=this.providers.get(e);if(!t)return;return this.checkProviderAuth(t,await this.readCredential(e))}async getAvailable(e){let t=e?[this.providers.get(e)].filter((n)=>n!==void 0):this.getProviders();return(await Promise.all(t.map(async(n)=>{let a=await this.readCredential(n.id);return{provider:n,credential:a,auth:await this.checkProviderAuth(n,a)}}))).flatMap(({provider:n,credential:a,auth:s})=>{if(!s)return[];let i=n.getModels();return n.filterModels?.(i,a)??i})}async getAuth(e,t){let r=typeof e==="string"?e:e.provider,n=this.providers.get(r);if(!n)return;let a=await v(n,this.credentials,this.authContext,t);if(!a||typeof e==="string"||!e.headers)return a;return{...a,auth:{...a.auth,headers:k(a.auth.headers,e.headers)}}}async login(e,t,r){let n=this.providers.get(e);if(!n)throw new u("provider",`Unknown provider: ${e}`);let a=t==="oauth"?n.auth.oauth:n.auth.apiKey;if(!a?.login)throw new u("auth",`${n.name} does not support ${t} login`);let s=await a.login(r);try{await this.credentials.modify(e,async()=>s)}catch(i){throw new u("auth",`Credential store modify failed for ${e}`,{cause:i})}return s}async logout(e){try{await this.credentials.delete(e)}catch(t){throw new u("auth",`Credential store delete failed for ${e}`,{cause:t})}}requireProvider(e){let t=this.providers.get(e.provider);if(!t)throw new u("provider",`Unknown provider: ${e.provider}`);return t}async applyAuth(e,t){this.requireProvider(e);let r=await this.getAuth(e,{apiKey:t?.apiKey,env:t?.env});if(!r)throw new u("auth",`Provider is not configured: ${e.provider}`);let n=r.auth,a=t?.apiKey??n.apiKey,s=k(n.headers,t?.headers);if(t?.transformHeaders)s=await t.transformHeaders(s??{});let i=r.env||t?.env?{...r.env??{},...t?.env??{}}:void 0,c=n.baseUrl?{...e,baseUrl:n.baseUrl}:e,{transformHeaders:p,...l}=t??{},o={...l,apiKey:a,headers:s,env:i};return{requestModel:c,requestOptions:o}}stream(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.stream(a,t,s)})}async complete(e,t,r){return this.stream(e,t,r).result()}streamSimple(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.streamSimple(a,t,s)})}async completeSimple(e,t,r){return this.streamSimple(e,t,r).result()}}function rA(e){return new M(e)}function Ze(e){let t=e.models,r=[],n,a=e.fetchModels,s=()=>{let o=[...t];for(let h of r){let d=o.findIndex((f)=>f.id===h.id);if(d>=0)o[d]=h;else o.push(h)}return o},i=typeof e.api.stream==="function"?e.api:void 0,c=i?void 0:e.api,p=(o)=>i??c?.[o.api],l=(o,h)=>{let d=p(o);if(!d)return y(o,async()=>{throw new u("stream",`Provider ${e.id} has no API implementation for "${o.api}"`)});return h(d)};return{id:e.id,name:e.name??e.id,baseUrl:e.baseUrl,headers:e.headers,auth:e.auth,getModels:s,refreshModels:a?(o)=>(n??=(async()=>{try{let h=await o.store.read();if(h)r=h.models.filter((f)=>f.provider===e.id).map((f)=>f);if(!o.allowNetwork||o.signal?.aborted)return;let d=await a(o);if(o.signal?.aborted)return;r=d,await o.store.write({models:d,checkedAt:Date.now()})}finally{n=void 0}})(),n):void 0,filterModels:e.filterModels,stream:(o,h,d)=>l(o,(f)=>f.stream(o,h,d)),streamSimple:(o,h,d)=>l(o,(f)=>f.streamSimple(o,h,d))}}function Vn(e,t){let r=t.input+t.cacheRead+t.cacheWrite,n=e.cost,a=-1;for(let c of e.cost.tiers??[])if(r>c.inputTokensAbove&&c.inputTokensAbove>a)n=c,a=c.inputTokensAbove;let s=t.cacheWrite1h??0,i=t.cacheWrite-s;return t.cost.input=n.input/1e6*t.input,t.cost.output=n.output/1e6*t.output,t.cost.cacheRead=n.cacheRead/1e6*t.cacheRead,t.cost.cacheWrite=(n.cacheWrite*i+n.input*2*s)/1e6,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite,t.cost}var w=["off","minimal","low","medium","high","xhigh","max"];function T(e){if(!e.reasoning)return["off"];return w.filter((t)=>{let r=e.thinkingLevelMap?.[t];if(r===null)return!1;if(t==="xhigh"||t==="max")return r!==void 0;return!0})}function bn(e,t){let r=T(e);if(r.includes(t))return t;let n=w.indexOf(t);if(n===-1)return r[0]??"off";for(let a=n;a<w.length;a++){let s=w[a];if(r.includes(s))return s}for(let a=n-1;a>=0;a--){let s=w[a];if(r.includes(s))return s}return r[0]??"off"}
|
|
3
|
-
export{
|
|
2
|
+
import{el,hr}from"./chunk-w4gqg27w.js";var C=function(e,t){if(typeof e==="string"&&/^\.\.?\//.test(e))return e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,a,s,i){return n?t?".jsx":".js":a&&(!s||!i)?r:a+s+"."+i.toLowerCase()+"js"});return e},x=(e)=>import(C(e));function P(){return globalThis.process?.env}function A(){return{async env(e){let t=P()?.[e];return typeof t==="string"&&t.trim().length>0?t:void 0},async fileExists(e){try{let t=await x("node:fs/promises"),r=e;if(r.startsWith("~"))r=(await x("node:os")).homedir()+r.slice(1);return await t.access(r),!0}catch{return!1}}}}class pd{credentials=new Map;chains=new Map;enqueue(e,t){let r=this.chains.get(e)??Promise.resolve(),n=(async()=>(await r.catch(()=>{}),t()))();return this.chains.set(e,n.catch(()=>{})),n}async read(e){return this.credentials.get(e)}async list(){return[...this.credentials].map(([e,t])=>({providerId:e,type:t.type}))}modify(e,t){return this.enqueue(e,async()=>{let r=this.credentials.get(e),n=await t(r);if(n!==void 0)this.credentials.set(e,n);return n??r})}delete(e){return this.enqueue(e,async()=>{this.credentials.delete(e)})}}class u extends Error{code;constructor(e,t,r){super(S(t,r?.cause),r);this.name="ModelsError",this.code=e}}function S(e,t){if(t===void 0||t===null)return e;let r=el(t).trim();if(!r||e.includes(r))return e;return`${e}: ${r}`}async function v(e,t,r,n){let a=n?.env?K(r,n.env):r;if(n?.apiKey!==void 0&&e.auth.apiKey)return m(a,e.auth.apiKey,e.id,{type:"api_key",key:n.apiKey,env:n.env});let s=await q(t,e.id);if(s){if(s.type==="oauth"&&e.auth.oauth)return b(t,e.id,e.auth.oauth,s);if(s.type==="api_key"&&e.auth.apiKey){let i=n?.env?{...s,env:{...s.env,...n.env}}:s;return m(a,e.auth.apiKey,e.id,i)}return}return e.auth.apiKey?m(a,e.auth.apiKey,e.id,void 0):void 0}function K(e,t){return{env:async(r)=>t[r]||await e.env(r),fileExists:(r)=>e.fileExists(r)}}async function b(e,t,r,n){let a=n;if(Date.now()>=a.expires){let s;try{s=await e.modify(t,async(i)=>{if(i?.type!=="oauth")return;if(Date.now()<i.expires)return;try{return await r.refresh(i)}catch(c){throw new u("oauth",`OAuth refresh failed for ${t}`,{cause:c})}})}catch(i){if(i instanceof u)throw i;throw new u("auth",`Credential store modify failed for ${t}`,{cause:i})}if(s?.type!=="oauth")return;a=s}try{return{auth:await r.toAuth(a),source:"OAuth"}}catch(s){throw new u("oauth",`OAuth auth derivation failed for ${t}`,{cause:s})}}async function m(e,t,r,n){try{return await t.resolve({ctx:e,credential:n})}catch(a){throw new u("auth",`API key auth failed for provider ${r}`,{cause:a})}}async function q(e,t){try{return await e.read(t)}catch(r){throw new u("auth",`Credential store read failed for ${t}`,{cause:r})}}function E(e,t){return{role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function R(e){return typeof e.result==="function"}async function _(e,t){for await(let r of t)e.push(r);e.end(R(t)?await t.result():void 0)}function y(e,t){let r=new hr;return t().then((n)=>_(r,n)).catch((n)=>{let a=E(e,n);r.push({type:"error",reason:"error",error:a}),r.end(a)}),r}function wn(e){return{stream:(t,r,n)=>y(t,async()=>(await e()).stream(t,r,n)),streamSimple:(t,r,n)=>y(t,async()=>(await e()).streamSimple(t,r,n))}}class g{entries=new Map;async read(e){let t=this.entries.get(e);return t?structuredClone(t):void 0}async write(e,t){this.entries.set(e,structuredClone(t))}async delete(e){this.entries.delete(e)}}function k(e,t){if(!e&&!t)return;let r={...e};for(let[n,a]of Object.entries(t??{})){let s=n.toLowerCase();for(let i of Object.keys(r))if(i.toLowerCase()===s)delete r[i];r[n]=a}return r}class M{providers=new Map;credentials;modelsStore;authContext;constructor(e){this.credentials=e?.credentials??new pd,this.modelsStore=e?.modelsStore??new g,this.authContext=e?.authContext??A()}setProvider(e){this.providers.set(e.id,e)}deleteProvider(e){this.providers.delete(e)}clearProviders(){this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(e){return this.providers.get(e)}getModels(e){if(e!==void 0){let r=this.providers.get(e);if(!r)return[];try{return r.getModels()}catch{return[]}}let t=[];for(let r of this.providers.values())try{t.push(...r.getModels())}catch{}return t}getModel(e,t){return this.getModels(e).find((r)=>r.id===t)}async refresh(e={}){let t=e.allowNetwork??!0,r=new Map,n=Array.from(this.providers.values()).filter((a)=>a.refreshModels!==void 0);return await Promise.all(n.map(async(a)=>{if(e.signal?.aborted)return;let s={read:()=>this.modelsStore.read(a.id),write:(c)=>this.modelsStore.write(a.id,c),delete:()=>this.modelsStore.delete(a.id)},i;try{i=await this.readCredential(a.id);let c=await this.resolveRefreshCredential(a,i,t,e.signal);if(!c)return;await a.refreshModels({credential:c,store:s,allowNetwork:t,force:e.force,signal:e.signal})}catch(c){if(!e.signal?.aborted)r.set(a.id,c instanceof Error?c:new u("model_source",`Model refresh failed for ${a.id}`,{cause:c}));try{await a.refreshModels({credential:i,store:s,allowNetwork:!1,signal:e.signal})}catch{}}})),{aborted:e.signal?.aborted??!1,errors:r}}async resolveRefreshCredential(e,t,r,n){if(t?.type==="oauth"){let c=e.auth.oauth;if(!c)return;if(!r||Date.now()<t.expires)return t;if(n?.aborted)return;let p=await this.credentials.modify(e.id,async(l)=>{if(l?.type!=="oauth"||Date.now()<l.expires)return;return c.refresh(l,n)});return p?.type==="oauth"?p:void 0}let a=e.auth.apiKey;if(!a)return;let s=t?.type==="api_key"?t:void 0,i=await a.resolve({ctx:this.authContext,credential:s});if(!i)return;return{type:"api_key",key:i.auth.apiKey,env:i.env}}async readCredential(e){try{return await this.credentials.read(e)}catch(t){throw new u("auth",`Credential store read failed for ${e}`,{cause:t})}}async checkProviderAuth(e,t){if(t?.type==="oauth")return e.auth.oauth?{source:"OAuth",type:"oauth"}:void 0;let r=e.auth.apiKey;if(!r)return;if(r.check)try{return await r.check({ctx:this.authContext,credential:t?.type==="api_key"?t:void 0})}catch(a){throw new u("auth",`API key auth check failed for provider ${e.id}`,{cause:a})}let n=await v(e,this.credentials,this.authContext);return n?{source:n.source,type:"api_key"}:void 0}async checkAuth(e){let t=this.providers.get(e);if(!t)return;return this.checkProviderAuth(t,await this.readCredential(e))}async getAvailable(e){let t=e?[this.providers.get(e)].filter((n)=>n!==void 0):this.getProviders();return(await Promise.all(t.map(async(n)=>{let a=await this.readCredential(n.id);return{provider:n,credential:a,auth:await this.checkProviderAuth(n,a)}}))).flatMap(({provider:n,credential:a,auth:s})=>{if(!s)return[];let i=n.getModels();return n.filterModels?.(i,a)??i})}async getAuth(e,t){let r=typeof e==="string"?e:e.provider,n=this.providers.get(r);if(!n)return;let a=await v(n,this.credentials,this.authContext,t);if(!a||typeof e==="string"||!e.headers)return a;return{...a,auth:{...a.auth,headers:k(a.auth.headers,e.headers)}}}async login(e,t,r){let n=this.providers.get(e);if(!n)throw new u("provider",`Unknown provider: ${e}`);let a=t==="oauth"?n.auth.oauth:n.auth.apiKey;if(!a?.login)throw new u("auth",`${n.name} does not support ${t} login`);let s=await a.login(r);try{await this.credentials.modify(e,async()=>s)}catch(i){throw new u("auth",`Credential store modify failed for ${e}`,{cause:i})}return s}async logout(e){try{await this.credentials.delete(e)}catch(t){throw new u("auth",`Credential store delete failed for ${e}`,{cause:t})}}requireProvider(e){let t=this.providers.get(e.provider);if(!t)throw new u("provider",`Unknown provider: ${e.provider}`);return t}async applyAuth(e,t){this.requireProvider(e);let r=await this.getAuth(e,{apiKey:t?.apiKey,env:t?.env});if(!r)throw new u("auth",`Provider is not configured: ${e.provider}`);let n=r.auth,a=t?.apiKey??n.apiKey,s=k(n.headers,t?.headers);if(t?.transformHeaders)s=await t.transformHeaders(s??{});let i=r.env||t?.env?{...r.env??{},...t?.env??{}}:void 0,c=n.baseUrl?{...e,baseUrl:n.baseUrl}:e,{transformHeaders:p,...l}=t??{},o={...l,apiKey:a,headers:s,env:i};return{requestModel:c,requestOptions:o}}stream(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.stream(a,t,s)})}async complete(e,t,r){return this.stream(e,t,r).result()}streamSimple(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.streamSimple(a,t,s)})}async completeSimple(e,t,r){return this.streamSimple(e,t,r).result()}}function CA(e){return new M(e)}function Ze(e){let t=e.models,r=[],n,a=e.fetchModels,s=()=>{let o=[...t];for(let h of r){let d=o.findIndex((f)=>f.id===h.id);if(d>=0)o[d]=h;else o.push(h)}return o},i=typeof e.api.stream==="function"?e.api:void 0,c=i?void 0:e.api,p=(o)=>i??c?.[o.api],l=(o,h)=>{let d=p(o);if(!d)return y(o,async()=>{throw new u("stream",`Provider ${e.id} has no API implementation for "${o.api}"`)});return h(d)};return{id:e.id,name:e.name??e.id,baseUrl:e.baseUrl,headers:e.headers,auth:e.auth,getModels:s,refreshModels:a?(o)=>(n??=(async()=>{try{let h=await o.store.read();if(h)r=h.models.filter((f)=>f.provider===e.id).map((f)=>f);if(!o.allowNetwork||o.signal?.aborted)return;let d=await a(o);if(o.signal?.aborted)return;r=d,await o.store.write({models:d,checkedAt:Date.now()})}finally{n=void 0}})(),n):void 0,filterModels:e.filterModels,stream:(o,h,d)=>l(o,(f)=>f.stream(o,h,d)),streamSimple:(o,h,d)=>l(o,(f)=>f.streamSimple(o,h,d))}}function Kn(e,t){let r=t.input+t.cacheRead+t.cacheWrite,n=e.cost,a=-1;for(let c of e.cost.tiers??[])if(r>c.inputTokensAbove&&c.inputTokensAbove>a)n=c,a=c.inputTokensAbove;let s=t.cacheWrite1h??0,i=t.cacheWrite-s;return t.cost.input=n.input/1e6*t.input,t.cost.output=n.output/1e6*t.output,t.cost.cacheRead=n.cacheRead/1e6*t.cacheRead,t.cost.cacheWrite=(n.cacheWrite*i+n.input*2*s)/1e6,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite,t.cost}var w=["off","minimal","low","medium","high","xhigh","max"];function T(e){if(!e.reasoning)return["off"];return w.filter((t)=>{let r=e.thinkingLevelMap?.[t];if(r===null)return!1;if(t==="xhigh"||t==="max")return r!==void 0;return!0})}function En(e,t){let r=T(e);if(r.includes(t))return t;let n=w.indexOf(t);if(n===-1)return r[0]??"off";for(let a=n;a<w.length;a++){let s=w[a];if(r.includes(s))return s}for(let a=n-1;a>=0;a--){let s=w[a];if(r.includes(s))return s}return r[0]??"off"}
|
|
3
|
+
export{pd,wn,CA,Ze,Kn,En};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function c(e){if(!(e instanceof Error)||!("status"in e)||!("headers"in e))return!1;return(e.status===void 0||typeof e.status==="number")&&(e.headers===void 0||e.headers instanceof Headers)}function d(e){let t=e.headers?.get("x-should-retry");if(t==="true")return!0;if(t==="false")return!1;if(e.status===void 0)return!0;return e.status===408||e.status===409||e.status===429||typeof e.status==="number"&&e.status>=500}function o(e,t,a){let r=t??60000;if(r>0&&e>r)throw Error(`Server requested ${Math.ceil(e/1000)}s retry delay (max: ${Math.ceil(r/1000)}s). ${a}`);return e}function l(e,t,a){let r=e.headers?.get("retry-after-ms");if(r){let s=Number.parseFloat(r);if(!Number.isNaN(s))return o(s,a,e.message)}let n=e.headers?.get("retry-after");if(n){let s=Number.parseFloat(n),f=Number.isNaN(s)?Date.parse(n)-Date.now():s*1000;return o(f,a,e.message)}return Math.min(0.5*2**t,8)*1000*(1-Math.random()*0.25)}function i(){let e=Error("Request aborted");return e.name="AbortError",e}function m(e,t){return new Promise((a,r)=>{if(t?.aborted){r(i());return}let n=()=>{clearTimeout(u),r(i())},u=setTimeout(()=>{t?.removeEventListener("abort",n),a()},Math.max(0,e));t?.addEventListener("abort",n,{once:!0})})}async function
|
|
3
|
-
export{
|
|
2
|
+
function c(e){if(!(e instanceof Error)||!("status"in e)||!("headers"in e))return!1;return(e.status===void 0||typeof e.status==="number")&&(e.headers===void 0||e.headers instanceof Headers)}function d(e){let t=e.headers?.get("x-should-retry");if(t==="true")return!0;if(t==="false")return!1;if(e.status===void 0)return!0;return e.status===408||e.status===409||e.status===429||typeof e.status==="number"&&e.status>=500}function o(e,t,a){let r=t??60000;if(r>0&&e>r)throw Error(`Server requested ${Math.ceil(e/1000)}s retry delay (max: ${Math.ceil(r/1000)}s). ${a}`);return e}function l(e,t,a){let r=e.headers?.get("retry-after-ms");if(r){let s=Number.parseFloat(r);if(!Number.isNaN(s))return o(s,a,e.message)}let n=e.headers?.get("retry-after");if(n){let s=Number.parseFloat(n),f=Number.isNaN(s)?Date.parse(n)-Date.now():s*1000;return o(f,a,e.message)}return Math.min(0.5*2**t,8)*1000*(1-Math.random()*0.25)}function i(){let e=Error("Request aborted");return e.name="AbortError",e}function m(e,t){return new Promise((a,r)=>{if(t?.aborted){r(i());return}let n=()=>{clearTimeout(u),r(i())},u=setTimeout(()=>{t?.removeEventListener("abort",n),a()},Math.max(0,e));t?.addEventListener("abort",n,{once:!0})})}async function Gs(e,t={}){let a=t.maxRetries??0,r=a;for(;;)try{return await e()}catch(n){if(t.signal?.aborted)throw i();if(r<=0||!c(n)||!d(n))throw n;let u=a-r;r--,await m(l(n,u,t.maxRetryDelayMs),t.signal)}}
|
|
3
|
+
export{Gs};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{j}from"./chunk-akafypge.js";var c=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],bu=j("palette",c);var e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],wu=j("shield",e);
|
|
2
|
+
export{bu,wu};
|