@shumai-one/shumai 0.2.1 → 0.2.2
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-qag3w2dd.js → chunk-0aj303as.js} +1 -1
- package/bin/{chunk-976v5s8y.js → chunk-0qkj838r.js} +1 -1
- package/bin/{chunk-mg6fce5x.js → chunk-0rxhc7ka.js} +1 -1
- package/bin/chunk-0xbf8bcg.js +2 -0
- package/bin/{chunk-t1mxqskx.js → chunk-15sefy5t.js} +1 -1
- package/bin/{chunk-jfjcxyhf.js → chunk-1wm57c6y.js} +3 -3
- package/bin/{chunk-7ktvhtp1.js → chunk-1xpec5r8.js} +1 -1
- package/bin/chunk-23d3968z.js +2 -0
- package/bin/{chunk-y4s3xr4n.js → chunk-262hkppb.js} +2 -2
- package/bin/{chunk-qj2kpkje.js → chunk-29tx9qe2.js} +1 -1
- package/bin/{chunk-a5s5ny4z.js → chunk-2aamsc5v.js} +1 -1
- package/bin/{chunk-gd5xwgp6.js → chunk-2aascrtb.js} +1 -1
- package/bin/chunk-2g12s6mc.js +2 -0
- package/bin/{chunk-pv76qkym.js → chunk-31baz5n0.js} +1 -1
- package/bin/{chunk-hmsb7ehr.js → chunk-46ar48f9.js} +1 -1
- package/bin/chunk-4e3jbp84.js +1 -0
- package/bin/chunk-4jk0y1w1.js +1 -0
- package/bin/{chunk-ga0drqj7.js → chunk-4qpa7b5t.js} +1 -1
- package/bin/{chunk-99db4j0k.js → chunk-54tr7y2x.js} +1 -1
- package/bin/{chunk-9n783gva.js → chunk-5d2q46mx.js} +1 -1
- package/bin/{chunk-qf7n519d.js → chunk-5m9be8an.js} +2 -2
- package/bin/{chunk-1w9dnk5p.js → chunk-5r8858hx.js} +1 -1
- package/bin/{chunk-ydagqpny.js → chunk-5t6c3038.js} +1 -1
- package/bin/chunk-6z65xd0w.js +3 -0
- package/bin/{chunk-qjjr3fff.js → chunk-77r8w95d.js} +1 -1
- package/bin/chunk-7e06b2zb.js +2 -0
- package/bin/{chunk-58aabg1f.js → chunk-7hsgmjpa.js} +2 -2
- package/bin/{chunk-7mnezagc.js → chunk-88fg1sw7.js} +1 -1
- package/bin/{chunk-m11g9hx7.js → chunk-8mkfgcvb.js} +2 -2
- package/bin/chunk-8tf6kgdj.js +2 -0
- package/bin/{chunk-b9hb5jzt.js → chunk-8wqfkm4c.js} +1 -1
- package/bin/{chunk-ag35pxnb.js → chunk-922nnh39.js} +1 -1
- package/bin/{chunk-ymyyap80.js → chunk-925q4paa.js} +1 -1
- package/bin/{chunk-wfex9jw0.js → chunk-92xxys10.js} +6 -6
- package/bin/{chunk-0a5k9avd.js → chunk-97jzve52.js} +1 -1
- package/bin/{chunk-dzm2f82x.js → chunk-9ab6k4rq.js} +1 -1
- package/bin/{chunk-mwh2n8yt.js → chunk-9avkn3x1.js} +1 -1
- package/bin/{chunk-pmx9760x.js → chunk-9h027f50.js} +1 -1
- package/bin/chunk-av71yjaa.js +1 -0
- package/bin/{chunk-mjncyjwf.js → chunk-b8js74jk.js} +1 -1
- package/bin/{chunk-861dz0bf.js → chunk-bd71dp4j.js} +1 -1
- package/bin/{chunk-v3j7acwn.js → chunk-bs0fjz3w.js} +2 -2
- package/bin/chunk-byqc8tzq.js +1 -0
- package/bin/chunk-ccw7mjgq.js +5 -0
- package/bin/{chunk-kj751zje.js → chunk-cxhmr356.js} +1 -1
- package/bin/{chunk-hcz4snm7.js → chunk-d3wmdjze.js} +1 -1
- package/bin/{chunk-82w2419d.js → chunk-de99643r.js} +2 -2
- package/bin/{chunk-dwf5e5g3.js → chunk-dghtwyq1.js} +1 -1
- package/bin/{chunk-5k03xpzq.js → chunk-dqgv5yy1.js} +1 -1
- package/bin/{chunk-q72ax3m8.js → chunk-e3s3rz2e.js} +1 -1
- package/bin/{chunk-79n633wf.js → chunk-e52nga6c.js} +1 -1
- package/bin/{chunk-8abs8d48.js → chunk-e7ndw3hg.js} +2 -2
- package/bin/chunk-f14sqw1d.js +1 -0
- package/bin/chunk-f7sbkfmk.js +2 -0
- package/bin/{chunk-2xnys7v4.js → chunk-fa2g2wge.js} +1 -1
- package/bin/{chunk-044xt1se.js → chunk-fbte2rmd.js} +1 -1
- package/bin/{chunk-k1r17nfa.js → chunk-fcvtgx1y.js} +1 -1
- package/bin/chunk-fd5a3pdd.js +1 -0
- package/bin/{chunk-hqptebzb.js → chunk-fepymbka.js} +1 -1
- package/bin/{chunk-cpr05qng.js → chunk-fz88kkk1.js} +1 -1
- package/bin/chunk-g6zzg6v2.js +1 -0
- package/bin/{chunk-6724dtsx.js → chunk-g8th86na.js} +1 -1
- package/bin/chunk-gswbc6y9.js +2 -0
- package/bin/{chunk-pvy0gccg.js → chunk-gtrc5ka2.js} +1 -1
- package/bin/chunk-h0ytx8zc.js +2 -0
- package/bin/{chunk-mv8c5fky.js → chunk-hkbybhww.js} +1 -1
- package/bin/{chunk-e3c6hyz8.js → chunk-hr97a5j5.js} +1 -1
- package/bin/{chunk-7h75r7ep.js → chunk-j8qtab70.js} +1 -1
- package/bin/{chunk-jyjnt0s9.js → chunk-jf3vn5c3.js} +2 -2
- package/bin/{chunk-azfgjqjx.js → chunk-kfhtk3eh.js} +1 -1
- package/bin/chunk-kr06nrbx.js +2 -0
- package/bin/{chunk-nceqrqey.js → chunk-m4zpf9gg.js} +1 -1
- package/bin/{chunk-1ae8csk6.js → chunk-mqjzmn0e.js} +1 -1
- package/bin/{chunk-sp75qe28.js → chunk-mzg1h07d.js} +1 -1
- package/bin/{chunk-cj5qwc9c.js → chunk-nrwna4ha.js} +1 -1
- package/bin/chunk-nyhqy6q2.js +62 -0
- package/bin/{chunk-4zq8vxcy.css → chunk-pmswtfe3.css} +1 -1
- package/bin/chunk-pq18zenh.js +2 -0
- package/bin/{chunk-p3emandj.js → chunk-q24epdh8.js} +2 -2
- package/bin/{chunk-2djd6pq1.js → chunk-qksb0v3c.js} +2 -2
- package/bin/chunk-qqk51620.js +2 -0
- package/bin/chunk-r0w920zb.js +1 -0
- package/bin/{chunk-2dz8nn9v.js → chunk-re0b7sj7.js} +1 -1
- package/bin/{chunk-x9q2vzn8.js → chunk-rtngbgpk.js} +1 -1
- package/bin/{chunk-zn9jbc6t.js → chunk-ry33f2qk.js} +1 -1
- package/bin/{chunk-k5bekrrp.js → chunk-s46zwr4p.js} +1 -1
- package/bin/chunk-s8t74q9m.js +1 -0
- package/bin/chunk-sd86v1e6.js +1 -0
- package/bin/{chunk-v98yavtp.js → chunk-srn8t0v7.js} +1 -1
- package/bin/chunk-szzff7gd.js +1 -0
- package/bin/{chunk-46c5xkmn.js → chunk-t3t6021k.js} +1 -1
- package/bin/{chunk-jbde7evp.js → chunk-thsbcbay.js} +1 -1
- package/bin/chunk-tspps87j.js +1 -0
- package/bin/{chunk-v05d1aeq.js → chunk-w7dn1m95.js} +1 -1
- package/bin/{chunk-w1d5vmtc.js → chunk-wc8sc9r9.js} +1 -1
- package/bin/chunk-wg98cacx.js +2 -0
- package/bin/chunk-wsyg4rwg.js +2 -0
- package/bin/{chunk-ga3mh3cd.js → chunk-xcwbg4w9.js} +1 -1
- package/bin/{chunk-9bpjfkjf.js → chunk-xyjw8w3r.js} +1 -1
- package/bin/chunk-y2qp11v9.js +1 -0
- package/bin/{chunk-ngd23mtc.js → chunk-ybhgmvxa.js} +1 -1
- package/bin/{chunk-phw4ne8b.js → chunk-ygz6pawn.js} +1 -1
- package/bin/{chunk-hy50c4pw.js → chunk-ymeycphq.js} +2 -2
- package/bin/{chunk-c1v946wb.js → chunk-zemrvz79.js} +2 -2
- package/bin/{chunk-29pkpmvy.js → chunk-zzx99j8t.js} +1 -1
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +248 -224
- package/package.json +7 -7
- package/prisma/migrations/20260723025234_add_ai_usage_table/migration.sql +28 -0
- package/prisma/migrations/20260723032755_add_ai_usage_unique_constraint/migration.sql +8 -0
- package/prisma/schema.prisma +25 -0
- package/bin/chunk-211y81mp.js +0 -1
- package/bin/chunk-25d1g086.js +0 -2
- package/bin/chunk-4fnak2zn.js +0 -2
- package/bin/chunk-50ebjdkv.js +0 -2
- package/bin/chunk-5j7axztv.js +0 -2
- package/bin/chunk-6h4ay2p8.js +0 -2
- package/bin/chunk-6w5cn6p3.js +0 -3
- package/bin/chunk-75jka5v9.js +0 -5
- package/bin/chunk-9evm8x70.js +0 -1
- package/bin/chunk-bepnbw1g.js +0 -2
- package/bin/chunk-bg24g9kk.js +0 -1
- package/bin/chunk-dqtq9t8e.js +0 -1
- package/bin/chunk-fgnxtqtk.js +0 -1
- package/bin/chunk-fxvb6g2r.js +0 -1
- package/bin/chunk-kjkmh26f.js +0 -1
- package/bin/chunk-m3dwydr3.js +0 -2
- package/bin/chunk-mk1jewvw.js +0 -2
- package/bin/chunk-q9sgjs4d.js +0 -1
- package/bin/chunk-s2725w64.js +0 -1
- package/bin/chunk-saq5797j.js +0 -1
- package/bin/chunk-sy8rqacm.js +0 -2
- package/bin/chunk-t84t3v6q.js +0 -1
- package/bin/chunk-ttsqdsxr.js +0 -2
- package/bin/chunk-vreq89j6.js +0 -1
- package/bin/chunk-wbhsmhgp.js +0 -2
- package/bin/chunk-wf4d1anc.js +0 -62
- package/bin/chunk-xv4mfppt.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$ as v}from"./chunk-wsyg4rwg.js";import{Aa as x2,Ba as _5,Ca as h5,Da as g5,Ea as m5,Fa as k1,Ga as P1,Ha as O1,Ia as b5,Ja as c5,Ka as X2,La as e5,Ma as $1,Na as J1,Oa as h,Pa as Y2,Qa as T1,Ra as Z1,ga as _,ha as T2,ia as S5,ja as _0,ka as S2,la as f5,ma as f2,oa as y2,qa as E2,ra as E5,sa as I5,ta as D5,ua as x5,va as j5,wa as y5,xa as v5,ya as I2,za as D2}from"./chunk-srn8t0v7.js";import{Za as m0}from"./chunk-b8js74jk.js";import{gg as K2}from"./chunk-54tr7y2x.js";import{Dg as W0,Ig as P2,sg as S0,tg as y,yg as K5}from"./chunk-fz88kkk1.js";import{Og as F0}from"./chunk-dghtwyq1.js";import{Qg as e,Rg as L1,Tg as R1,Ug as A1,Vg as C1,dh as g0}from"./chunk-gswbc6y9.js";import{Bj as U1,Dj as F1,Ei as G5,Hj as w1,Ij as V1,Lh as n0,Mh as Y5,Mj as V0,Ri as q1,Sh as T0,Si as B1,Yj as f0,_i as W1,di as H1,fi as K1,gk as a0,hk as L0,ik as R0,jk as A0,mh as l,mk as I,nh as Q2,oh as H,oj as c2,ph as R,qh as Q1,sj as z1,ti as N1,tj as G1,vh as b2,vi as H2,wi as w0,xi as W5,yi as z5,yj as r0,zj as M1}from"./chunk-nyhqy6q2.js";import{Vk as d}from"./chunk-0qkj838r.js";var r2=Symbol.for("immer-nothing"),l2=Symbol.for("immer-draftable"),b=Symbol.for("immer-state");function u($,...J){throw Error(`[Immer] minified error nr: ${$}. Full error at: https://bit.ly/3cXEKWf`)}var C0=Object.getPrototypeOf;function B0($){return!!$&&!!$[b]}function X0($){if(!$)return!1;return a2($)||Array.isArray($)||!!$[l2]||!!$.constructor?.[l2]||O0($)||p0($)}var v1=Object.prototype.constructor.toString(),p2=new WeakMap;function a2($){if(!$||typeof $!=="object")return!1;let J=Object.getPrototypeOf($);if(J===null||J===Object.prototype)return!0;let Z=Object.hasOwnProperty.call(J,"constructor")&&J.constructor;if(Z===Object)return!0;if(typeof Z!=="function")return!1;let X=p2.get(Z);if(X===void 0)X=Function.toString.call(Z),p2.set(Z,X);return X===v1}function c0($,J,Z=!0){if(l0($)===0)(Z?Reflect.ownKeys($):Object.keys($)).forEach((Y)=>{J(Y,$[Y],$)});else $.forEach((X,Y)=>J(Y,X,$))}function l0($){let J=$[b];return J?J.type_:Array.isArray($)?1:O0($)?2:p0($)?3:0}function W2($,J){return l0($)===2?$.has(J):Object.prototype.hasOwnProperty.call($,J)}function t2($,J,Z){let X=l0($);if(X===2)$.set(J,Z);else if(X===3)$.add(Z);else $[J]=Z}function _1($,J){if($===J)return $!==0||1/$===1/J;else return $!==$&&J!==J}function O0($){return $ instanceof Map}function p0($){return $ instanceof Set}function Z0($){return $.copy_||$.base_}function z2($,J){if(O0($))return new Map($);if(p0($))return new Set($);if(Array.isArray($))return Array.prototype.slice.call($);let Z=a2($);if(J===!0||J==="class_only"&&!Z){let X=Object.getOwnPropertyDescriptors($);delete X[b];let Y=Reflect.ownKeys(X);for(let N=0;N<Y.length;N++){let Q=Y[N],K=X[Q];if(K.writable===!1)K.writable=!0,K.configurable=!0;if(K.get||K.set)X[Q]={configurable:!0,writable:!0,enumerable:K.enumerable,value:$[Q]}}return Object.create(C0($),X)}else{let X=C0($);if(X!==null&&Z)return{...$};let Y=Object.create(X);return Object.assign(Y,$)}}function w2($,J=!1){if(i0($)||B0($)||!X0($))return $;if(l0($)>1)Object.defineProperties($,{set:b0,add:b0,clear:b0,delete:b0});if(Object.freeze($),J)Object.values($).forEach((Z)=>w2(Z,!0));return $}function h1(){u(2)}var b0={value:h1};function i0($){if($===null||typeof $!=="object")return!0;return Object.isFrozen($)}var g1={};function Y0($){let J=g1[$];if(!J)u(0,$);return J}var k0;function e2(){return k0}function m1($,J){return{drafts_:[],parent_:$,immer_:J,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function i2($,J){if(J)Y0("Patches"),$.patches_=[],$.inversePatches_=[],$.patchListener_=J}function G2($){M2($),$.drafts_.forEach(b1),$.drafts_=null}function M2($){if($===k0)k0=$.parent_}function n2($){return k0=m1(k0,$)}function b1($){let J=$[b];if(J.type_===0||J.type_===1)J.revoke_();else J.revoked_=!0}function o2($,J){J.unfinalizedDrafts_=J.drafts_.length;let Z=J.drafts_[0];if($!==void 0&&$!==Z){if(Z[b].modified_)G2(J),u(4);if(X0($)){if($=u0(J,$),!J.parent_)d0(J,$)}if(J.patches_)Y0("Patches").generateReplacementPatches_(Z[b].base_,$,J.patches_,J.inversePatches_)}else $=u0(J,Z,[]);if(G2(J),J.patches_)J.patchListener_(J.patches_,J.inversePatches_);return $!==r2?$:void 0}function u0($,J,Z){if(i0(J))return J;let X=$.immer_.shouldUseStrictIteration(),Y=J[b];if(!Y)return c0(J,(N,Q)=>s2($,Y,J,N,Q,Z),X),J;if(Y.scope_!==$)return J;if(!Y.modified_)return d0($,Y.base_,!0),Y.base_;if(!Y.finalized_){Y.finalized_=!0,Y.scope_.unfinalizedDrafts_--;let N=Y.copy_,Q=N,K=!1;if(Y.type_===3)Q=new Set(N),N.clear(),K=!0;if(c0(Q,(G,z)=>s2($,Y,N,G,z,Z,K),X),d0($,N,!1),Z&&$.patches_)Y0("Patches").generatePatches_(Y,Z,$.patches_,$.inversePatches_)}return Y.copy_}function s2($,J,Z,X,Y,N,Q){if(Y==null)return;if(typeof Y!=="object"&&!Q)return;let K=i0(Y);if(K&&!Q)return;if(B0(Y)){let G=N&&J&&J.type_!==3&&!W2(J.assigned_,X)?N.concat(X):void 0,z=u0($,Y,G);if(t2(Z,X,z),B0(z))$.canAutoFreeze_=!1;else return}else if(Q)Z.add(Y);if(X0(Y)&&!K){if(!$.immer_.autoFreeze_&&$.unfinalizedDrafts_<1)return;if(J&&J.base_&&J.base_[X]===Y&&K)return;if(u0($,Y),(!J||!J.scope_.parent_)&&typeof X!=="symbol"&&(O0(Z)?Z.has(X):Object.prototype.propertyIsEnumerable.call(Z,X)))d0($,Y)}}function d0($,J,Z=!1){if(!$.parent_&&$.immer_.autoFreeze_&&$.canAutoFreeze_)w2(J,Z)}function c1($,J){let Z=Array.isArray($),X={type_:Z?1:0,scope_:J?J.scope_:e2(),modified_:!1,finalized_:!1,assigned_:{},parent_:J,base_:$,draft_:null,copy_:null,revoke_:null,isManual_:!1},Y=X,N=V2;if(Z)Y=[X],N=P0;let{revoke:Q,proxy:K}=Proxy.revocable(Y,N);return X.draft_=K,X.revoke_=Q,K}var V2={get($,J){if(J===b)return $;let Z=Z0($);if(!W2(Z,J))return u1($,Z,J);let X=Z[J];if($.finalized_||!X0(X))return X;if(X===q2($.base_,J))return B2($),$.copy_[J]=F2(X,$);return X},has($,J){return J in Z0($)},ownKeys($){return Reflect.ownKeys(Z0($))},set($,J,Z){let X=$5(Z0($),J);if(X?.set)return X.set.call($.draft_,Z),!0;if(!$.modified_){let Y=q2(Z0($),J),N=Y?.[b];if(N&&N.base_===Z)return $.copy_[J]=Z,$.assigned_[J]=!1,!0;if(_1(Z,Y)&&(Z!==void 0||W2($.base_,J)))return!0;B2($),U2($)}if($.copy_[J]===Z&&(Z!==void 0||(J in $.copy_))||Number.isNaN(Z)&&Number.isNaN($.copy_[J]))return!0;return $.copy_[J]=Z,$.assigned_[J]=!0,!0},deleteProperty($,J){if(q2($.base_,J)!==void 0||J in $.base_)$.assigned_[J]=!1,B2($),U2($);else delete $.assigned_[J];if($.copy_)delete $.copy_[J];return!0},getOwnPropertyDescriptor($,J){let Z=Z0($),X=Reflect.getOwnPropertyDescriptor(Z,J);if(!X)return X;return{writable:!0,configurable:$.type_!==1||J!=="length",enumerable:X.enumerable,value:Z[J]}},defineProperty(){u(11)},getPrototypeOf($){return C0($.base_)},setPrototypeOf(){u(12)}},P0={};c0(V2,($,J)=>{P0[$]=function(){return arguments[0]=arguments[0][0],J.apply(this,arguments)}});P0.deleteProperty=function($,J){return P0.set.call(this,$,J,void 0)};P0.set=function($,J,Z){return V2.set.call(this,$[0],J,Z,$[0])};function q2($,J){let Z=$[b];return(Z?Z0(Z):$)[J]}function u1($,J,Z){let X=$5(J,Z);return X?"value"in X?X.value:X.get?.call($.draft_):void 0}function $5($,J){if(!(J in $))return;let Z=C0($);while(Z){let X=Object.getOwnPropertyDescriptor(Z,J);if(X)return X;Z=C0(Z)}return}function U2($){if(!$.modified_){if($.modified_=!0,$.parent_)U2($.parent_)}}function B2($){if(!$.copy_)$.copy_=z2($.base_,$.scope_.immer_.useStrictShallowCopy_)}var d1=class{constructor($){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(J,Z,X)=>{if(typeof J==="function"&&typeof Z!=="function"){let N=Z;Z=J;let Q=this;return function(G=N,...z){return Q.produce(G,(M)=>Z.call(this,M,...z))}}if(typeof Z!=="function")u(6);if(X!==void 0&&typeof X!=="function")u(7);let Y;if(X0(J)){let N=n2(this),Q=F2(J,void 0),K=!0;try{Y=Z(Q),K=!1}finally{if(K)G2(N);else M2(N)}return i2(N,X),o2(Y,N)}else if(!J||typeof J!=="object"){if(Y=Z(J),Y===void 0)Y=J;if(Y===r2)Y=void 0;if(this.autoFreeze_)w2(Y,!0);if(X){let N=[],Q=[];Y0("Patches").generateReplacementPatches_(J,Y,N,Q),X(N,Q)}return Y}else u(1,J)},this.produceWithPatches=(J,Z)=>{if(typeof J==="function")return(Q,...K)=>this.produceWithPatches(Q,(G)=>J(G,...K));let X,Y;return[this.produce(J,Z,(Q,K)=>{X=Q,Y=K}),X,Y]},typeof $?.autoFreeze==="boolean")this.setAutoFreeze($.autoFreeze);if(typeof $?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy($.useStrictShallowCopy);if(typeof $?.useStrictIteration==="boolean")this.setUseStrictIteration($.useStrictIteration)}createDraft($){if(!X0($))u(8);if(B0($))$=l1($);let J=n2(this),Z=F2($,void 0);return Z[b].isManual_=!0,M2(J),Z}finishDraft($,J){let Z=$&&$[b];if(!Z||!Z.isManual_)u(9);let{scope_:X}=Z;return i2(X,J),o2(void 0,X)}setAutoFreeze($){this.autoFreeze_=$}setUseStrictShallowCopy($){this.useStrictShallowCopy_=$}setUseStrictIteration($){this.useStrictIteration_=$}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches($,J){let Z;for(Z=J.length-1;Z>=0;Z--){let Y=J[Z];if(Y.path.length===0&&Y.op==="replace"){$=Y.value;break}}if(Z>-1)J=J.slice(Z+1);let X=Y0("Patches").applyPatches_;if(B0($))return X($,J);return this.produce($,(Y)=>X(Y,J))}};function F2($,J){let Z=O0($)?Y0("MapSet").proxyMap_($,J):p0($)?Y0("MapSet").proxySet_($,J):c1($,J);return(J?J.scope_:e2()).drafts_.push(Z),Z}function l1($){if(!B0($))u(10,$);return J5($)}function J5($){if(!X0($)||i0($))return $;let J=$[b],Z,X=!0;if(J){if(!J.modified_)return J.base_;J.finalized_=!0,Z=z2($,J.scope_.immer_.useStrictShallowCopy_),X=J.scope_.immer_.shouldUseStrictIteration()}else Z=z2($,!0);if(c0(Z,(Y,N)=>{t2(Z,Y,J5(N))},X),J)J.finalized_=!1;return Z}var p1=new d1,Z5=p1.produce;var i1=($)=>(J,Z,X)=>{return X.setState=(Y,N,...Q)=>{let K=typeof Y==="function"?Z5(Y):Y;return J(K,N,...Q)},$(X.setState,Z,X)},X5=i1;var o0=n0()(Y5(X5(($,J)=>({members:[],loading:!1,fetchMembers:async(Z,X,Y)=>{if(!Y&&J().loadedTeamId===Z&&J().loadedWithAgents===X)return;$({loading:!0});try{let N=await T0.api.teams[":teamId"].members.$get({param:{teamId:Z},query:{includeAgents:X?"true":"false"}});if(!N.ok)throw Error("failed to fetch members");let Q=await N.json();$({members:Q||[],loadedTeamId:Z,loadedWithAgents:X,loading:!1})}catch{$({loading:!1})}}}))));var Q5=n0(($)=>({fields:[],loadedProjectId:null,setFields:(J,Z)=>$({fields:J,loadedProjectId:Z}),updateFields:(J)=>$({fields:J})}));function L2($,J,Z){let X=y($,Z?.in);if(isNaN(J))return S0(Z?.in||$,NaN);if(!J)return X;let Y=X.getDate(),N=S0(Z?.in||$,X.getTime());N.setMonth(X.getMonth()+J+1,0);let Q=N.getDate();if(Y>=Q)return N;else return X.setFullYear(N.getFullYear(),N.getMonth(),Y),X}function H5($,J){let Z=y($,J?.in),X=Z.getMonth();return Z.setFullYear(Z.getFullYear(),X+1,0),Z.setHours(23,59,59,999),Z}function N5($,J){let[Z,X]=K5($,J.start,J.end);return{start:Z,end:X}}function q5($,J){let{start:Z,end:X}=N5(J?.in,$),Y=+Z>+X,N=Y?+Z:+X,Q=Y?X:Z;Q.setHours(0,0,0,0);let K=J?.step??1;if(!K)return[];if(K<0)K=-K,Y=!Y;let G=[];while(+Q<=N)G.push(S0(Z,Q)),Q.setDate(Q.getDate()+K),Q.setHours(0,0,0,0);return Y?G.reverse():G}function s0($,J){return y($,J?.in).getDate()}function B5($,J){return y($,J?.in).getDay()}function R2($,J){return y($,J?.in).getHours()}function A2($,J){return y($,J?.in).getMinutes()}function C2($,J){return y($,J?.in).getMonth()}function k2($,J){return y($,J?.in).getFullYear()}var r=d(l(),1);var n1=({value:$,config:J,onSave:Z,readOnly:X})=>{let Y=J?.date,[N,Q]=r.useState(!1),K=r.useRef(null),G=$?new Date($):new Date,z=W0(G)?G:new Date,[M,U]=r.useState(z);r.useEffect(()=>{if(N&&$){let q=new Date($);if(W0(q))U(q)}},[N,$]),r.useEffect(()=>{let q=(C)=>{if(K.current&&!K.current.contains(C.target)){if(N)Q(!1)}};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[N]);let W=()=>{if(!X)Q(!0)},w=(q)=>{if(!q)return"";let C=new Date(q);if(!W0(C))return"Invalid Date";let T="PPP";if(Y?.displayFormat==="usa")T="MM/dd/yyyy";else if(Y?.displayFormat==="euro")T="dd/MM/yyyy";else if(Y?.displayFormat==="iso")T="yyyy-MM-dd";if(Y?.includeTime)if(Y?.timeFormat==="twenty_four_hour")T+=" HH:mm";else T+=" p";let D=P2(C,T);if(Y?.displayTimezone)D+=` (${Intl.DateTimeFormat().resolvedOptions().timeZone})`;return D},B=new Date(M.getFullYear(),M.getMonth(),1),O=H5(M),P=q5({start:B,end:O}),A=B5(B),S=(q)=>{let C=new Date(q);if(Y?.includeTime)C.setHours(R2(z)),C.setMinutes(A2(z));let T=C.toISOString();if(Z(T),!Y?.includeTime)Q(!1)},F=(q,C)=>{let T=$?new Date($):new Date;if(!W0(T))T.setTime(new Date().getTime());if(q==="hour")T.setHours(C);if(q==="minute")T.setMinutes(C);let D=T.toISOString();Z(D)},L=Array.from({length:24},(q,C)=>C),V=Array.from({length:12},(q,C)=>C*5);if(N)return R("div",{className:"relative w-full",ref:K,children:[H("div",{className:"w-full px-2 py-1 border border-ring rounded bg-background text-sm shadow-sm min-h-[28px] flex items-center",children:$?w($):H("span",{className:"text-muted-foreground",children:"Select date..."})}),R("div",{className:"absolute z-50 top-full left-0 mt-1 bg-popover border border-border rounded-lg shadow-xl flex flex-col md:flex-row overflow-hidden min-w-[280px]",children:[R("div",{className:"p-4 w-64",children:[R("div",{className:"flex justify-between items-center mb-4",children:[H("button",{onClick:()=>U(L2(M,-1)),className:"p-1 hover:bg-accent rounded",children:H(W5,{className:"w-4 h-4"})}),H("span",{className:"font-semibold text-sm",children:P2(M,"MMMM yyyy")}),H("button",{onClick:()=>U(L2(M,1)),className:"p-1 hover:bg-accent rounded",children:H(z5,{className:"w-4 h-4"})})]}),H("div",{className:"grid grid-cols-7 gap-1 text-center text-xs mb-2 text-muted-foreground",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map((q)=>H("div",{children:q},q))}),R("div",{className:"grid grid-cols-7 gap-1 text-center text-sm",children:[Array.from({length:A}).map((q,C)=>H("div",{},`empty-${C}`)),P.map((q)=>{let C=$?new Date($):null,T=C&&W0(C)&&s0(C)===s0(q)&&C2(C)===C2(q)&&k2(C)===k2(q);return H("button",{onClick:()=>S(q),className:`w-8 h-8 rounded-full flex items-center justify-center hover:bg-accent transition-colors ${T?"bg-primary text-primary-foreground hover:bg-primary/90":"text-foreground"}`,children:s0(q)},q.toString())})]})]}),Y?.includeTime&&R("div",{className:"border-l border-border bg-muted w-32 flex flex-col",children:[R("div",{className:"p-2 border-b border-border text-xs font-semibold text-muted-foreground flex items-center justify-center gap-1",children:[H(G5,{className:"w-3 h-3"})," Time"]}),R("div",{className:"flex flex-1 h-64",children:[H("div",{className:"flex-1 overflow-y-auto scrollbar-hide border-r border-border",children:L.map((q)=>H("div",{onClick:()=>F("hour",q),className:`px-2 py-1 text-center text-sm cursor-pointer hover:bg-accent ${R2(z)===q?"bg-primary/10 font-medium text-primary":""}`,children:q.toString().padStart(2,"0")},q))}),H("div",{className:"flex-1 overflow-y-auto scrollbar-hide",children:V.map((q)=>H("div",{onClick:()=>F("minute",q),className:`px-2 py-1 text-center text-sm cursor-pointer hover:bg-accent ${A2(z)===q?"bg-primary/10 font-medium text-primary":""}`,children:q.toString().padStart(2,"0")},q))})]})]})]})]});return H("div",{onClick:W,className:`w-full min-h-[28px] px-2 py-1 text-sm text-foreground rounded border border-transparent transition-colors ${!X?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:$?w($):H("span",{className:"text-muted-foreground italic",children:"Empty"})})},M5=n1;var p=d(l(),1);var o1=({value:$,onSave:J,readOnly:Z})=>{let[X,Y]=p.useState(!1),[N,Q]=p.useState($||""),K=p.useRef(null),G=p.useRef(null),[z,M]=p.useState(!1);p.useEffect(()=>{Q($||"")},[$]),p.useEffect(()=>{if(X&&K.current)K.current.focus(),M(!1)},[X]),p.useEffect(()=>{let B=(O)=>{if(z&&G.current&&!G.current.contains(O.target))M(!1)};if(z)document.addEventListener("mousedown",B);return()=>{document.removeEventListener("mousedown",B)}},[z]);let U=()=>{Y(!1),J(N)},W=(B)=>{B.stopPropagation(),M(!0)},w=(B)=>{if(B.stopPropagation(),!Z)Y(!0)};if(X)return H("textarea",{ref:K,value:N,onChange:(B)=>Q(B.target.value),onBlur:U,className:"w-full min-h-[80px] p-2 border border-ring rounded bg-background text-sm outline-none shadow-sm resize-none"});return R("div",{ref:G,className:"relative w-full text-sm",children:[H("div",{onClick:W,className:`w-full text-foreground rounded border border-transparent transition-all px-2 py-1 line-clamp-2 max-h-[3rem] overflow-hidden ${!Z?"cursor-pointer hover:bg-accent hover:border-border":"cursor-pointer"}`,title:"Click to expand",children:$?$:H("span",{className:"text-muted-foreground italic",children:"Empty"})}),z&&H("div",{onClick:w,className:`absolute top-0 left-0 w-full min-h-full h-auto z-50 bg-background border border-ring rounded shadow-lg px-2 py-1 whitespace-pre-wrap ${!Z?"cursor-text":""}`,children:$?$:H("span",{className:"text-muted-foreground italic",children:"Empty"})})]})},U5=o1;var a=d(l(),1);var s1=({value:$,config:J,onSave:Z,readOnly:X})=>{let Y=J?.number,[N,Q]=a.useState(!1),[K,G]=a.useState(""),z=a.useRef(null);a.useEffect(()=>{G($!==void 0&&$!==null?$.toString():"")},[$]),a.useEffect(()=>{if(N&&z.current)z.current.focus()},[N]);let M=()=>{if(!X)Q(!0)},U=()=>{if(Q(!1),K==="")Z(void 0);else{let B=parseFloat(K);Z(isNaN(B)?void 0:B)}},W=(B)=>{if(B.key==="Enter")B.stopPropagation(),z.current?.blur()},w=(B)=>{if(B===void 0||B===null||isNaN(B))return"";return B.toFixed(Y?.scale)};if(N)return H("input",{ref:z,type:"number",step:1/Math.pow(10,Y?.scale||0),value:K,onChange:(B)=>G(B.target.value),onBlur:U,onKeyDown:W,onDoubleClick:(B)=>B.stopPropagation(),className:"w-full px-2 py-1 border border-ring rounded bg-background text-sm outline-none shadow-sm text-left font-mono"});return H("div",{onClick:M,onDoubleClick:(B)=>B.stopPropagation(),className:`w-full min-h-[28px] px-2 py-1 text-sm text-foreground rounded border border-transparent transition-colors text-left font-mono ${!X?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:$!==void 0&&$!==null?w($):H("span",{className:"text-muted-foreground italic font-sans text-left block",children:"Empty"})})},F5=s1;var w5=d(l(),1);var r1=({value:$,config:J,onSave:Z,readOnly:X})=>{let Y=J?.rating,N=Math.max(2,Math.min(6,Y?.maxValue||5)),[Q,K]=w5.useState(null),G=(M,U)=>{if(M.stopPropagation(),X)return;let W;if($===U)W=0;else W=U;Z(W)},z=Array.from({length:N},(M,U)=>U+1);return H("div",{className:"flex items-center gap-1 h-[28px]",onMouseLeave:()=>!X&&K(null),onDoubleClick:(M)=>M.stopPropagation(),children:z.map((M)=>{let U=Q!==null?M<=Q:M<=($||0);return H("button",{onClick:(W)=>G(W,M),onMouseEnter:()=>!X&&K(M),className:`focus:outline-none transition-transform ${!X?"cursor-pointer hover:scale-110":"cursor-default"}`,type:"button",disabled:X,children:H(r0,{className:`w-5 h-5 transition-colors ${U?"fill-yellow-400 text-yellow-400":"fill-muted text-muted-foreground/30"}`})},M)})})},V5=r1;var S1=d(l(),1);function i({...$}){return H(f0.Root,{"data-slot":"popover",...$})}function n({...$}){return H(f0.Trigger,{"data-slot":"popover-trigger",...$})}function o({className:$,align:J="center",sideOffset:Z=4,...X}){return H(f0.Portal,{children:H(f0.Content,{"data-slot":"popover-content",align:J,sideOffset:Z,className:a0("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",$),...X})})}var Q0;(function($){$.Base32IncorrectEncoding="B32_ENC_INVALID",$.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",$.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",$.EncodeTimeNegative="ENC_TIME_NEG",$.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",$.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",$.PRNGDetectFailure="PRNG_DETECT",$.ULIDInvalid="ULID_INVALID",$.Unexpected="UNEXPECTED",$.UUIDInvalid="UUID_INVALID"})(Q0||(Q0={}));class z0 extends Error{constructor($,J){super(`${J} (${$})`);this.name="ULIDError",this.code=$}}function a1($){let J=Math.floor($()*32)%32;return"0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt(J)}function t1($){let J=e1(),Z=J&&(J.crypto||J.msCrypto)||null;if(typeof Z?.getRandomValues==="function")return()=>{let X=new Uint8Array(1);return Z.getRandomValues(X),X[0]/256};else if(typeof Z?.randomBytes==="function")return()=>Z.randomBytes(1).readUInt8()/256;throw new z0(Q0.PRNGDetectFailure,"Failed to find a reliable PRNG")}function e1(){if(Z4())return self;if(typeof window<"u")return window;if(typeof global<"u")return global;if(typeof globalThis<"u")return globalThis;return null}function $4($,J){let Z="";for(;$>0;$--)Z=a1(J)+Z;return Z}function J4($,J=10){if(isNaN($))throw new z0(Q0.EncodeTimeValueMalformed,`Time must be a number: ${$}`);else if($>281474976710655)throw new z0(Q0.EncodeTimeSizeExceeded,`Cannot encode a time larger than 281474976710655: ${$}`);else if($<0)throw new z0(Q0.EncodeTimeNegative,`Time must be positive: ${$}`);else if(Number.isInteger($)===!1)throw new z0(Q0.EncodeTimeValueMalformed,`Time must be an integer: ${$}`);let Z,X="";for(let Y=J;Y>0;Y--)Z=$%32,X="0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt(Z)+X,$=($-Z)/32;return X}function Z4(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function L5($,J){let Z=J||t1(),X=!$||isNaN($)?Date.now():$;return J4(X,10)+$4(16,Z)}var h0=d(l(),1);var{create:X4,defineProperty:u5,defineProperties:Y4,getOwnPropertyDescriptor:Q4,getOwnPropertyDescriptors:H4,getOwnPropertySymbols:Z2}=Object,d5=Object.prototype.hasOwnProperty,l5=Object.prototype.propertyIsEnumerable,K4=($,J)=>(J=Symbol[$])?J:Symbol.for("Symbol."+$),y0=($)=>{throw TypeError($)},j2=($,J,Z)=>(J in $)?u5($,J,{enumerable:!0,configurable:!0,writable:!0,value:Z}):$[J]=Z,R5=($,J)=>{for(var Z in J||(J={}))if(d5.call(J,Z))j2($,Z,J[Z]);if(Z2){for(var Z of Z2(J))if(l5.call(J,Z))j2($,Z,J[Z])}return $},A5=($,J)=>Y4($,H4(J)),N4=($,J)=>{var Z={};for(var X in $)if(d5.call($,X)&&J.indexOf(X)<0)Z[X]=$[X];if($!=null&&Z2){for(var X of Z2($))if(J.indexOf(X)<0&&l5.call($,X))Z[X]=$[X]}return Z},q4=($)=>{var J;return[,,,X4((J=void 0)!=null?J:null)]},p5=["class","method","getter","setter","accessor","field","value","get","set"],I0=($)=>$!==void 0&&typeof $!=="function"?y0("Function expected"):$,B4=($,J,Z,X,Y)=>({kind:p5[$],name:J,metadata:X,addInitializer:(N)=>Z._?y0("Already initialized"):Y.push(I0(N||null))}),W4=($,J)=>j2(J,K4("metadata"),$[3]),t0=($,J,Z,X)=>{for(var Y=0,N=$[J>>1],Q=N&&N.length;Y<Q;Y++)J&1?N[Y].call(Z):X=N[Y].call(Z,X);return X},i5=($,J,Z,X,Y,N)=>{var Q,K,G,z,M,U=J&7,W=!1,w=!1,B=$.length+1,O=p5[U+5],P=$[B-1]=[],A=$[B]||($[B]=[]),S=(Y=Y.prototype,Q4({get[Z](){return D0(this,N)},set[Z](L){return H0(this,N,L)}},Z));for(var F=X.length-1;F>=0;F--)if(z=B4(U,Z,G={},$[3],A),z.static=W,z.private=w,M=z.access={has:(L)=>(Z in L)},M.get=(L)=>L[Z],M.set=(L,V)=>L[Z]=V,K=(0,X[F])({get:S.get,set:S.set},z),G._=1,K===void 0)I0(K)&&(S[O]=K);else if(typeof K!=="object"||K===null)y0("Object expected");else I0(Q=K.get)&&(S.get=Q),I0(Q=K.set)&&(S.set=Q),I0(Q=K.init)&&P.unshift(Q);return S&&u5(Y,Z,S),Y},n5=($,J,Z)=>J.has($)||y0("Cannot "+Z),D0=($,J,Z)=>(n5($,J,"read from private field"),J.get($)),E0=($,J,Z)=>J.has($)?y0("Cannot add the same private member more than once"):J instanceof WeakSet?J.add($):J.set($,Z),H0=($,J,Z,X)=>(n5($,J,"write to private field"),J.set($,Z),Z);function K0($){return $ instanceof g2||$ instanceof r5}var e0=10,z4=class extends y2{constructor($){super($);let J=S5(()=>{let{dragOperation:X}=$;if(!x2(X.activatorEvent))return;if(!K0(X.source))return;if(X.status.initialized){let Y=$.registry.plugins.get(m5);if(Y)return Y.disable(),()=>Y.enable()}}),Z=$.monitor.addEventListener("dragmove",(X,Y)=>{queueMicrotask(()=>{if(this.disabled||X.defaultPrevented||!X.nativeEvent)return;let{dragOperation:N}=Y;if(!x2(X.nativeEvent))return;if(!K0(N.source))return;if(!N.shape)return;let{actions:Q,collisionObserver:K,registry:G}=Y,{by:z}=X;if(!z)return;let M=G4(z),{source:U,target:W}=N,{center:w}=N.shape.current,B=[],O=[];_(()=>{for(let V of G.droppables){let{id:q}=V;if(!V.accepts(U)||q===(W==null?void 0:W.id)&&K0(V)||!V.element)continue;let C=V.shape,T=new D2(V.element,{getBoundingClientRect:(D)=>I5(D,void 0,0.2)});if(!T.height||!T.width)continue;if(M=="down"&&w.y+e0<T.center.y||M=="up"&&w.y-e0>T.center.y||M=="left"&&w.x-e0>T.center.x||M=="right"&&w.x+e0<T.center.x)B.push(V),V.shape=T,O.push(()=>V.shape=C)}}),X.preventDefault(),K.disable();let P=K.computeCollisions(B,h5);_(()=>O.forEach((V)=>V()));let[A]=P;if(!A)return;let{id:S}=A,{index:F,group:L}=U.sortable;Q.setDropTarget(S).then(()=>{let{source:V,target:q,shape:C}=N;if(!V||!K0(V)||!C)return;let{index:T,group:D,target:x}=V.sortable,g=F!==T||L!==D,m=g?x:q==null?void 0:q.element;if(!m)return;y5(m);let k=new D2(m);if(!k)return;let f=f2.delta(k,f2.from(C.current.boundingRectangle),V.alignment);if(Q.move({by:f}),g)Q.setDropTarget(V.id).then(()=>K.enable());else K.enable()})})});this.destroy=()=>{Z(),J()}}};function G4($){let{x:J,y:Z}=$;if(J>0)return"right";else if(J<0)return"left";else if(Z>0)return"down";else if(Z<0)return"up"}var{defineProperty:M4,defineProperties:U4,getOwnPropertyDescriptors:F4,getOwnPropertySymbols:C5}=Object,w4=Object.prototype.hasOwnProperty,V4=Object.prototype.propertyIsEnumerable,k5=($,J,Z)=>(J in $)?M4($,J,{enumerable:!0,configurable:!0,writable:!0,value:Z}):$[J]=Z,G0=($,J)=>{for(var Z in J||(J={}))if(w4.call(J,Z))k5($,Z,J[Z]);if(C5){for(var Z of C5(J))if(V4.call(J,Z))k5($,Z,J[Z])}return $},M0=($,J)=>U4($,F4(J));function L4($,J,Z){if(J===Z)return $;let X=$.slice();return X.splice(Z,0,X.splice(J,1)[0]),X}function O2($){return"initialIndex"in $&&typeof $.initialIndex==="number"&&"index"in $&&typeof $.index==="number"}function R4($,J,Z){var X,Y,N;let{source:Q,target:K,canceled:G}=J.operation;if(!Q||!K||G){if("preventDefault"in J)J.preventDefault();return $}let z=(L,V)=>L===V||typeof L==="object"&&("id"in L)&&L.id===V;if(Array.isArray($)){let L=$.findIndex((q)=>z(q,Q.id)),V=$.findIndex((q)=>z(q,K.id));if(L===-1||V===-1){if(O2(Q)){let{initialIndex:q,index:C}=Q;if(q===C||q<0||q>=$.length){if("preventDefault"in J)J.preventDefault();return $}return Z($,q,C)}return $}if(!G&&"index"in Q&&typeof Q.index==="number"){let q=Q.index;if(q!==L)return Z($,L,q)}return Z($,L,V)}let M=Object.entries($),U=-1,W,w=-1,B;for(let[L,V]of M){if(U===-1){if(U=V.findIndex((q)=>z(q,Q.id)),U!==-1)W=L}if(w===-1){if(w=V.findIndex((q)=>z(q,K.id)),w!==-1)B=L}if(U!==-1&&w!==-1)break}if(U===-1&&O2(Q)){let{initialGroup:L,initialIndex:V,group:q,index:C}=Q;if(L==null||q==null||!(L in $)||!(q in $)){if("preventDefault"in J)J.preventDefault();return $}if(L===q&&V===C){if("preventDefault"in J)J.preventDefault();return $}if(L===q)return M0(G0({},$),{[L]:Z($[L],V,C)});let T=$[L][V];return M0(G0({},$),{[L]:[...$[L].slice(0,V),...$[L].slice(V+1)],[q]:[...$[q].slice(0,C),T,...$[q].slice(C)]})}if(!Q.manager)return $;let{dragOperation:O}=Q.manager,P=(Y=(X=O.shape)==null?void 0:X.current.center)!=null?Y:O.position.current;if(B==null){if(K.id in $){let L=K.shape&&P.y>K.shape.center.y?$[K.id].length:0;B=K.id,w=L}}if(W==null||B==null||W===B&&U===w){if(W!=null&&W===B&&U===w&&O2(Q)){let L=Q.group!=null&&Q.group!==W,V=Q.index!==U;if(L||V){let q=(N=Q.group)!=null?N:W;if(q in $){if(W===q)return M0(G0({},$),{[W]:Z($[W],U,Q.index)});let C=$[W][U];return M0(G0({},$),{[W]:[...$[W].slice(0,U),...$[W].slice(U+1)],[q]:[...$[q].slice(0,Q.index),C,...$[q].slice(Q.index)]})}}}if("preventDefault"in J)J.preventDefault();return $}if(W===B)return M0(G0({},$),{[W]:Z($[W],U,w)});let S=K.shape&&Math.round(P.y)>Math.round(K.shape.center.y)?1:0,F=$[W][U];return M0(G0({},$),{[W]:[...$[W].slice(0,U),...$[W].slice(U+1)],[B]:[...$[B].slice(0,w+S),F,...$[B].slice(w+S)]})}function A4($,J){return R4($,J,L4)}var P5="__default__",C4=class extends y2{constructor($){super($);let J=()=>{let X=new Map;for(let Y of $.registry.droppables)if(Y instanceof g2){let{sortable:N}=Y,{group:Q}=N,K=X.get(Q);if(!K)K=new Set,X.set(Q,K);K.add(N)}for(let[Y,N]of X)X.set(Y,new Set($2(N)));return X},Z=[$.monitor.addEventListener("dragover",(X,Y)=>{if(this.disabled)return;let{dragOperation:N}=Y,{source:Q,target:K}=N;if(!K0(Q)||!K0(K))return;if(Q.sortable===K.sortable)return;let G=J(),z=Q.sortable.group===K.sortable.group,M=G.get(Q.sortable.group),U=z?M:G.get(K.sortable.group);if(!M||!U)return;queueMicrotask(()=>{if(X.defaultPrevented)return;Y.renderer.rendering.then(()=>{var W,w,B;let O=J();for(let[x,g]of G.entries()){let m=Array.from(g).entries();for(let[k,f]of m)if(f.index!==k||f.group!==x||!((W=O.get(x))==null?void 0:W.has(f)))return}let P=Q.sortable.element,A=K.sortable.element;if(!A||!P)return;if(!z&&K.id===Q.sortable.group)return;let S=$2(M),F=z?S:$2(U),L=(w=Q.sortable.group)!=null?w:P5,V=(B=K.sortable.group)!=null?B:P5,q={[L]:S,[V]:F},C=A4(q,X);if(q===C)return;let T=C[V].indexOf(Q.sortable),D=C[V].indexOf(K.sortable);Y.collisionObserver.disable(),O5(P,T,A,D),_(()=>{for(let[x,g]of C[L].entries())g.index=x;if(!z)for(let[x,g]of C[V].entries())g.group=K.sortable.group,g.index=x}),Y.actions.setDropTarget(Q.id).then(()=>Y.collisionObserver.enable())})})}),$.monitor.addEventListener("dragend",(X,Y)=>{if(!X.canceled)return;let{dragOperation:N}=Y,{source:Q}=N;if(!K0(Q))return;if(Q.sortable.initialIndex===Q.sortable.index&&Q.sortable.initialGroup===Q.sortable.group)return;queueMicrotask(()=>{let K=J(),G=K.get(Q.sortable.initialGroup);if(!G)return;Y.renderer.rendering.then(()=>{for(let[w,B]of K.entries()){let O=Array.from(B).entries();for(let[P,A]of O)if(A.index!==P||A.group!==w)return}let z=$2(G),M=Q.sortable.element,U=z[Q.sortable.initialIndex],W=U==null?void 0:U.element;if(!U||!W||!M)return;O5(M,U.index,W,Q.index),_(()=>{for(let[w,B]of K.entries()){let O=Array.from(B).values();for(let P of O)P.index=P.initialIndex,P.group=P.initialGroup}})})})})];this.destroy=()=>{for(let X of Z)X()}}};function O5($,J,Z,X){let Y=X<J?"afterend":"beforebegin";Z.insertAdjacentElement(Y,$)}function k4($,J){return $.index-J.index}function $2($){return Array.from($).sort(k4)}var T5=[z4,C4],v2={duration:250,easing:"cubic-bezier(0.25, 1, 0.5, 1)",idle:!1},J2=new f5,o5,s5,t,_2,x0,j0,h2,U0;s5=[S2],o5=[S2];var v0=class{constructor($,J){E0(this,_2,t0(t,8,this)),t0(t,11,this),E0(this,x0),E0(this,j0),E0(this,h2,t0(t,12,this)),t0(t,15,this),E0(this,U0),this.register=()=>{return _(()=>{var W,w;(W=this.manager)==null||W.registry.register(this.droppable),(w=this.manager)==null||w.registry.register(this.draggable)}),()=>this.unregister()},this.unregister=()=>{_(()=>{var W,w;(W=this.manager)==null||W.registry.unregister(this.droppable),(w=this.manager)==null||w.registry.unregister(this.draggable)})},this.destroy=()=>{_(()=>{this.droppable.destroy(),this.draggable.destroy()})};var Z=$,{effects:X=()=>[],group:Y,index:N,sensors:Q,type:K,transition:G=v2,plugins:z}=Z,M=N4(Z,["effects","group","index","sensors","type","transition","plugins"]);let U=E2(z,T5);this.droppable=new g2(M,J,this),this.draggable=new r5(A5(R5({},M),{plugins:U,effects:()=>[()=>{var W,w,B;let O=(W=this.manager)==null?void 0:W.dragOperation.status;if((O==null?void 0:O.initializing)&&this.id===((B=(w=this.manager)==null?void 0:w.dragOperation.source)==null?void 0:B.id))J2.clear(this.manager);if(O==null?void 0:O.dragging)J2.set(this.manager,this.id,T2(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{let{index:W,group:w,manager:B}=this,O=D0(this,j0),P=D0(this,x0);if(W!==O||w!==P)H0(this,j0,W),H0(this,x0,w),this.animate()},()=>{var W,w;let{target:B}=this,{isDragSource:O}=this.draggable;if(((w=(W=this.draggable.pluginConfig(g5))==null?void 0:W.feedback)!=null?w:"default")==="move"&&O)this.droppable.disabled=!B},...X()],type:K,sensors:Q}),J,this),H0(this,U0,M.element),this.manager=J,this.index=N,H0(this,j0,N),this.group=Y,H0(this,x0,Y),this.type=K,this.transition=G}get initialIndex(){var $,J;return(J=($=J2.get(this.manager,this.id))==null?void 0:$.initialIndex)!=null?J:this.index}get initialGroup(){var $,J;return(J=($=J2.get(this.manager,this.id))==null?void 0:$.initialGroup)!=null?J:this.group}animate(){T2(()=>{let{manager:$,transition:J}=this,{shape:Z}=this.droppable;if(!$)return;let{idle:X}=$.dragOperation.status;if(!Z||!J||X&&!J.idle)return;$.renderer.rendering.then(()=>{let{element:Y}=this;if(!Y)return;for(let M of Y.getAnimations())if("transitionProperty"in M&&(M.transitionProperty==="transform"||M.transitionProperty==="translate"||M.transitionProperty==="scale"))M.cancel();let N=this.refreshShape();if(!N)return;let Q={x:Z.boundingRectangle.left-N.boundingRectangle.left,y:Z.boundingRectangle.top-N.boundingRectangle.top},{translate:K}=j5(Y),G=I2(Y,K,!1),z=I2(Y,K);if(Q.x||Q.y){let M=D5(E5(Y))?A5(R5({},J),{duration:0}):J;v5({element:Y,keyframes:{translate:[`${G.x+Q.x}px ${G.y+Q.y}px ${G.z}`,`${z.x}px ${z.y}px ${z.z}`]},options:M}).then(()=>{if(!$.dragOperation.status.dragging)this.droppable.shape=void 0})}})})}get manager(){return this.draggable.manager}set manager($){_(()=>{this.draggable.manager=$,this.droppable.manager=$})}set element($){_(()=>{let J=D0(this,U0),Z=this.droppable.element,X=this.draggable.element;if(!Z||Z===J)this.droppable.element=$;if(!X||X===J)this.draggable.element=$;H0(this,U0,$)})}get element(){var $,J;let Z=D0(this,U0);if(!Z)return;return(J=($=x5.get(Z))!=null?$:Z)!=null?J:this.droppable.element}set target($){this.droppable.element=$}get target(){return this.droppable.element}set source($){this.draggable.element=$}get source(){return this.draggable.element}get disabled(){return this.draggable.disabled&&this.droppable.disabled}set plugins($){this.draggable.plugins=E2($,T5)}set disabled($){_(()=>{this.droppable.disabled=$,this.draggable.disabled=$})}set data($){_(()=>{this.droppable.data=$,this.draggable.data=$})}set handle($){this.draggable.handle=$}set id($){this.droppable.id=$,this.draggable.id=$}get id(){return this.droppable.id}set sensors($){this.draggable.sensors=$}set modifiers($){this.draggable.modifiers=$}set collisionPriority($){this.droppable.collisionPriority=$}set collisionDetector($){this.droppable.collisionDetector=$!=null?$:_5}set alignment($){this.draggable.alignment=$}get alignment(){return this.draggable.alignment}set type($){_(()=>{this.droppable.type=$,this.draggable.type=$})}get type(){return this.draggable.type}set accept($){this.droppable.accept=$}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts($){return this.droppable.accepts($)}};t=q4();_2=new WeakMap;x0=new WeakMap;j0=new WeakMap;h2=new WeakMap;U0=new WeakMap;i5(t,4,"index",s5,v0,_2);i5(t,4,"group",o5,v0,h2);W4(t,v0);var r5=class extends b5{constructor($,J,Z){super($,J);this.sortable=Z}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},g2=class extends c5{constructor($,J,Z){super($,J);this.sortable=Z}get index(){return this.sortable.index}get group(){return this.sortable.group}};var{defineProperty:P4,defineProperties:O4,getOwnPropertyDescriptors:T4,getOwnPropertySymbols:a5}=Object,S4=Object.prototype.hasOwnProperty,f4=Object.prototype.propertyIsEnumerable,t5=($,J,Z)=>(J in $)?P4($,J,{enumerable:!0,configurable:!0,writable:!0,value:Z}):$[J]=Z,m2=($,J)=>{for(var Z in J||(J={}))if(S4.call(J,Z))t5($,Z,J[Z]);if(a5){for(var Z of a5(J))if(f4.call(J,Z))t5($,Z,J[Z])}return $},E4=($,J)=>O4($,T4(J));function X1($){let{accept:J,collisionDetector:Z,collisionPriority:X,id:Y,data:N,element:Q,handle:K,index:G,group:z,disabled:M,modifiers:U,sensors:W,target:w,type:B,plugins:O}=$,P=m2(m2({},v2),$.transition),A=Z1((F)=>{return new v0(E4(m2({},$),{transition:P,register:!1,handle:X2(K),element:X2(Q),target:X2(w)}),F)}),S=$1(A,I4);return h(Y,()=>A.id=Y),e5(()=>{_(()=>{A.group=z,A.index=G})},[A,z,G]),h(B,()=>A.type=B),h(J,()=>A.accept=J,void 0,_0),h(N,()=>N&&(A.data=N)),h(G,()=>{var F;if(((F=A.manager)==null?void 0:F.dragOperation.status.idle)&&(P==null?void 0:P.idle))A.refreshShape()},J1),Y2(K,(F)=>A.handle=F),Y2(Q,(F)=>A.element=F),Y2(w,(F)=>A.target=F),h(M,()=>A.disabled=M===!0),h(W,()=>A.sensors=W),h(Z,()=>A.collisionDetector=Z),h(X,()=>A.collisionPriority=X),h(O,()=>A.plugins=O,void 0,_0),h(P,()=>A.transition=P,void 0,_0),h(U,()=>A.modifiers=U,void 0,_0),h($.alignment,()=>A.alignment=$.alignment),{sortable:S,get isDragging(){return S.isDragging},get isDropping(){return S.isDropping},get isDragSource(){return S.isDragSource},get isDropTarget(){return S.isDropTarget},handleRef:h0.useCallback((F)=>{A.handle=F!=null?F:void 0},[A]),ref:h0.useCallback((F)=>{var L,V;if(!F&&((L=A.element)==null?void 0:L.isConnected)&&!((V=A.manager)==null?void 0:V.dragOperation.status.idle))return;A.element=F!=null?F:void 0},[A]),sourceRef:h0.useCallback((F)=>{var L,V;if(!F&&((L=A.source)==null?void 0:L.isConnected)&&!((V=A.manager)==null?void 0:V.dragOperation.status.idle))return;A.source=F!=null?F:void 0},[A]),targetRef:h0.useCallback((F)=>{var L,V;if(!F&&((L=A.target)==null?void 0:L.isConnected)&&!((V=A.manager)==null?void 0:V.dragOperation.status.idle))return;A.target=F!=null?F:void 0},[A])}}function I4($,J,Z){if($==="isDragSource"&&!Z&&J)return!0;return!1}function Y1($,J,Z){let X=$.slice();return X.splice(Z,0,X.splice(J,1)[0]),X}async function H$($){let J=[],Z=[],X=$.items;if(X)for(let Q=0;Q<X.length;Q++){let K=X[Q];if(K.kind==="file"){let G=K.webkitGetAsEntry?.();if(G)Z.push({entry:G,path:""})}}else return Array.from($.files);let Y=(Q)=>{return new Promise((K)=>{Q.readEntries((G)=>K(G),()=>K([]))})},N=(Q)=>{return new Promise((K,G)=>{Q.file((z)=>K(z),(z)=>G(z))})};while(Z.length>0){let Q=Z.shift();if(!Q)continue;let{entry:K,path:G}=Q;if(K.isFile)try{let z=await N(K),M=G?`${G}/${z.name}`:z.name;Object.defineProperty(z,"webkitRelativePath",{value:M,writable:!1,configurable:!0}),J.push(z)}catch(z){console.error("Error reading file entry:",z)}else if(K.isDirectory){let z=K.createReader(),M=[],U=await Y(z);while(U.length>0)M=M.concat(U),U=await Y(z);let W=G?`${G}/${K.name}`:K.name;for(let w of M)Z.push({entry:w,path:W})}}return J}var c=d(l(),1);var D4=["red","orange","yellow","green","blue","purple","gray"],u2={red:{bg:"rgba(239, 68, 68, 0.15)",text:"#ef4444",hex:"#ef4444"},orange:{bg:"rgba(249, 115, 22, 0.15)",text:"#f97316",hex:"#f97316"},yellow:{bg:"rgba(234, 179, 8, 0.15)",text:"#ca8a04",hex:"#eab308"},green:{bg:"rgba(34, 197, 94, 0.15)",text:"#16a34a",hex:"#22c55e"},blue:{bg:"rgba(59, 130, 246, 0.15)",text:"#2563eb",hex:"#3b82f6"},purple:{bg:"rgba(168, 85, 247, 0.15)",text:"#9333ea",hex:"#a855f7"},gray:{bg:"rgba(128, 128, 128, 0.15)",text:"#4b5563",hex:"#808080"},system:{bg:"rgba(128, 128, 128, 0.1)",text:"#6b7280",hex:"#808080"}};function N0($){if(!$)return{backgroundColor:"rgba(128, 128, 128, 0.1)",color:"#6b7280"};let J=$.toLowerCase(),Z=u2[J];if(Z)return{backgroundColor:Z.bg,color:Z.text};if($.startsWith("#"))return{backgroundColor:`${$}33`,color:$};return{backgroundColor:"rgba(128, 128, 128, 0.1)",color:$}}var x4={[v.text]:F1,[v.longText]:K1,[v.select]:W1,[v.selectMulti]:M1,[v.rating]:r0,[v.number]:B1,[v.toggle]:U1,[v.date]:N1,[v.user]:w1,[v.userMulti]:V1};function j4({field:$,index:J,onVisibilityChange:Z}){let{ref:X,handleRef:Y}=X1({id:$.id,index:J}),N=$.config?.type?x4[$.config.type]:null;return R("div",{ref:X,className:"flex items-center justify-between p-2 rounded-md hover:bg-muted",children:[R("div",{className:"flex items-center gap-2",children:[H("div",{ref:Y,className:"cursor-grab",children:H(q1,{className:"h-4 w-4 text-muted-foreground"})}),N&&H(N,{className:"h-4 w-4 text-muted-foreground shrink-0"}),$.aiAutofill&&H(H1,{className:"h-4 w-4 text-muted-foreground shrink-0"}),H("span",{className:"text-sm truncate",children:$.config?.name})]}),H(m0,{checked:$.visible,onCheckedChange:(Q)=>Z($.id,Q)})]})}function O$({projectId:$,onManageFields:J,onSave:Z}){let{fields:X,updateFields:Y}=Q5(),[N,Q]=c.useState(""),[K,G]=c.useState("list"),[z,M]=c.useState(""),[U,W]=c.useState(""),[w,B]=c.useState(!1),[O,P]=c.useState(""),[A,S]=c.useState([]),F=Q1();c.useEffect(()=>{F.invalidateQueries({queryKey:["fields",$]})},[$,F]);let L=T0.api.projects[":projectId"].fields.order.$patch,{mutate:V}=b2({mutationFn:async(k)=>{if(!(await L(k)).ok)throw Error(I.failed_update_fields_order());return null}}),q=T0.api.projects[":projectId"].fields.$post,{mutate:C}=b2({mutationFn:async(k)=>{let f=await q(k);if(!f.ok)throw Error(I.failed_create_field());return await f.json()},onSuccess:(k)=>{let f={...k,visible:!0},E=[...X,f];Y(E),M(""),S([]),V({param:{projectId:$},json:E.map((j)=>({fieldId:j.id,visible:j.visible||!1}))}),Z?.()}}),T=c.useMemo(()=>X.filter((k)=>k.config?.name?.toLowerCase().includes(N.toLowerCase())),[X,N]),D=(k)=>{let{source:f,target:E}=k.operation;if(f&&E&&f.id!==E.id){let j=X.findIndex((q0)=>q0.id===f.id),y1=X.findIndex((q0)=>q0.id===E.id),d2=Y1(X,j,y1);Y(d2),V({param:{projectId:$},json:d2.map((q0)=>({fieldId:q0.id,visible:q0.visible||!1}))})}},x=(k,f)=>{let E=X.map((j)=>j.id===k?{...j,visible:f}:j);Y(E),V({param:{projectId:$},json:E.map((j)=>({fieldId:j.id,visible:j.visible||!1}))})},g=()=>{if(!z||!U)return;let k=U===v.select?{select:{options:A}}:U===v.selectMulti?{selectMulti:{options:A}}:{};C({param:{projectId:$},json:{config:{name:z,type:U,...k},label:z,aiAutofill:w,description:O}})},m=X.filter((k)=>k.visible).length;if(K==="create")return H("div",{className:"w-80 p-4",children:R("div",{className:"space-y-4",children:[R("div",{className:"space-y-2",children:[H(F0,{htmlFor:"field-name",children:I.field_name()}),H(g0,{id:"field-name",placeholder:I.new_field_placeholder(),value:z,onChange:(k)=>M(k.target.value),autoFocus:!0})]}),R("div",{className:"space-y-2",children:[H(F0,{children:I.field_type()}),R(L1,{children:[H(R1,{asChild:!0,children:R(e,{variant:"outline",className:"w-full justify-between font-normal",children:[U?H("span",{className:"capitalize",children:U.replace(/_/g," ")}):H("span",{className:"text-muted-foreground border-dashed",children:I.select_field_type()}),H(w0,{className:"ml-2 h-4 w-4 opacity-50"})]})}),H(A1,{className:"w-[--radix-dropdown-menu-trigger-width]",children:Object.values(v).map((k)=>H(C1,{onClick:()=>{W(k),S([])},className:"capitalize",children:k.replace(/_/g," ")},k))})]})]}),R("div",{className:"space-y-2",children:[H(F0,{htmlFor:"field-desc",children:I.description()}),H(g0,{id:"field-desc",placeholder:I.description_optional_placeholder(),value:O,onChange:(k)=>P(k.target.value)})]}),R("div",{className:"flex items-center space-x-2",children:[H(m0,{id:"ai-autofill",checked:w,onCheckedChange:B}),H(F0,{htmlFor:"ai-autofill",children:I.ai_autofill()})]}),(U===v.select||U===v.selectMulti)&&R("div",{className:"space-y-2",children:[R("div",{className:"flex items-center justify-between",children:[H(F0,{className:"text-sm font-medium",children:I.options()}),R(e,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{let k={id:L5(),displayName:I.new_option(),color:"#808080"};S([...A,k])},children:[H(c2,{className:"h-4 w-4 mr-1"})," ",I.add_option()]})]}),H("div",{className:"space-y-2 max-h-40 overflow-y-auto pr-1",children:A.map((k,f)=>R("div",{className:"flex items-center gap-2",children:[H(g0,{value:k.displayName,onChange:(E)=>{let j=[...A];j[f]={...k,displayName:E.target.value},S(j)},placeholder:I.option_name_placeholder(),className:"h-8 flex-1"}),R(i,{children:[H(n,{asChild:!0,children:H("button",{type:"button",className:"w-6 h-6 rounded-full border shrink-0 cursor-pointer focus:outline-none hover:scale-105 transition-transform",style:{backgroundColor:u2[k.color||""]?.hex||k.color||"#808080"}})}),H(o,{className:"p-2 w-auto",align:"end",children:H("div",{className:"flex gap-1",children:D4.map((E)=>H("button",{type:"button",className:"w-5 h-5 rounded-full border cursor-pointer hover:scale-110 transition-transform",style:{backgroundColor:u2[E]?.hex||E},onClick:()=>{let j=[...A];j[f]={...k,color:E},S(j)}},E))})})]}),H(e,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>{S(A.filter((E,j)=>j!==f))},children:H(V0,{className:"h-4 w-4"})})]},k.id))})]}),R("div",{className:"flex gap-2 pt-2",children:[H(e,{variant:"secondary",className:"flex-1",onClick:()=>{G("list"),M(""),W(""),B(!1),P(""),S([])},children:I.cancel()}),H(e,{className:"flex-1",onClick:g,disabled:!z||!U,children:I.save()})]})]})});return R("div",{className:"w-80 p-4",children:[H("div",{className:"flex items-center justify-between mb-4",children:R("h3",{className:"font-semibold",children:[I.fields()," ",H("span",{className:"text-muted-foreground text-sm font-normal",children:I.visible_count({count:m})})]})}),R("div",{className:"relative mb-4",children:[H(z1,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),H(g0,{placeholder:I.search_fields_placeholder(),value:N,onChange:(k)=>Q(k.target.value),className:"pl-8"})]}),H("div",{className:"max-h-60 overflow-y-auto pr-2",children:H(T1,{sensors:[O1.configure({activationConstraints:[new P1.Distance({value:8})]}),k1],onDragEnd:D,children:T.map((k,f)=>H(j4,{field:k,index:f,onVisibilityChange:x},k.id))})}),J&&R("div",{className:"mt-4 space-y-2",children:[R(e,{variant:"secondary",className:"w-full",onClick:J,children:[H(G1,{className:"h-4 w-4 mr-2"}),I.manage_fields()]}),R(e,{className:"w-full",onClick:()=>G("create"),children:[H(c2,{className:"h-4 w-4 mr-2"}),I.new_field()]})]})]})}var y4=({value:$,config:J,onSave:Z,readOnly:X})=>{let Y=J?.select,[N,Q]=S1.useState(!1),K=Y?.options?.find((W)=>W.id===$),G=()=>{if(!X)Q(!0)},z=(W)=>{Z(W),Q(!1)};return H("div",{className:"relative w-full",onClick:(W)=>W.stopPropagation(),children:R(i,{open:!X&&N,onOpenChange:(W)=>{if(X)return;Q(W)},children:[H(n,{asChild:!0,children:R("div",{onClick:G,className:`flex items-center justify-between w-full min-h-[28px] px-2 py-1 rounded border border-transparent transition-colors ${!X?"cursor-pointer hover:bg-accent hover:border-border group":""}`,children:[((W)=>{if(!W)return H("span",{className:"text-muted-foreground italic",children:"Select an option"});return H("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",style:N0(W.color),children:W.displayName})})(K),!X&&H(w0,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100"})]})}),R(o,{className:"p-1 w-[--radix-popover-trigger-width] min-w-[150px] max-h-60 overflow-auto bg-popover border border-border rounded-lg shadow-lg",align:"start",children:[R("div",{onClick:()=>z(""),className:"px-3 py-2 text-sm text-muted-foreground hover:bg-accent cursor-pointer flex items-center gap-2",children:[H(V0,{className:"w-3 h-3"})," Clear"]}),Y?.options?.map((W)=>H("div",{onClick:()=>z(W.id),className:"px-3 py-2 hover:bg-accent cursor-pointer flex items-center",children:H("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",style:N0(W.color),children:W.displayName})},W.id))]})]})})},f1=y4;var $0=d(l(),1);var v4=({value:$=[],config:J,onSave:Z,readOnly:X})=>{let Y=J?.selectMulti,N=$0.useRef(null),[Q,K]=$0.useState(!1),[G,z]=$0.useState(!1),[M,U]=$0.useState($.length),W=Y?.options?.filter((F)=>($||[]).includes(F.id))||[];$0.useLayoutEffect(()=>{if(Q||G){U(W.length);return}if(N.current){let F=N.current.offsetWidth,V=document.createElement("canvas").getContext("2d");if(V){V.font="12px ui-sans-serif, system-ui, sans-serif";let q=0,C=0,D=F-28;for(let x=0;x<W.length;x++){let m=V.measureText(W[x].displayName).width+16+4;if(q+m>D&&x<W.length-1)break;if(x===W.length-1){if(q+m<=F)C++;break}q+=m,C++}U(C)}}},[W,Q,G,$]);let w=(F)=>{let L=$||[],V;if(L.includes(F))V=L.filter((q)=>q!==F);else V=[...L,F];Z(V)},B=(F)=>{if(F.stopPropagation(),Q)return;let L=W.length-M;if(!G&&L>0)z(!0);else if(!X)K(!0)},O=(F)=>{if(F.stopPropagation(),!X)K(!0)},P=W.length-M;return H("div",{className:"relative w-full",onClick:(F)=>F.stopPropagation(),children:R(i,{open:!X&&(G&&!Q||Q),onOpenChange:(F)=>{if(X)return;if(!F)z(!1),K(!1)},children:[H(n,{asChild:!0,children:R("div",{ref:N,onClick:B,className:`w-full px-1 py-1 flex flex-wrap gap-1 rounded border border-transparent transition-all box-border h-[32px] overflow-hidden ${!X||P>0?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:[W.length===0&&H("span",{className:"text-muted-foreground text-sm italic px-1 pt-0.5",children:"Empty"}),W.slice(0,M).map((F)=>H("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border border-transparent whitespace-nowrap h-[22px]",style:N0(F.color),children:F.displayName},F.id)),P>0&&R("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground h-[22px]",children:["+",P]})]})}),H(o,{className:`p-1 bg-popover border rounded-lg shadow-xl max-h-60 overflow-auto ${G&&!Q?"w-[--radix-popover-trigger-width] min-w-[200px] flex flex-wrap gap-1 border-ring min-h-[32px] h-auto cursor-pointer":"w-64 border-border"}`,align:"start",onClick:G&&!Q?O:void 0,children:G&&!Q?R(Q2,{children:[W.length===0&&H("span",{className:"text-muted-foreground text-sm italic px-1 pt-0.5",children:"Empty"}),W.map((F)=>H("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border border-transparent whitespace-nowrap h-[22px]",style:N0(F.color),children:F.displayName},F.id))]}):Y?.options?.map((F)=>{let L=($||[]).includes(F.id);return R("div",{onClick:()=>w(F.id),className:"px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between",children:[H("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",style:N0(F.color),children:F.displayName}),L&&H(H2,{className:"w-4 h-4 text-primary"})]},F.id)})})]})})},E1=v4;var J0=d(l(),1);var _4=({value:$,onSave:J,readOnly:Z})=>{let[X,Y]=J0.useState(!1),[N,Q]=J0.useState($||""),K=J0.useRef(null);J0.useEffect(()=>{Q($||"")},[$]),J0.useEffect(()=>{if(X&&K.current)K.current.focus()},[X]);let G=()=>{if(!Z)Y(!0)},z=()=>{Y(!1),J(N)},M=(U)=>{if(U.key==="Enter")K.current?.blur()};if(X)return H("input",{ref:K,type:"text",value:N,onChange:(U)=>Q(U.target.value),onBlur:z,onKeyDown:M,className:"w-full px-2 py-1 border border-ring rounded bg-background text-sm outline-none shadow-sm"});return H("div",{onClick:G,className:`w-full min-h-[28px] px-2 py-1 text-sm text-foreground rounded truncate border border-transparent transition-colors ${!Z?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:$||H("span",{className:"text-muted-foreground italic",children:"Empty"})})},I1=_4;var h4=({value:$,onSave:J,readOnly:Z})=>{return H("div",{className:"flex items-center h-[28px] w-full",onClick:(Y)=>Y.stopPropagation(),children:H(m0,{checked:$,onCheckedChange:(Y)=>{if(!Z)J(Y)},disabled:Z,className:"cursor-pointer"})})},D1=h4;var N2=d(l(),1);var g4=({value:$,onSave:J,readOnly:Z})=>{let X=K2(),{members:Y,fetchMembers:N}=o0(),[Q,K]=N2.useState(!1);N2.useEffect(()=>{if(X)N(X)},[X,N]);let G=Y.find((B)=>B.id===$),z=()=>{if(!Z)K(!0)},M=(B)=>{J(B),K(!1)},U=(B)=>{if(Z)return;K(B)},W=(B)=>{return B.split(" ").map((O)=>O[0]).slice(0,2).join("").toUpperCase()};return H("div",{className:"relative w-full",onClick:(B)=>B.stopPropagation(),children:R(i,{open:!Z&&Q,onOpenChange:U,children:[H(n,{asChild:!0,children:R("div",{onClick:z,className:`flex items-center justify-between w-full h-[28px] px-2 rounded border border-transparent transition-colors ${!Z?"cursor-pointer hover:bg-accent hover:border-border group":""}`,children:[((B)=>{if(!B)return H("span",{className:"text-muted-foreground italic text-sm",children:"Select user"});return R("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-foreground border h-[22px]",children:[R(L0,{className:"w-4 h-4",children:[H(R0,{src:B.image,alt:B.name,className:"object-cover"}),H(A0,{className:"text-[8px] bg-rose-400 text-black font-semibold",children:W(B.name)})]}),H("span",{className:"truncate max-w-[120px]",children:B.name})]})})(G),!Z&&H(w0,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100"})]})}),R(o,{className:"p-1 w-[--radix-popover-trigger-width] min-w-[200px] max-h-60 overflow-auto bg-popover border border-border rounded-lg shadow-lg",align:"start",children:[R("div",{onClick:()=>M(""),className:"px-3 py-2 text-sm text-muted-foreground hover:bg-accent cursor-pointer flex items-center gap-2 rounded-sm",children:[H(V0,{className:"w-3 h-3"})," Clear"]}),Y.map((B)=>R("div",{onClick:()=>M(B.id),className:"px-3 py-2 hover:bg-accent cursor-pointer flex items-center gap-2 rounded-sm",children:[R(L0,{className:"w-5 h-5",children:[H(R0,{src:B.image,alt:B.name,className:"object-cover"}),H(A0,{className:"text-[10px] bg-rose-400 text-black font-semibold",children:W(B.name)})]}),H("span",{className:"text-sm font-medium text-foreground",children:B.name})]},B.id))]})]})})},x1=g4;var s=d(l(),1);var m4=({value:$=[],onSave:J,readOnly:Z})=>{let X=K2(),{members:Y,fetchMembers:N}=o0(),Q=s.useRef(null),[K,G]=s.useState(!1),[z,M]=s.useState(!1),[U,W]=s.useState($.length);s.useEffect(()=>{if(X)N(X)},[X,N]);let w=Y.filter((q)=>($||[]).includes(q.id)),B=(q)=>{return q.split(" ").map((C)=>C[0]).slice(0,2).join("").toUpperCase()};s.useLayoutEffect(()=>{if(K||z){W(w.length);return}if(Q.current){let q=Q.current.offsetWidth,T=document.createElement("canvas").getContext("2d");if(T){T.font="12px ui-sans-serif, system-ui, sans-serif";let D=0,x=0,m=q-28;for(let k=0;k<w.length;k++){let E=T.measureText(w[k].name).width+42;if(D+E>m&&k<w.length-1)break;if(k===w.length-1){if(D+E<=q)x++;break}D+=E,x++}W(x)}}},[w,K,z,$]);let O=(q)=>{let C=$||[],T;if(C.includes(q))T=C.filter((D)=>D!==q);else T=[...C,q];J(T)},P=(q)=>{if(q.stopPropagation(),K)return;let C=w.length-U;if(!z&&C>0)M(!0);else if(!Z)G(!0)},A=(q)=>{if(q.stopPropagation(),!Z)G(!0)},S=w.length-U,F=z&&!K||K,L=(q)=>{if(Z)return;if(!q)M(!1),G(!1)},V=(q)=>{return R("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-foreground border whitespace-nowrap h-[22px]",children:[R(L0,{className:"w-4 h-4",children:[H(R0,{src:q.image,alt:q.name,className:"object-cover"}),H(A0,{className:"text-[8px] bg-rose-400 text-black font-semibold",children:B(q.name)})]}),H("span",{className:"truncate max-w-[100px]",children:q.name})]},q.id)};return H("div",{className:"relative w-full",onClick:(q)=>q.stopPropagation(),children:R(i,{open:!Z&&F,onOpenChange:L,children:[H(n,{asChild:!0,children:R("div",{ref:Q,onClick:P,className:`w-full px-1 py-1 flex flex-wrap gap-1 rounded border border-transparent transition-all box-border h-[32px] overflow-hidden ${!Z||S>0?"cursor-pointer hover:bg-accent hover:border-border":""}`,children:[w.length===0&&H("span",{className:"text-muted-foreground text-sm italic px-1 pt-0.5",children:"Empty"}),w.slice(0,U).map(V),S>0&&R("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground h-[22px]",children:["+",S]})]})}),H(o,{className:`p-1 bg-popover border rounded-lg shadow-xl max-h-60 overflow-auto ${z&&!K?"w-[--radix-popover-trigger-width] min-w-[200px] flex flex-wrap gap-1 border-ring min-h-[32px] h-auto cursor-pointer":"w-64 border-border"}`,align:"start",onClick:z&&!K?A:void 0,children:z&&!K?R(Q2,{children:[w.length===0&&H("span",{className:"text-muted-foreground text-sm italic px-1 pt-0.5",children:"Empty"}),w.map(V)]}):Y.map((q)=>{let C=($||[]).includes(q.id);return R("div",{onClick:()=>O(q.id),className:"px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between rounded-sm",children:[R("div",{className:"flex items-center gap-2",children:[R(L0,{className:"w-5 h-5",children:[H(R0,{src:q.image,alt:q.name,className:"object-cover"}),H(A0,{className:"text-[10px] bg-rose-400 text-black font-semibold",children:B(q.name)})]}),H("span",{className:"text-sm font-medium text-foreground",children:q.name})]}),C&&H(H2,{className:"w-4 h-4 text-primary"})]},q.id)})})]})})},j1=m4;var b4=($)=>{if(!$.config)return H("div",{children:"Unknown Field Type"});switch($.config.type){case"text":return H(I1,{...$,value:$.value,onSave:$.onSave});case"longText":return H(U5,{...$,value:$.value,onSave:$.onSave});case"select":return H(f1,{...$,value:$.value,onSave:$.onSave});case"selectMulti":return H(E1,{...$,value:$.value,onSave:$.onSave});case"rating":return H(V5,{...$,value:$.value,onSave:$.onSave});case"number":return H(F5,{...$,value:$.value,onSave:$.onSave});case"toggle":return H(D1,{...$,value:$.value,onSave:$.onSave});case"date":return H(M5,{...$,value:$.value,onSave:$.onSave});case"user":return H(x1,{...$,value:$.value,onSave:$.onSave});case"userMulti":return H(j1,{...$,value:$.value,onSave:$.onSave});default:return H("div",{children:"Unknown Field Type"})}},L6=b4;var C6=({progress:$,className:J})=>{let X=2*Math.PI*20,Y=X-Math.min(100,Math.max(0,$))/100*X;return R("svg",{viewBox:"0 0 50 50",className:a0("w-12 h-12",J),children:[H("circle",{cx:"25",cy:"25",r:20,className:"stroke-muted",strokeWidth:"4",fill:"transparent"}),H("circle",{cx:"25",cy:"25",r:20,className:"stroke-primary transition-all duration-300 ease-out",strokeWidth:"4",fill:"transparent",strokeDasharray:X,strokeDashoffset:Y,transform:"rotate(-90 25 25)"}),H("text",{x:"50%",y:"50%",textAnchor:"middle",dy:".3em",className:"fill-foreground text-[10px] font-bold",children:`${Math.round($)}%`})]})};var c4=($)=>{if(isNaN($))return"00:00";let J=new Date($*1000),Z=J.getUTCHours(),X=J.getUTCMinutes().toString().padStart(2,"0"),Y=J.getUTCSeconds().toString().padStart(2,"0");if(Z)return`${Z}:${X}:${Y}`;return`${X}:${Y}`},O6=($,J,Z,X)=>{if(Z==="frames")return`${$} fr`;if(Z==="standard")return c4($/J);let Y=Math.round(J),N=J!==Y,Q=!1;if(N&&(Y===30||Y===60))Q=!0;let K=0;if(X){let B=X.match(/^([012]\d):(\d\d):(\d\d)(:|;|\.)(\d+)$/);if(B){let O=parseInt(B[1],10),P=parseInt(B[2],10),A=parseInt(B[3],10),S=parseInt(B[5],10);if(Q=B[4]!==":",K=(O*3600+P*60+A)*Y+S,Q){let F=O*60+P,L=J<30?2:4;K-=L*(F-Math.floor(F/10))}}}let G=$+K;if(Q){let B=J<30?2:4,O=Math.floor(G/(17982*B/2)),P=G%(17982*B/2);if(P<B)P=P+B;G+=9*B*O+B*Math.floor((P-B)/(1798*B/2))}let z=G%Y,M=Math.floor(G/Y)%60,U=Math.floor(G/(Y*60))%60,W=Math.floor(G/(Y*3600))%24,w=Q?";":":";return`${W.toString().padStart(2,"0")}:${U.toString().padStart(2,"0")}:${M.toString().padStart(2,"0")}${w}${z.toString().padStart(2,"0")}`};var T6=($,J)=>{if(!J)return 0;let Z=1/J;return $*Z+Z/2},u4=($)=>Math.max(100,3000/($||30)),S6=({dbTotalFrames:$,containerDuration:J,frameRate:Z})=>{let X=Z||30,Y=Math.round(J*X);if($<=0)return Y;let N=$/X,Q=J-N,K=u4(X)/1000;return Q>K?Y:$};
|
|
2
|
+
export{L2 as u,H5 as v,N5 as w,C2 as x,k2 as y,Y1 as z,H$ as A,Q5 as B,L5 as C,C6 as D,V5 as E,i as F,n as G,o as H,X1 as I,D4 as J,u2 as K,N0 as L,x4 as M,O$ as N,o0 as O,L6 as P,c4 as Q,O6 as R,T6 as S,u4 as T,S6 as U};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{zf as A}from"./chunk-
|
|
2
|
-
export{B as
|
|
1
|
+
import{zf as A}from"./chunk-ry33f2qk.js";import{Fh as w,Sh as z,oh as v}from"./chunk-nyhqy6q2.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/shares/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
|
|
2
|
+
export{B as jf,H as kf};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Jk as L,Lk as w}from"./chunk-1wm57c6y.js";import{Qk as Z}from"./chunk-re0b7sj7.js";import{Uk as J}from"./chunk-9h027f50.js";function d(b){return b.thought===!0}function B(b,j){if(typeof j==="string"&&j.length>0)return j;return b}var x=/^[A-Za-z0-9+/]+={0,2}$/;function T(b){if(!b)return!1;if(b.length%4!==0)return!1;return x.test(b)}function Q(b,j){return b&&T(j)?j:void 0}function U(b){return b.startsWith("claude-")||b.startsWith("gpt-oss-")}function f(b){let j=b.toLowerCase().match(/^gemini(?:-live)?-(\d+)/);if(!j)return;return Number.parseInt(j[1],10)}function y(b){let j=f(b);if(j!==void 0)return j>=3;return!0}function R(b,j){let A=[],N=(z)=>{if(!U(b.id))return z;return z.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)},$=Z(j.messages,b,N);for(let z of $)if(z.role==="user")if(typeof z.content==="string")A.push({role:"user",parts:[{text:J(z.content)}]});else{let E=z.content.map((D)=>{if(D.type==="text")return{text:J(D.text)};else return{inlineData:{mimeType:D.mimeType,data:D.data}}});if(E.length===0)continue;A.push({role:"user",parts:E})}else if(z.role==="assistant"){let E=[],D=z.provider===b.provider&&z.model===b.id;for(let q of z.content)if(q.type==="text"){if(!q.text||q.text.trim()==="")continue;let G=Q(D,q.textSignature);E.push({text:J(q.text),...G&&{thoughtSignature:G}})}else if(q.type==="thinking"){if(!q.thinking||q.thinking.trim()==="")continue;if(D){let G=Q(D,q.thinkingSignature);E.push({thought:!0,text:J(q.thinking),...G&&{thoughtSignature:G}})}else E.push({text:J(q.thinking)})}else if(q.type==="toolCall"){let G=Q(D,q.thoughtSignature),K={functionCall:{name:q.name,args:q.arguments??{},...U(b.id)?{id:q.id}:{}},...G&&{thoughtSignature:G}};E.push(K)}if(E.length===0)continue;A.push({role:"model",parts:E})}else if(z.role==="toolResult"){let D=z.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
|
|
3
3
|
`),q=b.input.includes("image")?z.content.filter((H)=>H.type==="image"):[],G=D.length>0,K=q.length>0,V=y(b.id),W=G?J(D):K?"(see attached image)":"",X=q.map((H)=>({inlineData:{mimeType:H.mimeType,data:H.data}})),v=U(b.id),Y={functionResponse:{name:z.toolName,response:z.isError?{error:W}:{output:W},...K&&V&&{parts:X},...v?{id:z.toolCallId}:{}}},O=A[A.length-1];if(O?.role==="user"&&O.parts?.some((H)=>H.functionResponse))O.parts.push(Y);else A.push({role:"user",parts:[Y]});if(K&&!V)A.push({role:"user",parts:[{text:"Tool result image:"},...X]})}return A}var F=new Set(["$schema","$id","$anchor","$dynamicAnchor","$vocabulary","$comment","$defs","definitions"]);function _(b){if(typeof b!=="object"||b===null||Array.isArray(b))return b;let j={};for(let[A,N]of Object.entries(b)){if(F.has(A))continue;j[A]=_(N)}return j}function C(b,j=!1){if(b.length===0)return;return[{functionDeclarations:b.map((A)=>({name:A.name,description:A.description,...j?{parameters:_(A.parameters)}:{parametersJsonSchema:A.parameters}}))}]}function k(b){switch(b){case"auto":return L.AUTO;case"none":return L.NONE;case"any":return L.ANY;default:return L.AUTO}}function P(b){switch(b){case w.STOP:return"stop";case w.MAX_TOKENS:return"length";case w.BLOCKLIST:case w.PROHIBITED_CONTENT:case w.SPII:case w.SAFETY:case w.IMAGE_SAFETY:case w.IMAGE_PROHIBITED_CONTENT:case w.IMAGE_RECITATION:case w.IMAGE_OTHER:case w.RECITATION:case w.FINISH_REASON_UNSPECIFIED:case w.OTHER:case w.LANGUAGE:case w.MALFORMED_FUNCTION_CALL:case w.UNEXPECTED_TOOL_CALL:case w.NO_IMAGE:return"error";default:throw Error(`Unhandled stop reason: ${b}`)}}
|
|
4
|
-
export{d as
|
|
4
|
+
export{d as Dk,B as Ek,R as Fk,C as Gk,k as Hk,P as Ik};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as WG,i as VG}from"./chunk-h0ytx8zc.js";import{p as qG,s as BG}from"./chunk-xyjw8w3r.js";import{t as zG}from"./chunk-ccw7mjgq.js";import{Va as HG}from"./chunk-srn8t0v7.js";import{pf as _G}from"./chunk-wg98cacx.js";import{qf as v,rf as g,sf as F,uf as u}from"./chunk-15sefy5t.js";import{hg as ZG}from"./chunk-54tr7y2x.js";import{Qg as XG,dh as $G}from"./chunk-gswbc6y9.js";import{$i as UG,Bh as KG,Sh as B,Wh as OG,ai as P,mh as oG,mk as YG,nh as JG,oh as O,ph as z,th as N,wh as w}from"./chunk-nyhqy6q2.js";import{Vk as nG}from"./chunk-0qkj838r.js";var X=nG(oG(),1);function $J({shareId:K,initialFolderId:QG,initialFileId:f,startTime:TG,versionId:V,compare:MG,compareLeftId:b,compareRightId:A,compareActiveSide:p="left"}){let H=KG(),W=!!MG&&!!b&&!!A,[Z,h]=X.useState(()=>{return localStorage.getItem(`share_pwd_${K}`)||""}),[D,NG]=X.useState(""),{data:U,error:Q,isLoading:yG}=N({queryKey:["share-info",K,Z],queryFn:async()=>{let G=await B.api.shares[":shareId"].info.$get({param:{shareId:K}},{headers:{"x-share-password":Z}});if(G.status===401)throw Error("Unauthorized");if(G.status===403){let J=await G.json();throw Error(J.error||"Forbidden")}if(!G.ok)throw Error("Failed to fetch share info");return await G.json()},retry:!1}),Y=QG||U?.rootFolderId,_=f||null,m=V||_,[c,l]=X.useState([]),{data:R}=N({queryKey:["public-share-folder",K,Y,Z],queryFn:async()=>{let G=await B.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:K,fileId:Y}},{headers:{"x-share-password":Z}});if(G.status===401)throw Error("Unauthorized");return await G.json()},enabled:!!U&&!!Y});X.useEffect(()=>{if(R?.ancestorFolders&&U){let G=R.ancestorFolders.findIndex((J)=>J.id===U.rootFolderId);if(G!==-1)l(R.ancestorFolders.slice(0,G));else if(Y===U.rootFolderId)l([])}},[R,U,Y]);let[y,E]=X.useState(new Set),[EG,LG]=X.useState(360),[j,kG]=X.useState(()=>!f),L=X.useRef(null),[I,C]=X.useState([]),[bG,n]=X.useState(0),[AG,o]=X.useState(null),[d,RG]=X.useState(null),[PG,DG]=X.useState(void 0),{data:i,fetchNextPage:jG,hasNextPage:CG,isFetchingNextPage:SG,error:t}=w({queryKey:["public-share-children",K,Y,"folder",Z],queryFn:async({pageParam:G})=>{let J=await B.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:K,folderId:Y},query:{assetType:"folder",after:G}},{headers:{"x-share-password":Z}});if(J.status===401)throw Error("Unauthorized");if(J.status===403)throw Error("Expired");return await J.json()},enabled:!!U&&!!Y,initialPageParam:"",getNextPageParam:(G)=>G.pageInfo?.cursor||void 0,retry:!1}),{data:a,fetchNextPage:xG,hasNextPage:wG,isFetchingNextPage:vG}=w({queryKey:["public-share-children",K,Y,"file",Z],queryFn:async({pageParam:G})=>{let J=await B.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:K,folderId:Y},query:{assetType:"file",after:G}},{headers:{"x-share-password":Z}});if(J.status===401)throw Error("Unauthorized");if(J.status===403)throw Error("Expired");return await J.json()},enabled:!!U&&!!Y,initialPageParam:"",getNextPageParam:(G)=>G.pageInfo?.cursor||void 0,retry:!1}),{data:gG}=N({queryKey:["public-share-fields",K,Z],queryFn:async()=>{let G=await B.api.shares[":shareId"].fields.$get({param:{shareId:K}},{headers:{"x-share-password":Z}});if(G.status===401)throw Error("Unauthorized");return await G.json()},enabled:!!U}),{data:q,isLoading:FG}=N({queryKey:["public-share-file",K,_,Z],queryFn:async()=>{let G=await B.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:K,fileId:_}},{headers:{"x-share-password":Z}});if(G.status===401)throw Error("Unauthorized");return await G.json()},enabled:!!_&&!!U}),{data:uG,isLoading:fG}=N({queryKey:["public-share-file",K,V,Z],queryFn:async()=>{let G=await B.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:K,fileId:V}},{headers:{"x-share-password":Z}});if(G.status===401)throw Error("Unauthorized");return await G.json()},enabled:!!V&&!!U}),$=V?uG:q,pG=FG||!!V&&fG;X.useEffect(()=>{if(t?.message==="Unauthorized")h(""),localStorage.removeItem(`share_pwd_${K}`)},[t,K]);let k=X.useMemo(()=>i?.pages.flatMap((G)=>G.data??[])??[],[i]),S=X.useMemo(()=>a?.pages.flatMap((G)=>G.data??[])??[],[a]),s=X.useMemo(()=>{if($)return $;if(y.size!==1)return null;let G=Array.from(y)[0];return[...k,...S].find((J)=>J.id===G)||null},[y,k,S,$]),hG=(G)=>{G.preventDefault(),h(D),localStorage.setItem(`share_pwd_${K}`,D)},mG=(G)=>{if(G.type==="folder"||G.targetType==="folder")H({to:"/share/$shareId/folders/$folderId",params:{shareId:K,folderId:G.id}});else H({to:"/share/$shareId/files/$fileId",params:{shareId:K,fileId:G.versionStack?G.versionStack.id:G.id}});E(new Set)},cG=(G)=>{if(!U)return;let J=G==="root"?U.rootFolderId:G;if(J===U.rootFolderId)H({to:"/share/$shareId",params:{shareId:K}});else H({to:"/share/$shareId/folders/$folderId",params:{shareId:K,folderId:J}});E(new Set)},lG=(G)=>{o(G.id||null);let J=G.annotations;if(J&&J.length>0)C(J);else C([]);if(W){if(G.second!==null&&G.second!==void 0)DG({second:G.second,nonce:Date.now()});return}if(G.second!==null&&G.second!==void 0)L.current?.seekTo(G.second),L.current?.pause();else if(J&&J.length>0)L.current?.pause()},r=()=>{C([]),o(null)},x=(G)=>{if(!_)return;H({to:"/share/$shareId/files/$fileId",params:{shareId:K,fileId:_},search:(J)=>({...J,...G})})},IG=()=>{x({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:p==="left"?b:A})},{setProjectState:e,clearProjectState:GG}=ZG();X.useEffect(()=>{if(U&&Y){let G=Y===U.rootFolderId?U.name:k.find((J)=>J.id===Y)?.name||U.name;e({teamId:"",projectId:U.projectId,projectName:U.name,ancestorFolders:c,currentAsset:{name:$?.name||G,type:_?"file":"folder",version:q?.versionStack?q.versionStack.versions.find((J)=>J.id===m)?.version??q.versionStack.versions.length:void 0,proxyType:$?.proxyType||null},isRootFolder:Y===U.rootFolderId&&!_,isPublic:!0,shareId:K,fileId:_||void 0,downloadInfo:$?{originalKey:$.media?.original?.key,videoTranscodes:$.media?.videoTranscodes?.map((J)=>({key:J.key,width:J.width,height:J.height,isRaw:J.isRaw}))}:void 0,onFolderClick:cG,isRightSidebarCollapsed:j,onRightSidebarToggle:()=>kG((J)=>!J),versions:q?.versionStack?.versions,compareMode:W,canCompareVersions:(q?.versionStack?.versions?.length??0)>=2,onCompareVersions:()=>{let J=qG(q?.versionStack?.versions);if(!J||!_)return;H({to:"/share/$shareId/files/$fileId",params:{shareId:K,fileId:_},search:(M)=>({...M,compare:!0,cmpLeft:J.left.id,cmpRight:J.right.id,cmpActive:"left"})})}})}return()=>GG()},[U,Y,k,$,q,m,_,c,e,GG,j,W,H,K]);let T;if(yG&&!Q)T=O("div",{className:"flex flex-1 items-center justify-center bg-background",children:O(P,{className:"h-8 w-8 animate-spin text-foreground"})});else if(Q)if(Q.message==="Unauthorized"){let G=Z!=="";T=O("div",{className:"flex flex-1 items-center justify-center p-4",children:z(v,{className:"w-full max-w-md",children:[z(g,{className:"text-center",children:[O("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:O(UG,{className:"h-6 w-6 text-primary"})}),O(F,{children:YG.password_protected()})]}),O(u,{children:z("form",{onSubmit:hG,className:"space-y-4",children:[z("div",{className:"space-y-2",children:[O($G,{type:"password",placeholder:"Enter password",value:D,onChange:(J)=>NG(J.target.value),autoFocus:!0}),G&&O("p",{className:"text-sm font-medium text-destructive",children:"Incorrect password. Please try again."})]}),O(XG,{type:"submit",className:"w-full",children:"Access Share"})]})})]})})}else{let G=Q.message.includes("expired"),J=Q.message.includes("disabled");T=O("div",{className:"flex flex-1 items-center justify-center p-4",children:z(v,{className:"w-full max-w-md",children:[z(g,{className:"text-center",children:[O("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:O(OG,{className:"h-6 w-6 text-destructive"})}),O(F,{children:G?"Share Expired":J?"Share Disabled":"Error"})]}),O(u,{className:"text-center text-muted-foreground",children:Q.message})]})})}else if(!U)T=O("div",{className:"flex flex-1 items-center justify-center bg-background",children:O(P,{className:"h-8 w-8 animate-spin text-foreground"})});else T=z("div",{className:"flex flex-1 overflow-hidden relative",children:[_?z("div",{className:"flex-1 relative bg-muted/30",children:[pG&&!W&&O("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:O(P,{className:"h-8 w-8 animate-spin text-foreground"})}),W&&b&&A?O(VG,{isPublic:!0,shareId:K,versions:$?.versionStack?.versions??[],leftId:b,rightId:A,activeSide:p,annotations:I,seekRequest:PG,onActiveSideChange:(G)=>x({cmpActive:G}),onSwitchVersion:(G,J)=>x(G==="left"?{cmpLeft:J}:{cmpRight:J}),onExit:IG,onActiveAssetChange:RG,onPlay:r,onTimeUpdate:n}):$&&O(WG,{file:$,mediaControllerRef:L,onPlay:r,onTimeUpdate:n,annotations:I,startTime:TG,shareId:K})]}):Y&&O(zG,{teamId:"",projectId:U.projectId,assetId:Y,folders:k,files:S,selectedItem:null,selectedIds:y,onItemSelect:(G,J)=>{if(J.metaKey||J.ctrlKey){let M=new Set(y);if(M.has(G.id))M.delete(G.id);else M.add(G.id);E(M)}else E(new Set([G.id]))},onItemDoubleClick:mG,onSaveField:()=>{},displayStyle:U.viewMode??"card",onClearSelection:()=>E(new Set),fetchNextFoldersPage:jG,hasNextFoldersPage:CG,isFetchingNextFoldersPage:SG,fetchNextFilesPage:xG,hasNextFilesPage:wG,isFetchingNextFilesPage:vG,isShareView:!0,isPublic:!0}),!j&&z(JG,{children:[O(HG,{onResize:(G)=>LG((J)=>Math.max(240,Math.min(600,J-G)))}),O("div",{style:{width:EG},className:"flex-shrink-0 border-l",children:O(BG,{teamId:"",projectId:U.projectId,file:W?d:s,onSaveField:()=>{},members:[],readOnly:!0,publicFields:gG,onCommentSelect:lG,isPublic:!0,shareId:K,currentTime:bG,onTyping:()=>{L.current?.pause()},selectedCommentId:AG,hideAnnotationControl:(W?d:s)?.proxyType==="audio"})})]})]});return z("div",{className:"flex h-screen flex-col bg-background",children:[O(_G,{}),T]})}
|
|
2
|
+
export{$J as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as _}from"./chunk-2g12s6mc.js";import"./chunk-f7sbkfmk.js";import"./chunk-fepymbka.js";import"./chunk-xyjw8w3r.js";import"./chunk-ccw7mjgq.js";import"./chunk-pq18zenh.js";import"./chunk-wsyg4rwg.js";import"./chunk-7e06b2zb.js";import"./chunk-srn8t0v7.js";import"./chunk-kfhtk3eh.js";import"./chunk-kr06nrbx.js";import"./chunk-b8js74jk.js";import"./chunk-0xbf8bcg.js";import{ef as Y,ff as Z}from"./chunk-262hkppb.js";import"./chunk-88fg1sw7.js";import"./chunk-77r8w95d.js";import"./chunk-t3t6021k.js";import"./chunk-54tr7y2x.js";import"./chunk-1xpec5r8.js";import"./chunk-0rxhc7ka.js";import"./chunk-fa2g2wge.js";import"./chunk-fz88kkk1.js";import"./chunk-dghtwyq1.js";import{bh as X}from"./chunk-gswbc6y9.js";import{Gh as V,Sh as B,mh as O,mk as W,oh as w,th as A,uh as N,vh as U}from"./chunk-nyhqy6q2.js";import{Vk as M}from"./chunk-0qkj838r.js";var h=M(O(),1);function R(){let{projectId:k,collectionId:D}=P.useParams(),{teamId:G,ensureTeamIdForProject:H}=X();h.useEffect(()=>{H(k)},[k,H]);let{data:J}=N(Y(k)),{data:v,refetch:z}=A({...Z(D)}),{mutate:E}=U({mutationFn:async(q)=>{let K=await B.api.collections[":collectionId"].$patch({param:{collectionId:D},json:q});if(!K.ok)throw Error("Failed to update collection");return await K.json()},onSuccess:()=>{z()}}),b=J?.rootFolder,{data:L}=A({queryKey:["folders",b],queryFn:async()=>{let q=await B.api.folders[":folderId"].$get({param:{folderId:b}});if(!q.ok)throw Error("Failed to fetch folder");return await q.json()},enabled:!!b});if(!G||!b||!L||!v)return w("div",{children:W.loading_collection()});let $=v.filter.sourceFolderId||b;return w(_,{teamId:G,projectId:k,projectName:J.name??"",assetId:$,rootFolderId:b,collection:v,onUpdateCollection:E})}var P=V("/projects/$projectId/collections/$collectionId")({component:R});export{P as Route};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function L(G,q,D){return{temperature:q?.temperature,maxTokens:q?.maxTokens,signal:q?.signal,apiKey:D||q?.apiKey,transport:q?.transport,cacheRetention:q?.cacheRetention,sessionId:q?.sessionId,headers:q?.headers,onPayload:q?.onPayload,onResponse:q?.onResponse,timeoutMs:q?.timeoutMs,websocketConnectTimeoutMs:q?.websocketConnectTimeoutMs,maxRetries:q?.maxRetries,maxRetryDelayMs:q?.maxRetryDelayMs,metadata:q?.metadata}}function K(G){return G==="xhigh"?"high":G}function y(G,q,D,N){let _={...{minimal:1024,low:2048,medium:8192,high:16384},...N},O=1024,V=K(D),J=_[V],Q=G===void 0?q:Math.min(G+J,q);if(Q<=J)J=Math.max(0,Q-1024);return{maxTokens:Q,thinkingBudget:J}}function j(G,q){let D=[],N=!1;for(let Y of G){if(Y.type==="image"){if(!N)D.push({type:"text",text:q});N=!0;continue}D.push(Y),N=Y.text===q}return D}function U(G,q){if(q.input.includes("image"))return G;return G.map((D)=>{if(D.role==="user"&&Array.isArray(D.content))return{...D,content:j(D.content,"(image omitted: model does not support images)")};if(D.role==="toolResult")return{...D,content:j(D.content,"(tool image omitted: model does not support images)")};return D})}function W(G,q,D){let N=new Map,_=U(G,q).map((E)=>{if(E.role==="user")return E;if(E.role==="toolResult"){let A=N.get(E.toolCallId);if(A&&A!==E.toolCallId)return{...E,toolCallId:A};return E}if(E.role==="assistant"){let A=E,H=A.provider===q.provider&&A.api===q.api&&A.model===q.id,$=A.content.flatMap((F)=>{if(F.type==="thinking"){if(F.redacted)return H?F:[];if(H&&F.thinkingSignature)return F;if(!F.thinking||F.thinking.trim()==="")return[];if(H)return F;return{type:"text",text:F.thinking}}if(F.type==="text"){if(H)return F;return{type:"text",text:F.text}}if(F.type==="toolCall"){let X=F,Z=X;if(!H&&X.thoughtSignature)Z={...X},delete Z.thoughtSignature;if(!H&&D){let w=D(X.id,q,A);if(w!==X.id)N.set(X.id,w),Z={...Z,id:w}}return Z}return F});return{...A,content:$}}return E}),O=[],V=[],J=new Set,Q=()=>{if(V.length>0){for(let E of V)if(!J.has(E.id))O.push({role:"toolResult",toolCallId:E.id,toolName:E.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});V=[],J=new Set}};for(let E=0;E<_.length;E++){let A=_[E];if(A.role==="assistant"){Q();let H=A;if(H.stopReason==="error"||H.stopReason==="aborted")continue;let $=H.content.filter((F)=>F.type==="toolCall");if($.length>0)V=$,J=new Set;O.push(A)}else if(A.role==="toolResult")J.add(A.toolCallId),O.push(A);else if(A.role==="user")Q(),O.push(A);else O.push(A)}return Q(),O}
|
|
3
|
-
export{L as
|
|
3
|
+
export{L as Ok,y as Pk,W as Qk};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Sb as m,Tb as c}from"./chunk-7we7ex0m.js";import{Yb as s}from"./chunk-s1n39qte.js";import{Zb as d}from"./chunk-
|
|
2
|
+
import{Sb as m,Tb as c}from"./chunk-7we7ex0m.js";import{Yb as s}from"./chunk-s1n39qte.js";import{Zb as d}from"./chunk-9avkn3x1.js";import{ec as l,fc as a}from"./chunk-w88219ex.js";import{hc as i,jc as n}from"./chunk-2dsmsa6a.js";import{kc as w}from"./chunk-ta7bfdrn.js";import{lc as p}from"./chunk-pxw97qbq.js";import{Xe as T}from"./chunk-ybhgmvxa.js";import{$e as g,af as r}from"./chunk-q09dfja5.js";import{bf as k}from"./chunk-d2vxmn9v.js";import{xk as h}from"./chunk-9ab6k4rq.js";import"./chunk-bs0fjz3w.js";import"./chunk-0qkj838r.js";function C(J,X){if(!J)return!1;let Q=X.toLowerCase();for(let[Y,_]of Object.entries(J))if(Y.toLowerCase()===Q&&_!==null&&_.trim().length>0)return!0;return!1}function t(J,X,Q){if(X)return X;if(C(Q,"authorization")||C(Q,"cf-aig-authorization"))return"unused";throw Error(`No API key for provider: ${J}`)}function $J(J){for(let X of J){if(X.role==="toolResult")return!0;if(X.role==="assistant"){if(X.content.some((Q)=>Q.type==="toolCall"))return!0}}return!1}function u(J){return J.type==="text"}function qJ(J){return J.type==="thinking"}function ZJ(J){return J.type==="toolCall"}function KJ(J){return J.type==="image"}function jJ(J){if(typeof J!=="object"||J===null)return!1;let X=J;return X.type==="reasoning.encrypted"&&typeof X.id==="string"&&X.id.length>0&&typeof X.data==="string"&&X.data.length>0}function e(J,X){if(J)return J;if(d("PI_CACHE_RETENTION",X)==="long")return"long";return"short"}var zJ=(J,X,Q)=>{let Y=new k;return(async()=>{let _={role:"assistant",content:[],api:J.api,provider:J.provider,model:J.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let H=t(J.provider,Q?.apiKey,Q?.headers),K=f(J),$=e(Q?.cacheRetention,Q?.env),q=$==="none"?void 0:Q?.sessionId,j=HJ(J,X,H,Q?.headers,q,K),V=LJ(J,X,Q,K,$),O=await Q?.onPayload?.(V,J);if(O!==void 0)V=O;let P={...Q?.signal?{signal:Q.signal}:{},...Q?.timeoutMs!==void 0?{timeout:Q.timeoutMs}:{},maxRetries:Q?.maxRetries??0},{data:A,response:F}=await j.chat.completions.create(V,P).withResponse();await Q?.onResponse?.({status:F.status,headers:p(F.headers)},J),Y.push({type:"start",partial:_});let E=null,L=null,G=!1,v=new Map,U=new Map,I=new Map,B=_.content,y=(Z)=>B.indexOf(Z),JJ=(Z)=>{let z=y(Z);if(z===-1)return;if(Z.type==="text")Y.push({type:"text_end",contentIndex:z,content:Z.text,partial:_});else if(Z.type==="thinking")Y.push({type:"thinking_end",contentIndex:z,content:Z.thinking,partial:_});else if(Z.type==="toolCall")Z.arguments=T(Z.partialArgs),delete Z.partialArgs,delete Z.streamIndex,Y.push({type:"toolcall_end",contentIndex:z,toolCall:Z,partial:_})},QJ=()=>{if(!E)E={type:"text",text:""},B.push(E),Y.push({type:"text_start",contentIndex:y(E),partial:_});return E},XJ=(Z)=>{if(!L)L={type:"thinking",thinking:"",thinkingSignature:Z},B.push(L),Y.push({type:"thinking_start",contentIndex:y(L),partial:_});return L},YJ=(Z)=>{if(!Z.id)return;let z=I.get(Z.id);if(z)Z.thoughtSignature=z,I.delete(Z.id)},_J=(Z)=>{let z=typeof Z.index==="number"?Z.index:void 0,N=z!==void 0?v.get(z):void 0;if(!N&&Z.id)N=U.get(Z.id);if(!N){if(N={type:"toolCall",id:Z.id||"",name:Z.function?.name||"",arguments:{},partialArgs:"",streamIndex:z},z!==void 0)v.set(z,N);if(Z.id)U.set(Z.id,N);B.push(N),Y.push({type:"toolcall_start",contentIndex:y(N),partial:_})}if(z!==void 0&&N.streamIndex===void 0)N.streamIndex=z,v.set(z,N);if(Z.id)U.set(Z.id,N);return YJ(N),N};for await(let Z of A){if(!Z||typeof Z!=="object")continue;if(_.responseId||=Z.id,typeof Z.model==="string"&&Z.model.length>0&&Z.model!==J.id)_.responseModel||=Z.model;if(Z.usage)_.usage=b(Z.usage,J);let z=Array.isArray(Z.choices)?Z.choices[0]:void 0;if(!z)continue;if(!Z.usage&&z.usage)_.usage=b(z.usage,J);if(z.finish_reason){let N=yJ(z.finish_reason);if(_.stopReason=N.stopReason,N.errorMessage)_.errorMessage=N.errorMessage;G=!0}if(z.delta){if(z.delta.content!==null&&z.delta.content!==void 0&&z.delta.content.length>0){let W=QJ();W.text+=z.delta.content,Y.push({type:"text_delta",contentIndex:y(W),delta:z.delta.content,partial:_})}let N=["reasoning_content","reasoning","reasoning_text"],R=z.delta,M=null;for(let W of N){let S=R[W];if(typeof S==="string"&&S.length>0){M=W;break}}if(M){let W=R[M];if(typeof W==="string"&&W.length>0){let S=J.provider==="opencode-go"&&M==="reasoning"?"reasoning_content":M,D=XJ(S);D.thinking+=W,Y.push({type:"thinking_delta",contentIndex:y(D),delta:W,partial:_})}}if(z?.delta?.tool_calls)for(let W of z.delta.tool_calls){let S=_J(W);if(!S.id&&W.id)S.id=W.id,U.set(W.id,S);if(!S.name&&W.function?.name)S.name=W.function.name;let D="";if(W.function?.arguments)D=W.function.arguments,S.partialArgs=(S.partialArgs??"")+W.function.arguments,S.arguments=T(S.partialArgs);Y.push({type:"toolcall_delta",contentIndex:y(S),delta:D,partial:_})}let x=z.delta.reasoning_details;if(Array.isArray(x)){for(let W of x)if(jJ(W)){let S=JSON.stringify(W),D=U.get(W.id);if(D)D.thoughtSignature=S;else I.set(W.id,S)}}}}for(let Z of B)JJ(Z);if(Q?.signal?.aborted)throw Error("Request was aborted");if(_.stopReason==="aborted")throw Error("Request was aborted");if(_.stopReason==="error")throw Error(_.errorMessage||"Provider returned an error stop reason");if(!G)throw Error("Stream ended without finish_reason");Y.push({type:"done",reason:_.stopReason,message:_}),Y.end()}catch(H){for(let $ of _.content)delete $.index,delete $.partialArgs,delete $.streamIndex;_.stopReason=Q?.signal?.aborted?"aborted":"error",_.errorMessage=a(l(H));let K=H?.error?.metadata?.raw;if(K&&!_.errorMessage.includes(String(K)))_.errorMessage+=`
|
|
3
3
|
${K}`;Y.push({type:"error",reason:_.stopReason,error:_}),Y.end()}})(),Y},hJ=(J,X,Q)=>{t(J.provider,Q?.apiKey,Q?.headers);let Y=i(J,X,Q,Q?.apiKey),_=Q?.reasoning?r(J,Q.reasoning):void 0,H=_==="off"?void 0:_,K=Q?.toolChoice;return zJ(J,X,{...Y,reasoningEffort:H,toolChoice:K})};function HJ(J,X,Q,Y,_,H=f(J)){let K={...J.headers};if(J.provider==="github-copilot"){let $=m(X.messages),q=c({messages:X.messages,hasImages:$});Object.assign(K,q)}if(_&&H.sendSessionAffinityHeaders)if(H.sessionAffinityFormat==="openrouter")K["x-session-id"]=_;else{if(H.sessionAffinityFormat==="openai")K.session_id=_;K["x-client-request-id"]=_,K["x-session-affinity"]=_}if(Y)Object.assign(K,Y);return new h({apiKey:Q,baseURL:J.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:K})}function LJ(J,X,Q,Y=f(J),_=e(Q?.cacheRetention,Q?.env)){let H=EJ(J,X,Y),K=GJ(Y,_),$={model:J.id,messages:H,stream:!0,prompt_cache_key:J.baseUrl.includes("api.openai.com")&&_!=="none"||_==="long"&&Y.supportsLongCacheRetention?s(Q?.sessionId):void 0,prompt_cache_retention:_==="long"&&Y.supportsLongCacheRetention?"24h":void 0};if(Y.supportsUsageInStreaming!==!1)$.stream_options={include_usage:!0};if(Y.supportsStore)$.store=!1;if(Q?.maxTokens)if(Y.maxTokensField==="max_tokens")$.max_tokens=Q.maxTokens;else $.max_completion_tokens=Q.maxTokens;if(Q?.temperature!==void 0)$.temperature=Q.temperature;if(X.tools&&X.tools.length>0){if($.tools=DJ(X.tools,Y),Y.zaiToolStream)$.tool_stream=!0}else if($J(X.messages))$.tools=[];if(K)NJ(H,$.tools,K);if(Q?.toolChoice)$.tool_choice=Q.toolChoice;if(Y.thinkingFormat==="zai"&&J.reasoning){let q=$;if(q.thinking=Q?.reasoningEffort?{type:"enabled",clear_thinking:!1}:{type:"disabled"},Q?.reasoningEffort&&Y.supportsReasoningEffort){let j=J.thinkingLevelMap?.[Q.reasoningEffort],V=j===void 0?Q.reasoningEffort:j;if(typeof V==="string")q.reasoning_effort=V}}else if(Y.thinkingFormat==="qwen"&&J.reasoning)$.enable_thinking=!!Q?.reasoningEffort;else if(Y.thinkingFormat==="qwen-chat-template"&&J.reasoning)$.chat_template_kwargs={enable_thinking:!!Q?.reasoningEffort,preserve_thinking:!0};else if(Y.thinkingFormat==="chat-template"&&J.reasoning){let q=VJ(J,Q,Y);if(q)$.chat_template_kwargs=q}else if(Y.thinkingFormat==="deepseek"&&J.reasoning){if(Q?.reasoningEffort)$.thinking={type:"enabled"};else if(J.thinkingLevelMap?.off!==null)$.thinking={type:"disabled"};if(Q?.reasoningEffort&&Y.supportsReasoningEffort)$.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort}else if(Y.thinkingFormat==="openrouter"&&J.reasoning){let q=$;if(Q?.reasoningEffort)q.reasoning={effort:J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort};else if(J.thinkingLevelMap?.off!==null)q.reasoning={effort:J.thinkingLevelMap?.off??"none"}}else if(Y.thinkingFormat==="ant-ling"&&J.reasoning&&Q?.reasoningEffort){let q=J.thinkingLevelMap?.[Q.reasoningEffort];if(typeof q==="string")$.reasoning={effort:q}}else if(Y.thinkingFormat==="together"&&J.reasoning){let q=$;if(q.reasoning={enabled:!!Q?.reasoningEffort},Q?.reasoningEffort&&Y.supportsReasoningEffort)q.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort}else if(Y.thinkingFormat==="string-thinking"&&J.reasoning){let q=$;if(Q?.reasoningEffort)q.thinking=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort;else if(J.thinkingLevelMap?.off!==null)q.thinking=J.thinkingLevelMap?.off??"none"}else if(Q?.reasoningEffort&&J.reasoning&&Y.supportsReasoningEffort)$.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort;else if(!Q?.reasoningEffort&&J.reasoning&&Y.supportsReasoningEffort){let q=J.thinkingLevelMap?.off;if(typeof q==="string")$.reasoning_effort=q}if(J.compat?.openRouterRouting)$.provider=J.compat.openRouterRouting;if(J.compat?.vercelGatewayRouting){let q=J.compat.vercelGatewayRouting;if(q.only||q.order){let j={};if(q.only)j.only=q.only;if(q.order)j.order=q.order;$.providerOptions={gateway:j}}}return $}function VJ(J,X,Q){let Y={};for(let[_,H]of Object.entries(Q.chatTemplateKwargs)){let K=WJ(J,X,H);if(K!==void 0)Y[_]=K}return Object.keys(Y).length>0?Y:void 0}function WJ(J,X,Q){if(typeof Q!=="object"||Q===null)return Q;let Y=X?.reasoningEffort;if(!Y&&Q.omitWhenOff)return;if(Q.$var==="thinking.enabled")return!!Y;let _=Y?J.thinkingLevelMap?.[Y]:J.thinkingLevelMap?.off;return _===void 0?Y:typeof _==="string"?_:void 0}function GJ(J,X){if(J.cacheControlFormat!=="anthropic"||X==="none")return;let Q=X==="long"&&J.supportsLongCacheRetention?"1h":void 0;return{type:"ephemeral",...Q?{ttl:Q}:{}}}function NJ(J,X,Q){SJ(J,Q),FJ(X,Q),OJ(J,Q)}function SJ(J,X){for(let Q of J)if(Q.role==="system"||Q.role==="developer"){PJ(Q,X);return}}function OJ(J,X){for(let Q=J.length-1;Q>=0;Q--){let Y=J[Q];if(Y.role==="user"||Y.role==="assistant"){if(AJ(Y,X))return}}}function FJ(J,X){if(!J||J.length===0)return;let Q=J[J.length-1];Q.cache_control=X}function PJ(J,X){return o(J,X)}function AJ(J,X){if(J.role==="user"||J.role==="assistant")return o(J,X);return!1}function o(J,X){let Q=J.content;if(typeof Q==="string"){if(Q.length===0)return!1;return J.content=[{type:"text",text:Q,cache_control:X}],!0}if(!Array.isArray(Q))return!1;for(let Y=Q.length-1;Y>=0;Y--){let _=Q[Y];if(_?.type==="text"){let H=_;return H.cache_control=X,!0}}return!1}function EJ(J,X,Q){let Y=[],_=($)=>{if($.includes("|")){let[q]=$.split("|");return q.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,40)}if(J.provider==="openai")return $.length>40?$.slice(0,40):$;return $},H=n(X.messages,J,($)=>_($));if(X.systemPrompt){let q=J.reasoning&&Q.supportsDeveloperRole?"developer":"system";Y.push({role:q,content:w(X.systemPrompt)})}let K=null;for(let $=0;$<H.length;$++){let q=H[$];if(Q.requiresAssistantAfterToolResult&&K==="toolResult"&&q.role==="user")Y.push({role:"assistant",content:"I have processed the tool results."});if(q.role==="user")if(typeof q.content==="string")Y.push({role:"user",content:w(q.content)});else{let j=q.content.map((V)=>{if(V.type==="text")return{type:"text",text:w(V.text)};else return{type:"image_url",image_url:{url:`data:${V.mimeType};base64,${V.data}`}}});if(j.length===0)continue;Y.push({role:"user",content:j})}else if(q.role==="assistant"){let j={role:"assistant",content:Q.requiresAssistantAfterToolResult?"":null},V=q.content.filter(u).filter((L)=>L.text.trim().length>0).map((L)=>({type:"text",text:w(L.text)})),O=V.map((L)=>L.text).join(""),P=q.content.filter(qJ).filter((L)=>L.thinking.trim().length>0);if(P.length>0)if(Q.requiresThinkingAsText){let L=P.map((G)=>w(G.thinking)).join(`
|
|
4
4
|
|
|
5
5
|
`);j.content=[{type:"text",text:L},...V]}else{if(O.length>0)j.content=O;let L=P[0].thinkingSignature;if(J.provider==="opencode-go"&&L==="reasoning")L="reasoning_content";if(L&&L.length>0)j[L]=P.map((G)=>G.thinking).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{qg as f}from"./chunk-
|
|
1
|
+
import{qg as f}from"./chunk-fa2g2wge.js";import{oh as b,ph as q}from"./chunk-nyhqy6q2.js";function z(){return q("div",{className:"flex h-screen flex-col bg-background min-h-0",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-24"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded-md"}),b(f,{className:"h-8 w-20 rounded-md"})]})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[240px] border-r p-4 space-y-4 hidden md:block shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-4 rounded"}),b(f,{className:"h-4 w-24"})]}),q("div",{className:"pl-4 space-y-3",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-28"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-24"})]})]})]}),q("div",{className:"flex-1 p-6 space-y-6 overflow-y-auto",children:[q("div",{className:"flex items-center justify-between border-b pb-4",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-5 w-40"}),b(f,{className:"h-4 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-32 rounded"})]})]}),q("div",{className:"space-y-4",children:[b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-4 w-24"})}),b("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:Array.from({length:10}).map((w,v)=>q("div",{className:"flex flex-col rounded-lg border bg-card p-3 space-y-3",children:[b(f,{className:"aspect-square w-full rounded-md"}),q("div",{className:"space-y-2",children:[b(f,{className:"h-4 w-3/4"}),q("div",{className:"flex justify-between items-center",children:[b(f,{className:"h-3 w-1/4"}),b(f,{className:"h-3 w-1/3"})]})]})]},v))})]})]})]})]})}function A(){return q("div",{className:"h-screen flex flex-col bg-background",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-16"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-28"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-8 w-20 rounded"})})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[280px] border-r p-4 flex flex-col gap-4 shrink-0 hidden md:flex",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:4}).map((w,v)=>q("div",{className:"flex gap-3 p-2 rounded border",children:[b(f,{className:"h-12 w-12 rounded bg-muted shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[b(f,{className:"h-3 w-2/3"}),b(f,{className:"h-2 w-1/2"})]})]},v))})]}),q("div",{className:"flex-1 bg-muted/20 p-6 flex flex-col justify-between relative min-w-0",children:[b("div",{className:"flex-1 flex items-center justify-center",children:b(f,{className:"w-full max-w-4xl aspect-video rounded-lg shadow-lg"})}),q("div",{className:"mt-4 flex items-center justify-between shrink-0",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-8 w-8 rounded-full"}),b(f,{className:"h-4 w-32"})]}),b(f,{className:"h-4 w-24"})]})]}),q("div",{className:"w-[360px] border-l p-4 flex flex-col gap-6 shrink-0 hidden lg:flex bg-card",children:[q("div",{className:"space-y-4",children:[b(f,{className:"h-5 w-32"}),b("div",{className:"space-y-3",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex justify-between items-center py-1 border-b",children:[b(f,{className:"h-3 w-20"}),b(f,{className:"h-3 w-32"})]},v))})]}),q("div",{className:"flex-1 flex flex-col gap-4",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex gap-3 p-3 rounded-lg border bg-muted/10",children:[b(f,{className:"h-8 w-8 rounded-full shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[q("div",{className:"flex justify-between",children:[b(f,{className:"h-3 w-24"}),b(f,{className:"h-2 w-12"})]}),b(f,{className:"h-3 w-full"}),b(f,{className:"h-3 w-5/6"})]})]},v))})]})]})]})]})}
|
|
2
2
|
export{z as zf,A as Af};
|
|
@@ -38,4 +38,4 @@ If you understand the risks and have appropriate mitigations in place,
|
|
|
38
38
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
39
39
|
|
|
40
40
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
41
|
-
`);this.baseURL=W.baseURL,this.timeout=W.timeout??C0.DEFAULT_TIMEOUT,this.logger=W.logger??console;let J="warn";this.logLevel=J,this.logLevel=iZ(W.logLevel,"ClientOptions.logLevel",this)??iZ(GZ("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=W.fetchOptions,this.maxRetries=W.maxRetries??2,this.fetch=W.fetch??D0(),G(this,vZ,P0,"f"),this._options=W,this.apiKey=typeof Z==="string"?Z:null,this.authToken=$}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){if(X.get("x-api-key")||X.get("authorization"))return;if(this.apiKey&&X.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&X.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(X){return w([await this.apiKeyAuth(X),await this.bearerAuth(X)])}async apiKeyAuth(X){if(this.apiKey==null)return;return w([{"X-Api-Key":this.apiKey}])}async bearerAuth(X){if(this.authToken==null)return;return w([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(X){return k0(X)}getUserAgent(){return`${this.constructor.name}/JS ${m}`}defaultIdempotencyKey(){return`stainless-node-retry-${cZ()}`}makeStatusError(X,Z,$,z){return A.generate(X,Z,$,z)}buildURL(X,Z,$){let z=!Y(this,U0,"m",Q1).call(this)&&$||this.baseURL,W=E0(X)?new URL(X):new URL(z+(z.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),J=this.defaultQuery(),Q=Object.fromEntries(W.searchParams);if(!uZ(J)||!uZ(Q))Z={...Q,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))W.search=this.stringifyQuery(Z);return W.toString()}_calculateNonstreamingTimeout(X){if(3600*X/128000>600)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(X){}async prepareRequest(X,{url:Z,options:$}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,$){return this.request(Promise.resolve($).then((z)=>{return{method:X,path:Z,...z}}))}request(X,Z=null){return new r(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,$){let z=await X,W=z.maxRetries??this.maxRetries;if(Z==null)Z=W;await this.prepareOptions(z);let{req:J,url:Q,timeout:K}=await this.buildRequest(z,{retryCount:W-Z});await this.prepareRequest(J,{url:Q,options:z});let x="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),E=$===void 0?"":`, retryOf: ${$}`,O=Date.now();if(T(this).debug(`[${x}] sending request`,g({retryOfRequestLogID:$,method:z.method,url:Q,options:z,headers:J.headers})),z.signal?.aborted)throw new L;let k=new AbortController,C=await this.fetchWithTimeout(Q,J,K,k).catch(MX),F=Date.now();if(C instanceof globalThis.Error){let h=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new L;let _=b(C)||/timed? ?out/i.test(String(C)+("cause"in C?String(C.cause):""));if(Z)return T(this).info(`[${x}] connection ${_?"timed out":"failed"} - ${h}`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (${h})`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),this.retryRequest(z,Z,$??x);if(T(this).info(`[${x}] connection ${_?"timed out":"failed"} - error; no more retries left`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (error; no more retries left)`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),_)throw new EX;throw new o({cause:C})}let a=[...C.headers.entries()].filter(([h])=>h==="request-id").map(([h,_])=>", "+h+": "+JSON.stringify(_)).join(""),OX=`[${x}${E}${a}] ${J.method} ${Q} ${C.ok?"succeeded":"failed"} with status ${C.status} in ${F-O}ms`;if(!C.ok){let h=await this.shouldRetry(C);if(Z&&h){let NZ=`retrying, ${Z} attempts remaining`;return await f0(C.body),T(this).info(`${OX} - ${NZ}`),T(this).debug(`[${x}] response error (${NZ})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),this.retryRequest(z,Z,$??x,C.headers)}let _=h?"error; no more retries left":"error; not retryable";T(this).info(`${OX} - ${_}`);let q0=await C.text().catch((NZ)=>MX(NZ).message),O0=UZ(q0),M0=O0?void 0:q0;throw T(this).debug(`[${x}] response error (${_})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,message:M0,durationMs:Date.now()-O})),this.makeStatusError(C.status,O0,M0,C.headers)}return T(this).info(OX),T(this).debug(`[${x}] response start`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),{response:C,options:z,controller:k,requestLogID:x,retryOfRequestLogID:$,startTime:O}}getAPIList(X,Z,$){return this.requestAPIList(Z,$&&"then"in $?$.then((z)=>({method:"get",path:X,...z})):{method:"get",path:X,...$})}requestAPIList(X,Z){let $=this.makeRequest(Z,null,void 0);return new AZ(this,$,X)}async fetchWithTimeout(X,Z,$,z){let{signal:W,method:J,...Q}=Z||{},K=this._makeAbort(z);if(W)W.addEventListener("abort",K,{once:!0});let x=setTimeout(K,$),E=globalThis.ReadableStream&&Q.body instanceof globalThis.ReadableStream||typeof Q.body==="object"&&Q.body!==null&&Symbol.asyncIterator in Q.body,O={signal:z.signal,...E?{duplex:"half"}:{},method:"GET",...Q};if(J)O.method=J.toUpperCase();try{return await this.fetch.call(void 0,X,O)}finally{clearTimeout(x)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,$,z){let W,J=z?.get("retry-after-ms");if(J){let K=parseFloat(J);if(!Number.isNaN(K))W=K}let Q=z?.get("retry-after");if(Q&&!W){let K=parseFloat(Q);if(!Number.isNaN(K))W=K*1000;else W=Date.parse(Q)-Date.now()}if(W===void 0){let K=X.maxRetries??this.maxRetries;W=this.calculateDefaultRetryTimeoutMillis(Z,K)}return await F0(W),this.makeRequest(X,Z-1,$)}calculateDefaultRetryTimeoutMillis(X,Z){let W=Z-X,J=Math.min(0.5*Math.pow(2,W),8),Q=1-Math.random()*0.25;return J*Q*1000}calculateNonstreamingTimeout(X,Z){if(3600000*X/128000>600000||Z!=null&&X>Z)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(X,{retryCount:Z=0}={}){let $={...X},{method:z,path:W,query:J,defaultBaseURL:Q}=$,K=this.buildURL(W,J,Q);if("timeout"in $)H0("timeout",$.timeout);$.timeout=$.timeout??this.timeout;let{bodyHeaders:x,body:E}=this.buildBody({options:$}),O=await this.buildHeaders({options:X,method:z,bodyHeaders:x,retryCount:Z});return{req:{method:z,headers:O,...$.signal&&{signal:$.signal},...globalThis.ReadableStream&&E instanceof globalThis.ReadableStream&&{duplex:"half"},...E&&{body:E},...this.fetchOptions??{},...$.fetchOptions??{}},url:K,timeout:$.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:$,retryCount:z}){let W={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();W[this.idempotencyHeader]=X.idempotencyKey}let J=w([W,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...B0(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(X),this._options.defaultHeaders,$,X.headers]);return this.validateHeaders(J),J.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let $=w([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&$.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:CZ(X)};else if(typeof X==="object"&&$.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return Y(this,vZ,"f").call(this,{body:X,headers:$})}}C0=M,vZ=new WeakMap,U0=new WeakSet,Q1=function(){return this.baseURL!=="https://api.anthropic.com"};M.Anthropic=C0;M.HUMAN_PROMPT=V1;M.AI_PROMPT=G1;M.DEFAULT_TIMEOUT=600000;M.AnthropicError=N;M.APIError=A;M.APIConnectionError=o;M.APIConnectionTimeoutError=EX;M.APIUserAbortError=L;M.NotFoundError=TX;M.ConflictError=LX;M.RateLimitError=jX;M.BadRequestError=AX;M.AuthenticationError=HX;M.InternalServerError=BX;M.PermissionDeniedError=FX;M.UnprocessableEntityError=SX;M.toFile=HZ;class WX extends M{constructor(){super(...arguments);this.completions=new UX(this),this.messages=new zX(this),this.models=new qX(this),this.beta=new S(this)}}WX.Completions=UX;WX.Messages=zX;WX.Models=qX;WX.Beta=S;export{WX as
|
|
41
|
+
`);this.baseURL=W.baseURL,this.timeout=W.timeout??C0.DEFAULT_TIMEOUT,this.logger=W.logger??console;let J="warn";this.logLevel=J,this.logLevel=iZ(W.logLevel,"ClientOptions.logLevel",this)??iZ(GZ("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=W.fetchOptions,this.maxRetries=W.maxRetries??2,this.fetch=W.fetch??D0(),G(this,vZ,P0,"f"),this._options=W,this.apiKey=typeof Z==="string"?Z:null,this.authToken=$}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){if(X.get("x-api-key")||X.get("authorization"))return;if(this.apiKey&&X.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&X.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(X){return w([await this.apiKeyAuth(X),await this.bearerAuth(X)])}async apiKeyAuth(X){if(this.apiKey==null)return;return w([{"X-Api-Key":this.apiKey}])}async bearerAuth(X){if(this.authToken==null)return;return w([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(X){return k0(X)}getUserAgent(){return`${this.constructor.name}/JS ${m}`}defaultIdempotencyKey(){return`stainless-node-retry-${cZ()}`}makeStatusError(X,Z,$,z){return A.generate(X,Z,$,z)}buildURL(X,Z,$){let z=!Y(this,U0,"m",Q1).call(this)&&$||this.baseURL,W=E0(X)?new URL(X):new URL(z+(z.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),J=this.defaultQuery(),Q=Object.fromEntries(W.searchParams);if(!uZ(J)||!uZ(Q))Z={...Q,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))W.search=this.stringifyQuery(Z);return W.toString()}_calculateNonstreamingTimeout(X){if(3600*X/128000>600)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(X){}async prepareRequest(X,{url:Z,options:$}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,$){return this.request(Promise.resolve($).then((z)=>{return{method:X,path:Z,...z}}))}request(X,Z=null){return new r(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,$){let z=await X,W=z.maxRetries??this.maxRetries;if(Z==null)Z=W;await this.prepareOptions(z);let{req:J,url:Q,timeout:K}=await this.buildRequest(z,{retryCount:W-Z});await this.prepareRequest(J,{url:Q,options:z});let x="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),E=$===void 0?"":`, retryOf: ${$}`,O=Date.now();if(T(this).debug(`[${x}] sending request`,g({retryOfRequestLogID:$,method:z.method,url:Q,options:z,headers:J.headers})),z.signal?.aborted)throw new L;let k=new AbortController,C=await this.fetchWithTimeout(Q,J,K,k).catch(MX),F=Date.now();if(C instanceof globalThis.Error){let h=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new L;let _=b(C)||/timed? ?out/i.test(String(C)+("cause"in C?String(C.cause):""));if(Z)return T(this).info(`[${x}] connection ${_?"timed out":"failed"} - ${h}`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (${h})`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),this.retryRequest(z,Z,$??x);if(T(this).info(`[${x}] connection ${_?"timed out":"failed"} - error; no more retries left`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (error; no more retries left)`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),_)throw new EX;throw new o({cause:C})}let a=[...C.headers.entries()].filter(([h])=>h==="request-id").map(([h,_])=>", "+h+": "+JSON.stringify(_)).join(""),OX=`[${x}${E}${a}] ${J.method} ${Q} ${C.ok?"succeeded":"failed"} with status ${C.status} in ${F-O}ms`;if(!C.ok){let h=await this.shouldRetry(C);if(Z&&h){let NZ=`retrying, ${Z} attempts remaining`;return await f0(C.body),T(this).info(`${OX} - ${NZ}`),T(this).debug(`[${x}] response error (${NZ})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),this.retryRequest(z,Z,$??x,C.headers)}let _=h?"error; no more retries left":"error; not retryable";T(this).info(`${OX} - ${_}`);let q0=await C.text().catch((NZ)=>MX(NZ).message),O0=UZ(q0),M0=O0?void 0:q0;throw T(this).debug(`[${x}] response error (${_})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,message:M0,durationMs:Date.now()-O})),this.makeStatusError(C.status,O0,M0,C.headers)}return T(this).info(OX),T(this).debug(`[${x}] response start`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),{response:C,options:z,controller:k,requestLogID:x,retryOfRequestLogID:$,startTime:O}}getAPIList(X,Z,$){return this.requestAPIList(Z,$&&"then"in $?$.then((z)=>({method:"get",path:X,...z})):{method:"get",path:X,...$})}requestAPIList(X,Z){let $=this.makeRequest(Z,null,void 0);return new AZ(this,$,X)}async fetchWithTimeout(X,Z,$,z){let{signal:W,method:J,...Q}=Z||{},K=this._makeAbort(z);if(W)W.addEventListener("abort",K,{once:!0});let x=setTimeout(K,$),E=globalThis.ReadableStream&&Q.body instanceof globalThis.ReadableStream||typeof Q.body==="object"&&Q.body!==null&&Symbol.asyncIterator in Q.body,O={signal:z.signal,...E?{duplex:"half"}:{},method:"GET",...Q};if(J)O.method=J.toUpperCase();try{return await this.fetch.call(void 0,X,O)}finally{clearTimeout(x)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,$,z){let W,J=z?.get("retry-after-ms");if(J){let K=parseFloat(J);if(!Number.isNaN(K))W=K}let Q=z?.get("retry-after");if(Q&&!W){let K=parseFloat(Q);if(!Number.isNaN(K))W=K*1000;else W=Date.parse(Q)-Date.now()}if(W===void 0){let K=X.maxRetries??this.maxRetries;W=this.calculateDefaultRetryTimeoutMillis(Z,K)}return await F0(W),this.makeRequest(X,Z-1,$)}calculateDefaultRetryTimeoutMillis(X,Z){let W=Z-X,J=Math.min(0.5*Math.pow(2,W),8),Q=1-Math.random()*0.25;return J*Q*1000}calculateNonstreamingTimeout(X,Z){if(3600000*X/128000>600000||Z!=null&&X>Z)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(X,{retryCount:Z=0}={}){let $={...X},{method:z,path:W,query:J,defaultBaseURL:Q}=$,K=this.buildURL(W,J,Q);if("timeout"in $)H0("timeout",$.timeout);$.timeout=$.timeout??this.timeout;let{bodyHeaders:x,body:E}=this.buildBody({options:$}),O=await this.buildHeaders({options:X,method:z,bodyHeaders:x,retryCount:Z});return{req:{method:z,headers:O,...$.signal&&{signal:$.signal},...globalThis.ReadableStream&&E instanceof globalThis.ReadableStream&&{duplex:"half"},...E&&{body:E},...this.fetchOptions??{},...$.fetchOptions??{}},url:K,timeout:$.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:$,retryCount:z}){let W={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();W[this.idempotencyHeader]=X.idempotencyKey}let J=w([W,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...B0(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(X),this._options.defaultHeaders,$,X.headers]);return this.validateHeaders(J),J.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let $=w([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&$.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:CZ(X)};else if(typeof X==="object"&&$.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return Y(this,vZ,"f").call(this,{body:X,headers:$})}}C0=M,vZ=new WeakMap,U0=new WeakSet,Q1=function(){return this.baseURL!=="https://api.anthropic.com"};M.Anthropic=C0;M.HUMAN_PROMPT=V1;M.AI_PROMPT=G1;M.DEFAULT_TIMEOUT=600000;M.AnthropicError=N;M.APIError=A;M.APIConnectionError=o;M.APIConnectionTimeoutError=EX;M.APIUserAbortError=L;M.NotFoundError=TX;M.ConflictError=LX;M.RateLimitError=jX;M.BadRequestError=AX;M.AuthenticationError=HX;M.InternalServerError=BX;M.PermissionDeniedError=FX;M.UnprocessableEntityError=SX;M.toFile=HZ;class WX extends M{constructor(){super(...arguments);this.completions=new UX(this),this.messages=new zX(this),this.models=new qX(this),this.beta=new S(this)}}WX.Completions=UX;WX.Messages=zX;WX.Models=qX;WX.Beta=S;export{WX as rk};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as W,b as X,c as Y,d,e as f,f as P}from"./chunk-wc8sc9r9.js";import{qf as M,rf as U,sf as C,tf as H,uf as I}from"./chunk-15sefy5t.js";import{Gh as T,Qj as q,Sh as N,Vh as l,ai as G,ek as K,gk as y,hk as A,ik as D,jk as L,mh as J,mk as o,oh as n,ph as i,sh as Q,th as w,vj as b}from"./chunk-nyhqy6q2.js";import{Vk as E}from"./chunk-0qkj838r.js";var x=E(J(),1);var Z=E(J(),1);var R=E(J(),1);var B=q("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});var k=R.createContext({size:"default",variant:"default",spacing:0});function O({className:p,variant:r,size:v,spacing:c=0,children:u,...g}){return n(K.Root,{"data-slot":"toggle-group","data-variant":r,"data-size":v,"data-spacing":c,style:{"--gap":c},className:y("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",p),...g,children:n(k.Provider,{value:{variant:r,size:v,spacing:c},children:u})})}function z({className:p,children:r,variant:v,size:c,...u}){let g=R.useContext(k);return n(K.Item,{"data-slot":"toggle-group-item","data-variant":g.variant||v,"data-size":g.size||c,"data-spacing":g.spacing,className:y(B({variant:g.variant||v,size:g.size||c}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",p),...u,children:r})}function a({teamId:p}){let[r,v]=Z.useState("team"),[c,u]=Z.useState("1h"),{data:g,isLoading:s}=w({queryKey:["teams",p,"ai-usage",c,"team"],queryFn:async()=>{let t=await N.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:p},query:{timeframe:c}});if(!t.ok)throw Error("Failed to fetch team AI usage");return await t.json()},enabled:!!p&&r==="team"}),{data:$,isLoading:j}=w({queryKey:["teams",p,"members"],queryFn:async()=>{let t=await N.api.teams[":teamId"].members.$get({param:{teamId:p},query:{}});if(!t.ok)throw Error("Failed to fetch team members");return await t.json()},enabled:!!p&&r==="members"}),F=Q({queries:($||[]).map((t)=>({queryKey:["teams",p,"ai-usage",c,t.id],queryFn:async()=>{let V=await N.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:p},query:{timeframe:c,userId:t.id}});if(!V.ok)throw Error(`Failed to fetch AI usage for member ${t.id}`);return await V.json()},enabled:!!p&&r==="members"}))}),m=j||F.some((t)=>t.isLoading),e=(t)=>{if(!t)return"U";let V=t.split(" ");if(V.length>1)return`${V[0][0]}${V[V.length-1][0]}`.toUpperCase();return t.substring(0,2).toUpperCase()},nn=(t)=>{if(!t)return"";switch(t.toLowerCase()){case"owner":return o.owner();case"editor":return o.editor();case"reviewer":return o.reviewer();default:return t}},h=(t)=>(t??0).toLocaleString(),S=(t)=>`$${(t??0).toFixed(6)}`;return i(M,{className:"border-border/60 shadow-sm",children:[i(U,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[i("div",{children:[n(C,{className:"text-xl font-semibold tracking-tight",children:o.ai_usage()}),n(H,{className:"text-sm text-muted-foreground mt-1",children:o.ai_usage_description()})]}),i("div",{className:"flex flex-wrap items-center gap-3",children:[i(O,{type:"single",value:r,onValueChange:(t)=>{if(t)v(t)},className:"border rounded-lg p-1 bg-muted/30",children:[n(z,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:o.team_view()}),n(z,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:o.members_view()})]}),i(O,{type:"single",value:c,onValueChange:(t)=>{if(t)u(t)},className:"border rounded-lg p-1 bg-muted/30",children:[n(z,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),n(z,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),n(z,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),n(z,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),n(I,{children:r==="team"?s?n("div",{className:"flex h-48 items-center justify-center",children:n(G,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):n("div",{className:"rounded-md border",children:i(W,{children:[n(X,{children:i(d,{children:[n(f,{children:o.team()}),n(f,{className:"text-right",children:o.input_tokens()}),n(f,{className:"text-right",children:o.output_tokens()}),n(f,{className:"text-right",children:o.cache_read_tokens()}),n(f,{className:"text-right",children:o.total_tokens()}),n(f,{className:"text-right",children:o.cost()})]})}),n(Y,{children:i(d,{children:[n(P,{className:"font-medium",children:o.team()}),n(P,{className:"text-right",children:h(g?.team?.inputTokens)}),n(P,{className:"text-right",children:h(g?.team?.outputTokens)}),n(P,{className:"text-right",children:h(g?.team?.cacheReadTokens)}),n(P,{className:"text-right font-medium",children:h(g?.team?.totalTokens)}),n(P,{className:"text-right font-medium",children:S(g?.team?.cost)})]})})]})}):m?n("div",{className:"flex h-48 items-center justify-center",children:n(G,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):n("div",{className:"rounded-md border",children:i(W,{children:[n(X,{children:i(d,{children:[n(f,{children:o.members()}),n(f,{children:o.role()}),n(f,{className:"text-right",children:o.input_tokens()}),n(f,{className:"text-right",children:o.output_tokens()}),n(f,{className:"text-right",children:o.cache_read_tokens()}),n(f,{className:"text-right",children:o.total_tokens()}),n(f,{className:"text-right",children:o.cost()})]})}),n(Y,{children:($||[]).map((t,V)=>{let _=F[V]?.data?.member;return i(d,{children:[n(P,{children:i("div",{className:"flex items-center gap-3",children:[i(A,{className:"h-8 w-8 rounded-full",children:[t.image&&n(D,{src:t.image,alt:t.name,className:"object-cover"}),n(L,{className:"bg-primary/20 text-xs",children:e(t.name)})]}),i("div",{className:"flex flex-col",children:[n("span",{className:"text-sm font-medium leading-none",children:t.name}),n("span",{className:"text-xs text-muted-foreground mt-0.5",children:t.email})]})]})}),n(P,{className:"text-xs text-muted-foreground",children:nn(t.role)}),n(P,{className:"text-right",children:h(_?.inputTokens)}),n(P,{className:"text-right",children:h(_?.outputTokens)}),n(P,{className:"text-right",children:h(_?.cacheReadTokens)}),n(P,{className:"text-right font-medium",children:h(_?.totalTokens)}),n(P,{className:"text-right font-medium",children:S(_?.cost)})]},t.id)})})]})})})]})}function tn(){let{teamId:p}=on.useParams(),[r,v]=x.useState("ai-usage"),{data:c,isLoading:u}=w({queryKey:["teams",p,"me"],queryFn:async()=>{let g=await N.api.teams[":teamId"].me.$get({param:{teamId:p}});if(!g.ok)throw Error("Failed to fetch me");return await g.json()},enabled:!!p});if(u)return n("div",{className:"flex h-screen items-center justify-center",children:n(G,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(c?.role?.toLowerCase()!=="owner")return i("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[n(b,{className:"h-12 w-12 text-destructive mb-4"}),n("h2",{className:"text-xl font-bold tracking-tight mb-2",children:o.access_denied()}),n("p",{className:"text-sm text-muted-foreground max-w-md",children:o.only_owner_dashboard()})]});return n("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:i("div",{className:"flex flex-col md:flex-row h-full",children:[n("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:i("nav",{className:"p-4 space-y-1 mt-4",children:[n("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:o.dashboard()}),n("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:o.ai()}),i("button",{onClick:()=>v("ai-usage"),className:y("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",r==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[n(l,{className:"w-5 h-5"}),o.usage(),r==="ai-usage"&&n("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),n("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:n("div",{className:"max-w-6xl mx-auto space-y-8",children:r==="ai-usage"&&n(a,{teamId:p})})})]})})}var on=T("/teams/$teamId/dashboard")({component:tn});export{on as Route};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r,b as a,c as s,d as E,e as $,f as q}from"./chunk-wc8sc9r9.js";import{fa as j}from"./chunk-7e06b2zb.js";import{Va as t}from"./chunk-srn8t0v7.js";import"./chunk-kfhtk3eh.js";import{Za as x}from"./chunk-b8js74jk.js";import"./chunk-0xbf8bcg.js";import{jf as l}from"./chunk-q24epdh8.js";import{zf as o}from"./chunk-ry33f2qk.js";import{og as d,pg as i}from"./chunk-fa2g2wge.js";import{Qg as m,bh as h}from"./chunk-gswbc6y9.js";import{Bh as C,Gh as P,Gi as b,Ki as g,Qh as B,Sh as A,Xi as I,ai as f,hk as p,ik as c,jk as n,mh as qG,mk as X,nh as k,oh as G,ph as K,qh as y,ti as T,uh as L,uj as u,vh as F,wh as S}from"./chunk-nyhqy6q2.js";import{Vk as $G}from"./chunk-0qkj838r.js";var _=$G(qG(),1);var OG=(Y)=>{if(!Y)return"??";return Y.split(" ").map((O)=>O[0]).slice(0,2).join("").toUpperCase()};function zG(){let{projectId:Y}=BG.useParams(),{teamId:O,ensureTeamIdForProject:U}=h(),e=y(),GG=C();_.useEffect(()=>{U(Y)},[Y,U]);let{data:M}=L(l(Y)),D=M?.rootFolder,[JG,KG]=_.useState(240),{shareConfigLeftSidebarCollapsed:Q,setShareConfigLeftSidebarCollapsed:XG}=i(),{data:V,isLoading:YG,fetchNextPage:R,hasNextPage:v,isFetchingNextPage:W}=S({queryKey:["shares",Y],queryFn:async({pageParam:J})=>{let Z=await A.api.projects[":projectId"].shares.$get({param:{projectId:Y},query:{first:"20",after:J}});if(!Z.ok)throw Error("Failed to fetch share links");return await Z.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!Y}),{ref:ZG,inView:w}=d();_.useEffect(()=>{if(w&&v&&!W)R()},[w,v,W,R]);let H=_.useMemo(()=>V?.pages.flatMap((J)=>J.data)||[],[V]),{mutate:_G}=F({mutationFn:async({id:J,isDisabled:Z})=>{let z=await A.api.shares[":shareId"].$put({param:{shareId:J},json:{isDisabled:Z}});if(!z.ok)throw Error("Failed to update share link");return await z.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["shares",Y]}),B.success(X.share_link_status_updated())},onError:(J)=>{B.error(X.error_message({message:J.message}))}});if(!O||!D||!M)return G(o,{});let N=(J)=>{let Z=`${window.location.origin}/share/${J}`;navigator.clipboard.writeText(Z),B.success(X.link_copied())};return G("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!Q&&G("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>XG(!0)}),!Q&&K(k,{children:[G("div",{className:"bg-background",style:{width:JG},children:G(j,{teamId:O,projectId:Y,projectName:M.name??"",rootFolderId:D})}),G(t,{onResize:(J)=>{KG((Z)=>Math.max(180,Math.min(400,Z+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[G("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[G(u,{className:"h-5 w-5 text-primary"}),G("h1",{className:"font-bold text-lg text-foreground",children:X.all_share_links()})]})}),G("div",{className:"flex-1 overflow-y-auto p-6",children:YG?G("div",{className:"flex justify-center items-center h-64",children:G("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):H.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[G(I,{className:"h-10 w-10 text-muted-foreground/50"}),G("p",{children:X.no_share_links_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(r,{children:[G(a,{children:K(E,{className:"hover:bg-transparent bg-muted/20",children:[G($,{className:"font-semibold px-4 py-3",children:X.name()}),G($,{className:"font-semibold px-4 py-3",children:X.public_link()}),G($,{className:"font-semibold px-4 py-3",children:X.creator()}),G($,{className:"font-semibold px-4 py-3 w-[150px]",children:X.created_date()}),G($,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:X.active()})]})}),G(s,{children:H.map((J)=>{let Z=`${window.location.origin}/share/${J.id}`;return K(E,{className:"hover:bg-muted/10 transition-colors",children:[G(q,{className:"font-medium px-4 py-3.5",children:G("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>GG({to:"/projects/$projectId/shares/$shareId",params:{projectId:Y,shareId:J.id}}),children:J.name})}),G(q,{className:"px-4 py-3.5 max-w-[300px]",children:K("div",{className:"flex items-center gap-2 group",children:[G("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>N(J.id),title:X.click_to_copy_link(),children:Z}),G(m,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>N(J.id),children:G(b,{className:"h-3.5 w-3.5"})}),G("a",{href:Z,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:G(g,{className:"h-3.5 w-3.5"})})]})}),G(q,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(p,{className:"h-6 w-6",children:[J.creator?.image&&G(c,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),G(n,{className:"text-[10px]",children:OG(J.creator?.name)})]}),G("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:J.creator?.name||X.unknown()})]})}),G(q,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[G(T,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),G("span",{children:new Date(J.createdAt).toLocaleDateString()})]})}),G(q,{className:"px-4 py-3.5 text-right",children:G("div",{className:"flex justify-end",children:G(x,{checked:!J.isDisabled,onCheckedChange:(z)=>_G({id:J.id,isDisabled:!z})})})})]},J.id)})})]}),G("div",{ref:ZG,className:"h-10 w-full flex items-center justify-center",children:W&&G(f,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var BG=P("/projects/$projectId/shares/")({component:zG});export{BG as Route};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ch as N5,mh as x0,oh as TJ,ph as PZ}from"./chunk-nyhqy6q2.js";import{Vk as TZ}from"./chunk-0qkj838r.js";var FQ=TZ(x0(),1);var b5=({onResize:J,className:Q=""})=>{let[Z,$]=FQ.useState(!1),q=FQ.useRef(0);FQ.useEffect(()=>{if(!Z)return;let K=(B)=>{let N=B.clientX-q.current;q.current=B.clientX,J(N)},X=()=>{$(!1),document.body.style.cursor=""};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",X),document.body.style.cursor="col-resize",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",X),document.body.style.cursor=""}},[Z,J]);let Y=(K)=>{K.preventDefault(),K.stopPropagation(),$(!0),q.current=K.clientX},H=()=>TJ("div",{className:"absolute inset-y-0 -left-4 -right-4 z-20 cursor-col-resize touch-none"});return PZ("div",{className:`group relative z-20 flex h-full w-[2px] cursor-col-resize items-center justify-center bg-border transition-all hover:bg-transparent ${Q}`,onMouseDown:Y,children:[TJ(H,{}),TJ("div",{className:`absolute inset-y-0 w-[2px] transition-all duration-300 ease-out
|
|
2
2
|
${Z?"bg-blue-600 shadow-[0_0_15px_rgba(37,99,235,0.6)] opacity-100":"bg-blue-400 opacity-0 group-hover:opacity-100 group-hover:shadow-[0_0_8px_rgba(96,165,250,0.5)]"}
|
|
3
3
|
`}),TJ("div",{className:`absolute top-1/2 left-1/2 h-10 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-blue-600 transition-all duration-300 ease-out
|
|
4
4
|
${Z?"opacity-100 scale-100 shadow-[0_0_10px_rgba(37,99,235,0.5)]":"opacity-0 scale-75 group-hover:opacity-100 group-hover:scale-100"}`})]})};var e$=Symbol.for("preact-signals");function xZ(){if(!(PJ>1)){var J,Q=!1;(function(){var q=SZ;SZ=void 0;while(q!==void 0){if(q.S.v===q.v)q.S.i=q.i;q=q.o}})();while(cQ!==void 0){var Z=cQ;cQ=void 0,EZ++;while(Z!==void 0){var $=Z.u;if(Z.u=void 0,Z.f&=-3,!(8&Z.f)&&_9(Z))try{Z.c()}catch(q){if(!Q)J=q,Q=!0}Z=$}}if(EZ=0,PJ--,Q)throw J}else PJ--}function JJ(J){if(PJ>0)return J();h0=++Jq,PJ++;try{return J()}finally{xZ()}}var k=void 0;function C(J){var Q=k;k=void 0;try{return J()}finally{k=Q}}var p9,cQ=void 0,PJ=0,EZ=0,Jq=0,h0=0,SZ=void 0,kZ=0;function d9(J){if(k!==void 0){var Q=J.n;if(Q===void 0||Q.t!==k){if(Q={i:0,S:J,p:k.s,n:void 0,t:k,e:void 0,x:void 0,r:Q},k.s!==void 0)k.s.n=Q;if(k.s=Q,J.n=Q,32&k.f)J.S(Q);return Q}else if(Q.i===-1){if(Q.i=0,Q.n!==void 0){if(Q.n.p=Q.p,Q.p!==void 0)Q.p.n=Q.n;Q.p=k.s,Q.n=void 0,k.s.n=Q,k.s=Q}return Q}}}function r(J,Q){this.v=J,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=Q==null?void 0:Q.watched,this.Z=Q==null?void 0:Q.unwatched,this.name=Q==null?void 0:Q.name}r.prototype.brand=e$;r.prototype.h=function(){return!0};r.prototype.S=function(J){var Q=this,Z=this.t;if(Z!==J&&J.e===void 0)if(J.x=Z,this.t=J,Z!==void 0)Z.e=J;else C(function(){var $;($=Q.W)==null||$.call(Q)})};r.prototype.U=function(J){var Q=this;if(this.t!==void 0){var{e:Z,x:$}=J;if(Z!==void 0)Z.x=$,J.e=void 0;if($!==void 0)$.e=Z,J.x=void 0;if(J===this.t){if(this.t=$,$===void 0)C(function(){var q;(q=Q.Z)==null||q.call(Q)})}}};r.prototype.subscribe=function(J){var Q=this;return o(function(){var Z=Q.value,$=k;k=void 0;try{J(Z)}finally{k=$}},{name:"sub"})};r.prototype.valueOf=function(){return this.value};r.prototype.toString=function(){return this.value+""};r.prototype.toJSON=function(){return this.value};r.prototype.peek=function(){var J=this;return C(function(){return J.value})};Object.defineProperty(r.prototype,"value",{get:function(){var J=d9(this);if(J!==void 0)J.i=this.i;return this.v},set:function(J){if(J!==this.v){if(EZ>100)throw Error("Cycle detected");(function(Z){if(PJ!==0&&EZ===0){if(Z.l!==h0)Z.l=h0,SZ={S:Z,v:Z.v,i:Z.i,o:SZ}}})(this),this.v=J,this.i++,kZ++,PJ++;try{for(var Q=this.t;Q!==void 0;Q=Q.x)Q.t.N()}finally{xZ()}}}});function IJ(J,Q){return new r(J,Q)}function _9(J){for(var Q=J.s;Q!==void 0;Q=Q.n)if(Q.S.i!==Q.i||!Q.S.h()||Q.S.i!==Q.i)return!0;return!1}function c9(J){for(var Q=J.s;Q!==void 0;Q=Q.n){var Z=Q.S.n;if(Z!==void 0)Q.r=Z;if(Q.S.n=Q,Q.i=-1,Q.n===void 0){J.s=Q;break}}}function l9(J){var Q=J.s,Z=void 0;while(Q!==void 0){var $=Q.p;if(Q.i===-1){if(Q.S.U(Q),$!==void 0)$.n=Q.n;if(Q.n!==void 0)Q.n.p=$}else Z=Q;if(Q.S.n=Q.r,Q.r!==void 0)Q.r=void 0;Q=$}J.s=Z}function sJ(J,Q){r.call(this,void 0),this.x=J,this.s=void 0,this.g=kZ-1,this.f=4,this.W=Q==null?void 0:Q.watched,this.Z=Q==null?void 0:Q.unwatched,this.name=Q==null?void 0:Q.name}sJ.prototype=new r;sJ.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===kZ)return!0;if(this.g=kZ,this.f|=1,this.i>0&&!_9(this))return this.f&=-2,!0;var J=k;try{c9(this),k=this;var Q=this.x();if(16&this.f||this.v!==Q||this.i===0)this.v=Q,this.f&=-17,this.i++}catch(Z){this.v=Z,this.f|=16,this.i++}return k=J,l9(this),this.f&=-2,!0};sJ.prototype.S=function(J){if(this.t===void 0){this.f|=36;for(var Q=this.s;Q!==void 0;Q=Q.n)Q.S.S(Q)}r.prototype.S.call(this,J)};sJ.prototype.U=function(J){if(this.t!==void 0){if(r.prototype.U.call(this,J),this.t===void 0){this.f&=-33;for(var Q=this.s;Q!==void 0;Q=Q.n)Q.S.U(Q)}}};sJ.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var J=this.t;J!==void 0;J=J.x)J.t.N()}};Object.defineProperty(sJ.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var J=d9(this);if(this.h(),J!==void 0)J.i=this.i;if(16&this.f)throw this.v;return this.v}});function y0(J,Q){return new sJ(J,Q)}function s9(J){var Q=J.m;if(J.m=void 0,typeof Q=="function"){PJ++;var Z=k;k=void 0;try{Q()}catch($){throw J.f&=-2,J.f|=8,f0(J),$}finally{k=Z,xZ()}}}function f0(J){for(var Q=J.s;Q!==void 0;Q=Q.n)Q.S.U(Q);J.x=void 0,J.s=void 0,s9(J)}function Qq(J){if(k!==this)throw Error("Out-of-order effect");if(l9(this),k=J,this.f&=-2,8&this.f)f0(this);xZ()}function zQ(J,Q){if(this.x=J,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=Q==null?void 0:Q.name,p9)p9.push(this)}zQ.prototype.c=function(){var J=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var Q=this.x();if(typeof Q=="function")this.m=Q}finally{J()}};zQ.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,s9(this),c9(this),PJ++;var J=k;return k=this,Qq.bind(this,J)};zQ.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=cQ,cQ=this};zQ.prototype.d=function(){if(this.f|=8,!(1&this.f))f0(this)};zQ.prototype.dispose=function(){this.d()};function o(J,Q){var Z=new zQ(J,Q);try{Z.c()}catch(q){throw Z.d(),q}var $=Z.d.bind(Z);return $[Symbol.dispose]=$,$}var{create:Zq,defineProperty:s0,defineProperties:$q,getOwnPropertyDescriptor:qq,getOwnPropertyDescriptors:Yq,getOwnPropertySymbols:o9}=Object,Kq=Object.prototype.hasOwnProperty,Hq=Object.prototype.propertyIsEnumerable,n9=(J,Q)=>(Q=Symbol[J])?Q:Symbol.for("Symbol."+J),MQ=(J)=>{throw TypeError(J)},m0=(J,Q,Z)=>(Q in J)?s0(J,Q,{enumerable:!0,configurable:!0,writable:!0,value:Z}):J[Q]=Z,Xq=(J,Q)=>{for(var Z in Q||(Q={}))if(Kq.call(Q,Z))m0(J,Z,Q[Z]);if(o9){for(var Z of o9(Q))if(Hq.call(Q,Z))m0(J,Z,Q[Z])}return J},Wq=(J,Q)=>$q(J,Yq(Q)),i9=(J,Q)=>s0(J,"name",{value:Q,configurable:!0}),Bq=(J)=>{var Q;return[,,,Zq((Q=J==null?void 0:J[n9("metadata")])!=null?Q:null)]},a9=["class","method","getter","setter","accessor","field","value","get","set"],lQ=(J)=>J!==void 0&&typeof J!=="function"?MQ("Function expected"):J,Nq=(J,Q,Z,$,q)=>({kind:a9[J],name:Q,metadata:$,addInitializer:(Y)=>Z._?MQ("Already initialized"):q.push(lQ(Y||null))}),r9=(J,Q)=>m0(Q,n9("metadata"),J[3]),oJ=(J,Q,Z,$)=>{for(var q=0,Y=J[Q>>1],H=Y&&Y.length;q<H;q++)Q&1?Y[q].call(Z):$=Y[q].call(Z,$);return $},wQ=(J,Q,Z,$,q,Y)=>{var H,K,X,B,N,W=Q&7,G=!!(Q&8),L=!!(Q&16),F=W>3?J.length+1:W?G?1:2:0,z=a9[W+5],A=W>3&&(J[F-1]=[]),I=J[F]||(J[F]=[]),U=W&&(!L&&!G&&(q=q.prototype),W<5&&(W>3||!L)&&qq(W<4?q:{get[Z](){return LJ(this,Y)},set[Z](V){return vJ(this,Y,V)}},Z));W?L&&W<4&&i9(Y,(W>2?"set ":W>1?"get ":"")+Z):i9(q,Z);for(var M=$.length-1;M>=0;M--){if(B=Nq(W,Z,X={},J[3],I),W){if(B.static=G,B.private=L,N=B.access={has:L?(V)=>Uq(q,V):(V)=>(Z in V)},W^3)N.get=L?(V)=>(W^1?LJ:Lq)(V,q,W^4?Y:U.get):(V)=>V[Z];if(W>2)N.set=L?(V,w)=>vJ(V,q,w,W^4?Y:U.set):(V,w)=>V[Z]=w}if(K=(0,$[M])(W?W<4?L?Y:U[z]:W>4?void 0:{get:U.get,set:U.set}:q,B),X._=1,W^4||K===void 0)lQ(K)&&(W>4?A.unshift(K):W?L?Y=K:U[z]=K:q=K);else if(typeof K!=="object"||K===null)MQ("Object expected");else lQ(H=K.get)&&(U.get=H),lQ(H=K.set)&&(U.set=H),lQ(H=K.init)&&A.unshift(H)}return W||r9(J,q),U&&s0(q,Z,U),L?W^4?Y:U:q},o0=(J,Q,Z)=>Q.has(J)||MQ("Cannot "+Z),Uq=(J,Q)=>Object(Q)!==Q?MQ('Cannot use the "in" operator on this value'):J.has(Q),LJ=(J,Q,Z)=>(o0(J,Q,"read from private field"),Z?Z.call(J):Q.get(J)),sQ=(J,Q,Z)=>Q.has(J)?MQ("Cannot add the same private member more than once"):Q instanceof WeakSet?Q.add(J):Q.set(J,Z),vJ=(J,Q,Z,$)=>(o0(J,Q,"write to private field"),$?$.call(J,Z):Q.set(J,Z),Z),Lq=(J,Q,Z)=>(o0(J,Q,"access private method"),Z);function AQ(J,Q){if(Q){let Z;return y0(()=>{let $=J();if($&&Z&&Q(Z,$))return Z;return Z=$,$})}return y0(J)}function EJ(J,Q){if(Object.is(J,Q))return!0;if(J===null||Q===null)return!1;if(typeof J==="function"&&typeof Q==="function")return J===Q;if(J instanceof Set&&Q instanceof Set){if(J.size!==Q.size)return!1;for(let Z of J)if(!Q.has(Z))return!1;return!0}if(Array.isArray(J)){if(!Array.isArray(Q)||J.length!==Q.length)return!1;return!J.some(($,q)=>!EJ($,Q[q]))}if(typeof J==="object"&&typeof Q==="object"){let Z=Object.keys(J),$=Object.keys(Q);if(Z.length!==$.length)return!1;return!Z.some((Y)=>!EJ(J[Y],Q[Y]))}return!1}function T({get:J},Q){return{init(Z){return IJ(Z)},get(){return J.call(this).value},set(Z){let $=J.call(this);if($.peek()===Z)return;$.value=Z}}}function h(J,Q){let Z=new WeakMap;return function(){let $=Z.get(this);if(!$)$=AQ(J.bind(this)),Z.set(this,$);return $.value}}function v0(J=!0){return function(Q,Z){Z.addInitializer(function(){let $=Z.kind==="field"?this:Z.static?this:Object.getPrototypeOf(this),q=Object.getOwnPropertyDescriptor($,Z.name);if(q)Object.defineProperty($,Z.name,Wq(Xq({},q),{enumerable:J}))})}}function nJ(...J){let Q=J.map((Z)=>o(Z));return()=>Q.forEach((Z)=>Z())}var t9,e9,J8,Q8,Z8,$8,QJ,i0,b0,p0,d0,t,n0,g0,q8,_0,a0,u0,c0,l0;$8=[T],Z8=[T],Q8=[T],J8=[v0()],e9=[v0()],t9=[v0()];var jJ=class{constructor(J,Q=Object.is){this.defaultValue=J,this.equals=Q,oJ(QJ,5,this),sQ(this,t),sQ(this,i0,oJ(QJ,8,this)),oJ(QJ,11,this),sQ(this,n0,oJ(QJ,12,this)),oJ(QJ,15,this),sQ(this,a0,oJ(QJ,16,this)),oJ(QJ,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return LJ(this,t,c0)}get initial(){return LJ(this,t,p0)}get previous(){return LJ(this,t,q8)}set current(J){let Q=C(()=>LJ(this,t,c0));if(J&&Q&&this.equals(Q,J))return;JJ(()=>{if(!LJ(this,t,p0))vJ(this,t,J,d0);vJ(this,t,Q,_0),vJ(this,t,J,l0)})}reset(J=this.defaultValue){JJ(()=>{vJ(this,t,void 0,_0),vJ(this,t,J,d0),vJ(this,t,J,l0)})}};QJ=Bq(null);i0=new WeakMap;t=new WeakSet;n0=new WeakMap;a0=new WeakMap;b0=wQ(QJ,20,"#initial",$8,t,i0),p0=b0.get,d0=b0.set;g0=wQ(QJ,20,"#previous",Z8,t,n0),q8=g0.get,_0=g0.set;u0=wQ(QJ,20,"#current",Q8,t,a0),c0=u0.get,l0=u0.set;wQ(QJ,2,"current",J8,jJ);wQ(QJ,2,"initial",e9,jJ);wQ(QJ,2,"previous",t9,jJ);r9(QJ,jJ);function hZ(J){return C(()=>{let Q={};for(let Z in J)Q[Z]=J[Z];return Q})}var iJ,o5=class{constructor(){sQ(this,iJ,new WeakMap)}get(J,Q){var Z;return J?(Z=LJ(this,iJ).get(J))==null?void 0:Z.get(Q):void 0}set(J,Q,Z){var $;if(!J)return;if(!LJ(this,iJ).has(J))LJ(this,iJ).set(J,new Map);return($=LJ(this,iJ).get(J))==null?void 0:$.set(Q,Z)}clear(J){var Q;return J?(Q=LJ(this,iJ).get(J))==null?void 0:Q.clear():void 0}};iJ=new WeakMap;var{create:Gq,defineProperty:Q1,getOwnPropertyDescriptor:Vq,getOwnPropertySymbols:Y8}=Object,Fq=Object.prototype.hasOwnProperty,zq=Object.prototype.propertyIsEnumerable,X8=(J,Q)=>(Q=Symbol[J])?Q:Symbol.for("Symbol."+J),IQ=(J)=>{throw TypeError(J)},K8=Math.pow,r0=(J,Q,Z)=>(Q in J)?Q1(J,Q,{enumerable:!0,configurable:!0,writable:!0,value:Z}):J[Q]=Z,Mq=(J,Q)=>{for(var Z in Q||(Q={}))if(Fq.call(Q,Z))r0(J,Z,Q[Z]);if(Y8){for(var Z of Y8(Q))if(zq.call(Q,Z))r0(J,Z,Q[Z])}return J},H8=(J,Q)=>Q1(J,"name",{value:Q,configurable:!0}),wq=(J)=>{var Q;return[,,,Gq((Q=J==null?void 0:J[X8("metadata")])!=null?Q:null)]},W8=["class","method","getter","setter","accessor","field","value","get","set"],oQ=(J)=>J!==void 0&&typeof J!=="function"?IQ("Function expected"):J,Aq=(J,Q,Z,$,q)=>({kind:W8[J],name:Q,metadata:$,addInitializer:(Y)=>Z._?IQ("Already initialized"):q.push(oQ(Y||null))}),B8=(J,Q)=>r0(Q,X8("metadata"),J[3]),Iq=(J,Q,Z,$)=>{for(var q=0,Y=J[Q>>1],H=Y&&Y.length;q<H;q++)Q&1?Y[q].call(Z):$=Y[q].call(Z,$);return $},N8=(J,Q,Z,$,q,Y)=>{var H,K,X,B,N,W=Q&7,G=!!(Q&8),L=!!(Q&16),F=W>3?J.length+1:W?G?1:2:0,z=W8[W+5],A=W>3&&(J[F-1]=[]),I=J[F]||(J[F]=[]),U=W&&(!L&&!G&&(q=q.prototype),W<5&&(W>3||!L)&&Vq(W<4?q:{get[Z](){return t0(this,Y)},set[Z](V){return e0(this,Y,V)}},Z));W?L&&W<4&&H8(Y,(W>2?"set ":W>1?"get ":"")+Z):H8(q,Z);for(var M=$.length-1;M>=0;M--){if(B=Aq(W,Z,X={},J[3],I),W){if(B.static=G,B.private=L,N=B.access={has:L?(V)=>jq(q,V):(V)=>(Z in V)},W^3)N.get=L?(V)=>(W^1?t0:Rq)(V,q,W^4?Y:U.get):(V)=>V[Z];if(W>2)N.set=L?(V,w)=>e0(V,q,w,W^4?Y:U.set):(V,w)=>V[Z]=w}if(K=(0,$[M])(W?W<4?L?Y:U[z]:W>4?void 0:{get:U.get,set:U.set}:q,B),X._=1,W^4||K===void 0)oQ(K)&&(W>4?A.unshift(K):W?L?Y=K:U[z]=K:q=K);else if(typeof K!=="object"||K===null)IQ("Object expected");else oQ(H=K.get)&&(U.get=H),oQ(H=K.set)&&(U.set=H),oQ(H=K.init)&&A.unshift(H)}return W||B8(J,q),U&&Q1(q,Z,U),L?W^4?Y:U:q},Z1=(J,Q,Z)=>Q.has(J)||IQ("Cannot "+Z),jq=(J,Q)=>Object(Q)!==Q?IQ('Cannot use the "in" operator on this value'):J.has(Q),t0=(J,Q,Z)=>(Z1(J,Q,"read from private field"),Z?Z.call(J):Q.get(J)),Oq=(J,Q,Z)=>Q.has(J)?IQ("Cannot add the same private member more than once"):Q instanceof WeakSet?Q.add(J):Q.set(J,Z),e0=(J,Q,Z,$)=>(Z1(J,Q,"write to private field"),$?$.call(J,Z):Q.set(J,Z),Z),Rq=(J,Q,Z)=>(Z1(J,Q,"access private method"),Z),e=class J{constructor(Q,Z){this.x=Q,this.y=Z}static delta(Q,Z){return new J(Q.x-Z.x,Q.y-Z.y)}static distance(Q,Z){return Math.hypot(Q.x-Z.x,Q.y-Z.y)}static equals(Q,Z){return Q.x===Z.x&&Q.y===Z.y}static from({x:Q,y:Z}){return new J(Q,Z)}},XJ=class J{constructor(Q,Z,$,q){this.left=Q,this.top=Z,this.width=$,this.height=q,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(Q,Z){let{top:$,left:q,width:Y,height:H,scale:K}=this,X=new J(q+Q,$+Z,Y,H);return X.scale=Mq({},K),X}get boundingRectangle(){let{width:Q,height:Z,left:$,top:q,right:Y,bottom:H}=this;return{width:Q,height:Z,left:$,top:q,right:Y,bottom:H}}get center(){let{left:Q,top:Z,right:$,bottom:q}=this;return new e((Q+$)/2,(Z+q)/2)}get area(){let{width:Q,height:Z}=this;return Q*Z}equals(Q){if(!(Q instanceof J))return!1;let{left:Z,top:$,width:q,height:Y}=this;return Z===Q.left&&$===Q.top&&q===Q.width&&Y===Q.height}containsPoint(Q){let{top:Z,left:$,bottom:q,right:Y}=this;return Z<=Q.y&&Q.y<=q&&$<=Q.x&&Q.x<=Y}intersectionArea(Q){if(Q instanceof J)return Dq(this,Q);return 0}intersectionRatio(Q){let{area:Z}=this,$=this.intersectionArea(Q);return $/(Q.area+Z-$)}get bottom(){let{top:Q,height:Z}=this;return Q+Z}get right(){let{left:Q,width:Z}=this;return Q+Z}get aspectRatio(){let{width:Q,height:Z}=this;return Q/Z}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:Q,left:Z,width:$,height:q}){return new J(Z,Q,$,q)}static delta(Q,Z,$={x:"center",y:"center"}){let q=(Y,H)=>{let K=$[H],X=H==="x"?Y.left:Y.top,B=H==="x"?Y.width:Y.height;if(K=="start")return X;if(K=="end")return X+B;return X+B/2};return e.delta({x:q(Q,"x"),y:q(Q,"y")},{x:q(Z,"x"),y:q(Z,"y")})}static intersectionRatio(Q,Z){return J.from(Q).intersectionRatio(J.from(Z))}};function Dq(J,Q){let Z=Math.max(Q.top,J.top),$=Math.max(Q.left,J.left),q=Math.min(Q.left+Q.width,J.left+J.width),Y=Math.min(Q.top+Q.height,J.top+J.height),H=q-$,K=Y-Z;if($<q&&Z<Y)return H*K;return 0}var U8,L8,J1,yZ,iQ,nQ=class extends(J1=jJ,L8=[h],U8=[h],J1){constructor(J){let Q=e.from(J);super(Q,(Z,$)=>e.equals(Z,$));Iq(iQ,5,this),Oq(this,yZ,0),this.velocity={x:0,y:0}}get delta(){return e.delta(this.current,this.initial)}get direction(){let{current:J,previous:Q}=this;if(!Q)return null;let Z={x:J.x-Q.x,y:J.y-Q.y};if(!Z.x&&!Z.y)return null;if(Math.abs(Z.x)>Math.abs(Z.y))return Z.x>0?"right":"left";return Z.y>0?"down":"up"}get current(){return super.current}set current(J){let{current:Q}=this,Z=e.from(J),$={x:Z.x-Q.x,y:Z.y-Q.y},q=Date.now(),Y=q-t0(this,yZ),H=(K)=>Math.round(K/Y*100);JJ(()=>{e0(this,yZ,q),this.velocity={x:H($.x),y:H($.y)},super.current=Z})}reset(J=this.defaultValue){super.reset(e.from(J)),this.velocity={x:0,y:0}}};iQ=wq(J1);yZ=new WeakMap;N8(iQ,2,"delta",L8,nQ);N8(iQ,2,"direction",U8,nQ);B8(iQ,nQ);function fZ({x:J,y:Q},Z){let $=Math.abs(J),q=Math.abs(Q);if(typeof Z==="number")return Math.sqrt(K8($,2)+K8(q,2))>Z;if("x"in Z&&"y"in Z)return $>Z.x&&q>Z.y;if("x"in Z)return $>Z.x;if("y"in Z)return q>Z.y;return!1}var G8=((J)=>{return J.Horizontal="x",J.Vertical="y",J})(G8||{}),$1=Object.values(G8);var{create:Cq,defineProperty:X1,defineProperties:Tq,getOwnPropertyDescriptor:Pq,getOwnPropertyDescriptors:Eq,getOwnPropertySymbols:dZ}=Object,M8=Object.prototype.hasOwnProperty,w8=Object.prototype.propertyIsEnumerable,A8=(J,Q)=>(Q=Symbol[J])?Q:Symbol.for("Symbol."+J),TQ=(J)=>{throw TypeError(J)},Y1=(J,Q,Z)=>(Q in J)?X1(J,Q,{enumerable:!0,configurable:!0,writable:!0,value:Z}):J[Q]=Z,W1=(J,Q)=>{for(var Z in Q||(Q={}))if(M8.call(Q,Z))Y1(J,Z,Q[Z]);if(dZ){for(var Z of dZ(Q))if(w8.call(Q,Z))Y1(J,Z,Q[Z])}return J},B1=(J,Q)=>Tq(J,Eq(Q)),V8=(J,Q)=>X1(J,"name",{value:Q,configurable:!0}),I8=(J,Q)=>{var Z={};for(var $ in J)if(M8.call(J,$)&&Q.indexOf($)<0)Z[$]=J[$];if(J!=null&&dZ){for(var $ of dZ(J))if(Q.indexOf($)<0&&w8.call(J,$))Z[$]=J[$]}return Z},PQ=(J)=>{var Q;return[,,,Cq((Q=J==null?void 0:J[A8("metadata")])!=null?Q:null)]},j8=["class","method","getter","setter","accessor","field","value","get","set"],aQ=(J)=>J!==void 0&&typeof J!=="function"?TQ("Function expected"):J,Sq=(J,Q,Z,$,q)=>({kind:j8[J],name:Q,metadata:$,addInitializer:(Y)=>Z._?TQ("Already initialized"):q.push(aQ(Y||null))}),rJ=(J,Q)=>Y1(Q,A8("metadata"),J[3]),O=(J,Q,Z,$)=>{for(var q=0,Y=J[Q>>1],H=Y&&Y.length;q<H;q++)Q&1?Y[q].call(Z):$=Y[q].call(Z,$);return $},P=(J,Q,Z,$,q,Y)=>{var H,K,X,B,N,W=Q&7,G=!!(Q&8),L=!!(Q&16),F=W>3?J.length+1:W?G?1:2:0,z=j8[W+5],A=W>3&&(J[F-1]=[]),I=J[F]||(J[F]=[]),U=W&&(!L&&!G&&(q=q.prototype),W<5&&(W>3||!L)&&Pq(W<4?q:{get[Z](){return u(this,Y)},set[Z](V){return WJ(this,Y,V)}},Z));W?L&&W<4&&V8(Y,(W>2?"set ":W>1?"get ":"")+Z):V8(q,Z);for(var M=$.length-1;M>=0;M--){if(B=Sq(W,Z,X={},J[3],I),W){if(B.static=G,B.private=L,N=B.access={has:L?(V)=>kq(q,V):(V)=>(Z in V)},W^3)N.get=L?(V)=>(W^1?u:O8)(V,q,W^4?Y:U.get):(V)=>V[Z];if(W>2)N.set=L?(V,w)=>WJ(V,q,w,W^4?Y:U.set):(V,w)=>V[Z]=w}if(K=(0,$[M])(W?W<4?L?Y:U[z]:W>4?void 0:{get:U.get,set:U.set}:q,B),X._=1,W^4||K===void 0)aQ(K)&&(W>4?A.unshift(K):W?L?Y=K:U[z]=K:q=K);else if(typeof K!=="object"||K===null)TQ("Object expected");else aQ(H=K.get)&&(U.get=H),aQ(H=K.set)&&(U.set=H),aQ(H=K.init)&&A.unshift(H)}return W||rJ(J,q),U&&X1(q,Z,U),L?W^4?Y:U:q},N1=(J,Q,Z)=>Q.has(J)||TQ("Cannot "+Z),kq=(J,Q)=>Object(Q)!==Q?TQ('Cannot use the "in" operator on this value'):J.has(Q),u=(J,Q,Z)=>(N1(J,Q,"read from private field"),Z?Z.call(J):Q.get(J)),E=(J,Q,Z)=>Q.has(J)?TQ("Cannot add the same private member more than once"):Q instanceof WeakSet?Q.add(J):Q.set(J,Z),WJ=(J,Q,Z,$)=>(N1(J,Q,"write to private field"),$?$.call(J,Z):Q.set(J,Z),Z),O8=(J,Q,Z)=>(N1(J,Q,"access private method"),Z);function R8(J,Q){return{plugin:J,options:Q}}function EQ(J){return(Q)=>{return R8(J,Q)}}function CQ(J){if(typeof J==="function")return{plugin:J,options:void 0};return J}var D8,eQ,U1,bZ;D8=[T];var $J=class{constructor(J,Q){this.manager=J,this.options=Q,E(this,U1,O(eQ,8,this,!1)),O(eQ,11,this),E(this,bZ,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return C(()=>{return this.disabled})}configure(J){this.options=J}registerEffect(J){let Q=o(J.bind(this));return u(this,bZ).add(Q),Q}destroy(){u(this,bZ).forEach((J)=>J())}static configure(J){return R8(this,J)}};eQ=PQ(null);U1=new WeakMap;bZ=new WeakMap;P(eQ,4,"disabled",D8,$J,U1);rJ(eQ,$J);var SQ=class extends $J{},gZ,q1=class{constructor(J){this.manager=J,this.instances=new Map,E(this,gZ,[])}get values(){return Array.from(this.instances.values())}set values(J){let Q=J.map(CQ).reduce(($,q)=>{let Y=$.find(({plugin:H})=>H===q.plugin);if(Y)return Y.options=q.options,$;return[...$,q]},[]),Z=Q.map(({plugin:$})=>$);for(let $ of u(this,gZ))if(!Z.includes($)){if($.prototype instanceof SQ)continue;this.unregister($)}for(let{plugin:$,options:q}of Q)this.register($,q);WJ(this,gZ,Z)}get(J){return this.instances.get(J)}register(J,Q){let Z=this.instances.get(J);if(Z){if(Z.options!==Q)Z.options=Q;return Z}let $=new J(this.manager,Q);return this.instances.set(J,$),$}unregister(J){let Q=this.instances.get(J);if(Q)Q.destroy(),this.instances.delete(J)}destroy(){for(let J of this.instances.values())J.destroy();this.instances.clear()}};gZ=new WeakMap;function xq(J,Q){if(J.priority===Q.priority){if(J.type===Q.type)return Q.value-J.value;return Q.type-J.type}return Q.priority-J.priority}var vZ=[],jQ,OQ,hq=class extends $J{constructor(J){super(J);E(this,jQ),E(this,OQ),this.computeCollisions=this.computeCollisions.bind(this),WJ(this,OQ,IJ(vZ)),this.destroy=nJ(()=>{let Q=this.computeCollisions(),Z=C(()=>this.manager.dragOperation.position.current);if(Q!==vZ){let $=u(this,jQ);if(WJ(this,jQ,Z),$&&Z.x==$.x&&Z.y==$.y)return}else WJ(this,jQ,void 0);u(this,OQ).value=Q},()=>{let{dragOperation:Q}=this.manager;if(Q.status.initialized)this.forceUpdate()})}forceUpdate(J=!0){C(()=>{if(J)u(this,OQ).value=this.computeCollisions();else WJ(this,jQ,void 0)})}computeCollisions(J,Q){let{registry:Z,dragOperation:$}=this.manager,{source:q,shape:Y,status:H}=$;if(!H.initialized||!Y)return vZ;let K=[],X=[];for(let B of J!=null?J:Z.droppables){if(B.disabled)continue;if(q&&!B.accepts(q))continue;let N=Q!=null?Q:B.collisionDetector;if(!N)continue;X.push(B),B.shape;let W=C(()=>N({droppable:B,dragOperation:$}));if(W){if(B.collisionPriority!=null)W.priority=B.collisionPriority;K.push(W)}}if(X.length===0)return vZ;return K.sort(xq),K}get collisions(){return u(this,OQ).value}};jQ=new WeakMap;OQ=new WeakMap;var C8,T8,P8,L1,E8,zJ,G1,DQ,V1,F1;P8=[T],T8=[T],C8=[T];var SJ=class J{constructor(Q,Z){E(this,G1,O(zJ,8,this)),O(zJ,11,this),E(this,DQ),E(this,V1,O(zJ,12,this)),O(zJ,15,this),E(this,F1,O(zJ,16,this)),O(zJ,19,this);let{effects:$,id:q,data:Y={},disabled:H=!1,register:K=!0}=Q,X=q;if(WJ(this,DQ,IJ(q)),this.manager=Z,this.data=Y,this.disabled=H,this.effects=()=>{var B;return[()=>{let{id:N,manager:W}=this;if(N===X)return;return X=N,W==null||W.registry.register(this),()=>W==null?void 0:W.registry.unregister(this)},...(B=$==null?void 0:$())!=null?B:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),Z&&K)queueMicrotask(this.register)}get id(){var Q,Z;let $=u(this,DQ).value;return(Z=(Q=J.pendingIdChanges)==null?void 0:Q.get(this))!=null?Z:$}set id(Q){var Z,$;let q=($=(Z=J.pendingIdChanges)==null?void 0:Z.get(this))!=null?$:u(this,DQ).peek();if(Q===q)return;if(!J.pendingIdChanges)J.pendingIdChanges=new Map,queueMicrotask(()=>{var Y;return O8(Y=J,L1,E8).call(Y)});J.pendingIdChanges.set(this,Q)}register(){var Q;return(Q=this.manager)==null?void 0:Q.registry.register(this)}unregister(){var Q;(Q=this.manager)==null||Q.registry.unregister(this)}destroy(){var Q;(Q=this.manager)==null||Q.registry.unregister(this)}};zJ=PQ(null);L1=new WeakSet;E8=function(){let J=SJ.pendingIdChanges;if(SJ.pendingIdChanges=null,J)JJ(()=>{for(let[Q,Z]of J)u(Q,DQ).value=Z})};G1=new WeakMap;DQ=new WeakMap;V1=new WeakMap;F1=new WeakMap;P(zJ,4,"manager",P8,SJ,G1);P(zJ,4,"data",T8,SJ,V1);P(zJ,4,"disabled",C8,SJ,F1);E(SJ,L1);rJ(zJ,SJ);SJ.pendingIdChanges=null;var _Z=SJ,F8=class{constructor(){this.map=IJ(new Map),this.cleanupFunctions=new WeakMap,this.register=(J,Q)=>{let Z=this.map.peek(),$=Z.get(J),q=()=>this.unregister(J,Q);if($===Q)return q;if($){if($.id===J){let K=this.cleanupFunctions.get($);K==null||K(),this.cleanupFunctions.delete($)}}let Y=new Map(Z);for(let[K,X]of Z)if(X===Q&&K!==J){Y.delete(K);break}Y.set(J,Q),this.map.value=Y;let H=nJ(...Q.effects());return this.cleanupFunctions.set(Q,H),q},this.unregister=(J,Q)=>{let Z=this.map.peek();if(Z.get(J)!==Q)return;let $=this.cleanupFunctions.get(Q);$==null||$(),this.cleanupFunctions.delete(Q);let q=new Map(Z);q.delete(J),this.map.value=q}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(J){return this.map.value.has(J)}get(J){return this.map.value.get(J)}destroy(){for(let J of this){let Q=this.cleanupFunctions.get(J);Q==null||Q(),J.destroy()}this.map.value=new Map}},S8,k8,x8,h8,y8,f8,K1,ZJ,z1,M1,w1,MJ=class extends(K1=_Z,f8=[T],y8=[T],h8=[T],x8=[h],k8=[h],S8=[h],K1){constructor(J,Q){var Z=J,{modifiers:$,type:q,sensors:Y,plugins:H,effects:K}=Z,X=I8(Z,["modifiers","type","sensors","plugins","effects"]);super(B1(W1({},X),{effects:()=>{var B;return[...(B=K==null?void 0:K())!=null?B:[],()=>{let{manager:N,plugins:W}=this;if(!N||!W)return;for(let G of W){let{plugin:L}=CQ(G);N.registry.plugins.register(L)}}]}}),Q);O(ZJ,5,this),E(this,z1,O(ZJ,8,this)),O(ZJ,11,this),E(this,M1,O(ZJ,12,this)),O(ZJ,15,this),E(this,w1,O(ZJ,16,this,this.isDragSource?"dragging":"idle")),O(ZJ,19,this),this.type=q,this.sensors=Y,this.modifiers=$,this.alignment=X.alignment,this.plugins=H}pluginConfig(J){if(!this.plugins)return;for(let Q of this.plugins){let Z=CQ(Q);if(Z.plugin===J)return Z.options}return}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var J,Q;return((Q=(J=this.manager)==null?void 0:J.dragOperation.source)==null?void 0:Q.id)===this.id}};ZJ=PQ(K1);z1=new WeakMap;M1=new WeakMap;w1=new WeakMap;P(ZJ,4,"type",f8,MJ,z1);P(ZJ,4,"modifiers",y8,MJ,M1);P(ZJ,4,"status",h8,MJ,w1);P(ZJ,2,"isDropping",x8,MJ);P(ZJ,2,"isDragging",k8,MJ);P(ZJ,2,"isDragSource",S8,MJ);rJ(ZJ,MJ);var v8,b8,g8,u8,m8,p8,H1,c,A1,I1,j1,O1,R1,wJ=class extends(H1=_Z,p8=[T],m8=[T],u8=[T],g8=[T],b8=[T],v8=[h],H1){constructor(J,Q){var Z=J,{accept:$,collisionDetector:q,collisionPriority:Y,type:H}=Z,K=I8(Z,["accept","collisionDetector","collisionPriority","type"]);super(K,Q);O(c,5,this),E(this,A1,O(c,8,this)),O(c,11,this),E(this,I1,O(c,12,this)),O(c,15,this),E(this,j1,O(c,16,this)),O(c,19,this),E(this,O1,O(c,20,this)),O(c,23,this),E(this,R1,O(c,24,this)),O(c,27,this),this.accept=$,this.collisionDetector=q,this.collisionPriority=Y,this.type=H}accepts(J){let{accept:Q}=this;if(!Q)return!0;if(typeof Q==="function")return Q(J);if(!J.type)return!1;if(Array.isArray(Q))return Q.includes(J.type);return J.type===Q}get isDropTarget(){var J,Q;return((Q=(J=this.manager)==null?void 0:J.dragOperation.target)==null?void 0:Q.id)===this.id}};c=PQ(H1);A1=new WeakMap;I1=new WeakMap;j1=new WeakMap;O1=new WeakMap;R1=new WeakMap;P(c,4,"accept",p8,wJ,A1);P(c,4,"type",m8,wJ,I1);P(c,4,"collisionDetector",u8,wJ,j1);P(c,4,"collisionPriority",g8,wJ,O1);P(c,4,"shape",b8,wJ,R1);P(c,2,"isDropTarget",v8,wJ);rJ(c,wJ);var yq=class{constructor(){this.registry=new Map}addEventListener(J,Q){let{registry:Z}=this,$=new Set(Z.get(J));return $.add(Q),Z.set(J,$),()=>this.removeEventListener(J,Q)}removeEventListener(J,Q){let{registry:Z}=this,$=new Set(Z.get(J));$.delete(Q),Z.set(J,$)}dispatch(J,...Q){let{registry:Z}=this,$=Z.get(J);if(!$)return;for(let q of $)q(...Q)}},fq=class extends yq{constructor(J){super();this.manager=J}dispatch(J,Q){let Z=[Q,this.manager];super.dispatch(J,...Z)}};function uZ(J,Q=!0){let Z=!1;return B1(W1({},J),{cancelable:Q,get defaultPrevented(){return Z},preventDefault(){if(!Q)return;Z=!0}})}var vq=class extends SQ{constructor(J){super(J);let Q=($,q)=>$.map(({id:Y})=>Y).join("")===q.map(({id:Y})=>Y).join(""),Z=[];this.destroy=nJ(()=>{let{dragOperation:$,collisionObserver:q}=J;if($.status.initializing)Z=[],q.enable()},()=>{let{collisionObserver:$,monitor:q}=J,{collisions:Y}=$;if($.isDisabled())return;if(_Z.pendingIdChanges)return;let H=uZ({collisions:Y});if(q.dispatch("collision",H),H.defaultPrevented)return;if(Q(Y,Z))return;else Z=Y;let[K]=Y;C(()=>{var X;if((K==null?void 0:K.id)!==((X=J.dragOperation.target)==null?void 0:X.id))$.disable(),J.actions.setDropTarget(K==null?void 0:K.id).then(()=>{$.enable()})})})}},OJ=((J)=>{return J[J.Lowest=0]="Lowest",J[J.Low=1]="Low",J[J.Normal=2]="Normal",J[J.High=3]="High",J[J.Highest=4]="Highest",J})(OJ||{}),RJ=((J)=>{return J[J.Collision=0]="Collision",J[J.ShapeIntersection=1]="ShapeIntersection",J[J.PointerIntersection=2]="PointerIntersection",J})(RJ||{}),d8,_8,c8,l8,s8,o8,i8,GJ,D1;i8=[T],o8=[h],s8=[h],l8=[h],c8=[h],_8=[h],d8=[h];var kJ=class{constructor(){O(GJ,5,this),E(this,D1,O(GJ,8,this,"idle")),O(GJ,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){let{value:J}=this;return J!=="idle"&&J!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(J){this.value=J}};GJ=PQ(null);D1=new WeakMap;P(GJ,4,"value",i8,kJ,D1);P(GJ,2,"current",o8,kJ);P(GJ,2,"idle",s8,kJ);P(GJ,2,"initializing",l8,kJ);P(GJ,2,"initialized",c8,kJ);P(GJ,2,"dragging",_8,kJ);P(GJ,2,"dropped",d8,kJ);rJ(GJ,kJ);var bq=class{constructor(J){this.manager=J}setDragSource(J){let{dragOperation:Q}=this.manager;Q.sourceIdentifier=typeof J==="string"||typeof J==="number"?J:J.id}setDropTarget(J){return C(()=>{let{dragOperation:Q}=this.manager,Z=J!=null?J:null;if(Q.targetIdentifier===Z)return Promise.resolve(!1);Q.targetIdentifier=Z;let $=uZ({operation:Q.snapshot()});if(Q.status.dragging)this.manager.monitor.dispatch("dragover",$);return this.manager.renderer.rendering.then(()=>$.defaultPrevented)})}start(J){return C(()=>{let{dragOperation:Q}=this.manager;if(J.source!=null)this.setDragSource(J.source);if(!Q.source)throw Error("Cannot start a drag operation without a drag source");if(!Q.status.idle)throw Error("Cannot start a drag operation while another is active");let $=new AbortController,{event:q,coordinates:Y}=J;JJ(()=>{Q.status.set("initialization-pending"),Q.shape=null,Q.canceled=!1,Q.activatorEvent=q!=null?q:null,Q.position.reset(Y)});let H=uZ({operation:Q.snapshot()});if(this.manager.monitor.dispatch("beforedragstart",H),H.defaultPrevented)return Q.reset(),$.abort(),$;return Q.status.set("initializing"),Q.controller=$,this.manager.renderer.rendering.then(()=>{if($.signal.aborted)return;let{status:K}=Q;if(K.current!=="initializing")return;JJ(()=>{Q.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:q,operation:Q.snapshot(),cancelable:!1})})}),$})}move(J){return C(()=>{var Q,Z;let{dragOperation:$}=this.manager,{status:q,controller:Y}=$;if(!q.dragging||!Y||Y.signal.aborted)return;let H=uZ({nativeEvent:J.event,operation:$.snapshot(),by:J.by,to:J.to},(Q=J.cancelable)!=null?Q:!0);if((Z=J.propagate)!=null?Z:!0)this.manager.monitor.dispatch("dragmove",H);queueMicrotask(()=>{var K,X,B,N,W;if(H.defaultPrevented)return;let G=(W=J.to)!=null?W:{x:$.position.current.x+((X=(K=J.by)==null?void 0:K.x)!=null?X:0),y:$.position.current.y+((N=(B=J.by)==null?void 0:B.y)!=null?N:0)};$.position.current=G})})}stop(J={}){return C(()=>{var Q,Z;let{dragOperation:$}=this.manager,{controller:q}=$;if(!q||q.signal.aborted)return;let Y,H=()=>{let X={resume:()=>{},abort:()=>{}};return Y=new Promise((B,N)=>{X.resume=B,X.abort=N}),X};q.abort();let K=()=>{this.manager.renderer.rendering.then(()=>{$.status.set("dropped");let X=C(()=>{var N;return((N=$.source)==null?void 0:N.status)==="dropping"}),B=()=>{if($.controller===q)$.controller=void 0;$.reset()};if(X){let{source:N}=$,W=o(()=>{if((N==null?void 0:N.status)==="idle")W(),B()})}else this.manager.renderer.rendering.then(B)})};if($.canceled=(Q=J.canceled)!=null?Q:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:J.event,operation:$.snapshot(),canceled:(Z=J.canceled)!=null?Z:!1,suspend:H}),Y)Y.then(K).catch(()=>$.reset());else K()})}},aJ=class extends $J{constructor(J,Q){super(J,Q);this.manager=J,this.options=Q}},n8=class extends AbortController{constructor(J,Q){super();this.constraints=J,this.onActivate=Q,this.activated=!1;for(let Z of J!=null?J:[])Z.controller=this}onEvent(J){var Q;if(this.activated)return;if((Q=this.constraints)==null?void 0:Q.length)for(let Z of this.constraints)Z.onEvent(J);else this.activate(J)}activate(J){if(this.activated)return;this.activated=!0,this.onActivate(J)}abort(J){this.activated=!1,super.abort(J)}},mZ,C1=class{constructor(J){this.options=J,E(this,mZ)}set controller(J){WJ(this,mZ,J),J.signal.addEventListener("abort",()=>this.abort())}activate(J){var Q;(Q=u(this,mZ))==null||Q.activate(J)}};mZ=new WeakMap;var z8=class extends $J{constructor(J,Q){super(J,Q);this.manager=J,this.options=Q}apply(J){return J.transform}},gq=class{constructor(J){this.draggables=new F8,this.droppables=new F8,this.plugins=new q1(J),this.sensors=new q1(J),this.modifiers=new q1(J)}register(J,Q){if(J instanceof MJ)return this.draggables.register(J.id,J);if(J instanceof wJ)return this.droppables.register(J.id,J);if(J.prototype instanceof z8)return this.modifiers.register(J,Q);if(J.prototype instanceof aJ)return this.sensors.register(J,Q);if(J.prototype instanceof $J)return this.plugins.register(J,Q);throw Error("Invalid instance type")}unregister(J){if(J instanceof _Z){if(J instanceof MJ)return this.draggables.unregister(J.id,J);if(J instanceof wJ)return this.droppables.unregister(J.id,J);return()=>{}}if(J.prototype instanceof z8)return this.modifiers.unregister(J);if(J.prototype instanceof aJ)return this.sensors.unregister(J);if(J.prototype instanceof $J)return this.plugins.unregister(J);throw Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},a8,r8,t8,e8,J2,Q2,Z2,$2,q2,rQ,pZ,RQ,g,T1,P1,E1,S1,k1,tQ;q2=[h],$2=[T],Z2=[T],Q2=[T],J2=[T],e8=[T],t8=[h],r8=[h],a8=[h];var AJ=class{constructor(J){O(g,5,this),E(this,rQ),E(this,pZ),E(this,RQ,new jJ(void 0,(Q,Z)=>Q&&Z?Q.equals(Z):Q===Z)),this.status=new kJ,E(this,T1,O(g,8,this,!1)),O(g,11,this),E(this,P1,O(g,12,this,null)),O(g,15,this),E(this,E1,O(g,16,this,null)),O(g,19,this),E(this,S1,O(g,20,this,null)),O(g,23,this),E(this,k1,O(g,24,this,[])),O(g,27,this),this.position=new nQ({x:0,y:0}),E(this,tQ,{x:0,y:0}),WJ(this,rQ,J)}get shape(){let{current:J,initial:Q,previous:Z}=u(this,RQ);if(!J||!Q)return null;return{current:J,initial:Q,previous:Z}}set shape(J){if(!J)u(this,RQ).reset();else u(this,RQ).current=J}get source(){var J;let Q=this.sourceIdentifier;if(Q==null)return null;let Z=u(this,rQ).registry.draggables.get(Q);if(Z)WJ(this,pZ,Z);return(J=Z!=null?Z:u(this,pZ))!=null?J:null}get target(){var J;let Q=this.targetIdentifier;return Q!=null?(J=u(this,rQ).registry.droppables.get(Q))!=null?J:null:null}get transform(){let{x:J,y:Q}=this.position.delta,Z={x:J,y:Q};for(let $ of this.modifiers)Z=$.apply(B1(W1({},this.snapshot()),{transform:Z}));return WJ(this,tQ,Z),Z}snapshot(){return C(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:u(this,tQ),shape:this.shape?hZ(this.shape):null,position:hZ(this.position),status:hZ(this.status),canceled:this.canceled}))}reset(){JJ(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,u(this,RQ).reset(),this.position.reset({x:0,y:0}),WJ(this,tQ,{x:0,y:0}),this.modifiers=[]})}};g=PQ(null);rQ=new WeakMap;pZ=new WeakMap;RQ=new WeakMap;T1=new WeakMap;P1=new WeakMap;E1=new WeakMap;S1=new WeakMap;k1=new WeakMap;tQ=new WeakMap;P(g,2,"shape",q2,AJ);P(g,4,"canceled",$2,AJ,T1);P(g,4,"activatorEvent",Z2,AJ,P1);P(g,4,"sourceIdentifier",Q2,AJ,E1);P(g,4,"targetIdentifier",J2,AJ,S1);P(g,4,"modifiers",e8,AJ,k1);P(g,2,"source",t8,AJ);P(g,2,"target",r8,AJ);P(g,2,"transform",a8,AJ);rJ(g,AJ);var uq={get rendering(){return Promise.resolve()}};function VJ(J,Q){if(typeof J==="function")return J(Q);return J!=null?J:Q}var Y2=class{constructor(J){this.destroy=()=>{if(!this.dragOperation.status.idle)this.actions.stop({canceled:!0});this.dragOperation.modifiers.forEach((W)=>W.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var Q;let Z=J!=null?J:{},$=VJ(Z.plugins,[]),q=VJ(Z.sensors,[]),Y=VJ(Z.modifiers,[]),H=(Q=Z.renderer)!=null?Q:uq,K=new fq(this),X=new gq(this);this.registry=X,this.monitor=K,this.renderer=H,this.actions=new bq(this),this.dragOperation=new AJ(this),this.collisionObserver=new hq(this),this.plugins=[vq,...$],this.modifiers=Y,this.sensors=q;let{destroy:B}=this,N=nJ(()=>{var W,G,L;let F=C(()=>this.dragOperation.modifiers),z=this.modifiers;for(let A of F)if(!z.includes(A))A.destroy();this.dragOperation.modifiers=(L=(G=(W=this.dragOperation.source)==null?void 0:W.modifiers)==null?void 0:G.map((A)=>{let{plugin:I,options:U}=CQ(A);return new I(this,U)}))!=null?L:z});this.destroy=()=>{N(),B()}}get plugins(){return this.registry.plugins.values}set plugins(J){this.registry.plugins.values=J}get modifiers(){return this.registry.modifiers.values}set modifiers(J){this.registry.modifiers.values=J}get sensors(){return this.registry.sensors.values}set sensors(J){this.registry.sensors.values=J}};var U2=(J)=>{throw TypeError(J)},y1=(J,Q,Z)=>Q.has(J)||U2("Cannot "+Z),R=(J,Q,Z)=>(y1(J,Q,"read from private field"),Q.get(J)),YJ=(J,Q,Z)=>Q.has(J)?U2("Cannot add the same private member more than once"):Q instanceof WeakSet?Q.add(J):Q.set(J,Z),BJ=(J,Q,Z,$)=>(y1(J,Q,"write to private field"),Q.set(J,Z),Z),L2=(J,Q,Z)=>(y1(J,Q,"access private method"),Z);function eZ(J){if(!J)return!1;if(J instanceof KeyframeEffect)return!0;return"getKeyframes"in J&&typeof J.getKeyframes==="function"}function f1(J,Q){let Z=J.getAnimations(),$=null;for(let q of Z){if(q.playState!=="running")continue;let{effect:Y}=q,K=(eZ(Y)?Y.getKeyframes():[]).filter(Q);if(K.length>0)$=[K[K.length-1],q]}return $}function J0(J){let{width:Q,height:Z,top:$,left:q,bottom:Y,right:H}=J.getBoundingClientRect();return{width:Q,height:Z,top:$,left:q,bottom:Y,right:H}}function v1(J){let Q=Object.prototype.toString.call(J);return Q==="[object Window]"||Q==="[object global]"}function KZ(J){return"nodeType"in J}function NJ(J){var Q,Z,$;if(!J)return window;if(v1(J))return J;if(!KZ(J))return window;if("defaultView"in J)return(Q=J.defaultView)!=null?Q:window;return($=(Z=J.ownerDocument)==null?void 0:Z.defaultView)!=null?$:window}function Q0(J){let{Document:Q}=NJ(J);return J instanceof Q||"nodeType"in J&&J.nodeType===Node.DOCUMENT_NODE}function xJ(J){if(!J||v1(J))return!1;return J instanceof NJ(J).HTMLElement||"namespaceURI"in J&&typeof J.namespaceURI==="string"&&J.namespaceURI.endsWith("html")}function G2(J){return J instanceof NJ(J).SVGElement||"namespaceURI"in J&&typeof J.namespaceURI==="string"&&J.namespaceURI.endsWith("svg")}function QQ(J){if(!J)return document;if(v1(J))return J.document;if(!KZ(J))return document;if(Q0(J))return J;if(xJ(J)||G2(J))return J.ownerDocument;return document}function mq(J){var Q,Z,$,q;let{documentElement:Y}=QQ(J),H=NJ(J).visualViewport,K=(Q=H==null?void 0:H.width)!=null?Q:Y.clientWidth,X=(Z=H==null?void 0:H.height)!=null?Z:Y.clientHeight,B=($=H==null?void 0:H.offsetTop)!=null?$:0,N=(q=H==null?void 0:H.offsetLeft)!=null?q:0;return{top:B,left:N,right:N+K,bottom:B+X,width:K,height:X}}function pq(J,Q){if(dq(J)&&J.open===!1)return!1;let{overflow:Z,overflowX:$,overflowY:q}=getComputedStyle(J);return Z==="visible"&&$==="visible"&&q==="visible"}function dq(J){return J.tagName==="DETAILS"}function iZ(J,Q=J.getBoundingClientRect(),Z=0){var $,q,Y,H,K;let X=Q,{ownerDocument:B}=J,N=($=B.defaultView)!=null?$:window,W=J.parentElement;while(W&&W!==B.documentElement){if(!pq(W)){let M=W.getBoundingClientRect(),V=Z*(M.bottom-M.top),w=Z*(M.right-M.left),f=Z*(M.bottom-M.top),j=Z*(M.right-M.left);X={top:Math.max(X.top,M.top-V),right:Math.min(X.right,M.right+w),bottom:Math.min(X.bottom,M.bottom+f),left:Math.max(X.left,M.left-j),width:0,height:0},X.width=X.right-X.left,X.height=X.bottom-X.top}W=W.parentElement}let G=N.visualViewport,L=(q=G==null?void 0:G.offsetTop)!=null?q:0,F=(Y=G==null?void 0:G.offsetLeft)!=null?Y:0,z=(H=G==null?void 0:G.width)!=null?H:N.innerWidth,A=(K=G==null?void 0:G.height)!=null?K:N.innerHeight,I=Z*A,U=Z*z;if(X={top:Math.max(X.top,L-I),right:Math.min(X.right,F+z+U),bottom:Math.min(X.bottom,L+A+I),left:Math.max(X.left,F-U),width:0,height:0},X.width=X.right-X.left,X.height=X.bottom-X.top,X.width<0)X.width=0;if(X.height<0)X.height=0;return X}function ZQ(J){return{x:J.clientX,y:J.clientY}}var V2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nZ(J=document,Q=new Set){if(Q.has(J))return[];Q.add(J);let Z=[J];for(let $ of Array.from(J.querySelectorAll("iframe, frame")))try{let q=$.contentDocument;if(q&&!Q.has(q))Z.push(...nZ(q,Q))}catch(q){}try{let $=J.defaultView;if($&&$!==window.top){let q=$.parent;if(q&&q.document&&q.document!==J)Z.push(...nZ(q.document,Q))}}catch($){}return Z}function Z0(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function b1(){var J,Q;let Z=Z0()?window.visualViewport:null;return{x:(J=Z==null?void 0:Z.offsetLeft)!=null?J:0,y:(Q=Z==null?void 0:Z.offsetTop)!=null?Q:0}}function $0(J){if(!J||!KZ(J))return!1;return J instanceof NJ(J).ShadowRoot}function HZ(J){if(J&&KZ(J)){let Q=J.getRootNode();if($0(Q))return Q;else if(Q instanceof Document)return Q}return QQ(J)}function g1(J){return J.matchMedia("(prefers-reduced-motion: reduce)").matches}function F2(J){let Z=J.cloneNode(!0),$=Array.from(J.querySelectorAll("input, textarea, select, canvas, [contenteditable]"));return Array.from(Z.querySelectorAll("input, textarea, select, canvas, [contenteditable]")).forEach((Y,H)=>{let K=$[H];if(K2(Y)&&K2(K)){if(Y.type!=="file")Y.value=K.value;if(Y.type==="radio"&&Y.name)Y.name=`Cloned__${Y.name}`}if(H2(Y)&&H2(K)&&K.width>0&&K.height>0){let X=Y.getContext("2d");X==null||X.drawImage(K,0,0)}}),Z}function K2(J){return"value"in J}function H2(J){return J.tagName==="CANVAS"}function u1(J,{x:Q,y:Z}){let $=J.elementFromPoint(Q,Z);if(_q($)){let{contentDocument:q}=$;if(q){let{left:Y,top:H}=$.getBoundingClientRect();return u1(q,{x:Q-Y,y:Z-H})}}return $}function _q(J){return(J==null?void 0:J.tagName)==="IFRAME"}var m1=new WeakMap;function z2(J){return Boolean(J.closest(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as V}from"./chunk-2g12s6mc.js";import"./chunk-f7sbkfmk.js";import"./chunk-fepymbka.js";import"./chunk-xyjw8w3r.js";import"./chunk-ccw7mjgq.js";import"./chunk-pq18zenh.js";import"./chunk-wsyg4rwg.js";import"./chunk-7e06b2zb.js";import"./chunk-srn8t0v7.js";import"./chunk-kfhtk3eh.js";import"./chunk-kr06nrbx.js";import"./chunk-b8js74jk.js";import"./chunk-0xbf8bcg.js";import{wf as U}from"./chunk-5r8858hx.js";import"./chunk-88fg1sw7.js";import{zf as N}from"./chunk-ry33f2qk.js";import"./chunk-77r8w95d.js";import"./chunk-t3t6021k.js";import"./chunk-54tr7y2x.js";import"./chunk-1xpec5r8.js";import"./chunk-0rxhc7ka.js";import"./chunk-fa2g2wge.js";import"./chunk-fz88kkk1.js";import"./chunk-dghtwyq1.js";import{bh as K}from"./chunk-gswbc6y9.js";import{Gh as H,Sh as J,mh as Z,oh as q,th as D,uh as G}from"./chunk-nyhqy6q2.js";import{Vk as Y}from"./chunk-0qkj838r.js";var W=Y(Z(),1);function _(){let{projectId:h}=$.useParams(),{teamId:v,ensureTeamIdForProject:w}=K();W.useEffect(()=>{w(h)},[h,w]);let{data:A}=G(U(h)),b=A?.rootFolder,{data:X}=D({queryKey:["folders",b],queryFn:async()=>{let B=await J.api.folders[":folderId"].$get({param:{folderId:b}});if(!B.ok)throw Error("failed to fetch folder");return await B.json()},enabled:!!b});if(!v||!b||!X)return q(N,{});return q(V,{teamId:v,projectId:h,projectName:A.name??"",assetId:b,rootFolderId:b})}var $=H("/projects/$projectId/")({component:_});export{$ as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Lh as Z,mh as W,oh as b,ph as Y}from"./chunk-nyhqy6q2.js";import{Vk as R}from"./chunk-0qkj838r.js";var r=Z((u)=>({uploading:0,tasks:{},fileProgress:{},increment:()=>u((d)=>({uploading:d.uploading+1})),decrement:()=>u((d)=>({uploading:d.uploading-1})),startTask:(d,k,F)=>u((o)=>{let l={},s=0;F.forEach((f)=>{l[f.fileId]={fileId:f.fileId,name:f.name,loaded:0,total:f.size,status:"uploading"},s+=f.size});let g={...o.tasks,[d]:{taskId:d,name:k,loaded:0,total:s,files:l}},P={...o.fileProgress};return F.forEach((f)=>{P[f.fileId]=l[f.fileId]}),{tasks:g,fileProgress:P}}),updateFileProgress:(d,k,F)=>u((o)=>{let l=o.tasks[d];if(!l)return{};let s=l.files[k];if(!s)return{};let g={...s,loaded:F},P={...l.files,[k]:g},f=Object.values(P).reduce((p,w)=>p+w.loaded,0);return{tasks:{...o.tasks,[d]:{...l,loaded:f,files:P}},fileProgress:{...o.fileProgress,[k]:g}}}),completeFile:(d,k)=>u((F)=>{let o=F.tasks[d];if(!o)return{};let l=o.files[k];if(!l)return{};let s={...l,status:"completed",loaded:l.total},g={...o.files,[k]:s},P=Object.values(g).reduce((f,p)=>f+p.loaded,0);return{tasks:{...F.tasks,[d]:{...o,loaded:P,files:g}},fileProgress:{...F.fileProgress,[k]:s}}}),failFile:(d,k)=>u((F)=>{let o=F.tasks[d];if(!o)return{};let l=o.files[k];if(!l)return{};let s={...l,status:"failed"},g={...o.files,[k]:s},P=Object.values(g).reduce((f,p)=>f+p.loaded,0);return{tasks:{...F.tasks,[d]:{...o,loaded:P,files:g}},fileProgress:{...F.fileProgress,[k]:s}}})}));var a=R(W(),1);var q=10,Q=10,$=q*Q,S=({spriteUrl:u,thumbnailUrl:d,videoWidth:k,videoHeight:F,className:o=""})=>{let l=a.useRef(null),[s,g]=a.useState({width:0,height:0}),[P,f]=a.useState({width:0,height:0}),[p,w]=a.useState(!1),[c,E]=a.useState(!1),[V,J]=a.useState(!1),[K,N]=a.useState(0),[j,n]=a.useState(0);a.useEffect(()=>{if(!l.current)return;let t=new ResizeObserver((m)=>{for(let B of m)g({width:B.contentRect.width,height:B.contentRect.height})});return t.observe(l.current),()=>t.disconnect()},[]);let X=a.useCallback(()=>{if(c||V)return;J(!0);let t=new Image;t.src=u,t.onload=()=>{f({width:t.naturalWidth,height:t.naturalHeight}),E(!0),J(!1)},t.onerror=()=>{console.error("Failed to load sprite image"),J(!1)}},[u,c,V]),M=()=>{w(!0),X()},A=()=>{w(!1)},D=(t)=>{if(!l.current)return;let m=l.current.getBoundingClientRect(),B=t.clientX-m.left,y=Math.max(0,Math.min(B,m.width));n(y);let T=y/m.width,U=Math.min(Math.floor(T*$),$-1);N(U)},G=a.useMemo(()=>{if(s.width===0||s.height===0)return{};let t=k/F;if(P.width>0&&P.height>0){let z=P.width/q,i=P.height/Q;t=z/i}let m=s.width/s.height,B,y;if(m>t)y=s.height,B=y*t;else B=s.width,y=B/t;let T=Math.ceil(B),U=Math.ceil(y),I=T*q,O=U*Q,v=K%q,x=Math.floor(K/q),C=-(v*T),_=-(x*U);return{backgroundImage:`url(${u})`,backgroundSize:`${I}px ${O}px`,backgroundPosition:`${C}px ${_}px`,backgroundRepeat:"no-repeat",width:`${T}px`,height:`${U}px`,imageRendering:"auto"}},[s,k,F,K,u,P]);return Y("div",{ref:l,className:`relative w-full h-full overflow-hidden cursor-crosshair group bg-black select-none ${o}`,onMouseEnter:M,onMouseLeave:A,onMouseMove:D,children:[b("img",{src:d,alt:"Thumbnail",className:`absolute inset-0 w-full h-full object-contain transition-opacity duration-200 ${p&&c?"opacity-0":"opacity-100"}`,draggable:!1}),p&&!c&&b("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:b("div",{className:"w-6 h-6 border-2 border-white/30 border-t-white rounded-full animate-spin"})}),c&&b("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-75 ${p?"opacity-100":"opacity-0"}`,children:b("div",{style:G})}),p&&b("div",{className:"absolute top-0 bottom-0 w-0.5 bg-red-500 shadow-[0_0_4px_rgba(255,0,0,0.8)] z-20 pointer-events-none",style:{transform:`translateX(${j}px)`}})]})};
|
|
2
2
|
export{S as eg,r as fg};
|