@qratilabs/qrati-connect 2.5.4 → 2.5.6

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 (44) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/element/{B59V0Mhr.js → B28y50Bi.js} +1 -1
  3. package/element/{DLz0G_z2.js → BWU1Eb1i.js} +1 -1
  4. package/element/{kdp9oLRU.js → CAt6yWea.js} +1 -1
  5. package/element/{D_N6wPLS.js → CH2f_afH.js} +1 -1
  6. package/element/{D43BQzpf.js → CUOOhGTj.js} +1 -1
  7. package/element/{BwemkCCJ.js → Cf1QDu0i.js} +1 -1
  8. package/element/{OucaMSbY.js → CvA0vfrf.js} +1 -1
  9. package/element/{DhfeoyBz.js → D4xTzxjA.js} +1 -1
  10. package/element/{J72K45YE.js → DODG2TX4.js} +1 -1
  11. package/element/{CPPs7pi-.js → DPOkh0eJ.js} +1 -1
  12. package/element/{DhcdFi7M.js → DiiWe_SG.js} +2 -2
  13. package/element/{BrMlCiWh.js → wHbQZdly.js} +1 -1
  14. package/element/web.es.js +3 -3
  15. package/package.json +1 -1
  16. package/react/{DXg0jviV.js → BAbwOJvT.js} +1 -1
  17. package/react/{DVhoieUG.js → BXiO9Rt2.js} +1 -1
  18. package/react/{B-MiXFkt.js → BaT1o9UO.js} +1 -1
  19. package/react/{q8ln6Sqn.js → BexGhdGA.js} +2 -2
  20. package/react/{CYK5EdMk.js → C4TTO8j2.js} +1 -1
  21. package/react/{DQq5P5kz.js → CNAEfadS.js} +1 -1
  22. package/react/{yjP1jdU0.js → CT_Cvh8-.js} +1 -1
  23. package/react/{DQRcftrx.js → Cs3wia2w.js} +1 -1
  24. package/react/{BBNhso7S.js → Czrz88CD.js} +1 -1
  25. package/react/{Rx2eXHSy.js → Czw0BHMZ.js} +1 -1
  26. package/react/{BaqVlxbd.js → D3jlv133.js} +1 -1
  27. package/react/{HzUDi5NE.js → D4BACpJw.js} +1 -1
  28. package/react/{Bh_3jcgw.js → D6cMN4OJ.js} +1 -1
  29. package/react/{B9vdeEQv.js → D7c4q3kj.js} +1 -1
  30. package/react/{t-ii7Ss0.js → DEIcfk-y.js} +1 -1
  31. package/react/{-k-ffFwP.js → DGIVHiX4.js} +1 -1
  32. package/react/{DMqKxwcb.js → DOw70z3P.js} +1 -1
  33. package/react/DV6DJ1Br.js +1 -0
  34. package/react/{r0vUVZIh.js → Dljj3ToS.js} +1 -1
  35. package/react/QPXxc9eb.js +1 -0
  36. package/react/{BQ7Q_1WB.js → Sb4c6EUR.js} +1 -1
  37. package/react/{Fhq5zLvg.js → aragUG-J.js} +1 -1
  38. package/react/{BRLq62Uv.js → e8YBtYhk.js} +1 -1
  39. package/react/index.cjs +1 -1
  40. package/react/index.mjs +3 -3
  41. package/react/{BTW-b-Wo.js → pIx9IeV5.js} +1 -1
  42. package/umd/web.umd.js +1 -1
  43. package/react/BJBX47Jb.js +0 -1
  44. package/react/C9yNmSQ8.js +0 -1
@@ -1,4 +1,4 @@
1
- import{$ as e,At as t,B as r,Ct as s,Dt as o,F as n,Ft as i,M as a,Mt as l,N as c,S as h,St as u,Tt as d,Y as f,_t as p,bt as m,et as y,ft as g,gt as w,ht as b,i as R,jt as v,l as S,lt as T,mt as x,n as A,t as I,tt as E,vt as C,xt as O}from"./BrMlCiWh.js";var q=class extends s{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=y(),this.bindMethods(),this.setOptions(t)}#e;#s=void 0;#o=void 0;#n=void 0;#i;#a;#r;#t;#l;#c;#h;#u;#d;#f;#p=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#s.addObserver(this),P(this.#s,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k(this.#s,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k(this.#s,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set,this.#g(),this.#w(),this.#s.removeObserver(this)}setOptions(e){const t=this.options,r=this.#s;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof b(this.options.enabled,this.#s))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#s.setOptions(this.options),t._defaulted&&!p(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#s,observer:this});const s=this.hasListeners();s&&D(this.#s,r,this.options,t)&&this.#m(),this.updateResult(),!s||this.#s===r&&b(this.options.enabled,this.#s)===b(t.enabled,this.#s)&&w(this.options.staleTime,this.#s)===w(t.staleTime,this.#s)||this.#R();const o=this.#v();!s||this.#s===r&&b(this.options.enabled,this.#s)===b(t.enabled,this.#s)&&o===this.#f||this.#S(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);var s;return s=r,p(this.getCurrentResult(),s)||(this.#n=r,this.#a=this.options,this.#i=this.#s.state),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(/* @__PURE__ */new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#s}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#m(e){this.#b();let t=this.#s.fetch(this.options,e);return e?.throwOnError||(t=t.catch(g)),t}#R(){this.#g();const e=w(this.options.staleTime,this.#s);if(E.isServer()||this.#n.isStale||!T(e))return;const t=m(this.#n.dataUpdatedAt,e)+1;this.#u=O.setTimeout(()=>{this.#n.isStale||this.updateResult()},t)}#v(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#s):this.options.refetchInterval)??!1}#S(e){this.#w(),this.#f=e,!E.isServer()&&!1!==b(this.options.enabled,this.#s)&&T(this.#f)&&0!==this.#f&&(this.#d=O.setInterval(()=>{(this.options.refetchIntervalInBackground||u.isFocused())&&this.#m()},this.#f))}#y(){this.#R(),this.#S(this.#v())}#g(){this.#u&&(O.clearTimeout(this.#u),this.#u=void 0)}#w(){this.#d&&(O.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const r=this.#s,s=this.options,o=this.#n,n=this.#i,i=this.#a,a=e!==r?e.state:this.#o,{state:l}=e;let c,h={...l},u=!1;if(t._optimisticResults){const o=this.hasListeners(),n=!o&&P(e,t),i=o&&D(e,r,t,s);(n||i)&&(h={...h,...f(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(h.fetchStatus="idle")}let{error:d,errorUpdatedAt:p,status:m}=h;c=h.data;let g=!1;if(void 0!==t.placeholderData&&void 0===c&&"pending"===m){let e;o?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(e=o.data,g=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,void 0!==e&&(m="success",c=x(o?.data,e,t),u=!0)}if(t.select&&void 0!==c&&!g)if(o&&c===n?.data&&t.select===this.#l)c=this.#c;else try{this.#l=t.select,c=t.select(c),c=x(o?.data,c,t),this.#c=c,this.#t=null}catch(I){this.#t=I}this.#t&&(d=this.#t,c=this.#c,p=Date.now(),m="error");const w="fetching"===h.fetchStatus,R="pending"===m,v="error"===m,S=R&&w,T=void 0!==c,A={status:m,fetchStatus:h.fetchStatus,isPending:R,isSuccess:"success"===m,isError:v,isInitialLoading:S,isLoading:S,data:c,dataUpdatedAt:h.dataUpdatedAt,error:d,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:h.dataUpdateCount>a.dataUpdateCount||h.errorUpdateCount>a.errorUpdateCount,isFetching:w,isRefetching:w&&!R,isLoadingError:v&&!T,isPaused:"paused"===h.fetchStatus,isPlaceholderData:u,isRefetchError:v&&T,isStale:N(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==b(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==A.data,s="error"===A.status&&!t,o=e=>{s?e.reject(A.error):t&&e.resolve(A.data)},n=()=>{o(this.#r=A.promise=y())},i=this.#r;switch(i.status){case"pending":e.queryHash===r.queryHash&&o(i);break;case"fulfilled":(s||A.data!==i.value)&&n();break;case"rejected":s&&A.error===i.reason||n()}}return A}updateResult(){const e=this.#n,t=this.createResult(this.#s,this.options);this.#i=this.#s.state,this.#a=this.options,void 0!==this.#i.data&&(this.#h=this.#s),p(t,e)||(this.#n=t,this.#T({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#p.size)return!0;const s=new Set(r??this.#p);return this.options.throwOnError&&s.add("error"),Object.keys(this.#n).some(t=>{const r=t;return this.#n[r]!==e[r]&&s.has(r)})})()}))}#b(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#s)return;const t=this.#s;this.#s=e,this.#o=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#T(t){e.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#s,type:"observerResultsUpdated"})})}};function P(e,t){return function(e,t){return!1!==b(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&k(e,t,t.refetchOnMount)}function k(e,t,r){if(!1!==b(t.enabled,e)&&"static"!==w(t.staleTime,e)){const s="function"==typeof r?r(e):r;return"always"===s||!1!==s&&N(e,t)}return!1}function D(e,t,r,s){return(e!==t||!1===b(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&N(e,r)}function N(e,t){return!1!==b(t.enabled,e)&&e.isStaleByTime(w(t.staleTime,e))}var M=i(!1);M.Provider;var U=i(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),Q=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function L(r,s,i){const c=v(M),h=v(U),u=a(i),d=u.defaultQueryOptions(r);u.getDefaultOptions().queries?._experimental_beforeQuery?.(d);const f=u.getQueryCache().get(d.queryHash);d._optimisticResults=c?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),s=e.staleTime;e.staleTime="function"==typeof s?(...e)=>r(s(...e)):r(s),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(d),((e,t,r)=>{const s=r?.state.error&&"function"==typeof e.throwOnError?C(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))})(d,h,f),(e=>{l(()=>{e.clearReset()},[e])})(h);const p=!u.getQueryCache().get(d.queryHash),[m]=o(()=>new s(u,d)),y=m.getOptimisticResult(d),w=!c&&!1!==r.subscribed;if(n(t(t=>{const r=w?m.subscribe(e.batchCalls(t)):g;return m.updateResult(),r},[m,w]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),l(()=>{m.setOptions(d)},[d,m]),((e,t)=>e?.suspense&&t.isPending)(d,y))throw Q(d,m,h);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(o&&void 0===e.data||C(r,[e.error,s])))({result:y,errorResetBoundary:h,throwOnError:d.throwOnError,query:f,suspense:d.suspense}))throw y.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(d,y),d.experimental_prefetchInRender&&!E.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(y,c)&&(p?Q(d,m,h):f?.promise)?.catch(g).finally(()=>{m.updateResult()}),d.notifyOnChangeProps?y:m.trackResult(y)}function j(e,t){return L(e,q,t)}var F=class extends Error{response;request;options;constructor(e,t,r){const s=`${e.status||0===e.status?e.status:""} ${e.statusText??""}`.trim();super(`Request failed with ${s?`status code ${s}`:"an unknown error"}: ${t.method} ${t.url}`),this.name="HTTPError",this.response=e,this.request=t,this.options=r}},_=class extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{"string"==typeof e?t=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(t=e.message)}catch{}super(t),this.value=e}},z=class extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const t=e?.cause?e.cause instanceof Error?e.cause:new _(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},H=(()=>{let e=!1,t=!1;const r="function"==typeof globalThis.ReadableStream,s="function"==typeof globalThis.Request;if(r&&s)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(o){if(o instanceof Error&&"unsupported BodyInit type"===o.message)return!1;throw o}return e&&!t})(),B="function"==typeof globalThis.AbortController,Z="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,V="function"==typeof globalThis.ReadableStream,W="function"==typeof globalThis.FormData,$=["get","post","put","patch","head","delete"],G={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},J=(new TextEncoder).encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,K=Symbol("stop"),Y=class{options;constructor(e){this.options=e}},X=e=>new Y(e),ee={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},te={next:!0},re={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},se=(e,t,r)=>{let s,o=0;return e.pipeThrough(new TransformStream({transform(e,n){if(n.enqueue(e),s){o+=s.byteLength;let e=0===t?0:o/t;e>=1&&(e=1-Number.EPSILON),r?.({percent:e,totalBytes:Math.max(t,o),transferredBytes:o},s)}s=e},flush(){s&&(o+=s.byteLength,r?.({percent:1,totalBytes:Math.max(t,o),transferredBytes:o},s))}}))},oe=e=>null!==e&&"object"==typeof e,ne=(...e)=>{for(const t of e)if((!oe(t)||Array.isArray(t))&&void 0!==t)throw new TypeError("The `options` argument must be an object");return he({},...e)},ie=(e={},t={})=>{const r=new globalThis.Headers(e),s=t instanceof globalThis.Headers,o=new globalThis.Headers(t);for(const[n,i]of o.entries())s&&"undefined"===i||void 0===i?r.delete(n):r.set(n,i);return r};function ae(e,t,r){return Object.hasOwn(t,r)&&void 0===t[r]?[]:he(e[r]??[],t[r]??[])}var le=(e={},t={})=>({beforeRequest:ae(e,t,"beforeRequest"),beforeRetry:ae(e,t,"beforeRetry"),afterResponse:ae(e,t,"afterResponse"),beforeError:ae(e,t,"beforeError")}),ce=(e,t)=>{const r=new URLSearchParams;for(const s of[e,t])if(void 0!==s)if(s instanceof URLSearchParams)for(const[e,t]of s.entries())r.append(e,t);else if(Array.isArray(s))for(const e of s){if(!Array.isArray(e)||2!==e.length)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(e[0]),String(e[1]))}else if(oe(s))for(const[e,t]of Object.entries(s))void 0!==t&&r.append(e,String(t));else{const e=new URLSearchParams(s);for(const[t,s]of e.entries())r.append(t,s)}return r},he=(...e)=>{let t,r={},s={},o={};const n=[];for(const i of e)if(Array.isArray(i))Array.isArray(r)||(r=[]),r=[...r,...i];else if(oe(i)){for(let[e,s]of Object.entries(i))if("signal"===e&&s instanceof globalThis.AbortSignal)n.push(s);else if("context"!==e)"searchParams"!==e?(oe(s)&&e in r&&(s=he(r[e],s)),r={...r,[e]:s}):t=null==s?void 0:void 0===t?s:ce(t,s);else{if(null!=s&&(!oe(s)||Array.isArray(s)))throw new TypeError("The `context` option must be an object");r={...r,context:null==s?{}:{...r.context,...s}}}oe(i.hooks)&&(o=le(o,i.hooks),r.hooks=o),oe(i.headers)&&(s=ie(s,i.headers),r.headers=s)}return void 0!==t&&(r.searchParams=t),n.length>0&&(1===n.length?r.signal=n[0]:r.signal=Z?AbortSignal.any(n):n.at(-1)),r},ue=e=>$.includes(e)?e.toUpperCase():e,de={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},fe=(e={})=>{if("number"==typeof e)return{...de,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");const t=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));return{...de,...t}},pe=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}},me=class e{static create(t,r){const s=new e(t,r),o=s.#x(async()=>{if("number"==typeof s.#A.timeout&&s.#A.timeout>2147483647)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await s.#I();for(const r of s.#A.hooks.afterResponse){const o=s.#E(e.clone());let n;try{n=await r(s.request,s.#C(),o,{retryCount:s.#O})}catch(t){throw s.#q(o),s.#q(e),t}if(n instanceof Y)throw s.#q(o),s.#q(e),new z(n.options);const i=n instanceof globalThis.Response?n:e;o!==i&&s.#q(o),e!==i&&s.#q(e),e=i}if(s.#E(e),!e.ok&&("function"==typeof s.#A.throwHttpErrors?s.#A.throwHttpErrors(e.status):s.#A.throwHttpErrors)){let t=new F(e,s.request,s.#C());for(const e of s.#A.hooks.beforeError)t=await e(t,{retryCount:s.#O});throw t}if(s.#A.onDownloadProgress){if("function"!=typeof s.#A.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!V)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const t=e.clone();return s.#q(e),((e,t)=>{if(!e.body)return e;if(204===e.status)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});const r=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(se(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})})(t,s.#A.onDownloadProgress)}return e}).finally(()=>{const e=s.#P;s.#k(e?.body??void 0),s.#k(s.request.body??void 0)});for(const[e,n]of Object.entries(G))"bytes"===e&&"function"!=typeof globalThis.Response?.prototype?.bytes||(o[e]=async()=>{s.request.headers.set("accept",s.request.headers.get("accept")||n);const t=await o;if("json"===e){if(204===t.status)return"";const e=await t.text();return""===e?"":r.parseJson?r.parseJson(e):JSON.parse(e)}return t[e]()});return o}static#D(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}request;#N;#O=0;#M;#A;#P;#U;#Q;constructor(t,r={}){if(this.#M=t,this.#A={...r,headers:ie(this.#M.headers,r.headers),hooks:le({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:ue(r.method??this.#M.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:fe(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},"string"!=typeof this.#M&&!(this.#M instanceof URL||this.#M instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#A.prefixUrl&&"string"==typeof this.#M){if(this.#M.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#A.prefixUrl.endsWith("/")||(this.#A.prefixUrl+="/"),this.#M=this.#A.prefixUrl+this.#M}B&&Z&&(this.#U=this.#A.signal??this.#M.signal,this.#N=new globalThis.AbortController,this.#A.signal=this.#U?AbortSignal.any([this.#U,this.#N.signal]):this.#N.signal),H&&(this.#A.duplex="half"),void 0!==this.#A.json&&(this.#A.body=this.#A.stringifyJson?.(this.#A.json)??JSON.stringify(this.#A.json),this.#A.headers.set("content-type",this.#A.headers.get("content-type")??"application/json"));const s=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#M instanceof globalThis.Request&&(W&&this.#A.body instanceof globalThis.FormData||this.#A.body instanceof URLSearchParams)&&!s&&this.#A.headers.delete("content-type"),this.request=new globalThis.Request(this.#M,this.#A),void 0!==(o=this.#A.searchParams)&&(Array.isArray(o)?o.length>0:o instanceof URLSearchParams?o.size>0:"object"==typeof o?Object.keys(o).length>0:"string"==typeof o?o.trim().length>0:Boolean(o))){const t="?"+("string"==typeof this.#A.searchParams?this.#A.searchParams.replace(/^\?/,""):new URLSearchParams(e.#D(this.#A.searchParams)).toString()),r=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,t);this.request=new globalThis.Request(r,this.#A)}var o;if(this.#A.onUploadProgress){if("function"!=typeof this.#A.onUploadProgress)throw new TypeError("The `onUploadProgress` option must be a function");if(!H)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#L(this.request,this.#A.body??void 0)}}#j(){const e=this.#A.retry.delay(this.#O);let t=e;!0===this.#A.retry.jitter?t=Math.random()*e:"function"==typeof this.#A.retry.jitter&&(t=this.#A.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));const r=this.#A.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(r,t)}async#F(e){if(this.#O++,this.#O>this.#A.retry.limit)throw e;const t=e instanceof Error?e:new _(e);if(t instanceof z)return t.customDelay??this.#j();if(!this.#A.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#A.retry.shouldRetry){const r=await this.#A.retry.shouldRetry({error:t,retryCount:this.#O});if(!1===r)throw e;if(!0===r)return this.#j()}if(function(e){return e instanceof pe||e?.name===pe.name}(e)&&!this.#A.retry.retryOnTimeout)throw e;if(function(e){return e instanceof F||e?.name===F.name}(e)){if(!this.#A.retry.statusCodes.includes(e.response.status))throw e;const t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this.#A.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now());const r=this.#A.retry.maxRetryAfter??e;return e<r?e:r}if(413===e.response.status)throw e}return this.#j()}#E(e){return this.#A.parseJson&&(e.json=async()=>this.#A.parseJson(await e.text())),e}#k(e){e&&e.cancel().catch(()=>{})}#q(e){this.#k(e.body??void 0)}async#x(e){try{return await e()}catch(t){const r=Math.min(await this.#F(t),2147483647);if(this.#O<1)throw t;if(await async function(e,{signal:t}){return new Promise((r,s)=>{function o(){clearTimeout(n),s(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",o,{once:!0}));const n=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e)})}(r,this.#U?{signal:this.#U}:{}),t instanceof z&&t.customRequest){const e=this.#A.signal?new globalThis.Request(t.customRequest,{signal:this.#A.signal}):new globalThis.Request(t.customRequest);this.#_(e)}for(const e of this.#A.hooks.beforeRetry){const r=await e({request:this.request,options:this.#C(),error:t,retryCount:this.#O});if(r instanceof globalThis.Request){this.#_(r);break}if(r instanceof globalThis.Response)return r;if(r===K)return}return this.#x(e)}}async#I(){this.#N?.signal.aborted&&(this.#N=new globalThis.AbortController,this.#A.signal=this.#U?AbortSignal.any([this.#U,this.#N.signal]):this.#N.signal,this.request=new globalThis.Request(this.request,{signal:this.#A.signal}));for(const t of this.#A.hooks.beforeRequest){const e=await t(this.request,this.#C(),{retryCount:this.#O});if(e instanceof Response)return e;if(e instanceof globalThis.Request){this.#_(e);break}}const e=((e,t)=>{const r={};for(const s in t)Object.hasOwn(t,s)&&(s in re||s in ee||s in e&&!(s in te)||(r[s]=t[s]));return r})(this.request,this.#A);return this.#P=this.request,this.request=this.#P.clone(),!1===this.#A.timeout?this.#A.fetch(this.#P,e):async function(e,t,r,s){return new Promise((o,n)=>{const i=setTimeout(()=>{r&&r.abort(),n(new pe(e))},s.timeout);s.fetch(e,t).then(o).catch(n).then(()=>{clearTimeout(i)})})}(this.#P,e,this.#N,this.#A)}#C(){if(!this.#Q){const{hooks:e,...t}=this.#A;this.#Q=Object.freeze(t)}return this.#Q}#_(e){this.#Q=void 0,this.request=this.#L(e)}#L(e,t){return this.#A.onUploadProgress&&e.body?((e,t,r)=>{if(!e.body)return e;const s=(e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[r,s]of e)t+=J,t+=(new TextEncoder).encode(`Content-Disposition: form-data; name="${r}"`).length,t+="string"==typeof s?(new TextEncoder).encode(s).length:s.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if("string"==typeof e)return(new TextEncoder).encode(e).length;if(e instanceof URLSearchParams)return(new TextEncoder).encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if("object"==typeof e&&null!==e)try{const t=JSON.stringify(e);return(new TextEncoder).encode(t).length}catch{return 0}return 0})(r??e.body);return new Request(e,{duplex:"half",body:se(e.body,s,t)})})(e,this.#A.onUploadProgress,t??this.#A.body??void 0):e}},ye=e=>{const t=(t,r)=>me.create(t,ne(e,r));for(const r of $)t[r]=(t,s)=>me.create(t,ne(e,s,{method:r}));return t.create=e=>ye(ne(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),ye(ne(e,t))),t.stop=K,t.retry=X,t},ge=ye();function we({title:e,children:t}){/* @__PURE__ */
1
+ import{$ as e,At as t,B as r,Ct as s,Dt as o,F as n,Ft as i,M as a,Mt as l,N as c,S as h,St as u,Tt as d,Y as f,_t as p,bt as m,et as y,ft as g,gt as w,ht as b,i as R,jt as v,l as S,lt as T,mt as x,n as A,t as I,tt as E,vt as C,xt as O}from"./wHbQZdly.js";var q=class extends s{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=y(),this.bindMethods(),this.setOptions(t)}#e;#s=void 0;#o=void 0;#n=void 0;#i;#a;#r;#t;#l;#c;#h;#u;#d;#f;#p=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#s.addObserver(this),P(this.#s,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k(this.#s,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k(this.#s,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set,this.#g(),this.#w(),this.#s.removeObserver(this)}setOptions(e){const t=this.options,r=this.#s;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof b(this.options.enabled,this.#s))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#s.setOptions(this.options),t._defaulted&&!p(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#s,observer:this});const s=this.hasListeners();s&&D(this.#s,r,this.options,t)&&this.#m(),this.updateResult(),!s||this.#s===r&&b(this.options.enabled,this.#s)===b(t.enabled,this.#s)&&w(this.options.staleTime,this.#s)===w(t.staleTime,this.#s)||this.#R();const o=this.#v();!s||this.#s===r&&b(this.options.enabled,this.#s)===b(t.enabled,this.#s)&&o===this.#f||this.#S(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);var s;return s=r,p(this.getCurrentResult(),s)||(this.#n=r,this.#a=this.options,this.#i=this.#s.state),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(/* @__PURE__ */new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#s}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#m(e){this.#b();let t=this.#s.fetch(this.options,e);return e?.throwOnError||(t=t.catch(g)),t}#R(){this.#g();const e=w(this.options.staleTime,this.#s);if(E.isServer()||this.#n.isStale||!T(e))return;const t=m(this.#n.dataUpdatedAt,e)+1;this.#u=O.setTimeout(()=>{this.#n.isStale||this.updateResult()},t)}#v(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#s):this.options.refetchInterval)??!1}#S(e){this.#w(),this.#f=e,!E.isServer()&&!1!==b(this.options.enabled,this.#s)&&T(this.#f)&&0!==this.#f&&(this.#d=O.setInterval(()=>{(this.options.refetchIntervalInBackground||u.isFocused())&&this.#m()},this.#f))}#y(){this.#R(),this.#S(this.#v())}#g(){this.#u&&(O.clearTimeout(this.#u),this.#u=void 0)}#w(){this.#d&&(O.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const r=this.#s,s=this.options,o=this.#n,n=this.#i,i=this.#a,a=e!==r?e.state:this.#o,{state:l}=e;let c,h={...l},u=!1;if(t._optimisticResults){const o=this.hasListeners(),n=!o&&P(e,t),i=o&&D(e,r,t,s);(n||i)&&(h={...h,...f(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(h.fetchStatus="idle")}let{error:d,errorUpdatedAt:p,status:m}=h;c=h.data;let g=!1;if(void 0!==t.placeholderData&&void 0===c&&"pending"===m){let e;o?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(e=o.data,g=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,void 0!==e&&(m="success",c=x(o?.data,e,t),u=!0)}if(t.select&&void 0!==c&&!g)if(o&&c===n?.data&&t.select===this.#l)c=this.#c;else try{this.#l=t.select,c=t.select(c),c=x(o?.data,c,t),this.#c=c,this.#t=null}catch(I){this.#t=I}this.#t&&(d=this.#t,c=this.#c,p=Date.now(),m="error");const w="fetching"===h.fetchStatus,R="pending"===m,v="error"===m,S=R&&w,T=void 0!==c,A={status:m,fetchStatus:h.fetchStatus,isPending:R,isSuccess:"success"===m,isError:v,isInitialLoading:S,isLoading:S,data:c,dataUpdatedAt:h.dataUpdatedAt,error:d,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:h.dataUpdateCount>a.dataUpdateCount||h.errorUpdateCount>a.errorUpdateCount,isFetching:w,isRefetching:w&&!R,isLoadingError:v&&!T,isPaused:"paused"===h.fetchStatus,isPlaceholderData:u,isRefetchError:v&&T,isStale:N(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==b(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==A.data,s="error"===A.status&&!t,o=e=>{s?e.reject(A.error):t&&e.resolve(A.data)},n=()=>{o(this.#r=A.promise=y())},i=this.#r;switch(i.status){case"pending":e.queryHash===r.queryHash&&o(i);break;case"fulfilled":(s||A.data!==i.value)&&n();break;case"rejected":s&&A.error===i.reason||n()}}return A}updateResult(){const e=this.#n,t=this.createResult(this.#s,this.options);this.#i=this.#s.state,this.#a=this.options,void 0!==this.#i.data&&(this.#h=this.#s),p(t,e)||(this.#n=t,this.#T({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#p.size)return!0;const s=new Set(r??this.#p);return this.options.throwOnError&&s.add("error"),Object.keys(this.#n).some(t=>{const r=t;return this.#n[r]!==e[r]&&s.has(r)})})()}))}#b(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#s)return;const t=this.#s;this.#s=e,this.#o=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#T(t){e.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#s,type:"observerResultsUpdated"})})}};function P(e,t){return function(e,t){return!1!==b(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&k(e,t,t.refetchOnMount)}function k(e,t,r){if(!1!==b(t.enabled,e)&&"static"!==w(t.staleTime,e)){const s="function"==typeof r?r(e):r;return"always"===s||!1!==s&&N(e,t)}return!1}function D(e,t,r,s){return(e!==t||!1===b(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&N(e,r)}function N(e,t){return!1!==b(t.enabled,e)&&e.isStaleByTime(w(t.staleTime,e))}var M=i(!1);M.Provider;var U=i(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),Q=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function L(r,s,i){const c=v(M),h=v(U),u=a(i),d=u.defaultQueryOptions(r);u.getDefaultOptions().queries?._experimental_beforeQuery?.(d);const f=u.getQueryCache().get(d.queryHash);d._optimisticResults=c?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),s=e.staleTime;e.staleTime="function"==typeof s?(...e)=>r(s(...e)):r(s),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(d),((e,t,r)=>{const s=r?.state.error&&"function"==typeof e.throwOnError?C(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))})(d,h,f),(e=>{l(()=>{e.clearReset()},[e])})(h);const p=!u.getQueryCache().get(d.queryHash),[m]=o(()=>new s(u,d)),y=m.getOptimisticResult(d),w=!c&&!1!==r.subscribed;if(n(t(t=>{const r=w?m.subscribe(e.batchCalls(t)):g;return m.updateResult(),r},[m,w]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),l(()=>{m.setOptions(d)},[d,m]),((e,t)=>e?.suspense&&t.isPending)(d,y))throw Q(d,m,h);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(o&&void 0===e.data||C(r,[e.error,s])))({result:y,errorResetBoundary:h,throwOnError:d.throwOnError,query:f,suspense:d.suspense}))throw y.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(d,y),d.experimental_prefetchInRender&&!E.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(y,c)&&(p?Q(d,m,h):f?.promise)?.catch(g).finally(()=>{m.updateResult()}),d.notifyOnChangeProps?y:m.trackResult(y)}function j(e,t){return L(e,q,t)}var F=class extends Error{response;request;options;constructor(e,t,r){const s=`${e.status||0===e.status?e.status:""} ${e.statusText??""}`.trim();super(`Request failed with ${s?`status code ${s}`:"an unknown error"}: ${t.method} ${t.url}`),this.name="HTTPError",this.response=e,this.request=t,this.options=r}},_=class extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{"string"==typeof e?t=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(t=e.message)}catch{}super(t),this.value=e}},z=class extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const t=e?.cause?e.cause instanceof Error?e.cause:new _(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},H=(()=>{let e=!1,t=!1;const r="function"==typeof globalThis.ReadableStream,s="function"==typeof globalThis.Request;if(r&&s)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(o){if(o instanceof Error&&"unsupported BodyInit type"===o.message)return!1;throw o}return e&&!t})(),B="function"==typeof globalThis.AbortController,Z="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,V="function"==typeof globalThis.ReadableStream,W="function"==typeof globalThis.FormData,$=["get","post","put","patch","head","delete"],G={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},J=(new TextEncoder).encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,K=Symbol("stop"),Y=class{options;constructor(e){this.options=e}},X=e=>new Y(e),ee={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},te={next:!0},re={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},se=(e,t,r)=>{let s,o=0;return e.pipeThrough(new TransformStream({transform(e,n){if(n.enqueue(e),s){o+=s.byteLength;let e=0===t?0:o/t;e>=1&&(e=1-Number.EPSILON),r?.({percent:e,totalBytes:Math.max(t,o),transferredBytes:o},s)}s=e},flush(){s&&(o+=s.byteLength,r?.({percent:1,totalBytes:Math.max(t,o),transferredBytes:o},s))}}))},oe=e=>null!==e&&"object"==typeof e,ne=(...e)=>{for(const t of e)if((!oe(t)||Array.isArray(t))&&void 0!==t)throw new TypeError("The `options` argument must be an object");return he({},...e)},ie=(e={},t={})=>{const r=new globalThis.Headers(e),s=t instanceof globalThis.Headers,o=new globalThis.Headers(t);for(const[n,i]of o.entries())s&&"undefined"===i||void 0===i?r.delete(n):r.set(n,i);return r};function ae(e,t,r){return Object.hasOwn(t,r)&&void 0===t[r]?[]:he(e[r]??[],t[r]??[])}var le=(e={},t={})=>({beforeRequest:ae(e,t,"beforeRequest"),beforeRetry:ae(e,t,"beforeRetry"),afterResponse:ae(e,t,"afterResponse"),beforeError:ae(e,t,"beforeError")}),ce=(e,t)=>{const r=new URLSearchParams;for(const s of[e,t])if(void 0!==s)if(s instanceof URLSearchParams)for(const[e,t]of s.entries())r.append(e,t);else if(Array.isArray(s))for(const e of s){if(!Array.isArray(e)||2!==e.length)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(e[0]),String(e[1]))}else if(oe(s))for(const[e,t]of Object.entries(s))void 0!==t&&r.append(e,String(t));else{const e=new URLSearchParams(s);for(const[t,s]of e.entries())r.append(t,s)}return r},he=(...e)=>{let t,r={},s={},o={};const n=[];for(const i of e)if(Array.isArray(i))Array.isArray(r)||(r=[]),r=[...r,...i];else if(oe(i)){for(let[e,s]of Object.entries(i))if("signal"===e&&s instanceof globalThis.AbortSignal)n.push(s);else if("context"!==e)"searchParams"!==e?(oe(s)&&e in r&&(s=he(r[e],s)),r={...r,[e]:s}):t=null==s?void 0:void 0===t?s:ce(t,s);else{if(null!=s&&(!oe(s)||Array.isArray(s)))throw new TypeError("The `context` option must be an object");r={...r,context:null==s?{}:{...r.context,...s}}}oe(i.hooks)&&(o=le(o,i.hooks),r.hooks=o),oe(i.headers)&&(s=ie(s,i.headers),r.headers=s)}return void 0!==t&&(r.searchParams=t),n.length>0&&(1===n.length?r.signal=n[0]:r.signal=Z?AbortSignal.any(n):n.at(-1)),r},ue=e=>$.includes(e)?e.toUpperCase():e,de={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},fe=(e={})=>{if("number"==typeof e)return{...de,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");const t=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));return{...de,...t}},pe=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}},me=class e{static create(t,r){const s=new e(t,r),o=s.#x(async()=>{if("number"==typeof s.#A.timeout&&s.#A.timeout>2147483647)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await s.#I();for(const r of s.#A.hooks.afterResponse){const o=s.#E(e.clone());let n;try{n=await r(s.request,s.#C(),o,{retryCount:s.#O})}catch(t){throw s.#q(o),s.#q(e),t}if(n instanceof Y)throw s.#q(o),s.#q(e),new z(n.options);const i=n instanceof globalThis.Response?n:e;o!==i&&s.#q(o),e!==i&&s.#q(e),e=i}if(s.#E(e),!e.ok&&("function"==typeof s.#A.throwHttpErrors?s.#A.throwHttpErrors(e.status):s.#A.throwHttpErrors)){let t=new F(e,s.request,s.#C());for(const e of s.#A.hooks.beforeError)t=await e(t,{retryCount:s.#O});throw t}if(s.#A.onDownloadProgress){if("function"!=typeof s.#A.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!V)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const t=e.clone();return s.#q(e),((e,t)=>{if(!e.body)return e;if(204===e.status)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});const r=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(se(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})})(t,s.#A.onDownloadProgress)}return e}).finally(()=>{const e=s.#P;s.#k(e?.body??void 0),s.#k(s.request.body??void 0)});for(const[e,n]of Object.entries(G))"bytes"===e&&"function"!=typeof globalThis.Response?.prototype?.bytes||(o[e]=async()=>{s.request.headers.set("accept",s.request.headers.get("accept")||n);const t=await o;if("json"===e){if(204===t.status)return"";const e=await t.text();return""===e?"":r.parseJson?r.parseJson(e):JSON.parse(e)}return t[e]()});return o}static#D(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}request;#N;#O=0;#M;#A;#P;#U;#Q;constructor(t,r={}){if(this.#M=t,this.#A={...r,headers:ie(this.#M.headers,r.headers),hooks:le({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:ue(r.method??this.#M.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:fe(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},"string"!=typeof this.#M&&!(this.#M instanceof URL||this.#M instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#A.prefixUrl&&"string"==typeof this.#M){if(this.#M.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#A.prefixUrl.endsWith("/")||(this.#A.prefixUrl+="/"),this.#M=this.#A.prefixUrl+this.#M}B&&Z&&(this.#U=this.#A.signal??this.#M.signal,this.#N=new globalThis.AbortController,this.#A.signal=this.#U?AbortSignal.any([this.#U,this.#N.signal]):this.#N.signal),H&&(this.#A.duplex="half"),void 0!==this.#A.json&&(this.#A.body=this.#A.stringifyJson?.(this.#A.json)??JSON.stringify(this.#A.json),this.#A.headers.set("content-type",this.#A.headers.get("content-type")??"application/json"));const s=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#M instanceof globalThis.Request&&(W&&this.#A.body instanceof globalThis.FormData||this.#A.body instanceof URLSearchParams)&&!s&&this.#A.headers.delete("content-type"),this.request=new globalThis.Request(this.#M,this.#A),void 0!==(o=this.#A.searchParams)&&(Array.isArray(o)?o.length>0:o instanceof URLSearchParams?o.size>0:"object"==typeof o?Object.keys(o).length>0:"string"==typeof o?o.trim().length>0:Boolean(o))){const t="?"+("string"==typeof this.#A.searchParams?this.#A.searchParams.replace(/^\?/,""):new URLSearchParams(e.#D(this.#A.searchParams)).toString()),r=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,t);this.request=new globalThis.Request(r,this.#A)}var o;if(this.#A.onUploadProgress){if("function"!=typeof this.#A.onUploadProgress)throw new TypeError("The `onUploadProgress` option must be a function");if(!H)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#L(this.request,this.#A.body??void 0)}}#j(){const e=this.#A.retry.delay(this.#O);let t=e;!0===this.#A.retry.jitter?t=Math.random()*e:"function"==typeof this.#A.retry.jitter&&(t=this.#A.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));const r=this.#A.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(r,t)}async#F(e){if(this.#O++,this.#O>this.#A.retry.limit)throw e;const t=e instanceof Error?e:new _(e);if(t instanceof z)return t.customDelay??this.#j();if(!this.#A.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#A.retry.shouldRetry){const r=await this.#A.retry.shouldRetry({error:t,retryCount:this.#O});if(!1===r)throw e;if(!0===r)return this.#j()}if(function(e){return e instanceof pe||e?.name===pe.name}(e)&&!this.#A.retry.retryOnTimeout)throw e;if(function(e){return e instanceof F||e?.name===F.name}(e)){if(!this.#A.retry.statusCodes.includes(e.response.status))throw e;const t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this.#A.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now());const r=this.#A.retry.maxRetryAfter??e;return e<r?e:r}if(413===e.response.status)throw e}return this.#j()}#E(e){return this.#A.parseJson&&(e.json=async()=>this.#A.parseJson(await e.text())),e}#k(e){e&&e.cancel().catch(()=>{})}#q(e){this.#k(e.body??void 0)}async#x(e){try{return await e()}catch(t){const r=Math.min(await this.#F(t),2147483647);if(this.#O<1)throw t;if(await async function(e,{signal:t}){return new Promise((r,s)=>{function o(){clearTimeout(n),s(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",o,{once:!0}));const n=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e)})}(r,this.#U?{signal:this.#U}:{}),t instanceof z&&t.customRequest){const e=this.#A.signal?new globalThis.Request(t.customRequest,{signal:this.#A.signal}):new globalThis.Request(t.customRequest);this.#_(e)}for(const e of this.#A.hooks.beforeRetry){const r=await e({request:this.request,options:this.#C(),error:t,retryCount:this.#O});if(r instanceof globalThis.Request){this.#_(r);break}if(r instanceof globalThis.Response)return r;if(r===K)return}return this.#x(e)}}async#I(){this.#N?.signal.aborted&&(this.#N=new globalThis.AbortController,this.#A.signal=this.#U?AbortSignal.any([this.#U,this.#N.signal]):this.#N.signal,this.request=new globalThis.Request(this.request,{signal:this.#A.signal}));for(const t of this.#A.hooks.beforeRequest){const e=await t(this.request,this.#C(),{retryCount:this.#O});if(e instanceof Response)return e;if(e instanceof globalThis.Request){this.#_(e);break}}const e=((e,t)=>{const r={};for(const s in t)Object.hasOwn(t,s)&&(s in re||s in ee||s in e&&!(s in te)||(r[s]=t[s]));return r})(this.request,this.#A);return this.#P=this.request,this.request=this.#P.clone(),!1===this.#A.timeout?this.#A.fetch(this.#P,e):async function(e,t,r,s){return new Promise((o,n)=>{const i=setTimeout(()=>{r&&r.abort(),n(new pe(e))},s.timeout);s.fetch(e,t).then(o).catch(n).then(()=>{clearTimeout(i)})})}(this.#P,e,this.#N,this.#A)}#C(){if(!this.#Q){const{hooks:e,...t}=this.#A;this.#Q=Object.freeze(t)}return this.#Q}#_(e){this.#Q=void 0,this.request=this.#L(e)}#L(e,t){return this.#A.onUploadProgress&&e.body?((e,t,r)=>{if(!e.body)return e;const s=(e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[r,s]of e)t+=J,t+=(new TextEncoder).encode(`Content-Disposition: form-data; name="${r}"`).length,t+="string"==typeof s?(new TextEncoder).encode(s).length:s.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if("string"==typeof e)return(new TextEncoder).encode(e).length;if(e instanceof URLSearchParams)return(new TextEncoder).encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if("object"==typeof e&&null!==e)try{const t=JSON.stringify(e);return(new TextEncoder).encode(t).length}catch{return 0}return 0})(r??e.body);return new Request(e,{duplex:"half",body:se(e.body,s,t)})})(e,this.#A.onUploadProgress,t??this.#A.body??void 0):e}},ye=e=>{const t=(t,r)=>me.create(t,ne(e,r));for(const r of $)t[r]=(t,s)=>me.create(t,ne(e,s,{method:r}));return t.create=e=>ye(ne(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),ye(ne(e,t))),t.stop=K,t.retry=X,t},ge=ye();function we({title:e,children:t}){/* @__PURE__ */
2
2
  return c("div",{className:"mx-auto mt-24 w-fit max-w-xl space-y-8",children:[/* @__PURE__ */c("svg",{xmlns:"http://www.w3.org/2000/svg",className:"mx-auto h-64 w-fit",width:"800",height:"469.317",viewBox:"0 0 800 469.317",role:"img","aria-label":"Error illustration",children:/* @__PURE__ */c("g",{transform:"translate(-443.142 -257.876)",children:[
3
3
  /* @__PURE__ */c("path",{d:"M898.247,664.1H371.155a30.276,30.276,0,0,1-30.241-30.241V352.525a30.276,30.276,0,0,1,30.241-30.241H898.247a30.276,30.276,0,0,1,30.241,30.241V633.862A30.276,30.276,0,0,1,898.247,664.1Z",transform:"translate(308.867 25.517)",fill:"#fff"}),
4
4
  /* @__PURE__ */c("path",{d:"M557.334,341.82H30.241A30.276,30.276,0,0,1,0,311.578V30.241A30.276,30.276,0,0,1,30.241,0H557.334a30.276,30.276,0,0,1,30.241,30.241V311.578A30.276,30.276,0,0,1,557.334,341.82ZM30.241,1.833A28.441,28.441,0,0,0,1.833,30.241V311.578a28.441,28.441,0,0,0,28.409,28.409H557.334a28.441,28.441,0,0,0,28.409-28.409V30.241A28.441,28.441,0,0,0,557.334,1.833Z",transform:"matrix(0.999, -0.035, 0.035, 0.999, 643.995, 358.158)",fill:"#d6d6e3"}),
@@ -29,4 +29,4 @@ return c("div",{className:"mx-auto mt-24 w-fit max-w-xl space-y-8",children:[/*
29
29
  /* @__PURE__ */c("path",{d:"M630.131,617.508a2.452,2.452,0,0,0-3.312-1.027l-9.931,5.228-3.4-195h-.272L608.039,707.89h10.353l-1.408-80.69,12.119-6.38A2.452,2.452,0,0,0,630.131,617.508Z",transform:"translate(-422.315 -280.9)",fill:"#3f3d56"})]})]})}),/* @__PURE__ */c("div",{className:"space-y-4",children:[/* @__PURE__ */c("h4",{className:"text-foreground text-center text-lg font-semibold",children:e}),/* @__PURE__ */c("p",{className:"text-muted-foreground text-center",children:t})]})]})}function be({organizationId:e,errorType:t}){/* @__PURE__ */
30
30
  return c(we,"custom-auth-invalid"===t?{title:"Invalid input",children:"Custom auth mode requires uid, fname, lname. For more details please contact Qrati support."}:{title:"page-not-registered"===t?"Page not registered":"Something went wrong",children:["If you are an admin of this organization, please add the current page URL in Allowed URLs under"," ",
31
31
  /* @__PURE__ */c("a",{className:"font-medium text-blue-500",href:h.ORGANIZATION_SETTINGS(e),target:"_blank",rel:"noreferrer",children:"Organization Settings"})," ","⇨"," ",
32
- /* @__PURE__ */c("a",{className:"font-medium text-blue-500",href:h.ORGANIZATION_SETTINGS_INTEGRATION(e),target:"_blank",rel:"noreferrer",children:"Integration Settings"}),". For more details please contact Qrati support."]})}var Re=e=>({google:"Google",apple:"Apple"}[e]||e.charAt(0).toUpperCase()+e.slice(1)),ve=(e,t=0)=>{let r=t^e.length,s=0;const o=e.length;for(;s+3<o;){let t=255&e.charCodeAt(s)|(255&e.charCodeAt(s+1))<<8|(255&e.charCodeAt(s+2))<<16|(255&e.charCodeAt(s+3))<<24;t=Math.imul(t,3432918353),t=t<<15|t>>>17,t=Math.imul(t,461845907),r^=t,r=r<<13|r>>>19,r=Math.imul(r,5)+3864292196,s+=4}let n=0;switch(o-s){case 3:n^=(255&e.charCodeAt(s+2))<<16;case 2:n^=(255&e.charCodeAt(s+1))<<8;case 1:n^=255&e.charCodeAt(s),n=Math.imul(n,3432918353),n=n<<15|n>>>17,n=Math.imul(n,461845907),r^=n}return r^=r>>>16,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,r>>>=0,r.toString(16).padStart(8,"0")},Se=async e=>{try{return await e()}catch{return null}},Te=e=>{if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Te).join(",")}]`;const t=Object.keys(e).sort(),r=[];for(const s of t){const t=e[s];void 0!==t&&r.push(`${Te(s)}:${Te(t)}`)}return`{${r.join(",")}}`},xe=async({debug:e=!1}={})=>{const t=await Se(()=>Oe()),r=await Se(()=>new Intl.NumberFormat(window.navigator.languages?.[0]||"en").resolvedOptions().numberingSystem),s=window.navigator.languages?Array.from(window.navigator.languages).join(","):window.navigator.language||null,o=Intl.DateTimeFormat().resolvedOptions().timeZone,n=/* @__PURE__ */(new Date).getTimezoneOffset(),i=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"reduce":"no-preference",a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",l=window.matchMedia("(forced-colors: active)").matches?"active":null,{pixelDepth:c,colorDepth:h}=window.screen,u="ontouchstart"in window||window.navigator.maxTouchPoints>0,d=await Se(()=>Ae(e)),f=await Se(()=>Ie()),p=await Se(()=>Ee(e)),m=await Se(()=>Ce(e)),y=window.screen.width&&window.screen.height?(window.screen.width/window.screen.height).toFixed(4):null,g={vendor:window.navigator.vendor||null,platform:window.navigator.platform||null,fonts:t,numberingSystem:r,languages:s,timezone:o,timezoneOffset:n,reducedMotion:i,colorScheme:a,hardwareConcurrency:window.navigator.hardwareConcurrency||null,deviceMemory:window.navigator.deviceMemory||null,forcedColors:l,pixelDepth:c,colorDepth:h,touchSupport:u,canvasID:d,webglID:f,webgpuID:p,audioID:m},w={aspectRatio:y,width:window.screen.width,height:window.screen.height,maxTouchPoints:window.navigator.maxTouchPoints};return(!0===navigator.userAgentData?.mobile||/Mobi|Android|iPhone|iPad|iPod|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent)||navigator.maxTouchPoints>0&&matchMedia("(pointer:coarse)").matches&&innerWidth<=1024)&&Object.assign(g,w),{fingerprint:ve(Te(g)),...g}},Ae=async e=>{const t=document.createElement("canvas");t.width=280,t.height=100;const r=t.getContext("2d"),s=r.createLinearGradient(0,0,280,100);return s.addColorStop(0,"#f60"),s.addColorStop(.4,"#09f"),s.addColorStop(.7,"#f09"),s.addColorStop(1,"#0f9"),r.fillStyle=s,r.fillRect(0,0,280,100),r.font='18px "Arial","Helvetica","DejaVu Sans",sans-serif',r.fillStyle="#000",r.textBaseline="alphabetic",r.fillText("Fingerprint ¼½¾™©®∆π∑€¶§",12,45),r.font='bold 22px "Georgia","Times New Roman",serif',r.fillStyle="#222",r.fillText("🦊🐱🚀 2026",12,78),r.globalAlpha=.7,r.fillStyle="rgba(255, 80, 0, 0.35)",r.fillRect(180,20,80,60),r.beginPath(),r.arc(220,50,32,0,2*Math.PI),r.strokeStyle="#fff",r.lineWidth=4,r.stroke(),r.beginPath(),r.moveTo(30,85),r.quadraticCurveTo(140,20,240,85),r.strokeStyle="#00f",r.lineWidth=3,r.stroke(),e&&(t.style.border="1px solid #444",document.body.appendChild(t)),ve(t.toDataURL("image/png"))},Ie=()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info");return ve(Te({vendor:r?t.getParameter(r.UNMASKED_VENDOR_WEBGL):t.getParameter(t.VENDOR),renderer:r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):t.getParameter(t.RENDERER)}))},Ee=async e=>{const t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),r={vendor:t.info?.vendor??"",architecture:t.info?.architecture??"",description:t.info?.description??"",features:Array.from(t.features).sort(),limits:Array.from(t.limits).sort()};if(e){const e=document.createElement("pre");e.style.margin="10px 0",e.style.padding="10px",e.style.border="1px solid #444",e.style.background="#111",e.style.color="#0f8",e.style.fontFamily="monospace",e.textContent=`WebGPU:\n${JSON.stringify(r,null,2)}`,document.body.appendChild(e)}return ve(Te(r))},Ce=async e=>{const t=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,6e3,44100),r=t.createOscillator();r.type="sawtooth",r.frequency.value=8800;const s=t.createDynamicsCompressor();s.threshold.value=-48,s.knee.value=30,s.ratio.value=14,s.attack.value=0,s.release.value=.3;const o=t.createGain();o.gain.value=.4,r.connect(s),s.connect(o),o.connect(t.destination),r.start(0);const n=(await t.startRendering()).getChannelData(0);let i=0,a=0;for(let c=3e3;c<5800;c+=2){const e=n[c];i=31*i+Math.floor(1e5*(e+1))|0,a=Math.imul(a^Math.floor(98765*e),2246822519)}const l=i>>>0^a>>>0;if(e){const e=document.createElement("canvas");e.width=500,e.height=120,e.style.border="1px solid #444",e.style.margin="10px 0",e.title="Audio buffer snippet (4500–5000 samples)";const t=e.getContext("2d");t.fillStyle="#111",t.fillRect(0,0,e.width,e.height),t.font="14px monospace",t.fillStyle="#0f8",t.textAlign="left",t.fillText("AudioID",10,20),t.strokeStyle="#0f8",t.lineWidth=1.5,t.beginPath();const r=Array.from(n.slice(4500,5e3)),s=e.width/r.length;for(let o=0;o<r.length;o++){const n=o*s,i=(r[o]+1)/2*e.height;0===o?t.moveTo(n,i):t.lineTo(n,i)}t.stroke(),document.body.appendChild(e)}return ve(l.toString(16))},Oe=()=>{const e=["monospace","serif","sans-serif"],t=["Arial","Helvetica","Verdana","Trebuchet MS","Comic Sans MS","Georgia","Times New Roman","Courier New","Segoe UI","Roboto","Open Sans","Noto Sans","system-ui","-apple-system","BlinkMacSystemFont"],r=document.createElement("span");r.style.fontSize="72px",r.style.position="absolute",r.style.visibility="hidden",r.style.whiteSpace="nowrap",r.textContent="mmmmmmmmmwwwwwww",document.body.appendChild(r);const s={};for(const n of e)r.style.fontFamily=n,s[n]=r.offsetWidth;const o=[];for(const n of t){let t=!1;for(const i of e)if(r.style.fontFamily=`"${n}", ${i}`,r.offsetWidth!==s[i]){o.push(n),t=!0;break}t||(r.style.fontFamily=`"${n}"`,r.offsetWidth!==s.monospace&&r.offsetWidth!==s.serif&&o.push(n))}return document.body.removeChild(r),o.length?o.sort().join(","):null};"undefined"!=typeof window&&(window.getBrowserFingerprint=xe);var qe=i(void 0),Pe=({props:e={},children:t})=>{const{organizationId:s,uid:n,fname:i,lname:a,theme:h="light"}=e,[u,f]=o(()=>{if("undefined"==typeof window)return null;if(n||i||a)return null;const e=localStorage.getItem("qrati_token");return e?{token:e}:null}),{isLoading:p,data:m,error:y}=j({queryKey:["qrati-connect-session",s],queryFn:async()=>{const e=await(async()=>{const e=await xe();return"string"==typeof e?e:e?.fingerprint})();return(await ge.post(S.INITIALIZE_SESSION,{json:{uid:n,fname:i,lname:a,browserFingerprint:e},headers:{"x-org-id":s,Authorization:n||i||a||!localStorage.getItem("qrati_token")?void 0:`Bearer ${localStorage.getItem("qrati_token")}`}}).json()).data},enabled:!!s});l(()=>{const e=m?.authSession?.session?.token,t=m?.authSession?.user;t&&e&&(f({...t,token:e}),m?.organization?.customAuth||localStorage.setItem("qrati_token",e))},[m]);const g=d(()=>R(m?.organization?.integrationSettings,m?.organization?.customFontUrl),[m?.organization?.integrationSettings,m?.organization?.customFontUrl]),w=async e=>{try{const t=await((e,t,r)=>new Promise((s,o)=>{if(!e)return void o(/* @__PURE__ */new Error("Provider is required"));if(!t)return void o(/* @__PURE__ */new Error("Organization ID is required"));const n=new URL(`${r}/qc-social-auth`);n.searchParams.set("provider",e),n.searchParams.set("organizationId",t),n.searchParams.set("origin",window.location.origin);const i=(window.screen.width-500)/2,a=(window.screen.height-600)/2,l=window.open(n.toString(),"qrati_social_auth",`width=500,height=600,left=${i},top=${a},scrollbars=yes,resizable=yes,status=yes`);if(!l)return void o(/* @__PURE__ */new Error("Failed to open popup window. Please allow popups and try again."));const c=()=>{clearInterval(u),clearTimeout(d),window.removeEventListener("message",h)},h=e=>{try{const t=new URL(r).origin;if(e.origin!==t)return void console.warn("Origin mismatch:",e.origin,"expected:",t)}catch(u){console.warn("Could not parse origin for verification")}const{type:n,data:i,error:a,organizationId:h}=e.data||{};if(h===t)switch(n){case"QRATI_SOCIAL_AUTH_SUCCESS":c(),l.close(),s({user:i.user,session:i.session,token:i.token});break;case"QRATI_SOCIAL_AUTH_ERROR":console.error("Authentication error:",a),c(),l.close(),o(new Error(a||"Social authentication failed"));break;case"QRATI_SOCIAL_AUTH_CANCELLED":c(),l.close(),o(/* @__PURE__ */new Error("Authentication was cancelled"))}else console.warn("Organization ID mismatch:",h,"expected:",t)},u=setInterval(()=>{try{l.closed&&(c(),o(/* @__PURE__ */new Error("Authentication was cancelled")))}catch(e){}},1e3);window.addEventListener("message",h);const d=setTimeout(()=>{c(),l.closed||l.close(),o(/* @__PURE__ */new Error("Authentication timeout. Please try again."))},3e5)}))(e,s??"","'https://qrati.com");return t?.user&&t?.token&&(f({...t.user,token:t.token}),localStorage.setItem("qrati_token",t.token)),t}catch(y){throw console.error("Social login error:",y),y}};return y?/* @__PURE__ */c(r,{fallback:null,children:/* @__PURE__ */c(be,{organizationId:s??"",errorType:401===y?.response?.status?"page-not-registered":"generic-error"})}):!m?.organization?.customAuth||n&&i&&a?/* @__PURE__ */c(qe.Provider,{value:{props:e,initializing:p,sessionId:m?.sessionId,organization:m?.organization,folders:m?.folders,loadingUser:p,user:u,registerUsingEmail:async(e,t,r,o)=>{try{const n=await ge.post(S.REGISTER,{json:{email:e,password:t,fname:r,lname:o},headers:{"x-org-id":s}}).json();return n.error?{error:n.error}:(f({...n.user,token:n.token}),localStorage.setItem("qrati_token",n.token),n)}catch(y){return{error:y?.message}}},loginWithGoogle:async()=>{try{return await w("google")}catch(y){throw console.error("Google login error:",y),y}},loginWithApple:async()=>{try{return await w("apple")}catch(y){throw console.error("Apple login error:",y),y}},loginUsingEmail:async(e,t)=>{try{const r=await ge.post(S.LOGIN,{json:{email:e,password:t},headers:{"x-org-id":s}}).json();return r.error?{error:r.error}:(f({...r.user,token:r.token}),localStorage.setItem("qrati_token",r.token),r)}catch(y){return{error:y?.message}}},signout:async()=>{try{const e=await ge.post(S.LOGOUT,{headers:{"x-org-id":s,Authorization:`Bearer ${u?.token}`}}).json();return e.error?{error:e.error}:(localStorage.removeItem("qrati_token"),f(null),e)}catch(y){return console.error(y),{error:y?.message}}},error:y},children:/* @__PURE__ */c("div",{id:"qrati-connect-container",style:{...A(m?.organization,h),fontFamily:"var(--font-family)"},className:I("bg-background text-foreground relative min-h-[80vh]"),children:[g?/* @__PURE__ */c("style",{children:g}):null,t]})}):/* @__PURE__ */c(r,{fallback:null,children:/* @__PURE__ */c(be,{organizationId:s??"",errorType:"custom-auth-invalid"})})},ke=()=>{const e=v(qe);if(void 0===e)throw new Error("useSession must be used within SessionProvider");return e};export{ge as a,q as c,Re as i,ke as n,j as o,xe as r,L as s,Pe as t};
32
+ /* @__PURE__ */c("a",{className:"font-medium text-blue-500",href:h.ORGANIZATION_SETTINGS_INTEGRATION(e),target:"_blank",rel:"noreferrer",children:"Integration Settings"}),". For more details please contact Qrati support."]})}var Re=e=>({google:"Google",apple:"Apple"}[e]||e.charAt(0).toUpperCase()+e.slice(1)),ve=(e,t=0)=>{let r=t^e.length,s=0;const o=e.length;for(;s+3<o;){let t=255&e.charCodeAt(s)|(255&e.charCodeAt(s+1))<<8|(255&e.charCodeAt(s+2))<<16|(255&e.charCodeAt(s+3))<<24;t=Math.imul(t,3432918353),t=t<<15|t>>>17,t=Math.imul(t,461845907),r^=t,r=r<<13|r>>>19,r=Math.imul(r,5)+3864292196,s+=4}let n=0;switch(o-s){case 3:n^=(255&e.charCodeAt(s+2))<<16;case 2:n^=(255&e.charCodeAt(s+1))<<8;case 1:n^=255&e.charCodeAt(s),n=Math.imul(n,3432918353),n=n<<15|n>>>17,n=Math.imul(n,461845907),r^=n}return r^=r>>>16,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,r>>>=0,r.toString(16).padStart(8,"0")},Se=async e=>{try{return await e()}catch{return null}},Te=e=>{if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Te).join(",")}]`;const t=Object.keys(e).sort(),r=[];for(const s of t){const t=e[s];void 0!==t&&r.push(`${Te(s)}:${Te(t)}`)}return`{${r.join(",")}}`},xe=async({debug:e=!1}={})=>{const t=await Se(()=>Oe()),r=await Se(()=>new Intl.NumberFormat(window.navigator.languages?.[0]||"en").resolvedOptions().numberingSystem),s=window.navigator.languages?Array.from(window.navigator.languages).join(","):window.navigator.language||null,o=Intl.DateTimeFormat().resolvedOptions().timeZone,n=/* @__PURE__ */(new Date).getTimezoneOffset(),i=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"reduce":"no-preference",a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",l=window.matchMedia("(forced-colors: active)").matches?"active":null,{pixelDepth:c,colorDepth:h}=window.screen,u="ontouchstart"in window||window.navigator.maxTouchPoints>0,d=await Se(()=>Ae(e)),f=await Se(()=>Ie()),p=await Se(()=>Ee(e)),m=await Se(()=>Ce(e)),y=window.screen.width&&window.screen.height?(window.screen.width/window.screen.height).toFixed(4):null,g={vendor:window.navigator.vendor||null,platform:window.navigator.platform||null,fonts:t,numberingSystem:r,languages:s,timezone:o,timezoneOffset:n,reducedMotion:i,colorScheme:a,hardwareConcurrency:window.navigator.hardwareConcurrency||null,deviceMemory:window.navigator.deviceMemory||null,forcedColors:l,pixelDepth:c,colorDepth:h,touchSupport:u,canvasID:d,webglID:f,webgpuID:p,audioID:m},w={aspectRatio:y,width:window.screen.width,height:window.screen.height,maxTouchPoints:window.navigator.maxTouchPoints};return(!0===navigator.userAgentData?.mobile||/Mobi|Android|iPhone|iPad|iPod|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent)||navigator.maxTouchPoints>0&&matchMedia("(pointer:coarse)").matches&&innerWidth<=1024)&&Object.assign(g,w),{fingerprint:ve(Te(g)),...g}},Ae=async e=>{const t=document.createElement("canvas");t.width=280,t.height=100;const r=t.getContext("2d"),s=r.createLinearGradient(0,0,280,100);return s.addColorStop(0,"#f60"),s.addColorStop(.4,"#09f"),s.addColorStop(.7,"#f09"),s.addColorStop(1,"#0f9"),r.fillStyle=s,r.fillRect(0,0,280,100),r.font='18px "Arial","Helvetica","DejaVu Sans",sans-serif',r.fillStyle="#000",r.textBaseline="alphabetic",r.fillText("Fingerprint ¼½¾™©®∆π∑€¶§",12,45),r.font='bold 22px "Georgia","Times New Roman",serif',r.fillStyle="#222",r.fillText("🦊🐱🚀 2026",12,78),r.globalAlpha=.7,r.fillStyle="rgba(255, 80, 0, 0.35)",r.fillRect(180,20,80,60),r.beginPath(),r.arc(220,50,32,0,2*Math.PI),r.strokeStyle="#fff",r.lineWidth=4,r.stroke(),r.beginPath(),r.moveTo(30,85),r.quadraticCurveTo(140,20,240,85),r.strokeStyle="#00f",r.lineWidth=3,r.stroke(),e&&(t.style.border="1px solid #444",document.body.appendChild(t)),ve(t.toDataURL("image/png"))},Ie=()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info");return ve(Te({vendor:r?t.getParameter(r.UNMASKED_VENDOR_WEBGL):t.getParameter(t.VENDOR),renderer:r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):t.getParameter(t.RENDERER)}))},Ee=async e=>{const t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),r={vendor:t.info?.vendor??"",architecture:t.info?.architecture??"",description:t.info?.description??"",features:Array.from(t.features).sort(),limits:Array.from(t.limits).sort()};if(e){const e=document.createElement("pre");e.style.margin="10px 0",e.style.padding="10px",e.style.border="1px solid #444",e.style.background="#111",e.style.color="#0f8",e.style.fontFamily="monospace",e.textContent=`WebGPU:\n${JSON.stringify(r,null,2)}`,document.body.appendChild(e)}return ve(Te(r))},Ce=async e=>{const t=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,6e3,44100),r=t.createOscillator();r.type="sawtooth",r.frequency.value=8800;const s=t.createDynamicsCompressor();s.threshold.value=-48,s.knee.value=30,s.ratio.value=14,s.attack.value=0,s.release.value=.3;const o=t.createGain();o.gain.value=.4,r.connect(s),s.connect(o),o.connect(t.destination),r.start(0);const n=(await t.startRendering()).getChannelData(0);let i=0,a=0;for(let c=3e3;c<5800;c+=2){const e=n[c];i=31*i+Math.floor(1e5*(e+1))|0,a=Math.imul(a^Math.floor(98765*e),2246822519)}const l=i>>>0^a>>>0;if(e){const e=document.createElement("canvas");e.width=500,e.height=120,e.style.border="1px solid #444",e.style.margin="10px 0",e.title="Audio buffer snippet (4500–5000 samples)";const t=e.getContext("2d");t.fillStyle="#111",t.fillRect(0,0,e.width,e.height),t.font="14px monospace",t.fillStyle="#0f8",t.textAlign="left",t.fillText("AudioID",10,20),t.strokeStyle="#0f8",t.lineWidth=1.5,t.beginPath();const r=Array.from(n.slice(4500,5e3)),s=e.width/r.length;for(let o=0;o<r.length;o++){const n=o*s,i=(r[o]+1)/2*e.height;0===o?t.moveTo(n,i):t.lineTo(n,i)}t.stroke(),document.body.appendChild(e)}return ve(l.toString(16))},Oe=()=>{const e=["monospace","serif","sans-serif"],t=["Arial","Helvetica","Verdana","Trebuchet MS","Comic Sans MS","Georgia","Times New Roman","Courier New","Segoe UI","Roboto","Open Sans","Noto Sans","system-ui","-apple-system","BlinkMacSystemFont"],r=document.createElement("span");r.style.fontSize="72px",r.style.position="absolute",r.style.visibility="hidden",r.style.whiteSpace="nowrap",r.textContent="mmmmmmmmmwwwwwww",document.body.appendChild(r);const s={};for(const n of e)r.style.fontFamily=n,s[n]=r.offsetWidth;const o=[];for(const n of t){let t=!1;for(const i of e)if(r.style.fontFamily=`"${n}", ${i}`,r.offsetWidth!==s[i]){o.push(n),t=!0;break}t||(r.style.fontFamily=`"${n}"`,r.offsetWidth!==s.monospace&&r.offsetWidth!==s.serif&&o.push(n))}return document.body.removeChild(r),o.length?o.sort().join(","):null};"undefined"!=typeof window&&(window.getBrowserFingerprint=xe);var qe=i(void 0),Pe=({props:e={},children:t})=>{const{organizationId:s,uid:n,fname:i,lname:a,theme:h="light"}=e,[u,f]=o(()=>{if("undefined"==typeof window)return null;if(n||i||a)return null;const e=localStorage.getItem("qrati_token");return e?{token:e}:null}),{isLoading:p,data:m,error:y}=j({queryKey:["qrati-connect-session",s,n??null,i??null,a??null],queryFn:async()=>{const e=await(async()=>{const e=await xe();return"string"==typeof e?e:e?.fingerprint})();return(await ge.post(S.INITIALIZE_SESSION,{json:{uid:n,fname:i,lname:a,browserFingerprint:e},headers:{"x-org-id":s,Authorization:n||i||a||!localStorage.getItem("qrati_token")?void 0:`Bearer ${localStorage.getItem("qrati_token")}`}}).json()).data},enabled:!!s});l(()=>{const e=m?.authSession?.session?.token,t=m?.authSession?.user;t&&e?(f({...t,token:e}),m?.organization?.customAuth||localStorage.setItem("qrati_token",e)):m?.organization?.customAuth&&n&&i&&a&&f(e=>e??{uid:n,name:`${i} ${a}`,fname:i,lname:a})},[m]);const g=d(()=>R(m?.organization?.integrationSettings,m?.organization?.customFontUrl),[m?.organization?.integrationSettings,m?.organization?.customFontUrl]),w=async e=>{try{const t=await((e,t,r)=>new Promise((s,o)=>{if(!e)return void o(/* @__PURE__ */new Error("Provider is required"));if(!t)return void o(/* @__PURE__ */new Error("Organization ID is required"));const n=new URL(`${r}/qc-social-auth`);n.searchParams.set("provider",e),n.searchParams.set("organizationId",t),n.searchParams.set("origin",window.location.origin);const i=(window.screen.width-500)/2,a=(window.screen.height-600)/2,l=window.open(n.toString(),"qrati_social_auth",`width=500,height=600,left=${i},top=${a},scrollbars=yes,resizable=yes,status=yes`);if(!l)return void o(/* @__PURE__ */new Error("Failed to open popup window. Please allow popups and try again."));const c=()=>{clearInterval(u),clearTimeout(d),window.removeEventListener("message",h)},h=e=>{try{const t=new URL(r).origin;if(e.origin!==t)return void console.warn("Origin mismatch:",e.origin,"expected:",t)}catch(u){console.warn("Could not parse origin for verification")}const{type:n,data:i,error:a,organizationId:h}=e.data||{};if(h===t)switch(n){case"QRATI_SOCIAL_AUTH_SUCCESS":c(),l.close(),s({user:i.user,session:i.session,token:i.token});break;case"QRATI_SOCIAL_AUTH_ERROR":console.error("Authentication error:",a),c(),l.close(),o(new Error(a||"Social authentication failed"));break;case"QRATI_SOCIAL_AUTH_CANCELLED":c(),l.close(),o(/* @__PURE__ */new Error("Authentication was cancelled"))}else console.warn("Organization ID mismatch:",h,"expected:",t)},u=setInterval(()=>{try{l.closed&&(c(),o(/* @__PURE__ */new Error("Authentication was cancelled")))}catch(e){}},1e3);window.addEventListener("message",h);const d=setTimeout(()=>{c(),l.closed||l.close(),o(/* @__PURE__ */new Error("Authentication timeout. Please try again."))},3e5)}))(e,s??"","https://qrati.com");return t?.user&&t?.token&&(f({...t.user,token:t.token}),localStorage.setItem("qrati_token",t.token)),t}catch(y){throw console.error("Social login error:",y),y}};return y?/* @__PURE__ */c(r,{fallback:null,children:/* @__PURE__ */c(be,{organizationId:s??"",errorType:401===y?.response?.status?"page-not-registered":"generic-error"})}):!m?.organization?.customAuth||n&&i&&a?/* @__PURE__ */c(qe.Provider,{value:{props:e,initializing:p,sessionId:m?.sessionId,organization:m?.organization,folders:m?.folders,loadingUser:p,user:u,registerUsingEmail:async(e,t,r,o)=>{try{const n=await ge.post(S.REGISTER,{json:{email:e,password:t,fname:r,lname:o},headers:{"x-org-id":s}}).json();return n.error?{error:n.error}:(f({...n.user,token:n.token}),localStorage.setItem("qrati_token",n.token),n)}catch(y){return{error:y?.message}}},loginWithGoogle:async()=>{try{return await w("google")}catch(y){throw console.error("Google login error:",y),y}},loginWithApple:async()=>{try{return await w("apple")}catch(y){throw console.error("Apple login error:",y),y}},loginUsingEmail:async(e,t)=>{try{const r=await ge.post(S.LOGIN,{json:{email:e,password:t},headers:{"x-org-id":s}}).json();return r.error?{error:r.error}:(f({...r.user,token:r.token}),localStorage.setItem("qrati_token",r.token),r)}catch(y){return{error:y?.message}}},signout:async()=>{try{const e=await ge.post(S.LOGOUT,{headers:{"x-org-id":s,Authorization:`Bearer ${u?.token}`}}).json();return e.error?{error:e.error}:(localStorage.removeItem("qrati_token"),f(null),e)}catch(y){return console.error(y),{error:y?.message}}},error:y},children:/* @__PURE__ */c("div",{id:"qrati-connect-container",style:{...A(m?.organization,h),fontFamily:"var(--font-family)"},className:I("bg-background text-foreground relative min-h-[80vh]"),children:[g?/* @__PURE__ */c("style",{children:g}):null,t]})}):/* @__PURE__ */c(r,{fallback:null,children:/* @__PURE__ */c(be,{organizationId:s??"",errorType:"custom-auth-invalid"})})},ke=()=>{const e=v(qe);if(void 0===e)throw new Error("useSession must be used within SessionProvider");return e};export{ge as a,q as c,Re as i,ke as n,j as o,xe as r,L as s,Pe as t};