@qratilabs/qrati-connect 2.3.3 → 2.4.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 (74) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -2
  3. package/element/{AuthLayout-BQsxj8DA.js → AuthLayout-D6yq2Myx.js} +1 -1
  4. package/element/ContentsPage-DCloOu7i.js +1 -0
  5. package/element/{CuratePage-l_53kq1u.js → CuratePage-C1XBJnxN.js} +1 -1
  6. package/element/Dialog-Bqed17jN.js +1 -0
  7. package/element/{DotLottiePlayer-DWbmlHl0.js → DotLottiePlayer-Ciqi1a0X.js} +1 -1
  8. package/element/EventHeaderAdminButtons-YVIZ2jNS.js +1 -0
  9. package/element/{FolderBreadcrumb-DgOZR2JO.js → FolderBreadcrumb-C8gAI_F2.js} +1 -1
  10. package/element/{ForgotPasswordPage-CIz3_X-3.js → ForgotPasswordPage-BLiFYU8r.js} +1 -1
  11. package/element/{InputField-DybXE_Ab.js → InputField-VxKss-ap.js} +1 -1
  12. package/element/{LazyLoadImage-8X8b06AJ.js → LazyLoadImage-CJQhdLtk.js} +1 -1
  13. package/element/{LeaderboardPage-Bphjksy_.js → LeaderboardPage-C_PNMUnE.js} +1 -1
  14. package/element/LoginPage-BlmrppsE.js +1 -0
  15. package/element/{NCMVHL6D-CBCgRwdZ.js → NCMVHL6D-Di9F8hV1.js} +1 -1
  16. package/element/{PublicEvents-RN-_fsl2.js → PublicEvents-C0iy0Ff1.js} +1 -1
  17. package/element/RegisterPage-BDawpnhD.js +1 -0
  18. package/element/{SocialLoginButton-DpBl7dWg.js → SocialLoginButton-DCZbdhrb.js} +1 -1
  19. package/element/{UploadPage-B7BieTEU.js → UploadPage-DKqtebrs.js} +1 -1
  20. package/element/{VideoPlayer-Bk8Hao3q.js → VideoPlayer-D-zTM_L9.js} +1 -1
  21. package/element/element.es.js +1 -1
  22. package/element/{heic2any-DLQd-wQs.js → heic2any-CPi_UmKl.js} +1 -1
  23. package/element/index-BEtvIXWu.js +1 -0
  24. package/element/{index-DI8B7D73.js → index-Cg2z7-F2.js} +1 -1
  25. package/element/index-ar7jHNfV.js +1 -0
  26. package/element/{index.esm-CAQX5kI5.js → index.esm-DMnv_TeJ.js} +1 -1
  27. package/element/{photoswipe-Coj-X7bR.js → photoswipe-BaMjvcSX.js} +1 -1
  28. package/element/styles.css +1 -1
  29. package/element/{tslib.es6-C9bR68b3.js → tslib.es6-CMp2KRLs.js} +1 -1
  30. package/element/{useOrgAccess-CnN4aiYB.js → useOrgAccess-59e03fsS.js} +1 -1
  31. package/element/web.es.js +1 -1
  32. package/package.json +16 -15
  33. package/react/0096QSNF.js +1 -0
  34. package/react/{Y9TU3Znq.js → 0VQzlcgi.js} +1 -1
  35. package/react/{Pcjql-py.js → BNMtxstZ.js} +1 -1
  36. package/react/{CfZ5_7x-.js → BYvYuEdt.js} +1 -1
  37. package/react/{DvDETl8u.js → Bags6A1F.js} +1 -1
  38. package/react/BozcWsGg.js +1 -0
  39. package/react/{jRrpvD0D.js → C4OAItgB.js} +1 -1
  40. package/react/{Dwry3hNI.js → C6KOByxs.js} +1 -1
  41. package/react/{BO8jvMXn.js → CKtJREoH.js} +1 -1
  42. package/react/{B1neVlFZ.js → C__pEwjz.js} +1 -1
  43. package/react/CaxUtbJe.js +1 -0
  44. package/react/ChmTNpp8.js +1 -0
  45. package/react/{CZp0lmKh.js → CyG7wrJo.js} +1 -1
  46. package/react/{D6nR1wv_.js → Cyl2KafN.js} +1 -1
  47. package/react/{DrqnWQLs.js → D4GskBrt.js} +1 -1
  48. package/react/{rZy1FKOQ.js → D9rOYW-1.js} +1 -1
  49. package/react/{Gbk2zO2l.js → DXMc4AHM.js} +1 -1
  50. package/react/DdTWd9NL.js +1 -0
  51. package/react/De-cdzUn.js +1 -0
  52. package/react/{IbMHxVCj.js → DqWiakim.js} +1 -1
  53. package/react/{DYrfBufu.js → DwbNwe-K.js} +1 -1
  54. package/react/G275Ly1Q.js +1 -0
  55. package/react/{Ply2G2qz.js → YYrpqjgS.js} +1 -1
  56. package/react/index.es.js +1 -2
  57. package/react/{DyklTvwE.js → sVnMjM13.js} +1 -1
  58. package/react/styles.css +1 -0
  59. package/react/{CXu6PHUW.js → zUd27y38.js} +1 -1
  60. package/umd/web.umd.js +106 -242
  61. package/element/ContentsPage-BswZWICC.js +0 -16
  62. package/element/Dialog-xRPAHU1U.js +0 -1
  63. package/element/EventHeaderAdminButtons-DpqqYPmp.js +0 -10
  64. package/element/LoginPage-CHzBIQEq.js +0 -1
  65. package/element/RegisterPage-7WLryyTX.js +0 -1
  66. package/element/index-DzVrt1C0.js +0 -14
  67. package/element/index-JyoNGo8S.js +0 -107
  68. package/react/BbIY3X7C.js +0 -1
  69. package/react/CN2vdtYT.js +0 -1
  70. package/react/Cg1c9zqH.js +0 -22
  71. package/react/DBnzOELO.js +0 -30
  72. package/react/D_imcCpv.js +0 -16
  73. package/react/DvOl03h5.js +0 -19
  74. package/react/fuEo08KS.js +0 -1
@@ -1 +1 @@
1
- import{u as a,j as s,E as r,c as t,T as l,I as e,A as c,a as n,b as i,d as f,N as o,P as d,e as m,S as h,f as x,g as j,h as q,F as p,k as g,i as u}from"./DBnzOELO.js";import{useMemo as v,Fragment as b}from"react";import{F as z,g as y}from"./B1neVlFZ.js";import{L as w}from"./Y9TU3Znq.js";import{u as N,T as L}from"./IbMHxVCj.js";const A=a=>a===r.UPCOMING?"qc:bg-warning":a===r.CLOSED?"qc:bg-destructive":"qc:bg-success",I=({event:e})=>{const{organization:c}=a(),n=e?.coverImageUrl?e?.coverImageUrl:e?.contents?.length>0?e.contents[0].thumbnailUrl||e.contents[0].url:void 0;return s.jsxs("div",{className:"qc:space-y-4",children:[s.jsxs("div",{className:"qc:relative qc:h-72 qc:overflow-hidden qc:rounded qc:sm:h-80",children:[n?s.jsx(w,{wrapperClassName:"qc:size-full qc:sm:hover:scale-105 qc:sm:transition-transform",src:e?.coverImageUrl?e?.coverImageUrl:e?.contents?.length>0?e.contents[0].thumbnailUrl||e.contents[0].url:`https://placehold.co/600x400/${c?.color?.slice(1)}/white`,blurhash:e?.coverBlurHash?e?.coverBlurHash:e?.contents?.length>0?e.contents[0].blurHash:void 0}):s.jsx("div",{className:"qc:bg-primary qc:flex qc:size-full qc:items-center qc:justify-center",children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"qc:text-primary-foreground qc:size-16",viewBox:"0 0 24 24",children:s.jsx("path",{fill:"currentColor",d:"M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-2h14V5H5zm0 0V5zm2-2h10q.3 0 .45-.275t-.05-.525l-2.75-3.675q-.15-.2-.4-.2t-.4.2L11.25 16L9.4 13.525q-.15-.2-.4-.2t-.4.2l-2 2.675q-.2.25-.05.525T7 17"})})}),!c?.integrationSettings?.hideEventStatus&&e?.status!==r.CLOSED&&s.jsx("span",{className:t("qc:absolute qc:right-4 qc:top-4 qc:inline-flex qc:items-center qc:rounded-full qc:px-3 qc:py-2",A(e.status)),children:s.jsx(l,{variant:"h6",color:"white",children:e.status})})]}),s.jsx(l,{variant:"h4",immutable:!0,lines:"2",children:e.name})]})},E=({folder:a})=>s.jsxs("div",{className:"qc:shadow-outer qc:border-border qc:flex qc:items-center qc:gap-4 qc:rounded qc:border qc:bg-background-primary-dark qc:bg-opacity-5 qc:p-2 qc:hover:bg-opacity-10",children:[s.jsx(e,{name:"material-symbols:folder-rounded",style:{color:a.color}}),s.jsx(l,{variant:"h5",children:a.name})]}),S=({organization:a})=>{const{role:r,isSuper:t}=N(),l=v(()=>{const s=[];return(t||r&&(r===c.OWNER||r===c.ADMIN))&&(s.push({label:"Analytics",icon:"material-symbols:analytics-outline-rounded",href:n.ORGANIZATION_DASHBOARD(a?._id)}),s.push({label:"Admins",icon:"material-symbols:supervised-user-circle-outline",href:n.ORGANIZATION_ADMINS(a?._id)}),s.push({label:"Settings",icon:"material-symbols:settings-outline-rounded",href:n.ORGANIZATION_SETTINGS(a?._id)})),s},[r,t]);return l?.length>0?s.jsx("div",{className:"qc:text-muted qc:sm:text-foreground qc:flex qc:flex-row qc:items-center qc:justify-end qc:gap-8 qc:pr-4",children:l.map(a=>s.jsx(L,{content:a?.label,children:s.jsx("a",{target:"_blank",href:a.href,rel:"noreferrer",children:s.jsx(e,{name:a.icon,size:"lg"})})},a.label))}):null},T=()=>{const{folderId:r=""}=i(),t=f(),{folders:l,organization:e,props:{organizationId:c}}=a();if(!t?.state?.internalNavigation)try{const a=new URLSearchParams(window?.location?.search);let r=a.get("event"),t=a.get("page");if(!r&&!t&&window?.location?.hash){const a=window.location.hash.split("?");if(a.length>1){const s=new URLSearchParams(a[1]);r=s.get("event"),t=s.get("page")}}if(r){if(t)switch(t.toLowerCase()){case"upload":return s.jsx(o,{to:d.UPLOAD(r)});case"curate":return s.jsx(o,{to:d.CURATE(r)});case"leaderboard":return s.jsx(o,{to:d.LEADERBOARD(r)});default:return s.jsx(o,{to:d.GALLERY(r)})}return s.jsx(o,{to:d.GALLERY(r)})}}catch(a){console.error("Error parsing URL parameters:",a)}const n=l?.filter(a=>a.parentFolderId===(r?.length>0?r:null)||a.parentFolderId===(r?.length>0?r:void 0)),{isLoading:v,data:w}=m({queryKey:[`public-events-${c}`,r],queryFn:async()=>(await g.get(u.PUBLIC_EVENTS,{headers:{"x-org-id":c},searchParams:{folderId:r,sort:"-createdAt"}}).json()).data});return v?s.jsx("div",{className:"qc:grid qc:grid-cols-1 qc:gap-4 qc:sm:grid-cols-3 qc-mt-4",children:Array.from({length:3}).map((a,r)=>s.jsxs("div",{className:"qc:space-y-4",children:[s.jsx(h,{className:"qc:h-72 qc:overflow-hidden qc:rounded qc:sm:h-80"}),s.jsx(h,{className:"qc:h-6 qc:w-64 qc:rounded"})]},r))}):s.jsxs(b,{children:[e?.navigationSettings?.enableNavbar&&s.jsx(x,{}),s.jsxs("div",{className:"qc:min-h-screen qc:w-full",children:[s.jsx(S,{organization:e}),r&&s.jsx("div",{className:"qc:mt-4",children:s.jsx(z,{homeLink:d.PUBLIC_EVENTS,data:y(l,r)})}),n?.length>0&&s.jsx("div",{className:"qc:mt-4 qc:grid qc:grid-cols-2 qc:gap-3 qc:md:grid-cols-2 qc:lg:grid-cols-4 qc:lg:gap-6",children:n?.map(a=>s.jsx(j,{to:d.FOLDER_EVENTS(a?._id),children:s.jsx(E,{folder:a},a._id)},a?._id))}),w?.length<=0&&s.jsx("div",{className:"min-h-[80vh]",children:s.jsx(q,{title:l?.length>0?"Empty folder":"No events",description:l?.length>0?"Browse other folders for events":"Check back later for our awesome events!",className:"qc:mt-24 qc:md:mt-36",iconSvg:s.jsxs("svg",{"data-name":"Layer 1",className:"qc:size-full",viewBox:"0 0 858.76 581.93",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m982.6 738.67a198.59 198.59 0 0 1 16.436-62.675q3.7094-8.2865 8.1655-16.208a1.2103 1.2103 0 0 0-2.0886-1.2208 201.33 201.33 0 0 0-22.403 61.805q-1.682 9.0855-2.5283 18.299c-0.14337 1.5493 2.2763 1.5396 2.4188 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"842.44",cy:"489.32",r:"15.319",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m984.17 739.08a128.83 128.83 0 0 1 10.662-40.66q2.4064-5.3758 5.2973-10.515a0.78518 0.78518 0 0 0-1.355-0.792 130.61 130.61 0 0 0-14.534 40.096q-1.0912 5.8942-1.6402 11.872c-0.093 1.0051 1.4768 0.99878 1.5692 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"833.31",cy:"521.45",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m982.19 738.14a128.83 128.83 0 0 1-16.601-38.618q-1.409-5.7188-2.2905-11.549a0.78518 0.78518 0 0 0-1.5555 0.2089 130.61 130.61 0 0 0 13.202 40.554q2.7649 5.3186 6.0085 10.369c0.54487 0.84972 1.7787-0.12078 1.2373-0.96515z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"791.11",cy:"520.75",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m341.05 738.67a198.59 198.59 0 0 0-16.436-62.675q-3.7094-8.2865-8.1655-16.208a1.2103 1.2103 0 0 1 2.0886-1.2208 201.33 201.33 0 0 1 22.403 61.805q1.682 9.0855 2.5283 18.299c0.14338 1.5493-2.2763 1.5396-2.4188 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"139.97",cy:"489.32",r:"15.319",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m339.48 739.08a128.83 128.83 0 0 0-10.662-40.66q-2.4064-5.3758-5.2973-10.515a0.78518 0.78518 0 0 1 1.355-0.792 130.61 130.61 0 0 1 14.534 40.096q1.0912 5.8942 1.6402 11.872c0.093 1.0051-1.4768 0.99878-1.5692 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"149.1",cy:"521.45",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m341.46 738.14a128.83 128.83 0 0 0 16.601-38.618q1.409-5.7188 2.2905-11.549a0.78518 0.78518 0 0 1 1.5555 0.2089 130.61 130.61 0 0 1-13.202 40.554q-2.7649 5.3186-6.0084 10.369c-0.54487 0.84972-1.7787-0.12078-1.2373-0.96515z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"191.3",cy:"520.75",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m925.02 538.41 0.2391 180.11a12.626 12.626 0 0 1-12.593 12.63l-74.817 0.10967c21.062-39.4 32.987-101.41 32.917-149.22a281.27 281.27 0 0 0-5.721-56.161l47.345-0.0694a12.626 12.626 0 0 1 12.63 12.593z",fill:"currentColor"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m1028.2 740.97h-738.29a1.1907 1.1907 0 0 1 0-2.3814h738.29a1.1907 1.1907 0 0 1 0 2.3814z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m815.39 513.79-133.34-0.52295 12.966-43.137a16.599 16.599 0 0 1 15.804-11.75h0.06274l76.106 0.29883a16.597 16.597 0 0 1 15.774 11.875z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m889.83 499.03a14 14 0 0 0-14 14h28a14 14 0 0 0-14-14z",fill:"currentColor"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m932.83 740.03h-368a17.019 17.019 0 0 1-17-17v-194a17.019 17.019 0 0 1 17-17h368a17.019 17.019 0 0 1 17 17v194a17.019 17.019 0 0 1-17 17zm-368-226a15.017 15.017 0 0 0-15 15v194a15.017 15.017 0 0 0 15 15h368a15.017 15.017 0 0 0 15-15v-194a15.017 15.017 0 0 0-15-15z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m764.83 497.53h-32a8.5 8.5 0 0 1 0-17h32a8.5 8.5 0 0 1 0 17z",fill:"#fff"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m748.83 702.03a76 76 0 1 1 76-76 76.086 76.086 0 0 1-76 76zm0-150a74 74 0 1 0 74 74 74.084 74.084 0 0 0-74-74z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m748.83 676.03a50 50 0 1 1 50-50 50.056 50.056 0 0 1-50 50zm0-98a48 48 0 1 0 48 48 48.054 48.054 0 0 0-48-48z",fill:"#3f3d56"}),s.jsx("circle",{cx:"578.2",cy:"467",r:"38",fill:"#ccc"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m725.83 626.03a25.001 25.001 0 0 1 21.5-24.751 25 25 0 1 0 0 49.502 25.001 25.001 0 0 1-21.5-24.751z",fill:"#fff"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m914.83 514.03h-50v-1a25 25 0 0 1 50 0zm-47.979-2h45.957a23 23 0 0 0-45.957 0z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m572.83 542.03a10 10 0 1 1 10-10 10.011 10.011 0 0 1-10 10zm0-18a8 8 0 1 0 8 8 8.0092 8.0092 0 0 0-8-8z",fill:"#3f3d56"}),s.jsx("circle",{cx:"402.2",cy:"373",r:"5",fill:"currentColor"}),s.jsx("circle",{cx:"428.2",cy:"373",r:"5",fill:"#ccc"}),s.jsx("circle",{cx:"454.2",cy:"373",r:"5",fill:"#ccc"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m598.83 542.03a10 10 0 1 1 10-10 10.011 10.011 0 0 1-10 10zm0-18a8 8 0 1 0 8 8 8.0092 8.0092 0 0 0-8-8z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m624.83 542.03a10 10 0 1 1 10-10 10.011 10.011 0 0 1-10 10zm0-18a8 8 0 1 0 8 8 8.0092 8.0092 0 0 0-8-8z",fill:"#3f3d56"}),s.jsx("rect",{x:"378.2",y:"439.87",width:"130",height:"2",fill:"#3f3d56"}),s.jsx("rect",{x:"378.2",y:"480.13",width:"126.77",height:"2",fill:"#3f3d56"}),s.jsx("rect",{x:"648.2",y:"439.87",width:"130",height:"2",fill:"#3f3d56"}),s.jsx("rect",{x:"651.2",y:"480.13",width:"126.77",height:"2",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m443.45 401.51c-8.1095-3.7255-13.44-14.377-13.137-24.881s5.8315-20.329 13.456-25.338a26.649 26.649 0 0 1 25.219-1.9056c8.1825 3.483 19.169 4.4318 24.087 13.089 3.7796 6.6528 2.4181 21.495-0.25792 28.892-2.3129 6.394-7.9684 9.9966-13.483 12.013a45.34 45.34 0 0 1-37.511-3.0216",fill:"#2f2e41"}),s.jsx("polygon",{points:"223.38 568.71 211.72 564.91 220.8 518.14 238.01 523.74",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(72.575 -240.02) rotate(18.021)",d:"m372.58 718.9h23.644v14.887h-38.531a14.887 14.887 0 0 1 14.887-14.887z",fill:"#2f2e41"}),s.jsx("polygon",{points:"327.75 568.96 315.49 568.96 309.66 521.67 327.75 521.67",fill:"#ffb8b8"}),s.jsx("path",{d:"m306.73 565.46h23.644v14.887h-38.531a14.887 14.887 0 0 1 14.887-14.887z",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m497.75 708.65c-0.07373 0-0.14746-2e-3 -0.22168-0.00585l-13.586-0.64747a4.5061 4.5061 0 0 1-4.2854-4.4326l-1.8411-134.39a1.5 1.5 0 0 0-2.8267-0.67871l-71.958 136.44a4.4762 4.4762 0 0 1-4.822 2.3213l-13.521-2.5752a4.4992 4.4992 0 0 1-3.4014-5.918l52.43-148.55 4.0344-43.943a4.4698 4.4698 0 0 1 3.936-4.0498c15.277-1.877 36.624-14.395 45.092-19.689a4.446 4.446 0 0 1 3.5305-0.53125 4.5558 4.5558 0 0 1 2.8308 2.2451 202.75 202.75 0 0 1 22.277 123.98l-13.217 96.54a4.4752 4.4752 0 0 1-4.4507 3.8907z",fill:"#2f2e41"}),s.jsx("circle",{cx:"290.56",cy:"228.24",r:"24.561",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m436.71 516.82-7.3955-52.845a31.045 31.045 0 0 1 60.574-13.635c2.106 9.7686 6.385 21.66 4.8218 34.479-10.953 30.399-30.835 39.772-58 32z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m469.21 434.82h-18a4.5051 4.5051 0 0 1-4.5-4.5v-6a4.5051 4.5051 0 0 1 4.5-4.5h18a4.5051 4.5051 0 0 1 4.5 4.5v6a4.5051 4.5051 0 0 1-4.5 4.5z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m560.44 534.7a10.743 10.743 0 0 0-8.7149-13.979l-56.029-80.214-16.614 16.425 60.299 73.683a10.801 10.801 0 0 0 21.059 4.0847z",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m513.22 465.05-20.234 13.507a4.8169 4.8169 0 0 1-7.0291-1.9475l-10.365-21.928a13.377 13.377 0 0 1 22.295-14.789l16.229 17.919a4.8169 4.8169 0 0 1-0.8968 7.2386z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m362.5 426.92a10.526 10.526 0 0 1 0.2393 1.6401l42.957 24.782 10.441-6.0109 11.131 14.572-17.45 12.438a8 8 0 0 1-9.5982-0.23384l-44.297-34.946a10.497 10.497 0 1 1 6.5757-12.241z",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m418.18 471.35-10.794-21.802a4.8169 4.8169 0 0 1 2.835-6.7204l23.078-7.4597a13.377 13.377 0 0 1 11.8 24.012l-19.857 13.79a4.8169 4.8169 0 0 1-7.0632-1.82z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m477.67 356.34a4.0633 4.0633 0 0 0 4.3168-2.4094 5.8506 5.8506 0 0 0-0.41558-5.1377 10.736 10.736 0 0 0-3.7759-3.7034 12.406 12.406 0 0 0-5.9816-2.0579 7.4612 7.4612 0 0 0-5.7939 2.1993 5.3768 5.3768 0 0 0-0.97171 5.9276c0.89811 1.7319 2.7825 2.7031 4.6186 3.3625a27.094 27.094 0 0 0 11.378 1.4944",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m485.52 398.45c-4.2928 0.20179-3.5536-8.9072-4.8971-12.989s-3.1955-8.9513-7.4212-9.734c-3.463-0.6414-6.5925 1.8908-9.609 3.7086-5.3764 3.24-12.336 4.4352-17.981 1.6906s-9.0786-10.078-6.3329-15.723a12.876 12.876 0 0 1 8.049-6.3415 25.906 25.906 0 0 1 10.462-0.50253 53.527 53.527 0 0 1 21.886 7.7574c4.5819 2.8736 8.9417 6.7864 10.306 12.02s1.9198 19.465-3.413 20.366z",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m474.29 343.67c-3.2427-4.1108-2.0213-10.588 1.7582-14.211s9.3995-4.7529 14.615-4.292a29.621 29.621 0 0 1 24.025 17.275c3.2959 7.5393 3.2687 16.163 6.2494 23.832a32.137 32.137 0 0 0 43.41 17.543c5.1881-2.3921 10.128-7.0763 9.8321-12.782 3.2802 12.646-2.6276 27.112-13.823 33.847-6.5573 3.9448-14.323 5.284-21.92 6.2056-4.9507 0.60059-10.039 1.0474-14.87-0.18987-6.7592-1.731-12.418-6.7198-15.845-12.798s-4.7748-13.161-4.827-20.138c-0.04071-5.4353 0.67085-10.873 0.29483-16.296s-2.0061-11.031-5.9367-14.785-10.564-4.9899-14.878-1.6831c-1.7337 1.329-3.0043 3.2697-4.9563 4.2502s-5.036 0.21793-5.1666-1.9626z",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m380.18 427.1h-202.58a6.9935 6.9935 0 0 1-6.9854-6.9854v-114.1a6.9936 6.9936 0 0 1 6.9854-6.9854h202.58a6.9933 6.9933 0 0 1 6.9854 6.9854v114.1a6.9933 6.9933 0 0 1-6.9854 6.9854zm-202.58-126.51a5.4392 5.4392 0 0 0-5.4331 5.4331v114.1a5.4392 5.4392 0 0 0 5.4331 5.4331h202.58a5.4395 5.4395 0 0 0 5.4331-5.4331v-114.1a5.4394 5.4394 0 0 0-5.4331-5.4331z",fill:"#3f3d56"}),s.jsx("circle",{cx:"73.768",cy:"191.12",r:"28.967",fill:"#e6e6e6"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m356.01 401.31-34.003-58.895a2.4215 2.4215 0 0 0-4.1941 0l-20.751 35.942-30.936-53.582a3.1047 3.1047 0 0 0-5.3774 0l-43.596 75.511a3.1046 3.1046 0 0 0 2.6887 4.657h134.07a2.4215 2.4215 0 0 0 2.0971-3.6322z",fill:"currentColor"}),s.jsx("rect",{x:"14.747",y:"153.97",width:"12.419",height:"12.419",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m459.04 259.1h-158.29a5.4645 5.4645 0 0 1-5.4581-5.4582v-89.15a5.4645 5.4645 0 0 1 5.4581-5.4582h158.29a5.4643 5.4643 0 0 1 5.4582 5.4582v89.15a5.4643 5.4643 0 0 1-5.4582 5.4582zm-158.29-98.853a4.25 4.25 0 0 0-4.2452 4.2452v89.15a4.25 4.25 0 0 0 4.2452 4.2452h158.29a4.2502 4.2502 0 0 0 4.2452-4.2452v-89.15a4.2502 4.2502 0 0 0-4.2452-4.2452z",fill:"#ccc"}),s.jsx("circle",{cx:"182.31",cy:"39.947",r:"22.634",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m440.15 238.95-26.569-46.018a1.892 1.892 0 0 0-3.2771 0l-16.214 28.084-24.172-41.867a2.4259 2.4259 0 0 0-4.2017 0l-34.064 59.001a2.4258 2.4258 0 0 0 2.1008 3.6388h104.76a1.8921 1.8921 0 0 0 1.6386-2.8381z",fill:"#e6e6e6"}),s.jsx("rect",{x:"136.2",y:"10.916",width:"9.7034",height:"9.7034",fill:"#ccc"})]})})}),w?.length>0&&s.jsx("div",{className:"qc:grid qc:grid-cols-1 qc:gap-4 qc:gap-y-6 qc:pb-16 qc:sm:grid-cols-3 qc:mt-4",children:w?.map(a=>s.jsx(j,{to:d.GALLERY(a.slug),children:s.jsx(I,{event:a})},a._id))})]}),s.jsx(p,{})]})};export{T as default};
1
+ import{u as a,j as s,E as r,c as t,T as l,I as e,A as c,a as n,b as i,d as f,N as o,P as d,e as m,S as h,f as x,g as j,h as q,F as p,k as g,i as u}from"./ChmTNpp8.js";import{useMemo as v,Fragment as b}from"react";import{F as z,g as y}from"./C__pEwjz.js";import{L as w}from"./0VQzlcgi.js";import{u as N,T as L}from"./DqWiakim.js";const A=a=>a===r.UPCOMING?"qc:bg-warning":a===r.CLOSED?"qc:bg-destructive":"qc:bg-success",I=({event:e})=>{const{organization:c}=a(),n=e?.coverImageUrl?e?.coverImageUrl:e?.contents?.length>0?e.contents[0].thumbnailUrl||e.contents[0].url:void 0;return s.jsxs("div",{className:"qc:space-y-4",children:[s.jsxs("div",{className:"qc:relative qc:h-72 qc:overflow-hidden qc:rounded qc:sm:h-80",children:[n?s.jsx(w,{wrapperClassName:"qc:size-full qc:sm:hover:scale-105 qc:sm:transition-transform",src:e?.coverImageUrl?e?.coverImageUrl:e?.contents?.length>0?e.contents[0].thumbnailUrl||e.contents[0].url:`https://placehold.co/600x400/${c?.color?.slice(1)}/white`,blurhash:e?.coverBlurHash?e?.coverBlurHash:e?.contents?.length>0?e.contents[0].blurHash:void 0}):s.jsx("div",{className:"qc:bg-primary qc:flex qc:size-full qc:items-center qc:justify-center",children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"qc:text-primary-foreground qc:size-16",viewBox:"0 0 24 24",children:s.jsx("path",{fill:"currentColor",d:"M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-2h14V5H5zm0 0V5zm2-2h10q.3 0 .45-.275t-.05-.525l-2.75-3.675q-.15-.2-.4-.2t-.4.2L11.25 16L9.4 13.525q-.15-.2-.4-.2t-.4.2l-2 2.675q-.2.25-.05.525T7 17"})})}),!c?.integrationSettings?.hideEventStatus&&e?.status!==r.CLOSED&&s.jsx("span",{className:t("qc:absolute qc:right-4 qc:top-4 qc:inline-flex qc:items-center qc:rounded-full qc:px-3 qc:py-2",A(e.status)),children:s.jsx(l,{variant:"h6",color:"white",children:e.status})})]}),s.jsx(l,{variant:"h4",immutable:!0,lines:"2",children:e.name})]})},E=({folder:a})=>s.jsxs("div",{className:"qc:shadow-outer qc:border-border qc:flex qc:items-center qc:gap-4 qc:rounded qc:border qc:bg-background-primary-dark qc:bg-opacity-5 qc:p-2 qc:hover:bg-opacity-10",children:[s.jsx(e,{name:"material-symbols:folder-rounded",style:{color:a.color}}),s.jsx(l,{variant:"h5",children:a.name})]}),S=({organization:a})=>{const{role:r,isSuper:t}=N(),l=v(()=>{const s=[];return(t||r&&(r===c.OWNER||r===c.ADMIN))&&(s.push({label:"Analytics",icon:"material-symbols:analytics-outline-rounded",href:n.ORGANIZATION_DASHBOARD(a?._id)}),s.push({label:"Admins",icon:"material-symbols:supervised-user-circle-outline",href:n.ORGANIZATION_ADMINS(a?._id)}),s.push({label:"Settings",icon:"material-symbols:settings-outline-rounded",href:n.ORGANIZATION_SETTINGS(a?._id)})),s},[r,t]);return l?.length>0?s.jsx("div",{className:"qc:text-muted qc:sm:text-foreground qc:flex qc:flex-row qc:items-center qc:justify-end qc:gap-8 qc:pr-4",children:l.map(a=>s.jsx(L,{content:a?.label,children:s.jsx("a",{target:"_blank",href:a.href,rel:"noreferrer",children:s.jsx(e,{name:a.icon,size:"lg"})})},a.label))}):null},T=()=>{const{folderId:r=""}=i(),t=f(),{folders:l,organization:e,props:{organizationId:c}}=a();if(!t?.state?.internalNavigation)try{const a=new URLSearchParams(window?.location?.search);let r=a.get("event"),t=a.get("page");if(!r&&!t&&window?.location?.hash){const a=window.location.hash.split("?");if(a.length>1){const s=new URLSearchParams(a[1]);r=s.get("event"),t=s.get("page")}}if(r){if(t)switch(t.toLowerCase()){case"upload":return s.jsx(o,{to:d.UPLOAD(r)});case"curate":return s.jsx(o,{to:d.CURATE(r)});case"leaderboard":return s.jsx(o,{to:d.LEADERBOARD(r)});default:return s.jsx(o,{to:d.GALLERY(r)})}return s.jsx(o,{to:d.GALLERY(r)})}}catch(a){console.error("Error parsing URL parameters:",a)}const n=l?.filter(a=>a.parentFolderId===(r?.length>0?r:null)||a.parentFolderId===(r?.length>0?r:void 0)),{isLoading:v,data:w}=m({queryKey:[`public-events-${c}`,r],queryFn:async()=>(await g.get(u.PUBLIC_EVENTS,{headers:{"x-org-id":c},searchParams:{folderId:r,sort:"-createdAt"}}).json()).data});return v?s.jsx("div",{className:"qc:grid qc:grid-cols-1 qc:gap-4 qc:sm:grid-cols-3 qc-mt-4",children:Array.from({length:3}).map((a,r)=>s.jsxs("div",{className:"qc:space-y-4",children:[s.jsx(h,{className:"qc:h-72 qc:overflow-hidden qc:rounded qc:sm:h-80"}),s.jsx(h,{className:"qc:h-6 qc:w-64 qc:rounded"})]},r))}):s.jsxs(b,{children:[e?.navigationSettings?.enableNavbar&&s.jsx(x,{}),s.jsxs("div",{className:"qc:min-h-screen qc:w-full",children:[s.jsx(S,{organization:e}),r&&s.jsx("div",{className:"qc:mt-4",children:s.jsx(z,{homeLink:d.PUBLIC_EVENTS,data:y(l,r)})}),n?.length>0&&s.jsx("div",{className:"qc:mt-4 qc:grid qc:grid-cols-2 qc:gap-3 qc:md:grid-cols-2 qc:lg:grid-cols-4 qc:lg:gap-6",children:n?.map(a=>s.jsx(j,{to:d.FOLDER_EVENTS(a?._id),children:s.jsx(E,{folder:a},a._id)},a?._id))}),w?.length<=0&&s.jsx("div",{className:"min-h-[80vh]",children:s.jsx(q,{title:l?.length>0?"Empty folder":"No events",description:l?.length>0?"Browse other folders for events":"Check back later for our awesome events!",className:"qc:mt-24 qc:md:mt-36",iconSvg:s.jsxs("svg",{"data-name":"Layer 1",className:"qc:size-full",viewBox:"0 0 858.76 581.93",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m982.6 738.67a198.59 198.59 0 0 1 16.436-62.675q3.7094-8.2865 8.1655-16.208a1.2103 1.2103 0 0 0-2.0886-1.2208 201.33 201.33 0 0 0-22.403 61.805q-1.682 9.0855-2.5283 18.299c-0.14337 1.5493 2.2763 1.5396 2.4188 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"842.44",cy:"489.32",r:"15.319",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m984.17 739.08a128.83 128.83 0 0 1 10.662-40.66q2.4064-5.3758 5.2973-10.515a0.78518 0.78518 0 0 0-1.355-0.792 130.61 130.61 0 0 0-14.534 40.096q-1.0912 5.8942-1.6402 11.872c-0.093 1.0051 1.4768 0.99878 1.5692 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"833.31",cy:"521.45",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m982.19 738.14a128.83 128.83 0 0 1-16.601-38.618q-1.409-5.7188-2.2905-11.549a0.78518 0.78518 0 0 0-1.5555 0.2089 130.61 130.61 0 0 0 13.202 40.554q2.7649 5.3186 6.0085 10.369c0.54487 0.84972 1.7787-0.12078 1.2373-0.96515z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"791.11",cy:"520.75",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m341.05 738.67a198.59 198.59 0 0 0-16.436-62.675q-3.7094-8.2865-8.1655-16.208a1.2103 1.2103 0 0 1 2.0886-1.2208 201.33 201.33 0 0 1 22.403 61.805q1.682 9.0855 2.5283 18.299c0.14338 1.5493-2.2763 1.5396-2.4188 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"139.97",cy:"489.32",r:"15.319",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m339.48 739.08a128.83 128.83 0 0 0-10.662-40.66q-2.4064-5.3758-5.2973-10.515a0.78518 0.78518 0 0 1 1.355-0.792 130.61 130.61 0 0 1 14.534 40.096q1.0912 5.8942 1.6402 11.872c0.093 1.0051-1.4768 0.99878-1.5692 0z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"149.1",cy:"521.45",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m341.46 738.14a128.83 128.83 0 0 0 16.601-38.618q1.409-5.7188 2.2905-11.549a0.78518 0.78518 0 0 1 1.5555 0.2089 130.61 130.61 0 0 1-13.202 40.554q-2.7649 5.3186-6.0084 10.369c-0.54487 0.84972-1.7787-0.12078-1.2373-0.96515z",fill:"#f2f2f2"}),s.jsx("circle",{cx:"191.3",cy:"520.75",r:"9.9382",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m925.02 538.41 0.2391 180.11a12.626 12.626 0 0 1-12.593 12.63l-74.817 0.10967c21.062-39.4 32.987-101.41 32.917-149.22a281.27 281.27 0 0 0-5.721-56.161l47.345-0.0694a12.626 12.626 0 0 1 12.63 12.593z",fill:"currentColor"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m1028.2 740.97h-738.29a1.1907 1.1907 0 0 1 0-2.3814h738.29a1.1907 1.1907 0 0 1 0 2.3814z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m815.39 513.79-133.34-0.52295 12.966-43.137a16.599 16.599 0 0 1 15.804-11.75h0.06274l76.106 0.29883a16.597 16.597 0 0 1 15.774 11.875z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m889.83 499.03a14 14 0 0 0-14 14h28a14 14 0 0 0-14-14z",fill:"currentColor"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m932.83 740.03h-368a17.019 17.019 0 0 1-17-17v-194a17.019 17.019 0 0 1 17-17h368a17.019 17.019 0 0 1 17 17v194a17.019 17.019 0 0 1-17 17zm-368-226a15.017 15.017 0 0 0-15 15v194a15.017 15.017 0 0 0 15 15h368a15.017 15.017 0 0 0 15-15v-194a15.017 15.017 0 0 0-15-15z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m764.83 497.53h-32a8.5 8.5 0 0 1 0-17h32a8.5 8.5 0 0 1 0 17z",fill:"#fff"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m748.83 702.03a76 76 0 1 1 76-76 76.086 76.086 0 0 1-76 76zm0-150a74 74 0 1 0 74 74 74.084 74.084 0 0 0-74-74z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m748.83 676.03a50 50 0 1 1 50-50 50.056 50.056 0 0 1-50 50zm0-98a48 48 0 1 0 48 48 48.054 48.054 0 0 0-48-48z",fill:"#3f3d56"}),s.jsx("circle",{cx:"578.2",cy:"467",r:"38",fill:"#ccc"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m725.83 626.03a25.001 25.001 0 0 1 21.5-24.751 25 25 0 1 0 0 49.502 25.001 25.001 0 0 1-21.5-24.751z",fill:"#fff"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m914.83 514.03h-50v-1a25 25 0 0 1 50 0zm-47.979-2h45.957a23 23 0 0 0-45.957 0z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m572.83 542.03a10 10 0 1 1 10-10 10.011 10.011 0 0 1-10 10zm0-18a8 8 0 1 0 8 8 8.0092 8.0092 0 0 0-8-8z",fill:"#3f3d56"}),s.jsx("circle",{cx:"402.2",cy:"373",r:"5",fill:"currentColor"}),s.jsx("circle",{cx:"428.2",cy:"373",r:"5",fill:"#ccc"}),s.jsx("circle",{cx:"454.2",cy:"373",r:"5",fill:"#ccc"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m598.83 542.03a10 10 0 1 1 10-10 10.011 10.011 0 0 1-10 10zm0-18a8 8 0 1 0 8 8 8.0092 8.0092 0 0 0-8-8z",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m624.83 542.03a10 10 0 1 1 10-10 10.011 10.011 0 0 1-10 10zm0-18a8 8 0 1 0 8 8 8.0092 8.0092 0 0 0-8-8z",fill:"#3f3d56"}),s.jsx("rect",{x:"378.2",y:"439.87",width:"130",height:"2",fill:"#3f3d56"}),s.jsx("rect",{x:"378.2",y:"480.13",width:"126.77",height:"2",fill:"#3f3d56"}),s.jsx("rect",{x:"648.2",y:"439.87",width:"130",height:"2",fill:"#3f3d56"}),s.jsx("rect",{x:"651.2",y:"480.13",width:"126.77",height:"2",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m443.45 401.51c-8.1095-3.7255-13.44-14.377-13.137-24.881s5.8315-20.329 13.456-25.338a26.649 26.649 0 0 1 25.219-1.9056c8.1825 3.483 19.169 4.4318 24.087 13.089 3.7796 6.6528 2.4181 21.495-0.25792 28.892-2.3129 6.394-7.9684 9.9966-13.483 12.013a45.34 45.34 0 0 1-37.511-3.0216",fill:"#2f2e41"}),s.jsx("polygon",{points:"223.38 568.71 211.72 564.91 220.8 518.14 238.01 523.74",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(72.575 -240.02) rotate(18.021)",d:"m372.58 718.9h23.644v14.887h-38.531a14.887 14.887 0 0 1 14.887-14.887z",fill:"#2f2e41"}),s.jsx("polygon",{points:"327.75 568.96 315.49 568.96 309.66 521.67 327.75 521.67",fill:"#ffb8b8"}),s.jsx("path",{d:"m306.73 565.46h23.644v14.887h-38.531a14.887 14.887 0 0 1 14.887-14.887z",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m497.75 708.65c-0.07373 0-0.14746-2e-3 -0.22168-0.00585l-13.586-0.64747a4.5061 4.5061 0 0 1-4.2854-4.4326l-1.8411-134.39a1.5 1.5 0 0 0-2.8267-0.67871l-71.958 136.44a4.4762 4.4762 0 0 1-4.822 2.3213l-13.521-2.5752a4.4992 4.4992 0 0 1-3.4014-5.918l52.43-148.55 4.0344-43.943a4.4698 4.4698 0 0 1 3.936-4.0498c15.277-1.877 36.624-14.395 45.092-19.689a4.446 4.446 0 0 1 3.5305-0.53125 4.5558 4.5558 0 0 1 2.8308 2.2451 202.75 202.75 0 0 1 22.277 123.98l-13.217 96.54a4.4752 4.4752 0 0 1-4.4507 3.8907z",fill:"#2f2e41"}),s.jsx("circle",{cx:"290.56",cy:"228.24",r:"24.561",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m436.71 516.82-7.3955-52.845a31.045 31.045 0 0 1 60.574-13.635c2.106 9.7686 6.385 21.66 4.8218 34.479-10.953 30.399-30.835 39.772-58 32z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m469.21 434.82h-18a4.5051 4.5051 0 0 1-4.5-4.5v-6a4.5051 4.5051 0 0 1 4.5-4.5h18a4.5051 4.5051 0 0 1 4.5 4.5v6a4.5051 4.5051 0 0 1-4.5 4.5z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m560.44 534.7a10.743 10.743 0 0 0-8.7149-13.979l-56.029-80.214-16.614 16.425 60.299 73.683a10.801 10.801 0 0 0 21.059 4.0847z",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m513.22 465.05-20.234 13.507a4.8169 4.8169 0 0 1-7.0291-1.9475l-10.365-21.928a13.377 13.377 0 0 1 22.295-14.789l16.229 17.919a4.8169 4.8169 0 0 1-0.8968 7.2386z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m362.5 426.92a10.526 10.526 0 0 1 0.2393 1.6401l42.957 24.782 10.441-6.0109 11.131 14.572-17.45 12.438a8 8 0 0 1-9.5982-0.23384l-44.297-34.946a10.497 10.497 0 1 1 6.5757-12.241z",fill:"#ffb8b8"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m418.18 471.35-10.794-21.802a4.8169 4.8169 0 0 1 2.835-6.7204l23.078-7.4597a13.377 13.377 0 0 1 11.8 24.012l-19.857 13.79a4.8169 4.8169 0 0 1-7.0632-1.82z",fill:"#b3b3b3"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m477.67 356.34a4.0633 4.0633 0 0 0 4.3168-2.4094 5.8506 5.8506 0 0 0-0.41558-5.1377 10.736 10.736 0 0 0-3.7759-3.7034 12.406 12.406 0 0 0-5.9816-2.0579 7.4612 7.4612 0 0 0-5.7939 2.1993 5.3768 5.3768 0 0 0-0.97171 5.9276c0.89811 1.7319 2.7825 2.7031 4.6186 3.3625a27.094 27.094 0 0 0 11.378 1.4944",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m485.52 398.45c-4.2928 0.20179-3.5536-8.9072-4.8971-12.989s-3.1955-8.9513-7.4212-9.734c-3.463-0.6414-6.5925 1.8908-9.609 3.7086-5.3764 3.24-12.336 4.4352-17.981 1.6906s-9.0786-10.078-6.3329-15.723a12.876 12.876 0 0 1 8.049-6.3415 25.906 25.906 0 0 1 10.462-0.50253 53.527 53.527 0 0 1 21.886 7.7574c4.5819 2.8736 8.9417 6.7864 10.306 12.02s1.9198 19.465-3.413 20.366z",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m474.29 343.67c-3.2427-4.1108-2.0213-10.588 1.7582-14.211s9.3995-4.7529 14.615-4.292a29.621 29.621 0 0 1 24.025 17.275c3.2959 7.5393 3.2687 16.163 6.2494 23.832a32.137 32.137 0 0 0 43.41 17.543c5.1881-2.3921 10.128-7.0763 9.8321-12.782 3.2802 12.646-2.6276 27.112-13.823 33.847-6.5573 3.9448-14.323 5.284-21.92 6.2056-4.9507 0.60059-10.039 1.0474-14.87-0.18987-6.7592-1.731-12.418-6.7198-15.845-12.798s-4.7748-13.161-4.827-20.138c-0.04071-5.4353 0.67085-10.873 0.29483-16.296s-2.0061-11.031-5.9367-14.785-10.564-4.9899-14.878-1.6831c-1.7337 1.329-3.0043 3.2697-4.9563 4.2502s-5.036 0.21793-5.1666-1.9626z",fill:"#2f2e41"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m380.18 427.1h-202.58a6.9935 6.9935 0 0 1-6.9854-6.9854v-114.1a6.9936 6.9936 0 0 1 6.9854-6.9854h202.58a6.9933 6.9933 0 0 1 6.9854 6.9854v114.1a6.9933 6.9933 0 0 1-6.9854 6.9854zm-202.58-126.51a5.4392 5.4392 0 0 0-5.4331 5.4331v114.1a5.4392 5.4392 0 0 0 5.4331 5.4331h202.58a5.4395 5.4395 0 0 0 5.4331-5.4331v-114.1a5.4394 5.4394 0 0 0-5.4331-5.4331z",fill:"#3f3d56"}),s.jsx("circle",{cx:"73.768",cy:"191.12",r:"28.967",fill:"#e6e6e6"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m356.01 401.31-34.003-58.895a2.4215 2.4215 0 0 0-4.1941 0l-20.751 35.942-30.936-53.582a3.1047 3.1047 0 0 0-5.3774 0l-43.596 75.511a3.1046 3.1046 0 0 0 2.6887 4.657h134.07a2.4215 2.4215 0 0 0 2.0971-3.6322z",fill:"currentColor"}),s.jsx("rect",{x:"14.747",y:"153.97",width:"12.419",height:"12.419",fill:"#3f3d56"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m459.04 259.1h-158.29a5.4645 5.4645 0 0 1-5.4581-5.4582v-89.15a5.4645 5.4645 0 0 1 5.4581-5.4582h158.29a5.4643 5.4643 0 0 1 5.4582 5.4582v89.15a5.4643 5.4643 0 0 1-5.4582 5.4582zm-158.29-98.853a4.25 4.25 0 0 0-4.2452 4.2452v89.15a4.25 4.25 0 0 0 4.2452 4.2452h158.29a4.2502 4.2502 0 0 0 4.2452-4.2452v-89.15a4.2502 4.2502 0 0 0-4.2452-4.2452z",fill:"#ccc"}),s.jsx("circle",{cx:"182.31",cy:"39.947",r:"22.634",fill:"#f2f2f2"}),s.jsx("path",{transform:"translate(-170.62 -159.03)",d:"m440.15 238.95-26.569-46.018a1.892 1.892 0 0 0-3.2771 0l-16.214 28.084-24.172-41.867a2.4259 2.4259 0 0 0-4.2017 0l-34.064 59.001a2.4258 2.4258 0 0 0 2.1008 3.6388h104.76a1.8921 1.8921 0 0 0 1.6386-2.8381z",fill:"#e6e6e6"}),s.jsx("rect",{x:"136.2",y:"10.916",width:"9.7034",height:"9.7034",fill:"#ccc"})]})})}),w?.length>0&&s.jsx("div",{className:"qc:grid qc:grid-cols-1 qc:gap-4 qc:gap-y-6 qc:pb-16 qc:sm:grid-cols-3 qc:mt-4",children:w?.map(a=>s.jsx(j,{to:d.GALLERY(a.slug),children:s.jsx(I,{event:a})},a._id))})]}),s.jsx(p,{})]})};export{T as default};
@@ -1 +1 @@
1
- import{j as e,c as r,T as t,_ as a,d as c,b as s,u as n,H as i,k as o,i as l,$ as d,S as m,h as q,N as h,P as u,E as g,w as p,J as x,g as f,a0 as v,I as j}from"./DBnzOELO.js";import{useState as b,useEffect as y,lazy as N,Fragment as w}from"react";import{D as k,a as E,b as I,c as _,d as C}from"./fuEo08KS.js";import{L as $}from"./Y9TU3Znq.js";import{V as S}from"./CfZ5_7x-.js";const T=(e,r)=>`${Number.parseFloat(e?.toFixed(r)??0)}`,A=(e,r)=>{switch(Math.floor(Math.abs(e-r))){case 0:return"qc:bg-green-500";case 1:return"qc:bg-lime-500";case 2:return"qc:bg-yellow-500";case 3:return"qc:bg-orange-500";case 4:return"qc:bg-red-500";default:return"qc:bg-background-500"}},O=(e,r)=>{switch(Math.floor(Math.abs(e-r))){case 0:return"qc:border-t-green-500";case 1:return"qc:border-t-lime-500";case 2:return"qc:border-t-yellow-500";case 3:return"qc:border-t-orange-500";case 4:return"qc:border-t-red-500";default:return"qc:border-t-color-500"}},z=({position:r,maxPosition:t=4,content:a,isOverlapping:c,colorclsx:s,borderColorclsx:n})=>{const i=r/t*100;let o="qc:transform qc:-translate-x-1/2 qc:left-1/2";r<2?o="qc:left-0":r>3&&(o="qc:right-0 qc:transform qc:-translate-x-full");const l=c?"qc:-top-1.5":"qc:bottom-full";return e.jsxs("div",{className:"qc:relative",children:[e.jsx("div",{style:{left:`${i}%`},className:`qc:absolute ${l} qc:text-primary-foreground qc:mb-0.5 qc:w-fit qc:whitespace-nowrap qc:rounded-md qc:px-2 qc:py-1 qc:text-sm qc:md:mb-1 ${o} qc:transition-all qc:duration-500 qc:ease-in-out ${s}`,children:a}),e.jsx("div",{style:{left:`${i}%`},className:`qc:absolute ${l} qc:-mb-1.5 qc:size-0 qc:border-x-4 qc:border-t-[1rem] qc:border-transparent ${o} qc:transition-all qc:duration-500 qc:ease-in-out ${n}`})]})},R=t=>{const{crowdScore:a,userScore:c}=t,[s,n]=b(0);y(()=>{setTimeout(()=>{n(c-1)},300)},[c]);const i=a-1,o=c-1,l=Math.abs(i-o)<1;return e.jsxs("div",{className:r("qc:relative qc:h-4",l?"qc:mb-3":"qc:mb-0"),children:[e.jsx("div",{className:"qc:absolute qc:top-1/2 qc:h-0.5 qc:w-full qc:bg-border-primary-light"}),e.jsx("div",{style:{left:(i<s?i:s)/4*100+"%",right:`calc(100% - ${(i<s?s:i)/4*100}%)`},className:r("qc:absolute qc:top-1/2 qc:h-1 qc:rounded",A(i,o))}),e.jsx(z,{position:i,content:`crowd · ${T(a,1)}`,isOverlapping:!1,colorclsx:"qc:bg-primary",borderColorclsx:"qc:border-t-primary"}),e.jsx(z,{position:s,content:`you · ${T(c,1)}`,isOverlapping:l,colorclsx:A(i,o),borderColorclsx:O(i,o)})]})},P=N(()=>import("./DYrfBufu.js").then(e=>e.i)),F=N(()=>import("./CXu6PHUW.js")),M=({feedback:r})=>{const a="#374151",[c,s]=b(10);return y(()=>{const e=(r?.parameters||[]).reduce((e,r)=>e+Math.abs(parseFloat(r.crowdRating)-parseFloat(r.userRating)),0);s(e.toFixed?e.toFixed(2):0)},[r]),r?e.jsxs("div",{className:"qc:w-full",children:[r.rateCount<=0&&e.jsxs("div",{className:"qc:-mt-4 qc:mb-4 qc:flex qc:flex-col qc:items-center",children:[e.jsx(F,{className:"qc:h-auto qc:w-72 qc:sm:h-72 qc:sm:w-auto",src:"https://res.cloudinary.com/dxtjlcra0/raw/upload/v1740374960/star-explode_h2nytb.lottie",autoplay:!0,loop:!0}),e.jsx(t,{variant:"h5",align:"center",children:"Congratulations! You are the first to rate"})]}),r.rateCount>0&&e.jsxs("div",{className:"qc:mt-4",children:[(r.parameters||[]).map(r=>e.jsxs("div",{className:"qc:mt-4 qc:space-y-4",children:[e.jsx(t,{variant:"h5",children:r.name}),e.jsx(R,{crowdScore:parseFloat(r.crowdRating),userScore:parseFloat(r.userRating)})]},r.name)),e.jsxs("div",{className:"qc:mt-4 qc:flex qc:w-full qc:flex-col qc:items-center",children:[e.jsx(P,{nrOfLevels:10,percent:(10-c)/10,colors:["#ef4444","#22c55e"],textColor:a,needleColor:a,needleBaseColor:a}),e.jsx(t,{variant:"h6",children:"Alignment with crowd"})]})]})]}):null},U=N(()=>import("./CXu6PHUW.js")),B=({parameter:c,selected:s,onChange:n,showValues:i=!0})=>e.jsxs("div",{className:"qc:mb-8 qc:flex qc:w-full qc:flex-col qc:gap-2 qc:lg:mb-12 qc:lg:gap-4",children:[e.jsx(t,{variant:"h4",className:"qc:text-center qc:font-semibold qc:text-primary-light qc:md:text-left",children:c.name}),e.jsx("div",{className:"qc:grid qc:w-full qc:grid-cols-5 qc:gap-1 qc:lg:gap-2",children:(c.tooltips||[]).map(t=>{const o=`${c._id}-option-${t.value}`;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:r("qc:border-primary qc:shadow-outer qc:flex qc:size-full qc:min-h-12 qc:items-center qc:justify-center qc:rounded qc:border qc:transition-all qc:duration-100 qc:active:scale-90",s===t.value?"qc:bg-primary":"qc:bg-background"),onClick:()=>{s!==t.value&&n?.(t.value)},children:[c.mode===a.TEXT&&e.jsx("div",{className:r("qc:p-1 qc:text-center qc:text-xs qc:font-semibold qc:md:p-2 qc:md:text-base",s===t.value?"qc:text-primary-foreground":"qc:text-foreground"),children:t.label}),c.mode===a.IMAGE&&e.jsx("img",{className:"qc:h-12 qc:w-auto qc:rounded-md qc:object-contain qc:lg:h-16",src:t.imageUrl,alt:t.value}),c.mode===a.LOTTIE&&e.jsx(U,{className:"qc:h-16 qc:w-auto qc:rounded-md qc:object-contain qc:lg:h-24",src:t.imageUrl,autoplay:!0,loop:!0})]}),i&&e.jsx("div",{className:"qc:mt-1 qc:w-full qc:text-center",children:e.jsx("span",{className:"qc:text-foreground qc:inline-flex qc:items-center qc:px-2 qc:py-[0.0625] qc:text-xs qc:font-medium qc:md:px-3 qc:md:py-0.5",children:t.value})})]},o)})})]});var L,D,G=function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var a,c,s=t.call(e),n=[];try{for(;(void 0===r||r-- >0)&&!(a=s.next()).done;)n.push(a.value)}catch(e){c={error:e}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(c)throw c.error}}return n};function V(e,r,t,a,c,s,n,i,o,l,d){var m,q,h,u;if(0!==n)if(n!==t-r+(s-c)){for(var g=t-r,p=s-c,x=Math.floor(p/2),f={},v=-n-1;v<=n+1;++v)f[v]={d:1/0,segments:0,direct:L.none};for(var j=((m={})[-n-1]={d:1/0,segments:0,direct:L.none},m[n+1]={d:1/0,segments:0,direct:L.none},m),b=0;b<=x;++b){q=G([j,f],2),f=q[0],j=q[1];var y=function(t){var s=b+t;if(0===b&&0===s)return f[t]={d:0,segments:0,direct:i},"continue";var n=[{direct:L.horizontal,d:f[t-1].d+1,segments:f[t-1].segments+(f[t-1].direct&L.horizontal?0:1)},{direct:L.vertical,d:j[t+1].d+1,segments:j[t+1].segments+(j[t+1].direct&L.vertical?0:1)}];s>0&&s<=g&&b>0&&b<=p&&l(e[r+s-1],a[c+b-1])&&n.push({direct:L.diagonal,d:j[t].d,segments:j[t].segments+(j[t].direct&L.diagonal?0:1)});var o=n.reduce(function(e,r){return e.d>r.d||e.d===r.d&&e.segments>r.segments?r:e});n.forEach(function(e){o.d===e.d&&o.segments===e.segments&&(o.direct|=e.direct)}),f[t]=o};for(v=-n;v<=n;++v)y(v)}var N={};for(v=-n-1;v<=n+1;++v)N[v]={d:1/0,segments:0,direct:L.none};var w=((h={})[-n-1]={d:1/0,segments:0,direct:L.none},h[n+1]={d:1/0,segments:0,direct:L.none},h);for(b=p;b>=x;--b){u=G([w,N],2),N=u[0],w=u[1];var k=function(t){var s=b+t;if(b===p&&s===g)return N[t]={d:0,segments:0,direct:o},"continue";var n=[{direct:L.horizontal,d:N[t+1].d+1,segments:N[t+1].segments+(N[t+1].direct&L.horizontal?0:1)},{direct:L.vertical,d:w[t-1].d+1,segments:w[t-1].segments+(w[t-1].direct&L.vertical?0:1)}];s>=0&&s<g&&b>=0&&b<p&&l(e[r+s],a[c+b])&&n.push({direct:L.diagonal,d:w[t].d,segments:w[t].segments+(w[t].direct&L.diagonal?0:1)});var i=n.reduce(function(e,r){return e.d>r.d||e.d===r.d&&e.segments>r.segments?r:e});n.forEach(function(e){i.d===e.d&&i.segments===e.segments&&(i.direct|=e.direct)}),N[t]=i};for(v=n;v>=-n;--v)k(v)}var E={k:-1,d:1/0,segments:0,direct:L.none};for(v=-n;v<=n;++v){var I=f[v].d+N[v].d;if(I<E.d)E.k=v,E.d=I,E.segments=f[v].segments+N[v].segments+(f[v].segments&N[v].segments?0:1),E.direct=N[v].direct;else if(I===E.d){var _=f[v].segments+N[v].segments+(f[v].segments&N[v].segments?0:1);(_<E.segments||_===E.segments&&!(E.direct&L.diagonal)&&N[v].direct&L.diagonal)&&(E.k=v,E.d=I,E.segments=_,E.direct=N[v].direct)}}x+E.k===0&&0===x&&(x++,f[E.k].direct=N[E.k].direct,N[E.k].direct=w[E.k].direct),V(e,r,r+x+E.k,a,c,c+x,f[E.k].d,i,N[E.k].direct,l,d),V(e,r+x+E.k,t,a,c+x,s,N[E.k].d,f[E.k].direct,o,l,d)}else(i&L.horizontal?1:0)+(o&L.vertical?1:0)>=(i&L.vertical?1:0)+(o&L.horizontal?1:0)?(r!==t&&d("remove",e,r,t,a,c,c),c!==s&&d("add",e,t,t,a,c,s)):(c!==s&&d("add",e,r,r,a,c,s),r!==t&&d("remove",e,r,t,a,s,s));else d("same",e,r,t,a,c,s)}function W(e,r,t,a){var c=function(e,r,t){for(var a=e.length,c=r.length,s=a+c,n={1:0},i=0;i<=s;++i)for(var o=-i;o<=i;o+=2){for(var l=void 0,d=(l=o===-i||o!==i&&n[o-1]+1<n[o+1]?n[o+1]:n[o-1]+1)-o;l<a&&d<c&&t(e[l],r[d]);)l++,d++;if(l===a&&d===c)return i;n[o]=l}return-1}(e,r,t);V(e,0,e.length,r,0,r.length,c,L.diagonal,L.all,t,a)}(D=L||(L={}))[D.none=0]="none",D[D.horizontal=1]="horizontal",D[D.vertical=2]="vertical",D[D.diagonal=4]="diagonal",D[D.all=7]="all";const Y=()=>{const r=c(),{eventSlug:a,contentId:j}=s(),{props:{organizationId:N,loginUrl:T},user:A,loadingUser:O,organization:z}=n(),[R,P]=b(!1),[F,U]=b(null),[L,D]=b([]),[G,V]=b(null),[Y,J]=b("contain"),[X,K]=b({}),[Q,Z]=b(null),[ee,re]=b(!1),[te,ae]=b(!0),[ce,se]=b(null),{loading:ne,event:ie,parameters:oe}=i({eventSlug:a});y(()=>{ie&&A&&de(ie._id)},[ie,A]);const le=z?.navigationSettings?.showAIDescription,de=async e=>{P(!0);try{const r=await o.get(l.CONTENT_FOR_CURATION,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{eventId:e,page:1,limit:10,includeDescription:le}}).json();if(r.error)throw new Error(r.error);const t=j?r.data.filter(e=>e._id!==j):r.data;let a,c=t;if(j){const e=await o.get(l.ELIGIBLE_TO_CURATE,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{contentId:j,includeDescription:le}}).json();if(e.error)throw new Error(e.error);const r=e.data;c=r?[r,...t]:t||[],a=r&&r.userId===A?._id?"Sorry, you cannot rate your own content":r&&r.ratingStatus===d.CURATED?"Sorry, you have already rated this photo.":null}const s=await o.get(l.GET_EVENT_POINTS,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{eventId:e}}).json();if(s.error)throw new Error(s.error);V(s.data),D(c),U(a)}catch(e){console.error("Failed to fetch contents",e)}P(!1)},me=async e=>{try{const r=await o.get(l.CONTENT_FOR_CURATION,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{eventId:ie?._id,page:1,limit:10,includeDescription:le}});if(r.error)throw new Error(r.error);if(r?.data?.length>0){const t=function(e,r,t){void 0===t&&(t=function(e,r){return e===r});var a={removed:[],added:[]};return W(e,r,t,function(e,r,t,c,s,n,i){if("add"===e)for(var o=n;o<i;++o)a.added.push(s[o]);else if("remove"===e)for(o=t;o<c;++o)a.removed.push(r[o])}),a}(e,r.data,(e,r)=>e._id===r._id),a=[...e,...t.added];D(a)}}catch(e){console.error(e)}},qe=()=>{const e=L.slice(1);U(null),Z(null),K({}),e.length===v?me(e):D(e),ae(!0)};if(O)return e.jsx(m,{className:"qc:mx-auto qc:h-6 qc:w-64"});if(!A){if(!z.customAuth)return e.jsx(h,{to:u.LOGIN,state:{referrer:r.pathname}});if(!T)return e.jsx(q,{title:"Please login to upload content"});window.history.pushState({},"",T)}return e.jsx("div",{className:"qc:min-h-[80vh]",children:R||ne?e.jsxs("div",{className:"qc:mt-8 qc:grid qc:grid-cols-1 qc:gap-6 qc:md:grid-cols-2",children:[e.jsx(m,{className:"qc:h-64 qc:w-full qc:md:h-[30rem] qc:md:max-h-screen qc:md:rounded"}),e.jsx("div",{className:"qc:space-y-8",children:Array.from({length:2}).map((r,t)=>e.jsxs("div",{className:"qc:space-y-4",children:[e.jsx(m,{className:"qc:h-8 qc:w-36"}),e.jsx("div",{className:"qc:flex qc:w-full qc:gap-4",children:Array.from({length:5}).map((r,t)=>e.jsx(m,{className:"qc:h-24 qc:w-full qc:sm:h-32"},t))})]},t))})]}):e.jsxs("div",{className:"qc:lg:mt-8",children:[ie?.status===g.CLOSED&&e.jsx(t,{variant:"h3",color:"primary",align:"center",children:"Event is now closed. Thank you for participating!"}),ie?.status===g.OPEN&&L.length<=0&&e.jsx(t,{variant:"h3",color:"primary",align:"center",children:"No content to rate. Please find another event to rate contents."}),ie?.status===g.OPEN&&L.length>0&&e.jsxs("div",{children:[!(oe?.length<=0&&le)&&e.jsxs("div",{className:"qc:flex qc:w-full qc:items-center qc:justify-between",children:[e.jsxs(t,{variant:"h4",children:["Rate this ",L[0].type===p.IMAGE?"image":"video"]}),e.jsxs(t,{variant:"h4",children:[ie?.pointName,":"," ",e.jsx("span",{className:"qc:text-primary",children:G.upload+G.curate})]})]}),e.jsxs("div",{className:"qc:grid qc:grid-cols-1 qc:gap-6 qc:md:grid-cols-2",children:[e.jsxs("div",{className:"qc:relative qc:mt-4 qc:w-full",children:[L[0].type===p.IMAGE&&e.jsx(w,{children:e.jsx($,{sizeMode:Y,src:L[0].url,alt:L[0].caption,blurhash:L[0].blurhash,wrapperClassName:"qc:w-full qc:h-60 qc:md:h-[30rem] qc:md:max-h-screen qc:md:rounded"})}),L[0].type===p.VIDEO&&e.jsx("div",{className:"qc:mx-auto qc:h-80 qc:w-fit qc:overflow-hidden qc:rounded qc:sm:h-[30rem]",children:e.jsx(S,{fit:Y,src:L[0].url,loop:!0,playing:te,volume:0,muted:!0,onPlay:()=>ae(!0),onPause:()=>ae(!1),onEnd:()=>ae(!1)})}),L[0].caption&&L[0].caption.length>0&&e.jsx("div",{className:"qc:bg-background qc:absolute qc:bottom-0 qc:w-full qc:bg-opacity-75 qc:p-2",children:e.jsx(t,{variant:"body3",lines:"2",children:L[0].caption})}),L.length>1&&e.jsx("img",{style:{display:"none"},src:L[1].url,alt:"Next image"})]}),e.jsxs("div",{className:"qc:px-2 qc:md:px-4",children:[!F&&oe&&oe.map(r=>e.jsx(B,{parameter:r,selected:X[r._id],onChange:e=>K({...X,[r._id]:e})},r._id)),ce&&oe?.length>0&&e.jsx(t,{variant:"h5",color:"error",children:ce}),F&&oe?.length>0&&e.jsx("div",{className:"qc:sm:pt-16",children:e.jsx(t,{variant:"h5",color:"error",align:"center",children:F})}),oe?.length>0&&e.jsx(x,{type:"button",color:"primary",className:"qc:mt-4 qc:w-full",disabled:ee,loading:ee,icon:"material-symbols:check-rounded",onClick:F?qe:async()=>{if(oe.length<1)return void se("no parameters found");if(Object.keys(X).length<oe.length)return void se("please select your ratings");se(null),re(!0);const e=await o.post(l.CURATE_CONTENT,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},json:{eventId:ie._id,contentId:L[0]._id,parameterCount:oe.length,userRatings:oe.map(e=>({parameterId:e._id,weight:e.weight,rate:X[e._id]})),inappropriate:""}}).json();if(e.error)se(e.error);else{const r=e.data,t=r.crowdRatings||{},a={parameters:oe.map(e=>({name:e.name,crowdRating:t[e._id],userRating:r.ratings?.find(r=>r.parameterId===e._id)?.rate})),similarity:r.similarity||null,points:r.points||0,rateCount:r.rateCount||0};Z(a);const c={...G};c.curate+=ie.activityScores.curate,V(c)}re(!1)},children:F?"Rate Next Image":ee?"Rating...":"Submit"}),L?.length>0&&le&&e.jsx(H,{summary:L[0].contentSummary,url:L[0].url})]})]}),e.jsx("div",{className:"qc:mt-16",children:e.jsx(f,{to:u.GALLERY(a),state:{internalNavigation:!0},children:e.jsx(t,{color:"primary",variant:"h5",align:"center",children:"Goto gallery"})})})]}),e.jsx(k,{open:!!Q,onOpenChange:e=>!e&&qe(),children:e.jsxs(E,{children:[e.jsxs(I,{children:[e.jsxs(_,{className:"qc:hidden",children:[ie?.pointName,": ",G?.upload+G?.curate]}),e.jsx(C,{className:"qc:hidden",children:"We are here to help you"})]}),e.jsxs("div",{className:"qc:w-full qc:space-y-3 qc:px-3 qc:pb-6 qc:lg:px-6",children:[e.jsx(M,{feedback:Q}),e.jsx(x,{fullWidth:!0,color:"primary",onClick:qe,children:"Next"})]})]})})]})})},H=({summary:r,url:a})=>e.jsxs("div",{className:"qc:w-full",children:[r?.subject&&e.jsx(t,{variant:"h3",className:"qc:mb-4",align:"center",children:r?.subject}),r?.labels&&e.jsx("div",{className:"qc:space-y-2",children:Object.entries(r?.labels).filter(([e,r])=>Array.isArray(r)&&r.length>0).map(([r,a])=>e.jsxs("div",{className:"",children:[e.jsx(t,{variant:"h4",className:"qc:mb-2 qc:font-semibold qc:capitalize",children:r.replace("_"," ")}),e.jsx("ul",{className:"qc:space-y-1 qc:pl-2",children:a.map((r,a)=>e.jsxs("li",{className:"qc:flex qc:items-center qc:gap-2",children:[e.jsx(j,{name:"material-symbols:check-circle-outline",className:"qc:text-primary"}),e.jsx(t,{variant:"body1",children:r}),e.jsx("a",{href:`https://www.google.com/search?q=${encodeURIComponent(r)}`,target:"_blank",rel:"noopener noreferrer",className:"qc:ml-2",children:e.jsx(x,{variant:"outlined",icon:"flat-color-icons:google",children:e.jsx(j,{name:"material-symbols:open-in-new-rounded",size:"sm"})})})]},a))})]},r))}),r?.description&&e.jsxs(w,{children:[e.jsx("hr",{className:"qc:my-4 qc:lg:my-8"}),e.jsx(t,{variant:"body2",children:r?.description})]}),e.jsx("div",{className:"qc:mt-4 qc:flex qc:justify-center qc:lg:mt-8",children:e.jsx("a",{target:"_blank",href:`https://www.bing.com/images/search?view=detailv2&iss=SBI&form=SBIIRP&sbisrc=UrlPaste&q=imgurl:${a}&idpbck=1&selectedindex=0&id=${a}&mediaurl=${a}&exph=480&expw=640&vt=3&sim=11&cal=0&cab=1&cat=0&car=1`,rel:"noopener noreferrer",children:e.jsx(x,{icon:"logos:bing",variant:"outlined",color:"info",children:"Search on Bing"})})}),r&&e.jsx(t,{variant:"caption",align:"center",color:"secondary",className:"qc:mt-4 qc:lg:mt-8",children:"These are AI generated summaries based on the content. Please verify the information before using it."})]});export{Y as default};
1
+ import{j as e,c as r,T as t,_ as a,d as c,b as s,u as n,H as i,k as o,i as l,$ as d,S as m,h as q,N as h,P as u,E as g,w as p,J as x,g as f,a0 as v,I as j}from"./ChmTNpp8.js";import{useState as b,useEffect as y,lazy as N,Fragment as w}from"react";import{D as k,a as E,b as I,c as _,d as C}from"./CaxUtbJe.js";import{L as $}from"./0VQzlcgi.js";import{V as S}from"./BYvYuEdt.js";const T=(e,r)=>`${Number.parseFloat(e?.toFixed(r)??0)}`,A=(e,r)=>{switch(Math.floor(Math.abs(e-r))){case 0:return"qc:bg-green-500";case 1:return"qc:bg-lime-500";case 2:return"qc:bg-yellow-500";case 3:return"qc:bg-orange-500";case 4:return"qc:bg-red-500";default:return"qc:bg-background-500"}},O=(e,r)=>{switch(Math.floor(Math.abs(e-r))){case 0:return"qc:border-t-green-500";case 1:return"qc:border-t-lime-500";case 2:return"qc:border-t-yellow-500";case 3:return"qc:border-t-orange-500";case 4:return"qc:border-t-red-500";default:return"qc:border-t-color-500"}},z=({position:r,maxPosition:t=4,content:a,isOverlapping:c,colorclsx:s,borderColorclsx:n})=>{const i=r/t*100;let o="qc:transform qc:-translate-x-1/2 qc:left-1/2";r<2?o="qc:left-0":r>3&&(o="qc:right-0 qc:transform qc:-translate-x-full");const l=c?"qc:-top-1.5":"qc:bottom-full";return e.jsxs("div",{className:"qc:relative",children:[e.jsx("div",{style:{left:`${i}%`},className:`qc:absolute ${l} qc:text-primary-foreground qc:mb-0.5 qc:w-fit qc:whitespace-nowrap qc:rounded-md qc:px-2 qc:py-1 qc:text-sm qc:md:mb-1 ${o} qc:transition-all qc:duration-500 qc:ease-in-out ${s}`,children:a}),e.jsx("div",{style:{left:`${i}%`},className:`qc:absolute ${l} qc:-mb-1.5 qc:size-0 qc:border-x-4 qc:border-t-[1rem] qc:border-transparent ${o} qc:transition-all qc:duration-500 qc:ease-in-out ${n}`})]})},R=t=>{const{crowdScore:a,userScore:c}=t,[s,n]=b(0);y(()=>{setTimeout(()=>{n(c-1)},300)},[c]);const i=a-1,o=c-1,l=Math.abs(i-o)<1;return e.jsxs("div",{className:r("qc:relative qc:h-4",l?"qc:mb-3":"qc:mb-0"),children:[e.jsx("div",{className:"qc:absolute qc:top-1/2 qc:h-0.5 qc:w-full qc:bg-border-primary-light"}),e.jsx("div",{style:{left:(i<s?i:s)/4*100+"%",right:`calc(100% - ${(i<s?s:i)/4*100}%)`},className:r("qc:absolute qc:top-1/2 qc:h-1 qc:rounded",A(i,o))}),e.jsx(z,{position:i,content:`crowd · ${T(a,1)}`,isOverlapping:!1,colorclsx:"qc:bg-primary",borderColorclsx:"qc:border-t-primary"}),e.jsx(z,{position:s,content:`you · ${T(c,1)}`,isOverlapping:l,colorclsx:A(i,o),borderColorclsx:O(i,o)})]})},P=N(()=>import("./DwbNwe-K.js").then(e=>e.i)),F=N(()=>import("./zUd27y38.js")),M=({feedback:r})=>{const a="#374151",[c,s]=b(10);return y(()=>{const e=(r?.parameters||[]).reduce((e,r)=>e+Math.abs(parseFloat(r.crowdRating)-parseFloat(r.userRating)),0);s(e.toFixed?e.toFixed(2):0)},[r]),r?e.jsxs("div",{className:"qc:w-full",children:[r.rateCount<=0&&e.jsxs("div",{className:"qc:-mt-4 qc:mb-4 qc:flex qc:flex-col qc:items-center",children:[e.jsx(F,{className:"qc:h-auto qc:w-72 qc:sm:h-72 qc:sm:w-auto",src:"https://res.cloudinary.com/dxtjlcra0/raw/upload/v1740374960/star-explode_h2nytb.lottie",autoplay:!0,loop:!0}),e.jsx(t,{variant:"h5",align:"center",children:"Congratulations! You are the first to rate"})]}),r.rateCount>0&&e.jsxs("div",{className:"qc:mt-4",children:[(r.parameters||[]).map(r=>e.jsxs("div",{className:"qc:mt-4 qc:space-y-4",children:[e.jsx(t,{variant:"h5",children:r.name}),e.jsx(R,{crowdScore:parseFloat(r.crowdRating),userScore:parseFloat(r.userRating)})]},r.name)),e.jsxs("div",{className:"qc:mt-4 qc:flex qc:w-full qc:flex-col qc:items-center",children:[e.jsx(P,{nrOfLevels:10,percent:(10-c)/10,colors:["#ef4444","#22c55e"],textColor:a,needleColor:a,needleBaseColor:a}),e.jsx(t,{variant:"h6",children:"Alignment with crowd"})]})]})]}):null},U=N(()=>import("./zUd27y38.js")),B=({parameter:c,selected:s,onChange:n,showValues:i=!0})=>e.jsxs("div",{className:"qc:mb-8 qc:flex qc:w-full qc:flex-col qc:gap-2 qc:lg:mb-12 qc:lg:gap-4",children:[e.jsx(t,{variant:"h4",className:"qc:text-center qc:font-semibold qc:text-primary-light qc:md:text-left",children:c.name}),e.jsx("div",{className:"qc:grid qc:w-full qc:grid-cols-5 qc:gap-1 qc:lg:gap-2",children:(c.tooltips||[]).map(t=>{const o=`${c._id}-option-${t.value}`;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:r("qc:border-primary qc:shadow-outer qc:flex qc:size-full qc:min-h-12 qc:items-center qc:justify-center qc:rounded qc:border qc:transition-all qc:duration-100 qc:active:scale-90",s===t.value?"qc:bg-primary":"qc:bg-background"),onClick:()=>{s!==t.value&&n?.(t.value)},children:[c.mode===a.TEXT&&e.jsx("div",{className:r("qc:p-1 qc:text-center qc:text-xs qc:font-semibold qc:md:p-2 qc:md:text-base",s===t.value?"qc:text-primary-foreground":"qc:text-foreground"),children:t.label}),c.mode===a.IMAGE&&e.jsx("img",{className:"qc:h-12 qc:w-auto qc:rounded-md qc:object-contain qc:lg:h-16",src:t.imageUrl,alt:t.value}),c.mode===a.LOTTIE&&e.jsx(U,{className:"qc:h-16 qc:w-auto qc:rounded-md qc:object-contain qc:lg:h-24",src:t.imageUrl,autoplay:!0,loop:!0})]}),i&&e.jsx("div",{className:"qc:mt-1 qc:w-full qc:text-center",children:e.jsx("span",{className:"qc:text-foreground qc:inline-flex qc:items-center qc:px-2 qc:py-[0.0625] qc:text-xs qc:font-medium qc:md:px-3 qc:md:py-0.5",children:t.value})})]},o)})})]});var L,D,G=function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var a,c,s=t.call(e),n=[];try{for(;(void 0===r||r-- >0)&&!(a=s.next()).done;)n.push(a.value)}catch(e){c={error:e}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(c)throw c.error}}return n};function V(e,r,t,a,c,s,n,i,o,l,d){var m,q,h,u;if(0!==n)if(n!==t-r+(s-c)){for(var g=t-r,p=s-c,x=Math.floor(p/2),f={},v=-n-1;v<=n+1;++v)f[v]={d:1/0,segments:0,direct:L.none};for(var j=((m={})[-n-1]={d:1/0,segments:0,direct:L.none},m[n+1]={d:1/0,segments:0,direct:L.none},m),b=0;b<=x;++b){q=G([j,f],2),f=q[0],j=q[1];var y=function(t){var s=b+t;if(0===b&&0===s)return f[t]={d:0,segments:0,direct:i},"continue";var n=[{direct:L.horizontal,d:f[t-1].d+1,segments:f[t-1].segments+(f[t-1].direct&L.horizontal?0:1)},{direct:L.vertical,d:j[t+1].d+1,segments:j[t+1].segments+(j[t+1].direct&L.vertical?0:1)}];s>0&&s<=g&&b>0&&b<=p&&l(e[r+s-1],a[c+b-1])&&n.push({direct:L.diagonal,d:j[t].d,segments:j[t].segments+(j[t].direct&L.diagonal?0:1)});var o=n.reduce(function(e,r){return e.d>r.d||e.d===r.d&&e.segments>r.segments?r:e});n.forEach(function(e){o.d===e.d&&o.segments===e.segments&&(o.direct|=e.direct)}),f[t]=o};for(v=-n;v<=n;++v)y(v)}var N={};for(v=-n-1;v<=n+1;++v)N[v]={d:1/0,segments:0,direct:L.none};var w=((h={})[-n-1]={d:1/0,segments:0,direct:L.none},h[n+1]={d:1/0,segments:0,direct:L.none},h);for(b=p;b>=x;--b){u=G([w,N],2),N=u[0],w=u[1];var k=function(t){var s=b+t;if(b===p&&s===g)return N[t]={d:0,segments:0,direct:o},"continue";var n=[{direct:L.horizontal,d:N[t+1].d+1,segments:N[t+1].segments+(N[t+1].direct&L.horizontal?0:1)},{direct:L.vertical,d:w[t-1].d+1,segments:w[t-1].segments+(w[t-1].direct&L.vertical?0:1)}];s>=0&&s<g&&b>=0&&b<p&&l(e[r+s],a[c+b])&&n.push({direct:L.diagonal,d:w[t].d,segments:w[t].segments+(w[t].direct&L.diagonal?0:1)});var i=n.reduce(function(e,r){return e.d>r.d||e.d===r.d&&e.segments>r.segments?r:e});n.forEach(function(e){i.d===e.d&&i.segments===e.segments&&(i.direct|=e.direct)}),N[t]=i};for(v=n;v>=-n;--v)k(v)}var E={k:-1,d:1/0,segments:0,direct:L.none};for(v=-n;v<=n;++v){var I=f[v].d+N[v].d;if(I<E.d)E.k=v,E.d=I,E.segments=f[v].segments+N[v].segments+(f[v].segments&N[v].segments?0:1),E.direct=N[v].direct;else if(I===E.d){var _=f[v].segments+N[v].segments+(f[v].segments&N[v].segments?0:1);(_<E.segments||_===E.segments&&!(E.direct&L.diagonal)&&N[v].direct&L.diagonal)&&(E.k=v,E.d=I,E.segments=_,E.direct=N[v].direct)}}x+E.k===0&&0===x&&(x++,f[E.k].direct=N[E.k].direct,N[E.k].direct=w[E.k].direct),V(e,r,r+x+E.k,a,c,c+x,f[E.k].d,i,N[E.k].direct,l,d),V(e,r+x+E.k,t,a,c+x,s,N[E.k].d,f[E.k].direct,o,l,d)}else(i&L.horizontal?1:0)+(o&L.vertical?1:0)>=(i&L.vertical?1:0)+(o&L.horizontal?1:0)?(r!==t&&d("remove",e,r,t,a,c,c),c!==s&&d("add",e,t,t,a,c,s)):(c!==s&&d("add",e,r,r,a,c,s),r!==t&&d("remove",e,r,t,a,s,s));else d("same",e,r,t,a,c,s)}function W(e,r,t,a){var c=function(e,r,t){for(var a=e.length,c=r.length,s=a+c,n={1:0},i=0;i<=s;++i)for(var o=-i;o<=i;o+=2){for(var l=void 0,d=(l=o===-i||o!==i&&n[o-1]+1<n[o+1]?n[o+1]:n[o-1]+1)-o;l<a&&d<c&&t(e[l],r[d]);)l++,d++;if(l===a&&d===c)return i;n[o]=l}return-1}(e,r,t);V(e,0,e.length,r,0,r.length,c,L.diagonal,L.all,t,a)}(D=L||(L={}))[D.none=0]="none",D[D.horizontal=1]="horizontal",D[D.vertical=2]="vertical",D[D.diagonal=4]="diagonal",D[D.all=7]="all";const Y=()=>{const r=c(),{eventSlug:a,contentId:j}=s(),{props:{organizationId:N,loginUrl:T},user:A,loadingUser:O,organization:z}=n(),[R,P]=b(!1),[F,U]=b(null),[L,D]=b([]),[G,V]=b(null),[Y,J]=b("contain"),[X,K]=b({}),[Q,Z]=b(null),[ee,re]=b(!1),[te,ae]=b(!0),[ce,se]=b(null),{loading:ne,event:ie,parameters:oe}=i({eventSlug:a});y(()=>{ie&&A&&de(ie._id)},[ie,A]);const le=z?.navigationSettings?.showAIDescription,de=async e=>{P(!0);try{const r=await o.get(l.CONTENT_FOR_CURATION,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{eventId:e,page:1,limit:10,includeDescription:le}}).json();if(r.error)throw new Error(r.error);const t=j?r.data.filter(e=>e._id!==j):r.data;let a,c=t;if(j){const e=await o.get(l.ELIGIBLE_TO_CURATE,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{contentId:j,includeDescription:le}}).json();if(e.error)throw new Error(e.error);const r=e.data;c=r?[r,...t]:t||[],a=r&&r.userId===A?._id?"Sorry, you cannot rate your own content":r&&r.ratingStatus===d.CURATED?"Sorry, you have already rated this photo.":null}const s=await o.get(l.GET_EVENT_POINTS,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{eventId:e}}).json();if(s.error)throw new Error(s.error);V(s.data),D(c),U(a)}catch(e){console.error("Failed to fetch contents",e)}P(!1)},me=async e=>{try{const r=await o.get(l.CONTENT_FOR_CURATION,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},searchParams:{eventId:ie?._id,page:1,limit:10,includeDescription:le}});if(r.error)throw new Error(r.error);if(r?.data?.length>0){const t=function(e,r,t){void 0===t&&(t=function(e,r){return e===r});var a={removed:[],added:[]};return W(e,r,t,function(e,r,t,c,s,n,i){if("add"===e)for(var o=n;o<i;++o)a.added.push(s[o]);else if("remove"===e)for(o=t;o<c;++o)a.removed.push(r[o])}),a}(e,r.data,(e,r)=>e._id===r._id),a=[...e,...t.added];D(a)}}catch(e){console.error(e)}},qe=()=>{const e=L.slice(1);U(null),Z(null),K({}),e.length===v?me(e):D(e),ae(!0)};if(O)return e.jsx(m,{className:"qc:mx-auto qc:h-6 qc:w-64"});if(!A){if(!z.customAuth)return e.jsx(h,{to:u.LOGIN,state:{referrer:r.pathname}});if(!T)return e.jsx(q,{title:"Please login to upload content"});window.history.pushState({},"",T)}return e.jsx("div",{className:"qc:min-h-[80vh] qc:bg-background",children:R||ne?e.jsxs("div",{className:"qc:mt-8 qc:grid qc:grid-cols-1 qc:gap-6 qc:md:grid-cols-2",children:[e.jsx(m,{className:"qc:h-64 qc:w-full qc:md:h-[30rem] qc:md:max-h-screen qc:md:rounded"}),e.jsx("div",{className:"qc:space-y-8",children:Array.from({length:2}).map((r,t)=>e.jsxs("div",{className:"qc:space-y-4",children:[e.jsx(m,{className:"qc:h-8 qc:w-36"}),e.jsx("div",{className:"qc:flex qc:w-full qc:gap-4",children:Array.from({length:5}).map((r,t)=>e.jsx(m,{className:"qc:h-24 qc:w-full qc:sm:h-32"},t))})]},t))})]}):e.jsxs("div",{className:"qc:lg:mt-8",children:[ie?.status===g.CLOSED&&e.jsx(t,{variant:"h3",color:"primary",align:"center",children:"Event is now closed. Thank you for participating!"}),ie?.status===g.OPEN&&L.length<=0&&e.jsx(t,{variant:"h3",color:"primary",align:"center",children:"No content to rate. Please find another event to rate contents."}),ie?.status===g.OPEN&&L.length>0&&e.jsxs("div",{children:[!(oe?.length<=0&&le)&&e.jsxs("div",{className:"qc:flex qc:w-full qc:items-center qc:justify-between",children:[e.jsxs(t,{variant:"h4",children:["Rate this ",L[0].type===p.IMAGE?"image":"video"]}),e.jsxs(t,{variant:"h4",children:[ie?.pointName,":"," ",e.jsx("span",{className:"qc:text-primary",children:G.upload+G.curate})]})]}),e.jsxs("div",{className:"qc:grid qc:grid-cols-1 qc:gap-6 qc:md:grid-cols-2",children:[e.jsxs("div",{className:"qc:relative qc:mt-4 qc:w-full",children:[L[0].type===p.IMAGE&&e.jsx(w,{children:e.jsx($,{sizeMode:Y,src:L[0].url,alt:L[0].caption,blurhash:L[0].blurhash,wrapperClassName:"qc:w-full qc:h-60 qc:md:h-[30rem] qc:md:max-h-screen qc:md:rounded"})}),L[0].type===p.VIDEO&&e.jsx("div",{className:"qc:mx-auto qc:h-80 qc:w-fit qc:overflow-hidden qc:rounded qc:sm:h-[30rem]",children:e.jsx(S,{fit:Y,src:L[0].url,loop:!0,playing:te,volume:0,muted:!0,onPlay:()=>ae(!0),onPause:()=>ae(!1),onEnd:()=>ae(!1)})}),L[0].caption&&L[0].caption.length>0&&e.jsx("div",{className:"qc:bg-background qc:absolute qc:bottom-0 qc:w-full qc:bg-opacity-75 qc:p-2",children:e.jsx(t,{variant:"body3",lines:"2",children:L[0].caption})}),L.length>1&&e.jsx("img",{style:{display:"none"},src:L[1].url,alt:"Next image"})]}),e.jsxs("div",{className:"qc:px-2 qc:md:px-4",children:[!F&&oe&&oe.map(r=>e.jsx(B,{parameter:r,selected:X[r._id],onChange:e=>K({...X,[r._id]:e})},r._id)),ce&&oe?.length>0&&e.jsx(t,{variant:"h5",color:"error",children:ce}),F&&oe?.length>0&&e.jsx("div",{className:"qc:sm:pt-16",children:e.jsx(t,{variant:"h5",color:"error",align:"center",children:F})}),oe?.length>0&&e.jsx(x,{type:"button",color:"primary",className:"qc:mt-4 qc:w-full",disabled:ee,loading:ee,icon:"material-symbols:check-rounded",onClick:F?qe:async()=>{if(oe.length<1)return void se("no parameters found");if(Object.keys(X).length<oe.length)return void se("please select your ratings");se(null),re(!0);const e=await o.post(l.CURATE_CONTENT,{headers:{"x-org-id":N,Authorization:A?`Bearer ${A.token}`:void 0},json:{eventId:ie._id,contentId:L[0]._id,parameterCount:oe.length,userRatings:oe.map(e=>({parameterId:e._id,weight:e.weight,rate:X[e._id]})),inappropriate:""}}).json();if(e.error)se(e.error);else{const r=e.data,t=r.crowdRatings||{},a={parameters:oe.map(e=>({name:e.name,crowdRating:t[e._id],userRating:r.ratings?.find(r=>r.parameterId===e._id)?.rate})),similarity:r.similarity||null,points:r.points||0,rateCount:r.rateCount||0};Z(a);const c={...G};c.curate+=ie.activityScores.curate,V(c)}re(!1)},children:F?"Rate Next Image":ee?"Rating...":"Submit"}),L?.length>0&&le&&e.jsx(H,{summary:L[0].contentSummary,url:L[0].url})]})]}),e.jsx("div",{className:"qc:mt-16",children:e.jsx(f,{to:u.GALLERY(a),state:{internalNavigation:!0},children:e.jsx(t,{color:"primary",variant:"h5",align:"center",children:"Goto gallery"})})})]}),e.jsx(k,{open:!!Q,onOpenChange:e=>!e&&qe(),children:e.jsxs(E,{children:[e.jsxs(I,{children:[e.jsxs(_,{className:"qc:hidden",children:[ie?.pointName,": ",G?.upload+G?.curate]}),e.jsx(C,{className:"qc:hidden",children:"We are here to help you"})]}),e.jsxs("div",{className:"qc:w-full qc:space-y-3 qc:px-3 qc:pb-6 qc:lg:px-6",children:[e.jsx(M,{feedback:Q}),e.jsx(x,{fullWidth:!0,color:"primary",onClick:qe,children:"Next"})]})]})})]})})},H=({summary:r,url:a})=>e.jsxs("div",{className:"qc:w-full",children:[r?.subject&&e.jsx(t,{variant:"h3",className:"qc:mb-4",align:"center",children:r?.subject}),r?.labels&&e.jsx("div",{className:"qc:space-y-2",children:Object.entries(r?.labels).filter(([e,r])=>Array.isArray(r)&&r.length>0).map(([r,a])=>e.jsxs("div",{className:"",children:[e.jsx(t,{variant:"h4",className:"qc:mb-2 qc:font-semibold qc:capitalize",children:r.replace("_"," ")}),e.jsx("ul",{className:"qc:space-y-1 qc:pl-2",children:a.map((r,a)=>e.jsxs("li",{className:"qc:flex qc:items-center qc:gap-2",children:[e.jsx(j,{name:"material-symbols:check-circle-outline",className:"qc:text-primary"}),e.jsx(t,{variant:"body1",children:r}),e.jsx("a",{href:`https://www.google.com/search?q=${encodeURIComponent(r)}`,target:"_blank",rel:"noopener noreferrer",className:"qc:ml-2",children:e.jsx(x,{variant:"outlined",icon:"flat-color-icons:google",children:e.jsx(j,{name:"material-symbols:open-in-new-rounded",size:"sm"})})})]},a))})]},r))}),r?.description&&e.jsxs(w,{children:[e.jsx("hr",{className:"qc:my-4 qc:lg:my-8"}),e.jsx(t,{variant:"body2",children:r?.description})]}),e.jsx("div",{className:"qc:mt-4 qc:flex qc:justify-center qc:lg:mt-8",children:e.jsx("a",{target:"_blank",href:`https://www.bing.com/images/search?view=detailv2&iss=SBI&form=SBIIRP&sbisrc=UrlPaste&q=imgurl:${a}&idpbck=1&selectedindex=0&id=${a}&mediaurl=${a}&exph=480&expw=640&vt=3&sim=11&cal=0&cab=1&cat=0&car=1`,rel:"noopener noreferrer",children:e.jsx(x,{icon:"logos:bing",variant:"outlined",color:"info",children:"Search on Bing"})})}),r&&e.jsx(t,{variant:"caption",align:"center",color:"secondary",className:"qc:mt-4 qc:lg:mt-8",children:"These are AI generated summaries based on the content. Please verify the information before using it."})]});export{Y as default};
@@ -1 +1 @@
1
- import{j as e,u as r,T as o,J as n,k as a,i as t,a4 as s,P as l}from"./DBnzOELO.js";import i,{useState as c}from"react";import{I as d}from"./CZp0lmKh.js";import{u,o as m,c as f,C as p,a as h,b as g}from"./-74yB4f5.js";const v=({count:r=1,currentStep:o=0,disabled:n,onStepClick:a})=>{const t=n||!a;return e.jsx("ol",{role:"list",className:"qc:flex qc:items-center qc:space-x-4 qc:pl-1.5",children:Array.from({length:r}).map((r,n)=>e.jsx("li",{children:n<o?e.jsx("button",{className:"qc:bg-primary qc:block qc:size-3 qc:rounded-full",disabled:t,onClick:()=>a&&a(n)}):n===o?e.jsxs("button",{className:"qc:relative qc:flex qc:items-center qc:justify-center","aria-current":"step",disabled:t,onClick:()=>a&&a(n),children:[e.jsx("span",{className:"qc:absolute qc:flex qc:size-6 qc:p-px","aria-hidden":"true",children:e.jsx("span",{className:"qc:bg-primary qc:size-full qc:rounded-full qc:bg-opacity-40"})}),e.jsx("span",{className:"qc:bg-primary qc:relative qc:block qc:size-3 qc:rounded-full","aria-hidden":"true"})]}):e.jsx("button",{className:"qc:block qc:size-3 qc:rounded-full qc:bg-text-secondary-light",disabled:t,onClick:()=>a&&a(n)})},`progress-dot-${n}`))})},q={email:""},w=f().shape({email:h().required("Please enter your email").email("Enter a valid email")}),x=({onCodeSent:s})=>{const[l,i]=c(!1),[f,h]=c(null),{props:{organizationId:g}}=r(),{control:v,handleSubmit:x,formState:{errors:y}}=u({mode:"onSubmit",defaultValues:q,resolver:m(w)});return e.jsxs("div",{className:"w-full space-y-6",children:[e.jsx(o,{variant:"h5",align:"center",children:"Reset password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-4 qc:lg:space-y-8",onSubmit:x(async e=>{h(null),i(!0);try{await a.post(t.SEND_PASSWORD_RESET_CODE,{json:{email:e.email?.toLowerCase()},headers:{"x-org-id":g}}),s(e.email.toLowerCase())}catch(e){console.error("Error sending verification code:",e),h(e.message||e||"An error occurred while sending the code. Please try again.")}i(!1)}),children:[e.jsx(p,{name:"email",control:v,render:({field:{value:r,onChange:o,onBlur:n}})=>e.jsx(d,{label:"Email",disabled:l,type:"email",value:r,onChange:o,onBlur:n,error:y.email?.message})}),e.jsx(n,{fullWidth:!0,type:"submit",loading:l,children:"Send verification code"})]}),f&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:f})]})};var y=function(e){return"object"==typeof e&&null!==e},b=function(e){var r=e.value,o=void 0===r?"":r,n=e.numInputs,a=void 0===n?4:n,t=e.onChange,s=e.onPaste,l=e.renderInput,c=e.shouldAutoFocus,d=void 0!==c&&c,u=e.inputType,m=void 0===u?"text":u,f=e.renderSeparator,p=e.placeholder,h=e.containerStyle,g=e.inputStyle,v=e.skipDefaultStyles,q=void 0!==v&&v,w=i.useState(0),x=w[0],b=w[1],j=i.useRef([]),S=function(){return o?o.toString().split(""):[]},C="number"===m||"tel"===m;i.useEffect(function(){j.current=j.current.slice(0,a)},[a]),i.useEffect(function(){var e;d&&(null===(e=j.current[0])||void 0===e||e.focus())},[d]);var P=function(){if("string"==typeof p){if(p.length===a)return p;p.length>0&&console.error("Length of the placeholder should be equal to the number of inputs.")}},N=function(e){return(C?!isNaN(Number(e)):"string"==typeof e)&&1===e.trim().length},D=function(e){var r=e.target.value;N(r)&&(R(r),I(x+1))},E=function(e){var r=e.nativeEvent,o=e.target.value;if(!N(o)){if(o.length===a)o.split("").some(function(e){return!N(e)})||(O(o.split("")),I(a-1));null===r.data&&"deleteContentBackward"===r.inputType&&(e.preventDefault(),R(""),I(x-1)),e.target.value=""}},k=function(){b(x-1)},A=function(e){var r=S();[e.code,e.key].includes("Backspace")?(e.preventDefault(),R(""),I(x-1)):"Delete"===e.code?(e.preventDefault(),R("")):"ArrowLeft"===e.code?(e.preventDefault(),I(x-1)):"ArrowRight"===e.code||e.key===r[x]?(e.preventDefault(),I(x+1)):("Spacebar"===e.code||"Space"===e.code||"ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault()},I=function(e){var r,o,n=Math.max(Math.min(a-1,e),0);j.current[n]&&(null===(r=j.current[n])||void 0===r||r.focus(),null===(o=j.current[n])||void 0===o||o.select(),b(n))},R=function(e){var r=S();r[x]=e[0],O(r)},O=function(e){var r=e.join("");t(r)},B=function(e){var r;e.preventDefault();var o=S(),n=x,t=e.clipboardData.getData("text/plain").slice(0,a-x).split("");if(!C||!t.some(function(e){return isNaN(Number(e))})){for(var s=0;s<a;++s)s>=x&&t.length>0&&(o[s]=null!==(r=t.shift())&&void 0!==r?r:"",n++);I(n),O(o)}};return i.createElement("div",{style:Object.assign({display:"flex",alignItems:"center"},y(h)&&h),className:"string"==typeof h?h:void 0,onPaste:s},Array.from({length:a},function(e,r){return r}).map(function(e){var r,o,n;return i.createElement(i.Fragment,{key:e},l({value:null!==(r=S()[e])&&void 0!==r?r:"",placeholder:null!==(n=null===(o=P())||void 0===o?void 0:o[e])&&void 0!==n?n:void 0,ref:function(r){return j.current[e]=r},onChange:D,onFocus:function(r){return function(e){return function(r){b(r),e.target.select()}}(r)(e)},onBlur:k,onKeyDown:A,onPaste:B,autoComplete:"off","aria-label":"Please enter OTP character ".concat(e+1),style:Object.assign(q?{}:{width:"1em",textAlign:"center"},y(g)?g:{}),className:"string"==typeof g?g:void 0,type:m,inputMode:C?"numeric":"text",onInput:E},e),e<a-1&&("function"==typeof f?f(e):f))}))};const j={code:""},S=f().shape({code:h().required("Please enter the code")}),C=({email:s,onCodeVerified:l})=>{const{props:{organizationId:i}}=r(),[d,f]=c(!1),[h,g]=c(null),{control:v,handleSubmit:q,watch:w}=u({mode:"onSubmit",defaultValues:j,resolver:m(S)});return e.jsxs("div",{className:"qc:space-y-4 qc:lg:space-y-8",children:[e.jsxs(o,{variant:"h5",align:"center",children:["Enter the code sent to ",e.jsx("span",{className:"qc:text-primary qc:font-medium",children:s})]}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:flex qc:w-full qc:flex-col qc:items-center qc:gap-4 qc:lg:gap-8",onSubmit:q(async e=>{g(null),f(!0);try{await a.post(t.VERIFY_PASSWORD_RESET_CODE,{json:{email:s,code:e.code},headers:{"x-org-id":i}}),l&&l()}catch(e){console.error(e.message),g("An error occurred while verifying the code. Please try again.")}f(!1)}),children:[e.jsx(p,{name:"code",control:v,render:({field:{value:r,onChange:o}})=>e.jsx(b,{value:r,onChange:o,numInputs:6,shouldAutoFocus:!0,inputType:"number",isInputNum:!0,containerStyle:"qc:flex qc:gap-4",inputStyle:"qc:rounded qc:border qc:focus:border-primary qc:text-foreground qc:bg-white qc:disabled:border-border qc:disabled:text-gray-400 otp-input qc:text-xl qc:focus:outline-none qc:focus:ring-0 qc:focus:boder-none",renderInput:r=>e.jsx("input",{...r})})}),e.jsx(n,{fullWidth:!0,type:"submit",disabled:w("code").length<6,loading:d,children:"Submit"})]}),h&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:h})]})},P={password:"",confirmPassword:""},N=f().shape({password:h().required("Please enter your password").min(8,"Min password length is 8"),confirmPassword:h().required("Please confirm your password").min(8,"Min password length is 8").oneOf([g("password"),null],"Passwords do not match")}),D=({email:s,onPasswordReset:l})=>{const{props:{organizationId:i}}=r(),[f,h]=c({showPassword:!1,showConfirmPassword:!1}),[g,v]=c(!1),[q,w]=c(null),{control:x,handleSubmit:y,formState:{errors:b}}=u({defaultValues:P,mode:"onSubmit",resolver:m(N)});return e.jsxs("div",{className:"qc:w-full qc:space-y-4",children:[e.jsx(o,{variant:"h5",align:"center",children:"Set new password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-8",onSubmit:y(async e=>{w(null),v(!0);try{const r=await a.post(t.RESET_PASSWORD,{json:{email:s.toLowerCase(),password:e.password},headers:{"x-org-id":i}});r.error?w(r.error):l()}catch{w("An error occurred while resetting the password. Please try again.")}v(!1)}),children:[e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"password",control:x,render:({field:{value:r,onChange:o,onBlur:n}})=>e.jsx(d,{label:"New password",disabled:g,type:f.showPassword?"text":"password",value:r,onChange:o,onBlur:n,error:b.password?.message})}),e.jsx(n,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showPassword:!f.showPassword})})]}),e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"confirmPassword",control:x,render:({field:{value:r,onChange:o,onBlur:n}})=>e.jsx(d,{label:"Confirm new password",disabled:g,type:f.showConfirmPassword?"text":"password",value:r,onChange:o,onBlur:n,error:b.confirmPassword?.message})}),e.jsx(n,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showConfirmPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showConfirmPassword:!f.showConfirmPassword})})]}),e.jsx(n,{fullWidth:!0,type:"submit",color:"primary",loading:g,children:"Reset password"})]}),q&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:q})]})},E=()=>{const r=s(),[o,n]=c(null),[a,t]=c(0);return e.jsxs("div",{className:"space-y-9",children:[(({index:a})=>{switch(a){case 0:return e.jsx(x,{onCodeSent:e=>{n(e),t(1)}});case 1:return e.jsx(C,{email:o,onCodeVerified:()=>t(2)});case 2:return e.jsx(D,{email:o,onPasswordReset:()=>{r(l.LOGIN)}})}})({index:a}),e.jsx("div",{className:"qc:mt-8 qc:flex qc:justify-center",children:e.jsx(v,{count:3,currentStep:a})})]})};export{E as default};
1
+ import{j as e,u as r,T as o,J as n,k as a,i as t,a4 as s,P as l}from"./ChmTNpp8.js";import c,{useState as i}from"react";import{I as d}from"./CyG7wrJo.js";import{u,o as m,c as f,C as p,a as h,b as g}from"./-74yB4f5.js";const v=({count:r=1,currentStep:o=0,disabled:n,onStepClick:a})=>{const t=n||!a;return e.jsx("ol",{role:"list",className:"qc:flex qc:items-center qc:space-x-4 qc:pl-1.5",children:Array.from({length:r}).map((r,n)=>e.jsx("li",{children:n<o?e.jsx("button",{className:"qc:bg-primary qc:block qc:size-3 qc:rounded-full",disabled:t,onClick:()=>a&&a(n)}):n===o?e.jsxs("button",{className:"qc:relative qc:flex qc:items-center qc:justify-center","aria-current":"step",disabled:t,onClick:()=>a&&a(n),children:[e.jsx("span",{className:"qc:absolute qc:flex qc:size-6 qc:p-px","aria-hidden":"true",children:e.jsx("span",{className:"qc:bg-primary qc:size-full qc:rounded-full qc:bg-opacity-40"})}),e.jsx("span",{className:"qc:bg-primary qc:relative qc:block qc:size-3 qc:rounded-full","aria-hidden":"true"})]}):e.jsx("button",{className:"qc:block qc:size-3 qc:rounded-full qc:bg-text-secondary-light",disabled:t,onClick:()=>a&&a(n)})},`progress-dot-${n}`))})},q={email:""},w=f().shape({email:h().required("Please enter your email").email("Enter a valid email")}),x=({onCodeSent:s})=>{const[l,c]=i(!1),[f,h]=i(null),{props:{organizationId:g}}=r(),{control:v,handleSubmit:x,formState:{errors:y}}=u({mode:"onSubmit",defaultValues:q,resolver:m(w)});return e.jsxs("div",{className:"w-full space-y-6",children:[e.jsx(o,{variant:"h5",align:"center",children:"Reset password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-4 qc:lg:space-y-8",onSubmit:x(async e=>{h(null),c(!0);try{await a.post(t.SEND_PASSWORD_RESET_CODE,{json:{email:e.email?.toLowerCase()},headers:{"x-org-id":g}}),s(e.email.toLowerCase())}catch(e){console.error("Error sending verification code:",e),h(e.message||e||"An error occurred while sending the code. Please try again.")}c(!1)}),children:[e.jsx(p,{name:"email",control:v,render:({field:{value:r,onChange:o,onBlur:n}})=>e.jsx(d,{label:"Email",disabled:l,type:"email",value:r,onChange:o,onBlur:n,error:y.email?.message})}),e.jsx(n,{fullWidth:!0,type:"submit",loading:l,children:"Send verification code"})]}),f&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:f})]})};var y=function(e){return"object"==typeof e&&null!==e},b=function(e){var r=e.value,o=void 0===r?"":r,n=e.numInputs,a=void 0===n?4:n,t=e.onChange,s=e.onPaste,l=e.renderInput,i=e.shouldAutoFocus,d=void 0!==i&&i,u=e.inputType,m=void 0===u?"text":u,f=e.renderSeparator,p=e.placeholder,h=e.containerStyle,g=e.inputStyle,v=e.skipDefaultStyles,q=void 0!==v&&v,w=c.useState(0),x=w[0],b=w[1],j=c.useRef([]),S=function(){return o?o.toString().split(""):[]},C="number"===m||"tel"===m;c.useEffect(function(){j.current=j.current.slice(0,a)},[a]),c.useEffect(function(){var e;d&&(null===(e=j.current[0])||void 0===e||e.focus())},[d]);var P=function(){if("string"==typeof p){if(p.length===a)return p;p.length>0&&console.error("Length of the placeholder should be equal to the number of inputs.")}},N=function(e){return(C?!isNaN(Number(e)):"string"==typeof e)&&1===e.trim().length},D=function(e){var r=e.target.value;N(r)&&(R(r),I(x+1))},E=function(e){var r=e.nativeEvent,o=e.target.value;if(!N(o)){if(o.length===a)o.split("").some(function(e){return!N(e)})||(O(o.split("")),I(a-1));null===r.data&&"deleteContentBackward"===r.inputType&&(e.preventDefault(),R(""),I(x-1)),e.target.value=""}},k=function(){b(x-1)},A=function(e){var r=S();[e.code,e.key].includes("Backspace")?(e.preventDefault(),R(""),I(x-1)):"Delete"===e.code?(e.preventDefault(),R("")):"ArrowLeft"===e.code?(e.preventDefault(),I(x-1)):"ArrowRight"===e.code||e.key===r[x]?(e.preventDefault(),I(x+1)):("Spacebar"===e.code||"Space"===e.code||"ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault()},I=function(e){var r,o,n=Math.max(Math.min(a-1,e),0);j.current[n]&&(null===(r=j.current[n])||void 0===r||r.focus(),null===(o=j.current[n])||void 0===o||o.select(),b(n))},R=function(e){var r=S();r[x]=e[0],O(r)},O=function(e){var r=e.join("");t(r)},B=function(e){var r;e.preventDefault();var o=S(),n=x,t=e.clipboardData.getData("text/plain").slice(0,a-x).split("");if(!C||!t.some(function(e){return isNaN(Number(e))})){for(var s=0;s<a;++s)s>=x&&t.length>0&&(o[s]=null!==(r=t.shift())&&void 0!==r?r:"",n++);I(n),O(o)}};return c.createElement("div",{style:Object.assign({display:"flex",alignItems:"center"},y(h)&&h),className:"string"==typeof h?h:void 0,onPaste:s},Array.from({length:a},function(e,r){return r}).map(function(e){var r,o,n;return c.createElement(c.Fragment,{key:e},l({value:null!==(r=S()[e])&&void 0!==r?r:"",placeholder:null!==(n=null===(o=P())||void 0===o?void 0:o[e])&&void 0!==n?n:void 0,ref:function(r){return j.current[e]=r},onChange:D,onFocus:function(r){return function(e){return function(r){b(r),e.target.select()}}(r)(e)},onBlur:k,onKeyDown:A,onPaste:B,autoComplete:"off","aria-label":"Please enter OTP character ".concat(e+1),style:Object.assign(q?{}:{width:"1em",textAlign:"center"},y(g)?g:{}),className:"string"==typeof g?g:void 0,type:m,inputMode:C?"numeric":"text",onInput:E},e),e<a-1&&("function"==typeof f?f(e):f))}))};const j={code:""},S=f().shape({code:h().required("Please enter the code")}),C=({email:s,onCodeVerified:l})=>{const{props:{organizationId:c}}=r(),[d,f]=i(!1),[h,g]=i(null),{control:v,handleSubmit:q,watch:w}=u({mode:"onSubmit",defaultValues:j,resolver:m(S)});return e.jsxs("div",{className:"qc:space-y-4 qc:lg:space-y-8",children:[e.jsxs(o,{variant:"h5",align:"center",children:["Enter the code sent to ",e.jsx("span",{className:"qc:text-primary qc:font-medium",children:s})]}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:flex qc:w-full qc:flex-col qc:items-center qc:gap-4 qc:lg:gap-8",onSubmit:q(async e=>{g(null),f(!0);try{await a.post(t.VERIFY_PASSWORD_RESET_CODE,{json:{email:s,code:e.code},headers:{"x-org-id":c}}),l&&l()}catch(e){console.error(e.message),g("An error occurred while verifying the code. Please try again.")}f(!1)}),children:[e.jsx(p,{name:"code",control:v,render:({field:{value:r,onChange:o}})=>e.jsx(b,{value:r,onChange:o,numInputs:6,shouldAutoFocus:!0,inputType:"number",isInputNum:!0,containerStyle:"qc:flex qc:gap-4",inputStyle:"qc:rounded qc:border qc:focus:border-primary qc:text-foreground qc:bg-white qc:disabled:border-border qc:disabled:text-gray-400 otp-input qc:text-xl qc:focus:outline-none qc:focus:ring-0 qc:focus:boder-none",renderInput:r=>e.jsx("input",{...r})})}),e.jsx(n,{fullWidth:!0,type:"submit",disabled:w("code").length<6,loading:d,children:"Submit"})]}),h&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:h})]})},P={password:"",confirmPassword:""},N=f().shape({password:h().required("Please enter your password").min(8,"Min password length is 8"),confirmPassword:h().required("Please confirm your password").min(8,"Min password length is 8").oneOf([g("password"),null],"Passwords do not match")}),D=({email:s,onPasswordReset:l})=>{const{props:{organizationId:c}}=r(),[f,h]=i({showPassword:!1,showConfirmPassword:!1}),[g,v]=i(!1),[q,w]=i(null),{control:x,handleSubmit:y,formState:{errors:b}}=u({defaultValues:P,mode:"onSubmit",resolver:m(N)});return e.jsxs("div",{className:"qc:w-full qc:space-y-4",children:[e.jsx(o,{variant:"h5",align:"center",children:"Set new password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-8",onSubmit:y(async e=>{w(null),v(!0);try{const r=await a.post(t.RESET_PASSWORD,{json:{email:s.toLowerCase(),password:e.password},headers:{"x-org-id":c}});r.error?w(r.error):l()}catch{w("An error occurred while resetting the password. Please try again.")}v(!1)}),children:[e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"password",control:x,render:({field:{value:r,onChange:o,onBlur:n}})=>e.jsx(d,{label:"New password",disabled:g,type:f.showPassword?"text":"password",value:r,onChange:o,onBlur:n,error:b.password?.message})}),e.jsx(n,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showPassword:!f.showPassword})})]}),e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"confirmPassword",control:x,render:({field:{value:r,onChange:o,onBlur:n}})=>e.jsx(d,{label:"Confirm new password",disabled:g,type:f.showConfirmPassword?"text":"password",value:r,onChange:o,onBlur:n,error:b.confirmPassword?.message})}),e.jsx(n,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showConfirmPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showConfirmPassword:!f.showConfirmPassword})})]}),e.jsx(n,{fullWidth:!0,type:"submit",color:"primary",loading:g,children:"Reset password"})]}),q&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:q})]})},E=()=>{const r=s(),[o,n]=i(null),[a,t]=i(0);return e.jsxs("div",{className:"qc:space-y-9 qc:bg-background",children:[(({index:a})=>{switch(a){case 0:return e.jsx(x,{onCodeSent:e=>{n(e),t(1)}});case 1:return e.jsx(C,{email:o,onCodeVerified:()=>t(2)});case 2:return e.jsx(D,{email:o,onPasswordReset:()=>{r(l.LOGIN)}})}})({index:a}),e.jsx("div",{className:"qc:mt-8 qc:flex qc:justify-center",children:e.jsx(v,{count:3,currentStep:a})})]})};export{E as default};
@@ -0,0 +1 @@
1
+ import{d as e,u as a,j as s,J as l,T as o,g as r,P as i}from"./ChmTNpp8.js";import{useState as t}from"react";import{I as n}from"./CyG7wrJo.js";import{S as c}from"./sVnMjM13.js";import{u as d,C as m,o as p,c as g,a as u}from"./-74yB4f5.js";const h=g().shape({email:u().required("Please enter your email").email("Enter a valid email"),password:u().required("Please enter your password").min(8,"Min password length is 8")}),j=()=>{const[g,u]=t(!1),[j,f]=t(!1),[x,w]=t({google:!1,apple:!1}),[y,q]=t(null),v=e(),{control:b,handleSubmit:C,formState:{errors:N}}=d({defaultValues:{email:"",password:""},mode:"onSubmit",resolver:p(h)}),{loginUsingEmail:S,loginWithGoogle:P,loginWithApple:k}=a(),B=async(e,a)=>{w(a=>({...a,[e]:!0})),q(null);try{await a()}catch(a){q(a.message||`Failed to login with ${e.charAt(0).toUpperCase()+e.slice(1)}`)}finally{w(a=>({...a,[e]:!1}))}};return s.jsxs("div",{className:"qc:w-full qc:space-y-6 qc:bg-background",children:[s.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:C(async e=>{const{email:a,password:s}=e;f(!0);try{const e=await S(a.toLowerCase(),s);e?.error&&q(e.error)}catch(e){q(e)}finally{f(!1)}}),className:"qc:space-y-6",children:[s.jsxs("div",{className:"qc:space-y-9",children:[s.jsx(m,{name:"email",control:b,render:({field:{value:e,onChange:a,onBlur:l}})=>s.jsx(n,{label:"Email",disabled:j,type:"email",value:e,onChange:a,onBlur:l,autoComplete:"email",error:N.email?.message})}),s.jsx(m,{name:"password",control:b,render:({field:{value:e,onChange:a,onBlur:o}})=>s.jsxs("div",{className:"qc:relative",children:[s.jsx(n,{label:"Password",disabled:j,type:g?"text":"password",value:e,onChange:a,onBlur:o,autoComplete:"current-password",error:N.password?.message}),s.jsx(l,{variant:"ghost",color:"primary",className:"qc:absolute qc:right-0 qc:top-8",icon:g?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>u(!g)})]})})]}),y&&s.jsx(o,{align:"center",weight:"medium",color:"error",children:y}),s.jsx("div",{className:"qc:flex qc:justify-end",children:s.jsx(r,{to:i.FORGOT_PASSWORD,state:v?.state,children:s.jsx(o,{variant:"h6",className:"qc:w-fit",children:"Forgot password?"})})}),s.jsx(l,{type:"submit",color:"primary",className:"qc:w-full",loading:j,disabled:j,children:"Login"})]}),s.jsxs("div",{className:"qc:grid qc:grid-cols-2 qc:gap-4",children:[s.jsx(c,{disabled:j||x.google||x.apple,loading:x.google,onClick:()=>B("google",P),provider:"google"}),s.jsx(c,{disabled:j||x.google||x.apple,loading:x.apple,onClick:()=>B("apple",k),provider:"apple"})]})]})};export{j as default};