chainlit 1.3.1__tar.gz → 1.3.2__tar.gz

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.

Potentially problematic release.


This version of chainlit might be problematic. Click here for more details.

Files changed (95) hide show
  1. {chainlit-1.3.1 → chainlit-1.3.2}/PKG-INFO +3 -3
  2. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/copilot/dist/index.js +1 -1
  3. chainlit-1.3.1/chainlit/frontend/dist/assets/DailyMotion-CwoOhIL8.js → chainlit-1.3.2/chainlit/frontend/dist/assets/DailyMotion-Bq4wFES6.js +1 -1
  4. chainlit-1.3.1/chainlit/frontend/dist/assets/Facebook-BhnGXlzq.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Facebook-CHEgeJDe.js +1 -1
  5. chainlit-1.3.1/chainlit/frontend/dist/assets/FilePlayer-CPSVT6fz.js → chainlit-1.3.2/chainlit/frontend/dist/assets/FilePlayer-BMFA6He5.js +1 -1
  6. chainlit-1.3.1/chainlit/frontend/dist/assets/Kaltura-COYaLzsL.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Kaltura-BS4Q0SKd.js +1 -1
  7. chainlit-1.3.1/chainlit/frontend/dist/assets/Mixcloud-JdadNiQ5.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Mixcloud-tLlgZy_i.js +1 -1
  8. chainlit-1.3.1/chainlit/frontend/dist/assets/Mux-CBN7RO2u.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Mux-Bcz0qNhS.js +1 -1
  9. chainlit-1.3.1/chainlit/frontend/dist/assets/Preview-CxAFvvjV.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Preview-RsJjlwJx.js +1 -1
  10. chainlit-1.3.1/chainlit/frontend/dist/assets/SoundCloud-JlgmASWm.js → chainlit-1.3.2/chainlit/frontend/dist/assets/SoundCloud-B9UgR7Bk.js +1 -1
  11. chainlit-1.3.1/chainlit/frontend/dist/assets/Streamable-CUWgr6Zw.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Streamable-BOgIqbui.js +1 -1
  12. chainlit-1.3.1/chainlit/frontend/dist/assets/Twitch-BiN1HEDM.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Twitch-CBX_d6nV.js +1 -1
  13. chainlit-1.3.1/chainlit/frontend/dist/assets/Vidyard-qhPmrhDm.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Vidyard-C5HPuozf.js +1 -1
  14. chainlit-1.3.1/chainlit/frontend/dist/assets/Vimeo-CrZVSCaT.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Vimeo-CHBmywi9.js +1 -1
  15. chainlit-1.3.1/chainlit/frontend/dist/assets/Wistia-C891KrBP.js → chainlit-1.3.2/chainlit/frontend/dist/assets/Wistia-1Gb23ljh.js +1 -1
  16. chainlit-1.3.1/chainlit/frontend/dist/assets/YouTube-DKjw5Hbn.js → chainlit-1.3.2/chainlit/frontend/dist/assets/YouTube-CA7t0q0j.js +1 -1
  17. chainlit-1.3.1/chainlit/frontend/dist/assets/index-DLRdQOIx.js → chainlit-1.3.2/chainlit/frontend/dist/assets/index-DnjoDoLU.js +30 -30
  18. chainlit-1.3.1/chainlit/frontend/dist/assets/react-plotly-Dpmqg5Sy.js → chainlit-1.3.2/chainlit/frontend/dist/assets/react-plotly-Ba2Cl614.js +1 -1
  19. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/frontend/dist/index.html +1 -1
  20. {chainlit-1.3.1 → chainlit-1.3.2}/pyproject.toml +3 -3
  21. {chainlit-1.3.1 → chainlit-1.3.2}/README.md +0 -0
  22. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/__init__.py +0 -0
  23. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/__main__.py +0 -0
  24. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/_utils.py +0 -0
  25. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/action.py +0 -0
  26. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/auth.py +0 -0
  27. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/cache.py +0 -0
  28. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/callbacks.py +0 -0
  29. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/chat_context.py +0 -0
  30. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/chat_settings.py +0 -0
  31. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/cli/__init__.py +0 -0
  32. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/config.py +0 -0
  33. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/context.py +0 -0
  34. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/copilot/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
  35. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/copilot/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
  36. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/__init__.py +0 -0
  37. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/acl.py +0 -0
  38. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/base.py +0 -0
  39. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/dynamodb.py +0 -0
  40. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/literalai.py +0 -0
  41. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/sql_alchemy.py +0 -0
  42. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/storage_clients.py +0 -0
  43. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/data/utils.py +0 -0
  44. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/discord/__init__.py +0 -0
  45. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/discord/app.py +0 -0
  46. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/element.py +0 -0
  47. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/emitter.py +0 -0
  48. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/frontend/dist/assets/index-CwmincdQ.css +0 -0
  49. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/frontend/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
  50. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/frontend/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
  51. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/frontend/dist/favicon.svg +0 -0
  52. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/haystack/__init__.py +0 -0
  53. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/haystack/callbacks.py +0 -0
  54. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/hello.py +0 -0
  55. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/input_widget.py +0 -0
  56. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/langchain/__init__.py +0 -0
  57. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/langchain/callbacks.py +0 -0
  58. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/langflow/__init__.py +0 -0
  59. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/llama_index/__init__.py +0 -0
  60. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/llama_index/callbacks.py +0 -0
  61. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/logger.py +0 -0
  62. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/markdown.py +0 -0
  63. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/message.py +0 -0
  64. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/mistralai/__init__.py +0 -0
  65. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/oauth_providers.py +0 -0
  66. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/openai/__init__.py +0 -0
  67. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/py.typed +0 -0
  68. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/secret.py +0 -0
  69. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/server.py +0 -0
  70. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/session.py +0 -0
  71. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/slack/__init__.py +0 -0
  72. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/slack/app.py +0 -0
  73. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/socket.py +0 -0
  74. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/step.py +0 -0
  75. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/sync.py +0 -0
  76. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/teams/__init__.py +0 -0
  77. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/teams/app.py +0 -0
  78. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/telemetry.py +0 -0
  79. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/bn.json +0 -0
  80. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/en-US.json +0 -0
  81. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/gu.json +0 -0
  82. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/he-IL.json +0 -0
  83. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/hi.json +0 -0
  84. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/kn.json +0 -0
  85. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/ml.json +0 -0
  86. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/mr.json +0 -0
  87. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/ta.json +0 -0
  88. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/te.json +0 -0
  89. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations/zh-CN.json +0 -0
  90. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/translations.py +0 -0
  91. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/types.py +0 -0
  92. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/user.py +0 -0
  93. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/user_session.py +0 -0
  94. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/utils.py +0 -0
  95. {chainlit-1.3.1 → chainlit-1.3.2}/chainlit/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chainlit
3
- Version: 1.3.1
3
+ Version: 1.3.2
4
4
  Summary: Build Conversational AI.
5
5
  Home-page: https://chainlit.io/
6
6
  License: Apache-2.0
@@ -24,7 +24,7 @@ Requires-Dist: aiofiles (>=23.1.0,<24.0.0)
24
24
  Requires-Dist: asyncer (>=0.0.7,<0.0.8)
25
25
  Requires-Dist: click (>=8.1.3,<9.0.0)
26
26
  Requires-Dist: dataclasses_json (>=0.6.7,<0.7.0)
27
- Requires-Dist: fastapi (>=0.110.1,<0.113)
27
+ Requires-Dist: fastapi (>=0.115.3,<0.116)
28
28
  Requires-Dist: filetype (>=1.2.0,<2.0.0)
29
29
  Requires-Dist: httpx (>=0.23.0)
30
30
  Requires-Dist: lazify (>=0.4.0,<0.5.0)
@@ -37,7 +37,7 @@ Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
37
37
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
38
38
  Requires-Dist: python-multipart (>=0.0.9,<0.0.10)
39
39
  Requires-Dist: python-socketio (>=5.11.0,<6.0.0)
40
- Requires-Dist: starlette (>=0.37.2,<0.38.0)
40
+ Requires-Dist: starlette (>=0.41.2,<0.42.0)
41
41
  Requires-Dist: syncer (>=2.0.3,<3.0.0)
42
42
  Requires-Dist: tomli (>=2.0.1,<3.0.0)
43
43
  Requires-Dist: uptrace (>=1.22.0,<2.0.0)
@@ -82,7 +82,7 @@ function print() { __p += __j.call(arguments, '') }
82
82
  *
83
83
  * This source code is licensed under the MIT license found in the
84
84
  * LICENSE file in the root directory of this source tree.
85
- */var sE=mt;function DRe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var PRe=typeof Object.is=="function"?Object.is:DRe,kRe=sE.useState,FRe=sE.useEffect,BRe=sE.useLayoutEffect,zRe=sE.useDebugValue;function URe(e,t){var r=t(),a=kRe({inst:{value:r,getSnapshot:t}}),u=a[0].inst,A=a[1];return BRe(function(){u.value=r,u.getSnapshot=t,pP(u)&&A({inst:u})},[e,r,t]),FRe(function(){return pP(u)&&A({inst:u}),e(function(){pP(u)&&A({inst:u})})},[e]),zRe(r),r}function pP(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!PRe(e,r)}catch{return!0}}function HRe(e,t){return t()}var $Re=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?HRe:URe;_ee.useSyncExternalStore=sE.useSyncExternalStore!==void 0?sE.useSyncExternalStore:$Re,bee.exports=_ee;var GRe=bee.exports;const G1=()=>{},qd=G1(),vP=Object,_s=e=>e===qd,_g=e=>typeof e=="function",V1=(e,t)=>({...e,...t}),VRe=e=>_g(e.then),e6=new WeakMap;let YRe=0;const V2=e=>{const t=typeof e,r=e&&e.constructor,a=r==Date;let u,A;if(vP(e)===e&&!a&&r!=RegExp){if(u=e6.get(e),u)return u;if(u=++YRe+"~",e6.set(e,u),r==Array){for(u="@",A=0;A<e.length;A++)u+=V2(e[A])+",";e6.set(e,u)}if(r==vP){u="#";const c=vP.keys(e).sort();for(;!_s(A=c.pop());)_s(e[A])||(u+=A+":"+V2(e[A])+",");e6.set(e,u)}}else u=a?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return u},xg=new WeakMap,mP={},t6={},gP="undefined",r6=typeof window!=gP,yP=typeof document!=gP,WRe=()=>r6&&typeof window.requestAnimationFrame!=gP,xee=(e,t)=>{const r=xg.get(e);return[()=>!_s(t)&&e.get(t)||mP,a=>{if(!_s(t)){const u=e.get(t);t in t6||(t6[t]=u),r[5](t,V1(u,a),u||mP)}},r[6],()=>!_s(t)&&t in t6?t6[t]:!_s(t)&&e.get(t)||mP]};let bP=!0;const jRe=()=>bP,[_P,xP]=r6&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[G1,G1],KRe=()=>{const e=yP&&document.visibilityState;return _s(e)||e!=="hidden"},XRe=e=>(yP&&document.addEventListener("visibilitychange",e),_P("focus",e),()=>{yP&&document.removeEventListener("visibilitychange",e),xP("focus",e)}),QRe=e=>{const t=()=>{bP=!0,e()},r=()=>{bP=!1};return _P("online",t),_P("offline",r),()=>{xP("online",t),xP("offline",r)}},ZRe={isOnline:jRe,isVisible:KRe},JRe={initFocus:XRe,initReconnect:QRe},Eee=!Xn.useId,Y2=!r6||"Deno"in window,qRe=e=>WRe()?window.requestAnimationFrame(e):setTimeout(e,1),EP=Y2?mt.useEffect:mt.useLayoutEffect,SP=typeof navigator<"u"&&navigator.connection,See=!Y2&&SP&&(["slow-2g","2g"].includes(SP.effectiveType)||SP.saveData),TP=e=>{if(_g(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?V2(e):"",[e,t]};let eMe=0;const wP=()=>++eMe,Tee=0,wee=1,Aee=2;var W2={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Tee,MUTATE_EVENT:Aee,RECONNECT_EVENT:wee};async function Cee(...e){const[t,r,a,u]=e,A=V1({populateCache:!0,throwOnError:!0},typeof u=="boolean"?{revalidate:u}:u||{});let c=A.populateCache;const g=A.rollbackOnError;let n=A.optimisticData;const s=A.revalidate!==!1,_=E=>typeof g=="function"?g(E):g!==!1,o=A.throwOnError;if(_g(r)){const E=r,h=[],x=t.keys();for(const l of x)!/^\$(inf|sub)\$/.test(l)&&E(t.get(l)._k)&&h.push(l);return Promise.all(h.map(T))}return T(r);async function T(E){const[h]=TP(E);if(!h)return;const[x,l]=xee(t,h),[i,d,f,v]=xg.get(t),m=()=>{const D=i[h];return s&&(delete f[h],delete v[h],D&&D[0])?D[0](Aee).then(()=>x().data):x().data};if(e.length<3)return m();let p=a,C;const w=wP();d[h]=[w,0];const I=!_s(n),S=x(),y=S.data,R=S._c,L=_s(R)?y:R;if(I&&(n=_g(n)?n(L,y):n,l({data:n,_c:L})),_g(p))try{p=p(L)}catch(D){C=D}if(p&&VRe(p))if(p=await p.catch(D=>{C=D}),w!==d[h][0]){if(C)throw C;return p}else C&&I&&_(C)&&(c=!0,l({data:L,_c:qd}));if(c&&!C)if(_g(c)){const D=c(p,L);l({data:D,error:qd,_c:qd})}else l({data:p,error:qd,_c:qd});if(d[h][1]=wP(),Promise.resolve(m()).then(()=>{l({_c:qd})}),C){if(o)throw C;return}return p}}const Ree=(e,t)=>{for(const r in e)e[r][0]&&e[r][0](t)},tMe=(e,t)=>{if(!xg.has(e)){const r=V1(JRe,t),a={},u=Cee.bind(qd,e);let A=G1;const c={},g=(_,o)=>{const T=c[_]||[];return c[_]=T,T.push(o),()=>T.splice(T.indexOf(o),1)},n=(_,o,T)=>{e.set(_,o);const E=c[_];if(E)for(const h of E)h(o,T)},s=()=>{if(!xg.has(e)&&(xg.set(e,[a,{},{},{},u,n,g]),!Y2)){const _=r.initFocus(setTimeout.bind(qd,Ree.bind(qd,a,Tee))),o=r.initReconnect(setTimeout.bind(qd,Ree.bind(qd,a,wee)));A=()=>{_&&_(),o&&o(),xg.delete(e)}}};return s(),[e,u,s,A]}return[e,xg.get(e)[4]]},rMe=(e,t,r,a,u)=>{const A=r.errorRetryCount,c=u.retryCount,g=~~((Math.random()+.5)*(1<<(c<8?c:8)))*r.errorRetryInterval;!_s(A)&&c>A||setTimeout(a,g,u)},nMe=(e,t)=>V2(e)==V2(t),[Mee,aMe]=tMe(new Map),iMe=V1({onLoadingSlow:G1,onSuccess:G1,onError:G1,onErrorRetry:rMe,onDiscarded:G1,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:See?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:See?5e3:3e3,compare:nMe,isPaused:()=>!1,cache:Mee,mutate:aMe,fallback:{}},ZRe),oMe=(e,t)=>{const r=V1(e,t);if(t){const{use:a,fallback:u}=e,{use:A,fallback:c}=t;a&&A&&(r.use=a.concat(A)),u&&c&&(r.fallback=V1(u,c))}return r},sMe=mt.createContext({}),lMe="$inf$",Iee=r6&&window.__SWR_DEVTOOLS_USE__,uMe=Iee?window.__SWR_DEVTOOLS_USE__:[],cMe=()=>{Iee&&(window.__SWR_DEVTOOLS_REACT__=Xn)},fMe=e=>_g(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],dMe=()=>V1(iMe,mt.useContext(sMe)),hMe=e=>(t,r,a)=>e(t,r&&((...A)=>{const[c]=TP(t),[,,,g]=xg.get(Mee);if(c.startsWith(lMe))return r(...A);const n=g[c];return _s(n)?r(...A):(delete g[c],n)}),a),pMe=uMe.concat(hMe),vMe=e=>function(...r){const a=dMe(),[u,A,c]=fMe(r),g=oMe(a,c);let n=e;const{use:s}=g,_=(s||[]).concat(pMe);for(let o=_.length;o--;)n=_[o](n);return n(u,A||g.fetcher||null,g)},mMe=(e,t,r)=>{const a=t[e]||(t[e]=[]);return a.push(r),()=>{const u=a.indexOf(r);u>=0&&(a[u]=a[a.length-1],a.pop())}};cMe();const Oee=Xn.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),AP={dedupe:!0},gMe=vMe((e,t,r)=>{const{cache:a,compare:u,suspense:A,fallbackData:c,revalidateOnMount:g,revalidateIfStale:n,refreshInterval:s,refreshWhenHidden:_,refreshWhenOffline:o,keepPreviousData:T}=r,[E,h,x,l]=xg.get(a),[i,d]=TP(e),f=mt.useRef(!1),v=mt.useRef(!1),m=mt.useRef(i),p=mt.useRef(t),C=mt.useRef(r),w=()=>C.current,I=()=>w().isVisible()&&w().isOnline(),[S,y,R,L]=xee(a,i),D=mt.useRef({}).current,F=_s(c)?r.fallback[i]:c,M=(ae,oe)=>{for(const he in D){const q=he;if(q==="data"){if(!u(ae[q],oe[q])&&(!_s(ae[q])||!u($,oe[q])))return!1}else if(oe[q]!==ae[q])return!1}return!0},k=mt.useMemo(()=>{const ae=!i||!t?!1:_s(g)?w().isPaused()||A?!1:_s(n)?!0:n:g,oe=re=>{const fe=V1(re);return delete fe._k,ae?{isValidating:!0,isLoading:!0,...fe}:fe},he=S(),q=L(),J=oe(he),le=he===q?J:oe(q);let Z=J;return[()=>{const re=oe(S());return M(re,Z)?(Z.data=re.data,Z.isLoading=re.isLoading,Z.isValidating=re.isValidating,Z.error=re.error,Z):(Z=re,re)},()=>le]},[a,i]),O=GRe.useSyncExternalStore(mt.useCallback(ae=>R(i,(oe,he)=>{M(he,oe)||ae()}),[a,i]),k[0],k[1]),b=!f.current,P=E[i]&&E[i].length>0,N=O.data,U=_s(N)?F:N,B=O.error,Y=mt.useRef(U),$=T?_s(N)?Y.current:N:U,G=P&&!_s(B)?!1:b&&!_s(g)?g:w().isPaused()?!1:A?_s(U)?!1:n:_s(U)||n,W=!!(i&&t&&b&&G),V=_s(O.isValidating)?W:O.isValidating,j=_s(O.isLoading)?W:O.isLoading,X=mt.useCallback(async ae=>{const oe=p.current;if(!i||!oe||v.current||w().isPaused())return!1;let he,q,J=!0;const le=ae||{},Z=!x[i]||!le.dedupe,re=()=>Eee?!v.current&&i===m.current&&f.current:i===m.current,fe={isValidating:!1,isLoading:!1},ne=()=>{y(fe)},Q=()=>{const ie=x[i];ie&&ie[1]===q&&delete x[i]},de={isValidating:!0};_s(S().data)&&(de.isLoading=!0);try{if(Z&&(y(de),r.loadingTimeout&&_s(S().data)&&setTimeout(()=>{J&&re()&&w().onLoadingSlow(i,r)},r.loadingTimeout),x[i]=[oe(d),wP()]),[he,q]=x[i],he=await he,Z&&setTimeout(Q,r.dedupingInterval),!x[i]||x[i][1]!==q)return Z&&re()&&w().onDiscarded(i),!1;fe.error=qd;const ie=h[i];if(!_s(ie)&&(q<=ie[0]||q<=ie[1]||ie[1]===0))return ne(),Z&&re()&&w().onDiscarded(i),!1;const ce=S().data;fe.data=u(ce,he)?ce:he,Z&&re()&&w().onSuccess(he,i,r)}catch(ie){Q();const ce=w(),{shouldRetryOnError:me}=ce;ce.isPaused()||(fe.error=ie,Z&&re()&&(ce.onError(ie,i,ce),(me===!0||_g(me)&&me(ie))&&I()&&ce.onErrorRetry(ie,i,ce,Se=>{const Ee=E[i];Ee&&Ee[0]&&Ee[0](W2.ERROR_REVALIDATE_EVENT,Se)},{retryCount:(le.retryCount||0)+1,dedupe:!0})))}return J=!1,ne(),!0},[i,a]),te=mt.useCallback((...ae)=>Cee(a,m.current,...ae),[]);if(EP(()=>{p.current=t,C.current=r,_s(N)||(Y.current=N)}),EP(()=>{if(!i)return;const ae=X.bind(qd,AP);let oe=0;const q=mMe(i,E,(J,le={})=>{if(J==W2.FOCUS_EVENT){const Z=Date.now();w().revalidateOnFocus&&Z>oe&&I()&&(oe=Z+w().focusThrottleInterval,ae())}else if(J==W2.RECONNECT_EVENT)w().revalidateOnReconnect&&I()&&ae();else{if(J==W2.MUTATE_EVENT)return X();if(J==W2.ERROR_REVALIDATE_EVENT)return X(le)}});return v.current=!1,m.current=i,f.current=!0,y({_k:d}),G&&(_s(U)||Y2?ae():qRe(ae)),()=>{v.current=!0,q()}},[i]),EP(()=>{let ae;function oe(){const q=_g(s)?s(S().data):s;q&&ae!==-1&&(ae=setTimeout(he,q))}function he(){!S().error&&(_||w().isVisible())&&(o||w().isOnline())?X(AP).then(oe):oe()}return oe(),()=>{ae&&(clearTimeout(ae),ae=-1)}},[s,_,o,i]),mt.useDebugValue($),A&&_s(U)&&i){if(!Eee&&Y2)throw new Error("Fallback data is required when using suspense in SSR.");p.current=t,C.current=r,v.current=!1;const ae=l[i];if(!_s(ae)){const oe=te(ae);Oee(oe)}if(_s(B)){const oe=X(AP);_s($)||(oe.status="fulfilled",oe.value=!0),Oee(oe)}else throw B}return{mutate:te,get data(){return D.data=!0,$},get error(){return D.error=!0,B},get isValidating(){return D.isValidating=!0,V},get isLoading(){return D.isLoading=!0,j}}}),fm=Object.create(null);fm.open="0",fm.close="1",fm.ping="2",fm.pong="3",fm.message="4",fm.upgrade="5",fm.noop="6";const n6=Object.create(null);Object.keys(fm).forEach(e=>{n6[fm[e]]=e});const CP={type:"error",data:"parser error"},Nee=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Lee=typeof ArrayBuffer=="function",Dee=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,RP=({type:e,data:t},r,a)=>Nee&&t instanceof Blob?r?a(t):Pee(t,a):Lee&&(t instanceof ArrayBuffer||Dee(t))?r?a(t):Pee(new Blob([t]),a):a(fm[e]+(t||"")),Pee=(e,t)=>{const r=new FileReader;return r.onload=function(){const a=r.result.split(",")[1];t("b"+(a||""))},r.readAsDataURL(e)};function kee(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let MP;function yMe(e,t){if(Nee&&e.data instanceof Blob)return e.data.arrayBuffer().then(kee).then(t);if(Lee&&(e.data instanceof ArrayBuffer||Dee(e.data)))return t(kee(e.data));RP(e,!1,r=>{MP||(MP=new TextEncoder),t(MP.encode(r))})}const Fee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Fee.length;e++)j2[Fee.charCodeAt(e)]=e;const bMe=e=>{let t=e.length*.75,r=e.length,a,u=0,A,c,g,n;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const s=new ArrayBuffer(t),_=new Uint8Array(s);for(a=0;a<r;a+=4)A=j2[e.charCodeAt(a)],c=j2[e.charCodeAt(a+1)],g=j2[e.charCodeAt(a+2)],n=j2[e.charCodeAt(a+3)],_[u++]=A<<2|c>>4,_[u++]=(c&15)<<4|g>>2,_[u++]=(g&3)<<6|n&63;return s},_Me=typeof ArrayBuffer=="function",IP=(e,t)=>{if(typeof e!="string")return{type:"message",data:Bee(e,t)};const r=e.charAt(0);return r==="b"?{type:"message",data:xMe(e.substring(1),t)}:n6[r]?e.length>1?{type:n6[r],data:e.substring(1)}:{type:n6[r]}:CP},xMe=(e,t)=>{if(_Me){const r=bMe(e);return Bee(r,t)}else return{base64:!0,data:e}},Bee=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},zee="",EMe=(e,t)=>{const r=e.length,a=new Array(r);let u=0;e.forEach((A,c)=>{RP(A,!1,g=>{a[c]=g,++u===r&&t(a.join(zee))})})},SMe=(e,t)=>{const r=e.split(zee),a=[];for(let u=0;u<r.length;u++){const A=IP(r[u],t);if(a.push(A),A.type==="error")break}return a};function TMe(){return new TransformStream({transform(e,t){yMe(e,r=>{const a=r.length;let u;if(a<126)u=new Uint8Array(1),new DataView(u.buffer).setUint8(0,a);else if(a<65536){u=new Uint8Array(3);const A=new DataView(u.buffer);A.setUint8(0,126),A.setUint16(1,a)}else{u=new Uint8Array(9);const A=new DataView(u.buffer);A.setUint8(0,127),A.setBigUint64(1,BigInt(a))}e.data&&typeof e.data!="string"&&(u[0]|=128),t.enqueue(u),t.enqueue(r)})}})}let OP;function a6(e){return e.reduce((t,r)=>t+r.length,0)}function i6(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let a=0;for(let u=0;u<t;u++)r[u]=e[0][a++],a===e[0].length&&(e.shift(),a=0);return e.length&&a<e[0].length&&(e[0]=e[0].slice(a)),r}function wMe(e,t){OP||(OP=new TextDecoder);const r=[];let a=0,u=-1,A=!1;return new TransformStream({transform(c,g){for(r.push(c);;){if(a===0){if(a6(r)<1)break;const n=i6(r,1);A=(n[0]&128)===128,u=n[0]&127,u<126?a=3:u===126?a=1:a=2}else if(a===1){if(a6(r)<2)break;const n=i6(r,2);u=new DataView(n.buffer,n.byteOffset,n.length).getUint16(0),a=3}else if(a===2){if(a6(r)<8)break;const n=i6(r,8),s=new DataView(n.buffer,n.byteOffset,n.length),_=s.getUint32(0);if(_>Math.pow(2,21)-1){g.enqueue(CP);break}u=_*Math.pow(2,32)+s.getUint32(4),a=3}else{if(a6(r)<u)break;const n=i6(r,u);g.enqueue(IP(A?n:OP.decode(n),t)),a=0}if(u===0||u>e){g.enqueue(CP);break}}}})}const Uee=4;function Ku(e){if(e)return AMe(e)}function AMe(e){for(var t in Ku.prototype)e[t]=Ku.prototype[t];return e}Ku.prototype.on=Ku.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Ku.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},Ku.prototype.off=Ku.prototype.removeListener=Ku.prototype.removeAllListeners=Ku.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var a,u=0;u<r.length;u++)if(a=r[u],a===t||a.fn===t){r.splice(u,1);break}return r.length===0&&delete this._callbacks["$"+e],this},Ku.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],a=1;a<arguments.length;a++)t[a-1]=arguments[a];if(r){r=r.slice(0);for(var a=0,u=r.length;a<u;++a)r[a].apply(this,t)}return this},Ku.prototype.emitReserved=Ku.prototype.emit,Ku.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Ku.prototype.hasListeners=function(e){return!!this.listeners(e).length};const o0=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Hee(e,...t){return t.reduce((r,a)=>(e.hasOwnProperty(a)&&(r[a]=e[a]),r),{})}const CMe=o0.setTimeout,RMe=o0.clearTimeout;function o6(e,t){t.useNativeTimers?(e.setTimeoutFn=CMe.bind(o0),e.clearTimeoutFn=RMe.bind(o0)):(e.setTimeoutFn=o0.setTimeout.bind(o0),e.clearTimeoutFn=o0.clearTimeout.bind(o0))}const MMe=1.33;function IMe(e){return typeof e=="string"?OMe(e):Math.ceil((e.byteLength||e.size)*MMe)}function OMe(e){let t=0,r=0;for(let a=0,u=e.length;a<u;a++)t=e.charCodeAt(a),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(a++,r+=4);return r}function NMe(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}function LMe(e){let t={},r=e.split("&");for(let a=0,u=r.length;a<u;a++){let A=r[a].split("=");t[decodeURIComponent(A[0])]=decodeURIComponent(A[1])}return t}class DMe extends Error{constructor(t,r,a){super(t),this.description=r,this.context=a,this.type="TransportError"}}class NP extends Ku{constructor(t){super(),this.writable=!1,o6(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,r,a){return super.emitReserved("error",new DMe(t,r,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const r=IP(t,this.socket.binaryType);this.onPacket(r)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,r={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const r=NMe(t);return r.length?"?"+r:""}}const $ee="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),LP=64,PMe={};let Gee=0,s6=0,Vee;function Yee(e){let t="";do t=$ee[e%LP]+t,e=Math.floor(e/LP);while(e>0);return t}function Wee(){const e=Yee(+new Date);return e!==Vee?(Gee=0,Vee=e):e+"."+Yee(Gee++)}for(;s6<LP;s6++)PMe[$ee[s6]]=s6;let jee=!1;try{jee=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const kMe=jee;function Kee(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||kMe))return new XMLHttpRequest}catch{}if(!t)try{return new o0[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function eNt(){}function FMe(){}const BMe=function(){return new Kee({xdomain:!1}).responseType!=null}();class zMe extends NP{constructor(t){if(super(t),this.polling=!1,typeof location<"u"){const a=location.protocol==="https:";let u=location.port;u||(u=a?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||u!==t.port}const r=t&&t.forceBase64;this.supportsBinary=BMe&&!r,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const r=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let a=0;this.polling&&(a++,this.once("pollComplete",function(){--a||r()})),this.writable||(a++,this.once("drain",function(){--a||r()}))}else r()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};SMe(t,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,EMe(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=Wee()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new lE(this.uri(),t)}doWrite(t,r){const a=this.request({method:"POST",data:t});a.on("success",r),a.on("error",(u,A)=>{this.onError("xhr post error",u,A)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,a)=>{this.onError("xhr poll error",r,a)}),this.pollXhr=t}}let lE=class oN extends Ku{constructor(t,r){super(),o6(this,r),this.opts=r,this.method=r.method||"GET",this.uri=t,this.data=r.data!==void 0?r.data:null,this.create()}create(){var t;const r=Hee(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this.opts.xd;const a=this.xhr=new Kee(r);try{a.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let u in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(u)&&a.setRequestHeader(u,this.opts.extraHeaders[u])}}catch{}if(this.method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(a),"withCredentials"in a&&(a.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(a.timeout=this.opts.requestTimeout),a.onreadystatechange=()=>{var u;a.readyState===3&&((u=this.opts.cookieJar)===null||u===void 0||u.parseCookies(a)),a.readyState===4&&(a.status===200||a.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof a.status=="number"?a.status:0)},0))},a.send(this.data)}catch(u){this.setTimeoutFn(()=>{this.onError(u)},0);return}typeof document<"u"&&(this.index=oN.requestsCount++,oN.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=FMe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete oN.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};if(lE.requestsCount=0,lE.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xee);else if(typeof addEventListener=="function"){const e="onpagehide"in o0?"pagehide":"unload";addEventListener(e,Xee,!1)}}function Xee(){for(let e in lE.requests)lE.requests.hasOwnProperty(e)&&lE.requests[e].abort()}const DP=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),l6=o0.WebSocket||o0.MozWebSocket,Qee=!0,UMe="arraybuffer",Zee=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class HMe extends NP{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),r=this.opts.protocols,a=Zee?{}:Hee(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=Qee&&!Zee?r?new l6(t,r):new l6(t):new l6(t,r,a)}catch(u){return this.emitReserved("error",u)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const a=t[r],u=r===t.length-1;RP(a,this.supportsBinary,A=>{const c={};try{Qee&&this.ws.send(A)}catch{}u&&DP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=Wee()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}check(){return!!l6}}class $Me extends NP{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const r=wMe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=t.readable.pipeThrough(r).getReader(),u=TMe();u.readable.pipeTo(t.writable),this.writer=u.writable.getWriter();const A=()=>{a.read().then(({done:g,value:n})=>{g||(this.onPacket(n),A())}).catch(g=>{})};A();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this.writer.write(c).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const a=t[r],u=r===t.length-1;this.writer.write(a).then(()=>{u&&DP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const GMe={websocket:HMe,webtransport:$Me,polling:zMe},VMe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,YMe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function PP(e){if(e.length>2e3)throw"URI too long";const t=e,r=e.indexOf("["),a=e.indexOf("]");r!=-1&&a!=-1&&(e=e.substring(0,r)+e.substring(r,a).replace(/:/g,";")+e.substring(a,e.length));let u=VMe.exec(e||""),A={},c=14;for(;c--;)A[YMe[c]]=u[c]||"";return r!=-1&&a!=-1&&(A.source=t,A.host=A.host.substring(1,A.host.length-1).replace(/;/g,":"),A.authority=A.authority.replace("[","").replace("]","").replace(/;/g,":"),A.ipv6uri=!0),A.pathNames=WMe(A,A.path),A.queryKey=jMe(A,A.query),A}function WMe(e,t){const r=/\/{2,9}/g,a=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&a.splice(0,1),t.slice(-1)=="/"&&a.splice(a.length-1,1),a}function jMe(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,u,A){u&&(r[u]=A)}),r}let Jee=class LT extends Ku{constructor(t,r={}){super(),this.binaryType=UMe,this.writeBuffer=[],t&&typeof t=="object"&&(r=t,t=null),t?(t=PP(t),r.hostname=t.host,r.secure=t.protocol==="https"||t.protocol==="wss",r.port=t.port,t.query&&(r.query=t.query)):r.host&&(r.hostname=PP(r.host).host),o6(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=r.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=LMe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=Uee,r.transport=t,this.id&&(r.sid=this.id);const a=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new GMe[t](a)}open(){let t;if(this.opts.rememberUpgrade&&LT.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",r=>this.onClose("transport close",r))}probe(t){let r=this.createTransport(t),a=!1;LT.priorWebsocketSuccess=!1;const u=()=>{a||(r.send([{type:"ping",data:"probe"}]),r.once("packet",o=>{if(!a)if(o.type==="pong"&&o.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;LT.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(_(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const T=new Error("probe error");T.transport=r.name,this.emitReserved("upgradeError",T)}}))};function A(){a||(a=!0,_(),r.close(),r=null)}const c=o=>{const T=new Error("probe error: "+o);T.transport=r.name,A(),this.emitReserved("upgradeError",T)};function g(){c("transport closed")}function n(){c("socket closed")}function s(o){r&&o.name!==r.name&&A()}const _=()=>{r.removeListener("open",u),r.removeListener("error",c),r.removeListener("close",g),this.off("close",n),this.off("upgrading",s)};r.once("open",u),r.once("error",c),r.once("close",g),this.once("close",n),this.once("upgrading",s),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{a||r.open()},200):r.open()}onOpen(){if(this.readyState="open",LT.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const r=this.upgrades.length;for(;t<r;t++)this.probe(this.upgrades[t])}}onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const r=new Error("server error");r.code=t.data,this.onError(r);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let a=0;a<this.writeBuffer.length;a++){const u=this.writeBuffer[a].data;if(u&&(r+=IMe(u)),a>0&&r>this.maxPayload)return this.writeBuffer.slice(0,a);r+=2}return this.writeBuffer}write(t,r,a){return this.sendPacket("message",t,r,a),this}send(t,r,a){return this.sendPacket("message",t,r,a),this}sendPacket(t,r,a,u){if(typeof r=="function"&&(u=r,r=void 0),typeof a=="function"&&(u=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const A={type:t,data:r,options:a};this.emitReserved("packetCreate",A),this.writeBuffer.push(A),u&&this.once("flush",u),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},a=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():t()}):this.upgrading?a():t()),this}onError(t){LT.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,r){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const r=[];let a=0;const u=t.length;for(;a<u;a++)~this.transports.indexOf(t[a])&&r.push(t[a]);return r}};Jee.protocol=Uee;function KMe(e,t="",r){let a=e;r=r||typeof location<"u"&&location,e==null&&(e=r.protocol+"//"+r.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=r.protocol+e:e=r.host+e),/^(https?|wss?):\/\//.test(e)||(typeof r<"u"?e=r.protocol+"//"+e:e="https://"+e),a=PP(e)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const A=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+A+":"+a.port+t,a.href=a.protocol+"://"+A+(r&&r.port===a.port?"":":"+a.port),a}const XMe=typeof ArrayBuffer=="function",QMe=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qee=Object.prototype.toString,ZMe=typeof Blob=="function"||typeof Blob<"u"&&qee.call(Blob)==="[object BlobConstructor]",JMe=typeof File=="function"||typeof File<"u"&&qee.call(File)==="[object FileConstructor]";function kP(e){return XMe&&(e instanceof ArrayBuffer||QMe(e))||ZMe&&e instanceof Blob||JMe&&e instanceof File}function u6(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let r=0,a=e.length;r<a;r++)if(u6(e[r]))return!0;return!1}if(kP(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return u6(e.toJSON(),!0);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&u6(e[r]))return!0;return!1}function qMe(e){const t=[],r=e.data,a=e;return a.data=FP(r,t),a.attachments=t.length,{packet:a,buffers:t}}function FP(e,t){if(!e)return e;if(kP(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}else if(Array.isArray(e)){const r=new Array(e.length);for(let a=0;a<e.length;a++)r[a]=FP(e[a],t);return r}else if(typeof e=="object"&&!(e instanceof Date)){const r={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=FP(e[a],t));return r}return e}function e8e(e,t){return e.data=BP(e.data,t),delete e.attachments,e}function BP(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=BP(e[r],t);else if(typeof e=="object")for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=BP(e[r],t));return e}const t8e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],r8e=5;var is;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(is||(is={}));class n8e{constructor(t){this.replacer=t}encode(t){return(t.type===is.EVENT||t.type===is.ACK)&&u6(t)?this.encodeAsBinary({type:t.type===is.EVENT?is.BINARY_EVENT:is.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===is.BINARY_EVENT||t.type===is.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const r=qMe(t),a=this.encodeAsString(r.packet),u=r.buffers;return u.unshift(a),u}}function ete(e){return Object.prototype.toString.call(e)==="[object Object]"}class zP extends Ku{constructor(t){super(),this.reviver=t}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const a=r.type===is.BINARY_EVENT;a||r.type===is.BINARY_ACK?(r.type=a?is.EVENT:is.ACK,this.reconstructor=new a8e(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(kP(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const a={type:Number(t.charAt(0))};if(is[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===is.BINARY_EVENT||a.type===is.BINARY_ACK){const A=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const c=t.substring(A,r);if(c!=Number(c)||t.charAt(r)!=="-")throw new Error("Illegal attachments");a.attachments=Number(c)}if(t.charAt(r+1)==="/"){const A=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););a.nsp=t.substring(A,r)}else a.nsp="/";const u=t.charAt(r+1);if(u!==""&&Number(u)==u){const A=r+1;for(;++r;){const c=t.charAt(r);if(c==null||Number(c)!=c){--r;break}if(r===t.length)break}a.id=Number(t.substring(A,r+1))}if(t.charAt(++r)){const A=this.tryParse(t.substr(r));if(zP.isPayloadValid(a.type,A))a.data=A;else throw new Error("invalid payload")}return a}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case is.CONNECT:return ete(r);case is.DISCONNECT:return r===void 0;case is.CONNECT_ERROR:return typeof r=="string"||ete(r);case is.EVENT:case is.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&t8e.indexOf(r[0])===-1);case is.ACK:case is.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class a8e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const r=e8e(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const i8e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:zP,Encoder:n8e,get PacketType(){return is},protocol:r8e},Symbol.toStringTag,{value:"Module"}));function cv(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const o8e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tte extends Ku{constructor(t,r,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=r,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[cv(t,"open",this.onopen.bind(this)),cv(t,"packet",this.onpacket.bind(this)),cv(t,"error",this.onerror.bind(this)),cv(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...r){if(o8e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const a={type:is.EVENT,data:r};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const c=this.ids++,g=r.pop();this._registerAckCallback(c,g),a.id=c}const u=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!u||!this.connected)||(this.connected?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(t,r){var a;const u=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(u===void 0){this.acks[t]=r;return}const A=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===t&&this.sendBuffer.splice(c,1);r.call(this,new Error("operation has timed out"))},u);this.acks[t]=(...c)=>{this.io.clearTimeoutFn(A),r.apply(this,[null,...c])}}emitWithAck(t,...r){const a=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((u,A)=>{r.push((c,g)=>a?c?A(c):u(g):u(c)),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((u,...A)=>a!==this._queue[0]?void 0:(u!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(u)):(this._queue.shift(),r&&r(null,...A)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:is.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case is.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case is.EVENT:case is.BINARY_EVENT:this.onevent(t);break;case is.ACK:case is.BINARY_ACK:this.onack(t);break;case is.DISCONNECT:this.ondisconnect();break;case is.CONNECT_ERROR:this.destroy();const a=new Error(t.data.message);a.data=t.data.data,this.emitReserved("connect_error",a);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const a of r)a.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const r=this;let a=!1;return function(...u){a||(a=!0,r.packet({type:is.ACK,id:t,data:u}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(r.apply(this,t.data),delete this.acks[t.id])}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:is.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const r=this._anyListeners;for(let a=0;a<r.length;a++)if(t===r[a])return r.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const r=this._anyOutgoingListeners;for(let a=0;a<r.length;a++)if(t===r[a])return r.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const a of r)a.apply(this,t.data)}}}function uE(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}uE.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0},uE.prototype.reset=function(){this.attempts=0},uE.prototype.setMin=function(e){this.ms=e},uE.prototype.setMax=function(e){this.max=e},uE.prototype.setJitter=function(e){this.jitter=e};class UP extends Ku{constructor(t,r){var a;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,o6(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((a=r.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new uE({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const u=r.parser||i8e;this.encoder=new u.Encoder,this.decoder=new u.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Jee(this.uri,this.opts);const r=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const u=cv(r,"open",function(){a.onopen(),t&&t()}),A=g=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",g),t?t(g):this.maybeReconnectOnOpen()},c=cv(r,"error",A);if(this._timeout!==!1){const g=this._timeout,n=this.setTimeoutFn(()=>{u(),A(new Error("timeout")),r.close()},g);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(u),this.subs.push(c),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(cv(t,"ping",this.onping.bind(this)),cv(t,"data",this.ondata.bind(this)),cv(t,"error",this.onerror.bind(this)),cv(t,"close",this.onclose.bind(this)),cv(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){DP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let a=this.nsps[t];return a?this._autoConnect&&!a.active&&a.connect():(a=new tte(this,t,r),this.nsps[t]=a),a}_destroy(t){const r=Object.keys(this.nsps);for(const a of r)if(this.nsps[a].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let a=0;a<r.length;a++)this.engine.write(r[a],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,r){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(u=>{u?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",u)):t.onreconnect()}))},r);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const K2={};function c6(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const r=KMe(e,t.path||"/socket.io"),a=r.source,u=r.id,A=r.path,c=K2[u]&&A in K2[u].nsps,g=t.forceNew||t["force new connection"]||t.multiplex===!1||c;let n;return g?n=new UP(a,t):(K2[u]||(K2[u]=new UP(a,t)),n=K2[u]),r.query&&!t.query&&(t.query=r.queryKey),n.socket(r.path,t)}Object.assign(c6,{Manager:UP,Socket:tte,io:c6,connect:c6});var s8e=e=>{let t={},r=new Date,a=new Date;a.setDate(r.getDate()-1);let u=new Date;u.setDate(r.getDate()-7);let A=new Date;return A.setDate(r.getDate()-30),e.forEach(c=>{let g=new Date(c.createdAt),n=g.toDateString()===r.toDateString(),s=g.toDateString()===a.toDateString(),_=g>=u,o=g>=A,T;n?T="Today":s?T="Yesterday":_?T="Previous 7 days":o?T="Previous 30 days":T=g.toLocaleString("default",{month:"long",year:"numeric"}).split(" ").slice(0,1).join(" "),t[T]||(t[T]=[]),t[T].push(c)}),t},rte=Bs({key:"ThreadIdToResume",default:void 0}),l8e=Bs({key:"ChatProfile",default:void 0}),nte=Bs({key:"SessionId",default:dP()}),HP=mee({key:"SessionIdSelector",get:({get:e})=>e(nte),set:({set:e},t)=>e(nte,t instanceof CRe?dP():t)}),$P=Bs({key:"Session",dangerouslyAllowMutability:!0,default:void 0}),GP=Bs({key:"Actions",default:[]}),cE=Bs({key:"Messages",dangerouslyAllowMutability:!0,default:[]}),ate=Bs({key:"TokenCount",default:0}),VP=Bs({key:"Loading",default:!1}),f6=Bs({key:"AskUser",default:void 0}),ite=Bs({key:"CallFn",default:void 0}),d6=Bs({key:"ChatSettings",default:[]}),ote=mee({key:"ChatSettingsValue/Default",get:({get:e})=>e(d6).reduce((t,r)=>(t[r.id]=r.initial,t),{})}),YP=Bs({key:"ChatSettingsValue",default:ote}),WP=Bs({key:"DisplayElements",default:[]}),jP=Bs({key:"TasklistElements",default:[]}),h6=Bs({key:"FirstUserInteraction",default:void 0}),Ub=Bs({key:"AccessToken",default:void 0}),u8e=Bs({key:"User",default:null}),c8e=Bs({key:"ChainlitConfig",default:void 0}),f8e=Bs({key:"AuthConfig",default:void 0}),X2=Bs({key:"ThreadHistory",default:{threads:void 0,currentThreadId:void 0,timeGroupedThreads:void 0,pageInfo:void 0},effects:[({setSelf:e,onSet:t})=>{t((r,a)=>{let u=r==null?void 0:r.timeGroupedThreads;r!=null&&r.threads&&!oE.isEqual(r.threads,a==null?void 0:a.timeGroupedThreads)&&(u=s8e(r.threads)),e({...r,timeGroupedThreads:u})})}]}),fE=Bs({key:"SideView",default:void 0}),KP=Bs({key:"CurrentThreadId",default:void 0}),fv=()=>{let e=as(VP),t=as(WP),r=as(jP),a=as(GP),u=as($P),A=as(f6),c=as(ite),g=as(d6),n=as(YP),s=as(ote),_=(u==null?void 0:u.socket.connected)&&!(u!=null&&u.error),o=!_||e||(A==null?void 0:A.spec.type)==="file"||(A==null?void 0:A.spec.type)==="action";return{actions:a,askUser:A,callFn:c,chatSettingsDefaultValue:s,chatSettingsInputs:g,chatSettingsValue:n,connected:_,disabled:o,elements:t,error:u==null?void 0:u.error,loading:e,tasklists:r}},d8e=e=>{let t=[];for(let r of e)t=Hb(t,r);return t},Hb=(e,t)=>p6(e,t.id)?$b(e,t.id,t):"parentId"in t&&t.parentId?lte(e,t.parentId,t):"indent"in t&&t.indent&&t.indent>0?ste(e,t.indent,t):[...e,t],ste=(e,t,r,a=0)=>{let u=[...e];if(u.length===0)return[...u,r];{let A=u.length-1,c=u[A];return c.steps=c.steps||[],a+1===t?(c.steps=[...c.steps,r],u[A]={...c},u):(c.steps=ste(c.steps,t,r,a+1),u[A]={...c},u)}},lte=(e,t,r)=>{let a=[...e];for(let u=0;u<a.length;u++){let A=a[u];oE.isEqual(A.id,t)?(A.steps=A.steps?[...A.steps,r]:[r],a[u]={...A}):p6(a,t)&&A.steps&&(A.steps=lte(A.steps,t,r),a[u]={...A})}return a},ute=(e,t)=>{for(let r of e){if(oE.isEqual(r.id,t))return r;if(r.steps&&r.steps.length>0){let a=ute(r.steps,t);if(a)return a}}},p6=(e,t)=>ute(e,t)!==void 0,$b=(e,t,r)=>{let a=[...e];for(let u=0;u<a.length;u++){let A=a[u];oE.isEqual(A.id,t)?a[u]={steps:A.steps,...r}:p6(a,t)&&A.steps&&(A.steps=$b(A.steps,t,r),a[u]={...A})}return a},cte=(e,t)=>{let r=[...e];for(let a=0;a<r.length;a++){let u=r[a];u.id===t?r=[...r.slice(0,a),...r.slice(a+1)]:p6(r,t)&&u.steps&&(u.steps=cte(u.steps,t),r[a]={...u})}return r},fte=(e,t,r,a,u)=>{let A=[...e];for(let c=0;c<A.length;c++){let g=A[c];oE.isEqual(g.id,t)?("content"in g&&g.content!==void 0?a?g.content=r:g.content+=r:u?"input"in g&&g.input!==void 0&&(a?g.input=r:g.input+=r):"output"in g&&g.output!==void 0&&(a?g.output=r:g.output+=r),A[c]={...g}):g.steps&&(g.steps=fte(g.steps,t,r,a,u),A[c]={...g})}return A},XP="token";function dte(){try{return localStorage.getItem(XP)}catch{return}}function h8e(e){try{return localStorage.setItem(XP,e)}catch{return}}function hte(){try{return localStorage.removeItem(XP)}catch{return}}var p8e=async(e,t,r)=>{var a;return(a=await e.get(t,r))==null?void 0:a.json()};function v6(e,{token:t,...r}={}){let a=mt.useContext(Rc),u=as(Ub);u=t||u;let A=mt.useMemo(()=>([g,n])=>p8e(a,g,n),[a]),c=mt.useMemo(()=>e?[e,u]:null,[e,u]);return gMe(c,A,r)}var s0=()=>{let e=mt.useContext(Rc),[t,r]=hu(f8e),[a,u]=hu(u8e),{data:A,isLoading:c}=v6(t?null:"/auth/config"),[g,n]=hu(Ub),s=Yo(X2);mt.useEffect(()=>{A&&r(A)},[A,r]);let _=!!(!c&&t),o=async(h=!1)=>{await e.logout(),u(null),hte(),n(""),s(void 0),h&&window.location.reload()},T=h=>{if(!h){o();return}try{let{exp:x,...l}=LRe(h);h8e(h),n(`Bearer ${h}`),u(l)}catch(x){console.error("Invalid token, clearing token from local storage","error:",x),o()}};mt.useEffect(()=>{if(!a&&dte()){T(dte());return}},[]);let E=!!g;return t&&!t.requireLogin?{authConfig:t,user:null,isReady:_,isAuthenticated:!0,accessToken:"",logout:()=>{},setAccessToken:()=>{}}:{data:t,user:a,isAuthenticated:E,isReady:_,accessToken:g,logout:o,setAccessToken:T}},QP=class extends Error{constructor(e,t){super(e),this.detail=t}toString(){return this.detail?`${this.message}: ${this.detail}`:this.message}},v8e=class{constructor(e,t,r,a){this.httpEndpoint=e,this.type=t,this.on401=r,this.onError=a}buildEndpoint(e){return this.httpEndpoint.endsWith("/")?`${this.httpEndpoint.slice(0,-1)}${e}`:`${this.httpEndpoint}${e}`}checkToken(e){let t="Bearer ";return e.startsWith(t)?e:t+e}async fetch(e,t,r,a,u){try{let A={};r&&(A.Authorization=this.checkToken(r));let c;a instanceof FormData?c=a:(A["Content-Type"]="application/json",c=a?JSON.stringify(a):null);let g=await fetch(this.buildEndpoint(t),{method:e,headers:A,signal:u,body:c});if(!g.ok){let n=await g.json();throw g.status===401&&this.on401&&(hte(),this.on401()),new QP(g.statusText,n.detail)}return g}catch(A){throw A instanceof QP&&this.onError&&this.onError(A),console.error(A),A}}async get(e,t){return await this.fetch("GET",e,t)}async post(e,t,r,a){return await this.fetch("POST",e,r,t,a)}async put(e,t,r){return await this.fetch("PUT",e,r,t)}async patch(e,t,r){return await this.fetch("PATCH",e,r,t)}async delete(e,t,r){return await this.fetch("DELETE",e,r,t)}},pte=class extends v8e{async headerAuth(){return(await this.post("/auth/header",{})).json()}async passwordAuth(e){return(await this.post("/login",e)).json()}async logout(){return(await this.post("/logout",{})).json()}async setFeedback(e,t){return(await this.put("/feedback",{feedback:e},t)).json()}async deleteFeedback(e,t){return(await this.delete("/feedback",{feedbackId:e},t)).json()}async listThreads(e,t,r){return(await this.post("/project/threads",{pagination:e,filter:t},r)).json()}async deleteThread(e,t){return(await this.delete("/project/thread",{threadId:e},t)).json()}uploadFile(e,t,r,a){let u=new XMLHttpRequest,A=new Promise((c,g)=>{let n=new FormData;n.append("file",e),u.open("POST",this.buildEndpoint(`/project/file?session_id=${r}`),!0),a&&u.setRequestHeader("Authorization",this.checkToken(a)),u.upload.onprogress=function(s){if(s.lengthComputable){let _=s.loaded/s.total*100;t(_)}},u.onload=function(){if(u.status===200){let s=JSON.parse(u.responseText);c(s)}else g("Upload failed")},u.onerror=function(){g("Upload error")},u.send(n)});return{xhr:u,promise:A}}getElementUrl(e,t){let r=`?session_id=${t}`;return this.buildEndpoint(`/project/file/${e}${r}`)}getLogoEndpoint(e){return this.buildEndpoint(`/logo?theme=${e}`)}getOAuthEndpoint(e){return this.buildEndpoint(`/auth/oauth/${e}`)}},Rc=mt.createContext(new pte("http://localhost:8000","webapp")),Xu=()=>{let e=mt.useContext(Rc),t=as(Ub),r=as($P),a=as(f6),u=as(HP),A=Q5(d6),c=Q5(HP),g=Q5(YP),n=Yo(h6),s=Yo(VP),_=Yo(cE),o=Yo(WP),T=Yo(jP),E=Yo(GP),h=Yo(ate),x=Yo(rte),l=Yo(fE),i=Yo(KP),d=mt.useCallback(()=>{r==null||r.socket.emit("clear_session"),r==null||r.socket.disconnect(),x(void 0),c(),n(void 0),_([]),o([]),T([]),E([]),h(0),A(),g(),l(void 0),i(void 0)},[r]),f=mt.useCallback((y,R=[])=>{y.id||(y.id=dP()),y.createdAt||(y.createdAt=new Date().toISOString()),_(L=>Hb(L,y)),r==null||r.socket.emit("client_message",{message:y,fileReferences:R})},[r==null?void 0:r.socket]),v=mt.useCallback(y=>{r==null||r.socket.emit("edit_message",{message:y})},[r==null?void 0:r.socket]),m=mt.useCallback((y,R,L,D)=>{r==null||r.socket.emit("audio_chunk",{isStart:y,mimeType:R,elapsedTime:L,data:D})},[r==null?void 0:r.socket]),p=mt.useCallback(y=>{r==null||r.socket.emit("audio_end",{fileReferences:y})},[r==null?void 0:r.socket]),C=mt.useCallback(y=>{a&&(_(R=>Hb(R,y)),a.callback(y))},[a]),w=mt.useCallback(y=>{r==null||r.socket.emit("chat_settings_change",y)},[r==null?void 0:r.socket]),I=mt.useCallback(()=>{_(y=>y.map(R=>(R.streaming=!1,R))),s(!1),r==null||r.socket.emit("stop")},[r==null?void 0:r.socket]),S=mt.useCallback(y=>{let R=r==null?void 0:r.socket;if(!R)return;let L=new Promise((D,F)=>{R.once("action_response",M=>{M.status?D(M):F(M)})});return R.emit("action_call",y),L},[r==null?void 0:r.socket]);return{uploadFile:mt.useCallback((y,R)=>e.uploadFile(y,R,u,t),[u,t]),callAction:S,clear:d,replyMessage:C,sendMessage:f,editMessage:v,sendAudioChunk:m,endAudioStream:p,stopTask:I,setIdToResume:x,updateChatSettings:w}},op=()=>{let e=as(cE),t=as(h6);return{threadId:as(KP),messages:e,firstInteraction:t}},Eg=()=>{let e=mt.useContext(Rc),t=as(HP),[r,a]=hu($P),u=Q5(YP),A=Yo(h6),c=Yo(VP),g=Yo(cE),n=Yo(f6),s=Yo(ite),_=Yo(WP),o=Yo(jP),T=Yo(GP),E=Yo(d6),h=Yo(ate),[x,l]=hu(l8e),i=as(rte),[d,f]=hu(KP);mt.useEffect(()=>{r!=null&&r.socket&&(r.socket.io.opts.extraHeaders["X-Chainlit-Thread-Id"]=d||"")},[d]);let v=mt.useCallback(({userEnv:C,accessToken:w})=>{let{protocol:I,host:S,pathname:y}=new URL(e.httpEndpoint),R=`${I}//${S}`,L=y&&y!=="/"?`${y}/ws/socket.io`:"/ws/socket.io",D=c6(R,{path:L,extraHeaders:{Authorization:w||"","X-Chainlit-Client-Type":e.type,"X-Chainlit-Session-Id":t,"X-Chainlit-Thread-Id":i||"","user-env":JSON.stringify(C),"X-Chainlit-Chat-Profile":x?encodeURIComponent(x):""}});a(F=>{var M,k;return(M=F==null?void 0:F.socket)==null||M.removeAllListeners(),(k=F==null?void 0:F.socket)==null||k.close(),{socket:D}}),D.on("connect",()=>{D.emit("connection_successful"),a(F=>({...F,error:!1}))}),D.on("connect_error",F=>{a(M=>({...M,error:!0}))}),D.on("task_start",()=>{c(!0)}),D.on("task_end",()=>{c(!1)}),D.on("reload",()=>{D.emit("clear_session"),window.location.reload()}),D.on("resume_thread",F=>{var O,b;let M=[];for(let P of F.steps)M=Hb(M,P);(O=F.metadata)!=null&&O.chat_profile&&l((b=F.metadata)==null?void 0:b.chat_profile),g(M);let k=F.elements||[];o(k.filter(P=>P.type==="tasklist")),_(k.filter(P=>["avatar","tasklist"].indexOf(P.type)===-1))}),D.on("new_message",F=>{g(M=>Hb(M,F))}),D.on("first_interaction",F=>{A(F.interaction),f(F.thread_id)}),D.on("update_message",F=>{g(M=>$b(M,F.id,F))}),D.on("delete_message",F=>{g(M=>cte(M,F.id))}),D.on("stream_start",F=>{g(M=>Hb(M,F))}),D.on("stream_token",({id:F,token:M,isSequence:k,isInput:O})=>{g(b=>fte(b,F,M,k,O))}),D.on("ask",({msg:F,spec:M},k)=>{n({spec:M,callback:k}),g(O=>Hb(O,F)),c(!1)}),D.on("ask_timeout",()=>{n(void 0),c(!1)}),D.on("clear_ask",()=>{n(void 0)}),D.on("call_fn",({name:F,args:M},k)=>{s({name:F,args:M,callback:k})}),D.on("clear_call_fn",()=>{s(void 0)}),D.on("call_fn_timeout",()=>{s(void 0)}),D.on("chat_settings",F=>{E(F),u()}),D.on("element",F=>{!F.url&&F.chainlitKey&&(F.url=e.getElementUrl(F.chainlitKey,t)),F.type==="tasklist"?o(M=>{let k=M.findIndex(O=>O.id===F.id);return k===-1?[...M,F]:[...M.slice(0,k),F,...M.slice(k+1)]}):_(M=>{let k=M.findIndex(O=>O.id===F.id);return k===-1?[...M,F]:[...M.slice(0,k),F,...M.slice(k+1)]})}),D.on("remove_element",F=>{_(M=>M.filter(k=>k.id!==F.id)),o(M=>M.filter(k=>k.id!==F.id))}),D.on("action",F=>{T(M=>[...M,F])}),D.on("remove_action",F=>{T(M=>{let k=M.findIndex(O=>O.id===F.id);return k===-1?M:[...M.slice(0,k),...M.slice(k+1)]})}),D.on("token_usage",F=>{h(M=>M+F)})},[a,t,x]),m=mt.useCallback(oE.debounce(v,200),[v]),p=mt.useCallback(()=>{r!=null&&r.socket&&(r.socket.removeAllListeners(),r.socket.close())},[r]);return{connect:m,disconnect:p,session:r,sessionId:t,chatProfile:x,idToResume:i,setChatProfile:l}},m8e={enabled:!0,min_decibels:-45,initial_silence_timeout:3e3,silence_timeout:1500,max_duration:15e3,chunk_duration:1e3},g8e=(e=m8e)=>{let t=mt.useRef(null),r=mt.useRef(!1),{sendAudioChunk:a,endAudioStream:u}=Xu(),[A,c]=mt.useState(!1),[g,n]=mt.useState(void 0),[s,_]=mt.useState(!1),[o,T]=mt.useState(void 0),[E,h]=mt.useState(!1),x=mt.useCallback(()=>{!A||!t.current||(r.current=!0,t.current.stop())},[A]),l=mt.useCallback(()=>{!A||!t.current||t.current.stop()},[A]);return{startRecording:mt.useCallback(i=>{if(A||!e)return;h(!1),T(void 0),clearTimeout(g),r.current=!1;let{min_decibels:d,silence_timeout:f,initial_silence_timeout:v,chunk_duration:m,max_duration:p}=e;navigator.mediaDevices.getUserMedia({audio:!0}).then(C=>{let w=!1,I=!1,S=!0,y=null,R=Date.now(),L=new MediaRecorder(C);t.current=L,L.addEventListener("start",()=>{c(!0),R=Date.now()}),L.addEventListener("dataavailable",async P=>{if(w||(y?y=new Blob([y,P.data],{type:P.data.type}):y=new Blob([P.data],{type:P.data.type})),L.state==="inactive")return;let N=Date.now()-R;if(N>=p){L.stop(),C.getTracks().forEach(Y=>Y.stop());return}_(I);let[U,B]=L.mimeType.split(";");y?(await a(S,U,N,new Blob([y,P.data])),y=null):await a(S,U,N,P.data),S&&(S=!1)}),L.addEventListener("stop",async()=>{c(!1),_(!1),w&&!r.current&&(h(!0),await u(i))});let D=new AudioContext,F=D.createMediaStreamSource(C),M=D.createAnalyser();M.minDecibels=d,F.connect(M);let k=M.frequencyBinCount,O=new Uint8Array(k);L.start(m);let b=()=>{if(L.state==="inactive")return;M.getByteFrequencyData(O);let P=O.some(N=>N>0);I||(I=P),!w&&P&&(_(I),w=!0),requestAnimationFrame(b)};b(),setTimeout(()=>{w?n(setInterval(()=>{I?I=!1:(L.stop(),C.getTracks().forEach(P=>P.stop()))},f)):(L.stop(),C.getTracks().forEach(P=>P.stop()))},v)}).catch(C=>{T(C.message)})},[g,A,e,a,u]),stopRecording:l,cancelRecording:x,isRecording:A,isSpeaking:s,isRecordingFinished:E,error:o}},xl=e=>{let[t,r]=hu(c8e),{isAuthenticated:a}=s0(),u=navigator.language||"en-US",{data:A,error:c,isLoading:g}=v6(!t&&a?`/project/settings?language=${u}`:null,{token:e});return mt.useEffect(()=>{A&&r(A)},[A,r]),{config:t,error:c,isLoading:g,language:u}};function y8e(e){const t=e,r=()=>{lv.error("Unauthorized")},a=u=>{lv.error(u.toString())};return new pte(t,"copilot",r,a)}const b8e={accessToken:void 0},m6=mt.createContext(b8e);let g6;const _8e=new Uint8Array(16);function x8e(){if(!g6&&(g6=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!g6))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return g6(_8e)}const af=[];for(let e=0;e<256;++e)af.push((e+256).toString(16).slice(1));function E8e(e,t=0){return(af[e[t+0]]+af[e[t+1]]+af[e[t+2]]+af[e[t+3]]+"-"+af[e[t+4]]+af[e[t+5]]+"-"+af[e[t+6]]+af[e[t+7]]+"-"+af[e[t+8]]+af[e[t+9]]+"-"+af[e[t+10]]+af[e[t+11]]+af[e[t+12]]+af[e[t+13]]+af[e[t+14]]+af[e[t+15]]).toLowerCase()}const vte={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ZP(e,t,r){if(vte.randomUUID&&!t&&!e)return vte.randomUUID();e=e||{};const a=e.random||(e.rng||x8e)();return a[6]=a[6]&15|64,a[8]=a[8]&63|128,E8e(a)}const Q2={black:"#000",white:"#fff"},dE={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},hE={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},pE={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},vE={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},mE={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},Z2={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},mte={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function Sg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function gte(e){if(!Sg(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=gte(e[r])}),t}function Of(e,t,r={clone:!0}){const a=r.clone?lr({},e):e;return Sg(e)&&Sg(t)&&Object.keys(t).forEach(u=>{u!=="__proto__"&&(Sg(t[u])&&u in e&&Sg(e[u])?a[u]=Of(e[u],t[u],r):r.clone?a[u]=Sg(t[u])?gte(t[u]):t[u]:a[u]=t[u])}),a}function Y1(e){let t="https://mui.com/production-error/?code="+e;for(let r=1;r<arguments.length;r+=1)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified MUI error #"+e+"; visit "+t+" for the full message."}var Gs={};/**
85
+ */var sE=mt;function DRe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var PRe=typeof Object.is=="function"?Object.is:DRe,kRe=sE.useState,FRe=sE.useEffect,BRe=sE.useLayoutEffect,zRe=sE.useDebugValue;function URe(e,t){var r=t(),a=kRe({inst:{value:r,getSnapshot:t}}),u=a[0].inst,A=a[1];return BRe(function(){u.value=r,u.getSnapshot=t,pP(u)&&A({inst:u})},[e,r,t]),FRe(function(){return pP(u)&&A({inst:u}),e(function(){pP(u)&&A({inst:u})})},[e]),zRe(r),r}function pP(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!PRe(e,r)}catch{return!0}}function HRe(e,t){return t()}var $Re=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?HRe:URe;_ee.useSyncExternalStore=sE.useSyncExternalStore!==void 0?sE.useSyncExternalStore:$Re,bee.exports=_ee;var GRe=bee.exports;const G1=()=>{},qd=G1(),vP=Object,_s=e=>e===qd,_g=e=>typeof e=="function",V1=(e,t)=>({...e,...t}),VRe=e=>_g(e.then),e6=new WeakMap;let YRe=0;const V2=e=>{const t=typeof e,r=e&&e.constructor,a=r==Date;let u,A;if(vP(e)===e&&!a&&r!=RegExp){if(u=e6.get(e),u)return u;if(u=++YRe+"~",e6.set(e,u),r==Array){for(u="@",A=0;A<e.length;A++)u+=V2(e[A])+",";e6.set(e,u)}if(r==vP){u="#";const c=vP.keys(e).sort();for(;!_s(A=c.pop());)_s(e[A])||(u+=A+":"+V2(e[A])+",");e6.set(e,u)}}else u=a?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return u},xg=new WeakMap,mP={},t6={},gP="undefined",r6=typeof window!=gP,yP=typeof document!=gP,WRe=()=>r6&&typeof window.requestAnimationFrame!=gP,xee=(e,t)=>{const r=xg.get(e);return[()=>!_s(t)&&e.get(t)||mP,a=>{if(!_s(t)){const u=e.get(t);t in t6||(t6[t]=u),r[5](t,V1(u,a),u||mP)}},r[6],()=>!_s(t)&&t in t6?t6[t]:!_s(t)&&e.get(t)||mP]};let bP=!0;const jRe=()=>bP,[_P,xP]=r6&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[G1,G1],KRe=()=>{const e=yP&&document.visibilityState;return _s(e)||e!=="hidden"},XRe=e=>(yP&&document.addEventListener("visibilitychange",e),_P("focus",e),()=>{yP&&document.removeEventListener("visibilitychange",e),xP("focus",e)}),QRe=e=>{const t=()=>{bP=!0,e()},r=()=>{bP=!1};return _P("online",t),_P("offline",r),()=>{xP("online",t),xP("offline",r)}},ZRe={isOnline:jRe,isVisible:KRe},JRe={initFocus:XRe,initReconnect:QRe},Eee=!Xn.useId,Y2=!r6||"Deno"in window,qRe=e=>WRe()?window.requestAnimationFrame(e):setTimeout(e,1),EP=Y2?mt.useEffect:mt.useLayoutEffect,SP=typeof navigator<"u"&&navigator.connection,See=!Y2&&SP&&(["slow-2g","2g"].includes(SP.effectiveType)||SP.saveData),TP=e=>{if(_g(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?V2(e):"",[e,t]};let eMe=0;const wP=()=>++eMe,Tee=0,wee=1,Aee=2;var W2={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Tee,MUTATE_EVENT:Aee,RECONNECT_EVENT:wee};async function Cee(...e){const[t,r,a,u]=e,A=V1({populateCache:!0,throwOnError:!0},typeof u=="boolean"?{revalidate:u}:u||{});let c=A.populateCache;const g=A.rollbackOnError;let n=A.optimisticData;const s=A.revalidate!==!1,_=E=>typeof g=="function"?g(E):g!==!1,o=A.throwOnError;if(_g(r)){const E=r,h=[],x=t.keys();for(const l of x)!/^\$(inf|sub)\$/.test(l)&&E(t.get(l)._k)&&h.push(l);return Promise.all(h.map(T))}return T(r);async function T(E){const[h]=TP(E);if(!h)return;const[x,l]=xee(t,h),[i,d,f,v]=xg.get(t),m=()=>{const D=i[h];return s&&(delete f[h],delete v[h],D&&D[0])?D[0](Aee).then(()=>x().data):x().data};if(e.length<3)return m();let p=a,C;const w=wP();d[h]=[w,0];const I=!_s(n),S=x(),y=S.data,R=S._c,L=_s(R)?y:R;if(I&&(n=_g(n)?n(L,y):n,l({data:n,_c:L})),_g(p))try{p=p(L)}catch(D){C=D}if(p&&VRe(p))if(p=await p.catch(D=>{C=D}),w!==d[h][0]){if(C)throw C;return p}else C&&I&&_(C)&&(c=!0,l({data:L,_c:qd}));if(c&&!C)if(_g(c)){const D=c(p,L);l({data:D,error:qd,_c:qd})}else l({data:p,error:qd,_c:qd});if(d[h][1]=wP(),Promise.resolve(m()).then(()=>{l({_c:qd})}),C){if(o)throw C;return}return p}}const Ree=(e,t)=>{for(const r in e)e[r][0]&&e[r][0](t)},tMe=(e,t)=>{if(!xg.has(e)){const r=V1(JRe,t),a={},u=Cee.bind(qd,e);let A=G1;const c={},g=(_,o)=>{const T=c[_]||[];return c[_]=T,T.push(o),()=>T.splice(T.indexOf(o),1)},n=(_,o,T)=>{e.set(_,o);const E=c[_];if(E)for(const h of E)h(o,T)},s=()=>{if(!xg.has(e)&&(xg.set(e,[a,{},{},{},u,n,g]),!Y2)){const _=r.initFocus(setTimeout.bind(qd,Ree.bind(qd,a,Tee))),o=r.initReconnect(setTimeout.bind(qd,Ree.bind(qd,a,wee)));A=()=>{_&&_(),o&&o(),xg.delete(e)}}};return s(),[e,u,s,A]}return[e,xg.get(e)[4]]},rMe=(e,t,r,a,u)=>{const A=r.errorRetryCount,c=u.retryCount,g=~~((Math.random()+.5)*(1<<(c<8?c:8)))*r.errorRetryInterval;!_s(A)&&c>A||setTimeout(a,g,u)},nMe=(e,t)=>V2(e)==V2(t),[Mee,aMe]=tMe(new Map),iMe=V1({onLoadingSlow:G1,onSuccess:G1,onError:G1,onErrorRetry:rMe,onDiscarded:G1,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:See?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:See?5e3:3e3,compare:nMe,isPaused:()=>!1,cache:Mee,mutate:aMe,fallback:{}},ZRe),oMe=(e,t)=>{const r=V1(e,t);if(t){const{use:a,fallback:u}=e,{use:A,fallback:c}=t;a&&A&&(r.use=a.concat(A)),u&&c&&(r.fallback=V1(u,c))}return r},sMe=mt.createContext({}),lMe="$inf$",Iee=r6&&window.__SWR_DEVTOOLS_USE__,uMe=Iee?window.__SWR_DEVTOOLS_USE__:[],cMe=()=>{Iee&&(window.__SWR_DEVTOOLS_REACT__=Xn)},fMe=e=>_g(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],dMe=()=>V1(iMe,mt.useContext(sMe)),hMe=e=>(t,r,a)=>e(t,r&&((...A)=>{const[c]=TP(t),[,,,g]=xg.get(Mee);if(c.startsWith(lMe))return r(...A);const n=g[c];return _s(n)?r(...A):(delete g[c],n)}),a),pMe=uMe.concat(hMe),vMe=e=>function(...r){const a=dMe(),[u,A,c]=fMe(r),g=oMe(a,c);let n=e;const{use:s}=g,_=(s||[]).concat(pMe);for(let o=_.length;o--;)n=_[o](n);return n(u,A||g.fetcher||null,g)},mMe=(e,t,r)=>{const a=t[e]||(t[e]=[]);return a.push(r),()=>{const u=a.indexOf(r);u>=0&&(a[u]=a[a.length-1],a.pop())}};cMe();const Oee=Xn.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),AP={dedupe:!0},gMe=vMe((e,t,r)=>{const{cache:a,compare:u,suspense:A,fallbackData:c,revalidateOnMount:g,revalidateIfStale:n,refreshInterval:s,refreshWhenHidden:_,refreshWhenOffline:o,keepPreviousData:T}=r,[E,h,x,l]=xg.get(a),[i,d]=TP(e),f=mt.useRef(!1),v=mt.useRef(!1),m=mt.useRef(i),p=mt.useRef(t),C=mt.useRef(r),w=()=>C.current,I=()=>w().isVisible()&&w().isOnline(),[S,y,R,L]=xee(a,i),D=mt.useRef({}).current,F=_s(c)?r.fallback[i]:c,M=(ae,oe)=>{for(const he in D){const q=he;if(q==="data"){if(!u(ae[q],oe[q])&&(!_s(ae[q])||!u($,oe[q])))return!1}else if(oe[q]!==ae[q])return!1}return!0},k=mt.useMemo(()=>{const ae=!i||!t?!1:_s(g)?w().isPaused()||A?!1:_s(n)?!0:n:g,oe=re=>{const fe=V1(re);return delete fe._k,ae?{isValidating:!0,isLoading:!0,...fe}:fe},he=S(),q=L(),J=oe(he),le=he===q?J:oe(q);let Z=J;return[()=>{const re=oe(S());return M(re,Z)?(Z.data=re.data,Z.isLoading=re.isLoading,Z.isValidating=re.isValidating,Z.error=re.error,Z):(Z=re,re)},()=>le]},[a,i]),O=GRe.useSyncExternalStore(mt.useCallback(ae=>R(i,(oe,he)=>{M(he,oe)||ae()}),[a,i]),k[0],k[1]),b=!f.current,P=E[i]&&E[i].length>0,N=O.data,U=_s(N)?F:N,B=O.error,Y=mt.useRef(U),$=T?_s(N)?Y.current:N:U,G=P&&!_s(B)?!1:b&&!_s(g)?g:w().isPaused()?!1:A?_s(U)?!1:n:_s(U)||n,W=!!(i&&t&&b&&G),V=_s(O.isValidating)?W:O.isValidating,j=_s(O.isLoading)?W:O.isLoading,X=mt.useCallback(async ae=>{const oe=p.current;if(!i||!oe||v.current||w().isPaused())return!1;let he,q,J=!0;const le=ae||{},Z=!x[i]||!le.dedupe,re=()=>Eee?!v.current&&i===m.current&&f.current:i===m.current,fe={isValidating:!1,isLoading:!1},ne=()=>{y(fe)},Q=()=>{const ie=x[i];ie&&ie[1]===q&&delete x[i]},de={isValidating:!0};_s(S().data)&&(de.isLoading=!0);try{if(Z&&(y(de),r.loadingTimeout&&_s(S().data)&&setTimeout(()=>{J&&re()&&w().onLoadingSlow(i,r)},r.loadingTimeout),x[i]=[oe(d),wP()]),[he,q]=x[i],he=await he,Z&&setTimeout(Q,r.dedupingInterval),!x[i]||x[i][1]!==q)return Z&&re()&&w().onDiscarded(i),!1;fe.error=qd;const ie=h[i];if(!_s(ie)&&(q<=ie[0]||q<=ie[1]||ie[1]===0))return ne(),Z&&re()&&w().onDiscarded(i),!1;const ce=S().data;fe.data=u(ce,he)?ce:he,Z&&re()&&w().onSuccess(he,i,r)}catch(ie){Q();const ce=w(),{shouldRetryOnError:me}=ce;ce.isPaused()||(fe.error=ie,Z&&re()&&(ce.onError(ie,i,ce),(me===!0||_g(me)&&me(ie))&&I()&&ce.onErrorRetry(ie,i,ce,Se=>{const Ee=E[i];Ee&&Ee[0]&&Ee[0](W2.ERROR_REVALIDATE_EVENT,Se)},{retryCount:(le.retryCount||0)+1,dedupe:!0})))}return J=!1,ne(),!0},[i,a]),te=mt.useCallback((...ae)=>Cee(a,m.current,...ae),[]);if(EP(()=>{p.current=t,C.current=r,_s(N)||(Y.current=N)}),EP(()=>{if(!i)return;const ae=X.bind(qd,AP);let oe=0;const q=mMe(i,E,(J,le={})=>{if(J==W2.FOCUS_EVENT){const Z=Date.now();w().revalidateOnFocus&&Z>oe&&I()&&(oe=Z+w().focusThrottleInterval,ae())}else if(J==W2.RECONNECT_EVENT)w().revalidateOnReconnect&&I()&&ae();else{if(J==W2.MUTATE_EVENT)return X();if(J==W2.ERROR_REVALIDATE_EVENT)return X(le)}});return v.current=!1,m.current=i,f.current=!0,y({_k:d}),G&&(_s(U)||Y2?ae():qRe(ae)),()=>{v.current=!0,q()}},[i]),EP(()=>{let ae;function oe(){const q=_g(s)?s(S().data):s;q&&ae!==-1&&(ae=setTimeout(he,q))}function he(){!S().error&&(_||w().isVisible())&&(o||w().isOnline())?X(AP).then(oe):oe()}return oe(),()=>{ae&&(clearTimeout(ae),ae=-1)}},[s,_,o,i]),mt.useDebugValue($),A&&_s(U)&&i){if(!Eee&&Y2)throw new Error("Fallback data is required when using suspense in SSR.");p.current=t,C.current=r,v.current=!1;const ae=l[i];if(!_s(ae)){const oe=te(ae);Oee(oe)}if(_s(B)){const oe=X(AP);_s($)||(oe.status="fulfilled",oe.value=!0),Oee(oe)}else throw B}return{mutate:te,get data(){return D.data=!0,$},get error(){return D.error=!0,B},get isValidating(){return D.isValidating=!0,V},get isLoading(){return D.isLoading=!0,j}}}),fm=Object.create(null);fm.open="0",fm.close="1",fm.ping="2",fm.pong="3",fm.message="4",fm.upgrade="5",fm.noop="6";const n6=Object.create(null);Object.keys(fm).forEach(e=>{n6[fm[e]]=e});const CP={type:"error",data:"parser error"},Nee=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Lee=typeof ArrayBuffer=="function",Dee=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,RP=({type:e,data:t},r,a)=>Nee&&t instanceof Blob?r?a(t):Pee(t,a):Lee&&(t instanceof ArrayBuffer||Dee(t))?r?a(t):Pee(new Blob([t]),a):a(fm[e]+(t||"")),Pee=(e,t)=>{const r=new FileReader;return r.onload=function(){const a=r.result.split(",")[1];t("b"+(a||""))},r.readAsDataURL(e)};function kee(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let MP;function yMe(e,t){if(Nee&&e.data instanceof Blob)return e.data.arrayBuffer().then(kee).then(t);if(Lee&&(e.data instanceof ArrayBuffer||Dee(e.data)))return t(kee(e.data));RP(e,!1,r=>{MP||(MP=new TextEncoder),t(MP.encode(r))})}const Fee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Fee.length;e++)j2[Fee.charCodeAt(e)]=e;const bMe=e=>{let t=e.length*.75,r=e.length,a,u=0,A,c,g,n;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const s=new ArrayBuffer(t),_=new Uint8Array(s);for(a=0;a<r;a+=4)A=j2[e.charCodeAt(a)],c=j2[e.charCodeAt(a+1)],g=j2[e.charCodeAt(a+2)],n=j2[e.charCodeAt(a+3)],_[u++]=A<<2|c>>4,_[u++]=(c&15)<<4|g>>2,_[u++]=(g&3)<<6|n&63;return s},_Me=typeof ArrayBuffer=="function",IP=(e,t)=>{if(typeof e!="string")return{type:"message",data:Bee(e,t)};const r=e.charAt(0);return r==="b"?{type:"message",data:xMe(e.substring(1),t)}:n6[r]?e.length>1?{type:n6[r],data:e.substring(1)}:{type:n6[r]}:CP},xMe=(e,t)=>{if(_Me){const r=bMe(e);return Bee(r,t)}else return{base64:!0,data:e}},Bee=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},zee="",EMe=(e,t)=>{const r=e.length,a=new Array(r);let u=0;e.forEach((A,c)=>{RP(A,!1,g=>{a[c]=g,++u===r&&t(a.join(zee))})})},SMe=(e,t)=>{const r=e.split(zee),a=[];for(let u=0;u<r.length;u++){const A=IP(r[u],t);if(a.push(A),A.type==="error")break}return a};function TMe(){return new TransformStream({transform(e,t){yMe(e,r=>{const a=r.length;let u;if(a<126)u=new Uint8Array(1),new DataView(u.buffer).setUint8(0,a);else if(a<65536){u=new Uint8Array(3);const A=new DataView(u.buffer);A.setUint8(0,126),A.setUint16(1,a)}else{u=new Uint8Array(9);const A=new DataView(u.buffer);A.setUint8(0,127),A.setBigUint64(1,BigInt(a))}e.data&&typeof e.data!="string"&&(u[0]|=128),t.enqueue(u),t.enqueue(r)})}})}let OP;function a6(e){return e.reduce((t,r)=>t+r.length,0)}function i6(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let a=0;for(let u=0;u<t;u++)r[u]=e[0][a++],a===e[0].length&&(e.shift(),a=0);return e.length&&a<e[0].length&&(e[0]=e[0].slice(a)),r}function wMe(e,t){OP||(OP=new TextDecoder);const r=[];let a=0,u=-1,A=!1;return new TransformStream({transform(c,g){for(r.push(c);;){if(a===0){if(a6(r)<1)break;const n=i6(r,1);A=(n[0]&128)===128,u=n[0]&127,u<126?a=3:u===126?a=1:a=2}else if(a===1){if(a6(r)<2)break;const n=i6(r,2);u=new DataView(n.buffer,n.byteOffset,n.length).getUint16(0),a=3}else if(a===2){if(a6(r)<8)break;const n=i6(r,8),s=new DataView(n.buffer,n.byteOffset,n.length),_=s.getUint32(0);if(_>Math.pow(2,21)-1){g.enqueue(CP);break}u=_*Math.pow(2,32)+s.getUint32(4),a=3}else{if(a6(r)<u)break;const n=i6(r,u);g.enqueue(IP(A?n:OP.decode(n),t)),a=0}if(u===0||u>e){g.enqueue(CP);break}}}})}const Uee=4;function Ku(e){if(e)return AMe(e)}function AMe(e){for(var t in Ku.prototype)e[t]=Ku.prototype[t];return e}Ku.prototype.on=Ku.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Ku.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},Ku.prototype.off=Ku.prototype.removeListener=Ku.prototype.removeAllListeners=Ku.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var a,u=0;u<r.length;u++)if(a=r[u],a===t||a.fn===t){r.splice(u,1);break}return r.length===0&&delete this._callbacks["$"+e],this},Ku.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],a=1;a<arguments.length;a++)t[a-1]=arguments[a];if(r){r=r.slice(0);for(var a=0,u=r.length;a<u;++a)r[a].apply(this,t)}return this},Ku.prototype.emitReserved=Ku.prototype.emit,Ku.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Ku.prototype.hasListeners=function(e){return!!this.listeners(e).length};const o0=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Hee(e,...t){return t.reduce((r,a)=>(e.hasOwnProperty(a)&&(r[a]=e[a]),r),{})}const CMe=o0.setTimeout,RMe=o0.clearTimeout;function o6(e,t){t.useNativeTimers?(e.setTimeoutFn=CMe.bind(o0),e.clearTimeoutFn=RMe.bind(o0)):(e.setTimeoutFn=o0.setTimeout.bind(o0),e.clearTimeoutFn=o0.clearTimeout.bind(o0))}const MMe=1.33;function IMe(e){return typeof e=="string"?OMe(e):Math.ceil((e.byteLength||e.size)*MMe)}function OMe(e){let t=0,r=0;for(let a=0,u=e.length;a<u;a++)t=e.charCodeAt(a),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(a++,r+=4);return r}function NMe(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}function LMe(e){let t={},r=e.split("&");for(let a=0,u=r.length;a<u;a++){let A=r[a].split("=");t[decodeURIComponent(A[0])]=decodeURIComponent(A[1])}return t}class DMe extends Error{constructor(t,r,a){super(t),this.description=r,this.context=a,this.type="TransportError"}}class NP extends Ku{constructor(t){super(),this.writable=!1,o6(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,r,a){return super.emitReserved("error",new DMe(t,r,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const r=IP(t,this.socket.binaryType);this.onPacket(r)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,r={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const r=NMe(t);return r.length?"?"+r:""}}const $ee="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),LP=64,PMe={};let Gee=0,s6=0,Vee;function Yee(e){let t="";do t=$ee[e%LP]+t,e=Math.floor(e/LP);while(e>0);return t}function Wee(){const e=Yee(+new Date);return e!==Vee?(Gee=0,Vee=e):e+"."+Yee(Gee++)}for(;s6<LP;s6++)PMe[$ee[s6]]=s6;let jee=!1;try{jee=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const kMe=jee;function Kee(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||kMe))return new XMLHttpRequest}catch{}if(!t)try{return new o0[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function eNt(){}function FMe(){}const BMe=function(){return new Kee({xdomain:!1}).responseType!=null}();class zMe extends NP{constructor(t){if(super(t),this.polling=!1,typeof location<"u"){const a=location.protocol==="https:";let u=location.port;u||(u=a?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||u!==t.port}const r=t&&t.forceBase64;this.supportsBinary=BMe&&!r,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const r=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let a=0;this.polling&&(a++,this.once("pollComplete",function(){--a||r()})),this.writable||(a++,this.once("drain",function(){--a||r()}))}else r()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};SMe(t,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,EMe(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=Wee()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new lE(this.uri(),t)}doWrite(t,r){const a=this.request({method:"POST",data:t});a.on("success",r),a.on("error",(u,A)=>{this.onError("xhr post error",u,A)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,a)=>{this.onError("xhr poll error",r,a)}),this.pollXhr=t}}let lE=class oN extends Ku{constructor(t,r){super(),o6(this,r),this.opts=r,this.method=r.method||"GET",this.uri=t,this.data=r.data!==void 0?r.data:null,this.create()}create(){var t;const r=Hee(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this.opts.xd;const a=this.xhr=new Kee(r);try{a.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let u in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(u)&&a.setRequestHeader(u,this.opts.extraHeaders[u])}}catch{}if(this.method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(a),"withCredentials"in a&&(a.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(a.timeout=this.opts.requestTimeout),a.onreadystatechange=()=>{var u;a.readyState===3&&((u=this.opts.cookieJar)===null||u===void 0||u.parseCookies(a)),a.readyState===4&&(a.status===200||a.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof a.status=="number"?a.status:0)},0))},a.send(this.data)}catch(u){this.setTimeoutFn(()=>{this.onError(u)},0);return}typeof document<"u"&&(this.index=oN.requestsCount++,oN.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=FMe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete oN.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};if(lE.requestsCount=0,lE.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xee);else if(typeof addEventListener=="function"){const e="onpagehide"in o0?"pagehide":"unload";addEventListener(e,Xee,!1)}}function Xee(){for(let e in lE.requests)lE.requests.hasOwnProperty(e)&&lE.requests[e].abort()}const DP=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),l6=o0.WebSocket||o0.MozWebSocket,Qee=!0,UMe="arraybuffer",Zee=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class HMe extends NP{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),r=this.opts.protocols,a=Zee?{}:Hee(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=Qee&&!Zee?r?new l6(t,r):new l6(t):new l6(t,r,a)}catch(u){return this.emitReserved("error",u)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const a=t[r],u=r===t.length-1;RP(a,this.supportsBinary,A=>{const c={};try{Qee&&this.ws.send(A)}catch{}u&&DP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=Wee()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}check(){return!!l6}}class $Me extends NP{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const r=wMe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=t.readable.pipeThrough(r).getReader(),u=TMe();u.readable.pipeTo(t.writable),this.writer=u.writable.getWriter();const A=()=>{a.read().then(({done:g,value:n})=>{g||(this.onPacket(n),A())}).catch(g=>{})};A();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this.writer.write(c).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const a=t[r],u=r===t.length-1;this.writer.write(a).then(()=>{u&&DP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const GMe={websocket:HMe,webtransport:$Me,polling:zMe},VMe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,YMe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function PP(e){if(e.length>2e3)throw"URI too long";const t=e,r=e.indexOf("["),a=e.indexOf("]");r!=-1&&a!=-1&&(e=e.substring(0,r)+e.substring(r,a).replace(/:/g,";")+e.substring(a,e.length));let u=VMe.exec(e||""),A={},c=14;for(;c--;)A[YMe[c]]=u[c]||"";return r!=-1&&a!=-1&&(A.source=t,A.host=A.host.substring(1,A.host.length-1).replace(/;/g,":"),A.authority=A.authority.replace("[","").replace("]","").replace(/;/g,":"),A.ipv6uri=!0),A.pathNames=WMe(A,A.path),A.queryKey=jMe(A,A.query),A}function WMe(e,t){const r=/\/{2,9}/g,a=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&a.splice(0,1),t.slice(-1)=="/"&&a.splice(a.length-1,1),a}function jMe(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,u,A){u&&(r[u]=A)}),r}let Jee=class LT extends Ku{constructor(t,r={}){super(),this.binaryType=UMe,this.writeBuffer=[],t&&typeof t=="object"&&(r=t,t=null),t?(t=PP(t),r.hostname=t.host,r.secure=t.protocol==="https"||t.protocol==="wss",r.port=t.port,t.query&&(r.query=t.query)):r.host&&(r.hostname=PP(r.host).host),o6(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=r.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=LMe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=Uee,r.transport=t,this.id&&(r.sid=this.id);const a=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new GMe[t](a)}open(){let t;if(this.opts.rememberUpgrade&&LT.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",r=>this.onClose("transport close",r))}probe(t){let r=this.createTransport(t),a=!1;LT.priorWebsocketSuccess=!1;const u=()=>{a||(r.send([{type:"ping",data:"probe"}]),r.once("packet",o=>{if(!a)if(o.type==="pong"&&o.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;LT.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(_(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const T=new Error("probe error");T.transport=r.name,this.emitReserved("upgradeError",T)}}))};function A(){a||(a=!0,_(),r.close(),r=null)}const c=o=>{const T=new Error("probe error: "+o);T.transport=r.name,A(),this.emitReserved("upgradeError",T)};function g(){c("transport closed")}function n(){c("socket closed")}function s(o){r&&o.name!==r.name&&A()}const _=()=>{r.removeListener("open",u),r.removeListener("error",c),r.removeListener("close",g),this.off("close",n),this.off("upgrading",s)};r.once("open",u),r.once("error",c),r.once("close",g),this.once("close",n),this.once("upgrading",s),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{a||r.open()},200):r.open()}onOpen(){if(this.readyState="open",LT.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const r=this.upgrades.length;for(;t<r;t++)this.probe(this.upgrades[t])}}onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const r=new Error("server error");r.code=t.data,this.onError(r);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let a=0;a<this.writeBuffer.length;a++){const u=this.writeBuffer[a].data;if(u&&(r+=IMe(u)),a>0&&r>this.maxPayload)return this.writeBuffer.slice(0,a);r+=2}return this.writeBuffer}write(t,r,a){return this.sendPacket("message",t,r,a),this}send(t,r,a){return this.sendPacket("message",t,r,a),this}sendPacket(t,r,a,u){if(typeof r=="function"&&(u=r,r=void 0),typeof a=="function"&&(u=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const A={type:t,data:r,options:a};this.emitReserved("packetCreate",A),this.writeBuffer.push(A),u&&this.once("flush",u),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},a=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():t()}):this.upgrading?a():t()),this}onError(t){LT.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,r){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const r=[];let a=0;const u=t.length;for(;a<u;a++)~this.transports.indexOf(t[a])&&r.push(t[a]);return r}};Jee.protocol=Uee;function KMe(e,t="",r){let a=e;r=r||typeof location<"u"&&location,e==null&&(e=r.protocol+"//"+r.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=r.protocol+e:e=r.host+e),/^(https?|wss?):\/\//.test(e)||(typeof r<"u"?e=r.protocol+"//"+e:e="https://"+e),a=PP(e)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const A=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+A+":"+a.port+t,a.href=a.protocol+"://"+A+(r&&r.port===a.port?"":":"+a.port),a}const XMe=typeof ArrayBuffer=="function",QMe=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qee=Object.prototype.toString,ZMe=typeof Blob=="function"||typeof Blob<"u"&&qee.call(Blob)==="[object BlobConstructor]",JMe=typeof File=="function"||typeof File<"u"&&qee.call(File)==="[object FileConstructor]";function kP(e){return XMe&&(e instanceof ArrayBuffer||QMe(e))||ZMe&&e instanceof Blob||JMe&&e instanceof File}function u6(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let r=0,a=e.length;r<a;r++)if(u6(e[r]))return!0;return!1}if(kP(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return u6(e.toJSON(),!0);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&u6(e[r]))return!0;return!1}function qMe(e){const t=[],r=e.data,a=e;return a.data=FP(r,t),a.attachments=t.length,{packet:a,buffers:t}}function FP(e,t){if(!e)return e;if(kP(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}else if(Array.isArray(e)){const r=new Array(e.length);for(let a=0;a<e.length;a++)r[a]=FP(e[a],t);return r}else if(typeof e=="object"&&!(e instanceof Date)){const r={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=FP(e[a],t));return r}return e}function e8e(e,t){return e.data=BP(e.data,t),delete e.attachments,e}function BP(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=BP(e[r],t);else if(typeof e=="object")for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=BP(e[r],t));return e}const t8e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],r8e=5;var is;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(is||(is={}));class n8e{constructor(t){this.replacer=t}encode(t){return(t.type===is.EVENT||t.type===is.ACK)&&u6(t)?this.encodeAsBinary({type:t.type===is.EVENT?is.BINARY_EVENT:is.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===is.BINARY_EVENT||t.type===is.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const r=qMe(t),a=this.encodeAsString(r.packet),u=r.buffers;return u.unshift(a),u}}function ete(e){return Object.prototype.toString.call(e)==="[object Object]"}class zP extends Ku{constructor(t){super(),this.reviver=t}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const a=r.type===is.BINARY_EVENT;a||r.type===is.BINARY_ACK?(r.type=a?is.EVENT:is.ACK,this.reconstructor=new a8e(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(kP(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const a={type:Number(t.charAt(0))};if(is[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===is.BINARY_EVENT||a.type===is.BINARY_ACK){const A=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const c=t.substring(A,r);if(c!=Number(c)||t.charAt(r)!=="-")throw new Error("Illegal attachments");a.attachments=Number(c)}if(t.charAt(r+1)==="/"){const A=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););a.nsp=t.substring(A,r)}else a.nsp="/";const u=t.charAt(r+1);if(u!==""&&Number(u)==u){const A=r+1;for(;++r;){const c=t.charAt(r);if(c==null||Number(c)!=c){--r;break}if(r===t.length)break}a.id=Number(t.substring(A,r+1))}if(t.charAt(++r)){const A=this.tryParse(t.substr(r));if(zP.isPayloadValid(a.type,A))a.data=A;else throw new Error("invalid payload")}return a}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case is.CONNECT:return ete(r);case is.DISCONNECT:return r===void 0;case is.CONNECT_ERROR:return typeof r=="string"||ete(r);case is.EVENT:case is.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&t8e.indexOf(r[0])===-1);case is.ACK:case is.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class a8e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const r=e8e(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const i8e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:zP,Encoder:n8e,get PacketType(){return is},protocol:r8e},Symbol.toStringTag,{value:"Module"}));function cv(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const o8e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tte extends Ku{constructor(t,r,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=r,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[cv(t,"open",this.onopen.bind(this)),cv(t,"packet",this.onpacket.bind(this)),cv(t,"error",this.onerror.bind(this)),cv(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...r){if(o8e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const a={type:is.EVENT,data:r};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const c=this.ids++,g=r.pop();this._registerAckCallback(c,g),a.id=c}const u=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!u||!this.connected)||(this.connected?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(t,r){var a;const u=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(u===void 0){this.acks[t]=r;return}const A=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===t&&this.sendBuffer.splice(c,1);r.call(this,new Error("operation has timed out"))},u);this.acks[t]=(...c)=>{this.io.clearTimeoutFn(A),r.apply(this,[null,...c])}}emitWithAck(t,...r){const a=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((u,A)=>{r.push((c,g)=>a?c?A(c):u(g):u(c)),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((u,...A)=>a!==this._queue[0]?void 0:(u!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(u)):(this._queue.shift(),r&&r(null,...A)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:is.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case is.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case is.EVENT:case is.BINARY_EVENT:this.onevent(t);break;case is.ACK:case is.BINARY_ACK:this.onack(t);break;case is.DISCONNECT:this.ondisconnect();break;case is.CONNECT_ERROR:this.destroy();const a=new Error(t.data.message);a.data=t.data.data,this.emitReserved("connect_error",a);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const a of r)a.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const r=this;let a=!1;return function(...u){a||(a=!0,r.packet({type:is.ACK,id:t,data:u}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(r.apply(this,t.data),delete this.acks[t.id])}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:is.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const r=this._anyListeners;for(let a=0;a<r.length;a++)if(t===r[a])return r.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const r=this._anyOutgoingListeners;for(let a=0;a<r.length;a++)if(t===r[a])return r.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const a of r)a.apply(this,t.data)}}}function uE(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}uE.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0},uE.prototype.reset=function(){this.attempts=0},uE.prototype.setMin=function(e){this.ms=e},uE.prototype.setMax=function(e){this.max=e},uE.prototype.setJitter=function(e){this.jitter=e};class UP extends Ku{constructor(t,r){var a;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,o6(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((a=r.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new uE({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const u=r.parser||i8e;this.encoder=new u.Encoder,this.decoder=new u.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Jee(this.uri,this.opts);const r=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const u=cv(r,"open",function(){a.onopen(),t&&t()}),A=g=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",g),t?t(g):this.maybeReconnectOnOpen()},c=cv(r,"error",A);if(this._timeout!==!1){const g=this._timeout,n=this.setTimeoutFn(()=>{u(),A(new Error("timeout")),r.close()},g);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(u),this.subs.push(c),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(cv(t,"ping",this.onping.bind(this)),cv(t,"data",this.ondata.bind(this)),cv(t,"error",this.onerror.bind(this)),cv(t,"close",this.onclose.bind(this)),cv(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){DP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let a=this.nsps[t];return a?this._autoConnect&&!a.active&&a.connect():(a=new tte(this,t,r),this.nsps[t]=a),a}_destroy(t){const r=Object.keys(this.nsps);for(const a of r)if(this.nsps[a].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let a=0;a<r.length;a++)this.engine.write(r[a],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,r){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(u=>{u?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",u)):t.onreconnect()}))},r);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const K2={};function c6(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const r=KMe(e,t.path||"/socket.io"),a=r.source,u=r.id,A=r.path,c=K2[u]&&A in K2[u].nsps,g=t.forceNew||t["force new connection"]||t.multiplex===!1||c;let n;return g?n=new UP(a,t):(K2[u]||(K2[u]=new UP(a,t)),n=K2[u]),r.query&&!t.query&&(t.query=r.queryKey),n.socket(r.path,t)}Object.assign(c6,{Manager:UP,Socket:tte,io:c6,connect:c6});var s8e=e=>{let t={},r=new Date,a=new Date;a.setDate(r.getDate()-1);let u=new Date;u.setDate(r.getDate()-7);let A=new Date;return A.setDate(r.getDate()-30),e.forEach(c=>{let g=new Date(c.createdAt),n=g.toDateString()===r.toDateString(),s=g.toDateString()===a.toDateString(),_=g>=u,o=g>=A,T;n?T="Today":s?T="Yesterday":_?T="Previous 7 days":o?T="Previous 30 days":T=g.toLocaleString("default",{month:"long",year:"numeric"}).split(" ").slice(0,1).join(" "),t[T]||(t[T]=[]),t[T].push(c)}),t},rte=Bs({key:"ThreadIdToResume",default:void 0}),l8e=Bs({key:"ChatProfile",default:void 0}),nte=Bs({key:"SessionId",default:dP()}),HP=mee({key:"SessionIdSelector",get:({get:e})=>e(nte),set:({set:e},t)=>e(nte,t instanceof CRe?dP():t)}),$P=Bs({key:"Session",dangerouslyAllowMutability:!0,default:void 0}),GP=Bs({key:"Actions",default:[]}),cE=Bs({key:"Messages",dangerouslyAllowMutability:!0,default:[]}),ate=Bs({key:"TokenCount",default:0}),VP=Bs({key:"Loading",default:!1}),f6=Bs({key:"AskUser",default:void 0}),ite=Bs({key:"CallFn",default:void 0}),d6=Bs({key:"ChatSettings",default:[]}),ote=mee({key:"ChatSettingsValue/Default",get:({get:e})=>e(d6).reduce((t,r)=>(t[r.id]=r.initial,t),{})}),YP=Bs({key:"ChatSettingsValue",default:ote}),WP=Bs({key:"DisplayElements",default:[]}),jP=Bs({key:"TasklistElements",default:[]}),h6=Bs({key:"FirstUserInteraction",default:void 0}),Ub=Bs({key:"AccessToken",default:void 0}),u8e=Bs({key:"User",default:null}),c8e=Bs({key:"ChainlitConfig",default:void 0}),f8e=Bs({key:"AuthConfig",default:void 0}),X2=Bs({key:"ThreadHistory",default:{threads:void 0,currentThreadId:void 0,timeGroupedThreads:void 0,pageInfo:void 0},effects:[({setSelf:e,onSet:t})=>{t((r,a)=>{let u=r==null?void 0:r.timeGroupedThreads;r!=null&&r.threads&&!oE.isEqual(r.threads,a==null?void 0:a.timeGroupedThreads)&&(u=s8e(r.threads)),e({...r,timeGroupedThreads:u})})}]}),fE=Bs({key:"SideView",default:void 0}),KP=Bs({key:"CurrentThreadId",default:void 0}),fv=()=>{let e=as(VP),t=as(WP),r=as(jP),a=as(GP),u=as($P),A=as(f6),c=as(ite),g=as(d6),n=as(YP),s=as(ote),_=(u==null?void 0:u.socket.connected)&&!(u!=null&&u.error),o=!_||e||(A==null?void 0:A.spec.type)==="file"||(A==null?void 0:A.spec.type)==="action";return{actions:a,askUser:A,callFn:c,chatSettingsDefaultValue:s,chatSettingsInputs:g,chatSettingsValue:n,connected:_,disabled:o,elements:t,error:u==null?void 0:u.error,loading:e,tasklists:r}},d8e=e=>{let t=[];for(let r of e)t=Hb(t,r);return t},Hb=(e,t)=>p6(e,t.id)?$b(e,t.id,t):"parentId"in t&&t.parentId?lte(e,t.parentId,t):"indent"in t&&t.indent&&t.indent>0?ste(e,t.indent,t):[...e,t],ste=(e,t,r,a=0)=>{let u=[...e];if(u.length===0)return[...u,r];{let A=u.length-1,c=u[A];return c.steps=c.steps||[],a+1===t?(c.steps=[...c.steps,r],u[A]={...c},u):(c.steps=ste(c.steps,t,r,a+1),u[A]={...c},u)}},lte=(e,t,r)=>{let a=[...e];for(let u=0;u<a.length;u++){let A=a[u];oE.isEqual(A.id,t)?(A.steps=A.steps?[...A.steps,r]:[r],a[u]={...A}):p6(a,t)&&A.steps&&(A.steps=lte(A.steps,t,r),a[u]={...A})}return a},ute=(e,t)=>{for(let r of e){if(oE.isEqual(r.id,t))return r;if(r.steps&&r.steps.length>0){let a=ute(r.steps,t);if(a)return a}}},p6=(e,t)=>ute(e,t)!==void 0,$b=(e,t,r)=>{let a=[...e];for(let u=0;u<a.length;u++){let A=a[u];oE.isEqual(A.id,t)?a[u]={steps:A.steps,...r}:p6(a,t)&&A.steps&&(A.steps=$b(A.steps,t,r),a[u]={...A})}return a},cte=(e,t)=>{let r=[...e];for(let a=0;a<r.length;a++){let u=r[a];u.id===t?r=[...r.slice(0,a),...r.slice(a+1)]:p6(r,t)&&u.steps&&(u.steps=cte(u.steps,t),r[a]={...u})}return r},fte=(e,t,r,a,u)=>{let A=[...e];for(let c=0;c<A.length;c++){let g=A[c];oE.isEqual(g.id,t)?("content"in g&&g.content!==void 0?a?g.content=r:g.content+=r:u?"input"in g&&g.input!==void 0&&(a?g.input=r:g.input+=r):"output"in g&&g.output!==void 0&&(a?g.output=r:g.output+=r),A[c]={...g}):g.steps&&(g.steps=fte(g.steps,t,r,a,u),A[c]={...g})}return A},XP="token";function dte(){try{return localStorage.getItem(XP)}catch{return}}function h8e(e){try{return localStorage.setItem(XP,e)}catch{return}}function hte(){try{return localStorage.removeItem(XP)}catch{return}}var p8e=async(e,t,r)=>{var a;return(a=await e.get(t,r))==null?void 0:a.json()};function v6(e,{token:t,...r}={}){let a=mt.useContext(Rc),u=as(Ub);u=t||u;let A=mt.useMemo(()=>([g,n])=>p8e(a,g,n),[a]),c=mt.useMemo(()=>e?[e,u]:null,[e,u]);return gMe(c,A,r)}var s0=()=>{let e=mt.useContext(Rc),[t,r]=hu(f8e),[a,u]=hu(u8e),{data:A,isLoading:c}=v6(t?null:"/auth/config"),[g,n]=hu(Ub),s=Yo(X2);mt.useEffect(()=>{A&&r(A)},[A,r]);let _=!!(!c&&t),o=async(h=!1)=>{await e.logout(),u(null),hte(),n(""),s(void 0),h&&window.location.reload()},T=h=>{if(!h){o();return}try{let{exp:x,...l}=LRe(h);h8e(h),n(`Bearer ${h}`),u(l)}catch(x){console.error("Invalid token, clearing token from local storage","error:",x),o()}};mt.useEffect(()=>{if(!a&&dte()){T(dte());return}},[]);let E=!!g;return t&&!t.requireLogin?{authConfig:t,user:null,isReady:_,isAuthenticated:!0,accessToken:"",logout:()=>{},setAccessToken:()=>{}}:{data:t,user:a,isAuthenticated:E,isReady:_,accessToken:g,logout:o,setAccessToken:T}},QP=class extends Error{constructor(e,t){super(e),this.detail=t}toString(){return this.detail?`${this.message}: ${this.detail}`:this.message}},v8e=class{constructor(e,t,r,a){this.httpEndpoint=e,this.type=t,this.on401=r,this.onError=a}buildEndpoint(e){return this.httpEndpoint.endsWith("/")?`${this.httpEndpoint.slice(0,-1)}${e}`:`${this.httpEndpoint}${e}`}checkToken(e){let t="Bearer ";return e.startsWith(t)?e:t+e}async fetch(e,t,r,a,u){try{let A={};r&&(A.Authorization=this.checkToken(r));let c;a instanceof FormData?c=a:(A["Content-Type"]="application/json",c=a?JSON.stringify(a):null);let g=await fetch(this.buildEndpoint(t),{method:e,headers:A,signal:u,body:c});if(!g.ok){let n=await g.json();throw g.status===401&&this.on401&&(hte(),this.on401()),new QP(g.statusText,n.detail)}return g}catch(A){throw A instanceof QP&&this.onError&&this.onError(A),console.error(A),A}}async get(e,t){return await this.fetch("GET",e,t)}async post(e,t,r,a){return await this.fetch("POST",e,r,t,a)}async put(e,t,r){return await this.fetch("PUT",e,r,t)}async patch(e,t,r){return await this.fetch("PATCH",e,r,t)}async delete(e,t,r){return await this.fetch("DELETE",e,r,t)}},pte=class extends v8e{async headerAuth(){return(await this.post("/auth/header",{})).json()}async passwordAuth(e){return(await this.post("/login",e)).json()}async logout(){return(await this.post("/logout",{})).json()}async setFeedback(e,t){return(await this.put("/feedback",{feedback:e},t)).json()}async deleteFeedback(e,t){return(await this.delete("/feedback",{feedbackId:e},t)).json()}async listThreads(e,t,r){return(await this.post("/project/threads",{pagination:e,filter:t},r)).json()}async deleteThread(e,t){return(await this.delete("/project/thread",{threadId:e},t)).json()}uploadFile(e,t,r,a){let u=new XMLHttpRequest,A=new Promise((c,g)=>{let n=new FormData;n.append("file",e),u.open("POST",this.buildEndpoint(`/project/file?session_id=${r}`),!0),a&&u.setRequestHeader("Authorization",this.checkToken(a)),u.upload.onprogress=function(s){if(s.lengthComputable){let _=s.loaded/s.total*100;t(_)}},u.onload=function(){if(u.status===200){let s=JSON.parse(u.responseText);c(s)}else g("Upload failed")},u.onerror=function(){g("Upload error")},u.send(n)});return{xhr:u,promise:A}}getElementUrl(e,t){let r=`?session_id=${t}`;return this.buildEndpoint(`/project/file/${e}${r}`)}getLogoEndpoint(e){return this.buildEndpoint(`/logo?theme=${e}`)}getOAuthEndpoint(e){return this.buildEndpoint(`/auth/oauth/${e}`)}},Rc=mt.createContext(new pte("http://localhost:8000","webapp")),Xu=()=>{let e=mt.useContext(Rc),t=as(Ub),r=as($P),a=as(f6),u=as(HP),A=Q5(d6),c=Q5(HP),g=Q5(YP),n=Yo(h6),s=Yo(VP),_=Yo(cE),o=Yo(WP),T=Yo(jP),E=Yo(GP),h=Yo(ate),x=Yo(rte),l=Yo(fE),i=Yo(KP),d=mt.useCallback(()=>{r==null||r.socket.emit("clear_session"),r==null||r.socket.disconnect(),x(void 0),c(),n(void 0),_([]),o([]),T([]),E([]),h(0),A(),g(),l(void 0),i(void 0)},[r]),f=mt.useCallback((y,R=[])=>{y.id||(y.id=dP()),y.createdAt||(y.createdAt=new Date().toISOString()),_(L=>Hb(L,y)),r==null||r.socket.emit("client_message",{message:y,fileReferences:R})},[r==null?void 0:r.socket]),v=mt.useCallback(y=>{r==null||r.socket.emit("edit_message",{message:y})},[r==null?void 0:r.socket]),m=mt.useCallback((y,R,L,D)=>{r==null||r.socket.emit("audio_chunk",{isStart:y,mimeType:R,elapsedTime:L,data:D})},[r==null?void 0:r.socket]),p=mt.useCallback(y=>{r==null||r.socket.emit("audio_end",{fileReferences:y})},[r==null?void 0:r.socket]),C=mt.useCallback(y=>{a&&(a.parentId&&(y.parentId=a.parentId),_(R=>Hb(R,y)),a.callback(y))},[a]),w=mt.useCallback(y=>{r==null||r.socket.emit("chat_settings_change",y)},[r==null?void 0:r.socket]),I=mt.useCallback(()=>{_(y=>y.map(R=>(R.streaming=!1,R))),s(!1),r==null||r.socket.emit("stop")},[r==null?void 0:r.socket]),S=mt.useCallback(y=>{let R=r==null?void 0:r.socket;if(!R)return;let L=new Promise((D,F)=>{R.once("action_response",M=>{M.status?D(M):F(M)})});return R.emit("action_call",y),L},[r==null?void 0:r.socket]);return{uploadFile:mt.useCallback((y,R)=>e.uploadFile(y,R,u,t),[u,t]),callAction:S,clear:d,replyMessage:C,sendMessage:f,editMessage:v,sendAudioChunk:m,endAudioStream:p,stopTask:I,setIdToResume:x,updateChatSettings:w}},op=()=>{let e=as(cE),t=as(h6);return{threadId:as(KP),messages:e,firstInteraction:t}},Eg=()=>{let e=mt.useContext(Rc),t=as(HP),[r,a]=hu($P),u=Q5(YP),A=Yo(h6),c=Yo(VP),g=Yo(cE),n=Yo(f6),s=Yo(ite),_=Yo(WP),o=Yo(jP),T=Yo(GP),E=Yo(d6),h=Yo(ate),[x,l]=hu(l8e),i=as(rte),[d,f]=hu(KP);mt.useEffect(()=>{r!=null&&r.socket&&(r.socket.io.opts.extraHeaders["X-Chainlit-Thread-Id"]=d||"")},[d]);let v=mt.useCallback(({userEnv:C,accessToken:w})=>{let{protocol:I,host:S,pathname:y}=new URL(e.httpEndpoint),R=`${I}//${S}`,L=y&&y!=="/"?`${y}/ws/socket.io`:"/ws/socket.io",D=c6(R,{path:L,extraHeaders:{Authorization:w||"","X-Chainlit-Client-Type":e.type,"X-Chainlit-Session-Id":t,"X-Chainlit-Thread-Id":i||"","user-env":JSON.stringify(C),"X-Chainlit-Chat-Profile":x?encodeURIComponent(x):""}});a(F=>{var M,k;return(M=F==null?void 0:F.socket)==null||M.removeAllListeners(),(k=F==null?void 0:F.socket)==null||k.close(),{socket:D}}),D.on("connect",()=>{D.emit("connection_successful"),a(F=>({...F,error:!1}))}),D.on("connect_error",F=>{a(M=>({...M,error:!0}))}),D.on("task_start",()=>{c(!0)}),D.on("task_end",()=>{c(!1)}),D.on("reload",()=>{D.emit("clear_session"),window.location.reload()}),D.on("resume_thread",F=>{var O,b;let M=[];for(let P of F.steps)M=Hb(M,P);(O=F.metadata)!=null&&O.chat_profile&&l((b=F.metadata)==null?void 0:b.chat_profile),g(M);let k=F.elements||[];o(k.filter(P=>P.type==="tasklist")),_(k.filter(P=>["avatar","tasklist"].indexOf(P.type)===-1))}),D.on("new_message",F=>{g(M=>Hb(M,F))}),D.on("first_interaction",F=>{A(F.interaction),f(F.thread_id)}),D.on("update_message",F=>{g(M=>$b(M,F.id,F))}),D.on("delete_message",F=>{g(M=>cte(M,F.id))}),D.on("stream_start",F=>{g(M=>Hb(M,F))}),D.on("stream_token",({id:F,token:M,isSequence:k,isInput:O})=>{g(b=>fte(b,F,M,k,O))}),D.on("ask",({msg:F,spec:M},k)=>{n({spec:M,callback:k,parentId:F.parentId}),g(O=>Hb(O,F)),c(!1)}),D.on("ask_timeout",()=>{n(void 0),c(!1)}),D.on("clear_ask",()=>{n(void 0)}),D.on("call_fn",({name:F,args:M},k)=>{s({name:F,args:M,callback:k})}),D.on("clear_call_fn",()=>{s(void 0)}),D.on("call_fn_timeout",()=>{s(void 0)}),D.on("chat_settings",F=>{E(F),u()}),D.on("element",F=>{!F.url&&F.chainlitKey&&(F.url=e.getElementUrl(F.chainlitKey,t)),F.type==="tasklist"?o(M=>{let k=M.findIndex(O=>O.id===F.id);return k===-1?[...M,F]:[...M.slice(0,k),F,...M.slice(k+1)]}):_(M=>{let k=M.findIndex(O=>O.id===F.id);return k===-1?[...M,F]:[...M.slice(0,k),F,...M.slice(k+1)]})}),D.on("remove_element",F=>{_(M=>M.filter(k=>k.id!==F.id)),o(M=>M.filter(k=>k.id!==F.id))}),D.on("action",F=>{T(M=>[...M,F])}),D.on("remove_action",F=>{T(M=>{let k=M.findIndex(O=>O.id===F.id);return k===-1?M:[...M.slice(0,k),...M.slice(k+1)]})}),D.on("token_usage",F=>{h(M=>M+F)})},[a,t,x]),m=mt.useCallback(oE.debounce(v,200),[v]),p=mt.useCallback(()=>{r!=null&&r.socket&&(r.socket.removeAllListeners(),r.socket.close())},[r]);return{connect:m,disconnect:p,session:r,sessionId:t,chatProfile:x,idToResume:i,setChatProfile:l}},m8e={enabled:!0,min_decibels:-45,initial_silence_timeout:3e3,silence_timeout:1500,max_duration:15e3,chunk_duration:1e3},g8e=(e=m8e)=>{let t=mt.useRef(null),r=mt.useRef(!1),{sendAudioChunk:a,endAudioStream:u}=Xu(),[A,c]=mt.useState(!1),[g,n]=mt.useState(void 0),[s,_]=mt.useState(!1),[o,T]=mt.useState(void 0),[E,h]=mt.useState(!1),x=mt.useCallback(()=>{!A||!t.current||(r.current=!0,t.current.stop())},[A]),l=mt.useCallback(()=>{!A||!t.current||t.current.stop()},[A]);return{startRecording:mt.useCallback(i=>{if(A||!e)return;h(!1),T(void 0),clearTimeout(g),r.current=!1;let{min_decibels:d,silence_timeout:f,initial_silence_timeout:v,chunk_duration:m,max_duration:p}=e;navigator.mediaDevices.getUserMedia({audio:!0}).then(C=>{let w=!1,I=!1,S=!0,y=null,R=Date.now(),L=new MediaRecorder(C);t.current=L,L.addEventListener("start",()=>{c(!0),R=Date.now()}),L.addEventListener("dataavailable",async P=>{if(w||(y?y=new Blob([y,P.data],{type:P.data.type}):y=new Blob([P.data],{type:P.data.type})),L.state==="inactive")return;let N=Date.now()-R;if(N>=p){L.stop(),C.getTracks().forEach(Y=>Y.stop());return}_(I);let[U,B]=L.mimeType.split(";");y?(await a(S,U,N,new Blob([y,P.data])),y=null):await a(S,U,N,P.data),S&&(S=!1)}),L.addEventListener("stop",async()=>{c(!1),_(!1),w&&!r.current&&(h(!0),await u(i))});let D=new AudioContext,F=D.createMediaStreamSource(C),M=D.createAnalyser();M.minDecibels=d,F.connect(M);let k=M.frequencyBinCount,O=new Uint8Array(k);L.start(m);let b=()=>{if(L.state==="inactive")return;M.getByteFrequencyData(O);let P=O.some(N=>N>0);I||(I=P),!w&&P&&(_(I),w=!0),requestAnimationFrame(b)};b(),setTimeout(()=>{w?n(setInterval(()=>{I?I=!1:(L.stop(),C.getTracks().forEach(P=>P.stop()))},f)):(L.stop(),C.getTracks().forEach(P=>P.stop()))},v)}).catch(C=>{T(C.message)})},[g,A,e,a,u]),stopRecording:l,cancelRecording:x,isRecording:A,isSpeaking:s,isRecordingFinished:E,error:o}},xl=e=>{let[t,r]=hu(c8e),{isAuthenticated:a}=s0(),u=navigator.language||"en-US",{data:A,error:c,isLoading:g}=v6(!t&&a?`/project/settings?language=${u}`:null,{token:e});return mt.useEffect(()=>{A&&r(A)},[A,r]),{config:t,error:c,isLoading:g,language:u}};function y8e(e){const t=e,r=()=>{lv.error("Unauthorized")},a=u=>{lv.error(u.toString())};return new pte(t,"copilot",r,a)}const b8e={accessToken:void 0},m6=mt.createContext(b8e);let g6;const _8e=new Uint8Array(16);function x8e(){if(!g6&&(g6=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!g6))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return g6(_8e)}const af=[];for(let e=0;e<256;++e)af.push((e+256).toString(16).slice(1));function E8e(e,t=0){return(af[e[t+0]]+af[e[t+1]]+af[e[t+2]]+af[e[t+3]]+"-"+af[e[t+4]]+af[e[t+5]]+"-"+af[e[t+6]]+af[e[t+7]]+"-"+af[e[t+8]]+af[e[t+9]]+"-"+af[e[t+10]]+af[e[t+11]]+af[e[t+12]]+af[e[t+13]]+af[e[t+14]]+af[e[t+15]]).toLowerCase()}const vte={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ZP(e,t,r){if(vte.randomUUID&&!t&&!e)return vte.randomUUID();e=e||{};const a=e.random||(e.rng||x8e)();return a[6]=a[6]&15|64,a[8]=a[8]&63|128,E8e(a)}const Q2={black:"#000",white:"#fff"},dE={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},hE={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},pE={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},vE={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},mE={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},Z2={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},mte={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function Sg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function gte(e){if(!Sg(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=gte(e[r])}),t}function Of(e,t,r={clone:!0}){const a=r.clone?lr({},e):e;return Sg(e)&&Sg(t)&&Object.keys(t).forEach(u=>{u!=="__proto__"&&(Sg(t[u])&&u in e&&Sg(e[u])?a[u]=Of(e[u],t[u],r):r.clone?a[u]=Sg(t[u])?gte(t[u]):t[u]:a[u]=t[u])}),a}function Y1(e){let t="https://mui.com/production-error/?code="+e;for(let r=1;r<arguments.length;r+=1)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified MUI error #"+e+"; visit "+t+" for the full message."}var Gs={};/**
86
86
  * @license React
87
87
  * react-is.production.min.js
88
88
  *
@@ -1 +1 @@
1
- import{g as P,r as v,u as D,a as O}from"./index-DLRdQOIx.js";function b(t,e){for(var r=0;r<e.length;r++){const o=e[r];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in t)){const i=Object.getOwnPropertyDescriptor(o,a);i&&Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D};
1
+ import{g as P,r as v,u as D,a as O}from"./index-DnjoDoLU.js";function b(t,e){for(var r=0;r<e.length;r++){const o=e[r];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in t)){const i=Object.getOwnPropertyDescriptor(o,a);i&&Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D};
@@ -1 +1 @@
1
- import{g as _,r as g,u as P,a as m}from"./index-DLRdQOIx.js";function v(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in t)){const p=Object.getOwnPropertyDescriptor(a,s);p&&Object.defineProperty(t,s,p.get?p:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F};
1
+ import{g as _,r as g,u as P,a as m}from"./index-DnjoDoLU.js";function v(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in t)){const p=Object.getOwnPropertyDescriptor(a,s);p&&Object.defineProperty(t,s,p.get?p:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F};
@@ -1 +1 @@
1
- import{g as b,r as _,u as O,a as A}from"./index-DLRdQOIx.js";function R(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in s)){const l=Object.getOwnPropertyDescriptor(i,n);l&&Object.defineProperty(s,n,l.get?l:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var I=Object.create,u=Object.defineProperty,D=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,U=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},E=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!k.call(s,n)&&n!==t&&u(s,n,{get:()=>e[n],enumerable:!(i=D(e,n))||i.enumerable});return s},j=(s,e,t)=>(t=s!=null?I(M(s)):{},E(!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),H=s=>E(u({},"__esModule",{value:!0}),s),r=(s,e,t)=>(U(s,typeof e!="symbol"?e+"":e,t),t),m={};N(m,{default:()=>P});var g=H(m),d=j(_),a=O,c=A;const y=typeof navigator<"u",F=y&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,v=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||F)&&!window.MSStream,V=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,T="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",C="Hls",B="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",x="dashjs",K="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",G="flvjs",X=/www\.dropbox\.com\/.+/,f=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,W="https://videodelivery.net/{id}/manifest/video.m3u8";class P extends d.Component{constructor(){super(...arguments),r(this,"onReady",(...e)=>this.props.onReady(...e)),r(this,"onPlay",(...e)=>this.props.onPlay(...e)),r(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),r(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),r(this,"onPause",(...e)=>this.props.onPause(...e)),r(this,"onEnded",(...e)=>this.props.onEnded(...e)),r(this,"onError",(...e)=>this.props.onError(...e)),r(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),r(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),r(this,"onDisablePIP",e=>{const{onDisablePIP:t,playing:i}=this.props;t(e),i&&this.play()}),r(this,"onPresentationModeChange",e=>{if(this.player&&(0,a.supportsWebKitPresentationMode)(this.player)){const{webkitPresentationMode:t}=this.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}}),r(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),r(this,"mute",()=>{this.player.muted=!0}),r(this,"unmute",()=>{this.player.muted=!1}),r(this,"renderSourceElement",(e,t)=>typeof e=="string"?d.default.createElement("source",{key:t,src:e}):d.default.createElement("source",{key:t,...e})),r(this,"renderTrack",(e,t)=>d.default.createElement("track",{key:t,...e})),r(this,"ref",e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getSource(this.props.url);e&&(this.player.src=e),(v||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,a.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute("src"),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){const{url:t,playsinline:i}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),i&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))}removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:c.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return V&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:v||this.props.config.forceDisableHls?!1:c.HLS_EXTENSIONS.test(e)||f.test(e)}shouldUseDASH(e){return c.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return c.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){const{hlsVersion:t,hlsOptions:i,dashVersion:n,flvVersion:l}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,a.getSDK)(T.replace("VERSION",t),C).then(o=>{if(this.hls=new o(i),this.hls.on(o.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.hls,o)}),f.test(e)){const h=e.match(f)[1];this.hls.loadSource(W.replace("{id}",h))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,a.getSDK)(B.replace("VERSION",n),x).then(o=>{this.dash=o.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on("error",this.props.onError),parseInt(n)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:o.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,a.getSDK)(K.replace("VERSION",l),G).then(o=>{this.flv=o.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.player),this.flv.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.flv,o)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,a.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute("src"),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="picture-in-picture"&&this.player.webkitSetPresentationMode("picture-in-picture")}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="inline"&&this.player.webkitSetPresentationMode("inline")}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getSource(e){const t=this.shouldUseHLS(e),i=this.shouldUseDASH(e),n=this.shouldUseFLV(e);if(!(e instanceof Array||(0,a.isMediaStream)(e)||t||i||n))return X.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e}render(){const{url:e,playing:t,loop:i,controls:n,muted:l,config:o,width:h,height:p}=this.props,L=this.shouldUseAudio(this.props)?"audio":"video",S={width:h==="auto"?h:"100%",height:p==="auto"?p:"100%"};return d.default.createElement(L,{ref:this.ref,src:this.getSource(e),style:S,preload:"auto",autoPlay:t||void 0,controls:n,muted:l,loop:i,...o.attributes},e instanceof Array&&e.map(this.renderSourceElement),o.tracks.map(this.renderTrack))}}r(P,"displayName","FilePlayer");r(P,"canPlay",c.canPlay.file);const z=b(g),J=R({__proto__:null,default:z},[g]);export{J as F};
1
+ import{g as b,r as _,u as O,a as A}from"./index-DnjoDoLU.js";function R(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in s)){const l=Object.getOwnPropertyDescriptor(i,n);l&&Object.defineProperty(s,n,l.get?l:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var I=Object.create,u=Object.defineProperty,D=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,U=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},E=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!k.call(s,n)&&n!==t&&u(s,n,{get:()=>e[n],enumerable:!(i=D(e,n))||i.enumerable});return s},j=(s,e,t)=>(t=s!=null?I(M(s)):{},E(!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),H=s=>E(u({},"__esModule",{value:!0}),s),r=(s,e,t)=>(U(s,typeof e!="symbol"?e+"":e,t),t),m={};N(m,{default:()=>P});var g=H(m),d=j(_),a=O,c=A;const y=typeof navigator<"u",F=y&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,v=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||F)&&!window.MSStream,V=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,T="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",C="Hls",B="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",x="dashjs",K="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",G="flvjs",X=/www\.dropbox\.com\/.+/,f=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,W="https://videodelivery.net/{id}/manifest/video.m3u8";class P extends d.Component{constructor(){super(...arguments),r(this,"onReady",(...e)=>this.props.onReady(...e)),r(this,"onPlay",(...e)=>this.props.onPlay(...e)),r(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),r(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),r(this,"onPause",(...e)=>this.props.onPause(...e)),r(this,"onEnded",(...e)=>this.props.onEnded(...e)),r(this,"onError",(...e)=>this.props.onError(...e)),r(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),r(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),r(this,"onDisablePIP",e=>{const{onDisablePIP:t,playing:i}=this.props;t(e),i&&this.play()}),r(this,"onPresentationModeChange",e=>{if(this.player&&(0,a.supportsWebKitPresentationMode)(this.player)){const{webkitPresentationMode:t}=this.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}}),r(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),r(this,"mute",()=>{this.player.muted=!0}),r(this,"unmute",()=>{this.player.muted=!1}),r(this,"renderSourceElement",(e,t)=>typeof e=="string"?d.default.createElement("source",{key:t,src:e}):d.default.createElement("source",{key:t,...e})),r(this,"renderTrack",(e,t)=>d.default.createElement("track",{key:t,...e})),r(this,"ref",e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getSource(this.props.url);e&&(this.player.src=e),(v||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,a.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute("src"),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){const{url:t,playsinline:i}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),i&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))}removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:c.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return V&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:v||this.props.config.forceDisableHls?!1:c.HLS_EXTENSIONS.test(e)||f.test(e)}shouldUseDASH(e){return c.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return c.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){const{hlsVersion:t,hlsOptions:i,dashVersion:n,flvVersion:l}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,a.getSDK)(T.replace("VERSION",t),C).then(o=>{if(this.hls=new o(i),this.hls.on(o.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.hls,o)}),f.test(e)){const h=e.match(f)[1];this.hls.loadSource(W.replace("{id}",h))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,a.getSDK)(B.replace("VERSION",n),x).then(o=>{this.dash=o.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on("error",this.props.onError),parseInt(n)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:o.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,a.getSDK)(K.replace("VERSION",l),G).then(o=>{this.flv=o.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.player),this.flv.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.flv,o)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,a.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute("src"),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="picture-in-picture"&&this.player.webkitSetPresentationMode("picture-in-picture")}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="inline"&&this.player.webkitSetPresentationMode("inline")}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getSource(e){const t=this.shouldUseHLS(e),i=this.shouldUseDASH(e),n=this.shouldUseFLV(e);if(!(e instanceof Array||(0,a.isMediaStream)(e)||t||i||n))return X.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e}render(){const{url:e,playing:t,loop:i,controls:n,muted:l,config:o,width:h,height:p}=this.props,L=this.shouldUseAudio(this.props)?"audio":"video",S={width:h==="auto"?h:"100%",height:p==="auto"?p:"100%"};return d.default.createElement(L,{ref:this.ref,src:this.getSource(e),style:S,preload:"auto",autoPlay:t||void 0,controls:n,muted:l,loop:i,...o.attributes},e instanceof Array&&e.map(this.renderSourceElement),o.tracks.map(this.renderTrack))}}r(P,"displayName","FilePlayer");r(P,"canPlay",c.canPlay.file);const z=b(g),J=R({__proto__:null,default:z},[g]);export{J as F};
@@ -1 +1 @@
1
- import{g as y,r as f,u as _,a as m}from"./index-DLRdQOIx.js";function P(r,e){for(var t=0;t<e.length;t++){const o=e[t];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in r)){const l=Object.getOwnPropertyDescriptor(o,a);l&&Object.defineProperty(r,a,l.get?l:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,j=(r,e,t)=>e in r?n(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},c=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!w.call(r,a)&&a!==t&&n(r,a,{get:()=>e[a],enumerable:!(o=b(e,a))||o.enumerable});return r},K=(r,e,t)=>(t=r!=null?g(O(r)):{},c(!r||!r.__esModule?n(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>c(n({},"__esModule",{value:!0}),r),s=(r,e,t)=>(j(r,typeof e!="symbol"?e+"":e,t),t),d={};L(d,{default:()=>i});var h=D(d),u=K(f),p=_,M=m;const S="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends u.Component{constructor(){super(...arguments),s(this,"callPlayer",p.callPlayer),s(this,"duration",null),s(this,"currentTime",null),s(this,"secondsLoaded",null),s(this,"mute",()=>{this.callPlayer("mute")}),s(this,"unmute",()=>{this.callPlayer("unmute")}),s(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,p.getSDK)(S,T).then(t=>{this.iframe&&(this.player=new t.Player(this.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on("play",t.onPlay),e.on("pause",t.onPause),e.on("ended",t.onEnded),e.on("error",t.onError),e.on("timeupdate",({duration:o,seconds:a})=>{this.duration=o,this.currentTime=a})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("setCurrentTime",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e={width:"100%",height:"100%"};return u.default.createElement("iframe",{ref:this.ref,src:this.props.url,frameBorder:"0",scrolling:"no",style:e,allow:"encrypted-media; autoplay; fullscreen;",referrerPolicy:"no-referrer-when-downgrade"})}}s(i,"displayName","Kaltura");s(i,"canPlay",M.canPlay.kaltura);const E=y(h),N=P({__proto__:null,default:E},[h]);export{N as K};
1
+ import{g as y,r as f,u as _,a as m}from"./index-DnjoDoLU.js";function P(r,e){for(var t=0;t<e.length;t++){const o=e[t];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in r)){const l=Object.getOwnPropertyDescriptor(o,a);l&&Object.defineProperty(r,a,l.get?l:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,j=(r,e,t)=>e in r?n(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},c=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!w.call(r,a)&&a!==t&&n(r,a,{get:()=>e[a],enumerable:!(o=b(e,a))||o.enumerable});return r},K=(r,e,t)=>(t=r!=null?g(O(r)):{},c(!r||!r.__esModule?n(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>c(n({},"__esModule",{value:!0}),r),s=(r,e,t)=>(j(r,typeof e!="symbol"?e+"":e,t),t),d={};L(d,{default:()=>i});var h=D(d),u=K(f),p=_,M=m;const S="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends u.Component{constructor(){super(...arguments),s(this,"callPlayer",p.callPlayer),s(this,"duration",null),s(this,"currentTime",null),s(this,"secondsLoaded",null),s(this,"mute",()=>{this.callPlayer("mute")}),s(this,"unmute",()=>{this.callPlayer("unmute")}),s(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,p.getSDK)(S,T).then(t=>{this.iframe&&(this.player=new t.Player(this.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on("play",t.onPlay),e.on("pause",t.onPause),e.on("ended",t.onEnded),e.on("error",t.onError),e.on("timeupdate",({duration:o,seconds:a})=>{this.duration=o,this.currentTime=a})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("setCurrentTime",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e={width:"100%",height:"100%"};return u.default.createElement("iframe",{ref:this.ref,src:this.props.url,frameBorder:"0",scrolling:"no",style:e,allow:"encrypted-media; autoplay; fullscreen;",referrerPolicy:"no-referrer-when-downgrade"})}}s(i,"displayName","Kaltura");s(i,"canPlay",M.canPlay.kaltura);const E=y(h),N=P({__proto__:null,default:E},[h]);export{N as K};
@@ -1 +1 @@
1
- import{g as _,r as f,u as m,a as g}from"./index-DLRdQOIx.js";function v(t,e){for(var r=0;r<e.length;r++){const s=e[r];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in t)){const n=Object.getOwnPropertyDescriptor(s,o);n&&Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,i=Object.defineProperty,O=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,M=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!w.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=O(e,o))||s.enumerable});return t},D=(t,e,r)=>(r=t!=null?P(M(t)):{},c(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(i({},"__esModule",{value:!0}),t),a=(t,e,r)=>(x(t,typeof e!="symbol"?e+"":e,r),r),d={};j(d,{default:()=>l});var h=S(d),p=D(f),u=m,y=g;const E="https://widget.mixcloud.com/media/js/widgetApi.js",L="Mixcloud";class l extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",u.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"secondsLoaded",null),a(this,"mute",()=>{}),a(this,"unmute",()=>{}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,L).then(r=>{this.player=r.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((s,o)=>{this.currentTime=s,this.duration=o}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){const{url:e,config:r}=this.props,s=e.match(y.MATCH_URL_MIXCLOUD)[1],o={width:"100%",height:"100%"},n=(0,u.queryString)({...r.options,feed:`/${s}/`});return p.default.createElement("iframe",{key:s,ref:this.ref,style:o,src:`https://www.mixcloud.com/widget/iframe/?${n}`,frameBorder:"0",allow:"autoplay"})}}a(l,"displayName","Mixcloud");a(l,"canPlay",y.canPlay.mixcloud);a(l,"loopOnEnded",!0);const T=_(h),N=v({__proto__:null,default:T},[h]);export{N as M};
1
+ import{g as _,r as f,u as m,a as g}from"./index-DnjoDoLU.js";function v(t,e){for(var r=0;r<e.length;r++){const s=e[r];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in t)){const n=Object.getOwnPropertyDescriptor(s,o);n&&Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,i=Object.defineProperty,O=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,M=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!w.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=O(e,o))||s.enumerable});return t},D=(t,e,r)=>(r=t!=null?P(M(t)):{},c(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(i({},"__esModule",{value:!0}),t),a=(t,e,r)=>(x(t,typeof e!="symbol"?e+"":e,r),r),d={};j(d,{default:()=>l});var h=S(d),p=D(f),u=m,y=g;const E="https://widget.mixcloud.com/media/js/widgetApi.js",L="Mixcloud";class l extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",u.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"secondsLoaded",null),a(this,"mute",()=>{}),a(this,"unmute",()=>{}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,L).then(r=>{this.player=r.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((s,o)=>{this.currentTime=s,this.duration=o}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){const{url:e,config:r}=this.props,s=e.match(y.MATCH_URL_MIXCLOUD)[1],o={width:"100%",height:"100%"},n=(0,u.queryString)({...r.options,feed:`/${s}/`});return p.default.createElement("iframe",{key:s,ref:this.ref,style:o,src:`https://www.mixcloud.com/widget/iframe/?${n}`,frameBorder:"0",allow:"autoplay"})}}a(l,"displayName","Mixcloud");a(l,"canPlay",y.canPlay.mixcloud);a(l,"loopOnEnded",!0);const T=_(h),N=v({__proto__:null,default:T},[h]);export{N as M};
@@ -1 +1 @@
1
- import{g as m,_ as E,r as g,a as _}from"./index-DLRdQOIx.js";function b(r,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in r)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(r,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var L=Object.create,u=Object.defineProperty,I=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,M=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!x.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(i=I(e,s))||i.enumerable});return r},w=(r,e,t)=>(t=r!=null?L(O(r)):{},f(!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>f(u({},"__esModule",{value:!0}),r),n=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),y={};R(y,{default:()=>l});var P=D(y),v=w(g),p=_;const j="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";class l extends v.Component{constructor(){super(...arguments),n(this,"onReady",(...e)=>this.props.onReady(...e)),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),n(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onError",(...e)=>this.props.onError(...e)),n(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),n(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),n(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.player.muted=!0}),n(this,"unmute",()=>{this.player.muted=!1}),n(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){const{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;const{onError:i,config:s}=this.props;if(!((t=globalThis.customElements)!=null&&t.get("mux-player")))try{const a=j.replace("VERSION",s.version);await E(()=>import(`${a}`),[]),this.props.onLoaded()}catch(a){i(a)}const[,o]=e.match(p.MATCH_URL_MUX);this.player.playbackId=o}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getPlaybackId(e){const[,t]=e.match(p.MATCH_URL_MUX);return t}render(){const{url:e,playing:t,loop:i,controls:s,muted:o,config:a,width:h,height:c}=this.props,d={width:h==="auto"?h:"100%",height:c==="auto"?c:"100%"};return s===!1&&(d["--controls"]="none"),v.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:d,preload:"auto",autoPlay:t||void 0,muted:o?"":void 0,loop:i?"":void 0,...a.attributes})}}n(l,"displayName","Mux");n(l,"canPlay",p.canPlay.mux);const C=m(P),B=b({__proto__:null,default:C},[P]);export{B as M};
1
+ import{g as m,_ as E,r as g,a as _}from"./index-DnjoDoLU.js";function b(r,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in r)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(r,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var L=Object.create,u=Object.defineProperty,I=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,M=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!x.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(i=I(e,s))||i.enumerable});return r},w=(r,e,t)=>(t=r!=null?L(O(r)):{},f(!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>f(u({},"__esModule",{value:!0}),r),n=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),y={};R(y,{default:()=>l});var P=D(y),v=w(g),p=_;const j="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";class l extends v.Component{constructor(){super(...arguments),n(this,"onReady",(...e)=>this.props.onReady(...e)),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),n(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onError",(...e)=>this.props.onError(...e)),n(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),n(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),n(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.player.muted=!0}),n(this,"unmute",()=>{this.player.muted=!1}),n(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){const{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;const{onError:i,config:s}=this.props;if(!((t=globalThis.customElements)!=null&&t.get("mux-player")))try{const a=j.replace("VERSION",s.version);await E(()=>import(`${a}`),[]),this.props.onLoaded()}catch(a){i(a)}const[,o]=e.match(p.MATCH_URL_MUX);this.player.playbackId=o}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getPlaybackId(e){const[,t]=e.match(p.MATCH_URL_MUX);return t}render(){const{url:e,playing:t,loop:i,controls:s,muted:o,config:a,width:h,height:c}=this.props,d={width:h==="auto"?h:"100%",height:c==="auto"?c:"100%"};return s===!1&&(d["--controls"]="none"),v.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:d,preload:"auto",autoPlay:t||void 0,muted:o?"":void 0,loop:i?"":void 0,...a.attributes})}}n(l,"displayName","Mux");n(l,"canPlay",p.canPlay.mux);const C=m(P),B=b({__proto__:null,default:C},[P]);export{B as M};
@@ -1 +1 @@
1
- import{g as y,r as v}from"./index-DLRdQOIx.js";function w(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in r)){const o=Object.getOwnPropertyDescriptor(n,a);o&&Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,s=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,I=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,E=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!j.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(n=O(e,a))||n.enumerable});return r},C=(r,e,t)=>(t=r!=null?P(I(r)):{},_(!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r)),N=r=>_(s({},"__esModule",{value:!0}),r),p=(r,e,t)=>(E(r,typeof e!="symbol"?e+"":e,t),t),g={};S(g,{default:()=>k});var m=N(g),i=C(v);const u="64px",d={};class k extends i.Component{constructor(){super(...arguments),p(this,"mounted",!1),p(this,"state",{image:null}),p(this,"handleKeyPress",e=>{(e.key==="Enter"||e.key===" ")&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){const{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!i.default.isValidElement(t)){if(typeof t=="string"){this.setState({image:t});return}if(d[e]){this.setState({image:d[e]});return}return this.setState({image:null}),window.fetch(n.replace("{url}",e)).then(a=>a.json()).then(a=>{if(a.thumbnail_url&&this.mounted){const o=a.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");this.setState({image:o}),d[e]=o}})}}render(){const{light:e,onClick:t,playIcon:n,previewTabIndex:a,previewAriaLabel:o}=this.props,{image:f}=this.state,l=i.default.isValidElement(e),h={display:"flex",alignItems:"center",justifyContent:"center"},c={preview:{width:"100%",height:"100%",backgroundImage:f&&!l?`url(${f})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...h},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:u,width:u,height:u,position:l?"absolute":void 0,...h},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},b=i.default.createElement("div",{style:c.shadow,className:"react-player__shadow"},i.default.createElement("div",{style:c.playIcon,className:"react-player__play-icon"}));return i.default.createElement("div",{style:c.preview,className:"react-player__preview",onClick:t,tabIndex:a,onKeyPress:this.handleKeyPress,...o?{"aria-label":o}:{}},l?e:null,n||b)}}const D=y(m),A=w({__proto__:null,default:D},[m]);export{A as P};
1
+ import{g as y,r as v}from"./index-DnjoDoLU.js";function w(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in r)){const o=Object.getOwnPropertyDescriptor(n,a);o&&Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,s=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,I=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,E=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!j.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(n=O(e,a))||n.enumerable});return r},C=(r,e,t)=>(t=r!=null?P(I(r)):{},_(!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r)),N=r=>_(s({},"__esModule",{value:!0}),r),p=(r,e,t)=>(E(r,typeof e!="symbol"?e+"":e,t),t),g={};S(g,{default:()=>k});var m=N(g),i=C(v);const u="64px",d={};class k extends i.Component{constructor(){super(...arguments),p(this,"mounted",!1),p(this,"state",{image:null}),p(this,"handleKeyPress",e=>{(e.key==="Enter"||e.key===" ")&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){const{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!i.default.isValidElement(t)){if(typeof t=="string"){this.setState({image:t});return}if(d[e]){this.setState({image:d[e]});return}return this.setState({image:null}),window.fetch(n.replace("{url}",e)).then(a=>a.json()).then(a=>{if(a.thumbnail_url&&this.mounted){const o=a.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");this.setState({image:o}),d[e]=o}})}}render(){const{light:e,onClick:t,playIcon:n,previewTabIndex:a,previewAriaLabel:o}=this.props,{image:f}=this.state,l=i.default.isValidElement(e),h={display:"flex",alignItems:"center",justifyContent:"center"},c={preview:{width:"100%",height:"100%",backgroundImage:f&&!l?`url(${f})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...h},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:u,width:u,height:u,position:l?"absolute":void 0,...h},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},b=i.default.createElement("div",{style:c.shadow,className:"react-player__shadow"},i.default.createElement("div",{style:c.playIcon,className:"react-player__play-icon"}));return i.default.createElement("div",{style:c.preview,className:"react-player__preview",onClick:t,tabIndex:a,onKeyPress:this.handleKeyPress,...o?{"aria-label":o}:{}},l?e:null,n||b)}}const D=y(m),A=w({__proto__:null,default:D},[m]);export{A as P};