@shumai-one/shumai 0.2.2 → 0.3.0
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-e7ndw3hg.js → chunk-0p333kh7.js} +3 -3
- package/bin/chunk-1wz0dge4.js +3 -0
- package/bin/{chunk-gtrc5ka2.js → chunk-1yqar2gz.js} +1 -1
- package/bin/{chunk-fz88kkk1.js → chunk-1zpw2mbj.js} +2 -2
- package/bin/{chunk-46ar48f9.js → chunk-28egv700.js} +1 -1
- package/bin/{chunk-0xbf8bcg.js → chunk-2m2saan7.js} +2 -2
- package/bin/chunk-2p0rg6xs.js +1 -0
- package/bin/{chunk-w88219ex.js → chunk-2xmsa8wv.js} +1 -1
- package/bin/{chunk-mzg1h07d.js → chunk-36wf2dq0.js} +1 -1
- package/bin/{chunk-ta7bfdrn.js → chunk-3g54qkv5.js} +1 -1
- package/bin/chunk-3ge0s4k2.js +1 -0
- package/bin/{chunk-hr97a5j5.js → chunk-449feg7g.js} +1 -1
- package/bin/{chunk-hkbybhww.js → chunk-48ebezek.js} +1 -1
- package/bin/{chunk-8qg47kj6.js → chunk-4gbs9swm.js} +1 -1
- package/bin/{chunk-thsbcbay.js → chunk-4tt3jvm1.js} +1 -1
- package/bin/{chunk-15sefy5t.js → chunk-5jhrqbk2.js} +2 -2
- package/bin/{chunk-wg98cacx.js → chunk-5x1ppya9.js} +2 -2
- package/bin/{chunk-nrwna4ha.js → chunk-652x28v2.js} +1 -1
- package/bin/{chunk-0qkj838r.js → chunk-6f1twjf6.js} +1 -1
- package/bin/chunk-6ks4277t.js +2 -0
- package/bin/{chunk-0rxhc7ka.js → chunk-6wa075zh.js} +2 -2
- package/bin/{chunk-qksb0v3c.js → chunk-736tcjve.js} +2 -2
- package/bin/chunk-80d6p55n.js +1 -0
- package/bin/{chunk-gswbc6y9.js → chunk-8a9k4qj6.js} +2 -2
- package/bin/chunk-8g1s0pq1.js +2 -0
- package/bin/chunk-8gkm2ysh.js +1 -0
- package/bin/chunk-8nvybmyv.js +2 -0
- package/bin/{chunk-srn8t0v7.js → chunk-8rkp0fc5.js} +1 -1
- package/bin/{chunk-1wm57c6y.js → chunk-8sr8ff6a.js} +3 -3
- package/bin/{chunk-2aamsc5v.js → chunk-93jcw0pn.js} +1 -1
- package/bin/{chunk-3rmc8nz6.js → chunk-9bvwwj5y.js} +1 -1
- package/bin/{chunk-925q4paa.js → chunk-9fefn2st.js} +1 -1
- package/bin/{chunk-262hkppb.js → chunk-9h3c60vw.js} +2 -2
- package/bin/{chunk-xyjw8w3r.js → chunk-9jd3d3f3.js} +1 -1
- package/bin/chunk-9nwjhams.js +1 -0
- package/bin/{chunk-7b17fb36.js → chunk-9q32g9jd.js} +1 -1
- package/bin/{chunk-0aj303as.js → chunk-9zy0a8kt.js} +2 -2
- package/bin/{chunk-w7dn1m95.js → chunk-a06432s3.js} +1 -1
- package/bin/{chunk-de99643r.js → chunk-a1mtpcrd.js} +2 -2
- package/bin/{chunk-4e3jbp84.js → chunk-a2njf6av.js} +1 -1
- package/bin/{chunk-5d2q46mx.js → chunk-a6dvjjce.js} +1 -1
- package/bin/{chunk-s46zwr4p.js → chunk-aa2tkqg0.js} +1 -1
- package/bin/{chunk-fbte2rmd.js → chunk-ab45988z.js} +1 -1
- package/bin/chunk-af3nys0r.js +1 -0
- package/bin/{chunk-29tx9qe2.js → chunk-agd2jevj.js} +1 -1
- package/bin/{chunk-9h027f50.js → chunk-bf5a4yc8.js} +1 -1
- package/bin/{chunk-ybhgmvxa.js → chunk-bjfwz2m7.js} +2 -2
- package/bin/{chunk-e52nga6c.js → chunk-bnpw72vt.js} +2 -2
- package/bin/{chunk-c45rh4hk.js → chunk-c003q4v6.js} +1 -1
- package/bin/{chunk-5m9be8an.js → chunk-cfamv4b2.js} +2 -2
- package/bin/{chunk-922nnh39.js → chunk-cm25nm9t.js} +1 -1
- package/bin/{chunk-9h3ds7rn.js → chunk-cmcsxkh1.js} +2 -2
- package/bin/{chunk-zemrvz79.js → chunk-cspp4n1d.js} +2 -2
- package/bin/{chunk-kfhtk3eh.js → chunk-cwebycwv.js} +1 -1
- package/bin/chunk-cx1ebj9k.js +1 -0
- package/bin/chunk-d1p9qz3y.js +7 -0
- package/bin/{chunk-q24epdh8.js → chunk-d3cqp0tb.js} +2 -2
- package/bin/{chunk-97jzve52.js → chunk-d5fapvnp.js} +2 -2
- package/bin/{chunk-e3s3rz2e.js → chunk-ddag2ezv.js} +2 -2
- package/bin/{chunk-7hsgmjpa.js → chunk-dk45f6mp.js} +2 -2
- package/bin/{chunk-9ab6k4rq.js → chunk-e0kw3bst.js} +1 -1
- package/bin/{chunk-bd71dp4j.js → chunk-e56nza63.js} +1 -1
- package/bin/{chunk-re0b7sj7.js → chunk-e66j69wz.js} +1 -1
- package/bin/{chunk-pq18zenh.js → chunk-ea0fh29m.js} +1 -1
- package/bin/{chunk-s1n39qte.js → chunk-en4m76fw.js} +1 -1
- package/bin/{chunk-f14sqw1d.js → chunk-epsctccj.js} +1 -1
- package/bin/{chunk-92xxys10.js → chunk-evzxjqr3.js} +2 -2
- package/bin/{chunk-ymeycphq.js → chunk-f4x2dxe5.js} +3 -3
- package/bin/{chunk-pxw97qbq.js → chunk-fr3dg9aj.js} +1 -1
- package/bin/{chunk-fcvtgx1y.js → chunk-fvf7j1qj.js} +1 -1
- package/bin/{chunk-bs0fjz3w.js → chunk-fwcm78s9.js} +2 -2
- package/bin/{chunk-xcwbg4w9.js → chunk-fytbcgak.js} +2 -2
- package/bin/{chunk-wc8sc9r9.js → chunk-gc7b9j22.js} +1 -1
- package/bin/{chunk-b8js74jk.js → chunk-h1hj60fr.js} +2 -2
- package/bin/{chunk-9avkn3x1.js → chunk-h3y7szbm.js} +2 -2
- package/bin/{chunk-j8qtab70.js → chunk-hdqvbds8.js} +1 -1
- package/bin/{chunk-q09dfja5.js → chunk-he4h8e9e.js} +2 -2
- package/bin/{chunk-d2vxmn9v.js → chunk-hktggc90.js} +1 -1
- package/bin/{chunk-fepymbka.js → chunk-jh6pw37a.js} +1 -1
- package/bin/{chunk-ygz6pawn.js → chunk-jjgwrvdb.js} +1 -1
- package/bin/{chunk-2dsmsa6a.js → chunk-jmh934ca.js} +1 -1
- package/bin/{chunk-dghtwyq1.js → chunk-jtwvd0te.js} +2 -2
- package/bin/{chunk-4qpa7b5t.js → chunk-jxxq76at.js} +1 -1
- package/bin/chunk-jyr3g5m4.js +1 -0
- package/bin/{chunk-zzx99j8t.js → chunk-k0s6gfg6.js} +1 -1
- package/bin/chunk-ky3dx324.js +2 -0
- package/bin/{chunk-h0ytx8zc.js → chunk-mw0rc5m7.js} +1 -1
- package/bin/chunk-mzre12bp.js +1 -0
- package/bin/{chunk-s8t74q9m.js → chunk-n0cn0xfg.js} +1 -1
- package/bin/{chunk-88fg1sw7.js → chunk-nd6psyzq.js} +2 -2
- package/bin/{chunk-m4zpf9gg.js → chunk-nmzvxgd6.js} +2 -2
- package/bin/{chunk-891h8br6.js → chunk-nxhzchen.js} +1 -1
- package/bin/{chunk-8mkfgcvb.js → chunk-phc9efjf.js} +2 -2
- package/bin/{chunk-n4meg9wb.js → chunk-pna93n17.js} +1 -1
- package/bin/{chunk-d3wmdjze.js → chunk-pvx55h1v.js} +1 -1
- package/bin/{chunk-g8th86na.js → chunk-pzehf31g.js} +1 -1
- package/bin/{chunk-nyhqy6q2.js → chunk-q0dhm16d.js} +5 -5
- package/bin/chunk-q11m2cp3.js +2 -0
- package/bin/{chunk-31baz5n0.js → chunk-qjf561n2.js} +1 -1
- package/bin/chunk-qs5k9j8s.js +1 -0
- package/bin/{chunk-ztmj61z9.js → chunk-qt9efp9y.js} +1 -1
- package/bin/{chunk-1xpec5r8.js → chunk-qwxt1cha.js} +2 -2
- package/bin/{chunk-5t6c3038.js → chunk-r8vrfefa.js} +1 -1
- package/bin/{chunk-cxhmr356.js → chunk-rybbss5f.js} +1 -1
- package/bin/{chunk-t3t6021k.js → chunk-sa4gc1f5.js} +2 -2
- package/bin/{chunk-jf3vn5c3.js → chunk-sprpjp4t.js} +2 -2
- package/bin/chunk-swa43tzr.js +3 -0
- package/bin/{chunk-14fh4s1a.js → chunk-szs8dy1s.js} +2 -2
- package/bin/{chunk-ry33f2qk.js → chunk-t0detvbj.js} +2 -2
- package/bin/chunk-t0fq8b99.js +2 -0
- package/bin/{chunk-pmswtfe3.css → chunk-tm6z4hkd.css} +1 -1
- package/bin/{chunk-wsyg4rwg.js → chunk-vdn3jymh.js} +1 -1
- package/bin/{chunk-8wqfkm4c.js → chunk-vjxgv3r6.js} +1 -1
- package/bin/{chunk-dqgv5yy1.js → chunk-w3m9g3e9.js} +1 -1
- package/bin/{chunk-5r8858hx.js → chunk-wcfpdfgy.js} +2 -2
- package/bin/{chunk-rtngbgpk.js → chunk-wv8xk7n7.js} +1 -1
- package/bin/{chunk-7e06b2zb.js → chunk-wwsvnz4v.js} +1 -1
- package/bin/{chunk-qqk51620.js → chunk-y132jbf0.js} +1 -1
- package/bin/{chunk-2aascrtb.js → chunk-yaydmgcg.js} +1 -1
- package/bin/{chunk-7we7ex0m.js → chunk-yvgs4kmv.js} +1 -1
- package/bin/{chunk-fa2g2wge.js → chunk-z5p39kpk.js} +2 -2
- package/bin/{chunk-77r8w95d.js → chunk-zct68gc7.js} +2 -2
- package/bin/{chunk-mqjzmn0e.js → chunk-zy2sqtt9.js} +1 -1
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +260 -208
- package/package.json +7 -7
- package/prisma/migrations/20260728024147_add_agent_session_entry_columns/migration.sql +14 -0
- package/prisma/migrations/20260728024205_migrate_agent_session_entry_data/migration.sql +12 -0
- package/prisma/migrations/20260728031230_remove_agent_session_entry_legacy_entry_column/migration.sql +8 -0
- package/prisma/schema.prisma +12 -6
- package/bin/chunk-23d3968z.js +0 -2
- package/bin/chunk-2g12s6mc.js +0 -2
- package/bin/chunk-4jk0y1w1.js +0 -1
- package/bin/chunk-54tr7y2x.js +0 -3
- package/bin/chunk-6z65xd0w.js +0 -3
- package/bin/chunk-8tf6kgdj.js +0 -2
- package/bin/chunk-av71yjaa.js +0 -1
- package/bin/chunk-byqc8tzq.js +0 -1
- package/bin/chunk-ccw7mjgq.js +0 -5
- package/bin/chunk-f7sbkfmk.js +0 -2
- package/bin/chunk-fd5a3pdd.js +0 -1
- package/bin/chunk-g6zzg6v2.js +0 -1
- package/bin/chunk-kr06nrbx.js +0 -2
- package/bin/chunk-r0w920zb.js +0 -1
- package/bin/chunk-sd86v1e6.js +0 -1
- package/bin/chunk-szzff7gd.js +0 -1
- package/bin/chunk-tspps87j.js +0 -1
- package/bin/chunk-y2qp11v9.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{hk as o,ph as a}from"./chunk-q0dhm16d.js";function l({className:t,...e}){return a("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function n({className:t,...e}){return a("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function c({className:t,...e}){return a("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a("tr",{"data-slot":"table-row",className:o("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",t),...e})}function s({className:t,...e}){return a("th",{"data-slot":"table-head",className:o("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function b({className:t,...e}){return a("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}
|
|
2
2
|
export{l as a,n as b,c,d,s as e,b as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{n as
|
|
1
|
+
import{dk as e,hk as a,ph as t}from"./chunk-q0dhm16d.js";function n({className:i,size:r="default",...s}){return t(e.Root,{"data-slot":"switch","data-size":r,className:a("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",i),...s,children:t(e.Thumb,{"data-slot":"switch-thumb",className:a("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")})})}
|
|
2
|
+
export{n as _a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{I as
|
|
2
|
+
import{$k as G}from"./chunk-6f1twjf6.js";var q=null;function H(k){if(typeof process>"u"||!process.versions?.bun||Object.keys(process.env).length>0)return;if(q===null){q=new Map;try{let{readFileSync:w}=G("fs"),D=w("/proc/self/environ","utf-8");for(let z of D.split("\x00")){let A=z.indexOf("=");if(A>0)q.set(z.slice(0,A),z.slice(A+1))}}catch{}}return q.get(k)}function I(k,w){return w?.[k]||(typeof process<"u"?process.env[k]:void 0)||H(k)||void 0}
|
|
3
|
+
export{I as _b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function q(k){let b=3735928559,d=1103547991;for(let f=0;f<k.length;f++){let l=k.charCodeAt(f);b=Math.imul(b^l,2654435761),d=Math.imul(d^l,1597334677)}return b=Math.imul(b^b>>>16,2246822507)^Math.imul(d^d>>>13,3266489909),d=Math.imul(d^d>>>16,2246822507)^Math.imul(b^b>>>13,3266489909),(d>>>0).toString(36)+(b>>>0).toString(36)}
|
|
3
|
-
export{q as
|
|
3
|
+
export{q as Yb};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{L as
|
|
2
|
+
import{cf as R}from"./chunk-hktggc90.js";function q(B,Q){return{role:"assistant",content:[],api:B.api,provider:B.provider,model:B.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:Q instanceof Error?Q.message:String(Q),timestamp:Date.now()}}function _(B,Q){(async()=>{for await(let Y of Q)B.push(Y);B.end()})()}function O(B,Q){let Y=new R;return Q().then((Z)=>{_(Y,Z)}).catch((Z)=>{let $=q(B,Z);Y.push({type:"error",reason:"error",error:$}),Y.end($)}),Y}function L(B){return{stream:(Q,Y,Z)=>O(Q,async()=>(await B()).stream(Q,Y,Z)),streamSimple:(Q,Y,Z)=>O(Q,async()=>(await B()).streamSimple(Q,Y,Z))}}var A=function(B,Q){if(typeof B==="string"&&/^\.\.?\//.test(B))return B.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(Y,Z,$,F,w){return Z?Q?".jsx":".js":$&&(!F||!w)?Y:$+F+"."+w.toLowerCase()+"js"});return B},j=(B)=>import(A(B));function C(){return globalThis.process?.env}function D(){return{async env(B){let Q=C()?.[B];return typeof Q==="string"&&Q.trim().length>0?Q:void 0},async fileExists(B){try{let Q=await j("node:fs/promises"),Y=B;if(Y.startsWith("~"))Y=(await j("node:os")).homedir()+Y.slice(1);return await Q.access(Y),!0}catch{return!1}}}}class V{credentials=new Map;chains=new Map;enqueue(B,Q){let Y=this.chains.get(B)??Promise.resolve(),Z=(async()=>{return await Y.catch(()=>{}),Q()})();return this.chains.set(B,Z.catch(()=>{})),Z}async read(B){return this.credentials.get(B)}modify(B,Q){return this.enqueue(B,async()=>{let Y=this.credentials.get(B),Z=await Q(Y);if(Z!==void 0)this.credentials.set(B,Z);return Z??Y})}delete(B){return this.enqueue(B,async()=>{this.credentials.delete(B)})}}class W extends Error{code;constructor(B,Q,Y){super(Q,Y);this.name="ModelsError",this.code=B}}async function z(B,Q,Y,Z,$){let F=$?.env?T(Z,$.env):Z;if($?.apiKey!==void 0&&B.auth.apiKey)return X(F,B.auth.apiKey,Q,{type:"api_key",key:$.apiKey,env:$.env});let w=await N(Y,B.id);if(w){if(w.type==="oauth"&&B.auth.oauth)return f(Y,B.id,B.auth.oauth,w);if(w.type==="api_key"&&B.auth.apiKey){let J=$?.env?{...w,env:{...w.env,...$.env}}:w;return X(F,B.auth.apiKey,Q,J)}return}return B.auth.apiKey?X(F,B.auth.apiKey,Q,void 0):void 0}function T(B,Q){return{env:async(Y)=>Q[Y]||await B.env(Y),fileExists:(Y)=>B.fileExists(Y)}}async function f(B,Q,Y,Z){let $=Z;if(Date.now()>=$.expires){let F;try{F=await B.modify(Q,async(w)=>{if(w?.type!=="oauth")return;if(Date.now()<w.expires)return;try{return await Y.refresh(w)}catch(J){throw new W("oauth",`OAuth refresh failed for ${Q}`,{cause:J})}})}catch(w){if(w instanceof W)throw w;throw new W("auth",`Credential store modify failed for ${Q}`,{cause:w})}if(F?.type!=="oauth")return;$=F}try{return{auth:await Y.toAuth($),source:"OAuth"}}catch(F){throw new W("oauth",`OAuth auth derivation failed for ${Q}`,{cause:F})}}async function X(B,Q,Y,Z){try{return await Q.resolve({model:Y,ctx:B,credential:Z})}catch($){throw new W("auth",`API key auth failed for provider ${Y.provider}`,{cause:$})}}async function N(B,Q){try{return await B.read(Q)}catch(Y){throw new W("auth",`Credential store read failed for ${Q}`,{cause:Y})}}class K{providers=new Map;credentials;authContext;constructor(B){this.credentials=B?.credentials??new V,this.authContext=B?.authContext??D()}setProvider(B){this.providers.set(B.id,B)}deleteProvider(B){this.providers.delete(B)}clearProviders(){this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(B){return this.providers.get(B)}getModels(B){if(B!==void 0){let Y=this.providers.get(B);if(!Y)return[];try{return Y.getModels()}catch{return[]}}let Q=[];for(let Y of this.providers.values())try{Q.push(...Y.getModels())}catch{}return Q}getModel(B,Q){return this.getModels(B).find((Y)=>Y.id===Q)}async refresh(B){if(B!==void 0){let Q=this.providers.get(B);if(!Q?.refreshModels)return;try{await Q.refreshModels()}catch(Y){if(Y instanceof W)throw Y;throw new W("model_source",`Model refresh failed for ${B}`,{cause:Y})}return}await Promise.allSettled(Array.from(this.providers.values(),async(Q)=>Q.refreshModels?.()))}async getAuth(B){let Q=this.providers.get(B.provider);if(!Q)return;return z(Q,B,this.credentials,this.authContext)}requireProvider(B){let Q=this.providers.get(B.provider);if(!Q)throw new W("provider",`Unknown provider: ${B.provider}`);return Q}async applyAuth(B,Q){let Y=await z(this.requireProvider(B),B,this.credentials,this.authContext,{apiKey:Q?.apiKey,env:Q?.env}),Z=Y?.auth;if(!Z)return{requestModel:B,requestOptions:Q};let $=Z.baseUrl?{...B,baseUrl:Z.baseUrl}:B,F=Q?.apiKey??Z.apiKey,w=Z.headers||Q?.headers?{...Z.headers,...Q?.headers}:void 0,J=Y.env||Q?.env?{...Y.env??{},...Q?.env??{}}:void 0,P={...Q,apiKey:F,headers:w,env:J};return{requestModel:$,requestOptions:P}}stream(B,Q,Y){return O(B,async()=>{let Z=this.requireProvider(B),{requestModel:$,requestOptions:F}=await this.applyAuth(B,Y);return Z.stream($,Q,F)})}async complete(B,Q,Y){return this.stream(B,Q,Y).result()}streamSimple(B,Q,Y){return O(B,async()=>{let Z=this.requireProvider(B),{requestModel:$,requestOptions:F}=await this.applyAuth(B,Y);return Z.streamSimple($,Q,F)})}async completeSimple(B,Q,Y){return this.streamSimple(B,Q,Y).result()}}function u(B){return new K(B)}function m(B){let Q=B.models,Y,Z=B.refreshModels,$=typeof B.api.stream==="function"?B.api:void 0,F=$?void 0:B.api,w=(P)=>$??F?.[P.api],J=(P,U)=>{let k=w(P);if(!k)return O(P,async()=>{throw new W("stream",`Provider ${B.id} has no API implementation for "${P.api}"`)});return U(k)};return{id:B.id,name:B.name??B.id,baseUrl:B.baseUrl,headers:B.headers,auth:B.auth,getModels:()=>Q,refreshModels:Z?()=>{return Y??=(async()=>{try{Q=await Z()}finally{Y=void 0}})(),Y}:void 0,stream:(P,U,k)=>J(P,(H)=>H.stream(P,U,k)),streamSimple:(P,U,k)=>J(P,(H)=>H.streamSimple(P,U,k))}}function v(B,Q){let Y=Q.input+Q.cacheRead+Q.cacheWrite,Z=B.cost,$=-1;for(let J of B.cost.tiers??[])if(Y>J.inputTokensAbove&&J.inputTokensAbove>$)Z=J,$=J.inputTokensAbove;let F=Q.cacheWrite1h??0,w=Q.cacheWrite-F;return Q.cost.input=Z.input/1e6*Q.input,Q.cost.output=Z.output/1e6*Q.output,Q.cost.cacheRead=Z.cacheRead/1e6*Q.cacheRead,Q.cost.cacheWrite=(Z.cacheWrite*w+Z.input*2*F)/1e6,Q.cost.total=Q.cost.input+Q.cost.output+Q.cost.cacheRead+Q.cost.cacheWrite,Q.cost}var G=["off","minimal","low","medium","high","xhigh","max"];function b(B){if(!B.reasoning)return["off"];return G.filter((Q)=>{let Y=B.thinkingLevelMap?.[Q];if(Y===null)return!1;if(Q==="xhigh"||Q==="max")return Y!==void 0;return!0})}function n(B,Q){let Y=b(B);if(Y.includes(Q))return Q;let Z=G.indexOf(Q);if(Z===-1)return Y[0]??"off";for(let $=Z;$<G.length;$++){let F=G[$];if(Y.includes(F))return F}for(let $=Z-1;$>=0;$--){let F=G[$];if(Y.includes(F))return F}return Y[0]??"off"}
|
|
3
|
+
export{L as Ze,u as _e,m as $e,v as af,n as bf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
class f{queue=[];waiting=[];done=!1;finalResultPromise;resolveFinalResult;isComplete;extractResult;constructor(b,d){this.isComplete=b,this.extractResult=d,this.finalResultPromise=new Promise((h)=>{this.resolveFinalResult=h})}push(b){if(this.done)return;if(this.isComplete(b))this.done=!0,this.resolveFinalResult(this.extractResult(b));let d=this.waiting.shift();if(d)d({value:b,done:!1});else this.queue.push(b)}end(b){if(this.done=!0,b!==void 0)this.resolveFinalResult(b);while(this.waiting.length>0)this.waiting.shift()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){while(!0)if(this.queue.length>0)yield this.queue.shift();else if(this.done)return;else{let b=await new Promise((d)=>this.waiting.push(d));if(b.done)return;yield b.value}}result(){return this.finalResultPromise}}class k extends f{constructor(){super((b)=>b.type==="done"||b.type==="error",(b)=>{if(b.type==="done")return b.message;else if(b.type==="error")return b.error;throw Error("Unexpected event type for final result")})}}
|
|
3
|
-
export{k as
|
|
3
|
+
export{k as cf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{na as j,pa as F}from"./chunk-
|
|
1
|
+
import{na as j,pa as F}from"./chunk-8rkp0fc5.js";import{jg as p}from"./chunk-swa43tzr.js";import{Rh as _,Th as f,nh as s,rh as q,wh as P}from"./chunk-q0dhm16d.js";import{Wk as l}from"./chunk-6f1twjf6.js";var i={x:0.5,y:0.5};class D extends F{apply({activatorEvent:Z,shape:L,transform:E}){if(!L||!(Z instanceof PointerEvent))return E;let M=this.options?.anchor??i,{boundingRectangle:G}=L.initial,Q=G.left+G.width*M.x,J=G.top+G.height*M.y;return{x:E.x+Z.clientX-Q,y:E.y+Z.clientY-J}}static configure=j(D)}var C=l(s(),1);function YO({teamId:Z,projectId:L,assetId:E,folders:M,files:G,selectedIds:Q,onClearSelection:J}){let T=q(),[N,A]=C.useState(void 0),y=(Y,R)=>{let h=["search",Z,E,Y?"folder":"file"],U=T.getQueriesData({queryKey:h}),H=(X)=>{if(typeof X!=="object"||X===null)return!1;let O=X;return"field"in O&&"order"in O&&typeof O.field==="string"&&(O.order==="asc"||O.order==="desc")};for(let[X,O]of U){if(!O||!Array.isArray(O.pages))continue;let z=X.find(H),k=O.pages.flatMap((w)=>w.data??[]),K=k.findIndex((w)=>w.id===R.id);if(K===-1)continue;if(k[K]={...k[K],...R},z?.field==="custom"){let w=z.order==="desc";k.sort((B,x)=>{let $=B.sortIndex??"",b=x.sortIndex??"";if($===b)return 0;if(w)return $<b?1:-1;else return $<b?-1:1})}let V=0,o=O.pages.map((w)=>{let B=w.data?w.data.length:0,x=k.slice(V,V+B);return V+=B,{...w,data:x}});T.setQueryData(X,{...O,pages:o})}},v=f.api.projects[":projectId"].reparent.$post,{mutate:c}=P({mutationFn:async(Y)=>{if(!(await v(Y)).ok)throw Error("Failed to move assets");return null}}),n=f.api.folders[":folderId"].order.$patch,{mutate:u}=P({mutationFn:async(Y)=>{let R=await n(Y);if(!R.ok)throw Error("Failed to reorder folder");return await R.json()}}),m=f.api.files[":fileId"].order.$patch,{mutate:S}=P({mutationFn:async(Y)=>{let R=await m(Y);if(!R.ok)throw Error("Failed to reorder file");return await R.json()}}),I=f.api.shares[":shareId"].assets.$post,{mutate:g}=P({mutationFn:async(Y)=>{let R=await I(Y);if(!R.ok)throw Error("Failed to add asset to share");return await R.json()}});return{dragState:N,handleDragStart:(Y)=>{let R=Y.operation.source;if(!R)return;let W=R.id.split(":").pop(),h=R.data;if(!h)return;let U,H;if(Q.has(W))U=new Set(Q),H=[...M,...G].filter((O)=>Q.has(O.id));else U=new Set([W]),H=[h.item];let X=H.some((O)=>O.type==="folder");A({isActive:!0,draggedIds:U,hasFolders:X,itemCount:U.size})},handleDragEnd:(Y)=>{let{target:R}=Y.operation;if(R&&N){let W=R.id.split(":").pop(),h=R.data;if(h?.type==="chatbot-sidebar"){let X=[...M,...G].filter((O)=>N.draggedIds.has(O.id)).map((O)=>({id:O.id,name:O.name||"Unnamed",type:O.type}));p.getState().addAssets(X),J(),A(void 0);return}if(h?.type==="share-link"){let H=W,X=Array.from(N.draggedIds);g({param:{shareId:H},json:{assetIds:X}},{onSuccess:(O)=>{if(O.addedCount===0)_.info("Assets already exists in share");else _.success(`Added ${O.addedCount} item(s) to share link`);T.invalidateQueries({queryKey:["shares",L]}),J()},onError:(O)=>{_.error(`Failed to add to share: ${O.message}`)}}),A(void 0);return}let U=!1;if(h&&!N.draggedIds.has(W)){if(h.type==="folder"||h.type==="reorder")U=!0;else if(h.type==="file"){if(!N.hasFolders&&N.itemCount===1)U=!0}}if(h?.type==="reorder"){let{position:H,item:X}=h,O=N.hasFolders,z=Array.from(N.draggedIds)[0];if(O)u({param:{folderId:z},json:H==="before"?{beforeIndex:X.sortIndex??void 0}:{afterIndex:X.sortIndex??void 0}},{onSuccess:(k)=>{_.success("Folder reordered"),y(!0,k),J()},onError:(k)=>{_.error(`Failed to reorder: ${k.message}`)}});else S({param:{fileId:z},json:H==="before"?{beforeIndex:X.sortIndex??void 0}:{afterIndex:X.sortIndex??void 0}},{onSuccess:(k)=>{_.success("File reordered"),y(!1,k),J()},onError:(k)=>{_.error(`Failed to reorder: ${k.message}`)}})}else if(U)c({param:{projectId:L},json:{assetIds:Array.from(N.draggedIds),newParentId:W}},{onSuccess:()=>{_.success("Assets moved successfully"),T.invalidateQueries({queryKey:["search",Z,E]}),T.invalidateQueries({queryKey:["folders"]}),J()},onError:()=>{_.error("Failed to move assets")}})}A(void 0)}}}
|
|
2
2
|
export{D as l,YO as m};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{tk as S,uk as T,vk as C}from"./chunk-dk45f6mp.js";import"./chunk-9bvwwj5y.js";import{xk as D}from"./chunk-r8vrfefa.js";import{zk as Z}from"./chunk-e0kw3bst.js";import"./chunk-bjfwz2m7.js";import"./chunk-fwcm78s9.js";import{Dk as k}from"./chunk-jxxq76at.js";import{Pk as f}from"./chunk-e66j69wz.js";import{Tk as M,Uk as V}from"./chunk-cm25nm9t.js";import"./chunk-3g54qkv5.js";import"./chunk-6f1twjf6.js";var j="v1",E=new Set(["openai","openai-codex","opencode","azure-openai-responses"]);function K(G){let Q=new Map;if(!G)return Q;for(let w of G.split(",")){let W=w.trim();if(!W)continue;let[X,J]=W.split("=",2);if(!X||!J)continue;Q.set(X.trim(),J.trim())}return Q}function g(G,Q){if(Q?.azureDeploymentName)return Q.azureDeploymentName;return K(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(G.id)||G.id}function B(G){if(G instanceof Error){let Q=G.status,w=typeof Q==="number"?Q:void 0;if(w!==void 0)return`Azure OpenAI API error (${w}): ${G.message}`;return G.message}try{return JSON.stringify(G)}catch{return String(G)}}var I=(G,Q,w)=>{let W=new V;return(async()=>{let X=g(G,w),J={role:"assistant",content:[],api:"azure-openai-responses",provider:G.provider,model:G.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let Y=w?.apiKey;if(!Y)throw Error(`No API key for provider: ${G.provider}`);let $=z(G,Y,w),q=b(G,Q,w,X),F=await w?.onPayload?.(q,G);if(F!==void 0)q=F;let L={...w?.signal?{signal:w.signal}:{},...w?.timeoutMs!==void 0?{timeout:w.timeoutMs}:{},maxRetries:w?.maxRetries??0},{data:_,response:H}=await $.responses.create(q,L).withResponse();if(await w?.onResponse?.({status:H.status,headers:k(H.headers)},G),W.push({type:"start",partial:J}),await C(_,J,W,G),w?.signal?.aborted)throw Error("Request was aborted");if(J.stopReason==="aborted"||J.stopReason==="error")throw Error("An unknown error occurred");W.push({type:"done",reason:J.stopReason,message:J}),W.end()}catch(Y){for(let $ of J.content)delete $.index,delete $.partialJson;J.stopReason=w?.signal?.aborted?"aborted":"error",J.errorMessage=B(Y),W.push({type:"error",reason:J.stopReason,error:J}),W.end()}})(),W},c=(G,Q,w)=>{let W=w?.apiKey;if(!W)throw Error(`No API key for provider: ${G.provider}`);let X=f(G,w,W),J=w?.reasoning?M(G,w.reasoning):void 0;return I(G,Q,{...X,reasoningEffort:J==="off"?void 0:J})};function P(G){let Q=G.trim().replace(/\/+$/,""),w;try{w=new URL(Q)}catch{throw Error(`Invalid Azure OpenAI base URL: ${G}`)}let W=w.hostname.endsWith(".openai.azure.com")||w.hostname.endsWith(".cognitiveservices.azure.com"),X=w.pathname.replace(/\/+$/,"");if(W&&(X===""||X==="/"||X==="/openai"))w.pathname="/openai/v1",w.search="";return w.toString().replace(/\/+$/,"")}function O(G){return`https://${G}.openai.azure.com/openai/v1`}function h(G,Q){let w=Q?.azureApiVersion||process.env.AZURE_OPENAI_API_VERSION||j,W=Q?.azureBaseUrl?.trim()||process.env.AZURE_OPENAI_BASE_URL?.trim()||void 0,X=Q?.azureResourceName||process.env.AZURE_OPENAI_RESOURCE_NAME,J=W;if(!J&&X)J=O(X);if(!J&&G.baseUrl)J=G.baseUrl;if(!J)throw Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:P(J),apiVersion:w}}function z(G,Q,w){let W={...G.headers};if(w?.headers)Object.assign(W,w.headers);let{baseUrl:X,apiVersion:J}=h(G,w);return new Z({apiKey:Q,apiVersion:J,dangerouslyAllowBrowser:!0,defaultHeaders:W,baseURL:X})}function b(G,Q,w,W){let X=S(G,Q,E),J={model:W,input:X,stream:!0,prompt_cache_key:D(w?.sessionId)};if(w?.maxTokens)J.max_output_tokens=w?.maxTokens;if(w?.temperature!==void 0)J.temperature=w?.temperature;if(Q.tools&&Q.tools.length>0)J.tools=T(Q.tools);if(G.reasoning){if(w?.reasoningEffort||w?.reasoningSummary){let Y=w?.reasoningEffort?G.thinkingLevelMap?.[w.reasoningEffort]??w.reasoningEffort:"medium";J.reasoning={effort:Y,summary:w?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(G.thinkingLevelMap?.off!==null)J.reasoning={effort:G.thinkingLevelMap?.off??"none"}}return J}export{c as streamSimpleAzureOpenAIResponses,I as streamAzureOpenAIResponses};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function _(q){return q.totalTokens||q.input+q.output+q.cacheRead+q.cacheWrite}function N(q){try{return JSON.stringify(q)??"undefined"}catch{return"[unserializable]"}}function z(q){if(typeof q==="string")return q.length;let G=0;for(let D of q)G+=D.type==="text"?D.text.length:4800;return G}function P(q){return Math.ceil(q.length/4)}function E(q){return Math.ceil(z(q)/4)}function K(q){let G=0;if(q.role==="user")return E(q.content);if(q.role==="toolResult")return E(q.content);for(let D of q.content)if(D.type==="text")G+=D.text.length;else if(D.type==="thinking")G+=D.thinking.length;else G+=D.name.length+N(D.arguments).length;return Math.ceil(G/4)}function h(q){let G=Number.NEGATIVE_INFINITY,D;for(let H=0;H<q.length;H++){let Z=q[H];if(Z.role==="assistant"){let V=Z;if(V.timestamp>=G&&V.stopReason!=="aborted"&&V.stopReason!=="error"&&_(V.usage)>0)D={usage:V.usage,index:H}}G=Math.max(G,Z.timestamp)}return D}function W(q){let G=h(q);if(G){let H=_(G.usage),Z=0;for(let V=G.index+1;V<q.length;V++)Z+=K(q[V]);return{tokens:H+Z,usageTokens:H,trailingTokens:Z,lastUsageIndex:G.index}}let D=0;for(let H of q)D+=K(H);return{tokens:D,usageTokens:0,trailingTokens:D,lastUsageIndex:null}}function B(q){if(!q||q.length===0)return 0;return P(N(q))}function f(q){return Array.isArray(q)}function R(q){if(f(q))return W(q);let G=W(q.messages);if(G.lastUsageIndex!==null){let H=new Set(q.messages.slice(G.lastUsageIndex+1).filter((V)=>V.role==="toolResult").flatMap((V)=>V.addedToolNames??[])),Z=B(q.tools?.filter((V)=>H.has(V.name)));return{tokens:G.tokens+Z,usageTokens:G.usageTokens,trailingTokens:G.trailingTokens+Z,lastUsageIndex:G.lastUsageIndex}}let D=(q.systemPrompt?P(q.systemPrompt):0)+B(q.tools);return{tokens:G.tokens+D,usageTokens:G.usageTokens,trailingTokens:G.trailingTokens+D,lastUsageIndex:G.lastUsageIndex}}var I=4096,v=1;function C(q,G,D){if(q.contextWindow<=0)return Math.max(v,D);let H=q.contextWindow-R(G).tokens-I;return Math.min(D,Math.max(v,H))}function T(q,G,D,H){return{temperature:D?.temperature,maxTokens:C(q,G,D?.maxTokens??q.maxTokens),signal:D?.signal,apiKey:H||D?.apiKey,transport:D?.transport,cacheRetention:D?.cacheRetention,sessionId:D?.sessionId,headers:D?.headers,onPayload:D?.onPayload,onResponse:D?.onResponse,timeoutMs:D?.timeoutMs,websocketConnectTimeoutMs:D?.websocketConnectTimeoutMs,maxRetries:D?.maxRetries,maxRetryDelayMs:D?.maxRetryDelayMs,metadata:D?.metadata,env:D?.env}}function M(q){return q==="xhigh"||q==="max"?"high":q}function p(q,G,D,H){let V={...{minimal:1024,low:2048,medium:8192,high:16384},...H},L=1024,Y=M(D),F=V[Y],j=q===void 0?G:Math.min(q+F,G);if(j<=F)F=Math.max(0,j-1024);return{maxTokens:j,thinkingBudget:F}}function S(q,G){let D=[],H=!1;for(let Z of q){if(Z.type==="image"){if(!H)D.push({type:"text",text:G});H=!0;continue}D.push(Z),H=Z.text===G}return D}function b(q,G){if(G.input.includes("image"))return q;return q.map((D)=>{if(D.role==="user"&&Array.isArray(D.content))return{...D,content:S(D.content,"(image omitted: model does not support images)")};if(D.role==="toolResult")return{...D,content:S(D.content,"(tool image omitted: model does not support images)")};return D})}function k(q,G,D){let H=new Map,Z=q.map((J)=>J.content==null?{...J,content:[]}:J),L=b(Z,G).map((J)=>{if(J.role==="user")return J;if(J.role==="toolResult"){let Q=H.get(J.toolCallId);if(Q&&Q!==J.toolCallId)return{...J,toolCallId:Q};return J}if(J.role==="assistant"){let Q=J,w=Q.provider===G.provider&&Q.api===G.api&&Q.model===G.id,O=Q.content.flatMap(($)=>{if($.type==="thinking"){if($.redacted)return w?$:[];if(w&&$.thinkingSignature)return $;if(!$.thinking||$.thinking.trim()==="")return[];if(w)return $;return{type:"text",text:$.thinking}}if($.type==="text"){if(w)return $;return{type:"text",text:$.text}}if($.type==="toolCall"){let U=$,X=U;if(!w&&U.thoughtSignature)X={...U},delete X.thoughtSignature;if(!w&&D){let A=D(U.id,G,Q);if(A!==U.id)H.set(U.id,A),X={...X,id:A}}return X}return $});return{...Q,content:O}}return J}),Y=[],F=[],j=new Set,y=()=>{if(F.length>0){for(let J of F)if(!j.has(J.id))Y.push({role:"toolResult",toolCallId:J.id,toolName:J.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});F=[],j=new Set}};for(let J=0;J<L.length;J++){let Q=L[J];if(Q.role==="assistant"){y();let w=Q;if(w.stopReason==="error"||w.stopReason==="aborted")continue;let O=w.content.filter(($)=>$.type==="toolCall");if(O.length>0)F=O,j=new Set;Y.push(Q)}else if(Q.role==="toolResult")j.add(Q.toolCallId),Y.push(Q);else if(Q.role==="user")y(),Y.push(Q);else Y.push(Q)}return y(),Y}
|
|
3
|
-
export{C as
|
|
3
|
+
export{C as hc,T as ic,p as jc,k as kc};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{n as
|
|
1
|
+
import{Yj as o,hk as t,ph as e}from"./chunk-q0dhm16d.js";function n({className:a,...r}){return e(o.Root,{"data-slot":"label",className:t("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...r})}
|
|
2
|
+
export{n as Pg};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as U}from"./chunk-8g1s0pq1.js";import"./chunk-6ks4277t.js";import"./chunk-jh6pw37a.js";import"./chunk-9jd3d3f3.js";import"./chunk-d1p9qz3y.js";import"./chunk-ea0fh29m.js";import"./chunk-vdn3jymh.js";import"./chunk-wwsvnz4v.js";import"./chunk-8rkp0fc5.js";import"./chunk-cwebycwv.js";import"./chunk-ky3dx324.js";import"./chunk-q11m2cp3.js";import"./chunk-h1hj60fr.js";import"./chunk-2m2saan7.js";import{df as N}from"./chunk-sprpjp4t.js";import"./chunk-nd6psyzq.js";import{Af as K}from"./chunk-t0detvbj.js";import"./chunk-zct68gc7.js";import"./chunk-sa4gc1f5.js";import"./chunk-swa43tzr.js";import"./chunk-qwxt1cha.js";import"./chunk-6wa075zh.js";import"./chunk-z5p39kpk.js";import"./chunk-1zpw2mbj.js";import"./chunk-jtwvd0te.js";import{ch as J}from"./chunk-8a9k4qj6.js";import{Hh as G,Th as H,nh as Z,ph as q,uh as B,vh as D}from"./chunk-q0dhm16d.js";import{Wk as Y}from"./chunk-6f1twjf6.js";var V=Y(Z(),1);function _(){let{projectId:h,folderId:W}=z.useParams(),{teamId:v,ensureTeamIdForProject:w}=J();V.useEffect(()=>{w(h)},[h,w]);let{data:A}=D(N(h)),b=A?.rootFolder,{data:X}=B({queryKey:["folders",b],queryFn:()=>(async()=>{return await(await H.api.folders[":folderId"].$get({param:{folderId:b}})).json()})(),enabled:!!b});if(!v||!b||!X)return q(K,{});return q(U,{teamId:v,projectId:h,projectName:A.name??"",assetId:W,rootFolderId:b})}var z=G("/projects/$projectId/folders/$folderId")({component:_});export{z as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{_b as V}from"./chunk-h3y7szbm.js";import{$b as v,ac as U,bc as x,cc as b,dc as f,ec as h}from"./chunk-736tcjve.js";import{fc as I,gc as B}from"./chunk-2xmsa8wv.js";import{ic as T}from"./chunk-jmh934ca.js";import{lc as C}from"./chunk-bf5a4yc8.js";import{nc as P}from"./chunk-fr3dg9aj.js";import{af as E,bf as M}from"./chunk-he4h8e9e.js";import{cf as y}from"./chunk-hktggc90.js";import{Lk as F,Nk as K,Ok as j}from"./chunk-8sr8ff6a.js";import"./chunk-6f1twjf6.js";var k="v1",u="gcp-vertex-credentials",a={THINKING_LEVEL_UNSPECIFIED:F.THINKING_LEVEL_UNSPECIFIED,MINIMAL:F.MINIMAL,LOW:F.LOW,MEDIUM:F.MEDIUM,HIGH:F.HIGH},c=0,R=(q,w,J)=>{let Y=new y;return(async()=>{let Q={role:"assistant",content:[],api:"google-vertex",provider:q.provider,model:q.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let $=n(J),D=$?l(q,$,J?.headers):p(q,t(J),o(J),J?.headers,J?.env),N=qq(q,w,J),L=await J?.onPayload?.(N,q);if(L!==void 0)N=L;let d=await D.models.generateContentStream(N);Y.push({type:"start",partial:Q});let Z=null,O=Q.content,X=()=>O.length-1;for await(let z of d){Q.responseId||=z.responseId;let H=z.candidates?.[0];if(H?.content?.parts)for(let W of H.content.parts){if(W.text!==void 0){let _=v(W);if(!Z||_&&Z.type!=="thinking"||!_&&Z.type!=="text"){if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:O.length-1,content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(_)Z={type:"thinking",thinking:"",thinkingSignature:void 0},Q.content.push(Z),Y.push({type:"thinking_start",contentIndex:X(),partial:Q});else Z={type:"text",text:""},Q.content.push(Z),Y.push({type:"text_start",contentIndex:X(),partial:Q})}if(Z.type==="thinking")Z.thinking+=W.text,Z.thinkingSignature=U(Z.thinkingSignature,W.thoughtSignature),Y.push({type:"thinking_delta",contentIndex:X(),delta:W.text,partial:Q});else Z.text+=W.text,Z.textSignature=U(Z.textSignature,W.thoughtSignature),Y.push({type:"text_delta",contentIndex:X(),delta:W.text,partial:Q})}if(W.functionCall){if(Z){if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});Z=null}let _=W.functionCall.id,S={type:"toolCall",id:!_||Q.content.some((A)=>A.type==="toolCall"&&A.id===_)?`${W.functionCall.name}_${Date.now()}_${++c}`:_,name:W.functionCall.name||"",arguments:W.functionCall.args??{},...W.thoughtSignature&&{thoughtSignature:W.thoughtSignature}};Q.content.push(S),Y.push({type:"toolcall_start",contentIndex:X(),partial:Q}),Y.push({type:"toolcall_delta",contentIndex:X(),delta:JSON.stringify(S.arguments),partial:Q}),Y.push({type:"toolcall_end",contentIndex:X(),toolCall:S,partial:Q})}}if(H?.finishReason){if(Q.stopReason=h(H.finishReason),Q.content.some((W)=>W.type==="toolCall"))Q.stopReason="toolUse"}if(z.usageMetadata)Q.usage={input:(z.usageMetadata.promptTokenCount||0)-(z.usageMetadata.cachedContentTokenCount||0),output:(z.usageMetadata.candidatesTokenCount||0)+(z.usageMetadata.thoughtsTokenCount||0),cacheRead:z.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:z.usageMetadata.thoughtsTokenCount||0,totalTokens:z.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},E(q,Q.usage)}if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(J?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");Y.push({type:"done",reason:Q.stopReason,message:Q}),Y.end()}catch($){for(let D of Q.content)if("index"in D)delete D.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=B(I($)),Y.push({type:"error",reason:Q.stopReason,error:Q}),Y.end()}})(),Y},Hq=(q,w,J)=>{let Y=T(q,w,J,void 0);if(!J?.reasoning)return R(q,w,{...Y,thinking:{enabled:!1}});let Q=M(q,J.reasoning),$=Q==="off"?"high":Q,D=q;if(G(D)||m(D))return R(q,w,{...Y,thinking:{enabled:!0,level:Jq($,D)}});return R(q,w,{...Y,thinking:{enabled:!0,budgetTokens:Qq(D,$,J.thinkingBudgets)}})};function p(q,w,J,Y,Q){let $=i(Q);return new j({vertexai:!0,project:w,location:J,apiVersion:k,...$?{googleAuthOptions:$}:{},httpOptions:g(q,Y)})}function l(q,w,J){return new j({vertexai:!0,apiKey:w,apiVersion:k,httpOptions:g(q,J)})}function g(q,w){let J={},Y=r(q.baseUrl);if(Y){if(J.baseUrl=Y,J.baseUrlResourceScope=K.COLLECTION,s(Y))J.apiVersion=""}let Q=P({...q.headers,...w});if(Q)J.headers=Q;return Object.keys(J).length>0?J:void 0}function r(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function s(q){try{return new URL(q).pathname.split("/").some((J)=>/^v\d+(?:beta\d*)?$/.test(J))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(q)}}function i(q){let w=V("GOOGLE_APPLICATION_CREDENTIALS",q);return w?{keyFilename:w}:void 0}function n(q){let w=q?.apiKey?.trim();if(!w||w===u||e(w))return;return w}function e(q){return/^<[^>]+>$/.test(q)}function t(q){let w=q?.project||V("GOOGLE_CLOUD_PROJECT",q?.env)||V("GCLOUD_PROJECT",q?.env);if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function o(q){let w=q?.location||V("GOOGLE_CLOUD_LOCATION",q?.env);if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function qq(q,w,J={}){let Y=x(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let $={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:C(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:b(w.tools)}};if(w.tools&&w.tools.length>0&&J.toolChoice)$.toolConfig={functionCallingConfig:{mode:f(J.toolChoice)}};else $.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let N={includeThoughts:!0};if(J.thinking.level!==void 0)N.thinkingLevel=a[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)N.thinkingBudget=J.thinking.budgetTokens;$.thinkingConfig=N}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)$.thinkingConfig=wq(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");$.abortSignal=J.signal}return{model:q.id,contents:Y,config:$}}function G(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function m(q){let w=q.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(w)||w==="gemini-flash-latest"||w==="gemini-flash-lite-latest"}function wq(q){let w=q;if(G(w))return{thinkingLevel:F.LOW};if(m(w))return{thinkingLevel:F.MINIMAL};return{thinkingBudget:0}}function Jq(q,w){if(G(w))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(q){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function Qq(q,w,J){if(J?.[w]!==void 0)return J[w];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[w];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[w];return-1}export{Hq as streamSimple,R as stream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Za as Kq}from"./chunk-q11m2cp3.js";import{$a as s,ab as o,bb as r,cb as m,db as e,eb as qq,fb as Eq,gb as Jq}from"./chunk-2m2saan7.js";import{Rg as Q,Sg as H,Ug as z,Vg as F,Xg as y,Yg as X,eh as d,fh as b,gh as a,hh as t,jh as n}from"./chunk-8a9k4qj6.js";import{Dj as i,Hi as l,Rh as P,bi as $,ik as c,jk as T,kk as w,nh as yq,nk as J,oh as x,ph as E,qh as K,xi as f}from"./chunk-q0dhm16d.js";import{Wk as Fq}from"./chunk-6f1twjf6.js";var V=Fq(yq(),1);function Tq({open:Nq,onOpenChange:Pq,title:Qq,members:A,isOwner:B,onInvite:S,onUpdateRole:D,onRemoveMember:R,currentUserId:Vq,availableMembersToAdd:k,onAddMember:I,type:Wq="team"}){let[G,g]=V.useState("editor"),[Z,M]=V.useState(null),[v,u]=V.useState(!1),[L,_]=V.useState(null),[Y,h]=V.useState(null),[Xq,p]=V.useState({}),[U,O]=V.useState(null),C=(q)=>{if(!q)return"";switch(q.toLowerCase()){case"owner":return J.owner();case"editor":return J.editor();case"reviewer":return J.reviewer();default:return q}},Yq=(q,N)=>{p((W)=>({...W,[q]:N}))},Zq=async(q,N)=>{if(!D)return;_(q);try{await D(q,N),P.success(J.member_role_updated())}catch(W){console.error(W),P.error(J.failed_to_update_member_role())}finally{_(null)}},_q=async()=>{if(!R||!Y?.id)return;_(Y.id);try{await R(Y.id),P.success(J.member_removed()),h(null)}catch(q){console.error(q),P.error(J.failed_to_remove_member())}finally{_(null)}},$q=async()=>{if(!S)return;u(!0);try{let q=await S(G),N=`${window.location.origin}/signup?inviteCode=${q}`;M(N)}catch(q){console.error(q),P.error(J.failed_to_generate_invite_link())}finally{u(!1)}},fq=async()=>{if(Z){if(await Kq(Z))P.success(J.invite_link_copied())}},j=(q)=>{if(!q)return"??";return q.split(" ").map((N)=>N[0]).slice(0,2).join("").toUpperCase()},Hq=(q)=>{if(!q)M(null),g("editor"),p({}),O(null);Pq(q)},zq=Array.isArray(A)?A:[];return E(b,{open:Nq,onOpenChange:Hq,children:K(a,{className:"sm:max-w-md",onOpenAutoFocus:(q)=>q.preventDefault(),children:[E(t,{children:E(n,{children:Qq})}),K("div",{className:"space-y-4",children:[E("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:zq.map((q)=>K("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[K("div",{className:"flex items-center gap-3",children:[K(c,{children:[q.image&&E(T,{src:q.image,alt:q.name,className:"object-cover"}),E(w,{children:j(q.name)})]}),K("div",{className:"flex flex-col",children:[E("span",{className:"text-sm font-medium",children:q.name}),K("div",{className:"flex items-center gap-2",children:[E("span",{className:"text-xs text-muted-foreground capitalize",children:C(q.role)}),q.scope&&K(x,{children:[E("span",{className:"text-[10px] text-muted-foreground/70",children:"•"}),E("span",{className:"text-xs text-muted-foreground capitalize",children:q.scope==="team"?J.team_member():J.project_member()})]})]})]})]}),B&&q.role!=="owner"&&q.id!==Vq&&K("div",{className:"flex items-center gap-2",children:[K(H,{children:[E(z,{asChild:!0,children:K(Q,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:L===q.id,children:[C(q.role),E(f,{className:"ml-1 h-3 w-3 opacity-50"})]})}),E(F,{children:K(y,{value:q.role,onValueChange:(N)=>Zq(q.id,N),children:[E(X,{value:"editor",className:"text-xs",children:J.editor()}),E(X,{value:"reviewer",className:"text-xs",children:J.reviewer()})]})})]}),E(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>h(q),disabled:L===q.id,children:L===q.id?E($,{className:"h-3 w-3 animate-spin"}):E(i,{className:"h-3 w-3"})})]})]},q.id))}),E(s,{open:!!Y,onOpenChange:(q)=>!q&&h(null),children:K(o,{children:[K(r,{children:[E(e,{children:J.remove_member()}),E(qq,{children:J.remove_member_confirmation({name:Y?.name||"",type:Wq==="project"?J.project():J.team()})})]}),K(m,{children:[E(Jq,{children:J.cancel()}),E(Eq,{onClick:_q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:J.remove()})]})]})})," ",B&&I&&k&&k.length>0&&K("div",{className:"border-t pt-4",children:[E("h4",{className:"text-sm font-medium mb-3",children:J.add_team_member_to_project()}),E("div",{className:"max-h-[200px] overflow-y-auto space-y-2 pr-1",children:k.map((q)=>{let N=Xq[q.id]||"editor";return K("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[K("div",{className:"flex items-center gap-3",children:[K(c,{children:[q.image&&E(T,{src:q.image,alt:q.name,className:"object-cover"}),E(w,{children:j(q.name)})]}),K("div",{className:"flex flex-col",children:[E("span",{className:"text-sm font-medium",children:q.name}),E("span",{className:"text-xs text-muted-foreground capitalize",children:q.scope==="team"?J.team_member():J.project_member()})]})]}),K("div",{className:"flex items-center gap-2",children:[K(H,{children:[E(z,{asChild:!0,children:K(Q,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:U===q.id,children:[C(N),E(f,{className:"ml-1 h-3 w-3 opacity-50"})]})}),E(F,{children:K(y,{value:N,onValueChange:(W)=>Yq(q.id,W),children:[E(X,{value:"editor",className:"text-xs",children:J.editor()}),E(X,{value:"reviewer",className:"text-xs",children:J.reviewer()})]})})]}),E(Q,{onClick:async()=>{O(q.id);try{await I(q.id,N),P.success(J.added_member_successfully({name:q.name||""}))}catch(W){console.error(W),P.error(J.failed_to_add_member({name:q.name||""}))}finally{O(null)}},disabled:U!==null,size:"sm",className:"h-8 text-xs px-3 w-[60px]",children:U===q.id?E($,{className:"h-3 w-3 animate-spin"}):J.add()})]})]},q.id)})})]}),B&&S&&K("div",{className:"border-t pt-4",children:[E("h4",{className:"text-sm font-medium mb-3",children:J.invite_new_member()}),K("div",{className:"space-y-3",children:[K("div",{className:"flex gap-2",children:[K(H,{children:[E(z,{asChild:!0,children:K(Q,{variant:"outline",className:"w-[120px] justify-between",children:[G==="editor"?J.editor():J.reviewer(),E(f,{className:"h-4 w-4 opacity-50"})]})}),E(F,{children:K(y,{value:G,onValueChange:(q)=>g(q),children:[E(X,{value:"editor",children:J.editor()}),E(X,{value:"reviewer",children:J.reviewer()})]})})]}),K(Q,{onClick:$q,disabled:v,className:"flex-1",children:[v&&E($,{className:"mr-2 h-4 w-4 animate-spin"}),J.generate_link()]})]}),Z&&K("div",{className:"flex gap-2",children:[E(d,{value:Z,readOnly:!0}),E(Q,{variant:"outline",size:"icon",onClick:fq,children:E(l,{className:"h-4 w-4"})})]})]})]})]})]})})}
|
|
2
|
+
export{Tq as Ya};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as s,q as t,r as b}from"./chunk-
|
|
1
|
+
import{o as s,q as t,r as b}from"./chunk-9jd3d3f3.js";import{Sg as YG,Ug as _G,Vg as $G,Wg as QG}from"./chunk-8a9k4qj6.js";import{Ni as JG,Nj as WG,Th as c,bi as A,ej as i,hk as C,ij as a,nh as SG,nk as r,oh as d,ph as H,qh as O,uh as KG,wi as GG,xi as HG}from"./chunk-q0dhm16d.js";import{Wk as AG}from"./chunk-6f1twjf6.js";function vG({file:Y,mediaControllerRef:X,onPlay:K,onPause:N,onTimeUpdate:V,annotations:_,startTime:M,shareId:Z,children:U}){let L=b(Y).viewer;return H(L,{ref:X,file:Y,onPlay:K,onPause:N,onTimeUpdate:V,annotations:_,startTime:M,shareId:Z,children:U},Y.id)}var J=AG(SG(),1);function e({activeState:Y,activeAsset:X,previewUrl:K,isFullScreen:N,onTogglePlay:V,onToggleLoop:_,onSeek:M,onVolumeChange:Z,onToggleMute:U,onChangePlaybackRate:B,onChangeResolution:L,onZoomIn:w,onZoomOut:T,onFit:z,onDownload:F,onToggleFullScreen:E}){if(Y?.kind==="video"&&Y.video&&X){let $=Y.video,y=$.totalFrames/$.frameRate,p=$.currentFrame/$.frameRate,S={isPlaying:$.isPlaying,progress:y>0?p/y*100:0,currentTime:p,duration:y,volume:$.volume,isMuted:$.isMuted,isLooping:$.isLooping,playbackRate:$.playbackRate,isFullScreen:N,showFrames:!1,currentResolution:$.currentResolution},g=K&&!X.media?.videoPreview?{...X,media:{...X.media,videoPreview:{url:K}}}:X;return H(s,{state:S,zoom:Y.zoom,isControlsVisible:!0,floatOverlayInFullScreen:!1,buffered:$.buffered,data:g,resolutions:$.resolutions,togglePlay:V,toggleLoop:_,toggleMute:U,handleVolumeChange:Z,changePlaybackRate:B,changeResolution:(k)=>L(k.resolution),handleDownload:(k)=>F(k),toggleFullScreen:E,onZoomChange:(k)=>k>=Y.zoom?w():T(),onZoomReset:z,frameRate:$.frameRate,totalFrames:$.totalFrames,currentFrame:$.currentFrame,seekToFrame:M})}if(Y?.kind==="image")return H(t,{zoom:Y.zoom,onZoomIn:w,onZoomOut:T,onFit:z,onDownload:()=>F(),canDownload:!!X?.media?.original?.key,fullscreen:{isFullScreen:N,onToggle:E}});return H("div",{className:"relative z-10 flex items-center justify-end gap-2 border-t border-border bg-card px-4 py-3",children:H("button",{onClick:E,className:"text-foreground transition-colors hover:text-primary",title:"Fullscreen",children:N?H(a,{className:"h-5 w-5"}):H(i,{className:"h-5 w-5"})})})}function v({side:Y,fileName:X,version:K,activeVersionId:N,versions:V,isActive:_,onActivate:M,onSwitchVersion:Z,onExit:U}){let B=C("flex-shrink-0 rounded p-1 transition-colors hover:bg-muted",_?"text-foreground":"text-muted-foreground hover:text-foreground"),L=H("button",{onClick:U,title:r.exit_compare(),className:B,children:H(WG,{className:"h-4 w-4"})}),w=O("button",{onClick:M,className:C("flex min-w-0 items-center gap-1 rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-muted",_?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[H("span",{className:"truncate",children:X}),K!==void 0&&O("span",{className:C("flex-shrink-0 rounded border px-1 py-0 text-xs",_?"border-foreground/40":"border-border"),children:["v",K]})]}),T=O(YG,{children:[H(_G,{onClick:M,title:r.switch_version(),className:B,children:H(HG,{className:"h-4 w-4"})}),H($G,{align:Y==="left"?"start":"end",className:"w-80 p-1",children:H("div",{className:"flex max-h-96 flex-col gap-1 overflow-y-auto",children:V.map((z)=>{let F=z.id===N;return O(QG,{onClick:()=>Z(z.id),className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2",children:[O("div",{className:"flex min-w-[2rem] flex-shrink-0 items-center justify-center rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground select-none",children:["v",z.version]}),H("div",{className:"flex h-10 w-16 flex-shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:z.previewUrl?H("img",{src:z.previewUrl,alt:z.name||void 0,className:"h-full w-full object-cover"}):H(JG,{className:"h-4 w-4 text-muted-foreground"})}),O("div",{className:"flex min-w-0 flex-1 flex-col text-left",children:[H("span",{className:"truncate text-sm font-semibold text-foreground",children:z.name}),H("span",{className:"truncate text-xs text-muted-foreground",children:z.creator?.name||"Unknown"})]}),F&&H(GG,{className:"ml-auto h-4 w-4 flex-shrink-0 text-primary"})]},z.id)})})})]});return H("div",{onMouseDown:M,className:C("dark flex h-10 flex-shrink-0 items-center gap-1 border-b bg-background px-2 transition-colors",_?"border-b-2 border-primary":"border-border"),children:Y==="left"?O(d,{children:[L,w,T]}):O(d,{children:[w,T,H("div",{className:"ml-auto"}),L]})})}function XG(Y,X,K){return KG({queryKey:X?["public-share-file",K,Y,localStorage.getItem(`share_pwd_${K}`)||""]:["files",Y],queryFn:async()=>{if(X){let V=localStorage.getItem(`share_pwd_${K}`)||"",_=await c.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:K,fileId:Y}},{headers:{"x-share-password":V}});if(!_.ok)throw Error("Failed to fetch version asset");return await _.json()}let N=await c.api.files[":fileId"].$get({param:{fileId:Y}});if(!N.ok)throw Error("Failed to fetch version asset");return await N.json()},enabled:!!Y&&(!X||!!K)})}function NH({isPublic:Y=!1,shareId:X,versions:K,leftId:N,rightId:V,activeSide:_,annotations:M,seekRequest:Z,onActiveSideChange:U,onSwitchVersion:B,onExit:L,onActiveAssetChange:w,onPlay:T,onTimeUpdate:z}){let F=J.useRef(null),E=J.useRef(null),$=J.useRef(null),[y,p]=J.useState(null),[S,g]=J.useState(null),[k,NG]=J.useState(1),[zG,l]=J.useState(!1),[OG,qG]=J.useState(!1),{data:P,isLoading:VG}=XG(N,Y,X),{data:R,isLoading:ZG}=XG(V,Y,X),MG=b(P),UG=b(R),I=!!P&&!!R&&MG.id===UG.id,f=_==="left"?P:R,u=_==="left"?y:S,D=J.useCallback(()=>_==="left"?E.current:$.current,[_]),h=J.useCallback(()=>_==="left"?$.current:E.current,[_]);J.useEffect(()=>{w(f??null)},[f,w]),J.useEffect(()=>{if(!Z)return;let G=D();if(G?.seekToSecond(Z.second),G?.pause(),I){let W=h();W?.seekToSecond(Z.second),W?.pause()}},[Z?.nonce]),J.useEffect(()=>{let G=()=>qG(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",G),()=>document.removeEventListener("fullscreenchange",G)},[]);let LG=J.useCallback((G)=>p(G),[]),DG=J.useCallback((G)=>g(G),[]),q=J.useCallback((G)=>{let W=D();if(W)G(W);if(I){let Q=h();if(Q)G(Q)}},[D,h,I]),m=J.useCallback(()=>{let G=!u?.video?.isPlaying;q((W)=>G?W.play():W.pause())},[u?.video?.isPlaying,q]);J.useEffect(()=>{let G=(W)=>{let Q=document.activeElement;if(Q&&(Q.tagName==="INPUT"||Q.tagName==="TEXTAREA"||Q instanceof HTMLElement&&Q.isContentEditable))return;let x=W.key===" ",j=Q&&(Q.tagName==="BUTTON"||Q.tagName==="A"||Q.tagName==="SELECT"||Q.tagName==="OPTION"||Q.getAttribute("role")==="button"||Q.getAttribute("role")==="link"||Q.getAttribute("role")==="checkbox"||Q.getAttribute("role")==="radio"||Q.getAttribute("role")==="menuitem");if(x&&j)return;if(W.key===" "||W.key.toLowerCase()==="k")W.preventDefault(),m()};return window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}},[m]);let BG=J.useCallback((G)=>q((W)=>W.seekToFrame(G)),[q]),wG=J.useCallback(()=>D()?.toggleLoop(),[D]),FG=J.useCallback((G)=>{NG(G),l(G===0)},[]),EG=J.useCallback(()=>l((G)=>!G),[]),PG=J.useCallback((G)=>q((W)=>W.setPlaybackRate(G)),[q]),RG=J.useCallback((G)=>D()?.changeResolution(G),[D]),TG=J.useCallback(()=>q((G)=>G.zoomBy(1.2)),[q]),kG=J.useCallback(()=>q((G)=>G.zoomBy(0.8)),[q]),IG=J.useCallback(()=>q((G)=>G.fit()),[q]),bG=J.useCallback((G)=>{D()?.download(G)},[D]),yG=J.useCallback(()=>{if(!F.current)return;if(!document.fullscreenElement)F.current.requestFullscreen();else document.exitFullscreen()},[]),fG=J.useCallback((G,W)=>{if(I)$.current?.panBy(G,W)},[I]),mG=J.useCallback((G,W)=>{if(I)E.current?.panBy(G,W)},[I]),jG=J.useCallback(()=>m(),[m]),n=J.useCallback((G)=>K.find((W)=>W.id===G)?.version,[K]),CG=J.useMemo(()=>f?.media?.videoPreview?.url,[f?.media?.videoPreview?.url]),o=(G,W)=>{let x=b(W)?.comparePane;if(!x)return H("div",{className:"flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950",children:H("p",{className:"text-muted-foreground",children:"Preview unavailable"})});let j=_===G;return H(x,{ref:G==="left"?E:$,file:W,shareId:X,isActive:j,annotations:j?M:[],onStateChange:G==="left"?LG:DG,onUserPan:G==="left"?fG:mG,onActivate:()=>U(G),muted:j?zG:!0,volume:k,onPlay:T,onTimeUpdate:z,onRequestTogglePlay:jG},W.id)},pG=!!P&&!!R,xG=VG||ZG;return O("div",{ref:F,className:"flex h-full flex-1 flex-col bg-background",children:[O("div",{className:"flex min-h-0 flex-1",children:[O("div",{className:"flex min-w-0 flex-1 flex-col border-r border-zinc-800",children:[P&&H(v,{side:"left",fileName:P.name,version:n(N),activeVersionId:N,versions:K,isActive:_==="left",onActivate:()=>U("left"),onSwitchVersion:(G)=>B("left",G),onExit:L}),H("div",{className:"relative flex min-h-0 flex-1",children:P?o("left",P):H("div",{className:"flex flex-1 items-center justify-center",children:H(A,{className:"h-6 w-6 animate-spin text-foreground"})})})]}),O("div",{className:"flex min-w-0 flex-1 flex-col",children:[R&&H(v,{side:"right",fileName:R.name,version:n(V),activeVersionId:V,versions:K,isActive:_==="right",onActivate:()=>U("right"),onSwitchVersion:(G)=>B("right",G),onExit:L}),H("div",{className:"relative flex min-h-0 flex-1",children:R?o("right",R):H("div",{className:"flex flex-1 items-center justify-center",children:H(A,{className:"h-6 w-6 animate-spin text-foreground"})})})]})]}),xG&&!pG&&H("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/30",children:H(A,{className:"h-8 w-8 animate-spin text-foreground"})}),H(e,{activeState:u,activeAsset:f??null,previewUrl:CG,isFullScreen:OG,onTogglePlay:m,onToggleLoop:wG,onSeek:BG,onVolumeChange:FG,onToggleMute:EG,onChangePlaybackRate:PG,onChangeResolution:RG,onZoomIn:TG,onZoomOut:kG,onFit:IG,onDownload:bG,onToggleFullScreen:yG})]})}
|
|
2
2
|
export{vG as h,NH as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ya as lz}from"./chunk-ky3dx324.js";import"./chunk-q11m2cp3.js";import{_a as a}from"./chunk-h1hj60fr.js";import{$a as yz,ab as Dz,bb as bz,cb as Cz,db as fz,eb as Iz,fb as gz,gb as uz}from"./chunk-2m2saan7.js";import{Og as hz}from"./chunk-1zpw2mbj.js";import{Pg as c}from"./chunk-jtwvd0te.js";import{Rg as E,Sg as b,Ug as C,Vg as f,Wg as M,dh as wz,eh as n,fh as Rz,gh as Kz,hh as kz,ih as qz,jh as Az,kh as Ez}from"./chunk-8a9k4qj6.js";import{Ch as m,Gj as Gz,Hh as Pz,Nj as Lz,Rh as Yz,Th as X,Uh as Jz,Vh as Uz,ai as Bz,bi as zz,di as Wz,ei as $z,hk as _z,ik as Sz,jk as Mz,kk as vz,nh as Xz,nk as V,oh as N,ph as z,pi as Tz,pj as Zz,qh as J,rh as x,uh as Vz,vh as Oz,wh as k,wi as i}from"./chunk-q0dhm16d.js";import{Wk as Qz}from"./chunk-6f1twjf6.js";var K=Qz(Xz(),1);function Fz({open:Z,onOpenChange:$,mode:T,teamId:F,project:W}){let q=x(),R=m(),[H,O]=K.useState(""),[v,B]=K.useState(!0),[I,P]=K.useState(void 0),[h,U]=K.useState(void 0),[A,w]=K.useState(!1),S=K.useRef(null);K.useEffect(()=>{if(Z)if(T==="edit"&&W)O(W.name||""),P(W.coverImageKey),U(W.coverImage),B(W.enableNotification!==!1);else O(""),P(void 0),U(void 0),B(!0)},[Z,T,W]);let g=X.api.teams[":teamId"].projects.$post,{mutate:j}=k({mutationFn:async(Q)=>{let _=await g({param:{teamId:F},json:Q});if(!_.ok)throw Error(V.failed_create_project());return await _.json()},onSuccess:(Q)=>{q.invalidateQueries({queryKey:["teams",F,"projects"]}),$(!1);let _=Q;if(_&&typeof _.id==="string")R({to:"/projects/$projectId",params:{projectId:_.id}})}}),u=X.api.projects[":projectId"].$put,{mutate:y}=k({mutationFn:async(Q)=>{let _=await u({param:{projectId:W.id},json:Q});if(!_.ok)throw Error(V.failed_update_project());return await _.json()},onSuccess:()=>{q.invalidateQueries({queryKey:["teams",F,"projects"]}),$(!1)}}),r=X.api.teams[":teamId"].files.$post,{mutate:D}=k({mutationFn:async({file:Q})=>{let _=await r({param:{teamId:F},form:{file:Q}});if(!_.ok)throw Error(V.failed_upload_file());return await _.json()},onSuccess:(Q)=>{let _=Q;if(_&&typeof _.key==="string")P(_.key);w(!1)},onError:()=>{w(!1)}}),o=(Q)=>{let _=Q.target.files?.[0];if(_){w(!0);let e=URL.createObjectURL(_);U(e),D({file:_})}},t=()=>{S.current?.click()},s=(Q)=>{Q.stopPropagation(),P(void 0),U(void 0)},l=()=>{if(!H.trim())return;if(T==="create")j({name:H.trim(),coverImageKey:I,enableNotification:v});else if(T==="edit"&&W?.id)y({name:H.trim(),coverImageKey:I,enableNotification:v})};return z(Rz,{open:Z,onOpenChange:$,children:J(Kz,{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:[J(kz,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[z("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),z("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),z("div",{className:"flex items-center gap-3",children:J("div",{children:[z(Az,{className:"text-xl font-semibold tracking-tight text-foreground",children:T==="create"?V.create_new_project():V.project_settings()}),z(Ez,{className:"text-xs text-muted-foreground/80 mt-1",children:T==="create"?V.configure_new_project_description():V.manage_project_description()})]})})]}),J("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[J("div",{className:"space-y-2",children:[z(c,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:V.project_name()}),J("div",{className:"relative",children:[z(n,{id:"name",value:H,onChange:(Q)=>O(Q.target.value),placeholder:V.project_name_placeholder(),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"}),H.trim()&&z("div",{className:"absolute inset-y-0 right-3 flex items-center",children:z(i,{className:"w-4 h-4 text-primary"})})]}),z("p",{className:"text-[11px] text-muted-foreground",children:V.project_name_hint()})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J("div",{className:"flex items-center justify-between",children:[J(c,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z($z,{className:"w-4 h-4 text-primary"}),V.project_cover()]}),h&&J("button",{type:"button",onClick:s,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:[z(Lz,{className:"w-3.5 h-3.5"}),V.remove_cover()]})]}),J("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:t,children:[z("input",{type:"file",ref:S,className:"hidden",accept:"image/*",onChange:o}),A&&z("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:J("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[z(zz,{className:"w-4 h-4 animate-spin text-primary"}),z("span",{className:"text-xs font-semibold text-foreground",children:V.uploading()})]})}),h?J(N,{children:[z("img",{src:h,alt:V.cover_preview(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),J("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:[z(Gz,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),z("span",{className:"text-xs font-semibold",children:V.upload_image()})]})]}):J("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[z("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:z(Gz,{className:"w-4 h-4 text-muted-foreground"})}),J("div",{children:[z("p",{className:"text-xs font-medium text-foreground",children:V.upload_cover()}),z("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:V.upload_cover_hint()})]})]})]})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J(c,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z(Wz,{className:"w-4 h-4 text-primary"}),V.project_preferences()]}),J("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:[J("div",{className:"space-y-1 pr-4",children:[J("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[z(Tz,{className:"w-4 h-4 text-primary"}),V.activity_notifications()]}),z("p",{className:"text-xs text-muted-foreground leading-normal",children:V.activity_notifications_description()})]}),z(a,{checked:v,onCheckedChange:B,disabled:A,className:"mt-0.5"})]})]})]}),J(qz,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[z(E,{type:"button",variant:"ghost",onClick:()=>$(!1),disabled:A,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:V.cancel()}),z(E,{type:"submit",onClick:l,disabled:!H.trim()||A,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:A?J(N,{children:[z(zz,{className:"w-4 h-4 animate-spin"}),V.processing()]}):T==="create"?V.create_project():V.save_changes()})]})]})})}function Nz({sortBy:Z,sortDirection:$,onSortChange:T}){let F=(H)=>{T(H,$)},W=()=>{T(Z,$==="asc"?"desc":"asc")},q=(H)=>{switch(H){case"name":return V.sort_name();case"created_at":return V.sort_created();case"updated_at":return V.sort_updated();default:return H}},R=$==="asc";return J(b,{children:[z(C,{asChild:!0,children:J(E,{variant:"outline",className:"gap-2 bg-muted/50",children:[z("span",{className:"text-muted-foreground",children:V.sorted_by_label()}),z("span",{className:"font-medium text-foreground",children:q(Z)})]})}),J(f,{align:"end",className:"w-56 p-2",children:[z("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:V.sort_by()}),J(b,{children:[z(C,{asChild:!0,children:J(E,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[z("span",{children:q(Z)}),z(Jz,{className:"h-4 w-4 opacity-50"})]})}),z(f,{className:"w-52",children:["name","created_at","updated_at"].map((H)=>J(M,{onClick:()=>F(H),className:"justify-between",children:[q(H),Z===H&&z(i,{className:"h-4 w-4"})]},H))})]}),J(E,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:W,children:[z("span",{className:"text-muted-foreground",children:Z==="name"?R?z(N,{children:V.sort_a_to_z()}):z(N,{children:V.sort_z_to_a()}):R?z(N,{children:V.sort_oldest_to_newest()}):z(N,{children:V.sort_newest_to_oldest()})}),R?z(Uz,{className:"h-4 w-4 opacity-50"}):z(Jz,{className:"h-4 w-4 opacity-50"})]})]})]})}var L=Qz(Xz(),1);function tz(){let{teamId:Z}=sz.useParams(),{canEdit:$,canAdmin:T}=wz(),F=m(),W=x(),[q,R]=L.useState(null),[H,O]=L.useState(!1),[v,B]=L.useState("create"),[I,P]=L.useState(void 0),[h,U]=L.useState(!1),[A,w]=L.useState(void 0),[S,g]=L.useState(""),[j,u]=L.useState(!1),[y,r]=L.useState("name"),[D,o]=L.useState("asc"),t=X.api.teams[":teamId"].projects.$get,{data:s}=Oz({queryKey:["teams",Z,"projects",y,D],queryFn:async()=>{let G=await t({param:{teamId:Z},query:{sortBy:y,sortDirection:D}});if(!G.ok)throw Error("Failed to fetch projects");return await G.json()}}),{data:l}=Vz({queryKey:["teams",Z,"members"],queryFn:async()=>{let G=await X.api.teams[":teamId"].members.$get({param:{teamId:Z},query:{}});if(!G.ok)throw Error("Failed to fetch members");return await G.json()}}),{data:Q}=Vz({queryKey:["teams",Z,"me"],queryFn:async()=>{let G=await X.api.teams[":teamId"].me.$get({param:{teamId:Z}});if(!G.ok)throw Error("Failed to fetch me");return await G.json()}}),_=X.api.teams[":teamId"].invite.$post,e=k({mutationFn:async(G)=>{let Y=await _(G);if(!Y.ok)throw Error("Failed to invite");return await Y.json()}}),d=k({mutationFn:async(G)=>{if(!(await X.api.projects[":projectId"].$delete({param:{projectId:G}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]})}}),dz=k({mutationFn:async(G)=>{let Y=await X.api.projects[":projectId"].$put({param:{projectId:G.id},json:{enableNotification:!G.enableNotification}});if(!Y.ok)throw Error("Failed to update project notification settings");return await Y.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]}),Yz.success(V.project_notification_updated())},onError:(G)=>{Yz.error(G instanceof Error?G.message:V.failed_update_project_notification())}}),Hz=()=>{B("create"),P(void 0),O(!0)},pz=()=>{R("create"),setTimeout(()=>{R(null)},100),setTimeout(()=>{Hz()},200)},cz=(G)=>{B("edit"),P(G),O(!0)},xz=(G)=>{w(G),g(""),U(!0)},mz=async()=>{if(A&&S==="delete")try{await d.mutateAsync(A.id),U(!1)}catch(G){console.error(G)}},iz=(G,Y)=>{if(Y.detail>1)return;R(G),setTimeout(()=>{R(null)},100),setTimeout(()=>{F({to:"/projects/$projectId",params:{projectId:G}})},200)},nz=async(G)=>{return(await e.mutateAsync({param:{teamId:Z},json:{role:G}})).code},az=k({mutationFn:async({userId:G,role:Y})=>{if(!(await X.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:Z,userId:G},json:{role:Y}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),jz=k({mutationFn:async(G)=>{if(!(await X.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:Z,userId:G}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),rz=(G)=>{if(!G)return"??";return G.split(" ").map((Y)=>Y[0]).slice(0,2).join("").toUpperCase()},oz=(G,Y)=>{r(G),o(Y)},p=Array.isArray(l)?l:[];return J("div",{className:"flex-1 overflow-y-auto p-4",children:[J("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[z("h1",{className:"text-2xl font-bold",children:V.projects()}),J("div",{className:"flex flex-wrap items-center gap-4",children:[J("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>u(!0),children:[p.slice(0,3).map((G)=>J(Sz,{className:"border-2 border-background w-8 h-8",children:[G.image&&z(Mz,{src:G.image,alt:G.name,className:"object-cover"}),z(vz,{className:"text-[10px]",children:rz(G.name)})]},G.id)),p.length>3&&J("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",p.length-3]})]}),z(Nz,{sortBy:y,sortDirection:D,onSortChange:oz}),$&&J(E,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:Hz,children:[z(Zz,{className:"w-4 h-4"}),V.create_project()]})]})]}),J("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:[s.data?.map((G)=>z("div",{className:_z("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",q===G.id?"scale-95":"scale-100"),onClick:(Y)=>iz(G.id,Y),children:J("div",{className:"flex flex-col",children:[J("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[G.coverImage?z("img",{src:G.coverImage,alt:G.name,className:"w-full h-full object-cover rounded"}):J("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:[z("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),z("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"}),z("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"}),z("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),z("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),z("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"}),z("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),z("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"}),z("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"}),z("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),z("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),z("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),z("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),z("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),z("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),z("p",{className:"absolute left-1 bottom-2 text-white",children:G.name})]}),J("div",{className:"px-2 h-10 flex justify-between items-center",children:[J("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[V.updated_ago()," ",hz(G.updatedAt??"")]}),z("div",{onClick:(Y)=>Y.stopPropagation(),children:J(b,{modal:!1,children:[z(C,{asChild:!0,children:z("button",{className:"hover:bg-muted outline-none flex px-1",children:z(Bz,{className:"w-5 h-5 text-muted-foreground"})})}),J(f,{align:"end",children:[$&&z(M,{onClick:(Y)=>{Y.stopPropagation(),cz(G)},children:V.project_settings()}),J(M,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(Y)=>{Y.preventDefault(),dz.mutate(G)},children:[z("span",{children:V.notification()}),z(a,{checked:G.enableNotification??!0,className:"pointer-events-none"})]}),T&&z(M,{className:"text-destructive focus:text-destructive",onClick:()=>xz(G),children:V.delete()})]})]})})]})]})},G.id)),$&&z("div",{className:_z("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",q==="create"?"scale-95":"scale-100"),onClick:pz,children:J("div",{className:"flex flex-col",children:[z("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:z(Zz,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),z("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:z("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:V.create_project()})})]})})]}),z(Fz,{open:H,onOpenChange:O,mode:v,teamId:Z,project:I}),z(yz,{open:h,onOpenChange:U,children:J(Dz,{children:[J(bz,{children:[z(fz,{children:V.are_you_sure()}),J(Iz,{children:[V.delete_project_warning({name:A?.name??""}),J("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[z("span",{className:"text-sm font-medium",children:V.type_delete_to_confirm()}),z(n,{value:S,onChange:(G)=>g(G.target.value),placeholder:V.delete_placeholder(),className:"h-9",autoFocus:!0})]})]})]}),J(Cz,{children:[z(uz,{disabled:d.isPending,children:V.cancel()}),z(gz,{onClick:(G)=>{G.preventDefault(),mz()},disabled:S!=="delete"||d.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:d.isPending?V.deleting():V.delete()})]})]})}),z(lz,{open:j,onOpenChange:u,title:V.team_members(),type:"team",members:p,isOwner:Q?.role==="owner",onInvite:nz,onUpdateRole:async(G,Y)=>{await az.mutateAsync({userId:G,role:Y})},onRemoveMember:async(G)=>{await jz.mutateAsync(G)},currentUserId:Q?.id})]})}var sz=Pz("/teams/$teamId/")({component:tz});export{sz as Route};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as W,b as X,c as Y,d,e as f,f as P}from"./chunk-
|
|
1
|
+
import{a as W,b as X,c as Y,d,e as f,f as P}from"./chunk-gc7b9j22.js";import{rf as M,sf as U,tf as C,uf as H,vf as I}from"./chunk-5jhrqbk2.js";import{Hh as T,Rj as q,Th as N,Wh as l,bi as G,fk as K,hk as y,ik as A,jk as D,kk as L,nh as J,nk as o,ph as n,qh as i,th as Q,uh as w,wj as b}from"./chunk-q0dhm16d.js";import{Wk as E}from"./chunk-6f1twjf6.js";var x=E(J(),1);var Z=E(J(),1);var R=E(J(),1);var B=q("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 k=R.createContext({size:"default",variant:"default",spacing:0});function O({className:p,variant:r,size:v,spacing:c=0,children:u,...g}){return n(K.Root,{"data-slot":"toggle-group","data-variant":r,"data-size":v,"data-spacing":c,style:{"--gap":c},className:y("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",p),...g,children:n(k.Provider,{value:{variant:r,size:v,spacing:c},children:u})})}function z({className:p,children:r,variant:v,size:c,...u}){let g=R.useContext(k);return n(K.Item,{"data-slot":"toggle-group-item","data-variant":g.variant||v,"data-size":g.size||c,"data-spacing":g.spacing,className:y(B({variant:g.variant||v,size:g.size||c}),"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",p),...u,children:r})}function a({teamId:p}){let[r,v]=Z.useState("team"),[c,u]=Z.useState("1h"),{data:g,isLoading:s}=w({queryKey:["teams",p,"ai-usage",c,"team"],queryFn:async()=>{let t=await N.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:p},query:{timeframe:c}});if(!t.ok)throw Error("Failed to fetch team AI usage");return await t.json()},enabled:!!p&&r==="team"}),{data:$,isLoading:j}=w({queryKey:["teams",p,"members"],queryFn:async()=>{let t=await N.api.teams[":teamId"].members.$get({param:{teamId:p},query:{}});if(!t.ok)throw Error("Failed to fetch team members");return await t.json()},enabled:!!p&&r==="members"}),F=Q({queries:($||[]).map((t)=>({queryKey:["teams",p,"ai-usage",c,t.id],queryFn:async()=>{let V=await N.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:p},query:{timeframe:c,userId:t.id}});if(!V.ok)throw Error(`Failed to fetch AI usage for member ${t.id}`);return await V.json()},enabled:!!p&&r==="members"}))}),m=j||F.some((t)=>t.isLoading),e=(t)=>{if(!t)return"U";let V=t.split(" ");if(V.length>1)return`${V[0][0]}${V[V.length-1][0]}`.toUpperCase();return t.substring(0,2).toUpperCase()},nn=(t)=>{if(!t)return"";switch(t.toLowerCase()){case"owner":return o.owner();case"editor":return o.editor();case"reviewer":return o.reviewer();default:return t}},h=(t)=>(t??0).toLocaleString(),S=(t)=>`$${(t??0).toFixed(6)}`;return i(M,{className:"border-border/60 shadow-sm",children:[i(U,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[i("div",{children:[n(C,{className:"text-xl font-semibold tracking-tight",children:o.ai_usage()}),n(H,{className:"text-sm text-muted-foreground mt-1",children:o.ai_usage_description()})]}),i("div",{className:"flex flex-wrap items-center gap-3",children:[i(O,{type:"single",value:r,onValueChange:(t)=>{if(t)v(t)},className:"border rounded-lg p-1 bg-muted/30",children:[n(z,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:o.team_view()}),n(z,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:o.members_view()})]}),i(O,{type:"single",value:c,onValueChange:(t)=>{if(t)u(t)},className:"border rounded-lg p-1 bg-muted/30",children:[n(z,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),n(z,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),n(z,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),n(z,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),n(I,{children:r==="team"?s?n("div",{className:"flex h-48 items-center justify-center",children:n(G,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):n("div",{className:"rounded-md border",children:i(W,{children:[n(X,{children:i(d,{children:[n(f,{children:o.team()}),n(f,{className:"text-right",children:o.input_tokens()}),n(f,{className:"text-right",children:o.output_tokens()}),n(f,{className:"text-right",children:o.cache_read_tokens()}),n(f,{className:"text-right",children:o.total_tokens()}),n(f,{className:"text-right",children:o.cost()})]})}),n(Y,{children:i(d,{children:[n(P,{className:"font-medium",children:o.team()}),n(P,{className:"text-right",children:h(g?.team?.inputTokens)}),n(P,{className:"text-right",children:h(g?.team?.outputTokens)}),n(P,{className:"text-right",children:h(g?.team?.cacheReadTokens)}),n(P,{className:"text-right font-medium",children:h(g?.team?.totalTokens)}),n(P,{className:"text-right font-medium",children:S(g?.team?.cost)})]})})]})}):m?n("div",{className:"flex h-48 items-center justify-center",children:n(G,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):n("div",{className:"rounded-md border",children:i(W,{children:[n(X,{children:i(d,{children:[n(f,{children:o.members()}),n(f,{children:o.role()}),n(f,{className:"text-right",children:o.input_tokens()}),n(f,{className:"text-right",children:o.output_tokens()}),n(f,{className:"text-right",children:o.cache_read_tokens()}),n(f,{className:"text-right",children:o.total_tokens()}),n(f,{className:"text-right",children:o.cost()})]})}),n(Y,{children:($||[]).map((t,V)=>{let _=F[V]?.data?.member;return i(d,{children:[n(P,{children:i("div",{className:"flex items-center gap-3",children:[i(A,{className:"h-8 w-8 rounded-full",children:[t.image&&n(D,{src:t.image,alt:t.name,className:"object-cover"}),n(L,{className:"bg-primary/20 text-xs",children:e(t.name)})]}),i("div",{className:"flex flex-col",children:[n("span",{className:"text-sm font-medium leading-none",children:t.name}),n("span",{className:"text-xs text-muted-foreground mt-0.5",children:t.email})]})]})}),n(P,{className:"text-xs text-muted-foreground",children:nn(t.role)}),n(P,{className:"text-right",children:h(_?.inputTokens)}),n(P,{className:"text-right",children:h(_?.outputTokens)}),n(P,{className:"text-right",children:h(_?.cacheReadTokens)}),n(P,{className:"text-right font-medium",children:h(_?.totalTokens)}),n(P,{className:"text-right font-medium",children:S(_?.cost)})]},t.id)})})]})})})]})}function tn(){let{teamId:p}=on.useParams(),[r,v]=x.useState("ai-usage"),{data:c,isLoading:u}=w({queryKey:["teams",p,"me"],queryFn:async()=>{let g=await N.api.teams[":teamId"].me.$get({param:{teamId:p}});if(!g.ok)throw Error("Failed to fetch me");return await g.json()},enabled:!!p});if(u)return n("div",{className:"flex h-screen items-center justify-center",children:n(G,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(c?.role?.toLowerCase()!=="owner")return i("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[n(b,{className:"h-12 w-12 text-destructive mb-4"}),n("h2",{className:"text-xl font-bold tracking-tight mb-2",children:o.access_denied()}),n("p",{className:"text-sm text-muted-foreground max-w-md",children:o.only_owner_dashboard()})]});return n("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:i("div",{className:"flex flex-col md:flex-row h-full",children:[n("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:i("nav",{className:"p-4 space-y-1 mt-4",children:[n("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:o.dashboard()}),n("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:o.ai()}),i("button",{onClick:()=>v("ai-usage"),className:y("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",r==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[n(l,{className:"w-5 h-5"}),o.usage(),r==="ai-usage"&&n("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),n("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:n("div",{className:"max-w-6xl mx-auto space-y-8",children:r==="ai-usage"&&n(a,{teamId:p})})})]})})}var on=T("/teams/$teamId/dashboard")({component:tn});export{on as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{J as
|
|
1
|
+
import{Mh as F,Th as B}from"./chunk-q0dhm16d.js";var J=F((w,D)=>({metadata:{},isLoading:!1,error:null,fetchMetadata:async(A)=>{w({isLoading:!0,error:null});try{let h=await B.api.teams[":teamId"]["user-metadata"].$get({param:{teamId:A}});if(!h.ok)throw Error("failed to fetch user metadata");let C=(await h.json()).reduce((j,E)=>{return j[E.key]=E.value,j},{});w({metadata:C,isLoading:!1})}catch(h){w({error:h instanceof Error?h.message:String(h),isLoading:!1})}},setMetadata:async(A,h,q)=>{let C=D().metadata;w((j)=>({metadata:{...j.metadata,[h]:q}}));try{if(!(await B.api.teams[":teamId"]["user-metadata"][":key"].$put({param:{teamId:A,key:h},json:{value:q}})).ok)throw Error("failed to update user metadata")}catch(j){w({metadata:C}),console.error(j)}},getMetadata:(A,h)=>{let q=D().metadata[A];return q!==void 0?q:h}}));
|
|
2
|
+
export{J as zf};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Kk as L,Mk as w}from"./chunk-8sr8ff6a.js";import{Rk as Z}from"./chunk-e66j69wz.js";import{Vk as J}from"./chunk-3g54qkv5.js";function d(b){return b.thought===!0}function B(b,j){if(typeof j==="string"&&j.length>0)return j;return b}var x=/^[A-Za-z0-9+/]+={0,2}$/;function T(b){if(!b)return!1;if(b.length%4!==0)return!1;return x.test(b)}function Q(b,j){return b&&T(j)?j:void 0}function U(b){return b.startsWith("claude-")||b.startsWith("gpt-oss-")}function f(b){let j=b.toLowerCase().match(/^gemini(?:-live)?-(\d+)/);if(!j)return;return Number.parseInt(j[1],10)}function y(b){let j=f(b);if(j!==void 0)return j>=3;return!0}function R(b,j){let A=[],N=(z)=>{if(!U(b.id))return z;return z.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)},$=Z(j.messages,b,N);for(let z of $)if(z.role==="user")if(typeof z.content==="string")A.push({role:"user",parts:[{text:J(z.content)}]});else{let E=z.content.map((D)=>{if(D.type==="text")return{text:J(D.text)};else return{inlineData:{mimeType:D.mimeType,data:D.data}}});if(E.length===0)continue;A.push({role:"user",parts:E})}else if(z.role==="assistant"){let E=[],D=z.provider===b.provider&&z.model===b.id;for(let q of z.content)if(q.type==="text"){if(!q.text||q.text.trim()==="")continue;let G=Q(D,q.textSignature);E.push({text:J(q.text),...G&&{thoughtSignature:G}})}else if(q.type==="thinking"){if(!q.thinking||q.thinking.trim()==="")continue;if(D){let G=Q(D,q.thinkingSignature);E.push({thought:!0,text:J(q.thinking),...G&&{thoughtSignature:G}})}else E.push({text:J(q.thinking)})}else if(q.type==="toolCall"){let G=Q(D,q.thoughtSignature),K={functionCall:{name:q.name,args:q.arguments??{},...U(b.id)?{id:q.id}:{}},...G&&{thoughtSignature:G}};E.push(K)}if(E.length===0)continue;A.push({role:"model",parts:E})}else if(z.role==="toolResult"){let D=z.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
|
|
3
3
|
`),q=b.input.includes("image")?z.content.filter((H)=>H.type==="image"):[],G=D.length>0,K=q.length>0,V=y(b.id),W=G?J(D):K?"(see attached image)":"",X=q.map((H)=>({inlineData:{mimeType:H.mimeType,data:H.data}})),v=U(b.id),Y={functionResponse:{name:z.toolName,response:z.isError?{error:W}:{output:W},...K&&V&&{parts:X},...v?{id:z.toolCallId}:{}}},O=A[A.length-1];if(O?.role==="user"&&O.parts?.some((H)=>H.functionResponse))O.parts.push(Y);else A.push({role:"user",parts:[Y]});if(K&&!V)A.push({role:"user",parts:[{text:"Tool result image:"},...X]})}return A}var F=new Set(["$schema","$id","$anchor","$dynamicAnchor","$vocabulary","$comment","$defs","definitions"]);function _(b){if(typeof b!=="object"||b===null||Array.isArray(b))return b;let j={};for(let[A,N]of Object.entries(b)){if(F.has(A))continue;j[A]=_(N)}return j}function C(b,j=!1){if(b.length===0)return;return[{functionDeclarations:b.map((A)=>({name:A.name,description:A.description,...j?{parameters:_(A.parameters)}:{parametersJsonSchema:A.parameters}}))}]}function k(b){switch(b){case"auto":return L.AUTO;case"none":return L.NONE;case"any":return L.ANY;default:return L.AUTO}}function P(b){switch(b){case w.STOP:return"stop";case w.MAX_TOKENS:return"length";case w.BLOCKLIST:case w.PROHIBITED_CONTENT:case w.SPII:case w.SAFETY:case w.IMAGE_SAFETY:case w.IMAGE_PROHIBITED_CONTENT:case w.IMAGE_RECITATION:case w.IMAGE_OTHER:case w.RECITATION:case w.FINISH_REASON_UNSPECIFIED:case w.OTHER:case w.LANGUAGE:case w.MALFORMED_FUNCTION_CALL:case w.UNEXPECTED_TOOL_CALL:case w.NO_IMAGE:return"error";default:throw Error(`Unhandled stop reason: ${b}`)}}
|
|
4
|
-
export{d as
|
|
4
|
+
export{d as Ek,B as Fk,R as Gk,C as Hk,k as Ik,P as Jk};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var I=(w)=>w;function J(w,H,A=I){let B=new Map;for(let h of w.tools??[])B.set(A(h.name),h);if(!H)return{immediate:[...B.values()],deferred:new Map};let C=new Set,D=new Set;for(let h of w.messages)if(h.role==="assistant"){for(let v of h.content)if(v.type==="toolCall")D.add(A(v.name))}else if(h.role==="toolResult")for(let v of h.addedToolNames??[]){let G=A(v);if(!D.has(G))C.add(G)}let E=[],F=new Map;for(let[h,v]of B)if(C.has(h))F.set(h,v);else E.push(v);return{immediate:E,deferred:F}}
|
|
3
|
-
export{J as
|
|
3
|
+
export{J as Sb};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{B as
|
|
1
|
+
import{Af as A}from"./chunk-t0detvbj.js";import{Gh as w,Th as z,ph as v}from"./chunk-q0dhm16d.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/recently-deleted")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
|
|
2
|
+
export{B as if,H as jf};
|