@qratilabs/qrati-connect 2.26.0 → 2.27.1

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 (58) hide show
  1. package/README.md +2 -73
  2. package/element/{CVdpS1mF2.js → 1eQ9Ef0M2.js} +3 -3
  3. package/element/B0sEsGHn.js +8 -0
  4. package/element/{CCDjXLSf.js → B5RetLW0.js} +2 -2
  5. package/element/B9ImRAum.js +1 -0
  6. package/element/{DwanMJWW.js → BKENYwOQ.js} +1 -1
  7. package/element/{DpD2Abx9.js → BLeZg2Bz.js} +1 -1
  8. package/element/{BfPopwQu2.js → BdkTKcG52.js} +8 -8
  9. package/element/{CwPz_TbG.js → BmsDSHUi.js} +1 -1
  10. package/element/{CM46pkhP2.js → BqiJLitq2.js} +1 -1
  11. package/element/{DLSVYuRG.js → BspExsK7.js} +2 -2
  12. package/element/Bspyv2wJ2.js +24 -0
  13. package/element/{D6nJgjWV.js → C4DSwLWc.js} +1 -1
  14. package/element/{CMR1TPJ1.js → C6MqLLDX.js} +1 -1
  15. package/element/C6YE4WUG2.js +5 -0
  16. package/element/C8meSsHD.js +1 -0
  17. package/element/CBM5QMn8.js +1 -0
  18. package/element/CKQOToSD.js +41 -0
  19. package/element/{DDyjgYNE.js → CUBxHQ8u.js} +1 -1
  20. package/element/CeHBrY_i.js +1 -0
  21. package/element/{BXZi_HIE.js → CfTdZB8y.js} +1 -1
  22. package/element/{xW6UboQF.js → CgxypkdG.js} +1 -1
  23. package/element/{DBUAmPz_.js → Cl0CwL5p.js} +1 -1
  24. package/element/DGZEznLT2.js +1 -0
  25. package/element/{Cw3szkAB.js → DLF5ysgi.js} +1 -1
  26. package/element/{BBWyJmHC.js → DOOdI-Oh.js} +1 -1
  27. package/element/DRPgs6nu2.js +16 -0
  28. package/element/{CDUjv5F52.js → DSx5wvUb2.js} +1 -1
  29. package/element/{BmU1kgIz2.js → DVFC5Z2L2.js} +14 -14
  30. package/element/{D9UPX_0d2.js → DWqIpaZ02.js} +1 -1
  31. package/element/{Bt5DH8OK.js → DZGp2V2-.js} +1 -1
  32. package/element/{DER_7fjj2.js → D_FNRN5A2.js} +1 -1
  33. package/element/{OGzsLhnG.js → DdYePHxG.js} +1 -1
  34. package/element/{BlD6lUxS.js → DlAI3J0X.js} +1 -1
  35. package/element/{CE4Zhv-W.js → DmIYOIw1.js} +1 -1
  36. package/element/DmpmrPE5.js +1 -0
  37. package/element/{Cqyszkb5.js → DvisvxzJ.js} +1 -1
  38. package/element/{CtWIgfGz.js → DyemeRjE2.js} +1 -1
  39. package/element/MU5QuIq0.js +3 -0
  40. package/element/{nOtAuUm1.js → QDuBhueG.js} +1 -1
  41. package/element/{Bb4v1eCh2.js → SgRzjPnr.js} +11 -11
  42. package/element/{PRmGsKkz2.js → Vk429P022.js} +1 -1
  43. package/element/{uIYtFcCq2.js → aXvUP7X72.js} +4 -4
  44. package/element/{BvrbBj1F.js → p0Q_2x6C.js} +1 -1
  45. package/element/{CzHEb5lR2.js → qBKIp1ZW2.js} +14 -14
  46. package/element/web.es.js +7 -9
  47. package/package.json +1 -1
  48. package/element/2CzUGwUv.js +0 -1
  49. package/element/BlmPmkho.js +0 -41
  50. package/element/CD7ZeUsI2.js +0 -9
  51. package/element/CitgNM58.js +0 -3
  52. package/element/DAjJ8IJf.js +0 -1
  53. package/element/DhbEeiM3.js +0 -8
  54. package/element/DvW8TE7T.js +0 -1
  55. package/element/KcnPb5CZ.js +0 -1
  56. package/element/PVzBLdl-2.js +0 -5
  57. package/element/VF9qDLJE2.js +0 -1
  58. package/element/b3Wjw4T02.js +0 -16
package/README.md CHANGED
@@ -1,19 +1,6 @@
1
- ![Qrati Connect Architecture](https://assets.qrati.com/images/tech-docs/qrati-connect-architecture-29-06-2026.webp)
2
-
3
- ![Node.js](https://img.shields.io/badge/Node-24.12-339933?logo=node.js)
4
- ![pnpm](https://img.shields.io/badge/pnpm-11-F69220?logo=pnpm)
5
- ![Preact](https://img.shields.io/badge/Preact-10.29-673AB8?logo=preact)
6
- ![Vite](https://img.shields.io/badge/Vite-8-646CFF?logo=vite)
7
- ![TypeScript](https://img.shields.io/badge/TypeScript-6.0+-3178C6?logo=typescript)
8
- ![Tailwind CSS](https://img.shields.io/badge/Tailwind%20CSS-v4-06B6D4?logo=tailwindcss)
9
- ![Vitest](https://img.shields.io/badge/Tests-Vitest-6E9F18?logo=vitest)
10
- ![Playwright](https://img.shields.io/badge/E2E-Playwright-2EAD33?logo=playwright)
11
- ![Storybook](https://img.shields.io/badge/Storybook-10-FF4785?logo=storybook)
12
- ![semantic-release](https://img.shields.io/badge/Release-semantic--release-CB3837?logo=semantic-release)
13
-
14
1
  Qrati Connect is a drop-in, embeddable event/gallery widget. It ships as three friendly bundles:
15
2
 
16
- - **`<qrati-connect>` Web Component** — shadow-DOM isolated, Preact-powered, ~3 KB.
3
+ - **`<qrati-connect>` Web Component** — shadow-DOM isolated, ~3 KB.
17
4
  - **React wrapper** — external React, lazy-loads the custom element.
18
5
  - **Embed loader** — one `<script>` tag, no bundler needed.
19
6
 
@@ -23,58 +10,9 @@ Styles self-inject at runtime, so hosts never import a stylesheet.
23
10
  ## Install
24
11
 
25
12
  ```bash
26
- # contributors
27
- pnpm install
28
-
29
- # consumers
30
13
  npm install @qratilabs/qrati-connect
31
14
  ```
32
15
 
33
- > Requires **Node ≥24** and **pnpm ≥11**. See `.nvmrc` for the pinned Node version.
34
-
35
- ## Environment
36
-
37
- ```bash
38
- cp .env.example .env.local
39
- ```
40
-
41
- Set at least:
42
-
43
- - `VITE_BASE_URL` — API base, e.g. `https://api.qrati.com`
44
- - `VITE_APP_ENVIRONMENT` — e.g. `alpha`, `beta`, `prod`
45
-
46
- ## Develop
47
-
48
- No separate dev server, but you have options:
49
-
50
- ```bash
51
- # Component workbench
52
- pnpm storybook
53
-
54
- # Iterate on the standalone element
55
- pnpm build:element:watch
56
- pnpm serve:element # http://localhost:4599
57
- ```
58
-
59
- ## Test
60
-
61
- ```bash
62
- pnpm test:unit:run # Vitest + jsdom
63
- pnpm test:production # Playwright against a live env
64
- pnpm test:all # unit + production
65
- ```
66
-
67
- ## Build
68
-
69
- ```bash
70
- pnpm build # all three bundles + post-build validation
71
- pnpm build:element # dist/element/web.es.js
72
- pnpm build:react # dist/react/index.{mjs,cjs,d.ts}
73
- pnpm build:embed # dist/embed/embed.js
74
- ```
75
-
76
- `build:react` automatically builds the element first because the React wrapper loads `../element/web.es.js` at runtime.
77
-
78
16
  ## Use it
79
17
 
80
18
  ### React
@@ -116,15 +54,6 @@ renderComponent('#qrati-host', {
116
54
  });
117
55
  ```
118
56
 
119
- ## Deploy
120
-
121
- ```bash
122
- pnpm deploy:beta # merge main into release/beta and push
123
- pnpm deploy:prod # merge main into release/prod and push
124
- ```
125
-
126
- Both scripts require a clean git working tree. After pushing, semantic-release publishes from `dist/` when CI runs on the release branch.
127
-
128
57
  ---
129
58
 
130
- Built with Preact, Vite, Tailwind, and a little bit of Shadow DOM magic.
59
+ Built with a little bit of Shadow DOM magic.
@@ -1,9 +1,9 @@
1
- import{t}from"./DrrpB4Om.js";import{n as s}from"./BlmPmkho.js";import{x as a}from"./DpD2Abx9.js";import{i as r,n as o,u as e}from"./OGzsLhnG.js";import{t as i}from"./CitgNM58.js";import{t as n}from"./DwanMJWW.js";import{t as m}from"./D6nJgjWV.js";import{t as l}from"./nOtAuUm1.js";import{t as c}from"./DGGc10Cy.js";import{t as g}from"./2CzUGwUv.js";import{t as d}from"./CtWIgfGz.js";var p=()=>{const p=e(),{props:f}=s(),v=f?.organizationId,{loading:h,event:u}=g({eventSlug:p.eventSlug});if(h)/* @__PURE__ */return t("div",{children:[
1
+ import{t}from"./DrrpB4Om.js";import{n as s}from"./CKQOToSD.js";import{x as a}from"./BLeZg2Bz.js";import{i as r,n as o,u as e}from"./DdYePHxG.js";import{t as i}from"./MU5QuIq0.js";import{t as n}from"./BKENYwOQ.js";import{t as m}from"./C4DSwLWc.js";import{t as l}from"./QDuBhueG.js";import{t as c}from"./DGGc10Cy.js";import{t as d}from"./CBM5QMn8.js";import{t as g}from"./DyemeRjE2.js";var f=()=>{const f=e(),{props:p}=s(),h=p?.organizationId,{loading:v,event:u}=d({eventSlug:f.eventSlug});if(v)/* @__PURE__ */return t("div",{children:[
2
2
  /* @__PURE__ */t(n,{className:"mx-auto mt-4 h-8 w-64"}),
3
3
  /* @__PURE__ */t(n,{className:"mx-auto mt-6 h-6 w-72"}),
4
4
  /* @__PURE__ */t(n,{className:"mx-auto mt-6 h-8 w-72"}),
5
- /* @__PURE__ */t("div",{className:"mt-8 grid grid-cols-1 gap-4 sm:grid-cols-3",children:Array.from({length:8}).map((s,a)=>/* @__PURE__ */t(n,{className:"h-72"},a))})]});const j=u?.organizationId?.toString?.()||u?.organizationId,N=v?.toString?.()||v;/* @__PURE__ */
5
+ /* @__PURE__ */t("div",{className:"mt-8 grid grid-cols-1 gap-4 sm:grid-cols-3",children:Array.from({length:8}).map((s,a)=>/* @__PURE__ */t(n,{className:"h-72"},a))})]});const j=u?.organizationId?.toString?.()||u?.organizationId,N=h?.toString?.()||h;/* @__PURE__ */
6
6
  return t("div",u&&j===N?{className:"bg-background relative min-h-screen",children:/* @__PURE__ */t(c,{locale:u?.language??"en",translations:u?.translations,children:[
7
7
  /* @__PURE__ */t(l,{}),
8
8
  /* @__PURE__ */t(r,{}),
9
- /* @__PURE__ */t(m,{})]})}:{className:"flex w-full flex-col items-center gap-8",children:[/* @__PURE__ */t(i,{className:"mt-16",title:"Event not found",description:"Please check the provided link",iconSvg:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-full",viewBox:"0 0 997.86122 450.8081",role:"img"})}),/* @__PURE__ */t(o,{to:a.PUBLIC_EVENTS,state:{internalNavigation:!0},children:/* @__PURE__ */t(d,{children:"All events"})})]})};export{p as default};
9
+ /* @__PURE__ */t(m,{})]})}:{className:"flex w-full flex-col items-center gap-8",children:[/* @__PURE__ */t(i,{className:"mt-16",title:"Event not found",description:"Please check the provided link",iconSvg:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-full",viewBox:"0 0 997.86122 450.8081",role:"img"})}),/* @__PURE__ */t(o,{to:a.PUBLIC_EVENTS,state:{internalNavigation:!0},children:/* @__PURE__ */t(g,{children:"All events"})})]})};export{f as default};
@@ -0,0 +1,8 @@
1
+ import{h as a,t as s}from"./DrrpB4Om.js";import{n as o}from"./CKQOToSD.js";import{x as e}from"./BLeZg2Bz.js";import{c as r,t as l}from"./DdYePHxG.js";import{t as i}from"./DmIYOIw1.js";import{n as t}from"./DGGc10Cy.js";import{t as n}from"./DyemeRjE2.js";import{a as d,i as m,o as p,r as c,s as w,t as g}from"./DWqIpaZ02.js";import{n as h,r as f,t as u}from"./DlRUi0u42.js";var P=()=>{const{t:P}=t(),[b,v]=a(""),[C,y]=a(""),[N,j]=a(""),[x,A]=a(""),[k,S]=a(""),[z,F]=a(null),[L,E]=a({}),[O,R]=a(!1),[W,D]=a({google:!1,apple:!1}),[G,H]=a({showPassword:!1,showConfirmPassword:!1}),I=r(),{registerUsingEmail:U,loginWithGoogle:T,loginWithApple:V}=o(),X=a=>{E(s=>s[a]?{...s,[a]:void 0}:s)},$=async(a,s)=>{D(s=>({...s,[a]:!0})),F(null);try{await(s?.())}catch(o){o instanceof Error?F(o.message):F(`Failed to sign up with ${a.charAt(0).toUpperCase()+a.slice(1)}`)}finally{D(s=>({...s,[a]:!1}))}};/* @__PURE__ */
2
+ return s("div",{className:"bg-background w-full space-y-8",children:[/* @__PURE__ */s("form",{noValidate:!0,onSubmit:async a=>{a.preventDefault();const s=d(b),o=p(C),e=m(N),r=w(x),l=c(k,x);if(s||o||e||r||l)return void E({fname:s,lname:o,email:e,password:r,confirmPassword:l});E({}),R(!0),F(null);const i=await(U?.(N.toLowerCase(),x,b,C));i?.error&&F(i.error),R(!1)},className:"space-y-4",children:[
3
+ /* @__PURE__ */s("div",{className:"grid grid-cols-2 gap-4",children:[/* @__PURE__ */s(g,{label:P("auth.firstName","First name"),name:"fname",disabled:O,type:"text",value:b,onChange:a=>{v(a.target.value),X("fname")},error:L.fname}),/* @__PURE__ */s(g,{label:P("auth.lastName","Last name"),name:"lname",disabled:O,type:"text",value:C,onChange:a=>{y(a.target.value),X("lname")},error:L.lname})]}),
4
+ /* @__PURE__ */s(g,{label:P("auth.email","Email address"),name:"email",disabled:O,type:"email",value:N,onChange:a=>{j(a.target.value),X("email")},autoComplete:"email",error:L.email}),
5
+ /* @__PURE__ */s(g,{label:P("auth.password","Password"),name:"password",disabled:O,type:G.showPassword?"text":"password",value:x,onChange:a=>{A(a.target.value),X("password")},autoComplete:"new-password",error:L.password,actionLabel:G.showPassword?"Hide password":"Show password",actionIcon:G.showPassword?/* @__PURE__ */s(u,{className:"size-5"}):/* @__PURE__ */s(h,{className:"size-5"}),onActionClick:()=>H(a=>({...a,showPassword:!a.showPassword}))}),
6
+ /* @__PURE__ */s(g,{label:P("auth.confirmPassword","Confirm password"),name:"confirmPassword",disabled:O,type:G.showConfirmPassword?"text":"password",value:k,onChange:a=>{S(a.target.value),X("confirmPassword")},autoComplete:"new-password",error:L.confirmPassword,actionLabel:G.showConfirmPassword?"Hide password":"Show password",actionIcon:G.showConfirmPassword?/* @__PURE__ */s(u,{className:"size-5"}):/* @__PURE__ */s(h,{className:"size-5"}),onActionClick:()=>H(a=>({...a,showConfirmPassword:!a.showConfirmPassword}))}),z&&/* @__PURE__ */s(i,{align:"center",color:"error",className:"font-medium",children:z}),
7
+ /* @__PURE__ */s("div",{className:"flex justify-end",children:/* @__PURE__ */s(l,{to:e.FORGOT_PASSWORD,state:{from:I.pathname},children:/* @__PURE__ */s(i,{variant:"h6",className:"w-fit",children:P("button.forgotPassword","Forgot Password?")})})}),
8
+ /* @__PURE__ */s(n,{type:"submit",color:"primary",className:"w-full",disabled:O,loading:O,children:P("button.register","Register")})]}),/* @__PURE__ */s("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */s(f,{disabled:O||W.google||W.apple,loading:W.google,onClick:()=>$("google",T),provider:"google"}),/* @__PURE__ */s(f,{disabled:O||W.google||W.apple,loading:W.apple,onClick:()=>$("apple",V),provider:"apple"})]})]})};export{P as default};
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"./DdACKOZr.js";import{E as r,_ as i,c as n,d as o,f as a,g as s,h as l,o as d,p as c,s as u,t as h,v as p,y as m}from"./DrrpB4Om.js";import{i as g,n as f,s as v}from"./BlmPmkho.js";import{b,i as y,p as w,s as x,x as S,y as T}from"./DpD2Abx9.js";import{c as C,l as F,n as k,u as _}from"./OGzsLhnG.js";import{t as E}from"./CE4Zhv-W.js";import{t as M}from"./BkIDQGIs.js";import{t as U}from"./CAETItHr.js";import{n as R}from"./BBWyJmHC.js";import{r as I}from"./DGGc10Cy.js";import{t as P}from"./2CzUGwUv.js";import{t as N}from"./CtWIgfGz.js";import{t as q}from"./DPg_DKOi2.js";import{a as O,c as A,i as D,o as L,r as j,s as z,t as $}from"./CBLQRRGX2.js";import{a as B,i as H,n as V,o as W,r as G,t as X}from"./PRmGsKkz2.js";import{t as Y}from"./N4HKgEC52.js";import{n as Q,r as K,t as J}from"./DER_7fjj2.js";var Z=/* @__PURE__ */new Uint8Array(16),ee=[];for(let ln=0;ln<256;++ln)ee.push((ln+256).toString(16).slice(1));function te(e,t,r){return t||e||!crypto.randomUUID?function(e,t,r){const i=(e=e||{}).random??e.rng?.()??crypto.getRandomValues(Z);if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return(ee[e[t+0]]+ee[e[t+1]]+ee[e[t+2]]+ee[e[t+3]]+"-"+ee[e[t+4]]+ee[e[t+5]]+"-"+ee[e[t+6]]+ee[e[t+7]]+"-"+ee[e[t+8]]+ee[e[t+9]]+"-"+ee[e[t+10]]+ee[e[t+11]]+ee[e[t+12]]+ee[e[t+13]]+ee[e[t+14]]+ee[e[t+15]]).toLowerCase()}(i)}(e,t,r):crypto.randomUUID()}function re({checked:e,defaultChecked:t,onChange:r,onBlur:i,label:n,className:o,disabled:a}){const s=e??t??!1,l=s?"checked":"unchecked";/* @__PURE__ */
1
+ import{r as e,t}from"./DdACKOZr.js";import{E as r,_ as i,c as n,d as o,f as a,g as s,h as l,o as d,p as c,s as u,t as h,v as p,y as m}from"./DrrpB4Om.js";import{i as g,n as f}from"./CKQOToSD.js";import{t as v}from"./DmpmrPE5.js";import{b,i as y,p as w,s as x,x as S,y as T}from"./BLeZg2Bz.js";import{c as C,l as F,n as k,u as _}from"./DdYePHxG.js";import{t as E}from"./DmIYOIw1.js";import{t as M}from"./BkIDQGIs.js";import{t as U}from"./CAETItHr.js";import{n as R}from"./DOOdI-Oh.js";import{r as I}from"./DGGc10Cy.js";import{t as P}from"./CBM5QMn8.js";import{t as N}from"./DyemeRjE2.js";import{t as q}from"./DPg_DKOi2.js";import{a as O,c as A,i as D,o as L,r as j,s as z,t as $}from"./CBLQRRGX2.js";import{a as B,i as H,n as V,o as W,r as G,t as X}from"./Vk429P022.js";import{t as Y}from"./N4HKgEC52.js";import{n as Q,r as K,t as J}from"./D_FNRN5A2.js";var Z=/* @__PURE__ */new Uint8Array(16),ee=[];for(let ln=0;ln<256;++ln)ee.push((ln+256).toString(16).slice(1));function te(e,t,r){return t||e||!crypto.randomUUID?function(e,t,r){const i=(e=e||{}).random??e.rng?.()??crypto.getRandomValues(Z);if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return(ee[e[t+0]]+ee[e[t+1]]+ee[e[t+2]]+ee[e[t+3]]+"-"+ee[e[t+4]]+ee[e[t+5]]+"-"+ee[e[t+6]]+ee[e[t+7]]+"-"+ee[e[t+8]]+ee[e[t+9]]+"-"+ee[e[t+10]]+ee[e[t+11]]+ee[e[t+12]]+ee[e[t+13]]+ee[e[t+14]]+ee[e[t+15]]).toLowerCase()}(i)}(e,t,r):crypto.randomUUID()}function re({checked:e,defaultChecked:t,onChange:r,onBlur:i,label:n,className:o,disabled:a}){const s=e??t??!1,l=s?"checked":"unchecked";/* @__PURE__ */
2
2
  return h("label",{className:g("flex items-center gap-2",a&&"cursor-not-allowed opacity-50",!a&&"cursor-pointer"),children:[/* @__PURE__ */h("button",{type:"button",role:"switch","aria-checked":s,disabled:a,"data-state":l,onBlur:i,onClick:()=>!a&&r?.(!s),className:g("peer relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 transition-colors","border-border bg-muted","focus-visible:ring-2 focus-visible:ring-offset-2","data-[state=checked]:border-primary data-[state=checked]:bg-primary","disabled:cursor-not-allowed disabled:opacity-50",!a&&"cursor-pointer",o),children:/* @__PURE__ */h("span",{"data-state":l,className:g("pointer-events-none block size-5 translate-x-0 rounded-full shadow transition-transform","border-border bg-background border","data-[state=checked]:bg-primary-foreground data-[state=checked]:translate-x-5 data-[state=checked]:border-transparent")})}),n&&/* @__PURE__ */h("span",{className:"text-sm font-medium",children:n})]})}var ie=["jpg","jpeg","png","webp","heic","tiff","bmp","avif"],ne=["mp4","webm","ogg","mov","avi","flv","wmv","mkv","3gp","m4v","mpg","mpeg"];function oe({open:e,oversizedUids:t,onClose:r,onRemoveAndUpload:i}){const n=Object.values(t),o=n.filter(e=>"image"===e).length,a=n.filter(e=>"video"===e).length,s=[];return o>0&&s.push(`${o} image${o>1?"s":""}`),a>0&&s.push(`${a} video${a>1?"s":""}`),/* @__PURE__ */h(X,{open:e,onOpenChange:e=>!e&&r(),children:/* @__PURE__ */h(V,{children:[/* @__PURE__ */h(B,{children:[/* @__PURE__ */h(W,{children:"Some files are too large"}),/* @__PURE__ */h(G,{children:[s.join(" and ")," exceed",1===n.length?"s":""," the size limit (25 MB for images, 250 MB for videos) and won't be uploaded."]})]}),/* @__PURE__ */h(H,{children:/* @__PURE__ */h(N,{onClick:i,children:"Remove and Upload"})})]})})}function ae({open:e,count:t,onResume:r,onDiscard:i}){/* @__PURE__ */
3
3
  return h(X,{open:e,onOpenChange:e=>!e&&i(),children:/* @__PURE__ */h(V,{children:[/* @__PURE__ */h(B,{children:[/* @__PURE__ */h(W,{children:"Resume your upload?"}),/* @__PURE__ */h(G,{children:["We found ",t," unfinished upload",t>1?"s":""," from your last visit. Resume where you left off, or remove ",t>1?"them":"it"," and start over."]})]}),/* @__PURE__ */h(H,{children:[/* @__PURE__ */h(N,{variant:"outlined",onClick:i,children:"Remove All"}),/* @__PURE__ */h(N,{onClick:r,children:"Resume"})]})]})})}var se=["6a385dabb04f4d8783b14fe1","69ada0f82889f080a9ca53df"],le=({open:e,onClose:t,onSuccess:r})=>{const{t:i}=I(),[n,o]=l(!1),a=f(),s=a.props?.organizationId??a.organization?._id,{user:d,updateUser:c}=a,u=!!s&&se.includes(s.trim()),p=u?"https://qrati.com/terms-of-use-wedding-private-events":"https://qrati.com/terms-of-use",m=u?"https://qrati.com/privacy-policy-wedding-private-events":"https://qrati.com/privacy-policy";/* @__PURE__ */
4
4
  return h(X,{open:e,onOpenChange:e=>!e&&t(),children:/* @__PURE__ */h(V,{children:/* @__PURE__ */h("div",{className:"mx-auto max-w-sm p-4 text-center sm:max-w-lg",children:[
@@ -10,7 +10,7 @@ return h(X,{open:e,onOpenChange:e=>!e&&t(),children:/* @__PURE__ */h(V,{children
10
10
  /* @__PURE__ */h(N,{fullWidth:!0,color:"success",disabled:n,loading:n,onClick:async()=>{o(!0);try{const e=await v.post(y.ACCEPT_TERMS,{headers:{"x-org-id":s,Authorization:d?.token?`Bearer ${d.token}`:void 0}}).json();if(e.error)throw new Error(e.error);await c({tcAccepted:!0}),o(!1),r()}catch(e){console.error("Error accepting terms:",e),R.error(i("upload.accept_failed","Failed to accept terms"))}o(!1)},children:i("button.accept","Accept")})]})})})},de=({event:e,locationState:t})=>{const{t:r}=I();/* @__PURE__ */
11
11
  return h("div",{className:"mx-auto mt-24 w-fit max-w-xl space-y-8",children:[
12
12
  /* @__PURE__ */h(E,{variant:"h3",align:"center",children:r("upload.event_closed","Upload Closed")}),
13
- /* @__PURE__ */h(E,{variant:"h5",align:"center",color:"muted",children:r("upload.closed_description","This event is no longer accepting uploads.")}),e?.status!==w.CLOSED&&/* @__PURE__ */h("div",{className:"flex flex-row justify-end",children:/* @__PURE__ */h(k,{to:S.PUBLIC_EVENTS,state:t,children:/* @__PURE__ */h(N,{children:r("button.back_to_events","Back to Events")})})})]})};function ce(e,t){let r=0;const i=[],n=()=>{if(r>=e)return;const t=i.shift();t&&t()};return function(e){return new Promise((o,a)=>{i.push(()=>{r++;const i=()=>function(e){let t;return Promise.race([e.finally(()=>clearTimeout(t)),new Promise((e,r)=>{t=setTimeout(()=>r(/* @__PURE__ */new Error("media task timed out")),3e4)})])}(e()).then(o,a).finally(()=>{r--,n()});t?setTimeout(i,0):i()}),n()})}}var ue=ce(2,!1),he=ce(1,!0),pe="error";function me(e){try{const t=JSON.stringify(e);fetch(y.REPORT_ERROR,{method:"POST",headers:{"Content-Type":"application/json"},body:t,keepalive:!0}).catch(()=>{})}catch{}}function ge(e,t){const r=e instanceof Error?e.message:String(e),i=e instanceof Error?e.stack:void 0;console.error(`[${t?.component??"app"}]`,r,t?.extra??""),me({message:r,stack:i,level:t?.level??pe,component:t?.component,tags:t?.tags,extra:t?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function fe(e,t="info",r){t===pe||"fatal"===t?console.error(`[${r?.component??"app"}]`,e,r?.extra??""):console.warn(`[${r?.component??"app"}]`,e,r?.extra??""),me({message:e,level:t,component:r?.component,tags:r?.tags,extra:r?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function ve(e,t,r,i,n,o,a,s,l,d,c,u,h,p,m,g,f,v,b,y){return w=>{const{data:x,width:S,height:T}=w,C=new Uint8ClampedArray(x.length);for(let F=0;F<x.length;F+=4){const w=x[F],S=x[F+1],T=x[F+2],k=x[F+3];C[F]=Math.min(255,Math.max(0,Math.round(e*w+t*S+r*T+i*k+255*n))),C[F+1]=Math.min(255,Math.max(0,Math.round(o*w+a*S+s*T+l*k+255*d))),C[F+2]=Math.min(255,Math.max(0,Math.round(c*w+u*S+h*T+p*k+255*m))),C[F+3]=Math.min(255,Math.max(0,Math.round(g*w+f*S+v*T+b*k+255*y)))}return new ImageData(C,S,T)}}function be(e,t,r,i){const n=Math.cos(i*Math.PI/180),o=Math.sin(i*Math.PI/180);return{r:(.299+.701*n+.168*o)*e,g:(.587-.587*n+.33*o)*t,b:(.114-.114*n-.497*o)*r}}function ye(e){let t=255,r=0,i=0;for(let n=1;n<e.length;n++){const o=e[n]-e[n-1];o>i&&(i=o,t=e[n],r=e[n-1])}return{low:r,high:t}}var we="\nprecision highp float;\nuniform sampler2D u_image;\nuniform vec4 u_row0; uniform float u_off0;\nuniform vec4 u_row1; uniform float u_off1;\nuniform vec4 u_row2; uniform float u_off2;\nuniform vec4 u_row3; uniform float u_off3;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n gl_FragColor = clamp(vec4(\n dot(u_row0, c) + u_off0,\n dot(u_row1, c) + u_off1,\n dot(u_row2, c) + u_off2,\n dot(u_row3, c) + u_off3\n ), 0.0, 1.0);\n}".trim(),xe=[{id:"underwater-correction",name:"Underwater Color Correction",description:"Restores colors absorbed by water — boosts red channel via histogram normalization",category:"color-correction",analyze(e){const t=function(e,t,r){const i=t*r,n=i/2e3,o=/* @__PURE__ */new Int32Array(256),a=/* @__PURE__ */new Int32Array(256),s=/* @__PURE__ */new Int32Array(256);let l=0,d=0,c=0;for(let M=0;M<e.length;M+=4)l+=e[M],d+=e[M+1],c+=e[M+2];const u=l/i,h=d/i,p=c/i;let m=0,g=u;for(;g<60;){const e=be(u,h,p,m);if(g=e.r+e.g+e.b,m++,m>120){g=60;break}}for(let M=0;M<e.length;M+=4){const t=be(e[M],e[M+1],e[M+2],m);o[Math.min(255,Math.max(0,Math.round(t.r+t.g+t.b)))]++,a[e[M+1]]++,s[e[M+2]]++}const f=[0],v=[0],b=[0];for(let M=0;M<256;M++)o[M]-n<2&&f.push(M),a[M]-n<2&&v.push(M),s[M]-n<2&&b.push(M);f.push(255),v.push(255),b.push(255);const y=ye(f),w=ye(v),x=ye(b),S=256/Math.max(1,y.high-y.low),T=256/Math.max(1,w.high-w.low),C=256/Math.max(1,x.high-x.low),F=-y.low/256*S,k=-w.low/256*T,_=-x.low/256*C,E=be(1,1,1,m);return{rR:E.r*S,rG:E.g*S,rB:E.b*S*1.2,rA:0,rOff:F,gR:0,gG:T,gB:0,gA:0,gOff:k,bR:0,bG:0,bB:C,bA:0,bOff:_,aR:0,aG:0,aB:0,aA:1,aOff:0}}(e.data,e.width,e.height);return{u_row0:[t.rR,t.rG,t.rB,t.rA],u_off0:t.rOff,u_row1:[t.gR,t.gG,t.gB,t.gA],u_off1:t.gOff,u_row2:[t.bR,t.bG,t.bB,t.bA],u_off2:t.bOff,u_row3:[t.aR,t.aG,t.aB,t.aA],u_off3:t.aOff}},fragShader:we,buildCpuTransform(e){const t=e.u_row0,r=e.u_row1,i=e.u_row2,n=e.u_row3;return ve(t[0],t[1],t[2],t[3],e.u_off0,r[0],r[1],r[2],r[3],e.u_off1,i[0],i[1],i[2],i[3],e.u_off2,n[0],n[1],n[2],n[3],e.u_off3)},defaultVariables:{},variableSchema:[]},{id:"vignette",name:"Vignette Effect",description:"Darken image corners for dramatic effect",category:"stylistic",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_vignette_strength;\nuniform float u_vignette_radius;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec2 uv = v_texCoord * 2.0 - 1.0;\n float dist = length(uv);\n float factor = 1.0;\n if (dist > u_vignette_radius) {\n float falloff = max(0.001, 1.414 - u_vignette_radius);\n float t = (dist - u_vignette_radius) / falloff;\n factor = 1.0 - clamp(t * u_vignette_strength, 0.0, 0.8);\n }\n gl_FragColor = vec4(c.rgb * factor, c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_vignette_strength??.5,r=e.u_vignette_radius??.7,i=new Float32Array(4096);for(let n=0;n<64;n++)for(let e=0;e<64;e++){const o=e/63*2-1,a=n/63*2-1,s=Math.sqrt(o*o+a*a);let l=1;if(s>r){const e=Math.max(.001,1.414-r);l=1-Math.min(.8,(s-r)/e*t)}i[64*n+e]=l}return e=>{const{data:t,width:r,height:n}=e,o=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let e=0;e<r;e++){const s=4*(a*r+e),l=Math.round(e/Math.max(1,r-1)*63),d=Math.round(a/Math.max(1,n-1)*63),c=i[64*Math.min(63,d)+Math.min(63,l)];o[s]=Math.round(t[s]*c),o[s+1]=Math.round(t[s+1]*c),o[s+2]=Math.round(t[s+2]*c),o[s+3]=t[s+3]}return new ImageData(o,r,n)}},defaultVariables:{vignette_strength:.5,vignette_radius:.7},variableSchema:[{key:"vignette_strength",type:"number",label:"Vignette strength",min:0,max:1,step:.05,default:.5},{key:"vignette_radius",type:"number",label:"Vignette radius",min:0,max:1,step:.05,default:.7}]},{id:"sepia",name:"Sepia Tone",description:"Apply warm sepia tone for vintage look",category:"stylistic",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_sepia_intensity;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float gray = dot(c.rgb, vec3(0.299, 0.587, 0.114));\n vec3 sepia = vec3(\n min(1.0, gray + 40.0 / 255.0),\n min(1.0, gray + 20.0 / 255.0),\n max(0.0, gray - 30.0 / 255.0)\n );\n gl_FragColor = vec4(mix(c.rgb, sepia, u_sepia_intensity), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_sepia_intensity??.8;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4){const e=r[a],i=r[a+1],n=r[a+2],s=.299*e+.587*i+.114*n,l=Math.min(255,s+40),d=Math.min(255,s+20),c=Math.max(0,s-30);o[a]=Math.round(e*(1-t)+l*t),o[a+1]=Math.round(i*(1-t)+d*t),o[a+2]=Math.round(n*(1-t)+c*t),o[a+3]=r[a+3]}return new ImageData(o,i,n)}},defaultVariables:{sepia_intensity:.8},variableSchema:[{key:"sepia_intensity",type:"number",label:"Sepia intensity",min:0,max:1,step:.05,default:.8}]},{id:"auto-white-balance",name:"Auto White Balance",description:"Grey-world white balance — equalises channel averages from image analysis",category:"color-correction",analyze(e){const t=e.data,r=e.width*e.height;let i=0,n=0,o=0;for(let c=0;c<t.length;c+=4)i+=t[c],n+=t[c+1],o+=t[c+2];const a=i/r,s=n/r,l=o/r,d=(a+s+l)/3;return{u_gain_r:d/Math.max(1,a),u_gain_g:d/Math.max(1,s),u_gain_b:d/Math.max(1,l)}},fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_gain_r;\nuniform float u_gain_g;\nuniform float u_gain_b;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(\n clamp(c.r * u_gain_r, 0.0, 1.0),\n clamp(c.g * u_gain_g, 0.0, 1.0),\n clamp(c.b * u_gain_b, 0.0, 1.0),\n c.a\n );\n}".trim(),buildCpuTransform:e=>ve(e.u_gain_r??1,0,0,0,0,0,e.u_gain_g??1,0,0,0,0,0,e.u_gain_b??1,0,0,0,0,0,1,0),defaultVariables:{},variableSchema:[]},{id:"grayscale",name:"Black & White",description:"Convert image to grayscale using luminance weights",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float gray = dot(c.rgb, vec3(0.299, 0.587, 0.114));\n gl_FragColor = vec4(vec3(gray), c.a);\n}".trim(),buildCpuTransform:()=>e=>{const{data:t,width:r,height:i}=e,n=new Uint8ClampedArray(t.length);for(let o=0;o<t.length;o+=4){const e=.299*t[o]+.587*t[o+1]+.114*t[o+2];n[o]=n[o+1]=n[o+2]=Math.round(e),n[o+3]=t[o+3]}return new ImageData(n,r,i)},defaultVariables:{},variableSchema:[]},{id:"invert",name:"Invert Colors",description:"Invert all color channels for a negative effect",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(1.0 - c.rgb, c.a);\n}".trim(),buildCpuTransform:()=>e=>{const{data:t,width:r,height:i}=e,n=new Uint8ClampedArray(t.length);for(let o=0;o<t.length;o+=4)n[o]=255-t[o],n[o+1]=255-t[o+1],n[o+2]=255-t[o+2],n[o+3]=t[o+3];return new ImageData(n,r,i)},defaultVariables:{},variableSchema:[]},{id:"brightness-contrast",name:"Brightness & Contrast",description:"Adjust overall brightness and contrast",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_brightness;\nuniform float u_contrast;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec3 col = c.rgb + u_brightness;\n col = (col - 0.5) * u_contrast + 0.5;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_brightness??0,r=e.u_contrast??1;return e=>{const{data:i,width:n,height:o}=e,a=new Uint8ClampedArray(i.length);for(let s=0;s<i.length;s+=4){for(let e=0;e<3;e++){let n=i[s+e]/255+t;n=(n-.5)*r+.5,a[s+e]=Math.min(255,Math.max(0,Math.round(255*n)))}a[s+3]=i[s+3]}return new ImageData(a,n,o)}},defaultVariables:{brightness:0,contrast:1},variableSchema:[{key:"brightness",type:"number",label:"Brightness",min:-.5,max:.5,step:.05,default:0},{key:"contrast",type:"number",label:"Contrast",min:0,max:2,step:.05,default:1}]},{id:"saturation",name:"Saturation",description:"Increase or decrease color saturation",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_saturation;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float gray = dot(c.rgb, vec3(0.299, 0.587, 0.114));\n gl_FragColor = vec4(mix(vec3(gray), c.rgb, u_saturation), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_saturation??1;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4){const e=r[a],i=r[a+1],n=r[a+2],s=.299*e+.587*i+.114*n;o[a]=Math.round(s+(e-s)*t),o[a+1]=Math.round(s+(i-s)*t),o[a+2]=Math.round(s+(n-s)*t),o[a+3]=r[a+3]}return new ImageData(o,i,n)}},defaultVariables:{saturation:1.2},variableSchema:[{key:"saturation",type:"number",label:"Saturation",min:0,max:2,step:.05,default:1.2}]},{id:"hue-rotate",name:"Hue Shift",description:"Rotate the hue of all colors",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_hue_shift;\nvarying vec2 v_texCoord;\n\nvec3 hueShift(vec3 color, float hue) {\n vec3 k = vec3(0.57735, 0.57735, 0.57735);\n float cosAngle = cos(hue);\n float sinAngle = sin(hue);\n return color * cosAngle + cross(k, color) * sinAngle + k * dot(k, color) * (1.0 - cosAngle);\n}\n\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float rad = u_hue_shift * 3.14159265 / 180.0;\n gl_FragColor = vec4(hueShift(c.rgb, rad), c.a);\n}".trim(),buildCpuTransform(e){const t=(e.u_hue_shift??0)*Math.PI/180,r=Math.cos(t),i=Math.sin(t),n=1/Math.sqrt(3);return e=>{const{data:t,width:o,height:a}=e,s=new Uint8ClampedArray(t.length);for(let l=0;l<t.length;l+=4){const e=t[l]/255,o=t[l+1]/255,a=t[l+2]/255,d=n*(e+o+a),c=e*r+n*(a-o)*i+n*d*(1-r),u=o*r+n*(e-a)*i+n*d*(1-r),h=a*r+n*(o-e)*i+n*d*(1-r);s[l]=Math.min(255,Math.max(0,Math.round(255*c))),s[l+1]=Math.min(255,Math.max(0,Math.round(255*u))),s[l+2]=Math.min(255,Math.max(0,Math.round(255*h))),s[l+3]=t[l+3]}return new ImageData(s,o,a)}},defaultVariables:{hue_shift:30},variableSchema:[{key:"hue_shift",type:"number",label:"Hue shift",min:0,max:360,step:5,default:30}]},{id:"gaussian-blur",name:"Soft Blur",description:"Apply a gentle Gaussian-like blur",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_blur_radius;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec2 off = u_blur_radius / u_resolution;\n vec4 sum = texture2D(u_image, v_texCoord) * 0.25;\n sum += texture2D(u_image, v_texCoord + vec2(off.x, 0.0)) * 0.125;\n sum += texture2D(u_image, v_texCoord - vec2(off.x, 0.0)) * 0.125;\n sum += texture2D(u_image, v_texCoord + vec2(0.0, off.y)) * 0.125;\n sum += texture2D(u_image, v_texCoord - vec2(0.0, off.y)) * 0.125;\n sum += texture2D(u_image, v_texCoord + vec2(off.x, off.y)) * 0.0625;\n sum += texture2D(u_image, v_texCoord - vec2(off.x, off.y)) * 0.0625;\n sum += texture2D(u_image, v_texCoord + vec2(off.x, -off.y)) * 0.0625;\n sum += texture2D(u_image, v_texCoord - vec2(off.x, -off.y)) * 0.0625;\n gl_FragColor = sum;\n}".trim(),buildCpuTransform(e){const t=Math.max(1,Math.round(e.u_blur_radius??2)),r=[[0,0],[t,0],[-t,0],[0,t],[0,-t],[t,t],[-t,-t],[t,-t],[-t,t]],i=[.25,.125,.125,.125,.125,.0625,.0625,.0625,.0625];return e=>{const{data:t,width:n,height:o}=e,a=new Uint8ClampedArray(t.length);for(let s=0;s<o;s++)for(let e=0;e<n;e++){let l=0,d=0,c=0,u=0;for(let a=0;a<9;a++){const h=Math.min(n-1,Math.max(0,e+r[a][0])),p=4*(Math.min(o-1,Math.max(0,s+r[a][1]))*n+h),m=i[a];l+=t[p]*m,d+=t[p+1]*m,c+=t[p+2]*m,u+=t[p+3]*m}const h=4*(s*n+e);a[h]=Math.round(l),a[h+1]=Math.round(d),a[h+2]=Math.round(c),a[h+3]=Math.round(u)}return new ImageData(a,n,o)}},defaultVariables:{blur_radius:2},variableSchema:[{key:"blur_radius",type:"number",label:"Blur radius",min:0,max:8,step:.5,default:2}]},{id:"sharpen",name:"Sharpen",description:"Enhance edge detail for a crisper look",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_sharpen_amount;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec2 off = 1.0 / u_resolution;\n vec4 c = texture2D(u_image, v_texCoord);\n vec4 left = texture2D(u_image, v_texCoord + vec2(-off.x, 0.0));\n vec4 right = texture2D(u_image, v_texCoord + vec2(off.x, 0.0));\n vec4 up = texture2D(u_image, v_texCoord + vec2(0.0, off.y));\n vec4 down = texture2D(u_image, v_texCoord + vec2(0.0, -off.y));\n vec4 edge = left + right + up + down - 4.0 * c;\n gl_FragColor = vec4(clamp(c.rgb - edge.rgb * u_sharpen_amount, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_sharpen_amount??.8;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length),a=(e,t,o)=>r[4*(Math.min(n-1,Math.max(0,e))*i+Math.min(i-1,Math.max(0,t)))+o];for(let s=0;s<n;s++)for(let e=0;e<i;e++){const n=4*(s*i+e);for(let i=0;i<3;i++){const l=r[n+i],d=a(s,e-1,i)+a(s,e+1,i)+a(s+1,e,i)+a(s-1,e,i)-4*l;o[n+i]=Math.min(255,Math.max(0,Math.round(l-d*t)))}o[n+3]=r[n+3]}return new ImageData(o,i,n)}},defaultVariables:{sharpen_amount:.8},variableSchema:[{key:"sharpen_amount",type:"number",label:"Sharpen amount",min:0,max:3,step:.1,default:.8}]},{id:"edge-detect",name:"Edge Detect",description:"Highlight edges using gradient detection",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_edge_intensity;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec2 off = 1.0 / u_resolution;\n vec4 c = texture2D(u_image, v_texCoord);\n vec4 left = texture2D(u_image, v_texCoord + vec2(-off.x, 0.0));\n vec4 right = texture2D(u_image, v_texCoord + vec2(off.x, 0.0));\n vec4 up = texture2D(u_image, v_texCoord + vec2(0.0, off.y));\n vec4 down = texture2D(u_image, v_texCoord + vec2(0.0, -off.y));\n vec3 edge = abs(left.rgb - right.rgb) + abs(up.rgb - down.rgb);\n float gray = dot(edge, vec3(0.299, 0.587, 0.114));\n vec3 result = mix(c.rgb, vec3(gray), u_edge_intensity);\n gl_FragColor = vec4(result, c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_edge_intensity??1;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length),a=(e,t,o)=>r[4*(Math.min(n-1,Math.max(0,e))*i+Math.min(i-1,Math.max(0,t)))+o]/255;for(let s=0;s<n;s++)for(let e=0;e<i;e++){const n=4*(s*i+e),l=.299*(Math.abs(a(s,e-1,0)-a(s,e+1,0))+Math.abs(a(s+1,e,0)-a(s-1,e,0)))+.587*(Math.abs(a(s,e-1,1)-a(s,e+1,1))+Math.abs(a(s+1,e,1)-a(s-1,e,1)))+.114*(Math.abs(a(s,e-1,2)-a(s,e+1,2))+Math.abs(a(s+1,e,2)-a(s-1,e,2)));for(let e=0;e<3;e++){const i=r[n+e]/255;o[n+e]=Math.min(255,Math.max(0,Math.round(255*(i*(1-t)+l*t))))}o[n+3]=r[n+3]}return new ImageData(o,i,n)}},defaultVariables:{edge_intensity:1},variableSchema:[{key:"edge_intensity",type:"number",label:"Edge intensity",min:0,max:1,step:.05,default:1}]},{id:"warm-tone",name:"Warm Tone",description:"Add warm orange-yellow tones",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_warmth;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec3 warm = c.rgb + vec3(0.08, 0.03, -0.05) * u_warmth;\n gl_FragColor = vec4(clamp(warm, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_warmth??.5;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4)o[a]=Math.min(255,Math.max(0,Math.round(r[a]+20.4*t))),o[a+1]=Math.min(255,Math.max(0,Math.round(r[a+1]+7.65*t))),o[a+2]=Math.min(255,Math.max(0,Math.round(r[a+2]-12.75*t))),o[a+3]=r[a+3];return new ImageData(o,i,n)}},defaultVariables:{warmth:.5},variableSchema:[{key:"warmth",type:"number",label:"Warmth",min:0,max:1,step:.05,default:.5}]},{id:"cool-tone",name:"Cool Tone",description:"Add cool blue-cyan tones",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_coolness;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec3 cool = c.rgb + vec3(-0.05, 0.02, 0.08) * u_coolness;\n gl_FragColor = vec4(clamp(cool, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_coolness??.5;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4)o[a]=Math.min(255,Math.max(0,Math.round(r[a]-12.75*t))),o[a+1]=Math.min(255,Math.max(0,Math.round(r[a+1]+5.1*t))),o[a+2]=Math.min(255,Math.max(0,Math.round(r[a+2]+20.4*t))),o[a+3]=r[a+3];return new ImageData(o,i,n)}},defaultVariables:{coolness:.5},variableSchema:[{key:"coolness",type:"number",label:"Coolness",min:0,max:1,step:.05,default:.5}]},{id:"custom-script",name:"Custom Shader",description:"Write a custom GLSL fragment shader",category:"custom",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\nvoid main() {\n // Your custom shader here.\n // Example — invert colours:\n // vec4 c = texture2D(u_image, v_texCoord);\n // gl_FragColor = vec4(1.0 - c.rgb, c.a);\n gl_FragColor = texture2D(u_image, v_texCoord);\n}".trim(),defaultVariables:{},variableSchema:[]}],Se="\nattribute vec2 a_position;\nvarying vec2 v_texCoord;\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_position * 0.5 + 0.5;\n}".trim(),Te=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),Ce=null,Fe=null,ke=null;function _e(e,t,r){const i=e.createShader(t);if(!i)return null;if(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){const r=e.getShaderInfoLog(i);return console.warn("[webgl-filter] shader error:",r),ge(/* @__PURE__ */new Error(`WebGL shader compilation failed: ${r}`),{component:"webgl-filter-engine",tags:["uploadv2","filter","webgl","shader"],extra:{shaderType:t===e.VERTEX_SHADER?"vertex":"fragment"}}),e.deleteShader(i),null}return i}function Ee(e,t){const r=_e(e,e.VERTEX_SHADER,Se),i=_e(e,e.FRAGMENT_SHADER,t);if(!r||!i)return e.deleteShader(r),e.deleteShader(i),null;const n=e.createProgram();if(e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),e.deleteShader(r),e.deleteShader(i),!e.getProgramParameter(n,e.LINK_STATUS)){const r=e.getProgramInfoLog(n);return console.warn("[webgl-filter] link error:",r),ge(/* @__PURE__ */new Error(`WebGL program link failed: ${r}`),{component:"webgl-filter-engine",tags:["uploadv2","filter","webgl","link"],extra:{fragmentLength:t.length}}),e.deleteProgram(n),null}return n}function Me(e){const t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),t}function Ue(e,t,r){const i=Me(e);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null);const n=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.bindFramebuffer(e.FRAMEBUFFER,null),{fbo:n,tex:i}}function Re(e,t,r){for(const[i,n]of Object.entries(r)){const r=e.getUniformLocation(t,i);if(r)if("number"!=typeof n)switch(n.length){case 2:e.uniform2fv(r,n);break;case 3:e.uniform3fv(r,n);break;case 4:e.uniform4fv(r,n)}else e.uniform1f(r,n)}}function Ie(e){const t=e.config,r=t?.templateId,i=t?.fragShader;if(r){const e=(n=r,xe.find(e=>e.id===n));return{def:e??null,fragShader:e?.fragShader??null}}var n;return i?{def:null,fragShader:i}:{def:null,fragShader:null}}function Pe(e){const t=e.config?.variables??{},r={};for(const[i,n]of Object.entries(t))"number"==typeof n&&(r[`u_${i}`]=n);return r}async function Ne(e,t,r,i="image/webp",n=.85){const o=Date.now(),a=t.filter(e=>e.enabled);if(!a.length)return{blob:e,appliedFilters:[],width:0,height:0,processingTime:0};const s=await createImageBitmap(e);let l=s.width,d=s.height;if(l>r||d>r){const e=Math.min(r/l,r/d);l=Math.round(l*e),d=Math.round(d*e)}const c=Math.min(150,l),u=Math.max(1,Math.round(c*d/l)),h=new OffscreenCanvas(c,u).getContext("2d");h.drawImage(s,0,0,c,u);const p=h.getImageData(0,0,c,u);let m;if(s.width!==l||s.height!==d){const e=new OffscreenCanvas(l,d);e.getContext("2d").drawImage(s,0,0,l,d),s.close(),m=await createImageBitmap(e,{imageOrientation:"flipY"})}else m=await createImageBitmap(s,{imageOrientation:"flipY"}),s.close();const g=Ce??new OffscreenCanvas(l,d);g.width===l&&g.height===d||(g.width=l,g.height=d),Ce=g;let f=Fe;if(f||(f=g.getContext("webgl",{preserveDrawingBuffer:!0,alpha:!0})||g.getContext("experimental-webgl",{preserveDrawingBuffer:!0,alpha:!0}),Fe=f),!f||f.isContextLost())return m.close(),Fe=null,Ce=null,async function(e,t,r,i,n,o,a="image/webp",s=.85){const l=new OffscreenCanvas(r,i),d=l.getContext("2d"),c=await createImageBitmap(e);d.drawImage(c,0,0,r,i),c.close();const u=[];for(const h of t){const{def:e}=Ie(h);if(!e?.buildCpuTransform)continue;const t=e.analyze?e.analyze(n,h.config?.variables??{}):{},o={},a=h.config?.variables??{};for(const[r,i]of Object.entries(a))"number"==typeof i&&(o[`u_${r}`]=i);const s=e.buildCpuTransform({...t,...o},r,i),l=d.getImageData(0,0,r,i);d.putImageData(s(l),0,0),u.push(h.id)}return u.length?{blob:await l.convertToBlob({type:a,quality:s}),appliedFilters:u,width:r,height:i,processingTime:Date.now()-o}:{blob:e,appliedFilters:[],width:r,height:i,processingTime:Date.now()-o}}(e,a,l,d,p,o,i,n);const v=Me(f);f.bindTexture(f.TEXTURE_2D,v),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,m),m.close(),f.viewport(0,0,l,d);const b=[Ue(f,l,d),Ue(f,l,d)],y=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,y),f.bufferData(f.ARRAY_BUFFER,Te,f.STATIC_DRAW);const w=ke??/* @__PURE__ */new Map;ke=w;const x=[];let S=v,T=0;try{for(let e=0;e<a.length;e++){const t=a[e],r=e===a.length-1,{def:i,fragShader:n}=Ie(t);if(!n)continue;const o=t.config?.templateId??n;w.has(o)||w.set(o,Ee(f,n));const s=w.get(o);if(!s)continue;f.useProgram(s);const c=f.getAttribLocation(s,"a_position");f.bindBuffer(f.ARRAY_BUFFER,y),f.enableVertexAttribArray(c),f.vertexAttribPointer(c,2,f.FLOAT,!1,0,0),f.activeTexture(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,S),f.uniform1i(f.getUniformLocation(s,"u_image"),0);const u=f.getUniformLocation(s,"u_resolution");if(u&&f.uniform2f(u,l,d),Re(f,s,Pe(t)),i?.analyze&&Re(f,s,i.analyze(p,t.config?.variables??{})),r)f.bindFramebuffer(f.FRAMEBUFFER,null),f.drawArrays(f.TRIANGLES,0,6);else{const e=b[T];f.bindFramebuffer(f.FRAMEBUFFER,e.fbo),f.drawArrays(f.TRIANGLES,0,6),S=e.tex,T=1-T}x.push(t.id)}return x.length?{blob:await g.convertToBlob({type:i,quality:n}),appliedFilters:x,width:l,height:d,processingTime:Date.now()-o}:{blob:e,appliedFilters:[],width:l,height:d,processingTime:Date.now()-o}}finally{for(const{fbo:e,tex:t}of b)f.deleteFramebuffer(e),f.deleteTexture(t);f.deleteTexture(v),f.deleteBuffer(y)}}async function qe(e,t,r,i){const n=Date.now(),o=e.filter(e=>e.enabled),a=e=>e;if(!o.length)return{transform:a,appliedFilters:[],processingTime:0};let s=null;try{const e=await createImageBitmap(t),r=Math.min(64,e.width),i=Math.round(r*e.height/e.width),n=new OffscreenCanvas(r,Math.max(1,i)).getContext("2d");n.drawImage(e,0,0,r,Math.max(1,i)),e.close(),s=n.getImageData(0,0,r,Math.max(1,i))}catch{}const l=[],d=[];for(const u of o){const{def:e}=Ie(u);if(!e?.buildCpuTransform)continue;const t=u.config?.variables??{},n=e.analyze&&s?e.analyze(s,t):{},o={};for(const[r,i]of Object.entries(t))"number"==typeof i&&(o[`u_${r}`]=i);try{const t=e.buildCpuTransform({...n,...o},r,i);l.push(t),d.push(u.id)}catch(c){console.warn(`[webgl-filter] buildCpuTransform failed for ${u.id}:`,c),ge(c instanceof Error?c:/* @__PURE__ */new Error(`buildCpuTransform failed for ${u.id}`),{component:"webgl-filter-engine",tags:["uploadv2","filter","cpu-transform"],extra:{filterId:u.id}})}}return l.length?{transform:1===l.length?l[0]:e=>l.reduce((e,t)=>t(e),e),appliedFilters:d,processingTime:Date.now()-n}:{transform:a,appliedFilters:[],processingTime:Date.now()-n}}var Oe=800;async function Ae(e){return new Promise((t,r)=>{const i=new FileReader;i.onload=()=>t(i.result),i.onerror=()=>r(/* @__PURE__ */new Error("FileReader failed")),i.readAsDataURL(e)})}async function De(e,t){const r=Date.now(),i=t.filter(e=>e.enabled),n=await D(e);let o,a;const s=await createImageBitmap(n,{resizeWidth:Oe});if(o=s.width,a=s.height,a>Oe){const e=Oe/a;o=Math.round(o*e),a=Oe}const l=new OffscreenCanvas(o,a);l.getContext("2d").drawImage(s,0,0,o,a),s.close();const d=await l.convertToBlob({type:"image/jpeg",quality:.92}),c=await Ae(d);if(!i.length)return{original:c,processed:c,appliedFilters:[],failedFilters:[],totalExecutionTime:Date.now()-r};let u=c;const h=[],p=[];try{const e=await Ne(d,i,Oe,"image/jpeg",.92);e.appliedFilters.length>0&&(u=await Ae(e.blob),h.push(...e.appliedFilters));for(const t of i)e.appliedFilters.includes(t.id)||p.push({id:t.id,error:"Filter not applied"})}catch(m){for(const e of i)p.push({id:e.id,error:m instanceof Error?m.message:"Unknown error"});ge(m instanceof Error?m:/* @__PURE__ */new Error("Filter preview failed"),{component:"client-filter-engine",tags:["uploadv2","filter-preview","webgl"],extra:{filterCount:i.length,failedFilters:p.map(e=>e.id)}})}return{original:c,processed:u,appliedFilters:h,failedFilters:p,totalExecutionTime:Date.now()-r}}function Le({label:e,info:t,className:r,error:i,disabled:n,id:o,...a}){const l=s(),d=o??l,c=[t?`${d}-info`:null,i?`${d}-error`:null].filter(Boolean);/* @__PURE__ */
13
+ /* @__PURE__ */h(E,{variant:"h5",align:"center",color:"muted",children:r("upload.closed_description","This event is no longer accepting uploads.")}),e?.status!==w.CLOSED&&/* @__PURE__ */h("div",{className:"flex flex-row justify-end",children:/* @__PURE__ */h(k,{to:S.PUBLIC_EVENTS,state:t,children:/* @__PURE__ */h(N,{children:r("button.back_to_events","Back to Events")})})})]})};function ce(e,t){let r=0;const i=[],n=()=>{if(r>=e)return;const t=i.shift();t&&t()};return function(e){return new Promise((o,a)=>{i.push(()=>{r++;const i=()=>function(e){let t;return Promise.race([e.finally(()=>clearTimeout(t)),new Promise((e,r)=>{t=setTimeout(()=>r(/* @__PURE__ */new Error("media task timed out")),3e4)})])}(e()).then(o,a).finally(()=>{r--,n()});t?setTimeout(i,0):i()}),n()})}}var ue=ce(2,!1),he=ce(1,!0),pe="error";function me(e){try{const t=JSON.stringify(e);fetch(y.REPORT_ERROR,{method:"POST",headers:{"Content-Type":"application/json"},body:t,keepalive:!0}).catch(()=>{})}catch{}}function ge(e,t){const r=e instanceof Error?e.message:String(e),i=e instanceof Error?e.stack:void 0;console.error(`[${t?.component??"app"}]`,r,t?.extra??""),me({message:r,stack:i,level:t?.level??pe,component:t?.component,tags:t?.tags,extra:t?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function fe(e,t="info",r){t===pe||"fatal"===t?console.error(`[${r?.component??"app"}]`,e,r?.extra??""):console.warn(`[${r?.component??"app"}]`,e,r?.extra??""),me({message:e,level:t,component:r?.component,tags:r?.tags,extra:r?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function ve(e,t,r,i,n,o,a,s,l,d,c,u,h,p,m,g,f,v,b,y){return w=>{const{data:x,width:S,height:T}=w,C=new Uint8ClampedArray(x.length);for(let F=0;F<x.length;F+=4){const w=x[F],S=x[F+1],T=x[F+2],k=x[F+3];C[F]=Math.min(255,Math.max(0,Math.round(e*w+t*S+r*T+i*k+255*n))),C[F+1]=Math.min(255,Math.max(0,Math.round(o*w+a*S+s*T+l*k+255*d))),C[F+2]=Math.min(255,Math.max(0,Math.round(c*w+u*S+h*T+p*k+255*m))),C[F+3]=Math.min(255,Math.max(0,Math.round(g*w+f*S+v*T+b*k+255*y)))}return new ImageData(C,S,T)}}function be(e,t,r,i){const n=Math.cos(i*Math.PI/180),o=Math.sin(i*Math.PI/180);return{r:(.299+.701*n+.168*o)*e,g:(.587-.587*n+.33*o)*t,b:(.114-.114*n-.497*o)*r}}function ye(e){let t=255,r=0,i=0;for(let n=1;n<e.length;n++){const o=e[n]-e[n-1];o>i&&(i=o,t=e[n],r=e[n-1])}return{low:r,high:t}}var we="\nprecision highp float;\nuniform sampler2D u_image;\nuniform vec4 u_row0; uniform float u_off0;\nuniform vec4 u_row1; uniform float u_off1;\nuniform vec4 u_row2; uniform float u_off2;\nuniform vec4 u_row3; uniform float u_off3;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n gl_FragColor = clamp(vec4(\n dot(u_row0, c) + u_off0,\n dot(u_row1, c) + u_off1,\n dot(u_row2, c) + u_off2,\n dot(u_row3, c) + u_off3\n ), 0.0, 1.0);\n}".trim(),xe=[{id:"underwater-correction",name:"Underwater Color Correction",description:"Restores colors absorbed by water — boosts red channel via histogram normalization",category:"color-correction",analyze(e){const t=function(e,t,r){const i=t*r,n=i/2e3,o=/* @__PURE__ */new Int32Array(256),a=/* @__PURE__ */new Int32Array(256),s=/* @__PURE__ */new Int32Array(256);let l=0,d=0,c=0;for(let M=0;M<e.length;M+=4)l+=e[M],d+=e[M+1],c+=e[M+2];const u=l/i,h=d/i,p=c/i;let m=0,g=u;for(;g<60;){const e=be(u,h,p,m);if(g=e.r+e.g+e.b,m++,m>120){g=60;break}}for(let M=0;M<e.length;M+=4){const t=be(e[M],e[M+1],e[M+2],m);o[Math.min(255,Math.max(0,Math.round(t.r+t.g+t.b)))]++,a[e[M+1]]++,s[e[M+2]]++}const f=[0],v=[0],b=[0];for(let M=0;M<256;M++)o[M]-n<2&&f.push(M),a[M]-n<2&&v.push(M),s[M]-n<2&&b.push(M);f.push(255),v.push(255),b.push(255);const y=ye(f),w=ye(v),x=ye(b),S=256/Math.max(1,y.high-y.low),T=256/Math.max(1,w.high-w.low),C=256/Math.max(1,x.high-x.low),F=-y.low/256*S,k=-w.low/256*T,_=-x.low/256*C,E=be(1,1,1,m);return{rR:E.r*S,rG:E.g*S,rB:E.b*S*1.2,rA:0,rOff:F,gR:0,gG:T,gB:0,gA:0,gOff:k,bR:0,bG:0,bB:C,bA:0,bOff:_,aR:0,aG:0,aB:0,aA:1,aOff:0}}(e.data,e.width,e.height);return{u_row0:[t.rR,t.rG,t.rB,t.rA],u_off0:t.rOff,u_row1:[t.gR,t.gG,t.gB,t.gA],u_off1:t.gOff,u_row2:[t.bR,t.bG,t.bB,t.bA],u_off2:t.bOff,u_row3:[t.aR,t.aG,t.aB,t.aA],u_off3:t.aOff}},fragShader:we,buildCpuTransform(e){const t=e.u_row0,r=e.u_row1,i=e.u_row2,n=e.u_row3;return ve(t[0],t[1],t[2],t[3],e.u_off0,r[0],r[1],r[2],r[3],e.u_off1,i[0],i[1],i[2],i[3],e.u_off2,n[0],n[1],n[2],n[3],e.u_off3)},defaultVariables:{},variableSchema:[]},{id:"vignette",name:"Vignette Effect",description:"Darken image corners for dramatic effect",category:"stylistic",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_vignette_strength;\nuniform float u_vignette_radius;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec2 uv = v_texCoord * 2.0 - 1.0;\n float dist = length(uv);\n float factor = 1.0;\n if (dist > u_vignette_radius) {\n float falloff = max(0.001, 1.414 - u_vignette_radius);\n float t = (dist - u_vignette_radius) / falloff;\n factor = 1.0 - clamp(t * u_vignette_strength, 0.0, 0.8);\n }\n gl_FragColor = vec4(c.rgb * factor, c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_vignette_strength??.5,r=e.u_vignette_radius??.7,i=new Float32Array(4096);for(let n=0;n<64;n++)for(let e=0;e<64;e++){const o=e/63*2-1,a=n/63*2-1,s=Math.sqrt(o*o+a*a);let l=1;if(s>r){const e=Math.max(.001,1.414-r);l=1-Math.min(.8,(s-r)/e*t)}i[64*n+e]=l}return e=>{const{data:t,width:r,height:n}=e,o=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let e=0;e<r;e++){const s=4*(a*r+e),l=Math.round(e/Math.max(1,r-1)*63),d=Math.round(a/Math.max(1,n-1)*63),c=i[64*Math.min(63,d)+Math.min(63,l)];o[s]=Math.round(t[s]*c),o[s+1]=Math.round(t[s+1]*c),o[s+2]=Math.round(t[s+2]*c),o[s+3]=t[s+3]}return new ImageData(o,r,n)}},defaultVariables:{vignette_strength:.5,vignette_radius:.7},variableSchema:[{key:"vignette_strength",type:"number",label:"Vignette strength",min:0,max:1,step:.05,default:.5},{key:"vignette_radius",type:"number",label:"Vignette radius",min:0,max:1,step:.05,default:.7}]},{id:"sepia",name:"Sepia Tone",description:"Apply warm sepia tone for vintage look",category:"stylistic",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_sepia_intensity;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float gray = dot(c.rgb, vec3(0.299, 0.587, 0.114));\n vec3 sepia = vec3(\n min(1.0, gray + 40.0 / 255.0),\n min(1.0, gray + 20.0 / 255.0),\n max(0.0, gray - 30.0 / 255.0)\n );\n gl_FragColor = vec4(mix(c.rgb, sepia, u_sepia_intensity), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_sepia_intensity??.8;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4){const e=r[a],i=r[a+1],n=r[a+2],s=.299*e+.587*i+.114*n,l=Math.min(255,s+40),d=Math.min(255,s+20),c=Math.max(0,s-30);o[a]=Math.round(e*(1-t)+l*t),o[a+1]=Math.round(i*(1-t)+d*t),o[a+2]=Math.round(n*(1-t)+c*t),o[a+3]=r[a+3]}return new ImageData(o,i,n)}},defaultVariables:{sepia_intensity:.8},variableSchema:[{key:"sepia_intensity",type:"number",label:"Sepia intensity",min:0,max:1,step:.05,default:.8}]},{id:"auto-white-balance",name:"Auto White Balance",description:"Grey-world white balance — equalises channel averages from image analysis",category:"color-correction",analyze(e){const t=e.data,r=e.width*e.height;let i=0,n=0,o=0;for(let c=0;c<t.length;c+=4)i+=t[c],n+=t[c+1],o+=t[c+2];const a=i/r,s=n/r,l=o/r,d=(a+s+l)/3;return{u_gain_r:d/Math.max(1,a),u_gain_g:d/Math.max(1,s),u_gain_b:d/Math.max(1,l)}},fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_gain_r;\nuniform float u_gain_g;\nuniform float u_gain_b;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(\n clamp(c.r * u_gain_r, 0.0, 1.0),\n clamp(c.g * u_gain_g, 0.0, 1.0),\n clamp(c.b * u_gain_b, 0.0, 1.0),\n c.a\n );\n}".trim(),buildCpuTransform:e=>ve(e.u_gain_r??1,0,0,0,0,0,e.u_gain_g??1,0,0,0,0,0,e.u_gain_b??1,0,0,0,0,0,1,0),defaultVariables:{},variableSchema:[]},{id:"grayscale",name:"Black & White",description:"Convert image to grayscale using luminance weights",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float gray = dot(c.rgb, vec3(0.299, 0.587, 0.114));\n gl_FragColor = vec4(vec3(gray), c.a);\n}".trim(),buildCpuTransform:()=>e=>{const{data:t,width:r,height:i}=e,n=new Uint8ClampedArray(t.length);for(let o=0;o<t.length;o+=4){const e=.299*t[o]+.587*t[o+1]+.114*t[o+2];n[o]=n[o+1]=n[o+2]=Math.round(e),n[o+3]=t[o+3]}return new ImageData(n,r,i)},defaultVariables:{},variableSchema:[]},{id:"invert",name:"Invert Colors",description:"Invert all color channels for a negative effect",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(1.0 - c.rgb, c.a);\n}".trim(),buildCpuTransform:()=>e=>{const{data:t,width:r,height:i}=e,n=new Uint8ClampedArray(t.length);for(let o=0;o<t.length;o+=4)n[o]=255-t[o],n[o+1]=255-t[o+1],n[o+2]=255-t[o+2],n[o+3]=t[o+3];return new ImageData(n,r,i)},defaultVariables:{},variableSchema:[]},{id:"brightness-contrast",name:"Brightness & Contrast",description:"Adjust overall brightness and contrast",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_brightness;\nuniform float u_contrast;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec3 col = c.rgb + u_brightness;\n col = (col - 0.5) * u_contrast + 0.5;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_brightness??0,r=e.u_contrast??1;return e=>{const{data:i,width:n,height:o}=e,a=new Uint8ClampedArray(i.length);for(let s=0;s<i.length;s+=4){for(let e=0;e<3;e++){let n=i[s+e]/255+t;n=(n-.5)*r+.5,a[s+e]=Math.min(255,Math.max(0,Math.round(255*n)))}a[s+3]=i[s+3]}return new ImageData(a,n,o)}},defaultVariables:{brightness:0,contrast:1},variableSchema:[{key:"brightness",type:"number",label:"Brightness",min:-.5,max:.5,step:.05,default:0},{key:"contrast",type:"number",label:"Contrast",min:0,max:2,step:.05,default:1}]},{id:"saturation",name:"Saturation",description:"Increase or decrease color saturation",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_saturation;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float gray = dot(c.rgb, vec3(0.299, 0.587, 0.114));\n gl_FragColor = vec4(mix(vec3(gray), c.rgb, u_saturation), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_saturation??1;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4){const e=r[a],i=r[a+1],n=r[a+2],s=.299*e+.587*i+.114*n;o[a]=Math.round(s+(e-s)*t),o[a+1]=Math.round(s+(i-s)*t),o[a+2]=Math.round(s+(n-s)*t),o[a+3]=r[a+3]}return new ImageData(o,i,n)}},defaultVariables:{saturation:1.2},variableSchema:[{key:"saturation",type:"number",label:"Saturation",min:0,max:2,step:.05,default:1.2}]},{id:"hue-rotate",name:"Hue Shift",description:"Rotate the hue of all colors",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_hue_shift;\nvarying vec2 v_texCoord;\n\nvec3 hueShift(vec3 color, float hue) {\n vec3 k = vec3(0.57735, 0.57735, 0.57735);\n float cosAngle = cos(hue);\n float sinAngle = sin(hue);\n return color * cosAngle + cross(k, color) * sinAngle + k * dot(k, color) * (1.0 - cosAngle);\n}\n\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n float rad = u_hue_shift * 3.14159265 / 180.0;\n gl_FragColor = vec4(hueShift(c.rgb, rad), c.a);\n}".trim(),buildCpuTransform(e){const t=(e.u_hue_shift??0)*Math.PI/180,r=Math.cos(t),i=Math.sin(t),n=1/Math.sqrt(3);return e=>{const{data:t,width:o,height:a}=e,s=new Uint8ClampedArray(t.length);for(let l=0;l<t.length;l+=4){const e=t[l]/255,o=t[l+1]/255,a=t[l+2]/255,d=n*(e+o+a),c=e*r+n*(a-o)*i+n*d*(1-r),u=o*r+n*(e-a)*i+n*d*(1-r),h=a*r+n*(o-e)*i+n*d*(1-r);s[l]=Math.min(255,Math.max(0,Math.round(255*c))),s[l+1]=Math.min(255,Math.max(0,Math.round(255*u))),s[l+2]=Math.min(255,Math.max(0,Math.round(255*h))),s[l+3]=t[l+3]}return new ImageData(s,o,a)}},defaultVariables:{hue_shift:30},variableSchema:[{key:"hue_shift",type:"number",label:"Hue shift",min:0,max:360,step:5,default:30}]},{id:"gaussian-blur",name:"Soft Blur",description:"Apply a gentle Gaussian-like blur",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_blur_radius;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec2 off = u_blur_radius / u_resolution;\n vec4 sum = texture2D(u_image, v_texCoord) * 0.25;\n sum += texture2D(u_image, v_texCoord + vec2(off.x, 0.0)) * 0.125;\n sum += texture2D(u_image, v_texCoord - vec2(off.x, 0.0)) * 0.125;\n sum += texture2D(u_image, v_texCoord + vec2(0.0, off.y)) * 0.125;\n sum += texture2D(u_image, v_texCoord - vec2(0.0, off.y)) * 0.125;\n sum += texture2D(u_image, v_texCoord + vec2(off.x, off.y)) * 0.0625;\n sum += texture2D(u_image, v_texCoord - vec2(off.x, off.y)) * 0.0625;\n sum += texture2D(u_image, v_texCoord + vec2(off.x, -off.y)) * 0.0625;\n sum += texture2D(u_image, v_texCoord - vec2(off.x, -off.y)) * 0.0625;\n gl_FragColor = sum;\n}".trim(),buildCpuTransform(e){const t=Math.max(1,Math.round(e.u_blur_radius??2)),r=[[0,0],[t,0],[-t,0],[0,t],[0,-t],[t,t],[-t,-t],[t,-t],[-t,t]],i=[.25,.125,.125,.125,.125,.0625,.0625,.0625,.0625];return e=>{const{data:t,width:n,height:o}=e,a=new Uint8ClampedArray(t.length);for(let s=0;s<o;s++)for(let e=0;e<n;e++){let l=0,d=0,c=0,u=0;for(let a=0;a<9;a++){const h=Math.min(n-1,Math.max(0,e+r[a][0])),p=4*(Math.min(o-1,Math.max(0,s+r[a][1]))*n+h),m=i[a];l+=t[p]*m,d+=t[p+1]*m,c+=t[p+2]*m,u+=t[p+3]*m}const h=4*(s*n+e);a[h]=Math.round(l),a[h+1]=Math.round(d),a[h+2]=Math.round(c),a[h+3]=Math.round(u)}return new ImageData(a,n,o)}},defaultVariables:{blur_radius:2},variableSchema:[{key:"blur_radius",type:"number",label:"Blur radius",min:0,max:8,step:.5,default:2}]},{id:"sharpen",name:"Sharpen",description:"Enhance edge detail for a crisper look",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_sharpen_amount;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec2 off = 1.0 / u_resolution;\n vec4 c = texture2D(u_image, v_texCoord);\n vec4 left = texture2D(u_image, v_texCoord + vec2(-off.x, 0.0));\n vec4 right = texture2D(u_image, v_texCoord + vec2(off.x, 0.0));\n vec4 up = texture2D(u_image, v_texCoord + vec2(0.0, off.y));\n vec4 down = texture2D(u_image, v_texCoord + vec2(0.0, -off.y));\n vec4 edge = left + right + up + down - 4.0 * c;\n gl_FragColor = vec4(clamp(c.rgb - edge.rgb * u_sharpen_amount, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_sharpen_amount??.8;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length),a=(e,t,o)=>r[4*(Math.min(n-1,Math.max(0,e))*i+Math.min(i-1,Math.max(0,t)))+o];for(let s=0;s<n;s++)for(let e=0;e<i;e++){const n=4*(s*i+e);for(let i=0;i<3;i++){const l=r[n+i],d=a(s,e-1,i)+a(s,e+1,i)+a(s+1,e,i)+a(s-1,e,i)-4*l;o[n+i]=Math.min(255,Math.max(0,Math.round(l-d*t)))}o[n+3]=r[n+3]}return new ImageData(o,i,n)}},defaultVariables:{sharpen_amount:.8},variableSchema:[{key:"sharpen_amount",type:"number",label:"Sharpen amount",min:0,max:3,step:.1,default:.8}]},{id:"edge-detect",name:"Edge Detect",description:"Highlight edges using gradient detection",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_edge_intensity;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec2 off = 1.0 / u_resolution;\n vec4 c = texture2D(u_image, v_texCoord);\n vec4 left = texture2D(u_image, v_texCoord + vec2(-off.x, 0.0));\n vec4 right = texture2D(u_image, v_texCoord + vec2(off.x, 0.0));\n vec4 up = texture2D(u_image, v_texCoord + vec2(0.0, off.y));\n vec4 down = texture2D(u_image, v_texCoord + vec2(0.0, -off.y));\n vec3 edge = abs(left.rgb - right.rgb) + abs(up.rgb - down.rgb);\n float gray = dot(edge, vec3(0.299, 0.587, 0.114));\n vec3 result = mix(c.rgb, vec3(gray), u_edge_intensity);\n gl_FragColor = vec4(result, c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_edge_intensity??1;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length),a=(e,t,o)=>r[4*(Math.min(n-1,Math.max(0,e))*i+Math.min(i-1,Math.max(0,t)))+o]/255;for(let s=0;s<n;s++)for(let e=0;e<i;e++){const n=4*(s*i+e),l=.299*(Math.abs(a(s,e-1,0)-a(s,e+1,0))+Math.abs(a(s+1,e,0)-a(s-1,e,0)))+.587*(Math.abs(a(s,e-1,1)-a(s,e+1,1))+Math.abs(a(s+1,e,1)-a(s-1,e,1)))+.114*(Math.abs(a(s,e-1,2)-a(s,e+1,2))+Math.abs(a(s+1,e,2)-a(s-1,e,2)));for(let e=0;e<3;e++){const i=r[n+e]/255;o[n+e]=Math.min(255,Math.max(0,Math.round(255*(i*(1-t)+l*t))))}o[n+3]=r[n+3]}return new ImageData(o,i,n)}},defaultVariables:{edge_intensity:1},variableSchema:[{key:"edge_intensity",type:"number",label:"Edge intensity",min:0,max:1,step:.05,default:1}]},{id:"warm-tone",name:"Warm Tone",description:"Add warm orange-yellow tones",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_warmth;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec3 warm = c.rgb + vec3(0.08, 0.03, -0.05) * u_warmth;\n gl_FragColor = vec4(clamp(warm, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_warmth??.5;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4)o[a]=Math.min(255,Math.max(0,Math.round(r[a]+20.4*t))),o[a+1]=Math.min(255,Math.max(0,Math.round(r[a+1]+7.65*t))),o[a+2]=Math.min(255,Math.max(0,Math.round(r[a+2]-12.75*t))),o[a+3]=r[a+3];return new ImageData(o,i,n)}},defaultVariables:{warmth:.5},variableSchema:[{key:"warmth",type:"number",label:"Warmth",min:0,max:1,step:.05,default:.5}]},{id:"cool-tone",name:"Cool Tone",description:"Add cool blue-cyan tones",category:"utility",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform float u_coolness;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec4 c = texture2D(u_image, v_texCoord);\n vec3 cool = c.rgb + vec3(-0.05, 0.02, 0.08) * u_coolness;\n gl_FragColor = vec4(clamp(cool, 0.0, 1.0), c.a);\n}".trim(),buildCpuTransform(e){const t=e.u_coolness??.5;return e=>{const{data:r,width:i,height:n}=e,o=new Uint8ClampedArray(r.length);for(let a=0;a<r.length;a+=4)o[a]=Math.min(255,Math.max(0,Math.round(r[a]-12.75*t))),o[a+1]=Math.min(255,Math.max(0,Math.round(r[a+1]+5.1*t))),o[a+2]=Math.min(255,Math.max(0,Math.round(r[a+2]+20.4*t))),o[a+3]=r[a+3];return new ImageData(o,i,n)}},defaultVariables:{coolness:.5},variableSchema:[{key:"coolness",type:"number",label:"Coolness",min:0,max:1,step:.05,default:.5}]},{id:"custom-script",name:"Custom Shader",description:"Write a custom GLSL fragment shader",category:"custom",fragShader:"\nprecision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_resolution;\nvarying vec2 v_texCoord;\nvoid main() {\n // Your custom shader here.\n // Example — invert colours:\n // vec4 c = texture2D(u_image, v_texCoord);\n // gl_FragColor = vec4(1.0 - c.rgb, c.a);\n gl_FragColor = texture2D(u_image, v_texCoord);\n}".trim(),defaultVariables:{},variableSchema:[]}],Se="\nattribute vec2 a_position;\nvarying vec2 v_texCoord;\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_position * 0.5 + 0.5;\n}".trim(),Te=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),Ce=null,Fe=null,ke=null;function _e(e,t,r){const i=e.createShader(t);if(!i)return null;if(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){const r=e.getShaderInfoLog(i);return console.warn("[webgl-filter] shader error:",r),ge(/* @__PURE__ */new Error(`WebGL shader compilation failed: ${r}`),{component:"webgl-filter-engine",tags:["upload","filter","webgl","shader"],extra:{shaderType:t===e.VERTEX_SHADER?"vertex":"fragment"}}),e.deleteShader(i),null}return i}function Ee(e,t){const r=_e(e,e.VERTEX_SHADER,Se),i=_e(e,e.FRAGMENT_SHADER,t);if(!r||!i)return e.deleteShader(r),e.deleteShader(i),null;const n=e.createProgram();if(e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),e.deleteShader(r),e.deleteShader(i),!e.getProgramParameter(n,e.LINK_STATUS)){const r=e.getProgramInfoLog(n);return console.warn("[webgl-filter] link error:",r),ge(/* @__PURE__ */new Error(`WebGL program link failed: ${r}`),{component:"webgl-filter-engine",tags:["upload","filter","webgl","link"],extra:{fragmentLength:t.length}}),e.deleteProgram(n),null}return n}function Me(e){const t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),t}function Ue(e,t,r){const i=Me(e);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null);const n=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.bindFramebuffer(e.FRAMEBUFFER,null),{fbo:n,tex:i}}function Re(e,t,r){for(const[i,n]of Object.entries(r)){const r=e.getUniformLocation(t,i);if(r)if("number"!=typeof n)switch(n.length){case 2:e.uniform2fv(r,n);break;case 3:e.uniform3fv(r,n);break;case 4:e.uniform4fv(r,n)}else e.uniform1f(r,n)}}function Ie(e){const t=e.config,r=t?.templateId,i=t?.fragShader;if(r){const e=(n=r,xe.find(e=>e.id===n));return{def:e??null,fragShader:e?.fragShader??null}}var n;return i?{def:null,fragShader:i}:{def:null,fragShader:null}}function Pe(e){const t=e.config?.variables??{},r={};for(const[i,n]of Object.entries(t))"number"==typeof n&&(r[`u_${i}`]=n);return r}async function Ne(e,t,r,i="image/webp",n=.85){const o=Date.now(),a=t.filter(e=>e.enabled);if(!a.length)return{blob:e,appliedFilters:[],width:0,height:0,processingTime:0};const s=await createImageBitmap(e);let l=s.width,d=s.height;if(l>r||d>r){const e=Math.min(r/l,r/d);l=Math.round(l*e),d=Math.round(d*e)}const c=Math.min(150,l),u=Math.max(1,Math.round(c*d/l)),h=new OffscreenCanvas(c,u).getContext("2d");h.drawImage(s,0,0,c,u);const p=h.getImageData(0,0,c,u);let m;if(s.width!==l||s.height!==d){const e=new OffscreenCanvas(l,d);e.getContext("2d").drawImage(s,0,0,l,d),s.close(),m=await createImageBitmap(e,{imageOrientation:"flipY"})}else m=await createImageBitmap(s,{imageOrientation:"flipY"}),s.close();const g=Ce??new OffscreenCanvas(l,d);g.width===l&&g.height===d||(g.width=l,g.height=d),Ce=g;let f=Fe;if(f||(f=g.getContext("webgl",{preserveDrawingBuffer:!0,alpha:!0})||g.getContext("experimental-webgl",{preserveDrawingBuffer:!0,alpha:!0}),Fe=f),!f||f.isContextLost())return m.close(),Fe=null,Ce=null,async function(e,t,r,i,n,o,a="image/webp",s=.85){const l=new OffscreenCanvas(r,i),d=l.getContext("2d"),c=await createImageBitmap(e);d.drawImage(c,0,0,r,i),c.close();const u=[];for(const h of t){const{def:e}=Ie(h);if(!e?.buildCpuTransform)continue;const t=e.analyze?e.analyze(n,h.config?.variables??{}):{},o={},a=h.config?.variables??{};for(const[r,i]of Object.entries(a))"number"==typeof i&&(o[`u_${r}`]=i);const s=e.buildCpuTransform({...t,...o},r,i),l=d.getImageData(0,0,r,i);d.putImageData(s(l),0,0),u.push(h.id)}return u.length?{blob:await l.convertToBlob({type:a,quality:s}),appliedFilters:u,width:r,height:i,processingTime:Date.now()-o}:{blob:e,appliedFilters:[],width:r,height:i,processingTime:Date.now()-o}}(e,a,l,d,p,o,i,n);const v=Me(f);f.bindTexture(f.TEXTURE_2D,v),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,m),m.close(),f.viewport(0,0,l,d);const b=[Ue(f,l,d),Ue(f,l,d)],y=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,y),f.bufferData(f.ARRAY_BUFFER,Te,f.STATIC_DRAW);const w=ke??/* @__PURE__ */new Map;ke=w;const x=[];let S=v,T=0;try{for(let e=0;e<a.length;e++){const t=a[e],r=e===a.length-1,{def:i,fragShader:n}=Ie(t);if(!n)continue;const o=t.config?.templateId??n;w.has(o)||w.set(o,Ee(f,n));const s=w.get(o);if(!s)continue;f.useProgram(s);const c=f.getAttribLocation(s,"a_position");f.bindBuffer(f.ARRAY_BUFFER,y),f.enableVertexAttribArray(c),f.vertexAttribPointer(c,2,f.FLOAT,!1,0,0),f.activeTexture(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,S),f.uniform1i(f.getUniformLocation(s,"u_image"),0);const u=f.getUniformLocation(s,"u_resolution");if(u&&f.uniform2f(u,l,d),Re(f,s,Pe(t)),i?.analyze&&Re(f,s,i.analyze(p,t.config?.variables??{})),r)f.bindFramebuffer(f.FRAMEBUFFER,null),f.drawArrays(f.TRIANGLES,0,6);else{const e=b[T];f.bindFramebuffer(f.FRAMEBUFFER,e.fbo),f.drawArrays(f.TRIANGLES,0,6),S=e.tex,T=1-T}x.push(t.id)}return x.length?{blob:await g.convertToBlob({type:i,quality:n}),appliedFilters:x,width:l,height:d,processingTime:Date.now()-o}:{blob:e,appliedFilters:[],width:l,height:d,processingTime:Date.now()-o}}finally{for(const{fbo:e,tex:t}of b)f.deleteFramebuffer(e),f.deleteTexture(t);f.deleteTexture(v),f.deleteBuffer(y)}}async function qe(e,t,r,i){const n=Date.now(),o=e.filter(e=>e.enabled),a=e=>e;if(!o.length)return{transform:a,appliedFilters:[],processingTime:0};let s=null;try{const e=await createImageBitmap(t),r=Math.min(64,e.width),i=Math.round(r*e.height/e.width),n=new OffscreenCanvas(r,Math.max(1,i)).getContext("2d");n.drawImage(e,0,0,r,Math.max(1,i)),e.close(),s=n.getImageData(0,0,r,Math.max(1,i))}catch{}const l=[],d=[];for(const u of o){const{def:e}=Ie(u);if(!e?.buildCpuTransform)continue;const t=u.config?.variables??{},n=e.analyze&&s?e.analyze(s,t):{},o={};for(const[r,i]of Object.entries(t))"number"==typeof i&&(o[`u_${r}`]=i);try{const t=e.buildCpuTransform({...n,...o},r,i);l.push(t),d.push(u.id)}catch(c){console.warn(`[webgl-filter] buildCpuTransform failed for ${u.id}:`,c),ge(c instanceof Error?c:/* @__PURE__ */new Error(`buildCpuTransform failed for ${u.id}`),{component:"webgl-filter-engine",tags:["upload","filter","cpu-transform"],extra:{filterId:u.id}})}}return l.length?{transform:1===l.length?l[0]:e=>l.reduce((e,t)=>t(e),e),appliedFilters:d,processingTime:Date.now()-n}:{transform:a,appliedFilters:[],processingTime:Date.now()-n}}var Oe=800;async function Ae(e){return new Promise((t,r)=>{const i=new FileReader;i.onload=()=>t(i.result),i.onerror=()=>r(/* @__PURE__ */new Error("FileReader failed")),i.readAsDataURL(e)})}async function De(e,t){const r=Date.now(),i=t.filter(e=>e.enabled),n=await D(e);let o,a;const s=await createImageBitmap(n,{resizeWidth:Oe});if(o=s.width,a=s.height,a>Oe){const e=Oe/a;o=Math.round(o*e),a=Oe}const l=new OffscreenCanvas(o,a);l.getContext("2d").drawImage(s,0,0,o,a),s.close();const d=await l.convertToBlob({type:"image/jpeg",quality:.92}),c=await Ae(d);if(!i.length)return{original:c,processed:c,appliedFilters:[],failedFilters:[],totalExecutionTime:Date.now()-r};let u=c;const h=[],p=[];try{const e=await Ne(d,i,Oe,"image/jpeg",.92);e.appliedFilters.length>0&&(u=await Ae(e.blob),h.push(...e.appliedFilters));for(const t of i)e.appliedFilters.includes(t.id)||p.push({id:t.id,error:"Filter not applied"})}catch(m){for(const e of i)p.push({id:e.id,error:m instanceof Error?m.message:"Unknown error"});ge(m instanceof Error?m:/* @__PURE__ */new Error("Filter preview failed"),{component:"client-filter-engine",tags:["upload","filter-preview","webgl"],extra:{filterCount:i.length,failedFilters:p.map(e=>e.id)}})}return{original:c,processed:u,appliedFilters:h,failedFilters:p,totalExecutionTime:Date.now()-r}}function Le({label:e,info:t,className:r,error:i,disabled:n,id:o,...a}){const l=s(),d=o??l,c=[t?`${d}-info`:null,i?`${d}-error`:null].filter(Boolean);/* @__PURE__ */
14
14
  return h("div",{className:"space-y-1.5",children:[e&&/* @__PURE__ */h("label",{htmlFor:d,className:"block text-base font-medium",children:e}),
15
15
  /* @__PURE__ */h("textarea",{id:d,className:g("border-border shadow-card focus:border-primary ring-offset-background focus:ring-primary min-h-12 w-full rounded border px-3 py-2.5 focus:outline-none focus-visible:ring-2","field-sizing-content",n&&"text-muted-foreground bg-transparent",i&&"border-destructive focus-visible:ring-destructive/20",r),disabled:n,"aria-invalid":!!i,"aria-describedby":c.length>0?c.join(" "):void 0,...a}),t&&/* @__PURE__ */h("p",{id:`${d}-info`,className:"text-muted-foreground text-xs",children:t}),i&&/* @__PURE__ */h("p",{id:`${d}-error`,className:"text-destructive text-xs",children:i})]})}var je=e=>{let t;const r=/* @__PURE__ */new Set,i=(e,i)=>{const n="function"==typeof e?e(t):e;if(!Object.is(n,t)){const e=t;t=(null!=i?i:"object"!=typeof n||null===n)?n:Object.assign({},t,n),r.forEach(r=>r(t,e))}},n=()=>t,o={setState:i,getState:n,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(i,n,o);return o},ze=e=>e;var $e=r(null);function Be({children:e,...t}){const r=a(null),i=a(t);return r.current&&t.eventId===i.current.eventId&&t.groupId===i.current.groupId||(r.current=function(e){return(t=t=>({eventId:e.eventId,groupId:e.groupId,selectedFiles:[],originalFiles:{},captions:{},hasStarted:!1,oversizedUids:{},showOversizedModal:!1,trimRanges:{},cropSelections:{},videoMuted:!0,uploadStates:{},uploadSpeedBps:0,showRestoreDialog:!1,restoredUids:[],activeFilters:[],showFilterChoice:!1,skipUploadFilters:!1,perFileFilterSkipped:{},filteredThumbs:{},setSelectedFiles:e=>t(t=>({selectedFiles:"function"==typeof e?e(t.selectedFiles):e})),addOriginalFiles:e=>t(t=>({originalFiles:{...t.originalFiles,...e}})),removeFile:e=>t(t=>{if(!t.selectedFiles.some(t=>t.uid===e))return t;const r={...t.captions};delete r[e];const i={...t.oversizedUids};delete i[e];const n={...t.trimRanges};delete n[e];const o={...t.originalFiles};delete o[e];const a={...t.cropSelections};delete a[e];const s={...t.uploadStates};t.hasStarted||delete s[e];const l={...t.filteredThumbs};delete l[e];const d={...t.perFileFilterSkipped};return delete d[e],{selectedFiles:t.selectedFiles.filter(t=>t.uid!==e),captions:r,oversizedUids:i,trimRanges:n,originalFiles:o,cropSelections:a,uploadStates:s,filteredThumbs:l,perFileFilterSkipped:d}}),setCaption:(e,r)=>t(t=>({captions:{...t.captions,[e]:r}})),setHasStarted:e=>t({hasStarted:e}),addOversizedUids:e=>t(t=>({oversizedUids:{...t.oversizedUids,...e}})),removeOversizedFiles:()=>t(e=>{const t=new Set(Object.keys(e.oversizedUids)),r={...e.captions},i={...e.trimRanges},n={...e.originalFiles},o={...e.cropSelections},a={...e.uploadStates},s={...e.filteredThumbs},l={...e.perFileFilterSkipped};return t.forEach(e=>{delete r[e],delete i[e],delete n[e],delete o[e],delete a[e],delete s[e],delete l[e]}),{selectedFiles:e.selectedFiles.filter(e=>!t.has(e.uid)),captions:r,trimRanges:i,originalFiles:n,cropSelections:o,uploadStates:a,filteredThumbs:s,perFileFilterSkipped:l,oversizedUids:{},showOversizedModal:!1}}),setShowOversizedModal:e=>t({showOversizedModal:e}),replaceFile:(e,r,i)=>t(t=>{const n={...t.cropSelections};i&&(n[e]=i);const o={...t.filteredThumbs};return delete o[e],{selectedFiles:t.selectedFiles.map(t=>t.uid===e?{...t,file:r}:t),cropSelections:n,filteredThumbs:o}}),setTrimRange:(e,r)=>t(t=>({trimRanges:{...t.trimRanges,[e]:r}})),setVideoMuted:e=>t({videoMuted:e}),setUploadState:(e,r)=>t(t=>({uploadStates:{...t.uploadStates,[e]:{...t.uploadStates[e],...r}}})),setUploadSpeedBps:e=>t({uploadSpeedBps:e}),setActiveFilters:(e,r)=>t({activeFilters:e,showFilterChoice:r}),setSkipUploadFilters:e=>t({skipUploadFilters:e}),setFileFilterSkipped:(e,r)=>t(t=>({perFileFilterSkipped:{...t.perFileFilterSkipped,[e]:r}})),setFilteredThumb:(e,r)=>t(t=>({filteredThumbs:{...t.filteredThumbs,[e]:r}})),resetUploader:()=>t({selectedFiles:[],originalFiles:{},captions:{},hasStarted:!1,oversizedUids:{},showOversizedModal:!1,trimRanges:{},cropSelections:{},uploadStates:{},uploadSpeedBps:0,skipUploadFilters:!1,perFileFilterSkipped:{},filteredThumbs:{}})}))?je(t):je;var t}(t),i.current=t),/* @__PURE__ */h($e.Provider,{value:r.current,children:e})}function He(e){const t=m($e);if(!t)throw new Error("useUploadStore must be used within UploadStoreProvider");return function(e,t=ze){const r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}(t,e)}function Ve(){const e=m($e);if(!e)throw new Error("useUploadStoreInstance must be used within UploadStoreProvider");return e}var We=/* @__PURE__ */new Map,Ge=null;function Xe({className:e}){/* @__PURE__ */
16
16
  return h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:e,"aria-hidden":"true",focusable:"false",children:/* @__PURE__ */h("path",{fill:"currentColor",d:"m20 7l-.95-2.05L17 4l2.05-.95L20 1l.95 2.05L23 4l-2.05.95L20 7ZM8.5 7l-.95-2.05L5.5 4l2.05-.95L8.5 1l.95 2.05L11.5 4l-2.05.95L8.5 7ZM20 18.5l-.95-2.05L17 15.5l2.05-.95l.95-2.05l.95 2.05l2.05.95l-2.05.95L20 18.5ZM5.1 21.7l-2.8-2.8q-.3-.3-.3-.725t.3-.725L13.45 6.3q.3-.3.725-.3t.725.3l2.8 2.8q.3.3.3.725t-.3.725L6.55 21.7q-.3.3-.725.3t-.725-.3Zm9.075-10.475l1.4-1.4l-1.4-1.4l-1.4 1.4l1.4 1.4Z"})})}function Ye({className:e}){/* @__PURE__ */
@@ -0,0 +1 @@
1
+ import{_ as e,h as n,p as t,v as o}from"./DrrpB4Om.js";import{n as i,s as r}from"./CKQOToSD.js";import{t as a}from"./DmpmrPE5.js";import{i as l}from"./BLeZg2Bz.js";var s=(e,n)=>e.filter(e=>(e.parentFolderId??null)===n).map(n=>{return{folder:n,children:s(e,n._id),eventCount:n.boundary?.length??0,centroid:(t=n.boundary,t?.length?[t.reduce((e,n)=>e+n.x,0)/t.length,t.reduce((e,n)=>e+n.y,0)/t.length]:null),color:n.color||"#fb8500"};var t}).filter(e=>e.eventCount>0||e.children.length>0),d=e=>e.filter(e=>"number"==typeof e.location?.x&&"number"==typeof e.location?.y),c=()=>{const{folders:c,organization:m}=i(),[g,u]=n(null),f=Boolean(m?.integrationSettings?.enableFolderView),h=t(()=>f?s(c??[],null):[],[c,f]),y=r({queryKey:["map-all-events",m?._id],queryFn:async()=>d((await a.get(l.PUBLIC_EVENTS,{headers:{"x-org-id":m?._id??""},searchParams:{includeAllFolders:!0,limit:500,sort:"-views",contentLimit:3,projection:"connect"}}).json()).data??[]),enabled:Boolean(m?._id)&&(!f||0===h.length),staleTime:3e5,gcTime:6e5,retry:!1}),v=r({queryKey:["map-folder-events",m?._id,g],queryFn:async()=>d((await a.get(l.PUBLIC_EVENTS,{headers:{"x-org-id":m?._id??""},searchParams:{folderId:g,limit:500,sort:"-views",contentLimit:3,projection:"connect"}}).json()).data??[]),enabled:Boolean(m?._id)&&f&&Boolean(g),staleTime:3e5,gcTime:6e5,retry:!1}),p=t(()=>(c??[]).find(e=>e._id===g)??null,[c,g]);e(()=>{f||u(null)},[f]);const _=o(e=>{u(e)},[]),F=f&&h.length>0;return{folderTree:h,activeFolderId:g,activeFolder:p,visibleEvents:F?v.data??[]:y.data??[],setActiveFolderId:_,isLoadingEvents:F?Boolean(g)&&(v.isLoading||v.isFetching):y.isLoading||y.isFetching}};export{c as t};
@@ -1 +1 @@
1
- import{t as r}from"./DrrpB4Om.js";import{i as a}from"./BlmPmkho.js";var s=({className:s,rounded:e=!1,...o})=>/* @__PURE__ */r("div",{className:a("bg-border animate-pulse",e?"rounded-full":"rounded",s),...o});export{s as t};
1
+ import{t as r}from"./DrrpB4Om.js";import{i as a}from"./CKQOToSD.js";var s=({className:s,rounded:e=!1,...o})=>/* @__PURE__ */r("div",{className:a("bg-border animate-pulse",e?"rounded-full":"rounded",s),...o});export{s as t};
@@ -1 +1 @@
1
- var E={PUBLIC_EVENTS:"/",FOLDER_EVENTS:E=>`/${E}`,LOGIN:"/auth/login",REGISTER:"/auth/register",FORGOT_PASSWORD:"/auth/forgot-password",RESET_PASSWORD:"/auth/reset-password",VERIFY_EMAIL:"/auth/verify-email",GALLERY:E=>`/event/${E}`,UPLOAD:E=>`/event/${E}/upload`,CURATE:E=>`/event/${E}/curate`,LEADERBOARD:E=>`/event/${E}/leaderboard`,MY_UPLOADS:"/my-uploads"},e={ORGANIZATION_SETTINGS:E=>`https://qrati.com/org/${E}/settings`,ORGANIZATION_SETTINGS_INTEGRATION:E=>`https://qrati.com/org/${E}/settings/integration`,ORGANIZATION_DASHBOARD:E=>`https://qrati.com/org/${E}/dashboard`,ORGANIZATION_ADMINS:E=>`https://qrati.com/org/${E}/admins`,EVENT_SETTINGS_BASIC_DETAILS:E=>`https://qrati.com/event/${E}/settings`,EVENT_REVIEW_CONTENTS:E=>`https://qrati.com/event/${E}/review-contents`,EVENT_DEEP_SEARCH:E=>`https://qrati.com/event/${E}/deep-search`,EVENT_GENERATE_ARTICLE:E=>`https://qrati.com/event/${E}/generate-article`,EVENT_ACCESS_REQUESTS:E=>`https://qrati.com/event/${E}/access-requests`,EVENT_SHOT_INSPECTOR:E=>`https://qrati.com/event/${E}/shot-inspector`,EVENT_CURATION_DETAILS:E=>`https://qrati.com/event/${E}/curation-details`},t={PUBLIC:"PUBLIC",PRIVATE:"PRIVATE",SECRET:"SECRET"},a="https://qrati.com/api/connect",T={INITIALIZE_SESSION:`${a}/session/initialize`,REGISTER:`${a}/auth/register`,LOGIN:`${a}/auth/login`,LOGOUT:`${a}/auth/logout`,UPDATE_SESSION:`${a}/session/update`,ACCEPT_TERMS:`${a}/auth/accept-terms`,EXTERNAL_LOGIN:`${a}/auth/external-login`,PUBLIC_EVENTS:`${a}/event/public-events`,SEARCH_EVENTS:`${a}/event/search`,FOLDER_DETAILS:`${a}/folder/details`,NESTED_FOLDERS:`${a}/folder/nested-folders`,GET_EVENT_POINTS:`${a}/event/points`,ELIGIBLE_TO_CURATE:`${a}/content/curation-eligibility`,CONTENT_FOR_CURATION:`${a}/content/for-curation`,CURATE_CONTENT:`${a}/content/curate`,GET_LEADERBOARD:`${a}/event/leaderboard`,GET_UPLOAD_COUNT:`${a}/event/upload-count`,UPLOAD_CREATE:`${a}/content/upload/create`,UPLOAD_COMPLETE:`${a}/content/upload/complete`,UPLOAD_FAIL:`${a}/content/upload/fail`,UPLOAD_ABORT:`${a}/content/upload/abort`,UPDATE_REACTION:`${a}/content/update-reaction`,EVENT_DATA:`${a}/event/details-with-ads-parameters`,UPDATE_EVENT_LAYOUT:`${a}/event/update-layout`,GET_EVENT_STATISTICS:`${a}/event/statistics`,GET_CONTENTS:`${a}/content/for-gallery`,SEARCH_CONTENTS:`${a}/content/search`,GET_CONTENTS_COUNT:`${a}/content/count`,UPDATE_AD_ANALYTICS:`${a}/event/update-ad-analytics`,UPDATE_GAM_ANALYTICS:`${a}/event/update-gam-analytics`,INCREMENT_EVENT_VIEW:`${a}/event/increment-view`,SEND_PASSWORD_RESET_CODE:`${a}/auth/send-password-reset-code`,VERIFY_PASSWORD_RESET_CODE:`${a}/auth/verify-password-reset-code`,RESET_PASSWORD:`${a}/auth/reset-password`,REPORT_ERROR:`${a}/session/report-error`,GET_POST_PROCESSING_SETTINGS:`${a}/event/post-processing-settings`,MY_UPLOADS:`${a}/content/my-uploads`,DELETE_CONTENT:`${a}/content/delete`},s={OWNER:"owner",ADMIN:"admin",MODERATOR:"moderator"},A={IMAGE:"IMAGE",VIDEO:"VIDEO",AD:"AD",GAM_AD:"GAM_AD"},n={GAM_IMPRESSION:"gam_impression",GAM_VIEWABLE:"gam_viewable",GAM_CLICK:"gam_click"},N={ROW:"ROW",COLUMN:"COLUMN",MASONRY:"MASONRY"},o={IN_REVIEW:"IN_REVIEW",APPROVED:"APPROVED",REJECTED:"REJECTED"},O=26214400,_=262144e3,S={CLOSED:"CLOSED",OPEN:"OPEN",UPCOMING:"UPCOMING"},r={TEXT:"text",IMAGE:"image",LOTTIE:"lottie"},I={CONTEST:"CONTEST",REACTION:"REACTION"},R={GRID:"grid",SINGLE:"single"},i={POPULAR:"popular",UPLOAD_TIME:"upload",CAPTURE_TIME:"capture"},c={[i.POPULAR]:{label:"Popular",sortField:"score"},[i.UPLOAD_TIME]:{label:"Uploaded",sortField:"createdAt"},[i.CAPTURE_TIME]:{label:"Captured",sortField:"capturedAt"}},C="map-view-state",D=i.UPLOAD_TIME,l={ASC:"asc",DESC:"desc"},d={[l.ASC]:{label:"Ascending",sortOrder:""},[l.DESC]:{label:"Descending",sortOrder:"-"}},L=l.DESC,P={OWN:"own",CURATED:"curated",ELIGIBLE:"eligible"},$={NONE:null,LINK:"LINK",EMAIL:"EMAIL",PHONE:"PHONE",SMS:"SMS",WHATSAPP:"WHATSAPP",MESSENGER:"MESSENGER"},p={AD_IMPRESSION:"impression",AD_ENGAGEMENT:"engagement",AD_CLICK:"click"},u={QRATI_CONNECT_SESSION:"qrati-connect-session",EVENT_IN_REVIEW_COUNT:E=>`in-review-count-${E}`,CONTENTS_BY_EVENT:E=>`contents-by-event-${E}`,USER_UPLOADS:"user-uploads"};export{P as C,d as E,u as S,l as T,n as _,i as a,_ as b,A as c,L as d,I as f,N as g,e as h,T as i,R as l,t as m,p as n,c as o,S as p,$ as r,o as s,s as t,D as u,C as v,r as w,E as x,O as y};
1
+ var E={PUBLIC_EVENTS:"/",FOLDER_EVENTS:E=>`/${E}`,LOGIN:"/auth/login",REGISTER:"/auth/register",FORGOT_PASSWORD:"/auth/forgot-password",RESET_PASSWORD:"/auth/reset-password",VERIFY_EMAIL:"/auth/verify-email",GALLERY:E=>`/event/${E}`,UPLOAD:E=>`/event/${E}/upload`,CURATE:E=>`/event/${E}/curate`,LEADERBOARD:E=>`/event/${E}/leaderboard`,MY_UPLOADS:"/my-uploads"},e={ORGANIZATION_SETTINGS:E=>`https://qrati.com/org/${E}/settings`,ORGANIZATION_SETTINGS_INTEGRATION:E=>`https://qrati.com/org/${E}/settings/integration`,ORGANIZATION_DASHBOARD:E=>`https://qrati.com/org/${E}/dashboard`,ORGANIZATION_ADMINS:E=>`https://qrati.com/org/${E}/admins`,EVENT_SETTINGS_BASIC_DETAILS:E=>`https://qrati.com/event/${E}/settings`,EVENT_REVIEW_CONTENTS:E=>`https://qrati.com/event/${E}/review-contents`,EVENT_DEEP_SEARCH:E=>`https://qrati.com/event/${E}/deep-search`,EVENT_GENERATE_ARTICLE:E=>`https://qrati.com/event/${E}/generate-article`,EVENT_ACCESS_REQUESTS:E=>`https://qrati.com/event/${E}/access-requests`,EVENT_SHOT_INSPECTOR:E=>`https://qrati.com/event/${E}/shot-inspector`,EVENT_CURATION_DETAILS:E=>`https://qrati.com/event/${E}/curation-details`},t={PUBLIC:"PUBLIC",PRIVATE:"PRIVATE",SECRET:"SECRET"},a="https://qrati.com/api/connect",T={INITIALIZE_SESSION:`${a}/session/initialize`,REGISTER:`${a}/auth/register`,LOGIN:`${a}/auth/login`,LOGOUT:`${a}/auth/logout`,UPDATE_SESSION:`${a}/session/update`,ACCEPT_TERMS:`${a}/auth/accept-terms`,EXTERNAL_LOGIN:`${a}/auth/external-login`,PUBLIC_EVENTS:`${a}/event/public-events`,SEARCH_EVENTS:`${a}/event/search`,FOLDER_DETAILS:`${a}/folder/details`,NESTED_FOLDERS:`${a}/folder/nested-folders`,GET_EVENT_POINTS:`${a}/event/points`,ELIGIBLE_TO_CURATE:`${a}/content/curation-eligibility`,CONTENT_FOR_CURATION:`${a}/content/for-curation`,CURATE_CONTENT:`${a}/content/curate`,GET_LEADERBOARD:`${a}/event/leaderboard`,GET_UPLOAD_COUNT:`${a}/event/upload-count`,UPLOAD_CREATE:`${a}/content/upload/create`,UPLOAD_COMPLETE:`${a}/content/upload/complete`,UPLOAD_FAIL:`${a}/content/upload/fail`,UPLOAD_ABORT:`${a}/content/upload/abort`,UPDATE_REACTION:`${a}/content/update-reaction`,EVENT_DATA:`${a}/event/details-with-ads-parameters`,UPDATE_EVENT_LAYOUT:`${a}/event/update-layout`,GET_EVENT_STATISTICS:`${a}/event/statistics`,GET_CONTENTS:`${a}/content/for-gallery`,SEARCH_CONTENTS:`${a}/content/search`,GET_CONTENTS_COUNT:`${a}/content/count`,UPDATE_AD_ANALYTICS:`${a}/event/update-ad-analytics`,TRACK_IMAGE_SEARCH_CLICK:`${a}/event/track-image-search-click`,UPDATE_GAM_ANALYTICS:`${a}/event/update-gam-analytics`,INCREMENT_EVENT_VIEW:`${a}/event/increment-view`,SEND_PASSWORD_RESET_CODE:`${a}/auth/send-password-reset-code`,VERIFY_PASSWORD_RESET_CODE:`${a}/auth/verify-password-reset-code`,RESET_PASSWORD:`${a}/auth/reset-password`,REPORT_ERROR:`${a}/session/report-error`,GET_POST_PROCESSING_SETTINGS:`${a}/event/post-processing-settings`,MY_UPLOADS:`${a}/content/my-uploads`,DELETE_CONTENT:`${a}/content/delete`},s={OWNER:"owner",ADMIN:"admin",MODERATOR:"moderator"},A={IMAGE:"IMAGE",VIDEO:"VIDEO",AD:"AD",GAM_AD:"GAM_AD"},n={GAM_IMPRESSION:"gam_impression",GAM_VIEWABLE:"gam_viewable",GAM_CLICK:"gam_click"},_={ROW:"ROW",COLUMN:"COLUMN",MASONRY:"MASONRY"},N={IN_REVIEW:"IN_REVIEW",APPROVED:"APPROVED",REJECTED:"REJECTED"},o=26214400,O=262144e3,S={CLOSED:"CLOSED",OPEN:"OPEN",UPCOMING:"UPCOMING"},r={TEXT:"text",IMAGE:"image",LOTTIE:"lottie"},I={CONTEST:"CONTEST",REACTION:"REACTION"},R={GRID:"grid",SINGLE:"single"},i={POPULAR:"popular",UPLOAD_TIME:"upload",CAPTURE_TIME:"capture"},c={[i.POPULAR]:{label:"Popular",sortField:"score"},[i.UPLOAD_TIME]:{label:"Uploaded",sortField:"createdAt"},[i.CAPTURE_TIME]:{label:"Captured",sortField:"capturedAt"}},C="map-view-state",D=i.UPLOAD_TIME,l={ASC:"asc",DESC:"desc"},L={[l.ASC]:{label:"Ascending",sortOrder:""},[l.DESC]:{label:"Descending",sortOrder:"-"}},d=l.DESC,P={OWN:"own",CURATED:"curated",ELIGIBLE:"eligible"},$={NONE:null,LINK:"LINK",EMAIL:"EMAIL",PHONE:"PHONE",SMS:"SMS",WHATSAPP:"WHATSAPP",MESSENGER:"MESSENGER"},p={AD_IMPRESSION:"impression",AD_ENGAGEMENT:"engagement",AD_CLICK:"click"},u={QRATI_CONNECT_SESSION:"qrati-connect-session",EVENT_IN_REVIEW_COUNT:E=>`in-review-count-${E}`,CONTENTS_BY_EVENT:E=>`contents-by-event-${E}`,USER_UPLOADS:"user-uploads"};export{P as C,L as E,u as S,l as T,n as _,i as a,O as b,A as c,d,I as f,_ as g,e as h,T as i,R as l,t as m,p as n,c as o,S as p,$ as r,N as s,s as t,D as u,C as v,r as w,E as x,o as y};
@@ -1,13 +1,13 @@
1
- import{t as e,v as r}from"./DrrpB4Om.js";import{c as a,i as t,n as l,s as i}from"./BlmPmkho.js";import{f as o,i as n}from"./DpD2Abx9.js";import{u as s}from"./OGzsLhnG.js";import{t as d}from"./CE4Zhv-W.js";import{t as c}from"./DwanMJWW.js";import{n as m}from"./DGGc10Cy.js";import{t as g}from"./2CzUGwUv.js";import{t as h}from"./CZ9iaxjO2.js";import{t as f}from"./N4HKgEC52.js";function p({className:r}){/* @__PURE__ */
1
+ import{t as e,v as r}from"./DrrpB4Om.js";import{i as a,n as t,s as l}from"./CKQOToSD.js";import{t as i}from"./DmpmrPE5.js";import{f as o,i as s}from"./BLeZg2Bz.js";import{u as n}from"./DdYePHxG.js";import{t as d}from"./DmIYOIw1.js";import{t as c}from"./BKENYwOQ.js";import{n as m}from"./DGGc10Cy.js";import{t as g}from"./CBM5QMn8.js";import{t as h}from"./CZ9iaxjO2.js";import{t as f}from"./N4HKgEC52.js";function p({className:r}){/* @__PURE__ */
2
2
  return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256",className:r,"aria-hidden":"true",focusable:"false",children:/* @__PURE__ */e("path",{fill:"currentColor",d:"M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m12 152a8 8 0 0 1-16 0V95l-11.56 7.71a8 8 0 1 1-8.88-13.32l24-16A8 8 0 0 1 140 80Z"})})}function b({className:r}){/* @__PURE__ */
3
3
  return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256",className:r,"aria-hidden":"true",focusable:"false",children:/* @__PURE__ */e("path",{fill:"currentColor",d:"M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m-4 164a35.7 35.7 0 0 1-25.71-10.81A8 8 0 1 1 109.71 166A20 20 0 1 0 124 132a8 8 0 0 1-6.55-12.59L136.63 92H104a8 8 0 0 1 0-16h48a8 8 0 0 1 6.55 12.59l-21 30A36 36 0 0 1 124 188"})})}function x({className:r}){/* @__PURE__ */
4
- return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256",className:r,"aria-hidden":"true",focusable:"false",children:/* @__PURE__ */e("path",{fill:"currentColor",d:"M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m24 144a8 8 0 0 1 0 16h-48a8 8 0 0 1-6.4-12.8l43.17-57.56a16 16 0 1 0-27.86-15a8 8 0 0 1-15.09-5.34a32 32 0 1 1 55.74 29.93L120 168Z"})})}var u=e=>{if(!e)return"";const r=e.trim().split(/\s+/);return 1===r.length?r[0]:`${r[0]} ${r[1]?.[0]?`${r[1][0]}.`:""}`},v={first:{size:"size-28",imageSize:"size-24",borderColor:"border-amber-400",gradient:"from-amber-400/20 via-yellow-300/10 to-transparent"},second:{size:"size-20",imageSize:"size-16",borderColor:"border-slate-400",gradient:"from-slate-400/20 via-slate-300/10 to-transparent"},third:{size:"size-20",imageSize:"size-16",borderColor:"border-amber-600",gradient:"from-amber-600/20 via-amber-500/10 to-transparent"}},N=(e,r)=>{const a=void 0===e.totalPoint?e.maxScore:e.totalPoint;return void 0===a?"—":a.toFixed(r?2:0)},w=({entry:a,position:l,showFloatingPoint:i,hidePictures:o})=>{const n=1===l?v.first:2===l?v.second:v.third,s={1:p,2:x,3:b}[l],c={1:{bg:"bg-amber-400",border:"border-amber-600",text:"text-amber-900"},2:{bg:"bg-slate-300",border:"border-slate-500",text:"text-slate-700"},3:{bg:"bg-amber-600",border:"border-amber-800",text:"text-amber-100"}},m=r(e=>{e.currentTarget.style.display="none"},[]);/* @__PURE__ */
5
- return e("div",{className:t("flex w-full flex-col items-center justify-center rounded-xl p-4 text-center sm:min-w-36","bg-linear-to-b",n.gradient),children:[o?/* @__PURE__ */e(s,{className:t(n.size,{1:"text-amber-400",2:"text-slate-400",3:"text-amber-600"}[l])}):/* @__PURE__ */e("div",{className:"relative",children:[/* @__PURE__ */e("img",{className:t(n.imageSize,"shadow-card scale-100 rounded-full border-4 object-cover",n.borderColor),src:a.image,alt:a.name??"",loading:"lazy",onError:m}),/* @__PURE__ */e("span",{className:t("shadow-card absolute -bottom-2 left-1/2 z-10 flex size-7 -translate-x-1/2 items-center justify-center rounded-full border-2 text-sm font-bold",c[l].bg,c[l].border,c[l].text),children:l})]}),/* @__PURE__ */e("div",{className:"mt-3 space-y-3 text-center",children:[/* @__PURE__ */e(d,{variant:"h6",lines:2,className:"max-w-24",align:"center",children:u(a.name)}),/* @__PURE__ */e("div",{className:"text-primary text-lg font-bold",children:N(a,i)})]})]})},y=({title:a,entries:l=[],showFloatingPoint:i=!1,hidePictures:o=!0})=>{const{t:n}=m(),s=a.replace(/\s+/g,"-").toLowerCase(),c=r(e=>{e.currentTarget.style.display="none"},[]);/* @__PURE__ */
6
- return e("div",{className:"border-border mx-auto flex max-w-2xl flex-col rounded border p-4 sm:p-5 lg:p-6",children:[/* @__PURE__ */e("div",{className:"mb-4 flex items-center justify-center gap-2",children:[/* @__PURE__ */e(h,{className:"text-primary size-6"}),/* @__PURE__ */e(d,{variant:"h4",align:"center",color:"primary",children:a})]}),0===l.length?/* @__PURE__ */e("div",{className:"py-16 text-center",children:[/* @__PURE__ */e(d,{variant:"h5",align:"center",color:"error",children:n("leaderboard.not_available","No data available")}),/* @__PURE__ */e(d,{variant:"body2",align:"center",color:"muted",className:"mt-2",children:n("leaderboard.come_back_later","Check back later for updates.")})]}):/* @__PURE__ */e("div",{children:[/* @__PURE__ */e("div",{className:"flex items-end justify-center gap-2 lg:gap-8",children:[l.length>1&&/* @__PURE__ */e(w,{entry:l[1],position:2,showFloatingPoint:i,hidePictures:o}),l.length>0&&/* @__PURE__ */e(w,{entry:l[0],position:1,showFloatingPoint:i,hidePictures:o}),l.length>2&&/* @__PURE__ */e(w,{entry:l[2],position:3,showFloatingPoint:i,hidePictures:o})]}),/* @__PURE__ */e("div",{className:"mt-6 overflow-hidden rounded ring-1 ring-black/5",children:/* @__PURE__ */e("div",{className:"divide-border divide-y",children:l.slice(3).map((r,a)=>/* @__PURE__ */e("div",{className:t("hover:bg-primary/5 flex items-center gap-4 px-4 py-3",a%2==0?"bg-primary/5":"bg-background"),children:[
7
- /* @__PURE__ */e("span",{className:"text-muted-foreground w-8 text-center text-sm font-medium",children:a+4}),!o&&/* @__PURE__ */e("img",{className:"ring-border size-10 rounded-full object-cover ring-2",src:r.image,alt:r.name??"",loading:"lazy",onError:c}),
4
+ return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256",className:r,"aria-hidden":"true",focusable:"false",children:/* @__PURE__ */e("path",{fill:"currentColor",d:"M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m24 144a8 8 0 0 1 0 16h-48a8 8 0 0 1-6.4-12.8l43.17-57.56a16 16 0 1 0-27.86-15a8 8 0 0 1-15.09-5.34a32 32 0 1 1 55.74 29.93L120 168Z"})})}var u=e=>{if(!e)return"";const r=e.trim().split(/\s+/);return 1===r.length?r[0]:`${r[0]} ${r[1]?.[0]?`${r[1][0]}.`:""}`},v={first:{size:"size-28",imageSize:"size-24",borderColor:"border-amber-400",gradient:"from-amber-400/20 via-yellow-300/10 to-transparent"},second:{size:"size-20",imageSize:"size-16",borderColor:"border-slate-400",gradient:"from-slate-400/20 via-slate-300/10 to-transparent"},third:{size:"size-20",imageSize:"size-16",borderColor:"border-amber-600",gradient:"from-amber-600/20 via-amber-500/10 to-transparent"}},N=(e,r)=>{const a=void 0===e.totalPoint?e.maxScore:e.totalPoint;return void 0===a?"—":a.toFixed(r?2:0)},w=({entry:t,position:l,showFloatingPoint:i,hidePictures:o})=>{const s=1===l?v.first:2===l?v.second:v.third,n={1:p,2:x,3:b}[l],c={1:{bg:"bg-amber-400",border:"border-amber-600",text:"text-amber-900"},2:{bg:"bg-slate-300",border:"border-slate-500",text:"text-slate-700"},3:{bg:"bg-amber-600",border:"border-amber-800",text:"text-amber-100"}},m=r(e=>{e.currentTarget.style.display="none"},[]);/* @__PURE__ */
5
+ return e("div",{className:a("flex w-full flex-col items-center justify-center rounded-xl p-4 text-center sm:min-w-36","bg-linear-to-b",s.gradient),children:[o?/* @__PURE__ */e(n,{className:a(s.size,{1:"text-amber-400",2:"text-slate-400",3:"text-amber-600"}[l])}):/* @__PURE__ */e("div",{className:"relative",children:[/* @__PURE__ */e("img",{className:a(s.imageSize,"shadow-card scale-100 rounded-full border-4 object-cover",s.borderColor),src:t.image,alt:t.name??"",loading:"lazy",onError:m}),/* @__PURE__ */e("span",{className:a("shadow-card absolute -bottom-2 left-1/2 z-10 flex size-7 -translate-x-1/2 items-center justify-center rounded-full border-2 text-sm font-bold",c[l].bg,c[l].border,c[l].text),children:l})]}),/* @__PURE__ */e("div",{className:"mt-3 space-y-3 text-center",children:[/* @__PURE__ */e(d,{variant:"h6",lines:2,className:"max-w-24",align:"center",children:u(t.name)}),/* @__PURE__ */e("div",{className:"text-primary text-lg font-bold",children:N(t,i)})]})]})},y=({title:t,entries:l=[],showFloatingPoint:i=!1,hidePictures:o=!0})=>{const{t:s}=m(),n=t.replace(/\s+/g,"-").toLowerCase(),c=r(e=>{e.currentTarget.style.display="none"},[]);/* @__PURE__ */
6
+ return e("div",{className:"border-border mx-auto flex max-w-2xl flex-col rounded border p-4 sm:p-5 lg:p-6",children:[/* @__PURE__ */e("div",{className:"mb-4 flex items-center justify-center gap-2",children:[/* @__PURE__ */e(h,{className:"text-primary size-6"}),/* @__PURE__ */e(d,{variant:"h4",align:"center",color:"primary",children:t})]}),0===l.length?/* @__PURE__ */e("div",{className:"py-16 text-center",children:[/* @__PURE__ */e(d,{variant:"h5",align:"center",color:"error",children:s("leaderboard.not_available","No data available")}),/* @__PURE__ */e(d,{variant:"body2",align:"center",color:"muted",className:"mt-2",children:s("leaderboard.come_back_later","Check back later for updates.")})]}):/* @__PURE__ */e("div",{children:[/* @__PURE__ */e("div",{className:"flex items-end justify-center gap-2 lg:gap-8",children:[l.length>1&&/* @__PURE__ */e(w,{entry:l[1],position:2,showFloatingPoint:i,hidePictures:o}),l.length>0&&/* @__PURE__ */e(w,{entry:l[0],position:1,showFloatingPoint:i,hidePictures:o}),l.length>2&&/* @__PURE__ */e(w,{entry:l[2],position:3,showFloatingPoint:i,hidePictures:o})]}),/* @__PURE__ */e("div",{className:"mt-6 overflow-hidden rounded ring-1 ring-black/5",children:/* @__PURE__ */e("div",{className:"divide-border divide-y",children:l.slice(3).map((r,t)=>/* @__PURE__ */e("div",{className:a("hover:bg-primary/5 flex items-center gap-4 px-4 py-3",t%2==0?"bg-primary/5":"bg-background"),children:[
7
+ /* @__PURE__ */e("span",{className:"text-muted-foreground w-8 text-center text-sm font-medium",children:t+4}),!o&&/* @__PURE__ */e("img",{className:"ring-border size-10 rounded-full object-cover ring-2",src:r.image,alt:r.name??"",loading:"lazy",onError:c}),
8
8
  /* @__PURE__ */e("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */e("div",{className:"truncate font-medium",children:u(r.name)})}),
9
- /* @__PURE__ */e("div",{className:"text-primary text-right font-semibold",children:N(r,i)})]},`${s}-${a}`))})})]})]})},z=()=>{const{eventSlug:r}=s(),{props:h}=l(),{t:p}=m(),b=h?.organizationId,{event:x,loading:u}=g({eventSlug:r}),{isLoading:v,isError:N,error:w,data:z}=a({queryKey:[`leaderboard-${b}-${x?._id}`],queryFn:async()=>(await i.get(n.GET_LEADERBOARD,{headers:{"x-org-id":b??""},searchParams:{eventId:x?._id??"",projection:"connect"}}).json()).data,enabled:Boolean(x),staleTime:3e4,gcTime:3e5});/* @__PURE__ */
10
- return e("div",u||v?{className:"bg-background mt-4 flex min-h-[80vh] w-full flex-col gap-6 px-2 py-4 sm:px-0 lg:py-8",children:[/* @__PURE__ */e("div",{className:"flex flex-col items-center gap-2 text-center",children:[/* @__PURE__ */e(c,{className:"h-5 w-28 rounded-full"}),/* @__PURE__ */e(c,{className:"h-10 w-64 rounded"})]}),/* @__PURE__ */e("div",{className:t("flex w-full gap-8 lg:gap-0",x?.engagementStyle===o.REACTION?"flex-col-reverse md:flex-row-reverse md:justify-between":"flex-col md:flex-row"),children:[/* @__PURE__ */e("div",{className:"flex-1",children:[/* @__PURE__ */e(c,{className:"h-72 w-full rounded"}),/* @__PURE__ */e(c,{className:"mt-4 h-72 w-full rounded"})]}),/* @__PURE__ */e("div",{className:"flex-1",children:/* @__PURE__ */e(c,{className:"h-72 w-full rounded"})})]})]}:N?{className:"bg-background mt-4 flex min-h-[80vh] w-full flex-col items-center justify-center gap-4 px-2 py-4 text-center sm:px-0 lg:py-8",children:[
9
+ /* @__PURE__ */e("div",{className:"text-primary text-right font-semibold",children:N(r,i)})]},`${n}-${t}`))})})]})]})},z=()=>{const{eventSlug:r}=n(),{props:h}=t(),{t:p}=m(),b=h?.organizationId,{event:x,loading:u}=g({eventSlug:r}),{isLoading:v,isError:N,error:w,data:z}=l({queryKey:[`leaderboard-${b}-${x?._id}`],queryFn:async()=>(await i.get(s.GET_LEADERBOARD,{headers:{"x-org-id":b??""},searchParams:{eventId:x?._id??"",projection:"connect"}}).json()).data,enabled:Boolean(x),staleTime:3e4,gcTime:3e5});/* @__PURE__ */
10
+ return e("div",u||v?{className:"bg-background mt-4 flex min-h-[80vh] w-full flex-col gap-6 px-2 py-4 sm:px-0 lg:py-8",children:[/* @__PURE__ */e("div",{className:"flex flex-col items-center gap-2 text-center",children:[/* @__PURE__ */e(c,{className:"h-5 w-28 rounded-full"}),/* @__PURE__ */e(c,{className:"h-10 w-64 rounded"})]}),/* @__PURE__ */e("div",{className:a("flex w-full gap-8 lg:gap-0",x?.engagementStyle===o.REACTION?"flex-col-reverse md:flex-row-reverse md:justify-between":"flex-col md:flex-row"),children:[/* @__PURE__ */e("div",{className:"flex-1",children:[/* @__PURE__ */e(c,{className:"h-72 w-full rounded"}),/* @__PURE__ */e(c,{className:"mt-4 h-72 w-full rounded"})]}),/* @__PURE__ */e("div",{className:"flex-1",children:/* @__PURE__ */e(c,{className:"h-72 w-full rounded"})})]})]}:N?{className:"bg-background mt-4 flex min-h-[80vh] w-full flex-col items-center justify-center gap-4 px-2 py-4 text-center sm:px-0 lg:py-8",children:[
11
11
  /* @__PURE__ */e(f,{className:"size-9 text-destructive"}),
12
12
  /* @__PURE__ */e(d,{variant:"h4",color:"error",align:"center",children:p("common.error","Something went wrong")}),
13
- /* @__PURE__ */e(d,{variant:"body2",color:"muted",align:"center",children:w instanceof Error?w.message:p("common.try_again","Please try again later.")})]}:{className:"bg-background mt-4 flex min-h-[80vh] w-full flex-col gap-6 px-2 py-4 sm:px-0 lg:py-8",children:[/* @__PURE__ */e("div",{className:"flex flex-col items-center gap-2 text-center",children:[/* @__PURE__ */e("div",{className:"text-primary flex items-center gap-2",children:/* @__PURE__ */e(d,{variant:"h5",color:"primary",children:p("leaderboard.leaderboard","Leaderboard")})}),/* @__PURE__ */e(d,{variant:"h4",align:"center",color:"foreground",children:x?.name})]}),/* @__PURE__ */e("div",{className:t("flex w-full gap-8 lg:gap-0",x?.engagementStyle===o.REACTION?"flex-col-reverse md:flex-row-reverse md:justify-between":"flex-col md:flex-row"),children:[/* @__PURE__ */e("div",{className:"flex-1",children:/* @__PURE__ */e(y,{title:p("leaderboard.point_leaders","Top Points Leaders"),entries:z?.leaderboardByPoint?.topRankers||[],pointName:x?.pointName})}),/* @__PURE__ */e("div",{className:"flex-1",children:/* @__PURE__ */e(y,{title:x?.engagementStyle===o.REACTION?p("leaderboard.reaction_counts","Top Reactions"):p("leaderboard.top_rated_photos","Top Rated Photos"),showFloatingPoint:x?.engagementStyle===o.CONTEST,entries:z?.leaderboardByScore?.topRankers||[],pointName:x?.pointName})})]})]})};export{z as default};
13
+ /* @__PURE__ */e(d,{variant:"body2",color:"muted",align:"center",children:w instanceof Error?w.message:p("common.try_again","Please try again later.")})]}:{className:"bg-background mt-4 flex min-h-[80vh] w-full flex-col gap-6 px-2 py-4 sm:px-0 lg:py-8",children:[/* @__PURE__ */e("div",{className:"flex flex-col items-center gap-2 text-center",children:[/* @__PURE__ */e("div",{className:"text-primary flex items-center gap-2",children:/* @__PURE__ */e(d,{variant:"h5",color:"primary",children:p("leaderboard.leaderboard","Leaderboard")})}),/* @__PURE__ */e(d,{variant:"h4",align:"center",color:"foreground",children:x?.name})]}),/* @__PURE__ */e("div",{className:a("flex w-full gap-8 lg:gap-0",x?.engagementStyle===o.REACTION?"flex-col-reverse md:flex-row-reverse md:justify-between":"flex-col md:flex-row"),children:[/* @__PURE__ */e("div",{className:"flex-1",children:/* @__PURE__ */e(y,{title:p("leaderboard.point_leaders","Top Points Leaders"),entries:z?.leaderboardByPoint?.topRankers||[],pointName:x?.pointName})}),/* @__PURE__ */e("div",{className:"flex-1",children:/* @__PURE__ */e(y,{title:x?.engagementStyle===o.REACTION?p("leaderboard.reaction_counts","Top Reactions"):p("leaderboard.top_rated_photos","Top Rated Photos"),showFloatingPoint:x?.engagementStyle===o.CONTEST,entries:z?.leaderboardByScore?.topRankers||[],pointName:x?.pointName})})]})]})};export{z as default};