@shumai-one/shumai 0.3.3 → 0.3.5

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 (136) hide show
  1. package/bin/{chunk-d3kpqay2.js → chunk-0bbhm7dp.js} +2 -2
  2. package/bin/{chunk-9e99n265.js → chunk-17bewdr0.js} +2 -2
  3. package/bin/{chunk-41m51y08.js → chunk-1fqpgz02.js} +1 -1
  4. package/bin/chunk-21hvrvzj.js +2 -0
  5. package/bin/chunk-23mj9p82.js +1 -0
  6. package/bin/chunk-24mag65w.js +1 -0
  7. package/bin/chunk-29203j0e.js +7 -0
  8. package/bin/{chunk-gpmaaca1.js → chunk-2jfbxefd.js} +2 -2
  9. package/bin/chunk-2jv9re91.js +2 -0
  10. package/bin/chunk-2rmceamt.js +1 -0
  11. package/bin/{chunk-bd6x5ns9.js → chunk-3mprq5kb.js} +2 -2
  12. package/bin/{chunk-wtzkfwmx.js → chunk-3w9vybrh.js} +2 -2
  13. package/bin/{chunk-gh4w2bdg.js → chunk-3ydjrkbd.js} +1 -1
  14. package/bin/{chunk-ts9f4zqh.js → chunk-43mhpb0k.js} +2 -2
  15. package/bin/{chunk-wkth5xwr.js → chunk-4b8ms2ct.js} +2 -2
  16. package/bin/{chunk-p8enen2a.js → chunk-4rz2105a.js} +1 -1
  17. package/bin/{chunk-g097058z.js → chunk-4sdrjye2.js} +2 -2
  18. package/bin/{chunk-yfkcv10v.js → chunk-52qe6z8w.js} +1 -1
  19. package/bin/{chunk-vg6mkdj1.js → chunk-54hmgj96.js} +2 -2
  20. package/bin/{chunk-2fc5hk8r.js → chunk-5r55htaw.js} +1 -1
  21. package/bin/{chunk-am1m29pv.js → chunk-5yxngq5n.js} +1 -1
  22. package/bin/{chunk-9vgjhemh.js → chunk-6j6dejtd.js} +1 -1
  23. package/bin/chunk-6kv3jyfc.js +2 -0
  24. package/bin/{chunk-xcbb21j9.js → chunk-6vn44e4d.js} +2 -2
  25. package/bin/{chunk-57kgmgfs.js → chunk-7jkvjm4x.js} +2 -2
  26. package/bin/{chunk-5cm4vge8.js → chunk-7mkk8ahk.js} +2 -2
  27. package/bin/{chunk-mm810jv7.js → chunk-7w2tx08e.js} +2 -2
  28. package/bin/{chunk-m6sssvg3.js → chunk-7zdmpbt6.js} +1 -1
  29. package/bin/{chunk-cdqvg03f.js → chunk-8fsrs7mh.js} +1 -1
  30. package/bin/{chunk-mggfc9ya.js → chunk-8hq6sn31.js} +2 -2
  31. package/bin/{chunk-m268vcdm.js → chunk-8mzg29m4.js} +2 -2
  32. package/bin/chunk-8na8a41a.js +2 -0
  33. package/bin/{chunk-7x7jtkh8.js → chunk-8skgcmxm.js} +1 -1
  34. package/bin/chunk-8ttfy5yy.js +1 -0
  35. package/bin/{chunk-3gcnj1eq.js → chunk-8vc1m0kw.js} +2 -2
  36. package/bin/{chunk-7anqxx1z.js → chunk-8vvr1ez5.js} +1 -1
  37. package/bin/chunk-95qc4bkh.js +2 -0
  38. package/bin/{chunk-3g9g2c7h.js → chunk-97y52q3a.js} +3 -3
  39. package/bin/{chunk-q8me9zev.js → chunk-9nd5m7hy.js} +1 -1
  40. package/bin/{chunk-4g7h9qhr.js → chunk-afzc5eae.js} +1 -1
  41. package/bin/{chunk-1rsp4hc5.js → chunk-ampyjbj4.js} +1 -1
  42. package/bin/{chunk-749c09cw.js → chunk-arxd4qb9.js} +1 -1
  43. package/bin/{chunk-x0r8dcq0.js → chunk-avvzqqk2.js} +2 -2
  44. package/bin/{chunk-525eypdk.js → chunk-b93djch5.js} +1 -1
  45. package/bin/{chunk-va6hxm7n.js → chunk-bg10gwm1.js} +2 -2
  46. package/bin/{chunk-h73653yp.js → chunk-bkcf4hw5.js} +1 -1
  47. package/bin/{chunk-gaemak59.js → chunk-bv642x5z.js} +2 -2
  48. package/bin/{chunk-rt0pvhdf.js → chunk-c2a5x1pk.js} +1 -1
  49. package/bin/{chunk-g224r7mc.js → chunk-c5esphve.js} +2 -2
  50. package/bin/chunk-cbjfw47x.js +62 -0
  51. package/bin/{chunk-9g6vy76b.js → chunk-d1zpcags.js} +2 -2
  52. package/bin/{chunk-qshm5vcn.js → chunk-d4zx3r12.js} +1 -1
  53. package/bin/{chunk-ey7vty63.js → chunk-f70xdh07.js} +2 -2
  54. package/bin/{chunk-tc7q988r.js → chunk-f7fevgv2.js} +2 -2
  55. package/bin/{chunk-p1bcbtmg.js → chunk-fcvtv783.js} +1 -1
  56. package/bin/chunk-fgda7ncw.js +2 -0
  57. package/bin/{chunk-vf3bg920.js → chunk-fnkrzqrn.js} +2 -2
  58. package/bin/{chunk-xgb533n0.js → chunk-fq6emqwq.js} +3 -3
  59. package/bin/{chunk-5vwkfxy7.js → chunk-fw5k0xrc.js} +2 -2
  60. package/bin/{chunk-3823qzr0.js → chunk-g0jy85re.js} +2 -2
  61. package/bin/{chunk-6jgq154r.js → chunk-g5mpp3nc.js} +1 -1
  62. package/bin/{chunk-t15a1vp6.js → chunk-gd1x3rgn.js} +1 -1
  63. package/bin/chunk-gwxzjc0m.js +1 -0
  64. package/bin/chunk-h2tztyxs.js +1 -0
  65. package/bin/{chunk-v0yhkcj5.js → chunk-hbrndqpj.js} +2 -2
  66. package/bin/{chunk-0dcv6kpk.js → chunk-hk7a2mgn.js} +2 -2
  67. package/bin/chunk-htrzgs2a.css +1 -0
  68. package/bin/{chunk-2475z7vk.js → chunk-jf5ytqxd.js} +1 -1
  69. package/bin/{chunk-r5jmnsqj.js → chunk-jkapr5we.js} +1 -1
  70. package/bin/chunk-jqyprvqd.js +1 -0
  71. package/bin/chunk-jyeyp8p3.js +1 -0
  72. package/bin/{chunk-xsw3pb5p.js → chunk-kn4tnhbw.js} +2 -2
  73. package/bin/{chunk-jkh04dka.js → chunk-ks8deg42.js} +1 -1
  74. package/bin/chunk-kwr4m6vh.js +1 -0
  75. package/bin/chunk-n62kyrh1.js +1 -0
  76. package/bin/{chunk-9sdhdhv4.js → chunk-n67rfv86.js} +2 -2
  77. package/bin/{chunk-8a75zqbz.js → chunk-nh4tzzn8.js} +2 -2
  78. package/bin/{chunk-zgsy3k3h.js → chunk-ntxwp6aa.js} +1 -1
  79. package/bin/{chunk-7pjes19z.js → chunk-p33nq4pp.js} +2 -2
  80. package/bin/{chunk-h4a3ms2b.js → chunk-p3k6nzhe.js} +2 -2
  81. package/bin/{chunk-67rr836p.js → chunk-q0znwxfe.js} +1 -1
  82. package/bin/{chunk-gpeyctxd.js → chunk-qm9w9fcv.js} +2 -2
  83. package/bin/chunk-qxwfhv63.js +2 -0
  84. package/bin/{chunk-9a7a1p1j.js → chunk-r9s1zs4g.js} +2 -2
  85. package/bin/{chunk-yj6tmjsc.js → chunk-rek85wwv.js} +2 -2
  86. package/bin/{chunk-wpntb95k.js → chunk-s0g0bc6t.js} +2 -2
  87. package/bin/{chunk-pdajhyqm.js → chunk-s0k2r6ym.js} +2 -2
  88. package/bin/{chunk-fwqpq2sy.js → chunk-sx1neqgr.js} +1 -1
  89. package/bin/{chunk-2jvqhps9.js → chunk-t58kqafx.js} +2 -2
  90. package/bin/{chunk-qx2mzv89.js → chunk-th07gms7.js} +1 -1
  91. package/bin/chunk-v0cdg3n6.js +307 -0
  92. package/bin/{chunk-tzmzqmcg.js → chunk-v4re49f5.js} +1 -1
  93. package/bin/{chunk-c7rj0f5r.js → chunk-vpq224tm.js} +1 -1
  94. package/bin/{chunk-mhwp74hh.js → chunk-vvr179pz.js} +1 -1
  95. package/bin/{chunk-p86w1eaw.js → chunk-vzb2b89p.js} +1 -1
  96. package/bin/{chunk-bw6wyw7k.js → chunk-w8vk30ze.js} +2 -2
  97. package/bin/{chunk-0a0sdyta.js → chunk-weean2ja.js} +1 -1
  98. package/bin/{chunk-pqxh0cg7.js → chunk-wg5tjyj9.js} +2 -2
  99. package/bin/{chunk-xn9cpax1.js → chunk-wknqst3v.js} +3 -3
  100. package/bin/chunk-x217skr3.js +2 -0
  101. package/bin/{chunk-bn4ewsy8.js → chunk-x2z5zz01.js} +1 -1
  102. package/bin/{chunk-hz6s7by4.js → chunk-xnzyt0kq.js} +1 -1
  103. package/bin/{chunk-9zvteyz0.js → chunk-xqkwpr7s.js} +2 -2
  104. package/bin/{chunk-yedr4r8a.js → chunk-xt9n0y9a.js} +1 -1
  105. package/bin/{chunk-7436fyrg.js → chunk-y6aa5ee0.js} +1 -1
  106. package/bin/{chunk-v75fanse.js → chunk-zj1rz1s9.js} +2 -2
  107. package/bin/shumai-app.html +1 -1
  108. package/bin/shumai-app.js +503 -408
  109. package/package.json +7 -7
  110. package/prisma/migrations/20260806082136_add_sharelink_watermark/migration.sql +69 -0
  111. package/prisma/migrations/20260806085643_add_watermark_file_status/migration.sql +7 -0
  112. package/prisma/migrations/20260807140837_clean_media_remove_raw_transcodes_and_original_download_url/migration.sql +86 -0
  113. package/prisma/migrations/20260808014542_add_sharelink_allow_download/migration.sql +2 -0
  114. package/prisma/schema.prisma +68 -0
  115. package/bin/chunk-1cjgpspz.js +0 -2
  116. package/bin/chunk-1pgtq4rc.js +0 -2
  117. package/bin/chunk-25qj10ny.js +0 -1
  118. package/bin/chunk-4v5ykazp.js +0 -1
  119. package/bin/chunk-5x3vzer8.js +0 -1
  120. package/bin/chunk-804ndet8.js +0 -2
  121. package/bin/chunk-a8daqpfh.js +0 -7
  122. package/bin/chunk-c0c88nje.js +0 -307
  123. package/bin/chunk-d6v81kjj.js +0 -1
  124. package/bin/chunk-dfcrtdk2.js +0 -1
  125. package/bin/chunk-eczsk2xd.js +0 -62
  126. package/bin/chunk-g5e93f59.js +0 -2
  127. package/bin/chunk-g5xkj9p3.js +0 -2
  128. package/bin/chunk-hp139z0j.js +0 -2
  129. package/bin/chunk-j4y8c864.js +0 -1
  130. package/bin/chunk-pbb1tdwt.js +0 -1
  131. package/bin/chunk-pbfkw90e.js +0 -1
  132. package/bin/chunk-s10v4b01.css +0 -1
  133. package/bin/chunk-s1b5kf34.js +0 -2
  134. package/bin/chunk-v0xbr5e6.js +0 -2
  135. package/bin/chunk-yfjn4qn2.js +0 -1
  136. package/bin/chunk-z9560a6e.js +0 -1
@@ -1,2 +1,2 @@
1
- import{Ag as a,tj as o}from"./chunk-eczsk2xd.js";function l({className:t,...e}){return a("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function n({className:t,...e}){return a("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function c({className:t,...e}){return a("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a("tr",{"data-slot":"table-row",className:o("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",t),...e})}function s({className:t,...e}){return a("th",{"data-slot":"table-head",className:o("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function b({className:t,...e}){return a("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}
2
- export{l as Ja,n as Ka,c as La,d as Ma,s as Na,b as Oa};
1
+ import{Cg as a,yj as o}from"./chunk-cbjfw47x.js";function l({className:t,...e}){return a("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function n({className:t,...e}){return a("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function c({className:t,...e}){return a("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a("tr",{"data-slot":"table-row",className:o("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",t),...e})}function s({className:t,...e}){return a("th",{"data-slot":"table-head",className:o("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function b({className:t,...e}){return a("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}
2
+ export{l as La,n as Ma,c as Na,d as Oa,s as Pa,b as Qa};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{kd as a}from"./chunk-7x7jtkh8.js";var l=/"/g,n=/[\\'"]/g;class r extends a{visitOrAction(t){this.append("or "),this.append(t.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(t){return t.replace(l,'""')}sanitizeJSONPathMemberValue(t){return t.replace(n,(e)=>e==="\\"?"\\\\":e==="'"?"''":"\\\"")}visitDefaultInsertValue(t){this.append("null")}}class s{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}class p extends s{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(t,e){}async releaseMigrationLock(t,e){}}
3
- export{s as yc,r as zc,p as Ac};
2
+ import{md as a}from"./chunk-8skgcmxm.js";var l=/"/g,n=/[\\'"]/g;class r extends a{visitOrAction(t){this.append("or "),this.append(t.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(t){return t.replace(l,'""')}sanitizeJSONPathMemberValue(t){return t.replace(n,(e)=>e==="\\"?"\\\\":e==="'"?"''":"\\\"")}visitDefaultInsertValue(t){this.append("null")}}class s{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}class p extends s{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(t,e){}async releaseMigrationLock(t,e){}}
3
+ export{s as Ac,r as Bc,p as Cc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function N(k){if(!(k instanceof Error)||!("status"in k)||!("headers"in k))return!1;return(k.status===void 0||typeof k.status==="number")&&(k.headers===void 0||k.headers instanceof Headers)}function O(k){let w=k.headers?.get("x-should-retry");if(w==="true")return!0;if(w==="false")return!1;if(k.status===void 0)return!0;return k.status===408||k.status===409||k.status===429||typeof k.status==="number"&&k.status>=500}function J(k,w,C){let z=w??60000;if(z>0&&k>z)throw Error(`Server requested ${Math.ceil(k/1000)}s retry delay (max: ${Math.ceil(z/1000)}s). ${C}`);return k}function Q(k,w,C){let z=k.headers?.get("retry-after-ms");if(z){let F=Number.parseFloat(z);if(!Number.isNaN(F))return J(F,C,k.message)}let B=k.headers?.get("retry-after");if(B){let F=Number.parseFloat(B),K=Number.isNaN(F)?Date.parse(B)-Date.now():F*1000;return J(K,C,k.message)}return Math.min(0.5*2**w,8)*1000*(1-Math.random()*0.25)}function H(){let k=Error("Request aborted");return k.name="AbortError",k}function T(k,w){return new Promise((C,z)=>{if(w?.aborted){z(H());return}let B=()=>{clearTimeout(G),z(H())},G=setTimeout(()=>{w?.removeEventListener("abort",B),C()},Math.max(0,k));w?.addEventListener("abort",B,{once:!0})})}async function V(k,w={}){let C=w.maxRetries??0,z=C;for(;;)try{return await k()}catch(B){if(w.signal?.aborted)throw H();if(z<=0||!N(B)||!O(B))throw B;let G=C-z;z--,await T(Q(B,G,w.maxRetryDelayMs),w.signal)}}
3
- export{V as Tj};
3
+ export{V as Yj};
@@ -1,2 +1,2 @@
1
- import{Ag as i,Bg as r,sj as o,tj as a}from"./chunk-eczsk2xd.js";function m({delayDuration:t=0,...e}){return i(o.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function f({...t}){return i(o.Root,{"data-slot":"tooltip",...t})}function s({...t}){return i(o.Trigger,{"data-slot":"tooltip-trigger",...t})}function c({className:t,sideOffset:e=0,children:n,...d}){return i(o.Portal,{children:r(o.Content,{"data-slot":"tooltip-content",sideOffset:e,className:a("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 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",t),...d,children:[n,i(o.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}
2
- export{m as wf,f as xf,s as yf,c as zf};
1
+ import{Cg as i,Dg as r,xj as o,yj as a}from"./chunk-cbjfw47x.js";function m({delayDuration:t=0,...e}){return i(o.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function f({...t}){return i(o.Root,{"data-slot":"tooltip",...t})}function s({...t}){return i(o.Trigger,{"data-slot":"tooltip-trigger",...t})}function c({className:t,sideOffset:e=0,children:n,...d}){return i(o.Portal,{children:r(o.Content,{"data-slot":"tooltip-content",sideOffset:e,className:a("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 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",t),...d,children:[n,i(o.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}
2
+ export{m as yf,f as zf,s as Af,c as Bf};
@@ -0,0 +1,2 @@
1
+ import{b as WG,c as VG}from"./chunk-2jv9re91.js";import{i as qG,l as BG}from"./chunk-v0cdg3n6.js";import{o as zG}from"./chunk-29203j0e.js";import{Ja as HG}from"./chunk-fw5k0xrc.js";import{Me as _G}from"./chunk-fgda7ncw.js";import{tf as ZG}from"./chunk-fnkrzqrn.js";import{$f as F,Zf as v,_f as g,bg as u}from"./chunk-54hmgj96.js";import{Ag as oG,Aj as XG,Bg as JG,Cg as U,Dg as z,Gj as YG,Hg as N,Hj as $G,Kg as w,Pg as KG,eh as B,ih as OG,ph as P,qi as UG}from"./chunk-cbjfw47x.js";import{Kk as nG}from"./chunk-gd1x3rgn.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,m]=X.useState(()=>{return localStorage.getItem(`share_pwd_${K}`)||""}),[D,NG]=X.useState(""),{data:O,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||O?.rootFolderId,_=f||null,h=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:!!O&&!!Y});X.useEffect(()=>{if(R?.ancestorFolders&&O){let G=R.ancestorFolders.findIndex((J)=>J.id===O.rootFolderId);if(G!==-1)l(R.ancestorFolders.slice(0,G));else if(Y===O.rootFolderId)l([])}},[R,O,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:!!O&&!!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:!!O&&!!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:!!O}),{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:!!_&&!!O}),{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&&!!O}),$=V?uG:q,pG=FG||!!V&&fG;X.useEffect(()=>{if(t?.message==="Unauthorized")m(""),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,$]),mG=(G)=>{G.preventDefault(),m(D),localStorage.setItem(`share_pwd_${K}`,D)},hG=(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(!O)return;let J=G==="root"?O.rootFolderId:G;if(J===O.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(O&&Y){let G=Y===O.rootFolderId?O.name:k.find((J)=>J.id===Y)?.name||O.name;e({teamId:"",projectId:O.projectId,projectName:O.name,ancestorFolders:c,currentAsset:{name:$?.name||G,type:_?"file":"folder",version:q?.versionStack?q.versionStack.versions.find((J)=>J.id===h)?.version??q.versionStack.versions.length:void 0,proxyType:$?.proxyType||null},isRootFolder:Y===O.rootFolderId&&!_,isPublic:!0,shareId:K,fileId:_||void 0,allowDownload:O.allowDownload,downloadInfo:$?{originalKey:$.media?.original?.key,videoTranscodes:$.media?.videoTranscodes?.map((J)=>({key:J.key,width:J.width,height:J.height}))}: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()},[O,Y,k,$,q,h,_,c,e,GG,j,W,H,K]);let T;if(yG&&!Q)T=U("div",{className:"flex flex-1 items-center justify-center bg-background",children:U(P,{className:"h-8 w-8 animate-spin text-foreground"})});else if(Q)if(Q.message==="Unauthorized"){let G=Z!=="";T=U("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:[U("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:U(UG,{className:"h-6 w-6 text-primary"})}),U(F,{children:YG.password_protected()})]}),U(u,{children:z("form",{onSubmit:mG,className:"space-y-4",children:[z("div",{className:"space-y-2",children:[U($G,{type:"password",placeholder:"Enter password",value:D,onChange:(J)=>NG(J.target.value),autoFocus:!0}),G&&U("p",{className:"text-sm font-medium text-destructive",children:"Incorrect password. Please try again."})]}),U(XG,{type:"submit",className:"w-full",children:"Access Share"})]})})]})})}else{let G=Q.message.includes("expired"),J=Q.message.includes("disabled");T=U("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:[U("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:U(OG,{className:"h-6 w-6 text-destructive"})}),U(F,{children:G?"Share Expired":J?"Share Disabled":"Error"})]}),U(u,{className:"text-center text-muted-foreground",children:Q.message})]})})}else if(!O)T=U("div",{className:"flex flex-1 items-center justify-center bg-background",children:U(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&&U("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:U(P,{className:"h-8 w-8 animate-spin text-foreground"})}),W&&b&&A?U(VG,{isPublic:!0,shareId:K,versions:$?.versionStack?.versions??[],leftId:b,rightId:A,activeSide:p,annotations:I,seekRequest:PG,allowDownload:O.allowDownload,onActiveSideChange:(G)=>x({cmpActive:G}),onSwitchVersion:(G,J)=>x(G==="left"?{cmpLeft:J}:{cmpRight:J}),onExit:IG,onActiveAssetChange:RG,onPlay:r,onTimeUpdate:n}):$&&U(WG,{file:$,mediaControllerRef:L,onPlay:r,onTimeUpdate:n,annotations:I,startTime:TG,shareId:K,allowDownload:O.allowDownload})]}):Y&&U(zG,{teamId:"",projectId:O.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:hG,onSaveField:()=>{},displayStyle:O.viewMode??"card",onClearSelection:()=>E(new Set),fetchNextFoldersPage:jG,hasNextFoldersPage:CG,isFetchingNextFoldersPage:SG,fetchNextFilesPage:xG,hasNextFilesPage:wG,isFetchingNextFilesPage:vG,isShareView:!0,isPublic:!0,shareId:K,allowDownload:O.allowDownload}),!j&&z(JG,{children:[U(HG,{onResize:(G)=>LG((J)=>Math.max(240,Math.min(600,J-G)))}),U("div",{style:{width:EG},className:"flex-shrink-0 border-l",children:U(BG,{teamId:"",projectId:O.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:[U(_G,{}),T]})}
2
+ export{$J as a};