@shumai-one/shumai 0.5.1 → 0.5.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.
Files changed (164) hide show
  1. package/bin/{chunk-1dt700ws.js → chunk-04avc4fn.js} +49 -49
  2. package/bin/chunk-0asthrjf.js +2 -0
  3. package/bin/chunk-0ge2mm8j.js +1 -0
  4. package/bin/{chunk-3z20b2hz.js → chunk-0j22699g.js} +2 -2
  5. package/bin/{chunk-j909v9p5.js → chunk-0v9srsdz.js} +1 -1
  6. package/bin/{chunk-exgtwask.js → chunk-0y4zq3y4.js} +1 -1
  7. package/bin/{chunk-5yd9cv7f.js → chunk-15vsw36h.js} +5 -5
  8. package/bin/{chunk-3584j9fc.js → chunk-15w79661.js} +2 -2
  9. package/bin/{chunk-xvdd04gy.js → chunk-19jpn3r6.js} +1 -1
  10. package/bin/{chunk-grsgkkrb.js → chunk-19q13a80.js} +6 -6
  11. package/bin/{chunk-r6gkv98n.js → chunk-1nvj833s.js} +6 -6
  12. package/bin/chunk-23780yj6.js +3 -0
  13. package/bin/chunk-2gf95tj0.js +1 -0
  14. package/bin/{chunk-6vvs18bw.js → chunk-2pw7xcrn.js} +1 -1
  15. package/bin/chunk-2tk5w3jc.js +1 -0
  16. package/bin/chunk-2w6gve12.js +4 -0
  17. package/bin/chunk-301e7g3z.js +2 -0
  18. package/bin/chunk-3kmjbc3m.js +2 -0
  19. package/bin/{chunk-zhe16jvg.js → chunk-3pm6q6kg.js} +1 -1
  20. package/bin/{chunk-zfqz72sd.js → chunk-3q5qkfkc.js} +1 -1
  21. package/bin/chunk-3td60k1m.js +2 -0
  22. package/bin/chunk-42hrvk6k.js +211 -0
  23. package/bin/chunk-4zksqvwj.js +2 -0
  24. package/bin/chunk-5bk16qdp.js +2 -0
  25. package/bin/{chunk-y03z5rrg.js → chunk-5nqvqvqp.js} +3 -3
  26. package/bin/{chunk-e3r1m6rb.js → chunk-5rzxekn4.js} +1 -1
  27. package/bin/{chunk-h9x81yp6.js → chunk-5vqbzsjv.js} +1 -1
  28. package/bin/{chunk-628k58ek.js → chunk-6hzktewz.js} +2 -2
  29. package/bin/{chunk-s978ftze.js → chunk-6jkjx0n2.js} +3 -3
  30. package/bin/{chunk-gy8z8sd7.js → chunk-6rn094yj.js} +1 -1
  31. package/bin/{chunk-3cvbb6kh.js → chunk-7qvvf0yd.js} +2 -2
  32. package/bin/{chunk-asgxtqf0.js → chunk-81dawvn4.js} +2 -2
  33. package/bin/chunk-8abhmarc.js +2 -0
  34. package/bin/{chunk-vre5andt.js → chunk-8ayz61rc.js} +3 -3
  35. package/bin/{chunk-03bfjh8k.js → chunk-8ny7wvzb.js} +2 -2
  36. package/bin/{chunk-m5cpsm28.js → chunk-8tzfcqtb.js} +2 -2
  37. package/bin/{chunk-5patxztz.js → chunk-8zgq5sav.js} +3 -3
  38. package/bin/{chunk-m1xc3t0p.js → chunk-93p27bbm.js} +6 -6
  39. package/bin/chunk-951r2rx1.js +1 -0
  40. package/bin/chunk-965102pf.js +3 -0
  41. package/bin/{chunk-hr2027z3.js → chunk-98mg3dpd.js} +8 -8
  42. package/bin/{chunk-v42jcex0.js → chunk-9bakwac0.js} +4 -4
  43. package/bin/{chunk-z8mmqfm4.js → chunk-9ggwc289.js} +1 -1
  44. package/bin/{chunk-dvkzhpxx.js → chunk-9zgqjdx1.js} +2 -2
  45. package/bin/{chunk-kzsdp31a.js → chunk-a8bymrv1.js} +2 -2
  46. package/bin/chunk-acn3r2m2.js +1 -0
  47. package/bin/{chunk-z1r86fna.js → chunk-ae6zgjhd.js} +2 -2
  48. package/bin/{chunk-trndqdaa.js → chunk-asy868kq.js} +1 -1
  49. package/bin/{chunk-r1m4q8vw.js → chunk-b5r0be06.js} +2 -2
  50. package/bin/{chunk-6ns2vhbd.js → chunk-bbcmhcvc.js} +2 -2
  51. package/bin/{chunk-0e8xg41c.js → chunk-bpxw19ez.js} +1 -1
  52. package/bin/{chunk-sg7n2g3z.js → chunk-cdk8vqeg.js} +4 -4
  53. package/bin/chunk-ce0bhc72.js +2 -0
  54. package/bin/chunk-ce75dw3k.css +1 -0
  55. package/bin/{chunk-zf2h3w7t.js → chunk-cpj562n6.js} +1 -1
  56. package/bin/{chunk-h153xefb.js → chunk-cx32wsa1.js} +1 -1
  57. package/bin/{chunk-4437dnfa.js → chunk-d2dgazjj.js} +1 -1
  58. package/bin/{chunk-3zvvct3r.js → chunk-d5hbzp7t.js} +1 -1
  59. package/bin/chunk-d9qpgkek.js +2 -0
  60. package/bin/{chunk-9h6nn1a3.js → chunk-dche0gy0.js} +1 -1
  61. package/bin/{chunk-zcrtr8qd.js → chunk-dppfek34.js} +2 -2
  62. package/bin/chunk-dv6p6n5e.js +1 -0
  63. package/bin/{chunk-hx76pje1.js → chunk-e439kt05.js} +1 -1
  64. package/bin/{chunk-gptzcgte.js → chunk-eqr0znmc.js} +1 -1
  65. package/bin/{chunk-q5mkbnr9.js → chunk-f5z3096k.js} +2 -2
  66. package/bin/{chunk-3m6ch1x5.js → chunk-ffj9cq9y.js} +2 -2
  67. package/bin/{chunk-80qz30dc.js → chunk-fxg81vtx.js} +2 -2
  68. package/bin/{chunk-5jbx9gqe.js → chunk-ggfx2b0f.js} +1 -1
  69. package/bin/chunk-gnt9gewm.js +2 -0
  70. package/bin/{chunk-t597y392.js → chunk-grjek810.js} +2 -2
  71. package/bin/chunk-gvas3xkp.js +2 -0
  72. package/bin/{chunk-0ttr4a6b.js → chunk-j53sjkxt.js} +2 -2
  73. package/bin/{chunk-xyk7vk42.js → chunk-jgfye6nf.js} +2 -2
  74. package/bin/{chunk-tcat7q9p.js → chunk-jt6v15wx.js} +2 -2
  75. package/bin/{chunk-rn9rktp4.js → chunk-k3prp6c6.js} +4 -4
  76. package/bin/{chunk-mqr096rn.js → chunk-k97axrc4.js} +1 -1
  77. package/bin/{chunk-20anqpf1.js → chunk-kvwec0p3.js} +2 -2
  78. package/bin/{chunk-tcp4q15p.js → chunk-kzr6ecke.js} +1 -1
  79. package/bin/{chunk-rkq6jvhb.js → chunk-m6v8vt2b.js} +2 -2
  80. package/bin/{chunk-xyh5dkr5.js → chunk-mn108p93.js} +1 -1
  81. package/bin/{chunk-31vx01aw.js → chunk-mn208vrv.js} +2 -2
  82. package/bin/chunk-mneeg71d.js +2 -0
  83. package/bin/{chunk-d7mgjqf8.js → chunk-n76w2wcr.js} +1 -1
  84. package/bin/{chunk-m2dtwvg0.js → chunk-n9vp9nbg.js} +29 -29
  85. package/bin/{chunk-2g5qdx4s.js → chunk-p0j4wpa5.js} +2 -2
  86. package/bin/chunk-qb178ntp.js +2 -0
  87. package/bin/{chunk-7vd5yajk.js → chunk-qmrg2jhs.js} +7 -7
  88. package/bin/{chunk-4mq874m3.js → chunk-qxscgcn9.js} +2 -2
  89. package/bin/{chunk-z7p7s55t.js → chunk-r249n1xe.js} +2 -2
  90. package/bin/{chunk-36r20sj7.js → chunk-r776bhsg.js} +1 -1
  91. package/bin/{chunk-1k16xsqq.js → chunk-rmvhyqyb.js} +6 -6
  92. package/bin/{chunk-zwb9kamp.js → chunk-rtaya5wc.js} +2 -2
  93. package/bin/chunk-rw5h0n0s.js +1 -0
  94. package/bin/{chunk-6v6c2921.js → chunk-ryepy5er.js} +4 -4
  95. package/bin/{chunk-ehhsezbj.js → chunk-rza95y4z.js} +2 -2
  96. package/bin/chunk-s4r6e6ms.js +1 -0
  97. package/bin/{chunk-qgkbxw1k.js → chunk-sbyyn9yw.js} +2 -2
  98. package/bin/chunk-syjjke3f.js +1 -0
  99. package/bin/chunk-t1yamxgk.js +2 -0
  100. package/bin/chunk-tgfxe0sb.js +1 -0
  101. package/bin/chunk-tjretpx8.js +1 -0
  102. package/bin/chunk-tvkekn4z.js +1 -0
  103. package/bin/{chunk-5t05jpna.js → chunk-twpc640e.js} +1 -1
  104. package/bin/{chunk-kvqp50dm.js → chunk-v034sfw8.js} +2 -2
  105. package/bin/{chunk-wydd7sz7.js → chunk-v5hz09a1.js} +2 -2
  106. package/bin/{chunk-j3xaq9s3.js → chunk-vm2pz2hm.js} +2 -2
  107. package/bin/{chunk-mt532a33.js → chunk-vzdgsfkf.js} +1 -1
  108. package/bin/chunk-w4yjgez6.js +14 -0
  109. package/bin/{chunk-0yv0nnmh.js → chunk-w73v578p.js} +2 -2
  110. package/bin/{chunk-zp5b1mb6.js → chunk-w9z27p0m.js} +2 -2
  111. package/bin/chunk-wjcebkpb.js +1 -0
  112. package/bin/{chunk-62sj29j8.js → chunk-wnqxyqrg.js} +2 -2
  113. package/bin/chunk-ws71fg50.js +2 -0
  114. package/bin/{chunk-rsdpycdr.js → chunk-wwkhskce.js} +2 -2
  115. package/bin/{chunk-kgfa5y9w.js → chunk-xr2v0d6y.js} +5 -5
  116. package/bin/{chunk-wkxm6yny.js → chunk-y2dhf3p0.js} +2 -2
  117. package/bin/chunk-yfp3q4da.js +1 -0
  118. package/bin/{chunk-f22nrm6r.js → chunk-ypkkfwfb.js} +4 -4
  119. package/bin/chunk-z8e4wc59.js +1 -0
  120. package/bin/{chunk-c4wnhekn.js → chunk-zckxc8m6.js} +2 -2
  121. package/bin/{chunk-3fjgf7eb.js → chunk-zdzkjp4q.js} +2 -2
  122. package/bin/chunk-zf5cyxnt.js +2 -0
  123. package/bin/shumai-app.html +1 -1
  124. package/bin/shumai-app.js +401 -396
  125. package/package.json +7 -7
  126. package/prisma/migrations/20261008134859_add_transcode_3d/migration.sql +2 -0
  127. package/prisma/schema.prisma +1 -0
  128. package/bin/chunk-088e1ath.js +0 -3
  129. package/bin/chunk-18kgmvme.js +0 -2
  130. package/bin/chunk-1ya6vx4k.js +0 -1
  131. package/bin/chunk-3xw70yr4.js +0 -2
  132. package/bin/chunk-4frhvsy0.js +0 -1
  133. package/bin/chunk-57nqvcg7.js +0 -1
  134. package/bin/chunk-58hdvwj2.js +0 -1
  135. package/bin/chunk-5seey9ee.js +0 -2
  136. package/bin/chunk-66hdwm6f.js +0 -2
  137. package/bin/chunk-6devq6jh.js +0 -2
  138. package/bin/chunk-756mr32b.js +0 -2
  139. package/bin/chunk-9k86d2a3.js +0 -4
  140. package/bin/chunk-a5fsqkt7.js +0 -1
  141. package/bin/chunk-ar6kq7hh.js +0 -2
  142. package/bin/chunk-axfwh5et.js +0 -2
  143. package/bin/chunk-c0vbj8za.js +0 -1
  144. package/bin/chunk-dcmfn4hs.js +0 -2
  145. package/bin/chunk-dy79b8kd.js +0 -1
  146. package/bin/chunk-ehvyq65t.js +0 -2
  147. package/bin/chunk-g21k2awz.js +0 -2
  148. package/bin/chunk-g9f9nzcc.js +0 -1
  149. package/bin/chunk-gzzfta3s.js +0 -2
  150. package/bin/chunk-k9cgfzgk.js +0 -3
  151. package/bin/chunk-nbfcknsq.js +0 -1
  152. package/bin/chunk-phzemmmy.js +0 -2
  153. package/bin/chunk-qcf3tb72.js +0 -1
  154. package/bin/chunk-rgfh5apb.js +0 -1
  155. package/bin/chunk-rh1hs8wa.js +0 -2
  156. package/bin/chunk-rpxayeqd.js +0 -1
  157. package/bin/chunk-s33pcxn0.js +0 -1
  158. package/bin/chunk-s9svhjv6.js +0 -2
  159. package/bin/chunk-vnk2p7mq.css +0 -1
  160. package/bin/chunk-vsefjzzj.js +0 -211
  161. package/bin/chunk-wf32n1s3.js +0 -1
  162. package/bin/chunk-yd1k76na.js +0 -2
  163. package/bin/chunk-yfm9xwes.js +0 -14
  164. package/bin/chunk-zkep4r7d.js +0 -1
@@ -1 +0,0 @@
1
- import{D,h,N,y,u,S,L,t,o,Q,Z,B,pt,ze,A,I,O,Pe,nn,vt,eo,to,Oo,pe,we,Ne,E,he,ge,Ae,K,Qr,Vt,wf,Im,Sf,K0,W0,Cf,If,De,$_,na,ay,uy,ch,at,Ff,hb,kb,xh,Lb,zb,jb,qb,Hb,$b,Na,yi,jc,qf,Da,vv,Mv,Vv,aw,cw,Sw,Cw,Iw,wd,Mx,gS,_S,ES,IS,pp,yg,mp,aE,lE,Ml,yC,MC,xo,DC,HC,VC,nA,Gc,Vc,kl,Op,Fp,Lp,Rl,Qc,Kc,Zp,Bp,Wc,CT,IT,TT,MT,RT,An,Qp,l1,c1,Yc,SA,_1,y1,b1,v1,w1,ue,ae,fe,qe,le,q,ce,lt,Dr,_n,$n,Xc,M,br,un,W,Me,Le,Ze,Be,Ue,ne,xi,$t,Ar,St,sm}from"./chunk-vsefjzzj.js";import{$a}from"./chunk-1dt700ws.js";import{iu,Ci}from"./chunk-yfm9xwes.js";import{Uo}from"./chunk-zp5b1mb6.js";import"./chunk-3m6ch1x5.js";import"./chunk-62sj29j8.js";import"./chunk-dcmfn4hs.js";import{Ir}from"./chunk-0e8xg41c.js";import{ua,jl}from"./chunk-ehhsezbj.js";import{ca}from"./chunk-xyk7vk42.js";import{Zl}from"./chunk-kvqp50dm.js";import{Bl}from"./chunk-6devq6jh.js";import{nr}from"./chunk-g21k2awz.js";import"./chunk-rsdpycdr.js";import{Ql,Kl}from"./chunk-6ns2vhbd.js";import"./chunk-m5cpsm28.js";import"./chunk-dvkzhpxx.js";import{lo}from"./chunk-4mq874m3.js";import"./chunk-t597y392.js";import{co}from"./chunk-80qz30dc.js";import{Nr}from"./chunk-4437dnfa.js";S();var Ct=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],dt=I("folder-open",Ct);var _t=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],ct=I("list-filter",_t);S();function It({ratio:a}){switch(a){case"16:9":return t("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"});case"9:16":return t("span",{className:"inline-block w-2.5 h-4 border border-current rounded-[1px] shrink-0"});case"4:3":return t("span",{className:"inline-block w-3.5 h-2.5 border border-current rounded-[1px] shrink-0"});case"3:4":return t("span",{className:"inline-block w-2.5 h-3.5 border border-current rounded-[1px] shrink-0"});case"1:1":return t("span",{className:"inline-block w-3 h-3 border border-current rounded-[1px] shrink-0"});default:return t("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"})}}function ot(){return Math.random().toString(36).substring(2,9)}function mt(){return{id:ot(),type:"text",text:"CONFIDENTIAL",x:0.5,y:0.5,size:0.05,color:"#999999",opacity:0.5,rotation:-30}}function Ft(){return{id:ot(),type:"image",imageAssetKey:"",x:0.5,y:0.5,size:0.15,opacity:0.5,rotation:0}}var st=[{id:"dark",label:"Dark Slate",bg:"#1e293b",dot:"#475569"},{id:"black",label:"Black",bg:"#000000",dot:"#404040"},{id:"gray",label:"Slate Gray",bg:"#64748b",dot:"#cbd5e1"},{id:"white",label:"White",bg:"#ffffff",dot:"#94a3b8"},{id:"green",label:"Chroma Green",bg:"#059669",dot:"#047857"}],Dt={"16:9":1.7777777777777777,"9:16":0.5625,"4:3":1.3333333333333333,"3:4":0.75,"1:1":1};function ft({open:a,onOpenChange:k,initialConfig:x,shareId:p,teamId:C,onSaveSuccess:v}){let z=Q(),[d,w]=u([]),[c,g]=u(null),[R,H]=u(null),[_,xe]=u("16:9"),[be,ye]=u("grid"),[_e,J]=u(!1),[ve,ie]=u("new"),[me,ee]=u(""),[te,re]=u(null),F=y(null),se=y(null),[oe,Ie]=u({w:0,h:0}),[T,G]=u(!1),s=D((e)=>{if(se.current=e,!e)return;let l=()=>{let{clientWidth:P,clientHeight:b}=e;if(P<=0||b<=0)return;let V=Dt[_],rt=P,Re=rt/V;if(Re>b)Re=b,rt=Re*V;Ie({w:Math.round(rt),h:Math.round(Re)})};l();let n=new ResizeObserver(l);return n.observe(e),()=>{n.disconnect(),se.current=null}},[_]),X=lt((e)=>e.teamId),ke=C||X,[Qe,je]=u(!1),[Y,Fe]=u({}),de=y(null),Se=A.api.teams[":teamId"].files.$post,Te=async(e,l)=>{let n=e.target.files?.[0];if(!n)return;if(n.size>1048576){if(M.error(vv()),de.current)de.current.value="";return}if(!ke){M.error(jc());return}je(!0);let P=URL.createObjectURL(n);Fe((b)=>({...b,[l]:P}));try{let b=await Se({param:{teamId:ke},form:{file:n}});if(!b.ok)throw Error(jc());let V=await b.json();j(l,{imageAssetKey:V.key,imageAssetUrl:V.url})}catch(b){let V=b instanceof Error?b.message:jc();M.error(V)}finally{if(je(!1),de.current)de.current.value=""}};h(()=>{if(a){if(x?.blocks&&x.blocks.length>0)w(x.blocks),g(x.blocks[0].id);else{let e=mt();w([e]),g(e.id)}H(null)}},[a,x]);let{data:U=[]}=Z({queryKey:["watermark-templates",C],queryFn:async()=>{let e=await A.api["watermark-templates"].$get({query:C?{teamId:C}:{}});if(!e.ok)return[];return await e.json()},enabled:a}),Ee=A.api.shares[":shareId"].watermark.$put,{mutate:Ce,isPending:Ve}=B({mutationFn:async(e)=>{let l=await Ee({param:{shareId:p},json:{enabled:!0,config:e}});if(!l.ok){let n=await l.json().catch(()=>null);throw Error(n?.error||yi())}return await l.json()},onSuccess:()=>{z.invalidateQueries({queryKey:["share",p]}),z.invalidateQueries({queryKey:["shares"]}),M.success(w1()),k(!1),v?.()},onError:(e)=>{M.error(e.message||yi())}}),He=A.api["watermark-templates"].$post,{mutate:Ge,isPending:Xe}=B({mutationFn:async({name:e,config:l})=>{let n=await He({json:{name:e,teamId:C||void 0,config:l}});if(!n.ok)throw Error(yi());return await n.json()},onSuccess:(e)=>{z.invalidateQueries({queryKey:["watermark-templates"]}),H(e.id),J(!1),M.success(TT())},onError:()=>{M.error(yi())}}),Ye=A.api["watermark-templates"][":templateId"].$put,{mutate:We,isPending:Je}=B({mutationFn:async({templateId:e,config:l})=>{let n=await Ye({param:{templateId:e},json:{config:l}});if(!n.ok)throw Error(yi());return await n.json()},onSuccess:()=>{z.invalidateQueries({queryKey:["watermark-templates"]}),J(!1),M.success(MT())},onError:()=>{M.error(yi())}}),r=A.api["watermark-templates"][":templateId"].$delete,{mutate:m}=B({mutationFn:async(e)=>{if(!(await r({param:{templateId:e}})).ok)throw Error(Na())},onSuccess:(e,l)=>{if(z.invalidateQueries({queryKey:["watermark-templates"]}),R===l)H(null);M.success(CT())},onError:()=>{M.error(Na())}}),f=d.findIndex((e)=>e.id===c),i=f>=0?d[f]:null,$e=()=>{let e=mt();w((l)=>[...l,e]),g(e.id)},xt=()=>{let e=Ft();w((l)=>[...l,e]),g(e.id)},it=(e)=>{if(!e)return;w((l)=>{let n=l.filter((P)=>P.id!==e);if(c===e)g(n.length>0?n[Math.max(0,f-1)].id:null);return n})},j=(e,l)=>{w((n)=>n.map((P)=>P.id===e?{...P,...l}:P))},ht=()=>{if(d.length===0)return;let e=(f-1+d.length)%d.length;g(d[e].id)},wt=()=>{if(d.length===0)return;let e=(f+1)%d.length;g(d[e].id)},bt=(e,l)=>{e.stopPropagation(),g(l),G(!0)},et=D((e)=>{if(!T||!c||!F.current)return;let l=F.current.getBoundingClientRect(),n=(e.clientX-l.left)/l.width,P=(e.clientY-l.top)/l.height,b=Math.max(0,Math.min(1,Math.round(n*100)/100)),V=Math.max(0,Math.min(1,Math.round(P*100)/100));j(c,{x:b,y:V})},[T,c]),tt=D(()=>{G(!1)},[]);h(()=>{if(T)window.addEventListener("mousemove",et),window.addEventListener("mouseup",tt);return()=>{window.removeEventListener("mousemove",et),window.removeEventListener("mouseup",tt)}},[T,et,tt]),h(()=>{let e=(l)=>{if(!a||!c)return;let n=l.target?.tagName?.toLowerCase();if(n==="input"||n==="textarea"||n==="select")return;if(l.key==="Delete"||l.key==="Backspace")l.preventDefault(),it(c)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,c,f]);let yt=(e)=>{if(e.config?.blocks&&e.config.blocks.length>0){let l=e.config.blocks.map((n)=>({...n,id:ot()}));w(l),g(l[0].id),H(e.id)}},Nt=()=>{if(d.length===0){M.error(_S());return}Ce({blocks:d})},kt=()=>{if(ve==="new"){if(!me.trim()){M.error(xh());return}Ge({name:me.trim(),config:{blocks:d}})}else{let e=te||R;if(!e){M.error(nA());return}We({templateId:e,config:{blocks:d}})}};return o(L,{children:[t(ue,{open:a,onOpenChange:k,children:o(ae,{showCloseButton:!1,className:"sm:max-w-[1400px] max-w-[95vw] w-[95vw] h-[88vh] flex flex-col p-0 gap-0 overflow-hidden",onPointerDownOutside:(e)=>e.preventDefault(),children:[o("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3",children:t(le,{className:"text-base font-semibold",children:y1()})}),o("div",{className:"flex items-center gap-2",children:[o(he,{modal:!1,children:[t(ge,{asChild:!0,children:o(E,{variant:"outline",size:"sm",className:"gap-2 text-xs",children:[t(dt,{className:"h-4 w-4 text-muted-foreground"}),b1()]})}),o(Ae,{align:"end",className:"w-56",children:[t(Qr,{className:"text-xs font-semibold text-muted-foreground",children:Iw()}),U.length===0?t("div",{className:"px-2 py-1.5 text-xs text-muted-foreground italic",children:gS()}):U.map((e)=>o(K,{onClick:()=>yt(e),className:"flex items-center justify-between text-xs cursor-pointer",children:[t("span",{className:"truncate flex-1",children:e.name}),R===e.id&&t(Pe,{className:"h-3.5 w-3.5 text-primary ml-2 flex-shrink-0"}),t(E,{variant:"ghost",size:"icon",className:"h-5 w-5 hover:bg-destructive/10 hover:text-destructive ml-1",onClick:(l)=>{l.stopPropagation(),m(e.id)},children:t(we,{className:"h-3 w-3"})})]},e.id)),t(Vt,{}),o(K,{onClick:()=>{ie("new"),ee(""),J(!0)},className:"text-xs gap-2 cursor-pointer",children:[t(pe,{className:"h-3.5 w-3.5 text-primary"}),ch()]}),U.length>0&&o(K,{onClick:()=>{ie("overwrite"),re(R||U[0].id),J(!0)},className:"text-xs gap-2 cursor-pointer",children:[t(ca,{className:"h-3.5 w-3.5 text-muted-foreground"}),yg()]})]})]}),t(E,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>k(!1),children:De()}),o(E,{size:"sm",className:"text-xs bg-primary hover:bg-primary/90 text-primary-foreground gap-1.5",disabled:Ve,onClick:Nt,children:[t(ca,{className:"h-3.5 w-3.5"}),DC()]})]})]}),o("div",{className:"flex-1 flex overflow-hidden",children:[o("div",{className:"w-[65%] flex flex-col p-4 bg-muted/20 border-r border-border overflow-hidden select-none",children:[o("div",{className:"flex items-center justify-between mb-3",children:[t("div",{className:"flex items-center gap-1 bg-muted/60 p-1 rounded-md border border-border/60",children:["16:9","9:16","4:3","3:4","1:1"].map((e)=>o(E,{variant:_===e?"secondary":"ghost",size:"sm",className:Oe("h-7 px-2.5 text-xs gap-1.5 font-mono transition-all",_===e?"bg-background shadow-xs font-semibold text-foreground border border-border/50":"text-muted-foreground hover:text-foreground"),onClick:()=>xe(e),children:[t(It,{ratio:e}),t("span",{children:e})]},e))}),t("div",{className:"flex items-center gap-1.5 bg-background border border-border/60 rounded-md p-1",children:st.map((e)=>t("button",{type:"button",onClick:()=>ye(e.id),style:{backgroundColor:e.bg},className:Oe("w-5 h-5 rounded-full border border-border/80 transition-all cursor-pointer relative",be===e.id?"ring-2 ring-primary ring-offset-1 scale-110":"hover:scale-105 opacity-80 hover:opacity-100"),title:e.label},e.id))})]}),t("div",{ref:s,className:"flex-1 flex items-center justify-center overflow-hidden",children:(()=>{let e=st.find((n)=>n.id===be)||st[0],l=oe.w>0&&oe.h>0;return t("div",{ref:F,onClick:()=>g(null),style:{backgroundColor:e.bg,backgroundImage:`radial-gradient(${e.dot} 1px, transparent 1px)`,backgroundSize:"16px 16px",...l?{width:oe.w,height:oe.h}:{}},className:Oe("relative rounded-lg border border-border overflow-hidden shadow-inner transition-all",_==="16:9"&&"aspect-[16/9] w-full max-h-full",_==="9:16"&&"aspect-[9/16] h-full max-w-full",_==="4:3"&&"aspect-[4/3] w-full max-h-full",_==="3:4"&&"aspect-[3/4] h-full max-w-full",_==="1:1"&&"aspect-square h-full max-w-full"),children:d.map((n)=>{let P=n.id===c,b=n.size*(oe.w||640);return t("div",{onMouseDown:(V)=>bt(V,n.id),onClick:(V)=>{V.stopPropagation(),g(n.id)},style:{left:`${n.x*100}%`,top:`${n.y*100}%`,transform:`translate(-50%, -50%) rotate(${n.rotation}deg)`,opacity:n.opacity},className:Oe("absolute cursor-move select-none transition-shadow rounded p-1.5 flex items-center justify-center",P?"ring-2 ring-primary ring-offset-2 ring-offset-background/80 bg-primary/10":"hover:ring-1 hover:ring-muted-foreground/50"),children:n.type==="text"?t("span",{style:{fontSize:`${b}px`,color:n.color,lineHeight:1,whiteSpace:"nowrap",fontWeight:700,textShadow:"0 1px 3px rgba(0,0,0,0.5)"},children:n.text||"Text"}):t("div",{style:{width:`${b}px`,height:`${b}px`},className:"bg-primary/20 border border-primary/40 rounded flex items-center justify-center p-1 overflow-hidden",children:Y[n.id]||n.imageAssetUrl?t("img",{src:Y[n.id]||n.imageAssetUrl,alt:"Watermark logo",className:"w-full h-full object-contain pointer-events-none"}):t(eo,{className:"h-1/2 w-1/2 opacity-70 text-primary"})})},n.id)})})})()})]}),o("div",{className:"w-[35%] flex flex-col bg-card overflow-hidden border-l border-border",children:[t("div",{className:"p-4 border-b border-border bg-muted/10 flex items-center justify-between",children:o("div",{className:"flex items-center gap-2",children:[t(to,{className:"h-4 w-4 text-muted-foreground"}),t("span",{className:"text-xs font-semibold",children:SA()})]})}),o("div",{className:"p-3 border-b border-border bg-background flex items-center justify-between gap-2",children:[o("div",{className:"flex items-center gap-1",children:[t(E,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:d.length<=1,onClick:ht,children:t(nn,{className:"h-4 w-4"})}),o(he,{modal:!1,children:[t(ge,{asChild:!0,children:t(E,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs font-mono",children:d.length===0?"0 / 0":`${f+1} / ${d.length}`})}),t(Ae,{align:"start",className:"w-48",children:d.map((e,l)=>o(K,{onClick:()=>g(e.id),className:"text-xs flex items-center justify-between cursor-pointer",children:[o("span",{className:"flex items-center gap-2 truncate",children:[e.type==="text"?t($a,{className:"h-3.5 w-3.5 text-muted-foreground"}):t(eo,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.type==="text"?e.text||"Text":e.imageAssetKey||"Image"]}),o("span",{className:"text-[10px] font-mono text-muted-foreground ml-2",children:["#",l+1]})]},e.id))})]}),t(E,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:d.length<=1,onClick:wt,children:t(vt,{className:"h-4 w-4"})})]}),o("div",{className:"flex items-center gap-1",children:[i&&t(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10",title:at(),onClick:()=>it(i.id),children:t(we,{className:"h-4 w-4"})}),o(he,{modal:!1,children:[t(ge,{asChild:!0,children:o(E,{size:"sm",className:"h-7 text-xs gap-1",children:[t(pe,{className:"h-3.5 w-3.5"}),wf()]})}),o(Ae,{align:"end",children:[o(K,{onClick:$e,className:"text-xs gap-2 cursor-pointer",children:[t($a,{className:"h-3.5 w-3.5"}),Sf()]}),o(K,{onClick:xt,className:"text-xs gap-2 cursor-pointer",children:[t(eo,{className:"h-3.5 w-3.5"}),Im()]})]})]})]})]}),t(ce,{className:"flex-1 min-h-0 p-4",children:i?o("div",{className:"space-y-5 text-xs",children:[o("div",{className:"flex items-center justify-between pb-2 border-b border-border",children:[o("span",{className:"font-semibold text-muted-foreground flex items-center gap-1.5",children:[i.type==="text"?t($a,{className:"h-4 w-4 text-primary"}):t(eo,{className:"h-4 w-4 text-primary"}),i.type==="text"?Sf():Im()]}),o("span",{className:"text-[10px] font-mono text-muted-foreground",children:["ID: ",i.id.slice(0,6)]})]}),i.type==="text"&&o("div",{className:"space-y-2",children:[t(W,{className:"text-xs",children:RT()}),t(q,{type:"text",value:i.text,onChange:(e)=>j(i.id,{text:e.target.value}),className:"text-xs h-8"})]}),i.type==="image"&&o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:aw()}),i.imageAssetKey&&o("button",{type:"button",onClick:()=>j(i.id,{imageAssetKey:"",imageAssetUrl:void 0}),className:"text-xs text-muted-foreground hover:text-destructive flex items-center gap-1 font-medium transition-colors cursor-pointer",children:[t(Ne,{className:"w-3.5 h-3.5"}),Ml?Ml():"Remove"]})]}),t("input",{type:"file",ref:de,className:"hidden",accept:"image/*",onChange:(e)=>Te(e,i.id)}),o("div",{onClick:()=>de.current?.click(),className:"relative aspect-square w-full rounded-xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 hover:border-primary/50 hover:bg-muted/40 transition-all p-2",children:[Qe&&t("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:o("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[t(O,{className:"w-4 h-4 animate-spin text-primary"}),t("span",{className:"text-xs font-semibold",children:Yc()})]})}),Y[i.id]||i.imageAssetUrl?o(L,{children:[t("img",{src:Y[i.id]||i.imageAssetUrl,alt:"Uploaded logo preview",className:"max-w-full max-h-full object-contain transition-transform duration-300 group-hover:scale-105"}),o("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1 text-white z-10",children:[t(lo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),t("span",{className:"text-xs font-semibold",children:Qp()})]})]}):o("div",{className:"flex flex-col items-center gap-1.5 text-center p-3",children:[t("div",{className:"p-2 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:t(lo,{className:"w-4 h-4 text-muted-foreground"})}),o("div",{children:[t("p",{className:"text-xs font-medium text-foreground",children:l1()}),t("p",{className:"text-[10px] text-muted-foreground mt-0.5 max-w-[150px] mx-auto leading-normal",children:c1()})]})]})]})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:i.type==="text"?Mv():cw()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.size*100),"%"]})]}),o("div",{className:"flex items-center gap-3",children:[t(Uo,{min:i.type==="text"?0.01:0.02,max:i.type==="text"?0.12:0.5,step:0.005,value:[i.size],onValueChange:([e])=>j(i.id,{size:e}),className:"flex-1"}),t(q,{type:"number",min:1,max:100,value:Math.round(i.size*100),onChange:(e)=>j(i.id,{size:Math.min(1,Math.max(0.001,Number(e.target.value)/100))}),className:"w-16 h-7 text-xs font-mono text-right"})]})]}),i.type==="text"&&o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:$_()}),t("span",{className:"font-mono text-[11px] text-muted-foreground uppercase",children:i.color})]}),o("div",{className:"flex items-center gap-2",children:[t("input",{type:"color",value:i.color,onChange:(e)=>j(i.id,{color:e.target.value}),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent p-0"}),t(q,{type:"text",value:i.color,onChange:(e)=>j(i.id,{color:e.target.value}),className:"flex-1 h-8 text-xs font-mono"})]}),t("div",{className:"flex items-center gap-1.5 pt-1",children:["#FFFFFF","#000000","#999999","#EF4444","#3B82F6","#10B981","#F59E0B"].map((e)=>t("button",{type:"button",onClick:()=>j(i.id,{color:e}),style:{backgroundColor:e},className:"w-5 h-5 rounded-full border border-border hover:scale-110 transition-transform"},e))})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:ES()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.opacity*100),"%"]})]}),t(Uo,{min:0,max:1,step:0.01,value:[i.opacity],onValueChange:([e])=>j(i.id,{opacity:e})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:MC()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[i.rotation,"°"]})]}),t(Uo,{min:-180,max:180,step:1,value:[i.rotation],onValueChange:([e])=>j(i.id,{rotation:e})}),t("div",{className:"flex items-center gap-1.5 pt-1",children:[-45,-30,0,30,45].map((e)=>o(E,{variant:"outline",size:"sm",className:"h-6 text-[10px] flex-1 px-1 font-mono",onClick:()=>j(i.id,{rotation:e}),children:[e,"°"]},e))})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:aE()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.x*100),"%"]})]}),t(Uo,{min:0,max:1,step:0.01,value:[i.x],onValueChange:([e])=>j(i.id,{x:e})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:lE()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.y*100),"%"]})]}),t(Uo,{min:0,max:1,step:0.01,value:[i.y],onValueChange:([e])=>j(i.id,{y:e})})]})]}):o("div",{className:"py-12 text-center text-xs text-muted-foreground space-y-3",children:[t("p",{children:VC()}),o(E,{size:"sm",variant:"outline",onClick:$e,children:[t(pe,{className:"h-3.5 w-3.5 mr-1"}),Sf()]})]})})]})]})]})}),t(ue,{open:_e,onOpenChange:J,children:o(ae,{className:"max-w-md",children:[t(fe,{children:t(le,{className:"text-sm font-semibold",children:ve==="new"?ch():yg()})}),t("div",{className:"py-3 space-y-4 text-xs",children:ve==="new"?o("div",{className:"space-y-2",children:[t(W,{children:IT()}),t(q,{type:"text",value:me,onChange:(e)=>ee(e.target.value),placeholder:xh(),className:"text-xs"})]}):o("div",{className:"space-y-2",children:[t(W,{children:nA()}),t("select",{value:te||"",onChange:(e)=>re(e.target.value),className:"w-full h-9 rounded-md border border-input bg-background px-3 text-xs",children:U.map((e)=>t("option",{value:e.id,children:e.name},e.id))})]})}),o(qe,{children:[t(E,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>J(!1),children:De()}),t(E,{size:"sm",className:"text-xs",disabled:Xe||Je,onClick:kt,children:na()})]})]})})]})}function Oe(...a){return a.filter(Boolean).join(" ")}S();function gt({shareLink:a,viewMode:k,onViewModeChange:x,defaultSortOrder:p,onSortOrderChange:C}){let v=Q(),[z,d]=u(a.password||""),[w,c]=u(a.expireAt?new Date(a.expireAt):void 0),[g,R]=u(!1);h(()=>{d(a.password||"")},[a.password]);let[H,_]=u(a.hasPassword),[xe,be]=u(!!a.expireAt),{data:ye,refetch:_e}=Z({queryKey:["share-watermark",a.id],queryFn:async()=>{let s=await A.api.shares[":shareId"].watermark.$get({param:{shareId:a.id}});if(!s.ok)return null;return await s.json()},refetchInterval:(s)=>(s.state.data?.watermarkStatus||a.watermarkStatus)==="processing"?3000:!1}),J=A.api.shares[":shareId"].watermark.$put,{mutate:ve}=B({mutationFn:async()=>{let s=await J({param:{shareId:a.id},json:{enabled:!1}});if(!s.ok)throw Error(yi());return await s.json()},onSuccess:()=>{v.invalidateQueries({queryKey:["shares",a.projectId]}),v.invalidateQueries({queryKey:["share",a.id]}),v.invalidateQueries({queryKey:["share-watermark",a.id]}),M.success(_1())}}),ie=ye?.watermarkStatus??a.watermarkStatus??(a.watermarkConfigId?"ready":"disabled"),me=ye?.watermarkConfig?.config??a.watermarkConfig?.config??null,ee=me!==null&&ie!=="disabled",{data:te}=Z({queryKey:["fields",a.projectId],queryFn:async()=>{let s=await A.api.projects[":projectId"].fields.$get({param:{projectId:a.projectId}});if(!s.ok)throw Error(zb());return await s.json()},enabled:!!a.projectId}),re=A.api.shares[":shareId"].$put,{mutate:F}=B({mutationFn:async(s)=>{let X=await re({param:{shareId:a.id},json:s});if(!X.ok)throw Error(yi());return await X.json()},onSuccess:()=>{v.invalidateQueries({queryKey:["shares",a.projectId]}),v.invalidateQueries({queryKey:["share",a.id]}),M.success(Gc())}}),se=`${window.location.origin}/share/${a.id}`,oe=async(s)=>{if(await co(s))M.success(ay())},Ie=(s)=>{let X=a.fieldVisibility||{},ke={...X,[s]:!X[s]};F({fieldVisibility:ke})},T="index",G="asc";if(p){let s=p.split(":");T=s[0],G=s[1]||"asc"}return o("div",{className:"flex flex-col h-full bg-background border-l border-border",children:[t("div",{className:"flex-1 overflow-y-auto",children:o("div",{className:"p-4 space-y-6",children:[o("div",{className:"space-y-4",children:[o("div",{className:"flex items-center justify-between",children:[t("h3",{className:"text-sm font-medium",children:Sw()}),t(Me,{checked:!a.isDisabled,onCheckedChange:(s)=>F({isDisabled:!s})})]}),o("div",{className:"relative w-full",children:[t(q,{value:se,readOnly:!0,className:"pr-10 bg-muted/50 text-xs"}),t(E,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full",onClick:()=>oe(se),children:t(Nr,{className:"h-4 w-4"})})]})]}),o("div",{className:"space-y-1",children:[t(Ke,{title:HC(),icon:t(Kl,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-4 pt-2",children:[o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:mp()}),t(Me,{checked:H,onCheckedChange:(s)=>{if(_(s),!s)F({password:null})}})]}),H&&o("div",{className:"flex gap-2 animate-in fade-in slide-in-from-top-1 duration-200",children:[t(q,{type:"text",value:z,onChange:(s)=>d(s.target.value),placeholder:kb(),className:"text-xs"}),t(E,{size:"sm",onClick:()=>F({password:z}),children:xo()})]})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:Lb()}),t(Me,{checked:xe,onCheckedChange:(s)=>{if(be(s),!s)c(void 0),F({expireAt:null})}})]}),xe&&t("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:t(xi,{value:w,onChange:(s)=>{c(s),F({expireAt:s?s.toISOString():null})},className:"text-xs"})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:K0()}),t(Me,{checked:a.allowDownload,onCheckedChange:(s)=>F({allowDownload:s})})]}),t("p",{className:"text-xs text-muted-foreground",children:W0()})]}),o("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:SA()}),t(Me,{checked:ee,disabled:ie==="processing",onCheckedChange:(s)=>{if(!s)ve();else R(!0)}})]}),ee&&ie==="processing"&&o("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 font-medium py-1 animate-pulse",children:[t(O,{className:"h-3.5 w-3.5 animate-spin"}),t("span",{children:v1()})]}),ee&&ie!=="processing"&&t(E,{variant:"outline",size:"sm",className:"w-full text-xs gap-1.5 mt-1",onClick:()=>R(!0),children:hb()})]})]})}),t(Ke,{title:Cf(),icon:t(Ql,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-3 pt-2 flex gap-2",children:[o(E,{variant:k==="card"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>x("card"),children:[t(to,{className:"h-4 w-4"}),Vv()]}),o(E,{variant:k==="list"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>x("list"),children:[t(Oo,{className:"h-4 w-4"}),Cw()]})]})}),t(Ke,{title:Da(),icon:t(ct,{className:"h-4 w-4"}),children:t("div",{className:"p-3 space-y-3 pt-2",children:te?.map((s)=>o("div",{className:"flex items-center justify-between",children:[t(W,{className:"text-xs",children:s.config?.name}),t(Me,{checked:a.fieldVisibility?.[s.id]??!1,onCheckedChange:()=>Ie(s.id)})]},s.id))})}),t(Ke,{title:kl(),icon:t(Bl,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-4 pt-2",children:[o("div",{className:"space-y-2",children:[t(W,{className:"text-xs text-muted-foreground",children:qf()}),o(Le,{value:T,onValueChange:(s)=>{if(s==="index")C(null);else C(`${s}:${G}`)},children:[t(Be,{className:"w-full text-xs h-9",children:t(Ze,{})}),o(Ue,{children:[t(ne,{value:"index",children:Op()}),t(ne,{value:"name",children:Rl()}),t(ne,{value:"createdAt",children:Fp()}),t(ne,{value:"size",children:Zp()})]})]})]}),o("div",{className:"space-y-2",children:[t(W,{className:"text-xs text-muted-foreground",children:pp()}),o(E,{variant:"outline",className:"w-full justify-between font-normal text-xs h-9",disabled:T==="index",onClick:()=>{C(`${T}:${G==="asc"?"desc":"asc"}`)},children:[t("span",{children:T==="name"?G==="asc"?Vc():Wc():T==="createdAt"?G==="asc"?Kc():Qc():T==="size"?G==="asc"?Bp():Lp():G==="asc"?If():Ff()}),t(iu,{className:"h-4 w-4 opacity-50"})]})]})]})})]})]})}),o("div",{className:"p-4 border-t border-border space-y-2",children:[o(E,{variant:"outline",className:"w-full justify-center",onClick:()=>window.open(se,"_blank"),children:[t(Zl,{className:"h-4 w-4 mr-2"}),IS()]}),o(E,{className:"w-full justify-center bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>oe(se),children:[t(Nr,{className:"h-4 w-4 mr-2"}),uy()]})]}),t(ft,{open:g,onOpenChange:R,initialConfig:me,shareId:a.id,onSaveSuccess:()=>{_e(),v.invalidateQueries({queryKey:["share",a.id]}),v.invalidateQueries({queryKey:["shares",a.projectId]})}})]})}function Ke({title:a,icon:k,children:x}){let[p,C]=u(!1);return o("div",{className:"border-b border-border last:border-0",children:[o("button",{onClick:()=>C(!p),className:"w-full flex items-center justify-between py-3 px-2 hover:bg-muted/50 transition-colors",children:[o("div",{className:"flex items-center gap-3",children:[k,t("span",{className:"text-sm font-medium",children:a})]}),t(vt,{className:Mt("h-4 w-4 transition-transform",p&&"rotate-90")})]}),p&&x&&t("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:x})]})}function Mt(...a){return a.filter(Boolean).join(" ")}function nt({teamId:a,projectId:k,projectName:x,shareId:p,rootFolderId:C}){let v=Q(),{fetchMetadata:z}=Ar();h(()=>{if(a)z(a)},[a,z]);let{data:d}=Z({queryKey:["share",p],queryFn:async()=>{let r=await A.api.shares[":shareId"].$get({param:{shareId:p}});if(!r.ok)throw Error(Hb());return await r.json()}}),w=d?.rootFolderId,[c,g]=u(null),[R,H]=u([]);h(()=>{if(w)g(w),H([]),U(new Set)},[w,p]);let _=un((r)=>r.setProjectState),xe=un((r)=>r.clearProjectState),be=(r)=>{if(r===c)return;if(r===w)g(w),H([]);else{let m=R.findIndex((f)=>f.id===r);if(m!==-1)g(r),H(R.slice(m+1))}U(new Set)},[ye,_e]=u(240),[J,ve]=u(360),{shareConfigLeftSidebarCollapsed:ie,shareConfigRightSidebarCollapsed:me}=$t(),ee=d?.defaultSortOrder||null,te,re;if(ee){let r=ee.split(":");te=r[0],re=r[1]}let F=d?.viewMode??"card",{data:se,fetchNextPage:oe,hasNextPage:Ie,isFetchingNextPage:T,isLoading:G}=pt({queryKey:["folder-children",a,c,"folder",te,re],queryFn:async({pageParam:r})=>{let m=await A.api.folders[":folderId"].children.$get({param:{folderId:c},query:{assetType:"folder",after:r,sort:te,order:re}});if(!m.ok)throw Error(qb());return await m.json()},enabled:!!c,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),{data:s,fetchNextPage:X,hasNextPage:ke,isFetchingNextPage:Qe,isLoading:je}=pt({queryKey:["folder-children",a,c,"file",te,re],queryFn:async({pageParam:r})=>{let m=await A.api.folders[":folderId"].children.$get({param:{folderId:c},query:{assetType:"file",after:r,sort:te,order:re}});if(!m.ok)throw Error(jb());return await m.json()},enabled:!!c,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),Y=N(()=>se?.pages.flatMap((r)=>r.data??[])??[],[se]),Fe=N(()=>s?.pages.flatMap((r)=>r.data??[])??[],[s]);h(()=>{if(d)_({teamId:a,projectId:k,projectName:x,ancestorFolders:R,currentAsset:{name:c===w?d.name:Y.find((r)=>r.id===c)?.name||d.name,type:"folder"},isRootFolder:!1,shareId:p,onFolderClick:be});return()=>xe()},[a,k,x,R,c,w,d,p,Y,_,xe]);let[de,Se]=u(null),[Te,U]=u(new Set),Ee=()=>{U(new Set),Se(null)},{dragState:Ce,handleDragStart:Ve,handleDragEnd:He}=jl({teamId:a,projectId:k,assetId:c||"",folders:Y,files:Fe,selectedIds:Te,onClearSelection:Ee}),Ge=A.api.shares[":shareId"].assets[":assetId"].$delete,{mutate:Xe}=B({mutationFn:async(r)=>{if(!(await Ge({param:{shareId:p,assetId:r}})).ok)throw Error($b())},onSuccess:()=>{v.invalidateQueries({queryKey:["folder-children",a,c]}),M.success(yC())}}),Ye=A.api.shares[":shareId"].$put,{mutate:We}=B({mutationFn:async(r)=>{let m=await Ye({param:{shareId:p},json:r});if(!m.ok)throw Error(yi());return await m.json()},onSuccess:()=>{v.invalidateQueries({queryKey:["share",p]}),M.success(Gc())}}),Je=(r)=>{if(r.type==="folder"||r.targetType==="folder"){let m=c===w?d?.name||"":Y.find((f)=>f.id===c)?.name||An();H((f)=>[{id:c,name:m},...f]),g(r.id),U(new Set)}};if(!d)return t("div",{children:wd()});return o($n,{modifiers:[ua.configure({anchor:{x:0,y:0}})],sensors:[_n.configure({activationConstraints:[new Dr.Distance({value:10})]})],onDragStart:Ve,onDragEnd:He,children:[t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{className:"flex flex-1 overflow-hidden relative",children:[!ie&&o(L,{children:[t("div",{className:"bg-background",style:{width:ye},children:t(br,{teamId:a,projectId:k,projectName:x,rootFolderId:C,dragState:Ce})}),t(Ir,{onResize:(r)=>_e((m)=>Math.max(180,Math.min(400,m+r)))})]}),t(Ci,{teamId:a,projectId:k,assetId:c||"",folders:Y,files:Fe,selectedItem:de,selectedIds:Te,onItemSelect:(r,m)=>{if(m.metaKey||m.ctrlKey){let f=new Set(Te);if(f.has(r.id)){if(f.delete(r.id),U(f),de?.id===r.id){let i=[...Y,...Fe].find(($e)=>f.has($e.id));Se(i||null)}}else f.add(r.id),U(f),Se(r)}else U(new Set([r.id])),Se(r)},onItemDoubleClick:Je,onSaveField:()=>{},displayStyle:F,onClearSelection:Ee,fetchNextFoldersPage:oe,hasNextFoldersPage:Ie,isFetchingNextFoldersPage:T,fetchNextFilesPage:X,hasNextFilesPage:ke,isFetchingNextFilesPage:Qe,isLoading:G||je,filterConditions:[],onFilterChange:()=>{},dragState:Ce,isShareView:!0,onRemoveFromShare:(r)=>{r.forEach((m)=>Xe(m.id))},fieldVisibility:d.fieldVisibility}),!me&&o(L,{children:[t(Ir,{onResize:(r)=>ve((m)=>Math.max(240,Math.min(600,m-r)))}),t("div",{style:{width:J},className:"flex-shrink-0 h-full",children:t(gt,{shareLink:d,viewMode:F,onViewModeChange:(r)=>We({viewMode:r}),defaultSortOrder:ee,onSortOrderChange:(r)=>We({defaultSortOrder:r})})})]})]})}),t(Xc,{children:Ce?.isActive?t("div",{className:"flex items-center gap-2 rounded-md bg-popover px-3 py-2 text-sm font-medium shadow-md",children:Mx({count:Ce.itemCount})}):null})]})}S();function Tt(){let{projectId:a,shareId:k}=jt.useParams(),{teamId:x,ensureTeamIdForProject:p}=lt();h(()=>{p(a)},[a,p]);let{data:C}=nr(sm(a)),v=C?.rootFolder,{data:z}=Z({queryKey:["folders",v],queryFn:async()=>{let d=await A.api.folders[":folderId"].$get({param:{folderId:v}});if(!d.ok)throw Error("Failed to fetch folder");return await d.json()},enabled:!!v});if(!x||!v||!z)return t(St,{});return t(nt,{teamId:x,projectId:a,projectName:C.name??"",shareId:k,rootFolderId:v})}var jt=ze("/projects/$projectId/shares/$shareId")({component:Tt});export{jt as Route};
@@ -1,2 +0,0 @@
1
- import{I}from"./chunk-vsefjzzj.js";var e=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],To=I("terminal",e);
2
- export{To};