@shumai-one/shumai 0.5.2 → 0.6.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-qxscgcn9.js → chunk-01ym2agz.js} +1 -1
- package/bin/{chunk-ae6zgjhd.js → chunk-047n9gfs.js} +2 -2
- package/bin/chunk-0a4ahz7r.js +2 -0
- package/bin/{chunk-v5hz09a1.js → chunk-0awcpx0a.js} +2 -2
- package/bin/{chunk-19q13a80.js → chunk-0fbgfgxv.js} +5 -5
- package/bin/{chunk-jt6v15wx.js → chunk-0nnqha4f.js} +1 -1
- package/bin/chunk-0tvggyy4.js +1 -0
- package/bin/{chunk-zckxc8m6.js → chunk-113baw0m.js} +2 -2
- package/bin/{chunk-mneeg71d.js → chunk-1dbjyarc.js} +2 -2
- package/bin/{chunk-951r2rx1.js → chunk-1qre79kf.js} +1 -1
- package/bin/chunk-27v3yepb.js +1 -0
- package/bin/{chunk-5vqbzsjv.js → chunk-2rq3w8sg.js} +1 -1
- package/bin/{chunk-v034sfw8.js → chunk-3020am4q.js} +2 -2
- package/bin/{chunk-zdzkjp4q.js → chunk-3fjgf7eb.js} +2 -2
- package/bin/chunk-3pwwg1xm.js +1 -0
- package/bin/{chunk-19jpn3r6.js → chunk-3sfb63fp.js} +1 -1
- package/bin/{chunk-wwkhskce.js → chunk-3tg10kwz.js} +2 -2
- package/bin/{chunk-0y4zq3y4.js → chunk-4g4pxmef.js} +1 -1
- package/bin/{chunk-2pw7xcrn.js → chunk-4jj92zwa.js} +1 -1
- package/bin/{chunk-bpxw19ez.js → chunk-4yhvexzk.js} +1 -1
- package/bin/chunk-58cbk6e8.js +1 -0
- package/bin/{chunk-eqr0znmc.js → chunk-59t9s2jh.js} +1 -1
- package/bin/{chunk-n76w2wcr.js → chunk-5e7r7a9d.js} +1 -1
- package/bin/{chunk-8tzfcqtb.js → chunk-5m51b7af.js} +1 -1
- package/bin/{chunk-m6v8vt2b.js → chunk-65t6rm5d.js} +2 -2
- package/bin/chunk-6bed0rz4.js +1 -0
- package/bin/{chunk-1nvj833s.js → chunk-6smn0q1n.js} +5 -5
- package/bin/{chunk-r249n1xe.js → chunk-6zerk0em.js} +2 -2
- package/bin/{chunk-gvas3xkp.js → chunk-7bbsv8g0.js} +1 -1
- package/bin/chunk-83bdgs2c.js +1 -0
- package/bin/{chunk-93p27bbm.js → chunk-86qtjd30.js} +5 -5
- package/bin/{chunk-b5r0be06.js → chunk-8rekh4h9.js} +1 -1
- package/bin/{chunk-d2dgazjj.js → chunk-8s9fehda.js} +1 -1
- package/bin/{chunk-r776bhsg.js → chunk-8sf2hf31.js} +1 -1
- package/bin/{chunk-mn108p93.js → chunk-9d3w678j.js} +1 -1
- package/bin/{chunk-xr2v0d6y.js → chunk-9gftd4f7.js} +4 -4
- package/bin/{chunk-n9vp9nbg.js → chunk-9rcg8zgs.js} +32 -32
- package/bin/{chunk-6jkjx0n2.js → chunk-a23q1kc4.js} +3 -3
- package/bin/{chunk-81dawvn4.js → chunk-a6cdt85k.js} +2 -2
- package/bin/chunk-a76h3ehe.js +1 -0
- package/bin/{chunk-rmvhyqyb.js → chunk-b1bkd2p4.js} +8 -8
- package/bin/{chunk-wnqxyqrg.js → chunk-bf5m8f6t.js} +2 -2
- package/bin/chunk-cf57fk11.js +2 -0
- package/bin/{chunk-0v9srsdz.js → chunk-cv5xx81e.js} +1 -1
- package/bin/{chunk-3q5qkfkc.js → chunk-czybv3vy.js} +1 -1
- package/bin/{chunk-ggfx2b0f.js → chunk-d4sbcvpa.js} +1 -1
- package/bin/{chunk-9ggwc289.js → chunk-d6xezgrg.js} +1 -1
- package/bin/{chunk-bbcmhcvc.js → chunk-da86fpjt.js} +2 -2
- package/bin/chunk-dzjmwat0.js +14 -0
- package/bin/{chunk-rza95y4z.js → chunk-eex8sjfs.js} +2 -2
- package/bin/{chunk-9zgqjdx1.js → chunk-emgyjhmx.js} +2 -2
- package/bin/{chunk-k3prp6c6.js → chunk-exmwerag.js} +5 -5
- package/bin/{chunk-kzr6ecke.js → chunk-f38xyahm.js} +1 -1
- package/bin/{chunk-ffj9cq9y.js → chunk-fb1bes2h.js} +1 -1
- package/bin/chunk-fbvak7q2.js +1 -0
- package/bin/{chunk-15w79661.js → chunk-fg9sr6r9.js} +1 -1
- package/bin/{chunk-dppfek34.js → chunk-fyb6t7ct.js} +2 -2
- package/bin/chunk-g2ptqqm3.js +3 -0
- package/bin/{chunk-t1yamxgk.js → chunk-ggwqxn95.js} +1 -1
- package/bin/chunk-ghk54h71.js +13 -0
- package/bin/{chunk-kvwec0p3.js → chunk-h1fbev9c.js} +2 -2
- package/bin/{chunk-f5z3096k.js → chunk-h9akn41s.js} +2 -2
- package/bin/{chunk-asy868kq.js → chunk-hdansxny.js} +1 -1
- package/bin/{chunk-grjek810.js → chunk-hjwpd09v.js} +2 -2
- package/bin/{chunk-zf5cyxnt.js → chunk-hjzbw975.js} +1 -1
- package/bin/{chunk-jgfye6nf.js → chunk-j4p3eqtd.js} +1 -1
- package/bin/chunk-jtkxeat4.js +2 -0
- package/bin/{chunk-8zgq5sav.js → chunk-jw4g9628.js} +3 -3
- package/bin/{chunk-0ge2mm8j.js → chunk-jxebakyq.js} +1 -1
- package/bin/{chunk-0asthrjf.js → chunk-kfewyax2.js} +2 -2
- package/bin/chunk-kk3m4za5.js +1 -0
- package/bin/{chunk-vzdgsfkf.js → chunk-m7tnj47b.js} +1 -1
- package/bin/{chunk-w73v578p.js → chunk-maw5ah8t.js} +2 -2
- package/bin/{chunk-8ny7wvzb.js → chunk-n0wwtjwv.js} +1 -1
- package/bin/{chunk-e439kt05.js → chunk-nahdd2t9.js} +1 -1
- package/bin/{chunk-04avc4fn.js → chunk-nv7tztvh.js} +32 -32
- package/bin/{chunk-mn208vrv.js → chunk-nyjwdxyj.js} +2 -2
- package/bin/{chunk-qmrg2jhs.js → chunk-p0yfxt5e.js} +5 -5
- package/bin/{chunk-p0j4wpa5.js → chunk-q27qn367.js} +2 -2
- package/bin/{chunk-j53sjkxt.js → chunk-q36sdt2w.js} +1 -1
- package/bin/{chunk-vm2pz2hm.js → chunk-q7t5zs7n.js} +2 -2
- package/bin/{chunk-cpj562n6.js → chunk-qbj5pe8t.js} +1 -1
- package/bin/chunk-qj0bxb1m.js +2 -0
- package/bin/{chunk-9bakwac0.js → chunk-qk5hsn6e.js} +4 -4
- package/bin/{chunk-6rn094yj.js → chunk-qnyqtaf0.js} +1 -1
- package/bin/{chunk-ypkkfwfb.js → chunk-qqkr6h07.js} +2 -2
- package/bin/chunk-qyqc5j3a.css +1 -0
- package/bin/chunk-qzaf6bre.js +2 -0
- package/bin/{chunk-cx32wsa1.js → chunk-r1e59gf0.js} +1 -1
- package/bin/chunk-ra5csbkr.js +2 -0
- package/bin/{chunk-rtaya5wc.js → chunk-rh8dy99a.js} +2 -2
- package/bin/{chunk-ryepy5er.js → chunk-rx9g95wk.js} +4 -4
- package/bin/{chunk-2w6gve12.js → chunk-rxyy37wa.js} +3 -3
- package/bin/{chunk-7qvvf0yd.js → chunk-scez7ppq.js} +2 -2
- package/bin/{chunk-twpc640e.js → chunk-t2a1vq34.js} +1 -1
- package/bin/chunk-t879v3b7.js +1 -0
- package/bin/{chunk-a8bymrv1.js → chunk-tjavzarz.js} +2 -2
- package/bin/{chunk-ce0bhc72.js → chunk-treyx8em.js} +1 -1
- package/bin/{chunk-dche0gy0.js → chunk-v3z4z04s.js} +1 -1
- package/bin/{chunk-5bk16qdp.js → chunk-v3z63tpw.js} +2 -2
- package/bin/{chunk-5rzxekn4.js → chunk-v9bes1fv.js} +1 -1
- package/bin/{chunk-d5hbzp7t.js → chunk-vjyget8s.js} +1 -1
- package/bin/{chunk-4zksqvwj.js → chunk-vmm9m3nv.js} +2 -2
- package/bin/chunk-vvr8tnse.js +211 -0
- package/bin/{chunk-tvkekn4z.js → chunk-w3stry4v.js} +1 -1
- package/bin/{chunk-3pm6q6kg.js → chunk-w89czwjj.js} +1 -1
- package/bin/{chunk-rw5h0n0s.js → chunk-wk0hk00z.js} +1 -1
- package/bin/{chunk-15vsw36h.js → chunk-ww9qq8yq.js} +5 -5
- package/bin/chunk-x4q082e6.js +2 -0
- package/bin/{chunk-98mg3dpd.js → chunk-x6rf77jm.js} +4 -4
- package/bin/chunk-x7dyj53k.js +2 -0
- package/bin/{chunk-y2dhf3p0.js → chunk-xbw7ffrz.js} +2 -2
- package/bin/{chunk-5nqvqvqp.js → chunk-xcrd0y8v.js} +3 -3
- package/bin/{chunk-0j22699g.js → chunk-z0z0jn5h.js} +2 -2
- package/bin/{chunk-w9z27p0m.js → chunk-zasjhrwc.js} +1 -1
- package/bin/chunk-zefds5gg.js +1 -0
- package/bin/{chunk-8ayz61rc.js → chunk-zzzgk1d5.js} +3 -3
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +390 -373
- package/package.json +8 -11
- package/prisma/migrations/20261014054332_add_embedding_768/migration.sql +8 -0
- package/prisma/schema.prisma +10 -8
- package/bin/chunk-2gf95tj0.js +0 -1
- package/bin/chunk-2tk5w3jc.js +0 -1
- package/bin/chunk-301e7g3z.js +0 -2
- package/bin/chunk-3kmjbc3m.js +0 -2
- package/bin/chunk-3td60k1m.js +0 -2
- package/bin/chunk-42hrvk6k.js +0 -211
- package/bin/chunk-8abhmarc.js +0 -2
- package/bin/chunk-965102pf.js +0 -3
- package/bin/chunk-acn3r2m2.js +0 -1
- package/bin/chunk-ce75dw3k.css +0 -1
- package/bin/chunk-d9qpgkek.js +0 -2
- package/bin/chunk-dv6p6n5e.js +0 -1
- package/bin/chunk-gnt9gewm.js +0 -2
- package/bin/chunk-k97axrc4.js +0 -13
- package/bin/chunk-qb178ntp.js +0 -2
- package/bin/chunk-s4r6e6ms.js +0 -1
- package/bin/chunk-syjjke3f.js +0 -1
- package/bin/chunk-tgfxe0sb.js +0 -1
- package/bin/chunk-tjretpx8.js +0 -1
- package/bin/chunk-w4yjgez6.js +0 -14
- package/bin/chunk-wjcebkpb.js +0 -1
- package/bin/chunk-ws71fg50.js +0 -2
- package/bin/chunk-yfp3q4da.js +0 -1
- package/bin/chunk-z8e4wc59.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t,E}from"./chunk-
|
|
1
|
+
import{t,E}from"./chunk-vvr8tnse.js";function Pn({className:e,...a}){return t("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t("table",{"data-slot":"table",className:E("w-full caption-bottom text-sm",e),...a})})}function Nn({className:e,...a}){return t("thead",{"data-slot":"table-header",className:E("[&_tr]:border-b",e),...a})}function Dn({className:e,...a}){return t("tbody",{"data-slot":"table-body",className:E("[&_tr:last-child]:border-0",e),...a})}function xr({className:e,...a}){return t("tr",{"data-slot":"table-row",className:E("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...a})}function It({className:e,...a}){return t("th",{"data-slot":"table-head",className:E("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a})}function xt({className:e,...a}){return t("td",{"data-slot":"table-cell",className:E("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a})}
|
|
2
2
|
export{Pn,Nn,Dn,xr,It,xt};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{w,V}from"./chunk-tjavzarz.js";var Y=w(function(wt,X){var A=1000,E=A*60,I=E*60,S=I*24,_e=S*7,ve=S*365.25;X.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return we(e);else if(t==="number"&&isFinite(e))return r.long?xe(e):Fe(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function we(e){if(e=String(e),e.length>100)return;var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!r)return;var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*ve;case"weeks":case"week":case"w":return t*_e;case"days":case"day":case"d":return t*S;case"hours":case"hour":case"hrs":case"hr":case"h":return t*I;case"minutes":case"minute":case"mins":case"min":case"m":return t*E;case"seconds":case"second":case"secs":case"sec":case"s":return t*A;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}function Fe(e){var r=Math.abs(e);if(r>=S)return Math.round(e/S)+"d";if(r>=I)return Math.round(e/I)+"h";if(r>=E)return Math.round(e/E)+"m";if(r>=A)return Math.round(e/A)+"s";return e+"ms"}function xe(e){var r=Math.abs(e);if(r>=S)return k(e,r,S,"day");if(r>=I)return k(e,r,I,"hour");if(r>=E)return k(e,r,E,"minute");if(r>=A)return k(e,r,A,"second");return e+" ms"}function k(e,r,t,n){var s=r>=t*1.5;return Math.round(e/t)+" "+n+(s?"s":"")}});var z=w(function(Ft,ee){function Oe(e){t.debug=t,t.default=t,t.coerce=v,t.disable=l,t.enable=s,t.enabled=_,t.humanize=Y(),t.destroy=N,Object.keys(e).forEach((o)=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={};function r(o){let i=0;for(let c=0;c<o.length;c++)i=(i<<5)-i+o.charCodeAt(c),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(o){let i,c=null,a,y;function f(...d){if(!f.enabled)return;let m=f,g=Number(new Date),x=g-(i||g);if(m.diff=x,m.prev=i,m.curr=g,i=g,d[0]=t.coerce(d[0]),typeof d[0]!=="string")d.unshift("%O");let F=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(O,j)=>{if(O==="%%")return"%";F++;let Q=t.formatters[j];if(typeof Q==="function"){let me=d[F];O=Q.call(m,me),d.splice(F,1),F--}return O}),t.formatArgs.call(m,d),(m.log||t.log).apply(m,d)}if(f.namespace=o,f.useColors=t.useColors(),f.color=t.selectColor(o),f.extend=n,f.destroy=t.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(c!==null)return c;if(a!==t.namespaces)a=t.namespaces,y=t.enabled(o);return y},set:(d)=>{c=d}}),typeof t.init==="function")t.init(f);return f}function n(o,i){let c=t(this.namespace+(typeof i>"u"?":":i)+o);return c.log=this.log,c}function s(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let i=(typeof o==="string"?o:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let c of i)if(c[0]==="-")t.skips.push(c.slice(1));else t.names.push(c)}function u(o,i){let c=0,a=0,y=-1,f=0;while(c<o.length)if(a<i.length&&(i[a]===o[c]||i[a]==="*"))if(i[a]==="*")y=a,f=c,a++;else c++,a++;else if(y!==-1)a=y+1,f++,c=f;else return!1;while(a<i.length&&i[a]==="*")a++;return a===i.length}function l(){let o=[...t.names,...t.skips.map((i)=>"-"+i)].join(",");return t.enable(""),o}function _(o){for(let i of t.skips)if(u(o,i))return!1;for(let i of t.names)if(u(o,i))return!0;return!1}function v(o){if(o instanceof Error)return o.stack||o.message;return o}function N(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}ee.exports=Oe});var te=w(function(G,L){G.formatArgs=Pe;G.save=je;G.load=Ae;G.useColors=Se;G.storage=Ee();G.destroy=(()=>{let e=!1;return()=>{if(!e)e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();G.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Se(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Pe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+L.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(s)=>{if(s==="%%")return;if(t++,s==="%c")n=t}),e.splice(n,0,r)}G.log=console.debug||console.log||(()=>{});function je(e){try{if(e)G.storage.setItem("debug",e);else G.storage.removeItem("debug")}catch(r){}}function Ae(){let e;try{e=G.storage.getItem("debug")||G.storage.getItem("DEBUG")}catch(r){}if(!e&&typeof process<"u"&&"env"in process)e=process.env.DEBUG;return e}function Ee(){try{return localStorage}catch(e){}}L.exports=z()(G);var{formatters:Ie}=L.exports;Ie.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var se=w(function(J,H){var Le=V("tty"),T=V("util");J.init=Je;J.log=Ue;J.formatArgs=He;J.save=ze;J.load=Ge;J.useColors=Te;J.destroy=T.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");J.colors=[6,2,3,4,5,1];try{let e=(()=>{throw new Error("Cannot require module "+"supports-color");})();if(e&&(e.stderr||e).level>=2)J.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(e){}J.inspectOpts=Object.keys(process.env).filter((e)=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(s,u)=>u.toUpperCase()),n=process.env[r];if(/^(yes|on|true|enabled)$/i.test(n))n=!0;else if(/^(no|off|false|disabled)$/i.test(n))n=!1;else if(n==="null")n=null;else n=Number(n);return e[t]=n,e},{});function Te(){return"colors"in J.inspectOpts?Boolean(J.inspectOpts.colors):Le.isatty(process.stderr.fd)}function He(e){let{namespace:r,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${s};1m${r} \x1B[0m`;e[0]=u+e[0].split(`
|
|
3
|
+
`).join(`
|
|
4
|
+
`+u),e.push(s+"m+"+H.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Re()+r+" "+e[0]}function Re(){if(J.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function Ue(...e){return process.stderr.write(T.formatWithOptions(J.inspectOpts,...e)+`
|
|
5
|
+
`)}function ze(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function Ge(){return process.env.DEBUG}function Je(e){e.inspectOpts={};let r=Object.keys(J.inspectOpts);for(let t=0;t<r.length;t++)e.inspectOpts[r[t]]=J.inspectOpts[r[t]]}H.exports=z()(J);var{formatters:re}=H.exports;re.o=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts).split(`
|
|
6
|
+
`).map((r)=>r.trim()).join(" ")};re.O=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts)}});var Z=w(function(St,W){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)W.exports=te();else W.exports=se()});var ce=w(function(p){var et=p&&p.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),tt=p&&p.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),oe=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))et(r,e,t)}return tt(r,e),r};Object.defineProperty(p,"__esModule",{value:!0});p.req=p.json=p.toBuffer=void 0;var rt=oe(V("http")),nt=oe(V("https"));async function ie(e){let r=0,t=[];for await(let n of e)r+=n.length,t.push(n);return Buffer.concat(t,r)}p.toBuffer=ie;async function st(e){let t=(await ie(e)).toString("utf8");try{return JSON.parse(t)}catch(n){let s=n;throw s.message+=` (input: ${t})`,s}}p.json=st;function ot(e,r={}){let n=((typeof e==="string"?e:e.href).startsWith("https:")?nt:rt).request(e,r),s=new Promise((u,l)=>{n.once("response",u).once("error",l).end()});return n.then=s.then.bind(s),n}p.req=ot});var de=w(function(h){var ae=h&&h.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),it=h&&h.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),fe=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))ae(r,e,t)}return it(r,e),r},ct=h&&h.__exportStar||function(e,r){for(var t in e)if(t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t))ae(r,e,t)};Object.defineProperty(h,"__esModule",{value:!0});h.Agent=void 0;var ut=fe(V("net")),ue=fe(V("http")),at=V("https");ct(ce(),h);var b=Symbol("AgentBaseInternalState");class le extends ue.Agent{constructor(e){super(e);this[b]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==="boolean")return e.secureEndpoint;if(typeof e.protocol==="string")return e.protocol==="https:"}let{stack:r}=Error();if(typeof r!=="string")return!1;return r.split(`
|
|
7
|
+
`).some((t)=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[e])this.sockets[e]=[];let r=new ut.Socket({writable:!1});return this.sockets[e].push(r),this.totalSocketCount++,r}decrementSockets(e,r){if(!this.sockets[e]||r===null)return;let t=this.sockets[e],n=t.indexOf(r);if(n!==-1){if(t.splice(n,1),this.totalSocketCount--,t.length===0)delete this.sockets[e]}}getName(e){if(this.isSecureEndpoint(e))return at.Agent.prototype.getName.call(this,e);return super.getName(e)}createSocket(e,r,t){let n={...r,secureEndpoint:this.isSecureEndpoint(r)},s=this.getName(n),u=this.incrementSockets(s);Promise.resolve().then(()=>this.connect(e,n)).then((l)=>{if(this.decrementSockets(s,u),l instanceof ue.Agent)try{return l.addRequest(e,n)}catch(_){return t(_)}this[b].currentSocket=l,super.createSocket(e,r,t)},(l)=>{this.decrementSockets(s,u),t(l)})}createConnection(){let e=this[b].currentSocket;if(this[b].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[b].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){if(this[b])this[b].defaultPort=e}get protocol(){return this[b].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){if(this[b])this[b].protocol=e}}h.Agent=le});var pe=w(function(M){var ft=M&&M.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(M,"__esModule",{value:!0});M.parseProxyResponse=void 0;var lt=ft(Z()),R=(0,lt.default)("https-proxy-agent:parse-proxy-response");function dt(e){return new Promise((r,t)=>{let n=0,s=[];function u(){let o=e.read();if(o)N(o);else e.once("readable",u)}function l(){e.removeListener("end",_),e.removeListener("error",v),e.removeListener("readable",u)}function _(){l(),R("onend"),t(Error("Proxy connection ended before receiving CONNECT response"))}function v(o){l(),R("onerror %o",o),t(o)}function N(o){s.push(o),n+=o.length;let i=Buffer.concat(s,n),c=i.indexOf(`\r
|
|
8
|
+
\r
|
|
9
|
+
`);if(c===-1){R("have not received end of HTTP headers yet..."),u();return}let a=i.slice(0,c).toString("ascii").split(`\r
|
|
10
|
+
`),y=a.shift();if(!y)return e.destroy(),t(Error("No header received from proxy CONNECT response"));let f=y.split(" "),d=+f[1],m=f.slice(2).join(" "),g={};for(let x of a){if(!x)continue;let F=x.indexOf(":");if(F===-1)return e.destroy(),t(Error(`Invalid header from proxy CONNECT response: "${x}"`));let D=x.slice(0,F).toLowerCase(),O=x.slice(F+1).trimStart(),j=g[D];if(typeof j==="string")g[D]=[j,O];else if(Array.isArray(j))j.push(O);else g[D]=O}R("got proxy server response: %o %o",y,g),l(),r({connect:{statusCode:d,statusText:m,headers:g},buffered:i})}e.on("error",v),e.on("end",_),u()})}M.parseProxyResponse=dt});var vt=w(function(C){var pt=C&&C.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var s=Object.getOwnPropertyDescriptor(r,t);if(!s||("get"in s?!r.__esModule:s.writable||s.configurable))s={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,s)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),ht=C&&C.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),ge=C&&C.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))pt(r,e,t)}return ht(r,e),r},be=C&&C.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0});C.HttpsProxyAgent=void 0;var U=ge(V("net")),he=ge(V("tls")),Ct=be(V("assert")),yt=be(Z()),gt=de(),bt=V("url"),mt=pe(),B=(0,yt.default)("https-proxy-agent"),Ce=(e)=>{if(e.servername===void 0&&e.host&&!U.isIP(e.host))return{...e,servername:e.host};return e};class K extends gt.Agent{constructor(e,r){super(r);this.options={path:void 0},this.proxy=typeof e==="string"?new bt.URL(e):e,this.proxyHeaders=r?.headers??{},B("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let t=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?ye(r,"headers"):null,host:t,port:n}}async connect(e,r){let{proxy:t}=this;if(!r.host)throw TypeError('No "host" provided');let n;if(t.protocol==="https:")B("Creating `tls.Socket`: %o",this.connectOpts),n=he.connect(Ce(this.connectOpts));else B("Creating `net.Socket`: %o",this.connectOpts),n=U.connect(this.connectOpts);let s=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},u=U.isIPv6(r.host)?`[${r.host}]`:r.host,l=`CONNECT ${u}:${r.port} HTTP/1.1\r
|
|
11
|
+
`;if(t.username||t.password){let i=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(i).toString("base64")}`}if(s.Host=`${u}:${r.port}`,!s["Proxy-Connection"])s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let i of Object.keys(s))l+=`${i}: ${s[i]}\r
|
|
12
|
+
`;let _=mt.parseProxyResponse(n);n.write(`${l}\r
|
|
13
|
+
`);let{connect:v,buffered:N}=await _;if(e.emit("proxyConnect",v),this.emit("proxyConnect",v,e),v.statusCode===200){if(e.once("socket",_t),r.secureEndpoint)return B("Upgrading socket connection to TLS"),he.connect({...ye(Ce(r),"host","path","port"),socket:n});return n}n.destroy();let o=new U.Socket({writable:!1});return o.readable=!0,e.once("socket",(i)=>{B("Replaying proxy buffer for failed request"),(0,Ct.default)(i.listenerCount("data")>0),i.push(N),i.push(null)}),o}}K.protocols=["http","https"];C.HttpsProxyAgent=K;function _t(e){e.resume()}function ye(e,...r){let t={},n;for(n in e)if(!r.includes(n))t[n]=e[n];return t}});export default vt();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Jr}from"./chunk-jw4g9628.js";import{dr}from"./chunk-8rekh4h9.js";import{pn,qi}from"./chunk-3fjgf7eb.js";import{Tc,dl,Jt}from"./chunk-q7t5zs7n.js";class g extends Error{code;diagnosticDetails;constructor(r,t,n){super(r);this.name="PiMessagesResponseError",this.code=t,this.diagnosticDetails=n}}function x(r){try{let t=JSON.parse(r),n=t?.error;return t&&typeof n==="object"&&n!==null&&!Array.isArray(n)?t:void 0}catch{return}}function m(r){return r.length>8192?`${r.slice(0,8192)}\u2026`:r}function y(r,t,n){let e=typeof n?.error?.message==="string"?n.error.message:void 0,s=typeof n?.error?.code==="string"?n.error.code:void 0,a=e??t,o=s?` (${s})`:"";return`${r.status} ${r.statusText}: ${a}${o}`}function w(r,t,n,e){let s=x(e),a=typeof s?.error?.code==="string"?s.error.code:void 0;return new g(y(n,e,s),a,{version:1,provider:r.provider,model:r.id,url:t.toString(),status:n.status,statusText:n.statusText,error:s?.error,body:s?void 0:m(e),timestampMs:Date.now()})}function h(){return{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}function l(r,t){if(!t)return;dl(r,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}function b(r){let t={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:"stop",timestamp:Date.now()},n=new Map;return(e)=>{switch(e.type){case"done":return Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),l(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":return Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),l(t,e.rewrite),{type:"error",reason:e.reason,error:t};case"start":break;case"text_start":t.content[e.contentIndex]={type:"text",text:""};break;case"text_delta":t.content[e.contentIndex].text+=e.delta;break;case"text_end":Object.assign(t.content[e.contentIndex],{text:e.content,textSignature:e.contentSignature});break;case"thinking_start":t.content[e.contentIndex]={type:"thinking",thinking:""};break;case"thinking_delta":t.content[e.contentIndex].thinking+=e.delta;break;case"thinking_end":Object.assign(t.content[e.contentIndex],{thinking:e.content,thinkingSignature:e.contentSignature,redacted:e.redacted});break;case"toolcall_start":t.content[e.contentIndex]={type:"toolCall",id:e.id,name:e.toolName,arguments:{}},n.set(e.contentIndex,"");break;case"toolcall_delta":{let s=`${n.get(e.contentIndex)??""}${e.delta}`;n.set(e.contentIndex,s),t.content[e.contentIndex].arguments=Jr(s);break}case"toolcall_end":return Object.assign(t.content[e.contentIndex],e.toolCall),n.delete(e.contentIndex),{type:"toolcall_end",contentIndex:e.contentIndex,toolCall:t.content[e.contentIndex],partial:t}}return{...e,partial:t}}}async function*I(r){let t=new TextDecoder,n=r.getReader(),e="";try{while(!0){let{done:s,value:a}=await n.read();e+=s?t.decode():t.decode(a,{stream:!0}),e=e.replace(/\r\n/g,`
|
|
3
3
|
`);let o=e.indexOf(`
|
|
4
4
|
|
|
5
5
|
`);while(o!==-1){let c=f(e.slice(0,o));if(c)yield c;e=e.slice(o+2),o=e.indexOf(`
|
|
6
6
|
|
|
7
7
|
`)}if(s)break}if(e.trim()){let s=f(e);if(s)yield s}}finally{n.releaseLock()}}function f(r){let t=r.split(`
|
|
8
|
-
`).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function k(r,t,n){let e=n?"aborted":"error",s={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};if(!n&&t instanceof g)
|
|
8
|
+
`).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function k(r,t,n){let e=n?"aborted":"error",s={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};if(!n&&t instanceof g)dl(s,Tc("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return dr("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var R=(r,t,n)=>{let e=new Jt,s=b(r);return(async()=>{try{let a=n?.apiKey;if(!a)throw Error(`No API key provided for provider "${r.provider}"`);let o=new URL(`${r.baseUrl.replace(/\/+$/u,"")}/messages`);if(n?.debug)o.searchParams.set("debug","1");let c={model:r.id,context:t,options:{temperature:n?.temperature,maxTokens:n?.maxTokens,reasoning:n?.reasoning,cacheRetention:E(n?.cacheRetention,n?.env),sessionId:n?.sessionId,toolChoice:n?.toolChoice}},p=await n?.onPayload?.(c,r);if(p!==void 0)c=p;let i=await fetch(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...qi(n?.headers)},body:JSON.stringify(c),signal:n?.signal});if(await n?.onResponse?.({status:i.status,headers:pn(i.headers)},r),!i.ok){let d=await i.text();throw w(r,o,i,d)}if(!i.body)throw Error(`${r.provider} response has no body`);for await(let d of I(i.body)){let u=s(d);if(e.push(u),u.type==="done"||u.type==="error")return}throw Error(`${r.provider} stream ended without a terminal event`)}catch(a){e.push(k(r,a,n?.signal?.aborted??!1))}})(),e},P=(r,t,n)=>{let e=n;return R(r,t,{...n,reasoning:n?.reasoning,toolChoice:e?.toolChoice,debug:e?.debug})};export{g as PiMessagesResponseError,R as stream,P as streamSimple};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bn}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{Bn}from"./chunk-maw5ah8t.js";var r=/"/g,n=/[\\'"]/g;class cl extends Bn{visitOrAction(e){this.append("or "),this.append(e.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(r,'""')}sanitizeJSONPathMemberValue(e){return e.replace(n,(t)=>t==="\\"?"\\\\":t==="'"?"''":"\\\"")}visitDefaultInsertValue(e){this.append("null")}}class ci{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}class ul extends ci{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(e,t){}async releaseMigrationLock(e,t){}}
|
|
3
|
+
export{ci,cl,ul};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{De,mr}from"./chunk-nyjwdxyj.js";import{Bn,Xr,Cn}from"./chunk-maw5ah8t.js";var n=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}get supportsOutput(){return!0}},s=class{#e;#t=new o;#r;#a;constructor(e){this.#e={...e}}async init(){if(this.#r=this.#e.database,this.#a=new i(this.#r),this.#e.onCreateConnection)await this.#e.onCreateConnection(this.#a)}async acquireConnection(){return await this.#t.lock(),this.#a}async beginTransaction(e){await e.executeQuery(mr.raw("begin"))}async commitTransaction(e){await e.executeQuery(mr.raw("commit"))}async rollbackTransaction(e){await e.executeQuery(mr.raw("rollback"))}async releaseConnection(){this.#t.unlock()}async destroy(){this.#r?.close()}},i=class{#e;constructor(e){this.#e=e}executeQuery(e){let{sql:r,parameters:a}=e,t=this.#e.prepare(r).all(...a);return Promise.resolve({rows:t})}async*streamQuery(){throw Error("Streaming query is not supported by SQLite driver.")}},o=class{#e;#t;async lock(){while(this.#e!==void 0)await this.#e;this.#e=new Promise((e)=>{this.#t=e})}unlock(){let e=this.#t;this.#e=void 0,this.#t=void 0,e?.()}},c=class{#e;constructor(e){this.#e=e}async getSchemas(){return[]}async getTables(e={withInternalKyselyTables:!1}){let r=this.#e.selectFrom("sqlite_schema").where("type","=","table").where("name","not like","sqlite_%").select("name").$castTo();if(!e.withInternalKyselyTables)r=r.where("name","!=",Xr).where("name","!=",Cn);let a=await r.execute();return Promise.all(a.map(({name:t})=>this.#t(t)))}async getMetadata(e){return{tables:await this.getTables(e)}}async#t(e){let r=this.#e,a=(await r.selectFrom("sqlite_master").where("name","=",e).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((t)=>t.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g,"");return{name:e,columns:(await r.selectFrom(De`pragma_table_info(${e})`.as("table_info")).select(["name","type","notnull","dflt_value"]).execute()).map((t)=>({name:t.name,dataType:t.type,isNullable:!t.notnull,isAutoIncrementing:t.name===a,hasDefaultValue:t.dflt_value!=null})),isView:!0}}},l=class extends Bn{getCurrentParameterPlaceholder(){return"?"}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}},m=class{#e;constructor(e){this.#e={...e}}createDriver(){return new s(this.#e)}createQueryCompiler(){return new l}createAdapter(){return new n}createIntrospector(e){return new c(e)}};export{m as NodeSqliteDialect};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{I}from"./chunk-vvr8tnse.js";var a=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],dn=I("sparkles",a);
|
|
2
|
+
export{dn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I}from"./chunk-
|
|
1
|
+
import{I}from"./chunk-vvr8tnse.js";var e=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ko=I("terminal",e);
|
|
2
2
|
export{ko};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I}from"./chunk-
|
|
1
|
+
import{I}from"./chunk-vvr8tnse.js";var a=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ua=I("save",a);
|
|
2
2
|
export{ua};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{mf,On,gc,Ac,_c,yc,Su,Eu,bm,zA,ks,Ho,qr}from"./chunk-2rq3w8sg.js";export{_c as EncryptJWT,Ac as SignJWT,bm as UnsecuredJWT,mf as base64url,yc as calculateJwkThumbprint,Su as createLocalJWKSet,Eu as createRemoteJWKSet,qr as decodeJwt,Ho as decodeProtectedHeader,ks as importJWK,zA as importPKCS8,gc as jwtDecrypt,On as jwtVerify};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{H,w}from"./chunk-
|
|
2
|
+
import{H,w}from"./chunk-tjavzarz.js";var E=w(function(M){Object.defineProperty(M,"__esModule",{value:!0});M.Allow=M.ALL=M.COLLECTION=M.ATOM=M.SPECIAL=M.INF=M._INFINITY=M.INFINITY=M.NAN=M.BOOL=M.NULL=M.OBJ=M.ARR=M.NUM=M.STR=void 0;M.STR=1;M.NUM=2;M.ARR=4;M.OBJ=8;M.NULL=16;M.BOOL=32;M.NAN=64;M.INFINITY=128;M._INFINITY=256;M.INF=M.INFINITY|M._INFINITY;M.SPECIAL=M.NULL|M.BOOL|M.INF|M.NAN;M.ATOM=M.STR|M.NUM|M.SPECIAL;M.COLLECTION=M.ARR|M.OBJ;M.ALL=M.ATOM|M.COLLECTION;M.Allow={STR:M.STR,NUM:M.NUM,ARR:M.ARR,OBJ:M.OBJ,NULL:M.NULL,BOOL:M.BOOL,NAN:M.NAN,INFINITY:M.INFINITY,_INFINITY:M._INFINITY,INF:M.INF,SPECIAL:M.SPECIAL,ATOM:M.ATOM,COLLECTION:M.COLLECTION,ALL:M.ALL};M.default=M.Allow});var Y=w(function(n){var z=n&&n.__createBinding||(Object.create?function(t,r,s,e){if(e===void 0)e=s;var i=Object.getOwnPropertyDescriptor(r,s);if(!i||("get"in i?!r.__esModule:i.writable||i.configurable))i={enumerable:!0,get:function(){return r[s]}};Object.defineProperty(t,e,i)}:function(t,r,s,e){if(e===void 0)e=s;t[e]=r[s]}),G=n&&n.__exportStar||function(t,r){for(var s in t)if(s!=="default"&&!Object.prototype.hasOwnProperty.call(r,s))z(r,t,s)};Object.defineProperty(n,"__esModule",{value:!0});n.Allow=n.MalformedJSON=n.PartialJSON=n.parseJSON=n.parse=void 0;var u=E();Object.defineProperty(n,"Allow",{enumerable:!0,get:function(){return u.Allow}});G(E(),n);class R extends Error{}n.PartialJSON=R;class B extends Error{}n.MalformedJSON=B;function m(t,r=u.Allow.ALL){if(typeof t!=="string")throw TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw Error(`${t} is empty`);return K(t.trim(),r)}n.parseJSON=m;var K=(t,r)=>{let s=t.length,e=0,i=(o)=>{throw new R(`${o} at position ${e}`)},a=(o)=>{throw new B(`${o} at position ${e}`)},f=()=>{if(N(),e>=s)i("Unexpected end of input");if(t[e]==='"')return P();if(t[e]==="{")return W();if(t[e]==="[")return D();if(t.substring(e,e+4)==="null"||u.Allow.NULL&r&&s-e<4&&"null".startsWith(t.substring(e)))return e+=4,null;if(t.substring(e,e+4)==="true"||u.Allow.BOOL&r&&s-e<4&&"true".startsWith(t.substring(e)))return e+=4,!0;if(t.substring(e,e+5)==="false"||u.Allow.BOOL&r&&s-e<5&&"false".startsWith(t.substring(e)))return e+=5,!1;if(t.substring(e,e+8)==="Infinity"||u.Allow.INFINITY&r&&s-e<8&&"Infinity".startsWith(t.substring(e)))return e+=8,1/0;if(t.substring(e,e+9)==="-Infinity"||u.Allow._INFINITY&r&&1<s-e&&s-e<9&&"-Infinity".startsWith(t.substring(e)))return e+=9,-1/0;if(t.substring(e,e+3)==="NaN"||u.Allow.NAN&r&&s-e<3&&"NaN".startsWith(t.substring(e)))return e+=3,NaN;return q()},P=()=>{let o=e,c=!1;e++;while(e<s&&(t[e]!=='"'||c&&t[e-1]==="\\"))c=t[e]==="\\"?!c:!1,e++;if(t.charAt(e)=='"')try{return JSON.parse(t.substring(o,++e-Number(c)))}catch(p){a(String(p))}else if(u.Allow.STR&r)try{return JSON.parse(t.substring(o,e-Number(c))+'"')}catch(p){return JSON.parse(t.substring(o,t.lastIndexOf("\\"))+'"')}i("Unterminated string literal")},W=()=>{e++,N();let o={};try{while(t[e]!=="}"){if(N(),e>=s&&u.Allow.OBJ&r)return o;let c=P();N(),e++;try{let p=f();o[c]=p}catch(p){if(u.Allow.OBJ&r)return o;else throw p}if(N(),t[e]===",")e++}}catch(c){if(u.Allow.OBJ&r)return o;else i("Expected '}' at end of object")}return e++,o},D=()=>{e++;let o=[];try{while(t[e]!=="]")if(o.push(f()),N(),t[e]===",")e++}catch(c){if(u.Allow.ARR&r)return o;i("Expected ']' at end of array")}return e++,o},q=()=>{if(e===0){if(t==="-")a("Not sure what '-' is");try{return JSON.parse(t)}catch(c){if(u.Allow.NUM&r)try{return JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch(p){}a(String(c))}}let o=e;if(t[e]==="-")e++;while(t[e]&&",]}".indexOf(t[e])===-1)e++;if(e==s&&!(u.Allow.NUM&r))i("Unterminated number literal");try{return JSON.parse(t.substring(o,e))}catch(c){if(t.substring(o,e)==="-")i("Not sure what '-' is");try{return JSON.parse(t.substring(o,t.lastIndexOf("e")))}catch(p){a(String(p))}}},N=()=>{while(e<s&&`
|
|
3
3
|
\r `.includes(t[e]))e++};return f()},Q=m;n.parse=Q});var F=H(Y(),1),X=new Set(['"',"\\","/","b","f","n","r","t","u"]);function Z(t){let r=t.codePointAt(0);return r!==void 0&&r>=0&&r<=31}function S(t){switch(t){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
4
|
-
`:return"\\n";case"\r":return"\\r";case"\t":return"\\t";default:return`\\u${t.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function v(t){let r="",s=!1;for(let e=0;e<t.length;e++){let i=t[e];if(!s){if(r+=i,i==='"')s=!0;continue}if(i==='"'){r+=i,s=!1;continue}if(i==="\\"){let a=t[e+1];if(a===void 0){r+="\\\\";continue}if(a==="u"){let f=t.slice(e+2,e+6);if(/^[0-9a-fA-F]{4}$/.test(f)){r+=`\\u${f}`,e+=5;continue}}if(X.has(a)){r+=`\\${a}`,e+=1;continue}r+="\\\\";continue}r+=Z(i)?S(i):i}return r}function
|
|
5
|
-
export{
|
|
4
|
+
`:return"\\n";case"\r":return"\\r";case"\t":return"\\t";default:return`\\u${t.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function v(t){let r="",s=!1;for(let e=0;e<t.length;e++){let i=t[e];if(!s){if(r+=i,i==='"')s=!0;continue}if(i==='"'){r+=i,s=!1;continue}if(i==="\\"){let a=t[e+1];if(a===void 0){r+="\\\\";continue}if(a==="u"){let f=t.slice(e+2,e+6);if(/^[0-9a-fA-F]{4}$/.test(f)){r+=`\\u${f}`,e+=5;continue}}if(X.has(a)){r+=`\\${a}`,e+=1;continue}r+="\\\\";continue}r+=Z(i)?S(i):i}return r}function ff(t){try{return JSON.parse(t)}catch(r){let s=v(t);if(s!==t)return JSON.parse(s);throw r}}function Jr(t){if(!t||t.trim()==="")return{};try{return ff(t)}catch{try{return F.parse(t)??{}}catch{try{return F.parse(v(t))??{}}catch{return{}}}}}
|
|
5
|
+
export{ff,Jr};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m,D,u,S,L,t,o,V,Z,B,mt,ze,A,I,or,O,Kr,Tt,jn,on,Et,ka,rr,js,xo,de,So,we,Ne,E,C,Ce,Ie,Te,ge,Ae,_e,K,Ym,nh,De,B_,$_,Uc,by,vy,Ff,ct,Qy,Ky,sb,ib,gd,gb,bh,Mn,$v,Gv,Vv,Qv,Kv,Wv,Yv,xd,zw,Wx,dg,yS,RS,Eg,Vg,Gs,zd,Op,jd,hA,qp,NT,DT,gA,AA,_A,yA,bA,Hd,vA,UT,_s,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,ce,es,Dr,yn,Vn,bs,Or,Qd,Nt,M,xe,Ar,Qe,zr,wi,LA,io,tm,aa,la,Si,W,Me,Le,Ze,Be,Ue,ne,Ei,Xd,ef,tf,nf}from"./chunk-42hrvk6k.js";import{$a}from"./chunk-r249n1xe.js";import{Kn,co}from"./chunk-8tzfcqtb.js";import{fn}from"./chunk-grjek810.js";S();var Ye=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ye=I("pen",Ye);function Se({scope:e,onScopeChange:r,selectedGoal:v,onClearGoal:f,onCreateTask:w,canCreateTask:h=!0}){return o("header",{className:"h-14 border-b border-border bg-card/60 backdrop-blur-sm px-4 flex items-center justify-between gap-3 shrink-0 select-none",children:[o("div",{className:"flex items-center gap-3 min-w-0",children:[o("div",{className:"flex items-center bg-muted/60 p-0.5 rounded-lg border border-border/50",children:[o(C,{variant:e==="team"?"secondary":"ghost",size:"sm",onClick:()=>r("team"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="team"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[t(co,{className:"w-3.5 h-3.5"}),t("span",{children:UT()})]}),o(C,{variant:e==="my"?"secondary":"ghost",size:"sm",onClick:()=>r("my"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="my"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[t(Kn,{className:"w-3.5 h-3.5"}),t("span",{children:Wx()})]})]}),v&&o("div",{className:"hidden sm:flex items-center gap-1.5 px-2 py-1 rounded-md bg-sidebar-accent border border-sidebar-border text-xs text-sidebar-accent-foreground min-w-0 max-w-[200px] md:max-w-[280px]",children:[t(So,{className:"w-3.5 h-3.5 text-sidebar-primary shrink-0"}),t("span",{className:"truncate font-medium",children:v.id===wi?_s():v.title}),t(C,{variant:"ghost",size:"icon-xs",onClick:f,className:"h-4 w-4 p-0 ml-0.5 text-muted-foreground hover:text-foreground",title:$_(),children:t(Ne,{className:"w-3 h-3"})})]})]}),h&&t("div",{className:"flex items-center gap-2 shrink-0",children:o(C,{size:"sm",onClick:w,className:"h-8 px-3 text-xs gap-1.5 shadow-xs",children:[t(de,{className:"w-3.5 h-3.5"}),t("span",{children:Ff()})]})})]})}S();S();function fe({teamId:e,isOpen:r,onClose:v,goalToEdit:f}){let w=V(),[h,_]=u(""),[b,P]=u("");m(()=>{if(f)_(f.title),P(f.description||"");else _(""),P("")},[f,r]);let{mutate:G,isPending:q}=B({mutationFn:async()=>{let n=await A.api.teams[":teamId"].kanban.goals.$post({param:{teamId:e},json:{title:h.trim(),description:b.trim()||void 0}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success($v()),v()},onError:(n)=>{M.error(n.message)}}),{mutate:Q,isPending:F}=B({mutationFn:async()=>{if(!f)return;let n=await A.api.teams[":teamId"].kanban.goals[":goalId"].$patch({param:{teamId:e,goalId:f.id},json:{title:h.trim(),description:b.trim()||null}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(Yv()),v()},onError:(n)=>{M.error(n.message)}}),H=(n)=>{if(n.preventDefault(),!h.trim())return;if(f)Q();else G()},d=q||F;return t(ue,{open:r,onOpenChange:(n)=>!n&&v(),children:t(ae,{className:"sm:max-w-xl",children:o("form",{onSubmit:H,className:"space-y-4",children:[o(pe,{children:[t(le,{children:f?bh():vy()}),t(Mt,{children:f?bh():by()})]}),o("div",{className:"space-y-3 py-2",children:[o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"goal-title",children:Kv()}),t(z,{id:"goal-title",value:h,onChange:(n)=>_(n.target.value),placeholder:Wv(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"goal-description",children:Vv()}),t(Si,{id:"goal-description",value:b,onChange:(n)=>P(n.target.value),placeholder:Qv(),rows:3})]})]}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:v,disabled:d,children:De()}),o(C,{type:"submit",disabled:!h.trim()||d,children:[d&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),f?Gs():Uc()]})]})]})})})}function Ke({teamId:e,selectedGoalId:r,onSelectGoal:v,isOwnerOrEditor:f=!0}){let w=V(),[h,_]=u(!1),[b,P]=u(null),[G,q]=u(null),[Q,F]=u(!1),{data:H,isLoading:d}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let i=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!i.ok)throw Error("Failed to fetch goals");return await i.json()},enabled:!!e}),n=H?.data||[],x=n.reduce((i,s)=>i+(s.taskCount||0),0),{mutate:N,isPending:l}=B({mutationFn:async(i)=>{let s=await A.api.teams[":teamId"].kanban.goals[":goalId"].$delete({param:{teamId:e,goalId:i}});if(!s.ok){let p=await s.json().catch(()=>({message:Mn()}));throw Error(p.message||Mn())}return await s.json()},onSuccess:(i,s)=>{if(w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),M.success(Gv()),r===s)v(null);q(null)},onError:(i)=>{M.error(i.message)}});if(Q)return o("div",{className:"border-r border-sidebar-border bg-sidebar flex flex-col items-center w-12 shrink-0 transition-all duration-300",children:[t("div",{className:"h-14 flex items-center justify-center border-b border-sidebar-border w-full shrink-0",children:t(C,{variant:"ghost",size:"icon-sm",onClick:()=>F(!1),title:xd(),className:"text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(Et,{className:"w-4 h-4"})})}),o("div",{className:"mt-3 flex flex-col items-center gap-2",children:[t(C,{variant:r===null?"secondary":"ghost",size:"icon-sm",onClick:()=>v(null),title:Ym(),className:E("w-8 h-8 rounded-md",r===null&&"bg-sidebar-accent text-sidebar-accent-foreground"),children:t($a,{className:"w-4 h-4"})}),t(C,{variant:"ghost",size:"icon-sm",onClick:()=>_(!0),title:dg(),className:"w-8 h-8 rounded-md text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(de,{className:"w-4 h-4"})})]}),h&&t(fe,{teamId:e,isOpen:h,onClose:()=>_(!1)})]});return o("aside",{className:"w-64 border-r border-sidebar-border bg-sidebar flex flex-col shrink-0 transition-all duration-300 select-none",children:[o("div",{className:"h-14 px-3 flex items-center justify-between border-b border-sidebar-border shrink-0",children:[o("div",{className:"flex items-center gap-2 font-semibold text-xs tracking-wider uppercase text-sidebar-foreground/70",children:[t(So,{className:"w-4 h-4 text-sidebar-primary"}),t("span",{children:xd()})]}),o("div",{className:"flex items-center gap-1",children:[f&&t(C,{variant:"ghost",size:"icon-sm",onClick:()=>_(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:dg(),children:t(de,{className:"w-4 h-4"})}),t(C,{variant:"ghost",size:"icon-sm",onClick:()=>F(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"Collapse",children:t(on,{className:"w-4 h-4"})})]})]}),t(ce,{className:"flex-1 p-2",children:o("div",{className:"space-y-1",children:[o("div",{onClick:()=>v(null),className:E("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group h-8 min-h-[32px]",r===null?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[o("div",{className:"flex items-center gap-2 truncate min-w-0",children:[t($a,{className:"w-3.5 h-3.5 shrink-0 text-sidebar-primary"}),t("span",{className:"truncate",children:Ym()})]}),x>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 shrink-0",children:x})]}),d?t("div",{className:"flex items-center justify-center p-4",children:t(O,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):n.length===0?t("div",{className:"px-2.5 py-4 text-center text-xs text-muted-foreground",children:yS()}):n.map((i)=>{let s=r===i.id,p=i.id===wi,k=p?_s():i.title,g=f&&!p;return o("div",{onClick:()=>v(i.id),className:E("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group relative min-h-[32px]",s?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[o("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t(So,{className:E("w-3.5 h-3.5 shrink-0",s?"text-sidebar-primary":"text-muted-foreground")}),t("span",{className:"line-clamp-2 break-words leading-tight",title:k,children:k})]}),t("div",{className:"flex items-center shrink-0 ml-1",children:g?o(L,{children:[(i.taskCount??0)>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 group-hover:hidden group-focus-within:hidden [&:has(~_div_[data-state=open])]:hidden",children:i.taskCount}),t("div",{className:"hidden group-hover:flex group-focus-within:flex [&:has([data-state=open])]:flex items-center",onClick:(c)=>c.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{variant:"ghost",size:"icon-xs",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:t(or,{className:"w-3.5 h-3.5"})})}),o(_e,{align:"end",className:"w-36",children:[o(K,{onClick:()=>{P(i)},children:[t(ye,{className:"w-3.5 h-3.5 mr-2"}),gb()]}),o(K,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{q(i)},children:[t(we,{className:"w-3.5 h-3.5 mr-2"}),ct()]})]})]})})]}):(i.taskCount??0)>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60",children:i.taskCount})})]},i.id)})]})}),(h||b)&&t(fe,{teamId:e,isOpen:h||!!b,goalToEdit:b,onClose:()=>{_(!1),P(null)}}),G&&t(Xe,{open:!!G,onOpenChange:(i)=>!i&&q(null),children:o(et,{children:[o(tt,{children:[t(nt,{children:Qy()}),t(ot,{children:Ky({title:G.title})})]}),o(rt,{children:[t(it,{disabled:l,children:De()}),o(st,{onClick:()=>N(G.id),disabled:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[l&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),ct()]})]})]})})]})}S();S();function Pe(e){return+xe(e)<Date.now()}function Fe({task:e,onClick:r,onDelete:v,disabled:f,isFirst:w,isLast:h,showBottomIndicator:_,currentUserId:b,currentUserRole:P}){let{source:G}=Qd(),q=!!G,Q=P?.toLowerCase()==="owner",F=P?.toLowerCase()==="editor",H=!!b&&e.creator?.id===b,d=e.reporter?.id===b||H,n=e.assignee?.id===b,x=Q||F||d||n,N=H||Q||d,l=f||!x,{ref:i,isDragging:s}=bs({id:e.id,data:{type:"kanban_task",task:e},disabled:l}),{ref:p,isDropTarget:k}=Or({id:`reorder-before-${e.id}`,data:{type:"reorder",task:e,position:"before"},disabled:s||f}),{ref:g,isDropTarget:c}=Or({id:`reorder-after-${e.id}`,data:{type:"reorder",task:e,position:"after"},disabled:s||f}),T=e.isAgentTask,j=e.status===Qe.BLOCKED,y=e.dueDate?Pe(new Date(e.dueDate))&&e.status!==Qe.DONE:!1;return o("div",{className:"relative",children:[t("div",{ref:p,className:E("absolute left-0 right-0 z-20",w?"-top-6 h-[calc(50%+24px)]":"-top-1 h-[calc(50%+4px)]",q&&!s?"pointer-events-auto":"pointer-events-none")}),t("div",{ref:g,className:E("absolute bottom-0 left-0 right-0 z-20",h?"-bottom-6 h-[calc(50%+24px)]":"h-1/2",q&&!s?"pointer-events-auto":"pointer-events-none")}),k&&!s&&t("div",{className:"absolute -top-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),(c||_)&&!s&&t("div",{className:"absolute -bottom-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),o("div",{ref:i,onClick:()=>r(e),className:E("group relative flex flex-col gap-2 p-3 rounded-lg border text-card-foreground transition-all duration-200 cursor-pointer select-none",s&&"opacity-40 scale-95 shadow-lg ring-2 ring-primary",!s&&"hover:shadow-md","border-border/80 bg-card hover:border-primary/50 shadow-2xs",j&&"border-red-500/60 bg-red-500/[0.03] ring-1 ring-red-500/20"),children:[o("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[o("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[t("span",{className:E("px-1.5 py-0.5 rounded text-[10px] font-medium border uppercase tracking-wider shrink-0",la(e.priority)),children:aa(e.priority)}),T&&o("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[t(Tt,{className:"w-3 h-3"}),t("span",{children:Hd()})]}),e.goal&&o("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground border border-border/70 truncate max-w-[130px]",children:[t(So,{className:"w-2.5 h-2.5 shrink-0"}),t("span",{className:"truncate",children:e.goal.title})]})]}),t("div",{className:"flex items-center gap-1 shrink-0",children:N&&t("div",{className:"opacity-0 group-hover:opacity-100 [&:has([data-state=open])]:opacity-100 focus-within:opacity-100 transition-opacity flex items-center",onClick:(X)=>X.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground",children:t(or,{className:"w-3.5 h-3.5"})})}),t(_e,{align:"end",className:"w-32",children:o(K,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>v?.(e),children:[t(we,{className:"w-3.5 h-3.5 mr-2"}),ct()]})})]})})})]}),t("h4",{className:"text-xs font-semibold leading-snug line-clamp-2 text-foreground break-words",children:e.title}),j&&o("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-red-500/10 border border-red-500/20 text-[11px] text-red-600 dark:text-red-400",children:[t(Kr,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),t("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent?.blockReason||e.latestStatusEvent?.reason||e.latestStatusEvent?.summary||hA()})]}),e.status===Qe.IN_REVIEW&&e.latestStatusEvent?.summary&&o("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-purple-500/10 border border-purple-500/20 text-[11px] text-purple-600 dark:text-purple-400",children:[t(fn,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),t("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent.summary})]}),o("div",{className:"flex items-center justify-between gap-2 pt-1 mt-auto border-t border-border/40 text-[11px] text-muted-foreground",children:[t("div",{className:"flex items-center gap-1.5 min-w-0",children:e.assignee?o(L,{children:[T?t("div",{className:"w-5 h-5 rounded-full bg-orange-500/15 border border-orange-500/30 flex items-center justify-center shrink-0",children:t(Tt,{className:"w-3 h-3 text-orange-600 dark:text-orange-400"})}):o(Ce,{size:"sm",className:"w-5 h-5 border border-border",children:[t(Ie,{src:e.assignee.image}),t(Te,{className:"text-[9px]",children:e.assignee.name.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate text-xs font-medium text-foreground/80 max-w-[90px]",children:e.assignee.name})]}):t("span",{className:"text-[11px] italic text-muted-foreground/60",children:_s()})}),o("div",{className:"flex items-center gap-2 shrink-0",children:[e.dueDate&&o("div",{className:E("flex items-center gap-1 text-[10px] font-mono",y?"text-red-500 font-semibold":"text-muted-foreground"),title:Ar(new Date(e.dueDate),"yyyy/MM/dd HH:mm"),children:[t(jn,{className:"w-3 h-3"}),t("span",{children:Ar(new Date(e.dueDate),"MM/dd")})]}),e.assetCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:zw({count:e.assetCount}),children:[t(ka,{className:"w-3 h-3"}),t("span",{children:e.assetCount})]}),e.dependencyCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.dependencyCount} dependencies`,children:[t(js,{className:"w-3 h-3"}),t("span",{children:e.dependencyCount})]}),e.commentCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.commentCount} comments`,children:[t(xo,{className:"w-3 h-3"}),t("span",{children:e.commentCount})]})]})]})]})]})}function Ee({teamId:e,status:r,selectedGoalId:v,scope:f,currentUserId:w,currentUserRole:h,onTaskClick:_,onDeleteTask:b,onCreateTaskInColumn:P}){let G=h?.toLowerCase()==="owner"||h?.toLowerCase()==="editor",q=f==="my"?w:void 0,{data:Q,fetchNextPage:F,hasNextPage:H,isFetchingNextPage:d,isLoading:n}=mt({queryKey:["teams",e,"kanban","tasks",{status:r,goalId:v,assigneeId:q}],queryFn:async({pageParam:R=""})=>{let J=await A.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:e},query:{status:r,goalId:v||void 0,assigneeId:q||void 0,first:"20",after:R||void 0}});if(!J.ok)throw Error("Failed to fetch column tasks");return await J.json()},initialPageParam:"",getNextPageParam:(R)=>R.pageInfo?.cursor||void 0,refetchInterval:5000,enabled:!!e}),{ref:x,inView:N}=Nt({threshold:0.1});m(()=>{if(N&&H&&!d)F()},[N,H,d,F]);let l=D(()=>Q?.pages?.flatMap((R)=>Array.isArray(R?.data)?R.data:[])||[],[Q]),{source:i,target:s}=Qd(),p=l.filter((R)=>R.id!==i?.id).at(-1),{ref:k,isDropTarget:g}=Or({id:r,data:{type:"kanban_column",status:r,lastTask:p}}),c=i?.data?.type==="kanban_task",T=c&&(g||s?.data?.type==="kanban_column"&&s.data.status===r||s?.data?.type==="reorder"&&s.data.task?.status===r),j=c&&s?.data?.type==="kanban_column"&&s.data.status===r,y=Q?.pages?.[0]?.pageInfo?.total??l.length,X=tm(r);return o("div",{ref:k,className:E("flex flex-col h-full max-h-full w-80 md:w-84 shrink-0 rounded-xl bg-card/60 border border-border/70 shadow-xs transition-colors duration-200 overflow-hidden select-none",T&&"ring-2 ring-primary/60 bg-primary/[0.03] border-primary/40"),children:[o("div",{className:"h-11 px-3.5 flex items-center justify-between border-b border-border/60 bg-card/80 shrink-0",children:[o("div",{className:"flex items-center gap-2 min-w-0",children:[t("div",{className:E("w-2.5 h-2.5 rounded-full shrink-0",X.dot)}),t("h3",{className:"text-xs font-bold tracking-wide uppercase text-foreground/90 truncate",children:io(r)})]}),t("div",{className:"flex items-center gap-1 shrink-0",children:t("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-muted font-medium text-muted-foreground",children:y})})]}),t(ce,{className:"flex-1 min-h-0 [&>div>div]:block!",children:o("div",{className:"p-2.5 space-y-2.5 min-h-full flex flex-col",children:[n?t("div",{className:"flex items-center justify-center py-10",children:t(O,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):l.length===0?t("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:t("p",{className:"text-xs text-muted-foreground/70",children:RS()})}):l.map((R,J)=>t(Fe,{task:R,onClick:_,onDelete:b,isFirst:J===0,isLast:J===l.length-1,showBottomIndicator:j&&R.id===p?.id,currentUserId:w,currentUserRole:h},R.id)),t("div",{ref:x,className:"h-2"}),d&&t("div",{className:"flex justify-center py-2",children:t(O,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})}),G&&t("div",{className:"p-2 border-t border-border/50 bg-card/90 shrink-0",children:o(C,{variant:"ghost",size:"sm",onClick:()=>P(r),className:"w-full justify-center h-8 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/80 border border-dashed border-border/80",children:[t(de,{className:"w-3.5 h-3.5 mr-1.5"}),t("span",{children:Ff()})]})})]})}function Oe({teamId:e,selectedGoalId:r,scope:v,currentUserId:f,currentUserRole:w,onTaskClick:h,onCreateTaskInColumn:_}){let b=V(),[P,G]=u(null),{mutate:q,isPending:Q}=B({mutationFn:async(d)=>{let n=await A.api.teams[":teamId"].kanban.tasks[":taskId"].$delete({param:{teamId:e,taskId:d}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{b.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),b.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(DT()),G(null)},onError:(d)=>{M.error(d.message)}}),{mutate:F}=B({mutationFn:async({taskId:d,fromStatus:n,status:x,reason:N,beforeIndex:l,afterIndex:i})=>{let s=await A.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:e,taskId:d},json:{fromStatus:n,status:x,reason:N,beforeIndex:l,afterIndex:i}});if(!s.ok){let p=await s.json().catch(()=>({message:Mn()}));throw Error(p.message||Mn())}return await s.json()},onMutate:async({taskId:d,status:n,targetTaskId:x,position:N})=>{await b.cancelQueries({queryKey:["teams",e,"kanban","tasks"]});let l=b.getQueriesData({queryKey:["teams",e,"kanban","tasks"]}),i=null,s=(p)=>p[0]==="teams"&&p[1]===e&&p[2]==="kanban"&&p[3]==="tasks"&&typeof p[4]==="object"&&p[4]!==null&&("status"in p[4]);if(b.setQueriesData({predicate:(p)=>s(p.queryKey)},(p)=>{if(!p||!Array.isArray(p.pages))return p;let k=!1,g=p.pages.map((c)=>{if(!c||!Array.isArray(c.data))return c;let T=c.data.find((j)=>j.id===d);if(T)return i={...T,status:n},k=!0,{...c,data:c.data.filter((j)=>j.id!==d),pageInfo:{...c.pageInfo,total:Math.max(0,(c.pageInfo?.total??c.data.length)-1)}};return c});return k?{...p,pages:g}:p}),i){let p=i;b.setQueriesData({predicate:(k)=>{if(!s(k.queryKey))return!1;return k.queryKey[4]?.status===n}},(k)=>{if(!k||!Array.isArray(k.pages))return k;let g=k.pages.flatMap((y)=>y?.data??[]).filter((y)=>y.id!==d),c=g.length;if(x){let y=g.findIndex((X)=>X.id===x);if(y!==-1)c=N==="before"?y:y+1}g.splice(c,0,p);let T=0,j=k.pages.map((y,X)=>{let R=y?.data?y.data.length:0,J=X===0&&R===0?1:X===k.pages.length-1?g.length-T:R,te=g.slice(T,T+J);return T+=J,{...y,data:te,pageInfo:{...y?.pageInfo,total:(y?.pageInfo?.total??0)+1}}});if(T<g.length&&j.length>0){let y=j.length-1;j[y]={...j[y],data:[...j[y]?.data??[],...g.slice(T)]}}return{...k,pages:j}})}return{previousQueries:l}},onError:(d,n,x)=>{if(x?.previousQueries)for(let[N,l]of x.previousQueries)b.setQueryData(N,l);M.error(d.message)},onSettled:()=>{b.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]})}}),H=(d)=>{if(d.canceled)return;let{source:n,target:x}=d.operation;if(!n||!x)return;let N=n.data;if(N?.type!=="kanban_task"||!N.task)return;let l=N.task,i=w?.toLowerCase()==="owner",s=w?.toLowerCase()==="editor",p=l.reporter?.id===f||l.creator?.id===f,k=l.assignee?.id===f;if(!i&&!s&&!p&&!k){M.error(B_());return}let g=x.data;if(!g)return;if(g.type==="reorder"&&g.task&&g.position){let c=g.task,T=c.status;if(l.id===c.id)return;let j=g.position==="before"?c.sortIndex??void 0:void 0,y=g.position==="after"?c.sortIndex??void 0:void 0;F({taskId:l.id,fromStatus:l.status,status:T,beforeIndex:j,afterIndex:y,targetTaskId:c.id,position:g.position});return}if(g.type==="kanban_column"&&g.status){let{status:c,lastTask:T}=g;if(T){if(l.id===T.id){if(l.status===c)return;F({taskId:l.id,fromStatus:l.status,status:c});return}F({taskId:l.id,fromStatus:l.status,status:c,afterIndex:T.sortIndex??void 0,targetTaskId:T.id,position:"after"});return}if(l.status===c)return;F({taskId:l.id,fromStatus:l.status,status:c})}};return o(Vn,{sensors:[yn.configure({activationConstraints:[new Dr.Distance({value:8})]}),es],onDragEnd:H,children:[t("div",{className:"flex-1 min-h-0 overflow-x-auto overflow-y-hidden p-4 bg-background/50",children:t("div",{className:"flex gap-4 h-full min-w-max pb-2",children:LA.map((d)=>t(Ee,{teamId:e,status:d,selectedGoalId:r,scope:v,currentUserId:f,currentUserRole:w,onTaskClick:h,onDeleteTask:(n)=>G(n),onCreateTaskInColumn:_},d))})}),P&&t(Xe,{open:!!P,onOpenChange:(d)=>!d&&G(null),children:o(et,{children:[o(tt,{children:[t(nt,{children:sb()}),t(ot,{children:ib({title:P.title})})]}),o(rt,{children:[t(it,{disabled:Q,children:De()}),o(st,{onClick:()=>q(P.id),disabled:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[Q&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),ct()]})]})]})})]})}S();function Ge({teamId:e,isOpen:r,onClose:v,initialGoalId:f}){let w=V(),h=f===wi||!f?"none":f,[_,b]=u(""),[P,G]=u(""),[q,Q]=u(!1),[F,H]=u(zr.MEDIUM),[d,n]=u(h),[x,N]=u("none"),[l,i]=u("none"),[s,p]=u(void 0),[k,g]=u(void 0),[c,T]=u(null),[j,y]=u(null),[X,R]=u(null),[J,te]=u([]),[re,oe]=u([]),[be,ve]=u(!1),{data:he}=Z({queryKey:["teams",e,"me"],queryFn:async()=>{let a=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!a.ok)return null;return await a.json()},enabled:!!e&&r});m(()=>{if(r)b(""),G(""),Q(!1),H(zr.MEDIUM),n(h),N("none"),i(he?.id||"none"),p(void 0),g(void 0),T(null),y(null),R(null),te([]),oe([])},[r,h,he?.id]);let{data:ke=[]}=Z({queryKey:["teams",e,"members","human"],queryFn:async()=>{let a=await A.api.teams[":teamId"].members.$get({param:{teamId:e},query:{includeAgents:"false"}});if(!a.ok)return[];let U=await a.json();return Array.isArray(U)?U:[]},enabled:!!e&&r}),{data:$e=[]}=Z({queryKey:["teams",e,"agents"],queryFn:async()=>{let a=await A.api.teams[":teamId"].agents.$get({param:{teamId:e}});if(!a.ok)return[];return await a.json()||[]},enabled:!!e&&r}),{data:He}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let a=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!a.ok)return{data:[]};return await a.json()},enabled:!!e&&r}),Ve=He?.data||[],{mutate:Je,isPending:se}=B({mutationFn:async()=>{let a=await A.api.teams[":teamId"].kanban.tasks.$post({param:{teamId:e},json:{title:_.trim(),description:P.trim()||void 0,isAgentTask:q,priority:F,goalId:d!=="none"?d:void 0,assigneeId:x!=="none"?x:void 0,reporterId:l!=="none"?l:void 0,startDate:s?s.toISOString():void 0,dueDate:k?k.toISOString():void 0,projectId:c||void 0,targetFolderId:j||void 0,parentIds:J.length>0?J:void 0,assetIds:re.length>0?re.map((U)=>U.id):void 0}});if(!a.ok){let U=await a.text().catch(()=>""),Y=Mn();if(U)try{let me=JSON.parse(U);if(me&&typeof me.message==="string")Y=me.message}catch{Y=U}throw Error(Y)}return await a.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(NT()),v()},onError:(a)=>{M.error(a.message)}}),We=(a)=>{if(a.preventDefault(),!_.trim()||se)return;Je()},ie=q;return t(ue,{open:r,onOpenChange:(a)=>!a&&v(),children:o(ae,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",children:[o("form",{onSubmit:We,className:"space-y-4",children:[t(pe,{children:t(le,{children:Ff()})}),o("div",{className:"space-y-3.5 py-1",children:[o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"create-task-title",children:yA()}),t(z,{id:"create-task-title",value:_,onChange:(a)=>b(a.target.value),placeholder:bA(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"create-task-desc",children:gA()}),t(Si,{id:"create-task-desc",value:P,onChange:(a)=>G(a.target.value),placeholder:AA(),rows:3})]}),o("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-lg border border-border/80 bg-muted/30 p-2.5 h-14",children:[o("div",{className:"space-y-0.5 min-w-0 pr-2",children:[o(W,{htmlFor:"create-is-agent-task",className:"text-xs font-medium cursor-pointer flex items-center gap-1.5",children:[t(Tt,{className:"w-3.5 h-3.5 text-orange-500"}),t("span",{children:Hd()})]}),t("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:vA()})]}),t(Me,{id:"create-is-agent-task",checked:q,onCheckedChange:(a)=>{Q(a),N("none")}})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:_A()}),o(Le,{value:F,onValueChange:(a)=>H(a),children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{})}),t(Ue,{children:Object.values(zr).map((a)=>t(ne,{value:a,children:t("span",{className:E("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",la(a)),children:aa(a)})},a))})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:xd()}),o(Le,{value:d,onValueChange:n,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:"None"})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:"None"})}),Ve.filter((a)=>a.id!==wi).map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(So,{className:"w-3.5 h-3.5 text-primary"}),t("span",{children:a.title})]})},a.id))]})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:ie?zd():nh()}),o(Le,{value:x,onValueChange:N,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:_s()})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:_s()})}),ie?$e.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(Tt,{className:"w-3.5 h-3.5 text-purple-500"}),t("span",{children:a.name})]})},a.id)):ke.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{size:"sm",className:"w-4 h-4",children:[t(Ie,{src:a.image}),t(Te,{className:"text-[8px]",children:a.name.slice(0,2).toUpperCase()})]}),t("span",{children:a.name})]})},a.id))]})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:Vg()}),o(Le,{value:l,onValueChange:i,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:_s()})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:_s()})}),ke.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{size:"sm",className:"w-4 h-4",children:[t(Ie,{src:a.image}),t(Te,{className:"text-[8px]",children:a.name.slice(0,2).toUpperCase()})]}),t("span",{children:a.name})]})},a.id))]})]})]}),ie&&o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:qp()}),o(C,{type:"button",variant:"outline",size:"sm",onClick:()=>ve(!0),className:"w-full justify-start h-9 text-xs truncate font-normal",children:[t(rr,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),t("span",{className:"truncate",children:X||Op()})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:jd()}),t(Ei,{value:s,onChange:p,placeholder:jd(),className:"h-9 text-xs"})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:gd()}),t(Ei,{value:k,onChange:g,placeholder:gd(),className:"h-9 text-xs"})]}),o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:Eg()}),t(Xd,{teamId:e,value:J,onChange:te})]}),t("div",{className:"sm:col-span-2 pt-1",children:t(ef,{teamId:e,projectId:c,assets:re,onAddAssets:(a)=>oe((U)=>[...U,...a]),onRemoveAsset:(a)=>oe((U)=>U.filter((Y)=>Y.id!==a))})})]})]}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:v,disabled:se,children:De()}),o(C,{type:"submit",disabled:!_.trim()||se,children:[se&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),Uc()]})]})]}),be&&t(tf,{teamId:e,currentProjectId:c,currentTargetFolderId:j,isOpen:be,onClose:()=>ve(!1),onSelect:(a,U,Y)=>{T(a),y(U),R(Y||"Selected Folder")}})]})})}function je({teamId:e,initialTaskId:r}){let[v,f]=u("team"),[w,h]=u(null),[_,b]=u(r??null),[P,G]=u(!1);m(()=>{if(r)b(r)},[r]);let[q,Q]=u(Qe.TODO),{data:F,isLoading:H}=Z({queryKey:["teams",e,"me"],queryFn:async()=>{let s=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!s.ok)throw Error("Failed to fetch me");return await s.json()},enabled:!!e}),{data:d}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let s=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!s.ok)return{data:[]};return await s.json()},enabled:!!e}),n=d?.data||[],x=w?n.find((s)=>s.id===w)||null:null,N=F?.role?.toLowerCase()==="owner"||F?.role?.toLowerCase()==="editor",l=(s=Qe.TODO)=>{Q(s),G(!0)},i=(s)=>{b(s.id)};if(H)return t("div",{className:"flex h-full items-center justify-center",children:t(O,{className:"w-8 h-8 animate-spin text-muted-foreground"})});return o("div",{className:"flex flex-row h-full bg-background overflow-hidden font-sans",children:[t(Ke,{teamId:e,selectedGoalId:w,onSelectGoal:h,isOwnerOrEditor:N}),o("div",{className:"flex-1 flex flex-col min-w-0 h-full overflow-hidden",children:[t(Se,{scope:v,onScopeChange:f,selectedGoal:x,onClearGoal:()=>h(null),onCreateTask:()=>l(Qe.TODO),canCreateTask:N}),t(Oe,{teamId:e,selectedGoalId:w,scope:v,currentUserId:F?.id,currentUserRole:F?.role,onTaskClick:i,onCreateTaskInColumn:(s)=>l(s)})]}),_&&t(nf,{teamId:e,taskId:_,isOpen:!!_,onClose:()=>b(null),canEdit:N}),P&&t(Ge,{teamId:e,isOpen:P,initialStatus:q,initialGoalId:w,onClose:()=>G(!1)})]})}function at(){let{teamId:e}=Re.useParams(),{taskId:r}=Re.useSearch();return t(je,{teamId:e,initialTaskId:r})}var Re=ze("/teams/$teamId/kanban")({component:at});export{Re as Route};
|
|
1
|
+
import{m,D,u,S,L,t,o,G,Z,B,mt,Ue,A,I,rr,O,Kr,Tt,jn,nn,Et,ka,lr,qs,xo,fe,So,we,Pe,E,C,Ce,Ie,Te,ge,Ae,_e,K,eh,ih,Ne,U_,G_,jc,vy,wy,Lf,ct,Ky,Wy,ib,ab,gd,Ab,xh,Mn,Gv,Vv,Qv,Kv,Wv,Yv,Jv,xd,jw,Wx,pg,yS,RS,Ig,Kg,Vs,zd,Fp,jd,AA,Hp,PT,NT,_A,yA,bA,vA,wA,Hd,xA,BT,_s,Xe,et,tt,rt,nt,ot,st,it,de,le,me,qe,ce,Mt,z,ue,es,Dr,_n,Vn,bs,Or,Qd,Nt,M,xe,Ar,Qe,zr,xi,BA,io,rm,aa,la,Ei,W,Me,Fe,Le,Ze,Be,ne,Ci,Xd,ef,tf,nf}from"./chunk-vvr8tnse.js";import{Ga}from"./chunk-6zerk0em.js";import{Kn,co}from"./chunk-5m51b7af.js";import{dn}from"./chunk-hjwpd09v.js";S();var Ye=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ye=I("pen",Ye);function De({scope:e,onScopeChange:r,selectedGoal:v,onClearGoal:f,onCreateTask:w,canCreateTask:h=!0}){return o("header",{className:"h-14 border-b border-border bg-card/60 backdrop-blur-sm px-4 flex items-center justify-between gap-3 shrink-0 select-none",children:[o("div",{className:"flex items-center gap-3 min-w-0",children:[o("div",{className:"flex items-center bg-muted/60 p-0.5 rounded-lg border border-border/50",children:[o(C,{variant:e==="team"?"secondary":"ghost",size:"sm",onClick:()=>r("team"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="team"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[t(co,{className:"w-3.5 h-3.5"}),t("span",{children:BT()})]}),o(C,{variant:e==="my"?"secondary":"ghost",size:"sm",onClick:()=>r("my"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="my"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[t(Kn,{className:"w-3.5 h-3.5"}),t("span",{children:Wx()})]})]}),v&&o("div",{className:"hidden sm:flex items-center gap-1.5 px-2 py-1 rounded-md bg-sidebar-accent border border-sidebar-border text-xs text-sidebar-accent-foreground min-w-0 max-w-[200px] md:max-w-[280px]",children:[t(So,{className:"w-3.5 h-3.5 text-sidebar-primary shrink-0"}),t("span",{className:"truncate font-medium",children:v.id===xi?_s():v.title}),t(C,{variant:"ghost",size:"icon-xs",onClick:f,className:"h-4 w-4 p-0 ml-0.5 text-muted-foreground hover:text-foreground",title:G_(),children:t(Pe,{className:"w-3 h-3"})})]})]}),h&&t("div",{className:"flex items-center gap-2 shrink-0",children:o(C,{size:"sm",onClick:w,className:"h-8 px-3 text-xs gap-1.5 shadow-xs",children:[t(fe,{className:"w-3.5 h-3.5"}),t("span",{children:Lf()})]})})]})}S();S();function pe({teamId:e,isOpen:r,onClose:v,goalToEdit:f}){let w=G(),[h,_]=u(""),[b,P]=u("");m(()=>{if(f)_(f.title),P(f.description||"");else _(""),P("")},[f,r]);let{mutate:j,isPending:Q}=B({mutationFn:async()=>{let n=await A.api.teams[":teamId"].kanban.goals.$post({param:{teamId:e},json:{title:h.trim(),description:b.trim()||void 0}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(Gv()),v()},onError:(n)=>{M.error(n.message)}}),{mutate:R,isPending:F}=B({mutationFn:async()=>{if(!f)return;let n=await A.api.teams[":teamId"].kanban.goals[":goalId"].$patch({param:{teamId:e,goalId:f.id},json:{title:h.trim(),description:b.trim()||null}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(Jv()),v()},onError:(n)=>{M.error(n.message)}}),U=(n)=>{if(n.preventDefault(),!h.trim())return;if(f)R();else j()},d=Q||F;return t(de,{open:r,onOpenChange:(n)=>!n&&v(),children:t(le,{className:"sm:max-w-xl",children:o("form",{onSubmit:U,className:"space-y-4",children:[o(me,{children:[t(ce,{children:f?xh():wy()}),t(Mt,{children:f?xh():vy()})]}),o("div",{className:"space-y-3 py-2",children:[o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"goal-title",children:Wv()}),t(z,{id:"goal-title",value:h,onChange:(n)=>_(n.target.value),placeholder:Yv(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"goal-description",children:Qv()}),t(Ei,{id:"goal-description",value:b,onChange:(n)=>P(n.target.value),placeholder:Kv(),rows:3})]})]}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:v,disabled:d,children:Ne()}),o(C,{type:"submit",disabled:!h.trim()||d,children:[d&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),f?Vs():jc()]})]})]})})})}function Se({teamId:e,selectedGoalId:r,onSelectGoal:v,isOwnerOrEditor:f=!0}){let w=G(),[h,_]=u(!1),[b,P]=u(null),[j,Q]=u(null),[R,F]=u(!1),{data:U,isLoading:d}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let i=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!i.ok)throw Error("Failed to fetch goals");return await i.json()},enabled:!!e}),n=U?.data||[],x=n.reduce((i,s)=>i+(s.taskCount||0),0),{mutate:N,isPending:l}=B({mutationFn:async(i)=>{let s=await A.api.teams[":teamId"].kanban.goals[":goalId"].$delete({param:{teamId:e,goalId:i}});if(!s.ok){let p=await s.json().catch(()=>({message:Mn()}));throw Error(p.message||Mn())}return await s.json()},onSuccess:(i,s)=>{if(w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),M.success(Vv()),r===s)v(null);Q(null)},onError:(i)=>{M.error(i.message)}});if(R)return o("div",{className:"border-r border-sidebar-border bg-sidebar flex flex-col items-center w-12 shrink-0 transition-all duration-300",children:[t("div",{className:"h-14 flex items-center justify-center border-b border-sidebar-border w-full shrink-0",children:t(C,{variant:"ghost",size:"icon-sm",onClick:()=>F(!1),title:xd(),className:"text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(Et,{className:"w-4 h-4"})})}),o("div",{className:"mt-3 flex flex-col items-center gap-2",children:[t(C,{variant:r===null?"secondary":"ghost",size:"icon-sm",onClick:()=>v(null),title:eh(),className:E("w-8 h-8 rounded-md",r===null&&"bg-sidebar-accent text-sidebar-accent-foreground"),children:t(Ga,{className:"w-4 h-4"})}),t(C,{variant:"ghost",size:"icon-sm",onClick:()=>_(!0),title:pg(),className:"w-8 h-8 rounded-md text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(fe,{className:"w-4 h-4"})})]}),h&&t(pe,{teamId:e,isOpen:h,onClose:()=>_(!1)})]});return o("aside",{className:"w-64 border-r border-sidebar-border bg-sidebar flex flex-col shrink-0 transition-all duration-300 select-none",children:[o("div",{className:"h-14 px-3 flex items-center justify-between border-b border-sidebar-border shrink-0",children:[o("div",{className:"flex items-center gap-2 font-semibold text-xs tracking-wider uppercase text-sidebar-foreground/70",children:[t(So,{className:"w-4 h-4 text-sidebar-primary"}),t("span",{children:xd()})]}),o("div",{className:"flex items-center gap-1",children:[f&&t(C,{variant:"ghost",size:"icon-sm",onClick:()=>_(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:pg(),children:t(fe,{className:"w-4 h-4"})}),t(C,{variant:"ghost",size:"icon-sm",onClick:()=>F(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"Collapse",children:t(nn,{className:"w-4 h-4"})})]})]}),t(ue,{className:"flex-1 p-2",children:o("div",{className:"space-y-1",children:[o("div",{onClick:()=>v(null),className:E("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group h-8 min-h-[32px]",r===null?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[o("div",{className:"flex items-center gap-2 truncate min-w-0",children:[t(Ga,{className:"w-3.5 h-3.5 shrink-0 text-sidebar-primary"}),t("span",{className:"truncate",children:eh()})]}),x>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 shrink-0",children:x})]}),d?t("div",{className:"flex items-center justify-center p-4",children:t(O,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):n.length===0?t("div",{className:"px-2.5 py-4 text-center text-xs text-muted-foreground",children:yS()}):n.map((i)=>{let s=r===i.id,p=i.id===xi,k=p?_s():i.title,g=f&&!p;return o("div",{onClick:()=>v(i.id),className:E("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group relative min-h-[32px]",s?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[o("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t(So,{className:E("w-3.5 h-3.5 shrink-0",s?"text-sidebar-primary":"text-muted-foreground")}),t("span",{className:"line-clamp-2 break-words leading-tight",title:k,children:k})]}),t("div",{className:"flex items-center shrink-0 ml-1",children:g?o(L,{children:[(i.taskCount??0)>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 group-hover:hidden group-focus-within:hidden [&:has(~_div_[data-state=open])]:hidden",children:i.taskCount}),t("div",{className:"hidden group-hover:flex group-focus-within:flex [&:has([data-state=open])]:flex items-center",onClick:(c)=>c.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{variant:"ghost",size:"icon-xs",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:t(rr,{className:"w-3.5 h-3.5"})})}),o(_e,{align:"end",className:"w-36",children:[o(K,{onClick:()=>{P(i)},children:[t(ye,{className:"w-3.5 h-3.5 mr-2"}),Ab()]}),o(K,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{Q(i)},children:[t(we,{className:"w-3.5 h-3.5 mr-2"}),ct()]})]})]})})]}):(i.taskCount??0)>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60",children:i.taskCount})})]},i.id)})]})}),(h||b)&&t(pe,{teamId:e,isOpen:h||!!b,goalToEdit:b,onClose:()=>{_(!1),P(null)}}),j&&t(Xe,{open:!!j,onOpenChange:(i)=>!i&&Q(null),children:o(et,{children:[o(tt,{children:[t(nt,{children:Ky()}),t(ot,{children:Wy({title:j.title})})]}),o(rt,{children:[t(it,{disabled:l,children:Ne()}),o(st,{onClick:()=>N(j.id),disabled:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[l&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),ct()]})]})]})})]})}S();S();function Ke(e){return+xe(e)<Date.now()}function Ee({task:e,onClick:r,onDelete:v,disabled:f,isFirst:w,isLast:h,showBottomIndicator:_,currentUserId:b,currentUserRole:P}){let{source:j}=Qd(),Q=!!j,R=P?.toLowerCase()==="owner",F=P?.toLowerCase()==="editor",U=!!b&&e.creator?.id===b,d=e.reporter?.id===b||U,n=e.assignee?.id===b,x=R||F||d||n,N=U||R||d,l=f||!x,{ref:i,isDragging:s}=bs({id:e.id,data:{type:"kanban_task",task:e},disabled:l}),{ref:p,isDropTarget:k}=Or({id:`reorder-before-${e.id}`,data:{type:"reorder",task:e,position:"before"},disabled:s||f}),{ref:g,isDropTarget:c}=Or({id:`reorder-after-${e.id}`,data:{type:"reorder",task:e,position:"after"},disabled:s||f}),T=e.isAgentTask,q=e.status===Qe.BLOCKED,y=e.dueDate?Ke(new Date(e.dueDate))&&e.status!==Qe.DONE:!1;return o("div",{className:"relative",children:[t("div",{ref:p,className:E("absolute left-0 right-0 z-20",w?"-top-6 h-[calc(50%+24px)]":"-top-1 h-[calc(50%+4px)]",Q&&!s?"pointer-events-auto":"pointer-events-none")}),t("div",{ref:g,className:E("absolute bottom-0 left-0 right-0 z-20",h?"-bottom-6 h-[calc(50%+24px)]":"h-1/2",Q&&!s?"pointer-events-auto":"pointer-events-none")}),k&&!s&&t("div",{className:"absolute -top-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),(c||_)&&!s&&t("div",{className:"absolute -bottom-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),o("div",{ref:i,onClick:()=>r(e),className:E("group relative flex flex-col gap-2 p-3 rounded-lg border text-card-foreground transition-all duration-200 cursor-pointer select-none",s&&"opacity-40 scale-95 shadow-lg ring-2 ring-primary",!s&&"hover:shadow-md","border-border/80 bg-card hover:border-primary/50 shadow-2xs",q&&"border-red-500/60 bg-red-500/[0.03] ring-1 ring-red-500/20"),children:[o("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[o("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[t("span",{className:E("px-1.5 py-0.5 rounded text-[10px] font-medium border uppercase tracking-wider shrink-0",la(e.priority)),children:aa(e.priority)}),T&&o("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[t(Tt,{className:"w-3 h-3"}),t("span",{children:Hd()})]}),e.goal&&o("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground border border-border/70 truncate max-w-[130px]",children:[t(So,{className:"w-2.5 h-2.5 shrink-0"}),t("span",{className:"truncate",children:e.goal.title})]})]}),t("div",{className:"flex items-center gap-1 shrink-0",children:N&&t("div",{className:"opacity-0 group-hover:opacity-100 [&:has([data-state=open])]:opacity-100 focus-within:opacity-100 transition-opacity flex items-center",onClick:(X)=>X.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground",children:t(rr,{className:"w-3.5 h-3.5"})})}),t(_e,{align:"end",className:"w-32",children:o(K,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>v?.(e),children:[t(we,{className:"w-3.5 h-3.5 mr-2"}),ct()]})})]})})})]}),t("h4",{className:"text-xs font-semibold leading-snug line-clamp-2 text-foreground break-words",children:e.title}),q&&o("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-red-500/10 border border-red-500/20 text-[11px] text-red-600 dark:text-red-400",children:[t(Kr,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),t("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent?.blockReason||e.latestStatusEvent?.reason||e.latestStatusEvent?.summary||AA()})]}),e.status===Qe.IN_REVIEW&&e.latestStatusEvent?.summary&&o("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-purple-500/10 border border-purple-500/20 text-[11px] text-purple-600 dark:text-purple-400",children:[t(dn,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),t("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent.summary})]}),o("div",{className:"flex items-center justify-between gap-2 pt-1 mt-auto border-t border-border/40 text-[11px] text-muted-foreground",children:[t("div",{className:"flex items-center gap-1.5 min-w-0",children:e.assignee?o(L,{children:[T?t("div",{className:"w-5 h-5 rounded-full bg-orange-500/15 border border-orange-500/30 flex items-center justify-center shrink-0",children:t(Tt,{className:"w-3 h-3 text-orange-600 dark:text-orange-400"})}):o(Ce,{size:"sm",className:"w-5 h-5 border border-border",children:[t(Ie,{src:e.assignee.image}),t(Te,{className:"text-[9px]",children:e.assignee.name.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate text-xs font-medium text-foreground/80 max-w-[90px]",children:e.assignee.name})]}):t("span",{className:"text-[11px] italic text-muted-foreground/60",children:_s()})}),o("div",{className:"flex items-center gap-2 shrink-0",children:[e.dueDate&&o("div",{className:E("flex items-center gap-1 text-[10px] font-mono",y?"text-red-500 font-semibold":"text-muted-foreground"),title:Ar(new Date(e.dueDate),"yyyy/MM/dd HH:mm"),children:[t(jn,{className:"w-3 h-3"}),t("span",{children:Ar(new Date(e.dueDate),"MM/dd")})]}),e.assetCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:jw({count:e.assetCount}),children:[t(ka,{className:"w-3 h-3"}),t("span",{children:e.assetCount})]}),e.dependencyCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.dependencyCount} dependencies`,children:[t(qs,{className:"w-3 h-3"}),t("span",{children:e.dependencyCount})]}),e.commentCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.commentCount} comments`,children:[t(xo,{className:"w-3 h-3"}),t("span",{children:e.commentCount})]})]})]})]})]})}function Oe({teamId:e,status:r,selectedGoalId:v,scope:f,currentUserId:w,currentUserRole:h,onTaskClick:_,onDeleteTask:b,onCreateTaskInColumn:P}){let j=h?.toLowerCase()==="owner"||h?.toLowerCase()==="editor",Q=f==="my"?w:void 0,{data:R,fetchNextPage:F,hasNextPage:U,isFetchingNextPage:d,isLoading:n}=mt({queryKey:["teams",e,"kanban","tasks",{status:r,goalId:v,assigneeId:Q}],queryFn:async({pageParam:H=""})=>{let J=await A.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:e},query:{status:r,goalId:v||void 0,assigneeId:Q||void 0,first:"20",after:H||void 0}});if(!J.ok)throw Error("Failed to fetch column tasks");return await J.json()},initialPageParam:"",getNextPageParam:(H)=>H.pageInfo?.cursor||void 0,refetchInterval:5000,enabled:!!e}),{ref:x,inView:N}=Nt({threshold:0.1});m(()=>{if(N&&U&&!d)F()},[N,U,d,F]);let l=D(()=>R?.pages?.flatMap((H)=>Array.isArray(H?.data)?H.data:[])||[],[R]),{source:i,target:s}=Qd(),p=l.filter((H)=>H.id!==i?.id).at(-1),{ref:k,isDropTarget:g}=Or({id:r,data:{type:"kanban_column",status:r,lastTask:p}}),c=i?.data?.type==="kanban_task",T=c&&(g||s?.data?.type==="kanban_column"&&s.data.status===r||s?.data?.type==="reorder"&&s.data.task?.status===r),q=c&&s?.data?.type==="kanban_column"&&s.data.status===r,y=R?.pages?.[0]?.pageInfo?.total??l.length,X=rm(r);return o("div",{ref:k,className:E("flex flex-col h-full max-h-full w-80 md:w-84 shrink-0 rounded-xl bg-card/60 border border-border/70 shadow-xs transition-colors duration-200 overflow-hidden select-none",T&&"ring-2 ring-primary/60 bg-primary/[0.03] border-primary/40"),children:[o("div",{className:"h-11 px-3.5 flex items-center justify-between border-b border-border/60 bg-card/80 shrink-0",children:[o("div",{className:"flex items-center gap-2 min-w-0",children:[t("div",{className:E("w-2.5 h-2.5 rounded-full shrink-0",X.dot)}),t("h3",{className:"text-xs font-bold tracking-wide uppercase text-foreground/90 truncate",children:io(r)})]}),t("div",{className:"flex items-center gap-1 shrink-0",children:t("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-muted font-medium text-muted-foreground",children:y})})]}),t(ue,{className:"flex-1 min-h-0 [&>div>div]:block!",children:o("div",{className:"p-2.5 space-y-2.5 min-h-full flex flex-col",children:[n?t("div",{className:"flex items-center justify-center py-10",children:t(O,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):l.length===0?t("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:t("p",{className:"text-xs text-muted-foreground/70",children:RS()})}):l.map((H,J)=>t(Ee,{task:H,onClick:_,onDelete:b,isFirst:J===0,isLast:J===l.length-1,showBottomIndicator:q&&H.id===p?.id,currentUserId:w,currentUserRole:h},H.id)),t("div",{ref:x,className:"h-2"}),d&&t("div",{className:"flex justify-center py-2",children:t(O,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})}),j&&t("div",{className:"p-2 border-t border-border/50 bg-card/90 shrink-0",children:o(C,{variant:"ghost",size:"sm",onClick:()=>P(r),className:"w-full justify-center h-8 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/80 border border-dashed border-border/80",children:[t(fe,{className:"w-3.5 h-3.5 mr-1.5"}),t("span",{children:Lf()})]})})]})}function Ge({teamId:e,selectedGoalId:r,scope:v,currentUserId:f,currentUserRole:w,onTaskClick:h,onCreateTaskInColumn:_}){let b=G(),[P,j]=u(null),{mutate:Q,isPending:R}=B({mutationFn:async(d)=>{let n=await A.api.teams[":teamId"].kanban.tasks[":taskId"].$delete({param:{teamId:e,taskId:d}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{b.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),b.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(NT()),j(null)},onError:(d)=>{M.error(d.message)}}),{mutate:F}=B({mutationFn:async({taskId:d,fromStatus:n,status:x,reason:N,beforeIndex:l,afterIndex:i})=>{let s=await A.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:e,taskId:d},json:{fromStatus:n,status:x,reason:N,beforeIndex:l,afterIndex:i}});if(!s.ok){let p=await s.json().catch(()=>({message:Mn()}));throw Error(p.message||Mn())}return await s.json()},onMutate:async({taskId:d,status:n,targetTaskId:x,position:N})=>{await b.cancelQueries({queryKey:["teams",e,"kanban","tasks"]});let l=b.getQueriesData({queryKey:["teams",e,"kanban","tasks"]}),i=null,s=(p)=>p[0]==="teams"&&p[1]===e&&p[2]==="kanban"&&p[3]==="tasks"&&typeof p[4]==="object"&&p[4]!==null&&("status"in p[4]);if(b.setQueriesData({predicate:(p)=>s(p.queryKey)},(p)=>{if(!p||!Array.isArray(p.pages))return p;let k=!1,g=p.pages.map((c)=>{if(!c||!Array.isArray(c.data))return c;let T=c.data.find((q)=>q.id===d);if(T)return i={...T,status:n},k=!0,{...c,data:c.data.filter((q)=>q.id!==d),pageInfo:{...c.pageInfo,total:Math.max(0,(c.pageInfo?.total??c.data.length)-1)}};return c});return k?{...p,pages:g}:p}),i){let p=i;b.setQueriesData({predicate:(k)=>{if(!s(k.queryKey))return!1;return k.queryKey[4]?.status===n}},(k)=>{if(!k||!Array.isArray(k.pages))return k;let g=k.pages.flatMap((y)=>y?.data??[]).filter((y)=>y.id!==d),c=g.length;if(x){let y=g.findIndex((X)=>X.id===x);if(y!==-1)c=N==="before"?y:y+1}g.splice(c,0,p);let T=0,q=k.pages.map((y,X)=>{let H=y?.data?y.data.length:0,J=X===0&&H===0?1:X===k.pages.length-1?g.length-T:H,te=g.slice(T,T+J);return T+=J,{...y,data:te,pageInfo:{...y?.pageInfo,total:(y?.pageInfo?.total??0)+1}}});if(T<g.length&&q.length>0){let y=q.length-1;q[y]={...q[y],data:[...q[y]?.data??[],...g.slice(T)]}}return{...k,pages:q}})}return{previousQueries:l}},onError:(d,n,x)=>{if(x?.previousQueries)for(let[N,l]of x.previousQueries)b.setQueryData(N,l);M.error(d.message)},onSettled:()=>{b.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]})}}),U=(d)=>{if(d.canceled)return;let{source:n,target:x}=d.operation;if(!n||!x)return;let N=n.data;if(N?.type!=="kanban_task"||!N.task)return;let l=N.task,i=w?.toLowerCase()==="owner",s=w?.toLowerCase()==="editor",p=l.reporter?.id===f||l.creator?.id===f,k=l.assignee?.id===f;if(!i&&!s&&!p&&!k){M.error(U_());return}let g=x.data;if(!g)return;if(g.type==="reorder"&&g.task&&g.position){let c=g.task,T=c.status;if(l.id===c.id)return;let q=g.position==="before"?c.sortIndex??void 0:void 0,y=g.position==="after"?c.sortIndex??void 0:void 0;F({taskId:l.id,fromStatus:l.status,status:T,beforeIndex:q,afterIndex:y,targetTaskId:c.id,position:g.position});return}if(g.type==="kanban_column"&&g.status){let{status:c,lastTask:T}=g;if(T){if(l.id===T.id){if(l.status===c)return;F({taskId:l.id,fromStatus:l.status,status:c});return}F({taskId:l.id,fromStatus:l.status,status:c,afterIndex:T.sortIndex??void 0,targetTaskId:T.id,position:"after"});return}if(l.status===c)return;F({taskId:l.id,fromStatus:l.status,status:c})}};return o(Vn,{sensors:[_n.configure({activationConstraints:[new Dr.Distance({value:8})]}),es],onDragEnd:U,children:[t("div",{className:"flex-1 min-h-0 overflow-x-auto overflow-y-hidden p-4 bg-background/50",children:t("div",{className:"flex gap-4 h-full min-w-max pb-2",children:BA.map((d)=>t(Oe,{teamId:e,status:d,selectedGoalId:r,scope:v,currentUserId:f,currentUserRole:w,onTaskClick:h,onDeleteTask:(n)=>j(n),onCreateTaskInColumn:_},d))})}),P&&t(Xe,{open:!!P,onOpenChange:(d)=>!d&&j(null),children:o(et,{children:[o(tt,{children:[t(nt,{children:ib()}),t(ot,{children:ab({title:P.title})})]}),o(rt,{children:[t(it,{disabled:R,children:Ne()}),o(st,{onClick:()=>Q(P.id),disabled:R,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[R&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),ct()]})]})]})})]})}S();function je({teamId:e,isOpen:r,onClose:v,initialGoalId:f}){let w=G(),h=f===xi||!f?"none":f,[_,b]=u(""),[P,j]=u(""),[Q,R]=u(!1),[F,U]=u(zr.MEDIUM),[d,n]=u(h),[x,N]=u("none"),[l,i]=u("none"),[s,p]=u(void 0),[k,g]=u(void 0),[c,T]=u(null),[q,y]=u(null),[X,H]=u(null),[J,te]=u([]),[se,re]=u([]),[be,ve]=u(!1),{data:he}=Z({queryKey:["teams",e,"me"],queryFn:async()=>{let a=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!a.ok)return null;return await a.json()},enabled:!!e&&r});m(()=>{if(r)b(""),j(""),R(!1),U(zr.MEDIUM),n(h),N("none"),i(he?.id||"none"),p(void 0),g(void 0),T(null),y(null),H(null),te([]),re([])},[r,h,he?.id]);let{data:ke=[]}=Z({queryKey:["teams",e,"members","human"],queryFn:async()=>{let a=await A.api.teams[":teamId"].members.$get({param:{teamId:e},query:{includeAgents:"false"}});if(!a.ok)return[];let V=await a.json();return Array.isArray(V)?V:[]},enabled:!!e&&r}),{data:$e=[]}=Z({queryKey:["teams",e,"agents"],queryFn:async()=>{let a=await A.api.teams[":teamId"].agents.$get({param:{teamId:e}});if(!a.ok)return[];return await a.json()||[]},enabled:!!e&&r}),{data:He}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let a=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!a.ok)return{data:[]};return await a.json()},enabled:!!e&&r}),Ve=He?.data||[],{mutate:Je,isPending:ae}=B({mutationFn:async()=>{let a=await A.api.teams[":teamId"].kanban.tasks.$post({param:{teamId:e},json:{title:_.trim(),description:P.trim()||void 0,isAgentTask:Q,priority:F,goalId:d!=="none"?d:void 0,assigneeId:x!=="none"?x:void 0,reporterId:l!=="none"?l:void 0,startDate:s?s.toISOString():void 0,dueDate:k?k.toISOString():void 0,projectId:c||void 0,targetFolderId:q||void 0,parentIds:J.length>0?J:void 0,assetIds:se.length>0?se.map((V)=>V.id):void 0}});if(!a.ok){let V=await a.text().catch(()=>""),Y=Mn();if(V)try{let ie=JSON.parse(V);if(ie&&typeof ie.message==="string")Y=ie.message}catch{Y=V}throw Error(Y)}return await a.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(PT()),v()},onError:(a)=>{M.error(a.message)}}),We=(a)=>{if(a.preventDefault(),!_.trim()||ae)return;Je()},oe=Q;return t(de,{open:r,onOpenChange:(a)=>!a&&v(),children:o(le,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",children:[o("form",{onSubmit:We,className:"space-y-4",children:[t(me,{children:t(ce,{children:Lf()})}),o("div",{className:"space-y-3.5 py-1",children:[o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"create-task-title",children:vA()}),t(z,{id:"create-task-title",value:_,onChange:(a)=>b(a.target.value),placeholder:wA(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"create-task-desc",children:_A()}),t(Ei,{id:"create-task-desc",value:P,onChange:(a)=>j(a.target.value),placeholder:yA(),rows:3})]}),o("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-lg border border-border/80 bg-muted/30 p-2.5 h-14",children:[o("div",{className:"space-y-0.5 min-w-0 pr-2",children:[o(W,{htmlFor:"create-is-agent-task",className:"text-xs font-medium cursor-pointer flex items-center gap-1.5",children:[t(Tt,{className:"w-3.5 h-3.5 text-orange-500"}),t("span",{children:Hd()})]}),t("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:xA()})]}),t(Me,{id:"create-is-agent-task",checked:Q,onCheckedChange:(a)=>{R(a),N("none")}})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:bA()}),o(Fe,{value:F,onValueChange:(a)=>U(a),children:[t(Ze,{className:"w-full h-9 text-xs",children:t(Le,{})}),t(Be,{children:Object.values(zr).map((a)=>t(ne,{value:a,children:t("span",{className:E("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",la(a)),children:aa(a)})},a))})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:xd()}),o(Fe,{value:d,onValueChange:n,children:[t(Ze,{className:"w-full h-9 text-xs",children:t(Le,{placeholder:"None"})}),o(Be,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:"None"})}),Ve.filter((a)=>a.id!==xi).map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(So,{className:"w-3.5 h-3.5 text-primary"}),t("span",{children:a.title})]})},a.id))]})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:oe?zd():ih()}),o(Fe,{value:x,onValueChange:N,children:[t(Ze,{className:"w-full h-9 text-xs",children:t(Le,{placeholder:_s()})}),o(Be,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:_s()})}),oe?$e.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(Tt,{className:"w-3.5 h-3.5 text-purple-500"}),t("span",{children:a.name})]})},a.id)):ke.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{size:"sm",className:"w-4 h-4",children:[t(Ie,{src:a.image}),t(Te,{className:"text-[8px]",children:a.name.slice(0,2).toUpperCase()})]}),t("span",{children:a.name})]})},a.id))]})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:Kg()}),o(Fe,{value:l,onValueChange:i,children:[t(Ze,{className:"w-full h-9 text-xs",children:t(Le,{placeholder:_s()})}),o(Be,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:_s()})}),ke.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{size:"sm",className:"w-4 h-4",children:[t(Ie,{src:a.image}),t(Te,{className:"text-[8px]",children:a.name.slice(0,2).toUpperCase()})]}),t("span",{children:a.name})]})},a.id))]})]})]}),oe&&o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:Hp()}),o(C,{type:"button",variant:"outline",size:"sm",onClick:()=>ve(!0),className:"w-full justify-start h-9 text-xs truncate font-normal",children:[t(lr,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),t("span",{className:"truncate",children:X||Fp()})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:jd()}),t(Ci,{value:s,onChange:p,placeholder:jd(),className:"h-9 text-xs"})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:gd()}),t(Ci,{value:k,onChange:g,placeholder:gd(),className:"h-9 text-xs"})]}),o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:Ig()}),t(Xd,{teamId:e,value:J,onChange:te})]}),t("div",{className:"sm:col-span-2 pt-1",children:t(ef,{teamId:e,projectId:c,assets:se,onAddAssets:(a)=>re((V)=>[...V,...a]),onRemoveAsset:(a)=>re((V)=>V.filter((Y)=>Y.id!==a))})})]})]}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:v,disabled:ae,children:Ne()}),o(C,{type:"submit",disabled:!_.trim()||ae,children:[ae&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),jc()]})]})]}),be&&t(tf,{teamId:e,currentProjectId:c,currentTargetFolderId:q,isOpen:be,onClose:()=>ve(!1),onSelect:(a,V,Y)=>{T(a),y(V),H(Y||"Selected Folder")}})]})})}function ze({teamId:e,initialTaskId:r}){let[v,f]=u("team"),[w,h]=u(null),[_,b]=u(r??null),[P,j]=u(!1);m(()=>{if(r)b(r)},[r]);let[Q,R]=u(Qe.TODO),{data:F,isLoading:U}=Z({queryKey:["teams",e,"me"],queryFn:async()=>{let s=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!s.ok)throw Error("Failed to fetch me");return await s.json()},enabled:!!e}),{data:d}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let s=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!s.ok)return{data:[]};return await s.json()},enabled:!!e}),n=d?.data||[],x=w?n.find((s)=>s.id===w)||null:null,N=F?.role?.toLowerCase()==="owner"||F?.role?.toLowerCase()==="editor",l=(s=Qe.TODO)=>{R(s),j(!0)},i=(s)=>{b(s.id)};if(U)return t("div",{className:"flex h-full items-center justify-center",children:t(O,{className:"w-8 h-8 animate-spin text-muted-foreground"})});return o("div",{className:"flex flex-row h-full bg-background overflow-hidden font-sans",children:[t(Se,{teamId:e,selectedGoalId:w,onSelectGoal:h,isOwnerOrEditor:N}),o("div",{className:"flex-1 flex flex-col min-w-0 h-full overflow-hidden",children:[t(De,{scope:v,onScopeChange:f,selectedGoal:x,onClearGoal:()=>h(null),onCreateTask:()=>l(Qe.TODO),canCreateTask:N}),t(Ge,{teamId:e,selectedGoalId:w,scope:v,currentUserId:F?.id,currentUserRole:F?.role,onTaskClick:i,onCreateTaskInColumn:(s)=>l(s)})]}),_&&t(nf,{teamId:e,taskId:_,isOpen:!!_,onClose:()=>b(null),canEdit:N}),P&&t(je,{teamId:e,isOpen:P,initialStatus:Q,initialGoalId:w,onClose:()=>j(!1)})]})}function at(){let{teamId:e}=Re.useParams(),{taskId:r}=Re.useSearch();return t(ze,{teamId:e,initialTaskId:r})}var Re=Ue("/teams/$teamId/kanban")({component:at});export{Re as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{m,_,u,S,L,t,o,V,B,A,O,Kr,ve,Et,ht,Us,de,C,ge,Ae,_e,K,De,na,lh,ct,jc,qc,yh,Eb,Cb,Zh,Bh,Uh,ap,lp,cp,up,El,hg,pp,mp,Cg,Ig,Mp,Kg,mA,$p,p1,Kp,Wp,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,Ot,Nt,M,Jr,bn,UA}from"./chunk-42hrvk6k.js";import{lu,cu,uu,du,fu}from"./chunk-w4yjgez6.js";import{Uo}from"./chunk-04avc4fn.js";import{uo}from"./chunk-qxscgcn9.js";S();var Se=[];function $l({teamId:r,projectId:D,assetId:p,folders:a,files:l,totalFolders:Me,totalFiles:Re,totalFoldersSize:ze,totalFilesSize:Ue,selectedItem:J,selectedIds:w,onItemSelect:X,onItemDoubleClick:Y,onSaveField:Be,onClearSelection:$e,fetchNextFoldersPage:Z,hasNextFoldersPage:ee,isFetchingNextFoldersPage:y,fetchNextFilesPage:te,hasNextFilesPage:oe,isFetchingNextFilesPage:b,isRecentlyDeleted:x=!1,isRecents:k=!1,isLoading:se=!1,isShareView:q=!1,isPublic:ie=!1,shareId:Oe,allowDownload:re=!0}){let d=V(),{canEdit:N,canAdmin:We}=Ot(D),ne=_(null),ce=_(null),[W,je]=u(!0),[j,Qe]=u(!0),[He,F]=u(!1),[I,me]=u(""),[Ke,Q]=u(!1),fe=Me??a.length,he=Re??l.length,we=ze??(a.length>0?a.reduce((e,s)=>e+(s.sizeByte||0),0):-1),ye=Ue??(l.length>0?l.reduce((e,s)=>e+(s.sizeByte||0),0):-1),Le=we>-1,Pe=ye>-1,be=(e,s)=>{if(s)return e===1?lp({count:e}):ap({count:e});else return e===1?up({count:e}):cp({count:e})},{editingItemId:xe,setEditingItemId:ke,handleAction:Ce,onRenameSubmit:Ne,isDeleteDialogOpen:Ve,setIsDeleteDialogOpen:Ge,confirmDelete:Je,isDownloadDialogOpen:Ye,setIsDownloadDialogOpen:H,isLoadingLinks:T,resolvedFiles:Fe,startDownload:Ze}=fu({teamId:r,projectId:D,assetId:p,folders:a,files:l,selectedIds:w,isPublic:ie,shareId:Oe}),{ref:at,inView:Ie}=Nt();m(()=>{if(Ie){if(ee&&!y)Z();else if(oe&&!b)te()}},[Ie,ee,y,oe,b,Z,te]);let lt=bn((e)=>e.startTask),dt=A.api.teams[":teamId"].upload.tasks.$post,{mutate:mt}=B({mutationFn:async(e)=>{let s=await dt(e);if(!s.ok)throw Error("Failed to create upload task");return await s.json()},onMutate:()=>({files:[...Se]}),onSuccess:async(e,s,n)=>{let f=n?.files||[],g=f.map((i)=>{let v=e.createdAssets?.find((c)=>c.tempId===i.id),R=e.presignedUrls?.find((c)=>c.id===i.id);return{fileId:v?.assetId||R?.fileId||i.id,name:i.file.name,size:i.file.size}}).filter((i)=>!!i.fileId),h=f.filter((i)=>!i.file.name.startsWith(".")),E=h.length===1?h[0].file.name:`${h.length} Items`;if(e.taskId)lt(e.taskId,E,g);d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]}),await cu({files:f,taskId:e.taskId,teamId:r,storageBackend:e.storageBackend||"local",createdAssets:e.createdAssets,presignedUrls:e.presignedUrls,onFileFinished:async()=>{await d.invalidateQueries({queryKey:["search",r,p]})}}),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]})}}),Te=(e)=>{if(!e||e.length===0)return;let s=[],n=[],f=new Map;for(let g of e){let h=(g.webkitRelativePath||g.name).split("/");if(h.some((U)=>U.startsWith(".")))continue;let E=h.pop(),i=n,v="";for(let U of h)if(v=`${v}/${U}`,!f.has(v)){let G=[],wt={name:U,type:"folder",id:Uo(),children:G,size:0};i.push(wt),f.set(v,G),i=G}else i=f.get(v);let R={file:g,id:Uo()};s.push(R);let c=g.type;if(E.toLowerCase().endsWith(".wma")&&c?.startsWith("video/"))c=c.replace(/^video\//,"audio/");i.push({name:E,size:g.size,type:"file",id:R.id,children:[],mediaType:c})}Se=s,mt({param:{teamId:r},json:{parentId:p,files:n}})},pt=A.api.folders.$post,{mutate:ut,isPending:Ee}=B({mutationFn:async(e)=>{let s=await pt({json:{name:e,parentId:p}});if(!s.ok)throw Error("Failed to create folder");return await s.json()},onSuccess:()=>{M.success(El()),F(!1),me(""),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["folders"]})},onError:(e)=>{M.error(`Error: ${e.message}`)}}),{mutate:ft,isPending:P}=B({mutationFn:async()=>{let e=await A.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:D}});if(!e.ok)throw Error("Failed to empty trash");return await e.json()},onSuccess:()=>{M.success(p1()),d.invalidateQueries({queryKey:["projects",D,"recently-deleted"]}),$e(),Q(!1)},onError:(e)=>{M.error(`Error: ${e.message}`)}}),gt=(e)=>{if(e.preventDefault(),!I.trim())return;ut(I.trim())},vt=!se&&a.length===0&&l.length===0&&!y&&!b;return o("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[N&&o(L,{children:[t("input",{type:"file",ref:ne,multiple:!0,className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}}),t("input",{type:"file",ref:ce,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}})]}),x&&o("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0",children:[o("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t(Kr,{className:"h-4 w-4 text-amber-500 shrink-0"}),t("span",{className:"text-xs",children:Mp()})]}),We&&t(C,{variant:"destructive",size:"sm",disabled:P||a.length===0&&l.length===0,onClick:()=>Q(!0),className:"h-7 px-2.5 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground",children:"Delete"})]}),o("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 pb-24",children:[se&&a.length===0&&l.length===0?t(UA,{}):o("div",{className:"max-w-lg mx-auto w-full",children:[fe>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>je(!W),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[W?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(fe,!1),Le?` • ${Jr(we)}`:""]})]}),W&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:a.map((e)=>t(du,{item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]}),he>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>Qe(!j),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[j?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(he,!0),Pe?` • ${Jr(ye)}`:""]})]}),j&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:l.map((e)=>t(uu,{teamId:r,item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onSaveField:(s,n)=>Be?.(e.id,s,n),fields:[],onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]})]}),vt&&t("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:k?o("div",{className:"flex flex-col items-center gap-2",children:[t(Us,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),t("p",{className:"font-medium text-foreground",children:pp()}),t("p",{className:"text-xs text-muted-foreground",children:mp()})]}):t("span",{children:$p()})}),t("div",{ref:at,className:"py-4 flex justify-center items-center min-h-6",children:(y||b)&&t(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),N&&!x&&!k&&!q&&!ie&&t("div",{className:"fixed bottom-6 right-6 z-30",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{size:"icon",className:"h-14 w-14 rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/90 flex items-center justify-center","aria-label":"Actions",children:t(de,{className:"h-6 w-6"})})}),o(_e,{align:"end",side:"top",className:"w-48 mb-2",children:[o(K,{onClick:()=>ne.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Kp()})]}),o(K,{onClick:()=>ce.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Wp()})]}),o(K,{onClick:()=>F(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(lu,{className:"h-4 w-4"}),t("span",{children:El()})]})]})]})}),t(ue,{open:He,onOpenChange:F,children:t(ae,{className:"sm:max-w-md",children:o("form",{onSubmit:gt,children:[o(pe,{children:[t(le,{children:El()}),t(Mt,{children:Bh()})]}),t("div",{className:"py-4",children:t(z,{autoFocus:!0,placeholder:Bh(),value:I,onChange:(e)=>me(e.target.value)})}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:()=>F(!1),children:De()}),o(C,{type:"submit",disabled:!I.trim()||Ee,children:[Ee?t(O,{className:"h-4 w-4 animate-spin mr-2"}):null,na()]})]})]})})}),t(Xe,{open:Ve,onOpenChange:Ge,children:o(et,{children:[o(tt,{children:[t(nt,{children:qc()}),t(ot,{children:jc()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:()=>Je(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ct()})]})]})}),t(Xe,{open:Ke,onOpenChange:Q,children:o(et,{children:[o(tt,{children:[t(nt,{children:Cb()}),t(ot,{children:Eb()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:(e)=>{e.preventDefault(),ft()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:P,children:P?"Deleting...":ct()})]})]})}),t(ue,{open:Ye,onOpenChange:H,children:o(ae,{className:"sm:max-w-md",children:[o(pe,{children:[t(le,{children:T?Cg():lh()}),t(Mt,{children:T?Kg():Zh()})]}),T?o("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[t(O,{className:"h-8 w-8 animate-spin text-primary"}),t("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:Ig()})]}):o("div",{className:"space-y-4 py-2",children:[t("div",{className:"text-sm text-muted-foreground",children:yh({count:Fe.length})}),o("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[t(Kr,{className:"h-5 w-5 shrink-0 mt-0.5"}),o("div",{children:[t("p",{className:"font-semibold",children:hg()}),t("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:Uh()})]})]})]}),t(qe,{children:!T?o(L,{children:[t(C,{variant:"outline",onClick:()=>H(!1),children:De()}),o(C,{onClick:Ze,className:"gap-2",disabled:Fe.length===0,children:[t(ht,{className:"h-4 w-4"}),mA()]})]}):t(C,{variant:"outline",onClick:()=>H(!1),children:De()})})]})})]})}
|
|
2
|
-
export{
|
|
1
|
+
import{m,_,u,S,L,t,o,G,B,A,O,Kr,ve,Et,ht,zs,fe,C,ge,Ae,_e,K,Ne,na,dh,ct,Hc,$c,wh,Cb,Ib,Uh,zh,jh,lp,cp,up,dp,Tl,Ag,mp,hp,Tg,Mg,kp,Yg,gA,Gp,f1,Wp,Yp,Xe,et,tt,rt,nt,ot,st,it,de,le,me,qe,ce,Mt,z,Ot,Nt,M,yn,bn,om}from"./chunk-vvr8tnse.js";import{uu,du,Va,Qa,fu}from"./chunk-dzjmwat0.js";import{Uo}from"./chunk-nv7tztvh.js";import{uo}from"./chunk-01ym2agz.js";S();var Se=[];function Ql({teamId:r,projectId:D,assetId:p,folders:a,files:l,totalFolders:Me,totalFiles:Re,totalFoldersSize:ze,totalFilesSize:Ue,selectedItem:J,selectedIds:w,onItemSelect:X,onItemDoubleClick:Y,onSaveField:Be,onClearSelection:$e,fetchNextFoldersPage:Z,hasNextFoldersPage:ee,isFetchingNextFoldersPage:y,fetchNextFilesPage:te,hasNextFilesPage:oe,isFetchingNextFilesPage:b,isRecentlyDeleted:x=!1,isRecents:k=!1,isLoading:se=!1,isShareView:q=!1,isPublic:ie=!1,shareId:Oe,allowDownload:re=!0}){let d=G(),{canEdit:N,canAdmin:We}=Ot(D),ne=_(null),ae=_(null),[W,je]=u(!0),[j,Qe]=u(!0),[He,F]=u(!1),[I,pe]=u(""),[Ke,Q]=u(!1),ue=Me??a.length,he=Re??l.length,we=ze??(a.length>0?a.reduce((e,s)=>e+(s.sizeByte||0),0):-1),De=Ue??(l.length>0?l.reduce((e,s)=>e+(s.sizeByte||0),0):-1),Le=we>-1,Pe=De>-1,ye=(e,s)=>{if(s)return e===1?cp({count:e}):lp({count:e});else return e===1?dp({count:e}):up({count:e})},{editingItemId:be,setEditingItemId:xe,handleAction:ke,onRenameSubmit:Ce,isDeleteDialogOpen:Ve,setIsDeleteDialogOpen:Ge,confirmDelete:Je,isDownloadDialogOpen:Ye,setIsDownloadDialogOpen:H,isLoadingLinks:T,resolvedFiles:Fe,startDownload:Ze}=fu({teamId:r,projectId:D,assetId:p,folders:a,files:l,selectedIds:w,isPublic:ie,shareId:Oe}),{ref:at,inView:Ie}=Nt();m(()=>{if(Ie){if(ee&&!y)Z();else if(oe&&!b)te()}},[Ie,ee,y,oe,b,Z,te]);let lt=bn((e)=>e.startTask),dt=A.api.teams[":teamId"].upload.tasks.$post,{mutate:mt}=B({mutationFn:async(e)=>{let s=await dt(e);if(!s.ok)throw Error("Failed to create upload task");return await s.json()},onMutate:()=>({files:[...Se]}),onSuccess:async(e,s,n)=>{let f=n?.files||[],g=f.map((i)=>{let v=e.createdAssets?.find((c)=>c.tempId===i.id),R=e.presignedUrls?.find((c)=>c.id===i.id);return{fileId:v?.assetId||R?.fileId||i.id,name:i.file.name,size:i.file.size}}).filter((i)=>!!i.fileId),h=f.filter((i)=>!i.file.name.startsWith(".")),E=h.length===1?h[0].file.name:`${h.length} Items`;if(e.taskId)lt(e.taskId,E,g);d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]}),await du({files:f,taskId:e.taskId,teamId:r,storageBackend:e.storageBackend||"local",createdAssets:e.createdAssets,presignedUrls:e.presignedUrls,onFileFinished:async()=>{await d.invalidateQueries({queryKey:["search",r,p]})}}),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]})}}),Te=(e)=>{if(!e||e.length===0)return;let s=[],n=[],f=new Map;for(let g of e){let h=(g.webkitRelativePath||g.name).split("/");if(h.some((U)=>U.startsWith(".")))continue;let E=h.pop(),i=n,v="";for(let U of h)if(v=`${v}/${U}`,!f.has(v)){let V=[],wt={name:U,type:"folder",id:Uo(),children:V,size:0};i.push(wt),f.set(v,V),i=V}else i=f.get(v);let R={file:g,id:Uo()};s.push(R);let c=g.type;if(E.toLowerCase().endsWith(".wma")&&c?.startsWith("video/"))c=c.replace(/^video\//,"audio/");i.push({name:E,size:g.size,type:"file",id:R.id,children:[],mediaType:c})}Se=s,mt({param:{teamId:r},json:{parentId:p,files:n}})},pt=A.api.folders.$post,{mutate:ut,isPending:Ee}=B({mutationFn:async(e)=>{let s=await pt({json:{name:e,parentId:p}});if(!s.ok)throw Error("Failed to create folder");return await s.json()},onSuccess:()=>{M.success(Tl()),F(!1),pe(""),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["folders"]})},onError:(e)=>{M.error(`Error: ${e.message}`)}}),{mutate:ft,isPending:P}=B({mutationFn:async()=>{let e=await A.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:D}});if(!e.ok)throw Error("Failed to empty trash");return await e.json()},onSuccess:()=>{M.success(f1()),d.invalidateQueries({queryKey:["projects",D,"recently-deleted"]}),$e(),Q(!1)},onError:(e)=>{M.error(`Error: ${e.message}`)}}),gt=(e)=>{if(e.preventDefault(),!I.trim())return;ut(I.trim())},vt=!se&&a.length===0&&l.length===0&&!y&&!b;return o("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[N&&o(L,{children:[t("input",{type:"file",ref:ne,multiple:!0,className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}}),t("input",{type:"file",ref:ae,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}})]}),x&&o("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0",children:[o("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t(Kr,{className:"h-4 w-4 text-amber-500 shrink-0"}),t("span",{className:"text-xs",children:kp()})]}),We&&t(C,{variant:"destructive",size:"sm",disabled:P||a.length===0&&l.length===0,onClick:()=>Q(!0),className:"h-7 px-2.5 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground",children:"Delete"})]}),o("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 pb-24",children:[se&&a.length===0&&l.length===0?t(om,{}):o("div",{className:"max-w-lg mx-auto w-full",children:[ue>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>je(!W),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[W?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[ye(ue,!1),Le?` • ${yn(we)}`:""]})]}),W&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:a.map((e)=>t(Qa,{item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:be===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ce(e,s),onFinishEditing:()=>xe(null),onAction:(s,n)=>ke(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]}),he>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>Qe(!j),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[j?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[ye(he,!0),Pe?` • ${yn(De)}`:""]})]}),j&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:l.map((e)=>t(Va,{teamId:r,item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:be===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ce(e,s),onFinishEditing:()=>xe(null),onSaveField:(s,n)=>Be?.(e.id,s,n),fields:[],onAction:(s,n)=>ke(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]})]}),vt&&t("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:k?o("div",{className:"flex flex-col items-center gap-2",children:[t(zs,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),t("p",{className:"font-medium text-foreground",children:mp()}),t("p",{className:"text-xs text-muted-foreground",children:hp()})]}):t("span",{children:Gp()})}),t("div",{ref:at,className:"py-4 flex justify-center items-center min-h-6",children:(y||b)&&t(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),N&&!x&&!k&&!q&&!ie&&t("div",{className:"fixed bottom-6 right-6 z-30",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{size:"icon",className:"h-14 w-14 rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/90 flex items-center justify-center","aria-label":"Actions",children:t(fe,{className:"h-6 w-6"})})}),o(_e,{align:"end",side:"top",className:"w-48 mb-2",children:[o(K,{onClick:()=>ne.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Wp()})]}),o(K,{onClick:()=>ae.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Yp()})]}),o(K,{onClick:()=>F(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uu,{className:"h-4 w-4"}),t("span",{children:Tl()})]})]})]})}),t(de,{open:He,onOpenChange:F,children:t(le,{className:"sm:max-w-md",children:o("form",{onSubmit:gt,children:[o(me,{children:[t(ce,{children:Tl()}),t(Mt,{children:zh()})]}),t("div",{className:"py-4",children:t(z,{autoFocus:!0,placeholder:zh(),value:I,onChange:(e)=>pe(e.target.value)})}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:()=>F(!1),children:Ne()}),o(C,{type:"submit",disabled:!I.trim()||Ee,children:[Ee?t(O,{className:"h-4 w-4 animate-spin mr-2"}):null,na()]})]})]})})}),t(Xe,{open:Ve,onOpenChange:Ge,children:o(et,{children:[o(tt,{children:[t(nt,{children:$c()}),t(ot,{children:Hc()})]}),o(rt,{children:[t(it,{children:Ne()}),t(st,{onClick:()=>Je(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ct()})]})]})}),t(Xe,{open:Ke,onOpenChange:Q,children:o(et,{children:[o(tt,{children:[t(nt,{children:Ib()}),t(ot,{children:Cb()})]}),o(rt,{children:[t(it,{children:Ne()}),t(st,{onClick:(e)=>{e.preventDefault(),ft()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:P,children:P?"Deleting...":ct()})]})]})}),t(de,{open:Ye,onOpenChange:H,children:o(le,{className:"sm:max-w-md",children:[o(me,{children:[t(ce,{children:T?Tg():dh()}),t(Mt,{children:T?Yg():Uh()})]}),T?o("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[t(O,{className:"h-8 w-8 animate-spin text-primary"}),t("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:Mg()})]}):o("div",{className:"space-y-4 py-2",children:[t("div",{className:"text-sm text-muted-foreground",children:wh({count:Fe.length})}),o("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[t(Kr,{className:"h-5 w-5 shrink-0 mt-0.5"}),o("div",{children:[t("p",{className:"font-semibold",children:Ag()}),t("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:jh()})]})]})]}),t(qe,{children:!T?o(L,{children:[t(C,{variant:"outline",onClick:()=>H(!1),children:Ne()}),o(C,{onClick:Ze,className:"gap-2",disabled:Fe.length===0,children:[t(ht,{className:"h-4 w-4"}),gA()]})]}):t(C,{variant:"outline",onClick:()=>H(!1),children:Ne()})})]})})]})}
|
|
2
|
+
export{Ql};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m,S,t,Z,Ue,A,ut,Ct,sm}from"./chunk-vvr8tnse.js";import"./chunk-nv7tztvh.js";import"./chunk-dzjmwat0.js";import"./chunk-zasjhrwc.js";import"./chunk-fb1bes2h.js";import"./chunk-bf5m8f6t.js";import"./chunk-rx9g95wk.js";import"./chunk-113baw0m.js";import"./chunk-eex8sjfs.js";import"./chunk-v3z63tpw.js";import"./chunk-kfewyax2.js";import"./chunk-zzzgk1d5.js";import"./chunk-a23q1kc4.js";import"./chunk-4yhvexzk.js";import{Qn}from"./chunk-treyx8em.js";import{tr}from"./chunk-ra5csbkr.js";import"./chunk-3tg10kwz.js";import"./chunk-fg9sr6r9.js";import"./chunk-hjzbw975.js";import"./chunk-5m51b7af.js";import"./chunk-emgyjhmx.js";import"./chunk-01ym2agz.js";import"./chunk-hjwpd09v.js";import"./chunk-8s9fehda.js";S();function l(){let{projectId:o}=c.useParams(),{teamId:r,ensureTeamIdForProject:a}=ut();m(()=>{a(o)},[o,a]);let{data:s}=tr(sm(o)),e=s?.rootFolder,{data:i}=Z({queryKey:["folders",e],queryFn:async()=>{let n=await A.api.folders[":folderId"].$get({param:{folderId:e}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!e});if(!r||!e||!i)return t(Ct,{});return t(Qn,{teamId:r,projectId:o,projectName:s.name??"",assetId:e,rootFolderId:e})}var c=Ue("/projects/$projectId/")({component:l});export{c as Route};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ge,qt}from"./chunk-
|
|
2
|
+
import{Ge,qt}from"./chunk-exmwerag.js";import{H}from"./chunk-tjavzarz.js";var _=H(Ge());var N=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.AccessKeyId==="string"&&typeof e.SecretAccessKey==="string"&&typeof e.Token==="string"&&typeof e.Expiration==="string",h=(e)=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}});var C=({maxRetries:e=0,timeout:t=1000})=>({maxRetries:e,timeout:t});var v=H(Ge());import R from"http";function E(e){return new Promise((t,n)=>{let o=R.request({method:"GET",...e,hostname:e.hostname?.replace(/^\[(.+)\]$/,"$1")});o.on("error",(r)=>{n(Object.assign(new v.ProviderError("Unable to connect to instance metadata service"),r)),o.destroy()}),o.on("timeout",()=>{n(new v.ProviderError("TimeoutError from instance metadata service")),o.destroy()}),o.on("response",(r)=>{let{statusCode:a=400}=r;if(a<200||300<=a)n(Object.assign(new v.ProviderError("Error response received from instance metadata service"),{statusCode:a})),o.destroy();let p=[];r.on("data",(s)=>{p.push(s)}),r.on("end",()=>{t(Buffer.concat(p)),o.destroy()})}),o.end()})}var T=(e,t)=>{let n=e();for(let o=0;o<t;o++)n=n.catch(e);return n};var A="AWS_CONTAINER_CREDENTIALS_FULL_URI",g="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",D="AWS_CONTAINER_AUTHORIZATION_TOKEN",G=(e={})=>{let{timeout:t,maxRetries:n}=C(e);return()=>T(async()=>{let o=await X({logger:e.logger}),r=JSON.parse(await q(t,o));if(!N(r))throw new _.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:e.logger});return h(r)},n)},q=async(e,t)=>{if(process.env[D])t.headers={...t.headers,Authorization:process.env[D]};return(await E({...t,timeout:e})).toString()},Y="169.254.170.2",j=new Set(["localhost","127.0.0.1"]),J=new Set(["http:","https:"]),X=async({logger:e})=>{if(process.env[g])return{hostname:Y,path:process.env[g]};if(process.env[A]){let t;try{t=new URL(process.env[A])}catch{throw new _.CredentialsProviderError(`${process.env[A]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:e})}if(!t.hostname||!j.has(t.hostname))throw new _.CredentialsProviderError(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:e});if(!t.protocol||!J.has(t.protocol))throw new _.CredentialsProviderError(`${t.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:e});return{protocol:t.protocol,hostname:t.hostname,path:t.pathname+t.search,port:t.port?parseInt(t.port,10):void 0}}throw new _.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${g} or ${A} environment variable is set`,{tryNextLink:!1,logger:e})};var u=H(Ge());var y=H(Ge());class O extends y.CredentialsProviderError{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(e,t=!0){super(e,t);this.tryNextLink=t,Object.setPrototypeOf(this,O.prototype)}}var w=H(Ge()),F=H(qt());var S;(function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]"})(S||(S={}));var P={environmentVariableSelector:(e)=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:(e)=>e.ec2_metadata_service_endpoint,default:void 0};var l;(function(e){e.IPv4="IPv4",e.IPv6="IPv6"})(l||(l={}));var z="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",Z="ec2_metadata_service_endpoint_mode",L={environmentVariableSelector:(e)=>e[z],configFileSelector:(e)=>e[Z],default:l.IPv4};var b=async()=>F.parseUrl(await Q()||await ee()),Q=async()=>w.loadConfig(P)(),ee=async()=>{let e=await w.loadConfig(L)();switch(e){case l.IPv4:return S.IPv4;case l.IPv6:return S.IPv6;default:throw Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(l)}`)}};var M=(e,t)=>{let n=300+Math.floor(Math.random()*300),o=new Date(Date.now()+n*1000);t.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(o)}.
|
|
3
3
|
For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let r=e.originalExpiration??e.expiration;return{...e,...r?{originalExpiration:r}:{},expiration:o}};var V=(e,t={})=>{let n=t?.logger||console,o;return async()=>{let r;try{if(r=await e(),r.expiration&&r.expiration.getTime()<Date.now())r=M(r,n)}catch(a){if(o)n.warn("Credential renew failed: ",a),r=M(o,n);else throw a}return o=r,r}};var W="/latest/meta-data/iam/security-credentials/",te="/latest/api/token",x="AWS_EC2_METADATA_V1_DISABLED",k="ec2_metadata_v1_disabled",U="x-aws-ec2-metadata-token",oe=(e={})=>V(re(e),{logger:e.logger}),re=(e={})=>{let t=!1,{logger:n,profile:o}=e,{timeout:r,maxRetries:a}=C(e),p=async(s,m)=>{if(t||m.headers?.[U]==null){let i=!1,c=!1,B=await u.loadConfig({environmentVariableSelector:(d)=>{let f=d[x];if(c=!!f&&f!=="false",f===void 0)throw new u.CredentialsProviderError(`${x} not set in env, checking config file next.`,{logger:e.logger});return c},configFileSelector:(d)=>{let f=d[k];return i=!!f&&f!=="false",i},default:!1},{profile:o})();if(e.ec2MetadataV1Disabled||B){let d=[];if(e.ec2MetadataV1Disabled)d.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(i)d.push(`config file profile (${k})`);if(c)d.push(`process environment variable (${x})`);throw new O(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${d.join(", ")}].`)}}let K=(await T(async()=>{let i;try{i=await ae(m)}catch(c){if(c.statusCode===401)t=!1;throw c}return i},s)).trim();return T(async()=>{let i;try{i=await se(K,m,e)}catch(c){if(c.statusCode===401)t=!1;throw c}return i},s)};return async()=>{let s=await b();if(t)return n?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),p(a,{...s,timeout:r});else{let m;try{m=(await ne({...s,timeout:r})).toString()}catch(I){if(I?.statusCode===400)throw Object.assign(I,{message:"EC2 Metadata token request returned error"});else if(I.message==="TimeoutError"||[403,404,405].includes(I.statusCode))t=!0;return n?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),p(a,{...s,timeout:r})}return p(a,{...s,headers:{[U]:m},timeout:r})}}},ne=async(e)=>E({...e,path:te,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),ae=async(e)=>(await E({...e,path:W})).toString(),se=async(e,t,n)=>{let o=JSON.parse((await E({...t,path:W+e})).toString());if(!N(o))throw new u.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:n.logger});return h(o)};export{A as ENV_CMDS_FULL_URI,g as ENV_CMDS_RELATIVE_URI,G as fromContainerMetadata,oe as fromInstanceMetadata};
|