@qratilabs/qrati-connect 2.2.3 → 2.3.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 (61) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/element/{AuthLayout-smqrs4PK.js → AuthLayout-BQsxj8DA.js} +1 -1
  3. package/element/{ContentsPage-BALVk95k.js → ContentsPage-BswZWICC.js} +2 -2
  4. package/element/{CuratePage-6O-YtfaK.js → CuratePage-l_53kq1u.js} +1 -1
  5. package/element/{Dialog-0wEAIe3Z.js → Dialog-xRPAHU1U.js} +1 -1
  6. package/element/{DotLottiePlayer-q7KyZjj4.js → DotLottiePlayer-DWbmlHl0.js} +1 -1
  7. package/element/{EventHeaderAdminButtons-AOGt2ZR_.js → EventHeaderAdminButtons-DpqqYPmp.js} +1 -1
  8. package/element/{FolderBreadcrumb-DE1SuI3R.js → FolderBreadcrumb-DgOZR2JO.js} +1 -1
  9. package/element/{ForgotPasswordPage-B7SQUSjQ.js → ForgotPasswordPage-CIz3_X-3.js} +1 -1
  10. package/element/{InputField-DCqkCRI8.js → InputField-DybXE_Ab.js} +1 -1
  11. package/element/{LazyLoadImage-Dx2kZ_ki.js → LazyLoadImage-8X8b06AJ.js} +1 -1
  12. package/element/{LeaderboardPage-ZllEyvHF.js → LeaderboardPage-Bphjksy_.js} +1 -1
  13. package/element/{LoginPage-CT0pEqXM.js → LoginPage-CHzBIQEq.js} +1 -1
  14. package/element/{NCMVHL6D-BwoIucZN.js → NCMVHL6D-CBCgRwdZ.js} +1 -1
  15. package/element/{PublicEvents-CIrYMBEL.js → PublicEvents-RN-_fsl2.js} +1 -1
  16. package/element/{RegisterPage-jGyiY6Q1.js → RegisterPage-7WLryyTX.js} +1 -1
  17. package/element/{SocialLoginButton-CD7hRRi3.js → SocialLoginButton-DpBl7dWg.js} +1 -1
  18. package/element/{UploadPage-CITq8Afj.js → UploadPage-B7BieTEU.js} +1 -1
  19. package/element/{VideoPlayer-BnGqOvd_.js → VideoPlayer-Bk8Hao3q.js} +1 -1
  20. package/element/element.es.js +1 -1
  21. package/element/{heic2any-DYXlMp6f.js → heic2any-DLQd-wQs.js} +1 -1
  22. package/element/{index-D2rVaTyg.js → index-DI8B7D73.js} +1 -1
  23. package/element/{index-dgkxxAYh.js → index-JyoNGo8S.js} +9 -9
  24. package/element/index.esm-CAQX5kI5.js +1 -0
  25. package/element/{photoswipe-CLqAYZuN.js → photoswipe-Coj-X7bR.js} +1 -1
  26. package/element/styles.css +1 -1
  27. package/element/{tslib.es6-Kir8qsmG.js → tslib.es6-C9bR68b3.js} +1 -1
  28. package/element/{useOrgAccess-CQGTKm39.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/{BByYodE2.js → B1neVlFZ.js} +1 -1
  33. package/react/{fLcJgmSx.js → BO8jvMXn.js} +1 -1
  34. package/react/{COmmnujB.js → BbIY3X7C.js} +1 -1
  35. package/react/{BfbjKTvp.js → CN2vdtYT.js} +1 -1
  36. package/react/{38fKKEwY.js → CXu6PHUW.js} +1 -1
  37. package/react/{CqFENFZB.js → CZp0lmKh.js} +1 -1
  38. package/react/{DCL2O5W3.js → CfZ5_7x-.js} +1 -1
  39. package/react/{CsN-e_l4.js → D6nR1wv_.js} +1 -1
  40. package/react/DBnzOELO.js +30 -0
  41. package/react/{Csp0JYSr.js → D_imcCpv.js} +2 -2
  42. package/react/{B-cnuYGK.js → DrqnWQLs.js} +1 -1
  43. package/react/{BKCu0fMZ.js → DvDETl8u.js} +1 -1
  44. package/react/{CeAGRh0t.js → DvOl03h5.js} +1 -1
  45. package/react/{CUXGA7St.js → Dwry3hNI.js} +1 -1
  46. package/react/{T91t2h6g.js → DyklTvwE.js} +1 -1
  47. package/react/{B_TCkLjZ.js → Gbk2zO2l.js} +1 -1
  48. package/react/{CwcF5rKn.js → IbMHxVCj.js} +1 -1
  49. package/react/{C-DBWaEg.js → Pcjql-py.js} +1 -1
  50. package/react/{Fz3ptOAl.js → Ply2G2qz.js} +1 -1
  51. package/react/{DDq_DfWj.js → Y9TU3Znq.js} +1 -1
  52. package/react/{B8mLtg2-.js → fuEo08KS.js} +1 -1
  53. package/react/index.es.js +2 -2
  54. package/react/{B1i756QD.js → jRrpvD0D.js} +1 -1
  55. package/react/{CTjUKTPO.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/index.esm-DH681Jwb.js +0 -1
  60. package/react/DNOLzzZH.js +0 -30
  61. package/react/HhCRmfOk.js +0 -1
@@ -1,4 +1,4 @@
1
- import{X as e,u as t,f as n,v as r,k as o,l as i,a0 as l,Z as s,a,K as u,a3 as c,j as d,I as f,W as p,Y as m,c as h,T as g,e as v,A as y,b,a2 as E,B as w,P as x}from"./index-dgkxxAYh.js";import{u as S,T}from"./useOrgAccess-CQGTKm39.js";import{r as C}from"./tslib.es6-Kir8qsmG.js";const O=s=>{const a=e(),{props:{organizationId:u}}=t(),{role:c,isSuper:d}=S(),{isLoading:f,data:p,isError:m,error:h}=n({queryKey:[r.EVENT_IN_REVIEW_COUNT(s?.slug)],queryFn:async()=>{try{const e=await o.get(i.GET_CONTENTS_COUNT,{searchParams:{eventSlug:s?.slug,filter:`status:${l.IN_REVIEW}`},headers:{"x-org-id":u}}).json();if(e.error)throw new Error(e.error);return e.data}catch(e){throw new Error(e?.message||e||"Failed to fetch in review count")}},staleTime:0,enabled:!!c||d});return{loading:f,inReviewCount:p,error:m?h:null,increment:()=>{a.setQueryData([r.EVENT_IN_REVIEW_COUNT(s?.slug)],e=>e+1)},decrement:()=>{a.setQueryData([r.EVENT_IN_REVIEW_COUNT(s?.slug)],e=>e-1)}}},R=e=>e&&e.length>0?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"",P=typeof document<"u"?s.useLayoutEffect:()=>{};var I;const A=null!==(I=s.useInsertionEffect)&&void 0!==I?I:P;const L=e=>{var t;return null!==(t=e?.ownerDocument)&&void 0!==t?t:document},M=e=>e&&"window"in e&&e.window===e?e:L(e).defaultView||window;function k(e,t){return!(!t||!e)&&e.contains(t)}const F=(e=document)=>e.activeElement;function N(e){return e.target}var D={};function q(e){if("test"===D.NODE_ENV)return e;let t=null;return()=>(null==t&&(t=e()),t)}const _=q(function(){return e=/^Mac/i,typeof window<"u"&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform);var e,t}),j=q(function(){return function(e){var t;if(typeof window>"u"||null==window.navigator)return!1;let n=null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands;return Array.isArray(n)&&n.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}(/Android/i)});function H(){let e=a.useRef(new Map),t=a.useCallback((t,n,r,o)=>{let i=o?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:i,options:o}),t.addEventListener(n,i,o)},[]),n=a.useCallback((t,n,r,o)=>{var i;let l=(null===(i=e.current.get(r))||void 0===i?void 0:i.fn)||r;t.removeEventListener(n,l,o),e.current.delete(r)},[]),r=a.useCallback(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return a.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function V(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function B(e){let t=a.useRef({isFocused:!1,observer:null});P(()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]);let n=function(e){const t=a.useRef(null);return A(()=>{t.current=e},[e]),a.useCallback((...e)=>{const n=t.current;return n?.(...e)},[])}(t=>{e?.(t)});return a.useCallback(e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target,o=e=>{if(t.current.isFocused=!1,r.disabled){let t=V(e);n(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};r.addEventListener("focusout",o,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;null===(e=t.current.observer)||void 0===e||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent("blur",{relatedTarget:n})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[n])}var W={};let U=null,G=new Set,$=new Map,K=!1,z=!1;const Y={Tab:!0,Escape:!0};function Q(e,t){for(let n of G)n(e,t)}function X(e){K=!0,function(e){return!(e.metaKey||!_()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(U="keyboard",Q("keyboard",e))}function J(e){U="pointer",("mousedown"===e.type||"pointerdown"===e.type)&&(K=!0,Q("pointer",e))}function Z(e){(function(e){return!(""!==e.pointerType||!e.isTrusted)||(j()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)})(e)&&(K=!0,U="virtual")}function ee(e){e.target===window||e.target===document||!e.isTrusted||(!K&&!z&&(U="virtual",Q("virtual",e)),K=!1,z=!1)}function te(){K=!1,z=!0}function ne(e){if(typeof window>"u"||typeof document>"u"||$.get(M(e)))return;const t=M(e),n=L(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){K=!0,r.apply(this,arguments)},n.addEventListener("keydown",X,!0),n.addEventListener("keyup",X,!0),n.addEventListener("click",Z,!0),t.addEventListener("focus",ee,!0),t.addEventListener("blur",te,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",J,!0),n.addEventListener("pointermove",J,!0),n.addEventListener("pointerup",J,!0)):"test"===W.NODE_ENV&&(n.addEventListener("mousedown",J,!0),n.addEventListener("mousemove",J,!0),n.addEventListener("mouseup",J,!0)),t.addEventListener("beforeunload",()=>{re(e)},{once:!0}),$.set(t,{focus:r})}const re=(e,t)=>{const n=M(e),r=L(e);t&&r.removeEventListener("DOMContentLoaded",t),$.has(n)&&(n.HTMLElement.prototype.focus=$.get(n).focus,r.removeEventListener("keydown",X,!0),r.removeEventListener("keyup",X,!0),r.removeEventListener("click",Z,!0),n.removeEventListener("focus",ee,!0),n.removeEventListener("blur",te,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",J,!0),r.removeEventListener("pointermove",J,!0),r.removeEventListener("pointerup",J,!0)):"test"===W.NODE_ENV&&(r.removeEventListener("mousedown",J,!0),r.removeEventListener("mousemove",J,!0),r.removeEventListener("mouseup",J,!0)),$.delete(n))};function oe(){return"pointer"!==U}typeof document<"u"&&function(e){const t=L(e);let n;"loading"!==t.readyState?ne(e):(n=()=>{ne(e)},t.addEventListener("DOMContentLoaded",n))}();const ie=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function le(e,t,n){ne(),a.useEffect(()=>{let t=(t,r)=>{(function(e,t,n){let r=L(n?.target);const o=typeof window<"u"?M(n?.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?M(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?M(n?.target).HTMLElement:HTMLElement,s=typeof window<"u"?M(n?.target).KeyboardEvent:KeyboardEvent;return!((e=e||r.activeElement instanceof o&&!ie.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof l&&r.activeElement.isContentEditable)&&"keyboard"===t&&n instanceof s&&!Y[n.key])})(!!n?.isTextInput,t,r)&&e(oe())};return G.add(t),()=>{G.delete(t)}},t)}function se(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=a.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:s}=H(),u=a.useCallback(e=>{e.currentTarget.contains(e.target)&&i.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(i.current.isFocusWithin=!1,s(),n&&n(e),o&&o(!1))},[n,o,i,s]),c=B(u),d=a.useCallback(e=>{if(!e.currentTarget.contains(e.target))return;const t=L(e.target),n=F(t);if(!i.current.isFocusWithin&&n===N(e.nativeEvent)){r&&r(e),o&&o(!0),i.current.isFocusWithin=!0,c(e);let n=e.currentTarget;l(t,"focus",e=>{if(i.current.isFocusWithin&&!k(n,e.target)){let r=new t.defaultView.FocusEvent("blur",{relatedTarget:e.target});!function(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}(r,n);let o=V(r);u(o)}},{capture:!0})}},[r,o,c,l,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:u}}}var ae={};let ue=!1,ce=0;function de(){ue=!0,setTimeout(()=>{ue=!1},50)}function fe(e){"touch"===e.pointerType&&de()}function pe(){if(!(typeof document>"u"))return 0===ce&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",fe):"test"===ae.NODE_ENV&&document.addEventListener("touchend",de)),ce++,()=>{ce--,!(ce>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",fe):"test"===ae.NODE_ENV&&document.removeEventListener("touchend",de))}}function me(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=a.useRef({isFocused:!1,isFocusVisible:t||oe()}),[i,l]=a.useState(!1),[s,u]=a.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=a.useCallback(()=>u(o.current.isFocused&&o.current.isFocusVisible),[]),d=a.useCallback(e=>{o.current.isFocused=e,l(e),c()},[c]);le(e=>{o.current.isFocusVisible=e,c()},[],{isTextInput:n});let{focusProps:f}=function(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const i=a.useCallback(e=>{if(e.target===e.currentTarget)return r&&r(e),o&&o(!1),!0},[r,o]),l=B(i),s=a.useCallback(e=>{const t=L(e.target),r=t?F(t):F();e.target===e.currentTarget&&r===N(e.nativeEvent)&&(n&&n(e),o&&o(!0),l(e))},[o,n,l]);return{focusProps:{onFocus:!t&&(n||o||r)?s:void 0,onBlur:t||!r&&!o?void 0:i}}}({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=se({isDisabled:!r,onFocusWithinChange:d});return{isFocused:i,isFocusVisible:s,focusProps:r?p:f}}var he=Object.defineProperty,ge=(e,t,n)=>(((e,t,n)=>{t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let ve=new class{constructor(){ge(this,"current",this.detect()),ge(this,"handoffState","pending"),ge(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}};function ye(e){var t;return ve.isServer?null:null==e?document:null!=(t=e?.ownerDocument)?t:document}function be(e){var t,n;return ve.isServer?null:null==e?document:null!=(n=null==(t=e?.getRootNode)?void 0:t.call(e))?n:document}function Ee(e){var t,n;return null!=(n=null==(t=be(e))?void 0:t.activeElement)?n:null}function we(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function xe(){let e=[],t={addEventListener:(e,n,r,o)=>(e.addEventListener(n,r,o),t.add(()=>e.removeEventListener(n,r,o))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return we(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=xe();return e(t),this.add(()=>t.dispose())},add:t=>(e.includes(t)||e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function Se(){let[e]=a.useState(xe);return a.useEffect(()=>()=>e.dispose(),[e]),e}let Te=(e,t)=>{ve.isServer?a.useEffect(e,t):a.useLayoutEffect(e,t)};function Ce(e){let t=a.useRef(e);return Te(()=>{t.current=e},[e]),t}let Oe=function(e){let t=Ce(e);return s.useCallback((...e)=>t.current(...e),[t])};function Re(e){return a.useMemo(()=>e,Object.values(e))}let Pe=a.createContext(void 0);function Ie(){return a.useContext(Pe)}function Ae(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}function Le(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Le),r}var Me,ke=((Me=ke||{})[Me.None=0]="None",Me[Me.RenderStrategy=1]="RenderStrategy",Me[Me.Static=2]="Static",Me),Fe=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Fe||{});function Ne(){let e=function(){let e=a.useRef([]),t=a.useCallback(t=>{for(let n of e.current)null!=n&&("function"==typeof n?n(t):n.current=t)},[]);return(...n)=>{if(!n.every(e=>null==e))return e.current=n,t}}();return a.useCallback(t=>function({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:l,mergeRefs:s}){s=s??qe;let a=_e(t,e);if(i)return De(a,n,r,l,s);let u=o??0;if(2&u){let{static:e=!1,...t}=a;if(e)return De(t,n,r,l,s)}if(1&u){let{unmount:e=!0,...t}=a;return Le(e?0:1,{0:()=>null,1:()=>De({...t,hidden:!0,style:{display:"none"}},n,r,l,s)})}return De(a,n,r,l,s)}({mergeRefs:e,...t}),[e])}function De(e,t={},n,r,o){let{as:i=n,children:l,refName:s="ref",...u}=Be(e,["unmount","static"]),c=void 0!==e.ref?{[s]:e.ref}:{},d="function"==typeof l?l(t):l;"className"in u&&u.className&&"function"==typeof u.className&&(u.className=u.className(t)),u["aria-labelledby"]&&u["aria-labelledby"]===u.id&&(u["aria-labelledby"]=void 0);let f={};if(t){let e=!1,n=[];for(let[r,o]of Object.entries(t))"boolean"==typeof o&&(e=!0),!0===o&&n.push(r.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e){f["data-headlessui-state"]=n.join(" ");for(let e of n)f[`data-${e}`]=""}}if(Ue(i)&&(Object.keys(Ve(u)).length>0||Object.keys(Ve(f)).length>0)){if(!(!a.isValidElement(d)||Array.isArray(d)&&d.length>1||function(e){return Ue(e.type)}(d))){let e=d.props,t=e?.className,n="function"==typeof t?(...e)=>Ae(t(...e),u.className):Ae(t,u.className),r=n?{className:n}:{},i=_e(d.props,Ve(Be(u,["ref"])));for(let e in f)e in i&&delete f[e];return a.cloneElement(d,Object.assign({},i,f,c,{ref:o(We(d),c.ref)},r))}if(Object.keys(Ve(u)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Ve(u)).concat(Object.keys(Ve(f))).map(e=>` - ${e}`).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(e=>` - ${e}`).join("\n")].join("\n"))}return a.createElement(i,Object.assign({},Be(u,["ref"]),!Ue(i)&&c,!Ue(i)&&f),d)}function qe(...e){return e.every(e=>null==e)?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function _e(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])for(let e in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(n[e]=[e=>{var t;return null==(t=e?.preventDefault)?void 0:t.call(e)}]);for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||t?.nativeEvent instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function je(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];for(let e in n)Object.assign(t,{[e](...t){let r=n[e];for(let e of r)e?.(...t)}});return t}function He(e){var t;return Object.assign(a.forwardRef(e),{displayName:null!=(t=e.displayName)?t:e.name})}function Ve(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Be(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function We(e){return s.version.split(".")[0]>="19"?e.props.ref:e.ref}function Ue(e){return e===a.Fragment||e===Symbol.for("react.fragment")}let Ge=a.createContext(void 0);function $e(e){return"object"==typeof e&&null!==e&&"nodeType"in e}function Ke(e){return $e(e)&&"tagName"in e}function ze(e){return Ke(e)&&"accessKey"in e}function Ye(e){return Ke(e)&&"tabIndex"in e}function Qe(e){return ze(e)&&"INPUT"===e.nodeName}function Xe(e){return ze(e)&&"LABEL"===e.nodeName}function Je(e){return ze(e)&&"FIELDSET"===e.nodeName}function Ze(e){return ze(e)&&"LEGEND"===e.nodeName}function et(e){let t=e.parentElement,n=null;for(;t&&!Je(t);)Ze(t)&&(n=t),t=t.parentElement;let r=""===t?.getAttribute("disabled");return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(Ze(t))return!1;t=t.previousElementSibling}return!0}(n))&&r}let tt=Symbol();function nt(...e){let t=a.useRef(e);a.useEffect(()=>{t.current=e},[e]);let n=Oe(e=>{for(let n of t.current)null!=n&&("function"==typeof n?n(e):n.current=e)});return e.every(e=>null==e||e?.[tt])?void 0:n}let rt=a.createContext(null);function ot(){let e=a.useContext(rt);if(null===e){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,ot),e}return e}rt.displayName="DescriptionContext";let it=He(function(e,t){let n=a.useId(),r=Ie(),{id:o=`headlessui-description-${n}`,...i}=e,l=ot(),s=nt(t);Te(()=>l.register(o),[o,l.register]);let u=Re({...l.slot,disabled:r||!1}),c={ref:s,...l.props,id:o};return Ne()({ourProps:c,theirProps:i,slot:u,defaultTag:"p",name:l.name||"Description"})});Object.assign(it,{});var lt=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(lt||{});let st=a.createContext(null);function at(){let e=a.useContext(st);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,at),e}return e}function ut({inherit:e=!1}={}){let t=function(){var e,t;let n=null!=(t=null==(e=a.useContext(st))?void 0:e.value)?t:void 0;return n}(),[n,r]=a.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,a.useMemo(()=>function(e){let t=Oe(e=>(r(t=>[...t,e]),()=>r(t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))),n=a.useMemo(()=>({register:t,slot:e.slot,name:e.name,props:e.props,value:e.value}),[t,e.slot,e.name,e.props,e.value]);return s.createElement(st.Provider,{value:n},e.children)},[r])]}st.displayName="LabelContext";let ct=He(function(e,t){var n;let r=a.useId(),o=at(),i=a.useContext(Ge),l=Ie(),{id:s=`headlessui-label-${r}`,htmlFor:u=i??(null==(n=o.props)?void 0:n.htmlFor),passive:c=!1,...d}=e,f=nt(t);Te(()=>o.register(s),[s,o.register]);let p=Oe(e=>{let t=e.currentTarget;if((e.target===e.currentTarget||!function(e){return!!Ke(e)&&e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]')}(e.target))&&(Xe(t)&&e.preventDefault(),o.props&&"onClick"in o.props&&"function"==typeof o.props.onClick&&o.props.onClick(e),Xe(t))){let e=document.getElementById(t.htmlFor);if(e){let t=e.getAttribute("disabled");if("true"===t||""===t)return;let n=e.getAttribute("aria-disabled");if("true"===n||""===n)return;(Qe(e)&&("file"===e.type||"radio"===e.type||"checkbox"===e.type)||"radio"===e.role||"checkbox"===e.role||"switch"===e.role)&&e.click(),e.focus({preventScroll:!0})}}}),m=Re({...o.slot,disabled:l||!1}),h={ref:f,...o.props,id:s,htmlFor:u,onClick:p};return c&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in d&&delete d.onClick),Ne()({ourProps:h,theirProps:d,slot:m,defaultTag:u?"label":"div",name:o.name||"Label"})});function dt(e){if(null===e)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function ft(e,t,n=!1){let[r,o]=a.useState(()=>dt(t));return Te(()=>{if(!t||!e)return;let n=xe();return n.requestAnimationFrame(function e(){n.requestAnimationFrame(e),o(e=>{let n=dt(t);return n.width===e.width&&n.height===e.height?e:n})}),()=>{n.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}Object.assign(ct,{});var pt=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(pt||{});let mt=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return void 0===t&&(t=this.factory(e),this.set(e,t)),t}};var ht,gt,vt,yt=Object.defineProperty,bt=(e,t,n)=>(((e,t,n)=>{t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,t+"",n),n),Et=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},wt=(e,t,n)=>(Et(e,t,"read from private field"),n?n.call(e):t.get(e)),xt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},St=(e,t,n,r)=>(Et(e,t,"write to private field"),t.set(e,n),n);let Tt=class{constructor(e){xt(this,ht,{}),xt(this,gt,new mt(()=>new Set)),xt(this,vt,new Set),bt(this,"disposables",xe()),St(this,ht,e),ve.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return wt(this,ht)}subscribe(e,t){if(ve.isServer)return()=>{};let n={selector:e,callback:t,current:e(wt(this,ht))};return wt(this,vt).add(n),this.disposables.add(()=>{wt(this,vt).delete(n)})}on(e,t){return ve.isServer?()=>{}:(wt(this,gt).get(e).add(t),this.disposables.add(()=>{wt(this,gt).get(e).delete(t)}))}send(e){let t=this.reduce(wt(this,ht),e);if(t!==wt(this,ht)){St(this,ht,t);for(let e of wt(this,vt)){let t=e.selector(wt(this,ht));Ct(e.current,t)||(e.current=t,e.callback(t))}for(let t of wt(this,gt).get(e.type))t(wt(this,ht),e)}}};function Ct(e,t){return!!Object.is(e,t)||"object"==typeof e&&null!==e&&"object"==typeof t&&null!==t&&(Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&Ot(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&Ot(e.entries(),t.entries()):!(!Rt(e)||!Rt(t))&&Ot(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()))}function Ot(e,t){for(;;){let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}}function Rt(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function Pt(e){let[t,n]=e(),r=xe();return(...e)=>{t(...e),r.dispose(),r.microTask(n)}}ht=new WeakMap,gt=new WeakMap,vt=new WeakMap;var It=Object.defineProperty,At=(e,t,n)=>(((e,t,n)=>{t in e?It(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Lt=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Lt||{});let Mt={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(-1!==o){let t=e.stack.slice();return t.splice(o,1),t.push(n),r=t,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(-1===r)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},kt=class e extends Tt{constructor(){super(...arguments),At(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),At(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new e({stack:[]})}reduce(e,t){return Le(t.type,Mt,e,t)}};const Ft=new mt(()=>kt.new());var Nt,Dt={exports:{}},qt={};
1
+ import{X as e,u as t,f as n,v as r,k as o,l as i,a0 as l,Z as s,a,K as u,a3 as c,j as d,I as f,W as p,Y as m,c as h,T as g,e as v,A as y,b,a2 as E,B as w,P as x}from"./index-JyoNGo8S.js";import{u as S,T}from"./useOrgAccess-CnN4aiYB.js";import{r as C}from"./tslib.es6-C9bR68b3.js";const O=s=>{const a=e(),{props:{organizationId:u}}=t(),{role:c,isSuper:d}=S(),{isLoading:f,data:p,isError:m,error:h}=n({queryKey:[r.EVENT_IN_REVIEW_COUNT(s?.slug)],queryFn:async()=>{try{const e=await o.get(i.GET_CONTENTS_COUNT,{searchParams:{eventSlug:s?.slug,filter:`status:${l.IN_REVIEW}`},headers:{"x-org-id":u}}).json();if(e.error)throw new Error(e.error);return e.data}catch(e){throw new Error(e?.message||e||"Failed to fetch in review count")}},staleTime:0,enabled:!!c||d});return{loading:f,inReviewCount:p,error:m?h:null,increment:()=>{a.setQueryData([r.EVENT_IN_REVIEW_COUNT(s?.slug)],e=>e+1)},decrement:()=>{a.setQueryData([r.EVENT_IN_REVIEW_COUNT(s?.slug)],e=>e-1)}}},R=e=>e&&e.length>0?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"",P=typeof document<"u"?s.useLayoutEffect:()=>{};var I;const A=null!==(I=s.useInsertionEffect)&&void 0!==I?I:P;const L=e=>{var t;return null!==(t=e?.ownerDocument)&&void 0!==t?t:document},M=e=>e&&"window"in e&&e.window===e?e:L(e).defaultView||window;function k(e,t){return!(!t||!e)&&e.contains(t)}const F=(e=document)=>e.activeElement;function N(e){return e.target}var D={};function q(e){if("test"===D.NODE_ENV)return e;let t=null;return()=>(null==t&&(t=e()),t)}const _=q(function(){return e=/^Mac/i,typeof window<"u"&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform);var e,t}),j=q(function(){return function(e){var t;if(typeof window>"u"||null==window.navigator)return!1;let n=null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands;return Array.isArray(n)&&n.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}(/Android/i)});function H(){let e=a.useRef(new Map),t=a.useCallback((t,n,r,o)=>{let i=o?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:i,options:o}),t.addEventListener(n,i,o)},[]),n=a.useCallback((t,n,r,o)=>{var i;let l=(null===(i=e.current.get(r))||void 0===i?void 0:i.fn)||r;t.removeEventListener(n,l,o),e.current.delete(r)},[]),r=a.useCallback(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return a.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function V(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function B(e){let t=a.useRef({isFocused:!1,observer:null});P(()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]);let n=function(e){const t=a.useRef(null);return A(()=>{t.current=e},[e]),a.useCallback((...e)=>{const n=t.current;return n?.(...e)},[])}(t=>{e?.(t)});return a.useCallback(e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target,o=e=>{if(t.current.isFocused=!1,r.disabled){let t=V(e);n(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};r.addEventListener("focusout",o,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;null===(e=t.current.observer)||void 0===e||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent("blur",{relatedTarget:n})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[n])}var W={};let U=null,G=new Set,$=new Map,K=!1,z=!1;const Y={Tab:!0,Escape:!0};function Q(e,t){for(let n of G)n(e,t)}function X(e){K=!0,function(e){return!(e.metaKey||!_()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(U="keyboard",Q("keyboard",e))}function J(e){U="pointer",("mousedown"===e.type||"pointerdown"===e.type)&&(K=!0,Q("pointer",e))}function Z(e){(function(e){return!(""!==e.pointerType||!e.isTrusted)||(j()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)})(e)&&(K=!0,U="virtual")}function ee(e){e.target===window||e.target===document||!e.isTrusted||(!K&&!z&&(U="virtual",Q("virtual",e)),K=!1,z=!1)}function te(){K=!1,z=!0}function ne(e){if(typeof window>"u"||typeof document>"u"||$.get(M(e)))return;const t=M(e),n=L(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){K=!0,r.apply(this,arguments)},n.addEventListener("keydown",X,!0),n.addEventListener("keyup",X,!0),n.addEventListener("click",Z,!0),t.addEventListener("focus",ee,!0),t.addEventListener("blur",te,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",J,!0),n.addEventListener("pointermove",J,!0),n.addEventListener("pointerup",J,!0)):"test"===W.NODE_ENV&&(n.addEventListener("mousedown",J,!0),n.addEventListener("mousemove",J,!0),n.addEventListener("mouseup",J,!0)),t.addEventListener("beforeunload",()=>{re(e)},{once:!0}),$.set(t,{focus:r})}const re=(e,t)=>{const n=M(e),r=L(e);t&&r.removeEventListener("DOMContentLoaded",t),$.has(n)&&(n.HTMLElement.prototype.focus=$.get(n).focus,r.removeEventListener("keydown",X,!0),r.removeEventListener("keyup",X,!0),r.removeEventListener("click",Z,!0),n.removeEventListener("focus",ee,!0),n.removeEventListener("blur",te,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",J,!0),r.removeEventListener("pointermove",J,!0),r.removeEventListener("pointerup",J,!0)):"test"===W.NODE_ENV&&(r.removeEventListener("mousedown",J,!0),r.removeEventListener("mousemove",J,!0),r.removeEventListener("mouseup",J,!0)),$.delete(n))};function oe(){return"pointer"!==U}typeof document<"u"&&function(e){const t=L(e);let n;"loading"!==t.readyState?ne(e):(n=()=>{ne(e)},t.addEventListener("DOMContentLoaded",n))}();const ie=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function le(e,t,n){ne(),a.useEffect(()=>{let t=(t,r)=>{(function(e,t,n){let r=L(n?.target);const o=typeof window<"u"?M(n?.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?M(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?M(n?.target).HTMLElement:HTMLElement,s=typeof window<"u"?M(n?.target).KeyboardEvent:KeyboardEvent;return!((e=e||r.activeElement instanceof o&&!ie.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof l&&r.activeElement.isContentEditable)&&"keyboard"===t&&n instanceof s&&!Y[n.key])})(!!n?.isTextInput,t,r)&&e(oe())};return G.add(t),()=>{G.delete(t)}},t)}function se(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=a.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:s}=H(),u=a.useCallback(e=>{e.currentTarget.contains(e.target)&&i.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(i.current.isFocusWithin=!1,s(),n&&n(e),o&&o(!1))},[n,o,i,s]),c=B(u),d=a.useCallback(e=>{if(!e.currentTarget.contains(e.target))return;const t=L(e.target),n=F(t);if(!i.current.isFocusWithin&&n===N(e.nativeEvent)){r&&r(e),o&&o(!0),i.current.isFocusWithin=!0,c(e);let n=e.currentTarget;l(t,"focus",e=>{if(i.current.isFocusWithin&&!k(n,e.target)){let r=new t.defaultView.FocusEvent("blur",{relatedTarget:e.target});!function(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}(r,n);let o=V(r);u(o)}},{capture:!0})}},[r,o,c,l,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:u}}}var ae={};let ue=!1,ce=0;function de(){ue=!0,setTimeout(()=>{ue=!1},50)}function fe(e){"touch"===e.pointerType&&de()}function pe(){if(!(typeof document>"u"))return 0===ce&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",fe):"test"===ae.NODE_ENV&&document.addEventListener("touchend",de)),ce++,()=>{ce--,!(ce>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",fe):"test"===ae.NODE_ENV&&document.removeEventListener("touchend",de))}}function me(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=a.useRef({isFocused:!1,isFocusVisible:t||oe()}),[i,l]=a.useState(!1),[s,u]=a.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=a.useCallback(()=>u(o.current.isFocused&&o.current.isFocusVisible),[]),d=a.useCallback(e=>{o.current.isFocused=e,l(e),c()},[c]);le(e=>{o.current.isFocusVisible=e,c()},[],{isTextInput:n});let{focusProps:f}=function(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const i=a.useCallback(e=>{if(e.target===e.currentTarget)return r&&r(e),o&&o(!1),!0},[r,o]),l=B(i),s=a.useCallback(e=>{const t=L(e.target),r=t?F(t):F();e.target===e.currentTarget&&r===N(e.nativeEvent)&&(n&&n(e),o&&o(!0),l(e))},[o,n,l]);return{focusProps:{onFocus:!t&&(n||o||r)?s:void 0,onBlur:t||!r&&!o?void 0:i}}}({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=se({isDisabled:!r,onFocusWithinChange:d});return{isFocused:i,isFocusVisible:s,focusProps:r?p:f}}var he=Object.defineProperty,ge=(e,t,n)=>(((e,t,n)=>{t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let ve=new class{constructor(){ge(this,"current",this.detect()),ge(this,"handoffState","pending"),ge(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}};function ye(e){var t;return ve.isServer?null:null==e?document:null!=(t=e?.ownerDocument)?t:document}function be(e){var t,n;return ve.isServer?null:null==e?document:null!=(n=null==(t=e?.getRootNode)?void 0:t.call(e))?n:document}function Ee(e){var t,n;return null!=(n=null==(t=be(e))?void 0:t.activeElement)?n:null}function we(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function xe(){let e=[],t={addEventListener:(e,n,r,o)=>(e.addEventListener(n,r,o),t.add(()=>e.removeEventListener(n,r,o))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return we(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=xe();return e(t),this.add(()=>t.dispose())},add:t=>(e.includes(t)||e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function Se(){let[e]=a.useState(xe);return a.useEffect(()=>()=>e.dispose(),[e]),e}let Te=(e,t)=>{ve.isServer?a.useEffect(e,t):a.useLayoutEffect(e,t)};function Ce(e){let t=a.useRef(e);return Te(()=>{t.current=e},[e]),t}let Oe=function(e){let t=Ce(e);return s.useCallback((...e)=>t.current(...e),[t])};function Re(e){return a.useMemo(()=>e,Object.values(e))}let Pe=a.createContext(void 0);function Ie(){return a.useContext(Pe)}function Ae(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}function Le(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Le),r}var Me,ke=((Me=ke||{})[Me.None=0]="None",Me[Me.RenderStrategy=1]="RenderStrategy",Me[Me.Static=2]="Static",Me),Fe=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Fe||{});function Ne(){let e=function(){let e=a.useRef([]),t=a.useCallback(t=>{for(let n of e.current)null!=n&&("function"==typeof n?n(t):n.current=t)},[]);return(...n)=>{if(!n.every(e=>null==e))return e.current=n,t}}();return a.useCallback(t=>function({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:l,mergeRefs:s}){s=s??qe;let a=_e(t,e);if(i)return De(a,n,r,l,s);let u=o??0;if(2&u){let{static:e=!1,...t}=a;if(e)return De(t,n,r,l,s)}if(1&u){let{unmount:e=!0,...t}=a;return Le(e?0:1,{0:()=>null,1:()=>De({...t,hidden:!0,style:{display:"none"}},n,r,l,s)})}return De(a,n,r,l,s)}({mergeRefs:e,...t}),[e])}function De(e,t={},n,r,o){let{as:i=n,children:l,refName:s="ref",...u}=Be(e,["unmount","static"]),c=void 0!==e.ref?{[s]:e.ref}:{},d="function"==typeof l?l(t):l;"className"in u&&u.className&&"function"==typeof u.className&&(u.className=u.className(t)),u["aria-labelledby"]&&u["aria-labelledby"]===u.id&&(u["aria-labelledby"]=void 0);let f={};if(t){let e=!1,n=[];for(let[r,o]of Object.entries(t))"boolean"==typeof o&&(e=!0),!0===o&&n.push(r.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e){f["data-headlessui-state"]=n.join(" ");for(let e of n)f[`data-${e}`]=""}}if(Ue(i)&&(Object.keys(Ve(u)).length>0||Object.keys(Ve(f)).length>0)){if(!(!a.isValidElement(d)||Array.isArray(d)&&d.length>1||function(e){return Ue(e.type)}(d))){let e=d.props,t=e?.className,n="function"==typeof t?(...e)=>Ae(t(...e),u.className):Ae(t,u.className),r=n?{className:n}:{},i=_e(d.props,Ve(Be(u,["ref"])));for(let e in f)e in i&&delete f[e];return a.cloneElement(d,Object.assign({},i,f,c,{ref:o(We(d),c.ref)},r))}if(Object.keys(Ve(u)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Ve(u)).concat(Object.keys(Ve(f))).map(e=>` - ${e}`).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(e=>` - ${e}`).join("\n")].join("\n"))}return a.createElement(i,Object.assign({},Be(u,["ref"]),!Ue(i)&&c,!Ue(i)&&f),d)}function qe(...e){return e.every(e=>null==e)?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function _e(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])for(let e in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(n[e]=[e=>{var t;return null==(t=e?.preventDefault)?void 0:t.call(e)}]);for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||t?.nativeEvent instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function je(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];for(let e in n)Object.assign(t,{[e](...t){let r=n[e];for(let e of r)e?.(...t)}});return t}function He(e){var t;return Object.assign(a.forwardRef(e),{displayName:null!=(t=e.displayName)?t:e.name})}function Ve(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Be(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function We(e){return s.version.split(".")[0]>="19"?e.props.ref:e.ref}function Ue(e){return e===a.Fragment||e===Symbol.for("react.fragment")}let Ge=a.createContext(void 0);function $e(e){return"object"==typeof e&&null!==e&&"nodeType"in e}function Ke(e){return $e(e)&&"tagName"in e}function ze(e){return Ke(e)&&"accessKey"in e}function Ye(e){return Ke(e)&&"tabIndex"in e}function Qe(e){return ze(e)&&"INPUT"===e.nodeName}function Xe(e){return ze(e)&&"LABEL"===e.nodeName}function Je(e){return ze(e)&&"FIELDSET"===e.nodeName}function Ze(e){return ze(e)&&"LEGEND"===e.nodeName}function et(e){let t=e.parentElement,n=null;for(;t&&!Je(t);)Ze(t)&&(n=t),t=t.parentElement;let r=""===t?.getAttribute("disabled");return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(Ze(t))return!1;t=t.previousElementSibling}return!0}(n))&&r}let tt=Symbol();function nt(...e){let t=a.useRef(e);a.useEffect(()=>{t.current=e},[e]);let n=Oe(e=>{for(let n of t.current)null!=n&&("function"==typeof n?n(e):n.current=e)});return e.every(e=>null==e||e?.[tt])?void 0:n}let rt=a.createContext(null);function ot(){let e=a.useContext(rt);if(null===e){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,ot),e}return e}rt.displayName="DescriptionContext";let it=He(function(e,t){let n=a.useId(),r=Ie(),{id:o=`headlessui-description-${n}`,...i}=e,l=ot(),s=nt(t);Te(()=>l.register(o),[o,l.register]);let u=Re({...l.slot,disabled:r||!1}),c={ref:s,...l.props,id:o};return Ne()({ourProps:c,theirProps:i,slot:u,defaultTag:"p",name:l.name||"Description"})});Object.assign(it,{});var lt=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(lt||{});let st=a.createContext(null);function at(){let e=a.useContext(st);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,at),e}return e}function ut({inherit:e=!1}={}){let t=function(){var e,t;let n=null!=(t=null==(e=a.useContext(st))?void 0:e.value)?t:void 0;return n}(),[n,r]=a.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,a.useMemo(()=>function(e){let t=Oe(e=>(r(t=>[...t,e]),()=>r(t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))),n=a.useMemo(()=>({register:t,slot:e.slot,name:e.name,props:e.props,value:e.value}),[t,e.slot,e.name,e.props,e.value]);return s.createElement(st.Provider,{value:n},e.children)},[r])]}st.displayName="LabelContext";let ct=He(function(e,t){var n;let r=a.useId(),o=at(),i=a.useContext(Ge),l=Ie(),{id:s=`headlessui-label-${r}`,htmlFor:u=i??(null==(n=o.props)?void 0:n.htmlFor),passive:c=!1,...d}=e,f=nt(t);Te(()=>o.register(s),[s,o.register]);let p=Oe(e=>{let t=e.currentTarget;if((e.target===e.currentTarget||!function(e){return!!Ke(e)&&e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]')}(e.target))&&(Xe(t)&&e.preventDefault(),o.props&&"onClick"in o.props&&"function"==typeof o.props.onClick&&o.props.onClick(e),Xe(t))){let e=document.getElementById(t.htmlFor);if(e){let t=e.getAttribute("disabled");if("true"===t||""===t)return;let n=e.getAttribute("aria-disabled");if("true"===n||""===n)return;(Qe(e)&&("file"===e.type||"radio"===e.type||"checkbox"===e.type)||"radio"===e.role||"checkbox"===e.role||"switch"===e.role)&&e.click(),e.focus({preventScroll:!0})}}}),m=Re({...o.slot,disabled:l||!1}),h={ref:f,...o.props,id:s,htmlFor:u,onClick:p};return c&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in d&&delete d.onClick),Ne()({ourProps:h,theirProps:d,slot:m,defaultTag:u?"label":"div",name:o.name||"Label"})});function dt(e){if(null===e)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function ft(e,t,n=!1){let[r,o]=a.useState(()=>dt(t));return Te(()=>{if(!t||!e)return;let n=xe();return n.requestAnimationFrame(function e(){n.requestAnimationFrame(e),o(e=>{let n=dt(t);return n.width===e.width&&n.height===e.height?e:n})}),()=>{n.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}Object.assign(ct,{});var pt=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(pt||{});let mt=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return void 0===t&&(t=this.factory(e),this.set(e,t)),t}};var ht,gt,vt,yt=Object.defineProperty,bt=(e,t,n)=>(((e,t,n)=>{t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,t+"",n),n),Et=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},wt=(e,t,n)=>(Et(e,t,"read from private field"),n?n.call(e):t.get(e)),xt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},St=(e,t,n,r)=>(Et(e,t,"write to private field"),t.set(e,n),n);let Tt=class{constructor(e){xt(this,ht,{}),xt(this,gt,new mt(()=>new Set)),xt(this,vt,new Set),bt(this,"disposables",xe()),St(this,ht,e),ve.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return wt(this,ht)}subscribe(e,t){if(ve.isServer)return()=>{};let n={selector:e,callback:t,current:e(wt(this,ht))};return wt(this,vt).add(n),this.disposables.add(()=>{wt(this,vt).delete(n)})}on(e,t){return ve.isServer?()=>{}:(wt(this,gt).get(e).add(t),this.disposables.add(()=>{wt(this,gt).get(e).delete(t)}))}send(e){let t=this.reduce(wt(this,ht),e);if(t!==wt(this,ht)){St(this,ht,t);for(let e of wt(this,vt)){let t=e.selector(wt(this,ht));Ct(e.current,t)||(e.current=t,e.callback(t))}for(let t of wt(this,gt).get(e.type))t(wt(this,ht),e)}}};function Ct(e,t){return!!Object.is(e,t)||"object"==typeof e&&null!==e&&"object"==typeof t&&null!==t&&(Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&Ot(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&Ot(e.entries(),t.entries()):!(!Rt(e)||!Rt(t))&&Ot(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()))}function Ot(e,t){for(;;){let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}}function Rt(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function Pt(e){let[t,n]=e(),r=xe();return(...e)=>{t(...e),r.dispose(),r.microTask(n)}}ht=new WeakMap,gt=new WeakMap,vt=new WeakMap;var It=Object.defineProperty,At=(e,t,n)=>(((e,t,n)=>{t in e?It(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Lt=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Lt||{});let Mt={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(-1!==o){let t=e.stack.slice();return t.splice(o,1),t.push(n),r=t,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(-1===r)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},kt=class e extends Tt{constructor(){super(...arguments),At(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),At(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new e({stack:[]})}reduce(e,t){return Le(t.type,Mt,e,t)}};const Ft=new mt(()=>kt.new());var Nt,Dt={exports:{}},qt={};
2
2
  /**
3
3
  * @license React
4
4
  * use-sync-external-store-with-selector.production.js
@@ -1 +1 @@
1
- import{P as e,j as s,I as r,h as a,T as o}from"./index-dgkxxAYh.js";const l=(s,r)=>{const a=new Map;s?.forEach(e=>{a.set(e._id,e)});const o=[];let l=a.get(r);for(;l;)o.unshift({_id:l._id,name:l.name,href:e.FOLDER_EVENTS(l?._id),color:l.color}),l=a.get(l.parentFolderId);return o},c=({folder:e})=>s.jsxs("li",{className:"qc:flex qc:items-center",children:[s.jsx(r,{name:"material-symbols:arrow-forward-ios-rounded",size:"sm"}),s.jsxs(a,{to:e.href,className:"qc:flex qc:items-center qc:gap-2 qc:rounded qc:px-4 qc:py-1 qc:transition-colors qc:hover:bg-primary/10",children:[s.jsx(r,{name:"material-symbols:folder",size:"lg",style:{color:e.color}}),s.jsx(o,{variant:"h5",color:"secondary",className:"qc:whitespace-nowrap",children:e.name})]})]},e.name),n=({homeLink:e,data:o})=>s.jsxs("ol",{role:"list",className:"scrollbar-hide qc:flex qc:max-w-full qc:items-center qc:space-x-3 qc:overflow-y-scroll",children:[s.jsx("li",{children:s.jsxs(a,{to:e,className:"qc:text-foreground",children:[s.jsx(r,{name:"material-symbols:home-outline-rounded",size:"lg"}),s.jsx("span",{className:"qc:sr-only",children:"Home"})]})}),o?.map(e=>s.jsx(c,{folder:e},e._id))]});export{n as F,l as g};
1
+ import{P as e,j as s,I as r,h as a,T as o}from"./index-JyoNGo8S.js";const l=(s,r)=>{const a=new Map;s?.forEach(e=>{a.set(e._id,e)});const o=[];let l=a.get(r);for(;l;)o.unshift({_id:l._id,name:l.name,href:e.FOLDER_EVENTS(l?._id),color:l.color}),l=a.get(l.parentFolderId);return o},c=({folder:e})=>s.jsxs("li",{className:"qc:flex qc:items-center",children:[s.jsx(r,{name:"material-symbols:arrow-forward-ios-rounded",size:"sm"}),s.jsxs(a,{to:e.href,className:"qc:flex qc:items-center qc:gap-2 qc:rounded qc:px-4 qc:py-1 qc:transition-colors qc:hover:bg-primary/10",children:[s.jsx(r,{name:"material-symbols:folder",size:"lg",style:{color:e.color}}),s.jsx(o,{variant:"h5",color:"secondary",className:"qc:whitespace-nowrap",children:e.name})]})]},e.name),n=({homeLink:e,data:o})=>s.jsxs("ol",{role:"list",className:"scrollbar-hide qc:flex qc:max-w-full qc:items-center qc:space-x-3 qc:overflow-y-scroll",children:[s.jsx("li",{children:s.jsxs(a,{to:e,className:"qc:text-foreground",children:[s.jsx(r,{name:"material-symbols:home-outline-rounded",size:"lg"}),s.jsx("span",{className:"qc:sr-only",children:"Home"})]})}),o?.map(e=>s.jsx(c,{folder:e},e._id))]});export{n as F,l as g};
@@ -1 +1 @@
1
- import{j as e,a as r,u as n,T as o,O as t,k as a,l as s,Z as l,ab as i,P as c}from"./index-dgkxxAYh.js";import{I as d}from"./InputField-DCqkCRI8.js";import{u,o as m,c as f,C as p,a as h,b as g}from"./index.esm-DH681Jwb.js";const v=({count:r=1,currentStep:n=0,disabled:o,onStepClick:t})=>{const a=o||!t;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,o)=>e.jsx("li",{children:o<n?e.jsx("button",{className:"qc:bg-primary qc:block qc:size-3 qc:rounded-full",disabled:a,onClick:()=>t&&t(o)}):o===n?e.jsxs("button",{className:"qc:relative qc:flex qc:items-center qc:justify-center","aria-current":"step",disabled:a,onClick:()=>t&&t(o),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:a,onClick:()=>t&&t(o)})},`progress-dot-${o}`))})},q={email:""},w=f().shape({email:h().required("Please enter your email").email("Enter a valid email")}),x=({onCodeSent:l})=>{const[i,c]=r.useState(!1),[f,h]=r.useState(null),{props:{organizationId:g}}=n(),{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(s.SEND_PASSWORD_RESET_CODE,{json:{email:e.email?.toLowerCase()},headers:{"x-org-id":g}}),l(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:n,onBlur:o}})=>e.jsx(d,{label:"Email",disabled:i,type:"email",value:r,onChange:n,onBlur:o,error:y.email?.message})}),e.jsx(t,{fullWidth:!0,type:"submit",loading:i,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,n=void 0===r?"":r,o=e.numInputs,t=void 0===o?4:o,a=e.onChange,s=e.onPaste,i=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=l.useState(0),x=w[0],b=w[1],j=l.useRef([]),S=function(){return n?n.toString().split(""):[]},C="number"===m||"tel"===m;l.useEffect(function(){j.current=j.current.slice(0,t)},[t]),l.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===t)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,n=e.target.value;if(!N(n)){if(n.length===t)n.split("").some(function(e){return!N(e)})||(O(n.split("")),I(t-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,n,o=Math.max(Math.min(t-1,e),0);j.current[o]&&(null===(r=j.current[o])||void 0===r||r.focus(),null===(n=j.current[o])||void 0===n||n.select(),b(o))},R=function(e){var r=S();r[x]=e[0],O(r)},O=function(e){var r=e.join("");a(r)},B=function(e){var r;e.preventDefault();var n=S(),o=x,a=e.clipboardData.getData("text/plain").slice(0,t-x).split("");if(!C||!a.some(function(e){return isNaN(Number(e))})){for(var s=0;s<t;++s)s>=x&&a.length>0&&(n[s]=null!==(r=a.shift())&&void 0!==r?r:"",o++);I(o),O(n)}};return l.createElement("div",{style:Object.assign({display:"flex",alignItems:"center"},y(h)&&h),className:"string"==typeof h?h:void 0,onPaste:s},Array.from({length:t},function(e,r){return r}).map(function(e){var r,n,o;return l.createElement(l.Fragment,{key:e},i({value:null!==(r=S()[e])&&void 0!==r?r:"",placeholder:null!==(o=null===(n=P())||void 0===n?void 0:n[e])&&void 0!==o?o: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<t-1&&("function"==typeof f?f(e):f))}))};const j={code:""},S=f().shape({code:h().required("Please enter the code")}),C=({email:l,onCodeVerified:i})=>{const{props:{organizationId:c}}=n(),[d,f]=r.useState(!1),[h,g]=r.useState(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:l})]}),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(s.VERIFY_PASSWORD_RESET_CODE,{json:{email:l,code:e.code},headers:{"x-org-id":c}}),i&&i()}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:n}})=>e.jsx(b,{value:r,onChange:n,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(t,{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:l,onPasswordReset:i})=>{const{props:{organizationId:c}}=n(),[f,h]=r.useState({showPassword:!1,showConfirmPassword:!1}),[g,v]=r.useState(!1),[q,w]=r.useState(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(s.RESET_PASSWORD,{json:{email:l.toLowerCase(),password:e.password},headers:{"x-org-id":c}});r.error?w(r.error):i()}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:n,onBlur:o}})=>e.jsx(d,{label:"New password",disabled:g,type:f.showPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.password?.message})}),e.jsx(t,{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:n,onBlur:o}})=>e.jsx(d,{label:"Confirm new password",disabled:g,type:f.showConfirmPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.confirmPassword?.message})}),e.jsx(t,{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(t,{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 n=i(),[o,t]=r.useState(null),[a,s]=r.useState(0);return e.jsxs("div",{className:"space-y-9",children:[(({index:r})=>{switch(r){case 0:return e.jsx(x,{onCodeSent:e=>{t(e),s(1)}});case 1:return e.jsx(C,{email:o,onCodeVerified:()=>s(2)});case 2:return e.jsx(D,{email:o,onPasswordReset:()=>{n(c.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,a as r,u as n,T as o,O as t,k as a,l as s,Z as l,ab as i,P as c}from"./index-JyoNGo8S.js";import{I as d}from"./InputField-DybXE_Ab.js";import{u,o as m,c as f,C as p,a as h,b as g}from"./index.esm-CAQX5kI5.js";const v=({count:r=1,currentStep:n=0,disabled:o,onStepClick:t})=>{const a=o||!t;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,o)=>e.jsx("li",{children:o<n?e.jsx("button",{className:"qc:bg-primary qc:block qc:size-3 qc:rounded-full",disabled:a,onClick:()=>t&&t(o)}):o===n?e.jsxs("button",{className:"qc:relative qc:flex qc:items-center qc:justify-center","aria-current":"step",disabled:a,onClick:()=>t&&t(o),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:a,onClick:()=>t&&t(o)})},`progress-dot-${o}`))})},q={email:""},w=f().shape({email:h().required("Please enter your email").email("Enter a valid email")}),x=({onCodeSent:l})=>{const[i,c]=r.useState(!1),[f,h]=r.useState(null),{props:{organizationId:g}}=n(),{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(s.SEND_PASSWORD_RESET_CODE,{json:{email:e.email?.toLowerCase()},headers:{"x-org-id":g}}),l(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:n,onBlur:o}})=>e.jsx(d,{label:"Email",disabled:i,type:"email",value:r,onChange:n,onBlur:o,error:y.email?.message})}),e.jsx(t,{fullWidth:!0,type:"submit",loading:i,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,n=void 0===r?"":r,o=e.numInputs,t=void 0===o?4:o,a=e.onChange,s=e.onPaste,i=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=l.useState(0),x=w[0],b=w[1],j=l.useRef([]),S=function(){return n?n.toString().split(""):[]},C="number"===m||"tel"===m;l.useEffect(function(){j.current=j.current.slice(0,t)},[t]),l.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===t)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,n=e.target.value;if(!N(n)){if(n.length===t)n.split("").some(function(e){return!N(e)})||(O(n.split("")),I(t-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,n,o=Math.max(Math.min(t-1,e),0);j.current[o]&&(null===(r=j.current[o])||void 0===r||r.focus(),null===(n=j.current[o])||void 0===n||n.select(),b(o))},R=function(e){var r=S();r[x]=e[0],O(r)},O=function(e){var r=e.join("");a(r)},B=function(e){var r;e.preventDefault();var n=S(),o=x,a=e.clipboardData.getData("text/plain").slice(0,t-x).split("");if(!C||!a.some(function(e){return isNaN(Number(e))})){for(var s=0;s<t;++s)s>=x&&a.length>0&&(n[s]=null!==(r=a.shift())&&void 0!==r?r:"",o++);I(o),O(n)}};return l.createElement("div",{style:Object.assign({display:"flex",alignItems:"center"},y(h)&&h),className:"string"==typeof h?h:void 0,onPaste:s},Array.from({length:t},function(e,r){return r}).map(function(e){var r,n,o;return l.createElement(l.Fragment,{key:e},i({value:null!==(r=S()[e])&&void 0!==r?r:"",placeholder:null!==(o=null===(n=P())||void 0===n?void 0:n[e])&&void 0!==o?o: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<t-1&&("function"==typeof f?f(e):f))}))};const j={code:""},S=f().shape({code:h().required("Please enter the code")}),C=({email:l,onCodeVerified:i})=>{const{props:{organizationId:c}}=n(),[d,f]=r.useState(!1),[h,g]=r.useState(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:l})]}),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(s.VERIFY_PASSWORD_RESET_CODE,{json:{email:l,code:e.code},headers:{"x-org-id":c}}),i&&i()}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:n}})=>e.jsx(b,{value:r,onChange:n,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(t,{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:l,onPasswordReset:i})=>{const{props:{organizationId:c}}=n(),[f,h]=r.useState({showPassword:!1,showConfirmPassword:!1}),[g,v]=r.useState(!1),[q,w]=r.useState(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(s.RESET_PASSWORD,{json:{email:l.toLowerCase(),password:e.password},headers:{"x-org-id":c}});r.error?w(r.error):i()}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:n,onBlur:o}})=>e.jsx(d,{label:"New password",disabled:g,type:f.showPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.password?.message})}),e.jsx(t,{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:n,onBlur:o}})=>e.jsx(d,{label:"Confirm new password",disabled:g,type:f.showConfirmPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.confirmPassword?.message})}),e.jsx(t,{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(t,{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 n=i(),[o,t]=r.useState(null),[a,s]=r.useState(0);return e.jsxs("div",{className:"space-y-9",children:[(({index:r})=>{switch(r){case 0:return e.jsx(x,{onCodeSent:e=>{t(e),s(1)}});case 1:return e.jsx(C,{email:o,onCodeVerified:()=>s(2)});case 2:return e.jsx(D,{email:o,onPasswordReset:()=>{n(c.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 +1 @@
1
- import{u as e,j as c,c as t}from"./index-dgkxxAYh.js";const r=({label:r,type:s="text",step:o=1,disabled:q,error:a,info:d,iconSVG:i,className:l="",...n})=>{const{props:{textClassName:m}}=e();return c.jsxs("div",{className:"qc:relative",children:[r&&c.jsx("div",{className:"qc:mb-1 qc:flex qc:items-center qc:gap-1",children:c.jsx("label",{className:t("qc:select-none qc:text-sm qc:font-medium",m,q?"qc:text-muted":"qc:text-foreground"),children:r})}),c.jsx("input",{type:s,disabled:q,step:"number"===s?o:void 0,"aria-invalid":!!a,className:t("qc:text-foreground qc:border-border qc:shadow-outer qc:focus:border-primary qc:focus:ring-primary qc:peer qc:w-full qc:rounded qc:border qc:p-2 qc:focus:outline-none",q?"qc:text-muted qc:bg-transparent":"qc:text-foreground qc:bg-white",a?"qc:border-destructive":"qc:border-border",i?"qc:pl-9":"",m,l),...n}),c.jsx("div",{className:t("qc:text-destructive qc:absolute qc:left-0 qc:flex qc:items-center qc:gap-1 qc:text-xs qc:transition-all qc:duration-300 qc:md:text-sm",a?"qc:-bottom-5 qc:opacity-100":"qc:-bottom-1 qc:opacity-0",m),children:c.jsx("label",{children:a})})]})};export{r as I};
1
+ import{u as e,j as c,c as t}from"./index-JyoNGo8S.js";const r=({label:r,type:s="text",step:o=1,disabled:q,error:a,info:d,iconSVG:i,className:l="",...n})=>{const{props:{textClassName:m}}=e();return c.jsxs("div",{className:"qc:relative",children:[r&&c.jsx("div",{className:"qc:mb-1 qc:flex qc:items-center qc:gap-1",children:c.jsx("label",{className:t("qc:select-none qc:text-sm qc:font-medium",m,q?"qc:text-muted":"qc:text-foreground"),children:r})}),c.jsx("input",{type:s,disabled:q,step:"number"===s?o:void 0,"aria-invalid":!!a,className:t("qc:text-foreground qc:border-border qc:shadow-outer qc:focus:border-primary qc:focus:ring-primary qc:peer qc:w-full qc:rounded qc:border qc:p-2 qc:focus:outline-none",q?"qc:text-muted qc:bg-transparent":"qc:text-foreground qc:bg-white",a?"qc:border-destructive":"qc:border-border",i?"qc:pl-9":"",m,l),...n}),c.jsx("div",{className:t("qc:text-destructive qc:absolute qc:left-0 qc:flex qc:items-center qc:gap-1 qc:text-xs qc:transition-all qc:duration-300 qc:md:text-sm",a?"qc:-bottom-5 qc:opacity-100":"qc:-bottom-1 qc:opacity-0",m),children:c.jsx("label",{children:a})})]})};export{r as I};
@@ -1 +1 @@
1
- import{a as t,j as e,c as r}from"./index-dgkxxAYh.js";var i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],s=t=>{let e=0;for(let r=0;r<t.length;r++){let s=t[r];e=83*e+i.indexOf(s)}return e},n=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},o=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},h=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),a=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},l=t=>{let e=t>>8&255,r=255&t;return[n(t>>16),n(e),n(r)]},c=(t,e)=>{let r=Math.floor(t/361),i=Math.floor(t/19)%19,s=t%19;return[h((r-9)/9,2)*e,h((i-9)/9,2)*e,h((s-9)/9,2)*e]},u=(t,e,r,i)=>{(t=>{if(!t||t.length<6)throw new a("The blurhash string must be at least 6 characters");let e=s(t[0]),r=Math.floor(e/9)+1,i=e%9+1;if(t.length!==4+2*i*r)throw new a(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*i*r}`)})(t),i|=1;let n=s(t[0]),h=Math.floor(n/9)+1,u=n%9+1,p=(s(t[1])+1)/166,d=new Array(u*h);for(let e=0;e<d.length;e++)if(0===e){let r=s(t.substring(2,6));d[e]=l(r)}else{let r=s(t.substring(4+2*e,6+2*e));d[e]=c(r,p*i)}let b=4*e,f=new Uint8ClampedArray(b*r);for(let t=0;t<r;t++)for(let i=0;i<e;i++){let s=0,n=0,a=0;for(let o=0;o<h;o++)for(let h=0;h<u;h++){let l=Math.cos(Math.PI*i*h/e)*Math.cos(Math.PI*t*o/r),c=d[h+o*u];s+=c[0]*l,n+=c[1]*l,a+=c[2]*l}let l=o(s),c=o(n),p=o(a);f[4*i+0+t*b]=l,f[4*i+1+t*b]=c,f[4*i+2+t*b]=p,f[4*i+3+t*b]=255}return f},p=Object.defineProperty,d=Object.defineProperties,b=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,v=(t,e,r)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&v(t,r,e[r]);if(f)for(var r of f(e))w.call(e,r)&&v(t,r,e[r]);return t},y=(t,e)=>d(t,b(e)),V=(t,e)=>{var r={};for(var i in t)g.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&f)for(var i of f(t))e.indexOf(i)<0&&w.call(t,i)&&(r[i]=t[i]);return r},M=class extends t.PureComponent{constructor(){super(...arguments),this.canvas=null,this.handleRef=t=>{this.canvas=t,this.draw()},this.draw=()=>{let{hash:t,height:e,punch:r,width:i}=this.props;if(this.canvas){let s=u(t,i,e,r),n=this.canvas.getContext("2d"),o=n.createImageData(i,e);o.data.set(s),n.putImageData(o,0,0)}}}componentDidUpdate(){this.draw()}render(){let e=this.props,{hash:r,height:i,width:s}=e,n=V(e,["hash","height","width"]);return t.createElement("canvas",y(m({},n),{height:i,width:s,ref:this.handleRef}))}};M.defaultProps={height:128,width:128};var I={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends t.PureComponent{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let e=this.props,{hash:r,height:i,width:s,punch:n,resolutionX:o,resolutionY:h,style:a}=e,l=V(e,["hash","height","width","punch","resolutionX","resolutionY","style"]);return t.createElement("div",y(m({},l),{style:y(m({display:"inline-block",height:i,width:s},a),{position:"relative"})}),t.createElement(M,{hash:r,height:h,width:o,punch:n,style:I}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var q=Object.defineProperty,C=(t,e,r)=>((t,e,r)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),j=new Map,k=new WeakMap,O=0;function x(t){return Object.keys(t).sort().filter(e=>void 0!==t[e]).map(e=>`${e}_${"root"===e?function(t){return t?(k.has(t)||(O+=1,k.set(t,O.toString())),k.get(t)):"0"}(t.root):t[e]}`).toString()}function E(t,e,r={},i=undefined){if(typeof window.IntersectionObserver>"u"&&void 0!==i){const s=t.getBoundingClientRect();return e(i,{isIntersecting:i,target:t,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:s,intersectionRect:s,rootBounds:s}),()=>{}}const{id:s,observer:n,elements:o}=function(t){const e=x(t);let r=j.get(e);if(!r){const i=new Map;let s;const n=new IntersectionObserver(e=>{e.forEach(e=>{var r;const n=e.isIntersecting&&s.some(t=>e.intersectionRatio>=t);t.trackVisibility&&typeof e.isVisible>"u"&&(e.isVisible=n),null==(r=i.get(e.target))||r.forEach(t=>{t(n,e)})})},t);s=n.thresholds||(Array.isArray(t.threshold)?t.threshold:[t.threshold||0]),r={id:e,observer:n,elements:i},j.set(e,r)}return r}(r),h=o.get(t)||[];return o.has(t)||o.set(t,h),h.push(e),n.observe(t),function(){h.splice(h.indexOf(e),1),0===h.length&&(o.delete(t),n.unobserve(t)),0===o.size&&(n.disconnect(),j.delete(s))}}var P=class extends t.Component{constructor(t){super(t),C(this,"node",null),C(this,"_unobserveCb",null),C(this,"lastInView"),C(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&(this.setState({inView:!!this.props.initialInView,entry:void 0}),this.lastInView=this.props.initialInView)),this.node=t||null,this.observeNode()}),C(this,"handleChange",(t,e)=>{const r=this.lastInView;this.lastInView=t,(void 0!==r||t)&&(t&&this.props.triggerOnce&&this.unobserve(),function(t){return"function"!=typeof t.children}(this.props)||this.setState({inView:t,entry:e}),this.props.onChange&&this.props.onChange(t,e))}),this.state={inView:!!t.initialInView,entry:void 0},this.lastInView=t.initialInView}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(t){(t.rootMargin!==this.props.rootMargin||t.root!==this.props.root||t.threshold!==this.props.threshold||t.skip!==this.props.skip||t.trackVisibility!==this.props.trackVisibility||t.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s,fallbackInView:n}=this.props;void 0===this.lastInView&&(this.lastInView=this.props.initialInView),this._unobserveCb=E(this.node,this.handleChange,{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s},n)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if("function"==typeof e){const{inView:t,entry:r}=this.state;return e({inView:t,entry:r,ref:this.handleNode})}const{as:r,triggerOnce:i,threshold:s,root:n,rootMargin:o,onChange:h,skip:a,trackVisibility:l,delay:c,initialInView:u,fallbackInView:p,...d}=this.props;return t.createElement(r||"div",{ref:this.handleNode,...d},e)}};const N=({src:i,alt:s,delayTime:n=0,threshold:o=.5,blurhash:h="LEHV6nWB2yk8pyo0adR*.7kCMdnj",wrapperClassName:a="qc:size-full",sizeMode:l="cover",position:c="center",onClick:u})=>{const p=t.useRef(null),d=t.useRef(null),[b,f]=t.useState(!1),[g,w]=t.useState(!1);return e.jsxs(P,{as:"div",className:r(a,"qc:relative qc:overflow-hidden"),threshold:o,onChange:t=>{t?d.current||(n<=0?f(!0):d.current=setTimeout(()=>f(!0),n)):d.current&&(clearTimeout(d.current),d.current=null)},children:[e.jsx(M,{className:"qc:size-full qc:blur-2xl",hash:h}),e.jsx("img",{alt:s,ref:p,src:b?i:null,onLoad:()=>w(!0),className:r("qc:bg-background qc:absolute qc:left-0 qc:top-0 qc:size-full qc:object-center qc:transition-all qc:duration-300",g?"qc:scale-100 qc:opacity-100":"qc:scale-95 qc:opacity-0","contain"===l?"qc:object-contain":"qc:object-cover","top"===c?"qc:object-top":"bottom"===c?"qc:object-bottom":"qc:object-center"),onClick:u})]})};export{P as I,N as L,u as j};
1
+ import{a as t,j as e,c as r}from"./index-JyoNGo8S.js";var i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],s=t=>{let e=0;for(let r=0;r<t.length;r++){let s=t[r];e=83*e+i.indexOf(s)}return e},n=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},o=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},h=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),a=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},l=t=>{let e=t>>8&255,r=255&t;return[n(t>>16),n(e),n(r)]},c=(t,e)=>{let r=Math.floor(t/361),i=Math.floor(t/19)%19,s=t%19;return[h((r-9)/9,2)*e,h((i-9)/9,2)*e,h((s-9)/9,2)*e]},u=(t,e,r,i)=>{(t=>{if(!t||t.length<6)throw new a("The blurhash string must be at least 6 characters");let e=s(t[0]),r=Math.floor(e/9)+1,i=e%9+1;if(t.length!==4+2*i*r)throw new a(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*i*r}`)})(t),i|=1;let n=s(t[0]),h=Math.floor(n/9)+1,u=n%9+1,p=(s(t[1])+1)/166,d=new Array(u*h);for(let e=0;e<d.length;e++)if(0===e){let r=s(t.substring(2,6));d[e]=l(r)}else{let r=s(t.substring(4+2*e,6+2*e));d[e]=c(r,p*i)}let b=4*e,f=new Uint8ClampedArray(b*r);for(let t=0;t<r;t++)for(let i=0;i<e;i++){let s=0,n=0,a=0;for(let o=0;o<h;o++)for(let h=0;h<u;h++){let l=Math.cos(Math.PI*i*h/e)*Math.cos(Math.PI*t*o/r),c=d[h+o*u];s+=c[0]*l,n+=c[1]*l,a+=c[2]*l}let l=o(s),c=o(n),p=o(a);f[4*i+0+t*b]=l,f[4*i+1+t*b]=c,f[4*i+2+t*b]=p,f[4*i+3+t*b]=255}return f},p=Object.defineProperty,d=Object.defineProperties,b=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,v=(t,e,r)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&v(t,r,e[r]);if(f)for(var r of f(e))w.call(e,r)&&v(t,r,e[r]);return t},y=(t,e)=>d(t,b(e)),V=(t,e)=>{var r={};for(var i in t)g.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&f)for(var i of f(t))e.indexOf(i)<0&&w.call(t,i)&&(r[i]=t[i]);return r},M=class extends t.PureComponent{constructor(){super(...arguments),this.canvas=null,this.handleRef=t=>{this.canvas=t,this.draw()},this.draw=()=>{let{hash:t,height:e,punch:r,width:i}=this.props;if(this.canvas){let s=u(t,i,e,r),n=this.canvas.getContext("2d"),o=n.createImageData(i,e);o.data.set(s),n.putImageData(o,0,0)}}}componentDidUpdate(){this.draw()}render(){let e=this.props,{hash:r,height:i,width:s}=e,n=V(e,["hash","height","width"]);return t.createElement("canvas",y(m({},n),{height:i,width:s,ref:this.handleRef}))}};M.defaultProps={height:128,width:128};var I={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends t.PureComponent{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let e=this.props,{hash:r,height:i,width:s,punch:n,resolutionX:o,resolutionY:h,style:a}=e,l=V(e,["hash","height","width","punch","resolutionX","resolutionY","style"]);return t.createElement("div",y(m({},l),{style:y(m({display:"inline-block",height:i,width:s},a),{position:"relative"})}),t.createElement(M,{hash:r,height:h,width:o,punch:n,style:I}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var q=Object.defineProperty,C=(t,e,r)=>((t,e,r)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),j=new Map,k=new WeakMap,O=0;function x(t){return Object.keys(t).sort().filter(e=>void 0!==t[e]).map(e=>`${e}_${"root"===e?function(t){return t?(k.has(t)||(O+=1,k.set(t,O.toString())),k.get(t)):"0"}(t.root):t[e]}`).toString()}function E(t,e,r={},i=undefined){if(typeof window.IntersectionObserver>"u"&&void 0!==i){const s=t.getBoundingClientRect();return e(i,{isIntersecting:i,target:t,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:s,intersectionRect:s,rootBounds:s}),()=>{}}const{id:s,observer:n,elements:o}=function(t){const e=x(t);let r=j.get(e);if(!r){const i=new Map;let s;const n=new IntersectionObserver(e=>{e.forEach(e=>{var r;const n=e.isIntersecting&&s.some(t=>e.intersectionRatio>=t);t.trackVisibility&&typeof e.isVisible>"u"&&(e.isVisible=n),null==(r=i.get(e.target))||r.forEach(t=>{t(n,e)})})},t);s=n.thresholds||(Array.isArray(t.threshold)?t.threshold:[t.threshold||0]),r={id:e,observer:n,elements:i},j.set(e,r)}return r}(r),h=o.get(t)||[];return o.has(t)||o.set(t,h),h.push(e),n.observe(t),function(){h.splice(h.indexOf(e),1),0===h.length&&(o.delete(t),n.unobserve(t)),0===o.size&&(n.disconnect(),j.delete(s))}}var P=class extends t.Component{constructor(t){super(t),C(this,"node",null),C(this,"_unobserveCb",null),C(this,"lastInView"),C(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&(this.setState({inView:!!this.props.initialInView,entry:void 0}),this.lastInView=this.props.initialInView)),this.node=t||null,this.observeNode()}),C(this,"handleChange",(t,e)=>{const r=this.lastInView;this.lastInView=t,(void 0!==r||t)&&(t&&this.props.triggerOnce&&this.unobserve(),function(t){return"function"!=typeof t.children}(this.props)||this.setState({inView:t,entry:e}),this.props.onChange&&this.props.onChange(t,e))}),this.state={inView:!!t.initialInView,entry:void 0},this.lastInView=t.initialInView}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(t){(t.rootMargin!==this.props.rootMargin||t.root!==this.props.root||t.threshold!==this.props.threshold||t.skip!==this.props.skip||t.trackVisibility!==this.props.trackVisibility||t.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s,fallbackInView:n}=this.props;void 0===this.lastInView&&(this.lastInView=this.props.initialInView),this._unobserveCb=E(this.node,this.handleChange,{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s},n)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if("function"==typeof e){const{inView:t,entry:r}=this.state;return e({inView:t,entry:r,ref:this.handleNode})}const{as:r,triggerOnce:i,threshold:s,root:n,rootMargin:o,onChange:h,skip:a,trackVisibility:l,delay:c,initialInView:u,fallbackInView:p,...d}=this.props;return t.createElement(r||"div",{ref:this.handleNode,...d},e)}};const N=({src:i,alt:s,delayTime:n=0,threshold:o=.5,blurhash:h="LEHV6nWB2yk8pyo0adR*.7kCMdnj",wrapperClassName:a="qc:size-full",sizeMode:l="cover",position:c="center",onClick:u})=>{const p=t.useRef(null),d=t.useRef(null),[b,f]=t.useState(!1),[g,w]=t.useState(!1);return e.jsxs(P,{as:"div",className:r(a,"qc:relative qc:overflow-hidden"),threshold:o,onChange:t=>{t?d.current||(n<=0?f(!0):d.current=setTimeout(()=>f(!0),n)):d.current&&(clearTimeout(d.current),d.current=null)},children:[e.jsx(M,{className:"qc:size-full qc:blur-2xl",hash:h}),e.jsx("img",{alt:s,ref:p,src:b?i:null,onLoad:()=>w(!0),className:r("qc:bg-background qc:absolute qc:left-0 qc:top-0 qc:size-full qc:object-center qc:transition-all qc:duration-300",g?"qc:scale-100 qc:opacity-100":"qc:scale-95 qc:opacity-0","contain"===l?"qc:object-contain":"qc:object-cover","top"===c?"qc:object-top":"bottom"===c?"qc:object-bottom":"qc:object-center"),onClick:u})]})};export{P as I,N as L,u as j};
@@ -1 +1 @@
1
- import{j as e,T as c,d as t,u as s,M as l,f as a,c as i,S as r,B as n,k as q,l as d}from"./index-dgkxxAYh.js";const o=({title:t,entries:s=[],showFloatingPoint:l=!1,hidePictures:a=!0})=>{const i=t.replace(/\s+/g,"-").toLowerCase(),r=e=>{if(!e)return"";const c=e.trim().split(" ");return 1===c.length?c[0]:`${c[0]} ${c[1][0]}.`};return e.jsxs("div",{className:"qc:border-border qc:mx-auto qc:flex qc:max-w-lg qc:flex-col qc:space-y-4 qc:rounded qc:border qc:p-4 qc:lg:space-y-8",children:[e.jsx(c,{variant:"h4",align:"center",color:"primary",children:t}),0===s.length?e.jsx(c,{variant:"h5",align:"center",color:"error",children:"Not available"}):e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"qc:flex qc:w-full qc:items-end qc:justify-center qc:gap-4 qc:lg:gap-24",children:[s.length>1&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-warning qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"2"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[1].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[1].totalPoint?s[1].maxScore?.toFixed(l?2:0):s[1].totalPoint?.toFixed(l?2:0)})]}),s.length>0&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-destructive qc:text-primary-foreground qc:flex qc:size-24 qc:items-center qc:justify-center qc:rounded-full qc:text-4xl",children:"1"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[0].name)}),e.jsx("div",{className:"qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[0].totalPoint?s[0].maxScore?.toFixed(l?2:0):s[0].totalPoint?.toFixed(l?2:0)})]}),s.length>2&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-success qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"3"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[2].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[2].totalPoint?s[2].maxScore?.toFixed(l?2:0):s[2].totalPoint?.toFixed(l?2:0)})]})]}),e.jsx("div",{className:"qc:mt-6",children:e.jsx("div",{className:"qc:-my-2 qc:overflow-x-auto qc:sm:-mx-6 qc:lg:-mx-8",children:e.jsx("div",{className:"qc:inline-block qc:min-w-full qc:py-2 qc:align-middle qc:md:px-6 qc:lg:px-8",children:e.jsx("div",{className:"qc:shadow-outer qc:overflow-hidden qc:ring-1 qc:ring-black qc:ring-opacity-5 qc:md:rounded",children:e.jsx("table",{className:"qc:w-full qc:divide-y qc:divide-gray-300",children:e.jsx("tbody",{className:"qc:bg-background qc:bg-opacity-50",children:s.slice(3).map((c,t)=>e.jsxs("tr",{children:[e.jsx("td",{className:"qc:text-muted qc:whitespace-nowrap qc:py-4 qc:pl-4 qc:text-sm qc:font-medium",children:e.jsx("span",{className:"qc:px-2",children:t+4})}),e.jsx("td",{className:"qc:whitespace-nowrap qc:py-4",children:e.jsxs("div",{className:"qc:flex qc:items-center",children:[!a&&e.jsx("div",{className:"qc:size-8 qc:shrink-0"}),e.jsx("div",{className:"qc-ml-4",children:e.jsx("div",{className:"qc-text-primary qc-font-medium",children:r(c.name)})})]})}),e.jsx("td",{className:"qc:text-foreground qc:whitespace-nowrap qc:py-4 qc:pr-4 qc:text-right qc:text-base qc:font-medium qc:italic",children:void 0===c.totalPoint?c.maxScore?.toFixed(l?2:0):c.totalPoint?.toFixed(l?2:0)})]},`${i}-${t}`))})})})})})})]})]})},x=()=>{const{eventSlug:c}=t(),{props:{organizationId:x}}=s(),{event:m}=l({eventSlug:c}),{isLoading:f,data:h}=a({queryKey:[`leaderboard-${x}-${m?._id}`],queryFn:async()=>(await q.get(d.GET_LEADERBOARD,{headers:{"x-org-id":x},searchParams:{eventId:m?._id}}).json()).data,enabled:!!m});return f?e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsxs("div",{className:"qc:flex-1",children:[e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"}),e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"})]}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:h?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]}):e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:"Point Leaders",entries:h?.leaderboardByPoint?.topRankers||[],pointName:m?.pointName})}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:h?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]})};export{x as default};
1
+ import{j as e,T as c,d as t,u as s,M as l,f as a,c as i,S as r,B as n,k as q,l as d}from"./index-JyoNGo8S.js";const o=({title:t,entries:s=[],showFloatingPoint:l=!1,hidePictures:a=!0})=>{const i=t.replace(/\s+/g,"-").toLowerCase(),r=e=>{if(!e)return"";const c=e.trim().split(" ");return 1===c.length?c[0]:`${c[0]} ${c[1][0]}.`};return e.jsxs("div",{className:"qc:border-border qc:mx-auto qc:flex qc:max-w-lg qc:flex-col qc:space-y-4 qc:rounded qc:border qc:p-4 qc:lg:space-y-8",children:[e.jsx(c,{variant:"h4",align:"center",color:"primary",children:t}),0===s.length?e.jsx(c,{variant:"h5",align:"center",color:"error",children:"Not available"}):e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"qc:flex qc:w-full qc:items-end qc:justify-center qc:gap-4 qc:lg:gap-24",children:[s.length>1&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-warning qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"2"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[1].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[1].totalPoint?s[1].maxScore?.toFixed(l?2:0):s[1].totalPoint?.toFixed(l?2:0)})]}),s.length>0&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-destructive qc:text-primary-foreground qc:flex qc:size-24 qc:items-center qc:justify-center qc:rounded-full qc:text-4xl",children:"1"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[0].name)}),e.jsx("div",{className:"qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[0].totalPoint?s[0].maxScore?.toFixed(l?2:0):s[0].totalPoint?.toFixed(l?2:0)})]}),s.length>2&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-success qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"3"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[2].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[2].totalPoint?s[2].maxScore?.toFixed(l?2:0):s[2].totalPoint?.toFixed(l?2:0)})]})]}),e.jsx("div",{className:"qc:mt-6",children:e.jsx("div",{className:"qc:-my-2 qc:overflow-x-auto qc:sm:-mx-6 qc:lg:-mx-8",children:e.jsx("div",{className:"qc:inline-block qc:min-w-full qc:py-2 qc:align-middle qc:md:px-6 qc:lg:px-8",children:e.jsx("div",{className:"qc:shadow-outer qc:overflow-hidden qc:ring-1 qc:ring-black qc:ring-opacity-5 qc:md:rounded",children:e.jsx("table",{className:"qc:w-full qc:divide-y qc:divide-gray-300",children:e.jsx("tbody",{className:"qc:bg-background qc:bg-opacity-50",children:s.slice(3).map((c,t)=>e.jsxs("tr",{children:[e.jsx("td",{className:"qc:text-muted qc:whitespace-nowrap qc:py-4 qc:pl-4 qc:text-sm qc:font-medium",children:e.jsx("span",{className:"qc:px-2",children:t+4})}),e.jsx("td",{className:"qc:whitespace-nowrap qc:py-4",children:e.jsxs("div",{className:"qc:flex qc:items-center",children:[!a&&e.jsx("div",{className:"qc:size-8 qc:shrink-0"}),e.jsx("div",{className:"qc-ml-4",children:e.jsx("div",{className:"qc-text-primary qc-font-medium",children:r(c.name)})})]})}),e.jsx("td",{className:"qc:text-foreground qc:whitespace-nowrap qc:py-4 qc:pr-4 qc:text-right qc:text-base qc:font-medium qc:italic",children:void 0===c.totalPoint?c.maxScore?.toFixed(l?2:0):c.totalPoint?.toFixed(l?2:0)})]},`${i}-${t}`))})})})})})})]})]})},x=()=>{const{eventSlug:c}=t(),{props:{organizationId:x}}=s(),{event:m}=l({eventSlug:c}),{isLoading:f,data:h}=a({queryKey:[`leaderboard-${x}-${m?._id}`],queryFn:async()=>(await q.get(d.GET_LEADERBOARD,{headers:{"x-org-id":x},searchParams:{eventId:m?._id}}).json()).data,enabled:!!m});return f?e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsxs("div",{className:"qc:flex-1",children:[e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"}),e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"})]}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:h?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]}):e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:"Point Leaders",entries:h?.leaderboardByPoint?.topRankers||[],pointName:m?.pointName})}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:h?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]})};export{x as default};
@@ -1 +1 @@
1
- import{a as e,e as a,u as s,j as l,O as o,T as r,h as i,P as t}from"./index-dgkxxAYh.js";import{I as n}from"./InputField-DCqkCRI8.js";import{S as c}from"./SocialLoginButton-CD7hRRi3.js";import{u as d,C as m,o as p,c as u,a as g}from"./index.esm-DH681Jwb.js";const h=u().shape({email:g().required("Please enter your email").email("Enter a valid email"),password:g().required("Please enter your password").min(8,"Min password length is 8")}),j=()=>{const[u,g]=e.useState(!1),[j,x]=e.useState(!1),[f,w]=e.useState({google:!1,apple:!1}),[y,q]=e.useState(null),v=a(),{control:C,handleSubmit:b,formState:{errors:S}}=d({defaultValues:{email:"",password:""},mode:"onSubmit",resolver:p(h)}),{loginUsingEmail:N,loginWithGoogle:B,loginWithApple:P}=s(),F=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 l.jsxs("div",{className:"qc:w-full qc:space-y-6",children:[l.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:b(async e=>{const{email:a,password:s}=e;x(!0);try{const e=await N(a.toLowerCase(),s);e?.error&&q(e.error)}catch(e){q(e)}finally{x(!1)}}),className:"qc:space-y-6",children:[l.jsxs("div",{className:"qc:space-y-9",children:[l.jsx(m,{name:"email",control:C,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsx(n,{label:"Email",disabled:j,type:"email",value:e,onChange:a,onBlur:s,autoComplete:"email",error:S.email?.message})}),l.jsx(m,{name:"password",control:C,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsxs("div",{className:"qc:relative",children:[l.jsx(n,{label:"Password",disabled:j,type:u?"text":"password",value:e,onChange:a,onBlur:s,autoComplete:"current-password",error:S.password?.message}),l.jsx(o,{variant:"ghost",color:"primary",className:"qc:absolute qc:right-0 qc:top-8",icon:u?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>g(!u)})]})})]}),y&&l.jsx(r,{align:"center",weight:"medium",color:"error",children:y}),l.jsx("div",{className:"qc:flex qc:justify-end",children:l.jsx(i,{to:t.FORGOT_PASSWORD,state:v?.state,children:l.jsx(r,{variant:"h6",className:"qc:w-fit",children:"Forgot password?"})})}),l.jsx(o,{type:"submit",color:"primary",className:"qc:w-full",loading:j,disabled:j,children:"Login"})]}),l.jsxs("div",{className:"qc:grid qc:grid-cols-2 qc:gap-4",children:[l.jsx(c,{disabled:j||f.google||f.apple,loading:f.google,onClick:()=>F("google",B),provider:"google"}),l.jsx(c,{disabled:j||f.google||f.apple,loading:f.apple,onClick:()=>F("apple",P),provider:"apple"})]})]})};export{j as default};
1
+ import{a as e,e as a,u as s,j as l,O as o,T as r,h as i,P as t}from"./index-JyoNGo8S.js";import{I as n}from"./InputField-DybXE_Ab.js";import{S as c}from"./SocialLoginButton-DpBl7dWg.js";import{u as d,C as m,o as p,c as u,a as g}from"./index.esm-CAQX5kI5.js";const h=u().shape({email:g().required("Please enter your email").email("Enter a valid email"),password:g().required("Please enter your password").min(8,"Min password length is 8")}),j=()=>{const[u,g]=e.useState(!1),[j,x]=e.useState(!1),[f,w]=e.useState({google:!1,apple:!1}),[y,q]=e.useState(null),v=a(),{control:C,handleSubmit:b,formState:{errors:S}}=d({defaultValues:{email:"",password:""},mode:"onSubmit",resolver:p(h)}),{loginUsingEmail:N,loginWithGoogle:B,loginWithApple:P}=s(),F=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 l.jsxs("div",{className:"qc:w-full qc:space-y-6",children:[l.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:b(async e=>{const{email:a,password:s}=e;x(!0);try{const e=await N(a.toLowerCase(),s);e?.error&&q(e.error)}catch(e){q(e)}finally{x(!1)}}),className:"qc:space-y-6",children:[l.jsxs("div",{className:"qc:space-y-9",children:[l.jsx(m,{name:"email",control:C,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsx(n,{label:"Email",disabled:j,type:"email",value:e,onChange:a,onBlur:s,autoComplete:"email",error:S.email?.message})}),l.jsx(m,{name:"password",control:C,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsxs("div",{className:"qc:relative",children:[l.jsx(n,{label:"Password",disabled:j,type:u?"text":"password",value:e,onChange:a,onBlur:s,autoComplete:"current-password",error:S.password?.message}),l.jsx(o,{variant:"ghost",color:"primary",className:"qc:absolute qc:right-0 qc:top-8",icon:u?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>g(!u)})]})})]}),y&&l.jsx(r,{align:"center",weight:"medium",color:"error",children:y}),l.jsx("div",{className:"qc:flex qc:justify-end",children:l.jsx(i,{to:t.FORGOT_PASSWORD,state:v?.state,children:l.jsx(r,{variant:"h6",className:"qc:w-fit",children:"Forgot password?"})})}),l.jsx(o,{type:"submit",color:"primary",className:"qc:w-full",loading:j,disabled:j,children:"Login"})]}),l.jsxs("div",{className:"qc:grid qc:grid-cols-2 qc:gap-4",children:[l.jsx(c,{disabled:j||f.google||f.apple,loading:f.google,onClick:()=>F("google",B),provider:"google"}),l.jsx(c,{disabled:j||f.google||f.apple,loading:f.apple,onClick:()=>F("apple",P),provider:"apple"})]})]})};export{j as default};