@qratilabs/qrati-connect 2.2.2 → 2.3.0

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 (65) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/element/{AuthLayout-yBnXbTdQ.js → AuthLayout-BQsxj8DA.js} +1 -1
  3. package/element/{ContentsPage-BpGmiu2Y.js → ContentsPage-BswZWICC.js} +2 -2
  4. package/element/{CuratePage-Bf96ltsu.js → CuratePage-l_53kq1u.js} +1 -1
  5. package/element/{Dialog-BqAbQiPJ.js → Dialog-xRPAHU1U.js} +1 -1
  6. package/element/{DotLottiePlayer-BtxapiSJ.js → DotLottiePlayer-DWbmlHl0.js} +1 -1
  7. package/element/{EventHeaderAdminButtons-BplHheBN.js → EventHeaderAdminButtons-DpqqYPmp.js} +2 -2
  8. package/element/FolderBreadcrumb-DgOZR2JO.js +1 -0
  9. package/element/{ForgotPasswordPage-Z0fY0XwU.js → ForgotPasswordPage-CIz3_X-3.js} +1 -1
  10. package/element/{InputField-B4v4KXcE.js → InputField-DybXE_Ab.js} +1 -1
  11. package/element/{LazyLoadImage-DAovisp3.js → LazyLoadImage-8X8b06AJ.js} +1 -1
  12. package/element/{LeaderboardPage-Ygaebr-t.js → LeaderboardPage-Bphjksy_.js} +1 -1
  13. package/element/{LoginPage-DIZ7qlYO.js → LoginPage-CHzBIQEq.js} +1 -1
  14. package/element/{NCMVHL6D-CxiMFMqg.js → NCMVHL6D-CBCgRwdZ.js} +1 -1
  15. package/element/PublicEvents-RN-_fsl2.js +1 -0
  16. package/element/{RegisterPage-Bg7pyJeh.js → RegisterPage-7WLryyTX.js} +1 -1
  17. package/element/{SocialLoginButton-DsAt02H9.js → SocialLoginButton-DpBl7dWg.js} +1 -1
  18. package/element/{UploadPage-C0ek4Qqe.js → UploadPage-B7BieTEU.js} +1 -1
  19. package/element/{VideoPlayer-g56XT4-3.js → VideoPlayer-Bk8Hao3q.js} +1 -1
  20. package/element/element.es.js +1 -1
  21. package/element/{heic2any-z2RaaSEC.js → heic2any-DLQd-wQs.js} +1 -1
  22. package/element/{index-BhzTVsTo.js → index-DI8B7D73.js} +1 -1
  23. package/element/{index-DDOpdb3i.js → index-JyoNGo8S.js} +9 -9
  24. package/element/index.esm-CAQX5kI5.js +1 -0
  25. package/element/{photoswipe-B7SExy7W.js → photoswipe-Coj-X7bR.js} +1 -1
  26. package/element/styles.css +1 -1
  27. package/element/{tslib.es6-DIRCPYhi.js → tslib.es6-C9bR68b3.js} +1 -1
  28. package/element/{useOrgAccess-CQNPoSFq.js → useOrgAccess-CnN4aiYB.js} +1 -1
  29. package/element/web.es.js +1 -1
  30. package/package.json +18 -15
  31. package/react/-74yB4f5.js +1 -0
  32. package/react/B1neVlFZ.js +1 -0
  33. package/react/{DppB7lia.js → BO8jvMXn.js} +1 -1
  34. package/react/{DqmSOLfe.js → BbIY3X7C.js} +1 -1
  35. package/react/{CBpEkjwz.js → CN2vdtYT.js} +1 -1
  36. package/react/{Ck9enZ3e.js → CXu6PHUW.js} +1 -1
  37. package/react/{Dhcvm9yI.js → CZp0lmKh.js} +1 -1
  38. package/react/{C5XgHCIU.js → CfZ5_7x-.js} +1 -1
  39. package/react/{Cb66NH94.js → D6nR1wv_.js} +1 -1
  40. package/react/DBnzOELO.js +30 -0
  41. package/react/{C1kBrsed.js → D_imcCpv.js} +2 -2
  42. package/react/DrqnWQLs.js +1 -0
  43. package/react/{MZeQHhBV.js → DvDETl8u.js} +1 -1
  44. package/react/{Cr9MgBeI.js → DvOl03h5.js} +2 -2
  45. package/react/{BBaDMfm_.js → Dwry3hNI.js} +1 -1
  46. package/react/{C27Sy5Nr.js → DyklTvwE.js} +1 -1
  47. package/react/{CouLaMtF.js → Gbk2zO2l.js} +1 -1
  48. package/react/{x0a0HaZy.js → IbMHxVCj.js} +1 -1
  49. package/react/{Dx52SzWS.js → Pcjql-py.js} +1 -1
  50. package/react/{BX9GvyM-.js → Ply2G2qz.js} +1 -1
  51. package/react/{DLUmYnVL.js → Y9TU3Znq.js} +1 -1
  52. package/react/{qwl23nTI.js → fuEo08KS.js} +1 -1
  53. package/react/index.es.js +2 -2
  54. package/react/{FcDLBnwX.js → jRrpvD0D.js} +1 -1
  55. package/react/{BE9_Ublk.js → rZy1FKOQ.js} +1 -1
  56. package/react/types/QratiConnect.d.ts +75 -0
  57. package/react/types/index.d.ts +1 -0
  58. package/umd/web.umd.js +119 -119
  59. package/element/FolderBreadcrumb-DhqYRcyB.js +0 -1
  60. package/element/PublicEvents-D4eUZCHS.js +0 -1
  61. package/element/index.esm-BbqgTw7t.js +0 -1
  62. package/react/DZqtPzMv.js +0 -1
  63. package/react/HhCRmfOk.js +0 -1
  64. package/react/Ld9VPzmf.js +0 -30
  65. package/react/U0g8gQE-.js +0 -1
@@ -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"./Ld9VPzmf.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"./qwl23nTI.js";import{L as $}from"./DLUmYnVL.js";import{V as S}from"./C5XgHCIU.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("./Ck9enZ3e.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("./Ck9enZ3e.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 active:qc: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"./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};
@@ -0,0 +1,75 @@
1
+ import { FC } from 'react';
2
+
3
+ export interface QratiConnectProps {
4
+ /**
5
+ * The organization ID for the Qrati Connect instance (required)
6
+ */
7
+ organizationId: string;
8
+
9
+ /**
10
+ * Optional router configuration
11
+ * @default "memory"
12
+ */
13
+ router?: 'memory' | 'hash';
14
+
15
+ /**
16
+ * Custom font class name for styling
17
+ */
18
+ fontClassName?: string;
19
+
20
+ /**
21
+ * Custom text class name for styling
22
+ */
23
+ textClassName?: string;
24
+
25
+ /**
26
+ * Custom label for the curate section
27
+ */
28
+ curateLabel?: string;
29
+
30
+ /**
31
+ * Custom label for the leaderboard section
32
+ */
33
+ leaderboardLabel?: string;
34
+
35
+ /**
36
+ * Custom image URL for empty state
37
+ */
38
+ emptyStateImage?: string;
39
+
40
+ /**
41
+ * User ID for authentication
42
+ */
43
+ uid?: string;
44
+
45
+ /**
46
+ * User's first name
47
+ */
48
+ fname?: string;
49
+
50
+ /**
51
+ * User's last name
52
+ */
53
+ lname?: string;
54
+
55
+ /**
56
+ * Custom login URL for authentication
57
+ */
58
+ loginUrl?: string;
59
+ }
60
+
61
+ /**
62
+ * QratiConnect - Main component for integrating Qrati into your React app
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * import QratiConnect from '@qratilabs/qrati-connect/react';
67
+ *
68
+ * function App() {
69
+ * return <QratiConnect organizationId="your-org-id" />;
70
+ * }
71
+ * ```
72
+ */
73
+ declare const QratiConnect: FC<QratiConnectProps>;
74
+
75
+ export default QratiConnect;
@@ -0,0 +1 @@
1
+ export { default, QratiConnectProps } from './QratiConnect';